/*! jQuery v2.2.0 | (c) jQuery Foundation | jquery.org/license */
!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){var i=[],a=e.document,r=i.slice,o=i.concat,n=i.push,s=i.indexOf,l={},d=l.toString,c=l.hasOwnProperty,u={},p="2.2.0",h=function(e,t){return new h.fn.init(e,t)},m=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,f=/^-ms-/,g=/-([\da-z])/gi,v=function(e,t){return t.toUpperCase()};function A(e){var t=!!e&&"length"in e&&e.length,i=h.type(e);return"function"!==i&&!h.isWindow(e)&&("array"===i||0===t||"number"==typeof t&&t>0&&t-1 in e)}h.fn=h.prototype={jquery:p,constructor:h,selector:"",length:0,toArray:function(){return r.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:r.call(this)},pushStack:function(e){var t=h.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return h.each(this,e)},map:function(e){return this.pushStack(h.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack(r.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,i=+e+(0>e?t:0);return this.pushStack(i>=0&&t>i?[this[i]]:[])},end:function(){return this.prevObject||this.constructor()},push:n,sort:i.sort,splice:i.splice},h.extend=h.fn.extend=function(){var e,t,i,a,r,o,n=arguments[0]||{},s=1,l=arguments.length,d=!1;for("boolean"==typeof n&&(d=n,n=arguments[s]||{},s++),"object"==typeof n||h.isFunction(n)||(n={}),s===l&&(n=this,s--);l>s;s++)if(null!=(e=arguments[s]))for(t in e)i=n[t],n!==(a=e[t])&&(d&&a&&(h.isPlainObject(a)||(r=h.isArray(a)))?(r?(r=!1,o=i&&h.isArray(i)?i:[]):o=i&&h.isPlainObject(i)?i:{},n[t]=h.extend(d,o,a)):void 0!==a&&(n[t]=a));return n},h.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===h.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){var t=e&&e.toString();return!h.isArray(e)&&t-parseFloat(t)+1>=0},isPlainObject:function(e){return"object"===h.type(e)&&!e.nodeType&&!h.isWindow(e)&&!(e.constructor&&!c.call(e.constructor.prototype,"isPrototypeOf"))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[d.call(e)]||"object":typeof e},globalEval:function(e){var t,i=eval;(e=h.trim(e))&&(1===e.indexOf("use strict")?((t=a.createElement("script")).text=e,a.head.appendChild(t).parentNode.removeChild(t)):i(e))},camelCase:function(e){return e.replace(f,"ms-").replace(g,v)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var i,a=0;if(A(e))for(i=e.length;i>a&&!1!==t.call(e[a],a,e[a]);a++);else for(a in e)if(!1===t.call(e[a],a,e[a]))break;return e},trim:function(e){return null==e?"":(e+"").replace(m,"")},makeArray:function(e,t){var i=t||[];return null!=e&&(A(Object(e))?h.merge(i,"string"==typeof e?[e]:e):n.call(i,e)),i},inArray:function(e,t,i){return null==t?-1:s.call(t,e,i)},merge:function(e,t){for(var i=+t.length,a=0,r=e.length;i>a;a++)e[r++]=t[a];return e.length=r,e},grep:function(e,t,i){for(var a=[],r=0,o=e.length,n=!i;o>r;r++)!t(e[r],r)!==n&&a.push(e[r]);return a},map:function(e,t,i){var a,r,n=0,s=[];if(A(e))for(a=e.length;a>n;n++)null!=(r=t(e[n],n,i))&&s.push(r);else for(n in e)null!=(r=t(e[n],n,i))&&s.push(r);return o.apply([],s)},guid:1,proxy:function(e,t){var i,a,o;return"string"==typeof t&&(i=e[t],t=e,e=i),h.isFunction(e)?(a=r.call(arguments,2),o=function(){return e.apply(t||this,a.concat(r.call(arguments)))},o.guid=e.guid=e.guid||h.guid++,o):void 0},now:Date.now,support:u}),"function"==typeof Symbol&&(h.fn[Symbol.iterator]=i[Symbol.iterator]),h.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});var C=function(e){var t,i,a,r,o,n,s,l,d,c,u,p,h,m,f,g,v,A,C,y="sizzle"+1*new Date,b=e.document,S=0,k=0,D=oe(),_=oe(),I=oe(),w=function(e,t){return e===t&&(u=!0),0},P=1<<31,T={}.hasOwnProperty,B=[],x=B.pop,F=B.push,O=B.push,M=B.slice,E=function(e,t){for(var i=0,a=e.length;a>i;i++)if(e[i]===t)return i;return-1},$="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",N="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",U="\\["+N+"*("+L+")(?:"+N+"*([*^$|!~]?=)"+N+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+N+"*\\]",R=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+U+")*)|.*)\\)|)",G=new RegExp(N+"+","g"),W=new RegExp("^"+N+"+|((?:^|[^\\\\])(?:\\\\.)*)"+N+"+$","g"),V=new RegExp("^"+N+"*,"+N+"*"),j=new RegExp("^"+N+"*([>+~]|"+N+")"+N+"*"),H=new RegExp("="+N+"*([^\\]'\"]*?)"+N+"*\\]","g"),Y=new RegExp(R),Z=new RegExp("^"+L+"$"),z={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+U),PSEUDO:new RegExp("^"+R),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+N+"*(even|odd|(([+-]|)(\\d*)n|)"+N+"*(?:([+-]|)"+N+"*(\\d+)|))"+N+"*\\)|)","i"),bool:new RegExp("^(?:"+$+")$","i"),needsContext:new RegExp("^"+N+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+N+"*((?:-\\d)?\\d*)"+N+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,ee=/'|\\/g,te=new RegExp("\\\\([\\da-f]{1,6}"+N+"?|("+N+")|.)","ig"),ie=function(e,t,i){var a="0x"+t-65536;return a!=a||i?t:0>a?String.fromCharCode(a+65536):String.fromCharCode(a>>10|55296,1023&a|56320)},ae=function(){p()};try{O.apply(B=M.call(b.childNodes),b.childNodes),B[b.childNodes.length].nodeType}catch(e){O={apply:B.length?function(e,t){F.apply(e,M.call(t))}:function(e,t){for(var i=e.length,a=0;e[i++]=t[a++];);e.length=i-1}}}function re(e,t,a,r){var o,s,d,c,u,m,v,A,S=t&&t.ownerDocument,k=t?t.nodeType:9;if(a=a||[],"string"!=typeof e||!e||1!==k&&9!==k&&11!==k)return a;if(!r&&((t?t.ownerDocument||t:b)!==h&&p(t),t=t||h,f)){if(11!==k&&(m=Q.exec(e)))if(o=m[1]){if(9===k){if(!(d=t.getElementById(o)))return a;if(d.id===o)return a.push(d),a}else if(S&&(d=S.getElementById(o))&&C(t,d)&&d.id===o)return a.push(d),a}else{if(m[2])return O.apply(a,t.getElementsByTagName(e)),a;if((o=m[3])&&i.getElementsByClassName&&t.getElementsByClassName)return O.apply(a,t.getElementsByClassName(o)),a}if(i.qsa&&!I[e+" "]&&(!g||!g.test(e))){if(1!==k)S=t,A=e;else if("object"!==t.nodeName.toLowerCase()){for((c=t.getAttribute("id"))?c=c.replace(ee,"\\$&"):t.setAttribute("id",c=y),s=(v=n(e)).length,u=Z.test(c)?"#"+c:"[id='"+c+"']";s--;)v[s]=u+" "+fe(v[s]);A=v.join(","),S=K.test(e)&&he(t.parentNode)||t}if(A)try{return O.apply(a,S.querySelectorAll(A)),a}catch(e){}finally{c===y&&t.removeAttribute("id")}}}return l(e.replace(W,"$1"),t,a,r)}function oe(){var e=[];return function t(i,r){return e.push(i+" ")>a.cacheLength&&delete t[e.shift()],t[i+" "]=r}}function ne(e){return e[y]=!0,e}function se(e){var t=h.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var i=e.split("|"),r=i.length;r--;)a.attrHandle[i[r]]=t}function de(e,t){var i=t&&e,a=i&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||P)-(~e.sourceIndex||P);if(a)return a;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function ce(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function ue(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}}function pe(e){return ne(function(t){return t=+t,ne(function(i,a){for(var r,o=e([],i.length,t),n=o.length;n--;)i[r=o[n]]&&(i[r]=!(a[r]=i[r]))})})}function he(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in i=re.support={},o=re.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=re.setDocument=function(e){var t,r,n=e?e.ownerDocument||e:b;return n!==h&&9===n.nodeType&&n.documentElement?(m=(h=n).documentElement,f=!o(h),(r=h.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ae,!1):r.attachEvent&&r.attachEvent("onunload",ae)),i.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),i.getElementsByTagName=se(function(e){return e.appendChild(h.createComment("")),!e.getElementsByTagName("*").length}),i.getElementsByClassName=J.test(h.getElementsByClassName),i.getById=se(function(e){return m.appendChild(e).id=y,!h.getElementsByName||!h.getElementsByName(y).length}),i.getById?(a.find.ID=function(e,t){if(void 0!==t.getElementById&&f){var i=t.getElementById(e);return i?[i]:[]}},a.filter.ID=function(e){var t=e.replace(te,ie);return function(e){return e.getAttribute("id")===t}}):(delete a.find.ID,a.filter.ID=function(e){var t=e.replace(te,ie);return function(e){var i=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return i&&i.value===t}}),a.find.TAG=i.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):i.qsa?t.querySelectorAll(e):void 0}:function(e,t){var i,a=[],r=0,o=t.getElementsByTagName(e);if("*"===e){for(;i=o[r++];)1===i.nodeType&&a.push(i);return a}return o},a.find.CLASS=i.getElementsByClassName&&function(e,t){return void 0!==t.getElementsByClassName&&f?t.getElementsByClassName(e):void 0},v=[],g=[],(i.qsa=J.test(h.querySelectorAll))&&(se(function(e){m.appendChild(e).innerHTML="<a id='"+y+"'></a><select id='"+y+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+N+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+N+"*(?:value|"+$+")"),e.querySelectorAll("[id~="+y+"-]").length||g.push("~="),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+y+"+*").length||g.push(".#.+[+~]")}),se(function(e){var t=h.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+N+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(i.matchesSelector=J.test(A=m.matches||m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&se(function(e){i.disconnectedMatch=A.call(e,"div"),A.call(e,"[s!='']:x"),v.push("!=",R)}),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),t=J.test(m.compareDocumentPosition),C=t||J.test(m.contains)?function(e,t){var i=9===e.nodeType?e.documentElement:e,a=t&&t.parentNode;return e===a||!(!a||1!==a.nodeType||!(i.contains?i.contains(a):e.compareDocumentPosition&&16&e.compareDocumentPosition(a)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},w=t?function(e,t){if(e===t)return u=!0,0;var a=!e.compareDocumentPosition-!t.compareDocumentPosition;return a||(1&(a=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!i.sortDetached&&t.compareDocumentPosition(e)===a?e===h||e.ownerDocument===b&&C(b,e)?-1:t===h||t.ownerDocument===b&&C(b,t)?1:c?E(c,e)-E(c,t):0:4&a?-1:1)}:function(e,t){if(e===t)return u=!0,0;var i,a=0,r=e.parentNode,o=t.parentNode,n=[e],s=[t];if(!r||!o)return e===h?-1:t===h?1:r?-1:o?1:c?E(c,e)-E(c,t):0;if(r===o)return de(e,t);for(i=e;i=i.parentNode;)n.unshift(i);for(i=t;i=i.parentNode;)s.unshift(i);for(;n[a]===s[a];)a++;return a?de(n[a],s[a]):n[a]===b?-1:s[a]===b?1:0},h):h},re.matches=function(e,t){return re(e,null,null,t)},re.matchesSelector=function(e,t){if((e.ownerDocument||e)!==h&&p(e),t=t.replace(H,"='$1']"),i.matchesSelector&&f&&!I[t+" "]&&(!v||!v.test(t))&&(!g||!g.test(t)))try{var a=A.call(e,t);if(a||i.disconnectedMatch||e.document&&11!==e.document.nodeType)return a}catch(e){}return re(t,h,null,[e]).length>0},re.contains=function(e,t){return(e.ownerDocument||e)!==h&&p(e),C(e,t)},re.attr=function(e,t){(e.ownerDocument||e)!==h&&p(e);var r=a.attrHandle[t.toLowerCase()],o=r&&T.call(a.attrHandle,t.toLowerCase())?r(e,t,!f):void 0;return void 0!==o?o:i.attributes||!f?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},re.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},re.uniqueSort=function(e){var t,a=[],r=0,o=0;if(u=!i.detectDuplicates,c=!i.sortStable&&e.slice(0),e.sort(w),u){for(;t=e[o++];)t===e[o]&&(r=a.push(o));for(;r--;)e.splice(a[r],1)}return c=null,e},r=re.getText=function(e){var t,i="",a=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=r(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[a++];)i+=r(t);return i},a=re.selectors={cacheLength:50,createPseudo:ne,match:z,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ie),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ie),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||re.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&re.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return z.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&Y.test(i)&&(t=n(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=D[e+" "];return t||(t=new RegExp("(^|"+N+")"+e+"("+N+"|$)"))&&D(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,i){return function(a){var r=re.attr(a,e);return null==r?"!="===t:!t||(r+="","="===t?r===i:"!="===t?r!==i:"^="===t?i&&0===r.indexOf(i):"*="===t?i&&r.indexOf(i)>-1:"$="===t?i&&r.slice(-i.length)===i:"~="===t?(" "+r.replace(G," ")+" ").indexOf(i)>-1:"|="===t&&(r===i||r.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,i,a,r){var o="nth"!==e.slice(0,3),n="last"!==e.slice(-4),s="of-type"===t;return 1===a&&0===r?function(e){return!!e.parentNode}:function(t,i,l){var d,c,u,p,h,m,f=o!==n?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),A=!l&&!s,C=!1;if(g){if(o){for(;f;){for(p=t;p=p[f];)if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;m=f="only"===e&&!m&&"nextSibling"}return!0}if(m=[n?g.firstChild:g.lastChild],n&&A){for(C=(h=(d=(c=(u=(p=g)[y]||(p[y]={}))[p.uniqueID]||(u[p.uniqueID]={}))[e]||[])[0]===S&&d[1])&&d[2],p=h&&g.childNodes[h];p=++h&&p&&p[f]||(C=h=0)||m.pop();)if(1===p.nodeType&&++C&&p===t){c[e]=[S,h,C];break}}else if(A&&(C=h=(d=(c=(u=(p=t)[y]||(p[y]={}))[p.uniqueID]||(u[p.uniqueID]={}))[e]||[])[0]===S&&d[1]),!1===C)for(;(p=++h&&p&&p[f]||(C=h=0)||m.pop())&&((s?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++C||(A&&((c=(u=p[y]||(p[y]={}))[p.uniqueID]||(u[p.uniqueID]={}))[e]=[S,C]),p!==t)););return(C-=r)===a||C%a===0&&C/a>=0}}},PSEUDO:function(e,t){var i,r=a.pseudos[e]||a.setFilters[e.toLowerCase()]||re.error("unsupported pseudo: "+e);return r[y]?r(t):r.length>1?(i=[e,e,"",t],a.setFilters.hasOwnProperty(e.toLowerCase())?ne(function(e,i){for(var a,o=r(e,t),n=o.length;n--;)e[a=E(e,o[n])]=!(i[a]=o[n])}):function(e){return r(e,0,i)}):r}},pseudos:{not:ne(function(e){var t=[],i=[],a=s(e.replace(W,"$1"));return a[y]?ne(function(e,t,i,r){for(var o,n=a(e,null,r,[]),s=e.length;s--;)(o=n[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,a(t,null,o,i),t[0]=null,!i.pop()}}),has:ne(function(e){return function(t){return re(e,t).length>0}}),contains:ne(function(e){return e=e.replace(te,ie),function(t){return(t.textContent||t.innerText||r(t)).indexOf(e)>-1}}),lang:ne(function(e){return Z.test(e||"")||re.error("unsupported lang: "+e),e=e.replace(te,ie).toLowerCase(),function(t){var i;do{if(i=f?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(i=i.toLowerCase())===e||0===i.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var i=e.location&&e.location.hash;return i&&i.slice(1)===t.id},root:function(e){return e===m},focus:function(e){return e===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!a.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return X.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:pe(function(){return[0]}),last:pe(function(e,t){return[t-1]}),eq:pe(function(e,t,i){return[0>i?i+t:i]}),even:pe(function(e,t){for(var i=0;t>i;i+=2)e.push(i);return e}),odd:pe(function(e,t){for(var i=1;t>i;i+=2)e.push(i);return e}),lt:pe(function(e,t,i){for(var a=0>i?i+t:i;--a>=0;)e.push(a);return e}),gt:pe(function(e,t,i){for(var a=0>i?i+t:i;++a<t;)e.push(a);return e})}},a.pseudos.nth=a.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})a.pseudos[t]=ce(t);for(t in{submit:!0,reset:!0})a.pseudos[t]=ue(t);function me(){}function fe(e){for(var t=0,i=e.length,a="";i>t;t++)a+=e[t].value;return a}function ge(e,t,i){var a=t.dir,r=i&&"parentNode"===a,o=k++;return t.first?function(t,i,o){for(;t=t[a];)if(1===t.nodeType||r)return e(t,i,o)}:function(t,i,n){var s,l,d,c=[S,o];if(n){for(;t=t[a];)if((1===t.nodeType||r)&&e(t,i,n))return!0}else for(;t=t[a];)if(1===t.nodeType||r){if((s=(l=(d=t[y]||(t[y]={}))[t.uniqueID]||(d[t.uniqueID]={}))[a])&&s[0]===S&&s[1]===o)return c[2]=s[2];if(l[a]=c,c[2]=e(t,i,n))return!0}}}function ve(e){return e.length>1?function(t,i,a){for(var r=e.length;r--;)if(!e[r](t,i,a))return!1;return!0}:e[0]}function Ae(e,t,i,a,r){for(var o,n=[],s=0,l=e.length,d=null!=t;l>s;s++)(o=e[s])&&(!i||i(o,a,r))&&(n.push(o),d&&t.push(s));return n}function Ce(e,t,i,a,r,o){return a&&!a[y]&&(a=Ce(a)),r&&!r[y]&&(r=Ce(r,o)),ne(function(o,n,s,l){var d,c,u,p=[],h=[],m=n.length,f=o||function(e,t,i){for(var a=0,r=t.length;r>a;a++)re(e,t[a],i);return i}(t||"*",s.nodeType?[s]:s,[]),g=!e||!o&&t?f:Ae(f,p,e,s,l),v=i?r||(o?e:m||a)?[]:n:g;if(i&&i(g,v,s,l),a)for(d=Ae(v,h),a(d,[],s,l),c=d.length;c--;)(u=d[c])&&(v[h[c]]=!(g[h[c]]=u));if(o){if(r||e){if(r){for(d=[],c=v.length;c--;)(u=v[c])&&d.push(g[c]=u);r(null,v=[],d,l)}for(c=v.length;c--;)(u=v[c])&&(d=r?E(o,u):p[c])>-1&&(o[d]=!(n[d]=u))}}else v=Ae(v===n?v.splice(m,v.length):v),r?r(null,n,v,l):O.apply(n,v)})}function ye(e){for(var t,i,r,o=e.length,n=a.relative[e[0].type],s=n||a.relative[" "],l=n?1:0,c=ge(function(e){return e===t},s,!0),u=ge(function(e){return E(t,e)>-1},s,!0),p=[function(e,i,a){var r=!n&&(a||i!==d)||((t=i).nodeType?c(e,i,a):u(e,i,a));return t=null,r}];o>l;l++)if(i=a.relative[e[l].type])p=[ge(ve(p),i)];else{if((i=a.filter[e[l].type].apply(null,e[l].matches))[y]){for(r=++l;o>r&&!a.relative[e[r].type];r++);return Ce(l>1&&ve(p),l>1&&fe(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(W,"$1"),i,r>l&&ye(e.slice(l,r)),o>r&&ye(e=e.slice(r)),o>r&&fe(e))}p.push(i)}return ve(p)}function be(e,t){var i=t.length>0,r=e.length>0,o=function(o,n,s,l,c){var u,m,g,v=0,A="0",C=o&&[],y=[],b=d,k=o||r&&a.find.TAG("*",c),D=S+=null==b?1:Math.random()||.1,_=k.length;for(c&&(d=n===h||n||c);A!==_&&null!=(u=k[A]);A++){if(r&&u){for(m=0,n||u.ownerDocument===h||(p(u),s=!f);g=e[m++];)if(g(u,n||h,s)){l.push(u);break}c&&(S=D)}i&&((u=!g&&u)&&v--,o&&C.push(u))}if(v+=A,i&&A!==v){for(m=0;g=t[m++];)g(C,y,n,s);if(o){if(v>0)for(;A--;)C[A]||y[A]||(y[A]=x.call(l));y=Ae(y)}O.apply(l,y),c&&!o&&y.length>0&&v+t.length>1&&re.uniqueSort(l)}return c&&(S=D,d=b),C};return i?ne(o):o}return me.prototype=a.filters=a.pseudos,a.setFilters=new me,n=re.tokenize=function(e,t){var i,r,o,n,s,l,d,c=_[e+" "];if(c)return t?0:c.slice(0);for(s=e,l=[],d=a.preFilter;s;){for(n in(!i||(r=V.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(o=[])),i=!1,(r=j.exec(s))&&(i=r.shift(),o.push({value:i,type:r[0].replace(W," ")}),s=s.slice(i.length)),a.filter)!(r=z[n].exec(s))||d[n]&&!(r=d[n](r))||(i=r.shift(),o.push({value:i,type:n,matches:r}),s=s.slice(i.length));if(!i)break}return t?s.length:s?re.error(e):_(e,l).slice(0)},s=re.compile=function(e,t){var i,a=[],r=[],o=I[e+" "];if(!o){for(t||(t=n(e)),i=t.length;i--;)(o=ye(t[i]))[y]?a.push(o):r.push(o);(o=I(e,be(r,a))).selector=e}return o},l=re.select=function(e,t,r,o){var l,d,c,u,p,h="function"==typeof e&&e,m=!o&&n(e=h.selector||e);if(r=r||[],1===m.length){if((d=m[0]=m[0].slice(0)).length>2&&"ID"===(c=d[0]).type&&i.getById&&9===t.nodeType&&f&&a.relative[d[1].type]){if(!(t=(a.find.ID(c.matches[0].replace(te,ie),t)||[])[0]))return r;h&&(t=t.parentNode),e=e.slice(d.shift().value.length)}for(l=z.needsContext.test(e)?0:d.length;l--&&(c=d[l],!a.relative[u=c.type]);)if((p=a.find[u])&&(o=p(c.matches[0].replace(te,ie),K.test(d[0].type)&&he(t.parentNode)||t))){if(d.splice(l,1),!(e=o.length&&fe(d)))return O.apply(r,o),r;break}}return(h||s(e,m))(o,t,!f,r,!t||K.test(e)&&he(t.parentNode)||t),r},i.sortStable=y.split("").sort(w).join("")===y,i.detectDuplicates=!!u,p(),i.sortDetached=se(function(e){return 1&e.compareDocumentPosition(h.createElement("div"))}),se(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,i){return i?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),i.attributes&&se(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,i){return i||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||le($,function(e,t,i){var a;return i?void 0:!0===e[t]?t.toLowerCase():(a=e.getAttributeNode(t))&&a.specified?a.value:null}),re}(e);h.find=C,h.expr=C.selectors,h.expr[":"]=h.expr.pseudos,h.uniqueSort=h.unique=C.uniqueSort,h.text=C.getText,h.isXMLDoc=C.isXML,h.contains=C.contains;var y=function(e,t,i){for(var a=[],r=void 0!==i;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&h(e).is(i))break;a.push(e)}return a},b=function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i},S=h.expr.match.needsContext,k=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,D=/^.[^:#\[\.,]*$/;function _(e,t,i){if(h.isFunction(t))return h.grep(e,function(e,a){return!!t.call(e,a,e)!==i});if(t.nodeType)return h.grep(e,function(e){return e===t!==i});if("string"==typeof t){if(D.test(t))return h.filter(t,e,i);t=h.filter(t,e)}return h.grep(e,function(e){return s.call(t,e)>-1!==i})}h.filter=function(e,t,i){var a=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===a.nodeType?h.find.matchesSelector(a,e)?[a]:[]:h.find.matches(e,h.grep(t,function(e){return 1===e.nodeType}))},h.fn.extend({find:function(e){var t,i=this.length,a=[],r=this;if("string"!=typeof e)return this.pushStack(h(e).filter(function(){for(t=0;i>t;t++)if(h.contains(r[t],this))return!0}));for(t=0;i>t;t++)h.find(e,r[t],a);return(a=this.pushStack(i>1?h.unique(a):a)).selector=this.selector?this.selector+" "+e:e,a},filter:function(e){return this.pushStack(_(this,e||[],!1))},not:function(e){return this.pushStack(_(this,e||[],!0))},is:function(e){return!!_(this,"string"==typeof e&&S.test(e)?h(e):e||[],!1).length}});var I,w=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,P=h.fn.init=function(e,t,i){var r,o;if(!e)return this;if(i=i||I,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:w.exec(e))||!r[1]&&t)return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof h?t[0]:t,h.merge(this,h.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:a,!0)),k.test(r[1])&&h.isPlainObject(t))for(r in t)h.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(o=a.getElementById(r[2]))&&o.parentNode&&(this.length=1,this[0]=o),this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):h.isFunction(e)?void 0!==i.ready?i.ready(e):e(h):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),h.makeArray(e,this))};P.prototype=h.fn,I=h(a);var T=/^(?:parents|prev(?:Until|All))/,B={children:!0,contents:!0,next:!0,prev:!0};function x(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}h.fn.extend({has:function(e){var t=h(e,this),i=t.length;return this.filter(function(){for(var e=0;i>e;e++)if(h.contains(this,t[e]))return!0})},closest:function(e,t){for(var i,a=0,r=this.length,o=[],n=S.test(e)||"string"!=typeof e?h(e,t||this.context):0;r>a;a++)for(i=this[a];i&&i!==t;i=i.parentNode)if(i.nodeType<11&&(n?n.index(i)>-1:1===i.nodeType&&h.find.matchesSelector(i,e))){o.push(i);break}return this.pushStack(o.length>1?h.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?s.call(h(e),this[0]):s.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(h.uniqueSort(h.merge(this.get(),h(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),h.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return y(e,"parentNode")},parentsUntil:function(e,t,i){return y(e,"parentNode",i)},next:function(e){return x(e,"nextSibling")},prev:function(e){return x(e,"previousSibling")},nextAll:function(e){return y(e,"nextSibling")},prevAll:function(e){return y(e,"previousSibling")},nextUntil:function(e,t,i){return y(e,"nextSibling",i)},prevUntil:function(e,t,i){return y(e,"previousSibling",i)},siblings:function(e){return b((e.parentNode||{}).firstChild,e)},children:function(e){return b(e.firstChild)},contents:function(e){return e.contentDocument||h.merge([],e.childNodes)}},function(e,t){h.fn[e]=function(i,a){var r=h.map(this,t,i);return"Until"!==e.slice(-5)&&(a=i),a&&"string"==typeof a&&(r=h.filter(a,r)),this.length>1&&(B[e]||h.uniqueSort(r),T.test(e)&&r.reverse()),this.pushStack(r)}});var F,O=/\S+/g;function M(){a.removeEventListener("DOMContentLoaded",M),e.removeEventListener("load",M),h.ready()}h.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return h.each(e.match(O)||[],function(e,i){t[i]=!0}),t}(e):h.extend({},e);var t,i,a,r,o=[],n=[],s=-1,l=function(){for(r=e.once,a=t=!0;n.length;s=-1)for(i=n.shift();++s<o.length;)!1===o[s].apply(i[0],i[1])&&e.stopOnFalse&&(s=o.length,i=!1);e.memory||(i=!1),t=!1,r&&(o=i?[]:"")},d={add:function(){return o&&(i&&!t&&(s=o.length-1,n.push(i)),function t(i){h.each(i,function(i,a){h.isFunction(a)?e.unique&&d.has(a)||o.push(a):a&&a.length&&"string"!==h.type(a)&&t(a)})}(arguments),i&&!t&&l()),this},remove:function(){return h.each(arguments,function(e,t){for(var i;(i=h.inArray(t,o,i))>-1;)o.splice(i,1),s>=i&&s--}),this},has:function(e){return e?h.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=n=[],o=i="",this},disabled:function(){return!o},lock:function(){return r=n=[],i||(o=i=""),this},locked:function(){return!!r},fireWith:function(e,i){return r||(i=[e,(i=i||[]).slice?i.slice():i],n.push(i),t||l()),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!a}};return d},h.extend({Deferred:function(e){var t=[["resolve","done",h.Callbacks("once memory"),"resolved"],["reject","fail",h.Callbacks("once memory"),"rejected"],["notify","progress",h.Callbacks("memory")]],i="pending",a={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var e=arguments;return h.Deferred(function(i){h.each(t,function(t,o){var n=h.isFunction(e[t])&&e[t];r[o[1]](function(){var e=n&&n.apply(this,arguments);e&&h.isFunction(e.promise)?e.promise().progress(i.notify).done(i.resolve).fail(i.reject):i[o[0]+"With"](this===a?i.promise():this,n?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?h.extend(e,a):a}},r={};return a.pipe=a.then,h.each(t,function(e,o){var n=o[2],s=o[3];a[o[1]]=n.add,s&&n.add(function(){i=s},t[1^e][2].disable,t[2][2].lock),r[o[0]]=function(){return r[o[0]+"With"](this===r?a:this,arguments),this},r[o[0]+"With"]=n.fireWith}),a.promise(r),e&&e.call(r,r),r},when:function(e){var t,i,a,o=0,n=r.call(arguments),s=n.length,l=1!==s||e&&h.isFunction(e.promise)?s:0,d=1===l?e:h.Deferred(),c=function(e,i,a){return function(o){i[e]=this,a[e]=arguments.length>1?r.call(arguments):o,a===t?d.notifyWith(i,a):--l||d.resolveWith(i,a)}};if(s>1)for(t=new Array(s),i=new Array(s),a=new Array(s);s>o;o++)n[o]&&h.isFunction(n[o].promise)?n[o].promise().progress(c(o,i,t)).done(c(o,a,n)).fail(d.reject):--l;return l||d.resolveWith(a,n),d.promise()}}),h.fn.ready=function(e){return h.ready.promise().done(e),this},h.extend({isReady:!1,readyWait:1,holdReady:function(e){e?h.readyWait++:h.ready(!0)},ready:function(e){(!0===e?--h.readyWait:h.isReady)||(h.isReady=!0,!0!==e&&--h.readyWait>0||(F.resolveWith(a,[h]),h.fn.triggerHandler&&(h(a).triggerHandler("ready"),h(a).off("ready"))))}}),h.ready.promise=function(t){return F||(F=h.Deferred(),"complete"===a.readyState||"loading"!==a.readyState&&!a.documentElement.doScroll?e.setTimeout(h.ready):(a.addEventListener("DOMContentLoaded",M),e.addEventListener("load",M))),F.promise(t)},h.ready.promise();var E=function(e,t,i,a,r,o,n){var s=0,l=e.length,d=null==i;if("object"===h.type(i))for(s in r=!0,i)E(e,t,s,i[s],!0,o,n);else if(void 0!==a&&(r=!0,h.isFunction(a)||(n=!0),d&&(n?(t.call(e,a),t=null):(d=t,t=function(e,t,i){return d.call(h(e),i)})),t))for(;l>s;s++)t(e[s],i,n?a:a.call(e[s],s,t(e[s],i)));return r?e:d?t.call(e):l?t(e[0],i):o},$=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function N(){this.expando=h.expando+N.uid++}N.uid=1,N.prototype={register:function(e,t){var i=t||{};return e.nodeType?e[this.expando]=i:Object.defineProperty(e,this.expando,{value:i,writable:!0,configurable:!0}),e[this.expando]},cache:function(e){if(!$(e))return{};var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,i){var a,r=this.cache(e);if("string"==typeof t)r[t]=i;else for(a in t)r[a]=t[a];return r},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][t]},access:function(e,t,i){var a;return void 0===t||t&&"string"==typeof t&&void 0===i?void 0!==(a=this.get(e,t))?a:this.get(e,h.camelCase(t)):(this.set(e,t,i),void 0!==i?i:t)},remove:function(e,t){var i,a,r,o=e[this.expando];if(void 0!==o){if(void 0===t)this.register(e);else{h.isArray(t)?a=t.concat(t.map(h.camelCase)):(r=h.camelCase(t),t in o?a=[t,r]:a=(a=r)in o?[a]:a.match(O)||[]),i=a.length;for(;i--;)delete o[a[i]]}(void 0===t||h.isEmptyObject(o))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!h.isEmptyObject(t)}};var L=new N,U=new N,R=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,G=/[A-Z]/g;function W(e,t,i){var a;if(void 0===i&&1===e.nodeType)if(a="data-"+t.replace(G,"-$&").toLowerCase(),"string"==typeof(i=e.getAttribute(a))){try{i="true"===i||"false"!==i&&("null"===i?null:+i+""===i?+i:R.test(i)?h.parseJSON(i):i)}catch(e){}U.set(e,t,i)}else i=void 0;return i}h.extend({hasData:function(e){return U.hasData(e)||L.hasData(e)},data:function(e,t,i){return U.access(e,t,i)},removeData:function(e,t){U.remove(e,t)},_data:function(e,t,i){return L.access(e,t,i)},_removeData:function(e,t){L.remove(e,t)}}),h.fn.extend({data:function(e,t){var i,a,r,o=this[0],n=o&&o.attributes;if(void 0===e){if(this.length&&(r=U.get(o),1===o.nodeType&&!L.get(o,"hasDataAttrs"))){for(i=n.length;i--;)n[i]&&(0===(a=n[i].name).indexOf("data-")&&(a=h.camelCase(a.slice(5)),W(o,a,r[a])));L.set(o,"hasDataAttrs",!0)}return r}return"object"==typeof e?this.each(function(){U.set(this,e)}):E(this,function(t){var i,a;if(o&&void 0===t){if(void 0!==(i=U.get(o,e)||U.get(o,e.replace(G,"-$&").toLowerCase())))return i;if(a=h.camelCase(e),void 0!==(i=U.get(o,a)))return i;if(void 0!==(i=W(o,a,void 0)))return i}else a=h.camelCase(e),this.each(function(){var i=U.get(this,a);U.set(this,a,t),e.indexOf("-")>-1&&void 0!==i&&U.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){U.remove(this,e)})}}),h.extend({queue:function(e,t,i){var a;return e?(t=(t||"fx")+"queue",a=L.get(e,t),i&&(!a||h.isArray(i)?a=L.access(e,t,h.makeArray(i)):a.push(i)),a||[]):void 0},dequeue:function(e,t){t=t||"fx";var i=h.queue(e,t),a=i.length,r=i.shift(),o=h._queueHooks(e,t);"inprogress"===r&&(r=i.shift(),a--),r&&("fx"===t&&i.unshift("inprogress"),delete o.stop,r.call(e,function(){h.dequeue(e,t)},o)),!a&&o&&o.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return L.get(e,i)||L.access(e,i,{empty:h.Callbacks("once memory").add(function(){L.remove(e,[t+"queue",i])})})}}),h.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length<i?h.queue(this[0],e):void 0===t?this:this.each(function(){var i=h.queue(this,e,t);h._queueHooks(this,e),"fx"===e&&"inprogress"!==i[0]&&h.dequeue(this,e)})},dequeue:function(e){return this.each(function(){h.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var i,a=1,r=h.Deferred(),o=this,n=this.length,s=function(){--a||r.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";n--;)(i=L.get(o[n],e+"queueHooks"))&&i.empty&&(a++,i.empty.add(s));return s(),r.promise(t)}});var V=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,j=new RegExp("^(?:([+-])=|)("+V+")([a-z%]*)$","i"),H=["Top","Right","Bottom","Left"],Y=function(e,t){return e=t||e,"none"===h.css(e,"display")||!h.contains(e.ownerDocument,e)};function Z(e,t,i,a){var r,o=1,n=20,s=a?function(){return a.cur()}:function(){return h.css(e,t,"")},l=s(),d=i&&i[3]||(h.cssNumber[t]?"":"px"),c=(h.cssNumber[t]||"px"!==d&&+l)&&j.exec(h.css(e,t));if(c&&c[3]!==d){d=d||c[3],i=i||[],c=+l||1;do{c/=o=o||".5",h.style(e,t,c+d)}while(o!==(o=s()/l)&&1!==o&&--n)}return i&&(c=+c||+l||0,r=i[1]?c+(i[1]+1)*i[2]:+i[2],a&&(a.unit=d,a.start=c,a.end=r)),r}var z=/^(?:checkbox|radio)$/i,X=/<([\w:-]+)/,q=/^$|\/(?:java|ecma)script/i,J={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Q(e,t){var i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&h.nodeName(e,t)?h.merge([e],i):i}function K(e,t){for(var i=0,a=e.length;a>i;i++)L.set(e[i],"globalEval",!t||L.get(t[i],"globalEval"))}J.optgroup=J.option,J.tbody=J.tfoot=J.colgroup=J.caption=J.thead,J.th=J.td;var ee=/<|&#?\w+;/;function te(e,t,i,a,r){for(var o,n,s,l,d,c,u=t.createDocumentFragment(),p=[],m=0,f=e.length;f>m;m++)if((o=e[m])||0===o)if("object"===h.type(o))h.merge(p,o.nodeType?[o]:o);else if(ee.test(o)){for(n=n||u.appendChild(t.createElement("div")),s=(X.exec(o)||["",""])[1].toLowerCase(),l=J[s]||J._default,n.innerHTML=l[1]+h.htmlPrefilter(o)+l[2],c=l[0];c--;)n=n.lastChild;h.merge(p,n.childNodes),(n=u.firstChild).textContent=""}else p.push(t.createTextNode(o));for(u.textContent="",m=0;o=p[m++];)if(a&&h.inArray(o,a)>-1)r&&r.push(o);else if(d=h.contains(o.ownerDocument,o),n=Q(u.appendChild(o),"script"),d&&K(n),i)for(c=0;o=n[c++];)q.test(o.type||"")&&i.push(o);return u}!function(){var e=a.createDocumentFragment().appendChild(a.createElement("div")),t=a.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),u.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",u.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var ie=/^key/,ae=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,re=/^([^.]*)(?:\.(.+)|)/;function oe(){return!0}function ne(){return!1}function se(){try{return a.activeElement}catch(e){}}function le(e,t,i,a,r,o){var n,s;if("object"==typeof t){for(s in"string"!=typeof i&&(a=a||i,i=void 0),t)le(e,s,i,a,t[s],o);return e}if(null==a&&null==r?(r=i,a=i=void 0):null==r&&("string"==typeof i?(r=a,a=void 0):(r=a,a=i,i=void 0)),!1===r)r=ne;else if(!r)return this;return 1===o&&(n=r,r=function(e){return h().off(e),n.apply(this,arguments)},r.guid=n.guid||(n.guid=h.guid++)),e.each(function(){h.event.add(this,t,r,a,i)})}h.event={global:{},add:function(e,t,i,a,r){var o,n,s,l,d,c,u,p,m,f,g,v=L.get(e);if(v)for(i.handler&&(i=(o=i).handler,r=o.selector),i.guid||(i.guid=h.guid++),(l=v.events)||(l=v.events={}),(n=v.handle)||(n=v.handle=function(t){return void 0!==h&&h.event.triggered!==t.type?h.event.dispatch.apply(e,arguments):void 0}),d=(t=(t||"").match(O)||[""]).length;d--;)m=g=(s=re.exec(t[d])||[])[1],f=(s[2]||"").split(".").sort(),m&&(u=h.event.special[m]||{},m=(r?u.delegateType:u.bindType)||m,u=h.event.special[m]||{},c=h.extend({type:m,origType:g,data:a,handler:i,guid:i.guid,selector:r,needsContext:r&&h.expr.match.needsContext.test(r),namespace:f.join(".")},o),(p=l[m])||((p=l[m]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,a,f,n)||e.addEventListener&&e.addEventListener(m,n)),u.add&&(u.add.call(e,c),c.handler.guid||(c.handler.guid=i.guid)),r?p.splice(p.delegateCount++,0,c):p.push(c),h.event.global[m]=!0)},remove:function(e,t,i,a,r){var o,n,s,l,d,c,u,p,m,f,g,v=L.hasData(e)&&L.get(e);if(v&&(l=v.events)){for(d=(t=(t||"").match(O)||[""]).length;d--;)if(m=g=(s=re.exec(t[d])||[])[1],f=(s[2]||"").split(".").sort(),m){for(u=h.event.special[m]||{},p=l[m=(a?u.delegateType:u.bindType)||m]||[],s=s[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),n=o=p.length;o--;)c=p[o],!r&&g!==c.origType||i&&i.guid!==c.guid||s&&!s.test(c.namespace)||a&&a!==c.selector&&("**"!==a||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,u.remove&&u.remove.call(e,c));n&&!p.length&&(u.teardown&&!1!==u.teardown.call(e,f,v.handle)||h.removeEvent(e,m,v.handle),delete l[m])}else for(m in l)h.event.remove(e,m+t[d],i,a,!0);h.isEmptyObject(l)&&L.remove(e,"handle events")}},dispatch:function(e){e=h.event.fix(e);var t,i,a,o,n,s=[],l=r.call(arguments),d=(L.get(this,"events")||{})[e.type]||[],c=h.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(s=h.event.handlers.call(this,e,d),t=0;(o=s[t++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,i=0;(n=o.handlers[i++])&&!e.isImmediatePropagationStopped();)(!e.rnamespace||e.rnamespace.test(n.namespace))&&(e.handleObj=n,e.data=n.data,void 0!==(a=((h.event.special[n.origType]||{}).handle||n.handler).apply(o.elem,l))&&!1===(e.result=a)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var i,a,r,o,n=[],s=t.delegateCount,l=e.target;if(s&&l.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(!0!==l.disabled||"click"!==e.type)){for(a=[],i=0;s>i;i++)void 0===a[r=(o=t[i]).selector+" "]&&(a[r]=o.needsContext?h(r,this).index(l)>-1:h.find(r,this,null,[l]).length),a[r]&&a.push(o);a.length&&n.push({elem:l,handlers:a})}return s<t.length&&n.push({elem:this,handlers:t.slice(s)}),n},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var i,r,o,n=t.button;return null==e.pageX&&null!=t.clientX&&(r=(i=e.target.ownerDocument||a).documentElement,o=i.body,e.pageX=t.clientX+(r&&r.scrollLeft||o&&o.scrollLeft||0)-(r&&r.clientLeft||o&&o.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||o&&o.scrollTop||0)-(r&&r.clientTop||o&&o.clientTop||0)),e.which||void 0===n||(e.which=1&n?1:2&n?3:4&n?2:0),e}},fix:function(e){if(e[h.expando])return e;var t,i,r,o=e.type,n=e,s=this.fixHooks[o];for(s||(this.fixHooks[o]=s=ae.test(o)?this.mouseHooks:ie.test(o)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new h.Event(n),t=r.length;t--;)e[i=r[t]]=n[i];return e.target||(e.target=a),3===e.target.nodeType&&(e.target=e.target.parentNode),s.filter?s.filter(e,n):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==se()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===se()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&h.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(e){return h.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},h.removeEvent=function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i)},h.Event=function(e,t){return this instanceof h.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?oe:ne):this.type=e,t&&h.extend(this,t),this.timeStamp=e&&e.timeStamp||h.now(),void(this[h.expando]=!0)):new h.Event(e,t)},h.Event.prototype={constructor:h.Event,isDefaultPrevented:ne,isPropagationStopped:ne,isImmediatePropagationStopped:ne,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=oe,e&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=oe,e&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=oe,e&&e.stopImmediatePropagation(),this.stopPropagation()}},h.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){h.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,a=e.relatedTarget,r=e.handleObj;return(!a||a!==this&&!h.contains(this,a))&&(e.type=r.origType,i=r.handler.apply(this,arguments),e.type=t),i}}}),h.fn.extend({on:function(e,t,i,a){return le(this,e,t,i,a)},one:function(e,t,i,a){return le(this,e,t,i,a,1)},off:function(e,t,i){var a,r;if(e&&e.preventDefault&&e.handleObj)return a=e.handleObj,h(e.delegateTarget).off(a.namespace?a.origType+"."+a.namespace:a.origType,a.selector,a.handler),this;if("object"==typeof e){for(r in e)this.off(r,t,e[r]);return this}return(!1===t||"function"==typeof t)&&(i=t,t=void 0),!1===i&&(i=ne),this.each(function(){h.event.remove(this,e,i,t)})}});var de=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,ce=/<script|<style|<link/i,ue=/checked\s*(?:[^=]|=\s*.checked.)/i,pe=/^true\/(.*)/,he=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function me(e,t){return h.nodeName(e,"table")&&h.nodeName(11!==t.nodeType?t:t.firstChild,"tr")&&e.getElementsByTagName("tbody")[0]||e}function fe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ge(e){var t=pe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function ve(e,t){var i,a,r,o,n,s,l,d;if(1===t.nodeType){if(L.hasData(e)&&(o=L.access(e),n=L.set(t,o),d=o.events))for(r in delete n.handle,n.events={},d)for(i=0,a=d[r].length;a>i;i++)h.event.add(t,r,d[r][i]);U.hasData(e)&&(s=U.access(e),l=h.extend({},s),U.set(t,l))}}function Ae(e,t){var i=t.nodeName.toLowerCase();"input"===i&&z.test(e.type)?t.checked=e.checked:("input"===i||"textarea"===i)&&(t.defaultValue=e.defaultValue)}function Ce(e,t,i,a){t=o.apply([],t);var r,n,s,l,d,c,p=0,m=e.length,f=m-1,g=t[0],v=h.isFunction(g);if(v||m>1&&"string"==typeof g&&!u.checkClone&&ue.test(g))return e.each(function(r){var o=e.eq(r);v&&(t[0]=g.call(this,r,o.html())),Ce(o,t,i,a)});if(m&&(n=(r=te(t,e[0].ownerDocument,!1,e,a)).firstChild,1===r.childNodes.length&&(r=n),n||a)){for(l=(s=h.map(Q(r,"script"),fe)).length;m>p;p++)d=r,p!==f&&(d=h.clone(d,!0,!0),l&&h.merge(s,Q(d,"script"))),i.call(e[p],d,p);if(l)for(c=s[s.length-1].ownerDocument,h.map(s,ge),p=0;l>p;p++)d=s[p],q.test(d.type||"")&&!L.access(d,"globalEval")&&h.contains(c,d)&&(d.src?h._evalUrl&&h._evalUrl(d.src):h.globalEval(d.textContent.replace(he,"")))}return e}function ye(e,t,i){for(var a,r=t?h.filter(t,e):e,o=0;null!=(a=r[o]);o++)i||1!==a.nodeType||h.cleanData(Q(a)),a.parentNode&&(i&&h.contains(a.ownerDocument,a)&&K(Q(a,"script")),a.parentNode.removeChild(a));return e}h.extend({htmlPrefilter:function(e){return e.replace(de,"<$1></$2>")},clone:function(e,t,i){var a,r,o,n,s=e.cloneNode(!0),l=h.contains(e.ownerDocument,e);if(!(u.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||h.isXMLDoc(e)))for(n=Q(s),a=0,r=(o=Q(e)).length;r>a;a++)Ae(o[a],n[a]);if(t)if(i)for(o=o||Q(e),n=n||Q(s),a=0,r=o.length;r>a;a++)ve(o[a],n[a]);else ve(e,s);return(n=Q(s,"script")).length>0&&K(n,!l&&Q(e,"script")),s},cleanData:function(e){for(var t,i,a,r=h.event.special,o=0;void 0!==(i=e[o]);o++)if($(i)){if(t=i[L.expando]){if(t.events)for(a in t.events)r[a]?h.event.remove(i,a):h.removeEvent(i,a,t.handle);i[L.expando]=void 0}i[U.expando]&&(i[U.expando]=void 0)}}}),h.fn.extend({domManip:Ce,detach:function(e){return ye(this,e,!0)},remove:function(e){return ye(this,e)},text:function(e){return E(this,function(e){return void 0===e?h.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return Ce(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||me(this,e).appendChild(e)})},prepend:function(){return Ce(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=me(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Ce(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Ce(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(h.cleanData(Q(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return h.clone(this,e,t)})},html:function(e){return E(this,function(e){var t=this[0]||{},i=0,a=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ce.test(e)&&!J[(X.exec(e)||["",""])[1].toLowerCase()]){e=h.htmlPrefilter(e);try{for(;a>i;i++)1===(t=this[i]||{}).nodeType&&(h.cleanData(Q(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Ce(this,arguments,function(t){var i=this.parentNode;h.inArray(this,e)<0&&(h.cleanData(Q(this)),i&&i.replaceChild(t,this))},e)}}),h.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){h.fn[e]=function(e){for(var i,a=[],r=h(e),o=r.length-1,s=0;o>=s;s++)i=s===o?this:this.clone(!0),h(r[s])[t](i),n.apply(a,i.get());return this.pushStack(a)}});var be,Se={HTML:"block",BODY:"block"};function ke(e,t){var i=h(t.createElement(e)).appendTo(t.body),a=h.css(i[0],"display");return i.detach(),a}function De(e){var t=a,i=Se[e];return i||("none"!==(i=ke(e,t))&&i||((t=(be=(be||h("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement))[0].contentDocument).write(),t.close(),i=ke(e,t),be.detach()),Se[e]=i),i}var _e=/^margin/,Ie=new RegExp("^("+V+")(?!px)[a-z%]+$","i"),we=function(t){var i=t.ownerDocument.defaultView;return i.opener||(i=e),i.getComputedStyle(t)},Pe=function(e,t,i,a){var r,o,n={};for(o in t)n[o]=e.style[o],e.style[o]=t[o];for(o in r=i.apply(e,a||[]),t)e.style[o]=n[o];return r},Te=a.documentElement;function Be(e,t,i){var a,r,o,n,s=e.style;return(i=i||we(e))&&(""!==(n=i.getPropertyValue(t)||i[t])||h.contains(e.ownerDocument,e)||(n=h.style(e,t)),!u.pixelMarginRight()&&Ie.test(n)&&_e.test(t)&&(a=s.width,r=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=n,n=i.width,s.width=a,s.minWidth=r,s.maxWidth=o)),void 0!==n?n+"":n}function xe(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}!function(){var t,i,r,o,n=a.createElement("div"),s=a.createElement("div");if(s.style){function l(){s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Te.appendChild(n);var a=e.getComputedStyle(s);t="1%"!==a.top,o="2px"===a.marginLeft,i="4px"===a.width,s.style.marginRight="50%",r="4px"===a.marginRight,Te.removeChild(n)}s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",u.clearCloneStyle="content-box"===s.style.backgroundClip,n.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",n.appendChild(s),h.extend(u,{pixelPosition:function(){return l(),t},boxSizingReliable:function(){return null==i&&l(),i},pixelMarginRight:function(){return null==i&&l(),r},reliableMarginLeft:function(){return null==i&&l(),o},reliableMarginRight:function(){var t,i=s.appendChild(a.createElement("div"));return i.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",s.style.width="1px",Te.appendChild(n),t=!parseFloat(e.getComputedStyle(i).marginRight),Te.removeChild(n),s.removeChild(i),t}})}}();var Fe=/^(none|table(?!-c[ea]).+)/,Oe={position:"absolute",visibility:"hidden",display:"block"},Me={letterSpacing:"0",fontWeight:"400"},Ee=["Webkit","O","Moz","ms"],$e=a.createElement("div").style;function Ne(e){if(e in $e)return e;for(var t=e[0].toUpperCase()+e.slice(1),i=Ee.length;i--;)if((e=Ee[i]+t)in $e)return e}function Le(e,t,i){var a=j.exec(t);return a?Math.max(0,a[2]-(i||0))+(a[3]||"px"):t}function Ue(e,t,i,a,r){for(var o=i===(a?"border":"content")?4:"width"===t?1:0,n=0;4>o;o+=2)"margin"===i&&(n+=h.css(e,i+H[o],!0,r)),a?("content"===i&&(n-=h.css(e,"padding"+H[o],!0,r)),"margin"!==i&&(n-=h.css(e,"border"+H[o]+"Width",!0,r))):(n+=h.css(e,"padding"+H[o],!0,r),"padding"!==i&&(n+=h.css(e,"border"+H[o]+"Width",!0,r)));return n}function Re(t,i,r){var o=!0,n="width"===i?t.offsetWidth:t.offsetHeight,s=we(t),l="border-box"===h.css(t,"boxSizing",!1,s);if(a.msFullscreenElement&&e.top!==e&&t.getClientRects().length&&(n=Math.round(100*t.getBoundingClientRect()[i])),0>=n||null==n){if((0>(n=Be(t,i,s))||null==n)&&(n=t.style[i]),Ie.test(n))return n;o=l&&(u.boxSizingReliable()||n===t.style[i]),n=parseFloat(n)||0}return n+Ue(t,i,r||(l?"border":"content"),o,s)+"px"}function Ge(e,t){for(var i,a,r,o=[],n=0,s=e.length;s>n;n++)(a=e[n]).style&&(o[n]=L.get(a,"olddisplay"),i=a.style.display,t?(o[n]||"none"!==i||(a.style.display=""),""===a.style.display&&Y(a)&&(o[n]=L.access(a,"olddisplay",De(a.nodeName)))):(r=Y(a),"none"===i&&r||L.set(a,"olddisplay",r?i:h.css(a,"display"))));for(n=0;s>n;n++)(a=e[n]).style&&(t&&"none"!==a.style.display&&""!==a.style.display||(a.style.display=t?o[n]||"":"none"));return e}function We(e,t,i,a,r){return new We.prototype.init(e,t,i,a,r)}h.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=Be(e,"opacity");return""===i?"1":i}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,t,i,a){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,o,n,s=h.camelCase(t),l=e.style;return t=h.cssProps[s]||(h.cssProps[s]=Ne(s)||s),n=h.cssHooks[t]||h.cssHooks[s],void 0===i?n&&"get"in n&&void 0!==(r=n.get(e,!1,a))?r:l[t]:("string"===(o=typeof i)&&(r=j.exec(i))&&r[1]&&(i=Z(e,t,r),o="number"),void(null!=i&&i==i&&("number"===o&&(i+=r&&r[3]||(h.cssNumber[s]?"":"px")),u.clearCloneStyle||""!==i||0!==t.indexOf("background")||(l[t]="inherit"),n&&"set"in n&&void 0===(i=n.set(e,i,a))||(l[t]=i))))}},css:function(e,t,i,a){var r,o,n,s=h.camelCase(t);return t=h.cssProps[s]||(h.cssProps[s]=Ne(s)||s),(n=h.cssHooks[t]||h.cssHooks[s])&&"get"in n&&(r=n.get(e,!0,i)),void 0===r&&(r=Be(e,t,a)),"normal"===r&&t in Me&&(r=Me[t]),""===i||i?(o=parseFloat(r),!0===i||isFinite(o)?o||0:r):r}}),h.each(["height","width"],function(e,t){h.cssHooks[t]={get:function(e,i,a){return i?Fe.test(h.css(e,"display"))&&0===e.offsetWidth?Pe(e,Oe,function(){return Re(e,t,a)}):Re(e,t,a):void 0},set:function(e,i,a){var r,o=a&&we(e),n=a&&Ue(e,t,a,"border-box"===h.css(e,"boxSizing",!1,o),o);return n&&(r=j.exec(i))&&"px"!==(r[3]||"px")&&(e.style[t]=i,i=h.css(e,t)),Le(0,i,n)}}}),h.cssHooks.marginLeft=xe(u.reliableMarginLeft,function(e,t){return t?(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-Pe(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px":void 0}),h.cssHooks.marginRight=xe(u.reliableMarginRight,function(e,t){return t?Pe(e,{display:"inline-block"},Be,[e,"marginRight"]):void 0}),h.each({margin:"",padding:"",border:"Width"},function(e,t){h.cssHooks[e+t]={expand:function(i){for(var a=0,r={},o="string"==typeof i?i.split(" "):[i];4>a;a++)r[e+H[a]+t]=o[a]||o[a-2]||o[0];return r}},_e.test(e)||(h.cssHooks[e+t].set=Le)}),h.fn.extend({css:function(e,t){return E(this,function(e,t,i){var a,r,o={},n=0;if(h.isArray(t)){for(a=we(e),r=t.length;r>n;n++)o[t[n]]=h.css(e,t[n],!1,a);return o}return void 0!==i?h.style(e,t,i):h.css(e,t)},e,t,arguments.length>1)},show:function(){return Ge(this,!0)},hide:function(){return Ge(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Y(this)?h(this).show():h(this).hide()})}}),h.Tween=We,We.prototype={constructor:We,init:function(e,t,i,a,r,o){this.elem=e,this.prop=i,this.easing=r||h.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=a,this.unit=o||(h.cssNumber[i]?"":"px")},cur:function(){var e=We.propHooks[this.prop];return e&&e.get?e.get(this):We.propHooks._default.get(this)},run:function(e){var t,i=We.propHooks[this.prop];return this.options.duration?this.pos=t=h.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):We.propHooks._default.set(this),this}},We.prototype.init.prototype=We.prototype,We.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=h.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){h.fx.step[e.prop]?h.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[h.cssProps[e.prop]]&&!h.cssHooks[e.prop]?e.elem[e.prop]=e.now:h.style(e.elem,e.prop,e.now+e.unit)}}},We.propHooks.scrollTop=We.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},h.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},h.fx=We.prototype.init,h.fx.step={};var Ve,je,He=/^(?:toggle|show|hide)$/,Ye=/queueHooks$/;function Ze(){return e.setTimeout(function(){Ve=void 0}),Ve=h.now()}function ze(e,t){var i,a=0,r={height:e};for(t=t?1:0;4>a;a+=2-t)r["margin"+(i=H[a])]=r["padding"+i]=e;return t&&(r.opacity=r.width=e),r}function Xe(e,t,i){for(var a,r=(qe.tweeners[t]||[]).concat(qe.tweeners["*"]),o=0,n=r.length;n>o;o++)if(a=r[o].call(i,t,e))return a}function qe(e,t,i){var a,r,o=0,n=qe.prefilters.length,s=h.Deferred().always(function(){delete l.elem}),l=function(){if(r)return!1;for(var t=Ve||Ze(),i=Math.max(0,d.startTime+d.duration-t),a=1-(i/d.duration||0),o=0,n=d.tweens.length;n>o;o++)d.tweens[o].run(a);return s.notifyWith(e,[d,a,i]),1>a&&n?i:(s.resolveWith(e,[d]),!1)},d=s.promise({elem:e,props:h.extend({},t),opts:h.extend(!0,{specialEasing:{},easing:h.easing._default},i),originalProperties:t,originalOptions:i,startTime:Ve||Ze(),duration:i.duration,tweens:[],createTween:function(t,i){var a=h.Tween(e,d.opts,t,i,d.opts.specialEasing[t]||d.opts.easing);return d.tweens.push(a),a},stop:function(t){var i=0,a=t?d.tweens.length:0;if(r)return this;for(r=!0;a>i;i++)d.tweens[i].run(1);return t?(s.notifyWith(e,[d,1,0]),s.resolveWith(e,[d,t])):s.rejectWith(e,[d,t]),this}}),c=d.props;for(function(e,t){var i,a,r,o,n;for(i in e)if(r=t[a=h.camelCase(i)],o=e[i],h.isArray(o)&&(r=o[1],o=e[i]=o[0]),i!==a&&(e[a]=o,delete e[i]),(n=h.cssHooks[a])&&"expand"in n)for(i in o=n.expand(o),delete e[a],o)i in e||(e[i]=o[i],t[i]=r);else t[a]=r}(c,d.opts.specialEasing);n>o;o++)if(a=qe.prefilters[o].call(d,e,c,d.opts))return h.isFunction(a.stop)&&(h._queueHooks(d.elem,d.opts.queue).stop=h.proxy(a.stop,a)),a;return h.map(c,Xe,d),h.isFunction(d.opts.start)&&d.opts.start.call(e,d),h.fx.timer(h.extend(l,{elem:e,anim:d,queue:d.opts.queue})),d.progress(d.opts.progress).done(d.opts.done,d.opts.complete).fail(d.opts.fail).always(d.opts.always)}h.Animation=h.extend(qe,{tweeners:{"*":[function(e,t){var i=this.createTween(e,t);return Z(i.elem,e,j.exec(t),i),i}]},tweener:function(e,t){h.isFunction(e)?(t=e,e=["*"]):e=e.match(O);for(var i,a=0,r=e.length;r>a;a++)i=e[a],qe.tweeners[i]=qe.tweeners[i]||[],qe.tweeners[i].unshift(t)},prefilters:[function(e,t,i){var a,r,o,n,s,l,d,c=this,u={},p=e.style,m=e.nodeType&&Y(e),f=L.get(e,"fxshow");for(a in i.queue||(null==(s=h._queueHooks(e,"fx")).unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,c.always(function(){c.always(function(){s.unqueued--,h.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(i.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===("none"===(d=h.css(e,"display"))?L.get(e,"olddisplay")||De(e.nodeName):d)&&"none"===h.css(e,"float")&&(p.display="inline-block")),i.overflow&&(p.overflow="hidden",c.always(function(){p.overflow=i.overflow[0],p.overflowX=i.overflow[1],p.overflowY=i.overflow[2]})),t)if(r=t[a],He.exec(r)){if(delete t[a],o=o||"toggle"===r,r===(m?"hide":"show")){if("show"!==r||!f||void 0===f[a])continue;m=!0}u[a]=f&&f[a]||h.style(e,a)}else d=void 0;if(h.isEmptyObject(u))"inline"===("none"===d?De(e.nodeName):d)&&(p.display=d);else for(a in f?"hidden"in f&&(m=f.hidden):f=L.access(e,"fxshow",{}),o&&(f.hidden=!m),m?h(e).show():c.done(function(){h(e).hide()}),c.done(function(){var t;for(t in L.remove(e,"fxshow"),u)h.style(e,t,u[t])}),u)n=Xe(m?f[a]:0,a,c),a in f||(f[a]=n.start,m&&(n.end=n.start,n.start="width"===a||"height"===a?1:0))}],prefilter:function(e,t){t?qe.prefilters.unshift(e):qe.prefilters.push(e)}}),h.speed=function(e,t,i){var a=e&&"object"==typeof e?h.extend({},e):{complete:i||!i&&t||h.isFunction(e)&&e,duration:e,easing:i&&t||t&&!h.isFunction(t)&&t};return a.duration=h.fx.off?0:"number"==typeof a.duration?a.duration:a.duration in h.fx.speeds?h.fx.speeds[a.duration]:h.fx.speeds._default,(null==a.queue||!0===a.queue)&&(a.queue="fx"),a.old=a.complete,a.complete=function(){h.isFunction(a.old)&&a.old.call(this),a.queue&&h.dequeue(this,a.queue)},a},h.fn.extend({fadeTo:function(e,t,i,a){return this.filter(Y).css("opacity",0).show().end().animate({opacity:t},e,i,a)},animate:function(e,t,i,a){var r=h.isEmptyObject(e),o=h.speed(t,i,a),n=function(){var t=qe(this,h.extend({},e),o);(r||L.get(this,"finish"))&&t.stop(!0)};return n.finish=n,r||!1===o.queue?this.each(n):this.queue(o.queue,n)},stop:function(e,t,i){var a=function(e){var t=e.stop;delete e.stop,t(i)};return"string"!=typeof e&&(i=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,r=null!=e&&e+"queueHooks",o=h.timers,n=L.get(this);if(r)n[r]&&n[r].stop&&a(n[r]);else for(r in n)n[r]&&n[r].stop&&Ye.test(r)&&a(n[r]);for(r=o.length;r--;)o[r].elem!==this||null!=e&&o[r].queue!==e||(o[r].anim.stop(i),t=!1,o.splice(r,1));(t||!i)&&h.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,i=L.get(this),a=i[e+"queue"],r=i[e+"queueHooks"],o=h.timers,n=a?a.length:0;for(i.finish=!0,h.queue(this,e,[]),r&&r.stop&&r.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;n>t;t++)a[t]&&a[t].finish&&a[t].finish.call(this);delete i.finish})}}),h.each(["toggle","show","hide"],function(e,t){var i=h.fn[t];h.fn[t]=function(e,a,r){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(ze(t,!0),e,a,r)}}),h.each({slideDown:ze("show"),slideUp:ze("hide"),slideToggle:ze("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){h.fn[e]=function(e,i,a){return this.animate(t,e,i,a)}}),h.timers=[],h.fx.tick=function(){var e,t=0,i=h.timers;for(Ve=h.now();t<i.length;t++)(e=i[t])()||i[t]!==e||i.splice(t--,1);i.length||h.fx.stop(),Ve=void 0},h.fx.timer=function(e){h.timers.push(e),e()?h.fx.start():h.timers.pop()},h.fx.interval=13,h.fx.start=function(){je||(je=e.setInterval(h.fx.tick,h.fx.interval))},h.fx.stop=function(){e.clearInterval(je),je=null},h.fx.speeds={slow:600,fast:200,_default:400},h.fn.delay=function(t,i){return t=h.fx&&h.fx.speeds[t]||t,i=i||"fx",this.queue(i,function(i,a){var r=e.setTimeout(i,t);a.stop=function(){e.clearTimeout(r)}})},function(){var e=a.createElement("input"),t=a.createElement("select"),i=t.appendChild(a.createElement("option"));e.type="checkbox",u.checkOn=""!==e.value,u.optSelected=i.selected,t.disabled=!0,u.optDisabled=!i.disabled,(e=a.createElement("input")).value="t",e.type="radio",u.radioValue="t"===e.value}();var Je,Qe=h.expr.attrHandle;h.fn.extend({attr:function(e,t){return E(this,h.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){h.removeAttr(this,e)})}}),h.extend({attr:function(e,t,i){var a,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?h.prop(e,t,i):(1===o&&h.isXMLDoc(e)||(t=t.toLowerCase(),r=h.attrHooks[t]||(h.expr.match.bool.test(t)?Je:void 0)),void 0!==i?null===i?void h.removeAttr(e,t):r&&"set"in r&&void 0!==(a=r.set(e,i,t))?a:(e.setAttribute(t,i+""),i):r&&"get"in r&&null!==(a=r.get(e,t))?a:null==(a=h.find.attr(e,t))?void 0:a)},attrHooks:{type:{set:function(e,t){if(!u.radioValue&&"radio"===t&&h.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},removeAttr:function(e,t){var i,a,r=0,o=t&&t.match(O);if(o&&1===e.nodeType)for(;i=o[r++];)a=h.propFix[i]||i,h.expr.match.bool.test(i)&&(e[a]=!1),e.removeAttribute(i)}}),Je={set:function(e,t,i){return!1===t?h.removeAttr(e,i):e.setAttribute(i,i),i}},h.each(h.expr.match.bool.source.match(/\w+/g),function(e,t){var i=Qe[t]||h.find.attr;Qe[t]=function(e,t,a){var r,o;return a||(o=Qe[t],Qe[t]=r,r=null!=i(e,t,a)?t.toLowerCase():null,Qe[t]=o),r}});var Ke=/^(?:input|select|textarea|button)$/i,et=/^(?:a|area)$/i;h.fn.extend({prop:function(e,t){return E(this,h.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[h.propFix[e]||e]})}}),h.extend({prop:function(e,t,i){var a,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&h.isXMLDoc(e)||(t=h.propFix[t]||t,r=h.propHooks[t]),void 0!==i?r&&"set"in r&&void 0!==(a=r.set(e,i,t))?a:e[t]=i:r&&"get"in r&&null!==(a=r.get(e,t))?a:e[t]},propHooks:{tabIndex:{get:function(e){var t=h.find.attr(e,"tabindex");return t?parseInt(t,10):Ke.test(e.nodeName)||et.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),u.optSelected||(h.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),h.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){h.propFix[this.toLowerCase()]=this});var tt=/[\t\r\n\f]/g;function it(e){return e.getAttribute&&e.getAttribute("class")||""}h.fn.extend({addClass:function(e){var t,i,a,r,o,n,s,l=0;if(h.isFunction(e))return this.each(function(t){h(this).addClass(e.call(this,t,it(this)))});if("string"==typeof e&&e)for(t=e.match(O)||[];i=this[l++];)if(r=it(i),a=1===i.nodeType&&(" "+r+" ").replace(tt," ")){for(n=0;o=t[n++];)a.indexOf(" "+o+" ")<0&&(a+=o+" ");r!==(s=h.trim(a))&&i.setAttribute("class",s)}return this},removeClass:function(e){var t,i,a,r,o,n,s,l=0;if(h.isFunction(e))return this.each(function(t){h(this).removeClass(e.call(this,t,it(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(O)||[];i=this[l++];)if(r=it(i),a=1===i.nodeType&&(" "+r+" ").replace(tt," ")){for(n=0;o=t[n++];)for(;a.indexOf(" "+o+" ")>-1;)a=a.replace(" "+o+" "," ");r!==(s=h.trim(a))&&i.setAttribute("class",s)}return this},toggleClass:function(e,t){var i=typeof e;return"boolean"==typeof t&&"string"===i?t?this.addClass(e):this.removeClass(e):h.isFunction(e)?this.each(function(i){h(this).toggleClass(e.call(this,i,it(this),t),t)}):this.each(function(){var t,a,r,o;if("string"===i)for(a=0,r=h(this),o=e.match(O)||[];t=o[a++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else(void 0===e||"boolean"===i)&&((t=it(this))&&L.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":L.get(this,"__className__")||""))})},hasClass:function(e){var t,i,a=0;for(t=" "+e+" ";i=this[a++];)if(1===i.nodeType&&(" "+it(i)+" ").replace(tt," ").indexOf(t)>-1)return!0;return!1}});var at=/\r/g;h.fn.extend({val:function(e){var t,i,a,r=this[0];return arguments.length?(a=h.isFunction(e),this.each(function(i){var r;1===this.nodeType&&(null==(r=a?e.call(this,i,h(this).val()):e)?r="":"number"==typeof r?r+="":h.isArray(r)&&(r=h.map(r,function(e){return null==e?"":e+""})),(t=h.valHooks[this.type]||h.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))})):r?(t=h.valHooks[r.type]||h.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(i=t.get(r,"value"))?i:"string"==typeof(i=r.value)?i.replace(at,""):null==i?"":i:void 0}}),h.extend({valHooks:{option:{get:function(e){return h.trim(e.value)}},select:{get:function(e){for(var t,i,a=e.options,r=e.selectedIndex,o="select-one"===e.type||0>r,n=o?null:[],s=o?r+1:a.length,l=0>r?s:o?r:0;s>l;l++)if(((i=a[l]).selected||l===r)&&(u.optDisabled?!i.disabled:null===i.getAttribute("disabled"))&&(!i.parentNode.disabled||!h.nodeName(i.parentNode,"optgroup"))){if(t=h(i).val(),o)return t;n.push(t)}return n},set:function(e,t){for(var i,a,r=e.options,o=h.makeArray(t),n=r.length;n--;)((a=r[n]).selected=h.inArray(h.valHooks.option.get(a),o)>-1)&&(i=!0);return i||(e.selectedIndex=-1),o}}}}),h.each(["radio","checkbox"],function(){h.valHooks[this]={set:function(e,t){return h.isArray(t)?e.checked=h.inArray(h(e).val(),t)>-1:void 0}},u.checkOn||(h.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var rt=/^(?:focusinfocus|focusoutblur)$/;h.extend(h.event,{trigger:function(t,i,r,o){var n,s,l,d,u,p,m,f=[r||a],g=c.call(t,"type")?t.type:t,v=c.call(t,"namespace")?t.namespace.split("."):[];if(s=l=r=r||a,3!==r.nodeType&&8!==r.nodeType&&!rt.test(g+h.event.triggered)&&(g.indexOf(".")>-1&&(v=g.split("."),g=v.shift(),v.sort()),u=g.indexOf(":")<0&&"on"+g,(t=t[h.expando]?t:new h.Event(g,"object"==typeof t&&t)).isTrigger=o?2:3,t.namespace=v.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),i=null==i?[t]:h.makeArray(i,[t]),m=h.event.special[g]||{},o||!m.trigger||!1!==m.trigger.apply(r,i))){if(!o&&!m.noBubble&&!h.isWindow(r)){for(d=m.delegateType||g,rt.test(d+g)||(s=s.parentNode);s;s=s.parentNode)f.push(s),l=s;l===(r.ownerDocument||a)&&f.push(l.defaultView||l.parentWindow||e)}for(n=0;(s=f[n++])&&!t.isPropagationStopped();)t.type=n>1?d:m.bindType||g,(p=(L.get(s,"events")||{})[t.type]&&L.get(s,"handle"))&&p.apply(s,i),(p=u&&s[u])&&p.apply&&$(s)&&(t.result=p.apply(s,i),!1===t.result&&t.preventDefault());return t.type=g,o||t.isDefaultPrevented()||m._default&&!1!==m._default.apply(f.pop(),i)||!$(r)||u&&h.isFunction(r[g])&&!h.isWindow(r)&&((l=r[u])&&(r[u]=null),h.event.triggered=g,r[g](),h.event.triggered=void 0,l&&(r[u]=l)),t.result}},simulate:function(e,t,i){var a=h.extend(new h.Event,i,{type:e,isSimulated:!0});h.event.trigger(a,null,t),a.isDefaultPrevented()&&i.preventDefault()}}),h.fn.extend({trigger:function(e,t){return this.each(function(){h.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];return i?h.event.trigger(e,t,i,!0):void 0}}),h.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){h.fn[t]=function(e,i){return arguments.length>0?this.on(t,null,e,i):this.trigger(t)}}),h.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),u.focusin="onfocusin"in e,u.focusin||h.each({focus:"focusin",blur:"focusout"},function(e,t){var i=function(e){h.event.simulate(t,e.target,h.event.fix(e))};h.event.special[t]={setup:function(){var a=this.ownerDocument||this,r=L.access(a,t);r||a.addEventListener(e,i,!0),L.access(a,t,(r||0)+1)},teardown:function(){var a=this.ownerDocument||this,r=L.access(a,t)-1;r?L.access(a,t,r):(a.removeEventListener(e,i,!0),L.remove(a,t))}}});var ot=e.location,nt=h.now(),st=/\?/;h.parseJSON=function(e){return JSON.parse(e+"")},h.parseXML=function(t){var i;if(!t||"string"!=typeof t)return null;try{i=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){i=void 0}return(!i||i.getElementsByTagName("parsererror").length)&&h.error("Invalid XML: "+t),i};var lt=/#.*$/,dt=/([?&])_=[^&]*/,ct=/^(.*?):[ \t]*([^\r\n]*)$/gm,ut=/^(?:GET|HEAD)$/,pt=/^\/\//,ht={},mt={},ft="*/".concat("*"),gt=a.createElement("a");function vt(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var a,r=0,o=t.toLowerCase().match(O)||[];if(h.isFunction(i))for(;a=o[r++];)"+"===a[0]?(a=a.slice(1)||"*",(e[a]=e[a]||[]).unshift(i)):(e[a]=e[a]||[]).push(i)}}function At(e,t,i,a){var r={},o=e===mt;function n(s){var l;return r[s]=!0,h.each(e[s]||[],function(e,s){var d=s(t,i,a);return"string"!=typeof d||o||r[d]?o?!(l=d):void 0:(t.dataTypes.unshift(d),n(d),!1)}),l}return n(t.dataTypes[0])||!r["*"]&&n("*")}function Ct(e,t){var i,a,r=h.ajaxSettings.flatOptions||{};for(i in t)void 0!==t[i]&&((r[i]?e:a||(a={}))[i]=t[i]);return a&&h.extend(!0,e,a),e}gt.href=ot.href,h.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ot.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(ot.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ft,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":h.parseJSON,"text xml":h.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ct(Ct(e,h.ajaxSettings),t):Ct(h.ajaxSettings,e)},ajaxPrefilter:vt(ht),ajaxTransport:vt(mt),ajax:function(t,i){"object"==typeof t&&(i=t,t=void 0),i=i||{};var r,o,n,s,l,d,c,u,p=h.ajaxSetup({},i),m=p.context||p,f=p.context&&(m.nodeType||m.jquery)?h(m):h.event,g=h.Deferred(),v=h.Callbacks("once memory"),A=p.statusCode||{},C={},y={},b=0,S="canceled",k={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!s)for(s={};t=ct.exec(n);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?n:null},setRequestHeader:function(e,t){var i=e.toLowerCase();return b||(e=y[i]=y[i]||e,C[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)A[t]=[A[t],e[t]];else k.always(e[k.status]);return this},abort:function(e){var t=e||S;return r&&r.abort(t),D(0,t),this}};if(g.promise(k).complete=v.add,k.success=k.done,k.error=k.fail,p.url=((t||p.url||ot.href)+"").replace(lt,"").replace(pt,ot.protocol+"//"),p.type=i.method||i.type||p.method||p.type,p.dataTypes=h.trim(p.dataType||"*").toLowerCase().match(O)||[""],null==p.crossDomain){d=a.createElement("a");try{d.href=p.url,d.href=d.href,p.crossDomain=gt.protocol+"//"+gt.host!=d.protocol+"//"+d.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=h.param(p.data,p.traditional)),At(ht,p,i,k),2===b)return k;for(u in(c=h.event&&p.global)&&0===h.active++&&h.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!ut.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(st.test(o)?"&":"?")+p.data,delete p.data),!1===p.cache&&(p.url=dt.test(o)?o.replace(dt,"$1_="+nt++):o+(st.test(o)?"&":"?")+"_="+nt++)),p.ifModified&&(h.lastModified[o]&&k.setRequestHeader("If-Modified-Since",h.lastModified[o]),h.etag[o]&&k.setRequestHeader("If-None-Match",h.etag[o])),(p.data&&p.hasContent&&!1!==p.contentType||i.contentType)&&k.setRequestHeader("Content-Type",p.contentType),k.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+ft+"; q=0.01":""):p.accepts["*"]),p.headers)k.setRequestHeader(u,p.headers[u]);if(p.beforeSend&&(!1===p.beforeSend.call(m,k,p)||2===b))return k.abort();for(u in S="abort",{success:1,error:1,complete:1})k[u](p[u]);if(r=At(mt,p,i,k)){if(k.readyState=1,c&&f.trigger("ajaxSend",[k,p]),2===b)return k;p.async&&p.timeout>0&&(l=e.setTimeout(function(){k.abort("timeout")},p.timeout));try{b=1,r.send(C,D)}catch(e){if(!(2>b))throw e;D(-1,e)}}else D(-1,"No Transport");function D(t,i,a,s){var d,u,C,y,S,D=i;2!==b&&(b=2,l&&e.clearTimeout(l),r=void 0,n=s||"",k.readyState=t>0?4:0,d=t>=200&&300>t||304===t,a&&(y=function(e,t,i){for(var a,r,o,n,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===a&&(a=e.mimeType||t.getResponseHeader("Content-Type"));if(a)for(r in s)if(s[r]&&s[r].test(a)){l.unshift(r);break}if(l[0]in i)o=l[0];else{for(r in i){if(!l[0]||e.converters[r+" "+l[0]]){o=r;break}n||(n=r)}o=o||n}return o?(o!==l[0]&&l.unshift(o),i[o]):void 0}(p,k,a)),y=function(e,t,i,a){var r,o,n,s,l,d={},c=e.dataTypes.slice();if(c[1])for(n in e.converters)d[n.toLowerCase()]=e.converters[n];for(o=c.shift();o;)if(e.responseFields[o]&&(i[e.responseFields[o]]=t),!l&&a&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(n=d[l+" "+o]||d["* "+o]))for(r in d)if((s=r.split(" "))[1]===o&&(n=d[l+" "+s[0]]||d["* "+s[0]])){!0===n?n=d[r]:!0!==d[r]&&(o=s[0],c.unshift(s[1]));break}if(!0!==n)if(n&&e.throws)t=n(t);else try{t=n(t)}catch(e){return{state:"parsererror",error:n?e:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}(p,y,k,d),d?(p.ifModified&&((S=k.getResponseHeader("Last-Modified"))&&(h.lastModified[o]=S),(S=k.getResponseHeader("etag"))&&(h.etag[o]=S)),204===t||"HEAD"===p.type?D="nocontent":304===t?D="notmodified":(D=y.state,u=y.data,d=!(C=y.error))):(C=D,(t||!D)&&(D="error",0>t&&(t=0))),k.status=t,k.statusText=(i||D)+"",d?g.resolveWith(m,[u,D,k]):g.rejectWith(m,[k,D,C]),k.statusCode(A),A=void 0,c&&f.trigger(d?"ajaxSuccess":"ajaxError",[k,p,d?u:C]),v.fireWith(m,[k,D]),c&&(f.trigger("ajaxComplete",[k,p]),--h.active||h.event.trigger("ajaxStop")))}return k},getJSON:function(e,t,i){return h.get(e,t,i,"json")},getScript:function(e,t){return h.get(e,void 0,t,"script")}}),h.each(["get","post"],function(e,t){h[t]=function(e,i,a,r){return h.isFunction(i)&&(r=r||a,a=i,i=void 0),h.ajax(h.extend({url:e,type:t,dataType:r,data:i,success:a},h.isPlainObject(e)&&e))}}),h._evalUrl=function(e){return h.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},h.fn.extend({wrapAll:function(e){var t;return h.isFunction(e)?this.each(function(t){h(this).wrapAll(e.call(this,t))}):(this[0]&&(t=h(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return h.isFunction(e)?this.each(function(t){h(this).wrapInner(e.call(this,t))}):this.each(function(){var t=h(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=h.isFunction(e);return this.each(function(i){h(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){h.nodeName(this,"body")||h(this).replaceWith(this.childNodes)}).end()}}),h.expr.filters.hidden=function(e){return!h.expr.filters.visible(e)},h.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var yt=/%20/g,bt=/\[\]$/,St=/\r?\n/g,kt=/^(?:submit|button|image|reset|file)$/i,Dt=/^(?:input|select|textarea|keygen)/i;function _t(e,t,i,a){var r;if(h.isArray(t))h.each(t,function(t,r){i||bt.test(e)?a(e,r):_t(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,i,a)});else if(i||"object"!==h.type(t))a(e,t);else for(r in t)_t(e+"["+r+"]",t[r],i,a)}h.param=function(e,t){var i,a=[],r=function(e,t){t=h.isFunction(t)?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=h.ajaxSettings&&h.ajaxSettings.traditional),h.isArray(e)||e.jquery&&!h.isPlainObject(e))h.each(e,function(){r(this.name,this.value)});else for(i in e)_t(i,e[i],t,r);return a.join("&").replace(yt,"+")},h.fn.extend({serialize:function(){return h.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=h.prop(this,"elements");return e?h.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!h(this).is(":disabled")&&Dt.test(this.nodeName)&&!kt.test(e)&&(this.checked||!z.test(e))}).map(function(e,t){var i=h(this).val();return null==i?null:h.isArray(i)?h.map(i,function(e){return{name:t.name,value:e.replace(St,"\r\n")}}):{name:t.name,value:i.replace(St,"\r\n")}}).get()}}),h.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var It={0:200,1223:204},wt=h.ajaxSettings.xhr();u.cors=!!wt&&"withCredentials"in wt,u.ajax=wt=!!wt,h.ajaxTransport(function(t){var i,a;return u.cors||wt&&!t.crossDomain?{send:function(r,o){var n,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(n in t.xhrFields)s[n]=t.xhrFields[n];for(n in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)s.setRequestHeader(n,r[n]);i=function(e){return function(){i&&(i=a=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(It[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=i(),a=s.onerror=i("error"),void 0!==s.onabort?s.onabort=a:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){i&&a()})},i=i("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(i)throw e}},abort:function(){i&&i()}}:void 0}),h.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return h.globalEval(e),e}}}),h.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),h.ajaxTransport("script",function(e){var t,i;if(e.crossDomain)return{send:function(r,o){t=h("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",i=function(e){t.remove(),i=null,e&&o("error"===e.type?404:200,e.type)}),a.head.appendChild(t[0])},abort:function(){i&&i()}}});var Pt=[],Tt=/(=)\?(?=&|$)|\?\?/;h.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Pt.pop()||h.expando+"_"+nt++;return this[e]=!0,e}}),h.ajaxPrefilter("json jsonp",function(t,i,a){var r,o,n,s=!1!==t.jsonp&&(Tt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Tt.test(t.data)&&"data");return s||"jsonp"===t.dataTypes[0]?(r=t.jsonpCallback=h.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Tt,"$1"+r):!1!==t.jsonp&&(t.url+=(st.test(t.url)?"&":"?")+t.jsonp+"="+r),t.converters["script json"]=function(){return n||h.error(r+" was not called"),n[0]},t.dataTypes[0]="json",o=e[r],e[r]=function(){n=arguments},a.always(function(){void 0===o?h(e).removeProp(r):e[r]=o,t[r]&&(t.jsonpCallback=i.jsonpCallback,Pt.push(r)),n&&h.isFunction(o)&&o(n[0]),n=o=void 0}),"script"):void 0}),u.createHTMLDocument=function(){var e=a.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),h.parseHTML=function(e,t,i){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(i=t,t=!1),t=t||(u.createHTMLDocument?a.implementation.createHTMLDocument(""):a);var r=k.exec(e),o=!i&&[];return r?[t.createElement(r[1])]:(r=te([e],t,o),o&&o.length&&h(o).remove(),h.merge([],r.childNodes))};var Bt=h.fn.load;function xt(e){return h.isWindow(e)?e:9===e.nodeType&&e.defaultView}h.fn.load=function(e,t,i){if("string"!=typeof e&&Bt)return Bt.apply(this,arguments);var a,r,o,n=this,s=e.indexOf(" ");return s>-1&&(a=h.trim(e.slice(s)),e=e.slice(0,s)),h.isFunction(t)?(i=t,t=void 0):t&&"object"==typeof t&&(r="POST"),n.length>0&&h.ajax({url:e,type:r||"GET",dataType:"html",data:t}).done(function(e){o=arguments,n.html(a?h("<div>").append(h.parseHTML(e)).find(a):e)}).always(i&&function(e,t){n.each(function(){i.apply(n,o||[e.responseText,t,e])})}),this},h.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){h.fn[t]=function(e){return this.on(t,e)}}),h.expr.filters.animated=function(e){return h.grep(h.timers,function(t){return e===t.elem}).length},h.offset={setOffset:function(e,t,i){var a,r,o,n,s,l,d=h.css(e,"position"),c=h(e),u={};"static"===d&&(e.style.position="relative"),s=c.offset(),o=h.css(e,"top"),l=h.css(e,"left"),("absolute"===d||"fixed"===d)&&(o+l).indexOf("auto")>-1?(n=(a=c.position()).top,r=a.left):(n=parseFloat(o)||0,r=parseFloat(l)||0),h.isFunction(t)&&(t=t.call(e,i,h.extend({},s))),null!=t.top&&(u.top=t.top-s.top+n),null!=t.left&&(u.left=t.left-s.left+r),"using"in t?t.using.call(e,u):c.css(u)}},h.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){h.offset.setOffset(this,e,t)});var t,i,a=this[0],r={top:0,left:0},o=a&&a.ownerDocument;return o?(t=o.documentElement,h.contains(t,a)?(r=a.getBoundingClientRect(),i=xt(o),{top:r.top+i.pageYOffset-t.clientTop,left:r.left+i.pageXOffset-t.clientLeft}):r):void 0},position:function(){if(this[0]){var e,t,i=this[0],a={top:0,left:0};return"fixed"===h.css(i,"position")?t=i.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),h.nodeName(e[0],"html")||(a=e.offset()),a.top+=h.css(e[0],"borderTopWidth",!0)-e.scrollTop(),a.left+=h.css(e[0],"borderLeftWidth",!0)-e.scrollLeft()),{top:t.top-a.top-h.css(i,"marginTop",!0),left:t.left-a.left-h.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===h.css(e,"position");)e=e.offsetParent;return e||Te})}}),h.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var i="pageYOffset"===t;h.fn[e]=function(a){return E(this,function(e,a,r){var o=xt(e);return void 0===r?o?o[t]:e[a]:void(o?o.scrollTo(i?o.pageXOffset:r,i?r:o.pageYOffset):e[a]=r)},e,a,arguments.length)}}),h.each(["top","left"],function(e,t){h.cssHooks[t]=xe(u.pixelPosition,function(e,i){return i?(i=Be(e,t),Ie.test(i)?h(e).position()[t]+"px":i):void 0})}),h.each({Height:"height",Width:"width"},function(e,t){h.each({padding:"inner"+e,content:t,"":"outer"+e},function(i,a){h.fn[a]=function(a,r){var o=arguments.length&&(i||"boolean"!=typeof a),n=i||(!0===a||!0===r?"margin":"border");return E(this,function(t,i,a){var r;return h.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(r=t.documentElement,Math.max(t.body["scroll"+e],r["scroll"+e],t.body["offset"+e],r["offset"+e],r["client"+e])):void 0===a?h.css(t,i,n):h.style(t,i,a,n)},t,o?a:void 0,o,null)}})}),h.fn.extend({bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,i,a){return this.on(t,e,i,a)},undelegate:function(e,t,i){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",i)},size:function(){return this.length}}),h.fn.andSelf=h.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return h});var Ft=e.jQuery,Ot=e.$;return h.noConflict=function(t){return e.$===h&&(e.$=Ot),t&&e.jQuery===h&&(e.jQuery=Ft),h},t||(e.jQuery=e.$=h),h}),"undefined"==typeof _FBBDP&&(_FBBDP={}),_FBBDP.BusinessID=0,_FBBDP.ShopOwnerID=0,_FBBDP.LoginUserEmail="",_FBBDP.LoginUserImage="",_FBBDP.BusinessName="#ddFBBusinessName",_FBBDP.FacebookPopup="#divFbOAuthPopup",_FBBDP.BtnFBoauthContinue="#btnFBoauthContinue",_FBBDP.BtnFBoauthAuthorize="#btnFBoauthAuthorize",_FBBDP.DivFbOAuthPopupContent="#divFbOAuthPopupContent",_FBBDP.DivFbOAuthPopupContentAuthorize="#divFbOAuthPopupContentAuthorize",_FBBDP.Scope_Configuration="configure_page_transactions",_FBBDP.FBE_Scope_Configuration="manage_business_extension",_FBBDP.BusinessName="#ddFBBusinessName",_FBBDP.lblFboAuthBusinessName="#lblFBoAuthBusinessName",_FBBDP.spnFbAuthorizeUserEmail="#fbAuthorizeUserEmail",_FBBDP.dvFbUserImage=".divFBUserImage",_FBBDP.dvFbloginUserInitials=".fbloginUserIntials",_FBBDP.isFromLoginPage=!1,_FBBDP.IsPartnerAccessAuthorizeVal=!1,_FBBDP.dvAuthorize="#dvAuthorize",_FBBDP.dvDeAuthorize="#dvDeAuthorize",_FBBDP.Encryption="",_FBBDP.objBDPData=null,_FBBDP.fbuserloginid=0,_FBBDP.isBDPConfig=!1,_FBBDP.StringisNullOrUndefineOrBlank=function(e){return void 0===e||null==e||""==e||null==e},_FBBDP.FBoAuthPageLoad=function(e,t,i,a){$FacebookLoader(function(){if(ShowLoadingPanelLogin(!1),_FBBDP.StringisNullOrUndefineOrBlank(a)||(_FBBDP.isFromLoginPage=!0,$(_FBBDP.FacebookPopup).removeClass("modal fade"),$(".stepLogin1").addClass("slide1"),$(".stepLogin2").addClass("slide2"),$(".stepLogin4").addClass("slide4"),$(".stepLogin5").addClass("slide5")),_FBBDP.ShopOwnerID=e,("/oauth/fb/home"==window.location.pathname||"/oauth/fb"==window.location.pathname)&&null!=FBoAuthredirect_uri&&""!=FBoAuthredirect_uri&&"undefined"!=typeof FBoAuthredirect_uri&&(navigator.userAgent.indexOf("FBAN")>-1||navigator.userAgent.indexOf("FBAV")>-1))return vagaro.alert({message:"Facebook integration cannot be authorized from a mobile device. Please use a web browser on your computer to complete the authorization. Thank you!",title:"Alert",callback:function(){window.close()}}),!1;"true"==i?_FBBDP.BindBusinessList():(_FBBDP.BusinessID=t,_FBBDP.GoToNextStepPopup(!0)),centerModal($(_FBBDP.FacebookPopup))})},_FBBDP.FBDeoAuth=function(e,t,i){var a;a=_FBBDP.FBE_Scope_Configuration,FB.api("/me","GET",{fields:"id,name"},function(e){""==i||null==i||0==i||i==e.id?""!=e.id&&null!=e.id&&"undefined"!=e.id?FB.api("/"+e.id+"/permissions/"+a,"DELETE",function(t){t&&!t.error?(response_message="Faceboook DeAuthorise is success.",Mode="success"):(response_message=t.error.message,Mode="warning");var i={objRequest:{businessId:_FBBDP.BusinessID,shopOwnerId:_FBBDP.ShopOwnerID,fbuserId:e.id,isdeauthorise:!0,issuccess:!t.error,fbresponse:response_message,isBDPConfig:"False"==_FBBDP.IsFBEoAuthLive}};_FBBDP.ajax("SetBusinessDeAuthorizeForFacebookBDP",i,_FBBDP.GetBusinessDeAuth_Success,_FBBDP.GetBusinessDeAuth_Fail)}):(0==_FBBDP.BusinessID&&(_FBBDP.BusinessID=BusinessID),response_message=e.error.message,_FBBDP.GetBusinessDeAuth_Fail(),_FBBDP.isFromFBIntegrationPage()&&(GetOrUpdateBusinessLastModifiedDetails(29,!1),_FBBDP.IsPartnerAccessAuthorize(_FBBDP.BusinessID)),ShowLoadingPanelLogin(!1)):response_message="You are not authorised person."})};var response_message="",Mode="";_FBBDP.FBDeoAuthPageLoad=function(e,t){if(ShowLoadingPanelLogin(!0),_FBBDP.ShopOwnerID=e,_FBBDP.BusinessID=t,navigator.userAgent.toLowerCase().indexOf("iphone")>-1||navigator.userAgent.toLowerCase().indexOf("ipad")>-1||navigator.userAgent.toLowerCase().indexOf("android")>-1){var i={objRequest:{businessId:_FBBDP.BusinessID,shopOwnerId:_FBBDP.ShopOwnerID,fbuserId:-1,isdeauthorise:!0,issuccess:!0,fbresponse:"From iPhone,Tablet",isBDPConfig:"False"==_FBBDP.IsFBEoAuthLive}};_FBBDP.ajax("SetBusinessDeAuthorizeForFacebookBDP",i,_FBBDP.GetBusinessDeAuth_Success,_FBBDP.GetBusinessDeAuth_Fail)}ShowLoadingPanelLogin(!1),$FacebookLoader(function(){FBAPP.funcLogin(function(i){i?(_FBBDP.FBDeoAuth(e,t,_FBBDP.fbuserloginid),_FBBDP.fbuserloginid=0):ShowLoadingPanelLogin(!1)})})},_FBBDP.GetBusinessDeAuth_Success=function(){ShowLoadingPanelLogin(!1),"success"==Mode&&ShowHideDoneMessageCommon("Faceboook DeAuthorise is success."),"warning"==Mode&&ShowHideWarningMessageCommon(response_message),"failed"==Mode&&ShowHideFailedMessageCommon("Facebook response failed, "+response_message),_FBBDP.isFromFBIntegrationPage()&&(GetOrUpdateBusinessLastModifiedDetails(29,!1),0==_FBBDP.BusinessID&&(_FBBDP.BusinessID=BusinessID),_FBBDP.IsPartnerAccessAuthorize(_FBBDP.BusinessID))},_FBBDP.GetBusinessDeAuth_Fail=function(){ShowLoadingPanelLogin(!1),ShowHideFailedMessageCommon(response_message)},_FBBDP.HideFBoAuthPopup=function(){window.location.href.toLocaleLowerCase().indexOf("merchants/settings/premiumfeature/integration/facebook")>0?$(_FBBDP.FacebookPopup).modal("hide"):location.href="/"},_FBBDP.BindBusinessList=function(){ShowLoadingPanelLogin(!0);var e={objRequest:{shopOwnerID:_FBBDP.ShopOwnerID}};_FBBDP.ajax("GetBusinessListForFacebookBDP",e,_FBBDP.GetBusinessList_Success,_FBBDP.GetBusinessList_Failure)},_FBBDP.GetBusinessList_Success=function(e){if(null!=e&&e.length>0){for(var t=0;t<=e.length-1;t++){var i=new Option(e[t].businessName,e[t].businessID,false,false);$(_FBBDP.BusinessName).append($(i))}1==e.length?(1!=_FBBDP.isFromLoginPage&&$(_FBBDP.FacebookPopup).modal("show"),_FBBDP.GoToNextStepPopup(!0)):1==_FBBDP.isFromLoginPage?$(_FBBDP.FacebookPopup).show():$(_FBBDP.FacebookPopup).modal("show")}else $(_FBBDP.FacebookPopup).modal("hide");ShowLoadingPanelLogin(!1)},_FBBDP.GetBusinessList_Failure=function(e){ShowLoadingPanelLogin(!1)},_FBBDP.GoToNextStepPopup=function(e){1==e&&(1==_FBBDP.isFromLoginPage&&$(".stepLogin5").addClass("slide5"),$(_FBBDP.DivFbOAuthPopupContent).hide(),$(_FBBDP.BtnFBoauthContinue).hide(),$(_FBBDP.DivFbOAuthPopupContentAuthorize).show(),setTimeout(function(){centerModal($(_FBBDP.FacebookPopup))}),$(_FBBDP.BtnFBoauthAuthorize).show(),$(_FBBDP.spnFbAuthorizeUserEmail).text(_FBBDP.LoginUserEmail),window.location.href.toLocaleLowerCase().indexOf("merchants/settings/premiumfeature/integration/facebook")>0?($(_FBBDP.dvFbUserImage).css("background-image",$("#spnLoginUserImage").css("background-image")),$(_FBBDP.dvFbloginUserInitials).text($("#spnLoginUserImage").text()),$(_FBBDP.lblFboAuthBusinessName).text(GetBusinessName()),"none"!=$("#divUserPhoto").css("background-image")&&"none"!=$(".divFBUserImage").css("background-image")||$(".fbintialsnames").css("display","block"),$(_FBBDP.FacebookPopup).modal("show")):("none"!=$("#divUserPhoto").css("background-image")?($(_FBBDP.dvFbUserImage).css("background-image",$("#divUserPhoto").css("background-image")),$(".loginUserIntials").length>1?$(_FBBDP.dvFbloginUserInitials).text($(".loginUserIntials")[0].innerText):$(_FBBDP.dvFbloginUserInitials).text($(".loginUserIntials").text())):($(".fbintialsnames").css("display","block"),$(_FBBDP.dvFbUserImage).css("background-image","none"),$(".loginUserIntials").length>1?$(_FBBDP.dvFbloginUserInitials).text($(".loginUserIntials")[0].innerText):$(_FBBDP.dvFbloginUserInitials).text($(".loginUserIntials").text())),$(_FBBDP.lblFboAuthBusinessName).text($(_FBBDP.BusinessName+" option:selected").text()),_FBBDP.BusinessID=$(_FBBDP.BusinessName+" option:selected").val()),"False"==_FBBDP.IsFBEoAuthLive&&_FBBDP.GetBusinessEncryptedValue())},_FBBDP.GetBusinessEncryptedValue=function(){var e={objRequest:{shopOwnerID:_FBBDP.ShopOwnerID,businessID:_FBBDP.BusinessID},IsBusinessToken:!0};_FBBDP.ajax("getfacebookencrypted",e,_FBBDP.GetBusinessEncrypted_Success,_FBBDP.GetBusinessList_CallBack)},_FBBDP.GetBusinessEncrypted_Success=function(e){_FBBDP.Encryption=e},_FBBDP.FBOauthAuthorize=function(){setTimeout(function(){_FBBDP.SetBusinessAuthorizeForFacebookBDP()},500),ShowLoadingPanelLogin(!0)},_FBBDP.SetBusinessAuthorizeForFacebookBDP=function(){var e={objRequest:{businessId:_FBBDP.BusinessID,shopOwnerId:_FBBDP.ShopOwnerID}};_FBBDP.ajax("SetBusinessAuthorizeForFacebookBDP",e,_FBBDP.GetSuccess_CallBack,_FBBDP.GetBusinessList_CallBack,null,null,!0)},_FBBDP.GetSuccess_CallBack=function(e){if(_FBBDP.objBDPData=e,!_FBBDP.StringisNullOrUndefineOrBlank(_FBBDP.objBDPData))if("/oauth/fb/home"!=window.location.pathname&&"/oauth/fb"!=window.location.pathname||null==FBoAuthredirect_uri||""==FBoAuthredirect_uri||"undefined"==typeof FBoAuthredirect_uri)_FBBDP.openFBLoginPopup();else if(FBoAuthredirect_uri=decodeURIComponent(FBoAuthredirect_uri),/https?:\/\/(www\.|m\.|l\.)?(svcscm\.\d{4}\.od\.)?(facebook|instagram|whatsapp)\.com(\/.*)?/.test(FBoAuthredirect_uri)){var t="",i="";i=FBoAuthredirect_uri.indexOf("?")>0?"&":"?",t="False"==_FBBDP.IsFBEoAuthLive?FBoAuthredirect_uri+i+'extras={app_access_headers:\'{"X-USER-ACCESS-TOKEN": "'+_FBBDP.Encryption+"\"}',repeat:false}":FBoAuthredirect_uri+i+'extras={"setup":{"external_business_id":"'+_FBBDP.objBDPData.business_token+'","timezone":"'+_FBBDP.objBDPData.business_time_zone+'","currency":"'+_FBBDP.objBDPData.currency+'","business_vertical":"SERVICES"},"business_config":{"business":{"name":"'+encodeURIComponent(_FBBDP.objBDPData.business_name)+'"},"page_cta":{"enabled":true,"cta_button_text":"'+_FBBDP.objBDPData.cta_button_text+'","cta_button_url":"'+_FBBDP.objBDPData.cta_button_url+'","below_button_text":"Powered by Vagaro"},"page_card": {"enabled":true,"see_all_text":"'+_FBBDP.objBDPData.see_all_text+'","see_all_url":"'+_FBBDP.objBDPData.see_all_url+'","cta_button_text":"Book"},"ig_cta":{"enabled":true,"cta_button_text":"'+_FBBDP.objBDPData.cta_button_text+'","cta_button_url":"'+_FBBDP.objBDPData.cta_button_url+'"}},"repeat":false}',window.location.href=t}else _FBBDP.openFBLoginPopup();_FBBDP.isFromFBIntegrationPage()&&GetOrUpdateBusinessLastModifiedDetails(29,!1)},_FBBDP.GetBusinessList_CallBack=function(e){_FBBDP.isFromFBIntegrationPage()&&GetOrUpdateBusinessLastModifiedDetails(29,!1),ShowLoadingPanelLogin(!1)},_FBBDP.openFBLoginPopup=function(){ShowLoadingPanelLogin(!1),$FacebookLoader(function(){"False"==_FBBDP.IsFBEoAuthLive?(FBAPP.objBDPEncryption=_FBBDP.Encryption,FBAPP.IsFBEoAuthLive=!1):(FBAPP.objBDPEncryption=_FBBDP.objBDPData,FBAPP.IsFBEoAuthLive=!0),FBAPP.funcRequestPagesAppForFBBDP(function(e){console.log("Response 1-"+JSON.stringify(e)),void 0!==e&&null!=e&&e.length>0?(console.log("Response 2-"+JSON.stringify(e)),FB.api("/me","GET",{fields:"id,name"},function(e){var t=e.id;_FBBDP.GetAuthorizedSuccess(!0,t),FBAPP.objBDPEncryption=null})):ShowLoadingPanelLogin(!1)})})},_FBBDP.GetAuthorizedSuccess=function(e,t){var i={objRequest:{shopOwnerID:_FBBDP.ShopOwnerID,businessID:_FBBDP.BusinessID,fbUserLoginID:t,access_token:"True"==_FBBDP.IsFBEoAuthLive?FBAPI.accessToken:""},isAuthorize:e};_FBBDP.ajax("SetBusinessPartnerAccessAuthorizeRequest",i,_FBBDP.PartnerAccessAuthorizeRequest_Success,_FBBDP.GetBusinessList_CallBack)},_FBBDP.PartnerAccessAuthorizeRequest_Success=function(){if("True"==_FBBDP.IsFBEoAuthLive&&_FBBDP.UpdateFacebookInventory(),window.location.href.toLocaleLowerCase().indexOf("oauth/fb")>0&&($(_FBBDP.FacebookPopup).modal("hide"),window.location.href="/ShopOwner/ChooseBusiness.aspx?RedirectPageURL=/merchants/settings/premiumfeature/integration/facebook"),window.location.href.toLocaleLowerCase().indexOf("choosebusiness.aspx")>0)return ShowHideDoneMessageCommon("Faceboook authorized is successfull"),$(_FBBDP.FacebookPopup).modal("hide"),ShowLoadingPanelLogin(!1),!1;if(_FBBDP.isFromFBIntegrationPage())return GetOrUpdateBusinessLastModifiedDetails(29,!1),0==_FBBDP.BusinessID&&(_FBBDP.BusinessID=BusinessID),_FBBDP.IsPartnerAccessAuthorize(_FBBDP.BusinessID),ShowHideDoneMessageCommon("Faceboook authorized is successfull"),$(_FBBDP.FacebookPopup).modal("hide"),ShowLoadingPanelLogin(!1),!1;$(window).width();ShowLoadingPanelLogin(!1)},_FBBDP.UpdateFacebookInventory=function(){var e={objRequest:{businessId:_FBBDP.BusinessID,access_token:FBAPI.accessToken,business_token:_FBBDP.objBDPData.business_token,shopOwnerId:_FBBDP.ShopOwnerID}};_FBBDP.ajax("UploadFBEBusinessData",e,_FBBDP.UpdateFacebookInventory_Success,_FBBDP.UpdateFacebookInventory_Fail)},_FBBDP.UpdateFacebookInventory_Success=function(e){ShowLoadingPanelLogin(!1)},_FBBDP.UpdateFacebookInventory_Fail=function(){ShowHideFailedMessageCommon("Something went wrong. Please try again"),ShowLoadingPanelLogin(!1)},_FBBDP.isFromFBIntegrationPage=function(){return window.location.href.toLocaleLowerCase().indexOf("merchants/settings/premiumfeature/integration/facebook")>0},_FBBDP.IsPartnerAccessAuthorize=function(e){var t={objRequest:{businessId:e,shopOwnerId:_FBBDP.ShopOwnerID}};_FBBDP.ajax("IsPartnerAccessAuthorize",t,_FBBDP.IsPartnerAccessAuthorize_CallBack,_FBBDP.GetBusinessList_CallBack)},_FBBDP.IsPartnerAccessAuthorize_CallBack=function(e){_FBBDP.StringisNullOrUndefineOrBlank(e)||(_FBBDP.IsPartnerAccessAuthorizeVal=e.isAuthorize,_FBBDP.isBDPConfig=e.isBDPConfig,_FBBDP.fbuserloginid=e.fbUserLoginID,_FBBDP.IsPartnerAccessAuthorizeVal?($(_FBBDP.dvAuthorize).hide(),$(_FBBDP.dvDeAuthorize).show()):($(_FBBDP.dvAuthorize).show(),$(_FBBDP.dvDeAuthorize).hide()))},_FBBDP.ajax=function(e,t,i,a,r,o,n){var s=new vagaro.ajax;s.datamodel.Token=e,s.datamodel.data=t,s.datamodel.callback=i,s.datamodel.Error=a,0==n&&(s.datamodel.async=!1),void 0!==o&&1==o&&(s.datamodel.ErrorMessage=_invoice.Empty),r?s.PostQue():s.Post()},vagaroFBExtensions={},vagaroFBExtensions.isFBExtensions=!1,vagaroFBExtensions.isExtensions_FB_iOS=!1,vagaroFBExtensions.isExtensions_FB_Android=!1,vagaroFBExtensions.isExtensions_Insta_iOS=!1,vagaroFBExtensions.isExtensions_Insta_Android=!1,vagaroFBExtensions.isExtensions_Mobile=!1,function(e,t){"use strict";var i=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();vagaroFBExtensions.isFBExtensions=/fbextensions/i.test(i)||/instagram/i.test(i)||!1;if(0==vagaroFBExtensions.isFBExtensions){if("true"!=function(e){var t=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return i&&i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):""}("ig_ix").toLowerCase())return;vagaroFBExtensions.isFBExtensions=!0,vagaroFBExtensions.isExtensions_Mobile=e("#mobile-check").is(":visible")}vagaroFBExtensions.isExtensions_FB_iOS=vagaroFBExtensions.isFBExtensions&&/fbios/i.test(i)||!1,vagaroFBExtensions.isExtensions_FB_Android=vagaroFBExtensions.isFBExtensions&&/fb_iab/i.test(i)||!1,vagaroFBExtensions.isExtensions_Insta_iOS=vagaroFBExtensions.isFBExtensions&&/instagram/i.test(i)&&(/iphone/i.test(i)||/ios|ipad|ipod|itouch/i.test(i))||!1,vagaroFBExtensions.isExtensions_Insta_Android=vagaroFBExtensions.isFBExtensions&&/instagram/i.test(i)&&/android/i.test(i)||!1,vagaroFBExtensions.isExtensions_Android_Mobile=vagaroFBExtensions.isFBExtensions&&/android/i.test(i)&&e("#mobile-check").is(":visible"),vagaroFBExtensions.isExtensions_iOS_Mobile=vagaroFBExtensions.isFBExtensions&&(/iphone/i.test(i)||/ios|ipad|ipod|itouch/i.test(i))&&e("#mobile-check").is(":visible"),vagaroFBExtensions.isExtensions_Mobile=vagaroFBExtensions.isFBExtensions&&e("#mobile-check").is(":visible");var a,r="script",o="facebook-ixsdk",n=t.getElementsByTagName(r)[0];if(!t.getElementById(o)){(a=t.createElement(r)).id=o,a.src="https://connect.facebook.net/en_US/platform.Extensions.js",n.parentNode.insertBefore(a,n),-1!==e.inArray(location.host,["trunk.vagaro.com","p.vagaro.com","vagarodev17.vagaro.com","vagarodev16.vagaro.com","vagarodev.vagaro.com"])&&localStorage.setItem("com.facebook.fbextensions.debug_mode","102379999909139");var s={};vagaroFBExtensions.getUserDetail=function(t,i){s={};var a,r=e.Deferred();return(a=e.Deferred(),function e(){"undefined"!=typeof FBExtensions?a.resolve():setTimeout(function(){e()},1e3)}(),a.promise()).then(function(){var a;(a=e.Deferred(),FBExtensions.getUserID(function(e){s.psid=e.psid,a.resolve(s)},function(e,t){a.reject(e,t)}),e.when(a).promise()).then(function(a){(function(t,i){var a=e.Deferred();return FBExtensions.requestFormFields(function(e){s.user_name=e.fields.user_name.value,s.user_email=e.fields.user_email.value,s.user_phone=e.fields.user_phone.value,s.user_street=e.fields.user_street.value,s.user_city=e.fields.user_city.value,s.user_state=e.fields.user_state.value,s.user_country=e.fields.user_country.value,s.user_zipcode=e.fields.user_zipcode.value,s.user_address=e.fields.user_address.value,a.resolve(s)},function(e,t){a.reject(e,t)},{fields:[{id:"user_name",label:"Name",autocomplete:"name"},{id:"user_email",label:"Email",autocomplete:"email"},{id:"user_phone",label:"Phone number",autocomplete:"tel"},{id:"user_street",label:"Street",autocomplete:"address-line1"},{id:"user_city",label:"City",autocomplete:"address-level2"},{id:"user_state",label:"State",autocomplete:"address-level1"},{id:"user_country",label:"Country",autocomplete:"country-name"},{id:"user_zipcode",label:"Zipcode",autocomplete:"postal-code"},{id:"user_address",label:"Address",autocomplete:"street-address"}],business_name:t,terms_url:i}),a.promise()})(t,i).then(function(e){r.resolve(s),vagaroFBExtensions.data=s},function(e,t){console.log("requestFormFields-errorCode",e),console.log("requestFormFields-errorMessage",t),r.reject(e,t)})},function(e,t){console.log("getUserID-errorCode",e),console.log("getUserID-errorMessage",t),r.reject(e,t)})}),r.promise()}}}(jQuery,document,window);var cAppID,cChannelURL,CommonFromPage="",CommonFromPageForShopDetail="",sFromPage="",IsVagaroDefaultMaster=!1,blNeedstoRedirect="",sUserName="",sPassword="",GLogintype=0,FBGoogleAppleUserID="",isFromForms=!1,appleSignInData="",_gender={Female:0,Male:1,NonBinary:2,Optional:3},userccattemptdata={},isSignUpFromCustomerAPP=!1,isFromAppAutoSignIn=!1,isAmplitudeEventLog=!1,ApiURLEnumWBCheckout={getcartcount:(ApiPath="websiteapi/homepage/")+"getcartcount_wb",getwidgetuserdetails:ApiPath+"getwidgetuserdetails"};function LogOutFromFB(){FBAPP.funcLogout()}var timeout,QueryStringValue="",RedirectPages={MyAccountManagementMasterURl:"/myaccount/",DefaultPage:"/",ChangeBussinessSOPage:"/ShopOwner/ChooseBusiness.aspx",ThankYouPage:"/Users/ThankYou.aspx",FBOauthHome:"/oauth/fb/home",FBOauthLogin:"/oauth/fb",MyLikedStyles:"/photos/my-liked-styles",CustomerDefaultPage:"/myaccount/profile"},RedirectUserType={Customer:"1",ServiceProvider:"2",ShopAdmin:"4",ShopOwnerServiceProvider:"5"},_redirectTo={model:{IsCustomerApp:"",UserType:"0",smallMedia:"0",ReturnUrl:"",RedirectPageURL:"",Type:"",redirect_uri:""}},JSAdjustEventToken={app_launch_eventtoken:"2id34i",live_stream_class_joined_eventtoken:"kc0pbs",book_service_completed_eventtoken:"x169tw",request_service_completed_eventtoken:"tkefoi",marketplace_login_completed_eventtoken:"ml21u5",marketplace_signup_completed_eventtoken:"66jk7q",class_booking_completed_eventtoken:"qrwhm8",add_to_cart_eventtoken:"kgy2fi",product_purchased_completed_eventtoken:"t0i4z2",class_booking_requested_eventtoken:"1ect6c",gift_card_purchase_completed_eventtoken:"i4dswc",membership_purchase_completed_eventtoken:"hn11mn",package_purchase_completed_eventtoken:"etim0e"},JSAdjustEventName={app_launch:"app_launch",live_stream_class_joined:"live_stream_class_joined",book_service_completed:"book_service_completed",request_service_completed:"request_service_completed",marketplace_login_completed:"marketplace_login_completed",marketplace_signup_completed:"marketplace_signup_completed",class_booking_completed:"class_booking_completed",add_to_cart:"add_to_cart",product_purchased_completed:"product_purchase_completed",class_booking_requested:"class_booking_requested",gift_card_purchase_completed:"gift_card_purchase_completed",membership_purchase_completed:"membership_purchase_complete",package_purchase_completed:"package_purchase_completed"};function setBuilderVariables(e,t){var i,a=!1;if("Builder"!=(u="undefined"!=typeof WebsiteBuilderType?WebsiteBuilderType:$("#hdnWebsiteBuilderType").val())&&"LogoutfromBuilder"!=u||(a=!0),void 0===t&&e.split("|").length>=2&&(t=e.split("|")[1],FullUserName=e.split("|")[0]),e.split("|").length>15&&(i=e.split("|")[16],EncUidHash=e.split("|")[17],connectEncUid=e.split("|")[18],csEncUid=e.split("|")[19]),1==a){var r="";void 0!==WBBusinessID&&null!=WBBusinessID&&(r=WBBusinessID)}var o=e.split("|")[4],n=o.substring(o.lastIndexOf("/")+1),s="";(null==n||""==n||n.indexOf("user-male-img_155_new.png")>=0||n.indexOf("user-female-img_155.jpg")>=0)&&(s=FindInitials(FullUserName,"SP"),o="");var l=e.split("|")[5],d=(e.split("|")[6],getCookie("vPowerV2")),c={EncUid:i,UName:FullUserName,UImage:o,IVal:s,UEmail:l,LoginCookie:d,EncUidHash:EncUidHash,cEncUid:connectEncUid,csEncUid:csEncUid};if(setWBCookie("WebsiteBuilder",JSON.stringify(c)),1==a&&window.self!=window.top){var u="undefined"!=typeof WebsiteBuilderType?WebsiteBuilderType:$("#hdnWebsiteBuilderType").val(),p="undefined"!=typeof WebsiteBuilderEvent?WebsiteBuilderEvent:$("#hdnWebsiteBuilderEvent").val();if("Builder"==u||"LogoutfromBuilder"==u){var h=getQueryStringData("Data");"DealBookNow"!=p&&"WBBusinessServices"!=p&&"WBBusinessClasses"!=p&&"StaffServiceBook"!=p&&"StaffClassBook"!=p&&"ServiceBook"!=p&&(iframeParent="");var m=new vagaro.ajax;return m.datamodel.Token=ApiURLEnumWBCheckout.getcartcount,m.datamodel.IsNewVagaroAPI=!0,m.datamodel.callback=function(e){wbc._postMessage('{"eventType": "'+p+'", "ResponseData": '+JSON.stringify(c)+',"RequestData": "'+h+'","cartCount": "'+e+'"}')},m.datamodel.data={businessID:r,loginUserID:t},m.datamodel.Error=function(e){},m.Post(),"undefined"!=typeof WebsiteBuilderType||"WBBusinessServices"==p||"WBBusinessClasses"==p||"StaffServiceBook"==p||"StaffClassBook"==p||"ServiceBook"==p}}return!1}function widgetEncUserID(e){try{e.split("|").length>15&&(e.split("|")[16],EncUidHash=e.split("|")[17],connectEncUid=e.split("|")[18],csEncUid=e.split("|")[19]);var t={eventName:"CustomerLogin",timestamp:(new Date).getTime(),data:{customerId:""}};if("undefined"!=typeof staticEncryptUserID&&null!==staticEncryptUserID&&"VjyaDUqIaJ9ZTvKEP9kn6g=="===staticEncryptUserID){if(UserID&&parseInt(UserID)>0){var i=csEncUid;staticEncryptUserID=i,t.data.customerId=staticEncryptUserID}}else UserID&&parseInt(UserID)>0&&(t.data.customerId="undefined"!=typeof staticEncryptUserID&&null!==staticEncryptUserID?staticEncryptUserID:"");void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(t)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(t)}catch(e){}}function LoginRedirectTo(){_redirectTo.model.smallMedia=$(window).width()>=768?"1":"0",String.isNullOrUndefineOrBlank($("#hdnLoginQueryString").val())||(QueryStringValue=$("#hdnLoginQueryString").val());var e=getQueryStringData("ReturnUrl"),t=getQueryStringData("RedirectPageURL"),i=getQueryStringData("Type"),a=getQueryStringData("redirect_uri");if(null!=e&&void 0!==e&&""!=e&&!e.toLowerCase().includes(RedirectPages.MyAccountManagementMasterURl.toLowerCase())&&_redirectTo.model.UserType==RedirectUserType.Customer){var r=RedirectPages.MyLikedStyles;e.toLowerCase().includes("/cl/")||e.toLowerCase().includes(r)||e.toLowerCase().includes("/paylatersignup/")||e.toLowerCase().includes("/book-now?id=")||(e="")}ShowLoader(!0),void 0!==e&&null!=e&&""!=e?location.href=e:vgAppicationType==objApplicationType.CustomerApp||_redirectTo.model.UserType==RedirectUserType.Customer?location.href=RedirectPages.DefaultPage:void 0!==t&&null!=t&&""!=t&&"1"==_redirectTo.model.smallMedia?location.href=null!=i&&void 0!==i&&""!=i&&"FromConnect"!=i?RedirectPages.ChangeBussinessSOPage+"?RedirectPageURL="+t+NaN+i:RedirectPages.ChangeBussinessSOPage+"?RedirectPageURL="+t:_redirectTo.model.UserType!=RedirectUserType.ShopAdmin&&_redirectTo.model.UserType!=RedirectUserType.ServiceProvider&&_redirectTo.model.UserType!=RedirectUserType.ShopOwnerServiceProvider||"1"!=_redirectTo.model.smallMedia||window.location.pathname.toString().toLowerCase()==RedirectPages.FBOauthLogin?_redirectTo.model.UserType!=RedirectUserType.ShopOwnerServiceProvider&&_redirectTo.model.UserType!=RedirectUserType.ServiceProvider||window.location.pathname.toString().toLowerCase()!=RedirectPages.FBOauthLogin?location.href=RedirectPages.DefaultPage:location.href=void 0!==a&&null!=a&&""!=a?RedirectPages.FBOauthHome+"?redirect_uri="+QueryStringValue.substr(QueryStringValue.substring(QueryStringValue.indexOf("?")).split("=")[0].length+1):RedirectPages.FBOauthHome:location.href=RedirectPages.ChangeBussinessSOPage}function readParamFromQueryString(e,t){try{var i=e||"",a=i.indexOf("?");a>=0&&(i=i.substring(a+1));for(var r,o=i.split("&"),n=0;n<o.length;n+=1){var s=(o[n]||"").split("=");s[0]===t&&(r=s[1])}return void 0!==r&&null!=r&&""!=r?decodeURIComponent(r):""}catch(e){return""}}function getQueryStringData(e){try{var t=readParamFromQueryString(QueryStringValue,e);return""==t&&(t=window.location&&window.location.search?readParamFromQueryString(window.location.search.substring(1),e):""),t}catch(e){return""}}function getQueryStringData_Wb(e){for(var t,i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("&"),a=0;a<i.length;a+=1){var r=(i[a]||"").split("=");if(r[0]===e)if(r.length>2)for(a=1;a<r.length;a++)t?t+="="+r[a]:t=r[a];else t=r[1]}return void 0!==t&&null!=t&&""!=t?decodeURIComponent(t):""}function listner(e){if(null!=e&&"undefined"!=e&&null!=e.data&&"undefined"!=e.data){if(void 0===e.data)return;var t="";if(void 0!==e.originalEvent&&void 0!==e.originalEvent.data)try{t=JSON.parse(e.data||e.originalEvent.data)}catch(e){}else try{t=JSON.parse(e.data)}catch(e){}switch(t.eventType){case"LoginFromForms":if(isFromForms=!0,0==$(".lazy-img").is(":visible")&&$(".lazy-img").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload"),"undefined"!=typeof UserID&&null!=UserID&&""!=UserID&&UserID>0){var i={};i=null!=$("#hdnStrUserIdV2").val()&&void 0!==$("#hdnStrUserIdV2").val()&&""!=$("#hdnStrUserIdV2").val()?{LoginUserID:UserID,UserName:FullUserName,EncUserID:$("#hdnStrUserIdV2").val()}:{LoginUserID:UserID,UserName:FullUserName},window.parent.postMessage('{"eventType": "SendLoginData", "data": '+JSON.stringify(i)+"}","*")}else window.parent.postMessage('{"eventType": "ShowLoginPopup"}',"*"),showCommonLoginPopup("FromForms"),setTimeout(function(){$("#divLoginNew").css("display","block"),$("#divLoginNew").addClass("in")},1e3);break;case"SignUpFromForms":ShowSignupPage();break;case"addClassInVagaroBodyFromForms":$("html").addClass(t.data);break;case"SendBusinessData":var a=t.data;setTimeout(function(){$("#hdnBusinessID").val(a.businessId),$("#hdnBusinessGroupID").val(a.busGroupId);try{void 0!==a.busIsFormWidget&&null!=a.busIsFormWidget&&"true"==a.busIsFormWidget.toLowerCase()&&(isWidget="true",w_type=_common.WidgetTypeEnum.Embedded,SignUp_FromPage.value="FromForms")}catch(e){}},1e3);break;case"filledContractForm":onFilledContractForm();break;case"getrentcontractheightcallback":getrentcontractheightcallback(t);break;case"addStyle":addStyle(t.style,t.parentID,t.businessID,t.cookieobject);break;case"modalPosition":modalTop=t.modalTop,modalHeight=t.modalHeight,getCenterPoint=t.getCenterPoint,viewportHeightW=t.viewportHeightW,scrollPositionW=t.scrollPositionW}}}function GetDetailMore(){if("undefined"!=typeof isWindowsApp&&isWindowsApp){try{window.external.notify("facebooklogin")}catch(e){}ShowLoadingPanelLogin(!0)}else ShowLoadingPanelLogin(!0),FBAPP.funcLogin(function(e){if(e){var t=_gender.Female;"undefined"!=FBAPI.gender&&null!=FBAPI.gender||(t=_gender.Optional);var i="";"male"==FBAPI.gender&&(t=_gender.Male),i="undefined"==FBAPI.email||null==FBAPI.email?"":FBAPI.email;try{"undefined"!=typeof LoginHeader_NeedstoRedirect&&null!=LoginHeader_NeedstoRedirect&&(blNeedstoRedirect=LoginHeader_NeedstoRedirect)}catch(e){}signin(FBAPI.firstName,FBAPI.lastName,t,null,i+"|~|"+FBAPI.accessToken,FBAPI.userID,null,3,!1,!0,null,null,null,"")}else{var a={get_message:function(){return"Unable to log in with Facebook"}};CallFailed(a)}})}function FBloginForApp(e,t,i,a,r){ShowLoadingPanelLogin(!0);var o=_gender.Female,n="";void 0!==a&&"undefined"!=a&&null!=a||(o=_gender.Optional),"male"==a&&(o=_gender.Male),n="undefined"==i||null==i?"":i;try{"undefined"!=typeof LoginHeader_NeedstoRedirect&&null!=LoginHeader_NeedstoRedirect&&(blNeedstoRedirect=LoginHeader_NeedstoRedirect)}catch(e){}signin(e,t,o,null,n,r,null,3,!1,!0,null,null,null,"")}function fnLoginP(){ShowLoadingPanelLogin(!0),sUserName=SignUp_UserName.value,sPassword=SignUp_Password.value,""==SignUp_CCSwipe.value&&parseFloat(_EndKeyboardSpeed)<parseFloat(.05)&&""==SignUp_Password_EmailExist.value&&""==SignUp_UserName_EmailExist.textContent&&(SignUp_CCSwipe.value=sPassword);var e=SignUp_chkRemember.checked;try{"undefined"!=typeof LoginHeader_NeedstoRedirect&&null!=LoginHeader_NeedstoRedirect&&(blNeedstoRedirect=LoginHeader_NeedstoRedirect)}catch(e){}var t=SignUp_CCSwipe.value;SignUp_CCSwipe.value="";var i=1,a=!0;""!=t&&(i=2,""==(sUserName=sUserName.replace("%",""))&&(a=!1)),""==sUserName&&(SignUp_UserName.className="signininput errorInput",a=!1),""==sPassword&&1==i&&(SignUp_Password.className="signininput errorInput",a=!1);0!=a?signin(null,null,null,sUserName,"","",t,i,e,!0,EncPV(sPassword),getek(),getei(),""):ShowLoadingPanelLogin(!1)}function signin(e,t,i,a,r,o,n,s,l,d,c,u,p,h){GLogintype=s,FBGoogleAppleUserID=o,"False"!=recaptch.isCapAllowtoShow()&&recaptch.isCapShown()?(gCapchareponce=null==c_responce?"":c_responce,captchtype="Google"):(gCapchareponce="",captchtype="");var m="";if("undefined"!=typeof Vsecure){if(0==Vsecure.isValid("errorInput"))return void ShowLoadingPanelLogin(!1);m=Vsecure.getC()}h=m;var f="";try{f="undefined"!=typeof localStorage&&void 0!==localStorage.getItem("atCode")&&null!=localStorage.getItem("atCode")?localStorage.getItem("atCode"):""}catch(e){}var g='"fNam" : '+_securelogin.getJsonVal(e);g+=', "lNam" : '+_securelogin.getJsonVal(t),g+=', "gendr" : '+_securelogin.getJsonVal(i),g+=', "uNam" :'+_securelogin.getJsonVal(a),g+=', "email" : '+_securelogin.getJsonVal(r),g+=', "fbUserID" : '+_securelogin.getJsonVal(o),g+=null!=s&&null!=s&&5===s?', "sCardID" :'+_securelogin.getJsonVal("applelogin"):', "sCardID" :'+_securelogin.getJsonVal(n),g+=', "lType" :'+_securelogin.getJsonVal(s),g+=', "bRem" :'+_securelogin.getJsonVal(l),g+=', "bUpdateFTime" : '+_securelogin.getJsonVal(d),g+=', "pwrd" : '+_securelogin.getJsonVal(c),g+=', "ky" : '+_securelogin.getJsonVal(u),g+=', "ki" : '+_securelogin.getJsonVal(p),g+=', "cap" : '+_securelogin.getJsonVal(h),g+=', "gCapcha" : '+_securelogin.getJsonVal(gCapchareponce),g+=', "ctype" : '+_securelogin.getJsonVal(captchtype);var v="Unknown";try{-1!=navigator.appVersion.indexOf("Win")?v="Windows":-1!=navigator.appVersion.indexOf("Mac")?v="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?v="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(v="Linux"),g+=', "operatingSystem" : '+_securelogin.getJsonVal(v);var A=new Date,C=A.getFullYear()+"-"+("0"+(A.getMonth()+1)).slice(-2)+"-"+("0"+A.getDate()).slice(-2)+" "+("0"+A.getHours()).slice(-2)+":"+("0"+A.getMinutes()).slice(-2)+":"+("0"+A.getSeconds()).slice(-2);g+=', "clientDate" : '+_securelogin.getJsonVal(C)}catch(e){g+=', "operatingSystem" : '+_securelogin.getJsonVal(v),g+=', "clientDate" : ""'}if(g+=', "wsUserid" : 0',g+=', "bid" : 0',Vsecure.model.ltype=s,"undefined"!=typeof vgAppicationType&&1==vgAppicationType)void 0===s||null==s||5!==s||1!=IsIOSBrandedApp&&"true"!=IsIOSBrandedApp||(dInfoValue=""),String.isNullOrUndefineOrBlank(dInfoValue)?(g+=', "vid" : ""',g+=', "fpID" : ""'):(g+=', "vid" : "'+dInfoValue+'"',g+=', "fpID" : "'+dInfoValue+'"'),g+=',"atCode": ""',g+=', "isFromCookieLessWidget" : false',g+=', "ssoId" : ""',CallWebServicehed("MySampleService.asmx/SignIn",g+=', "acctkn" : ""',CallSuccessLoginCtrl,CallFailed);else if(g+=',"atCode":'+_securelogin.getJsonVal(f),8===s)g+=', "vid" : ""',g+=', "fpID" : ""',g+=', "isFromCookieLessWidget" : false',g+=', "ssoId" : ""',CallWebServicehed("MySampleService.asmx/SignIn",g+=', "acctkn" : ""',CallSuccessLoginCtrl,CallFailed);else kickOff(g)}function HideLogin(){$("#dvSignupNew").hide(),"undefined"!=typeof SignUp_ModalPopupLoginHide&&SignUp_ModalPopupLoginHide(),ShowLoadingPanelLogin(!1),"undefined"!=typeof TwoStepAuth&&TwoStepAuth.switchToStep1()}function CallSuccessLoginCtrl(e){_IsProcessing=!1;var t=!1;if(null!=e.d){if(null!=e.d)try{"string"==typeof e.d&&((e=JSON.parse(e.d)||e.d)&&null!=e.IsPolicyAck&&(t=e.IsPolicyAck),e&&"d"in e&&(e=e.d))}catch(t){e=e.d}if(null!=e&&e.indexOf("widget-")>-1){var i=e.split("|");if(i.length>0){var a=i.findIndex(function(e,t){if(e.toLowerCase().indexOf("widget-")>-1)return!0});if(a>-1){widgetcookievalue=i[a],widgetcookievalue=widgetcookievalue.replace("widget-","");try{var r={Key:"vdsid"};r.Value=widgetcookievalue,"undefined"!=typeof $Interframe&&void 0!==$Interframe.setStoratevalueintoParent&&$Interframe.setStoratevalueintoParent(r)}catch(e){}i.splice(a,1),e=i.join("|")}}}if(appleSignInData="",void 0!==e&&null!=e&&"-15"==e)return ShowLoadingPanelLogin(!1),void("undefined"!=typeof bootbox?vagaro.alert({message:"Your account is temporary locked out for security reason. Kindly check your email.",title:"Alert",callback:function(){_login.IsResponceLoginpage()}}):alert("Your account is temporary locked out for security reason. Kindly check your email."));if(null!=e&&null!=e&&""!=e.toString().trim()&&e.toString().indexOf("-13|")>-1&&(appleSignInData=e,e="-13"),"-9"!=e)if("-6"!=e&&"-5"!=e){if(""==e)return ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alertsmall({message:"Invalid UserName or Password",title:"Alert",callback:function(){"undefined"!=typeof SignUp_Password&&null!=SignUp_Password&&(SignUp_Password.value="",setTimeout(function(){SignUp_Password.focus()},10))}}):(alert("Invalid UserName or Password"),"undefined"!=typeof SignUp_Password&&null!=SignUp_Password&&(SignUp_Password.value="",SignUp_Password.focus())),"False"!=recaptch.isCapAllowtoShow()&&"undefined"!=typeof recaptch&&recaptch.showHideCap("False"),void("undefined"!=typeof Vsecure&&Vsecure.loadIfrm());if("undefined"!=typeof Vsecure&&Vsecure.showHideCap(!1),"-1"==e)return ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("There is some problem while swiping the card.Please swipe it again!"):alert("There is some problem while swiping the card.Please swipe it again!"),void(SignUp_CCSwipe.value="");if("-2"==e)return ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("Invalid Username or Card Swipe"):alert("Invalid Username or Card Swipe"),SignUp_CCSwipe.value="",void(SignUp_Password.value="");if("-3"==e)return ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("Something went wrong. Please try again!"):alert("Something went wrong. Please try again!"),void(SignUp_CCSwipe.value="");if("-4"!=e){if("-7"==e||"-8"==e)return ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?"-7"==e?vagaro.alert("There is some problem with Facebook Login. Please try again."):vagaro.alert("There is some problem with Google Login. Please try again."):"-7"==e?alert("There is some problem with Facebook Login. Please try again."):alert("There is some problem with Google Login. Please try again."),void(SignUp_CCSwipe.value="");if("-13"==e)return ShowLoadingPanelLogin(!1),resetCotrolForAppleFNameLName(),void ShowFnameLnameControlForAppleLogin(!1);if("-16"!=e){if("-17"==e)return ShowLoadingPanelLogin(!1),clearAlexaCookie("_vgamzn"),clearAlexaCookie("_vggoogle"),void("undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar&&showLogin("yes"));"undefined"!=typeof _common&&_common.CloseToggelmobileMenu(),_securelogin.Show2StepAuth(e,t)}else{ShowLoadingPanelLogin(!1);o="Invalid username or password";_securelogin.showAlert(o,function(){})}}else{ShowLoadingPanelLogin(!1);var o="Something went wrong. Please try again!";_securelogin.showAlert(o,function(){"undefined"!=typeof SignUp_Password&&null!=SignUp_Password&&(SignUp_Password.value="",setTimeout(function(){SignUp_Password.focus()},10))})}}else{if(ShowLoadingPanelLogin(!1),1==vgAppicationType&&"-6"==e)return void CallbackforMobileApp(0,0,"","",0,"6");if(IsShowCapcha="True","undefined"!=typeof Vsecure&&(Vsecure.loadIfrm(),Vsecure.showHideCap(!0)),"False"!=recaptch.isCapAllowtoShow()&&"undefined"!=typeof recaptch&&window.location.pathname.toString().toLowerCase()!=RedirectPages.FBOauthLogin&&(frmsignupnew.updateVsecure(),0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType)?(recaptch.showHideCap("True"),recaptch.reset()):IsShowCapcha="False",c_responce=null,"undefined"!=typeof bootbox?vagaro.alertsmall({message:"Invalid UserName or Password",title:"Alert",callback:function(){"-6"==e?"undefined"!=typeof SignUp_Password&&null!=SignUp_Password&&(SignUp_Password.value="",setTimeout(function(){SignUp_Password.focus()},10)):_login.IsResponceLoginpage()}}):alert("Invalid UserName or Password"),_login.IsResponceLoginpage()),"-6"==e){ShowLoadingPanelLogin(!1);var o="Invalid captcha code. Please try again.";_securelogin.showAlert(o,function(){"undefined"!=typeof SignUp_Password&&null!=SignUp_Password&&(SignUp_Password.value="",setTimeout(function(){SignUp_Password.focus()},10))}),"False"!=recaptch.isCapAllowtoShow()&&"undefined"!=typeof recaptch&&(recaptch.showHideCap("True"),recaptch.reset(),c_responce=null)}}else"undefined"!=typeof bootbox&&null!=bootbox?(ShowLoadingPanelLogin(!1),bootbox.alert({className:"vagaro-midium-popup",message:_twoFactor.FailOTPMessage(),title:"Error Code: XJ140"})):ShowLoadingPanelLogin(!0)}else ShowLoadingPanelLogin(!1)}function RedirectTwoStepAuth(e,t){if(void 0!==e&&null!=e&&e.length>10&&null!=e[10]){if(userccattemptdata.IsEmailPhoneVerified=e[10],userccattemptdata.EmailId=e[5],userccattemptdata.PhoneNo=e[6],userccattemptdata.isEmailPhoneVerified=e[10],userccattemptdata.FullName=e[0],userccattemptdata.UserID=e[3],userccattemptdata.IsTwoStepForSP=("2"==e[1]||"5"==e[1])&&"0"!=e[7],userccattemptdata.CountryID=void 0!==e[11]&&""!=e[11]?e[11]:"",userccattemptdata.IsNewBusiness=void 0!==e[12]&&"1"==e[12],userccattemptdata.UserType=void 0!==e[7]?e[7]:"1",isEmailPhoneVerified=e[10],$("#pnlCCSwipe").hide(),$("#hdnTwoFactorVerified").val(isEmailPhoneVerified),$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&0==userccattemptdata.IsTwoStepForSP)twoStepEmail={},twoStepEmail.emailid=$.trim(userccattemptdata.EmailId),twoStepEmail.phone=$.trim(userccattemptdata.PhoneNo.replace(/([()-\s])+/g,"")),twoStepEmail.fullname=userccattemptdata.FullName,twoStepEmail.CountryID=void 0!==e[11]&&""!=e[11]?e[11]:"",twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Email,twoStepEmail.UserType=userccattemptdata.UserType,_twoFactor.Model.IsPolicyAck=t,_twoFactor.Model.UserType=twoStepEmail.UserType,_twoFactor.Model.UserID=e[3],_twoFactor.LoadTwoFactorControlForInput(twoStepEmail);else if($("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailAndPhone||3!=isEmailPhoneVerified&&userccattemptdata.IsTwoStepForSP){var i=1==isEmailPhoneVerified?_twoFactor.AuthCodeReceiveMode.Cell:_twoFactor.AuthCodeReceiveMode.Email;ShowLoadingPanelLogin(!0),twoStepEmail={},twoStepEmail.emailid=$.trim(userccattemptdata.EmailId),twoStepEmail.phone=$.trim(userccattemptdata.PhoneNo.replace(/([()-\s])+/g,"")),twoStepEmail.fullname=userccattemptdata.FullName,twoStepEmail.CountryID=void 0!==e[11]&&""!=e[11]?e[11]:$("#ddlcountry option:selected").val(),twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.AuthenticationMode=i,twoStepEmail.UserType=userccattemptdata.UserType,_twoFactor.Model.IsPolicyAck=t,_twoFactor.Model.UserType=twoStepEmail.UserType,_twoFactor.Model.UserID=e[3],_twoFactor.LoadTwoFactorControlForInput(twoStepEmail)}}else _securelogin.AfterSuccessfullLogin()}function BookingAfterLogin(e,t,i){var a=new vagaro.ajax;a.datamodel.Token="GetOnlineBookStatus",a.datamodel.data=[e,t],a.datamodel.ErrorMessage="",a.datamodel.callback=function(e){e.IsBlockBook?(IsBlockBook=e.IsBlockBook.toString(),"BookAppointment"==i||"BookWaitlistAppointment"==i?_shopdetail.HideShowDisableBookMessageForApps(!0):"EventAddToCart1"!=i&&"EventAddToCart2"!=i&&"EventAddToCart3"!=i||(_shopdetail.ShowHideClassPopup(!1),_shopdetail.HideShowDisableBookMessageForClass(!0))):"BookAppointment"==i?(_shopdetail.CheckCustomerExists(),CheckAvailablePromotions(!0)):"BookWaitlistAppointment"==i?_vgWaitlist.ShowWaitlistPopup():"EventAddToCart1"!=i&&"EventAddToCart2"!=i&&"EventAddToCart3"!=i||(_shopdetail.setBookTextOnLoginlogout(!0),"EventAddToCart1"==i?_vgClassSessionSelection.AddToEventCart(1):"EventAddToCart2"==i?_vgClassSessionSelection.AddToEventCart(2):"EventAddToCart3"==i&&_vgClassSessionSelection.AddToEventCart(3))},a.Post()}function SendAdjustDataMobileApp(e,t,i){CallbackforMobileApp(0,0,"","","0","47|~|"+('{\\"eventName\\":\\"'+e+'\\",\\"eventToken\\":\\"'+t+'\\",\\"userid\\":\\"'+i+'\\"}'))}function chkMultiLocParameter(){"undefined"!=typeof isFromMultiLocation&&null!=isFromMultiLocation||(isFromMultiLocation=!1),"undefined"!=typeof b_themeID&&null!=b_themeID||(b_themeID=0),"undefined"!=typeof MultiLocBusinessID&&null!=MultiLocBusinessID||(MultiLocBusinessID=0)}window.addEventListener("message",listner,!1),_securelogin={model:{},Show2StepAuth:function(e,t){var i=e.split("|");if(this.model.ReturnValue=e,"2"!=i[1]&&"5"!=i[1]?(_redirectTo.model.UserType=i[7],$("#hdnUserType").val(i[7])):($("#hdnUserType").val(i[8]),_redirectTo.model.UserType=i[8]),"2"!=i[1]&&"5"!=i[1]||"0"==i[7]||!(i.length>10)||null!=i[10]&&""!=i[10])i.length>10&&null!=i[10]&&""!=i[10]&&void 0!==$("#hdnEmailAndCell2FScreen").val()&&null!=$("#hdnEmailAndCell2FScreen").val()&&""!=$("#hdnEmailAndCell2FScreen").val()&&$("#hdnEmailAndCell2FScreen").val()>_twoFactor.EmailAndCell2FScreen.None?RedirectTwoStepAuth(i,t):t&&8!=GLogintype?(r="",void 0!==sFromPage&&null!=sFromPage&&("ScreenLock"==sFromPage?TwoStepAuth.init("screenlock-privacypolicy",i[5],i[6],i[7],void 0,void 0,void 0,a,t,_redirectTo.model.UserType,i[3]):TwoStepAuth.init("privacypolicy",i[5],i[6],i[7],void 0,void 0,void 0,a,t,_redirectTo.model.UserType,i[3]))):this.AfterSuccessfullLogin();else{if("undefined"!=typeof vgAppicationType&&(vgAppicationType==objApplicationType.CheckinApp||vgAppicationType==objApplicationType.CustomerApp)&&"5"==i[1]&&1==isFromAppAutoSignIn){if(!$("#divLoginNew").is(":visible"))return callbacktomobile=e,void showLogin("yes",!0);isFromAppAutoSignIn=!1}var a=void 0!==i[11]&&""!=i[11]?i[11]:1,r="signupNew";"LoginPage"!=SignUp_FromPage.value&&"CMSMaster"!=SignUp_FromPage.value&&"ScreenLock"!=SignUp_FromPage.value&&"Login"!=SignUp_FromPage.value||(r=SignUp_FromPage.value),TwoStepAuth.init(r,i[5],i[6],i[7],void 0,void 0,void 0,a,t,i[8],i[3]),ShowLoadingPanelLogin(!1),openPopupVerification()}if("undefined"!=typeof isWindowsApp&&isWindowsApp)try{var o="login|"+sUserName+"|"+sPassword;window.external.notify(o)}catch(e){}},AfterSuccessfullLogin:function(){ReturnValue=this.model.ReturnValue,setCookie("loginTypeValue",GLogintype),_vgParseatkn(ReturnValue),getCookie("isSignupValue");var e=getCookie("isLoginValue"),t=getCookie("appleLoginSource");if(1==GLogintype&&null==e?(setCookie("isLoginValue",!1),setCookie("isSignupValue",!0)):1==GLogintype&&e&&(setCookie("isLoginValue",!0),setCookie("isSignupValue",!1)),5==t?(setCookie("isLoginValue",!0),setCookie("isSignupValue",!1)):6==t&&(setCookie("isLoginValue",!1),setCookie("isSignupValue",!0)),"undefined"!=typeof vgAppicationType&&1==vgAppicationType){var i=0;if(ReturnValue.split("|").length>=6?i=ReturnValue.split("|")[3]:parseInt(ReturnValue.split("|")[1])>0&&(i=ReturnValue.split("|")[1]),0==("undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp)){var a=ReturnValue.split("|"),r=a.length>1&&"4"==a[1],o=a.length>0?a[0]:"",n=a.length>4?a[4]:"",s=a.length>5?a[5]:"";(!baIsUndefine(IsBrandedApp)&&1==IsBrandedApp&&"2"!=a[1]||"undefined"!=typeof IsNewVersionCustomerAppForFbGoogleLogin&&null!=IsNewVersionCustomerAppForFbGoogleLogin&&""!==IsNewVersionCustomerAppForFbGoogleLogin&&null!=IsNewVersionCustomerAppForFbGoogleLogin&&1==IsNewVersionCustomerAppForFbGoogleLogin&&"2"!=a[1])&&(a.length>8&&(sUserName=a[8]),a.length>9&&(sPassword=a[9])),ReturnValue.split("|").length<5?sUserName=ReturnValue.split("|")[3]:a.length>8&&"2"!=a[1]&&(sUserName=a[8]),CallbackforMobileApp(0,0,"","","0",'5|~|{\\"username\\":\\"'+sUserName+'\\", \\"password\\":\\"'+sPassword.replace('"',"|~~|")+'\\", \\"UserID\\":'+i+', \\"LoginType\\":'+GLogintype+', \\"isFirstTimeCustomer\\":'+r+', \\"fullName\\":\\"'+o+'\\", \\"userEmailId\\":\\"'+s+'\\", \\"userImage\\":\\"'+n+'\\", \\"SocialUserID\\":\\"'+FBGoogleAppleUserID+'\\"}'),"undefined"!=typeof _home&&void 0!==_home.GetOutStandingReviewAndInvoiceCnt&&_home.GetOutStandingReviewAndInvoiceCnt(1)}else if(baIsUndefine(IsBrandedApp)||1!=IsBrandedApp||(sUserName=a.length>8?a[8]:"",sPassword=a.length>9?a[9]:""),ReturnValue.split("|").length<5?sUserName=ReturnValue.split("|")[3]:ReturnValue.split("|").length>8&&"2"!=ReturnValue.split("|")[1]&&(sUserName=ReturnValue.split("|")[8]),CallbackforMobileApp(0,0,"","","0","5|~|{ 'username':'"+sUserName+"', 'password':'"+sPassword.replace('"',"|~~|")+"' , 'UserID':"+i+" , 'LoginType':"+GLogintype+" , 'SocialUserID':"+FBGoogleAppleUserID+"}"),"undefined"!=typeof _home&&void 0!==_home.GetOutStandingReviewAndInvoiceCnt&&_home.GetOutStandingReviewAndInvoiceCnt(1),"undefined"!=typeof SignUp_FromPage&&"loginpage"==SignUp_FromPage.value.toLowerCase())return;isSignUpFromCustomerAPP||1!=GLogintype?5==GLogintype&&(ReturnValue.split("|").length>=12&&"NewAppleSignUp"==ReturnValue.split("|")[11]?SendAdjustDataMobileApp(JSAdjustEventName.marketplace_signup_completed,window.parent.JSAdjustEventToken.marketplace_signup_completed_eventtoken,i):SendAdjustDataMobileApp(JSAdjustEventName.marketplace_login_completed,JSAdjustEventToken.marketplace_login_completed_eventtoken,i)):SendAdjustDataMobileApp(JSAdjustEventName.marketplace_login_completed,JSAdjustEventToken.marketplace_login_completed_eventtoken,i),isSignUpFromCustomerAPP=!1}if("undefined"!=typeof Vsecure&&Vsecure.showHideCap(!1),"undefined"!=typeof recaptch&&(recaptch.showHideCap("False"),IsShowCapcha="False"),ReturnValue.split("|").length>=6){loggedInUserId=ReturnValue.split("|")[3],""!=ReturnValue.split("|")[0]?(UserNameArray=ReturnValue.split("|")[0],UserName=UserNameArray.split(" ")[0]+" "+(UserNameArray.split(" ")[1].length>1?UserNameArray.split(" ")[1].substring(0,1):UserNameArray.split(" ")[1])):UserName="",FullUserName=UserNameArray,$(".loginUserIntials").html(FindInitials(FullUserName,"SP")),$("#divBusinessfrom").length>0&&$("#divBusinessfrom").html("From :"+FullUserName),$("#dvUsername").html(UserName),UserID=loggedInUserId,UserEmail=ReturnValue.split("|")[5],void 0!==ReturnValue.split("|")[6]?UserCellNo=ReturnValue.split("|")[6]:UserCellNo="",$("#userImage").attr("src",ReturnValue.split("|")[4]);try{if(vgAppicationType==objApplicationType.CheckinApp&&void 0!==$("#CheckinImgUserProfile")){var l=ReturnValue.split("|")[4];""!=l?l.indexOf("user-female-img_155.jpg")>=0||l.indexOf("user-male-img_155.png")>=0?$("#CheckinImgUserProfile").html(FindInitials(FullUserName,"SP")):$("#CheckinImgUserProfile").addClass("lazy").css("background-image","url('"+ReturnValue.split("|")[4]+"')").lazyload():$("#CheckinImgUserProfile").html(FindInitials(FullUserName,"SP"))}}catch(e){}if("undefined"!=typeof _home){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType||(_home.CommonLogin(!0,UserName,ReturnValue.split("|")[4]),"undefined"!=typeof _siteBuilderDetail&&_home.GetOutStandingReviewAndInvoiceCnt(1)),"/"==tabSegment&&"2steps"!=this.model.ReturnValue.split("|")[9]&&(0==this.IsLoginRedirect()||$(window).width()<768)){_home.loadFavoriteBusinesses(),_home.loadUpComingAppointments(),_home.GetOutStandingReviewAndInvoiceCnt(1);try{"undefined"!=typeof _common&&void 0!==_common.FeaturedBusinessTooltip&&_common.FeaturedBusinessTooltip("login")}catch(e){}}if("undefined"!=typeof AfterBeforeLoginLiveStream){var d=!0;"4"==ReturnValue.split("|")[1]?d=!1:"1"==ReturnValue.split("|")[1]?("yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar)&&$(window).width()>=768&&(d=!1):"2"==ReturnValue.split("|")[1]&&ReturnValue.split("|").length>=8&&"6"!=ReturnValue.split("|")[8]&&("yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar)&&$(window).width()>=768&&(d=!1),1==d&&"undefined"!=typeof AfterBeforeLoginLiveStream&&(void 0!==sFromPage&&"LiveStreamEventAddToCart"==sFromPage||AfterBeforeLoginLiveStream())}}try{void 0!==_shopdetail&&null!=_shopdetail&&"function"==typeof _shopdetail.SetGoogleMapDirection&&_shopdetail.SetGoogleMapDirection()}catch(e){}}"undefined"!=typeof _common&&null!==_common&&"function"==typeof _common.GetLoginPlatformDetails&&"ScreenLock"!=sFromPage&&(isAmplitudeEventLog||(_common.GetLoginPlatformDetails(ReturnValue,sFromPage),isAmplitudeEventLog=!0)),ShowLoadingPanelLogin(!0),"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp||8!=GLogintype&&(sFromPage="undefined"!=typeof SignUp_FromPage?SignUp_FromPage.value:"");try{if(void 0!==GLogintype&&null!=GLogintype&&8==GLogintype&&"function"==typeof IsExistsAlxCookie&&IsExistsAlxCookie()&&"undefined"!=typeof redirectMyAccountPage&&null!=redirectMyAccountPage&&""!=redirectMyAccountPage)return void(window.location.href=redirectMyAccountPage)}catch(e){}if("LoginPage"!=sFromPage&&"ScreenLock"!=sFromPage&&HideSignup(),"HomePage"==sFromPage||"DefaultMaster"==sFromPage||"CMSMaster"==sFromPage||"ScreenLock"==sFromPage||"LoginPage"==sFromPage||"Login"==sFromPage||"CustomerMessagePage"==sFromPage){if("ShopDetail"==CommonFromPageForShopDetail&&"0"==ReturnValue.split("|")[1])try{"false"==IsWidget&&"false"==isCustomWebsite&&"false"==isFacebook&&ShowFavorites(),$Page.bookText(null)}catch(e){}this.DoLoginSuccess(),"CustomerMessagePage"==sFromPage&&("undefined"!=typeof _siteBuilderDetail&&void 0===_siteBuilderDetail.loginUserId||null==_siteBuilderDetail.loginUserId||""==_siteBuilderDetail.loginUserId||"0"==_siteBuilderDetail.loginUserId)&&(_siteBuilderDetail.loginUserId=UserID,localStorage.setItem("openCustomMessage","true"),location.reload())}else if("BookAppointment"==sFromPage||"BookWaitlistAppointment"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&BookingAfterLogin(businessID,UserID,sFromPage);else if("SubmitReview"==sFromPage)this.DoLoginSuccess(),this.IsLoginRedirect();else if("GiftCertificate"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&_siteBuilderDetail.createGC($("#hdnGCID").val());else if("Products"===sFromPage)this.DoLoginSuccess(),this.IsLoginRedirect();else if("ShoppingcartPopup"===sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&(0==_siteBuilderDetail.InvetoryID&&""!=_siteBuilderDetail.encInvetoryId?($("#divProductPreviewpageOnline").show(),$("#divProductListSection").hide()):($("#divShoppingcartpopup").modal("show"),_siteBuilderDetail.AddToCart(_siteBuilderDetail.InvetoryID,_siteBuilderDetail.loginQty,_siteBuilderDetail.loginTotalQuantity,1,"",_siteBuilderDetail.encInvetoryId)));else if("ReviewUC"==sFromPage)this.DoLoginSuccess(),_siteBuilderDetail.OpenReviewPopup();else if("WordPress"==sFromPage)$ManageWordPress.onLogin();else if("Zendesk"==sFromPage)$ZendeskLogin.onLogin();else if("LiveStreamEventBookmark"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&ManagaBusinessBookmark(objLiveStreamEventBookmark.obj);else if("LiveStreamEventAddToCartFromPopup"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&AddEventFromPublic();else if("LiveStreamEventAddToCart"==sFromPage){this.DoLoginSuccess(),0==this.IsLoginRedirect()&&ClassSignupPublic(objLiveStreamSignupPublic.appID,objLiveStreamSignupPublic.busID,!0);try{window.history.go(-1)}catch(e){}}else if("EventAddToCart1"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&BookingAfterLogin(businessID,UserID,"EventAddToCart1");else if("EventAddToCart2"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&BookingAfterLogin(businessID,UserID,"EventAddToCart2");else if("EventAddToCart3"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&BookingAfterLogin(businessID,UserID,"EventAddToCart3");else if("ClassSignup"==sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&BookingAfterLogin(businessID,UserID,"ClassSignup");else if("MembershipAddToCart"===sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&_onlineCheckout.MembershipAddToCart(objMembershipAddToCart);else if("GiftCertificateAddToCart"===sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&_onlineCheckout.GiftCertificateAddToCart(objGiftCertificateAddToCart);else if("ServiceAddToCart"===sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&_onlineCheckout.ServiceAddToCart(objServiceAddToCart);else if("ShoppingCartIconClick"===sFromPage)this.DoLoginSuccess(),0==this.IsLoginRedirect()&&($(objShoppingCartIconClick).attr("data-isbypass","true"),ShoppingCartIconClick(objShoppingCartIconClick));else if("CustomPackageAddToCart"===sFromPage)this.DoLoginSuccess();else if("FromForms"===sFromPage){this.DoLoginSuccess(),"undefined"==typeof loggedInUserId&&ReturnValue.split("|").length>=2&&(loggedInUserId=ReturnValue.split("|")[1],FullUserName=ReturnValue.split("|")[0]);var c="0";try{var u=ReturnValue.split("|");u.length>19&&void 0!==u[19]&&null!==u[19]&&""!==u[19].toString().trim()&&(c=u[19].toString().trim())}catch(e){console.error("Error extracting encUserID:",e),c="0"}var p={LoginUserID:loggedInUserId,UserName:FullUserName,EncUserID:c};window.parent.postMessage('{"eventType": "SendLoginData", "data": '+JSON.stringify(p)+"}","*")}else if("Invoice"===sFromPage)this.DoLoginSuccess();else if("ProviderLiveStream"===sFromPage){if(this.DoLoginSuccess(),0==this.IsLoginRedirect()){var h=[];h.push(_vgLiveStream.Init(ReturnValue.split("|")[3])),Promise.all(h).then(function(){console.log("sucess")},function(){console.log("failed")})}}else if("CustomerLiveStream"===sFromPage){if(this.DoLoginSuccess(),0==this.IsLoginRedirect()){var m=[];m.push(_vgLiveStream.Init(ReturnValue.split("|")[3])),Promise.all(m).then(function(){console.log("sucess")},function(){console.log("failed")})}}else clearlogincontrols(),ShowLoadingPanelLogin(!1);void 0!==$(".myaccount-link")&&0==$("#openlnkCalendar .caret").is(":visible")&&$(".myaccount-link").show(),0==this.IsLoginRedirect()&&void 0!==callBackLoginToHome&&"function"==typeof callBackLoginToHome&&callBackLoginToHome(!0)},DoLoginSuccess:function(){ReturnValue=this.model.ReturnValue,null!=ReturnValue.d&&(ReturnValue=ReturnValue.d);var e=ReturnValue.split("|");if("undefined"==typeof isWidget&&(isWidget="false",isCustomWebsite="false",isFacebook="false"),"Invoice"==sFromPage&&(location.href=location.href),(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase())&&widgetEncUserID(ReturnValue),window.self!=window.top){var t="undefined"!=typeof WebsiteBuilderType?WebsiteBuilderType:$("#hdnWebsiteBuilderType").val();if(("Builder"==t||"LogoutfromBuilder"==t)&&setBuilderVariables(ReturnValue,loggedInUserId))return!0}try{window.self==window.top&&("undefined"!=typeof vgAppicationType&&null!=vgAppicationType&&1==vgAppicationType||void 0!==e&&null!=e&&e.length>15&&setBuilderVariables(ReturnValue,loggedInUserId))}catch(e){}if("LoginPage"==sFromPage||"Login"==sFromPage){if("4"==e[1]||"5"==e[1])if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp)void 0!==_shopdetail.activeTabName&&"book-now"==_shopdetail.activeTabName.toLowerCase()||CallbackforMobileApp(0,0,"","",0,"7");else{setCookie("IsFirstTimeUser",!0);var i=getQueryStringData("ReturnUrl").toLowerCase();i.indexOf("paylatersignup")>0&&(i=(i=getQueryStringData("ReturnUrl").toLowerCase().split("?"))[0]),null==getQueryStringData("ReturnUrl")||void 0===getQueryStringData("ReturnUrl")||"/paylatersignup/invite"!=i&&"/myaccount/paymentmethods"!=getQueryStringData("ReturnUrl")?location.href=RedirectToPublicAccManagement:LoginRedirectTo()}else{try{"undefined"!=typeof localStorage&&"object"==typeof localStorage&&localStorage.setItem("atCode",ReturnValue.split("|")[13])}catch(e){}SetUserAuthCodeToken(ReturnValue,function(){if($(window).width(),!("5"!=e[7]&&"2"!=e[7]||String.isNullOrUndefineOrBlank(window.location.pathname)||"/oauth/fb"!=window.location.pathname.toString().toLowerCase()))return _FBBDP.LoginUserEmail=UserEmail,_FBBDP.FBoAuthPageLoad(e[3],0,"true",1),$("#divFbOAuthPopup .close").hide(),!0;LoginRedirectTo()})}return!0}if("4"!=e[1]&&"5"!=e[1]||"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue)if("3"==e[1])"undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&"false"==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),ShowLoadingPanelLogin(!1);else if("1"==e[1]&&"false"==isWidget){if("undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&"false"==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),"yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType)return;try{"undefined"!=typeof localStorage&&"object"==typeof localStorage&&localStorage.setItem("atCode",ReturnValue.split("|")[13])}catch(e){}return void SetUserAuthCodeToken(ReturnValue,function(){$(window).width()>=768&&(location.href=RedirectChangeBussinessSOPage)})}ShowLoadingPanelLogin(!1)}else if("2"==e[1])if("6"==e[8])"undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&"false"==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),ShowLoadingPanelLogin(!1);else{if("undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&"false"==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),"yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar&&("undefined"==typeof isWidget||"false"==isWidget.toLowerCase())){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType)return;try{"undefined"!=typeof localStorage&&"object"==typeof localStorage&&localStorage.setItem("atCode",ReturnValue.split("|")[13])}catch(e){}return void SetUserAuthCodeToken(ReturnValue,function(){$(window).width()>=768&&(location.href=RedirectChangeBussinessSOPage)})}ShowLoadingPanelLogin(!1)}else ShowLoadingPanelLogin(!1);else"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp?void 0!==_shopdetail.activeTabName&&"book-now"==_shopdetail.activeTabName.toLowerCase()||CallbackforMobileApp(0,0,"","",0,"7"):"undefined"!=typeof vgAppicationType&&vgAppicationType!=objApplicationType.CheckinApp&&"ProviderLiveStream"!=sFromPage&&"CustomerLiveStream"!=sFromPage&&"CustomerMessagePage"!=sFromPage&&"BookAppointment"!=sFromPage&&"ClassSignup"!=sFromPage&&(setCookie("IsFirstTimeUser",!0),"false"==isWidget&&"false"==isFacebook?location.href=RedirectToPublicAccManagement:(chkMultiLocParameter(),153758==_shopdetail.businessID?location.href="/us04/myaccount/profile?IsPopup="+IsPopup+"&IsBusinessWidgetPage="+isWidget+"&IsFacebookPage="+isFacebook+"&BusinessID="+_shopdetail.businessID+"&b_themeID="+b_themeID+"&IsFromMultiLocation="+isFromMultiLocation+"&MultiLocBusinessID="+MultiLocBusinessID:location.href="/myaccount/profile?IsPopup="+IsPopup+"&IsBusinessWidgetPage="+isWidget+"&IsFacebookPage="+isFacebook+"&BusinessID="+_shopdetail.businessID+"&b_themeID="+b_themeID+"&IsFromMultiLocation="+isFromMultiLocation+"&MultiLocBusinessID="+MultiLocBusinessID));return"ScreenLock"!=sFromPage&&("undefined"!=typeof LoginHeader_divLogin&&(LoginHeader_divLogin.style.display="none",LoginHeader_ddLogout.style.display="",LoginHeader_lblLoginName.innerHTML="<strong>Welcome,</strong> "+e[0]),4==e.length&&(""!=ReturnValue.split("|")[0]?(UserNameArray=ReturnValue.split("|")[0],UserName=UserNameArray.split(" ")[0]+" "+(UserNameArray.split(" ")[1].length>1?UserNameArray.split(" ")[1].substring(0,1):UserNameArray.split(" ")[1])):UserName="",FullUserName=UserNameArray,$("#dvUsername").html(UserName),$(".loginUserIntials").html(FindInitials(FullUserName,"SP")),UserID=e[1],UserName=e[0],UserEmail=e[3],"undefined"!=typeof _home&&("undefined"!=typeof vgAppicationType&&1==vgAppicationType||_home.CommonLogin(!0,UserName,"https://vagaro.azureedge.net/static-content/Images/user-male-img_155_new!1.png"))),"Login"==sFromPage&&LoginRedirectTo()),HideLogin(),"undefined"!=typeof hdnLogin&&""!=hdnLogin.value&&LoginRedirectTo(),"undefined"!=typeof $Page&&"function"==typeof $Page.getHandler&&$Page.getHandler().afterLogin(),!0},IsLoginRedirect:function(){var e=this.model.ReturnValue;null!=e.d&&(e=e.d);var t=e.split("|");if("4"!=t[1]&&"5"!=t[1]||"ProviderLiveStream"==sFromPage||"CustomerLiveStream"==sFromPage||"BookAppointment"==sFromPage||"ClassSignup"==sFromPage||"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue)return"1"==t[1]&&("undefined"==typeof isWidget||"false"==isWidget)&&("yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar)||"undefined"!=typeof hdnLogin&&""!=hdnLogin.value;if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){if(void 0!==_shopdetail.activeTabName&&"book-now"==_shopdetail.activeTabName.toLowerCase())return!1}else if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp)return!1;return!0},showAlert:function(e,t){"undefined"==typeof bootbox?(alert(e),"function"==typeof t&&t()):vagaro.alertsmall({message:e,title:"Alert",callback:t})},getJsonVal:function(e){return null==e?"null":'"'+e+'"'},isLocalhost:function(){return window.location.hostname.indexOf("localhost")>=0}};var WidgetParamsdata="";if(location.href.toLowerCase().indexOf("onlinechoosebusiness.aspx")&&"undefined"!=typeof isWidget&&"True"==isWidget){var formAction=$("#aspnetForm").attr("action"),queryString=formAction.split("?")[1],urlParams=new URLSearchParams(queryString);void 0!==urlParams&&null!=urlParams&&""!=urlParams&&(WidgetParamsdata="?"+urlParams)}var lgsuccess_new='<div id="dvloginsuccess" style="display: none" class="loginlink">';lgsuccess_new+="</div>";var lgsuccess='<div id="dvloginsuccess" style="display: none" class="loginlink EmbeddedWidgetLoginlink">';lgsuccess+="</div>";var menuItem='<div class="mobile-dropdown-link header">';function injecthtml(){var e=menuItem,t=document.getElementById("dvlogindropdown"),i=lgsuccess;"undefined"!=t&&null!=t&&""!=t?t.innerHTML=e:"undefined"!=i&&null!=i&&""!=t&&(i.innerHTML=e);var a=$("#mobile-menu").find("#dvlogindropdown");a.length>0&&(a.html(e),a.find("a").each(function(){$(this).removeClass("profile-dropdown-links w-dropdown-link w-hidden-main").addClass("mobile-dropdown-link")}),a.find(".loginlink, .mobile-dropdown-link").show());var r=document.getElementById("divbusinesslogin"),o=lgsuccess_new;"undefined"!=r&&null!=r&&""!=r?r.innerHTML=e:"undefined"!=o&&null!=o&&""!=r&&(o.innerHTML=e)}function DoLoginSuccess(e){null!=e.d&&(e=e.d);if(""==e)return ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("Invalid Username or Password"):alert("Invalid Username or Password"),SignUp_CCSwipe.value="",!1;if("-1"==e)ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("There is some problem while swiping the card.Please swipe it again!"):alert("There is some problem while swiping the card.Please swipe it again!"),SignUp_CCSwipe.value="";else if("-2"==e)ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("Invalid Username or Card Swipe"):alert("Invalid Username or Card Swipe"),SignUp_CCSwipe.value="";else if("-3"==e)ShowLoadingPanelLogin(!1),"undefined"!=typeof bootbox?vagaro.alert("Something went wrong. Please try again!"):alert("Something went wrong. Please try again!"),SignUp_CCSwipe.value="";else{var t=e.split("|");"undefined"==typeof isWidget&&(isWidget="false",isCustomWebsite="false",isFacebook="false");try{"undefined"!=typeof localStorage&&"object"==typeof localStorage&&localStorage.setItem("atCode",e.split("|")[13])}catch(e){}SetUserAuthCodeToken(e,function(){if("LoginPage"==sFromPage||"Login"==sFromPage){if("4"==t[1]||"5"==t[1])"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp?void 0!==_shopdetail.activeTabName&&"book-now"==_shopdetail.activeTabName.toLowerCase()||CallbackforMobileApp(0,0,"","",0,"7"):(setCookie("IsFirstTimeUser",!0),location.href=RedirectToPublicAccManagement);else{if(!($(window).width()>=768))return location.href="/",!1;LoginRedirectTo()}return!0}if("4"!=t[1]&&"5"!=t[1]||"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue)if("3"==t[1])"undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&$("#lnkCalender").show(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),ShowLoadingPanelLogin(!1);else if("1"==t[1]&&"false"==isWidget)if("undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&0==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),"yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar){if("undefined"!=typeof RedirectToCalendar&&(RedirectToCalendar="no"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType)return;if($(window).width()>=768)return void("Login"==sFromPage?LoginRedirectTo():location.href=RedirectChangeBussinessSOPage)}else ShowLoadingPanelLogin(!1);else if("2"==t[1])if("6"==t[8])"undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&"false"==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),ShowLoadingPanelLogin(!1);else{if("undefined"!=typeof LoginHeader_spnSOLanding?null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display=""):(null!=$("#lnkCalender")&&0==isWidget?$("#lnkCalender").show():$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","")),"yes"==blNeedstoRedirect||"undefined"!=typeof RedirectToCalendar&&"yes"==RedirectToCalendar&&("undefined"==typeof isWidget||"false"==isWidget.toLowerCase())){if("undefined"!=typeof RedirectToCalendar&&(RedirectToCalendar="no"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType)return;try{"undefined"!=typeof localStorage&&"object"==typeof localStorage&&localStorage.setItem("atCode",e.split("|")[13])}catch(e){}return void SetUserAuthCodeToken(e,function(){$(window).width()>=768&&(location.href=RedirectChangeBussinessSOPage)})}ShowLoadingPanelLogin(!1)}else ShowLoadingPanelLogin(!1);else"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp?void 0!==_shopdetail.activeTabName&&"book-now"==_shopdetail.activeTabName.toLowerCase()||CallbackforMobileApp(0,0,"","",0,"7"):(setCookie("IsFirstTimeUser",!0),"false"==isWidget&&"false"==isFacebook?location.href=RedirectToPublicAccManagement:(chkMultiLocParameter(),location.href="/myaccount/profile?IsPopup="+IsPopup+"&IsBusinessWidgetPage="+isWidget+"&IsFacebookPage="+isFacebook+"&BusinessID="+GetBusinessID()+"&b_themeID="+b_themeID+"&IsFromMultiLocation="+isFromMultiLocation+"&MultiLocBusinessID="+MultiLocBusinessID));return"ScreenLock"!=sFromPage&&("undefined"!=typeof LoginHeader_divLogin&&(LoginHeader_divLogin.style.display="none",LoginHeader_ddLogout.style.display="",LoginHeader_lblLoginName.innerHTML="Welcome, "+t[0]),4==t.length&&(""!=e.split("|")[0]?(UserNameArray=e.split("|")[0],UserName=UserNameArray.split(" ")[0]+" "+(UserNameArray.split(" ")[1].length>1?UserNameArray.split(" ")[1].substring(0,1):UserNameArray.split(" ")[1])):UserName="",FullUserName=UserNameArray,$("#dvUsername").html(UserName),$("#userImage").attr("src","https://vagaro.azureedge.net/static-content/Images/user-male-img_155_new.png"),UserID=t[1],UserName=t[0],UserEmail=t[3],$("#logOut").slideUp(),$("#userlogin").slideDown())),HideLogin(),null!=hdnLogin&&"undefined"!=hdnLogin&&""!=hdnLogin.value&&LoginRedirectTo(),"undefined"!=typeof $Page&&"function"==typeof $Page.getHandler&&$Page.getHandler().afterLogin(),!0})}}function LoginUserRememberMeApp(e,t){ShowLoadingPanelLogin(!0),sUserName=e,sPassword=t,signin(null,null,null,e,"","","",1,!1,!0,EncPV(t),getek(),getei(),"")}function LogoutForceFully(){CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,_onlineCheckout.CallFailed)}function fnLogout(){var e=[];"undefined"!=typeof bootbox?bootbox.confirm({title:"Logout",message:"Are you sure you want to logout?",callback:function(t){t&&(e.length>0&&(_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),$("#lblEventCart").html("0"),_onlineCheckout.GetCartItemCount(0),"block"==$("#divEventCartDetail").css("display").toLowerCase()&&_shopdetail.ShowHideCart(!1)),void 0!==_shopdetail&&void 0!==_shopdetail.GetRescheduleDetail&&null!=_shopdetail.GetRescheduleDetail()&&_shopdetail.ClearClassControls(!0),"undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&(onlineShoppingCart={}),"undefined"!=typeof onlineShoppingCartmain&&null!=onlineShoppingCartmain&&(onlineShoppingCartmain={}),void 0!==isAmplitudeEventLog&&(isAmplitudeEventLog=!1),CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed),$("#dvlogindropdown").empty(),$("#mobile-menu").children("#dvlogindropdown").empty(),$("#divbusinesslogin").empty(),$("#desktop-menu").children("#divbusinesslogin").empty(),_vgClassSessionSelection.commonProperty.spNameClass="",_vgClassSessionSelection.commonProperty.spIdClass="",void 0!==deleteKeyValue&&deleteKeyValue())}}):CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed)}function CallSuccessLogout(e){if(null!=e.d&&(e=e.d),clearCookie("isSignupValue"),clearCookie("isLoginValue"),clearCookie("loginTypeValue"),clearCookie("appleLoginSource"),clearCookie("WebsiteBuilder"),clearAlexaCookie("_vgamzn"),clearAlexaCookie("_vggoogle"),e){"undefined"!=typeof publicUserGroupID?publicUserGroupID="":"undefined"!=typeof _siteBuilderDetail&&void 0!==_siteBuilderDetail.ComponentResponse&&null!=_siteBuilderDetail.ComponentResponse&&void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo&&void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID&&(_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID=""),"undefined"==typeof _siteBuilderDetail||void 0===_siteBuilderDetail.loginUserId||null==_siteBuilderDetail.loginUserId&&""==_siteBuilderDetail.loginUserId&&"0"==_siteBuilderDetail.loginUserId||void 0===_siteBuilderDetail.IsVagaroConnectOpen||void 0===_siteBuilderDetail.HideVagaroConnectChat||(_siteBuilderDetail.loginUserId="0",_siteBuilderDetail.IsVagaroConnectOpen=!1,_siteBuilderDetail.HideVagaroConnectChat()),void 0!==IsUserGroupCheck&&(IsUserGroupCheck=!1),void 0!==shopdetailuserGroupId&&(shopdetailuserGroupId=""),"undefined"!=typeof TwoStepAuth&&TwoStepAuth.switchToStep1(),$("#divUserName").html("");try{"object"==typeof localStorage&&(localStorage.removeItem("cusList"),localStorage.removeItem("cusSynInfo"),localStorage.removeItem("ReviewPlatformData"))}catch(e){}if(clearCookie("IsFirstTimeUser"),"undefined"!=typeof LoginHeader_divLogin)LoginHeader_divLogin.style.display="",LoginHeader_ddLogout.style.display="none",LoginHeader_lblLoginName.innerHTML="",void 0!==$(".myaccount-link")&&$(".myaccount-link").hide(),null!=LoginHeader_spnSOLanding&&(LoginHeader_spnSOLanding.style.display="none");else{$("#dvUsername").html(""),UserName="",FullUserName="",$("#hdnUserName").val(""),UserID="",$("#hdnUserId").val(""),UserEmail="",$("#hdnUserEmail").val(""),UserCellNo="",null!=$("#lnkCalender")&&$("#lnkCalender").hide(),$("#lnkCalenderCustom","#userloginLinks").css("display","none"),$(".loginlink ,#divLoginDetail").hide(),$("#divLoginDetailCart").hide(),$(".lnkLogin").show(),_common.CloseToggelmobileMenu(),"undefined"!=typeof _home&&($("#scBookMarkSection").hide(),_home.ResetUpcomingAppObjDivhide(),"undefined"!=typeof AfterBeforeLoginLiveStream&&AfterBeforeLoginLiveStream());try{$("#hdnUserType").val(""),UserType="","undefined"!=typeof _common&&void 0!==_common.FeaturedBusinessTooltip&&_common.FeaturedBusinessTooltip("logout")}catch(e){}}if(null!=readCookie("VagaroUID"))var t=readCookie("VagaroPWD");if(null!=t&&navigator.appName,void 0!==callBackLogout&&"function"==typeof callBackLogout&&callBackLogout(),window.location.href.indexOf("gift-certificates")>0&&_shopdetail.backClickGCGenerete(),1!=window.location.href.includes("/photos/")&&1!=window.location.href.includes("/my-liked-styles")||!$("#photos").hasClass("active")||setMylikesGalleryFilterValue(0,"aMyLikesOption_filter_0",1,0),"undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("loggedout")}catch(e){}if("undefined"!=typeof hdnLogin)if(""!=hdnLogin.value)if("logout"==hdnLogin.value){var i=$("#hdnWhereToRedirectInCaseOfNewDesign").val();""!=i&&"/login"!=i?location.href=i:""!=i&&"/login"==i?showLogin("yes",!0):""!=readCookie("promotionalurl")&&readCookie("PromotionUIDetails")?location.href="/salons/"+readCookie("promotionalurl"):location.href="/"}else LoginRedirectTo();else""!=$("#hdnWhereToRedirectInCaseOfNewDesign").val()&&"/login"==$("#hdnWhereToRedirectInCaseOfNewDesign").val()?showLogin("yes",!0):"undefined"!=typeof $Page&&"function"==typeof $Page.getHandler&&$Page.getHandler().afterLogout();try{void 0!==_shopdetail&&null!=_shopdetail&&"function"==typeof _shopdetail.SetGoogleMapDirection&&_shopdetail.SetGoogleMapDirection()}catch(e){}if("undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())try{widgetcookievalue="";var a={Key:"vdsid",Value:""};"undefined"!=typeof $Interframe&&void 0!==$Interframe.setStoratevalueintoParent&&$Interframe.setStoratevalueintoParent(a)}catch(e){}(window.location.href.indexOf("book-now")>0||window.location.href.indexOf("shopping-bag")>0||window.location.href.indexOf("paymentmethods")>0)&&(void 0===fnLogoutwithoutConfirm||1==fnLogoutwithoutConfirm?location.reload(!0):fnLogoutwithoutConfirm=void 0)}}function CallFailed(e){_IsProcessing=!1,ShowLoadingPanelLogin(!1),"undefined"!=typeof SignUp_CCSwipe&&null!=SignUp_CCSwipe&&(SignUp_CCSwipe.value="")}function HideSignup(){"undefined"!=typeof HideDynamicPopup&&(HideDynamicPopup("divSignUp"),$("#dvSignupNew").hide()),HideLogin()}menuItem+="<div>Account</div>",menuItem+="</div>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/profile'+WidgetParamsdata+'" id="accprofile" title="My Profile">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon profile-SlideRight" aria-hidden="true">',menuItem+='<div class="profilesidePic profilesidePicMobile"></div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">My Profile</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/familyfriends'+WidgetParamsdata+'" id="accfamilyfriends" title="Family & Friends">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf0c0;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Family & Friends</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/notification'+WidgetParamsdata+'" id="accnotification" title="Notification Settings">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf0f3;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Notification Settings</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/bookmarks'+WidgetParamsdata+'" id="accbookmarks" title="Bookmarks">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf02e;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Bookmarks</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/reviews'+WidgetParamsdata+'" id="accreviews" title="Reviews">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf044;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Reviews</div>',menuItem+='<div style="display: none" class="notification-bubble count-iconRound revcount"></div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<div class="mobile-dropdown-link header">',menuItem+="<div>Purchases</div>",menuItem+="</div>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/appointments'+WidgetParamsdata+'" id="accappointments" title="Appointments">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf133;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Appointments</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/products'+WidgetParamsdata+'" id="accproducts" title="Products">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon font-awesome-light-pro">',menuItem+='<div class="common-vagaro-icon">&#xe901;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Products</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/packages'+WidgetParamsdata+'" id="accpackages" title="Packages">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf49e;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Packages</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/memberships'+WidgetParamsdata+'" id="accmemberShips" title="Memberships">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf47f;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Memberships</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<div class="mobile-dropdown-link header">',menuItem+="<div>Payments</div>",menuItem+="</div>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/payrollhistory'+WidgetParamsdata+'" runat="server" id="accpayrollhistory" title="Payroll History">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf1da;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Payroll History</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/paymentmethods'+WidgetParamsdata+'" runat="server" id="myaccountpaymentmethods" title="Payments">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf09d;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Payment Methods</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/buynowpaylater'+WidgetParamsdata+'" id="accvpaylater" title="Buy Now, Pay Later" >',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">',menuItem+='<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="28" height="22" viewBox="0 0 3840.000000 2160.000000" preserveAspectRatio="xMidYMid meet"><g transform="translate(0.000000,2160.000000) scale(0.100000,-0.100000)" fill="currentColor" stroke="none"><path d="M18920 21087 c-3 -2 -113 -7 -245 -11 -132 -4 -251 -8 -265 -10 -14 -2 -79 -7 -145 -11 -66 -3 -140 -8 -165 -11 -25 -2 -119 -11 -210 -19 -2925 -273 -5731 -1484 -7935 -3423 -391 -345 -810 -760 -1196 -1187 -59 -65 -233 -267 -284 -330 -22 -27 -54 -65 -71 -84 -128 -149 -398 -502 -601 -787 -1493 -2093 -2398 -4609 -2573 -7154 -6 -85 -12 -180 -15 -210 -8 -101 -20 -572 -20 -790 0 -228 13 -738 19 -780 2 -14 7 -77 10 -140 23 -407 96 -1022 177 -1490 216 -1239 619 -2512 1144 -3607 l78 -163 1569 0 c1253 0 1568 3 1562 13 -4 6 -58 93 -119 192 -880 1411 -1435 2989 -1630 4630 -87 733 -101 1549 -40 2280 237 2819 1518 5451 3580 7354 1630 1505 3648 2494 5815 2851 324 53 723 101 970 115 58 4 110 8 117 10 56 18 913 26 1240 12 1541 -64 3103 -468 4503 -1163 470 -233 824 -437 1259 -728 772 -514 1502 -1148 2124 -1844 1881 -2106 2910 -4836 2881 -7642 -23 -2102 -611 -4127 -1710 -5881 -60 -95 -113 -179 -117 -186 -7 -11 277 -13 1566 -13 l1574 0 83 178 c512 1093 861 2158 1089 3322 106 543 185 1138 221 1665 5 88 12 183 15 210 8 94 20 550 20 790 0 792 -61 1529 -191 2310 -480 2884 -1845 5552 -3889 7600 -273 274 -347 345 -535 515 -1468 1325 -3220 2335 -5110 2945 -362 117 -557 172 -933 266 -721 178 -1592 319 -2257 364 -52 4 -104 8 -116 10 -12 2 -93 6 -180 10 -87 4 -170 9 -184 11 -34 6 -874 16 -880 11z"></path><path d="M19120 13713 c-586 -30 -1109 -106 -1690 -247 -1180 -285 -2413 -819 -3335 -1443 -138 -94 -405 -291 -405 -299 0 -5 1160 -2458 1165 -2462 2 -2 52 39 112 90 305 264 661 518 1028 734 166 97 570 304 737 378 535 235 1110 408 1598 481 436 65 934 72 1353 19 1047 -132 1590 -629 1564 -1429 -5 -170 -29 -271 -93 -399 -138 -275 -430 -471 -869 -581 -183 -47 -335 -70 -685 -105 -2587 -260 -4367 -876 -5391 -1868 -558 -540 -880 -1162 -988 -1907 -31 -212 -40 -367 -36 -625 10 -602 121 -1094 355 -1575 262 -536 693 -999 1231 -1320 571 -339 1267 -547 2079 -620 245 -22 727 -30 925 -16 498 37 949 141 1405 324 129 52 420 194 555 272 638 366 1196 911 1590 1551 l85 137 0 -961 0 -962 1665 0 1665 0 -3 4283 c-3 4640 1 4325 -52 4702 -177 1256 -722 2204 -1646 2866 -727 520 -1706 844 -2849 943 -322 28 -887 49 -1070 39z m2060 -7515 c0 -457 -135 -1020 -349 -1463 -301 -622 -736 -1079 -1290 -1355 -362 -180 -715 -261 -1137 -261 -218 0 -289 5 -464 32 -667 104 -1075 432 -1176 945 -24 117 -24 380 -1 514 122 714 676 1180 1712 1439 429 107 1017 189 1555 216 69 4 135 8 148 10 12 2 138 7 280 11 141 4 258 8 260 9 1 1 106 3 232 4 l230 2 0 -103z"></path></g></svg>',menuItem+="</div>",menuItem+="</div>",menuItem+='<div class="side-nav-Text">Buy Now, Pay Later</div>',menuItem+='<div style="display: none" class="notification-bubble count-iconRound fTraCount"></div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/points'+WidgetParamsdata+'" id="accpoints" title="Points">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf005;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Points</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/gift'+WidgetParamsdata+'" id="accgift" title="Gift Cards">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf663;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Gift Cards</div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<a class="profile-dropdown-links w-dropdown-link loginlink" href="/myaccount/invoices'+WidgetParamsdata+'" id="myaccountivoices" title="Invoices">',menuItem+='<div class="d-flex">',menuItem+='<div class="side-nav-icon">',menuItem+='<div class="font-awesome-light-pro">&#xf570;</div>',menuItem+="</div>",menuItem+='<div class="side-nav-Text">Invoices</div>',menuItem+='<div style="display: none" class="notification-bubble count-iconRound invcount"></div>',menuItem+="</div>",menuItem+="</a>",menuItem+='<div class="mobile-separator hideincustomdesign"></div>';var glbRedirectPageURLForIPad="";function getCookie(e){if(void 0!==$.cookie)return $.cookie(e);var t,i,a,r=document.cookie.split(";");for(t=0;t<r.length;t++)if(i=r[t].substr(0,r[t].indexOf("=")),a=r[t].substr(r[t].indexOf("=")+1),(i=i.replace(/^\s+|\s+$/g,""))==e)return unescape(a)}function showCommonLoginPopup(e){ShowLoadingPanelLogin(!0),"ScreenLock"==(sFromPage=e)?$("body").addClass("screenlocksignin"):$("body").removeClass("screenlocksignin");var t=!1;"undefined"!=typeof callbacktomobile&&null!=callbacktomobile&&""!=callbacktomobile&&"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&("5"==callbacktomobile.split("|")[1]&&(t=!0));if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&0==t)CallbackforMobileApp(0,0,"","",0,"2|~|3");else if(""!=$("#dvSignupNew").html()&&null!=$("#dvSignupNew").html()||"ScreenLock"==sFromPage){$("#pnlLogin").show(),$("#dvAuth").hide(),$("#dvSignupNew").show(),showCommonLoginPopupDetails(sFromPage);try{("undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions||void 0!==_shopdetail.isFBExtensions&&"true"==_shopdetail.isFBExtensions.toLowerCase()||"undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.IsFirstTimeCustomer&&void 0!==vagaroFBExtensions.data)&&$("#divNewToVagaro").hide()}catch(e){}}else{resetCotrolForAppleFNameLName(),hideAppleFNameLNameControls(),$("#dvSignupNew").html("");var i={UserControlPath:"~/UserControls/SignupNew.ascx",PageNamePath:"~/Public.Master",isRemoveFormTag:!0};"function"==typeof CallWSJSON?CallWSJSON("CalendarWebService.asmx/LoadUserControl",JSON.stringify(i),showCommonLoginPopupSuccess_LoadUserControlCCPopup,showCommonLoginPopupFail_LoadUserControlCCPopup):CallWSJSON1("CalendarWebService.asmx/LoadUserControl",JSON.stringify(i),showCommonLoginPopupSuccess_LoadUserControlCCPopup,showCommonLoginPopupFail_LoadUserControlCCPopup)}}function showCommonLoginPopupSuccess_LoadUserControlCCPopup(e){var t=sFromPage,i=isFromForms,a=QueryStringValue;try{$("#dvSignupNew").show();var r=$("#dvSignupNew"),o=e&&void 0!==e.d&&null!=e.d?e.d:"";r.html(""),""!=o&&r.append(o)}catch(e){}sFromPage=t,CommonFromPage=t,isFromForms=i,QueryStringValue=a;try{$("#hdnLoginQueryString").length&&$("#hdnLoginQueryString").val(a)}catch(e){}showCommonLoginPopupDetails(sFromPage),1==isFromForms&&($(".sign-up-image").hide(),$("#btnBackLogin").hide(),$("#btnBackSignup").hide(),$(".login-backbtn").hide()),"ProviderLiveStream"!==sFromPage&&"CustomerLiveStream"!==sFromPage||$("#btnBackLogin").hide(),"undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.IsFirstTimeCustomer&&void 0!==vagaroFBExtensions.data&&0==vagaroFBExtensions.IsFirstTimeCustomer&&($("#txtUsernameP").val(vagaroFBExtensions.data.user_email),$("#divNewToVagaro").hide());try{("undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions||void 0!==_shopdetail.isFBExtensions&&"true"==_shopdetail.isFBExtensions.toLowerCase())&&$("#divNewToVagaro").hide()}catch(e){}void 0!==isBrandedAppForApproval&&1==isBrandedAppForApproval&&($("#strAppleSignInBtn").text("Sign in with Apple"),$(".sign-up-image").hide());try{if("undefined"!=typeof callbacktomobile&&null!=callbacktomobile&&""!=callbacktomobile&&"undefined"!=typeof vgAppicationType&&(vgAppicationType==objApplicationType.CheckinApp||vgAppicationType==objApplicationType.CustomerApp))"5"==callbacktomobile.split("|")[1]&&(_securelogin.Show2StepAuth(callbacktomobile),callbacktomobile=null,isFromAppAutoSignIn=!1)}catch(e){}}function showCommonLoginPopupFail_LoadUserControlCCPopup(e){ShowLoadingPanal(!1);try{var t=JSON.parse(e.responseText);vagaro.alert(t.Message)}catch(e){vagaro.alert("Something went wrong, Try Again.")}}function showCommonLoginPopupDetails(e){sFromPage=e,LoadFacebook(cAppID,cChannelURL);var t=IsCookieEnabled();0!=t&&1!=t||void 0!==_common.IsCookieLessWidget&&0!=_common.IsCookieLessWidget()?("ScreenLock"==sFromPage&&ShowLoadingPanelLogin(!0),PopupLoginShow()):showCoockiePopup(t)}function showCoockiePopup(e){if(1==IsCookieEnabled()){var t=JSON.stringify({object:"openinNewWindow",URL:window.self.location.href});return window.parent.postMessage(t,"*"),void ShowLoader(!1)}try{1==e?(_pCookieDisabled.style.display="none",_pCookieThirdPartDisabled.style.display="block"):(_pCookieDisabled.style.display="block",_pCookieThirdPartDisabled.style.display="none"),"undefined"==typeof _common?($find("modalpopupCookie").show(),ShowLoader(!1)):($("#dvCookieModal").modal("show"),ShowLoader(!1))}catch(e){}}function openloginpopup(){"undefined"!=typeof BasePage&&"Detail"==BasePage&&$("#dvRegister").removeClass("fade").modal("hide"),String.isNullOrUndefineOrBlank(sFromPage)||"Login"!=sFromPage||$(".modal-backdrop").removeClass("show"),openlogin()}function openlogin(){ShowLoader(!0),HideSignup(),$("#dvSignupNew").show(),SignUp_ModalPopupLoginShow(),ShowLoader(!1)}function openPopuplogin(){openPopupVerification(),$("#dvSignupNew").show(),SignUp_ModalPopupLoginShow()}function openPopupVerification(){$(".signup-user-found").addClass(" w-hiddenstrict"),$(".sign-in-btn-divinner").removeClass(" w-hiddenstrict"),$(".sign-in-logo-div").removeClass(" w-hiddenstrict")}function ShowFnameLnameControlForAppleLogin(e){$(".sign-in-btn-div.stepLogin1").addClass("slide1"),$(".sign-in-btn-div.stepAppleflname").addClass("slide2"),$("#divLoginStep1").addClass(" w-hiddenstrict"),$("#divAppleFLStep1").removeClass("w-hiddenstrict"),$(".stepLogin1").addClass("anileft100"),$(".loginbtncont").addClass("anileft100"),bappIsUndefine(IsBrandedApp)||1!=IsBrandedApp||($("#divAppleFLStep1 .loginfrmcontrol").show(),$("#divAppleFLStep1 .loginbtncont").show()),setTimeout(function(){$("#divAppleFLStep1").addClass("slide2")},50),1!==$("#dvRegister.modal.fade.signupmodalpopup.in").length&&1!==$("#dvRegister.modal.fade.signupmodalpopup.show").length||(null!=SignUp_FromPage&&null!=SignUp_FromPage&&null!=SignUp_FromPage.value&&null!=SignUp_FromPage.value&&"loginpage"!=SignUp_FromPage.value.toString().trim().toLowerCase()?($("#dvRegister").modal("hide"),$("#divLoginNew").modal("show")):null!=SignUp_FromPage&&null!=SignUp_FromPage&&null!=SignUp_FromPage.value&&null!=SignUp_FromPage.value&&"loginpage"==SignUp_FromPage.value.toString().trim().toLowerCase()&&(hidePopup(),setTimeout(function(){$(".sign-in-btn-div.stepLogin1").addClass("slide1"),$(".sign-in-btn-div.stepAppleflname").addClass("slide2")},50))),setTimeout(function(){var e=document.getElementById("txtFNameAppleP");void 0!==e&&null!=e&&null!=e&&$(e).attr("tabindex",1);var t=document.getElementById("txtLNameAppleP");void 0!==t&&null!=t&&null!=t&&$(t).attr("tabindex",2)},50)}function resetCotrolForAppleFNameLName(){try{var e=document.getElementById("txtFNameAppleP"),t=document.getElementById("txtLNameAppleP");null!=e&&null!=e&&null!=t&&null!=t&&(e.value="",t.value="",setTimeout(function(){$(e).removeClass("errorInput"),$(e).removeAttr("required"),$(t).removeClass("errorInput"),$(t).removeAttr("required"),document.getElementById("txtFNameAppleP-error").style.display="none",document.getElementById("txtLNameAppleP-error").style.display="none"},20),$(e).removeAttr("tabindex",1),$(t).removeAttr("tabindex",2)),$("#txtUsernameP").focus()}catch(e){console.log(e)}}function updateFNameLNameAppleLoginCallback(e,t){try{if(13==e){var i=!0,a=null;null!=appleSignInData&&null!=appleSignInData&&""!=appleSignInData.toString().trim()&&(a=appleSignInData.split("|"));var r=document.getElementById("txtFNameAppleP");$(r).attr(""),""!=r.value?($(r).removeClass("errorInput"),$(r).removeAttr("required"),document.getElementById("txtFNameAppleP-error").innerHTML="",document.getElementById("txtFNameAppleP-error").style.display="none"):(document.getElementById("txtFNameAppleP-error").style.display="block",document.getElementById("txtFNameAppleP-error").innerHTML="required.",$(r).addClass("errorInput"),$(r).attr("required","required"),i=!1);var o=document.getElementById("txtLNameAppleP");if(""!=o.value?(document.getElementById("txtLNameAppleP-error").innerHTML="",document.getElementById("txtLNameAppleP-error").style.display="none",$(o).removeClass("errorInput"),$(o).removeAttr("required")):(document.getElementById("txtLNameAppleP-error").style.display="block",document.getElementById("txtLNameAppleP-error").innerHTML="required.",$(o).addClass("errorInput"),$(o).attr("required","required"),i=!1),null!=a&&null!=a&&0!=a.length||(i=!1),i&&null!=a&&null!=a&&a.length>=5){if(null!=t&&null!=t&&""!=t.toString().trim()&&"login"==t.toString().toLowerCase())try{SetLoginValues()}catch(e){}var n=a[1],s=a[4],l=a[5];return ShowLoadingPanelLogin(!0),ShowFnameLnameControlForAppleLogin(!0),signin(r.value,o.value,3,null,n,s,"applelogin",l,!1,!0,null,"","",""),appleSignInData="",!1}}else-13==e&&(resetCotrolForAppleFNameLName(),appleSignInData="",hideAppleFNameLNameControls())}catch(e){vagaro.alert("There is some problem with Apple Login. Please try again."),resetCotrolForAppleFNameLName(),appleSignInData="",hideAppleFNameLNameControls()}return!1}function hideAppleFNameLNameControls(){$(".sign-in-btn-div.stepLogin1").removeClass("slide1"),$(".sign-in-btn-div.stepAppleflname").removeClass("slide2"),$("#divAppleFLStep1").removeClass(" slide2"),$("#divLoginStep1").removeClass(" w-hiddenstrict"),$("#divAppleFLStep1").addClass(" w-hiddenstrict"),setTimeout(function(){$(".stepLogin1").removeClass("anileft100"),$(".loginbtncont").removeClass("anileft100")},1);var e=document.getElementById("txtFNameAppleP");void 0!==e&&null!=e&&null!=e&&$(e).removeAttr("tabindex",1);var t=document.getElementById("txtLNameAppleP");void 0!==t&&null!=t&&null!=t&&$(t).removeAttr("tabindex",2),$("#txtUsernameP").focus()}function openLoginWhenExistEmail(e,t,i,a,r){openlogin(),$(".signup-user-found").removeClass(" w-hiddenstrict"),$(".sign-in-btn-divinner").addClass(" w-hiddenstrict"),$(".sign-in-logo-div").addClass(" w-hiddenstrict"),$("#errorClass").removeClass(" errorInput"),$("#errorClass-error").css("display","none"),$("#lblError").css("display","none"),$("#lblExistEmail").text(i).css("font-weight","400"),$("#lblFirstName").text(e),$("#spnuserImage").css("background-image","url('NoImage')"),$(".loginUserIntials").html(FindInitials(e+" "+t,"SP")),null==a||""==a?($("#spnuserImage").attr("data-original","NoImage"),$("#spnuserImage").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload")):($("#spnuserImage").attr("data-original",r+"200x0/"+a),$("#spnuserImage").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"))}function ShowFP(){$("#dvSignupNew").show(),ShowForgotPwd(sFromPage)}function opensignup(){clearRegisterControls(),SignUp_ModalPopupLoginHide()}function CallFailedLogin(e){vagaro.alert(e.get_message()),ShowLoadingPanelLogin(!1)}function ShowLoadingPanelLogin(e){$("#apgLoading").length>0?ShowLoader(e):"undefined"!=typeof SignUp_Loading&&(e?$(SignUp_Loading).show():$(SignUp_Loading).hide())}function inIframe(){try{return window.self!==window.top}catch(e){return!0}}function CallWSJSON1(e,t,i,a){if("undefined"==typeof keepAlive&&$("#IsWaitforKeepALive").length>0&&void 0!==$("#IsWaitforKeepALive").val()&&"true"===$("#IsWaitforKeepALive").val().toLowerCase())setTimeout(function(){CallWSJSON1(e,t,i,a)},500);else{var r=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";"undefined"!=typeof regionId&&""!=regionId&&(r=r+regionId+"/"),e=r+"WebServices/"+e,$.ajax({type:"POST",contentType:"application/json; charset=utf-8",beforeSend:function(e){if("undefined"!=typeof keepAlive&&e.setRequestHeader("keepAlive",keepAlive),1==$("#hdnToken1").length&&void 0!==$("#hdnToken1").val()&&e.setRequestHeader("token1",$("#hdnToken1").val()),1==$("#hdnToken2").length&&void 0!==$("#hdnToken2").val()&&e.setRequestHeader("token2",$("#hdnToken2").val()),"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&e.setRequestHeader("widgetcookievalue",widgetcookievalue);else try{void 0!==window.parent._common&&void 0!==window.parent._common.IsCookieLessWidget&&window.parent._common.IsCookieLessWidget()&&"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&e.setRequestHeader("widgetcookievalue",widgetcookievalue)}catch(e){}},url:e,data:t,dataType:"json",success:i,error:function(e,t,i){try{if(403===e.status)return alert("Your session is expired. Please reload your page."),void location.reload(!0);""!=a&&null!=a&&null!=a&&"function"==typeof a&&a(e,t,i)}catch(e){}}})}}function clearlogincontrols(e){"undefined"!=typeof SignUp_FromPage&&(SignUp_Password.value="",0!=e&&SignUp_Password.focus())}function PopupLoginShow(){if(ShowLoadingPanelLogin(!1),clearlogincontrols(0),SignUp_FromPage.value=sFromPage,"ScreenLock"==sFromPage)$(".hideinscreenlock").length&&($(".hideinscreenlock").hide(),$(".screenlock-img").show()),SignUp_ModalPopupLoginShow_ScreenLock();else{$(".hideinscreenlock").length&&($(".hideinscreenlock").show(),$(".screenlock-img").hide()),SignUp_ModalPopupLoginShow(),"undefined"!=typeof _common&&0==_common.isTouchDevice&&SignUp_UserName.focus(),SignUp_UserName.focus();var e=SignUp_chkRemember;e.checked=!1;var t=getCookie("VagaroUID");null!=t&&""!=t&&null!=t?(SignUp_UserName.value=t,SignUp_Password.focus(),null!=document.getElementById("tdCheck")&&document.getElementById("tdCheck").setAttribute("class","rtChecked"),e.checked=!0):(null!=document.getElementById("tdCheck")&&document.getElementById("tdCheck").setAttribute("class","rtUnchecked"),e.checked=!1)}}function RegisterPopUpID(){isWidPopup=SignUp_IsFromWidget.value}function IsLoginPage(){return"undefined"!=typeof Login_CCSwipe&&null!=typeof Login_CCSwipe}IsCookieEnabled=function(){if(navigator.cookieEnabled||/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)&&/OS 14_/.test(navigator.userAgent)){try{if(inIframe())return document.cookie="IsCookieEnable=yes; SameSite=None; Secure",-1==document.cookie.indexOf("IsCookieEnable=")?1:2}catch(e){}return 2}return 0};var _KeyChar="48",_ZEROKeyValues="",_OldKeyVal="%",_IsProcessing=!1,_StartKeyboardSpeed="",_EndKeyboardSpeed="";function focusAtEnd(e){var t=e.value;1==IsLoginPage()?e.value="0":e.value="",e.focus(),e.value=t}function CheckWidgetSession(){return chkMultiLocParameter(),location.href.toLowerCase().indexOf("businesswidget.aspx")>-1?null!=GetBusinessID()?(CallWebServicehed("GeneralWebService.asmx/SetWidgetSession",'"lBusinessID" : '+GetBusinessID(),SetWidgetSessionSuccess,CallFailed),IsPopup+"&IsBusinessWidgetPage="+IsBusinessWidgetPage+"&IsFacebookPage="+IsFacebookPage+"&BusinessID="+GetBusinessID()+"&b_themeID="+b_themeID+"&IsFromMultiLocation="+isFromMultiLocation+"&MultiLocBusinessID="+MultiLocBusinessID):"":IsPopup+"&IsBusinessWidgetPage="+IsBusinessWidgetPage+"&IsFacebookPage="+IsFacebookPage+"&BusinessID="+GetBusinessID()+"&b_themeID="+b_themeID+"&IsFromMultiLocation="+isFromMultiLocation+"&MultiLocBusinessID="+MultiLocBusinessID}function SetWidgetSessionSuccess(e){}function are_cookies_enabled(){var e=!!navigator.cookieEnabled;return(void 0===navigator.cookieEnabled&&!e||"Microsoft Internet Explorer"==navigator.appName)&&(document.cookie="testcookie",e=-1!=document.cookie.indexOf("testcookie")),e}function LoadFacebook(e,t){}document.onkeypress=function(e){var t;"undefined"!=typeof TwoStepAuth&&TwoStepAuth.is2StepShown()||(t=window.event?window.event.keyCode:e.which,"undefined"!=typeof SignUp_Password&&(0==SignUp_Password.value.length&&(_StartKeyboardSpeed=(new Date).getTime()),1==SignUp_Password.value.length&&(_EndKeyboardSpeed=((new Date).getTime()-_StartKeyboardSpeed)/1e3)),_IsProcessing||48==parseInt(t)||(_IsProcessing=!0),"undefined"!=typeof _ReSetValue&&null!=_ReSetValue&&(_IsProcessing=!_ReSetValue),parseFloat(_EndKeyboardSpeed)>parseFloat(.05)&&(_IsProcessing=!0),_IsProcessing||parseInt(t)==parseInt(_KeyChar)&&(_ZEROKeyValues=""==_ZEROKeyValues?_KeyChar:_ZEROKeyValues+"|"+_KeyChar),37!=parseInt(t)&&2!=_ZEROKeyValues.split("|").length||("undefined"!=typeof _ReSetValue&&null!=_ReSetValue&&(_ReSetValue=!1),_IsProcessing=!0,_ZEROKeyValues="",_OldKeyVal=37==parseInt(t)?"%":"00",0==IsLoginPage()?(SignUp_CCSwipe.value=_OldKeyVal,focusAtEnd(SignUp_CCSwipe)):(Login_CCSwipe.value=_OldKeyVal,focusAtEnd(Login_CCSwipe))),13==parseInt(t)&&(_IsProcessing=!1))};var acToken,tokenType,expiresIn,user,_0x95cd=["lib","Base","prototype","mixIn","init","hasOwnProperty","apply","$super","extend","toString","WordArray","words","sigBytes","length","stringify","clamp","push","ceil","call","clone","slice","random","enc","Hex","","join","substr","Latin1","fromCharCode","charCodeAt","Utf8","Malformed UTF-8 data","parse","BufferedBlockAlgorithm","_data","_nDataBytes","string","concat","blockSize","_minBufferSize","max","min","splice","Hasher","cfg","reset","finalize","HMAC","algo","Base64","_map","charAt","indexOf","create","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=","sin","abs","MD5","_hash","floor","HmacMD5","EvpKDF","hasher","keySize","iterations","update","compute","Cipher","_xformMode","_key","encrypt","decrypt","StreamCipher","mode","_iv","_prevBlock","BlockCipherMode","Encryptor","Decryptor","_cipher","encryptBlock","decryptBlock","CBC","Pkcs7","pad","BlockCipher","iv","_ENC_XFORM_MODE","createEncryptor","createDecryptor","_mode","processBlock","padding","unpad","CipherParams","formatter","OpenSSL","format","ciphertext","salt","SerializableCipher","kdf","PasswordBasedCipher","ivSize","execute","key","AES","_nRounds","_keySchedule","_invKeySchedule"],CryptoJS=CryptoJS||function(e){var t={},i=t[_0x95cd[0]]={},a=function(){},r=i[_0x95cd[1]]={extend:function(e){a[_0x95cd[2]]=this;var t=new a;return e&&t[_0x95cd[3]](e),t[_0x95cd[5]](_0x95cd[4])||(t[_0x95cd[4]]=function(){t[_0x95cd[7]][_0x95cd[4]][_0x95cd[6]](this,arguments)}),t[_0x95cd[4]][_0x95cd[2]]=t,t[_0x95cd[7]]=this,t},create:function(){var e=this[_0x95cd[8]]();return e[_0x95cd[4]][_0x95cd[6]](e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e[_0x95cd[5]](t)&&(this[t]=e[t]);e[_0x95cd[5]](_0x95cd[9])&&(this[_0x95cd[9]]=e[_0x95cd[9]])},clone:function(){return this[_0x95cd[4]][_0x95cd[2]][_0x95cd[8]](this)}},o=i[_0x95cd[10]]=r[_0x95cd[8]]({init:function(e,t){e=this[_0x95cd[11]]=e||[],this[_0x95cd[12]]=null!=t?t:4*e[_0x95cd[13]]},toString:function(e){return(e||s)[_0x95cd[14]](this)},concat:function(e){var t=this[_0x95cd[11]],i=e[_0x95cd[11]],a=this[_0x95cd[12]];if(e=e[_0x95cd[12]],this[_0x95cd[15]](),a%4)for(var r=0;r<e;r++)t[a+r>>>2]|=(i[r>>>2]>>>24-r%4*8&255)<<24-(a+r)%4*8;else if(65535<i[_0x95cd[13]])for(r=0;r<e;r+=4)t[a+r>>>2]=i[r>>>2];else t[_0x95cd[16]][_0x95cd[6]](t,i);return this[_0x95cd[12]]+=e,this},clamp:function(){var t=this[_0x95cd[11]],i=this[_0x95cd[12]];t[i>>>2]&=4294967295<<32-i%4*8,t[_0x95cd[13]]=e[_0x95cd[17]](i/4)},clone:function(){var e=r[_0x95cd[19]][_0x95cd[18]](this);return e[_0x95cd[11]]=this[_0x95cd[11]][_0x95cd[20]](0),e},random:function(t){for(var i=[],a=0;a<t;a+=4)i[_0x95cd[16]](4294967296*e[_0x95cd[21]]()|0);return new o[_0x95cd[4]](i,t)}}),n=t[_0x95cd[22]]={},s=n[_0x95cd[23]]={stringify:function(e){var t=e[_0x95cd[11]];e=e[_0x95cd[12]];for(var i=[],a=0;a<e;a++){var r=t[a>>>2]>>>24-a%4*8&255;i[_0x95cd[16]]((r>>>4).toString(16)),i[_0x95cd[16]]((15&r).toString(16))}return i[_0x95cd[25]](_0x95cd[24])},parse:function(e){for(var t=e[_0x95cd[13]],i=[],a=0;a<t;a+=2)i[a>>>3]|=parseInt(e[_0x95cd[26]](a,2),16)<<24-a%8*4;return new o[_0x95cd[4]](i,t/2)}},l=n[_0x95cd[27]]={stringify:function(e){var t=e[_0x95cd[11]];e=e[_0x95cd[12]];for(var i=[],a=0;a<e;a++)i[_0x95cd[16]](String[_0x95cd[28]](t[a>>>2]>>>24-a%4*8&255));return i[_0x95cd[25]](_0x95cd[24])},parse:function(e){for(var t=e[_0x95cd[13]],i=[],a=0;a<t;a++)i[a>>>2]|=(255&e[_0x95cd[29]](a))<<24-a%4*8;return new o[_0x95cd[4]](i,t)}},d=n[_0x95cd[30]]={stringify:function(e){try{return decodeURIComponent(escape(l[_0x95cd[14]](e)))}catch(e){throw Error(_0x95cd[31])}},parse:function(e){return l[_0x95cd[32]](unescape(encodeURIComponent(e)))}},c=i[_0x95cd[33]]=r[_0x95cd[8]]({reset:function(){this[_0x95cd[34]]=new o[_0x95cd[4]],this[_0x95cd[35]]=0},_append:function(e){_0x95cd[36]==typeof e&&(e=d[_0x95cd[32]](e)),this[_0x95cd[34]][_0x95cd[37]](e),this[_0x95cd[35]]+=e[_0x95cd[12]]},_process:function(t){var i=this[_0x95cd[34]],a=i[_0x95cd[11]],r=i[_0x95cd[12]],n=this[_0x95cd[38]],s=r/(4*n);if(t=(s=t?e[_0x95cd[17]](s):e[_0x95cd[40]]((0|s)-this[_0x95cd[39]],0))*n,r=e[_0x95cd[41]](4*t,r),t){for(var l=0;l<t;l+=n)this._doProcessBlock(a,l);l=a[_0x95cd[42]](0,t),i[_0x95cd[12]]-=r}return new o[_0x95cd[4]](l,r)},clone:function(){var e=r[_0x95cd[19]][_0x95cd[18]](this);return e[_0x95cd[34]]=this[_0x95cd[34]][_0x95cd[19]](),e},_minBufferSize:0});i[_0x95cd[43]]=c[_0x95cd[8]]({cfg:r[_0x95cd[8]](),init:function(e){this[_0x95cd[44]]=this[_0x95cd[44]][_0x95cd[8]](e),this[_0x95cd[45]]()},reset:function(){c[_0x95cd[45]][_0x95cd[18]](this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e[_0x95cd[4]](i)[_0x95cd[46]](t)}},_createHmacHelper:function(e){return function(t,i){return new u[_0x95cd[47]][_0x95cd[4]](e,i)[_0x95cd[46]](t)}}});var u=t[_0x95cd[48]]={};return t}(Math);!function(){var e=CryptoJS,t=e[_0x95cd[0]][_0x95cd[10]];e[_0x95cd[22]][_0x95cd[49]]={stringify:function(e){var t=e[_0x95cd[11]],i=e[_0x95cd[12]],a=this[_0x95cd[50]];e[_0x95cd[15]](),e=[];for(var r=0;r<i;r+=3)for(var o=(t[r>>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,n=0;4>n&&r+.75*n<i;n++)e[_0x95cd[16]](a[_0x95cd[51]](o>>>6*(3-n)&63));if(t=a[_0x95cd[51]](64))for(;e[_0x95cd[13]]%4;)e[_0x95cd[16]](t);return e[_0x95cd[25]](_0x95cd[24])},parse:function(e){var i=e[_0x95cd[13]],a=this[_0x95cd[50]];(r=a[_0x95cd[51]](64))&&(-1!=(r=e[_0x95cd[52]](r))&&(i=r));for(var r=[],o=0,n=0;n<i;n++)if(n%4){var s=a[_0x95cd[52]](e[_0x95cd[51]](n-1))<<n%4*2,l=a[_0x95cd[52]](e[_0x95cd[51]](n))>>>6-n%4*2;r[o>>>2]|=(s|l)<<24-o%4*8,o++}return t[_0x95cd[53]](r,o)},_map:_0x95cd[54]}}(),function(e){function t(e,t,i,a,r,o,n){return((e=e+(t&i|~t&a)+r+n)<<o|e>>>32-o)+t}function i(e,t,i,a,r,o,n){return((e=e+(t&a|i&~a)+r+n)<<o|e>>>32-o)+t}function a(e,t,i,a,r,o,n){return((e=e+(t^i^a)+r+n)<<o|e>>>32-o)+t}function r(e,t,i,a,r,o,n){return((e=e+(i^(t|~a))+r+n)<<o|e>>>32-o)+t}for(var o=CryptoJS,n=(l=o[_0x95cd[0]])[_0x95cd[10]],s=l[_0x95cd[43]],l=o[_0x95cd[48]],d=[],c=0;64>c;c++)d[c]=4294967296*e[_0x95cd[56]](e[_0x95cd[55]](c+1))|0;l=l[_0x95cd[57]]=s[_0x95cd[8]]({_doReset:function(){this[_0x95cd[58]]=new n[_0x95cd[4]]([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var n=0;16>n;n++){var s=e[l=o+n];e[l]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}n=this[_0x95cd[58]][_0x95cd[11]];var l=e[o+0],c=(s=e[o+1],e[o+2]),u=e[o+3],p=e[o+4],h=e[o+5],m=e[o+6],f=e[o+7],g=e[o+8],v=e[o+9],A=e[o+10],C=e[o+11],y=e[o+12],b=e[o+13],S=e[o+14],k=e[o+15],D=t(D=n[0],w=n[1],I=n[2],_=n[3],l,7,d[0]),_=t(_,D,w,I,s,12,d[1]),I=t(I,_,D,w,c,17,d[2]),w=t(w,I,_,D,u,22,d[3]);D=t(D,w,I,_,p,7,d[4]),_=t(_,D,w,I,h,12,d[5]),I=t(I,_,D,w,m,17,d[6]),w=t(w,I,_,D,f,22,d[7]),D=t(D,w,I,_,g,7,d[8]),_=t(_,D,w,I,v,12,d[9]),I=t(I,_,D,w,A,17,d[10]),w=t(w,I,_,D,C,22,d[11]),D=t(D,w,I,_,y,7,d[12]),_=t(_,D,w,I,b,12,d[13]),I=t(I,_,D,w,S,17,d[14]),D=i(D,w=t(w,I,_,D,k,22,d[15]),I,_,s,5,d[16]),_=i(_,D,w,I,m,9,d[17]),I=i(I,_,D,w,C,14,d[18]),w=i(w,I,_,D,l,20,d[19]),D=i(D,w,I,_,h,5,d[20]),_=i(_,D,w,I,A,9,d[21]),I=i(I,_,D,w,k,14,d[22]),w=i(w,I,_,D,p,20,d[23]),D=i(D,w,I,_,v,5,d[24]),_=i(_,D,w,I,S,9,d[25]),I=i(I,_,D,w,u,14,d[26]),w=i(w,I,_,D,g,20,d[27]),D=i(D,w,I,_,b,5,d[28]),_=i(_,D,w,I,c,9,d[29]),I=i(I,_,D,w,f,14,d[30]),D=a(D,w=i(w,I,_,D,y,20,d[31]),I,_,h,4,d[32]),_=a(_,D,w,I,g,11,d[33]),I=a(I,_,D,w,C,16,d[34]),w=a(w,I,_,D,S,23,d[35]),D=a(D,w,I,_,s,4,d[36]),_=a(_,D,w,I,p,11,d[37]),I=a(I,_,D,w,f,16,d[38]),w=a(w,I,_,D,A,23,d[39]),D=a(D,w,I,_,b,4,d[40]),_=a(_,D,w,I,l,11,d[41]),I=a(I,_,D,w,u,16,d[42]),w=a(w,I,_,D,m,23,d[43]),D=a(D,w,I,_,v,4,d[44]),_=a(_,D,w,I,y,11,d[45]),I=a(I,_,D,w,k,16,d[46]),D=r(D,w=a(w,I,_,D,c,23,d[47]),I,_,l,6,d[48]),_=r(_,D,w,I,f,10,d[49]),I=r(I,_,D,w,S,15,d[50]),w=r(w,I,_,D,h,21,d[51]),D=r(D,w,I,_,y,6,d[52]),_=r(_,D,w,I,u,10,d[53]),I=r(I,_,D,w,A,15,d[54]),w=r(w,I,_,D,s,21,d[55]),D=r(D,w,I,_,g,6,d[56]),_=r(_,D,w,I,k,10,d[57]),I=r(I,_,D,w,m,15,d[58]),w=r(w,I,_,D,b,21,d[59]),D=r(D,w,I,_,p,6,d[60]),_=r(_,D,w,I,C,10,d[61]),I=r(I,_,D,w,c,15,d[62]),w=r(w,I,_,D,v,21,d[63]);n[0]=n[0]+D|0,n[1]=n[1]+w|0,n[2]=n[2]+I|0,n[3]=n[3]+_|0},_doFinalize:function(){var t=this[_0x95cd[34]],i=t[_0x95cd[11]],a=8*this[_0x95cd[35]],r=8*t[_0x95cd[12]];i[r>>>5]|=128<<24-r%32;var o=e[_0x95cd[59]](a/4294967296);for(i[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t[_0x95cd[12]]=4*(i[_0x95cd[13]]+1),this._process(),i=(t=this[_0x95cd[58]])[_0x95cd[11]],a=0;4>a;a++)r=i[a],i[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return t},clone:function(){var e=s[_0x95cd[19]][_0x95cd[18]](this);return e[_0x95cd[58]]=this[_0x95cd[58]][_0x95cd[19]](),e}}),o[_0x95cd[57]]=s._createHelper(l),o[_0x95cd[60]]=s._createHmacHelper(l)}(Math),function(){var e,t=CryptoJS,i=(e=t[_0x95cd[0]])[_0x95cd[1]],a=e[_0x95cd[10]],r=(e=t[_0x95cd[48]])[_0x95cd[61]]=i[_0x95cd[8]]({cfg:i[_0x95cd[8]]({keySize:4,hasher:e[_0x95cd[57]],iterations:1}),init:function(e){this[_0x95cd[44]]=this[_0x95cd[44]][_0x95cd[8]](e)},compute:function(e,t){for(var i=(s=this[_0x95cd[44]])[_0x95cd[62]][_0x95cd[53]](),r=a[_0x95cd[53]](),o=r[_0x95cd[11]],n=s[_0x95cd[63]],s=s[_0x95cd[64]];o[_0x95cd[13]]<n;){l&&i[_0x95cd[65]](l);var l=i[_0x95cd[65]](e)[_0x95cd[46]](t);i[_0x95cd[45]]();for(var d=1;d<s;d++)l=i[_0x95cd[46]](l),i[_0x95cd[45]]();r[_0x95cd[37]](l)}return r[_0x95cd[12]]=4*n,r}});t[_0x95cd[61]]=function(e,t,i){return r[_0x95cd[53]](i)[_0x95cd[66]](e,t)}}(),CryptoJS[_0x95cd[0]][_0x95cd[67]]||function(){var e=(p=CryptoJS)[_0x95cd[0]],t=e[_0x95cd[1]],i=e[_0x95cd[10]],a=e[_0x95cd[33]],r=p[_0x95cd[22]][_0x95cd[49]],o=p[_0x95cd[48]][_0x95cd[61]],n=e[_0x95cd[67]]=a[_0x95cd[8]]({cfg:t[_0x95cd[8]](),createEncryptor:function(e,t){return this[_0x95cd[53]](this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this[_0x95cd[53]](this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this[_0x95cd[44]]=this[_0x95cd[44]][_0x95cd[8]](i),this[_0x95cd[68]]=e,this[_0x95cd[69]]=t,this[_0x95cd[45]]()},reset:function(){a[_0x95cd[45]][_0x95cd[18]](this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,a){return(_0x95cd[36]==typeof i?h:u)[_0x95cd[70]](e,t,i,a)},decrypt:function(t,i,a){return(_0x95cd[36]==typeof i?h:u)[_0x95cd[71]](e,t,i,a)}}}});e[_0x95cd[72]]=n[_0x95cd[8]]({_doFinalize:function(){return this._process(!0)},blockSize:1});var s=p[_0x95cd[73]]={},l=function(e,t,i){var a=this[_0x95cd[74]];a?this[_0x95cd[74]]=void 0:a=this[_0x95cd[75]];for(var r=0;r<i;r++)e[t+r]^=a[r]},d=(e[_0x95cd[76]]=t[_0x95cd[8]]({createEncryptor:function(e,t){return this[_0x95cd[77]][_0x95cd[53]](e,t)},createDecryptor:function(e,t){return this[_0x95cd[78]][_0x95cd[53]](e,t)},init:function(e,t){this[_0x95cd[79]]=e,this[_0x95cd[74]]=t}}))[_0x95cd[8]]();d[_0x95cd[77]]=d[_0x95cd[8]]({processBlock:function(e,t){var i=this[_0x95cd[79]],a=i[_0x95cd[38]];l[_0x95cd[18]](this,e,t,a),i[_0x95cd[80]](e,t),this[_0x95cd[75]]=e[_0x95cd[20]](t,t+a)}}),d[_0x95cd[78]]=d[_0x95cd[8]]({processBlock:function(e,t){var i=this[_0x95cd[79]],a=i[_0x95cd[38]],r=e[_0x95cd[20]](t,t+a);i[_0x95cd[81]](e,t),l[_0x95cd[18]](this,e,t,a),this[_0x95cd[75]]=r}}),s=s[_0x95cd[82]]=d,d=(p[_0x95cd[84]]={})[_0x95cd[83]]={pad:function(e,t){for(var a,r=(a=(a=4*t)-e[_0x95cd[12]]%a)<<24|a<<16|a<<8|a,o=[],n=0;n<a;n+=4)o[_0x95cd[16]](r);a=i[_0x95cd[53]](o,a),e[_0x95cd[37]](a)},unpad:function(e){e[_0x95cd[12]]-=255&e[_0x95cd[11]][e[_0x95cd[12]]-1>>>2]}},e[_0x95cd[85]]=n[_0x95cd[8]]({cfg:n[_0x95cd[44]][_0x95cd[8]]({mode:s,padding:d}),reset:function(){n[_0x95cd[45]][_0x95cd[18]](this);var e=(t=this[_0x95cd[44]])[_0x95cd[86]],t=t[_0x95cd[73]];if(this[_0x95cd[68]]==this[_0x95cd[87]])var i=t[_0x95cd[88]];else i=t[_0x95cd[89]],this[_0x95cd[39]]=1;this[_0x95cd[90]]=i[_0x95cd[18]](t,this,e&&e[_0x95cd[11]])},_doProcessBlock:function(e,t){this[_0x95cd[90]][_0x95cd[91]](e,t)},_doFinalize:function(){var e=this[_0x95cd[44]][_0x95cd[92]];if(this[_0x95cd[68]]==this[_0x95cd[87]]){e[_0x95cd[84]](this._data,this[_0x95cd[38]]);var t=this._process(!0)}else t=this._process(!0),e[_0x95cd[93]](t);return t},blockSize:4});var c=e[_0x95cd[94]]=t[_0x95cd[8]]({init:function(e){this[_0x95cd[3]](e)},toString:function(e){return(e||this[_0x95cd[95]])[_0x95cd[14]](this)}}),u=(s=(p[_0x95cd[97]]={})[_0x95cd[96]]={stringify:function(e){var t=e[_0x95cd[98]];return((e=e[_0x95cd[99]])?i[_0x95cd[53]]([1398893684,1701076831])[_0x95cd[37]](e)[_0x95cd[37]](t):t).toString(r)},parse:function(e){var t=(e=r[_0x95cd[32]](e))[_0x95cd[11]];if(1398893684==t[0]&&1701076831==t[1]){var a=i[_0x95cd[53]](t[_0x95cd[20]](2,4));t[_0x95cd[42]](0,4),e[_0x95cd[12]]-=16}return c[_0x95cd[53]]({ciphertext:e,salt:a})}},e[_0x95cd[100]]=t[_0x95cd[8]]({cfg:t[_0x95cd[8]]({format:s}),encrypt:function(e,t,i,a){a=this[_0x95cd[44]][_0x95cd[8]](a);var r=e[_0x95cd[88]](i,a);return t=r[_0x95cd[46]](t),r=r[_0x95cd[44]],c[_0x95cd[53]]({ciphertext:t,key:i,iv:r[_0x95cd[86]],algorithm:e,mode:r[_0x95cd[73]],padding:r[_0x95cd[92]],blockSize:e[_0x95cd[38]],formatter:a[_0x95cd[97]]})},decrypt:function(e,t,i,a){return a=this[_0x95cd[44]][_0x95cd[8]](a),t=this._parse(t,a[_0x95cd[97]]),e[_0x95cd[89]](i,a)[_0x95cd[46]](t[_0x95cd[98]])},_parse:function(e,t){return _0x95cd[36]==typeof e?t[_0x95cd[32]](e,this):e}})),p=(p[_0x95cd[101]]={})[_0x95cd[96]]={execute:function(e,t,a,r){return r||(r=i[_0x95cd[21]](8)),e=o[_0x95cd[53]]({keySize:t+a})[_0x95cd[66]](e,r),a=i[_0x95cd[53]](e[_0x95cd[11]][_0x95cd[20]](t),4*a),e[_0x95cd[12]]=4*t,c[_0x95cd[53]]({key:e,iv:a,salt:r})}},h=e[_0x95cd[102]]=u[_0x95cd[8]]({cfg:u[_0x95cd[44]][_0x95cd[8]]({kdf:p}),encrypt:function(e,t,i,a){return i=(a=this[_0x95cd[44]][_0x95cd[8]](a))[_0x95cd[101]][_0x95cd[104]](i,e[_0x95cd[63]],e[_0x95cd[103]]),a[_0x95cd[86]]=i[_0x95cd[86]],(e=u[_0x95cd[70]][_0x95cd[18]](this,e,t,i[_0x95cd[105]],a))[_0x95cd[3]](i),e},decrypt:function(e,t,i,a){return a=this[_0x95cd[44]][_0x95cd[8]](a),t=this._parse(t,a[_0x95cd[97]]),i=a[_0x95cd[101]][_0x95cd[104]](i,e[_0x95cd[63]],e[_0x95cd[103]],t[_0x95cd[99]]),a[_0x95cd[86]]=i[_0x95cd[86]],u[_0x95cd[71]][_0x95cd[18]](this,e,t,i[_0x95cd[105]],a)}})}(),function(){for(var e=CryptoJS,t=e[_0x95cd[0]][_0x95cd[85]],i=e[_0x95cd[48]],a=[],r=[],o=[],n=[],s=[],l=[],d=[],c=[],u=[],p=[],h=[],m=0;256>m;m++)h[m]=128>m?m<<1:m<<1^283;var f=0,g=0;for(m=0;256>m;m++){var v=(v=g^g<<1^g<<2^g<<3^g<<4)>>>8^255&v^99;a[f]=v,r[v]=f;var A=h[f],C=h[A],y=h[C],b=257*h[v]^16843008*v;o[f]=b<<24|b>>>8,n[f]=b<<16|b>>>16,s[f]=b<<8|b>>>24,l[f]=b,b=16843009*y^65537*C^257*A^16843008*f,d[v]=b<<24|b>>>8,c[v]=b<<16|b>>>16,u[v]=b<<8|b>>>24,p[v]=b,f?(f=A^h[h[h[y^A]]],g^=h[h[g]]):f=g=1}var S=[0,1,2,4,8,16,32,64,128,27,54];i=i[_0x95cd[106]]=t[_0x95cd[8]]({_doReset:function(){for(var e=(i=this[_0x95cd[69]])[_0x95cd[11]],t=i[_0x95cd[12]]/4,i=4*((this[_0x95cd[107]]=t+6)+1),r=this[_0x95cd[108]]=[],o=0;o<i;o++)if(o<t)r[o]=e[o];else{var n=r[o-1];o%t?6<t&&4==o%t&&(n=a[n>>>24]<<24|a[n>>>16&255]<<16|a[n>>>8&255]<<8|a[255&n]):(n=a[(n=n<<8|n>>>24)>>>24]<<24|a[n>>>16&255]<<16|a[n>>>8&255]<<8|a[255&n],n^=S[o/t|0]<<24),r[o]=r[o-t]^n}for(e=this[_0x95cd[109]]=[],t=0;t<i;t++)o=i-t,n=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?n:d[a[n>>>24]]^c[a[n>>>16&255]]^u[a[n>>>8&255]]^p[a[255&n]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,n,s,l,a)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,d,c,u,p,r),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,a,r,o,n,s){for(var l=this[_0x95cd[107]],d=e[t]^i[0],c=e[t+1]^i[1],u=e[t+2]^i[2],p=e[t+3]^i[3],h=4,m=1;m<l;m++){var f=a[d>>>24]^r[c>>>16&255]^o[u>>>8&255]^n[255&p]^i[h++],g=a[c>>>24]^r[u>>>16&255]^o[p>>>8&255]^n[255&d]^i[h++],v=a[u>>>24]^r[p>>>16&255]^o[d>>>8&255]^n[255&c]^i[h++];p=a[p>>>24]^r[d>>>16&255]^o[c>>>8&255]^n[255&u]^i[h++],d=f,c=g,u=v}f=(s[d>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&p])^i[h++],g=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[p>>>8&255]<<8|s[255&d])^i[h++],v=(s[u>>>24]<<24|s[p>>>16&255]<<16|s[d>>>8&255]<<8|s[255&c])^i[h++],p=(s[p>>>24]<<24|s[d>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^i[h++],e[t]=f,e[t+1]=g,e[t+2]=v,e[t+3]=p},keySize:8});e[_0x95cd[106]]=t._createHelper(i)}();var DateFormatter,loggedIn=!1,OAUTHURL="https://accounts.google.com/o/oauth2/auth?",VALIDURL="https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=";function GetGoogleLogin(){if("undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("GoogleLoginClick")}catch(e){}else{var e=window.location.host+"/GoogleLogin.aspx";_securelogin.isLocalhost()&&(e="localhost:3829/GoogleLogin.aspx"),e="https:"==window.location.protocol?"https://"+e:"http://"+e;var t=OAUTHURL+"scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email&client_id="+CLIENTID+"&redirect_uri="+e+"&response_type=token&approval_prompt=auto",i=window.open(t,"Googlewindow","width=800, height=700"),a=window.setInterval(function(){try{if(-1!=i.document.URL.indexOf(e)){window.clearInterval(a);var t=i.document.URL;acToken=urlReplace(t,"access_token"),tokenType=urlReplace(t,"token_type"),expiresIn=urlReplace(t,"expires_in"),i.close(),""!=acToken?(validateToken(acToken),ShowLoadingPanelLogin(!0)):ShowLoadingPanelLogin(!1)}}catch(e){}},500)}}function validateToken(e){$.ajax({url:VALIDURL+e,data:null,success:function(e){getUserInfo(),loggedIn=!0},dataType:"jsonp"})}function getUserInfo(){$.ajax({url:"https://www.googleapis.com/userinfo/v2/me?access_token="+acToken,data:null,success:function(e){user=e;var t=_gender.Female,i="";void 0!==user.gender&&"undefined"!=user.gender&&null!=user.gender||(t=_gender.Optional),"male"==user.gender&&(t=_gender.Male),i="undefined"==user.email||null==user.email?"":user.email;try{"undefined"!=typeof LoginHeader_NeedstoRedirect&&null!=LoginHeader_NeedstoRedirect&&(blNeedstoRedirect=LoginHeader_NeedstoRedirect)}catch(e){}signin(user.given_name,user.family_name,t,null,i+"|~|"+acToken,user.id+"|"+user.picture,null,4,!1,!0,null,"","","")},dataType:"jsonp"})}function GoogleLoginVariableSettingUp(e,t,i,a,r,o){ShowLoadingPanelLogin(!0);var n="";"male"==(a=_gender.Female)&&(a=_gender.Male),n="undefined"==i||null==i?"":i;try{"undefined"!=typeof LoginHeader_NeedstoRedirect&&null!=LoginHeader_NeedstoRedirect&&(blNeedstoRedirect=LoginHeader_NeedstoRedirect)}catch(e){}signin(e,t,a,null,n,r+"|"+o,null,4,!1,!0,null,"","","")}function FBloginVariableSettingforWinApp(e,t,i,a,r,o){ShowLoadingPanelLogin(!0);var n="";"undefined"!=(a=_gender.Female)&&null!=a||(a=_gender.Optional),"male"==a&&(a=_gender.Male),n="undefined"==i||null==i?"":i;try{"undefined"!=typeof LoginHeader_NeedstoRedirect&&null!=LoginHeader_NeedstoRedirect&&(blNeedstoRedirect=LoginHeader_NeedstoRedirect)}catch(e){}signin(e,t,a,null,n,r+"|"+o,null,3,!1,!0,null,"","","")}function urlReplace(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\#&]"+t+"=([^&#]*)").exec(e);return null==i?"":i[1]}function startLogoutPolling(){loggedIn=!1}function HideCookiePopUp(){"undefined"==typeof _common?$find("modalpopupCookie").hide():$("#dvCookieModal").modal("hide")}function is_numeric(e){return/^\d+$/.test(e)}function FindInitials(e,t){var i=/[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/,a=["ASS","WTF","SEX","SUK","FUK","DIE","BUM","TIT","BCH","DAM","HAH","OUT"];if(null!=e&&""!=e){var r=(e=e.replace("s+","")).split(" "),o="";if(r.length>0){for(var n=0;n<r.length;n++){var s=r[n].substr(0,1);1!=i.test(s)&&s==s.toUpperCase()&&0==is_numeric(s)&&(o+=s)}o.length<=0&&(o=e.substr(0,1))}else o=r[0].substr(0,1);return o.length>=3?(Arrcontains(a,o=o.substr(0,3))&&(o=o.substr(0,o.length-1)),a=null,"SP"==t?o.substr(0,2).toUpperCase():o.toUpperCase()):o.toUpperCase()}return e}function Arrcontains(e,t){for(var i=0;i<e.length;i++)if(e[i]===t)return!0;return!1}function SkipTwoFactoFromSignIn(){"function"==typeof CallWSJSON?CallWSJSON("MySampleService.asmx/SkipTwoFactorForSignIn","",function(e){if(void 0!==e&&null!=e&&void 0!==e.d&&null!=e.d){if("true"==e.d.split("|")[0].toLowerCase()){if(e.d.split("|").length>=2&&void 0!==setLogintkn)try{setLogintkn(e.d.split("|")[1]),(navigator.userAgent.indexOf("com.vagaro.customerios")>-1||navigator.userAgent.indexOf("com.vagaro.customerandroid")>-1)&&navigator.userAgent.toLowerCase().indexOf("brandedapp")<0&&void 0!==isNewVersionCustomerAppLogin&&isNewVersionCustomerAppLogin("529","428")&&CallbackforMobileApp(0,0,"",e.d.split("|")[1],0,"135")}catch(e){}_securelogin.AfterSuccessfullLogin()}else"undefined"!=typeof bootbox?vagaro.alert("Something went wrong. Please try again!"):alert("Something went wrong. Please try again!");ShowLoadingPanelLogin(!1)}},CallFailed):CallWSJSON1("MySampleService.asmx/SkipTwoFactorForSignIn","",function(e){if(void 0!==e&&null!=e&&void 0!==e.d&&null!=e.d){if("true"==e.d.split("|")[0].toLowerCase()){if(e.d.split("|").length>=2&&void 0!==setLogintkn)try{setLogintkn(e.d.split("|")[1]),(navigator.userAgent.indexOf("com.vagaro.customerios")>-1||navigator.userAgent.indexOf("com.vagaro.customerandroid")>-1)&&navigator.userAgent.toLowerCase().indexOf("brandedapp")<0&&void 0!==isNewVersionCustomerAppLogin&&isNewVersionCustomerAppLogin("529","428")&&CallbackforMobileApp(0,0,"",e.d.split("|")[1],0,"135")}catch(e){}_securelogin.AfterSuccessfullLogin()}else"undefined"!=typeof bootbox?vagaro.alert("Something went wrong. Please try again!"):alert("Something went wrong. Please try again!");ShowLoadingPanelLogin(!1)}},CallFailed)}function SetUserAuthCodeToken(e,t){try{if(void 0!==e&&null!=e&&""!=e&&void 0!==e.split("|")[15]&&null!=e.split("|")[15]&&""!=e.split("|")[15]&&"true"==e.split("|")[15].toString().toLowerCase()&&null!=e.split("|")[13]&&""!=e.split("|")[13]&&null!=e.split("|")[3]&&""!=e.split("|")[3]&&parseInt(e.split("|")[3])>0){ShowLoadingPanelLogin(!0);var i=e.split("|")[3].toString(),a=e.split("|")[14].toString(),r=e.split("|")[13].toString(),o=new vagaro.ajax;o.datamodel.Token="SetUserAuthCodeToken",o.datamodel.data=[i,a,r],o.datamodel.ErrorMessage="",o.datamodel.callback=function(e){void 0!==e&&null!=e&&0==e&&localStorage.removeItem("atCode"),ShowLoadingPanelLogin(!1),t()},o.datamodel.Error=function(e){ShowLoadingPanelLogin(!1),t()},o.Post()}else t()}catch(e){ShowLoadingPanelLogin(!1),t()}}function setWBCookie(e,t,i){var a=new Date;a.setTime(a.getTime()+6e4*i);var r="expires="+a.toUTCString();"undefined"!=typeof location&&void 0!==location.hostname&&(location.hostname.endsWith(".bookitall.com")||location.hostname.endsWith(".vagaro.com"))?location.hostname.endsWith(".bookitall.com")?document.cookie=e+"="+t+";"+r+";path=/;domain=.bookitall.com;secure;samesite=None":document.cookie=e+"="+t+";"+r+";path=/;domain=.vagaro.com;secure;samesite=None":document.cookie=e+"="+t+";"+r+";path=/"}function readAlexaCookie(e){for(var t=e+"=",i=document.cookie.split(";"),a=0;a<i.length;a++){for(var r=i[a];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(t))return r.substring(t.length,r.length)}return null}function IsExistsAlxCookie(){var e=readAlexaCookie("_vgamzn"),t=readAlexaCookie("_vggoogle");return!isNullOrUndefineOrBlank(e)||!isNullOrUndefineOrBlank(t)}function LoginAlexaUser(){ShowLoader(!0),vagaro.ajaxCall("websiteapi/homepage/checkisuserloggedin","",CallSuccess_CheckAlexaUserLoggedIn,CallFailed_Alexa,!1,!0)}function CallSuccess_CheckAlexaUserLoggedIn(e){if(ShowLoader(!1),!e){ShowLoader(!0);var t=readAlexaCookie("_vgamzn"),i=readAlexaCookie("_vggoogle"),a="";isNullOrUndefineOrBlank(t)?isNullOrUndefineOrBlank(i)||(a=i):a=t,signin(null,null,null,a,"","","",8,!1,!0,EncPV(""),getek(),getei(),"")}}function CallFailed_Alexa(){ShowLoader(!1)}function clearAlexaCookie(e){document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}function _vgParseatkn(e){var t=e.split("|");if(t.length>0){var i=t[t.length-1].split("$");i.length>1&&"tkn"==i[0]&&_vgsactkn(i[1])}}function _vgsactkn(e){if(!isNullOrUndefineOrBlank(e)&&void 0!==setLogintkn)try{setLogintkn(e),(navigator.userAgent.indexOf("com.vagaro.customerios")>-1||navigator.userAgent.indexOf("com.vagaro.customerandroid")>-1)&&navigator.userAgent.toLowerCase().indexOf("brandedapp")<0&&void 0!==isNewVersionCustomerAppLogin&&isNewVersionCustomerAppLogin("529","428")&&CallbackforMobileApp(0,0,"",e,0,"135")}catch(e){}}function _vggactkn(){try{for(var e="s_utkn=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var a=t[i];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(e))return a.substring(7,a.length)}return""}catch(e){return""}}function isNullOrUndefineOrBlank(e){return void 0===e||null==e||""==e||null==e}!function(e){_login={},_login.preUserName="",_login.preEmail="",_login.validateinput=!0,_login.tab=1,_login.IsResponceLoginpage=function(){"Login"==sFromPage&&2==_login.tab&&(e(".stepLogin1").removeClass("slide1"),e(".stepLogin2").removeClass("slide2"),_login.tab=1)},_login.getExistUserDetalis=function(){var t=e("#txtUsername").val();if(""!=e("#txtUsername").val().trim()&&0==SearchingUserNameNow){ShowLoader(!0),SearchingUserNameNow=!0;var i=new vagaro.ajax;i.datamodel.Token="getExistUserDetails",i.datamodel.data=[t],i.datamodel.callback=function(i){return SearchingUserNameNow=!1,ShowLoader(!1),e("#txtFNameAppleP").val(""),e("#txtLNameAppleP").val(""),null==i?(e(".divUserImage").css("background-image","url("+cdnimagepath+"Images/user-male-img_155_new.png"),e("#divUserNameform4").addClass("inputError"),e("#divUserNameform4 > .errortext").html("invalid username"),_login.validateinput=!1,!1):(e("#divUserNameform4").removeClass("inputError"),e("#divUserNameform4 > .errortext").html(""),e(".divUserName").html(i.EmailId),e("#txtFNameAppleP").val(i.FirstName),e("#txtLNameAppleP").val(i.LastName),""==_login.preUserName&&""==_login.preEmail&&(_login.preUserName=t,_login.preEmail=i.EmailId),e(".divUserImage").css("background-image","url('NoImage')"),e(".loginUserIntials").html(FindInitials(i.FirstName+" "+i.LastName,"SP")),null!=i.Photo?(e(".divUserImage").attr("data-original",i.CDNUrl+"200x0/"+i.Photo),e(".divUserImage").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload")):(e(".divUserImage").attr("data-original","NoImage"),e(".divUserImage").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload")),0==checkCaptch()?(_login.validateinput=!1,!1):void(0==e(".stepLogin1").hasClass("slide1")&&(e(".stepLogin1").addClass("slide1"),e(".stepLogin2").addClass("slide2"),_login.tab=2,setTimeout(function(){e(".stepLogin2 #txtPassword").focus()},1e3))))},i.datamodel.Error=function(e){ShowLoader(!1)},i.Post()}}}(jQuery,window,document),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){$.extend($.fn,{validate:function(e){if(this.length){var t=$.data(this[0],"validator");return t||(this.attr("novalidate","novalidate"),t=new $.validator(e,this[0]),$.data(this[0],"validator",t),t.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){t.settings.submitHandler&&(t.submitButton=e.target),$(e.target).hasClass("cancel")&&(t.cancelSubmit=!0),void 0!==$(e.target).attr("formnovalidate")&&(t.cancelSubmit=!0)}),this.submit(function(e){function i(){var i,a;return!t.settings.submitHandler||(t.submitButton&&(i=$("<input type='hidden'/>").attr("name",t.submitButton.name).val($(t.submitButton).val()).appendTo(t.currentForm)),a=t.settings.submitHandler.call(t,t.currentForm,e),t.submitButton&&i.remove(),void 0!==a&&a)}return t.settings.debug&&e.preventDefault(),t.cancelSubmit?(t.cancelSubmit=!1,i()):t.form()?t.pendingRequest?(t.formSubmitted=!0,!1):i():(t.focusInvalid(),!1)})),t)}e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.")},valid:function(){return this.validate().form()},removeAttrs:function(e){var t={},i=this;return $.each(e.split(/\s/),function(e,a){t[a]=i.attr(a),i.removeAttr(a)}),t},rules:function(e,t){var i,a,r,o,n,s,l=this[0];if(e)switch(a=(i=$.data($(l).closest("[data-type=validcontainer]")[0],"validator").settings).rules,r=$.validator.staticRules(l),e){case"add":$.extend(r,$.validator.normalizeRule(t)),delete r.messages,a[l.name]=r,t.messages&&(i.messages[l.name]=$.extend(i.messages[l.name],t.messages));break;case"remove":return t?(s={},$.each(t.split(/\s/),function(e,t){s[t]=r[t],delete r[t],"required"===t&&$(l).removeAttr("aria-required")}),s):(delete a[l.name],r)}return(o=$.validator.normalizeRules($.extend({},$.validator.classRules(l),$.validator.attributeRules(l),$.validator.dataRules(l),$.validator.staticRules(l)),l)).required&&(n=o.required,delete o.required,o=$.extend({required:n},o),$(l).attr("aria-required","true")),o.remote&&(n=o.remote,delete o.remote,o=$.extend(o,{remote:n})),o}}),$.extend($.expr[":"],{blank:function(e){return!$.trim(""+$(e).val())},filled:function(e){return!!$.trim(""+$(e).val())},unchecked:function(e){return!$(e).prop("checked")}}),$.validator=function(e,t){this.settings=$.extend(!0,{},$.validator.defaults,e),this.currentForm=t,this.init()},$.validator.format=function(e,t){return 1===arguments.length?function(){var t=$.makeArray(arguments);return t.unshift(e),$.validator.format.apply(this,t)}:(arguments.length>2&&t.constructor!==Array&&(t=$.makeArray(arguments).slice(1)),t.constructor!==Array&&(t=[t]),$.each(t,function(t,i){e=e.replace(new RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"errorInput",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e){this.lastActive=e,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(e)))},onfocusout:function(e){this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||this.element(e)},onkeyup:function(e,t){9===t.which&&""===this.elementValue(e)||(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(e,t,i){"radio"===e.type?this.findByName(e.name).addClass(t).removeClass(i):$(e).parent().hasClass("dropdowndiv")?$(e).parent().addClass(t).removeClass(i):$(e).addClass(t).removeClass(i)},unhighlight:function(e,t,i){"radio"===e.type?this.findByName(e.name).removeClass(t).addClass(i):$(e).parent().hasClass("dropdowndiv")?$(e).parent().removeClass(t).addClass(i):$(e).removeClass(t).addClass(i)}},setDefaults:function(e){$.extend($.validator.defaults,e)},messages:{required:"required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm),this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var e,t=this.groups={};function i(e){var t=$.data($(this[0]).closest("[data-type=validcontainer]")[0],"validator"),i="on"+e.type.replace(/^validate/,""),a=t.settings;t&&a[i]&&!this.is(a.ignore)&&a[i].call(t,this[0],e)}$.each(this.settings.groups,function(e,i){"string"==typeof i&&(i=i.split(/\s/)),$.each(i,function(i,a){t[a]=e})}),e=this.settings.rules,$.each(e,function(t,i){e[t]=$.validator.normalizeRule(i)}),$(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",i).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",i),this.settings.invalidHandler&&$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),$(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),$.extend(this.submitted,this.errorMap),this.invalid=$.extend({},this.errorMap),this.valid()||$(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(e){var t=this.clean(e),i=this.validationTargetFor(t),a=!0;return this.lastElement=i,void 0===i?delete this.invalid[t.name]:(this.prepareElement(i),this.currentElements=$(i),(a=!1!==this.check(i))?delete this.invalid[i.name]:this.invalid[i.name]=!0),$(e).attr("aria-invalid",!a),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a},showErrors:function(e){if(e){for(var t in $.extend(this.errorMap,e),this.errorList=[],e)this.errorList.push({message:e[t],element:this.findByName(t)[0]});this.successList=$.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){$.fn.resetForm&&$(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid"),this.elements().parent().hasClass("dropdowndiv")&&this.elements().parent().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t,i=0;for(t in e)i++;return i},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(e){e.not(this.containers).text(""),this.addWrapper(e).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===$.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,t={};return $(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),!(this.name in t||!e.objectLength($(this).rules()))&&(t[this.name]=!0,!0)})},clean:function(e){return $(e)[0]},errors:function(){var e=this.settings.errorClass.split(" ").join(".");return $(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=$([]),this.toHide=$([]),this.currentElements=$([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(e){var t,i=$(e),a=e.type;return"radio"===a||"checkbox"===a?$("input[name='"+e.name+"']:checked").val():"number"===a&&void 0!==e.validity?!e.validity.badInput&&i.val():"string"==typeof(t=i.val())?t.replace(/\r/g,""):t},check:function(e){e=this.validationTargetFor(this.clean(e));var t,i,a,r=$(e).rules(),o=$.map(r,function(e,t){return t}).length,n=!1,s=this.elementValue(e);for(i in r){a={method:i,parameters:r[i]};try{if("dependency-mismatch"===(t=$.validator.methods[i].call(this,s,e,a.parameters))&&1===o){n=!0;continue}if(n=!1,"pending"===t)return void(this.toHide=this.toHide.not(this.errorsFor(e)));if(!t)return this.formatAndAdd(e,a),!1}catch(t){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+a.method+"' method.",t),t}}if(!n)return this.objectLength(r)&&this.successList.push(e),!0},customDataMessage:function(e,t){return $(e).data("msg"+t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())||$(e).data("msg")},customMessage:function(e,t){var i=this.settings.messages[e];return i&&(i.constructor===String?i:i[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]},defaultMessage:function(e,t){return this.findDefined(this.customMessage(e.name,t),this.customDataMessage(e,t),!this.settings.ignoreTitle&&e.title||void 0,$.validator.messages[t],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,t){var i=this.defaultMessage(e,t.method),a=/\$?\{(\d+)\}/g;"function"==typeof i?i=i.call(this,t.parameters,e):a.test(i)&&(i=$.validator.format(i.replace(a,"{$1}"),t.parameters)),this.errorList.push({message:i,element:e,method:t.method}),this.errorMap[e.name]=i,this.submitted[e.name]=i},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t,i;for(e=0;this.errorList[e];e++)i=this.errorList[e],this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return $(this.errorList).map(function(){return this.element})},showLabel:function(e,t){var i,a,r,o=this.errorsFor(e),n=this.idOrName(e),s=$(e).attr("aria-describedby");o.length?(o.removeClass(this.settings.validClass).addClass(this.settings.errorClass),o.html(t)):(i=o=$("<"+this.settings.errorElement+">").attr("id",n+"-error").addClass(this.settings.errorClass).html(t||""),this.settings.wrapper&&(i=o.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(i):this.settings.errorPlacement?this.settings.errorPlacement(i,$(e)):$(e).parent().hasClass("dropdowndiv")?i.insertAfter($(e).parent()):i.insertAfter(e),o.is("label")?o.attr("for",n):0===o.parents("label[for='"+n+"']").length&&(r=o.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),s?s.match(new RegExp("\\b"+r+"\\b"))||(s+=" "+r):s=r,$(e).attr("aria-describedby",s),(a=this.groups[e.name])&&$.each(this.groups,function(e,t){t===a&&$("[name='"+e+"']",this.currentForm).attr("aria-describedby",o.attr("id"))}))),!t&&this.settings.success&&(o.text(""),"string"==typeof this.settings.success?o.addClass(this.settings.success):this.settings.success(o,e)),this.toShow=this.toShow.add(o)},errorsFor:function(e){var t=this.idOrName(e),i=$(e).attr("aria-describedby"),a="label[for='"+t+"'], label[for='"+t+"'] *";return i&&(a=a+", #"+i.replace(/\s+/g,", #")),this.errors().filter(a)},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name)),$(e).not(this.settings.ignore)[0]},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(e){return $(this.currentForm).find("[name='"+e+"']")},getLength:function(e,t){switch(t.nodeName.toLowerCase()){case"select":return $("option:selected",t).length;case"input":if(this.checkable(t))return this.findByName(t.name).filter(":checked").length}return e.length},depend:function(e,t){return!this.dependTypes[typeof e]||this.dependTypes[typeof e](e,t)},dependTypes:{boolean:function(e){return e},string:function(e,t){return!!$(e,t).length},function:function(e,t){return e(t)}},optional:function(e){var t=this.elementValue(e);return!$.validator.methods.required.call(this,t,e)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(e,t){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[e.name],t&&0===this.pendingRequest&&this.formSubmitted&&this.form()?($(this.currentForm).submit(),this.formSubmitted=!1):!t&&0===this.pendingRequest&&this.formSubmitted&&($(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return $.data(e,"previousValue")||$.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,t){e.constructor===String?this.classRuleSettings[e]=t:$.extend(this.classRuleSettings,e)},classRules:function(e){var t={},i=$(e).attr("class");return i&&$.each(i.split(" "),function(){this in $.validator.classRuleSettings&&$.extend(t,$.validator.classRuleSettings[this])}),t},attributeRules:function(e){var t,i,a={},r=$(e),o=e.getAttribute("type");for(t in $.validator.methods)"required"===t?(""===(i=e.getAttribute(t))&&(i=!0),i=!!i):i=r.attr(t),/min|max/.test(t)&&(null===o||/number|range|text/.test(o))&&(i=Number(i)),i||0===i?a[t]=i:o===t&&"range"!==o&&(a[t]=!0);return a.maxlength&&/-1|2147483647|524288/.test(a.maxlength)&&delete a.maxlength,a},dataRules:function(e){var t,i,a={},r=$(e);for(t in $.validator.methods)void 0!==(i=r.data("rule"+t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()))&&(a[t]=i);return a},staticRules:function(e){var t={},i=$.data($(e).closest("[data-type=validcontainer]")[0],"validator");return i.settings.rules&&(t=$.validator.normalizeRule(i.settings.rules[e.name])||{}),t},normalizeRules:function(e,t){return $.each(e,function(i,a){if(!1!==a){if(a.param||a.depends){var r=!0;switch(typeof a.depends){case"string":r=!!$(a.depends,t).length;break;case"function":r=a.depends.call(t,t)}r?e[i]=void 0===a.param||a.param:delete e[i]}}else delete e[i]}),$.each(e,function(i,a){e[i]=$.isFunction(a)?a(t):a}),$.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),$.each(["rangelength","range"],function(){var t;e[this]&&($.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(t=e[this].replace(/[\[\]]/g,"").split(/[\s,]+/),e[this]=[Number(t[0]),Number(t[1])]))}),$.validator.autoCreateRanges&&(null!=e.min&&null!=e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),null!=e.minlength&&null!=e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var t={};$.each(e.split(/\s/),function(){t[this]=!0}),e=t}return e},addMethod:function(e,t,i){$.validator.methods[e]=t,$.validator.messages[e]=void 0!==i?i:$.validator.messages[e],t.length<3&&$.validator.addClassRules(e,$.validator.normalizeRule(e))},methods:{required:function(e,t,i){if(!this.depend(i,t))return"dependency-mismatch";if("select"===t.nodeName.toLowerCase()){var a=$(t).val();return a&&a.length>0}return this.checkable(t)?this.getLength(e,t)>0:$.trim(e).length>0},email:function(e,t){return this.optional(t)||/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test(new Date(e).toString())},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var i,a,r=0,o=0,n=!1;if((e=e.replace(/\D/g,"")).length<13||e.length>19)return!1;for(i=e.length-1;i>=0;i--)a=e.charAt(i),o=parseInt(a,10),n&&(o*=2)>9&&(o-=9),r+=o,n=!n;return r%10==0},minlength:function(e,t,i){var a=$.isArray(e)?e.length:this.getLength(e,t);return this.optional(t)||a>=i},maxlength:function(e,t,i){var a=$.isArray(e)?e.length:this.getLength(e,t);return this.optional(t)||a<=i},rangelength:function(e,t,i){var a=$.isArray(e)?e.length:this.getLength(e,t);return this.optional(t)||a>=i[0]&&a<=i[1]},min:function(e,t,i){return this.optional(t)||e>=i},max:function(e,t,i){return this.optional(t)||e<=i},range:function(e,t,i){return this.optional(t)||e>=i[0]&&e<=i[1]},equalTo:function(e,t,i){var a=$(i);return this.settings.onfocusout&&a.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(t).valid()}),e===a.val()},remote:function(e,t,i){if(this.optional(t))return"dependency-mismatch";var a,r,o=this.previousValue(t);return this.settings.messages[t.name]||(this.settings.messages[t.name]={}),o.originalMessage=this.settings.messages[t.name].remote,this.settings.messages[t.name].remote=o.message,i="string"==typeof i&&{url:i}||i,o.old===e?o.valid:(o.old=e,a=this,this.startRequest(t),(r={})[t.name]=e,$.ajax($.extend(!0,{url:i,mode:"abort",port:"validate"+t.name,dataType:"json",data:r,context:a.currentForm,success:function(i){var r,n,s,l=!0===i||"true"===i;a.settings.messages[t.name].remote=o.originalMessage,l?(s=a.formSubmitted,a.prepareElement(t),a.formSubmitted=s,a.successList.push(t),delete a.invalid[t.name],a.showErrors()):(r={},n=i||a.defaultMessage(t,"remote"),r[t.name]=o.message=$.isFunction(n)?n(e):n,a.invalid[t.name]=!0,a.showErrors(r)),o.valid=l,a.stopRequest(t,l)}},i)),"pending")}}}),$.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var t,i={};$.ajaxPrefilter?$.ajaxPrefilter(function(e,t,a){var r=e.port;"abort"===e.mode&&(i[r]&&i[r].abort(),i[r]=a)}):(t=$.ajax,$.ajax=function(e){var a=("mode"in e?e:$.ajaxSettings).mode,r=("port"in e?e:$.ajaxSettings).port;return"abort"===a?(i[r]&&i[r].abort(),i[r]=t.apply(this,arguments),i[r]):t.apply(this,arguments)}),$.extend($.fn,{validateDelegate:function(e,t,i){return this.bind(t,function(t){var a=$(t.target);if(a.is(e))return i.apply(a,arguments)})}})}),
/*!
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2015 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.9.5
 *
 */
function(e,t,i,a){var r=e(t);e.fn.lazyload=function(o){var n,s=this,l={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",data_error:null,skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC",imgLoadClass:null,isShowIntials:!1,intial_selecter:null};function d(){var t=0;s.each(function(){var i=e(this);if(!l.skip_invisible||i.is(":visible"))if(e.abovethetop(this,l)||e.leftofbegin(this,l));else if(e.belowthefold(this,l)||e.rightoffold(this,l)){if(++t>l.failure_limit)return!1}else i.trigger("appear"),t=0})}return o&&(a!==o.failurelimit&&(o.failure_limit=o.failurelimit,delete o.failurelimit),a!==o.effectspeed&&(o.effect_speed=o.effectspeed,delete o.effectspeed),e.extend(l,o)),n=l.container===a||l.container===t?r:e(l.container),0===l.event.indexOf("scroll")&&n.bind(l.event,function(){return d()}),this.each(function(){var t=this,i=e(t);t.loaded=!1,i.attr("src")!==a&&!1!==i.attr("src")||i.is("img")&&i.attr("src",l.placeholder),i.one("appear",function(){if(!this.loaded){if(l.appear){var r=s.length;l.appear.call(t,r,l)}e("<img />").bind("load",function(){var r=i.attr("data-"+l.data_attribute);i.hide();try{var o=l.imgLoadClass;null!=o&&o!=a&&i.addClass(o)}catch(e){}i.is("img")?i.attr("src",r):(1==l.isShowIntials&&(i.find(l.intial_selecter).hide(),(r.indexOf("/user-male-img_155_new.png")>0||r.indexOf("/user-female-img_155.jpg")>0)&&(r="",i.find(l.intial_selecter).show())),r!=a&&""!=r&&""!=r&&null!=r?i.css("background-image","url('"+r+"')"):i.css("background-image","none")),i[l.effect](l.effect_speed),t.loaded=!0;var n=e.grep(s,function(e){return!e.loaded});if(s=e(n),l.load){var d=s.length;l.load.call(t,d,l)}}).bind("error",function(){try{if(void 0!==i.data("hidedivid")&&null!=i.data("hidedivid")&&""!=i.data("hidedivid")){var r=i.data("hidedivid");e("#"+r).hide()}}catch(e){}var o=l.data_error;if(null!=o||1==l.isShowIntials){i.hide();try{var n=l.imgLoadClass;null!=n&&n!=a&&i.addClass(n)}catch(e){}i.is("img")?i.attr("src",o):1==l.isShowIntials?(i.find(l.intial_selecter).show(),i.css("background-image","none")):o!=a&&""!=o&&""!=o&&null!=o?i.css("background-image","url('"+o+"')"):i.css("background-image","none"),i[l.effect](l.effect_speed),t.loaded=!0;var d=e.grep(s,function(e){return!e.loaded});if(s=e(d),l.load){var c=s.length;l.load.call(t,c,l)}}}).attr("src",i.attr("data-"+l.data_attribute))}}),0!==l.event.indexOf("scroll")&&i.bind(l.event,function(){t.loaded||i.trigger("appear")})}),r.bind("resize",function(){d()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&r.bind("pageshow",function(t){t.originalEvent&&t.originalEvent.persisted&&s.each(function(){e(this).trigger("appear")})}),e(i).ready(function(){d()}),this},e.belowthefold=function(i,o){return(o.container===a||o.container===t?(t.innerHeight?t.innerHeight:r.height())+r.scrollTop():e(o.container).offset().top+e(o.container).height())<=e(i).offset().top-o.threshold},e.rightoffold=function(i,o){return(o.container===a||o.container===t?r.width()+r.scrollLeft():e(o.container).offset().left+e(o.container).width())<=e(i).offset().left-o.threshold},e.abovethetop=function(i,o){return(o.container===a||o.container===t?r.scrollTop():e(o.container).offset().top)>=e(i).offset().top+o.threshold+e(i).height()},e.leftofbegin=function(i,o){return(o.container===a||o.container===t?r.scrollLeft():e(o.container).offset().left)>=e(i).offset().left+o.threshold+e(i).width()},e.inviewport=function(t,i){return!(e.rightoffold(t,i)||e.leftofbegin(t,i)||e.belowthefold(t,i)||e.abovethetop(t,i))},e.extend(e.expr[":"],{"below-the-fold":function(t){return e.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return e.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!e.rightoffold(t,{threshold:0})},"in-viewport":function(t){return e.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return e.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!e.rightoffold(t,{threshold:0})}})}(jQuery,window,document),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Popper=t()}(this,function(){"use strict";function e(e){return e&&"[object Function]"==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var i=getComputedStyle(e,null);return t?i[t]:i}function i(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function a(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var r=t(e),o=r.overflow,n=r.overflowX,s=r.overflowY;return/(auto|scroll)/.test(o+s+n)?e:a(i(e))}function r(e){var i=e&&e.offsetParent,a=i&&i.nodeName;return a&&"BODY"!==a&&"HTML"!==a?-1!==["TD","TABLE"].indexOf(i.nodeName)&&"static"===t(i,"position")?r(i):i:e?e.ownerDocument.documentElement:document.documentElement}function o(e){return null===e.parentNode?e:o(e.parentNode)}function n(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var i=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,a=i?e:t,s=i?t:e,l=document.createRange();l.setStart(a,0),l.setEnd(s,0);var d=l.commonAncestorContainer;if(e!==d&&t!==d||a.contains(s))return function(e){var t=e.nodeName;return"BODY"!==t&&("HTML"===t||r(e.firstElementChild)===e)}(d)?d:r(d);var c=o(e);return c.host?n(c.host,t):n(e,o(t).host)}function s(e){var t="top"===(1<arguments.length&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",i=e.nodeName;if("BODY"===i||"HTML"===i){var a=e.ownerDocument.documentElement;return(e.ownerDocument.scrollingElement||a)[t]}return e[t]}function l(e,t){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],a=s(t,"top"),r=s(t,"left"),o=i?-1:1;return e.top+=a*o,e.bottom+=a*o,e.left+=r*o,e.right+=r*o,e}function d(e,t){var i="x"===t?"Left":"Top",a="Left"==i?"Right":"Bottom";return parseFloat(e["border"+i+"Width"],10)+parseFloat(e["border"+a+"Width"],10)}function c(e,t,i,a){return W(t["offset"+e],t["scroll"+e],i["client"+e],i["offset"+e],i["scroll"+e],X()?i["offset"+e]+a["margin"+("Height"===e?"Top":"Left")]+a["margin"+("Height"===e?"Bottom":"Right")]:0)}function u(){var e=document.body,t=document.documentElement,i=X()&&getComputedStyle(t);return{height:c("Height",e,t,i),width:c("Width",e,t,i)}}function p(e){return Q({},e,{right:e.left+e.width,bottom:e.top+e.height})}function h(e){var i={};if(X())try{i=e.getBoundingClientRect();var a=s(e,"top"),r=s(e,"left");i.top+=a,i.left+=r,i.bottom+=a,i.right+=r}catch(e){}else i=e.getBoundingClientRect();var o={left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top},n="HTML"===e.nodeName?u():{},l=n.width||e.clientWidth||o.right-o.left,c=n.height||e.clientHeight||o.bottom-o.top,h=e.offsetWidth-l,m=e.offsetHeight-c;if(h||m){var f=t(e);h-=d(f,"x"),m-=d(f,"y"),o.width-=h,o.height-=m}return p(o)}function m(e,i){var r=X(),o="HTML"===i.nodeName,n=h(e),s=h(i),d=a(e),c=t(i),u=parseFloat(c.borderTopWidth,10),m=parseFloat(c.borderLeftWidth,10),f=p({top:n.top-s.top-u,left:n.left-s.left-m,width:n.width,height:n.height});if(f.marginTop=0,f.marginLeft=0,!r&&o){var g=parseFloat(c.marginTop,10),v=parseFloat(c.marginLeft,10);f.top-=u-g,f.bottom-=u-g,f.left-=m-v,f.right-=m-v,f.marginTop=g,f.marginLeft=v}return(r?i.contains(d):i===d&&"BODY"!==d.nodeName)&&(f=l(f,i)),f}function f(e){var t=e.ownerDocument.documentElement,i=m(e,t),a=W(t.clientWidth,window.innerWidth||0),r=W(t.clientHeight,window.innerHeight||0),o=s(t),n=s(t,"left");return p({top:o-i.top+i.marginTop,left:n-i.left+i.marginLeft,width:a,height:r})}function g(e){var a=e.nodeName;return"BODY"!==a&&"HTML"!==a&&("fixed"===t(e,"position")||g(i(e)))}function v(e,t,r,o){var s={top:0,left:0},l=n(e,t);if("viewport"===o)s=f(l);else{var d;"scrollParent"===o?"BODY"===(d=a(i(t))).nodeName&&(d=e.ownerDocument.documentElement):d="window"===o?e.ownerDocument.documentElement:o;var c=m(d,l);if("HTML"!==d.nodeName||g(l))s=c;else{var p=u(),h=p.height,v=p.width;s.top+=c.top-c.marginTop,s.bottom=h+c.top,s.left+=c.left-c.marginLeft,s.right=v+c.left}}return s.left+=r,s.top+=r,s.right-=r,s.bottom-=r,s}function A(e){return e.width*e.height}function C(e,t,i,a,r){var o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf("auto"))return e;var n=v(i,a,o,r),s={top:{width:n.width,height:t.top-n.top},right:{width:n.right-t.right,height:n.height},bottom:{width:n.width,height:n.bottom-t.bottom},left:{width:t.left-n.left,height:n.height}},l=Object.keys(s).map(function(e){return Q({key:e},s[e],{area:A(s[e])})}).sort(function(e,t){return t.area-e.area}),d=l.filter(function(e){var t=e.width,a=e.height;return t>=i.clientWidth&&a>=i.clientHeight}),c=0<d.length?d[0].key:l[0].key,u=e.split("-")[1];return c+(u?"-"+u:"")}function y(e,t,i){return m(i,n(t,i))}function b(e){var t=getComputedStyle(e),i=parseFloat(t.marginTop)+parseFloat(t.marginBottom),a=parseFloat(t.marginLeft)+parseFloat(t.marginRight);return{width:e.offsetWidth+a,height:e.offsetHeight+i}}function S(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function k(e,t,i){i=i.split("-")[0];var a=b(e),r={width:a.width,height:a.height},o=-1!==["right","left"].indexOf(i),n=o?"top":"left",s=o?"left":"top",l=o?"height":"width",d=o?"width":"height";return r[n]=t[n]+t[l]/2-a[l]/2,r[s]=i===s?t[s]-a[d]:t[S(s)],r}function D(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function _(t,i,a){var r=void 0===a?t:t.slice(0,function(e,t,i){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===i});var a=D(e,function(e){return e[t]===i});return e.indexOf(a)}(t,"name",a));return r.forEach(function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var a=t.function||t.fn;t.enabled&&e(a)&&(i.offsets.popper=p(i.offsets.popper),i.offsets.reference=p(i.offsets.reference),i=a(i,t))}),i}function I(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=y(this.state,this.popper,this.reference),e.placement=C(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=k(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position="absolute",e=_(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function w(e,t){return e.some(function(e){var i=e.name;return e.enabled&&i===t})}function P(e){for(var t=[!1,"ms","Webkit","Moz","O"],i=e.charAt(0).toUpperCase()+e.slice(1),a=0;a<t.length-1;a++){var r=t[a],o=r?""+r+i:e;if(void 0!==document.body.style[o])return o}return null}function T(){return this.state.isDestroyed=!0,w(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.left="",this.popper.style.position="",this.popper.style.top="",this.popper.style[P("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function B(e){var t=e.ownerDocument;return t?t.defaultView:window}function x(e,t,i,r){var o="BODY"===e.nodeName,n=o?e.ownerDocument.defaultView:e;n.addEventListener(t,i,{passive:!0}),o||x(a(n.parentNode),t,i,r),r.push(n)}function F(e,t,i,r){i.updateBound=r,B(e).addEventListener("resize",i.updateBound,{passive:!0});var o=a(e);return x(o,"scroll",i.updateBound,i.scrollParents),i.scrollElement=o,i.eventsEnabled=!0,i}function O(){this.state.eventsEnabled||(this.state=F(this.reference,this.options,this.state,this.scheduleUpdate))}function M(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=function(e,t){return B(e).removeEventListener("resize",t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener("scroll",t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}(this.reference,this.state))}function E(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function $(e,t){Object.keys(t).forEach(function(i){var a="";-1!==["width","height","top","right","bottom","left"].indexOf(i)&&E(t[i])&&(a="px"),e.style[i]=t[i]+a})}function N(e,t,i){var a=D(e,function(e){return e.name===t}),r=!!a&&e.some(function(e){return e.name===i&&e.enabled&&e.order<a.order});if(!r){var o="`"+t+"`";console.warn("`"+i+"` modifier is required by "+o+" modifier in order to work, be sure to include it before "+o+"!")}return r}function L(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=ee.indexOf(e),a=ee.slice(i+1).concat(ee.slice(0,i));return t?a.reverse():a}function U(e,t,i,a){var r=[0,0],o=-1!==["right","left"].indexOf(a),n=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=n.indexOf(D(n,function(e){return-1!==e.search(/,|\s/)}));n[s]&&-1===n[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,d=-1===s?[n]:[n.slice(0,s).concat([n[s].split(l)[0]]),[n[s].split(l)[1]].concat(n.slice(s+1))];return d=d.map(function(e,a){var r=(1===a?!o:o)?"height":"width",n=!1;return e.reduce(function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,n=!0,e):n?(e[e.length-1]+=t,n=!1,e):e.concat(t)},[]).map(function(e){return function(e,t,i,a){var r=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),o=+r[1],n=r[2];if(!o)return e;if(0===n.indexOf("%")){return p("%p"===n?i:a)[t]/100*o}return"vh"===n||"vw"===n?("vh"===n?W(document.documentElement.clientHeight,window.innerHeight||0):W(document.documentElement.clientWidth,window.innerWidth||0))/100*o:o}(e,r,t,i)})}),d.forEach(function(e,t){e.forEach(function(i,a){E(i)&&(r[t]+=i*("-"===e[a-1]?-1:1))})}),r}for(var R=Math.min,G=Math.floor,W=Math.max,V="undefined"!=typeof window&&"undefined"!=typeof document,j=["Edge","Trident","Firefox"],H=0,Y=0;Y<j.length;Y+=1)if(V&&0<=navigator.userAgent.indexOf(j[Y])){H=1;break}var Z,z=V&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},H))}},X=function(){return null==Z&&(Z=-1!==navigator.appVersion.indexOf("MSIE 10")),Z},q=function(){function e(e,t){for(var i,a=0;a<t.length;a++)(i=t[a]).enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}return function(t,i,a){return i&&e(t.prototype,i),a&&e(t,a),t}}(),J=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},Q=Object.assign||function(e){for(var t,i=1;i<arguments.length;i++)for(var a in t=arguments[i])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},K=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],ee=K.slice(3),te="flip",ie="clockwise",ae="counterclockwise",re=function(){function t(i,a){var r=this,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=z(this.update.bind(this)),this.options=Q({},t.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=i&&i.jquery?i[0]:i,this.popper=a&&a.jquery?a[0]:a,this.options.modifiers={},Object.keys(Q({},t.Defaults.modifiers,o.modifiers)).forEach(function(e){r.options.modifiers[e]=Q({},t.Defaults.modifiers[e]||{},o.modifiers?o.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return Q({name:e},r.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(r.reference,r.popper,r.options,t,r.state)}),this.update();var n=this.options.eventsEnabled;n&&this.enableEventListeners(),this.state.eventsEnabled=n}return q(t,[{key:"update",value:function(){return I.call(this)}},{key:"destroy",value:function(){return T.call(this)}},{key:"enableEventListeners",value:function(){return O.call(this)}},{key:"disableEventListeners",value:function(){return M.call(this)}}]),t}();return re.Utils=("undefined"==typeof window?global:window).PopperUtils,re.placements=K,re.Defaults={placement:"bottom",eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,i=t.split("-")[0],a=t.split("-")[1];if(a){var r=e.offsets,o=r.reference,n=r.popper,s=-1!==["bottom","top"].indexOf(i),l=s?"left":"top",d=s?"width":"height",c={start:J({},l,o[l]),end:J({},l,o[l]+o[d]-n[d])};e.offsets.popper=Q({},n,c[a])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var i,a=t.offset,r=e.placement,o=e.offsets,n=o.popper,s=o.reference,l=r.split("-")[0];return i=E(+a)?[+a,0]:U(a,n,s,l),"left"===l?(n.top+=i[0],n.left-=i[1]):"right"===l?(n.top+=i[0],n.left+=i[1]):"top"===l?(n.left+=i[0],n.top-=i[1]):"bottom"===l&&(n.left+=i[0],n.top+=i[1]),e.popper=n,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var i=t.boundariesElement||r(e.instance.popper);e.instance.reference===i&&(i=r(i));var a=v(e.instance.popper,e.instance.reference,t.padding,i);t.boundaries=a;var o=t.priority,n=e.offsets.popper,s={primary:function(e){var i=n[e];return n[e]<a[e]&&!t.escapeWithReference&&(i=W(n[e],a[e])),J({},e,i)},secondary:function(e){var i="right"===e?"left":"top",r=n[i];return n[e]>a[e]&&!t.escapeWithReference&&(r=R(n[i],a[e]-("right"===e?n.width:n.height))),J({},i,r)}};return o.forEach(function(e){var t=-1===["left","top"].indexOf(e)?"secondary":"primary";n=Q({},n,s[t](e))}),e.offsets.popper=n,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,i=t.popper,a=t.reference,r=e.placement.split("-")[0],o=G,n=-1!==["top","bottom"].indexOf(r),s=n?"right":"bottom",l=n?"left":"top",d=n?"width":"height";return i[s]<o(a[l])&&(e.offsets.popper[l]=o(a[l])-i[d]),i[l]>o(a[s])&&(e.offsets.popper[l]=o(a[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,i){var a;if(!N(e.instance.modifiers,"arrow","keepTogether"))return e;var r=i.element;if("string"==typeof r){if(!(r=e.instance.popper.querySelector(r)))return e}else if(!e.instance.popper.contains(r))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var o=e.placement.split("-")[0],n=e.offsets,s=n.popper,l=n.reference,d=-1!==["left","right"].indexOf(o),c=d?"height":"width",u=d?"Top":"Left",h=u.toLowerCase(),m=d?"left":"top",f=d?"bottom":"right",g=b(r)[c];l[f]-g<s[h]&&(e.offsets.popper[h]-=s[h]-(l[f]-g)),l[h]+g>s[f]&&(e.offsets.popper[h]+=l[h]+g-s[f]),e.offsets.popper=p(e.offsets.popper);var v=l[h]+l[c]/2-g/2,A=t(e.instance.popper),C=parseFloat(A["margin"+u],10),y=parseFloat(A["border"+u+"Width"],10),S=v-e.offsets.popper[h]-C-y;return S=W(R(s[c]-g,S),0),e.arrowElement=r,e.offsets.arrow=(J(a={},h,Math.round(S)),J(a,m,""),a),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(e,t){if(w(e.instance.modifiers,"inner"))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var i=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),a=e.placement.split("-")[0],r=S(a),o=e.placement.split("-")[1]||"",n=[];switch(t.behavior){case te:n=[a,r];break;case ie:n=L(a);break;case ae:n=L(a,!0);break;default:n=t.behavior}return n.forEach(function(s,l){if(a!==s||n.length===l+1)return e;a=e.placement.split("-")[0],r=S(a);var d=e.offsets.popper,c=e.offsets.reference,u=G,p="left"===a&&u(d.right)>u(c.left)||"right"===a&&u(d.left)<u(c.right)||"top"===a&&u(d.bottom)>u(c.top)||"bottom"===a&&u(d.top)<u(c.bottom),h=u(d.left)<u(i.left),m=u(d.right)>u(i.right),f=u(d.top)<u(i.top),g=u(d.bottom)>u(i.bottom),v="left"===a&&h||"right"===a&&m||"top"===a&&f||"bottom"===a&&g,A=-1!==["top","bottom"].indexOf(a),C=!!t.flipVariations&&(A&&"start"===o&&h||A&&"end"===o&&m||!A&&"start"===o&&f||!A&&"end"===o&&g);(p||v||C)&&(e.flipped=!0,(p||v)&&(a=n[l+1]),C&&(o=function(e){return"end"===e?"start":"start"===e?"end":e}(o)),e.placement=a+(o?"-"+o:""),e.offsets.popper=Q({},e.offsets.popper,k(e.instance.popper,e.offsets.reference,e.placement)),e=_(e.instance.modifiers,e,"flip"))}),e},behavior:"flip",padding:5,boundariesElement:"viewport"},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,i=t.split("-")[0],a=e.offsets,r=a.popper,o=a.reference,n=-1!==["left","right"].indexOf(i),s=-1===["top","left"].indexOf(i);return r[n?"left":"top"]=o[i]-(s?r[n?"width":"height"]:0),e.placement=S(t),e.offsets.popper=p(r),e}},hide:{order:800,enabled:!0,fn:function(e){if(!N(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,i=D(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottom<i.top||t.left>i.right||t.top>i.bottom||t.right<i.left){if(!0===e.hide)return e;e.hide=!0,e.attributes["x-out-of-boundaries"]=""}else{if(!1===e.hide)return e;e.hide=!1,e.attributes["x-out-of-boundaries"]=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var i=t.x,a=t.y,o=e.offsets.popper,n=D(e.instance.modifiers,function(e){return"applyStyle"===e.name}).gpuAcceleration;void 0!==n&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var s,l,d=void 0===n?t.gpuAcceleration:n,c=h(r(e.instance.popper)),u={position:o.position},p={left:G(o.left),top:G(o.top),bottom:G(o.bottom),right:G(o.right)},m="bottom"===i?"top":"bottom",f="right"===a?"left":"right",g=P("transform");if(l="bottom"==m?-c.height+p.bottom:p.top,s="right"==f?-c.width+p.right:p.left,d&&g)u[g]="translate3d("+s+"px, "+l+"px, 0)",u[m]=0,u[f]=0,u.willChange="transform";else{var v="bottom"==m?-1:1,A="right"==f?-1:1;u[m]=l*v,u[f]=s*A,u.willChange=m+", "+f}var C={"x-placement":e.placement};return e.attributes=Q({},C,e.attributes),e.styles=Q({},u,e.styles),e.arrowStyles=Q({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){return $(e.instance.popper,e.styles),function(e,t){Object.keys(t).forEach(function(i){!1===t[i]?e.removeAttribute(i):e.setAttribute(i,t[i])})}(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&$(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,i,a,r){var o=y(0,t,e),n=C(i.placement,o,t,e,i.modifiers.flip.boundariesElement,i.modifiers.flip.padding);return t.setAttribute("x-placement",n),$(t,{position:"absolute"}),i},gpuAcceleration:void 0}}},re}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],t):t(e.bootstrap={},e.jQuery,e.Popper)}(this,function(e,t,i){"use strict";function a(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),e}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e}).apply(this,arguments)}t=t&&t.hasOwnProperty("default")?t.default:t,i=i&&i.hasOwnProperty("default")?i.default:i;var n,s,l,d,c,u,p,h,m,f,g,v,A,C,y,b,S,k,D=function(e){var t=!1;var i={TRANSITION_END:"bsTransitionEnd",getUID:function(e){do{e+=~~(1e6*Math.random())}while(document.getElementById(e));return e},getSelectorFromElement:function(t){var i,a=t.getAttribute("data-target");a&&"#"!==a||(a=t.getAttribute("href")||""),"#"===a.charAt(0)&&(i=a,a=i="function"==typeof e.escapeSelector?e.escapeSelector(i).substr(1):i.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1"));try{return e(document).find(a).length>0?a:null}catch(e){return null}},reflow:function(e){return e.offsetHeight},triggerTransitionEnd:function(i){e(i).trigger(t.end)},supportsTransitionEnd:function(){return Boolean(t)},isElement:function(e){return(e[0]||e).nodeType},typeCheckConfig:function(e,t,a){for(var r in a)if(Object.prototype.hasOwnProperty.call(a,r)){var o=a[r],n=t[r],s=n&&i.isElement(n)?"element":(l=n,{}.toString.call(l).match(/\s([a-zA-Z]+)/)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(e.toUpperCase()+': Option "'+r+'" provided type "'+s+'" but expected type "'+o+'".')}var l}};return t=("undefined"==typeof window||!window.QUnit)&&{end:"transitionend"},e.fn.emulateTransitionEnd=function(t){var a=this,r=!1;return e(this).one(i.TRANSITION_END,function(){r=!0}),setTimeout(function(){r||i.triggerTransitionEnd(a)},t),this},i.supportsTransitionEnd()&&(e.event.special[i.TRANSITION_END]={bindType:t.end,delegateType:t.end,handle:function(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}}),i}(t),_=(s="alert",d="."+(l="bs.alert"),c=(n=t).fn[s],u={CLOSE:"close"+d,CLOSED:"closed"+d,CLICK_DATA_API:"click"+d+".data-api"},p=function(){function e(e){this._element=e}var t=e.prototype;return t.close=function(e){e=e||this._element;var t=this._getRootElement(e);this._triggerCloseEvent(t).isDefaultPrevented()||this._removeElement(t)},t.dispose=function(){n.removeData(this._element,l),this._element=null},t._getRootElement=function(e){var t=D.getSelectorFromElement(e),i=!1;return t&&(i=n(t)[0]),i||(i=n(e).closest(".alert")[0]),i},t._triggerCloseEvent=function(e){var t=n.Event(u.CLOSE);return n(e).trigger(t),t},t._removeElement=function(e){var t=this;n(e).removeClass("show"),D.supportsTransitionEnd()&&n(e).hasClass("fade")?n(e).one(D.TRANSITION_END,function(i){return t._destroyElement(e,i)}).emulateTransitionEnd(150):this._destroyElement(e)},t._destroyElement=function(e){n(e).detach().trigger(u.CLOSED).remove()},e._jQueryInterface=function(t){return this.each(function(){var i=n(this),a=i.data(l);a||(a=new e(this),i.data(l,a)),"close"===t&&a[t](this)})},e._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},r(e,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),e}(),n(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',p._handleDismiss(new p)),n.fn[s]=p._jQueryInterface,n.fn[s].Constructor=p,n.fn[s].noConflict=function(){return n.fn[s]=c,p._jQueryInterface},p),I=(m="button",g="."+(f="bs.button"),v=".data-api",A=(h=t).fn[m],C="active",y='[data-toggle^="button"]',b=".btn",S={CLICK_DATA_API:"click"+g+v,FOCUS_BLUR_DATA_API:"focus"+g+v+" blur"+g+v},k=function(){function e(e){this._element=e}var t=e.prototype;return t.toggle=function(){var e=!0,t=!0,i=h(this._element).closest('[data-toggle="buttons"]')[0];if(i){var a=h(this._element).find("input")[0];if(a){if("radio"===a.type)if(a.checked&&h(this._element).hasClass(C))e=!1;else{var r=h(i).find(".active")[0];r&&h(r).removeClass(C)}if(e){if(a.hasAttribute("disabled")||i.hasAttribute("disabled")||a.classList.contains("disabled")||i.classList.contains("disabled"))return;a.checked=!h(this._element).hasClass(C),h(a).trigger("change")}a.focus(),t=!1}}t&&this._element.setAttribute("aria-pressed",!h(this._element).hasClass(C)),e&&h(this._element).toggleClass(C)},t.dispose=function(){h.removeData(this._element,f),this._element=null},e._jQueryInterface=function(t){return this.each(function(){var i=h(this).data(f);i||(i=new e(this),h(this).data(f,i)),"toggle"===t&&i[t]()})},r(e,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),e}(),h(document).on(S.CLICK_DATA_API,y,function(e){e.preventDefault();var t=e.target;h(t).hasClass("btn")||(t=h(t).closest(b)),k._jQueryInterface.call(h(t),"toggle")}).on(S.FOCUS_BLUR_DATA_API,y,function(e){var t=h(e.target).closest(b)[0];h(t).toggleClass("focus",/^focus(in)?$/.test(e.type))}),h.fn[m]=k._jQueryInterface,h.fn[m].Constructor=k,h.fn[m].noConflict=function(){return h.fn[m]=A,k._jQueryInterface},k),w=function(e){var t="carousel",i="bs.carousel",a="."+i,n=e.fn[t],s={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0},l={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean"},d="next",c="prev",u={SLIDE:"slide"+a,SLID:"slid"+a,KEYDOWN:"keydown"+a,MOUSEENTER:"mouseenter"+a,MOUSELEAVE:"mouseleave"+a,TOUCHEND:"touchend"+a,LOAD_DATA_API:"load"+a+".data-api",CLICK_DATA_API:"click"+a+".data-api"},p="active",h=".active",m=".active.carousel-item",f=".carousel-item",g=".carousel-item-next, .carousel-item-prev",v=".carousel-indicators",A="[data-slide], [data-slide-to]",C='[data-ride="carousel"]',y=function(){function n(t,i){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this._config=this._getConfig(i),this._element=e(t)[0],this._indicatorsElement=e(this._element).find(v)[0],this._addEventListeners()}var A=n.prototype;return A.next=function(){this._isSliding||this._slide(d)},A.nextWhenVisible=function(){!document.hidden&&e(this._element).is(":visible")&&"hidden"!==e(this._element).css("visibility")&&this.next()},A.prev=function(){this._isSliding||this._slide(c)},A.pause=function(t){t||(this._isPaused=!0),e(this._element).find(g)[0]&&D.supportsTransitionEnd()&&(D.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},A.cycle=function(e){e||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},A.to=function(t){var i=this;this._activeElement=e(this._element).find(m)[0];var a=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)e(this._element).one(u.SLID,function(){return i.to(t)});else{if(a===t)return this.pause(),void this.cycle();var r=t>a?d:c;this._slide(r,this._items[t])}},A.dispose=function(){e(this._element).off(a),e.removeData(this._element,i),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},A._getConfig=function(e){return e=o({},s,e),D.typeCheckConfig(t,e,l),e},A._addEventListeners=function(){var t=this;this._config.keyboard&&e(this._element).on(u.KEYDOWN,function(e){return t._keydown(e)}),"hover"===this._config.pause&&(e(this._element).on(u.MOUSEENTER,function(e){return t.pause(e)}).on(u.MOUSELEAVE,function(e){return t.cycle(e)}),"ontouchstart"in document.documentElement&&e(this._element).on(u.TOUCHEND,function(){t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout(function(e){return t.cycle(e)},500+t._config.interval)}))},A._keydown=function(e){if(!/input|textarea/i.test(e.target.tagName))switch(e.which){case 37:e.preventDefault(),this.prev();break;case 39:e.preventDefault(),this.next()}},A._getItemIndex=function(t){return this._items=e.makeArray(e(t).parent().find(f)),this._items.indexOf(t)},A._getItemByDirection=function(e,t){var i=e===d,a=e===c,r=this._getItemIndex(t),o=this._items.length-1;if((a&&0===r||i&&r===o)&&!this._config.wrap)return t;var n=(r+(e===c?-1:1))%this._items.length;return-1===n?this._items[this._items.length-1]:this._items[n]},A._triggerSlideEvent=function(t,i){var a=this._getItemIndex(t),r=this._getItemIndex(e(this._element).find(m)[0]),o=e.Event(u.SLIDE,{relatedTarget:t,direction:i,from:r,to:a});return e(this._element).trigger(o),o},A._setActiveIndicatorElement=function(t){if(this._indicatorsElement){e(this._indicatorsElement).find(h).removeClass(p);var i=this._indicatorsElement.children[this._getItemIndex(t)];i&&e(i).addClass(p)}},A._slide=function(t,i){var a,r,o,n=this,s=e(this._element).find(m)[0],l=this._getItemIndex(s),c=i||s&&this._getItemByDirection(t,s),h=this._getItemIndex(c),f=Boolean(this._interval);if(t===d?(a="carousel-item-left",r="carousel-item-next",o="left"):(a="carousel-item-right",r="carousel-item-prev",o="right"),c&&e(c).hasClass(p))this._isSliding=!1;else if(!this._triggerSlideEvent(c,o).isDefaultPrevented()&&s&&c){this._isSliding=!0,f&&this.pause(),this._setActiveIndicatorElement(c);var g=e.Event(u.SLID,{relatedTarget:c,direction:o,from:l,to:h});D.supportsTransitionEnd()&&e(this._element).hasClass("slide")?(e(c).addClass(r),D.reflow(c),e(s).addClass(a),e(c).addClass(a),e(s).one(D.TRANSITION_END,function(){e(c).removeClass(a+" "+r).addClass(p),e(s).removeClass(p+" "+r+" "+a),n._isSliding=!1,setTimeout(function(){return e(n._element).trigger(g)},0)}).emulateTransitionEnd(600)):(e(s).removeClass(p),e(c).addClass(p),this._isSliding=!1,e(this._element).trigger(g)),f&&this.cycle()}},n._jQueryInterface=function(t){return this.each(function(){var a=e(this).data(i),r=o({},s,e(this).data());"object"==typeof t&&(r=o({},r,t));var l="string"==typeof t?t:r.slide;if(a||(a=new n(this,r),e(this).data(i,a)),"number"==typeof t)a.to(t);else if("string"==typeof l){if(void 0===a[l])throw new TypeError('No method named "'+l+'"');a[l]()}else r.interval&&(a.pause(),a.cycle())})},n._dataApiClickHandler=function(t){var a=D.getSelectorFromElement(this);if(a){var r=e(a)[0];if(r&&e(r).hasClass("carousel")){var s=o({},e(r).data(),e(this).data()),l=this.getAttribute("data-slide-to");l&&(s.interval=!1),n._jQueryInterface.call(e(r),s),l&&e(r).data(i).to(l),t.preventDefault()}}},r(n,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return s}}]),n}();return e(document).on(u.CLICK_DATA_API,A,y._dataApiClickHandler),e(window).on(u.LOAD_DATA_API,function(){e(C).each(function(){var t=e(this);y._jQueryInterface.call(t,t.data())})}),e.fn[t]=y._jQueryInterface,e.fn[t].Constructor=y,e.fn[t].noConflict=function(){return e.fn[t]=n,y._jQueryInterface},y}(t),P=function(e){var t="collapse",i="bs.collapse",a="."+i,n=e.fn[t],s={toggle:!0,parent:""},l={toggle:"boolean",parent:"(string|element)"},d={SHOW:"show"+a,SHOWN:"shown"+a,HIDE:"hide"+a,HIDDEN:"hidden"+a,CLICK_DATA_API:"click"+a+".data-api"},c="show",u="collapse",p="collapsing",h="collapsed",m="width",f=".show, .collapsing",g='[data-toggle="collapse"]',v=function(){function a(t,i){this._isTransitioning=!1,this._element=t,this._config=this._getConfig(i),this._triggerArray=e.makeArray(e('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'));for(var a=e(g),r=0;r<a.length;r++){var o=a[r],n=D.getSelectorFromElement(o);null!==n&&e(n).filter(t).length>0&&(this._selector=n,this._triggerArray.push(o))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var n=a.prototype;return n.toggle=function(){e(this._element).hasClass(c)?this.hide():this.show()},n.show=function(){var t,r,o=this;if(!(this._isTransitioning||e(this._element).hasClass(c)||(this._parent&&0===(t=e.makeArray(e(this._parent).find(f).filter('[data-parent="'+this._config.parent+'"]'))).length&&(t=null),t&&(r=e(t).not(this._selector).data(i))&&r._isTransitioning))){var n=e.Event(d.SHOW);if(e(this._element).trigger(n),!n.isDefaultPrevented()){t&&(a._jQueryInterface.call(e(t).not(this._selector),"hide"),r||e(t).data(i,null));var s=this._getDimension();e(this._element).removeClass(u).addClass(p),this._element.style[s]=0,this._triggerArray.length>0&&e(this._triggerArray).removeClass(h).attr("aria-expanded",!0),this.setTransitioning(!0);var l=function(){e(o._element).removeClass(p).addClass(u).addClass(c),o._element.style[s]="",o.setTransitioning(!1),e(o._element).trigger(d.SHOWN)};if(D.supportsTransitionEnd()){var m="scroll"+(s[0].toUpperCase()+s.slice(1));e(this._element).one(D.TRANSITION_END,l).emulateTransitionEnd(600),this._element.style[s]=this._element[m]+"px"}else l()}}},n.hide=function(){var t=this;if(!this._isTransitioning&&e(this._element).hasClass(c)){var i=e.Event(d.HIDE);if(e(this._element).trigger(i),!i.isDefaultPrevented()){var a=this._getDimension();if(this._element.style[a]=this._element.getBoundingClientRect()[a]+"px",D.reflow(this._element),e(this._element).addClass(p).removeClass(u).removeClass(c),this._triggerArray.length>0)for(var r=0;r<this._triggerArray.length;r++){var o=this._triggerArray[r],n=D.getSelectorFromElement(o);null!==n&&(e(n).hasClass(c)||e(o).addClass(h).attr("aria-expanded",!1))}this.setTransitioning(!0);var s=function(){t.setTransitioning(!1),e(t._element).removeClass(p).addClass(u).trigger(d.HIDDEN)};this._element.style[a]="",D.supportsTransitionEnd()?e(this._element).one(D.TRANSITION_END,s).emulateTransitionEnd(600):s()}}},n.setTransitioning=function(e){this._isTransitioning=e},n.dispose=function(){e.removeData(this._element,i),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},n._getConfig=function(e){return(e=o({},s,e)).toggle=Boolean(e.toggle),D.typeCheckConfig(t,e,l),e},n._getDimension=function(){return e(this._element).hasClass(m)?m:"height"},n._getParent=function(){var t=this,i=null;D.isElement(this._config.parent)?(i=this._config.parent,void 0!==this._config.parent.jquery&&(i=this._config.parent[0])):i=e(this._config.parent)[0];var r='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]';return e(i).find(r).each(function(e,i){t._addAriaAndCollapsedClass(a._getTargetFromElement(i),[i])}),i},n._addAriaAndCollapsedClass=function(t,i){if(t){var a=e(t).hasClass(c);i.length>0&&e(i).toggleClass(h,!a).attr("aria-expanded",a)}},a._getTargetFromElement=function(t){var i=D.getSelectorFromElement(t);return i?e(i)[0]:null},a._jQueryInterface=function(t){return this.each(function(){var r=e(this),n=r.data(i),l=o({},s,r.data(),"object"==typeof t&&t);if(!n&&l.toggle&&/show|hide/.test(t)&&(l.toggle=!1),n||(n=new a(this,l),r.data(i,n)),"string"==typeof t){if(void 0===n[t])throw new TypeError('No method named "'+t+'"');n[t]()}})},r(a,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return s}}]),a}();return e(document).on(d.CLICK_DATA_API,g,function(t){"A"===t.currentTarget.tagName&&t.preventDefault();var a=e(this),r=D.getSelectorFromElement(this);e(r).each(function(){var t=e(this),r=t.data(i)?"toggle":a.data();v._jQueryInterface.call(t,r)})}),e.fn[t]=v._jQueryInterface,e.fn[t].Constructor=v,e.fn[t].noConflict=function(){return e.fn[t]=n,v._jQueryInterface},v}(t),T=function(e){var t="dropdown",a="bs.dropdown",n="."+a,s=".data-api",l=e.fn[t],d=new RegExp("38|40|27"),c={HIDE:"hide"+n,HIDDEN:"hidden"+n,SHOW:"show"+n,SHOWN:"shown"+n,CLICK:"click"+n,CLICK_DATA_API:"click"+n+s,KEYDOWN_DATA_API:"keydown"+n+s,KEYUP_DATA_API:"keyup"+n+s},u="disabled",p="show",h="dropup",m="dropdown-menu-right",f='[data-toggle="dropdown"]',g=".dropdown-menu",v={offset:0,flip:!0,boundary:"scrollParent"},A={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)"},C=function(){function s(e,t){this._element=e,this._popper=null,this._config=this._getConfig(t),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var l=s.prototype;return l.toggle=function(){if(!this._element.disabled&&!e(this._element).hasClass(u)){var t=s._getParentFromElement(this._element),a=e(this._menu).hasClass(p);if(s._clearMenus(),!a){var r={relatedTarget:this._element},o=e.Event(c.SHOW,r);if(e(t).trigger(o),!o.isDefaultPrevented()){if(!this._inNavbar){if(void 0===i)throw new TypeError("Bootstrap dropdown require Popper.js (https://popper.js.org)");var n=this._element;e(t).hasClass(h)&&(e(this._menu).hasClass("dropdown-menu-left")||e(this._menu).hasClass(m))&&(n=t),"scrollParent"!==this._config.boundary&&e(t).addClass("position-static"),this._popper=new i(n,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===e(t).closest(".navbar-nav").length&&e("body").children().on("mouseover",null,e.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),e(this._menu).toggleClass(p),e(t).toggleClass(p).trigger(e.Event(c.SHOWN,r))}}}},l.dispose=function(){e.removeData(this._element,a),e(this._element).off(n),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},l.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},l._addEventListeners=function(){var t=this;e(this._element).on(c.CLICK,function(e){e.preventDefault(),e.stopPropagation(),t.toggle()})},l._getConfig=function(i){return i=o({},this.constructor.Default,e(this._element).data(),i),D.typeCheckConfig(t,i,this.constructor.DefaultType),i},l._getMenuElement=function(){if(!this._menu){var t=s._getParentFromElement(this._element);this._menu=e(t).find(g)[0]}return this._menu},l._getPlacement=function(){var t=e(this._element).parent(),i="bottom-start";return t.hasClass(h)?(i="top-start",e(this._menu).hasClass(m)&&(i="top-end")):t.hasClass("dropright")?i="right-start":t.hasClass("dropleft")?i="left-start":e(this._menu).hasClass(m)&&(i="bottom-end"),i},l._detectNavbar=function(){return e(this._element).closest(".navbar").length>0},l._getPopperConfig=function(){var e=this,t={};return"function"==typeof this._config.offset?t.fn=function(t){return t.offsets=o({},t.offsets,e._config.offset(t.offsets)||{}),t}:t.offset=this._config.offset,{placement:this._getPlacement(),modifiers:{offset:t,flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}}},s._jQueryInterface=function(t){return this.each(function(){var i=e(this).data(a);if(i||(i=new s(this,"object"==typeof t?t:null),e(this).data(a,i)),"string"==typeof t){if(void 0===i[t])throw new TypeError('No method named "'+t+'"');i[t]()}})},s._clearMenus=function(t){if(!t||3!==t.which&&("keyup"!==t.type||9===t.which))for(var i=e.makeArray(e(f)),r=0;r<i.length;r++){var o=s._getParentFromElement(i[r]),n=e(i[r]).data(a),l={relatedTarget:i[r]};if(n){var d=n._menu;if(e(o).hasClass(p)&&!(t&&("click"===t.type&&/input|textarea/i.test(t.target.tagName)||"keyup"===t.type&&9===t.which)&&e.contains(o,t.target))){var u=e.Event(c.HIDE,l);e(o).trigger(u),u.isDefaultPrevented()||("ontouchstart"in document.documentElement&&e("body").children().off("mouseover",null,e.noop),i[r].setAttribute("aria-expanded","false"),e(d).removeClass(p),e(o).removeClass(p).trigger(e.Event(c.HIDDEN,l)))}}}},s._getParentFromElement=function(t){var i,a=D.getSelectorFromElement(t);return a&&(i=e(a)[0]),i||t.parentNode},s._dataApiKeydownHandler=function(t){if((/input|textarea/i.test(t.target.tagName)?!(32===t.which||27!==t.which&&(40!==t.which&&38!==t.which||e(t.target).closest(g).length)):d.test(t.which))&&(t.preventDefault(),t.stopPropagation(),!this.disabled&&!e(this).hasClass(u))){var i=s._getParentFromElement(this),a=e(i).hasClass(p);if((a||27===t.which&&32===t.which)&&(!a||27!==t.which&&32!==t.which)){var r=e(i).find(".dropdown-menu .dropdown-item:not(.disabled)").get();if(0!==r.length){var o=r.indexOf(t.target);38===t.which&&o>0&&o--,40===t.which&&o<r.length-1&&o++,o<0&&(o=0),r[o].focus()}}else{if(27===t.which){var n=e(i).find(f)[0];e(n).trigger("focus")}e(this).trigger("click")}}},r(s,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return v}},{key:"DefaultType",get:function(){return A}}]),s}();return e(document).on(c.KEYDOWN_DATA_API,f,C._dataApiKeydownHandler).on(c.KEYDOWN_DATA_API,g,C._dataApiKeydownHandler).on(c.CLICK_DATA_API+" "+c.KEYUP_DATA_API,C._clearMenus).on(c.CLICK_DATA_API,f,function(t){t.preventDefault(),t.stopPropagation(),C._jQueryInterface.call(e(this),"toggle")}).on(c.CLICK_DATA_API,".dropdown form",function(e){e.stopPropagation()}),e.fn[t]=C._jQueryInterface,e.fn[t].Constructor=C,e.fn[t].noConflict=function(){return e.fn[t]=l,C._jQueryInterface},C}(t),B=function(e){var t="bs.modal",i="."+t,a=e.fn.modal,n={backdrop:!0,keyboard:!0,focus:!0,show:!0},s={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},l={HIDE:"hide"+i,HIDDEN:"hidden"+i,SHOW:"show"+i,SHOWN:"shown"+i,FOCUSIN:"focusin"+i,RESIZE:"resize"+i,CLICK_DISMISS:"click.dismiss"+i,KEYDOWN_DISMISS:"keydown.dismiss"+i,MOUSEUP_DISMISS:"mouseup.dismiss"+i,MOUSEDOWN_DISMISS:"mousedown.dismiss"+i,CLICK_DATA_API:"click"+i+".data-api"},d="modal-open",c="fade",u="show",p=".modal-dialog",h='[data-toggle="modal"]',m='[data-dismiss="modal"]',f=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",g=".sticky-top",v=".navbar-toggler",A=function(){function a(t,i){this._config=this._getConfig(i),this._element=t,this._dialog=e(t).find(p)[0],this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._originalBodyPadding=0,this._scrollbarWidth=0}var h=a.prototype;return h.toggle=function(e){return this._isShown?this.hide():this.show(e)},h.show=function(t){var i=this;if(!this._isTransitioning&&!this._isShown){D.supportsTransitionEnd()&&e(this._element).hasClass(c)&&(this._isTransitioning=!0);var a=e.Event(l.SHOW,{relatedTarget:t});e(this._element).trigger(a),this._isShown||a.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),e(document.body).addClass(d),this._setEscapeEvent(),this._setResizeEvent(),e(this._element).on(l.CLICK_DISMISS,m,function(e){return i.hide(e)}),e(this._dialog).on(l.MOUSEDOWN_DISMISS,function(){e(i._element).one(l.MOUSEUP_DISMISS,function(t){e(t.target).is(i._element)&&(i._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return i._showElement(t)}))}},h.hide=function(t){var i=this;if(t&&t.preventDefault(),!this._isTransitioning&&this._isShown){var a=e.Event(l.HIDE);if(e(this._element).trigger(a),this._isShown&&!a.isDefaultPrevented()){this._isShown=!1;var r=D.supportsTransitionEnd()&&e(this._element).hasClass(c);r&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),e(document).off(l.FOCUSIN),e(this._element).removeClass(u),e(this._element).off(l.CLICK_DISMISS),e(this._dialog).off(l.MOUSEDOWN_DISMISS),r?e(this._element).one(D.TRANSITION_END,function(e){return i._hideModal(e)}).emulateTransitionEnd(300):this._hideModal()}}},h.dispose=function(){e.removeData(this._element,t),e(window,document,this._element,this._backdrop).off(i),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._scrollbarWidth=null},h.handleUpdate=function(){this._adjustDialog()},h._getConfig=function(e){return e=o({},n,e),D.typeCheckConfig("modal",e,s),e},h._showElement=function(t){var i=this,a=D.supportsTransitionEnd()&&e(this._element).hasClass(c);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.scrollTop=0,a&&D.reflow(this._element),e(this._element).addClass(u),this._config.focus&&this._enforceFocus();var r=e.Event(l.SHOWN,{relatedTarget:t}),o=function(){i._config.focus&&i._element.focus(),i._isTransitioning=!1,e(i._element).trigger(r)};a?e(this._dialog).one(D.TRANSITION_END,o).emulateTransitionEnd(300):o()},h._enforceFocus=function(){var t=this;e(document).off(l.FOCUSIN).on(l.FOCUSIN,function(i){document!==i.target&&t._element!==i.target&&0===e(t._element).has(i.target).length&&t._element.focus()})},h._setEscapeEvent=function(){var t=this;this._isShown&&this._config.keyboard?e(this._element).on(l.KEYDOWN_DISMISS,function(e){27===e.which&&(e.preventDefault(),t.hide())}):this._isShown||e(this._element).off(l.KEYDOWN_DISMISS)},h._setResizeEvent=function(){var t=this;this._isShown?e(window).on(l.RESIZE,function(e){return t.handleUpdate(e)}):e(window).off(l.RESIZE)},h._hideModal=function(){var t=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1,this._showBackdrop(function(){e(document.body).removeClass(d),t._resetAdjustments(),t._resetScrollbar(),e(t._element).trigger(l.HIDDEN)})},h._removeBackdrop=function(){this._backdrop&&(e(this._backdrop).remove(),this._backdrop=null)},h._showBackdrop=function(t){var i=this,a=e(this._element).hasClass(c)?c:"";if(this._isShown&&this._config.backdrop){var r=D.supportsTransitionEnd()&&a;if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",a&&e(this._backdrop).addClass(a),e(this._backdrop).appendTo(document.body),e(this._element).on(l.CLICK_DISMISS,function(e){i._ignoreBackdropClick?i._ignoreBackdropClick=!1:e.target===e.currentTarget&&("static"===i._config.backdrop?i._element.focus():i.hide())}),r&&D.reflow(this._backdrop),e(this._backdrop).addClass(u),!t)return;if(!r)return void t();e(this._backdrop).one(D.TRANSITION_END,t).emulateTransitionEnd(150)}else if(!this._isShown&&this._backdrop){e(this._backdrop).removeClass(u);var o=function(){i._removeBackdrop(),t&&t()};D.supportsTransitionEnd()&&e(this._element).hasClass(c)?e(this._backdrop).one(D.TRANSITION_END,o).emulateTransitionEnd(150):o()}else t&&t()},h._adjustDialog=function(){var e=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},h._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},h._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=e.left+e.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},h._setScrollbar=function(){var t=this;if(this._isBodyOverflowing){e(f).each(function(i,a){var r=e(a)[0].style.paddingRight,o=e(a).css("padding-right");e(a).data("padding-right",r).css("padding-right",parseFloat(o)+t._scrollbarWidth+"px")}),e(g).each(function(i,a){var r=e(a)[0].style.marginRight,o=e(a).css("margin-right");e(a).data("margin-right",r).css("margin-right",parseFloat(o)-t._scrollbarWidth+"px")}),e(v).each(function(i,a){var r=e(a)[0].style.marginRight,o=e(a).css("margin-right");e(a).data("margin-right",r).css("margin-right",parseFloat(o)+t._scrollbarWidth+"px")});var i=document.body.style.paddingRight,a=e("body").css("padding-right");e("body").data("padding-right",i).css("padding-right",parseFloat(a)+this._scrollbarWidth+"px")}},h._resetScrollbar=function(){e(f).each(function(t,i){var a=e(i).data("padding-right");void 0!==a&&e(i).css("padding-right",a).removeData("padding-right")}),e(g+", "+v).each(function(t,i){var a=e(i).data("margin-right");void 0!==a&&e(i).css("margin-right",a).removeData("margin-right")});var t=e("body").data("padding-right");void 0!==t&&e("body").css("padding-right",t).removeData("padding-right")},h._getScrollbarWidth=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",document.body.appendChild(e);var t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},a._jQueryInterface=function(i,r){return this.each(function(){var n=e(this).data(t),s=o({},a.Default,e(this).data(),"object"==typeof i&&i);if(n||(n=new a(this,s),e(this).data(t,n)),"string"==typeof i){if(void 0===n[i])throw new TypeError('No method named "'+i+'"');n[i](r)}else s.show&&n.show(r)})},r(a,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return n}}]),a}();return e(document).on(l.CLICK_DATA_API,h,function(i){var a,r=this,n=D.getSelectorFromElement(this);n&&(a=e(n)[0]);var s=e(a).data(t)?"toggle":o({},e(a).data(),e(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||i.preventDefault();var d=e(a).one(l.SHOW,function(t){t.isDefaultPrevented()||d.one(l.HIDDEN,function(){e(r).is(":visible")&&r.focus()})});A._jQueryInterface.call(e(a),s,this)}),e.fn.modal=A._jQueryInterface,e.fn.modal.Constructor=A,e.fn.modal.noConflict=function(){return e.fn.modal=a,A._jQueryInterface},A}(t),x=function(e){var t="tooltip",a="bs.tooltip",n="."+a,s=e.fn[t],l=new RegExp("(^|\\s)bs-tooltip\\S+","g"),d={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"},c={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},u={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},p="show",h="out",m={HIDE:"hide"+n,HIDDEN:"hidden"+n,SHOW:"show"+n,SHOWN:"shown"+n,INSERTED:"inserted"+n,CLICK:"click"+n,FOCUSIN:"focusin"+n,FOCUSOUT:"focusout"+n,MOUSEENTER:"mouseenter"+n,MOUSELEAVE:"mouseleave"+n},f="fade",g="show",v="hover",A="focus",C=function(){function s(e,t){if(void 0===i)throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=e,this.config=this._getConfig(t),this.tip=null,this._setListeners()}var C=s.prototype;return C.enable=function(){this._isEnabled=!0},C.disable=function(){this._isEnabled=!1},C.toggleEnabled=function(){this._isEnabled=!this._isEnabled},C.toggle=function(t){if(this._isEnabled)if(t){var i=this.constructor.DATA_KEY,a=e(t.currentTarget).data(i);a||(a=new this.constructor(t.currentTarget,this._getDelegateConfig()),e(t.currentTarget).data(i,a)),a._activeTrigger.click=!a._activeTrigger.click,a._isWithActiveTrigger()?a._enter(null,a):a._leave(null,a)}else{if(e(this.getTipElement()).hasClass(g))return void this._leave(null,this);this._enter(null,this)}},C.dispose=function(){clearTimeout(this._timeout),e.removeData(this.element,this.constructor.DATA_KEY),e(this.element).off(this.constructor.EVENT_KEY),e(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&e(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,null!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},C.show=function(){var t=this;if("none"===e(this.element).css("display"))throw new Error("Please use show on visible elements");var a=e.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){e(this.element).trigger(a);var r=e.contains(this.element.ownerDocument.documentElement,this.element);if(a.isDefaultPrevented()||!r)return;var o=this.getTipElement(),n=D.getUID(this.constructor.NAME);o.setAttribute("id",n),this.element.setAttribute("aria-describedby",n),this.setContent(),this.config.animation&&e(o).addClass(f);var l="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,d=this._getAttachment(l);this.addAttachmentClass(d);var c=!1===this.config.container?document.body:e(this.config.container);e(o).data(this.constructor.DATA_KEY,this),e.contains(this.element.ownerDocument.documentElement,this.tip)||e(o).appendTo(c),e(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new i(this.element,o,{placement:d,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(e){e.originalPlacement!==e.placement&&t._handlePopperPlacementChange(e)},onUpdate:function(e){t._handlePopperPlacementChange(e)}}),e(o).addClass(g),"ontouchstart"in document.documentElement&&e("body").children().on("mouseover",null,e.noop);var u=function(){t.config.animation&&t._fixTransition();var i=t._hoverState;t._hoverState=null,e(t.element).trigger(t.constructor.Event.SHOWN),i===h&&t._leave(null,t)};D.supportsTransitionEnd()&&e(this.tip).hasClass(f)?e(this.tip).one(D.TRANSITION_END,u).emulateTransitionEnd(s._TRANSITION_DURATION):u()}},C.hide=function(t){var i=this,a=this.getTipElement(),r=e.Event(this.constructor.Event.HIDE),o=function(){i._hoverState!==p&&a.parentNode&&a.parentNode.removeChild(a),i._cleanTipClass(),i.element.removeAttribute("aria-describedby"),e(i.element).trigger(i.constructor.Event.HIDDEN),null!==i._popper&&i._popper.destroy(),t&&t()};e(this.element).trigger(r),r.isDefaultPrevented()||(e(a).removeClass(g),"ontouchstart"in document.documentElement&&e("body").children().off("mouseover",null,e.noop),this._activeTrigger.click=!1,this._activeTrigger[A]=!1,this._activeTrigger[v]=!1,D.supportsTransitionEnd()&&e(this.tip).hasClass(f)?e(a).one(D.TRANSITION_END,o).emulateTransitionEnd(150):o(),this._hoverState="")},C.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},C.isWithContent=function(){return Boolean(this.getTitle())},C.addAttachmentClass=function(t){e(this.getTipElement()).addClass("bs-tooltip-"+t)},C.getTipElement=function(){return this.tip=this.tip||e(this.config.template)[0],this.tip},C.setContent=function(){var t=e(this.getTipElement());this.setElementContent(t.find(".tooltip-inner"),this.getTitle()),t.removeClass(f+" "+g)},C.setElementContent=function(t,i){var a=this.config.html;"object"==typeof i&&(i.nodeType||i.jquery)?a?e(i).parent().is(t)||t.empty().append(i):t.text(e(i).text()):t[a?"html":"text"](i)},C.getTitle=function(){var e=this.element.getAttribute("data-original-title");return e||(e="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),e},C._getAttachment=function(e){return c[e.toUpperCase()]},C._setListeners=function(){var t=this;this.config.trigger.split(" ").forEach(function(i){if("click"===i)e(t.element).on(t.constructor.Event.CLICK,t.config.selector,function(e){return t.toggle(e)});else if("manual"!==i){var a=i===v?t.constructor.Event.MOUSEENTER:t.constructor.Event.FOCUSIN,r=i===v?t.constructor.Event.MOUSELEAVE:t.constructor.Event.FOCUSOUT;e(t.element).on(a,t.config.selector,function(e){return t._enter(e)}).on(r,t.config.selector,function(e){return t._leave(e)})}e(t.element).closest(".modal").on("hide.bs.modal",function(){return t.hide()})}),this.config.selector?this.config=o({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},C._fixTitle=function(){var e=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==e)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},C._enter=function(t,i){var a=this.constructor.DATA_KEY;(i=i||e(t.currentTarget).data(a))||(i=new this.constructor(t.currentTarget,this._getDelegateConfig()),e(t.currentTarget).data(a,i)),t&&(i._activeTrigger["focusin"===t.type?A:v]=!0),e(i.getTipElement()).hasClass(g)||i._hoverState===p?i._hoverState=p:(clearTimeout(i._timeout),i._hoverState=p,i.config.delay&&i.config.delay.show?i._timeout=setTimeout(function(){i._hoverState===p&&i.show()},i.config.delay.show):i.show())},C._leave=function(t,i){var a=this.constructor.DATA_KEY;(i=i||e(t.currentTarget).data(a))||(i=new this.constructor(t.currentTarget,this._getDelegateConfig()),e(t.currentTarget).data(a,i)),t&&(i._activeTrigger["focusout"===t.type?A:v]=!1),i._isWithActiveTrigger()||(clearTimeout(i._timeout),i._hoverState=h,i.config.delay&&i.config.delay.hide?i._timeout=setTimeout(function(){i._hoverState===h&&i.hide()},i.config.delay.hide):i.hide())},C._isWithActiveTrigger=function(){for(var e in this._activeTrigger)if(this._activeTrigger[e])return!0;return!1},C._getConfig=function(i){return"number"==typeof(i=o({},this.constructor.Default,e(this.element).data(),i)).delay&&(i.delay={show:i.delay,hide:i.delay}),"number"==typeof i.title&&(i.title=i.title.toString()),"number"==typeof i.content&&(i.content=i.content.toString()),D.typeCheckConfig(t,i,this.constructor.DefaultType),i},C._getDelegateConfig=function(){var e={};if(this.config)for(var t in this.config)this.constructor.Default[t]!==this.config[t]&&(e[t]=this.config[t]);return e},C._cleanTipClass=function(){var t=e(this.getTipElement()),i=t.attr("class").match(l);null!==i&&i.length>0&&t.removeClass(i.join(""))},C._handlePopperPlacementChange=function(e){this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(e.placement))},C._fixTransition=function(){var t=this.getTipElement(),i=this.config.animation;null===t.getAttribute("x-placement")&&(e(t).removeClass(f),this.config.animation=!1,this.hide(),this.show(),this.config.animation=i)},s._jQueryInterface=function(t){return this.each(function(){var i=e(this).data(a),r="object"==typeof t&&t;if((i||!/dispose|hide/.test(t))&&(i||(i=new s(this,r),e(this).data(a,i)),"string"==typeof t)){if(void 0===i[t])throw new TypeError('No method named "'+t+'"');i[t]()}})},r(s,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return u}},{key:"NAME",get:function(){return t}},{key:"DATA_KEY",get:function(){return a}},{key:"Event",get:function(){return m}},{key:"EVENT_KEY",get:function(){return n}},{key:"DefaultType",get:function(){return d}}]),s}();return e.fn[t]=C._jQueryInterface,e.fn[t].Constructor=C,e.fn[t].noConflict=function(){return e.fn[t]=s,C._jQueryInterface},C}(t),F=function(e){var t="popover",i="bs.popover",a="."+i,n=e.fn[t],s=new RegExp("(^|\\s)bs-popover\\S+","g"),l=o({},x.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),d=o({},x.DefaultType,{content:"(string|element|function)"}),c={HIDE:"hide"+a,HIDDEN:"hidden"+a,SHOW:"show"+a,SHOWN:"shown"+a,INSERTED:"inserted"+a,CLICK:"click"+a,FOCUSIN:"focusin"+a,FOCUSOUT:"focusout"+a,MOUSEENTER:"mouseenter"+a,MOUSELEAVE:"mouseleave"+a},u=function(o){var n,u;function p(){return o.apply(this,arguments)||this}u=o,(n=p).prototype=Object.create(u.prototype),n.prototype.constructor=n,n.__proto__=u;var h=p.prototype;return h.isWithContent=function(){return this.getTitle()||this._getContent()},h.addAttachmentClass=function(t){e(this.getTipElement()).addClass("bs-popover-"+t)},h.getTipElement=function(){return this.tip=this.tip||e(this.config.template)[0],this.tip},h.setContent=function(){var t=e(this.getTipElement());this.setElementContent(t.find(".popover-header"),this.getTitle());var i=this._getContent();"function"==typeof i&&(i=i.call(this.element)),this.setElementContent(t.find(".popover-body"),i),t.removeClass("fade show")},h._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},h._cleanTipClass=function(){var t=e(this.getTipElement()),i=t.attr("class").match(s);null!==i&&i.length>0&&t.removeClass(i.join(""))},p._jQueryInterface=function(t){return this.each(function(){var a=e(this).data(i),r="object"==typeof t?t:null;if((a||!/destroy|hide/.test(t))&&(a||(a=new p(this,r),e(this).data(i,a)),"string"==typeof t)){if(void 0===a[t])throw new TypeError('No method named "'+t+'"');a[t]()}})},r(p,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return l}},{key:"NAME",get:function(){return t}},{key:"DATA_KEY",get:function(){return i}},{key:"Event",get:function(){return c}},{key:"EVENT_KEY",get:function(){return a}},{key:"DefaultType",get:function(){return d}}]),p}(x);return e.fn[t]=u._jQueryInterface,e.fn[t].Constructor=u,e.fn[t].noConflict=function(){return e.fn[t]=n,u._jQueryInterface},u}(t),O=function(e){var t="scrollspy",i="bs.scrollspy",a="."+i,n=e.fn[t],s={offset:10,method:"auto",target:""},l={offset:"number",method:"string",target:"(string|element)"},d={ACTIVATE:"activate"+a,SCROLL:"scroll"+a,LOAD_DATA_API:"load"+a+".data-api"},c="active",u='[data-spy="scroll"]',p=".active",h=".nav, .list-group",m=".nav-link",f=".nav-item",g=".list-group-item",v=".dropdown",A=".dropdown-item",C=".dropdown-toggle",y="position",b=function(){function n(t,i){var a=this;this._element=t,this._scrollElement="BODY"===t.tagName?window:t,this._config=this._getConfig(i),this._selector=this._config.target+" "+m+","+this._config.target+" "+g+","+this._config.target+" "+A,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,e(this._scrollElement).on(d.SCROLL,function(e){return a._process(e)}),this.refresh(),this._process()}var u=n.prototype;return u.refresh=function(){var t=this,i=this._scrollElement===this._scrollElement.window?"offset":y,a="auto"===this._config.method?i:this._config.method,r=a===y?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),e.makeArray(e(this._selector)).map(function(t){var i,o=D.getSelectorFromElement(t);if(o&&(i=e(o)[0]),i){var n=i.getBoundingClientRect();if(n.width||n.height)return[e(i)[a]().top+r,o]}return null}).filter(function(e){return e}).sort(function(e,t){return e[0]-t[0]}).forEach(function(e){t._offsets.push(e[0]),t._targets.push(e[1])})},u.dispose=function(){e.removeData(this._element,i),e(this._scrollElement).off(a),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},u._getConfig=function(i){if("string"!=typeof(i=o({},s,i)).target){var a=e(i.target).attr("id");a||(a=D.getUID(t),e(i.target).attr("id",a)),i.target="#"+a}return D.typeCheckConfig(t,i,l),i},u._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},u._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},u._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},u._process=function(){var e=this._getScrollTop()+this._config.offset,t=this._getScrollHeight(),i=this._config.offset+t-this._getOffsetHeight();if(this._scrollHeight!==t&&this.refresh(),e>=i){var a=this._targets[this._targets.length-1];this._activeTarget!==a&&this._activate(a)}else{if(this._activeTarget&&e<this._offsets[0]&&this._offsets[0]>0)return this._activeTarget=null,void this._clear();for(var r=this._offsets.length;r--;)this._activeTarget!==this._targets[r]&&e>=this._offsets[r]&&(void 0===this._offsets[r+1]||e<this._offsets[r+1])&&this._activate(this._targets[r])}},u._activate=function(t){this._activeTarget=t,this._clear();var i=this._selector.split(",");i=i.map(function(e){return e+'[data-target="'+t+'"],'+e+'[href="'+t+'"]'});var a=e(i.join(","));a.hasClass("dropdown-item")?(a.closest(v).find(C).addClass(c),a.addClass(c)):(a.addClass(c),a.parents(h).prev(m+", "+g).addClass(c),a.parents(h).prev(f).children(m).addClass(c)),e(this._scrollElement).trigger(d.ACTIVATE,{relatedTarget:t})},u._clear=function(){e(this._selector).filter(p).removeClass(c)},n._jQueryInterface=function(t){return this.each(function(){var a=e(this).data(i);if(a||(a=new n(this,"object"==typeof t&&t),e(this).data(i,a)),"string"==typeof t){if(void 0===a[t])throw new TypeError('No method named "'+t+'"');a[t]()}})},r(n,null,[{key:"VERSION",get:function(){return"4.0.0"}},{key:"Default",get:function(){return s}}]),n}();return e(window).on(d.LOAD_DATA_API,function(){for(var t=e.makeArray(e(u)),i=t.length;i--;){var a=e(t[i]);b._jQueryInterface.call(a,a.data())}}),e.fn[t]=b._jQueryInterface,e.fn[t].Constructor=b,e.fn[t].noConflict=function(){return e.fn[t]=n,b._jQueryInterface},b}(t),M=function(e){var t="bs.tab",i="."+t,a=e.fn.tab,o={HIDE:"hide"+i,HIDDEN:"hidden"+i,SHOW:"show"+i,SHOWN:"shown"+i,CLICK_DATA_API:"click.bs.tab.data-api"},n="active",s="show",l=".active",d="> li > .active",c=function(){function i(e){this._element=e}var a=i.prototype;return a.show=function(){var t=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&e(this._element).hasClass(n)||e(this._element).hasClass("disabled"))){var i,a,r=e(this._element).closest(".nav, .list-group")[0],s=D.getSelectorFromElement(this._element);if(r){var c="UL"===r.nodeName?d:l;a=(a=e.makeArray(e(r).find(c)))[a.length-1]}var u=e.Event(o.HIDE,{relatedTarget:this._element}),p=e.Event(o.SHOW,{relatedTarget:a});if(a&&e(a).trigger(u),e(this._element).trigger(p),!p.isDefaultPrevented()&&!u.isDefaultPrevented()){s&&(i=e(s)[0]),this._activate(this._element,r);var h=function(){var i=e.Event(o.HIDDEN,{relatedTarget:t._element}),r=e.Event(o.SHOWN,{relatedTarget:a});e(a).trigger(i),e(t._element).trigger(r)};i?this._activate(i,i.parentNode,h):h()}}},a.dispose=function(){e.removeData(this._element,t),this._element=null},a._activate=function(t,i,a){var r=this,o=("UL"===i.nodeName?e(i).find(d):e(i).children(l))[0],n=a&&D.supportsTransitionEnd()&&o&&e(o).hasClass("fade"),s=function(){return r._transitionComplete(t,o,a)};o&&n?e(o).one(D.TRANSITION_END,s).emulateTransitionEnd(150):s()},a._transitionComplete=function(t,i,a){if(i){e(i).removeClass(s+" "+n);var r=e(i.parentNode).find("> .dropdown-menu .active")[0];r&&e(r).removeClass(n),"tab"===i.getAttribute("role")&&i.setAttribute("aria-selected",!1)}if(e(t).addClass(n),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),D.reflow(t),e(t).addClass(s),t.parentNode&&e(t.parentNode).hasClass("dropdown-menu")){var o=e(t).closest(".dropdown")[0];o&&e(o).find(".dropdown-toggle").addClass(n),t.setAttribute("aria-expanded",!0)}a&&a()},i._jQueryInterface=function(a){return this.each(function(){var r=e(this),o=r.data(t);if(o||(o=new i(this),r.data(t,o)),"string"==typeof a){if(void 0===o[a])throw new TypeError('No method named "'+a+'"');o[a]()}})},r(i,null,[{key:"VERSION",get:function(){return"4.0.0"}}]),i}();return e(document).on(o.CLICK_DATA_API,'[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',function(t){t.preventDefault(),c._jQueryInterface.call(e(this),"show")}),e.fn.tab=c._jQueryInterface,e.fn.tab.Constructor=c,e.fn.tab.noConflict=function(){return e.fn.tab=a,c._jQueryInterface},c}(t);!function(e){if(void 0===e)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1===t[0]&&9===t[1]&&t[2]<1||t[0]>=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}(t),e.Util=D,e.Alert=_,e.Button=I,e.Carousel=w,e.Collapse=P,e.Dropdown=T,e.Modal=B,e.Popover=F,e.Scrollspy=O,e.Tab=M,e.Tooltip=x,Object.defineProperty(e,"__esModule",{value:!0})}),function(e,t){"use strict";e.fn.rating=function(i){this.each(function(){var a=e(this),r=e.extend({},a.data(),i);r.start=parseInt(r.start,10)||t,r.stop=parseInt(r.stop,10)||r.start+5||t,r.step=parseInt(r.step,10)||t,r=e.extend({},e.fn.rating.defaults,r);for(var o=function(e){var t=d.children();t.eq(e).prevAll(".rating-symbol").addBack().removeClass(r.empty).addClass(r.filled),t.eq(e).nextAll(".rating-symbol").removeClass(r.filled).addClass(r.empty)},n=function(e){return Math.max(Math.ceil((e-r.start)/r.step),0)},s=function(e){var t=parseInt(e,10);(function(e){var t=r.step>0?r.start:r.stop,i=r.step>0?r.stop-1:r.start+1;return e>=t&&i>=e&&(r.start+e)%r.step===0})(t)&&o(n(t))},l=function(e){return function(){a.prop("disabled")||a.prop("readonly")||e.call(this)}},d=e("<div></div>").insertBefore(a),c=0;c<n(r.stop);c++)d.append('<div class="rating-symbol '+r.empty+'"></div>');s(a.val()),a.on("change",function(){s(e(this).val())}),d.on("click",".rating-symbol",l(function(){a.val(function(e){return r.start+e*r.step}(e(this).index())).change()})).on("mouseenter",".rating-symbol",l(function(){o(e(this).index())})).on("mouseleave",".rating-symbol",l(function(){o(n(a.val()))}))})},e.fn.rating.defaults={filled:"glyphicon glyphicon-star",empty:"glyphicon glyphicon-star-empty",start:0,stop:5,step:1},e(function(){e("input.rating").rating()})}(jQuery),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e;function t(){return e.apply(null,arguments)}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function a(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(r(e,t))return;return 1}function n(e){return void 0===e}function s(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function l(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var i=[],a=e.length,r=0;r<a;++r)i.push(t(e[r],r));return i}function c(e,t){for(var i in t)r(t,i)&&(e[i]=t[i]);return r(t,"toString")&&(e.toString=t.toString),r(t,"valueOf")&&(e.valueOf=t.valueOf),e}function u(e,t,i,a){return It(e,t,i,a,!0).utc()}function p(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function h(e){if(null==e._isValid){var t=p(e),i=f.call(t.parsedDateParts,function(e){return null!=e});i=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&i);if(e._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function m(e){var t=u(NaN);return null!=e?c(p(t),e):p(t).userInvalidated=!0,t}var f=Array.prototype.some||function(e){for(var t=Object(this),i=t.length>>>0,a=0;a<i;a++)if(a in t&&e.call(this,t[a],a,t))return!0;return!1},g=t.momentProperties=[],v=!1;function A(e,t){var i,a,r,o=g.length;if(n(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),n(t._i)||(e._i=t._i),n(t._f)||(e._f=t._f),n(t._l)||(e._l=t._l),n(t._strict)||(e._strict=t._strict),n(t._tzm)||(e._tzm=t._tzm),n(t._isUTC)||(e._isUTC=t._isUTC),n(t._offset)||(e._offset=t._offset),n(t._pf)||(e._pf=p(t)),n(t._locale)||(e._locale=t._locale),0<o)for(i=0;i<o;i++)n(r=t[a=g[i]])||(e[a]=r);return e}function C(e){A(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,t.updateOffset(this),v=!1)}function y(e){return e instanceof C||null!=e&&null!=e._isAMomentObject}function b(e){!1===t.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function S(e,i){var a=!0;return c(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),a){for(var o,n,s=[],l=arguments.length,d=0;d<l;d++){if(o="","object"==typeof arguments[d]){for(n in o+="\n["+d+"] ",arguments[0])r(arguments[0],n)&&(o+=n+": "+arguments[0][n]+", ");o=o.slice(0,-2)}else o=arguments[d];s.push(o)}b(e+"\nArguments: "+Array.prototype.slice.call(s).join("")+"\n"+(new Error).stack),a=!1}return i.apply(this,arguments)},i)}var k={};function D(e,i){null!=t.deprecationHandler&&t.deprecationHandler(e,i),k[e]||(b(i),k[e]=!0)}function _(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function I(e,t){var i,o=c({},e);for(i in t)r(t,i)&&(a(e[i])&&a(t[i])?(o[i]={},c(o[i],e[i]),c(o[i],t[i])):null!=t[i]?o[i]=t[i]:delete o[i]);for(i in e)r(e,i)&&!r(t,i)&&a(e[i])&&(o[i]=c({},o[i]));return o}function w(e){null!=e&&this.set(e)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var P=Object.keys||function(e){var t,i=[];for(t in e)r(e,t)&&i.push(t);return i};function T(e,t,i){var a=""+Math.abs(e);return(0<=e?i?"+":"":"-")+Math.pow(10,Math.max(0,t-a.length)).toString().substr(1)+a}var B=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,x=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,F={},O={};function M(e,t,i,a){var r="string"==typeof a?function(){return this[a]()}:a;e&&(O[e]=r),t&&(O[t[0]]=function(){return T(r.apply(this,arguments),t[1],t[2])}),i&&(O[i]=function(){return this.localeData().ordinal(r.apply(this,arguments),e)})}function E(e,t){return e.isValid()?(t=$(t,e.localeData()),F[t]=F[t]||function(e){for(var t,i=e.match(B),a=0,r=i.length;a<r;a++)O[i[a]]?i[a]=O[i[a]]:i[a]=(t=i[a]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){for(var a="",o=0;o<r;o++)a+=_(i[o])?i[o].call(t,e):i[o];return a}}(t),F[t](e)):e.localeData().invalidDate()}function $(e,t){var i=5;function a(e){return t.longDateFormat(e)||e}for(x.lastIndex=0;0<=i&&x.test(e);)e=e.replace(x,a),x.lastIndex=0,--i;return e}var N={};function L(e,t){var i=e.toLowerCase();N[i]=N[i+"s"]=N[t]=e}function U(e){return"string"==typeof e?N[e]||N[e.toLowerCase()]:void 0}function R(e){var t,i,a={};for(i in e)r(e,i)&&(t=U(i))&&(a[t]=e[i]);return a}var G={};function W(e,t){G[e]=t}function V(e){return e%4==0&&e%100!=0||e%400==0}function j(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function H(e){var t=0;return 0!=(e=+e)&&isFinite(e)?j(e):t}function Y(e,i){return function(a){return null!=a?(z(this,e,a),t.updateOffset(this,i),this):Z(this,e)}}function Z(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function z(e,t,i){e.isValid()&&!isNaN(i)&&("FullYear"===t&&V(e.year())&&1===e.month()&&29===e.date()?(i=H(i),e._d["set"+(e._isUTC?"UTC":"")+t](i,e.month(),Pe(i,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](i))}var X=/\d/,q=/\d\d/,J=/\d{3}/,Q=/\d{4}/,K=/[+-]?\d{6}/,ee=/\d\d?/,te=/\d\d\d\d?/,ie=/\d\d\d\d\d\d?/,ae=/\d{1,3}/,re=/\d{1,4}/,oe=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,le=/Z|[+-]\d\d:?\d\d/gi,de=/Z|[+-]\d\d(?::?\d\d)?/gi,ce=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function ue(e,t,i){me[e]=_(t)?t:function(e,a){return e&&i?i:t}}function pe(e,t){return r(me,e)?me[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,a,r){return t||i||a||r})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var me={},fe={};function ge(e,t){var i,a,r=t;for("string"==typeof e&&(e=[e]),s(t)&&(r=function(e,i){i[t]=H(e)}),a=e.length,i=0;i<a;i++)fe[e[i]]=r}function ve(e,t){ge(e,function(e,i,a,r){a._w=a._w||{},t(e,a._w,a,r)})}var Ae,Ce=0,ye=1,be=2,Se=3,ke=4,De=5,_e=6,Ie=7,we=8;function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var i=(t%(i=12)+i)%i;return e+=(t-i)/12,1==i?V(e)?29:28:31-i%7%2}Ae=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},M("M",["MM",2],"Mo",function(){return this.month()+1}),M("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),M("MMMM",0,0,function(e){return this.localeData().months(this,e)}),L("month","M"),W("month",8),ue("M",ee),ue("MM",ee,q),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ge(["M","MM"],function(e,t){t[ye]=H(e)-1}),ge(["MMM","MMMM"],function(e,t,i,a){null!=(a=i._locale.monthsParse(e,a,i._strict))?t[ye]=a:p(i).invalidMonth=e});var Te="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Be="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),xe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Fe=ce,Oe=ce;function Me(e,t){var i;if(e.isValid()){if("string"==typeof t)if(/^\d+$/.test(t))t=H(t);else if(!s(t=e.localeData().monthsParse(t)))return;i=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,i)}}function Ee(e){return null!=e?(Me(this,e),t.updateOffset(this,!0),this):Z(this,"Month")}function $e(){function e(e,t){return t.length-e.length}for(var t,i=[],a=[],r=[],o=0;o<12;o++)t=u([2e3,o]),i.push(this.monthsShort(t,"")),a.push(this.months(t,"")),r.push(this.months(t,"")),r.push(this.monthsShort(t,""));for(i.sort(e),a.sort(e),r.sort(e),o=0;o<12;o++)i[o]=he(i[o]),a[o]=he(a[o]);for(o=0;o<24;o++)r[o]=he(r[o]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function Ne(e){return V(e)?366:365}M("Y",0,0,function(){var e=this.year();return e<=9999?T(e,4):"+"+e}),M(0,["YY",2],0,function(){return this.year()%100}),M(0,["YYYY",4],0,"year"),M(0,["YYYYY",5],0,"year"),M(0,["YYYYYY",6,!0],0,"year"),L("year","y"),W("year",1),ue("Y",se),ue("YY",ee,q),ue("YYYY",re,Q),ue("YYYYY",oe,K),ue("YYYYYY",oe,K),ge(["YYYYY","YYYYYY"],Ce),ge("YYYY",function(e,i){i[Ce]=2===e.length?t.parseTwoDigitYear(e):H(e)}),ge("YY",function(e,i){i[Ce]=t.parseTwoDigitYear(e)}),ge("Y",function(e,t){t[Ce]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return H(e)+(68<H(e)?1900:2e3)};var Le=Y("FullYear",!0);function Ue(e,t,i,a,r,o,n){var s;return e<100&&0<=e?(s=new Date(e+400,t,i,a,r,o,n),isFinite(s.getFullYear())&&s.setFullYear(e)):s=new Date(e,t,i,a,r,o,n),s}function Re(e){var t;return e<100&&0<=e?((t=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,t)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ge(e,t,i){return(i=7+t-i)-(7+Re(e,0,i).getUTCDay()-t)%7-1}function We(e,t,i,a,r){var o;i=(t=1+7*(t-1)+(7+i-a)%7+Ge(e,a,r))<=0?Ne(o=e-1)+t:t>Ne(e)?(o=e+1,t-Ne(e)):(o=e,t);return{year:o,dayOfYear:i}}function Ve(e,t,i){var a,r,o=Ge(e.year(),t,i);return(o=Math.floor((e.dayOfYear()-o-1)/7)+1)<1?a=o+je(r=e.year()-1,t,i):o>je(e.year(),t,i)?(a=o-je(e.year(),t,i),r=e.year()+1):(r=e.year(),a=o),{week:a,year:r}}function je(e,t,i){var a=Ge(e,t,i);t=Ge(e+1,t,i);return(Ne(e)-a+t)/7}function He(e,t){return e.slice(t,7).concat(e.slice(0,t))}M("w",["ww",2],"wo","week"),M("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),W("week",5),W("isoWeek",5),ue("w",ee),ue("ww",ee,q),ue("W",ee),ue("WW",ee,q),ve(["w","ww","W","WW"],function(e,t,i,a){t[a.substr(0,1)]=H(e)}),M("d",0,"do","day"),M("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),M("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),M("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),M("e",0,0,"weekday"),M("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),W("day",11),W("weekday",11),W("isoWeekday",11),ue("d",ee),ue("e",ee),ue("E",ee),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),ve(["dd","ddd","dddd"],function(e,t,i,a){null!=(a=i._locale.weekdaysParse(e,a,i._strict))?t.d=a:p(i).invalidWeekday=e}),ve(["d","e","E"],function(e,t,i,a){t[a]=H(e)});var Ye="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Xe=ce,qe=ce,Je=ce;function Qe(){function e(e,t){return t.length-e.length}for(var t,i,a,r=[],o=[],n=[],s=[],l=0;l<7;l++)a=u([2e3,1]).day(l),t=he(this.weekdaysMin(a,"")),i=he(this.weekdaysShort(a,"")),a=he(this.weekdays(a,"")),r.push(t),o.push(i),n.push(a),s.push(t),s.push(i),s.push(a);r.sort(e),o.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Ke(){return this.hours()%12||12}function et(e,t){M(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function tt(e,t){return t._meridiemParse}M("H",["HH",2],0,"hour"),M("h",["hh",2],0,Ke),M("k",["kk",2],0,function(){return this.hours()||24}),M("hmm",0,0,function(){return""+Ke.apply(this)+T(this.minutes(),2)}),M("hmmss",0,0,function(){return""+Ke.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),M("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),M("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),et("a",!0),et("A",!1),L("hour","h"),W("hour",13),ue("a",tt),ue("A",tt),ue("H",ee),ue("h",ee),ue("k",ee),ue("HH",ee,q),ue("hh",ee,q),ue("kk",ee,q),ue("hmm",te),ue("hmmss",ie),ue("Hmm",te),ue("Hmmss",ie),ge(["H","HH"],Se),ge(["k","kk"],function(e,t,i){e=H(e),t[Se]=24===e?0:e}),ge(["a","A"],function(e,t,i){i._isPm=i._locale.isPM(e),i._meridiem=e}),ge(["h","hh"],function(e,t,i){t[Se]=H(e),p(i).bigHour=!0}),ge("hmm",function(e,t,i){var a=e.length-2;t[Se]=H(e.substr(0,a)),t[ke]=H(e.substr(a)),p(i).bigHour=!0}),ge("hmmss",function(e,t,i){var a=e.length-4,r=e.length-2;t[Se]=H(e.substr(0,a)),t[ke]=H(e.substr(a,2)),t[De]=H(e.substr(r)),p(i).bigHour=!0}),ge("Hmm",function(e,t,i){var a=e.length-2;t[Se]=H(e.substr(0,a)),t[ke]=H(e.substr(a))}),ge("Hmmss",function(e,t,i){var a=e.length-4,r=e.length-2;t[Se]=H(e.substr(0,a)),t[ke]=H(e.substr(a,2)),t[De]=H(e.substr(r))}),ce=Y("Hours",!0);var it,at={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Be,week:{dow:0,doy:6},weekdays:Ye,weekdaysMin:ze,weekdaysShort:Ze,meridiemParse:/[ap]\.?m?\.?/i},rt={},ot={};function nt(e){return e&&e.toLowerCase().replace("_","-")}function st(e){var t;if(void 0===rt[e]&&"undefined"!=typeof module&&module&&module.exports&&null!=e.match("^[^/\\\\]*$"))try{t=it._abbr,require("./locale/"+e),lt(t)}catch(t){rt[e]=null}return rt[e]}function lt(e,t){return e&&((t=n(t)?ct(e):dt(e,t))?it=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),it._abbr}function dt(e,t){if(null===t)return delete rt[e],null;var i,a=at;if(t.abbr=e,null!=rt[e])D("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),a=rt[e]._config;else if(null!=t.parentLocale)if(null!=rt[t.parentLocale])a=rt[t.parentLocale]._config;else{if(null==(i=st(t.parentLocale)))return ot[t.parentLocale]||(ot[t.parentLocale]=[]),ot[t.parentLocale].push({name:e,config:t}),null;a=i._config}return rt[e]=new w(I(a,t)),ot[e]&&ot[e].forEach(function(e){dt(e.name,e.config)}),lt(e),rt[e]}function ct(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return it;if(!i(e)){if(t=st(e))return t;e=[e]}return function(e){for(var t,i,a,r,o=0;o<e.length;){for(t=(r=nt(e[o]).split("-")).length,i=(i=nt(e[o+1]))?i.split("-"):null;0<t;){if(a=st(r.slice(0,t).join("-")))return a;if(i&&i.length>=t&&function(e,t){for(var i=Math.min(e.length,t.length),a=0;a<i;a+=1)if(e[a]!==t[a])return a;return i}(r,i)>=t-1)break;t--}o++}return it}(e)}function ut(e){var t=e._a;return t&&-2===p(e).overflow&&(t=t[ye]<0||11<t[ye]?ye:t[be]<1||t[be]>Pe(t[Ce],t[ye])?be:t[Se]<0||24<t[Se]||24===t[Se]&&(0!==t[ke]||0!==t[De]||0!==t[_e])?Se:t[ke]<0||59<t[ke]?ke:t[De]<0||59<t[De]?De:t[_e]<0||999<t[_e]?_e:-1,p(e)._overflowDayOfYear&&(t<Ce||be<t)&&(t=be),p(e)._overflowWeeks&&-1===t&&(t=Ie),p(e)._overflowWeekday&&-1===t&&(t=we),p(e).overflow=t),e}var pt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ht=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/Z|[+-]\d\d(?::?\d\d)?/,ft=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],vt=/^\/?Date\((-?\d+)/i,At=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Ct={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function yt(e){var t,i,a,r,o,n,s=e._i,l=pt.exec(s)||ht.exec(s),d=(s=ft.length,gt.length);if(l){for(p(e).iso=!0,t=0,i=s;t<i;t++)if(ft[t][1].exec(l[1])){r=ft[t][0],a=!1!==ft[t][2];break}if(null==r)e._isValid=!1;else{if(l[3]){for(t=0,i=d;t<i;t++)if(gt[t][1].exec(l[3])){o=(l[2]||" ")+gt[t][0];break}if(null==o)return void(e._isValid=!1)}if(a||null==o){if(l[4]){if(!mt.exec(l[4]))return void(e._isValid=!1);n="Z"}e._f=r+(o||"")+(n||""),Dt(e)}else e._isValid=!1}}else e._isValid=!1}function bt(e){var t,i,a,r,o=At.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));o?(t=function(e,t,i,a,r,o){return e=[function(e){return(e=parseInt(e,10))<=49?2e3+e:e<=999?1900+e:e}(e),Be.indexOf(t),parseInt(i,10),parseInt(a,10),parseInt(r,10)],o&&e.push(parseInt(o,10)),e}(o[4],o[3],o[2],o[5],o[6],o[7]),a=t,r=e,(i=o[1])&&Ze.indexOf(i)!==new Date(a[0],a[1],a[2]).getDay()?(p(r).weekdayMismatch=!0,r._isValid=!1):(e._a=t,e._tzm=(i=o[8],a=o[9],r=o[10],i?Ct[i]:a?0:((i=parseInt(r,10))-(a=i%100))/100*60+a),e._d=Re.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),p(e).rfc2822=!0)):e._isValid=!1}function St(e,t,i){return null!=e?e:null!=t?t:i}function kt(e){var i,a,r,o,n,s,l,d,c,u,h,m=[];if(!e._d){for(r=e,o=new Date(t.now()),a=r._useUTC?[o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()]:[o.getFullYear(),o.getMonth(),o.getDate()],e._w&&null==e._a[be]&&null==e._a[ye]&&(null!=(o=(r=e)._w).GG||null!=o.W||null!=o.E?(d=1,c=4,n=St(o.GG,r._a[Ce],Ve(wt(),1,4).year),s=St(o.W,1),((l=St(o.E,1))<1||7<l)&&(u=!0)):(d=r._locale._week.dow,c=r._locale._week.doy,h=Ve(wt(),d,c),n=St(o.gg,r._a[Ce],h.year),s=St(o.w,h.week),null!=o.d?((l=o.d)<0||6<l)&&(u=!0):null!=o.e?(l=o.e+d,(o.e<0||6<o.e)&&(u=!0)):l=d),s<1||s>je(n,d,c)?p(r)._overflowWeeks=!0:null!=u?p(r)._overflowWeekday=!0:(h=We(n,s,l,d,c),r._a[Ce]=h.year,r._dayOfYear=h.dayOfYear)),null!=e._dayOfYear&&(o=St(e._a[Ce],a[Ce]),(e._dayOfYear>Ne(o)||0===e._dayOfYear)&&(p(e)._overflowDayOfYear=!0),u=Re(o,0,e._dayOfYear),e._a[ye]=u.getUTCMonth(),e._a[be]=u.getUTCDate()),i=0;i<3&&null==e._a[i];++i)e._a[i]=m[i]=a[i];for(;i<7;i++)e._a[i]=m[i]=null==e._a[i]?2===i?1:0:e._a[i];24===e._a[Se]&&0===e._a[ke]&&0===e._a[De]&&0===e._a[_e]&&(e._nextDay=!0,e._a[Se]=0),e._d=(e._useUTC?Re:Ue).apply(null,m),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Se]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(p(e).weekdayMismatch=!0)}}function Dt(e){if(e._f===t.ISO_8601)yt(e);else if(e._f===t.RFC_2822)bt(e);else{e._a=[],p(e).empty=!0;for(var i,a,o,n,s,l=""+e._i,d=l.length,c=0,u=$(e._f,e._locale).match(B)||[],h=u.length,m=0;m<h;m++)a=u[m],(i=(l.match(pe(a,e))||[])[0])&&(0<(o=l.substr(0,l.indexOf(i))).length&&p(e).unusedInput.push(o),l=l.slice(l.indexOf(i)+i.length),c+=i.length),O[a]?(i?p(e).empty=!1:p(e).unusedTokens.push(a),o=a,s=e,null!=(n=i)&&r(fe,o)&&fe[o](n,s._a,s,o)):e._strict&&!i&&p(e).unusedTokens.push(a);p(e).charsLeftOver=d-c,0<l.length&&p(e).unusedInput.push(l),e._a[Se]<=12&&!0===p(e).bigHour&&0<e._a[Se]&&(p(e).bigHour=void 0),p(e).parsedDateParts=e._a.slice(0),p(e).meridiem=e._meridiem,e._a[Se]=function(e,t,i){return null==i?t:null!=e.meridiemHour?e.meridiemHour(t,i):null!=e.isPM?((e=e.isPM(i))&&t<12&&(t+=12),t=e||12!==t?t:0):t}(e._locale,e._a[Se],e._meridiem),null!==(d=p(e).era)&&(e._a[Ce]=e._locale.erasConvertYear(d,e._a[Ce])),kt(e),ut(e)}}function _t(e){var r,o,u,f=e._i,g=e._f;return e._locale=e._locale||ct(e._l),null===f||void 0===g&&""===f?m({nullInput:!0}):("string"==typeof f&&(e._i=f=e._locale.preparse(f)),y(f)?new C(ut(f)):(l(f)?e._d=f:i(g)?function(e){var t,i,a,r,o,n,s=!1,l=e._f.length;if(0===l)return p(e).invalidFormat=!0,e._d=new Date(NaN);for(r=0;r<l;r++)o=0,n=!1,t=A({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[r],Dt(t),h(t)&&(n=!0),o=(o+=p(t).charsLeftOver)+10*p(t).unusedTokens.length,p(t).score=o,s?o<a&&(a=o,i=t):(null==a||o<a||n)&&(a=o,i=t,n&&(s=!0));c(e,i||t)}(e):g?Dt(e):n(g=(f=e)._i)?f._d=new Date(t.now()):l(g)?f._d=new Date(g.valueOf()):"string"==typeof g?(o=f,null!==(r=vt.exec(o._i))?o._d=new Date(+r[1]):(yt(o),!1===o._isValid&&(delete o._isValid,bt(o),!1===o._isValid&&(delete o._isValid,o._strict?o._isValid=!1:t.createFromInputFallback(o))))):i(g)?(f._a=d(g.slice(0),function(e){return parseInt(e,10)}),kt(f)):a(g)?(r=f)._d||(u=void 0===(o=R(r._i)).day?o.date:o.day,r._a=d([o.year,o.month,u,o.hour,o.minute,o.second,o.millisecond],function(e){return e&&parseInt(e,10)}),kt(r)):s(g)?f._d=new Date(g):t.createFromInputFallback(f),h(e)||(e._d=null),e))}function It(e,t,r,n,s){var l={};return!0!==t&&!1!==t||(n=t,t=void 0),!0!==r&&!1!==r||(n=r,r=void 0),(a(e)&&o(e)||i(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=r,l._i=e,l._f=t,l._strict=n,(s=new C(ut(_t(s=l))))._nextDay&&(s.add(1,"d"),s._nextDay=void 0),s}function wt(e,t,i,a){return It(e,t,i,a,!1)}function Pt(e,t){var a,r;if(!(t=1===t.length&&i(t[0])?t[0]:t).length)return wt();for(a=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](a)||(a=t[r]);return a}t.createFromInputFallback=S("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){},te=S("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=wt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),ie=S("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=wt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:m()});var Tt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Bt(e){var t=(e=R(e)).year||0,i=e.quarter||0,a=e.month||0,o=e.week||e.isoWeek||0,n=e.day||0,s=e.hour||0,l=e.minute||0,d=e.second||0,c=e.millisecond||0;this._isValid=function(e){var t,i,a=!1,o=Tt.length;for(t in e)if(r(e,t)&&(-1===Ae.call(Tt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(i=0;i<o;++i)if(e[Tt[i]]){if(a)return!1;parseFloat(e[Tt[i]])!==H(e[Tt[i]])&&(a=!0)}return!0}(e),this._milliseconds=+c+1e3*d+6e4*l+1e3*s*60*60,this._days=+n+7*o,this._months=+a+3*i+12*t,this._data={},this._locale=ct(),this._bubble()}function xt(e){return e instanceof Bt}function Ft(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ot(e,t){M(e,0,0,function(){var e=this.utcOffset(),i="+";return e<0&&(e=-e,i="-"),i+T(~~(e/60),2)+t+T(~~e%60,2)})}Ot("Z",":"),Ot("ZZ",""),ue("Z",de),ue("ZZ",de),ge(["Z","ZZ"],function(e,t,i){i._useUTC=!0,i._tzm=Et(de,e)});var Mt=/([\+\-]|\d\d)/gi;function Et(e,t){return null===(t=(t||"").match(e))?null:0===(t=60*(e=((t[t.length-1]||[])+"").match(Mt)||["-",0,0])[1]+H(e[2]))?0:"+"===e[0]?t:-t}function $t(e,i){var a;return i._isUTC?(i=i.clone(),a=(y(e)||l(e)?e:wt(e)).valueOf()-i.valueOf(),i._d.setTime(i._d.valueOf()+a),t.updateOffset(i,!1),i):wt(e).local()}function Nt(e){return-Math.round(e._d.getTimezoneOffset())}function Lt(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var Ut=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Rt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Gt(e,t){var i,a=e,o=null;return xt(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:s(e)||!isNaN(+e)?(a={},t?a[t]=+e:a.milliseconds=+e):(o=Ut.exec(e))?(i="-"===o[1]?-1:1,a={y:0,d:H(o[be])*i,h:H(o[Se])*i,m:H(o[ke])*i,s:H(o[De])*i,ms:H(Ft(1e3*o[_e]))*i}):(o=Rt.exec(e))?(i="-"===o[1]?-1:1,a={y:Wt(o[2],i),M:Wt(o[3],i),w:Wt(o[4],i),d:Wt(o[5],i),h:Wt(o[6],i),m:Wt(o[7],i),s:Wt(o[8],i)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(t=function(e,t){var i;return e.isValid()&&t.isValid()?(t=$t(t,e),e.isBefore(t)?i=Vt(e,t):((i=Vt(t,e)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}(wt(a.from),wt(a.to)),(a={}).ms=t.milliseconds,a.M=t.months),o=new Bt(a),xt(e)&&r(e,"_locale")&&(o._locale=e._locale),xt(e)&&r(e,"_isValid")&&(o._isValid=e._isValid),o}function Wt(e,t){return e=e&&parseFloat(e.replace(",",".")),(isNaN(e)?0:e)*t}function Vt(e,t){var i={};return i.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+e.clone().add(i.months,"M"),i}function jt(e,t){return function(i,a){var r;return null===a||isNaN(+a)||(D(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=i,i=a,a=r),Ht(this,Gt(i,a),e),this}}function Ht(e,i,a,r){var o=i._milliseconds,n=Ft(i._days);i=Ft(i._months);e.isValid()&&(r=null==r||r,i&&Me(e,Z(e,"Month")+i*a),n&&z(e,"Date",Z(e,"Date")+n*a),o&&e._d.setTime(e._d.valueOf()+o*a),r&&t.updateOffset(e,n||i))}function Yt(e){return"string"==typeof e||e instanceof String}function Zt(e,t){if(e.date()<t.date())return-Zt(t,e);var i=12*(t.year()-e.year())+(t.month()-e.month()),a=e.clone().add(i,"months");return-(i+(t=t-a<0?(t-a)/(a-e.clone().add(i-1,"months")):(t-a)/(e.clone().add(1+i,"months")-a)))||0}function zt(e){return void 0===e?this._locale._abbr:(null!=(e=ct(e))&&(this._locale=e),this)}function Xt(){return this._locale}Gt.fn=Bt.prototype,Gt.invalid=function(){return Gt(NaN)},Te=jt(1,"add"),Ye=jt(-1,"subtract"),t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]",ze=S("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});var qt=126227808e5;function Jt(e,t){return(e%t+t)%t}function Qt(e,t,i){return e<100&&0<=e?new Date(e+400,t,i)-qt:new Date(e,t,i).valueOf()}function Kt(e,t,i){return e<100&&0<=e?Date.UTC(e+400,t,i)-qt:Date.UTC(e,t,i)}function ei(e,t){return t.erasAbbrRegex(e)}function ti(){for(var e=[],t=[],i=[],a=[],r=this.eras(),o=0,n=r.length;o<n;++o)t.push(he(r[o].name)),e.push(he(r[o].abbr)),i.push(he(r[o].narrow)),a.push(he(r[o].name)),a.push(he(r[o].abbr)),a.push(he(r[o].narrow));this._erasRegex=new RegExp("^("+a.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+i.join("|")+")","i")}function ii(e,t){M(0,[e,e.length],0,t)}function ai(e,t,i,a,r){var o;return null==e?Ve(this,a,r).year:(o=je(e,a,r),function(e,t,i,a,r){return t=Re((e=We(e,t,i,a,r)).year,0,e.dayOfYear),this.year(t.getUTCFullYear()),this.month(t.getUTCMonth()),this.date(t.getUTCDate()),this}.call(this,e,t=o<t?o:t,i,a,r))}M("N",0,0,"eraAbbr"),M("NN",0,0,"eraAbbr"),M("NNN",0,0,"eraAbbr"),M("NNNN",0,0,"eraName"),M("NNNNN",0,0,"eraNarrow"),M("y",["y",1],"yo","eraYear"),M("y",["yy",2],0,"eraYear"),M("y",["yyy",3],0,"eraYear"),M("y",["yyyy",4],0,"eraYear"),ue("N",ei),ue("NN",ei),ue("NNN",ei),ue("NNNN",function(e,t){return t.erasNameRegex(e)}),ue("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),ge(["N","NN","NNN","NNNN","NNNNN"],function(e,t,i,a){(a=i._locale.erasParse(e,a,i._strict))?p(i).era=a:p(i).invalidEra=e}),ue("y",ne),ue("yy",ne),ue("yyy",ne),ue("yyyy",ne),ue("yo",function(e,t){return t._eraYearOrdinalRegex||ne}),ge(["y","yy","yyy","yyyy"],Ce),ge(["yo"],function(e,t,i,a){var r;i._locale._eraYearOrdinalRegex&&(r=e.match(i._locale._eraYearOrdinalRegex)),i._locale.eraYearOrdinalParse?t[Ce]=i._locale.eraYearOrdinalParse(e,r):t[Ce]=parseInt(e,10)}),M(0,["gg",2],0,function(){return this.weekYear()%100}),M(0,["GG",2],0,function(){return this.isoWeekYear()%100}),ii("gggg","weekYear"),ii("ggggg","weekYear"),ii("GGGG","isoWeekYear"),ii("GGGGG","isoWeekYear"),L("weekYear","gg"),L("isoWeekYear","GG"),W("weekYear",1),W("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",ee,q),ue("gg",ee,q),ue("GGGG",re,Q),ue("gggg",re,Q),ue("GGGGG",oe,K),ue("ggggg",oe,K),ve(["gggg","ggggg","GGGG","GGGGG"],function(e,t,i,a){t[a.substr(0,2)]=H(e)}),ve(["gg","GG"],function(e,i,a,r){i[r]=t.parseTwoDigitYear(e)}),M("Q",0,"Qo","quarter"),L("quarter","Q"),W("quarter",7),ue("Q",X),ge("Q",function(e,t){t[ye]=3*(H(e)-1)}),M("D",["DD",2],"Do","date"),L("date","D"),W("date",9),ue("D",ee),ue("DD",ee,q),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ge(["D","DD"],be),ge("Do",function(e,t){t[be]=H(e.match(ee)[0])}),re=Y("Date",!0),M("DDD",["DDDD",3],"DDDo","dayOfYear"),L("dayOfYear","DDD"),W("dayOfYear",4),ue("DDD",ae),ue("DDDD",J),ge(["DDD","DDDD"],function(e,t,i){i._dayOfYear=H(e)}),M("m",["mm",2],0,"minute"),L("minute","m"),W("minute",14),ue("m",ee),ue("mm",ee,q),ge(["m","mm"],ke);var ri;Q=Y("Minutes",!1),M("s",["ss",2],0,"second"),L("second","s"),W("second",15),ue("s",ee),ue("ss",ee,q),ge(["s","ss"],De),oe=Y("Seconds",!1);for(M("S",0,0,function(){return~~(this.millisecond()/100)}),M(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),M(0,["SSS",3],0,"millisecond"),M(0,["SSSS",4],0,function(){return 10*this.millisecond()}),M(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),M(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),M(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),M(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),M(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),L("millisecond","ms"),W("millisecond",16),ue("S",ae,X),ue("SS",ae,q),ue("SSS",ae,J),ri="SSSS";ri.length<=9;ri+="S")ue(ri,ne);function oi(e,t){t[_e]=H(1e3*("0."+e))}for(ri="S";ri.length<=9;ri+="S")ge(ri,oi);function ni(e){return e}function si(e,t,i,a){var r=ct();a=u().set(a,t);return r[i](a,e)}function li(e,t,i){if(s(e)&&(t=e,e=void 0),e=e||"",null!=t)return si(e,t,i,"month");for(var a=[],r=0;r<12;r++)a[r]=si(e,r,i,"month");return a}function di(e,t,i,a){"boolean"==typeof e?s(t)&&(i=t,t=void 0):(t=e,e=!1,s(i=t)&&(i=t,t=void 0)),t=t||"";var r,o=ct(),n=e?o._week.dow:0,l=[];if(null!=i)return si(t,(i+n)%7,a,"day");for(r=0;r<7;r++)l[r]=si(t,(r+n)%7,a,"day");return l}K=Y("Milliseconds",!1),M("z",0,0,"zoneAbbr"),M("zz",0,0,"zoneName"),(X=C.prototype).add=Te,X.calendar=function(e,n){1===arguments.length&&(arguments[0]?function(e){return y(e)||l(e)||Yt(e)||s(e)||function(e){var t=i(e),a=!1;return t&&(a=0===e.filter(function(t){return!s(t)&&Yt(e)}).length),t&&a}(e)||function(e){var t,i=a(e)&&!o(e),n=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],l=s.length;for(t=0;t<l;t+=1)n=n||r(e,s[t]);return i&&n}(e)||null==e}(arguments[0])?(e=arguments[0],n=void 0):function(e){for(var t=a(e)&&!o(e),i=!1,n=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],s=0;s<n.length;s+=1)i=i||r(e,n[s]);return t&&i}(arguments[0])&&(n=arguments[0],e=void 0):n=e=void 0);var d=$t(e=e||wt(),this).startOf("day");d=t.calendarFormat(this,d)||"sameElse",n=n&&(_(n[d])?n[d].call(this,e):n[d]);return this.format(n||this.localeData().calendar(d,this,wt(e)))},X.clone=function(){return new C(this)},X.diff=function(e,t,i){var a,r,o;if(!this.isValid())return NaN;if(!(a=$t(e,this)).isValid())return NaN;switch(r=6e4*(a.utcOffset()-this.utcOffset()),t=U(t)){case"year":o=Zt(this,a)/12;break;case"month":o=Zt(this,a);break;case"quarter":o=Zt(this,a)/3;break;case"second":o=(this-a)/1e3;break;case"minute":o=(this-a)/6e4;break;case"hour":o=(this-a)/36e5;break;case"day":o=(this-a-r)/864e5;break;case"week":o=(this-a-r)/6048e5;break;default:o=this-a}return i?o:j(o)},X.endOf=function(e){var i,a;if(void 0===(e=U(e))||"millisecond"===e||!this.isValid())return this;switch(a=this._isUTC?Kt:Qt,e){case"year":i=a(this.year()+1,0,1)-1;break;case"quarter":i=a(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":i=a(this.year(),this.month()+1,1)-1;break;case"week":i=a(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":i=a(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":i=a(this.year(),this.month(),this.date()+1)-1;break;case"hour":i=this._d.valueOf(),i+=36e5-Jt(i+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":i=this._d.valueOf(),i+=6e4-Jt(i,6e4)-1;break;case"second":i=this._d.valueOf(),i+=1e3-Jt(i,1e3)-1}return this._d.setTime(i),t.updateOffset(this,!0),this},X.format=function(e){return e=E(this,e=e||(this.isUtc()?t.defaultFormatUtc:t.defaultFormat)),this.localeData().postformat(e)},X.from=function(e,t){return this.isValid()&&(y(e)&&e.isValid()||wt(e).isValid())?Gt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},X.fromNow=function(e){return this.from(wt(),e)},X.to=function(e,t){return this.isValid()&&(y(e)&&e.isValid()||wt(e).isValid())?Gt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},X.toNow=function(e){return this.to(wt(),e)},X.get=function(e){return _(this[e=U(e)])?this[e]():this},X.invalidAt=function(){return p(this).overflow},X.isAfter=function(e,t){return e=y(e)?e:wt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=U(t)||"millisecond")?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},X.isBefore=function(e,t){return e=y(e)?e:wt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=U(t)||"millisecond")?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},X.isBetween=function(e,t,i,a){return e=y(e)?e:wt(e),t=y(t)?t:wt(t),!!(this.isValid()&&e.isValid()&&t.isValid())&&("("===(a=a||"()")[0]?this.isAfter(e,i):!this.isBefore(e,i))&&(")"===a[1]?this.isBefore(t,i):!this.isAfter(t,i))},X.isSame=function(e,t){e=y(e)?e:wt(e);return!(!this.isValid()||!e.isValid())&&("millisecond"===(t=U(t)||"millisecond")?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},X.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},X.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},X.isValid=function(){return h(this)},X.lang=ze,X.locale=zt,X.localeData=Xt,X.max=ie,X.min=te,X.parsingFlags=function(){return c({},p(this))},X.set=function(e,t){if("object"==typeof e)for(var i=function(e){var t,i=[];for(t in e)r(e,t)&&i.push({unit:t,priority:G[t]});return i.sort(function(e,t){return e.priority-t.priority}),i}(e=R(e)),a=i.length,o=0;o<a;o++)this[i[o].unit](e[i[o].unit]);else if(_(this[e=U(e)]))return this[e](t);return this},X.startOf=function(e){var i,a;if(void 0===(e=U(e))||"millisecond"===e||!this.isValid())return this;switch(a=this._isUTC?Kt:Qt,e){case"year":i=a(this.year(),0,1);break;case"quarter":i=a(this.year(),this.month()-this.month()%3,1);break;case"month":i=a(this.year(),this.month(),1);break;case"week":i=a(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":i=a(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":i=a(this.year(),this.month(),this.date());break;case"hour":i=this._d.valueOf(),i-=Jt(i+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":i=this._d.valueOf(),i-=Jt(i,6e4);break;case"second":i=this._d.valueOf(),i-=Jt(i,1e3)}return this._d.setTime(i),t.updateOffset(this,!0),this},X.subtract=Ye,X.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},X.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},X.toDate=function(){return new Date(this.valueOf())},X.toISOString=function(e){if(!this.isValid())return null;var t=(e=!0!==e)?this.clone().utc():this;return t.year()<0||9999<t.year()?E(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):_(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",E(t,"Z")):E(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},X.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t="moment",i="";return this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),t="["+t+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",this.format(t+e+"-MM-DD[T]HH:mm:ss.SSS"+i+'[")]')},"undefined"!=typeof Symbol&&null!=Symbol.for&&(X[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),X.toJSON=function(){return this.isValid()?this.toISOString():null},X.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},X.unix=function(){return Math.floor(this.valueOf()/1e3)},X.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},X.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},X.eraName=function(){for(var e,t=this.localeData().eras(),i=0,a=t.length;i<a;++i){if(e=this.clone().startOf("day").valueOf(),t[i].since<=e&&e<=t[i].until)return t[i].name;if(t[i].until<=e&&e<=t[i].since)return t[i].name}return""},X.eraNarrow=function(){for(var e,t=this.localeData().eras(),i=0,a=t.length;i<a;++i){if(e=this.clone().startOf("day").valueOf(),t[i].since<=e&&e<=t[i].until)return t[i].narrow;if(t[i].until<=e&&e<=t[i].since)return t[i].narrow}return""},X.eraAbbr=function(){for(var e,t=this.localeData().eras(),i=0,a=t.length;i<a;++i){if(e=this.clone().startOf("day").valueOf(),t[i].since<=e&&e<=t[i].until)return t[i].abbr;if(t[i].until<=e&&e<=t[i].since)return t[i].abbr}return""},X.eraYear=function(){for(var e,i,a=this.localeData().eras(),r=0,o=a.length;r<o;++r)if(e=a[r].since<=a[r].until?1:-1,i=this.clone().startOf("day").valueOf(),a[r].since<=i&&i<=a[r].until||a[r].until<=i&&i<=a[r].since)return(this.year()-t(a[r].since).year())*e+a[r].offset;return this.year()},X.year=Le,X.isLeapYear=function(){return V(this.year())},X.weekYear=function(e){return ai.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},X.isoWeekYear=function(e){return ai.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},X.quarter=X.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},X.month=Ee,X.daysInMonth=function(){return Pe(this.year(),this.month())},X.week=X.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},X.isoWeek=X.isoWeeks=function(e){var t=Ve(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},X.weeksInYear=function(){var e=this.localeData()._week;return je(this.year(),e.dow,e.doy)},X.weeksInWeekYear=function(){var e=this.localeData()._week;return je(this.weekYear(),e.dow,e.doy)},X.isoWeeksInYear=function(){return je(this.year(),1,4)},X.isoWeeksInISOWeekYear=function(){return je(this.isoWeekYear(),1,4)},X.date=re,X.day=X.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,i,a=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,i=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=i.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-a,"d")):a},X.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},X.isoWeekday=function(e){return this.isValid()?null!=e?(t=e,i=this.localeData(),i="string"==typeof t?i.weekdaysParse(t)%7||7:isNaN(t)?null:t,this.day(this.day()%7?i:i-7)):this.day()||7:null!=e?this:NaN;var t,i},X.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},X.hour=X.hours=ce,X.minute=X.minutes=Q,X.second=X.seconds=oe,X.millisecond=X.milliseconds=K,X.utcOffset=function(e,i,a){var r,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?o:Nt(this);if("string"==typeof e){if(null===(e=Et(de,e)))return this}else Math.abs(e)<16&&!a&&(e*=60);return!this._isUTC&&i&&(r=Nt(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),o!==e&&(!i||this._changeInProgress?Ht(this,Gt(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},X.utc=function(e){return this.utcOffset(0,e)},X.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Nt(this),"m")),this},X.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Et(le,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},X.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?wt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},X.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},X.isLocal=function(){return!!this.isValid()&&!this._isUTC},X.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},X.isUtc=Lt,X.isUTC=Lt,X.zoneAbbr=function(){return this._isUTC?"UTC":""},X.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},X.dates=S("dates accessor is deprecated. Use date instead.",re),X.months=S("months accessor is deprecated. Use month instead",Ee),X.years=S("years accessor is deprecated. Use year instead",Le),X.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),X.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!n(this._isDSTShifted))return this._isDSTShifted;var e,t={};return A(t,this),(t=_t(t))._a?(e=(t._isUTC?u:wt)(t._a),this._isDSTShifted=this.isValid()&&0<function(e,t){for(var i=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),r=0,o=0;o<i;o++)H(e[o])!==H(t[o])&&r++;return r+a}(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted}),(q=w.prototype).calendar=function(e,t,i){return _(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,i):e},q.longDateFormat=function(e){var t=this._longDateFormat[e],i=this._longDateFormat[e.toUpperCase()];return t||!i?t:(this._longDateFormat[e]=i.match(B).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},q.invalidDate=function(){return this._invalidDate},q.ordinal=function(e){return this._ordinal.replace("%d",e)},q.preparse=ni,q.postformat=ni,q.relativeTime=function(e,t,i,a){var r=this._relativeTime[i];return _(r)?r(e,t,i,a):r.replace(/%d/i,e)},q.pastFuture=function(e,t){return _(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},q.set=function(e){var t,i;for(i in e)r(e,i)&&(_(t=e[i])?this[i]=t:this["_"+i]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},q.eras=function(e,i){for(var a,r=this._eras||ct("en")._eras,o=0,n=r.length;o<n;++o){if("string"==typeof r[o].since)a=t(r[o].since).startOf("day"),r[o].since=a.valueOf();switch(typeof r[o].until){case"undefined":r[o].until=1/0;break;case"string":a=t(r[o].until).startOf("day").valueOf(),r[o].until=a.valueOf()}}return r},q.erasParse=function(e,t,i){var a,r,o,n,s,l=this.eras();for(e=e.toUpperCase(),a=0,r=l.length;a<r;++a)if(o=l[a].name.toUpperCase(),n=l[a].abbr.toUpperCase(),s=l[a].narrow.toUpperCase(),i)switch(t){case"N":case"NN":case"NNN":if(n===e)return l[a];break;case"NNNN":if(o===e)return l[a];break;case"NNNNN":if(s===e)return l[a]}else if(0<=[o,n,s].indexOf(e))return l[a]},q.erasConvertYear=function(e,i){var a=e.since<=e.until?1:-1;return void 0===i?t(e.since).year():t(e.since).year()+(i-e.offset)*a},q.erasAbbrRegex=function(e){return r(this,"_erasAbbrRegex")||ti.call(this),e?this._erasAbbrRegex:this._erasRegex},q.erasNameRegex=function(e){return r(this,"_erasNameRegex")||ti.call(this),e?this._erasNameRegex:this._erasRegex},q.erasNarrowRegex=function(e){return r(this,"_erasNarrowRegex")||ti.call(this),e?this._erasNarrowRegex:this._erasRegex},q.months=function(e,t){return e?(i(this._months)?this._months:this._months[(this._months.isFormat||xe).test(t)?"format":"standalone"])[e.month()]:i(this._months)?this._months:this._months.standalone},q.monthsShort=function(e,t){return e?(i(this._monthsShort)?this._monthsShort:this._monthsShort[xe.test(t)?"format":"standalone"])[e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},q.monthsParse=function(e,t,i){var a,r;if(this._monthsParseExact)return function(e,t,i){var a,r,o;e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],a=0;a<12;++a)o=u([2e3,a]),this._shortMonthsParse[a]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[a]=this.months(o,"").toLocaleLowerCase();return i?"MMM"===t?-1!==(r=Ae.call(this._shortMonthsParse,e))?r:null:-1!==(r=Ae.call(this._longMonthsParse,e))?r:null:"MMM"===t?-1!==(r=Ae.call(this._shortMonthsParse,e))||-1!==(r=Ae.call(this._longMonthsParse,e))?r:null:-1!==(r=Ae.call(this._longMonthsParse,e))||-1!==(r=Ae.call(this._shortMonthsParse,e))?r:null}.call(this,e,t,i);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),a=0;a<12;a++){if(r=u([2e3,a]),i&&!this._longMonthsParse[a]&&(this._longMonthsParse[a]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[a]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),i||this._monthsParse[a]||(r="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[a]=new RegExp(r.replace(".",""),"i")),i&&"MMMM"===t&&this._longMonthsParse[a].test(e))return a;if(i&&"MMM"===t&&this._shortMonthsParse[a].test(e))return a;if(!i&&this._monthsParse[a].test(e))return a}},q.monthsRegex=function(e){return this._monthsParseExact?(r(this,"_monthsRegex")||$e.call(this),e?this._monthsStrictRegex:this._monthsRegex):(r(this,"_monthsRegex")||(this._monthsRegex=Oe),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},q.monthsShortRegex=function(e){return this._monthsParseExact?(r(this,"_monthsRegex")||$e.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(r(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},q.week=function(e){return Ve(e,this._week.dow,this._week.doy).week},q.firstDayOfYear=function(){return this._week.doy},q.firstDayOfWeek=function(){return this._week.dow},q.weekdays=function(e,t){return t=i(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"],!0===e?He(t,this._week.dow):e?t[e.day()]:t},q.weekdaysMin=function(e){return!0===e?He(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},q.weekdaysShort=function(e){return!0===e?He(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},q.weekdaysParse=function(e,t,i){var a,r;if(this._weekdaysParseExact)return function(e,t,i){var a,r,o;e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],a=0;a<7;++a)o=u([2e3,1]).day(a),this._minWeekdaysParse[a]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[a]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[a]=this.weekdays(o,"").toLocaleLowerCase();return i?"dddd"===t?-1!==(r=Ae.call(this._weekdaysParse,e))?r:null:"ddd"===t?-1!==(r=Ae.call(this._shortWeekdaysParse,e))?r:null:-1!==(r=Ae.call(this._minWeekdaysParse,e))?r:null:"dddd"===t?-1!==(r=Ae.call(this._weekdaysParse,e))||-1!==(r=Ae.call(this._shortWeekdaysParse,e))||-1!==(r=Ae.call(this._minWeekdaysParse,e))?r:null:"ddd"===t?-1!==(r=Ae.call(this._shortWeekdaysParse,e))||-1!==(r=Ae.call(this._weekdaysParse,e))||-1!==(r=Ae.call(this._minWeekdaysParse,e))?r:null:-1!==(r=Ae.call(this._minWeekdaysParse,e))||-1!==(r=Ae.call(this._weekdaysParse,e))||-1!==(r=Ae.call(this._shortWeekdaysParse,e))?r:null}.call(this,e,t,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),a=0;a<7;a++){if(r=u([2e3,1]).day(a),i&&!this._fullWeekdaysParse[a]&&(this._fullWeekdaysParse[a]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[a]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[a]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[a]||(r="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[a]=new RegExp(r.replace(".",""),"i")),i&&"dddd"===t&&this._fullWeekdaysParse[a].test(e))return a;if(i&&"ddd"===t&&this._shortWeekdaysParse[a].test(e))return a;if(i&&"dd"===t&&this._minWeekdaysParse[a].test(e))return a;if(!i&&this._weekdaysParse[a].test(e))return a}},q.weekdaysRegex=function(e){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(r(this,"_weekdaysRegex")||(this._weekdaysRegex=Xe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},q.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(r(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=qe),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},q.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(r(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Je),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},q.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},q.meridiem=function(e,t,i){return 11<e?i?"pm":"PM":i?"am":"AM"},lt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===H(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),t.lang=S("moment.lang is deprecated. Use moment.locale instead.",lt),t.langData=S("moment.langData is deprecated. Use moment.localeData instead.",ct);var ci=Math.abs;function ui(e,t,i,a){return t=Gt(t,i),e._milliseconds+=a*t._milliseconds,e._days+=a*t._days,e._months+=a*t._months,e._bubble()}function pi(e){return e<0?Math.floor(e):Math.ceil(e)}function hi(e){return 4800*e/146097}function mi(e){return 146097*e/4800}function fi(e){return function(){return this.as(e)}}function gi(e){return function(){return this.isValid()?this._data[e]:NaN}}ae=fi("ms"),J=fi("s"),Te=fi("m"),ie=fi("h"),te=fi("d"),Ye=fi("w"),ce=fi("M"),Q=fi("Q"),oe=fi("y");K=gi("milliseconds"),re=gi("seconds"),Le=gi("minutes"),q=gi("hours");var vi=gi("days"),Ai=gi("months"),Ci=gi("years"),yi=Math.round,bi={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};var Si=Math.abs;function ki(e){return(0<e)-(e<0)||+e}function Di(){if(!this.isValid())return this.localeData().invalidDate();var e,t,i,a,r,o,n,s=Si(this._milliseconds)/1e3,l=Si(this._days),d=Si(this._months),c=this.asSeconds();return c?(e=j(s/60),t=j(e/60),s%=60,e%=60,i=j(d/12),d%=12,a=s?s.toFixed(3).replace(/\.?0+$/,""):"",r=ki(this._months)!==ki(c)?"-":"",o=ki(this._days)!==ki(c)?"-":"",n=ki(this._milliseconds)!==ki(c)?"-":"",(c<0?"-":"")+"P"+(i?r+i+"Y":"")+(d?r+d+"M":"")+(l?o+l+"D":"")+(t||e||s?"T":"")+(t?n+t+"H":"")+(e?n+e+"M":"")+(s?n+a+"S":"")):"P0D"}var _i=Bt.prototype;return _i.isValid=function(){return this._isValid},_i.abs=function(){var e=this._data;return this._milliseconds=ci(this._milliseconds),this._days=ci(this._days),this._months=ci(this._months),e.milliseconds=ci(e.milliseconds),e.seconds=ci(e.seconds),e.minutes=ci(e.minutes),e.hours=ci(e.hours),e.months=ci(e.months),e.years=ci(e.years),this},_i.add=function(e,t){return ui(this,e,t,1)},_i.subtract=function(e,t){return ui(this,e,t,-1)},_i.as=function(e){if(!this.isValid())return NaN;var t,i,a=this._milliseconds;if("month"===(e=U(e))||"quarter"===e||"year"===e)switch(t=this._days+a/864e5,i=this._months+hi(t),e){case"month":return i;case"quarter":return i/3;case"year":return i/12}else switch(t=this._days+Math.round(mi(this._months)),e){case"week":return t/7+a/6048e5;case"day":return t+a/864e5;case"hour":return 24*t+a/36e5;case"minute":return 1440*t+a/6e4;case"second":return 86400*t+a/1e3;case"millisecond":return Math.floor(864e5*t)+a;default:throw new Error("Unknown unit "+e)}},_i.asMilliseconds=ae,_i.asSeconds=J,_i.asMinutes=Te,_i.asHours=ie,_i.asDays=te,_i.asWeeks=Ye,_i.asMonths=ce,_i.asQuarters=Q,_i.asYears=oe,_i.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*H(this._months/12):NaN},_i._bubble=function(){var e=this._milliseconds,t=this._days,i=this._months,a=this._data;return 0<=e&&0<=t&&0<=i||e<=0&&t<=0&&i<=0||(e+=864e5*pi(mi(i)+t),i=t=0),a.milliseconds=e%1e3,e=j(e/1e3),a.seconds=e%60,e=j(e/60),a.minutes=e%60,e=j(e/60),a.hours=e%24,t+=j(e/24),i+=e=j(hi(t)),t-=pi(mi(e)),e=j(i/12),i%=12,a.days=t,a.months=i,a.years=e,this},_i.clone=function(){return Gt(this)},_i.get=function(e){return e=U(e),this.isValid()?this[e+"s"]():NaN},_i.milliseconds=K,_i.seconds=re,_i.minutes=Le,_i.hours=q,_i.days=vi,_i.weeks=function(){return j(this.days()/7)},_i.months=Ai,_i.years=Ci,_i.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var i=!1,a=bi;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(a=Object.assign({},bi,t),null!=t.s&&null==t.ss&&(a.ss=t.s-1)),t=function(e,t,i,a){var r=Gt(e).abs(),o=yi(r.as("s")),n=yi(r.as("m")),s=yi(r.as("h")),l=yi(r.as("d")),d=yi(r.as("M")),c=yi(r.as("w"));return r=yi(r.as("y")),o=(o<=i.ss?["s",o]:o<i.s&&["ss",o])||n<=1&&["m"]||n<i.m&&["mm",n]||s<=1&&["h"]||s<i.h&&["hh",s]||l<=1&&["d"]||l<i.d&&["dd",l],(o=(o=null!=i.w?o||c<=1&&["w"]||c<i.w&&["ww",c]:o)||d<=1&&["M"]||d<i.M&&["MM",d]||r<=1&&["y"]||["yy",r])[2]=t,o[3]=0<+e,o[4]=a,function(e,t,i,a,r){return r.relativeTime(t||1,!!i,e,a)}.apply(null,o)}(this,!i,a,e=this.localeData()),i&&(t=e.pastFuture(+this,t)),e.postformat(t)},_i.toISOString=Di,_i.toString=Di,_i.toJSON=Di,_i.locale=zt,_i.localeData=Xt,_i.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Di),_i.lang=ze,M("X",0,0,"unix"),M("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ge("X",function(e,t,i){i._d=new Date(1e3*parseFloat(e))}),ge("x",function(e,t,i){i._d=new Date(H(e))}),t.version="2.29.4",e=wt,t.fn=X,t.min=function(){return Pt("isBefore",[].slice.call(arguments,0))},t.max=function(){return Pt("isAfter",[].slice.call(arguments,0))},t.now=function(){return Date.now?Date.now():+new Date},t.utc=u,t.unix=function(e){return wt(1e3*e)},t.months=function(e,t){return li(e,t,"months")},t.isDate=l,t.locale=lt,t.invalid=m,t.duration=Gt,t.isMoment=y,t.weekdays=function(e,t,i){return di(e,t,i,"weekdays")},t.parseZone=function(){return wt.apply(null,arguments).parseZone()},t.localeData=ct,t.isDuration=xt,t.monthsShort=function(e,t){return li(e,t,"monthsShort")},t.weekdaysMin=function(e,t,i){return di(e,t,i,"weekdaysMin")},t.defineLocale=dt,t.updateLocale=function(e,t){var i,a;return null!=t?(a=at,null!=rt[e]&&null!=rt[e].parentLocale?rt[e].set(I(rt[e]._config,t)):(t=I(a=null!=(i=st(e))?i._config:a,t),null==i&&(t.abbr=e),(a=new w(t)).parentLocale=rt[e],rt[e]=a),lt(e)):null!=rt[e]&&(null!=rt[e].parentLocale?(rt[e]=rt[e].parentLocale,e===lt()&&lt(e)):null!=rt[e]&&delete rt[e]),rt[e]},t.locales=function(){return P(rt)},t.weekdaysShort=function(e,t,i){return di(e,t,i,"weekdaysShort")},t.normalizeUnits=U,t.relativeTimeRounding=function(e){return void 0===e?yi:"function"==typeof e&&(yi=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==bi[e]&&(void 0===t?bi[e]:(bi[e]=t,"s"===e&&(bi.ss=t-1),!0))},t.calendarFormat=function(e,t){return(e=e.diff(t,"days",!0))<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"},t.prototype=X,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t});var xdsoft_moveStart=!1,AnyTime="Anytime",TimeClick=!1,wHour=null;!function(){"use strict";var e,t,i,a,r,o;o=864e5,e=function(e,t){return"string"==typeof e&&"string"==typeof t&&e.toLowerCase()===t.toLowerCase()},t=function(e,i,a){var r=e.toString();return a=a||"0",r.length<i?t(a+r,i):r},i=function(e){var t,a;for(e=e||{},t=1;t<arguments.length;t++)if(a=arguments[t])for(var r in a)a.hasOwnProperty(r)&&("object"==typeof a[r]?i(e[r],a[r]):e[r]=a[r]);return e},a=function(e,t){for(var i=0;i<t.length;i++)if(t[i].toLowerCase()===e.toLowerCase())return i;return-1},r={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(e){var t=e%10,i={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(e%100/10)&&i[t]?i[t]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},(DateFormatter=function(e){var t=this,a=i(r,e);t.dateSettings=a.dateSettings,t.separators=a.separators,t.validParts=a.validParts,t.intParts=a.intParts,t.tzParts=a.tzParts,t.tzClip=a.tzClip}).prototype={constructor:DateFormatter,getMonth:function(e){var t;return 0===(t=a(e,this.dateSettings.monthsShort)+1)&&(t=a(e,this.dateSettings.months)+1),t},parseDate:function(t,i){var a,r,o,n,s,l,d,c,u,p,h=this,m=!1,f=!1,g=h.dateSettings,v={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!t)return null;if(t instanceof Date)return t;if("U"===i)return(o=parseInt(t))?new Date(1e3*o):t;switch(typeof t){case"number":return new Date(t);case"string":break;default:return null}if(!(a=i.match(h.validParts))||0===a.length)throw new Error("Invalid date format definition.");for(r=t.replace(h.separators,"\0").split("\0"),o=0;o<r.length;o++)switch(n=r[o],s=parseInt(n),a[o]){case"y":case"Y":if(!s)return null;u=n.length,v.year=2===u?parseInt((s<70?"20":"19")+n):s,m=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(!((l=h.getMonth(n))>0))return null;v.month=l}else{if(!(s>=1&&s<=12))return null;v.month=s}m=!0;break;case"d":case"j":if(!(s>=1&&s<=31))return null;v.day=s,m=!0;break;case"g":case"h":if(p=r[d=a.indexOf("a")>-1?a.indexOf("a"):a.indexOf("A")>-1?a.indexOf("A"):-1],-1!==d)c=e(p,g.meridiem[0])?0:e(p,g.meridiem[1])?12:-1,s>=1&&s<=12&&-1!==c?v.hour=s%12==0?c:s+c:s>=0&&s<=23&&(v.hour=s);else{if(!(s>=0&&s<=23))return null;v.hour=s}f=!0;break;case"G":case"H":if(!(s>=0&&s<=23))return null;v.hour=s,f=!0;break;case"i":if(!(s>=0&&s<=59))return null;v.min=s,f=!0;break;case"s":if(!(s>=0&&s<=59))return null;v.sec=s,f=!0}if(!0===m&&v.year&&v.month&&v.day)v.date=new Date(v.year,v.month-1,v.day,v.hour,v.min,v.sec,0);else{if(!0!==f)return null;v.date=new Date(0,0,0,v.hour,v.min,v.sec,0)}return v.date},guessDate:function(e,t){if("string"!=typeof e)return e;var i,a,r,o,n,s,l=e.replace(this.separators,"\0").split("\0"),d=t.match(this.validParts),c=new Date,u=0;if(!/^[djmn]/g.test(d[0]))return e;for(r=0;r<l.length;r++){if(u=2,n=l[r],s=parseInt(n.substr(0,2)),isNaN(s))return null;switch(r){case 0:"m"===d[0]||"n"===d[0]?c.setMonth(s-1):c.setDate(s);break;case 1:"m"===d[0]||"n"===d[0]?c.setDate(s):c.setMonth(s-1);break;case 2:if(a=c.getFullYear(),u=(i=n.length)<4?i:4,!(a=parseInt(i<4?a.toString().substr(0,4-i)+n:n.substr(0,4))))return null;c.setFullYear(a);break;case 3:c.setHours(s);break;case 4:c.setMinutes(s);break;case 5:c.setSeconds(s)}(o=n.substr(u)).length>0&&l.splice(r+1,0,o)}return c},parseFormat:function(e,i){var a,r=this,n=r.dateSettings,s=/\\?(.?)/gi,l=function(e,t){return a[e]?a[e]():t};return a={d:function(){return t(a.j(),2)},D:function(){return n.daysShort[a.w()]},j:function(){return i.getDate()},l:function(){return n.days[a.w()]},N:function(){return a.w()||7},w:function(){return i.getDay()},z:function(){var e=new Date(a.Y(),a.n()-1,a.j()),t=new Date(a.Y(),0,1);return Math.round((e-t)/o)},W:function(){var e=new Date(a.Y(),a.n()-1,a.j()-a.N()+3),i=new Date(e.getFullYear(),0,4);return t(1+Math.round((e-i)/o/7),2)},F:function(){return n.months[i.getMonth()]},m:function(){return t(a.n(),2)},M:function(){return n.monthsShort[i.getMonth()]},n:function(){return i.getMonth()+1},t:function(){return new Date(a.Y(),a.n(),0).getDate()},L:function(){var e=a.Y();return e%4==0&&e%100!=0||e%400==0?1:0},o:function(){var e=a.n(),t=a.W();return a.Y()+(12===e&&t<9?1:1===e&&t>9?-1:0)},Y:function(){return i.getFullYear()},y:function(){return a.Y().toString().slice(-2)},a:function(){return a.A().toLowerCase()},A:function(){var e=a.G()<12?0:1;return n.meridiem[e]},B:function(){var e=3600*i.getUTCHours(),a=60*i.getUTCMinutes(),r=i.getUTCSeconds();return t(Math.floor((e+a+r+3600)/86.4)%1e3,3)},g:function(){return a.G()%12||12},G:function(){return i.getHours()},h:function(){return t(a.g(),2)},H:function(){return t(a.G(),2)},i:function(){return t(i.getMinutes(),2)},s:function(){return t(i.getSeconds(),2)},u:function(){return t(1e3*i.getMilliseconds(),6)},e:function(){return/\((.*)\)/.exec(String(i))[1]||"Coordinated Universal Time"},I:function(){return new Date(a.Y(),0)-Date.UTC(a.Y(),0)!==new Date(a.Y(),6)-Date.UTC(a.Y(),6)?1:0},O:function(){var e=i.getTimezoneOffset(),a=Math.abs(e);return(e>0?"-":"+")+t(100*Math.floor(a/60)+a%60,4)},P:function(){var e=a.O();return e.substr(0,3)+":"+e.substr(3,2)},T:function(){return(String(i).match(r.tzParts)||[""]).pop().replace(r.tzClip,"")||"UTC"},Z:function(){return 60*-i.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(s,l)},r:function(){return"D, d M Y H:i:s O".replace(s,l)},U:function(){return i.getTime()/1e3||0}},l(e,e)},formatDate:function(e,t){var i,a,r,o,n,s=this,l="";if("string"==typeof e&&!(e=s.parseDate(e,t)))return null;if(e instanceof Date){for(r=t.length,i=0;i<r;i++)if("S"!==(n=t.charAt(i))&&"\\"!==n)if(i>0&&"\\"===t.charAt(i-1))l+=n;else{if("a"===n)if(i+1<r)if("t"===t.charAt(i+1)){l+=n;continue}if("t"===n)if(i+1<r)if("a"===t.charAt(i-1)){l+=n;continue}o=s.parseFormat(n,e),i!==r-1&&s.intParts.test(n)&&"S"===t.charAt(i+1)&&(a=parseInt(o)||0,o+=s.dateSettings.ordinal(a)),l+=o}return l}return""}}}(),function(e){"function"==typeof define&&define.amd?define(["jquery","jquery-mousewheel"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){"use strict";var t={i18n:{ar:{months:["كانون الثاني","شباط","آذار","نيسان","مايو","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],dayOfWeekShort:["ن","ث","ع","خ","ج","س","ح"],dayOfWeek:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت","الأحد"]},ro:{months:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"],dayOfWeekShort:["Du","Lu","Ma","Mi","Jo","Vi","Sâ"],dayOfWeek:["Duminică","Luni","Marţi","Miercuri","Joi","Vineri","Sâmbătă"]},id:{months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],dayOfWeekShort:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],dayOfWeek:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},is:{months:["Janúar","Febrúar","Mars","Apríl","Maí","Júní","Júlí","Ágúst","September","Október","Nóvember","Desember"],dayOfWeekShort:["Sun","Mán","Þrið","Mið","Fim","Fös","Lau"],dayOfWeek:["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"]},bg:{months:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"],dayOfWeekShort:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],dayOfWeek:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},fa:{months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],dayOfWeekShort:["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],dayOfWeek:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه","یک‌شنبه"]},ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeekShort:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],dayOfWeek:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},uk:{months:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"],dayOfWeekShort:["Ндл","Пнд","Втр","Срд","Чтв","Птн","Сбт"],dayOfWeek:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeekShort:["Su","Mo","Tu","We","Th","Fr","Sa"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},el:{months:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],dayOfWeekShort:["Κυρ","Δευ","Τρι","Τετ","Πεμ","Παρ","Σαβ"],dayOfWeek:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeekShort:["So","Mo","Di","Mi","Do","Fr","Sa"],dayOfWeek:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},nl:{months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],dayOfWeekShort:["zo","ma","di","wo","do","vr","za"],dayOfWeek:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],dayOfWeekShort:["Paz","Pts","Sal","Çar","Per","Cum","Cts"],dayOfWeek:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeekShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],dayOfWeek:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayOfWeekShort:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],dayOfWeek:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"]},th:{months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],dayOfWeekShort:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."],dayOfWeek:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัส","ศุกร์","เสาร์","อาทิตย์"]},pl:{months:["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],dayOfWeekShort:["nd","pn","wt","śr","cz","pt","sb"],dayOfWeek:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"]},pt:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeekShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"],dayOfWeek:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"]},ch:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeekShort:["日","一","二","三","四","五","六"]},se:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeekShort:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},km:{months:["មករា​","កុម្ភៈ","មិនា​","មេសា​","ឧសភា​","មិថុនា​","កក្កដា​","សីហា​","កញ្ញា​","តុលា​","វិច្ឋិកា​","ធ្នូ​"],dayOfWeekShort:["អាទិ​","ចន្ទ​","អង្គារ​","ពុធ​","ព្រហ​​","សុក្រ​","សៅរ៍"],dayOfWeek:["អាទិត្យ​","ចន្ទ​","អង្គារ​","ពុធ​","ព្រហស្បតិ៍​","សុក្រ​","សៅរ៍"]},kr:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeekShort:["일","월","화","수","목","금","토"],dayOfWeek:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],dayOfWeekShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],dayOfWeek:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]},da:{months:["January","Februar","Marts","April","Maj","Juni","July","August","September","Oktober","November","December"],dayOfWeekShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],dayOfWeek:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},no:{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],dayOfWeekShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],dayOfWeek:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"]},ja:{months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeekShort:["日","月","火","水","木","金","土"],dayOfWeek:["日曜","月曜","火曜","水曜","木曜","金曜","土曜"]},vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],dayOfWeekShort:["CN","T2","T3","T4","T5","T6","T7"],dayOfWeek:["Chủ nhật","Thứ hai","Thứ ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bảy"]},sl:{months:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"],dayOfWeekShort:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"],dayOfWeek:["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},cs:{months:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"],dayOfWeekShort:["Ne","Po","Út","St","Čt","Pá","So"]},hu:{months:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],dayOfWeekShort:["Va","Hé","Ke","Sze","Cs","Pé","Szo"],dayOfWeek:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"]},az:{months:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"],dayOfWeekShort:["B","Be","Ça","Ç","Ca","C","Ş"],dayOfWeek:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"]},bs:{months:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"],dayOfWeekShort:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],dayOfWeek:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},ca:{months:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"],dayOfWeekShort:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"],dayOfWeek:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"]},"en-GB":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeekShort:["Su","Mo","Tu","We","Th","Fr","Sa"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},et:{months:["Jaanuar","Veebruar","Märts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"],dayOfWeekShort:["P","E","T","K","N","R","L"],dayOfWeek:["Pühapäev","Esmaspäev","Teisipäev","Kolmapäev","Neljapäev","Reede","Laupäev"]},eu:{months:["Urtarrila","Otsaila","Martxoa","Apirila","Maiatza","Ekaina","Uztaila","Abuztua","Iraila","Urria","Azaroa","Abendua"],dayOfWeekShort:["Ig.","Al.","Ar.","Az.","Og.","Or.","La."],dayOfWeek:["Igandea","Astelehena","Asteartea","Asteazkena","Osteguna","Ostirala","Larunbata"]},fi:{months:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],dayOfWeekShort:["Su","Ma","Ti","Ke","To","Pe","La"],dayOfWeek:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},gl:{months:["Xan","Feb","Maz","Abr","Mai","Xun","Xul","Ago","Set","Out","Nov","Dec"],dayOfWeekShort:["Dom","Lun","Mar","Mer","Xov","Ven","Sab"],dayOfWeek:["Domingo","Luns","Martes","Mércores","Xoves","Venres","Sábado"]},hr:{months:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],dayOfWeekShort:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],dayOfWeek:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},ko:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeekShort:["일","월","화","수","목","금","토"],dayOfWeek:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},lt:{months:["Sausio","Vasario","Kovo","Balandžio","Gegužės","Birželio","Liepos","Rugpjūčio","Rugsėjo","Spalio","Lapkričio","Gruodžio"],dayOfWeekShort:["Sek","Pir","Ant","Tre","Ket","Pen","Šeš"],dayOfWeek:["Sekmadienis","Pirmadienis","Antradienis","Trečiadienis","Ketvirtadienis","Penktadienis","Šeštadienis"]},lv:{months:["Janvāris","Februāris","Marts","Aprīlis ","Maijs","Jūnijs","Jūlijs","Augusts","Septembris","Oktobris","Novembris","Decembris"],dayOfWeekShort:["Sv","Pr","Ot","Tr","Ct","Pk","St"],dayOfWeek:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"]},mk:{months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],dayOfWeekShort:["нед","пон","вто","сре","чет","пет","саб"],dayOfWeek:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},mn:{months:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],dayOfWeekShort:["Дав","Мяг","Лха","Пүр","Бсн","Бям","Ням"],dayOfWeek:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},"pt-BR":{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeekShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],dayOfWeek:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"]},sk:{months:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"],dayOfWeekShort:["Ne","Po","Ut","St","Št","Pi","So"],dayOfWeek:["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},sq:{months:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"],dayOfWeekShort:["Die","Hën","Mar","Mër","Enj","Pre","Shtu"],dayOfWeek:["E Diel","E Hënë","E Martē","E Mërkurë","E Enjte","E Premte","E Shtunë"]},"sr-YU":{months:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"],dayOfWeekShort:["Ned","Pon","Uto","Sre","čet","Pet","Sub"],dayOfWeek:["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},sr:{months:["јануар","фебруар","март","април","мај","јун","јул","август","септембар","октобар","новембар","децембар"],dayOfWeekShort:["нед","пон","уто","сре","чет","пет","суб"],dayOfWeek:["Недеља","Понедељак","Уторак","Среда","Четвртак","Петак","Субота"]},sv:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeekShort:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"],dayOfWeek:["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"]},"zh-TW":{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeekShort:["日","一","二","三","四","五","六"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},zh:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeekShort:["日","一","二","三","四","五","六"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},he:{months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],dayOfWeekShort:["א'","ב'","ג'","ד'","ה'","ו'","שבת"],dayOfWeek:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת","ראשון"]},hy:{months:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"],dayOfWeekShort:["Կի","Երկ","Երք","Չոր","Հնգ","Ուրբ","Շբթ"],dayOfWeek:["Կիրակի","Երկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},kg:{months:["Үчтүн айы","Бирдин айы","Жалган Куран","Чын Куран","Бугу","Кулжа","Теке","Баш Оона","Аяк Оона","Тогуздун айы","Жетинин айы","Бештин айы"],dayOfWeekShort:["Жек","Дүй","Шей","Шар","Бей","Жум","Ише"],dayOfWeek:["Жекшемб","Дүйшөмб","Шейшемб","Шаршемб","Бейшемби","Жума","Ишенб"]},rm:{months:["Schaner","Favrer","Mars","Avrigl","Matg","Zercladur","Fanadur","Avust","Settember","October","November","December"],dayOfWeekShort:["Du","Gli","Ma","Me","Gie","Ve","So"],dayOfWeek:["Dumengia","Glindesdi","Mardi","Mesemna","Gievgia","Venderdi","Sonda"]},ka:{months:["იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"],dayOfWeekShort:["კვ","ორშ","სამშ","ოთხ","ხუთ","პარ","შაბ"],dayOfWeek:["კვირა","ორშაბათი","სამშაბათი","ოთხშაბათი","ხუთშაბათი","პარასკევი","შაბათი"]}},ownerDocument:document,contentWindow:window,value:"",rtl:!1,format:"YYYY/M/D h:mm",formatTime:"h:mm",formatDate:"MMM DD,YYYY",startDate:!1,step:60,monthChangeSpinner:!0,closeOnDateSelect:!1,closeOnTimeSelect:!0,closeOnWithoutClick:!0,closeOnInputClick:!0,timepicker:!0,datepicker:!0,weeks:!1,defaultTime:!1,defaultDate:!1,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,disabledMinTime:!1,disabledMaxTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,theme:"",onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onGetWeekOfYear:function(){},onChangeYear:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,parentID:"body",timeHeightInTimePicker:34,timepickerScrollbar:!0,todayButton:!0,prevButton:!0,nextButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!1,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:2008,yearEnd:2050,monthStart:0,monthEnd:11,style:"",id:"",fixed:!1,roundTime:"round",className:"",weekends:[],highlightedDates:[],highlightedPeriods:[],allowDates:[],allowDateRe:null,disabledDates:[],disabledWeekDays:[],disabledTimePicker:[],yearOffset:0,beforeShowDay:null,enterLikeTab:!0,showOkCloseButtons:!0},i=null,a="en",r={meridiem:["AM","PM"]},o=function(){var o=t.i18n[a],n={days:o.dayOfWeek,daysShort:o.dayOfWeekShort,months:o.months,monthsShort:e.map(o.months,function(e){return e.substring(0,3)})};"function"==typeof DateFormatter&&(i=new DateFormatter({dateSettings:e.extend({},r,n)}))};function n(e,t,i){this.date=e,this.desc=t,this.style=i}e.datetimepicker={setLocale:function(e){var i=t.i18n[e]?e:"en";a!=i&&(a=i,o())},setDateFormatter:function(e){i=e},RFC_2822:"D, d M Y H:i:s O",ATOM:"Y-m-dTH:i:sP",ISO_8601:"Y-m-dTH:i:sO",RFC_822:"D, d M y H:i:s O",RFC_850:"l, d-M-y H:i:s T",RFC_1036:"D, d M y H:i:s O",RFC_1123:"D, d M Y H:i:s O",RSS:"D, d M Y H:i:s O",W3C:"Y-m-dTH:i:sP"},o(),window.getComputedStyle||(window.getComputedStyle=function(e,t){return this.el=e,this.getPropertyValue=function(t){var i=/(\-([a-z]){1})/g;return"float"===t&&(t="styleFloat"),i.test(t)&&(t=t.replace(i,function(e,t,i){return i.toUpperCase()})),e.currentStyle[t]||null},this}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var i,a;for(i=t||0,a=this.length;i<a;i+=1)if(this[i]===e)return i;return-1}),Date.prototype.countDaysInMonth=function(){return new Date(this.getFullYear(),this.getMonth()+1,0).getDate()},e.fn.xdsoftScroller=function(t,i){return this.each(function(){var a,r,o,n,s,l=e(this),d=function(e){var t,i={x:0,y:0};return"touchstart"===e.type||"touchmove"===e.type||"touchend"===e.type||"touchcancel"===e.type?(t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],i.x=t.clientX,i.y=t.clientY):"mousedown"!==e.type&&"mouseup"!==e.type&&"mousemove"!==e.type&&"mouseover"!==e.type&&"mouseout"!==e.type&&"mouseenter"!==e.type&&"mouseleave"!==e.type||(i.x=e.clientX,i.y=e.clientY),i},c=100,u=!1,p=0,h=0,m=0,f=!1,g=0,v=function(){};"hide"!==i?(e(this).hasClass("xdsoft_scroller_box")||(a=l.children().eq(0),r=l[0].clientHeight,o=a[0].offsetHeight,n=e('<div class="xdsoft_scrollbar"></div>'),s=e('<div class="xdsoft_scroller"></div>'),n.append(s),l.addClass("xdsoft_scroller_box").append(n),v=function(e){var t=d(e).y-p+g;t<0&&(t=0),t+s[0].offsetHeight>m&&(t=m-s[0].offsetHeight),l.trigger("scroll_element.xdsoft_scroller",[c?t/c:0])},s.on("touchstart.xdsoft_scroller mousedown.xdsoft_scroller",function(a){r||l.trigger("resize_scroll.xdsoft_scroller",[i]),p=d(a).y,g=parseInt(s.css("margin-top"),10),m=n[0].offsetHeight,"mousedown"===a.type||"touchstart"===a.type?(t.ownerDocument&&e(t.ownerDocument.body).addClass("xdsoft_noselect"),e([t.ownerDocument.body,t.contentWindow]).on("touchend mouseup.xdsoft_scroller",function i(){e([t.ownerDocument.body,t.contentWindow]).off("touchend mouseup.xdsoft_scroller",i).off("mousemove.xdsoft_scroller",v).removeClass("xdsoft_noselect")}),e(t.ownerDocument.body).on("mousemove.xdsoft_scroller",v)):(f=!0,a.stopPropagation(),a.preventDefault())}).on("touchmove",function(e){f&&(e.preventDefault(),v(e))}).on("touchend touchcancel",function(){f=!1,g=0}),l.on("scroll_element.xdsoft_scroller",function(e,t){r||l.trigger("resize_scroll.xdsoft_scroller",[t,!0]),t=t>1?1:t<0||isNaN(t)?0:t,s.css("margin-top",c*t),setTimeout(function(){a.css("marginTop",-parseInt((a[0].offsetHeight-r)*t,10))},10)}).on("resize_scroll.xdsoft_scroller",function(e,t,i){var d,u;r=l[0].clientHeight,o=a[0].offsetHeight,u=(d=r/o)*n[0].offsetHeight,d>1?s.hide():(s.show(),s.css("height",parseInt(u>10?u:10,10)),c=n[0].offsetHeight-s[0].offsetHeight,!0!==i&&l.trigger("scroll_element.xdsoft_scroller",[t||Math.abs(parseInt(a.css("marginTop"),10))/(o-r)]))}),l.on("mousewheel",function(e){var t=Math.abs(parseInt(a.css("marginTop"),10));return(t-=20*e.deltaY)<0&&(t=0),l.trigger("scroll_element.xdsoft_scroller",[t/(o-r)]),e.stopPropagation(),!1}),l.on("touchstart",function(e){u=d(e),h=Math.abs(parseInt(a.css("marginTop"),10))}),l.on("touchmove",function(e){if(u){e.preventDefault();var t=d(e);l.trigger("scroll_element.xdsoft_scroller",[(h-(t.y-u.y))/(o-r)])}}),l.on("touchend touchcancel",function(){u=!1,h=0})),l.trigger("resize_scroll.xdsoft_scroller",[i])):l.find(".xdsoft_scrollbar").hide()})},e.fn.datetimepicker=function(r,o){var s,l,d=this,c=17,u=46,p=13,h=27,m=37,f=38,g=39,v=40,A=9,C=116,y=65,b=67,S=86,k=90,D=89,_=!1,I=e.isPlainObject(r)||!r?e.extend(!0,{},t,r):e.extend(!0,{},t),w=0,P=!1;return s=function(t){I.id,e(window).on("click.xdsoft",function(e){void 0!==B&&null!=B&&B.trigger("close.xdsoft")}).on("blur.xdsoft",function(e){});var o,s,l,d,w,T,B=e('<div class="xdsoft_datetimepicker xdsoft_noselect vagaro-datepicker" aria-modal="true" aria-label="Anytime Today dialog" ></div>'),x=e('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),F=e('<div class="xdsoft_datepicker active"></div>'),O=e('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev" aria-label="previous month">&#xf104;</button><button type="button" class="xdsoft_today_button"></button><div class="xdsoft_label xdsoft_month" role="combobox" aria-expanded="true" aria-haspopup="listbox"><span></span><i>&#xf107;</i></div><div class="xdsoft_label xdsoft_year" role="combobox" aria-expanded="true" aria-haspopup="listbox"><span></span><i>&#xf107;</i></div><button type="button" class="xdsoft_next" aria-label="next month">&#xf105</button></div>'),M=e('<div class="xdsoft_calendar" aira-hidden="true"></div>'),E=e('<div class="xdsoft_timepicker active"><div class="hmanytime-text" onclick="AnyTimeDate(); return false;" ontouchstart="AnyTimeDate(); return false;" > Anytime </div><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),$=E.find(".xdsoft_time_box").eq(0),N=e('<div class="xdsoft_time_variant" role="listbox"></div>'),L=e('<button type="button" class="xdsoft_save_button w-button-primary w-button border-radius3px flamingo-button" tabindex="0">OK</button>'),U=e('<button type="button" class="xdsoft_cancel w-button-default w-button border-radius3px secondary-button" tabindex="0">Cancel</button>'),R=e('<div class="xdsoft_datepicker-buttons w-clearfix"></div>'),G=(U=e('<button type="button" class="xdsoft_cancel w-button-default w-button border-radius3px secondary-button" tabindex="0">Cancel</button>'),e('<div class="xdsoft_select xdsoft_monthselect" role="listbox"><div></div></div>')),W=e('<div class="xdsoft_select xdsoft_yearselect" role="listbox"><div></div></div>'),V=!1,j=0;function H(){var e,i=!1;return I.startDate?i=w.strToDate(I.startDate):(i=I.value||(t&&t.val&&t.val()?t.val():""))?i=w.strToDateTime(i):I.defaultDate&&(i=w.strToDateTime(I.defaultDate),I.defaultTime&&(e=w.strtotime(I.defaultTime),i.setHours(e.getHours()),i.setMinutes(e.getMinutes()))),i&&w.isValidDate(i)?B.data("changed",!0):i="",i||0}function Y(i){var a=function(e,t){var i=e.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,"\\$1").replace(/_/g,"{digit+}").replace(/([0-9]{1})/g,"{digit$1}").replace(/\{digit([0-9]{1})\}/g,"[0-$1_]{1}").replace(/\{digit[\+]\}/g,"[0-9_]{1}");return new RegExp(i).test(t)},r=function(e,t){if(!(e="string"==typeof e||e instanceof String?i.ownerDocument.getElementById(e):e))return!1;if(e.createTextRange){var a=e.createTextRange();return a.collapse(!0),a.moveEnd("character",t),a.moveStart("character",t),a.select(),!0}return!!e.setSelectionRange&&(e.setSelectionRange(t,t),!0)};i.mask&&t.off("keydown.xdsoft"),!0===i.mask&&("undefined"!=typeof moment?i.mask=i.format.replace(/Y{4}/g,"9999").replace(/Y{2}/g,"99").replace(/M{2}/g,"19").replace(/D{2}/g,"39").replace(/H{2}/g,"29").replace(/m{2}/g,"59").replace(/s{2}/g,"59"):i.mask=i.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59")),"string"===e.type(i.mask)&&(a(i.mask,t.val())||(t.val(i.mask.replace(/[0-9]/g,"_")),r(t[0],0)),t.on("keydown.xdsoft",function(o){var n,s,l=this.value,d=o.which;if(d>=48&&d<=57||d>=96&&d<=105||8===d||d===u){for(n=function(e){try{if(i.ownerDocument.selection&&i.ownerDocument.selection.createRange)return i.ownerDocument.selection.createRange().getBookmark().charCodeAt(2)-2;if(e.setSelectionRange)return e.selectionStart}catch(e){return 0}}(this),s=8!==d&&d!==u?String.fromCharCode(96<=d&&d<=105?d-48:d):"_",8!==d&&d!==u||!n||(n-=1,s="_");/[^0-9_]/.test(i.mask.substr(n,1))&&n<i.mask.length&&n>0;)n+=8===d||d===u?-1:1;if(l=l.substr(0,n)+s+l.substr(n+1),""===e.trim(l))l=i.mask.replace(/[0-9]/g,"_");else if(n===i.mask.length)return o.preventDefault(),!1;for(n+=8===d||d===u?0:1;/[^0-9_]/.test(i.mask.substr(n,1))&&n<i.mask.length&&n>0;)n+=8===d||d===u?-1:1;a(i.mask,l)?(this.value=l,r(this,n)):""===e.trim(l)?this.value=i.mask.replace(/[0-9]/g,"_"):t.trigger("error_input.xdsoft")}else if(-1!==[y,b,S,k,D].indexOf(d)&&_||-1!==[h,f,v,m,g,C,c,A,p].indexOf(d))return!0;return o.preventDefault(),!1}))}I.id&&B.attr("id",I.id),I.style&&B.attr("style",I.style),I.weeks&&B.addClass("xdsoft_showweeks"),I.rtl&&B.addClass("xdsoft_rtl"),B.addClass("xdsoft_"+I.theme),B.addClass(I.className),O.find(".xdsoft_month span").after(G),O.find(".xdsoft_year span").after(W),O.find(".xdsoft_month,.xdsoft_year").on("touchstart mousedown.xdsoft",function(t){var i,a,r=e(this).find(".xdsoft_select").eq(0),o=0,n=0,s=r.is(":visible");for(O.find(".xdsoft_select").hide(),(void 0===w.currentTime||null===w.currentTime||w.currentTime==AnyTime||e("#txtHomeServicesDate").length>0&&e("#txtHomeServicesDate").val().toLowerCase()==AnyTime.toLowerCase())&&(w.currentTime=w.now()),w.currentTime&&(o=w.currentTime[e(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),e(".scroller_custom").removeClass("scroller_custom"),s||e(this).addClass("scroller_custom"),r[s?"hide":"show"](),i=r.find("div.xdsoft_option"),a=0;a<i.length&&i.eq(a).data("value")!==o;a+=1)n+=i[0].offsetHeight;return r.xdsoftScroller(I,n/(r.children()[0].offsetHeight-r[0].clientHeight)),t.stopPropagation(),!1}),O.find(".xdsoft_select").xdsoftScroller(I).on("touchstart mousedown.xdsoft",function(e){e.stopPropagation(),e.preventDefault()}).on("touchmove",".xdsoft_option",function(e){xdsoft_moveStart=!0}).on("touchend mousedown.xdsoft",".xdsoft_option",function(){if(void 0===xdsoft_moveStart||1!=xdsoft_moveStart){(void 0===w.currentTime||null===w.currentTime||e("#txtHomeServicesDate").length>0&&e("#txtHomeServicesDate").val().toLowerCase()==AnyTime.toLowerCase())&&(w.currentTime=w.now(),e(".hmanytime-text").removeClass("xdsoft_current"));var t=w.currentTime.getFullYear();w&&w.currentTime&&w.currentTime[e(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](e(this).data("value")),e(this).parent().parent().hide(),e(this).parent().parent().parent().removeClass("scroller_custom"),B.trigger("xchange.xdsoft"),I.onChangeMonth&&e.isFunction(I.onChangeMonth)&&I.onChangeMonth.call(B,w.currentTime,B.data("input")),t!==w.currentTime.getFullYear()&&e.isFunction(I.onChangeYear)&&I.onChangeYear.call(B,w.currentTime,B.data("input"))}else xdsoft_moveStart=!1}),B.getValue=function(){return w.getCurrentTime()},B.setOptions=function(a){var r={};I=e.extend(!0,{},I,a),a.allowTimes&&e.isArray(a.allowTimes)&&a.allowTimes.length&&(I.allowTimes=e.extend(!0,[],a.allowTimes)),a.weekends&&e.isArray(a.weekends)&&a.weekends.length&&(I.weekends=e.extend(!0,[],a.weekends)),a.allowDates&&e.isArray(a.allowDates)&&a.allowDates.length&&(I.allowDates=e.extend(!0,[],a.allowDates)),a.allowDateRe&&"[object String]"===Object.prototype.toString.call(a.allowDateRe)&&(I.allowDateRe=new RegExp(a.allowDateRe)),a.highlightedDates&&e.isArray(a.highlightedDates)&&a.highlightedDates.length&&(e.each(a.highlightedDates,function(t,a){var o,s=e.map(a.split(","),e.trim),l=new n(i.parseDate(s[0],I.formatDate),s[1],s[2]),d=i.formatDate(l.date,I.formatDate);void 0!==r[d]?(o=r[d].desc)&&o.length&&l.desc&&l.desc.length&&(r[d].desc=o+"\n"+l.desc):r[d]=l}),I.highlightedDates=e.extend(!0,[],r)),a.highlightedPeriods&&e.isArray(a.highlightedPeriods)&&a.highlightedPeriods.length&&(r=e.extend(!0,[],I.highlightedDates),e.each(a.highlightedPeriods,function(t,a){var o,s,l,d,c,u,p;if(e.isArray(a))o=a[0],s=a[1],l=a[2],p=a[3];else{var h=e.map(a.split(","),e.trim);o=i.parseDate(h[0],I.formatDate),s=i.parseDate(h[1],I.formatDate),l=h[2],p=h[3]}for(;o<=s;)d=new n(o,l,p),c=i.formatDate(o,I.formatDate),o.setDate(o.getDate()+1),void 0!==r[c]?(u=r[c].desc)&&u.length&&d.desc&&d.desc.length&&(r[c].desc=u+"\n"+d.desc):r[c]=d}),I.highlightedDates=e.extend(!0,[],r)),a.disabledDates&&e.isArray(a.disabledDates)&&a.disabledDates.length&&(I.disabledDates=e.extend(!0,[],a.disabledDates)),a.disabledWeekDays&&e.isArray(a.disabledWeekDays)&&a.disabledWeekDays.length&&(I.disabledWeekDays=e.extend(!0,[],a.disabledWeekDays)),a.disabledTimePicker&&e.isArray(a.disabledTimePicker)&&a.disabledTimePicker.length&&I.disabledTimePicker.length>1&&(I.minTime=I.disabledTimePicker[0],I.maxTime=I.disabledTimePicker[1]),!I.open&&!I.opened||I.inline||t.trigger("open.xdsoft"),I.inline&&(V=!0,B.addClass("xdsoft_inline"),t.after(B).hide()),I.inverseButton&&(I.next="xdsoft_prev",I.prev="xdsoft_next"),I.datepicker?F.addClass("active"):F.removeClass("active"),I.timepicker?E.addClass("active"):E.removeClass("active"),I.value&&(w.setCurrentTime(I.value),t&&t.val&&t.val(w.str)),isNaN(I.dayOfWeekStart)?I.dayOfWeekStart=0:I.dayOfWeekStart=parseInt(I.dayOfWeekStart,10)%7,I.timepickerScrollbar||$.xdsoftScroller(I,"hide"),I.minDate&&/^[\+\-](.*)$/.test(I.minDate)&&(I.minDate=i.formatDate(w.strToDateTime(I.minDate),I.formatDate)),I.maxDate&&/^[\+\-](.*)$/.test(I.maxDate)&&(I.maxDate=i.formatDate(w.strToDateTime(I.maxDate),I.formatDate)),R.toggle(I.showOkCloseButtons),O.find(".xdsoft_today_button").css("display",I.todayButton?"block":"none"),O.find("."+I.prev).css("visibility",I.prevButton?"visible":"hidden"),O.find("."+I.next).css("visibility",I.nextButton?"visible":"hidden"),Y(I),I.validateOnBlur&&t.off("blur.xdsoft").on("blur.xdsoft",function(){if(I.allowBlank&&(!e.trim(e(this).val()).length||"string"==typeof I.mask&&e.trim(e(this).val())===I.mask.replace(/[0-9]/g,"_")))e(this).val(null),B.data("xdsoft_datetime").empty();else{var t=i.parseDate(e(this).val(),I.format);if(t)e(this).val(i.formatDate(t,I.format));else{var a=+[e(this).val()[0],e(this).val()[1]].join(""),r=+[e(this).val()[2],e(this).val()[3]].join("");!I.datepicker&&I.timepicker&&a>=0&&a<24&&r>=0&&r<60?e(this).val([a,r].map(function(e){return e>9?e:"0"+e}).join(":")):e(this).val(i.formatDate(w.now(),I.format))}B.data("xdsoft_datetime").setCurrentTime(e(this).val())}B.trigger("changedatetime.xdsoft"),B.trigger("close.xdsoft")}),I.dayOfWeekStartPrev=0===I.dayOfWeekStart?6:I.dayOfWeekStart-1,B.trigger("xchange.xdsoft").trigger("afterOpen.xdsoft")},B.data("options",I).on("touchstart mousedown.xdsoft",function(e){return e.stopPropagation(),e.preventDefault(),W.parent().removeClass("scroller_custom"),W.hide(),G.parent().removeClass("scroller_custom"),G.hide(),!1}),$.append(N),$.xdsoftScroller(I),B.on("afterOpen.xdsoft",function(){$.xdsoftScroller(I),e(".xdsoft_current").attr("tabindex",0),I.id&&(e(".xdsoft_current").find("div").attr("id","div_"+I.id),e(".xdsoft_current").attr("tabindex",0))}),B.append(F).append(E).append(R),!0!==I.withoutCopyright&&B.append(x),R.append(U).append(L),F.append(O).append(M),e(I.parentID).append(B),w=new function(){var t=this;t.now=function(e){var i,a,r=new Date;return!e&&I.defaultDate&&(i=t.strToDateTime(I.defaultDate),r.setDate(1),r.setFullYear(i.getFullYear()),r.setMonth(i.getMonth()),r.setDate(i.getDate())),I.yearOffset&&r.setFullYear(r.getFullYear()+I.yearOffset),!e&&I.defaultTime&&(a=t.strtotime(I.defaultTime),r.setHours(a.getHours()),r.setMinutes(a.getMinutes())),r},t.isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},t.setCurrentTime=function(e,i){"string"==typeof e?t.currentTime=t.strToDateTime(e):t.isValidDate(e)?t.currentTime=e:e||i||!I.allowBlank?t.currentTime=t.now():t.currentTime=null,B.trigger("xchange.xdsoft")},t.empty=function(){t.currentTime=null},t.getCurrentTime=function(e){return t.currentTime},t.nextMonth=function(){void 0!==t.currentTime&&null!==t.currentTime&&t.currentTime!==AnyTime||(t.currentTime=t.now()),e(".hmanytime-text").removeClass("xdsoft_current");var i,a=t.currentTime.getMonth()+1;return 12===a&&(t.currentTime.getFullYear()+1>I.yearEnd&&$this.removeClass(I.next),t.currentTime.setFullYear(t.currentTime.getFullYear()+1),a=0),i=t.currentTime.getFullYear(),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),a+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(a),I.onChangeMonth&&e.isFunction(I.onChangeMonth)&&I.onChangeMonth.call(B,w.currentTime,B.data("input")),i!==t.currentTime.getFullYear()&&e.isFunction(I.onChangeYear)&&I.onChangeYear.call(B,w.currentTime,B.data("input")),B.trigger("xchange.xdsoft"),a},t.prevMonth=function(){void 0!==t.currentTime&&null!==t.currentTime&&t.currentTime!==AnyTime||(t.currentTime=t.now());var i=t.currentTime.getMonth()-1;return-1===i&&(t.currentTime.getFullYear()-1<I.yearStart&&$this.removeClass(I.prev),t.currentTime.setFullYear(t.currentTime.getFullYear()-1),i=11),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),i+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(i),I.onChangeMonth&&e.isFunction(I.onChangeMonth)&&I.onChangeMonth.call(B,w.currentTime,B.data("input")),B.trigger("xchange.xdsoft"),i},t.getWeekOfYear=function(t){if(I.onGetWeekOfYear&&e.isFunction(I.onGetWeekOfYear)){var i=I.onGetWeekOfYear.call(B,t);if(void 0!==i)return i}var a=new Date(t.getFullYear(),0,1);return 4!=a.getDay()&&a.setMonth(0,1+(4-a.getDay()+7)%7),Math.ceil(((t-a)/864e5+a.getDay()+1)/7)},t.strToDateTime=function(e){var a,r,o=[];return e&&e instanceof Date&&t.isValidDate(e)?e:((o=/^(\+|\-)(.*)$/.exec(e))&&(o[2]=i.parseDate(o[2],I.formatDate)),o&&o[2]?(a=o[2].getTime()-6e4*o[2].getTimezoneOffset(),r=new Date(t.now(!0).getTime()+parseInt(o[1]+"1",10)*a)):(w.currentTime,r=null!=w.currentTime&&""!=w.currentTime?w.currentTime:e?i.parseDate(e,I.format):t.now()),t.isValidDate(r)||(r=t.now()),r)},t.strToDate=function(e){if(e&&e instanceof Date&&t.isValidDate(e))return e;var a=e?i.parseDate(e,I.formatDate):t.now(!0);return t.isValidDate(a)||(a=t.now(!0)),a},t.strtotime=function(e){if(e&&e instanceof Date&&t.isValidDate(e))return e;var a=e?i.parseDate(e,I.formatTime):t.now(!0);t.isValidDate(a)||(a=t.now(!0));try{"undefined"!=typeof _onlineCheckout&&void 0!==_onlineCheckout.currentTime&&null!=_onlineCheckout.currentTime&&(a=_onlineCheckout.objMin==e?_onlineCheckout.minDate:_onlineCheckout.currentTime)}catch(e){}return a},t.str=function(){return i.formatDate(t.currentTime,I.format)},t.currentTime=this.now()},L.on("touchend click",function(i){i.preventDefault(),B.data("changed",!0),void 0!==e("#txtHomeServicesDate")&&0!=e("#txtHomeServicesDate").length&&e("#txtHomeServicesDate").val().toLowerCase()==AnyTime.toLowerCase()&&e(".hmanytime-text").hasClass("xdsoft_current")||(w.setCurrentTime(H()),t.val(w.str()),TimeClick=!0,e("#btnSearchBuss").length>0&&e("#btnSearchBuss").attr("tabindex",-1).focus(),e("#ancSearchbook").length>0&&e("#ancSearchbook").attr("tabindex",-1).focus(),e("#divcheckoutSelectPaymentMethodTitle").length>0&&e("#divcheckoutSelectPaymentMethodTitle").attr("role","heading").attr("aria-live","polite").attr("tabindex",-1).focus(),e("#ancFilter").length>0&&e("#ancFilter").attr("tabindex",-1).focus()),B.trigger("close.xdsoft")}),U.on("touchend click",function(t){t.preventDefault(),B.trigger("close.xdsoft"),e("#btnSearchBuss").length>0&&e("#btnSearchBuss").attr("tabindex",-1).focus(),e("#ancSearchbook").length>0&&e("#ancSearchbook").attr("tabindex",-1).focus(),e("#divcheckoutSelectPaymentMethodTitle").length>0&&e("#divcheckoutSelectPaymentMethodTitle").attr("role","heading").attr("aria-live","polite").attr("tabindex",-1).focus(),e("#ancFilter").length>0&&e("#ancFilter").attr("tabindex",-1).focus()}),O.find(".xdsoft_today_button").on("touchend mousedown.xdsoft",function(){B.data("changed",!0),w.setCurrentTime(0,!0),B.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){var e,i,a=w.getCurrentTime();a=new Date(a.getFullYear(),a.getMonth(),a.getDate()),e=w.strToDate(I.minDate),a<(e=new Date(e.getFullYear(),e.getMonth(),e.getDate()))||(i=w.strToDate(I.maxDate),a>(i=new Date(i.getFullYear(),i.getMonth(),i.getDate()))||(t.val(w.str()),t.trigger("change"),B.trigger("close.xdsoft")))}),O.find(".xdsoft_prev,.xdsoft_next").on("touchend mousedown.xdsoft",function(){var t=e(this),i=0,a=!1;!function e(r){t.hasClass(I.next)?w.nextMonth():t.hasClass(I.prev)&&w.prevMonth(),I.monthChangeSpinner&&(a||(i=setTimeout(e,r||100)))}(500),e([I.ownerDocument.body,I.contentWindow]).on("touchend mouseup.xdsoft",function t(){clearTimeout(i),a=!0,e([I.ownerDocument.body,I.contentWindow]).off("touchend mouseup.xdsoft",t)})}),E.find(".xdsoft_prev,.xdsoft_next").on("touchend mousedown.xdsoft",function(){var t=e(this),i=0,a=!1,r=110;!function e(o){var n=$[0].clientHeight,s=N[0].offsetHeight,l=Math.abs(parseInt(N.css("marginTop"),10));t.hasClass(I.next)&&s-n-I.timeHeightInTimePicker>=l?N.css("marginTop","-"+(l+I.timeHeightInTimePicker)+"px"):t.hasClass(I.prev)&&l-I.timeHeightInTimePicker>=0&&N.css("marginTop","-"+(l-I.timeHeightInTimePicker)+"px"),$.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(N[0].style.marginTop,10)/(s-n))]),r=r>10?10:r-10,a||(i=setTimeout(e,o||r))}(500),e([I.ownerDocument.body,I.contentWindow]).on("touchend mouseup.xdsoft",function t(){clearTimeout(i),a=!0,e([I.ownerDocument.body,I.contentWindow]).off("touchend mouseup.xdsoft",t)})}),o=0,B.on("xchange.xdsoft",function(n){function s(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()}clearTimeout(o),void 0!==IdSearchServiceMain&&e(IdSearchServiceMain).length&&e(IdSearchServiceMain).data("select2")&&setTimeout(function(){e(IdSearchServiceMain).select2("close")},100),o=setTimeout(function(){var o=!1;if(void 0===w.currentTime||null===w.currentTime){if(I.allowBlank)return;w.currentTime=w.now()}w.currentTime===AnyTime&&(o=!0,w.currentTime=w.now()),!1!==I.minDateTime&&I.minDateTime>w.currentTime&&0==o&&null!=o&&void 0!==o&&(w.currentTime=new Date(I.minDateTime),t.val(w.str())),!1!==I.maxDate&&w.currentTime>I.maxDate&&(w.currentTime=new Date(I.maxDate),t.val(w.str()));for(var n,l,d,c,u,p,h,m,f,g,v="",A=new Date(w.currentTime.getFullYear(),w.currentTime.getMonth(),1,12,0,0),C=0,y=w.now(),b=!1,S=!1,k=[],D=!0,_="";A.getDay()!==I.dayOfWeekStart;)A.setDate(A.getDate()-1);for(v+='<table style="hyphens:manual;" role="grid"><thead><tr style="hyphens:manual;">',I.weeks&&(v+="<th></th>"),n=0;n<7;n+=1)v+='<th scope="col" abbr="'+I.i18n[a].dayOfWeek[(n+I.dayOfWeekStart)%7]+'" aria-label="'+I.i18n[a].dayOfWeek[(n+I.dayOfWeekStart)%7]+'"> <span aria-hidden="true">'+I.i18n[a].dayOfWeekShort[(n+I.dayOfWeekStart)%7]+"</span></th>";v+="</tr></thead>",v+="<tbody>",!1!==I.maxDate&&(b=w.strToDate(I.maxDate),b=new Date(b.getFullYear(),b.getMonth(),b.getDate(),23,59,59,999)),!1!==I.minDate&&(S=w.strToDate(I.minDate),S=new Date(S.getFullYear(),S.getMonth(),S.getDate()));try{if(void 0!==wHour&&null!=wHour&&0==TimeClick&&wHour.length>0&&w.currentTime.getDate()!=(new Date).getDate()&&w.currentTime.getMonth()==(new Date).getMonth()&&w.currentTime.getFullYear()==(new Date).getFullYear()){var P=new Date(w.currentTime).getDay()+1,T=wHour.filter(function(e){return e.DayID===P})[0];new Date(w.currentTime.setHours(Converttimeformat(T.FromTime))),new Date(w.currentTime.setMinutes(ConverttimeformattoMiniut(T.FromTime))),t.val(w.str())}TimeClick=!1}catch(e){}for(;C<w.currentTime.countDaysInMonth()||A.getDay()!==I.dayOfWeekStart||w.currentTime.getMonth()===A.getMonth();){k=[],C+=1,d=A.getDay(),c=A.getDate(),u=A.getFullYear(),p=A.getMonth(),h=w.getWeekOfYear(A),g="",k.push("xdsoft_date"),m=I.beforeShowDay&&e.isFunction(I.beforeShowDay.call)?I.beforeShowDay.call(B,A):null,I.allowDateRe&&"[object RegExp]"===Object.prototype.toString.call(I.allowDateRe)?I.allowDateRe.test(i.formatDate(A,I.formatDate))||k.push("xdsoft_disabled"):I.allowDates&&I.allowDates.length>0?-1===I.allowDates.indexOf(i.formatDate(A,I.formatDate))&&k.push("xdsoft_disabled"):(!1!==b&&A>b||!1!==S&&A<S||m&&!1===m[0]||-1!==I.disabledDates.indexOf(i.formatDate(A,I.formatDate))||-1!==I.disabledWeekDays.indexOf(d)||t.is("[readonly]"))&&k.push("xdsoft_disabled"),m&&""!==m[1]&&k.push(m[1]),w.currentTime.getMonth()!==p&&k.push("xdsoft_other_month"),(I.defaultSelect||B.data("changed"))&&i.formatDate(w.currentTime,I.formatDate)===i.formatDate(A,I.formatDate)&&k.push("xdsoft_current"),i.formatDate(y,I.formatDate)===i.formatDate(A,I.formatDate)&&k.push("xdsoft_today"),0!==A.getDay()&&6!==A.getDay()&&-1===I.weekends.indexOf(i.formatDate(A,I.formatDate))||k.push("xdsoft_weekend"),void 0!==I.highlightedDates[i.formatDate(A,I.formatDate)]&&(l=I.highlightedDates[i.formatDate(A,I.formatDate)],k.push(void 0===l.style?"xdsoft_highlighted_default":l.style),g=void 0===l.desc?"":l.desc),I.beforeShowDay&&e.isFunction(I.beforeShowDay)&&k.push(I.beforeShowDay(A)),D&&(v+='<tr style="hyphens:manual;">',D=!1,I.weeks&&(v+="<th>"+h+"</th>"));var x="",F="",E=" tabindex='-1'",$="";"function"==typeof moment&&(F=" aria-label='"+moment(new Date(u,p,c)).format("dddd, MMM D, YYYY")+"'"),void 0!==k&&null!=k&&k.length>0&&(k.indexOf("xdsoft_current")>-1&&(E=" tabindex='0'",x=" aria-selected='true'"),k.indexOf("xdsoft_disabled")>-1&&(E=" tabindex='-1'",F=" aria-label='Booking is not available on "+moment(new Date(u,p,c)).format("dddd, MMM D, YYYY")+"'")),((new Date).getMonth()<=p||(new Date).getFullYear()<=u)&&!k.indexOf("xdsoft_disabled")>-1&&(E="tabindex='0'"),v+='<td data-date="'+c+'" data-month="'+p+'" data-year="'+u+'" class="xdsoft_date xdsoft_day_of_week'+A.getDay()+" "+k.join(" ")+'" aria-live="off" title="'+g+'" '+E+" "+x+" "+F+' onclick="javascript:_xdsoft_dateid('+c+')"><div aria-hidden="true">'+c+"</div></td>",A.getDay()===I.dayOfWeekStartPrev&&(v+="</tr>",D=!0),A.setDate(c+1)}if(v+="</tbody></table>",M.html(v),O.find(".xdsoft_label span").eq(0).text(I.i18n[a].months[w.currentTime.getMonth()]),O.find(".xdsoft_label span").eq(1).text(w.currentTime.getFullYear()),_="",p="",f=function(a,r){var o,n,l,d,c=w.now(),u=I.allowTimes&&e.isArray(I.allowTimes)&&I.allowTimes.length;c.setHours(a),a=parseInt(c.getHours(),10),c.setMinutes(r),c.setSeconds(0),c.setMilliseconds(0),r=parseInt(c.getMinutes(),10),(l=new Date(w.currentTime)).setHours(a),l.setMinutes(r),l.setSeconds(0),l.setMilliseconds(0),k=[],window.location.href.includes("/shopping-bag")?!1!==I.minDateTime&&I.minDateTime>l||!1!==I.maxTime&&s(w.strtotime(I.maxTime))<s(c)||!1!==I.minTime&&s(w.strtotime(I.minTime))>s(c)||!1!==I.minDateTime&&I.minDateTime>l||!1!==I.disabledMinTime&&c.getTime()>w.strtotime(I.disabledMinTime).getTime()&&!1!==I.disabledMaxTime&&c.getTime()<w.strtotime(I.disabledMaxTime).getTime()||t.is("[readonly]")?(k.push("xdsoft_disabled"),o=" tabindex='-1'",n=" aria-hidden='true' "):(o=" tabindex='0'",n=" aria-hidden='false' "):!1!==I.minDateTime&&I.minDateTime>l||!1!==I.maxTime&&w.strtotime(I.maxTime).getTime()<c.getTime()||!1!==I.minTime&&w.strtotime(I.minTime).getTime()>c.getTime()||!1!==I.minDateTime&&I.minDateTime>l||!1!==I.disabledMinTime&&c.getTime()>w.strtotime(I.disabledMinTime).getTime()&&!1!==I.disabledMaxTime&&c.getTime()<w.strtotime(I.disabledMaxTime).getTime()||t.is("[readonly]")||!1!==I.maxDate&&l>I.maxDate?(k.push("xdsoft_disabled"),o=" tabindex='-1'",n=" aria-hidden='true' "):(o=" tabindex='0'",n=" aria-hidden='false' "),(d=new Date(w.currentTime)).setHours(parseInt(w.currentTime.getHours(),10)),u||d.setMinutes(Math[I.roundTime](w.currentTime.getMinutes()/I.step)*I.step),(I.initTime||I.defaultSelect||B.data("changed"))&&d.getHours()===parseInt(a,10)&&(!u&&I.step>59||d.getMinutes()===parseInt(r,10))&&(I.defaultSelect||B.data("changed")?(k.push("xdsoft_current"),e(".xdsoft_date.xdsoft_current").focus()):I.initTime&&k.push("xdsoft_init_time")),parseInt(y.getHours(),10)===parseInt(a,10)&&parseInt(y.getMinutes(),10)===parseInt(r,10)&&k.push("xdsoft_today"),$="xdsoft_current"==k?"aria-selected='true'":"",_+='<div class="xdsoft_time '+k.join(" ")+'" data-hour="'+a+'" data-minute="'+r+'" role="option" aria-label="'+i.formatDate(c,I.formatTime)+'" '+o+" "+n+" "+$+' "onclick="javascript:_xdsoft_timeid('+i.formatDate(c,I.formatTime)+')" >'+i.formatDate(c,I.formatTime)+"</div>"},I.allowTimes&&e.isArray(I.allowTimes)&&I.allowTimes.length)for(C=0;C<I.allowTimes.length;C+=1)f(w.strtotime(I.allowTimes[C]).getHours(),p=w.strtotime(I.allowTimes[C]).getMinutes());else for(C=0,n=0;C<(I.hours12?12:24);C+=1)for(n=0;n<60;n+=I.step)f((C<10?"0":"")+C,p=(n<10?"0":"")+n);for(N.html(_),r="",C=0,C=parseInt(I.yearStart,10)+I.yearOffset;C<=parseInt(I.yearEnd,10)+I.yearOffset;C+=1)r+='<div class="xdsoft_option '+(w.currentTime.getFullYear()===C?"xdsoft_current":"")+'" data-value="'+C+'"  role="option">'+C+"</div>";for(W.children().eq(0).html(r),C=parseInt(I.monthStart,10),r="";C<=parseInt(I.monthEnd,10);C+=1)r+='<div class="xdsoft_option '+(w.currentTime.getMonth()===C?"xdsoft_current":"")+'" data-value="'+C+'" role="option">'+I.i18n[a].months[C]+"</div>";G.children().eq(0).html(r),e(B).trigger("generate.xdsoft"),o?(e("#txtHomeServicesDate").length>0&&e("#txtHomeServicesDate").val(AnyTime),e(".hmanytime-text").addClass("xdsoft_current"),e(".xdsoft_time_variant .xdsoft_current").removeClass("xdsoft_current"),e(".xdsoft_calendar .xdsoft_current").removeClass("xdsoft_current")):e(".hmanytime-text").removeClass("xdsoft_current")},10),n.stopPropagation(),e("#div_txtHomeServicesDate_picker").attr("tabindex",-1),e("#div_txtHomeServicesDate_picker").focus()}).on("afterOpen.xdsoft",function(){var e,t,i,a;I.timepicker&&(N.find(".xdsoft_current").length?e=".xdsoft_current":N.find(".xdsoft_init_time").length&&(e=".xdsoft_init_time"),e?(t=$[0].clientHeight,(i=N[0].offsetHeight)-t<(a=N.find(e).index()*I.timeHeightInTimePicker)&&(a=i-t),$.trigger("scroll_element.xdsoft_scroller",[parseInt(a,10)/(i-t)])):$.trigger("scroll_element.xdsoft_scroller",[0]))}),s=0,M.on("touchend click.xdsoft","td",function(i){i.stopPropagation(),s+=1;var a=e(this),r=w.currentTime;if(null!=r&&r!=AnyTime||(w.currentTime=w.now(),r=w.currentTime),a.hasClass("xdsoft_disabled"))return!1;r.setDate(1),r.setFullYear(a.data("year")),r.setMonth(a.data("month")),r.setDate(a.data("date")),B.trigger("select.xdsoft",[r]),t.val(w.str()),t.focus(),I.onSelectDate&&e.isFunction(I.onSelectDate)&&I.onSelectDate.call(B,w.currentTime,B.data("input"),i),I.disabledTimePicker&&null!=I.disabledTimePicker&&e.isArray(I.disabledTimePicker)&&void 0!==r&&void 0!==I.disabledTimePicker&&I.disabledTimePicker.length&&I.disabledTimePicker.length>1&&(I.minTime=I.disabledTimePicker[0],I.maxTime=I.disabledTimePicker[1]),B.data("changed",!0),B.trigger("xchange.xdsoft"),B.trigger("changedatetime.xdsoft"),(s>1||!0===I.closeOnDateSelect||!1===I.closeOnDateSelect&&!I.timepicker)&&!I.inline&&B.trigger("close.xdsoft");var o=200;void 0!==I.id&&null!=I.id&&"txtpickupdatetime_picker"==I.id.toLowerCase()&&(o=1200),setTimeout(function(){e("div.xdsoft_time.xdsoft_current").focus()},o),setTimeout(function(){s=0},200),e(".hmanytime-text").removeClass("xdsoft_current")}).on("focus.xdsoft","td",function(t){e(".xdsoft_date").removeAttr("id"),e(".xdsoft_date").find("div").removeAttr("aria-selected"),e(t.currentTarget).attr("tabindex",0),I.id&&e(t.currentTarget).find("div").attr("id","div_"+I.id),e(t.currentTarget).find("div").attr("aria-selected",!0)}).on("keypress.xdsoft","td",function(i){if(13===i.keyCode){i.stopPropagation(),s+=1;var a=e(this),r=w.currentTime;if(null!=r&&r!=AnyTime||(w.currentTime=w.now(),r=w.currentTime),a.hasClass("xdsoft_disabled"))return!1;r.setDate(1),r.setFullYear(a.data("year")),r.setMonth(a.data("month")),r.setDate(a.data("date")),B.trigger("select.xdsoft",[r]),t.val(w.str()),I.onSelectDate&&e.isFunction(I.onSelectDate)&&I.onSelectDate.call(B,w.currentTime,B.data("input"),i),I.disabledTimePicker&&null!=I.disabledTimePicker&&e.isArray(I.disabledTimePicker)&&void 0!==r&&void 0!==I.disabledTimePicker&&I.disabledTimePicker.length&&I.disabledTimePicker.length>1&&(I.minTime=I.disabledTimePicker[0],I.maxTime=I.disabledTimePicker[1]),B.data("changed",!0),B.trigger("xchange.xdsoft"),B.trigger("changedatetime.xdsoft"),(s>1||!0===I.closeOnDateSelect||!1===I.closeOnDateSelect&&!I.timepicker)&&!I.inline&&B.trigger("close.xdsoft"),setTimeout(function(){s=0,e("div.xdsoft_time.xdsoft_current").focus()},200),e(".hmanytime-text").removeClass("xdsoft_current")}}),N.on("touchend click.xdsoft","div",function(t){t.stopPropagation();var i=e(this),a=w.currentTime;if(null!=a&&a!==AnyTime||(w.currentTime=w.now(),a=w.currentTime),i.hasClass("xdsoft_disabled"))return!1;a.setHours(i.data("hour")),a.setMinutes(i.data("minute")),B.trigger("select.xdsoft",[a]),B.data("input").val(w.str()),TimeClick=!0,I.onSelectTime&&e.isFunction(I.onSelectTime)&&I.onSelectTime.call(B,w.currentTime,B.data("input"),t),B.data("changed",!0),B.trigger("xchange.xdsoft"),B.trigger("changedatetime.xdsoft"),!0!==I.inline&&!0===I.closeOnTimeSelect&&B.trigger("close.xdsoft"),e(".hmanytime-text").removeClass("xdsoft_current"),setTimeout(function(){e(".xdsoft_cancel").focus()},10)}),F.on("mousewheel.xdsoft",function(e){return!I.scrollMonth||(e.deltaY<0?w.nextMonth():w.prevMonth(),!1)}),t.on("mousewheel.xdsoft",function(e){return!I.scrollInput||(!I.datepicker&&I.timepicker?((l=N.find(".xdsoft_current").length?N.find(".xdsoft_current").eq(0).index():0)+e.deltaY>=0&&l+e.deltaY<N.children().length&&(l+=e.deltaY),N.children().eq(l).length&&N.children().eq(l).trigger("mousedown"),!1):I.datepicker&&!I.timepicker?(F.trigger(e,[e.deltaY,e.deltaX,e.deltaY]),t.val&&t.val(w.str()),B.trigger("changedatetime.xdsoft"),!1):void 0)}),B.on("changedatetime.xdsoft",function(t){if(I.onChangeDateTime&&e.isFunction(I.onChangeDateTime)){var i=B.data("input");I.onChangeDateTime.call(B,w.currentTime,i,t),delete I.value,i.trigger("change")}}).on("generate.xdsoft",function(){I.onGenerate&&e.isFunction(I.onGenerate)&&I.onGenerate.call(B,w.currentTime,B.data("input")),V&&(B.trigger("afterOpen.xdsoft"),V=!1)}).on("click.xdsoft",function(e){e.stopPropagation()}),l=0,T=function(e,t){do{if(!1===t(e=e.parentNode))break}while("HTML"!==e.nodeName)},d=function(){var t,i,a,r,o,n,s,l,d,c,u,p,h;if(t=(l=B.data("input")).offset(),i=l[0],c="top",a=t.top+i.offsetHeight-1,r=t.left,o="absolute",d=e(I.contentWindow).width(),p=e(I.contentWindow).height(),h=e(I.contentWindow).scrollTop(),I.ownerDocument.documentElement.clientWidth-t.left<F.parent().outerWidth(!0)){var m=F.parent().outerWidth(!0)-i.offsetWidth;r-=m}"rtl"===l.parent().css("direction")&&(r-=B.outerWidth()-l.outerWidth()),I.fixed?(a-=h,r-=e(I.contentWindow).scrollLeft(),o="fixed"):(s=!1,T(i,function(e){if("fixed"===window.getComputedStyle(e).getPropertyValue("position"))return s=!0,!1}),s?(o="fixed",a+B.outerHeight()>p+h?(c="bottom",a=p+h-t.top):a-=h):a+i.offsetHeight>p+h&&(a=t.top-i.offsetHeight+1),a<0&&(a=0),r+i.offsetWidth>d&&(r=d-i.offsetWidth)),n=B[0],T(n,function(e){if("relative"===window.getComputedStyle(e).getPropertyValue("position")&&d>=e.offsetWidth)return r-=(d-e.offsetWidth)/2,!1}),(u={position:o,left:r,top:"",bottom:""})[c]=a,B.css(u)},B.on("open.xdsoft",function(t){var i=!0;I.onShow&&e.isFunction(I.onShow)&&(void 0!==e("#txtHomeServicesDate")&&e("#txtHomeServicesDate").length>0&&e("#txtHomeServicesDate").val().toLowerCase()==AnyTime.toLowerCase()&&w.currentTime<w.now()&&(w.currentTime=AnyTime,e(".hmanytime-text").addClass("xdsoft_current"),e(".xdsoft_time_variant .xdsoft_current").removeClass("xdsoft_current"),e(".xdsoft_calendar .xdsoft_current").removeClass("xdsoft_current")),i=I.onShow.call(B,w.currentTime,B.data("input"),t)),!1!==i&&(B.show(),d(),e(I.contentWindow).off("resize.xdsoft").on("resize.xdsoft",d).off("scroll.xdsoft").on("scroll.xdsoft",d),I.closeOnWithoutClick&&"open"!=t.type&&e([I.ownerDocument.body,I.contentWindow]).on("touchstart mousedown.xdsoft",function t(){B.trigger("close.xdsoft"),e([I.ownerDocument.body,I.contentWindow]).off("touchstart mousedown.xdsoft",t)}))}).on("close.xdsoft",function(t){null!=I.allowDates&&I.allowDates.length>0&&-1===I.allowDates.indexOf(w.currentTime.format(I.formatDate))&&(w.currentTime=new Date(moment(I.allowDates[0])._d));var i=!0;O.find(".xdsoft_month,.xdsoft_year").find(".xdsoft_select").hide(),O.find(".xdsoft_month,.xdsoft_year").removeClass("scroller_custom"),I.onClose&&e.isFunction(I.onClose)&&(i=I.onClose.call(B,w.currentTime,B.data("input"),t)),!1===i||I.opened||I.inline||B.hide(),P=!1,t.stopPropagation()}).on("toggle.xdsoft",function(){B.is(":visible")?B.trigger("close.xdsoft"):B.trigger("open.xdsoft")}).data("input",t),j=0,B.data("xdsoft_datetime",w),B.setOptions(I),w.setCurrentTime(H()),t.data("xdsoft_datetimepicker",B).on("open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart",function(){t.is(":disabled")||t.data("xdsoft_datetimepicker").is(":visible")&&I.closeOnInputClick||(clearTimeout(j),j=setTimeout(function(){t.is(":disabled")||(P=!0,V=!0,w.setCurrentTime(H(),!0),I.mask&&Y(I),B.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(t){var i,a=t.which;return-1!==[p].indexOf(a)&&I.enterLikeTab?(i=e("input:visible,textarea:visible,button:visible,a:visible"),B.trigger("close.xdsoft"),i.eq(i.index(this)+1),!1):-1!==[A].indexOf(a)?(B.trigger("close.xdsoft"),!0):void 0}).on("blur.xdsoft",function(){}).on("click.xdsoft",function(e){e.stopPropagation()}).closest("div").on("click.xdsoft",function(e){e.stopPropagation()}),"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&navigator.userAgent.toLowerCase().indexOf("com.vagaro")>-1&&e(".page-form-wrapper, .pagebodycontainer,.wrap-page").on("touchstart",function(){1==P&&B.trigger("close.xdsoft")}),"undefined"!=typeof navigator&&null!=navigator&&void 0!==navigator.userAgent&&null!=navigator.userAgent&&navigator.userAgent.toLowerCase().match(/safari/i)&&navigator.userAgent.toLowerCase().match(/mac/i)&&e(".page-form-wrapper, .pagebodycontainer,.wrap-page").on("mousedown",function(){1==P&&B.trigger("close.xdsoft")})},l=function(t){e(window).off("click.xdsoft"),e(window).off("blur.xdsoft");var i=t.data("xdsoft_datetimepicker");i&&(i.data("xdsoft_datetime",null),i.remove(),t.data("xdsoft_datetimepicker",null).off(".xdsoft"),t.off("click.xdsoft"),t.closest("div").off("click.xdsoft"),e(I.contentWindow).off("resize.xdsoft"),e(I.contentWindow).off("scroll.xdsoft"),e([I.contentWindow,I.ownerDocument.body]).off("mousedown.xdsoft touchstart"),t.unmousewheel&&t.unmousewheel())},e(I.ownerDocument).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(e){e.keyCode===c&&(_=!0)}).on("keyup.xdsoftctrl",function(e){e.keyCode===c&&(_=!1)}),this.each(function(){var t,a=e(this).data("xdsoft_datetimepicker");if(a){if("string"===e.type(r))switch(r){case"show":e(this).select().focus(),a.trigger("open.xdsoft");break;case"hide":a.trigger("close.xdsoft");break;case"toggle":a.trigger("toggle.xdsoft");break;case"destroy":l(e(this));break;case"reset":this.value=this.defaultValue,this.value&&a.data("xdsoft_datetime").isValidDate(i.parseDate(this.value,I.format))||a.data("changed",!1),a.data("xdsoft_datetime").setCurrentTime(this.value);break;case"validate":a.data("input").trigger("blur.xdsoft");break;default:a[r]&&e.isFunction(a[r])&&(d=a[r](o))}else a.setOptions(r);return 0}"string"!==e.type(r)&&(!I.lazyInit||I.open||I.inline?s(e(this)):(t=e(this)).on("open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart",function e(){t.is(":disabled")||t.data("xdsoft_datetimepicker")||(clearTimeout(w),w=setTimeout(function(){t.data("xdsoft_datetimepicker")||s(t),t.off("open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart",e).trigger("open.xdsoft")},100))}))}),d},e.fn.datetimepicker.defaults=t}),
/*!
 * jQuery Mousewheel 3.1.13
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 */
function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){var t,i,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],o=Array.prototype.slice;if(e.event.fixHooks)for(var n=a.length;n;)e.event.fixHooks[a[--n]]=e.event.mouseHooks;var s=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var t=r.length;t;)this.addEventListener(r[--t],l,!1);else this.onmousewheel=l;e.data(this,"mousewheel-line-height",s.getLineHeight(this)),e.data(this,"mousewheel-page-height",s.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=r.length;t;)this.removeEventListener(r[--t],l,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function l(a){var r,n=a||window.event,l=o.call(arguments,1),u=0,p=0,h=0,m=0,f=0;if((a=e.event.fix(n)).type="mousewheel","detail"in n&&(h=-1*n.detail),"wheelDelta"in n&&(h=n.wheelDelta),"wheelDeltaY"in n&&(h=n.wheelDeltaY),"wheelDeltaX"in n&&(p=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(p=-1*h,h=0),u=0===h?p:h,"deltaY"in n&&(u=h=-1*n.deltaY),"deltaX"in n&&(p=n.deltaX,0===h&&(u=-1*p)),0!==h||0!==p){if(1===n.deltaMode){var g=e.data(this,"mousewheel-line-height");u*=g,h*=g,p*=g}else if(2===n.deltaMode){var v=e.data(this,"mousewheel-page-height");u*=v,h*=v,p*=v}if(r=Math.max(Math.abs(h),Math.abs(p)),(!i||r<i)&&(i=r,c(n,r)&&(i/=40)),c(n,r)&&(u/=40,p/=40,h/=40),u=Math[u>=1?"floor":"ceil"](u/i),p=Math[p>=1?"floor":"ceil"](p/i),h=Math[h>=1?"floor":"ceil"](h/i),s.settings.normalizeOffset&&this.getBoundingClientRect){var A=this.getBoundingClientRect();m=a.clientX-A.left,f=a.clientY-A.top}return a.deltaX=p,a.deltaY=h,a.deltaFactor=i,a.offsetX=m,a.offsetY=f,a.deltaMode=0,l.unshift(a,u,p,h),t&&clearTimeout(t),t=setTimeout(d,200),(e.event.dispatch||e.event.handle).apply(this,l)}}function d(){i=null}function c(e,t){return s.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}}),_xdsoft_dateid=function(t){e("#txtdivSearchDate").length},_xdsoft_timeid=function(e){}}),
/*!
 * jQuery MobiScroll v2.6.2
 * http://mobiscroll.com
 *
 * Copyright 2010-2013, Acid Media
 * Licensed under the MIT license.
 *
 */
function(e){function t(t,i){var s,c,h,g,_,I,w,P,T,B,x,F,O,M,E,$,N,L,U,R,G,W,V,j,H,Y,Z,z,X=this,q=e.mobiscroll,J=t,Q=e(J),K=y({},D),ee={},te={},ie={},ae={},re=[],oe=Q.is("input"),ne=!1,se=function(t){!a(t)||l||ge(this)||E||(t.preventDefault(),l=!0,$="clickpick"!=K.mode,Ae(j=e(".dw-ul",this)),N=void 0!==te[H],G=N?function(t){var i,a,r=window.getComputedStyle?getComputedStyle(t[0]):t[0].style;v?(e.each(["t","webkitT","MozT","OT","msT"],function(e,t){if(void 0!==r[t+"ransform"])return i=r[t+"ransform"],!1}),a=(i=i.split(")")[0].split(", "))[13]||i[5]):a=r.top.replace("px","");return Math.round(s-a/c)}(j):ie[H],L=r(t,"Y"),U=new Date,R=L,be(j,H,G,.001),$&&j.closest(".dwwl").addClass("dwa"),e(document).on(S,le).on(k,de))},le=function(e){$&&(e.preventDefault(),e.stopPropagation(),R=r(e,"Y"),be(j,H,o(G+(L-R)/c,W-1,V+1))),N=!0},de=function(t){var i,a,r,n=new Date-U,s=o(G+(L-R)/c,W-1,V+1),d=j.offset().top;if(n<300?(a=(i=(R-L)/n)*i/K.speedUnit,R-L<0&&(a=-a)):a=R-L,r=Math.round(G-a/c),!a&&!N){var u=Math.floor((R-d)/c),p=e(".dw-li",j).eq(u),h=$;!1!==ke("onValueTap",[p])?r=u:h=!0,h&&(p.addClass("dw-hl"),setTimeout(function(){p.removeClass("dw-hl")},200))}$&&De(j,r,0,!0,Math.round(s)),l=!1,j=null,e(document).off(S,le).off(k,de)},ce=function(t){var i=e(this);e(document).on(k,ue),i.hasClass("dwb-d")||i.addClass("dwb-a"),setTimeout(function(){i.blur()},10),i.hasClass("dwwb")&&a(t)&&fe(t,i.closest(".dwwl"),i.hasClass("dwwbp")?_e:Ie)},ue=function(t){E&&(clearInterval(Y),E=!1),e(document).off(k,ue),e(".dwb-a",g).removeClass("dwb-a")},pe=function(t){38==t.keyCode?fe(t,e(this),Ie):40==t.keyCode&&fe(t,e(this),_e)},he=function(e){E&&(clearInterval(Y),E=!1)},me=function(t){if(!ge(this)){t.preventDefault();var i=(t=t.originalEvent||t).wheelDelta?t.wheelDelta/120:t.detail?-t.detail/3:0,a=e(".dw-ul",this);Ae(a),De(a,Math.round(ie[H]-i),i<0?1:2)}};function fe(e,t,i){if(e.stopPropagation(),e.preventDefault(),!E&&!ge(t)&&!t.hasClass("dwa")){E=!0;var a=t.find(".dw-ul");Ae(a),clearInterval(Y),Y=setInterval(function(){i(a)},K.delay),i(a)}}function ge(t){if(e.isArray(K.readonly)){var i=e(".dwwl",g).index(t);return K.readonly[i]}return K.readonly}function ve(t){var i='<div class="dw-bf">',a=re[t],r=a.values?a:n(a),o=1,s=r.labels||[],l=r.values,d=r.keys||l;return e.each(l,function(e,t){o%20==0&&(i+='</div><div class="dw-bf">'),i+='<div role="option" aria-selected="false" class="dw-li dw-v" data-val="'+d[e]+'"'+(s[e]?' aria-label="'+s[e]+'"':"")+' style="height:'+c+"px;line-height:"+c+'px;"><div class="dw-i">'+t+"</div></div>",o++}),i+="</div>"}function Ae(t){W=e(".dw-li",t).index(e(".dw-v",t).eq(0)),V=e(".dw-li",t).index(e(".dw-v",t).eq(-1)),H=e(".dw-ul",g).index(t)}function Ce(){X.temp=oe&&null!==X.val&&X.val!=Q.val()||null===X.values?K.parseValue(Q.val()||"",X):X.values.slice(0),we()}function ye(e,t){clearTimeout(te[t]),delete te[t],e.closest(".dwwl").removeClass("dwa")}function be(e,t,i,a,r){var o=(s-i)*c,n=e[0].style;o==ae[t]&&te[t]||(a&&o!=ae[t]&&ke("onAnimStart",[g,t,a]),ae[t]=o,n[C+"Transition"]="all "+(a?a.toFixed(3):0)+"s ease-out",v?n[C+"Transform"]="translate3d(0,"+o+"px,0)":n.top=o+"px",te[t]&&ye(e,t),a&&r&&(e.closest(".dwwl").addClass("dwa"),te[t]=setTimeout(function(){ye(e,t)},1e3*a)),ie[t]=i)}function Se(t,i,a,r,o){!1!==ke("validate",[g,i,t])&&(e(".dw-ul",g).each(function(a){var n=e(this),s=e('.dw-li[data-val="'+X.temp[a]+'"]',n),l=e(".dw-li",n),d=l.index(s),c=l.length,u=a==i||void 0===i;if(!s.hasClass("dw-v")){for(var p=s,h=s,m=0,f=0;d-m>=0&&!p.hasClass("dw-v");)m++,p=l.eq(d-m);for(;d+f<c&&!h.hasClass("dw-v");)f++,h=l.eq(d+f);(f<m&&f&&2!==r||!m||d-m<0||1==r)&&h.hasClass("dw-v")?(s=h,d+=f):(s=p,d-=m)}if(!s.hasClass("dw-sel")||u){X.temp[a]=s.attr("data-val"),e(".dw-sel",n).removeClass("dw-sel"),K.multiple||(e(".dw-sel",n).removeAttr("aria-selected"),s.attr("aria-selected","true")),s.addClass("dw-sel");var g=1;e(".dwtoptwosel",n).removeClass("dwtoptwosel"),e(".dwtoponesel",n).removeClass("dwtoponesel"),e(".dwlasttwosel",n).removeClass("dwlasttwosel"),e(".dwlastonesel",n).removeClass("dwlastonesel"),s.prev().length>0?s.prev().addClass("dwtoponesel"):0==s.prev().length&&(s.parent().prev("div").find(".dw-li.dw-v:last").addClass("dwtoponesel"),g=0),s.prev().prev().length>0?s.prev().prev().addClass("dwtoptwosel"):0==s.prev().prev().length&&(1==g?s.parent().prev("div").find(".dw-li.dw-v:last").addClass("dwtoptwosel"):s.parent().prev("div").find(".dw-li.dw-v:last").prev().addClass("dwtoptwosel")),g=1,s.next().length>0?s.next().addClass("dwlastonesel"):0==s.next().length&&(s.parent().next("div").find(".dw-li.dw-v:first").addClass("dwlastonesel"),g=0),s.next().next().length>0?s.next().next().addClass("dwlasttwosel"):0==s.next().next().length&&(1==g?s.parent().next("div").find(".dw-li.dw-v:first").addClass("dwlasttwosel"):s.parent().next("div").find(".dw-li.dw-v:first").next().addClass("dwlasttwosel")),be(n,a,d,u?t:.1,!!u&&o)}}),h=K.formatResult(X.temp),"inline"==K.display?we(a,0,!0):e(".dwv",g).html(function(e){var t=K.headerText;return t?"function"==typeof t?t.call(J,e):t.replace(/\{value\}/i,e):""}(h)),a&&ke("onChange",[h]))}function ke(t,a){var r;return a.push(X),e.each([O.defaults,ee,i],function(e,i){i[t]&&(r=i[t].apply(J,a))}),r}function De(t,i,a,r,n){i=o(i,W,V);var s=e(".dw-li",t).eq(i),l=void 0===n?i:n,d=H,c=r?i==l?.1:Math.abs((i-l)*K.timeUnit):0;X.temp[d]=s.attr("data-val"),be(t,d,i,c,n),setTimeout(function(){Se(c,d,!0,a,void 0!==n)},10)}function _e(e){var t=ie[H]+1;De(e,t>V?W:t,1,!0)}function Ie(e){var t=ie[H]-1;De(e,t<W?V:t,2,!0)}function we(e,t,i,a){ne&&!i&&Se(t),h=K.formatResult(X.temp),a||(X.values=X.temp.slice(0),X.val=h),e&&oe&&Q.val(h).trigger("change")}X.position=function(t){if(!("inline"==K.display||_===e(window).width()&&w===e(window).height()&&t||!1===ke("onPosition",[g]))){var i,a,r,n,s,l,d,c,u,p,h,m,f=0,v=0,A=e(window).scrollTop(),C=e(".dwwr",g),y=e(".dw",g),b={},S=void 0===K.anchor?Q:K.anchor;_=e(window).width(),w=e(window).height(),I=(I=window.innerHeight)||w,/modal|bubble/.test(K.display)&&(e(".dwc",g).each(function(){i=e(this).outerWidth(!0),f+=i,v=i>v?i:v}),i=f>_?v:f,C.width(i).css("white-space",f>_?"":"nowrap")),P=y.outerWidth(),T=y.outerHeight(!0),B=T<=I&&P<=_,"modal"==K.display?(a=(_-P)/2,r=A+(I-T)/2):"bubble"==K.display?(m=!0,u=e(".dw-arrw-i",g),d=(l=S.offset()).top,c=l.left,n=S.outerWidth(),s=S.outerHeight(),a=(a=(a=c-(y.outerWidth(!0)-n)/2)>_-P?_-(P+20):a)>=0?a:20,(r=d-T)<A||d>A+I?(y.removeClass("dw-bubble-top").addClass("dw-bubble-bottom"),r=d+s):y.removeClass("dw-bubble-bottom").addClass("dw-bubble-top"),p=u.outerWidth(),h=c+n/2-(a+(P-p)/2),e(".dw-arr",g).css({left:o(h,0,p)})):(b.width="100%","top"==K.display?r=A:"bottom"==K.display&&(r=A+I-T)),b.top=r<0?0:r,b.left=a,y.css(b),e(".dw-persp",g).height(0).height(r+T>e(document).height()?r+T:e(document).height()),m&&(r+T>A+I||d>A+I)&&e(window).scrollTop(r+T-I)}},X.enable=function(){K.disabled=!1,oe&&Q.prop("disabled",!1)},X.disable=function(){K.disabled=!0,oe&&Q.prop("disabled",!0)},X.setValue=function(t,i,a,r){X.temp=e.isArray(t)?t.slice(0):K.parseValue.call(J,t+"",X),we(i,a,!1,r)},X.getValue=function(){return X.values},X.getValues=function(){var e,t=[];for(e in X._selectedValues)t.push(X._selectedValues[e]);return t},X.changeWheel=function(t,i){if(g){var a=0,r=t.length;e.each(K.wheels,function(o,n){if(e.each(n,function(o,n){if(e.inArray(a,t)>-1&&(re[a]=n,e(".dw-ul",g).eq(a).html(ve(a)),! --r))return X.position(),Se(i,void 0,!0),!1;a++}),!r)return!1})}},X.isVisible=function(){return ne},X.tap=function(e,t){var i,a;K.tap&&e.on("touchstart.dw",function(e){e.preventDefault(),i=r(e,"X"),a=r(e,"Y")}).on("touchend.dw",function(e){Math.abs(r(e,"X")-i)<20&&Math.abs(r(e,"Y")-a)<20&&t.call(this,e),d=!0,setTimeout(function(){d=!1},300)}),e.on("click.dw",function(e){d||t.call(this,e)})},X.show=function(t){if(e("body").addClass("mobidatepicker"),K.disabled||ne)return!1;"top"==K.display&&(x="slidedown"),"bottom"==K.display&&(x="slideup"),Ce(),ke("onBeforeShow",[]);var i,a=0,r="";x&&!t&&(r="dw-"+x+" dw-in");var o='<div role="dialog" class="'+K.theme+" dw-"+K.display+(A?" dw"+A:"")+' mobile-datepicker-bottom">'+("inline"==K.display?'<div class="dw dwbg dwi"><div class="dwwr">':'<div class="dw-persp"><div class="dwo"></div><div class="dw dwbg '+r+'"><div class="dw-arrw"><div class="dw-arrw-i"><div class="dw-arr"></div></div></div><div class="dwwr"><div aria-live="assertive" class="dwv flamingo-background-color'+(K.headerText?"":" dw-hidden")+'"></div>')+'<div class="dwcc">';e.each(K.wheels,function(t,r){o+='<div class="dwc'+("scroller"!=K.mode?" dwpm":" dwsc")+(K.showLabel?"":" dwhl")+'"><div class="dwwc dwrc"><table cellpadding="0" cellspacing="0"><tr>',e.each(r,function(e,t){re[a]=t,i=void 0!==t.label?t.label:e,o+='<td><div class="dwwl dwrc dwwl'+a+'">'+("scroller"!=K.mode?'<div class="dwb-e dwwb dwwbp" style="height:'+c+"px;line-height:"+c+'px;"><span>+</span></div><div class="dwb-e dwwb dwwbm" style="height:'+c+"px;line-height:"+c+'px;"><span>&ndash;</span></div>':"")+'<div class="dwl">'+i+'</div><div tabindex="0" aria-live="off" aria-label="'+i+'" role="listbox" class="dwww"><div class="dww" style="height:'+K.rows*c+"px;min-width:"+K.width+'px;"><div class="dw-ul">',o+=ve(a),o+='</div><div class="dwwol"></div></div><div class="dwwo"></div></div><div class="dwwol"></div></div></td>',a++}),o+="</tr></table></div></div>"}),o+="</div>"+("inline"!=K.display?'<div class="dwbc'+(K.button3?" dwbc-p":"")+'"><span class="dwbw dwb-s"><span class="dwb dwb-e" role="button" tabindex="0">'+K.setText+"</span></span>"+(K.button3?'<span class="dwbw dwb-n"><span class="dwb dwb-e" role="button" tabindex="0">'+K.button3Text+"</span></span>":"")+'<span class="dwbw dwb-c"><span class="dwb dwb-e" role="button" tabindex="0">'+K.cancelText+"</span></span></div></div>":"")+"</div></div></div>",g=e(o),Se(),ke("onMarkupReady",[g]),"inline"!=K.display?(g.appendTo("body"),x&&!t&&(g.addClass("dw-trans"),setTimeout(function(){g.removeClass("dw-trans").find(".dw").removeClass(r)},350))):Q.is("div")?Q.html(g):g.insertAfter(Q),ke("onMarkupInserted",[g]),ne=!0,O.init(g,X),"inline"!=K.display&&(X.tap(e(".dwb-s span",g),function(){X.select()}),X.tap(e(".dwb-c span",g),function(){X.cancel()}),K.button3&&X.tap(e(".dwb-n span",g),K.button3),e(window).on("keydown.dw",function(e){13==e.keyCode?X.select():27==e.keyCode&&X.cancel()}),K.scrollLock&&g.on("touchmove touchstart",function(e){B&&e.preventDefault()}),e("input,select,button").each(function(){this.disabled||(e(this).attr("autocomplete")&&e(this).data("autocomplete",e(this).attr("autocomplete")),e(this).addClass("dwtd").prop("disabled",!0).attr("autocomplete","off"))}),X.position(),e(window).on("orientationchange.dw resize.dw scroll.dw",function(e){clearTimeout(F),F=setTimeout(function(){var t="scroll"==e.type;(t&&B||!t)&&X.position(!t)},500)}),X.alert(K.ariaDesc)),e(".dwwl",g).on("DOMMouseScroll mousewheel",me).on(b,se).on("keydown",pe).on("keyup",he),g.on(b,".dwb-e",ce).on("keydown",".dwb-e",function(t){32==t.keyCode&&(t.preventDefault(),t.stopPropagation(),e(this).click())}),ke("onShow",[g,h])},X.hide=function(t,i){if(e("body").removeClass("mobidatepicker"),!ne||!1===ke("onClose",[h,i]))return!1;e(".dwtd").each(function(){e(this).prop("disabled",!1).removeClass("dwtd"),e(this).data("autocomplete")?e(this).attr("autocomplete",e(this).data("autocomplete")):e(this).removeAttr("autocomplete")}),g&&("inline"!=K.display&&x&&!t?(g.addClass("dw-trans").find(".dw").addClass("dw-"+x+" dw-out"),setTimeout(function(){g.remove(),g=null},350)):(g.remove(),g=null),e(window).off(".dw")),ae={},ne=!1,z=!0,Q.focus()},X.select=function(){!1!==X.hide(!1,"set")&&(we(!0,0,!0),ke("onSelect",[X.val]))},X.alert=function(e){p.text(e),clearTimeout(u),u=setTimeout(function(){p.text("")},5e3)},X.cancel=function(){!1!==X.hide(!1,"cancel")&&ke("onCancel",[X.val])},X.init=function(e){O=y({defaults:{},init:f},q.themes[e.theme||K.theme]),M=q.i18n[e.lang||K.lang],y(i,e),y(K,O.defaults,M,i),X.settings=K,Q.off(".dw");var t=q.presets[K.preset];t&&(ee=t.call(J,X),y(K,ee,i)),s=Math.floor(K.rows/2),c=K.height,x=K.animate,ne&&X.hide(),"inline"==K.display?X.show():(Ce(),oe&&(void 0===Z&&(Z=J.readOnly),J.readOnly=!0,K.showOnFocus&&Q.on("focus.dw",function(){z||X.show(),z=!1})),K.showOnTap&&X.tap(Q,function(){X.show()}))},X.trigger=function(e,t){return ke(e,t)},X.option=function(e,t){var i={};"object"==typeof e?i=e:i[e]=t,X.init(i)},X.destroy=function(){X.hide(),Q.off(".dw"),delete m[J.id],oe&&(J.readOnly=Z)},X.getInst=function(){return X},X.values=null,X.val=null,X.temp=null,X._selectedValues={},X.init(i)}function i(e){var t;for(t in e)if(void 0!==g[e[t]])return!0;return!1}function a(e){if("touchstart"===e.type)c=!0;else if(c)return c=!1,!1;return!0}function r(e,t){var i=e.originalEvent,a=e.changedTouches;return a||i&&i.changedTouches?i?i.changedTouches[0]["page"+t]:a[0]["page"+t]:e["page"+t]}function o(e,t,i){return Math.max(t,Math.min(e,i))}function n(t){var i={values:[],keys:[]};return e.each(t,function(e,t){i.keys.push(e),i.values.push(t)}),i}function s(e,i,a){var r=e;return"object"==typeof i?e.each(function(){this.id||(h+=1,this.id="mobiscroll"+h),m[this.id]=new t(this,i)}):("string"==typeof i&&e.each(function(){var e,t=m[this.id];if(t&&t[i]&&void 0!==(e=t[i].apply(this,Array.prototype.slice.call(a,1))))return r=e,!1}),r)}var l,d,c,u,p,h=(new Date).getTime(),m={},f=function(){},g=document.createElement("modernizr").style,v=i(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]),A=function(){var e,t=["Webkit","Moz","O","ms"];for(e in t)if(i([t[e]+"Transform"]))return"-"+t[e].toLowerCase();return""}(),C=A.replace(/^\-/,"").replace("moz","Moz"),y=e.extend,b="touchstart mousedown",S="touchmove mousemove",k="touchend mouseup",D={width:70,height:40,rows:3,delay:300,disabled:!1,readonly:!1,showOnFocus:!0,showOnTap:!0,showLabel:!0,wheels:[],theme:"",headerText:"{value}",display:"modal",mode:"scroller",preset:"",lang:"en-US",setText:"Done",cancelText:"Anytime",ariaDesc:"",scrollLock:!0,tap:!0,speedUnit:.0012,timeUnit:.1,formatResult:function(e){return e.join(" ")},parseValue:function(t,i){var a,r=t.split(" "),o=[],s=0;return e.each(i.settings.wheels,function(t,i){e.each(i,function(t,i){i=i.values?i:n(i),a=i.keys||i.values,-1!==e.inArray(r[s],a)?o.push(r[s]):o.push(a[0]),s++})}),o}};e(function(){p=e('<div class="dw-hidden" role="alert"></div>').appendTo("body")}),e(document).on("mouseover mouseup mousedown click",function(e){if(d)return e.stopPropagation(),e.preventDefault(),!1}),e.fn.mobiscroll=function(t){return y(this,e.mobiscroll.shorts),s(this,t,arguments)},e.mobiscroll=e.mobiscroll||{setDefaults:function(e){y(D,e)},presetShort:function(e){this.shorts[e]=function(t){return s(this,y(t,{preset:e}),arguments)}},has3d:v,shorts:{},presets:{},themes:{},i18n:{}},e.scroller=e.scroller||e.mobiscroll,e.fn.scroller=e.fn.scroller||e.fn.mobiscroll}(jQuery),function(e){e.fn.vgMultiMonthDatePicker=function(t){var a={defaultOptions:{numberOfMonths:3,selectedDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()),minDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()),maxDate:new Date((new Date).getFullYear(),(new Date).getMonth()+7,(new Date).getDate()),dateFormat:"MMM DD, YYYY",arrValidDates:[],arrInValidDates:[],validDatesFormat:"MMM DD,YYYY",inValidDatesFormat:"MMM DD,YYYY",disabledWeekDays:[],ignoreValidation:!1},monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],disabledClass:"vg_disable",todayClass:"vg_today",activeClass:"vg_current",currentDate:null};!function(t,r){if(0!=e(t).length){var o=e("#vgCalendar_"+t.attr("id"));if("string"!=typeof r||"destroy"!=r.toLowerCase())if("string"!=typeof r||"show"!=r.toLowerCase())if("string"!=typeof r||"hide"!=r.toLowerCase())if("object"==typeof r&&void 0!==r.value&&l(r.value)){if(o.length>0&&e("#hdnOldOptions",o).length>0&&""!=e("#hdnOldOptions",o).val()){var n=e.parseJSON(e("#hdnOldOptions",o).val());null!=n&&s(n)}h(t,r.value)}else void 0!==r&&null!=r?s(a.defaultOptions):r=a.defaultOptions,o.length>0&&C(),u(),e(t).on("click touchstart",function(i){(i.preventDefault(),e(t).prop("disabled"))||(a.currentDate=function(t){if(void 0!==e(t).data("vgselectedvalue")&&""!=e(t).data("vgselectedvalue")){var i=e(t).data("vgselectedvalue").split("-");return new Date(i[0],i[1]-1,i[2])}return new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate())}(t),0==e("#vgCalendar_"+t.attr("id")).length&&u(),g(a.currentDate,!0),v(!0),g(a.currentDate,!1))}),e(window).resize(function(){A()});else o.is(":visible")&&v(!1);else o.is(":visible")||v(!0);else C()}function s(e){(void 0===r.numberOfMonths||isNaN(parseInt(r.numberOfMonths)))&&(r.numberOfMonths=e.numberOfMonths),(void 0===r.selectedDate||isNaN(r.selectedDate.getDate()))&&(r.selectedDate=new Date(e.selectedDate)),(void 0===r.minDate||isNaN(r.minDate.getDate()))&&(r.minDate=new Date(e.minDate)),(void 0===r.maxDate||isNaN(r.maxDate.getDate()))&&(r.maxDate=new Date(e.maxDate)),void 0===r.dateFormat||null==r.dateFormat||""==r.dateFormat?r.dateFormat=e.dateFormat:r.dateFormat=r.dateFormat.toUpperCase(),void 0!==r.arrValidDates&&null!=r.arrValidDates&&""!=r.arrValidDates||(r.arrValidDates=e.arrValidDates),void 0!==r.arrInValidDates&&null!=r.arrInValidDates&&""!=r.arrInValidDates||(r.arrInValidDates=e.arrInValidDates),void 0===r.validDatesFormat||null==r.validDatesFormat||""==r.validDatesFormat?r.validDatesFormat=e.validDatesFormat:r.validDatesFormat=r.validDatesFormat.toUpperCase(),void 0===r.inValidDatesFormat||null==r.inValidDatesFormat||""==r.inValidDatesFormat?r.inValidDatesFormat=e.inValidDatesFormat:r.inValidDatesFormat=r.inValidDatesFormat.toUpperCase(),void 0!==r.disabledWeekDays&&null!=r.disabledWeekDays&&""!=r.disabledWeekDays||(r.disabledWeekDays=e.disabledWeekDays),void 0!==r.ignoreValidation&&null!=r.ignoreValidation&&""!=r.ignoreValidation||(r.ignoreValidation=e.ignoreValidation)}function l(e){var t=!0,i=new Date(e);return i.setHours(0),i.setMinutes(0),i.setMilliseconds(0),!(i<r.minDate||i>r.maxDate)&&(void 0!==r.arrValidDates&&null!=r.arrValidDates&&r.arrValidDates.length>0&&-1==r.arrValidDates.indexOf(moment(i).format(r.validDatesFormat))&&(t=!1),!(t&&void 0!==r.arrInValidDates&&null!=r.arrInValidDates&&r.arrInValidDates.length>0&&r.arrInValidDates.indexOf(moment(i).format(r.inValidDatesFormat))>-1)&&t)}function d(e,t){var i;return(i=12*(t.getFullYear()-e.getFullYear()))>0?(i-=e.getMonth()+1,i+=t.getMonth()):i=t.getMonth()-e.getMonth(),i<=0?0:i}function c(e,t){return new Date(t,e,0).getDate()}function u(){var i=e('<div id="vgCalendar_'+t.attr("id")+'" class="vg_calendar-container vagaro-datepicker-mobile" />'),a=e('<input type="hidden" id="hdnOldOptions" value="" />'),o=e('<div class="vg_calendar-dates" />'),n=e('<div class="vg_calendar-date-div" />'),s=e('<div class="vg_cal-header" />'),c=e('<div class="vg_cal_head"><div class="vg_cal-close font-awesome-light">&#xf00d;</div></div>'),u=e('<div class="vg_cal-next-button font-awesome-light">&#xf107;</div>'),m=e('<div class="vg_cal-week-div w-clearfix"><div class="vg_cal-week-day text-primary-lg">Su</div><div class="vg_cal-week-day text-primary-lg">Mo</div><div class="vg_cal-week-day text-primary-lg">Tu</div><div class="vg_cal-week-day text-primary-lg">We</div><div class="vg_cal-week-day text-primary-lg">Th</div><div class="vg_cal-week-day text-primary-lg">Fr</div><div class="vg_cal-week-day text-primary-lg">Sa</div></div>');a.val(JSON.stringify(r)),a.appendTo(i),e(c).on("click touchstart",function(e){e.preventDefault(),f()}),e(c).appendTo(s),e(m).appendTo(s),e(s).appendTo(i),e(n).appendTo(o),e(u).on("click",function(e){e.preventDefault(),p(t),A()}),e(u).data("nextmonth",r.minDate.getMonth()),e(u).data("nextyear",r.minDate.getFullYear()),e(u).appendTo(o),e(o).appendTo(i),e(i).appendTo(e("body"));var g=r.numberOfMonths,v=d(r.selectedDate,r.minDate);v>g&&(r.numberOfMonths=v),p(t),r.numberOfMonths=g,h(t,1==r.ignoreValidation||l(r.selectedDate)?r.selectedDate:r.minDate)}function p(t){var o=t.attr("id"),n=e("#vgCalendar_"+o);o&&e(t).attr("aria-activedescendant","div_"+o),e(t).attr("aria-live","polite");var s=n.find(".vg_calendar-date-div"),d=n.find(".vg_cal-next-button"),u=d.data("nextmonth"),p=d.data("nextyear");for(i=0;i<r.numberOfMonths;i++){var m=new Date(p,u+i,1),g=m.getFullYear(),v=m.getMonth(),A=a.monthNames[v]+" "+g,C=e('<div class="vg_cal-month"><div class="vg_cal-month-title">'+A+"</div></div>"),y=e('<div class="vg_cal-month-div" />'),b=e('<table class="vg_cal-month-div" role="presentation" />'),S=e("<tbody />"),D=e("<tr />"),_=new Date(g,v,1).getDay();for(j=0;j<_;j++){e('<td class="vg_cal-days-placeholder"></td>').appendTo(D)}var I=_,w=c(v+1,g);for(k=1;k<=w;k++){var P=new Date(g,v,k),T=e('<td class="vg_cal-days" data-value="'+moment(P).format("YYYY-MM-DD")+'">'+k+"</td>"),B=void 0!==r.disabledWeekDays&&null!=r.disabledWeekDays&&r.disabledWeekDays.length>0&&r.disabledWeekDays.indexOf(P.getDay()+1)>-1;P.getFullYear()==(new Date).getFullYear()&&P.getMonth()==(new Date).getMonth()&&P.getDate()==(new Date).getDate()&&T.addClass(a.todayClass);var x=moment(P).format("dddd, MMM D, YYYY");T.attr("role","text"),!l(P)||B?(T.addClass(a.disabledClass),T.attr("aria-label","Booking is not available on "+x)):T.attr("aria-label",x),T.on("click",function(i){if(i.preventDefault(),!e(this).hasClass(a.disabledClass)){var o=e(this).data("value").split("-");h(t,new Date(o[0],o[1]-1,o[2])),"function"==typeof r.ondatechange&&r.ondatechange(a.currentDate),f()}}),I%7==0&&(e(D).appendTo(S),D=e("<tr />")),T.appendTo(D),I++}if(e(D).appendTo(S),e(C).appendTo(s),e(S).appendTo(b),e(b).appendTo(y),e(y).appendTo(s),d.data("nextmonth",v+1),d.data("nextyear",g),g==r.maxDate.getFullYear()&&v==r.maxDate.getMonth()){d.remove();break}}}function h(t,i){var o=void 0!==r.ignoreValidation&&r.ignoreValidation;if(o||l(new Date(i))){m(new Date(i));var n=t.attr("id"),s=e("#vgCalendar_"+n).find(".vg_calendar-date-div"),d=e(s).find("[data-value='"+moment(i).format("YYYY-MM-DD")+"']");if(e(s).find("[aria-selected='true']").removeAttr("aria-selected").removeAttr("id"),o||d.length>0&&!d.hasClass(a.disabledClass))return e(t).data("vgselectedvalue",moment(i).format("YYYY-MM-DD")),e(t).val(moment(i).format(r.dateFormat)),e(s).find("td").removeClass(a.activeClass),e(d).addClass(a.activeClass),e(d).attr("aria-selected","true"),e(d).attr("tabindex",0),n&&e(d).attr("id","div_"+n),"txtPayrollStartingDate"==e(t)[0].id&&_RentAndFees.PayrollDateChange(),setTimeout(function(){e(d).focus()},100),a.currentDate=new Date(i),!0;e(d).attr("tabindex",-1)}return!1}function m(i){var a=e("#vgCalendar_"+t.attr("id")).find(".vg_cal-next-button"),o=a.data("nextmonth")-1,n=a.data("nextyear"),s=new Date(n,o,c(o+1,n));if(i.setHours(0),i.setMinutes(0),i.setMilliseconds(0),i>s){var l=d(s,i),u=r.numberOfMonths;l>0&&(r.numberOfMonths=l),p(t),r.numberOfMonths=u}}function f(){v(!1),"function"==typeof r.onclose&&r.onclose()}function g(e,t){1==t&&null!=r.openBeforeCallBack&&"function"==typeof r.openBeforeCallBack?r.openBeforeCallBack(e):0==t&&null!=r.openAfterCallBack&&"function"==typeof r.openAfterCallBack&&r.openAfterCallBack(e)}function v(i){var r=e("#vgCalendar_"+t.attr("id")),o=r.find(".vg_calendar-dates");if(e(r).attr("role","dialog"),e(r).attr("aria-modal",!0),i)e(r).attr("role","dialog"),e(r).attr("aria-modal",!0),r.slideDown(300),o.slideDown(300),e("html, body").addClass("overflowHidden"),A(),setTimeout(function(){var e=o.find("."+a.activeClass).parent().parent().parent().parent(),t=o.scrollTop(),i=0;e.length>0&&(i=e.offset().top),o.scrollTop(t+i-o.height()+283)},350);else{var n=r.find(".vg_calendar-date-div"),s=e(n).find("[aria-selected='true']");e(s).attr("tabindex",-1),e(r).removeAttr("role"),e(r).removeAttr("aria-modal"),e("#txtdivSearchDate").focus(),r.slideUp(300),o.slideUp(300),e("html, body").removeClass("overflowHidden")}}function A(){setTimeout(function(){e("#vgCalendar_"+t.attr("id")).find(".vg_calendar-date-div").find("td").each(function(t,i){e(this).height(e(this).width()-1)})},100)}function C(){e(t).removeAttr("data-vgselectedvalue"),e(t).unbind("click touchstart"),o.remove()}}(e(this),t)}}(jQuery);var serviceDateFormat_year="MMM DD YYYY hh:mm A";function getCurrentLocationDate(){var e=iPadAndroid||isWindowsPhone?15:5,t=new Date;if("undefined"!=typeof utcOffset){var i=new Date;(t=new Date(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds())).setSeconds(t.getSeconds()+utcOffset)}var a=moment(t).format("nn"),r=parseInt(parseInt(a)%e);return r>0&&(a=a-r+e,t.setMinutes(a)),t}function applydatepicker(e){var t=e.divid,a=e.textid,r=e.dateTimeFormat,o=e.callBackOnHide;void 0!==o&&""!=o||(o=null);var n=e.BeforecallBackOnOpenForMobile;void 0!==n&&""!=n||(n=null);var s=e.AftercallBackOnOpenForMobile;void 0!==s&&""!=s||(s=null);var l=e.callBackOnChange;void 0!==l&&""!=l||(l=null);var d=e.onGenerate;void 0!==d&&""!=d||(d=null);var c=e.preset;void 0!==c&&null!=c&&""!=c||(c="datetime");var u=e.arrValidDates;void 0===u&&(u=null);var p=e.defaultDateTime,h=e.pickTime;void 0===h&&(h=!1);var m=e.formatTime;void 0===m&&(m=null);var f=e.contentWindow;void 0===f&&(f=null);var g=e.parentID;void 0===g&&(g="body");var v=e.scrollMonth;void 0===v&&(v=!0);var A=e.isMobileFriendly;void 0===A&&(A="undefined"!=typeof _vgClassSessionSelection&&void 0!==_vgClassSessionSelection.VisibleControlLength&&_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(0==$("body").hasClass("Embedded_Widget")||1==$("body").hasClass("Embedded_Widget")&&void 0!==e.isApplyInWidget&&null!=e.isApplyInWidget&&1==e.isApplyInWidget)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(A=!1);var C=e.disabledWeekDays;void 0===C&&(C=null);var y=e.disabledTimePicker;void 0===y&&(y=null);var b=e.disabledMobileTimePicker;void 0===b&&(b=null);var S=e.MinDate;void 0===S&&(S=null);var k=e.MaxDate;void 0===k&&(k=null);var D=e.unavailableShowDate;void 0===D&&(D=!1);var _=e.inline;if(void 0===_&&(_=!1),(iPadAndroid||isWindowsPhone)&&A&&null!=typeof e.flagVgMultiMonthDatePicker&&e.flagVgMultiMonthDatePicker){$(a).data("dtmindate","");var I={};if(void 0!==e.numberOfMonths&&e.numberOfMonths>0&&(I.numberOfMonths=e.numberOfMonths),void 0!==e.ignoreValidation&&null!=e.ignoreValidation&&(I.ignoreValidation=e.ignoreValidation),null!=u&&u.length>0&&(I.arrValidDates=u,""!=u[0]&&(S=new Date(moment(u[0])._d),k=new Date(moment(u[u.length-1])._d),$(a).data("dtmindate",u[0]))),null!=S&&(I.minDate=new Date(S)),null!=k&&(I.maxDate=new Date(k)),void 0!==r&&null!=r&&(I.dateFormat=r),null!=C&&(I.disabledWeekDays=C),null!=y&&(I.disabledTimePicker=y),void 0!==p&&""!=p)M>(O=new Date(p))?(p=M,O=M):M=O,I.selectedDate=p;return null!=l&&(I.ondatechange=l),null!=o&&(I.onclose=o),I.openBeforeCallBack=n,I.openAfterCallBack=s,void $(a).vgMultiMonthDatePicker(I)}var w=t+"input";if((iPadAndroid||isWindowsPhone)&&1==A)if(0==$(t).find(w).length){$(t).append("<input id="+w.replace(/[#.]/g,"")+' type="text" style="display:none" />');var P="android-ics light",T="bottom",B="y";if(P="ios",T="bottom",B="y",isWindowsPhone&&(P="wp light",T="modal",B="MD ddyy"),null!=u)u.length>0&&""!=u[0]?(U=M=new Date(moment(u[0])._d),E=new Date(moment(u[u.length-1])._d),$(a).data("dtmindate",u[0])):(u=null,U=M=new Date,E=M,$(a).data("dtmindate",""));else if(null==u){M=void 0===getLocationDate?void 0===getLocationDatepickupinstrore?getCurrentLocationDate():"undefined"!=typeof pageval&&void 0!==getLocationDatepickupinstrore&&"onlineshopppingcart"==pageval?getLocationDatepickupinstrore():getCurrentLocationDate():getLocationDate();var x=moment(M).format("nn");(L=parseInt(parseInt(x)%15))>0&&(x=x-L+15,M.setMinutes(x)),U=M,(E=new Date(M)).setMonth(E.getMonth()+6)}"date"==c&&1==D&&$("body").addClass("iosdateonly");var F={preset:c,minDate:null!=S?S:U,maxDate:null!=k?k:E,stepMinute:15,dateFormat:"M dd yy",timeWheels:"hhii A",separator:" ",dateOrder:B,mergeDate:!isWindowsPhone,mergeTime:!isWindowsPhone,validDates:u,unavailableShowDate:D,onCancel:function(){$(w).val("Anytime"),$(a).data("date","Anytime"),$(a).val("Anytime"),void 0!==o&&null!=o&&o(t,a),$(w).mobiscroll("hide")},onSelect:function(e){$(w).val(moment(e).format(serviceDateFormat_year)),$(a).data("date",e),$(a).val(moment(e).format(r)),void 0!==o&&null!=o&&o(t,a),void 0!==l&&null!=l&&l(new Date(moment(e)))}};if(null!=C&&(F.disabledWeekDays=C),null!=b&&(F.disabledMobileTimePicker=b),void 0!==p&&""!=p)M>(O=new Date(p))?(p=M,O=M):M=O;$(a).data("date",moment(M).format(serviceDateFormat_year)),$(a).data("preset",c),$(w).val(moment(M).format(serviceDateFormat_year)).scroller("destroy").scroller($.extend(F,{theme:P,mode:"scroller",display:T})),$(a).val(moment(M).format(r)),$(a).bind("click touchend",function(e,t){$(w).mobiscroll("show")})}else{var O;if(void 0!==p&&""!=p)M>(O=new Date(p))?(p=M,O=M):M=O;$(a).data("date",moment(M).format(serviceDateFormat_year)),$(w).val(moment(M).format(serviceDateFormat_year)),$(a).val(moment(M).format(r))}else{if(void 0===$(a).data("xdsoft_datetimepicker")||null==$(a).data("xdsoft_datetimepicker")){var M,E;$.datetimepicker.setDateFormatter({parseDate:function(e,t){var i=moment(e,t);return!!i.isValid()&&i.toDate()},formatDate:function(e,t){return moment(e).format(t)}});var N={minDate:new Date,maxDate:new Date,defaultDate:new Date,format:r,timepickerScrollbar:h,timepicker:h,validateOnBlur:!1,id:$(a).attr("id")+"_picker",closeOnTimeSelect:!1,todayButton:!1,showOkCloseButtons:1==h,yearStart:(new Date).getFullYear(),yearEnd:(new Date).getFullYear()+5,scrollMonth:v,inline:_};if(null!=e.yearStart&&(N.yearStart=e.yearStart),null!=e.yearEnd&&(N.yearEnd=e.yearEnd),null!=f&&(N.contentWindow=f),N.parentID=g,null!=C&&(N.disabledWeekDays=C),null!=y&&(N.disabledTimePicker=y),null!=m&&(N.formatTime=m,N.step=30),null!=u)u.length>0&&""!=u[0]?(M=new Date(moment(u[0])._d),E=new Date(moment(u[u.length-1])._d),N.defaultDate=new Date(M),N.minDate=new Date(M),N.maxDate=new Date(E),N.allowDates=u,$(a).data("dtmindate",u[0]),N.yearEnd=new Date(moment(u[u.length-1])).getFullYear()):(M=new Date,N.allowDates=u,$(a).data("dtmindate",""));else{M=void 0===getLocationDate?void 0===getLocationDatepickupinstrore?getCurrentLocationDate():"undefined"!=typeof pageval&&void 0!==getLocationDatepickupinstrore&&"onlineshopppingcart"==pageval?getLocationDatepickupinstrore():getCurrentLocationDate():getLocationDate();var L;x=moment(M).format("nn");(L=parseInt(parseInt(x)%5))>0&&(x=x-L+5,M.setMinutes(x)),(E=new Date(M)).setMonth(E.getMonth()+6),N.defaultDate=new Date(M),N.minDate=new Date(M),N.maxDate=E,1==h&&(N.minDateTime=new Date(M))}void 0!==l&&null!=l&&(N.onSelectDate=function(e){l(new Date(e))}),void 0!==d&&null!=d&&(N.monthChangeSpinner=!1,N.onGenerate=function(e){d(new Date(e))}),void 0!==o&&null!=o&&(N.onClose=function(e){o(t,a)}),null!=S&&(N.minDate=S,1==h&&(N.minDateTime=S)),null!=k&&(N.maxDate=k),$(a).datetimepicker(N)}if((void 0===p||null==p)&&0==h&&null!=u&&u.length>0&&""!=u[0]){var U,R=new Date(getdatepickervalue(a));if(R<=(U=new Date(moment(u[0])._d)))p=new Date(U);else if(-1===u.indexOf(R.format("MMM DD,YYYY")))for(i=0;i<u.length;i++){var G=new Date(moment(u[i])._d),W=!1;G>R&&(p=G,W=!0),W||(p=new Date(moment(u[0])._d))}}void 0!==p&&""!=p&&("undefined"!=typeof Search&&Search.IsFromSearchrPage()&&null!=u&&u.length>0&&p.format()==new Date(moment(u[u.length-1])._d).format()?setdatepickervalue(e,new Date(moment($("#ucAppointments_hdnDate").val()).format())):setdatepickervalue(e,new Date(moment(p).format())))}}function getdatepickervalue(e,t,i,a,r){if(void 0!==t&&null!=t||(t="undefined"!=typeof _vgClassSessionSelection&&void 0!==_vgClassSessionSelection.VisibleControlLength&&_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(0==$("body").hasClass("Embedded_Widget")||1==$("body").hasClass("Embedded_Widget")&&void 0!==a&&null!=a&&1==a)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(t=!1),(iPadAndroid||isWindowsPhone)&&t&&void 0!==i&&i){if(void 0!==$(e).data("vgselectedvalue")){var o=$(e).data("vgselectedvalue").split("-");return new Date(o[0],o[1]-1,o[2])}if(void 0!==$(e).data("xdsoft_datetimepicker"))return new Date(moment($(e).data("xdsoft_datetimepicker").getValue()))}if((iPadAndroid||isWindowsPhone)&&1==t){if(void 0!==$(e).data("preset")&&"datetime"==$(e).data("preset").toLowerCase())return new Date($(e).data("date"));var n=new Date($(e).data("date"));return new Date(n.getFullYear(),n.getMonth(),n.getDate())}if(void 0!==$(e).data("xdsoft_datetimepicker")&&1==$(e).data("xdsoft_datetimepicker").data("options").timepicker)return new Date(moment($(e).data("xdsoft_datetimepicker").getValue()));if(""==$(e).val()||"Never"==$(e).val())return"";if(void 0!==r&&null!=r&&""!=r&&1==r){n=new Date(moment($(e).val()).format());return new Date(n.getFullYear(),n.getMonth(),n.getDate())}if(void 0!==$(e).data("xdsoft_datetimepicker")){n=new Date(moment($(e).data("xdsoft_datetimepicker").getValue()).format());return new Date(n.getFullYear(),n.getMonth(),n.getDate())}return null}function setdatepickervalue(e,t){var i=e.isMobileFriendly;void 0===i&&(i="undefined"!=typeof _vgClassSessionSelection&&void 0!==_vgClassSessionSelection.VisibleControlLength&&_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(0==$("body").hasClass("Embedded_Widget")||1==$("body").hasClass("Embedded_Widget")&&void 0!==e.isApplyInWidget&&null!=e.isApplyInWidget&&1==e.isApplyInWidget)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(i=!1);var a=e.divid,r=e.textid,o=e.dateTimeFormat;(iPadAndroid||isWindowsPhone)&&i&&void 0!==e.flagVgMultiMonthDatePicker&&e.flagVgMultiMonthDatePicker?void 0!==_shopdetail&&_shopdetail.IsClassSelected()||"undefined"!=typeof _invoice?$(r).vgMultiMonthDatePicker({value:t,dateFormat:o,ignoreValidation:!0}):($(r).vgMultiMonthDatePicker({value:t,dateFormat:o}),""!=t&&"Never"!=t||$(r).val(t),""!=t&&"Send Now"!=t||$(r).val(t)):(iPadAndroid||isWindowsPhone)&&1==i?($(a).find(a+"input").val(moment(t).format(serviceDateFormat_year)),$(r).val(moment(t).format(o)),$(r).data("date",moment(t).format(serviceDateFormat_year))):(r=$(r),$(r).datetimepicker({value:t}),""!=t&&"Never"!=t||$(r).val(t),""!=t&&"Send Now"!=t||$(r).val(t))}function destroydatepicker(e){var t=e.divid,i=e.textid,a=e.isMobileFriendly;if(void 0===a&&(a="undefined"!=typeof _vgClassSessionSelection&&void 0!==_vgClassSessionSelection.VisibleControlLength&&_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(0==$("body").hasClass("Embedded_Widget")||1==$("body").hasClass("Embedded_Widget")&&void 0!==e.isApplyInWidget&&null!=e.isApplyInWidget&&1==e.isApplyInWidget)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(a=!1),a&&void 0!==e.flagVgMultiMonthDatePicker&&e.flagVgMultiMonthDatePicker)$(i).vgMultiMonthDatePicker("destroy");else if((iPadAndroid||isWindowsPhone)&&1==a){var r=t+"input";$(t).find(r).length>0&&($(r).scroller("destroy"),$(i).unbind("click touchend"),$(r).remove())}else void 0!==$(i).data("xdsoft_datetimepicker")&&null!=$(i).data("xdsoft_datetimepicker")&&$(i).datetimepicker("destroy");applydatepicker(e)}function enabledisabledatepicker(e,t){var i=t.divid,a=t.textid,r=t.isMobileFriendly;if(void 0===r&&(r=!0),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(r=!1),r&&void 0!==t.flagVgMultiMonthDatePicker&&t.flagVgMultiMonthDatePicker)return $(a).vgMultiMonthDatePicker("hide"),void $(a).prop("disabled",!e);if(e)if((iPadAndroid||isWindowsPhone)&&1==r){var o=i+"input";$(a).unbind("click touchend"),$(a).bind("click touchend",function(e,t){$(o).mobiscroll("show")})}else $(a).prop("disabled",!1);else(iPadAndroid||isWindowsPhone)&&1==r?$(a).unbind("click touchend"):$(a).prop("disabled",!0)}function getMinDateValue(e){var t=$(e.textid).data("dtmindate");return void 0!==t&&""!=t?new Date(moment(t)._d):new Date(moment($(e.textid).data("xdsoft_datetimepicker").getValue()))}function HideShowdatepicker(e,t){var i=t.divid,a=t.textid,r=t.isMobileFriendly;void 0===r&&(r="undefined"!=typeof _vgClassSessionSelection&&void 0!==_vgClassSessionSelection.VisibleControlLength&&_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(0==$("body").hasClass("Embedded_Widget")||1==$("body").hasClass("Embedded_Widget")&&void 0!==t.isApplyInWidget&&null!=t.isApplyInWidget&&1==t.isApplyInWidget)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(r=!1),r&&void 0!==t.flagVgMultiMonthDatePicker&&t.flagVgMultiMonthDatePicker?$(a).vgMultiMonthDatePicker(e?"show":"hide"):1==e?(iPadAndroid||isWindowsPhone)&&1==r?$(i+"input").mobiscroll("show"):$(a).datetimepicker("show"):(iPadAndroid||isWindowsPhone)&&1==r?$(i+"input").mobiscroll("hide"):$(a).datetimepicker("hide")}function setMinMaxTimeValue(e){var t=e.isMobileFriendly;void 0===t&&(t="undefined"!=typeof _vgClassSessionSelection&&void 0!==_vgClassSessionSelection.VisibleControlLength&&_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(0==$("body").hasClass("Embedded_Widget")||1==$("body").hasClass("Embedded_Widget")&&void 0!==e.isApplyInWidget&&null!=e.isApplyInWidget&&1==e.isApplyInWidget)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("body").hasClass("Popup_Widget")&&(t=!1);e.divid;var i=e.textid;e.dateTimeFormat;(iPadAndroid||isWindowsPhone)&&1==t||(i=$(i),$(i).data("xdsoft_datetimepicker").setOptions({disabledTimePicker:e.disabledTimePicker}))}!function(e){"use strict";"function"==typeof d&&d.amd?d(["jquery"],e):"undefined"!=typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var t,i=window.Slick||{};t=0,i=function(i,a){var r,o,n=this;if(n.defaults={accessibility:!1,adaptiveHeight:!1,appendArrows:e(i),appendDots:e(i),arrows:!0,asNavFor:null,prevArrow:'<button type="button" data-role="none" class="slick-prev">Previous</button>',nextArrow:'<button type="button" data-role="none" class="slick-next">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return'<button type="button" data-role="none">'+(t+1)+"</button>"},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",fade:!1,focusOnSelect:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",onBeforeChange:null,onAfterChange:null,onInit:null,onReInit:null,onSetPosition:null,pauseOnHover:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rtl:!1,slide:"div",slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,variableWidth:!1,vertical:!1,waitForAnimate:!0,CurrentSlideDirection:""},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:!1,CurrentSlideDirection:""},e.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.paused=!1,n.positionProp=null,n.respondTo=null,n.shouldClick=!0,n.$slider=e(i),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.windowWidth=0,n.windowTimer=null,n.options=e.extend({},n.defaults,a),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,(r=n.options.responsive||null)&&r.length>-1){for(o in n.respondTo=n.options.respondTo||"window",r)r.hasOwnProperty(o)&&(n.breakpoints.push(r[o].breakpoint),n.breakpointSettings[r[o].breakpoint]=r[o].settings);n.breakpoints.sort(function(e,t){return t-e})}n.autoPlay=e.proxy(n.autoPlay,n),n.autoPlayClear=e.proxy(n.autoPlayClear,n),n.changeSlide=e.proxy(n.changeSlide,n),n.clickHandler=e.proxy(n.clickHandler,n),n.selectHandler=e.proxy(n.selectHandler,n),n.setPosition=e.proxy(n.setPosition,n),n.swipeHandler=e.proxy(n.swipeHandler,n),n.dragHandler=e.proxy(n.dragHandler,n),n.keyHandler=e.proxy(n.keyHandler,n),n.autoPlayIterator=e.proxy(n.autoPlayIterator,n),n.instanceUid=t++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.init(),n.checkResponsive()},i.prototype.addSlide=function(t,i,a){var r=this;if("boolean"==typeof i)a=i,i=null;else if(i<0||i>=r.slideCount)return!1;r.unload(),"number"==typeof i?0===i&&0===r.$slides.length?e(t).appendTo(r.$slideTrack):a?e(t).insertBefore(r.$slides.eq(i)):e(t).insertAfter(r.$slides.eq(i)):!0===a?e(t).prependTo(r.$slideTrack):e(t).appendTo(r.$slideTrack),r.$slides=r.$slideTrack.children(this.options.slide),r.$slideTrack.children(this.options.slide).detach(),r.$slideTrack.append(r.$slides),r.$slides.each(function(t,i){e(i).attr("index",t)}),r.$slidesCache=r.$slides,r.reinit()},i.prototype.animateSlide=function(t,i){var a={},r=this;if(1===r.options.slidesToShow&&!0===r.options.adaptiveHeight&&!1===r.options.vertical){var o=r.$slides.eq(r.currentSlide).outerHeight(!0);r.$list.animate({height:o},r.options.speed)}!0===r.options.rtl&&!1===r.options.vertical&&(t=-t),!1===r.transformsEnabled?!1===r.options.vertical?r.$slideTrack.animate({left:t},r.options.speed,r.options.easing,i):r.$slideTrack.animate({top:t},r.options.speed,r.options.easing,i):!1===r.cssTransitions?e({animStart:r.currentLeft}).animate({animStart:t},{duration:r.options.speed,easing:r.options.easing,step:function(e){!1===r.options.vertical?(a[r.animType]="translate("+e+"px, 0px)",r.$slideTrack.css(a)):(a[r.animType]="translate(0px,"+e+"px)",r.$slideTrack.css(a))},complete:function(){i&&i.call()}}):(r.applyTransition(),!1===r.options.vertical?a[r.animType]="translate3d("+t+"px, 0px, 0px)":a[r.animType]="translate3d(0px,"+t+"px, 0px)",r.$slideTrack.css(a),i&&setTimeout(function(){r.disableTransition(),i.call()},r.options.speed))},i.prototype.asNavFor=function(t){var i=null!=this.options.asNavFor?e(this.options.asNavFor).getSlick():null;null!=i&&i.slideHandler(t,!0)},i.prototype.applyTransition=function(e){var t=this,i={};!1===t.options.fade?i[t.transitionType]=t.transformType+" "+t.options.speed+"ms "+t.options.cssEase:i[t.transitionType]="opacity "+t.options.speed+"ms "+t.options.cssEase,!1===t.options.fade?t.$slideTrack.css(i):t.$slides.eq(e).css(i)},i.prototype.autoPlay=function(){var e=this;e.autoPlayTimer&&clearInterval(e.autoPlayTimer),e.slideCount>e.options.slidesToShow&&!0!==e.paused&&(e.autoPlayTimer=setInterval(e.autoPlayIterator,e.options.autoplaySpeed))},i.prototype.autoPlayClear=function(){this.autoPlayTimer&&clearInterval(this.autoPlayTimer)},i.prototype.autoPlayIterator=function(){var e=this;!1===e.options.infinite?1===e.direction?(e.currentSlide+1===e.slideCount-1&&(e.direction=0),e.slideHandler(e.currentSlide+e.options.slidesToScroll)):(e.currentSlide-1==0&&(e.direction=1),e.slideHandler(e.currentSlide-e.options.slidesToScroll)):e.slideHandler(e.currentSlide+e.options.slidesToScroll)},i.prototype.buildArrows=function(){var t=this;!0===t.options.arrows&&t.slideCount>t.options.slidesToShow&&(t.$prevArrow=e(t.options.prevArrow),t.$nextArrow=e(t.options.nextArrow),t.htmlExpr.test(t.options.prevArrow)&&t.$prevArrow.appendTo(t.options.appendArrows),t.htmlExpr.test(t.options.nextArrow)&&t.$nextArrow.appendTo(t.options.appendArrows),!0!==t.options.infinite&&t.$prevArrow.addClass("slick-disabled"))},i.prototype.buildDots=function(){var t,i,a=this;if(!0===a.options.dots&&a.slideCount>a.options.slidesToShow){for(i='<ul class="'+a.options.dotsClass+'">',t=0;t<=a.getDotCount();t+=1)i+="<li>"+a.options.customPaging.call(this,a,t)+"</li>";i+="</ul>",a.$dots=e(i).appendTo(a.options.appendDots),a.$dots.find("li").first().addClass("slick-active")}},i.prototype.buildOut=function(){var t=this;t.$slides=t.$slider.children(t.options.slide+":not(.slick-cloned)").addClass("slick-slide"),t.slideCount=t.$slides.length,t.$slides.each(function(t,i){e(i).attr("index",t)}),t.$slidesCache=t.$slides,t.$slider.addClass("slick-slider"),t.$slideTrack=0===t.slideCount?e('<div class="slick-track"/>').appendTo(t.$slider):t.$slides.wrapAll('<div class="slick-track"/>').parent(),t.$list=t.$slideTrack.wrap('<div class="slick-list"/>').parent(),t.$slideTrack.css("opacity",0),!0===t.options.centerMode&&(t.options.slidesToScroll=1),e("img[data-lazy]",t.$slider).not("[src]").addClass("slick-loading"),t.setupInfinite(),t.buildArrows(),t.buildDots(),t.updateDots(),!0===t.options.accessibility&&t.$list.prop("tabIndex",0),t.setSlideClasses("number"==typeof this.currentSlide?this.currentSlide:0),!0===t.options.draggable&&t.$list.addClass("draggable")},i.prototype.checkResponsive=function(){var t,i,a,r=this,o=r.$slider.width(),n=window.innerWidth||e(window).width();if("window"===r.respondTo?a=n:"slider"===r.respondTo?a=o:"min"===r.respondTo&&(a=Math.min(n,o)),r.originalSettings.responsive&&r.originalSettings.responsive.length>-1&&null!==r.originalSettings.responsive){for(t in i=null,r.breakpoints)r.breakpoints.hasOwnProperty(t)&&a<r.breakpoints[t]&&(i=r.breakpoints[t]);null!==i?null!==r.activeBreakpoint?i!==r.activeBreakpoint&&(r.activeBreakpoint=i,r.options=e.extend({},r.originalSettings,r.breakpointSettings[i]),r.refresh()):(r.activeBreakpoint=i,r.options=e.extend({},r.originalSettings,r.breakpointSettings[i]),r.refresh()):null!==r.activeBreakpoint&&(r.activeBreakpoint=null,r.options=r.originalSettings,r.refresh())}},i.prototype.changeSlide=function(t,i){var a,r,o,n,s=this;switch(e(t.target).is("a")&&t.preventDefault(),a=s.slideCount%s.options.slidesToScroll!==0?0:(s.slideCount-s.currentSlide)%s.options.slidesToScroll,s.CurrentSlideDirection="",t.data.message){case"previous":s.CurrentSlideDirection="Prev",s.currentDirection=0,r=0===a?s.options.slidesToScroll:s.options.slidesToShow-a,s.slideCount>s.options.slidesToShow&&s.slideHandler(s.currentSlide-r,!1,i);break;case"next":s.CurrentSlideDirection="Next",s.currentDirection=1,r=0===a?s.options.slidesToScroll:a,s.slideCount>s.options.slidesToShow&&s.slideHandler(s.currentSlide+r,!1,i);break;case"index":s.CurrentSlideDirection="Index";var l=0===t.data.index?0:t.data.index||e(t.target).parent().index()*s.options.slidesToScroll;if(n=0,(o=s.getNavigableIndexes())[l]&&o[l]===l)if(l>o[o.length-1])l=o[o.length-1];else for(var d in o){if(l<o[d]){l=n;break}n=o[d]}s.slideHandler(l,!1,i);default:return}},i.prototype.clickHandler=function(e){!1===this.shouldClick&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault())},i.prototype.destroy=function(){var t=this;t.autoPlayClear(),t.touchObject={},e(".slick-cloned",t.$slider).remove(),t.$dots&&t.$dots.remove(),t.$prevArrow&&"object"!=typeof t.options.prevArrow&&t.$prevArrow.remove(),t.$nextArrow&&"object"!=typeof t.options.nextArrow&&t.$nextArrow.remove(),null!=t.$slides&&(t.$slides.parent().hasClass("slick-track")&&t.$slides.unwrap().unwrap(),t.$slides.removeClass("slick-slide slick-active slick-center slick-visible").removeAttr("index").css({position:"",left:"",top:"",zIndex:"",opacity:"",width:""}),t.$slider.removeClass("slick-slider"),t.$slider.removeClass("slick-initialized"),t.$list.off(".slick"),e(window).off(".slick-"+t.instanceUid),e(document).off(".slick-"+t.instanceUid))},i.prototype.disableTransition=function(e){var t=this,i={};i[t.transitionType]="",!1===t.options.fade?t.$slideTrack.css(i):t.$slides.eq(e).css(i)},i.prototype.fadeSlide=function(e,t,i){var a=this;!1===a.cssTransitions?(a.$slides.eq(t).css({zIndex:1e3}),a.$slides.eq(t).animate({opacity:1},a.options.speed,a.options.easing,i),a.$slides.eq(e).animate({opacity:0},a.options.speed,a.options.easing)):(a.applyTransition(t),a.applyTransition(e),a.$slides.eq(t).css({opacity:1,zIndex:1e3}),a.$slides.eq(e).css({opacity:0}),i&&setTimeout(function(){a.disableTransition(t),a.disableTransition(e),i.call()},a.options.speed))},i.prototype.filterSlides=function(e){var t=this;null!==e&&(t.unload(),t.$slideTrack.children(this.options.slide).detach(),t.$slidesCache.filter(e).appendTo(t.$slideTrack),t.reinit())},i.prototype.getCurrent=function(){return this.currentSlide},i.prototype.getDotCount=function(){var e=this,t=0,i=0,a=0;if(!0===e.options.infinite)a=Math.ceil(e.slideCount/e.options.slidesToScroll);else for(;t<e.slideCount;)++a,t=i+e.options.slidesToShow,i+=e.options.slidesToScroll<=e.options.slidesToShow?e.options.slidesToScroll:e.options.slidesToShow;return a-1},i.prototype.getLeft=function(e){var t,i,a,r=this,o=0;return r.slideOffset=0,i=r.$slides.first().outerHeight(),!0===r.options.infinite?(r.slideCount>r.options.slidesToShow&&(r.slideOffset=r.slideWidth*r.options.slidesToShow*-1,o=i*r.options.slidesToShow*-1),r.slideCount%r.options.slidesToScroll!==0&&e+r.options.slidesToScroll>r.slideCount&&r.slideCount>r.options.slidesToShow&&(e>r.slideCount?(r.slideOffset=(r.options.slidesToShow-(e-r.slideCount))*r.slideWidth*-1,o=(r.options.slidesToShow-(e-r.slideCount))*i*-1):(r.slideOffset=r.slideCount%r.options.slidesToScroll*r.slideWidth*-1,o=r.slideCount%r.options.slidesToScroll*i*-1))):e+r.options.slidesToShow>r.slideCount&&(r.slideOffset=(e+r.options.slidesToShow-r.slideCount)*r.slideWidth,o=(e+r.options.slidesToShow-r.slideCount)*i),r.slideCount<=r.options.slidesToShow&&(r.slideOffset=0,o=0),!0===r.options.centerMode&&!0===r.options.infinite?r.slideOffset+=r.slideWidth*Math.floor(r.options.slidesToShow/2)-r.slideWidth:!0===r.options.centerMode&&(r.slideOffset=0,r.slideOffset+=r.slideWidth*Math.floor(r.options.slidesToShow/2)),t=!1===r.options.vertical?e*r.slideWidth*-1+r.slideOffset:e*i*-1+o,!0===r.options.variableWidth&&(t=(a=r.slideCount<=r.options.slidesToShow||!1===r.options.infinite?r.$slideTrack.children(".slick-slide").eq(e):r.$slideTrack.children(".slick-slide").eq(e+r.options.slidesToShow))[0]?-1*a[0].offsetLeft:0,!0===r.options.centerMode&&(t=(a=!1===r.options.infinite?r.$slideTrack.children(".slick-slide").eq(e):r.$slideTrack.children(".slick-slide").eq(e+r.options.slidesToShow+1))[0]?-1*a[0].offsetLeft:0,t+=(r.$list.width()-a.outerWidth())/2)),t},i.prototype.getNavigableIndexes=function(){for(var e=this,t=0,i=0,a=[];t<e.slideCount;)a.push(t),t=i+e.options.slidesToScroll,i+=e.options.slidesToScroll<=e.options.slidesToShow?e.options.slidesToScroll:e.options.slidesToShow;return a},i.prototype.getSlideCount=function(){var t=this;if(!0===t.options.swipeToSlide){var i=null;return t.$slideTrack.find(".slick-slide").each(function(a,r){if(r.offsetLeft+e(r).outerWidth()/2>-1*t.swipeLeft)return i=r,!1}),Math.abs(e(i).attr("index")-t.currentSlide)}return t.options.slidesToScroll},i.prototype.init=function(){var t=this;e(t.$slider).hasClass("slick-initialized")||(e(t.$slider).addClass("slick-initialized"),t.buildOut(),t.setProps(),t.startLoad(),t.loadSlider(),t.initializeEvents(),t.updateArrows(),t.updateDots()),null!==t.options.onInit&&t.options.onInit.call(this,t)},i.prototype.initArrowEvents=function(){var e=this;!0===e.options.arrows&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow.on("click.slick",{message:"previous"},e.changeSlide),e.$nextArrow.on("click.slick",{message:"next"},e.changeSlide))},i.prototype.initDotEvents=function(){var t=this;!0===t.options.dots&&t.slideCount>t.options.slidesToShow&&e("li",t.$dots).on("click.slick",{message:"index"},t.changeSlide),!0===t.options.dots&&!0===t.options.pauseOnDotsHover&&!0===t.options.autoplay&&e("li",t.$dots).on("mouseenter.slick",function(){t.paused=!0,t.autoPlayClear()}).on("mouseleave.slick",function(){t.paused=!1,t.autoPlay()})},i.prototype.initializeEvents=function(){var t=this;t.initArrowEvents(),t.initDotEvents(),t.$list.on("touchstart.slick mousedown.slick",{action:"start"},t.swipeHandler),t.$list.on("touchmove.slick mousemove.slick",{action:"move"},t.swipeHandler),t.$list.on("touchend.slick mouseup.slick",{action:"end"},t.swipeHandler),t.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},t.swipeHandler),t.$list.on("click.slick",t.clickHandler),!0===t.options.pauseOnHover&&!0===t.options.autoplay&&(t.$list.on("mouseenter.slick",function(){t.paused=!0,t.autoPlayClear()}),t.$list.on("mouseleave.slick",function(){t.paused=!1,t.autoPlay()})),!0===t.options.accessibility&&t.$list.on("keydown.slick",t.keyHandler),!0===t.options.focusOnSelect&&e(t.options.slide,t.$slideTrack).on("click.slick",t.selectHandler),e(window).on("orientationchange.slick.slick-"+t.instanceUid,function(){t.checkResponsive(),t.setPosition()}),e(window).on("resize.slick.slick-"+t.instanceUid,function(){e(window).width()!==t.windowWidth&&(clearTimeout(t.windowDelay),t.windowDelay=window.setTimeout(function(){t.windowWidth=e(window).width(),t.checkResponsive(),t.setPosition()},50))}),e("*[draggable!=true]",t.$slideTrack).on("dragstart",function(e){e.preventDefault()}),e(window).on("load.slick.slick-"+t.instanceUid,t.setPosition),e(document).on("ready.slick.slick-"+t.instanceUid,t.setPosition)},i.prototype.initUI=function(){var e=this;!0===e.options.arrows&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow.show(),e.$nextArrow.show()),!0===e.options.dots&&e.slideCount>e.options.slidesToShow&&e.$dots.show(),!0===e.options.autoplay&&e.autoPlay()},i.prototype.keyHandler=function(e){var t=this;37===e.keyCode&&!0===t.options.accessibility?t.changeSlide({data:{message:"previous"}}):39===e.keyCode&&!0===t.options.accessibility&&t.changeSlide({data:{message:"next"}})},i.prototype.lazyLoad=function(){var t,i,a=this;function r(t){e(".lazy",t).each(function(){var t=e(this),i=e(this).attr("data-original");t.css({opacity:0}),t.is("img")?t.attr("src",i):t.css("background-image","url('"+i+"')"),t.removeAttr("data-original"),t.removeClass("slick-loading").removeClass("lazy");var a=new Image;e(a).load(function(){e(t).animate({opacity:1}).fadeIn()}),e(a).attr("src",i)})}!0===a.options.centerMode?!0===a.options.infinite?i=(t=a.currentSlide+(a.options.slidesToShow/2+1))+a.options.slidesToShow+2:(t=Math.max(0,a.currentSlide-(a.options.slidesToShow/2+1)),i=a.options.slidesToShow/2+1+2+a.currentSlide):(i=(t=a.options.infinite?a.options.slidesToShow+a.currentSlide:a.currentSlide)+a.options.slidesToShow,!0===a.options.fade&&(t>0&&t--,i<=a.slideCount&&i++)),r(a.$slider.find(".slick-slide").slice(t,i)),a.slideCount<=a.options.slidesToShow?r(a.$slider.find(".slick-slide")):a.currentSlide>=a.slideCount-a.options.slidesToShow?r(a.$slider.find(".slick-cloned").slice(0,a.options.slidesToShow)):0===a.currentSlide&&r(a.$slider.find(".slick-cloned").slice(-1*a.options.slidesToShow))},i.prototype.loadSlider=function(){var e=this;e.setPosition(),e.$slideTrack.css({opacity:1}),e.$slider.removeClass("slick-loading"),e.initUI(),"progressive"===e.options.lazyLoad&&e.progressiveLazyLoad()},i.prototype.postSlide=function(e){var t=this;null!==t.options.onAfterChange&&t.options.onAfterChange.call(this,t,e),t.animating=!1,t.setPosition(),t.swipeLeft=null,!0===t.options.autoplay&&!1===t.paused&&t.autoPlay()},i.prototype.progressiveLazyLoad=function(){var t,i=this;e("img[data-lazy]",i.$slider).length>0&&(t=e("img[data-lazy]",i.$slider).first()).attr("src",t.attr("data-lazy")).removeClass("slick-loading").load(function(){t.removeAttr("data-lazy"),i.progressiveLazyLoad()}).error(function(){t.removeAttr("data-lazy"),i.progressiveLazyLoad()})},i.prototype.refresh=function(){var t=this,i=t.currentSlide;t.destroy(),e.extend(t,t.initials),t.init(),t.changeSlide({data:{message:"index",index:i}},!0)},i.prototype.reinit=function(){var t=this;t.$slides=t.$slideTrack.children(t.options.slide).addClass("slick-slide"),t.slideCount=t.$slides.length,t.currentSlide>=t.slideCount&&0!==t.currentSlide&&(t.currentSlide=t.currentSlide-t.options.slidesToScroll),t.slideCount<=t.options.slidesToShow&&(t.currentSlide=0),t.setProps(),t.setupInfinite(),t.buildArrows(),t.updateArrows(),t.initArrowEvents(),t.buildDots(),t.updateDots(),t.initDotEvents(),!0===t.options.focusOnSelect&&e(t.options.slide,t.$slideTrack).on("click.slick",t.selectHandler),t.setSlideClasses(0),t.setPosition(),null!==t.options.onReInit&&t.options.onReInit.call(this,t)},i.prototype.removeSlide=function(e,t,i){var a=this;if(e="boolean"==typeof e?!0===(t=e)?0:a.slideCount-1:!0===t?--e:e,a.slideCount<1||e<0||e>a.slideCount-1)return!1;a.unload(),!0===i?a.$slideTrack.children().remove():a.$slideTrack.children(this.options.slide).eq(e).remove(),a.$slides=a.$slideTrack.children(this.options.slide),a.$slideTrack.children(this.options.slide).detach(),a.$slideTrack.append(a.$slides),a.$slidesCache=a.$slides,a.reinit()},i.prototype.setCSS=function(e){var t,i,a=this,r={};!0===a.options.rtl&&(e=-e),t="left"==a.positionProp?e+"px":"0px",i="top"==a.positionProp?e+"px":"0px",r[a.positionProp]=e,!1===a.transformsEnabled?a.$slideTrack.css(r):(r={},!1===a.cssTransitions?(r[a.animType]="translate("+t+", "+i+")",a.$slideTrack.css(r)):(r[a.animType]="translate3d("+t+", "+i+", 0px)",a.$slideTrack.css(r)))},i.prototype.setDimensions=function(){var t=this;if(!1===t.options.vertical?!0===t.options.centerMode&&t.$list.css({padding:"0px "+t.options.centerPadding}):(t.$list.height(t.$slides.first().outerHeight(!0)*t.options.slidesToShow),!0===t.options.centerMode&&t.$list.css({padding:t.options.centerPadding+" 0px"})),t.listWidth=t.$list.width(),t.listHeight=t.$list.height(),!1===t.options.vertical&&!1===t.options.variableWidth)t.slideWidth=Math.ceil(t.listWidth/t.options.slidesToShow),t.$slideTrack.width(Math.ceil(t.slideWidth*t.$slideTrack.children(".slick-slide").length));else if(!0===t.options.variableWidth){var i=0;t.slideWidth=Math.ceil(t.listWidth/t.options.slidesToShow),t.$slideTrack.children(".slick-slide").each(function(){i+=Math.ceil(e(this).outerWidth(!0))}),t.$slideTrack.width(Math.ceil(i)+1)}else t.slideWidth=Math.ceil(t.listWidth),t.$slideTrack.height(Math.ceil(t.$slides.first().outerHeight(!0)*t.$slideTrack.children(".slick-slide").length));var a=t.$slides.first().outerWidth(!0)-t.$slides.first().width();!1===t.options.variableWidth&&t.$slideTrack.children(".slick-slide").width(t.slideWidth-a)},i.prototype.setFade=function(){var t,i=this;i.$slides.each(function(a,r){t=i.slideWidth*a*-1,!0===i.options.rtl?e(r).css({position:"relative",right:t,top:0,zIndex:800,opacity:0}):e(r).css({position:"relative",left:t,top:0,zIndex:800,opacity:0})}),i.$slides.eq(i.currentSlide).css({zIndex:900,opacity:1})},i.prototype.setHeight=function(){var e=this;if(1===e.options.slidesToShow&&!0===e.options.adaptiveHeight&&!1===e.options.vertical){var t=e.$slides.eq(e.currentSlide).outerHeight(!0);e.$list.css("height",t)}},i.prototype.setPosition=function(){var e=this;e.setDimensions(),e.setHeight(),!1===e.options.fade?e.setCSS(e.getLeft(e.currentSlide)):e.setFade(),null!==e.options.onSetPosition&&e.options.onSetPosition.call(this,e)},i.prototype.setProps=function(){var e=this,t=document.body.style;e.positionProp=!0===e.options.vertical?"top":"left","top"===e.positionProp?e.$slider.addClass("slick-vertical"):e.$slider.removeClass("slick-vertical"),void 0===t.WebkitTransition&&void 0===t.MozTransition&&void 0===t.msTransition||!0===e.options.useCSS&&(e.cssTransitions=!0),void 0!==t.OTransform&&(e.animType="OTransform",e.transformType="-o-transform",e.transitionType="OTransition",void 0===t.perspectiveProperty&&void 0===t.webkitPerspective&&(e.animType=!1)),void 0!==t.MozTransform&&(e.animType="MozTransform",e.transformType="-moz-transform",e.transitionType="MozTransition",void 0===t.perspectiveProperty&&void 0===t.MozPerspective&&(e.animType=!1)),void 0!==t.webkitTransform&&(e.animType="webkitTransform",e.transformType="-webkit-transform",e.transitionType="webkitTransition",void 0===t.perspectiveProperty&&void 0===t.webkitPerspective&&(e.animType=!1)),void 0!==t.msTransform&&(e.animType="msTransform",e.transformType="-ms-transform",e.transitionType="msTransition",void 0===t.msTransform&&(e.animType=!1)),void 0!==t.transform&&!1!==e.animType&&(e.animType="transform",e.transformType="transform",e.transitionType="transition"),e.transformsEnabled=null!==e.animType&&!1!==e.animType},i.prototype.setSlideClasses=function(e){var t,i,a,r,o=this;o.$slider.find(".slick-slide").removeClass("slick-active").removeClass("slick-center"),i=o.$slider.find(".slick-slide"),!0===o.options.centerMode?(t=Math.floor(o.options.slidesToShow/2),!0===o.options.infinite&&(e>=t&&e<=o.slideCount-1-t?o.$slides.slice(e-t,e+t+1).addClass("slick-active"):(a=o.options.slidesToShow+e,i.slice(a-t+1,a+t+2).addClass("slick-active")),0===e?i.eq(i.length-1-o.options.slidesToShow).addClass("slick-center"):e===o.slideCount-1&&i.eq(o.options.slidesToShow).addClass("slick-center")),o.$slides.eq(e).addClass("slick-center")):e>=0&&e<=o.slideCount-o.options.slidesToShow?o.$slides.slice(e,e+o.options.slidesToShow).addClass("slick-active"):i.length<=o.options.slidesToShow?i.addClass("slick-active"):(r=o.slideCount%o.options.slidesToShow,a=!0===o.options.infinite?o.options.slidesToShow+e:e,o.options.slidesToShow==o.options.slidesToScroll&&o.slideCount-e<o.options.slidesToShow?i.slice(a-(o.options.slidesToShow-r),a+r).addClass("slick-active"):i.slice(a,a+o.options.slidesToShow).addClass("slick-active")),"ondemand"===o.options.lazyLoad&&o.lazyLoad()},i.prototype.setupInfinite=function(){var t,i,a,r=this;if(!0===r.options.fade&&(r.options.centerMode=!1),!0===r.options.infinite&&!1===r.options.fade&&(i=null,r.slideCount>r.options.slidesToShow)){for(a=!0===r.options.centerMode?r.options.slidesToShow+1:r.options.slidesToShow,t=r.slideCount;t>r.slideCount-a;t-=1)i=t-1,e(r.$slides[i]).clone(!0).attr("id","").attr("index",i-r.slideCount).prependTo(r.$slideTrack).addClass("slick-cloned");for(t=0;t<a;t+=1)i=t,e(r.$slides[i]).clone(!0).attr("id","").attr("index",i+r.slideCount).appendTo(r.$slideTrack).addClass("slick-cloned");r.$slideTrack.find(".slick-cloned").find("[id]").each(function(){e(this).attr("id","")})}},i.prototype.selectHandler=function(t){var i=this,a=parseInt(e(t.target).parents(".slick-slide").attr("index"));if(a||(a=0),i.slideCount<=i.options.slidesToShow)return i.$slider.find(".slick-slide").removeClass("slick-active"),i.$slides.eq(a).addClass("slick-active"),!0===i.options.centerMode&&(i.$slider.find(".slick-slide").removeClass("slick-center"),i.$slides.eq(a).addClass("slick-center")),void i.asNavFor(a);i.slideHandler(a)},i.prototype.slideHandler=function(e,t,i){var a,r,o,n,s,l=this;t=t||!1,!0===l.animating&&!0===l.options.waitForAnimate||!0===l.options.fade&&l.currentSlide===e||l.slideCount<=l.options.slidesToShow||(!1===t&&l.asNavFor(e),a=e,s=l.getLeft(a),n=l.getLeft(l.currentSlide),l.currentLeft=null===l.swipeLeft?n:l.swipeLeft,!1===l.options.infinite&&!1===l.options.centerMode&&(e<0||e>l.getDotCount()*l.options.slidesToScroll)||!1===l.options.infinite&&!0===l.options.centerMode&&(e<0||e>l.slideCount-l.options.slidesToScroll)?!1===l.options.fade&&(a=l.currentSlide,!0!==i?l.animateSlide(n,function(){l.postSlide(a)}):l.postSlide(a)):(!0===l.options.autoplay&&clearInterval(l.autoPlayTimer),r=a<0?l.slideCount%l.options.slidesToScroll!==0?l.slideCount-l.slideCount%l.options.slidesToScroll:l.slideCount+a:a>=l.slideCount?l.slideCount%l.options.slidesToScroll!==0?0:a-l.slideCount:a,l.animating=!0,null!==l.options.onBeforeChange&&e!==l.currentSlide&&l.options.onBeforeChange.call(this,l,l.currentSlide,r),o=l.currentSlide,l.currentSlide=r,l.setSlideClasses(l.currentSlide),l.updateDots(),l.updateArrows(),!0!==l.options.fade?!0!==i?l.animateSlide(s,function(){l.postSlide(r)}):l.postSlide(r):!0!==i?l.fadeSlide(o,r,function(){l.postSlide(r)}):l.postSlide(r)))},i.prototype.startLoad=function(){var e=this;!0===e.options.arrows&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow.hide(),e.$nextArrow.hide()),!0===e.options.dots&&e.slideCount>e.options.slidesToShow&&e.$dots.hide(),e.$slider.addClass("slick-loading")},i.prototype.swipeDirection=function(){var e,t,i,a,r=this;return e=r.touchObject.startX-r.touchObject.curX,t=r.touchObject.startY-r.touchObject.curY,i=Math.atan2(t,e),(a=Math.round(180*i/Math.PI))<0&&(a=360-Math.abs(a)),a<=45&&a>=0||a<=360&&a>=315?!1===r.options.rtl?"left":"right":a>=135&&a<=225?!1===r.options.rtl?"right":"left":"vertical"},i.prototype.swipeEnd=function(e){var t=this;if(t.dragging=!1,t.shouldClick=!(t.touchObject.swipeLength>10),void 0===t.touchObject.curX)return!1;if(t.CurrentSlideDirection="",t.touchObject.swipeLength>=t.touchObject.minSwipe)switch(t.swipeDirection()){case"left":t.CurrentSlideDirection="Next",t.slideHandler(t.currentSlide+t.getSlideCount()),t.currentDirection=1,t.touchObject={};break;case"right":t.CurrentSlideDirection="Prev",t.slideHandler(t.currentSlide-t.getSlideCount()),t.currentDirection=0,t.touchObject={}}else t.touchObject.startX!==t.touchObject.curX&&(t.slideHandler(t.currentSlide),t.touchObject={})},i.prototype.swipeHandler=function(t){var i=this;if(!(!1===i.options.swipe||"ontouchend"in document&&!1===i.options.swipe||!1===i.options.draggable&&-1!==t.type.indexOf("mouse"))){switch(i.touchObject.fingerCount=t.originalEvent&&void 0!==t.originalEvent.touches?t.originalEvent.touches.length:1,i.touchObject.minSwipe=i.listWidth/i.options.touchThreshold,t.data.action){case"start":i.swipeStart(t);break;case"move":i.swipeMove(t);break;case"end":i.swipeEnd(t)}-1!==t.type.indexOf("mouse")&&1==e(t.target).is("img")&&t.preventDefault()}},i.prototype.swipeMove=function(e){var t,i,a,r=this;return a=void 0!==e.originalEvent?e.originalEvent.touches:null,!(!r.dragging||a&&1!==a.length)&&(t=r.getLeft(r.currentSlide),r.touchObject.curX=void 0!==a?a[0].pageX:e.clientX,r.touchObject.curY=void 0!==a?a[0].pageY:e.clientY,r.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(r.touchObject.curX-r.touchObject.startX,2))),"vertical"!==r.swipeDirection()?(void 0!==e.originalEvent&&r.touchObject.swipeLength>4&&e.preventDefault(),i=(!1===r.options.rtl?1:-1)*(r.touchObject.curX>r.touchObject.startX?1:-1),!1===r.options.vertical?r.swipeLeft=t+r.touchObject.swipeLength*i:r.swipeLeft=t+r.touchObject.swipeLength*(r.$list.height()/r.listWidth)*i,!0!==r.options.fade&&!1!==r.options.touchMove&&(!0===r.animating?(r.swipeLeft=null,!1):void r.setCSS(r.swipeLeft))):void 0)},i.prototype.swipeStart=function(e){var t,i=this;if(1!==i.touchObject.fingerCount||i.slideCount<=i.options.slidesToShow)return i.touchObject={},!1;void 0!==e.originalEvent&&void 0!==e.originalEvent.touches&&(t=e.originalEvent.touches[0]),i.touchObject.startX=i.touchObject.curX=void 0!==t?t.pageX:e.clientX,i.touchObject.startY=i.touchObject.curY=void 0!==t?t.pageY:e.clientY,i.dragging=!0},i.prototype.unfilterSlides=function(){var e=this;null!==e.$slidesCache&&(e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.appendTo(e.$slideTrack),e.reinit())},i.prototype.unload=function(){var t=this;e(".slick-cloned",t.$slider).remove(),t.$dots&&t.$dots.remove(),t.$prevArrow&&"object"!=typeof t.options.prevArrow&&t.$prevArrow.remove(),t.$nextArrow&&"object"!=typeof t.options.nextArrow&&t.$nextArrow.remove(),t.$slides.removeClass("slick-slide slick-active slick-visible").css("width","")},i.prototype.updateArrows=function(){var e,t=this;e=Math.floor(t.options.slidesToShow/2),!0===t.options.arrows&&!0!==t.options.infinite&&t.slideCount>t.options.slidesToShow&&(t.$prevArrow.removeClass("slick-disabled"),t.$nextArrow.removeClass("slick-disabled"),t.$prevArrow.addClass("text-primary"),t.$nextArrow.addClass("text-primary"),t.$prevArrow.removeClass("border-outline"),t.$nextArrow.removeClass("border-outline"),0===t.currentSlide?(t.$prevArrow.addClass("slick-disabled"),t.$prevArrow.addClass("border-outline"),t.$prevArrow.removeClass("text-primary"),t.$nextArrow.removeClass("slick-disabled"),t.$nextArrow.addClass("text-primary")):(t.currentSlide>=t.slideCount-t.options.slidesToShow&&!1===t.options.centerMode||t.currentSlide>t.slideCount-t.options.slidesToShow+e&&!0===t.options.centerMode)&&(t.$nextArrow.addClass("slick-disabled"),t.$nextArrow.addClass("border-outline"),t.$nextArrow.removeClass("text-primary"),t.$prevArrow.removeClass("slick-disabled"),t.$prevArrow.addClass("text-primary")))},i.prototype.updateDots=function(){var e=this;null!==e.$dots&&(e.$dots.find("li").removeClass("slick-active"),e.$dots.find("li").eq(Math.floor(e.currentSlide/e.options.slidesToScroll)).addClass("slick-active"))},e.fn.slick=function(e){return this.each(function(t,a){a.slick=new i(a,e)})},e.fn.slickAdd=function(e,t,i){return this.each(function(a,r){r.slick.addSlide(e,t,i)})},e.fn.slickCurrentSlide=function(){return this.get(0).slick.getCurrent()},e.fn.slickFilter=function(e){return this.each(function(t,i){i.slick.filterSlides(e)})},e.fn.slickGoTo=function(e,t){return this.each(function(i,a){a.slick.changeSlide({data:{message:"index",index:parseInt(e)}},t)})},e.fn.slickNext=function(){return this.each(function(e,t){t.slick.changeSlide({data:{message:"next"}})})},e.fn.slickPause=function(){return this.each(function(e,t){t.slick.autoPlayClear(),t.slick.paused=!0})},e.fn.slickPlay=function(){return this.each(function(e,t){t.slick.paused=!1,t.slick.autoPlay()})},e.fn.slickPrev=function(){return this.each(function(e,t){t.slick.changeSlide({data:{message:"previous"}})})},e.fn.slickRemove=function(e,t){return this.each(function(i,a){a.slick.removeSlide(e,t)})},e.fn.slickRemoveAll=function(){return this.each(function(e,t){t.slick.removeSlide(null,null,!0)})},e.fn.slickGetOption=function(e){return this.get(0).slick.options[e]},e.fn.slickSetOption=function(e,t,i){return this.each(function(a,r){r.slick.options[e]=t,!0===i&&(r.slick.unload(),r.slick.reinit())})},e.fn.slickUnfilter=function(){return this.each(function(e,t){t.slick.unfilterSlides()})},e.fn.unslick=function(){return this.each(function(e,t){t.slick&&t.slick.destroy()})},e.fn.getSlick=function(){var e=null;return this.each(function(t,i){e=i.slick}),e}}),function(e){"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e("undefined"!=typeof module&&module.exports?require("jquery"):jQuery)}(function(e){"use strict";function t(t){return!t||void 0!==t.allowPageScroll||void 0===t.swipe&&void 0===t.swipeStatus||(t.allowPageScroll=d),void 0!==t.click&&void 0===t.tap&&(t.tap=t.click),t||(t={}),t=e.extend({},e.fn.swipe.defaults,t),this.each(function(){var a=e(this),r=a.data(w);r||(r=new i(this,t),a.data(w,r))})}function i(t,i){function P(t){if(!(!0===Se.data(w+"_intouch")||e(t.target).closest(i.excludedElements,Se).length>0)){var s=t.originalEvent?t.originalEvent:t;if(!s.pointerType||"mouse"!=s.pointerType||0!=i.fallbackToMouseEvents){var l,d=s.touches,c=d?d[0]:s;return ke=y,d?De=d.length:!1!==i.preventDefaultEvents&&t.preventDefault(),pe=0,he=null,me=null,ye=null,fe=0,ge=0,ve=0,Ae=1,Ce=0,(u={})[a]=te(a),u[r]=te(r),u[o]=te(o),u[n]=te(n),be=u,X(),Q(0,c),!d||De===i.fingers||i.fingers===A||G()?(Ie=oe(),2==De&&(Q(1,d[1]),ge=ve=ae(_e[0].start,_e[1].start)),(i.swipeStatus||i.pinchStatus)&&(l=E(s,ke))):l=!1,!1===l?(E(s,ke=k),l):(i.hold&&(Fe=setTimeout(e.proxy(function(){Se.trigger("hold",[s.target]),i.hold&&(l=i.hold.call(Se,s,s.target))},this),i.longTapThreshold)),J(!0),null)}}var u}function T(t){var u,p,h=t.originalEvent?t.originalEvent:t;if(ke!==S&&ke!==k&&!q()){var m,f=h.touches,C=K(f?f[0]:h);if(we=oe(),f&&(De=f.length),i.hold&&clearTimeout(Fe),ke=b,2==De&&(0==ge?(Q(1,f[1]),ge=ve=ae(_e[0].start,_e[1].start)):(K(f[1]),ve=ae(_e[0].end,_e[1].end),_e[0].end,_e[1].end,ye=Ae<1?l:s),Ae=(ve/ge*1).toFixed(2),Ce=Math.abs(ge-ve)),De===i.fingers||i.fingers===A||!f||G()){if(he=re(C.start,C.end),function(e,t){if(!1!==i.preventDefaultEvents)if(i.allowPageScroll===d)e.preventDefault();else{var s=i.allowPageScroll===c;switch(t){case a:(i.swipeLeft&&s||!s&&i.allowPageScroll!=g)&&e.preventDefault();break;case r:(i.swipeRight&&s||!s&&i.allowPageScroll!=g)&&e.preventDefault();break;case o:(i.swipeUp&&s||!s&&i.allowPageScroll!=v)&&e.preventDefault();break;case n:(i.swipeDown&&s||!s&&i.allowPageScroll!=v)&&e.preventDefault()}}}(t,me=re(C.last,C.end)),u=C.start,p=C.end,pe=Math.round(Math.sqrt(Math.pow(p.x-u.x,2)+Math.pow(p.y-u.y,2))),fe=ie(),function(e,t){e!=d&&(t=Math.max(t,ee(e)),be[e].distance=t)}(he,pe),m=E(h,ke),!i.triggerOnTouchEnd||i.triggerOnTouchLeave){var y=!0;if(i.triggerOnTouchLeave){var D=function(t){var i=(t=e(t)).offset(),a={left:i.left,right:i.left+t.outerWidth(),top:i.top,bottom:i.top+t.outerHeight()};return a}(this);y=function(e,t){return e.x>t.left&&e.x<t.right&&e.y>t.top&&e.y<t.bottom}(C.end,D)}!i.triggerOnTouchEnd&&y?ke=M(b):i.triggerOnTouchLeave&&!y&&(ke=M(S)),ke!=k&&ke!=S||E(h,ke)}}else E(h,ke=k);!1===m&&E(h,ke=k)}}function B(e){var t=e.originalEvent?e.originalEvent:e,a=t.touches;if(a){if(a.length&&!q())return function(e){Pe=oe(),Te=e.touches.length+1}(t),!0;if(a.length&&q())return!0}return q()&&(De=Te),we=oe(),fe=ie(),L()||!N()?E(t,ke=k):i.triggerOnTouchEnd||!1===i.triggerOnTouchEnd&&ke===b?(!1!==i.preventDefaultEvents&&!1!==e.cancelable&&e.preventDefault(),E(t,ke=S)):!i.triggerOnTouchEnd&&Y()?$(t,ke=S,h):ke===b&&E(t,ke=k),J(!1),null}function x(){De=0,we=0,Ie=0,ge=0,ve=0,Ae=1,X(),J(!1)}function F(e){var t=e.originalEvent?e.originalEvent:e;i.triggerOnTouchLeave&&E(t,ke=M(S))}function O(){Se.unbind(se,P),Se.unbind(ue,x),Se.unbind(le,T),Se.unbind(de,B),ce&&Se.unbind(ce,F),J(!1)}function M(e){var t=e,a=U(),r=N(),o=L();return!a||o?t=k:!r||e!=b||i.triggerOnTouchEnd&&!i.triggerOnTouchLeave?!r&&e==S&&i.triggerOnTouchLeave&&(t=k):t=S,t}function E(e,t){var a,r=e.touches;return(!(!W()||!V())||V())&&(a=$(e,t,u)),(!(!R()||!G())||G())&&!1!==a&&(a=$(e,t,p)),z()&&Z()&&!1!==a?a=$(e,t,m):fe>i.longTapThreshold&&pe<C&&i.longTap&&!1!==a?a=$(e,t,f):!(1!==De&&D||!(isNaN(pe)||pe<i.threshold)||!Y())&&!1!==a&&(a=$(e,t,h)),t===k&&x(),t===S&&(r&&r.length||x()),a}function $(t,d,c){var g;if(c==u){if(Se.trigger("swipeStatus",[d,he||null,pe||0,fe||0,De,_e,me]),i.swipeStatus&&!1===(g=i.swipeStatus.call(Se,t,d,he||null,pe||0,fe||0,De,_e,me)))return!1;if(d==S&&W()){if(clearTimeout(xe),clearTimeout(Fe),Se.trigger("swipe",[he,pe,fe,De,_e,me]),i.swipe&&!1===(g=i.swipe.call(Se,t,he,pe,fe,De,_e,me)))return!1;switch(he){case a:Se.trigger("swipeLeft",[he,pe,fe,De,_e,me]),i.swipeLeft&&(g=i.swipeLeft.call(Se,t,he,pe,fe,De,_e,me));break;case r:Se.trigger("swipeRight",[he,pe,fe,De,_e,me]),i.swipeRight&&(g=i.swipeRight.call(Se,t,he,pe,fe,De,_e,me));break;case o:Se.trigger("swipeUp",[he,pe,fe,De,_e,me]),i.swipeUp&&(g=i.swipeUp.call(Se,t,he,pe,fe,De,_e,me));break;case n:Se.trigger("swipeDown",[he,pe,fe,De,_e,me]),i.swipeDown&&(g=i.swipeDown.call(Se,t,he,pe,fe,De,_e,me))}}}if(c==p){if(Se.trigger("pinchStatus",[d,ye||null,Ce||0,fe||0,De,Ae,_e]),i.pinchStatus&&!1===(g=i.pinchStatus.call(Se,t,d,ye||null,Ce||0,fe||0,De,Ae,_e)))return!1;if(d==S&&R())switch(ye){case s:Se.trigger("pinchIn",[ye||null,Ce||0,fe||0,De,Ae,_e]),i.pinchIn&&(g=i.pinchIn.call(Se,t,ye||null,Ce||0,fe||0,De,Ae,_e));break;case l:Se.trigger("pinchOut",[ye||null,Ce||0,fe||0,De,Ae,_e]),i.pinchOut&&(g=i.pinchOut.call(Se,t,ye||null,Ce||0,fe||0,De,Ae,_e))}}return c==h?d!==k&&d!==S||(clearTimeout(xe),clearTimeout(Fe),Z()&&!z()?(Be=oe(),xe=setTimeout(e.proxy(function(){Be=null,Se.trigger("tap",[t.target]),i.tap&&(g=i.tap.call(Se,t,t.target))},this),i.doubleTapThreshold)):(Be=null,Se.trigger("tap",[t.target]),i.tap&&(g=i.tap.call(Se,t,t.target)))):c==m?d!==k&&d!==S||(clearTimeout(xe),clearTimeout(Fe),Be=null,Se.trigger("doubletap",[t.target]),i.doubleTap&&(g=i.doubleTap.call(Se,t,t.target))):c==f&&(d!==k&&d!==S||(clearTimeout(xe),Be=null,Se.trigger("longtap",[t.target]),i.longTap&&(g=i.longTap.call(Se,t,t.target)))),g}function N(){var e=!0;return null!==i.threshold&&(e=pe>=i.threshold),e}function L(){var e=!1;return null!==i.cancelThreshold&&null!==he&&(e=ee(he)-pe>=i.cancelThreshold),e}function U(){return!(i.maxTimeThreshold&&fe>=i.maxTimeThreshold)}function R(){var e=j(),t=H(),a=null===i.pinchThreshold||Ce>=i.pinchThreshold;return e&&t&&a}function G(){return!!(i.pinchStatus||i.pinchIn||i.pinchOut)}function W(){var e=U(),t=N(),i=j(),a=H();return!L()&&a&&i&&t&&e}function V(){return!!(i.swipe||i.swipeStatus||i.swipeLeft||i.swipeRight||i.swipeUp||i.swipeDown)}function j(){return De===i.fingers||i.fingers===A||!D}function H(){return 0!==_e[0].end.x}function Y(){return!!i.tap}function Z(){return!!i.doubleTap}function z(){if(null==Be)return!1;var e=oe();return Z()&&e-Be<=i.doubleTapThreshold}function X(){Pe=0,Te=0}function q(){var e=!1;Pe&&(oe()-Pe<=i.fingerReleaseThreshold&&(e=!0));return e}function J(e){Se&&(!0===e?(Se.bind(le,T),Se.bind(de,B),ce&&Se.bind(ce,F)):(Se.unbind(le,T,!1),Se.unbind(de,B,!1),ce&&Se.unbind(ce,F,!1)),Se.data(w+"_intouch",!0===e))}function Q(e,t){var i={start:{x:0,y:0},last:{x:0,y:0},end:{x:0,y:0}};return i.start.x=i.last.x=i.end.x=t.pageX||t.clientX,i.start.y=i.last.y=i.end.y=t.pageY||t.clientY,_e[e]=i,i}function K(e){var t=void 0!==e.identifier?e.identifier:0,i=function(e){return _e[e]||null}(t);return null===i&&(i=Q(t,e)),i.last.x=i.end.x,i.last.y=i.end.y,i.end.x=e.pageX||e.clientX,i.end.y=e.pageY||e.clientY,i}function ee(e){if(be[e])return be[e].distance}function te(e){return{direction:e,distance:0}}function ie(){return we-Ie}function ae(e,t){var i=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);return Math.round(Math.sqrt(i*i+a*a))}function re(e,t){if(s=t,(i=e).x==s.x&&i.y==s.y)return d;var i,s,l=function(e,t){var i=e.x-t.x,a=t.y-e.y,r=Math.atan2(a,i),o=Math.round(180*r/Math.PI);return o<0&&(o=360-Math.abs(o)),o}(e,t);return l<=45&&l>=0||l<=360&&l>=315?a:l>=135&&l<=225?r:l>45&&l<135?n:o}function oe(){return(new Date).getTime()}i=e.extend({},i);var ne=D||I||!i.fallbackToMouseEvents,se=ne?I?_?"MSPointerDown":"pointerdown":"touchstart":"mousedown",le=ne?I?_?"MSPointerMove":"pointermove":"touchmove":"mousemove",de=ne?I?_?"MSPointerUp":"pointerup":"touchend":"mouseup",ce=ne?I?"mouseleave":null:"mouseleave",ue=I?_?"MSPointerCancel":"pointercancel":"touchcancel",pe=0,he=null,me=null,fe=0,ge=0,ve=0,Ae=1,Ce=0,ye=0,be=null,Se=e(t),ke="start",De=0,_e={},Ie=0,we=0,Pe=0,Te=0,Be=0,xe=null,Fe=null;try{Se.bind(se,P),Se.bind(ue,x)}catch(t){e.error("events not supported "+se+","+ue+" on jQuery.swipe")}this.enable=function(){return this.disable(),Se.bind(se,P),Se.bind(ue,x),Se},this.disable=function(){return O(),Se},this.destroy=function(){O(),Se.data(w,null),Se=null},this.option=function(t,a){if("object"==typeof t)i=e.extend(i,t);else if(void 0!==i[t]){if(void 0===a)return i[t];i[t]=a}else{if(!t)return i;e.error("Option "+t+" does not exist on jQuery.swipe.options")}return null}}var a="left",r="right",o="up",n="down",s="in",l="out",d="none",c="auto",u="swipe",p="pinch",h="tap",m="doubletap",f="longtap",g="horizontal",v="vertical",A="all",C=10,y="start",b="move",S="end",k="cancel",D="ontouchstart"in window,_=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled&&!D,I=(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&!D,w="TouchSwipe";e.fn.swipe=function(i){var a=e(this),r=a.data(w);if(r&&"string"==typeof i){if(r[i])return r[i].apply(r,Array.prototype.slice.call(arguments,1));e.error("Method "+i+" does not exist on jQuery.swipe")}else if(r&&"object"==typeof i)r.option.apply(r,arguments);else if(!(r||"object"!=typeof i&&i))return t.apply(this,arguments);return a},e.fn.swipe.version="1.6.18",e.fn.swipe.defaults={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:!0,triggerOnTouchLeave:!1,allowPageScroll:"auto",fallbackToMouseEvents:!0,excludedElements:".noSwipe",preventDefaultEvents:!0},e.fn.swipe.phases={PHASE_START:y,PHASE_MOVE:b,PHASE_END:S,PHASE_CANCEL:k},e.fn.swipe.directions={LEFT:a,RIGHT:r,UP:o,DOWN:n,IN:s,OUT:l},e.fn.swipe.pageScroll={NONE:d,HORIZONTAL:g,VERTICAL:v,AUTO:c},e.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,FOUR:4,FIVE:5,ALL:A}}),function(e){null==e.isNumeric&&(e.isNumeric=function(e){return null!=e&&e.constructor===Number}),null==e.isFunction&&(e.isFunction=function(e){return null!=e&&e instanceof Function});var t=e(window),i=e(document),a={defaultConfig:{animate:!1,cellW:100,cellH:100,delay:0,engine:"giot",fixSize:null,gutterX:15,gutterY:15,keepOrder:!1,selector:"> div",draggable:!1,cacheSize:!0,rightToLeft:!1,bottomToTop:!1,onGapFound:function(){},onComplete:function(){},onResize:function(){},onBlockDrag:function(){},onBlockMove:function(){},onBlockDrop:function(){},onBlockReady:function(){},onBlockFinish:function(){},onBlockActive:function(){},onBlockResize:function(){}},plugin:{},totalGrid:1,transition:!1,loadBlock:function(t,i){var a=i.runtime,r=a.gutterX,o=a.gutterY,n=a.cellH,s=a.cellW,l=null,d=e(t),c=d.data("active"),u=d.attr("data-position"),p=parseInt(d.attr("data-fixSize")),h=a.lastId+++"-"+a.totalGrid;if(d.hasClass("fw-float"))return null;d.attr({id:h,"data-delay":t.index}),i.animate&&this.transition&&this.setTransition(t,""),isNaN(p)&&(p=null),null==p&&(p=i.fixSize);var m=p?"ceil":"round";null==d.attr("data-height")&&d.attr("data-height",d.height()),null==d.attr("data-width")&&d.attr("data-width",d.width());var f=1*d.attr("data-height"),g=1*d.attr("data-width");i.cacheSize||(t.style.width="",g=d.width(),t.style.height="",f=d.height());var v=g?Math[m]((g+r)/s):0,A=f?Math[m]((f+o)/n):0;if(p||"auto"!=i.cellH||(d.width(s*v-r),t.style.height="",A=(f=d.height())?Math.round((f+o)/n):0),p||"auto"!=i.cellW||(d.height(n*A-o),t.style.width="",v=(g=d.width())?Math.round((g+r)/s):0),null!=p&&(v>a.limitCol||A>a.limitRow))l=null;else if(A&&A<a.minHoB&&(a.minHoB=A),v&&v<a.minWoB&&(a.minWoB=v),A>a.maxHoB&&(a.maxHoB=A),v>a.maxWoB&&(a.maxWoB=v),0==g&&(v=0),0==f&&(A=0),l={resize:!1,id:h,width:v,height:A,fixSize:p},u){u=u.split("-"),l.y=1*u[0],l.x=1*u[1],l.width=null!=p?v:Math.min(v,a.limitCol-l.x),l.height=null!=p?A:Math.min(A,a.limitRow-l.y);var C=l.y+"-"+l.x+"-"+l.width+"-"+l.height;c?(a.holes[C]={id:l.id,top:l.y,left:l.x,width:l.width,height:l.height},this.setBlock(l,i)):delete a.holes[C]}return null==d.attr("data-state")?d.attr("data-state","init"):d.attr("data-state","move"),i.onBlockReady.call(t,l,i),u&&c?null:l},setBlock:function(e,t){var i=t.runtime,a=i.gutterX,r=i.gutterY,o=e.height,n=e.width,s=i.cellH,l=i.cellW,d=e.x,c=e.y;t.rightToLeft&&(d=i.limitCol-d-n),t.bottomToTop&&(c=i.limitRow-c-o);var u={fixSize:e.fixSize,resize:e.resize,top:c*s,left:d*l,width:l*n-a,height:s*o-r};return u.top=1*u.top.toFixed(2),u.left=1*u.left.toFixed(2),u.width=1*u.width.toFixed(2),u.height=1*u.height.toFixed(2),e.id&&(i.blocks[e.id]=u),u},showBlock:function(t,i){var a=i.runtime,r=i.animate&&!this.transition?"animate":"css",o=a.blocks[t.id],n=e(t),s=this,l="move"!=n.attr("data-state"),d=l?"width 0.5s, height 0.5s":"top 0.5s, left 0.5s, width 0.5s, height 0.5s, opacity 0.5s";function c(){if(l&&n.attr("data-state","start"),i.animate&&s.transition&&s.setTransition(t,d),a.length-=1,o)o.fixSize&&(o.height=1*n.attr("data-height"),o.width=1*n.attr("data-width")),n.css({opacity:1,width:o.width,height:o.height}),n[r]({top:o.top,left:o.left}),null!=n.attr("data-nested")&&s.nestedGrid(t,i);else{var e=parseInt(t.style.height)||0,c=parseInt(t.style.width)||0,u=parseInt(t.style.left)||0,p=parseInt(t.style.top)||0;n[r]({left:u+c/2,top:p+e/2,width:0,height:0,opacity:0})}if(i.onBlockFinish.call(t,o,i),0==a.length){var h=i.animate?500:0;t.delay=setTimeout(function(){i.onComplete.call(t,o,i)},h)}}t.delay&&clearTimeout(t.delay),n.hasClass("fw-float")||(s.setTransition(t,""),t.style.position="absolute",i.onBlockActive.call(t,o,i),o&&o.resize&&i.onBlockResize.call(t,o,i),i.delay>0?t.delay=setTimeout(c,i.delay*n.attr("data-delay")):c())},nestedGrid:function(t,i){var a,r=e(t),n=i.runtime,s=r.attr("data-gutterX")||i.gutterX,l=r.attr("data-gutterY")||i.gutterY,d=r.attr("data-method")||"fitZone",c=r.attr("data-nested")||"> div",u=r.attr("data-cellH")||i.cellH,p=r.attr("data-cellW")||i.cellW,h=n.blocks[t.id];if(h)switch((a=new o(r)).reset({cellH:u,cellW:p,gutterX:1*s,gutterY:1*l,selector:c,cacheSize:!1}),d){case"fitHeight":a[d](h.height);break;case"fitWidth":a[d](h.width);break;case"fitZone":a[d](h.width,h.height)}},adjustBlock:function(t,i){var a=i.runtime,r=a.gutterX,o=a.gutterY,n=e("#"+t.id),s=a.cellH,l=a.cellW;"auto"==i.cellH&&(n.width(t.width*l-r),n[0].style.height="",t.height=Math.round((n.height()+o)/s))},adjustUnit:function(t,i,a){var r=a.gutterX,o=a.gutterY,n=a.runtime,s=a.cellW,l=a.cellH;if(e.isFunction(s)&&(s=s(t)),s*=1,!e.isNumeric(s)&&(s=1),e.isFunction(l)&&(l=l(i)),l*=1,!e.isNumeric(l)&&(l=1),e.isNumeric(t)){s<1&&(s*=t);var d=Math.max(1,Math.floor(t/s));e.isNumeric(r)||(r=(t-d*s)/Math.max(1,d-1),r=Math.max(0,r)),d=Math.floor((t+r)/s),n.cellW=(t+r)/Math.max(d,1),n.cellS=n.cellW/s,n.gutterX=r,n.limitCol=d}if(e.isNumeric(i)){l<1&&(l*=i);var c=Math.max(1,Math.floor(i/l));e.isNumeric(o)||(o=(i-c*l)/Math.max(1,c-1),o=Math.max(0,o)),c=Math.floor((i+o)/l),n.cellH=(i+o)/Math.max(c,1),n.cellS=n.cellH/l,n.gutterY=o,n.limitRow=c}e.isNumeric(t)||(s<1&&(s=n.cellH),n.cellW=1!=s?s*n.cellS:1,n.gutterX=r,n.limitCol=666666),e.isNumeric(i)||(l<1&&(l=n.cellW),n.cellH=1!=l?l*n.cellS:1,n.gutterY=o,n.limitRow=666666),n.keepOrder=a.keepOrder},resetGrid:function(e){e.blocks={},e.length=0,e.cellH=0,e.cellW=0,e.lastId=1,e.matrix={},e.totalCol=0,e.totalRow=0},setDraggable:function(t,a){var r=!1,o={startX:0,startY:0,top:0,left:0,handle:null,onDrop:function(){},onDrag:function(){},onStart:function(){}};e(t).each(function(){var t=e.extend({},o,a),n=t.handle||this,s=this,l=e(s),d=e(n);function c(e){e=e.originalEvent,r&&(e=e.changedTouches[0]),l.css({top:t.top-(t.startY-e.clientY),left:t.left-(t.startX-e.clientX)}),t.onDrag.call(s,e)}function u(e){e=e.originalEvent,r&&(e=e.changedTouches[0]),t.onDrop.call(s,e),i.unbind("mouseup touchend",u),i.unbind("mousemove touchmove",c)}"absolute"!=l.css("position")&&l.css("position","relative"),l.find("iframe, form, input, textarea, .ignore-drag").each(function(){e(this).on("touchstart mousedown",function(e){e.stopPropagation()})}),i.unbind("mouseup touchend",u),i.unbind("mousemove touchmove",c),d.unbind("mousedown touchstart").bind("mousedown touchstart",function(e){return e.stopPropagation(),(e=e.originalEvent).touches&&(r=!0,e=e.changedTouches[0]),2!=e.button&&3!=e.which&&(t.onStart.call(s,e),t.startX=e.clientX,t.startY=e.clientY,t.top=parseInt(l.css("top"))||0,t.left=parseInt(l.css("left"))||0,i.bind("mouseup touchend",u),i.bind("mousemove touchmove",c)),!1})})},setTransition:function(t,i){var a=t.style,r=e(t);!this.transition&&r.stop?r.stop():null!=a.webkitTransition?a.webkitTransition=i:null!=a.MozTransition?a.MozTransition=i:null!=a.msTransition?a.msTransition=i:null!=a.OTransition?a.OTransition=i:a.transition=i},getFreeArea:function(e,t,i){for(var a=Math.min(e+i.maxHoB,i.limitRow),r=Math.min(t+i.maxWoB,i.limitCol),o=r,n=a,s=i.matrix,l=e;l<n;++l)for(var d=t;d<r;++d)s[l+"-"+d]&&t<d&&d<o&&(o=d);for(l=e;l<a;++l)for(d=t;d<o;++d)s[l+"-"+d]&&e<l&&l<n&&(n=l);return{top:e,left:t,width:o-t,height:n-e}},setWallSize:function(e,t){var i=e.totalRow,a=e.totalCol,r=e.gutterY,o=e.gutterX,n=e.cellH,s=e.cellW,l=Math.max(0,s*a-o),d=Math.max(0,n*i-r);t.attr({"data-total-col":a,"data-total-row":i,"data-wall-width":Math.ceil(l),"data-wall-height":Math.ceil(d)}),e.limitCol<e.limitRow&&!t.attr("data-height")&&t.height(Math.ceil(d))}},r={giot:function(e,t){var i=t.runtime,r=i.limitRow,o=i.limitCol,n=0,s=0,l=i.totalCol,d=i.totalRow,c={},u=i.holes,p=null,h=i.matrix,m=Math.max(o,r),f=null,g=null,v=o<r?1:0,A=null,C=Math.min(o,r);function y(e,t,i,a,r){for(var o=t;o<t+r;){for(var n=i;n<i+a;)h[o+"-"+n]=e,++n>l&&(l=n);++o>d&&(d=o)}}for(var b in u)u.hasOwnProperty(b)&&y(u[b].id||!0,u[b].top,u[b].left,u[b].width,u[b].height);for(var S=0;S<m&&e.length;++S){v?s=S:n=S,A=null;for(var k=0;k<C&&e.length;++k)if(p=null,v?n=k:s=k,!i.matrix[s+"-"+n]){if(f=a.getFreeArea(s,n,i),null==t.fixSize){if(A&&!v&&i.minHoB>f.height){A.height+=f.height,A.resize=!0,y(A.id,A.y,A.x,A.width,A.height),a.setBlock(A,t);continue}if(A&&v&&i.minWoB>f.width){A.width+=f.width,A.resize=!0,y(A.id,A.y,A.x,A.width,A.height),a.setBlock(A,t);continue}}if(i.keepOrder)(p=e.shift()).resize=!0;else{for(b=0;b<e.length;++b)if(!(e[b].height>f.height||e[b].width>f.width)){p=e.splice(b,1)[0];break}if(null==p&&null==t.fixSize)for(b=0;b<e.length;++b)if(null==e[b].fixSize){(p=e.splice(b,1)[0]).resize=!0;break}}if(null!=p)p.resize&&(v?(p.width=f.width,"auto"==t.cellH&&a.adjustBlock(p,t),p.height=Math.min(p.height,f.height)):(p.height=f.height,p.width=Math.min(p.width,f.width))),c[p.id]={id:p.id,x:n,y:s,width:p.width,height:p.height,resize:p.resize,fixSize:p.fixSize},y((A=c[p.id]).id,A.y,A.x,A.width,A.height),a.setBlock(A,t);else{g={x:n,y:s,fixSize:0};if(v){g.width=f.width,g.height=0;for(var D=n-1,_=s;h[_+"-"+D];)h[_+"-"+n]=!0,g.height+=1,_+=1}else{g.height=f.height,g.width=0;for(_=s-1,D=n;h[_+"-"+D];)h[s+"-"+D]=!0,g.width+=1,D+=1}t.onGapFound(a.setBlock(g,t),t)}}}i.matrix=h,i.totalRow=d,i.totalCol=l}};function o(i){var o=e(i);"static"==o.css("position")&&o.css("position","relative");var n=Number.MAX_VALUE,s=this;a.totalGrid+=1;var l=e.extend({},a.defaultConfig),d={arguments:null,blocks:{},events:{},matrix:{},holes:{},cellW:0,cellH:0,cellS:1,filter:"",lastId:0,length:0,maxWoB:0,maxHoB:0,minWoB:n,minHoB:n,running:0,gutterX:15,gutterY:15,totalCol:0,totalRow:0,limitCol:666666,limitRow:666666,sortFunc:null,keepOrder:!1};l.runtime=d,d.totalGrid=a.totalGrid;var c=document.body.style;function u(t){d.gutterX,d.gutterY;var i=d.cellH,r=d.cellW,o=e(t),n=o.find(o.attr("data-handle"));a.setDraggable(t,{handle:n[0],onStart:function(e){l.animate&&a.transition&&a.setTransition(this,""),o.css("z-index",9999).addClass("fw-float"),l.onBlockDrag.call(t,e)},onDrag:function(e,a){var n=o.position(),c=Math.round(n.top/i),u=Math.round(n.left/r),p=Math.round(o.width()/r),h=Math.round(o.height()/i);c=Math.min(Math.max(0,c),d.limitRow-h),u=Math.min(Math.max(0,u),d.limitCol-p),s.setHoles({top:c,left:u,width:p,height:h}),s.refresh(),l.onBlockMove.call(t,e)},onDrop:function(a){var n,c,u,p,h=o.position(),m=Math.round(h.top/i),f=Math.round(h.left/r),g=Math.round(o.width()/r),v=Math.round(o.height()/i);for(m=Math.min(Math.max(0,m),d.limitRow-v),f=Math.min(Math.max(0,f),d.limitCol-g),o.removeClass("fw-float"),o.css({zIndex:"auto",top:m*i,left:f*r}),c=0;c<v;++c)for(n=0;n<g;++n)u=c+m+"-"+(n+f),(p=d.matrix[u])&&1!=p&&e("#"+p).removeAttr("data-position");d.holes={},o.attr({"data-width":o.width(),"data-height":o.height(),"data-position":m+"-"+f}),s.refresh(),l.onBlockDrop.call(t,a)}})}for(var p in a.transition||(null!=c.webkitTransition||null!=c.MozTransition||null!=c.msTransition||null!=c.OTransition||null!=c.transition)&&(a.transition=!0),e.extend(s,{addCustomEvent:function(e,t){var i=d.events;return!i[e=e.toLowerCase()]&&(i[e]=[]),t.eid=i[e].length,i[e].push(t),this},appendBlock:function(t){var i=e(t).appendTo(o),n=null,s=[];d.arguments&&(e.isFunction(d.sortFunc)&&i.sort(d.sortFunc),i.each(function(e,t){t.index=++e,(n=a.loadBlock(t,l))&&s.push(n)}),r[l.engine](s,l),a.setWallSize(d,o),d.length=i.length,i.each(function(e,t){a.showBlock(t,l),(l.draggable||t.getAttribute("data-draggable"))&&u(t)}))},appendHoles:function(e){var t,i=[].concat(e),a={};for(t=0;t<i.length;++t)a=i[t],d.holes[a.top+"-"+a.left+"-"+a.width+"-"+a.height]=a;return this},container:o,destroy:function(){o.find(l.selector).removeAttr("id").each(function(t,i){$item=e(i);var a=1*$item.attr("data-width")||"",r=1*$item.attr("data-height")||"";$item.width(a).height(r).css({position:"static"})})},fillHoles:function(e){if(0==arguments.length)d.holes={};else{var t,i=[].concat(e),a={};for(t=0;t<i.length;++t)a=i[t],delete d.holes[a.top+"-"+a.left+"-"+a.width+"-"+a.height]}return this},filter:function(e){return d.filter=e,d.arguments&&this.refresh(),this},fireEvent:function(e,t,i){var a=d.events;if(a[e=e.toLowerCase()]&&a[e].length)for(var r=0;r<a[e].length;++r)a[e][r].call(this,t,i);return this},fitHeight:function(e){e=e||(o.height()||t.height());this.fitZone("auto",e),d.arguments=arguments},fitWidth:function(e){e=e||(o.width()||t.width());this.fitZone(e,"auto"),d.arguments=arguments},fitZone:function(i,n){var c=o.find(l.selector).removeAttr("id"),p=null,h=[];n=n||(o.height()||t.height()),i=i||(o.width()||t.width()),d.arguments=arguments,a.resetGrid(d),a.adjustUnit(i,n,l),d.filter?(c.data("active",0),c.filter(d.filter).data("active",1)):c.data("active",1),e.isFunction(d.sortFunc)&&c.sort(d.sortFunc),c.each(function(t,i){var r=e(i);i.index=++t,(p=a.loadBlock(i,l))&&r.data("active")&&h.push(p)}),s.fireEvent("onGridReady",o,l),r[l.engine](h,l),a.setWallSize(d,o),s.fireEvent("onGridArrange",o,l),d.length=c.length,c.each(function(e,t){a.showBlock(t,l),(l.draggable||t.getAttribute("data-draggable"))&&u(t)})},fixPos:function(t){return e(t.block).attr({"data-position":t.top+"-"+t.left}),this},fixSize:function(t){return null!=t.height&&e(t.block).attr({"data-height":t.height}),null!=t.width&&e(t.block).attr({"data-width":t.width}),this},prepend:function(e){return o.prepend(e),d.arguments&&this.refresh(),this},refresh:function(){var e=arguments.length?arguments:d.arguments,t=d.arguments;return(t?t.callee:this.fitWidth).apply(this,Array.prototype.slice.call(e,0)),this},reset:function(t){return e.extend(l,t),this},setHoles:function(e){var t,i=[].concat(e),a={};for(d.holes={},t=0;t<i.length;++t)a=i[t],d.holes[a.top+"-"+a.left+"-"+a.width+"-"+a.height]=a;return this},sortBy:function(e){return d.sortFunc=e,d.arguments&&this.refresh(),this},unFilter:function(){return delete d.filter,this.refresh(),this}}),o.attr("data-min-width",80*Math.floor(t.width()/80)),a.plugin)a.plugin.hasOwnProperty(p)&&a.plugin[p].call(s,l,o);t.resize(function(){d.running||(d.running=1,setTimeout(function(){d.running=0,l.onResize.call(s,o)},122),o.attr("data-min-width",80*Math.floor(t.width()/80)))})}o.addConfig=function(t){e.extend(a.defaultConfig,t)},o.createEngine=function(t){e.extend(r,t)},o.createPlugin=function(t){e.extend(a.plugin,t)},o.getMethod=function(e){return a[e]},window.Freewall=window.freewall=o}(window.Zepto||window.jQuery);var ajaxQueue=$({}),currentRequest=null;vagaro={},function(e){vagaro.ajax=function(){this.datamodel={},this.datamodel.url="",this.datamodel.data="",this.datamodel.callback="",this.datamodel.Token="",this.datamodel.Error,this.datamodel.async=!0,this.datamodel.ErrorMessage="An Error Has Occurred",this.datamodel.GroupToken="",this.datamodel.IsNewVagaroAPI=!1,this.datamodel.Proxy=!1,this.datamodel.RouteParameter={},this.datamodel.QueryStringParameter={},this.datamodel.merchantId="",this.datamodel.userId="",this.Post=function(){if("undefined"==typeof keepAlive&&e("#IsWaitforKeepALive").length>0&&void 0!==e("#IsWaitforKeepALive").val()&&"true"===e("#IsWaitforKeepALive").val().toLowerCase()){var t=e(this),i=this.datamodel.url,a=this.datamodel.data,r=this.datamodel.callback,o=this.datamodel.Token,n=this.datamodel.Error,s=this.datamodel.async,l=this.datamodel.ErrorMessage,d=this.datamodel.GroupToken,c=this.datamodel.Proxy,u=this.datamodel.RouteParameter={},p=this.datamodel.QueryStringParameter={},h=this.datamodel.merchantId="",m=this.datamodel.userId="";setTimeout(function(){t[0].datamodel.url=i,t[0].datamodel.data=a,t[0].datamodel.callback=r,t[0].datamodel.Token=o,t[0].datamodel.Error=n,t[0].datamodel.async=s,t[0].datamodel.ErrorMessage=l,t[0].datamodel.GroupToken=d,t[0].datamodel.Proxy=c,t[0].datamodel.RouteParameter=u,t[0].datamodel.QueryStringParameter=p,t[0].datamodel.merchantId=h,t[0].datamodel.userId=m,t[0].Post()},500)}else{var f=this.datamodel;f.async="undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()&&"undefined"!=typeof businessID&&null!=businessID&&(156973===parseInt(businessID)||383713===parseInt(businessID)||377983===parseInt(businessID)||430616===parseInt(businessID)||400713===parseInt(businessID))||f.async;var g={};1==f.Proxy?(g.Data=""+JSON.stringify(f.data),g.Token=f.Token,g.IsPublic=f.IsPublic,g.RouteParameter=f.RouteParameter,g.QueryStringParameter=f.QueryStringParameter):1==f.IsNewVagaroAPI?g=f.data:(g.Data=""+JSON.stringify(f.data),g.Token=f.Token);var v=this.datamodel.GroupToken;e.ajax({url:1==f.Proxy?this.seturl(2):this.seturl(1),type:"POST",contentType:"application/json; charset=utf-8",xhr:function(){return 1==f.IsNewVagaroAPI&&null!=window.childWindow&&f.Token.indexOf("http")>-1&&f.Token.indexOf("api")>-1?new window.childWindow.XMLHttpRequest:new window.XMLHttpRequest},beforeSend:function(t){try{"function"==typeof EncH&&0==f.IsNewVagaroAPI&&t.setRequestHeader("H",EncH())}catch(e){}if(0==f.IsNewVagaroAPI){if("undefined"!=typeof getek&&"function"==typeof getek)t.setRequestHeader("K",getek());else try{void 0!==window.parent.getek&&"function"==typeof window.parent.getek&&t.setRequestHeader("K",window.parent.getek())}catch(e){}if("undefined"!=typeof getek&&"function"==typeof getek)t.setRequestHeader("I",getei());else try{void 0!==window.parent.getek&&"function"==typeof window.parent.getek&&t.setRequestHeader("I",window.parent.getei())}catch(e){}if("undefined"!=typeof getek&&"function"==typeof getek)t.setRequestHeader("Val",EncIV());else try{void 0!==window.parent.getek&&"function"==typeof window.parent.getek&&t.setRequestHeader("Val",window.parent.EncIV())}catch(e){}}if("undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val()),void 0!==v&&null!=v&&""!=v?t.setRequestHeader("grouptoken",v):"undefined"!=typeof groupID&&t.setRequestHeader("grouptoken",groupID),"undefined"!=typeof myAccountUserGroupID&&t.setRequestHeader("usergrouptoken",myAccountUserGroupID),1==e("#hdnCheckInApp").length&&void 0!==e("#hdnCheckInApp").val()&&t.setRequestHeader("checkinApp",e("#hdnCheckInApp").val()),1==e("#hdnIsBrandedApp").length&&void 0!==e("#hdnIsBrandedApp").val()&&t.setRequestHeader("brandedApp",e("#hdnIsBrandedApp").val()),1==f.IsNewVagaroAPI&&f.Token.indexOf("http")>-1&&f.Token.indexOf("api")>-1&&(1==e("#hdnCalendarVersion").length&&void 0!==e("#hdnCalendarVersion").val()?(t.setRequestHeader("Version",e("#hdnCalendarVersion").val()),t.setRequestHeader("Device","website"),t.setRequestHeader("DeviceID","calendar")):1==e("#hdnVersionDetail").length&&void 0!==e("#hdnVersionDetail").val()&&(t.setRequestHeader("Version",e("#hdnVersionDetail").val()),t.setRequestHeader("Device","website"),t.setRequestHeader("DeviceID","masterpage")),("undefined"!=typeof PublicBusinessID&&"undefined"!=typeof UserID||"undefined"!=typeof businessID&&"undefined"!=typeof UserID||"undefined"!=typeof BusinessID&&"undefined"!=typeof UserID||"undefined"!=typeof SecuBusinessID&&"undefined"!=typeof SecuUserID)&&getheader(t)),"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&t.setRequestHeader("widgetcookievalue",widgetcookievalue);else try{void 0!==window.parent._common&&void 0!==window.parent._common.IsCookieLessWidget&&window.parent._common.IsCookieLessWidget()&&"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&t.setRequestHeader("widgetcookievalue",widgetcookievalue)}catch(e){}try{"undefined"!=typeof _freeCardReader&&void 0!==_freeCardReader.userdata&&null!=_freeCardReader.userdata&&void 0!==_freeCardReader.userdata.BusinessId&&t.setRequestHeader("businessId",_freeCardReader.userdata.BusinessId),"undefined"!=typeof _freeCardReader&&void 0!==_freeCardReader.userdata&&null!=_freeCardReader.userdata&&void 0!==_freeCardReader.userdata.UserId&&t.setRequestHeader("loggedInUserId",_freeCardReader.userdata.UserId)}catch(e){}try{void 0!==f.merchantId&&null!=f.merchantId&&""!=f.merchantId&&t.setRequestHeader("merchantId",f.merchantId),void 0!==f.userId&&null!=f.userId&&""!=f.userId&&t.setRequestHeader("userId",f.userId)}catch(e){}try{"undefined"!=vm&&"undefined"!=vm.V2VTransferCoreApiHeader&&"undefined"!=vm.V2VTransferCoreApiHeader._vdpb_id&&t.setRequestHeader("_vdpb_id",vm.V2VTransferCoreApiHeader._vdpb_id),"undefined"!=vm&&"undefined"!=vm.V2VTransferCoreApiHeader&&"undefined"!=vm.V2VTransferCoreApiHeader._vdpu_id&&t.setRequestHeader("_vdpu_id",vm.V2VTransferCoreApiHeader._vdpu_id)}catch(e){}},async:f.async,data:JSON.stringify(g),dataType:"json"}).done(function(e){if(1==f.IsNewVagaroAPI)(t=void 0!==e&&null!=e&&void 0!==e.CustomCode&&null!=e.CustomCode&&(f.Token.indexOf("http")>-1&&f.Token.indexOf("api")>-1||f.Token.indexOf("myaccount")>-1))&&1032==e.CustomCode?window.location.href="/ScheduleMaintenance.aspx":t&&1036==e.CustomCode?window.location.reload():t&&1034==e.CustomCode?"function"==typeof ShowHideFailedMessageCommon?ShowHideFailedMessageCommon(e.Message):vagaro.alert({message:e.Message,title:"Invalid!"}):f.callback(e);else if(1==f.Proxy){var t;(t=void 0!==e&&null!=e&&void 0!==e.responseCode&&null!=e.responseCode&&(f.Token.indexOf("http")>-1&&f.Token.indexOf("api")>-1||f.Token.indexOf("myaccount")>-1))&&1032==e.responseCode?window.location.href="/ScheduleMaintenance.aspx":t&&1036==e.responseCode?window.location.reload():t&&1034==e.responseCode?"function"==typeof ShowHideFailedMessageCommon?ShowHideFailedMessageCommon(e.message):vagaro.alert({message:e.message,title:"Invalid!"}):f.callback(e)}else f.callback(e.d)}).fail(function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}if(void 0!==e&&null!=e&&999==e.status)return vagaro.reloadDetailPage(e.status,f.Token),void ShowLoader(!1);if(void 0===e||null==e||0!=e.status||"undefined"==typeof vgAppicationType||1!=vgAppicationType){if(""!=f.ErrorMessage){var t="",i="undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()&&"undefined"!=typeof businessID&&null!=businessID&&(156973===parseInt(businessID)||383713===parseInt(businessID)||377983===parseInt(businessID)||430616===parseInt(businessID)||400713===parseInt(businessID));try{t=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase().match(/com.vagaro.iospro/i),ShowLoader(!1)}catch(e){}!t&&!i&&"websiteapi/homepage/getupcomingappintmentdata"!=f.Token&&"websiteapi/homepage/getallpetdetails"!=f.Token&&"websiteapi/homepage/getupcominglivestreamclasses"!=f.Token&&f.Token.toLowerCase().indexOf("addloginamplitude")<0&&"addbusiness/signupbusinessailog"!=f.Token&&vagaro.alert({message:f.ErrorMessage+f.Token,title:"Oops!"})}void 0!==f.Error&&f.Error(e)}})}},this.PostQue=function(){if("undefined"==typeof keepAlive&&e("#IsWaitforKeepALive").length>0&&void 0!==e("#IsWaitforKeepALive").val()&&"true"===e("#IsWaitforKeepALive").val().toLowerCase()){var t=e(this),i=this.datamodel.url,a=this.datamodel.data,r=this.datamodel.callback,o=this.datamodel.Token,n=this.datamodel.Error,s=this.datamodel.async,l=this.datamodel.ErrorMessage;setTimeout(function(){t[0].datamodel.url=i,t[0].datamodel.data=a,t[0].datamodel.callback=r,t[0].datamodel.Token=o,t[0].datamodel.Error=n,t[0].datamodel.async=s,t[0].datamodel.ErrorMessage=l,t[0].PostQue()},500)}else{var d=this.datamodel,c={};1==d.IsNewVagaroAPI?c=d.data:(c.Data=""+JSON.stringify(d.data),c.Token=d.Token),this.que({url:this.seturl(1),type:"POST",contentType:"application/json; charset=utf-8",beforeSend:function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}if(0==d.IsNewVagaroAPI&&(t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV())),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val()),1==e("#hdnCheckInApp").length&&void 0!==e("#hdnCheckInApp").val()&&t.setRequestHeader("checkinApp",e("#hdnCheckInApp").val()),"undefined"!=typeof groupID&&t.setRequestHeader("grouptoken",groupID),"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&t.setRequestHeader("widgetcookievalue",widgetcookievalue);else try{void 0!==window.parent._common&&void 0!==window.parent._common.IsCookieLessWidget&&window.parent._common.IsCookieLessWidget()&&"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&t.setRequestHeader("widgetcookievalue",widgetcookievalue)}catch(e){}},data:JSON.stringify(c),dataType:"json",success:function(e){1==d.IsNewVagaroAPI?d.callback(e):d.callback(e.d)},error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}if(void 0!==e&&null!=e&&999==e.status)return vagaro.reloadDetailPage(e.status,d.Token),void ShowLoader(!1);if("abort"!=e.statusText){if(""!=d.ErrorMessage){try{ShowLoader(!1)}catch(e){}d.Token.toLowerCase().indexOf("addloginamplitude")<0&&vagaro.alert({message:d.ErrorMessage+d.Token,title:"Oops!"})}void 0!==d.Error&&d.Error(e)}}})}},this.que=function(t){var i=t.complete;ajaxQueue.clearQueue(),currentRequest&&currentRequest.abort(),ajaxQueue.queue(function(a){t.complete=function(){i&&i.apply(this,arguments),a()},currentRequest=e.ajax(t)})},this.Get=function(){e.ajax({url:this.seturl(this.datamodel.url),type:"GET",data:JSON.stringify(this.datamodel.data),dataType:"json"}).done(function(e){this.datamodel.callback(e)}).fail(function(e){this.datamodel.ErrorMessage.length>0&&(ShowLoader(!1),vagaro.alert({message:Model.ErrorMessage,title:"Oops!"})),"undefined"!=this.datamodel.Error&&this.datamodel.Error(e)})},this.GetDirectV2=function(){var t=this,i=t.datamodel.url;if(t.datamodel.RouteParameter&&"object"==typeof t.datamodel.RouteParameter&&Object.keys(t.datamodel.RouteParameter).length>0)for(var a in t.datamodel.RouteParameter)if(t.datamodel.RouteParameter.hasOwnProperty(a)){var r=t.datamodel.RouteParameter[a];null!=r&&""!==r&&(i+=(i.endsWith("/")?"":"/")+encodeURIComponent(r))}if(t.datamodel.QueryStringParameter&&"object"==typeof t.datamodel.QueryStringParameter&&Object.keys(t.datamodel.QueryStringParameter).length>0){var o=e.param(t.datamodel.QueryStringParameter);i+=(i.includes("?")?"&":"?")+o}var n={};t.datamodel.merchantId&&(n.MerchantId=t.datamodel.merchantId),t.datamodel.userId&&(n.UserId=t.datamodel.userId),void 0!==t.datamodel.ErrorMessage&&(n.IsErrorMsgReq=""!==t.datamodel.ErrorMessage?"true":"false"),e.ajax({url:i,type:"GET",headers:n,dataType:"json"}).done(function(e){"function"==typeof t.datamodel.callback&&t.datamodel.callback(e)}).fail(function(e){t.datamodel.ErrorMessage&&t.datamodel.ErrorMessage.length>0&&(ShowLoader(!1),vagaro.alert({message:t.datamodel.ErrorMessage,title:"Oops!"})),"function"==typeof t.datamodel.Error&&t.datamodel.Error(e)})},this.seturl=function(e){var t=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";if(t.indexOf("webcache.googleusercontent.com")>-1&&"vagaro.com"==DomainName&&(t="https://www.vagaro.com/"),1==e){var i="";if("undefined"!=typeof regionId&&""!=regionId&&(i=regionId+"/"),1==this.datamodel.IsNewVagaroAPI)this.datamodel.Token.indexOf("http")>-1&&this.datamodel.Token.indexOf("api")>-1?t=this.datamodel.Token:(void 0!==vagaroSiteBuilder&&null!=vagaroSiteBuilder&&void 0!==vagaroSiteBuilder.BaseURLOfWebSiteBuilderAPI&&t.indexOf(vagaroSiteBuilder.BaseURLOfWebSiteBuilderAPI)>-1&&(t=vagaroSiteBuilder.BaseURLOfVagaroAPI),t=t+i+this.datamodel.Token);else try{t=void 0!==this.datamodel.Token&&null!=this.datamodel.Token&&""!=this.datamodel.Token?t+i+"WebServices/MySampleService.asmx/PageMethodsProxyJson?token="+this.datamodel.Token:t+i+"WebServices/MySampleService.asmx/PageMethodsProxyJson"}catch(e){t=t+i+"WebServices/MySampleService.asmx/PageMethodsProxyJson"}}else if(2==e){i="";"undefined"!=typeof regionId&&""!=regionId&&(i=regionId+"/"),t=t+i+"api/proxy"}else try{t=void 0!==this.datamodel.Token&&null!=this.datamodel.Token&&""!=this.datamodel.Token?t+i+"WebServices/MySampleService.asmx/PageMethodsProxyJson?token="+this.datamodel.Token:t+i+"WebServices/MySampleService.asmx/PageMethodsProxyJson"}catch(e){t=t+i+"WebServices/MySampleService.asmx/PageMethodsProxyJson"}return t}},vagaro.alert=function(e){"undefined"!=typeof bootbox?bootbox.alert(e):ShowPopupAlert(e.message,1,null)},vagaro.alertsmall=function(e){"undefined"!=typeof bootbox?bootbox.alertsmall(e):ShowPopupAlert(e.message,1,null)},vagaro.alertmidium=function(e,t){"undefined"!=typeof bootbox?bootbox.alert({className:"vagaro-midium-popup",message:e,title:"Alert",callback:"function"==typeof t?t:null}):ShowPopupAlert(e.message,1,null)},vagaro.popup=function(e){"undefined"!=typeof bootbox?bootbox.dialog(e):ShowPopupAlert(e.message,4,null)},vagaro.confirm=function(e){"undefined"!=typeof bootbox&&bootbox.confirm(e)},vagaro.confirmsmall=function(e){"undefined"!=typeof bootbox&&bootbox.confirm(e,e.success.label,e.success.label)},vagaro.prompt=function(){"undefined"!=typeof bootbox&&bootbox.prompt(options)},vagaro.reloadDetailPage=function(e,t){999===e&&["SaveSettingHistory","GetServiceProviderDetails","GetServicesDetails","GetShoppingCartInventory","GetShoppingCartProductType","GetShoppingCartBrand","GetShoppingCartPopupData","GetShoppingCartPopupDataNew","AddToCart","MembershipAddToCart","GiftCertificateAddToCart","ServiceAddToCart","ClassAddToCart","UpdateCartItem","UpdateMutipleCartItem","GetNextAvailableDateWorkShop","RemoveCartItem","ValidateShoppingCartData","GetCartCount","GetEventCartDetail","GetGiftcertificateCategory","GetReturnPolicy","GetAppointmentCancellationPolicy","BindSalonServiceComboForGC","GetGiftCertificateExpMonth","GetGiftCertificateImgByCategory","GetShopDetailStyle","LikeStyle","GetStyleImagesCommaSeparated","GetBookRequestButtonText","GetDealDataWithServicesByPromotionID","ShareSPorStyle","GetCustomerNameByEmailId","GetAvailableDates","SendEmailtoSP","ShowFavorites","GetAvailableMultiAppointments","GetUserCCDetailsByOnlyUserID","GetStatesByCountryID","GetStatesByMultipleCountryID","CheckUserExistsByUserId","GetValidatePromotionsDetails","GetAvailableDatesForEvents","GetEventDetailAndAvailableDates","CheckUserExistanceInEvent","GetEventDetailForReschedule","GetEventDetailForRescheduleForWorkShop","GetClassCancellationPolicy","GetMembershipAndPackageByBusinessId","GetOnlineCheckoutTipSetting","GetOnlineBookingTabDetail","GetGCPackageAndPointForOnlineCheckout","RemoveCehckOutItem","ValidatePromocodeAndGetDetails","GetOnlineInvoiceBusinessUserDetailsByInvoiceId","GetAllPetDetails","GetMyAppintmentData","GetMyProducts","GetMyAccountFavoriteBusinesses","GetBusinessPoints","GetCustomerPoints","GetUserCompleteAppointmentsForReviews","GetGiftCertificateDetails","GetBusinessMembershipNew","GetMyAccountInvoices","GetFamilyAndFriendsDetailsByUserID"].indexOf(t)>-1&&location.reload(!0)},vagaro.ajaxCall=function(e,t,i,a,r,o,n,s){var l=new vagaro.ajax;l.datamodel.Token=e,l.datamodel.data=t,l.datamodel.callback=i,l.datamodel.Error=a,void 0!==o&&1==o&&(l.datamodel.IsNewVagaroAPI=o),void 0!==s&&1==s&&(l.datamodel.ErrorMessage=""),r?l.PostQue():l.Post()},vagaro.ajaxCallV2=function(e,t,i,a,r,o,n,s,l,d){var c=new vagaro.ajax;c.datamodel.Token=e,c.datamodel.data=t,c.datamodel.callback=r,c.datamodel.Error=o,c.datamodel.Proxy=!0,c.datamodel.IsPublic=!1,void 0!==d&&(c.datamodel.IsPublic=d),void 0!==i&&null!=i&&(c.datamodel.RouteParameter=i),void 0!==a&&null!=a&&(c.datamodel.QueryStringParameter=a),void 0!==s&&1==s&&(c.datamodel.ErrorMessage=""),void 0!==l&&void 0!==l.MerchantId&&null!==l.MerchantId&&""!==l.MerchantId&&(c.datamodel.merchantId=l.MerchantId),void 0!==l&&void 0!==l.UserId&&null!==l.UserId&&""!==l.UserId&&(c.datamodel.userId=l.UserId),n?c.PostQue():c.Post()},vagaro.ajaxCallV2Direct=function(e,t,i,a,r,o,n,s){var l=new vagaro.ajax;"undefined"==VagaroCorePublicAPIURLV2||isNullOrUndefineOrBlank(VagaroCorePublicAPIURLV2)?(VagaroCorePublicAPIURLV2="https://api.vagaro.com/US02/api/v2/public/",l.datamodel.Token=VagaroCorePublicAPIURLV2+e):l.datamodel.Token=VagaroCorePublicAPIURLV2+e,l.datamodel.IsNewVagaroAPI=!0,l.datamodel.Proxy=!1,void 0!==i&&null!=i&&(l.datamodel.RouteParameter=i),void 0!==a&&null!=a&&(l.datamodel.QueryStringParameter=a),void 0!==n&&1==n&&(l.datamodel.ErrorMessage=""),void 0!==s&&void 0!==s.MerchantId&&null!==s.MerchantId&&""!==s.MerchantId&&(l.datamodel.merchantId=s.MerchantId),void 0!==s&&void 0!==s.UserId&&null!==s.UserId&&""!==s.UserId&&(l.datamodel.userId=s.UserId),l.datamodel.data=t,"undefined"!=typeof isAsync&&null!=isAsync&&(l.datamodel.async=isAsync),l.datamodel.Error=o,l.datamodel.callback=r,l.datamodel.url=l.datamodel.Token,l.GetDirectV2()},vagaro.VagaroCoreApiResponseCode={Success:1e3,Error:1001,UnderMaintanance:1032,QuotaExceeded:1038},vagaro.VagaroCoreApiStatusCode={OK:200,Created:201,BadRequest:400}}(jQuery);var isNullOrUndefineOrBlank=e=>void 0===e||null==e||""==e||null==e;function onKeyPressBlockNumbers(e){var t=window.event?window.event.keyCode:e.which;if(46!=t&&(32==t||39==t||46==t||8==t||9==t||189==t||0==t))return t;var i=String.fromCharCode(t),a=/\d/;return window.event?event.returnValue=a.test(i):a.test(i)}function resize_bg(){$(".replaced").css({left:"160px"}),$("#fullbackground-wrapper").css("display","block"),$(".model").css("padding-left","0px!important");var e=$(window).width(),t=$(window).height(),i=$(".replaced").width()/$(".replaced").height(),a=e,r=Math.round(a/i);if(r<t){r=t,a=Math.round(r*i);var o=Math.round((a-e)/2);$(".replaced").css("left","-"+o+"px")}$(".replaced").width(a),$(".replaced").height(r)}function onOnlineiFrameLoad(){loader(!1)}function ajaxCallV2DirectAsync(e,t,i,a,r=!1,o={}){return new Promise((n,s)=>{try{vagaro.ajaxCallV2Direct(e,t,i,a,e=>n(e),e=>s(e),r,o)}catch(e){s(e)}})}!function(e){e.fn.applyupdown=function(t,i){t?(this.parent().find(".arrow-up-down").find(".uparrow").bind(i,function(){var t=e(this).attr("disabled");if(void 0===t||!1===t){var i=e(this).parent().siblings("input:text"),a=0;null!=i.attr("max")&&(a=i.attr("max"));var r=parseFloat(i.val());(0==a||r<a)&&i.val(r+1).change()}}),this.parent().find(".arrow-up-down").find(".downarrow").bind(i,function(){var t=e(this).attr("disabled");if(void 0===t||!1===t){var i=e(this).parent().siblings("input:text");null!=i.attr("min")&&(max=i.attr("min"));var a=parseFloat(i.val());(0==max||a>max)&&i.val(a-1).change()}})):(this.parent().siblings(".arrow-up-down").find(".uparrow").bind("click",function(){var t=e(this).attr("disabled");if(void 0===t||!1===t){var i=e(this).parent().siblings(".upDownArow").find("input:text"),a=0;null!=i.attr("max")&&(a=i.attr("max"));var r=parseFloat(i.val());(0==a||r<a)&&i.val(r+1).change()}}),this.parent().siblings(".arrow-up-down").find(".downarrow").bind("click",function(){var t=e(this).attr("disabled");if(void 0===t||!1===t){var i=e(this).parent().siblings(".upDownArow").find("input:text");null!=i.attr("min")&&(max=i.attr("min"));var a=parseFloat(i.val());(0==max||a>max)&&i.val(a-1).change()}})),this.bind("keyup",function(t){var i=0,a=0,r=e(this);if(38==t.keyCode){null!=r.attr("max")&&(i=r.attr("max"));var o=parseFloat(r.val());(0==i||o<i)&&r.val(o+1).change()}else if(40==t.keyCode){null!=r.attr("min")&&(i=r.attr("min"));o=parseFloat(r.val());(0==i||o>i)&&r.val(o-1).change()}else{null!=r.attr("max")&&(i=parseFloat(r.attr("max"))),null!=r.attr("min")&&(a=parseFloat(r.attr("min")));o=parseFloat(r.val());0!=i&&o>i?r.val(i).change():0!=a&&o<a&&r.val(a).change()}});var a=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";return this.bind(a,function(t){var i=0,r=e(this),o=e(this).attr("disabled");if(void 0===o||!1===o){if("mousewheel"==a){if(t.originalEvent.wheelDelta/120>0){null!=r.attr("max")&&(i=r.attr("max"));var n=parseFloat(r.val());(0==i||n<i)&&r.val(n+1).change()}else if(t.originalEvent.wheelDelta/120<0){null!=r.attr("min")&&(i=r.attr("min"));n=parseFloat(r.val());(0==i||n>i)&&r.val(n-1).change()}}else if(t.originalEvent.detail>0){null!=r.attr("max")&&(i=r.attr("max"));n=parseFloat(r.val());(0==i||n<i)&&r.val(n+1).change()}else if(t.originalEvent.detail<0){null!=r.attr("min")&&(i=r.attr("min"));n=parseFloat(r.val());(0==i||n>i)&&r.val(n-1).change()}t.preventDefault(),t.stopPropagation()}}),this}}(jQuery),Object.keys||(Object.keys=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i);return t}),jQuery,vagaro.commonUtils={},vagaro.commonUtils.isNullOrUndefined=function(e){return void 0===e||null==e},vagaro.commonUtils.isFunction=function(e){return"function"==typeof e},vagaro.commonUtils.CheckPhonenoCount=function(e,t){var i=e;return null!=i&&null!=i&&""!=i?"4"==t?9==i.length?0+e:10==i.length?e:null:e:1},radGridWrapper=function(e){var t=this;return t.gridEvents={onRowMouseOver:null,onRowMouseOut:null,onRowDropped:null,onRowClick:null,onGridCreated:null},t.clientId=e,t.getGrid=function(){return $find(t.clientId)},t.getDataItems=function(){return t.getMasterTableView().get_dataItems()},t.getDataItem=function(e){return t.getMasterTableView().get_dataItems()[e]},t.getHTMLElement=function(e){return t.getMasterTableView().get_dataItems()[e].get_element()},t.addCssClassToRow=function(e,i){var a=t.getHTMLElement(e);$(a).addClass(i)},t.removeCssClassToRow=function(e,i){var a=t.getHTMLElement(e);$(a).removeClass(i)},t.getDataKeyValue=function(e,i){return t.getDataItem(e).getDataKeyValue(i)},t.getDataKeyValueFromRow=function(e,t){return e.getDataKeyValue(t)},t.getMasterTableView=function(){return t.getGrid().get_masterTableView()},t.dataBind=function(e){var i=t.getMasterTableView();i.set_dataSource(e),i.dataBind()},t.getSelectedItems=function(){return t.getMasterTableView().get_selectedItems()},t.selectItemByIndex=function(e){t.getMasterTableView().selectItem(e)},t.getItemIndex=function(e){return parseInt(e.get_itemIndexHierarchical())},t.getCellValueByKey=function(e,i){return t.getMasterTableView().getCellByColumnUniqueName(e,i)},t.getCell=function(e,i){var a=t.getMasterTableView(),r=a.get_dataItems()[e];return a.getCellByColumnUniqueName(r,i)},t.destroy=function(){t.clientId=null,t.gridEvents.onGridCreated=null,t.gridEvents.onRowClick=null,t.gridEvents.onRowDropped=null,t.gridEvents.onRowMouseOut=null,t.gridEvents.onRowMouseOver=null},t.onRowMouseOver=function(e,i){vagaro.commonUtils.isFunction(t.gridEvents.onRowMouseOver)&&t.gridEvents.onRowMouseOver(e,i)},t.onRowMouseOut=function(e,i){vagaro.commonUtils.isFunction(t.gridEvents.onRowMouseOut)&&t.gridEvents.onRowMouseOut(e,i)},t.onRowDropped=function(e,i){vagaro.commonUtils.isFunction(t.gridEvents.onRowDropped)&&t.gridEvents.onRowDropped(e,i)},t.onRowClick=function(e,i){vagaro.commonUtils.isFunction(t.gridEvents.onRowClick)&&t.gridEvents.onRowClick(e,i)},t.onGridCreated=function(e,i){vagaro.commonUtils.isFunction(t.gridEvents.onGridCreated)&&t.gridEvents.onGridCreated(e,i)},t.getAllBoundKeyValues=function(){return t.getGrid()._clientKeyValues},t.updateKeyValue=function(e,i,a){var r=t.getAllBoundKeyValues();vagaro.commonUtils.isNullOrUndefined(r)||0==r.length||(r[e][i]=a)},t.showHideItem=function(e,i){var a=t.getMasterTableView();i?a.showItem(e):a.hideItem(e)},t.showHideItems=function(e,i){if(!vagaro.commonUtils.isNullOrUndefined(e)&&0!=e.length)for(var a=t.getMasterTableView(),r=0;r<e.length;r++){var o=e[r];i?a.showItem(o):a.hideItem(o)}},t},function(e){_CustomTooltip={Msg:{FlagshipDisabledMsg:"Cannot edit fields synced from a flagship location."}},e(document).on("mouseenter",".custom-tooltip",function(t){var i=e(this),a=e(this).attr("data-tooltip");void 0!==e(this).data("angular-tooltip")&&null!=e(this).data("angular-tooltip")&&(a=e(this).data("angular-tooltip"));var r=e('<div class="v-tooltip-content tooltip top mllocation-tooltip-content" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner">'+a+"</div></div>");e(this).after(r),e(".v-tooltip-content").position({of:i,at:"center top",my:"center bottom",collision:"flipfit"}),e(".custom-tooltip-left").next(".v-tooltip-content").find(".tooltip-arrow").position({of:i,at:"center top",my:"center bottom",collision:"flipfit"})}),e(document).on("mouseleave",".custom-tooltip",function(t){e(".v-tooltip-content").remove()})}(jQuery);var gsMonthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December"),gsDayNames=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");String.prototype.times||(String.prototype.times=function(e){for(var t="",i=0;i<e;i++)t+=this;return t}),String.prototype.zp||(String.prototype.zp=function(e){return"0".times(e-this.length)+this}),Number.prototype.zp||(Number.prototype.zp=function(e){return this.toString().zp(e)}),Date.prototype.format||(Date.prototype.format=function(e){if(!this.valueOf())return"&nbsp;";var t=this;return e.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|ms|a\/p)/gi,function(e){switch(e.toLowerCase()){case"yyyy":return t.getFullYear();case"mmmm":return gsMonthNames[t.getMonth()];case"mmm":return gsMonthNames[t.getMonth()].substr(0,3);case"mm":return(t.getMonth()+1).zp(2);case"dddd":return gsDayNames[t.getDay()];case"ddd":return gsDayNames[t.getDay()].substr(0,3);case"dd":return t.getDate().zp(2);case"hh":return((h=t.getHours()%12)?h:12).zp(2);case"nn":return t.getMinutes().zp(2);case"ss":return t.getSeconds().zp(2);case"ms":return t.getMilliseconds().zp(2);case"a/p":return t.getHours()<12?"AM":"PM"}})}),Date.prototype.formatdate||(Date.prototype.formatdate=function(e){if(!this.valueOf())return"&nbsp;";var t=this;return e.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|ms|a\/p)/gi,function(e){switch(e.toLowerCase()){case"yyyy":return t.getFullYear();case"mmmm":return gsMonthNames[t.getMonth()];case"mmm":return gsMonthNames[t.getMonth()].substr(0,3);case"mm":return(t.getMonth()+1).zp(2);case"dddd":return gsDayNames[t.getDay()];case"ddd":return gsDayNames[t.getDay()].substr(0,3);case"dd":return t.getDate().zp(2);case"hh":return((h=t.getHours()%12)?h:12).zp(2);case"nn":return t.getMinutes().zp(2);case"ss":return t.getSeconds().zp(2);case"ms":return t.getMilliseconds().zp(2);case"a/p":return t.getHours()<12?"AM":"PM"}})}),String.format||(String.format=function(){for(var e=arguments[0],t=1;t<arguments.length;t++){var i=new RegExp("\\{"+(t-1)+"\\}","gm");e=e.replace(i,arguments[t])}return e});var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","^":"&#94;",$:"&#36;"},functionentityMap={'"':'\\"',"'":"\\'"};function addCommas(e){x=(e+="").split("."),x1=x[0],x2=x.length>1?"."+x[1]:"";for(var t=/(\d+)(\d{3})/;t.test(x1);)x1=x1.replace(t,"$1,$2");return x1+x2}String.prototype.escapeHtml||(String.prototype.escapeHtml=function(){return String(this).replace(/[&<>\"'\/^$]/g,function(e){return entityMap[e]}).toString()}),String.isNullOrUndefineOrBlank||(String.isNullOrUndefineOrBlank=function(e){return void 0===e||null==e||""==e||null==e}),String.isNullOrUndefine||(String.isNullOrUndefine=function(e){return void 0===e||null==e||null==e}),RegExp.escape=function(e){return String(e).replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")},Number.prototype.formatMoney||(Number.prototype.formatMoney=function(e,t,i,a){e=isNaN(e=Math.abs(e))?2:e,i=i||",",a=a||".";var r=this,o=r<0?"-":"",n=parseInt(r=Math.abs(+r||0).toFixed(e),10)+"",s=(s=n.length)>3?s%3:0;return o+(s?n.substr(0,s)+i:"")+n.substr(s).replace(/(\d{3})(?=\d)/g,"$1"+i)+(e?a+Math.abs(r-n).toFixed(e).slice(2):"")}),Number.prototype.format||(Number.prototype.format=function(e){var t=this,i=e.match(/^[-+]?[\#]+\.[##]+$/);if(i){return(i=e.match(/^#.##$/))?addCommas(t.toFixed(2)):4==(t=t.toFixed(2)).toString().length?"0"+t:addCommas(t)}return addCommas(t)}),String.prototype.escapeParamHtml||(String.prototype.escapeParamHtml=function(){return String(this).replace(/["']/g,function(e){return functionentityMap[e]}).toString()}),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),i=this,a=function(){},r=function(){return i.apply(this instanceof a&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return a.prototype=this.prototype,r.prototype=new a,r}),Array.prototype.keySort||(Array.prototype.keySort=function(e){var t=function(e,t){var i,a=0;for(i in e)if(e.hasOwnProperty(i)){if(a==t)return i;a++}return!1},i=function(e,t,i){return i=null!==i?i:1,e==t?0:e>t?1*i:-1*i},a=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i}(e=e||{});if(!a)return this.sort(i);for(var r in e)e[r]="desc"==e[r]||-1==e[r]?-1:"skip"==e[r]||0===e[r]?0:1;return this.sort(function(r,o){for(var n=0,s=0;0===n&&s<a;){var l=t(e,s);if(l){var d=e[l];n=i(r[l],o[l],d),s++}}return n}),this});var userAgent=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase(),iOS=/iPad|iPhone|iPod|iTouch/.test(navigator.userAgent)&&!window.MSStream;if(function(e,t){currentscrollpager=null;var i=function(e,i){this.$elem=t(e),this.options=i,this.isInitalize=0};i.scrollPaginators={},i.frozen=!1,i.prototype={defaults:{Token:null,Data:{},LocalData:{},templateName:null,beforeLoad:null,afterLoad:null,onRowLoad:null,heightOffset:10,pageIndex:1,PageSize:12,totalPages:1,NoDataFoundDiv:null,Loader:null,WallWidth:null,Wall:null,Slick:null,SlickNext:!0,SlickDots:!1,SlickAuto:!1,SlideWidth:null,AfterSlickChange:!1,EnablePagescroll:!1,ScrollTarget:t(e),templateClass:null,IsAjaxQue:!1,checkTab:!1,lastcall:null,removeElement:null,ItemIndex:0,callbackclass:null,async:!0,initialpageData:null,pageName:"",slickOptions:null,isScrollInProgress:!1,data_error:null,lazyLoadClass:"lazy",isShowIntials:!1,intialsname:".intialsname",IsNewVagaroAPI:!1,prevHeight:0},init:function(){if(this.config=t.extend({},this.defaults,this.options),this.config.pageIndex=1,this.$elem.removeAttr("style"),this.isInitalize=0,this.options.Data.currentPageIndex=this.config.pageIndex,this.options.Data.PageSize=this.config.PageSize,null!=this.config.ScrollTarget&&(this.config.ScrollTarget=t(this.config.ScrollTarget)),this.config.EnablePagescroll){var e=this;this.config.ScrollTarget.bind("scroll",function(){0==e.config.isScrollInProgress&&(e.config.isScrollInProgress=!0,e.targetScroll())})}return this},initelem:function(e){this.$elem=t(e),this.init()},scroll:function(){return 0==this.isInitalize&&(this.config=t.extend({},this.defaults,this.options),this.config.pageIndex=1,0==this.isServerResponse(this)&&this.$elem.html(""),this.$elem.attr("scrollPagination","enabled"),this.isInitalize=1),null!=this.config.NoDataFoundDiv&&this.config.NoDataFoundDiv.hide(),0==i.frozen&&this.loadContent(),this},disableScroll:function(){t(".scrollme").removeClass("scrollme")},enableScroll:function(){this.config.EnablePagescroll?(t(".scrollme").removeClass("scrollme"),t("#"+this.config.templateName).addClass("scrollme"),currentscrollpager=this,this.config.isScrollInProgress=!1):(t(".scrollme").removeClass("scrollme"),currentscrollpager=this),t("#dvPageContent").length>0&&t("html,body,#page-content-wrapper").animate({scrollTop:0},1e3)},click:function(e,t,i,a){1==e.currentDirection&&this.scroll()},targetScroll:function(){if(this.config.EnablePagescroll&&t("#"+this.config.templateName).hasClass("scrollme")){if(1==this.config.pageIndex)return void(this.config.isScrollInProgress=!1);var e=0,i=0;if(t(this.config.ScrollTarget).is("div"))t("#footerdiv:visible").length>0&&t(this.config.ScrollTarget).find("#footerdiv").length>0&&(i=t("#footerdiv").height()),void 0!==this.config.BestSalon&&null!=this.config.BestSalon&&this.config.BestSalon.length>0&&1==this.config.BestSalon.is(":visible")&&(i=i=t("#footerdiv").height(),this.config.BestSalon.height()),e=this.config.ScrollTarget[0].scrollHeight-(i+100);else{i=0;if(t("#footerdiv:visible").length>0&&(i=t("#footerdiv").height()),t("#divBestSaloonHead:visible").length>0&&(i+=t("#divBestSaloonHead").height()),t("#divMoresalloncities:visible").length>0&&(i+=t("#divMoresalloncities").height()),t("#divFAQSearchServiceHead:visible").length>0&&(i+=t("#divFAQSearchServiceHead").height()),t(this.config.ScrollTarget).is("body")){var a=this.config.ScrollTarget[0].scrollHeight;t("#page-wrapper").length>0&&(a=t("#page-wrapper")[0].scrollHeight)}else a=this.config.ScrollTarget[0].document.body.scrollHeight;e=a-(i+150)}var r=this.config.ScrollTarget.scrollTop()+this.config.ScrollTarget.innerHeight()>=e;if(t(this.config.ScrollTarget).is("body")&&t("#page-wrapper").length>0&&(r=-1*t("#page-wrapper").position().top+this.config.ScrollTarget.innerHeight()>=e),r){try{"ulFeatureBusiness"==this.$elem.attr("id")&&(this.config.prevHeight=this.$elem.innerHeight())}catch(e){}this.scroll()}else this.config.isScrollInProgress=!1}else this.config.isScrollInProgress=!1},hasScrollBar:function(i){if(1==i.config.EnablePagescroll&&null!=i.config.ScrollTarget){if(i.config.ScrollTarget.get(0)==e)return t("body").get(0).scrollHeight>=t("body").height();var a=i.config.ScrollTarget.get(0).scrollHeight;return t(i.config.ScrollTarget).is("body")&&t("#page-wrapper").length>0&&(a=i.config.ScrollTarget[0].scrollHeight,0==t(i.config.ScrollTarget).is("div")&&t("#page-wrapper").length>0&&(a=t("#page-wrapper")[0].scrollHeight-10)),a>i.config.ScrollTarget.height()}return!0},isServerResponse:function(e){return null!=e.options.initialpageData&&e.config.pageIndex==e.options.initialpageData.PageIndex&&e.options.initialpageData.tabName==e.options.pageName},loadContent:function(){if(this.$elem=t("#"+this.$elem.attr("id")),"disabled"!=this.$elem.attr("scrollPagination")){if(this.$elem.attr("scrollPagination","disabled"),this.config.pageIndex>this.config.totalPages&&this.config.pageIndex>1)return this.config.isScrollInProgress=!1,void t(this.config.Loader).hide();if(this.config.lastcall=(new Date).format("yyyy-mm-dd hh:nn:ss:ms a/p")+this.$elem.attr("id"),this.$elem.attr("lastcall",this.config.lastcall),t(this.config.Loader).show(),"function"==typeof this.config.CallbackOnLoderShow&&this.config.CallbackOnLoderShow(),showLoadingCenter(".loader-imgNew"),null!=this.config.beforeLoad&&this.config.beforeLoad(),this.$elem.children().attr("rel","loaded"),this.options.Data.currentPageIndex=this.config.pageIndex,this.options.Data.PageSize=this.config.PageSize,this.isServerResponse(this))this.CallbackResponse(null);else{var e=new vagaro.ajax;if(e.datamodel.Token=this.config.Token,e.datamodel.data=this.config.Data,e.datamodel.callback=this.CallbackResponse.bind(this),e.datamodel.Error=this.ErrorResponse.bind(this),e.datamodel.IsNewVagaroAPI=this.config.IsNewVagaroAPI,null!=this.config&&"divmyPayrollHistorytemplate"==this.config.templateName&&null!=this.config.Data){var i={};i.PageSize=this.config.Data.PageSize,i.currentPageIndex=this.config.Data.currentPageIndex,i.SPagingDetails="",e.datamodel.userId=this.config.Data.userId,e.datamodel.data=i}0==this.options.async&&(e.datamodel.async=!1),this.options.IsAjaxQue?e.PostQue():e.Post()}}else this.config.isScrollInProgress=!1},CallbackResponse:function(e){if(void 0!==e&&null!=e&&void 0!==e.Data&&void 0!==e.CustomCode&&void 0!==e.Message&&(e=(this.config.Token.indexOf("getusermembershiphistory")>-1||this.config.Token.indexOf("getmembershipdetails")>-1||this.config.Token.indexOf("getsoldmemberhipforcustomer")>-1||this.config.Token.indexOf("getgiftcertificatehistory")>-1||this.config.Token.indexOf("getpackagedetailsforcustomer")>-1)&&e.CustomCode==vagaro.VagaroCoreApiResponseCode.UnderMaintanance?[{UnderMaintanance:vagaro.VagaroCoreApiResponseCode.UnderMaintanance}]:e.Data),this.config.isScrollInProgress=!1,this.getLastcallTime()==this.config.lastcall){t("#"+this.config.templateName).html();var i=this;if(null!=this.config.NoDataFoundDiv&&(this.config.NoDataFoundDiv.hide(),null!=this.config.removeElement&&this.config.removeElement.show()),null==e||1===i.config.pageIndex&&0==e.length||null!=e.data&&0==e.data.length){if((null!=this.config.NoDataFoundDiv&&0==this.isServerResponse(this)||1==this.isServerResponse(this)&&0==this.options.initialpageData.totalPages)&&(this.$elem.removeAttr("style"),this.config.NoDataFoundDiv.show(),null!=this.config.removeElement&&this.config.removeElement.hide()),t(this.config.Loader).hide(),(null!=this.config.afterLoad&&0==this.isServerResponse(this)||1==this.isServerResponse(this)&&null!=this.options.initialpageData.afterLoad&&null!=this.options.initialpageData.afterLoad)&&this.config.afterLoad(e),0==this.isServerResponse(this)||1==this.isServerResponse(this)&&0==this.options.initialpageData.totalPages)return void(this.options.initialpageData=null)}else 1===i.config.pageIndex&&0==this.isServerResponse(this)&&this.$elem.html("");this.config.checkTab&&!i.$elem.closest("div.tab-pane").hasClass("active")?i.CheckTab(e):this.ResponseProcess(e)}},CheckTab:function(e){var t=this;setTimeout(function(){t.$elem.closest("div.tab-pane").hasClass("active")?t.ResponseProcess(e):t.CheckTab(e)},50)},getLastcallTime:function(){return t("#"+this.$elem.attr("id")).attr("lastcall")},getScrollTab:function(){return void 0===t("#"+this.$elem.attr("id")).data("scrollTab")||"true"==t("#"+this.$elem.attr("id")).data("scrollTab")},RefreshWall:function(){var e=this;null!=e.config.Wall&&setTimeout(function(){e.config.Wall.refresh()},50)},ErrorResponse:function(e){this.config.isScrollInProgress=!1,this.$elem.attr("scrollPagination","enabled"),t(this.config.Loader).hide()},setWallandSlick:function(e,i,a,r){if(null!=a.config.WallWidth?(1===a.config.pageIndex&&0===r&&(a.config.Wall=new freewall(a.$elem),a.config.Wall.reset({selector:".gallery-solo-image",cellW:a.config.WallWidth,cellH:"auto",gutterX:5,gutterY:15,animate:!1,onResize:function(){a.config.Wall.refresh()}})),0==a.isServerResponse(a)&&(a.getLastcallTime(),a.config.lastcall),(1==a.isServerResponse(a)&&1===a.config.pageIndex||r===e.length-1&&1===a.config.pageIndex)&&a.config.Wall.fitWidth()):a.$elem.parent().addClass("listing-wrapper").removeClass("gallery-wrapper"),null!=a.config.Slick&&0==iPadAndroid)if(1===a.config.pageIndex&&0===r){"object"==typeof a.config.Slick.getSlick()&&a.config.Slick.unslick(),0==a.isServerResponse(a)&&a.$elem.append(i);var o=6,n=5;null!=a.config.slickOptions?(o=3,n=1,a.config.slickOptions):(null!=a.config.SlideWidth&&(o=Math.ceil(a.$elem.width()/a.config.SlideWidth)),o>=a.config.PageSize&&a.config.totalPages>1&&(o=a.config.PageSize-1),o<=1&&(o=1),(n=o-1)<1&&(n=1));var s=null;1==a.config.AfterSlickChange&&(s=a.click.bind(a)),a.config.Slick.slick({lazyLoad:"ondemand",dots:a.config.SlickDots,arrows:a.config.SlickNext,infinite:!1,speed:300,autoplay:a.config.SlickAuto,slidesToShow:o,slidesToScroll:n,onAfterChange:s,responsive:a.config.slickOptions})}else 0==a.isServerResponse(a)&&a.getLastcallTime()==a.config.lastcall&&a.config.Slick.slickAdd(i);else null==a.config.WallWidth&&0==a.isServerResponse(a)&&a.getLastcallTime()==a.config.lastcall&&a.$elem.append(i);if(0==a.isServerResponse(a)&&null!=a.config.onRowLoad){var l=e[r];i=a.config.onRowLoad(l,i)}if(null!=a.config.Wall){if(0==a.isServerResponse(a)){var d=i.find(".walllazy");(d=t(d)).length>0&&t("<img />").bind("load",function(){var e=d.attr("data-original");d.is("img")?(d.attr("src",e),d.removeAttr("height")):d.css("background-image","url('"+e+"')"),setTimeout(function(){a.getLastcallTime()==a.config.lastcall&&a.config.Wall.appendBlock(i)},100),d.fadeIn}).bind("error",function(){d.fadeIn,setTimeout(function(){a.getLastcallTime()==a.config.lastcall&&a.config.Wall.appendBlock(i)},100)}).attr("src",d.attr("data-original"))}else{var c=!1;a.$elem.find(".walllazy").each(function(){var e=t(this);t("<img />").bind("load",function(){var t=e.attr("data-original");e.is("img")?e.attr("src",t):e.css("background-image","url('"+t+"')"),e.fadeIn,0==c&&(c=!0,setTimeout(function(){a.config.Wall.refresh()},1e3))}).bind("error",function(){e.fadeIn,0==c&&(c=!0,setTimeout(function(){a.config.Wall.fitWidth()},2e3))}).attr("src",e.attr("data-original"))})}var u=t(".WallSec2:last",a.$elem);u.length>0&&(u.outerHeight()>60?u.css("height",u.outerHeight()):u.css("height","60px"))}a.options.initialpageData=null},ResponseProcess:function(i){var a,r=t("#"+this.config.templateName).html(),o=this,n=i=null!=i&&i.hasOwnProperty("data")&&Array.isArray(i.data)?i.data:i,s=(navigator.userAgent||navigator.vendor||e.opera).toLowerCase(),l=s.match(/ipad/i)||s.match(/iphone/i)||s.match(/itouch/i)||s.match(/android/i)||!1;if(null!=this.config.callbackclass&&null!=i&&(n=i[this.config.callbackclass]),this.isServerResponse(o)){var d=o.options.initialpageData.totalPages;o.config.totalPages=Math.ceil(d/o.config.PageSize+parseInt(d%(o.config.PageSize>0?1:0))),this.setWallandSlick(n,null,o,0,l)}else if("CustomerPayment"==Object.keys(i)[0]){var c=n.CustomerPayment;if(void 0!==c&&null!=c&&t.each(c,function(e){if(o.getLastcallTime()==o.config.lastcall){var i=c[e];if(null!=o.config.LocalData&&(i=t.extend({},i,o.config.LocalData)),1===o.config.pageIndex&&0===e){var s=i.TotalPage;o.config.totalPages=Math.ceil(s/o.config.PageSize+parseInt(s%(o.config.PageSize>0?1:0)))}0===e&&(a=Object.keys(i));for(var d=r,u=0;u<a.length;u++){var p=a[u],h=new RegExp("{{"+p+"}}","gi");if(null!=i[p]&&null!=i[p]){var m=new RegExp("{{"+p+"[|]Datemmddyyyy}}","gi"),f=new RegExp("{{"+p+"[|]Timehhmmtt}}","gi"),g=new RegExp("{{"+p+"[|]removeQuote}}","gi");if(m.test(d)){var v=new Date(parseFloat(i[p].replace(/\/Date\((\d+)\)\//gi,"$1"))).format("mmm dd,yyyy");d=d.replace(m,v)}if(f.test(d)){var A="";try{A=new Date(parseFloat(i[p].replace(/\/Date\((\d+)\)\//gi,"$1")))}catch(e){(A=new Date).setMinutes(i[p].Minutes),A.setHours(i[p].Hours)}A=A.format("hh:nn a/p");d=d.replace(f,A)}g.test(d)&&(d=d.replace(g,i[p].replace(/\'/g,"\\'").replace(/"/g,"\\'\\'")));try{d="string"==typeof i[p]?d.replace(h,i[p].escapeHtml()):d.replace(h,i[p])}catch(e){}}else null!=d&&(d=d.replace(h,""))}d=t(d).attr("ItemIndex",o.config.ItemIndex),o.setWallandSlick(n,d,o,e,l),null!=o.config.templateClass&&t(d,o.$elem).addClass(o.config.templateClass),o.config.ItemIndex++}}),"divMyPaymentMethodstemplate"==this.config.templateName){var u=n.CustomerBank;void 0!==u&&null!=u&&0!=u.length?(t(".vpl-payment").hide(),t(".vpl-bank-sub-text").hide(),t("#vplBankText").html(t("#divMyBankDetailTemplate").tmpl(u))):null!=t("#hdncountryid").val()&&void 0!==t("#hdncountryid").val()&&1==parseInt(t("#hdncountryid").val())?(t(".vpl-payment").hide(),t(".vpl-bank-sub-text").show(),t(".vpl-bank-sub-text").show()):(t(".vpl-payment").hide(),t(".vpl-bank-sub-text").hide(),t(".vpl-bank-sub-text").hide())}}else t.each(n,function(e){var i=n.length-1;if(o.getLastcallTime()==o.config.lastcall){var s=n[e];if(null!=o.config.LocalData&&(s=t.extend({},s,o.config.LocalData)),1===o.config.pageIndex&&0===e){var d=null!=o.config&&null!=o.config.templateName&&"divmyPayrollHistorytemplate"==o.config.templateName?s.totalPage:s.TotalPage;o.config.totalPages=Math.ceil(d/o.config.PageSize+parseInt(d%(o.config.PageSize>0?1:0)))}0===e&&(a=Object.keys(s));for(var c=r,u=0;u<a.length;u++){var p=a[u],h=new RegExp("{{"+p+"}}","gi");if(null!=s[p]&&null!=s[p]){var m=new RegExp("{{"+p+"[|]Datemmddyyyy}}","gi"),f=new RegExp("{{"+p+"[|]Timehhmmtt}}","gi"),g=new RegExp("{{"+p+"[|]removeQuote}}","gi");if(m.test(c)){var v=new Date(parseFloat(s[p].replace(/\/Date\((\d+)\)\//gi,"$1"))).format("mmm dd,yyyy");c=c.replace(m,v)}if(f.test(c)){var A="";try{A=new Date(parseFloat(s[p].replace(/\/Date\((\d+)\)\//gi,"$1")))}catch(e){(A=new Date).setMinutes(s[p].Minutes),A.setHours(s[p].Hours)}A=A.format("hh:nn a/p");c=c.replace(f,A)}g.test(c)&&(c=c.replace(g,s[p].replace(/\'/g,"\\'").replace(/"/g,"\\'\\'")));try{c="string"==typeof s[p]?c.replace(h,s[p].escapeHtml()):c.replace(h,s[p])}catch(e){}}else null!=c&&(c=c.replace(h,""))}c=t(c).attr("ItemIndex",o.config.ItemIndex),o.setWallandSlick(n,c,o,e,l),null!=o.config.templateClass&&t(c,o.$elem).addClass(o.config.templateClass),o.config.ItemIndex++,e===i&&o.config.prevHeight>0&&o.config.ScrollTarget.scrollTop(o.config.prevHeight)}});if(null!=this.config.Wall&&t("img[data-type='wallimg']",o.$elem).removeAttr("height"),1===o.config.pageIndex&&null==o.config.Wall&&(o.$elem.removeData("wall"),o.$elem.removeAttr("style")),this.config.pageIndex++,this.config.totalPages=o.config.totalPages,(null!=this.config.afterLoad&&null!=i||1==this.isServerResponse(this)&&null!=this.options.initialpageData.afterLoad&&null!=this.options.initialpageData.afterLoad)&&this.config.afterLoad(i),null==o.config.Slick||0!=l&&null!=o.config.Slick)try{setTimeout(function(){o.config.pageIndex<=2?t("."+o.config.lazyLoadClass,o.$elem).lazyload({event:"lazyload",effect:"fadeIn",failure_limit:5e4,container:o.config.ScrollTarget[0],data_error:o.config.data_error,isShowIntials:o.config.isShowIntials,intial_selecter:o.config.intialsname}).trigger("lazyload"):t("."+o.config.lazyLoadClass,o.$elem).lazyload({effect:"fadeIn",failure_limit:5e4,container:o.config.ScrollTarget[0],data_error:o.config.data_error,isShowIntials:o.config.isShowIntials,intial_selecter:o.config.intialsname}),t("."+o.config.lazyLoadClass,o.$elem).removeClass(o.config.lazyLoadClass)},500)}catch(e){}this.$elem.attr("scrollPagination","enabled"),t(this.config.Loader).hide(),0==iOS&&setTimeout(function(){!(t("#"+o.config.templateName).hasClass("scrollme")&&o.config.totalPages>1)||"undefined"!=typeof isFacebook&&"true"==isFacebook||"undefined"!=typeof isWidget&&"true"==isWidget||0!=o.hasScrollBar(o)||o.getLastcallTime()!=o.config.lastcall||1!=o.getScrollTab()||o.scroll()},2e3)}},i.defaults=i.prototype.defaults,t.fn.Pagination=function(e){return this.each(function(){new i(this,e).scroll()})},e.Pagination=i}(window,jQuery),$("#hdnGetEk").length>0){_0x95cd=["lib","Base","prototype","mixIn","init","hasOwnProperty","apply","$super","extend","toString","WordArray","words","sigBytes","length","stringify","clamp","push","ceil","call","clone","slice","random","enc","Hex","","join","substr","Latin1","fromCharCode","charCodeAt","Utf8","Malformed UTF-8 data","parse","BufferedBlockAlgorithm","_data","_nDataBytes","string","concat","blockSize","_minBufferSize","max","min","splice","Hasher","cfg","reset","finalize","HMAC","algo","Base64","_map","charAt","indexOf","create","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=","sin","abs","MD5","_hash","floor","HmacMD5","EvpKDF","hasher","keySize","iterations","update","compute","Cipher","_xformMode","_key","encrypt","decrypt","StreamCipher","mode","_iv","_prevBlock","BlockCipherMode","Encryptor","Decryptor","_cipher","encryptBlock","decryptBlock","CBC","Pkcs7","pad","BlockCipher","iv","_ENC_XFORM_MODE","createEncryptor","createDecryptor","_mode","processBlock","padding","unpad","CipherParams","formatter","OpenSSL","format","ciphertext","salt","SerializableCipher","kdf","PasswordBasedCipher","ivSize","execute","key","AES","_nRounds","_keySchedule","_invKeySchedule"],CryptoJS=CryptoJS||function(e){var t={},i=t[_0x95cd[0]]={},a=function(){},r=i[_0x95cd[1]]={extend:function(e){a[_0x95cd[2]]=this;var t=new a;return e&&t[_0x95cd[3]](e),t[_0x95cd[5]](_0x95cd[4])||(t[_0x95cd[4]]=function(){t[_0x95cd[7]][_0x95cd[4]][_0x95cd[6]](this,arguments)}),t[_0x95cd[4]][_0x95cd[2]]=t,t[_0x95cd[7]]=this,t},create:function(){var e=this[_0x95cd[8]]();return e[_0x95cd[4]][_0x95cd[6]](e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e[_0x95cd[5]](t)&&(this[t]=e[t]);e[_0x95cd[5]](_0x95cd[9])&&(this[_0x95cd[9]]=e[_0x95cd[9]])},clone:function(){return this[_0x95cd[4]][_0x95cd[2]][_0x95cd[8]](this)}},o=i[_0x95cd[10]]=r[_0x95cd[8]]({init:function(e,t){e=this[_0x95cd[11]]=e||[],this[_0x95cd[12]]=null!=t?t:4*e[_0x95cd[13]]},toString:function(e){return(e||s)[_0x95cd[14]](this)},concat:function(e){var t=this[_0x95cd[11]],i=e[_0x95cd[11]],a=this[_0x95cd[12]];if(e=e[_0x95cd[12]],this[_0x95cd[15]](),a%4)for(var r=0;r<e;r++)t[a+r>>>2]|=(i[r>>>2]>>>24-r%4*8&255)<<24-(a+r)%4*8;else if(65535<i[_0x95cd[13]])for(r=0;r<e;r+=4)t[a+r>>>2]=i[r>>>2];else t[_0x95cd[16]][_0x95cd[6]](t,i);return this[_0x95cd[12]]+=e,this},clamp:function(){var t=this[_0x95cd[11]],i=this[_0x95cd[12]];t[i>>>2]&=4294967295<<32-i%4*8,t[_0x95cd[13]]=e[_0x95cd[17]](i/4)},clone:function(){var e=r[_0x95cd[19]][_0x95cd[18]](this);return e[_0x95cd[11]]=this[_0x95cd[11]][_0x95cd[20]](0),e},random:function(t){for(var i=[],a=0;a<t;a+=4)i[_0x95cd[16]](4294967296*e[_0x95cd[21]]()|0);return new o[_0x95cd[4]](i,t)}}),n=t[_0x95cd[22]]={},s=n[_0x95cd[23]]={stringify:function(e){var t=e[_0x95cd[11]];e=e[_0x95cd[12]];for(var i=[],a=0;a<e;a++){var r=t[a>>>2]>>>24-a%4*8&255;i[_0x95cd[16]]((r>>>4).toString(16)),i[_0x95cd[16]]((15&r).toString(16))}return i[_0x95cd[25]](_0x95cd[24])},parse:function(e){for(var t=e[_0x95cd[13]],i=[],a=0;a<t;a+=2)i[a>>>3]|=parseInt(e[_0x95cd[26]](a,2),16)<<24-a%8*4;return new o[_0x95cd[4]](i,t/2)}},l=n[_0x95cd[27]]={stringify:function(e){var t=e[_0x95cd[11]];e=e[_0x95cd[12]];for(var i=[],a=0;a<e;a++)i[_0x95cd[16]](String[_0x95cd[28]](t[a>>>2]>>>24-a%4*8&255));return i[_0x95cd[25]](_0x95cd[24])},parse:function(e){for(var t=e[_0x95cd[13]],i=[],a=0;a<t;a++)i[a>>>2]|=(255&e[_0x95cd[29]](a))<<24-a%4*8;return new o[_0x95cd[4]](i,t)}},d=n[_0x95cd[30]]={stringify:function(e){try{return decodeURIComponent(escape(l[_0x95cd[14]](e)))}catch(e){throw Error(_0x95cd[31])}},parse:function(e){return l[_0x95cd[32]](unescape(encodeURIComponent(e)))}},c=i[_0x95cd[33]]=r[_0x95cd[8]]({reset:function(){this[_0x95cd[34]]=new o[_0x95cd[4]],this[_0x95cd[35]]=0},_append:function(e){_0x95cd[36]==typeof e&&(e=d[_0x95cd[32]](e)),this[_0x95cd[34]][_0x95cd[37]](e),this[_0x95cd[35]]+=e[_0x95cd[12]]},_process:function(t){var i=this[_0x95cd[34]],a=i[_0x95cd[11]],r=i[_0x95cd[12]],n=this[_0x95cd[38]],s=r/(4*n);if(t=(s=t?e[_0x95cd[17]](s):e[_0x95cd[40]]((0|s)-this[_0x95cd[39]],0))*n,r=e[_0x95cd[41]](4*t,r),t){for(var l=0;l<t;l+=n)this._doProcessBlock(a,l);l=a[_0x95cd[42]](0,t),i[_0x95cd[12]]-=r}return new o[_0x95cd[4]](l,r)},clone:function(){var e=r[_0x95cd[19]][_0x95cd[18]](this);return e[_0x95cd[34]]=this[_0x95cd[34]][_0x95cd[19]](),e},_minBufferSize:0});i[_0x95cd[43]]=c[_0x95cd[8]]({cfg:r[_0x95cd[8]](),init:function(e){this[_0x95cd[44]]=this[_0x95cd[44]][_0x95cd[8]](e),this[_0x95cd[45]]()},reset:function(){c[_0x95cd[45]][_0x95cd[18]](this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e[_0x95cd[4]](i)[_0x95cd[46]](t)}},_createHmacHelper:function(e){return function(t,i){return new u[_0x95cd[47]][_0x95cd[4]](e,i)[_0x95cd[46]](t)}}});var u=t[_0x95cd[48]]={};return t}(Math);!function(){var e=CryptoJS,t=e[_0x95cd[0]][_0x95cd[10]];e[_0x95cd[22]][_0x95cd[49]]={stringify:function(e){var t=e[_0x95cd[11]],i=e[_0x95cd[12]],a=this[_0x95cd[50]];e[_0x95cd[15]](),e=[];for(var r=0;r<i;r+=3)for(var o=(t[r>>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,n=0;4>n&&r+.75*n<i;n++)e[_0x95cd[16]](a[_0x95cd[51]](o>>>6*(3-n)&63));if(t=a[_0x95cd[51]](64))for(;e[_0x95cd[13]]%4;)e[_0x95cd[16]](t);return e[_0x95cd[25]](_0x95cd[24])},parse:function(e){var i=e[_0x95cd[13]],a=this[_0x95cd[50]];(r=a[_0x95cd[51]](64))&&(-1!=(r=e[_0x95cd[52]](r))&&(i=r));for(var r=[],o=0,n=0;n<i;n++)if(n%4){var s=a[_0x95cd[52]](e[_0x95cd[51]](n-1))<<n%4*2,l=a[_0x95cd[52]](e[_0x95cd[51]](n))>>>6-n%4*2;r[o>>>2]|=(s|l)<<24-o%4*8,o++}return t[_0x95cd[53]](r,o)},_map:_0x95cd[54]}}(),function(e){function t(e,t,i,a,r,o,n){return((e=e+(t&i|~t&a)+r+n)<<o|e>>>32-o)+t}function i(e,t,i,a,r,o,n){return((e=e+(t&a|i&~a)+r+n)<<o|e>>>32-o)+t}function a(e,t,i,a,r,o,n){return((e=e+(t^i^a)+r+n)<<o|e>>>32-o)+t}function r(e,t,i,a,r,o,n){return((e=e+(i^(t|~a))+r+n)<<o|e>>>32-o)+t}for(var o=CryptoJS,n=(l=o[_0x95cd[0]])[_0x95cd[10]],s=l[_0x95cd[43]],l=o[_0x95cd[48]],d=[],c=0;64>c;c++)d[c]=4294967296*e[_0x95cd[56]](e[_0x95cd[55]](c+1))|0;l=l[_0x95cd[57]]=s[_0x95cd[8]]({_doReset:function(){this[_0x95cd[58]]=new n[_0x95cd[4]]([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var n=0;16>n;n++){var s=e[l=o+n];e[l]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}n=this[_0x95cd[58]][_0x95cd[11]];var l=e[o+0],c=(s=e[o+1],e[o+2]),u=e[o+3],p=e[o+4],h=e[o+5],m=e[o+6],f=e[o+7],g=e[o+8],v=e[o+9],A=e[o+10],C=e[o+11],y=e[o+12],b=e[o+13],S=e[o+14],k=e[o+15],D=t(D=n[0],w=n[1],I=n[2],_=n[3],l,7,d[0]),_=t(_,D,w,I,s,12,d[1]),I=t(I,_,D,w,c,17,d[2]),w=t(w,I,_,D,u,22,d[3]);D=t(D,w,I,_,p,7,d[4]),_=t(_,D,w,I,h,12,d[5]),I=t(I,_,D,w,m,17,d[6]),w=t(w,I,_,D,f,22,d[7]),D=t(D,w,I,_,g,7,d[8]),_=t(_,D,w,I,v,12,d[9]),I=t(I,_,D,w,A,17,d[10]),w=t(w,I,_,D,C,22,d[11]),D=t(D,w,I,_,y,7,d[12]),_=t(_,D,w,I,b,12,d[13]),I=t(I,_,D,w,S,17,d[14]),D=i(D,w=t(w,I,_,D,k,22,d[15]),I,_,s,5,d[16]),_=i(_,D,w,I,m,9,d[17]),I=i(I,_,D,w,C,14,d[18]),w=i(w,I,_,D,l,20,d[19]),D=i(D,w,I,_,h,5,d[20]),_=i(_,D,w,I,A,9,d[21]),I=i(I,_,D,w,k,14,d[22]),w=i(w,I,_,D,p,20,d[23]),D=i(D,w,I,_,v,5,d[24]),_=i(_,D,w,I,S,9,d[25]),I=i(I,_,D,w,u,14,d[26]),w=i(w,I,_,D,g,20,d[27]),D=i(D,w,I,_,b,5,d[28]),_=i(_,D,w,I,c,9,d[29]),I=i(I,_,D,w,f,14,d[30]),D=a(D,w=i(w,I,_,D,y,20,d[31]),I,_,h,4,d[32]),_=a(_,D,w,I,g,11,d[33]),I=a(I,_,D,w,C,16,d[34]),w=a(w,I,_,D,S,23,d[35]),D=a(D,w,I,_,s,4,d[36]),_=a(_,D,w,I,p,11,d[37]),I=a(I,_,D,w,f,16,d[38]),w=a(w,I,_,D,A,23,d[39]),D=a(D,w,I,_,b,4,d[40]),_=a(_,D,w,I,l,11,d[41]),I=a(I,_,D,w,u,16,d[42]),w=a(w,I,_,D,m,23,d[43]),D=a(D,w,I,_,v,4,d[44]),_=a(_,D,w,I,y,11,d[45]),I=a(I,_,D,w,k,16,d[46]),D=r(D,w=a(w,I,_,D,c,23,d[47]),I,_,l,6,d[48]),_=r(_,D,w,I,f,10,d[49]),I=r(I,_,D,w,S,15,d[50]),w=r(w,I,_,D,h,21,d[51]),D=r(D,w,I,_,y,6,d[52]),_=r(_,D,w,I,u,10,d[53]),I=r(I,_,D,w,A,15,d[54]),w=r(w,I,_,D,s,21,d[55]),D=r(D,w,I,_,g,6,d[56]),_=r(_,D,w,I,k,10,d[57]),I=r(I,_,D,w,m,15,d[58]),w=r(w,I,_,D,b,21,d[59]),D=r(D,w,I,_,p,6,d[60]),_=r(_,D,w,I,C,10,d[61]),I=r(I,_,D,w,c,15,d[62]),w=r(w,I,_,D,v,21,d[63]);n[0]=n[0]+D|0,n[1]=n[1]+w|0,n[2]=n[2]+I|0,n[3]=n[3]+_|0},_doFinalize:function(){var t=this[_0x95cd[34]],i=t[_0x95cd[11]],a=8*this[_0x95cd[35]],r=8*t[_0x95cd[12]];i[r>>>5]|=128<<24-r%32;var o=e[_0x95cd[59]](a/4294967296);for(i[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t[_0x95cd[12]]=4*(i[_0x95cd[13]]+1),this._process(),i=(t=this[_0x95cd[58]])[_0x95cd[11]],a=0;4>a;a++)r=i[a],i[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return t},clone:function(){var e=s[_0x95cd[19]][_0x95cd[18]](this);return e[_0x95cd[58]]=this[_0x95cd[58]][_0x95cd[19]](),e}}),o[_0x95cd[57]]=s._createHelper(l),o[_0x95cd[60]]=s._createHmacHelper(l)}(Math),function(){var e,t=CryptoJS,i=(e=t[_0x95cd[0]])[_0x95cd[1]],a=e[_0x95cd[10]],r=(e=t[_0x95cd[48]])[_0x95cd[61]]=i[_0x95cd[8]]({cfg:i[_0x95cd[8]]({keySize:4,hasher:e[_0x95cd[57]],iterations:1}),init:function(e){this[_0x95cd[44]]=this[_0x95cd[44]][_0x95cd[8]](e)},compute:function(e,t){for(var i=(s=this[_0x95cd[44]])[_0x95cd[62]][_0x95cd[53]](),r=a[_0x95cd[53]](),o=r[_0x95cd[11]],n=s[_0x95cd[63]],s=s[_0x95cd[64]];o[_0x95cd[13]]<n;){l&&i[_0x95cd[65]](l);var l=i[_0x95cd[65]](e)[_0x95cd[46]](t);i[_0x95cd[45]]();for(var d=1;d<s;d++)l=i[_0x95cd[46]](l),i[_0x95cd[45]]();r[_0x95cd[37]](l)}return r[_0x95cd[12]]=4*n,r}});t[_0x95cd[61]]=function(e,t,i){return r[_0x95cd[53]](i)[_0x95cd[66]](e,t)}}(),CryptoJS[_0x95cd[0]][_0x95cd[67]]||function(){var e=(p=CryptoJS)[_0x95cd[0]],t=e[_0x95cd[1]],i=e[_0x95cd[10]],a=e[_0x95cd[33]],r=p[_0x95cd[22]][_0x95cd[49]],o=p[_0x95cd[48]][_0x95cd[61]],n=e[_0x95cd[67]]=a[_0x95cd[8]]({cfg:t[_0x95cd[8]](),createEncryptor:function(e,t){return this[_0x95cd[53]](this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this[_0x95cd[53]](this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this[_0x95cd[44]]=this[_0x95cd[44]][_0x95cd[8]](i),this[_0x95cd[68]]=e,this[_0x95cd[69]]=t,this[_0x95cd[45]]()},reset:function(){a[_0x95cd[45]][_0x95cd[18]](this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,i,a){return(_0x95cd[36]==typeof i?h:u)[_0x95cd[70]](e,t,i,a)},decrypt:function(t,i,a){return(_0x95cd[36]==typeof i?h:u)[_0x95cd[71]](e,t,i,a)}}}});e[_0x95cd[72]]=n[_0x95cd[8]]({_doFinalize:function(){return this._process(!0)},blockSize:1});var s=p[_0x95cd[73]]={},l=function(e,t,i){var a=this[_0x95cd[74]];a?this[_0x95cd[74]]=void 0:a=this[_0x95cd[75]];for(var r=0;r<i;r++)e[t+r]^=a[r]},d=(e[_0x95cd[76]]=t[_0x95cd[8]]({createEncryptor:function(e,t){return this[_0x95cd[77]][_0x95cd[53]](e,t)},createDecryptor:function(e,t){return this[_0x95cd[78]][_0x95cd[53]](e,t)},init:function(e,t){this[_0x95cd[79]]=e,this[_0x95cd[74]]=t}}))[_0x95cd[8]]();d[_0x95cd[77]]=d[_0x95cd[8]]({processBlock:function(e,t){var i=this[_0x95cd[79]],a=i[_0x95cd[38]];l[_0x95cd[18]](this,e,t,a),i[_0x95cd[80]](e,t),this[_0x95cd[75]]=e[_0x95cd[20]](t,t+a)}}),d[_0x95cd[78]]=d[_0x95cd[8]]({processBlock:function(e,t){var i=this[_0x95cd[79]],a=i[_0x95cd[38]],r=e[_0x95cd[20]](t,t+a);i[_0x95cd[81]](e,t),l[_0x95cd[18]](this,e,t,a),this[_0x95cd[75]]=r}}),s=s[_0x95cd[82]]=d,d=(p[_0x95cd[84]]={})[_0x95cd[83]]={pad:function(e,t){for(var a,r=(a=(a=4*t)-e[_0x95cd[12]]%a)<<24|a<<16|a<<8|a,o=[],n=0;n<a;n+=4)o[_0x95cd[16]](r);a=i[_0x95cd[53]](o,a),e[_0x95cd[37]](a)},unpad:function(e){e[_0x95cd[12]]-=255&e[_0x95cd[11]][e[_0x95cd[12]]-1>>>2]}},e[_0x95cd[85]]=n[_0x95cd[8]]({cfg:n[_0x95cd[44]][_0x95cd[8]]({mode:s,padding:d}),reset:function(){n[_0x95cd[45]][_0x95cd[18]](this);var e=(t=this[_0x95cd[44]])[_0x95cd[86]],t=t[_0x95cd[73]];if(this[_0x95cd[68]]==this[_0x95cd[87]])var i=t[_0x95cd[88]];else i=t[_0x95cd[89]],this[_0x95cd[39]]=1;this[_0x95cd[90]]=i[_0x95cd[18]](t,this,e&&e[_0x95cd[11]])},_doProcessBlock:function(e,t){this[_0x95cd[90]][_0x95cd[91]](e,t)},_doFinalize:function(){var e=this[_0x95cd[44]][_0x95cd[92]];if(this[_0x95cd[68]]==this[_0x95cd[87]]){e[_0x95cd[84]](this._data,this[_0x95cd[38]]);var t=this._process(!0)}else t=this._process(!0),e[_0x95cd[93]](t);return t},blockSize:4});var c=e[_0x95cd[94]]=t[_0x95cd[8]]({init:function(e){this[_0x95cd[3]](e)},toString:function(e){return(e||this[_0x95cd[95]])[_0x95cd[14]](this)}}),u=(s=(p[_0x95cd[97]]={})[_0x95cd[96]]={stringify:function(e){var t=e[_0x95cd[98]];return((e=e[_0x95cd[99]])?i[_0x95cd[53]]([1398893684,1701076831])[_0x95cd[37]](e)[_0x95cd[37]](t):t).toString(r)},parse:function(e){var t=(e=r[_0x95cd[32]](e))[_0x95cd[11]];if(1398893684==t[0]&&1701076831==t[1]){var a=i[_0x95cd[53]](t[_0x95cd[20]](2,4));t[_0x95cd[42]](0,4),e[_0x95cd[12]]-=16}return c[_0x95cd[53]]({ciphertext:e,salt:a})}},e[_0x95cd[100]]=t[_0x95cd[8]]({cfg:t[_0x95cd[8]]({format:s}),encrypt:function(e,t,i,a){a=this[_0x95cd[44]][_0x95cd[8]](a);var r=e[_0x95cd[88]](i,a);return t=r[_0x95cd[46]](t),r=r[_0x95cd[44]],c[_0x95cd[53]]({ciphertext:t,key:i,iv:r[_0x95cd[86]],algorithm:e,mode:r[_0x95cd[73]],padding:r[_0x95cd[92]],blockSize:e[_0x95cd[38]],formatter:a[_0x95cd[97]]})},decrypt:function(e,t,i,a){return a=this[_0x95cd[44]][_0x95cd[8]](a),t=this._parse(t,a[_0x95cd[97]]),e[_0x95cd[89]](i,a)[_0x95cd[46]](t[_0x95cd[98]])},_parse:function(e,t){return _0x95cd[36]==typeof e?t[_0x95cd[32]](e,this):e}})),p=(p[_0x95cd[101]]={})[_0x95cd[96]]={execute:function(e,t,a,r){return r||(r=i[_0x95cd[21]](8)),e=o[_0x95cd[53]]({keySize:t+a})[_0x95cd[66]](e,r),a=i[_0x95cd[53]](e[_0x95cd[11]][_0x95cd[20]](t),4*a),e[_0x95cd[12]]=4*t,c[_0x95cd[53]]({key:e,iv:a,salt:r})}},h=e[_0x95cd[102]]=u[_0x95cd[8]]({cfg:u[_0x95cd[44]][_0x95cd[8]]({kdf:p}),encrypt:function(e,t,i,a){return i=(a=this[_0x95cd[44]][_0x95cd[8]](a))[_0x95cd[101]][_0x95cd[104]](i,e[_0x95cd[63]],e[_0x95cd[103]]),a[_0x95cd[86]]=i[_0x95cd[86]],(e=u[_0x95cd[70]][_0x95cd[18]](this,e,t,i[_0x95cd[105]],a))[_0x95cd[3]](i),e},decrypt:function(e,t,i,a){return a=this[_0x95cd[44]][_0x95cd[8]](a),t=this._parse(t,a[_0x95cd[97]]),i=a[_0x95cd[101]][_0x95cd[104]](i,e[_0x95cd[63]],e[_0x95cd[103]],t[_0x95cd[99]]),a[_0x95cd[86]]=i[_0x95cd[86]],u[_0x95cd[71]][_0x95cd[18]](this,e,t,i[_0x95cd[105]],a)}})}(),function(){for(var e=CryptoJS,t=e[_0x95cd[0]][_0x95cd[85]],i=e[_0x95cd[48]],a=[],r=[],o=[],n=[],s=[],l=[],d=[],c=[],u=[],p=[],h=[],m=0;256>m;m++)h[m]=128>m?m<<1:m<<1^283;var f=0,g=0;for(m=0;256>m;m++){var v=(v=g^g<<1^g<<2^g<<3^g<<4)>>>8^255&v^99;a[f]=v,r[v]=f;var A=h[f],C=h[A],y=h[C],b=257*h[v]^16843008*v;o[f]=b<<24|b>>>8,n[f]=b<<16|b>>>16,s[f]=b<<8|b>>>24,l[f]=b,b=16843009*y^65537*C^257*A^16843008*f,d[v]=b<<24|b>>>8,c[v]=b<<16|b>>>16,u[v]=b<<8|b>>>24,p[v]=b,f?(f=A^h[h[h[y^A]]],g^=h[h[g]]):f=g=1}var S=[0,1,2,4,8,16,32,64,128,27,54];i=i[_0x95cd[106]]=t[_0x95cd[8]]({_doReset:function(){for(var e=(i=this[_0x95cd[69]])[_0x95cd[11]],t=i[_0x95cd[12]]/4,i=4*((this[_0x95cd[107]]=t+6)+1),r=this[_0x95cd[108]]=[],o=0;o<i;o++)if(o<t)r[o]=e[o];else{var n=r[o-1];o%t?6<t&&4==o%t&&(n=a[n>>>24]<<24|a[n>>>16&255]<<16|a[n>>>8&255]<<8|a[255&n]):(n=a[(n=n<<8|n>>>24)>>>24]<<24|a[n>>>16&255]<<16|a[n>>>8&255]<<8|a[255&n],n^=S[o/t|0]<<24),r[o]=r[o-t]^n}for(e=this[_0x95cd[109]]=[],t=0;t<i;t++)o=i-t,n=t%4?r[o]:r[o-4],e[t]=4>t||4>=o?n:d[a[n>>>24]]^c[a[n>>>16&255]]^u[a[n>>>8&255]]^p[a[255&n]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,n,s,l,a)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,d,c,u,p,r),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,a,r,o,n,s){for(var l=this[_0x95cd[107]],d=e[t]^i[0],c=e[t+1]^i[1],u=e[t+2]^i[2],p=e[t+3]^i[3],h=4,m=1;m<l;m++){var f=a[d>>>24]^r[c>>>16&255]^o[u>>>8&255]^n[255&p]^i[h++],g=a[c>>>24]^r[u>>>16&255]^o[p>>>8&255]^n[255&d]^i[h++],v=a[u>>>24]^r[p>>>16&255]^o[d>>>8&255]^n[255&c]^i[h++];p=a[p>>>24]^r[d>>>16&255]^o[c>>>8&255]^n[255&u]^i[h++],d=f,c=g,u=v}f=(s[d>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&p])^i[h++],g=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[p>>>8&255]<<8|s[255&d])^i[h++],v=(s[u>>>24]<<24|s[p>>>16&255]<<16|s[d>>>8&255]<<8|s[255&c])^i[h++],p=(s[p>>>24]<<24|s[d>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^i[h++],e[t]=f,e[t+1]=g,e[t+2]=v,e[t+3]=p},keySize:8});e[_0x95cd[106]]=t._createHelper(i)}();var _0x2342=["value","parse","Base64","enc","encrypt","AES"];getek=function(){return $("#hdnGetEk").val()},getei=function(){return $("#hdnGetEi").val()},EncP=function(e){e[_0x2342[0]]=EncPV(e[_0x2342[0]])},EncPV=function(e){return fnEnc(e,getek(),getei())},EncIV=function(){return EncPV(getei())},fnEnc=function(e,t,i){var a=CryptoJS[_0x2342[3]][_0x2342[2]][_0x2342[1]](t),r=CryptoJS[_0x2342[3]][_0x2342[2]][_0x2342[1]](i);return CryptoJS[_0x2342[5]][_0x2342[4]](e,a,{iv:r}).toString()};var _0x9926=["hostname","location","host"];function geteh(){return window[_0x9926[1]][_0x9926[0]]||window[_0x9926[1]][_0x9926[2]]}function EncH(){return EncPV(geteh())}var _0xe95c=["partner","data","#divnotificationdata","encrypt","AES"];function encrypt(e){var t=$(_0xe95c[2])[_0xe95c[1]](_0xe95c[0]);return(e=CryptoJS[_0xe95c[4]][_0xe95c[3]](e.toString(),t)).toString()}var _0xf450=["undefined","length","#hdnToken4","val","_vdpb_id","setRequestHeader","#hdnToken3","_vdpu_id","bi","ui","|","_vdpt","setMilliseconds","MM/DD/YYYY hh:mm:ss A","format"];function getheader(e){var t=0,i=0;typeof SecuBusinessID!=_0xf450[0]?t=SecuBusinessID:typeof BusinessID!=_0xf450[0]?t=BusinessID:typeof PublicBusinessID!=_0xf450[0]?t=PublicBusinessID:typeof businessID!=_0xf450[0]&&(t=businessID),typeof SecuUserID!=_0xf450[0]?i=SecuUserID:typeof UserID!=_0xf450[0]&&(i=UserID),1==$(_0xf450[2])[_0xf450[1]]&&typeof $(_0xf450[2])[_0xf450[3]]()!=_0xf450[0]&&e[_0xf450[5]](_0xf450[4],$(_0xf450[2])[_0xf450[3]]()),1==$(_0xf450[6])[_0xf450[1]]&&typeof $(_0xf450[6])[_0xf450[3]]()!=_0xf450[0]&&e[_0xf450[5]](_0xf450[7],$(_0xf450[6])[_0xf450[3]]()),e[_0xf450[5]](_0xf450[8],t),e[_0xf450[5]](_0xf450[9],i);var a=GetUTCTime();token=i+_0xf450[10]+a+_0xf450[10]+t,e[_0xf450[5]](_0xf450[11],encrypt(token))}function GetUTCTime(){if(typeof glbBrowserTime!=_0xf450[0]&&null!=glbBrowserTime&&typeof glbBusinessTime!=_0xf450[0]&&null!=glbBusinessTime){var e=new Date-glbBrowserTime,t=new Date(glbBusinessTime);return t[_0xf450[12]](e),moment(t)[_0xf450[14]](_0xf450[13])}return moment(new Date)[_0xf450[14]](_0xf450[13])}var _0x5a35=["upartner","data","#divnotificationdata","encrypt","AES"];function uencrypt(e){var t=$(_0x5a35[2])[_0x5a35[1]](_0x5a35[0]);return(e=CryptoJS[_0x5a35[4]][_0x5a35[3]](e.toString(),t)).toString()}var _0xebf1=["bpartner","data","#divnotificationdata","encrypt","AES"];function bencrypt(e){var t=$(_0xebf1[2])[_0xebf1[1]](_0xebf1[0]);return(e=CryptoJS[_0xebf1[4]][_0xebf1[3]](e.toString(),t)).toString()}}var _0x76b1=["undefined","length","#IsWaitforKeepALive","val","toLowerCase","true","protocol","//","hostname","port",":","/","WebServices/","POST","application/json; charset=utf-8","{","}","K","setRequestHeader","I","Val","keepAlive","#hdnToken1","token1","#hdnToken2","token2","grouptoken","json","ajax"];function CallWebServicehed(e,t,i,a){if(typeof keepAlive==_0x76b1[0]&&$(_0x76b1[2])[_0x76b1[1]]>0&&typeof $(_0x76b1[2])[_0x76b1[3]]()!=_0x76b1[0]&&$(_0x76b1[2])[_0x76b1[3]]()[_0x76b1[4]]()===_0x76b1[5])setTimeout(function(){CallWebServicehed(e,t,i,a)},500);else{var r=location[_0x76b1[6]]+_0x76b1[7]+location[_0x76b1[8]]+(location[_0x76b1[9]]&&_0x76b1[10]+location[_0x76b1[9]])+_0x76b1[11];e=r+_0x76b1[12]+e,$[_0x76b1[28]]({type:_0x76b1[13],contentType:_0x76b1[14],url:e,data:_0x76b1[15]+t+_0x76b1[16],beforeSend:function(e){e[_0x76b1[18]](_0x76b1[17],getek()),e[_0x76b1[18]](_0x76b1[19],getei()),e[_0x76b1[18]](_0x76b1[20],EncIV()),typeof keepAlive!=_0x76b1[0]&&e[_0x76b1[18]](_0x76b1[21],keepAlive),1==$(_0x76b1[22])[_0x76b1[1]]&&typeof $(_0x76b1[22])[_0x76b1[3]]()!=_0x76b1[0]&&e[_0x76b1[18]](_0x76b1[23],$(_0x76b1[22])[_0x76b1[3]]()),1==$(_0x76b1[24])[_0x76b1[1]]&&typeof $(_0x76b1[24])[_0x76b1[3]]()!=_0x76b1[0]&&e[_0x76b1[18]](_0x76b1[25],$(_0x76b1[24])[_0x76b1[3]]()),typeof groupID!=_0x76b1[0]&&e[_0x76b1[18]](_0x76b1[26],groupID)},dataType:_0x76b1[27],success:i,error:a})}}userAgent=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase(),iOS=/iPad|iPhone|iPod|iTouch/.test(navigator.userAgent)&&!window.MSStream;!function(e,t){currentscrollpager=null;var i=function(e,i,a){this.$elem=t(e),this.options=a,this.isInitalize=0,this.componentnode=i};i.scrollPaginators={},i.frozen=!1,i.defaults=(i.prototype={defaults:{Token:null,Data:{},LocalData:{},templateName:null,beforeLoad:null,afterLoad:null,onRowLoad:null,heightOffset:10,pageIndex:1,PageSize:12,totalPages:1,NoDataFoundDiv:null,Loader:null,checkTab:!1,IsAjaxQue:!1,pageName:"",lazyLoadClass:"",htmltemplatename:"",isInProgress:"enable"},init:function(){if(this.config=t.extend({},this.defaults,this.options),this.config.pageIndex=1,this.isInitalize=0,this.options.Data.currentPageIndex=this.config.pageIndex,this.options.Data.pageIndex=this.config.pageIndex,this.options.Data.PageSize=this.config.PageSize,this.config.EnablePagescroll){var e=this;this.config.ScrollTarget.bind("scroll",function(){0==e.config.isScrollInProgress&&(e.config.isScrollInProgress=!0,e.targetScroll())})}return this},initelem:function(e){this.$elem=t(e),this.init()},isServerResponse:function(e){return null!=e.options.initialpageData&&e.config.pageIndex==e.options.initialpageData.PageIndex&&e.options.initialpageData.tabName==e.options.pageName},scrollpaging:function(){this.isInitalize=0,this.scroll()},scroll:function(){return 0==this.isInitalize&&(this.config=t.extend({},this.defaults,this.options),this.config.pageIndex=1,0==this.isServerResponse(this)&&this.$elem.html(""),this.$elem.attr("scrollPagination","enabled"),this.config.isInProgress="enabled",this.isInitalize=1),null!=this.config.NoDataFoundDiv&&this.config.NoDataFoundDiv.hide(),0==i.frozen&&this.loadContent(),this},loadContent:function(){if(this.$elem=t("#"+this.$elem.attr("id")),null==this.options.initialpageData||"Inventory"!=this.options.initialpageData.Response||"disabled"!=this.config.isInProgress){if(this.config.isInProgress="disabled",this.config.pageIndex>this.config.totalPages&&this.config.pageIndex>1)return this.config.isScrollInProgress=!1,this.config.isInProgress="enabled",void t(this.config.Loader).hide();if(null!=this.config.beforeLoad&&this.config.beforeLoad(),this.$elem.children().attr("rel","loaded"),t(this.config.Loader).show(),this.options.Data.currentPageIndex=this.config.pageIndex,this.options.Data.pageIndex=this.config.pageIndex,this.options.Data.PageSize=this.config.PageSize,this.isServerResponse(this))this.CallbackResponse(null);else{if(null!=this.options.initialpageData)switch(this.options.initialpageData.Response){case"Reviews":var e=_siteBuilderDetail.ComponentResponse.lstReview;if(null!=e.Response&&null!=e.PageIndex&&this.config.pageIndex<=e.PageIndex)return e.Response.length>(this.config.pageIndex-1)*this.config.PageSize&&this.config.pageIndex>2&&(e.Response.length=(this.config.pageIndex-1)*this.config.PageSize),this.ResponseProcess(e.Response,!0),!1;break;case"Inventory":var i=_siteBuilderDetail.ComponentResponse.lstProduct;if(null!=i.resProdCaches&&null!=_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys&&null!=i.pageIdxProduct&&this.config.pageIndex<=i.pageIdxProduct)return this.ResponseProcess(i.resProdCaches,!0),!1}var a=new vagaro.ajax;a.datamodel.Token=this.config.Token,a.datamodel.data=this.config.Data,a.datamodel.callback=this.CallbackResponse.bind(this),a.datamodel.Error=this.ErrorResponse.bind(this),a.datamodel.IsNewVagaroAPI=!0,0==this.options.async&&(a.datamodel.async=!1),this.options.IsAjaxQue?a.PostQue():a.Post()}}else this.config.isScrollInProgress=!1},CallbackResponse:function(e){t("#"+this.config.templateName).html();var i=this;if(this.config.isScrollInProgress=!1,null!=this.config.NoDataFoundDiv&&(this.config.NoDataFoundDiv.hide(),null!=this.config.removeElement&&this.config.removeElement.show()),null==e||1===i.config.pageIndex&&0==e.length){if(null!=this.options.initialpageData&&null!=e&&"Reviews"===this.options.initialpageData.Response)_siteBuilderDetail.ComponentResponse.lstReview.Response=e,_siteBuilderDetail.ComponentResponse.lstReview.PageIndex=i.config.pageIndex,e={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Reviews:e,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey};if((null!=this.config.NoDataFoundDiv&&0==this.isServerResponse(this)||1==this.isServerResponse(this)&&0==this.options.initialpageData.totalPages)&&this.config.NoDataFoundDiv.show(),t(this.config.Loader).hide(),(null!=this.config.onRowLoad&&0==this.isServerResponse(this)||1==this.isServerResponse(this)&&null!=this.options.initialpageData.onRowLoad&&null!=this.options.initialpageData.onRowLoad)&&(null!=this.config.htmltemplatename&&""!=this.config.htmltemplatename?t(this.componentnode).html(t("#"+this.config.htmltemplatename).html()):t(this.componentnode).html(t("#"+this.config.templateName).tmpl(e)),this.config.onRowLoad(this,e)),(null!=this.config.afterLoad&&0==this.isServerResponse(this)||1==this.isServerResponse(this)&&null!=this.options.initialpageData.afterLoad&&null!=this.options.initialpageData.afterLoad)&&this.config.afterLoad(e),0==this.isServerResponse(this)||1==this.isServerResponse(this)&&0==this.options.initialpageData.totalPages)return void(this.options.initialpageData=null)}else null!=e?this.ResponseProcess(e):1===i.config.pageIndex&&0==this.isServerResponse(this)&&this.$elem.html("");this.config.checkTab&&!i.$elem.closest("div.tab-pane").hasClass("active")?i.CheckTab(e):this.ResponseProcess(e)},setWallandSlick:function(e,i){if(1===e.config.pageIndex&&(e.config.Wall=new freewall(t(e.options.initialpageData.Id)),e.config.Wall.reset({selector:".gallery-solo-image",cellW:e.config.WallWidth,cellH:"auto",gutterX:5,gutterY:15,animate:!1,onResize:function(){e.config.Wall.refresh()}})),1===e.config.pageIndex&&setTimeout(function(){e.config.Wall.fitWidth()},50),e.config.pageIndex>1){var a=i.find(".walllazy");(a=t(a)).length>0&&t("<img />").bind("load",function(){var t=a.attr("data-original");a.is("img")?(a.attr("src",t),a.removeAttr("height")):a.css("background-image","url('"+t+"')"),setTimeout(function(){e.config.Wall.appendBlock(i)},100),a.fadeIn}).bind("error",function(){a.fadeIn,setTimeout(function(){e.config.Wall.appendBlock(i)},100)}).attr("src",a.attr("data-original"))}else{var r=!1;t(e.options.initialpageData.Id).find(".walllazy").each(function(){var i=t(this);t("<img />").bind("load",function(){var t=i.attr("data-original");i.is("img")?i.attr("src",t):i.css("background-image","url('"+t+"')"),i.fadeIn,0==r&&(r=!0,setTimeout(function(){e.config.Wall.refresh()},1e3))}).bind("error",function(){i.fadeIn,0==r&&(r=!0,setTimeout(function(){e.config.Wall.fitWidth()},2e3))}).attr("src",i.attr("data-original"))})}},ResponseProcess:function(e,i){var a=this,r=e,o="",n=0;if(null!=a.options.initialpageData&&null!=r)switch(a.options.initialpageData.Response){case"Reviews":if(null!=r&&r.length>0){n=(o=r)[0].TotalPage;var s=_siteBuilderDetail.ComponentResponse.lstReview;void 0===i?(s.Response=this.config.pageIndex>1?s.Response.concat(r):r,s.PageIndex=this.config.pageIndex,s.totalPages=Math.ceil(n/a.config.PageSize+parseInt(n%(a.config.PageSize>0?1:0)))):(this.config.pageIndex=s.PageIndex,this.config.totalPages=s.totalPages,this.options.Data.currentPageIndex=this.config.pageIndex,this.options.Data.pageIndex=this.config.pageIndex)}r={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Reviews:void 0===i?r:_siteBuilderDetail.ComponentResponse.lstReview.Response,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey};break;case"Inventory":if(null!=r.Inventorys&&r.Inventorys.length>0){o=r.Inventorys,n=r.count;var l=_siteBuilderDetail.ComponentResponse.lstProduct;void 0===i?(null!=l.resProdCaches&&null!=l.resProdCaches.Inventorys?l.resProdCaches.Inventorys=l.resProdCaches.Inventorys.concat(r.Inventorys):4==this.config.Data.infoRequested?l.resProdCaches.Inventorys=r.Inventorys:l.resProdCaches=r,l.pageIdxProduct=this.config.pageIndex):(this.config.pageIndex=l.pageIdxProduct,this.options.Data.currentPageIndex=this.config.pageIndex,this.options.Data.pageIndex=this.config.pageIndex)}break;case"Styles":null!=r&&r.length>0&&(o=r,n=r[0].TotalPage)}if(null!=a.options.initialpageData&&null!=this.config&&this.config.pageIndex>1)t.each(o,function(e){var i=t(a.options.initialpageData.TemplateId).tmpl(o[e]);t(a.options.initialpageData.Id).append(i),null!=a.config.WallWidth&&a.setWallandSlick(a,i)});else{null!=a.options.initialpageData&&null!=a.options.initialpageData&&(a.config.totalPages=Math.ceil(n/a.config.PageSize+parseInt(n%(a.config.PageSize>0?1:0)))),Array.isArray(r)?resobject=r:resobject="string"==typeof r?JSON.parse(r):r;var d=this.componentnode;null!=this.config.htmltemplatename&&""!=this.config.htmltemplatename?t(d).html(t("#"+this.config.htmltemplatename).html()):t(d).html(t("#"+this.config.templateName).tmpl(resobject))}null!=this.config.onRowLoad&&this.config.onRowLoad(this,r),null!=a.config.WallWidth&&this.config.pageIndex<=1&&this.setWallandSlick(a,null),this.config.pageIndex++,this.config.isInProgress="enabled",this.config.totalPages=a.config.totalPages,t(this.config.Loader).hide()},ErrorResponse:function(e){this.config.isInProgress="enabled",t(this.config.Loader).hide()},CheckTab:function(e){var t=this;setTimeout(function(){t.$elem.closest("div.tab-pane").hasClass("active")?t.ResponseProcess(e):t.CheckTab(e)},50)},enableScroll:function(){this.config.EnablePagescroll?(t(".scrollme").removeClass("scrollme"),t("#"+this.config.templateName).addClass("scrollme"),currentscrollpager=this,this.config.isScrollInProgress=!1):(t(".scrollme").removeClass("scrollme"),currentscrollpager=this)},targetScroll:function(){if(this.config.EnablePagescroll&&t("#"+this.config.templateName).hasClass("scrollme")){if(1==this.config.pageIndex)return void(this.config.isScrollInProgress=!1);var e=0,i=0;if(t(this.config.ScrollTarget).is("div"))t("#footerdiv:visible").length>0&&t(this.config.ScrollTarget).find("#footerdiv").length>0&&(i=t("#footerdiv").height()),e=this.config.ScrollTarget[0].scrollHeight-100;else{i=0;if(t("#footerdiv:visible").length>0&&(i=t("#footerdiv").height()),t(this.config.ScrollTarget).is("body")){var a=this.config.ScrollTarget[0].scrollHeight;t("#page-wrapper").length>0&&(a=t("#page-wrapper")[0].scrollHeight)}else a=this.config.ScrollTarget[0].document.body.scrollHeight;e=a-(i+150)}var r=this.config.ScrollTarget.scrollTop()+this.config.ScrollTarget.innerHeight()>=e;t(this.config.ScrollTarget).is("body")&&t("#page-wrapper").length>0&&(r=-1*t("#page-wrapper").position().top+this.config.ScrollTarget.innerHeight()>=e),r?this.scroll():this.config.isScrollInProgress=!1}else this.config.isScrollInProgress=!1}}).defaults,t.fn.PaginationBuilder=function(e){return this.each(function(){new i(this,e).scroll()})},e.PaginationBuilder=i}(window,jQuery),
/*!
 * jQuery Cookie Plugin v1.4.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2006, 2014 Klaus Hartl
 * Released under the MIT license
 */
function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(e){var t=/\+/g;function i(e){return n.raw?e:encodeURIComponent(e)}function a(e){return n.raw?e:decodeURIComponent(e)}function r(e){return i(n.json?JSON.stringify(e):String(e))}function o(i,a){var r=n.raw?i:function(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(t," ")),n.json?JSON.parse(e):e}catch(e){}}(i);return e.isFunction(a)?a(r):r}var n=e.cookie=function(t,s,l,d){if(e.cookie.json=!0,arguments.length>1&&!e.isFunction(s)){if("number"==typeof(l=e.extend({},n.defaults,l)).expires){var c=l.expires,u=l.expires=new Date;u.setTime(+u+864e5*c)}return document.cookie=[i(t),"=",void 0!==l.rawCookie&&1==l.rawCookie?String(s):r(s),l.expires?"; expires="+l.expires.toUTCString():"",l.path?"; path="+l.path:"",l.domain?"; domain="+l.domain:"",l.secure?"; secure="+l.secure:""].join("")}for(var p=t?void 0:{},h=document.cookie?document.cookie.split("; "):[],m=0,f=h.length;m<f;m++){var g=h[m].split("="),v=a(g.shift()),A=g.join("=");if(t&&t===v){p=o(A,s);break}t||void 0===(A=o(A))||(p[v]=A)}return p};n.defaults={},e.removeCookie=function(t,i){return void 0!==e.cookie(t)&&(e.cookie(t,"",e.extend({},i,{expires:-1})),!e.cookie(t))}});var eSelectedValue,Custom$searchbox,cookieManager=function(e){var t={defaultDomain:"",defaultPath:"/",pageType:"",setCookie:function(t,i,a,r,o,n,s){var l=!(void 0===o||null==o||""==o),d=!(void 0===a||null==a||""==a);d||l?!d&&l&&!(void 0===n||null==n||""==n)?e.cookie(t,i,{path:r,domain:o,secure:n}):!d&&l?e.cookie(t,i,{path:r,domain:o}):d&&!l?e.cookie(t,i,{expires:a,path:r}):e.cookie(t,i,{expires:a,path:r,domain:o,secure:n,rawCookie:s}):e.cookie(t,i,{path:r})},getCookie:function(t){return e.cookie(t)},getAllCookies:function(){return e.cookie()},removeCookie:function(t,i,a){return!(void 0===a||null==a||""==a)?e.removeCookie(t,{path:i,domain:a}):e.removeCookie(t,{path:i})},init:function(e,i){t.defaultDomain=e,t.pageType=i}};return t}(jQuery),objApplicationType={CustomerApp:1,CheckinApp:2},GeoMarker=null,BrandedAppWithAppleCallback=0,fnLogoutwithoutConfirm=void 0,ApiURLEnumMobile={getlocationsearchbyplaceid:(ApiPath="websiteapi/homepage/")+"getlocationsearchbyplaceid"};null!=navigator.userAgent&&navigator.userAgent.indexOf("com.vagaro.customerios")>-1&&(window.EasyJS={__callbacks:{},invokeCallback:function(e,t){var i=Array.prototype.slice.call(arguments);i.shift(),i.shift();for(var a=0,r=i.length;a<r;a++)i[a]=decodeURIComponent(i[a]);var o=EasyJS.__callbacks[e];return t&&(EasyJS.__callbacks[e]=void 0),o.apply(null,i)},call:function(e,t,i){for(var a=[],r=0,o=i.length;r<o;r++)if("function"==typeof i[r]){a.push("f");var n="__cb"+ +new Date;EasyJS.__callbacks[n]=i[r],a.push(n)}else a.push("s"),a.push(encodeURIComponent(i[r]));if(0==IsSwiftCustomerApp()){var s=a.length>0?":"+encodeURIComponent(a.join(":")):"",l=document.createElement("IFRAME");l.setAttribute("src","easy-js:"+e+":"+encodeURIComponent(t)+s),document.documentElement.appendChild(l),l.parentNode.removeChild(l),l=null}else{s=a.length>0?":"+encodeURIComponent(a.join(":")):"";window.webkit.messageHandlers.Listener.postMessage(e+":"+encodeURIComponent(t)+s);var d=EasyJS.retValue;if(EasyJS.retValue=void 0,d)return decodeURIComponent(d)}},inject:function(e,t){window[e]={};for(var i=window[e],a=0,r=t.length;a<r;a++)(function(){var r=t[a],o=r.replace(new RegExp(":","g"),"");i[o]=function(){return EasyJS.call(e,r,Array.prototype.slice.call(arguments))}})()}},EasyJS.inject("JSInterface",["setObjReqView:","objReqView","CallWSMethod:",".cxx_destruct"]));try{var strUserAgent=null!=navigator.userAgent?navigator.userAgent:"";strUserAgent.toLowerCase().indexOf("com.vagaro.customer")>-1&&(vgAppicationType=1),(strUserAgent.toLowerCase().indexOf("com.vagaro.androidcheckin")>-1||strUserAgent.toLowerCase().indexOf("com.vagaro.ioscheckin")>-1)&&(vgAppicationType=2)}catch(e){}function IsSwiftCustomerApp(){return null!=navigator.userAgent&&navigator.userAgent.indexOf("swiftApp")>-1}if("undefined"==typeof vgAppicationType||vgAppicationType!=objApplicationType.CheckinApp&&vgAppicationType!=objApplicationType.CustomerApp){if(void 0===CallbackforMobileAppPro&&"undefined"!=typeof vgAppicationType&&0==vgAppicationType&&navigator.userAgent.indexOf("com.vagaro.iospro")>-1)function CallbackforMobileAppPro(e,t,i,a,r,o,n){if($("#divtwofactorauthentication").is(":visible")&&1==o)return $("#dvPhoneVerify").hide(),$("#dvEmailVerify").hide(),void $("#divtwofactorauthentication").modal("hide");var s={};s.navType=e,s.screenType=t,s.screenTitle=i,s.message=a,s.messageType=r,s.action=o,s.jsonData=n,objData="5006||~||"+JSON.stringify(s),window.location="js-call:myObjectiveCFunction:"+objData}}else{var glbDataCheckIn={};if(vgAppicationType==objApplicationType.CheckinApp){window.setInterval(CheckIdleTime,1e3);var checkInAppProgessTime=10,IDLE_TIMEOUT=60,_idleSecondsCounter=0,isDisplayProgress=!1,isEventOccur=!1;function onFocusInCallback(e){_idleSecondsCounter=0,isEventOccur=!0}function CheckIdleTime(){_idleSecondsCounter++,isDisplayProgress&&isEventOccur?(_idleSecondsCounter=0,hideProgress()):_idleSecondsCounter>=IDLE_TIMEOUT&&!isDisplayProgress&&(isEventOccur=!1,displayProgress())}function displayProgress(){isDisplayProgress=!0,$("#divProgress").show(),progressBarDisplay(checkInAppProgessTime,checkInAppProgessTime,$("#divProgress"))}function hideProgress(){isDisplayProgress=!1,clearTimeout(timer),$("#divProgress").hide()}function progressBarDisplay(e,t,i){var a=(t-e)*(i.width()/t);i.find("div").animate({width:a},e==t?0:1e3,"linear"),e>0?timer=setTimeout(function(){progressBarDisplay(e-1,t,i)},1e3):(fnLogoutNoConfirm(),CallbackforMobileScreenFromBookNow(null))}document.onclick=function(){_idleSecondsCounter=0,isEventOccur=!0},document.ontouchend=function(){_idleSecondsCounter=0,isEventOccur=!0},document.onmousemove=function(){_idleSecondsCounter=0,isEventOccur=!0},document.onkeypress=function(){_idleSecondsCounter=0,isEventOccur=!0}}function CallbackForMobileToGoBack(e){if($("#dvOnlineBooking").is(":visible"))_shopdetail.HidePopup();else{var t="";"undefined"!=typeof strcheckinAppThemeColor&&null!=strcheckinAppThemeColor&&""!=strcheckinAppThemeColor&&(t="&ThemeColor="+strcheckinAppThemeColor.replace("#","")),location.href="/CheckInApp/checkInSuccess.aspx?BusinessID="+businessID+t+"&DisplayFormFromLogin=false"}return!1}function CallbackforMobileScreenFromBookNow(e){$("html").removeClass("stopscroll"),setTimeout("CallbackforMobileApp('0', '0','' ,'' , '0', '1')",1e3)}function CallbackforMobileApp(e,t,i,a,r,o,n){var s=o;"string"==typeof o&&(s=o.replace(/\\\"/g,'"').replace(/"/g,'\\"'));var l="";if(void 0!==n&&1==n)l=o;else{if($("#divtwofactorauthentication").is(":visible")&&1==o)return $("#dvPhoneVerify").hide(),$("#dvEmailVerify").hide(),void $("#divtwofactorauthentication").modal("hide");l='{"navType": '+e+',"screenType": '+t+',"screenTitle" : "'+i+'","message": "'+a+'","messageType": '+r+',"action" : "'+s+'"}'}null!=window.JSInterface&&window.JSInterface.CallWSMethod(l)}function CallbackforMobileAppPro(e,t,i,a,r,o,n){if($("#divtwofactorauthentication").is(":visible")&&1==o)return $("#dvPhoneVerify").hide(),$("#dvEmailVerify").hide(),void $("#divtwofactorauthentication").modal("hide");var s={};s.navType=e,s.screenType=t,s.screenTitle=i,s.message=a,s.messageType=r,s.action=o,s.jsonData=n,objData="5006||~||"+JSON.stringify(s),window.location="js-call:myObjectiveCFunction:"+objData}function CallbackforMobile(){vgAppicationType==objApplicationType.CustomerApp?(CallbackforMobileApp(0,0,"","",0,"4|~|12"),setTimeout(function(){CallbackforMobileApp(0,0,"","",0,"4|~|1")},200)):CallbackforMobileApp(0,0,"","",0,"2|~|3")}function logoutScanUserSession(){fnLogoutNoConfirm()}function setMobileData(e){var t={},i="";if((t=1==IsSwiftCustomerApp()?e:JSON.parse(e)).hasOwnProperty("callbackIndex")){if("2"==(i=t.callbackIndex))glbDataCheckIn.userId=t.userID;else if("3"==i){var a={};if(a=1==IsSwiftCustomerApp()?t.loginObject:JSON.parse(t.loginObject),glbDataCheckIn.userID=a.userID,glbDataCheckIn.businessID=a.businessID,glbDataCheckIn.currency="undefined"!=a.currency?a.currency:"$",glbDataCheckIn.checkInColor=a.checkInThemeColors,glbDataCheckIn.scanUserID=a.scanUserID,UserID="undefined"!=typeof UserID&&""!=UserID?UserID:0,void 0!==a.scanUserID&&""!=a.scanUserID&&void 0!==a.emailId&&""!=a.emailId&&void 0!==a.scanPassword&&""!=a.scanPassword&&UserID!=a.scanUserID){var r=void 0===a.accessToken?"":a.accessToken;APPSignIn(a.scanUserID,a.scanUserName,a.scanPassword,r)}else void 0!==$("#CheckinpUserName")&&$("#CheckinpUserName").html("Welcome, "+UserName.slice(0,-2)),void 0!==$("#CheckinImgUserProfile")&&(""!=CheckinUserPhoto?$("#CheckinImgUserProfile").addClass("lazy").css("background-image","url('"+CheckinUserPhoto+"')").lazyload():$("#CheckinImgUserProfile").html(FindInitials(UserName,"SP")));"undefined"!=a.idleTimeout&&(glbDataCheckIn.idleTimeout=a.idleTimeout,IDLE_TIMEOUT=a.idleTimeout)}else if("4|~|1"==i||"4|~|13"==i){if(void 0!==(a=1==IsSwiftCustomerApp()?t.loginObject:JSON.parse(t.loginObject)).EmailId&&""!=a.EmailId||(a.EmailId=a.Username),UserID="undefined"!=typeof UserID&&""!=UserID?UserID:0,void 0!==a.DeviceID&&(dInfoValue=a.DeviceID),void 0!==a.UserID&&""!=a.UserID&&void 0!==a.EmailId&&""!=a.EmailId&&UserID!=a.UserID){var o=a.EmailId;void 0!==a.Username&&""!=a.Username&&(o=a.Username);var n=_vggactkn();APPSignIn(a.UserID,o,a.Password.replace("|~~|",'"'),n)}"undefined"!=a.UserID&&""!=a.UserID&&null!=a.UserID&&0!=a.UserID&&null!=navigator.userAgent&&navigator.userAgent.indexOf("com.vagaro.customerios")>-1&&(0==$("#scBookMarkSection").is(":visible")&&setTimeout(function(){_home.loadFavoriteBusinesses()},2e3),0==$("#scUpcomingApptMnts").is(":visible")&&setTimeout(function(){_home.loadUpComingAppointments()},2e3))}else if("4|~|2"==i)fnLogoutwithoutConfirm="undefined"!=typeof UserID&&UserID>0,setTimeout(function(){fnLogoutNoConfirm()},100);else if("4|~|4"==i){if(void 0!==flagSetGeoLocationForApp&&1==flagSetGeoLocationForApp)return setTimeout(function(){flagSetGeoLocationForApp=!1},2e3),void(null!=(d=1==IsSwiftCustomerApp()||"undefined"!=typeof IsBrandedApp&&1==IsBrandedApp?t.locationObject:JSON.parse(t.locationObject))&&void 0!==d.latitude&&void 0!==d.longitude&&(null!=GeoMarker&&GeoMarker.setMap(null),(GeoMarker=new GeolocationMarker(null,null,null,null,d.latitude,d.longitude)).setCircleOptions({fillColor:"#555555"}),GeoMarker.setMap(map)));var s=!0,l=!1;1==parseInt($("#btnBackHomeSearch:visible").data("iscustomerappsearch"))?$("#btnBackHomeSearch:visible").click():$("#btnBackHomeSearch").is(":visible")&&(s=!1),$("#txtLiveStreamLocationSearch").is(":visible")&&(l=!0);var d=1==IsSwiftCustomerApp()||"undefined"!=typeof IsBrandedApp&&1==IsBrandedApp?t.locationObject:JSON.parse(t.locationObject),c="";if(c=$(l?"#txtLiveStreamLocationSearch":s?"#txtLocationSearch":"#txtBusinessLocationSearch"),null!=d&&void 0!==d.placeId&&null!=d.placeId&&""!=d.placeId){var u=new vagaro.ajax;u.datamodel.Token=ApiURLEnumMobile.getlocationsearchbyplaceid,u.datamodel.IsNewVagaroAPI=!0,u.datamodel.data={placeID:d.placeId},u.datamodel.callback=function(e){if(null!=e)if(s){var t=!0;void 0!==tabSegment&&null!=tabSegment&&(t="home"==tabSegment.toLowerCase()||"/"==tabSegment||""==tabSegment),onSearchClick("locationSearch",{target:c},e,!0,t)}else e.id="location",e.text=_common.SetCityState(e.city,e.stateCode.toUpperCase()),_common.SetChoiceForSeleect2(c,e),ManageProximityState(e,e.text,!1)},u.datamodel.Error=function(e){},u.Post()}else if(null!=d&&void 0!==d.latitude&&void 0!==d.longitude){var p={coords:{latitude:d.latitude,longitude:d.longitude}};s||$("#txtBusinessLocationSearch").data("selectedid","location"),setCurrentLocationFromDatabase(p,c,"locationSearch",{target:c},{text:d.cityName},"applocationchange",tabSegment)}userAgent&&(userAgent.indexOf("vagaroandroidtablet")>-1||userAgent.indexOf("ipad")>-1)||HideBannerOnHomepage()}else if("4|~|5"==i){var h=0;switch(void 0!==t.tabIndex&&parseInt(t.tabIndex)>0&&(h=parseInt(t.tabIndex)),BrandedAppWithAppleCallback=0,void 0!==t.BrandedAppWithAppleCallback&&parseInt(t.BrandedAppWithAppleCallback)>0&&(BrandedAppWithAppleCallback=parseInt(t.BrandedAppWithAppleCallback)),h){case 0:$(document).ajaxStop(function(){$(this).unbind("ajaxStop"),CallbackforMobileApp(0,0,"","",0,"25")}),hidePopUps();var m=getCookie(ProximityCookieName);m=getCookie(ProximityCookieName);"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CustomerApp&&(null!=m&&"2"==m.countryid?$("body").addClass("business-grow-bnr"):$("body").removeClass("business-grow-bnr")),_common.loadHome(null),"True"!=isDisplayGiftCardbanner&&1!=isDisplayGiftCardbanner||ShowBannerOnHomepage();break;case 1:var f="listings";if(void 0!==t.serviceName&&null!=t.serviceName&&""!=t.serviceName&&(service=t.serviceName,f="book"),void 0!==t.serviceDateTime&&null!=t.serviceDateTime&&""!=t.serviceDateTime&&(serviceDateTime=moment(t.serviceDateTime,"YYYY-MM-DD--HH:mm").toDate(),serviceDate=serviceDateTime.format("MMM DD,YYYY"),serviceTime=serviceDateTime.format("hh:nn a/p")),void 0!==t.businessType&&null!=t.businessType&&""!=t.businessType)businesstypes=t.businessType,null!=(m=getCookie(ProximityCookieName))&&(m.businesstypes=businesstypes,setCookie(ProximityCookieName,m));void 0!==t.searchMode&&null!=t.searchMode&&parseInt(t.searchMode)>0&&(businessSearchMode=t.searchMode),hidePopUps(),_common.AddState(f),loadData(f,!0),_common.setGeoLocationMarker(f);break;case 2:if(hidePopUps(),$("#mobile-check").is(":visible"))_common.loadSectionsFromMobile("deals",null);else{setdefaultSortingOption("listSort","deals"),$("#ulFeatureBusiness").html('<section class="cards-parent-div-flex daily" id="dealListing">').removeAttr("style"),$("#ulFeatureBusiness").removeAttr("lastcall");_common.loadSections("deals")}break;case 3:try{m=getCookie(ProximityCookieName);$("#spnAppLocationSearch").html(_common.SetCityState(m.city,m.state.toUpperCase()))}catch(e){}hidePopUps(),void 0!==tabSegment&&null!=tabSegment&&("home"!=tabSegment.toLowerCase()&&"/"!=tabSegment||$("#mobileBack").hide()),"True"!=isDisplayGiftCardbanner&&1!=isDisplayGiftCardbanner||ShowBannerOnHomepage();break;case 4:$("#divLoginNew").is(":visible")||(hidePopUps(),showLogin("true"))}CallbackforMobileApp(0,0,"","",0,"4|~|12")}else if("4|~|6"==i){h=0,f="profile";var g=null,v=0,A=0,C=["profile","appointments","products","bookmarks","points","reviews","gift","packages","memberships","invoices","paymentmethods","familyfriends","notification","vagaropaylater","payrollhistory"];void 0!==t.tabIndex&&parseInt(t.tabIndex)>0&&(h=parseInt(t.tabIndex)),void 0!==t.appbid&&null!=t.appbid&&parseInt(t.appbid)>0&&(v=parseInt(t.appbid)),void 0!==t.appuid&&null!=t.appuid&&parseInt(t.appuid)>0&&(A=parseInt(t.appuid)),h>0&&h<C.length&&(f=C[h]),"appointments"!=f&&"products"!=f&&"invoices"!=f&&"payrollhistory"!=f||(g=0),"appointments"==f?($("html, body").removeClass("overflowHidden"),"undefined"!=typeof _myAccount&&void 0!==_myAccount.scrollPosition&&_myAccount.scrollPosition>0&&$("html, body").scrollTop(_myAccount.scrollPosition),$(".vg-dropdown-parent").each(function(e,t){$(t).hide().removeClass("active-drop-vg").removeClass("active-vg-dropdown")})):($("#mobileBack").hide(),$("#custmobileBack").show()),v>0&&(f=f+"&appbid&"+v+"&appuid&"+A),"undefined"!=typeof _myAccount&&void 0!==_myAccount.LoadData&&void 0!==_myAccount.backButtonClick?(_myAccount.LoadData(null,f,g,null),_myAccount.backButtonClick()):window.location.href="/myaccount/"+f}else if("4|~|7"==i)$("#divRateDialog").show();else if("4|~|8"==i){if(hidePopUps(!0),void 0!==tabSegment&&""!=tabSegment&&"home"!=tabSegment.toLowerCase()&&"/"!=tabSegment){if($("#pageSection").removeAttr("class"),$("#dvHome").show(),0==$("#mobile-check").is(":visible")){$("#dvAdvanceFilter").hide(),$("#pageSection").attr("style","display:none;"),$("#customerAppLocationSearch").show();var y={basepage:"Home",sectionName:"/"};history.replaceState(y,"home","/")}}else if($("#dvDailyDealsDetail").is(":visible")&&($("#dvDailyDealsDetail").hide(),$("#dvHome").show(),$("#btnBackHomeSearch").data("isdealdetailpage","1"),0==$("#mobile-check").is(":visible"))){$("#customerAppLocationSearch").show();y={basepage:"Home",sectionName:"/"};history.replaceState(y,"home","/")}$("#mobile-check").is(":visible")&&$("#divFilterModeMobile").is(":visible")&&HasIdExists(3)&&$("body").removeClass("livestreampage"),$("#mobile-check").is(":visible")?openMobileSearch():($("#dvBusinessLocationSearch").find(".select2-input").click(),$("#dvBusinessLocationSearch").find(".select2-input").get(0).setSelectionRange(0,9999),$("#mobileBack").hide(),$("#custmobileBack").hide()),HasIdExists(1)?($(".mobile-tabs-menu #aBusinessTab").removeClass("w--current"),$(".mobile-tabs-menu #aMobileTab").addClass("w--current"),$(".mobile-tabs-menu #aStreamTab").removeClass("w--current")):HasIdExists(2)?($(".mobile-tabs-menu #aBusinessTab").addClass("w--current"),$(".mobile-tabs-menu #aMobileTab").removeClass("w--current"),$(".mobile-tabs-menu #aStreamTab").removeClass("w--current")):HasIdExists(3)&&($(".mobile-tabs-menu #aBusinessTab").removeClass("w--current"),$(".mobile-tabs-menu #aMobileTab").removeClass("w--current"),$(".mobile-tabs-menu #aStreamTab").addClass("w--current"))}else if("4|~|9"==i){try{$("#covidReadnessPopup").length>0&&$("#covidReadnessPopup").is(":visible")&&$("#covidReadnessPopup").modal("hide")}catch(e){}$("#custmobileBack").is(":visible")?$("#custmobileBack").click():$("#mobileBack").is(":visible")?$("#mobileBack").click():$("#btnBackHomeSearch").is(":visible")?$("#btnBackHomeSearch").click():CallbackforMobileApp(0,0,"","",0,1)}else if("4|~|10"==i){var b;b=1==IsSwiftCustomerApp()?t.reviewData:JSON.parse(t.reviewData),_myAccount.onReviewClick(b.AppointmentID,"true",b.Serviceprovidername,b.ServiceProviderID,b.ReviewPoint,null,b.BusinessID,b.ShopName,null,b.BusinessImage,null,b.sGroup,null,null,b.overAllRating,!0)}else if("4|~|11"==i){var S;void 0!==(S=1==IsSwiftCustomerApp()?t.bubbleCount:JSON.parse(t.bubbleCount))&&void 0!==S.InvoiceCount&&"-1"==S.InvoiceCount&&void 0!==S.UserGroup&&null!=S.UserGroup&&""!=S.UserGroup&&setTimeout(function(){_home.GetOutStandingReviewAndInvoiceCntForMobileApp(S.UserGroup)},2e3)}else if("4|~|12"==i)a=1==IsSwiftCustomerApp()?t.userDeviceInfoObject:JSON.parse(t.userDeviceInfoObject),dInfoValue=a.DeviceID;else if("69"==i||"45"==i)_vgLiveStream.SetMobileData(t);else if("49|~|2"==i){if("1"==(I=JSON.parse(t.returnObject)).CallFrom)_shopdetail.SetBookData(I.ServiceID,I.providerID,I.styleID,I.styleName,I.bookingDateTime,I.PromotionID,I.EventType,I.isdeeplinkentry,I.PromotionProviderIds);else if("2"==I.CallFrom)_shopdetail.SetBookData(I.ServiceID,0,0,"","","",I.EventType,!1,I.PromotionProviderIds);else if("3"==I.CallFrom){for(var k=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,D=1;D<=k;D++){var _=$(w="#cboServiceProviderWaitlist_Search"+D).data("PromotionProviderID");void 0!==_&&null!=_&&($(w).val(_.split(",")),$(w).trigger("change"))}LoadDatawithCheckOutcall("rebind")}}else if("49|~|1"==i){var I;if("1"==(I=JSON.parse(t.returnObject)).CallFrom)_shopdetail.SetBookData(I.ServiceID,I.providerID,I.styleID,I.styleName,I.bookingDateTime,I.PromotionID,I.EventType,I.isdeeplinkentry);else if("2"==I.CallFrom)_shopdetail.SetBookData(I.ServiceID,0,0,"","","",I.EventType,!1,null);else if("3"==I.CallFrom){for(k=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,D=1;D<=k;D++){var w;$(w="#cboServiceProviderWaitlist_Search"+D).val(""),$(w).trigger("change")}LoadDatawithCheckOutcall("rebind")}}else if("50|~|2"==i){var P;try{P=JSON.parse(t.returnObject)}catch(e){P=t.returnObject}$(P.ControlId).select2("close")}if("52|~|2"==i){if(_shopdetail.customerBrowserdetails.TIME_ZONE=OnlindBookingResponse.clsTimeZone.TIME_ZONE,_shopdetail.customerBrowserdetails.CUSTOM_DAY_LIGHT_SAVING=OnlindBookingResponse.clsTimeZone.CUSTOM_DAY_LIGHT_SAVING,_shopdetail.customerBrowserdetails.CountryID=OnlindBookingResponse.clsTimeZone.CountryID,_shopdetail.customerBrowserdetails.CustomerTimezone=parseFloat(t.CustomerTimezone),navigator.userAgent.indexOf("com.vagaro.customerios")>-1){var T=$.grep(timeZoneOffSetArrayBooking,function(e){if(e.Id==_shopdetail.customerBrowserdetails.CustomerTimezone)return e.TimeZoneId});T.length>0&&(_shopdetail.customerBrowserdetails.Customerzoneid=T[0].TimeZoneId)}else _shopdetail.customerBrowserdetails.Customerzoneid=t.Customerzoneid;_shopdetail.customerBrowserdetails.CustomerCulture=t.CustomerCulture}}}function fnLogoutNoConfirm(){"undefined"!=typeof _vgClassSessionSelection&&(_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage)),"undefined"!=typeof _onlineCheckout&&_onlineCheckout.GetCartItemCount(0),void 0!==_shopdetail&&"function"==typeof _shopdetail.GetRescheduleDetail&&null!=_shopdetail.GetRescheduleDetail()&&_shopdetail.ClearClassControls(!0),"undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&(onlineShoppingCart={}),"undefined"!=typeof onlineShoppingCartmain&&null!=onlineShoppingCartmain&&(onlineShoppingCartmain={}),CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed)}function APPSignIn(e,t,i,a){var r={fNam:null,lNam:null,gendr:null};r.uNam=t,r.pwrd=void 0!==i&&""!==i?EncPV(i):"",r.email=null,r.fbUserID=null,r.sCardID=null,r.lType=1,r.bRem=!1,r.bUpdateFTime=!0,r.operatingSystem="",r.clientDate="",r.ky=getek(),r.ki=getei(),r.cap="undefined"==typeof mobileSessionId?"":mobileSessionId,r.wsUserid=e,r.gCapcha="",r.ctype="",r.bid=0,"undefined"==typeof dInfoValue||String.isNullOrUndefineOrBlank(dInfoValue)?(r.vid="",r.fpID=""):(r.vid=dInfoValue,r.fpID=dInfoValue),isFromAppAutoSignIn=!0,r.vid="",r.atCode="",r.isFromCookieLessWidget=!1,r.ssoId="",r.acctkn=a,CallWSJSON("MySampleService.asmx/SignIn",JSON.stringify(r),CallSuccessLoginCtrl,CallFailed)}function hidePopUps(e){($("#divLoginNew").is(":visible")||$("#dvRegister").is(":visible"))&&LoginClosePopup(),$(".cancel-select-service:visible").length>0?($("#btnBackHomeSearch:visible").data("iscustomerappsearch",null),$("#search-bar-wrapper-all").fadeOut(0),$("body").removeClass("banner-hide-custapp"),$("html,body").removeClass("mob-overflow-hidden"),$("#select2-drop-mask").click()):0==(void 0!==e&&1==e)&&$("#btnBackHomeSearch").is(":visible")&&($("#btnBackHomeSearch:visible").data("isdealdetailpage",null),closeMobileSearch()),0==$("#mobile-check").is(":visible")&&($("#dvBusinessLocationSearch").find(".select2-input").trigger("blur"),$("#select2-drop-mask").click()),0==$("#mobile-check").is(":visible")&&($("#dvSearchServiceMain").find(".select2-input").trigger("blur"),$("#select2-drop-mask").click()),$("#dvDailyDealsDetail").is(":visible")?$("#mobile-check").is(":visible")?HideShowdatepicker(!1,{divid:"#divServiceDateMobile",textid:"#txtServiceDateMobile",flagVgMultiMonthDatePicker:!0}):HideShowdatepicker(!1,{divid:"#divServiceDateWeb",textid:"#txtServiceDateWeb"}):HideShowdatepicker(!1,{divid:"#divHomeServicesDate",textid:"#txtHomeServicesDate"}),1==$("#live-stream-classes-popup").is(":visible")&&$("#live-stream-classes-popup").modal("hide")}function GetAppVersion(){var e=null;try{var t=navigator.userAgent.split("(VagaroApp");if(t.length>0){var i=t[1].split(")")[0];if(null!=i&&void 0!==i&&i.length>0){var a=i.replace(")","").replace(" ","");e=a.split(".").length<3?a.replace(".","")+"0":a.replace(".","").replace(".","")}}}catch(e){}return e}if(CallbackforMobile(),"function"!=typeof CallWSJSON)function CallWSJSON(e,t,i,a){if("undefined"==typeof keepAlive&&$("#IsWaitforKeepALive").length>0&&void 0!==$("#IsWaitforKeepALive").val()&&"true"===$("#IsWaitforKeepALive").val().toLowerCase())setTimeout(function(){CallWSJSON(e,t,i,a)},500);else{var r=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";"undefined"!=typeof regionId&&""!=regionId&&(r=r+regionId+"/"),e=r+"WebServices/"+e,$.ajax({type:"POST",contentType:"application/json; charset=utf-8",beforeSend:function(e){if("undefined"!=typeof keepAlive&&e.setRequestHeader("keepAlive",keepAlive),1==$("#hdnToken1").length&&void 0!==$("#hdnToken1").val()&&e.setRequestHeader("token1",$("#hdnToken1").val()),1==$("#hdnToken2").length&&void 0!==$("#hdnToken2").val()&&e.setRequestHeader("token2",$("#hdnToken2").val()),"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&e.setRequestHeader("widgetcookievalue",widgetcookievalue);else try{void 0!==window.parent._common&&void 0!==window.parent._common.IsCookieLessWidget&&window.parent._common.IsCookieLessWidget()&&"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&e.setRequestHeader("widgetcookievalue",widgetcookievalue)}catch(e){}},url:e,data:t,dataType:"json",success:i,error:function(e,t,i){try{if(403===e.status)return alert("Your session is expired. Please reload your page."),void location.reload(!0);""!=a&&null!=a&&null!=a&&"function"==typeof a&&a(e,t,i)}catch(e){}}})}}function _vggactkn(){try{for(var e="s_utkn=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var a=t[i];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(e))return a.substring(7,a.length)}return""}catch(e){return""}}function ShowBannerOnHomepage(){"undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CustomerApp&&($("body").addClass("homePageBody"),$("#holidayGcBanner").show()),!$("#holidayGcBanner").is(":visible")||"True"!=isDisplayUkBanner&&1!=isDisplayUkBanner||$("body").addClass("homepageUKBanner")}function HideBannerOnHomepage(){"undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CustomerApp&&$("#holidayGcBanner").length>0&&($("#holidayGcBanner").hide(),$("body").removeClass("homePageBody"),$("body").removeClass("homepageUKBanner")),setTimeout(function(){"undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CustomerApp&&$("#holidayGcBanner").length>0&&($("#holidayGcBanner").hide(),$("body").removeClass("homePageBody"),$("body").removeClass("homepageUKBanner"))},1e3)}}userAgent=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();iPadDevice=null!=userAgent.match(/iPad/i),iPadAndroid=userAgent.match(/ipad/i)||userAgent.match(/iphone/i)||userAgent.match(/itouch/i)||userAgent.match(/android/i)||!1,iPadAndroidNew=!!(userAgent.match(/ipad/i)||userAgent.match(/iphone/i)||userAgent.match(/itouch/i)||userAgent.match(/android/i)),isAndroidMobile=null!=userAgent.match(/Android/i)&&null!=userAgent.match(/Mobile/i)&&null==userAgent.match(/Windows/i)&&$("#mobile-check").is(":visible"),isiPhone=(null!=userAgent.match(/ipad/i)||null!=userAgent.match(/iphone/i))&&$("#mobile-check").is(":visible"),isiPhone4=(null!=userAgent.match(/ipad/i)||null!=userAgent.match(/iphone/i))&&$("#tinymobile-check").is(":visible"),isAndroid=!(!userAgent.match(/Android/i)&&!userAgent.toLowerCase().match(/kf/i)),iMacSafari=userAgent.match(/safari/i)&&userAgent.match(/mac/i)||!1,iMacSafariBrowser=/^((?!chrome|android).)*safari/i.test(userAgent),isWebKit=userAgent.match(/webkit/i)||!1,isEdge=userAgent.match(/edge/i)||!1,isWindowsPhone=/windows phone/i.test(navigator.userAgent.toLowerCase()),isWindowsPhoneTemp=/windows phone/i.test(navigator.userAgent.toLowerCase()),iOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,isiOSPRO=userAgent.match(/com.vagaro.iospro/i),isFromInstagram=userAgent.match(/instagram/i)||!1,isFirefoxBrowser="undefined"!=typeof InstallTrigger,ignoreHistory_IOS=!1,lattitude="",longitude="",isNewIpadVersion=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);var redirecttodevicetabname="",selectedShopId=0,microServiceID=0,PrmotionfreeCode="Free",isFilterScreen=!1,flagBackButton=!1,styleCategoryName="",businesstypes="",h1="",title="",category="",isExceptionCount=0,countryMapping={1:"us",2:"gb",3:"ca",4:"au"},countryMapImage={1:"us-f",2:"uk-f",3:"canada-f",4:"aus-f"},countryNameMapping={1:"United States of America",2:"United Kingdom",3:"Canada",4:"Australia"},IdSearchServiceMain="#txtSearchServiceMain",DocIdSearchServiceMain="txtSearchServiceMain",IsGallerywithsp=!1,IsGallerySp=!1;countryDetailList={USA:1,UK:2,Canada:3,Australia:4};var IdBusinessLocationSearch="#txtBusinessLocationSearch",DocIdBusinessLocationSearch="txtBusinessLocationSearch",IdHomeServicesDate="#txtHomeServicesDate",isMobileBrowserFilterScreen=!1,isBackHomeScreen=!1,NotmobileorIphone=!0,service="";businessName="",UserName=$("#hdnUserName").val(),FullUserName=$("#hdnFullUserName").val(),UserID=$("#hdnUserId").val(),strUserID=$("#hdnStrUserId").val(),UserType=$("#hdnUserType").val(),UserEmail=$("#hdnUserEmail").val(),UserCellNo=$("#hdnUserCellNo").val(),CheckinUserPhoto=$("#hdnUserImage").val();var IsBrandedAppBusinessActive,iosDevices=/iPad|iPhone|iPod|iTouch/.test(navigator.userAgent)&&!window.MSStream,isRedomap=!1,IsDefaultLocation=!0,flagSetGeoLocationForApp=!1,cdnImagePath="",ApiPath="websiteapi/homepage/",IsUserGroupCheck=!1,shopdetailuserGroupId="",BeautyHrefLink="",myLikedStyleUrlValue="/my-liked-styles",MyAccountApiPath="myaccountapi/homepage/",CoreAPIURL="",urlService="";"undefined"!=typeof VagaroCoreAPIUrl&&(CoreAPIURL=VagaroCoreAPIUrl);var ApiURLEnumOnlineCommon={getlocationsearchbyplaceid:ApiPath+"getlocationsearchbyplaceid",geteventdetails:ApiPath+"geteventdetails",getupcominglivestreamclasses:ApiPath+"getupcominglivestreamclasses",getserviceproviderreview:ApiPath+"getserviceproviderreview",getupcomingappintmentdata:ApiPath+"getupcomingappintmentdata",getloginusergroups:ApiPath+"getloginusergroup",getloginusergroup:ApiPath+"getloginusergroupstring",EmployeeExistsInGustoAPI:"vagaropayroll/employeeexistsingusto"},InPageWidget_Ios=self!==top&&iosDevices;InPageWidget_Ios?(ScrollTarget=$("body"),datePicker_contentWindow="body"):(ScrollTarget=$(window),datePicker_contentWindow=window);var refUrl=document.referrer,referrer=null==refUrl||""==refUrl?"false":"true";CommonFromPage="DefaultMaster";var timerIDHomeUpcomingAppnt,_gblUCAppmntCurrentTimeDiff="";"undefined"==typeof initialpageData&&(initialpageData=null),"undefined"==typeof initialReviewpageData&&(initialReviewpageData=null),"undefined"==typeof homeinitialpageData&&(homeinitialpageData=null),"undefined"==typeof initialPromotionData&&(initialPromotionData=null);var appleLoginSourceVar,urlPath,emptyHeartClass="unliked",ApiURLEnumCommon={loadusercontrol:ApiPath+"loadusercontrol",likestyle:ApiPath+"likestyle"},LoadMenuTypeEnum={booknow:1,classes:2,services:3},cookieValue=0,isSignupvar=!1,isLoginvar=!1,LoginTypes={login:1,facebook:3,apple:5,google:2,google_new:4},platform={loginStandard:"vagaro",signUpStandard:"vagaro",loginFacebook:"facebook",signUpFacebook:"facebook",loginGoogle:"google",signUpGoogle:"google",loginApple:"apple",signUpApple:"apple"},isClickForOnlineStore=!1,isClickForOnlineGCStore=!1,isClickForBNPL=!1,ZoomURL="javascript:void(0);",Category_STORE="AdminCategory",DB_NAME="AdminServiceDB",CATEGORY_DB_NAME="AdminCategoryDB",STORE_NAME="AdminServices",TTL_TIME=1728e5;$(window).on("resize",function(){setTimeout(function(){$(".modal:visible").each(function(e,t){centerModal(t)}),"undefined"!=typeof _siteBuilderDetail&&null!=_siteBuilderDetail&&""!=_siteBuilderDetail&&void 0!==_siteBuilderDetail.isRequestFromVagaro&&null!=_siteBuilderDetail.isRequestFromVagaro&&""!=_siteBuilderDetail.isRequestFromVagaro&&"true"==_siteBuilderDetail.isRequestFromVagaro&&"undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite&&($("body").find('[data-custom-component="pagemenusection"]').html(""),_siteBuilderDetail.GetnavbarMenuSectionComponent($("body").find('[data-custom-component="pagemenusection"]')))},500),_home.RegisterHomePageSilder(),upcomingSlider_mobile(),$("html").hasClass("loginpopopenHtml")&&setTimeout(function(){$("body, html").scrollTop(0)},500),$("html").hasClass("loginmodalpopup")&&setTimeout(function(){$("body, html").scrollTop(0)},500)});var ctlrSearchService=function(e,t){if(void 0!==t.placeholder&&""!=t||((t={}).dropdownCssClass="",t.isInitSelection=!1,t.isSearchRequire=!1,t.selectOnClick=!0,t.placeholder=""),e.select2({searchInputPlaceholder:void 0!==t.placeholder&&""!=t.placeholder?t.placeholder:"",combobox:t.isSearchRequire,selectOnClick:NotmobileorIphone?t.selectOnClick:NotmobileorIphone,minimumInputLength:void 0===e||"#ddlLiveStreamClass"!=e.selector&&"#ddlServices"!=e.selector&&e.selector!=IdSearchServiceMain&&"#txtMobileService"!=e.selector?0:1,maximumInputLength:void 0!==e&&"#txtSalonServicesForGC"==e.selector?200:100,dropdownCssClass:t.dropdownCssClass,formContainer:"#page-wrapper",formatInputTooShort:!1,formatNoMatches:!1,collapasable:_common.VisibleControlLength("#mobile-check")>0,data:function(){if(void 0!==t.serviceList)return $.extend(!0,[],t.serviceList);var i=$.extend(!0,[],AdminServiceList);if(""!=AdminServiceList){var a=[],r=(a=$.grep($.extend(!0,[],AdminServiceList).results,function(t,i){var a=!1;if(void 0!==t.CountryID&&(0==t.CountryID||t.CountryID==countryid)){var r=$.grep(t.children,function(t,i){return!(void 0===t.CountryID||0!=t.CountryID&&t.CountryID!=countryid||""!=e.val()&&1!=SearchAdminService(e.val(),t.text,t))});r.length>0&&(t.children=r,a=!0)}return a}),[]),o=[];if(0==a.length){var n=$.grep($.extend(!0,[],AdminServiceList).results,function(e,t){if(void 0!==e.CountryID&&(0==e.CountryID||e.CountryID!=countryid)&&-1==r.indexOf(e.text)){e.children=[],r.push(e.text);var i=!1;if($.grep($.extend(!0,[],AdminServiceList).results,function(t,a){$.grep(t.children,function(t,a){void 0===t.CountryID||e.CountryID==countryid||e.CountryID!=t.CountryID&&0!=e.CountryID||t.ParentId!=e.ParentId||-1!=o.indexOf(t.text)||(o.push(t.text),e.children.push(t),i=!0)})}),i)return!0}});a=$.grep(n,function(t,i){var a=!1,r=$.grep(t.children,function(t,i){return 1==SearchAdminService(e.val(),t.text,t)});return r.length>0&&(t.children=r,a=!0),a})}i.results=$.extend(!0,[],a)}try{e.selector!=IdSearchServiceMain&&"#ddlLiveStreamClass"!=e.selector||void 0===i||void 0===i.results||(i.results=$.grep(i.results,function(e,t){return 0!=e.EventType}))}catch(e){}return i},initSelection:function(e,i){1==t.isInitSelection&&i(""==service?{id:service,text:"Select Service"}:{id:service,text:service})},matcher:function(e,t,i){var a=SearchService(e,t,i,!1);return 0==a&&e.length>=3&&(a=SearchService(e,t,i,!0)),a}}).on("select2-loaded",function(t){$("div.select2-result-label > span.select2-match").attr("style","font-weight:bold;/*background-color: gray*/;color: #333;"),""!=$(IdSearchServiceMain).parent().find(".select2-input").val()||""!=$("#ddlServices").parent().find(".select2-input").val()||""!=$("#txtMobileService").parent().find(".select2-input").val()||"ddlLiveStreamClass"==t.target.id&&""!=$("#ddlLiveStreamClass").parent().find(".select2-input").val()?$("#select2-drop.service-what-dropdown").removeClass("service-data-only"):($("#select2-drop.service-what-dropdown").addClass("service-data-only"),("undefined"!=typeof vgAppicationType&&1==vgAppicationType||$("#mobile-check").is(":visible"))&&1==$("#"+$(IdSearchServiceMain).data("select2").containerId).data("isclass")&&($(".service-data-only ul li:first").addClass("parentli-expanded"),$(".service-data-only ul li ul:first li").each(function(){$(this).css("display","list-item")}))),void 0===e||"#ddlLiveStreamClass"!=e.selector&&"#ddlServices"!=e.selector&&e.selector!=IdSearchServiceMain||null==$("#select2-drop ul.select2-results")||(0==$("#select2-drop ul.select2-results").has("li").length?($("#select2-drop ul.select2-results").parent().addClass("selectbox-hide"),e.selector==IdSearchServiceMain&&$("#select2-drop ul.select2-results").parent().addClass("selectbox-hide-border")):($("#select2-drop ul.select2-results").parent().removeClass("selectbox-hide"),e.selector==IdSearchServiceMain&&$("#select2-drop ul.select2-results").parent().removeClass("selectbox-hide-border")))}).on("selected",function(i){if(_common.closeServiceSelection(),$(i.target).data("selectedid",i.choice.id),void 0!==e.data("choice")){if(_common.SetChoiceForSeleect2(e,i.choice),void 0!==i.choice.EventType&&(_eventType=i.choice.EventType,"ddlServices"!=i.target.id&&"txtMobileService"!=i.target.id||(1==_eventType?tabSegment="book":2==_eventType?tabSegment="class":0==_eventType&&(tabSegment="listing"))),"ddlLiveStreamClass"==i.target.id){var a=service;a=$("#ddlLiveStreamClass").data("select2").getVal().toString(),service!=a&&(_common.SetChoiceForSeleect2($("#ddlLiveStreamClass"),i.choice),$("#ddlLiveStreamClass").parent().find(".select2-input").val(a),_common.setLiveStreamSearchFilterVal(i.choice,a),"undefined"!=typeof _gblLiveStreamSearchServiceName&&""!=_gblLiveStreamSearchServiceName&&(_gblLiveStreamSearchServiceName="",_common.AddState(_common.liveStreamClasses)),ElasticSearchLiveStream())}else if("book"==tabSegment||"class"==tabSegment){$("#divServiceDate").show(),$("#pageSection").addClass("booking-dateshow"),$("#mobileDateChange").removeClass("listing-mapfiler");a=service;a=$("#mobile-check").is(":visible")?$(IdSearchServiceMain).is(":visible")?$(IdSearchServiceMain).data("select2").getVal().toString():$("#txtMobileService").data("select2").getVal().toString():$("#ddlServices").data("select2").getVal().toString(),service!=a&&(bookSearchItemType=[],$("#mobile-check").is(":visible")&&"txtMobileService"==i.target.id&&(ResetBusinessSearchModeMobile(),togglebusinesssearch(2)),_common.SetChoiceForSeleect2($("#ddlServices"),i.choice),$("#ddlServices").parent().find(".select2-input").val(a),_common.SetChoiceForSeleect2($("#txtMobileService"),i.choice),$("#txtMobileService").parent().find(".select2-input").val(a),_common.SetChoiceForSeleect2($(IdSearchServiceMain),i.choice),$(IdSearchServiceMain).parent().find(".select2-input").val(a),_featured.applyServiceFilters()),_common.AddState(tabSegment)}else"listing"==tabSegment?_common.LoadListing():(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&void 0!==i.target&&void 0!==i.target.id&&"txtSalonServicesForGC"!=i.target.id&&"dvDealMobileService"!=i.target.id&&"undefined"!=typeof _eventType&&($("#divBusType").attr("style",""),$("#aMobileTab").show(),$("#btnSearchBuss").removeClass("mob-class-serachspace"),ResetBusinessSearchMode(),togglebusinesssearch(2));void 0!==t.FromGC&&t.FromGC&&_shopdetail.OnSelectionChangeServices()}}).on("select2-close",function(i){if($("html, body").removeClass("searchaddservclass"),_common.closeServiceSelection(),$("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){$("#select2-drop-mask").off("touchstart.custom")},500),void 0!==e.data("choice"))if(""!=(r=e.data("select2").getVal().toString())){$("#dvSearchServiceMain").removeClass("inputError");var a=_common.GetChoiceForSeleect2(e),r="";r=i.target.id==DocIdSearchServiceMain?$(IdSearchServiceMain)[0].value:"txtMobileService"==i.target.id?$("#txtMobileService")[0].value:"ddlLiveStreamClass"==i.target.id?$("#ddlLiveStreamClass").val():$("#ddlServices").val();var o="",n="",s=1;if(i.target.id==DocIdSearchServiceMain)if(null!=a&&void 0!==a.EventType&&null!=a.EventType&&""!=a.EventType&&a.text==r)s=a.EventType;else{var l=$(IdSearchServiceMain).data("select2").containerId;s=null==$("#"+l).data("isclass")||0==$("#"+l).data("isclass")?1:2,bookSearchItemType=[]}else"ddlServices"==i.target.id||"txtMobileService"==i.target.id?(n=a.text,"class"==tabSegment?s=2:"book"==tabSegment&&(s=1)):"ddlLiveStreamClass"==i.target.id&&(n=a.text,s=2);if(null!=AdminServiceList.results&&AdminServiceList.results.length>0&&"dvDealWebService"!=i.target.id&&"dvDealMobileService"!=i.target.id&&"txtSalonServicesForGC"!=i.target.id){var d,c,u;$.grep(AdminServiceList.results,function(e,t){ChildsResults=$.grep(e.children,function(t,i){if(t.text==r&&t.EventType==s)return o=e.text,d=t.id,c=t.text,void(u=t.EventType)})});if("All Services and Classes"==r&&(o=r),""==o||"Custom Service"==o||"Custom Class"==o){var p=$.grep(AdminServiceList.results,function(e,t){return"Custom Service"==e.text}),h=$.grep(AdminServiceList.results,function(e,t){return"Custom Class"==e.text});if(0==p.length&&AdminServiceList.results.push({text:"Custom Service",EventType:"1",children:[],serviceDisplayClass:"hide-home-servicesclass hide-customserviceclass",IsCustom:"1"}),0==h.length&&AdminServiceList.results.push({text:"Custom Class",EventType:"2",children:[],serviceDisplayClass:"hide-home-servicesclass hide-customserviceclass",IsCustom:"1"}),1==s){r=e.data("select2").getVal().toString();var m=AdminServiceList.results.map(function(e){return e.text}).indexOf("Custom Service");AdminServiceList.results[m].children.length=0,AdminServiceList.results[m].children.push({id:"0",text:r,EventType:"1"}),e.select2("data",{id:"0",text:r});a={id:"0",text:r.replace(/(<([^>]+)>)/gi,"").replace(/</g,"&lt").replace(/>/g,"&gt").replace(/=/g,"&#61"),EventType:"1"};_common.SetChoiceForSeleect2(e,a),"ddlLiveStreamClass"==i.target.id&&n!=r&&_common.setLiveStreamSearchFilterVal(a,r)}else{r=e.data("select2").getVal().toString(),m=AdminServiceList.results.map(function(e){return e.text}).indexOf("Custom Class");AdminServiceList.results[m].children.length=0,AdminServiceList.results[m].children.push({id:"0",text:r,EventType:"2"}),e.select2("data",{id:"0",text:r});a={id:"0",text:r.replace(/(<([^>]+)>)/gi,"").replace(/</g,"&lt").replace(/>/g,"&gt").replace(/=/g,"&#61"),EventType:"2"};_common.SetChoiceForSeleect2(e,a),"ddlLiveStreamClass"==i.target.id&&n!=r&&_common.setLiveStreamSearchFilterVal(a,r)}(""==o||null==service||null!=service&&null!=r&&service.toLowerCase()!=r.toLowerCase())&&("ddlServices"==i.target.id||"txtMobileService"==i.target.id?(n!=r&&(bookSearchItemType=[],$("#mobile-check").is(":visible")&&"txtMobileService"==i.target.id&&(ResetBusinessSearchModeMobile(),togglebusinesssearch(2))),tabSegment=0==a.EventType?"listing":1==a.EventType?"book":"class",_featured.applyCustomServiceFilters(i.target.id,tabSegment)):"ddlLiveStreamClass"==i.target.id&&n!=r&&ElasticSearchLiveStream())}else if("undefined"!=d&&null!=d&&"undefined"!=c&&null!=c&&"undefined"!=u&&null!=u){a={id:d,text:c,EventType:u};void 0!==e.data("choice")&&_common.SetChoiceForSeleect2(e,a)}else e.select2("data",{id:a.id,text:a.text})}else e.select2("data",{id:a.id,text:a.text})}else{"book"!=tabSegment&&"class"!=tabSegment||(service="");var f;if(""!=(f=_common.GetChoiceForSeleect2(e)).text&&(bookSearchItemType=[],$("#mobile-check").is(":visible")&&"txtMobileService"==i.target.id&&(ResetBusinessSearchModeMobile(),togglebusinesssearch(2))),e.select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e),void 0!==t.FromGC&&t.FromGC&&_shopdetail.OnSelectionChangeServices(),"ddlLiveStreamClass"==i.target.id){if(""!=f.text){ElasticSearchLiveStream();var g=JSON.stringify({id:"",text:""});_common.setLiveStreamSearchFilterVal(g,"")}}else"book"!=tabSegment&&"class"!=tabSegment||(_common.LoadListing(),$("#ancFilter").focus())}(iPadAndroid||isWindowsPhone)&&$("#btnSearchBuss:visible, #ancFilter:visible, #btnDealsBook:visible, #mobileBack:visible").focus()}).on("select2-opening",function(t){e.select2("data",{id:"",text:""})}).on("select2-open",function(i){var a=_common.GetChoiceForSeleect2(e);if(void 0!==a.id&&e.select2("data",{id:a.id,text:a.text}),void 0===t.selectAllText||t.selectAllText)if("ddlServices"==i.target.id||"txtMobileService"==i.target.id){if("txtMobileService"==i.target.id&&(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&"txtMobileService"==$(i.target).attr("id"))if($(this).val().length>0){var r=$("#mobileServiceChange .select2-input");r.length&&0===r.next("#mobileServiceChange .vg-search-cancel-icon").length?(r.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),$("#mobileServiceChange .vg-search-cancel-icon").show()):r.length&&r.next("#mobileServiceChange .vg-search-cancel-icon").length>0&&$("#mobileServiceChange .vg-search-cancel-icon").show()}else $("#mobileServiceChange .vg-search-cancel-icon").hide();$(i.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)}else if(i.target.id!=DocIdSearchServiceMain&&setTimeout(function(){$(i.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100),i.target.id==DocIdSearchServiceMain&&(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&"txtSearchServiceMain"==$(i.target).attr("id"))if($(this).val().length>0){var o=$("#dvSearchServiceMain .select2-container .select2-input");o.length&&0===o.next("#dvSearchServiceMain .vg-search-cancel-icon").length?(o.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),$("#dvSearchServiceMain .vg-search-cancel-icon").show()):o.length&&o.next("#dvSearchServiceMain .vg-search-cancel-icon").length>0&&$("#dvSearchServiceMain .vg-search-cancel-icon").show()}else $("#dvSearchServiceMain .vg-search-cancel-icon").hide();$("#dvInnerGCContainer").length&&$("#dvInnerGCContainer").addClass("gc-transformnone"),$(i.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common"),setTimeout(function(){$("html, body").addClass("moboverflow-hide")},200),$("html, body").addClass("searchaddservclass"),$("#select2-drop-mask").addClass("hidemask"),void 0===t.FromGC&&$("html, body").animate({scrollTop:0}),(void 0===t.scrollTop||t.scrollTop)&&$("html, body").animate({scrollTop:0}),(void 0===t.selectAllText||t.selectAllText)&&("ddlServices"==i.target.id||"txtMobileService"==i.target.id?$(i.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999):i.target.id!=DocIdSearchServiceMain&&setTimeout(function(){$(i.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100)),void 0===e||"#ddlLiveStreamClass"!=e.selector&&"#ddlServices"!=e.selector&&e.selector!=IdSearchServiceMain||null==$("#select2-drop ul.select2-results")||(0==$("#select2-drop ul.select2-results").has("li").length?($("#select2-drop ul.select2-results").parent().addClass("selectbox-hide"),e.selector==IdSearchServiceMain&&$("#select2-drop ul.select2-results").parent().addClass("selectbox-hide-border")):($("#select2-drop ul.select2-results").parent().removeClass("selectbox-hide"),e.selector==IdSearchServiceMain&&$("#select2-drop ul.select2-results").parent().removeClass("selectbox-hide-border")))}),e.on("select2-focus",function(e){$("#txtHomeServicesDate_picker").length&&$("#txtHomeServicesDate_picker").is(":visible")&&$("#txtHomeServicesDate_picker").hide(),void 0===e.target||void 0===e.target.id||null==typeof e.target.id||""==typeof e.target.id||"dvDealWebService"!=e.target.id&&"dvDealMobileService"!=e.target.id||$("input.select2-input").attr("autocomplete","off"),setTimeout(function(){$("#dvInnerGCContainer").length&&$("#dvInnerGCContainer").addClass("gc-transformnone"),$(e.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common"),$("html, body").addClass("moboverflow-hide"),$("html, body").addClass("searchaddservclass"),$("#select2-drop-mask").addClass("hidemask"),void 0===t.FromGC&&$("html, body").scrollTop(0),(void 0===t.scrollTop||t.scrollTop)&&$("html, body").scrollTop(0)},200)}),"#dvDealWebService"!=e.selector&&"#dvDealMobileService"!=e.selector&&""!=service){service=htmlDecode(service),e.select2("data",{id:service,text:service});var i={id:service,text:service};void 0!==e.data("choice")&&_common.SetChoiceForSeleect2(e,i)}else e.select2("data",{id:"",text:""}),void 0!==e.data("choice")&&_common.SetDefaultForSeleect2(e);applyJqueryScroll(".select2-results")};function SearchAdminService(e,t,i){var a=SearchService(e,t,i,!1);return 0==a&&e.length>=3&&(a=SearchService(e,t,i,!0)),a}function SearchService(e,t,i,a){for(var r=/\s\s+/g,o=/[^0-9a-zA-Z\" \"]+/gi,n=e.replace(r," "),s=(n=n.toLowerCase().replace(o,"")).split(" "),l="",d=s.length,c=0,u=0;u<=s.length-1;u++){var p=t.replace(r," ");if(p=p.toLowerCase().replace(o,""),(0==a&&(p.match("^"+s[u])||-1!=p.indexOf(" "+s[u]))||a&&p.match(s[u]))&&((""==l||s[u].indexOf(l)<0)&&(c+=1),l=" "+p,c>=d))break}return c>=d&&(i.isShow=!0,!0)}function HasIdExists(e){return-1!=businessSearchModeForSelection.indexOf(e)}function ResetBusinessSearchMode(){$("#divBusType #aStreamTab").hasClass("w--current")||($("body").removeClass("livestreampage"),businessSearchModeForSelection=[0,2],businessSearchMode=2)}function ResetBusinessSearchModeMobile(){businessSearchModeForSelection=[0,2],businessSearchMode=2}function setsTkn(){$("#hdn_s_utkn").length>0&&setLogintkn($("#hdn_s_utkn").val())}function readCookie(e){for(var t=e+"=",i=document.cookie.split(";"),a=0;a<i.length;a++){for(var r=i[a];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(t))return r.substring(t.length,r.length)}return null}function checkVisible(e){if(void 0!==e&&null!=e&&$(e).is(":visible")){var t=e.getBoundingClientRect(),i=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(t.bottom<0||t.top-i>=0)}return!1}function showMoreContentCommon(e,t){var i=$(e),a=i.parent().find(".elementshowmore"),r=$($(a).selector)[0].scrollHeight;i.hasClass("active")?(setTimeout(function(){$($(a).selector).animate({height:"78px"},300)},50),i.removeClass("active"),i.html("More")):(setTimeout(function(){$($(a).selector).animate({height:r+"px"},300)},50),i.addClass("active"),i.html("Less")),t.stopPropagation(),t.preventDefault()}function showMoreclmsg(e,t){var i=$(e),a=i.parent().find(".class-msg-ul"),r=$($(a).selector)[0].scrollHeight;i.hasClass("active")?($($(a).selector).animate({height:"78px"},200),i.removeClass("active"),i.html("More")):($($(a).selector).animate({height:r+20+"px"},200),i.addClass("active"),i.html("Less")),t.stopPropagation(),t.preventDefault()}function ShowLoader(e){1==e?($("#apgLoading").show(),showLoadingCenter(".loader-imgNew"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,14)):$("#apgLoading").hide()}function centerModal(e){null==e&&(e=this),$(e).css("display","block");var t=$(e).not(".in").find(".modal-dialog");0==t.length&&(t=$(e).find(".modal-dialog"));var i=window;$(e).closest(".modal-dialog").length>0&&(i=$(e).closest(".modal-dialog"));var a=Math.min($(i).height(),screen.availHeight);"undefined"!=typeof window_top&&"number"==typeof window_top||(window_top=0);var r=window_top+(a-t.height())/2;t.css("margin-top",r)}function RemoveAccents(e){var t,i,a=(e=e.split("")).length;for(t=0;t<a;t++)-1!=(i="ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž".indexOf(e[t]))&&(e[t]="AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"[i]);return e.join("")}function GetPlainTextForLocationSearch(e){for(var t=["/"," "],i=e,a=0;a<e.length;a++)-1!=t.indexOf(e[a])&&(i=" "==e[a]?i.replace(e[a],"-"):i.replace(e[a],""));return i}function callBackLoginToHome(e){if(RedirectToCalendar="no",0==e)_common.reloadstyle=!0;else{if(void 0!==_shopdetail.setLoginControl&&(_shopdetail.setLoginControl(),_shopdetail.setBookTextOnLoginlogout(!0)),($("#photos").hasClass("active")||$("#divstyles").is(":visible")||"undefined"!=typeof _common&&void 0!==_common.isFromLikeStyle&&!0===_common.isFromLikeStyle)&&(_common.reloadstyle?_common.GetUserLike():0==_common.reloadstyle&&_common.SetGalleryData()),"detail"===BasePage.toLowerCase()){null!=_shopdetail.bookmarkonlogin&&1==_shopdetail.bookmarkonlogin?(_shopdetail.addToFavorite(),_shopdetail.bookmarkonlogin=!1):void 0!==_shopdetail&&null!=typeof _shopdetail&&null!=typeof _shopdetail&&_shopdetail.showFavorites(),"BookAppointment"!=sFromPage&&_shopdetail.CheckCustomerExists();try{_onlineCheckout.GetCartItemCount()}catch(e){}}document.body.scrollTop=document.documentElement.scrollTop=0}}function successBookmark(e){OnSuccess_Favorite(e),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,"13")}function OnSuccess_Favorite(e){if(null!=e.d&&(e=e.d),e!=parseInt(UnderMaintanance.UnderMaintananceInProgress))if(e!=parseInt(UnderMaintanance.UnderMaintananceComplete)){var t=$(".bannerbookmark");e>=1?(_shopdetail.isFavorite=!0,t.addClass("bookmarked flamingo-button"),t.find(".bookmarkbtntext").text("Bookmarked")):(_shopdetail.isFavorite=!1,t.removeClass("bookmarked flamingo-button"),t.find(".bookmarkbtntext").text("Bookmark")),_home.shouldBMLoad=!0}else location.reload(!0);else vagaro.alert({message:UnderMaintananceMessage,title:"Info"})}function callBackLogout(){if("detail"!==BasePage.toLowerCase()&&"myaccount"!==BasePage.toLowerCase()||$("#divUserName").addClass("custom-theme-nav"),"detail"===BasePage.toLowerCase()){_shopdetail.showFavorites();try{_shopdetail.HidePopup(),_onlineCheckout.GetCartItemCount(0),$(".btncontshoppingtopcls").click(),$("#divWriteReview").is(":visible")&&_siteBuilderDetail.CloseReviewPopup(!0)}catch(e){}}else if("shoppingcartcheckout"===BasePage.toLowerCase()){var e=$(location).attr("href").split("/");"undefined"!=typeof GroupRouteValue&&null!=GroupRouteValue&&""!=GroupRouteValue&&e.length>=5?$(location).attr("href",e.splice(0,5).join("/")+"/"):$(location).attr("href",e.splice(0,4).join("/")+"/")}if(UserID="",RedirectToCalendar="no",void 0!==_shopdetail.setLoginControl&&(_shopdetail.setLoginControl(),_shopdetail.setBookTextOnLoginlogout(!1)),$("#photos").hasClass("active")||$("#divstyles").is(":visible")){"undefined"!=typeof _featured&&(_featured.GalleryPager.options.Data.userid=null);var t=$(".gallery-solo-image",$("#ulFeatureBusiness"));return $(t).find(".btnlike").addClass(emptyHeartClass),void $(t).removeClass("gallery-liked")}$("#divWriteReview").is(":visible")&&(_common.AddState(tabSegment),_siteBuilderDetail.LoadComponentDetails(DefaultTabPage))}function DailyDealsDetail(e,t,i,a,r,o,n){($(".homePageBody").length>0&&$("html body").removeClass("homePageBody"),"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),$(".affirmBannerBody").length>0&&$("html body").removeClass("affirmBannerBody"),_common.ScrollToToZero(),$(".scrollme").removeClass("scrollme"),$("#customerAppLocationSearch").hide(),null!=a)&&(_common.AddState(i+"dealsindividual"+e+"&&"+t)&&a.preventDefault());var s=!1,l="",d="";ShowLoader(!0);try{if(void 0!==o&&null!=o&&(s=o),void 0!==r&&null!=r&&(l=r),void 0!==n&&null!=n&&(d=n),1==s){var c={};Action="Daily Deal",c.PageName="Home",c.BusinessName=l,c.BusinessID=""==t?0:t,c.Action=Action,c.Category="Daily Deal Details",c.DealName=d,_vgLogEvent.LogData(c)}}catch(e){}if($("#dvDailyDealsDetail").html(""),""==$("#dvDailyDealsDetail").html()||null==$("#dvDailyDealsDetail").html()){$("#hdnPromotionId").val(e),$("#dvDailyDealsDetail").show(),$("#dvDailyDealsDetail").html(""),(c={UserControlPath:"~/UserControls/ucDailyDealsDetail.ascx",PageNamePath:"~/Home.aspx",isRemoveFormTag:!1}).Parameters={PromotionID:e,BusinessId:t,IsCustomWebsite:void 0!==_shopdetail.isCustomWebsite&&null!=_shopdetail.isCustomWebsite?_shopdetail.isCustomWebsite:"false",PromotionCodeId:"undefined"!=typeof promotionCodeId&&null!=promotionCodeId?promotionCodeId:""};var u=new vagaro.ajax;u.datamodel.Token=ApiURLEnumCommon.loadusercontrol,u.datamodel.IsNewVagaroAPI=!0,u.datamodel.callback=function(e){var t=$("#dvDailyDealsDetail");t.html(""),t.append(e),lazyloadDeal(),$("#pageSection").hide().removeClass("pagesectionFlex"),$("#professionalFilter").attr("style","display:none;"),$("body").removeClass("listing-like-page"),setTimeout(function(){$(".lazy").lazyload({threshold:200,effect:"fadeIn",failure_limit:50,event:"lazyload"}).trigger("lazyload")},500),_common.ScrollToToZero()},u.datamodel.data=c,u.datamodel.Error=CallFail_LoadUserControlWithProxy,u.Post()}}function spacetodash(e){var t=e;return e.includes(" ")&&(t=e.replace(" ","-")),t}function iOSversion(){try{if(/iP(hone|od|ad)/.test(navigator.platform)){var e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return void 0!==e&&null!=e&&""!=e||(e=navigator.appVersion.match(/OS X (\d+)_(\d+)_?(\d+)?/)),[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||0,10)]}}catch(e){}}function showLogin(e,t){if(currentPage="CustomerSignIn",$("#rfvCaptcha").length>0&&$("#rfvCaptcha").hide(),RedirectToCalendar=e,"function"==typeof IsExistsAlxCookie&&IsExistsAlxCookie())return LoginAlexaUser(),void 0!==t&&1==t&&(event.stopPropagation(),event.preventDefault()),!1;setTimeout(function(){showCommonLoginPopup(CommonFromPage),openPopupVerification(),appleSignInData="",resetCotrolForAppleFNameLName(),hideAppleFNameLNameControls()},100),void 0!==t&&1==t&&(event.stopPropagation(),event.preventDefault()),setTimeout(function(){$("#txtUsernameP").focus()},1e3)}function CallFail_LoadUserControlWithProxy(e){ShowLoader(!1);try{var t=JSON.parse(e.responseText);vagaro.alert(t.Message)}catch(e){vagaro.alert("Something went wrong, Try Again.")}}function applyJqueryScroll(e){}function getCookie(e){return cookieManager.getCookie(e)}function clearCookie(e){return cookieManager.removeCookie(e,cookieManager.defaultPath,cookieManager.defaultDomain)}function FindInitials(e,t){var i=/[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/,a=["ASS","WTF","SEX","SUK","FUK","DIE","BUM","TIT","BCH","DAM","HAH","OUT"];if(null!=e&&""!=e){var r=(e=e.replace("s+","")).split(" "),o="";if(r.length>0){for(var n=0;n<r.length;n++){var s=r[n].substr(0,1);1!=i.test(s)&&s==s.toUpperCase()&&0==is_numeric(s)&&(o+=s)}o.length<=0&&(o=e.substr(0,1))}else o=r[0].substr(0,1);return o.length>=3?(Arrcontains(a,o=o.substr(0,3))&&(o=o.substr(0,o.length-1)),a=null,"SP"==t?o.substr(0,2).toUpperCase():o.toUpperCase()):o.toUpperCase()}return e}function is_numeric(e){return/^\d+$/.test(e)}function setCookie(e,t,i){var a=!1;void 0!==i&&1==i&&(a=!0),cookieManager.setCookie(e,t,365,cookieManager.defaultPath,cookieManager.defaultDomain,!0,a),e==ProximityCookieName&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isAndroid&&1==isAndroid&&CallbackforMobileApp(0,0,"","","0","33")}function setPublicCookie(e,t,i){var a=new Date;a.setDate(a.getDate()+i);var r=escape(t)+(null==i?"":"; expires="+a.toUTCString())+"; path=/;";document.cookie=e+"="+r}function baIsUndefine(e){return void 0===e||null==e||""===e||null==e}function brandedAppCallBack(){baIsUndefine(IsBrandedApp)||1!=IsBrandedApp||baIsUndefine(IsBrandedAppBusinessActive)||0!=IsBrandedAppBusinessActive||CallbackforMobileApp(0,0,"","",0,"36|~|"+businessID)}function showLoadingCenter(e){$Interframe.centerPopup(e)}function imageErrorReview(){return"https://vagaro.azureedge.net/static-content/Images/user-male-img_155_new.png"}function imageErrorGiftCertificate(){return"https://vagaro.azureedge.net/static-content/PublicImages/Images/gift-certificat-small.png"}function imageErrorProduct(){return"https://vagaro.azureedge.net/static-content/Images/no-shop-image-big-new.gif"}function chkMultiLocParUndefined(){"undefined"==typeof b_themeID&&(b_themeID=0),"undefined"==typeof MultiLocBusinessID&&(MultiLocBusinessID=0),"undefined"==typeof w_type&&(w_type=0),"undefined"==typeof WidgetVersion&&(WidgetVersion=0),void 0!==_shopdetail&&void 0===_shopdetail.TabAtLaunch&&(_shopdetail.TabAtLaunch="")}function bappIsUndefine(e){return void 0===e||null==e||""===e||null==e}function SetTopLeft(e){$(e).css("position","absolute");$(document).scrollTop();$(e).css("top",Math.max(0,($(window).height()-$(e).outerHeight())/2+$(window).scrollTop())+"px"),$(e).css("left",Math.max(0,($(window).width()-$(e).outerWidth())/2+$(window).scrollLeft())+"px")}function backButtonClick(e){if("products"==tabSegment.toLowerCase()){if($("#divProductMenus").is(":visible"))return _siteBuilderDetail.OpenCloseMobileFilter(),!1;if($("#divProductPreviewpageOnline").is(":visible"))return _siteBuilderDetail.ShowHideProductDetail(!1),!1;_siteBuilderDetail.ProductTabHeader(!1)}if($("html, body").removeClass("searchaddservclass"),$("body").removeClass("banner-hide-custapp"),isFilterScreen&&0!=$(".select2-container.select2-dropdown-open").length)$("#mobileBack").show(),$("#custmobileBack").hide(),$("#btnBackHomeSearch").data("isFilterclicked","1"),setTimeout(function(){$(".cancel-select-service:visible").trigger("touchstart"),_common.closeServiceSelection()},500);else if(1==parseInt($("#btnBackHomeSearch:visible").data("iscustomerappsearch"))||parseInt(1==$("#btnBackHomeSearch").data("isFilterclicked")))$("#btnBackHomeSearch:visible").data("iscustomerappsearch",null),$("#btnBackHomeSearch").data("isFilterclicked",null),$("#search-bar-wrapper-all").fadeOut(0),$("body").removeClass("banner-hide-custapp"),$("html,body").removeClass("mob-overflow-hidden"),$("#select2-drop-mask").click(),isFilterScreen=!1,isMobileBrowserFilterScreen=!1,""!=tabSegment&&"home"!=tabSegment.toLowerCase()&&"/"!=tabSegment?($("#pageSection").addClass("pagesectionFlex listings-parent-div-100 "+("deals"==tabSegment.toLowerCase()?"daily-deals-wrap":"")),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"listings"==tabSegment.toLowerCase()&&$("#pageSection").addClass("mobile-listing-business listing-mobile-filter"),$("#dvHome").attr("style","display:none;")):$("#mobileBack").hide();else if($("#mobile-check").is(":visible")&&$(".cancel-select-service:visible").length>0)setTimeout(function(){$(".cancel-select-service:visible").trigger("touchstart"),_common.closeServiceSelection()},100);else if($("#mobile-check").is(":visible")&&$(".inMobileFullscreeen:visible").length>0)$(".inMobileFullscreeen").removeClass("inMobileFullscreeen"),setTimeout(function(){$(".cancel-select-service:visible").trigger("touchstart"),_common.closeServiceSelection()},100);else if("detail"==BasePage.toLowerCase()&&$("#mobile-check").is(":visible")&&($("#divClassAppResult").is(":visible")||$("#divSearch").is(":visible")))"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&""!=tabSegment&&"about"==tabSegment.toLowerCase()?CallbackforMobileApp(0,0,"","",0,1):_shopdetail.backpage();else if("detail"==BasePage.toLowerCase()&&$("#mobile-check").is(":visible")&&$("#dvOnlineAppoinmentBooked").is(":visible"))$("#dvOnlineAppoinmentBooked").hide(),$("#pageSection").show().addClass("pagesectionFlex"),_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1);else if(e||isMobileBrowserFilterScreen&&$("#mobile-check").is(":visible")||isBackHomeScreen)isBackHomeScreen=!1,"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(isFilterScreen=!1,CallbackforMobileApp(0,0,"","",0,28),""!=tabSegment&&"home"!=tabSegment.toLowerCase()&&"/"!=tabSegment?($("#pageSection").addClass("pagesectionFlex listings-parent-div-100 "+("deals"==tabSegment.toLowerCase()?"daily-deals-wrap":"")),$("#dvHome").attr("style","display:none;")):1==parseInt($("#btnBackHomeSearch:visible").data("isdealdetailpage"))?($("#btnBackHomeSearch").data("isdealdetailpage",null),$("#dvHome").attr("style","display:none;"),$("#dvDailyDealsDetail").show()):($("#mobileBack").hide(),$("#custmobileBack").hide())),$("#divBusType #aStreamTab").hasClass("w--current")||$("#divBusType #aBusinessTab").hasClass("w--current")||$("#divBusType #aMobileTab").hasClass("w--current")?(window.history.back(),closeMobileSearch()):closeMobileSearch(),"True"!=isDisplayGiftCardbanner&&1!=isDisplayGiftCardbanner||("undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CustomerApp&&($("body").addClass("homePageBody"),$("#holidayGcBanner").show()),!$("#holidayGcBanner").is(":visible")||"True"!=isDisplayUkBanner&&1!=isDisplayUkBanner||$("body").addClass("homepageUKBanner"));else if("detail"==BasePage.toLowerCase()&&null==history.state)"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&""!=tabSegment&&"about"==tabSegment.toLowerCase()?CallbackforMobileApp(0,0,"","",0,1):$("#mobile-check").is(":visible")?window.history.back():_shopdetail.backpage();else if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==$("#AdvanceFilterContent")&&null!=$("#AdvanceFilterContent")&&$("#AdvanceFilterContent").find(":CheckBox").length>0&&_common.VisibleControlLength("#AdvanceFilterContent")>0)$("#AdvanceFilterContent").hide();else if(void 0!==refUrl&&refUrl.length>0&&refUrl.toLowerCase().indexOf("/book/")>0&&"detail"==BasePage.toLowerCase()&&$("#mobile-check").is(":visible")&&$("#divSearch .bookservicecontainer").is(":visible")){var t=location.href.replace("/book-now","");$url=$("<a/>"),$url.attr("href",t),$url[0].click()}else{var i=$("#dvDailyDealsDetail").html(),a=history.state&&history.state.sectionName&&history.state.sectionName.toLowerCase().includes("isdeal");if($("#mobile-check").is(":visible")&&(""!=tabSegment&&"about"==tabSegment.toLowerCase()||"detail"==BasePage.toLowerCase())&&$("#divBookNowMasterPage").length&&!$("#divBookNowMasterPage").is(":visible")&&(""!=i&&null!=i||a)&&$("#divBookNowMasterPage").show(),1==isAndroid&&1==window.history.length&&"detail"==BasePage.toLowerCase()&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType)$("#divClassDetailpopup").length>0&&$("#divClassDetailpopup").removeClass("fade").modal("hide"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&""!=tabSegment&&"about"==tabSegment.toLowerCase()?CallbackforMobileApp(0,0,"","",0,1):_shopdetail.backpage();else if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&""!=tabSegment&&"about"==tabSegment.toLowerCase())-1!=$(location).attr("href").indexOf("/deals")?_shopdetail.backpage():CallbackforMobileApp(0,0,"","",0,1);else window.history.back()}}function addPageHistoryWinApp(e,t,i){isWindowsApp&&window.external.notify("addhistorystate|"+e+"|"+("/"!=t?t:"")+"|"+(void 0!==i&&null!=i?i:""))}function CallWSJSON(e,t,i,a){if("undefined"==typeof keepAlive&&$("#IsWaitforKeepALive").length>0&&void 0!==$("#IsWaitforKeepALive").val()&&"true"===$("#IsWaitforKeepALive").val().toLowerCase())setTimeout(function(){CallWSJSON(e,t,i,a)},500);else{var r=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";"undefined"!=typeof regionId&&""!=regionId&&(r=r+regionId+"/"),e=r+"WebServices/"+e,$.ajax({type:"POST",contentType:"application/json; charset=utf-8",beforeSend:function(e){if("undefined"!=typeof keepAlive&&e.setRequestHeader("keepAlive",keepAlive),1==$("#hdnToken1").length&&void 0!==$("#hdnToken1").val()&&e.setRequestHeader("token1",$("#hdnToken1").val()),1==$("#hdnToken2").length&&void 0!==$("#hdnToken2").val()&&e.setRequestHeader("token2",$("#hdnToken2").val()),"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&e.setRequestHeader("widgetcookievalue",widgetcookievalue);else try{void 0!==window.parent._common&&void 0!==window.parent._common.IsCookieLessWidget&&window.parent._common.IsCookieLessWidget()&&"undefined"!=typeof widgetcookievalue&&null!=widgetcookievalue&&""!=widgetcookievalue&&e.setRequestHeader("widgetcookievalue",widgetcookievalue)}catch(e){}},url:e,data:t,dataType:"json",success:i,error:function(e,t,i){try{if(403===e.status)return alert("Your session is expired. Please reload your page."),void location.reload(!0);""!=a&&null!=a&&null!=a&&"function"==typeof a&&a(e,t,i)}catch(e){}}})}}function fnShowSocialMediaIconInMobiles(){var e=$(".customTopSocial"),t=$(".mobile-social-menu"),i=!1,a=$(".wg-soc-list ul"),r="",o=[{DomainSymbol:"&#xf099;",DomainName:"Twitter",href:0==e.find("#ancTwitter").hasClass("d-none")?e.find("#ancTwitter").prop("href"):null},{DomainSymbol:"&#xf082;",DomainName:"Facebook",href:0==e.find("#ancFacebook").hasClass("d-none")?e.find("#ancFacebook").prop("href"):null},{DomainSymbol:"&#xf167;",DomainName:"Youtube",href:0==e.find("#ancYouTube").hasClass("d-none")?e.find("#ancYouTube").prop("href"):null},{DomainSymbol:"&#xf08c;",DomainName:"Linkedin",href:0==e.find("#ancLinkedIn").hasClass("d-none")?e.find("#ancLinkedIn").prop("href"):null},{DomainSymbol:"&#xf1e9;",DomainName:"Yelp",href:0==e.find("#ancYelp").hasClass("d-none")?e.find("#ancYelp").prop("href"):null},{DomainSymbol:"&#xf37c;",DomainName:"Blog",href:0==e.find("#ancBlog").hasClass("d-none")?e.find("#ancBlog").prop("href"):null},{DomainSymbol:"&#xf0d2;",DomainName:"Pinterest",href:0==e.find("#ancPinterest").hasClass("d-none")?e.find("#ancPinterest").prop("href"):null},{DomainSymbol:"&#xf16d;",DomainName:"Instagram",href:0==e.find("#ancInstagram").hasClass("d-none")?e.find("#ancInstagram").prop("href"):null},{DomainSymbol:"&#xf1a0;",DomainName:"GooglePlus",href:0==e.find("#ancGooglePlus").hasClass("d-none")?e.find("#ancGooglePlus").prop("href"):null},{DomainSymbol:"&#xf1a0;",DomainName:"TikTok",href:0==e.find("#ancTikTok").hasClass("d-none")?e.find("#ancTikTok").prop("href"):null},{DomainSymbol:'<img src="'+cdnImagePath+'/Images/myspace-icon-2x.png" width="24" />',DomainName:"Myspace",href:0==e.find("#ancMyspace").hasClass("d-none")?e.find("#ancMyspace").prop("href"):null}];$.grep(o,function(e,t){void 0!==e.href&&null!=e.href&&(i=!0)}),1==i&&"true"==isCustomWebsite&&"false"==isWidget?($(".social-share-popup .wg-soc-list li").each(function(){$(this).hide()}),$.grep(o,function(e,t){void 0!==e.href&&null!=e.href&&(r+="<li><a href='[!HREF]' target='_blank' class='custom-top-social-lnk'><div class='dl-micon-middle'><span class='dl-soc-icon'>[!DomainSymbol]</span><span>[!DomainName]</span></div></a></li>".replace("[!HREF]",e.href).replace("[!DomainSymbol]",e.DomainSymbol).replace("[!DomainName]",e.DomainName))}),$(a).append(r),$(t).css("display","inline-block")):$(t).hide()}function onOutsideClick(e){try{$(".on-search-LocationSearch").select2("destroy"),$("#txtLocationSearch").select2("destroy")}catch(e){}var t=$(".search-box"),i=$(".search-tab"),a=$(".select2-drop-mask"),r=$(".datepicker"),o=$(".timepicker");$($(e.target).context).hasClass("commonvgdropbutton")||$($(e.target).context).hasClass("bookdropicon")||$($(e.target).context).hasClass("vg-dropdown-link")||!$(".vg-dropdown-parent").is(":visible")||($(".booknowdropdown.vg-dropdown-parent").slideUp(250),$(".booknowdropdown.vg-dropdown-parent").parent().removeClass("active-vg-dropdown"),$(".booknowdropdown.vg-dropdown-parent").removeClass("active-drop-vg")),"divClassDetailTooltippopup"!=$($(e.target).context).parent().attr("id")||$($(e.target).context).hasClass("modal-content")||$("#divClassDetailTooltippopup").modal("hide"),t.is(e.target)||t.has(e.target).length>0||i.is(e.target)||i.has(e.target).length>0||a.is(e.target)||a.has(e.target).length>0||r.is(e.target)||r.has(e.target).length>0||o.is(e.target)||o.has(e.target).length>0||0==$(".bootbox-alert").find(".modal-backdrop").length&&($(".search-box").removeClass("openLeft"),$(".search-tab").removeClass("open-search")),$("#page-wrapper").on("click touchstart",function(e){var t=$("#menuBar"),i=$(".mobile-dropdown");t.is(e.target)||0!==t.has(e.target).length||i.is(e.target)||0!==i.has(e.target).length||_common.CloseToggelmobileMenu()});var n=$(".mobile-share-model:visible"),s=n.find(".mobile-share-popup");n.length>0&&!s.is(e.target)&&0===s.has(e.target).length&&($(".mobile-share-model").is(e.target)&&$(".mobile-share-model").hide(),$("#mobile-check").is(":visible")?n.fadeOut():n.slideUp());var l=$("#durationdropdown");l.is(e.target)||0!==l.has(e.target).length||1!=l.is(":visible")||l.hide();var d=$("#LiveStreamClassList"),c=$("#streamclassdropdown");d.is(e.target)||0!==d.has(e.target).length||1!=c.is(":visible")||c.hide();var u=$("#ulLiveStreamCountryDetail");u.is(e.target)||0!==u.has(e.target).length||1!=u.is(":visible")||u.hide()}function onScrolling(e,t,i){var a=$("#"+e).outerWidth(),r=document.getElementById(e).scrollWidth,o=$("#"+e).scrollLeft();o<=0?($("#"+i).addClass("slide-disabled"),$("#"+i).attr("disabled",!0)):($("#"+i).removeClass("slide-disabled"),$("#"+i).removeAttr("disabled")),o+a>=r?($("#"+t).addClass("slide-disabled"),$("#"+t).attr("disabled",!0)):($("#"+t).removeClass("slide-disabled"),$("#"+t).removeAttr("disabled"))}function ShowHideDoneMessage(e,t,i){void 0!==t&&null!=t&&""!=t&&(void 0!==CommonFromPage&&null!=CommonFromPage&&""!=CommonFromPage||i.getLastModifyLabel(t,!1)),$(".banner-success .text-block-28").html(e);var a=Webflow.require("ix"),r=$(".banner-success");a.run({type:"click",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 200ms ease 0",x:"0px",y:"50px",z:"0px"},{wait:"2s"},{transition:"transform 200 ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]},r)}function ShowHideFailedMessage(e){$(".banner-fail .text-block-28").html(e);var t=Webflow.require("ix"),i=$(".banner-fail");t.run({type:"click",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 200ms ease 0",x:"0px",y:"50px",z:"0px"},{wait:"2s"},{transition:"transform 200 ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]},i)}function trim(e){var t=/^(\s*)$/;return t.test(e)&&0==(e=e.replace(t,"")).length||(t=/^(\s*)([\W\w]*)(\b\s*$)/).test(e)&&(e=e.replace(t,"$2")),e}function isDoubleClicked(e){return!!e.data("isclicked")||(e.data("isclicked",!0),setTimeout(function(){e.removeData("isclicked")},1e3),!1)}function GetSlugTabPageName(e){return e.toLowerCase().replace("/","")}function GetSelectedMenuObject(e){return $("#tabs").find("[data-page-slug='"+e+"']")}function IsVagaroDomain(){return"undefined"!=typeof DomainName&&window.location.host.indexOf(DomainName)>-1}function brandedAppbackButtonClick(){""!=document.referrer?setTimeout("window.history.back()",500):CallbackforMobileApp(0,0,"","",0,1)}function _signInWithApple(e){if(bappIsUndefine(IsIOSBrandedApp)||1!=IsIOSBrandedApp&&"true"!=IsIOSBrandedApp||1!==BrandedAppWithAppleCallback||bappIsUndefine(IsOldOSBrandedApp)||0!=IsOldOSBrandedApp&&"false"!=IsOldOSBrandedApp){if("False"!=recaptch.isCapAllowtoShow()&&recaptch.isCapShown()){if(null==c_responce)return $("#pnlLogin [id*=txtCaptcha]").val(""),$("#pnlLogin [id*=rfvCaptcha]").show(),$("#logInPageValidate [id*=rfvCaptcha]").show(),$(".login-bodyfields").animate({scrollTop:$(".login-bodyfields").height()},500),!1;$("#pnlLogin [id*=txtCaptcha]").val(c_responce),$("#pnlLogin [id*=rfvCaptcha]").hide(),$("#logInPageValidate [id*=rfvCaptcha]").hide()}setCookie("appleLoginSource",e),window.open(window.location.protocol+"//"+window.location.host+"/SignInWithApple.aspx?init=true","_blank","location=yes,height=570,width=650,scrollbars=yes,status=yes")}else{var t=navigator.userAgent,i=t.indexOf("(LogicV");if(i>=0&&(i+=8,t.length>=i)){var a=(t=t.substring(i,t.length)).indexOf(")");if(t.length>a)if(2!=t.substring(0,a))CallbackforMobileApp(0,0,"","",0,38);else{if("False"!=recaptch.isCapAllowtoShow()&&recaptch.isCapShown()){if(null==c_responce)return $("#pnlLogin [id*=txtCaptcha]").val(""),$("#pnlLogin [id*=rfvCaptcha]").show(),$("#logInPageValidate [id*=rfvCaptcha]").show(),$(".login-bodyfields").animate({scrollTop:$(".login-bodyfields").height()},500),!1;$("#pnlLogin [id*=txtCaptcha]").val(c_responce),$("#pnlLogin [id*=rfvCaptcha]").hide(),$("#logInPageValidate [id*=rfvCaptcha]").hide()}setCookie("appleLoginSource",e),window.open(window.location.protocol+"//"+window.location.host+"/SignInWithApple.aspx?init=true","_blank","location=yes,height=570,width=650,scrollbars=yes,status=yes")}}}}function _signInWithAppleResponse(e,t,i,a){if((""==t||""==i)&&""!=a&&null!=a){var r=a.split("@");if(""!=r&&null!=r&&r.length>0){var o=r[0].split(".");""!=o&&null!=o&&o.length>0&&(2==o.length&&(t=o[0],i=o[1]),1==o.length&&(t=o[0]))}}void 0!==i&&null!=i&&""!=i.toString().trim()||(i="?"),"undefined"!=typeof SetLoginValues&&SetLoginValues(),signin(t,i,3,null,a,e,null,5,!1,!0,null,"","","")}function CheckToRedirect(e,t){if(!IsVagaroDefaultMaster){null==_shopdetail.PreviewID&&(_shopdetail.PreviewID=0),chkMultiLocParUndefined();return String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo.objUserCustomData.WidgetServiceId)&&(_siteBuilderDetail.UserLocationInfo.objUserCustomData.WidgetServiceId=0),"true"==_shopdetail.isFacebook||"true"==_shopdetail.isWidget||1==_shopdetail.isPromotion?"?BusinessID="+_shopdetail.businessID+"&IsPopup="+_shopdetail.IsPopup+"&IsFacebookPage="+_shopdetail.isFacebook+"&IsBusinessWidgetPage="+_shopdetail.isWidget+"&TabsIncluded="+_shopdetail.TabsIncluded+"&isPromotion="+_shopdetail.isPromotion+"&b_themeID="+b_themeID+"&IsFromMultiLocation=true&MultiLocBusinessID="+MultiLocBusinessID+"&w_type="+w_type+"&widgetversion="+WidgetVersion+"&tabatlaunch="+_shopdetail.TabAtLaunch+"&WidgetSpId="+_shopdetail.WidgetSpId+"&widgetserviceid="+_siteBuilderDetail.UserLocationInfo.objUserCustomData.WidgetServiceId:parseInt(_shopdetail.PreviewID)>0?"?BusinessID="+_shopdetail.businessID+"&IsPopup="+_shopdetail.IsPopup+"&IsFacebookPage="+_shopdetail.isFacebook+"&IsBusinessWidgetPage="+_shopdetail.isWidget+"&TabsIncluded="+_shopdetail.TabsIncluded+"&isPromotion="+_shopdetail.isPromotion+"&PreviewId="+_shopdetail.PreviewID+"&b_themeID="+b_themeID+"&IsFromMultiLocation=true&MultiLocBusinessID="+MultiLocBusinessID+"&w_type="+w_type+"&widgetversion="+WidgetVersion+"&tabatlaunch="+_shopdetail.TabAtLaunch:parseInt(b_themeID)>0?"?BusinessID="+b_themeID+"&IsFacebookPage="+_shopdetail.isFacebook+"&IsBusinessWidgetPage=true&b_themeID="+b_themeID+"&IsFromMultiLocation=false&MultiLocBusinessID="+MultiLocBusinessID+"&w_type="+w_type+"&TabsIncluded="+_shopdetail.TabsIncluded+"&widgetversion="+WidgetVersion+"&tabatlaunch="+_shopdetail.TabAtLaunch:void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()?"?ig_fbb=true":void 0!==_shopdetail.isFBExtensions&&"true"==_shopdetail.isFBExtensions.toLowerCase()?"?ig_ix=true":""}CheckWidgetSession()}function htmlEnc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")}function htmlEncode(e){return null==e?e:e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")}function vagaroOnlineTokens(e){return 0==e?$("#hdnToken0").val():2==e?$("#hdnToken2").val():void 0}function CallParentFunction(e,t,i){return vagaro.popup({title:i,message:'<div id="dvAgreementPolicy" class="Loader"> <div id="divAgreementloader" class="loadImg"><span class="loaderimage"></span></div><iframe id="iFrameOther" src="'+t+'" width="100%"  frameborder="0"></iframe> </div>',className:"useraggreement-popup"}),$(".useraggreement-popup").modal().find(".modal-header").find(".close").attr("data-dismiss","#dvAgreementPolicy"),1==IsWebsiteBuilderCommunication?$("#iFrameOther").on("load",function(){$(".useraggreement-popup").addClass("in"),$("#divAgreementloader").hide()}):$("#iFrameOther").load(function(){$("#divAgreementloader").hide()}),!1}function ClosePopup(){$(".useraggreement-popup").modal().find(".modal-header").find(".close").click()}function CallParentFunctionUserAgreement(e,t,i){if(vagaro.popup({title:i,message:'<style>div#iFrameOther{height:calc(100vh - 230px);overflow:auto;text-align:left;margin-bottom: 10px;padding-right:0px;}.useraggreement-popup .modal-dialog{max-width:800px;width:95%}.useraggreement-popup p{font-size:14px;line-height:20px;margin-bottom:20px;color:#1f2937cc}.prose :where(p):not(:where([class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.useraggreement-popup h3{color:#696969;font-weight:400;margin-bottom:15px}.useraggreement-popup ul li{font-size:16px;line-height:30px;margin-bottom:4px;margin-top:8px}.prose :where(strong):not(:where([class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(ul>li):not(:where([class~=not-prose] *))::marker{color:#1f293780}.prose :where(h3):not(:where([class~=not-prose] *)){margin-top:1.6em;margin-bottom:.6em}.useraggreement-popup h1{font-size:60px;padding-bottom:24px;display:none}.useraggreement-popup a{color:#2479c7;text-decoration:none}.popupBottompart {min-height: 62px;clear: both; border-radius: 0 0 5px 5px;}.popupBtnBottom{float:right;min-width:200px;margin-right:0px;margin-top:12px}.grayButtonPlain{background:#fff;border-radius:2px;color:#333;border:1px solid rgba(0,0,0,.15);height:40px;font-weight:400;font-size:16px!important;min-width:95px;padding:8px 10px;-webkit-transition:border .2s;transition:border .2s}@media screen and (max-width: 767px){div#iFrameOther {height: 100%;}.popupBottompart {display: none;}}</style ><div id="dvAgreementPolicy" class="Loader"> <div id="divAgreementloader" class="loadImg"><span class="loaderimage"></span></div><div id="iFrameOther"></div></div>',className:"useraggreement-popup useraggreement-vg-popup modal-bootstrapcommon in"}),$(".useraggreement-popup").modal().find(".modal-header").find(".close").attr("data-dismiss","#dvAgreementPolicy"),$(".modal-body").append("<div class='popupBottompart block'><div class='popupBtnBottom'><input type='submit' name='btnClose' value='Close' onclick='ClosePopup();' id='btnClose' class='grayButtonPlain secondary-button' style='float: right!important;'></div></div>"),$("#btnClose").click(function(){$(".useraggreement-popup").modal("hide")}),1==IsWebsiteBuilderCommunication){var a=$("<iframe>",{src:"https://www.vagaro.com/pro/user-agreement",frameborder:0,scrolling:"auto"});$("#iFrameOther").append(a),$(".useraggreement-popup").addClass("in"),$("#divAgreementloader").hide()}else{a=$("<iframe>",{src:"https://www.vagaro.com/pro/user-agreement",frameborder:0,scrolling:"auto"});$("#iFrameOther").append(a),$("#divAgreementloader").hide()}return!1}function CallParentFunctionPrivacyPolicy(e,t,i){if(vagaro.popup({title:i,message:'<style>div#iFrameOther{height:calc(100vh - 230px);overflow:auto;text-align:left;margin-bottom: 10px;padding-right:0px;}.useraggreement-popup .modal-dialog{max-width:800px;width:95%}.useraggreement-popup p{font-size:14px;line-height:20px;margin-bottom:20px;color:#1f2937cc}.prose :where(p):not(:where([class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.useraggreement-popup h3{color:#696969;font-weight:400;margin-bottom:15px}.useraggreement-popup ul li{font-size:16px;line-height:30px;margin-bottom:4px;margin-top:8px}.prose :where(strong):not(:where([class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(ul>li):not(:where([class~=not-prose] *))::marker{color:#1f293780}.prose :where(h3):not(:where([class~=not-prose] *)){margin-top:1.6em;margin-bottom:.6em}.useraggreement-popup h1{font-size:60px;padding-bottom:24px;display:none}.useraggreement-popup a{color:#2479c7;text-decoration:none}.popupBottompart {min-height: 62px;clear: both; border-radius: 0 0 5px 5px;}.popupBtnBottom{float:right;min-width:200px;margin-right:0px;margin-top:12px}.grayButtonPlain{background:#fff;border-radius:2px;color:#333;border:1px solid rgba(0,0,0,.15);height:40px;font-weight:400;font-size:16px!important;min-width:95px;padding:8px 10px;-webkit-transition:border .2s;transition:border .2s}@media screen and (max-width: 767px){div#iFrameOther {height: 100%;}.popupBottompart {display: none;}}</style ><div id="dvAgreementPolicy" class="Loader"> <div id="divAgreementloader" class="loadImg"><span class="loaderimage"></span></div><div id="iFrameOther"></div></div>',className:"useraggreement-popup useraggreement-vg-popup modal-bootstrapcommon in"}),$(".useraggreement-popup").modal().find(".modal-header").find(".close").attr("data-dismiss","#dvAgreementPolicy"),$(".modal-body").append("<div class='popupBottompart block'><div class='popupBtnBottom'><input type='submit' name='btnClose' value='Close' onclick='ClosePopup();' id='btnClose' class='grayButtonPlain secondary-button' style='float: right!important;'></div></div>"),$("#btnClose").click(function(){$(".useraggreement-popup").modal("hide")}),1==IsWebsiteBuilderCommunication){var a=$("<iframe>",{src:"https://www.vagaro.com/pro/privacy",frameborder:0,scrolling:"auto"});$("#iFrameOther").append(a),$(".useraggreement-popup").addClass("in"),$("#divAgreementloader").hide()}else{a=$("<iframe>",{src:"https://www.vagaro.com/pro/privacy",frameborder:0,scrolling:"auto"});$("#iFrameOther").append(a),$("#divAgreementloader").hide()}return!1}function HidePrivacyPolicy(){$(".useraggreement-popup").modal("hide"),$("#dvRegister").modal("show"),1!=IsWebsiteBuilderCommunication&&($("html").addClass("signuppopopenHtml"),$("body").addClass("signuppopopen signupiframe"))}function RedirecttoApp(e,t){var i="";if(void 0!==redirecttodevicetabname&&""!=redirecttodevicetabname&&("book-now"==redirecttodevicetabname&&(redirecttodevicetabname="online-scheduling"),i="&tab="+redirecttodevicetabname,"online-scheduling"!=redirecttodevicetabname||isNaN(+microServiceID)||0==microServiceID||(i+="&serviceid="+microServiceID+"&Device=Google")),0==selectedShopId){var a=!1,r=$(location).attr("href");$(location).attr("pathname").replace("/","");if(-1!=r.indexOf("/listings")?(i+="&tab=salons",a=!0):-1!=r.indexOf("/deals")?(i+="&tab=salon-coupons",a=!0):-1!=r.indexOf("/book")&&(i+="&tab=salon-appointment",a=!0),1==a){var o=_common.SetCityState(city,stateName);""!=o&&(i+="&Location="+o),""!=lattitude&&""!=longitude&&(i+="&LatLng="+lattitude+","+longitude),""!=countryid&&"0"!=countryid&&(i+="&CID="+countryid),-1!=r.indexOf("/book")&&""!=escape(service)&&(i+="&ServiceName="+escape(service.replace(/ /g,"")))}}i=i.replace(/ /g,""),"Android"==e?(setTimeout(function(){window.location=""!=i?selectedShopId>0?"VagaroApp:///BusinessId="+selectedShopId+i:"VagaroApp:///"+i.substring(1):"VagaroApp:///BusinessId="+selectedShopId},25),void 0!==t&&""!=t||("undefined"!=typeof w_type&&"1"==w_type?window.open("https://play.google.com/store/apps/details?id=com.vagaro","_blank"):window.location.href="https://play.google.com/store/apps/details?id=com.vagaro")):(null!=t&&"undefined"!=t&&""!=t||setTimeout(function(){"undefined"!=typeof w_type&&"1"==w_type?window.open("https://itunes.apple.com/us/app/vagaro/id536110000?mt=8i","_blank"):window.location.href="https://itunes.apple.com/us/app/vagaro/id536110000?mt=8i"},25),""!=i?selectedShopId>0?null!=navigator&&null!=navigator.userAgent&&navigator.userAgent.toLowerCase().indexOf("vagaroapp")>-1?window.location="js-call:myObjectiveCFunction:1001|~|VagaroApp:///BusinessId="+selectedShopId+encodeURIComponent(i):openApp("VagaroApp:///BusinessId="+selectedShopId+i):null!=navigator&&null!=navigator.userAgent&&navigator.userAgent.toLowerCase().indexOf("vagaroapp")>-1?window.location="js-call:myObjectiveCFunction:1001|~|VagaroApp:///"+encodeURIComponent(i.substring(1)):openApp("VagaroApp:///"+i.substring(1)):null!=navigator&&null!=navigator.userAgent&&navigator.userAgent.toLowerCase().indexOf("vagaroapp")>-1?window.location="js-call:myObjectiveCFunction:1001|~|VagaroApp:///BusinessId="+selectedShopId:openApp("VagaroApp:///BusinessId="+selectedShopId))}function RedirecttoAppNew(e,t){var i="";if(void 0!==redirecttodevicetabname&&""!==redirecttodevicetabname){var a=redirecttodevicetabname;"book-now"===a&&(a="online-scheduling"),i="&tab="+a,"online-scheduling"!==a||isNaN(+microServiceID)||0==microServiceID||(i+="&serviceid="+microServiceID+"&Device=Google")}if(0==selectedShopId){var r=!1,o=window.location.href;if(-1!==o.indexOf("/listings")?(i+="&tab=salons",r=!0):-1!==o.indexOf("/deals")?(i+="&tab=salon-coupons",r=!0):-1!==o.indexOf("/book")&&(i+="&tab=salon-appointment",r=!0),r){var n=_common.SetCityState(city,stateName);""!==n&&(i+="&Location="+n),""!==lattitude&&""!==longitude&&(i+="&LatLng="+lattitude+","+longitude),""!==countryid&&"0"!=countryid&&(i+="&CID="+countryid),-1!==o.indexOf("/book")&&void 0!==service&&""!==escape(service)&&(i+="&ServiceName="+escape(service.replace(/ /g,"")))}}i=i.replace(/ /g,"");var s="";if(s=selectedShopId>0?"VagaroApp:///BusinessId="+selectedShopId+i:""!==i?"VagaroApp:///"+i.substring(1):"VagaroApp:///BusinessId="+selectedShopId,"Android"===e)return void 0!==t&&""!==t?void(window.location.href=s):(window.location.href=s,void setTimeout(function(){"visible"===document.visibilityState&&("undefined"!=typeof w_type&&"1"==w_type?window.open("https://play.google.com/store/apps/details?id=com.vagaro","_blank"):window.location.href="https://play.google.com/store/apps/details?id=com.vagaro")},1500));navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().indexOf("vagaroapp")>-1?window.location="js-call:myObjectiveCFunction:1001|~|"+encodeURIComponent(s):(window.location.href=s,void 0!==t&&""!==t||setTimeout(function(){"visible"===document.visibilityState&&("undefined"!=typeof w_type&&"1"==w_type?window.open("https://itunes.apple.com/us/app/vagaro/id536110000?mt=8i","_blank"):window.location.href="https://itunes.apple.com/us/app/vagaro/id536110000?mt=8i")},1500))}function openApp(e){$("<iframe />").attr("src",e).attr("style","display:none;").appendTo("body")}function ClassSignupPublic(e,t,i){ShowLoader(!0),$("#divApplyisPointApply").hide(),$("#divApplyDailyDeal").hide(),$("#divApplyGC").hide(),$("#divOuterApplyPkg").hide(),$("#divApplyisMembershipApply").hide(),"undefined"!=typeof groupID&&(groupID=void 0);var a=null;if(void 0!==$("#tr"+e).data("data-value")&&null==(a=JSON.parse($("#tr"+e).data("data-value"))).objEventDetails&&(a=null),null!=a&&null!=a.objEventDetails&&0!=a.objEventDetails.LoginUserID&&""!==a.objEventDetails.LoginUserID)ShowLoader(!1),ClassSignupPublicSuccess(a,i,!1);else{var r={};r.AppointmentID=e,r.loginUserID=UserID,r.businessID=t;var o=new vagaro.ajax;o.datamodel.Token=ApiURLEnumOnlineCommon.geteventdetails,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.data=r,o.datamodel.callback=function(t){ShowLoader(!1),null!=t&&1==t.UnderMaintanance?vagaro.alert({message:"Business is under maintenance. This won't take long",title:"info"}):null!=t&&($("#tr"+e).data("data-value",JSON.stringify(t)),$("#tr"+e).data("data-valueTime",new Date),ClassSignupPublicSuccess(t,i,!0))},o.datamodel.Error=function(e){console.log(e),ShowLoader(!1)},o.Post()}}function ClassSignupPublicSuccess(e,t,i){if(null!=e.objEventDetails){var a=e.objEventDetails;try{var r={},o="";r.PageName="Home",o=1==a.IsEnrolled?a.DurationRemainMin>5||a.EventDurationRemainMin<-5?"You're Signed Up":"Join Now":a.EventDurationRemainMin<6?"Join Now":"Sign Up",r.Action=o,r.ClassPrice="Free"==a.StreamingSellPrice?0:a.StreamingSellPrice,r.Category="Live Stream",r.BusinessName=a.BusinessName,r.BusinessID=a.BusinessID,r.ClassName=a.ServiceTitle;var n=a.StrStartTime.split("/"),s=n[2].split(" ");r.ClassStartDate=n[0]+"-"+n[1]+"-"+s[0],r.ClassTime=a.StrStartTime.toString().split(" ")[1]+" "+a.StrStartTime.toString().split(" ")[2],r.ClassDuration=a.Duration+" mins",r.ClassBy=a.FirstName,_vgLogEvent.LogData(r)}catch(e){}if(0==i){var l=$("#tr"+a.AppointmentID).data("data-valueTime");DateDiff=getDateDiff(l,new Date,!0),a.EventDurationRemain=a.EventDurationRemain-DateDiff}if(8==a.AppStatus||12==a.AppStatus)return void vagaro.alert({message:"This class not available for booking, Class is cancel or delete by business. ",title:"Class Not Available"});if(a.EventDurationRemain<-5)return void vagaro.alert({message:"This class is already live.",title:"Class Not Available"});var d=a.IsWorkShop?a.StreamingSellPrice:_vgClassSessionSelection.CalcSessionPrice(a.SessionDetail,1,1,!0,!0);$("#PopupEventPrice").html(BindEventPrice($("#tr"+a.AppointmentID).attr("data-countryid"),d)),_publicEvent=e,UserID>0&&1!=t&&1!=a.IsEnrolled&&_vgClassSessionSelection.GetEventCartDetail_ShowDiscountPublic(),0!=a.LoginUserID&&(ZoomURL=a.ZoomURL);var c="undefined"!=typeof vgAppicationType&&1==vgAppicationType?_common.GetAppVersion():null;if(null!=c&&c>=381&&null!=navigator.userAgent&&navigator.userAgent.indexOf("com.vagaro.customerios")>-1?$("#live-stream-classes-popup .enroll-visits").attr("onclick","javascript:CallbackforMobileApp(0, 0, '', '', '0', '38|~|"+ZoomURL+"');"):$("#live-stream-classes-popup .enroll-visits").attr("href",ZoomURL),1==t&&1==a.IsEnrolled)a.EventDurationRemain<6&&a.EventDurationRemain>-5&&$("#live-stream-classes-popup .enroll-visits")[0].click(),$("#live-stream-classes-popup .signup-enroll").hide(),$("#live-stream-classes-popup .signup-enroll-done").show(),a.EventDurationRemain>5||a.EventDurationRemain<-5?($("#signupViewmyclasses").removeAttr("href").removeAttr("target").removeAttr("onclick"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType?$("#signupViewmyclasses").on("click",function(){CallbackforMobileApp(0,0,"","",0,12)}):$("#signupViewmyclasses").attr("href","/myaccount/appointments").attr("target","_blank"),$("#live-stream-classes-popup .enroll-view").show(),$("#divJoinNow").hide()):($("#live-stream-classes-popup .enroll-view").hide(),$("#divJoinNow").show());else{$("#PopupServicePhoto").hide(),$("#live-stream-classes-popup").addClass("noclassImg"),String.isNullOrUndefineOrBlank(a.ServicePhoto)||($("#PopupServicePhoto").show(),$("#live-stream-classes-popup").removeClass("noclassImg"),$("#PopupServicePhoto").attr("data-original",a.ServicePhoto).addClass("lazylivestreamserviceimg"),$(".lazylivestreamserviceimg").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:ServiceImageError(),isShowIntials:!1,intial_selecter:""}).trigger("lazyload"),imageExists(a.ServicePhoto,function(e){0==e&&$("#live-stream-classes-popup").addClass("noclassImg")})),$("#PopupServiceProviderInitial").html(FindInitials(a.ServiceProviderName,"")),$("#PopupServiceProviderPhoto").attr("data-original",a.SpPhoto).addClass("lazylivestreamimg"),$(".lazylivestreamimg").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".initialspusername"}).trigger("lazyload"),$("#PopupReviewCount").html("<span aria-hidden='true'>("+a.ReviewCount+")</span>").attr("aria-label",Math.round(a.ReviewRank)+" star ratting having total "+a.ReviewCount+" reviews.").attr("role","banner");var u,p=null!=a.ReviewCount?Number(a.ReviewCount):0,h=1===p?"Review":"Reviews",m=parseFloat(a.ReviewRank),f=isNaN(m)?"0.0":m.toFixed(1);$("#PopupReviewCount").html("<span aria-hidden='true'>"+f+" ("+p+" "+h+")</span>").attr("aria-label",f+" star rating having total "+p+" "+h+".").attr("role","banner"),u="undefined"!=typeof vgAppicationType&&1==vgAppicationType?"<a id='signup-businessname' class='web-body-font-blue' href='/"+a.VagaroURL+"'>":"<a id='signup-businessname' class='web-body-font-blue' href='/"+a.VagaroURL+"' target='_blank'>",$("#PopupBusinessName").html(u+a.BusinessName+" in "+a.City+", "+a.StateCode+"</a>"),$("#PopupClassName").html(a.ServiceTitle),$("#PopupServiceProvider").html(a.ServiceProviderName);var g=a.IsDayLight;if(void 0!==$("#tr"+a.AppointmentID).attr("data-appointmentstarttime")){var v=new Date($("#tr"+a.AppointmentID).attr("data-appointmentstarttime").replace(/(\d{2})-(\d{2})-(\d{4})/,"$2/$1/$3"));v=countryDateFormat(moment(v),VagaroCountryDateFormat.LargeDateWithTime),$("#PopupClassDate").html(v+" ("+GetTimeZoneIDFromCookies(1,g)+")")}if($("#PopupClassDuration").html(a.EventDuration).attr("aria-label",a.EventDuration.indexOf("hr")>=0?a.EventDuration.replace("hr","hour"):a.EventDuration.replace("min","minute")),a.ReviewRank>0){var A=(100*a.ReviewRank/5).toFixed(2)+"%";$("#dvSPRatingStart").css("width",A)}else $("#dvSPRatingStart").css("width","0%");if($("#PopupClassDescMain").hide(),String.isNullOrUndefineOrBlank(a.ServiceDesc)||($("#PopupClassDesc").html(a.ServiceDesc),$("#PopupClassDescMain").show()),1==a.IsEnrolled?($("#live-stream-classes-popup .signup-enroll").hide(),$("#live-stream-classes-popup .signup-enroll-done").show(),a.EventDurationRemain>5||a.EventDurationRemain<-5?($("#signupViewmyclasses").removeAttr("href").removeAttr("target").removeAttr("onclick"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType?$("#signupViewmyclasses").on("click",function(){CallbackforMobileApp(0,0,"","",0,12)}):$("#signupViewmyclasses").attr("href","/myaccount/appointments").attr("target","_blank"),$("#live-stream-classes-popup .enroll-view").show(),$("#divJoinNow").hide()):($("#live-stream-classes-popup .enroll-view").hide(),$("#divJoinNow").show())):($("#PopupBtnSignUp").data("appID",a.AppointmentID),$("#PopupBtnSignUp").data("busID",a.BusinessID),$("#PopupBtnSignUp").removeClass("btn-flamigo flamingo-button").removeClass("btn-purchase"),a.EventDurationRemain>5?$("#PopupBtnSignUp").html('Sign Up <span class="mobile-event-price"> - '+$("#PopupEventPrice").html()+"</span>").addClass("btn-purchase"):$("#PopupBtnSignUp").html('Join Now <span class="mobile-event-price"> - '+$("#PopupEventPrice").html()+"</span>").addClass("btn-flamigo flamingo-button"),$("#live-stream-classes-popup .signup-enroll").show(),$("#live-stream-classes-popup .signup-enroll-done").hide()),1==a.IsWorkShop&&null!=e.lstEventAvailableDate){var C=_vgClassSessionSelection.GetWorkshopDates(e.lstEventAvailableDate);$("#live-stream-classes-popup .WorkshopDateDetails").show(),$("#live-stream-classes-popup .WorkshopDateDetails-Desc").html(C);var y=e.objWorkshopvalidateData;null==y?vagaro.alert({message:"This workshop started. Workshops are a series of sessions that must be attended from the beginning.",title:"Workshop in Progress"}):y.IsFirstDate?1==t&&0==a.IsEnrolled?0==a.IsLimitOnlineBooking?AddEventFromPublic():LiveStreamSignUpWithLimitOnlineBooking(a):$("#live-stream-classes-popup").modal("show"):null==y.FutureStartDate?vagaro.alert({message:"This workshop started on "+moment(new Date(y.strCurrentStartDate.replace(new RegExp("-","g")," "))).format("MMM DD, YYYY").replace(/ 0+/g," ")+". Workshops are a series of sessions that must be attended from the beginning.",title:"Workshop in Progress"}):"undefined"!=typeof bootbox&&bootbox.confirm({title:"Workshop in Progress",message:"This workshop started on "+moment(new Date(y.strCurrentStartDate.replace(new RegExp("-","g")," "))).format("MMM DD, YYYY").replace(/ 0+/g," ")+". Workshops are a series of sessions that must be attended from the beginning. Would you like to join the next workshop on "+moment(new Date(y.strFutureStartDate.replace(new RegExp("-","g")," "))).format("MMM DD, YYYY").replace(/ 0+/g," ")+"?",buttons:{cancel:{label:"Cancel"},confirm:{label:"Continue"}},callback:function(e){e&&(1==t&&0==a.IsEnrolled?0==a.IsLimitOnlineBooking?AddEventFromPublic():LiveStreamSignUpWithLimitOnlineBooking(a):$("#live-stream-classes-popup").modal("show"))}})}else $("#live-stream-classes-popup .WorkshopDateDetails").hide(),1==t&&0==a.IsEnrolled?0==a.IsLimitOnlineBooking?AddEventFromPublic():LiveStreamSignUpWithLimitOnlineBooking(a):$("#live-stream-classes-popup").modal("show");$("#live-stream-classes-popup .modal-body").animate({scrollTop:0},500)}}}function LiveStreamSignUpWithLimitOnlineBooking(e){if(2==e.IsRedirectToCheckOut){if(null!=e&&void 0!==e.VagaroURL&&null!=e.VagaroURL){var t={},i=e.SessionDetail.split(","),a=1,r=0;return i.length>0&&(a=parseInt(i[0].split("-")[1]),r=i[0].split("-")[3]),t.BusinessID=e.BusinessID,t.AppointmentID=e.AppointmentID,t.Session=a,t.Amount=r,t.ServiceID=e.ServiceID,t.ServiceProviderID=e.ServiceProviderID,t.StrStartTime=e.StrStartTime,setCookie("LiveStreamSignUp",t),void(window.location.href=e.VagaroURL+"/classes")}}else if(1==e.IsRedirectToCheckOut)return void vagaro.alert({message:"Live stream sign up is not possible for this class as logged in user or friends/family are not existing customers. ",title:"Live Stream Sign Up"})}function ServiceImageError(){$("#PopupServicePhoto").hide()}function imageExists(e,t){var i=new Image;i.onload=function(){t(!0)},i.onerror=function(){t(!1)},i.src=e}function AddEventFromPublic(e,t){if(UserID>0&&void 0!==e&&void 0!==t){var i=$(e.currentTarget).data("appID");if(null!=i){var a=$("#tr"+i).data("data-value"),r=JSON.parse(a);if(null!=r.objEventDetails&&1==r.objEventDetails.IsLimitOnlineBooking)return void LiveStreamSignUpWithLimitOnlineBooking(r.objEventDetails)}}if(UserID>0){var o=!1;void 0!==t&&null!=t&&(o=t),_vgClassSessionSelection.ClassAddToCartPublic(o)}else ClassSignupPublicButton(e,$("#PopupBtnSignUp").data("appID"),$("#PopupBtnSignUp").data("busID"),$("#PopupBtnSignUp").data("ServiceName"))}function ClassSignupPublicButton(e,t,i){if(e.stopPropagation(),e.preventDefault(),objLiveStreamSignupPublic={},objLiveStreamSignupPublic.appID=t,objLiveStreamSignupPublic.busID=i,!(UserID>0))return window.location.href.indexOf(_common.liveStreamClasses)>0?_common.AddState(_common.liveStreamClasses):_common.AddState("home"),showCommonLoginPopup("LiveStreamEventAddToCart"),!1;ClassSignupPublic(t,i,!0)}function AddLogEventDataInFirebase(e){IsGallerySp=!1,IsGallerywithsp=!1;var t=!0;null!=e.IsFiltered&&void 0!==e.IsFiltered&&"undefined"!=typeof isDealFilterApplied&&null!=isDealFilterApplied&&(e.IsFiltered=isDealFilterApplied),null!=e.IsFromBusinessDetailPage&&void 0!==e.IsFromBusinessDetailPage&&e.IsFromBusinessDetailPage&&IsServiceTab&&IsClassTab&&(t=!1),t&&_vgLogEvent.LogEventData(e)}function upcomingSlider(){$("#divUpcomingApptMnts").slick({infinite:!1,speed:600,slidesToShow:4,leftMode:!0,variableWidth:!0,responsive:[{breakpoint:1679,settings:{slidesToShow:3,slidesToScroll:1}},{breakpoint:1200,settings:{slidesToShow:2,slidesToScroll:1}},{breakpoint:767,settings:{slidesToShow:2,slidesToScroll:1}},{breakpoint:660,settings:{slidesToShow:1,slidesToScroll:1,arrows:!1}}]})}function upcomingSlider_mobile(){var e=$(window).width();setTimeout(function(){e<=767?$("#divUpcomingApptMnts").unslick():e>=767&&upcomingSlider()},60)}function ShowHideDoneMessageCommon(e,t){void 0!==t&&""!=t||(t=4e3),$(".banner-success-master .text-block-28").html(e),$(".banner-success-master").addClass("showmsgTop"),setTimeout(function(){$(".banner-success-master").removeClass("showmsgTop")},t)}function ShowHideWarningMessageCommon(e,t){void 0!==t&&""!=t||(t=4e3),$(".banner-warning-master .text-block-28").html(e),$(".banner-warning-master").addClass("showmsgTop"),setTimeout(function(){$(".banner-warning-master").removeClass("showmsgTop")},t)}function ShowHideFailedMessageCommon(e,t){void 0!==t&&""!=t||(t=4e3),$(".banner-fail-master .text-block-28").html(e),$(".banner-fail-master").addClass("showmsgTop"),setTimeout(function(){$(".banner-fail-master").removeClass("showmsgTop")},t)}function SaveReviewCommon(){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.SaveReview():_siteBuilderDetail.saveReview()}function EmptyStarCommon(e){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.Emptystar(e):_siteBuilderDetail.emptystar(e)}function FillStarCommon(e){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.Fillstar(e):_siteBuilderDetail.fillstar(e)}function ClickStarCommon(e){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.Clickstar(e):_siteBuilderDetail.clickstar(e),$("#imgReviewBusinessLogo").removeAttr("tabindex"),$(e).attr("tabindex","0"),$(e).focus(),$.grep($(e).parent("div").find("div").siblings("div.rating-symbol.glyphicon-star-empty.glyphicon"),function(e,t){var i=$(e).parent("div").find("div").siblings(".selected").length,a=t+1;i<a?$(e).attr("aria-label",a+" Star").attr("aria-live","polite"):$(e).attr("aria-label",i+" out of 5 stars Selected").attr("aria-live","polite")})}function DeleteReviewImageCommon(e){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.DeleteReviewImage(e):_siteBuilderDetail.DeleteReviewImage(e)}function CloseReviewPopupCommon(){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.AttendeeCloseButton():_siteBuilderDetail.CloseReviewPopup(),$("#imgReviewBusinessLogo").removeAttr("tabindex"),$("#divSelect2Parent").removeAttr("tabindex")}function KeyUpCommon(e){"undefined"!=typeof _vgLiveStreamReview?_vgLiveStreamReview.keyup(e):_siteBuilderDetail.keyup(e)}function FocusPolicy(e){try{document.getElementById("iFrameSignUp")&&void 0!==document.getElementById("iFrameSignUp").contentWindow.focusPolicy&&document.getElementById("iFrameSignUp").contentWindow.focusPolicy(e)}catch(e){}}togglesearchmodeforselection=function(e,t,i){var a=businessSearchModeForSelection.indexOf(e);try{"undefined"!=typeof _ServiceData&&null!=_ServiceData&&"undefined"!=_ServiceData.VagaroServiceIDs&&null!=_ServiceData.VagaroServiceIDs&&""!=_ServiceData.VagaroServiceIDs&&(_ServiceData.VagaroServiceIDs="")}catch(e){}if(-1==a?(businessSearchModeForSelection=[0,e],void 0===i||1!=i||e!=searchFilterEnum.LiveStream||void 0===tabSegment||"class"!=tabSegment&&"listings"!=tabSegment&&"book"!=tabSegment?$("body").removeClass("livestreampage"):$("body").hasClass("livestreampage")||($("body").addClass("livestreampage"),LoadLiveStreamPage())):0!=e&&($(t).removeClass("active").attr("aria-checked",!1),businessSearchModeForSelection.splice(a,1),void 0!==i&&1==i&&e==searchFilterEnum.LiveStream&&"book"!=tabSegment&&window.history.go(-1)),3==e){if(0!=$(".listigBusiness-wrapper").find(".liststream-filter-top").length)return!1;if($(".listigBusiness-wrapper").append('<div id="listStreamFilterId" class="liststream-filter-top" style="" role="none" runat="server"><div class="livestreamfilter" role="none"><div class="pos-relative marginleft20" role="none"><div id="dvDurationText" class="white-roundbox duration-text font-awesome-5pro-light filter-button filter-button-icon" aria-label="Duration combobox" aria-controls="ul_durationdropdown" aria-live="polite"><span class="font-awesome-5pro-light bookmark-text14" aria-hidden="true">&#xf017;</span></div><div class="dropdown-class-stream positionLeft vagaro-dropdown-multiselect" id="durationdropdown" role="none"><ul id="ul_durationdropdown" role="listbox"><li aria-label="Less than 30 minutes"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="1" id="Lessthan30min"><label for="Lessthan30min" role="checkbox" aria-live="polite" aria-checked="false">Less than 30 minutes</label></div></li><li aria-label="30 min"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="2" id="30min"><label for="30min" role="checkbox" aria-live="polite" aria-checked="false">30 min</label></div></li><li aria-label="1 hour"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="3" id="1hour"><label for="1hour" role="checkbox" aria-live="polite" aria-checked="false">1 hour</label></div></li><li aria-label="1+ hours"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="4" id="1+hours"><label for="1+hours" role="checkbox" aria-live="polite" aria-checked="false">1+ hours</label></div></li></ul></div></div><div class="marginleft20"><div class="white-roundbox LiveStreamBookmarkClass filter-button filter-button-icon" id="LiveStreamBookmark" aria-label="Live Stream Bookmark Class" aria-live="polite" role="link"><span class="font-awesome-5pro-light bookmark-text14" aria-hidden="true">&#xf02e;</span></div></div></div><div class="prof-right-padding streamfilterclass"><div class="filteradded" id="divStreamListingFilters"><div id="divStreamFirstSlide" class="w-inline-block" aria-hidden="true">&nbsp;</div><a href="javascript:void(0);" onclick="SearviceFilter(this,1)" id="LiveStreamyoga" data-livestreamid="1" data-livestream="yoga" class="LiveStreamYoga fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Yoga</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,2)" id="LiveStreampilates" data-livestreamid="2" data-livestream="pilates" class="LiveStreamPilates fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro pilates" aria-hidden="true"></span>Pilates</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,3)" id="LiveStreamcardio" data-livestreamid="3" data-livestream="cardio" class="LiveStreamCrossfit fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Cardio</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,4)" id="LiveStreamcycling" data-livestreamid="4" data-livestream="cycling" class="LiveStreamCycle fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Cycling</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,5)" id="LiveStreamstrength" data-livestreamid="5" data-livestream="strength" class="LiveStreamStrength fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Strength</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,6)" id="LiveStreambootcamp" data-livestreamid="6" data-livestream="bootcamp" class="LiveStreamCrossfit fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Boot Camp</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,7)" id="LiveStreammartialarts" data-livestreamid="7" data-livestream="martialarts" class="LiveStreamStrength fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Martial Arts</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,8)" id="LiveStreamboxing" data-livestreamid="8" data-livestream="boxing" class="LiveStreamBoxing fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Boxing</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,9)" id="LiveStreamdance" data-livestreamid="9" data-livestream="dance" class="LiveStreamBoxing fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Dance</div></a><div id="divStreamLastSlide" class="w-inline-block" style="">&nbsp;</div></div><div class="font-awesome left-slide-arrow" id="divStreamPrevFilter" onclick=\'_common.nextPreviousFilters("divStreamListingFilters",0,"divStreamNextFilter","divStreamPrevFilter")\'><span>&#xf104;</span></div><div class="font-awesome right-slide-arrow" id="divStreamNextFilter" onclick=\'_common.nextPreviousFilters("divStreamListingFilters",1,"divStreamNextFilter","divStreamPrevFilter")\'><span>&#xf105;</span></div></div><div class="dropdown-stream"><div class="pos-relative"><div class="dropdown-stream-div stream-more filter-button" aria-label="more combobox" aria-controls="LiveStreamClassList"><span class="font-awesome-light-pro margin-right4"></span><span aria-hidden="true">More</span><span class="font-awesome-solid-pro margin-left4" aria-hidden="true"></span></div><div class="dropdown-class-stream default-scrollbar vagaro-dropdown-share-content" id="streamclassdropdown" role="none"><ul class="share-content-ul" id="LiveStreamClassList" role="listbox"><li class="LiveStreamClassListCss p-0"><a href="javascript:void(0);" onclick="SearviceFilter(this,1)" id="liLiveStreamyoga" data-livestreamid="1" data-livestream="yoga" class="LiveStreamYoga w-inline-block" role="option" aria-label="Yoga"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Yoga</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,2)" id="liLiveStreampilates" data-livestreamid="2" data-livestream="pilates" class="LiveStreamPilates w-inline-block" role="option" aria-label="Pilates"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro pilates"></span>Pilates</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,3)" id="liLiveStreamcardio" data-livestreamid="3" data-livestream="cardio" class="LiveStreamCrossfit w-inline-block" role="option" aria-label="Cardio"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Cardio</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,4)" id="liLiveStreamcycling" data-livestreamid="4" data-livestream="cycling" class="LiveStreamCycle w-inline-block" aria-label="Cycling"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Cycling</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,5)" id="liLiveStreamstrength" data-livestreamid="5" data-livestream="strength" class="LiveStreamStrength w-inline-block" aria-label="Strength"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Strength</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,6)" id="liLiveStreambootcamp" data-livestreamid="6" data-livestream="bootcamp" class="LiveStreamCrossfit w-inline-block" aria-label="Boot Camp"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Boot Camp</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,7)" id="liLiveStreammartialarts" data-livestreamid="7" data-livestream="martialarts" class="LiveStreamStrength w-inline-block" aria-label="Martial Arts"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Martial Arts</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,8)" id="liLiveStreamboxing" data-livestreamid="8" data-livestream="boxing" class="LiveStreamBoxing w-inline-block" aria-label="Boxing"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Boxing</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,9)" id="liLiveStreamdance" data-livestreamid="9" data-livestream="dance" class="LiveStreamBoxing w-inline-block" aria-label="Dance"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Dance</div></a></li></ul><ul id="streamclassdropdownlist" style="display : none"><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Gyrontonic" id="Gyrontonic"><label for="Gyrontonic">Gyrontonic</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Gyrokinesis" id="Gyrokinesis"><label for="Gyrokinesis">Gyrokinesis</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Aerobics" id="Aerobics"><label for="Aerobics">Aerobics</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Zumba" id="Zumba"><label for="Zumba">Zumba</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Spinning" id="Spinning"><label for="Spinning">Cycle / Spinning</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Step Classes" id="StepClasses"><label for="StepClasses">Step Classes</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Weight Training" id="WeightTraining"><label for="WeightTraining">Weight Training</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Strength Training" id="StrengthTraining"><label for="StrengthTraining">Strength Training</label></div></li></ul><script id="StreamClassDropdownTemplate" type="text/x-jQuery-tmpl"><li><div><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" name="StreamClassDropdownCheckbox" value="${HSBusinessTypeId}" data-hsbusinesstype="${HSBusinessType}" id="${HeroSliderID}"><label for="${HeroSliderID}">${PopularCategoryName}</label></div></div></li><\/script><script id="StreamClassCategoryDropdownTemplate" type="text/x-jQuery-tmpl"><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="javascript:SearviceFilter(this);" id="${ServiceId}">${CategoryName}</a></li><\/script></div></div></div></div>'),$(".LiveStreamBookmarkClass").on("click",function(e){ManagaBusinessBookmark(this)}),$(".stream-more").on("click",function(){$("#streamclassdropdown").slideToggle("600"),$(window).width()<767&&$(this).closest(".livestreampage").find(".mobile-classmore-links").toggle()}),$(".duration-text").on("click",function(){$("#durationdropdown").slideToggle("600")}),_gblLiveStreamSearchServiceId.length>0||_gblLiveStreamSearchServiceId>0)for(var r in _gblLiveStreamSearchServiceId=_gblLiveStreamSearchServiceId.toString(),_gblLiveStreamSearchServiceId){t=parseInt(_gblLiveStreamSearchServiceId[r]);$("#divStreamListingFilters a").each(function(){$(this).data("livestreamid")===t&&$(this).addClass("selected")}),$("#LiveStreamClassList li a").each(function(){$(this).data("livestreamid")===t&&$(this.parentElement).addClass("active")})}setCategoryWidthheight()}else $(".listigBusiness-wrapper").find(".liststream-filter-top").length>0&&$(".listigBusiness-wrapper").find(".liststream-filter-top").remove();return!1},togglebusinesssearch=function(e){var t,i,a,r=service;if(void 0!==r&&""!=r){var o=AdminServiceList.results;if(o&&o.length>0){var n=findObjectBytext(o,r);urlService=null!=n?n.url:service}}if($("#aBusinessTab").removeClass("active"),$("#aMobileTab").removeClass("active"),$("#aStreamTab").removeClass("active"),$("#aBusinessTab").removeClass("vg-filter-mobile-tab"),$("#aMobileTab").removeClass("vg-filter-mobile-tab"),$("#aStreamTab").removeClass("vg-filter-mobile-tab"),$(".business-toggle").removeClass("w--current"),$(".mobile-toggle").removeClass("w--current"),$(".stream-toggle").removeClass("w--current"),$("#aBusinessTab").removeClass("w--current"),$("#aMobileTab").removeClass("w--current"),$("#aStreamTab").removeClass("w--current"),$("#btnLiveStream").removeClass("w--current"),$("#btnLiveStreamMobile").removeClass("w--current"),$(".business-toggle").removeClass("active").attr("aria-checked",!1),$(".mobile-toggle").removeClass("active").attr("aria-checked",!1),$(".stream-toggle").removeClass("active").attr("aria-checked",!1),$("#aBusinessTab").removeClass("active").attr("aria-checked",!1),$("#aMobileTab").removeClass("active").attr("aria-checked",!1),$("#aStreamTab").removeClass("active").attr("aria-checked",!1),$("#btnAtBusiness").removeClass("active").attr("aria-checked",!1),$("#btnMobile").removeClass("active").attr("aria-checked",!1),$("#btnLiveStream").removeClass("active").attr("aria-checked",!1),$("#btnMobileForMobile").removeClass("active").attr("aria-checked",!1),$("#btnAtBusinessMobile").removeClass("active").attr("aria-checked",!1),$("#btnLiveStreamMobile").removeClass("active").attr("aria-checked",!1),HasIdExists(1)){$(".mobile-toggle").addClass("active").attr("aria-checked",!0),$("#aMobileTab").addClass("active").attr("aria-checked",!0),$("#aMobileTab").addClass("vg-filter-mobile-tab");var s=$("#btnMobile");s.addClass("active"),s.is(":visible")&&s.attr("aria-checked",!0).focus();var l=$("#btnMobileForMobile");l.addClass("active"),l.is(":visible")&&l.attr("aria-checked",!0).focus();var d=$("#divAdOtheLocation");d.is(":visible")&&d.focus()}HasIdExists(2)&&($(".business-toggle").addClass("active").attr("aria-checked",!0),$("#aBusinessTab").addClass("active").attr("aria-checked",!0),$("#aBusinessTab").addClass("vg-filter-mobile-tab"),(t=$("#btnAtBusiness")).addClass("active"),t.is(":visible")&&t.attr("aria-checked",!0).focus(),(i=$("#btnAtBusinessMobile")).addClass("active"),i.is(":visible")&&i.attr("aria-checked",!0).focus(),(a=$("#divAdBusiness")).is(":visible")&&a.focus());if(HasIdExists(3)){$(".stream-toggle").addClass("active").attr("aria-checked",!0),$("#aStreamTab").addClass("active").attr("aria-checked",!0),$("#aStreamTab").addClass("vg-filter-mobile-tab");var c=$("#btnLiveStream");c.addClass("active"),c.is(":visible")&&c.attr("aria-checked",!0).focus();var u=$("#btnLiveStreamMobile");u.addClass("active"),u.is(":visible")&&u.attr("aria-checked",!0).focus(),$(".stream-toggle").focus();var p=$("#divAdOnlineStream");p.is(":visible")&&p.focus()}HasIdExists(2)&&($(".business-toggle").addClass("active").attr("aria-checked",!0),$("#aBusinessTab").addClass("active").attr("aria-checked",!0),(t=$("#btnAtBusiness")).addClass("active").attr("aria-checked",!0),t.is(":visible")&&t.attr("aria-checked",!0).focus(),(i=$("#btnAtBusinessMobile")).addClass("active").attr("aria-checked",!0),i.is(":visible")&&i.attr("aria-checked",!0).focus(),(a=$("#divAdBusiness")).is(":visible")&&a.focus());businessSearchMode=e,$("#btnLiveStream").on("click",function(e){var t=window.location.pathname;$("#btnLiveStream").attr("href",t),e.preventDefault()}),$("#btnLiveStreamMobile").on("click",function(e){var t=window.location.pathname;$("#btnLiveStreamMobile").attr("href",t),e.preventDefault()})},window.history&&window.history.pushState&&$(window).on("popstate",function(){try{$("input.selectfocusout-back").each(function(){$(this).select2("close")})}catch(e){}if("undefined"==typeof ignoreHistory_IOS||1!=ignoreHistory_IOS||1==localStorage.getItem("isAdvanceSearchMenu"))if("object"==typeof $(".select2-drop")&&$(".select2-drop").hide(),"Home"==BasePage){if(""!=$("#dvSignupNew").html()&&null!=$("#dvSignupNew").html()&&1==$("#dvSignupNew").is(":visible")&&LoginClosePopup(!0),$("#btnBackHomeSearch").is(":visible")&&$("#btnBackHomeSearch").click(),history.state)if(history.state.sectionName.indexOf("dealsindividual")>=0){var e=(r=history.state.sectionName.split("dealsindividual"))[0];DailyDealsDetail(r[1].split("&&")[0],r[1].split("&&")[1],e,null)}else{if("detail"!=history.state.basepage.toLowerCase()&&"myaccount"!=history.state.basepage.toLowerCase()||1==localStorage.getItem("isAdvanceSearchMenu")&&(localStorage.setItem("isAdvanceSearchMenu",0),window.location.reload(!0)),"deals"==history.state.sectionName.toLowerCase()&&($("#ulFeatureBusiness").html('<section class="cards-parent-div-flex daily" id="dealListing">').removeAttr("style"),$("#ulFeatureBusiness").removeAttr("lastcall")),-1!=history.state.sectionName.indexOf("/")&&(history.state.sectionName=history.state.sectionName.split("/")[0]),history.state.sectionName.toLowerCase()==_common.liveStreamClasses)_common.SelectLiveStreamClasses(history.state);else if("listings"==history.state.sectionName.toLowerCase()||"class"==history.state.sectionName.toLowerCase()||"book"==history.state.sectionName.toLowerCase()){-1!=businessSearchModeForSelection.indexOf(searchFilterEnum.LiveStream)&&($("#divBusType #aStreamTab").hasClass("w--current")||$("#divBusType #aBusinessTab").hasClass("w--current")||$("#divBusType #aMobileTab").hasClass("w--current")?window.history.back():(ResetBusinessSearchMode(),resetAllCheckBox()))}history.state.sectionName.toLowerCase()!=_common.liveStreamClasses&&$("body").hasClass("livestreampage")&&$("body").removeClass("livestreampage"),loadData(history.state.sectionName,!0),_common.setGeoLocationMarker(history.state.sectionName),"home"!=history.state.basepage.toLowerCase()||"undefined"==typeof isDisplayAffirmBanner||"True"!=isDisplayAffirmBanner&&1!=isDisplayAffirmBanner||($("#aSeeAllAffirmBusinesses").length>0?$("body").addClass("affirmBannerBody"):$("body").removeClass("affirmBannerBody"))}else if(null==history.state){var t="home";try{t=window.location.pathname.split("/")[1]}catch(e){}"deals"==(t=void 0!==t?t:"home").toLowerCase()&&($("#ulFeatureBusiness").html('<section class="cards-parent-div-flex daily" id="dealListing">').removeAttr("style"),$("#ulFeatureBusiness").removeAttr("lastcall")),loadData(t,!0),_common.setGeoLocationMarker(t),"undefined"==typeof isDisplayAffirmBanner||"True"!=isDisplayAffirmBanner&&1!=isDisplayAffirmBanner||($("#aSeeAllAffirmBusinesses").length>0?$("body").addClass("affirmBannerBody"):$("body").removeClass("affirmBannerBody")),1==localStorage.getItem("isAdvanceSearchMenu")&&(localStorage.setItem("isAdvanceSearchMenu",0),window.location.reload(!0))}}else if("detail"==BasePage.toLowerCase()){if($("#divLoginNew").is(":visible")&&setTimeout(function(){LoginClosePopup()},300),$("#mobile-check").is(":visible")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)document.referrer.toLowerCase().indexOf("customerapprule.html")>-1&&$("#divSearch").is(":visible")&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,1),$("#divClassDetailpopup").length>0&&$("#divClassDetailpopup").removeClass("fade").modal("hide"),_shopdetail.backpage();else if($("#dvOnlineAppoinmentBooked").is(":visible"))$("#dvOnlineAppoinmentBooked").hide(),_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!0);else if(history.state){var i=GetSelectedMenuObject(history.state.subTab);if(history.state.sectionName.indexOf("dealsindividual")>=0){$("#dvDailyDealsDetail").show(),$("#pageSection").hide().removeClass("pagesectionFlex");e=(r=history.state.sectionName.split("dealsindividual"))[0];DailyDealsDetail(r[1].split("&&")[0],r[1].split("&&")[1],e,null)}else if("addreview"==history.state.subTab)$("#btnAboutAddReview").attr("data-addstate","false"),_siteBuilderDetail.OpenReviewPopup();else{"about"==history.state.subTab||"reviews"==history.state.subTab||"products"==history.state.subTab?($("#dvDailyDealsDetail").hide(),$("#divWriteReview").hide()):"staff"!=history.state.subTab&&"services"!=history.state.subTab&&"classes"!=history.state.subTab&&"gift-certificates"!=history.state.subTab&&"memberships"!=history.state.subTab&&"book-now"!=history.state.subTab&&"styles"!=history.state.subTab||$("#dvDailyDealsDetail").hide();try{$(i[0]).attr("data-addstate","false"),"shopping-bag"==history.state.subTab.toLowerCase()&&$(i[0]).attr("data-isbypass","false"),$(i[0]).click()}catch(e){tabOb.attr("data-addstate","false"),"shopping-bag"==history.state.subTab.toLowerCase()&&i.attr("data-isbypass","false"),i.click()}}}else if(null==history.state){$("#dvDailyDealsDetail").hide();t=tabSegment;try{t=IsVagaroDomain()?window.location.pathname.split("/")[2]:window.location.pathname.split("/")[1]}catch(e){}var a=GetSelectedMenuObject(t=void 0!==t&&""!=t&&null!=t?t:DefaultTabPage);try{$(a[0]).attr("data-addstate","false"),"shopping-bag"==t.toLowerCase()&&$(a[0]).attr("data-isbypass","true"),$(a[0]).click()}catch(e){a.attr("data-addstate","false"),"shopping-bag"==t.toLowerCase()&&a.attr("data-isbypass","true"),a.click()}}}else if("dailydeal"==BasePage.toLowerCase())if(history.state)if(history.state.sectionName.indexOf("dealsindividual")>=0){var r;e=(r=history.state.sectionName.split("dealsindividual"))[0];DailyDealsDetail(r[1].split("&&")[0],r[1].split("&&")[1],e,null)}else loadData(history.state.sectionName,!0),_common.setGeoLocationMarker(history.state.sectionName);else null==history.state&&window.location.reload(!0);else null==history.state&&window.location.reload(!0);else ignoreHistory_IOS=!1}),iosDevices?$(document).bind("touchstart",function(e){onOutsideClick(e)}):$(document).mousedown(function(e){onOutsideClick(e)}),function(e,t){var i=iOSversion();function a(e){for(var t=null==e?"":e.toLowerCase().split(" "),i=0;i<t.length;i++)t[i]=t[i].charAt(0).toUpperCase()+t[i].substring(1);return t.join(" ")}_common={},_common.reloadstyle=!0,_common.likestyle=null,_common.liveStreamClasses="live-stream-classes",_common.getscrollTop=function(t){e(t).scrollTop();return InPageWidget_Ios?-1*e("#page-wrapper").position().top:e(window).scrollTop()},_common.nestedHiddenElement=function(t){return e(t).filter(function(){return"none"!==e(this).css("display")}).length},_common.checkiOSversion=function(){try{if(/iP(hone|od|ad)/.test(navigator.platform)){var e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return void 0!==e&&null!=e&&""!=e||(e=navigator.appVersion.match(/OS X (\d+)_(\d+)_?(\d+)?/)),[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||0,10)]}}catch(e){}},_common.SyncAppNavCtaVisibility=function(){var t=_common.IsMobileDeviceForAppPromo()&&!_common.IsVagaroAppOrEmbeddedContext()&&_common.IsHomeUrlForAppPromo()&&!_common.IsMobileSearchOverlayOpen();t&&e(".inventory-product-header").is(":visible")&&(t=!1),t?e("#divAppNavCta").css({float:"none",position:"fixed"}).show():e("#divAppNavCta").hide(),"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo()},_common.showHideCart=function(t){t&&_common.VisibleControlLength("#mobile-check")>0?(e("#mobileCart").show(),_common.SyncAppNavCtaVisibility()):e("#mobileCart").hide()},_common.showHideBackandCart=function(e){_common.showHideCart(e)},_common.SetCityState=function(e,t,i){return void 0!==t&&null!=t||(t=""),void 0!==e&&null!=e&&""!=e?e+", "+(null!=i&&""!=i&&null!=i&&2==i?t:t.toUpperCase()):null!=i&&""!=i&&null!=i&&2==i?t:t.toUpperCase()},_common.nextPrevious=function(t,i,a,r){var o=e("#"+t).width();e("#"+a).removeClass("slide-disabled"),e("#"+a).removeAttr("disabled"),e("#"+r).removeClass("slide-disabled"),e("#"+r).removeAttr("disabled");var n,s=document.getElementById(t).scrollWidth,l=e("#"+t).scrollLeft();0==i?((n=l-o)<0&&(n=0),n<=0&&e("#"+a).addClass("slide-disabled"),e("#"+t).animate({scrollLeft:n},500)):((n=l+o)>s&&(n=s),n+o>=s&&e("#"+r).addClass("slide-disabled"),e("#"+t).animate({scrollLeft:n},500));return!1},_common.nextPreviousFilters=function(t,i,a,r){var o=e("#"+t).width();e("#"+r).show(),e("#"+a).show();var n,s=document.getElementById(t).scrollWidth,l=e("#"+t).scrollLeft();0==i?((n=l-o)<0&&(n=0),n<=0&&e("#"+r).hide(),e("#"+t).animate({scrollLeft:n},500)):((n=l+o)>s&&(n=s),n+o>=s&&e("#"+a).hide(),e("#"+t).animate({scrollLeft:n},500));return!1},_common.SetChoiceForSeleect2=function(e,t){e.data("choice",JSON.stringify(t))},_common.GetChoiceForSeleect2=function(e){try{return JSON.parse(e.data("choice"))}catch(e){return{}}},_common.SetDefaultForSeleect2=function(e){e.data("choice",JSON.stringify({id:"",text:""}))},_common.focusonLocationControl=function(t){if(e("#txtLocationSearch").click(),0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType)){var i=e("#txtBusinessLocationSearch1").data("select2");i.val(e("#txtLocationSearch").val()),setTimeout(function(){i.opened()||(1==t&&e("#txtBusinessLocationSearch1").parent().find(".select2-input").val(""),i.open())},0)}},_common.LiveStreamLocationSearchControl=function(){e("#divLiveStreamLocationSearchPopUp").modal("show"),e(".modal-backdrop").last().css("z-index","1003"),e("#txtLiveStreamLocationSearch").select2("destroy"),e("#txtLiveStreamLocationSearch").off("selected"),e("#txtLiveStreamLocationSearch").off("select2-close");new ProximitySearch(e("#txtLiveStreamLocationSearch"),e("#hdngblCountryId"),e("#navCountryList")).init("service-where-dropdown mobcommon-dropdown liveStreamSearchClass",!1);e("#txtLiveStreamLocationSearch").parent().find(".select2-input").val(""),e(".liveStreamSearchClass").css("z-index","99999"),e("#txtLiveStreamLocationSearch").parent().find(".select2-input").attr("placeholder","Search for a Location"),e("input.select2-input").attr("autocomplete","off"),setTimeout(function(){null!=e("#divLiveStreamLocationSearchPopUp").css("display")&&"none"!=e("#divLiveStreamLocationSearchPopUp").css("display")&&e("#txtLiveStreamLocationSearch").parent().find(".select2-input").click()},500)},_common.focusonMobileLocationControl=function(){if(0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType)){var t=e("#txtMobileCityState").data("select2");setTimeout(function(){t.opened()||(e("#txtMobileCityState").parent().find(".select2-input").val(""),t.open())},0)}},_common.MobileSctollTop=function(t){if(_common.VisibleControlLength("#mobile-check")>0){e("html,body").animate({scrollTop:e(t).offset().top+0},"slow")}},_common.ScrollToTopShopDetail=function(t){if(1==_shopdetail.isTabLoaded)if(0==e("#mobile-check").is(":visible")){var i=e("#topHeadSection").height()+31;void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite&&(i=e("#divCustombanner").height()+81),setTimeout(function(){e("html, body").animate({scrollTop:i},"slow",function(){e("#backtotop").css("display","none")})},500)}else _common.ScrollToToZero()},_common.ScrollToTopAnchor=function(t){var i=0;InPageWidget_Ios&&(i=_common.getscrollTop(ScrollTarget)),e("html,body").animate({scrollTop:e(t).offset().top+i-74},"slow")},_common.ScrollToToZero=function(){InPageWidget_Ios?(e("body").css("height","auto"),e("body").css("height","100%")):e("html, body").animate({scrollTop:0},"slow",function(){e("#backtotop").length&&e("#backtotop").css("display","none")})},_common.ScrollToToZeroReview=function(){e("html, body").animate({scrollTop:0},"slow","linear",function(){e("#backtotop").length&&e("#backtotop").css("display","none")})},_common.backtoTopHide=function(){e("#backtotop").css("display","none")},_common.PassiveAlertClass=function(t,i){var a=e(".passive-alert-parent .passive-alert");a.attr("class","passive-alert"),a.addClass(t),a.find(".image-27").attr("src",i)},_common.ADAPassiveAlert=function(t,i){var a=document.activeElement,r=null;(a=e(void 0!==i&&null!=i?i:a)).length>0&&void 0!==a.attr("aria-label")&&a.attr("aria-label")!=t&&(r=a.attr("aria-label")),a.attr("aria-label",t).focus(),setTimeout(function(e,t){e.removeAttr("aria-label"),null!=t&&e.attr("aria-label",t)},5e3,a,r)},_common.PassiveAlertSuccess=function(t,a){var r=Webflow.require("ix"),o=e(".passive-alert-parent");if(e(".passive-alert").hasClass("passive-warn")&&e(".passive-alert").removeClass("passive-warn"),o.find(".passive-msg").html(t),void 0!==i&&i[0]<=8){var n={type:"click",selector:".passive-alert-parent",preserve3d:!0,stepsA:[{display:"-webkit-flex",transition:"transform 400ms ease 0",x:"0px",y:"55px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){r.run(n,o),_common.ADAPassiveAlert(t,a)},500)}else{n={type:"click",selector:".passive-alert-parent",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"55px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){r.run(n,o),_common.ADAPassiveAlert(t,a)},500)}},_common.PassiveAlertSuccessgreen=function(t,a){if("Builder"==getQueryStringData("Type"))wbc._postMessage('{"eventType": "passiveAlert","type": "success", "message":"'+t+'"}');else{var r=Webflow.require("ix"),o=e(".passive-alert-green");if(o.find(".passive-tex-msg").html(t),void 0!==i&&i[0]<=8){var n={type:"click",selector:".passive-alert-green",preserve3d:!0,stepsA:[{display:"-webkit-flex",transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"-50px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){r.run(n,o),_common.ADAPassiveAlert(t,a)},500)}else{n={type:"click",selector:".passive-alert-green",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"-50px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){r.run(n,o),_common.ADAPassiveAlert(t,a)},500)}}},_common.PassiveAlertfail=function(t,a){if("OnBoarding"==getQueryStringData("Type")){var r=e(".passive-banner-fail");r.length>0&&(r.css({display:"block",top:"300px"}),e(".scrptbody").scrollTop(1))}var o=Webflow.require("ix"),n=e(".passive-banner-fail");if(n.find(".passive-tex-msg").html(t),void 0!==i&&i[0]<=8){var s={type:"click",selector:".passive-banner-fail",preserve3d:!0,stepsA:[{display:"-webkit-flex",transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"-50px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){o.run(s,n),_common.ADAPassiveAlert(t,a)},500)}else{s={type:"click",selector:".passive-banner-fail",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"-50px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){o.run(s,n),_common.ADAPassiveAlert(t,a)},500)}},_common.PassiveAlertwarning=function(t,a){if("Builder"==getQueryStringData("Type"))wbc._postMessage('{"eventType": "passiveAlert","type": "warning", "message":"'+t+'"}');else{var r=Webflow.require("ix"),o=e(".passive-banner-warning");if(o.find(".passive-tex-msg").html(t),void 0!==i&&i[0]<=8){var n={type:"click",selector:".passive-banner-fail",preserve3d:!0,stepsA:[{display:"-webkit-flex",transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"-50px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){r.run(n,o),_common.ADAPassiveAlert(t,a)},500)}else{n={type:"click",selector:".passive-banner-warning",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"-50px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){r.run(n,o),_common.ADAPassiveAlert(t,a)},500)}}},_common.PassiveAlertFailed=function(t,i){var a=Webflow.require("ix"),r=e(".passive-alert-parent");_common.PassiveAlertClass("passive-fail",cdnImagePath+"/PublicImages/Images/alert-fail-mark@2x.png"),r.find(".passive-msg").html(t);var o={type:"click",selector:".passive-alert-parent",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"129px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){a.run(o,r),_common.ADAPassiveAlert(t,i)},500)},_common.PassiveAlertWarning=function(t,i){var a=Webflow.require("ix"),r=e(".passive-alert-parent");_common.PassiveAlertClass("passive-warn",cdnImagePath+"/PublicImages/Images/passive-warning.svg"),r.find(".passive-msg").html(t),r.removeClass("vagaro-passive-green"),r.find(".passive-alert").addClass("vagaro-passive-warning");var o={type:"click",selector:".passive-alert-parent",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"129px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){a.run(o,r),_common.ADAPassiveAlert(t,i)},500)},_common.vgBookNowDropDown=function(t){if(IsServiceTab||IsClassTab)if(IsServiceTab&&IsClassTab)e(".vgtabs > div").show(),_common.vgBookNowDropDownToggle(t);else if(IsServiceTab){if(e(".vgtabs > div").hide(),e(".vgtabs").closest(".vg-dropdown-parent").hide(),0==("detail"==BasePage.toLowerCase()&&void 0!==_shopdetail.activeTabName&&"details"==_shopdetail.activeTabName.toLowerCase()))try{"undefined"!=typeof isWidget&&null!=isWidget&&"false"===isWidget.toString().toLowerCase()?_common.LoadBookNowMenu(LoadMenuTypeEnum.services,!1,!0):_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1,!0)}catch(e){_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1,!0)}}else IsClassTab&&(e(".vgtabs > div").hide(),e(".vgtabs").closest(".vg-dropdown-parent").hide(),_common.LoadBookNowMenu(LoadMenuTypeEnum.classes,!1,!0));else e(".vgtabs > div").hide(),e(".vgtabs").closest(".vg-dropdown-parent").hide(),0==("detail"==BasePage.toLowerCase()&&void 0!==_shopdetail.activeTabName&&"staff"==_shopdetail.activeTabName.toLowerCase())&&_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1,!0)},_common.vgBookNowDropDownToggle=function(t){var i=e(t).parent().find(".vg-dropdown-parent");i.hasClass("active-drop-vg")?(i.slideUp(250),i.removeClass("active-drop-vg"),e(t).parent().removeClass("active-vg-dropdown")):(i.slideDown(250),i.addClass("active-drop-vg"),e(t).parent().addClass("active-vg-dropdown"))},_common.vgBookNowmenuClick=function(t){var i=e(t).parent().parent();i.hasClass("active-drop-vg")?(i.slideUp(250),i.removeClass("active-drop-vg"),e(t).closest(".active-vg-dropdown").removeClass("active-vg-dropdown"),e(t).children("a").attr("aria-expanded",!1)):(i.slideDown(250),i.addClass("active-drop-vg"),e(t).closest(".active-vg-dropdown").addClass("active-vg-dropdown"),e(t).children("a").attr("aria-expanded",!0))},_common.IsWidgetForServiceProvider=function(e){return!String.isNullOrUndefineOrBlank(_shopdetail.isWidget)&&"true"==_shopdetail.isWidget&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetSpId)&&_shopdetail.WidgetSpId>0&&(1==e||(_shopdetail.WidgetSpOnline=_shopdetail.WidgetSpOnline,_shopdetail.WidgetSpId))},_common.IsWidgetForServiceProviderOnline=function(e){return!String.isNullOrUndefineOrBlank(_shopdetail.isWidget)&&"true"==_shopdetail.isWidget&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetSpId)&&_shopdetail.WidgetSpId>0&&(1==e||_shopdetail.WidgetSpOnline)},_common.setPageSatructure=function(t,i){e("#divBusTitle").hide(),t?(e("#pageSection").hide().removeClass("pagesectionFlex"),e("#dvAdvanceFilter").hide(),e("#divGalleryFilter").hide(),e(".mobileAdvancefilter").hide()):(e("#pageSection").show().addClass("pagesectionFlex"),i?(e(".mobileAdvancefilter").show(),e("#pageSection").addClass("listings-parent-div-100"),e("#divListing").addClass("listings-60").removeClass("gallery-content"),e("#sectionheader").addClass("listing-header").removeClass("div-block-97"),e("#sectionheader h1").addClass("listing-h1").removeClass("business-heading with-paragraph web-display-large"),e("#sectionheader p").addClass("paragraph-2").removeClass("title-paragraph"),e("#divBusTitle").show().css("display","flex"),e("#ulFeatureBusiness").removeClass("gallery page w-clearfix"),e("#map_canvas").attr("style","display:block;"),e("#map_list_optiondiv").addClass("map-optionshow")):(e(".mobileAdvancefilter").hide().removeClass("w-hidden-main w-hidden-medium"),e("#pageSection").removeClass("listings-parent-div-100"),e("#divListing").removeClass("listings-60").addClass("gallery-content"),e("#sectionheader").removeClass("listing-header").addClass("div-block-97"),e("#sectionheader h1").removeClass("listing-h1 web-display-small").addClass("business-heading with-paragraph web-display-large"),e("#sectionheader p").removeClass("paragraph-2").addClass("title-paragraph"),e("#divBusTitle").hide(),e("#ulFeatureBusiness").addClass("gallery page w-clearfix"),e("#map_canvas").hide().removeClass("showMap"),e("#map_list_optiondiv").removeClass("map-optionshow")),e("#sectionheader").attr("style","display:block;")),e("body").removeClass("no-loc-fixed"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(e("#mobilefilterChange").hide().removeClass("mapfilter").removeClass("listing-mapfiler"),"listings"!=tabSegment.toLowerCase()&&"deals"!=tabSegment.toLowerCase()||e("body").addClass("no-loc-fixed"))},_common.LoadAddToThisSmartLayer=function(){var t="true"==_shopdetail.isCustomWebsite?"left":"right";e.getScript("//s7.addthis.com/js/300/addthis_widget.js#pubid=fredhelou",function(i,a,r){"success"==a&&200==r.status&&addthis.layers({theme:"transparent",share:{position:t,numPreferredServices:5},follow:{services:"false"==_shopdetail.isCustomWebsite?[{service:"facebook",id:"vagaro"},{service:"twitter",id:"vagaro"},{service:"pinterest",id:"VagaroPins"}]:[]}},function(t){if("false"==_shopdetail.isCustomWebsite){var i=e(".shopdetail-wrapper").offset();e(".atss").offset({top:348,left:i.left-48}),e(".atss").css("z-index","5"),e("div").finish()}})})},HideMailPopup=function(t){e("#"+t).modal("hide"),e("html, body").removeClass("hide-bgscrollappoint"),iosDevices&&e("html, body").scrollTop(scrollPos)},_common.calculateDistance=function(e,t,i,a){var r=_common.deg2rad(i-e),o=_common.deg2rad(a-t),n=Math.sin(r/2)*Math.sin(r/2)+Math.cos(_common.deg2rad(e))*Math.cos(_common.deg2rad(i))*Math.sin(o/2)*Math.sin(o/2);return 6371*(2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n)))},_common.UpdateCustomListingCityinLocalStorage=function(){if("undefined"!=typeof promotionCodeId&&!String.isNullOrUndefineOrBlank(promotionCodeId)){var e=new vagaro.ajax;e.datamodel.Token="GetCustomListingCity",e.datamodel.data=[promotionCodeId],e.datamodel.callback=function(e){String.isNullOrUndefineOrBlank(e)||(localStorage.removeItem("custfvrcity"),localStorage.setItem("custfvrcity",JSON.stringify(e)))},e.Post()}},_common.getLocationsByCityState=function(t){"undefined"!=typeof regionId&&""!=regionId&&(regionName="/"+regionId);var i={};i.searchText=t.choice.cityState.replace("‘","'").replace("’","'").replace("“",'"').replace("”",'"'),i.countryId="undefined"!=typeof countryId&&""!=countryId&&null!=countryId?countryId:1,i.businesspromoid=lBusinessPromoCodeID,i.latitude=""!=t.choice.latitude?parseFloat(t.choice.latitude):0,i.longitude=""!=t.choice.longitude?parseFloat(t.choice.longitude):0,i.currentlocation="",i.pagenumber=1,i.countryName=e("#divCountryName").text(),CallWSJSON("CommonWebService.asmx/GetLocationPlaceIdForCustomDesign",JSON.stringify(i),_common.GetBusinessLocationSearchCallback,function(e,t){})},_common.GetBusinessLocationSearchCallback=function(t,i){var a=e.grep(t.d,function(e){return e.cityState===eSelectedValue.choice.cityState});a&&!String.isNullOrUndefineOrBlank(eSelectedValue)&&(eSelectedValue.choice.id=a[0].place_id,eSelectedValue.choice.text=eSelectedValue.choice.cityState,e(eSelectedValue.target).data("selectedid",a[0].place_id).data("isselected",!0),String.isNullOrUndefineOrBlank(Custom$searchbox)||(_common.SetChoiceForSeleect2(Custom$searchbox,eSelectedValue.choice),e(eSelectedValue.target).data("response",JSON.stringify(eSelectedValue.choice))),Custom$searchbox=null)},_common.deg2rad=function(e){return e*(Math.PI/180)},ProximitySearch=function(t,i,a){this.$searchelement=t,this.$countrycomboelement=i,this.$countrylistelement=a,this.$select2object={},this.$searchelement.on("select2-focus",function(t){setTimeout(function(){e(t.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common"),e("html, body").addClass("moboverflow-hide"),e("#select2-drop-mask").addClass("hidemask"),e("html, body").scrollTop(0)},200)}),this.$searchelement.on("select2-open",function(t){if(e(t.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common"),e(t.target).data("isselected",!1),e("html, body").addClass("moboverflow-hide"),e("#select2-drop-mask").addClass("hidemask"),e("html, body").scrollTop(0),(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&("txtBusinessLocationSearch"==e(t.target).attr("id")||"txtSearchServiceMain"==e(t.target).attr("id")||"txtMobileCityState"==e(t.target).attr("id")||"txtMobileService"==e(t.target).attr("id")))if(e(this).val().length>0){var i=e("#dvBusinessLocationSearch .select2-input"),a=e("#dvSearchServiceMain.select2-input"),r=e("#mobilefilterChange .select2-input"),o=e("#mobileServiceChange .select2-input");!i.length||0!==i.next("#dvBusinessLocationSearch .vg-search-cancel-icon").length&&0!==i.next("#dvSearchServiceMain .vg-search-cancel-icon").length&&0!==i.next("#dvSearchServiceMain .vg-search-cancel-icon").length&&0!==i.next("#mobilefilterChange .vg-search-cancel-icon").length&&0!==i.next("#mobileServiceChange .vg-search-cancel-icon").length||(i.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),e("#dvBusinessLocationSearch .vg-search-cancel-icon").show()),a.length&&0===a.next("#dvSearchServiceMain .vg-search-cancel-icon").length&&(a.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),e("#dvSearchServiceMain .vg-search-cancel-icon").show()),r.length&&0===r.next("#mobilefilterChange .vg-search-cancel-icon").length?(r.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),e("#mobilefilterChange .vg-search-cancel-icon").show()):r.length&&r.next("#mobilefilterChange .vg-search-cancel-icon").length>0&&e("#mobilefilterChange .vg-search-cancel-icon").show(),o.length&&0===o.next("#mobileServiceChange .vg-search-cancel-icon").length&&(o.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),e("#mobileServiceChange .vg-search-cancel-icon").show())}else e("#dvBusinessLocationSearch .vg-search-cancel-icon").hide(),e("#dvSearchServiceMain .vg-search-cancel-icon").hide(),e("#mobilefilterChange .vg-search-cancel-icon").hide(),e("#mobileServiceChange .vg-search-cancel-icon").hide()}),this.$searchelement.on("selected",function(i){"txtLiveStreamLocationSearch"!=e(i.target).attr("id")||iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone||ShowLoader(!0),0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&1==parseInt(e("#btnBackHomeSearch:visible").data("iscustomerappsearch")))&&_common.closeServiceSelection(),i.choice.text=i.choice.cityState;var a=!1,r=1==e(i.target).data().instantsearch;if(isLocationByDefault=!1,isSetIsCurrentLocationCookie=!1,"undefined"!=typeof poldservice&&(poldservice=""),2==i.choice.type){if(e(i.target).data("selectedid",""),void 0!==i.choice.vagarourl!=null&&""!=i.choice.vagarourl){a=!0;var o=window.location.href.split("/"),n=o[0]+"//"+o[2]+i.choice.vagarourl;$url=e("<a/>"),$url.attr("href",n),$url[0].click()}}else{if("location"==i.choice.type){if((1==r||iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&(isSetIsCurrentLocationCookie=!0),"undefined"!=typeof vgAppicationType&&1==vgAppicationType)return void CallbackforMobileApp(0,1,"","",0,27);e(i.target).data("selectedid",i.choice.id).data("isselected",!0);var s=e(i.target).data().purpose,l=i;return findCurrentLocation(t,s,l,i.choice,"onlocationchange"),void i.stopPropagation()}"locationByCityState"==i.choice.type?(eSelectedValue=i,Custom$searchbox=t,_common.getLocationsByCityState(i)):e(i.target).data("selectedid",i.choice.id).data("isselected",!0)}(_common.SetChoiceForSeleect2(t,i.choice),e(i.target).data("response",JSON.stringify(i.choice)),1==parseInt(e("#btnBackHomeSearch:visible").data("iscustomerappsearch"))&&(e("#btnBackHomeSearch:visible").click(),r=!0),e(i.target).attr("id").toLowerCase()!=DocIdBusinessLocationSearch&&e(IdBusinessLocationSearch).length>0)&&(0==(d=/^\d+$/.test(i.choice.id))&&e(IdBusinessLocationSearch).data("selectedid",i.choice.id),e(IdBusinessLocationSearch).data("response",JSON.stringify(i.choice)));if(r&&0==a){s=e(i.target).data().purpose,l=i;var d=/^\d+$/.test(i.choice.id),c=!0;if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(c="home"==tabSegment.toLowerCase()||"/"==tabSegment||""==tabSegment||"listings"==tabSegment,e(IdSearchServiceMain).select2("close")),1==d)onSearchClick(s,l,i.choice,!1,c);else{var u=new vagaro.ajax;u.datamodel.Token=ApiURLEnumOnlineCommon.getlocationsearchbyplaceid,u.datamodel.IsNewVagaroAPI=!0,u.datamodel.data={placeID:i.choice.id},u.datamodel.callback=function(e){null!=e&&(onSearchClick(s,l,e,!1,c),"undefined"!=typeof isSetIsCurrentLocationCookie&&setCookie(ProximityIsCurrentLocation,isSetIsCurrentLocationCookie))},u.datamodel.Error=function(e){},u.Post()}}"txtLiveStreamLocationSearch"==e(i.target).attr("id")&&_common.SetLocationBySearch(i,!0),i.stopPropagation()}),this.$searchelement.on("select2-blur",function(t){t.preventDefault(),1==e(t.currentTarget).data().instantsearch&&""==e(t.currentTarget).val()&&ProxymityValueChaning(),isAndroidMobile&&e(t.currentTarget).select2("close")}),this.$searchelement.on("select2-close",function(i){if(0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&1==parseInt(e("#btnBackHomeSearch:visible").data("iscustomerappsearch")))||"current location"!=t.parent().find(".select2-input").val().toLowerCase()){_common.closeServiceSelection(),e("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){e("#select2-drop-mask").off("touchstart.custom")},500);var a=t.data("select2").getVal().toString(),r=_common.GetChoiceForSeleect2(t);if(null!=typeof r&&null!=r&&null!=r.city){var o=EmptyProximityValue();o.countryid=r.countryID,o.currencysymbol="2"==r.countryID?"£":"$",o.lat=r.latitude,o.long=r.longitude,o.zip=r.zipCode,o.city=r.city.toLowerCase(),o.state=r.stateCode.toLowerCase(),state=r.stateCode.toLowerCase(),lattitude=r.latitude,longitude=r.longitude,setCookie(ProximityCookieName,o),e("#txtLocationSearch").val(r.city+", "+r.stateCode+", "+r.countryName),_common.AddState("listings"),_home.loadHeroList()}""!=a&&void 0!==r.id?1==e(i.currentTarget).data().instantsearch?"txtlocationsearch"!=e(i.currentTarget).attr("id").toLowerCase()||void 0===e(i.currentTarget).data("isselected")||1!=e(i.currentTarget).data("isselected")||"undefined"!=typeof vgAppicationType&&0!=vgAppicationType||0!=_common.VisibleControlLength("#mobile-check")?t.select2("val",r.id):void 0!==r.text&&null!=typeof r.text&&(void 0!==r.countryName&&null!=typeof r.countryName?t.select2("data",{id:"",text:r.text+", "+r.countryName}):t.select2("data",{id:"",text:r.text})):(e("#dvBusinessLocationSearch").removeClass("inputError"),t.select2("data",{id:r.id,text:r.text})):1==e(i.currentTarget).data().instantsearch?ProxymityValueChaning():(t.select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(t)),(iPadAndroid||isWindowsPhone)&&e("#btnSearchBuss:visible, #ancFilter:visible, #btnDealsBook:visible, #mobileBack:visible").focus(),e(".select2-more-pager").remove()}else t.parent().find(".select2-input").click()}),null!=this.$countrylistelement&&this.$countrylistelement.find("a").click(function(){e("#divCountryName").html(e(this).html()),e("#hdngblCountryId").data("countryid",e(this).data("countryid")),e("#navCountryList").trigger("w-close.w-dropdown")})},ProximitySearch.prototype={CountrySelected:function(t,i,a,r){a.data("countryid",e(t).attr("data-countryid")),a.data("currencysymbol",e(t).attr("data-currencysymbol")),e("#divCountryName").html(e(t).html()),r.data("selectedid","");var o=getCookie(ProximityCookieName);null!=o&&(o.countryid==e(t).attr("data-countryid")||"#txtLiveStreamLocationSearch"!=r.selector&&"#txtLocationSearch"!=r.selector&&"#txtBusinessLocationSearch1"!=r.selector&&"#txtMobileCityState"!=r.selector&&_featured.clearAdvanceSearch("proxysearch"),i&&(r.val(""),r.closest("#divSelect2Parent").find(".select2-input").val(""),e(IdBusinessLocationSearch).closest("#dvBusinessLocationSearch").find(".select2-input").val(""),_common.SetChoiceForSeleect2(e(IdBusinessLocationSearch),{})))},init:function(t,i){var a=this.$countrycomboelement,r=0,o=20;this.$searchelement.val("");var n="";if("undefined"!=typeof regionId&&""!=regionId&&(n="/"+regionId),void 0===this.$searchelement.data("select2")&&(this.$select2object=this.$searchelement.select2({searchInputPlaceholder:1==i?"Business Name or Location":"City, Zip / Postal code",minimumInputLength:0,maximumInputLength:100,combobox:!0,formContainer:"#page-wrapper",dropdownCssClass:t,selectOnClick:NotmobileorIphone,formatInputTooShort:!1,ajax:{type:"POST",contentType:"application/json; charset=utf-8",url:n+"/WebServices/CommonWebService.asmx/GetBusinessLocationSearch",dataType:"json",quietMillis:300,minimumInputLengthForAjaxCall:3,transport:function(t){return t.beforeSend=function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val())},e.ajax(t)},data:function(t,r){return{searchText:t.replace("‘","'").replace("’","'").replace("“",'"').replace("”",'"'),countryId:parseInt(a.data("countryid")),businesspromoid:lBusinessPromoCodeID,latitude:""!=lattitude?parseFloat(lattitude):0,longitude:""!=longitude?parseFloat(longitude):0,includebusiness:i,currentlocation:CurrentLocation,pagenumber:r,countryName:e("#divCountryName").text()}},results:function(t,i){if(arrresults=[],null!=t&&t.length>0){if(arrBusiness=[],arrLocation=[],e.grep(t,function(e,t){if(1==e.type&&null!=e.cityState&&""!=e.cityState)(i={}).countryID=e.countryID,null!=e.place_id&&""!=e.place_id?(i.id=e.place_id,i.text=e.cityState+', <span class="countrygreycolor">'+e.countryName+"</span>",i.cityState=e.cityState):(i.id=t+1,i.text=e.cityState,i.latitude=e.latitude,i.longitude=e.longitude,i.state=e.state,i.zipCode=e.zipCode,i.currencySymbol=e.currencySymbol,1!=e.countryID?i.stateCode=e.stateCode.replace("AU-","").replace("GB-","").replace("CA-",""):i.stateCode=e.stateCode,i.city=e.city,i.cityState=_common.SetCityState(i.city,i.state,i.countryID)),i.countryName=e.countryName,i.type=e.type,i.cssClass="parent-text location-icon-select",arrLocation.push(i);else if(2==e.type){var i;(i={}).id=e.vagaroURL+"|"+e.businessID,i.text=e.businessName,i.cssClass="parent-text",i.appendText=e.cityState,i.childCssClass="child-text ",i.type=e.type,i.vagarourl=e.vagaroURL,arrBusiness.push(i)}}),t.length>0&&1==t[0].includebusiness){var a={};"1"==i?(arrLocation.length>0&&((a={}).id="Locations",a.text="Locations",a.cssClass="selectlocation-icon ",a.disabled=!0,a.children=arrLocation,arrresults.push(a)),arrBusiness.length>0&&((a={}).id="Businesses",a.text="Businesses",a.cssClass="selectbusiness-icon ",a.disabled=!0,a.children=arrBusiness,arrresults.push(a))):arrresults=arrBusiness}else arrresults=arrLocation;var n=20;if("1"==i){n=25;var s={id:"location",text:"Current Location",cssClass:"currentlocation-icon web-subheading-font-blue",type:"location"};arrresults.splice(0,0,s)}r=t.length>0?t[0].totalCount:0;var l=Math.ceil(r/n);o=n*i,i==l&&(o=r);var d=!1;return o<r&&(d=!0),{results:arrresults,more:d}}s={id:"location",text:"Current Location",cssClass:"currentlocation-icon web-subheading-font-blue",type:"location"};if(arrresults.splice(0,0,s),"undefined"!=typeof promotionCodeId&&!String.isNullOrUndefineOrBlank(promotionCodeId)){var c=localStorage.getItem("custfvrcity");if(!String.isNullOrUndefineOrBlank(c)){c=JSON.parse(c),e.each(c,function(e,t){t.type="locationByCityState",t.text=t.City+", "+t.StateCode,t.cityState=t.City+", "+t.StateCode,t.latitude=t.Latitude,t.longitude=t.Longitude,t.id=""});var u=getCookie(ProximityCookieName);null!=u?(e.each(c,function(e,t){t.Distance=_common.calculateDistance(t.Latitude,t.Longitude,u.lat,u.long)}),c.sort(function(e,t){return e.Distance-t.Distance})):c.sort(function(e,t){return e.text<t.text?-1:e.text>t.text?1:0});for(var p=0;p<c.length;p++)arrresults.push(c[p])}}return{results:arrresults,more:!1}},params:{error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}}},cache:!1},initSelection:function(e,t){var i=getCookie(ProximityCookieName);if(null!=i&&""!=i.state){var a={},r=null==i.state?"":2==i.countryid?i.stateName:i.state.toUpperCase();if(void 0!==i.city&&null!=i.city&&""!=i.city)a={id:"",text:i.city+", "+r+", "+(null!=i.countryid&&""!=i.countryid?CountryNames[parseInt(i.countryid)]:"United States")};else a={id:"",text:(String.isNullOrUndefineOrBlank(i.stateName)?r:i.stateName)+", "+(null!=i.countryid&&""!=i.countryid?CountryNames[parseInt(i.countryid)]:"United States")};t(a)}},formatResult:function(e){var t="",i=e.text;(t=1==e.hasOwnProperty("cssClass")?'<div class="'+e.cssClass+'">'+i+"</div>":"<div>"+i+"</div>",1==e.hasOwnProperty("appendText")&&""!=e.appendText)&&(t=t+"<span"+(e.hasOwnProperty("childCssClass")?' class="'+e.childCssClass+'"':"")+">"+e.appendText+"</span>");return t},formatSelection:function(e){return e.text},sortResults:function(e,t,i){return e},formatPager:function(e){return e>1&&(o+=5)>r?"Items 1 - "+(o-=5)+" out of "+r:"Items 1 - "+o+" out of "+r}})),null!=this.$countrylistelement&&(this.CountrySelected(this.$countrylistelement.find("a[data-countryid='"+countryid+"']").get(0),!1,this.$countrycomboelement,this.$searchelement),null!=state&&""!=state)){var s="";s=void 0!==city&&null!=city&&""!=city?lattitude+"#"+longitude+"#"+zip+"#"+city.toLowerCase()+"#"+state.toLowerCase():lattitude+"#"+longitude+"#"+zip+"#"+state.toLowerCase(),this.$searchelement.select2("val",s);var l={id:s};if(_common.SetChoiceForSeleect2(this.$searchelement,l),this.$searchelement.data("selectedid",s),e(IdBusinessLocationSearch).length>0){var d={id:"",text:_common.SetCityState(city,state,countryid)};e(IdBusinessLocationSearch).select2("data",d),_common.SetChoiceForSeleect2(e(IdBusinessLocationSearch),d)}if(e("#h2LocationName").length>0&&(null!=countryid&&"undefined"!=countryid&&"2"==countryid?e("#h2LocationName").text("Featured in "+city).attr("aria-label",city):e("#h2LocationName").text("Featured in "+_common.SetCityState(city,state,countryid)).attr("aria-label",_common.SetCityState(city,state,countryid))),!StringisNullOrUndefineOrBlank(city)&&city&&state){var c=city.toString().trim().toLowerCase().replace(/\s+/g,"-"),u=state.toString().trim().toLowerCase().replace(/\s+/g,"-"),p="";if(!StringisNullOrUndefineOrBlank(countryid)&&("2"==countryid?p="gb":"3"==countryid?p="ca":"4"==countryid&&(p="au"),"2"==countryid)){var h=getCookie(ProximityCookieName)||{};if(!StringisNullOrUndefineOrBlank(h))if(StringisNullOrUndefineOrBlank(h.stateName)){var m=getStateName();StringisNullOrUndefineOrBlank(m)||(u=m.toString().trim().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/\s+/g,"-"))}else StringisNullOrUndefineOrBlank(h.stateName)||""===h.stateName.trim()||(u=h.stateName.toString().trim().toLowerCase().replace(/\s+/g,"-"))}var f=c+"--"+u;""!=p&&(f+="--"+p);[{selector:"#aSeeAllPopularBusiness",path:"/listings/"},{selector:"#aSeeAllDeals",path:"/deals/"}].forEach(function(t){var i=e(t.selector);i.length>0&&i.attr("href",t.path+f)})}}return applyJqueryScroll(".select2-results"),this}},AdminServiceList="",AdminServiceopenDB=function(e){var t=indexedDB.open(DB_NAME,1);t.onupgradeneeded=function(e){e.target.result.createObjectStore(STORE_NAME,{keyPath:"id"})},t.onsuccess=function(t){e(t.target.result)}},saveAdminServicesToDB=function(e){AdminServiceopenDB(function(t){t.transaction(STORE_NAME,"readwrite").objectStore(STORE_NAME).put({id:"adminServices",data:e,timestamp:Date.now()})})},getAdminServicesFromDB=function(e){AdminServiceopenDB(function(t){let i=t.transaction(STORE_NAME,"readonly").objectStore(STORE_NAME).get("adminServices");i.onsuccess=function(){let t=i.result;t&&Date.now()-t.timestamp<TTL_TIME?e(t.data):e(null)},i.onerror=function(){e(null)}})},InitAdminServices=function(){try{_home.IsIndexedDBSupported()?getAdminServicesFromDB(function(e){e?(AdminServiceList=e,LoadAdminServicesKeyphrase(),processAdminServices()):LoadAdminServices()}):LoadAdminServices()}catch(e){LoadAdminServices()}},processAdminServices=function(){var t={dropdownCssClass:"home-serch-service-height service-what-dropdown service-data-only",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Search Services and Classes"};new ctlrSearchService(e(IdSearchServiceMain),t),new ctlrSearchService(e("#txtSearchServiceMain1"),t);_common.UpdateCustomListingCityinLocalStorage(),"undefined"!=typeof _featured&&void 0!==_featured.GetAdminFAQServiceClass&&_featured.GetAdminFAQServiceClass()},LoadAdminServices=function(){var e=new vagaro.ajax;e.datamodel.Token="GetAdminServices",e.datamodel.callback=GetAdminServices_Success,e.datamodel.data=[],e.datamodel.async=!1,e.datamodel.Error=function(e){ShowLoader(!1)},e.Post()},GetAdminServices_Success=function(t){ShowLoader(!1),AdminServiceList=JSON.parse(t),"select service"==AdminServiceList.results[0].text.toLowerCase()&&AdminServiceList.results.shift(),"undefined"!=typeof AdminServiceList&&void 0!==AdminServiceList.results&&AdminServiceList.results.splice(0,0,{text:"All Services and Classes",EventType:"0",ServiceOrder:"0",IsDefault:"true",id:"0",children:[]});var i=e.grep(AdminServiceList.results,function(e,t){return 0==e.EventType}),a=e.grep(AdminServiceList.results,function(e,t){return 2==e.EventType}),r={serviceDisplayClass:"hide-home-servicesclass"};e.each(a,function(t){e.extend(a[t],r)});var o=e.grep(AdminServiceList.results,function(e,t){return 1==e.EventType});e.merge(i,o),e.merge(i,a),AdminServiceList.results=i;var n=e.grep(AdminServiceList.results,function(e,t){return 1==e.IsCustom});e.each(n,function(t){e.extend(n[t],r)});try{_home.IsIndexedDBSupported()&&saveAdminServicesToDB(AdminServiceList)}catch(e){}processAdminServices()},findObjectBytext=function(e,t){for(var i=0;i<e.length;i++){if(e[i].text===t)return e[i];if(e[i].url===t)return e[i];if(e[i].children&&e[i].children.length>0){var a=this.findObjectBytext(e[i].children,t);if(a)return a}}return null},_common.setBookAService=function(){if(!e("#"+(e("#mobile-check").is(":visible")?"txtMobileService":"ddlServices")).data("select2")){var t={dropdownCssClass:"home-serch-service-height bookaservice-select service-what-dropdown",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Search Services and Classes"};new ctlrSearchService(e("#ddlServices"),t),new ctlrSearchService(e("#txtMobileService"),t)}if(null!=service&&""!=service){void 0!==p&&null!=typeof p||(p="");var i=service;void 0!==htmlDecode&&(i=htmlDecode(service)),e("#ddlServices").select2("data",{id:service,text:i,EventType:p});var a={id:service,text:i,EventType:p};if(void 0!==e("#ddlServices").data("choice")){_common.SetChoiceForSeleect2(e("#ddlServices"),a),e("#ddlServices").parent().find(".select2-input").val(i),_common.SetChoiceForSeleect2(e("#txtMobileService"),a),e("#txtMobileService").parent().find(".select2-input").val(i);try{_common.SetChoiceForSeleect2(e("#txtSearchServiceMain1"),a),e("#txtSearchServiceMain1").parent().find(".select2-input").val(i),e("#txtSearchServiceMain1").val(i).trigger("change"),_common.SetChoiceForSeleect2(e("#txtSearchServiceMain"),a),e("#txtSearchServiceMain").parent().find(".select2-input").val(i),e("#txtSearchServiceMain").val(i).trigger("change");var r=e("#txtServiceDate").val();if(void 0!==r&&null!=r&&""!=r)if("Anytime"==r)e("#txtHomeServicesDate1").val(r).trigger("change");else if(/^[A-Z][a-z]{2}\s\d{1,2}\sat\s\d{1,2}:\d{2}\s(AM|PM)$/.test(r))e("#txtHomeServicesDate1").val(r).trigger("change");else{var o=new Date(r).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).replace(","," at");e("#txtHomeServicesDate1").val(o).trigger("change")}}catch(e){}}}},_common.setLiveStreamSearchFilterVal=function(t,i){_common.SetChoiceForSeleect2(e("#ddlServices"),t),e("#ddlServices").parent().find(".select2-input").val(i),_common.SetChoiceForSeleect2(e("#txtMobileService"),t),e("#txtMobileService").parent().find(".select2-input").val(i),_common.SetChoiceForSeleect2(e(IdSearchServiceMain),t),e(IdSearchServiceMain).parent().find(".select2-input").val(i),String.isNullOrUndefineOrBlank(i)?(service="",tabSegment="listings"):"book"==tabSegment||"listings"==tabSegment?_common.SetVariablesForBookAService():"class"==tabSegment&&_common.SetVariablesForBookAClass()},_common.LoadListing=function(){service="",closeMobileSearch(),_common.ClearService(),setdefaultSortingOption("listSort","listings"),_common.loadSectionsFromMobile("listings",null)},_common.ClearService=function(){e("#ddlServices").select2("data",{id:service,text:service,EventType:p});var t={id:service,text:service,EventType:p};void 0!==e("#ddlServices").data("choice")&&(_common.SetChoiceForSeleect2(e("#ddlServices"),t),e("#ddlServices").parent().find(".select2-input").val(service),_common.SetChoiceForSeleect2(e("#txtMobileService"),t),e("#txtMobileService").parent().find(".select2-input").val(service)),e("#divServiceDate").hide(),e("#ddlBusMode").hide()},_common.setTitlePage=function(e){var t={1:"us",2:"gb",3:"ca",4:"au"},i="",r="";if(void 0!==city&&null!=city&&""!=city&&(i=city+","),void 0!==state&&null!=state&&""!=state&&(r=1!=countryid?state+",":state),"undefined"!=typeof PublicPagetitles&&null!=PublicPagetitles)switch(e){case"professionals":if(null!=(s=PublicPagetitles.filter(function(t){return t.Url=="/"+e}))){var o=s[0];document.title=o.City_StateTitle.replace("[Business-Type]",a(businesstypes.split(",")[0])).replace("[City],",a(i)).replace("[State],",r.toUpperCase()).replace("[Country]",1==countryid?"":a(t[countryid]))}break;case"photos":if(null!=(s=PublicPagetitles.filter(function(t){return t.Url=="/"+e}))){o=s[0];document.title=o.City_StateTitle.replace("[Portfolio-Type]",a(portfolioTypes)).replace("[City],",a(i)).replace("[State],",r.toUpperCase()).replace("[Country]",1==countryid?"":a(t[countryid]))}break;case"deals":if(null!=(s=PublicPagetitles.filter(function(t){return t.Url=="/"+e}))){o=s[0];null!=serviceName&&null!=serviceName&&""!=serviceName?document.title=o.City_StateTitle.replace("[Service-Category]",a(serviceName)).replace("[City],",a(i)).replace("[State],",r.toUpperCase()).replace("[Country]",1==countryid?"":a(t[countryid])):document.title=o.City_StateTitle.replace("[Service-Category]",a(businesstypes.split(",")[0])).replace("[City],",a(i)).replace("[State],",r.toUpperCase()).replace("[Country]",1==countryid?"":a(t[countryid]))}break;case"dailydealdetail":if(null!=(s=PublicPagetitles.filter(function(t){return t.Url=="/"+e}))){o=s[0];document.title=a(o.City_StateTitle.replace("[deal-title]",dealtitle).replace("[business-name] ",businessnamed))}break;case"listings":var n=void 0!==title&&null!=title&&""!=title?title:"";if(void 0===title||null==title||""==title||""==title)n=void 0!==businesstypes&&null!=businesstypes&&""!=businesstypes?businesstypes:"salon";title="";var s=PublicPagetitles.filter(function(t){return t.Url=="/"+e});if(null!=BusinessTypeTitles)BusinessTypeTitles.filter(function(e){return e.Type==n});break;case"book":s=PublicPagetitles.filter(function(t){return t.Url=="/"+e});break;default:null!=(s=PublicPagetitles.filter(function(e){return"/Home.aspx"==e.Url}))&&(document.title=a(s[0].City_StateTitle))}},_common.getPager=function(t){return _common.setTitlePage(t),e("#pageSection").removeClass("professional-mobile-filter listing-mobile-filter photoslisting"),"professionals"==t?(e("body").addClass("listing-like-page"),e("#mobile-check").is(":visible")&&e("#pageSection").addClass("professional-mobile-filter"),_common.setPageSatructure(!1,!1),_featured.ProfessionalsPager):"photos"==t?(e("#mobile-check").is(":visible")&&e("#pageSection").addClass("photoslisting"),_common.setPageSatructure(!1,!1),_featured.GalleryPager):"deals"==t?(e("body").addClass("listing-like-page"),_common.setPageSatructure(!1,!0),_featured.PromotionsPager):"book"==t?(e("#mobile-check").is(":visible")&&e("#pageSection").addClass("listing-mobile-filter"),_common.setPageSatructure(!1,!0),_featured.ServicesPager):"class"==t?(e("#mobile-check").is(":visible")&&e("#pageSection").addClass("listing-mobile-filter"),_common.setPageSatructure(!1,!0),_featured.ClassPager):"listings"==t?(e("#mobile-check").is(":visible")&&e("#pageSection").addClass("listing-mobile-filter"),_common.setPageSatructure(!1,!0),_featured.BusinessPager):(_common.setPageSatructure(!0,!1),e("body").removeClass("listing-like-page"),"")};var r=!1;if(null!=typeof getQueryStringData_Wb){String.isNullOrUndefineOrBlank(e("#hdnLoginQueryString").val())||(QueryStringValue=e("#hdnLoginQueryString").val()),String.isNullOrUndefineOrBlank(QueryStringValue)&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL);var o=getQueryStringData_Wb("Type");"Builder"==o&&(r=!0)}0!=r||0!=IsCookieEnabled()&&1!=IsCookieEnabled()||showCoockiePopup(),_common.getShortNameForDesign=function(e,t,i){return String(e).length>t?e.substr(0,i)+"...":e},_common.ShowFeaturedPromotionPopup=function(i,a,r,o){e("#OldServicePriceHome,#NewServicePriceHome").empty(),ShowLoader(!0);e("#ulServicesCombo").validate().resetForm(),e("#ddlPromotionService").parent().removeClass("errorInput"),"detail"==BasePage.toLowerCase()&&null!=o&&e("#btnFeaturedPromotionPopupBook",".promocustompopup").text(o.innerHTML);var n="Detail"!=BasePage;e("#hdPromoBusinessID",".promocustompopup").val(r);var s=new vagaro.ajax;s.datamodel.Token="GetPromotionDetailByPromotionID",s.datamodel.callback=function(r){if(null!=r){if(null!=r.PromoDetails&&r.PromoDetails.length>0){var o=r.PromoDetails[0];e("#btnFeaturedPromotionPopupBook",".promocustompopup").attr("onclick","_common.RedirectToShopDetailPage('"+a+"' , '"+i+"',"+o.IsForNewCustomer+","+o.IsNewCustomer+")"),e("#PromotionTitleHome",".promocustompopup").text(_common.getShortNameForDesign(o.PromotionTitle,67,64)),e("#PromotionTitleHome",".promocustompopup").attr("title",o.PromotionTitle);var n=new Date(parseFloat(o.StartDate.replace(/\/Date\((\d+)\)\//gi,"$1"))).format("mmm dd,yyyy"),s=new Date(parseFloat(o.EndDate.replace(/\/Date\((\d+)\)\//gi,"$1"))).format("mmm dd,yyyy");if(e("#PromotionPeriodHome",".promocustompopup").text(n+" - "+s),e("#PromotionDesHome",".promocustompopup").text(o.PromotionDesc),null!==o.FinePrint&&""!==o.FinePrint?(e("#PromotionLimitHome",".promocustompopup").text(o.FinePrint),e("#PromotionLimitTitle",".promocustompopup").css("display","block")):(e("#PromotionLimitHome",".promocustompopup").text(""),e("#PromotionLimitTitle",".promocustompopup").css("display","none")),null!==o.Image&&""!==o.Image&&e("#PromotionImage",".promocustompopup").css("background-image","url("+o.Image+")"),null!==o.IsForNewCustomer&&!0===o.IsForNewCustomer?e("#imgNewCustomerOnly",".promocustompopup").css("display","block"):e("#imgNewCustomerOnly",".promocustompopup").css("display","none"),null!==o.ServiceOldPrice&&""!==o.ServiceOldPrice){var l="Detail"==BasePage?_shopdetail.currencySymbol:currencysymbol;e("#OldServicePriceHome",".promocustompopup").text(o.ServiceOldPrice).prepend(l),0==o.PromotionDiscount?e("#NewServicePriceHome",".promocustompopup").text(PrmotionfreeCode).removeClass("orange-text"):e("#NewServicePriceHome",".promocustompopup").text(o.PromotionDiscount).prepend(l).removeClass("orange-text")}null!==o.ServiceOldPrice&&""!==o.ServiceOldPrice||null===o.PromotionDiscount||""===o.PromotionDiscount||(e("#OldServicePriceHome",".promocustompopup").text(""),e("#NewServicePriceHome",".promocustompopup").text(o.PromotionDiscount+"% off").addClass("orange-text")),e("#hdnSalontime").val(o.SalonTime)}if("Detail"!=BasePage){if(null!=r.PromoBusinessDetail){e("#PromoBusinessDetails",".promocustompopup").css("display","block");var d=r.PromoBusinessDetail;if(e(".promoBusinessName a").text(d.BusinessName).attr("href",t.location.protocol+"//"+t.location.host+"/"+d.VagaroURL),e(".BusinessDescription").text(null!=d.Description?d.Description:""),e(".promoOverallRating").text(parseFloat(d.VenueRank).toFixed(1)),_common.clearRating(e(".promoOverallRatingStar")),e(".promoReviewText").text(d.ReviewCount+(d.ReviewCount>1?" reviews":" review")),_common.clearRating(e(".promoOverall")),_common.clearRating(e(".promoPunct")),_common.clearRating(e(".promoValue")),_common.clearRating(e(".promoService")),e(".promoOverallRatingStar").prop("value",Math.round(d.VenueRank)-1).rating(),e(".promoOverall").prop("value",Math.round(d.VenueRank)-1).rating(),e(".promoPunct").prop("value",Math.round(d.PunctualityRank)-1).rating(),e(".promoValue").prop("value",Math.round(d.ValueRank)-1).rating(),e(".promoService").prop("value",Math.round(d.ServiceRank)-1).rating(),address=(null!=d.Street?d.Street.replace("  "," ")+", ":"")+(null!=d.City?d.City.replace("'","\\'")+", ":"")+(null!=d.StateName?d.StateName.replace("'","\\'")+" ":"")+(null!=d.Zip?d.Zip:""),e(".BusinessAddress").text(address),address=address.replace("#"," No "),",46583,30840,98,20400,50339,50400,63412,".indexOf(","+d.BusinessID+",")>-1&&null!=d.LATITUDE&&0!=d.LATITUDE&&null!=d.LONGITUDE&&0!=d.LONGITUDE){var c=d.LATITUDE+","+d.LONGITUDE;e("#hdnBusinessAddress").val(c),e(".staticAddressImg").attr("src","https://maps.googleapis.com/maps/api/staticmap?center="+c+"&zoom=12&size=635x220&style=feature:poi|visibility:off&markers=icon:https://vagaro.azureedge.net/static-content/Images/flamingo-map-newicon-new@2x.png|"+c+"&key="+googleKeyFormap)}else e("#hdnBusinessAddress").val(address),e(".staticAddressImg").attr("src","https://maps.googleapis.com/maps/api/staticmap?center="+address+"&zoom=12&size=635x220&style=feature:poi|visibility:off&markers=icon:https://vagaro.azureedge.net/static-content/Images/flamingo-map-newicon-new@2x.png|"+address+"&key="+googleKeyFormap);""!=lattitude&&""!=longitude&&null!=lattitude&&null!=longitude?(e(".promo-mile-col").css("display","block"),e(".BusinessMiles").text(d.DistanceToCentroid+" "+d.distanceUnit+".")):(e(".promo-mile-col").css("display","none"),e(".BusinessMiles").text("0 "+d.distanceUnit+"."))}else e("#PromoBusinessDetails",".promocustompopup").css("display","none");if(null!=r.PromoReviewDetail){var u=r.PromoReviewDetail,p=e(".ulReviewBar",".promocustompopup");u.length>0&&(p.html(""),e(u).each(function(){e("<li><label>"+this.Review+' stars</label><div class="promo-review-per-col"><div style="width: '+this.ReviewPercent+'%"><span>'+this.ReviewAvg+"</span></div></div></li>").appendTo(p)}))}}e(".promo-scrollbox").scrollTop(e(".promo-scrollbox")[0].scrollHeight),e(".promo-scrollbox").enscroll({showOnHover:!1,verticalTrackClass:"promoslidertrack",verticalHandleClass:"promosliderhandle"});var h=new vagaro.ajax;h.datamodel.Token="GetPromotionDataWithServicesByPromotionID",h.datamodel.callback=_common.GetPromotionsByPromotionIDCallback,h.datamodel.data=[o.PromotionID,o.BusinessID],h.datamodel.Error=function(e){},h.Post()}},s.datamodel.data=[i,lattitude,longitude,UserID,n],s.datamodel.Error=function(e){},s.Post()},_common.clearRating=function(t){e(t).prev().html(""),e(t).val(-1)};var n=e("<optGroup />");function s(t,i){e("[id$='btnbookService']").focus()}_common.GetPromotionsByPromotionIDCallback=function(t){var i=e("#ddlPromotionService",".promocustompopup");i.html(""),e("<option />",{val:"",text:"Select Service"}).appendTo(i),t.length>0?(e("#ulServicesCombo",".promocustompopup").css("display","block"),i.children("option:not(:first)").remove(),e(t).each(function(a){(0==a||a>0&&void 0!==this.ParentServiceID&&this.ParentServiceID!=t[a-1].ParentServiceID)&&(n=e("<optGroup />")).attr("label",this.ParentServiceTitle).appendTo(i),e("<option />",{val:this.ServiceID,text:this.ServiceTitle}).appendTo(n)})):(e("#ulServicesCombo",".promocustompopup").css("display","none"),i.val("0"),i.children("option:not(:first)").remove());var a='"lBusinessID" :"'+e("#hdPromoBusinessID",".promocustompopup").val()+'"';CallWebServicehed("MySampleService.asmx/GetAvailableDates",a+=',"spID" :""',_common.GetCalendarAvailableDatesCallback,_common.CallFailed)},_common.CallFailed=function(){vagaro.alert("Some Error occured")},_common.RedirectToShopDetailPage=function(t,i,a,r,o,n){var s,d,c=0,u=0;if(_common.VisibleControlLength("#dvDelasFromMobile")>0?e("#dvDelasFromMobile").is(":visible")?(s=_common.GetChoiceForSeleect2(e("#dvDealMobileService")),d=getdatepickervalue("#txtServiceDateMobile",null,!0)):swal({title:"",text:e("#hdnDealBusinessName").val()+" does not accept online appointments.Please call "+e("#hdnDealBusinessPhoneNumber").val()+" to make an appointment by phone.",showCancelButton:!1}):e("#dvDealWebService").is(":visible")?(s=_common.GetChoiceForSeleect2(e("#dvDealWebService")),d=getdatepickervalue("#txtServiceDateWeb")):swal({title:"",text:e("#hdnDealBusinessName").val()+" does not accept online appointments.Please call "+e("#hdnDealBusinessPhoneNumber").val()+" to make an appointment by phone.",showCancelButton:!1}),void 0!==s.id&&""!=s.id){if(e(".select2-container.ddlPromotionService").removeClass("errorInput"),c=s.id,"undefined"==s||String.isNullOrUndefineOrBlank(s.ItemTypeID)||(u=s.ItemTypeID),void 0!==l&&1==l&&(i=""),""!=s.id){var p,h;p=d.format("mmm dd,yyyy"),h=d.format("hh:nn");var m=_common.SetMessageForConfirm(o,r,a);return""!==UserID&&UserID>0&&""!=m?bootbox.confirm({title:"Confirm",message:m,buttons:{cancel:{label:"Cancel"},confirm:{label:"Continue"}},callback:function(e){e&&_common.ConfirmRedirectToShopDetailPage(t,"",c,p,h,u,n)}}):_common.ConfirmRedirectToShopDetailPage(t,i,c,p,h,u,n),!1}}else e(".select2-container.ddlPromotionService").addClass("errorInput")},_common.RedirectToShopDetailPageFromGC=function(t,i,a,r,o){var n,s=0,d=0;if(_common.VisibleControlLength("#dvDelasFromMobile")>0?e("#dvDelasFromMobile").is(":visible")?n=_common.GetChoiceForSeleect2(e("#dvDealMobileGC")):swal({title:"",text:e("#hdnDealBusinessName").val()+" does not accept online appointments.Please call "+e("#hdnDealBusinessPhoneNumber").val()+" to make an appointment by phone.",showCancelButton:!1}):e("#dvGCPurchase").is(":visible")?n=_common.GetChoiceForSeleect2(e("#dvGCPurchase")):swal({title:"",text:e("#hdnDealBusinessName").val()+" does not accept online appointments.Please call "+e("#hdnDealBusinessPhoneNumber").val()+" to make an appointment by phone.",showCancelButton:!1}),void 0!==n.id&&""!=n.id){if(e(".select2-container.gc-service-select").removeClass("errorInput"),s=n.id,"undefined"==n||String.isNullOrUndefineOrBlank(n.ItemTypeID)||(d=n.ItemTypeID),void 0!==l&&1==l&&(i=""),""!=n.id){var c=_common.SetMessageForConfirm(o,r,a);return""!==UserID&&UserID>0&&""!=c?bootbox.confirm({title:"Confirm",message:c,buttons:{cancel:{label:"Cancel"},confirm:{label:"Continue"}},callback:function(e){e&&_common.ConfirmRedirectToShopDetailPage(t,"",s,"","",d)}}):_common.ConfirmRedirectToShopDetailPage(t,i,s,"","",d),!1}}else e(".select2-container.gc-service-select").addClass("errorInput")},_common.SetMessageForConfirm=function(e,t,i){var a="";return void 0!==e?"2"===e&&!1===t?a="This promotion is for new clients only. It won't be applicable for you.<br/>Are you sure want to continue?":"1"===e&&!0===t&&(a="This promotion is for existing clients only. It won't be applicable for you.<br/>Are you sure want to continue?"):!0===i&&!1===t&&(a="This promotion is for new clients only. It won't be applicable for you.<br/>Are you sure want to continue?"),a},_common.ConfirmRedirectToShopDetailPage=function(i,a,r,o,n,s,l){if("Home"==BasePage||"MyAccount"==BasePage||"DailyDeal"==BasePage||"Detail"==BasePage)if(setCookie("PromotionID",a),cookieManager.setCookie("Referral",BasePage,.0833,cookieManager.defaultPath,cookieManager.defaultDomain,!0,!1),5==s?setCookie("gcAmount",r):(setCookie("BookingDate",o),setCookie("ServiceID",r),setCookie("BookingTime",n),void 0!==l&&null!=l&&""!=l&&setCookie("PromotionPIds",l)),8==s||20==s)"MyAccount"==BasePage&&(null!=isWidget&&"true"==isWidget||null!=isFacebook&&"true"==isFacebook)?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/classes?IsFacebookPage="+(null!=isFacebook&&"true"==isFacebook?"true":"false")+"&IsBusinessWidgetPage="+(null!=isWidget&&"true"==isWidget?"true":"false")+"&TabsIncluded="+_shopdetail.TabsIncluded+"&IsFromMyAccount=1":void 0!==getQueryStringData&&String.isNullOrUndefineOrBlank(0==getQueryStringData("connectai"))&&"true"==getQueryStringData("connectai")?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/classes/connectai":void 0!==getQueryStringData&&String.isNullOrUndefineOrBlank(0==getQueryStringData("connect"))&&"true"==getQueryStringData("connect")?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/classes/connect":window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/classes";else if(5==s)"MyAccount"==BasePage&&(null!=isWidget&&"true"==isWidget||null!=isFacebook&&"true"==isFacebook)?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/gift-certificates?IsFacebookPage="+(null!=isFacebook&&"true"==isFacebook?"true":"false")+"&IsBusinessWidgetPage="+(null!=isWidget&&"true"==isWidget?"true":"false")+"&TabsIncluded="+_shopdetail.TabsIncluded+"&IsFromMyAccount=1":void 0!==getQueryStringData&&String.isNullOrUndefineOrBlank(0==getQueryStringData("connectai"))&&"true"==getQueryStringData("connectai")?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/gift-certificates/connectai":void 0!==getQueryStringData&&String.isNullOrUndefineOrBlank(0==getQueryStringData("connect"))&&"true"==getQueryStringData("connect")?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/gift-certificates/connect":window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/gift-certificates";else if("MyAccount"==BasePage&&(null!=isWidget&&"true"==isWidget||null!=isFacebook&&"true"==isFacebook))window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/book-now?IsFacebookPage="+(null!=isFacebook&&"true"==isFacebook?"true":"false")+"&IsBusinessWidgetPage="+(null!=isWidget&&"true"==isWidget?"true":"false")+"&TabsIncluded="+_shopdetail.TabsIncluded+"&IsFromMyAccount=1";else{try{var d={Action:"Book Now",Category:"Deal",PageName:"Deal"};null!=e("#lblSalonName")&&null!=e("#lblSalonName").text()&&(d.BusinessName=e("#lblSalonName").text()),null!=e("#hdnBusinessId")&&null!=e("#hdnBusinessId").val()&&(d.BusinessID=parseInt(""==e("#hdnBusinessId").val()?"0":e("#hdnBusinessId").val())),d.isDealDetails=!0,d.IsListPage=!0,d.IsMapPage=!1,d.isFiltered=!1,null!=e("#lblPromotionTitleHome")&&null!=e("#lblPromotionTitleHome").text()&&(d.DealName=e("#lblPromotionTitleHome").text()),_vgLogEvent.LogData(d)}catch(e){}void 0!==getQueryStringData&&String.isNullOrUndefineOrBlank(0==getQueryStringData("connectai"))&&"true"==getQueryStringData("connectai")?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/book-now/connectai":void 0!==getQueryStringData&&String.isNullOrUndefineOrBlank(0==getQueryStringData("connect"))&&"true"==getQueryStringData("connect")?window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/book-now/connect":window.location=t.location.protocol+"//"+t.location.host+"/"+i+"/book-now"}else{e("#dvDailyDealsDetail").hide(),e("#pageSection").show().addClass("pagesectionFlex");var c=o;_shopdetail.SetBookData(r,"","","",c,a)}bootbox.hideAll()},_common.hideSocialIcons=function(t){e(".share-popup").hide(),e(".gallery-solo-image").removeClass("active")},e("#dvAdvanceFilter").mouseup(function(t){var i=e("#professionalFilter"),a=e(".filters-div");a.is(t.target)||0!==a.has(t.target).length||i.is(t.target)||0!==i.has(t.target).length||(e(".filter-background").hide(),e("html, body").removeClass("overflowHidden"))}),e("#divGalleryFilter").mouseup(function(t){var i=e("#divFilterSection"),a=e(".filters-div");a.is(t.target)||0!==a.has(t.target).length||i.is(t.target)||0!==i.has(t.target).length||(e(".filter-background").hide(),e("html, body").removeClass("overflowHidden"))}),_common.ShowHideSocialIcons=function(t){var i=e(t).closest(".gallery-solo-image");_featured.fetchStylistName(i,t)},_common.PostonFacebook=function(t,i,a){var r=e(t).closest(".brick"),o="",n="",s="",l="",d="",c="",u="",p="";if("Stylist"==i)o=e("#spnProviderName_"+_common.businessID+"_"+_common.curtemp.data().spid,r).html(unescape(escape(i.Spname))),d=e(r).find("#spnAddress").data().businessname,n=e(r).find("#spnAddress").data().address,s=location.protocol+"//"+location.host+"/"+e("#arating",r).attr("href"),l=e("#imgServiceProvider",r).attr("src"),p="Service Provider has been posted.";else if("Photos"==i)(void 0===(r=e(t).parents(".cust-img-popup-slider"))||null==r||r.length<=0)&&(r=e(img).parents(".gallery-solo-image")),l=e("#imgServiceImage_"+_common.curtemp.data().styleid,r).attr("src"),d=e("#divSalonName_"+_common.curtemp.data().styleid.styleid,r).html(),c=r.data().servicetitle,u=r.data().styletitle,s=location.protocol+"//"+location.host+"/"+r.data().vagarourl.toLowerCase()+"/styles",p="Portfolio has been posted.";else if("Deals"==i){d=e("#lblPromotionTitleHome").text();var h=e("#hdnScTitletimestamp").val(),m=e("#hdnScVagarourl").val();u=e("#promotionDesHome",".deals-text-cont").text(),l=e("#imgPromotion").attr("src"),s=location.protocol+"//"+location.host+"/"+m+"/deals/"+h,p="Deals has been posted."}else"BusinessDetail"==i&&(l=a.imageUrl,d=a.BusinessName,s=location.protocol+"//"+location.host+"/"+a.vagaroUrl.toLowerCase(),p="Business has been posted.");if("undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("promotionsharefacebook|"+s+"|"+c)}catch(e){}else $FacebookLoader(function(){FBAPP.funcPostfeature(unescape(d),o,n,s,c,u,l,i,function(e){null!=e.id&&null!=e.id&&vagaro.alert(p)})})},_common.PostOnTwitter=function(e){var t="https://twitter.com/intent/tweet?url="+(e=unescape(e).replace(/<br *\/?>/gi,"\n"));if(t=encodeURI(t),"undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("promotionsharetwitter|"+t)}catch(e){}else{var i=screen.width/2-300,a=screen.height/2-160,r=window.open(t,"shareWindow","toolbar=no,location=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=600,height=320,left="+i+",top="+a);r&&!r.closed&&void 0!==r&&void 0!==r.closed||vagaro.alert("Window cannot be opened as popup is blocked in your browser")}return!1},_common.DealDetailPage=function(){_siteBuilderSocialMedia.PostOnPint(PinUrl)},_common.setviewport=function(t){var i=window.orientation,a=0===i||180==i,r=a?e(window).outerHeight():e(window).outerWidth(),o=e(window).outerHeight(),n=Math.min(r,o);a&&(n=Math.max(r,o)),"page-content-wrapper"==ScrollTarget.attr("id")&&(e("#dvPageContent").hasClass("paddingtop50")?ScrollTarget.css("height",n-45-50):ScrollTarget.css("height",n-45));e("#page-content-wrapper").height();var s,l,d=parseInt(e("#divServiceMap").height())+parseInt(e("#divServicePromotions").height()),c=e("#footer").outerHeight(),u=parseInt(o)-(parseInt(0)+parseInt(c)),p=parseInt(d)+15;if(parseInt(p)>parseInt(u)?e("#divServicePromotions").hide():e("#servicePromotion div").length>0?e("#divServicePromotions").show():e("#divServicePromotions").hide(),navigator.userAgent.match(/iPad/i)&&e("html").addClass("ipad"),e("#map_canvas").css("height",u),e("#contact-min-height").length,e("#page-height-min").length>0&&e("#page-height-min").css("min-height",n-46),"detail"==t)if("true"==_shopdetail.isCustomWebsite)s=e("#imgCustomBanner").height();else{s=e("#imgStandardBanner").height();var h=e("#tabs").height();l=parseInt(o)-(parseInt(s)+parseInt(h)+parseInt(c)),1==_shopdetail.isWidget&&(l-=55),l>600?e("#my-tab-content").css("min-height",l):e("#my-tab-content").css("min-height","200px")}0==_common.hasLatLongCookie()&&centerModal(e("#locationpopup")),window.location.href.indexOf(_common.liveStreamClasses)>=0&&setTimeout(function(){setCategoryWidthheight()},1500)},_common.removeEmojis=function(t){try{var i=e(t);void 0===i||String.isNullOrUndefineOrBlank(i.val())||i.val(i.val().replace(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g,""))}catch(e){}},_common.numeric=function(e,t,i,a){parseInt(t,10)<a||isNaN(t)?e.value=t:parseInt(t,10)>a?e.value=a:e.value=t},_common.toggleGCEmailRequired=function(){var t=e("#txtfullname").val().trim(),i=e("#txtGCEmail");""===t?(i.prop("required",!1),i.removeClass("errorInput"),i.parent().removeClass("form-row-invalid"),e("#txtGCEmail-error").hide()):i.prop("required",!0)},_common.GetCalendarAvailableDatesCallback=function(t){e("#hdnSalonstime").val();var i=t.d[0]+" "+e("#hdnSalonstime").val(),a=moment(i,"MMM DD,YYYY hh:mm a")._d,r=new Date(a),o=r.format("nn"),n=parseInt(parseInt(o)%5);n>0&&(o=o-n+5,r.setMinutes(o)),applydatepicker({divid:"#divServiceDateWeb",textid:"#txtServiceDateWeb",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),defaultDateTime:r,arrValidDates:t.d,pickTime:!1,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,callBackOnChange:d,callBackOnHide:s}),applydatepicker({divid:"#divServiceDateMobile",textid:"#txtServiceDateMobile",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),defaultDateTime:r,arrValidDates:t.d,pickTime:!1,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,callBackOnChange:d}),ShowLoader(!1)};var l=!1;function d(t){var i=e("#hdnPromotionStartDate").val(),a=e("#hdnPromotionEndDate").val();if(void 0!==i&&""!=i&&void 0!==a){var r=moment(t.formatdate("MMM DD, YYYY")),o=moment(moment(i).format("MMM DD, YYYY")),n=!1,s="";if(""!=a){var d=moment(moment(a).format("MMM DD, YYYY"));(o.diff(r,"min")>0||r.diff(d,"min")>0)&&(n=!0,s="The date selected is outside of "+o.format(DatePickerFormat(VagaroCountryDateFormat.MiniDate))+" - "+d.format(DatePickerFormat(VagaroCountryDateFormat.MiniDate))+". If you continue, the daily deal will not be applied.")}else o.diff(r,"min")>0&&(n=!0,s="The deal will be applicable from "+o.format("MMM")+" "+o.format("D")+". If you continue, the daily deal will not be applied.");l=!1,1==n&&bootbox.dialog({title:"Regular Price",className:"checkout-center-modal bootbox-confirm",message:s,buttons:{ok:{label:"Continue",className:"thm-greyButton book-daily-btn w-button thm-contentButton flamingo-button",callback:function(){l=!0,e(".booknow").click()}}}})}}function c(e){var t,i,a=(e=e.split("")).length;for(t=0;t<a;t++)-1!=(i="ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž".indexOf(e[t]))&&(e[t]="AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"[i]);return e.join("")}function u(e){for(var t=["/"," "],i=e,a=0;a<e.length;a++)-1!=t.indexOf(e[a])&&(i=" "==e[a]?i.replace(e[a],"-"):i.replace(e[a],""));return i}_common.destroyDateTimePicker=function(e){null!=e&&e.length>0&&e.data("DateTimePicker").destroy()},_common.isTouchDevice=function(){return"ontouchstart"in document.documentElement},_common.AddState=function(t,i){var a="";null!=promotionalURL&&null!=promotionalURL&&promotionalURL.length>0&&(a="/"+promotionalURL);var r=!0,o="",n={1:"us",2:"--gb",3:"--ca",4:"--au"},s=getCookie(ProximityCookieName),l="",d="",p="",h="";null!=s&&void 0!==s&&LoadCitiesAndServices(s.countryid);var m="";if(void 0!==getCookie("connectroute")&&null!=getCookie("connectroute")&&getCookie("connectroute")?m="/connect":void 0!==getCookie("connectairoute")&&null!=getCookie("connectairoute")&&getCookie("connectairoute")?m="/connectai":"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&isFromTextMarketing&&window.location.pathname.indexOf("/promotiontm/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0?m=window.location.pathname.substring(window.location.pathname.indexOf("/promotiontm/")):"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&!isFromTextMarketing&&window.location.pathname.indexOf("/promotion/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0&&(m=window.location.pathname.substring(window.location.pathname.indexOf("/promotion/"))),null!=s&&void 0!==s&&(null!=s.city&&void 0!==s.city&&""!=s.city&&(l=s.city.toLowerCase().replace(" ","-").trim()+"--",d=s.city.toLowerCase().trim().replace(/\s+/g,"-")),null!=s.state&&void 0!==s.state&&""!=s.state&&(p=2==s.countryid?s.stateName.toLowerCase().replace(" ","-").trim():s.state.toLowerCase().trim()),null!=s.countryid&&void 0!==s.countryid&&""!=s.countryid&&(h=s.countryid)),l=c(u(l)),d=c(u(d)),window.history&&history.pushState)if("Home"==BasePage){var f={basepage:BasePage,sectionName:t};if("home"==t||"/"==t||""==t)history.pushState(f,t,"/");else if(t.indexOf("dealsindividual")>=0)t=t.split("dealsindividual")[0],history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t);else if("book"==t||"class"==t){var g=window.location.pathname;if(""!=service&&void 0!==service&&null!=service&&g.endsWith("/listings")||e("#hdnSelectedBusinessType").val())if(""!=urlService&&null!=urlService){var v=/\s\s+/g,A=/[^0-9a-zA-Z\" \"]+/gi;window.location.href=(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",urlService.toLowerCase().trim().replace(v," ").replace(A,"").replace(/ /g,"-"),"/",l,p,1==h?"":n[h])}else{v=/\s\s+/g,A=/[^0-9a-zA-Z\" \"]+/gi;window.location.href=(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",service.toLowerCase().trim().replace(v," ").replace(A,"").replace(/ /g,"-"),"/",l,p,1==h?"":n[h])}else if(void 0!==urlService&&""!=urlService&&null!=urlService){var C="",y=service;if(void 0!==y&&""!=y){var b=AdminServiceList.results;if(b&&b.length>0){var S=findObjectBytext(b,y);C=null!=S?S.url:service}}if(void 0===C||""==C||g.endsWith("/login")||g.endsWith("/pro-login"))if(g.endsWith("/login")||g.endsWith("/pro-login")){v=/\s\s+/g,A=/[^0-9a-zA-Z\" \"]+/gi;window.location.href=(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",service.toLowerCase().trim().replace(v," ").replace(A,"").replace(/ /g,"-"),"/",l,p,1==h?"":n[h])}else{v=/\s\s+/g,A=/[^0-9a-zA-Z\" \"]+/gi;history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",service.toLowerCase().trim().replace(v," ").replace(A,"").replace(/ /g,"-"),"/",l,p,1==h?"":n[h]))}else{t="book";var v=/\s\s+/g,A=/[^0-9a-zA-Z\" \"]+/gi;history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",C.toLowerCase().trim().replace(v," ").replace(A,"").replace(/ /g,"-"),"/",l,p,1==h?"":n[h]))}}else{t="book";v=/\s\s+/g,A=/[^0-9a-zA-Z\" \"]+/gi;history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",service.toLowerCase().trim().replace(v," ").replace(A,"").replace(/ /g,"-"),"/",l,p,1==h?"":n[h]))}}else if("photos"==t)e(".nDropDownMenusFilterMyLikes #aMyLikesOption_filter_1").hasClass("myLikeAll-active")?history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+myLikedStyleUrlValue):""!=styleCategoryName&&void 0!==styleCategoryName&&null!=styleCategoryName?history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",styleCategoryName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,p,1==h?"":n[h])):history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",l,p,1==h?"":n[h]));else if(t==_common.liveStreamClasses){f={basepage:BasePage,sectionName:t,subTab:_gblLiveStreamSearchServiceName};"undefined"!=typeof _gblLiveStreamSearchServiceName&&null!=_gblLiveStreamSearchServiceName&&""!=_gblLiveStreamSearchServiceName?history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+o.concat("/",_gblLiveStreamSearchServiceName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"))):history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t)}else{g=window.location.pathname;void 0!==category&&""!=category&&null!=category?history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",category.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",d,"--",p,1==h?"":n[h])):g.endsWith("/listings")||e("#hdnSelectedBusinessType").val()||g.endsWith("/login")||g.endsWith("/pro-login")?window.location.href=(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",l,p,1==h?"":n[h]):history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+a+o.concat("/",l,p,1==h?"":n[h])),category=""}}else if("MyAccount"==BasePage){if(t.indexOf("dealsindividual")>=0)t=t.split("dealsindividual")[0],history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t);else if("home"!=t&&"photos"!=t&&"professionals"!=t&&"deals"!=t){f={basepage:BasePage,sectionName:t,subTab:i};var k="";(D=location.href.split("?")).length>=2&&(k="?"+D[1]),document.referrer.indexOf("/cl/")>=0||window.location.href.indexOf("/cl/")>=0||document.referrer.indexOf("partner=fb")>=0||window.location.href.indexOf("partner=fb")>=0?history.pushState(f,t,document.referrer.indexOf("/cl/")>=0||window.location.href.indexOf("/cl/")>=0?document.referrer.split("?")[0]:document.referrer):history.pushState(f,t,(window.location.href.match("/$")?"../":"/myaccount/")+t+k)}}else if("detail"==BasePage.toLowerCase()){if(null!=t&&null!=t&&""!=t&&GetSelectedMenuObject(t).length<0&&t.indexOf("dealsindividual")<0)return;var D;k="";(D=location.href.split("?")).length>=2&&(k="?"+D[1]);f={basepage:BasePage,sectionName:t,subTab:i};if(window.location.href.indexOf("BusinessWidget.aspx")>=0||window.location.href.indexOf("/cl/")>=0||document.referrer.indexOf("partner=fb")>=0||window.location.href.indexOf("partner=fb")>=0)history.pushState(f,t,window.location.href);else if(null!=t&&null!=t&&""!=t&&t.indexOf("dealsindividual")>=0)(t=t.split("dealsindividual")[0]).indexOf("isdeal")>=0&&k.indexOf("isdeal")>=0&&(t=t.split("?")[0]),history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t+m+k);else if(null!=t&&null!==t&&""!==t&&t.indexOf("shopping-bag")>=0&&window.location.href.indexOf("invoice")>=0)history.pushState(f,t,window.location.href);else if(window.location.href.indexOf("?qsp")>=0&&"addreview"!=t){var _=window.location.toString(),I=_.substring(0,_.indexOf("?"));window.history.replaceState({},document.title,I),history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+(IsVagaroDomain()?vagaroUrl.toLowerCase()+"/":"")+t+m)}else history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+(IsVagaroDomain()?"about"==f.subTab.trim()?vagaroUrl.toLowerCase():vagaroUrl.toLowerCase()+"/":"")+t+m+k)}else if("dailydeal"==BasePage.toLowerCase()){f={basepage:BasePage,sectionName:t,subTab:"dailydeal"};void 0!==t&&null!=t&&""!=t&&t.indexOf("dealsindividual")>=0&&(t=t.split("dealsindividual")[0],history.pushState(f,t,(window.location.href.match("/$")?"../":"/")+t))}else{if("businesstypecategory"!=BasePage.toLowerCase())return!1;f={basepage:BasePage,sectionName:t,subTab:"BusinessTypeCategory"};if(void 0!==t&&null!=t&&""!=t&&t.indexOf("listings")>=0){var w=window.location.href+o.concat("/",l,p,1==h?"":n[h]);return $url=e("<a/>"),$url.attr("href",w),$url[0].click(),!0}}else r=!1;if(""!=styleCategoryName&&void 0!==styleCategoryName&&null!=styleCategoryName?e("#photos").attr("href",(window.location.href.match("/$")?"../":"/")+"photos"+a+o.concat("/",styleCategoryName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,p,1==h?"":n[h])):e("#photos").attr("href",(window.location.href.match("/$")?"../":"/")+"photos"+a+o.concat("/",l,p,1==h?"":n[h])),""!=businesstypes&&void 0!==businesstypes&&null!=businesstypes?(e("#listings").attr("href",(window.location.href.match("/$")?"../":"/")+"listings"+a+o.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",d,"--",p,1==h?"":n[h])),e("#aSeeAllPopularBusiness").attr("href","/listings"+a+o.concat("/",l,p,1==h?"":n[h])),e("#professionals").attr("href",(window.location.href.match("/$")?"../":"/")+"professionals"+a+o.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",d,"--",p,1==h?"":n[h])),e("#deals").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+o.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",d,"--",p,1==h?"":n[h])),e("#aSeeAllDeals").attr("href","/deals"+a+o.concat("/",l,p,1==h?"":n[h])),e("#dailyDealsFooter").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+o.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",d,"--",p,1==h?"":n[h])),null!=s&&void 0!==s&&(null!=s.countryid&&void 0!==s.countryid&&"2"==s.countryid?(l=(l=l.replace(/--+/g,"").replace(/-/g," ")).replace(/\b\w/g,function(e){return e.toUpperCase()}),e("#h2LocationName").text("Featured in "+l).attr("aria-label",l)):(l=(l=l.replace(/--+/g,"").replace(/-/g," ")).replace(/\b\w/g,function(e){return e.toUpperCase()}),e("#h2LocationName").text("Featured in "+_common.SetCityState(l,p,h)).attr("aria-label",_common.SetCityState(l,p,h))))):(e("#listings").attr("href",(window.location.href.match("/$")?"../":"/")+"listings"+a+o.concat("/",l,p,1==h?"":n[h])),e("#aSeeAllPopularBusiness").attr("href","/listings"+a+o.concat("/",l,p,1==h?"":n[h])),e("#professionals").attr("href",(window.location.href.match("/$")?"../":"/")+"professionals"+a+o.concat("/",l,p,1==h?"":n[h])),e("#deals").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+o.concat("/",l,p,1==h?"":n[h])),e("#aSeeAllDeals").attr("href","/deals"+a+o.concat("/",l,p,1==h?"":n[h])),e("#dailyDealsFooter").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+o.concat("/",l,p,1==h?"":n[h])),null!=s&&void 0!==s&&(null!=s.countryid&&void 0!==s.countryid&&"2"==s.countryid?(l=(l=l.replace(/--+/g,"").replace(/-/g," ")).replace(/\b\w/g,function(e){return e.toUpperCase()}),e("#h2LocationName").text("Featured in "+l).attr("aria-label",l)):(l=(l=l.replace(/--+/g,"").replace(/-/g," ")).replace(/\b\w/g,function(e){return e.toUpperCase()}),e("#h2LocationName").text("Featured in "+_common.SetCityState(l,p,h)).attr("aria-label",_common.SetCityState(l,p,h))))),"detail"!=BasePage.toLowerCase()&&"home"!=BasePage.toLowerCase()){e.each(["hair","spa","med-spa","barber","deals"],function(t,i){var a="";if("deals"===i)a="/deals"+o.concat("/",l,p,1==h?"":n[h]);else{var r=o;a=0===r.indexOf("/listings/"+i)?r:"/listings/"+i+o.concat("/",l,p,1==h?"":n[h])}e('[data-path="'+i+'"]').attr("href",a)})}return r},_common.Getbeautylink=function(t,i){var a="";null!=promotionalURL&&null!=promotionalURL&&promotionalURL.length>0&&(a="/"+promotionalURL);var r="",o={1:"us",2:"--gb",3:"--ca",4:"--au"},n=getCookie(ProximityCookieName),s="",l="",d="",p="";if(null!=n&&void 0!==n&&(null!=n.city&&void 0!==n.city&&""!=n.city&&(s=n.city.toLowerCase().replace(" ","-").trim()+"--",l=n.city.toLowerCase().trim().replace(/\s+/g,"-")),null!=n.state&&void 0!==n.state&&""!=n.state&&(d=2==n.countryid?n.stateName.toLowerCase().replace(" ","-").trim():n.state.toLowerCase().trim()),null!=n.countryid&&void 0!==n.countryid&&""!=n.countryid&&(p=n.countryid)),s=c(u(s)),l=c(u(l)),window.history&&history.pushState)if("Home"==BasePage){var h={basepage:BasePage,sectionName:t};if("home"==t||"/"==t||""==t)BeautyHrefLink="/";else if(t.indexOf("dealsindividual")>=0)t=t.split("dealsindividual")[0],BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+t;else if("book"==t||"class"==t){if(""!=service&&void 0!==service&&null!=service){BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+t+a+r.concat("/",service.toLowerCase().trim().replace(/\s\s+/g," ").replace(/[^0-9a-zA-Z\" \"]+/gi,"").replace(/ /g,"-"),"/",s,d,1==p?"":o[p])}}else if("photos"==t)BeautyHrefLink=""!=styleCategoryName&&void 0!==styleCategoryName&&null!=styleCategoryName?(window.location.href.match("/$")?"../":"/")+t+a+r.concat("/",styleCategoryName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",s,d,1==p?"":o[p]):(window.location.href.match("/$")?"../":"/")+t+a+r.concat("/",s,d,1==p?"":o[p]);else if(t==_common.liveStreamClasses){h={basepage:BasePage,sectionName:t,subTab:_gblLiveStreamSearchServiceName};BeautyHrefLink="undefined"!=typeof _gblLiveStreamSearchServiceName&&null!=_gblLiveStreamSearchServiceName&&""!=_gblLiveStreamSearchServiceName?(window.location.href.match("/$")?"../":"/")+t+r.concat("/",_gblLiveStreamSearchServiceName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-")):(window.location.href.match("/$")?"../":"/")+t}else BeautyHrefLink=""!=businesstypes&&void 0!==businesstypes&&null!=businesstypes?(window.location.href.match("/$")?"../":"/")+t+a+r.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==p?"":o[p]):(window.location.href.match("/$")?"../":"/")+t+a+r.concat("/",s,d,1==p?"":o[p])}else if("MyAccount"==BasePage){if(t.indexOf("dealsindividual")>=0)t=t.split("dealsindividual")[0],BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+t;else if("home"!=t&&"photos"!=t&&"professionals"!=t&&"deals"!=t){h={basepage:BasePage,sectionName:t,subTab:i};var m="";(f=location.href.split("?")).length>=2&&(m="?"+f[1]),BeautyHrefLink=(window.location.href.match("/$")?"../":"/myaccount/")+t+m}}else if("detail"==BasePage.toLowerCase()){if(null!=t&&null!=t&&""!=t&&GetSelectedMenuObject(t).length<0&&t.indexOf("dealsindividual")<0)return;var f;m="";(f=location.href.split("?")).length>=2&&(m="?"+f[1]);h={basepage:BasePage,sectionName:t,subTab:i};if(window.location.href.indexOf("BusinessWidget.aspx")>=0)BeautyHrefLink=window.location.href;else if(null!=t&&null!=t&&""!=t&&t.indexOf("dealsindividual")>=0)(t=t.split("dealsindividual")[0]).indexOf("isdeal")>=0&&m.indexOf("isdeal")>=0&&(t=t.split("?")[0]),BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+t+m;else if(null!=t&&null!==t&&""!==t&&t.indexOf("shopping-bag")>=0&&window.location.href.indexOf("invoice")>=0)BeautyHrefLink=window.location.href;else if(window.location.href.indexOf("?qsp")>=0&&"addreview"!=t){var g=window.location.toString(),v=g.substring(0,g.indexOf("?"));window.history.replaceState({},document.title,v),BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+(IsVagaroDomain()?vagaroUrl.toLowerCase()+"/":"")+t}else BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+(IsVagaroDomain()?"about"==h.subTab.trim()?vagaroUrl.toLowerCase():vagaroUrl.toLowerCase()+"/":"")+t+m}else{if("dailydeal"!=BasePage.toLowerCase())return BeautyHrefLink;h={basepage:BasePage,sectionName:t,subTab:"dailydeal"};void 0!==t&&null!=t&&""!=t&&t.indexOf("dealsindividual")>=0&&(t=t.split("dealsindividual")[0],BeautyHrefLink=(window.location.href.match("/$")?"../":"/")+t)}return""!=styleCategoryName&&void 0!==styleCategoryName&&null!=styleCategoryName?e("#photos").attr("href",(window.location.href.match("/$")?"../":"/")+"photos"+a+r.concat("/",styleCategoryName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",s,d,1==p?"":o[p])):e("#photos").attr("href",(window.location.href.match("/$")?"../":"/")+"photos"+a+r.concat("/",s,d,1==p?"":o[p])),""!=businesstypes&&void 0!==businesstypes&&null!=businesstypes?(e("#listings").attr("href",(window.location.href.match("/$")?"../":"/")+"listings"+a+r.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==p?"":o[p])),e("#professionals").attr("href",(window.location.href.match("/$")?"../":"/")+"professionals"+a+r.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==p?"":o[p])),e("#deals").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+r.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==p?"":o[p])),e("#dailyDealsFooter").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+r.concat("/",businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==p?"":o[p]))):(e("#listings").attr("href",(window.location.href.match("/$")?"../":"/")+"listings"+a+r.concat("/",s,d,1==p?"":o[p])),e("#professionals").attr("href",(window.location.href.match("/$")?"../":"/")+"professionals"+a+r.concat("/",s,d,1==p?"":o[p])),e("#deals").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+r.concat("/",s,d,1==p?"":o[p])),e("#dailyDealsFooter").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+a+r.concat("/",s,d,1==p?"":o[p]))),BeautyHrefLink},_common.loadSections=function(t){var i=_common.AddState(t);return t==_common.liveStreamClasses&&(t="listings"),_common.CloseToggelmobileMenu(),"Home"!=BasePage?i=!1:(-1!=t.indexOf("/")&&(t=t.split("/")[0]),loadData(t,!0),_common.setGeoLocationMarker(t)),e("#s2id_ddlServices").find("ul").attr("role","none"),i},_common.ToggelmobileMenu=function(t){if(HideAdvanceSearchModel(),e("#mobilemenutoggle").hasClass("active")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)_common.CloseToggelmobileMenu();else{e("#mobile-menu").addClass("mobile_menu_open"),e("html, body").addClass("overflowHidden mobile_menu_show"),e("#mobilemenutoggle").addClass("active");var i=Webflow.require("ix"),a=e(".dropdown-arrow");i.run({type:"click",selector:".dropdown-arrow",preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",rotateX:"0deg",rotateY:"0deg",rotateZ:"180deg"}]},a)}},_common.loadHome=function(t){try{HideAdvanceSearchModel(),_common.AppPromoSearchActive=!1;var i=e(".vagaro-logo");if(1==i.length){if(i.hasClass("clickednow")&&null!=t)return void t.preventDefault();i.addClass("clickednow"),setTimeout(function(){i.removeClass("clickednow")},2e3)}}catch(t){}setdefaultSortingOption("",""),_common.loadSections("home")&&null!=t&&t.preventDefault(),_common.isCreateclearCookie(),"undefined"==typeof isDisplayAffirmBanner||"True"!=isDisplayAffirmBanner&&1!=isDisplayAffirmBanner||(e("#aSeeAllAffirmBusinesses").length>0?e("body").addClass("affirmBannerBody"):e("body").removeClass("affirmBannerBody"))},_common.setGeoLocationMarker=function(e){"undefined"==typeof vgAppicationType||1!=vgAppicationType||void 0===e||null==e||"listings"!=e.toLowerCase()&&"deals"!=e.toLowerCase()&&"book"!=e.toLowerCase()&&"class"!=e.toLowerCase()||(flagSetGeoLocationForApp=!0,CallbackforMobileApp(0,0,"","",0,27))},_common.CloseToggelmobileMenu=function(){e("#mobile-menu").removeClass("mobile_menu_open"),e("html, body").removeClass("overflowHidden mobile_menu_show"),e("#mobilemenutoggle").removeClass("active");var t=Webflow.require("ix"),i=e(".dropdown-arrow");t.run({type:"click",selector:".dropdown-arrow",preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",rotateX:"0deg",rotateY:"0deg",rotateZ:"0deg"}]},i)},_common.setTouchEvents=function(){var t=iPadAndroid?"touchstart":"click";window.location.pathname;e(".LiveStreamBookmarkClass").bind(t,function(e){ManagaBusinessBookmark(this)}),e("#aSeeAllLiveStream").bind(t,function(t){try{var i={Action:"See All",Category:"Live Stream",PageName:"Home"};_vgLogEvent.LogData(i)}catch(t){}ResetBusinessSearchMode(),resetAllCheckBox(),e("body").addClass("livestreampage"),setTimeout(function(){_common.SelectLiveStreamClasses(),CheckLiveStreamCategoryNextPrevious()},50);var a=_common.loadSections(_common.liveStreamClasses);if("undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),"Live Stream"===i.Category){if(0!=e(".listigBusiness-wrapper").find(".liststream-filter-top").length)return!1;e(".listigBusiness-wrapper").append('<div id="listStreamFilterId" class="liststream-filter-top" style="" role="none" ><div class="livestreamfilter" role="none"><div class="pos-relative marginleft20" role="none"><div id="dvDurationText" class="white-roundbox duration-text font-awesome-5pro-light filter-button filter-button-icon" aria-label="Duration combobox" aria-controls="ul_durationdropdown" aria-live="polite"><span class="font-awesome-5pro-light bookmark-text14" aria-hidden="true">&#xf017;</span></div><div class="dropdown-class-stream positionLeft vagaro-dropdown-multiselect" id="durationdropdown" role="none"><ul id="ul_durationdropdown" role="listbox"><li aria-label="Less than 30 minutes"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="1" id="Lessthan30min"><label for="Lessthan30min" role="checkbox" aria-live="polite" aria-checked="false">Less than 30 minutes</label></div></li><li aria-label="30 min"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="2" id="30min"><label for="30min" role="checkbox" aria-live="polite" aria-checked="false">30 min</label></div></li><li aria-label="1 hour"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="3" id="1hour"><label for="1hour" role="checkbox" aria-live="polite" aria-checked="false">1 hour</label></div></li><li aria-label="1+ hours"><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" onchange="CallSearchWithFilter()" name="liveStreamDuration" value="4" id="1+hours"><label for="1+hours" role="checkbox" aria-live="polite" aria-checked="false">1+ hours</label></div></li></ul></div></div><div class="marginleft20"><div class="white-roundbox LiveStreamBookmarkClass filter-button filter-button-icon" id="LiveStreamBookmark" aria-label="Live Stream Bookmark Class" aria-live="polite" role="link"><span class="font-awesome-5pro-light bookmark-text14" aria-hidden="true">&#xf02e;</span></div></div></div><div class="prof-right-padding streamfilterclass" style = "padding-right: 0px;"><div class="filteradded" id="divStreamListingFilters"><div id="divStreamFirstSlide" class="w-inline-block" aria-hidden="true">&nbsp;</div><a href="javascript:void(0);" onclick="SearviceFilter(this,1)" id="LiveStreamyoga" data-livestreamid="1" data-livestream="yoga" class="LiveStreamYoga fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Yoga</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,2)" id="LiveStreampilates" data-livestreamid="2" data-livestream="pilates" class="LiveStreamPilates fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro pilates" aria-hidden="true"></span>Pilates</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,3)" id="LiveStreamcardio" data-livestreamid="3" data-livestream="cardio" class="LiveStreamCrossfit fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Cardio</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,4)" id="LiveStreamcycling" data-livestreamid="4" data-livestream="cycling" class="LiveStreamCycle fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Cycling</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,5)" id="LiveStreamstrength" data-livestreamid="5" data-livestream="strength" class="LiveStreamStrength fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Strength</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,6)" id="LiveStreambootcamp" data-livestreamid="6" data-livestream="bootcamp" class="LiveStreamCrossfit fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Boot Camp</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,7)" id="LiveStreammartialarts" data-livestreamid="7" data-livestream="martialarts" class="LiveStreamStrength fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Martial Arts</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,8)" id="LiveStreamboxing" data-livestreamid="8" data-livestream="boxing" class="LiveStreamBoxing fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Boxing</div></a><a href="javascript:void(0);" onclick="SearviceFilter(this,9)" id="LiveStreamdance" data-livestreamid="9" data-livestream="dance" class="LiveStreamBoxing fliter-class-name w-inline-block filter-button"><div class="filter-pill-text"><span class="filter-icon font-awesome-light-pro" aria-hidden="true"></span>Dance</div></a><div id="divStreamLastSlide" class="w-inline-block" style="">&nbsp;</div></div><div class="font-awesome left-slide-arrow" id="divStreamPrevFilter" onclick=\'_common.nextPreviousFilters("divStreamListingFilters",0,"divStreamNextFilter","divStreamPrevFilter")\'><span>&#xf104;</span></div><div class="font-awesome right-slide-arrow" id="divStreamNextFilter" onclick=\'_common.nextPreviousFilters("divStreamListingFilters",1,"divStreamNextFilter","divStreamPrevFilter")\'><span>&#xf105;</span></div></div><div class="dropdown-stream"><div class="pos-relative"><div class="dropdown-stream-div stream-more filter-button" aria-label="more combobox" aria-controls="LiveStreamClassList"><span class="font-awesome-light-pro margin-right4"></span><span aria-hidden="true">More</span><span class="font-awesome-solid-pro margin-left4" aria-hidden="true"></span></div><div class="dropdown-class-stream default-scrollbar vagaro-dropdown-share-content" id="streamclassdropdown" role="none"><ul class="share-content-ul" id="LiveStreamClassList" role="listbox"><li class="LiveStreamClassListCss p-0"><a href="javascript:void(0);" onclick="SearviceFilter(this,1)" id="liLiveStreamyoga" data-livestreamid="1" data-livestream="yoga" class="LiveStreamYoga w-inline-block" role="option" aria-label="Yoga"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Yoga</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,2)" id="liLiveStreampilates" data-livestreamid="2" data-livestream="pilates" class="LiveStreamPilates w-inline-block" role="option" aria-label="Pilates"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro pilates"></span>Pilates</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,3)" id="liLiveStreamcardio" data-livestreamid="3" data-livestream="cardio" class="LiveStreamCrossfit w-inline-block" role="option" aria-label="Cardio"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Cardio</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,4)" id="liLiveStreamcycling" data-livestreamid="4" data-livestream="cycling" class="LiveStreamCycle w-inline-block" aria-label="Cycling"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Cycling</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,5)" id="liLiveStreamstrength" data-livestreamid="5" data-livestream="strength" class="LiveStreamStrength w-inline-block" aria-label="Strength"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Strength</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,6)" id="liLiveStreambootcamp" data-livestreamid="6" data-livestream="bootcamp" class="LiveStreamCrossfit w-inline-block" aria-label="Boot Camp"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Boot Camp</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,7)" id="liLiveStreammartialarts" data-livestreamid="7" data-livestream="martialarts" class="LiveStreamStrength w-inline-block" aria-label="Martial Arts"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Martial Arts</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,8)" id="liLiveStreamboxing" data-livestreamid="8" data-livestream="boxing" class="LiveStreamBoxing w-inline-block" aria-label="Boxing"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Boxing</div></a></li><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="SearviceFilter(this,9)" id="liLiveStreamdance" data-livestreamid="9" data-livestream="dance" class="LiveStreamBoxing w-inline-block" aria-label="Dance"><div class="filter-pill-text web-body-font" aria-hidden="true"><span class="filter-icon font-awesome-light-pro"></span>Dance</div></a></li></ul><ul id="streamclassdropdownlist" style="display : none"><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Gyrontonic" id="Gyrontonic"><label for="Gyrontonic">Gyrontonic</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Gyrokinesis" id="Gyrokinesis"><label for="Gyrokinesis">Gyrokinesis</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Aerobics" id="Aerobics"><label for="Aerobics">Aerobics</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Zumba" id="Zumba"><label for="Zumba">Zumba</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Spinning" id="Spinning"><label for="Spinning">Cycle / Spinning</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Step Classes" id="StepClasses"><label for="StepClasses">Step Classes</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Weight Training" id="WeightTraining"><label for="WeightTraining">Weight Training</label></div></li><li><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" value="Strength Training" id="StrengthTraining"><label for="StrengthTraining">Strength Training</label></div></li></ul><script id="StreamClassDropdownTemplate" type="text/x-jQuery-tmpl"><li><div><div class="checkbox-custom-black vagaro-checkbox"><input type="checkbox" name="StreamClassDropdownCheckbox" value="${HSBusinessTypeId}" data-hsbusinesstype="${HSBusinessType}" id="${HeroSliderID}"><label for="${HeroSliderID}">${PopularCategoryName}</label></div></div></li><\/script><script id="StreamClassCategoryDropdownTemplate" type="text/x-jQuery-tmpl"><li class="LiveStreamClassListCss"><a href="javascript:void(0);" onclick="javascript:SearviceFilter(this);" id="${ServiceId}">${CategoryName}</a></li><\/script></div></div></div></div>'),e(".LiveStreamBookmarkClass").on("click",function(e){ManagaBusinessBookmark(this)}),e(".stream-more").on("click",function(){e("#streamclassdropdown").slideToggle("600"),e(window).width()<767&&e(this).closest(".livestreampage").find(".mobile-classmore-links").toggle()}),e(".duration-text").on("click",function(){e("#durationdropdown").slideToggle("600")}),setCategoryWidthheight()}else e(".listigBusiness-wrapper").find(".liststream-filter-top").length>0&&e(".listigBusiness-wrapper").find(".liststream-filter-top").remove();a&&t.preventDefault()}),e("#aSeeAllLiveStream").length>0&&e("#aSeeAllLiveStream").attr("href","/live-stream-classes"),e("#aSeeAllPopularBusiness").bind(t,function(e){try{var t={Action:"See All",PageName:"Home",Category:"Popular Businesses"};_vgLogEvent.LogData(t)}catch(e){}_common.aSeeallPopularBusiness(e),"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo()}),e("#aSeeAllDeals").bind(t,function(e){try{var t={Action:"See All",Category:"Daily Deal",PageName:"Home"};_vgLogEvent.LogData(t)}catch(e){}"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo()}),e("#aSeeAllCovidBusinesses").bind(t,function(e){ResetBusinessSearchMode(),isClickForOnlineStore=!1,isClickForOnlineGCStore=!0,pserviceid="",resetAllCheckBox(),setdefaultSortingOption("listSort","listings");var t=_common.loadSections("listings");"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),t&&e.preventDefault()}),e("#aSeeAllAffirmBusinesses").bind(t,function(e){ResetBusinessSearchMode(),isClickForOnlineStore=!1,isClickForOnlineGCStore=!1,isClickForBNPL=!0,pserviceid="",resetAllCheckBox(),setdefaultSortingOption("listSort","listings");var t=_common.loadSections("listings");"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),t&&e.preventDefault()}),e("#professionals").bind(t,function(t){HideAdvanceSearchModel(),ResetBusinessSearchMode(),resetAllCheckBox(),e("#hdnChkProfessional").val("true"),setdefaultSortingOption("professionalSort","listings");var i=_common.loadSections("professionals");"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),i&&t.preventDefault()}),e("#photos").bind(t,function(t){HideAdvanceSearchModel(),ResetBusinessSearchMode(),resetAllCheckBox(),setdefaultSortingOption("gallerySort","listings");var i=_common.loadSections("photos");"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),i&&t.preventDefault(),setTimeout(function(){e("#dDropDownMenusFilterMyLikes").attr("tabindex",-1).focus()},700)}),e("#deals, #dailyDealsFooter, #aSeeAllDeals").bind(t,function(t){HideAdvanceSearchModel(),ResetBusinessSearchMode(),resetAllCheckBox(),setdefaultSortingOption("listSort","deals"),e("#ulFeatureBusiness").html('<section class="cards-parent-div-flex daily" id="dealListing">').removeAttr("style"),e("#ulFeatureBusiness").removeAttr("lastcall"),_common.loadSections("deals")&&t.preventDefault(),"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo()})};var p=null;_common.aSeeallPopularBusiness=function(e){ResetBusinessSearchMode(),resetAllCheckBox(),setdefaultSortingOption("listSort","listings"),_common.loadSections("listings")&&!String.isNullOrUndefineOrBlank(e)&&e.preventDefault()},_common.SelectLiveStreamClasses=function(t){if(businessSearchModeForSelection=[0,3],togglebusinesssearch(searchFilterEnum.LiveStream),0==String.isNullOrUndefineOrBlank(t))if(0==String.isNullOrUndefineOrBlank(t.subTab)){var i=e("#LiveStream"+t.subTab);i.length>=0&&selectClassCategory(i,!1)}else e("#divStreamListingFilters a").removeClass("selected"),e(".LiveStreamClassListCss").removeClass("active"),_gblLiveStreamSearchServiceId=0,_gblLiveStreamSearchServiceName="";setdefaultSortingOption("listSort","listingsLive"),setCategoryWidthheight()},_common.SetLocationBySearch=function(t,i){e("body").removeClass("banner-hide-custapp"),_common.AppPromoSearchActive=!0,"function"==typeof _common.HideAppPromoUI&&_common.HideAppPromoUI();var a=e(IdSearchServiceMain).data("select2").getVal().toString();if(void 0!==a&&""!=a){var r=AdminServiceList.results;if(r&&r.length>0){var o=findObjectBytext(r,a);urlService=null!=o?o.url:a}}void 0!==i&&null!=i&&1==i&&(isDealFilterApplied=!0),setAdvSearchDefaultName(),"txtLiveStreamLocationSearch"==e(t.target).attr("id")?(e("#txtLiveStreamLocationSearch").select2("destroy"),e("#txtLiveStreamLocationSearch").off("selected"),e("#txtLiveStreamLocationSearch").off("select2-close"),e("#divLiveStreamLocationSearchPopUp").modal("hide"),setCookie("eventType",3)):resetAllCheckBox();var n=!1;void 0===(p=1)||""==p?p=getCookie("eventType"):setCookie("eventType",p),e("#mobile-check").is(":visible")&&e("#mobilemenutoggle").show();var s=e(IdBusinessLocationSearch).data("select2").getVal().toString(),l=e(IdSearchServiceMain).data("select2").getVal().toString();e("#btnBackHomeSearch:visible").data("isdealdetailpage",null),e("#btnBackHomeSearch").data("isFilterclicked",null),isFilterScreen=!1;var d=e(IdBusinessLocationSearch);1!=isLocationByDefault&&null!=d.data("response")||""==s||(s=""),e(IdHomeServicesDate).val().toLowerCase()==AnyTime.toLowerCase()?(isServiceAnyTime=!0,e("#txtMobileServiceDate").val(AnyTime),e("#txtServiceDate").val(AnyTime),serviceDateTime=getLocationDate(),1==isAdvanceSearch&&localStorage.setItem("serviceDateTime",AnyTime.toLowerCase())):(isServiceAnyTime=!1,serviceDateTime=getdatepickervalue(IdHomeServicesDate),e("#txtServiceDate").val(serviceDateTime),1==isAdvanceSearch&&localStorage.setItem("serviceDateTime",serviceDateTime)),isBackHomeScreen=!1;var c=!0;if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(c="home"==tabSegment.toLowerCase()||"/"==tabSegment||""==tabSegment||"listings"==tabSegment),""==d.data("selectedid")&&(String.isNullOrUndefineOrBlank(e(t.target).attr("id"))||"txtLiveStreamLocationSearch"!=e(t.target).attr("id")||e(d).data("selectedid",location)),""!=s&&""!=d.data("selectedid")){var u=d.data().purpose,h=t,m=void 0!==t.choice&&"txtLiveStreamLocationSearch"==t.currentTarget.id&&"location"==t.choice.id;if("location"==d.data("selectedid")||m)closeMobileSearch(),(f=JSON.parse(d.data("response"))).locationDetail=f.latitude+"#"+f.longitude+"#"+f.zipCode+"#"+f.city+"#"+f.stateCode,""!=l&&p>0?(_common.SetVariablesForLiveStream(1==p?"book":"class"),_common.SetVariablesForBookAService(),onSearchClick(u,h,f,!1,c)):(service="",tabSegment="listings",_common.SetVariablesForLiveStream("listings"),onSearchClick(u,h,f,!1,c));else{n=!0;var f=null;try{if(null!=(f=JSON.parse(d.data("response"))))if(1==/^\d+$/.test(f.id))closeMobileSearch(),""!=l&&p>0?(1==p?(_common.SetVariablesForLiveStream("book"),_common.SetVariablesForBookAService()):2==p&&(_common.SetVariablesForLiveStream("class"),_common.SetVariablesForBookAClass()),onSearchClick(u,h,f,!1,c)):(service="",tabSegment="listings",_common.SetVariablesForLiveStream("listings"),onSearchClick(u,h,f,!1,c));else{var g=new vagaro.ajax;g.datamodel.Token=ApiURLEnumOnlineCommon.getlocationsearchbyplaceid,g.datamodel.IsNewVagaroAPI=!0,g.datamodel.data={placeID:d.data("selectedid")},g.datamodel.callback=function(e){null!=e?("undefined"!=typeof isSetIsCurrentLocationCookie&&setCookie(ProximityIsCurrentLocation,isSetIsCurrentLocationCookie),closeMobileSearch(),""!=l&&p>0?(1==p?(_common.SetVariablesForLiveStream("book"),_common.SetVariablesForBookAService()):2==p&&(_common.SetVariablesForLiveStream("class"),_common.SetVariablesForBookAClass()),onSearchClick(u,h,e,!1,c)):(service="",tabSegment="listings",_common.SetVariablesForLiveStream("listings"),onSearchClick(u,h,e,!1,c))):closeMobileSearch()},g.datamodel.Error=function(e){},g.Post()}else closeMobileSearch()}catch(e){}}}else""!=l&&p>0?(closeMobileSearch(),setdefaultSortingOption("listSort","book"),1==p?(_common.SetVariablesForBookAService(),_common.SetVariablesForLiveStream("book"),_common.loadSectionsFromMobile("book",t)):2==p&&(_common.SetVariablesForBookAClass(),_common.SetVariablesForLiveStream("class"),_common.loadSectionsFromMobile("class",t))):(service="",_common.SetVariablesForBusinessListing(),closeMobileSearch(),setdefaultSortingOption("listSort","listings"),_common.SetVariablesForLiveStream("listings"),_common.loadSectionsFromMobile("listings",t));void 0!==e("#hdnAtBusiness").val()&&"isHomepage"==e("#hdnAtBusiness").val()&&(e("#btnAtBusiness").focus(),e("#hdnAtBusiness").val("")),0==n&&pageReload()},_common.SetVariablesForLiveStream=function(t){1==e("#mobile-check").is(":visible")&&(businessSearchModeForSelection.indexOf(3)>-1&&void 0!==t&&("class"==t||"listings"==t||0==bookSearchItemType.length&&"book"==t)?e("body").hasClass("livestreampage")||(e("body").addClass("livestreampage"),LoadLiveStreamPage()):e("body").removeClass("livestreampage"))},_common.SetVariablesForBookAService=function(){service=_common.GetChoiceForSeleect2(e(IdSearchServiceMain)).text,serviceDate=serviceDateTime.format("MMM DD,YYYY"),serviceTime=serviceDateTime.format("hh:nn a/p"),tabSegment="book"},_common.SetVariablesForBookAClass=function(){service=_common.GetChoiceForSeleect2(e(IdSearchServiceMain)).text,serviceDate=serviceDateTime.format("MMM DD,YYYY"),serviceTime=serviceDateTime.format("hh:nn a/p"),tabSegment="class"},_common.SetVariablesForBusinessListing=function(){service=_common.GetChoiceForSeleect2(e(IdSearchServiceMain)).text,serviceDate=serviceDateTime.format("MMM DD,YYYY"),serviceTime=serviceDateTime.format("hh:nn a/p")},_common.loadSectionsFromMobile=function(t,i){"book"==t||"class"==t||"listings"==t||3==businessSearchMode&&ResetBusinessSearchMode(),"deals"==t.toLowerCase()&&(e("#ulFeatureBusiness").html('<section class="cards-parent-div-flex daily" id="dealListing">').removeAttr("style"),e("#ulFeatureBusiness").removeAttr("lastcall"));var a=_common.loadSections(t);"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),a&&void 0!==i&&null!=i&&(String.isNullOrUndefineOrBlank(e(i.target).attr("id"))||"txtLiveStreamLocationSearch"==e(i.target).attr("id")||i.preventDefault())},_common.hasLatLongCookie=function(e){if("home"==BasePage.toLowerCase()){var t=getCookie(ProximityCookieName);return!(null==t||"undefined"==t||String.isNullOrUndefineOrBlank(t.lat)&&String.isNullOrUndefineOrBlank(t.long))}},_common.isTouchOrClick=function(e){return!e.ctrlKey},_common.CheckPromoBusinessID=function(){null!=strBusinessPromoURL&&""!==strBusinessPromoURL||(clearCookie("PromotionUIDetails"),clearCookie("promotionalurl"))},_common.onBookmarkRowLoad=function(t,i){var a=e(i);if(t.intRating>0){var r=100*t.intRating/5;e("#divBookMarksRating_"+t.FavoriteID,a).css("width",r+"%")}return e("#divBookmarksBusName_"+t.FavoriteID,a).text(_common.getShortNameForDesign(t.BusinessName,30,27)),a},_common.afterBookmarkRowLoad=function(t){e("#btnBookNext").hide(),e("#btnBookPre").hide(),e("#divBookmarks").removeAttr("ondragend"),null==t||0==t.length?e("#scBookMarkSection").hide():(e("#scBookMarkSection").show(),t.length>=4&&(e("#btnBookNext").show(),e("#btnBookNext").removeClass("slide-disabled"),e("#btnBookNext").removeAttr("disabled"),e("#btnBookPre").show(),e("#btnBookPre").addClass("slide-disabled"),e("#btnBookPre").attr("disabled",!0),e("#divBookmarks").attr("ondragend","javascript:dragOnSlider(event, 'divBookmarks', 'btnBookPre', 'btnBookNext');")),_common.AddEndSpaceInSlider("#divBookmarks"))},_common.AddEndSpaceInSlider=function(t){var i=e(t+" .divSlider-Content");i.length>0&&i.last().after("<a href='javascript:void(0)' class='end-div-space'></a>")},_common.SetDefaultLocation=function(t,i){var a=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";a.indexOf("webcache.googleusercontent.com")>-1&&"vagaro.com"==DomainName&&(a="https://www.vagaro.com/"),e.ajax({url:a+"WebServices/MySampleService.asmx/GetLocation",type:"POST",contentType:"application/json; charset=utf-8"}).success(function(e){var a=EmptyProximityValue();if(void 0!==e&&null!=e&&"success"==e.status.toLowerCase()){var r={us:"1",gb:"2",ca:"3",au:"4"}[e.countryCode.toLowerCase()];void 0===r?a=_common.SetDefaultCookie(i):(a.countryid=r,a.currencysymbol="2"==r?"£":"$",a.lat=e.lat,a.long=e.lon,a.zip=e.zip,a.city=e.city,a.state=e.region),ipLocation=e.lat+","+e.lon}else a=_common.SetDefaultCookie(i);setCookie(ProximityCookieName,a),SetProximityVariables(),setDropDown(),loadData(t,!0)})},_common.SetUserLocation=function(){var t=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";e.ajax({url:t+"WebServices/MySampleService.asmx/GetLocation",type:"POST",contentType:"application/json; charset=utf-8"}).success(function(e){EmptyProximityValue();void 0!==e&&null!=e&&"success"==e.status.toLowerCase()?CurrentLocation=e.lat+","+e.lon:CurrentLocation="37.78222,-122.46178"})},_common.SetDefaultCookie=function(e){var t=EmptyProximityValue();return t.countryid="1",t.currencysymbol="$",t.lat="37.78222",t.long="-122.46178",t.zip="",t.city="San Francisco",t.state="CA",t.stateName="California",void 0!==e&&void 0!==e.businesstypes&&(t.businesstypes=e.businesstypes),t},_common.mapListToggle=function(t){if(!(e("#divFeatureBusinessLoader:visible").length>0))if(t){e("#pageSection").addClass("map-viewonly"),e(".listings-60").addClass("hideList"),e(".listings-map-40").addClass("showMap"),e(".map-pill-pkg").hide(),e(".filter-pill-pkg").hide(),e(".list-pill-pkg").show();try{var i={Action:"Deal Details",PageName:"Deal",Category:"Deal",BusinessName:"",BusinessID:"",isDealDetails:!1,IsListPage:!1,IsMapPage:!0,isFiltered:!1,DealName:""};_vgLogEvent.LogData(i)}catch(e){}}else{e("#pageSection").removeClass("map-viewonly"),e(".listings-60").removeClass("hideList"),e(".listings-map-40").removeClass("showMap"),e(".list-pill-pkg").hide(),e(".map-pill-pkg").removeAttr("style"),e(".filter-pill-pkg").removeAttr("style"),e("#mobile-check").is(":visible")&&e(".redo-search-btn").hide();try{i={Action:"Deal Details",PageName:"Deal",Category:"Deal",BusinessName:"",BusinessID:"",isDealDetails:!1,IsListPage:!0,IsMapPage:!1,isFiltered:!1,DealName:""};_vgLogEvent.LogData(i)}catch(e){}}},_common.ApplyEnScroll=function(e){iPadAndroid||iMacSafari||isWindowsPhone||isWebKit&&!isEdge||Ps.initialize(document.querySelector(e),{suppressScrollY:!1})},_common.GetAppVersion=function(){var e=null,t=userAgent.split("(vagaroapp");if(t.length>0){var i=t[1].split(")")[0];if(null!=i&&void 0!==i&&i.length>0){var a=i.replace(")","").replace(" ","");e=a.split(".").length<3?a.replace(".","")+"0":a.replace(".","").replace(".","")}}return e},_common.FeaturedBusinessTooltip=function(t){if(1!=isWindowsPhone){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(1==isAndroidMobile||"android"==iPadAndroid)){var i=_common.GetAppVersion();if(null!=i&&i<=450)return}if(void 0!==t&&"login"==t&&("undefined"==typeof UserType||null==UserType||""==UserType)){var a=new vagaro.ajax;a.datamodel.Token="GetLoggedinUserType",a.datamodel.callback=function(e){""!=e&&null!=e&&(UserType=e,_common.FeaturedBusinessTooltip(t))},a.datamodel.Error=function(e){},a.datamodel.data=[],a.Post()}"undefined"!=typeof UserID&&null!=UserID&&""!=UserID&&parseInt(UserID)>0&&"undefined"!=typeof UserType&&null!=UserType&&""!=UserType&&(5==parseInt(UserType)||6==parseInt(UserType))?e(".ad-text").length&&(iPadAndroid?(e(".ad-text").off("click"),e(".ad-text").on("click",function(){e(this).hasClass("hover")?(e(".ad-text").removeClass("hover"),event.stopPropagation(),event.preventDefault()):(event.stopPropagation(),event.preventDefault(),e(".ad-text").removeClass("hover"),e(this).addClass("hover"))}),e(".ad-text .featured-whitebutton").off("click"),e(".ad-text .featured-whitebutton").on("click",function(e){e.stopPropagation(),e.preventDefault(),RedirectToShopOwnerPage()})):(e(".ad-text").off("click"),e(".ad-text").on("click",function(e){e.stopPropagation(),e.preventDefault()}),e(".ad-text .featured-whitebutton").off("click"),e(".ad-text .featured-whitebutton").on("click",function(e){e.stopPropagation(),e.preventDefault(),RedirectToShopOwnerPage()}),e(".ad-text").addClass("cusrerpointer"),e(".ad-text").hover(function(){e(this).addClass("hover")},function(){e(this).removeClass("hover")}),e(".ad-text").each(function(){"ad"===e(this).text().trim().toLowerCase()?e(this).show():e(this).is(":visible")?e(this).text("Ad").show():e(this).hide()}))):(e(".ad-text").removeClass("cusrerpointer"),e(".ad-text").off("click"),e(".ad-text .featured-whitebutton").off("click"),e(".ad-text").off("hover"),e(".ad-text").hover(function(){e(this).removeClass("hover")},function(){e(this).removeClass("hover")}),e(".ad-text").each(function(){"ad"===e(this).text().trim().toLowerCase()?e(this).show():e(this).is(":visible")?e(this).text("Ad").show():e(this).hide()}))}},_common.RedirectBusinessDetailPage=function(t){e("#ancbus_"+t).removeAttr("onClick"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&e("#ancbus_"+t).removeAttr("target"),"undefined"!=typeof event&&(event.stopPropagation(),event.preventDefault()),document.getElementById("ancbus_"+t).click()},_common.RedirectToBook24=function(i,a){if(i.serviceid>0&&e("#divPromotion_"+i.serviceid).length>0){var r=e(a.target),n=e("#divPromotion_"+i.serviceid),s=e("#aSerivceBusPromotion",n),l=s.children();if(r.is(l)||r.is(s))return!0}a.stopPropagation(),a.preventDefault(),e("html, body").removeClass("overflowHidden"),1==e("#galleryPopup").length&&e("#galleryPopup").hide(),void 0!==i.styleid&&null!=i.styleid&&i.styleid>0&&"undefined"!=typeof businessID&&(IsGallerySp=!0,function(t,i,a){var r={ServiceId:parseInt(t),BusinessID:parseInt(i)},o=new vagaro.ajax;o.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetPhotoGalleryService,groupID),o.datamodel.data=r,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.callback=function(r){var o={ServiceId:parseInt(t),BusinessID:parseInt(i),ServiceProviderID:"undefined"!=typeof isWidget&&"undefined"!=typeof WidgetSpId&&null!=WidgetSpId&&isWidget&&WidgetSpId>0?WidgetSpId:0,IsBundle:0,LastMinDealHours:LastMinuteBookingDays},n=new vagaro.ajax;n.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAddOnService,groupID),n.datamodel.data=o,n.datamodel.IsNewVagaroAPI=!0;var s=t,l=r.Data[0].Photo,d=r.Data[0].EventType,c=r.Data[0].ServiceTitle,u=r.Data[0].ServiceDesc,p=r.Data[0].Price,h=r.Data[0].IsShowPriceOnline.toString();if(0!=r.Data[0].DiscountValue&&0==r.Data[0].IsAmount)var m=p-p*r.Data[0].DiscountValue/100,f=p-p*r.Data[0].DiscountValue/100,g=r.Data[0].ServiceProviderID,v=r.Data[0].DiscountValue+"% OFF";else 0!=r.Data[0].DiscountValue&&1==r.Data[0].IsAmount?(m=p-r.Data[0].DiscountValue,f=p-r.Data[0].DiscountValue,g=r.Data[0].ServiceProviderID,v=r.Data[0].DiscountValue+"$ OFF"):(m="0",f="0",g="",v="");var A=!0;if(1==_shopdetail.IsIncludeTaxInOnlinePricing&&0!=r.Data[0].ServiceNewPriceWithTax)var C=r.Data[0].ServiceNewPriceWithTax;else C=1==_shopdetail.IsIncludeTaxInOnlinePricing&&0==r.Data[0].ServiceNewPriceWithTax?r.Data[0].Price:"0";r.Data[0].Taxes;var y=1==d&&void 0!==ServiceDataList&&null!=ServiceDataList&&ServiceDataList.length>0&&ServiceDataList.some(function(e){return Number(e.ServiceID)===Number(s)&&e.IsShowPriceAsStartingPoint})?"Starting at ":"";n.datamodel.callback=function(t){if(1e3==t.ResponseCode)if(ShowLoader(!1),t.Data.length>0&&null!=t.Data[0]){_shopdetail.ShowAddOnService(),e("#divSuggestedAddon").text("Suggested Add-Ons Available"),SelectedAddonService=[],_shopdetail.localData.AddonsList=t.Data,e(_shopdetail.Controls.AddOnList).empty(),e(_shopdetail.Controls.ParentService).empty(),null==l||"null"==l||""==l?(e("#divServiceImage").css("display","none"),e(".addon-service-description").addClass("no-image-data")):(e("#divServiceImage").css("display","block"),e(".addon-service-description").removeClass("no-image-data"),e("#divServiceImage").css("background-image","url("+l+")")),e("#divServiceName").text(c),e("#divServiceDes").text(u),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&f<=0&&(p=C),void 0!==p&&null!=p&&"string"!=typeof p&&(p=p.toString()),"$0.00"==p||"0.00"==p||"0"==p?"true"==h?(e("#divFreeServicePrice").css("display","block"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(p.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(p.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):"true"==h?(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(y+_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(p.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(0,2).format("#.##"))),e("#hdnServiceId").val(s),e("#hdnEventType").val(d);var i=e.grep(t.Data,function(e){return 0==e.ServiceLevel});e.each(i,function(a){var r=e.grep(t.Data,function(e){return e.Price=_onlineCheckout.parseTodecimal(e.Price,2),e.ParentServiceID==i[a].ServiceId});i[a].MinItem=i[a].MinItem>r.length?r.length:i[a].MinItem,i[a].MaxItem=i[a].MaxItem>r.length?r.length:i[a].MaxItem,r=r.map(function(e){if(e.IsRequired=i[a].IsRequired,e.MinItem=i[a].MinItem,e.MaxItem=i[a].MaxItem,e.Photo=e.Photo.indexOf("no-shop-image-big.")>0?"":e.Photo,e.CurrencySymbol=_shopdetail.currencySymbol,e.OnlinePrice=1==e.IsShowPriceOnline?e.Price:"0.00",e.OnlinePricewithtax=1==e.IsShowPriceOnline?e.Price:"0.00",e.IsIncludeTaxInOnlinePricing=!1,e.NewPricewithTax=e.Price,null!=e.PromotionDetail&&""!=e.PromotionDetail){var t=_shopdetail.GetAddonDailyDealData(e.PromotionDetail,e.OnlinePrice,e.ServiceId,0,!0,e.BusinessTax);t.PromotionID>0?(e.IsDealApplied=!0,e.PromotionID=t.PromotionID,e.NewPrice=t.NewPrice,e.NewPricewithTax=e.NewPrice):(e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0)}else e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0;try{void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&(e.IsIncludeTaxInOnlinePricing=!0,void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues&&""!=e.BusinessTax&&null!=e.BusinessTax&&null!=e.BusinessTax&&""!=e.BusinessTax&&null!=e.PromotionDetail&&e.PromotionDetail)}catch(e){}return e}),_shopdetail.CreateNoneOTAboveObject(r),e(_shopdetail.Controls.tmplAddOnCategory).tmpl(i[a]).appendTo(_shopdetail.Controls.AddOnList),e(_shopdetail.Controls.tmplAddOnService).tmpl(r).appendTo("#Service_"+r[0].ParentServiceID),e(".modal:visible").each(function(e,t){centerModal(t)}),e("#addonspopupclose.close").css({visibility:"hidden"})}),_shopdetail.BindSelectedAddon(s,1,"0"),_shopdetail.CheckboxAddOnService(),0!=r.Data[0].DiscountValue&&(e(".s-sub-heading.TotalServicePrice").text(currencySymbol+""+m),e("#divServicePrice").text(y+currencySymbol+""+m)),e("#btnClose").css("display","none"),e(".classfooter-btn-row").addClass("backremove"),e("#servicenamepopup").removeClass("single-button"),e("#btnback").css("display","none"),e("#btnNext").css("display","none"),e("#btnContinue").css("display","block"),void 0!==a&&""!=a&&null!=a?e("#btnContinue").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNow("+s+", "+a+", 0, '', '', '', "+d+", false,0,'"+l+"','"+ReplaceSpecialCharacters(u)+"','"+g+"', '"+v+"','"+A+"');"):e("#btnContinue").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNow("+s+", 0, 0, '', '', '', "+d+", false,0,'"+l+"','"+ReplaceSpecialCharacters(u)+"','"+g+"', '"+v+"','"+A+"');"),2==t.Data.length?e(".addon-group-row1").css("border-bottom","none"):e(".addon-group-row1").css("border-bottom","solid #E7E7E7 1px")}else e(_vgClassSessionSelection.Controls.AddOnList).empty(),_shopdetail.HideAddOnService(),_shopdetail.SetBookData(s,0,0,"","","",d,!1,null)},n.datamodel.Error=_common.CallFailed,n.Post()},o.datamodel.Error=_common.CallFailed,o.Post()}(i.serviceid,businessID,i.spid));var d,c,u="",p="",h="",m="",f="",g="",v="";if(void 0!==i.serviceid&&"0"!=i.serviceid&&(u=i.serviceid),void 0!==i.spid&&"0"!=i.spid&&(p=i.spid),void 0!==i.styleid&&"0"!=i.styleid&&(h=i.styleid),void 0!==i.styletitle&&null!=i.styletitle&&""!=i.styletitle&&(m=i.styletitle),void 0!==i.bookingDateTime&&null!=i.bookingDateTime&&""!=i.bookingDateTime&&(f=i.bookingDateTime),void 0!==i.vagarourl&&null!=i.vagarourl&&""!=i.vagarourl&&(i.vagarourl=i.vagarourl.toLowerCase()),void 0!==i.AddonServicIds&&null!=i.AddonServicIds&&""!=i.AddonServicIds&&(g=i.AddonServicIds),void 0!==i.HouseCallGroupID&&null!=i.HouseCallGroupID&&""!=i.HouseCallGroupID&&(v=i.HouseCallGroupID),"Home"==BasePage||"MyAccount"==BasePage)if(setCookie("StyleID",h),setCookie("StyleName",m),setCookie("BookingDate",f),setCookie("IsReBookAppointment","True"),"MyAccount"==BasePage)if(setCookie("strServiceID",u),setCookie("strProviderID",p),setCookie("strAddonServicIds",g),setCookie("HouseCallGroupID",v),d="undefined"!=typeof widgetcookievalue&&""!=widgetcookievalue&&null!=widgetcookievalue&&"undefined"!=widgetcookievalue?"ServiceId="+u+"&ServiceProviderId="+p+"&wid='"+widgetcookievalue+"'&encrypted=true":"ServiceId="+u+"&ServiceProviderId="+p+"&encrypted=true&rebook=true",void 0!==i.Type&&null!=i.Type&&""!=i.Type&&(c="?Type="+i.Type),"Builder"==o&&"?Type=Builder"!=c&&(d+="&Type=Builder"),null!=isWidget&&"true"==isWidget||null!=isFacebook&&"true"==isFacebook)if(d="&"+d,_common.IsWidgetForServiceProvider(!0)){var A=_common.IsWidgetForServiceProvider(!1);window.location=t.location.protocol+"//"+t.location.host+"/"+i.vagarourl+"/book-now?IsFacebookPage="+(null!=isFacebook&&"true"==isFacebook?"true":"false")+"&IsBusinessWidgetPage="+(null!=isWidget&&"true"==isWidget?"true":"false")+"&TabsIncluded="+_shopdetail.TabsIncluded+"&IsFromMyAccount=1&b_themeID="+b_themeID+"&IsFromMultiLocation=true&MultiLocBusinessID="+MultiLocBusinessID+"&w_type="+w_type+"&IsFromWidgetMenu=true&widgetversion="+WidgetVersion+"&tab=1&tabatlaunch="+_shopdetail.TabAtLaunch+"&WidgetSpId="+A+d}else window.location=t.location.protocol+"//"+t.location.host+"/"+i.vagarourl+"/book-now?IsFacebookPage="+(null!=isFacebook&&"true"==isFacebook?"true":"false")+"&IsBusinessWidgetPage="+(null!=isWidget&&"true"==isWidget?"true":"false")+"&TabsIncluded="+_shopdetail.TabsIncluded+"&IsFromMyAccount=1&b_themeID="+b_themeID+"&IsFromMultiLocation=true&MultiLocBusinessID="+MultiLocBusinessID+"&w_type="+w_type+"&IsFromWidgetMenu=true&widgetversion="+WidgetVersion+"&tab=1&tabatlaunch="+_shopdetail.TabAtLaunch+d;else if(void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase())d="&"+d,window.location=t.location.protocol+"//"+t.location.host+"/"+i.vagarourl+"/book-now?ig_fbb=true"+d;else if(void 0!==_shopdetail.isFBExtensions&&"true"==_shopdetail.isFBExtensions.toLowerCase())d="&"+d,window.location=t.location.protocol+"//"+t.location.host+"/"+i.vagarourl+"/book-now?ig_ix=true"+d;else if(null!=i.Type&&null!=i.Type&&""!=i.Type){d="&"+d;var C=t.location.protocol+"//"+t.location.host+"/"+i.vagarourl+"/book-now"+((document.referrer.indexOf("partner=fb")>=0||window.location.href.indexOf("partner=fb")>=0)&&1==_common.isCreateLinkPreserve(!0)?C.search:"")+c+d;$url=e("<a/>"),$url.attr("href",C),$url[0].click()}else{d="?"+d;var y=t.location.protocol+"//"+t.location.host+"/"+i.vagarourl+"/book-now"+((document.referrer.indexOf("partner=fb")>=0||window.location.href.indexOf("partner=fb")>=0)&&1==_common.isCreateLinkPreserve(!0)?C.search:"")+d;$url=e("<a/>"),$url.attr("href",y),$url[0].click()}else if(setCookie("ServiceID",u),setCookie("ProviderID",p),setCookie("AddonServicIds",g),void 0!==i.serviceid&&null!==i.serviceid&&"0"!==i.serviceid&&localStorage.setItem("RedirectSource","HomeBtn"),"undefined"!=e(n).parent().data("frombooknow")&&1==e(n).parent().data("frombooknow")){e("#anc_"+i.serviceid).removeAttr("onClick"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&e("#anc_"+i.serviceid).removeAttr("target");var b=document.getElementById("anc_"+i.serviceid);e("#mobile-check").is(":visible")&&"undefined"!=typeof vgAppicationType&&0==vgAppicationType&&b&&b.href&&"#"!==b.href&&!b.href.includes("javascript")?window.location.href=b.href:b.click()}else window.location="/"+i.vagarourl+"/book-now";else _shopdetail.SetBookData(u,p,h,m,f,"")},_common.centerGalleryPopup=function(){var t=e("#galleryPopup:visible").height();e(".gallery-popup-white-overall").css("max-height",t)},_common.checkHeart=function(t){return 0==e(t).find(".btnlike").hasClass(emptyHeartClass)},_common.clickToLikeStyle=function(t){var i=e(t).parents(".cust-img-popup-slider");if((void 0===i||null==i||i.length<=0)&&(i=e(t).parents(".gallery-solo-image")),e(t).parents(".gallery-solo-image").resize(),i.find(".share-popup").hide(),!(UserID>0))return _common.reloadstyle=!1,_common.likestyle=t,showLogin(),!1;var a=_common.checkHeart(i)?0:1,r=i.data();_common.likestyle=t;var o=new vagaro.ajax;o.datamodel.IsNewVagaroAPI=!0,o.datamodel.Token=ApiURLEnumCommon.likestyle,o.datamodel.callback=_common.LikeStyleSuccess,Data={},Data.styleId=r.styleid,Data.isLike=a,Data.ReceiverName=i.find("#divSalonName_"+r.styleid).html(),Data.Mailto=r.businessemail,Data.Body="User "+UserName+" liked the style",Data.Image=i.find("#imgServiceImage_"+r.styleid).attr("src"),Data.StyleTitle=r.styletitle,Data.Address=i.find("#divAddress_"+r.styleid).html(),Data.BusinessName=i.find("#divSalonName_"+r.styleid).html(),Data.Service=r.servicetitle,Data.businessUrl=r.vagarourl,Data.UserLike=e("#hdnLikeCount_"+r.styleid,i).val(),Data.groupID=r.group,0==_common.reloadstyle&&(a=2),o.datamodel.data=Data,o.datamodel.Error=function(t){_common.checkHeart(i)?(e(i).find(".btnlike").addClass(emptyHeartClass),e(i).removeClass("gallery-liked")):(e(i).find(".btnlike").removeClass(emptyHeartClass),e(i).addClass("gallery-liked"))},o.Post();var n=0;null!=e("#divGalleryLikeCount",i).html()&&"undefined"!=e("#divGalleryLikeCount",i).html()&&(n=parseInt(e("#divGalleryLikeCount",i).html().trim().split(" ")[0])),_common.checkHeart(i)?(e(i).find(".btnlike").addClass(emptyHeartClass),e(i).removeClass("gallery-liked"),e("#divGalleryLikeCount:visible",i).length>0?1==(n-=1)?e("#divGalleryLikeCount",i).html(n+" Like"):0==n?(e("#divGalleryLikeCount",i).css("display","none"),e("#divGalleryLikeCount",i).html("")):e("#divGalleryLikeCount",i).html(n+" Likes"):(e("#divGalleryLikeCount",i).css("display","none"),e("#divGalleryLikeCount",i).html("")),e("#imgLikePopUp").addClass(emptyHeartClass).attr("aria-label","Click to like")):(e(i).find(".btnlike").removeClass(emptyHeartClass),e(i).addClass("gallery-liked"),e("#imgLikePopUp").removeClass(emptyHeartClass).attr("aria-label","Click to unlike"),e("#divGalleryLikeCount:visible",i).length>0?(n+=1,e("#divGalleryLikeCount",i).html(n+" Likes")):(n=1,e("#divGalleryLikeCount",i).show(),e("#divGalleryLikeCount",i).html(n+" Like")),e(t).parents(".gallery-solo-image").resize())},_common.LikeStyleSuccess=function(t){if(null==t)return showLogin(),!1;if(t.length>0){var i,a=e(_common.likestyle).parents(".cust-img-popup-slider");if((void 0===a||null==a||a.length<=0)&&(a=e(_common.likestyle).parents(".gallery-solo-image")),_common.isFromLikeStyle=!1,_common.checkHeart(a))(i=parseInt(e("#hdnLikeCount_"+a.data().styleid,a).val()))>0?e("#hdnLikeCount_"+a.data().styleid,a).val(i-1):e("#hdnLikeCount_"+a.data().styleid,a).val(0);else(i=parseInt(e("#hdnLikeCount_"+a.data().styleid,a).val()))>0?e("#hdnLikeCount_"+a.data().styleid,a).val(i+1):e("#hdnLikeCount_"+a.data().styleid,a).val(1);e(".gallery-solo-image",e("#ulFeatureBusiness")).each(function(){var i=e(this).data().styleid;e.inArray(parseInt(i),t)>-1&&(e(this).prop("title","You liked this portfolio"),e(this).find(".btnlike").removeClass(emptyHeartClass),e(this).addClass("gallery-liked"))}),window.location.href.includes(myLikedStyleUrlValue)&&(a.detach(),setTimeout(function(){_featured.GalleryPager.RefreshWall(),1==e("#ulFeatureBusiness").attr("data-total-col")&&setMylikesGalleryFilterValue(1,"aMyLikesOption_filter_1",0,1)},150))}},_common.GetUserLike=function(){var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumCommon.likestyle,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.data=[0,3,"","","","","","","","","","0"],t.datamodel.callback=function(t){e(".gallery-solo-image",e("#ulFeatureBusiness")).each(function(){var i=e(this).data().styleid;e.inArray(parseInt(i),t)>-1&&(e(this).prop("title","You liked this portfolio"),e(this).find(".btnlike").removeClass(emptyHeartClass),e(this).addClass("gallery-liked"))})},t.datamodel.Error=function(e){},t.Post()},_common.SetGalleryData=function(t){0==_common.reloadstyle&&(t&&(_featured.GalleryPager.options.Data.userid=UserID),_common.clickToLikeStyle(_common.likestyle),e("div.slick-active","#detailstyleboot").length>0&&e("div.slick-active","#detailstyleboot").closest(".bootbox").show()),_common.reloadstyle=!0,ShowLoader(!1)},_common.clearCovidReviewRating=function(t,i){try{for(var a,r=0,o=e(t).children().children(".rating-symbol").length,n=0;n<o;n++){var s=e(t).children().children(".rating-symbol")[n];if(e(s).hasClass("glyphicon-star-empty")){a=e(t).children().children(".rating-symbol")[n-1],r=n-1;break}}null!=a&&null!=a||(a=e(t).children().children(".rating-symbol")[o-1],r=o-1);for(var l=0;l<o;l++)covid=e(t).children().children(".rating-symbol")[l],l!=r&&e(covid).removeClass("select");if(e(t).parent().parent().length>0&&e(t).parent().parent()[0].id.toString().toLowerCase().indexOf("covid")>-1&&e(a).hasClass("select")){e(a).removeClass("select");for(var d=0;d<=r;d++){s=e(t).children().children(".rating-symbol")[d];e(s).hasClass("glyphicon-star-empty")||e(s).addClass("glyphicon-star-empty"),e(s).hasClass("glyphicon-star")&&e(s).removeClass("glyphicon-star")}return void e(i,e(t)).val("")}e(a).addClass("select"),""!=e(i,e(t)).val()&&"-1"!=e("#rating-input",e(t)).val()||(e(".rating-symbol",e(t)).addClass("glyphicon-star-empty"),e(i,e(t)).val(""))}catch(e){}},_common.clearReviewRating=function(t,i){""!=e(i,e(t)).val()&&"-1"!=e("#rating-input",e(t)).val()||(e(".rating-symbol",e(t)).addClass("glyphicon-star-empty"),e(i,e(t)).val(""))},_common.setServiceCancelButtonMobile=function(t){e(".cancel-select-service").on("touchstart click",function(t){t.preventDefault(),t.stopPropagation(),void 0!==isFilterScreen&&isFilterScreen?(e("#select2-drop-mask").click(),e(IdSearchServiceMain).select2("close")):1==parseInt(e("#btnBackHomeSearch:visible").data("iscustomerappsearch"))?(e(this).parent().find(".select2-input").blur(),e("#btnBackHomeSearch:visible").click()):e("#select2-drop-mask").click(),e("html, body").removeClass("searchaddservclass")})},_common.imageErrorStyle=function(e){e.src="https://vagaro.azureedge.net/static-content/Images/no-shop-image-big-new.gif"},_common.DeleteReviewImage=function(t){var i=t.target,a=e(i).closest(".review-editpic"),r=e(i).closest(".review-gallery-image"),o=e(r).attr("img_name"),n=e(r).attr("img_upload_name"),s=e(r).attr("position");e(r).css("background-image","none"),e(i).closest(".review-editpic").hide(),null!=o&&null==n||null!=o&&null==n?(ReviewPhotoArray[s].ActionName="Delete",ReviewPhotoArray[s].temp_delete=!0):_shopdetail.deleteImage(n,s),!(null!=navigator.userAgent.match(/iPad/i))&&iosDevices||isAndroidMobile||isWindowsPhone?e(".add-reviewbtn-bg").show():e("div.reviewProfile").css("display","flex"),e(".reviewProfile-bg").append(e(a))},_common.GetCurrencySymbol=function(){return currencySymbol},_common.HeaderTopfixed=function(){e(_siteBuilderDetail.componentInfo[2]).removeClass("tab-fixednav"),e(".pagebodycontainer").removeClass("giveNavspace"),e("body").removeClass("detailnavfixed"),footerBottomfixed()},_common.CheckFacebookControllRenders=function(){if(e("#dvFaceBookControl").length<=0){objReqFacebookData={},objReqFacebookData.UserControlPath="~/UserControls/General/ucFacebookLoader.ascx",objReqFacebookData.PageNamePath="~/Home.aspx",objReqFacebookData.isRemoveFormTag=!0;var t=new vagaro.ajax;t.datamodel.IsNewVagaroAPI=!0,t.datamodel.Token="websiteapi/homepage/loadusercontrol",t.datamodel.data=objReqFacebookData,t.datamodel.callback=function(t){null!=t&&e("body").append(t)},t.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert({message:"An Error Has Occurred ucFacebookLoader",title:"Oops!"})},t.Post()}},_common.VisibleControlLength=function(t){return e(t).filter(function(){return"none"!==e(this).css("display")}).length},_common.GetGoogleToken=function(e){var t=getCookie("GoogleMap_"+e);return String.isNullOrUndefineOrBlank(t)?null:t},_common.GooglePostCall=function(e){if("true"==isGoogle){var t=_common.GetGoogleToken(e);if(String.isNullOrUndefineOrBlank(t))_common.getGoogleMapCookie();else{var i=t;fetch(GoogleEndPointUrl,{mode:"no-cors",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversion_partner_id:GooglePartnerId,rwg_token:i,merchant_changed:2})})}}else _common.getGoogleMapCookie()},_common.getGoogleMapCookie=function(){var e=_common.getAllCookies();if(!String.isNullOrUndefineOrBlank(e)){var t=_common.getFirstPropertyName(e);String.isNullOrUndefineOrBlank(t)||(BusinessId=t.split("_")[1]);var i=_common.GetGoogleToken(BusinessId);if(!String.isNullOrUndefineOrBlank(i)){var a=i;fetch(GoogleEndPointUrl,{mode:"no-cors",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversion_partner_id:GooglePartnerId,rwg_token:a,merchant_changed:1})})}}},_common.getFirstPropertyName=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return t;return null},_common.getAllCookies=function(){var e=document.cookie.split(";"),t={},i=!1;return e.forEach(function(e){var a=e.split("="),r=a[0].trim();if(r.includes("GoogleMap_")){var o=decodeURIComponent(a[1]);return t[r]=o,i=!0,t}}),i?t:null},_common.closeServiceSelection=function(){e(".book-service-open").removeClass("book-service-open"),e(".book-service-open-common").removeClass("book-service-open-common"),e(".gc-transformnone").removeClass("gc-transformnone"),e("html, body").removeClass("moboverflow-hide"),setTimeout(function(){"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&e("html, body").hasClass("moboverflow-hide")&&e("html, body").removeClass("moboverflow-hide")},200),((iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&e("#dvBusinessLocationSearch").is(":visible")||e("#dvSearchServiceMain").is(":visible")||e("#mobilefilterChange").is(":visible")||e("#mobileServiceChange").is(":visible"))&&(e("#dvBusinessLocationSearch .vg-search-cancel-icon").hide(),e("#dvSearchServiceMain .vg-search-cancel-icon").hide(),e("#mobilefilterChange  .vg-search-cancel-icon").hide(),e("#mobileServiceChange .vg-search-cancel-icon").hide())},_common.findNested=function(e,t,i){if(e[t]===i)return e;for(var a=0,r=Object.keys(e).length;a<r;a++)if("object"==typeof e[a]){var o=this.findNested(e[a],t,i);if(o)return o}},_common.DisableComponent=function(t,i){void 0!==vgCustomComponentDisableDivAdded&&void 0!==vgCustomComponentDisableDivID&&(6!==t&&13!==t&&14!==t&&15!==t||0===e(i).parent().find("#"+vgCustomComponentDisableDivID).length&&(e(i).before(vgCustomComponentDisableDivAdded),e(i).parent().addClass("vgcustom-content-overlay")))},_common.LoadBookNowMenu=function(t,i,a){try{if(void 0!==a&&1==a){var r={};t==LoadMenuTypeEnum.booknow?(r.Action="Book Service",e("#services").focus()):(r.Action="Book Class",e("#classes").focus());var o=e("#busname").text(),n=0;null!=e("#hdnSiteBuilderBusinessID")&&null!=e("#hdnSiteBuilderBusinessID").val()&&(n=parseInt(e("#hdnSiteBuilderBusinessID").val())),r.Category="Book",r.PageName="Business Page",r.BusinessName=null!=o?o:"",r.BusinessID=null!=n?n:"",_vgLogEvent.LogData(r)}}catch(e){}if("undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite&&t==LoadMenuTypeEnum.services&&(t=LoadMenuTypeEnum.booknow),t==LoadMenuTypeEnum.booknow&&"undefined"!=typeof IsNewCustomWebsite&&0==IsNewCustomWebsite)_shopdetail.loadbyMenuClick("book-now"),i&&_common.AddState("book-now","book-now");else if(t==LoadMenuTypeEnum.services&&"undefined"!=typeof IsNewCustomWebsite&&0==IsNewCustomWebsite)_shopdetail.loadbyMenuClick("services"),i&&_common.AddState("services","services");else if(t==LoadMenuTypeEnum.classes&&"undefined"!=typeof IsNewCustomWebsite&&0==IsNewCustomWebsite)_shopdetail.loadbyMenuClick("classes"),i&&_common.AddState("classes","classes");else if("undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite&&(t==LoadMenuTypeEnum.booknow||t==LoadMenuTypeEnum.classes)){"undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()&&"undefined"!=typeof businessID&&null!=businessID&&(156973===parseInt(businessID)||383713===parseInt(businessID)||377983===parseInt(businessID)||430616===parseInt(businessID)||400713===parseInt(businessID))&&_siteBuilderDetail.templatePagesModal.forEach(function(e){e.isBooknowEnable=t==LoadMenuTypeEnum.booknow||e.isBooknowEnable,e.isClassesEnable=t==LoadMenuTypeEnum.classes||e.isClassesEnable}),_siteBuilderDetail.findNestedWithObj(_siteBuilderDetail.templatePagesModal,null,t);var s=_siteBuilderDetail.FindObj;_siteBuilderDetail.FindObj=null,void 0!==s&&null!=s&&(_shopdetail.loadbyMenuClick(GetSlugTabPageName(s.url_slug)),i&&_common.AddState(GetSlugTabPageName(s.url_slug),GetSlugTabPageName(s.url_slug)))}},_common.ApplySelect2ControlsNew=function(t,i){void 0!==i.placeholder&&""!=i||((i={}).dropdownCssClass="",i.isSearchRequire=!1,i.selectOnClick=!0,i.placeholder="",i.maxInputLen=100),void 0===i.maxInputLen&&(i.maxInputLen=100),t.select2("destroy"),t.off("selected"),t.off("select2-close"),t.select2({searchInputPlaceholder:void 0!==i.placeholder&&""!=i.placeholder?i.placeholder:"",combobox:i.isSearchRequire,collapasable:_common.VisibleControlLength("#mobile-check")>0&&i.collapasable,selectOnClick:!0,minimumInputLength:0,maximumInputLength:100,dropdownCssClass:i.dropdownCssClass,formContainer:"#page-wrapper",data:function(){if(void 0!==i.data){var a=e.extend(!0,[],i.data),r=e.extend(!0,[],i.data);return"GCPromo"==t.data("type")&&t.data("GCPromoList",r),{results:a}}return null},initSelection:function(e,t){},formatResult:function(e){return"GCPromo"==t.data("type")&&void 0!==e.promotext&&""!=e.promotext?markup='<div class="promodigittextrow"> <div class="w-inline-block">'+e.text+' <span class="promo-bold">('+(1==e.isCurrencySymbol?currencySymbol+e.promotext:e.promotext)+")</span></div></div>":markup=e.text,markup},matcher:function(i,a,r){for(var o=/\s\s+/g,n=/[^0-9a-zA-Z\" \"]+/gi,s=/[^0-9a-zA-Z\"\. \"]+/gi,l=i.replace(o," "),d=(l="GCPromo"==t.data("type")?l.toLowerCase().replace(s,""):l.toLowerCase().replace(n,"")).split(" "),c="",u=d.length,p=0,h=0;h<=d.length-1;h++){var m=a.replace(o," ");if(((m="GCPromo"==t.data("type")?m.toLowerCase().replace(s,""):m.toLowerCase().replace(n,"")).match("^"+d[h])||-1!=m.indexOf(" "+d[h]))&&((""==c||d[h].indexOf(c)<0)&&(p+=1),c=" "+m,p>=u))break}return p>=u&&("#txtGCPromoAmount"==t.selector&&e("#select2-drop").show(),r.isShow=!0,!0)},formatNoMatches:function(){if("#txtGCPromoAmount"!=t.selector)return e(".select2-results .select2-no-results").remove(),"No matches found";e("#select2-drop").hide()}}).on("selected",function(i){_common.closeServiceSelection(),"GCPromo"==t.data("type")&&(e(i.target).data("selecteddetail",JSON.stringify(i.choice)),void 0!==t.data("choice")&&_common.SetChoiceForSeleect2(t,i.choice))}).on("select2-opening",function(i){t.select2("data",{id:"",text:""}),"txtGCPromoAmount"==i.currentTarget.id&&e("#"+i.currentTarget.id).data("selecteddetail","")}).on("select2-open",function(a){var r=_common.GetChoiceForSeleect2(t);void 0!==r.id&&"txtGCPromoAmount"!=a.currentTarget.id&&t.select2("data",{id:r.id,text:r.text}),(void 0===i.selectAllText||i.selectAllText)&&setTimeout(function(){e(a.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100),"GCPromo"==t.data("type")&&("GCPromo"==t.data("type")&&(e("#dvInnerGCContainer").length&&e("#dvInnerGCContainer").addClass("gc-transformnone"),e(a.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common")),e(a.target).closest(".service-book-what").addClass("book-service-open"),e("html, body").addClass("moboverflow-hide"),e("#select2-drop-mask").addClass("hidemask"),(void 0===i.scrollTop||i.scrollTop)&&e("html, body").animate({scrollTop:0}),(void 0===i.selectAllText||i.selectAllText)&&setTimeout(function(){e(a.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100))}).on("change",function(e){}).on("select2-close",function(i){if(_common.closeServiceSelection(),e("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){e("#select2-drop-mask").off("touchstart.custom")},500),void 0!==t.data("choice")){var a=t.data("select2").getVal().toString(),r=_common.GetChoiceForSeleect2(t);""!=a&&"Select Any Provider"!=a&&"Select Any Instructor"!=a&&"Select Any Class"!=a&&void 0!==r.id?"GCPromo"==t.data("type")?(e(".txtAmounterrortext").hide(),e("#txtGCPromoAmount").removeClass("errorInput"),a==r.text?(t.select2("data",{id:r.id,text:r.text+" ("+r.promotext+")"}),"txtGCPromoAmount"==i.currentTarget.id&&e("#div_amount").html("$"+r.Price.toFixed(2).replace(".00",""))):_common.BindGCpromoPrice(t,a)):t.select2("data",{id:r.id,text:r.text}):("GCPromo"==t.data("type")?_common.BindGCpromoPrice(t,a):t.select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(t))}(iPadAndroid||isWindowsPhone)&&(1==("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase())?document.activeElement.blur():e("#ancSearchbook:visible").focus())}),"GCPromo"==t.data("type")&&t.on("select2-focus",function(a){setTimeout(function(){"GCPromo"==t.data("type")&&(e("#dvInnerGCContainer").length&&e("#dvInnerGCContainer").addClass("gc-transformnone"),e(a.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common")),e(a.target).closest(".service-book-what").addClass("book-service-open"),e("#select2-drop-mask").addClass("hidemask"),e("html, body").addClass("moboverflow-hide"),(void 0===i.scrollTop||i.scrollTop)&&e("html, body").animate({scrollTop:0})},200)}),applyJqueryScroll(".select2-results")},_common.BindGCpromoPrice=function(t,i){var a=t.data("GCPromoList"),r=e.grep(a,function(e){return parseFloat(i)==parseFloat(e.Price)});r.length>0?(i=r[0].Price,t.select2("data",{id:r[0].id,text:r[0].text+" ("+r[0].promotext+")"}),e("#div_amount").html("$"+i.toFixed(2).replace(".00",""))):1==e.isNumeric(i)&&parseFloat(i)>0?parseFloat(i)>999999?(t.select2("data",{id:"",text:""}),e("#div_amount").html("")):(i.indexOf(".")>0&&(i=parseFloat(i).toFixed(2)),e("#div_amount").html("$"+i.replace(".00","")),t.select2("data",{id:i,text:i})):(t.select2("data",{id:"",text:""}),e("#div_amount").html(""))}}(jQuery,window,document),function(e){_home={},_home.strBusinessTypes={featured:"featured",newest:"newest",bestrank:"best rank",kids:"kids"},_home.countriesLocation={us:"1",gb:"2",ca:"3",au:"4"},_home.HomePageBannerType={Beauty:1,Fitness:4,Wellness:2},"undefined"!=typeof Pagination&&(_home.FaturedPager=new Pagination(e("#featuredslider"),{Token:"GetHomePageBusinessDetail",Data:{},LocalData:{},PageSize:12,SlideWidthCeil:!0,NoDataFoundDiv:e("#divNoRecordsFeatured"),templateName:"divFeaturedBusinessHomeTemplate",Loader:e("#divFeatureLoader"),initialpageData:initialpageData,pageName:"home",lazyLoadClass:"lazypager",ScrollTarget:e("#featuredslider")}).init(),_home.PromotionsPager=new Pagination(e("#promotionsList"),{Token:"GetFeaturedPromotionListByProximityNew",Data:{},PageSize:12,LocalData:{},SlideWidthCeil:!0,NoDataFoundDiv:e("#divNoRecordsPromotions"),templateName:"divFeaturedPromotionHomeTemplate",Loader:e("#divPromotionLoader"),initialpageData:homeinitialpageData,pageName:"home",lazyLoadClass:"lazypager",ScrollTarget:e("#promotionsList")}).init(),_home.BookmarkPager=new Pagination(e("#divBookmarks"),{Token:"GetFavoriteBusinesses",Data:{},LocalData:{},PageSize:1e3,SlideWidthCeil:!0,NoDataFoundDiv:e("#divNoRecordsBookmarks"),templateName:"divBookmarksTemplate",Loader:e("#divBookmarksLoader"),initialpageData:initialpageData,pageName:"homeBookmark",lazyLoadClass:"lazypager",ScrollTarget:e("#divBookmarks")}).init()),_home.loadData=function(e,t){var i=e;if(i.init(),i.options.ActivateLoading=!0,i.options.Data.intCountryID=countryid,i.options.Data.strlatitude=lattitude,i.options.Data.strlongitude=longitude,i.options.Data.strTabName=t,i.options.Data.strBusinessTypes=businesstypes,i.options.Data.isCrwaler=!1,i.options.onRowLoad=_home.onFeaturedRowLoad,"divFeaturedBusinessHomeTemplate"==e.config.templateName){var a=getCookie(ProximityCookieName),r=getCookie(ProximityIsCurrentLocation);i.options.Data.cityName=a.city,i.options.Data.stateCode=a.state,i.options.Data.isFromMobile=!1,(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&(i.options.Data.isFromMobile=!0),i.options.Data.isCurrentLocation=void 0!==r&&null!=r&&"true"==r.toString().toLowerCase(),i.options.afterLoad=_home.onFeaturedafterLoad,i.options.Data.strBusinessTypes=""}i.scroll()},_home.loadPromotions=function(t,i,a){var r=0;1==i?(t.$elem=e("#servicePromotion"),t.options.templateName="servicePromoTemplate",t.init()):t==_featured.PromotionsPager?(t.options.templateClass="promotion-container",""!==lattitude&&""!==longitude?e("#liNearest,#liEndingSoon").css("display",""):e("#liEndingSoon").css("display",""),r=getSortingValue()):(t.$elem=e("#promotionsList"),t.options.templateName="divFeaturedPromotionHomeTemplate",t.options.templateClass=null,t.init(),""!==lattitude&&""!==longitude&&(r=5)),t.options.ActivateLoading=!0,t.options.Data.intCountryID=countryid,t.options.Data.dLatitude=lattitude,t.options.Data.dLongitude=longitude,t.options.Data.intRadius=distanceRadius,t.options.Data.intSortingValue=r,t.options.Data.strBusinessFacilityValues=null==businesstypeids?"":businesstypeids,t.options.Data.intPromotionCodeID=lBusinessPromoCodeID,t.options.Data.dtFromDate=null,t.options.Data.dtToDate=null,t.options.Data.blIsRandom=a,t.options.onRowLoad=_home.onPromotionsRowLoad;var o="";0==i&&1==a&&t==_home.PromotionsPager?(t.options.Data.isHomePage=!0,t.options.afterLoad=_home.afterHomePromotionRowLoad,t.options.Data.strBusinessFacilityValues="",t.options.Data.sFacilities="[]",t.options.Data.sKidsCondition="",t.options.Data.SearchFilter=2,o="0"):(t.options.Data.isHomePage=!1,t.options.afterLoad=_home.afterPromotionRowLoad,t.options.Data.sFacilities=JSON.stringify(_featured.GetFacilityObject()),t.options.Data.sKidsCondition=kidsFacilities,t.options.Data.SearchFilter=businessSearchMode,o=businessSearchModeForSelection.join()),0==dealserviceId?t.options.Data.ServiceID=null:t.options.Data.ServiceID=dealserviceId;var n=getCookie(ProximityCookieName),s=getCookie(ProximityIsCurrentLocation);t.options.Data.cityName=n.city,t.options.Data.stateCode=n.state,t.options.Data.isFromMobile=!1,(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&(t.options.Data.isFromMobile=!0),t.options.Data.isCurrentLocation=void 0!==s&&null!=s&&"true"==s.toString().toLowerCase(),t.options.Data.ignoreBusinessIds="",t.options.Data.BusinessTypes=null==businesstypes?"":businesstypes,t.options.Data.ArrSearchFilter=o,t.scroll(),t.enableScroll()},_home.onFeaturedRowLoad=function(t,i){var a=e(i),r=t.IsNewBusiness&&(null==t.TotalReview||0==t.TotalReview);r||e("input.addrating",a).prop("value",t.intRating-1).rating();var o=e("#dvFeatureReviews",a);if(r)e(".vagaro-star-rating",a).attr("style","display: none !important"),o.attr("aria-label","New Business").addClass("badgeNewWrap").html("<span class='badge-button-blue'>New</span>");else if(null!=t.TotalReview){var n=parseFloat(t.intRating),s=isNaN(n)?"0.0":n.toFixed(1),l=1==t.TotalReview?"Review":"Reviews";o.text(s+" ("+t.TotalReview+" "+l+")")}if(e("#home_featurebusinesslink_"+t.BusinessID).attr("onclick","javascript:window.location.href='/"+t.VagaroURL+"'"),e("#homefeaturedBusinssName_"+t.BusinessID).attr("onclick","javascript:window.location.href='/"+t.VagaroURL+"'"),t.blnPromotions){var d={};d.BusinessID=t.BusinessID,d.BusinessName=t.BusinessName,d.Street=null!==t.Street?t.Street:"",d.City=t.City,d.Zip=t.Zip,d.StateName=t.StateName,d.VagaroURL=t.VagaroURL,d.TotalPage=t.TotalPage,d.Telephone=t.Telephone,e("#promotion_"+t.BusinessID).attr("style",""),e("#promotion_"+t.BusinessID).attr("onclick","javascript:window.location.href='/"+t.VagaroURL+"/deals/"+t.PromotionTitle+"-"+t.PromotionCreatedDate+"'")}else e("#promotion_"+t.BusinessID).attr("style","display:none");if("featured"==t.CalledtabName){if(e("#homefeaturedBusinssName",a).text(_common.getShortNameForDesign(t.BusinessName,40,37)),!r&&t.intRating>0){var c=100*t.intRating/5;e("#divPopularBusRating_"+t.BusinessID,a).css("width",c+"%")}e(".ad-text",a).hide()}else e(".businesses-thumb h2",a).text(_common.getShortNameForDesign(t.BusinessName,15,12));return a},_home.onFeaturedafterLoad=function(t){_common.FeaturedBusinessTooltip(),null==t||0==t.length?e("#scFeatureBusiness").attr("style","display:none;"):e("#scFeatureBusiness").attr("style","display:block;"),null==t||t.length<4?(e("#btnPopularNext").hide(),e("#btnPopularPre").hide(),e("#aSeeAllPopularBusiness").addClass("no-arrow-slide"),e("#featuredslider").removeAttr("ondragend")):(e("#btnPopularNext").show(),e("#btnPopularNext").removeClass("slide-disabled"),e("#btnPopularNext").removeAttr("disabled"),e("#btnPopularPre").show(),e("#btnPopularPre").addClass("slide-disabled"),e("#btnPopularPre").attr("disabled",!0),e("#aSeeAllPopularBusiness").removeClass("no-arrow-slide"),e("#featuredslider").attr("ondragend","javascript: dragOnSlider(event, 'featuredslider', 'btnPopularPre', 'btnPopularNext');")),_common.AddEndSpaceInSlider("#featuredslider")},_home.featuredLoadmoreClick=function(t,i){if(isDealFilterApplied=!1,_home.HideHomeSliderMoreBusinessTypePopup(),e(".tips-mobile-section-fade").hide(),e(".tips-mobile-section").animate({bottom:"-100%"},200),null!=t){ResetBusinessSearchMode(),resetAllCheckBox(),businesstypes=bussinessTypesByCategoryname[t],businesstypeids=bussinessTypeIdsByCategoryname[t],h1=h1ByCategoryname[t],title=titleByCategoryname[t],category=categoryByCategoryname[t],pserviceid="";var a=getCookie(ProximityCookieName);null!=a&&(1==isAdvanceSearch&&localStorage.setItem("businesstypes",businesstypes),a.businesstypes=businesstypes,a.h1=h1,a.title=title,a.category=category,setCookie(ProximityCookieName,a)),generateCheckboxList(businesstypes,"chkbusiness");var r=_common.loadSections("listings");"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),r&&i.preventDefault()}},_home.GetfeaturedBeautyLink=function(e,t){return null!=e?(businesstypes=bussinessTypesByCategoryname[e],businesstypeids=bussinessTypeIdsByCategoryname[e],_common.Getbeautylink("listings")):(businesstypes="",businesstypeids="",_common.Getbeautylink("listings"))},_home.onPromotionsRowLoad=function(t,i){var a=e(i);0==a.index()&&"deals"==tabSegment&&e("#ulFeatureBusiness").addClass("daily home-page-section");if(e(".ad-text",a).hide(),e("#promotionTitle",a).html(""+_common.getShortNameForDesign(t.PromotionTitle,67,64)),e("#promoBusinessName",a).text(_common.getShortNameForDesign(t.BusinessName,34,31)),e("#promoCity",a).text(_common.getShortNameForDesign(t.City,26,23)+t.StateCode),t.IsNewBusiness)e("#spnRatingStar",a).hide(),e("#reviewTotal",a).html("<span class='badge-button-blue'>New</span>"),e("#reviewTotal",a).attr("aria-label","New Business");else if(0==(o=parseFloat(t.AverageRank)||0))e("#divAverageRank",a).hide();else{e("#divAverageRank",a).show();var r=1==t.ReviewTotal?"Review":"Reviews";e("#divAverageRank",a).attr("title",o.toFixed(1)),e("#reviewTotal",a).text(o.toFixed(1)),e("#reviewTotal",a).attr("aria-label","Has "+o.toFixed(1)+" star rating with total "+t.ReviewTotal+" "+r)}var o,n=parseInt(e("#spnTotalRecords").html());if(null!=t.TotalPage&&t.TotalPage!=n&&e("#spnTotalRecords").html(t.TotalPage),null!==t.ServiceOldPrice&&(e(".spnCurrencySymbol",a).html(currencysymbol),null!==t.PromotionDiscount&&0==t.PromotionDiscount&&(e("#spnDiscount",a).html(PrmotionfreeCode),e("#spnDiscount",a).attr("aria-label","Promotion Discount "+PrmotionfreeCode))),null!=t.Telephone&&""!=t.Telephone&&e("#ddhdnPhone_"+t.BusinessID).val(t.Telephone),t.DealDiscountAmtType>0&&null!==t.PromotionDiscount?1==t.DealDiscountAmtType?(e("#spnDiscount",a).html("UP TO "+currencysymbol+t.PromotionDiscount+" OFF"),e("#spnDiscount",a).attr("aria-label","Promotion Discount UP TO "+currencysymbol+t.PromotionDiscount+" OFF"),e("#spnOldPrice",a).css("display","none")):2==t.DealDiscountAmtType?(e("#spnDiscount",a).text("UP TO "+t.PromotionDiscount+"% OFF"),e("#spnDiscount",a).attr("aria-label","Promotion Discount UP TO "+t.PromotionDiscount+"% OFF"),e("#spnOldPrice",a).css("display","none")):3==t.DealDiscountAmtType&&(e("#spnDiscount",a).html(currencysymbol+t.PromotionDiscount+" OFF"),e("#spnDiscount",a).attr("aria-label","Promotion Discount "+currencysymbol+t.PromotionDiscount+" OFF"),e("#spnOldPrice",a).css("display","none")):null===t.ServiceOldPrice&&null!==t.PromotionDiscount?100==parseInt(t.PromotionDiscount)?(e("#spnDiscount",a).html(PrmotionfreeCode),e("#spnDiscount",a).attr("atia-label","Promotion Discount "+PrmotionfreeCode)):(e("#spnDiscount",a).append("% OFF"),e("#spnOldPrice",a).css("display","none")):t.PromotionDiscount<0?(e("#spnDiscount",a).html(PrmotionfreeCode),e("#spnDiscount",a).attr("aria-label","Promotion Discount "+PrmotionfreeCode)):e("#spnOldPrice",a).css("display","inline-block"),t.TotalUsage>0&&t.UsageLeft<6&&t.UsageLeft>0?e("#spnusageLeft",a).text(t.UsageLeft+" LEFT"):e("#UsageLeft",a).css("display","none"),t.IsNewBusiness)e("#spnRatingStar",a).hide(),e("#reviewTotal",a).html("<span class='badge-button-blue'>New</span>"),e("#reviewTotal",a).attr("aria-label","New Business");else if(0==(o=parseFloat(t.AverageRank)||0))e("#divAverageRank",a).hide();else{e("#divAverageRank",a).show();r=1==t.ReviewTotal?"Review":"Reviews";e("#divAverageRank",a).attr("title",o.toFixed(1)),e("#reviewTotal",a).text(o.toFixed(1)),e("#reviewTotal",a).attr("aria-label","Has "+o.toFixed(1)+" star rating with total "+t.ReviewTotal+" "+r)}return a},_home.loadHomePageData=function(){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){var t=getCookie(ProximityCookieName);e("#spnAppLocationSearch").html(_common.SetCityState(t.city,t.state.toUpperCase())),CallbackforMobileApp(0,0,"","",0,28)}if(null!=UserID&&""!=UserID&&(e("#divBookmarks").empty(),_home.loadFavoriteBusinesses(),_home.loadUpComingAppointments(),_home.GetOutStandingReviewAndInvoiceCnt()),e("#dvFeatureBusiness").hide(),e("#dvHome").attr("style","display:block;"),_home.loadHeroList(),_home.loadStaticContent(),_home.ShowUKHomePageUKJoinVagaroSection(),_home.ShowUKHomePageUKCookiesSection(),null==AdminServiceList.results||0==AdminServiceList.results.length)"undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()?AdminServiceList.results=[]:InitAdminServices();else{var i=service;void 0!==htmlDecode&&(i=htmlDecode(service));var a=e(IdSearchServiceMain);"undefined"!=typeof _eventType&&null!=typeof _eventType||(_eventType=""),a.select2("data",{id:i,text:i,EventType:_eventType});var r={id:i,text:i,EventType:_eventType};void 0!==a.data("choice")&&_common.SetChoiceForSeleect2(a,r)}setDateTimeforServiceNew("divHomeServicesDate"),_home.loadData(_home.FaturedPager,_home.strBusinessTypes.featured),_home.PromotionsPager.init(),_home.loadPromotions(_home.PromotionsPager,!1,1),lazyLoadWithContainer("lazycategory","popular_category"),e(".square-slide-div:nth-child(3) .lazycategory","#popular_category").length&&e(".square-slide-div:nth-child(3) .lazycategory","#popular_category").lazyload({effect:"fadeIn"}),e(IdHomeServicesDate).val(AnyTime),setTimeout(function(){e(IdHomeServicesDate).val(AnyTime)},100),e("#txtHomeServicesDate").val(AnyTime),setTimeout(function(){e("#txtHomeServicesDate").val(AnyTime)},100),_home.RegisterHomePageSilder(),"undefined"==typeof isDisplayGiftCardbanner||null===isDisplayGiftCardbanner||"True"!=isDisplayGiftCardbanner&&1!=isDisplayGiftCardbanner||("undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CustomerApp&&(e("body").addClass("homePageBody"),e("#holidayGcBanner").show()),!e("#holidayGcBanner").is(":visible")||"True"!=isDisplayUkBanner&&1!=isDisplayUkBanner||e("body").addClass("homepageUKBanner"))},_home.RegisterHomePageSilder=function(){_home.HomePageSlider("promotionsList",".card-link-block"),_home.HomePageSlider("featuredslider",".card-link-block"),_home.HomePageSlider("divBookmarks",".card-link-block"),_home.HomePageSlider("dvLiveStream",".livestreambox"),_home.HomePageSlider("divUpcomingApptMnts",".ucservice-box")},_home.HomePageSlider=function(t,i){window.innerWidth<=660?e("#"+t).hasClass("vbScroll-initialized")||e("#"+t).scroll(function(){e(this).addClass("vbScroll-initialized"),clearTimeout(e.data(this,"scrollCheck")),e.data(this,"scrollCheck",setTimeout(function(){var a=e("#"+t).scrollLeft(),r=e("#"+t+" > "+i).first().outerWidth(),o=r*Math.round(a/r);a!=o&&e("#"+t).animate({scrollLeft:o},200)},400))}):e("#"+t).hasClass("vbScroll-initialized")&&(e("#"+t).off("scroll"),e("#"+t).removeClass("vbScroll-initialized"))},_home.loadStaticContent=function(){e(".slick-fourblockslider .lazy-bgimg").length>0&&e(".slick-fourblockslider .lazy-bgimg").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload")},_home.openCategoryDB=function(){return new Promise(function(e,t){var i=indexedDB.open(CATEGORY_DB_NAME,1);i.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(Category_STORE)||t.createObjectStore(Category_STORE,{keyPath:"key"})},i.onsuccess=function(t){e(t.target.result)},i.onerror=function(e){t(e)}})},_home.getCategoryCache=async function(){try{var e=await _home.openCategoryDB();return new Promise(function(t){let i;try{i=e.transaction(Category_STORE,"readonly")}catch(e){try{return indexedDB.deleteDatabase(CATEGORY_DB_NAME),void t(null)}catch(e){return void t(null)}}var a=i.objectStore(Category_STORE).get("adminCategory");a.onsuccess=function(){var e=a.result;if(e){if(Date.now()-e.timestamp>TTL_TIME)return indexedDB.deleteDatabase(CATEGORY_DB_NAME),void t(null);t(e.data)}else t(null)},a.onerror=function(){t(null)}})}catch(e){return null}},_home.setCategoryCache=async function(e){try{var t=await _home.openCategoryDB();return new Promise(function(i,a){var r=t.transaction(Category_STORE,"readwrite").objectStore(Category_STORE).put({key:"adminCategory",data:e,timestamp:Date.now()});r.onsuccess=function(){i(!0)},r.onerror=function(){a(!1)}})}catch(e){return console.log(e),!1}},_home.GetMasterCategoryValues=async function(e){try{let t=null;if(_home.IsIndexedDBSupported&&_home.IsIndexedDBSupported()&&(t=await _home.getCategoryCache(),t&&t.length>0))return void _home.bindCategoryUI(t,e);let i=await new Promise(function(e,t){var i=new vagaro.ajax;i.datamodel.Token="GetMasterCategoryValues",i.datamodel.data={},i.datamodel.callback=function(t){e(t)},i.datamodel.Error=function(e){t(e)},i.Post()});i&&i.length>0?(t=i,_home.IsIndexedDBSupported&&_home.IsIndexedDBSupported()&&await _home.setCategoryCache(i),_home.bindCategoryUI(t,e)):vagaro.alert("Something went wrong, Try Again.")}catch(e){console.log("Error:",e)}},_home.bindCategoryUI=function(t,a){e("#divCategoryPopup").html("");for(var r=0;r<t.length;r++){var o=e.grep(a,function(e){return e.SliderType==t[r].MasterServiceCategoryId});if(!String.isNullOrUndefineOrBlank(o)&&o.length>0){$divMain=e('<div class="main-section-tips"><div class="web-display-small">'+t[r].MasterServiceCategoryName+'</div><div id="divseo_'+r+'" class="body-inner-section"></div></div>'),$divMain.appendTo(e("#divCategoryPopup"));var n=_home.BindHeroSliderycitystate();for(i=0;i<o.length;i++)o[i].cookieCityState=n;e("#homesliderImageMobile").tmpl(o).appendTo("#divseo_"+r)}}},_home.loadHeroList=function(){try{var t=HSnames;if(void 0!==t&&null!=t&&""!=t&&""!=t&&t.length>0){for(var i=0;i<t.length;i++)bussinessTypesByCategoryname[t[i].HeroCategoryName.toLowerCase()]=t[i].HSBusinessType,bussinessTypeIdsByCategoryname[t[i].HeroCategoryName.toLowerCase()]=t[i].HSBusinessTypeId,h1ByCategoryname[t[i].HeroCategoryName.toLowerCase()]=t[i].H1,titleByCategoryname[t[i].HeroCategoryName.toLowerCase()]=t[i].Title,categoryByCategoryname[t[i].HeroCategoryName.toLowerCase()]=t[i].HeroCategoryName;var a=iPadAndroid?"touchstart":"click";e("#aSeeAllBeautyHomeCategory").unbind(a),e("#aSeeAllBeautyHomeCategory").bind(a,function(e){ResetBusinessSearchMode(),resetAllCheckBox(),setdefaultSortingOption("listSort","listings"),_common.loadSections("listings")&&e.preventDefault()}),e("#aSeeAllFitnessHomeCategory").unbind(a),e("#aSeeAllFitnessHomeCategory").bind(a,function(e){ResetBusinessSearchMode(),resetAllCheckBox(),setdefaultSortingOption("listSort","listings"),_common.loadSections("listings")&&e.preventDefault()}),e("#popular-beauty-cat-row").html(""),e("#popular-beauty-cat-row1").html("");var r=e.grep(t,function(e,t){return 1==e.ShowChipOnSlider}),o=!1;try{o=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1}catch(e){}r.length>9&&(r=iosDevices||iPadAndroid||isAndroidMobile||isAndroidMobile||o?r.slice(0,6):r.slice(0,9));var n=_home.BindHeroSliderycitystate();for(i=0;i<r.length;i++)r[i].cookieCityState=n;e("#homesliderImageMobile").tmpl(r).appendTo("#popular-beauty-cat-row"),e("#popular-beauty-cat-row").append('<a href="javascript:void(0);" onclick="_home.ShowHomeSliderMoreBusinessTypePopup();" class="filter-button">More...</a>'),e("#homesliderImageMobile").tmpl(r).appendTo("#popular-beauty-cat-row1"),e("#popular-beauty-cat-row1").append('<a href="javascript:void(0);" onclick="_home.ShowHomeSliderMoreBusinessTypePopup();" class="filter-button">More...</a>');var s=e.grep(t,function(e,t){return null!=e.PopularCategoryImage&&""!=e.PopularCategoryImage});s=s.sort(function(e,t){return e.ImageOrder-t.ImageOrder}),e("#spnSliderServicename").text(s[0].BookYourNext),e.trim(e("#sliderHomePageHero").html()).length<=0&&(e("#homesliderImage").tmpl(s).appendTo("#sliderHomePageHero"),e("#sliderHomePageHero .overlay-hero-image:not(:first)").hide()),e("#spnSliderServicename1").text(s[0].BookYourNext),e.trim(e("#sliderHomePageHero1").html()).length<=0&&(e("#homesliderImage").tmpl(s).appendTo("#sliderHomePageHero1"),e("#sliderHomePageHero1 .overlay-hero-image:not(:first)").hide()),"undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()?e("#divCategoryPopup").html(""):_home.GetMasterCategoryValues(t);var l=e.grep(t,function(e,t){return 1==e.ShowChipOnSlider&&e.HSType==_home.HomePageBannerType.Beauty});l=l.sort(function(e,t){return e.ChipOrder-t.ChipOrder});n=_home.BindHeroSliderycitystate();for(i=0;i<l.length;i++)l[i].cookieCityState=n;e(".divHomePageBannerMobileBeautybody").html(""),e("#homesliderImageMobile").tmpl(l).appendTo(".divHomePageBannerMobileBeautybody");var d=e.grep(t,function(e,t){return 1==e.ShowChipOnSlider&&e.HSType==_home.HomePageBannerType.Fitness});d=d.sort(function(e,t){return e.ChipOrder-t.ChipOrder});n=_home.BindHeroSliderycitystate();for(i=0;i<d.length;i++)d[i].cookieCityState=n;e(".divHomePageBannerMobileFitnessbody").html(""),e("#homesliderImageMobile").tmpl(d).appendTo(".divHomePageBannerMobileFitnessbody");var c=e.grep(t,function(e,t){return 1==e.ShowChipOnSlider&&e.HSType==_home.HomePageBannerType.Wellness});c=c.sort(function(e,t){return e.ChipOrder-t.ChipOrder});n=_home.BindHeroSliderycitystate();for(i=0;i<c.length;i++)c[i].cookieCityState=n;e(".divHomePageBannerMobileWellnessbody").html(""),e("#homesliderImageMobile").tmpl(c).appendTo(".divHomePageBannerMobileWellnessbody")}_common.UpdateTimeZoneLocationCookie(!1)}catch(e){}},_home.BindHeroSliderycitystate=function(){void 0===_home.BindHeroSliderycitystate.hasLoadedCities&&(_home.BindHeroSliderycitystate.hasLoadedCities=!1);var e=getCookie(ProximityCookieName);null!=e&&void 0!==e&&(_home.BindHeroSliderycitystate.hasLoadedCities||(LoadCitiesAndServices(e.countryid),_home.BindHeroSliderycitystate.hasLoadedCities=!0));var t="",i="",a="";return null!=e&&void 0!==e&&(null!=e.city&&void 0!==e.city&&""!=e.city&&(t=e.city.toLowerCase().replace(" ","-").trim()+"--",i=e.city.toLowerCase().trim().replace(/\s+/g,"-")),null!=e.state&&void 0!==e.state&&""!=e.state&&(a=2==e.countryid?e.stateName.toLowerCase().replace(" ","-").trim():e.state.toLowerCase().trim()),null!=e.countryid&&void 0!==e.countryid&&""!=e.countryid&&(cookieCountryid=e.countryid)),t=RemoveAccents(GetPlainTextForLocationSearch(t)),i=RemoveAccents(GetPlainTextForLocationSearch(i)),t+a},_home.BindDataWithTemplate=function(t){e("#divUpcomingApptMnts").html(""),e("#divUpcomingApptTemplate").tmpl(t).appendTo("#divUpcomingApptMnts"),e(".upcoming-business-img").lazyload({effect:"fadeIn",failure_limit:5e4,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:""}).trigger("lazyload")},_home.loadUpComingAppointments=function(){try{e("#scUpcomingApptMnts").show(),e("#divUpcomingApptMnts").unslick(),clearInterval(timerIDHomeUpcomingAppnt);var t=null!=UserID&&""!=UserID?parseInt(UserID):0;_home.GetSetIndexedDBForUpComingAppmntDetails(null,t),setTimeout(function(){null!=_home.upcomingAppCache&&_home.upcomingAppCache.length>0&&0==_home.IsRefresh(_home.upcomingAppCache[0].lastSyncTime)?(_home.afterUpcomingApptMntsRowLoad(_home.upcomingAppCache),_home.upcomingAppCache=null):(_home.RemoveDBObject(),setTimeout(function(){var e={pageIndex:1,pageSize:24};e.strLoginUserId=encUid;var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumOnlineCommon.getupcomingappintmentdata,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.data=e,t.datamodel.callback=function(e){_home.afterUpcomingApptMntsRowLoad(e)},t.datamodel.Error=function(e){_home.ResetUpcomingAppObjDivhide()},t.Post()},250))},500)}catch(e){_home.ResetUpcomingAppObjDivhide()}},_home.redirectToUpComingMyAccount=function(e,t,i,a){"undefined"!=typeof vgAppicationType&&1==vgAppicationType?CallbackforMobileApp(0,0,"","","0","39|~|"+('{\\"appointmentID\\":\\"'+e+'\\",\\"BusinessID\\":\\"'+t+'\\",\\"Group\\":\\"'+i+'\\",\\"EventType\\":\\"'+a+'\\"}')):window.location.href="/myaccount/appointments?isFromHomePage="+e+i;return!1},_home.afterUpcomingApptMntsRowLoad=function(t){if(null==t||0==t.length)_home.ResetUpcomingAppObjDivhide();else{var i;e("#dvUpcomingAppointmentStensil").hide(),e("#scUpcomingApptMnts").show();null!=t&&t.length>0&&null!=t[0].CurrentDateUTC&&(i=new Date(t[0].StrCurrentDateUTC),_gblUCAppmntCurrentTimeDiff=new Date(t[0].StrCurrentDateUTC)-new Date,HomePageUpcomingApptData=e.grep(t,function(e){return!(getDateDiff(i,e.StrEndTimeUTC,!0)<=-1)}),null!=HomePageUpcomingApptData&&HomePageUpcomingApptData.length>0?(_home.BindDataWithTemplate(HomePageUpcomingApptData),_home.GetSetIndexedDBForUpComingAppmntDetails(HomePageUpcomingApptData,null!=UserID&&""!=UserID?parseInt(UserID):0),timerIDHomeUpcomingAppnt=setInterval(function(){_home.RefreshUpcomingAppmntData(UpComingLiveStreamFromType.Home)},3e4)):_home.ResetUpcomingAppObjDivhide())}if(_home.setSlickerUpcomingApptMnts(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType){for(var a=[],r=0;r<t.length;r++){var o=new Object;o.appointmentID=t[r].AppointmentID,o.businessID=t[r].BusinessID,o.sGroup=t[r].sGroup,o.eventType=t[r].EventType,a.push(o)}CallbackforMobileApp(0,0,"","","0","48|~|"+JSON.stringify(a))}},_home.setSlickerUpcomingApptMnts=function(){upcomingSlider(),e(window).width()<=767&&e("#divUpcomingApptMnts").unslick()},_home.RemoveDBObject=function(){try{if(_home.IsIndexedDBSupported()){var e=_home.GetIndexedDB();null!=e?e.deleteDatabase("UpAppDB"):console.log("could not connect index db.")}}catch(e){console.log("Error:"+e)}},_home.RefreshUpcomingAppmntData=function(t){if(t==UpComingLiveStreamFromType.Home)if(void 0===tabSegment||"/"!=tabSegment&&"home"!=tabSegment.toLowerCase())clearInterval(timerIDHomeUpcomingAppnt),"undefined"!=typeof HomePageUpcomingApptData&&null!=HomePageUpcomingApptData&&(HomePageUpcomingApptData=null);else if("undefined"!=typeof HomePageUpcomingApptData&&null!=HomePageUpcomingApptData&&HomePageUpcomingApptData.length>0){var i=0,a=HomePageUpcomingApptData.length,r=e.grep(HomePageUpcomingApptData,function(t){var a=getDateDiff(moment(new Date).add(_gblUCAppmntCurrentTimeDiff,"milliseconds")._d,t.StrEndTimeUTC,!0),r="#divUpcoming_"+t.AppointmentID;return!(e(r).length>0&&a<=-1)||(i++,e(r).hide(),!1)});i==HomePageUpcomingApptData.length&&(_home.ResetUpcomingAppObj(),clearInterval(timerIDHomeUpcomingAppnt)),r.length>0&&a>r.length&&(HomePageUpcomingApptData=r,_home.RemoveDBObject(),_home.GetSetIndexedDBForUpComingAppmntDetails(r,null!=UserID&&""!=UserID?parseInt(UserID):0))}},_home.IsRefresh=function(e){return 1*getDateDiff(moment(e)._d,new Date,!0)>5},_home.ChangeDate=function(e,t){var i=moment(new Date(e));return t?i.format("DD"):i.format("MMM")},_home.ResetUpcomingAppObj=function(){_home.RemoveDBObject(),_home.ResetUpcomingAppObjDivhide()},_home.ResetUpcomingAppObjDivhide=function(){e("#scUpcomingApptMnts").hide(),e("#dvUpcomingAppointmentStensil").hide()},_home.loadFavoriteBusinesses=function(){var e=_home.BookmarkPager;e.init(),e.options.ActivateLoading=!0,e.options.Data.lUserID=0,e.options.Data.countryID=null!=countryid&&""!=countryid?countryid:1,null!=lattitude&&""!=lattitude?e.options.Data.latitude=parseFloat(lattitude):e.options.Data.latitude=0,null!=longitude&&""!=longitude?e.options.Data.longitude=parseFloat(longitude):e.options.Data.longitude=0,e.options.Data.strUserID=isNullOrUndefineOrBlank(strUserID)?"":strUserID,e.options.onRowLoad=_common.onBookmarkRowLoad,e.options.afterLoad=_common.afterBookmarkRowLoad,e.scroll()},_home.afterPromotionRowLoad=function(t){if(e("#spnTotalRecords").show(),_common.FeaturedBusinessTooltip(),null==t){var i=[];e(".daily-deal-link").each(function(){var t=e(this).data(),a={};a.BusinessID=t.businessid,a.BusinessName=t.businessname,a.LATITUDE=t.latitude,a.LONGITUDE=t.longitude,a.PromotionID=t.promotionid,i.push(a)}),google.maps.event.trigger(map,"resize"),loadMarkers(i,"deals")}else 0==t.length&&(e("#spnTotalRecords").html("No"),e(".divSorting").hide(),setTimeout(function(){e("#divNodataFeature").attr("tabindex",-1).attr("role","banner").attr("aria-labelledby","myLikeNoDataMsg").focus(),e("myLikeNoDataMsg").attr("aria-hidden",!0)},600)),t.length>0&&(t.length>1||t[0].TotalPage>1?e(".divSorting").show():e(".divSorting").hide(),google.maps.event.trigger(map,"resize"),loadMarkers(t,"deals"));""!=_featured.PromotionsPager.options.Data.ignoreBusinessIds&&void 0!==_featured.PromotionsPager.options.Data.ignoreBusinessIds||setTimeout(function(){var t="";1==e("#ulFeatureBusiness").is(":visible")&&e("#ulFeatureBusiness:visible").find("section.cards-parent-div-flex .daily-deal-link").slice(0,6).each(function(){var i=e(this);void 0!==i.data("isfeatured")&&"true"==i.data("isfeatured").toString().toLowerCase()&&void 0!==e(this).data("businessid")&&(t+=e(this).data("businessid")+",")}),t=t.replace(/(^[,\s]+)|([,\s]+$)/g,""),_featured.PromotionsPager.options.Data.ignoreBusinessIds=t},500)},_home.afterHomePromotionRowLoad=function(t){_common.FeaturedBusinessTooltip(),null==t||0==t.length?e("#scDailyDeals").attr("style","display:none;"):e("#scDailyDeals").attr("style","display:block;"),e("#btnDealsNext").hide(),e("#btnDealsPre").hide(),e("#promotionsList").removeAttr("ondragend"),e("#aSeeAllDeals").addClass("no-arrow-slide"),null!=t&&t.length>0&&t[0].TotalPage>0?(t.length>=4&&(e("#btnDealsNext").show(),e("#btnDealsNext").removeClass("slide-disabled"),e("#btnDealsNext").removeAttr("disabled"),e("#btnDealsPre").show(),e("#btnDealsPre").addClass("slide-disabled"),e("#btnDealsPre").attr("disabled",!0),e("#aSeeAllDeals").removeClass("no-arrow-slide"),e("#promotionsList").attr("ondragend","javascript:dragOnSlider(event, 'promotionsList', 'btnDealsPre', 'btnDealsNext');")),e("#aSeeAllDeals").attr("style","display:block;"),_common.AddEndSpaceInSlider("#promotionsList")):e("#aSeeAllDeals").attr("style","display:none;")},_home.PromotionLoadmoreClick=function(){loadData("deals",!0),_common.setGeoLocationMarker("deals")},_home.myaccountpaymentmethods=function(e){setTimeout(function(){var t={},i=new vagaro.ajax;"undefined"==typeof strUserID||"undefined"==strUserID||null==strUserID||""==strUserID?(t.LoginUserID=e,i.datamodel.Token=ApiURLEnumOnlineCommon.getloginusergroups):(t.strLoginUserID=strUserID,i.datamodel.Token=ApiURLEnumOnlineCommon.getloginusergroup),i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=t,i.datamodel.callback=function(e){},i.datamodel.Error=function(e){},i.Post()},500)},_home.CommonLogin=function(t,i,a){if(1==t){if(injecthtml(),e(".lnkLogin").hide(),("undefined"!=typeof _siteBuilderDetail&&null!=_siteBuilderDetail.IsCustomWebsite&&1==_siteBuilderDetail.IsCustomWebsite||"undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite)&&e("#divUserName").removeClass("custom-theme-nav"),"undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite?e("#divUserName").html("Hi,"+i).removeClass("hide-notlogged"):e("#divUserName").html("Welcome, "+i).removeClass("hide-notlogged"),"undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite&&e("#dvShoppingCartIcon").is(":visible")?e("#divLoginDetail").hide():e("#divLoginDetail").removeAttr("style"),e("#divLoginDetailCart").removeAttr("style"),"undefined"!=typeof WebsiteBuilderType&&""!=WebsiteBuilderType?"Builder"==WebsiteBuilderType&&"MyAccount"==WebsiteBuilderEvent&&(""!=a?e(".profilesidePic").html("<div id='divUserPhoto' class='nav-profile-photo vagaro-avatar-sm opacity-1' role='link' tabindex='-1' aria-label='Navigation bar' data-original='"+a+"' style=\"display: block; background-image:url('"+a+"');\"><div class='avatar-inital intialsname vg-avatar-inital' aria-hidden='true' style='display: none;'><div class='avatar-inital-inner vg-avatar-inital-inner'><div class='avatar-inital-inner-text loginUserIntials vg-avatar-inital-inner-text'>"+i+"</div></div></div></div>"):e(".profilesidePic").html("<div class='profilesidePic'><div id='divUserPhoto' class='nav-profile-photo vagaro-avatar-sm opacity-1' role='link' tabindex='-1' aria-label='Navigation bar' data-original='' style='display: block; background-image: none;'><div class='avatar-inital intialsname vg-avatar-inital' aria-hidden='true' style='display: block;'><div class='avatar-inital-inner vg-avatar-inital-inner'><div class='avatar-inital-inner-text loginUserIntials vg-avatar-inital-inner-text'>"+i+"</div></div></div></div></div>")):(e("#divUserPhoto").attr("data-original",a),e("#divUserPhoto").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),e(".profilesidePic").html(e("#divUserPhoto").clone()).find("#divUserPhoto").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload")),e(".loginlink").show(),void 0!==e("#CheckinpUserName")&&"undefined"!=typeof vgAppicationType&&void 0!==objApplicationType&&vgAppicationType==objApplicationType.CheckinApp)if(""==e("#hdnUserName").val()){var r=new vagaro.ajax;r.datamodel.Token="GetFirstNameForCheckin",r.datamodel.callback=function(t){""!=t?e("#CheckinpUserName").html("Welcome, "+t):e("#CheckinpUserName").html("Welcome, "+i.slice(0,-2))},r.datamodel.Error=function(t){e("#CheckinpUserName").html("Welcome, "+i.slice(0,-2))},r.datamodel.data=[],r.Post()}else e("#CheckinpUserName").html("Welcome, "+e("#hdnUserName").val().slice(0,-2));"undefined"==strUserID||null==strUserID||""==strUserID?_home.myaccountpaymentmethods(UserID):_home.myaccountpaymentmethods(strUserID)}else e(".loginlink").hide(),e(".lnkLogin").show(),e("#divUserName").html("").addClass("hide-notlogged"),e("#divLoginDetail").hide(),e("#divLoginDetailCart").hide(),e("#dvlogindropdown").empty(),e("#mobile-menu").children("#dvlogindropdown").empty(),e("#divbusinesslogin").empty(),e("#desktop-menu").children("#divbusinesslogin").empty(),("undefined"!=typeof _siteBuilderDetail&&null!=_siteBuilderDetail.IsCustomWebsite&&1==_siteBuilderDetail.IsCustomWebsite||"undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite)&&e("#divUserName").addClass("custom-theme-nav")},_home.redirecttoStaff=function(t,i,a){if(iPadAndroid||isWindowsPhone){var r=e(a).closest(".gallery-solo-image");e(r).hasClass("hover")?(e(r).removeClass("hover"),location.href="../../../"+t+"/staff"):(i.stopPropagation(),i.preventDefault(),e(".gallery-solo-image").removeClass("hover"),e(r).addClass("hover"))}else location.href="../../../"+t+"/staff"},_home.galleryhover=function(t,i,a,r,o){if((iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&e("#divBookNowMasterPage").removeClass("mobile-book-div"),void 0!==o&&"true"==o&&(r="#"+e(i).closest(".panel-group").attr("id")+" "+r),iPadAndroid||isWindowsPhone){var n=e(i).closest(".cust-img-popup-slider");"false"==a.toLowerCase()&&_featured.openGalleryPopup(i),e(n).hasClass("hover")?(e(n).removeClass("hover"),_featured.openGalleryPopup(i)):(t.stopPropagation(),t.preventDefault(),e(".gallery-solo-image").removeClass("hover"),e(n).addClass("hover"))}else _featured.openGalleryPopup(i);void 0!==r&&""!=r&&""!=r||(r="#ulFeatureBusiness"),styleCounter=e(".imgstyles",r).index(e(i,r)),styleCounter==e(".imgstyles",r).length-1?(e("#btnStyleNext").addClass("w-lightbox-inactive"),e("#btnStylePrev").removeClass("w-lightbox-inactive")):0==styleCounter?(e("#btnStylePrev").addClass("w-lightbox-inactive"),e("#btnStyleNext").removeClass("w-lightbox-inactive")):(e("#btnStyleNext").removeClass("w-lightbox-inactive"),e("#btnStylePrev").removeClass("w-lightbox-inactive")),1==e(".imgstyles",r).length&&(e("#btnStyleNext").addClass("w-lightbox-inactive"),e("#btnStylePrev").addClass("w-lightbox-inactive")),e("#btnStyleNext").attr("data-parentdivid",r),e("#btnStylePrev").attr("data-parentdivid",r)},_home.NextStyle=function(t){t.stopPropagation(),t.preventDefault();var i=e("#btnStyleNext").attr("data-parentdivid"),a=e(".imgstyles",i)[styleCounter+1];null!=a?(_featured.openGalleryPopup(a,"N"),styleCounter+=1,styleCounter==e(".imgstyles",i).length-1?(e("#btnStyleNext").addClass("w-lightbox-inactive"),e("#btnStylePrev").removeClass("w-lightbox-inactive")):(e("#btnStyleNext").removeClass("w-lightbox-inactive"),e("#btnStylePrev").removeClass("w-lightbox-inactive"))):(e("#btnStyleNext").addClass("w-lightbox-inactive"),e("#btnStylePrev").removeClass("w-lightbox-inactive")),1==e(".imgstyles",i).length&&(e("#btnStyleNext").addClass("w-lightbox-inactive"),e("#btnStylePrev").addClass("w-lightbox-inactive"))},_home.PrevStyle=function(t){t.stopPropagation(),t.preventDefault();var i=e("#btnStylePrev").attr("data-parentdivid"),a=e(".imgstyles",i)[parseInt(styleCounter)-1];null!=a?(_featured.openGalleryPopup(a,"P"),styleCounter-=1,0==styleCounter?(e("#btnStylePrev").addClass("w-lightbox-inactive"),e("#btnStyleNext").removeClass("w-lightbox-inactive")):(e("#btnStylePrev").removeClass("w-lightbox-inactive"),e("#btnStyleNext").removeClass("w-lightbox-inactive"))):(e("#btnStylePrev").addClass("w-lightbox-inactive"),e("#btnStyleNext").removeClass("w-lightbox-inactive")),1==e(".imgstyles",i).length&&(e("#btnStyleNext").addClass("w-lightbox-inactive"),e("#btnStylePrev").addClass("w-lightbox-inactive"))},"undefined"!=typeof vgAppicationType&&1==vgAppicationType||("undefined"==typeof UserName||""===UserName?_home.CommonLogin(!1,"",""):(e(".loginUserIntials").html(FindInitials(FullUserName,"SP")),_home.CommonLogin(!0,UserName,e("#hdnUserImage").val()))),e(".hfeed-no-realy").click(function(){e(".home-feedbk-responsce").show(),e(".home-feedbk-enj ").hide()}),e(".hfeed-ys").click(function(){e(".home-feedbk-app").show(),e(".home-feedbk-enj ").hide()}),e(".hfeed-thank , .hfeed-okay").click(function(){e(".home-feedbk-enj ").show(),e(".home-feedbk-responsce").hide()}),e(".hfeed-no-thank ,.hfeed-sur").click(function(){e(".home-feedbk-enj").show(),e(".home-feedbk-app").hide()}),e(".vg-default-tabs .vg-default-tabs-links .vg-default-tab-link a").on("click",function(t){var i=e(this).attr("data-href");e(".vg-default-tab-content "+i).addClass("active").siblings().removeClass("active"),e(".vg-default-tab-content "+i).fadeIn().siblings().hide(),e(this).parent(".vg-default-tab-link").addClass("active").siblings().removeClass("active"),t.preventDefault()}),_home.upcomingAppCache={},_home.bubbleCountCache={},_home.GetSetIndexedDBForUpComingAppmntDetails=function(e,t){try{if(_home.IsIndexedDBSupported()){var a,r=_home.GetIndexedDB(),o=(new Date,t.toString());if(null!=r){if(null!=e&&e.length>0)(n=r.open("UpAppDB",o)).onupgradeneeded=function(t){var a=t.target.result;a.onerror=function(e){console.log("IndexedDB error: "+t.target.error.code)};var r=a.createObjectStore(o,{keyPath:"speciesId",autoIncrement:!0});r.createIndex("text","text",{unique:!1});var n=e.length;for(i in e[0].lastSyncTime=moment(new Date).format("YYYY/MM/DD HH:mm"),e)n>0&&(n--,r.add(e[i]))},n.onsuccess=function(e){a=n.result},n.onerror=function(e){console.log("Error:"+e.target.errorCode)};else if(null==e){var n,s=!1;(n=r.open("UpAppDB",o)).onupgradeneeded=function(e){s=!0},n.onsuccess=function(e){if((a=e.target.result).objectStoreNames.contains(o)&&0==s){var t=a.transaction(o).objectStore(o),i=[];t.openCursor().onsuccess=function(e){var t=e.target.result;t?(i.push(t.value),t.continue()):_home.upcomingAppCache=i},n.onerror=function(e){alert("Unable to retrieve data from database!")}}else a.close(),r.deleteDatabase("UpAppDB")},n.onerror=function(e){console.log("Error:"+e.target.errorCode)}}}else console.log("could not connect index db.")}}catch(e){console.log("Error:"+e.target.message)}},_home.IsIndexedDBSupported=function(){return!!(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB)},_home.GetIndexedDB=function(){return window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB},_home.GetOutStandingReviewAndInvoiceCntApiCall=function(e){var t=new vagaro.ajax;t.datamodel.Token="websiteapi/myaccount/getoutstandingreviewandinvoicecount",t.datamodel.IsNewVagaroAPI=!0,t.datamodel.data=e,t.datamodel.data.groupId="",t.datamodel.callback=function(e){_home.RemoveMyAccountGroupId(),e.CustomCode==vagaro.VagaroCoreApiResponseCode.UnderMaintanance?vagaro.alert({message:UnderMaintananceMessage,title:"Info"}):e.CustomCode==vagaro.VagaroCoreApiResponseCode.Error?_home.SetDefaultCountForInvoiceAndReview():e.CustomCode==vagaro.VagaroCoreApiResponseCode.Success&&(e=e.Data,_home.afterGetOutStandingReviewAndInvoiceCntRowLoad(e))},t.datamodel.Error=function(e){_home.RemoveMyAccountGroupId(),_home.SetDefaultCountForInvoiceAndReview()},t.Post()},_home.GetOutStandingReviewAndInvoiceCntForMobileApp=function(e){var t=null!=UserID&&""!=UserID?parseInt(UserID):0;if(t>0&&void 0!==e&&null!=e&&""!=e){var i={};i.LoginUserID=t,baIsUndefine(IsBrandedApp)||1!=IsBrandedApp?(i.BusinessID=0,i.IsFromBrandedApp=!1):(i.BusinessID=parseInt(businessID),i.IsFromBrandedApp=!0),myAccountUserGroupID=e,_home.GetOutStandingReviewAndInvoiceCntApiCall(i)}},_home.IsMobileApp=function(){return"undefined"!=typeof vgAppicationType&&(vgAppicationType==objApplicationType.CustomerApp||vgAppicationType==objApplicationType.CheckinApp)},_home.GetOutStandingReviewAndInvoiceCntCallBack=function(e,t){"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CustomerApp&&2!=t?CallbackforMobileApp(0,0,"","",0,"4|~|11"):0==_home.IsMobileApp()&&null!=_home.bubbleCountCache&&_home.bubbleCountCache.length>0&&2!=t?(_home.afterGetOutStandingReviewAndInvoiceCntRowLoad(_home.bubbleCountCache[0]),_home.bubbleCountCache=null):(0==_home.IsMobileApp()&&_home.RemoveReviewInvoiceCountDBObject(),setTimeout(function(){var t={};if(""==strUserID?t.LoginUserID=e:t.strLoginUserId=strUserID,baIsUndefine(IsBrandedApp)||1!=IsBrandedApp?(t.strBusinessId="undefined"==typeof strVgBusienssId?0:strVgBusienssId,t.IsFromBrandedApp=!1):(t.strBusinessId=strBrandedBusinessID,t.IsFromBrandedApp=!0),"undefined"!=typeof publicUserGroupID&&"undefined"!=typeof BasePage&&"MyAccount"!=BasePage?myAccountUserGroupID=publicUserGroupID:"undefined"!=typeof _siteBuilderDetail&&void 0!==_siteBuilderDetail.ComponentResponse&&null!=_siteBuilderDetail.ComponentResponse&&void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo&&void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID?myAccountUserGroupID=_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID:void 0!==shopdetailuserGroupId&&null!=shopdetailuserGroupId&&""!=shopdetailuserGroupId&&(myAccountUserGroupID=shopdetailuserGroupId),"undefined"==typeof BasePage||"MyAccount"==BasePage||"undefined"!=typeof myAccountUserGroupID&&""!=myAccountUserGroupID||0!=IsUserGroupCheck)"undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID?_home.GetOutStandingReviewAndInvoiceCntApiCall(t):(_home.RemoveMyAccountGroupId(),_home.SetDefaultCountForInvoiceAndReview());else{var i={},a=new vagaro.ajax;"undefined"==strUserID||null==strUserID||""==strUserID?(i.LoginUserID=e,a.datamodel.Token=ApiURLEnumOnlineCommon.getloginusergroups):(i.strLoginUserID=strUserID,a.datamodel.Token=ApiURLEnumOnlineCommon.getloginusergroup),a.datamodel.IsNewVagaroAPI=!0,a.datamodel.data=i,a.datamodel.callback=function(e){IsUserGroupCheck=!0,myAccountUserGroupID=e,"undefined"!=typeof publicUserGroupID&&"undefined"!=typeof BasePage&&"MyAccount"!=BasePage?publicUserGroupID=e:"undefined"!=typeof _siteBuilderDetail&&void 0!==_siteBuilderDetail.ComponentResponse&&null!=_siteBuilderDetail.ComponentResponse&&void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo&&null==_siteBuilderDetail.ComponentResponse.lstUserInfo&&(shopdetailuserGroupId=e),"undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID?_home.GetOutStandingReviewAndInvoiceCntApiCall(t):(_home.SetDefaultCountForInvoiceAndReview(),_home.RemoveMyAccountGroupId())},a.datamodel.Error=function(e){},a.Post()}},500))},_home.RemoveMyAccountGroupId=function(){"undefined"!=typeof BasePage&&"MyAccount"!=BasePage&&"undefined"!=typeof myAccountUserGroupID&&(myAccountUserGroupID=void 0)},_home.GetOutStandingReviewAndInvoiceCnt=function(t){if("undefined"!=typeof isStopInvoiceReviewcnt&&0==isStopInvoiceReviewcnt||"undefined"!=typeof BasePage&&"MyAccount"==BasePage){1==t&&e("#hdnToken3").val(uencrypt(UserID));try{var i=null!=UserID&&""!=UserID?parseInt(UserID):0;1==_home.IsMobileApp()?_home.GetOutStandingReviewAndInvoiceCntCallBack(i,t):_home.GetSetIndexedDBForBubbleCount(null,i,function(){_home.GetOutStandingReviewAndInvoiceCntCallBack(i,t)})}catch(e){_home.SetDefaultCountForInvoiceAndReview()}}},_home.EmployeeExistsInGusto=function(){try{var t=e("#hdnStrUserIdV2").val();if("undefined"!=t&&null!=t&&""!=t){var i={LoginUserID:""},a=new vagaro.ajax;a.datamodel.userId=t,a.datamodel.Token=_home.GetCoreAPIURLV2WithToken(ApiURLEnumOnlineCommon.EmployeeExistsInGustoAPI,""),a.datamodel.IsNewVagaroAPI=!0,a.datamodel.data=i,a.datamodel.callback=function(t){null!=t&&null!=t&&null!=t.data&&0==t.data.isGustoEnable&&(e("#accpayrollhistory").attr("style","display:none"),"undefined"!=typeof BasePage&&"MyAccount"==BasePage&&e("#lipayrollhisotry").attr("style","display:none"))},a.datamodel.Error=function(e){},a.Post()}}catch(e){}},_home.GetCoreAPIURLV2WithToken=function(e,t){try{var i="",a=CoreAPIURLV2.split("/");if(void 0!==t&&null!=t&&""!=t)a[3]=t,i=a.join("/")+e;else if("undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID){var r=myAccountUserGroupID.split(",");r.length>0&&(a[3]=r[0],i=a.join("/")+e)}return""==i&&(i=CoreAPIURLV2+e),i}catch(t){return CoreAPIURLV2+e}},_home.GetSetIndexedDBForBubbleCount=function(e,t,i){try{if(_home.IsIndexedDBSupported()){var a,r=_home.GetIndexedDB(),o=t.toString();if(null!=r){if(null!=e)(n=r.open("BubbleCount",o)).onupgradeneeded=function(t){var i=t.target.result;i.onerror=function(e){console.log("IndexedDB error: "+t.target.error.code)};var a=i.createObjectStore(o,{keyPath:"speciesId",autoIncrement:!0});a.createIndex("text","text",{unique:!1}),a.add(e)},n.onsuccess=function(e){a=n.result},n.onerror=function(e){console.log("Error:"+e.target.errorCode)};else if(null==e){var n,s=!1;(n=r.open("BubbleCount",o)).onupgradeneeded=function(e){s=!0},n.onsuccess=function(e){if((a=e.target.result).objectStoreNames.contains(o)&&0==s){var t=a.transaction(o).objectStore(o),l=[];t.openCursor().onsuccess=function(e){var t=e.target.result;t?(l.push(t.value),t.continue()):(_home.bubbleCountCache=l,void 0!==i&&null!=i&&i())},n.onerror=function(e){alert("Unable to retrieve data from database!")}}else a.close(),r.deleteDatabase("BubbleCount"),void 0!==i&&null!=i&&i()},n.onerror=function(e){console.log("Error:"+e.target.errorCode),"VersionError"==e.target.error.name&&isExceptionCount<1&&(isExceptionCount=1,r.deleteDatabase("BubbleCount"),_home.GetSetIndexedDBForBubbleCount(null,t,function(){_home.GetOutStandingReviewAndInvoiceCntCallBack(t,i)}))}}}else console.log("could not connect index db.")}}catch(e){console.log("Error:"+e.target.message)}},_home.RemoveReviewInvoiceCountDBObject=function(){try{if(_home.IsIndexedDBSupported()){var e=_home.GetIndexedDB();null!=e?e.deleteDatabase("BubbleCount"):console.log("could not connect index db.")}}catch(e){console.log("Error:"+e)}},_home.afterGetOutStandingReviewAndInvoiceCntRowLoad=function(t){if(_home.SetDefaultCountForInvoiceAndReview(),null!=t&&null!=t.InvoiceCount&&null!=t.ReviewCount){if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CustomerApp)CallbackforMobileApp(0,0,"","","0","40|~|"+('{\\"InvoiceCount\\":\\"'+t.InvoiceCount+'\\",\\"ReviewCount\\":\\"'+t.ReviewCount+'\\",\\"VPLFailCount\\":\\"'+t.VplFailCount+'\\"}'));else 0==_home.IsMobileApp()&&_home.GetSetIndexedDBForBubbleCount(t,null!=UserID&&""!=UserID?parseInt(UserID):0,null);t.InvoiceCount>0&&e(".invcount").html(t.InvoiceCount).show(),t.ReviewCount>0&&e(".revcount").html(t.ReviewCount).show(),t.VplFailCount>0&&e(".fTraCount").html(t.VplFailCount).show()}},_home.SetDefaultCountForInvoiceAndReview=function(){e(".revcount").html(0).hide(),e(".invcount").html(0).hide(),e(".fTraCount").html(0).hide()},_home.ShowHomeSliderMoreBusinessTypePopup=function(){e("#divMoreHomeSliderBusinessTypes").modal("show"),e(".modal-backdrop").addClass("service-modal-zindex")},_home.HideHomeSliderMoreBusinessTypePopup=function(){e("#divMoreHomeSliderBusinessTypes").modal("hide"),e(".modal-backdrop").removeClass("service-modal-zindex"),e("html, body").removeClass("moboverflow-hide"),e(".modal-backdrop").removeAttr("style")},_home.ShowUKHomePageUKJoinVagaroSection=function(){null!=getCookie(ProximityCookieName)&&e("#divHomePageUKJoinVagaroSection").show()},_home.ShowUKHomePageUKCookiesSection=function(){var t=getCookie(ProximityCookieName);if(null!=t&&"2"==t.countryid){var i=getCookie("_vopt");null!=i&&null!=i&&"2"==t.countryid?e("#divHomePageUKCookiesSection").hide():e("#divHomePageUKCookiesSection").show()}else e("#divHomePageUKCookiesSection").hide(),_home.CookieAcceptClicked("_vopt","accepted",365)},_home.CookieDeclineClicked=function(t,i){cookieManager.setCookie(t,i,null,cookieManager.defaultPath,cookieManager.defaultDomain),e("#divHomePageUKCookiesSection").hide()},_home.CookieAcceptClicked=function(t,i,a){cookieManager.setCookie(t,i,a,cookieManager.defaultPath,cookieManager.defaultDomain),e("#divHomePageUKCookiesSection").hide()},_home.ShowHomePageBennerTipsFromBottom=function(t){e(".tips-mobile-section").hide();var i=e("#divHomePageBannerMobileBeauty");t==_home.HomePageBannerType.Beauty?i=e("#divHomePageBannerMobileBeauty"):t==_home.HomePageBannerType.Fitness?i=e("#divHomePageBannerMobileFitness"):t==_home.HomePageBannerType.Wellness&&(i=e("#divHomePageBannerMobileWellness")),i.show().animate({bottom:"0"},{duration:200,complete:function(){e(".tips-mobile-section-fade").show()}})}}(jQuery,window,document),_common.isCreateLinkPreserve=function(e,t){if(e){var i=!1,a=getCookie("UniqueCreateLink");return void 0!==a&&null!=a&&""!=a&&"true"==a.split("~")[0]&&(t&&getCookie("UniqueCreateLink").split("~")[1]!=_siteBuilderDetail.businessID?_common.isCreateclearCookie():i=!0),i}var r=getCookie("MultiProviderID");return void 0!==r&&null!=r&&""!=r?r.split(","):""},_common.isCreateclearCookie=function(){clearCookie("ServiceID"),clearCookie("MultiProviderID"),clearCookie("UniqueCreateLink"),clearCookie("EventType"),"undefined"!=typeof IsFromCreateLink&&1==IsFromCreateLink&&(IsFromCreateLink=!1,_shopdetail.providerID="")},_common.Openswalpopup=function(e){swal({title:"",text:e.swalTextMessage,showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:e.confirmButtonText,cancelButtonText:"OK",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,showConfirmButton:!1,customClass:"sweet-alert-model text-left hideconfirm"},function(e){return swal.close(),!1})},_common.IsInActiveOnlineBooking=function(e){var t=!1;if(e.length>0&&(_common.IsWidgetForServiceProvider(!0)||"undefined"!=typeof IsBookFromFacebookoAuth&&0!=IsBookFromFacebookoAuth&&"undefined"!=typeof isFacebookoAuth&&"true"==IsBookFromFacebookoAuth&&"true"==isFacebookoAuth&&"undefined"!=typeof isWidget&&"true"!=isWidget)){var i=1==_common.isCreateLinkPreserve(!0)&&"true"==IsBookFromFacebookoAuth?_common.isCreateLinkPreserve(!1):1==_common.IsWidgetForServiceProvider(!0)&&"true"==isWidget?String(_common.IsWidgetForServiceProvider(!1)).split(","):null;if(null!=i&&i.length>0&&"-1"!=i[0]){var a=[];$.grep(e,function(e){parseInt(i[0])==parseInt(e.id)&&a.push(e)}),a.length<=0&&(t=!0)}}return t},_common.WidgetTypeEnum={Popup:0,Embedded:1,NewWindow:2},_common.getQueryStringData=function(e){for(var t,i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("&"),a=0;a<i.length;a+=1){var r=(i[a]||"").split("=");if(r[0]===e)if(r.length>2)for(a=1;a<r.length;a++)t?t+="="+r[a]:t=r[a];else t=r[1]}return void 0!==t&&null!=t&&""!=t?decodeURIComponent(t):""},_common.IsCookieLessWidget=function(){try{var e=!1;if(null!=typeof _common.getQueryStringData)String.isNullOrUndefineOrBlank($("#hdnLoginQueryString").val())||(QueryStringValue=$("#hdnLoginQueryString").val()),String.isNullOrUndefineOrBlank(QueryStringValue)&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL),"Builder"==_common.getQueryStringData("Type")&&(e=!0);if((e||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()&&"undefined"!=typeof w_type&&null!=w_type&&(w_type==_common.WidgetTypeEnum.Embedded||w_type==_common.WidgetTypeEnum.Popup))&&"undefined"!=typeof IsCookieEnabled){var t=IsCookieEnabled();if(0==t||1==t)return!0}}catch(e){}return!1},_common.SetAddonForSeleect2=function(e,t){e.data("addon",JSON.stringify(t))},_common.GenerateRandomNo=function(e,t){for(var i="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=0;r<e;r++)i+=a.charAt(Math.floor(62*Math.random()));var o=new Date;return t+"_"+i+o.getDate()+o.getMonth()+o.getFullYear()+o.getHours()+o.getMinutes()+o.getSeconds()},_common.UpdateTimeZoneLocationCookie=function(e){try{if(pageLocation=getCookie(ProximityCookieName),"undefined"==typeof pageLocation||null==pageLocation||void 0!==pageLocation.timeZoneOffSet&&null!=pageLocation.timeZoneOffSet&&""!=pageLocation.timeZoneOffSet&&void 0!==pageLocation.isSupportDayLight&&null!=pageLocation.isSupportDayLight)e&&_shopdetail.RebindAfterLocationChange();else{var t=pageLocation.lat,i=pageLocation.long,a=new vagaro.ajax;a.datamodel.Token="GetCurrentLocation",a.datamodel.data=[t,i,25,!0],a.datamodel.callback=function(t){if(null!=t){var i=EmptyProximityValue();i.businesstypes=businesstypes,i.countryid=t.countryID,i.currencysymbol=t.currencySymbol,i.lat=t.latitude,i.long=t.longitude,i.zip=t.zipCode,i.city=t.city,i.state=t.stateCode,i.stateName=t.state,i.utcOffset=t.utcOffset,i.timeZoneOffSet=t.timeZoneOffSet,i.isSupportDayLight=t.IsSupportDayLight,setCookie(ProximityCookieName,i),String.isNullOrUndefineOrBlank(tabSegment)||"book-now"!=tabSegment||_shopdetail.setLocationCookieData(),e&&_shopdetail.RebindAfterLocationChange()}},a.datamodel.Error=function(e){},a.Post()}}catch(e){}},_common.GetLoginPlatformDetails=function(e,t){var i=getCookie(ProximityCookieName);cookieValue=getCookie("loginTypeValue"),isSignupvar=getCookie("isSignupValue"),isLoginvar=getCookie("isLoginValue"),appleLoginSourceVar=getCookie("appleLoginSource"),urlPath=window.location.href.substring(window.location.href.lastIndexOf("/")+1);var a={},r=e.split("|");4==r.length?(loggedInUserId=r[1],FullUserName=r[0],(null!=r[3]||null!=r[3])&&r[3].split("~").length>0&&(UserEmail=r[3].split("~")[0])):(loggedInUserId=r[3],FullUserName=r[0],UserEmail=r.length>5?r[5]:"");a.PageURL=window.location.href,a.UserAgent=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"",a.Licence=localStorage.getItem("NoOfLicences"),a.UserId=loggedInUserId,a.Email=UserEmail,a.UserName=FullUserName,void 0!==i&&null!=i&&(void 0!==i.city&&null!=i.city&&""!=i.city&&(a.City=i.city),void 0!==i.countryid&&null!=i.countryid&&""!=i.countryid&&(a.Country=i.countryid),void 0!==i.stateName&&null!=i.stateName&&""!=i.stateName&&(a.State=i.stateName)),a.Referrer_url=document.referrer,isSignupvar?isSignupvar&&(cookieValue==LoginTypes.google||cookieValue==LoginTypes.google_new?(a.Signup_method=platform.signUpGoogle,a.Step=76):cookieValue==LoginTypes.facebook?(a.Signup_method=platform.signUpFacebook,a.Step=76):cookieValue==LoginTypes.apple?(a.Signup_method=platform.signUpApple,a.Step=76):cookieValue==LoginTypes.login&&(a.Signup_method=platform.signUpStandard,a.Step=76),isSignupvar=!1):cookieValue==LoginTypes.google||cookieValue==LoginTypes.google_new?(a.Login_method=platform.loginGoogle,a.Step=75):cookieValue==LoginTypes.facebook?(a.Login_method=platform.loginFacebook,a.Step=75):cookieValue==LoginTypes.apple?(a.Login_method=platform.loginApple,a.Step=75):cookieValue==LoginTypes.login&&(a.Login_method=platform.loginStandard,a.Step=75);var o={};o.AddLogInAmplitude=a;var n=$("#hdnUserType").val();void 0!==n&&null!=n&&""!=n&&"1"==n&&(o.AddLogInAmplitude.UserId=0),AjaxOld("AddLogInAmplitudeV2",o,this.AddLogInAmplitudeSuccess,this.AddLogInAmplitudeSuccessFail)},AjaxOld=function(e,t,i,a){var r=new vagaro.ajax;r.datamodel.Token=e,r.datamodel.data=t,r.datamodel.callback=i,r.datamodel.Error=a,r.Post()},AddLogInAmplitudeSuccess=function(e){console.log("success")},AddLogInAmplitudeSuccessFail=function(e){console.log("error")};var lstCickElementArray=[];function GatherClickElement(e){try{lstCickElementArray.length>=2&&lstCickElementArray.shift(),$(e.target).length>0?lstCickElementArray.push($(e.target)):$(e).length>0&&lstCickElementArray.push($(e))}catch(e){lstCickElementArray=[]}}function SetControlAttribute(e){if(null!=lstCickElementArray&&lstCickElementArray.length>0)for(var t=1,i=lstCickElementArray.length-1;i>=0;i--){var a=(new Date).getTime().toString();$(e).attr("adaindex"+t.toString(),a),$(lstCickElementArray[i]).addClass(a),t+=1}}function SetFocusOnlastControl(e){for(var t=1;t<=2;t++){var i="adaindex"+t.toString();if(e.length>0&&void 0!==e.attr(i)){var a=$("."+e.attr(i));if(a.length>0&&1==a.is(":visible")){a.attr("tabindex",-1).focus().removeClass(e.attr(i));break}}}lstCickElementArray=[]}function SetAreaAttributeInSweetAlert(e){1==e?($(".gencutom-title").removeAttr("id").removeAttr("tabindex").removeAttr("role"),$(".gencustom-close").removeAttr("aria-hidden"),$(".sa-input-error").removeAttr("aria-hidden"),$(".sa-error-container").removeAttr("aria-hidden")):($(".gencutom-title").attr("tabindex",-1).attr("role","heading").focus(),$(".gencustom-close").attr("aria-hidden",!0),$(".sa-input-error").attr("aria-hidden",!0),$(".sa-error-container").attr("aria-hidden",!0))}function SweetAlertOpenCallback(arguments,e){setTimeout(function(){SetControlAttribute(e),SetAreaAttributeInSweetAlert(!1)},100)}function SweetAlertCloseCallback(e,t){setTimeout(function(){SetFocusOnlastControl($(t))},1),SetAreaAttributeInSweetAlert(!0)}function GetCalculateTaxValue(e){var t=0;return"[]"==e||$.each(e,function(e,i){t+=i.CalculatedTax}),t}function ReplaceSpecialCharacters(e){return escape(e.trim().replace(/(\r\n|\r|\n)/g,""))}function IgnoreScriptTag(e,t){""==t&&(t="<>"),document.all?k=e.keyCode:k=e.which;for(var i=0;i<t.length;i++)if(t.charCodeAt(i)==k)return e.returnValue=null,!1}function ISAndroidOrIOSDevicesAndBrowser(){return/iPhone|iPad|iPod|Android|Tablet/i.test(navigator.userAgent)}function setLogintkn(e){try{if(void 0===e||null==e||""==e)return;localStorage.setItem("s_utkn",e),_postConnectSessionToken(e),setFMBFeeEnable()}catch(e){console.error("storeLoginDetailsIndexDb: Error while storing menu details in IndexedDB",e)}}function _isAllowedConnectOrigin(e){try{var t=new URL(e).hostname;return"vagaro.com"===t||t.endsWith(".vagaro.com")||"bookitall.com"===t||t.endsWith(".bookitall.com")||"localdev.com"===t||t.endsWith(".localdev.com")}catch(e){return!1}}function _postConnectSessionToken(e){try{if(void 0===e||null==e||""==e)return;var t="";try{document.referrer&&(t=new URL(document.referrer).origin)}catch(e){}if(!t||!_isAllowedConnectOrigin(t))return;var i=JSON.stringify({eventType:"SetSessionToken",payload:{s_utkn:e}});window.opener&&window.opener.postMessage(i,t),window.parent&&window.parent!==window&&window.parent.postMessage(i,t)}catch(e){}}function setFMBFeeEnable(){try{if("undefined"==typeof FMBFeeEnable||!0===FMBFeeEnable)return;if("undefined"==typeof businessID||null==businessID||""==businessID||parseInt(businessID)<=0)return;CallWebServicehed("MySampleService.asmx/GetFMBFeeEnable",'"businessID" : '+parseInt(businessID),function(e){null!=e&&void 0!==e.d&&(FMBFeeEnable=!0===e.d)},function(){})}catch(e){console.error("setFMBFeeEnable: Error while resolving FMB fee flag",e)}}function deleteKeyValue(){try{localStorage.removeItem("s_utkn")}catch(e){console.error("Error deleting previous localStorage item:",e)}}function isNewVersionCustomerAppLogin(e="",t=""){var i=navigator.userAgent;if(i&&i.toLowerCase().includes("com.vagaro.customerios")&&i.toLowerCase().includes("(vagaroapp")&&!i.toLowerCase().includes("brandedapp")){if((a=i.split("(VagaroApp"))&&a.length>=2&&(r=a[1].split(")"))&&r.length>=1)return r[0].replace(/^\.+|\.+$/g,"").split(".").length<3&&(r[0]=r[0].replace(/^\.+|\.+$/g,"")+".0"),(parseInt(r[0].replace(/\./g,"").trim())||0)>(parseInt(t?t.replace(/[.~]/g,""):"357")||0)}else if(i&&i.toLowerCase().includes("com.vagaro.customerandroid")&&i.toLowerCase().includes("(vagaroapp")&&!i.toLowerCase().includes("brandedapp")){var a,r;if((a=i.split("(VagaroApp"))&&a.length>=2)if((r=a[1].split(")"))&&r.length>=1)return r[0].replace(/^\.+|\.+$/g,"").split(".").length<3&&(r[0]=r[0].replace(/^\.+|\.+$/g,"")+".0"),(parseInt(r[0].replace(/\./g,"").trim())||0)>(parseInt(e?e.replace(/[.~]/g,""):"468")||0)}return!1}function StringisNullOrUndefineOrBlank(e){return void 0===e||null==e||""==e||null==e}function getStateName(){var e="";try{if(pageLocation=getCookie(ProximityCookieName),"undefined"!=typeof pageLocation&&null!=pageLocation&&(void 0===pageLocation.timeZoneOffSet||null==pageLocation.timeZoneOffSet||""==pageLocation.timeZoneOffSet||void 0===pageLocation.isSupportDayLight||null==pageLocation.isSupportDayLight)){var t=pageLocation.lat,i=pageLocation.long,a=new vagaro.ajax;a.datamodel.Token="GetCurrentLocation",a.datamodel.data=[t,i,25,!0],a.datamodel.async=!1,a.datamodel.callback=function(t){null!=t&&(e=t.state)},a.datamodel.Error=function(e){},a.Post()}}catch(e){}return e}$(document).on("click",function(e){GatherClickElement(e)}),$(window).on("shown.bs.modal",function(e){var t=$(e.target).find(".modal-title"),i=$(e.target).find(".bootbox-body");t.length>0?"dvDeleteCardDetailsModal"==$(e.target).attr("id")?(setTimeout(function(){$("#dvDeleteCardDetailsModal").attr("tabindex",-1).focus()},1e3),SetControlAttribute($(e.target))):"AppcheckoutModal"==$(e.target).attr("id")?(setTimeout(function(){$("#AppcheckoutModal").find($("#mainTCPoliceHeader")).attr("tabindex",-1).focus()},1e3),SetControlAttribute($(e.target))):($(t).attr("tabindex",-1).focus(),SetControlAttribute($(e.target))):i.length>0?($(i).attr("role","heading").attr("tabindex",-1).focus(),SetControlAttribute($(e.target))):$(e.target).length>0&&("divShoppingcartpopup"==$(e.target).attr("id")?(setTimeout(function(){$(".clsproductname").attr("tabindex",-1).focus()},1e3),SetControlAttribute($(e.target))):"divWaitlistpopup"==$(e.target).attr("id")?(setTimeout(function(){$("#dvwaitlistPopupHeader").attr("tabindex",-1).focus()},500),SetControlAttribute($(e.target))):"divClassDetailpopup"==$(e.target).attr("id")&&(setTimeout(function(){$("#divEventNamePopup").attr("tabindex",-1).focus()},1e3),SetControlAttribute($(e.target)))),"AppcheckoutModal"==$(e.target).attr("id")&&void 0!==setPopupPosi&&void 0!==IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&($(this).addClass("wbbootbox"),setPopupPosi("#AppcheckoutModal"))}),$(window).on("hidden.bs.modal",function(e){SetFocusOnlastControl($(e.target))}),PreventScriptInjection=function(e){var t=e.clipboardData.getData("Text");if(1==/<(.|\n)*?>/g.test(t))return!1},$("#live-stream-classes-popup").on("hidden.bs.modal",function(){ZoomURL="javascript:void(0);",$("#live-stream-classes-popup .enroll-visits").attr("href",ZoomURL)}),$(document).ready(function(){setsTkn()});var countrylist=[{country:1,records:[{city:"New York",slug:"new-york--ny",rank:1},{city:"San Francisco",slug:"san-francisco--ca",rank:2},{city:"Chicago",slug:"chicago--il",rank:3},{city:"Atlanta",slug:"atlanta--ga",rank:4},{city:"Dallas",slug:"dallas--tx",rank:5},{city:"Los Angeles",slug:"los-angeles--ca",rank:6},{city:"Seattle",slug:"seattle--wa",rank:7},{city:"Boston",slug:"boston--ma",rank:8},{city:"Phoenix",slug:"phoenix--az",rank:9},{city:"Miami",slug:"miami--fl",rank:10},{city:"Indianapolis",slug:"indianapolis--in",rank:11},{city:"Minneapolis",slug:"minneapolis--mn",rank:12},{city:"Denver",slug:"denver--co",rank:13},{city:"Charlotte",slug:"charlotte--nc",rank:14},{city:"Houston",slug:"houston--tx",rank:15},{city:"Portland",slug:"portland--or",rank:16},{city:"Philadelphia",slug:"philadelphia--pa",rank:17},{city:"San Jose",slug:"san-jose--ca",rank:18},{city:"Columbus",slug:"columbus--oh",rank:19},{city:"Detroit",slug:"detroit--mi",rank:20}]},{country:2,records:[{city:"London",slug:"london--greater-london--gb",rank:1},{city:"Manchester",slug:"manchester--greater-manchester--gb",rank:2},{city:"Birmingham",slug:"birmingham--west-midlands--gb",rank:3},{city:"Glasgow",slug:"glasgow--glasgow-city--gb",rank:4},{city:"Bristol",slug:"redcliffe--city-of-bristol--gb",rank:5},{city:"Liverpool",slug:"liverpool--merseyside--gb",rank:6},{city:"Southampton",slug:"southampton--hampshire--gb",rank:7},{city:"Southwark",slug:"southwark--greater-london--gb",rank:8},{city:"Croydon",slug:"croydon--greater-london--gb",rank:9},{city:"Bournemouth",slug:"bournemouth--dorset--gb",rank:10},{city:"Cardiff",slug:"cardiff--cardiff--gb",rank:11},{city:"Reading",slug:"reading--berkshire--gb",rank:12},{city:"Hackney",slug:"hackney--derbyshire--gb",rank:13},{city:"Edinburgh",slug:"edinburgh--city-of-edinburgh--gb",rank:14},{city:"Falkirk",slug:"falkirk--falkirk--gb",rank:15},{city:"Oxford",slug:"oxford--oxfordshire--gb",rank:16},{city:"Wrexham",slug:"wrexham--wrexham-principal-area--gb",rank:17},{city:"Sheffield",slug:"sheffield--south-yorkshire--gb",rank:18},{city:"Leeds",slug:"leeds--west-yorkshire--gb",rank:19},{city:"Luton",slug:"luton--luton--gb",rank:20}]},{country:3,records:[{city:"Toronto",slug:"toronto--on--ca",rank:1},{city:"Calgary",slug:"calgary--ab--ca",rank:2},{city:"Vancouver",slug:"vancouver--bc--ca",rank:3},{city:"Edmonton",slug:"edmonton--ab--ca",rank:4},{city:"Winnipeg",slug:"winnipeg--mb--ca",rank:5},{city:"Montreal",slug:"montreal--qc--ca",rank:6},{city:"Lethbridge",slug:"lethbridge--ab--ca",rank:7},{city:"Halifax",slug:"halifax--ns--ca",rank:8},{city:"Regina",slug:"regina--sk--ca",rank:9},{city:"Saskatoon",slug:"saskatoon--sk--ca",rank:10},{city:"St. John's",slug:"st.-john's--nl--ca",rank:11},{city:"Victoria",slug:"victoria--bc--ca",rank:12},{city:"Ottawa",slug:"ottawa--on--ca",rank:13},{city:"Surrey",slug:"surrey--bc--ca",rank:14},{city:"Red Deer",slug:"red-deer--ab--ca",rank:15},{city:"Brampton",slug:"brampton--on--ca",rank:16},{city:"Burnaby",slug:"burnaby--bc--ca",rank:17},{city:"Kamloops",slug:"kamloops--bc--ca",rank:18},{city:"Kitchener",slug:"kitchener--on--ca",rank:19},{city:"Mississauga",slug:"mississauga--on--ca",rank:20}]},{country:4,records:[{city:"Sydney",slug:"sydney--nsw--au",rank:1},{city:"Melbourne",slug:"melbourne--vic--au",rank:2},{city:"Perth",slug:"perth--wa--au",rank:3},{city:"Brisbane",slug:"brisbane-city--qld--au",rank:4},{city:"Adelaide",slug:"adelaide--sa--au",rank:5},{city:"Gold Coast",slug:"gold-coast--qld--au",rank:6},{city:"Canberra",slug:"canberra--act--au",rank:7},{city:"Newcastle",slug:"newcastle--nsw--au",rank:8},{city:"Jordan Springs",slug:"jordan-springs--nsw--au",rank:9},{city:"Sydney Olympic Park",slug:"sydney-olympic-park--nsw--au",rank:10},{city:"Wollongong",slug:"wollongong--nsw--au",rank:11},{city:"Hobart",slug:"hobart--tas--au",rank:12},{city:"Sunshine Coast",slug:"sunshine-coast--qld--au",rank:13},{city:"Geelong",slug:"geelong--vic--au",rank:14},{city:"Central Coast",slug:"central-coast--nsw--au",rank:15},{city:"Lara",slug:"lara--vic--au",rank:16},{city:"Mandurah",slug:"mandurah--wa--au",rank:17},{city:"Quinns Rocks",slug:"quinns-rocks--wa--au",rank:18},{city:"Thirlmere",slug:"thirlmere--nsw--au",rank:19},{city:"Cranbourne East",slug:"cranbourne-east--vic--au",rank:20}]}],BTypelist=[{code:"microblading",displayName:"Microblading",route:"/listings/microblading",rank:9},{code:"sugaring",displayName:"Sugaring",route:"/listings/sugaring",rank:5},{code:"waxing",displayName:"Waxing",route:"/listings/waxing",rank:4},{code:"gym",displayName:"Gym",route:"/listings/gym",rank:13},{code:"nail",displayName:"Nail",route:"/listings/nail",rank:2},{code:"massage",displayName:"Massage",route:"/listings/massage",rank:11},{code:"threading",displayName:"Threading",route:"/listings/threading",rank:8,active:!0},{code:"hair",displayName:"Hair",route:"/listings/hair",rank:1},{code:"personal-trainer",displayName:"Personal Trainer",route:"/listings/personal-trainer",rank:16},{code:"barber",displayName:"Barber",route:"/listings/barber",rank:3},{code:"yoga",displayName:"Yoga",route:"/listings/yoga",rank:15},{code:"lash",displayName:"Lash",route:"/listings/lash-bar",rank:7},{code:"pilates",displayName:"Pilates",route:"/listings/pilates",rank:14},{code:"cryotherapy",displayName:"Cryotherapy",route:"/listings/cryotherapy",rank:12},{code:"tanning",displayName:"Tanning",route:"/listings/tanning",rank:6},{code:"spa",displayName:"Spa",route:"/listings/spa",rank:10}];function LoadCitiesAndServices(e){if("undefined"==typeof _common||"function"!=typeof _common.IsVagaroAppOrEmbeddedContext||!_common.IsVagaroAppOrEmbeddedContext()){var t=document.getElementById("hdnIsBotCrawler"),i=!(!t||"string"!=typeof t.value)&&"true"===t.value.toLowerCase();if(e||(e=1),!i||""!=tabSegment&&"home"!=tabSegment&&"/"!=tabSegment){if(""==tabSegment||"home"==tabSegment||"/"==tabSegment)try{r=[];(a=countrylist.find(t=>t.country==e))&&(r=(r=(r=a.records).sort((e,t)=>e.rank-t.rank)).slice(0,20)),renderCityAccordion(r,BTypelist.sort((e,t)=>e.rank-t.rank).slice(0,50))}catch(e){console.error("Unexpected error in LoadCitiesAndServices:",e)}}else try{var a,r=[];(a=countrylist.find(t=>t.country==e))&&(r=(r=(r=a.records).sort((e,t)=>e.rank-t.rank)).slice(0,20)),renderCityAccordion(r,BTypelist.sort((e,t)=>e.rank-t.rank).slice(0,50))}catch(e){console.error("Unexpected error in LoadCitiesAndServices:",e)}}}function renderCityAccordion(e,t=[]){const i=$("#webCityContainer"),a=$(".find-a-service-section");a.find("h3.web-display-large");if(!e||0===e.length)return void a.hide();a.show(),i.empty();let r="";e.forEach((i,a)=>{a%5==0&&(r+='<div class="find-service-block">');const o=t.map(e=>`<div>\n            <a href="${e.route}/${i.slug}" class="ghost-button">${e.displayName}</a></div>\n        `).join("");r+=`\n            <div class="service-item" data-country="${i.slug}">\n                <div class="service-sec-header">\n                    <span class="web-display-small">${i.city}</span>\n                    <span class="arrow"><i class="fa-solid fa-caret-down"></i></span>\n                </div>\n                <div class="service-sec-content" style="display: none;">\n                <div class="listingLinkServices">\n                \n                    ${o}\n                    </div>\n                    \n                </div>\n            </div>\n        `,a%5!=4&&a!==e.length-1||(r+="</div>")}),i.html(r),initializeAccordion()}function initializeAccordion(){document.querySelectorAll(".service-sec-header").forEach(e=>{e.replaceWith(e.cloneNode(!0))});const e=document.querySelectorAll(".service-sec-header");e.forEach(t=>{t.addEventListener("click",()=>{e.forEach(e=>{e!==t&&(e.classList.remove("active"),e.nextElementSibling.style.display="none")}),t.classList.toggle("active");t.nextElementSibling.style.display=t.classList.contains("active")?"block":"none"})})}function dummyreleaseonlinecommon(){}function getBusinessTypelist(e){var t=[],i={};i.businessId=e;var a=new vagaro.ajax;a.datamodel.Token="getBusinessTypeListByBusinessId",a.datamodel.data=i,a.datamodel.callback=function(e){t=e,vuiForms.frame.forms.responseBusinessTypes(t)},a.datamodel.Error=function(e){t=null},a.Post()}$(document).on("keyup","#dvBusinessLocationSearch .select2-input",function(){if(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)if($(this).val().length>0){var e=$("#dvBusinessLocationSearch .select2-input");e.length&&0===e.next("#dvBusinessLocationSearch .vg-search-cancel-icon").length&&e.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),$("#dvBusinessLocationSearch .vg-search-cancel-icon").show()}else $("#dvBusinessLocationSearch .vg-search-cancel-icon").hide()}),$(document).on("keyup","#dvSearchServiceMain .select2-input",function(){if(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)if($(this).val().length>0){var e=$("#dvSearchServiceMain .select2-input");e.length&&0===e.next("#dvSearchServiceMain .vg-search-cancel-icon").length&&e.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),$("#dvSearchServiceMain .vg-search-cancel-icon").show()}else $("#dvSearchServiceMain .vg-search-cancel-icon").hide()}),$(document).on("keyup","#mobilefilterChange .select2-input",function(){if(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)if($(this).val().length>0){var e=$("#mobilefilterChange .select2-input");e.length&&0===e.next("#mobilefilterChange .vg-search-cancel-icon").length&&e.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),$("#mobilefilterChange .vg-search-cancel-icon").show()}else $("#mobilefilterChange .vg-search-cancel-icon").hide()}),$(document).on("keyup","#mobileServiceChange .select2-input",function(){if(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)if($(this).val().length>0){var e=$("#mobileServiceChange .select2-input");e.length&&0===e.next("#mobileServiceChange .vg-search-cancel-icon").length&&e.after('<span class="vg-search-cancel-icon" style="display:none;"><svg id="svgCloseIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M0 8C0 3.59375 3.5625 0 8 0C12.4062 0 16 3.59375 16 8C16 12.4375 12.4062 16 8 16C3.5625 16 0 12.4375 0 8ZM5.46875 6.53125L6.9375 8L5.46875 9.46875C5.15625 9.78125 5.15625 10.25 5.46875 10.5312C5.75 10.8438 6.21875 10.8438 6.5 10.5312L7.96875 9.0625L9.46875 10.5312C9.75 10.8438 10.2188 10.8438 10.5 10.5312C10.8125 10.25 10.8125 9.78125 10.5 9.46875L9.03125 8L10.5 6.53125C10.8125 6.25 10.8125 5.78125 10.5 5.46875C10.2188 5.1875 9.75 5.1875 9.46875 5.46875L7.96875 6.96875L6.5 5.46875C6.21875 5.1875 5.75 5.1875 5.46875 5.46875C5.15625 5.78125 5.15625 6.25 5.46875 6.53125Z" fill="#A2A0A2"></path></svg></span>'),$("#mobileServiceChange .vg-search-cancel-icon").show()}else $("#mobileServiceChange .vg-search-cancel-icon").hide()}),$(document).on("mousedown touchstart click",".vg-search-cancel-icon",function(e){"touchstart"===e.type&&e.preventDefault(),e.stopPropagation();var t=$(this).closest("#dvBusinessLocationSearch"),i=$(this).closest("#dvSearchServiceMain"),a=$(this).closest("#mobilefilterChange"),r=$(this).closest("#mobileServiceChange"),o=t.find(".select2-input"),n=i.find(".select2-input"),s=a.find(".select2-input"),l=r.find(".select2-input"),d=$("#txtBusinessLocationSearch"),c=$("#txtSearchServiceMain"),u=$("#txtMobileCityState"),p=$("#txtMobileService");o.length&&(o.val(""),o.trigger("input").trigger("keyup")),n.length&&(n.val(""),n.trigger("input").trigger("keyup")),s.length&&(s.val(""),s.trigger("input").trigger("keyup")),l.length&&(l.val(""),l.trigger("input").trigger("keyup")),d.length&&(d.select2("val",""),d.data("selectedid",""),d.data("response","")),c.length&&(c.select2("val",""),c.data("selectedid",""),c.data("response","")),u.length&&(u.select2("val",""),u.data("selectedid",""),u.data("response","")),p.length&&(p.select2("val",""),p.data("selectedid",""),p.data("response","")),$(this).hide()}),_common.AppPromoScheme="VagaroApp:///",_common.AppPromoStoreUrlIOS="https://apps.apple.com/us/app/vagaro/id536110000",_common.AppPromoStoreUrlAndroid="https://play.google.com/store/apps/details?id=com.vagaro",_common.AppPromoCookieHasApp="vgHasApp",_common.AppPromoSessionKey="vgAppSheetShownSession",_common.AppPromoTabMarker="vgAppTab:",_common.AppPromoSheetShown=!1,_common.IsMobileDeviceForAppPromo=function(){return $("#mobile-check").length>0&&$("#mobile-check").is(":visible")},_common.IsIOSForAppPromo=function(){return/iPhone|iPod|iPad/i.test(navigator.userAgent)},_common.IsAndroidForAppPromo=function(){return"undefined"!=typeof isAndroid?!!isAndroid:/Android/i.test(navigator.userAgent)},_common.AppPromoSearchActive=!1,_common.IsHomeTabForAppPromo=function(){if(_common.AppPromoSearchActive)return!1;if(!_common.IsHomeUrlForAppPromo())return!1;var e=null!=tabSegment?tabSegment.toString():"";return"home"===e.toLowerCase()||"/"===e||""===e},_common.IsHomeUrlForAppPromo=function(){try{var e=(window.location.pathname||"/").toLowerCase();return"/"===e||""===e||(e.indexOf("/listings")>-1?"undefined"!=typeof BasePage&&null!==BasePage&&"home"===BasePage.toString().toLowerCase():e.indexOf("/deals")>-1||e.indexOf("/professionals")>-1||e.indexOf("/photos")>-1||e.indexOf("thankyou")>-1||e.indexOf("book-now")>-1||!(e.indexOf("/products")>-1)&&null!=_shopdetail)}catch(e){return!0}},_common.IsMobileSearchOverlayOpen=function(){return $("html, body").hasClass("mob-overflow-hidden")||$("body").hasClass("banner-hide-custapp")},_common.IsVagaroAppOrEmbeddedContext=function(){var e=void 0!==userAgent&&userAgent?userAgent:(navigator.userAgent||"").toLowerCase();if("undefined"!=typeof vgAppicationType&&1==vgAppicationType)return!0;if(e.indexOf("com.vagaro.customerios")>-1)return!0;if(e.indexOf("com.vagaro.customerandroid")>-1)return!0;if(e.indexOf("com.vagaro.customer")>-1)return!0;if(e.indexOf("swiftapp")>-1)return!0;if(e.indexOf("com.vagaro.androidcheckin")>-1||e.indexOf("com.vagaro.ioscheckin")>-1)return!0;if("undefined"!=typeof isiOSPRO&&isiOSPRO)return!0;if(e.indexOf("com.vagaro.iospro")>-1||e.indexOf("com.vagaro.androidpro")>-1)return!0;if(e.indexOf("(vagaroapp")>-1||e.indexOf("vagaroapp")>-1)return!0;if("undefined"!=typeof IsBrandedApp&&IsBrandedApp)return!0;if(e.indexOf("brandedapp")>-1)return!0;if("undefined"!=typeof WebsiteBuilderType&&WebsiteBuilderType)return!0;if(!0===window.IsMysite)return!0;try{if("Builder"===new URLSearchParams(window.location.search).get("Type"))return!0}catch(e){}if("undefined"!=typeof isWidget&&null!==isWidget&&"true"===isWidget.toString().toLowerCase())return!0;if(void 0!==_shopdetail&&_shopdetail){if("true"===_shopdetail.isWidget)return!0;if("true"===_shopdetail.isCustomWebsite)return!0;if("true"===_shopdetail.isFacebook)return!0}return!1},_common.GetAppPromoCookie=function(e){return"function"==typeof readCookie?readCookie(e):null},_common.SetAppPromoCookie=function(e,t,i){"function"==typeof setPublicCookie&&setPublicCookie(e,t,i)},_common.GetAppPromoSessionFlag=function(e){try{return window.sessionStorage?window.sessionStorage.getItem(e):null}catch(e){return null}},_common.SetAppPromoSessionFlag=function(e,t){try{window.sessionStorage&&window.sessionStorage.setItem(e,t)}catch(e){}},_common.ClearAppPromoSessionFlag=function(e){try{window.sessionStorage&&window.sessionStorage.removeItem(e)}catch(e){}},_common.IsSameBrowserTabAsBefore=function(){return"string"==typeof window.name&&0===window.name.indexOf(_common.AppPromoTabMarker)},_common.EnsureAppPromoTabIdentity=function(){_common.IsSameBrowserTabAsBefore()||(window.name=_common.AppPromoTabMarker+(new Date).getTime()+"-"+Math.floor(1e9*Math.random()),_common.ClearAppPromoSessionFlag(_common.AppPromoSessionKey),_common.AppPromoSheetShown=!1)},_common.MarkAppInstalled=function(){_common.SetAppPromoCookie(_common.AppPromoCookieHasApp,"1",365),_common.UpdateAppPromoLabels()},_common.UpdateAppPromoLabels=function(){var e="1"===_common.GetAppPromoCookie(_common.AppPromoCookieHasApp);$("#ancAppNavCta").text("Open App"),$("#btnGetTheApp").text(e?"Open App":"Get the app")},_common.MarkAppNotInstalled=function(){_common.SetAppPromoCookie(_common.AppPromoCookieHasApp,"0",365),_common.UpdateAppPromoLabels()},_common.DetectAndroidAppInstalled=function(){_common.IsAndroidForAppPromo()&&"getInstalledRelatedApps"in navigator&&navigator.getInstalledRelatedApps().then(function(e){try{1==(e&&e.length>0&&e.some(function(e){return"com.vagaro"===e.id}))?_common.MarkAppInstalled():_common.MarkAppNotInstalled()}catch(e){window.console&&console.error&&console.error("DetectAndroidAppInstalled: MarkAppInstalled failed",e)}}).catch(function(e){window.console&&console.warn&&console.warn("DetectAndroidAppInstalled: getInstalledRelatedApps rejected",e)})},_common.OpenOrGetVagaroApp=function(){if("function"==typeof openApp)openApp(_common.AppPromoScheme);else try{var e=document.createElement("iframe");e.style.display="none",e.src=_common.AppPromoScheme,document.body.appendChild(e)}catch(e){}_common.IsIOSForAppPromo()?window.location.href=_common.AppPromoStoreUrlIOS:window.location.href=_common.AppPromoStoreUrlAndroid},_common.ShowAppInterstitial=function(){0!==$("#divAppInterstitial").length&&(_common.AppPromoSheetShown||"1"===_common.GetAppPromoSessionFlag(_common.AppPromoSessionKey)||(_common.AppPromoSheetShown=!0,_common.UpdateAppPromoLabels(),$("#divAppInterstitial").addClass("vg-appsheet-shown").attr("aria-hidden","false"),$("body").addClass("vg-appsheet-open")))},_common.HideAppInterstitial=function(e){$("#divAppInterstitial").removeClass("vg-appsheet-shown").attr("aria-hidden","true"),$("body").removeClass("vg-appsheet-open"),e&&(_common.AppPromoSheetShown=!0,_common.SetAppPromoSessionFlag(_common.AppPromoSessionKey,"1"))},_common.HideAppPromoUI=function(){$("#divAppNavCta").removeClass("vg-appcta-visible")},_common.RepositionAppNavCtaIfOverlapping=function(){var e=$("#divAppNavCta");if(0!==e.length&&e.hasClass("vg-appcta-visible")){e.css("right",""),e.css("top","");var t=e[0];if(t&&"function"==typeof t.getBoundingClientRect){var i=$(".vgn-business-grow-bnr:visible");if(i.length>0){var a=i[0].getBoundingClientRect();a.height>0&&e.css("top",a.bottom+10+"px")}var r=t.getBoundingClientRect(),o=null;if($(".sort-dropdown-div:visible, .mobile-hamburger:visible, #mobilemenutoggle:visible, #mobileCart:visible").each(function(){var e=this.getBoundingClientRect();!(r.right<e.left||r.left>e.right||r.bottom<e.top||r.top>e.bottom)&&(null===o||e.left<o)&&(o=e.left)}),null!==o){var n=window.innerWidth-o+16;e.css("right",n+"px")}var s=$(".sort-dropdown-div:visible").first();if(s.length>0){s.css("margin-right","");var l=s[0].getBoundingClientRect(),d=window.innerWidth-l.right;if(d<10){var c=parseFloat(s.css("margin-right"))||0;s.css("margin-right",c+(10-d)+"px")}}}}},_common.RefreshAppPromo=function(){var e=_common.IsMobileDeviceForAppPromo()&&!_common.IsVagaroAppOrEmbeddedContext()&&_common.IsHomeUrlForAppPromo(),t=e&&!_common.IsMobileSearchOverlayOpen();t&&$(".inventory-product-header").is(":visible")&&(t=!1),$("#divAppNavCta").toggleClass("vg-appcta-visible",t),t&&($("#divAppNavCta").css({float:"none",position:"fixed"}),_common.UpdateAppPromoLabels(),_common.RepositionAppNavCtaIfOverlapping()),e?_common.ShowAppInterstitial():_common.HideAppInterstitial()},_common.InitAppPromo=function(){if(window.console&&window.console.log&&console.log("[InitAppPromo] #divAppNavCta found =",$("#divAppNavCta").length,"| IsMobileDeviceForAppPromo =",_common.IsMobileDeviceForAppPromo(),"| IsVagaroAppOrEmbeddedContext =",_common.IsVagaroAppOrEmbeddedContext()),0!==$("#divAppNavCta").length&&(document.addEventListener("click",function(e){var t=$(e.target);t.closest("#ancAppNavCta").length>0?(e.preventDefault(),RedirectToIPhoneAndroidAppNew()):t.closest("#btnGetTheApp").length>0?(e.preventDefault(),_common.HideAppInterstitial(!0),RedirectToIPhoneAndroidAppNew()):t.closest("#btnStayOnBrowser, #btnCloseAppInterstitial").length>0&&(e.preventDefault(),_common.HideAppInterstitial(!0))},!0),_common.IsMobileDeviceForAppPromo()&&!_common.IsVagaroAppOrEmbeddedContext())){_common.EnsureAppPromoTabIdentity(),window.location.search.indexOf("resetAppPromo=1")>-1&&(_common.ClearAppPromoSessionFlag(_common.AppPromoSessionKey),_common.AppPromoSheetShown=!1),_common.DetectAndroidAppInstalled(),_common.RefreshAppPromo(),$(window).on("hashchange popstate",_common.RefreshAppPromo),setInterval(_common.RefreshAppPromo,1e3),$(window).on("pageshow",function(e){var t=e.originalEvent||e;t&&t.persisted&&_common.RefreshAppPromo()});var e=null;$(window).on("resize orientationchange",function(){clearTimeout(e),e=setTimeout(function(){_common.RepositionAppNavCtaIfOverlapping()},150)})}},_common.IsBusinessOnboardingFlow=function(){try{var e="function"==typeof getQueryStringData?getQueryStringData("Type"):null;return"OnBoarding"===e||"ImportOnBoarding"===e}catch(e){return!1}},_common.RefreshAppDownloadBanner=function(){var e=_common.IsMobileDeviceForAppPromo()&&!_common.IsVagaroAppOrEmbeddedContext()&&!_common.IsBusinessOnboardingFlow();if($("#divAppDownloadBanner").toggleClass("vg-appbanner-visible",e),e){var t="1"===_common.GetAppPromoCookie(_common.AppPromoCookieHasApp);$("#ancAppDownloadBanner").text(t?"Open the app":"Download the app")}},_common.RefreshAppDownloadBannerDesktop=function(){var e=!_common.IsMobileDeviceForAppPromo()&&!_common.IsVagaroAppOrEmbeddedContext()&&!_common.IsBusinessOnboardingFlow();$("#divAppDownloadBannerDesktop").toggleClass("vg-appbanner-visible",e)},_common.InitAppDownloadBanner=function(){$("#divAppDownloadBannerDesktop").length>0&&_common.RefreshAppDownloadBannerDesktop(),0!==$("#divAppDownloadBanner").length&&(!_common.IsMobileDeviceForAppPromo()||_common.IsVagaroAppOrEmbeddedContext()||_common.IsBusinessOnboardingFlow()||(_common.DetectAndroidAppInstalled(),_common.RefreshAppDownloadBanner(),$("#ancAppDownloadBanner").on("click",function(e){e.preventDefault(),_common.OpenOrGetVagaroApp()}),$(window).on("pageshow",function(e){var t=e.originalEvent||e;t&&t.persisted&&_common.RefreshAppDownloadBanner()})))},_common.InitAppPromoAndBanner=function(e){e&&!_common.IsHomeUrlForAppPromo()||(_common.InitAppPromo(),_common.InitAppDownloadBanner())},$(document).ready(function(){_common.InitAppPromoAndBanner(!0)}),function(e){"use strict";e.fn.VagaroForms=function(t,i){e.isFunction(t)&&(t=null);var a,r=e.extend({},e.fn.VagaroForms.defaults,t),o=this;function n(t){if("https://portal.forms.com"==t.origin||-1!=t.origin.indexOf("localhost")||-1!=t.origin.indexOf("10.10")||-1!=t.origin.indexOf("vagaro")||-1!==t.origin.indexOf("bookitall.com")||-1!==t.origin.indexOf("localdev.com")){var i=t.data||t.originalEvent.data;if(i.indexOf("callToVagaroForHEICCallBack")>-1)return void _callBackToCheckInApp(i);var a=JSON.parse(t.data||t.originalEvent.data);switch(a.eventType){case"ECHO":r.loaded=!0;break;case"callSubmitButton":case"callSubmitButton":vuiForms.frame.forms.submitForm();break;case"getSize":l(r.receivers.onGetSize,a);break;case"loadTutorial":l(r.receivers.onloadTutorial,a);break;case"setParentDivHeight":onsetParentDivHeightCallback();break;case"setToScrollPosition":onsetToScrollPositionCallback(a);break;case"closeFrame":l(r.receivers.onClose,a),l(r.receivers.onHideLoading,a),vuiForms.frame.destroy();break;case"reloadIframeParentPage":l(r.receivers.onReloadIframeParentPage,a);break;case"hideLoading":l(r.receivers.onHideLoading,a);break;case"SavebuttonName":l(r.receivers.SavebuttonName,a);break;case"displayLoading":l(r.receivers.onDisplayLoading,a);break;case"resetReponseFrame":l(r.receivers.onResetReponseFrame,a);break;case"error":l(r.receivers.onFormsDown,a);break;case"sendMessage":case"iframe_Loaded":case"parent_screen":l(r.receivers.onMessage,a);break;case"setHeight":e(vuiForms.frame).find("iframe").css("height",a.height+"px"),e(".settingmainwhitebg").css("min-height",parseInt(a.height+10)+"px");break;case"setContentHeight":e(vuiForms.frame).find("iframe").css("height",a.height+"px"),e(vuiForms.frame).find("iframe").parent().css("height",a.height+"px");var o=null!=userAgent.match(/Android/i)&&null!=userAgent.match(/Mobile/i)&&null==userAgent.match(/Windows/i);if(/(iPhone)/i.test(navigator.userAgent)&&!window.MSStream||o)if(null!=typeof getQueryStringData)"Builder"===getQueryStringData("Type")&&(a.height<1500?(a.height=1500,e(vuiForms.frame).find("iframe").css("height",a.height+560+"px"),e(vuiForms.frame).find("iframe").parent().css("height",a.height+560+"px")):(e(vuiForms.frame).find("iframe").css("height",a.height+"px"),e(vuiForms.frame).find("iframe").parent().css("height",a.height+"px")));break;case"setCheckinContentHeight":e(vuiForms.frame).find("iframe").css("height",a.height+160+"px"),e(vuiForms.frame).find("iframe").parent().css("height",a.height+160+"px");break;case"showHideSaveCancel":l(r.receivers.onShowHideSaveCancel,a);break;case"scrollToTop":l(r.receivers.onscrollToTop,a);break;case"submitFormResponse":l(r.receivers.onsubmitFormResponse,a);break;case"GetFormRespIframeData":l(r.receivers.onGetFormRespIframeData,a);break;case"getServicesandClass":l(r.receivers.ongetServicesandClass,a);break;case"getMemberships":l(r.receivers.ongetMemberships,a);break;case"getLoginUserDetails":l(r.receivers.ongetLoginUserDetails,a);break;case"getBusinessTypelist":l(r.receivers.ongetBusinessTypelistList,a);break;case"getAccessRights":l(r.receivers.ongetAccessRights,a);break;case"showMessage":l(r.receivers.onShowMessage,a);break;case"GetStateDetailByName":l(r.receivers.onGetStateDetailByName,a);break;case"GetCityByZipCode":l(r.receivers.onGetCityByZipCode,a);break;case"DateRangePickerSetUp":l(r.receivers.onDateRangePickerSetUp,a);break;case"editFormOrSaopResponse":l(r.receivers.onEditFormResponse,a.message);break;case"newEditFormOrSaopResponse":l(r.receivers.onNewEditFormResponse,a.message);break;case"ResetCheckInAppTimer":l(r.receivers.onResetCheckInAppTimer,a.message);break;case"SendFormSaveSuccess":l(r.receivers.onSendFormSaveSuccess,a);break;case"loadVagaroDrive":l(r.receivers.onloadVagaroDrive,a);break;case"loadReactiveVagaroDrivePopup":l(r.receivers.onloadReactiveVagaroDrivePopup,a);break;case"setToFormScrollPosition":l(r.receivers.setToFormScrollPosition,a);break;case"loadVagaroDriveRequired":l(r.receivers.onloadVagaroDriveRequired,a);break;case"callToVagaroForHEICCallBack":l(r.receivers.callToVagaroForHEICCallBack,a);break;case"callOpenManageMerchantAccountDialog":l(r.receivers.onOpenManageMerchantAccountDialog,a);break;case"getCCDetailsFromVagaro":l(r.receivers.ongetCCDetailsFromVagaro,a);break;case"loadMarkerPhotoEditor":l(r.receivers.onloadMarkerPhotoEditor,a.postData);break;case"callEmployeeSignPopup":l(r.receivers.callEmployeeSignPopup,a.postData);break;case"HideLastModifydate":a.postData?null!=document.getElementById("lastmodifiedForm")&&(document.getElementById("lastmodifiedForm").style.display="none"):document.getElementById("lastmodifiedForm").style.display="block",Call_Last_Modified_date(0);break;case"setDatePickerDiv":l(r.receivers.onsetDatePickerDiv,a);break;case"setDatePickerScrollFromVagaro":l(r.receivers.onSetDatePickerScrollFromVagaro,a.postData);break;case"sendFormTitleToVagaro":l(r.receivers.onsetFormTitle,a.message)}}}return o.post=r.post,o.destroy=function(){window.removeEventListener("message",n,!1),null!=o&&(o.each(function(){e.data(this,""),e(this).attr("style","").removeData().hide().html("")}),o=null)},o.forms={getSize:function(){s('{"eventType": "getSize"}')},addStyle:function(e){s('{"eventType": "addStyle", "style" : "'+e+'"}')},submitForm:function(){var e={formRespId:"undefined"!=typeof _custForm&&null!=_custForm?_custForm.CurrentFormResponseId:"",isEdit:"undefined"!=typeof isFormSoapEdit&&isFormSoapEdit};"undefined"!=typeof isFormSoapEdit&&(isFormSoapEdit=!1),s('{"eventType": "submitForm", "message": '+JSON.stringify(e)+"}")},NextSign:function(){s('{"eventType": "NextSign"}')},submitFormRespIframeData:function(e){"object"==typeof e&&(e=JSON.stringify(e)),s('{"eventType": "GetFormRespIframeDataSuccess", "message": '+e+"}")},submitAllForm:function(e){s('{"eventType": "submitAllForm","formsRes":'+JSON.stringify(e)+"}")},responseServiceAndClass:function(e){s('{"eventType": "responseServiceAndClass", "data": '+JSON.stringify(e)+"}")},responseMembership:function(e){s('{"eventType": "responseMembership", "data": '+JSON.stringify(e)+"}")},responseBusinessTypes:function(e){s('{"eventType": "responseBusinessTypes", "data": '+JSON.stringify(e)+"}")},hideHeaderandFooter:function(){s('{"eventType": "hideHeaderandFooter"}')},addClassInFormsBody:function(e){s('{"eventType": "addClassInFormsBody" , "data": '+JSON.stringify(e)+"}")},addClassInFormsHtml:function(e){s('{"eventType": "addClassInFormsHtml" , "data": '+JSON.stringify(e)+"}")},showHeaderandFooter:function(e){s('{"eventType": "showHeaderandFooter", "message": '+e+"}")},sendLoginUseDetails:function(e){s('{"eventType": "sendLoginUseDetails", "data": '+JSON.stringify(e)+"}")},checkWebView:function(e){s('{"eventType": "checkWebView","iswebview" : "'+e+'"}')},ignorePro:function(e){s('{"eventType": "ignorePro","ignorePro" : "'+e+'"}')},getHeight:function(){s('{"eventType": "getHeight"}')},getContentHeight:function(){null!=typeof getQueryStringData?s("Builder"===getQueryStringData("Type")?'{"eventType": "getWBContentHeight"}':'{"eventType": "getContentHeight"}'):s('{"eventType": "getContentHeight"}')},HideSignatureData:function(){s('{"eventType": "HideSignatureData"}')},getCheckinContentHeight:function(){s('{"eventType": "getCheckinContentHeight"}')},setScreen:function(e,t,i,a,r){s(JSON.stringify({eventType:"setScreen",objScreen:""+e,topoffset:""+t,headeroffset:""+i,divgotit:""+a,divouterheight:""+r}))},hideSubmitButton:function(){s('{"eventType": "hideSubmitButton"}')},showSubmitButton:function(){s('{"eventType": "showSubmitButton"}')},hidePopup:function(){s('{"eventType": "hidePopup"}')},sendAccessRights:function(e){s('{"eventType": "sendAccessRights","accessrights" : "'+e+'"}')},sendStateDetail:function(e){s('{"eventType": "sendStateDetail","message" : "'+e+'"}')},sendCityByZipCode:function(e){s('{"eventType": "sendCityByZipCode","message" : "'+e+'"}')},getFormResponseDetailById:function(e){s('{"eventType": "getFormOrSoapResponseDetailById","message" : "'+e+'"}')},getFormValidationContentHeight:function(){s('{"eventType": "getFormValidationContentHeight"}')},getFormValidationScrollTop:function(){s('{"eventType": "getFormValidationScrollTop"}')},IsOnline:function(e){s('{"eventType": "IsOnline", "IsOnline" : "'+e+'"}')},heicSucessResponseFromVagaro:function(e){s(JSON.stringify(e))},sendCCDetailsToForms:function(e){e.eventType="sendCCDetailsToForms",s(JSON.stringify(e))},setPreviewFlag:function(e){s('{"eventType": "setPreviewFlag"}')},GetRentContractHeight:function(){s('{"eventType": "GetRentContractHeight"}')},callMarkerSaveFunction:function(e){s('{"eventType": "callMarkerEditorSave", "responseData": '+JSON.stringify(e)+"}")},callEmployeeSignValidate:function(e){s('{"eventType": "callEmployeeSignValidate", "responseData": '+JSON.stringify(e)+"}")},FillAllCustomerData:function(e){s('{"eventType": "FillAllCustomerData","responseData": '+JSON.stringify(e)+"}")},setDarkModePreference:function(e){s('{"eventType": "setDarkModePreference" , "data": '+JSON.stringify(e)+"}")},FormTitle:function(){s('{"eventType": "formTitle"}')}},window.addEventListener("message",n,!1),o.each(function(){e.data(this,"plugin")||function(t){var i=e('<iframe class="b-iframe" '+r.iframeAttr+' id="iFrame_'+o.attr("id")+'" style="display:none;"></iframe>');if(1==t){var a=e("<div id='frame_apgProgress_"+o[0].id+"' style='display:none;'></div><div style='position: relative; ' id='divinnertop_up'><div id='ccfram_backgroundElement' style='position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;' class='ModalPopupBG'></div><div style='color: white; font-family: \"Lucida Grande\",\"Arial\"; font-size: 11px; position: absolute; text-align: center;width: 100%; z-index: 2001; top: 6px; position:relative;'></div><div style='width: auto; height: auto; margin: 0 -7px;z-index:9999; position:relative' class='contentContainer'></div></div>");a.find(".contentContainer").append(i),a.appendTo(o)}else i.appendTo(o);o.data("iframe_id",i.attr("id")),i.height(r.height).width(r.width),i.attr("src",r.loadUrl),console.log(i.attr("id")),l(r.receivers.onOpening),i.load(function(i){if(1==r.isOnline){var a=vuiForms._getOnlineStyle();if(vuiForms.frame.forms.addStyle(a),null!=typeof getQueryStringData){var n=getQueryStringData("Type");"OnBoarding"!=n&&"ImportOnBoarding"!=n&&vuiForms.frame.forms.IsOnline("1")}else vuiForms.frame.forms.IsOnline("1")}1==r.isfullwidth&&e(this).addClass("framefullwidth"),vuiForms.frame.forms.checkWebView(r.iswebview?"true":"false"),vuiForms.frame.forms.ignorePro(r.ignorePro?"true":"false"),window.setTimeout(function(t){var i,a,n,s,d,c,u,p;r.loaded=!0,l(r.receivers.onOpened),o.find("iframe").css("display","block"),1==t?(i=r.height,a=r.width,n=o.attr("id"),p=document.getElementById(n),s=function(e,t){var i,a,r,o;return i=function(){var e,t;return void 0!==window.innerWidth?(e=window.innerWidth,t=window.innerHeight):void 0!==document.documentElement&&void 0!==document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?(e=document.documentElement.clientWidth,t=document.documentElement.clientHeight):(e=document.getElementsByTagName("body")[0].clientWidth,t=document.getElementsByTagName("body")[0].clientHeight),t+"|"+e}().split("|"),a=i[0],r=i[1],(o=(a-e)/2)<0&&(o=1),o+"|"+(r-t)/2+"|"+a}(i,a).split("|"),d=s[0],c=s[1],s[2],p.style.left=c-20+"px",(u=document.documentElement.scrollTop!=document.body.scrollTop?document.documentElement.scrollTop+document.body.scrollTop:document.body.scrollTop)>0&&(d=parseInt(d)+u),d-=20,p.style.top=d+"px",p.style.position="absolute",p.width="auto",p.height="auto",p.style.zIndex=100001,p.style.display=""):e("#"+vuiForms.contentContainer).show(),null!=vuiForms.loader&&vuiForms.loader(!1)}(t),1e3)})}(r.modal),console.log("frame.each")});function s(t){try{null==document.getElementById(o.data("iframe_id"))&&null==document.getElementById(o.data("iframe_id"))||document.getElementById(o.data("iframe_id")).contentWindow.postMessage(t,function(){if(null==a||1==function(){try{if(void 0!==a&&null!=a&&a.indexOf("forms.vagaro.com")>0){var t=/^(https*:\/\/[^\/]*).*$/g.exec(e("#"+o.data("iframe_id")).attr("src"));if(t)if(t[1]!=a)return!0}return!1}catch(e){return!1}}()){var t=/^(https*:\/\/[^\/]*).*$/g.exec(e("#"+o.data("iframe_id")).attr("src"));t&&(a=t[1])}return a}())}catch(e){console.log(e)}}function l(t,i){e.isFunction(t)&&t.call(this,i)}},e.fn.VagaroForms.defaults={height:375,width:480,loaded:!1,appendTo:"body",iframeAttr:'scrolling="yes" frameborder="0"',loadUrl:"",modal:!0,modalClose:!0,opacity:1,position:["auto","auto"],positionStyle:"absolute",scrollBar:!0,speed:250,transition:"fadeIn",transitionClose:!1,zIndex:1000001,showLog:!0,afterCallBackHandle:0,iswebview:!1,ignorePro:!1,isfullwidth:!1,receivers:{onOpening:function(e){"function"==typeof onFormOpeningCallback&&onFormOpeningCallback(e)},onClose:function(e){"function"==typeof onFormCloseCallback&&onFormCloseCallback(e)},onOpened:function(e){"function"==typeof onFormOpenedCallback&&onFormOpenedCallback(e)},onError:function(e){"function"==typeof onErrorCallback&&onErrorCallback(e)},onReloadIframeParentPage:function(e){"function"==typeof onReloadIframeParentPageCallback&&onReloadIframeParentPageCallback(e)},onHideLoading:function(e){"function"==typeof onHideLoadingCallbackForms&&onHideLoadingCallbackForms(e)},SavebuttonName:function(e){"function"==typeof SavebuttonNameCallbackForms&&SavebuttonNameCallbackForms(e)},onDisplayLoading:function(e){"function"==typeof onDisplayLoadingCallbackForms&&onDisplayLoadingCallbackForms(e)},onResetReponseFrame:function(e){"function"==typeof onResetReponseFrameCallback&&onResetReponseFrameCallback(e)},onGetSize:function(e){"function"==typeof onGetSizeCallback&&onGetSizeCallback(e)},onloadTutorial:function(e){"function"==typeof onloadTutorialCallback&&onloadTutorialCallback(e)},onMessage:function(e){"function"==typeof onMessageCallback&&onMessageCallback(e)},onFormsDown:function(e){"function"==typeof onFormsDownCallback&&onFormsDownCallback(e)},onShowHideSaveCancel:function(e){"function"==typeof onShowHideSaveCancelCallback&&onShowHideSaveCancelCallback(e)},onscrollToTop:function(e){"function"==typeof onscrollToTopCallback&&onscrollToTopCallback(e)},onGetFormRespIframeData:function(e){"function"==typeof onGetFormRespIframeDataCallback&&onGetFormRespIframeDataCallback(e)},onsubmitFormResponse:function(e){"function"==typeof onsubmitFormResponseCallback&&onsubmitFormResponseCallback(e)},ongetServicesandClass:function(e){"function"==typeof ongetServicesandClassCallback&&ongetServicesandClassCallback(e)},ongetMemberships:function(e){"function"==typeof ongetMembershipsCallback&&ongetMembershipsCallback(e)},ongetLoginUserDetails:function(e){"function"==typeof ongetLoginUserDetailsCallback&&ongetLoginUserDetailsCallback(e)},ongetBusinessTypelistList:function(e){"function"==typeof ongetBusinessTypelistCallback&&ongetBusinessTypelistCallback(e)},onShowMessage:function(e){"function"==typeof onShowMessageCallback&&onShowMessageCallback(e)},onGetStateDetailByName:function(e){"function"==typeof onGetStateDetailByNameCallback&&onGetStateDetailByNameCallback(e)},onGetCityByZipCode:function(e){"function"==typeof onGetCityByZipCodeCallback&&onGetCityByZipCodeCallback(e)},onDateRangePickerSetUp:function(e){"function"==typeof onDateRangePickerSetUpCallback&&onDateRangePickerSetUpCallback(e)},ongetAccessRights:function(e){"function"==typeof ongetAccessRightsCallback&&ongetAccessRightsCallback(e)},onEditFormResponse:function(e){"function"==typeof onEditFormResponseCallback&&onEditFormResponseCallback(e)},onNewEditFormResponse:function(e){"function"==typeof onNewEditFormResponseCallback&&onNewEditFormResponseCallback(e)},onResetCheckInAppTimer:function(e){"function"==typeof onFocusInCallback&&onFocusInCallback(e)},onSendFormSaveSuccess:function(e){"function"==typeof onSendFormSaveSuccessCallback&&onSendFormSaveSuccessCallback(e)},onloadVagaroDrive:function(e){"function"==typeof onloadVagaroDriveCallback&&onloadVagaroDriveCallback(e)},onloadReactiveVagaroDrivePopup:function(e){"function"==typeof onloadReactiveVagaroDrivePopupCallback&&onloadReactiveVagaroDrivePopupCallback(e)},onloadVagaroDriveRequired:function(e){"function"==typeof onloadVagaroDriveRequiredCallback&&onloadVagaroDriveRequiredCallback(e)},setToFormScrollPosition:function(e){"function"==typeof onsetToFormScrollPositionCallBack&&onsetToFormScrollPositionCallBack(e)},callToVagaroForHEICCallBack:function(e){"function"==typeof _callBackToCheckInApp&&_callBackToCheckInApp(e)},onOpenManageMerchantAccountDialog:function(e){"function"==typeof onOpenManageMerchantAccountDialogCallBack&&onOpenManageMerchantAccountDialogCallBack(e)},ongetCCDetailsFromVagaro:function(e){"function"==typeof ongetCCDetailsFromVagaroCallBack&&ongetCCDetailsFromVagaroCallBack(e)},onloadMarkerPhotoEditor:function(e){"function"==typeof onloadMarkerPhotoEditorCallback&&onloadMarkerPhotoEditorCallback(e)},callEmployeeSignPopup:function(e){"function"==typeof callEmployeeSignPopupCallback&&callEmployeeSignPopupCallback(e)},onsetDatePickerDiv:function(e){"function"==typeof onsetDatePickerDivCallback&&onsetDatePickerDivCallback(e)},onSetDatePickerScrollFromVagaro:function(e){"function"==typeof onSetDatePickerScrollFromVagaroCallBack&&onSetDatePickerScrollFromVagaroCallBack(e)},onsetFormTitle:function(e){"function"==typeof onsetFormTitleCallback&&onsetFormTitleCallback(e)}}}}(jQuery),window.vuiForms={frameUrl:null,frame:null,contentContainer:null,modal:!1,height:375,width:480,loader:function(e){e?$("#apgProgress").length>0?$("#apgProgress").show():$("#apgLoading").length>0&&$("#apgLoading").show():$("#apgProgress").length>0?$("#apgProgress").hide():$("#apgLoading").length>0&&$("#apgLoading").hide()},buttonBackColor:null!=typeof hdnButtonBackColor?$("#hdnButtonBackColor").val():"",buttonFontColor:null!=typeof ButtonFontColor?$("#hdnButtonFontColor").val():"",buttonHoverColor:null!=typeof ButtonHoverColor?$("#hdnButtonHoveColor").val():"",displayLoading:function(e){this.loader(!0)},hideLoading:function(e){this.loader(!1)},ChangeSaveButtonName:function(e){$("#btnSaveForm").val(e.Name),$("#btnSaveForm").attr("data-IspenddingSign",e.PendingSign)},setHeight:function(e,t){var i="iFrame_"+this.contentContainer;$("#"+i).height(e),$("#"+i).width(t)},getSize:function(e,t){forms.getSize()},getFormsPage:function(e,t,i,a,r,o){this.modal=!1,this.height=i,this.width=a,this.iswebview=r,this.isOnline=o,this.contentContainer=e;var n={data:{url:t},custom_code:1e3};this._callFormsPageSuccess(n)},_callFormsPageSuccess:function(e){null!=e&&1e3==e.custom_code?(vuiForms.modal,null==e.data.url||null==e.data.url||"undefined"==e.data.url||(vuiForms.frame=$("#"+vuiForms.contentContainer).VagaroForms({loadUrl:e.data.url,modal:vuiForms.modal,height:vuiForms.height,width:vuiForms.width,afterCallBackHandle:vuiForms.afterCallBackHandle,iswebview:vuiForms.iswebview,isfullwidth:vuiForms.isfullwidth,isOnline:vuiForms.isOnline}))):(null!=vuiForms.loader&&vuiForms.loader(!1),onFormsDownCallback(e))},getFilledFormsPage:function(e,t,i,a,r){this.modal=!1,this.height=i,this.width=a,this.iswebview=r,this.contentContainer=e,this.iframeAttr='scrolling="yes" frameborder="0"';var o={data:{url:t},custom_code:1e3};this._callFilledFormsSuccess(o)},_callFilledFormsSuccess:function(e){null!=e&&1e3==e.custom_code?(vuiForms.modal,null==e.data.url||null==e.data.url||"undefined"==e.data.url||(vuiForms.frame=$("#"+vuiForms.contentContainer).VagaroForms({iframeAttr:vuiForms.iframeAttr,loadUrl:e.data.url,modal:vuiForms.modal,height:vuiForms.height,width:vuiForms.width,afterCallBackHandle:vuiForms.afterCallBackHandle,iswebview:vuiForms.iswebview,isfullwidth:vuiForms.isfullwidth}))):null!=vuiForms.loader&&vuiForms.loader(!1)},_callDirectUrl:function(e,t,i,a,r){vuiForms.frame=$("#"+vuiForms.contentContainer).VagaroForms({loadUrl:e,modal:t,height:i,width:a,afterCallBackHandle:r})},setIframeUrl:function(e,t,i,a,r){null!=vuiForms.frame?vuiForms.frame.find("iframe").attr("src",e):vuiForms.frame=$("#"+vuiForms.contentContainer).VagaroForms({loadUrl:e,modal:t,height:i,width:a,afterCallBackHandle:r})},_getStyle:function(){var e,t,i="";if("undefined"!=typeof backGroundColor&&""!=backGroundColor&&(i+=".popupwidth542 .modal-body { background-color:"+backGroundColor+"}"),""!=$("#hdnButtonBackColor").val()&&null!=$("#hdnButtonBackColor").val()&&""!=$("#hdnButtonFontColor").val()&&null!=$("#hdnButtonFontColor").val()){var a=(e=$("#hdnButtonBackColor").val(),t=30,e=e.replace("#",""),r=parseInt(e.substring(0,2),16),g=parseInt(e.substring(2,4),16),b=parseInt(e.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t/100+")",result);i+=".btn-theme-text  { background-color: "+$("#hdnButtonBackColor").val()+"!important;border-color:"+$("#hdnButtonBackColor").val()+"!important; color : "+$("#hdnButtonFontColor").val()+"!important;}",i+=".btn-theme-text:hover { background-color: "+$("#hdnButtonHoveColor").val()+"!important;border-color:"+$("#hdnButtonHoveColor").val()+"!important;}",i+=".btn-default  { background-color!important:  #666666 }",i+=".vg-default-tab-link.active a,.vg-default-tab-link a:hover {color: "+$("#hdnButtonBackColor").val()+"!important;}.vg-default-tab-link.active a: before,.vg-default-tab-link.active a: hover: before { border-color: "+$("#hdnButtonBackColor").val()+"!important; }.vg-default-tab-link.active a:before,.vg-default-tab-link.active a:hover:before {border-color: "+$("#hdnButtonBackColor").val()+"!important;}",i+=".pagination-new-default ul li:hover a,.pagination-new-default ul li.active a { color: #fff !important; background-color: "+$("#hdnButtonBackColor").val()+"!important;}",i+=".fmTextWrap.active { border-left-color: "+$("#hdnButtonBackColor").val()+"!important}",i+=".customer-table-arrow a { color: "+$("#hdnButtonBackColor").val()+"!important}",i+=".loader-imgNew { border-right-color: "+a+"!important}",i+=".loader-imgNew { border-top-color: "+a+"!important}",i+=".loader-imgNew { border-bottom-color: "+a+"!important}",i+=".loader-imgNew { border-left-color: "+$("#hdnButtonBackColor").val()+"!important}"}return i+=".framefullwidth { width:100%!important;}"},_getOnlineStyle:function(){if(""==$("#hdnFontColor").val()&&""==$("#hdnTabBackgroundColor").val()&&""==$("#hdnContentHeaderFontColor").val())return"";var e="",t=void 0!==$("#hdnFontColor").val()?$("#hdnFontColor").val():"#333",i=void 0!==$("#hdnTabBackgroundColor").val()?$("#hdnTabBackgroundColor").val():"#fff",a=void 0!==$("#hdnContentHeaderFontColor").val()?$("#hdnContentHeaderFontColor").val():"#cdcdcd";return e+=".frm-form-title, .frm-input-title, .customredio-box-singal-type2 label, .signature-content, .frm-form-text.heading, .frm-form-text,.customcheck-box-singal-black label, .customcheck-box-singal label,.frm-img-caption { color: "+t+"; font-family: "+(void 0!==$("#hdnContentFontName").val()?$("#hdnContentFontName").val():'"proxima-nova",sans-serif!important"')+";}",e+=".title-line { border-color: "+t+";}",e+=".whiitebg body, .whiitebg  {background-color: "+i+"!important;}",e+=".ratting-common a { background-color: #fff; border-color: "+a+";}",e+=".ratting-common a.active, .ratting-common a:after, .ratting-common a:hover {border-color: "+a+";}",e+=".ratting-common a:hover:after, .ratting-common a.active:after {background:"+a+";}"}},onFormsDownCallback=function(e){var t="";if(void 0!==e&&void 0!==e.data&&null!=e.data&&void 0!==e.data.Message&&""!==e.data.Message){t=e.data.Message+""}else t=void 0!==e&&void 0!==e.Message&&null!=e.Message&&""!==e.Message?e.Message:"Some error occured, Please try again!. ErrorCode: 1011";swal({title:"",text:t,html:!0,showCancelButton:!1,customClass:"sweet-alert-model",animation:"slide-from-bottom"},function(e){return window.location.href=window.location.href,!1})},onsetParentDivHeightCallback=function(e){($("body,html").hasClass("Popup_Widget")||$("body,html").hasClass("Newtab_Widget"))&&$("#mobile-check").is(":visible")?($(vuiForms.frame).find("iframe").css("height",$("body").height()+"px"),$(vuiForms.frame).find("iframe").parent().css("height",$("body").height()+"px"),$("html,body").addClass("overflow-hidden-remove")):$("body,html").hasClass("Embedded_Widget")&&$("#mobile-check").is(":visible")&&($(vuiForms.frame).find("iframe").css("height",screen.height+"px"),$(vuiForms.frame).find("iframe").parent().css("height",screen.height+"px"),$("html,body").addClass("overflow-hidden-remove"))},onsetToScrollPositionCallback=function(e){($("body,html").hasClass("Popup_Widget")||$("body,html").hasClass("Newtab_Widget"))&&$("#mobile-check").is(":visible")?($("html,body").removeClass("overflow-hidden-remove"),setTimeout(function(){$("html,body").animate({scrollTop:e.position},400)},250)):$("body,html").hasClass("Embedded_Widget")&&$("#mobile-check").is(":visible")&&setTimeout(function(){parent.$("html,body").animate({scrollTop:e.position},400)},250)},onsetToFormScrollPositionCallBack=function(e){setTimeout(function(){"undefined"!=typeof _employeeOwner&&1==$(_employeeOwner.control.aformstatus).is(":visible")&&1==_employeeOwner.model.IsRentContract?$(".settingMainWarp").animate({scrollTop:e.position+626},500):parent.$("html,body").animate({scrollTop:e.position},400)},0)},onloadTutorialCallback=function(){return ShowDynamicPopupForShopOwner("/DynamicPopupPages/Videos.aspx",402,765,"divVideos","Play Video","ShowVideoBoxAlways",""),!1},onloadVagaroDriveCallback=function(){return ShowDynamicPopupForShopOwner("/ShopOwner/VagaroDrivePopup.aspx?RequestFrom=uploadForms",700,1050,"divVagaroDrive","Vagaro Drive","showVagaroDrive","","Vagarodrivepopup"),!1},onOpenManageMerchantAccountDialogCallBack=function(){window.open("/merchants/settings/premiumfeature/creditcardprocessing","_blank")},ongetCCDetailsFromVagaroCallBack=function(e){if(null!=ZenSwipeCardDetails&&void 0!==ZenSwipeCardDetails&&""!=ZenSwipeCardDetails)ZenSwipeCardDetails.UserID=e.UserID,vuiForms.frame.forms.sendCCDetailsToForms(ZenSwipeCardDetails);else{var t=JSON.parse('{"UserID" : "'+e.UserID+'","eventType": ""}');vuiForms.frame.forms.sendCCDetailsToForms(t)}},onloadReactiveVagaroDrivePopupCallback=function(){return ShowDynamicPopupForShopOwner("/ShopOwner/VagaroDriveReactivePopup.aspx?RequestFrom=uploadForms",175,600,"divReactiveVagaroDrivePopup","Vagaro Drive ReActivated","showReactiveVagaroDrive","","Vagarodrivepopup"),!1},onloadVagaroDriveRequiredCallback=function(){swal({title:"",text:"Uploading Files to Forms requires Vagaro Drive. Would you like to activate Vagaro Drive?",customClass:"sweet-alert-model",animation:"slide-from-bottom",confirmButtonText:"Activate Vagaro Drive"},function(e){1==e?top.location=window.location.origin+"/merchants/settings/premiumfeature/drive":$("#SelectForm").val("0").trigger("change"),swal.close()}),$(".gencustom-head .gencutom-title").text("Vagaro Drive Required")},_callBackToCheckInApp=function(e){null!=window.JSInterface&&window.JSInterface.CallWSMethod(e)},onGetSizeCallback=function(e){},onGetFormRespIframeDataCallback=function(e){var t="";void 0!==e.message&&null!=e.message&&(t=e.message);var i={formId:t},a=new vagaro.ajax;a.datamodel.Token="GetFormRespIframeData",a.datamodel.data=i,a.datamodel.callback=function(e){vuiForms.frame.forms.submitFormRespIframeData(e)},a.datamodel.Error=function(e){this.loader(!1)},a.Post()},onReloadIframeParentPageCallback=function(e){window.location.reload(!0)},onDisplayLoadingCallbackForms=function(e){vuiForms.displayLoading()},onHideLoadingCallbackForms=function(e){vuiForms.hideLoading()},SavebuttonNameCallbackForms=function(e){vuiForms.ChangeSaveButtonName(e)},onResetReponseFrameCallback=function(){$("#SelectForm").val("0"),$("#divFilledFormsIframe").hide(),_custForm.getResponseList()},ongetServicesandClassCallback=function(e){BindServices(e.businessID)},BindServices=function(e){var t=[],i={};i.BusinessID=e,i.IncludePackage=0,i.loadClass=null;var a=new vagaro.ajax;a.datamodel.Token="GetALLActiveServicesAndClassForForms",a.datamodel.data=i,a.datamodel.callback=function(e){t=e,vuiForms.frame.forms.responseServiceAndClass(t)},a.datamodel.Error=function(e){t=null},a.Post()},ongetMembershipsCallback=function(e){BindMemberships(e.businessID)},BindMemberships=function(e){var t=[],i={};i.BusinessID=e,i.Type=1;var a=new vagaro.ajax;a.datamodel.Token="GetAllActiveMembershipForForms",a.datamodel.data=i,a.datamodel.callback=function(e){t=e,vuiForms.frame.forms.responseMembership(t)},a.datamodel.Error=function(e){t=null},a.Post()},ongetBusinessTypelistCallback=function(e){getBusinessTypelist(e.businessId)},ongetAccessRightsCallback=function(){"undefined"!=typeof _custForm&&_custForm.ongetAccessRightsCallback()},onEditFormResponseCallback=function(e){_custForm.editFormResponse(e.respId,e.respPageUrl,e.formId,e.isEdit)},onNewEditFormResponseCallback=function(e){_custForm.newEditFormResponse(e)},onGetStateDetailByNameCallback=function(e){if(null!=e.message){var t={objParam:{BusinessID:""==$("#hdnBusinessID").val()?0:$("#hdnBusinessID").val(),LoginUserId:$("#hdnLoginUserID").val(),CountryID:e.message.CountryID,StateName:e.message.StateName}};formsAjax("GetStateDetailByName",t,getStateDetailByNameSuccess,getStateDetailByNameFailed,!1,!0)}},getStateDetailByNameSuccess=function(e){vuiForms.frame.forms.sendStateDetail(e)},getStateDetailByNameFailed=function(e){console.log(e)},onGetCityByZipCodeCallback=function(e){if(null!=e.message){var t={objParam:{BusinessID:""==$("#hdnBusinessID").val()?0:$("#hdnBusinessID").val(),LoginUserId:$("#hdnLoginUserID").val(),CountryID:e.message.CountryID,strZipCode:e.message.strZipCode}};formsAjax("GetCityByZipCode",t,getCityByZipCodeCallSuccess,getCityByZipCodeCallFailed,!1,!0)}},onDateRangePickerSetUpCallback=function(e){var t=e.message;if($(window).scrollTop(t.position),$("body,html").hasClass("Embedded_Widget")&&$("#mobile-check").length>0&&$("#mobile-check").is(":visible")){var i=t.position;try{parent.$("html,body").animate({scrollTop:i},400)}catch(e){"undefined"!=typeof $Interframe&&void 0!==$Interframe.setWidgetScroll?$Interframe.setWidgetScroll(i):$("html,body").animate({scrollTop:i},400)}}},getCityByZipCodeCallSuccess=function(e){vuiForms.frame.forms.sendCityByZipCode(e)},getCityByZipCodeCallFailed=function(e){console.log(e)};var formsAjax=function(e,t,i,a,r,o){var n=new vagaro.ajax;n.datamodel.Token=e,n.datamodel.data=t,n.datamodel.callback=i,n.datamodel.Error=a,0==o&&(n.datamodel.async=!1),1==r?n.PostQue():n.Post()};function setFormPageHeight(){"undefined"!=typeof iframe_type&&(1==iframe_type?1==$(".navigation-bg").is(":visible")?vuiForms.setHeight($(window).height()-$(".navigation-bg").height(),"100%"):vuiForms.setHeight($(window).height(),"100%"):2!=iframe_type&&4!=iframe_type||vuiForms.setHeight($(window).height()-$(".headerFix").height(),"100%"))}function successHEICtoJPG(e){navigator.userAgent.toLowerCase().indexOf("safari")<0&&(navigator.userAgent.toLowerCase().indexOf("iphone")>-1||navigator.userAgent.toLowerCase().indexOf("ipad")>-1)&&(e=unescape(e));var t=JSON.parse(e);t.eventType="heicSucessResponseFromVagaro",vuiForms.frame.forms.heicSucessResponseFromVagaro(t)}function onsetDatePickerDivCallback(){var e=document.querySelector(".formsbutton-row");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}function onSetDatePickerScrollFromVagaroCallBack(e){var t=0;($("body,html").hasClass("Popup_Widget")||$("body,html").hasClass("Newtab_Widget")||$("body,html").hasClass("Embedded_Widget"))&&$("#mobile-check").length>0&&$("#mobile-check").is(":visible")?setTimeout(function(){t=e;try{parent.$("html,body").animate({scrollTop:t},400)}catch(e){"undefined"!=typeof $Interframe&&void 0!==$Interframe.setWidgetScroll?$Interframe.setWidgetScroll(t):$("html,body").animate({scrollTop:t},400)}},350):(t=e,window.parent.scrollTo(0,t>0?t:0))}function onsetFormTitleCallback(e){_onlineCheckout.FormTitle=e}ongetLoginUserDetailsCallback=function(){"undefined"!=typeof _custForm&&_custForm.sendUseDetailsToForm()},onShowMessageCallback=function(e){alertToastMsg(e.message,e.type)},$(window).on("resize",function(){setTimeout(function(){setFormPageHeight()},500)}),$(window).bind("orientationchange",function(e){setTimeout(function(){setFormPageHeight()},1e3)}),$(".settingMainWarp").on("touchend",function(e){null!=vuiForms.frame&&vuiForms.frame.forms.getHeight(),setTimeout(function(){setFormPageHeight()},1e3)}),$(".settingMainWarp").on("touchstart",function(e){null!=vuiForms.frame&&vuiForms.frame.forms.getHeight(),setTimeout(function(){setFormPageHeight()},1e3)});ApiPath="websiteapi/homepage/";activetabtype=1;var dailyDealFeeValue,dailyDealFeeValue_ExistingUser,dailyDealFeeType,IsForVeraNewCustomer,cartDailyDealFee,dailydeal_CCOFF_Depositper,totalDepositWhenDepositLessDDFee,frmcontainer,onlineVPLCheckout=0,isGCAppliedForClass=!1,tipType="percentage",ischkFirstTimeCustomerCart=null,dailydealFee=0,IsSameDayCustomer=!1,totalDailyDealFee=0,totalOriginalPrice=0,IsDailyDealFeeCCOFF=!1,totalDailyDealFeeOfAllCart_PMGCA=0,isPromotionApplied=!1,ApiURLEnumOnlineCheckout={removecartitem:ApiPath+"removecartitem",classaddtocart:ApiPath+"classaddtocart",getgcpackageandpointforonlinecheckout:ApiPath+"getgcpackageandpointforonlinecheckout",getclasscancellationpolicy:ApiPath+"getclasscancellationpolicy",getreturnpolicy:ApiPath+"getreturnpolicy",getcitybyzipcode:ApiPath+"getcitybyzipcode",validatepromocodeandgetdetails:ApiPath+"validatepromocodeandgetdetails",updatemutiplecartitem:ApiPath+"updatemutiplecartitem",getonlinecheckouttipsetting:ApiPath+"getonlinecheckouttipsetting",updateeventsessionattendees:ApiPath+"updateeventsessionattendees",getonlineinvoicebusinessuserdetailsbyinvoiceid:ApiPath+"getonlineinvoicebusinessuserdetailsbyinvoiceid",removecheckoutitem:ApiPath+"removecheckoutitem",getcartcount:ApiPath+"getcartcount",getstatesbymultiplecountryid:ApiPath+"getstatesbymultiplecountryid",getappointmentcancellationpolicy:ApiPath+"getappointmentcancellationpolicy",getbusinesshourslist:ApiPath+"getbusinesshourslist",getuserccdetailsbyonlyuserid:ApiPath+"getuserccdetailsbyonlyuserid",giftcertificateaddtocart:ApiPath+"giftcertificateaddtocart",serviceaddtocart:ApiPath+"serviceaddtocart",checkuserexistsbyuserid:ApiPath+"checkuserexistsbyuserid",getformbyserviceids:ApiPath+"getformbyserviceids",insertusersatformload:ApiPath+"insertusersatformload",getformsbyids:ApiPath+"getformsbyids",validateshoppingcartdata:ApiPath+"validateshoppingcartdata",saveuserccdetails:ApiPath+"saveuserccdetails",geteventtimezonedate:ApiPath+"geteventtimezonedate",getState:"myaccount/getstatesbymultiplecountryid",getStateCode:"myaccount/getcitybyzipcodewithstatecode",getuservplaccountdetail:"myaccount/getuservplaccounts",gcpromocodelimt:"myaccount/gcpromocodelimt",getgcpromocodelimt:"myaccount/getgcpromocodelimt"},CartItemTypeEnumOnlineCheckout={Membership:"7",Package:"5",Product:"2",GC:"3",Class:"8",Service:"1",ClassAddon:"20",VCFFee:"21"},_PackageMembership={Product:3,PartialProduct:21};function getLocationDatepickupinstrore(){if(null!=_onlineCheckout.minDate)return _onlineCheckout.minDate;var e=e=new Date,t=e.format("mm"),i=parseInt(parseInt(t)%30);return i>0&&(t=t-i+30,e.setMinutes(t)),e}function Converttimeformat(e){var t=e;t=(t=t.replace("AM"," AM")).replace("PM"," PM");var i=Number(t.match(/^(\d+)/)[1]),a=Number(t.match(/:(\d+)/)[1]),r=t.match(/\s(.*)$/)[1];"PM"==r&&i<12&&(i+=12),"AM"==r&&12==i&&(i-=12);var o=i.toString(),n=a.toString();return i<10&&(o="0"+o),a<10&&(n="0"+n),o}function ConverttimeformattoMiniut(e){var t=e;t=(t=t.replace("AM"," AM")).replace("PM"," PM");var i=Number(t.match(/^(\d+)/)[1]),a=Number(t.match(/:(\d+)/)[1]),r=t.match(/\s(.*)$/)[1];"PM"==r&&i<12&&(i+=12),"AM"==r&&12==i&&(i-=12);var o=i.toString(),n=a.toString();return i<10&&(o="0"+o),a<10&&(n="0"+n),n}function verifyaddresshideloadingCallback(){ShowLoader(!1)}function FormatPhoneByCountry(e,t){try{if(null!=e&&void 0!==e&&0!=e.length&&e.length>8){var i=e.replace(/\D/g,""),a={0:"(",3:") ",6:"-"};void 0!==t&&null!=t&&1*t>0&&(2==t&&10==i.length||4==t&&9==i.length)&&(i="0"+i),void 0!==t&&null!=t&&1*t>0&&(2==t?a={3:" ",7:" "}:3==t?a={3:"-",6:"-"}:4==t&&(a={0:"(",2:") ",6:" "})),e="";for(var r=0;r<i.length;r++)e+=(a[r]||"")+i[r]}return e}catch(t){return e}}function DisableFinalSubmitButton(e){return 1==e?($("#ancBuyNow").css("pointer-events","auto").removeClass("checkoutdisable"),!0):"none"!==$("#ancBuyNow").css("pointer-events")&&($("#ancBuyNow").css("pointer-events","none").addClass("checkoutdisable"),!0)}
/*!
 * Select2 4.0.0
 * https://select2.github.io
 *
 * Released under the MIT license
 * https://github.com/select2/select2/blob/master/LICENSE.md
 *Waitlist 2.0: Add for wailtlist. By Chandni Shah, 30/07/2018
 */function InfoBox(e){e=e||{},google.maps.OverlayView.apply(this,arguments),this.content_=e.content||"",this.disableAutoPan_=e.disableAutoPan||!1,this.maxWidth_=e.maxWidth||0,this.pixelOffset_=e.pixelOffset||new google.maps.Size(0,0),this.position_=e.position||new google.maps.LatLng(0,0),this.zIndex_=e.zIndex||null,this.boxClass_=e.boxClass||"infoBox",this.boxStyle_=e.boxStyle||{},this.closeBoxMargin_=e.closeBoxMargin||"2px",this.closeBoxURL_=e.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===e.closeBoxURL&&(this.closeBoxURL_=""),this.infoBoxClearance_=e.infoBoxClearance||new google.maps.Size(1,1),void 0===e.visible&&(e.visible=void 0===e.isHidden||!e.isHidden),this.isHidden_=!e.visible,this.alignBottom_=e.alignBottom||!1,this.pane_=e.pane||"floatPane",this.enableEventPropagation_=e.enableEventPropagation||!1,this.div_=null,this.closeListener_=null,this.moveListener_=null,this.contextListener_=null,this.eventListeners_=null,this.fixedWidthSet_=null}_onlineCheckout={},_HighRiskEmailCheck={},function(e,t,a){var r;_onlineCheckout.IsRecurringPkg="",_onlineCheckout.IsRecurringMembership=!1,_onlineCheckout.IsRecurringMembershipCount=0,_onlineCheckout.IsRecurringPkgCount=0,_onlineCheckout.PrintType={Receipt:1,GC:2},_onlineCheckout.Empty="",_onlineCheckout.StatesList=[],_onlineCheckout.selectedCountryId=1,_onlineCheckout.popupStateList={},_onlineCheckout.selectedAddressData={},_onlineCheckout.ccCardOnFile=null,_onlineCheckout.BusSavedCard=null,_onlineCheckout.isCCConfirmationfrompage="",_onlineCheckout.zenSwipeCardDetails=null,_onlineCheckout.isCheckoutCCChanged=!1,_onlineCheckout.isUpdateItemQty=!1,_onlineCheckout.isUpdateAddonsItemQty=!1,_onlineCheckout.isShowClassPolicePopup=!0,_onlineCheckout.isShowProductPolicePopup=!0,_onlineCheckout.formsResponse=[],_onlineCheckout.currentresponse=[],_onlineCheckout.isConsiderForms=!1,_onlineCheckout.isFormsDirectClass=!1,_onlineCheckout.isFormsbookwithcc=!1,_onlineCheckout.isFormsbookwithoutcc=!1,_onlineCheckout.formId="",_onlineCheckout.loadNewCCandShip=!1,_onlineCheckout.IsThisNewCustomer=!1,_onlineCheckout.isFromInvoice=!1,_onlineCheckout.InvoiceID=0,_onlineCheckout.businessWorkinghour=[],_onlineCheckout.GCVoidMsg="This gift card has been voided and can no longer be used.",_onlineCheckout.GCExpMsg="This gift card has expired and can no longer be used.",_onlineCheckout.GCBalMsg="There is no balance available in the gift card you have selected.",_onlineCheckout.GCQuantityMsg="There is no quantity available in the gift card you have selected.",_onlineCheckout.GCOtherMsg="The gift card you have selected belongs to other service and can not be used here.",_onlineCheckout.IsValidatedOnePerUser=!1,_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount=null,_onlineCheckout.lstUserListForCheckout_ShowDiscount=null,_onlineCheckout.lstMembershipForCheckout_ShowDiscount=null,_onlineCheckout.IsPromotionEnable_ShowDiscount=!1,_onlineCheckout.GcAndPackagesForCheckout_ShowDiscount=null,_onlineCheckout.UserListForCheckout_ShowDiscount=null,_onlineCheckout.MembershipForCheckout_ShowDiscount=null,_onlineCheckout.RelationshipsArr=null,_onlineCheckout.ChildAge="",_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.SelectedFamilyFriendsCount=null,_onlineCheckout.MaxNoFamilyFriends=null,_onlineCheckout.SelectedFamilyFriendsArr=null,_onlineCheckout.PackageSharingDetail=null,_onlineCheckout.currentTime=null,_onlineCheckout.minDate=null,_onlineCheckout.objMin=null,_onlineCheckout.objMax=null,_onlineCheckout.objChecktime=0,_onlineCheckout.FormsResponseID=null,_onlineCheckout.isFillCCDetailsForms="0",_onlineCheckout.CardNotPresentMessage="This account is restricted to online gift cards only",_onlineCheckout.TotalPaidCount=0,_onlineCheckout.TipApplyCounter=0,_onlineCheckout.TipAppliedSum=0,_onlineCheckout.ShoppingCartStep=0,_onlineCheckout.DateFormatdddMMMDDYYYY="ddd, MMM DD, YYYY",_onlineCheckout.DateFormatdddMMM_ddYYYY="ddd, MMM dd, YYYY",_onlineCheckout.IsVplChanged=!1,_onlineCheckout.isCheckoutVPLChanged=!1,_onlineCheckout.isCheckoutVPLPromocode=!1,_onlineCheckout.totalfinalAmount=0,_onlineCheckout.totalFinalDiscount=0,_onlineCheckout.VPLCheckoutData={},_onlineCheckout.customerEnroll={},_onlineCheckout.VplSelectedBank={},_onlineCheckout.isClassCheckout=!1,_onlineCheckout.isCalShippingCharge=!1,_onlineCheckout.CountryID=1,_onlineCheckout.IsVPLAddress=0,_onlineCheckout.CustomerDetails={},_onlineCheckout.IsBuyGC=!1,_onlineCheckout.IsPartialPointAllowed=!1,_onlineCheckout.isFormResponseSubmittedCalled=!1,_onlineCheckout.FormCallSource=!1,_onlineCheckout.invoiceStatus={Draft:1,Sent:2,Paid:3,Overdue:4,Void:5},_onlineCheckout.CheckoutBarcodeCodePrepayOnline={srvc:"srvc",GC:"GC",Pkg:"Pkg",IOU:"IOU",MS:"MS",CLS:"CLS",srvcGC:"SrvcGC",Fee:"FEE",Point:"point",dailyDealFee:"dailyDealFee"},_onlineCheckout.ItemType={Other:1,Class:8},_onlineCheckout.CodeType={GCCode:"CheckGCNumber",PromoCode:"CheckPromoNumber"},_onlineCheckout.PromoCodeType={GCCode:1,PromoCode:2},_onlineCheckout.PaymentOptionText={TextPkg:"Use Package Visit - ",TextMS:"Use Membership Visit - ",TextGC:"Use Gift Card - ",TextPoint:"Points Balance - "},_onlineCheckout.Controls={TmplBookingPaymentOption:"#BookingPaymentOption",DivPaymentOption:"#divPaymentOption",DvcheckoutBookingTabs:"#dvcheckoutBookingTabs",PaymentOptionMsPkgPoint:".payment-option-mspkgpoint",tabGooglePay:"#tabGooglePay",tabApplePay:"#tabApplePay",keyGooglePay:"tabGooglePay",keyApplePay:"tabApplePay"},_onlineCheckout.Model={IsPaymentOption:!1},_onlineCheckout.CssClass={ActiveTab:"w--current"},_onlineCheckout.AuthoriseListData=[],_onlineCheckout.AuthorisePaymnetCount=0,_onlineCheckout.IsUpSellMemPkgAdd=0,_onlineCheckout.IsPkgAdded=!1,_onlineCheckout.arrpaidType={UnPaid:0,Paid:1,Deposits:2,PartiallyPaid:3,PaidClass:4,DepositsClass:5,PartiallyPaidClass:6,OfflineDeposit:7,OfflineDepositPrepay:8},_onlineCheckout.arrPaymentTitleType={Default:"Payment Information",Select:"Select Payment Method",Deposits:"This Business Requires a Deposit:",HoldOnCard:"Credit Card Required to Secure Your Reservation"},_onlineCheckout.VPLTwoFactor={None:0,Email:1,Cell:2,EmailAndCell:3},_onlineCheckout.ApplyVCFLocation={OnLoad:1,ApplyTip:2,ApplyPromoCode:3,RemovePromoCode:4,RemoveDiscount:5,ShippingMethod:6,ApplyGC:7,CCSelection:8,MembershipUpSell:9,PackageUpSell:10,RemoveUpSell:11},_onlineCheckout.FormTitle="",_onlineCheckout.VPLTwoFactorStatus=0,_onlineCheckout.applePaySession=null,_onlineCheckout.resetGlobalVeriable=function(){_onlineCheckout.ccCardOnFile=null,_onlineCheckout.isCCConfirmationfrompage="",_onlineCheckout.zenSwipeCardDetails=null,_onlineCheckout.isCheckoutCCChanged=!1,_onlineCheckout.isUpdateItemQty=!1,_onlineCheckout.businessWorkinghour=[],_onlineCheckout.isShowClassPolicePopup=!0,_onlineCheckout.isShowProductPolicePopup=!0,_onlineCheckout.IsThisNewCustomer=!1,"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&e("#mobileCart").hide(),"1"!=getCookie("EventType")&&"8"!=getCookie("EventType")&&"5"!=getCookie("EventType")&&void 0!==clearCookie&&null!=clearCookie&&clearCookie("UniqueCreateLink")},_onlineCheckout.loadPage=function(){if(_onlineCheckout.IsPartialPointAllowed="undefined"!=typeof _IsPartialPointAllowed&&_IsPartialPointAllowed,_onlineCheckout.isFromInvoice="undefined"!=typeof sIsFromInvoice&&sIsFromInvoice,_onlineCheckout.isValidForCheckoutInvoice()?(null!=onlineShoppingCart.invoiceDetails&&1!=onlineShoppingCart.invoiceDetails.CountryID&&(currencysymbol=onlineShoppingCart.invoiceDetails.CurrencySymbol),CommonFromPage="Invoice",e("#shoppingcartfirst").hide()):e("#shoppingcartfirst").show(),e("#divHeaderBusinessName").attr("tabindex",-1).focus(),_onlineCheckout.resetGlobalVeriable(),_onlineCheckout.checkIfProductExists(),_onlineCheckout.initWebFlowtab(),_onlineCheckout.calculateSubTotalForFirstStep(),_onlineCheckout.errorMessage(),_onlineCheckout.ImgLazyLoad(),_onlineCheckout.isValidForCheckoutInvoice()?(_onlineCheckout.InvoiceID=sInvoiceID,e("#divshippinginfo").hide(),"True"==e("#hdnIsFormsEnable").val()?_onlineCheckout.UpdateMutipleCartItem(null,!1,!0):_onlineCheckout.UpdateMutipleCartItem(null,!1,!1)):_onlineCheckout.InvoiceID=0,_onlineCheckout.CheckCustomerExists(),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.each(onlineShoppingCart.Memberships,function(t,i){var a=e(".product-div-shopping-col[data-type='membership']").eq(t);"true"!=_onlineCheckout.isFromInvoice.toString().toLowerCase()&&i.MaxNoFamilyFriends>0?(0==e("#divMemberChipsForMS").children().length&&(_onlineCheckout.ResetPkgMembershipVariable(),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(2)),a.find(".scffsharing").show()):a.find(".scffsharing").hide()}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var t=!1;e.each(onlineShoppingCart.Packages,function(i,a){"true"!=_onlineCheckout.isFromInvoice.toString().toLowerCase()&&a.MaxNoFamilyFriends>0?0==e("#"+a.ServiceId+"_"+a.autoId).children().length&&(t||(_onlineCheckout.PackageSharingDetail=null,t=!0),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(1)):e("#"+a.ServiceId+"_"+a.autoId).closest(".scffsharing").empty()})}},_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS=function(t){if(null==_onlineCheckout.FamilyAndFriendsDetails){var i=new vagaro.ajax;i.datamodel.Token="GetFamilyAndFriendsDetailsByUserID",i.datamodel.data={objRequest:{businessID:businessID,loginUserID:UserID,UserID:UserID,IsLoadFromOffline:!0,strLoginUserId:strUserID,parentPage:"OnlineShoppingCart"}},i.datamodel.callback=function(i){null!=i&&(_onlineCheckout.FamilyAndFriendsDetails=i,1==t?e.each(onlineShoppingCart.Packages,function(t,i){e("#"+i.ServiceId+"_"+i.autoId).empty(),_onlineCheckout.BindFamilyChipsForPkgMS(i,1)}):4==t?void 0!==_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&(_onlineCheckout.RelationshipsArr=_shopdetail.BookingDetail.MembershipUpSellData[0].Relationships.split(","),_onlineCheckout.ChildAge=_shopdetail.BookingDetail.MembershipUpSellData[0].ChildAge,_onlineCheckout.MaxNoFamilyFriends=_shopdetail.BookingDetail.MembershipUpSellData[0].MaxNoFamilyFriends,_onlineCheckout.BindFamilyChipsForPkgMS(null,4)):5==t?void 0!==_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.each(_shopdetail.BookingDetail.PackageUpSellData,function(t,i){e("#"+i.ServiceId+"_"+i.autoId).empty(),_onlineCheckout.BindFamilyChipsForPkgMS(i,5)}):e.each(onlineShoppingCart.Memberships,function(e,t){_onlineCheckout.BindFamilyChipsForPkgMS(t,2)}))},i.datamodel.Error=function(e){},i.Post()}else 1==t?e.each(onlineShoppingCart.Packages,function(t,i){e("#"+i.ServiceId+"_"+i.autoId).empty(),_onlineCheckout.BindFamilyChipsForPkgMS(i,1)}):4==t?void 0!==_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&(_onlineCheckout.RelationshipsArr=_shopdetail.BookingDetail.MembershipUpSellData[0].Relationships.split(","),_onlineCheckout.ChildAge=_shopdetail.BookingDetail.MembershipUpSellData[0].ChildAge,_onlineCheckout.MaxNoFamilyFriends=_shopdetail.BookingDetail.MembershipUpSellData[0].MaxNoFamilyFriends,_onlineCheckout.BindFamilyChipsForPkgMS(null,4)):5==t?void 0!==_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.each(_shopdetail.BookingDetail.PackageUpSellData,function(e,t){_onlineCheckout.BindFamilyChipsForPkgMS(t,5)}):e.each(onlineShoppingCart.Memberships,function(e,t){_onlineCheckout.BindFamilyChipsForPkgMS(t,2)})},_onlineCheckout.BindFamilyChipsForPkgMS=function(t,i){if(1==i||5==i){var a,r=0,o=null,n={};void 0!==t.Relationships&&null!=t.Relationships&&(a=t.Relationships.split(","));var s=t.ChildAge,l=t.MaxNoFamilyFriends;if(n.MaxNoFamilyFriends=l,n.ServiceId=t.ServiceId,n.autoId=t.autoId,null!=a&&null!=_onlineCheckout.FamilyAndFriendsDetails){e.grep(a,function(a){e.grep(_onlineCheckout.FamilyAndFriendsDetails,function(n){if(n.Relation==a){var d=!1;if("Child"==n.Relation){var c=s.split("-");(-1==n.Age&&c[1]>18||n.Age>=c[0]&&n.Age<=c[1])&&(d=!0)}else d=!0;if(d){var u=!1;l>r&&(r+=1,null==o&&(o=[]),o.push(n.UserID),u=!0);var p="#"+t.ServiceId+"_"+t.autoId;5==i&&(e("#scffsharingPkg").show(),p="#divMemberChipsForPKG"),u?e(p).append('<a id="'+n.UserID+'" href="javascript:void(0)" role="link" aria-label="'+n.FullName+' selected" onclick="_onlineCheckout.AddRemoveFamilyFriendPkg('+n.UserID+","+t.autoId+","+t.ServiceId+",'"+n.FullName+"',"+i+');" class="tag shared-ff-chkout selected blue-button">'+n.FullName+"</a>"):e(p).append('<a id="'+n.UserID+'" href="javascript:void(0)" role="link" aria-label="'+n.FullName+' unselected" onclick="_onlineCheckout.AddRemoveFamilyFriendPkg('+n.UserID+","+t.autoId+","+t.ServiceId+",'"+n.FullName+"',"+i+');" class="tag shared-ff-chkout gray-button">'+n.FullName+"</a>")}}}),5==i&&e("#scffsharingPkg").show()}),n.SelectedFamilyFriendsCountpkg=r,null!=o&&o.length>0&&(n.SelectedFamilyFriends=o.join(",")),null==_onlineCheckout.PackageSharingDetail&&(_onlineCheckout.PackageSharingDetail=[]);var d=!0;e.each(_onlineCheckout.PackageSharingDetail,function(e,t){t.ServiceId==n.ServiceId&&t.autoId==n.autoId&&(d=!1)}),d&&_onlineCheckout.PackageSharingDetail.push(n),(u=e.extend(!0,[],a))[u.indexOf("Child")]="Child (Age: "+s+")";var c=u.join(", ");e("#lblRelationshipsAndAgePkg"+t.ServiceId+t.autoId).text(c),5==i&&e("#lblRelationshipsAndAgePKG").text(c)}}else if(4==i){if(null!=_onlineCheckout.RelationshipsArr&&null!=_onlineCheckout.FamilyAndFriendsDetails){e.grep(_onlineCheckout.RelationshipsArr,function(t){e.grep(_onlineCheckout.FamilyAndFriendsDetails,function(i){if(i.Relation==t){var a=!1;if("Child"==i.Relation&&void 0!==_onlineCheckout.ChildAge&&null!=_onlineCheckout.ChildAge){var r=_onlineCheckout.ChildAge.split("-");(-1==i.Age&&r[1]>18||i.Age>=r[0]&&i.Age<=r[1])&&(a=!0)}else a=!0;if(a){var o=!1;_onlineCheckout.MaxNoFamilyFriends>_onlineCheckout.SelectedFamilyFriendsCount&&(_onlineCheckout.SelectedFamilyFriendsCount+=1,null==_onlineCheckout.SelectedFamilyFriendsArr&&(_onlineCheckout.SelectedFamilyFriendsArr=[]),_onlineCheckout.SelectedFamilyFriendsArr.push(i.UserID),o=!0),e("#scffsharingMS").show(),o?e("#divMemberChipsForMS").append('<a id="m'+i.UserID+'" href="javascript:void(0)" role="link" aria-label="'+i.FullName+' selected" onclick="_onlineCheckout.AddRemoveFamilyFriend('+i.UserID+",'m','"+i.FullName+'\');" class="tag shared-ff-chkout selected blue-button">'+i.FullName+"</a>"):e("#divMemberChipsForMS").append('<a id="m'+i.UserID+'" href="javascript:void(0)" role="link" aria-label="'+i.FullName+' unselected" onclick="_onlineCheckout.AddRemoveFamilyFriend('+i.UserID+",'m','"+i.FullName+'\'); " class="tag shared-ff-chkout blue-button">'+i.FullName+"</a>")}}})}),(u=e.extend(!0,[],_onlineCheckout.RelationshipsArr))[u.indexOf("Child")]="Child (Age: "+_onlineCheckout.ChildAge+")";c=u.join(", ");e("#lblRelationshipsAndAgeMS").text(c)}}else if(null!=_onlineCheckout.RelationshipsArr&&null!=_onlineCheckout.FamilyAndFriendsDetails){var u;e.grep(_onlineCheckout.RelationshipsArr,function(t){e.grep(_onlineCheckout.FamilyAndFriendsDetails,function(i){if(i.Relation==t){var a=!1;if("Child"==i.Relation&&void 0!==_onlineCheckout.ChildAge&&null!=_onlineCheckout.ChildAge){var r=_onlineCheckout.ChildAge.split("-");(-1==i.Age&&r[1]>18||i.Age>=r[0]&&i.Age<=r[1])&&(a=!0)}else a=!0;if(a){var o=!1;_onlineCheckout.MaxNoFamilyFriends>_onlineCheckout.SelectedFamilyFriendsCount&&(_onlineCheckout.SelectedFamilyFriendsCount+=1,null==_onlineCheckout.SelectedFamilyFriendsArr&&(_onlineCheckout.SelectedFamilyFriendsArr=[]),_onlineCheckout.SelectedFamilyFriendsArr.push(i.UserID),o=!0),o?e("#divMemberChipsForMS").append('<a id="m'+i.UserID+'" href="javascript:void(0)" role="link" aria-label="'+i.FullName+' selected" onclick="_onlineCheckout.AddRemoveFamilyFriend('+i.UserID+",'m','"+i.FullName+'\');" class="tag shared-ff-chkout selected blue-button">'+i.FullName+"</a>"):e("#divMemberChipsForMS").append('<a id="m'+i.UserID+'" href="javascript:void(0)" role="link" aria-label="'+i.FullName+' unselected" onclick="_onlineCheckout.AddRemoveFamilyFriend('+i.UserID+",'m','"+i.FullName+'\'); " class="tag shared-ff-chkout blue-button">'+i.FullName+"</a>")}}})}),(u=e.extend(!0,[],_onlineCheckout.RelationshipsArr))[u.indexOf("Child")]="Child (Age: "+_onlineCheckout.ChildAge+")";c=u.join(", ");e("#lblRelationshipsAndAgeMS").text(c)}},_onlineCheckout.ResetPkgMembershipVariable=function(){_onlineCheckout.RelationshipsArr=null,_onlineCheckout.ChildAge="",_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.SelectedFamilyFriendsCount=null,_onlineCheckout.MaxNoFamilyFriends=null,_onlineCheckout.SelectedFamilyFriendsArr=null},_onlineCheckout.AddRemoveFamilyFriend=function(t,i,a){null==_onlineCheckout.SelectedFamilyFriendsArr&&(_onlineCheckout.SelectedFamilyFriendsArr=[]),_onlineCheckout.SelectedFamilyFriendsArr.includes(t)?(e("#"+i+t).attr("aria-label",a+" unselected"),_onlineCheckout.SelectedFamilyFriendsArr=e.grep(_onlineCheckout.SelectedFamilyFriendsArr,function(e){return e!=t}),_onlineCheckout.SelectedFamilyFriendsCount-=1,e("#"+i+t).toggleClass("selected"),e("#"+i+t).hasClass("selected")?(e("#"+i+t).removeClass("gray-button"),e("#"+i+t).addClass("blue-button")):(e("#"+i+t).addClass("gray-button"),e("#"+i+t).removeClass("blue-button"))):(e("#"+i+t).attr("aria-label",a+" selected"),_onlineCheckout.MaxNoFamilyFriends>_onlineCheckout.SelectedFamilyFriendsCount?(null==_onlineCheckout.SelectedFamilyFriendsArr&&(_onlineCheckout.SelectedFamilyFriendsArr=[]),_onlineCheckout.SelectedFamilyFriendsArr.push(t),_onlineCheckout.SelectedFamilyFriendsCount+=1,e("#"+i+t).toggleClass("selected"),e("#"+i+t).hasClass("selected")?(e("#"+i+t).removeClass("gray-button"),e("#"+i+t).addClass("blue-button")):(e("#"+i+t).addClass("gray-button"),e("#"+i+t).removeClass("blue-button"))):_common.PassiveAlertFailed("You have reached maximum number of family & friends."))},_onlineCheckout.AddRemoveFamilyFriendPkg=function(t,i,a,r,o){var n,s=e.grep(_onlineCheckout.PackageSharingDetail,function(e){return e.ServiceId==a&&e.autoId==i}),l=0,d=null,c="#"+a+"_"+i;5==o&&(c="#divMemberChipsForPKG"),null!=s[0].SelectedFamilyFriends&&(d=s[0].SelectedFamilyFriends.split(",")),l=s[0].SelectedFamilyFriendsCountpkg,n=s[0].MaxNoFamilyFriends,null==d&&(d=[]),d.includes(t.toString())?(e("#"+t).attr("aria-label",r+" unselected"),d=e.grep(d,function(e){return e!=t}),l-=1,e(c).find("#"+t).toggleClass("selected"),e(c).find("#"+t).hasClass("selected")?(e(c).find("#"+t).removeClass("gray-button"),e(c).find("#"+t).addClass("blue-button")):(e(c).find("#"+t).addClass("gray-button"),e(c).find("#"+t).removeClass("blue-button")),e.each(_onlineCheckout.PackageSharingDetail,function(e,t){t.ServiceId==a&&t.autoId==i&&(t.SelectedFamilyFriends=d.join(","),t.SelectedFamilyFriendsCountpkg=l)})):(e("#"+t).attr("aria-label",r+" selected"),n>l?(null==d&&(d=[]),d.push(t),l+=1,e(c).find("#"+t).toggleClass("selected"),e(c).find("#"+t).hasClass("selected")?(e(c).find("#"+t).removeClass("gray-button"),e(c).find("#"+t).addClass("blue-button")):(e(c).find("#"+t).addClass("gray-button"),e(c).find("#"+t).removeClass("blue-button")),e.each(_onlineCheckout.PackageSharingDetail,function(e,t){t.ServiceId==a&&t.autoId==i&&(t.SelectedFamilyFriends=d.join(","),t.SelectedFamilyFriendsCountpkg=l)})):_common.PassiveAlertFailed("You have reached maximum number of family & friends."))},_onlineCheckout.EnableDisableSharing=function(t,i,a){if(1==a||5==a){var r="#"+t+"_"+i;if(5==a&&(r="#divMemberChipsForPKG"),e(r).closest("#divsharedPkgwithFF").toggle(),!e(r+":checked").length>0)e(r).attr("checked",!1),e(r).next().attr("aria-checked",!1),e.each(_onlineCheckout.PackageSharingDetail,function(e,r){(r.ServiceId==t&&r.autoId==i||5==a)&&(r.SelectedFamilyFriends=null,r.SelectedFamilyFriendsCountpkg=0)});else{var o=[];e(r+" .selected").map(function(e){o.push(this.id)}),e(r).attr("checked",!0),e(r).next().attr("aria-checked",!0),e.each(_onlineCheckout.PackageSharingDetail,function(e,a){a.ServiceId==t&&a.autoId==i&&(a.SelectedFamilyFriends=o.join(),a.SelectedFamilyFriendsCountpkg=o.length)})}}else if(t>0&&2==a){var n="#FFFriends_"+t,s="#divsharedMSwithFF_"+t,l="#divMemberChipsForMS_"+t;if(!e(n).length)return;if(e(s).toggle(e(n).is(":checked")),e(n).is(":checked")){e(n).prop("checked",!0).next().attr("aria-checked",!0);o=[];e(l+" .selected").each(function(){var e=this.id.substring(1);o.push(Number(e))}),_onlineCheckout.SelectedFamilyFriendsArr=o}else e(n).prop("checked",!1).next().attr("aria-checked",!1),_onlineCheckout.SelectedFamilyFriendsArr=null}else if(e("#divsharedMSwithFF").toggle(),!e("#FFFriends:checked").length>0)e("#FFFriends").attr("checked",!1),e("#FFFriends").next().attr("aria-checked",!1),_onlineCheckout.SelectedFamilyFriendsArr=null;else{o=[];e("#FFFriends").attr("checked",!0),e("#FFFriends").next().attr("aria-checked",!0),e("#divMemberChipsForMS .selected").map(function(e){var t=this.id.substring(1);o.push(Number(t))}),_onlineCheckout.SelectedFamilyFriendsArr=o}e("#chk"+t+i).focus()},_onlineCheckout.CheckCustomerExists=function(){var e=new vagaro.ajax;e.datamodel.async=!1,e.datamodel.Token=ApiURLEnumOnlineCheckout.checkuserexistsbyuserid,e.datamodel.data={loginUserID:UserID,businessID:businessID},e.datamodel.IsNewVagaroAPI=!0,e.datamodel.callback=function(e){_onlineCheckout.IsThisNewCustomer=1!=e,_onlineCheckout.errorMessage()},e.datamodel.Error=function(e){},e.Post()},_onlineCheckout.ImgLazyLoad=function(){setTimeout(function(){e(".lazy").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"https://vagaro.azureedge.net/static-content/Images/no-shop-image-big-new.gif"}).trigger("lazyload")},500)},_onlineCheckout.initWebFlowtab=function(){Webflow.destroy(),Webflow.ready()},_onlineCheckout.cartItemQtyDown=function(t){var i=e(t),a=i.closest(".item-quantitychange").find(".itemqtyinput"),r=a.val(),o=parseInt(a.attr("data-min"));e(t).closest(".product-div-shopping-col").attr("data-rid");if(r>=o+1){var n=parseInt(r)-1;i.closest(".item-quantitychange").find(".itemqtyinput").val(n)}r!=o&&_onlineCheckout.updateCartItem(t)},_onlineCheckout.cartItemQtyUp=function(t){var i=e(t),a=i.closest(".item-quantitychange").find(".itemqtyinput"),r=a.val(),o=parseInt(a.attr("data-max"));e(t).closest(".product-div-shopping-col").attr("data-rid");if(r<o){var n=parseInt(r)+1;i.closest(".item-quantitychange").find(".itemqtyinput").val(n)}r!=o&&_onlineCheckout.updateCartItem(t)},_onlineCheckout.VisibleControlLength=function(t){return e(t).filter(function(){return"none"!==e(this).css("display")}).length},_onlineCheckout.continueShoping=function(){try{var t=document.activeElement.id;if("undefined"!=t&&"ancCheckoutSuccess"==t&&"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&void 0!==_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&null!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&""!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking){var i=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking;i.startsWith("http://")||i.startsWith("https://")||(i="https://"+i),window.top.location.href=i}else{if(1==IsWebsiteBuilderCommunication)return e(".shopping-bag-items .cartremoverdtl").length>0?void wbc._postMessage('{"eventType": "KeepShopping"}'):void wbc._postMessage('{"eventType": "WBBusinessDetailPage"}');if(0==isCheckInApp){if("true"==IsClassReschedule.toLowerCase())return void swal({html:!0,title:"Your class reschedule detail will be lost Are you sure?",text:"",type:"",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",closeOnCancel:!0},function(e){1==e&&(IsClassReschedule="false",_onlineCheckout.continueShoping())});e("#mobile-check").is(":visible")&&e("#mobileCart").show(),e("#dvDailyDealsDetail").html(""),e("#dvDailyDealsDetail").hide(),e("#pageSection").show().addClass("pagesectionFlex"),DisplayFullView(!1),_onlineCheckout.UpdateMutipleCartItem(null,!0,!1),vgAppicationType==objApplicationType.CheckinApp?"classes"==e("#ancShoppingCartIcon").attr("data-redirectto")?_siteBuilderDetail.LoadComponentDetails("classes"):_siteBuilderDetail.LoadComponentDetails("book-now"):(e("#navbarNavDropdown li.active a").click(),null!=e("#dvCheckoutSuccessMSG").html()&&"undefined"!=e("#dvCheckoutSuccessMSG").html()&&"Successful Checkout"==e("#dvCheckoutSuccessMSG").html()&&location.pathname.includes("/shopping-bag")&&"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&isFromTextMarketing&&window.location.pathname.indexOf("/promotiontm/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0?window.history.pushState("forward",null,window.location.href.replace("/promotiontm/"+PromotionAppointmentID,"")):null!=e("#dvCheckoutSuccessMSG").html()&&"undefined"!=e("#dvCheckoutSuccessMSG").html()&&"Successful Checkout"==e("#dvCheckoutSuccessMSG").html()&&location.pathname.includes("/shopping-bag")&&"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&!isFromTextMarketing&&window.location.pathname.indexOf("/promotion/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0&&window.history.pushState("forward",null,window.location.href.replace("/promotion/"+PromotionAppointmentID,"")));try{e(".lazy,.lazy-bgimg").lazyload({effect:"fadeIn"})}catch(e){}}else null==glbMembershipData.membershipID||null!=onlineShoppingCart.Events&&0!=onlineShoppingCart.Events.length?"function"==typeof CheckInSuccessRedirection&&CheckInSuccessRedirection():("function"==typeof InsertCheckInLog&&(glbDataCheckIn.requiredMembershipStatus=2,InsertCheckInLog()),isDisplayForms=!0);_vgClassSessionSelection.PreviousClassRow=""}}catch(e){}},_onlineCheckout.ValidateMinMaxValue=function(t){var i=e(t),a=i.val();try{/\D/g.test(a)&&(a=1,i.val("1")),(a=parseInt(a))>0==0&&i.val("1")}catch(e){i.val("1")}var r=parseInt(i.attr("data-min")),o=parseInt(i.attr("data-max")),n=void 0===i.attr("data-istrack")?"True":i.attr("data-istrack"),s=parseInt(i.val());return s<r?i.val(r):"True"==n&&s>o&&i.val(o),_onlineCheckout.updateCartItem(t),!1},_onlineCheckout.OpenClassAlertPpopup=function(t){var i=null;if(null==_vgClassSessionSelection.commonProperty.MembershipPackageDetailsForClass||null==_vgClassSessionSelection.commonProperty.MembershipPackageDetailsForClass?(_shopdetail.LoadMembershipPackageData(),i=_shopdetail.MembershipPackageDetails):i=_vgClassSessionSelection.commonProperty.MembershipPackageDetailsForClass,1e3==i.CustomCode&&null!=i.Data.UserMemberShipAndPackageInformation&&null!=i.Data.MembershipOrPackageRequiredToBookResponse&&i.Data.MembershipOrPackageRequiredToBookResponse.length>0){var a=i.Data.UserMemberShipAndPackageInformation;if(a.IsMemPkgReqToBook&&!a.IsUserHasRequiredMembership&&!a.IsUserHasRequiredPackage){var r=i.Data.MembershipOrPackageRequiredToBookResponse,o=e.grep(r,function(e){return 1==e.Type}),n=e.grep(r,function(e){return 2==e.Type}),s=e.grep(o,function(e){return e.IsOnline}),l=e.grep(n,function(e){return e.IsOnline});s.length>0&&l.length>0?(e("#classAlertPpopupHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div><div class="web-body-font"> <p>You cannot book <b>'+t+"</b> without being a member or package holder. Purchase a qualifying membership or package to continue booking.</p></div>"),errorMessage="Select a membership or package to continue booking."):s.length>0?(e("#classAlertPpopupHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font"><p>You cannot book <b>'+t+"</b>  without being a member. Purchase a qualifying membership to continue booking.</p></div>"),errorMessage="Select a membership to continue booking."):l.length>0?(e("#classAlertPpopupHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div><div class="web-body-font"><p>You cannot book <b>'+t+"</b> without being a package holder. Purchase a qualifying package to continue booking.</p></div>"),errorMessage="Select a package to continue booking."):o.length>0&&n.length>0?e("#classAlertPpopupHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div> <div class="web-body-font"> <p>You cannot book <b>'+t+"</b> without being a member or package holder. Purchase a qualifying membership or package to continue booking.</div></p>"):o.length>0?e("#classAlertPpopupHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font"><p>You cannot book <b>'+t+"</b> without being a member. Purchase a qualifying membership to continue booking.</div></p>"):n.length>0&&e("#classAlertPpopupHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div> <div class="web-body-font"> <p>You cannot book <b>'+t+"</b> without being a package holder. Purchase a qualifying package to continue booking.</div></p>"),e("#classAlertPpopup").modal("show")}}},_onlineCheckout.DeleteCartItems=function(t){var i=e(t).closest(".cartremoverdtl"),a=i.attr("data-bid"),r=i.attr("data-rid"),o=i.attr("data-type"),n=i.attr("data-email"),s=i.attr("data-autoid"),l=i.attr("data-rand"),d=!1;if(void 0!==i.attr("data-isWorkShop")&&"true"==i.attr("data-isWorkShop").toLowerCase()&&(d=!0,i=e(t).closest(".service-div-checkout")),void 0!==IsWebsiteBuilderCommunication&&"inventory"==o&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||1==("undefined"!=typeof isWidget&&"inventory"==o&&null!=isWidget&&"true"==isWidget.toLowerCase())){var c={eventName:"ProductRemovedFromCart",timestamp:(new Date).getTime(),data:{productName:document.querySelectorAll(".product-name.thm-textColor.web-subheading-font.web-builder-font-color")[1].textContent.trim()}};"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(c)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(c)}1==isCheckInApp&&(UserID=glbDataCheckIn.scanUserID),ShowLoader(!0);var u={businessID:a,referenceId:r,cardItemType:o,userEmail:n,autoId:s,isCheckInApp:isCheckInApp,isWorkShop:d,randomForWorkShop:l,loginUserID:UserID},p=[],h=!1,m=!1;if(_shopdetail.IsMemPkgReqToBook){var f=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);f.forEach(function(e){e.IsMemPkgRequired&&(m=!0)}),e.each(onlineShoppingCartmain.Packages,function(e,t){null!=t&&1==t.IsFromClass&&p.push(t)}),e.each(onlineShoppingCartmain.Memberships,function(e,t){null!=t&&1==t.IsFromClass&&p.push(t)}),e.each(onlineShoppingCartmain.Memberships,function(e,t){null!=t&&t.MembershipId.toString()==r&&1==t.IsFromClass&&f.length>0&&m&&(p.length>1?p.splice(service,1):(_onlineCheckout.OpenClassAlertPpopup(""),h=!0,ShowLoader(!1)))}),e.each(onlineShoppingCartmain.Packages,function(e,t){null!=t&&t.ServiceId.toString()==r&&1==t.IsFromClass&&f.length>0&&(p.length>1?p.splice(t,1):(_onlineCheckout.OpenClassAlertPpopup(""),h=!0,ShowLoader(!1)))})}h||vagaro.ajaxCall(ApiURLEnumOnlineCheckout.removecartitem,u,function(a){if(ShowLoader(!1),"classes"==o){var c=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(c.length>0){e.each(c,function(t,i){null!=i&&i.eventID==r&&e.each(i.eventEnrollment,function(t,a){null!=a&&a.autoID==s&&i.eventEnrollment.splice(e.inArray(a,i.eventEnrollment),1)}),null!=i&&0==i.eventEnrollment.length&&c.splice(e.inArray(i,c),1)});try{c.length>0?localStorage[_vgClassSessionSelection.model.EventStorage]=JSON.stringify(c):localStorage.removeItem(_vgClassSessionSelection.model.EventStorage)}catch(e){}}d?null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0&&e.each(onlineShoppingCartmain.Events,function(t,i){if(null!=i&&i.eventID==r){var a=i.eventEnrollment;for(t=0;t<a.length;t++)a[t].randomForWorkShop==l&&a[t].cUserEmail==n&&(a.splice(t,1),t--)}null!=i&&0==i.eventEnrollment.length&&onlineShoppingCartmain.Events.splice(e.inArray(i,onlineShoppingCartmain.Events),1)}):null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0&&e.each(onlineShoppingCartmain.Events,function(t,i){null!=i&&i.eventID==r&&e.each(i.eventEnrollment,function(t,a){null!=a&&a.autoID==s&&i.eventEnrollment.splice(e.inArray(a,i.eventEnrollment),1)}),null!=i&&0==i.eventEnrollment.length&&onlineShoppingCartmain.Events.splice(e.inArray(i,onlineShoppingCartmain.Events),1)});var u=e(t).closest(".service-div-checkout");u.find(".cartremoverdtl").length<=1&&u.remove()}else if("inventory"==o)for(var p=onlineShoppingCartmain.Inventories.length-1;p>=0;p--){var m=onlineShoppingCartmain.Inventories[p];null!=m&&(m.InventoryId.toString()==r&&0==m.MasterInventoryId||m.MasterInventoryId.toString()==r)&&onlineShoppingCartmain.Inventories.splice(p,1)}else"servicepackage"==o?(e.each(_onlineCheckout.PackageSharingDetail,function(t,i){null!=i&&i.ServiceId.toString()==r&&i.autoId.toString()==s&&_onlineCheckout.PackageSharingDetail.splice(e.inArray(i,_onlineCheckout.PackageSharingDetail),1)}),e.each(onlineShoppingCartmain.Packages,function(t,i){null!=i&&i.ServiceId.toString()==r&&i.autoId.toString()==s&&onlineShoppingCartmain.Packages.splice(e.inArray(i,onlineShoppingCartmain.Packages),1)})):"gc"==o?e.each(onlineShoppingCartmain.GiftCertificates,function(t,i){null!=i&&i.GiftCertificatePhotoID.toString()==r&&i.autoId==s&&onlineShoppingCartmain.GiftCertificates.splice(e.inArray(i,onlineShoppingCartmain.GiftCertificates),1)}):"membership"==o&&(_onlineCheckout.ResetPkgMembershipVariable(1),e.each(onlineShoppingCartmain.Memberships,function(t,i){null!=i&&i.MembershipId.toString()==r&&onlineShoppingCartmain.Memberships.splice(e.inArray(i,onlineShoppingCartmain.Memberships),1)}));h||i.remove(),_onlineCheckout.IsRecurringMembership=!1,_onlineCheckout.IsRecurringPkg=!1,_onlineCheckout.IsRecurringMembershipCount=0,_onlineCheckout.IsRecurringPkgCount=0,parseInt(a)<=0&&(e(".divcartdetail").hide(),e(".divHeaderText").text("There are no items in the cart."),e(".divnoitem").attr("style",""),1==IsWebsiteBuilderCommunication&&(e(".btnContShopping").attr("href","javascript:void(0);"),e(".btnContShopping").attr("onclick","_onlineCheckout.continueShoping();"))),_onlineCheckout.checkIfProductExists(),_onlineCheckout.GetCartItemCount(a),_onlineCheckout.calculateSubTotalForFirstStep(),_onlineCheckout.IsClassBookingOnly(!1),_onlineCheckout.errorMessage()},function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},!1,!0),e("#divHeaderBusinessName").focus()},_onlineCheckout.DeleteWorkShopCartItems=function(e){swal({title:"",text:"Are you sure you want to delete whole workshop?",showCancelButton:!0,customClass:"text-left",html:!0},function(t){t&&_onlineCheckout.DeleteCartItems(e)})},_onlineCheckout.onlyUnique=function(e,t,i){return i.indexOf(e)===t},_onlineCheckout.updateCartItem=function(t){var i=e(t).closest(".product-div-shopping-col"),a=(i.attr("data-bid"),i.attr("data-rid")),r=i.attr("data-type"),o=i.find("#txtItemsQuantity").val();try{/\D/g.test(o)&&(i.find("#txtItemsQuantity").val("1"),o=1),(o=parseInt(o))>0==0&&(i.find("#txtItemsQuantity").val("1"),o=1)}catch(e){i.find("#txtItemsQuantity").val("1"),o=1}_onlineCheckout.isUpdateItemQty=!0,"inventory"==r?(e.each(onlineShoppingCartmain.Inventories,function(){if(this.MasterInventoryId.toString()==a.toString()){var t=e.grep(onlineShoppingCartmain.Inventories,function(e){return e.InventoryId==a});String.isNullOrUndefineOrBlank(t)||(this.Quantity=this.Quantity/t[0].Quantity*o,this.Price=this.Price/t[0].Quantity*o,this.bundleQuantity=t[0].Quantity,this.calculatedTax=parseFloat(this.Price*this.Tax/100),this.BusinessTax=_onlineCheckout.ApplyMultipleTax(this.Price,this),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+a+'"]').find(".div-block-59 .product-name").html(currencysymbol+_onlineCheckout.decimalFormate(this.Price)))}}),e.each(onlineShoppingCartmain.Inventories,function(){this.InventoryId.toString()==a.toString()&&0==this.MasterInventoryId&&(this.Quantity=o,this.Price=o*this.SellingPrice,this.calculatedTax=parseFloat(this.Price*this.Tax/100),this.BusinessTax=_onlineCheckout.ApplyMultipleTax(this.Price,this),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+a+'"]').find(".div-block-59 .product-name").html(currencysymbol+_onlineCheckout.decimalFormate(this.Price)))})):"servicepackage"==r&&e.each(onlineShoppingCartmain.Packages,function(){if(this.ServiceId.toString()==a.toString()){if(this.NoOfVisit=o,1==this.eventType){var t=this.Price;this.PromotionID>0&&(t=_onlineCheckout.calculatePromotionAmt(this.PromotionID,this.IsAmount,this.AmountValue,this.Price,1)),this.TotalPrice=t*this.NoOfVisit,this.calculatedTax=parseFloat(this.TotalPrice*this.Tax/100),this.BusinessTax=_onlineCheckout.ApplyMultipleTax(this.TotalPrice,this)}else 2==this.eventType?(this.TotalPrice=_onlineCheckout.GetClassSessionWisePrice(this.sessionDetail,this.NoOfVisit,1),this.calculatedTax=parseFloat(this.TotalPrice*this.Tax/100),this.BusinessTax=_onlineCheckout.ApplyMultipleTax(this.TotalPrice,this)):4==this.eventType&&(this.TotalPrice=_onlineCheckout.decimalFormate(e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+a+'"]').find(".div-block-59 .product-name")[0].innerHTML.substr(1)),this.calculatedTax=parseFloat(this.TotalPrice*this.Tax/100),this.BusinessTax=_onlineCheckout.ApplyMultipleTax(this.TotalPrice,this));var i=0,r=0;if(null!=this.lstAddonService&&this.lstAddonService.length>0)for(var n=0;n<this.lstAddonService.length;n++)i=this.lstAddonService[n].Originalprice*this.NoOfVisit,r=_onlineCheckout.parseTodecimal(r,2)+_onlineCheckout.parseTodecimal(i,2),e("#addprice_"+this.ServiceId+"_"+n).html(currencysymbol+_onlineCheckout.decimalFormate(i)),this.lstAddonService[n].Price=_onlineCheckout.decimalFormate(i);this.TotalAddonServicePrice=r,e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+a+'"]').find(".div-block-59 .product-name").html(currencysymbol+_onlineCheckout.decimalFormate(this.TotalPrice))}}),setTimeout(function(){_onlineCheckout.calculateSubTotalForFirstStep()},5)},_onlineCheckout.MapFormsWithUserId=function(t,i){i.keySort({UserId:"asc"}),e.each(t,function(t,a){var r={};e.each(i,function(t,i){if(e.inArray(i.ServiceId,a.ServiceIds)>-1&&(a.FormId!=r.FormId||i.UserId!=r.UserId)){var o={};o.UserId=i.UserId,o.FullName=i.FirstName+" "+i.LastName,o.EmailId=i.EmailId,o.FormUrl=a.FormUrl,o.ServiceId=i.ServiceId,o.FormId=a.FormId,_onlineCheckout.formsResponse.push(o),r=o}})}),e.each(_onlineCheckout.formsResponse,function(e,t){var i=!1;_onlineCheckout.formsResponse.length>e+1&&t.FormId==_onlineCheckout.formsResponse[e+1].FormId&&(i=!0),t.flagDup=i})},_onlineCheckout.GetFormsByIds=function(){_onlineCheckout.formsResponse=[],_onlineCheckout.currentresponse=[];var t="",i=onlineShoppingCartmain.UsersPoints,a=onlineShoppingCartmain.Events,r="",o="",n=onlineShoppingCartmain.Memberships,s="";e.each(i,function(e,i){0!=i.userId&&(t+=i.userId+",")}),""==(t=t.slice(0,-1))&&_onlineCheckout.isValidForCheckoutInvoice()&&"True"==e("#hdnIsFormsEnable").val()&&null!=onlineShoppingCartmain.invoiceDetails&&null!=onlineShoppingCartmain.invoiceDetails.InvoiceGridObject&&(t=onlineShoppingCartmain.invoiceDetails.InvoiceGridObject.PayeeId),void 0!==a&&null!=a&&a.length>0&&(e.each(a,function(t,i){r+=i.eventID+",",!String.isNullOrUndefineOrBlank(i.eventEnrollment)&&i.eventEnrollment.length>0&&e.grep(i.eventEnrollment,function(t){!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){r+=e.ServiceId+","})})}),r=r.slice(0,-1)),null!=onlineShoppingCartmain.Memberships&&onlineShoppingCartmain.Memberships.length>0&&(e.each(n,function(e,t){s+=t.MembershipId+","}),s=s.slice(0,-1)),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&(e.each(onlineShoppingCart.ServiceInvoice,function(e,t){r+=t.serviceid+",",o+=t.AppConfirmUniqueID+","}),r=r.slice(0,-1),o=o.slice(0,-1));var l={serviceIds:r,membershipIds:s,UserIds:void 0!==isCheckInApp&&1==isCheckInApp&&""==t?UserID:t,businessID:businessID,loginUserID:UserID,strAppConfirmUniqueIds:o,callFrom:void 0!==isCheckInApp&&1==isCheckInApp?3:1};ShowLoader(!0),0==t&&0==UserID&&window.location.reload();var d=new vagaro.ajax;d.datamodel.Token=ApiURLEnumOnlineCheckout.getformsbyids,d.datamodel.IsNewVagaroAPI=!0,d.datamodel.callback=function(t){if(ShowLoader(!1),null!=t){_onlineCheckout.currentresponse=t,_onlineCheckout.updateAppIdforms=[],_onlineCheckout.formResponseIds=[];var o=[];if(e.each(a,function(a,n){r+=n.eventID+",",e.each(n.eventEnrollment,function(a,r){e.each(i,function(t,i){if(i.emailId==r.cUserEmail||i.userId==r.customerID){var a={};a.FirstName=r.cFirstName,a.LastName=r.cLastName,a.ServiceId=n.eventID,a.UserId=i.userId,a.EmailId=i.emailId,a.Cell=r.cUserCellNo,a.CellCountryID=r.cCellcountryID,a.DialingCode=r.cDialingCode,o.push(a),!String.isNullOrUndefineOrBlank(r.lstAddonService)&&r.lstAddonService.length>0&&e.grep(r.lstAddonService,function(e){var t={};t.FirstName=r.cFirstName,t.LastName=r.cLastName,t.ServiceId=e.ServiceId,t.UserId=i.userId,t.EmailId=i.emailId,t.Cell=r.cUserCellNo,t.CellCountryID=r.cCellcountryID,t.DialingCode=r.cDialingCode,o.push(t)})}}),e.grep(t,function(t){null!=t&&(String.isNullOrUndefineOrBlank(t.ServiceIds)||e.grep(t.ServiceIds,function(e){if(0==String.isNullOrUndefineOrBlank(e)&&r.eventID==e){var i={AppConfirmUniqueID:null,ServiceID:e,FormID:t.FormId,AppointmentId:r.appointmentID,IsReqAlways:t.IsReqAlways};_onlineCheckout.updateAppIdforms.push(i)}}))})})}),""!=r){var s=e.grep(o,function(e){return 0==e.UserId});if(s.length>0){var l=new vagaro.ajax;l.datamodel.Token=ApiURLEnumOnlineCheckout.insertusersatformload,l.datamodel.IsNewVagaroAPI=!0,l.datamodel.callback=function(i){var a=e.grep(o,function(e){return 0!=e.UserId});e.each(a,function(e,t){i.push(t)}),_onlineCheckout.MapFormsWithUserIds(t,i,n)},l.datamodel.data={objUsers:s,LoggedInUserId:UserID},l.datamodel.Error=function(e){ShowLoader(!1)},l.Post()}else _onlineCheckout.MapFormsWithUserIds(t,o,n)}else e.each(i,function(e,t){var i={};i.UserId=t.userId,i.EmailId=t.emailId,o.push(i)}),_onlineCheckout.MapFormsWithUserIds(t,o,n)}else 1==_onlineCheckout.isFormsDirectClass&&_onlineCheckout.DirectClassCheckout(),_onlineCheckout.IsShowForms(!1)},d.datamodel.data=l,d.datamodel.Error=function(e){ShowLoader(!1)},d.Post()},_onlineCheckout.GetFormsByIdsForMS=function(t,i){_onlineCheckout.currentresponse=[];var a=i;if(t&&a){var r={serviceIds:"",membershipIds:t,UserIds:void 0!==isCheckInApp&&1==isCheckInApp&&""==a?UserID:a,businessID:businessID,loginUserID:UserID,strAppConfirmUniqueIds:"",callFrom:void 0!==isCheckInApp&&1==isCheckInApp?3:1};ShowLoader(!0);var o=new vagaro.ajax;o.datamodel.Token=ApiURLEnumOnlineCheckout.getformsbyids,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.callback=function(r){if(ShowLoader(!1),r&&r.length>0){if(1==_onlineCheckout.FormCallSource){var o=Number(t);r=r.filter(function(e){return!(!e.MembershipIds||0===e.MembershipIds.length)&&e.MembershipIds.includes(o)}),_onlineCheckout.FormCallSource=!1}_onlineCheckout.currentresponse=r;var n=[];e.each(a.toString().split(","),function(e,t){n.push({UserId:parseInt(t,10)})});var s=[];e.each(t.toString().split(","),function(e,t){s.push({MembershipId:Number(t),userID:Number(i)})}),_onlineCheckout.MapFormsWithUserIds(r,n,s)}else _onlineCheckout.IsShowForms(!1)},o.datamodel.Error=function(){ShowLoader(!1)},o.datamodel.data=r,o.Post()}else _onlineCheckout.IsShowForms(!1)},_onlineCheckout.MapFormsWithUserIds=function(t,i,a){i.keySort({UserId:"asc"}),e.each(t,function(t,a){var r={};e.each(i,function(t,i){if(e.inArray(i.ServiceId,a.ServiceIds)>-1&&(a.FormId!=r.FormId||i.UserId!=r.UserId)){var o={};o.UserId=i.UserId,o.FullName=i.FirstName+" "+i.LastName,o.EmailId=i.EmailId,o.FormUrl=a.FormUrl,o.ServiceId=i.ServiceId,o.FormId=a.FormId,_onlineCheckout.formsResponse.push(o),r=o}})}),e.each(t,function(t,r){var o={};e.each(a,function(t,a){e.inArray(a.MembershipId,r.MembershipIds)>-1&&(r.FormId==o.FormId&&a.userID==o.UserId||e.each(i,function(e,t){if(t.UserId==a.userID){var i={};i.UserId=t.UserId,i.FullName=FullUserName,i.EmailId=t.emailId,i.FormUrl=r.FormUrl,i.MembershipId=a.MembershipId,i.FormId=r.FormId,_onlineCheckout.formsResponse.push(i),o=i}}))})}),e.each(t,function(t,a){var r={};e.each(i,function(e,t){if(a.IsReqForAllClients&&(a.FormId!=r.FormId||t.UserId!=r.UserId)){var i={};i.UserId=t.UserId,i.FullName=null!=FullUserName?FullUserName:t.FirstName+" "+t.LastName,i.EmailId=t.EmailId,i.FormUrl=a.FormUrl,i.FormId=a.FormId,_onlineCheckout.formsResponse.push(i),r=i}})}),e.each(t,function(e,t){var i=_onlineCheckout.formsResponse.filter(function(e){return e.FormId===t.FormId});if(!i.length>0){var a={};a.UserId=parseInt(UserID),a.FullName=FullUserName,a.EmailId=UserEmail,a.FormUrl=t.FormUrl,a.FormId=t.FormId,_onlineCheckout.formsResponse.push(a)}}),e.each(_onlineCheckout.formsResponse,function(e,t){var i=!1;_onlineCheckout.formsResponse.length>e+1&&t.FormId==_onlineCheckout.formsResponse[e+1].FormId&&(i=!0),t.flagDup=i}),_onlineCheckout.IsShowForms(!0),_onlineCheckout.DisplayFormsInIframe(),"function"==typeof ShowLoader&&ShowLoader(!1)},_onlineCheckout.DisplayFormsInIframe=function(t,i){var a="",r="undefined"!=typeof AllowCustomField&&null!==AllowCustomField&&""!==AllowCustomField.trim()&&"true"===AllowCustomField.toLowerCase();if(0==isCheckInApp&&(a=_shopdetail.activeTabName),0==isCheckInApp&&"book-now"==a&&void 0!==i&&null!=i&&""!=i)"true"==i.IsNewCard&&(isCCChanged=!0,ZenSwipeCardDetails=i);else if(0==isCheckInApp&&"book-now"!=a&&void 0!==i&&null!=i&&""!=i&&"true"==i.IsNewCard){var o={BusinessID:businessID,CCFirstName:i.first_name,CCLastName:i.last_name,CCMiddleName:i.middle_name,CardTokenId:i.card_token,CreditCardNumber:i.cc_no,CreditCardType:i.cc_type,ExpMonth:"",ExpYear:"",FullName:i.first_name+" "+i.last_name,SecurityCode:i.cvv,index:0,isselfcard:!0};_onlineCheckout.ccCardOnFile=o,_onlineCheckout.zenSwipeCardDetails=o,_onlineCheckout.isFillCCDetailsForms="1",_onlineCheckout.BindCCDetailForBooking(o,null,null)}_onlineCheckout.formsResponse.length>0?(1==_onlineCheckout.formsResponse.length?"book-now"==a?e("#btnFormsSubmit").text("Next"):1==_onlineCheckout.isFormsDirectClass?e("#btnFormsSubmitDirectClass").text("Next"):1==_onlineCheckout.IsFromCheckInLoginPage?e("#btnFormsSubmitCheckInApp").text("Submit"):e("#btnFormsSubmitCheckOut").text("Next"):"book-now"==a?e("#btnFormsSubmit").text("Next"):1==_onlineCheckout.isFormsDirectClass?e("#btnFormsSubmitDirectClass").text("Next"):1==_onlineCheckout.IsFromCheckInLoginPage?e("#btnFormsSubmitCheckInApp").text("Next"):e("#btnFormsSubmitCheckOut").text("Next"),null!=vuiForms.frame&&vuiForms.frame.destroy(),"book-now"==a&&void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0?("OnBoarding"==getQueryStringData("Type")&&e("#Onboard-BookNow-back").hide(),r?DisplayFormsIFrameForAppNew(_onlineCheckout.formsResponse[0]):DisplayFormsIFrameForApp(_onlineCheckout.formsResponse[0])):1==_onlineCheckout.isFormsDirectClass&&void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0?r?DisplayFormsIFrameDirectClassNew(_onlineCheckout.formsResponse[0]):DisplayFormsIFrameDirectClass(_onlineCheckout.formsResponse[0]):1==_onlineCheckout.IsFromCheckInLoginPage&&void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0?DisplayFormsIFrameCheckInApp(_onlineCheckout.formsResponse[0]):void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0&&(r?DisplayFormsIFrameNew(_onlineCheckout.formsResponse[0]):DisplayFormsIFrame(_onlineCheckout.formsResponse[0]))):(_onlineCheckout.currentresponse=[],1==_onlineCheckout.isFormsDirectClass?_onlineCheckout.DirectClassCheckout():1==_onlineCheckout.isFormsbookwithcc?_shopdetail.ValidateBookingDataWithCC():1==_onlineCheckout.isFormsbookwithoutcc?_shopdetail.ValidateBookingDataWithoutCC():"book-now"!=a&&(1==_onlineCheckout.IsClickFromCheckInButton?(e("#divCheckInAppDetails").show(),e("#divFormsCheckInApp").hide(),checkInAppointmentProcess()):1==_onlineCheckout.IsFromCheckInLoginPage?(e("#divCheckInAppDetails").show(),e("#divFormsCheckInApp").hide()):_onlineCheckout.checkoutGotoNextStep(!1)),_onlineCheckout.IsShowForms(!1))},_onlineCheckout.IsShowForms=function(t){var i="";0==isCheckInApp&&(i=_shopdetail.activeTabName),t?"book-now"==i?(e("#divForms").show(),e("#divCheckoutScreen").hide()):1==_onlineCheckout.isFormsDirectClass?(e("#divFormsDirectClass").show(),e("#shoppingcartfirst").hide()):(_onlineCheckout.isValidForCheckoutInvoice()&&"True"==e("#hdnIsFormsEnable").val()&&e("#btnBuyNowBackCheckOut").hide(),e("#divFormsCheckOut").show(),e("#divFormsCheckoutScreen").hide()):"book-now"==i?(1==_onlineCheckout.isFormsbookwithcc||1==_onlineCheckout.isFormsbookwithoutcc?(setTimeout(function(){ShowLoader(!0)},100),e("#dvOnlineBooking").hide()):(e("#divCheckoutScreen").show(),e(window).scrollTop(0)),e("#divForms").hide()):1==_onlineCheckout.isFormsDirectClass?e("#divFormsDirectClass").hide():(e("#divFormsCheckOut").hide(),e("#divFormsCheckoutScreen").show())},_onlineCheckout.FormsClick=function(){if(void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0){var t=_onlineCheckout.formsResponse[0],i=0;void 0!==t.UserId&&null!=t.UserId&&(i=parseInt(t.UserId));var a="";void 0!==t.FullName&&null!=t.FullName&&(a=t.FullName),1==_onlineCheckout.IsFromCheckInLoginPage&&(i=UserID,a=FullUserName);void 0!==t.ServiceId&&null!=t.ServiceId&&t.ServiceId;var r=e.grep(_onlineCheckout.currentresponse,function(e){return e.FormId==t.FormId}),o="";r.length>0&&void 0!==r[0].ServiceIds&&null!=r[0].ServiceIds&&(o=r[0].ServiceIds.toString()),_onlineCheckout.isValidForCheckoutInvoice()&&"True"==e("#hdnIsFormsEnable").val()&&i<=0&&null!=onlineShoppingCartmain.invoiceDetails&&null!=onlineShoppingCartmain.invoiceDetails.InvoiceGridObject&&(a=onlineShoppingCartmain.invoiceDetails.FirstName+" "+onlineShoppingCartmain.invoiceDetails.LastName,i=onlineShoppingCartmain.invoiceDetails.InvoiceGridObject.PayeeId);var n=!1;r.length>0&&void 0!==r[0].IsReqAlways&&null!=r[0].IsReqAlways&&(n=r[0].IsReqAlways);var s="";if(n&&(o=""),"undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&(!String.isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&e.each(onlineShoppingCart.ServiceInvoice,function(e,t){""!=s&&(s+=","),s+=t.AppConfirmUniqueID+"#"+t.serviceid}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(e){""!=s&&(s+=","),s+=String.isNullOrUndefineOrBlank(e.AppConfirmUniqueID)?"#"+e.eventID:e.AppConfirmUniqueID+"#"+e.eventID})})),"undefined"!=typeof glbMyAppDataAllData&&null!=glbMyAppDataAllData&&1==_onlineCheckout.IsFromCheckInLoginPage){var l="undefined"!=typeof localAppID&&""!=localAppID?localAppID:localClassAppID;e.each(glbMyAppDataAllData,function(e,t){t.AppointmentID==l&&(""!=s&&(s+=","),s+=t.AppConfirmUniqueID+"#"+t.ServiceID)})}try{if("Submit"==e("#btnFormsSubmitCheckOut").text())(d={}).Action=_vgLogEvent.model.buttonText+" - Fill Form",d.Category="Live Stream",d.PageName="Live Stream",null!=e("#businessname")&&null!=e("#businessname").text()&&(d.BusinessName=e("#businessname").text()),d.TypeofService="Live Stream",null!=e("#livestream")&&null!=e("#livestream").text()&&e("#livestream").text().includes("Live")&&(d.isLiveStream=!0,d.isInHouse=!1),d.IsFormfilled=!0,_vgLogEvent.LogData(d)}catch(e){}var d={LoginUserID:UserID,UserName:FullUserName,BusinessID:businessID,ResBy:i,ResByName:a,ServiceId:o,CallFrom:"1",ApptServiceIds:s,IsOnlineForm:"True"};vuiForms.frame.forms.sendLoginUseDetails(d),vuiForms.frame.forms.submitForm()}},_onlineCheckout.AddEventLogInFirebaseForForms=function(){try{if("Submit"==e("#btnFormsSubmitCheckOut").text()){var t={Category:"Live Stream"};t.Action=_vgLogEvent.model.buttonText+" - Fill Form",t.PageName="Live Stream",t.BusinessID=businessID,null!=e("#businessname")&&null!=e("#businessname").text()&&(t.BusinessName=e("#businessname").text()),t.IsFormfilled=!0,t.TypeofService="Live Stream",null!=e("#livestream")&&null!=e("#livestream").text()&&e("#livestream").text().includes("Live")&&(t.isLiveStream=!0,t.isInHouse=!1),_vgLogEvent.LogEventData(t)}}catch(e){}},_onlineCheckout.SendDetailsToForms=function(){if(void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0){var t=_onlineCheckout.formsResponse[0],i=0;void 0!==t.UserId&&null!=t.UserId&&(i=parseInt(t.UserId));var a="";void 0!==t.FullName&&null!=t.FullName&&(a=t.FullName),1==_onlineCheckout.IsFromCheckInLoginPage&&(i=UserID,a=FullUserName);void 0!==t.ServiceId&&null!=t.ServiceId&&t.ServiceId;var r=e.grep(_onlineCheckout.currentresponse,function(e){return e.FormId==t.FormId}),o="";r.length>0&&void 0!==r[0].ServiceIds&&null!=r[0].ServiceIds&&(o=r[0].ServiceIds.toString()),_onlineCheckout.isValidForCheckoutInvoice()&&"True"==e("#hdnIsFormsEnable").val()&&i<=0&&null!=onlineShoppingCartmain.invoiceDetails&&null!=onlineShoppingCartmain.invoiceDetails.InvoiceGridObject&&(a=onlineShoppingCartmain.invoiceDetails.FirstName+" "+onlineShoppingCartmain.invoiceDetails.LastName,i=onlineShoppingCartmain.invoiceDetails.InvoiceGridObject.PayeeId);var n={LoginUserID:UserID,UserName:FullUserName,BusinessID:businessID,ResBy:i,ResByName:a,ServiceId:o,CallFrom:"1",isLoadCCIframe:"true",IsOnlineForm:"True"};vuiForms.frame.forms.sendLoginUseDetails(n)}},_onlineCheckout.FormsClickForAll=function(){var t=e.grep(_onlineCheckout.formsResponse,function(e){return e.FormId==_onlineCheckout.formId});vuiForms.frame.forms.submitAllForm(t)},_onlineCheckout.FormsClickFromBookNow=function(){var t=ISAndroidOrIOSDevicesAndBrowser();(t||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&e("#btnFormsSubmit").attr("disabled",!0);var i,a=e(".familycktfrnd ul li.selected").data("value"),r=e(".familycktfrnd ul li.selected .avtar-name").html().replace(" (Me)","");if(void 0!==_onlineCheckout.formsResponse&&_onlineCheckout.formsResponse.length>0){var o=_onlineCheckout.formsResponse[0],n="",s=hdnCommandArgArray.serviceid;String.isNullOrUndefineOrBlank(hdnCommandArgArray.addonServiceIds)||(s+=","+hdnCommandArgArray.addonServiceIds),o.IsReqAlways&&(e.grep(s.split(","),function(t){String.isNullOrUndefineOrBlank(o.ServiceIds)||e.grep(o.ServiceIds,function(e){0==String.isNullOrUndefineOrBlank(e)&&t==e&&(n+=e+",")})}),n=n.replace(/,\s*$/,""))}i=void 0!==a&&UserID!=a?{LoginUserID:a,UserName:r,BusinessID:businessID,CallFrom:"1",ServiceId:n,IsOnlineForm:"True"}:{LoginUserID:UserID,UserName:FullUserName,BusinessID:businessID,CallFrom:"1",ServiceId:n,IsOnlineForm:"True"},vuiForms.frame.forms.sendLoginUseDetails(i),vuiForms.frame.forms.submitForm(),_onlineCheckout.FormResponseSubmitted(),(t||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&setTimeout(function(){e("#btnFormsSubmit").attr("disabled",!1)},1e3)},_onlineCheckout.FormResponseSubmitted=function(){try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){var e=(new Date).getTime(),t=_onlineCheckout.formsResponse[0].FormId||"";vuiForms.frame.forms.FormTitle();var i={eventName:"FormResponseSubmitted",timestamp:e,data:{formId:t,formName:_onlineCheckout.FormTitle||""}};UserID&&parseInt(UserID)>0&&(i.data.customerId="undefined"!=typeof staticEncryptUserID&&null!==staticEncryptUserID?staticEncryptUserID:""),"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(i)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(i),_onlineCheckout.isFormResponseSubmittedCalled=!0,setTimeout(function(){_shopdetail.startCreditCardCaptureInterval()},1e3)}}catch(e){}},_onlineCheckout.formsCallBackSuccess=function(e,t,i){1==e?_onlineCheckout.formsResponse.shift():_onlineCheckout.RemoveProcessedForms(),_onlineCheckout.DisplayFormsInIframe(t,i)},_onlineCheckout.fromsCallBackFailed=function(){vagaro.alert("Some error occured. Please try again.")},onsubmitFormResponseCallback=function(e){void 0!==e.message&&null!=e.message&&""!=e.message?(null!=_onlineCheckout.FormsResponseID?_onlineCheckout.FormsResponseID+=","+e.message:_onlineCheckout.FormsResponseID=e.message,"undefined"!=typeof _onlineCheckout&&void 0!==_onlineCheckout.formResponseIds&&_onlineCheckout.formResponseIds.push(e.message),_onlineCheckout.formsCallBackSuccess(e.isSingleSave,e.isCCCaptureInForms,e.zenSwipeCardDetailsFormForms)):_onlineCheckout.fromsCallBackFailed(),ShowLoader(!1)},_onlineCheckout.RemoveProcessedForms=function(){_onlineCheckout.formsResponse=e.grep(_onlineCheckout.formsResponse,function(e){return e.FormId!=_onlineCheckout.formId})},_onlineCheckout.UpdateMutipleCartItem=function(t,i,a){if(void 0===IsWebsiteBuilderCommunication||1!=IsWebsiteBuilderCommunication||1!=i){_onlineCheckout.IsValidatedOnePerUser=!1;var r=!(!String.isNullOrUndefineOrBlank(getCookie("loginTypeValue"))&&8==getCookie("loginTypeValue"))&&a;if(_onlineCheckout.isConsiderForms=r,_onlineCheckout.IsFromCheckInLoginPage=!1,1!=i&&(_onlineCheckout.ValidateErrorMessage(onlineShoppingCartmain),0==onlineShoppingCartmain.IsValidCartData))return!1;if(e("#hdnIsFromPage").length>0&&e("#hdnIsFromPage").val(""),1==_onlineCheckout.isUpdateItemQty||1==_onlineCheckout.isUpdateAddonsItemQty){ShowLoader(!0);var o=new vagaro.ajax,n={};n.businessID=businessID,n.inventories=onlineShoppingCartmain.Inventories,n.packages=onlineShoppingCartmain.Packages,o.datamodel.Token=ApiURLEnumOnlineCheckout.updatemutiplecartitem,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.callback=function(e){if(ShowLoader(!1),e.IsSuccess?_onlineCheckout.GetCartItemCount(e.ItemCount):e.IsSuccess||-1!=e.ItemCount||window.location.reload(),_onlineCheckout.isUpdateItemQty=!1,1==_onlineCheckout.isUpdateAddonsItemQty)return _onlineCheckout.isUpdateAddonsItemQty=!1,void _onlineCheckout.LoadShoppingCartExternal();1!=i&&_onlineCheckout.getUserGCDetail()},o.datamodel.data=n,o.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},o.Post()}else 1!=i&&_onlineCheckout.getUserGCDetail()}else _onlineCheckout.continueShoping()},_onlineCheckout.MembershipAddToCart=function(t,i){var a=0,r="",o="",n=!1,s=0,l=!1,d=0,c=0;if(0==isCheckInApp){if(UserID<=0)return objMembershipAddToCart=t,showCommonLoginPopup("MembershipAddToCart"),!1;var u=(h=e(t).closest("div.div-block-18")).attr("data-id"),p=h.attr("data-IsOverride");"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(c=h.data("price")),r=h.attr("data-promotionDetail"),o=h.attr("data-promotiontitle"),void 0===r||""==o?(n=h.attr("data-isinitialdiscount"),s=h.attr("data-initialdiscount"),l=h.attr("data-isamount"),d=h.attr("data-billingcycle")):d=h.attr("data-billingcycle")}else{a=glbDataCheckIn.scanUserID,businessID=glbDataCheckIn.businessID;var h=t.closestObj;u=t.membershipID,p=t.IsOverride;r=t.promotiondetail,o=t.promotiontitle,d=t.billingCycle,void 0!==r&&""==o&&(n=t.isInitialDiscount,s=t.initialDiscount,l=t.isAmount)}String.isNullOrUndefineOrBlank(p)&&(p=!1);var m="NoRedirect";if("undefined"!=typeof businessID&&1!=i||"undefined"!=e("#hdnBusinessId").val()&&(businessID=e("#hdnBusinessId").val(),m="Redirect",cookieManager.setCookie("Referral","DailyDealToCart",.0833,cookieManager.defaultPath,cookieManager.defaultDomain,!0,!1)),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&!String.isNullOrUndefineOrBlank(c)){var f=c.split("/");c=f[0]}ShowLoader(!0),Data={},Data.businessID=businessID,t.ItemId>0?(Data.membershipID=t.ItemId,Data.IsOverride=!1,Data.checkInUserID=a,Data.ischeckinApp=isCheckInApp,Data.promotiondetail=t.PromotionDetail,Data.promotiontitle=t.PromotionTitle,Data.IsInitialDiscount=t.IsInitialDiscount,Data.InitialDiscount=t.InitialDiscount,Data.BillingCycle=t.BillingCycle,Data.IsAmount=t.IsAmount,Data.IsFromClass=!0):(Data.membershipID=u,Data.IsOverride=p,Data.checkInUserID=a,Data.ischeckinApp=isCheckInApp,Data.promotiondetail=r,Data.promotiontitle=o,Data.IsInitialDiscount=n,Data.InitialDiscount=s,Data.IsAmount=l,Data.BillingCycle=d,Data.IsFromClass=!1);var g=new vagaro.ajax;g.datamodel.Token="websiteapi/homepage/membershipaddtocart",g.datamodel.IsNewVagaroAPI=!0,g.datamodel.async=!1,g.datamodel.callback=function(i){h.attr("data-isoverride","false"),ShowLoader(!1);var a="Membership has been added successfully to cart.";if(0==i.IsSuccess)return a=i.Message,0==i.MessageId?(swal({html:!0,title:a,text:"",type:"",showCancelButton:!0,showConfirmButton:!1,customClass:"Membership-alert-modal",confirmButtonText:"",cancelButtonText:"Close",closeOnCancel:!0},function(a){0==isCheckInApp?a&&(h.attr("data-isoverride","true"),e(t).click(),i.IsSuccess&&_onlineCheckout.GetCartItemCount(i.ItemCount,h,c)):a?(glbMembershipData.closestObj.attr("data-isoverride","true"),glbMembershipData.IsOverride=!0,RedirectAddToCartMembership(glbMembershipData.membershipID,!0),e("#licartIcon a").attr("data-isbypass","true"),e("#licartIcon a").click()):2==glbDataCheckIn.membershipStatus&&(ShowLoader(!0),-1!==i.Message.indexOf("modify")?InsertCheckInLog():(e("#licartIcon a").attr("data-isbypass","true"),e("#licartIcon a").click()))}),void setTimeout(function(){e(".gencutom-title").html("Membership is Already Active")},100)):(swal({title:a,type:"",showConfirmButton:!1,showCancelButton:!0,cancelButtonText:"OK",html:!0},function(e){e&&swal.close()}),void setTimeout(function(){e(".gencutom-title").html("You Already Have a Membership")},100));i.IsSuccess&&(0==isCheckInApp?"Redirect"==m?(ManageAddtoCart(t),_onlineCheckout.GetCartItemCount(i.ItemCount,null,c)):(_shopdetail.IsMemPkgReqToBook,_onlineCheckout.GetCartItemCount(i.ItemCount,h,c)):(e("#licartIcon a").attr("data-isbypass","true"),e("#licartIcon a").click()),void 0!==bkEvent.SelectedPackages&&null!=bkEvent.SelectedPackages&&bkEvent.SelectedPackages.length>0&&(_onlineCheckout.CustomPackageAddToCart(bkEvent.SelectedPackages),IsPkgAdded=!0),bkEvent.SelectedMembership=null),e(t).attr("aria-label","Membership has been added successfully to cart.").focus(),setTimeout(function(){e(t).removeAttr("aria-label")},600)},g.datamodel.data=Data,g.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},g.Post()},_onlineCheckout.escape=function(e){return e.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\/]/g,"\\/").replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t")},_onlineCheckout.GiftCertificateAddToCart=function(t){var i="",a=e("#tab_service").hasClass("w--current");if("Send Now"==e("#txtScheduleDate").val()?(e("#txtReciverPhoneNo").prop("required",!1),e("#txtGCEmail").prop("required",!1)):(e("#txtReciverPhoneNo").prop("required",!0),e("#txtGCEmail").prop("required",!0)),!String.isNullOrUndefineOrBlank(e("#txtGCEmail").val())&&String.isNullOrUndefineOrBlank(e("#txtfullname").val())?e("#txtfullname").prop("required",!0):e("#txtfullname").prop("required",!1),String.isNullOrUndefineOrBlank(e("#txtfullname").val())||e("#txtGCEmail").prop("required",!0),e("#div_gcContainer").valid()){if(a){if(""==e("#txtSalonServicesForGC").val())return e(".txtSalonServicesForGCerrortext").show(),e("#txtSalonServicesForGC").addClass("errorInput"),!1;e(".txtSalonServicesForGCerrortext").hide(),e("#txtSalonServicesForGC").removeClass("errorInput")}if(UserID<=0)return objGiftCertificateAddToCart=t,showCommonLoginPopup("GiftCertificateAddToCart"),!1;var r=e(t).closest("#div_gcContainer"),o=0,n="",s="",l=r.find("#paytype .w--current").attr("data-val");if("service"!=l)if(void 0!==e(r.find("#txtGCPromoAmount")).data("selecteddetail")&&""!=e(r.find("#txtGCPromoAmount")).data("selecteddetail")&&e("#txtGCPromoAmount").is(":visible")){var d=JSON.parse(e(r.find("#txtGCPromoAmount")).data("selecteddetail"));o=d.Price,n=d.promotionDetail,s=d.PromotionTitle}else if(r.find("#txtAmount").val()>0&&e("#txtAmount").is(":visible"))o=r.find("#txtAmount").val();else{if(!(r.find("#txtGCPromoAmount").val()>0&&e("#txtGCPromoAmount").is(":visible")))return e(".txtAmounterrortext").show(),e("#txtAmount").addClass("errorInput"),!1;o=r.find("#txtGCPromoAmount").val()}var c={};c.GiftCertificatePhotoID=r.find("#gcpreview").attr("data-photoid"),c.FullName=r.find("#txtfullname").val(),c.Email=r.find("#txtGCEmail").val(),c.Type=l,c.Price="service"==c.Type?e("#hdnServicePriceForGC").val():o,""!=e("#txtSalonServicesForGC").val()&&"service"==c.Type?c.ServiceId=JSON.parse(e("#txtSalonServicesForGC").data("choice")).id:c.ServiceId=0,c.NoOfVisit="service"==c.Type?r.find("#txtMaxQuantity").val():1,c.Message=_onlineCheckout.escape(r.find("#txtmessage").val()),c.TotalPrice=parseFloat(c.Price)*parseInt(c.NoOfVisit),c.businessID=businessID,c.promotiondetail=n,c.promotiontitle=s,c.ReciverPhoneNo=r.find("#txtReciverPhoneNo").val();var u={};if(!String.isNullOrUndefineOrBlank(c.ReciverPhoneNo)){if(!reciverPhoneNumber.validatePhoneNumber())return!1;u=reciverPhoneNumber.getPhoneData(),c.ReciverPhoneNo=u.phoneNo}i="";"Send Now"!=e("#txtScheduleDate").val()&&(i=getdatepickervalue(txtScheduleDate,null,!0,null,!0)),String.isNullOrUndefineOrBlank(i)?c.ScheduleDate=null:c.ScheduleDate=moment(i).format("YYYY-MM-DD HH:mm:ss"),ShowLoader(!0);var p=new vagaro.ajax;p.datamodel.Token=ApiURLEnumOnlineCheckout.giftcertificateaddtocart,p.datamodel.IsNewVagaroAPI=!0,p.datamodel.callback=function(i){ShowLoader(!1);i.IsSuccess,e(t).attr("aria-label","Giftcertificate has been added successfully to cart.").focus(),setTimeout(function(){e(t).removeAttr("aria-label")},600),i.IsSuccess&&(_onlineCheckout.GetCartItemCount(i.ItemCount,r,o),e("#ancShoppingCartIcon").attr("data-isbypass","true"),e("#ancShoppingCartIcon").click())},p.datamodel.data=c,p.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},p.Post()}else a?""==e("#txtSalonServicesForGC").val()?(e(".txtSalonServicesForGCerrortext").show(),e("#txtSalonServicesForGC").addClass("errorInput")):(e(".txtSalonServicesForGCerrortext").hide(),e("#txtSalonServicesForGC").removeClass("errorInput")):""==e("#txtGCPromoAmount").val()?(e(".txtAmounterrortext").show(),e("#txtGCPromoAmount").addClass("errorInput")):(e(".txtAmounterrortext").hide(),e("#txtGCPromoAmount").removeClass("errorInput"))},_onlineCheckout.ServiceAddToCart=function(t,i){if(UserID<=0)return objServiceAddToCart=t,showCommonLoginPopup("ServiceAddToCart"),!1;var a=!1,r=t[0];for(var o in r)if("ItemId"===o){a=!0;break}if(a){Data={},Data.businessID=businessID,Data.IsFromClass=!0;var n=[];t.forEach(function(e){var t={};t.ServiceId=String(e.ItemId),t.BillingCycle=e.BillingCycle,t.IsAmount=e.IsAmount,t.IsInitialDiscount=e.IsInitialDiscount,t.InitialDiscount=e.InitialDiscount,t.NoOfVisit=0,t.isCustomPackage=!0,t.promotionDetail=e.PromotionDetail,t.PromotionTitle=e.PromotionTitle,t.IsFromClass=!0,t.eventType=4,n.push(t)}),Data.PackageData=n,ShowLoader(!0),(S=new vagaro.ajax).datamodel.Token=ApiURLEnumOnlineCheckout.serviceaddtocart,S.datamodel.IsNewVagaroAPI=!0,S.datamodel.callback=function(i){ShowLoader(!1);0==i.IsSuccess&&(null!=i.Message&&null!=i.Message&&i.Message),e(t).attr("aria-label","Service has been added successfully to cart.").focus(),setTimeout(function(){e(t).removeAttr("aria-label")},600),i.IsSuccess&&("Redirect"==C?(ManageAddtoCart(t),_onlineCheckout.GetCartItemCount(i.ItemCount,null,c)):1==_shopdetail.IsMemPkgReqToBook?_onlineCheckout.GetCartItemCount(i.ItemCount,null,c):_onlineCheckout.GetCartItemCount(i.ItemCount,s,c)),bkEvent.SelectedPackages=[]},S.datamodel.data=Data,S.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},S.Post()}else{var s=e(t).closest(".service-50"),l=s.find("#pServiceDesc").text();if(t.ItemId>0)var d=t.ItemId;else d=s.attr("data-serviceid");var c=0;"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(c=s.data("price"));var u;u=s.attr("data-promotionDetail");var p;p=s.attr("data-promotiontitle");var h=!1,m=0,f=!1,g=0;void 0===u||""==u?(h=s.attr("data-isinitialdiscount"),m=s.attr("data-initialdiscount"),f=s.attr("data-isamount"),g=s.attr("data-billingcycle")):g=s.attr("data-billingcycle");var v=0;s.attr("data-noofvisit")&&(v=s.attr("data-noofvisit"));var A=!1;s.attr("data-iscustompackage")&&void 0===(A=s.attr("data-iscustompackage"))&&(A=!1);var C="NoRedirect";if("undefined"!=typeof businessID&&1!=i||"undefined"!=e("#hdnBusinessId").val()&&(businessID=e("#hdnBusinessId").val(),C="Redirect",cookieManager.setCookie("Referral","DailyDealToCart",.0833,cookieManager.defaultPath,cookieManager.defaultDomain,!0,!1)),parseFloat(d)>0){if("true"!=A){var y=_shopdetail.CreateAddonCollection();if(!String.isNullOrUndefineOrBlank(y)&&y.length>0&&"undefined"!=typeof iscustompackage&&1!=iscustompackage&&"true"!=iscustompackage){var b=0;e.grep(y,function(e){b=_onlineCheckout.parseTodecimal(b+e.Price,2)}),c=_onlineCheckout.parseTodecimal(c,2)+_onlineCheckout.parseTodecimal(b,2)}}var S;ShowLoader(!0),(S=new vagaro.ajax).datamodel.Token=ApiURLEnumOnlineCheckout.serviceaddtocart,S.datamodel.IsNewVagaroAPI=!0,S.datamodel.callback=function(i){ShowLoader(!1);0==i.IsSuccess&&(null!=i.Message&&null!=i.Message&&i.Message),e(t).attr("aria-label","Service has been added successfully to cart.").focus(),setTimeout(function(){e(t).removeAttr("aria-label")},600),i.IsSuccess&&("Redirect"==C?(ManageAddtoCart(t),_onlineCheckout.GetCartItemCount(i.ItemCount,null,c)):1==_shopdetail.IsMemPkgReqToBook?_onlineCheckout.GetCartItemCount(i.ItemCount,null,c):_onlineCheckout.GetCartItemCount(i.ItemCount,s,c)),bkEvent.SelectedPackages=[]},Data={},Data.businessID=businessID,Data.serviceId=d,Data.noOfVisit=v,Data.isCustomPackage=A,Data.promotionDetail=u,Data.promotionTitle=p,Data.IsInitialDiscount=h,Data.InitialDiscount=m,Data.IsAmount=f,Data.BillingCycle=g,Data.ServiceDesc=l,Data.lstAddonService=y,Data.IsFromClass=!1,S.datamodel.data=Data;try{var k={Action:"Add to Cart",Category:"Deal",PageName:"Deal"};null!=e("#lblSalonName")&&null!=e("#lblSalonName").text()&&(k.BusinessName=e("#lblSalonName").text()),k.BusinessID=businessID,k.isDealDetails=!0,k.IsListPage=!0,k.IsMapPage=!1,k.isFiltered=!1,k.DealName=p,_vgLogEvent.LogData(k)}catch(e){}S.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},S.Post()}}e("#divAddonPopupSection input[type='checkbox']:checked").prop("checked",!1),e("#divAddonPopupSection input[type='radio']:checked").prop("checked",!1)},_onlineCheckout.setCartCountLabel=function(t){1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "updateCartCount","cartCount": "'+t+'"}'):e(".cart-number").html(t)},_onlineCheckout.GetCartItemCount=function(e,t,i){try{if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==i&&void 0!==e&&""!=e&&null!=e&&""!=e&&1==e&&_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.add_to_cart,JSAdjustEventToken.add_to_cart_eventtoken,i),null!=e&&""!=e&&null!=e&&""!=e)void 0!==t&&null!=t&&null!=t?setTimeout(function(){t.animate_from_to(".cart-number:visible",{pixels_per_second:2e3,callback:function(){_onlineCheckout.setCartCountLabel(e)}})},100):_onlineCheckout.setCartCountLabel(e);else if(UserID>0&&businessID>0){var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumOnlineCheckout.getcartcount,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(e){_onlineCheckout.setCartCountLabel(e)},a.datamodel.data={businessID:businessID},a.datamodel.Error=function(e){},a.Post()}else _onlineCheckout.setCartCountLabel("0")}catch(e){_onlineCheckout.setCartCountLabel("0")}},_onlineCheckout.ensureFamilyAndFriendsDetailsLoadedSync=function(){if(!("undefined"==typeof UserID||UserID<=0||null!=_onlineCheckout.FamilyAndFriendsDetails)){var e=new vagaro.ajax;e.datamodel.Token="GetFamilyAndFriendsDetailsByUserID",e.datamodel.data={objRequest:{businessID:businessID,loginUserID:UserID,UserID:UserID,IsLoadFromOffline:!0,strLoginUserId:strUserID,parentPage:"OnlineShoppingCart"}},e.datamodel.async=!1,e.datamodel.callback=function(e){null!=e&&(_onlineCheckout.FamilyAndFriendsDetails=e)},e.datamodel.Error=function(e){},e.Post()}},_onlineCheckout.isFamilyMemberCustomerId=function(t){if(null==t||""===t||null==_onlineCheckout.FamilyAndFriendsDetails)return!1;var i=_onlineCheckout.FamilyAndFriendsDetails;return!e.isArray(i)&&i&&e.isArray(i.Data)&&(i=i.Data),!!e.isArray(i)&&e.grep(i,function(e){return null!=e&&e.UserID==t}).length>0},_onlineCheckout.classAddToCart=function(t,i){var a=!1;_vgClassSessionSelection.isCallFromPublic()&&(businessID=_publicEvent.objEventDetails.BusinessID,a=!0);var r={businessID:businessID,events:t,loginUserID:UserID,ischeckinApp:isCheckInApp,IsLiveStream:a},o=0;"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(o=parseFloat(e("#hdnAdjustClassTotalPrice").val()),e("#hdnAdjustClassTotalPrice").val("0"));var n=new vagaro.ajax;n.datamodel.Token=ApiURLEnumOnlineCheckout.classaddtocart,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=function(a){if(_onlineCheckout.GetCartItemCount(a.ItemCount,null,o),1==_shopdetail.IsMemPkgReqToBook&&(e.grep(t,function(t){var i=t.eventEnrollment;e.grep(i,function(e){e.eventID==_vgClassSessionSelection.commonProperty.eventID&&null!=bkEvent.SelectedMembership&&(e.customerID==UserID?_onlineCheckout.MembershipAddToCart(bkEvent.SelectedMembership):(_onlineCheckout.ensureFamilyAndFriendsDetailsLoadedSync(),_onlineCheckout.isFamilyMemberCustomerId(e.customerID)&&_onlineCheckout.MembershipAddToCart(bkEvent.SelectedMembership)))})}),null==bkEvent.SelectedMembership&&void 0!==bkEvent.SelectedPackages&&null!=bkEvent.SelectedPackages&&bkEvent.SelectedPackages.length>0&&_onlineCheckout.CustomPackageAddToCart(bkEvent.SelectedPackages)),1==i)if(_vgClassSessionSelection.isCallFromPublic()&&(1==e("#live-stream-classes-popup").is(":visible")&&e("#live-stream-classes-popup").modal("hide"),window.location.href="/"+_publicEvent.objEventDetails.VagaroURL+"/shopping-bag/live-stream"),0==isCheckInApp){var r=e("#ancShoppingCartIcon");r.length>0&&(r.attr("data-isbypass","true"),r.click())}else e("#licartIcon a").attr("data-isbypass","true"),e("#licartIcon a").click()},n.datamodel.data=r,n.datamodel.Error=function(t){if(vagaro.alert("Some error occured. Please try again."),1==i)if(0==isCheckInApp){var a=e("#ancShoppingCartIcon");a.length>0&&(a.attr("data-isbypass","true"),a.click())}else e("#licartIcon a").attr("data-isbypass","true"),e("#licartIcon a").click()},n.Post()},_onlineCheckout.checkoutGotoNextStep=function(t){if(_onlineCheckout.IsVplChanged=!1,e("#page-wrapper").animate({scrollTop:0},"slow"),1==t){if(1==_onlineCheckout.IsCalledFromLiveStream())return void("undefined"!=typeof vgAppicationType&&1==vgAppicationType?e("#custmobileBack").click():window.history.go(-1));_onlineCheckout.loadNewCCandShip=!1,_onlineCheckout._checkoutPageVisitedLogged=!1,e("#txtPromoCode").val(""),e("#divApplyPromocode").empty(),e("#shoppingcartfirst").show(),e("#shoppingcartsecond").hide(),e("#chkreturnpolicy").prop("checked",!1),e("#lblreturnpolicy").css("color",""),_onlineCheckout.LoadShoppingCartExternal(),_onlineCheckout.rebindCartDataAfterPartialCheckOut()}else{e("#shoppingcartfirst").hide(),e("#shoppingcartsecond").show(),_onlineCheckout.FireOnlineCheckoutPageVisited(),setTimeout(function(){e("#h1InBusinessName").attr("tabindex",-1).focus()},1e3);var i=[];if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&(i=e.grep(onlineShoppingCart.Inventories,function(e){return 1==e.IsDropShip})),4==ShippingID?e("#btnShipToAddress").hide():"false"==IsEnablePickUpInStore.toString().toLowerCase()||i.length>0?(e("#btnShipToAddress").click(),e("#btnInStorePickup").hide()):(e("#btnInStorePickup").click(),e("#btnInStorePickup").show()),newShippingAddress=e("#txtNewShippingAddress").GoogleAddressPlugin({Address2Control:"#txtNewShippingAptSuite",CurrentLocationCountryID:"undefined"!=typeof BusinessCountryID&&null!=BusinessCountryID&&""!=BusinessCountryID?parseInt(BusinessCountryID):_onlineCheckout.CountryID,CountryDropDownRole:0}),_onlineCheckout.rightSideCartDataBind(),e("#btnShipToAddress").click(function(){e("#aOldUserAddress").click()}),e("#btnInStorePickup").click(function(){e("#divPickupDateError").hide(),e("#txtPickupDateTime").removeClass("errorInput"),setTimeout(function(){_onlineCheckout.setShippingAddressObject()},100)}),e("#saveaddressinfo").click(function(){e("#saveaddressinfo").prop("checked")?e("#lblsaveaddressinfo").attr("aria-checked","true"):e("#lblsaveaddressinfo").attr("aria-checked","false")}),e("#chkgcprint").click(function(){e("#chkgcprint").prop("checked")?e("#lblgcprint").attr("aria-checked",!0):e("#lblgcprint").attr("aria-checked",!1)}),e("#chkgcsendmail").click(function(){e("#chkgcsendmail").prop("checked")?e("#lblgcsendmail").attr("aria-checked",!0):e("#lblgcsendmail").attr("aria-checked",!1)}),e("#chkreturnpolicy").click(function(){e("#chkreturnpolicy").prop("checked")?e("#lblreturnpolicy").attr("aria-checked",!0):e("#lblreturnpolicy").attr("aria-checked",!1)}),e("#chkinvoicereturnpolicy").click(function(){e("#chkinvoicereturnpolicy").prop("checked")?e("#lblinvoicereturnpolicy").attr("aria-checked",!0):e("#lblinvoicereturnpolicy").attr("aria-checked",!1)}),e("#aOldUserAddress").unbind("click"),e("#aOldUserAddress").click(function(t){e("#txtNewShipFirstName").val(""),e("#txtNewShipLastName").val(""),e("#txtNewShippingAddress").select2("data",{id:"",text:""}),e("#txtNewShippingAptSuite").val(""),e("#txtNewShipPhone").val(""),e("#saveaddressinfo").attr("checked",!1);var i={};i.country="undefined"!=typeof BusinessCountryID&&null!=BusinessCountryID&&""!=BusinessCountryID?parseInt(BusinessCountryID):_onlineCheckout.CountryID,newShippingAddress.setAddressData(i),_onlineCheckout.clearShippingMethod(),onlineShoppingCart.IsAddressOnFile=!0,setTimeout(function(){_onlineCheckout.setShippingAddressObject()},100)}),e("#aDiffUserAddress").unbind("click"),e("#aDiffUserAddress").click(function(e){_onlineCheckout.clearShippingMethod(),onlineShoppingCart.IsAddressOnFile=!1,setTimeout(function(){_onlineCheckout.setShippingAddressObject()},100),_onlineCheckout.LoadStatesByMultipleCountryID(),_onlineCheckout.ValidateVPl(!1)}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Packages)&&onlineShoppingCart.Packages.length>0&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.GiftCertificates)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Memberships)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Events))for(var a=0;a<onlineShoppingCart.Packages.length;a++){if("Package"==onlineShoppingCart.Packages[a].ParentServiceTitle){e("#divreturnpolicy").show();break}e("#divreturnpolicy").hide()}else e("#divreturnpolicy").show();_onlineCheckout.isValidForCheckoutInvoice()&&("true"==IsOnLineShoppingCart.toLowerCase()?(e("#divreturnpolicy").hide(),e("#divreturnpolicyPayInvoice").show()):(e("#divreturnpolicy").hide(),e("#divreturnpolicyPayInvoice").hide())),!String.isNullOrUndefineOrBlank(onlineShoppingCart)&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.GiftCertificates)&&onlineShoppingCart.GiftCertificates.length>0?e("#gcprintandsendmailcheckbox").show():e("#gcprintandsendmailcheckbox").hide(),_onlineCheckout.getBusinessWorkingHours(),void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&1==isBrandedAppForApproval?(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide()):(onlineShoppingCart.PartialPrice!=(void 0===onlineShoppingCart.PartialPrice||String.isNullOrUndefineOrBlank(onlineShoppingCart.PartialPrice))&&onlineShoppingCart.PartialPrice,parseFloat(onlineShoppingCart.ccAmt)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining)-parseFloat(onlineShoppingCart.FeeDepositsRemaining)>0||1==_onlineCheckout.IsCCDetailEnable()&&parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining)-parseFloat(onlineShoppingCart.PartialPrice))>0||1==_onlineCheckout.isValidForCheckoutInvoice()||parseFloat(onlineShoppingCart.tipValue)>0||1==_onlineCheckout.IsLoadCCIframForMemrship()||IsDailyDealFeeCCOFF&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Memberships)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Packages)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.GiftCertificates)?_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout"):(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide())),1==_onlineCheckout.Model.IsPaymentOption&&e("#dvCheckoutBookingPaymentMethod").show(),_onlineCheckout.PromoBox(),setTimeout(_onlineCheckout.setShippingAddressObject,100),_onlineCheckout.ClearCheckOutValidationMessage(),0==_onlineCheckout.loadNewCCandShip&&_onlineCheckout.clearShippingMethod(),_onlineCheckout.loadNewCCandShip=!0,_onlineCheckout.CheckLiveStreamAddressVisibleOrNot();var r=!1;void 0!==onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(e){e.paidType==_onlineCheckout.arrpaidType.PaidClass&&(r=!0)})}),null!=onlineShoppingCart.ServiceInvoice&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){e.paidType==_onlineCheckout.arrpaidType.Paid&&(r=!0)}),_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(isAllowTipForInvoice)&&"true"!=isAllowTipForInvoice.toLowerCase().trim()&&(r=!1),void 0!==onlineShoppingCartmain.TipOption&&null!=onlineShoppingCartmain.TipOption&&""!=onlineShoppingCartmain.TipOption&&"0"!=onlineShoppingCartmain.TipOption&&(onlineShoppingCartmain.IsFullDeposit&&r&&_onlineCheckout.IsBaseTipAllowedByConfig()||_onlineCheckout.HasConfigTipItemInCart())?(e("#divTip").show(),_onlineCheckout.ShowTipOptions()):e("#divTip").hide(),_onlineCheckout.isValidForCheckoutInvoice()&&setTimeout(function(){e("#h1InBusinessName").attr("tabindex",-1).focus()},1e3),e("#divTotalDuePrice").focusin(function(){e("#divTotalDuePrice").removeAttr("tabindex"),e("#ancBuyNow").attr("aria-labelledby","divTotalTitle divfinalTotalPrice lblGcEndingNumber lblGCRedeemAmt divTotalDueNow divCartPrepaypricewithoutGC divTotalDueNowTitle divcartdepositpricewithoutgc divTotalDueAtBusinessTitle divcarttotalduepriceatbusiness ancBuyNow")}),e("#divTotalDuePrice").focusout(function(){e("#divTotalDuePrice").attr("tabindex",0),e("#ancBuyNow").attr("tabindex",-1).focus()}),e("#ancBuyNow").focusout(function(){e("#ancBuyNow").attr("aria-labelledby","ancBuyNow")})}},_onlineCheckout.ShowTipOptions=function(){_onlineCheckout.ShowHideTipOptions(!0),e("#divfinalCheckoutTipAmount").show(),0==onlineShoppingCart.tipValue&&(e("#lstTipTabList").is(":visible")||_onlineCheckout.CreateHtmlTip())},_onlineCheckout.HideTipOptions=function(){onlineShoppingCart.tipValue=0,onlineShoppingCart.tipPercent=0,e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+"0.00"),e("#divfinalCheckoutTipAmount").hide(),e("#txtOnlineCustomerTip").val("0.00"),e("#divTip").hide(),_onlineCheckout.displayFinalCalculatedPrice(),parseFloat(onlineShoppingCart.ccAmt)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining)>0||1==_onlineCheckout.IsCCDetailEnable()&&parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining))>0||parseFloat(onlineShoppingCart.tipValue)>0||1==_onlineCheckout.IsLoadCCIframForMemrship()?_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout"):(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divVplTracking").hide())},_onlineCheckout.GetTipOnItemsList=function(){var t=[];if(void 0!==tipOnItems&&null!=tipOnItems&&""!=tipOnItems.toString().trim())for(var i=tipOnItems.toString().split(","),a=0;a<i.length;a++){var r=parseInt(i[a],10);isNaN(r)||(22===r&&(r=3),-1===e.inArray(r,t)&&t.push(r))}return t},_onlineCheckout.IsConfigTipItem=function(t){var i=_onlineCheckout.GetTipOnItemsList();return i.length>0&&-1!==e.inArray(parseInt(t,10),i)},_onlineCheckout.IsTipTaxInclusive=function(){return-1!==e.inArray(29,_onlineCheckout.GetTipOnItemsList())},_onlineCheckout.GetItemTipTax=function(e){if(!_onlineCheckout.IsTipTaxInclusive())return 0;var t=parseFloat(e);return isNaN(t)?0:_onlineCheckout.parseTodecimal(t,2)},_onlineCheckout.GetCartTipTax=function(){if(!_onlineCheckout.IsTipTaxInclusive())return 0;var e=0;return isNaN(parseFloat(onlineShoppingCart.tax))||(e+=parseFloat(onlineShoppingCart.tax)),isNaN(parseFloat(onlineShoppingCart.classTax))||(e+=parseFloat(onlineShoppingCart.classTax)),isNaN(parseFloat(onlineShoppingCart.classAddonTotalTaxPrice))||(e+=parseFloat(onlineShoppingCart.classAddonTotalTaxPrice)),_onlineCheckout.parseTodecimal(e,2)},_onlineCheckout.HasTippableFeeInCart=function(){return null!=onlineShoppingCart.BusinessFee&&0!=onlineShoppingCart.BusinessFee.length&&e.grep(onlineShoppingCart.BusinessFee,function(e){return 1!=e.FeeType&&parseFloat(e.DisplayCalculatedFees)>0}).length>0},_onlineCheckout.HasConfigTipItemInCart=function(){if(_onlineCheckout.IsConfigTipItem(d.Membership)&&null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0)return!0;if(_onlineCheckout.IsConfigTipItem(d.GiftCertificate)){if(null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0)return!0;if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0)return!0}return!!(_onlineCheckout.IsConfigTipItem(d.Product)&&null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0)},_onlineCheckout.IsBaseTipAllowedByConfig=function(){var t=_onlineCheckout.GetTipOnItemsList(),i=function(i,a){return a&&(0==t.length||-1!==e.inArray(i,t))};return!!i(d.Class,null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0)||(!!i(d.Service,null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0)||(!!i(d.Product,null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0)||(!!i(d.Membership,null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0)||(!!i(d.GiftCertificate,null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0)||!!i(d.GiftCertificate,null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0)))))},_onlineCheckout.GetConfigTipItemsAmount=function(t){var i=0;return _onlineCheckout.IsConfigTipItem(d.Membership)&&null!=onlineShoppingCart.Memberships&&e.each(onlineShoppingCart.Memberships,function(e,a){i=_onlineCheckout.parseTodecimal(i+parseFloat(a.Price),2),!0===t&&(_onlineCheckout.TotalPaidCount+=1)}),_onlineCheckout.IsConfigTipItem(d.GiftCertificate)&&(null!=onlineShoppingCart.GiftCertificates&&e.each(onlineShoppingCart.GiftCertificates,function(e,a){i=_onlineCheckout.parseTodecimal(i+parseFloat(a.TotalPrice),2),!0===t&&(_onlineCheckout.TotalPaidCount+=1)}),null!=onlineShoppingCart.Packages&&e.each(onlineShoppingCart.Packages,function(e,a){i=_onlineCheckout.parseTodecimal(i+parseFloat(a.TotalPrice),2),!0===t&&(_onlineCheckout.TotalPaidCount+=1)})),_onlineCheckout.IsConfigTipItem(d.BusinessFee)&&null!=onlineShoppingCart.BusinessFee&&e.each(onlineShoppingCart.BusinessFee,function(e,a){1!=a.FeeType&&parseFloat(a.DisplayCalculatedFees)>0&&(i=_onlineCheckout.parseTodecimal(i+parseFloat(a.DisplayCalculatedFees),2),!0===t&&(_onlineCheckout.TotalPaidCount+=1))}),i},_onlineCheckout.ApplyConfigItemTip=function(e,t,i){try{if("undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&void 0!==onlineShoppingCart.tipValue&&null!=onlineShoppingCart.tipValue&&onlineShoppingCart.tipValue>0&&_onlineCheckout.IsConfigTipItem(i)){_onlineCheckout.TipApplyCounter=++_onlineCheckout.TipApplyCounter;var a=_onlineCheckout.parseTodecimal(parseFloat(t)+_onlineCheckout.GetItemTipTax(e.calculatedTax),2),r=_onlineCheckout.parseTodecimal(parseFloat(onlineShoppingCart.tipValue)-_onlineCheckout.TipAppliedSum,2);if(r<=0)return void(e.calculatedTip=0);var o=0;(_onlineCheckout.TipApplyCounter>=_onlineCheckout.TotalPaidCount||onlineShoppingCart.tipPercent<=0||(o=_onlineCheckout.parseTodecimal(a*onlineShoppingCart.tipPercent/100,2))>r)&&(o=r),e.calculatedTip=o,_onlineCheckout.TipAppliedSum=_onlineCheckout.parseTodecimal(_onlineCheckout.TipAppliedSum+o,2)}}catch(e){}},_onlineCheckout.GetOnlineCartTipAmount=function(){var e=parseFloat(onlineShoppingCart.tipValue);return isNaN(e)?0:_onlineCheckout.parseTodecimal(e,2)},_onlineCheckout.GetTotalCartAmountforTip=function(){var t=0;return _onlineCheckout.TotalPaidCount=0,null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(i){i.paidType==_onlineCheckout.arrpaidType.PaidClass&&(_onlineCheckout.TotalPaidCount=++_onlineCheckout.TotalPaidCount,t=1==i.isPackage||1==i.isPointApply||i.isMembershipApply||i.isPresetApply||void 0!==i.PromotionID&&null!=i.PromotionID&&i.PromotionID>0?_onlineCheckout.parseTodecimal(t+i.Originalprice,2):_onlineCheckout.parseTodecimal(t+i.price,2)),null!=i.lstAddonService&&e.grep(i.lstAddonService,function(e){e.paidType==_onlineCheckout.arrpaidType.PaidClass&&(_onlineCheckout.TotalPaidCount=++_onlineCheckout.TotalPaidCount,t=1==e.isPackage||1==e.isPointApply||e.isMembershipApply||i.isPresetApply?_onlineCheckout.parseTodecimal(t+e.Originalprice,2):_onlineCheckout.parseTodecimal(t,2)+_onlineCheckout.parseTodecimal(isNaN(e.price)?e.Price:e.price,2))})})}),t},_onlineCheckout.CreateHtmlTip=function(){"undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&void 0!==onlineShoppingCart.tipPercent&&null!=onlineShoppingCart.tipPercent&&(onlineShoppingCart.tipPercent=0),void 0!==onlineShoppingCartmain.TipType&&null!=onlineShoppingCartmain.TipType&&""!=onlineShoppingCartmain.TipType&&(tipType=onlineShoppingCartmain.TipType.toLowerCase());var t=onlineShoppingCartmain.TipOption.split(","),i="";e("#lstTipTabList").html(""),e("#dvTipBlock").html(""),_shopdetail.VisibleControlLength("#mobile-check")>0?(e("#divCartTipSelectionMobile").html(""),e("#divCartTipSelectionMobile").html('<div class="checkout-title">Tip</div><div class="tip-tablist vagaro-segment vagaro-segment-mobile-full" id="lstTipTabList"></div><div class="tipBlock" id="dvTipBlock" style="display: none;"></div>')):(e("#divCartTipSelection").html(""),e("#divCartTipSelection").html('<div class="tip-tablist vagaro-segment vagaro-segment-mobile-full" id="lstTipTabList"></div><div class="tipBlock" id="dvTipBlock" style="display: none;"></div>'));var a=0;a=onlineShoppingCartmain.IsFullDeposit&&"true"!=_onlineCheckout.isFromInvoice.toString().toLowerCase()?_onlineCheckout.GetTotalCartAmountforTip():_onlineCheckout.GetSumOfProdcutOrService(),a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.GetConfigTipItemsAmount(!1),2),a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.GetCartTipTax(),2);for(var r=0;r<t.length;r++){var o,n;"dollar"===tipType?(o=parseFloat(t[r]),n=currencysymbol+o):(o=a*parseFloat(t[r])/100,n=t[r]+"%");var s="dollar"===tipType?"":"<div class='text-blockNew text-secondary'>("+currencysymbol+o.toFixed(2)+")</div>";i="<a href='javascript:void(0);' class='tip-tab vg-filter-mobile-tab' tip-amount='"+o.toFixed(2)+"' tip-percentage='"+t[r]+"' onClick='_onlineCheckout.setTipValueOnline("+t[r]+",this)'><div>"+n+"</div>"+s+"</a>",r==t.length-1&&(i+="<a href='javascript:void(0);' class='tip-tab vg-filter-mobile-tab' tip-amount='0' tip-percentage='0' onClick='_onlineCheckout.showOtherTipOption(true,1,this)'><div>Custom</div></a>"),e("#lstTipTabList").append(i)}var l="<div class='tipInputHolder vagaro-input-prefix-text'><div id='dvServiceDollarSign' class='dollersign doller-icon' style='display: block;'>"+currencysymbol+"</div><input Id='txtOnlineCustomerTip' type='text' class='tipInputField vagaro-input tip-currency' onkeypress='return _onlineCheckout.validateCustomTipKeyPress(this, event);' maxlength='6' tip-amount='0' placeholder='Custom' onBlur='validateDecimal(this,1,2);_onlineCheckout.setTipValueOnline(-1);' onkeyup='pasteHandlerKeyup(this,event,1);_onlineCheckout.enforceCustomTipMinimum(this);' onfocus='_onlineCheckout.setFocusinCustomTip();' value='0.00' /></div>";void 0!==i&&null!=i&&""!=i&&e("#dvTipBlock").append(l)},_onlineCheckout.directClassGoBack=function(){e("#divFormsDirectClass").hide(),e("#shoppingcartfirst").show()},_onlineCheckout.clearShippingMethod=function(){e(".upsFedexIcoN").removeClass("uspsIcon");var t=e("#divShippingTab"),i=t.find(".divshpopt"),a=t.find(".divshpcontent");2==_onlineCheckout.IsVPLAddress||String.isNullOrUndefineOrBlank(onlineShoppingCart)||(onlineShoppingCart.SelectedShippingMethod=null,onlineShoppingCart.shippingOptions=null),e("#divShippingerrorTab").hide(),e(i).html(""),e(a).html("")},_onlineCheckout.saveNewPopAddrss=function(t){if(e("#divNewShippingAddressPopup").valid()){0==t&&_onlineCheckout.clearShippingMethod();var i=e("#txtNewStreet").val(),a=e("#txtNewCity").val(),r=e("#txtNewState").val(),o=e("#txtNewZip").val(),n=i;n=(n=(n=n+(""!=n?", ":"")+a)+(""!=n?", ":"")+r)+(""!=n?", ":"")+o,0==_onlineCheckout.IsVPLAddress?(e("#txtNewShippingAddress").select2("val",n),e("#txtNewShippingAddress").attr("data-preval",n)):(e("#txtAddressVPL").select2("val",n),e("#txtAddressVPL").attr("data-preval",n),_onlineCheckout.setAddressControl()),e("#divNewShippingAddressPopup").modal("hide");var s={};if(s.street=n,s.city=a,s.state=r,s.zip=o,s.countryId=e("#cboCountryshopping").val(),s.countrytext=countryMapping[e("#cboCountryshopping").val()],e("#txtNewShippingAptSuite").val(e("#txtStreet1").val()),s.streetNo=e("#txtNewShippingAptSuite").val(),s.stateID=_onlineCheckout.getMappingStateId(s.countryId,s.state),e("#hdnNewAddressDataCheckout").val(JSON.stringify(s)),0!=_onlineCheckout.IsVPLAddress)return!0;_onlineCheckout.setShippingAddressObject()}return!1},_onlineCheckout.GetCityByZipCode=function(t){var i=0,a="";if("1"==e("#divaddressonfile .w--current").attr("data-adval")?(i=e("#divaddressonfile .w--current").attr("data-countryid"),a=e("#divaddressonfile .w--current").attr("data-zip")):(i=e("#cboCountryshopping").val(),a=new String(e("#txtNewZip").val())),!String.isNullOrUndefineOrBlank(t)&&String.isNullOrUndefineOrBlank(a)&&(a=e(t).val()),""!=a&&i>0){ShowLoader(!0);var r=new vagaro.ajax,o={CountryID:parseInt(i),strZipCode:a.toString()};r.datamodel.async=!1,r.datamodel.Token=_onlineCheckout.GetCoreAPIURLWithToken(ApiURLEnumOnlineCheckout.getStateCode,groupID),r.datamodel.IsNewVagaroAPI=!0,r.datamodel.data=o,r.datamodel.callback=function(t){if(ShowLoader(!1),1e3==t.CustomCode){var a=t.Data,r=a.split("|")[0],o=1*a.split("|")[1],n=a.split("|")[2];e("#txtNewCity").val(r),e("#txtNewState").val(n),e(".ddlState").val(o),""==t?(e("#txtNewState").val(""),e("#txtNewZip").val("")):e("#txtNewState").attr("disabled",!0),e("#hdnNewCountrycode").val(countryMapping[i]),e("#hdnNewCountryName").val(countryNameMapping[i])}},r.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},r.Post()}},_onlineCheckout.getMappingStateId=function(t,i){if(null!=_onlineCheckout.StatesList&&null!=_onlineCheckout.StatesList&&_onlineCheckout.StatesList.length>0){var a=e.grep(_onlineCheckout.StatesList,function(e){return e.CountryID==t&&e.StateName==i});if(null!=a&&null!=a&&a.length>0)return a[0].StateID}return 0},_onlineCheckout.LoadStatesByMultipleCountryID=function(){if(null!=_onlineCheckout.StatesList&&null!=_onlineCheckout.StatesList||(_onlineCheckout.StatesList=[]),null!=_onlineCheckout.StatesList&&null!=_onlineCheckout.StatesList&&_onlineCheckout.StatesList.length<=0){var e=new vagaro.ajax;e.datamodel.Token=ApiURLEnumOnlineCheckout.getstatesbymultiplecountryid,e.datamodel.IsNewVagaroAPI=!0;e.datamodel.data={CountryIDs:[1,2,3,4]},e.datamodel.callback=function(e){_onlineCheckout.StatesList=e},e.datamodel.Error=function(e){},e.Post()}},_onlineCheckout.validateNewShippingAddressData=function(){
//!String.isNullOrUndefineOrBlank($('#txtNewShippingAddress').val())
return!(String.isNullOrUndefineOrBlank(e("#txtNewStreet").val())||String.isNullOrUndefineOrBlank(e("#txtNewZip").val())||String.isNullOrUndefineOrBlank(e("#txtNewState").val())||String.isNullOrUndefineOrBlank(e("#txtNewCity").val()))||(_onlineCheckout.GetState(),_onlineCheckout.ChangeCountry(_onlineCheckout.selectedCountryId),_onlineCheckout.openCloseAddresspopup(1),!1)},_onlineCheckout.ClearNewShippingAddressValue=function(t){e("#txtNewStreet").val(""),e("#txtNewCity").val(""),e("#txtNewState").val(""),e("#txtNewZip").val(""),_onlineCheckout.clearShippingMethod()},_onlineCheckout.openCloseAddresspopup=function(t){return 1==t?(e("#txtNewState").attr("disabled",!0),GatherClickElement("#txtNewShippingAddress"),e("#divNewShippingAddressPopup").modal("show"),e("#txtStreet1").val(e("#txtNewShippingAptSuite").val()),!1):(e("#divNewShippingAddressPopup").modal("hide"),e("#txtNewShippingAddress").focus(),!1)},_onlineCheckout.getShippingMethods=function(){var t,i=e("#divaddressonfile .w--current").attr("data-adval"),a="",r="",o="",n="",s="",l="";if("1"==i)a=e("#divaddressonfile .w--current").attr("data-countrycode"),r=e("#divaddressonfile .w--current").attr("data-countryname"),o=e("#divaddressonfile .w--current").attr("data-zip"),n=e("#divaddressonfile .w--current").attr("data-fullname"),s=e("#divaddressonfile .w--current").attr("data-street"),l=e("#divaddressonfile .w--current").attr("data-city");else{var d={};if(!newShippingAddress.validateAddressData())return!1;d=newShippingAddress.getAddressData(),a=String.isNullOrUndefineOrBlank(d.countryCode)?e("#hdnNewCountrycode").val():d.countryCode,r=String.isNullOrUndefineOrBlank(d.countryName)?e("#hdnNewCountryName").val():d.countryName,o=d.zip,n=e("#txtNewShipFirstName").val()+" "+e("#txtNewShipLastName").val(),s=d.address,l=d.city}if(""==o||null==o||""==o)return swal("Please enter valid shipping address"),!1;String.isNullOrUndefineOrBlank(onlineShoppingCart)||String.isNullOrUndefineOrBlank(onlineShoppingCart.Address)||(t=onlineShoppingCart.Address.countryID),ShowLoader(!0);var c={};"undefined"!=typeof BusinessDetail&&null!=BusinessDetail&&(c.businessName=BusinessDetail.BusinessName,c.businessStreet=BusinessDetail.Street,c.businessCity=BusinessDetail.City),c.businessId=businessID,c.businessCountryID=BusinessCountryID,c.businessZipCode=BusinessZipCode,c.countryCode=a,c.countryName=r,c.zipCode=o,c.name=n,c.street=s,c.city=l,c.isAddressOnFile=i,c.CurrencyCode=currencyCode,c.CountryID=t,c.IsWebsiteBuilder=void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication;var u=new vagaro.ajax;u.datamodel.Token="GetShippingMethods_New",u.datamodel.callback=_onlineCheckout.OnLoadShippingMethodSuccess,u.datamodel.data=[c],u.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},u.Post()},_onlineCheckout.OnLoadShippingMethodSuccess=function(t){if(ShowLoader(!1),e("#divShippingerrorTab").hide(),null!=t){var i,a="",o=e("#divShippingTab"),n=o.find(".divshpopt"),s=o.find(".divshpcontent");if(e(n).html(""),e(s).html(""),0==t.Success)return t.Errors[0].indexOf("administrator")>-1||t.Errors[0].indexOf("Invalid XML")>-1?void vagaro.alert("Some error occured."):void vagaro.alert(t.Errors[0]);if(i=t.ShippingOptions,onlineShoppingCart.shippingOptions=t.ShippingOptions,onlineShoppingCart.IsFreeShip=t.IsFreeShip,onlineShoppingCart.shippingOptionsInd=t.ShippingOptionsInd,1==onlineShoppingCart.IsFreeShip){var l=[];e(i).each(function(e,t){l.push(t.Rate)}),r=Math.min.apply(Math,l)}e(i).each(function(t,i){if(i.Rate==r){e(n).append('<a class="shipping-method w-inline-block w-tab-link" data-w-tab="tab_shp_'+t+'" onclick="_onlineCheckout.clickShipingMethod('+t+');"><div>'+i.Name+" <font color='red'>(Free Shipping)</font></div></a>")}else e(n).append('<a class="shipping-method w-inline-block w-tab-link" data-w-tab="tab_shp_'+t+'" onclick="_onlineCheckout.clickShipingMethod('+t+');"><div>'+i.Name+" "+currencysymbol+i.Rate.format("#.##")+"</div></a>");e(s).append('<div class="w-tab-pane" data-w-tab="tab_shp_'+t+'"></div>'),0==t&&(a=i.ShippingRateComputationMethodSystemName)}),""!=a&&("usps"==a.toLowerCase()?(e(".upsFedexIcoN").removeClass("upsIcon"),e(".upsFedexIcoN").removeClass("fedexIcon"),e(".upsFedexIcoN").removeClass("evriicon"),e(".upsFedexIcoN").removeClass("royalmail"),e(".upsFedexIcoN").addClass("uspsIcon"),e(".upsFedexIcoN").show()):"ups"==a.toLowerCase()?(e(".upsFedexIcoN").removeClass("uspsIcon"),e(".upsFedexIcoN").removeClass("fedexIcon"),e(".upsFedexIcoN").removeClass("evriicon"),e(".upsFedexIcoN").removeClass("royalmail"),e(".upsFedexIcoN").addClass("upsIcon"),e(".upsFedexIcoN").show()):"fedex"==a.toLowerCase()?(e(".upsFedexIcoN").removeClass("uspsIcon"),e(".upsFedexIcoN").removeClass("upsIcon"),e(".upsFedexIcoN").removeClass("evriicon"),e(".upsFedexIcoN").removeClass("royalmail"),e(".upsFedexIcoN").addClass("fedexIcon"),e(".upsFedexIcoN").show()):"evri"==a.toLowerCase()?(e(".upsFedexIcoN").removeClass("upsIcon"),e(".upsFedexIcoN").removeClass("fedexIcon"),e(".upsFedexIcoN").removeClass("uspsIcon"),e(".upsFedexIcoN").removeClass("royalmail"),e(".upsFedexIcoN").addClass("evriicon"),e(".upsFedexIcoN").show()):"royalmail"==a.toLowerCase()&&(e(".upsFedexIcoN").removeClass("upsIcon"),e(".upsFedexIcoN").removeClass("fedexIcon"),e(".upsFedexIcoN").removeClass("uspsIcon"),e(".upsFedexIcoN").removeClass("evriicon"),e(".upsFedexIcoN").addClass("royalmail"),e(".upsFedexIcoN").show())),_onlineCheckout.initWebFlowtab()}else vagaro.alert("Invalid zip/postal code.");ShowLoader(!1)},_onlineCheckout.getFinalCCAmount=function(){var e=0;return"undefined"!=typeof onlineShoppingCart&&void 0!==onlineShoppingCart.FinalCCAmount&&(e=onlineShoppingCart.FinalCCAmount),e},_onlineCheckout.clickShipingMethod=function(t){if(onlineShoppingCart.SelectedShippingMethod=onlineShoppingCart.shippingOptions[t],onlineShoppingCart.SelectedShippingMethod.Rate==r&&(onlineShoppingCart.SelectedShippingMethod.Rate=0),_onlineCheckout.displayFinalCalculatedPrice(),e("#divShippingerrorTab").hide(),e("#divShippingerrorTab").html(""),(0==e("#dvCheckoutBookingPaymentMethod").is(":visible")||0==e(_onlineCheckout.Controls.DvcheckoutBookingTabs).is(":visible"))&&onlineShoppingCart.SelectedShippingMethod.Rate>0)_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout");else{var i=_onlineCheckout.getFinalCCAmount();0==parseFloat(i)&&0==_onlineCheckout.IsLoadCCIframForMemrship()?(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divcheckoutSelectPaymentMethodTitle").html("")):_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout")}_onlineCheckout.PromoBox();var a=null,o=null;null!=e("#divcartdepositprice")[0]&&null!=e("#divcartdepositprice")[0].innerHTML&&(o=e("#divcartdepositprice")[0].innerHTML.replace(currencysymbol,"")),null!=e("#lblGCRedeemAmt")[0]&&(a=(a=e("#lblGCRedeemAmt")[0].innerHTML.replace("$(","")).replace(")","")),null!=o&&null!=o&&0!=o?(totalDueAmt=e("#divfinalTotalPrice")[0].innerHTML.replace(currencysymbol,"")-o,FinalCCAmount=totalDueAmt,e("#VplAmount")[0].innerHTML=currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)):null!=a&&null!=a&&0!=a?(totalDueAmt=e("#divfinalTotalPrice")[0].innerHTML.replace(currencysymbol,"")-onlineShoppingCart.gcAmt,FinalCCAmount=totalDueAmt,e("#VplAmount")[0].innerHTML=currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)):(FinalCCAmount=e("#divfinalTotalPrice")[0].innerHTML.replace(currencysymbol,""),e("#VplAmount")[0].innerHTML=e("#divfinalTotalPrice")[0].innerHTML),!String.isNullOrUndefineOrBlank(BusinessDetail)&&FinalCCAmount<=BusinessDetail.MaximumAmount&&FinalCCAmount>=BusinessDetail.MinimumAmount&&"Free"==e("#divfinalTotalPrice")[0].innerHTML&&e("#divVplTracking").hide(),e("#VplAmount").length>0&&(e("#VplAmount")[0].innerHTML=currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)),1==e("#tabVagaroPayLater").hasClass("w--current")&&FinalCCAmount>0&&_vgVPLOnline.PaymentSchedule(FinalCCAmount,_onlineCheckout.PaymentSchduleSuccess,_onlineCheckout.PaymentSchdulefail),1==onlineShoppingCartmain.IsEnableVCFFee&&_onlineCheckout.IsVCFFeeExists()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.ShippingMethod))},_onlineCheckout.shipToAddressClick=function(e){return!1},_onlineCheckout.checkIfProductExists=function(){e('.shopping-bag-items [data-type="inventory"]').length>0?e("#divshippinginfo").show():e("#divshippinginfo").hide()},_onlineCheckout.rightSideCartDataBind=function(){if(!String.isNullOrUndefineOrBlank(onlineShoppingCart)){e("#divcartcheckoutsummary").html("");var t="";if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){var i=e.grep(onlineShoppingCart.Inventories,function(e){return 0==e.MasterInventoryId});e.each(i,function(i,a){var r="";if(!String.isNullOrUndefineOrBlank(a.InventoryBundleCartDetails)){var o=a.InventoryBundleCartDetails.split("|^|");e.each(o,function(e,i){if(!String.isNullOrUndefineOrBlank(i)){var a=i.split("~");t+="Product Name is "+a[0]+" and BrandName is "+a[1]+" ",o.length>2&&!String.isNullOrUndefineOrBlank(a[2])?r+='<li class="bundle-product web-body-font"><div class="product-name thm-textColor web-caption-text web-builder-font-color">'+a[2]+'</div><div class="product-name thm-textColor web-caption-text web-builder-font-color">'+a[0]+'</div><div class="brand-name-checkout thm-textColor web-caption-text web-builder-font-color">'+a[1]+"</div></li>":r+='<li class="bundle-product web-body-font"><div class="product-name thm-textColor web-caption-text web-builder-font-color">'+a[0]+'</div><div class="brand-name-checkout thm-textColor web-caption-text web-builder-font-color">'+a[1]+"</div></li>"}}),a.BrandName="",a.BundleName=t,0==a.OriginalPrice&&(a.OriginalPrice=a.Price/a.Quantity)}a.InventoryBundleCartDetailsHtml=r}),e("#temlcartcheckoutinventoriessummary").tmpl(i).appendTo("#divcartcheckoutsummary"),onlineVPLCheckout=1}if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(e("#temlcartcheckoutpackagessummary").tmpl(onlineShoppingCart.Packages).appendTo("#divcartcheckoutsummary"),onlineVPLCheckout=1),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(e("#temlcartcheckoutGiftCertificatessummary").tmpl(onlineShoppingCart.GiftCertificates).appendTo("#divcartcheckoutsummary"),onlineVPLCheckout=1),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&(e("#temlcartcheckoutmembershipssummary").tmpl(onlineShoppingCart.Memberships).appendTo("#divcartcheckoutsummary"),onlineVPLCheckout=1),null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(e("#temlcartcheckoutEventssummary").tmpl(onlineShoppingCart.Events).appendTo("#divcartcheckoutsummary"),_vgLogEvent.model.EventDurationRemain=parseInt(onlineShoppingCart.Events[0].eventEnrollment[0].EventDurationRemain),_vgLogEvent.model.EventDurationRemain<6?_vgLogEvent.model.buttonText="Join Now":_vgLogEvent.model.buttonText="Sign Up",onlineVPLCheckout=null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0?1:0),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e("#scptService").tmpl(onlineShoppingCart.ServiceInvoice).appendTo("#divcartcheckoutsummary"),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.invoiceDetails&&null!=onlineShoppingCart.invoiceDetails){try{onlineShoppingCart.invoiceDetails.DueDate=moment(onlineShoppingCart.invoiceDetails.DueDate).format("MMM D, YYYY"),4==onlineShoppingCart.invoiceDetails.Status?onlineShoppingCart.invoiceDetails.isOverdue=!0:onlineShoppingCart.invoiceDetails.isOverdue=!1}catch(e){}_onlineCheckout.FillInvoiceLeftSideDetails(onlineShoppingCart.invoiceDetails)}_onlineCheckout.ImgLazyLoad()}_onlineCheckout.isValidForCheckoutInvoice()&&e("#invShowOrderSummary").is(":visible")&&"none"==e(".order-summary").parent().css("display")&&(e("#invShowOrderSummary").mousedown(),e("#invShowOrderSummary").trigger("click")),_onlineCheckout.IsValidatedOnePerUser||_onlineCheckout.ValidateOnePerUserDeal()},_onlineCheckout.ValidateOnePerUserDeal=function(t){_onlineCheckout.IsValidatedOnePerUser=!0;var i=[];null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&e.grep(onlineShoppingCart.GiftCertificates,function(e){if(e.PromotionID>0&&"1"==e.PerTransactionOne){var t={};t.autoId=e.autoId,t.PromotionID=e.PromotionID,t.Discount=e.discount,t.EnrollAutoID=0,i.push(t)}}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(e){try{if(e.PromotionID>0){if(PromotionDetails&&Array.isArray(PromotionDetails)){var t=PromotionDetails.filter(function(t){return t.PromotionID===e.PromotionID});t.length>0&&(e.PerTransactionOne=t[0].PerTransactionOne?"1":"0")}if("1"==e.PerTransactionOne){var a=e.NoOfVisit;e.SellPackageServiceID>0&&(a=1);var r={};r.autoId=e.autoId,r.PromotionID=e.PromotionID,r.Discount=e.discount/a,r.EnrollAutoID=0,i.push(r)}}}catch(e){}}),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(e){if(e.PromotionID>0&&"1"==e.PerTransactionOne){var t={};t.autoId=e.autoId,t.PromotionID=e.PromotionID,t.Discount=e.productDisc,t.EnrollAutoID=0,i.push(t)}}),null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(a){if(a.PromotionID>0&&"1"==a.PerTransactionOne&&1!=a.isPointApply&&1!=a.isPackage){var r={};r.autoId=t.autoId,r.PromotionID=a.PromotionID,r.Discount=t.discountdd,r.EnrollAutoID=a.autoID,i.push(r)}!String.isNullOrUndefineOrBlank(a.lstAddonService)&&a.lstAddonService.length>0&&e.grep(a.lstAddonService,function(e){if(e.PromotionID>0&&"1"==e.PerTransactionOne&&1!=e.isPointApply&&1!=e.isPackage){var t={};t.autoId=e.autoId,t.PromotionID=e.PromotionID,t.Discount=e.discountdd,t.EnrollAutoID=e.autoID,i.push(t)}})})}),null!=i&&i.length>1?_onlineCheckout.RemoveExtraDeals(i,!1,t):1==i.length&&_onlineCheckout.RemoveDealOnSimplePkgMultiQty(i[0],t)},_onlineCheckout.ValidateOnePerUserDealForDirectClassCheckout=function(){var t=[],i=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);null!=i&&i.length>0&&e.grep(i,function(i){e.grep(i.eventEnrollment,function(e){if(e.PromotionID>0&&"1"==e.PerUserOne&&1!=e.isPointApply&&1!=e.isPackage){var a={};a.autoId=i.autoId,a.PromotionID=e.PromotionID,a.Discount=e.discount,a.EnrollAutoID=e.autoID,t.push(a)}})}),null!=t&&t.length>1&&_onlineCheckout.RemoveExtraDeals(t,!0)},_onlineCheckout.RemoveExtraDeals=function(t,i,a){if(null!=t&&t.length>1){var r=[];e.grep(t,function(e){-1==r.indexOf(e.PromotionID)&&r.push(e.PromotionID)});var o=[];e.grep(r,function(i){var a=e.grep(t,function(e){return e.PromotionID==i});a.length>1&&o.push(a)}),o.length>0&&e.grep(o,function(t){var r,o=0;e.grep(t,function(e){e.Discount>o&&(o=e.Discount,r=e)}),void 0!==r&&(e.grep(t,function(e){e.autoId.toString()+e.EnrollAutoID.toString()!=r.autoId.toString()+r.EnrollAutoID.toString()&&(i?_onlineCheckout.RemoveDealOnClassEvent(e.autoId,e.EnrollAutoID,e.Discount):_onlineCheckout.RemoveDealOnItem(e.autoId,e.EnrollAutoID,e.Discount,a))}),i||_onlineCheckout.RemoveDealOnSimplePkgMultiQty(r,a))})}},_onlineCheckout.RemoveDealOnClassEvent=function(t,i,a){var r=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);null!=r&&r.length>0&&e.grep(_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),function(r){e.grep(r.eventEnrollment,function(e){r.autoId==t&&e.autoID==i&&(e.discount=e.discount-a,e.price=_onlineCheckout.parseTodecimal(e.price+e.discount,2),e.actualPrice=e.price,e.actualTaxprice=_onlineCheckout.parseTodecimal(e.price*r.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+e.discount,2),r.calssdiscountprice=_onlineCheckout.parseTodecimal(r.calssdiscountprice+e.discount,2),e.isPresetApply=!1,e.isPointApply=!1,e.isPackage,e.PromotionID=0,e.IsAmount=!1,e.AmountValue=0,e.taxprice=e.actualTaxprice,e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.price,e),null!=e.gcId&&0==e.isPackage&&(e.redeemTax=e.actualTaxprice,e.redeemAmt=e.actualPrice,onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed+a))})})},_onlineCheckout.RemoveDealOnItem=function(t,i,a,r){null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&e.grep(onlineShoppingCart.GiftCertificates,function(e){e.autoId==t&&(e.Price=_onlineCheckout.parseTodecimal(e.TotalPrice,2),e.discount=0,e.ActualPrice=_onlineCheckout.parseTodecimal(e.Price,2),e.isPresetApply=!1,e.PromotionID=0,e.IsAmount=!1,e.AmountValue=0)}),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(e){e.autoId==t&&(e.productDisc=e.productDisc-a,e.Price=e.Price,e.ActualPrice=_onlineCheckout.parseTodecimal(e.ActualPrice+a,2),e.calculatedTax=_onlineCheckout.parseTodecimal(e.ActualPrice*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.ActualPrice,e),e.isPresetApply=!1,e.PromotionID=0,e.IsAmount=!1,e.AmountValue=0)}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(e){if(e.autoId==t){var i=e.NoOfVisit;e.SellPackageServiceID>0&&(i=1),a*=i,e.discount=e.discount-a,e.Price=_onlineCheckout.parseTodecimal(e.Price+a,2),e.ActualPrice=e.Price,e.calculatedTax=_onlineCheckout.parseTodecimal(e.Price*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.Price,e),e.isPresetApply=!1,e.PromotionID=0,e.IsAmount=!1,e.AmountValue=0}}),null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(r){e.grep(r.eventEnrollment,function(o){if(r.autoId==t&&o.autoID==i&&(o.discount=o.discount-a,o.price=_onlineCheckout.parseTodecimal(o.price+o.discount,2),o.actualPrice=o.price,o.actualTaxprice=_onlineCheckout.parseTodecimal(o.price*r.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+o.discount,2),r.calssdiscountprice=_onlineCheckout.parseTodecimal(r.calssdiscountprice+o.discount,2),o.isPresetApply=!1,o.isPointApply=!1,o.isPackage,o.PromotionID=0,o.IsAmount=!1,o.AmountValue=0,o.taxprice=o.actualTaxprice,o.BusinessTax=_onlineCheckout.ApplyMultipleTax(o.price,o),null!=o.gcId&&0==o.isPackage&&(o.redeemTax=o.actualTaxprice,o.redeemAmt=o.actualPrice,onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed+a)),o.isMembershipApply){var n=e.grep(onlineShoppingCart.lstMembership,function(e){return 2==e.ItemType});if(null!=n&&n.length>0){var s=e.grep(n,function(e){return o.customerID>0&&e.UserID>0&&o.customerID==e.UserID||o.customerID<=0&&e.UserID>0&&o.cUserEmail==e.EmailId});e.each(s,function(e,t){t.VisitRemaining+=1})}}})}),_onlineCheckout.RecalcGCONAllItemsAfterPreset(),void 0!==r&&1==r||_onlineCheckout.ReApplyDiscounts(!0)},_onlineCheckout.RemoveDealOnSimplePkgMultiQty=function(e,t){},_onlineCheckout.FillInvoiceLeftSideDetails=function(t){e("#divInvoiceDetails").html(""),e("#scptInvoiceDetails").tmpl(t).appendTo("#divInvoiceDetails")},_onlineCheckout.dateformate=function(e,t){return countryDateFormat(moment(e),VagaroCountryDateFormat.SmallDate)},_onlineCheckout.decimalFormate=function(e){return parseFloat(Math.round(100*e)/100).toFixed(2)},_onlineCheckout.DisplayAmountOnCart=function(e,t){var i=parseFloat(Math.round(100*parseFloat(t))/100);return i>0?e+i.toFixed(2):"Free"},_onlineCheckout.calculateSubTotalForFirstStep=function(){if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmain)){if(e("#newCartSummaryDectail123").html(""),!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events)&&onlineShoppingCartmain.Events.length>0){for(var t={randomForWorkShop:"asc",cUserEmail:"asc"},i=0;i<onlineShoppingCartmain.Events.length;i++)onlineShoppingCartmain.Events[i].eventEnrollment.length>0&&onlineShoppingCartmain.Events[i].eventEnrollment[0].IsWorkShop&&onlineShoppingCartmain.Events[i].eventEnrollment.keySort(t);_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCartmain.Events)}"true"==IsClassReschedule.toLowerCase()&&"true"==IsPaid.toString().toLowerCase()?_onlineCheckout.CalculateSubtotal_ShowDiscount(1):_onlineCheckout.isValidForCheckoutInvoice()||(_onlineCheckout.Clear_ShowDiscount(),_onlineCheckout.getUserGCDetail_ShowDiscount(1,!1))}},_onlineCheckout.calculatePromotionAmt=function(e,t,i,a,r){var o=a*r;return e>0&&("1"==t?(a<i&&(i=a),o-=i*r):o-=o*i/100),parseFloat(_onlineCheckout.decimalFormate(o))},_onlineCheckout.getBusinessWorkingHours=function(){if(null!=_onlineCheckout.businessWorkinghour&&null!=_onlineCheckout.businessWorkinghour&&_onlineCheckout.businessWorkinghour.length<=0){var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumOnlineCheckout.getbusinesshourslist,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.data={businessID:businessID},t.datamodel.callback=function(t){var i=[1,2,3,4,5,6,7];if(_onlineCheckout.businessWorkinghour=t,e.each(t,function(e,t){i.indexOf(t.DayID)>-1&&i.splice(i.indexOf(t.DayID),1)}),e.each(i,function(e,t){i[e]=t-1}),onlineShoppingCart.PickupDate=moment(Date())._d,_onlineCheckout.businessWorkinghour.length>0){var r=onlineShoppingCart.PickupDate.getDay()+1,n=new Date,s=_onlineCheckout.businessWorkinghour.filter(function(e){return e.DayID===r})[0];if(null!=s&&null!=s){n=onlineShoppingCart.PickupDate<=new Date(BusinessDate)?new Date(BusinessDate):new Date(onlineShoppingCart.PickupDate),Converttimeformat(s.ToTime)<=n.getHours()&&(onlineShoppingCart.PickupDate=new Date(onlineShoppingCart.PickupDate.setDate(onlineShoppingCart.PickupDate.getDate()+1)));var l=_onlineCheckout.businessWorkinghour.filter(function(e){return e.DayID===r})[0]}for(var d=0,c=0,u=0;u<7;u++){for(var p=0;p<i.length;p++){if(i[p]==onlineShoppingCart.PickupDate.getDay()){onlineShoppingCart.PickupDate=new Date(onlineShoppingCart.PickupDate.setDate(onlineShoppingCart.PickupDate.getDate()+1)),d=0,c=1;break}d=1}if(1==d)break}onlineShoppingCart.PickupDate<=new Date(BusinessDate)?onlineShoppingCart.PickupDate=new Date(BusinessDate):onlineShoppingCart.PickupDate;var h=onlineShoppingCart.PickupDate.getDay()+1;if(null!=typeof(l=_onlineCheckout.businessWorkinghour.filter(function(e){return e.DayID===h})[0])&&null!=l){var m=new Date;m.setHours(0,0,0,0),(a=new Date(onlineShoppingCart.PickupDate)).setHours(0,0,0,0),a.getTime()==m.getTime()&&new Date(onlineShoppingCart.PickupDate).setHours(Converttimeformat(l.FromTime),ConverttimeformattoMiniut(l.FromTime),0,0)>=(new Date).setHours(0,0,0,0)&&(Converttimeformat(l.FromTime)>(new Date).getHours()?onlineShoppingCart.PickupDate.setHours(Converttimeformat(l.FromTime),ConverttimeformattoMiniut(l.FromTime),0,0):onlineShoppingCart.PickupDate.setHours((new Date).getHours(),(new Date).getMinutes(),0,0));var f=Converttimeformat(l.ToTime),g=0;f<=onlineShoppingCart.PickupDate.getHours()&&a<=m&&0==c?(g=1,_onlineCheckout.objChecktime=1):f<=onlineShoppingCart.PickupDate.getHours()&&a>m&&0==c&&(c=1);var v=Converttimeformat(l.FromTime),A=onlineShoppingCart.PickupDate;A.setDate(A.getDate()+g),1!=g&&1!=c||A.setHours(v,ConverttimeformattoMiniut(l.FromTime),0,0),_onlineCheckout.minDate=A;var C=f,y=new Date(A);y.setDate(y.getDate()+g),y.setHours(C,ConverttimeformattoMiniut(l.ToTime),0,0),_onlineCheckout.currentTime=y,_onlineCheckout.objMin=l.FromTime,_onlineCheckout.objMax=l.ToTime,applydatepicker({divid:"#divPickupDateTime",textid:"#txtPickupDateTime",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDateWithTime),defaultDateTime:A,pickTime:!0,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,disabledWeekDays:i,disabledTimePicker:[l.FromTime,l.ToTime],disabledMobileTimePicker:_onlineCheckout.businessWorkinghour,callBackOnChange:o}),wHour=_onlineCheckout.businessWorkinghour}else applydatepicker({divid:"#divPickupDateTime",textid:"#txtPickupDateTime",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDateWithTime),defaultDateTime:onlineShoppingCart.PickupDate,pickTime:!0,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,disabledWeekDays:i,disabledMobileTimePicker:_onlineCheckout.businessWorkinghour,callBackOnChange:o})}else applydatepicker({divid:"#divPickupDateTime",textid:"#txtPickupDateTime",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDateWithTime),defaultDateTime:onlineShoppingCart.PickupDate,pickTime:!0,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,disabledWeekDays:i,callBackOnChange:o})},t.datamodel.Error=function(e){},t.Post()}};var o=function(t){e("#divPickupDateError").hide(),e("#txtPickupDateTime").removeClass("errorInput"),setTimeout(function(){onlineShoppingCart.PickupDate=moment(getdatepickervalue("#txtPickupDateTime"))._d;var e=onlineShoppingCart.PickupDate.getDay()+1;if(_onlineCheckout.businessWorkinghour.length>0){var t=_onlineCheckout.businessWorkinghour.filter(function(t){return t.DayID===e})[0];if(null!=typeof t&&null!=t){var i;Converttimeformat(t.ToTime);i=_onlineCheckout.objChecktime;var a=Converttimeformat(t.FromTime),r=new Date(_onlineCheckout.minDate);r.setDate(r.getDate()+i),r.setHours(a,ConverttimeformattoMiniut(t.FromTime),0,0),_onlineCheckout.minDate=r;var o=Converttimeformat(t.ToTime),n=new Date(_onlineCheckout.minDate);n.setDate(n.getDate()+i),n.setHours(o,ConverttimeformattoMiniut(t.ToTime),0,0),_onlineCheckout.currentTime=n,_onlineCheckout.objMin=t.FromTime,_onlineCheckout.objMax=t.ToTime,setMinMaxTimeValue({divid:"#divPickupDateTime",textid:"#txtPickupDateTime",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDateWithTime),disabledTimePicker:[t.FromTime,t.ToTime]})}}},1e3)};_onlineCheckout.CalculatePriceAndTaxOnCartForClass=function(t,i,a,r){for(var o=!0,n=!1,s=1==onlineShoppingCart.IsIncludeTaxInOnlinePricing||_onlineCheckout.IsCCDetailEnable(),l=0;l<=t.length-1;l++){var d=t[l].eventEnrollment,c=t[l].sessiondetail,u=d.uniqueObjects(["customerID","cUserEmail"]);if(u.length>0){for(var p=0;p<=u.length-1;p++){var h=[];if((1==i||0==i)&&null!=a&&a.length>0){var m=e.grep(a,function(e){return(u[p].customerID>0&&e.assignTo==u[p].customerID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,u[p].customerID)||u[p].customerID<=0&&e.emailId==u[p].cUserEmail)&&null!=e.serviceID&&(e.serviceID==t[l].eventID||e.serviceName.toLowerCase().trim()==t[l].eventName.toLowerCase().trim()&&8!=e.eventType)});null!=m&&m.length>0&&(h=m)}var f=1,g=0,v=0;e.grep(t[l].eventEnrollment,function(e){(u[p].customerID>0&&e.customerID==u[p].customerID||u[p].customerID<=0&&e.cUserEmail==u[p].cUserEmail)&&(0==e.StreamingStatus?v+=1:1==e.StreamingStatus&&(g+=1))});var A=1;g>0&&v>0?(A=2,f=3):0==v&&g>0&&(f=2);for(var C=1;C<=A;C++){var y=e.grep(t[l].eventEnrollment,function(e){return 1==C&&3==f||1==f?(u[p].customerID>0&&e.customerID==u[p].customerID||u[p].customerID<=0&&e.cUserEmail==u[p].cUserEmail)&&0==e.StreamingStatus:(u[p].customerID>0&&e.customerID==u[p].customerID||u[p].customerID<=0&&e.cUserEmail==u[p].cUserEmail)&&1==e.StreamingStatus}),b=0;b=null!=_onlineCheckout.GetRescheduleDetail()?y[0].oldPrice:1==y[0].IsWorkShop?_vgClassSessionSelection.CalcSessionPriceForOnlineWorkShop(y):1==C&&3==f||1==f?_vgClassSessionSelection.CalcSessionPrice(c,y.length,1,!1,!1):_vgClassSessionSelection.CalcSessionPrice(c,y.length,1,!1,!0);var S=_vgClassSessionSelection.ConvertTodecimal(b/y.length,2,!0),k=b/y.length,D=0,_=0,I=0;if(1==s&&(I=_vgClassSessionSelection.ConvertTodecimal(b*t[l].tax/100,2,!0),D=_vgClassSessionSelection.ConvertTodecimal(I/y.length,2,!0),_=b*t[l].tax/100/y.length),null!=y&&y.length>0){var w=0,P=0,T=0,B=0,x=0,F=0,O=0,M=0;e.each(y,function(d,c){void 0===c.IsOutsideBilling&&(c.IsOutsideBilling=!1),void 0===c.IsWaivedApply&&(c.IsWaivedApply=!1),void 0===c.isPaid&&(c.isPaid=!1);var u=d==y.length-1?_vgClassSessionSelection.ConvertTodecimal(_vgClassSessionSelection.ConvertTodecimal(b,2,!0)-w,2,!0):S;_onlineCheckout.isValidForCheckoutInvoice()&&1==c.IsWorkShop&&(u=c.price),w=_vgClassSessionSelection.ConvertTodecimal(w+u,2,!0);var p=0;if(p=1==s?d==y.length-1?_vgClassSessionSelection.ConvertTodecimal(_vgClassSessionSelection.ConvertTodecimal(I,2,!0)-P,2,!0):D:0,P=_vgClassSessionSelection.ConvertTodecimal(P+p,2,!0),c.discount=0,void 0!==c.PromotionID&&0!=c.PromotionID){var m=0;m=1==c.IsAmount?c.AmountValue:k*c.AmountValue/100,k<m&&(m=k),c.discount=m,c.discount>0&&k==c.discount&&1!=c.isPointApply&&("1"==c.PerUserOne?0==n?(n=!0,o=!1):o=!0:o=!1)}var f={};if(1==c.isPackage&&(f.price=c.price,f.actualPrice=c.actualPrice,f.actualTaxprice=c.actualTaxprice,f.taxprice=c.taxprice,f.pkgName=c.pkgName),_onlineCheckout.isValidForCheckoutInvoice()&&1!=c.isPointApply&&(void 0!==c.Originalprice?(c.price=c.Originalprice,c.actualPrice=c.Originalprice,c.actualTaxprice=c.Originaltaxprice,c.taxprice=c.Originaltaxprice):(c.price=c.actualPrice,c.actualPrice=c.actualPrice,c.actualTaxprice=c.actualTaxprice,c.taxprice=c.taxprice)),!_onlineCheckout.isValidForCheckoutInvoice()&&1!=c.isPointApply){c.price=u,c.actualPrice=k,c.actualTaxprice=_,c.taxprice=p;var g=_onlineCheckout.IsItemFmbEligible(c.PromotionID),v=_onlineCheckout.GetEffectiveIsForNewCustomer();g&&!0===v?(c.dailydealFee=(c.actualPrice-c.discount)*dailyDealFeeValue/100,c.FMBPercentage=dailyDealFeeValue):g&&!1===v?(c.dailydealFee=(c.actualPrice-c.discount)*dailyDealFeeValue_ExistingUser/100,c.FMBPercentage=dailyDealFeeValue_ExistingUser):(c.dailydealFee=0,c.FMBPercentage=0),Number(c.dailydealFee)>0&&(c.isPointApply=!1,1!=c.isPackage&&(c.gcId=0,c.isPriceBaseGCApply=!1),e("#divGiftCertificateCart").hide(),e("#divCheckoutBookingPromoCode").hide()),!String.isNullOrUndefineOrBlank(c.lstAddonService)&&c.lstAddonService.length>0&&e.each(c.lstAddonService,function(t,i){var a=_onlineCheckout.IsItemFmbEligible(i.PromotionID),r=_onlineCheckout.GetEffectiveIsForNewCustomer();a&&!0===r?(i.dailydealFee=(i.Originalprice-i.AmountValue)*dailyDealFeeValue/100,i.FMBPercentage=dailyDealFeeValue):a&&!1===r?(i.dailydealFee=(i.Originalprice-i.AmountValue)*dailyDealFeeValue_ExistingUser/100,i.FMBPercentage=dailyDealFeeValue_ExistingUser):(i.dailydealFee=0,i.FMBPercentage=0),(Number(i.dailydealFee)>0||Number(c.dailydealFee)>0)&&(i.isPointApply=!1,1!=i.isPackage&&(i.gcId=0,i.isPriceBaseGCApply=!1),e("#divCheckoutBookingPromoCode").hide())})}if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==c.isPresetApply&&1==c.isPresetApply)c.isDecisionTaken=!1;else if((1!=c.isDecisionTaken&&(1==i||0==i)||1==r&&1==c.isDecisionTaken&&(1==c.isPackage||0==c.isPackage))&&h.length>0&&c.price>0)if(1==i||1==r){var A=[];if(1!=c.isPointApply&&0==c.isPaid&&(A=e.grep(h,function(e){return null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(c.eventDate).format("YYYY/MM/DD"))>new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))&&null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(c.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))&&(0==c.IsOutsideBilling&&(c.strAdvanceLimitDate=e.strAdvanceLimitDate),c.IsWaivedApply=!0,c.AppliedName=e.pkgName),(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(c.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))})),Number(c.dailydealFee)>0&&(A=e.grep(A,function(e){return e&&1==e.isPackage})),A.length>0){var C=A[0];if(0==C.isPackage)1==o&&(c.redeemAmt=c.price,C.quantity-=1,C.currentBalance-=c.redeemAmt);else if(1==o){var E=0,$=[];1==C.isCustomPackage?$=e.grep(a,function(e){if(1==e.isCustomPackage&&null==e.serviceID&&e.giftCertificateID==C.giftCertificateID)return E=0==e.quantity?0:Math.floor(parseFloat((e.currentBalance/e.quantity*100).toFixed(2)))/100,!0}):E=Math.floor(parseFloat((C.currentBalance/C.quantity*100).toFixed(2)))/100,1==C.isCustomPackage&&void 0!==C.serviceID&&C.serviceID>0&&(c.RedeemServiceId=C.serviceID),-1==C.quantity&&(E=0),c.redeemAmt=E,c.price=E,c.actualPrice=E,c.actualTaxprice=0,c.taxprice=0,1==C.isCustomPackage?(null!=C.groupID&&0!=C.groupID&&-1!=C.quantity?e.grep(a,function(e){e.giftCertificateID==C.giftCertificateID&&e.groupID==C.groupID&&(e.quantity=e.quantity-1)}):null==C.groupID&&-1!=C.quantity&&(C.quantity=C.quantity-1),$.length>0&&-1!=C.quantity&&($[0].currentBalance=parseFloat(parseFloat($[0].currentBalance)-E),$[0].quantity=$[0].quantity-1)):(C.quantity-=1,C.currentBalance-=E)}1==o?(c.gcId=C.giftCertificateID,c.giftCertificateNo=C.giftCertificateNo,c.isPackage=C.isPackage,c.pkgName=C.pkgName,0==C.isCustomPackage&&String.isNullOrUndefineOrBlank(C.pkgName)&&(c.pkgName=C.serviceName),c.isDecisionTaken=!0):(c.gcId=0,c.isPackage=null)}else c.gcId=0,c.isPackage=null}else 0==i&&(c.isPackage=null,c.isDecisionTaken=!0);else 1==c.isPackage&&1==f.hasOwnProperty("price")&&(c.price=f.price,c.actualPrice=f.actualPrice,c.actualTaxprice=f.actualTaxprice,c.taxprice=f.taxprice,c.pkgName=f.pkgName,0==f.isCustomPackage&&String.isNullOrUndefineOrBlank(f.pkgName)&&(c.pkgName=f.serviceName));if(1==s&&(1!=c.isPackage?(x=_vgClassSessionSelection.ConvertTodecimal(x+c.price,2,!0),F=_vgClassSessionSelection.ConvertTodecimal(F+c.actualPrice,10,!0),M+=1):1==c.isPackage&&(O+=1),T=_vgClassSessionSelection.ConvertTodecimal(T+c.taxprice,2,!0),B=_vgClassSessionSelection.ConvertTodecimal(B+c.actualTaxprice,10,!0),O>0&&M>0&&d==y.length-1))for(var N=_vgClassSessionSelection.ConvertTodecimal(x*t[l].tax/100,2,!0),L=parseFloat((N-T).toFixed(2)),U=_vgClassSessionSelection.ConvertTodecimal(F*t[l].tax/100,2,!0),R=parseFloat((U-B).toFixed(2)),G=y.length-1;G>=0;G--)if(1!=y[G].isPackage){y[G].actualTaxprice=_vgClassSessionSelection.ConvertTodecimal(y[G].actualTaxprice+R,10,!0),y[G].taxprice=_vgClassSessionSelection.ConvertTodecimal(y[G].taxprice+L,2,!0);break}var W=!0;e.each(c.lstAddonService,function(t,s){var l=[];if((1==i||0==i)&&null!=a&&a.length>0){var d=e.grep(a,function(e){return(s.customerID>0&&e.assignTo==s.customerID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,s.customerID)||s.customerID<=0&&e.emailId==s.cUserEmail)&&null!=e.serviceID&&(e.serviceID==s.ServiceId||e.serviceName.toLowerCase().trim()==s.ServiceTitle.toLowerCase().trim()&&2!=e.eventType)});null!=d&&d.length>0&&(l=d)}if(void 0===s.IsOutsideBilling&&(s.IsOutsideBilling=!1),void 0===s.IsWaivedApply&&(s.IsWaivedApply=!1),void 0===s.isPaid&&(s.isPaid=!1),s.discount=0,void 0!==s.PromotionID&&0!=s.PromotionID){var u=0;u=1==s.IsAmount?s.AmountValue:s.Originalprice*s.AmountValue/100,s.Originalprice<u&&(u=s.Originalprice),s.discount=u,s.discount>0&&s.Originalprice==s.discount&&1!=s.isPointApply&&("1"==s.PerUserOne?0==n?(n=!0,W=!1):W=!0:W=!1)}var p={};if(1==s.isPackage&&(p.price=s.Price,p.actualPrice=s.actualPrice,p.actualTaxprice=s.actualTaxprice,p.taxprice=s.taxprice,p.pkgName=s.pkgName),_onlineCheckout.isValidForCheckoutInvoice()&&1!=s.isPointApply&&(void 0!==s.Originalprice?(s.Price=s.Originalprice,s.actualPrice=s.Originalprice,s.actualTaxprice=s.Originaltaxprice,s.taxprice=s.Originaltaxprice):(s.Price=s.actualPrice,s.actualPrice=s.actualPrice,s.actualTaxprice=s.actualTaxprice,s.taxprice=s.taxprice)),_onlineCheckout.isValidForCheckoutInvoice()||1==s.isPointApply||(s.Price=s.Originalprice,s.actualPrice=s.Price,s.actualTaxprice=parseFloat(s.Price)*s.tax/100,s.taxprice=_vgClassSessionSelection.ConvertTodecimal(parseFloat(s.Price)*s.tax/100,2,!0)),_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==s.isPresetApply&&1==s.isPresetApply)s.isDecisionTaken=!1;else if((1!=s.isDecisionTaken&&(1==i||0==i)||1==r&&1==s.isDecisionTaken&&(1==s.isPackage||0==s.isPackage))&&l.length>0&&s.Price>0)if(1==i||1==r){var h=[];if(1!=s.isPointApply&&0==s.isPaid&&(h=e.grep(l,function(e){return null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(c.eventDate).format("YYYY/MM/DD"))>new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))&&null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(c.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))&&(0==s.IsOutsideBilling&&(s.strAdvanceLimitDate=e.strAdvanceLimitDate),s.IsWaivedApply=!0,s.AppliedName=e.pkgName),(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(c.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))})),Number(s.dailydealFee)>0&&(h=e.grep(h,function(e){return e&&1==e.isPackage})),h.length>0){var m=h[0];if(0==m.isPackage)1==W&&(s.redeemAmt=s.Price,m.quantity-=1,m.currentBalance-=s.redeemAmt);else if(1==W){var f=0,g=[];1==m.isCustomPackage?g=e.grep(a,function(e){if(1==e.isCustomPackage&&null==e.serviceID&&e.giftCertificateID==m.giftCertificateID)return f=0==e.quantity?0:Math.floor(parseFloat((e.currentBalance/e.quantity*100).toFixed(2)))/100,!0}):f=Math.floor(parseFloat((m.currentBalance/m.quantity*100).toFixed(2)))/100,1==m.isCustomPackage&&void 0!==m.serviceID&&m.serviceID>0&&(s.RedeemServiceId=m.serviceID),-1==m.quantity&&(f=0),s.redeemAmt=f,s.Price=f,s.actualPrice=f,s.actualTaxprice=0,s.taxprice=0,1==m.isCustomPackage?(null!=m.groupID&&0!=m.groupID&&-1!=m.quantity?e.grep(a,function(e){e.giftCertificateID==m.giftCertificateID&&e.groupID==m.groupID&&(e.quantity=e.quantity-1)}):null==m.groupID&&-1!=m.quantity&&(m.quantity=m.quantity-1),g.length>0&&-1!=m.quantity&&(g[0].currentBalance=parseFloat(parseFloat(g[0].currentBalance)-f),g[0].quantity=g[0].quantity-1)):(m.quantity-=1,m.currentBalance-=f)}1==o?(s.gcId=m.giftCertificateID,s.giftCertificateNo=m.giftCertificateNo,s.isPackage=m.isPackage,s.pkgName=m.pkgName,0==m.isCustomPackage&&String.isNullOrUndefineOrBlank(m.pkgName)&&(s.pkgName=m.serviceName),s.isDecisionTaken=!0):(s.gcId=0,s.isPackage=null)}else s.gcId=0,s.isPackage=null}else 0==i&&(s.isPackage=null,s.isDecisionTaken=!0);else 1==s.isPackage&&1==p.hasOwnProperty("price")&&(s.Price=p.price,s.actualPrice=p.actualPrice,s.actualTaxprice=p.actualTaxprice,s.taxprice=p.taxprice,s.pkgName=p.pkgName)})})}}if(p==u.length-1){var E,$=0,N=0,L=0,U=0,R=0,G=0,W=0,V=0,j=0,H=!1,Y=0,Z=0;if(e.grep(t[l].eventEnrollment,function(e){e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.price,e),e.IsPartialPoint=void 0!==e.IsPartialPoint&&e.IsPartialPoint,$=e.IsPartialPoint&&1==_onlineCheckout.isValidForCheckoutInvoice()?void 0!==e.depositsPercentage&&!String.isNullOrUndefineOrBlank(e.depositsPercentage)&&e.depositsPercentage<100?_vgClassSessionSelection.ConvertTodecimal($+e.Originalprice,2,!0):_vgClassSessionSelection.ConvertTodecimal($+e.price,2,!0):e.IsPartialPoint&&"undefined"!=typeof onlineShoppingCartmain&&void 0!==onlineShoppingCartmain.DepositsPer&&onlineShoppingCartmain.DepositsPer<100?_vgClassSessionSelection.ConvertTodecimal($+e.Originalprice,2,!0):_vgClassSessionSelection.ConvertTodecimal($+e.price,2,!0),1==e.IsPartialPoint&&(j=_vgClassSessionSelection.ConvertTodecimal(j+e.PartialPrice,2,!0),Y=_vgClassSessionSelection.ConvertTodecimal(Y+(e.Originalprice-e.discount),2,!0),Z=_vgClassSessionSelection.ConvertTodecimal(Z+(e.Originalprice-e.PartialPrice),2,!0),H=!0),N=_vgClassSessionSelection.ConvertTodecimal(N+e.taxprice,2,!0),L=_vgClassSessionSelection.ConvertTodecimal(L+e.actualPrice,10,!0),U="undefined"==typeof onlineShoppingCart||null==onlineShoppingCart||void 0===onlineShoppingCart.BusinessID||null==onlineShoppingCart.BusinessID||241902!=onlineShoppingCart.BusinessID&&306501!=onlineShoppingCart.BusinessID?_vgClassSessionSelection.ConvertTodecimal(U+e.actualTaxprice,10,!0):0==U&&0==e.actualTaxprice?0:_shopdetail.ConvertDecimalCustomRound(_vgClassSessionSelection.ConvertTodecimal(U+e.actualTaxprice,10,!0),!0,2),parseFloat(e.deposit)>0&&(W=_vgClassSessionSelection.ConvertTodecimal(W+e.deposit,2,!0)),_onlineCheckout.ApplyMultipleAddonTax(e.lstAddonService);var t=_onlineCheckout.GetTotalPriceAddonEvent(e);R=_vgClassSessionSelection.ConvertTodecimal(R+t.TotalAddonPrice,2,!0),G=_vgClassSessionSelection.ConvertTodecimal(G+t.TotalAddonTax,2,!0),V=_vgClassSessionSelection.ConvertTodecimal(V+t.TotalAddonDeposit,2,!0)}),u.length>1)if($!=L||1==s&&N!=U){for(var z=t[l].eventEnrollment.length-1;z>=0&&1==(E=t[l].eventEnrollment[z]).isPackage;z--);if($!=L){var X=0;X=parseFloat((L-$).toFixed(2)),E.price=_vgClassSessionSelection.ConvertTodecimal(E.price+X,2,!0),$=_vgClassSessionSelection.ConvertTodecimal($+X,2,!0)}if(1==s&&N!=U){var q=0;q=parseFloat((U-N).toFixed(2)),E.taxprice=_vgClassSessionSelection.ConvertTodecimal(E.taxprice+q,2,!0),N=_vgClassSessionSelection.ConvertTodecimal(N+q,2,!0)}}t[l].actualPrice=L,t[l].roundedPrice=$,t[l].actualTaxprice=U,t[l].roundedTaxprice=N,t[l].deposit=W,t[l].calcAddonTotalPrice=R,t[l].calcPerAddonTotalTax=G,t[l].addonDeposit=V,t[l].TotalPartialPrice=j,t[l].IsPartialPoint=H,t[l].DisplayOriginalprice=Y,t[l].DisplayAfterPartialPointPrice=Z}}1==u.length&&u[0].customerID==parseInt(UserID)&&e.each(t[l].eventEnrollment,function(){this.IsshowUserName=!1})}if(l==t.length-1){var J=0,Q=0,K=0,ee=0,te=0,ie=0,ae=0,re=0,oe=0;if(e.grep(t,function(e){J=_vgClassSessionSelection.ConvertTodecimal(J+e.roundedPrice,2,!0),Q=_shopdetail.CheckPriceWithTaxSwitch()&&_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(e.deposit)&&e.deposit>0?_onlineCheckout.parseTodecimal(e.deposit*e.tax/100,2):_vgClassSessionSelection.ConvertTodecimal(Q+e.roundedTaxprice,2,!0),re=_vgClassSessionSelection.ConvertTodecimal(re+e.TotalPartialPrice,2,!0),_onlineCheckout.parseTodecimal(e.deposit,2)>0&&(K=_vgClassSessionSelection.ConvertTodecimal(K+e.deposit,2,!0)),ee+=e.actualPrice,te+=e.actualTaxprice,ie=_vgClassSessionSelection.ConvertTodecimal(ie+e.calcAddonTotalPrice,2,!0),ae=_vgClassSessionSelection.ConvertTodecimal(ae+e.calcPerAddonTotalTax,2,!0),oe=_vgClassSessionSelection.ConvertTodecimal(oe+e.addonDeposit,2,!0)}),ee=_vgClassSessionSelection.ConvertTodecimal(ee,2,!0),te=_vgClassSessionSelection.ConvertTodecimal(te,2,!0),re=_vgClassSessionSelection.ConvertTodecimal(re,2,!0),t.length>1&&(ee!=J||1==s&&Q!=te)){var ne,se;e:for(var le=t.length-1;le>=0;le--)for(var de=t[le].eventEnrollment.length-1;de>=0;de--)if(ne=t[le].eventEnrollment[de],se=t[le],1!=ne.isPackage)break e;if(ee!=J){X=0;X=parseFloat((ee-J-re).toFixed(2)),ne.price=_vgClassSessionSelection.ConvertTodecimal(ne.price+X,2,!0),se.roundedPrice=_vgClassSessionSelection.ConvertTodecimal(se.roundedPrice+X,2,!0),J=_vgClassSessionSelection.ConvertTodecimal(J+X,2,!0)}if(1==s&&Q!=te){q=0;q=parseFloat((te-Q).toFixed(2)),ne.taxprice=_vgClassSessionSelection.ConvertTodecimal(ne.taxprice+q,2,!0),se.roundedTaxprice=_vgClassSessionSelection.ConvertTodecimal(se.roundedTaxprice+q,2,!0),Q=_vgClassSessionSelection.ConvertTodecimal(Q+q,2,!0)}}var ce=0,ue=0;e.grep(t,function(t){var i=0,a=0,r=0;t.classGCUsed=0,e.grep(t.eventEnrollment,function(o){if(1==o.isPackage?(ue=_vgClassSessionSelection.ConvertTodecimal(ue+o.price,2,!0),a=_vgClassSessionSelection.ConvertTodecimal(a+o.price,2,!0),t.classGCUsed=_vgClassSessionSelection.ConvertTodecimal(t.classGCUsed+o.price,2,!0)):0==o.isPackage&&(ce=_vgClassSessionSelection.ConvertTodecimal(ce+o.price,2,!0),i=_vgClassSessionSelection.ConvertTodecimal(i+o.price,2,!0),t.classGCUsed=_vgClassSessionSelection.ConvertTodecimal(t.classGCUsed+o.price,2,!0)),void 0!==o.discount&&(r+=o.discount),null!=o.lstAddonService&&null!=o.lstAddonService&&o.lstAddonService.length>0){e.grep(o.lstAddonService,function(e){e.classAddonGCUsed=0,e.discountdd=0,e.IsPartialPoint=void 0!==e.IsPartialPoint&&null!=e.IsPartialPoint&&""!=e.IsPartialPoint,1==e.isPackage?(ue=_vgClassSessionSelection.ConvertTodecimal(ue+e.Price,2,!0),e.classAddonGCUsed=_vgClassSessionSelection.ConvertTodecimal(e.Price,2,!0)):0==e.isPackage&&(ce=_vgClassSessionSelection.ConvertTodecimal(ce+e.Price,2,!0),e.classAddonGCUsed=_vgClassSessionSelection.ConvertTodecimal(e.Price,2,!0)),void 0!==e.discount&&(e.discountdd=e.discount),1==e.IsPartialPoint&&"undefined"!=typeof onlineShoppingCartmain&&void 0!==onlineShoppingCartmain.DepositsPer&&onlineShoppingCartmain.DepositsPer<100?e.displayroundedPrice=_vgClassSessionSelection.ConvertTodecimal(e.Originalprice-e.discount,2,!0):e.displayroundedPrice=_vgClassSessionSelection.ConvertTodecimal(e.Price,2,!0),e.roundedPrice=_vgClassSessionSelection.ConvertTodecimal(e.Price,2,!0),1==e.IsPartialPoint&&(e.DisplayOriginalprice=e.actualPrice,e.DisplayAfterPartialPointPrice=_vgClassSessionSelection.ConvertTodecimal(e.actualPrice-e.PartialPrice,2,!0))})}}),t.displayroundedPrice=parseFloat(t.roundedPrice.toFixed(2)),t.roundedPrice=parseFloat((t.roundedPrice-(i+a)).toFixed(2)),t.actualPrice=t.roundedPrice,t.displayPartialRoundedPrice=parseFloat(t.TotalPartialPrice.toFixed(2)),t.IsPartialPoint=t.IsPartialPoint,t.DisplayOriginalprice=t.DisplayOriginalprice,t.DisplayAfterPartialPointPrice=t.DisplayAfterPartialPointPrice,t.discountdd=r});var pe=parseFloat((J+Q+ie+ae-(ce+ue)).toFixed(2));onlineShoppingCart.classSubTotal=parseFloat((J+ie).toFixed(2)),_onlineCheckout.parseTodecimal(K,2)>0&&(onlineShoppingCart.depositTotal=onlineShoppingCart.depositTotal+_onlineCheckout.parseTodecimal(K,2)+_onlineCheckout.parseTodecimal(oe,2)),onlineShoppingCart.classTax=parseFloat((Q+ae).toFixed(2)),onlineShoppingCart.classGCUsed=ce,onlineShoppingCart.classPackageUsed=ue,onlineShoppingCart.classFinalTotal=pe}}return t},_onlineCheckout.GetRescheduleDetail=function(){var t=e("#hdnRescheduleDetail");if(""==t.val())return null;try{return JSON.parse(t.val())}catch(e){return null}},_onlineCheckout.IsCCDetailEnable=function(){try{return!!_onlineCheckout.isValidForCheckoutInvoice()||"true"==IsEnableMerchantAccount.toLowerCase()&&"true"==isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsOnLineShoppingCart.toLowerCase()&&(("true"!=IsClassReschedule.toLowerCase()||"true"!=IsPaid.toString().toLowerCase())&&1!=e("#tabVagaroPayLater").hasClass("w--current"))}catch(e){return!1}},_onlineCheckout.IsDepositItemExists=function(t){if((null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0||!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&("true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)&&("false"==IsClassReschedule.toLowerCase()||"true"==IsClassReschedule.toLowerCase()&&(void 0===IsPaid||"false"==IsPaid.toString().toLowerCase()))||null!=t&&1==t.isSaveClassCard))&&null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0||null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&_onlineCheckout.IsVCFFeeApplied()||1==_onlineCheckout.IsPaidClass())return!0;var i=!0;return null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(e){e.paidType!=_onlineCheckout.arrpaidType.PaidClass&&e.paidType!=_onlineCheckout.arrpaidType.Paid&&(i=!1)})}),!!((null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0||!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&1==i)&&null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0)},_onlineCheckout.IsPaidClass=function(){var t=!0;return null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(e.grep(onlineShoppingCart.Events,function(i){!String.isNullOrUndefineOrBlank(i.eventEnrollment)&&i.eventEnrollment.length>0&&e.grep(i.eventEnrollment,function(e){e.paidType!=_onlineCheckout.arrpaidType.PaidClass&&e.paidType!=_onlineCheckout.arrpaidType.Paid&&e.paidType!=_onlineCheckout.arrpaidType.DepositsClass&&(t=!1)})}),!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&1==t)},_onlineCheckout.IsCalculateAndDisplayFeeOnline=function(e){return e?"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove:!(1==_onlineCheckout.IsClassBookingOnly(!0)&&"true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove))||"false"!=IsClassReschedule.toLowerCase()&&("true"!=IsClassReschedule.toLowerCase()||void 0!==IsPaid&&"false"!=IsPaid.toString().toLowerCase())},_onlineCheckout.loginUserClassCheckoutAmount=function(){var t=0;if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events))e.grep(onlineShoppingCartmain.Events,function(i){if(void 0!==i.eventEnrollment&&i.eventEnrollment.length>0)e.grep(i.eventEnrollment,function(e){t=_onlineCheckout.parseTodecimal(t+e.price-e.discount,2)})});return t},_onlineCheckout.validatePhone=function(t,i){var a=_onlineCheckout.CountryID,r=e(t),o=r.val().replace(/([()-\s])+/g,""),n=o.length;if(n<=0)return"txtCell"==r.attr("id")?(e(i).show(),e(i).html("required."),r.addClass("errorInput"),!1):(e(i).hide(),e(i).html(""),r.removeClass("errorInput"),!0);if(n>0)if(2!=a&&11==n&&0==o[0]&&(n=(o=o.substring(1)).length),1==a||3==a){if(10!=n)return r.val(o),"#revtxtnightphoneCust"==i?(e("#revtxtnightphoneCust").attr("style","display:inline"),e(i).html("Night phone should be of 10 digits.")):"#revtxtdayphoneCust"==i?(e("#revtxtdayphoneCust").attr("style","display:inline"),e(i).html("Day phone should be of 10 digits.")):("#divInvalidMobileMessage"==i&&e("#divInvalidMobileMessage").attr("style","display:inline"),e(i).html("Phone number should be of 10 digits")),r.addClass("errorInput"),e(i).show(),!1}else if(2==a){if(n<10||n>11)return r.val(o),"#revtxtnightphoneCust"==i?(e("#revtxtnightphoneCust").attr("style","display:inline"),e(i).html("Night phone should be of 10 or 11 digits.")):"#revtxtdayphoneCust"==i?(e("#revtxtdayphoneCust").attr("style","display:inline"),e(i).html("Day phone should be of 10 or 11 digits.")):("#divInvalidMobileMessage"==i&&e("#divInvalidMobileMessage").attr("style","display:inline"),e(i).html("Phone number should be of 10 or 11 digits")),r.addClass("errorInput"),e(i).show(),!1;10==n&&0!=o[0]?n=(o=0+o).length:(n<=10||12==n)&&0==o[0]&&(n=(o=o.substring(1)).length),r.val(o.replace(/(\d{3})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3"))}else if(4==a){if(n<9||n>10)return r.val(o),"#revtxtnightphoneCust"==i?(e("#revtxtnightphoneCust").attr("style","display:inline"),e(i).html("Night phone should be of 9 or 10 digits.")):"#revtxtdayphoneCust"==i?(e("#revtxtdayphoneCust").attr("style","display:inline"),e(i).html("Day phone should be of 9 or 10 digits.")):("#divInvalidMobileMessage"==i&&e("#divInvalidMobileMessage").attr("style","display:inline"),e(i).html("Phone number should be of 9 or 10 digits")),r.addClass("errorInput"),e(i).show(),!1;9==n&&0!=o[0]?n=(o=0+o).length:(n<=9||n>10)&&0==o[0]&&(n=(o=o.substring(1)).length),r.val(o.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3"))}return e(i).hide(),r.removeClass("errorInput"),!0},_onlineCheckout.Phone_format=function(t,i,a){null!=typeof(a=_onlineCheckout.CountryID)&&null!=a&&""!=a&&(countryID=a);var r=e(t);/\D/g.test(r.val())&&r.val(r.val().replace(/\D/g,"")),1==countryID?r.removeClass("cntry-ca").addClass("cntry-us"):3==countryID?r.removeClass("cntry-us").addClass("cntry-ca"):r.removeClass("cntry-ca cntry-us");var o=r.val().replace(/([()-\s])+/g,""),n=o.length;if(!(n<=0)){r.removeClass("errorInput");return String.isNullOrUndefineOrBlank(o)||/^\d+$/.test(o)?(e(i).hide(),2!=countryID&&11==n&&0==o[0]&&(n=(o=o.substring(1)).length),1!=countryID&&3!=countryID||10!=n?2==countryID?(10==n&&0!=o[0]?n=(o=0+o).length:(n<=10||12==n)&&0==o[0]&&(n=(o=o.substring(1)).length),10==n||11==n?(r.val(o.replace(/(\d{3})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3")),!0):r.val(o)):4==countryID?(9==n&&0!=o[0]?n=(o=0+o).length:(n<=9||n>10)&&0==o[0]&&(n=(o=o.substring(1)).length),9==n||10==n?(r.val(o.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3")),!0):r.val(o)):r.val(o):(3==countryID?r.val(o.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"$1-$2-$3")):r.val(o.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1) $2-$3")),!0),!0):(event.preventDefault(),!1)}},_onlineCheckout.ValidateEmail=function(){return""==e("#emailid").val()?(e("#lblInvalidEmail").hide(),!0):_onlineCheckout.isValidEmailAddress(e("#emailid").val())?(e("#lblInvalidEmail").hide(),e("#emailid").removeClass("errorInput"),e('[id*="spanVendorEmailRequire"]').hide(),!0):(e("#lblInvalidEmail").show(),e("#emailid").removeClass("errorInput"),e('[id*="spanVendorEmailRequire"]').hide(),e("#emailid").addClass("errorInput"),!1)},_onlineCheckout.isValidEmailAddress=function(e){return new RegExp(/^[A-Za-z0-9_\+-]+(\.[A-Za-z0-9_\+-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.([A-Za-z]{2,10})$/g).test(e)},_onlineCheckout.ShowCountry=function(){return e(".countryselectmyacprofile").is(":visible")?void e(".countryselectmyacprofile").hide():void e(".countryselectmyacprofile").show()},_onlineCheckout.setDialingCode=function(t){var i="";switch(e(".txtCell").removeClass(function(e,t){return(t.match(/(^|\s)cntry-\S+/g)||[]).join(" ")}),e("#txtNightPhone").removeClass(function(e,t){return(t.match(/(^|\s)cntry-\S+/g)||[]).join(" ")}),e("#txtDayPhone").removeClass(function(e,t){return(t.match(/(^|\s)cntry-\S+/g)||[]).join(" ")}),t){case 1:i="+1",e(".txtCell").addClass("cntry-us"),e("#txtNightPhone").addClass("cntry-us"),e("#txtDayPhone").addClass("cntry-us");break;case 2:i="+44";break;case 3:i="+1",e(".txtCell").addClass("cntry-ca"),e("#txtNightPhone").addClass("cntry-ca"),e("#txtDayPhone").addClass("cntry-ca");break;case 4:i="+61"}e(".country-icon").text(i)},_onlineCheckout.selectCountry=function(t){e("#txtAddressVPL").select2("val"," "),e(".selectedCountrudiv").attr("data-country",t),e(".selectedCountrudiv").removeClass().addClass("selectedcountry "+B[t]+" Selected selectedCountrudiv"),e("#temphdncountryid").val(t),e("#txtAddressVPL").select2("focus"),_onlineCheckout.setDialingCode(t),_onlineCheckout.Phone_format(".txtCell","#divInvalidMobileMessage",t),_onlineCheckout.BindState(),e(".countryselectoption").hide()},_onlineCheckout.UpdateAffirmUserData=function(){if(String.isNullOrUndefineOrBlank(e("#emailid").val()))return _onlineCheckout.WarningMessage("Please enter emailId"),!1;if(0==_onlineCheckout.ValidateEmail())return _onlineCheckout.WarningMessage("Please enter valid emailId"),!1;if(String.isNullOrUndefineOrBlank(e("#txtAddressVPL").val()))return _onlineCheckout.WarningMessage("Please enter address"),!1;if(_onlineCheckout.IsVPLAddress=1,""!=e("#txtAddressVPL").val().trim()){if(!_onlineCheckout.validateNewShippingAddressData())return!1}else e(".cboRState").val("-1");return _onlineCheckout.CustomerDetails=JSON.parse(e("#hdnUserDetails").val()),_onlineCheckout.CustomerDetails.EmailId=e("#emailid").val().trim(),_onlineCheckout.CustomerDetails.Cell=ShoppingBagVPLCell.getPhoneData().phoneNo,_onlineCheckout.CustomerDetails.Street=e("#txtNewStreet").val().trim(),_onlineCheckout.CustomerDetails.BirthDate=new Date(e("#cboYear").val()+"-"+e("#cboMonth").val()+"-"+e("#cboDay").val()),_onlineCheckout.CustomerDetails.City=e("#txtNewCity").val().trim(),_onlineCheckout.CustomerDetails.CountryID=_onlineCheckout.CountryID,_onlineCheckout.CustomerDetails.Zip=e("#txtNewZip").val().trim(),_onlineCheckout?.selectedAddressData?.statecode&&(_onlineCheckout.CustomerDetails.StateCode=_onlineCheckout.selectedAddressData.statecode),e("#hdnUserDetails").val(JSON.stringify(_onlineCheckout.CustomerDetails)),e("#lblterms").removeClass("termsConditionText"),!0},_onlineCheckout.ProccessBank=function(){if(!ShoppingBagVPLCell.validatePhoneNumber(!0)){var t=ShoppingBagVPLCell.getValidateMessage();return 1==t.WarningType?_onlineCheckout.WarningMessage("Please enter mobile no"):_onlineCheckout.WarningMessage(t.WarningMessage),!1}if(String.isNullOrUndefineOrBlank(e("#emailid").val()))return _onlineCheckout.WarningMessage("Please enter emailId"),!1;if(0==_onlineCheckout.ValidateEmail())return _onlineCheckout.WarningMessage("Please enter valid emailId"),!1;if(0==_siteBuilderDetail.isAffirmEnable&&(!_onlineCheckout.checkBirthDate()||"-1"==e("#cboDay").val()&&"-1"==e("#cboMonth").val()&&"-1"==e("#cboYear").val()))return _onlineCheckout.WarningMessage("Invalid Birth Date"),!1;if(String.isNullOrUndefineOrBlank(e("#txtAddressVPL").val()))return _onlineCheckout.WarningMessage("Please enter address"),!1;if(_onlineCheckout.IsVPLAddress=1,""!=e("#txtAddressVPL").val().trim()){if(!_onlineCheckout.validateNewShippingAddressData())return!1}else e(".cboRState").val("-1");IsEmailPhoneChanged=!1;var i=e("#hdnEmailBeforeChange").val(),a=e("#hdnCellNoBeforeChange").val(),r=i!=e("#emailid").val(),o=a!=ShoppingBagVPLCell.getPhoneData().phoneNo;if(1!=r&&1!=o||(_onlineCheckout.VPLTwoFactorStatus=1==r&&1==o?_onlineCheckout.VPLTwoFactor.EmailAndCell:1==r?_onlineCheckout.VPLTwoFactor.Email:_onlineCheckout.VPLTwoFactor.Cell),_onlineCheckout.VPLTwoFactorStatus!=_onlineCheckout.VPLTwoFactor.None)if(e("#dvtwostepemailcodeinfo").length<=0&&e("body").append('<div id="dvtwostepemailcodeinfo" role="none"></div>'),currentPage="ShoppingBag",TwoFactorPageType=currentPage,e("#hdnEmailAndCell2FScreenVPL").val()>_twoFactor.EmailAndCell2FScreen.None){if(_onlineCheckout.VPLTwoFactorStatus==_onlineCheckout.VPLTwoFactor.EmailAndCell||_onlineCheckout.VPLTwoFactorStatus==_onlineCheckout.VPLTwoFactor.Email){authenticationMode=_twoFactor.AuthCodeReceiveMode.Email,IsEmailPhoneChanged=_onlineCheckout.VPLTwoFactorStatus==_onlineCheckout.VPLTwoFactor.EmailAndCell;var n='"strUserName" :""';n+=',"strEmailID" :"'+e("#emailid").val()+'"',CallWebServicehed("MySampleService.asmx/CheckUserNameAvailabilityWithUserID",n+=',"UserID" :'+parseInt(_onlineCheckout.CustomerDetails.UserID),_onlineCheckout.CallSuccessWithEmail,_onlineCheckout.CallFailed)}else _onlineCheckout.VPLTwoFactorStatus==_onlineCheckout.VPLTwoFactor.Cell&&(authenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,_onlineCheckout.GetfilterrequestDataByEmail());IsEmailPhoneChanged=!0}else _onlineCheckout.SaveVPLUSerDetailProfile();else _onlineCheckout.SaveVPLUSerDetailProfile()},_onlineCheckout.GetfilterrequestDataByEmail=function(){ShowLoader(!0);var t={};String.isNullOrUndefineOrBlank(fpDeviceId)||(t.UserAgent=navigator.userAgent,t.VisitorID=fpDeviceId),t.UserEmail=e("#emailid").val(),t.OwnersPhone=ShoppingBagVPLCell.getPhoneData().phoneNo,t.IP=e("#hdnIPAddress").val(),t.UserId=parseInt(_onlineCheckout.CustomerDetails.UserID);var i=new vagaro.ajax;i.datamodel.Token="websiteapi/myaccount/getdatabybrowservisitorid",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=t,i.datamodel.callback=function(t){if(null!=typeof t&&null!=t&&(userccattemptdata=t),null!=typeof userccattemptdata&&null!=userccattemptdata){if(1==userccattemptdata.IsBlock)return ShowLoader(!1),String.isNullOrUndefineOrBlank(userccattemptdata.BlockErrorCode)||"XJ140"!=userccattemptdata.BlockErrorCode||(e("#divConfirmBox").find(".w-button-default").attr("value","Ok"),_onlineCheckout.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)),void(IsBlocked=!0);if(IsBlocked=!1,"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.ShoppingBag){TwoFactorPageType=_twoFactor.PageType.ShoppingBag;var i={};i.emailid=e("#emailid").val(),i.phone=ShoppingBagVPLCell.getPhoneData().phoneNo,i.fullname=_onlineCheckout.CustomerDetails.FirstName+" "+_onlineCheckout.CustomerDetails.LastName,i.CountryID=ShoppingBagVPLCell.getPhoneData().countryId,i.IP=e("#hdnIPAddress").val(),i.IsEmailPhoneChanges=IsEmailPhoneChanged,i.NoOfLoginAttemptemail=NoOfLoginAttemptemail,i.AuthenticationMode=authenticationMode,i.IsFromBusinessSignup=!0,_twoFactor.SendTowFactorAuthenticationCode(i)}}else IsBlocked=!1,ShowLoader(!1)},i.datamodel.Error=function(){ShowLoader(!1)},i.Post()},_onlineCheckout.CallSuccessWithEmail=function(e){1*e.d==1?(_onlineCheckout.WarningMessage("Email already exists."),ShowLoader(!1)):_onlineCheckout.GetfilterrequestDataByEmail()},_onlineCheckout.CallFailed=function(){var e="Some error occured.Please try again later.";"true"==isWidget?vagaro.alertsmall(e):_common.PassiveAlertfail(e),ShowLoader(!1)},_onlineCheckout.SaveVPLUSerDetailProfile=function(){if(!ShoppingBagVPLCell.validatePhoneNumber(!0)){var t=ShoppingBagVPLCell.getValidateMessage();return 1==t.WarningType?_onlineCheckout.WarningMessage("Please enter mobile no"):_onlineCheckout.WarningMessage(t.WarningMessage),!1}if(String.isNullOrUndefineOrBlank(e("#emailid").val()))return _onlineCheckout.WarningMessage("Please enter emailId"),!1;if(0==_onlineCheckout.ValidateEmail())return _onlineCheckout.WarningMessage("Please enter valid emailId"),!1;if(0==_siteBuilderDetail.isAffirmEnable&&(!_onlineCheckout.checkBirthDate()||"-1"==e("#cboDay").val()&&"-1"==e("#cboMonth").val()&&"-1"==e("#cboYear").val()))return _onlineCheckout.WarningMessage("Invalid Birth Date"),!1;if(String.isNullOrUndefineOrBlank(e("#txtAddressVPL").val()))return _onlineCheckout.WarningMessage("Please enter address"),!1;if(_onlineCheckout.IsVPLAddress=1,""!=e("#txtAddressVPL").val().trim()){if(!_onlineCheckout.validateNewShippingAddressData())return!1}else e(".cboRState").val("-1");_onlineCheckout.VPLTwoFactorStatus=_onlineCheckout.VPLTwoFactor.None,ShowLoader(!0);var i={};i.UserID=_onlineCheckout.CustomerDetails.UserID,i.strFirstName=_onlineCheckout.CustomerDetails.FirstName,i.strLastName=_onlineCheckout.CustomerDetails.LastName,i.CustomerEmail=e("#emailid").val().trim(),i.strStreet=e("#txtNewStreet").val().trim(),i.CountryID=_onlineCheckout.CountryID.toString(),i.strState=String.isNullOrUndefineOrBlank(e(".ddlState").val())?String.isNullOrUndefineOrBlank(_onlineCheckout.selectedAddressData)||String.isNullOrUndefineOrBlank(_onlineCheckout.selectedAddressData.statecode)?e(".ddlState").val():_onlineCheckout.selectedAddressData.statecode:e(".ddlState").val(),i.strCity=e("#txtNewCity").val().trim(),i.strZip=e("#txtNewZip").val().trim(),i.Cell=ShoppingBagVPLCell.getPhoneData().phoneNo,i.DayPhone="",i.NightPhone="","-1"==e("#cboMonth").val()&&"-1"==e("#cboMonth").val()?(i.Month=null,i.Day=null,i.Year=null):(i.Month=e("#cboMonth").val(),i.Day=e("#cboDay").val(),i.Year=e("#cboYear").val()),String.isNullOrUndefineOrBlank(e("#txtSuite").val())?i.strStreetNo="":i.strStreetNo=e("#txtSuite").val(),i.strStateName=String.isNullOrUndefineOrBlank(e("#txtState").val())?String.isNullOrUndefineOrBlank(_onlineCheckout.selectedAddressData)||String.isNullOrUndefineOrBlank(_onlineCheckout.selectedAddressData.state)?e("#txtState").val():_onlineCheckout.selectedAddressData.state:e("#txtState").val(),i.strCellProvider="-1",i.strExp=_onlineCheckout.CustomerDetails.BusinessSummary,i.Gender=_onlineCheckout.CustomerDetails.Gender,i.IsFromOnline=!0;var a={};a.objCustInfo=i,a.ObjCustomerprofile=null,e.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/WebServices/VagaroWebOffline.asmx/AddEditCustomer",dataType:"json",beforeSend:function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val())},data:JSON.stringify(a),success:function(t){e("#dvtwostepemailcodeinfo").remove(),t=t.d,ShowLoader(!1),null==t?_onlineCheckout.FailedMessage("something went wrong"):t.UserID<=0?_onlineCheckout.WarningMessage(t.Message):(_onlineCheckout.CustomerDetails=JSON.parse(e("#hdnUserDetails").val()),_onlineCheckout.CustomerDetails.EmailId=e("#emailid").val().trim(),_onlineCheckout.CustomerDetails.Cell=ShoppingBagVPLCell.getPhoneData().phoneNo,_onlineCheckout.CustomerDetails.Street=e("#txtNewStreet").val().trim(),_onlineCheckout.CustomerDetails.BirthDate=new Date(e("#cboYear").val()+"-"+e("#cboMonth").val()+"-"+e("#cboDay").val()),String.isNullOrUndefineOrBlank(t.City)||(_onlineCheckout.CustomerDetails.City=t.City),String.isNullOrUndefineOrBlank(t.CountryID)||(_onlineCheckout.CustomerDetails.CountryID=t.CountryID),String.isNullOrUndefineOrBlank(t.Zip)||(_onlineCheckout.CustomerDetails.Zip=t.Zip),String.isNullOrUndefineOrBlank(t.StateCode)||(String.isNullOrUndefineOrBlank(t.CountryID)||1!=t.CountryID?_onlineCheckout.CustomerDetails.StateCode=t.StateCode:_onlineCheckout.CustomerDetails.StateCode=t.StateCode.includes("-")?t.StateCode.split("-")[1]:t.StateCode),e("#hdnUserDetails").val(JSON.stringify(_onlineCheckout.CustomerDetails)),e("#lblterms").removeClass("termsConditionText"),1==_siteBuilderDetail.isAffirmEnable||(e("#divActiveDialog").modal("show"),e("#chkDialogAggree").attr("checked",!1),e("#divVplAddBankDetails").hide()))},error:function(e){ShowLoader(!1),ShowHideFailedMessageCommon("Something went wrong, Try Again."),console.log(e)}})},_onlineCheckout.showConfirmbox=function(t,i,a,r,o){e("#divConfirmBox").find("#confirmmsg").html(t),e("#divConfirmBox").find("#confirmTitle").html(a),e("#divConfirmBox").find(".w-button-primary").show(),e("#divConfirmBox").find(".close-modal").show(),e("#divConfirmBox").fadeIn(),e("html").addClass("popupscroll"),e("body").css("overflow","hidden"),e("#divConfirmBox").addClass("in"),r||e("#divConfirmBox").find(".w-button-primary").hide(),0==o&&e("#divConfirmBox").find(".close-modal").hide()},_onlineCheckout.hideConfirmbox=function(){e("#divConfirmBox").fadeOut(),e("#divConfirmBox").removeClass("in"),e("html").removeClass("popupscroll"),e("body").css("overflow","auto"),CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,_onlineCheckout.CallFailed),CallbackforMobileApp(0,0,"","",0,6)},_onlineCheckout.WarningMessage=function(t,i){String.isNullOrUndefineOrBlank(i)&&(i=2e3),e(".warning").show(),e("#wartext").text(t),setTimeout(function(){e(".warning").hide()},i)},_onlineCheckout.FailedMessage=function(t,i){String.isNullOrUndefineOrBlank(i)&&(i=2e3),e(".fail").show(),e("#failtext").text(t),setTimeout(function(){e(".fail").hide()},i)},_onlineCheckout.checkBirthDate=function(){var e=document.getElementById("cboDay").value,t=document.getElementById("cboMonth").value,i=document.getElementById("cboYear").value,a=!1;return"-1"!=e&&"-1"!=t&&"-1"!=i&&(a=chkDate(t+"/"+e+"/"+i,!0)),a},_onlineCheckout.setAddressControl=function(){var t=e("#txtAddressVPL").select2({searchInputPlaceholder:"Address Line 1",minimumInputLength:1,combobox:!0,dropdownCssClass:"select-location-icons select2-drop-active select-customdropdown",selectOnClick:!1,multiple:!1,closeOnSelect:!0,formContainer:"#page-wrapper",allowClear:!0,ajax:{type:"POST",contentType:"application/json; charset=utf-8",url:"/WebServices/CommonWebService.asmx/GetLocationOrPlaceDetail",dataType:"json",quietMillis:250,transport:function(t){return t.beforeSend=function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val())},e.ajax(t)},data:function(){return{searchText:e("#txtAddressVPL").val(),countryFilter:countryMapping[_onlineCheckout.CountryID],Location:"0,0"}},results:function(e,t){return{results:e}},params:{error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}}},cache:!1},formatNoMatches:function(){return e("#select2-drop").css("display","block"),"No matches found"},formatSearching:function(){return e("#select2-drop").css("display","block"),"Searching"},formatInputTooShort:function(t,i){return e("#select2-drop").css("display","none"),""},initSelection:function(t,i){i({id:e("#txtAddressVPL").val(),text:e("#txtAddressVPL").val()})},formatResult:function(t){return e("#select2-drop").css("display","block"),'<div data-placeid="'+t.place_id+'"><span class="fullocation">'+t.FormattedAddress+"</span></div>"}});t.on("select2-loaded",function(t){e(".select2-result-unselectable").addClass("select2-result-selectable").removeClass("select2-result-unselectable")}),t.on("select2-blur",function(e){e.preventDefault()}),t.on("selected",function(t){e(t.currentTarget).select2("val",t.choice.CityState),e(t.currentTarget).data("selectedid",t.choice.CityState),e.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/WebServices/CommonWebService.asmx/GetPlaceDetailByPlaceId",dataType:"json",beforeSend:function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val())},data:JSON.stringify({placeId:t.choice.place_id,description:t.choice.CityState}),success:function(t){if(null!=t&&"null"!=t){var i=null!=(t=t.d)&&null==t.City?"":t.City.split(",")[0],a=null==t.State?"":t.State;a=a.trim();var r={};r.street=t.Address,r.city=i,r.state=a,r.zip=t.ZipCode,r.country=t.CountryID,r.countrytext=countryMapping[t.CountryID],r.statecode=t.StateCode,r.stateID=_onlineCheckout.getMappingStateId(r.country,r.state),_onlineCheckout.selectedAddressData=r,e("#txtNewStreet").val(t.Address),e("#txtNewCity").val(i),e("#txtNewState").val(a),e("#txtNewZip").val(t.ZipCode),_onlineCheckout.GetCityByZipCode(e("#txtNewZip")),e("#txtSuite").focus(),e("#hdnNewCountrycode").val(countryMapping[t.CountryID]),e("#hdnNewCountryName").val(countryNameMapping[t.CountryID]),e("#cboCountryshopping").val(r.country),e(".ddlState").val(r.stateID)}},error:function(e){console.log(e)}})})},_onlineCheckout.addbankclick=function(){_onlineCheckout.addbankDetails()},_onlineCheckout.DisplayAffirmEmailValidation=function(){return e("#txtAffirmEmailId").data("EmailId",""),e("#dvAffirmEmailAddress").modal("show"),!1},_onlineCheckout.CloseAffirmEmail=function(t){ShowLoader(!0),1==t?_shopdetail.ResetVPLPaymentMethod(!0,!0):_shopdetail.ResetVPLPaymentMethod(!1,!0),_onlineCheckout.AuthorisePaymnetCount=0,_onlineCheckout.AuthoriseListData=[],e("#dvAffirmEmailAddress").modal("hide"),ShowLoader(!1)},_onlineCheckout.ContinueAffirmEmail=function(t){return ShowLoader(!0),1==_onlineCheckout.ValidateAffirmEmail()?(e("#dvAffirmEmailAddress").modal("hide"),e("#txtAffirmEmailId").data("EmailId",e("#txtAffirmEmailId").val()),1==t?_onlineCheckout.VPLFinalSubmit(!0):_shopdetail.VPLFinalSubmit(!0),!0):(ShowLoader(!1),!1)},_onlineCheckout.ValidateAffirmEmail=function(){return""==e("#txtAffirmEmailId").val()?(e("#lblAffirmInvalidEmail").hide(),e('[id*="spanAffirmVendorEmailRequire"]').show(),!1):_onlineCheckout.isValidEmailAddress(e("#txtAffirmEmailId").val())?(e("#lblAffirmInvalidEmail").hide(),e("#txtAffirmEmailId").removeClass("errorInput"),e('[id*="spanAffirmVendorEmailRequire"]').hide(),!0):(e("#lblAffirmInvalidEmail").show(),e("#txtAffirmEmailId").removeClass("errorInput"),e('[id*="spanAffirmVendorEmailRequire"]').hide(),e("#txtAffirmEmailId").addClass("errorInput"),e("#txtAffirmEmailId").focus(),!1)},_onlineCheckout.addbankDetails=function(){if(_onlineCheckout.CustomerDetails=JSON.parse(e("#hdnUserDetails").val()),e("#txtCellVPL").length>0&&!e("#txtCellVPL").data("phone-init")?(ShoppingBagVPLCell=e("#txtCellVPL").PhonePlugin({UserRole:String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.UserType)||"1"!=_onlineCheckout.CustomerDetails.UserType?1:2,ControlText:"Mobile Phone",IsPhoneNoRequire:!0,CurrentLocationCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):1,CountryId:_onlineCheckout.CustomerDetails.CellCountryID>0?_onlineCheckout.CustomerDetails.CellCountryID:1}),e("#txtCellVPL").data("phone-init",!0)):e("#txtvplCartcell").length>0&&!e("#txtvplCartcell").data("phone-init")&&(ShoppingBagVPLCell=e("#txtvplCartcell").PhonePlugin({UserRole:String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.UserType)||"1"!=_onlineCheckout.CustomerDetails.UserType?1:2,ControlText:"Mobile Phone",IsPhoneNoRequire:!0,CurrentLocationCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):1,CountryId:_onlineCheckout.CustomerDetails.CellCountryID>0?_onlineCheckout.CustomerDetails.CellCountryID:1}),e("#txtvplCartcell").data("phone-init",!0)),_onlineCheckout.LoadStatesByMultipleCountryID(),String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.EmailId)||String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.Cell)||String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.Street)||String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.BirthDate)||1==_siteBuilderDetail.isAffirmEnable){if(e("#hdncountryid").val(_onlineCheckout.CustomerDetails.CountryID),e("#txtAddressVPL").on("select2-focus",function(t){e(".countryselectmyacprofile").is(":visible")&&e(".countryselectmyacprofile").hide()}),_onlineCheckout.setAddressControl(),String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.Cell)?_onlineCheckout.VPLTwoFactorStatus=_onlineCheckout.VPLTwoFactor.Cell:(e("#hdnCellNoBeforeChange").val(_onlineCheckout.CustomerDetails.Cell),ShoppingBagVPLCell.setPhoneData(_onlineCheckout.CustomerDetails.CellCountryID,_onlineCheckout.CustomerDetails.Cell)),String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.EmailId)?_onlineCheckout.VPLTwoFactorStatus=_onlineCheckout.VPLTwoFactorStatus!=_onlineCheckout.VPLTwoFactor.None?_onlineCheckout.VPLTwoFactor.EmailAndCell:_onlineCheckout.VPLTwoFactor.Email:(e("#hdnEmailBeforeChange").val(_onlineCheckout.CustomerDetails.EmailId),e("#emailid").val(_onlineCheckout.CustomerDetails.EmailId)),0==_siteBuilderDetail.isAffirmEnable&&!String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.BirthDate)){var t=new Date(parseInt(_onlineCheckout.CustomerDetails.BirthDate.slice(6,19)));e("#cboMonth").val(t.getMonth()+1),e("#cboDay").val(t.getDate()),e("#cboYear").val(t.getFullYear())}e(".selectedCountrudiv").removeClass().addClass("selectedcountry "+B[_onlineCheckout.CustomerDetails.CountryID]+" Selected selectedCountrudiv");var i,a,r,o;if(i=String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.Street)?"":_onlineCheckout.CustomerDetails.Street+", ",a=String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.City)?"":_onlineCheckout.CustomerDetails.City+", ",r=String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.StateName)?"":_onlineCheckout.CustomerDetails.StateName+", ",o=String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.Zip)?"":_onlineCheckout.CustomerDetails.Zip,e("#txtAddressVPL").select2("val",i+a+r+o),e("#txtNewStreet").val(i),e("#txtNewCity").val(a),e("#txtNewState").val(r),e("#txtNewZip").val(o),e("#hdnNewCountrycode").val(countryMapping[_onlineCheckout.CustomerDetails.CountryID]),e("#hdnNewCountryName").val(countryNameMapping[_onlineCheckout.CustomerDetails.CountryID]),String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.StreetNo)||e("#txtSuite").val(_onlineCheckout.CustomerDetails.StreetNo),_onlineCheckout.IsVPLAddress=2,1==_siteBuilderDetail.isAffirmEnable){if(e("#btnProccessBank").text("Save"),e("#affirmBirthdate").hide(),e("#affirmphoneno").hide(),e("#btnProccessBank").hide(),e("#divVplAddBankDetails").show(),String.isNullOrUndefineOrBlank(_onlineCheckout.CustomerDetails.EmailId))return;e("#divVplAddBankDetails").show()}else e("#divVplAddBankDetails").show()}else e("#lblterms").removeClass("termsConditionText"),e("#divActiveDialog").modal("show"),e("#chkDialogAggree").attr("checked",!1)},_onlineCheckout.BankRadioClick=function(t){e("#addBankList input:radio").attr("checked",!1),e(t).prop("checked","checked")};var n,s,l,d={Service:1,Product:2,GiftCertificate:3,IOU:4,Membership:7,Class:8,IOUCleared:9,Package:15,ServiceInvoice:17,ServiceAddons:19,BusinessFee:18,ClassAddons:20,VCFFee:21,DailyDealFee:28},c=1,u=2,p=3,h=4,m=5,f="GC",g="Pkg",v="MS",A="CLS",C="addon",y=1,b=2,S=3;_onlineCheckout.isOnlyLiveStreamClass=function(){try{var t=!1,i=!1;return!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&Array.isArray(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.each(onlineShoppingCart.Events,function(a,r){!String.isNullOrUndefineOrBlank(r.eventEnrollment)&&Array.isArray(r.eventEnrollment)&&r.eventEnrollment.length>0&&e.each(r.eventEnrollment,function(e,a){String.isNullOrUndefineOrBlank(a.StreamingStatus)||1!==parseInt(a.StreamingStatus,10)?1==a.isPointApply||1==a.isPackage||1==a.isMembershipApply||a.isPriceBaseGCApply||a.isPresetApply||!String.isNullOrUndefineOrBlank(a.gcId)&&a.gcId>0||(t=!0):i=!0})}),i&&!t}catch(e){return!1}},_onlineCheckout.ValidatePaymentMethodInfo=function(t,i){if(1==e("#tabVagaroPayLater").hasClass("w--current")||1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")||1==e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current"))return!0;var a=1==i&&"true"==isCCRequiredForOnlineClass.toLowerCase()&&t>0||1!=i&&t>0,r="true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove),o=!String.isNullOrUndefineOrBlank(_onlineCheckout.zenSwipeCardDetails)&&!String.isNullOrUndefineOrBlank(_onlineCheckout.zenSwipeCardDetails.card_token),n=!String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile)&&!String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId);return!((r||a)&&!o&&!n)},_onlineCheckout.IsDisplayGoogleAppleMethod=function(){return null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||1==_onlineCheckout.CheckLiveStreamClass()||1==_onlineCheckout.isValidForCheckoutInvoice()||(1==_onlineCheckout.IsCalculateAndDisplayFeeOnline(!0)||1==_onlineCheckout.IsDepositItemExists(null))},_onlineCheckout.IsOtherCheckoutExceptClass=function(e){return null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0||!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&("true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)&&("false"==IsClassReschedule.toLowerCase()||"true"==IsClassReschedule.toLowerCase()&&(void 0===IsPaid||"false"==IsPaid.toString().toLowerCase()))||null!=e&&1==e.isSaveClassCard)||1==_onlineCheckout.isCheckoutVPLChanged||1==_onlineCheckout.IsDepositItemExists(e)&&null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0||null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&1==_onlineCheckout.IsDepositItemExists(e)},_onlineCheckout.IsValidCartDepositInfo=function(e){var t=!0;try{if(void 0!==e&&null!=e&&void 0!==e.objValidateClassBookingData&&null!=e.objValidateClassBookingData){var i=parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining)-parseFloat(onlineShoppingCart.PartialPrice)),a=e.checkoutRequest;if(0==(void 0!==a&&null!=a&&void 0!==a.vplAmt&&null!=a.vplAmt&&a.vplAmt>0)){var r="true"==isCCRequiredForOnlineClass.toLowerCase()&&i>0,o="true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove),n=!String.isNullOrUndefineOrBlank(_onlineCheckout.zenSwipeCardDetails)&&!String.isNullOrUndefineOrBlank(_onlineCheckout.zenSwipeCardDetails.card_token),s=!String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile)&&!String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId);if((null==e.objCardDetails||null!=e.objCardDetails&&0===Object.keys(e.objCardDetails).length)&&String.isNullOrUndefineOrBlank(e.objValidateClassBookingData.strUserCCXML)&&(null==e.objValidateClassBookingData.objUserCCDetails||null!=e.objValidateClassBookingData.objUserCCDetails&&0===Object.keys(e.objValidateClassBookingData.objUserCCDetails).length)&&(n=!1,s=!1),1==_onlineCheckout.isOnlyLiveStreamClass()&&1==o&&(o=!1),(o||r)&&!n&&!s){t=!1;var l={},d={AppointmentData:e,BusinessDetail:onlineShoppingCart,UserDetail:""};l.BusinessID=onlineShoppingCart.BusinessID,l.UserID=String.isNullOrUndefineOrBlank(onlineShoppingCart.loginUserId)?0:onlineShoppingCart.loginUserId,l.Step=141,l.PageURL=window.location.href,l.Device="Online",l.AppointmentDetail=JSON.stringify(d),l.UserAgent=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"";var c=[];c.push(l);var u=new vagaro.ajax;return u.datamodel.Token="CCCaptureLogError",u.datamodel.data=c,u.datamodel.callback=function(e){},u.datamodel.Error=function(e){},u.Post(),swal({title:"Your business requires a deposit or credit card on file to complete this booking. Please add a card to proceed.",text:"",confirmButtonColor:"#DD6B55",confirmButtonText:"Ok",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model"},function(e){swal.close(),location.reload(),t=!1}),t}}}return t}catch(e){return!0}},_onlineCheckout.SaveOnlineCheckout=function(){if(oldCardDetails={},_onlineCheckout.IsBuyGC=!0,0!=_onlineCheckout.ValidateCheckOutForm()){_onlineCheckout.isValidForCheckoutInvoice()&&ShowLoader(!0);var t=!1,i=null;if(0==_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){var a="Online";!_onlineCheckout.IsVagaroMarketplace()&&1!=vgAppicationType||IsFromCreateLink||(a="Online Marketplace"),String.isNullOrUndefineOrBlank(_common.GetGoogleToken(businessID))&&(isGoogle="false"),"undefined"!=typeof isFacebook&&"true"==isFacebook.toLowerCase()||0==isCheckInApp&&void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()?a="Facebook":"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&(a="Widget"),1!=_siteBuilderDetail.isFromAppleClip&&1!=_siteBuilderDetail.isFromAppClip||(a="AppleMaps"),"true"==isGoogle&&1!=_siteBuilderDetail.isFromAppleClip&&1!=_siteBuilderDetail.isFromAppClip&&(a="Google"),1==isCheckInApp&&(a="CheckInApp"),"undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions&&(a="Insta",1==vagaroFBExtensions.isExtensions_FB_Android?a="FBAndroid":1==vagaroFBExtensions.isExtensions_FB_iOS?a="FBiOS":1==vagaroFBExtensions.isExtensions_Insta_Android||1==vagaroFBExtensions.isExtensions_Android_Mobile?a="InstaAndroid":1!=vagaroFBExtensions.isExtensions_Insta_iOS&&1!=vagaroFBExtensions.isExtensions_iOS_Mobile||(a="InstaiOS")),!String.isNullOrUndefineOrBlank(PromotionID)&&_onlineCheckout.IsVagaroDailDeal()&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.IsDailyDealEnable)&&onlineShoppingCart.IsDailyDealEnable&&(a="DailyDeal"),String.isNullOrUndefineOrBlank(PromotionAppointmentID)||(a="Marketing Campaign"),!String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&isFromTextMarketing&&(a="Text Marketing Campaign");var r=getQueryStringData("Type");void 0!==r&&""!=r&&"Builder"==r&&(a+=" MySite"),void 0!==getCookie("connectroute")&&null!=getCookie("connectroute")&&getCookie("connectroute")?a+=" Connect":void 0!==getCookie("connectairoute")&&null!=getCookie("connectairoute")&&getCookie("connectairoute")&&(a+=" Connect AI"),String.isNullOrUndefineOrBlank(getCookie("loginTypeValue"))||8!=getCookie("loginTypeValue")||(a="Alexa");var o=!1;!String.isNullOrUndefineOrBlank(totalDailyDealFeeOfAllCart_PMGCA)&&totalDailyDealFeeOfAllCart_PMGCA>0&&(o="function"==typeof _onlineCheckout.isDailyDealExistsInItems&&!0===_onlineCheckout.isDailyDealExistsInItems(onlineShoppingCart)),o&&(a+=" Vera"),"undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&null!=onlineShoppingCart&&String.isNullOrUndefineOrBlank(onlineShoppingCart.loginUserId)&&"undefined"!=typeof isWidget&&null!=isWidget&&null!=isWidget&&"true"==isWidget&&void 0!==_shopdetail.GetRescheduleUserID()&&null!=_shopdetail.GetRescheduleUserID()&&null!=_shopdetail.GetRescheduleUserID()&&(onlineShoppingCart.loginUserId=parseInt(_shopdetail.GetRescheduleUserID()));var n=parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining)-parseFloat(onlineShoppingCart.PartialPrice));if(0==_onlineCheckout.ValidatePaymentMethodInfo(n,1))return ShowLoader(!1),vagaro.alert("Please select payment method"),!1;var s=_onlineCheckout.SaveClassCheckout(onlineShoppingCart.loginUserId,1==_onlineCheckout.IsCCDetailEnable()?1:2,a);if(0==s)return;if(i=s,_onlineCheckout.isValidForCheckoutInvoice()?i.invoiceID=_onlineCheckout.InvoiceID:i.invoiceID=0,i.HasFMBFee=_onlineCheckout.GetFirstVisitFlagCart(),i.IsFMBEnableForBusiness=void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness,i.FMBFeeType="function"==typeof _onlineCheckout.GetFMBFeeTypeCart?_onlineCheckout.GetFMBFeeTypeCart(onlineShoppingCart):0,t=!0,0==_onlineCheckout.IsOtherCheckoutExceptClass(i)&&(e(_onlineCheckout.Controls.tabGooglePay).is(":visible")||e(_onlineCheckout.Controls.tabApplePay).is(":visible"))&&(1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")||1==e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")))if(String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId)||void 0===_onlineCheckout.ccCardOnFile.IsTokenGenerated||null==_onlineCheckout.ccCardOnFile.IsTokenGenerated||""==typeof _onlineCheckout.ccCardOnFile.IsTokenGenerated||1!=_onlineCheckout.ccCardOnFile.IsTokenGenerated){if(!String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId)&&void 0!==_onlineCheckout.ccCardOnFile.IsTokenGenerated&&null!=_onlineCheckout.ccCardOnFile.IsTokenGenerated&&""!=typeof _onlineCheckout.ccCardOnFile.IsTokenGenerated)return vagaro.alert("Please select "+e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")==1?"google":"apple pay payment method"),!1;if(1!=_onlineCheckout.ccCardOnFile.IsTokenGenerated)return e(_onlineCheckout.Controls.tabGooglePay).is(":visible")&&1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")?(ShowLoader(!0),_shopdetail.OpenGoogleApplePaymentInfoPopup(1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")?PaymentMethod.GooglePay:PaymentMethod.ApplePay,!0,n)):e(_onlineCheckout.Controls.tabApplePay).is(":visible")&&1==e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")&&startApplePaySession(),!1}else;}var l=!1,c=null;if(1==_onlineCheckout.IsOtherCheckoutExceptClass(i)){if(l=!0,c={},"undefined"==typeof vui||String.isNullOrUndefineOrBlank(vui.stripeRadarSession)||(c.StripeRadarSession=vui.stripeRadarSession),_onlineCheckout.isValidForCheckoutInvoice()||1==_onlineCheckout.IsPaidClass()){if(onlineShoppingCart.PartialPrice==typeof onlineShoppingCart.PartialPrice!="undefined"&&onlineShoppingCart.PartialPrice,c.ccAmt=parseFloat(onlineShoppingCart.ccAmt)+parseFloat(onlineShoppingCart.classFinalTotal)+parseFloat(onlineShoppingCart.tipValue)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining+onlineShoppingCart.DepositsRemaining+onlineShoppingCart.FeeDepositsRemaining+onlineShoppingCart.PartialPrice),_onlineCheckout.IsTaxCalculated)try{var u=0;onlineShoppingCart.Packages?.forEach(e=>e.BusinessTax?.forEach(e=>u+=e.CalculatedTax||0)),c.tax=parseFloat(ConvertTodecimalMorePrecious(onlineShoppingCart.classTax+(u||0),!0,2))}catch(e){c.tax=parseFloat(ConvertTodecimalMorePrecious(onlineShoppingCart.classTax,!0,2))}else c.tax=parseFloat(onlineShoppingCart.tax)+parseFloat(onlineShoppingCart.classTax)+parseFloat(1==String.isNullOrUndefineOrBlank(onlineShoppingCart.classAddonTotalTaxPrice)?0:onlineShoppingCart.classAddonTotalTaxPrice);c.amtPaid=parseFloat(onlineShoppingCart.amtPaid)+parseFloat(onlineShoppingCart.classSubTotal)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining+onlineShoppingCart.DepositsRemaining+onlineShoppingCart.FeeDepositsRemaining),c.gcAmt=parseFloat(onlineShoppingCart.gcAmt)+parseFloat(onlineShoppingCart.classGCUsed),c.vplAmt=parseFloat(onlineShoppingCart.vplAmt)+parseFloat(onlineShoppingCart.classFinalTotal)+parseFloat(onlineShoppingCart.tipValue)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining+onlineShoppingCart.DepositsRemaining)}else c.tip=_onlineCheckout.GetOnlineCartTipAmount(),c.gcAmt=onlineShoppingCart.gcAmt,c.ccAmt=onlineShoppingCart.ccAmt-parseFloat(onlineShoppingCart.FeeDepositsRemaining)+c.tip,c.amtPaid=onlineShoppingCart.amtPaid-parseFloat(onlineShoppingCart.FeeDepositsRemaining),c.tax=onlineShoppingCart.tax-parseFloat(onlineShoppingCart.FeeTaxDepositsRemaining),c.vplAmt=onlineShoppingCart.vplAmt;if((e(_onlineCheckout.Controls.tabGooglePay).is(":visible")||e(_onlineCheckout.Controls.tabApplePay).is(":visible"))&&(1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")||1==e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")))if(String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId)||void 0===_onlineCheckout.ccCardOnFile.IsTokenGenerated||null==_onlineCheckout.ccCardOnFile.IsTokenGenerated||""==typeof _onlineCheckout.ccCardOnFile.IsTokenGenerated||1!=_onlineCheckout.ccCardOnFile.IsTokenGenerated){if(!String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId)&&void 0!==_onlineCheckout.ccCardOnFile.IsTokenGenerated&&null!=_onlineCheckout.ccCardOnFile.IsTokenGenerated&&""!=typeof _onlineCheckout.ccCardOnFile.IsTokenGenerated)return vagaro.alert("Please select "+e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")==1?"google":"apple pay payment method"),!1;if(1!=_onlineCheckout.ccCardOnFile.IsTokenGenerated){if(e(_onlineCheckout.Controls.tabGooglePay).is(":visible")&&1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")){ShowLoader(!0);var p=_onlineCheckout.ConvertDecimalWithFixed(onlineShoppingCart.FinalCCAmount,!1,2);_shopdetail.OpenGoogleApplePaymentInfoPopup(1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")?PaymentMethod.GooglePay:PaymentMethod.ApplePay,!0,p)}else e(_onlineCheckout.Controls.tabApplePay).is(":visible")&&1==e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")&&startApplePaySession();return!1}}else;if(0==_onlineCheckout.ValidatePaymentMethodInfo(c.ccAmt,2))return ShowLoader(!1),vagaro.alert("Please select payment method"),!1;c.businessID=onlineShoppingCart.BusinessID,c.CurrencyCode=currencyCode,c.loginUserID=onlineShoppingCart.loginUserId,void 0!==_onlineCheckout.zenSwipeCardDetails&&null!=_onlineCheckout.zenSwipeCardDetails&&""!=_onlineCheckout.zenSwipeCardDetails&&void 0!==_onlineCheckout.zenSwipeCardDetails.save_card&&null!=_onlineCheckout.zenSwipeCardDetails.save_card&&""!=_onlineCheckout.zenSwipeCardDetails.save_card&&1==_onlineCheckout.zenSwipeCardDetails.save_card?(c.isSaveCard=!0,c.isCCSaveCard=!0):c.isSaveCard=!1,c.IsNewCCIframeOpen=!1,void 0!==_onlineCheckout.zenSwipeCardDetails&&null!=_onlineCheckout.zenSwipeCardDetails&&""!=_onlineCheckout.zenSwipeCardDetails&&void 0!==_onlineCheckout.zenSwipeCardDetails.save_card&&null!=_onlineCheckout.zenSwipeCardDetails.save_card&&""!==_onlineCheckout.zenSwipeCardDetails.save_card&&0==_onlineCheckout.zenSwipeCardDetails.save_card&&1==_onlineCheckout.isCheckoutCCChanged&&(c.IsNewCCIframeOpen=!0),c.isUserCardonFile=!1,c.onlineGCDevice="",null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&1==_onlineCheckout.IsPaidClass()?c.IsOnlineClassCheckout=!0:c.IsOnlineClassCheckout=!1,1==_onlineCheckout.isCheckoutVPLChanged&&(c.ccDetails={},c.ccAmt=0),(c.isSaveCard||c.isUserCardonFile)&&(c.isUserCardonFile=!0);var h=[];if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){var m=e.grep(onlineShoppingCart.Inventories,function(e){return 1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)});_onlineCheckout.setProductCheckoutData(m,h,c)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&_onlineCheckout.setMembershipCheckoutData(onlineShoppingCart.Memberships,h,c),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(_onlineCheckout.setGCCheckoutData(onlineShoppingCart.GiftCertificates,h,c),void 0!==_siteBuilderDetail.IsFromGoogleMyBusiness&&1==_siteBuilderDetail.IsFromGoogleMyBusiness&&(c.onlineGCDevice="google")),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&_onlineCheckout.setPackageCheckoutData(onlineShoppingCart.Packages,h,c),null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&(_onlineCheckout.UpdateBusinessTaxForBusinessFee(),_onlineCheckout.setBusinessFeesCheckoutData(onlineShoppingCart.BusinessFee,h,c),c.TotalFeeAmount=onlineShoppingCart.totalFeeAmount,c.TotalFeeTax=onlineShoppingCart.totalFeeTax),1==_onlineCheckout.IsThisNewCustomer)for(var f=0;f<=h.length-1;f++)h[f].isNewCustomer=_onlineCheckout.IsThisNewCustomer;if(_shopdetail.EnableFMBFee()&&_onlineCheckout.RecomputeDailyDealFeeOnRemaining(onlineShoppingCart.Events,onlineShoppingCart.Packages,onlineShoppingCart.Memberships),(1==_onlineCheckout.IsPaidClass()||_onlineCheckout.isValidForCheckoutInvoice())&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(_onlineCheckout.setClassCheckoutData(onlineShoppingCart.Events,h,c,!1),Array.isArray(h)&&h.some(e=>e.recordType===d.Class)&&_onlineCheckout.fixWorkshopSessionMismatch(h)),_shopdetail.EnableFMBFee()&&Array.isArray(h)&&h.some(e=>Number(e?.dailydealFee||0)>0)&&_onlineCheckout.setdailydealFeesCheckoutData(onlineShoppingCart,h,c),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&_onlineCheckout.setServiceCheckoutData(onlineShoppingCart.ServiceInvoice,h,c),_onlineCheckout.isValidForCheckoutInvoice()?(c.invoiceID=_onlineCheckout.InvoiceID,null==onlineShoppingCart.invoiceDetails||String.isNullOrUndefineOrBlank(onlineShoppingCart.invoiceDetails.InvoiceGridObject.isExpiryDate)||1!=onlineShoppingCart.invoiceDetails.InvoiceGridObject.isExpiryDate?c.invExpiredMonthForGCPackage=0:c.invExpiredMonthForGCPackage=String.isNullOrUndefineOrBlank(onlineShoppingCart.invoiceDetails.InvoiceGridObject.ExpiryMonths)?parseInt(0):parseFloat(onlineShoppingCart.invoiceDetails.InvoiceGridObject.ExpiryMonths),c.tip=onlineShoppingCart.tipValue,(void 0===c.loginUserID||null==c.loginUserID||0==c.loginUserID)&&void 0!==onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId&&null!=onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId&&onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId>0&&(c.loginUserID=onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId)):(c.invoiceID=0,void 0===c.tip&&(c.tip=0)),"undefined"==typeof hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)||"1"!=hdnPriceWithTaxSwitch.value||(c.IsIncludeTaxInOnlinePricing=!0),0==(1==e("#tabVagaroPayLater").hasClass("w--current")&&!String.isNullOrUndefineOrBlank(_onlineCheckout.isCheckoutVPLChanged)&&1==_onlineCheckout.isCheckoutVPLChanged)&&(c.ccAmt>0||null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&(c.isCCMust&&!String.isNullOrUndefineOrBlank(_onlineCheckout.isCheckoutVPLChanged)&&0==_onlineCheckout.isCheckoutVPLChanged||onlineShoppingCart.Inventories.filter(function(e){return e.shippingAmount>0}).length>0)||1==_onlineCheckout.IsLoadCCIframForMemrship()&&0==e("#tabVagaroPayLater").hasClass("w--current"))){if(ccDetails={},1==_onlineCheckout.isCheckoutCCChanged){if(ccDetails.ccNo=_onlineCheckout.zenSwipeCardDetails.cc_no,ccDetails.ccSecurityCode=_onlineCheckout.zenSwipeCardDetails.cvv,ccDetails.ccFirstName=_onlineCheckout.zenSwipeCardDetails.first_name,ccDetails.ccMiddleName=_onlineCheckout.zenSwipeCardDetails.middle_name,ccDetails.ccLastName=_onlineCheckout.zenSwipeCardDetails.last_name,ccDetails.ccType=_onlineCheckout.zenSwipeCardDetails.cc_type,ccDetails.cardTokenId=_onlineCheckout.zenSwipeCardDetails.card_token,void 0!==_onlineCheckout.zenSwipeCardDetails.expire_month&&null!=_onlineCheckout.zenSwipeCardDetails.expire_month&&""!=_onlineCheckout.zenSwipeCardDetails.expire_month&&(ccDetails.ExpMonth=_onlineCheckout.zenSwipeCardDetails.expire_month),void 0!==_onlineCheckout.zenSwipeCardDetails.expire_year&&null!=_onlineCheckout.zenSwipeCardDetails.expire_year&&""!=_onlineCheckout.zenSwipeCardDetails.expire_year&&(ccDetails.ExpYear=_onlineCheckout.zenSwipeCardDetails.expire_year),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0)c.isSaveCCForMembership=!0;else if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){e.grep(onlineShoppingCart.Packages,function(e){return void 0!==e.IsRecurring&&1==e.IsRecurring}).length>0&&(c.isSaveCCForMembership=!0)}}else ccDetails.ccNo=_onlineCheckout.ccCardOnFile.CreditCardNumber,ccDetails.ccSecurityCode=_onlineCheckout.ccCardOnFile.SecurityCode,ccDetails.ccFirstName=_onlineCheckout.ccCardOnFile.CCFirstName,ccDetails.ccMiddleName=_onlineCheckout.ccCardOnFile.CCMiddleName,ccDetails.ccLastName=_onlineCheckout.ccCardOnFile.CCLastName,ccDetails.ccType=_onlineCheckout.ccCardOnFile.CreditCardType,ccDetails.cardTokenId=_onlineCheckout.ccCardOnFile.CardTokenId,void 0!==_onlineCheckout.ccCardOnFile.ExpMonth&&null!=_onlineCheckout.ccCardOnFile.ExpMonth&&""!=_onlineCheckout.ccCardOnFile.ExpMonth&&(ccDetails.ExpMonth=_onlineCheckout.ccCardOnFile.ExpMonth),void 0!==_onlineCheckout.ccCardOnFile.ExpYear&&null!=_onlineCheckout.ccCardOnFile.ExpYear&&""!=_onlineCheckout.ccCardOnFile.ExpYear&&(ccDetails.ExpYear=_onlineCheckout.ccCardOnFile.ExpYear),void 0!==_onlineCheckout.ccCardOnFile&&null!=_onlineCheckout.ccCardOnFile&&void 0!==_onlineCheckout.ccCardOnFile.IsSaveCard&&null!=_onlineCheckout.ccCardOnFile.IsSaveCard&&1==_onlineCheckout.ccCardOnFile.IsSaveCard&&(c.isCCSaveCard=!0);if(1==e("#dvcheckoutBookingTabs").find(".w--current").data("isothercard")||1==_onlineCheckout.isCheckoutCCChanged)if(void 0!==_onlineCheckout.BusSavedCard&null!=_onlineCheckout.BusSavedCard&&(oldCardDetails.CreditCardType=_onlineCheckout.BusSavedCard.CreditCardType,oldCardDetails.CreditCardNumber=_onlineCheckout.BusSavedCard.CreditCardNumber,oldCardDetails.SecurityCode=_onlineCheckout.BusSavedCard.SecurityCode,oldCardDetails.ExpMonth=_onlineCheckout.BusSavedCard.ExpMonth,oldCardDetails.ExpYear=_onlineCheckout.BusSavedCard.ExpYear,oldCardDetails.CCFirstName=_onlineCheckout.BusSavedCard.CCFirstName,oldCardDetails.CCMiddleName=_onlineCheckout.BusSavedCard.CCMiddleName,oldCardDetails.CCLastName=_onlineCheckout.BusSavedCard.CCLastName,oldCardDetails.CardTokenId=_onlineCheckout.BusSavedCard.CardTokenId,oldCardDetails.BusinessID=_onlineCheckout.BusSavedCard.BusinessID,oldCardDetails.businessCount=_onlineCheckout.BusSavedCard.businessCount),1==e("#dvcheckoutBookingTabs").find(".w--current").data("isothercard")?(oldCardDetails.isMongo=e("#dvcheckoutBookingTabs").find(".w--current").data("ismongo"),oldCardDetails.UsedCardTokenId=_onlineCheckout.ccCardOnFile.CardTokenId):(oldCardDetails.isMongo=!1,oldCardDetails.UsedCardTokenId=_onlineCheckout.zenSwipeCardDetails.card_token),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0)c.isSaveCCForMembership=!0;else if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){e.grep(onlineShoppingCart.Packages,function(e){return void 0!==e.IsRecurring&&1==e.IsRecurring}).length>0?c.isSaveCCForMembership=!0:oldCardDetails=null}else null!=onlineShoppingCart.Events&&0!=onlineShoppingCart.Events.length||(oldCardDetails=null);else oldCardDetails=null;var g=1;!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&("true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)||null!=i&&1==i.isSaveClassCard)&&(1!=c.isSaveCCForMembership&&null==onlineShoppingCart.Inventories&&null==onlineShoppingCart.GiftCertificates&&null==onlineShoppingCart.Packages&&null==onlineShoppingCart.Memberships?(c.isSaveCCForMembership=!0,g=2):1!=c.isSaveCCForMembership?(c.isSaveCCForMembership=!0,g=3):g=3),c.isCCSaveForClassBooking=g,ccDetails.isCcSwipe=!1,c.ccDetails=ccDetails,e.each(h,function(e,t){t.CardTokenIdForRenew=ccDetails.cardTokenId,(void 0===t.DepositsRemaining||null==t.DepositsRemaining||isNaN(t.DepositsRemaining))&&(t.DepositsRemaining=0),(void 0===t.DepositsPaid||null==t.DepositsPaid||isNaN(t.DepositsPaid))&&(t.DepositsPaid=0)})}c.RedeemedByGC=onlineShoppingCart.RedeemedByGC,c.checkoutGridrow=h,c.HasFMBFee=_onlineCheckout.GetFirstVisitFlagCart(),c.IsFMBEnableForBusiness=void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness,c.IsNewCustomerFees=void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()&&!(void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness),c.FMBFeeType="undefined"!=typeof _onlineCheckout&&_onlineCheckout&&"function"==typeof _onlineCheckout.GetFMBFeeTypeCart?_onlineCheckout.GetFMBFeeTypeCart(onlineShoppingCart):0}var v=0;if(1==t&&1==l?v=3:1==t?(c=null,v=2):1==l&&(i=null,v=1),1==isCheckInApp&&(onlineShoppingCart.ChekoutType=v),void 0!==i&&null!=i&&(i.ShoppingCartStep=_onlineCheckout.ShoppingCartStep),"undefined"!=typeof vui&&(null!=c&&(c.StripeRadarSession=vui.stripeRadarSession),null!=i&&(i.StripeRadarSession=vui.stripeRadarSession)),void 0!==c&&null!=c&&void 0!==c.ccDetails&&null!=typeof c.ccDetails&&_onlineCheckout.AuthoriseListData.length>0&&(c.ccDetails.AuthorisePayment=_onlineCheckout.AuthoriseListData.filter(function(e){return e.Type==_onlineCheckout.ItemType.Other})),void 0!==c&&null!=c&&void 0!==c.ccDetails&&null!=typeof c.ccDetails&&null!=i&&_onlineCheckout.AuthoriseListData.length>0&&(i.AuthorisePayment=_onlineCheckout.AuthoriseListData.filter(function(e){return e.Type==_onlineCheckout.ItemType.Class})),void 0!==c&&null!=c&&(c.VPLGatewayType=0),1==_onlineCheckout.isCheckoutVPLChanged?(c.ccAmt=0,c.IsVPLPayment=_onlineCheckout.isCheckoutVPLChanged,c.vplAmt=_onlineCheckout.ConvertDecimalWithFixed(onlineShoppingCart.FinalCCAmount,!1,2),c.vplDetails={},c.vplDetails.VplBankMasterId=1==_siteBuilderDetail.isAffirmEnable?"":SelectedBank[0].Id,c.vplDetails.BankAccountId=1==_siteBuilderDetail.isAffirmEnable?"":SelectedBank[0].BankId,c.vplDetails.ConsumerId=1==_siteBuilderDetail.isAffirmEnable?"":SelectedBank[0].CertegyConsumerTokenID,c.vplDetails.AccountNumber=1==_siteBuilderDetail.isAffirmEnable?"":SelectedBank[0].AccountNumber,0==_siteBuilderDetail.isAffirmEnable&&(c.vplDetails.BillingAddress={city_locality:NewUser[0].City,postal_code:NewUser[0].Zip,line_1:NewUser[0].Street,line_2:NewUser[0].StreetNo,country_code:NewUser[0].CountryName,state_province:NewUser[0].StateCode}),c.IsVPLDistributionRequired=!0,c.VPLGatewayType=1==_siteBuilderDetail.isAffirmEnable?_vgVPLOnline.VPLGatewayType.Affirm:_vgVPLOnline.VPLGatewayType.Certegy,c.PayLaterInfo=_onlineCheckout.AffirmVPLCapture(!1)):null!=c&&(c.vplAmt=0),null!=c&&""!=CyberTrackingID&&"undefind"!=CyberTrackingID&&(c.TrackingId=CyberTrackingID),null!=c&&(1==isCheckInApp?"undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail&&_siteBuilderDetail.AllDetailCommon&&_siteBuilderDetail.AllDetailCommon.BusinessDetail&&void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.IsMobileServiceMandatory?c.mobileServiceData=_siteBuilderDetail.AllDetailCommon.BusinessDetail.IsMobileServiceMandatory:c.mobileServiceData=0:c.mobileServiceData=_siteBuilderDetail.AllDetailCommon.BusinessDetail.IsMobileServiceMandatory),objChkRequest={},objChkRequest.checkoutRequest=c,objChkRequest.objValidateClassBookingData=i,objChkRequest.OnlineCheckoutType=v,objChkRequest.objCardDetails=oldCardDetails,String.isNullOrUndefineOrBlank(objChkRequest.objValidateClassBookingData)||("undefined"!=typeof ClassCartInvoiceNum&&null!=ClassCartInvoiceNum?objChkRequest.objValidateClassBookingData.InvoiceNum=ClassCartInvoiceNum:"undefined"!=typeof _common&&(ClassCartInvoiceNum=_common.GenerateRandomNo(10,onlineShoppingCart.BusinessID),objChkRequest.objValidateClassBookingData.InvoiceNum=ClassCartInvoiceNum)),String.isNullOrUndefineOrBlank(objChkRequest.checkoutRequest)||("undefined"!=typeof CartInvoiceNum&&null!=CartInvoiceNum?objChkRequest.checkoutRequest.InvoiceNum=CartInvoiceNum:"undefined"!=typeof _common&&(CartInvoiceNum=_common.GenerateRandomNo(10,onlineShoppingCart.BusinessID),objChkRequest.checkoutRequest.InvoiceNum=CartInvoiceNum)),"true"==IsCCCapturedAllowed.toLowerCase()&&1!=v&&e("#dvCheckoutBookingPaymentMethod").is(":visible")&&e(_onlineCheckout.Controls.DvcheckoutBookingTabs).is(":visible")&&(0==_onlineCheckout.isCheckoutCCChanged&&"undefined"!=_onlineCheckout.ccCardOnFile&&null!=_onlineCheckout.ccCardOnFile&&"undefined"!=_onlineCheckout.ccCardOnFile.CardTokenId&&null!=_onlineCheckout.ccCardOnFile.CardTokenId&&""!=_onlineCheckout.ccCardOnFile.CardTokenId||1==_onlineCheckout.isCheckoutCCChanged&&"undefined"!=_onlineCheckout.zenSwipeCardDetails&&null!=_onlineCheckout.zenSwipeCardDetails&&"undefined"!=_onlineCheckout.zenSwipeCardDetails.card_token&&null!=_onlineCheckout.zenSwipeCardDetails.card_token&&""!=_onlineCheckout.zenSwipeCardDetails.card_token)&&null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){ShowLoader(!0);var A=[],C=!1;if(e.grep(onlineShoppingCart.Events,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(e){var t=e.eventDate;A.push(new Date(moment(t))),e.paidType!=_onlineCheckout.arrpaidType.PaidClass&&e.paidType!=_onlineCheckout.arrpaidType.Paid||(C=!0)})}),0==_onlineCheckout.IsValidCartDepositInfo(objChkRequest))return!1;if(C){if(0==DisableFinalSubmitButton(!1))return ShowLoader(!0),!1;ShowLoader(!0),(k=new vagaro.ajax).datamodel.Token="SaveOnlineCheckoutNew",k.datamodel.callback=function(e){DisableFinalSubmitButton(!0),ShowLoader(!1),_onlineCheckout.ChekoutResponse(e),onlineVPLCheckout=0},k.datamodel.data=[objChkRequest],k.datamodel.Error=function(e){DisableFinalSubmitButton(!0),ShowLoader(!1),_onlineCheckout.SetCheckoutAuthResult("fail","",null,"","Checkout request failed (network/server error)"),_onlineCheckout.FireOnlineCheckoutCompleted(),vagaro.alert("Some error occured. Please try again.")},k.Post()}else{var y=new Date(Math.max.apply(null,A)),b={};b.businessId=onlineShoppingCart.BusinessID,b.loginUserID=onlineShoppingCart.loginUserId,1==_onlineCheckout.isCheckoutCCChanged?b.CardTokenId=_onlineCheckout.zenSwipeCardDetails.card_token:b.CardTokenId=_onlineCheckout.ccCardOnFile.CardTokenId,b.app_Date=y;var S=new vagaro.ajax;S.datamodel.async=!1,S.datamodel.Token="GetValidateCardExpiry",S.datamodel.data=[b],S.datamodel.callback=function(t){if(null!=t&&null!=t.data&&1e3==t.custom_code){if(1==t.data.isExpiredCard)return ShowLoader(!1),swal({title:"",text:"This credit card will expire before the appointment date. Please update your credit card to finish booking the appointment.",showCancelButton:!1,html:!0,customClass:"sweet-alert-model text-justify-align"},function(t){e("#tabCheckoutBooking2").click()}),setTimeout(function(){e(".gencutom-title").html("Credit Card Will Expire Before Appointment")},100),1==_onlineCheckout.isCheckoutCCChanged&&(_onlineCheckout.zenSwipeCardDetails=null),!1;if(0==DisableFinalSubmitButton(!1))return ShowLoader(!0),!1;ShowLoader(!0);var i=new vagaro.ajax;i.datamodel.Token="SaveOnlineCheckoutNew",i.datamodel.callback=function(e){DisableFinalSubmitButton(!0),ShowLoader(!1),_onlineCheckout.ChekoutResponse(e),onlineVPLCheckout=0},i.datamodel.data=[objChkRequest],i.datamodel.Error=function(e){DisableFinalSubmitButton(!0),ShowLoader(!1),_onlineCheckout.SetCheckoutAuthResult("fail","",null,"","Checkout request failed (network/server error)"),_onlineCheckout.FireOnlineCheckoutCompleted(),vagaro.alert("Some error occured. Please try again.")},i.Post()}else ShowLoader(!1),_common.PassiveAlertFailed("Some error occured. Please try again.")},S.datamodel.Error=function(e){ShowLoader(!1),_common.PassiveAlertFailed("Some error occured. Please try again.")},S.Post()}}else{if(0==_onlineCheckout.IsValidCartDepositInfo(objChkRequest))return!1;var k;if(0==DisableFinalSubmitButton(!1))return ShowLoader(!0),!1;ShowLoader(!0),(k=new vagaro.ajax).datamodel.Token="SaveOnlineCheckoutNew",k.datamodel.callback=function(t){if(DisableFinalSubmitButton(!0),null!=t.checkoutResponse&&"0"==t.checkoutResponse.resultType&&t.checkoutResponse.resultMessage.includes("Certegy")&&"0"==t.checkoutResponse.userPaymentMstID){ShowLoader(!1),e(".customeb-body p").html("");var i=t.checkoutResponse.resultMessage.split("|~|");e("#vpl-payment-fail-popup").modal("show");var a=i[0],r=i[1];e(".customeb-body p").html(a),e(".customeb-body-last #certegydate").html(String.format("{0}",(new Date).format("MMMM dd, yyyy hh:mm"))),e(".customeb-body-last #certegyref").text(r),e(".modal:visible").each(function(e,t){centerModal(t)}),_onlineCheckout.SetCheckoutAuthResult("fail","",null,"",t.checkoutResponse&&t.checkoutResponse.resultMessage?t.checkoutResponse.resultMessage:"Certegy/VPL payment failed"),_onlineCheckout.FireOnlineCheckoutCompleted(),onlineVPLCheckout=0}else ShowLoader(!1),_onlineCheckout.ChekoutResponse(t),onlineVPLCheckout=0},k.datamodel.data=[objChkRequest],k.datamodel.Error=function(e){DisableFinalSubmitButton(!0),ShowLoader(!1),_onlineCheckout.SetCheckoutAuthResult("fail","",null,"","Checkout request failed (network/server error)"),_onlineCheckout.FireOnlineCheckoutCompleted(),vagaro.alert("Some error occured. Please try again.")},k.Post()}}else 1==_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.invoiceDetails&&0==_onlineCheckout.IsCCSupportedCountry()&&(ShowLoader(!1),vagaro.alert("Some error occured. Please contact business owner."))},_onlineCheckout.fixWorkshopSessionMismatch=function(e){try{if(!e||!e.length)return;for(var t=function(e){return Number(e||0).toFixed(2)},i={},a=0;a<e.length;a++){!(f=e[a]).calculatedTax||f.calculatedTax<=0||(i[f.itemID]||(i[f.itemID]=[]),i[f.itemID].push(f))}for(var r in i){var o=i[r];if(o&&!(o.length<=1)){for(var n={},s=0;s<o.length;s++){var l=t(o[s].price);n[l]=(n[l]||0)+1}var d=null,c=0;for(var u in n)(n[u]>c||n[u]===c&&(null===d||parseFloat(u)<parseFloat(d)))&&(c=n[u],d=u);if(d){for(var p=null,h=0;h<o.length;h++)if(t(o[h].price)===d){p=o[h];break}if(p)for(var m=0;m<o.length;m++){var f=o[m],g=Math.abs(Number(f.price)-Number(p.price));if(g>0&&g<=.02&&(f.price=p.price,f.discountedPrice>0&&(f.discountedPrice=p.discountedPrice),f.ConstantOriginalServicePrice>0&&(f.ConstantOriginalServicePrice=p.ConstantOriginalServicePrice),f.originalServicePriceForPackage>0&&(f.originalServicePriceForPackage=p.originalServicePriceForPackage),f.calculatedTax>0&&(f.calculatedTax=p.calculatedTax),f.BusinessTax&&p.BusinessTax))for(var v=0;v<f.BusinessTax.length;v++){var A=f.BusinessTax[v],C=p.BusinessTax.find(e=>e.BusinessTaxID===A.BusinessTaxID);if(C){var y=Math.abs(Number(A.CalculatedTax)-Number(C.CalculatedTax));y>0&&y<=.02&&(A.CalculatedTax=C.CalculatedTax)}}}}}}}catch(e){"undefined"!=typeof _vgLogEvent&&"function"==typeof _vgLogEvent.LogEventData&&_vgLogEvent.LogEventData({Category:"fixWorkshopSessionMismatch",Action:"Exception",Message:e&&e.message?e.message:String(e)})}},_HighRiskEmailCheck.CertegyFailedEmail=function(){ShowLoader(!0);var t=JSON.parse(e("#hdnUserDetails").val()).EmailId,i=e(".customeb-body p").text(),a=e(".customeb-body-last #certegydate").text(),r=e(".customeb-body-last #certegyref").text(),o=new vagaro.ajax;o.datamodel.Token="SendMailForCertegyHighRisk",o.datamodel.callback=function(e){},o.datamodel.data=[t,i,a,r],o.datamodel.Error=function(e){},o.Post(),e("#vpl-payment-fail-popup").modal("show"),e(".customeb-body a").replaceWith("<p>Email is sent to your email ID. Please check Inbox.</p>"),ShowLoader(!1)},_onlineCheckout.SaveClassCheckout=function(t,i,a){_onlineCheckout.IsTaxCalculated=!1,onlineShoppingCart.classBookXML="";var r=parseInt(checkoutcountryID),o=parseInt(onlineShoppingCart.BusinessID),n=onlineShoppingCartmain.UsersPoints,s=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(s.length<=0)return _vgClassSessionSelection.commonMessageAlert("Something went wrong. Please search again."),!1;var l=e("<XMLDocument/>");l.append(_vgClassSessionSelection.createXmlElement("EventList"));var d=null,c=!1,u=[],p=_onlineCheckout.TipApplyCounter,h=_onlineCheckout.TipAppliedSum;e.each(s,function(t,a){var r=_vgClassSessionSelection.createXmlElement("event");r.append(_vgClassSessionSelection.createXmlElement("eventId",a.eventID)),r.append(_vgClassSessionSelection.createXmlElement("eventname",a.eventName.trim())),r.append(_vgClassSessionSelection.createXmlElement("eventimage",a.smallimage)),e.each(a.eventEnrollment,function(t,o){if(1==i&&o.paidType==_onlineCheckout.arrpaidType.PaidClass)if(u.length>0){var s=!1;if(e.grep(u,function(e,t){e.SPID==o.sPID&&(++e.TransactionCount,s=!0)}),!s)(l={}).SPID=o.sPID,l.TransactionCount=1,u.push(l)}else{var l;(l={}).SPID=o.sPID,l.TransactionCount=1,u.push(l)}if(null==(d=null)||null==d){d=_vgClassSessionSelection.createXmlElement("appointment");var m;m=o.isHandleDuetoException,d.append(_vgClassSessionSelection.createXmlElement("isHandleDuetoException",1==m?"1":"0")),d.append(_vgClassSessionSelection.createXmlElement("appId",o.appointmentID)),d.append(_vgClassSessionSelection.createXmlElement("spid",o.sPID)),d.append(_vgClassSessionSelection.createXmlElement("spname",function(t){try{return e(e('#txtSP5Mobile option[value="'+t+'"]')[0]).text()}catch(e){return""}}(o.sPID))),d.append(_vgClassSessionSelection.createXmlElement("isworkshop",o.IsWorkShop)),d.append(_vgClassSessionSelection.createXmlElement("appstarttime",new Date(o.eventDate).format("yyyy-MM-dd")+" "+o.startTime)),r.append(d)}else d=d.parent();if(d.append(_vgClassSessionSelection.createXmlElement("fname",o.cFirstName)),d.append(_vgClassSessionSelection.createXmlElement("lname",o.cLastName)),d.append(_vgClassSessionSelection.createXmlElement("email",o.cUserEmail)),d.append(_vgClassSessionSelection.createXmlElement("cellno",o.cUserCellNo)),d.append(_vgClassSessionSelection.createXmlElement("cellcountryid",o.cCellcountryID)),d.append(_vgClassSessionSelection.createXmlElement("dialingcode",o.cDialingCode)),d.append(_vgClassSessionSelection.createXmlElement("paidtype",o.paidType)),d.append(_vgClassSessionSelection.createXmlElement("streamingstatus",o.StreamingStatus)),String.isNullOrUndefineOrBlank(o.IsWaivedApply)||d.append(_vgClassSessionSelection.createXmlElement("IsWaivedApply",o.IsWaivedApply)),String.isNullOrUndefineOrBlank(o.CustomerStartTime)||(d.append(_vgClassSessionSelection.createXmlElement("customerstarttime",o.CustomerStartTime)),d.append(_vgClassSessionSelection.createXmlElement("customertimezonename",o.CustomerTimeZone))),(o.paidType==_onlineCheckout.arrpaidType.DepositsClass||o.paidType==_onlineCheckout.arrpaidType.PartiallyPaidClass)&&void 0!==o.depositsPaid){if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&o.depositsPercentage<100){var f=parseFloat(_onlineCheckout.ConvertDecimalWithFixed(100*parseFloat(o.depositsPaid)/o.price,!0,2));o.depositsPercentage=f}d.append(_vgClassSessionSelection.createXmlElement("depositspercentage",o.depositsPercentage)),d.append(_vgClassSessionSelection.createXmlElement("depositspaid",o.depositsPaid)),d.append(_vgClassSessionSelection.createXmlElement("payableamount",o.price)),d.append(_vgClassSessionSelection.createXmlElement("depositsremaining",_onlineCheckout.parseTodecimal(o.price-o.depositsPaid,2)))}if(onlineShoppingCart.tipPercent>0&&o.paidType==_onlineCheckout.arrpaidType.PaidClass){p=++p;var g=_onlineCheckout.parseTodecimal(o.price,2);(1==o.isPackage||1==o.isPointApply||o.isMembershipApply||void 0!==o.isPresetApply&&o.isPresetApply||void 0!==o.PromotionID&&null!=o.PromotionID&&o.PromotionID>0)&&(g=_onlineCheckout.parseTodecimal(o.Originalprice,2));var v=0;v=p==_onlineCheckout.TotalPaidCount?_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-h,2):_onlineCheckout.parseTodecimal(g*onlineShoppingCart.tipPercent/100,2),d.append(_vgClassSessionSelection.createXmlElement("tipAmount",v)),h+=v}var A=0;void 0!==o.PromotionID&&o.PromotionID>0&&1!=o.isPointApply&&(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)&&(A=o.PromotionID,d.append(_vgClassSessionSelection.createXmlElement("presetdiscountamount",o.discount))),d.append(_vgClassSessionSelection.createXmlElement("promotionid",A)),void 0!==o.isPresetApply&&1==o.isPresetApply&&(d.append(_vgClassSessionSelection.createXmlElement("discountid",o.DiscountID)),d.append(_vgClassSessionSelection.createXmlElement("ispresetapply",o.isPresetApply))),void 0!==o.IsAmount&&d.append(_vgClassSessionSelection.createXmlElement("isamount",o.IsAmount)),void 0!==o.AmountValue&&d.append(_vgClassSessionSelection.createXmlElement("amountvalue",o.AmountValue));var C="";0==o.customerID?(C=S=e.grep(n,function(e){return 0==o.customerID&&e.emailId==o.cUserEmail}),null!=S&&S.length>0?d.append(_vgClassSessionSelection.createXmlElement("userid",S[0].userId)):d.append(_vgClassSessionSelection.createXmlElement("userid",o.customerID))):(C=e.grep(n,function(e){return e.userId==o.customerID}),d.append(_vgClassSessionSelection.createXmlElement("userid",o.customerID)));if(null!=C&&C.length>0&&d.append(_vgClassSessionSelection.createXmlElement("isnewcustomer",C[0].isNewCustomer)),1==i&&(1==o.isPackage||0==o.isPackage)&&(o.gcId>0||o.gcId<0&&1==o.isPackage)||1==o.isPriceBaseGCApply){var y=[],b=[];1==o.isPriceBaseGCApply?(o.isPackage=!1,d.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!0))):d.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!1)),d.append(_vgClassSessionSelection.createXmlElement("ispackage",o.isPackage)),1==o.isPriceBaseGCApply&&e.each(o.GCDetail,function(e,t){y.push(t.GCId),b.push(t.GCAmount)}),void 0!==o.gcId&&null!=o.gcId&&o.gcId<0&&d.append(_vgClassSessionSelection.createXmlElement("price",o.price)),d.append(_vgClassSessionSelection.createXmlElement("packageid",o.gcId<0?_onlineCheckout.GetPackageId(o.gcId):0)),d.append(_vgClassSessionSelection.createXmlElement("gcid",void 0===o.gcId||null==o.gcId?0:o.gcId)),d.append(_vgClassSessionSelection.createXmlElement("gcids",0==y.length?0:y.join(","))),d.append(_vgClassSessionSelection.createXmlElement("gcamount",0==b.length?0:b.join(","))),o.RedeemServiceId>0&&d.append(_vgClassSessionSelection.createXmlElement("redeemserviceid",o.RedeemServiceId))}if(1==i&&1==o.isPointApply&&(d.append(_vgClassSessionSelection.createXmlElement("ispointapply",o.isPointApply)),d.append(_vgClassSessionSelection.createXmlElement("pointsredeem",o.pointsRedeem))),1==i&&(d.append(_vgClassSessionSelection.createXmlElement("taxes",o.TaxValue)),d.append(_vgClassSessionSelection.createXmlElement("calculatedTaxTypeWise",String.isNullOrUndefineOrBlank(o.BusinessTax)?"[]":JSON.stringify(o.BusinessTax).toString())),null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(t){t.giftCertificateID==o.gcId&&null!=t.Taxes&&(d.append(_vgClassSessionSelection.createXmlElement("taxes","0")),e.grep(o.BusinessTax,function(e){onlineShoppingCart.classFinalTotal=parseFloat(ConvertTodecimalMorePrecious(parseFloat(onlineShoppingCart.classFinalTotal)-e.CalculatedTax,!0,2)),onlineShoppingCart.classTax=parseFloat(ConvertTodecimalMorePrecious(parseFloat(onlineShoppingCart.classTax)-e.CalculatedTax,!0,2)),_onlineCheckout.IsTaxCalculated=!0,e.CalculatedTax=0}))})),1==i&&1==o.isMembershipApply&&null!=o.membershipUniqueID&&null!=o.membershipUniqueID&&""!=o.membershipUniqueID){d.append(_vgClassSessionSelection.createXmlElement("ismembershipapply",o.isMembershipApply)),d.append(_vgClassSessionSelection.createXmlElement("membershipdiscountpercentage",o.membershipDiscount)),d.append(_vgClassSessionSelection.createXmlElement("membershipuserid",o.membershipuserid)),d.append(_vgClassSessionSelection.createXmlElement("membershipuniqueid",o.membershipUniqueID));var S,k=null;if((k=_vgClassSessionSelection.createXmlElement("membershipredeemeddetails")).append(_vgClassSessionSelection.createXmlElement("businessid",o.BusinessID)),k.append(_vgClassSessionSelection.createXmlElement("redeembusinessid",o.RedeemBusinessId)),0==o.customerID)null!=(S=e.grep(n,function(e){return 0==o.customerID&&e.emailId==o.cUserEmail}))&&S.length>0?k.append(_vgClassSessionSelection.createXmlElement("userid",S[0].userId)):k.append(_vgClassSessionSelection.createXmlElement("userid",o.customerID));else k.append(_vgClassSessionSelection.createXmlElement("userid",o.customerID));k.append(_vgClassSessionSelection.createXmlElement("membershipuserid",o.membershipuserid)),k.append(_vgClassSessionSelection.createXmlElement("redeemuserid",o.membershipuserid)),k.append(_vgClassSessionSelection.createXmlElement("itemtype",8)),k.append(_vgClassSessionSelection.createXmlElement("type",8)),k.append(_vgClassSessionSelection.createXmlElement("membershipid",o.MembershipID)),k.append(_vgClassSessionSelection.createXmlElement("membershipitemid",o.MembershipItemId)),k.append(_vgClassSessionSelection.createXmlElement("groupid",o.GroupId)),k.append(_vgClassSessionSelection.createXmlElement("isunlimitedvisit",-1==o.VisitRemaining)),k.append(_vgClassSessionSelection.createXmlElement("serviceproductname",a.eventName.trim())),d.append(k)}if(0==isCheckInApp){var D=!1;e(".cartremoverdtl").each(function(t,i){void 0!==e(i).attr("data-isWorkShop")&&"true"==e(i).attr("data-isWorkShop").toLowerCase()&&(D=!0)});var _=_shopdetail.GetRescheduleDetail();null!=_&&(D||(c=!0),d.append(_vgClassSessionSelection.createXmlElement("eventsessionattendeeid",_.EventSessionAttendeesId)))}d.append(_vgClassSessionSelection.createXmlElement("isAddon",!1)),d.append(_vgClassSessionSelection.createXmlElement("isupsell",(!String.isNullOrUndefineOrBlank(o.isMembershipApply)&&0!=o.isMembershipApply||!String.isNullOrUndefineOrBlank(o.isMembershipApply)&&0!=o.isPackage)&&_onlineCheckout.IsCheckMemPkgUpsellExists(o.isMembershipApply,o.MembershipID))),d.append(_vgClassSessionSelection.createXmlElement("uniqueAddonID","addon"+o.appointmentID+o.autoID)),d.append(_vgClassSessionSelection.createXmlElement("ispartialpointapply",void 0!==o.IsPartialPoint&&o.IsPartialPoint)),d.append(_vgClassSessionSelection.createXmlElement("partialserviceprice",o.price)),"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&d.append(_vgClassSessionSelection.createXmlElement("revenueisfromtextmarketing",isFromTextMarketing)),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&d.append(_vgClassSessionSelection.createXmlElement("revenuepromotionid",parseInt(PromotionAppointmentID))),null!=o.lstAddonService&&o.lstAddonService.length>0&&_onlineCheckout.CreateAddonXMl(o.lstAddonService,o,r,i)}),l.find("EventList").append(r)});var m="",f={},g={};g.businessId=o,g.loggedInUserId=t,g.countryId=r,g.classXmlData=l.html().replace(new RegExp("&nbsp;","g")," "),g.operationType=i,g.device=a,g.isCardOnFile=!1,g.isSaveClassCard=!1,g.isReschedule=c,g.CurrencyCode=currencyCode;var v=e("#dvcheckoutBookingTabs").find(".w--current").attr("id");void 0===v||""==v||"tabCheckoutBooking1"!=v&&"tabCheckoutBooking2"!=v&&1!=e("#dvcheckoutBookingTabs").find(".w--current").data("isothercard")?g.isSharedCC=!0:g.isSharedCC=!1,g.userFullName=FullUserName,g.userEmail=onlineShoppingCart.loginUserEmail,g.currencySymbol=currencysymbol;var A="",C="",y="",b="",S="",k="",D="";if((1==_onlineCheckout.IsCCDetailEnable()&&parseFloat(onlineShoppingCart.classFinalTotal+parseFloat(onlineShoppingCart.tipValue)-parseFloat(onlineShoppingCart.DepositsRemaining))>0||1==_onlineCheckout.IsLoadCCIframForMemrship()&&0==e("#tabVagaroPayLater").hasClass("w--current"))&&(1==_onlineCheckout.isCheckoutCCChanged&&null!=_onlineCheckout.zenSwipeCardDetails?(g.isSaveClassCard=!0,A=_onlineCheckout.zenSwipeCardDetails.cc_type,C=_onlineCheckout.zenSwipeCardDetails.cc_no,y=_onlineCheckout.zenSwipeCardDetails.cvv,b=_onlineCheckout.zenSwipeCardDetails.first_name,S=_onlineCheckout.zenSwipeCardDetails.middle_name,k=_onlineCheckout.zenSwipeCardDetails.last_name,D=_onlineCheckout.zenSwipeCardDetails.card_token):("block"==e("#dvcheckoutBookingTabs").css("display").toLowerCase()||"flex"==e("#dvcheckoutBookingTabs").css("display").toLowerCase()||e("#dvcheckoutBookingTabs").is(":visible")&&0==e("#tabVagaroPayLater").hasClass("w--current"))&&(g.isCardOnFile=!0,A=_onlineCheckout.ccCardOnFile.CreditCardType,C=_onlineCheckout.ccCardOnFile.CreditCardNumber,y=_onlineCheckout.ccCardOnFile.SecurityCode,b=_onlineCheckout.ccCardOnFile.CCFirstName,S=_onlineCheckout.ccCardOnFile.CCMiddleName,k=_onlineCheckout.ccCardOnFile.CCLastName,D=_onlineCheckout.ccCardOnFile.CardTokenId),1==e("#dvcheckoutBookingTabs").find(".w--current").data("isothercard")||1==_onlineCheckout.isCheckoutCCChanged&&null!=_onlineCheckout.zenSwipeCardDetails?(void 0!==_onlineCheckout.BusSavedCard&null!=_onlineCheckout.BusSavedCard&&(oldCardDetails.CreditCardType=_onlineCheckout.BusSavedCard.CreditCardType,oldCardDetails.CreditCardNumber=_onlineCheckout.BusSavedCard.CreditCardNumber,oldCardDetails.SecurityCode=_onlineCheckout.BusSavedCard.SecurityCode,oldCardDetails.ExpMonth=_onlineCheckout.BusSavedCard.ExpMonth,oldCardDetails.ExpYear=_onlineCheckout.BusSavedCard.ExpYear,oldCardDetails.CCFirstName=_onlineCheckout.BusSavedCard.CCFirstName,oldCardDetails.CCMiddleName=_onlineCheckout.BusSavedCard.CCMiddleName,oldCardDetails.CCLastName=_onlineCheckout.BusSavedCard.CCLastName,oldCardDetails.CardTokenId=_onlineCheckout.BusSavedCard.CardTokenId,oldCardDetails.BusinessID=_onlineCheckout.BusSavedCard.BusinessID,oldCardDetails.businessCount=_onlineCheckout.BusSavedCard.businessCount),1==e("#dvcheckoutBookingTabs").find(".w--current").data("isothercard")?(oldCardDetails.isMongo=e("#dvcheckoutBookingTabs").find(".w--current").data("ismongo"),oldCardDetails.UsedCardTokenId=_onlineCheckout.ccCardOnFile.CardTokenId,g.isSaveClassCard=!0):(oldCardDetails.isMongo=!1,oldCardDetails.UsedCardTokenId=_onlineCheckout.zenSwipeCardDetails.card_token)):oldCardDetails=null,m="<root>",m+="<UserCCDetail><UCCType>"+A+"</UCCType>",m+="<UCCNo>"+C.substr(C.length-4)+"</UCCNo>",m+="<UCCSecurityCode>"+y+"</UCCSecurityCode>",g.isSharedCC&&(m+="<UCCExpMonth>"+_onlineCheckout.ccCardOnFile.ExpMonth+"</UCCExpMonth>",m+="<UCCExpYear>"+_onlineCheckout.ccCardOnFile.ExpYear+"</UCCExpYear>",m+="<isSharedCCdetail>1</isSharedCCdetail>"),m+="<UCCFirstName>"+b.escapeHtml()+"</UCCFirstName>",m+="<UCCMiddleName>"+(void 0===S?"":S.escapeHtml())+"</UCCMiddleName>",m+="<UCCLastName>"+k.escapeHtml()+"</UCCLastName>",m+="<UCCTokenID>"+D+"</UCCTokenID>",m+="</UserCCDetail></root>",f.UCCNo=C,f.UCCType=A,f.UCCSecurityCode=y,f.UCCFirstName=b,f.UCCMiddleName=S,f.UCCLastName=k,f.CardTokenId=D,void 0!==_onlineCheckout.ccCardOnFile&&null!=_onlineCheckout.ccCardOnFile&&void 0!==_onlineCheckout.ccCardOnFile.IsSaveCard&&null!=_onlineCheckout.ccCardOnFile.IsSaveCard&&1==_onlineCheckout.ccCardOnFile.IsSaveCard&&(g.isSaveClassCard=!0)),g.objUserCCDetails=f,g.strUserCCXML=m,g.bookText=checkoutClassBookText,0==isCheckInApp){var _=_shopdetail.GetRescheduleDetail();1==c&&null!=_&&(g.OldSPID=_.providerID,g.OldAppDate=e("#hdnDate").val()+" "+BookingTime)}return onlineShoppingCart.classBookXML=l,"undefined"!=typeof _onlineCheckout&&void 0!==_onlineCheckout.updateAppIdforms&&null!=_onlineCheckout.updateAppIdforms&&_onlineCheckout.updateAppIdforms.length>0&&(g.lstUpdateAppIdInForm=_onlineCheckout.updateAppIdforms),"undefined"!=typeof _onlineCheckout&&void 0!==_onlineCheckout.formResponseIds&&null!=_onlineCheckout.formResponseIds&&_onlineCheckout.formResponseIds.length>0&&(g.lstFormResponseIds=_onlineCheckout.formResponseIds),g},_onlineCheckout.removeEventSessionAttendies=function(e,t,i){var a=" (Website Online)";if("undefined"!=typeof isWindowsApp&&1==isWindowsApp)a=" (Windows Online)";else if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){a="(CustomerApp Online)";var r=null!=navigator.userAgent?navigator.userAgent:"";r.toLowerCase().indexOf("customerios")>-1?a=" (iOS Online)":r.toLowerCase().indexOf("customerandroid amazon")>-1?a=" (Amazon Online)":r.toLowerCase().indexOf("customerandroid")>-1&&(a=" (Android Online)")}else if(2==vgAppicationType)a=" (CheckIn Online)";else if(_shopdetail.VisibleControlLength("#mobile-check")>0){a=" (MobileWeb";var o=navigator.userAgent;OpenedFrom={iphone:o.match(/(iPhone|iPod)/),blackberry:o.match(/BlackBerry/),kindle:o.match(/Silk/),android:o.match(/Android/),windows:o.match(/Windows/),ipad:o.match(/iPad/)},OpenedFrom.windows?a+=" Windows Phone Online)":OpenedFrom.iphone?a+=" iPhone Online)":OpenedFrom.android?a+=" Android Online)":OpenedFrom.blackberry?a+=" Blackberry Online)":OpenedFrom.ipad?a+=" iPad Online)":OpenedFrom.kindle&&(a+=" kindle Online)")}var n={};n.ApptIds=e.eventSsnAtIds,n.userId=e.userId,n.status=e.status,n.eventConfirmBy=e.userId,n.price=null,n.pointGiven=null,n.pointRedeem=null,n.isPaid=null,n.confirmDevice=e.device+a,n.denyComments=e.denyComments,n.modifiedBy=e.userId,n.isCancelledByCustomer=e.isCancelledByCustomer,n.device=e.device+a,n.isFromMyAccount=!1,n.isWorkShop=e.isWorkshop,n.isSendMailToCustomer=e.isSendMail,n.businessID=parseInt(businessID);var s=new vagaro.ajax;s.datamodel.Token=ApiURLEnumOnlineCheckout.updateeventsessionattendees,s.datamodel.IsNewVagaroAPI=!0,s.datamodel.data=n,s.datamodel.callback=t,s.datamodel.Error=i,s.Post()},_onlineCheckout.setProductCheckoutData=function(t,i,a){var o=_onlineCheckout.hideShippingMethodsForFlatRateShippingProducts().Inventories,n=0,s=!1,l=0;if(1==IsChargeMostExpensive&&t.length>0){var c=0,u=0;e.grep(t,function(e,t){(e.FlatRateShippingPrice>c||e.FlatRateShippingPrice==c&&e.AdditionShippingPrice>u)&&(c=e.FlatRateShippingPrice,u=e.AdditionShippingPrice,l=e.InventoryId)})}for(var p=0;p<=t.length-1;p++){if(checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?t[p].autoId:1,checkoutGridrow.userName="",checkoutGridrow.userID=t[p].userID,checkoutGridrow.serviceProviderID=t[p].serviceProviderID,checkoutGridrow.serviceProviderName=t[p].serviceProviderName,checkoutGridrow.itemName=t[p].ProductName,checkoutGridrow.InventoryMasterID=t[p].InventoryMasterID,checkoutGridrow.InventoryMasterName=t[p].InventoryMasterName,checkoutGridrow.itemID=t[p].InventoryId,checkoutGridrow.InventoryBundleId=t[p].MasterInventoryId,checkoutGridrow.IsPartial=t[p].IsPartial,checkoutGridrow.UnitAbbreviation=t[p].UnitAbbreviation,checkoutGridrow.LotId=t[p].LotId,checkoutGridrow.SerialNumber=t[p].SerialNumber,checkoutGridrow.ReceiptSetting=t[p].ReceiptSetting,checkoutGridrow.InventoryBundleId>0){var h=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==t[p].MasterInventoryId});h.length>0&&(checkoutGridrow.InventoryBundleName=h[0].ProductName)}if(checkoutGridrow.bundleQuantity=t[p].bundleQuantity,checkoutGridrow.IsDropShip=t[p].IsDropShip,checkoutGridrow.VendorEmail=t[p].VendorEmail,checkoutGridrow.VendorName=t[p].VendorName,checkoutGridrow.recordType=d.Product,checkoutGridrow.barcodeID=t[p].barcodeID,void 0!==t[p].isPackageApplied&&1==t[p].isPackageApplied?(checkoutGridrow.price=_onlineCheckout.parseTodecimal(t[p].Price,2),checkoutGridrow.discount=0,checkoutGridrow.packageAssignStatus=void 0!==t[p].isPackageApplied&&t[p].isPackageApplied?1:0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.membershipDiscount=0):(void 0!==t[p].isMembershipApply&&1==t[p].isMembershipApply?(checkoutGridrow.price=_onlineCheckout.parseTodecimal(t[p].Price+t[p].discount,2),checkoutGridrow.discount=t[p].discount,checkoutGridrow.membershipDiscount=t[p].membershipDiscount,checkoutGridrow.pointsRedeem=0):void 0!==t[p].isPresetApply&&1==t[p].isPresetApply?(t[p]&&null!=t[p].Quantity&&t[p].Quantity>1?checkoutGridrow.price=_onlineCheckout.parseTodecimal(t[p].OriginalPrice*t[p].Quantity,2):checkoutGridrow.price=_onlineCheckout.parseTodecimal(t[p].OriginalPrice,2),checkoutGridrow.discount=t[p].discount,checkoutGridrow.membershipDiscount=0,checkoutGridrow.pointsRedeem=t[p].pointsRedeem):(checkoutGridrow.price=_onlineCheckout.parseTodecimal(t[p].Price,2),checkoutGridrow.discount=t[p].discount,checkoutGridrow.membershipDiscount=0,checkoutGridrow.pointsRedeem=t[p].pointsRedeem),checkoutGridrow.packageAssignStatus=0),checkoutGridrow.discountedPrice=t[p].Price,e.grep(o,function(e,i){t[p].InventoryId==e.InventoryId&&(s=!0)}),checkoutGridrow.IsFlatRateShipping=s,s=!1,checkoutGridrow.pointsGained=_onlineCheckout.isValidForCheckoutInvoice()?t[p].pointsGained:t[p].pointsGained*t[p].Quantity,checkoutGridrow.quantity=t[p].Quantity,void 0!==t[p].isPointApply&&1==t[p].isPointApply?checkoutGridrow.pointAssignStatus=parseInt(parseInt(t[p].pointsRedeem)>0?1:0):checkoutGridrow.pointAssignStatus=0,checkoutGridrow.costToBusiness=t[p].costToBusiness,checkoutGridrow.totalQty=t[p].TotalQty,checkoutGridrow.lowQtyWarning=t[p].lowQtyWarning,onlineShoppingCart.tipPercent>0&&null==onlineShoppingCart.ServiceInvoice&&null==onlineShoppingCart.Events){_onlineCheckout.TipApplyCounter=++_onlineCheckout.TipApplyCounter;var m=0;m=_onlineCheckout.TipApplyCounter==_onlineCheckout.TotalPaidCount||0==t[p].ActualPrice&&1==t.length?_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2):_onlineCheckout.parseTodecimal(t[p].ActualPrice*onlineShoppingCart.tipPercent/100,2),checkoutGridrow.calculatedTip=m,_onlineCheckout.TipAppliedSum+=m}else if(onlineShoppingCart.tipValue>0&&null==onlineShoppingCart.ServiceInvoice&&null==onlineShoppingCart.Events){m=0;m=_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2),checkoutGridrow.calculatedTip=m,_onlineCheckout.TipAppliedSum+=m}if(checkoutGridrow.DiscountID=t[p].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].DiscountType)?1==t[p].IsAmount?2:1:t[p].DiscountType:1==t[p].IsAmount?2:1,checkoutGridrow.AmountValue=t[p].AmountValue,checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].ConstantOriginalServicePrice)?t[p].Price:t[p].ConstantOriginalServicePrice:t[p].Price,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].OriginalDiscountRights)?0:t[p].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].OriginalDiscountType)?1:t[p].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].ApprovedBy)?0:t[p].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].IsAskApprovalPopup)?0:t[p].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[p].IsShowApprovalPriceDiscount)?0:t[p].IsShowApprovalPriceDiscount:0,"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,checkoutGridrow.calculatedTaxTypeWise="[]",checkoutGridrow.pointsRedeem>0?(checkoutGridrow.calculatedTax=0,t[p].IsPartialPoint&&(checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(t[p].ActualTax,3),checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(t[p].BusinessTax)?"[]":JSON.stringify(t[p].BusinessTax))):void 0!==t[p].isPackageApplied&&1==t[p].isPackageApplied?(checkoutGridrow.calculatedTax=0,t[p].BusinessTax=0,checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(t[p].BusinessTax)?"[]":JSON.stringify(t[p].BusinessTax)):(checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(t[p].calculatedTax,3),checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(t[p].BusinessTax)?"[]":JSON.stringify(t[p].BusinessTax)),checkoutGridrow.taxes=t[p].TaxValue,checkoutGridrow.shippingAmount=t[p].shippingAmount,1==onlineShoppingCart.IsPickupInStore)checkoutGridrow.shippingSurcharge=0,checkoutGridrow.shippingAmount=0;else{if(checkoutGridrow.shippingSurcharge=0,1==t[p].IsFreeShipping){var f=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==checkoutGridrow.InventoryBundleId});checkoutGridrow.shippingSurcharge=0==t[p].MasterInventoryId?t[p].Quantity*t[p].ShippingSurcharge:t[p].ShippingSurcharge*f[0].Quantity}e.grep(o,function(i,a){if(t[p].InventoryId!=i.InventoryId&&t[p].MasterInventoryId!=i.InventoryId||(n+=i.FlatRateShippingPrice*i.Quantity),(checkoutGridrow.InventoryBundleId>0?checkoutGridrow.InventoryBundleId==i.InventoryId:checkoutGridrow.itemID==i.InventoryId)&&0==_onlineCheckout.isValidForCheckoutInvoice()){var r=0;if(1==IsChargeMostExpensive?checkoutGridrow.itemID==l?(r+=i.FlatRateShippingPrice,r+=(i.Quantity-1)*i.AdditionShippingPrice):r+=i.Quantity*i.AdditionShippingPrice:(r+=i.FlatRateShippingPrice,i.Quantity>1&&(r+=(i.Quantity-1)*i.AdditionShippingPrice)),checkoutGridrow.InventoryBundleId>0){var o=e.grep(t,function(e){return e.MasterInventoryId==checkoutGridrow.InventoryBundleId});checkoutGridrow.shippingAmount=r/o.length}else checkoutGridrow.shippingAmount=r}})}if(0==p){if(objOnlineProductDetail={},objOnlineProductDetail.isPickupInStore=onlineShoppingCart.IsPickupInStore,1==onlineShoppingCart.IsPickupInStore)objOnlineProductDetail.fullName=FullUserName,objOnlineProductDetail.totalShippingAmount=0,objOnlineProductDetail.originalTotalShippingPrice=0,objOnlineProductDetail.totalShippingSurcharge=0,objOnlineProductDetail.strEstimatedPickupDate=moment(onlineShoppingCart.PickupDate).format("MMM-DD-YYYY hh:mm A");else if(objOnlineProductDetail.strEstimatedPickupDate=null,void 0===onlineShoppingCart.SelectedShippingMethod||String.isNullOrUndefineOrBlank(onlineShoppingCart.SelectedShippingMethod)){if(n>0&&0==_onlineCheckout.isValidForCheckoutInvoice()){n=0;g=_onlineCheckout.getFinalCCAmount();0==parseFloat(g)?a.isCCMust=!1:a.isCCMust=!0,void 0===objOnlineProductDetail.totalShippingSurcharge&&(objOnlineProductDetail.totalShippingSurcharge=0),objOnlineProductDetail.totalShippingSurcharge+=checkoutGridrow.shippingSurcharge,0==onlineShoppingCart.IsAddressOnFile?objOnlineProductDetail.isAddressSaveinProfile=onlineShoppingCart.Address.isSaveAddressinfo:objOnlineProductDetail.isAddressSaveinProfile=!1,objOnlineProductDetail.fullName=onlineShoppingCart.Address.fullName,objOnlineProductDetail.street=onlineShoppingCart.Address.street,objOnlineProductDetail.streetNo=onlineShoppingCart.Address.streetNo,objOnlineProductDetail.stateID=onlineShoppingCart.Address.stateID,objOnlineProductDetail.stateName=onlineShoppingCart.Address.stateName,objOnlineProductDetail.countryID=onlineShoppingCart.Address.countryID,objOnlineProductDetail.city=onlineShoppingCart.Address.city,objOnlineProductDetail.zip=onlineShoppingCart.Address.zip,objOnlineProductDetail.dayPhone=onlineShoppingCart.Address.dayPhone}}else{var g=_onlineCheckout.getFinalCCAmount();0==parseFloat(g)?a.isCCMust=!1:a.isCCMust=!0,objOnlineProductDetail.totalShippingAmount=onlineShoppingCart.SelectedShippingMethod.Rate,null!=r&&null!=r&&""!=r&&0==onlineShoppingCart.SelectedShippingMethod.Rate&&(objOnlineProductDetail.originalTotalShippingPrice=r),objOnlineProductDetail.shippingServiceName=onlineShoppingCart.SelectedShippingMethod.ShippingRateComputationMethodSystemName,objOnlineProductDetail.shippingServiceMethod=onlineShoppingCart.SelectedShippingMethod.Name,objOnlineProductDetail.shippingServiceCode=onlineShoppingCart.SelectedShippingMethod.Code,objOnlineProductDetail.isAddressSaveinProfile=onlineShoppingCart.IsAddressOnFile,0==onlineShoppingCart.IsAddressOnFile?objOnlineProductDetail.isAddressSaveinProfile=onlineShoppingCart.Address.isSaveAddressinfo:objOnlineProductDetail.isAddressSaveinProfile=!1,objOnlineProductDetail.fullName=onlineShoppingCart.Address.fullName,objOnlineProductDetail.street=onlineShoppingCart.Address.street,objOnlineProductDetail.streetNo=onlineShoppingCart.Address.streetNo,objOnlineProductDetail.stateID=onlineShoppingCart.Address.stateID,objOnlineProductDetail.stateName=onlineShoppingCart.Address.stateName,objOnlineProductDetail.countryID=onlineShoppingCart.Address.countryID,objOnlineProductDetail.city=onlineShoppingCart.Address.city,objOnlineProductDetail.zip=onlineShoppingCart.Address.zip,objOnlineProductDetail.dayPhone=onlineShoppingCart.Address.dayPhone,objOnlineProductDetail.totalShippingSurcharge=0}a.OnlineProductDetail=objOnlineProductDetail}void 0===objOnlineProductDetail.totalShippingAmount&&(objOnlineProductDetail.totalShippingAmount=0);var v=!1;if(e.grep(onlineShoppingCart.Inventories,function(e,t){checkoutGridrow.InventoryBundleId==e.InventoryId&&1==e.IsFlatRateShipping&&(v=!0)}),1!=checkoutGridrow.IsFlatRateShipping&&1!=v||(objOnlineProductDetail.totalShippingAmount+=checkoutGridrow.shippingAmount),t[p].isMembershipApply){var A={};A.BusinessID=t[p].BusinessID,A.RedeemBusinessId=t[p].RedeemBusinessId,A.UserID=_onlineCheckout.isValidForCheckoutInvoice()?a.loginUserID:t[p].userID,A.MembershipID=t[p].MembershipID,A.MembershipItemId=t[p].MembershipItemId,A.ItemType=t[p].IsPartial?_PackageMembership.PartialProduct:_PackageMembership.Product,A.VisitUsed=t[p].VisitUsed,A.Type=2,A.GroupId=t[p].GroupId,A.IsUnlimitedVisit=-1==t[p].Visit,A.ServiceProductName=checkoutGridrow.itemName,checkoutGridrow.MembershipRedeemedDetails=A}if(t[p].isPackageApplied)for(var C=e.grep(onlineShoppingCart.lstGCPkgData,function(e){return e.giftCertificateID===t[p].MembershipID}),y=0;y<C.length;y++)if(void 0!==t[p]&&"undefined"!=t[p].InventoryId&&(t[p].IsPartial?t[p].InventoryMasterID:t[p].InventoryId)==C[y].serviceID){objGC={},objGC.giftcertificateId=C[y].giftCertificateID,objGC.giftCertificateNo=C[y].giftCertificateNo,objGC.serviceId=t[p].IsPartial?t[p].InventoryId:C[y].serviceID;var b=0;if(C[y].quantity>0){for(var S=e.grep(onlineShoppingCart.lstGCPkgData,function(e){return 1==e.isCustomPackage&&e.giftCertificateID==C[y].giftCertificateID&&null!=e.serviceID&&""!=e.serviceName}),k=0,D=0;D<S.length;D++){var _=S[D];_.quantity>0&&(k+=_.quantity)}k>0?(b=Math.floor(_shopdetail.parseTodecimal(C[y].currentBalance/(k+(t[p].IsPartial?_shopdetail.parseTodecimal(t[p].Quantity):parseInt(t[p].Quantity)))*100))/100,b*=t[p].IsPartial?_shopdetail.parseTodecimal(t[p].Quantity):parseInt(t[p].Quantity)):b=0}objGC.redeemAmt=b,objGC.uniqID=1,objGC.RedeemServiceId=t[p].IsPartial?t[p].InventoryId:C[y].serviceID,objGC.gcAfterbalance=C[y].quantity,C[y].quantity=objGC.gcAfterbalance,objGC.GcPkgType=3,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,objGC.ItemType=3;var I=!1;e.each(onlineShoppingCart.RedeemedByGC,function(e,t){if(t.giftcertificateId===objGC.giftcertificateId)return I=!0,!1}),I||onlineShoppingCart.RedeemedByGC.push(objGC)}t[p].IsPartialPoint&&(checkoutGridrow.payableAmount=t[p].OriginalPrice-t[p].PartialPrice),"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&(checkoutGridrow.RevenueIsFromTextMarketing=isFromTextMarketing),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&(checkoutGridrow.RevenuePromotionID=parseInt(PromotionAppointmentID)),i.push(checkoutGridrow)}},_onlineCheckout.setMembershipCheckoutData=function(e,t,i,a){for(var r=0;r<=e.length-1;r++){checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()||1==a?e[r].autoId:1,checkoutGridrow.userName="",checkoutGridrow.userID=e[r].userID,checkoutGridrow.serviceProviderID=e[r].serviceProviderID,checkoutGridrow.itemName=e[r].MembershipName,checkoutGridrow.itemID=e[r].MembershipId,checkoutGridrow.recordType=d.Membership,checkoutGridrow.barcodeID=v,checkoutGridrow.FmbFee=e[r].dailydealFee,checkoutGridrow.FMBPercentage=e[r].FMBPercentage,checkoutGridrow.DealBookingType=_onlineCheckout.GetDealBookingType(e[r].dailydealFee,e[r].FMBPercentage),checkoutGridrow.price=e[r].Price,checkoutGridrow.membershipchangeprice=e[r].Price;try{void 0!==e[r].dailydealFee&&null!=e[r].dailydealFee&&Number(e[r].dailydealFee)>0&&(checkoutGridrow.dailydealFee=e[r].dailydealFee)}catch(e){}void 0!==e[r].isPresetApply&&1==e[r].isPresetApply||0!=e[r].PromotionID||void 0!==e[r].IsInitialDiscount&&1==e[r].IsInitialDiscount?(checkoutGridrow.productDisc=e[r].productDisc,checkoutGridrow.discountedPrice=e[r].Price-e[r].productDisc):(checkoutGridrow.discount=_onlineCheckout.isValidForCheckoutInvoice()?e[r].productDisc:0,checkoutGridrow.discountedPrice=_onlineCheckout.isValidForCheckoutInvoice()?e[r].Price-e[r].productDisc:e[r].Price),void 0!==e[r].dailydealFee&&null!=e[r].dailydealFee&&Number(e[r].dailydealFee)>0&&(checkoutGridrow.price=Math.max(0,checkoutGridrow.price-e[r].dailydealFee),checkoutGridrow.discountedPrice=Math.max(0,checkoutGridrow.discountedPrice-e[r].dailydealFee)),checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].ConstantOriginalServicePrice)?e[r].Price:e[r].ConstantOriginalServicePrice:e[r].Price,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].OriginalDiscountRights)?0:e[r].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].OriginalDiscountType)?1:e[r].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].ApprovedBy)?0:e[r].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].IsAskApprovalPopup)?0:e[r].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].IsShowApprovalPriceDiscount)?0:e[r].IsShowApprovalPriceDiscount:0,checkoutGridrow.pointsGained=e[r].pointsGained,checkoutGridrow.pointsRedeem=0,checkoutGridrow.quantity=1,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.isAutoRenewalMembership=e[r].IsRecurring,checkoutGridrow.membershipPaymentToBeTaken=e[r].IsRecurring,checkoutGridrow.productDisc=e[r].productDisc,checkoutGridrow.serviceDisc=e[r].serviceDisc,checkoutGridrow.chargeFrequency=e[r].ChargeFrequency,checkoutGridrow.isCarryBal=1==checkoutGridrow.isAutoRenewalMembership&&void 0!==e[r].IsCarryForwardBal&&null!=e[r].IsCarryForwardBal&&"true"==e[r].IsCarryForwardBal.toString().toLowerCase(),checkoutGridrow.Relationships=e[r].Relationships,checkoutGridrow.ChildAge=e[r].ChildAge,checkoutGridrow.MaxNoFamilyFriends=null!=e[r].MaxNoFamilyFriends?e[r].MaxNoFamilyFriends:0,null!=_onlineCheckout.SelectedFamilyFriendsArr&&_onlineCheckout.SelectedFamilyFriendsArr.length>0?checkoutGridrow.SelectedFamilyFriends=_onlineCheckout.SelectedFamilyFriendsArr.join(","):"true"==_onlineCheckout.isFromInvoice.toString().toLowerCase()&&(checkoutGridrow.SelectedFamilyFriends=e[r].SelectedFamilyFriends),checkoutGridrow.recurringLimit=e[r].RecurringLimit,checkoutGridrow.message=_onlineCheckout.isValidForCheckoutInvoice()?e[r].message:"",checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(e[r].calculatedTax,3),checkoutGridrow.Taxation=e[r].Taxation,checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(e[r].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(e[r].BusinessTax)?"[]":JSON.stringify(e[r].BusinessTax)),checkoutGridrow.taxes=e[r].TaxValue,checkoutGridrow.PromotionID=e[r].PromotionID,checkoutGridrow.DiscountID=e[r].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(e[r].DiscountType)?1==e[r].IsAmount?2:1:e[r].DiscountType:1==e[r].IsAmount?2:1,checkoutGridrow.AmountValue=e[r].AmountValue,1==isCheckInApp&&""!=glbMembershipData.membershipCardNo&&null!=glbMembershipData.membershipCardNo&&null!=glbMembershipData.membershipCardNo&&(checkoutGridrow.message=glbMembershipData.membershipCardNo),checkoutGridrow.isInitialDiscount=e[r].IsInitialDiscount,checkoutGridrow.initialDiscount=e[r].InitialDiscount,checkoutGridrow.isAmountInitialDiscount=e[r].IsAmountForInitialDiscount,checkoutGridrow.billingCycle=e[r].BillingCycle,!String.isNullOrUndefineOrBlank(e[r].UsedInBiling)&&e[r].UsedInBiling>0?checkoutGridrow.usedInBiling=e[r].UsedInBiling:0!=typeof e[r].BillingCycle&&(checkoutGridrow.usedInBiling=1),"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&(checkoutGridrow.RevenueIsFromTextMarketing=isFromTextMarketing),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&(checkoutGridrow.RevenuePromotionID=parseInt(PromotionAppointmentID));var o=parseFloat(e[r].Price);_onlineCheckout.ApplyConfigItemTip(checkoutGridrow,o,d.Membership),t.push(checkoutGridrow)}},_onlineCheckout.setPackageCheckoutData=function(t,i,a,r){for(var o=Math.max.apply(Math,t.map(function(e){return e.autoId})),n=0;n<=t.length-1;n++){checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()||1==r?t[n].autoId:1,checkoutGridrow.userName=t[n].userName,checkoutGridrow.userID=t[n].userID,checkoutGridrow.serviceProviderID=t[n].serviceProviderID,4==t[n].eventType?(checkoutGridrow.itemID=t[n].SellPackageServiceID,checkoutGridrow.packageDetailId=t[n].ServiceId,!String.isNullOrUndefineOrBlank(t[n].GCUpdatePendingID)&&t[n].GCUpdatePendingID<0?(checkoutGridrow.GCUpdatePendingID=t[n].GCUpdatePendingID,checkoutGridrow.uniqID=t[n].autoId):checkoutGridrow.GCUpdatePendingID=0):checkoutGridrow.itemID=t[n].ServiceId,checkoutGridrow.itemName=t[n].ServiceTitle,checkoutGridrow.pointsGained=t[n].pointsGained,checkoutGridrow.pointsRedeem=0,checkoutGridrow.recordType=d.GiftCertificate,checkoutGridrow.barcodeID=g,checkoutGridrow.FmbFee=t[n].dailydealFee,checkoutGridrow.FMBPercentage=t[n].FMBPercentage,checkoutGridrow.DealBookingType=_onlineCheckout.GetDealBookingType(t[n].dailydealFee,t[n].FMBPercentage),checkoutGridrow.price=t[n].TotalPrice,checkoutGridrow.giftCertificateChangePrice=t[n].TotalPrice,void 0!==t[n].dailydealFee&&null!=t[n].dailydealFee&&Number(t[n].dailydealFee)>0&&(checkoutGridrow.dailydealFee=t[n].dailydealFee),checkoutGridrow.Relationships=t[n].Relationships,checkoutGridrow.ChildAge=t[n].ChildAge,checkoutGridrow.MaxNoFamilyFriends=null!=t[n].MaxNoFamilyFriends?t[n].MaxNoFamilyFriends:0,checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].ConstantOriginalServicePrice)?t[n].TotalPrice:t[n].ConstantOriginalServicePrice:t[n].TotalPrice,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].OriginalDiscountRights)?0:t[n].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].OriginalDiscountType)?1:t[n].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].ApprovedBy)?0:t[n].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].IsAskApprovalPopup)?0:t[n].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].IsShowApprovalPriceDiscount)?0:t[n].IsShowApprovalPriceDiscount:0,null==_onlineCheckout.PackageSharingDetail&&(_onlineCheckout.PackageSharingDetail=[]);var s=e.grep(_onlineCheckout.PackageSharingDetail,function(e){return e.ServiceId==t[n].ServiceId&&e.autoId==t[n].autoId});null!=s&&s.length>0?checkoutGridrow.SelectedFamilyFriends=s[0].SelectedFamilyFriends:"true"==_onlineCheckout.isFromInvoice.toString().toLowerCase()&&(checkoutGridrow.SelectedFamilyFriends=t[n].SelectedFamilyFriends),void 0!==t[n].isPresetApply&&1==t[n].isPresetApply||0!=t[n].PromotionID||void 0!==t[n].IsInitialDiscount&&1==t[n].IsInitialDiscount?(checkoutGridrow.discount=t[n].discount,checkoutGridrow.discountedPrice=t[n].TotalPrice-t[n].discount):(checkoutGridrow.discount=_onlineCheckout.isValidForCheckoutInvoice()?t[n].discount:0,checkoutGridrow.discountedPrice=_onlineCheckout.isValidForCheckoutInvoice()?t[n].Price:t[n].TotalPrice),void 0!==t[n].dailydealFee&&null!=t[n].dailydealFee&&Number(t[n].dailydealFee)>0&&(checkoutGridrow.price=Math.max(0,checkoutGridrow.price-t[n].dailydealFee),checkoutGridrow.discountedPrice=Math.max(0,checkoutGridrow.discountedPrice-t[n].dailydealFee)),checkoutGridrow.quantity=t[n].NoOfVisit,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.isSendEmailToRecipient=!1,checkoutGridrow.isSendEmailToSender=!0,checkoutGridrow.isPrint=!1,checkoutGridrow.assignTo=t[n].userID,checkoutGridrow.expiresOn="never",checkoutGridrow.imagePath="",checkoutGridrow.message="",checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(t[n].calculatedTax,3),checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(t[n].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(t[n].BusinessTax)?"[]":JSON.stringify(t[n].BusinessTax)),checkoutGridrow.taxes=t[n].TaxValue,checkoutGridrow.GCAssignToName="",checkoutGridrow.GCServiceName="",checkoutGridrow.GCColor="",checkoutGridrow.gCPreviewURL="",checkoutGridrow.isRecurring=t[n].IsRecurring,checkoutGridrow.isRecurring?(checkoutGridrow.renewalOn=t[n].ChargeFrequency,checkoutGridrow.RecurringLimit=0==t[n].RecurringLimit?-1:t[n].RecurringLimit,checkoutGridrow.isCarryBal=3!=t[n].ChargeFrequency&&t[n].IsCarryForwardBal):(checkoutGridrow.renewalOn=0,checkoutGridrow.RecurringLimit=0,checkoutGridrow.isCarryBal=!1),checkoutGridrow.recGiftCertificateID=_onlineCheckout.isValidForCheckoutInvoice()||!String.isNullOrUndefineOrBlank(t[n].RecGiftCertificateId)&&t[n].RecGiftCertificateId>0?t[n].RecGiftCertificateId:0,"true"==isWidget.toLowerCase()?checkoutGridrow.purchasedAt="My Widget":"true"==isCustomWebsite.toLowerCase()?checkoutGridrow.purchasedAt="My Vagaro Website":checkoutGridrow.purchasedAt="My Vagaro Page",checkoutGridrow.PromotionID=t[n].PromotionID,checkoutGridrow.DiscountID=t[n].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[n].DiscountType)?1==t[n].IsAmount?2:1:t[n].DiscountType:1==t[n].IsAmount?2:1,checkoutGridrow.AmountValue=t[n].AmountValue,checkoutGridrow.isInitialDiscount=t[n].IsInitialDiscount,checkoutGridrow.initialDiscount=t[n].InitialDiscount,checkoutGridrow.isAmountInitialDiscount=t[n].IsAmountForInitialDiscount,checkoutGridrow.billingCycle=t[n].BillingCycle,!String.isNullOrUndefineOrBlank(t[n].UsedInBiling)&&t[n].UsedInBiling>0?checkoutGridrow.usedInBiling=t[n].UsedInBiling:String.isNullOrUndefineOrBlank(t[n].BillingCycle)||0==t[n].BillingCycle||(checkoutGridrow.usedInBiling=1),"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,checkoutGridrow.AddOnsServiceIds=_onlineCheckout.GetAddonsServiceId(t[n].lstAddonService),checkoutGridrow.AddonServiceDetials=t[n].lstAddonService,"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&(checkoutGridrow.RevenueIsFromTextMarketing=isFromTextMarketing),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&(checkoutGridrow.RevenuePromotionID=parseInt(PromotionAppointmentID)),_onlineCheckout.ApplyConfigItemTip(checkoutGridrow,t[n].TotalPrice,d.GiftCertificate),i.push(checkoutGridrow),o=_onlineCheckout.setAddonServicePackageCheckoutData(t[n],t[n].lstAddonService,i,o)}},_onlineCheckout.setServiceCheckoutData=function(t,i,a){for(var r=0;r<=t.length-1;r++){if(checkoutGridrow={},checkoutGridrow.uniqID=t[r].AppSrNo,checkoutGridrow.userName=t[r].userName,checkoutGridrow.userID=t[r].userID,checkoutGridrow.serviceProviderID=t[r].serviceProviderID,checkoutGridrow.itemID=t[r].serviceid,checkoutGridrow.packageDetailId=t[r].packageDetailId,checkoutGridrow.itemName=t[r].servicename,checkoutGridrow.pointsGained=void 0!==t[r].isPointApply&&t[r].isPointApply?t[r].pointsGained:t[r].pointgiven,checkoutGridrow.pointsRedeem=void 0!==t[r].isPointApply&&t[r].isPointApply?t[r].pointsRedeem:t[r].pointredeem,checkoutGridrow.recordType=t[r].recordType,checkoutGridrow.barcodeID=t[r].barcodeID,checkoutGridrow.price=void 0!==t[r].isPackageApplied&&t[r].isPackageApplied||void 0!==t[r].DiscountType&&2==t[r].DiscountType&&t[r].depositsPercentage>0?t[r].price:t[r].ServiceOrginalPrice,checkoutGridrow.discount=t[r].discount,checkoutGridrow.discountedPrice=void 0!==t[r].isPointApply&&t[r].isPointApply?t[r].ServiceOrginalPrice:t[r].price,checkoutGridrow.quantity=1,checkoutGridrow.packageAssignStatus=void 0!==t[r].isPackageApplied&&t[r].isPackageApplied?1:0,checkoutGridrow.pointAssignStatus=void 0!==t[r].isPointApply&&t[r].isPointApply?1:0,checkoutGridrow.calculatedTax=void 0!==t[r].isPointApply&&t[r].isPointApply?0:_onlineCheckout.parseTodecimal(t[r].calculatedTax,3),checkoutGridrow.BusinessTax=void 0!==t[r].isPointApply&&t[r].isPointApply?null:t[r].BusinessTax,checkoutGridrow.appointmentDate=t[r].appointmentDate,checkoutGridrow.appointmentID=t[r].appointmentID,checkoutGridrow.appointmentTime=t[r].appointmentTime,checkoutGridrow.serviceProviderName=t[r].serviceProviderName,checkoutGridrow.startTime=t[r].startTime,checkoutGridrow.originalServicePriceForPackage=t[r].ServiceOrginalPrice,checkoutGridrow.businessPackageID=t[r].businessPackageID,checkoutGridrow.PromotionID=t[r].PromotionId,checkoutGridrow.redeemID=void 0===t[r].redeemID||""==t[r].redeemID||null==t[r].redeemID?0:t[r].redeemID,checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].ConstantOriginalServicePrice)?t[r].ServiceOrginalPrice:t[r].ConstantOriginalServicePrice:t[r].ServiceOrginalPrice,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].OriginalDiscountRights)?0:t[r].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].OriginalDiscountType)?1:t[r].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].ApprovedBy)?0:t[r].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].IsAskApprovalPopup)?0:t[r].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].IsShowApprovalPriceDiscount)?0:t[r].IsShowApprovalPriceDiscount:0,checkoutGridrow.parentAppointmentID=t[r].parentAppointmentID,t[r].isMembershipApply){var o={};o.BusinessID=t[r].BusinessID,o.RedeemBusinessId=t[r].RedeemBusinessId,o.UserID=_onlineCheckout.isValidForCheckoutInvoice()?a.loginUserID:t[r].userID,o.MembershipID=t[r].MembershipID,o.MembershipItemId=t[r].MembershipItemId,o.ItemType=t[r].ItemType,o.VisitUsed=t[r].VisitUsed,o.Type=2,o.GroupId=t[r].GroupId,o.IsUnlimitedVisit=-1==t[r].Visit,o.ServiceProductName=checkoutGridrow.itemName,checkoutGridrow.MembershipRedeemedDetails=o}if(checkoutGridrow.DiscountID=t[r].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].DiscountType)?1==t[r].IsAmount?2:1:t[r].DiscountType:1==t[r].IsAmount?2:1,checkoutGridrow.AmountValue=t[r].AmountValue,t[r].isPaid&&(t[r].paidType==_onlineCheckout.arrpaidType.Deposits&&(checkoutGridrow.price=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(t[r].payableAmount,2)-_onlineCheckout.parseTodecimal(t[r].deposit,2),2)),checkoutGridrow.isPaid=t[r].isPaid,checkoutGridrow.paidType=t[r].paidType,checkoutGridrow.DiscountID=0,checkoutGridrow.PromotionID=0),t[r].paidType==_onlineCheckout.arrpaidType.Paid)if(onlineShoppingCart.tipPercent>0){_onlineCheckout.TipApplyCounter=++_onlineCheckout.TipApplyCounter;var n=_onlineCheckout.parseTodecimal(t[r].ServiceOrginalPrice-t[r].discount,2),s=0;s=_onlineCheckout.TipApplyCounter==_onlineCheckout.TotalPaidCount||0==n&&r==t.length-1?_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2):_onlineCheckout.parseTodecimal(n*onlineShoppingCart.tipPercent/100,2),checkoutGridrow.calculatedTip=s,_onlineCheckout.TipAppliedSum+=s}else{s=0;onlineShoppingCart.tipValue>0&&(s=_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2)),checkoutGridrow.calculatedTip=s,_onlineCheckout.TipAppliedSum+=s}t[r].paidType!=_onlineCheckout.arrpaidType.OfflineDeposit&&t[r].paidType!=_onlineCheckout.arrpaidType.OfflineDepositPrepay||(checkoutGridrow.payableAmount=_onlineCheckout.parseTodecimal(t[r].payableAmount,2),checkoutGridrow.DepositsRemaining=_onlineCheckout.parseTodecimal(t[r].DepositsRemaining,2),checkoutGridrow.DepositsPaid=_onlineCheckout.parseTodecimal(t[r].DepositsPaid,2),checkoutGridrow.depositsPercentage=_onlineCheckout.parseTodecimal(t[r].depositsPercentage,3),checkoutGridrow.paidType=t[r].paidType,t[r].paidType!=_onlineCheckout.arrpaidType.OfflineDepositPrepay&&(checkoutGridrow.calculatedTax=0,checkoutGridrow.BusinessTax=null)),checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(t[r].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(t[r].BusinessTax)?"[]":JSON.stringify(t[r].BusinessTax)),checkoutGridrow.taxes=t[r].TaxValue,null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(e){if(void 0!==t[r].GCDetail&&null!=t[r].GCDetail&&t[r].GCDetail.length>0)for(var i=0;i<t[r].GCDetail.length;i++)e.giftCertificateID==t[r].GCDetail[i].GCId&&null!=e.Taxes&&(checkoutGridrow.taxes="",checkoutGridrow.calculatedTax=0,checkoutGridrow.BusinessTax=null,checkoutGridrow.tax=0,checkoutGridrow.calculatedTaxTypeWise="[]")}),9==t[r].OriginalpaidType&&(checkoutGridrow.paidType=t[r].OriginalpaidType,checkoutGridrow.IsChargeFee=t[r].IsChargeFee),"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,1==t[r].IsPartialPoint&&(checkoutGridrow.payableAmount=t[r].ServiceOrginalPrice-t[r].PartialPrice,checkoutGridrow.price=t[r].ServiceOrginalPrice),i.push(checkoutGridrow)}},_onlineCheckout.setClassCheckoutData=function(t,i,a,r){for(var o=0;o<=t.length-1;o++)for(var n=t[o].eventEnrollment,s=0;s<=n.length-1;s++)if(t[o].eventID==n[s].eventID){if(checkoutGridrow={},checkoutGridrow.emailId=n[s].cUserEmail,checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?n[s].autoID:_onlineCheckout.GetMaxChkGridRowuniqueId(i),checkoutGridrow.userName="",checkoutGridrow.userID=null==n[s].tmpcustomerID?n[s].customerID:n[s].tmpcustomerID,checkoutGridrow.serviceProviderID=n[s].sPID,checkoutGridrow.itemID=n[s].eventID,checkoutGridrow.packageDetailId=String.isNullOrUndefineOrBlank(n[s].gcId)?0:n[s].gcId,checkoutGridrow.itemName=t[o].eventName,checkoutGridrow.pointsGained=t[o].PointGiven,checkoutGridrow.pointsRedeem=n[s].pointsRedeem,checkoutGridrow.recordType=d.Class,checkoutGridrow.barcodeID=A,checkoutGridrow.FmbFee=n[s].dailydealFee,checkoutGridrow.FMBPercentage=n[s].FMBPercentage,checkoutGridrow.DealBookingType=_onlineCheckout.GetDealBookingType(n[s].dailydealFee,n[s].FMBPercentage),checkoutGridrow.price=void 0!==n[s].isPointApply&&n[s].isPointApply?n[s].Originalprice:parseFloat(String.isNullOrUndefineOrBlank(n[s].price)?0:n[s].price)+parseFloat(String.isNullOrUndefineOrBlank(n[s].discount)?0:n[s].discount),checkoutGridrow.discount=String.isNullOrUndefineOrBlank(n[s].discount)?0:n[s].discount,checkoutGridrow.discountedPrice=void 0!==n[s].isPointApply&&n[s].isPointApply?n[s].Originalprice:n[s].price,void 0!==n[s].dailydealFee&&null!=n[s].dailydealFee&&Number(n[s].dailydealFee)>0&&(checkoutGridrow.price=Math.max(0,checkoutGridrow.price-n[s].dailydealFee),checkoutGridrow.discountedPrice=Math.max(0,checkoutGridrow.discountedPrice-n[s].dailydealFee)),checkoutGridrow.quantity=1,checkoutGridrow.packageAssignStatus=void 0!==n[s].isPackage&&n[s].isPackage?1:0,checkoutGridrow.pointAssignStatus=void 0!==n[s].isPointApply&&n[s].isPointApply?1:0,checkoutGridrow.appointmentDate=n[s].eventDate,checkoutGridrow.appointmentID=n[s].appointmentID,checkoutGridrow.appointmentTime=n[s].startTime,checkoutGridrow.serviceProviderName=n[s].sPName,checkoutGridrow.startTime=n[s].startTime,checkoutGridrow.originalServicePriceForPackage=n[s].Originalprice,checkoutGridrow.businessPackageID=0,checkoutGridrow.PromotionID=n[s].PromotionID,checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].ConstantOriginalServicePrice)?n[s].Originalprice:n[s].ConstantOriginalServicePrice:n[s].Originalprice,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].OriginalDiscountRights)?0:n[s].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].OriginalDiscountType)?1:n[s].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].ApprovedBy)?0:n[s].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].IsAskApprovalPopup)?0:n[s].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].IsShowApprovalPriceDiscount)?0:n[s].IsShowApprovalPriceDiscount:0,checkoutGridrow.membershipDiscount=0,n[s].isMembershipApply){checkoutGridrow.membershipDiscount=String.isNullOrUndefineOrBlank(n[s].membershipDiscount)?0:n[s].membershipDiscount,checkoutGridrow.membershipDiscountOnReceipt=String.isNullOrUndefineOrBlank(n[s].membershipDiscountOnReceipt)?0:n[s].membershipDiscountOnReceipt;var l={};l.BusinessID=n[s].BusinessID,l.RedeemBusinessId=n[s].RedeemBusinessId,l.UserID=null==n[s].tmpcustomerID?n[s].customerID:n[s].tmpcustomerID,l.MembershipID=n[s].MembershipID,l.MembershipItemId=n[s].MembershipItemId,l.ItemType=2,l.VisitUsed=1,l.Type=2,l.GroupId=n[s].GroupId,l.IsUnlimitedVisit=-1==n[s].VisitRemaining,l.ServiceProductName=t[o].eventName,checkoutGridrow.MembershipRedeemedDetails=l}if(n[s].isPackage)objGC={},objGC.giftcertificateId=n[s].gcId,objGC.serviceId=n[s].eventID,objGC.redeemAmt=n[s].redeemAmt,objGC.RedeemServiceId=n[s].RedeemServiceId,objGC.uniqID=checkoutGridrow.uniqID,objGC.AppointmentID=n[s].appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,r?onlineShoppingCart.RedeemedByGCDistri.push(objGC):onlineShoppingCart.RedeemedByGC.push(objGC);else if(!String.isNullOrUndefineOrBlank(n[s].gcId)&&n[s].gcId>0)if(objGC={},objGC.giftcertificateId=n[s].gcId,objGC.serviceId=n[s].eventID,void 0!==n[s].redeemTax&&null!==n[s].redeemTax?objGC.redeemAmt=(n[s].redeemAmt||0)+n[s].redeemTax:objGC.redeemAmt=n[s].redeemAmt||0,null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(e){e.giftCertificateID==n[s].gcId&&null!=e.Taxes&&(n[s].redeemTax=0,n[s].TaxValue="0",n[s].taxprice=0)}),objGC.RedeemServiceId=n[s].RedeemServiceId,objGC.uniqID=checkoutGridrow.uniqID,objGC.AppointmentID=n[s].appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,r)onlineShoppingCart.RedeemedByGCDistri.push(objGC);else{for(var c=onlineShoppingCart.RedeemedByGC,u=0;u<c.length;u++)if(c[u].giftcertificateId===objGC.giftcertificateId&&0===c[u].serviceId){c.splice(u,1);break}objGC.serviceId>0&&objGC.giftcertificateId>0&&onlineShoppingCart.RedeemedByGC.push(objGC)}if(checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(n[s].taxprice,3),checkoutGridrow.BusinessTax=n[s].BusinessTax,checkoutGridrow.DiscountID=n[s].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(n[s].DiscountType)?1==n[s].IsAmount?2:1:n[s].DiscountType:1==n[s].IsAmount?2:1,checkoutGridrow.AmountValue=n[s].AmountValue,checkoutGridrow.sessionAttendeeID=n[s].sessionAttendeeID,n[s].isPaid&&(n[s].paidType==_onlineCheckout.arrpaidType.Deposits&&(checkoutGridrow.price=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(n[s].payableAmount,2)-_onlineCheckout.parseTodecimal(n[s].deposit,2),2)),checkoutGridrow.isPaid=n[s].isPaid,checkoutGridrow.paidType=n[s].paidType,checkoutGridrow.DiscountID=0,checkoutGridrow.PromotionID=0),(n[s].paidType==_onlineCheckout.arrpaidType.PaidClass||n[s].paidType==_onlineCheckout.arrpaidType.Paid)&&onlineShoppingCart.tipPercent>0){_onlineCheckout.TipApplyCounter=++_onlineCheckout.TipApplyCounter;var p=_onlineCheckout.parseTodecimal(n[s].price,2);!String.isNullOrUndefineOrBlank(n[s].deposit)&&n[s].deposit>0&&(p=_onlineCheckout.parseTodecimal(n[s].price,2)+_onlineCheckout.parseTodecimal(n[s].deposit,2)),(1==n[s].isPackage||1==n[s].isPointApply||n[s].isMembershipApply||void 0!==n[s].PromotionID&&null!=n[s].PromotionID&&n[s].PromotionID>0)&&(p=_onlineCheckout.parseTodecimal(n[s].Originalprice,2));var h=0;h=_onlineCheckout.TipApplyCounter==_onlineCheckout.TotalPaidCount||0==p?_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2):_onlineCheckout.parseTodecimal(p*onlineShoppingCart.tipPercent/100,2),checkoutGridrow.calculatedTip=h,_onlineCheckout.TipAppliedSum+=h}n[s].paidType!=_onlineCheckout.arrpaidType.OfflineDeposit&&n[s].paidType!=_onlineCheckout.arrpaidType.OfflineDepositPrepay&&n[s].paidType!=_onlineCheckout.arrpaidType.DepositsClass||(checkoutGridrow.payableAmount=_onlineCheckout.parseTodecimal(n[s].payableAmount,2),"undefined"==n[s].depositsRemaining||null==n[s].depositsRemaining||isNaN(n[s].depositsRemaining)?checkoutGridrow.DepositsRemaining=0:checkoutGridrow.DepositsRemaining=_onlineCheckout.parseTodecimal(n[s].depositsRemaining,2),"undefined"==n[s].depositsPaid||null==n[s].depositsPaid||isNaN(n[s].depositsPaid)?checkoutGridrow.DepositsPaid=0:n[s].IsPartialPoint&&!n[s].IsDepositsOver?checkoutGridrow.DepositsPaid=_onlineCheckout.parseTodecimal(n[s].depositsPaid+n[s].PartialPrice,2):checkoutGridrow.DepositsPaid=_onlineCheckout.parseTodecimal(n[s].depositsPaid,2),checkoutGridrow.depositsPercentage=_onlineCheckout.parseTodecimal(n[s].depositsPercentage,3),checkoutGridrow.paidType=n[s].paidType,n[s].paidType!=_onlineCheckout.arrpaidType.OfflineDepositPrepay&&(checkoutGridrow.calculatedTax=0,checkoutGridrow.BusinessTax=null)),1==n[s].IsPartialPoint&&(checkoutGridrow.payableAmount=n[s].IsPartialDeposits?n[s].price-n[s].PartialPrice:n[s].price),checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(n[s].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(n[s].BusinessTax)?"[]":JSON.stringify(n[s].BusinessTax)),checkoutGridrow.taxes=n[s].TaxValue,9==n[s].OriginalpaidType&&(checkoutGridrow.paidType=n[s].OriginalpaidType,checkoutGridrow.IsChargeFee=n[s].IsChargeFee),"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,"undefined"==typeof hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)||"1"!=hdnPriceWithTaxSwitch.value||(checkoutGridrow.IsIncludeTaxInOnlinePricing=!0);try{void 0!==n[s].dailydealFee&&null!=n[s].dailydealFee&&Number(n[s].dailydealFee)>0&&(checkoutGridrow.dailydealFee=n[s].dailydealFee)}catch(e){}i.push(checkoutGridrow),_onlineCheckout.setClassAddonCheckoutData(n[s].lstAddonService,i,n[s],checkoutGridrow.uniqID)}},_onlineCheckout.setGCCheckoutData=function(t,i,a){for(var r=0;r<=t.length-1;r++){var o=t[r].ServiceId>0;checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?t[r].autoId:1,checkoutGridrow.userName=_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.invoiceDetails.CustomerName)?onlineShoppingCart.invoiceDetails.CustomerName:""==t[r].userName?FullUserName:t[r].userName,checkoutGridrow.userID=t[r].userID,checkoutGridrow.serviceProviderID=t[r].serviceProviderID,checkoutGridrow.itemID=t[r].ServiceId,checkoutGridrow.itemName=_onlineCheckout.isValidForCheckoutInvoice()?t[r].serviceTitle:"",checkoutGridrow.pointsGained=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.recordType=d.GiftCertificate,checkoutGridrow.barcodeID=f,checkoutGridrow.FmbFee=t[r].dailydealFee,checkoutGridrow.DealBookingType=_onlineCheckout.GetDealBookingType(t[r].dailydealFee,t[r].FMBPercentage),checkoutGridrow.price=t[r].TotalPrice;try{void 0!==t[r].dailydealFee&&null!=t[r].dailydealFee&&Number(t[r].dailydealFee)>0&&(checkoutGridrow.dailydealFee=t[r].dailydealFee)}catch(e){}checkoutGridrow.discount=t[r].discount,checkoutGridrow.discountedPrice=checkoutGridrow.itemID>0?t[r].TotalPrice:t[r].Price,void 0!==t[r].dailydealFee&&null!=t[r].dailydealFee&&Number(t[r].dailydealFee)>0&&(checkoutGridrow.price=Math.max(0,checkoutGridrow.price-t[r].dailydealFee),checkoutGridrow.discountedPrice=Math.max(0,checkoutGridrow.discountedPrice-t[r].dailydealFee)),checkoutGridrow.quantity=1==o?t[r].NoOfVisit:0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.isPrint=e("#chkgcprint").prop("checked"),checkoutGridrow.assignTo=_onlineCheckout.isValidForCheckoutInvoice()?t[r].assignTo:0,checkoutGridrow.expiresOn=1==_onlineCheckout.isValidForCheckoutInvoice()?void 0===t[r].ExpiresOn||null==t[r].ExpiresOn||""==t[r].ExpiresOn||"NEVER"==t[r].ExpiresOn.toUpperCase()?"never":t[r].ExpiresOn:"never",checkoutGridrow.giftCertificateCatID=t[r].GiftCertificateCatID,checkoutGridrow.giftCertificatePhotoID=t[r].GiftCertificatePhotoID,checkoutGridrow.imagePath=t[r].imagePath,checkoutGridrow.isAdminImage=t[r].isAdminImage,checkoutGridrow.message=t[r].Message,checkoutGridrow.calculatedTax=t[r].calculatedTax,checkoutGridrow.GCAssignToName=t[r].FullName,checkoutGridrow.GCAssignToEmailId=t[r].Email,checkoutGridrow.GCServiceName=_onlineCheckout.isValidForCheckoutInvoice()&&1==o?t[r].GCServiceName:1==o?t[r].serviceTitle:"",checkoutGridrow.GCColor=t[r].GCFontColor,checkoutGridrow.gCPreviewURL="",checkoutGridrow.isRecurring=!1,checkoutGridrow.renewalOn=0,checkoutGridrow.isCarryBal=!1,checkoutGridrow.recGiftCertificateID=0,checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].ConstantOriginalServicePrice)?t[r].TotalPrice:t[r].ConstantOriginalServicePrice:t[r].TotalPrice,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].OriginalDiscountRights)?0:t[r].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].OriginalDiscountType)?1:t[r].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].ApprovedBy)?0:t[r].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].IsAskApprovalPopup)?0:t[r].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].IsShowApprovalPriceDiscount)?0:t[r].IsShowApprovalPriceDiscount:0,"true"==isWidget.toLowerCase()?checkoutGridrow.purchasedAt="My Widget":"true"==isCustomWebsite.toLowerCase()?checkoutGridrow.purchasedAt="My Vagaro Website":checkoutGridrow.purchasedAt="My Vagaro Page",checkoutGridrow.PromotionID=t[r].PromotionID,checkoutGridrow.DiscountID=t[r].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(t[r].DiscountType)?1==t[r].IsAmount?2:1:t[r].DiscountType:1==t[r].IsAmount?2:1,checkoutGridrow.AmountValue=t[r].AmountValue,"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(t[r].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(t[r].BusinessTax)?"[]":JSON.stringify(t[r].BusinessTax)),checkoutGridrow.taxes=t[r].TaxValue,checkoutGridrow.SenderPhoneNo=t[r].SenderPhoneNo,checkoutGridrow.ReciverPhoneNo=t[r].ReciverPhoneNo,String.isNullOrUndefineOrBlank(t[r].ScheduleDate)?(checkoutGridrow.ScheduleDate=t[r].ScheduleDate,checkoutGridrow.isSendEmailToRecipient=!0,checkoutGridrow.isSendEmailToSender=!0,checkoutGridrow.MailStatus=1):(checkoutGridrow.ScheduleDate=t[r].ScheduleDate,checkoutGridrow.isSendEmailToRecipient=!1,checkoutGridrow.isSendEmailToSender=!1,checkoutGridrow.MailStatus=0),window.location.href.includes("/shopping-bag/invoice")&&String.isNullOrUndefineOrBlank(t[r].ScheduleDate)&&(t[r].IsSendMailtoReceiptInvoice?checkoutGridrow.isSendEmailToRecipient=!0:checkoutGridrow.isSendEmailToRecipient=!1),"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&(checkoutGridrow.RevenueIsFromTextMarketing=isFromTextMarketing),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&(checkoutGridrow.RevenuePromotionID=parseInt(PromotionAppointmentID)),_onlineCheckout.ApplyConfigItemTip(checkoutGridrow,t[r].TotalPrice,d.GiftCertificate),i.push(checkoutGridrow)}},_onlineCheckout.setBusinessFeesCheckoutData=function(e,t,i){for(var a=0;a<=e.length-1;a++)if(e[a].DisplayCalculatedFees>0){checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?e[a].autoId:_onlineCheckout.GetMaxChkGridRowuniqueId(t),checkoutGridrow.itemID=e[a].BusinessFeeID,1==e[a].FeeType?checkoutGridrow.recordType=d.VCFFee:checkoutGridrow.recordType=d.BusinessFee,checkoutGridrow.itemName=e[a].FeeName,checkoutGridrow.price=e[a].DisplayCalculatedFees,checkoutGridrow.AmountType=e[a].AmountType,checkoutGridrow.ApplyType=e[a].ApplyType,checkoutGridrow.TransactionType=e[a].TransactionType,checkoutGridrow.AutoApplyFees=e[a].AutoApplyFees,checkoutGridrow.quantity=e[a].Qty,checkoutGridrow.taxes=e[a].TaxValue,checkoutGridrow.calculatedTaxTypeWise="[]";var r=0;String.isNullOrUndefineOrBlank(e[a].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(e[a].BusinessTax)?"[]":JSON.stringify(e[a].BusinessTax),r=GetCalculateTaxValue(e[a].BusinessTax)),checkoutGridrow.calculatedTax=r,checkoutGridrow.serviceProviderID=e[a].ShopOwnerId,checkoutGridrow.userID=UserID,checkoutGridrow.barcodeID=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Fee,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.pointsGained=0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.originalServicePriceForPackage=e[a].DisplayCalculatedFees,checkoutGridrow.discount=0,checkoutGridrow.discountedPrice=e[a].DisplayCalculatedFees,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.appointmentID=0,checkoutGridrow.FeeAccountType=String.isNullOrUndefineOrBlank(e[a].FeeAccountType)?1:e[a].FeeAccountType,checkoutGridrow.recordType==d.BusinessFee&&_onlineCheckout.ApplyConfigItemTip(checkoutGridrow,e[a].DisplayCalculatedFees,d.BusinessFee),t.push(checkoutGridrow)}},_onlineCheckout.isValidDailyDealFee=function(e){return Number(e||0)>0},_onlineCheckout.setdailydealFeesCheckoutData=function(t,i,a){String.isNullOrUndefineOrBlank(t.Memberships)||e.each(t.Memberships,function(e,t){if(!_onlineCheckout.isValidDailyDealFee(t.dailydealFee))return!0;checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?t.autoId:_onlineCheckout.GetMaxChkGridRowuniqueId(i),checkoutGridrow.itemID=t.MembershipID||0,checkoutGridrow.recordType=d.DailyDealFee,checkoutGridrow.itemName="Vagaro Fee",checkoutGridrow.price=t.dailydealFee,checkoutGridrow.AmountType=0,checkoutGridrow.ApplyType="",checkoutGridrow.TransactionType=0,checkoutGridrow.AutoApplyFees=0,checkoutGridrow.quantity=1,checkoutGridrow.taxes="",checkoutGridrow.calculatedTaxTypeWise="[]";checkoutGridrow.calculatedTax=0,checkoutGridrow.serviceProviderID=t.serviceProviderID,checkoutGridrow.userID=t.userID,checkoutGridrow.barcodeID=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.dailyDealFee,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.pointsGained=0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.originalServicePriceForPackage=t.dailydealFee,checkoutGridrow.discount=0,checkoutGridrow.discountedPrice=t.dailydealFee,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.appointmentID=0,checkoutGridrow.FeeAccountType=1,i.push(checkoutGridrow)}),String.isNullOrUndefineOrBlank(t.Packages)||e.each(t.Packages,function(e,t){if(!_onlineCheckout.isValidDailyDealFee(t.dailydealFee))return!0;checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?t.autoId:_onlineCheckout.GetMaxChkGridRowuniqueId(i),checkoutGridrow.itemID=t.PackageID||0,checkoutGridrow.recordType=d.DailyDealFee,checkoutGridrow.itemName="Vagaro Fee",checkoutGridrow.price=t.dailydealFee,checkoutGridrow.AmountType=0,checkoutGridrow.ApplyType="",checkoutGridrow.TransactionType=0,checkoutGridrow.AutoApplyFees=0,checkoutGridrow.quantity=1,checkoutGridrow.taxes="",checkoutGridrow.calculatedTaxTypeWise="[]";checkoutGridrow.calculatedTax=0,checkoutGridrow.serviceProviderID=t.serviceProviderID,checkoutGridrow.userID=t.userID,checkoutGridrow.barcodeID=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.dailyDealFee,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.pointsGained=0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.originalServicePriceForPackage=t.dailydealFee,checkoutGridrow.discount=0,checkoutGridrow.discountedPrice=t.dailydealFee,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.appointmentID=0,checkoutGridrow.FeeAccountType=1,i.push(checkoutGridrow)}),String.isNullOrUndefineOrBlank(t.Events)||e.each(t.Events,function(t,a){!String.isNullOrUndefineOrBlank(a.eventEnrollment)&&a.eventEnrollment.length>0&&e.each(a.eventEnrollment,function(t,a){if(!_onlineCheckout.isValidDailyDealFee(a.dailydealFee))return!0;checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?a.autoId:_onlineCheckout.GetMaxChkGridRowuniqueId(i),checkoutGridrow.itemID=a.EventID||0,checkoutGridrow.recordType=d.DailyDealFee,checkoutGridrow.itemName="Vagaro Fee",checkoutGridrow.price=a.dailydealFee,checkoutGridrow.AmountType=0,checkoutGridrow.ApplyType="",checkoutGridrow.TransactionType=0,checkoutGridrow.AutoApplyFees=0,checkoutGridrow.quantity=1,checkoutGridrow.taxes="",checkoutGridrow.calculatedTaxTypeWise="[]";if(checkoutGridrow.calculatedTax=0,checkoutGridrow.serviceProviderID=a.sPID,checkoutGridrow.userID=a.customerID,checkoutGridrow.barcodeID=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.dailyDealFee,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.pointsGained=0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.originalServicePriceForPackage=a.dailydealFee,checkoutGridrow.discount=0,checkoutGridrow.discountedPrice=a.dailydealFee,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.appointmentID=a.appointmentID||0,checkoutGridrow.FeeAccountType=1,i.push(checkoutGridrow),a.lstAddonService&&a.lstAddonService.length>0){var r=a.sPID||0;e.each(a.lstAddonService,function(e,t){if(!_onlineCheckout.isValidDailyDealFee(t.dailydealFee))return!0;checkoutGridrow={},checkoutGridrow.uniqID=_onlineCheckout.isValidForCheckoutInvoice()?t.autoId:_onlineCheckout.GetMaxChkGridRowuniqueId(i),checkoutGridrow.itemID=t.AddonID||0,checkoutGridrow.recordType=d.DailyDealFee,checkoutGridrow.itemName="Vagaro Fee",checkoutGridrow.price=t.dailydealFee,checkoutGridrow.AmountType=0,checkoutGridrow.ApplyType="",checkoutGridrow.TransactionType=0,checkoutGridrow.AutoApplyFees=0,checkoutGridrow.quantity=1,checkoutGridrow.taxes="",checkoutGridrow.calculatedTaxTypeWise="[]";checkoutGridrow.calculatedTax=0,checkoutGridrow.serviceProviderID=r,checkoutGridrow.userID=t.customerID,checkoutGridrow.barcodeID=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.dailyDealFee,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.pointsGained=0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.originalServicePriceForPackage=t.dailydealFee,checkoutGridrow.discount=0,checkoutGridrow.discountedPrice=t.dailydealFee,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.appointmentID=0,checkoutGridrow.FeeAccountType=1,i.push(checkoutGridrow)})}})})},_onlineCheckout.GetMaxChkGridRowuniqueId=function(e){var t=1;if(!String.isNullOrUndefineOrBlank(e)&&e.length>0){var i=e[e.length-1];if(!String.isNullOrUndefineOrBlank(i.uniqID)&&i.uniqID>0&&null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&onlineShoppingCart.BusinessFee.some(function(e){return!0===e.isGCApply&&null!=e.GCDetail&&e.GCDetail.length>0}))return i.uniqID;t=e.keySort({uniqID:"desc"})[0].uniqID+1}return t},_onlineCheckout.getUserGCDetail=function(t){if(ShowLoader(!0),null!=onlineShoppingCart){if(1==isCheckInApp&&(onlineShoppingCart.loginUserId=glbDataCheckIn.scanUserID),void 0===onlineShoppingCart.loginUserId&&0==isCheckInApp)return showCommonLoginPopup(),!1;var i=e("<XMLDocument/>");i.append(_vgClassSessionSelection.createXmlElement("UsersDetail"));var a=_vgClassSessionSelection.createXmlElement("User");"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget()&&void 0!==onlineShoppingCart.loginUserId?a.append(_vgClassSessionSelection.createXmlElement("userid",parseInt(onlineShoppingCart.loginUserId))):a.append(_vgClassSessionSelection.createXmlElement("userid",glbEncryptUserIdWithSafeURL)),a.append(_vgClassSessionSelection.createXmlElement("email","")),a.append(_vgClassSessionSelection.createXmlElement("isloginuser",!0)),a.append(_vgClassSessionSelection.createXmlElement("encryptuserid",glbEncryptUserIdWithSafeURL)),i.find("UsersDetail").append(a);for(var r=_vgClassSessionSelection.ManageEventTempAndRealData(!0,!0,!1),o=0;o<=r.length-1;o++){if(parseInt(onlineShoppingCart.loginUserId)!=parseInt(r[o].customerID))(a=_vgClassSessionSelection.createXmlElement("User")).append(_vgClassSessionSelection.createXmlElement("userid",parseInt(r[o].customerID))),a.append(_vgClassSessionSelection.createXmlElement("email",r[o].cUserEmail)),i.find("UsersDetail").append(a)}var d=e("<XMLDocument/>"),c="",u="";if(null!=onlineShoppingCartmain.Inventories&&onlineShoppingCartmain.Inventories.length>0){var p=_vgClassSessionSelection.createXmlElement("itms");for(o=0;o<onlineShoppingCartmain.Inventories.length;o++){(c=_vgClassSessionSelection.createXmlElement("itm")).append(_vgClassSessionSelection.createXmlElement("ity",1==onlineShoppingCartmain.Inventories[o].IsPartial?_PackageMembership.PartialProduct:_PackageMembership.Product)),u=_vgClassSessionSelection.createXmlElement("ns");var h=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.Inventories[o].ProductName,!0);u.append(h),c.append(u),p.append(c)}d.append(p)}var m=e("<XMLDocument/>"),f=e("<XMLDocument/>");if(null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0){m.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",2)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(o=0;o<onlineShoppingCartmain.Events.length;o++){var g=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.Events[o].eventName.trim());m.find("ns").append(g)}var v=!0;for(o=0;o<onlineShoppingCartmain.Events.length;o++)e.each(onlineShoppingCartmain.Events[o].eventEnrollment,function(t,i){null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0&&(v&&f.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",8)).append(_vgClassSessionSelection.createXmlElement("ns")))),e.each(i.lstAddonService,function(e,t){v&&(v=!1);var i=_vgClassSessionSelection.createXmlElement("n",t.ServiceTitle.trim());f.find("ns").append(i)}))})}var A=e("<XMLDocument/>");if(_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCartmain.ServiceInvoice&&onlineShoppingCartmain.ServiceInvoice.length>0){var C=_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",1)).append(_vgClassSessionSelection.createXmlElement("ns"));for(o=0;o<onlineShoppingCartmain.ServiceInvoice.length;o++)if(19!=onlineShoppingCartmain.ServiceInvoice[o].recordType){var y=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.ServiceInvoice[o].servicename.trim());C.find("ns").append(y)}A.append(_vgClassSessionSelection.createXmlElement("itms").append(C));var b=onlineShoppingCartmain.ServiceInvoice.filter(function(e){return 19==e.recordType});if(!String.isNullOrUndefineOrBlank(b)&&b.length>0){for(var S=_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",7)).append(_vgClassSessionSelection.createXmlElement("ns")),k=0;k<b.length;k++){var D=_vgClassSessionSelection.createXmlElement("n",b[k].servicename.trim());S.find("ns").append(D)}A.find("itms").length>0&&A.append(A.find("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(S.html())))}}d.find("itms").length>0?(m.find("itms").length>0&&d.find("itms").append(m.find("itms").html()),_onlineCheckout.isValidForCheckoutInvoice()&&A.find("itms").length>0&&d.find("itms").append(A.find("itms").html()),f.find("itms").length>0&&d.find("itms").append(f.find("itms").html())):m.find("itms").length>0?(d=m,_onlineCheckout.isValidForCheckoutInvoice()&&A.find("itms").length>0&&d.find("itms").append(A.find("itms").html()),f.find("itms").length>0&&d.find("itms").append(f.find("itms").html())):_onlineCheckout.isValidForCheckoutInvoice()&&A.find("itms").length>0?(d=A,f.find("itms").length>0&&d.find("itms").append(f.find("itms").html())):f.find("itms").length>0&&(d=f);var _=!1;!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events)&&isCCRequiredForOnlineClass&&(_=!0);var I=!1,w=!1;"undefined"!=typeof IsClassReschedule&&"true"==IsClassReschedule.toLowerCase()&&void 0!==IsPaid&&"true"==IsPaid.toString().toLowerCase()?I=!1:String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events)||e.grep(onlineShoppingCartmain.Events,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(e){1==e.StreamingStatus&&1==_onlineCheckout.IsCCSupportedCountry()&&(I=!0,_=!0),String.isNullOrUndefineOrBlank(e.IsFromHomePage)||1!=e.IsFromHomePage||(w=!0)})});var P={};P.userData=i.html(),P.businessID=onlineShoppingCart.BusinessID,P.productList=d.html(),P.isGetDepositsConfig=_,P.isZoomEvents=I,"undefined"==typeof PromotionID||String.isNullOrUndefineOrBlank(PromotionID)?P.promotionID=0:P.promotionID=parseInt(PromotionID),P.isWebsiteBuilder=void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof vgAppicationType&&1==vgAppicationType;var T=new vagaro.ajax;T.datamodel.Token=ApiURLEnumOnlineCheckout.getgcpackageandpointforonlinecheckout,T.datamodel.IsNewVagaroAPI=!0,T.datamodel.callback=function(i){if(ShowLoader(!1),void 0!==i.IsCheckForVagaroAppApple&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==i.IsCheckForVagaroAppApple){var a=_onlineCheckout.getiOSCustomerAppVersion()+"~false";i.IsCheckForVagaroAppApple.indexOf(a)>-1&&(i.depositsClassConfigForCheckout.isCCRequiredForOnlineClass=!1,i.depositsClassConfigForCheckout.depositsPer=0,IsCCCapturedAllowed="false")}if(_onlineCheckout.IsAnyDailyDealInCart()&&(i.lstUserListForCheckout?.forEach(e=>{e.pointsBalance=0}),i.lstGcAndPackagesForCheckout=e.grep(i.lstGcAndPackagesForCheckout||[],function(e){return e&&1==e.isPackage})),IsFMBEnableForBusiness=i.IsFMBEnableForBusiness,onlineShoppingCartmain.UsersPoints=i.lstUserListForCheckout,onlineShoppingCartmain.IsPromotionEnable=i.IsPromotionEnable,onlineShoppingCart.IsPromotionEnable=i.IsPromotionEnable,onlineShoppingCart.IsDailyDealEnable=i.depositsClassConfigForCheckout.IsDailyDealEnable,onlineShoppingCartmain.IsEnableVCFFee=i.depositsClassConfigForCheckout.IsEnableVCFFee,onlineShoppingCartmain.IsDailyDealEnable=i.depositsClassConfigForCheckout.IsDailyDealEnable,onlineShoppingCart.lstPromotionData=[],onlineShoppingCart.lstPromoDetails=[],onlineShoppingCartmain.DepositsPer=i.depositsClassConfigForCheckout.depositsPer,onlineShoppingCartmain.DepositsLimit=i.depositsClassConfigForCheckout.depositsLimit,onlineShoppingCartmain.IsCardNotPresent=i.depositsClassConfigForCheckout.IsCardNotPresent,onlineShoppingCartmain.DepositAmtType=i.depositsClassConfigForCheckout.IsClsDepositAmtType,onlineShoppingCartmain.TipOption=i.depositsClassConfigForCheckout.TipOption,onlineShoppingCartmain.TipType=i.depositsClassConfigForCheckout.TipType,void 0!==i.depositsClassConfigForCheckout.TipOnItems&&null!=i.depositsClassConfigForCheckout.TipOnItems&&""!=i.depositsClassConfigForCheckout.TipOnItems.toString().trim()&&(tipOnItems=i.depositsClassConfigForCheckout.TipOnItems),_onlineCheckout.VPLUserBankDetails=onlineShoppingCartmain.VPLUserBankDetails=i.lstVPLUserAccount,0!=i.IsDepositNoshowFeatureOn||_onlineCheckout.isValidForCheckoutInvoice()||(onlineShoppingCartmain.TipOption=""),onlineShoppingCartmain.IsFullDeposit=!1,_onlineCheckout.isValidForCheckoutInvoice()||void 0===onlineShoppingCartmain.TipOption||null==onlineShoppingCartmain.TipOption||""==onlineShoppingCartmain.TipOption||"0"==onlineShoppingCartmain.TipOption||(onlineShoppingCart.tipValue=0,e("#divTip").show(),e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+"0.00"),e("#divfinalCheckoutTipAmount").hide(),e("#txtOnlineCustomerTip").hide(),e("#dvTipBlock").hide("")),void 0===n&&(n=isCCRequiredForOnlineClass,s=IsOnLineShoppingCart,l=t),I){var r=i.depositsClassConfigForCheckout.isCCRequiredForOnlineClass?"True":"False";i.depositsClassConfigForCheckout.isCCRequiredForOnlineClass&&(isCCRequiredForOnlineClass=r,IsOnLineShoppingCart=r,t=!1)}else isCCRequiredForOnlineClass=n,IsOnLineShoppingCart=s,t=l;if(1==w&&(t=!1),_onlineCheckout.PromoBox(),onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail=e.extend(!0,[],i),1==t)_onlineCheckout.isConsiderForms&&"True"==e("#hdnIsFormsEnable").val()&&"false"==IsClassReschedule.toLowerCase()?(_onlineCheckout.isFormsDirectClass=!0,_onlineCheckout.GetFormsByIds(),_onlineCheckout.isConsiderForms=!1):_onlineCheckout.DirectClassCheckout();else{("true"==isCCRequiredForOnlineClass.toLowerCase()||"true"==IsOnLineShoppingCart.toLowerCase()&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0)&&_onlineCheckout.BindPaymentOption(i),_onlineCheckout.initWebFlowtab(),_onlineCheckout.ApplyDiscounts(i.lstGcAndPackagesForCheckout,i.lstUserListForCheckout,i.lstMembershipForCheckout,i.IsPromotionEnable);var o=!1;!String.isNullOrUndefineOrBlank(onlineShoppingCart)&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.GiftCertificates)&&onlineShoppingCart.GiftCertificates.length>0&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Packages)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Memberships)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&String.isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&(o=!0),_onlineCheckout.isConsiderForms&&"True"==e("#hdnIsFormsEnable").val()&&"false"==IsClassReschedule.toLowerCase()&&0==o&&(_onlineCheckout.isConsiderForms=!1,_onlineCheckout.isFormsDirectClass=!1,_onlineCheckout.GetFormsByIds())}if(_onlineCheckout.IsSelectGCEmployeeForWidget(),void 0===_onlineCheckout.IsMemPackageUpSell||1!=_onlineCheckout.IsMemPackageUpSell&&1!=_shopdetail.IsMemPkgReqToBook||_shopdetail.GetMembershipList(_onlineCheckout.ShoppingCartItemIds(!1,2,!0),onlineShoppingCart.loginUserId,!0,_onlineCheckout.ShoppingCartItemIds(!1,3)),null!=_onlineCheckout._fmbTipRestore){var d=_onlineCheckout._fmbTipRestore;_onlineCheckout._fmbTipRestore=null;var c=_onlineCheckout.parseTodecimal(d.tipValue,2);if(c>0&&!_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==onlineShoppingCartmain.TipOption&&null!=onlineShoppingCartmain.TipOption&&""!=onlineShoppingCartmain.TipOption&&"0"!=onlineShoppingCartmain.TipOption){_onlineCheckout.ShowTipOptions(),onlineShoppingCart.tipValue=c,onlineShoppingCart.tipPercent=d.tipPercent,e("#lstTipTabList .tip-tab").removeClass("active");var u=e("#lstTipTabList .tip-tab").filter(function(){var t=e(this).attr("tip-percentage");return null!=t&&"0"!=t&&parseFloat(t)==parseFloat(d.tipPercent)}).first();d.tipPercent>0&&u.length>0?(u.addClass("active"),e(".tipBlock").hide()):(e("#lstTipTabList .tip-tab[tip-percentage='0']").addClass("active"),e(".tipBlock").show(),e("#txtOnlineCustomerTip").val(c.toFixed(2)).show()),e("#divfinalCheckoutTipAmount").show(),_onlineCheckout.displayFinalCalculatedPrice(),parseFloat(onlineShoppingCart.tipValue)>0&&_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout"),_onlineCheckout.IsVCFEnable()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.ApplyTip),_onlineCheckout.displayFinalCalculatedPrice())}}},T.datamodel.data=P,T.datamodel.Error=function(e){window.location.reload(),ShowLoader(!1),1==t?_onlineCheckout.DirectClassCheckout():_onlineCheckout.checkoutGotoNextStep(!1)},T.Post()}else ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},_onlineCheckout.ApplyDiscounts=function(t,i,a,r,o){onlineShoppingCart=e.extend(!0,{},onlineShoppingCartmain),onlineShoppingCart.FinalCCAmount=0,onlineShoppingCart.ccAmt=0,onlineShoppingCart.amtPaid=0,onlineShoppingCart.tax=0,onlineShoppingCart.Rtax=0,onlineShoppingCart.taxdifference=0,onlineShoppingCart.gcAmt=0,onlineShoppingCart.RedeemedByGCtemp=[],onlineShoppingCart.RedeemedByGC=[],onlineShoppingCart.shippingSurcharge=0,onlineShoppingCart.PackageAmount=0,onlineShoppingCart.tipValue=0,onlineShoppingCart.depositTotal=0,onlineShoppingCart.classSubTotal=0,onlineShoppingCart.classTax=0,onlineShoppingCart.classGCUsed=0,onlineShoppingCart.classPackageUsed=0,onlineShoppingCart.classFinalTotal=0,onlineShoppingCart.discount=0,onlineShoppingCart.lstMembership=a,onlineShoppingCart.lstMembershipOld=JSON.parse(JSON.stringify(a)),onlineShoppingCart.classdiscount=0,onlineShoppingCart.IsPromotionEnable=r,onlineShoppingCart.lstPromotionData=[],onlineShoppingCart.lstPromoDetails=[],onlineShoppingCart.lstGCPkgData=JSON.parse(JSON.stringify(t)),!String.isNullOrUndefineOrBlank(onlineShoppingCart.lstGCPkgData)&&onlineShoppingCart.lstGCPkgData.length>0&&e.each(onlineShoppingCart.lstGCPkgData,function(e,t){t.ResetcurrentBalance=t.currentBalance}),onlineShoppingCart.DepositsRemaining=0,onlineShoppingCart.InvoiceDepositsRemaining=0,onlineShoppingCart.FeeDepositsRemaining=0,onlineShoppingCart.FeeTaxDepositsRemaining=0,onlineShoppingCart.PartialPrice=0,e("#divGiftCertificateCart").show(),1==_onlineCheckout.IsClassBookingOnly(!0)&&"true"!=isCCRequiredForOnlineClass.toLowerCase()||_onlineCheckout.createGiftCertificates(onlineShoppingCart.lstGCPkgData),e.grep(onlineShoppingCart.UsersPoints,function(e){e.userId==onlineShoppingCart.loginUserId&&e.userId>0&&(onlineShoppingCart.loginUserEmail=e.emailId)});var n=null!=o&&void 0!==o?o.giftCertificateNo:"",s=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return!(1!=e.eventType&&7!=e.eventType||""!=n&&n==e.giftCertificateNo)}),l=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return!(1!=e.eventType&&7!=e.eventType&&2!=e.eventType||""!=n&&n==e.giftCertificateNo)});if(null!=s&&s.length>0){var c={serviceID:"desc",GiftCertificateAmt:"asc"};s.keySort(c),null!=o&&void 0!==o&&null==o.serviceID&&s.splice(0,0,o)}else null!=o&&void 0!==o&&null==o.serviceID&&s.splice(0,0,o);if(_onlineCheckout.ApplyDailyDealONPackages(),_onlineCheckout.ApplyDailyDealONMemberships(),_onlineCheckout.ApplyDailyDealONGC(),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0){_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.ServiceInvoice,d.ServiceInvoice);var u=!1,p=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return 1==e.isPackage&&(0==e.isCustomPackage||1==e.isCustomPackage&&null==e.serviceID)&&(1==e.isCustomPackage&&null==e.serviceID&&0==u&&(u=!0),!0)});if(null!=p&&p.length>0){c={expiresOn:"asc",quantity:"asc"};p.keySort(c);var h=[];1==u&&(e.grep(p,function(t){h.push(t);var i=e.grep(onlineShoppingCart.lstGCPkgData,function(e){return 1==e.isPackage&&1==e.isCustomPackage&&t.giftCertificateID==e.giftCertificateID&&null!=e.serviceID});i.length>0&&(h=h.concat(i))}),p=h)}_onlineCheckout.ApplyPackageOnServices(onlineShoppingCart.ServiceInvoice,p),_onlineCheckout.ApplyPointsONServices(onlineShoppingCart.ServiceInvoice,onlineShoppingCart.UsersPoints),_onlineCheckout.ApplyMembershipONServices(onlineShoppingCart.ServiceInvoice,a),_onlineCheckout.calculateDepositsOnInvoice(!0);var m=e.grep(s,function(e,t){return!e.isPackage&&null==e.serviceID||!e.isPackage&&null!=e.serviceID});if(null!=m&&m.length>0){c={serviceID:"desc",serviceName:"desc"};m.keySort(c)}_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.ServiceInvoice,m,d.ServiceInvoice),_onlineCheckout.calculateDepositsOnInvoice(!1)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.Memberships,d.Membership),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.Memberships,s,d.Membership)),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.GiftCertificates,d.GiftCertificate),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.GiftCertificates,s,d.GiftCertificate)),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.Packages,d.Package),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.Packages,s,d.Package)),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.Inventories,d.Product);var f=_onlineCheckout.ApplyPointsONProduct(onlineShoppingCart.Inventories,onlineShoppingCart.UsersPoints);if(_onlineCheckout.IsPartialPointAllowed){var g=e.grep(onlineShoppingCart.Inventories,function(e){return void 0!==e.IsPartialPoint&&1==e.IsPartialPoint});null!=g&&g.length>0&&_onlineCheckout.ApplyGCONAllItems(g,s,d.Product)}var v=e.grep(f,function(e){return 1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)});null!=v&&v.length>0&&(_onlineCheckout.ApplyMembershipONProduct(v,a),_onlineCheckout.ApplyGCONAllItems(v,l,d.Product)),e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){i.isPresetApply=!1,i.isGCApply=!1,i.isMembershipApply=!1,i.isPointApply=!1,i.isPointApplyPartial=!1,i.membershipName="",i.Price=0;var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId}),r=0,o=[],n=[],s=!1,l=!1;if(e.each(a,function(e,t){void 0!==t.isPointApply&&0==t.isPointApply?i.Price+=t.Price:void 0!==t.isPointApply&&1==t.isPointApply&&1==t.IsPartialPoint?i.Price+=t.Price-t.PartialPrice:r+=1,void 0!==t.isPointApply&&1==t.isPointApply&&1==_onlineCheckout.IsPartialPointAllowed&&(i.pointsRedeem+=t.pointsRedeem),i.isPresetApply=1==i.isPresetApply||t.isPresetApply,i.isGCApply=1==i.isGCApply||t.isGCApply,i.isMembershipApply=1!=t.isPackageApplied&&(1==i.isMembershipApply||t.isMembershipApply),i.isPackageApplied=1==i.isPackageApplied||t.isPackageApplied,t.isPackageApplied&&(s=!0),t.isMembershipApply&&(l=!0),t.isMembershipApply&&-1==o.indexOf(t.membershipName)&&o.push(t.membershipName),t.isPackageApplied&&-1==n.indexOf(t.membershipName)&&n.push(t.membershipName)}),s&&null!=n&&n.length>0){var d=n.join();i.membershipName=d,i.packageName=d,i.isPackageBundleApplied=!0}if(l&&null!=o&&o.length>0){var c=o.join();i.membershipName=c,i.isMembershipBundleApplied=!0}a.length==r?i.isPointApply=!0:r>0&&(i.isPointApplyPartial=!0)}})}var A=!1;if(null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){u=!1;var C=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return(2==e.eventType||8==e.eventType)&&(0==e.isCustomPackage||1==e.isCustomPackage&&null==e.serviceID)&&(1==e.isCustomPackage&&null==e.serviceID&&0==u&&(u=!0),!0)}),y=[];if(C.length>0&&(1==_onlineCheckout.IsCCDetailEnable()||1==_onlineCheckout.IsUpSellMemPkgAdd)){c={isPackage:"desc",expiresOn:"asc",quantity:"asc"};C.keySort(c),1==u?e.grep(C,function(t){y.push(t);var i=e.grep(onlineShoppingCart.lstGCPkgData,function(e){return(2==e.eventType||8==e.eventType)&&1==e.isPackage&&1==e.isCustomPackage&&t.giftCertificateID==e.giftCertificateID&&null!=e.serviceID});i.length>0&&(y=y.concat(i))}):y=C}_onlineCheckout.ApplyPointsONEvents(onlineShoppingCart.Events,onlineShoppingCart.UsersPoints,y),y.length>0?onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events,!0,y):onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events),_onlineCheckout.ApplyDailyDealONEvents(),_onlineCheckout.ApplyMembershipONEvents(onlineShoppingCart.Events,a),_onlineCheckout.calculateDepositsOnEvents(),_onlineCheckout.ApplyPriceBaseGCOnEvents(s,!1);e.grep(onlineShoppingCart.Events,function(t,i){return e.grep(t.eventEnrollment,function(e,t){return 4==e.paidType}).length>0&&(A=!0),A})}if(null!=onlineShoppingCart.ServiceInvoice&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){e.paidType==_onlineCheckout.arrpaidType.Paid&&(A=!0)}),onlineShoppingCartmain.IsFullDeposit=A,null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&(e.grep(onlineShoppingCart.BusinessFee,function(e){1==e.FeeType&&(e.ActualPrice=0,e.ActualTax=0,e.RemainingPrice=0,e.RemainingTax=0,e.CalculatedTax=0,e.CalculatedFeesForClass=0,e.CalculatedTaxForClass=0)}),_onlineCheckout.ApplyMultipleFeesonAllItems(0),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.BusinessFee,s,d.BusinessFee)),onlineShoppingCart.tax>0){var b=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax,2),S=onlineShoppingCart.tax;S!=b&&(onlineShoppingCart.taxdifference=_onlineCheckout.parseTodecimal(S-b,2),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax-onlineShoppingCart.taxdifference,2),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid-onlineShoppingCart.taxdifference,2),onlineShoppingCart.ccAmt>0&&onlineShoppingCart.ccAmt>onlineShoppingCart.taxdifference?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-onlineShoppingCart.taxdifference,2):onlineShoppingCart.gcAmt>0&&onlineShoppingCart.gcAmt>onlineShoppingCart.taxdifference&&(onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt-onlineShoppingCart.taxdifference,2)))}if(onlineShoppingCart.RedeemedByGCtemp.length>0){onlineShoppingCart.RedeemedByGC=[];var k=e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){return 1!=e.IsClass}),D=k.uniqueObjects(["GCId"]);e.grep(D,function(t){_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg==t.Type?(objGC={},objGC.giftcertificateId=t.giftcertificateId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.RedeemServiceId=t.serviceId,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,e.grep(k,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC==t.Type?(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.RedeemServiceId=t.serviceId,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,e.grep(k,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),objGC.GCredeemAmtForDisc=objGC.redeemAmt,onlineShoppingCart.RedeemedByGC.push(objGC)):(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=0,objGC.redeemAmt=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type="GC",e.grep(k,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.GCAmount,3))}),onlineShoppingCart.RedeemedByGC.push(objGC))})}_onlineCheckout.PaymentOptionSelectDeselect(),_onlineCheckout.checkoutGotoNextStep(!1)},_onlineCheckout.calculateDepositsOnInvoice=function(t){var i=0;null!=onlineShoppingCart.ServiceInvoice&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){t&&(e.OriginalpaidType=e.paidType),e.paidType=_onlineCheckout.arrpaidType.Paid,void 0!==e.isPackageApplied&&0==e.isPackageApplied&&(void 0!==e.isPointApply&&0==e.isPointApply||e.IsPartialPoint)&&0==e.isServiceBaseGC&&e.OriginalpaidType==_onlineCheckout.arrpaidType.OfflineDeposit&&e.depositsPercentage>0&&(onlineShoppingCartmain.DepositsPer=e.depositsPercentage,e.depositsPaid=_onlineCheckout.parseTodecimal(e.price*e.depositsPercentage/100,2),e.paidType=_onlineCheckout.arrpaidType.OfflineDeposit,i=_onlineCheckout.parseTodecimal(i+_onlineCheckout.parseTodecimal(e.price+e.calculatedTax-e.depositsPaid,2),2)),e.BusinessTax=String.isNullOrUndefineOrBlank(e.Taxes)||"[]"==e.Taxes?"[]":JSON.parse(e.Taxes),void 0!==e.deposit&&null!=e.deposit&&e.deposit>0?1==onlineShoppingCart.IsIncludeTaxInOnlinePricing&&e.discount>0?e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.ServiceOrginalPrice-e.discount,e):e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.ServiceOrginalPrice,e):e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.price,e)}),onlineShoppingCart.InvoiceDepositsRemaining=i},_onlineCheckout.CalculateApplyPointsProductPrice=function(e,t){return 1==parseInt(e.Quantity)?t*e.Price/e.OriginalPointsRedeem:t*e.Price/(e.OriginalPointsRedeem*parseInt(e.Quantity))},_onlineCheckout.ApplyPointsONProduct=function(t,i){var a=[],r=0,o=e.grep(onlineShoppingCart.UsersPoints,function(e){return e.userId==onlineShoppingCart.loginUserId&&e.userId>0});return null!=o&&null!=o&&o.length>0&&(o=o[0],r=o.pointsBalance),e.grep(t,function(e){_onlineCheckout.isValidForCheckoutInvoice()?void 0!==e.isPresetApply&&1==e.isPresetApply&&(e.discount=e.discount):e.discount=0,_onlineCheckout.isValidForCheckoutInvoice()||!String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)||!String.isNullOrUndefineOrBlank(e.MasterInventoryId)&&e.MasterInventoryId>0?e.OriginalPrice=e.SellingPrice:void 0!==e.OriginalPointsRedeem&&e.OriginalPointsRedeem>0?e.OriginalPrice=parseFloat(e.Price):e.OriginalPrice=e.SellingPrice,1==e.IsFreeShipping&&0==e.MasterInventoryId&&(onlineShoppingCart.shippingSurcharge=_onlineCheckout.parseTodecimal(onlineShoppingCart.shippingSurcharge+e.Quantity*e.ShippingSurcharge,2)),void 0===e.OriginalPointsRedeem&&(e.OriginalPointsRedeem=e.pointsRedeem);var t=Math.round(e.OriginalPointsRedeem*(e.IsPartial?_onlineCheckout.parseTodecimal(e.Quantity,2):parseInt(e.Quantity)));if(e.originalpointsGained=e.pointsGained,t>0&&r>=t&&r>0)_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==e.isPresetApply&&1==e.isPresetApply?(e.isPointApply=!1,e.pointsRedeem=0):(e.discount=0,_onlineCheckout.isValidForCheckoutInvoice()&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-e.originalDiscount,2)),e.isPointApply=!0,e.isPackageApplied=!1,e.pointsRedeem=t,e.pointsGained=0,r=parseInt(r-t),o.pointsBalance=r,onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(e.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(e.pointsRedeem),e.redeemAmt=0,e.redeemTax=0,e.ActualPrice=parseFloat(e.Price),e.ActualTax=parseFloat(e.calculatedTax),e.IsPartialPoint=!1);else if(_onlineCheckout.IsPartialPointAllowed&&t>0&&r>0)if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==e.isPresetApply&&1==e.isPresetApply)e.isPointApply=!1,e.pointsRedeem=0;else{parseInt(t-r);var i=parseInt(r);e.discount=0,_onlineCheckout.isValidForCheckoutInvoice()&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-e.originalDiscount,2)),e.isPointApply=!0,e.isPackageApplied=!1,e.pointsRedeem=i,e.pointsGained=0,r=parseInt(r-i),o.pointsBalance=r,onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(e.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(e.pointsRedeem),e.redeemAmt=0,e.redeemTax=0,e.IsPartialPoint=!0,e.PartialPrice=parseFloat(_onlineCheckout.CalculateApplyPointsProductPrice(e,i)),e.ActualPrice=_onlineCheckout.parseTodecimal(parseFloat(e.Price-e.PartialPrice),2),e.ActualTax=_onlineCheckout.parseTodecimal(e.ActualPrice*e.Tax/100,3),e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.ActualPrice,e)}else e.isPointApply=!1,e.pointsRedeem=0,e.IsPartialPoint=!1,e.PartialPrice=0,e.ActualPrice=0;a.push(e)}),a},_onlineCheckout.GetMembershipDiscountAmount=function(e,t){var i=0;return 1==t.isAmountValue||1==t.IsAmountValue?(i=_onlineCheckout.parseTodecimal(t.Discount,2))>_onlineCheckout.parseTodecimal(e,2)&&(i=_onlineCheckout.parseTodecimal(e,2)):i=_onlineCheckout.parseTodecimal(e*t.Discount/100,2),i},_onlineCheckout.GetMembershipParentGroupId=function(e){var t=null!=e.parentGroupId?e.parentGroupId:e.ParentGroupId;return String.isNullOrUndefineOrBlank(t)?0:Number(t)},_onlineCheckout.SyncMembershipVisitRemaining=function(t,i){var a=_onlineCheckout.GetMembershipParentGroupId(i),r=e.grep(t,function(e){return e!==i&&i.BusinessID==e.BusinessID&&(a>0?i.MembershipID==e.MembershipID&&a==_onlineCheckout.GetMembershipParentGroupId(e):i.MembershipItemId>0&&i.MembershipItemId==e.MembershipItemId||0!=i.GroupId&&i.GroupId==e.GroupId&&i.ServiceProductName.toLowerCase().trim()!=e.ServiceProductName.toLowerCase().trim())});e.each(r,function(e,t){t.VisitRemaining=i.VisitRemaining})},_onlineCheckout.ApplyMembershipONProduct=function(t,i){e.grep(t,function(t){null!=(i=e.grep(i,function(e){return e.ItemType==_PackageMembership.Product||e.ItemType==_PackageMembership.PartialProduct}))&&i.length>0&&e.each(i,function(e,a){if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==t.isPresetApply&&1==t.isPresetApply&&0==a.IsAllowPreSetDiscount)return!1;if(a.ServiceProductName==t.ProductName&&(a.VisitRemaining>0&&t.Quantity<=a.VisitRemaining||-1==a.VisitRemaining)){if(1==t.isMembershipApply&&_onlineCheckout.RemoveDicount(d.Product,h,t.autoId),t.isMembershipApply=!0,String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply||void 0!==onlineShoppingCart.UsersPoints&&null!=onlineShoppingCart.UsersPoints&&"undefined"!=onlineShoppingCart.UsersPoints[0].pointsBalance&&(onlineShoppingCart.UsersPoints[0].pointsBalance+=t.OriginalPointsRedeem),t.isPointApply=!1,t.isPackageApplied=!1,_onlineCheckout.isValidForCheckoutInvoice()){if(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-t.originalDiscount,2),t.OriginalPrice=t.SellingPrice,void 0!==t.isPresetApply&&1==t.isPresetApply&&1==a.IsAllowPreSetDiscount){var r=_onlineCheckout.GetMembershipDiscountAmount(t.SellingPrice,a);t.discount=_onlineCheckout.parseTodecimal(t.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else t.discount=_onlineCheckout.GetMembershipDiscountAmount(t.SellingPrice,a);t.Price=_onlineCheckout.parseTodecimal(t.SellingPrice-t.discount,2),t.ActualPrice=_onlineCheckout.parseTodecimal(t.Price,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),t.ActualTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3)}else t.discount=_onlineCheckout.GetMembershipDiscountAmount(t.Price,a),t.Price=_onlineCheckout.parseTodecimal(t.Price-t.discount,2),t.ActualPrice=_onlineCheckout.parseTodecimal(t.Price,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),t.ActualTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3);return onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+t.discount,2),a.VisitRemaining=-1==a.VisitRemaining?a.VisitRemaining:a.VisitRemaining-t.Quantity,t.RedeemBusinessId=a.BusinessID,t.VisitUsed=t.Quantity,t.Visit=a.Visit,t.ItemType=a.ItemType,t.BusinessID=onlineShoppingCart.BusinessID,t.MembershipID=a.MembershipID,t.MembershipItemId=a.MembershipItemId,t.membershipName=a.MembershipName,t.GroupId=a.GroupId,t.membershipDiscount=t.discount,_onlineCheckout.SyncMembershipVisitRemaining(i,a),!1}})})},_onlineCheckout.ApplyPointsONServices=function(t,i){var a=0,r=e.grep(i,function(e){return e.userId==onlineShoppingCart.loginUserId&&e.userId>0});null!=r&&null!=r&&r.length>0&&(r=r[0],a=r.pointsBalance),a>0&&e.each(t,function(e,t){if(void 0!==t.isPresetApply&&0==t.isPresetApply&&void 0!==t.isPackageApplied&&0==t.isPackageApplied&&t.PromotionId<=0&&0==t.isPaid){void 0===t.pointredeemOriginal&&(t.pointredeemOriginal=t.pointredeem);var i=t.pointredeemOriginal;if(i>0&&a>=i&&a>0)a=parseInt(a-i),t.pointAssignStatus=1,t.isPointApply=!0,t.pointsRedeem=i,t.pointsGained=0,r.pointsBalance=a,onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(t.pointredeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(t.pointredeem),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-t.originalDiscount,2),t.redeemAmt=0,t.redeemTax=0,t.Tax=0,t.price=parseFloat(0),t.IsPartialPoint=!1;else if(_onlineCheckout.IsPartialPointAllowed&&i>0&&a>0){parseInt(i-a);var o=parseInt(a);t.isPointApply=!0,t.IsPartialPoint=!0,a=parseInt(a-o),t.pointAssignStatus=1,t.pointsRedeem=o,t.pointsGained=0,r.pointsBalance=a,onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(t.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(t.pointsRedeem),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-t.originalDiscount,2),t.PartialPrice=parseFloat(_onlineCheckout.CalculateApplyPointsClassPrice(t.price,o,t.pointredeem)),t.redeemAmt=0,t.redeemTax=0,t.price=parseFloat(t.price-t.PartialPrice),t.ActualTax=_onlineCheckout.parseTodecimal(t.price*t.tax/100,3)}else t.isPointApply=!1,t.pointsRedeem=0}})},_onlineCheckout.AddInvoiceDiscount=function(t,i){e.grep(t,function(e){i==d.GiftCertificate&&0==e.PromotionID||i==d.Product||i==d.ServiceInvoice||i==d.Package&&0==e.PromotionID?onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2):i==d.Membership&&0==e.PromotionID&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.productDisc,2))})},_onlineCheckout.ApplyMembershipONServices=function(t,i){e.grep(t,function(t){void 0!==t.isPackageApplied&&0==t.isPackageApplied&&void 0!==t.isPointApply&&0==t.isPointApply&&0==t.isPaid&&null!=(i=e.grep(i,function(e){return 1==e.ItemType||19==e.ItemType}))&&i.length>0&&e.each(i,function(e,a){if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==t.isPresetApply&&1==t.isPresetApply&&0==a.IsAllowPreSetDiscount)return!1;if(a.ServiceProductName==t.servicename&&(a.VisitRemaining>0&&1<=a.VisitRemaining||-1==a.VisitRemaining)&&(0==t.PromotionId||1==a.isPromotionalDiscount&&0!=t.PromotionId)&&(null==a.strValidUpto||""==a.strValidUpto||null!=a.strValidUpto&&""!=a.strValidUpto&&new Date(moment(t.startTime).format("YYYY/MM/DD"))<=new Date(moment(a.strValidUpto).format("YYYY/MM/DD")))){if(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-t.originalDiscount,2),1==a.isPromotionalDiscount&&0!=t.PromotionId){var r=_onlineCheckout.GetMembershipDiscountAmount(t.ServiceOrginalPrice,a);t.discount=_onlineCheckout.parseTodecimal(t.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else if(void 0!==t.isPresetApply&&1==t.isPresetApply&&1==a.IsAllowPreSetDiscount){r=_onlineCheckout.GetMembershipDiscountAmount(t.ServiceOrginalPrice,a);t.discount=_onlineCheckout.parseTodecimal(t.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else t.discount=_onlineCheckout.GetMembershipDiscountAmount(t.ServiceOrginalPrice,a);return t.ServiceOrginalPrice<t.discount&&(t.discount=t.ServiceOrginalPrice),t.price=_onlineCheckout.parseTodecimal(t.ServiceOrginalPrice-t.discount,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.price*t.tax/100,3),t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+t.discount,2),t.ActualPrice=_onlineCheckout.parseTodecimal(t.price,2),t.ActualTax=parseFloat(t.calculatedTax),a.VisitRemaining=-1==a.VisitRemaining?a.VisitRemaining:a.VisitRemaining-1,t.RedeemBusinessId=a.BusinessID,t.VisitUsed=1,t.Visit=a.Visit,t.ItemType=1,t.isMembershipApply=!0,t.BusinessID=onlineShoppingCart.BusinessID,t.MembershipID=a.MembershipID,t.MembershipItemId=a.MembershipItemId,t.GroupId=a.GroupId,t.membershipDiscount=t.discount,_onlineCheckout.SyncMembershipVisitRemaining(i,a),!1}})})},_onlineCheckout.ApplyPackageOnServices=function(t,i){var a=e.grep(i,function(e){return 1==e.isCustomPackage||1==e.isPackage&&null!=e.serviceID});null!=a&&a.length>0&&e.grep(t,function(t){e.grep(a,function(i){if(i.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&(i.quantity>0||1==i.isCustomPackage&&-1==i.quantity)&&(null==i.strValidUpto||""==i.strValidUpto||null!=i.strValidUpto&&""!=i.strValidUpto&&new Date(moment(i.strValidUpto).format("YYYY/MM/DD"))>=new Date(moment(t.startTime).format("YYYY/MM/DD")))&&0==t.isPaid){var r=0,o=[];void 0!==t.isPresetApply&&0!=t.isPresetApply||void 0!==t.isPointApply&&0!=t.isPointApply||void 0!==t.isPackageApplied&&0!=t.isPackageApplied||void 0!==t.isMembershipApply&&0!=t.isMembershipApply||void 0!==t.isServiceBaseGC&&0!=t.isServiceBaseGC||void 0!==t.isGCApply&&0!=t.isGCApply||!(t.PromotionId<=0)||(1==i.isCustomPackage?o=e.grep(a,function(e){if(1==e.isCustomPackage&&null==e.serviceID&&e.giftCertificateID==i.giftCertificateID)return r=0==e.quantity?0:Math.floor(parseFloat((e.currentBalance/e.quantity*100).toFixed(2)))/100,!0}):r=Math.floor(parseFloat((i.currentBalance/i.quantity*100).toFixed(2)))/100,objGC={},objGC.giftcertificateId=i.giftCertificateID,objGC.serviceId=t.serviceid,objGC.uniqID=t.AppSrNo,objGC.AppointmentID=t.appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,objGC.GCredeemAmtForDisc=0,objGC.redeemAmt=r,1==i.isCustomPackage&&void 0!==i.serviceID&&i.serviceID>0&&(objGC.RedeemServiceId=i.serviceID),onlineShoppingCart.RedeemedByGCtemp.push(objGC),1==i.isCustomPackage?(null!=i.groupID&&0!=i.groupID&&-1!=i.quantity?e.grep(a,function(e){e.giftCertificateID==i.giftCertificateID&&e.groupID==i.groupID&&(e.quantity=e.quantity-1)}):null==i.groupID&&-1!=i.quantity&&(i.quantity=i.quantity-1),o.length>0&&-1!=i.quantity&&(o[0].currentBalance=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(o[0].currentBalance,2)-r,2),o[0].quantity=o[0].quantity-1)):(i.currentBalance=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(i.currentBalance,2)-r,2),i.quantity=i.quantity-1),t.redeemID=i.giftCertificateID,t.pointgiven=0,t.pointredeem=0,t.price=r,t.calculatedTax=0,t.priceOriginal=r,t.GCDetail=objGC,t.redeemAmount=r,t.isPackageApplied=!0,onlineShoppingCart.PackageAmount=_onlineCheckout.parseTodecimal(onlineShoppingCart.PackageAmount+r,2),_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(t.PromotionId)&&t.PromotionId>0&&(t.discount=0,onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount-t.originalDiscount,2)))}})})},_onlineCheckout.ApplyMembershipONEvents=function(t,i){var a=e.grep(i,function(e){return 2==e.ItemType||e.ItemType==d.ClassAddons}),r=0,o=0,n=0,s=0,l=0;if(null!=a&&a.length>0){onlineShoppingCart.classdiscount=0,e.each(t,function(t,i){e.each(i.eventEnrollment,function(t,s){var l=e.grep(a,function(e){return s.customerID>0&&e.UserID>0&&(s.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,s.customerID))||s.customerID<=0&&e.UserID>0&&s.cUserEmail==e.EmailId});e.each(l,function(e,t){if(t.ServiceProductName.toLowerCase().trim()==i.eventName.toLowerCase().trim()&&null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(s.eventDate).format("YYYY/MM/DD"))>new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))&&null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(s.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))&&0==s.IsOutsideBilling&&0==s.IsWaivedApply&&(s.strAdvanceLimitDate=t.strAdvanceLimitDate,s.IsWaivedApply=!0,s.AppliedName=t.MembershipName),_onlineCheckout.isValidForCheckoutInvoice()&&(void 0!==s.isPresetApply&&1==s.isPresetApply&&0==t.IsAllowPreSetDiscount||0!=s.PromotionID&&0==t.isPromotionalDiscount))return!1;if(1==s.isMembershipRemove&&t.ServiceProductName.toLowerCase().trim()==i.eventName.toLowerCase().trim()&&t.Discount>0&&(s.customerID>0&&t.UserID>0&&(s.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,s.customerID))||s.customerID<=0&&t.UserID>0&&s.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)){t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining>0?t.VisitRemaining-1:t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(l,t);return 1==s.isPointApply||!(null==s.gcId||0==s.gcId||s.gcId>0&&0==s.isPackage)||0==s.PromotionID&&1!=s.isPresetApply||(s.discount,s.price=s.Originalprice-s.discount,s.taxprice=_onlineCheckout.parseTodecimal(s.price*i.tax/100,3),s.actualPrice=s.price,s.actualTaxprice=s.taxprice),!1}if(s.price>0&&1!=s.isPointApply&&1!=s.isPackage&&(null==s.gcId||0==s.gcId)&&t.ServiceProductName.toLowerCase().trim()==i.eventName.toLowerCase().trim()&&t.Discount>0&&(s.customerID>0&&t.UserID>0&&(s.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,s.customerID))||s.customerID<=0&&t.UserID>0&&s.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)&&(1==_onlineCheckout.IsUpSellMemPkgAdd||"true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&(0!=s.PromotionID&&1==t.isPromotionalDiscount||0==s.PromotionID||void 0===s.PromotionID)&&0==s.isPaid&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(s.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))){var a=parseFloat(s.Originalprice);if(_onlineCheckout.isValidForCheckoutInvoice()){if(a=parseFloat(s.Originalprice),1==t.isPromotionalDiscount&&0!=s.PromotionID){var r=_onlineCheckout.GetMembershipDiscountAmount(s.Originalprice,t);s.discount=_onlineCheckout.parseTodecimal(s.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else if(void 0!==s.isPresetApply&&1==s.isPresetApply&&1==t.IsAllowPreSetDiscount){r=_onlineCheckout.GetMembershipDiscountAmount(s.Originalprice,t);s.discount=_onlineCheckout.parseTodecimal(s.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else s.discount=0,s.discount=_onlineCheckout.GetMembershipDiscountAmount(s.Originalprice,t);s.Originalprice=a}else s.discount=s.discount+_onlineCheckout.GetMembershipDiscountAmount(s.Originalprice,t);return a<s.discount&&(s.discount=a),s.price=_onlineCheckout.parseTodecimal(s.Originalprice-s.discount,2),a>0&&(s.taxprice=_onlineCheckout.parseTodecimal(s.price*i.tax/100,2)),s.isMembershipApply=!0,s.membershipDiscount=t.Discount,s.membershipDiscountOnReceipt=s.discount,s.membershipUniqueID=t.MembershipUniqueId,s.membershipuserid=t.UserID,t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining-1,s.RedeemBusinessId=t.BusinessID,s.BusinessID=onlineShoppingCart.BusinessID,s.MembershipID=t.MembershipID,s.MembershipItemId=t.MembershipItemId,s.membershipName=t.MembershipName,s.GroupId=t.GroupId,s.VisitRemaining=t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(l,t),!1}if(1!=s.isMembershipApply&&0==s.isPaid)if(s.discount=0,s.isMembershipApply=!1,s.membershipDiscount=0,s.membershipUniqueID=null,1!=s.isPointApply&&(null==s.gcId||0==s.gcId||s.gcId>0&&0==s.isPackage)&&void 0!==s.PromotionID&&0!=s.PromotionID){var o=0;o=1==s.IsAmount?s.AmountValue:s.Originalprice*s.AmountValue/100,s.discount=o,s.price=s.Originalprice-o,s.taxprice=_onlineCheckout.parseTodecimal(s.price*i.tax/100,3),s.actualPrice=s.price,s.actualTaxprice=s.taxprice}else _onlineCheckout.isValidForCheckoutInvoice()&&1!=s.isPointApply&&(null==s.gcId||0==s.gcId||s.gcId>0&&0==s.isPackage)&&(s.discount=s.originalDiscount,s.price=s.Originalprice-s.discount,s.taxprice=_onlineCheckout.parseTodecimal(s.price*i.tax/100,3),s.actualPrice=s.price,s.actualTaxprice=s.taxprice)}),s.BusinessTax=_onlineCheckout.ApplyMultipleTax(s.price,s),r=_onlineCheckout.parseTodecimal(r+s.price,2),o=_shopdetail.CheckPriceWithTaxSwitch()&&_onlineCheckout.isValidForCheckoutInvoice()&&!isNullOrUndefineOrBlank(s.paidType)&&s.paidType===_onlineCheckout.arrpaidType.Deposits?_onlineCheckout.parseTodecimal(i.deposit*i.tax/100,2):_onlineCheckout.parseTodecimal(o+s.taxprice,2),s.gcId>0&&0==s.isPackage&&(n=_onlineCheckout.parseTodecimal(n+s.price,2))}),i.calssdiscountprice=0,i.addonCalssdiscountprice=0,e.each(i.eventEnrollment,function(e,t){i.calssdiscountprice+=t.discount}),i.calssdiscountprice=_onlineCheckout.parseTodecimal(i.calssdiscountprice,2);var d=_onlineCheckout.ApplyMembershipONEventsAddon(i.eventEnrollment,a);r+=d.addonTotalPrice,l+=d.addonTotalTaxPrice,s+=d.addonTotalGCUsed,i.addonCalssdiscountprice=i.addonCalssdiscountprice+d.addonDiscountprice,onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+i.calssdiscountprice+i.addonCalssdiscountprice,2)});var c=parseFloat((r+o+l-(n+s+onlineShoppingCart.classPackageUsed)).toFixed(2));onlineShoppingCart.classTax=parseFloat(o.toFixed(2)),onlineShoppingCart.classGCUsed=n+s,onlineShoppingCart.classAddonGCUsed=s,onlineShoppingCart.classAddonTotalTaxPrice=l,onlineShoppingCart.classFinalTotal=c}},_onlineCheckout.ApplyPointsONEvents=function(t,i,a){var r=e.extend(!0,[],a);e.grep(t,function(t){t.calssdiscountprice=0,t.addonCalssdiscountprice=0;var o={IsDealGCApply:!0,PerUserOneFlag:!1};e.grep(t.eventEnrollment,function(n){var s=0,l=_onlineCheckout.GetPackageList(r,t,n,o);n.OriginalpaidType=n.paidType,e.grep(i,function(e){if(n.price>0)if(n.customerID>0&&e.userId>0&&n.customerID==e.userId||n.customerID<=0&&e.userId>0&&n.cUserEmail==e.emailId){s=e.pointsBalance;var i=t.PointRedeem;if(!(i>0&&s>0&&s>=i&&("true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==n.isPaid&&0==l.length)||Number(n.dailydealFee)>0||_shopdetail.EnableFMBFee()&&null!=n.PromotionID&&Number(n.PromotionID)>0)if(!(_onlineCheckout.IsPartialPointAllowed&&i>0&&s>0&&("true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==n.isPaid&&0==l.length)||Number(n.dailydealFee)>0||_shopdetail.EnableFMBFee()&&null!=n.PromotionID&&Number(n.PromotionID)>0)n.isPointApply=!1,n.pointsRedeem=0,(void 0===n.Originalprice||String.isNullOrUndefineOrBlank(n.Originalprice))&&(n.Originalprice=parseFloat(n.price)),n.Originaltaxprice=parseFloat(n.taxprice);else{var a=parseInt(s);if(n.isPointApply=!0,n.pointsRedeem=a,(void 0===n.Originalprice||String.isNullOrUndefineOrBlank(n.Originalprice))&&(n.Originalprice=parseFloat(n.price)),1==onlineShoppingCartmain.DepositAmtType){var r=_onlineCheckout.calculatedDepositsAmount(n.Originalprice);if(n.depositsPercentage=r,(A=Math.ceil(t.PointRedeem*onlineShoppingCartmain.DepositsPer/parseFloat(n.Originalprice)))>s){n.pointsRedeem=s,n.PartialPrice=_onlineCheckout.parseTodecimal(_onlineCheckout.CalculateApplyPointsClassPrice(n.price,n.pointsRedeem,t.PointRedeem),2);var o=_shopdetail.parseTodecimal(onlineShoppingCartmain.DepositsPer-n.PartialPrice);n.depositsPaid=o,n.price=_onlineCheckout.parseTodecimal(parseFloat(n.price-n.PartialPrice),2),n.IsDepositsOver=!1,n.IsPartialDeposits=!0}else n.depositsPaid=onlineShoppingCartmain.DepositsPer,n.pointsRedeem=A,n.PartialPrice=n.depositsPaid,n.price=_onlineCheckout.parseTodecimal(parseFloat(n.price-n.PartialPrice),2),n.IsDepositsOver=!0,n.IsPartialDeposits=!0}else if(0==onlineShoppingCartmain.DepositAmtType&&100!=onlineShoppingCartmain.DepositsPer&&n.price>0){var d=n.TaxValue,c=0,u=0;if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&""!=d&&null!=d&&"0"!=d){var p=d.split(","),h=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues&&null!=p&&p.length>0){for(var m=0;m<p.length;m++){var f=JSON.parse(_shopdetail.TaxesValues).Taxes;if(f.length>0)for(var g=0;g<f.length;g++)if(f[g].BusinessTaxID==p[m]){h.push(f[g].Tax);break}}if(h.length>0){for(m=0;m<h.length;m++)u+=h[m];c=CalAccPriceWithTax(n.Originalprice,u)}}}else c=n.Originalprice;var v=_onlineCheckout.calculatedDepositsAmount(c),A=Math.ceil(t.PointRedeem*v/parseFloat(n.Originalprice));if(n.depositsPercentage=onlineShoppingCartmain.DepositsPer,A>s){n.pointsRedeem=s,n.PartialPrice=_onlineCheckout.parseTodecimal(_onlineCheckout.CalculateApplyPointsClassPrice(n.price,n.pointsRedeem,t.PointRedeem),2);o=_shopdetail.parseTodecimal(v-n.PartialPrice);n.depositsPaid=o,n.price=_onlineCheckout.parseTodecimal(parseFloat(n.price-n.PartialPrice),2),n.IsDepositsOver=!1,n.IsPartialDeposits=!0}else n.depositsPaid=v,n.pointsRedeem=A,n.PartialPrice=v,n.price=_onlineCheckout.parseTodecimal(parseFloat(n.price-n.PartialPrice),2),n.IsDepositsOver=!0,n.IsPartialDeposits=!0}else n.PartialPrice=_onlineCheckout.parseTodecimal(_onlineCheckout.CalculateApplyPointsClassPrice(n.price,a,t.PointRedeem),2),n.price=_onlineCheckout.parseTodecimal(parseFloat(n.price-n.PartialPrice),2);e.pointsBalance=parseInt(s-n.pointsRedeem),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(n.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(n.pointsRedeem),n.Originaltaxprice=parseFloat(n.taxprice),n.IsPartialPoint=!0,1==_onlineCheckout.isValidForCheckoutInvoice()?n.taxprice=0:n.taxprice=_onlineCheckout.parseTodecimal(n.price*t.tax/100,3)}else n.isPointApply=!0,n.pointsRedeem=i,e.pointsBalance=parseInt(s-i),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(n.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(n.pointsRedeem),(void 0===n.Originalprice||String.isNullOrUndefineOrBlank(n.Originalprice))&&(n.Originalprice=parseFloat(n.price)),n.price=0,n.Originaltaxprice=parseFloat(n.taxprice),n.taxprice=0,n.actualPrice=0,n.actualTaxprice=0,n.IsPartialPoint=!1}else _onlineCheckout.isValidForCheckoutInvoice()&&(n.isPointApply=!1,n.Originalprice=parseFloat(n.actualPrice),n.Originaltaxprice=parseFloat(n.actualTaxprice));else void 0!==n.isPointApply||n.isPointApply||(n.isPointApply=!1,n.Originalprice=parseFloat(n.actualPrice),n.Originaltaxprice=parseFloat(n.actualTaxprice))}),n.BusinessTax=_onlineCheckout.ApplyMultipleTax(n.price,n),_onlineCheckout.ApplyPointsOnAddonEvents(t,i,a,n.lstAddonService)})})},_onlineCheckout.CalculateApplyPointsClassPrice=function(e,t,i){return t*e/i},_onlineCheckout.ApplyGCONAllItems=function(t,i,a){null!=i&&i.length>0?e.grep(t,function(t){if(a==d.Membership)t.Price=parseFloat(t.Price),0!=t.PromotionID||t.IsInitialDiscount?t.ActualPrice=parseFloat(t.ActualPrice):t.ActualPrice=parseFloat(t.Price),_onlineCheckout.isValidForCheckoutInvoice()&&(0!=t.PromotionID||(t.ActualPrice=parseFloat(t.Price)-parseFloat(t.productDisc))),t.RemainingPrice=parseFloat(t.ActualPrice),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax);else if(a==d.GiftCertificate)t.TotalPrice=parseFloat(t.TotalPrice),t.ServiceId>0?(t.ActualPrice=parseFloat(t.TotalPrice),t.RemainingPrice=parseFloat(t.TotalPrice)):(t.ActualPrice=parseFloat(t.Price),t.RemainingPrice=parseFloat(t.Price)),_onlineCheckout.isValidForCheckoutInvoice()&&(t.ActualPrice=parseFloat(t.Price),t.RemainingPrice=parseFloat(t.Price)),"True"!=_onlineCheckout.isFromInvoice&&t.NoOfVisit>1&&(t.calculatedTax=t.calculatedTax*t.NoOfVisit),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax);else if(a==d.Package){if(t.TotalPrice=parseFloat(t.TotalPrice),t.ActualPrice=parseFloat(t.TotalPrice),(0!=t.PromotionID||t.IsInitialDiscount)&&(t.ActualPrice=parseFloat(t.Price)),_onlineCheckout.isValidForCheckoutInvoice()&&(0!=t.PromotionID||(t.ActualPrice=parseFloat(t.Price))),null!=t.lstAddonService&&null!=t.lstAddonService&&t.lstAddonService.length>0){t.TotalAddonServicePrice=t.TotalAddonServicePrice,t.TotalAddonServiceTax=0;for(var r=0,o=0;o<t.lstAddonService.length;o++){var n=e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+t.ServiceId+'"]').find("#txtItemsQuantity").val();t.TotalAddonServiceTax=parseFloat(t.TotalAddonServiceTax)+parseFloat(t.lstAddonService[o].taxprice),t.lstAddonService[o].Price=parseFloat(t.lstAddonService[o].Originalprice)*n,t.lstAddonService[o].ActualPrice=parseFloat(t.lstAddonService[o].Originalprice)*n,t.lstAddonService[o].BillingCycle=t.BillingCycle,t.lstAddonService[o].TotalPrice=parseFloat(t.lstAddonService[o].Originalprice)*n,r+=parseFloat(t.lstAddonService[o].Originalprice)*n,e("#addprice_"+t.ServiceId+"_"+o).html(currencysymbol+_onlineCheckout.decimalFormate(parseFloat(t.lstAddonService[o].Originalprice)*n))}t.TotalAddonServicePrice=r}else t.TotalAddonServicePrice=0,t.TotalAddonServiceTax=0;t.RemainingPrice=parseFloat(t.ActualPrice),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax)}else a==d.Product?_onlineCheckout.isValidForCheckoutInvoice()?null!=i&&i.length>0&&e.each(i,function(a,r){if(r.serviceName==t.ProductName&&r.currentBalance>0&&(t.IsPartial?t.InventoryMasterID:t.InventoryId)==r.serviceID&&(r.quantity>0&&t.Quantity<=r.quantity||-1==r.quantity)){var o=0;if(1==r.isCustomPackage&&r.quantity>0){for(var n=e.grep(i,function(e){return 1==e.isCustomPackage&&e.giftCertificateID==r.giftCertificateID&&null!=e.serviceID&&""!=e.serviceName}),s=0,l=0;l<n.length;l++){var d=n[l];d.quantity>0&&(s+=d.quantity)}s>0?(o=Math.floor(_shopdetail.parseTodecimal(r.currentBalance/s*100))/100,o*=t.IsPartial?parseFloat(t.Quantity):parseInt(t.Quantity)):o=0}t.Price=o,String.isNullOrUndefineOrBlank(t.IsPartialPoint)||1!=t.IsPartialPoint||(t.ActualPrice=0),t.ActualPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:0),t.RemainingPrice=0,t.RemainingTax=0,t.ActualTax=0,t.ItemType=3,t.isMembershipApply=!1,String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply||1!=t.IsPartialPoint||void 0!==onlineShoppingCart.UsersPoints&&null!=onlineShoppingCart.UsersPoints&&"undefined"!=onlineShoppingCart.UsersPoints[0].pointsBalance&&(onlineShoppingCart.UsersPoints[0].pointsBalance+=t.pointsRedeem),String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply||0!=t.IsPartialPoint||void 0!==onlineShoppingCart.UsersPoints&&null!=onlineShoppingCart.UsersPoints&&"undefined"!=onlineShoppingCart.UsersPoints[0].pointsBalance&&(onlineShoppingCart.UsersPoints[0].pointsBalance+=t.OriginalPointsRedeem),t.isPointApply=!1,t.BusinessID=r.businessID,t.MembershipID=r.giftCertificateID,t.MembershipItemId=r.serviceID,t.membershipName=r.pkgName,r.quantity=t.IsPartial?r.quantity-parseFloat(t.Quantity):r.quantity-1,t.isPackageApplied=!0}else t.OriginalPrice=parseFloat(t.SellingPrice),t.Price=parseFloat(t.Price),t.ActualPrice=parseFloat(t.Price),t.RemainingPrice=parseFloat(t.Price),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax)}):null!=i&&i.length>0&&e.each(i,function(a,r){if(r.serviceName==t.ProductName&&r.currentBalance>0&&(t.IsPartial?t.InventoryMasterID:t.InventoryId)==r.serviceID&&(r.quantity>0&&t.Quantity<=r.quantity||-1==r.quantity)){var o=0;if(1==r.isCustomPackage&&r.quantity>0){for(var n=e.grep(i,function(e){return 1==e.isCustomPackage&&e.giftCertificateID==r.giftCertificateID&&null!=e.serviceID&&""!=e.serviceName}),s=0,l=0;l<n.length;l++){var d=n[l];d.quantity>0&&(s+=d.quantity)}s>0?(o=Math.floor(_shopdetail.parseTodecimal(r.currentBalance/s*100))/100,o*=parseInt(t.Quantity)):o=0}t.Price=o,String.isNullOrUndefineOrBlank(t.IsPartialPoint)||1!=t.IsPartialPoint||(t.ActualPrice=0),t.ActualPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:0),t.RemainingPrice=0,t.RemainingTax=0,t.ActualTax=0,t.ItemType=3,t.isMembershipApply=!1,String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply||1!=t.IsPartialPoint||void 0!==onlineShoppingCart.UsersPoints&&null!=onlineShoppingCart.UsersPoints&&"undefined"!=onlineShoppingCart.UsersPoints[0].pointsBalance&&(onlineShoppingCart.UsersPoints[0].pointsBalance+=t.pointsRedeem),String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply||0!=t.IsPartialPoint||void 0!==onlineShoppingCart.UsersPoints&&null!=onlineShoppingCart.UsersPoints&&"undefined"!=onlineShoppingCart.UsersPoints[0].pointsBalance&&(onlineShoppingCart.UsersPoints[0].pointsBalance+=t.OriginalPointsRedeem),t.isPointApply=!1,t.BusinessID=r.businessID,t.MembershipID=r.giftCertificateID,t.MembershipItemId=r.serviceID,t.membershipName=r.pkgName,r.quantity=r.quantity-1,t.isPackageApplied=!0}else t.Price=parseFloat(1==t.isPointApply?0:t.Price),t.ActualPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:t.Price),t.RemainingPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:t.Price),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(1==t.isPointApply?0:t.calculatedTax),t.OriginalPrice=parseFloat(t.SellingPrice)}):a==d.ServiceInvoice?(t.priceOriginal=parseFloat(t.ServiceOrginalPrice),_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(t.PromotionId)&&t.PromotionId>0&&(t.priceOriginal=parseFloat(t.price)),t.Price=parseFloat(t.price),t.RemainingPrice=parseFloat(t.price),t.RemainingTax=parseFloat(t.calculatedTax),1==t.isPackageApplied||1==t.isPointApply?(t.ActualPrice=parseFloat(t.price),t.ActualTax=parseFloat(0)):(t.ActualPrice=parseFloat(t.price),t.ActualTax=parseFloat(t.calculatedTax))):a==d.BusinessFee&&(t.Price=parseFloat(t.CalculatedFees),t.paidType==_onlineCheckout.arrpaidType.Paid?(t.ActualPrice=parseFloat(t.CalculatedFees),t.ActualTax=parseFloat(t.CalculatedTax),t.RemainingPrice=parseFloat(t.Price),t.RemainingTax=parseFloat(t.CalculatedTax)):(t.ActualPrice=parseFloat(t.CalculatedFees),t.ActualTax=parseFloat(t.CalculatedTax),t.RemainingPrice=0,t.RemainingTax=0));t.redeemAmt=0,t.redeemTax=0,t.GCDetail=[],e.grep(i,function(e){!_onlineCheckout.isValidForCheckoutInvoice()||String.isNullOrUndefineOrBlank(e.serviceID)||String.isNullOrUndefineOrBlank(e.serviceName)||a!=d.ServiceInvoice?(!String.isNullOrUndefineOrBlank(e.serviceID)||_onlineCheckout.isValidForCheckoutInvoice()&&a==d.GiftCertificate||!_onlineCheckout.isValidForCheckoutInvoice()||void 0!==t.isPointApply&&0!=t.isPointApply||void 0!==t.isPackageApplied&&0!=t.isPackageApplied)&&(_onlineCheckout.isValidForCheckoutInvoice()||a==d.GiftCertificate||!String.isNullOrUndefineOrBlank(e.serviceID))||(t.RemainingPrice>0&&e.currentBalance>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&a==d.ServiceInvoice&&t.paidType==_onlineCheckout.arrpaidType.OfflineDeposit&&(t.RemainingPrice=t.depositsPaid,t.RemainingTax=0),e.currentBalance>=t.RemainingPrice&&(void 0===t.isPackageApplied||0==t.isPackageApplied)&&"undefined"!=e.giftCertificateNo&&null!=e.giftCertificateNo?(t.isGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=t.RemainingPrice,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemAmt=_onlineCheckout.parseTodecimal(t.redeemAmt+t.RemainingPrice,3),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-t.RemainingPrice,3),t.RemainingPrice=0):t.RemainingPrice>e.currentBalance&&e.currentBalance>0&&(void 0===t.isPackageApplied||0==t.isPackageApplied)&&"undefined"!=e.giftCertificateNo&&null!=e.giftCertificateNo&&(t.isGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=e.currentBalance,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemAmt=_onlineCheckout.parseTodecimal(t.redeemAmt+e.currentBalance,3),t.RemainingPrice=_onlineCheckout.parseTodecimal(t.RemainingPrice-e.currentBalance,3),e.currentBalance=0)),t.RemainingTax>0&&e.currentBalance>0&&!String.isNullOrUndefineOrBlank(e.giftCertificateNo)&&void 0!==e.isCustomPackage&&0==e.isCustomPackage&&(t.RemainingTax=_onlineCheckout.parseTodecimal(t.RemainingTax,3),e.currentBalance>=t.RemainingTax?(objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=t.RemainingTax,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemTax=_onlineCheckout.parseTodecimal(t.redeemTax+t.RemainingTax,3),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-t.RemainingTax,3),t.RemainingTax=0):t.RemainingTax>e.currentBalance&&e.currentBalance>0&&(objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=e.currentBalance,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemTax=_onlineCheckout.parseTodecimal(t.redeemTax+e.currentBalance,3),t.RemainingTax=_onlineCheckout.parseTodecimal(t.RemainingTax-e.currentBalance,3),e.currentBalance=0))):void 0!==t.isPointApply&&0!=t.isPointApply||void 0!==t.isPackageApplied&&0!=t.isPackageApplied||void 0!==t.isMembershipApply&&0!=t.isMembershipApply||0!=t.isPaid||e.serviceID==t.serviceid&&e.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&e.quantity>0&&t.RemainingPrice>0&&(objGC={},objGC.GCId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.serviceId=t.serviceid,objGC.redeemAmt=t.price,objGC.uniqID=t.AppSrNo,objGC.AppointmentID=t.appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC,onlineShoppingCart.RedeemedByGCtemp.push(objGC),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-t.price,2),e.quantity=e.quantity-1,t.redeemID=e.giftCertificateID,t.redeemAmt=t.price,t.GCDetail.push(objGC),t.isServiceBaseGC=!0,t.RemainingPrice=0,t.paidType=_onlineCheckout.arrpaidType.Paid,t.depositsPaid=0,null!=e.Taxes&&(t.RemainingTax=0,t.ActualTax=0))}),void 0===t.TotalAddonServicePrice&&void 0===t.TotalAddonServicePrice&&(t.TotalAddonServicePrice=0),void 0===t.TotalAddonServiceTax&&void 0===t.TotalAddonServiceTax&&(t.TotalAddonServiceTax=0),onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(t.ActualPrice+_onlineCheckout.parseTodecimal(t.ActualTax,3))-(t.redeemAmt+t.redeemTax)+t.TotalAddonServicePrice+t.TotalAddonServiceTax,3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(t.ActualPrice+_onlineCheckout.parseTodecimal(t.ActualTax,3)+t.TotalAddonServicePrice+t.TotalAddonServiceTax),3),_onlineCheckout.parseTodecimal(t.deposit,2)>0&&(onlineShoppingCart.depositTotal=_onlineCheckout.parseTodecimal(onlineShoppingCart.depositTotal+t.deposit,2)),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+t.ActualTax+t.TotalAddonServiceTax,3),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+t.ActualTax+t.TotalAddonServiceTax,3),onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt+t.redeemAmt+t.redeemTax,3),_onlineCheckout.isValidForCheckoutInvoice()&&1==t.isPackageApplied?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-t.ActualPrice,2):void 0!==t.isPackageApplied&&1==t.isPackageApplied&&a==d.Product&&(onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-(t.ActualPrice+t.ActualTax+t.TotalAddonServiceTax),2))}):(a==d.VCFFee&&(t=e.grep(t,function(e){return 1==e.FeeType})),e.grep(t,function(t){if(a==d.Membership)t.Price=parseFloat(t.Price),0!=t.PromotionID||t.IsInitialDiscount?t.ActualPrice=parseFloat(t.ActualPrice):t.ActualPrice=parseFloat(t.Price),_onlineCheckout.isValidForCheckoutInvoice()&&(0!=t.PromotionID||(t.ActualPrice=parseFloat(t.Price)-parseFloat(t.productDisc))),t.ActualTax=parseFloat(t.calculatedTax);else if(a==d.GiftCertificate)t.TotalPrice=parseFloat(t.TotalPrice),t.ServiceId>0?t.ActualPrice=parseFloat(t.TotalPrice):t.ActualPrice=parseFloat(t.Price),_onlineCheckout.isValidForCheckoutInvoice()&&(t.ActualPrice=parseFloat(t.Price)),"True"!=_onlineCheckout.isFromInvoice&&t.NoOfVisit>1&&(t.calculatedTax=t.calculatedTax*t.NoOfVisit),t.ActualTax=parseFloat(t.calculatedTax);else if(a==d.Package){if(t.TotalPrice=parseFloat(t.TotalPrice),t.ActualPrice=parseFloat(t.TotalPrice),(0!=t.PromotionID||t.IsInitialDiscount)&&(t.ActualPrice=parseFloat(t.Price)),_onlineCheckout.isValidForCheckoutInvoice()&&(0!=t.PromotionID||(t.ActualPrice=parseFloat(t.Price))),t.TotalSAddPricex=0,t.TotalSAddTax=0,null!=t.lstAddonService&&null!=t.lstAddonService&&t.lstAddonService.length>0){for(var i=0,r=0;r<t.lstAddonService.length;r++){var o=e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+t.ServiceId+'"]').find("#txtItemsQuantity").val();t.lstAddonService[r].Price=parseFloat(t.lstAddonService[r].Originalprice)*o,t.lstAddonService[r].ActualPrice=parseFloat(t.lstAddonService[r].Originalprice)*o,t.lstAddonService[r].BillingCycle=t.BillingCycle,t.lstAddonService[r].TotalPrice=parseFloat(t.lstAddonService[r].Originalprice)*o,t.TotalSAddPricex=parseFloat(t.TotalSAddPricex)+parseFloat(t.lstAddonService[r].Price),t.TotalSAddTax=parseFloat(t.TotalSAddTax)+parseFloat(t.lstAddonService[r].taxprice),i+=parseFloat(t.lstAddonService[r].Originalprice)*o,e("#addprice_"+t.ServiceId+"_"+r).html(currencysymbol+_onlineCheckout.decimalFormate(parseFloat(t.lstAddonService[r].Originalprice)*o))}t.TotalAddonServicePrice=i}t.ActualTax=parseFloat(t.calculatedTax)}else a==d.Product?(1==t.isPointApply&&1==t.IsPartialPoint&&(onlineShoppingCart.ccAmt=0,onlineShoppingCart.amtPaid=0,onlineShoppingCart.tax=0,onlineShoppingCart.Rtax=0),t.Price=parseFloat(1==t.isPointApply?0:t.Price),t.ActualPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:t.Price),t.ActualTax=parseFloat(1==t.isPointApply&&0==t.IsPartialPoint?0:1==t.IsPartialPoint?t.ActualTax:t.calculatedTax),1==t.isPointApply&&0==t.Price&&0==t.ActualPrice&&0==t.ActualTax&&(t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t))):a==d.ServiceInvoice?(_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(t.PromotionId)&&t.PromotionId>0?t.priceOriginal=parseFloat(t.price):t.priceOriginal=parseFloat(t.ServiceOrginalPrice),1==t.isPackageApplied||1==t.isPointApply?(t.ActualPrice=parseFloat(t.price),a==d.ServiceInvoice&&t.IsPartialPoint&&t.isPointApply?t.ActualTax=parseFloat(t.ActualTax):t.ActualTax=parseFloat(0)):(t.ActualPrice=parseFloat(t.price),t.ActualTax=parseFloat(t.calculatedTax)),t.Price=parseFloat(t.price)):a!=d.BusinessFee&&a!=d.VCFFee||(t.Price=parseFloat(t.CalculatedFees),t.ActualPrice=parseFloat(t.CalculatedFees),t.ActualTax=parseFloat(t.CalculatedTax));t.redeemAmt=0,t.redeemTax=0,void 0===t.TotalSAddPricex&&(t.TotalSAddPricex=0),void 0===t.TotalSAddTax&&(t.TotalSAddTax=0),onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(t.ActualPrice+_onlineCheckout.parseTodecimal(t.ActualTax,3)+_onlineCheckout.parseTodecimal(t.TotalSAddPricex,2)+_onlineCheckout.parseTodecimal(t.TotalSAddTax,2)),3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(t.ActualPrice+_onlineCheckout.parseTodecimal(t.ActualTax,3)+_onlineCheckout.parseTodecimal(t.TotalSAddPricex,2)+_onlineCheckout.parseTodecimal(t.TotalSAddTax,2)),3),_onlineCheckout.parseTodecimal(t.deposit,2)>0&&(onlineShoppingCart.depositTotal=_onlineCheckout.parseTodecimal(onlineShoppingCart.depositTotal+t.deposit,2)),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+t.ActualTax,3)+_onlineCheckout.parseTodecimal(t.TotalSAddTax,3),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+t.ActualTax+t.TotalSAddTax,3),_onlineCheckout.isValidForCheckoutInvoice()&&1==t.isPackageApplied?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-t.ActualPrice,2):1==t.isPackageApplied&&(onlineShoppingCart.ccAmt=0)}))},_onlineCheckout.RemoveDicountForWorkShop=function(t,i,a,r,o){var n=e.grep(onlineShoppingCart.Events,function(e){return e.eventID==a});if(null!=n&&n.length>0){var s=e.grep(n[0].eventEnrollment,function(e){return e.randomForWorkShop==r&&e.cUserEmail==o});null!=s&&s.length>0&&e.each(s,function(e,r){void 0!==r&&null!=r&&_onlineCheckout.RemoveDicount(t,i,a,r.autoID)})}},_onlineCheckout.RemoveDicount=function(t,i,a,r){var o=[];if(t==d.Product?null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&(o=onlineShoppingCart.Inventories,CartItemTypeEnumOnlineCheckout.Product):t==d.GiftCertificate?null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(o=onlineShoppingCart.GiftCertificates,CartItemTypeEnumOnlineCheckout.GC):t==d.Package?null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(o=onlineShoppingCart.Packages,CartItemTypeEnumOnlineCheckout.Package):t==d.Membership?null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&(o=onlineShoppingCart.Memberships,CartItemTypeEnumOnlineCheckout.Membership):t==d.Class?null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(o=onlineShoppingCart.Events,CartItemTypeEnumOnlineCheckout.Class):t==d.ServiceInvoice?null!=onlineShoppingCart.ServiceInvoice&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&(o=onlineShoppingCart.ServiceInvoice,CartItemTypeEnumOnlineCheckout.Service):t==d.ClassAddons&&null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(o=onlineShoppingCart.Events,CartItemTypeEnumOnlineCheckout.ClassAddon),1==_onlineCheckout.Model.IsPaymentOption&&_onlineCheckout.RemoveExistingGC(a,r),null!=o&&o.length>0)if(t==d.ServiceInvoice&&i==p)e.grep(o,function(t){if(t.AppSrNo==a){var i=e.grep(onlineShoppingCart.UsersPoints,function(e){return e.userId==onlineShoppingCart.loginUserId&&e.userId>0});!String.isNullOrUndefineOrBlank(i)&&i.length>0&&((i=i[0]).pointsBalance=i.pointsBalance+t.pointsRedeem),onlineShoppingCart.AppliedPoints=onlineShoppingCart.AppliedPoints-t.pointsRedeem,t.pointsRedeem=0,t.pointsGained=t.pointredeemOriginal,t.price=parseFloat(t.ServiceOrginalPrice)-parseFloat(t.originalDiscount),t.ActualPrice=t.price,t.Tax=t.taxOriginalPrice,t.ActualTax=t.taxOriginalPrice,t.discount=parseFloat(t.originalDiscount),t.priceOriginal=parseFloat(t.ServiceOrginalPrice),t.isPointApply=!1,t.IsPartialPoint&&(t.IsPartialPoint=!1,t.PartialPrice=0)}});else if(t!=d.ServiceInvoice||i!=c&&i!=u)if(t==d.ServiceInvoice&&i==h)e.grep(o,function(e){e.AppSrNo==a&&(e.discount=parseFloat(e.originalDiscount),e.ActualPrice=parseFloat(e.ServiceOrginalPrice)-parseFloat(e.discount),e.price=parseFloat(e.ServiceOrginalPrice)-parseFloat(e.discount),e.isMembershipApply=!1,e.calculatedTax=e.taxOriginalPrice,e.ActualTax=parseFloat(e.calculatedTax))});else if(t==d.ClassAddons&&i==p){var n=parseInt(r.split("_")[0]);e.grep(o,function(t){e.grep(t.eventEnrollment,function(t){t.eventID==a&&t.autoID==n&&e.grep(t.lstAddonService,function(i){if(i.autoID==r){i.isPointApply=!1,_onlineCheckout.isValidForCheckoutInvoice()?(i.actualPrice=parseFloat(i.Originalprice),i.actualTaxprice=parseFloat(i.Originaltaxprice),onlineShoppingCart.AppliedPoints=onlineShoppingCart.AppliedPoints-i.PointRedeem):onlineShoppingCart.AppliedPoints=onlineShoppingCart.AppliedPoints-i.pointsRedeem;var a=e.grep(onlineShoppingCart.UsersPoints,function(e){return t.customerID>0&&e.userId>0&&t.customerID==e.userId||t.customerID<=0&&e.userId>0&&t.cUserEmail==e.emailId});!String.isNullOrUndefineOrBlank(a)&&a.length>0&&((a=a[0]).pointsBalance=a.pointsBalance+i.pointsRedeem),i.pointsRedeem=0,i.Price=parseFloat(i.Originalprice),i.taxprice=parseFloat(i.Originaltaxprice),i.isMembershipRemove=!0,i.isMembershipApply=!1,i.IsPartialPoint=!1,i.PartialPrice=0}}),onlineShoppingCart.lstMembership=JSON.parse(JSON.stringify(onlineShoppingCart.lstMembershipOld))})}),_onlineCheckout.ApplyDailyDealONEvents()}else if(t!=d.Class&&i==p){var s=e.grep(o,function(e){return e.autoId==a&&!String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)});e.grep(o,function(t){if(t.autoId==a||s.length>0&&t.MasterInventoryId==s[0].InventoryId){if(t.isPointApply=!1,s.length>0&&t.InventoryId==s[0].InventoryId)if(t.isPointApplyPartial=!1,s[0].isMembershipApply){var i=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==t.InventoryId});t.Price=0,e.each(i,function(e,i){t.Price+=parseFloat(i.Price)})}else t.Price=t.OriginalPrice;else{var r=e.grep(onlineShoppingCart.UsersPoints,function(e){return e.userId==onlineShoppingCart.loginUserId&&e.userId>0});!String.isNullOrUndefineOrBlank(r)&&r.length>0&&((r=r[0]).pointsBalance=r.pointsBalance+t.pointsRedeem),onlineShoppingCart.AppliedPoints=onlineShoppingCart.AppliedPoints-t.pointsRedeem}t.pointsRedeem=0,t.pointsGained=t.originalpointsGained,t.Price=t.OriginalPrice,t.ActualPrice=_onlineCheckout.parseTodecimal(t.Price,2),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),_onlineCheckout.isValidForCheckoutInvoice()&&(t.OriginalPrice=t.SellingPrice,t.discount=parseFloat(t.originalDiscount)),t.IsPartialPoint&&(t.IsDepositsOver=!1,t.PartialPrice=0,t.ActualPrice=t.Price,t.IsPartialPoint=!1,t.ActualTax=t.calculatedTax,t.GCDetail=[],t.isGCApply=!1,t.redeemAmt=0,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t))}}),t==d.Product&&e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId});i.Price=0,i.isMembershipApply=!1,i.membershipName="",i.packageName="";var r=[],o=[],n=!1;if(e.each(a,function(e,t){i.Price+=t.Price,i.isMembershipApply=1!=t.isPackageApplied&&(1==i.isMembershipApply||t.isMembershipApply),i.isPackageApplied=1==i.isPackageApplied||t.isPackageApplied,t.isPackageApplied&&(n=!0),t.isMembershipApply&&(isMembershipBundleApplied=!0),t.isMembershipApply&&-1==r.indexOf(t.membershipName)&&r.push(t.membershipName),t.isPackageApplied&&-1==o.indexOf(t.membershipName)&&o.push(t.membershipName)}),n){if(null!=o&&o.length>0){var s=o.join();i.membershipName=s}}else if(null!=r&&r.length>0){var l=r.join();i.membershipName=l}}})}else if(t==d.Class&&i==p)e.grep(o,function(t){e.grep(t.eventEnrollment,function(i){if(i.eventID==a&&i.autoID==r){i.isPointApply=!1,_onlineCheckout.isValidForCheckoutInvoice()?(i.actualPrice=parseFloat(i.Originalprice),i.actualTaxprice=parseFloat(i.Originaltaxprice),onlineShoppingCart.AppliedPoints=onlineShoppingCart.AppliedPoints-t.PointRedeem):void 0!==t.pointsRedeem?onlineShoppingCart.AppliedPoints=onlineShoppingCart.AppliedPoints-t.pointsRedeem:onlineShoppingCart.AppliedPoints=i.IsPartialPoint?onlineShoppingCart.AppliedPoints-i.pointsRedeem:onlineShoppingCart.AppliedPoints-t.PointRedeem;var o=e.grep(onlineShoppingCart.UsersPoints,function(e){return i.customerID>0&&e.userId>0&&i.customerID==e.userId||i.customerID<=0&&e.userId>0&&i.cUserEmail==e.emailId});!String.isNullOrUndefineOrBlank(o)&&o.length>0&&((o=o[0]).pointsBalance=i.IsPartialPoint?o.pointsBalance+i.pointsRedeem:o.pointsBalance+t.PointRedeem),i.IsPartialPoint&&(i.IsPartialPoint=!1,i.PartialPrice=0,i.BusinessTax=_onlineCheckout.ApplyMultipleTax(i.Originalprice,t)),i.pointsRedeem=0,i.price=parseFloat(i.Originalprice),i.taxprice=parseFloat(i.Originaltaxprice),i.isMembershipRemove=!0}i.isMembershipApply=!1,onlineShoppingCart.lstMembership=JSON.parse(JSON.stringify(onlineShoppingCart.lstMembershipOld))})}),_onlineCheckout.ApplyDailyDealONEvents();else if(t!=d.ClassAddons||i!=c&&i!=u)if(t!=d.Class&&i==c)e.grep(o,function(e){e.autoId==a&&(_onlineCheckout.isValidForCheckoutInvoice()&&(e.discount=parseFloat(e.originalDiscount)),e.isGCApply=!1,e.GCDetail=[],e.redeemAmt=0,e.redeemTax=0)});else if(t!=d.Class||i!=c&&i!=u)if(t!=d.Product||i!=c&&i!=u)if(t==d.Class&&i==h)e.grep(o,function(t){e.grep(t.eventEnrollment,function(e){if(e.eventID==a&&e.autoID==r&&(e.isMembershipRemove=!0,e.price=parseFloat(e.Originalprice),e.taxprice=parseFloat(e.Originaltaxprice),void 0!==e.PromotionID&&0!=e.PromotionID)){var i=0;i=1==e.IsAmount?e.AmountValue:e.Originalprice*e.AmountValue/100,e.Originalprice<i&&(i=e.Originalprice),e.discount=i,e.price=e.Originalprice-i,e.taxprice=_onlineCheckout.parseTodecimal(e.price*t.tax/100,3),e.actualPrice=e.price,e.actualTaxprice=e.taxprice}e.isMembershipApply=!1,onlineShoppingCart.lstMembership=JSON.parse(JSON.stringify(onlineShoppingCart.lstMembershipOld))})});else if(t==d.ClassAddons&&i==h){n=parseInt(r.split("_")[0]);e.grep(o,function(t){e.grep(t.eventEnrollment,function(t){t.eventID==a&&t.autoID==n&&e.grep(t.lstAddonService,function(e){if(e.autoID==r){if(e.isMembershipRemove=!0,e.Price=parseFloat(e.Originalprice),e.taxprice=parseFloat(e.Originaltaxprice),void 0!==e.PromotionID&&0!=e.PromotionID){var t=0;t=1==e.IsAmount?e.AmountValue:e.Originalprice*e.AmountValue/100,e.Originalprice<t&&(t=e.Originalprice),e.discount=t,e.Price=e.Originalprice-t,e.taxprice=_onlineCheckout.parseTodecimal(e.Price*e.tax/100,3),e.actualPrice=e.Price,e.actualTaxprice=e.taxprice}e.isMembershipApply=!1}}),onlineShoppingCart.lstMembership=JSON.parse(JSON.stringify(onlineShoppingCart.lstMembershipOld))})})}else if(t!=d.Class&&i==h){s=e.grep(o,function(e){return e.autoId==a&&!String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)});e.grep(o,function(t){if(t.autoId==a||s.length>0&&t.MasterInventoryId==s[0].InventoryId){if(_onlineCheckout.isValidForCheckoutInvoice())t.discount=parseFloat(t.originalDiscount),t.ActualPrice=parseFloat(t.OriginalPrice)-parseFloat(t.discount),t.Price=parseFloat(t.OriginalPrice)-parseFloat(t.discount);else if(t.discount=0,s.length>0&&t.InventoryId==s[0].InventoryId&&s[0].isPointApplyPartial){var i=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==t.InventoryId});t.Price=0,e.each(i,function(e,i){void 0!==i.isPointApply&&0==i.isPointApply&&(t.Price+=parseFloat(i.OriginalPrice))}),t.isMembershipBundleApplied=!1}else t.ActualPrice=parseFloat(t.OriginalPrice*t.Quantity),t.Price=parseFloat(t.OriginalPrice*t.Quantity);t.isMembershipApply=!1,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=parseFloat(t.calculatedTax),t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t)}})}else t==d.Class&&i==m&&(e.grep(o,function(t){e.grep(t.eventEnrollment,function(e){e.eventID==a&&e.autoID==r&&(e.strAdvanceLimitDate="",e.IsWaivedApply=!1,e.IsOutsideBilling=!0)})}),onlineShoppingCart.Events=o,_onlineCheckout.calculateDepositsOnEvents());else e.grep(o,function(t){if(t.autoId==a){if(i==u)if(String.isNullOrUndefineOrBlank(t.InventoryBundleCartDetails)){var r=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==t.MembershipID&&e.serviceID==t.MembershipItemId});String.isNullOrUndefineOrBlank(r)||-1==r[0].quantity||(r[0].quantity=r[0].quantity+1,r[0].currentBalance=r[0].currentBalance+t.redeemAmt)}else{var o=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==t.InventoryId});t.Price=0,t.OriginalPrice=0,t.calculatedTax=0,t.ActualTax=0,e.each(o,function(e,i){t.Price+=parseFloat(i.OriginalPrice),t.OriginalPrice+=parseFloat(i.OriginalPrice),t.calculatedTax+=_onlineCheckout.parseTodecimal(parseFloat(i.OriginalPrice*i.Quantity)*i.Tax/100,3),t.ActualTax=parseFloat(t.calculatedTax),t.IsPartial=i.IsPartial}),t.isPackageBundleApplied=!1}t.gcId=null,t.isDecisionTaken=null,t.isPackageApplied=!1,t.redeemAmt=0,t.redeemTax=0,t.ActualPrice=t.IsPartial?t.OriginalPrice:parseFloat(t.OriginalPrice*t.Quantity),t.Price=t.IsPartial?t.OriginalPrice:parseFloat(t.OriginalPrice*t.Quantity),String.isNullOrUndefineOrBlank(t.InventoryBundleCartDetails)&&(t.calculatedTax=_onlineCheckout.parseTodecimal(parseFloat(t.OriginalPrice*t.Quantity)*t.Tax/100,3),t.ActualTax=parseFloat(t.calculatedTax))}});else e.grep(o,function(t){e.grep(t.eventEnrollment,function(e){if(e.eventID==a&&e.autoID==r){if(i==u){var t=onlineShoppingCart.lstGCPkgData.filter(function(t){return t.giftCertificateID==e.gcId&&t.serviceID==e.eventID});String.isNullOrUndefineOrBlank(t)||-1==t[0].quantity||(t[0].quantity=t[0].quantity+1,t[0].currentBalance=t[0].currentBalance+e.redeemAmt)}e.gcId=null,e.isDecisionTaken=null,e.isPackage=null,e.redeemAmt=0,e.isMembershipRemove=!0}e.isMembershipApply=!1,onlineShoppingCart.lstMembership=JSON.parse(JSON.stringify(onlineShoppingCart.lstMembershipOld))})});else{var n=parseInt(r.split("_")[0]);e.grep(o,function(t){e.grep(t.eventEnrollment,function(t){t.eventID==a&&t.autoID==n&&e.grep(t.lstAddonService,function(e){if(e.autoID==r){if(i==u){var t=onlineShoppingCart.lstGCPkgData.filter(function(t){return t.giftCertificateID==e.gcId&&t.serviceID==e.ServiceId});String.isNullOrUndefineOrBlank(t)||-1==t[0].quantity||(t[0].quantity=t[0].quantity+1,t[0].currentBalance=t[0].currentBalance+e.redeemAmt)}e.gcId=null,e.isDecisionTaken=null,e.isPackage=null,e.redeemAmt=0,e.isMembershipApply=!1,e.isMembershipRemove=!0}}),onlineShoppingCart.lstMembership=JSON.parse(JSON.stringify(onlineShoppingCart.lstMembershipOld))})})}else e.grep(o,function(e){e.AppSrNo==a&&(i==u&&(onlineShoppingCart.PackageAmount=parseFloat(onlineShoppingCart.PackageAmount)-parseFloat(e.price),e.calculatedTax=parseFloat(e.taxOriginalPrice)),e.paidType==_onlineCheckout.arrpaidType.Deposits?e.price=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(e.payableAmount,2)-(_onlineCheckout.parseTodecimal(e.deposit,2)+_onlineCheckout.parseTodecimal(e.discount,2)),2):e.price=parseFloat(e.ServiceOrginalPrice)-parseFloat(e.originalDiscount),e.priceOriginal=e.ServiceOrginalPrice,e.ActualPrice=parseFloat(e.price),e.ActualTax=parseFloat(e.taxOriginalPrice),e.GCDetail=[],e.redeemAmt=0,e.redeemTax=0,e.isGCApply=!1,e.isServiceBaseGC=!1,_onlineCheckout.isValidForCheckoutInvoice()&&(e.discount=parseFloat(e.originalDiscount)),e.isPackageApplied=!1)});_onlineCheckout.IsValidatedOnePerUser=!1,_onlineCheckout.ReApplyDiscounts(),!_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==onlineShoppingCartmain.TipOption&&null!=onlineShoppingCartmain.TipOption&&""!=onlineShoppingCartmain.TipOption&&"0"!=onlineShoppingCartmain.TipOption&&(onlineShoppingCartmain.IsFullDeposit&&_onlineCheckout.IsBaseTipAllowedByConfig()||_onlineCheckout.HasConfigTipItemInCart())&&(onlineShoppingCart.tipValue=0,e("#divTip").show(),e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+"0.00"),e("#divfinalCheckoutTipAmount").hide(),e("#txtOnlineCustomerTip").hide(),e("#dvTipBlock").hide(""),_onlineCheckout.ShowTipOptions()),_onlineCheckout.IsVCFEnable()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.RemoveDicount))},_onlineCheckout.ReApplyDiscounts=function(t){if(1!=_onlineCheckout._reApplyRunning){_onlineCheckout._reApplyRunning=!0;try{if(_onlineCheckout.HideTipOptions(),1!=t){var i=onlineShoppingCart.lstPromotionData.uniqueObjects(["PromotionID"]),a=onlineShoppingCart.lstPromotionData,r=onlineShoppingCart.lstPromoDetails;e.grep(i,function(e){_onlineCheckout.RemovePromoCode(e.PromotionID)}),e.grep(i,function(t){var i=e.grep(a,function(e){return e.PromotionID==t.PromotionID}),o=e.grep(r,function(e){return e.PromotionID==t.PromotionID});_onlineCheckout.ApplyPromoCodeOnCart(i,!0,o[0].PromoCodeStr,o[0].msg,o[0].PerTransactionOne,!0)})}_onlineCheckout.IsBuyGC||e("#divGiftCertificatelistCart > a").removeClass("w--current"),onlineShoppingCart.ccAmt=0,onlineShoppingCart.amtPaid=0,onlineShoppingCart.tax=0,onlineShoppingCart.Rtax=0,onlineShoppingCart.taxdifference=0,onlineShoppingCart.gcAmt=0,onlineShoppingCart.RedeemedByGCtemp=[],onlineShoppingCart.RedeemedByGC=[],onlineShoppingCart.shippingSurcharge=0,onlineShoppingCart.depositTotal=0,onlineShoppingCart.classSubTotal=0,onlineShoppingCart.classTax=0,onlineShoppingCart.classGCUsed=0,onlineShoppingCart.classPackageUsed=0,onlineShoppingCart.classFinalTotal=0,onlineShoppingCart.discount=0,onlineShoppingCart.classdiscount=0,onlineShoppingCart.DepositsRemaining=0,onlineShoppingCart.InvoiceDepositsRemaining=0,onlineShoppingCart.FeeDepositsRemaining=0,onlineShoppingCart.FeeTaxDepositsRemaining=0,null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.Memberships,d.Membership),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.GiftCertificates,d.GiftCertificate),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.Packages,d.Package),_onlineCheckout.RecalcGCONAllAddonItems(onlineShoppingCart.Packages)),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.Inventories,d.Product),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&(_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.ServiceInvoice,d.ServiceInvoice),_onlineCheckout.calculateDepositsOnInvoice(!1));var o=e.extend(!0,[],onlineShoppingCart.lstGCPkgData),n=e.grep(o,function(e){return 1==e.eventType&&null==e.quantity&&1==e.assignStatus&&e.currentBalance>0}),s=!1;if(null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){if(onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events),_onlineCheckout.ApplyDailyDealONEvents(),onlineShoppingCart.lstMembership=e.extend(!0,[],onlineShoppingCart.lstMembershipOld),_onlineCheckout.ApplyMembershipONEvents(onlineShoppingCart.Events,onlineShoppingCart.lstMembership),null!=onlineShoppingCart.lstPromotionData&&onlineShoppingCart.lstPromotionData.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()){i=onlineShoppingCart.lstPromotionData.uniqueObjects(["PromotionID"]);e.grep(i,function(t){var i=e.grep(onlineShoppingCart.lstPromotionData,function(e){return e.PromotionID==t.PromotionID}),a=e.grep(i,function(e){return 8==e.ItemTypeID||e.ItemTypeID==d.ClassAddons});a.length>0&&_onlineCheckout.ApplyPresetDiscountOnEvents(onlineShoppingCart.Events,a,!1,null)})}_onlineCheckout.calculateDepositsOnEvents(),_onlineCheckout.ApplyPriceBaseGCOnEvents(n,!1);e.grep(onlineShoppingCart.Events,function(t,i){return e.grep(t.eventEnrollment,function(e,t){return 4==e.paidType}).length>0&&(s=!0),s})}if(null!=onlineShoppingCart.ServiceInvoice&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){e.paidType==_onlineCheckout.arrpaidType.Paid&&(s=!0)}),onlineShoppingCartmain.IsFullDeposit=s,null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&(e.grep(onlineShoppingCart.BusinessFee,function(e){1==e.FeeType&&(e.ActualPrice=0,e.ActualTax=0,e.RemainingPrice=0,e.RemainingTax=0,e.CalculatedTax=0,e.CalculatedFeesForClass=0,e.CalculatedTaxForClass=0)}),_onlineCheckout.ApplyMultipleFeesonAllItems(0),_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.BusinessFee,d.BusinessFee)),onlineShoppingCart.tax>0){var l=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax,2),c=onlineShoppingCart.tax;c!=l&&(onlineShoppingCart.taxdifference=_onlineCheckout.parseTodecimal(c-l,2),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax-onlineShoppingCart.taxdifference,2),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid-onlineShoppingCart.taxdifference,2),onlineShoppingCart.ccAmt>0&&onlineShoppingCart.ccAmt>onlineShoppingCart.taxdifference?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-onlineShoppingCart.taxdifference,2):onlineShoppingCart.gcAmt>0&&onlineShoppingCart.gcAmt>onlineShoppingCart.taxdifference&&(onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt-onlineShoppingCart.taxdifference,2)))}if(onlineShoppingCart.RedeemedByGCtemp.length>0){onlineShoppingCart.RedeemedByGC=[],onlineShoppingCart.RedeemedByGCtemp=e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){return 1!=e.IsClass});var u=onlineShoppingCart.RedeemedByGCtemp.uniqueObjects(["GCId"]);e.grep(u,function(t){_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg==t.Type?(objGC={},objGC.giftcertificateId=t.giftcertificateId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=t.redeemAmt,objGC.uniqID=t.uniqID,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC==t.Type?(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=0,objGC.redeemAmt=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type="GC",e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.GCAmount,2))}),e.grep(n,function(e){t.GCId==e.giftCertificateID&&(e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-objGC.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC))})}_onlineCheckout.PaymentOptionSelectDeselect(),_onlineCheckout.checkoutGotoNextStep(!1)}finally{_onlineCheckout._reApplyRunning=!1}}},_onlineCheckout.RecalcGCONAllItems=function(t,i){e.grep(t,function(e){i==d.Product&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2),1==e.IsFreeShipping&&0==e.MasterInventoryId&&(onlineShoppingCart.shippingSurcharge=_onlineCheckout.parseTodecimal(onlineShoppingCart.shippingSurcharge+e.Quantity*e.ShippingSurcharge,2))),i==d.Package&&null!=e.discount&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2)),i==d.Membership&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.productDisc,2)),_onlineCheckout.isValidForCheckoutInvoice()&&i==d.ServiceInvoice&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2)),i==d.GiftCertificate&&(onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2)),i==d.Product&&1==!String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)&&(e.ActualTax=void 0===e.ActualTax?0:e.ActualTax,e.redeemAmt=void 0===e.redeemAmt?0:e.redeemAmt,e.redeemTax=void 0===e.redeemTax?0:e.redeemTax,(1!=e.isPointApply||e.IsPartialPoint&&e.isPointApply)&&((e.isGCApply=null!=e.GCDetail&&e.GCDetail.length>0)&&(onlineShoppingCart.RedeemedByGCtemp=onlineShoppingCart.RedeemedByGCtemp.concat(e.GCDetail),e.ActualTax=0),i==d.ServiceInvoice&&e.IsPartialPoint&&e.isPointApply?(onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3))-(e.redeemAmt+e.redeemTax)-e.PartialPrice,3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3)-e.PartialPrice),3)):(onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3))-(e.redeemAmt+e.redeemTax),3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3)),3)),_onlineCheckout.parseTodecimal(e.deposit,2)>0&&(onlineShoppingCart.depositTotal=_onlineCheckout.parseTodecimal(onlineShoppingCart.depositTotal+_onlineCheckout.parseTodecimal(e.deposit,2),2)),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+e.ActualTax,2),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+e.ActualTax,3),onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt+e.redeemAmt+e.redeemTax,2),_onlineCheckout.isValidForCheckoutInvoice()&&1==e.isPackageApplied?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-e.ActualPrice,2):1==e.isPackageApplied&&(onlineShoppingCart.ccAmt=0))),(i!=d.Product||i==d.Product&&1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails))&&(1!=e.isPointApply||e.IsPartialPoint&&e.isPointApply)&&((e.isGCApply=null!=e.GCDetail&&e.GCDetail.length>0)&&(onlineShoppingCart.RedeemedByGCtemp=onlineShoppingCart.RedeemedByGCtemp.concat(e.GCDetail)),i==d.ServiceInvoice&&e.IsPartialPoint&&e.isPointApply?(onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3))-(e.redeemAmt+e.redeemTax)-e.PartialPrice,3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3)-e.PartialPrice),3)):(onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3))-(e.redeemAmt+e.redeemTax),3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3)),3)),_onlineCheckout.parseTodecimal(e.deposit,2)>0&&(onlineShoppingCart.depositTotal=_onlineCheckout.parseTodecimal(onlineShoppingCart.depositTotal+_onlineCheckout.parseTodecimal(e.deposit,2),2)),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+e.ActualTax,2),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+e.ActualTax,3),onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt+e.redeemAmt+e.redeemTax,2),_onlineCheckout.isValidForCheckoutInvoice()&&1==e.isPackageApplied?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-e.ActualPrice,2):1==e.isPackageApplied&&(onlineShoppingCart.ccAmt>0?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3))-(e.redeemAmt+e.redeemTax),3):onlineShoppingCart.ccAmt=0))})},_onlineCheckout.parseTodecimal=function(e,t){const i=Number(e);return Number.isNaN(i)?0:parseFloat(Number(Math.round(e+"e"+t)+"e-"+t).toFixed(t))},_onlineCheckout.FinalResponseType={Fail:0,Success:1,Distrubution:2,PartialSuccess:3,OldVersion:4,TokenMissMatch:5,ConfigurationMismatch:6,AuthorizationFail:7,ServiceMismatch:8},_onlineCheckout.SomeErrorMessage="Something went wrong! Please refresh your browser and try again!",_onlineCheckout.RemoveClassOnly=function(){onlineShoppingCart.Events=[],onlineShoppingCartmain.Events=[];var e=[];e.push(4);var t=new vagaro.ajax,i={};i.businessID=onlineShoppingCart.BusinessID,i.loginUserID=UserID,i.itemType=e,i.ischeckinApp=isCheckInApp,i.isFromInvoice=_onlineCheckout.isFromInvoice,t.datamodel.Token=ApiURLEnumOnlineCheckout.removecheckoutitem,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(e){_onlineCheckout.getUserGCDetail()},t.datamodel.data=i,t.datamodel.Error=function(e){vagaro.alert("error")},t.Post()},_onlineCheckout.CallAdjustEvent=function(){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof onlineShoppingCartmainSuccess&&null!=onlineShoppingCartmainSuccess){if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmainSuccess.Memberships)&&onlineShoppingCartmainSuccess.Memberships.length>0){var t=0;e.grep(onlineShoppingCartmainSuccess.Memberships,function(e){t=_onlineCheckout.parseTodecimal(t+e.Price,2)}),_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.membership_purchase_completed,JSAdjustEventToken.membership_purchase_completed_eventtoken,t)}if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmainSuccess.GiftCertificates)&&onlineShoppingCartmainSuccess.GiftCertificates.length>0){var i=0;e.grep(onlineShoppingCartmainSuccess.GiftCertificates,function(e){i=_onlineCheckout.parseTodecimal(i+e.Price,2)}),_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.gift_card_purchase_completed,JSAdjustEventToken.gift_card_purchase_completed_eventtoken,i)}if(!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0){var a=0;e.grep(onlineShoppingCart.Inventories,function(t){a=_onlineCheckout.parseTodecimal(a+t.ActualPrice,2),!String.isNullOrUndefineOrBlank(t.BusinessTax)&&t.BusinessTax.length>0&&e.grep(t.BusinessTax,function(e){a=_onlineCheckout.parseTodecimal(a+e.CalculatedTax,2)})}),_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.product_purchased_completed,JSAdjustEventToken.product_purchased_completed_eventtoken,a)}if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmainSuccess.Packages)&&onlineShoppingCartmainSuccess.Packages.length>0){var r=0;e.grep(onlineShoppingCartmainSuccess.Packages,function(e){r=_onlineCheckout.parseTodecimal(r+e.TotalPrice+e.TotalAddonServicePrice,2)});var o=e.grep(onlineShoppingCartmainSuccess.Packages,function(e){return null!=e.SellPackageServiceID}),n=e.grep(onlineShoppingCartmainSuccess.Packages,function(e){return null==e.SellPackageServiceID});null!=o&&o.length>0&&_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.package_purchase_completed,JSAdjustEventToken.package_purchase_completed_eventtoken,r),null!=n&&n.length>0&&_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.book_service_completed,JSAdjustEventToken.book_service_completed_eventtoken,r)}if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmainSuccess.Events)&&onlineShoppingCartmainSuccess.Events.length>0){var s=0;e.grep(onlineShoppingCartmainSuccess.Events,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(t){s=_onlineCheckout.parseTodecimal(s+t.price,2),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){s=_onlineCheckout.parseTodecimal(s+e.Price,2)})})}),"Request"==e("#ancBuyNow").text()?_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.class_booking_requested,JSAdjustEventToken.class_booking_requested_eventtoken,s):_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.class_booking_completed,JSAdjustEventToken.class_booking_completed_eventtoken,s)}}},_onlineCheckout.CheckoutMSG=function(t,i,a){_onlineCheckout.CallAdjustEvent(),1==i&&(e("#ancCheckoutSuccess").removeAttr("onclick"),e("#ancCheckoutSuccess").attr("onclick","_onlineCheckout.SuccessCheckinAPP();")),Webflow.destroy(),Webflow.ready();var r=!1;if(1!=_onlineCheckout.IsCalledFromLiveStream()||"undefined"==typeof onlineShoppingCartmainSuccess||null==onlineShoppingCartmainSuccess||String.isNullOrUndefineOrBlank(onlineShoppingCartmainSuccess.Events)||e.grep(onlineShoppingCartmainSuccess.Events,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(e){1!=e.StreamingStatus||String.isNullOrUndefineOrBlank(e.IsFromHomePage)||1!=e.IsFromHomePage||(r=!0)})}),_onlineCheckout.isValidForCheckoutInvoice()?(e("#dvCheckoutSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),e("#dvCheckoutSuccessMSG").html("Invoice Paid"),e("#dvCheckoutSuccessMSG1").html("Thank you. Your invoice was paid successfully."),e("#dvCheckoutSuccessMSG1").show()):1==t?("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,"22|~|1"),0==r&&(void 0!==a&&null!=a&&""!=a&&a.length>0?_onlineCheckout.SetClassSuccessDetails(t,a):(e("#dvCheckoutSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),e("#dvCheckoutSuccessMSG").html("Successful Enrollment."),e("#dvCheckoutSuccessMSG1").hide()))):0==r&&(void 0!==a&&null!=a&&""!=a&&a.length>0?_onlineCheckout.SetClassSuccessDetails(t,a):(e("#dvCheckoutSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),e("#dvCheckoutSuccessMSG").html("Successful Checkout"),1==_onlineCheckout.isCheckoutVPLChanged?1==_siteBuilderDetail.isAffirmEnable?(e("#dvCheckoutSuccessMSG1").show(),e("#dvCheckoutVplAmt").hide(),e("#dvCheckoutVplPart").hide(),e("#dvCheckoutVplMsg").hide()):(e("#dvCheckoutSuccessMSG1").hide(),e("#dvCheckoutVplAmt").show(),e("#dvCheckoutVplPart").show(),e("#dvCheckoutVplMsg").show()):e("#dvCheckoutSuccessMSG1").show().css("display","flex"))),1==r){var o=[],n=0,s="",l="",d=!1;e.grep(onlineShoppingCartmainSuccess.Events,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(e){var i=new Date(e.workshopActualDate).format(_onlineCheckout.DateFormatdddMMM_ddYYYY),a=new Date(e.workshopActualDate).format(_onlineCheckout.DateFormatdddMMM_ddYYYY),r=e.startTime.replace(/^0+/,""),c="";String.isNullOrUndefineOrBlank(e.CustomerTimeZone)||(i=moment(e.CustomerStartTime).format(_onlineCheckout.DateFormatdddMMMDDYYYY),a=moment(e.CustomerStartTime).format(_onlineCheckout.DateFormatdddMMMDDYYYY),r=moment(e.CustomerStartTime).format("h:mm A"),c=" ("+e.CustomerTimeZone+")");var u={};u.autoId=n,u.date=i,u.dateLable=a,u.time=r+c,u.image=e.SpPhoto,u.servicename=t.eventName,u.spname=e.sPName,u.ZoomURL=e.ZoomURL,u.IsFromHomePage=!1,String.isNullOrUndefineOrBlank(e.IsFromHomePage)||1!=e.IsFromHomePage||(u.IsFromHomePage=!0),u.spinit=FindInitials(e.sPName,"SP"),1==e.StreamingStatus?u.LiveStreamingStatus=!0:u.LiveStreamingStatus=!1,u.ShowLiveStream=!1,e.EventDurationRemain<6&&(u.ShowLiveStream=!0),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(u.lstAddonService=e.lstAddonService),o.push(u),""==l?(l=u.date,d=!1):u.date!=l&&(d=!0),s=moment(e.workshopActualDate),String.isNullOrUndefineOrBlank(e.CustomerTimeZone)||(s=moment(e.CustomerStartTime)),n++})});var c=e("#divClassBookSuccess");e("#classDateBox").hide(),0==d&&(e("#classDateBox").show(),c.find("#classDateBox").attr("aria-label",s.format("MMMM").toUpperCase()+s.format("D")).attr("role","banner"),c.find(".booked-month").html(s.format("MMM").toUpperCase()).attr("aria-hidden",!0),c.find(".booked-date").html(s.format("D")).attr("aria-hidden",!0),c.find("#divstatusicon").attr("class","green-circle-div").attr("aria-hidden",!0).html("&#xf00c;")),n>1?c.find("#divappttitletext").html("You're signed up for the classes."):c.find("#divappttitletext").html("You're signed up for the class."),c.find("#divapptparagraphtext").html("You're all set with "+businessName+"."),e("#divclassbooking").html(""),e("#divtempclassbooking").tmpl(o).appendTo("#divclassbooking"),e(".apptproviderimg").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),e("#divClassBookSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;")}"undefined"!=typeof onlineShoppingCartmainSuccess&&(onlineShoppingCartmainSuccess=null),e("#shoppingcartsecond").hide(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,29),e(_cardIntendent.Controls.frame3d_cardintent).hide(),e(_cardIntendent.Controls.zenswipepaymentframe).removeClass("showpopup")},_onlineCheckout.threeDSSuccessCheckout=function(e){if(void 0!==e&&null!=e){if(_onlineCheckout.AuthorisePaymnetCount=_onlineCheckout.AuthorisePaymnetCount+1,_onlineCheckout.AuthoriseListData.length>_onlineCheckout.AuthorisePaymnetCount)return _onlineCheckout.AuthoriseListData[_onlineCheckout.AuthorisePaymnetCount-1].PaymentIntentId=e.PaymentIntentResponse.PaymentIntentId,_onlineCheckout.AuthorisePayment(),!1;_onlineCheckout.AuthoriseListData[_onlineCheckout.AuthorisePaymnetCount-1].PaymentIntentId=e.PaymentIntentResponse.PaymentIntentId,_onlineCheckout.ValidateCartData()}},_onlineCheckout.threeDSFailCheckout=function(t){_onlineCheckout.SetCheckoutAuthResult("fail","",t&&t.paymentGateway?t.paymentGateway:null,t&&t.subResponseCode?t.subResponseCode:"",t&&t.Message?t.Message:"3DS/SCA authorization failed"),_onlineCheckout.FireOnlineCheckoutCompleted(),e("#tabCheckoutBooking2").hasClass("w--current")&&(_onlineCheckout.LoadBalnkCCFrame(),_onlineCheckout.isCheckoutCCChanged=!0),_onlineCheckout.AuthoriseListData=[],_onlineCheckout.AuthorisePaymnetCount=0,FailedCapture3DSecurePopup()},_onlineCheckout.AffirmSuccessCheckout=function(e){void 0!==e&&null!=e&&(_onlineCheckout.AuthoriseListData[0].PSPReferenceNo=e.PaymentIntentResponse.PSPReferenceNo,_onlineCheckout.ValidateCartData())},_onlineCheckout.AffirmFailCheckout=function(e){_onlineCheckout.SetCheckoutAuthResult("fail","",e&&e.paymentGateway?e.paymentGateway:null,e&&e.subResponseCode?e.subResponseCode:"",e&&e.Message?e.Message:"Affirm/VPL authorization failed"),_onlineCheckout.FireOnlineCheckoutCompleted(),String.isNullOrUndefineOrBlank(e)||String.isNullOrUndefineOrBlank(e.PaymentIntentResponse)||String.isNullOrUndefineOrBlank(e.PaymentIntentResponse.PSPReferenceNo)||"FAIL"!=e.PaymentIntentResponse.PSPReferenceNo?(_shopdetail.ResetVPLPaymentMethod(!0,!0),_onlineCheckout.AuthorisePaymnetCount=0,_onlineCheckout.AuthoriseListData=[],FailedCapture3DSecurePopup()):(_onlineCheckout.AuthorisePaymnetCount=0,_onlineCheckout.AuthoriseListData=[])},_onlineCheckout.AuthoriseAffirmPayment=function(){var e={};e.CountryID=countryIdBusDetail,e.PaymentIntentURL=_onlineCheckout.AuthoriseListData[0].NextActionUrl,e.SuccessCallBack=SuccessCallBack=_onlineCheckout.AffirmSuccessCheckout,e.FailedCallback=_onlineCheckout.AffirmFailCheckout,e.IsAffirm=!0,_cardIntendent.LoadCardCaptureIntendentInfo(e)},_onlineCheckout.ChekoutResponse=function(t){ShowLoader(!0),_onlineCheckout.CaptureCheckoutAuthResult(t);var i=!1;if(null==t)return _onlineCheckout.FireOnlineCheckoutCompleted(),void swal({html:!0,title:"Something went wrong. Please search again."});if(_onlineCheckout.AuthorisePaymnetCount=0,_onlineCheckout.CreateAuthoriseList(t),_onlineCheckout.AuthoriseListData.length>0)void 0!==_onlineCheckout.AuthoriseListData[0].IsVPLTransaction&&1==_onlineCheckout.AuthoriseListData[0].IsVPLTransaction?_onlineCheckout.AuthoriseAffirmPayment():_onlineCheckout.AuthorisePayment();else{if(_onlineCheckout.FireOnlineCheckoutCompleted(),null!=t.checkoutResponse&&null!=t.checkoutResponse.resultType&&9==t.checkoutResponse.resultType&&null!=t.checkoutResponse.resultMessage)return void CallbackforMobileApp(0,0,"","",0,"36|~|"+t.checkoutResponse.resultMessage);if(null!=t.checkoutResponse&&null!=t.checkoutResponse.resultType&&10==t.checkoutResponse.resultType&&null!=t.checkoutResponse.resultMessage){var a;return a=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/ReleaseToPublicPending.aspx",void(location.href=a)}1==isCheckInApp&&centerModal("#divClassValidationpopupchk");var r=!1,o=!1,n=!1,s="",l="";if(onlineShoppingCartmainSuccess=e.extend(!0,{},onlineShoppingCartmain),t.OnlineCheckoutType==b||t.OnlineCheckoutType==S){var c=t.classCheckoutResponse;if(null!=c&&c.length>0){var u=t.classCheckoutResponse[0].response;if(void 0!==u&&null!=u&&void 0!==u.subResponseCode&&null!=u.subResponseCode&&"58-43-1"==u.subResponseCode&&(ShowLoader(!1),CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed)),4==c[0].type){if(ClassCartInvoiceNum=null,0==isCheckInApp&&(bkEvent.timeSlotsCache={}),t.OnlineCheckoutType==b){if("true"==IsClassReschedule.toLowerCase()){IsClassReschedule="false";var p=!1;e(".cartremoverdtl").each(function(t,i){void 0!==e(i).attr("data-isWorkShop")&&"true"==e(i).attr("data-isWorkShop").toLowerCase()&&(p=!0)});var h=_shopdetail.GetRescheduleDetail();if(p&&null!=h&&void 0!==h.EventSessionAttendeesId){var m={eventSsnAtIds:h.EventSessionAttendeesId,userId:onlineShoppingCart.loginUserId,status:12,device:"Deleted",denyComments:"",isCancelledByCustomer:!1,isSendMail:!1,isWorkshop:!0};_onlineCheckout.removeEventSessionAttendies(m,function(e){},function(e){})}}1==_onlineCheckout.IsCCDetailEnable()?(1==isCheckInApp&&navigator.userAgent.toLowerCase().indexOf("ipad")>-1&&e("#txtfocusbox").blur(),i=!0,_onlineCheckout.CheckoutMSG(!1,isCheckInApp,onlineShoppingCartmain.Events)):(i=!0,_onlineCheckout.CheckoutMSG(!0,isCheckInApp,onlineShoppingCartmain.Events)),ShowLoader(!1),onlineShoppingCart.Events=[],onlineShoppingCartmain.Events=[],(L=[]).push(4);var f=new vagaro.ajax;(R={}).businessID=onlineShoppingCart.BusinessID,R.loginUserID=UserID,R.itemType=L,R.ischeckinApp=isCheckInApp,R.isFromInvoice=_onlineCheckout.isFromInvoice,R.IsLiveStream=_onlineCheckout.IsCalledFromLiveStream(),f.datamodel.Token=ApiURLEnumOnlineCheckout.removecheckoutitem,f.datamodel.IsNewVagaroAPI=!0,f.datamodel.callback=function(t){0==i?e("#shoppingcartfirst").show():e("#shoppingcartfirst").hide(),e("#shoppingcartsecond").hide(),e("#shoppingcartfirst .divnoitem").removeAttr("style"),e("#shoppingcartfirst .divcartdetail").attr("style","display:none;"),e("#shoppingcartfirst .divheadertext").html("There are no items in the cart."),_onlineCheckout.GetCartItemCount(0)},f.datamodel.data=R,f.datamodel.Error=function(e){vagaro.alert("error")},f.Post()}else r=!0;ShowLoader(!1)}else if(6==c[0].type){if(0==isCheckInApp&&(bkEvent.timeSlotsCache={}),s="",""!=c[0].successSPlist)for(var g=c[0].successSPlist.split(","),v=0;v<=g.length-1;v++)g.length>1&&v==g.length-2?s+=_vgClassSessionSelection.findSPnameByspid(parseInt(g[v]))+" and ":s+=_vgClassSessionSelection.findSPnameByspid(parseInt(g[v]))+",";if(null!=c[0].failSPlistAndReason&&c[0].failSPlistAndReason.length>0){var A=c[0].failSPlistAndReason,C=[];l="";for(v=0;v<=A.length-1;v++)e.grep(A[v].spID,function(e){var t={};t.spID=parseInt(e),t.spName=_vgClassSessionSelection.findSPnameByspid(parseInt(e)),t.failReason=A[v].failReason,C.push(t)}),A.length>1&&v==A.length-2?null!=A[v].spID&&A[v].spID.length>0&&(l+=_vgClassSessionSelection.findSPnameByspid(parseInt(A[v].spID[0]))+" and "):null!=A[v].spID&&A[v].spID.length>0&&(l+=_vgClassSessionSelection.findSPnameByspid(parseInt(A[v].spID[0]))+",");if(""!=c[0].successSPlist&&""!=s){var k=onlineShoppingCartmain.Events;if(k.length>0)for(var D=0;D<=k.length-1;D++){var _=[];for(v=0;v<=C.length-1;v++){var I=e.grep(k[D].eventEnrollment,function(e){return e.sPID==C[v].spID});I.length>0&&(_=_.concat(I))}_.length>0?k[D].eventEnrollment=_:k.splice(D,1)}k.length>0&&(onlineShoppingCartmain.Events=k,_vgClassSessionSelection.SetIntoSessionStorage(_vgClassSessionSelection.model.EventStorage,k))}}if(""!=c[0].successSPlist&&""!=s)s=s.escapeHtml().slice(0,-1),""!=l&&(l=l.escapeHtml().slice(0,-1)),t.OnlineCheckoutType==b?(swal({html:!0,title:"Please note: Due to some error, your enrollment(s) went through with "+s+" and it didn't go through with "+l+"."}),setTimeout(function(){_onlineCheckout.getUserGCDetail()},2e3)):o=!0;else if(t.OnlineCheckoutType==b)if(void 0!==u.paymentGateway&&null!=u.paymentGateway&&void 0!==u.subResponseCode&&null!=u.subResponseCode){var w="Message:"+u.Message+"<br/>Error Code:"+u.paymentGateway+"-"+u.subResponseCode;swal({html:!0,title:w})}else{w="Message:"+u.Message;swal({html:!0,title:w})}else n=!0}else if(1==c[0].type)e.each(c,function(e,t){clsObj=_vgClassSessionSelection.findClassObjByAppId(t.appointmentId),t.className=clsObj.className,t.sessionTime=clsObj.startTime,t.spName=clsObj.sPName,t.eventDate=_vgClassSessionSelection.FormatDate(clsObj.eventDate),t.isVacancyFull=t.vacancy<=0}),e("#tBodyClassValidationTemp").html(""),e("#classValidationCheckoutTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"),e("#validationpopupcls").html(e("#divClassValidationTemp").html()),e("#divClassValidationpopupchk").modal("show");else if(2==c[0].type)e.each(c,function(e,t){if(clsObj=_vgClassSessionSelection.findClassObjByAppId(t.appointmentId),t.className=clsObj.className,t.sessionTime=clsObj.startTime,t.spName=clsObj.sPName,t.eventDate=_vgClassSessionSelection.FormatDate(clsObj.eventDate),""!=t.userDataXml){var i=t.userDataXml.split(" ")[0],a="";void 0!==t.userDataXml.split(" ")[1]&&(a=t.userDataXml.split(" ")[1]),t.username=""!=a?_vgClassSessionSelection.GetUserShortDetail(i,a):i+"."}else t.username=""}),e("#tBodyClassValidationTemp").html(""),e("#UserAlreadyEnrolledTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"),e("#validationpopupcls").html(e("#divClassValidationTemp").html()),e("#divClassValidationpopupchk").modal("show"),ShowLoader(!1);else if(7==c[0].type)e.each(c,function(e,t){clsObj=_vgClassSessionSelection.findClassObjByAppId(t.appointmentId),t.className=clsObj.className,t.sessionTime=clsObj.startTime,t.spName=clsObj.sPName,t.eventDate=_vgClassSessionSelection.FormatDate(clsObj.eventDate)}),e("#tBodyClassValidationTemp").html(""),e("#ClassDeleteTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"),e("#validationpopupcls").html(e("#divClassValidationTemp").html()),e("#divClassValidationpopupchk").modal("show");else if(8==c[0].type)swal({html:!0,title:"Your order is not free of cost. It requires credit card information. Please go back and search again."});else if(9==c[0].type||10==c[0].type||11==c[0].type||12==c[0].type||13==c[0].type){_vgClassSessionSelection.GetGCorPackage();e.each(c,function(e,t){if(1==t.isCustomPackage)var i=_vgClassSessionSelection.findClassObjByGcIdAndEventId(t.gcId,t.eventId);else i=_vgClassSessionSelection.findClassObjByGcId(t.gcId);i.length>0&&(t.className=i[0].className,t.username=_vgClassSessionSelection.GetUserShortDetail(i[0].cFirstName,i[0].cLastName),1==i[0].isPackage?t.giftcertificate="package":0==i[0].isPackage?t.giftcertificate="gift card":t.giftcertificate="")}),e("#tBodyClassValidationTemp").html(""),9==c[0].type?e("#GCNotAvalableTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"):10==c[0].type?e("#GCExpiredTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"):11==c[0].type?e("#GCVoidedTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"):12==c[0].type?e("#GCNotServiceBalTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"):13==c[0].type&&e("#GCNotPriceBalTemplate").tmpl(c).appendTo("#tBodyClassValidationTemp"),e("#validationpopupcls").html(e("#divClassValidationTemp").html()),e("#divClassValidationpopupchk").modal("show"),_onlineCheckout.getUserGCDetail()}else if(5==c[0].type)swal({html:!0,title:"Something went wrong. Please search again."});else if(14==c[0].type)swal({html:!0,title:"User point redeem exceed point balance limit."});else if(15==c[0].type)swal({html:!0,title:"Membership DeActivated / Membership Discount Not Match."});else if(16==c[0].type){var T="";e.grep(c,function(e){T+=e.userDataXml+", "}),c[0].userDataXml=T.trimRight().slice(0,-1);var B=[];B.push(c[0]),e("#tBodyClassValidationTemp").html(""),e("#ClassOnlineBookBlockTemplate").tmpl(B).appendTo("#tBodyClassValidationTemp"),e("#validationpopupcls").html(e("#divClassValidationTemp").html()),e("#divClassValidationpopupchk").modal("show")}}_common.GooglePostCall(onlineShoppingCart.BusinessID)}if(t.OnlineCheckoutType==y||t.OnlineCheckoutType==S){var x=t.checkoutResponse;if(null!=x&&null!==x.resultType){if(x.resultType===_onlineCheckout.FinalResponseType.OldVersion||x.resultType===_onlineCheckout.FinalResponseType.ConfigurationMismatch)1==r?(swal({html:!0,title:"Please note: Your enrollment(s) for classes went through but for other item(s) "+_onlineCheckout.SomeErrorMessage}),_onlineCheckout.RemoveClassOnly()):1==o?(""!=s&&""!=l?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes with "+s+" went through. Your enrollment(s) with "+l+" and transacion for other item(s) didnot go through."}):swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through with "+l+" and the transacion for other item(s) didnot go through."}),setTimeout(function(){_onlineCheckout.getUserGCDetail()},2e3)):swal({html:!0,title:_onlineCheckout.SomeErrorMessage});else if(x.resultType===_onlineCheckout.FinalResponseType.TokenMissMatch){var F="Our system indicates that there is some network related error. Your transaction might be completed. It's recommended to verify Transaction List Report to avoid duplicate Transactions.";1==r?(swal({html:!0,title:"Please note: Your enrollment(s) for classes went through but for other item(s) "+F}),_onlineCheckout.RemoveClassOnly()):1==o?(""!=s&&""!=l?swal({html:!0,title:"Your enrollment(s) went through with "+s+",enrollment didn't go through with "+l+" and for other item(s) "+F}):swal({html:!0,title:"Your enrollment(s) didn't go through with "+l+" and for other item(s) "+F}),setTimeout(function(){_onlineCheckout.getUserGCDetail()},2e3)):swal({html:!0,title:F})}else if(x.resultType===_onlineCheckout.FinalResponseType.ServiceMismatch)swal({html:!0,title:x.resultMessage+" Or contact the shop owner."});else if(x.resultType===_onlineCheckout.FinalResponseType.Fail)if(null!=x.gatewayResponse&&void 0!==x.gatewayResponse.subResponseCode&&null!=x.gatewayResponse.subResponseCode&&"58-43-1"==x.gatewayResponse.subResponseCode&&CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed),1==r)swal({html:!0,title:"Please note: Your enrollment(s) for classes went through but the transaction for other item(s) didnot go through."}),_onlineCheckout.RemoveClassOnly();else if(1==o)""!=s&&""!=l?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes with "+s+" went through. Your enrollment(s) with "+l+" and transacion for other item(s) didnot go through."}):swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through with "+l+" and the transacion for other item(s) didnot go through."}),setTimeout(function(){_onlineCheckout.getUserGCDetail()},2e3);else{if((w=x.resultMessage.replace("Something went wrong. Please try again.","")).includes("Certegy")){e(".customeb-body p").html("");var O=x.resultMessage.split("|~|");e("#vpl-payment-fail-popup").modal("show");var M=O[0],E=O[1];return e(".customeb-body p").html(M),e(".customeb-body-last #certegydate").html(String.format("{0}",(new Date).format("MMMM dd, yyyy hh:mm"))),e(".customeb-body-last #certegyref").text(E),ShowLoader(!1),e(".modal:visible").each(function(e,t){centerModal(t)}),!1}swal({html:!0,title:w},function(e){_shopdetail.ResetVPLPaymentMethod(!0,!0),P(x)})}else if(x.resultType===_onlineCheckout.FinalResponseType.AuthorizationFail){var $=parseFloat(x.resultMessage);isNaN($)&&($=0);F="didnot go through.";1==r?(swal({html:!0,title:"Please note: Your enrollment(s) for classes went through but the transaction for other item(s) didnot go through."}),_onlineCheckout.RemoveClassOnly()):1==o?(""!=s&&""!=l?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes with "+s+" went through. Your enrollment(s) with "+l+" and transacion for other item(s) didnot go through."}):swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through with "+l+" and the transacion for other item(s) didnot go through."}),setTimeout(function(){_onlineCheckout.getUserGCDetail()},2e3)):swal({html:!0,title:"Something went wrong. Please try again."})}else if(x.resultType===_onlineCheckout.FinalResponseType.PartialSuccess){var N=!1;e.each(x.partiallyFailed,function(e,t){t.recordType==d.Product&&0==N&&(N=!0)});var L=[];if(1==N)onlineShoppingCart.GiftCertificates=[],onlineShoppingCartmain.GiftCertificates=[],onlineShoppingCart.Memberships=[],onlineShoppingCartmain.Memberships=[],onlineShoppingCart.Packages=[],onlineShoppingCartmain.Packages=[],L.push(2),L.push(3),L.push(5),1==r?(onlineShoppingCart.Events=[],onlineShoppingCartmain.Events=[],L.push(4),swal({html:!0,title:"Your enrollment(s) for classes went through but the transaction for product(s) didnot go through."})):1==o?""!=s&&""!=l?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes with "+s+" went through. Your enrollment(s) with "+l+" and transacion for product(s) didnot go through."}):swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through with "+l+" and the transacion for product(s) didnot go through."}):1==n?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes and transaction for Product(s) didnot go through."}):swal({html:!0,title:"Product(s) checkout didnot go through."});else{var U="";null!=onlineShoppingCart.GiftCertificates&&GiftCertificates.length>0&&(U+="GiftCertificate(s),"),null!=onlineShoppingCart.Memberships&&Memberships.length>0&&(U+="Membership(s),"),null!=onlineShoppingCart.Packages&&Packages.length>0&&(U+="Package(s),"),U=U.escapeHtml().slice(0,-1),1==r?(onlineShoppingCart.Events=[],onlineShoppingCartmain.Events=[],L.push(4),swal({html:!0,title:"Your enrollment(s) for classes went through but the transaction for "+U+" didnot go through."})):1==o?""!=s&&""!=l?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes with "+s+" went through. Your enrollment(s) with "+l+" and transacion for "+U+" didnot go through."}):swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through with "+l+" and the transacion for "+U+" didnot go through."}):1==n?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes and transaction for "+U+" didnot go through."}):swal({html:!0,title:U+" checkout didnot go through."}),onlineShoppingCart.Inventories=[],onlineShoppingCartmain.Inventories=[],L.push(1)}f=new vagaro.ajax;(R={}).businessID=onlineShoppingCart.BusinessID,R.loginUserID=UserID,R.itemType=L,R.ischeckinApp=isCheckInApp,R.isFromInvoice=_onlineCheckout.isFromInvoice,R.IsLiveStream=_onlineCheckout.IsCalledFromLiveStream(),f.datamodel.Token=ApiURLEnumOnlineCheckout.removecheckoutitem,f.datamodel.IsNewVagaroAPI=!0,f.datamodel.callback=function(e){_onlineCheckout.getUserGCDetail()},f.datamodel.data=R,f.datamodel.Error=function(e){vagaro.alert("error")},f.Post()}else if(x.resultType===_onlineCheckout.FinalResponseType.Success){L=[];CartInvoiceNum=null,1==r?(L.push(4),i=!0,_onlineCheckout.CheckoutMSG(!1,isCheckInApp,onlineShoppingCartmain.Events)):1==o?""!=s&&""!=l?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes with "+s+" went through. Your enrollment(s) with "+l+"  didnot go through and transacion for other item(s) item(s) did go through."}):swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through with "+l+" and transacion for other item(s) item(s) did go through."}):1==n?swal({html:!0,title:"Please note: Due to some error, your enrollment(s) for classes didn't go through but the transaction for other item(s) did go through."}):(i=!0,_onlineCheckout.CheckoutMSG(!1,isCheckInApp,onlineShoppingCartmain.Events)),onlineShoppingCart.Events=[],onlineShoppingCartmain.Events=[],onlineShoppingCart.GiftCertificates=[],onlineShoppingCartmain.GiftCertificates=[],onlineShoppingCart.Memberships=[],onlineShoppingCartmain.Memberships=[],onlineShoppingCart.Packages=[],onlineShoppingCartmain.Packages=[],onlineShoppingCart.Inventories=[],onlineShoppingCartmain.Inventories=[],L.push(1),L.push(2),L.push(3),L.push(5);var R;f=new vagaro.ajax;(R={}).businessID=onlineShoppingCart.BusinessID,R.loginUserID=UserID,R.itemType=L,R.ischeckinApp=isCheckInApp,R.isFromInvoice=_onlineCheckout.isFromInvoice,R.IsLiveStream=_onlineCheckout.IsCalledFromLiveStream(),f.datamodel.Token=ApiURLEnumOnlineCheckout.removecheckoutitem,f.datamodel.IsNewVagaroAPI=!0,f.datamodel.callback=function(t){1==o||1==n?_onlineCheckout.getUserGCDetail():(0==i&&e("#shoppingcartfirst").show(),e("#shoppingcartsecond").hide(),e("#shoppingcartfirst .divnoitem").removeAttr("style"),e("#shoppingcartfirst .divcartdetail").attr("style","display:none;"),e("#shoppingcartfirst .divheadertext").html("There are no items in the cart."),_onlineCheckout.GetCartItemCount(0))},f.datamodel.data=R,f.datamodel.Error=function(e){vagaro.alert("error")},f.Post()}if(null!==x.printObjects&&x.printObjects.length>0){var G="",W="",V=!1;if(e.each(x.printObjects,function(e,t){t.printType===_onlineCheckout.PrintType.Receipt||t.printType===_onlineCheckout.PrintType.GC&&(ShowLoader(!1),G=_onlineCheckout.getParameterFromUrl(t.printData,"BussURl"),W=W+","+_onlineCheckout.getParameterFromUrl(t.printData,"img"),V=!0)}),1==V)if(G.includes("https://")||(G="https://"+G),"undefined"!=typeof vgAppicationType&&1==vgAppicationType){W=","==(W=","==W.charAt(0)?W.substr(1):W).charAt(W.length-1)?W.substr(0,W.length-1):W,CallbackforMobileApp(0,0,"","","0","9|~|"+('{\\"vagarourl\\":\\"'+(G+("/"!=G.charAt(G.length-1)?"/":"")+("undefined"!=typeof GCTextOnImageAkamai&&""!=GCTextOnImageAkamai?GCTextOnImageAkamai:""))+'\\", \\"imagename\\":\\"'+W+'\\"}')),HideDynamicPopup("divPrintGC")}else{var j="/ShopOwner/PrintMultipleGC.aspx?BussID="+onlineShoppingCart.BusinessID+"&img="+W;ShowDynamicPopupForShopOwner(j,510,970,"divPrintGC","Print GC")}}else ShowLoader(!1)}}}},_onlineCheckout.SuccessCheckinAPP=function(){null!=glbMembershipData.membershipID&&1==onlineShoppingCart.ChekoutType?null!=glbMembershipData.membershipCardNo?CallbackforMobileScreen(null):"function"==typeof InsertCheckInLog&&(glbDataCheckIn.requiredMembershipStatus=2,InsertCheckInLog()):"function"==typeof CheckInSuccessRedirection&&(glbDataCheckIn.requiredMembershipStatus=2,CheckInSuccessRedirection())},_onlineCheckout.ShowSweetConfirmCheckInLogEntry=function(e,t,i,a){swal({title:e,text:"",type:"success",showCancelButton:a,confirmButtonClass:"btn-danger",confirmButtonText:"OK",cancelButtonText:"",closeOnConfirm:!1,closeOnCancel:!1,customClass:"swal-white-greenbtn"},function(e){return swal.close(),1==e&&(null!=glbMembershipData.membershipID&&1==onlineShoppingCart.ChekoutType?null!=glbMembershipData.membershipCardNo?CallbackforMobileScreen(null):"function"==typeof InsertCheckInLog&&InsertCheckInLog():"function"==typeof CheckInSuccessRedirection&&CheckInSuccessRedirection(),!0)})},_onlineCheckout.ApplyPointsONClass=function(){e.each(onlineShoppingCart.Events,function(t,i){i.PointRedeem>0&&e.each(i.eventEnrollment,function(t,a){var r=e.grep(onlineShoppingCart.UsersPoints,function(e){return e.userId==a.customerID&&e.userId>0||e.emailId==a.cUserEmail&&""!=e.emailId});if(null!=(r=r[0])&&null!=r&&r.pointsBalance>0){var o=1*i.PointRedeem;o>0&&r.pointsBalance>=o&&(a.isPointApply=!0,a.PointRedeem=o,a.pointGained=0,r.pointsBalance=parseInt(r.pointsBalance-o),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(a.PointRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(a.PointRedeem))}1!=a.isPointApply&&(a.PointRedeem=0)})})};var k=0,D=0,_=!0;_onlineCheckout.GetPackageSessionWisePrice=function(e,t,i){k=0,D=0;var a=[],r=e;if(1==i){for(var o=0;o<=r.length-1;o++){if(!(parseInt(t)>=parseInt(r[o].split("-")[1]))){_onlineCheckout.GetPackageSessionWisePrice(e,t+1,1),_=!1;break}if(t==parseInt(r[o].split("-")[1])){k=parseInt(r[o].split("-")[1]),D=parseFloat(r[o].split("-")[2]),_=!1;break}_=!0}_&&_onlineCheckout.GetPackageSessionWisePrice(e,t-1,1)}else{for(o=r.length-1;o>=0;o--){if(!(parseInt(t)<=parseInt(r[o].split("-")[1]))){_onlineCheckout.GetPackageSessionWisePrice(e,t-1,0),_=!1;break}if(t==parseInt(r[o].split("-")[1])){k=parseInt(r[o].split("-")[1]),D=parseFloat(r[o].split("-")[2]),_=!1;break}_=!0}_&&(1!=t?_onlineCheckout.GetPackageSessionWisePrice(e,t+1,0):k=r[0].split("-")[1])}return a[0]=k,a[1]=D,a},_onlineCheckout.GetClassSessionWisePrice=function(e,t,i){for(var a=0,r=0,o=e.split(","),n=0;n<=o.length-1&&parseInt(t)>=parseInt(o[n].split("-")[1]);n++)a=parseInt(o[n].split("-")[1]),r=parseFloat(o[n].split("-")[2]);return(parseInt(t)*r/a*parseInt(i)).toFixed(2)},_onlineCheckout.errorMessage=function(){e(".checkoutvalerror").remove(),String.isNullOrUndefineOrBlank(onlineShoppingCartmain)||_onlineCheckout.isValidForCheckoutInvoice()||(String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Inventories)||e.each(onlineShoppingCartmain.Inventories,function(t,i){!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,a){e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId.toString()+'"]').find("div.div-block-42").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+a.Message+"</div>")})}),String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Memberships)||e.each(onlineShoppingCartmain.Memberships,function(e,t){!String.isNullOrUndefineOrBlank(t.errors)&&t.errors.length}),String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Packages)||e.each(onlineShoppingCartmain.Packages,function(t,i){!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,a){e('div [data-type="servicepackage"][data-rid="'+i.ServiceId+'"][data-autoid="'+i.autoId+'"]').find("div.div-block-47 > div").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+a.Message+"</div>")})}),String.isNullOrUndefineOrBlank(onlineShoppingCartmain.GiftCertificates)||e.each(onlineShoppingCartmain.GiftCertificates,function(t,i){!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,a){e('div [data-type="gc"][data-rid="'+i.GiftCertificatePhotoID.toString()+'"][data-autoid="'+i.autoId+'"]').find(".div-block-42").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+a.Message+"</div>")})}),String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events)||e.each(onlineShoppingCartmain.Events,function(t,i){!String.isNullOrUndefineOrBlank(i.eventEnrollment)&&i.eventEnrollment.length>0&&e.each(i.eventEnrollment,function(t,i){!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,a){e('div [data-type="classes"][data-rid="'+i.eventID.toString()+'"][data-autoid="'+i.autoID.toString()+'"] > div').append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+a.Message+"</div>")})})}))},_onlineCheckout.setShippingAddressObject=function(){if(onlineShoppingCart.IsPickupInStore=e("#btnInStorePickup").hasClass("w--current"),onlineShoppingCart.IsAddressOnFile=e("#aOldUserAddress").hasClass("w--current"),0==onlineShoppingCart.IsPickupInStore)if(1==onlineShoppingCart.IsAddressOnFile)onlineShoppingCart.Address={},onlineShoppingCart.Address.fullName=e("#aOldUserAddress").attr("data-fullname"),onlineShoppingCart.Address.street=e("#aOldUserAddress").attr("data-street"),onlineShoppingCart.Address.streetNo=e("#aOldUserAddress").attr("data-streetno"),onlineShoppingCart.Address.stateName=e("#aOldUserAddress").attr("data-statename"),onlineShoppingCart.Address.countryID=e("#aOldUserAddress").attr("data-countryid"),onlineShoppingCart.Address.city=e("#aOldUserAddress").attr("data-City"),onlineShoppingCart.Address.zip=e("#aOldUserAddress").attr("data-zip"),onlineShoppingCart.Address.dayPhone=e("#aOldUserAddress").attr("data-dayphone"),onlineShoppingCart.Address.stateID=e("#aOldUserAddress").attr("data-stateid"),onlineShoppingCart.Address.isSaveAddressinfo=!1;else{onlineShoppingCart.Address={},onlineShoppingCart.Address.fullName=e("#txtNewShipFirstName").val()+" "+e("#txtNewShipLastName").val(),onlineShoppingCart.Address.dayPhone=e("#txtNewShipPhone").val();var t;t=newShippingAddress.getAddressData(),onlineShoppingCart.Address.street=t.address,onlineShoppingCart.Address.streetNo=e("#txtNewShippingAptSuite").val(),onlineShoppingCart.Address.stateName=t.state,onlineShoppingCart.Address.countryID=t.country,onlineShoppingCart.Address.city=t.city,onlineShoppingCart.Address.zip=t.zip,onlineShoppingCart.Address.stateID=t.stateId,onlineShoppingCart.Address.isSaveAddressinfo=e("#saveaddressinfo").prop("checked")}else onlineShoppingCart.Address=null;try{onlineShoppingCart.PickupDate=moment(getdatepickervalue("#txtPickupDateTime"))._d}catch(e){}_onlineCheckout.displayFinalCalculatedPrice()},_onlineCheckout.ValidateCheckOutForm=function(){_onlineCheckout.setShippingAddressObject(),_onlineCheckout.ClearCheckOutValidationMessage();var t=!0;if(!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&!_onlineCheckout.isValidForCheckoutInvoice())if(onlineShoppingCart.IsPickupInStore=e("#btnInStorePickup").hasClass("w--current"),onlineShoppingCart.IsPickupInStore){try{onlineShoppingCart.PickupDate=moment(getdatepickervalue("#txtPickupDateTime"))._d}catch(e){onlineShoppingCart.PickupDate=moment(new Date)._d}var a=onlineShoppingCart.PickupDate.getDay()+1;0==(null!=_onlineCheckout.businessWorkinghour.filter(function(e){return e.DayID===a})[0])&&(e("#divPickupDateError").show(),e("#divPickupDateError").html(""),e("#divPickupDateError").html("Business is closed on pickup date. Please select another pickup date"),e("#txtPickupDateTime").addClass("errorInput"),t=!1);var r,o="";for(i=1;i<=7;i++){switch(i){case 1:r="Sunday";break;case 2:r="Monday";break;case 3:r="Tuesday";break;case 4:r="Wednesday";break;case 5:r="Thursday";break;case 6:r="Friday";break;case 7:r="Saturday"}var n=e.grep(_onlineCheckout.businessWorkinghour,function(e){return e.DayID===i});o+="<div class='openingHours' itemprop='openingHours' datetime='Su 06:05-13:05'><div class='clsdays'>"+r+"</div> <div class='clstime'>  "+(null!=n[0]&&""!=n[0]?n[0].FromTime.replace("AM"," AM").replace("PM"," PM")+" - "+n[0].ToTime.replace("AM"," AM").replace("PM"," PM"):"Closed")+"</div></div>"}var s,l=moment(onlineShoppingCart.PickupDate).format("hh:mm a");for(i=0;i<_onlineCheckout.businessWorkinghour.length;i++)if(_onlineCheckout.businessWorkinghour[i].DayID==a){openingtime=_onlineCheckout.businessWorkinghour[i].FromTime,closingtime=_onlineCheckout.businessWorkinghour[i].ToTime;break}if("undefined"!=typeof openingtime&&"undefined"!=typeof closingtime)openingtime=openingtime.toLowerCase().replace("am"," am"),openingtime=openingtime.toLowerCase().replace("pm"," pm"),closingtime=closingtime.toLowerCase().replace("am"," am"),closingtime=closingtime.toLowerCase().replace("pm"," pm"),s='<div id="divWorkingHours1" style="" class="paddingbottom20"> <p style=padding-top:5px>You are allowed to select any time from the range given below. </p><div><div id="ulBusinessWorkingHours" class="list-inline salontime ulBusinessWorkingHours">'+o+"</div></div></div>",(Date.parse("01/01/2010 "+l)<Date.parse("01/01/2010 "+openingtime)||Date.parse("01/01/2010 "+l)>Date.parse("01/01/2010 "+closingtime))&&(e("#divPickupDateError").show(),e("#divPickupDateError").html(""),e("#divPickupDateError").html("The time that you have selected is outside of salon working hours.</br>"+s),e("#txtPickupDateTime").addClass("errorInput"),t=!1);new Date(onlineShoppingCart.PickupDate).toDateString()==salonDate.toDateString()&&Date.parse("01/01/2010 "+l)<Date.parse("01/01/2010 "+salonTime)&&(e("#divPickupDateError").show(),e("#divPickupDateError").html(""),e("#divPickupDateError").html("Selected time has already passed. Please select later time."),e("#txtPickupDateTime").addClass("errorInput"),t=!1)}else if(onlineShoppingCart.IsAddressOnFile=e("#aOldUserAddress").hasClass("w--current"),0==onlineShoppingCart.IsAddressOnFile&&(e("#userNewAddressValidate").valid()&&newShippingAddress.validateAddressData()||(vagaro.alert("Please enter valid address"),t=!1)),String.isNullOrUndefineOrBlank(onlineShoppingCart.SelectedShippingMethod)){var d="Please select shipping method";String.isNullOrUndefineOrBlank(onlineShoppingCart.shippingOptions)&&(d="Please calculate shipping cost"),0==_onlineCheckout.hideShippingMethodsForFlatRateShippingProducts().allFlatRateShippingProducts?(e("#divShippingerrorTab").show(),e("#divShippingerrorTab").html(""),_onlineCheckout.ShippingMethodPopUp(d),t=!1):1==onlineShoppingCart.IsAddressOnFile&&(String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-statename"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-countryid"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-City"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-zip"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-stateid")))&&(swal("Please enter valid shipping address"),t=!1)}if(0==e("#tabVagaroPayLater").hasClass("w--current")){var c=_onlineCheckout.getFinalCCAmount();!(parseFloat(onlineShoppingCart.ccAmt)>0-parseFloat(onlineShoppingCart.FeeDepositsRemaining)>0||1==_onlineCheckout.IsCCDetailEnable()&&parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining))>0||null!=onlineShoppingCart.SelectedShippingMethod&&null!=onlineShoppingCart.SelectedShippingMethod&&onlineShoppingCart.SelectedShippingMethod.Rate>0||1==_onlineCheckout.IsLoadCCIframForMemrship()||parseFloat(c)>0)||null!=_onlineCheckout.zenSwipeCardDetails&&null!=_onlineCheckout.zenSwipeCardDetails.card_token||1!=_onlineCheckout.isCheckoutCCChanged||(ShowLoader(!0),vui.frame.zenswipe.submit(),t=!1)}return t},_onlineCheckout.IsLoadCCIframForMemrship=function(){if("undefined"!=typeof onlineShoppingCartmain&&!String.isNullOrUndefineOrBlank(onlineShoppingCartmain)){if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Memberships)){var t=0;if(e.grep(onlineShoppingCartmain.Memberships,function(e){e.IsRecurring&&(t=_onlineCheckout.parseTodecimal(t+e.Price,2))}),onlineShoppingCartmain.Memberships.length>0&&t>0)return!0}if(!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Packages)){var i=0,a=e.grep(onlineShoppingCartmain.Packages,function(e){if(void 0!==e.IsRecurring&&1==e.IsRecurring)return i=_onlineCheckout.parseTodecimal(i+e.Price,2),!0});if(onlineShoppingCartmain.Packages.length>0&&a.length>0&&i>0)return!0}if("true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)&&("false"==IsClassReschedule.toLowerCase()||"true"==IsClassReschedule.toLowerCase()&&(void 0===IsPaid||"false"==IsPaid.toString().toLowerCase())))return!0;if("true"==isCCRequiredForOnlineClass.toLowerCase()&&parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining)-parseFloat(onlineShoppingCart.PartialPrice))>0)return!0}return!1},_onlineCheckout.ClearCheckOutValidationMessage=function(){e("#divPickupDateError").hide(),e("#divPickupDateError").html(""),e("#divShippingerrorTab").hide(),e("#divShippingerrorTab").html("")},_onlineCheckout.getAppliedPresetDiscount=function(){var t=[];return null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&(objDIsc={},objDIsc.DiscountID=e.DiscountID,objDIsc.ItemTypeID=2,objDIsc.ServiceID=e.InventoryId,t.push(objDIsc))}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&(objDIsc={},objDIsc.DiscountID=e.DiscountID,objDIsc.ItemTypeID=3,objDIsc.ServiceID=e.ServiceId,t.push(objDIsc))}),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&(objDIsc={},objDIsc.DiscountID=e.DiscountID,objDIsc.ItemTypeID=7,objDIsc.ServiceID=e.MembershipId,t.push(objDIsc))}),null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&(objDIsc={},objDIsc.DiscountID=e.DiscountID,objDIsc.ItemTypeID=8,objDIsc.ServiceID=e.appointmentID,t.push(objDIsc))})}),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&e.grep(onlineShoppingCart.GiftCertificates,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&(objDIsc={},objDIsc.DiscountID=e.DiscountID,objDIsc.ItemTypeID=5,objDIsc.Price=e.TotalPrice,t.push(objDIsc))}),t},_onlineCheckout.ValidProductData=function(){if(onlineShoppingCart.IsPickupInStore=e("#btnInStorePickup").hasClass("w--current"),onlineShoppingCart.IsPickupInStore){try{onlineShoppingCart.PickupDate=moment(getdatepickervalue("#txtPickupDateTime"))._d}catch(e){onlineShoppingCart.PickupDate=moment(new Date)._d}var t=onlineShoppingCart.PickupDate.getDay()+1;if(0==(null!=_onlineCheckout.businessWorkinghour.filter(function(e){return e.DayID===t})[0]))return e("#divPickupDateError").show(),e("#divPickupDateError").html(""),e("#divPickupDateError").html("Business is closed on pickup date. Please select another pickup date"),e("#txtPickupDateTime").addClass("errorInput"),isValid=!1,!1;var a,r="";for(i=1;i<=7;i++){switch(i){case 1:a="Sunday";break;case 2:a="Monday";break;case 3:a="Tuesday";break;case 4:a="Wednesday";break;case 5:a="Thursday";break;case 6:a="Friday";break;case 7:a="Saturday"}var o=e.grep(_onlineCheckout.businessWorkinghour,function(e){return e.DayID===i});r+="<div class='openingHours' itemprop='openingHours' datetime='Su 06:05-13:05'><div class='clsdays'>"+a+"</div> <div class='clstime'>  "+(null!=o[0]&&""!=o[0]?o[0].FromTime.replace("AM"," AM").replace("PM"," PM")+" - "+o[0].ToTime.replace("AM"," AM").replace("PM"," PM"):"Closed")+"</div></div>"}var n,s=moment(onlineShoppingCart.PickupDate).format("hh:mm a");for(i=0;i<_onlineCheckout.businessWorkinghour.length;i++)if(_onlineCheckout.businessWorkinghour[i].DayID==t){openingtime=_onlineCheckout.businessWorkinghour[i].FromTime,closingtime=_onlineCheckout.businessWorkinghour[i].ToTime;break}if("undefined"!=typeof openingtime&&"undefined"!=typeof closingtime)if(openingtime=openingtime.toLowerCase().replace("am"," am"),openingtime=openingtime.toLowerCase().replace("pm"," pm"),closingtime=closingtime.toLowerCase().replace("am"," am"),closingtime=closingtime.toLowerCase().replace("pm"," pm"),n='<div id="divWorkingHours1" style="" class="paddingbottom20"> <p style=padding-top:5px>You are allowed to select any time from the range given below. </p><div><div id="ulBusinessWorkingHours" class="list-inline salontime ulBusinessWorkingHours">'+r+"</div></div></div>",Date.parse("01/01/2010 "+s)<Date.parse("01/01/2010 "+openingtime)||Date.parse("01/01/2010 "+s)>Date.parse("01/01/2010 "+closingtime))return e("#divPickupDateError").show(),e("#divPickupDateError").html(""),e("#divPickupDateError").html("The time that you have selected is outside of salon working hours.</br>"+n),e("#txtPickupDateTime").addClass("errorInput"),isValid=!1,!1;if(new Date(onlineShoppingCart.PickupDate).toDateString()==salonDate.toDateString()&&Date.parse("01/01/2010 "+s)<Date.parse("01/01/2010 "+salonTime))return e("#divPickupDateError").show(),e("#divPickupDateError").html(""),e("#divPickupDateError").html("Selected time has already passed. Please select later time."),e("#txtPickupDateTime").addClass("errorInput"),isValid=!1,!1}else{if(onlineShoppingCart.IsAddressOnFile=e("#aOldUserAddress").hasClass("w--current"),0==onlineShoppingCart.IsAddressOnFile){if(!e("#userNewAddressValidate").valid())return vagaro.alert("Please enter valid address"),isValid=!1,!1;if(!newShippingAddress.validateAddressData())return vagaro.alert("Please enter valid address"),isValid=!1,!1}if(String.isNullOrUndefineOrBlank(onlineShoppingCart.SelectedShippingMethod)){var l="Please select shipping method";if(String.isNullOrUndefineOrBlank(onlineShoppingCart.shippingOptions)&&(l="Please calculate shipping cost"),0==_onlineCheckout.hideShippingMethodsForFlatRateShippingProducts().allFlatRateShippingProducts)return e("#divShippingerrorTab").show(),e("#divShippingerrorTab").html(""),e("#divShippingerrorTab").html(l),isValid=!1,!1;if(1==onlineShoppingCart.IsAddressOnFile&&(String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-statename"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-countryid"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-City"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-zip"))||String.isNullOrUndefineOrBlank(e("#aOldUserAddress").attr("data-stateid"))))return swal("Please enter valid shipping address"),isValid=!1,!1}}return!0},_onlineCheckout.ValidateCartData=function(){if(1==isCheckInApp&&navigator.userAgent.toLowerCase().indexOf("ipad")>-1&&1==_onlineCheckout.isFormsDirectClass&&e("#txtfocusbox").focus(),!_onlineCheckout.ValidateFirstTimeCustomerSelectionCart())return!1;if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&0==_onlineCheckout.isValidForCheckoutInvoice()&&0==onlineShoppingCart.IsAddressOnFile){if(""==e("#txtNewShipFirstName").val().trim()||""==e("#txtNewShipLastName").val().trim())return void vagaro.alert("Please enter valid name.");if(""==e("#txtNewShipPhone").val().trim())return void vagaro.alert("Please enter valid contact number.")}if(_vgClassSessionSelection.VisibleControlLength("#divreturnpolicy")>0&&_vgClassSessionSelection.VisibleControlLength("#shoppingcartsecond")>0&&_onlineCheckout.VisibleControlLength("#lblreturnpolicy")>0){if(0==e("#chkreturnpolicy").prop("checked"))return _onlineCheckout.CancelPolicyPopup(),!1;e("#lblreturnpolicy").removeClass("label-error").css("color","")}if(e("#tabVagaroPayLater").hasClass("w--current")){if(!_onlineCheckout.UpdateAffirmUserData())return!1;if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&String.isNullOrUndefineOrBlank(onlineShoppingCart.SelectedShippingMethod)&&!onlineShoppingCart.IsPickupInStore)if(null==onlineShoppingCart.invoiceDetails)if(0==_onlineCheckout.ValidProductData())return isValid=!1,!1;if(0==_onlineCheckout.AffirmVPLCapture(!0))return isvalid=!1,!1}if(0==isCheckInApp&&_vgClassSessionSelection.VisibleControlLength("#divreturnpolicyPayInvoice")>0){if(0==e("#chkinvoicereturnpolicy").prop("checked"))return e("#lblinvoicereturnpolicy").addClass("label-error").css("color","#FF0000"),e("#chkinvoicereturnpolicy").focus(),!1;e("#lblinvoicereturnpolicy").removeClass("label-error").css("color","")}if(1!=_onlineCheckout.isValidCardNotPresent())if(1==isCheckInApp&&(UserID=glbDataCheckIn.scanUserID),"false"==IsClassReschedule.toLowerCase()){ShowLoader(!0);var t=_onlineCheckout.getAppliedPresetDiscount(),i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumOnlineCheckout.validateshoppingcartdata,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){if(ShowLoader(!1),null!=t){if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&null==t.Inventories)return vagaro.alert("All the items in the cart are already checked out, Keep shopping."),void setTimeout(function(){window.location.href=window.location.href},3e3);if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&null==t.Memberships)return vagaro.alert("All the items in the cart are already checked out, Keep shopping."),void setTimeout(function(){window.location.href=window.location.href},3e3);if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&null==t.Packages)return vagaro.alert("All the items in the cart are already checked out, Keep shopping."),void setTimeout(function(){window.location.href=window.location.href},3e3);if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){if(null==t.Events)return vagaro.alert("All the items in the cart are already checked out, Keep shopping."),void setTimeout(function(){window.location.href=window.location.href},3e3);try{e.grep(onlineShoppingCart.Events,function(t){var i="",a=e("#ancBuyNow").text();console.log(a),i="Request"!=a;var r={};r.PageName=0==i?"Request":"Book",r.Category="Book",r.Action=r.PageName+" Class",r.BusinessName=_shopdetail.businessName;var o=0;null!=e("#hdnSiteBuilderBusinessID")&&null!=e("#hdnSiteBuilderBusinessID").val()&&(o=parseInt(e("#hdnSiteBuilderBusinessID").val())),r.BusinessID=o,r.ClassName=t.eventName,r.ClassPrice=currencysymbol+t.eventEnrollment[0].price.format("#.##"),r.EmpName=t.eventEnrollment[0].sPName,r.ClassTime=t.eventEnrollment[0].startTime,formattedDate=new Date(t.eventEnrollment[0].eventDate),r.ClassDate=formattedDate.toISOString().split("T")[0],r.isAppointmentBooked=i,_vgLogEvent.LogData(r)})}catch(e){}}if(null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&null==t.GiftCertificates)return vagaro.alert("All the items in the cart are already checked out, Keep shopping."),void setTimeout(function(){window.location.href=window.location.href},3e3);_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(onlineShoppingCart)?(onlineShoppingCart.loginUserId=t.loginUserId,1==_onlineCheckout.isCheckoutVPLChanged&&0==_siteBuilderDetail.isAffirmEnable?_onlineCheckout.VPLCheckoutValidation():_onlineCheckout.SaveOnlineCheckout()):1==_onlineCheckout.isCheckoutVPLChanged?(ShowLoader(!0),0==_siteBuilderDetail.isAffirmEnable?_onlineCheckout.VPLCheckoutValidation():_onlineCheckout.SaveOnlineCheckout()):1==t.IsValidCartData?_onlineCheckout.SaveOnlineCheckout():(onlineShoppingCartmain=t,_onlineCheckout.ValidateErrorMessage(t,!0))}};var a={businessID:businessID,loginUserID:UserID,IsCheckInApp:isCheckInApp,AppliedPromo:t,IsFromInvoice:_onlineCheckout.isFromInvoice,InvoiceID:_onlineCheckout.InvoiceID,IsLiveStream:_onlineCheckout.IsCalledFromLiveStream()};i.datamodel.data=a,i.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},i.Post(),setTimeout(function(){e("#dvCheckoutSuccessMSG").attr("tabindex",-1).attr("role","banner").focus()},5e3)}else _onlineCheckout.SaveOnlineCheckout(),setTimeout(function(){e("#dvCheckoutSuccessMSG").attr("tabindex",-1).attr("role","banner").focus()},5e3);else vagaro.alert(_onlineCheckout.CardNotPresentMessage)},_onlineCheckout.CancelPolicyPopup=function(){swal({title:"",text:"By selecting “Agree & Continue,” you acknowledge and accept the Cancellation Policy and Terms & Conditions of this business.",html:!0,showCancelButton:!0,confirmButtonText:"Agree & Proceed",cancelButtonText:"Disagree",customClass:"sweet-alert-model"},function(t){t?(e("#chkreturnpolicy").prop("checked",!0),e("#lblreturnpolicy").removeClass("label-error").css("color",""),e("#ancBuyNow").is(":visible")&&e("#ancBuyNow").click()):(e("#lblreturnpolicy").addClass("label-error").css("color","#FF0000"),e("#chkreturnpolicy").focus(),swal.close())})},_onlineCheckout.ShippingMethodPopUp=function(t){swal({title:"",text:t,html:!0,showCancelButton:!0,confirmButtonText:"Ok",cancelButtonText:"Cancel",customClass:"sweet-alert-model"},function(i){var a;i?(a=document.querySelector(".shippingMethodsHideShow"))&&(e("#divShippingerrorTab").html(t),a.scrollIntoView({behavior:"smooth",block:"start"})):((a=document.querySelector(".shippingMethodsHideShow"))&&(e("#divShippingerrorTab").html(t),a.scrollIntoView({behavior:"smooth",block:"start"})),swal.close())})},_onlineCheckout.VPLFinalSubmit=function(t){if(1==t){if(0==_onlineCheckout.AffirmVPLCapture(!0))return ShowLoader(!1),!1;_onlineCheckout.isValidForCheckoutInvoice()?_onlineCheckout.PayInvoice():_onlineCheckout.ValidateCartData()}else ShowLoader(!0),e("#finalCheckout").val(1),_onlineCheckout.SaveOnlineCheckout()},_onlineCheckout.AffirmVPLCapture=function(t){var i=JSON.parse(e("#hdnUserDetails").val());if(1==t)return!String.isNullOrUndefineOrBlank(i.EmailId)||!String.isNullOrUndefineOrBlank(e("#txtAffirmEmailId").data("EmailId"))||(_onlineCheckout.DisplayAffirmEmailValidation(),!1);var a="";return a=2==i.CountryID?"UK":3==i.CountryID?"CA":4==i.CountryID?"AU":"US",{ShopperName:{FirstName:i.FirstName,LastName:i.LastName},ShopperAddress:{City:String.isNullOrUndefineOrBlank(i.City)?"":i.City,Country:a,HouseNumberOrName:String.isNullOrUndefineOrBlank(i.StreetNo)?"":i.StreetNo,PostalCode:String.isNullOrUndefineOrBlank(i.Zip)?"":i.Zip,StateOrProvince:String.isNullOrUndefineOrBlank(i.StateCode)?"":i.StateCode,Street:String.isNullOrUndefineOrBlank(i.Street)?"":i.Street},ShopperEmail:String.isNullOrUndefineOrBlank(i.EmailId)?e("#txtAffirmEmailId").data("EmailId"):i.EmailId,ShopperPhoneNumber:String.isNullOrUndefineOrBlank(i.Cell)?"":i.Cell}},_onlineCheckout.DisplayVPLCetegeyOrAffirm=function(t){1==_siteBuilderDetail.isAffirmEnable?1==t&&(e("#tabVagaroPayLaterCertegy").hide(),e("#tabVagaroPayLaterAffirm").show()):1==t&&(e("#tabVagaroPayLaterCertegy").show(),e("#tabVagaroPayLaterAffirm").hide())},_onlineCheckout.VPLCheckoutValidation=function(){if(null!=typeof _onlineCheckout.VPLUserBankDetails||null!=_onlineCheckout.VPLUserBankDetails.length){if(0==_siteBuilderDetail.isAffirmEnable&&(null==typeof e('input[type="radio"][name="vpl-bank"]:checked').val()||null==e('input[type="radio"][name="vpl-bank"]:checked').val()))return vagaro.alert("Please add bank account to pay with Vagaro Pay Later."),void ShowLoader(!1);_onlineCheckout.VplSelectedBank={},SelectedBank=e.grep(_onlineCheckout.VPLUserBankDetails,function(t){return t.Id==e('input[type="radio"][name="vpl-bank"]:checked').val()}),_onlineCheckout.VplSelectedBank=SelectedBank,NewUser=e.grep(onlineShoppingCartmain.UsersPoints,function(e){return e.userId==UserID}),null!=e("#divServicesTotalPrice")[0]&&null!=e("#divServicesTotalPrice")[0]&&(FinalCCAmount=e("#divServicesTotalPrice")[0].innerHTML.replace("$","")),e("#divVplCheckoutScreen").show(),e(".mulvplbook").hide(),e("#divVplTracking").hide(),e("#subtotalCheckoutScreen").text("Subtotal: "+currencySymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)),ShowLoader(!1)}else vagaro.alert("Add bank for vagaro pay later.")},_onlineCheckout.SavecheckoutVPL=function(e){onlineShoppingCart.ccAmt=0,_onlineCheckout.VPLCheckoutData.vplAmt=_onlineCheckout.ConvertDecimalWithFixed(onlineShoppingCart.FinalCCAmount,!1,2),_onlineCheckout.VPLCheckoutData.businessID=businessID,_onlineCheckout.VPLCheckoutData.loggedInUserId=_onlineCheckout.VplSelectedBank[0].UserID,_onlineCheckout.VPLCheckoutData.BankAccountId=_onlineCheckout.VplSelectedBank[0].BankId,_onlineCheckout.VPLCheckoutData.AccountNumber=_onlineCheckout.VplSelectedBank[0].AccountNumber,_onlineCheckout.VPLCheckoutData.VplBankMasterId=_onlineCheckout.VplSelectedBank[0].Id,_onlineCheckout.VPLCheckoutData.ConsumerId=_onlineCheckout.VplSelectedBank[0].CertegyConsumerTokenID,_onlineCheckout.VPLCheckoutData.TransactionIntentId=e.intentId,_onlineCheckout.SaveOnlineCheckout()},_onlineCheckout.AddEventLogInFirebaseForClass=function(){try{e.grep(onlineShoppingCart.Events,function(t){var i=[],a=[];e.grep(t.eventEnrollment,function(r){if(0==r.IsWorkShop&&-1==i.indexOf(r.appointmentID)||-1==(r.IsWorkShop&&a.indexOf(r.customerID))){i.push(r.appointmentID),r.IsWorkShop&&a.push(r.customerID);var o="",n=e("#ancBuyNow").text();console.log(n);var s="";s=0==(o="Request"!=n)?"Request":"Book";var l={};l.Category="Request"==s?"Book_Class_Request":"Book_Class_Confirmation_Page",l.Action=s+" Class",l.PageName=s;var d=0;d=null!=e("#hdnSiteBuilderBusinessID")&&null!=e("#hdnSiteBuilderBusinessID").val()?parseInt(e("#hdnSiteBuilderBusinessID").val()):businessID,l.BusinessID=d,l.BusinessName=_shopdetail.businessName,l.EmpName=t.eventEnrollment[0].sPName,formattedDate=new Date(t.eventEnrollment[0].eventDate),l.ClassDate=formattedDate.toISOString().split("T")[0],l.ClassTime=t.eventEnrollment[0].startTime,l.ClassName=t.eventName,l.ClassPrice=currencysymbol+t.eventEnrollment[0].price.format("#.##"),l.isAppointmentBooked=o,_vgLogEvent.LogEventData(l)}})})}catch(e){}},_onlineCheckout.ValidateErrorMessage=function(t,a){e(".checkoutvalerror").remove();var r=[],o=[],n=!0;if(!String.isNullOrUndefineOrBlank(t)&&!_onlineCheckout.isValidForCheckoutInvoice()){if(String.isNullOrUndefineOrBlank(t.Inventories)||e.each(t.Inventories,function(t,i){!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,a){(1!=a.IsWarning||i.Quantity>i.TotalQty)&&(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId.toString()+'"]').find("div.div-block-42").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+a.Message+"</div>"),n=!1),r.push(a)})}),!String.isNullOrUndefineOrBlank(t.Memberships)){_onlineCheckout.IsAnyDailyDealInCart(t);e.each(t.Memberships,function(i,o){var s=_onlineCheckout.IsItemFmbEligible(o.PromotionID,t),l=Math.max(0,(Number(o.Price)||0)-(Number(o.productDisc)||0)),d=_onlineCheckout.GetEffectiveIsForNewCustomer();s&&!0===d?(o.dailydealFee=l*dailyDealFeeValue/100,o.FMBPercentage=dailyDealFeeValue):s&&!1===d?(o.dailydealFee=l*dailyDealFeeValue_ExistingUser/100,o.FMBPercentage=dailyDealFeeValue_ExistingUser):(o.dailydealFee=0,o.FMBPercentage=0),!String.isNullOrUndefineOrBlank(o.errors)&&o.errors.length>0&&e.each(o.errors,function(t,i){e('div [data-type="membership"][data-rid="'+o.MembershipId.toString()+'"]').find("div.div-block-47 > div").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+i.Message+"</div>"),(1!=i.IsWarning||1==a)&&(n=!1),r.push(i)})})}if(!String.isNullOrUndefineOrBlank(t.Packages)){_onlineCheckout.IsAnyDailyDealInCart(t);e.each(t.Packages,function(i,o){var s=_onlineCheckout.IsItemFmbEligible(o.PromotionID,t),l=Math.max(0,(Number(o.TotalPrice)||0)-(Number(o.discount)||0)),d=_onlineCheckout.GetEffectiveIsForNewCustomer();s&&!0===d?(o.dailydealFee=l*dailyDealFeeValue/100,o.FMBPercentage=dailyDealFeeValue):s&&!1===d?(o.dailydealFee=l*dailyDealFeeValue_ExistingUser/100,o.FMBPercentage=dailyDealFeeValue_ExistingUser):(o.dailydealFee=0,o.FMBPercentage=0),!String.isNullOrUndefineOrBlank(o.errors)&&o.errors.length>0&&e.each(o.errors,function(t,i){e('div [data-type="servicepackage"][data-rid="'+o.ServiceId+'"]').find(".div-block-42").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+i.Message+"</div>"),1==i.IsWarning&&1!=a||(n=!1),r.push(i)})})}String.isNullOrUndefineOrBlank(t.GiftCertificates)||e.each(t.GiftCertificates,function(t,i){i.dailydealFee=0,!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,o){e('div [data-type="gc"][data-rid="'+i.GiftCertificatePhotoID.toString()+'"][data-autoid="'+i.autoId+'"]').find(".div-block-42").append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+o.Message+"</div>"),1==o.IsWarning&&1!=a||(n=!1),r.push(o)})}),String.isNullOrUndefineOrBlank(t.Events)||e.each(t.Events,function(t,i){!String.isNullOrUndefineOrBlank(i.eventEnrollment)&&i.eventEnrollment.length>0&&e.each(i.eventEnrollment,function(t,i){!String.isNullOrUndefineOrBlank(i.errors)&&i.errors.length>0&&e.each(i.errors,function(t,s){e('div [data-type="classes"][data-rid="'+i.eventID.toString()+'"][data-autoid="'+i.autoID.toString()+'"] > div').append('<div class="checkoutvalerror web-caption-text-error" style="color: red;font-size: 12px;padding-top: 10px;">'+s.Message+"</div>"),1==s.IsWarning&&1!=a||(n=!1),r.push(s),s.Message.indexOf("This business does not allow you to book more than")>-1&&o.push(s)})})})}if(onlineShoppingCartmain.IsValidCartData=n,r.length>0&&(0==n||1==a)){var s="";if(1==r.length)e.each(r,function(e,t){s=t.Message});else{for(i=0;i<r.length;i++)r[i].Message.indexOf("This business does not allow you to book more than")>-1&&(r.splice(i,1),i--);o.length>0&&r.push(o[0]),1==r.length?e.each(r,function(e,t){s=t.Message}):(s="<ul>",e.each(r,function(e,t){s=s+'<li style="text-align: left;">'+t.Message+"</li>"}))}return swal({html:!0,title:s,text:"",type:"",showCancelButton:!1,confirmButtonText:"OK",cancelButtonText:"No",closeOnCancel:!0},function(e){1==a&&(_onlineCheckout.checkoutGotoNextStep(!0),_onlineCheckout.loadPage())}),setTimeout(function(){e(".gencutom-title").html("Booking Unavailable")},100),!1}return!0},_onlineCheckout.clickOnPolicy=function(t){1==isCheckInApp&&centerModal("#AppcheckoutModal"),e("#AppcheckoutModal").find("#divpolicyforclass").hide(),e("#AppcheckoutModal").find("#divpolicyforProduct").hide(),_onlineCheckout.isShowClassPolicePopup=!0,_onlineCheckout.isShowProductPolicePopup=!0,_onlineCheckout.isShowServicePolicePopup=!0,e("#mainTCPoliceHeader").html("Terms and Conditions For Classes"),e("#divTCforClassHeader").hide(),e("#divTCforServiceInvoice").hide(),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&(_onlineCheckout.isShowClassPolicePopup=!1,_onlineCheckout.ViewClassCancellationPolicy()),(!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0||!String.isNullOrUndefineOrBlank(onlineShoppingCart.GiftCertificates)&&onlineShoppingCart.GiftCertificates.length>0||!String.isNullOrUndefineOrBlank(onlineShoppingCart.Packages)&&onlineShoppingCart.Packages.length>0||!String.isNullOrUndefineOrBlank(onlineShoppingCart.Memberships)&&onlineShoppingCart.Memberships.length>0)&&(e("#mainTCPoliceHeader").html("Refund Policy"),e("#divTCforClassHeader").show(),e("#divpolicyforclass").addClass("policy-border"),_onlineCheckout.isShowProductPolicePopup=!1,_onlineCheckout.ViewReturnPolicy()),_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&(_onlineCheckout.isShowServicePolicePopup=!1,0==_onlineCheckout.isShowClassPolicePopup&&1==_onlineCheckout.isShowProductPolicePopup&&e("#divpolicyforclass").removeClass("policy-border"),1==_onlineCheckout.isShowClassPolicePopup&&1==_onlineCheckout.isShowProductPolicePopup?(e("#mainTCPoliceHeader").html("Terms and Conditions For Appointments"),e("#divTCforServiceInvoice").hide()):e("#divTCforServiceInvoice").show(),_onlineCheckout.ViewAppointmentCancellationPolicy())},_onlineCheckout.ViewClassCancellationPolicy=function(){ShowLoader(!0);var t=new vagaro.ajax;return t.datamodel.Token=ApiURLEnumOnlineCheckout.getclasscancellationpolicy,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(t){ShowLoader(!1),_onlineCheckout.isShowClassPolicePopup=!0,String.isNullOrUndefineOrBlank(t)?(e("#AppcheckoutModal").find("#divpolicyforclass").show(),e("#AppcheckoutModal").find("#divpolicyforclass .divclasspolicycontent").html(""),e("#AppcheckoutModal").find("#divpolicyforclass .divclasspolicycontent").html("No Class Cancellation Policy")):(e("#AppcheckoutModal").find("#divpolicyforclass").show(),e("#AppcheckoutModal").find("#divpolicyforclass .divclasspolicycontent").html(""),e("#AppcheckoutModal").find("#divpolicyforclass .divclasspolicycontent").html(t)),1==_onlineCheckout.isShowClassPolicePopup&&1==_onlineCheckout.isShowProductPolicePopup&&e("#AppcheckoutModal").modal("show"),e("#mainTCPoliceHeader").focus(),e("#AppcheckoutModal").find(".btn.btn-primary").attr("id","btn_ClosePoPAppCancelPolicy"),e("#btn_ClosePoPAppCancelPolicy").off().on("click",function(){e("#AppcheckoutModal").modal("hide")})},t.datamodel.data={businessID:businessID},t.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},t.Post(),!1},_onlineCheckout.ViewReturnPolicy=function(){ShowLoader(!0);var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumOnlineCheckout.getreturnpolicy,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(t){ShowLoader(!1),_onlineCheckout.isShowProductPolicePopup=!0,String.isNullOrUndefineOrBlank(t)?(e("#AppcheckoutModal").find("#divpolicyforProduct").show(),e("#AppcheckoutModal").find("#divpolicyforProduct .divproductpolicycontent").html(""),e("#AppcheckoutModal").find("#divpolicyforProduct .divproductpolicycontent").html(""),e("#AppcheckoutModal").modal("show")):(e("#AppcheckoutModal").find("#divpolicyforProduct").show(),e("#AppcheckoutModal").find("#divpolicyforProduct .divproductpolicycontent").html(""),e("#AppcheckoutModal").find("#divpolicyforProduct .divproductpolicycontent").html(t)),1==_onlineCheckout.isShowClassPolicePopup&&1==_onlineCheckout.isShowProductPolicePopup&&e("#AppcheckoutModal").modal("show"),e("#mainTCPoliceHeader").focus(),e("#AppcheckoutModal").find(".btn.btn-primary").attr("id","btn_ClosePoPAppCancelPolicy"),e("#btn_ClosePoPAppCancelPolicy").off().on("click",function(){e("#AppcheckoutModal").modal("hide")})},t.datamodel.data={businessID:businessID},t.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},t.Post()},_onlineCheckout.ViewAppointmentCancellationPolicy=function(){ShowLoader(!0);var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumOnlineCheckout.getappointmentcancellationpolicy,t.datamodel.IsNewVagaroAPI=!0;var i={businessID:businessID};t.datamodel.callback=function(t){ShowLoader(!1),_onlineCheckout.isShowServicePolicePopup=!0,String.isNullOrUndefineOrBlank(t)?(e("#AppcheckoutModal").find("#divpolicyforServiceInvoice").show(),e("#AppcheckoutModal").find("#divpolicyforServiceInvoice .divServiceInvoicepolicycontent").html(""),e("#AppcheckoutModal").find("#divpolicyforServiceInvoice .divServiceInvoicepolicycontent").html(""),e("#AppcheckoutModal").modal("show")):(e("#AppcheckoutModal").find("#divpolicyforServiceInvoice").show(),e("#AppcheckoutModal").find("#divpolicyforServiceInvoice .divServiceInvoicepolicycontent").html(""),e("#AppcheckoutModal").find("#divpolicyforServiceInvoice .divServiceInvoicepolicycontent").html(t)),(_onlineCheckout.isShowServicePolicePopup=1==_onlineCheckout.isShowClassPolicePopup&&1==_onlineCheckout.isShowProductPolicePopup)&&e("#AppcheckoutModal").modal("show"),e("#mainTCPoliceHeader").focus(),e("#AppcheckoutModal").find(".btn.btn-primary").attr("id","btn_ClosePoPAppCancelPolicy"),e("#btn_ClosePoPAppCancelPolicy").off().on("click",function(){e("#AppcheckoutModal").modal("hide")})},t.datamodel.data=i,t.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},t.Post()},_onlineCheckout.ChangeBuyBottonText=function(t){var i=!0,a="";if(String.isNullOrUndefineOrBlank(t)||(1!=i||String.isNullOrUndefineOrBlank(t.Inventories)||t.Inventories.length>0&&(i=!1),1!=i||String.isNullOrUndefineOrBlank(t.Memberships)||t.Memberships.length>0&&(i=!1),1!=i||String.isNullOrUndefineOrBlank(t.Packages)||t.Packages.length>0&&(i=!1),1!=i||String.isNullOrUndefineOrBlank(t.GiftCertificates)||t.GiftCertificates.length>0&&(i=!1)),1==_onlineCheckout.IsCalledFromLiveStream()&&(e("#btnBuyNowBack").text("Back"),e("#mobileCart").hide()),_onlineCheckout.isValidForCheckoutInvoice())e("#ancBuyNow").text("Pay Invoice"),e("#btnBuyNowBack").hide();else if(1==i){if(void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsConfimationReq){if(t.Events.length>0){for(var r="Book",o=0;o<t.Events.length;o++)if("Request"==t.Events[o].ClassBookText){r="Request";break}e("#ancBuyNow").text(r),a=r}}else e("#ancBuyNow").text(checkoutClassBookText),a=checkoutClassBookText;void 0!==a&&null!=a&&"Book"==a?e("#lblreturnpolicy span").contents().first().replaceWith('By clicking "Book" I agree to '):e("#lblreturnpolicy span").contents().first().replaceWith('By clicking "Request" I agree to ')}else e("#ancBuyNow").text("Buy Now"),1==i&&"true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)&&e("#ancBuyNow").text(checkoutClassBookText)},_onlineCheckout.hasPromotionApplied=function(e){function t(e,t,i){if(!e||0===e.length)return!1;for(var a=0;a<e.length;a++){var r=e[a];if(r.PromotionID&&Number(r.PromotionID)>0)return!0;if(t&&r.eventEnrollment&&r.eventEnrollment.length>0)for(var o=0;o<r.eventEnrollment.length;o++){var n=r.eventEnrollment[o];if(n.PromotionID&&Number(n.PromotionID)>0)return!0;if(i&&n.lstAddonService&&n.lstAddonService.length>0)for(var s=0;s<n.lstAddonService.length;s++)if(n.lstAddonService[s].PromotionID&&Number(n.lstAddonService[s].PromotionID)>0)return!0}}return!1}return t(e.Events,!0,!0)||t(e.Packages,!1,!1)||t(e.Memberships,!1,!1)||t(e.GiftCertificates,!1,!1)},_onlineCheckout.IsClassBookingOnly=function(t){if(isPromotionApplied=_onlineCheckout.hasPromotionApplied(onlineShoppingCart),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.IsMemPkgReqToBook){var i=0,a=0;String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Memberships)||(i=e.grep(onlineShoppingCartmain.Memberships,function(e){return 1==e.IsFromClass}).length),String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Packages)||(a=e.grep(onlineShoppingCartmain.Packages,function(e){return 1==e.IsFromClass}).length),(i>0||a>0)&&(e("#divSuggestUpsell").css("display","none"),e("#removeMemLink").css("display","none"),e("#removePackLink").css("display","none"))}var r=!0;return String.isNullOrUndefineOrBlank(onlineShoppingCartmain)||(1!=r||String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Inventories)?1!=r||String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Memberships)?1!=r||String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Packages)?1!=r||String.isNullOrUndefineOrBlank(onlineShoppingCartmain.GiftCertificates)||onlineShoppingCartmain.GiftCertificates.length>0&&(r=!1):onlineShoppingCartmain.Packages.length>0&&(r=!1):onlineShoppingCartmain.Memberships.length>0&&(r=!1):onlineShoppingCartmain.Inventories.length>0&&(r=!1)),t?r:(e("#btnContShoppingCheckout").text("Proceed to Checkout"),1==r&&0==_onlineCheckout.IsCCDetailEnable()?("true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)&&("false"==IsClassReschedule.toLowerCase()||"true"==IsClassReschedule.toLowerCase()&&(void 0===IsPaid||"false"==IsPaid.toString().toLowerCase()))||void 0!==_onlineCheckout.IsMemPackageUpSell&&1==_onlineCheckout.IsMemPackageUpSell?(e("#btnContShoppingCheckoutForClass").hide(),e("#btnContShoppingCheckout").show(),e("#btnContShoppingCheckout").text("Continue")):(1==_onlineCheckout.CheckLiveStreamClass()?e("#btnContShoppingCheckoutForClass").text("Continue"):e("#btnContShoppingCheckoutForClass").text(checkoutClassBookText),e("#btnContShoppingCheckoutForClass").show(),e("#btnContShoppingCheckout").hide(),isPromotionApplied&&(e("#btnContShoppingCheckoutForClass").hide(),e("#btnContShoppingCheckout").show())),_onlineCheckout.isClassCheckout=r,!0):(1==r&&e("#btnContShoppingCheckout").text("Continue"),e("#btnContShoppingCheckoutForClass").hide(),e("#btnContShoppingCheckout").show(),_onlineCheckout.isClassCheckout=r,!1))},_onlineCheckout.CheckLiveStreamClass=function(){var t=!1;return 0==String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events)&&onlineShoppingCartmain.Events.length>0&&e.each(onlineShoppingCartmain.Events,function(i,a){!String.isNullOrUndefineOrBlank(a.eventEnrollment)&&a.eventEnrollment.length>0&&e.each(a.eventEnrollment,function(e,i){String.isNullOrUndefineOrBlank(i.StreamingStatus)||1!=i.StreamingStatus||(t=!0)})}),t},_onlineCheckout.ClassCheckout=function(t){if(1!=t&&(_onlineCheckout.ValidateErrorMessage(onlineShoppingCartmain),0==onlineShoppingCartmain.IsValidCartData))return!1;if(e("#hdnIsFromPage").length>0&&e("#hdnIsFromPage").val(""),1!=t){var i=!(!String.isNullOrUndefineOrBlank(getCookie("loginTypeValue"))&&8==getCookie("loginTypeValue"));_onlineCheckout.isConsiderForms=i,_onlineCheckout.getUserGCDetail(!0)}},_onlineCheckout.DirectClassCheckout=function(){onlineShoppingCart=e.extend(!0,{},onlineShoppingCartmain),onlineShoppingCart.FinalCCAmount=0,onlineShoppingCart.ccAmt=0,onlineShoppingCart.amtPaid=0,onlineShoppingCart.tax=0,onlineShoppingCart.Rtax=0,onlineShoppingCart.taxdifference=0,onlineShoppingCart.gcAmt=0,onlineShoppingCart.RedeemedByGCtemp=[],onlineShoppingCart.RedeemedByGC=[],onlineShoppingCart.shippingSurcharge=0,onlineShoppingCart.classSubTotal=0,onlineShoppingCart.classTax=0,onlineShoppingCart.classGCUsed=0,onlineShoppingCart.classPackageUsed=0,onlineShoppingCart.classFinalTotal=0,_onlineCheckout.ShoppingCartStep=1,onlineShoppingCart.PartialPrice=0,e.grep(onlineShoppingCart.UsersPoints,function(e){e.userId==onlineShoppingCart.loginUserId&&e.userId>0&&(onlineShoppingCart.loginUserEmail=e.emailId)}),null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(_onlineCheckout.ValidateOnePerUserDealForDirectClassCheckout(),onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events),_onlineCheckout.ValidateCartData())},_onlineCheckout.IsAnyDailyDealInCart=function(e){if(!_shopdetail.EnableFMBFee())return!1;if(e=e||onlineShoppingCart,String.isNullOrUndefineOrBlank(e))return!1;if("function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()){var t=!1;return!("function"!=typeof _shopdetail.IsEligibleFMBForUK||!_shopdetail.IsEligibleFMBForUK())&&(t=!0,(void 0===ischkFirstTimeCustomerCart||!1!==ischkFirstTimeCustomerCart||1!=t||0!=_onlineCheckout.isDailyDealExistsInItems(e))&&t)}return _onlineCheckout.isDailyDealExistsInItems(e)},_onlineCheckout.IsValidateForPromoCode=function(e){return!!_shopdetail.EnableFMBFee()&&(e=e||onlineShoppingCart,!String.isNullOrUndefineOrBlank(e)&&_onlineCheckout.isDailyDealExistsInItems(e))},_onlineCheckout.IsItemFmbEligible=function(e,t){return void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()?_onlineCheckout.IsAnyDailyDealInCart(t):_shopdetail.EnableFMBFee()&&Number(e||0)>0||_onlineCheckout.IsAnyDailyDealInCart(t)},_onlineCheckout.isDailyDealExistsInItems=function(t){var i=function(e){return null!=e&&null!=e.PromotionID&&Number(e.PromotionID)>0};if(t.Events&&t.Events.length>0){var a=!1;if(e.each(t.Events,function(t,r){if(r.eventEnrollment&&r.eventEnrollment.length>0&&e.each(r.eventEnrollment,function(t,r){return i(r)?(a=!0,!1):(r.lstAddonService&&r.lstAddonService.length>0&&e.each(r.lstAddonService,function(e,t){if(i(t))return a=!0,!1}),!a&&void 0)}),a)return!1}),a)return!0}if(t.Packages&&t.Packages.length>0){var r=!1;if(e.each(t.Packages,function(e,t){if(i(t))return r=!0,!1}),r)return!0}if(t.Memberships&&t.Memberships.length>0){var o=!1;if(e.each(t.Memberships,function(e,t){if(i(t))return o=!0,!1}),o)return!0}return!1},_onlineCheckout.GetFMBFeeTypeCart=function(e){e=e||("undefined"!=typeof onlineShoppingCart?onlineShoppingCart:null);var t=void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness,i=!1;try{e&&"function"==typeof _onlineCheckout.isDailyDealExistsInItems&&(i=!0===_onlineCheckout.isDailyDealExistsInItems(e))}catch(e){i=!1}return t&&!i?1:!t&&i?2:t&&i?3:0},_onlineCheckout.GetEffectiveIsForNewCustomer=function(){return void 0!==IsSameDayCustomer&&!0===IsSameDayCustomer||(void 0===ischkFirstTimeCustomerCart||null==ischkFirstTimeCustomerCart||!0!==ischkFirstTimeCustomerCart&&!1!==ischkFirstTimeCustomerCart?"undefined"!=typeof IsForNewCustomer&&null!=IsForNewCustomer&&IsForNewCustomer||void 0!==IsForVeraNewCustomer&&!0===IsForVeraNewCustomer:ischkFirstTimeCustomerCart)},_onlineCheckout.GetDealBookingType=function(e,t){try{if(Number(t||0)>0&&Number(e||0)>0){var i="";try{i="function"==typeof getCookie&&getCookie("VeraSourceType")||""}catch(e){i=""}if("vera-push"==(i=i.toString().toLowerCase()))return 2;if("vera-email"==i)return 1}}catch(e){}return 0},_onlineCheckout.RecomputeDailyDealFeeOnRemaining=function(t,i,a){if(_shopdetail.EnableFMBFee()){var r=_onlineCheckout.GetEffectiveIsForNewCustomer(),o=Number(!0===r?dailyDealFeeValue||0:dailyDealFeeValue_ExistingUser||0),n=_onlineCheckout.IsAnyDailyDealInCart(),s=function(e,t,i){return function(e){return e&&(!0===e.isPackage||!0===e.isPackageApplied)}(e)?0:Number(null!=t&&""!==t?t:i)||0},l=!(void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()),d=function(e,t,i){(l&&null!=t&&Number(t)>0||n)&&o>0&&i>0?(e.dailydealFee=i*o/100,e.FMBPercentage=o):(e.dailydealFee=0,e.FMBPercentage=0)};String.isNullOrUndefineOrBlank(t)||e.each(t,function(t,i){if(!i||String.isNullOrUndefineOrBlank(i.eventEnrollment))return!0;e.each(i.eventEnrollment,function(t,i){if(!i)return!0;d(i,i.PromotionID,s(i,i.price,i.actualPrice)),String.isNullOrUndefineOrBlank(i.lstAddonService)||e.each(i.lstAddonService,function(e,t){if(!t)return!0;d(t,t.PromotionID,s(t,t.Price,t.Originalprice))})})}),String.isNullOrUndefineOrBlank(i)||e.each(i,function(e,t){if(!t)return!0;d(t,t.PromotionID,s(t,t.ActualPrice,t.Price))}),String.isNullOrUndefineOrBlank(a)||e.each(a,function(e,t){if(!t)return!0;d(t,t.PromotionID,s(t,t.ActualPrice,t.Price))})}},_onlineCheckout.BindFirstTimeCustomerCheckbox=function(){var t=e("#dvFirstTimeCustomerCart");if(0!==t.length){var i=getQueryStringData("Type");"OnBoarding"!=i&&"ImportOnBoarding"!=i&&_shopdetail.EnableFMBFee()&&_onlineCheckout.EnableFirstTimeCustomerToggle()?(t.show(),_onlineCheckout.RefreshFirstTimeCustomerSelectionUI()):t.hide()}},_onlineCheckout.RefreshFirstTimeCustomerSelectionUI=function(){var t=ischkFirstTimeCustomerCart;e("#tabFirstTimeYesCart").toggleClass("w--current",!0===t).attr("aria-checked",!0===t?"true":"false"),e("#tabFirstTimeNoCart").toggleClass("w--current",!1===t).attr("aria-checked",!1===t?"true":"false"),!0!==t&&!1!==t||e("#dvFirstTimeCustomerCartError").hide()},_onlineCheckout.SelectFirstTimeCustomerCart=function(e){var t=_onlineCheckout.IsAnyDailyDealInCart(onlineShoppingCartmain);ischkFirstTimeCustomerCart=!0===e,_onlineCheckout.RefreshFirstTimeCustomerSelectionUI(),(t||_onlineCheckout.IsAnyDailyDealInCart(onlineShoppingCartmain))&&(_onlineCheckout._fmbTipRestore="undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&onlineShoppingCart.tipValue>0?{tipValue:onlineShoppingCart.tipValue,tipPercent:onlineShoppingCart.tipPercent}:null,_onlineCheckout.ValidateErrorMessage(onlineShoppingCartmain),_onlineCheckout.getUserGCDetail())},_onlineCheckout.ValidateFirstTimeCustomerSelectionCart=function(){if(e("#dvFirstTimeCustomerCart").is(":visible")&&(void 0===ischkFirstTimeCustomerCart||null==ischkFirstTimeCustomerCart)){e("#dvFirstTimeCustomerCartError").show();try{e("html, body").animate({scrollTop:e("#dvFirstTimeCustomerCart").offset().top-120},300),e("#tabFirstTimeYesCart").focus()}catch(e){}return swal({title:"",text:"Is this your first visit at this business?",showCancelButton:!0,confirmButtonText:"Yes, this is my first visit.",cancelButtonText:"No, I've visited before.",customClass:"sweet-alert-model sweetalert-width"},function(t){t?e("#tabFirstTimeYesCart").click():e("#tabFirstTimeNoCart").click()}),e(".gencustom-close").attr("style","display:none !important"),!1}return!0},_onlineCheckout.GetFirstVisitFlagCart=function(){return void 0!==IsSameDayCustomer&&!0===IsSameDayCustomer?1:!0!==e("#dvFirstTimeCustomerCart").is(":visible")?0:!0===ischkFirstTimeCustomerCart?1:!1===ischkFirstTimeCustomerCart?2:0},_onlineCheckout.EnableFirstTimeCustomerToggle=function(){return("undefined"!=typeof IsForNewCustomer&&!0===IsForNewCustomer||void 0!==IsForVeraNewCustomer&&!0===IsForVeraNewCustomer)&&((void 0===IsSameDayCustomer||!0!==IsSameDayCustomer)&&!_onlineCheckout.isValidForCheckoutInvoice())},_onlineCheckout.AmplitudeStep={OnlineCheckoutPageVisited:121,OnlineCheckoutCompleted:122},_onlineCheckout.FormatFmbAmount=function(e,t){try{if(null==e||""===String(e))return"";var i="undefined"!=typeof currencysymbol&&currencysymbol?currencysymbol:"$";return!0===t||1===Number(t)?i+e:e+"%"}catch(e){return""}},_onlineCheckout.GetPrimaryCheckoutItem=function(e){var t={name:"",date:"",time:"",type:"",providerName:"",providerId:"",dealAmount:"",depositAmount:"",isDepositRequired:!1};try{if(null==e)return t;if(e.ServiceInvoice&&e.ServiceInvoice.length>0){var i=e.ServiceInvoice[0];return t.name=i.servicename||"",t.type="Service",t.date=i.appointmentDate||"",t.time=i.appointmentTime||i.startTime||"",t.providerName=i.serviceProviderName||"",t.providerId=null!=i.serviceProviderID?String(i.serviceProviderID):"",t.dealAmount=null!=i.dailydealFee?String(i.dailydealFee):"",t.depositAmount=null!=i.deposit?String(i.deposit):"",t.isDepositRequired=Number(i.depositsPercentage)>0||Number(i.deposit)>0,t}if(e.Events&&e.Events.length>0){var a=e.Events[0];t.name=a.eventName||"",t.type="Class";var r=a.eventEnrollment&&a.eventEnrollment.length>0?a.eventEnrollment[0]:null;return r&&(t.date=r.eventDate||"",t.time=r.startTime||"",t.providerName=r.sPName||"",t.providerId=null!=r.sPID?String(r.sPID):"",t.dealAmount=null!=r.dailydealFee?String(r.dailydealFee):"",t.depositAmount=null!=r.deposit?String(r.deposit):"",t.isDepositRequired=Number(r.deposit)>0),t}if(e.Packages&&e.Packages.length>0){var o=e.Packages[0];return t.name=o.servicename||"",t.type="Package",t.dealAmount=null!=o.dailydealFee?String(o.dailydealFee):"",t}if(e.Memberships&&e.Memberships.length>0)return t.name=e.Memberships[0].membershipName||e.Memberships[0].servicename||"",t.type="Membership",t;if(e.Inventories&&e.Inventories.length>0)return t.name=e.Inventories[0].productName||e.Inventories[0].itemName||"",t.type="Product",t}catch(e){}return t},_onlineCheckout.AmplitudeMultiSep="|~|",_onlineCheckout.FormatItemDealFee=function(e){try{var t=Number(e);return isNaN(t)||t<=0?"$0.00":"$"+t.toFixed(2)}catch(e){return"$0.00"}},_onlineCheckout.GetCheckoutItemsAggregate=function(e){var t=_onlineCheckout.AmplitudeMultiSep,i={name:"",date:"",time:"",type:"",providerName:"",providerId:"",dealAmount:"",depositAmount:"",isDepositRequired:!1,dealComputed:!1};try{if(null==e)return i;var a,r=[],o=[],n=[],s=[],l=[],d=[],c=[],u=[],p=!1,h=!1,m=function(e){null!=e&&(h=!0);var t=null!=e?Number(e):0;return _onlineCheckout.FormatItemDealFee(isNaN(t)?0:t)},f=function(e){return e&&(e.ServiceTitle||e.ServiceName||e.servicename)||""};if(e.ServiceInvoice&&e.ServiceInvoice.length>0){var g=[],v={},A=[];for(a=0;a<e.ServiceInvoice.length;a++){var C=e.ServiceInvoice[a];if(C)if(19===Number(C.recordType)){var y=null!=C.parentAppointmentID?String(C.parentAppointmentID):null;null!=y?(v[y]=v[y]||[]).push(C):A.push(C)}else g.push(C)}var b=function(e,t){var i=t||{};r.push(e.servicename||f(e)),s.push("Add-on"),o.push(e.appointmentDate||i.appointmentDate||""),n.push(e.appointmentTime||e.startTime||i.appointmentTime||i.startTime||""),l.push(e.serviceProviderName||i.serviceProviderName||""),d.push(null!=e.serviceProviderID?String(e.serviceProviderID):null!=i.serviceProviderID?String(i.serviceProviderID):""),c.push(m(null!=e.dailydealFee?e.dailydealFee:null)),u.push(null!=e.deposit?String(e.deposit):""),(Number(e.depositsPercentage)>0||Number(e.deposit)>0)&&(p=!0)};for(a=0;a<g.length;a++){var S=g[a];r.push(S.servicename||""),s.push("Service"),o.push(S.appointmentDate||""),n.push(S.appointmentTime||S.startTime||""),l.push(S.serviceProviderName||""),d.push(null!=S.serviceProviderID?String(S.serviceProviderID):""),c.push(m(null!=S.dailydealFee?S.dailydealFee:null)),u.push(null!=S.deposit?String(S.deposit):""),(Number(S.depositsPercentage)>0||Number(S.deposit)>0)&&(p=!0);var k=null!=S.appointmentID?String(S.appointmentID):null;if(null!=k&&v[k]){for(var D=0;D<v[k].length;D++)b(v[k][D],S);delete v[k]}}for(var _ in v)if(v.hasOwnProperty(_))for(var I=0;I<v[_].length;I++)b(v[_][I],null);for(var w=0;w<A.length;w++)b(A[w],null)}else if(e.Events&&e.Events.length>0)for(a=0;a<e.Events.length;a++)for(var P=e.Events[a],T=P.eventEnrollment&&P.eventEnrollment.length>0?P.eventEnrollment:[null],B=0;B<T.length;B++){var x=T[B];r.push(P.eventName||""),s.push("Class"),o.push(x&&x.eventDate||""),n.push(x&&x.startTime||""),l.push(x&&x.sPName||""),d.push(x&&null!=x.sPID?String(x.sPID):""),c.push(m(x&&null!=x.dailydealFee?x.dailydealFee:null)),u.push(x&&null!=x.deposit?String(x.deposit):""),x&&Number(x.deposit)>0&&(p=!0);for(var F=x&&x.lstAddonService&&x.lstAddonService.length?x.lstAddonService:[],O=0;O<F.length;O++){var M=F[O];r.push(f(M)),s.push("Add-on"),o.push(x&&x.eventDate||""),n.push(x&&x.startTime||""),l.push(x&&x.sPName||""),d.push(x&&null!=x.sPID?String(x.sPID):""),c.push(m(M&&null!=M.dailydealFee?M.dailydealFee:null)),u.push("")}}else if(e.Packages&&e.Packages.length>0)for(a=0;a<e.Packages.length;a++){var E=e.Packages[a];r.push(E.servicename||""),s.push("Package"),o.push(""),n.push(""),l.push(""),d.push(""),c.push(m(null!=E.dailydealFee?E.dailydealFee:null)),u.push("");for(var $=E.lstAddonService&&E.lstAddonService.length?E.lstAddonService:[],N=0;N<$.length;N++){var L=$[N];r.push(f(L)),s.push("Add-on"),o.push(""),n.push(""),l.push(""),d.push(""),c.push(m(L&&null!=L.dailydealFee?L.dailydealFee:null)),u.push("")}}else if(e.Memberships&&e.Memberships.length>0)for(a=0;a<e.Memberships.length;a++){var U=e.Memberships[a];r.push(U.membershipName||U.servicename||""),s.push("Membership"),o.push(""),n.push(""),l.push(""),d.push(""),c.push(m(null!=U.dailydealFee?U.dailydealFee:null)),u.push("")}else if(e.Inventories&&e.Inventories.length>0)for(a=0;a<e.Inventories.length;a++){var R=e.Inventories[a];r.push(R.productName||R.itemName||""),s.push("Product"),o.push(""),n.push(""),l.push(""),d.push(""),c.push(m(null!=R.dailydealFee?R.dailydealFee:null)),u.push("")}i.name=r.join(t),i.date=o.join(t),i.time=n.join(t),i.type=s.join(t),i.providerName=l.join(t),i.providerId=d.join(t),i.dealAmount=c.join(t),i.depositAmount=u.join(t),i.isDepositRequired=p,i.dealComputed=h}catch(e){}return i},_onlineCheckout.GetVagaroProVersion=function(){try{var e=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"";if(e.indexOf("com.vagaro")>-1)return e.indexOf("androidpro")>-1?"Android Pro App":e.indexOf("iospro")>-1?"iPhone Pro App":e.indexOf("android")>-1?"Android App":e.indexOf("iphone")>-1||e.indexOf("ipad")>-1?"iPhone App":"Vagaro App";var t=_onlineCheckout.GetBrowserNameAndVersion(e),i=t?" - "+t:"";return e.indexOf("android")>-1?"Android Web Browser"+i:e.indexOf("iphone")>-1||e.indexOf("ipad")>-1?"iPhone Web Browser"+i:"Desktop Web Browser"+i}catch(e){return"Desktop Web Browser"}},_onlineCheckout.GetBrowserNameAndVersion=function(e){try{return e?e.indexOf("edg/")>-1?(t=e.match(/edg\/([0-9]+)/))?"Edge "+t[1]:"Edge":e.indexOf("opr/")>-1||e.indexOf("opera")>-1?(t=e.match(/(?:opr|opera)\/([0-9]+)/))?"Opera "+t[1]:"Opera":e.indexOf("chrome/")>-1?(t=e.match(/chrome\/([0-9]+)/))?"Chrome "+t[1]:"Chrome":e.indexOf("firefox/")>-1?(t=e.match(/firefox\/([0-9]+)/))?"Firefox "+t[1]:"Firefox":e.indexOf("safari")>-1&&e.indexOf("version/")>-1?(t=e.match(/version\/([0-9]+)/))?"Safari "+t[1]:"Safari":"":"";var t}catch(e){return""}},_onlineCheckout.GetAmplitudeDeviceId=function(){try{if("undefined"!=typeof amplitude&&amplitude&&amplitude.getInstance){var e=amplitude.getInstance().getDeviceId();if(!String.isNullOrUndefineOrBlank(e))return e}}catch(e){}try{var t="vg_amp_fallback_device_id",i=window.localStorage?window.localStorage.getItem(t):null;return String.isNullOrUndefineOrBlank(i)&&(i="vgfb-"+(new Date).getTime().toString(36)+"-"+Math.random().toString(36).slice(2,12),window.localStorage&&window.localStorage.setItem(t,i)),i}catch(e){return""}},_onlineCheckout.BuildOnlineCheckoutAmplitudeData=function(t){var i={};try{var a="undefined"!=typeof onlineShoppingCartmain&&null!=onlineShoppingCartmain&&(onlineShoppingCartmain.ServiceInvoice||onlineShoppingCartmain.Events||onlineShoppingCartmain.Packages)?onlineShoppingCartmain:"undefined"!=typeof onlineShoppingCart?onlineShoppingCart:null;i.Step=t,i.PageURL=window.location.href,i.UserAgent=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i.AmplitudeDeviceId=_onlineCheckout.GetAmplitudeDeviceId(),i.BusinessID=a&&a.BusinessID?a.BusinessID:e("#hdnBusinessID").val()?e("#hdnBusinessID").val():0,i.UserID=a&&a.loginUserId?a.loginUserId:"undefined"!=typeof UserID?UserID:0,i.BusinessName=void 0!==_shopdetail&&_shopdetail&&_shopdetail.businessName?_shopdetail.businessName:"",i.Email="undefined"!=typeof UserEmail?UserEmail:"";var r=_onlineCheckout.GetCheckoutItemsAggregate(a);i.ServiceName=r.name,i.ServiceDate=r.date,i.ServiceTime=r.time,i.ServiceType=r.type,i.ServiceProviderName=r.providerName,i.ServiceProviderId=r.providerId;var o="undefined"!=typeof onlineShoppingCartmain&&null!=onlineShoppingCartmain?onlineShoppingCartmain:a||{};if(i.DepositAmount=_onlineCheckout.FormatFmbAmount(o.DepositsPer,o.DepositAmtType),t===_onlineCheckout.AmplitudeStep.OnlineCheckoutPageVisited){var n="function"==typeof _onlineCheckout.GetEffectiveIsForNewCustomer&&_onlineCheckout.GetEffectiveIsForNewCustomer(),s=Number(n?dailyDealFeeValue||0:dailyDealFeeValue_ExistingUser||0),l="function"==typeof _onlineCheckout.IsAnyDailyDealInCart&&!!_onlineCheckout.IsAnyDailyDealInCart(a);if(!l&&a&&a.ServiceInvoice&&a.ServiceInvoice.length&&void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.EnableFMBFee&&_shopdetail.EnableFMBFee())for(var d=0;d<a.ServiceInvoice.length;d++){var c=a.ServiceInvoice[d],u=c?null!=c.PromotionID?c.PromotionID:c.PromotionId:null;if(null!=u&&Number(u)>0){l=!0;break}}i.DealAmount=l&&s>0?_onlineCheckout.FormatFmbAmount(s,dailyDealFeeType):""}else i.DealAmount=r.dealComputed?r.dealAmount:void 0!==dailyDealFeeValue&&null!=dailyDealFeeValue&&Number(dailyDealFeeValue)>0?dailyDealFeeValue+"%":"";i.IsDepositRequired=r.isDepositRequired;var p=void 0!==IsFMBEnableForBusiness&&IsFMBEnableForBusiness;i.IsFillMyBooksEnabled=p,i.IsDailyDealEnabled="function"==typeof _onlineCheckout.IsAnyDailyDealInCart&&!!_onlineCheckout.IsAnyDailyDealInCart(a),i.Is_Forms_Enabled="True"==e("#hdnIsFormsEnable").val(),i.IsCreditCardRequired="function"==typeof _onlineCheckout.IsCCDetailEnable&&!!_onlineCheckout.IsCCDetailEnable(),i.IsFirstBusinessVisit="function"==typeof _onlineCheckout.GetFirstVisitFlagCart&&1===_onlineCheckout.GetFirstVisitFlagCart();var h="";try{h="function"==typeof getCookie&&getCookie("VeraSourceType")||""}catch(e){h=""}if(h=h.toString().toLowerCase(),i.IsFromPush="vera-push"==h,i.IsFromEmail="vera-email"==h,i.VagaroProVersion=_onlineCheckout.GetVagaroProVersion(),i.DeviceModel=i.UserAgent,t===_onlineCheckout.AmplitudeStep.OnlineCheckoutCompleted){var m=_onlineCheckout._checkoutAuthResult||{};i.AuthStatus=m.AuthStatus||"",i.TransactionId=m.TransactionId||"",i.AuthFailCode=m.AuthFailCode||"",i.AuthFailReason=m.AuthFailReason||""}}catch(e){}return i},_onlineCheckout.SetCheckoutAuthResult=function(e,t,i,a,r){try{var o="";if("fail"===e){var n=null!=a?String(a):"";o=null!=i&&""!==String(i)?String(i)+"-"+n:n}_onlineCheckout._checkoutAuthResult={AuthStatus:e||"",TransactionId:null!=t?String(t):"",AuthFailCode:o,AuthFailReason:"fail"===e&&null!=r?String(r):""}}catch(e){}},_onlineCheckout.ApplyAuthResultFromResponse=function(e){try{if(null!=e&&null!=e.data){var t=null!=e.data.data&&null!=e.data.data.TransactionId?e.data.data.TransactionId:"";if(1e3==e.data.custom_code)_onlineCheckout.SetCheckoutAuthResult("success",t,null,"","");else{var i=e.data.Message||e.data.subResponseMessage||"Payment authorization failed";_onlineCheckout.SetCheckoutAuthResult("fail",t,e.data.paymentGateway,e.data.subResponseCode,i)}}else _onlineCheckout.SetCheckoutAuthResult("fail","",null,"","Payment authorization failed")}catch(e){}},_onlineCheckout.ExtractTransactionId=function(e){try{if(!e)return"";if(e.data){if(e.data.transactionID)return e.data.transactionID;if(e.data.TransactionId)return e.data.TransactionId;if(e.data.TransactionID)return e.data.TransactionID}return e.transactionID||e.transactionId||e.TransactionId||""}catch(e){return""}},_onlineCheckout.FirstTxnFromDistribution=function(e){try{if(e&&e.length)for(var t=0;t<e.length;t++){var i=e[t];if(i&&(i.transactionID||i.VPLTransactionID))return i.transactionID||i.VPLTransactionID}}catch(e){}return""},_onlineCheckout.AllTxnFromDistribution=function(e){try{if(e&&e.length){for(var t=[],i=0;i<e.length;i++){var a=e[i],r=a?a.transactionID||a.VPLTransactionID:"";r&&-1===t.indexOf(String(r))&&t.push(String(r))}if(t.length)return t.join(_onlineCheckout.AmplitudeMultiSep)}}catch(e){}return""},_onlineCheckout.CaptureCheckoutAuthResult=function(e){try{if(null==e)return void _onlineCheckout.SetCheckoutAuthResult("fail","",null,"","No checkout response");if(null!=e.classCheckoutResponse&&e.classCheckoutResponse.length>0){var t=e.classCheckoutResponse[0],i=t?t.response:null;if(t&&4==t.type){var a=_onlineCheckout.ExtractTransactionId(i);if(!a&&e.checkoutResponse){var r=e.checkoutResponse;a=_onlineCheckout.AllTxnFromDistribution(r.ccDistribution)||_onlineCheckout.ExtractTransactionId(r.gatewayResponse)||r.EventTransactionId||""}_onlineCheckout.SetCheckoutAuthResult("success",a,null,"","")}else if(t&&(5==t.type||6==t.type)){var o=e.checkoutResponse,n=i&&(i.paymentGateway||i.subResponseCode||i.Message)?i:o&&o.gatewayResponse?o.gatewayResponse:null,s=n&&n.Message?n.Message:n&&n.subResponseMessage?n.subResponseMessage:o&&o.resultMessage?o.resultMessage:"Payment failed";_onlineCheckout.SetCheckoutAuthResult("fail","",n?n.paymentGateway:null,n?n.subResponseCode:"",s)}return}var l=e.checkoutResponse;if(null!=l&&void 0!==l.resultType&&null!=l.resultType){var d=l.resultType;if(d===_onlineCheckout.FinalResponseType.Success||d===_onlineCheckout.FinalResponseType.PartialSuccess||d===_onlineCheckout.FinalResponseType.Distrubution){var c=_onlineCheckout.AllTxnFromDistribution(l.ccDistribution)||_onlineCheckout.ExtractTransactionId(l.gatewayResponse)||l.EventTransactionId||"";_onlineCheckout.SetCheckoutAuthResult("success",c,null,"","")}else if(d===_onlineCheckout.FinalResponseType.Fail||d===_onlineCheckout.FinalResponseType.AuthorizationFail){var u=l.gatewayResponse,p=l.resultMessage||(u&&u.Message?u.Message:"Checkout failed");_onlineCheckout.SetCheckoutAuthResult("fail","",u?u.paymentGateway:null,u?u.subResponseCode:"",p)}}}catch(e){}},_onlineCheckout.FireOnlineCheckoutAmplitude=function(e,t){try{var i=t||_onlineCheckout.BuildOnlineCheckoutAmplitudeData(e);i&&(i.Step=e);var a={};if(a.AddLogInAmplitude=i,_shopdetail.AjaxOld("AddLogInAmplitudeV2",a,function(){},function(){}),e==_onlineCheckout.AmplitudeStep.OnlineCheckoutCompleted&&i&&"success"==(i.AuthStatus||"").toString().toLowerCase()&&"function"==typeof clearCookie)try{clearCookie("VeraSourceType")}catch(e){}}catch(e){}},_onlineCheckout.FireOnlineCheckoutPageVisited=function(){try{_onlineCheckout._checkoutAuthResult=null,_onlineCheckout.FireOnlineCheckoutAmplitude(_onlineCheckout.AmplitudeStep.OnlineCheckoutPageVisited)}catch(e){}},_onlineCheckout.FireOnlineCheckoutCompleted=function(){try{_onlineCheckout.FireOnlineCheckoutAmplitude(_onlineCheckout.AmplitudeStep.OnlineCheckoutCompleted)}catch(e){}},_onlineCheckout.getTotalDailyDealFeeOfAllCartItems=function(t){if(_shopdetail.EnableFMBFee())return _onlineCheckout.RecomputeDailyDealFeeOnRemaining(t?t.Events:null,t?t.Packages:null,t?t.Memberships:null),totalDailyDealFeeOfAllCart_PMGCA=0,t.Events&&t.Events.length>0&&e.each(t.Events,function(t,i){i.eventEnrollment&&i.eventEnrollment.length>0&&e.each(i.eventEnrollment,function(t,i){totalDailyDealFeeOfAllCart_PMGCA+=Number(i.dailydealFee||0),i.lstAddonService&&i.lstAddonService.length>0&&e.each(i.lstAddonService,function(e,t){totalDailyDealFeeOfAllCart_PMGCA+=Number(t.dailydealFee||0)})})}),t.Packages&&t.Packages.length>0&&e.each(t.Packages,function(e,t){totalDailyDealFeeOfAllCart_PMGCA+=Number(t.dailydealFee||0)}),t.Memberships&&t.Memberships.length>0&&e.each(t.Memberships,function(e,t){totalDailyDealFeeOfAllCart_PMGCA+=Number(t.dailydealFee||0)}),totalDailyDealFeeOfAllCart_PMGCA},_onlineCheckout.displayFinalCalculatedPrice=function(){if(totalDailyDealFeeOfAllCart_PMGCA=_onlineCheckout.getTotalDailyDealFeeOfAllCartItems(onlineShoppingCart),_onlineCheckout.ChangeBuyBottonText(onlineShoppingCartmain),!String.isNullOrUndefineOrBlank(onlineShoppingCart)){var t=_onlineCheckout.hideShippingMethodsForFlatRateShippingProducts();_onlineCheckout.DisplayBusinessTaxes(),onlineShoppingCart.totalFeeAmount=0,onlineShoppingCart.totalFeeTax=0,onlineShoppingCart.businessFeesFinalTotal=0,String.isNullOrUndefineOrBlank(_onlineCheckout.IsVCFRequire)||1!=_onlineCheckout.IsVCFRequire?_onlineCheckout.ApplyMultipleFeesonAllItems(0):(_onlineCheckout.ApplyMultipleFeesonAllItems(2),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.BusinessFee,null,d.VCFFee),_onlineCheckout.IsVCFRequire=!1),_onlineCheckout.DisplayBusinessFees(),onlineShoppingCart.businessFeesFinalTotal=_onlineCheckout.parseTodecimal(onlineShoppingCart.totalFeeAmount+onlineShoppingCart.totalFeeTax,2),e("#divdepositsdescription").hide(),e("#divCCDescription").hide(),e("#divcartsubtotal").hide(),e("#divfinalTotalPrice").html("");var i=parseFloat(0),a=parseFloat(0);i=parseFloat(onlineShoppingCart.ccAmt);var o=!1,n=onlineShoppingCart.tax,s=onlineShoppingCart.amtPaid-n,l=onlineShoppingCart.gcAmt,c=onlineShoppingCart.classPackageUsed,u=onlineShoppingCart.discount;if(i+=parseFloat(onlineShoppingCart.classFinalTotal),n+=onlineShoppingCart.classTax,s=s+parseFloat(onlineShoppingCart.classSubTotal)-parseFloat(onlineShoppingCart.classdiscount)-parseFloat(onlineShoppingCart.totalFeeAmount),parseFloat(onlineShoppingCart.depositTotal)>0&&(s+=onlineShoppingCart.depositTotal),l+=onlineShoppingCart.classGCUsed,u=_onlineCheckout.parseTodecimal(u+onlineShoppingCart.classdiscount,2),parseFloat(onlineShoppingCart.tipValue)>0&&(i+=parseFloat(onlineShoppingCart.tipValue)),0==onlineShoppingCart.IsPickupInStore){null!=onlineShoppingCart.shippingSurcharge&&null!=onlineShoppingCart.shippingSurcharge&&onlineShoppingCart.shippingSurcharge>0&&(i+=parseFloat(onlineShoppingCart.shippingSurcharge));var p=0;if(1==IsChargeMostExpensive&&t.Inventories.length>0){var h=0,m=0;e.grep(t.Inventories,function(e,t){(e.FlatRateShippingPrice>h||e.FlatRateShippingPrice==h&&e.AdditionShippingPrice>m)&&(h=e.FlatRateShippingPrice,m=e.AdditionShippingPrice,p=e.InventoryId)})}e.grep(t.Inventories,function(e,t){1==IsChargeMostExpensive?e.InventoryId==p?(a+=e.FlatRateShippingPrice,a+=(e.Quantity-1)*e.AdditionShippingPrice):a+=e.Quantity*e.AdditionShippingPrice:(a+=e.FlatRateShippingPrice,e.Quantity>1&&(a+=(e.Quantity-1)*e.AdditionShippingPrice))}),!_onlineCheckout.isValidForCheckoutInvoice()&&a>0&&(i+=a),null!=onlineShoppingCart.SelectedShippingMethod&&null!=onlineShoppingCart.SelectedShippingMethod&&null!=onlineShoppingCart.SelectedShippingMethod.Rate&&null!=onlineShoppingCart.SelectedShippingMethod.Rate&&onlineShoppingCart.SelectedShippingMethod.Rate>0&&(i+=parseFloat(onlineShoppingCart.SelectedShippingMethod.Rate),e.grep(onlineShoppingCart.Inventories,function(t,i){var a=t.InventoryId.toString();t.MasterInventoryId>0&&(a=t.InventoryId.toString()+""+t.MasterInventoryId.toString());var r=e.grep(onlineShoppingCart.shippingOptionsInd,function(e,t){return e.CombineId==a&&e.Code==onlineShoppingCart.SelectedShippingMethod.Code});r.length>0&&(t.shippingAmount=r[0].Rate)}))}if(!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"!=isCCRequiredForOnlineClass.toLowerCase()?(1==_onlineCheckout.IsClassBookingOnly(!0)?e(".divfinalclassamountless").hide():IsDailyDealFeeCCOFF&&totalDailyDealFeeOfAllCart_PMGCA>0||(i-=parseFloat(onlineShoppingCart.classFinalTotal),e("#divfinalclassamountless").html(""),e("#divfinalclassamountless").html("("+currencysymbol+parseFloat(parseFloat(onlineShoppingCart.classFinalTotal)+parseFloat(onlineShoppingCart.FeeDepositsRemaining)).format("#.##")+")"),e(".divfinalclassamountless").show()),o=!0):e(".divfinalclassamountless").hide(),"undefined"!=typeof IsEnableMerchantAccount&&"false"==IsEnableMerchantAccount.toLowerCase()&&1==_onlineCheckout.IsCalledFromLiveStream()&&(e(".divfinalclassamountless").hide(),o=!1),e("#divmobilefinalTotalPrice").html(""),1==_onlineCheckout.IsCalculateAndDisplayFeeOnline(!0)&&(i-=parseFloat(onlineShoppingCart.FeeDepositsRemaining)),e("#divfinalTotalPrice").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i)),_onlineCheckout.isCheckoutVPLPromocode=!0,_onlineCheckout.totalfinalAmount=i,e("#divmobilefinalTotalPrice").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i)),onlineShoppingCart.FinalCCAmount=i,_onlineCheckout.ValidateVPl(!1),_onlineCheckout.VPLmessagedeposit(i),e("#VPLtotaldeposit").show(),e("#vpltotalmessage").hide(),parseFloat(onlineShoppingCart.depositTotal)>0?(e(".divfinalcheckoutdeposit").show(),e("#divFinalCheckoutDeposit").html(""),e("#divFinalCheckoutDeposit").html("("+currencysymbol+onlineShoppingCart.depositTotal.format("#.##")+")"),o=!0):e(".divfinalcheckoutdeposit").hide(),parseFloat(n)>0?(e(".divfinalcheckouttex").hide(),e("#divFinalCheckoutTex").html(""),e("#divFinalCheckoutTex").html(currencysymbol+n.format("#.##")),o=!0):e(".divfinalcheckouttex").hide(),e("#divFinalCheckoutSubtotal").html(""),e("#divFinalCheckoutSubtotal").html(currencysymbol+s.format("#.##")),e("#divFinalCheckoutSubtotalDisplay").hide(),s>0&&e("#divFinalCheckoutSubtotalDisplay").show(),parseFloat(c)>0||_onlineCheckout.isValidForCheckoutInvoice()&&parseFloat(onlineShoppingCart.PackageAmount)>0){var f=c;e(".divfinalcheckoutpkgamount").show(),e("#divFinalCheckoutPkgAmount").html(""),_onlineCheckout.isValidForCheckoutInvoice()&&parseFloat(onlineShoppingCart.PackageAmount)>0&&(f=parseFloat(f)+parseFloat(onlineShoppingCart.PackageAmount)),e("#divFinalCheckoutPkgAmount").html("("+currencysymbol+f.format("#.##")+")"),o=!0}else e(".divfinalcheckoutpkgamount").hide();if(onlineShoppingCart.tipValue>0){var g=_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue,2);e("#divfinalCheckoutTipAmount").html(currencysymbol+g.format("#.##")),o=!0}else if(onlineShoppingCartmain.IsFullDeposit)o=!0,void 0!==onlineShoppingCartmain.TipOption&&null!=onlineShoppingCartmain.TipOption&&""!=onlineShoppingCartmain.TipOption&&"0"!=onlineShoppingCartmain.TipOption&&_onlineCheckout.IsBaseTipAllowedByConfig()&&(e(".divfinalCheckoutTip").show(),_onlineCheckout.ShowTipOptions());else if(void 0!==onlineShoppingCartmain.TipOption&&null!=onlineShoppingCartmain.TipOption&&""!=onlineShoppingCartmain.TipOption&&"0"!=onlineShoppingCartmain.TipOption&&_onlineCheckout.HasConfigTipItemInCart())o=!0,e(".divfinalCheckoutTip").show(),_onlineCheckout.ShowTipOptions();else if(_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(isAllowTipForInvoice)&&"true"==isAllowTipForInvoice.toLowerCase().trim())if(o=!0,null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0||null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){var v=null;null!=onlineShoppingCart.ServiceInvoice&&(v=e.grep(onlineShoppingCart.ServiceInvoice,function(e){return 0==e.isPaid&&e.depositsPercentage>0})),(null==v||null!=v&&0==v.length)&&_onlineCheckout.setTipOption()}else e(".divfinalCheckoutTip").hide();else e(".divfinalCheckoutTip").hide();0!=onlineShoppingCart.IsPickupInStore||String.isNullOrUndefineOrBlank(onlineShoppingCart.SelectedShippingMethod)||String.isNullOrUndefineOrBlank(onlineShoppingCart.SelectedShippingMethod.Rate)&&null==r?e(".divfinalcheckoutshipping").hide():(e(".divfinalcheckoutshipping").show(),e("#divFinalCheckoutShipping").html(""),e("#divFinalCheckoutShipping").html(currencysymbol+onlineShoppingCart.SelectedShippingMethod.Rate.format("#.##")),o=!0),!_onlineCheckout.isValidForCheckoutInvoice()&&a>0?(e(".divfinalflatrateshipping").show(),e("#divFinalFlatRateShipping").html(""),e("#divFinalFlatRateShipping").html(currencysymbol+a.format("#.##")),o=!0):e(".divfinalflatrateshipping").hide(),0!=onlineShoppingCart.IsPickupInStore||String.isNullOrUndefineOrBlank(onlineShoppingCart.shippingSurcharge)?e(".divfinalcheckoutsurcharge").hide():(e(".divfinalcheckoutsurcharge").show(),e("#divFinalCheckoutsurcharge").html(""),e("#divFinalCheckoutsurcharge").html(currencysymbol+onlineShoppingCart.shippingSurcharge.format("#.##")),o=!0),parseFloat(i)>0&&1==_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.invoiceDetails&&(o=!0,(0==_onlineCheckout.IsCCSupportedCountry()||1==_onlineCheckout.IsCCSupportedCountry()&&"false"==IsEnableMerchantAccount.toLowerCase())&&(e("#ancBuyNow").hide(),e("#divreturnpolicyPayInvoice").hide())),1==onlineShoppingCart.IsPickupInStore&&0==i&&0==_onlineCheckout.IsLoadCCIframForMemrship()?(e("#creditcardiframe_checkoutcart").html(""),e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divVplTracking").hide()):0==onlineShoppingCart.IsPickupInStore&&!_onlineCheckout.isValidForCheckoutInvoice()&&1==t.allFlatRateShippingProducts&&i>0&&_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout"),onlineShoppingCart.businessFeesFinalTotal>0&&(o=!0),o&&e("#divcartsubtotal").show(),e("#divcartdepositsblock").hide(),e("#divcartdepositprice_mobile").hide();var A=0;if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&("true"==isCCRequiredForOnlineClass.toLowerCase()||_onlineCheckout.isValidForCheckoutInvoice())&&("false"==IsClassReschedule.toLowerCase()||"true"==IsClassReschedule.toLowerCase()&&(void 0===IsPaid||"false"==IsPaid.toString().toLowerCase()))||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0){e("#divcartdepositsper").hide();var C=0,y=0,b=0,S=0;if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){b+=1,t.IsPartialDeposits=void 0!==t.IsPartialDeposits&&t.IsPartialDeposits,t.IsPartialPoint=void 0!==t.IsPartialPoint&&t.IsPartialPoint,t.paidType==_onlineCheckout.arrpaidType.DepositsClass?(C+=1,t.IsPartialPoint&&t.IsPartialDeposits&&(A+=t.PartialPrice),t.IsPartialPoint&&!t.IsDepositsOver?S+=t.depositsPaid+t.PartialPrice:S+=t.depositsPaid):t.paidType==_onlineCheckout.arrpaidType.PartiallyPaidClass?1:t.paidType==_onlineCheckout.arrpaidType.PaidClass&&(y+=1),null!=t.lstAddonService&&null!=t.lstAddonService&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){e.IsPartialDeposits=void 0!==e.IsPartialDeposits&&e.IsPartialDeposits,e.IsPartialPoint=void 0!==e.IsPartialPoint&&e.IsPartialPoint,b+=1,e.paidType==_onlineCheckout.arrpaidType.DepositsClass?(C+=1,e.IsPartialPoint&&e.IsPartialDeposits&&(A+=e.PartialPrice),e.IsPartialPoint&&!e.IsDepositsOver?S+=e.depositsPaid+e.PartialPrice:S+=e.depositsPaid):e.paidType==_onlineCheckout.arrpaidType.PartiallyPaidClass?1:e.paidType==_onlineCheckout.arrpaidType.PaidClass&&(y+=1)})})}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){b+=1,e.paidType==_onlineCheckout.arrpaidType.OfflineDeposit?(C+=1,S+=e.depositsPaid):e.paidType==_onlineCheckout.arrpaidType.Paid&&(y+=1)}),!(y>0&&b==y)){e("#divfinalTotalPrice").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,parseFloat(i+l))),e("#divcartdepositsblock").show(),e("#divcartdepositprice_mobile").show(),C>0&&(e("#divcartdepositsper").show(),e("#divcartdepositsper").html(currencysymbol+S.format("#.##")+" Deposit"),1==_onlineCheckout.IsClassBookingOnly(!0)&&(e("#divcheckoutSelectPaymentMethodTitle").html(_onlineCheckout.arrPaymentTitleType.Deposits),e("#divdepositsdescription").show())),i=_onlineCheckout.ConvertDecimalWithFixed(i-parseFloat(onlineShoppingCart.DepositsRemaining),!1,2)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining)-parseFloat(onlineShoppingCart.FeeDepositsRemaining)-parseFloat(A),onlineShoppingCart.FinalCCAmount=i,onlineShoppingCart.PartialPrice=A,e("#divcartdepositprice").html(currencysymbol+i.format("#.##")),e("#divcartdepositprice_mobile").html(currencysymbol+i.format("#.##")+" due now"),e("#divcarttotalduepriceatbusiness").html(currencysymbol+(onlineShoppingCart.DepositsRemaining+parseFloat(onlineShoppingCart.InvoiceDepositsRemaining)+parseFloat(onlineShoppingCart.FeeDepositsRemaining)).format("#.##"));var k=(onlineShoppingCart.DepositsRemaining+parseFloat(onlineShoppingCart.InvoiceDepositsRemaining)+parseFloat(onlineShoppingCart.FeeDepositsRemaining)).format("#.##");k>0&&(e("#VPLtotaldeposit").hide(),e("#vpltotalmessage").show(),_onlineCheckout.VPLmessagedeposit(k)),0==i&&0==_onlineCheckout.IsLoadCCIframForMemrship()&&(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divVplTracking").hide())}}else!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&1==_onlineCheckout.IsClassBookingOnly(!0)&&(e("#divcheckoutSelectPaymentMethodTitle").html(_onlineCheckout.arrPaymentTitleType.HoldOnCard),e("#divCCDescription").show(),void 0!==GetCCRequiredToSecureAppointmentDescription&&e("#divCCDescription").html(GetCCRequiredToSecureAppointmentDescription("classes")));if(1==_onlineCheckout.Model.IsPaymentOption&&e("#dvCheckoutBookingPaymentMethod").show(),e("#divcartdepositsduelabelwithgc").hide(),e("#divCartGCLabelNew").hide(),e("#divcartdepositsperlabel").html("Total Due Now"),void 0!==_shopdetail&&null!=_shopdetail?(e(_shopdetail.tabAddGiftCards).removeClass("w--current"),e(_shopdetail.divAddGiftCards).attr("style","display: none")):(e("#tabAddGiftCards").removeClass("w--current"),e("#divAddGiftCards").attr("style","display: none")),parseFloat(l)>0){var D=_onlineCheckout.createGiftCertificatesCartsubTotal();"none"==e("#divcartdepositsblock").css("display")?(e("#divCartGCLabelNew").show(),e("#divCartPrepayGClist").html(""),e("#tmplgclstCartSubtotal").tmpl(D).appendTo("#divCartPrepayGClist"),e("#divCartPrepaypricewithoutGC").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i)),e("#divfinalTotalPrice").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i+l)),1==_onlineCheckout.IsClassBookingOnly(!0)&&e("#divcheckoutSelectPaymentMethodTitle").html(_onlineCheckout.arrPaymentTitleType.Default)):(e("#divcartdepositsperlabel").html(""),e("#divcartdepositsduelabelwithgc").show(),e("#divcartdepositsgclist").html(""),e("#tmplgclstCartSubtotal").tmpl(D).appendTo("#divcartdepositsgclist"),"none"==e("#divcartdepositsper").css("display")?e("#divcartdepositpricewithoutgc").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i)):e("#divcartdepositpricewithoutgc").html(currencysymbol+i.format("#.##")),e("#divcartdepositprice").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i+l)))}e("#divfinalTotalDisplay").show(),e("#divcartsubtotal").removeClass("total-master").addClass("subtotal-master"),0==i&&1==e("#divfinalclassamountless").is(":visible")&&0==parseFloat(l)&&(e("#divfinalTotalDisplay").hide(),e("#divcartsubtotal").removeClass("subtotal-master").addClass("total-master")),0==_onlineCheckout.isValidForCheckoutInvoice()&&e(".divfinalCheckoutTipSuboption").hide();var _=null,I=null;null!=e("#divcartdepositprice")[0]&&null!=e("#divcartdepositprice")[0].innerHTML&&(I=e("#divcartdepositprice")[0].innerHTML.replace(currencysymbol,"")),null!=e("#lblGCRedeemAmt")[0]&&(_=(_=e("#lblGCRedeemAmt")[0].innerHTML.replace("$(","")).replace(")","")),null!=I&&null!=I&&0!=I?(totalDueAmt=e("#divfinalTotalPrice")[0].innerHTML.replace(currencysymbol,"")-I,FinalCCAmount=totalDueAmt):null!=_&&null!=_&&0!=_?(totalDueAmt=e("#divfinalTotalPrice")[0].innerHTML.replace(currencysymbol,"")-onlineShoppingCart.gcAmt,FinalCCAmount=totalDueAmt):FinalCCAmount=e("#divfinalTotalPrice")[0].innerHTML.replace(currencysymbol,""),!String.isNullOrUndefineOrBlank(BusinessDetail)&&FinalCCAmount<=BusinessDetail.MaximumAmount&&FinalCCAmount>=BusinessDetail.MinimumAmount&&"Free"==e("#divfinalTotalPrice")[0].innerHTML&&e("#divVplTracking").hide(),1==e("#tabVagaroPayLater").hasClass("w--current")&&FinalCCAmount>0&&_vgVPLOnline.PaymentSchedule(FinalCCAmount,_onlineCheckout.PaymentSchduleSuccess,_onlineCheckout.PaymentSchdulefail);var w=0,P=0;if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0){for(var T=0;T<onlineShoppingCart.Events.length;T++)if(null!=onlineShoppingCart.Events[T].eventEnrollment&&onlineShoppingCart.Events[T].eventEnrollment.length>0)for(var B=0;B<onlineShoppingCart.Events[T].eventEnrollment.length;B++){if(null!=onlineShoppingCart.Events[T].eventEnrollment[B].gcId&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].gcId&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax&&""!=onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].giftCertificateNo&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].giftCertificateNo)for(var x=onlineShoppingCart.Events[T].eventEnrollment[B].giftCertificateNo.substr(onlineShoppingCart.Events[T].eventEnrollment[B].giftCertificateNo.length-4),F=0;F<onlineShoppingCart.lstGCPkgData.length;F++)if(0==onlineShoppingCart.lstGCPkgData[F].isPackage&&onlineShoppingCart.lstGCPkgData[F].giftCertificateNo.substr(onlineShoppingCart.lstGCPkgData[F].giftCertificateNo.length-4).toLowerCase()==x.toLowerCase()&&null!=onlineShoppingCart.lstGCPkgData[F].Taxes)for(var O=0;O<onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax.length;O++)if(e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax[O].BusinessTaxID).length>0){var M=e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax[O].BusinessTaxID)[0].innerHTML;M=ConvertTodecimalMorePrecious(parseFloat(M.replace(/\$/g,"").replace(/£/g,"")),!0,2),M=ConvertTodecimalMorePrecious(M-onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax[O].CalculatedTax,!0,2),e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax[O].BusinessTaxID)[0].innerHTML=_shopdetail.currencySymbol+M,w+=onlineShoppingCart.Events[T].eventEnrollment[B].BusinessTax[O].CalculatedTax}if(null!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService&&onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService.length>0)for(var E=0;E<onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService.length;E++)if(null!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].gcId&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].gcId&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax&&""!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].giftCertificateNo&&null!=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].giftCertificateNo)for(var $=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].giftCertificateNo.substr(onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].giftCertificateNo.length-4),N=0;N<onlineShoppingCart.lstGCPkgData.length;N++)if(0==onlineShoppingCart.lstGCPkgData[N].isPackage&&onlineShoppingCart.lstGCPkgData[N].giftCertificateNo.substr(onlineShoppingCart.lstGCPkgData[N].giftCertificateNo.length-4).toLowerCase()==$.toLowerCase()&&null!=onlineShoppingCart.lstGCPkgData[N].Taxes)for(var L=0;L<onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax.length;L++)if(e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax[L].BusinessTaxID).length>0){var U=e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax[L].BusinessTaxID)[0].innerHTML;U=ConvertTodecimalMorePrecious(parseFloat(U.replace(/\$/g,"").replace(/£/g,"")),!0,2),U=ConvertTodecimalMorePrecious(U-onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax[L].CalculatedTax,!0,2),e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax[L].BusinessTaxID)[0].innerHTML=_shopdetail.currencySymbol+U,P+=onlineShoppingCart.Events[T].eventEnrollment[B].lstAddonService[E].BusinessTax[L].CalculatedTax}}e("#divTotalDuePrice").find("#divfinalTotalPrice")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divTotalDuePrice").find("#divfinalTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")-(parseFloat(ConvertTodecimalMorePrecious(w,!0,2))+parseFloat(ConvertTodecimalMorePrecious(P,!0,2))),!0,2),e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")>=w+P?e("#divCartPrepaypricewithoutGC")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")-ConvertTodecimalMorePrecious(parseFloat(ConvertTodecimalMorePrecious(w,!0,2))+parseFloat(ConvertTodecimalMorePrecious(P,!0,2)),!0,2),!0,2):e("#divCartPrepaypricewithoutGC")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")-parseFloat(e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")),!0,2),e("#divmobilefinalTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")>=w+P?e("#divmobilefinalTotalPrice")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divmobilefinalTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")-ConvertTodecimalMorePrecious(parseFloat(ConvertTodecimalMorePrecious(w,!0,2))+parseFloat(ConvertTodecimalMorePrecious(P,!0,2)),!0,2),!0,2):e("#divmobilefinalTotalPrice")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divmobilefinalTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")-parseFloat(e("#divmobilefinalTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")),!0,2)}if(null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&null!=onlineShoppingCart.RedeemedByGC&&onlineShoppingCart.RedeemedByGC.length>0){var R=0,G=[];for(T=0;T<onlineShoppingCart.ServiceInvoice.length;T++)for(B=0;B<onlineShoppingCart.RedeemedByGC.length;B++)onlineShoppingCart.ServiceInvoice[T].serviceid==onlineShoppingCart.RedeemedByGC[B].serviceId&&G.push(onlineShoppingCart.ServiceInvoice[T]);for(F=0;F<G.length;F++)for(O=0;O<onlineShoppingCart.lstGCPkgData.length;O++)if(G[F].serviceid==onlineShoppingCart.lstGCPkgData[O].serviceID&&null!=onlineShoppingCart.lstGCPkgData[O].Taxes&&null!=G[F].BusinessTax&&G[F].BusinessTax.length>0)for(E=0;E<G[F].BusinessTax.length;E++)if(e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+G[F].BusinessTax[E].BusinessTaxID).length>0){M=e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+G[F].BusinessTax[E].BusinessTaxID)[0].innerHTML;M=ConvertTodecimalMorePrecious(parseFloat(M.replace(/\$/g,"").replace(/£/g,"")),!0,2),M=ConvertTodecimalMorePrecious(M-G[F].BusinessTax[E].CalculatedTax,!0,2),e("#divfinalcheckoutMultipletaxes").find("#divMultipleTaxValue_"+G[F].BusinessTax[E].BusinessTaxID)[0].innerHTML=_shopdetail.currencySymbol+M,R+=G[F].BusinessTax[E].CalculatedTax}e("#divTotalDuePrice").find("#divfinalTotalPrice")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divTotalDuePrice").find("#divfinalTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""),!0,2),e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")>=R?e("#divCartPrepaypricewithoutGC")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""),!0,2):e("#divCartPrepaypricewithoutGC")[0].innerHTML=_shopdetail.currencySymbol+ConvertTodecimalMorePrecious(e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")-parseFloat(e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,"")),!0,2)}}_onlineCheckout.BindFirstTimeCustomerCheckbox()},_onlineCheckout.CheckGCPromoCodeLimt=function(t){if(_shopdetail.EnableFMBFee()&&_onlineCheckout.IsAnyDailyDealInCart()){var i=_onlineCheckout.IsValidateForPromoCode();if("function"!=typeof _shopdetail.IsUKBusiness||!_shopdetail.IsUKBusiness()||0!=i)return}ShowLoader(!0);try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){var a=(new Date).getTime();if(1===t)var r=e("#txtGCRedeemGCNo").val(),o={timestamp:a,eventName:"GiftCardApplied",data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:"",giftCardNumber:r}};else{var n=e("#txtPromoCode").val();o={timestamp:a,eventName:"PromoCodeApplied",data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:"",promoCode:n}}}"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(o)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(o)}}catch(e){}if(t==_onlineCheckout.PromoCodeType.GCCode){if(null==(r=e("#txtGCRedeemGCNo").val())||String.isNullOrUndefineOrBlank(r.trim()))return e("#txtGCRedeemGCNo").val(""),e("#txtGCRedeemGCNo").addClass("errorInput"),e("#txtGCRedeemGCNo").focus(),void ShowLoader(!1);var s=onlineShoppingCart.loginUserId,l=UserType,d="CheckGCNumber";_onlineCheckout.GetGCPromoCodeLimt(s,l,d),ShowLoader(!1)}else if(t==_onlineCheckout.PromoCodeType.PromoCode){if(null==(n=e("#txtPromoCode").val())||String.isNullOrUndefineOrBlank(n.trim()))return e("#txtPromoCode").val(""),e("#txtPromoCode").addClass("errorInput"),e("#txtPromoCode").focus(),void ShowLoader(!1);s=onlineShoppingCart.loginUserId,l=UserType,d="CheckPromoNumber";_onlineCheckout.GetGCPromoCodeLimt(s,l,d),ShowLoader(!1)}},_onlineCheckout.GetGCPromoCodeLimt=function(e,t,i){var a={};a.UserID=parseInt(e),a.UserType=null==t||""==t||void 0===t||0==t?parseInt(1):parseInt(t),a.MethodName=i;var r=new vagaro.ajax;r.datamodel.async=!1,r.datamodel.Token=_onlineCheckout.GetCoreAPIURLWithToken(ApiURLEnumOnlineCheckout.getgcpromocodelimt,groupID),r.datamodel.data=a,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.callback=_onlineCheckout.GetGCPromoCodeLimtSuccess,r.datamodel.Error=_onlineCheckout.GetState_Failure,r.Post()},_onlineCheckout.GetGCPromoCodeLimtSuccess=function(t){if(1e3==t.ResponseCode&&null!=t.Data){var i=t.Data.split("|");if(i.length<=2&&i[1]==_onlineCheckout.CodeType.GCCode){var a=e("#txtGCRedeemGCNo").val();if("True"!=i[0])return _onlineCheckout.CreateGCCodeDiv(a.trim().toUpperCase(),a.trim().toUpperCase(),"You have exceeded the number of attempts.",!1),e("#txtGCRedeemGCNo").val(""),void ShowLoader(!1);_onlineCheckout.CheckValidGCNoInGCRedeem(),ShowLoader(!1)}else if(i.length<=2&&i[1]==_onlineCheckout.CodeType.PromoCode){var r=e("#txtPromoCode").val();if("True"!=i[0])return _onlineCheckout.CreatePromoCodeDiv(r.toUpperCase(),r.toUpperCase(),"You have exceeded the number of attempts.",!1),e("#txtPromoCode").val(""),void ShowLoader(!1);_onlineCheckout.ValidatePromoCode(),ShowLoader(!1)}}},_onlineCheckout.GCPromoCodeLimt=function(e,t,i,a){var r={};r.UserID=parseInt(e),r.UserType=null==t||""==t||void 0===t||0==t?parseInt(1):parseInt(t),r.GCPromoCodeNo=i,r.MethodName=a;var o=new vagaro.ajax;o.datamodel.async=!1,o.datamodel.Token=_onlineCheckout.GetCoreAPIURLWithToken(ApiURLEnumOnlineCheckout.gcpromocodelimt,groupID),o.datamodel.data=r,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.callback=_onlineCheckout.GCPromoCodeLimtSuccess,o.datamodel.Error=_onlineCheckout.GetState_Failure,o.Post()},_onlineCheckout.GCPromoCodeLimtSuccess=function(t){if(1e3==t.CustomCode&&null!=t.Data)if(null!=t.Data.RateLimitMethods&&t.Data.RateLimitMethods.MethodName==_onlineCheckout.CodeType.GCCode){var i=e("#txtGCRedeemGCNo").val();if(null!=t.Data.RateLimitMethodDetails)return _onlineCheckout.CreateGCCodeDiv(i.trim().toUpperCase(),i.trim().toUpperCase(),"The gift card number you entered is incorrect.",!1),e("#txtGCRedeemGCNo").val(""),void ShowLoader(!1)}else if(null!=t.Data.RateLimitMethods&&t.Data.RateLimitMethods.MethodName==_onlineCheckout.CodeType.PromoCode){var a=e("#txtPromoCode").val();if(null!=t.Data.RateLimitMethodDetails)return _onlineCheckout.CreatePromoCodeDiv(a.toUpperCase(),a.toUpperCase(),"The promo code you entered is incorrect.",!1),e("#txtPromoCode").val(""),void ShowLoader(!1)}};var I=!1;_onlineCheckout.CheckValidGCNoInGCRedeem=function(){e("#divApplyGCcode").empty();var t,i=e("#txtGCRedeemGCNo").val();if(null==i||String.isNullOrUndefineOrBlank(i.trim()))e("#txtGCRedeemGCNo").val(""),e("#txtGCRedeemGCNo").addClass("errorInput"),e("#txtGCRedeemGCNo").focus();else{if(0!==(t=e.grep(onlineShoppingCart.lstGCPkgData,function(t){return!String.isNullOrUndefineOrBlank(t.giftCertificateNo)&&t.giftCertificateNo.toLowerCase()==e("#txtGCRedeemGCNo").val().toLowerCase().trim()||!String.isNullOrUndefineOrBlank(t.giftCertificateNo)&&t.giftCertificateNo.toLowerCase().substr(0,t.giftCertificateNo.lastIndexOf("-")).trim()==e("#txtGCRedeemGCNo").val().toLowerCase().trim()})).length)return _onlineCheckout.CreateGCCodeDiv(i.trim().toUpperCase(),i.trim().toUpperCase(),"This Gift Card already exist.",!1),e("#txtGCRedeemGCNo").val(""),void ShowLoader(!1);if(I=!0,0===t.length){ShowLoader(!0);var a={};a.businessID=onlineShoppingCart.BusinessID,a.userID=onlineShoppingCart.loginUserId,a.gCNo=e("#txtGCRedeemGCNo").val().trim(),a.isConsiderOwnBusiness="1"===e("#hdnIsFromSwipe").val(),a.lLoggedInID=onlineShoppingCart.loginUserId;var r=new vagaro.ajax;r.datamodel.Token="CheckGCNo",r.datamodel.data=a,r.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},r.datamodel.callback=_onlineCheckout.CheckValidGCNoInGCRedeem_Success,r.Post()}}},_onlineCheckout.DateDifference=function(e,t){var i=t.getTime()-e.getTime();return Math.ceil(i/1e3/60/60/24)},_onlineCheckout.GetTerikSupportedDate=function(e){return new Date(e.replace(/-/g,","))},_onlineCheckout.SetGCPackageList=function(e){var t={AdvanceLimitDate:null};return t.SharedUserIDs=onlineShoppingCart.loginUserId.toString(),t.TotalPKGUnlimitedCount=e.TotalPKGUnlimitedCount,t.ValidUpto=e.ValidUpto,t.assignTo=e.AssignTo,t.assignedToName=e.AssignedToName,t.businessID=e.BusinessID,t.businessName=e.BusinessName,t.currentBalance=e.CurrentBalance,t.emailId="",t.eventType=e.EventType,t.expiresOn=e.ExpiresOn,t.giftCertificateAmt=e.GiftCertificateAmt,t.giftCertificateID=e.GiftCertificateID,t.giftCertificateNo=e.GiftCertificateNo,t.groupID=e.GroupId,t.initialQuantity=e.InitialQuantity,t.isCustomPackage=e.IsCustomPackage,t.isPackage=e.IsPackage,t.pkgName="",t.quantity=e.Quantity,t.senderName=e.SenderName,t.serviceID=0==e.ServiceID?null:e.ServiceID,t.serviceName=e.ServiceName,t.strAdvanceLimitDate=e.AdvanceLimitDate,t.strValidUpto=e.strValidUpto,t.voidDate=e.VoidDate,t.voidReason=e.VoidReason,onlineShoppingCart.lstGCPkgData.push(t),t},_onlineCheckout.CheckValidGCNoInGCRedeem_Success=function(t){ShowLoader(!1);var i=e("#txtGCRedeemGCNo").val();if(null!==t&&t.length>0){var a=_onlineCheckout.Empty,r=e.grep(t,function(e){return String.isNullOrUndefineOrBlank(e.VoidDate)&&(String.isNullOrUndefineOrBlank(e.strExpiresOn)||!String.isNullOrUndefineOrBlank(e.strExpiresOn)&&_onlineCheckout.DateDifference(_onlineCheckout.GetTerikSupportedDate(BusinessDate),new Date(e.strExpiresOn))>0)&&(null===e.ServiceID||null!==e.ServiceID&&e.Quantity>0)&&null!==e.CurrentBalance&&e.CurrentBalance>0});if(r.length>0&&(t[0]=r[0]),String.isNullOrUndefineOrBlank(t[0].VoidDate)?!String.isNullOrUndefineOrBlank(t[0].strExpiresOn)&&_onlineCheckout.DateDifference(_onlineCheckout.GetTerikSupportedDate(BusinessDate),new Date(t[0].strExpiresOn))<0?a=_onlineCheckout.GCExpMsg:null!==t[0].CurrentBalance&&t[0].CurrentBalance<=0?a=_onlineCheckout.GCBalMsg:null!==t[0].ServiceID&&t[0].Quantity<=0&&(a=_onlineCheckout.GCQuantityMsg):a=_onlineCheckout.GCVoidMsg,!String.isNullOrUndefineOrBlank(a))return _onlineCheckout.CreateGCCodeDiv(i.trim().toUpperCase(),i.trim().toUpperCase(),a,!1),!1;if(0==r.length&&1==I){var o=UserType,n="CheckGCNumber";return _onlineCheckout.GCPromoCodeLimt(onlineShoppingCart.loginUserId,o,i.trim().toUpperCase(),n),!1}e("#divApplyGCcode").empty(),e("#txtGCRedeemGCNo").val("");var s=_onlineCheckout.SetGCPackageList(t[0]);null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){1!=t.isPointApply&&1!=t.isPackage&&(t.gcId=null,t.GCDetail=[],t.isPriceBaseGCApply=!1,t.isGCApply=!1,t.isDecisionTaken=null,t.redeemAmt=0,t.redeemTax=0,t.isServiceBaseGC=!1),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){1!=e.isPointApply&&1!=e.isPackage&&(e.gcId=null,e.GCDetail=[],e.isPriceBaseGCApply=!1,e.isGCApply=!1,e.isDecisionTaken=null,e.redeemAmt=0,e.redeemTax=0,e.isServiceBaseGC=!1)})})}),onlineShoppingCart.RedeemedByGCtemp=[]),_onlineCheckout.ApplyDiscounts(onlineShoppingCart.lstGCPkgData,null,onlineShoppingCart.lstMembership,onlineShoppingCart.IsPromotionEnable,s),e("#txtGCRedeemGCNo").val(_onlineCheckout.Empty)}else{o=UserType,n="CheckGCNumber";_onlineCheckout.GCPromoCodeLimt(onlineShoppingCart.loginUserId,o,i.trim().toUpperCase(),n)}},_onlineCheckout.VPLmessagedeposit=function(t){if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&_siteBuilderDetail.isAffirmEnable)return e("#dvVPLdeposit").hide(),e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfrdeposit").css("display","none"),e("#dvVPLTotal").hide(),e("#VPLImageaftr").css("display","none"),void e("#VPLImageBfr").css("display","none");var i=t,a=e("#hdnMaximumAmount").val(),r=e("#hdnMinimumAmount").val(),o=e("#hdnIsVPLEnable").val(),n=parseInt(JSON.parse(a)),s=parseInt(JSON.parse(r)),l=JSON.parse(o);if(_siteBuilderDetail.isAffirmEnable){const t="https://vagaro.azureedge.net/static/assets/new_affirm_logo2.png";e("#VPLImageBfrdeposit img, #VPLImageaftrdeposit img, #VPLImageBfr img, #VPLImageaftr img").attr("src",t).addClass("AffirmImageLogo")}if(2==l&&0==_onlineCheckout.IsVplChanged&&"false"==IsClassReschedule.toLowerCase()){if("undefined"!=typeof IsEnableMerchantAccount&&"false"==IsEnableMerchantAccount.toLowerCase())e("#dvVPLdeposit").hide(),e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfrdeposit").css("display","none"),e("#dvVPLTotal").hide(),e("#VPLImageaftr").css("display","none"),e("#VPLImageBfr").css("display","none");else if(1==_onlineCheckout.IsRecurringPkg||1==_onlineCheckout.IsRecurringMembership)e("#VPLImageBfrdeposit").css("display","block"),e("#dvVPLdeposit").css("display","block"),e("#dvVPLdeposit")[0].innerText=" is not available for recurring memberships and packages.",e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfr").css("display","inline"),e("#dvVPLTotal").css("display","inline"),e("#dvVPLTotal")[0].innerText=" is not available for recurring memberships and packages.",e("#VPLImageaftr").css("display","none");else if(0==i||i<s&&(0==_onlineCheckout.IsRecurringPkg||0==_onlineCheckout.IsRecurringMembership))e("#dvVPLdeposit").css("display","inline"),e("#dvVPLdeposit")[0].innerText="Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",e("#VPLImageaftrdeposit").css("display","inline"),e("#VPLImageBfrdeposit").css("display","none"),e("#VPLImageaftrdeposit").attr("aria-label"," Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with"),_siteBuilderDetail.isAffirmEnable&&"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),e("#dvVPLTotal").css("display","inline"),e("#dvVPLTotal")[0].innerText="Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",e("#VPLImageaftr").css("display","inline"),e("#VPLImageBfr").css("display","none"),e("#VPLImageaftr").attr("aria-label"," Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with"),_siteBuilderDetail.isAffirmEnable&&"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh();else if(i>n&&(0==_onlineCheckout.IsRecurringPkg||0==_onlineCheckout.IsRecurringMembership))e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfrdeposit").css("display","inline"),e("#dvVPLdeposit").css("display","inline"),e("#dvVPLdeposit")[0].innerText=" is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".",e("#VPLImageBfrdeposit").attr("aria-label"," is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"."),e("#VPLImageBfr").css("display","inline"),e("#VPLImageaftr").css("display","none"),e("#dvVPLTotal").css("display","inline"),e("#dvVPLTotal")[0].innerText=" is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".",e("#VPLImageBfr").attr("aria-label"," is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".");else if(i<n&&i>s&&0==_onlineCheckout.isCheckoutVPLChanged||0==_onlineCheckout.IsVplChanged){var d=i/4;d=d.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,"),e("#dvVPLdeposit").css("display","inline"),e("#dvVPLdeposit")[0].innerText=" or 4 payments of "+_shopdetail.currencySymbol+d+" with ",e("#VPLImageaftrdeposit").css("display","inline"),e("#VPLImageBfrdeposit").css("display","none"),e("#VPLImageaftrdeposit").attr("aria-label"," or 4 payments of "+_shopdetail.currencySymbol+d+" with vagaro pay later"),_siteBuilderDetail.isAffirmEnable&&(e("#dvVPLdeposit")[0].innerText="Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with",e("#dvVPLdeposit").addClass("affirm-as-low-as"),e("#dvVPLdeposit").attr("data-page-type","product"),e("#dvVPLdeposit").attr("data-amount",Math.round(100*i)),e("#VPLImageaftrdeposit").css("display","none"),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?affirm.ui.refresh():e("#VPLImageaftrdeposit").css("display","inline")),e("#dvVPLTotal").css("display","inline"),e("#dvVPLTotal")[0].innerText=" or 4 payments of "+_shopdetail.currencySymbol+d+" with ",e("#VPLImageaftr").css("display","inline"),e("#VPLImageBfr").css("display","none"),e("#VPLImageaftr").attr("aria-label"," or 4 payments of "+_shopdetail.currencySymbol+d+" with vagaro pay later"),_siteBuilderDetail.isAffirmEnable&&(e("#dvVPLTotal")[0].innerText="Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",e("#dvVPLTotal").addClass("affirm-as-low-as"),e("#dvVPLTotal").attr("data-page-type","product"),e("#dvVPLTotal").attr("data-amount",Math.round(100*i)),e("#VPLImageaftr").css("display","none"),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?affirm.ui.refresh():e("#VPLImageaftr").css("display","inline")),e("#AffirmPaybutton").attr("data-amount",Math.round(100*i)),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&i<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&(e("#dvVPLdeposit").css("display","none"),e("#VPLImageaftrdeposit").css("display","none"),e("#dvVPLTotal").css("display","none"),e("#VPLImageaftr").css("display","none"))}}else 1==l?(e("#VPLImageBfrdeposit").css("display","block"),e("#dvVPLdeposit").css("display","block"),e("#dvVPLdeposit")[0].innerText="is not available for this service Provider.",e("#VPLImageBfr").css("display","block"),e("#dvVPLTotal").css("display","block"),e("#dvVPLTotal")[0].innerText="is not available for this service Provider."):(e("#dvVPLdeposit").hide(),e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfrdeposit").css("display","none"))},_onlineCheckout.Affirmmessagedeposit=function(t){var i=t,a=e("#hdnMaximumAmount").val(),r=e("#hdnMinimumAmount").val(),o=e("#hdnIsVPLEnable").val(),n=parseInt(JSON.parse(a)),s=parseInt(JSON.parse(r)),l=JSON.parse(o);2==l&&0==_onlineCheckout.IsVplChanged&&"false"==IsClassReschedule.toLowerCase()?"undefined"!=typeof IsEnableMerchantAccount&&"false"==IsEnableMerchantAccount.toLowerCase()?(e("#dvAffirmdeposit").hide(),e("#AffirmImageaftrdeposit").css("display","none"),e("#AffirmImageBfrdeposit").css("display","none"),e("#dvAffirmTotal").hide(),e("#AffirmImageaftr").css("display","none"),e("#AffirmImageBfr").css("display","none")):1==_onlineCheckout.IsRecurringPkg||1==_onlineCheckout.IsRecurringMembership?(e("#AffirmImageBfrdeposit").css("display","block"),e("#dvAffirmdeposit").css("display","block"),e("#dvAffirmdeposit")[0].innerText=" is not available for recurring memberships and packages.",e("#AffirmImageaftrdeposit").css("display","none"),e("#AffirmImageBfr").css("display","inline"),e("#dvAffirmTotal").css("display","inline"),e("#dvAffirmTotal")[0].innerText=" is not available for recurring memberships and packages.",e("#AffirmImageaftr").css("display","none")):0==i||i<s&&(0==_onlineCheckout.IsRecurringPkg||0==_onlineCheckout.IsRecurringMembership)?(e("#dvAffirmdeposit").css("display","inline"),e("#dvAffirmdeposit")[0].innerText="Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with",e("#AffirmImageaftrdeposit").css("display","inline"),e("#AffirmImageBfrdeposit").css("display","inline"),e("#AffirmImageaftrdeposit").attr("aria-label"," Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with"),e("#dvAffirmTotal").css("display","inline"),e("#dvAffirmTotal")[0].innerText="Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with",e("#AffirmImageaftr").css("display","inline"),e("#AffirmImageBfr").css("display","inline"),e("#AffirmImageaftr").attr("aria-label"," Pay over time for orders of $"+s.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with")):i>n&&(0==_onlineCheckout.IsRecurringPkg||0==_onlineCheckout.IsRecurringMembership)?(e("#AffirmImageaftrdeposit").css("display","none"),e("#AffirmImageBfrdeposit").css("display","inline"),e("#dvAffirmdeposit").css("display","inline"),e("#dvAffirmdeposit")[0].innerText=" is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".",e("#AffirmImageBfrdeposit").attr("aria-label"," is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"."),e("#AffirmImageBfr").css("display","inline"),e("#AffirmImageaftr").css("display","none"),e("#dvAffirmTotal").css("display","inline"),e("#dvAffirmTotal")[0].innerText=" is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".",e("#AffirmImageBfr").attr("aria-label"," is only available for order under $"+n.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".")):(i<n&&i>s&&0==_onlineCheckout.isCheckoutVPLChanged||0==_onlineCheckout.IsVplChanged)&&(e("#dvAffirmdeposit").css("display","none"),e("#AffirmImageaftrdeposit").css("display","block"),e("#AffirmImageBfrdeposit").css("display","none"),e("#AffirmImageaftrdeposit").attr("data-amount",Math.round(100*i)),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),e("#dvAffirmTotal").css("display","none"),e("#AffirmImageaftr").css("display","block"),e("#AffirmImageBfr").css("display","none"),e("#AffirmImageaftr").attr("data-amount",Math.round(100*i)),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&i<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&(e("#dvAffirmdeposit").css("display","none"),e("#AffirmImageaftrdeposit").css("display","none"),e("#dvAffirmTotal").css("display","none"),e("#AffirmImageaftr").css("display","none"))):1==l?(e("#AffirmImageBfrdeposit").css("display","block"),e("#dvAffirmdeposit").css("display","block"),e("#dvAffirmdeposit")[0].innerText="is not available for this service Provider.",e("#AffirmImageBfr").css("display","block"),e("#dvAffirmTotal").css("display","block"),e("#dvAffirmTotal")[0].innerText="is not available for this service Provider."):(e("#dvAffirmdeposit").hide(),e("#AffirmImageaftrdeposit").css("display","none"),e("#AffirmImageBfrdeposit").css("display","none"))},_onlineCheckout.hideShippingMethodsForFlatRateShippingProducts=function(){var t={Inventories:[],allFlatRateShippingProducts:!1};if("undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart.Inventories&&void 0!==onlineShoppingCart.Inventories){var i=0,a=0,r=!1;parseFloat(0);e.grep(onlineShoppingCart.Inventories,function(e){0==e.MasterInventoryId&&(a++,0==e.IsFreeShipping&&1==e.IsFlatRateShipping&&(i++,t.Inventories.push({InventoryId:e.InventoryId,IsFreeShipping:e.IsFreeShipping,FlatRateShippingPrice:e.FlatRateShippingPrice,Quantity:e.Quantity,AdditionShippingPrice:e.AdditionShippingPrice})),1==e.IsFreeShipping&&0)}),a==i&&(r=!0,e(".shippingMethodsHideShow").hide()),t.allFlatRateShippingProducts=r}return t};var w=null;function P(t){isCCChanged=!1,null!=t&&void 0!==t&&null!=t.gatewayResponse&&void 0!==t.gatewayResponse&&1080==t.gatewayResponse.custom_code||(null==t||void 0===t||1071!=t.custom_code?e("#hdnIsFromPage").length>0&&"shopdetail"==e("#hdnIsFromPage").val()?(isCCChanged=!0,LoadCCFrame()):(e("#tabCheckoutBooking2").siblings(".w-tab-link").removeClass("w--current"),e("#tabCheckoutBooking2").addClass("w--current"),_onlineCheckout.isCheckoutCCChanged=!0,_onlineCheckout.LoadBalnkCCFrame()):CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed))}_onlineCheckout.CheckUserhasCreditcardOrNot=function(t){if((1!=e("#dvCheckoutBookingPaymentMethod").is(":visible")||1!=e(_onlineCheckout.Controls.DvcheckoutBookingTabs).is(":visible")||1!=_onlineCheckout.loadNewCCandShip)&&"1"!=_onlineCheckout.isFillCCDetailsForms){if(ShowLoader(!0),1==isCheckInApp&&(UserID=glbDataCheckIn.scanUserID),_onlineCheckout.zenSwipeCardDetails=null,1==isCheckInApp?void 0!==glbDataCheckIn.sGroup&&null!=glbDataCheckIn.sGroup?glbDataCheckIn.sGroup:"":void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo?_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID:"","undefined"!=typeof onlineShoppingCartmain){var i=!1;if(void 0!==onlineShoppingCartmain.Packages&&null!=onlineShoppingCartmain.Packages&&onlineShoppingCartmain.Packages.length>0&&e.grep(onlineShoppingCartmain.Packages,function(e){void 0!==e.RecGiftCertificateId&&e.RecGiftCertificateId>0&&(i=!0)}),void 0!==onlineShoppingCartmain.Memberships&&null!=onlineShoppingCartmain.Memberships&&onlineShoppingCartmain.Memberships.length>0&&e.grep(onlineShoppingCartmain.Memberships,function(e){void 0!==e.UserBusinessMembershipId&&null!=e.UserBusinessMembershipId&&""!=e.UserBusinessMembershipId&&(i=!0)}),1==i)return void _onlineCheckout.LoadCCSectionForCheckout([])}var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumOnlineCheckout.getuserccdetailsbyonlyuserid,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=_onlineCheckout.LoadCCSectionForCheckout;var r={lUserID:UserID,lBusinessID:businessID,isAmaxSupport:"False"!==AcceptAmex,LoginUserGroup:"",EncryptUserId:glbEncryptUserId};a.datamodel.data=r,a.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},a.Post()}},_onlineCheckout.LoadCCSectionForCheckout=function(t){var i,a,r;ShowLoader(!1),void 0!==t&&null!=t&&(i=e.grep(t,function(e){return 1==e.isselfcard}),a=e.grep(t,function(e){return 0==e.isselfcard&&0==e.isOtherCard}),r=e.grep(t,function(e){return 1==e.isOtherCard})),void 0===i||0==i.length?i=null:(i=i[0],_onlineCheckout.BusSavedCard=e.extend(!0,{},i),w=1),e("#dvCheckoutCCConfirmtion").modal("hide"),void 0===i||null==i?void 0!==r&&r.length>0?_onlineCheckout.ccCardOnFile=r[0]:void 0!==a&&a.length>0?_onlineCheckout.ccCardOnFile=a[0]:_onlineCheckout.ccCardOnFile=null:_onlineCheckout.ccCardOnFile=i,_onlineCheckout.zenSwipeCardDetails=i,_onlineCheckout.BindCCDetailForBooking(i,a,r)},_onlineCheckout.IsValidateMembershipPackageRecurring=function(){if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0){var t=e.grep(onlineShoppingCart.Memberships,function(e){return 1==e.IsRecurring});null!=t&&t.length>0?_onlineCheckout.IsRecurringMembership=!0:_onlineCheckout.IsRecurringMembership=!1}else _onlineCheckout.IsRecurringMembership=!1;if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var i=e.grep(onlineShoppingCart.Packages,function(e){return 1==e.IsRecurring});null!=i&&i.length>0?_onlineCheckout.IsRecurringPkg=!0:_onlineCheckout.IsRecurringPkg=!1}else _onlineCheckout.IsRecurringPkg=!1},_onlineCheckout.ValidateVPl=function(t,i){if("undefined"!=typeof BusinessDetail&&null!=BusinessDetail&&2==BusinessDetail.VPLStatus){_onlineCheckout.IsValidateMembershipPackageRecurring(),_shopdetail.DisplayVPLCetegeyOrAffirm(1);var a=onlineShoppingCart.FinalCCAmount;if("undefined"==typeof CCDetail&&1==_onlineCheckout.Model.IsPaymentOption&&(void 0===onlineShoppingCart.FinalCCAmount||onlineShoppingCart.FinalCCAmount<=0)&&e("#dvcheckoutBookingTabs").hide(),1==_onlineCheckout.isCheckoutVPLPromocode&&null!=_onlineCheckout.totalfinalAmount&&(a=_onlineCheckout.totalfinalAmount),"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp)_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e(_onlineCheckout.Controls.tabGooglePay).is(":visible")&&e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")||e(_onlineCheckout.Controls.tabApplePay).is(":visible")&&e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")||e("#tabCheckoutBooking1").addClass("w--current"),e("#tabVagaroPayLater").removeClass("w--current"),e("#vpltotalmessage").hide(),e("#divVplTracking").hide();else if(null!=e("#divcartdepositprice")[0]&&null!=e("#divcartdepositprice")[0].innerHTML&&(depositeAmount=e("#divcartdepositprice")[0].innerHTML.replace(currencysymbol,""),null!=depositeAmount&&null!=depositeAmount&&0!=depositeAmount&&(1==e("#divcartdepositpricewithoutgc").is(":visible")&&null!=e("#divcartdepositpricewithoutgc")[0]&&null!=e("#divcartdepositpricewithoutgc")[0].innerHTML&&(depositeAmount=e("#divcartdepositpricewithoutgc")[0].innerHTML.replace(currencysymbol,"")),a=depositeAmount,e("#tabVagaroPayLater").hide())),t)a>=BusinessDetail.MinimumAmount&&a<=BusinessDetail.MaximumAmount?1==_onlineCheckout.IsRecurringMembership||1==_onlineCheckout.IsRecurringPkg?(_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e("#vpltotalmessage").show(),e("#VPLtotaldeposit").show()):(_onlineCheckout.IsVplChanged=!0,e("#tabVagaroPayLater").show(),e("#vpltotalmessage").hide(),e("#VPLtotaldeposit").hide()):(_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide(),e(_onlineCheckout.Controls.tabGooglePay).is(":visible")&&e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")||e(_onlineCheckout.Controls.tabApplePay).is(":visible")&&e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")||e("#tabCheckoutBooking1").addClass("w--current"),e("#tabVagaroPayLater").removeClass("w--current"));else if(a<=BusinessDetail.MaximumAmount&&a>=BusinessDetail.MinimumAmount)if(1==_onlineCheckout.IsRecurringMembership||1==_onlineCheckout.IsRecurringPkg)_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide();else{if(void 0!==_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage)[0]){var r=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage)[0].eventEnrollment.uniqueObjects(["customerID","cUserEmail"])[0].customerID;if(void 0!==r&&UserID!=r)return _onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),void e("#divVplTracking").hide()}_onlineCheckout.IsVplChanged=!0,void 0!==w&&1==w&&(e("#tabVagaroPayLater").removeClass("first-tab"),e("#tabVagaroPayLater").addClass("mid-tab")),"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0?1==onlineVPLCheckout?1==_onlineCheckout.IsRecurringMembership||1==_onlineCheckout.IsRecurringPkg?(e("#tabVagaroPayLater").hide(),e("#vpltotalmessage").show(),e("#divVplTracking").hide()):(e("#tabVagaroPayLater").show(),e("#vpltotalmessage").hide(),e("#divVplTracking").hide()):(_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide(),e("#dvVPLdeposit").hide(),e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfrdeposit").css("display","none")):1==_onlineCheckout.IsRecurringMembership||1==_onlineCheckout.IsRecurringPkg?(e("#tabVagaroPayLater").hide(),e("#vpltotalmessage").show(),e("#divVplTracking").hide()):(e("#tabVagaroPayLater").show(),e("#vpltotalmessage").hide(),e("#divVplTracking").hide())}else(a<BusinessDetail.MinimumAmount||a>BusinessDetail.MaximumAmount)&&(_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e(_onlineCheckout.Controls.tabGooglePay).is(":visible")&&e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")||e(_onlineCheckout.Controls.tabApplePay).is(":visible")&&e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")||e("#tabCheckoutBooking1").addClass("w--current"),e("#tabVagaroPayLater").removeClass("w--current"))}},_onlineCheckout.UpdateCCSelection=function(t){e(t).siblings(".w-tab-link").removeClass("w--current"),e(t).addClass("w--current"),"tabCheckoutBooking2"!=t.id&&t.id!=_onlineCheckout.Controls.keyApplePay&&t.id!=_onlineCheckout.Controls.keyGooglePay&&void 0!==t.dataset&&null!=t.dataset&&(_onlineCheckout.ccCardOnFile.CCFirstName=t.dataset.ccfirstname,_onlineCheckout.ccCardOnFile.CCLastName=t.dataset.cclastname,_onlineCheckout.ccCardOnFile.CCMiddleName=t.dataset.ccmiddlename,_onlineCheckout.ccCardOnFile.CardTokenId=t.dataset.cardtokenid,_onlineCheckout.ccCardOnFile.CreditCardNumber=t.dataset.creditcardnumber,_onlineCheckout.ccCardOnFile.CreditCardType=t.dataset.creditcardtype,_onlineCheckout.ccCardOnFile.ExpMonth=t.dataset.expmonth,_onlineCheckout.ccCardOnFile.ExpYear=t.dataset.expyear,_onlineCheckout.ccCardOnFile.FullName=t.dataset.fullname,_onlineCheckout.ccCardOnFile.SecurityCode=t.dataset.securitycode,e("#hdnCCTokenID").val(t.dataset.cardtokenid)),e("#divVplAddBankDetails").hide(),e("#divVplCheckoutScreen").hide(),e(".mulvplbook").show(),_onlineCheckout.IsVCFEnable()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.CCSelection))},_onlineCheckout.ShowBankAndEmi=function(t){if(e("#VplAmount").text(currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(onlineShoppingCart.FinalCCAmount,!0,2)),e(t).siblings(".w-tab-link").removeClass("w--current"),e(t).addClass("w--current"),e(".vpl-add-bank").html(""),0==_siteBuilderDetail.isAffirmEnable&&void 0!==_onlineCheckout.VPLUserBankDetails&&null!=_onlineCheckout.VPLUserBankDetails){var i=_onlineCheckout.VPLUserBankDetails[0].Id;e("#tmplUserBankListtmplUserBankList").tmpl(_onlineCheckout.VPLUserBankDetails).appendTo(".vpl-add-bank"),e("#addBankList #rb_"+i).attr("checked","checked"),e("#addBankAccount").length>0&&e("#dvVPLSubPart").hide()}1==e("#tabVagaroPayLater").hasClass("w--current")&&onlineShoppingCart.FinalCCAmount>0&&_vgVPLOnline.PaymentSchedule(onlineShoppingCart.FinalCCAmount,_onlineCheckout.PaymentSchduleSuccess,_onlineCheckout.PaymentSchdulefail);var a=onlineShoppingCart.FinalCCAmount;if(1==_onlineCheckout.isCheckoutVPLPromocode&&null!=_onlineCheckout.totalfinalAmount&&(a=_onlineCheckout.totalfinalAmount),null!=e("#divcartdepositprice")[0]&&null!=e("#divcartdepositprice")[0].innerHTML){var r=e("#divcartdepositprice")[0].innerHTML.replace(currencysymbol,"");null!=r&&null!=r&&0!=r&&(a=r)}a>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&a<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount&&"Free"!=e("#divfinalTotalPrice")[0].innerHTML&&(1==_siteBuilderDetail.isAffirmEnable?(e("#divVplTracking").hide(),_onlineCheckout.addbankclick()):e("#divVplTracking").show(),e("#VplAmountInterestFreeTxt").text("vagaro pay later. "+e("#VplAmountInterestFree").text())),_onlineCheckout.totalfinalAmount<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount&&_onlineCheckout.totalfinalAmount>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&"Free"==e("#divfinalTotalPrice")[0].innerHTML&&e("#divVplTracking").hide(),e("#VplAmount").length>0&&(e("#VplAmount")[0].innerHTML=currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(_onlineCheckout.totalfinalAmount,!0,2)),1==onlineShoppingCartmain.IsEnableVCFFee&&_onlineCheckout.IsVCFFeeExists()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.displayFinalCalculatedPrice())},_onlineCheckout.OpenVPLTCDialog=function(){var t=JSON.parse(e("#hdnUserDetails").val());String.isNullOrUndefineOrBlank(t.Cell)?_common.PassiveAlertwarning("Please enter moblie phone in my profile."):String.isNullOrUndefineOrBlank(t.EmailId)?_common.PassiveAlertwarning("Please enter email id"):String.isNullOrUndefineOrBlank(t.BirthDate)?_common.PassiveAlertwarning("Please enter birthdate in my profile."):String.isNullOrUndefineOrBlank(t.Street)?_common.PassiveAlertwarning("Please enter full address in my profile."):(e("#lblterms").removeClass("termsConditionText"),e("#divActiveDialog").modal("show"),e("#chkDialogAggree").attr("checked",!1))},_onlineCheckout.ActiveButtonClick=function(t){"btnSaveVplTerms"!=t||e("#chkDialogAggree").is(":checked")?("#btnCancel"!=t&&"#btnClose"!=t||(e("#divActiveDialog").modal("hide"),e("#lblterms").removeClass("termsConditionText")),e("#chkDialogAggree").attr("checked",!1)):e("#lblterms").addClass("termsConditionText")},_onlineCheckout.EnrollUser=function(t){e("#chkDialogAggree").is(":checked")||"btnSaveVplTerms"!=t?(e("#divActiveDialog").modal("hide"),ShowLoader(!0),_onlineCheckout.Addnewbank(),e("#chkDialogAggree").attr("checked",!1)):e("#lblterms").addClass("termsConditionText")},_onlineCheckout.Addnewbank=function(){_onlineCheckout.VPLBankDetailsBind;var t=JSON.parse(e("#hdnUserDetails").val());null==t.CountryName&&(t.CountryName=""),null==t.StateCode&&(t.StateCode=""),_onlineCheckout.customerEnroll.submerchant_id=128789,_onlineCheckout.customerEnroll.UserID=t.UserID,_onlineCheckout.customerEnroll.billing_address={city_locality:t.City,postal_code:t.Zip,line_1:t.Street,line_2:t.StreetNo,country_code:t.CountryName,state_province:t.StateCode},_onlineCheckout.customerEnroll.company_name="",null!=t.BirthDate&&""!=t.BirthDate?(_onlineCheckout.customerEnroll.date_of_birth=moment(t.BirthDate)._d.format("yyyy-mm-dd"),"1-01-01"==_onlineCheckout.customerEnroll.date_of_birth&&(_onlineCheckout.customerEnroll.date_of_birth="1900-01-01")):_onlineCheckout.customerEnroll.date_of_birth="1900-01-01",_onlineCheckout.customerEnroll.email_address=t.EmailId,_onlineCheckout.customerEnroll.email_address_is_verified=!0,_onlineCheckout.customerEnroll.external_customer_id="101",_onlineCheckout.customerEnroll.first_name=t.FirstName,_onlineCheckout.customerEnroll.last_name=t.LastName,_onlineCheckout.customerEnroll.phone_number=t.Cell,_onlineCheckout.customerEnroll.phone_number_is_verified=!0,_onlineCheckout.customerEnroll.merchant_token_id=_shopdetail.MerchantTokenID,null!=ObjBankDetail&&ObjBankDetail.length>0&&!String.isNullOrUndefineOrBlank(ObjBankDetail[0].CertegyTokenID)?_onlineCheckout.customerEnroll.consumer=ObjBankDetail[0].CertegyTokenID:_onlineCheckout.customerEnroll.consumer="",_onlineCheckout.customerEnroll.ClientIP=e("#hdnIPAddress").val(),_vgVPLOnline.EnrollNewUser(_onlineCheckout.customerEnroll)},_onlineCheckout.PaymentSchedule=function(){_vgVPLOnline.PaymentSchedule(onlineShoppingCart.FinalCCAmount,_onlineCheckout.PaymentSchduleSuccess,_onlineCheckout.PaymentSchdulefail)},_onlineCheckout.PaymentSchduleSuccess=function(t){if(void 0!==t&&null!=t){var i=[],a=0;e.grep(t.InstallmentDetails,function(t){var r={};r.Index=a,r.Amount=currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(t.amount,!0,2),r.Date=countryDateFormat(moment(t.date),VagaroCountryDateFormat.SmallDate),i.push(r),0==a&&(e("#VplAmount")[0].innerHTML=r.Amount,e(".duetodayCheckoutScreen").text("Due Today: "+r.Amount),e("#dvCheckoutVplAmt").text(r.Amount)),a++}),e(".timeline-text-div").html(""),e("#tmplPaymentScheduleList").tmpl(i).appendTo(".timeline-text-div")}"0"==e("#finalCheckout").val()?ShowLoader(!1):e("#finalCheckout").val("0")},_onlineCheckout.PaymentSchdulefail=function(e){},_onlineCheckout.isValidCardNotPresent=function(){return!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.IsCardNotPresent)&&1==onlineShoppingCartmain.IsCardNotPresent&&(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0)&&onlineShoppingCart.ccAmt>0},_onlineCheckout.ConvertDecimalWithFixed=function(e,t,i){return isNaN(parseFloat(e))&&(e=0),t?parseFloat(e).toFixed(i):parseFloat(parseFloat(e).toFixed(i))},_onlineCheckout.BindCCDetailForBooking=function(t,i,a){if(ShowLoader(!1),1!=_onlineCheckout.isValidCardNotPresent()){if(e("#dvCheckoutBookingPaymentMethod").show(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).show(),1==_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.invoiceDetails&&(0==_onlineCheckout.IsCCSupportedCountry()||1==_onlineCheckout.IsCCSupportedCountry()&&"false"==IsEnableMerchantAccount.toLowerCase())&&(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divVplTracking").hide()),0==e("#divdepositsdescription").is(":visible")&&0==e("#divCCDescription").is(":visible")&&e("#divcheckoutSelectPaymentMethodTitle").html(_onlineCheckout.arrPaymentTitleType.Select),_onlineCheckout.PromoBox(),null!=t&&null!=t.CreditCardNumber&&("AmericanExpress"!=t.CreditCardType||"False"!=AcceptAmex&&"AmericanExpress"==t.CreditCardType)){e("#dvcheckoutBookingTabs").show(),_onlineCheckout.isCheckoutCCChanged=!1;var r=t.CreditCardNumber;r.length>0||(r=""),e("#dvcheckoutCustomerCCDetail").html(t.CreditCardType+" ending in "+r),e("#tabCheckoutBooking1").attr({"data-ccfirstname":t.CCFirstName,"data-cclastname":t.CCLastName,"data-ccmiddlename":t.CCMiddleName,"data-cardtokenid":t.CardTokenId,"data-creditcardnumber":t.CreditCardNumber,"data-creditcardtype":t.CreditCardType,"data-expmonth":t.ExpMonth,"data-expyear":t.ExpYear,"data-fullname":t.FullName,"data-securitycode":t.SecurityCode}),e("#tabCheckoutBooking1").click(),e("#tabCheckoutBooking1").show(),e("#hdnCheckoutCCTokenID").val(t.CardTokenId)}else e("#tabCheckoutBooking1").hide(),null!=i&&void 0!==i&&0!=i.length||null!=a&&void 0!==a&&0!=a.length||(e("#tabCheckoutBooking2").click(),e("#dvcheckoutBookingTabs").hide(),0==e("#divdepositsdescription").is(":visible")&&0==e("#divCCDescription").is(":visible")&&e("#divcheckoutSelectPaymentMethodTitle").html(_onlineCheckout.arrPaymentTitleType.Default));1==_onlineCheckout.Model.IsPaymentOption&&(void 0===onlineShoppingCart.FinalCCAmount||onlineShoppingCart.FinalCCAmount<=0)&&e("#dvcheckoutBookingTabs").hide();var o=0;e(".ffccdetail").remove(),null!=i&&void 0!==i&&i.length>0&&(e("#familyfriendsCCdetailCheckoutTemplate").tmpl(i).insertAfter("#tabCheckoutBooking1"),o=i.length,null!=t&&void 0!==t||void 0!==a&&null!=a&&0!=a.length||(e("#tabCheckoutBooking3").addClass("first-tab vg-filter-mobile-tab vg-switch-tab-first"),e("#tabCheckoutBooking3").removeClass("mid-tab"),e("#tabCheckoutBooking3").click())),null!=a&&void 0!==a&&a.length>0&&(e.each(a,function(e,t){t.index=o,o++}),e("#familyfriendsCCdetailCheckoutTemplate").tmpl(a).insertAfter("#tabCheckoutBooking1"),void 0!==t&&null!=t||void 0!==i&&null!=i&&0!=i.length||(e("#tabCheckoutBooking3").addClass("first-tab vg-filter-mobile-tab vg-switch-tab-first"),e("#tabCheckoutBooking3").removeClass("mid-tab"),e("#tabCheckoutBooking3").click())),e(_onlineCheckout.Controls.tabGooglePay).hide();try{paymentCheckAvailability("gpay",function(t){1==_shopdetail.IsGooglepayPayment(!0,t)&&e(_onlineCheckout.Controls.tabGooglePay).show()})}catch(t){e(_onlineCheckout.Controls.tabGooglePay).hide()}e(_onlineCheckout.Controls.tabApplePay).hide();try{paymentCheckAvailability("applepay",function(t){1==_shopdetail.IsApplepayPayment(!0,t)&&e(_onlineCheckout.Controls.tabApplePay).show()})}catch(t){e(_onlineCheckout.Controls.tabApplePay).hide()}}else vagaro.alert(_onlineCheckout.CardNotPresentMessage)},_onlineCheckout.SelectedAffirmPaymentMethodDefault=function(){1==_siteBuilderDetail.isAffirmEnable&&1==e("#tabVagaroPayLater").is(":visible")&&0==e("#tabVagaroPayLater").hasClass("w--current")&&e("#tabVagaroPayLater").click()},_onlineCheckout.SaveCardForUser=function(){ShowLoader(!0);var e=new vagaro.ajax;e.datamodel.Token=ApiURLEnumOnlineCheckout.saveuserccdetails,e.datamodel.IsNewVagaroAPI=!0,e.datamodel.callback=function(e){if(ShowLoader(!1),null!=e&&null!=_onlineCheckout.zenSwipeCardDetails&&null!=_onlineCheckout.zenSwipeCardDetails&&(_onlineCheckout.zenSwipeCardDetails.BusinessID=businessID,_onlineCheckout.zenSwipeCardDetails.IsSaveCard=!0),Array.isArray(_onlineCheckout.zenSwipeCardDetails))_onlineCheckout.LoadCCSectionForCheckout(_onlineCheckout.zenSwipeCardDetails);else{var t=[];t.push(_onlineCheckout.zenSwipeCardDetails),_onlineCheckout.LoadCCSectionForCheckout(t)}};var t=null,i=null;void 0!==_onlineCheckout.zenSwipeCardDetails.ExpMonth&&null!=_onlineCheckout.zenSwipeCardDetails.ExpMonth&&""!=_onlineCheckout.zenSwipeCardDetails.ExpMonth&&(t=_onlineCheckout.zenSwipeCardDetails.ExpMonth),void 0!==_onlineCheckout.zenSwipeCardDetails.ExpYear&&null!=_onlineCheckout.zenSwipeCardDetails.ExpYear&&""!=_onlineCheckout.zenSwipeCardDetails.ExpYear&&(i=_onlineCheckout.zenSwipeCardDetails.ExpYear);var a={businessID:businessID,loginUserID:UserID,CCNo:_onlineCheckout.zenSwipeCardDetails.CreditCardNumber,CardType:_onlineCheckout.zenSwipeCardDetails.CreditCardType,CCCode:_onlineCheckout.zenSwipeCardDetails.SecurityCode,LoggedInID:0,CardTokenID:_onlineCheckout.zenSwipeCardDetails.CardTokenId,UCCFirstName:_onlineCheckout.zenSwipeCardDetails.CCFirstName,UCCMiddleName:_onlineCheckout.zenSwipeCardDetails.CCMiddleName,UCCLastName:_onlineCheckout.zenSwipeCardDetails.CCLastName,ExpMonth:t,ExpYear:i,IsCheckUserExists:!0,IsSaveCard:!1};e.datamodel.data=a,e.datamodel.Error=function(e){ShowLoader(!1),_onlineCheckout.LoadCCSectionForCheckout(_onlineCheckout.zenSwipeCardDetails)},e.Post()},_onlineCheckout.GPayApplePaySuccessResponse=function(t){console.log(t);var i={},a={};a.PaymentToken=1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")?""+t:btoa(JSON.stringify(t.token.paymentData)),a.PaymentMethodType=1==e(_onlineCheckout.Controls.tabGooglePay).hasClass("w--current")?PaymentMethod.GooglePay:PaymentMethod.ApplePay,a.LoginUserId=UserID.toString(),_onlineCheckout.isValidForCheckoutInvoice()&&onlineShoppingCart?.invoiceDetails?.InvoiceGridObject?.PayeeId>0&&(a.LoginUserId=onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId),a.MerchantToken=MerchantTokenID,a.SaveCard=!0,a.Device="Online Checkout",i.paymentInfo=[a],i.successCallback=_onlineCheckout.SuccessGoogleAppleTokenInfo,i.FailCallback=_onlineCheckout.FailGoogleAppleTokenInfo,_shopdetail.SaveGoogleAppleToken(i)},_onlineCheckout.SuccessGoogleAppleTokenInfo=function(e){null!=e?(console.log(e),1!=e.IsSuccess||String.isNullOrUndefineOrBlank(e.card_token)?_onlineCheckout.FailGoogleAppleTokenInfo(e):(_onlineCheckout.SetGoogleApplePayCardInfo(e,!0),_onlineCheckout.isValidForCheckoutInvoice()?_onlineCheckout.PayInvoice():_onlineCheckout.ValidateCartData())):_onlineCheckout.FailGoogleAppleTokenInfo()},_onlineCheckout.FailGoogleAppleTokenInfo=function(e){let t="Payment could not be completed.";if(e){if(5006===e.custom_code)t="The card entered is invalid or got declined, Please contact business or try another card.";else if(6001===e.custom_code)t=e.subResponseCode+" - "+e.subResponseMessage;else if(e.message&&""!==e.message.trim()){let i="";e.subResponseCode&&""!==e.subResponseCode.trim()&&(i="<br/>Error Code: "+e.paymentGateway+"-"+e.subResponseCode),t=e.message+i}}else t="Some error occured, Please try again!. ErrorCode: 1009";_siteBuilderDetail.PaymentErrorHandler(t)},_onlineCheckout.SetGoogleApplePayCardInfo=function(t,i){void 0!==_onlineCheckout.ccCardOnFile&&null!=_onlineCheckout.ccCardOnFile||(_onlineCheckout.ccCardOnFile={}),t&&"string"!=typeof t||(t={});var a=_shopdetail.getFirstMiddleLastName(t);_onlineCheckout.ccCardOnFile.CCFirstName=a.first_name,_onlineCheckout.ccCardOnFile.CCLastName=a.last_name,_onlineCheckout.ccCardOnFile.CCMiddleName=a.middle_name,_onlineCheckout.ccCardOnFile.CardTokenId=_onlineCheckout.safeValue(t.card_token),_onlineCheckout.ccCardOnFile.CreditCardNumber=_onlineCheckout.safeValue(t.cc_no),_onlineCheckout.ccCardOnFile.CreditCardType=_onlineCheckout.safeValue(t.cc_type),_onlineCheckout.ccCardOnFile.ExpMonth=_onlineCheckout.safeValue(t.expire_month),_onlineCheckout.ccCardOnFile.ExpYear=_onlineCheckout.safeValue(t.expire_year),_onlineCheckout.ccCardOnFile.FullName=a.full_name,_onlineCheckout.ccCardOnFile.SecurityCode="",_onlineCheckout.ccCardOnFile.IsTokenGenerated=i,e("#hdnCCTokenID").val(_onlineCheckout.ccCardOnFile.CardTokenId),_onlineCheckout.ccCardOnFile.IsSaveCard=!0,_onlineCheckout.isCheckoutCCChanged=!1},_onlineCheckout.safeValue=function(e){return null==e||"string"==typeof e&&""===e.trim()?"":e},_onlineCheckout.BookTabClick=function(t){e("#hdnCheckCCAdressISExist").val("true"),e("#creditcardiframe_checkoutccaddress").html(""),_onlineCheckout.isCheckoutVPLChanged=!1;var i="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:"1";if(6==t||7==t)e("#creditcardiframe_checkoutcart").html(""),_onlineCheckout.SetGoogleApplePayCardInfo(null,!1);else if(2==t)_onlineCheckout.LoadBalnkCCFrame(),_onlineCheckout.isCheckoutCCChanged=!0,_onlineCheckout.VPLmessagedeposit(_onlineCheckout.totalfinalAmount),e("#divVplTracking").hide();else if(0==t)_onlineCheckout.isCheckoutVPLChanged=!0,e("#dvVPLdeposit").hide(),e("#VPLImageaftrdeposit").css("display","none"),e("#VPLImageBfrdeposit").css("display","none"),e("#dvVPLTotal").hide(),e("#VPLImageaftr").css("display","none"),e("#VPLImageBfr").css("display","none"),e("#VPLImageBfr1").css("display","none"),e("#VPLImageaftr1").css("display","none"),e("#creditcardiframe_checkoutcart").html("");else if(2==t||void 0===_onlineCheckout.ccCardOnFile||null==_onlineCheckout.ccCardOnFile||String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId)||"2"==i)_onlineCheckout.isCheckoutCCChanged=!1,_onlineCheckout.VPLmessagedeposit(_onlineCheckout.totalfinalAmount),e("#divVplTracking").hide();else{_onlineCheckout.isCheckoutCCChanged=!1,ShowLoader(!0);var a={CardTokenId:_onlineCheckout.ccCardOnFile.CardTokenId};a.UserID=UserID;var r=new vagaro.ajax;r.datamodel.Token="CheckCCAdressISExist",r.datamodel.data=a,r.datamodel.Error=function(e){ShowLoader(!1)},r.datamodel.callback=function(t){ShowLoader(!1),null!=t&&1e3==t.custom_code&&0==t.data?(_onlineCheckout.isCheckoutCCChanged=!0,e("#hdnCheckCCAdressISExist").val(t.data),_onlineCheckout.LoadBalnkCCFrame()):null!=t&&1e3==t.custom_code&&1==t.data&&(e("#creditcardiframe_checkoutcart").html(""),e("#creditcardiframe_checkoutccaddress").html(""))},r.Post()}},_onlineCheckout.LoadBalnkCCFrame=function(){"true"==isWidget.toLowerCase()||"true"==isFacebook.toLowerCase()?backGroundColor=WidgetTabBackgroundColor:"true"==isCustomWebsite.toLowerCase()||"true"==isWidget.toLowerCase()||"true"==isFacebook.toLowerCase()?backGroundColor=TabBackgroundColor:"undefined"!=typeof isPromotionUI&&"true"==isPromotionUI.toLowerCase()&&(backGroundColor=PatternColor),e("#creditcardiframe_checkoutcart").html(""),e("#creditcardiframe_checkoutccaddress").html(""),vui.loader=ShowLoader,vui.ccCountryId="undefined"!=typeof countryIdBusDetail?countryIdBusDetail:"1";var t=void 0!==e("#hdnIsNewCCIframe").val()&&""!=e("#hdnIsNewCCIframe").val()&&JSON.parse(e("#hdnIsNewCCIframe").val()),i=!(void 0!==e("#hdnCheckCCAdressISExist").val()&&!String.isNullOrUndefineOrBlank(e("#hdnCheckCCAdressISExist").val()))||JSON.parse(e("#hdnCheckCCAdressISExist").val()),a=void 0===_onlineCheckout.ccCardOnFile||null==_onlineCheckout.ccCardOnFile||String.isNullOrUndefineOrBlank(_onlineCheckout.ccCardOnFile.CardTokenId)?"":_onlineCheckout.ccCardOnFile.CardTokenId;if(i||String.isNullOrUndefineOrBlank(a)){var r="undefined"!=typeof GetTrackData?GetTrackData():"";1==_onlineCheckout.IsLoadCCIframForMemrship()?vui.getTypeWithoutButton("creditcardiframe_checkoutcart",1==t?260:160,MerchantTokenID,"","",1,"online checkout",!0,"",r,void 0,!0):vui.getTypeWithoutButtonAndAuthorization("creditcardiframe_checkoutcart",1==t?260:160,MerchantTokenID,"100%","",1,"online checkout",!1,"",r,!0)}else vui.getTypeFrameForCCAddress("creditcardiframe_checkoutccaddress",1==t?260:160,MerchantTokenID,"","",1,"online checkout",!0,"",!0,a,!0)},_onlineCheckout.SetClassSuccessDetails=function(t,i){try{var a=[],r=0,o="",n="",s="",l=!1,d=_onlineCheckout.getServiceProviderForBusiness();e.grep(i,function(t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&e.grep(t.eventEnrollment,function(i){var c=new Date(i.eventDate).format(_onlineCheckout.DateFormatdddMMM_ddYYYY),u=new Date(i.eventDate).format(_onlineCheckout.DateFormatdddMMM_ddYYYY),p=i.startTime.replace(/^0+/,""),h="";String.isNullOrUndefineOrBlank(i.CustomerTimeZone)||(c=moment(i.CustomerStartTime).format(_onlineCheckout.DateFormatdddMMMDDYYYY),u=moment(i.CustomerStartTime).format(_onlineCheckout.DateFormatdddMMMDDYYYY),p=moment(i.CustomerStartTime).format("h:mm A"),h=" ("+i.CustomerTimeZone+")");var m={};if(m.autoId=r,m.date=c,m.dateLable=u,m.time=p+h,m.image=i.SpPhoto,m.servicename=t.eventName,void 0!==d&&null!=d&&""!=d&&d.length>0)var f=e.grep(d,function(e){if(e.UserID==i.sPID)return e.FirstName+" "+e.LastName});if(void 0!==f&&null!=f&&""!=f&&f.length>0?m.spname=f[0].FullName:m.spname=i.sPName,m.ZoomURL=i.ZoomURL,m.IsFromHomePage=!1,m.cFirstName=i.cFirstName,m.cLastName=i.cLastName,m.UserId=i.customerID,m.appointmentID=i.appointmentID,String.isNullOrUndefineOrBlank(i.IsFromHomePage)||1!=i.IsFromHomePage||(m.IsFromHomePage=!0),void 0!==f&&null!=f&&""!=f&&f.length>0&&null!=f[0].Photo&&""!=f[0].Photo&&(m.image=f[0].CDNUrl+"155x155/"+f[0].Photo),m.spinit=FindInitials(i.sPName,"SP"),1==i.StreamingStatus?m.LiveStreamingStatus=!0:m.LiveStreamingStatus=!1,m.ShowLiveStream=!1,m.lstAddonService=[],null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0)for(var g=0;g<i.lstAddonService.length;g++)m.lstAddonService.push({AddonName:i.lstAddonService[g].ServiceTitle});a.push(m),""==n?(n=m.date,l=!1):m.date!=n&&(l=!0),o=moment(i.eventDate),""==s&&(s=moment(t.eventEnrollment[0].eventDate)),String.isNullOrUndefineOrBlank(i.CustomerTimeZone)||(o=moment(i.CustomerStartTime),s=moment(i.CustomerStartTime)),r++})}),"true"==isWidget&&w_type==(_siteBuilderDetail.WidgetTypeEnum.Embedded||_siteBuilderDetail.WidgetTypeEnum.Popup)&&e("#btnviewBusiness").hide();var c=e("#divClassBookSuccess");e("#classDateBox").hide(),0==l?(e("#classDateBox").show(),c.find(".booked-month").html(o.format("MMM").toUpperCase()).attr("aria-hidden",!0),c.find("#classDateBox").attr("aria-label",o.format("MMMM").toUpperCase()+","+o.format("D")).attr("role","banner"),c.find("#divDatemonth").attr("aria-label",o.format("MMMM")+","+o.format("D")).attr("role","banner"),c.find(".booked-date").html(o.format("D")).attr("aria-hidden",!0),c.find("#divstatusicon").attr("class","green-circle-div").attr("aria-hidden",!0).html("&#xf00c;")):void 0!==s&&null!=s&&""!=s&&(e("#classDateBox").show(),c.find(".booked-month").html(s.format("MMM").toUpperCase()).attr("aria-hidden",!0),c.find(".booked-date").html(s.format("D")).attr("aria-hidden",!0),c.find("#classDateBox").attr("aria-label",s.format("MMMM").toUpperCase()+","+s.format("D")).attr("role","banner"),c.find("#divstatusicon").attr("class","green-circle-div").attr("aria-hidden",!0).html("&#xf00c;"));var u=[],p=[],h=[],m="You've booked classes for ";e.grep(a,function(e){return h.push(e.UserId)}),e.grep(a,function(t){var i=e.grep(p,function(e){if(e==t.UserId)return e}),a=e.grep(u,function(e){if(e==t.cFirstName+" "+t.cLastName)return e});if(parseInt(UserID)!=t.UserId&&0==i.length&&0==a.length)return p.push(t.UserId),u.push(t.cFirstName+" "+t.cLastName)});var f="";e.grep(u,function(e,t){0==t?f+=e:t==u.length-1?f+=" and "+e:f+=" , "+e}),m+=f+".",t?r>1?void 0!==u&&null!=u&&""!=u&&u.length>0?_onlineCheckout.hideShowClassSuccessMessage(m,!0,"signed up",!1,a):_onlineCheckout.hideShowClassSuccessMessage(m,!1,"signed up",!0,a):parseInt(UserID)!=a[0].UserId?_onlineCheckout.hideShowClassSuccessMessage(m,!1,"signed up",!1,a):_onlineCheckout.hideShowClassSuccessMessage(m,!1,"signed up",!0,a):r>1?void 0!==u&&null!=u&&""!=u&&u.length>0?_onlineCheckout.hideShowClassSuccessMessage(m,!0,"checkout",!1,a):_onlineCheckout.hideShowClassSuccessMessage(m,!1,"checkout",!0,a):parseInt(UserID)!=a[0].UserId?_onlineCheckout.hideShowClassSuccessMessage(m,!1,"checkout",!1,a):_onlineCheckout.hideShowClassSuccessMessage(m,!1,"checkout",!0,a),c.find("#divapptparagraphtext").html("You're all set with "+businessName+"."),e("#divclassbooking").html(""),e("#divtempclassbooking").tmpl(a).appendTo("#divclassbooking"),e(".apptproviderimg").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),e("#divClassBookSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;");var g=e.grep(a,function(e){return 1==e.LiveStreamingStatus});void 0!==g&&null!=g&&""!=g&&g.length>0?e(".booknow-live-box").show():e(".booknow-live-box").hide(),"undefined"!=typeof vgAppicationType&&vgAppicationType,"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&void 0!==_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&null!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&""!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&1==("true"==isWidget&&w_type==(_siteBuilderDetail.WidgetTypeEnum.Embedded||_siteBuilderDetail.WidgetTypeEnum.Popup))&&_onlineCheckout.continueShoping()}catch(i){t?(e("#dvCheckoutSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),e("#dvCheckoutSuccessMSG").html("Successful Enrollment."),e("#dvCheckoutSuccessMSG1").hide()):(e("#dvCheckoutSuccess").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),e("#dvCheckoutSuccessMSG").html("Successful Checkout"),1==_onlineCheckout.isCheckoutVPLChanged?1==_siteBuilderDetail.isAffirmEnable?(e("#dvCheckoutSuccessMSG1").show(),e("#dvCheckoutVplAmt").hide(),e("#dvCheckoutVplPart").hide(),e("#dvCheckoutVplMsg").hide()):(e("#dvCheckoutSuccessMSG1").hide(),e("#dvCheckoutVplAmt").show(),e("#dvCheckoutVplPart").show(),e("#dvCheckoutVplMsg").show()):e("#dvCheckoutSuccessMSG1").show().css("display","flex"))}},_onlineCheckout.getServiceProviderForBusiness=function(){var e=[],t={};t.businessId=_shopdetail.businessID,t.userType=5,t.isAdmin=!1,t.viewHisOwnReports=!1,t.viewOtherReports=!1;var i=new vagaro.ajax;return i.datamodel.Token="GetServiceProviders",i.datamodel.data=t,i.datamodel.ErrorMessage="",i.datamodel.async=!1,i.datamodel.callback=function(t){e=t},i.datamodel.Error=function(e){},i.Post(),e},_onlineCheckout.hideShowClassSuccessMessage=function(t,i,a,r,o){"checkout"==a&&(a="Checked Out.");var n="You're "+a,s=e("#divClassBookSuccess"),l="divClassSuccessMessageForFriend";r?(s.find("#"+l).hide(),s.find("#divappttitletext").html(n)):0==i&&0==r?(s.find("#divappttitletext").html(o[0].cFirstName+" is "+a+" for the class."),s.find("#"+l).show(),s.find("#"+l).html("You booked class for "+o[0].cFirstName+" "+o[0].cLastName+".")):i&&(s.find("#divappttitletext").html(n),s.find("#"+l).show(),s.find("#"+l).html(t))},onZSDownCallback=function(t){var i="";if(_onlineCheckout.ApplyAuthResultFromResponse(t),void 0!==t&&void 0!==t.data&&null!=t.data&&void 0!==t.data.Message&&""!==t.data.Message&&"5006"==t.data.custom_code)i="The card entered is invalid or got declined, Please contact business or try another card.";else if(void 0!==t&&void 0!==t.data&&null!=t.data&&void 0!==t.data.Message&&""!==t.data.Message){var a="";null!=t.data.subResponseCode&&""!=t.data.subResponseCode&&(a="<br/>Error Code:"+t.data.paymentGateway+"-"+t.data.subResponseCode),i=t.data.Message+a}else i=void 0!==t&&void 0!==t.Message&&null!=t.Message&&""!==t.Message?t.Message:void 0!==t&&null!=t&&6001==t.custom_code?t.subResponseCode+" - "+t.subResponseMessage:"Some error occured, Please try again!. ErrorCode: 1010";var r="";r=e("#hdnIsFromPage").length>0&&"shopdetail"==e("#hdnIsFromPage").val()?"Book247CCDetails":"creditcardiframe_checkoutcart",e("#"+r).html("");var o=GetHTMLDummyFrame();e("#"+r).html(o),e("#"+r).show(),ShowLoader(!1),swal({title:"",text:i,showCancelButton:!1,html:!0},function(e){P(t)})},onGetTokenCallback=function(t){if(ShowLoader(!1),_onlineCheckout.ApplyAuthResultFromResponse(t),1e3==t.data.custom_code){var i=!(void 0!==e("#hdnCheckCCAdressISExist").val()&&!String.isNullOrUndefineOrBlank(e("#hdnCheckCCAdressISExist").val()))||JSON.parse(e("#hdnCheckCCAdressISExist").val());e("#hdnIsFromPage").length>0&&"shopdetail"==e("#hdnIsFromPage").val()?(i||void 0===t.data.data||1!=t.data.data?ZenSwipeCardDetails=t.data.data:(isCCChanged=!1,e("#hdnCheckCCAdressISExist").val("true")),_shopdetail.ValidateBookingDataWithCC()):e("#hdnIsFromPage").length>0&&"cancelfromcheckinapp"==e("#hdnIsFromPage").val()?(ZenSwipeCardDetails=t.data.data,validateCCCaptureCancellation()):(i||void 0===t.data.data||1!=t.data.data?_onlineCheckout.zenSwipeCardDetails=t.data.data:(_onlineCheckout.isCheckoutCCChanged=!1,e("#hdnCheckCCAdressISExist").val("true")),_onlineCheckout.SaveOnlineCheckout())}else onZSDownCallback(t)},onOpenedCallback=function(t){if(e("#hdnIsFromPage").length>0&&"shopdetail"==e("#hdnIsFromPage").val()){var i=_IsPrepay?_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount:0;"0"!=parseFloat(i)||!_IsPrepay||"false"!=e("#hdnIsCCCapturedAllowed").val().toLowerCase()||"undefine"!=typeof _IsPaymentOption&&0!=_IsPaymentOption?e("#dvBookingPaymentMethod").show():e("#dvBookingPaymentMethod").hide()}else e("#hdnIsFromPage").length>0&&("cancelappointment"==e("#hdnIsFromPage").val()||"cancelfromcheckinapp"==e("#hdnIsFromPage").val())?(e("#divCancelCCCaptureAppoitmentModalBody").animate({scrollTop:e("#divCancelCCCaptureAppoitmentModalBody").prop("scrollHeight")},100),e("#dvPaymentFailedSaveCCCheckbox").show(),e("#dvPaymentFailedSecuredVagaro").show()):(e("#dvCheckoutBookingPaymentMethod").show(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).show(),1==_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.invoiceDetails&&(0==_onlineCheckout.IsCCSupportedCountry()||1==_onlineCheckout.IsCCSupportedCountry()&&"false"==IsEnableMerchantAccount.toLowerCase())&&(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divVplTracking").hide()),void 0===_onlineCheckout.Model||String.isNullOrUndefineOrBlank(_onlineCheckout.Model)||1==_onlineCheckout.Model.IsPaymentOption&&(void 0===onlineShoppingCart.FinalCCAmount||onlineShoppingCart.FinalCCAmount<=0)&&(e("#dvcheckoutBookingTabs").hide(),e("#creditcardiframe_checkoutcart").html("")),_onlineCheckout.PromoBox());"undefined"!=typeof AcceptAmex&&"false"==AcceptAmex.toLowerCase()&&vui.frame.zenswipe.removeCardOption("amex"),ShowLoader(!1)},_onlineCheckout.ValidateCCforCheckout=function(){return null!=_onlineCheckout.zenSwipeCardDetails&&null!=_onlineCheckout.zenSwipeCardDetails.card_token||1!=_onlineCheckout.isCheckoutCCChanged||(ShowLoader(!0),vui.frame.zenswipe.submit()),!1},_onlineCheckout.PrintPopup=function(e,t){var i=window.open(e,"","left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0,resizable=1");!i||i.closed||void 0===i||void 0===i.closed?vagaro.alert(t):i&&navigator&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(i.onload=function(){setTimeout(function(){_onlineCheckout.CheckChromePopup(i,t)},40)})},_onlineCheckout.getParameterFromUrl=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))},_onlineCheckout.CheckChromePopup=function(e,t){0===e.screenX&&(vagaro.alert(t),e.close())},_onlineCheckout.CustomPackageAddToCart=function(t,i,a){var r=e(t).closest(".srvdtls");r.attr("data-noofvisit",i),r.attr("data-iscustompackage",!0),_onlineCheckout.ServiceAddToCart(t,a)},_onlineCheckout.rebindCartDataAfterPartialCheckOut=function(){String.isNullOrUndefineOrBlank(onlineShoppingCartmain)||((String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Inventories)||!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Inventories)&&0==onlineShoppingCartmain.Inventories.length)&&e('.cartremoverdtl[data-type="inventory"]').hide(),(String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Packages)||!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Packages)&&0==onlineShoppingCartmain.Packages.length)&&e('.cartremoverdtl[data-type="servicepackage"]').hide(),(String.isNullOrUndefineOrBlank(onlineShoppingCartmain.GiftCertificates)||!String.isNullOrUndefineOrBlank(onlineShoppingCartmain.GiftCertificates)&&0==onlineShoppingCartmain.GiftCertificates.length)&&e('.cartremoverdtl[data-type="gc"]').hide(),(String.isNullOrUndefineOrBlank(onlineShoppingCart.Memberships)||!String.isNullOrUndefineOrBlank(onlineShoppingCart.Memberships)&&0==onlineShoppingCart.Memberships.length)&&e('.cartremoverdtl[data-type="membership"]').hide(),(String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)||!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&0==onlineShoppingCart.Events.length)&&e("#newCartSummaryDectail123").hide(),_onlineCheckout.loadPage())},_onlineCheckout.appendMembership=function(e){return-1==e.toLowerCase().indexOf("membership")&&(e+=" Membership"),e},_onlineCheckout.RemovePromoCode=function(t){e("#txtPromoCode").val("");var i=e.grep(onlineShoppingCart.lstPromotionData,function(e){return e.PromotionID==t});if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){var a=e.grep(i,function(e){return 2==e.ItemTypeID});a.length>0&&(_onlineCheckout.RemovePresetDiscountOnProducts(onlineShoppingCart.Inventories,a,t),_onlineCheckout.ApplyRemovePromoCodeOnBundle())}if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var r=e.grep(i,function(e){return 3==e.ItemTypeID||1==e.ItemTypeID||19==e.ItemTypeID});r.length>0&&_onlineCheckout.RemovePresetDiscountOnPackages(onlineShoppingCart.Packages,r,t)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0){var o=e.grep(i,function(e){return 7==e.ItemTypeID});o.length>0&&_onlineCheckout.RemovePresetDiscountOnMemberships(onlineShoppingCart.Memberships,o,t)}if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()){var n=e.grep(i,function(e){return 8==e.ItemTypeID||e.ItemTypeID==d.ClassAddons});n.length>0&&_onlineCheckout.RemovePresetDiscountOnEvents(onlineShoppingCart.Events,n,t)}if(null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0){var s=e.grep(i,function(e){return 5==e.ItemTypeID});s.length>0&&_onlineCheckout.RemovePresetDiscountOnGC(onlineShoppingCart.GiftCertificates,s,t)}var l=e.grep(onlineShoppingCart.lstPromotionData,function(e){return e.PromotionID!=t}),c=e.grep(onlineShoppingCart.lstPromoDetails,function(e){return e.PromotionID!=t});onlineShoppingCart.lstPromotionData=l,onlineShoppingCart.lstPromoDetails=c,_onlineCheckout.RemovePromoCodeDiv(t),_onlineCheckout.RecalcGCONAllItemsAfterPreset(),1==onlineShoppingCartmain.IsEnableVCFFee&&_onlineCheckout.IsVCFFeeExists()?(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.ReApplyDiscounts(!0),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.RemovePromoCode)):_onlineCheckout.ReApplyDiscounts(!0)},_onlineCheckout.txtPromoCodeClick=function(){e(".divPromoCode_0").hide()},_onlineCheckout.txtPromoCodeKeypress=function(t){13==t.which?(t.preventDefault(),_onlineCheckout.ValidatePromoCode()):e("#txtPromoCode").removeClass("errorInput")},_onlineCheckout.ValidatePromoCode=function(){var t=e("#txtPromoCode").val();if(""==t.trim())return e("#txtPromoCode").val(""),void e("#txtPromoCode").addClass("errorInput");ShowLoader(!0);var i={};i.PromotionCode=t,i.businessID=businessID,i.loginUserID=UserID,i.CartAmount=_onlineCheckout.ShoppingCartAmount(),i.IsNewCustomer=_onlineCheckout.IsThisNewCustomer,i.ServiceIDs=_onlineCheckout.ShoppingCartItemIds(!0,1);var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumOnlineCheckout.validatepromocodeandgetdetails,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(i){if(ShowLoader(!1),void 0!==i&&null!=i){if(200==i.ResponseID)if(null!=i.PromotionDataList&&i.PromotionDataList.length>0){if(e.grep(onlineShoppingCart.lstPromotionData,function(e){return e.PromotionID==i.PromotionDataList[0].PromotionID}).length>0)return _onlineCheckout.CreatePromoCodeDiv("twise",t.toUpperCase(),"This discount has already been applied.",!1),void e("#txtPromoCode").val("");_onlineCheckout.ApplyPromoCodeOnCart(i.PromotionDataList,!0,t,i.PromotionDesc,i.PerTransactionOne,!0)}else _onlineCheckout.CreatePromoCodeDiv("0",t.toUpperCase(),"Discount cannot be used for any items in this cart.",!1);else{var a=UserType;_onlineCheckout.GCPromoCodeLimt(onlineShoppingCart.loginUserId,a,t.toUpperCase(),"CheckPromoNumber")}e("#txtPromoCode").val(""),_onlineCheckout.IsVCFEnable()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.ApplyPromoCode))}},a.datamodel.data=i,a.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},a.Post()},_onlineCheckout.ApplyPromoCodeOnCart=function(t,i,a,r,o,n){if(1!=_onlineCheckout.IsValidateForPromoCode()&&null!=t){var s=!1,l=null;if(1==o&&(l=_onlineCheckout.GetApplicableItemForOnePerUser(t)),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){var c=e.grep(t,function(e){return 2==e.ItemTypeID});c.length>0&&1==_onlineCheckout.ApplyPresetDiscountOnProducts(onlineShoppingCart.Inventories,c,l)&&(s=!0,_onlineCheckout.ApplyRemovePromoCodeOnBundle())}if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var u=e.grep(t,function(e){return 3==e.ItemTypeID||1==e.ItemTypeID||19==e.ItemTypeID});u.length>0&&1==_onlineCheckout.ApplyPresetDiscountOnPackages(onlineShoppingCart.Packages,u,l)&&(s=!0)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0){var p=e.grep(t,function(e){return 7==e.ItemTypeID});p.length>0&&1==_onlineCheckout.ApplyPresetDiscountOnMemberships(onlineShoppingCart.Memberships,p,l)&&(s=!0)}if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()){var h=e.grep(t,function(e){return 8==e.ItemTypeID||e.ItemTypeID==d.ClassAddons});h.length>0&&1==_onlineCheckout.ApplyPresetDiscountOnEvents(onlineShoppingCart.Events,h,i,l)&&(s=!0)}if(null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0){var m=e.grep(t,function(e){return 5==e.ItemTypeID});m.length>0&&1==_onlineCheckout.ApplyPresetDiscountOnGC(onlineShoppingCart.GiftCertificates,m,l)&&(s=!0)}if(1==i||1==n)if(0==s)_onlineCheckout.CreatePromoCodeDiv(t[0].PromotionID,a.toUpperCase(),"Discount cannot be used for any items in this cart.",!1);else{onlineShoppingCart.lstPromotionData=onlineShoppingCart.lstPromotionData.concat(t),_onlineCheckout.CreatePromoCodeDiv(t[0].PromotionID,a.toUpperCase(),r,!0),_onlineCheckout.RemoveUnusedPromocode(t[0].PromotionID);var f={};f.PromotionID=t[0].PromotionID,f.PromoCodeStr=a.toUpperCase(),f.msg=r,f.PeruserOne=o,f.PerTransactionOne=o,onlineShoppingCart.lstPromoDetails.push(f)}_onlineCheckout.RecalcGCONAllItemsAfterPreset(),_onlineCheckout.ReApplyDiscounts(!0)}},_onlineCheckout.ApplyRemovePromoCodeOnBundle=function(){e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId});i.OriginalPrice=0,i.Price=0,i.isPresetApply=!1,e.each(a,function(e,t){i.OriginalPrice+=t.OriginalPrice,i.Price+=t.Price,i.isPresetApply=1==i.isPresetApply||t.isPresetApply})}})},_onlineCheckout.GetApplicableItemForOnePerUser=function(t){var a=!1,r={},o=0;return null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(i){var n=e.grep(t,function(e){return e.ServiceID==i.InventoryId&&2==e.ItemTypeID}),s=e.grep(onlineShoppingCartmain.Inventories,function(e){return e.autoId==i.autoId});if(null!=n&&n.length>0){n=n[0];var l=s[0].Price,d=0;1!=i.isPointApply&&(0==n.IsAmount?d=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(l/i.Quantity*n.DiscountValue/100,2),2):(d=_onlineCheckout.parseTodecimal(n.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(d=parseFloat(ConvertTodecimalMorePrecious(parseFloat(d)/(1+i.Tax/100),!0,4)))),l/i.Quantity<d&&(d=l)),d>o&&(o=d,r.autoId=i.autoId,r.EnrollAutoID=0,a=!0)}}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(i){var n=e.grep(t,function(e){return e.ServiceID==i.ServiceId&&3==e.ItemTypeID&&4==i.eventType||e.ServiceID==i.ServiceId&&1==e.ItemTypeID&&1==i.eventType}),s=e.grep(onlineShoppingCartmain.Packages,function(e){return e.autoId==i.autoId});if(null!=n&&n.length>0){n=n[0];var l=s[0].Price,d=0;0==n.IsAmount?d=_onlineCheckout.parseTodecimal(l*n.DiscountValue/100,2):(d=_onlineCheckout.parseTodecimal(n.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(d=parseFloat(ConvertTodecimalMorePrecious(parseFloat(d)/(1+i.Tax/100),!0,4))));i.NoOfVisit;i.SellPackageServiceID>0&&1,l-d<0&&(d=l),d>o&&(o=d,r.autoId=i.autoId,r.EnrollAutoID=0,a=!0)}}),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(i){var n=e.grep(t,function(e){return e.ServiceID==i.MembershipId&&7==e.ItemTypeID}),s=e.grep(onlineShoppingCartmain.Memberships,function(e){return e.autoId==i.autoId});if(null!=n&&n.length>0){n=n[0];var l=s[0].Price,d=0;0==n.IsAmount?d=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(l*n.DiscountValue/100,2),2):(d=_onlineCheckout.parseTodecimal(n.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(d=parseFloat(ConvertTodecimalMorePrecious(parseFloat(d)/(1+i.Tax/100),!0,4)))),l<d&&(d=l),d>o&&(o=d,r.autoId=i.autoId,r.EnrollAutoID=0,a=!0)}}),null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()&&e.grep(onlineShoppingCart.Events,function(n){var s=e.grep(t,function(e){return e.ServiceID==n.eventID&&8==e.ItemTypeID}),l=e.grep(onlineShoppingCartmain.Events,function(e){return e.autoId==n.autoId});if(null!=s&&s.length>0){s=s[0];e.grep(n.eventEnrollment,function(t){var d=e.grep(l[0].eventEnrollment,function(e){return e.autoID==t.autoID})[0].actualPrice,c=0,u=s.ServiceProviderIDs,p=t.sPID;for(i=0;i<u.split(",").length;i++)p==u.split(",")[i]&&!0;var h=moment(t.workshopActualDate),m=moment(s.StartDate.replace("A"," A").replace("P"," P")),f=moment(s.EndDate.replace("A"," A").replace("P"," P"));m.diff(h,"min"),""!=s.EndDate&&f.diff(h,"min"),1!=t.isPointApply&&1!=t.isPackage&&(0==s.IsAmount?c=_onlineCheckout.parseTodecimal(d*s.DiscountValue/100,2):(c=_onlineCheckout.parseTodecimal(s.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(c=parseFloat(ConvertTodecimalMorePrecious(parseFloat(c)/(1+n.tax/100),!0,4)))),d<c&&(c=d),c>o&&(o=c,r.autoId=n.autoId,r.EnrollAutoID=t.autoID,a=!0))})}}),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&e.grep(onlineShoppingCart.GiftCertificates,function(i){var n=e.grep(t,function(e){return e.Price==i.TotalPrice&&5==e.ItemTypeID}),s=e.grep(onlineShoppingCartmain.GiftCertificates,function(e){return e.autoId==i.autoId});if(null!=n&&n.length>0){n=n[0];var l=s[0].Price,d=0;0==n.IsAmount?d=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(l*n.DiscountValue/100,2),2):(d=_onlineCheckout.parseTodecimal(n.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(d=parseFloat(ConvertTodecimalMorePrecious(parseFloat(d)/(1+i.Tax/100),!0,4)))),l<d&&(d=l),d>o&&(o=d,r.autoId=i.autoId,r.EnrollAutoID=0,a=!0)}}),a||(r=null),r},_onlineCheckout.ShowPromoCodeErrorMessage=function(e,t){},_onlineCheckout.ApplyPresetDiscountOnProducts=function(t,i,a){var r=!1;return e.grep(t,function(t){if(null!=a&&t.autoId+"0"==a.autoId.toString()+a.EnrollAutoID.toString()||null==a){var o=e.grep(i,function(e){return e.ServiceID==t.InventoryId&&2==e.ItemTypeID}),n=e.grep(onlineShoppingCartmain.Inventories,function(e){return e.autoId==t.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;if(void 0!==t.isPresetApply&&t.isPresetApply,1!=t.isPointApply){if(1==t.isMembershipApply){var c=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==t.MembershipID&&3==e.ItemType&&e.MembershipItemId==t.InventoryId});null!=c&&c.length>0&&1==c[0].IsAllowPreSetDiscount?l=_onlineCheckout.parseTodecimal(s*c[0].Discount/100,2):_onlineCheckout.RemoveDicount(d.Product,4,t.autoId)}if(0==o.IsAmount)if(null!=a){var u=0,p=_onlineCheckout.parseTodecimal(s/t.Quantity*o.DiscountValue/100,2);l/t.Quantity+p>s/t.Quantity&&(u=l/t.Quantity+p-s/t.Quantity),l=_onlineCheckout.parseTodecimal(l+_onlineCheckout.parseTodecimal(s/t.Quantity*o.DiscountValue/100,2),2),l-=u}else l=_onlineCheckout.parseTodecimal(l+_onlineCheckout.parseTodecimal(s*o.DiscountValue/100,2),2);else{if(null!=a){u=0,p=_onlineCheckout.parseTodecimal(o.DiscountValue,2);l/t.Quantity+p>s/t.Quantity&&(u=l/t.Quantity+p-s/t.Quantity),l=_onlineCheckout.parseTodecimal(l+o.DiscountValue,2),l-=u}else l=_onlineCheckout.parseTodecimal(l+o.DiscountValue*t.Quantity,2);void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(l=parseFloat(ConvertTodecimalMorePrecious(parseFloat(l)/(1+t.Tax/100),!0,4)))}s<l&&(l=s),t.discount=l,t.Price=_onlineCheckout.parseTodecimal(s-t.discount,2),t.ActualPrice=t.Price,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),t.isPresetApply=!0,t.isPointApply=!1,t.DiscountID=o.PromotionID,t.IsAmount=o.IsAmount,t.AmountValue=o.DiscountValue,r=!0}}}}),r},_onlineCheckout.ApplyPresetDiscountOnPackages=function(t,i,a){var r=!1;return e.grep(t,function(t){if(null!=a&&t.autoId+"0"==a.autoId.toString()+a.EnrollAutoID.toString()||null==a){var o=e.grep(i,function(e){return e.ServiceID==t.ServiceId&&3==e.ItemTypeID&&4==t.eventType||e.ServiceID==t.ServiceId&&1==e.ItemTypeID&&1==t.eventType}),n=e.grep(onlineShoppingCartmain.Packages,function(e){return e.autoId==t.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;0!=t.PromotionID&&(t.PromotionID=0),0==o.IsAmount?l=_onlineCheckout.parseTodecimal(l+s*o.DiscountValue/100,2):(l=_onlineCheckout.parseTodecimal(l+o.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(l=parseFloat(ConvertTodecimalMorePrecious(parseFloat(l)/(1+t.Tax/100),!0,4))));var d=t.NoOfVisit;t.SellPackageServiceID>0&&(d=1),s-l<0&&(l=s),t.discount=null!=a?l:l*d,t.Price=_onlineCheckout.parseTodecimal(s*d-t.discount,2),t.ActualPrice=t.Price,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),t.isPresetApply=!0,t.DiscountID=o.PromotionID,t.IsAmount=o.IsAmount,t.AmountValue=o.DiscountValue,1==t.IsRecurring&&(t.BillingCycle=o.BillingCycle,t.IsInitialDiscount=!1,t.InitialDiscount=0,t.IsAmountForInitialDiscount=!1),r=!0}}if(!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0){var c=_onlineCheckout.ApplyPresetDiscountOnAddOnPackages(t,t.lstAddonService,i,a);r=c||r}}),r},_onlineCheckout.ApplyPresetDiscountOnMemberships=function(t,i,a){var r=!1;return e.grep(t,function(t){if(null!=a&&t.autoId+"0"==a.autoId.toString()+a.EnrollAutoID.toString()||null==a){var o=e.grep(i,function(e){return e.ServiceID==t.MembershipId&&7==e.ItemTypeID}),n=e.grep(onlineShoppingCartmain.Memberships,function(e){return e.autoId==t.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;0!=t.PromotionID&&(t.PromotionID=0),0==o.IsAmount?l=_onlineCheckout.parseTodecimal(l+_onlineCheckout.parseTodecimal(s*o.DiscountValue/100,2),2):(l=_onlineCheckout.parseTodecimal(l+o.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(l=parseFloat(ConvertTodecimalMorePrecious(parseFloat(l)/(1+t.Tax/100),!0,4)))),s<l&&(l=s),t.productDisc=l,t.Price=s,t.ActualPrice=_onlineCheckout.parseTodecimal(s-t.productDisc,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.ActualPrice*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.ActualPrice,t),t.isPresetApply=!0,t.DiscountID=o.PromotionID,t.IsAmount=o.IsAmount,t.AmountValue=o.DiscountValue,r=!0,1==t.IsRecurring&&(t.BillingCycle=o.BillingCycle,t.IsInitialDiscount=!1,t.InitialDiscount=0,t.IsAmountForInitialDiscount=!1),1==t.isGCApply&&0==t.Price&&_onlineCheckout.RemoveDicount(d.Membership,1,t.autoId)}}}),r},_onlineCheckout.ApplyPresetDiscountOnEvents=function(t,a,r,o){var n=!1,s=0,l=0,c=0;onlineShoppingCart.classdiscount=0,e.grep(t,function(t){var u=e.extend(!0,[],a),p=e.grep(u,function(e){return e.ServiceID==t.eventID&&8==e.ItemTypeID});t.calssdiscountprice=0,t.addonCalssdiscountprice=0;var h=e.grep(onlineShoppingCartmain.Events,function(e){return e.autoId==t.autoId});if(null!=p&&p.length>0){p=p[0];e.grep(t.eventEnrollment,function(a){if(void 0!==o&&(null!=o&&t.autoId.toString()+a.autoID.toString()==o.autoId.toString()+o.EnrollAutoID.toString()||null==o)){var u=e.grep(h[0].eventEnrollment,function(e){return e.autoID==a.autoID})[0].actualPrice,m=0,f=p.ServiceProviderIDs,g=a.sPID,v=!1;for(i=0;i<f.split(",").length;i++)g==f.split(",")[i]&&(v=!0);var A=moment(a.workshopActualDate),C=moment(p.StartDate.replace("A"," A").replace("P"," P")),y=moment(p.EndDate.replace("A"," A").replace("P"," P"));if(C.diff(A,"min")>0&&(v=!1),""!=p.EndDate&&y.diff(A,"min")<0&&(v=!1),0==r&&(void 0!==a.isPresetApply&&0==a.isPresetApply&&a.DiscountID!=p.PromotionID||void 0===a.isPresetApply||void 0!==a.isPresetApply&&1==a.isPresetApply&&a.DiscountID!=p.PromotionID)&&(v=!1),1==a.isPointApply||null!=a.gcId&&1==a.isPackage||0==v){if(1!=a.isPointApply){if(a.gcId>0&&(u=a.actualPrice),1==a.isMembershipApply){var b=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==a.MembershipID&&2==e.ItemType&&e.MembershipItemId==a.MembershipItemId});m=_onlineCheckout.parseTodecimal(u*b[0].Discount/100,2)}if(void 0!==a.isPresetApply&&1==a.isPresetApply&&(0==a.IsAmount?m=_onlineCheckout.parseTodecimal(m+u*a.AmountValue/100,2):(m=a.actualPrice<m+a.AmountValue?u:_onlineCheckout.parseTodecimal(m+a.AmountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(m=parseFloat(ConvertTodecimalMorePrecious(parseFloat(m)/(1+t.tax/100),!0,4))))),(null==a.gcId||0==a.gcId||a.gcId>0&&0==a.isPackage)&&0!=a.PromotionID){var S=0;1==a.IsAmount?(S=a.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(S=parseFloat(ConvertTodecimalMorePrecious(parseFloat(S)/(1+t.tax/100),!0,4)))):S=u*a.AmountValue/100,m+=S}a.actualPrice<m&&(m=u),a.discount=m,a.price=_onlineCheckout.parseTodecimal(u-a.discount,2),a.actualPrice=a.price,(a.gcId<0||a.gcId>0)&&1==a.isPackage?a.actualTaxprice=0:a.actualTaxprice=_onlineCheckout.parseTodecimal(a.price*t.tax/100,3),t.calssdiscountprice=_onlineCheckout.parseTodecimal(t.calssdiscountprice+a.discount,2),a.taxprice=a.actualTaxprice,null!=a.gcId&&0==a.isPackage&&(0==a.price&&(a.gcId=null,_onlineCheckout.RemoveDicount(d.Class,1,a.eventID,a.autoID)),a.redeemTax=a.actualTaxprice,a.redeemAmt=a.actualPrice),a.BusinessTax=_onlineCheckout.ApplyMultipleTax(a.price,a),s=_onlineCheckout.parseTodecimal(s+a.price,2),l=_onlineCheckout.parseTodecimal(l+a.actualTaxprice,2),a.gcId>0&&0==a.isPackage&&(c=_onlineCheckout.parseTodecimal(c+a.price,2))}}else{if(0!=a.PromotionID&&(a.PromotionID=0),1==a.isMembershipApply)null!=(b=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==a.MembershipID&&2==e.ItemType&&e.MembershipItemId==a.MembershipItemId}))&&b.length>0&&1==b[0].IsAllowPreSetDiscount?m=_onlineCheckout.parseTodecimal(u*b[0].Discount/100,2):_onlineCheckout.RemoveDicount(d.Class,4,a.eventID,a.autoID);(void 0===a.isPresetApply||void 0!==a.isPresetApply&&1==a.isPresetApply||r)&&(0==p.IsAmount?m=_onlineCheckout.parseTodecimal(m+u*p.DiscountValue/100,2):(m=_onlineCheckout.parseTodecimal(m+p.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(m=parseFloat(ConvertTodecimalMorePrecious(parseFloat(m)/(1+t.tax/100),!0,4)))),a.isPresetApply=!0,a.DiscountID=p.PromotionID,a.IsAmount=p.IsAmount,a.AmountValue=p.DiscountValue,n=!0),u<m&&(m=u),a.discount=m,a.price=_onlineCheckout.parseTodecimal(u-a.discount,2),a.actualPrice=a.price,a.actualTaxprice=_onlineCheckout.parseTodecimal(a.price*t.tax/100,3),t.calssdiscountprice=_onlineCheckout.parseTodecimal(t.calssdiscountprice+a.discount,2),a.isPointApply=!1,a.isPackage=!1,a.taxprice=a.actualTaxprice,null!=a.gcId&&0==a.isPackage&&(0==a.price&&(a.gcId=null,_onlineCheckout.RemoveDicount(d.Class,1,a.eventID,a.autoID)),a.redeemTax=a.actualTaxprice,a.redeemAmt=a.actualPrice),a.BusinessTax=_onlineCheckout.ApplyMultipleTax(a.price,a),s=_onlineCheckout.parseTodecimal(s+a.price,2),l=_onlineCheckout.parseTodecimal(l+a.taxprice,2),a.gcId>0&&0==a.isPackage&&(c=_onlineCheckout.parseTodecimal(c+a.price,2))}}})}else e.grep(t.eventEnrollment,function(i){if(1!=i.isPointApply){var a=e.grep(h[0].eventEnrollment,function(e){return e.autoID==i.autoID})[0].actualPrice;i.gcId>0&&(a=i.actualPrice);var r=0;if(1==i.isMembershipApply){var o=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==i.MembershipID&&2==e.ItemType&&e.MembershipItemId==i.MembershipItemId});r=_onlineCheckout.parseTodecimal(a*o[0].Discount/100,2)}if(void 0!==i.isPresetApply&&1==i.isPresetApply&&(0==i.IsAmount?r=_onlineCheckout.parseTodecimal(r+a*i.AmountValue/100,2):(r=i.actualPrice<r+i.AmountValue?a:_onlineCheckout.parseTodecimal(r+i.AmountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(r=parseFloat(ConvertTodecimalMorePrecious(parseFloat(r)/(1+t.tax/100),!0,4))))),(null==i.gcId||0==i.gcId||i.gcId>0&&0==i.isPackage)&&0!=i.PromotionID){var n=0;1==i.IsAmount?(n=i.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(n=parseFloat(ConvertTodecimalMorePrecious(parseFloat(n)/(1+t.tax/100),!0,4)))):n=a*i.AmountValue/100,r+=n}i.actualPrice<r&&(r=a),i.discount=r,i.price=_onlineCheckout.parseTodecimal(a-i.discount,2),i.actualPrice=i.price,(i.gcId<0||i.gcId>0)&&1==i.isPackage?i.actualTaxprice=0:i.actualTaxprice=_onlineCheckout.parseTodecimal(i.price*t.tax/100,3),t.calssdiscountprice=_onlineCheckout.parseTodecimal(t.calssdiscountprice+i.discount,2),i.taxprice=i.actualTaxprice,null!=i.gcId&&0==i.isPackage&&(0==i.price&&(i.gcId=null,_onlineCheckout.RemoveDicount(d.Class,1,i.eventID,i.autoID)),i.redeemTax=i.actualTaxprice,i.redeemAmt=i.actualPrice),i.BusinessTax=_onlineCheckout.ApplyMultipleTax(i.price,i),s=_onlineCheckout.parseTodecimal(s+i.price,2),l=_onlineCheckout.parseTodecimal(l+i.actualTaxprice,2),i.gcId>0&&0==i.isPackage&&(c=_onlineCheckout.parseTodecimal(c+i.price,2))}});t.displayroundedPrice<t.calssdiscountprice&&(t.calssdiscountprice=t.displayroundedPrice);var m=_onlineCheckout.ApplyPresetDiscountOnEventsAddon(t.eventEnrollment,a,r,o);s+=m.addonTotalPrice,l+=m.addonTotalTaxPrice,c+=m.addonTotalGCUsed,m.PromoApplied&&(n=m.PromoApplied),t.addonCalssdiscountprice=m.addonDiscountprice,onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+t.calssdiscountprice+t.addonCalssdiscountprice,2)});var u=parseFloat((s+l-(c+onlineShoppingCart.classPackageUsed)).toFixed(2));return onlineShoppingCart.classTax=parseFloat(l.toFixed(2)),onlineShoppingCart.classGCUsed=c,onlineShoppingCart.classFinalTotal=u,n},_onlineCheckout.ApplyPresetDiscountOnGC=function(t,i,a){var r=!1;return e.grep(t,function(t){if(0==t.ServiceId&&(null!=a&&t.autoId+"0"==a.autoId.toString()+a.EnrollAutoID.toString()||null==a)){var o=e.grep(i,function(e){return e.Price==t.TotalPrice&&5==e.ItemTypeID}),n=e.grep(onlineShoppingCartmain.GiftCertificates,function(e){return e.autoId==t.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;0!=t.PromotionID&&(t.PromotionID=0),0==o.IsAmount?l=_onlineCheckout.parseTodecimal(l+s*o.DiscountValue/100,2):(l=_onlineCheckout.parseTodecimal(l+o.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(l=parseFloat(ConvertTodecimalMorePrecious(parseFloat(l)/(1+t.Tax/100),!0,4)))),s-l<0&&(l=s),t.discount=l,t.Price=_onlineCheckout.parseTodecimal(s-t.discount,2),t.ActualPrice=t.Price,t.isPresetApply=!0,t.DiscountID=o.PromotionID,t.IsAmount=o.IsAmount,t.AmountValue=o.DiscountValue,r=!0,"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&PromotionAppointmentID>0&&t.DiscountID>0&&(PromotionAppointmentID="")}}}),r},_onlineCheckout.CreatePromoCodeDiv=function(t,i,a,r){1==r?e("#divApplyPromocode").prepend("<div id='divPromoCode_"+t+"' class='promo-summercode'> <div class='promo-summercode-bg'><a class='font-awesome-light grid-close-icon promo-close-icon ' onclick ='_onlineCheckout.RemovePromoCode("+t+");'>&#xf00d;</a><span class='font-awesome-normal vg-green-text sign-icon' aria-hidden='true'>&#xf058;</span> <span class='vg-green-text'>"+i+"</span><p class='text web-body-font web-builder-font-color'>"+a+"</p></div></div>"):e("#divApplyPromocode").prepend("<div id='divPromoCode_0' class='promo-summercode divPromoCode_0'> <div class='promo-summercode-error-bg' ><a class='font-awesome-light grid-close-icon promo-close-icon ' onclick ='_onlineCheckout.RemovePromoCodeError(this);'>&#xf00d;</a><span class='font-awesome-normal vg-red-text sign-icon' aria-hidden='true'>&#xf057;</span> <span class='vg-red-text'>"+i+"</span><p class='text web-body-font web-builder-font-color'>"+a+"</p></div></div>")},_onlineCheckout.CreateGCCodeDiv=function(t,i,a,r){1==r?e("#divApplyGCcode").prepend("<div id='divGCCode_"+t+"' class='promo-summercode'> <div class='promo-summercode-bg'><a class='font-awesome-light grid-close-icon promo-close-icon ' onclick ='_onlineCheckout.RemovePromoCode("+t+");'>&#xf00d;</a><span class='font-awesome-normal vg-green-text sign-icon' aria-hidden='true'>&#xf058;</span> <span class='vg-green-text'>"+i+"</span><p class='text web-body-font web-builder-font-color'>"+a+"</p></div></div>"):e("#divApplyGCcode").prepend("<div id='divGCCode_0' class='promo-summercode divGCCode_0'> <div class='promo-summercode-error-bg' ><a class='font-awesome-light grid-close-icon promo-close-icon ' onclick ='_onlineCheckout.RemoveGCCodeError(this);'>&#xf00d;</a><span class='font-awesome-normal vg-red-text sign-icon' aria-hidden='true'>&#xf057;</span> <span class='vg-red-text'>"+i+"</span><p class='text web-body-font web-builder-font-color'>"+a+"</p></div></div>")},_onlineCheckout.GCCodeClick=function(){e(".divGCCode_0").hide()},_onlineCheckout.GCCodeCodeKeypress=function(t){13==t.which?(t.preventDefault(),_onlineCheckout.ValidateGCCode()):e("#txtGCRedeemGCNo").removeClass("errorInput")},_onlineCheckout.ValidateGCCode=function(){if(""==e("#txtGCRedeemGCNo").val().trim())return e("#txtGCRedeemGCNo").val(""),void e("#txtGCRedeemGCNo").addClass("errorInput")},_onlineCheckout.RemoveGCCodeError=function(t){e(t).parent().parent().hide()},_onlineCheckout.RemovePromoCodeDiv=function(t){e(e("#divPromoCode_"+t)[0].firstElementChild.firstElementChild).empty(),e("#divPromoCode_"+t).hide(),e("#divPromoCode_"+t).attr("id","0")},_onlineCheckout.RemovePromoCodeError=function(t){e(t).parent().parent().hide()},_onlineCheckout.RemoveUnusedPromocode=function(t){var i=onlineShoppingCart.lstPromotionData.uniqueObjects(["PromotionID"]);e.grep(i,function(t){var i=!1;null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(a){void 0!==a.isPresetApply&&1==a.isPresetApply&&a.DiscountID==t.PromotionID&&(i=!0),!String.isNullOrUndefineOrBlank(a.lstAddonService)&&a.lstAddonService.length>0&&e.grep(a.lstAddonService,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)})}),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)}),null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()&&e.grep(onlineShoppingCart.Events,function(a){e.grep(a.eventEnrollment,function(a){void 0!==a.isPresetApply&&1==a.isPresetApply&&a.DiscountID==t.PromotionID&&(i=!0),null!=a.lstAddonService&&a.lstAddonService.length>0&&e.grep(a.lstAddonService,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)})})}),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&e.grep(onlineShoppingCart.GiftCertificates,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)}),0==i&&_onlineCheckout.RemovePromoCode(t.PromotionID)})},_onlineCheckout.RemovePresetDiscountOnProducts=function(t,i,a){e.grep(t,function(t){var r=e.grep(i,function(e){return e.ServiceID==t.InventoryId&&2==e.ItemTypeID}),o=e.grep(onlineShoppingCartmain.Inventories,function(e){return e.autoId==t.autoId});if(null!=r&&r.length>0){r=r[0];var n=o[0].Price,s=0;if(void 0!==t.isPresetApply&&1==t.isPresetApply&&t.DiscountID==a){if(1==t.isMembershipApply){var l=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==t.MembershipID&&3==e.ItemType&&e.MembershipItemId==t.InventoryId});null!=l&&l.length>0&&1==l[0].IsAllowPreSetDiscount&&(s=_onlineCheckout.parseTodecimal(n*l[0].Discount/100,2))}t.discount=s,t.Price=_onlineCheckout.parseTodecimal(n-s,2),t.ActualPrice=t.Price,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),t.isPresetApply=!1,t.isPointApply=!1,t.DiscountID=0,t.IsAmount=!1,t.AmountValue=0}}})},_onlineCheckout.RemovePresetDiscountOnPackages=function(t,i,a){e.grep(t,function(t){var r=e.grep(i,function(e){return e.ServiceID==t.ServiceId&&3==e.ItemTypeID&&4==t.eventType||e.ServiceID==t.ServiceId&&1==e.ItemTypeID&&1==t.eventType}),o=e.grep(onlineShoppingCartmain.Packages,function(e){return e.autoId==t.autoId});if(null!=r&&r.length>0){r=r[0];var n=o[0].Price;if(void 0!==t.isPresetApply&&1==t.isPresetApply&&t.DiscountID==a){n-(0==r.IsAmount?_onlineCheckout.parseTodecimal(n*r.DiscountValue/100,2):_onlineCheckout.parseTodecimal(r.DiscountValue,2))<0&&n;var s=t.NoOfVisit;t.SellPackageServiceID>0&&(s=1),t.discount=0,t.Price=n*s,t.ActualPrice=t.Price,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),t.isPresetApply=!1,t.DiscountID=0,t.IsAmount=!1,t.AmountValue=0,t.BillingCycle=0}}!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(r){var o=e.grep(i,function(e){return e.ServiceID==t.ServiceId&&3==e.ItemTypeID&&4==t.eventType||e.ServiceID==r.ServiceId&&19==e.ItemTypeID}),n=e.grep(onlineShoppingCartmain.Packages,function(e){return e.autoId==t.autoId}),s=e.grep(n[0].lstAddonService,function(e){return e.ServiceId==r.ServiceId});if(null!=o&&o.length>0){o=o[0];var l=s[0].Price;if(void 0!==r.isPresetApply&&1==r.isPresetApply&&r.DiscountID==a){l-(0==o.IsAmount?_onlineCheckout.parseTodecimal(l*o.DiscountValue/100,2):_onlineCheckout.parseTodecimal(o.DiscountValue,2))<0&&l;var d=t.NoOfVisit;r.SellPackageServiceID>0&&(d=1),r.discount=0,r.Price=l*d,r.ActualPrice=r.Price,r.calculatedTax=_onlineCheckout.parseTodecimal(r.Price*r.tax/100,3),r.ActualTax=r.calculatedTax,r.BusinessTax=_onlineCheckout.ApplyMultipleTax(r.Price,t),r.isPresetApply=!1,r.DiscountID=0,r.IsAmount=!1,r.AmountValue=0,r.BillingCycle=0}}})})},_onlineCheckout.RemovePresetDiscountOnMemberships=function(t,i,a){e.grep(t,function(t){var r=e.grep(i,function(e){return e.ServiceID==t.MembershipId&&7==e.ItemTypeID}),o=e.grep(onlineShoppingCartmain.Memberships,function(e){return e.autoId==t.autoId});if(null!=r&&r.length>0){r=r[0];var n=o[0].Price;void 0!==t.isPresetApply&&1==t.isPresetApply&&t.DiscountID==a&&(t.productDisc=0,t.ActualPrice=_onlineCheckout.parseTodecimal(n,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.ActualPrice*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.ActualPrice,t),t.isPresetApply=!1,t.DiscountID=0,t.IsAmount=!1,t.AmountValue=0,t.BillingCycle=0)}})},_onlineCheckout.RemovePresetDiscountOnEvents=function(t,i,a){var r=0,o=0,n=0;onlineShoppingCart.classdiscount=0,e.grep(t,function(t){var s=e.grep(i,function(e){return e.ServiceID==t.eventID&&8==e.ItemTypeID});t.calssdiscountprice=0,t.addonCalssdiscountprice=0;var l=e.grep(onlineShoppingCartmain.Events,function(e){return e.autoId==t.autoId});if(null!=s&&s.length>0){s=s[0];e.grep(t.eventEnrollment,function(i){var c=e.grep(l[0].eventEnrollment,function(e){return e.autoID==i.autoID})[0].actualPrice,u=0;if(void 0!==i.isPresetApply&&1==i.isPresetApply&&i.DiscountID==a)u=0==s.IsAmount?_onlineCheckout.parseTodecimal(c*s.DiscountValue/100,2):i.actualPrice<s.DiscountValue?c:_onlineCheckout.parseTodecimal(s.DiscountValue,2),i.discount=i.discount-u,i.price=_onlineCheckout.parseTodecimal(i.price+i.discount,2),i.actualPrice=i.price,(i.gcId<0||i.gcId>0)&&1==i.isPackage?i.actualTaxprice=0:i.actualTaxprice=_onlineCheckout.parseTodecimal(i.price*t.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+i.discount,2),t.calssdiscountprice=_onlineCheckout.parseTodecimal(t.calssdiscountprice+i.discount,2),i.isPresetApply=!1,i.isPointApply=!1,i.isPackage,i.DiscountID=0,i.IsAmount=!1,i.AmountValue=0,i.taxprice=i.actualTaxprice,null!=i.gcId&&0==i.isPackage&&(i.redeemTax=i.actualTaxprice,i.redeemAmt=i.actualPrice,onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed+u);else{if(1==i.isMembershipApply){var p=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==i.MembershipID&&2==e.ItemType&&e.MembershipItemId==i.MembershipItemId});u=_onlineCheckout.parseTodecimal(c*p[0].Discount/100,2)}i.discount=u,i.price=i.price,i.actualPrice=i.price,(i.gcId<0||i.gcId>0)&&1==i.isPackage?i.actualTaxprice=0:i.actualTaxprice=_onlineCheckout.parseTodecimal(i.price*t.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+i.discount,2),t.calssdiscountprice=_onlineCheckout.parseTodecimal(t.calssdiscountprice+i.discount,2),i.taxprice=i.actualTaxprice,null!=i.gcId&&0==i.isPackage&&(0==i.price?_onlineCheckout.RemoveDicount(d.Class,1,i.eventID,i.autoID):onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed-i.discount,i.redeemTax=i.actualTaxprice,i.redeemAmt=i.actualPrice)}r=_onlineCheckout.parseTodecimal(r+i.price,2),o=_onlineCheckout.parseTodecimal(o+i.actualTaxprice,2),i.gcId>0&&0==i.isPackage&&(n=_onlineCheckout.parseTodecimal(n+i.price,2))})}else e.grep(t.eventEnrollment,function(i){var a=i.actualPrice,s=0;if(1==i.isMembershipApply){var l=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==i.MembershipID&&2==e.ItemType&&e.MembershipItemId==i.MembershipItemId});s=_onlineCheckout.parseTodecimal(a*l[0].Discount/100,2)}i.discount=s,i.price=i.price,i.actualPrice=i.price,(i.gcId<0||i.gcId>0)&&1==i.isPackage?i.actualTaxprice=0:i.actualTaxprice=_onlineCheckout.parseTodecimal(i.price*t.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+i.discount,2),t.calssdiscountprice=_onlineCheckout.parseTodecimal(t.calssdiscountprice+i.discount,2),i.taxprice=i.actualTaxprice,null!=i.gcId&&0==i.isPackage&&(0==i.price?_onlineCheckout.RemoveDicount(d.Class,1,i.eventID,i.autoID):onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed-i.discount,i.redeemTax=i.actualTaxprice,i.redeemAmt=i.actualPrice),r=_onlineCheckout.parseTodecimal(r+i.price,2),o=_onlineCheckout.parseTodecimal(o+i.actualTaxprice,2),i.gcId>0&&0==i.isPackage&&(n=_onlineCheckout.parseTodecimal(n+i.price,2))});var c=_onlineCheckout.RemovePresetDiscountOnEventsAddon(t.eventEnrollment,i,a);r+=c.addonTotalPrice,o+=c.addonTotalTaxPrice,n+=c.addonTotalGCUsed,t.addonCalssdiscountprice=c.addonDiscountprice});var s=parseFloat((r+o-(n+onlineShoppingCart.classPackageUsed)).toFixed(2));onlineShoppingCart.classTax=parseFloat(o.toFixed(2)),onlineShoppingCart.classGCUsed=n,onlineShoppingCart.classFinalTotal=s},_onlineCheckout.RemovePresetDiscountOnGC=function(t,i,a){e.grep(t,function(t){if(0==t.ServiceId){var r=e.grep(i,function(e){return e.Price==t.TotalPrice&&5==e.ItemTypeID}),o=e.grep(onlineShoppingCartmain.GiftCertificates,function(e){return e.autoId==t.autoId});if(null!=r&&r.length>0){r=r[0];var n=o[0].Price;void 0!==t.isPresetApply&&1==t.isPresetApply&&t.DiscountID==a&&(n-(0==r.IsAmount?_onlineCheckout.parseTodecimal(n*r.DiscountValue/100,2):_onlineCheckout.parseTodecimal(r.DiscountValue,2))<0&&n,t.discount=0,t.Price=n,t.ActualPrice=t.Price,t.isPresetApply=!1,t.DiscountID=0,t.IsAmount=!1,t.AmountValue=0)}}})},_onlineCheckout.PersistGCBalance=function(t,i){null!=t&&null!=onlineShoppingCart.lstGCPkgData&&e.grep(onlineShoppingCart.lstGCPkgData,function(e){e.giftCertificateID==t&&(e.currentBalance=i)})},_onlineCheckout.RecalcGCONAllItemsAfterPreset=function(t){if(void 0!==onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0){onlineShoppingCart.RedeemedByGCtemp=[],onlineShoppingCart.RedeemedByGC=[],e.grep(onlineShoppingCart.lstGCPkgData,function(e){String.isNullOrUndefineOrBlank(e.ResetcurrentBalance)||(e.currentBalance=e.ResetcurrentBalance)});var i=e.grep(e.extend(!0,[],onlineShoppingCart.lstGCPkgData),function(e,t){return(1==e.eventType||7==e.eventType||2==e.eventType)&&0==e.isPackage&&1==e.assignStatus});if(null!=i&&i.length>0){var a={serviceID:"desc",GiftCertificateAmt:"asc"};i.keySort(a)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&_onlineCheckout.ApplyGCONAllItemsPreset(onlineShoppingCart.Memberships,i,d.Membership,t),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&_onlineCheckout.ApplyGCONAllItemsPreset(onlineShoppingCart.GiftCertificates,i,d.GiftCertificate,t),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&_onlineCheckout.ApplyGCONAllItemsPreset(onlineShoppingCart.Packages,i,d.Package,t),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&_onlineCheckout.ApplyGCONAllItemsPreset(onlineShoppingCart.Inventories,i,d.Product,t),1==t&&_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&_onlineCheckout.ApplyGCONAllItemsPreset(onlineShoppingCart.ServiceInvoice,i,d.ServiceInvoice,t),null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&_onlineCheckout.ApplyGCONAllItemsPreset(onlineShoppingCart.BusinessFee,i,d.BusinessFee,t),onlineShoppingCart.tax>0){var r=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax,2),o=onlineShoppingCart.tax;o!=r&&(onlineShoppingCart.taxdifference=_onlineCheckout.parseTodecimal(o-r,2),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax-onlineShoppingCart.taxdifference,2),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid-onlineShoppingCart.taxdifference,2),onlineShoppingCart.ccAmt>0&&onlineShoppingCart.ccAmt>onlineShoppingCart.taxdifference?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-onlineShoppingCart.taxdifference,2):onlineShoppingCart.gcAmt>0&&onlineShoppingCart.gcAmt>onlineShoppingCart.taxdifference&&(onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt-onlineShoppingCart.taxdifference,3)))}if(onlineShoppingCart.RedeemedByGCtemp.length>0){onlineShoppingCart.RedeemedByGC=[];var n=e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){return 1!=e.IsClass}),s=n.uniqueObjects(["GCId"]);e.grep(s,function(t){objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=0,objGC.redeemAmt=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type="GC",e.grep(n,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.GCAmount,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)})}if(1==t&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){var l=e.grep(e.extend(!0,[],onlineShoppingCart.lstGCPkgData),function(e,t){return(2==e.eventType||8==e.eventType)&&0==e.isPackage&&1==e.assignStatus});if(null!=l&&l.length>0){a={expiresOn:"asc",GiftCertificateAmt:"asc"};l.keySort(a)}l.length>0&&(onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events,!0,l))}}},_onlineCheckout.ApplyGCONAllItemsPreset=function(t,i,a,r){if(null!=i&&i.length>0){let o=!0===i._cycleResetDone;e.grep(t,function(t){String.isNullOrUndefineOrBlank(t.InventoryBundleCartDetails)&&(a==d.Membership?(t.Price=parseFloat(t.Price),t.ActualPrice=parseFloat(t.ActualPrice),t.RemainingPrice=parseFloat(t.ActualPrice),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax)):a==d.GiftCertificate?(t.TotalPrice=parseFloat(t.TotalPrice),t.ServiceId>0?(t.ActualPrice=parseFloat(t.TotalPrice),t.RemainingPrice=parseFloat(t.TotalPrice)):(t.ActualPrice=parseFloat(t.Price),t.RemainingPrice=parseFloat(t.Price)),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax)):a==d.Package?(t.TotalPrice=parseFloat(t.TotalPrice),t.ActualPrice=parseFloat(t.ActualPrice),t.RemainingPrice=parseFloat(t.Price),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax)):a==d.Product?(t.Price=parseFloat(t.Price),t.ActualPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:t.Price),t.RemainingPrice=parseFloat(1==t.IsPartialPoint?t.ActualPrice:t.Price),t.RemainingTax=parseFloat(t.calculatedTax),t.ActualTax=parseFloat(t.calculatedTax)):a==d.ServiceInvoice?(t.priceOriginal=parseFloat(t.ServiceOrginalPrice),_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(t.PromotionId)&&t.PromotionId>0&&(t.priceOriginal=parseFloat(t.price)),t.Price=parseFloat(t.price),t.RemainingPrice=parseFloat(t.price),t.RemainingTax=parseFloat(t.calculatedTax),1==t.isPackageApplied||1==t.isPointApply?(t.ActualPrice=parseFloat(t.price),t.ActualTax=parseFloat(0)):(t.ActualPrice=parseFloat(t.price),t.ActualTax=parseFloat(t.calculatedTax)),t.isServiceBaseGC=!1):a==d.BusinessFee&&(t.Price=parseFloat(t.CalculatedFees),t.paidType==_onlineCheckout.arrpaidType.Paid?(t.ActualPrice=parseFloat(t.CalculatedFees),t.ActualTax=parseFloat(t.CalculatedTax),t.RemainingPrice=parseFloat(t.Price),t.RemainingTax=parseFloat(t.CalculatedTax)):(t.ActualPrice=parseFloat(t.CalculatedFees),t.ActualTax=parseFloat(t.CalculatedTax),t.RemainingPrice=0,t.RemainingTax=0)),t.redeemAmt=0,t.redeemTax=0,t.GCDetail=[],1!=t.isGCApply&&1!=r||e.grep(i,function(e){!_onlineCheckout.isValidForCheckoutInvoice()||String.isNullOrUndefineOrBlank(e.serviceID)||String.isNullOrUndefineOrBlank(e.serviceName)||a!=d.ServiceInvoice?(!String.isNullOrUndefineOrBlank(e.serviceID)||_onlineCheckout.isValidForCheckoutInvoice()&&a==d.GiftCertificate||!_onlineCheckout.isValidForCheckoutInvoice()||void 0!==t.isPointApply&&0!=t.isPointApply||void 0!==t.isPackageApplied&&0!=t.isPackageApplied)&&(_onlineCheckout.isValidForCheckoutInvoice()||a==d.GiftCertificate||!String.isNullOrUndefineOrBlank(e.serviceID))||(!o&&1==t.isGCApply&&String.isNullOrUndefineOrBlank(t.InventoryBundleCartDetails)&&(e.currentBalance=String.isNullOrUndefineOrBlank(e.ResetcurrentBalance)?e.currentBalance:e.ResetcurrentBalance,o=!0,i._cycleResetDone=!0),t.RemainingPrice>0&&e.currentBalance>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&a==d.ServiceInvoice&&t.paidType==_onlineCheckout.arrpaidType.OfflineDeposit&&(t.RemainingPrice=t.depositsPaid,t.RemainingTax=0),e.currentBalance>=t.RemainingPrice?(t.isGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=t.RemainingPrice,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemAmt=_onlineCheckout.parseTodecimal(t.redeemAmt+t.RemainingPrice,2),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-t.RemainingPrice,2),t.RemainingPrice=0,_onlineCheckout.PersistGCBalance(e.giftCertificateID,e.currentBalance)):t.RemainingPrice>e.currentBalance&&e.currentBalance>0&&(t.isGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=e.currentBalance,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemAmt=_onlineCheckout.parseTodecimal(t.redeemAmt+e.currentBalance,2),t.RemainingPrice=_onlineCheckout.parseTodecimal(t.RemainingPrice-e.currentBalance,2),e.currentBalance=0,_onlineCheckout.PersistGCBalance(e.giftCertificateID,0))),t.RemainingTax>0&&e.currentBalance>0&&(t.RemainingTax=_onlineCheckout.parseTodecimal(t.RemainingTax,2),e.currentBalance>=t.RemainingTax?(objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=t.RemainingTax,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemTax=_onlineCheckout.parseTodecimal(t.redeemTax+t.RemainingTax,2),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-t.RemainingTax,2),t.RemainingTax=0,_onlineCheckout.PersistGCBalance(e.giftCertificateID,e.currentBalance)):t.RemainingTax>e.currentBalance&&e.currentBalance>0&&(objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=e.currentBalance,objGC.giftCertificateNo=e.giftCertificateNo,t.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),t.redeemTax=_onlineCheckout.parseTodecimal(t.redeemTax+e.currentBalance,2),t.RemainingTax=_onlineCheckout.parseTodecimal(t.RemainingTax-e.currentBalance,2),e.currentBalance=0,_onlineCheckout.PersistGCBalance(e.giftCertificateID,0)))):void 0!==t.isPointApply&&0!=t.isPointApply||void 0!==t.isPackageApplied&&0!=t.isPackageApplied||void 0!==t.isMembershipApply&&0!=t.isMembershipApply||0!=t.isPaid||e.serviceID==t.serviceid&&e.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&e.quantity>0&&t.RemainingPrice>0&&(objGC={},objGC.GCId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.serviceId=t.serviceid,objGC.redeemAmt=t.price,objGC.uniqID=t.AppSrNo,objGC.AppointmentID=t.appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC,onlineShoppingCart.RedeemedByGCtemp.push(objGC),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-t.price,2),e.quantity=e.quantity-1,t.redeemID=e.giftCertificateID,t.redeemAmt=t.price,t.GCDetail.push(objGC),t.isServiceBaseGC=!0,t.RemainingPrice=0,t.paidType=_onlineCheckout.arrpaidType.Paid,t.depositsPaid=0,null!=e.Taxes&&(t.RemainingTax=0))}),onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(t.ActualPrice+_onlineCheckout.parseTodecimal(t.ActualTax,3))-(t.redeemAmt+t.redeemTax),3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(t.ActualPrice+_onlineCheckout.parseTodecimal(t.ActualTax,3)),3),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+t.ActualTax,2),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+t.ActualTax,3),onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt+t.redeemAmt+t.redeemTax,2))})}else e.grep(t,function(e){String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)&&(a==d.Membership?(e.Price=parseFloat(e.Price),e.ActualPrice=parseFloat(e.ActualPrice),e.ActualTax=parseFloat(e.calculatedTax)):a==d.GiftCertificate?(e.TotalPrice=parseFloat(e.TotalPrice),e.ServiceId>0?e.ActualPrice=parseFloat(e.TotalPrice):e.ActualPrice=parseFloat(e.Price),e.ActualTax=0):a==d.Package?(e.TotalPrice=parseFloat(e.TotalPrice),e.ActualPrice=parseFloat(e.ActualPrice),e.ActualTax=parseFloat(e.calculatedTax)):a==d.Product?(String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)||0!=e.InventoryMasterID||(e.Price=0,e.ActualPrice=0,e.calculatedTax=0),e.Price=parseFloat(e.Price),e.ActualPrice=parseFloat(1==e.IsPartialPoint?e.ActualPrice:e.Price),e.ActualTax=parseFloat(e.calculatedTax)):a==d.ServiceInvoice?(_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(e.PromotionId)&&e.PromotionId>0?e.priceOriginal=parseFloat(e.price):e.priceOriginal=parseFloat(e.ServiceOrginalPrice),1==e.isPackageApplied||1==e.isPointApply?(e.ActualPrice=parseFloat(e.price),e.ActualTax=parseFloat(0)):(e.ActualPrice=parseFloat(e.price),e.ActualTax=parseFloat(e.calculatedTax)),e.Price=parseFloat(e.price),e.isServiceBaseGC=!1):a==d.BusinessFee&&(e.Price=parseFloat(e.CalculatedFees),e.ActualPrice=parseFloat(e.CalculatedFees),e.ActualTax=parseFloat(e.CalculatedTax)),e.redeemAmt=0,e.redeemTax=0,onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3)),3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(e.ActualPrice+_onlineCheckout.parseTodecimal(e.ActualTax,3)),3),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+e.ActualTax,2),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+e.ActualTax,3))})},_onlineCheckout.ApplyDailyDealONEvents=function(){if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){var t=onlineShoppingCart.Events,i=0,a=0,r=0,o=0,n=0,s=0;onlineShoppingCart.classdiscount=0,e.each(t,function(t,l){var d=e.grep(onlineShoppingCartmain.Events,function(e){return e.autoId==l.autoId});l.calssdiscountprice=0,l.addonCalssdiscountprice=0,l.classGCUsed=0,e.each(l.eventEnrollment,function(t,c){var u=e.grep(d[0].eventEnrollment,function(e){return e.autoID==c.autoID}),p=u[0].price;if(_onlineCheckout.isValidForCheckoutInvoice()&&(p=u[0].actualPrice),c.discount=0,(1!=c.isPointApply||c.IsPartialPoint)&&(c.isPointApply&&c.IsPartialPoint?c.IsPartialPoint&&1==_onlineCheckout.isValidForCheckoutInvoice()?void 0!==c.depositsPercentage&&!String.isNullOrUndefineOrBlank(c.depositsPercentage)&&c.depositsPercentage<100?c.price=p:p=c.price:c.IsPartialPoint&&"undefined"!=typeof onlineShoppingCartmain&&void 0!==onlineShoppingCartmain.DepositsPer&&onlineShoppingCartmain.DepositsPer<100?c.price=p:p=c.price:c.price=p,null!=c.gcId&&(c.gcId>0||c.gcId<0&&1==c.isPackage)&&(c.price=c.actualPrice),p>0&&(c.taxprice=_onlineCheckout.parseTodecimal(c.price*c.taxprice/p,2)),!_onlineCheckout.isValidForCheckoutInvoice()||0!=c.isPackage&&null!=c.isPackage||(c.discount=c.originalDiscount,c.price=p-c.discount,c.actualPrice=c.price,c.actualTaxprice=c.taxprice),(null==c.gcId||0==c.gcId||c.gcId>0&&0==c.isPackage)&&void 0!==c.PromotionID&&0!=c.PromotionID&&0==c.isPaid))if(void 0!==c.PromotionID&&0!=c.PromotionID){var h=getCookie("Referral");if(void 0===h||""==h||null==h||null==h)if(null==c.IsDailyDealApply||c.IsDailyDealApply)c.PromotionID=0;else if(c.price>0){var m=0;1==c.IsAmount?(m=c.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(m=parseFloat(ConvertTodecimalMorePrecious(parseFloat(m)/(1+l.tax/100),!0,4)))):m=_onlineCheckout.parseTodecimal(p*c.AmountValue/100,2),c.Originalprice<m&&(m=c.Originalprice),c.discount=m,c.price=p-m,c.taxprice=_onlineCheckout.parseTodecimal(c.price*l.tax/100,3),c.actualPrice=c.price,c.actualTaxprice=c.taxprice}else c.PromotionID=0;else if(c.price>0){m=0;1==c.IsAmount?(m=c.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(m=parseFloat(ConvertTodecimalMorePrecious(parseFloat(m)/(1+l.tax/100),!0,4)))):m=_onlineCheckout.parseTodecimal(p*c.AmountValue/100,2),c.Originalprice<m&&(m=c.Originalprice),c.discount=m,c.price=p-m,c.taxprice=_onlineCheckout.parseTodecimal(c.price*l.tax/100,3),c.actualPrice=c.price,c.actualTaxprice=c.taxprice}else c.PromotionID=0}else if(c.price>0){m=0;m=1==c.IsAmount?c.AmountValue:_onlineCheckout.parseTodecimal(p*c.AmountValue/100,2),c.Originalprice<m&&(m=c.Originalprice),c.discount=m,c.price=p-m,c.taxprice=_onlineCheckout.parseTodecimal(c.price*l.tax/100,3),c.actualPrice=c.price,c.actualTaxprice=c.taxprice}else c.PromotionID=0;onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+c.discount,2),l.calssdiscountprice=_onlineCheckout.parseTodecimal(l.calssdiscountprice+c.discount,2),c.isPointApply||c.IsPartialPoint||(c.BusinessTax=_onlineCheckout.ApplyMultipleTax(c.price,c)),i=_onlineCheckout.parseTodecimal(i+c.price,2),a=_shopdetail.CheckPriceWithTaxSwitch()&&_onlineCheckout.isValidForCheckoutInvoice()&&!isNullOrUndefineOrBlank(c.paidType)&&c.paidType===_onlineCheckout.arrpaidType.Deposits?_vgClassSessionSelection.ConvertTodecimal(i*l.tax/100,2,!0):_onlineCheckout.parseTodecimal(a+c.taxprice,2),c.gcId>0&&0==c.isPackage&&(r=_onlineCheckout.parseTodecimal(r+c.price,2),l.classGCUsed=_onlineCheckout.parseTodecimal(l.classGCUsed+c.price,2)),(c.gcId<0||c.gcId>0)&&1==c.isPackage&&(l.classGCUsed=_onlineCheckout.parseTodecimal(l.classGCUsed+c.price,2));var f=_onlineCheckout.ApplyDailyDealONEventsAddon(c.lstAddonService);o+=f.addonTotalPrice,n+=f.addonTotalTaxPrice,s+=f.addonTotalGCUsed,onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+f.addonDiscountprice,2)})});var l=parseFloat((i+o+a+n-(r+s+onlineShoppingCart.classPackageUsed)).toFixed(2));onlineShoppingCart.classTax=parseFloat((a+n).toFixed(2)),onlineShoppingCart.classGCUsed=r+s,onlineShoppingCart.classFinalTotal=l,onlineShoppingCart.classAddonGCUsed=s,onlineShoppingCart.classAddonTotalTaxPrice=n}},_onlineCheckout.PromotionAppliedOnPKGMS=function(t,i){var a=!0;if(void 0!==t.PerUserOne&&"1"==t.PerUserOne&&void 0!==t.PerTransactionOne&&"1"==t.PerTransactionOne){a=!1;var r={TotalPrice:"desc"},o=[];if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var n=e.extend(!0,[],onlineShoppingCart.Packages);o=e.grep(n,function(e){return t.PromotionID==e.PromotionID}).keySort(r)}r={Price:"desc"};var s=[];if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0){var l=e.extend(!0,[],onlineShoppingCart.Memberships);s=e.grep(l,function(e){return t.PromotionID==e.PromotionID}).keySort(r)}i==_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg&&o.length>0&&o[0].autoId===t.autoId?(s.length>0&&o[0].TotalPrice>s[0].Price||0==s.length)&&(a=!0):i==_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS&&s.length>0&&s[0].autoId===t.autoId&&(o.length>0&&o[0].TotalPrice<s[0].Price||0==o.length)&&(a=!0)}return a},_onlineCheckout.ApplyDailyDealONPackages=function(){if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var t=onlineShoppingCart.Packages;e.grep(t,function(t){if(0!=t.PromotionID){if(_onlineCheckout.PromotionAppliedOnPKGMS(t,_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg)){var i=t.NoOfVisit;t.SellPackageServiceID>0&&(i=1),_onlineCheckout.isValidForCheckoutInvoice()?t.TotalPrice=t.TotalPrice:t.TotalPrice=t.Price*i;var a=0;1==t.IsAmount?(a=t.AmountValue*i,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(a=parseFloat(ConvertTodecimalMorePrecious(parseFloat(a)/(1+t.Tax/100),!0,4)))):a=_onlineCheckout.parseTodecimal(t.TotalPrice*t.AmountValue/100,2),void 0!==t.PerUserOne&&"1"==t.PerUserOne&&(a/=i),t.TotalPrice-a<0&&(a=t.TotalPrice),t.discount=a,t.Price=_onlineCheckout.parseTodecimal(t.TotalPrice-a,2),t.ActualPrice=t.Price,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+t.discount,2)}else t.PromotionID=0;0===t.Price&&0!=t.isGCApply&&(t.isGCApply=!1,e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+t.ServiceId+'"][data-autoid="'+t.autoId+'"]').find("#divPkgGCApply").html(""))}else if(t.IsInitialDiscount){i=t.NoOfVisit;t.SellPackageServiceID>0&&(i=1),_onlineCheckout.isValidForCheckoutInvoice()?t.TotalPrice=t.TotalPrice:t.TotalPrice=t.Price*i;var r=0;r=1==t.IsAmountForInitialDiscount?t.InitialDiscount*i:_onlineCheckout.parseTodecimal(t.TotalPrice*t.InitialDiscount/100,2),t.TotalPrice-r<0&&(r=t.TotalPrice),t.discount=r,t.Price=_onlineCheckout.parseTodecimal(t.TotalPrice-r,2),t.ActualPrice=t.Price,t.calculatedTax=_onlineCheckout.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+t.discount,2)}})}},_onlineCheckout.ApplyDailyDealONMemberships=function(){if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0){var t=onlineShoppingCart.Memberships;e.grep(t,function(t){if(0!=t.PromotionID){if(_onlineCheckout.PromotionAppliedOnPKGMS(t,_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS)){var i=0;1==t.IsAmount?(i=t.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(i=parseFloat(ConvertTodecimalMorePrecious(parseFloat(i)/(1+t.Tax/100),!0,4)))):i=_onlineCheckout.parseTodecimal(t.Price*t.AmountValue/100,2),t.productDisc=i,t.Price=t.Price,i>t.Price?t.ActualPrice=0:t.ActualPrice=_onlineCheckout.parseTodecimal(t.Price-i,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.ActualPrice*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.ActualPrice,t),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+t.productDisc,2)}else t.PromotionID=0;0===t.ActualPrice&&0!=t.isGCApply&&(t.isGCApply=!1,e('#shoppingcartfirst [data-type="membership"][data-rid="'+t.MembershipId+'"]').find("#divMembershipGCApply").html(""))}else if(1==t.IsInitialDiscount){var a=0;a=1==t.IsAmountForInitialDiscount?t.InitialDiscount:_onlineCheckout.parseTodecimal(t.Price*t.InitialDiscount/100,2),t.productDisc=a,t.Price=t.Price,a>t.Price?t.ActualPrice=0:t.ActualPrice=_onlineCheckout.parseTodecimal(t.Price-a,2),t.calculatedTax=_onlineCheckout.parseTodecimal(t.ActualPrice*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.ActualPrice,t),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+t.productDisc,2)}})}},_onlineCheckout.ApplyDailyDealONGC=function(){if(null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0){var t=onlineShoppingCart.GiftCertificates;e.grep(t,function(e){var t=getCookie("Referral");if(void 0!==t&&""!=t&&null!=t&&null!=t||null!=e.IsDailyDealApply&&e.IsDailyDealApply&&(e.Price=e.TotalPrice,e.PromotionID=0),0!=e.PromotionID){var i=0;i=1==e.IsAmount?e.AmountValue:_onlineCheckout.parseTodecimal(e.TotalPrice*e.AmountValue/100,2),e.TotalPrice-i<0&&(i=e.TotalPrice),e.discount=i,e.Price=_onlineCheckout.parseTodecimal(e.TotalPrice-i,2),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2)}})}},_onlineCheckout.PromoBox=function(){if(e("#divCheckoutBookingPromoCode").hide(),"undefined"!=typeof onlineShoppingCartmain&&onlineShoppingCartmain.IsPromotionEnable){_onlineCheckout.ShoppingCartAmount()>0&&(_onlineCheckout.isValidForCheckoutInvoice()||e("#divCheckoutBookingPromoCode").show())}},_onlineCheckout.ShoppingCartAmount=function(){var t=0;return null!=onlineShoppingCartmain.Inventories&&onlineShoppingCartmain.Inventories.length>0&&e.grep(onlineShoppingCartmain.Inventories,function(e){t+=e.Price}),null!=onlineShoppingCartmain.Packages&&onlineShoppingCartmain.Packages.length>0&&e.grep(onlineShoppingCartmain.Packages,function(e){void 0!==e.SellPackageServiceID&&e.SellPackageServiceID>0?t+=e.Price:t+=e.Price*e.NoOfVisit}),null!=onlineShoppingCartmain.Memberships&&onlineShoppingCartmain.Memberships.length>0&&e.grep(onlineShoppingCartmain.Memberships,function(e){t+=e.Price}),null!=onlineShoppingCartmain.GiftCertificates&&onlineShoppingCartmain.GiftCertificates.length>0&&e.grep(onlineShoppingCartmain.GiftCertificates,function(e){t+=e.Price}),null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0&&"true"==isCCRequiredForOnlineClass.toLowerCase()&&e.grep(onlineShoppingCartmain.Events,function(i){e.grep(i.eventEnrollment,function(i){t+=i.actualPrice,!isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e){t+=e.actualPrice})})}),t},_onlineCheckout.isValidForCheckoutInvoice=function(){return"true"==_onlineCheckout.isFromInvoice.toString().toLowerCase()},_onlineCheckout.setTipOption=function(){if(ShowLoader(!0),businessID>0){var t={};t.businessID=businessID;var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumOnlineCheckout.getonlinecheckouttipsetting,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){var i=t;if(null!=i&&"undefined"!=i)if(""==i.TipOption)e(".divfinalCheckoutTip").hide();else{var a=e(".selectonlineTipCol"),r=i.TipOption.split(",");a.html(""),strTip="<ul>";"0"!=i.TipOption&&e.each(r,function(e,t){strTip+='<li role="link" aria-label="'+t+'%" onclick="_onlineCheckout.SetColorOnSignature(this);_onlineCheckout.setTipValueOnline('+t+');_onlineCheckout.showOtherTipOption(false,0);" > <div class=\'Custome-price-option\'><input type="button" title="'+t+'%" value="'+t+'%" aria-hidden="true" /></div> </li>'}),strTip+='<li role="link" aria-label="Other" id="liotherTipOpt" onclick="_onlineCheckout.SetColorOnSignature(this);_onlineCheckout.showOtherTipOption(true,0);" > <div class=\'Custome-price-option\'><input type="button" title="Other" value="Other" aria-hidden="true" /></div> </li>',strTip+="</ul>",a.append(strTip),e(".divfinalCheckoutTip").show(),e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+"0.00"),e(".otherTipCol").is(":visible")&&e("#liotherTipOpt").addClass("selected")}ShowLoader(!1)},i.datamodel.data=t,i.datamodel.Error=function(t){e(".divfinalCheckoutTip").hide(),ShowLoader(!1)},i.Post()}},_onlineCheckout.showOtherTipOption=function(t,i,a){void 0!==a&&null!=a&&(e(".tip-tab").removeClass("active"),e(a).addClass("active")),1==i?(e("#txtOnlineCustomerTip").val("0.00"),e(".tipBlock").show(),e("#txtOnlineCustomerTip").show(),e("#txtOnlineCustomerTip").select()):1==t?(e(".otherTipCol").show(),e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+"0.00"),e("#txtOnlineCustomerTip").select()):e(".otherTipCol").hide()},_onlineCheckout.setFocusinCustomTip=function(){(String.isNullOrUndefineOrBlank(e("#txtOnlineCustomerTip").val())||!String.isNullOrUndefineOrBlank(e("#txtOnlineCustomerTip").val())&&e("#txtOnlineCustomerTip").val()<=0)&&e("#txtOnlineCustomerTip").val("0.00"),e("#txtOnlineCustomerTip").select()},_onlineCheckout.validateCustomTipKeyPress=function(e,t){var i=void 0!==t.charCode&&null!=t.charCode?t.charCode:t.keyCode;if(0==i||8==i)return!0;var a=46==i;if(!a&&!(i>=48&&i<=57))return!1;var r=e.value||"",o="number"==typeof e.selectionStart?e.selectionStart:r.length,n="number"==typeof e.selectionEnd?e.selectionEnd:r.length,s=(r.substring(0,o)+String.fromCharCode(i)+r.substring(n)).replace(/^[^0-9.]*/,"");return!(a&&!/[1-9]/.test(s.split(".")[0]))},_onlineCheckout.enforceCustomTipMinimum=function(e){var t=e.value||"",i=t.replace(/^[^0-9.]*/,""),a=i.replace(/^0+(?=\d)/,""),r=parseFloat(a);r>0&&r<1&&(a="0.00"),a!==i&&(e.value=t.substring(0,t.length-i.length)+a)},_onlineCheckout.GetSumOfProdcutOrService=function(){var t=0;return _onlineCheckout.TotalPaidCount=0,e.each(onlineShoppingCart.ServiceInvoice,function(e,i){_onlineCheckout.TotalPaidCount+=1,!String.isNullOrUndefineOrBlank(i.isPointApply)&&1==i.isPointApply||i.isPackageApplied||i.isMembershipApply?t+=parseFloat(i.ServiceOrginalPrice):i.paidType==_onlineCheckout.arrpaidType.Deposits&&0==parseFloat(i.ActualPrice)?t+=parseFloat(i.ActualPrice):t+=parseFloat(i.ActualPrice)+parseFloat(i.deposit)}),(null==onlineShoppingCart.ServiceInvoice||null!=onlineShoppingCart.ServiceInvoice&&0==onlineShoppingCart.ServiceInvoice.length)&&(null==onlineShoppingCart.Events||null!=onlineShoppingCart.Events&&0==onlineShoppingCart.Events.length)&&e.each(onlineShoppingCart.Inventories,function(e,i){_onlineCheckout.TotalPaidCount+=1,t+=parseFloat(i.ActualPrice)}),e.each(onlineShoppingCart.Events,function(e,i){for(var a=i.eventEnrollment,r=0;r<=a.length-1;r++)_onlineCheckout.TotalPaidCount+=1,!String.isNullOrUndefineOrBlank(a[r].isPointApply)&&1==a[r].isPointApply||a[r].isPackage?t+=parseFloat(a[r].Originalprice):a[r].paidType==_onlineCheckout.arrpaidType.Deposits&&0==parseFloat(a[r].actualPrice)?t+=parseFloat(a[r].actualPrice):t+=parseFloat(a[r].actualPrice)+parseFloat(a[r].deposit)}),t<=0&&null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&e.each(onlineShoppingCart.Inventories,function(e,i){_onlineCheckout.TotalPaidCount+=1,t+=parseFloat(i.ActualPrice)}),t>0?t:0},_onlineCheckout.GetDiscountedPrice=function(e,t){return parseFloat(e*t/100).toFixed(2)},_onlineCheckout.setTipValueOnline=function(t,i){var a=0;t>0&&(e(".tip-tab").removeClass("active"),e(i).addClass("active")),a=onlineShoppingCartmain.IsFullDeposit&&"true"!=_onlineCheckout.isFromInvoice.toString().toLowerCase()?_onlineCheckout.GetTotalCartAmountforTip():_onlineCheckout.GetSumOfProdcutOrService(),a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.GetConfigTipItemsAmount(!0),2),a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.GetCartTipTax(),2);var r=0;-1==t?(r=e("#txtOnlineCustomerTip").val().replace(currencysymbol,""),e("#txtOnlineCustomerTip").val(r),a>0&&(onlineShoppingCart.tipPercent=_onlineCheckout.parseTodecimal(100*r/a,2))):("dollar"===tipType?(r=parseFloat(t).toFixed(2),a>0&&(onlineShoppingCart.tipPercent=_onlineCheckout.parseTodecimal(100*r/a,2))):(r=_onlineCheckout.GetDiscountedPrice(a,t),onlineShoppingCart.tipPercent=t),e("#txtOnlineCustomerTip").val("0.00")),onlineShoppingCart.tipValue=r,-1!=t&&e(".tipBlock").hide(),e("#divfinalCheckoutTipAmount").show(),e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+r);var o=null;null!=e("#lblGCRedeemAmt")[0]&&null!=e("#lblGCRedeemAmt")[0]&&(o=e("#lblGCRedeemAmt")[0].innerHTML.replace("$(","")),_onlineCheckout.displayFinalCalculatedPrice(),(0==e("#dvCheckoutBookingPaymentMethod").is(":visible")||0==e(_onlineCheckout.Controls.DvcheckoutBookingTabs).is(":visible"))&&parseFloat(onlineShoppingCart.tipValue)>0&&_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout"),null!=onlineShoppingCart.gcAmt&&null!=onlineShoppingCart.gcAmt&&(totalDueAmt=e("#divCartPrepaypricewithoutGC")[0].innerHTML.replace("$","")-onlineShoppingCart.gcAmt),_onlineCheckout.ConvertDecimalWithFixed(totalDueAmt,!0,2)>_onlineCheckout.ConvertDecimalWithFixed(_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount,!0,2)&&_onlineCheckout.ConvertDecimalWithFixed(totalDueAmt,!0,2)<_onlineCheckout.ConvertDecimalWithFixed(_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount,!0,2)&&(e("#dvBookingPaymentMethod").hide(),e("#divVplTracking").hide()),_onlineCheckout.ValidateVPl(!0),e("#VplAmount").length>0&&e("#divCartPrepaypricewithoutGC").length>0&&(null!=e("#lblGCRedeemAmt")[0]&&null!=e("#lblGCRedeemAmt")[0]&&(o=o.replace(")","")),null!=o&&null!=o&&0!=o?(vplTipAmount=totalDueAmt,e("#VplAmount")[0].innerHTML=currencysymbol+_onlineCheckout.ConvertDecimalWithFixed(vplTipAmount,!0,2)):(vplTipAmount=e("#VplAmount")[0].innerHTML.replace(currencysymbol,""),e("#VplAmount")[0].innerHTML=e("#divfinalTotalPrice")[0].innerHTML),1==e("#tabVagaroPayLater").hasClass("w--current")&&vplTipAmount>0&&_vgVPLOnline.PaymentSchedule(vplTipAmount,_onlineCheckout.PaymentSchduleSuccess,_onlineCheckout.PaymentSchdulefail)),_onlineCheckout.IsVCFEnable()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.ApplyTip),_onlineCheckout.displayFinalCalculatedPrice())},_onlineCheckout.AddTip=function(t){e("#divfinalCheckoutTipAmount").show(),e(".divfinalCheckoutTipSuboption").show(),t&&(onlineShoppingCartmain.IsFullDeposit&&_onlineCheckout.IsBaseTipAllowedByConfig()||_onlineCheckout.HasConfigTipItemInCart())&&_onlineCheckout.ShowHideTipOptions(!0)},_onlineCheckout.ShowHideTipOptions=function(t){t?_shopdetail.VisibleControlLength("#mobile-check")>0?e("#divCartTipSelectionMobile").show():e("#divCartTipSelection").show():_shopdetail.VisibleControlLength("#mobile-check")>0?e("#divCartTipSelectionMobile").hide():e("#divCartTipSelection").hide()},_onlineCheckout.RemoveTip=function(){onlineShoppingCart.tipValue=0,"true"!=_onlineCheckout.isFromInvoice.toString().toLowerCase()&&_onlineCheckout.ShowHideTipOptions(!1),e("#divfinalCheckoutTipAmount").html(""),e("#divfinalCheckoutTipAmount").html(currencysymbol+"0.00"),e("#divfinalCheckoutTipAmount").hide(),e("#txtOnlineCustomerTip").val("0.00"),_onlineCheckout.showOtherTipOption(!1),_onlineCheckout.displayFinalCalculatedPrice(),parseFloat(onlineShoppingCart.ccAmt)>0||1==_onlineCheckout.IsCCDetailEnable()&&onlineShoppingCart.classFinalTotal>0||parseFloat(onlineShoppingCart.tipValue)>0||1==_onlineCheckout.IsLoadCCIframForMemrship()?_onlineCheckout.CheckUserhasCreditcardOrNot("online-checkout"):(e("#dvCheckoutBookingPaymentMethod").hide(),e(_onlineCheckout.Controls.DvcheckoutBookingTabs).hide(),e("#divVplTracking").hide())},_onlineCheckout.SetColorOnSignature=function(t){e(".selectonlineTipCol").find(".selected").removeClass("selected"),e(t).addClass("selected")},_onlineCheckout.PayInvoice=function(){_onlineCheckout.GetOnlineInvoiceBusinessUserDetailsByInvoiceId(_onlineCheckout.InvoiceID)},_onlineCheckout.GetOnlineInvoiceBusinessUserDetailsByInvoiceId=function(t){if(ShowLoader(!0),businessID>0&&t>0){var i={};i.BusinessID=businessID,i.Id=0,i.CreatedBy=0,i.isFilterByInvoiceID=!0;var a=window.location.href.split("invoice/")[1];a.indexOf("?")>-1&&(a=a.split("?")[0]),i.EncInvoiceID=a;var r=new vagaro.ajax;r.datamodel.Token=ApiURLEnumOnlineCheckout.getonlineinvoicebusinessuserdetailsbyinvoiceid,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.callback=function(e){var t=e;if(null!=t&&void 0!==t&&t.Status!==_onlineCheckout.invoiceStatus.Sent&&t.Status!==_onlineCheckout.invoiceStatus.Overdue)return ShowLoader(!1),void(window.location.href=sInvWarningLink.replace("||~||",t.Status));ShowLoader(!1),_onlineCheckout.ValidateCartData()},r.datamodel.data=i,r.datamodel.Error=function(e){ShowLoader(!1),_onlineCheckout.ValidateCartData()},r.Post()}else ShowLoader(!1),_onlineCheckout.ValidateCartData();setTimeout(function(){e("#divDatemonth").focus()},500)},_onlineCheckout.ShoppingCartItemIds=function(t,i,a){var r="";return null!=onlineShoppingCartmain.Inventories&&onlineShoppingCartmain.Inventories.length>0&&(1==i||3==i)&&e.grep(onlineShoppingCartmain.Inventories,function(e){r+=e.InventoryId+","}),null!=onlineShoppingCartmain.Packages&&onlineShoppingCartmain.Packages.length>0&&1==t&&e.grep(onlineShoppingCartmain.Packages,function(e){r+=e.ServiceId+","}),null!=onlineShoppingCartmain.Memberships&&onlineShoppingCartmain.Memberships.length>0&&1==t&&e.grep(onlineShoppingCartmain.Memberships,function(e){r+=e.MembershipId+","}),!(null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0)||"true"!=isCCRequiredForOnlineClass.toLowerCase()&&1!=a||1!=i&&2!=i||e.grep(onlineShoppingCartmain.Events,function(t){r+=t.eventID+",",e.grep(t.eventEnrollment,function(e){if(null!=e.lstAddonService&&null!=e.lstAddonService&&e.lstAddonService.length>0){var t=_onlineCheckout.GetAllAddonsWithSeparator(e.lstAddonService,",");r+=t.addonids+","}})}),r=r.substring(0,r.length-1)},_onlineCheckout.getUserGCDetail_ShowDiscount=function(t,i){if(String.isNullOrUndefineOrBlank(_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount)&&String.isNullOrUndefineOrBlank(_onlineCheckout.lstUserListForCheckout_ShowDiscount)&&String.isNullOrUndefineOrBlank(_onlineCheckout.lstMembershipForCheckout_ShowDiscount)&&String.isNullOrUndefineOrBlank(_onlineCheckout.IsPromotionEnable_ShowDiscount))if(null!=onlineShoppingCart){1==isCheckInApp&&(onlineShoppingCart.loginUserId=glbDataCheckIn.scanUserID);var a=!1;if("undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget()&&null!=typeof getQueryStringData){String.isNullOrUndefineOrBlank(e("#hdnLoginQueryString").val())||(QueryStringValue=e("#hdnLoginQueryString").val()),String.isNullOrUndefineOrBlank(QueryStringValue)&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL);var r=getQueryStringData("Type"),o=getQueryStringData("wgVal");"Builder"==r&&null!=o&&""!=o&&(widgetcookievalue=o,a=!0)}if(void 0===onlineShoppingCart.loginUserId&&0==isCheckInApp)return 0==a&&showCommonLoginPopup(),!1;var n=e("<XMLDocument/>");n.append(_vgClassSessionSelection.createXmlElement("UsersDetail"));var s=_vgClassSessionSelection.createXmlElement("User");1==a&&void 0!==onlineShoppingCart.loginUserId||"undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget()&&void 0!==onlineShoppingCart.loginUserId?s.append(_vgClassSessionSelection.createXmlElement("userid",parseInt(onlineShoppingCart.loginUserId))):s.append(_vgClassSessionSelection.createXmlElement("userid",glbEncryptUserIdWithSafeURL)),s.append(_vgClassSessionSelection.createXmlElement("email","")),s.append(_vgClassSessionSelection.createXmlElement("isloginuser",!0)),s.append(_vgClassSessionSelection.createXmlElement("encryptuserid",glbEncryptUserIdWithSafeURL)),n.find("UsersDetail").append(s);for(var l=_vgClassSessionSelection.ManageEventTempAndRealData(!0,!1,!1),d=0;d<=l.length-1;d++){if(parseInt(onlineShoppingCart.loginUserId)!=parseInt(l[d].customerID))(s=_vgClassSessionSelection.createXmlElement("User")).append(_vgClassSessionSelection.createXmlElement("userid",parseInt(l[d].customerID))),s.append(_vgClassSessionSelection.createXmlElement("email",l[d].cUserEmail)),n.find("UsersDetail").append(s)}var c=e("<XMLDocument/>");if(null!=onlineShoppingCartmain.Inventories&&onlineShoppingCartmain.Inventories.length>0){c.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",3)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(d=0;d<onlineShoppingCartmain.Inventories.length;d++){var u=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.Inventories[d].ProductName,!0);c.find("ns").append(u)}}var p=e("<XMLDocument/>"),h=e("<XMLDocument/>");if(null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0){p.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",2)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(d=0;d<onlineShoppingCartmain.Events.length;d++){var m=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.Events[d].eventName.trim());p.find("ns").append(m)}var f=!0;for(d=0;d<onlineShoppingCartmain.Events.length;d++)e.each(onlineShoppingCartmain.Events[d].eventEnrollment,function(t,i){null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0&&(f&&h.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",8)).append(_vgClassSessionSelection.createXmlElement("ns")))),e.each(i.lstAddonService,function(e,t){f&&(f=!1);var i=_vgClassSessionSelection.createXmlElement("n",t.ServiceTitle.trim());h.find("ns").append(i)}))})}c.find("itms").length>0?(p.find("itms").length>0&&c.find("itms").append(p.find("itms").html()),h.find("itms").length>0&&c.find("itms").append(h.find("itms").html())):p.find("itms").length>0?(c=p,h.find("itms").length>0&&c.find("itms").append(h.find("itms").html())):h.find("itms").length>0&&(c=h);var g={};g.userData=n.html(),g.businessID=onlineShoppingCart.BusinessID,g.productList=c.html(),g.isGetDepositsConfig=!1,"undefined"==typeof PromotionID||String.isNullOrUndefineOrBlank(PromotionID)?g.promotionID=0:g.promotionID=parseInt(PromotionID),g.isWebsiteBuilder=void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof vgAppicationType&&1==vgAppicationType;var v=new vagaro.ajax;v.datamodel.async=!1,v.datamodel.Token=ApiURLEnumOnlineCheckout.getgcpackageandpointforonlinecheckout,v.datamodel.IsNewVagaroAPI=!0,v.datamodel.callback=function(a){dailyDealFeeValue=a.depositsClassConfigForCheckout.DailyDealFee,dailyDealFeeValue_ExistingUser=a.depositsClassConfigForCheckout.DailyDealVagaroFee_ExistingUser;var r=a.depositsClassConfigForCheckout;dailyDealFeeType=null!=r.IsClsDailyDealVagaroFeeType?r.IsClsDailyDealVagaroFeeType:null!=r.IsDailyDealVagaroFeeType?r.IsDailyDealVagaroFeeType:null!=r.DailyDealVagaroFeeType&&r.DailyDealVagaroFeeType,IsForVeraNewCustomer=a.depositsClassConfigForCheckout.IsForVeraNewCustomer,IsSameDayCustomer=!0===a.depositsClassConfigForCheckout.IsSameDayCustomer,IsFMBEnableForBusiness=a.IsFMBEnableForBusiness,onlineShoppingCartmain.UsersPoints=a.lstUserListForCheckout,onlineShoppingCartmain.IsPromotionEnable=a.IsPromotionEnable,onlineShoppingCart.IsPromotionEnable=a.IsPromotionEnable,onlineShoppingCart.IsDailyDealEnable=a.depositsClassConfigForCheckout.IsDailyDealEnable,onlineShoppingCartmain.IsDailyDealEnable=a.depositsClassConfigForCheckout.IsDailyDealEnable;var o=_onlineCheckout.IsAnyDailyDealInCart();o?(a.lstUserListForCheckout?.forEach(e=>{e.pointsBalance=0}),_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount=e.grep(e.extend(!0,[],a.lstGcAndPackagesForCheckout)||[],function(e){return e&&1==e.isPackage}),_onlineCheckout.lstUserListForCheckout_ShowDiscount=e.extend(!0,[],a.lstUserListForCheckout),_onlineCheckout.lstMembershipForCheckout_ShowDiscount=e.extend(!0,[],a.lstMembershipForCheckout)):(_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount=e.extend(!0,[],a.lstGcAndPackagesForCheckout),_onlineCheckout.lstUserListForCheckout_ShowDiscount=e.extend(!0,[],a.lstUserListForCheckout),_onlineCheckout.lstMembershipForCheckout_ShowDiscount=e.extend(!0,[],a.lstMembershipForCheckout)),_onlineCheckout.IsPromotionEnable_ShowDiscount=a.IsPromotionEnable,_onlineCheckout.VPLUserBankDetails=a.lstVPLUserAccount,_onlineCheckout.ApplyDiscounts_ShowDiscount(o?_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount:a.lstGcAndPackagesForCheckout,o?_onlineCheckout.lstUserListForCheckout_ShowDiscount:a.lstUserListForCheckout,o?_onlineCheckout.lstMembershipForCheckout_ShowDiscount:a.lstMembershipForCheckout,a.IsPromotionEnable,i),_onlineCheckout.ValidateOnePerUserDeal(1),_onlineCheckout.ReApplyDiscounts_ShowDiscount(),_onlineCheckout.CalculateSubtotal_ShowDiscount(t),_onlineCheckout.IsSelectGCEmployeeForWidget(),_onlineCheckout.IsMemPackageUpSell=a.depositsClassConfigForCheckout.IsMemPackageUpSell},v.datamodel.data=g,v.datamodel.Error=function(e){},v.Post()}else ShowLoader(!1),vagaro.alert("Some error occured. Please try again.");else null!=onlineShoppingCart?(onlineShoppingCart.IsPromotionEnable=_onlineCheckout.IsPromotionEnable_ShowDiscount,_onlineCheckout.GcAndPackagesForCheckout_ShowDiscount=e.extend(!0,[],_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount),_onlineCheckout.UserListForCheckout_ShowDiscount=e.extend(!0,[],_onlineCheckout.lstUserListForCheckout_ShowDiscount),_onlineCheckout.MembershipForCheckout_ShowDiscount=e.extend(!0,[],_onlineCheckout.lstMembershipForCheckout_ShowDiscount),_onlineCheckout.IsPromotionEnable_ShowDiscount=_onlineCheckout.IsPromotionEnable_ShowDiscount,_onlineCheckout.ApplyDiscounts_ShowDiscount(_onlineCheckout.GcAndPackagesForCheckout_ShowDiscount,_onlineCheckout.UserListForCheckout_ShowDiscount,_onlineCheckout.MembershipForCheckout_ShowDiscount,_onlineCheckout.IsPromotionEnable_ShowDiscount,i),_onlineCheckout.ValidateOnePerUserDeal(1),_onlineCheckout.ReApplyDiscounts_ShowDiscount(),_onlineCheckout.CalculateSubtotal_ShowDiscount(t)):(ShowLoader(!1),vagaro.alert("Some error occured. Please try again."))},_onlineCheckout.CalculateSubtotal_ShowDiscount=function(t){if(!_onlineCheckout.isValidForCheckoutInvoice()&&1==t){e.each(onlineShoppingCart.Events,function(t,i){if(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing){var a=0,r=0;e.each(i.eventEnrollment,function(t,i){if(void 0!==i.isPackage&&null!=i.isPackage&&1==i.isPackage)a=a+i.price+i.taxprice;else if(void 0!==i.isPriceBaseGCApply&&null!=i.isPriceBaseGCApply&&0==i.isPriceBaseGCApply&&void 0!==i.gcId&&null!=i.gcId&&i.gcId>0)a+=i.price;else if(void 0!==i.isPriceBaseGCApply&&null!=i.isPriceBaseGCApply&&1==i.isPriceBaseGCApply)a=a+i.Originalprice+i.Originaltaxprice,r=r+i.price+i.taxprice-(i.redeemAmt+i.redeemTax);else if(a=a+i.Originalprice+i.Originaltaxprice,null!=i.PromotionID&&null!=i.PromotionID&&i.PromotionID>0){var o=getCookie("Referral");(void 0===o||""==o||null==o||null==o)&&(null==i.IsDailyDealApply||i.IsDailyDealApply)?(r=a,i.PromotionID=0,e.each(onlineShoppingCartmain.Events,function(t,a){e.each(a.eventEnrollment,function(e,t){t.eventID==i.eventID&&(t.PromotionID=0)})})):r=r+i.price+i.taxprice}else r=r+i.price+i.taxprice;if(null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0)for(t=0;t<i.lstAddonService.length;t++)i.lstAddonService[t].IsIncludeTaxInOnlinePricing=!0,i.lstAddonService[t].displayroundedPriceWithTax=i.lstAddonService[t].Originalprice+i.lstAddonService[t].Originaltaxprice,i.lstAddonService[t].roundedPriceWithTax=i.lstAddonService[t].Price+i.lstAddonService[t].taxprice}),i.IsIncludeTaxInOnlinePricing=!0,i.displayroundedPriceWithTax=a,i.roundedPriceWithTax=r}}),String.isNullOrUndefineOrBlank(onlineShoppingCartmain.Events)||e("#NewEvenetCartDetail123").tmpl(onlineShoppingCart.Events).appendTo("#newCartSummaryDectail123");var i=parseFloat(Math.round(0)/100),a=parseInt(0);e.each(onlineShoppingCart.Inventories,function(t,r){if(String.isNullOrUndefineOrBlank(r.InventoryBundleCartDetails)){var o=0;if(void 0!==r.isPointApply&&0==r.isPointApply){var n=0;if(void 0!==r.isGCApply&&1==r.isGCApply&&r.GCDetail.length>0&&e.each(onlineShoppingCart.Inventories[t].GCDetail,function(e,t){n+=parseFloat(t.GCAmount)}),r.OriginalPrice==r.Price)0==r.MasterInventoryId&&(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(n>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax):""),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.PriceWithTax-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax-n)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(n>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax):"")+", new price is "+(_onlineCheckout.decimalFormate(r.PriceWithTax-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax-n))).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(n>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice):""),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.OriginalPrice-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice-n)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(n>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice):"")+", new price is "+(_onlineCheckout.decimalFormate(r.OriginalPrice-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice-n))).attr("aria-live","polite").attr("role","contentinfo"))),o+=parseFloat(r.OriginalPrice-n);else{if(0==r.MasterInventoryId)if(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing){var s=r.ActualPrice+r.ActualTax-n;e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.PriceWithTax-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,s)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old Price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)+", new Price is "+(_onlineCheckout.decimalFormate(r.PriceWithTax-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,s))).attr("aria-live","polite").attr("role","contentinfo")}else e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.Price-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price-n)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old Price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice)+", new Price is "+(_onlineCheckout.decimalFormate(r.Price-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price-n))).attr("aria-live","polite").attr("role","contentinfo");o+=parseFloat(r.Price-n)}}else void 0!==r.isPointApply&&1==r.isPointApply?(0==r.MasterInventoryId&&(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html("Free"),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)+", new price is Free").attr("aria-live","polite").attr("role","contentinfo")):r.IsPartialPoint?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.ActualPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice)+", new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.ActualPrice)).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html("Free"),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.OriginalPrice)+", new price is Free").attr("aria-live","polite").attr("role","contentinfo"))),r.IsPartialPoint?o+=parseFloat(r.ActualPrice):o+=parseFloat(0)):(0==r.MasterInventoryId&&(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)).attr("aria-live","polite").attr("role","contentinfo"))),o+=parseFloat(r.Price));0==r.MasterInventoryId&&(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProductPromoPointGcApply").html(""),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProdcutMembershipApply").html(""),void 0!==r.isPresetApply&&1==r.isPresetApply&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Promo Code Applied</span></div></div>'),void 0!==r.isGCApply&&1==r.isGCApply?e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Gift Card Applied</span></div></div>'):void 0!==r.isPointApply&&1==r.isPointApply&&("undefined"!=_onlineCheckout.IsPartialPointAllowed&&1==_onlineCheckout.IsPartialPointAllowed?e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Points Applied ('+r.pointsRedeem+")</span></div></div>"):e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Points Applied</span></div></div>')),void 0!==r.isMembershipApply&&1==r.isMembershipApply&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProdcutMembershipApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Membership Applied ('+r.membershipName+")</span></div></div>"),void 0!==r.isPackageApplied&&1==r.isPackageApplied&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+r.InventoryId+'"]').find("#divProdcutMembershipApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Package Applied ('+r.membershipName+")</span></div></div>")),(isNaN(o)||o<0)&&(o=0),1==onlineShoppingCart.IsIncludeTaxInOnlinePricing&&(o=r.OriginalPrice==r.Price?r.OriginalPrice+r.calculatedTax-n:r.ActualPrice+r.ActualTax-n),i+=o,0==r.MasterInventoryId&&(a+=1)}else a+=1}),e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){i.bPrice=0,i.bOriginalPrice=0,i.bgcAmount=0,i.isPresetApply=!1,i.isGCApply=!1,i.isMembershipApply=!1,i.isPointApply=!1,i.isPointApplyPartial=!1,i.membershipName="",i.packageName="",i.bPriceWithTax=0,i.bPriceWithDiscount=0;var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId}),r=0,o=[],n=[],s=!1,l=!1;if(e.each(a,function(t,d){if(void 0!==d.isPointApply&&0==d.isPointApply){var c=0;void 0!==d.isGCApply&&1==d.isGCApply&&d.GCDetail.length>0&&e.each(a[t].GCDetail,function(e,t){c+=parseFloat(t.GCAmount)}),i.bOriginalPrice+=d.OriginalPrice,i.bPrice+=d.Price,i.bgcAmount+=c,i.bPriceWithTax+=d.PriceWithTax,i.bPriceWithDiscount+=d.ActualPrice+d.ActualTax-c}else r+=1;i.isPresetApply=1==i.isPresetApply||d.isPresetApply,i.isGCApply=1==i.isGCApply||d.isGCApply,i.isMembershipApply=1!=d.isPackageApplied&&(1==i.isMembershipApply||d.isMembershipApply),i.isPackageApplied=1==i.isPackageApplied||d.isPackageApplied,d.isPackageApplied&&(s=!0),d.isMembershipApply&&(l=!0),d.isMembershipApply&&-1==o.indexOf(d.membershipName)&&o.push(d.membershipName),d.isPackageApplied&&-1==n.indexOf(d.membershipName)&&n.push(d.membershipName)}),s&&null!=n&&n.length>0){var d=n.join();i.packageName=d}if(l&&null!=o&&o.length>0){var c=o.join();i.membershipName=c}a.length==r?i.isPointApply=!0:r>0&&(i.isPointApplyPartial=!0);void 0!==i.isPointApply&&0==i.isPointApply?i.bOriginalPrice==i.bPrice?1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(i.bgcAmount>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax):""),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(i.bOriginalPrice-i.bgcAmount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax-i.bgcAmount)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(i.bgcAmount>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax):"")+", new price is "+(_onlineCheckout.decimalFormate(i.bPriceWithTax-i.bgcAmount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax-i.bgcAmount))).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(i.bgcAmount>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bOriginalPrice):""),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(i.bOriginalPrice-i.bgcAmount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bOriginalPrice-i.bgcAmount)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(i.bgcAmount>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bOriginalPrice):"")+", new price is "+(_onlineCheckout.decimalFormate(i.bOriginalPrice-i.bgcAmount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bOriginalPrice-i.bgcAmount))).attr("aria-live","polite").attr("role","contentinfo")):1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(i.bPriceWithDiscount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithDiscount)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax)+", new price is "+(_onlineCheckout.decimalFormate(i.bPriceWithDiscount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithDiscount))).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bOriginalPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(i.bPrice-i.bgcAmount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPrice-i.bgcAmount)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bOriginalPrice)+", new price is "+(_onlineCheckout.decimalFormate(i.bPrice-i.bgcAmount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPrice-i.bgcAmount))).attr("aria-live","polite").attr("role","contentinfo")):void 0!==i.isPointApply&&1==i.isPointApply?(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html("Free"),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax)+", new price is Free").attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.OriginalPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html("Free"),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.OriginalPrice)+", new price is Free").attr("aria-live","polite").attr("role","contentinfo")),parseFloat(0)):1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPriceWithTax)).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPrice)),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,i.bPrice)).attr("aria-live","polite").attr("role","contentinfo")),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProductPromoPointGcApply").html(""),e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProdcutMembershipApply").html(""),void 0!==i.isPresetApply&&1==i.isPresetApply&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Promo Code Applied</span></div></div>'),void 0!==i.isGCApply&&1==i.isGCApply?e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Gift Card Applied</span></div></div>'):(void 0!==i.isPointApply&&1==i.isPointApply||void 0!==i.isPointApplyPartial&&1==i.isPointApplyPartial)&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProductPromoPointGcApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Points Applied</span></div></div>'),void 0!==i.isMembershipApply&&1==i.isMembershipApply&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProdcutMembershipApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Membership Applied ('+i.membershipName.replace(/^,|,$/g,"")+")</span></div></div>"),void 0!==i.isPackageApplied&&1==i.isPackageApplied&&e('#shoppingcartfirst [data-type="inventory"][data-rid="'+i.InventoryId+'"]').find("#divProdcutPackageApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Package Applied ('+i.packageName.replace(/^,|,$/g,"")+")</span></div></div>")}}),e.each(onlineShoppingCart.Packages,function(t,r){var o=e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"]').find("#txtItemsQuantity").val();4==r.eventType&&(e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"]').find("#txtItemsQuantity").attr("disabled","disabled"),o=1);var n=0,s=0;if(void 0!==r.isGCApply&&1==r.isGCApply&&r.GCDetail.length>0&&e.each(onlineShoppingCart.Packages[t].GCDetail,function(e,t){s+=parseFloat(t.GCAmount)}),r.ActualPrice==r.TotalPrice)1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .item-price-line-through").html(s>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax*o):""),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.ActualPrice-s)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax*o-s)),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(s>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax*o):"")+", new price is "+(_onlineCheckout.decimalFormate(r.PriceWithTax*o-s)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax*o-s))).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .item-price-line-through").html(s>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice):""),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.ActualPrice-s)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.ActualPrice-s)),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(s>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice):"")+", new price is "+(_onlineCheckout.decimalFormate(r.ActualPrice-s)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.ActualPrice-s))).attr("aria-live","polite").attr("role","contentinfo")),n+=parseFloat(r.ActualPrice-s);else{if(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing){var l=r.ActualPrice+r.ActualTax-s;e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax*o)),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.PriceWithTax*o-s-r.discount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,l)),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax*o)+", new price is "+(_onlineCheckout.decimalFormate(r.PriceWithTax*o-s-r.discount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,l))).attr("aria-live","polite").attr("role","contentinfo")}else e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.decimalFormate(r.TotalPrice-s-r.discount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice-s-r.discount)),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)+", new price is "+(_onlineCheckout.decimalFormate(r.TotalPrice-s-r.discount)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice-s-r.discount))).attr("aria-live","polite").attr("role","contentinfo");n+=parseFloat(r.TotalPrice-s-r.discount)}if(void 0!==r.isPresetApply&&r.PromotionID>0){var d="";if(void 0!==r.PromotionTitle&&null!=r.PromotionTitle&&(d=r.PromotionTitle.length>0?"("+r.PromotionTitle+")":""),e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#divPkgDDApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Daily Deal Applied '+d+"</span></div></div>"),r.BillingCycle>0)u="<br/>"+(-1==r.BillingCycle?"For unlimited payments ":"After the first "+(r.BillingCycle>1?r.BillingCycle+" payments":"payment"))+", this package price will return to "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)+".",(c=3==r.ChargeFrequency?e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#showPackageVisitCompletedMessage"):e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#showPackageMessage")).length>0&&c.find(".clsPkgInitialDis").html(u)}else if(r.IsInitialDiscount&&r.BillingCycle>0){var c,u="<br/>"+(-1==r.BillingCycle?"For unlimited payments ":"After the first "+(r.BillingCycle>1?r.BillingCycle+" payments":"payment"))+", this package price will return to "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)+".";(c=3==r.ChargeFrequency?e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#showPackageVisitCompletedMessage"):e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#showPackageMessage")).length>0&&c.find(".clsPkgInitialDis").html(u)}void 0!==r.isPresetApply&&1==r.isPresetApply&&e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#divPkgPromoApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Promo Code Applied</span></div></div>'),void 0!==r.isGCApply&&1==r.isGCApply&&e('#shoppingcartfirst [data-type="servicepackage"][data-rid="'+r.ServiceId+'"][data-autoid="'+r.autoId+'"]').find("#divPkgGCApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Gift Card Applied</span></div></div>'),(isNaN(n)||n<0)&&(n=0),1==onlineShoppingCart.IsIncludeTaxInOnlinePricing&&(n=r.ActualPrice==r.TotalPrice?r.PriceWithTax*o-s:r.ActualPrice+r.ActualTax-s),i+=n,1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?i+=r.TotalAddonServicePrice+parseFloat(void 0===r.TotalAddonServiceTax?0:r.TotalAddonServiceTax):i+=r.TotalAddonServicePrice,a+=1,_onlineCheckout.IsRecurringPkg=r.IsRecurring,_onlineCheckout.IsRecurringPkg&&(_onlineCheckout.IsRecurringPkgCount=1)}),e.each(onlineShoppingCart.GiftCertificates,function(t,r){var o=0;if(r.ServiceId>0)o+=parseFloat(r.TotalPrice),1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)).parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)).attr("aria-live","polite").attr("role","contentinfo"):e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)).parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)).attr("aria-live","polite").attr("role","contentinfo");else{var n=getCookie("Referral");void 0!==n&&""!=n&&null!=n&&null!=n||null!=r.IsDailyDealApply&&r.IsDailyDealApply&&(r.Price=r.TotalPrice,r.PromotionID=0),o+=parseFloat(r.Price),r.Price==r.TotalPrice?1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)).parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)).attr("aria-live","polite").attr("role","contentinfo"):e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)).parent().closest("div").attr("aria-label","new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)).attr("aria-live","polite").attr("role","contentinfo"):(e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)),e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find(".div-block-59 .product-name").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)).parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.TotalPrice)+", new price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)).attr("aria-live","polite").attr("role","contentinfo"));if(r.PromotionID>0){var s="";void 0!==r.PromotionTitle&&null!=r.PromotionTitle&&(s=r.PromotionTitle.length>0?"("+r.PromotionTitle+")":""),e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find("#divGCDDApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Daily Deal Applied '+s+"</span></div></div>")}"0"!=r.Price&&"0.00"!=r.Price||e('#shoppingcartfirst [data-type="gc"][data-rid="'+r.GiftCertificatePhotoID+'"][data-autoid="'+r.autoId+'"]').find("#MYDropDown").css("display","none")}(isNaN(o)||o<0)&&(o=0),1==onlineShoppingCart.IsIncludeTaxInOnlinePricing&&(o=r.PriceWithTax),i+=o,a+=1}),e.each(onlineShoppingCart.Memberships,function(t,r){var o=0,n=0;if(void 0!==r.isGCApply&&1==r.isGCApply&&r.GCDetail.length>0&&e.each(onlineShoppingCart.Memberships[t].GCDetail,function(e,t){n+=parseFloat(t.GCAmount)}),r.ActualPrice==r.Price)1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?(e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .item-price-line-through").html(n>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]:""),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").html((_onlineCheckout.decimalFormate(r.ActualPrice-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax-n))+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(n>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]:"")+", new price is "+(_onlineCheckout.decimalFormate(r.PriceWithTax-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax-n))+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]).attr("aria-live","polite").attr("role","contentinfo")):(e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .item-price-line-through").html(n>0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]:""),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").html((_onlineCheckout.decimalFormate(r.ActualPrice-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.ActualPrice-n))+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label",(n>0?"old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]:"")+", new price is "+(_onlineCheckout.decimalFormate(r.ActualPrice-n)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.ActualPrice-n))+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]).attr("aria-live","polite").attr("role","contentinfo")),o+=parseFloat(r.ActualPrice-n);else{if(1==onlineShoppingCart.IsIncludeTaxInOnlinePricing){var s=r.ActualPrice+r.ActualTax-n;e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").html((_onlineCheckout.decimalFormate(r.Price-n-r.productDisc)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,s))+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.PriceWithTax)+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]+", new price is "+(_onlineCheckout.decimalFormate(r.PriceWithTax-n-r.productDisc)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,s))+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]).attr("aria-live","polite").attr("role","contentinfo")}else e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .item-price-line-through").html(_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").html((_onlineCheckout.decimalFormate(r.Price-n-r.productDisc)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price-n-r.productDisc))+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").parent().closest("div").attr("aria-label","old price is "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]+", new price is "+(_onlineCheckout.decimalFormate(r.Price-n-r.productDisc)<0?_onlineCheckout.DisplayAmountOnCart(currencysymbol,0):_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price-n-r.productDisc))+" per "+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]).attr("aria-live","polite").attr("role","contentinfo");o+=parseFloat(r.Price-n-r.productDisc)}if(void 0!==r.isPresetApply&&r.PromotionID>0){var l="";if(void 0!==r.PromotionTitle&&null!=r.PromotionTitle&&(l=r.PromotionTitle.length>0?"("+r.PromotionTitle+")":""),e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find("#divMembershipDDApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Daily Deal Applied '+l+"</span></div></div>"),r.BillingCycle>0){var d=(-1==r.BillingCycle?"For unlimited payments ":"After the first "+(r.BillingCycle>1?r.BillingCycle+" payments":"payment"))+", this membership price will return to "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]+".";e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find("#divMembershipInitialDiscountApply").html(d)}}else if(r.IsInitialDiscount&&r.BillingCycle>0){d=(-1==r.BillingCycle?"For unlimited payments ":"After the first "+(r.BillingCycle>1?r.BillingCycle+" payments":"payment"))+", this membership price will return to "+_onlineCheckout.DisplayAmountOnCart(currencysymbol,r.Price)+"/"+e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find(".div-block-59 .product-name").text().split("/")[1]+".";e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find("#divMembershipInitialDiscountApply").html(d)}void 0!==r.isPresetApply&&1==r.isPresetApply&&e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find("#divMembershipPromoApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Promo Code Applied</span></div></div>'),void 0!==r.isGCApply&&1==r.isGCApply&&e('#shoppingcartfirst [data-type="membership"][data-rid="'+r.MembershipId+'"]').find("#divMembershipGCApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part thm-textColor badge-button-positive"><div class="sign-icon" aria-hidden="true"></div><span class="green-text">Gift Card Applied</span></div></div>'),(isNaN(o)||o<0)&&(o=0),1==onlineShoppingCart.IsIncludeTaxInOnlinePricing&&(o=r.ActualPrice==r.Price?r.PriceWithTax-n:r.ActualPrice+r.ActualTax-n),i+=o,a+=1,_onlineCheckout.IsRecurringMembership=r.IsRecurring,_onlineCheckout.IsRecurringMembership&&(_onlineCheckout.IsRecurringMembershipCount=1)}),e.each(onlineShoppingCart.Events,function(e,t){var r=0;r=parseFloat(t.displayroundedPrice-t.calssdiscountprice-t.classGCUsed)>0?parseFloat(t.displayroundedPrice-t.calssdiscountprice-t.classGCUsed):0,(isNaN(r)||r<0)&&(r=0),1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?i+=r>0?t.roundedPriceWithTax:r:i+=r,i+=_onlineCheckout.CalculateAddonTotal(t.eventEnrollment),a+=1});var r="";r=1==parseInt(a)?"Subtotal ("+a.toString()+" item)":"Subtotal ("+a.toString()+" items)",1==_onlineCheckout.IsRecurringMembershipCount&&(_onlineCheckout.IsRecurringMembership=!0),1==_onlineCheckout.IsRecurringPkgCount&&(_onlineCheckout.IsRecurringPkg=!0),e("#cartsubtotal .cartsubtotaltitle").text(r),e("#cartsubtotal .cartsubtotal").text(_onlineCheckout.DisplayAmountOnCart(currencysymbol,_onlineCheckout.decimalFormate(i))),_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.loadAffirm(),_onlineCheckout.VPLmessagedeposit(i),e("#vpltotalmessage").show(),_siteBuilderDetail.isAffirmEnable&&"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh()}},_onlineCheckout.ApplyMembershipONEvents_ShowDiscount=function(t,i){var a=e.grep(i,function(e){return 2==e.ItemType}),r=0,o=0,n=0,s=0,l=0;if(null!=a&&a.length>0){onlineShoppingCart.classdiscount=0,e.each(t,function(t,d){d.classGCUsed=0,e.each(d.eventEnrollment,function(t,i){void 0===i.IsOutsideBilling&&(i.IsOutsideBilling=!1),void 0===i.IsWaivedApply&&(i.IsWaivedApply=!1);var s=e.grep(a,function(e){return i.customerID>0&&e.UserID>0&&(i.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,i.customerID))||i.customerID<=0&&e.UserID>0&&i.cUserEmail==e.EmailId});e.each(s,function(e,t){if(t.ServiceProductName.toLowerCase().trim()==d.eventName.toLowerCase().trim()&&null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))>new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))&&null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))&&0==i.IsOutsideBilling&&0==i.IsWaivedApply&&(i.strAdvanceLimitDate=t.strAdvanceLimitDate,i.IsWaivedApply=!0,i.AppliedName=t.MembershipName),1==i.isMembershipRemove&&t.ServiceProductName.toLowerCase().trim()==d.eventName.toLowerCase().trim()&&t.Discount>0&&(i.customerID>0&&t.UserID>0&&(i.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,i.customerID))||i.customerID<=0&&t.UserID>0&&i.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)){t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining>0?t.VisitRemaining-1:t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(s,t);return 1==i.isPointApply||!(null==i.gcId||0==i.gcId||i.gcId>0&&0==i.isPackage)||0==i.PromotionID&&1!=i.isPresetApply||(i.discount,i.price=i.Originalprice-i.discount,i.taxprice=_onlineCheckout.parseTodecimal(i.price*d.tax/100,3),i.actualPrice=i.price,i.actualTaxprice=i.taxprice),!1}if(i.price>0&&1!=i.isPointApply&&1!=i.isPackage&&(null==i.gcId||0==i.gcId)&&t.ServiceProductName.toLowerCase().trim()==d.eventName.toLowerCase().trim()&&t.Discount>0&&(i.customerID>0&&t.UserID>0&&(i.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,i.customerID))||i.customerID<=0&&t.UserID>0&&i.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)&&(!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&(0!=i.PromotionID&&1==t.isPromotionalDiscount||0==i.PromotionID||void 0===i.PromotionID)&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))){var a=parseFloat(i.Originalprice);return i.discount=i.discount+_onlineCheckout.GetMembershipDiscountAmount(i.Originalprice,t),a<i.discount&&(i.discount=a),i.price=_onlineCheckout.parseTodecimal(i.Originalprice-i.discount,2),a>0&&(i.taxprice=_onlineCheckout.parseTodecimal(i.price*i.taxprice/a,2)),i.isMembershipApply=!0,i.membershipDiscount=t.Discount,i.membershipuserid=t.UserID,i.membershipUniqueID=t.MembershipUniqueId,t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining-1,i.RedeemBusinessId=t.BusinessID,i.BusinessID=onlineShoppingCart.BusinessID,i.MembershipID=t.MembershipID,i.MembershipItemId=t.MembershipItemId,i.membershipName=t.MembershipName,i.GroupId=t.GroupId,i.VisitRemaining=t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(s,t),!1}if(1!=i.isMembershipApply)if(i.discount=0,i.isMembershipApply=!1,i.membershipDiscount=0,i.membershipUniqueID=null,1!=i.isPointApply&&(null==i.gcId||0==i.gcId||i.gcId>0&&0==i.isPackage)&&void 0!==i.PromotionID&&0!=i.PromotionID){var r=0;r=1==i.IsAmount?i.AmountValue:i.Originalprice*i.AmountValue/100,i.discount=r,i.price=i.Originalprice-r,i.taxprice=_onlineCheckout.parseTodecimal(i.price*d.tax/100,3),i.actualPrice=i.price,i.actualTaxprice=i.taxprice}else _onlineCheckout.isValidForCheckoutInvoice()&&1!=i.isPointApply&&(null==i.gcId||0==i.gcId||i.gcId>0&&0==i.isPackage)&&(i.discount=i.originalDiscount,i.price=i.Originalprice-i.discount,i.taxprice=_onlineCheckout.parseTodecimal(i.price*d.tax/100,3),i.actualPrice=i.price,i.actualTaxprice=i.taxprice)}),r=_onlineCheckout.parseTodecimal(r+i.price,2),o=_onlineCheckout.parseTodecimal(o+i.taxprice,2),i.gcId>0&&0==i.isPackage&&(n=_onlineCheckout.parseTodecimal(n+i.price,2),d.classGCUsed=_onlineCheckout.parseTodecimal(d.classGCUsed+i.price,2)),(i.gcId<0||i.gcId>0)&&1==i.isPackage&&(d.classGCUsed=_onlineCheckout.parseTodecimal(d.classGCUsed+i.price,2))}),d.calssdiscountprice=0,d.addonCalssdiscountprice=0,e.each(d.eventEnrollment,function(e,t){d.calssdiscountprice+=t.discount}),d.calssdiscountprice=_onlineCheckout.parseTodecimal(d.calssdiscountprice,2);var c=_onlineCheckout.ApplyMembershipONEventsAddon_ShowDiscount(d.eventEnrollment,i);r+=c.addonTotalPrice,l+=c.addonTotalTaxPrice,s+=c.addonTotalGCUsed,d.addonCalssdiscountprice=d.addonCalssdiscountprice+c.addonDiscountprice,onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+d.calssdiscountprice+d.addonCalssdiscountprice,2)});var d=parseFloat((r+o+l-(n+s+onlineShoppingCart.classPackageUsed)).toFixed(2));onlineShoppingCart.classTax=parseFloat(o.toFixed(2)),onlineShoppingCart.classGCUsed=n+s,onlineShoppingCart.classFinalTotal=d,onlineShoppingCart.classAddonGCUsed=s,onlineShoppingCart.classAddonTotalTaxPrice=l}},_onlineCheckout.ApplyPointsONEvents_ShowDiscount=function(t,i,a){var r=e.extend(!0,[],a);e.grep(t,function(t){t.calssdiscountprice=0;var a={IsDealGCApply:!0,PerUserOneFlag:!1};e.grep(t.eventEnrollment,function(o){var n=0,s=_onlineCheckout.GetPackageList(r,t,o,a);e.grep(i,function(i){if(o.price>0&&(o.customerID>0&&i.userId>0&&o.customerID==i.userId||o.customerID<=0&&i.userId>0&&o.cUserEmail==i.emailId)){n=i.pointsBalance;var l=t.PointRedeem;if(l>0&&n>0&&n>=l&&(!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==s.length)o.isPointApply=!0,o.pointsRedeem=l,i.pointsBalance=parseInt(n-l),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(o.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(o.pointsRedeem),o.Originalprice=parseFloat(o.price),o.price=0,o.Originaltaxprice=parseFloat(o.taxprice),o.taxprice=0,o.actualPrice=0,o.actualTaxprice=0,o.IsPartialPoint=!1;else if(_onlineCheckout.IsPartialPointAllowed&&l>0&&n>0&&(!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==s.length){parseInt(l-n);var d=parseInt(n);o.isPointApply=!0,o.pointsRedeem=d,i.pointsBalance=parseInt(n-d),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(o.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(o.pointsRedeem),o.Originalprice=parseFloat(o.price),o.Originaltaxprice=parseFloat(o.taxprice),o.IsPartialPoint=!0,o.PartialPrice=parseFloat(_onlineCheckout.CalculateApplyPointsClassPrice(o.price,d,t.PointRedeem)),o.price=_onlineCheckout.parseTodecimal(parseFloat(o.price-o.PartialPrice),2),o.taxprice=_onlineCheckout.parseTodecimal(o.price*t.tax/100,3),o.BusinessTax=_onlineCheckout.ApplyMultipleTax(o.price,o)}else o.isPointApply=!1,o.pointsRedeem=0,o.Originalprice=parseFloat(o.price),o.Originaltaxprice=parseFloat(o.taxprice)}null!=o.lstAddonService&&o.lstAddonService.length>0&&e.grep(o.lstAddonService,function(e){var n=0,s=_onlineCheckout.GetPackageList(r,t,e,a);if(e.Price>0&&(o.customerID>0&&i.userId>0&&o.customerID==i.userId||o.customerID<=0&&i.userId>0&&o.cUserEmail==i.emailId)){n=i.pointsBalance;var l=e.PointRedeem;if(l>0&&n>0&&n>=l&&(!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==s.length)e.isPointApply=!0,e.pointsRedeem=l,i.pointsBalance=parseInt(n-l),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(e.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(e.pointsRedeem),e.Originalprice=parseFloat(e.Price),e.Price=0,e.Originaltaxprice=parseFloat(e.taxprice),e.taxprice=0,e.actualPrice=0,e.actualTaxprice=0,e.IsPartialPoint=!1;else if(_onlineCheckout.IsPartialPointAllowed&&l>0&&n>0&&(!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==s.length){parseInt(l-n);var d=parseInt(n);e.isPointApply=!0,i.pointsBalance=parseInt(n-d),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(d):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(d),e.Originalprice=parseFloat(e.Price),e.IsPartialPoint=!0,e.PartialPrice=parseFloat(_onlineCheckout.CalculateApplyAddonPointsClassPrice(e.Price,e.PointRedeem,d)),e.Price=_onlineCheckout.parseTodecimal(parseFloat(e.Price-e.PartialPrice),2),e.Originaltaxprice=parseFloat(e.taxprice),e.taxprice=_onlineCheckout.parseTodecimal(e.Price*e.tax/100,3),e.actualPrice=0,e.actualTaxprice=0,e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.Price,o),e.pointsRedeem=d}else e.isPointApply=!1,e.pointsRedeem=0,e.Originalprice=parseFloat(e.Price),e.Originaltaxprice=parseFloat(e.taxprice)}})})})})},_onlineCheckout.CalculateApplyAddonPointsClassPrice=function(e,t,i){return i*e/t},_onlineCheckout.ApplyDiscounts_ShowDiscount=function(t,i,a,r,o){if(!_onlineCheckout.isValidForCheckoutInvoice()){if(onlineShoppingCart=e.extend(!0,{},onlineShoppingCartmain),onlineShoppingCart.UsersPoints=i,onlineShoppingCart.ccAmt=0,onlineShoppingCart.amtPaid=0,onlineShoppingCart.tax=0,onlineShoppingCart.Rtax=0,onlineShoppingCart.taxdifference=0,onlineShoppingCart.gcAmt=0,onlineShoppingCart.shippingSurcharge=0,onlineShoppingCart.PackageAmount=0,onlineShoppingCart.tipValue=0,onlineShoppingCart.classSubTotal=0,onlineShoppingCart.classTax=0,onlineShoppingCart.classGCUsed=0,onlineShoppingCart.classPackageUsed=0,onlineShoppingCart.classFinalTotal=0,onlineShoppingCart.discount=0,onlineShoppingCart.lstMembership=a,onlineShoppingCart.lstMembershipOld=JSON.parse(JSON.stringify(a)),onlineShoppingCart.classdiscount=0,onlineShoppingCart.IsPromotionEnable=r,onlineShoppingCart.lstPromotionData=[],onlineShoppingCart.lstGCPkgData=JSON.parse(JSON.stringify(t)),onlineShoppingCart.RedeemedByGCtemp=[],onlineShoppingCart.RedeemedByGC=[],0==o&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0){for(var n=0;n<=onlineShoppingCart.Events.length-1;n++){var s=e.grep(onlineShoppingCart.Events[n].eventEnrollment,function(e){return 1!=e.isTempData});if(s.length>0){var l={cFirstName:"asc",cLastName:"asc",eventDate:"asc"};s.keySort(l),onlineShoppingCart.Events[n].eventEnrollment=s}else onlineShoppingCart.Events.splice(n,1)}onlineShoppingCart.Events.keySort({eventName:"asc"})}e.grep(i,function(e){e.userId==onlineShoppingCart.loginUserId&&e.userId>0&&(onlineShoppingCart.loginUserEmail=e.emailId)});var c=e.grep(t,function(e,t){return 1==e.eventType}),u=e.grep(t,function(e,t){return 1==e.eventType||2==e.eventType});if(null!=c&&c.length>0){l={serviceID:"desc",GiftCertificateAmt:"asc"};c.keySort(l)}if(_onlineCheckout.ApplyDailyDealONPackages(),_onlineCheckout.ApplyDailyDealONMemberships(),_onlineCheckout.ApplyDailyDealONGC(),null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.Memberships,d.Membership),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.Memberships,c,d.Membership)),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(_onlineCheckout.isValidForCheckoutInvoice()&&_onlineCheckout.AddInvoiceDiscount(onlineShoppingCart.Packages,d.Package),_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.Packages,c,d.Package)),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){var p=_onlineCheckout.ApplyPointsONProduct(onlineShoppingCart.Inventories,onlineShoppingCart.UsersPoints),h=e.grep(p,function(e){return 1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)});null!=h&&h.length>0&&(_onlineCheckout.ApplyMembershipONProduct(h,a),_onlineCheckout.ApplyGCONAllItems(h,u,d.Product))}if(null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&_onlineCheckout.ApplyGCONAllItems(onlineShoppingCart.BusinessFee,c,d.BusinessFee),onlineShoppingCart.tax>0){var m=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax,2),f=onlineShoppingCart.tax;f!=m&&(onlineShoppingCart.taxdifference=_onlineCheckout.parseTodecimal(f-m,2),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax-onlineShoppingCart.taxdifference,2),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid-onlineShoppingCart.taxdifference,2),onlineShoppingCart.ccAmt>0&&onlineShoppingCart.ccAmt>onlineShoppingCart.taxdifference?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-onlineShoppingCart.taxdifference,2):onlineShoppingCart.gcAmt>0&&onlineShoppingCart.gcAmt>onlineShoppingCart.taxdifference&&(onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt-onlineShoppingCart.taxdifference,2)))}if(null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){e.grep(onlineShoppingCart.Events,function(t){t.classGCUsed=0,e.grep(t.eventEnrollment,function(t){t.isPointApply=!1,t.isPresetApply=!1,t.gcId=null,t.isPackage=null,t.isMembershipApply=null,t.isPriceBaseGCApply=!1,null!=t.lstAddonService&&null!=t.lstAddonService&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){e.isPointApply=!1,e.isPresetApply=!1,e.gcId=null,e.isPackage=null,e.isMembershipApply=null,e.isPriceBaseGCApply=!1})})});var g=!1,v=e.grep(t,function(e,t){return(2==e.eventType||8==e.eventType)&&(0==e.isCustomPackage||1==e.isCustomPackage&&null==e.serviceID)&&(1==e.isCustomPackage&&null==e.serviceID&&0==g&&(g=!0),!0)}),A=[];if(v.length>0&&v.length>0&&1==_onlineCheckout.IsCCDetailEnable()){l={isPackage:"desc",expiresOn:"asc",quantity:"asc"};v.keySort(l),1==g?e.grep(v,function(i){A.push(i);var a=e.grep(t,function(e){return(2==e.eventType||8==e.eventType)&&1==e.isPackage&&1==e.isCustomPackage&&i.giftCertificateID==e.giftCertificateID&&null!=e.serviceID});a.length>0&&(A=A.concat(a))}):A=v}_onlineCheckout.ApplyPointsONEvents_ShowDiscount(onlineShoppingCart.Events,onlineShoppingCart.UsersPoints,A),A.length>0?onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events,!0,A):onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events),_onlineCheckout.ApplyDailyDealONEvents(),_onlineCheckout.ApplyMembershipONEvents_ShowDiscount(onlineShoppingCart.Events,a),_onlineCheckout.ApplyPriceBaseGCOnEvents(c,!0)}}},_onlineCheckout.ReApplyDiscounts_ShowDiscount=function(){if(!_onlineCheckout.isValidForCheckoutInvoice()){if(onlineShoppingCart.ccAmt=0,onlineShoppingCart.amtPaid=0,onlineShoppingCart.tax=0,onlineShoppingCart.Rtax=0,onlineShoppingCart.taxdifference=0,onlineShoppingCart.gcAmt=0,onlineShoppingCart.RedeemedByGCtemp=[],onlineShoppingCart.RedeemedByGC=[],onlineShoppingCart.shippingSurcharge=0,onlineShoppingCart.classSubTotal=0,onlineShoppingCart.classTax=0,onlineShoppingCart.classGCUsed=0,onlineShoppingCart.classPackageUsed=0,onlineShoppingCart.classFinalTotal=0,onlineShoppingCart.discount=0,onlineShoppingCart.classdiscount=0,null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.Memberships,d.Membership),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.GiftCertificates,d.GiftCertificate),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.Packages,d.Package),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.Inventories,d.Product),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.ServiceInvoice,d.ServiceInvoice),null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&_onlineCheckout.RecalcGCONAllItems(onlineShoppingCart.BusinessFee,d.BusinessFee),onlineShoppingCart.tax>0){var t=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax,2),i=onlineShoppingCart.tax;i!=t&&(onlineShoppingCart.taxdifference=_onlineCheckout.parseTodecimal(i-t,2),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax-onlineShoppingCart.taxdifference,2),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid-onlineShoppingCart.taxdifference,2),onlineShoppingCart.ccAmt>0&&onlineShoppingCart.ccAmt>onlineShoppingCart.taxdifference?onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt-onlineShoppingCart.taxdifference,2):onlineShoppingCart.gcAmt>0&&onlineShoppingCart.gcAmt>onlineShoppingCart.taxdifference&&(onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt-onlineShoppingCart.taxdifference,2)))}var a=e.extend(!0,[],onlineShoppingCart.lstGCPkgData),r=e.grep(a,function(e){return 1==e.eventType&&null==e.quantity&&e.currentBalance>0});if(onlineShoppingCart.RedeemedByGCtemp.length>0){onlineShoppingCart.RedeemedByGC=[];var o=e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){return 1!=e.IsClass}),n=o.uniqueObjects(["GCId"]);e.grep(n,function(t){_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg==t.Type?(objGC={},objGC.giftcertificateId=t.giftcertificateId,objGC.serviceId=t.serviceId,objGC.redeemAmt=t.redeemAmt,objGC.uniqID=t.uniqID,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,e.grep(o,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC==t.Type?(objGC={},objGC.giftcertificateId=t.GCId,objGC.serviceId=t.serviceId,objGC.redeemAmt=t.redeemAmt,objGC.uniqID=t.uniqID,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,e.grep(o,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):(objGC={},objGC.giftcertificateId=t.GCId,objGC.serviceId=0,objGC.redeemAmt=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type="GC",e.grep(o,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.GCAmount,2))}),e.grep(r,function(e){t.GCId==e.giftCertificateID&&(e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-objGC.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC))})}if(null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0){onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events),_onlineCheckout.ApplyDailyDealONEvents();var s=e.extend(!0,[],_onlineCheckout.lstMembershipForCheckout_ShowDiscount);_onlineCheckout.ApplyMembershipONEvents_ShowDiscount(onlineShoppingCart.Events,s),_onlineCheckout.ApplyPriceBaseGCOnEvents(r,!0)}}},_onlineCheckout.Clear_ShowDiscount=function(){_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount=null,_onlineCheckout.lstUserListForCheckout_ShowDiscount=null,_onlineCheckout.lstMembershipForCheckout_ShowDiscount=null,_onlineCheckout.IsPromotionEnable_ShowDiscount=!1,_onlineCheckout.GcAndPackagesForCheckout_ShowDiscount=null,_onlineCheckout.UserListForCheckout_ShowDiscount=null,_onlineCheckout.MembershipForCheckout_ShowDiscount=null,DbCartData=[]},_onlineCheckout.getTotalDailyDealFee=function(t){var i=0;return t&&0!==t.length?(e.each(t,function(t,a){a.eventEnrollment&&a.eventEnrollment.length>0&&e.each(a.eventEnrollment,function(t,a){void 0===a.dailydealFee||isNaN(a.dailydealFee)||(i+=Number(a.dailydealFee)),a.lstAddonService&&a.lstAddonService.length>0&&e.each(a.lstAddonService,function(e,t){void 0===t.dailydealFee||isNaN(t.dailydealFee)||(i+=Number(t.dailydealFee))})})}),i):0},_onlineCheckout.CCOFFDepositPerCalculate=function(e,t){return!e||e<=0?0:t/e*100},_onlineCheckout.getTotalDepositFromCart=function(e){return e*(Number(onlineShoppingCart.DepositsPer)||0)/100},_onlineCheckout.GetTotalCartAmountforDeposits=function(){var t=0;return null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(i){t=1==i.isPackage||1==i.isPointApply?_onlineCheckout.parseTodecimal(t+i.Originalprice,2):_onlineCheckout.parseTodecimal(t+i.price,2),null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e){t=1==e.isPackage||1==e.isPointApply?_onlineCheckout.parseTodecimal(t+e.Originalprice,2):_onlineCheckout.parseTodecimal(t+e.Price,2)})})}),t},_onlineCheckout.calculatedDepositsAmount=function(e){return 1==onlineShoppingCartmain.DepositAmtType?_onlineCheckout.parseTodecimal(100*onlineShoppingCartmain.DepositsPer/e,2):_onlineCheckout.parseTodecimal(e*onlineShoppingCartmain.DepositsPer/100,2)},_onlineCheckout.calculatedDepositsPercent=function(e,t){return 100*t/e},_onlineCheckout.calculateDepositsOnEvents=function(){var t=_onlineCheckout.GetTotalCartAmountforDeposits();if(cartDailyDealFee=_onlineCheckout.getTotalDailyDealFee(onlineShoppingCart.Events),dailydeal_CCOFF_Depositper=_onlineCheckout.CCOFFDepositPerCalculate(t,cartDailyDealFee),totalDepositWhenDepositLessDDFee=_onlineCheckout.getTotalDepositFromCart(t),!onlineShoppingCart.IsFullDeposit&&"false"==isCCRequiredForOnlineClass.toLowerCase()&&cartDailyDealFee>0?(IsDailyDealFeeCCOFF=!0,isCCRequiredForOnlineClass="true",onlineShoppingCart.DepositsPer=dailydeal_CCOFF_Depositper,onlineShoppingCart.DepositsLimit=1,onlineShoppingCartmain.DepositsPer=dailydeal_CCOFF_Depositper):IsDailyDealFeeCCOFF&&cartDailyDealFee<=0&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()&&(IsDailyDealFeeCCOFF=!1,void 0===n||String.isNullOrUndefineOrBlank(n)||(isCCRequiredForOnlineClass=n),onlineShoppingCart.DepositsPer=onlineShoppingCartmain.DepositsPer,onlineShoppingCart.DepositsLimit=onlineShoppingCartmain.DepositsLimit),"true"==isCCRequiredForOnlineClass.toLowerCase()||_onlineCheckout.isValidForCheckoutInvoice()){var i=0;totalDepositWhenDepositLessDDFee<cartDailyDealFee&&t>cartDailyDealFee&&(onlineShoppingCart.DepositsPer=dailydeal_CCOFF_Depositper,onlineShoppingCartmain.DepositsPer=dailydeal_CCOFF_Depositper),e.grep(onlineShoppingCart.Events,function(a){var r=0;void 0===a.tax||a.tax;e.grep(a.eventEnrollment,function(e){var i=void 0!==e.IsPartialPoint&&e.IsPartialPoint;if(e.paidType=_onlineCheckout.arrpaidType.PaidClass,1==e.isPointApply&&!i||1==e.isPackage||0!=e.gcId&&null!=e.gcId||0!=e.price||0!=e.discount||(e.paidType=_onlineCheckout.arrpaidType.Paid),e.depositsTax=0,i||(e.depositsPaid=0),(1!=e.isPointApply||i)&&1!=e.isPackage&&(0==e.gcId||null==e.gcId)){if(_onlineCheckout.isValidForCheckoutInvoice())(e.OriginalpaidType==_onlineCheckout.arrpaidType.DepositsClass||e.OriginalpaidType==_onlineCheckout.arrpaidType.OfflineDeposit)&&void 0!==e.depositsPercentage&&parseFloat(e.depositsPercentage)>0&&(e.depositsPaid=_onlineCheckout.parseTodecimal(e.price*e.depositsPercentage/100,2),e.depositsTax=e.taxprice,e.paidType=_onlineCheckout.arrpaidType.DepositsClass);else if(t>=onlineShoppingCart.DepositsLimit&&!_onlineCheckout.isValidForCheckoutInvoice())if(null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(e.eventDate))e.depositsPaid=0,e.depositsPercentage=0,e.depositsTax=e.taxprice,e.paidType=_onlineCheckout.arrpaidType.UnPaid;else if(0==onlineShoppingCartmain.DepositAmtType&&100!=onlineShoppingCart.DepositsPer&&e.price>0){if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()){var a=e.price+e.taxprice;e.depositsPaid=1==e.IsPartialPoint?e.depositsPaid:_onlineCheckout.calculatedDepositsAmount(a,0),totalDepositWhenDepositLessDDFee<cartDailyDealFee&&e.actualPrice>e.dailydealFee?e.depositsPaid=e.dailydealFee:e.actualPrice<e.dailydealFee&&(e.depositsPaid=e.actualPrice)}else e.depositsPaid=1==e.IsPartialPoint?e.depositsPaid:_onlineCheckout.calculatedDepositsAmount(e.price,0),totalDepositWhenDepositLessDDFee<cartDailyDealFee&&e.actualPrice>e.dailydealFee?e.depositsPaid=e.dailydealFee:e.actualPrice<e.dailydealFee&&(e.depositsPaid=e.actualPrice);e.depositsPercentage=Number(e.dailydealFee)>0?onlineShoppingCartmain.DepositsPer:0,e.depositsTax=e.taxprice,e.paidType=_onlineCheckout.arrpaidType.DepositsClass}else 1==onlineShoppingCartmain.DepositAmtType&&onlineShoppingCart.DepositsPer<e.price&&e.price>0?(e.depositsPaid=1==e.IsPartialPoint?e.depositsPaid:onlineShoppingCartmain.DepositsPer,e.depositsPercentage=_onlineCheckout.calculatedDepositsAmount(e.price,1),e.depositsTax=e.taxprice,e.paidType=100==e.depositsPercentage?_onlineCheckout.arrpaidType.Paid:_onlineCheckout.arrpaidType.DepositsClass):(e.paidType=_onlineCheckout.arrpaidType.PaidClass,e.depositsPaid=0,e.actualPrice<e.dailydealFee&&cartDailyDealFee>0&&(e.dailydealFee=e.actualPrice),0==e.price?1==e.isMembershipApply||e.discount>0?e.paidType=_onlineCheckout.arrpaidType.PaidClass:e.paidType=_onlineCheckout.arrpaidType.UnPaid:1==e.isMembershipApply&&0==onlineShoppingCartmain.DepositAmtType&&onlineShoppingCart.DepositsPer<100&&(e.paidType=_onlineCheckout.arrpaidType.PartiallyPaidClass));else 0!=e.price||1!=e.isMembershipApply&&0!=e.discount?1==e.isMembershipApply?e.paidType=_onlineCheckout.arrpaidType.PartiallyPaidClass:0==e.discount&&(e.paidType=_onlineCheckout.arrpaidType.UnPaid):e.paidType=_onlineCheckout.arrpaidType.PaidClass,e.depositsPaid=0,e.depositsPercentage=0,e.depositsTax=e.taxprice;e.paidType!=_onlineCheckout.arrpaidType.PaidClass&&(e.IsPartialPoint?e.IsDepositsOver?(r=_onlineCheckout.parseTodecimal(r+_onlineCheckout.parseTodecimal(e.price-e.depositsPaid,2)+_onlineCheckout.parseTodecimal(e.depositsTax,2),2),e.depositsRemaining=_onlineCheckout.parseTodecimal(e.price-e.depositsPaid,2)):(r=_onlineCheckout.parseTodecimal(r+_onlineCheckout.parseTodecimal(e.price-e.depositsPaid-e.PartialPrice,2)+_onlineCheckout.parseTodecimal(e.depositsTax,2),2),e.depositsRemaining=_onlineCheckout.parseTodecimal(e.price-e.depositsPaid-e.PartialPrice,2)):(r=_onlineCheckout.parseTodecimal(r+_onlineCheckout.parseTodecimal(e.price-e.depositsPaid,2)+_onlineCheckout.parseTodecimal(e.depositsTax,2),2),e.depositsRemaining=_onlineCheckout.parseTodecimal(e.price-e.depositsPaid,2)))}r+=_onlineCheckout.calculateAddonsDepositsOnEvents(e.lstAddonService,t)}),i=_onlineCheckout.parseTodecimal(i+r,2)}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(e){void 0!==e.BusinessTax&&null!=e.BusinessTax&&""!=e.BusinessTax||(e.BusinessTax=String.isNullOrUndefineOrBlank(e.Taxes)||"[]"==e.Taxes?"[]":JSON.parse(e.Taxes),e.BusinessTax=_onlineCheckout.ApplyMultipleTax(e.price,e))})}),onlineShoppingCart.DepositsRemaining=i}},_onlineCheckout.ApplyPriceBaseGCOnEvents=function(t,i){if(t.length>0){var a=e.grep(t,function(e){return 1==e.eventType&&null==e.quantity&&e.currentBalance>0});if(null!=a&&a.length>0){a.keySort({serviceID:"desc",GiftCertificateAmt:"asc"})}if(a.length>0){var r=onlineShoppingCart.Events,o=0,n=0,s=0,l=0,d=0;if(e.each(r,function(r,c){c.classGCUsed=0,e.each(c.eventEnrollment,function(t,r){if(r.isPriceBaseGCApply=!1,r.paidType==_onlineCheckout.arrpaidType.PaidClass||r.paidType==_onlineCheckout.arrpaidType.DepositsClass||1==i||_onlineCheckout.isValidForCheckoutInvoice()){var l=e.grep(a,function(e){return r.customerID>0&&e.assignTo>=0||r.customerID<=0&&e.assignTo>=0&&(r.cUserEmail==e.emailId||0==e.assignTo)});if((1!=r.isPointApply||1==r.IsPartialPoint)&&1!=r.isPackage&&!(Number(r.dailydealFee)>0)&&(1==i||"true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())){var d=0,u=0;d=parseFloat(r.price),u=parseFloat(r.taxprice),r.paidType==_onlineCheckout.arrpaidType.DepositsClass&&(d=r.depositsPaid,u=0,1==r.IsPartialPoint&&(d=0==r.IsDepositsOver?r.depositsPaid:r.depositsPaid-r.PartialPrice)),r.RemainingPrice=parseFloat(d),r.RemainingTax=parseFloat(u),null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(e){e.giftCertificateID==r.gcId&&null!=e.Taxes&&(r.RemainingTax=0)}),r.GCDetail=[],r.redeemAmt=0,r.redeemTax=0,e.grep(l,function(t){if(r.RemainingPrice>0&&r.RemainingPrice>0&&t.currentBalance>0)if(t.currentBalance>=r.RemainingPrice){r.isPriceBaseGCApply=!0,objGC={},objGC.GCId=t.giftCertificateID,objGC.GCAmount=r.RemainingPrice,objGC.giftCertificateNo=t.giftCertificateNo,objGC.IsClass=!0,r.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),r.gcId=t.giftCertificateID,r.redeemAmt=_onlineCheckout.parseTodecimal(r.redeemAmt+r.RemainingPrice,2),t.currentBalance=_onlineCheckout.parseTodecimal(t.currentBalance-r.RemainingPrice,2),r.RemainingPrice=0;var i=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==r.gcId});String.isNullOrUndefineOrBlank(i)||(i[0].currentBalance=t.currentBalance),e('[id="'+r.gcId+'"]').addClass("w--current")}else if(r.RemainingPrice>t.currentBalance&&t.currentBalance>0){r.isPriceBaseGCApply=!0,objGC={},objGC.GCId=t.giftCertificateID,objGC.GCAmount=t.currentBalance,objGC.giftCertificateNo=t.giftCertificateNo,objGC.IsClass=!0,r.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),r.gcId=t.giftCertificateID,r.redeemAmt=_onlineCheckout.parseTodecimal(r.redeemAmt+t.currentBalance,2),r.RemainingPrice=_onlineCheckout.parseTodecimal(r.RemainingPrice-t.currentBalance,2),t.currentBalance=0;i=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==r.gcId});String.isNullOrUndefineOrBlank(i)||(i[0].currentBalance=0),e('[id="'+r.gcId+'"]').addClass("w--current")}r.RemainingTax>0&&t.currentBalance>0&&(r.RemainingTax=_onlineCheckout.parseTodecimal(r.RemainingTax,3),t.currentBalance>=r.RemainingTax?(r.isPriceBaseGCApply=!0,objGC={},objGC.GCId=t.giftCertificateID,objGC.GCAmount=r.RemainingTax,objGC.giftCertificateNo=t.giftCertificateNo,r.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),objGC.IsClass=!0,r.redeemTax=_onlineCheckout.parseTodecimal(r.redeemTax+r.RemainingTax,2),t.currentBalance=_onlineCheckout.parseTodecimal(t.currentBalance-r.RemainingTax,2),r.RemainingTax=0):r.RemainingTax>t.currentBalance&&t.currentBalance>0&&(r.isPriceBaseGCApply=!0,objGC={},objGC.GCId=t.giftCertificateID,objGC.GCAmount=t.currentBalance,objGC.giftCertificateNo=t.giftCertificateNo,r.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),objGC.IsClass=!0,r.redeemTax=_onlineCheckout.parseTodecimal(r.redeemTax+t.currentBalance,2),r.RemainingTax=_onlineCheckout.parseTodecimal(r.RemainingTax-t.currentBalance,2),t.currentBalance=0))})}}r.BusinessTax=_onlineCheckout.ApplyMultipleTax(r.price,r),o=_onlineCheckout.parseTodecimal(o+r.price,2),n=_onlineCheckout.parseTodecimal(n+r.taxprice,2),r.gcId>0&&0==r.isPackage?(s=_onlineCheckout.parseTodecimal(s+r.price+r.redeemTax,2),c.classGCUsed=_onlineCheckout.parseTodecimal(c.classGCUsed+r.price+r.redeemTax,2)):(r.gcId<0||r.gcId>0)&&1==r.isPackage?c.classGCUsed=_onlineCheckout.parseTodecimal(c.classGCUsed+r.price,2):1==r.isPriceBaseGCApply&&(s=_onlineCheckout.parseTodecimal(s+r.redeemAmt+r.redeemTax,2),c.classGCUsed=_onlineCheckout.parseTodecimal(c.classGCUsed+r.redeemAmt+r.redeemTax,2))});var u=_onlineCheckout.ApplyPriceBaseGCOnEventsAddon(c.eventEnrollment,t,i);o+=u.addonTotalPrice,l+=u.addonTotalTaxPrice,d+=u.addonTotalGCUsed}),_onlineCheckout.isValidForCheckoutInvoice()&&onlineShoppingCart.RedeemedByGCtemp.length>0){onlineShoppingCart.RedeemedByGC=[];var c=onlineShoppingCart.RedeemedByGCtemp.uniqueObjects(["GCId"]);e.grep(c,function(t){_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg==t.Type?(objGC={},objGC.giftcertificateId=t.giftcertificateId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.RedeemServiceId=t.serviceId,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC==t.Type?(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.RedeemServiceId=t.serviceId,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),objGC.GCredeemAmtForDisc=objGC.redeemAmt,onlineShoppingCart.RedeemedByGC.push(objGC)):(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=0,objGC.redeemAmt=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type="GC",e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.GCAmount,2))}),onlineShoppingCart.RedeemedByGC.push(objGC))})}var u=parseFloat((o+n+l-(s+d+onlineShoppingCart.classPackageUsed)).toFixed(2));onlineShoppingCart.classTax=parseFloat(n.toFixed(2)),onlineShoppingCart.classGCUsed=s+d,onlineShoppingCart.classAddonGCUsed=d,onlineShoppingCart.classAddonTotalTaxPrice=l,onlineShoppingCart.classFinalTotal=u}}},_onlineCheckout.GetPackageList=function(t,i,a,r){var o=!1;return e.grep(t,function(e){return null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))>new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))&&null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))&&e.serviceName.toLowerCase().trim()==i.eventName.toLowerCase().trim()&&(0==a.IsOutsideBilling&&(a.strAdvanceLimitDate=e.strAdvanceLimitDate),a.IsWaivedApply=!0,a.AppliedName=e.pkgName),0==o&&1==e.isPackage&&(a.customerID>0&&e.assignTo==a.customerID||a.customerID<=0&&e.emailId==a.cUserEmail)&&null!=e.serviceID&&(e.serviceID==i.eventID||e.serviceName.toLowerCase().trim()==i.eventName.toLowerCase().trim())&&(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))&&(a.discount>0&&a.actualPrice==a.discount&&1!=a.isPointApply&&("1"==a.PerUserOne?0==r.PerUserOneFlag?(r.PerUserOneFlag=!0,r.IsDealGCApply=!1):r.IsDealGCApply=!0:r.IsDealGCApply=!1),-1!=e.quantity&&1==r.IsDealGCApply&&(e.quantity=e.quantity-1),o=!0,!0)})},_onlineCheckout.GetPackageListAddon=function(t,i,a,r){var o=!1;return e.grep(t,function(e){return null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))>new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))&&null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))&&e.serviceName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&(0==a.IsOutsideBilling&&(a.strAdvanceLimitDate=e.strAdvanceLimitDate),a.IsWaivedApply=!0,a.AppliedName=e.pkgName),0==o&&1==e.isPackage&&(a.customerID>0&&e.assignTo==a.customerID||a.customerID<=0&&e.emailId==a.cUserEmail)&&null!=e.serviceID&&(e.serviceID==a.ServiceId||e.serviceName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim())&&(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))&&(a.discount>0&&a.actualPrice==a.discount&&1!=a.isPointApply&&("1"==a.PerUserOne?0==r.PerUserOneFlag?(r.PerUserOneFlag=!0,r.IsDealGCApply=!1):r.IsDealGCApply=!0:r.IsDealGCApply=!1),-1!=e.quantity&&1==r.IsDealGCApply&&(e.quantity=e.quantity-1),o=!0,!0)})},_onlineCheckout.createGiftCertificatesCartsubTotal=function(){e("#divGiftCertificatelistCart > a").removeClass("w--current");var t=[];void 0!==onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(i){if(0==i.isPackage&&i.gcId>0&&1!=i.isPriceBaseGCApply){var a={};a.giftCertificateNo=i.giftCertificateNo,a.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,a.giftcertificateId=i.gcId,a.redeemAmt=i.price,t.push(a)}1==i.isPriceBaseGCApply&&e.grep(i.GCDetail,function(e){var i={};i.giftCertificateNo=e.giftCertificateNo,i.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,i.giftcertificateId=e.GCId,i.redeemAmt=e.GCAmount,t.push(i)}),!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(i){if(0==i.isPackage&&i.gcId>0&&1!=i.isPriceBaseGCApply){var a={};a.giftCertificateNo=i.giftCertificateNo,a.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,a.giftcertificateId=i.gcId,a.redeemAmt=i.Price,t.push(a)}1==i.isPriceBaseGCApply&&e.grep(i.GCDetail,function(e){var i={};i.giftCertificateNo=e.giftCertificateNo,i.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,i.giftcertificateId=e.GCId,i.redeemAmt=e.GCAmount,t.push(i)})})})});var i=(t=t.concat(onlineShoppingCart.RedeemedByGC)).uniqueObjects(["giftcertificateId"]),a=[];return e.grep(i,function(i){var r=0;if(i.Type==_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC&&void 0!==i.giftCertificateNo&&null!=i.giftCertificateNo){var o={};o.giftCertificateNoLast=i.giftCertificateNo.substr(i.giftCertificateNo.length-4),o.CurrencySymbol=currencysymbol,e.grep(t,function(e){i.giftcertificateId==e.giftcertificateId&&(r=_onlineCheckout.parseTodecimal(r+e.redeemAmt,3))}),o.redeemAmt=r,a.push(o),e('[id="gcNo_'+i.giftCertificateNo+'"]').addClass("w--current"),_onlineCheckout.SetGCStatus(i.giftcertificateId,T.Add)}}),a},_onlineCheckout.createGiftCertificates=function(t){var i=e.grep(t,function(e,t){return!e.isPackage});i.keySort({serviceID:"desc",GiftCertificateAmt:"asc"});var a=[];"true"==isCCRequiredForOnlineClass.toLowerCase()&&void 0!==onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t,i){a.push(t.eventName.toLowerCase().trim()),e.grep(t.eventEnrollment,function(t,i){!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e,t){a.push(e.ServiceTitle.toLowerCase().trim())})})}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e,t){a.push(e.servicename.toLowerCase().trim())});var r=[];e.grep(i,function(e,t){if(null==e.serviceID||e.serviceID>0&&a.indexOf(e.serviceName.toLowerCase().trim())>-1){var i={};i.giftCertificateNo=e.giftCertificateNo,i.giftCertificateID=e.giftCertificateID,i.giftCertificateNoLast=e.giftCertificateNo.substr(e.giftCertificateNo.length-4),i.currentBalance=e.currentBalance,i.CurrencySymbol=currencysymbol,i.AvailabeVisit="",i.isservicebase=!1,null!=e.serviceID&&(i.isservicebase=!0,i.AvailabeVisit="("+e.quantity+" "+(e.quantity>1?"visits":"visit")+")"),r.push(i)}}),r.length>0?(e("#divGiftCertificateCart").show(),e("#divGiftCertificatelistCart").html(""),e("#tmplGiftCertificatelistCart").tmpl(r).appendTo("#divGiftCertificatelistCart"),1==r.length?e('[id="gcNo_'+r[0].giftCertificateNo+'"]').addClass("only-one"):e('[id="gcNo_'+r[0].giftCertificateNo+'"]').removeClass("only-one"),void 0!==_shopdetail&&null!=_shopdetail&&e(_shopdetail.tabAddGiftCards).removeClass("giftcard-shipping-method")):void 0!==_shopdetail&&null!=_shopdetail&&e(_shopdetail.tabAddGiftCards).addClass("giftcard-shipping-method")};var T={Default:0,Add:1,Remove:2};_onlineCheckout.SetGCStatus=function(t,i){e.grep(onlineShoppingCart.lstGCPkgData,function(e){(e.giftCertificateID==t||null==t&&i==T.Default)&&(e.assignStatus=i)})},_onlineCheckout.ManageGC=function(t){if(_onlineCheckout.IsBuyGC=!0,null!=t){var i=e('[id="'+t.id+'"]'),a=i.data("gcid"),r=i.data("isservicebase");_onlineCheckout.isCheckoutVPLChanged=!1,e("#divVplTracking").hide(),a=e('[id="'+t.id+'"]').data("gcid"),r=e('[id="'+t.id+'"]').data("isservicebase");var o=!1;e.grep(onlineShoppingCart.lstGCPkgData,function(n){if(n.giftCertificateID==a)if(i.hasClass("w--current")){o=!0,r=!1,n.assignStatus=T.Remove,n.currentBalance=String.isNullOrUndefineOrBlank(n.ResetcurrentBalance)?n.currentBalance:n.ResetcurrentBalance,i.removeClass("w--current"),null!=onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(isGCAppliedForClass=!0,e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){1==t.isPointApply&&1!=t.IsPartialPoint||1==t.isPackage||(t.gcId==a&&(n.currentBalance=String.isNullOrUndefineOrBlank(n.ResetcurrentBalance)?n.currentBalance+t.redeemAmt:n.ResetcurrentBalance,null!=n.quantity&&-1!=n.quantity&&(n.quantity+=1)),t.gcId=null,t.GCDetail=[],t.isPriceBaseGCApply=!1,t.isGCApply=!1,t.isDecisionTaken=null,t.redeemAmt=0,t.redeemTax=0,t.isServiceBaseGC=!1,t.isMembershipRemove=!0),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){1==e.isPointApply&&1!=e.IsPartialPoint||1==e.isPackage||(e.gcId==a&&(n.currentBalance=String.isNullOrUndefineOrBlank(n.ResetcurrentBalance)?n.currentBalance+e.redeemAmt:n.ResetcurrentBalance,null!=n.quantity&&-1!=n.quantity&&(n.quantity+=1)),e.gcId=null,e.GCDetail=[],e.isPriceBaseGCApply=!1,e.isGCApply=!1,e.isDecisionTaken=null,e.redeemAmt=0,e.redeemTax=0,e.isServiceBaseGC=!1,e.isMembershipRemove=!0)})})}),onlineShoppingCart.RedeemedByGCtemp=e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){return e.GCId!=a}));var s=[];null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&(s=onlineShoppingCart.Memberships),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(s=s.concat(onlineShoppingCart.GiftCertificates)),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(s=s.concat(onlineShoppingCart.Packages)),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&(s=s.concat(onlineShoppingCart.Inventories)),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&(s=s.concat(onlineShoppingCart.ServiceInvoice)),null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&(s=s.concat(onlineShoppingCart.BusinessFee)),s.length>0&&e.grep(s,function(e){e.redeemAmt=0,e.redeemTax=0,e.GCDetail=[],e.isGCApply=!1,void 0!==e.isServiceBaseGC&&(e.isServiceBaseGC=!1)}),setTimeout(function(){e("#divcheckoutSelectPaymentMethodTitle").attr("tabindex",0).attr("role","heading").focus()},500)}else{var l=parseFloat(onlineShoppingCart.ccAmt)+parseFloat(onlineShoppingCart.classFinalTotal-parseFloat(onlineShoppingCart.DepositsRemaining));_onlineCheckout.isValidForCheckoutInvoice()&&(l=parseFloat(onlineShoppingCart.ccAmt)+parseFloat(onlineShoppingCart.classFinalTotal)-parseFloat(onlineShoppingCart.DepositsRemaining)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining)),!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"!=isCCRequiredForOnlineClass.toLowerCase()&&!IsDailyDealFeeCCOFF&&(l=parseFloat(l-parseFloat(onlineShoppingCart.classFinalTotal))),l>0||n.serviceID>0?(o=!0,n.assignStatus=T.Add,i.addClass("w--current"),void 0!==onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(isGCAppliedForClass=!0,e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){1!=t.isPointApply&&1!=t.isPackage&&(t.gcId=null,t.GCDetail=[],t.isPriceBaseGCApply=!1,t.isGCApply=!1,t.isDecisionTaken=null,t.redeemAmt=0,t.redeemTax=0,n.serviceID>0&&(t.isMembershipApply=!1)),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){1!=e.isPointApply&&1!=e.isPackage&&(e.gcId=null,e.GCDetail=[],e.isPriceBaseGCApply=!1,e.isGCApply=!1,e.isDecisionTaken=null,e.redeemAmt=0,e.redeemTax=0,n.serviceID>0&&(e.isMembershipApply=!1))})})}))):0==l&&onlineShoppingCart.tipValue>0?_common.PassiveAlertWarning("Amount Due could not be Paid with this gift card.",t):_common.PassiveAlertfail("Unable to add another gift card because the amount due is zero.")}}),1==o&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.calculateDepositsOnInvoice(!1),_onlineCheckout.RecalcGCONAllItemsAfterPreset(!0),_onlineCheckout.ReApplyDiscounts(),setTimeout(function(){1==r&&0==i.hasClass("w--current")&&_common.PassiveAlertWarning("Amount Due could not be Paid with this gift card.",t)},200)),_onlineCheckout.IsVCFEnable()&&_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.ApplyGC)}_onlineCheckout.IsBuyGC=!1},_onlineCheckout.LoadShoppingCartExternal=function(){ShowLoader(!0);var t,i={UserControlPath:"~/UserControls/ShopDetail/ucShoppingCartPage.ascx",PageNamePath:"~/detail.aspx",isRemoveFormTag:!0};t={GroupID:groupID,BusinessId:_shopdetail.businessID,VagaroURL:_shopdetail.vagaroUrl,loggedInUserId:_siteBuilderDetail.loginUserId,IsAllowTipForInvoice:IsAllowTipForInvoice,EncryptedInvoiceNo:EncryptedInvoiceNo,IsPopup:IsPopup,IsNewCustomWebsite:IsNewCustomWebsite,IsCustomWebsite:isCustomWebsite,IsLiveStream:_onlineCheckout.IsCalledFromLiveStream(),IsPromotionUI:isPromotionUI,IsWidget:isWidget,IsFacebook:isFacebook,IsNewReDesignWidget:IsNewReDesignWidget},i.Parameters=t;var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumBooking.LoadUserControl,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(t){e(".pagebodycontainer").html(e("#dvCart").html());var i=e("#dvShoppingCart");i.html(""),i.append(t),i.show(),"undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail.isAffirmEnable&&"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),DisplayFullView(!0),e(".cancel-select-service:visible").length>0&&(e(".cancel-select-service:visible").trigger("touchstart"),_common.closeServiceSelection()),e("#pageSection").hide().removeClass("pagesectionFlex"),e("#dvOnlineAppoinmentBooked").hide(),e("#divWriteReview").hide(),1==_onlineCheckout.IsCalledFromLiveStream()&&(e("#shoppingcartfirst").hide(),e("#shoppingcartsecond").show(),e("#btnContShoppingCheckoutForClass").click()),ShowLoader(!1)},a.datamodel.data=i,a.datamodel.Error=CallFail_LoadUserControlWithProxy,a.Post()},_onlineCheckout.IsUserHaveSharedMS=function(e,t){return t=void 0===t||null==t?"":t,(null!=e?e.split(","):"").indexOf(t.toString())>-1},_onlineCheckout.showDiffUserAddress=function(t){"Tab 1"==e(t).data("w-tab")?(e(t).siblings(".w-tab-link").removeClass("w--current"),e("#userNewAddressValidate").removeClass("w--tab-active"),e(t).addClass("w--current"),e("#userNewAddressValidate").siblings(".w-tab-pane").addClass("w--tab-active"),e("#userNewAddressValidate").siblings(".w-tab-pane").css({opacity:1,transition:"opacity 300ms ease 0s"})):(e(t).siblings(".w-tab-link").removeClass("w--current"),e("#userNewAddressValidate").siblings(".w-tab-pane").removeClass("w--tab-active"),e(t).addClass("w--current"),e("#userNewAddressValidate").addClass("w--tab-active"),e("#userNewAddressValidate").css({opacity:1,transition:"opacity 300ms ease 0s"}))};var B={1:"us-f",2:"uk-f",3:"canada-f",4:"aus-f"};_onlineCheckout.txtLiveStreamAddress="#txtLiveStreamAddress",_onlineCheckout.clscountryselectmyacprofile=".countryselectmyacprofile",_onlineCheckout.hdnLiveStreamCountryId="#hdnLiveStreamCountryId",_onlineCheckout.selectCountryDiv="#selectedCountrudiv",_onlineCheckout.divLiveStreamAddressControl="#divLiveStreamAddressControl",_onlineCheckout.SelectLiveStreamCountry=function(t){e(_onlineCheckout.txtLiveStreamAddress).select2("val"," "),e(_onlineCheckout.selectCountryDiv).removeClass().addClass("selectedcountry "+B[t]).attr("aria-label",B[t]+" Selected"),e(_onlineCheckout.hdnLiveStreamCountryId).val(t),e(".countryselectoption").hide(),e(_onlineCheckout.txtLiveStreamAddress).select2("focus")},_onlineCheckout.ShowLiveStreamCountry=function(){return e(_onlineCheckout.clscountryselectmyacprofile).is(":visible")?void e(_onlineCheckout.clscountryselectmyacprofile).hide():void e(_onlineCheckout.clscountryselectmyacprofile).show()},_onlineCheckout.SetLiveStreamAddressControl=function(){var t=e(_onlineCheckout.txtLiveStreamAddress).select2({searchInputPlaceholder:"City or Zip Code",minimumInputLength:1,combobox:!0,dropdownCssClass:"select-location-icons select2-drop-active select-customdropdown",selectOnClick:!0,multiple:!1,closeOnSelect:!0,allowClear:!0,ajax:{type:"POST",contentType:"application/json; charset=utf-8",url:"/WebServices/CommonWebService.asmx/GetLocationOrPlaceDetail",dataType:"json",quietMillis:250,transport:function(t){return t.beforeSend=function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val())},e.ajax(t)},data:function(){return{searchText:e(_onlineCheckout.txtLiveStreamAddress).val(),countryFilter:countryMapping[e(_onlineCheckout.hdnLiveStreamCountryId).val()],Location:(""!=lattitude?parseFloat(lattitude):0)+","+(""!=longitude?parseFloat(longitude):0)}},results:function(e,t){return{results:e}},params:{error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}}},cache:!1},formatNoMatches:function(){return e("#select2-drop").css("display","block"),"No matches found"},formatSearching:function(){return e("#select2-drop").css("display","block"),"Searching"},formatInputTooShort:function(t,i){return e("#select2-drop").css("display","none"),""},initSelection:function(t,i){i({id:e(_onlineCheckout.txtLiveStreamAddress).val(),text:e(_onlineCheckout.txtLiveStreamAddress).val()})},formatResult:function(t){return e("#select2-drop").css("display","block"),'<div data-placeid="'+t.place_id+'"><span class="fullocation">'+t.FormattedAddress+"</span></div>"}});t.on("select2-loaded",function(t){e(".select2-result-unselectable").addClass("select2-result-selectable").removeClass("select2-result-unselectable")}),t.on("select2-blur",function(e){e.preventDefault()}),t.on("selected",function(t){ShowLoader(!0),e(t.currentTarget).select2("val",t.choice.CityState),e(t.currentTarget).attr("data-isselected","true"),e(t.currentTarget).attr("data-preval",t.choice.CityState),e(t.currentTarget).data("selectedid",t.choice.CityState);var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumOnlineCommon.getlocationsearchbyplaceid,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data={placeID:t.choice.place_id},i.datamodel.callback=function(t){if(ShowLoader(!1),null!=t&&"null"!=t){var i=null!=t&&null==t.city?"":t.city.split(",")[0],a=null==t.state?"":t.state;a=a.trim();var r={};r.street=t.Address,r.city=i,r.state=a,r.zip=t.zipCode,r.countryId=t.countryID,r.countrytext=countryMapping[t.countryID],r.statecode=t.stateCode,r.rowOffSet=t.utcOffset,r.timeZoneOffSet=t.timeZoneOffSet,r.isSupportDayLight=t.IsSupportDayLight,e("#hdnLiveStreamSelectedVal").val(JSON.stringify(r)),_onlineCheckout.ChangeCustomerStartTime(t.timeZoneOffSet,t.countryID,t.IsSupportDayLight)}},i.datamodel.Error=function(e){ShowLoader(!1),console.log(e)},i.Post()}),t.on("select2-close",function(t){e(t.currentTarget).removeAttr("data-isselected")})},_onlineCheckout.InitLiveStreamAddressControl=function(){e(_onlineCheckout.selectCountryDiv).removeClass().addClass("selectedcountry "+B[e(_onlineCheckout.hdnLiveStreamCountryId).val()]),_onlineCheckout.SetLiveStreamAddressControl(),_shopdetail.NewAddressHtml()},_onlineCheckout.CheckLiveStreamAddressVisibleOrNot=function(){if(e(_onlineCheckout.divLiveStreamAddressControl).hide(),0==String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0){var t=!1;e.each(onlineShoppingCartmain.Events,function(i,a){!String.isNullOrUndefineOrBlank(a.eventEnrollment)&&a.eventEnrollment.length>0&&e.each(a.eventEnrollment,function(e,i){(!String.isNullOrUndefineOrBlank(i.IsFromHomePage)&&1==i.IsFromHomePage||1==i.StreamingStatus)&&(t=!0)})}),1==t&&(e(_onlineCheckout.divLiveStreamAddressControl).show(),_onlineCheckout.InitLiveStreamAddressControl())}},_onlineCheckout.SetEventDateFormat=function(e,t,i,a){return String.isNullOrUndefineOrBlank(t)||String.isNullOrUndefineOrBlank(i)?_onlineCheckout.dateformate(e,"MMM DD, YYYY"):1==a?countryDateFormat(moment(t),VagaroCountryDateFormat.LargeDate):countryDateFormat(moment(t),VagaroCountryDateFormat.LargeDateWithTime)+" ("+i+")"},_onlineCheckout.SetEventTimeFormat=function(e,t,i,a,r){if(String.isNullOrUndefineOrBlank(i)||String.isNullOrUndefineOrBlank(r)||String.isNullOrUndefineOrBlank(a))return e.replace(/^0+/,"")+" - "+t.replace(/^0+/,"");var o=moment(a).format("h:mm A");return moment(i).format("h:mm A")+" - "+o+" ("+r+")"},_onlineCheckout.ChangeCustomerStartTime=function(t,i,a){ShowLoader(!0);var r=[];null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){var i={};i.autoId=t.autoId,i.eventID=t.eventID,i.eventName=t.eventName;var a=[];e.grep(t.eventEnrollment,function(e){if(1==e.StreamingStatus){var t={};t.autoID=e.autoID,t.appointmentID=e.appointmentID,t.eventID=e.eventID,t.UtcStartTime=e.UtcStartTime,t.workshopActualDate=e.eventDate,t.startTime=e.startTime,t.endTime=e.endTime,t.DurationValue=e.DurationValue,a.push(t)}}),null!=a&&a.length>0&&(i.eventEnrollment=a,r.push(i))});var o={ShoppingCartEvent:r,TimeZoneOffSet:t,CountryId:i,IsSupportDayLight:a,BusinessID:_shopdetail.businessID},n=new vagaro.ajax;n.datamodel.Token=ApiURLEnumOnlineCheckout.geteventtimezonedate,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.data={objRequest:o},n.datamodel.callback=function(e){ShowLoader(!1),null!=e&&null!=e.ShoppingCartEvent&&e.ShoppingCartEvent.length>0&&_onlineCheckout.SetCustomerStartTimeValue(e.ShoppingCartEvent)},n.datamodel.Error=function(e){ShowLoader(!1)},n.Post()},_onlineCheckout.SetCustomerStartTimeValue=function(t){null!=t&&t.length>0&&e.grep(t,function(t){var i=e.grep(onlineShoppingCart.Events,function(e){return e.autoId==t.autoId&&e.eventID==t.eventID}),a=e.grep(onlineShoppingCartmain.Events,function(e){return e.autoId==t.autoId&&e.eventID==t.eventID});e.grep(t.eventEnrollment,function(t){null!=i&&i.length>0&&e.grep(i,function(i){e.grep(i.eventEnrollment,function(e){e.autoID==t.autoID&&e.appointmentID==t.appointmentID&&(e.CustomerStartTime=t.CustomerStartTime,e.CustomerTimeZone=t.CustomerTimeZone,e.CustomerEndTime=t.CustomerEndTime)})}),null!=a&&a.length>0&&e.grep(a,function(i){e.grep(i.eventEnrollment,function(e){e.autoID==t.autoID&&e.appointmentID==t.appointmentID&&(e.CustomerStartTime=t.CustomerStartTime,e.CustomerTimeZone=t.CustomerTimeZone,e.CustomerEndTime=t.CustomerEndTime)})});var r=t.autoID+""+t.appointmentID;e("#dv"+r).html(_onlineCheckout.SetEventDateFormat(t.workshopActualDate,t.CustomerStartTime,t.CustomerTimeZone,!1)),e("#dvdt"+r).html(_onlineCheckout.SetEventDateFormat(t.workshopActualDate,t.CustomerStartTime,t.CustomerTimeZone,!0)),e("#dvti"+r).html(_onlineCheckout.SetEventTimeFormat(t.startTime,t.endTime,t.CustomerStartTime,t.CustomerEndTime,t.CustomerTimeZone))})})},_onlineCheckout.IsCalledFromLiveStream=function(){return void 0!==_shopdetail&&void 0!==_shopdetail.IsCalledFromLiveStream&&null!=_shopdetail.IsCalledFromLiveStream&&_shopdetail.IsCalledFromLiveStream},_onlineCheckout.IsCCSupportedCountry=function(){return null!=typeof IsCCSupportedCountry&&null!=IsCCSupportedCountry&&1==IsCCSupportedCountry},_onlineCheckout.IsSelectGCEmployeeForWidget=function(){if("undefined"!=typeof _common&&(!String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)&&1==_common.IsWidgetForServiceProvider(!0)||_common.isCreateLinkPreserve(!0,!0))&&1==e(".MYDropDown").is(":visible")){var t=0;if(_common.isCreateLinkPreserve(!0,!0)){var i=_common.isCreateLinkPreserve(!1);t=1==i.length&&"-1"!=i[0]?parseInt(i[0]):0}else t=_common.IsWidgetForServiceProvider(!1);t>0&&(e(".SelectEmployee").val(t),e(".SelectEmployee").trigger("change"),e(".SelectEmployee").attr("disabled","disabled"))}},_onlineCheckout.GetCoreAPIURLWithToken=function(e,t){try{var i="",a=VagaroCorePublicAPIURLV2.split("/");if(void 0!==t&&null!=t&&""!=t)a[3]=t,i=a.join("/")+e;else if("undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID){var r=myAccountUserGroupID.split(",");r.length>0&&(a[3]=r[0],i=a.join("/")+e)}return""==i&&(i=CoreAPIURL+e),i}catch(t){return CoreAPIURL+e}},_onlineCheckout.ChangeCountry=function(t){_onlineCheckout.selectedCountryId=t;var i="";e(".countryflag").removeClass("active"),1==t?(e(".lblZipCode").text("ZIP Code:"),e("#txtNewZip").attr("placeholder","ZIP Code"),e("#lblState").text("State:"),e("#lblCity").text("City:"),e("#txtNewCity").attr("placeholder","City"),i="us-f"):2==t?(e(".lblZipCode").text("Postcode:"),e("#txtNewZip").attr("placeholder","Postcode"),e("#lblState").text("County:"),e("#lblCity").text("City:"),e("#txtNewCity").attr("placeholder","City"),i="uk-f"):3==t?(e(".lblZipCode").text("Postal Code:"),e("#txtNewZip").attr("placeholder","Postal Code"),e("#lblState").text("Province:"),e("#lblCity").text("City:"),e("#txtNewCity").attr("placeholder","City"),i="canada-f"):4==t&&(e(".lblZipCode").text("Postcode:"),e("#txtNewZip").attr("placeholder","Postcode"),e("#lblState").text("State/Territory:"),e("#lblCity").text("Suburb:"),e("#txtNewCity").attr("placeholder","Suburb"),i="aus-f"),0==_onlineCheckout.IsVPLAddress&&_onlineCheckout.BindState(!1),e("#cboCountryshopping").val(t),e(".flag-"+i).addClass("active"),e("#mycountrypopup").removeClass(),e("#mycountrypopup").addClass("selectedcountry "+i),e("#mycountrypopupVPL").removeClass(),e("#mycountrypopupVPL").addClass("selectedcountry "+i),e(".selectoptionpopup").css("display","none"),e(".selectoptionpopup").removeClass("active")},_onlineCheckout.GetState=function(){var e=new vagaro.ajax;e.datamodel.async=!1,e.datamodel.Token=_onlineCheckout.GetCoreAPIURLWithToken(ApiURLEnumOnlineCheckout.getState,groupID),e.datamodel.data={},e.datamodel.IsNewVagaroAPI=!0,e.datamodel.callback=_onlineCheckout.GetState_Success,e.datamodel.Error=_onlineCheckout.GetState_Failure,e.Post()},_onlineCheckout.GetState_Success=function(e){1e3==e.ResponseCode&&(_onlineCheckout.popupStateList=e.Data,_onlineCheckout.BindState(!0))},_onlineCheckout.GetState_Failure=function(e){swal({title:e.get_message(),text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn"},function(e){swal.close()})},_onlineCheckout.BindState=function(t){e(".ddlState").html(""),e(".ddlState").html('<option value="0">Select</option>'),e.grep(_onlineCheckout.popupStateList,function(t){t.CountryID==_onlineCheckout.selectedCountryId&&e(".ddlState").append(e("<option></option>").val(t.StateID).html(t.DisplayStateCode))}),1!=t||void 0===_onlineCheckout.selectedAddressData.statecode||isNullOrUndefineOrBlank(_onlineCheckout.selectedAddressData.statecode)||e.grep(_onlineCheckout.popupStateList,function(t){t.StateCode==_onlineCheckout.selectedAddressData.statecode&&e(".ddlState").val(t.StateID)})},_onlineCheckout.flagChange=function(t){var i=e("#mycountrypopup");if(1==t)i=e("#mycountrypopupVPL");if(i!==event.target&&!i.has(event.target).length){if("mycountrypopup"==event.target.id||"mycountrypopupselection"==event.target.id||"mycountrypopupVPL"==event.target.id||"mycountrypopupVPL"==event.target.id)return e("#ulcartcountryselectoptionpopup").is(":visible")?void e("#ulcartcountryselectoptionpopup").hide():void e("#ulcartcountryselectoptionpopup").show();e("#ulcartcountryselectoptionpopup").hide()}},_onlineCheckout.CreateAuthoriseList=function(t){_onlineCheckout.AuthoriseListData=[],void 0!==t&&null!=t&&void 0!==t.classCheckoutResponse&&null!=t.classCheckoutResponse&&t.classCheckoutResponse.length>0&&void 0!==t.classCheckoutResponse[0].failSPlistAndReason&&null!=t.classCheckoutResponse[0].failSPlistAndReason&&t.classCheckoutResponse[0].failSPlistAndReason.length>0&&e.grep(t.classCheckoutResponse[0].failSPlistAndReason,function(e){var t={};void 0!==e.NextActionUrl&&null!=e.NextActionUrl&&""!=e.NextActionUrl&&(t.NextActionUrl=e.NextActionUrl,t.MerchantTokenID=e.MerchantTokenID,t.Type=_onlineCheckout.ItemType.Class,t.Isauthorise=!1,e.vplAmount>0?t.IsVPLTransaction=!0:t.IsVPLTransaction=!1,_onlineCheckout.AuthoriseListData.push(t))}),void 0!==t&&null!=t&&void 0!==t.checkoutResponse&&null!=t.checkoutResponse&&void 0!==t.checkoutResponse.ccDistribution&&null!=t.checkoutResponse.ccDistribution&&t.checkoutResponse.ccDistribution.length>0&&e.grep(t.checkoutResponse.ccDistribution,function(e){var t={};void 0!==e.NextActionUrl&&null!=e.NextActionUrl&&""!=e.NextActionUrl&&(t.NextActionUrl=e.NextActionUrl,t.MerchantTokenID=e.MerchantTokenID,t.Type=_onlineCheckout.ItemType.Other,t.Isauthorise=!1,e.vplAmount>0?t.IsVPLTransaction=!0:t.IsVPLTransaction=!1,_onlineCheckout.AuthoriseListData.push(t))})},_onlineCheckout.AuthorisePayment=function(){var e={},t={buttonname:"bookwithcc"};e.CountryID=countryIdBusDetail,e.PaymentIntentURL=_onlineCheckout.AuthoriseListData[_onlineCheckout.AuthorisePaymnetCount].NextActionUrl,e.SuccessCallBackResponse=t,e.SuccessCallBack=SuccessCallBack=_onlineCheckout.threeDSSuccessCheckout,e.FailedCallback=_onlineCheckout.threeDSFailCheckout,e.IsAffirm=!1,_cardIntendent.LoadCardCaptureIntendentInfo(e)},_onlineCheckout.IsVagaroMarketplace=function(){return!String.isNullOrUndefineOrBlank(document.referrer)&&!String.isNullOrUndefineOrBlank(document.location.origin)&&document.referrer.indexOf(document.location.origin)>=0&&document.referrer.indexOf("/CheckInApp/")<=0&&!IsFromCreateLink},_onlineCheckout.VPLBankDetailsBind=function(){ShowLoader(!0);var t=e("<XMLDocument/>");t.append(_vgClassSessionSelection.createXmlElement("UsersDetail")),(r=_vgClassSessionSelection.createXmlElement("User")).append(_vgClassSessionSelection.createXmlElement("userid",parseInt(onlineShoppingCart.loginUserId))),r.append(_vgClassSessionSelection.createXmlElement("email","")),r.append(_vgClassSessionSelection.createXmlElement("isloginuser",!0)),r.append(_vgClassSessionSelection.createXmlElement("encryptUserId",glbEncryptUserIdWithSafeURL)),t.find("UsersDetail").append(r);for(var i=_vgClassSessionSelection.ManageEventTempAndRealData(!0,!1,!1),a=0;a<=i.length-1;a++){var r;if(parseInt(onlineShoppingCart.loginUserId)!=parseInt(i[a].customerID))(r=_vgClassSessionSelection.createXmlElement("User")).append(_vgClassSessionSelection.createXmlElement("userid",parseInt(i[a].customerID))),r.append(_vgClassSessionSelection.createXmlElement("email",i[a].cUserEmail)),t.find("UsersDetail").append(r)}var o=e("<XMLDocument/>");if(null!=onlineShoppingCartmain.Inventories&&onlineShoppingCartmain.Inventories.length>0){o.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",3)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(a=0;a<onlineShoppingCartmain.Inventories.length;a++){var n=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.Inventories[a].ProductName,!0);o.find("ns").append(n)}}var s=e("<XMLDocument/>");if(null!=onlineShoppingCartmain.Events&&onlineShoppingCartmain.Events.length>0){s.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",2)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(a=0;a<onlineShoppingCartmain.Events.length;a++){var l=_vgClassSessionSelection.createXmlElement("n",onlineShoppingCartmain.Events[a].eventName.trim());s.find("ns").append(l)}}o.find("itms").length>0?s.find("itms").length>0&&o.find("itms").append(s.find("itms").html()):s.find("itms").length>0&&(o=s);var d={};d.userData=t.html(),d.businessID=onlineShoppingCart.BusinessID,d.productList=o.html(),d.isGetDepositsConfig=!1,"undefined"==typeof PromotionID||String.isNullOrUndefineOrBlank(PromotionID)?d.promotionID=0:d.promotionID=parseInt(PromotionID),d.isWebsiteBuilder=void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof vgAppicationType&&1==vgAppicationType;var c=new vagaro.ajax;c.datamodel.async=!1,c.datamodel.Token=ApiURLEnumOnlineCheckout.getgcpackageandpointforonlinecheckout,c.datamodel.IsNewVagaroAPI=!0,c.datamodel.callback=function(t){if(onlineShoppingCartmain.UsersPoints=t.lstUserListForCheckout,onlineShoppingCartmain.IsPromotionEnable=t.IsPromotionEnable,onlineShoppingCart.IsPromotionEnable=t.IsPromotionEnable,onlineShoppingCart.IsDailyDealEnable=t.depositsClassConfigForCheckout.IsDailyDealEnable,onlineShoppingCartmain.IsDailyDealEnable=t.depositsClassConfigForCheckout.IsDailyDealEnable,IsFMBEnableForBusiness=t.IsFMBEnableForBusiness,_onlineCheckout.IsAnyDailyDealInCart()?(t.lstUserListForCheckout?.forEach(e=>{e.pointsBalance=0}),_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount=e.grep(e.extend(!0,[],t.lstGcAndPackagesForCheckout)||[],function(e){return e&&1==e.isPackage}),_onlineCheckout.lstUserListForCheckout_ShowDiscount=e.extend(!0,[],t.lstUserListForCheckout),_onlineCheckout.lstMembershipForCheckout_ShowDiscount=e.extend(!0,[],t.lstMembershipForCheckout)):(_onlineCheckout.lstGcAndPackagesForCheckout_ShowDiscount=e.extend(!0,[],t.lstGcAndPackagesForCheckout),_onlineCheckout.lstUserListForCheckout_ShowDiscount=e.extend(!0,[],t.lstUserListForCheckout),_onlineCheckout.lstMembershipForCheckout_ShowDiscount=e.extend(!0,[],t.lstMembershipForCheckout)),_onlineCheckout.IsPromotionEnable_ShowDiscount=t.IsPromotionEnable,_onlineCheckout.VPLUserBankDetails=t.lstVPLUserAccount,_onlineCheckout.ValidateOnePerUserDeal(1),_onlineCheckout.ReApplyDiscounts_ShowDiscount(),_onlineCheckout.IsSelectGCEmployeeForWidget(),e(".vpl-add-bank").html(""),void 0!==_onlineCheckout.VPLUserBankDetails&&null!=_onlineCheckout.VPLUserBankDetails&&(e("#tmplUserBankListtmplUserBankList").tmpl(t.lstVPLUserAccount).appendTo(".vpl-add-bank"),void 0!==_onlineCheckout.VPLUserBankDetails&&null!=_onlineCheckout.VPLUserBankDetails)){var i=_onlineCheckout.VPLUserBankDetails[0].Id;e("#addBankList #rb_"+i).attr("checked","checked")}},c.datamodel.data=d,c.datamodel.Error=function(e){},c.Post(),ShowLoader(!1)},_onlineCheckout.GetCustomerBankAccountDetails_Success=function(t){var i=t.Data;if(null!=i.vplUserAccounts&&i.vplUserAccounts.length>0){vplCustomerBankListCheckout=i.vplUserAccounts;var a=i.vplUserAccounts[i.vplUserAccounts.length-1].ACFourDigit;e("#BankList").html(""),e("#tmplUserBankListtmplUserBankList").tmpl(vplCustomerBankListCheckout).appendTo("#BankList"),e("#rb_"+a).attr("checked","checked")}e("#"+_vgCovidCleanCheckout.model.vplAppliedPopup).hide(),e("#"+_vgCovidCleanCheckout.model.vplAppliedPopup).css("display","none"),e("#"+_vgCovidCleanCheckout.model.divVplCheckoutTip).hide(),e("#"+_vgCovidCleanCheckout.model.divVplCheckoutSlotList).show()},_onlineCheckout.BindVPLBank=function(){ShowLoader(!0);var t={};t.UserID=parseInt(UserID),t.EncryptUserID=glbEncryptUserId;var i=new vagaro.ajax;i.datamodel.async=!1,i.datamodel.Token=_onlineCheckout.GetCoreAPIURLWithToken(ApiURLEnumOnlineCheckout.getuservplaccountdetail,groupID),i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){ShowLoader(!1),_onlineCheckout.VPLUserBankDetails=t.Data,void 0!==ObjBankDetail&&(ObjBankDetail=t.Data.vplUserAccounts);var i=t.Data;e(".vpl-add-bank").html(""),void 0!==i.vplUserAccounts&&null!=i.vplUserAccounts&&(e("#tmplUserBankListtmplUserBankList").tmpl(i.vplUserAccounts).appendTo(".vpl-add-bank"),e("#addBankList #rb_"+i.vplUserAccounts[0].Id).attr("checked","checked"))},i.datamodel.data=t,i.datamodel.Error=function(e){ShowLoader(!1)},i.Post()},_onlineCheckout.IsVagaroFeaturedMarketplace=function(){var e=getCookie(_shopdetail.businessID);return void 0!==e&&null!=e&&_shopdetail.businessID,!1},_onlineCheckout.ApplyMultipleTax=function(t,i){var a=String.isNullOrUndefineOrBlank(i.BusinessTax)||"[]"==i.BusinessTax?"":i.BusinessTax;return String.isNullOrUndefineOrBlank(a)||e.grep(a,function(e){void 0===i||1!=i.isPackage&&1!=i.isPointApply||1==i.IsPartialPoint?e.CalculatedTax=_onlineCheckout.parseTodecimal(t*e.Tax/100,2):e.CalculatedTax=_onlineCheckout.parseTodecimal(0,2)}),a},_onlineCheckout.ApplyMultipleFees=function(e,t,i,a,r){if(t)if(void 0===a||a!=CartItemTypeEnumOnlineCheckout.Product&&a!=CartItemTypeEnumOnlineCheckout.GC?i.Qty+=1:i.Qty+=r,1==i.AmountType)void 0!==a&&a==CartItemTypeEnumOnlineCheckout.Product?i.CalculatedFees+=i.FeeAmount*r:(i.CalculatedFees+=i.FeeAmount,void 0!==a&&a==CartItemTypeEnumOnlineCheckout.Class&&0==_onlineCheckout.IsPrepayBusinessFee()&&(i.Qty-=1,i.CalculatedFeesForClass+=i.FeeAmount));else if(void 0!==a&&a==CartItemTypeEnumOnlineCheckout.GC)i.CalculatedFees+=_onlineCheckout.parseTodecimal(e*r*i.FeeAmount/100,2);else{var o=_onlineCheckout.parseTodecimal(e*i.FeeAmount/100,2);i.CalculatedFees+=o,void 0!==a&&a==CartItemTypeEnumOnlineCheckout.Class&&0==_onlineCheckout.IsPrepayBusinessFee()&&(i.Qty-=1,i.CalculatedFeesForClass+=o)}else if(i.Qty=1,1==i.AmountType)i.CalculatedFees=i.FeeAmount,void 0!==a&&a==CartItemTypeEnumOnlineCheckout.Class&&0==_onlineCheckout.IsPrepayBusinessFee()&&(i.CalculatedFeesForClass=i.FeeAmount);else{var n=_onlineCheckout.parseTodecimal(e*i.FeeAmount/100,2);i.CalculatedFees+=n,void 0!==a&&a==CartItemTypeEnumOnlineCheckout.Class&&0==_onlineCheckout.IsPrepayBusinessFee()&&(i.CalculatedFeesForClass+=n)}i.paidType=1==_onlineCheckout.IsPrepayBusinessFee()?_onlineCheckout.arrpaidType.Paid:_onlineCheckout.arrpaidType.Deposits},_onlineCheckout.IsPrepayBusinessFee=function(){var t=!0;return void 0!==onlineShoppingCart.Events&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(e){e.paidType!=_onlineCheckout.arrpaidType.PaidClass&&(t=!1)})}),t},_onlineCheckout.UpdateBusinessTaxForBusinessFee=function(){e.grep(onlineShoppingCart.BusinessFee,function(t){null!=t.BusinessTax&&t.BusinessTax.length>0&&e.grep(t.BusinessTax,function(e){void 0!==e.PreviousCalculatedTax&&null!=e.PreviousCalculatedTax||(e.PreviousCalculatedTax=_onlineCheckout.parseTodecimal(e.CalculatedTax,2),e.PreviousCalculatedTaxForClass=_onlineCheckout.parseTodecimal(String.isNullOrUndefineOrBlank(e.CalculatedTaxForClass)?0:e.CalculatedTaxForClass,2)),e.CalculatedTax=_onlineCheckout.parseTodecimal(e.PreviousCalculatedTax,2)-_onlineCheckout.parseTodecimal(e.PreviousCalculatedTaxForClass,2)})})},_onlineCheckout.ApplyMultipleFeesonAllItems=function(t){var i;if(null!=onlineShoppingCart.BusinessFee&&0!=onlineShoppingCart.BusinessFee.length&&(null!=(i=1==t?e.grep(onlineShoppingCart.BusinessFee,function(e){return 1==e.FeeType}):0==t?e.grep(onlineShoppingCart.BusinessFee,function(e){return 0==e.FeeType}):onlineShoppingCart.BusinessFee)&&i.length>0)){var a=0,r=0;e.grep(i,function(i){if(1==_onlineCheckout.isValidForCheckoutInvoice()){var o=String.isNullOrUndefineOrBlank(i.ApplyType)?"":i.ApplyType.split(",");_onlineCheckout.IsVCFFeeExists()&&o.indexOf("99")>-1&&2==t&&_onlineCheckout.ApplyMultipleFees(0,!1,i),r+=i.CalculatedFees,i.BusinessTax=String.isNullOrUndefineOrBlank(i.Taxes)||"[]"==i.Taxes?"":JSON.parse(i.Taxes),i.BusinessTax="[]"==i.BusinessTax?"":i.BusinessTax;var n=0;!String.isNullOrUndefineOrBlank(i.BusinessTax)&&"[]"!=i.Taxes&&i.BusinessTax.length>0&&e.grep(i.BusinessTax,function(e){e.CalculatedTax=_onlineCheckout.parseTodecimal(e.Tax*i.CalculatedFees/100,2),a+=e.CalculatedTax,n+=e.CalculatedTax}),i.CalculatedTax=n,i.CalculatedFeesForClass=0,i.CalculatedTaxForClass=0}else{i.CalculatedFees=0,i.CalculatedTax=0,i.Qty=0,i.CalculatedFeesForClass=0,i.CalculatedTaxForClass=0,i.ActualPrice=0,i.ActualTax=0;o=i.ApplyType.split(",");if(1==i.AutoApplyFees){if(0==i.TransactionType)o.indexOf(CartItemTypeEnumOnlineCheckout.Membership)>-1&&null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.each(onlineShoppingCart.Memberships,function(e,t){_onlineCheckout.ApplyMultipleFees(t.ActualPrice,!0,i)}),o.indexOf(CartItemTypeEnumOnlineCheckout.Package)>-1&&null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.each(onlineShoppingCart.Packages,function(e,t){_onlineCheckout.ApplyMultipleFees(t.ActualPrice,!0,i)}),o.indexOf(CartItemTypeEnumOnlineCheckout.Product)>-1&&null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&e.each(onlineShoppingCart.Inventories,function(e,t){1==t.isPointApply?t.pointsRedeem==t.OriginalPointsRedeem?_onlineCheckout.ApplyMultipleFees(0,!0,i,CartItemTypeEnumOnlineCheckout.Product,t.Quantity):_onlineCheckout.ApplyMultipleFees(t.ActualPrice,!0,i,CartItemTypeEnumOnlineCheckout.Product,t.Quantity):_onlineCheckout.ApplyMultipleFees(t.Price,!0,i,CartItemTypeEnumOnlineCheckout.Product,t.Quantity)}),o.indexOf(CartItemTypeEnumOnlineCheckout.Class)>-1&&1==_onlineCheckout.IsCalculateAndDisplayFeeOnline()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&e.each(onlineShoppingCart.Events,function(t,a){e.each(a.eventEnrollment,function(e,t){_onlineCheckout.ApplyMultipleFees(t.price,!0,i,CartItemTypeEnumOnlineCheckout.Class)})}),o.indexOf(CartItemTypeEnumOnlineCheckout.Service)>-1&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.each(onlineShoppingCart.ServiceInvoice,function(e,t){var a=void 0!==t.isPackageApplied&&t.isPackageApplied?t.price:onlineShoppingCart.ServiceInvoice[0].ServiceOrginalPrice;_onlineCheckout.ApplyMultipleFees(a,!0,i)}),o.indexOf(CartItemTypeEnumOnlineCheckout.GC)>-1&&null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&e.each(onlineShoppingCart.GiftCertificates,function(e,t){_onlineCheckout.ApplyMultipleFees(t.Price,!0,i,CartItemTypeEnumOnlineCheckout.GC,t.NoOfVisit)});else{if(null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&o.indexOf(CartItemTypeEnumOnlineCheckout.ServiceInvoice)>-1){var s=0;e.each(onlineShoppingCart.ServiceInvoice,function(e,t){s+=void 0!==t.isPackageApplied&&t.isPackageApplied?t.price:t.ServiceOrginalPrice}),_onlineCheckout.ApplyMultipleFees(s,!1,i)}if(null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&o.indexOf(CartItemTypeEnumOnlineCheckout.Class)>-1&&1==_onlineCheckout.IsCalculateAndDisplayFeeOnline()){var l=0;e.each(onlineShoppingCart.Events,function(t,i){e.each(i.eventEnrollment,function(e,t){l+=t.price})}),_onlineCheckout.ApplyMultipleFees(l,!1,i,CartItemTypeEnumOnlineCheckout.Class)}if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&o.indexOf(CartItemTypeEnumOnlineCheckout.Product)>-1){var d=0;e.each(onlineShoppingCart.Inventories,function(e,t){t.pointsRedeem==t.OriginalPointsRedeem?d+=t.Price:d+=t.ActualPrice}),_onlineCheckout.ApplyMultipleFees(d,!1,i)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&o.indexOf(CartItemTypeEnumOnlineCheckout.Membership)>-1){var c=0;e.each(onlineShoppingCart.Memberships,function(e,t){c+=t.ActualPrice}),_onlineCheckout.ApplyMultipleFees(c,!1,i)}if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&o.indexOf(CartItemTypeEnumOnlineCheckout.Package)>-1){var u=0;e.each(onlineShoppingCart.Packages,function(e,t){u+=t.ActualPrice}),_onlineCheckout.ApplyMultipleFees(u,!1,i)}if(null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&o.indexOf(CartItemTypeEnumOnlineCheckout.GC)>-1){var p=0;e.each(onlineShoppingCart.GiftCertificates,function(e,t){p+=t.Price*t.NoOfVisit}),_onlineCheckout.ApplyMultipleFees(p,!1,i)}_onlineCheckout.IsVCFFeeExists()&&o.indexOf("99")>-1&&2==t&&_onlineCheckout.ApplyMultipleFees(0,!1,i)}r+=i.CalculatedFees,i.ActualPrice+=i.CalculatedFees;n=0;var h=0;null!=i.BusinessTax&&i.BusinessTax.length>0&&e.grep(i.BusinessTax,function(e){e.CalculatedTax=_onlineCheckout.parseTodecimal(e.Tax*i.CalculatedFees/100,2),e.CalculatedTaxForClass=_onlineCheckout.parseTodecimal(e.Tax*i.CalculatedFeesForClass/100,2),a+=e.CalculatedTax,n+=e.CalculatedTax,h+=e.CalculatedTaxForClass}),i.CalculatedTax=n,i.CalculatedTaxForClass=h,i.ActualTax=i.CalculatedTax}}});var o=0,n=0,s=0,l=0;e.grep(onlineShoppingCart.BusinessFee,function(e){e.DisplayCalculatedFees=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(e.CalculatedFees,2)-_onlineCheckout.parseTodecimal(e.CalculatedFeesForClass,2),2),e.DisplayCalculatedTax=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(e.CalculatedTax,2)-_onlineCheckout.parseTodecimal(e.CalculatedTaxForClass,2),2),o=_onlineCheckout.parseTodecimal(o+_onlineCheckout.parseTodecimal(e.CalculatedFeesForClass,2)+_onlineCheckout.parseTodecimal(e.CalculatedTaxForClass,2),2),s+=e.DisplayCalculatedFees,l+=e.DisplayCalculatedTax,n=_onlineCheckout.parseTodecimal(n+_onlineCheckout.parseTodecimal(e.CalculatedTaxForClass,2),2)}),onlineShoppingCart.totalFeeAmount=r,onlineShoppingCart.totalFeeTax=a,onlineShoppingCart.totalFeeAmountPrepay=s,onlineShoppingCart.totalFeeTaxPrepay=l,onlineShoppingCart.FeeDepositsRemaining=o,onlineShoppingCart.FeeTaxDepositsRemaining=n}},_onlineCheckout.DisplayBusinessTaxes=function(){e("#divfinalcheckoutMultipletaxes").hide(),e("#divfinalcheckoutMultipletaxes").html("");var t=[];null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})}),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(_onlineCheckout.IsBuyGC?e.grep(onlineShoppingCart.GiftCertificates,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})}):e.grep(onlineShoppingCart.GiftCertificates,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,a){"True"!=_onlineCheckout.isFromInvoice&&i.NoOfVisit>1&&(a.CalculatedTax=a.CalculatedTax*i.NoOfVisit),t.push(a)})})),null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)}),null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})})}),null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&(1==_onlineCheckout.IsCalculateAndDisplayFeeOnline()&&0==_onlineCheckout.IsCalculateAndDisplayFeeOnline(!0)||1==onlineShoppingCart.IsIncludeTaxInOnlinePricing)&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)}),null!=i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})})})}),null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&e.grep(onlineShoppingCart.BusinessFee,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(i){var a=i.BusinessTax;null!=a&&""!=a&&"[]"!=a&&e.each(a,function(e,i){t.push(i)})});var i=[];if(t.reduce(function(e,t){return e[t.TaxName]||(e[t.TaxName]={TaxName:t.TaxName,Tax:0,CalculatedTax:0,BusinessTaxID:t.BusinessTaxID},i.push(e[t.TaxName])),e[t.TaxName].Tax+=t.Tax,e[t.TaxName].CalculatedTax+=parseFloat(t.CalculatedTax),e},{}),null!=i&&i.length>0){for(var a="",r=0;r<i.length;r++){var o=i[r].CalculatedTax;o>0&&(a+='<div class="div-block-26" role="contentinfo" aria-labelledby="divTaxTitle divfinalcheckoutMultipletaxes"><div id="divMultipleTaxTitle_'+i[r].BusinessTaxID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+i[r].TaxName+'</div><div id="divMultipleTaxValue_'+i[r].BusinessTaxID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+currencysymbol+o.format("#.##")+"</div></div>")}e("#divfinalcheckoutMultipletaxes").html(a),e("#divfinalcheckoutMultipletaxes").show()}},_onlineCheckout.DisplayBusinessFees=function(){if(e("#divfinalcheckoutMultipleFees").hide(),e("#divfinalcheckoutMultipleFees").html(""),null!=onlineShoppingCart.BusinessFee){e("#divfinalcheckoutMultipleFees").html("");for(var t="",i=0;i<onlineShoppingCart.BusinessFee.length;i++){if(0==onlineShoppingCart.BusinessFee[i].FeeType)(r=onlineShoppingCart.BusinessFee[i].CalculatedFees)>0&&(t+='<div class="div-block-26" role="contentinfo" aria-labelledby="divFeesTitle divfinalcheckoutMultipleFees"><div id="divMultipleFeesTitle_'+onlineShoppingCart.BusinessFee[i].BusinessFeeID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+onlineShoppingCart.BusinessFee[i].FeeName+'</div><div id="divMultipleFeesValue_'+onlineShoppingCart.BusinessFee[i].BusinessFeeID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+currencysymbol+r.format("#.##")+"</div></div>")}var a=e.grep(onlineShoppingCart.BusinessFee,function(e){return 1==e.FeeType});if(void 0!==a&&null!=a&&a.length>0){itemFees=a[0];var r=itemFees.CalculatedFees*a.length;if(!String.isNullOrUndefineOrBlank(r)&&0!=r)if(a.length>1){var o=itemFees.FeeName+" ("+currencysymbol+itemFees.CalculatedFees+")";t+='<div class="div-block-26" role="contentinfo" aria-labelledby="divFeesTitle divfinalcheckoutMultipleFees"><div id="divMultipleFeesTitle_'+itemFees.BusinessFeeID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+o+'</div><div id="divMultipleFeesValue_'+itemFees.BusinessFeeID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+currencysymbol+r.format("#.##")+"</div></div>"}else t+='<div class="div-block-26" role="contentinfo" aria-labelledby="divFeesTitle divfinalcheckoutMultipleFees"><div id="divMultipleFeesTitle_'+itemFees.BusinessFeeID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+itemFees.FeeName+'</div><div id="divMultipleFeesValue_'+itemFees.BusinessFeeID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+currencysymbol+r.format("#.##")+"</div></div>"}e("#divfinalcheckoutMultipleFees").html(t),e("#divfinalcheckoutMultipleFees").show()}},_onlineCheckout.CalculateAddonTotal=function(t){var i=0;return e.each(t,function(e,t){if(null!=t.lstAddonService&&null!=t.lstAddonService&&t.lstAddonService.length>0)for(e=0;e<t.lstAddonService.length;e++)1==onlineShoppingCart.IsIncludeTaxInOnlinePricing?i+=parseFloat(t.lstAddonService[e].roundedPriceWithTax):i+=parseFloat(t.lstAddonService[e].displayroundedPrice-t.lstAddonService[e].discount-t.lstAddonService[e].classAddonGCUsed)}),i},_onlineCheckout.CreateAddonXMl=function(t,i,a,r){var o=onlineShoppingCartmain.UsersPoints;e.each(t,function(t,n){var s=null;s=_vgClassSessionSelection.createXmlElement("appointment");var l;if(l=i.isHandleDuetoException,s.append(_vgClassSessionSelection.createXmlElement("isHandleDuetoException",1==l?"1":"0")),s.append(_vgClassSessionSelection.createXmlElement("appId",i.appointmentID)),s.append(_vgClassSessionSelection.createXmlElement("spid",i.sPID)),s.append(_vgClassSessionSelection.createXmlElement("spname","")),s.append(_vgClassSessionSelection.createXmlElement("isworkshop",i.IsWorkShop)),s.append(_vgClassSessionSelection.createXmlElement("appstarttime",new Date(i.eventDate).format("yyyy-MM-dd")+" "+i.startTime)),a.append(s),s.append(_vgClassSessionSelection.createXmlElement("fname",i.cFirstName)),s.append(_vgClassSessionSelection.createXmlElement("lname",i.cLastName)),s.append(_vgClassSessionSelection.createXmlElement("email",i.cUserEmail)),s.append(_vgClassSessionSelection.createXmlElement("cellno",i.cUserCellNo)),s.append(_vgClassSessionSelection.createXmlElement("paidtype",n.paidType)),s.append(_vgClassSessionSelection.createXmlElement("streamingstatus",i.StreamingStatus)),(n.paidType==_onlineCheckout.arrpaidType.DepositsClass||n.paidType==_onlineCheckout.arrpaidType.PartiallyPaidClass)&&void 0!==n.depositsPaid){if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&n.depositsPercentage<100){var d=parseFloat(_onlineCheckout.ConvertDecimalWithFixed(100*parseFloat(n.depositsPaid)/n.Price,!0,2));n.depositsPercentage=d}s.append(_vgClassSessionSelection.createXmlElement("depositspercentage",n.depositsPercentage)),s.append(_vgClassSessionSelection.createXmlElement("depositspaid",n.depositsPaid)),s.append(_vgClassSessionSelection.createXmlElement("payableamount",n.Price)),s.append(_vgClassSessionSelection.createXmlElement("depositsremaining",_onlineCheckout.parseTodecimal(n.Price-n.depositsPaid,2)))}if(onlineShoppingCart.tipPercent>0&&n.paidType==_onlineCheckout.arrpaidType.PaidClass){_onlineCheckout.TipApplyCounter=++_onlineCheckout.TipApplyCounter;var c=_onlineCheckout.parseTodecimal(n.Price,2);(1==n.isPackage||1==n.isPointApply||n.isMembershipApply||void 0!==n.isPresetApply&&n.isPresetApply||void 0!==n.PromotionID&&null!=n.PromotionID&&n.PromotionID>0)&&(c=_onlineCheckout.parseTodecimal(n.Originalprice,2));var u=0;u=_onlineCheckout.TipApplyCounter==_onlineCheckout.TotalPaidCount?_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2):_onlineCheckout.parseTodecimal(c*onlineShoppingCart.tipPercent/100,2),s.append(_vgClassSessionSelection.createXmlElement("tipAmount",u)),_onlineCheckout.TipAppliedSum+=u}var p=0;void 0!==n.PromotionID&&n.PromotionID>0&&1!=n.isPointApply&&(null==n.gcId||0==n.gcId||n.gcId>0&&0==n.isPackage)&&(p=n.PromotionID,s.append(_vgClassSessionSelection.createXmlElement("presetdiscountamount",n.discount))),s.append(_vgClassSessionSelection.createXmlElement("promotionid",p)),void 0!==n.isPresetApply&&1==n.isPresetApply&&(s.append(_vgClassSessionSelection.createXmlElement("discountid",n.DiscountID)),s.append(_vgClassSessionSelection.createXmlElement("ispresetapply",n.isPresetApply))),void 0!==n.IsAmount&&s.append(_vgClassSessionSelection.createXmlElement("isamount",n.IsAmount)),void 0!==n.AmountValue&&s.append(_vgClassSessionSelection.createXmlElement("amountvalue",n.AmountValue));var h="";0==i.customerID?(h=g=e.grep(o,function(e){return 0==i.customerID&&e.emailId==i.cUserEmail}),null!=g&&g.length>0?s.append(_vgClassSessionSelection.createXmlElement("userid",g[0].userId)):s.append(_vgClassSessionSelection.createXmlElement("userid",i.customerID))):(h=e.grep(o,function(e){return e.userId==i.customerID}),s.append(_vgClassSessionSelection.createXmlElement("userid",i.customerID)));if(null!=h&&h.length>0&&s.append(_vgClassSessionSelection.createXmlElement("isnewcustomer",h[0].isNewCustomer)),1==r&&(1==n.isPackage||0==n.isPackage)&&(n.gcId>0||n.gcId<0&&1==n.isPackage)||1==n.isPriceBaseGCApply){var m=[],f=[];1==n.isPriceBaseGCApply?(n.isPackage=!1,s.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!0))):s.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!1)),s.append(_vgClassSessionSelection.createXmlElement("ispackage",n.isPackage)),1==n.isPriceBaseGCApply&&e.each(n.GCDetail,function(e,t){m.push(t.GCId),f.push(t.GCAmount)}),s.append(_vgClassSessionSelection.createXmlElement("packageid",n.gcId<0?_onlineCheckout.GetPackageId(n.gcId):0)),s.append(_vgClassSessionSelection.createXmlElement("gcid",void 0===n.gcId||null==n.gcId?0:n.gcId)),s.append(_vgClassSessionSelection.createXmlElement("gcids",0==m.length?0:m.join(","))),s.append(_vgClassSessionSelection.createXmlElement("gcamount",0==f.length?0:f.join(","))),n.RedeemServiceId>0&&s.append(_vgClassSessionSelection.createXmlElement("redeemserviceid",n.RedeemServiceId))}if(1==r&&1==n.isPointApply&&(s.append(_vgClassSessionSelection.createXmlElement("ispointapply",n.isPointApply)),s.append(_vgClassSessionSelection.createXmlElement("pointsredeem",n.pointsRedeem))),1==r&&(s.append(_vgClassSessionSelection.createXmlElement("taxes",n.TaxValue)),s.append(_vgClassSessionSelection.createXmlElement("calculatedTaxTypeWise",String.isNullOrUndefineOrBlank(n.BusinessTax)?"[]":JSON.stringify(n.BusinessTax).toString())),null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(t){t.giftCertificateID==n.gcId&&null!=t.Taxes&&(s.append(_vgClassSessionSelection.createXmlElement("taxes","0")),e.grep(n.BusinessTax,function(e){onlineShoppingCart.classFinalTotal=parseFloat(ConvertTodecimalMorePrecious(parseFloat(onlineShoppingCart.classFinalTotal)-e.CalculatedTax,!0,2)),onlineShoppingCart.classTax>0&&(onlineShoppingCart.classTax=parseFloat(ConvertTodecimalMorePrecious(parseFloat(onlineShoppingCart.classTax)-e.CalculatedTax,!0,2))),e.CalculatedTax=0,_onlineCheckout.IsTaxCalculated=!0}))}),s.append(_vgClassSessionSelection.createXmlElement("addontaxation",n.tax))),1==r&&1==n.isMembershipApply&&null!=n.membershipUniqueID&&null!=n.membershipUniqueID&&""!=i.membershipUniqueID){s.append(_vgClassSessionSelection.createXmlElement("ismembershipapply",n.isMembershipApply)),s.append(_vgClassSessionSelection.createXmlElement("membershipdiscountpercentage",n.membershipDiscount)),s.append(_vgClassSessionSelection.createXmlElement("membershipuserid",n.membershipuserid)),s.append(_vgClassSessionSelection.createXmlElement("membershipuniqueid",n.membershipUniqueID));var g,v=null;if((v=_vgClassSessionSelection.createXmlElement("membershipredeemeddetails")).append(_vgClassSessionSelection.createXmlElement("businessid",n.BusinessID)),v.append(_vgClassSessionSelection.createXmlElement("redeembusinessid",n.RedeemBusinessId)),0==i.customerID)null!=(g=e.grep(o,function(e){return 0==i.customerID&&e.emailId==i.cUserEmail}))&&g.length>0?v.append(_vgClassSessionSelection.createXmlElement("userid",g[0].userId)):v.append(_vgClassSessionSelection.createXmlElement("userid",i.customerID));else v.append(_vgClassSessionSelection.createXmlElement("userid",i.customerID));v.append(_vgClassSessionSelection.createXmlElement("membershipuserid",n.membershipuserid)),v.append(_vgClassSessionSelection.createXmlElement("redeemuserid",n.membershipuserid)),v.append(_vgClassSessionSelection.createXmlElement("itemtype",20)),v.append(_vgClassSessionSelection.createXmlElement("type",20)),v.append(_vgClassSessionSelection.createXmlElement("membershipid",n.MembershipID)),v.append(_vgClassSessionSelection.createXmlElement("membershipitemid",n.MembershipItemId)),v.append(_vgClassSessionSelection.createXmlElement("groupid",n.GroupId)),v.append(_vgClassSessionSelection.createXmlElement("isunlimitedvisit",-1==n.VisitRemaining)),v.append(_vgClassSessionSelection.createXmlElement("serviceproductname",n.ServiceTitle.trim())),s.append(v)}if(0==isCheckInApp){var A=!1;e(".cartremoverdtl").each(function(t,i){void 0!==e(i).attr("data-isWorkShop")&&"true"==e(i).attr("data-isWorkShop").toLowerCase()&&(A=!0)});var C=_shopdetail.GetRescheduleDetail();null!=C&&(A||(isReschedule=!0),s.append(_vgClassSessionSelection.createXmlElement("eventsessionattendeeid",C.EventSessionAttendeesId)))}s.append(_vgClassSessionSelection.createXmlElement("isAddon",!0)),s.append(_vgClassSessionSelection.createXmlElement("isupsell",(!String.isNullOrUndefineOrBlank(n.isMembershipApply)&&0!=n.isMembershipApply||!String.isNullOrUndefineOrBlank(n.isPackage)&&0!=n.isPackage)&&_onlineCheckout.IsCheckMemPkgUpsellExists(n.isMembershipApply,n.MembershipID))),s.append(_vgClassSessionSelection.createXmlElement("uniqueAddonID","addon"+i.appointmentID+i.autoID)),s.append(_vgClassSessionSelection.createXmlElement("serviceid",n.ServiceId)),s.append(_vgClassSessionSelection.createXmlElement("addonname",n.ServiceTitle)),s.append(_vgClassSessionSelection.createXmlElement("price",n.Originalprice)),s.append(_vgClassSessionSelection.createXmlElement("ispartialpointapply",void 0!==n.IsPartialPoint&&n.IsPartialPoint)),s.append(_vgClassSessionSelection.createXmlElement("partialserviceprice",n.Price))})},_onlineCheckout.OpenAddonModal=function(t,i){ShowLoader(!0);var a=e.grep(onlineShoppingCart.Events,function(e){return e.eventID==t});e("#eventDescription").html("").removeClass("height80").removeAttr("style"),e("#divEventName").text(a[0].eventName),e("#eventDescription").text(a[0].eventDesc),e("#eventDescription").show(),null!=a[0].eventDesc&&""!=a[0].eventDesc||e("#eventDescription").hide(),null==a[0].smallimage||""==a[0].smallimage||a[0].smallimage.indexOf("no-shop-image-big.")>0?e("#divaddonPopupHeader").addClass("no-image-data"):(e("#divaddonPopupHeader").removeClass("no-image-data"),e("#eventimage").css("background-image","url("+a[0].smallimage+")"),e("#eventimage").show());var r=e.grep(a[0].eventEnrollment,function(e){return e.autoID==i}),o={UserID:onlineShoppingCart.loginUserId,ServiceId:parseInt(t),BusinessID:parseInt(_vgClassSessionSelection.GetCommonBusinessID()),ServiceProviderID:parseInt(r[0].sPID)},n=new vagaro.ajax;n.datamodel.Token="GetListofFamilyFriendtoBook",n.datamodel.data=[o],n.datamodel.callback=function(r){_vgClassSessionSelection.commonProperty.isAddonPopup=!0,_vgClassSessionSelection.SetFamilyFriendListData(r,1,!0);var o=a[0].actualPrice>0?_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(a[0].actualPrice,2).format("#.##"):"FREE";e("#divHdrEventPrice").text(o);var n=e.grep(a[0].eventEnrollment,function(e){return e.autoID==i});if(null!=n&&n.length>0){var s=n[0].customerID;_onlineCheckout.UpdateAttendeeSelectionOnAddonPopup(e("#lstoffamilyandfriends").find('[data-value="'+s+'"]')[0])}_onlineCheckout.BindSelectedAddon(a,i),e("#btnContinue").attr("data-enrollAutoId",i),e("#btnContinue").attr("data-eventID",t),e("#divHdrEventPrice").show(),e("#divUserDetail").show(),e("#mob-addnew").hide(),e("#divclassaddonpopup").modal("show"),_onlineCheckout.LoadEventForAddonClass(),e("#eventDescription")[0].scrollHeight<=80?(e("#divMoreContent").hide(),e("#eventDescription").removeClass("height80")):(e("#eventDescription").addClass("height80"),e("#btnMoreContent").html("More"),e("#btnMoreContent").removeClass("active"),e("#divMoreContent").show()),ShowLoader(!1)},n.datamodel.Error=_vgClassSessionSelection.CallFailed,n.Post()},_onlineCheckout.BindSelectedAddon=function(t,i){var a=e.grep(t[0].eventEnrollment,function(e){return e.autoID==i});null!=a[0].lstAddonService&&null!=a[0].lstAddonService&&a[0].lstAddonService.length>0&&e.each(a[0].lstAddonService,function(t){e("#check_"+a[0].lstAddonService[t].ServiceId).prop("checked",!0),e("#rdo_"+a[0].lstAddonService[t].ServiceId).prop("checked",!0)}),_vgClassSessionSelection.CalculateTotalPrice()},_onlineCheckout.UpdateAddonService=function(){var t=0;e("div.clsaccordion").find(".panel-default").each(function(){void 0===e(this).attr("data-value")&&(t+=1)});var i=_vgClassSessionSelection.AddonValidate();if(0==t&&i){var a=0,r=parseInt(e("#btnContinue").attr("data-enrollAutoId")),o=parseInt(e("#btnContinue").attr("data-eventID")),n=JSON.parse(JSON.stringify(onlineShoppingCartmain.Events)),s=e.grep(n,function(e){return e.eventID==o}),l=e.grep(s[0].eventEnrollment,function(e){return e.autoID==r});if(l.length>0){var d=e("div.clsaccordion").find(".panel-default").attr("data-value"),c=e("div.clsaccordion").find(".panel-default").attr("data-email");if(d!=l[0].customerID&&s.length>0&&_onlineCheckout.CheckUserExistanceWhenAddonUpdate(d,c,s[0],l[0])&&(_vgClassSessionSelection.commonMessageAlert("This user is already exists in cart."),a+=1),0==a){var u="",p="",h="",m=0,f="";_vgClassSessionSelection.model.IsOnline&&e("div.clsaccordion").find(".panel-default").each(function(){m=e(this).attr("data-value"),u=e(this).attr("data-fullname").split(" ")[0],p=void 0!==e(this).attr("data-fullname").split(" ")[1]?e(this).attr("data-fullname").split(" ")[1]:"",h=e(this).attr("data-email"),f=e(this).attr("data-cell")}),l[0].customerID=m,l[0].cFirstName=u,l[0].cLastName=p,l[0].cUserEmail=h,l[0].cUserCellNo=f,_vgClassSessionSelection.commonProperty.isAddonPopup=!1,l[0].lstAddonService=_vgClassSessionSelection.CreateAddonCollection(l[0]),"true"==IsClassReschedule.toLowerCase()?(onlineShoppingCartmain.Events=n,_onlineCheckout.loadPage()):_onlineCheckout.classAddToCart(n,!0),e("#divclassaddonpopup").modal("hide")}}}else 0!=t&&_vgClassSessionSelection.commonMessageAlert("Select All Attendees.")},_onlineCheckout.GetTotalPriceAddonEvent=function(e){var t={TotalAddonPrice:0,TotalAddonTax:0,TotalAddonDeposit:0};if(null!=e.lstAddonService&&null!=e.lstAddonService&&e.lstAddonService.length>0)for(var i=0;i<e.lstAddonService.length;i++)1==e.lstAddonService[i].IsPartialPoint&&"undefined"!=typeof onlineShoppingCartmain&&void 0!==onlineShoppingCartmain.DepositsPer&&onlineShoppingCartmain.DepositsPer<100?t.TotalAddonPrice=_vgClassSessionSelection.ConvertTodecimal(t.TotalAddonPrice+parseFloat(e.lstAddonService[i].Originalprice),2,!0):t.TotalAddonPrice=_vgClassSessionSelection.ConvertTodecimal(t.TotalAddonPrice+parseFloat(e.lstAddonService[i].Price),2,!0),t.TotalAddonTax=_vgClassSessionSelection.ConvertTodecimal(t.TotalAddonTax+parseFloat(e.lstAddonService[i].taxprice),2,!0),parseFloat(e.lstAddonService[i].deposit)>0&&(t.TotalAddonDeposit=_vgClassSessionSelection.ConvertTodecimal(t.TotalAddonDeposit+parseFloat(e.lstAddonService[i].deposit),2,!0));return t},_onlineCheckout.OpenServiceAddonModal=function(t,i){ShowLoader(!0);var a=e.grep(onlineShoppingCart.Packages,function(e){return e.ServiceId==t}),r={ServiceId:parseInt(t),BusinessID:parseInt(_vgClassSessionSelection.GetCommonBusinessID()),ServiceProviderID:0,IsOnline:0,LastMinDealHours:LastMinuteBookingDays},o=new vagaro.ajax;o.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAddOnService,groupID),o.datamodel.data=r,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.callback=function(r){if(r.Data.length>0&&null!=r.Data[0]){_shopdetail.ShowAddOnService(),e(_shopdetail.Controls.AddOnList).empty(),e(_shopdetail.Controls.ParentService).empty(),null==a[0].DefaultImage||""==a[0].DefaultImage||a[0].DefaultImage.indexOf(".jpg")<0?(e("#divServiceImage").css("display","none"),e(".addon-service-description").addClass("no-image-data")):(e("#divServiceImage").css("display","block"),e("#divServiceImage").css("background-image","url("+a[0].DefaultImage+")"),e(".addon-service-description").removeClass("no-image-data")),e("#divServiceName").text(a[0].ServiceTitle),e("#divServiceDes").text(a[0].ServiceDesc);"$0.00"==a[0].Price||"0.00"==a[0].Price||"0"==a[0].Price?(e("#divFreeServicePrice").css("display","block"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(a[0].Price,2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(a[0].Price,2).format("#.##"))),e("#hdnServiceId").val(a[0].ServiceId),e("#hdnEventType").val(a[0].eventType),e("#hdnSrNo").val(1),e("#divSuggestedAddon").text("Suggested Add-Ons Available"),e("#hdnServicebundleName").val("");var o=e.grep(r.Data,function(e){return 0==e.ServiceLevel});e.each(o,function(t){var i=e.grep(r.Data,function(e){return e.Price=_onlineCheckout.parseTodecimal(e.Price,2).format("#.##"),e.ParentServiceID==o[t].ServiceId});o[t].MinItem=o[t].MinItem>i.length?i.length:o[t].MinItem,o[t].MaxItem=o[t].MaxItem>i.length?i.length:o[t].MaxItem,i=i.map(function(e){return e.IsRequired=o[t].IsRequired,e.MinItem=o[t].MinItem,e.MaxItem=o[t].MaxItem,e.Photo=e.Photo.indexOf("no-shop-image-big.")>0?"":e.Photo,e.CurrencySymbol=_shopdetail.currencySymbol,e.IsShowPriceOnline=1,e.OnlinePrice=1==e.IsShowPriceOnline?e.Price:"0.00",e.OnlinePricewithtax=1==e.IsShowPriceOnline?e.Price:"0.00",e}),e(_shopdetail.Controls.tmplAddOnCategory).tmpl(o[t]).appendTo(_shopdetail.Controls.AddOnList),e(_shopdetail.Controls.tmplAddOnService).tmpl(i).appendTo("#Service_"+i[0].ParentServiceID),e(".modal:visible").each(function(e,t){centerModal(t)})}),2==r.Data.length?e(".addon-group-row1").css("border-bottom","none"):e(".addon-group-row1").css("border-bottom","solid #E7E7E7 1px"),e("#btnClose").css("display","none"),e("#btnback").css("display","none"),e(".classfooter-btn-row").addClass("backremove"),e("#btnNext").css("display","none"),e("#btnContinue").css("display","block"),_onlineCheckout.BindSelectedServiceAddon(a,i),_shopdetail.CheckboxAddOnService(),e("#btnContinue").attr("data-enrollAutoId",i),e("#btnContinue").attr("data-eventID",t),e("#servicenamepopup #btnContinue").attr("onclick","_onlineCheckout.UpdateAddonsService()"),ShowLoader(!1)}},o.datamodel.Error=_common.CallFailed,o.Post()},_onlineCheckout.BindSelectedServiceAddon=function(t,i){null!=t[0].lstAddonService&&null!=t[0].lstAddonService&&t[0].lstAddonService.length>0&&(e.each(t[0].lstAddonService,function(i){e("#check_"+t[0].lstAddonService[i].ServiceId).prop("checked",!0),e("#rdo_"+t[0].lstAddonService[i].ServiceId).prop("checked",!0)}),_vgClassSessionSelection.CalculateTotalPrice())},_onlineCheckout.UpdateAddonsService=function(){var t=_vgClassSessionSelection.AddonValidate();if(_onlineCheckout.isUpdateAddonsItemQty=!0,t){var i=parseInt(e("#btnContinue").attr("data-enrollAutoId")),a=parseInt(e("#btnContinue").attr("data-eventID")),r=JSON.parse(JSON.stringify(onlineShoppingCartmain.Packages)),o=e.grep(r,function(e){return e.ServiceId==a});if(o.length>0){o[0].lstAddonService=null,o[0].lstAddonService=_shopdetail.CreateAddonCollection();for(var n=0;n<onlineShoppingCartmain.Packages.length;n++)onlineShoppingCartmain.Packages[n].ServiceId==a&&onlineShoppingCartmain.Packages[n].autoId==i&&(onlineShoppingCartmain.Packages[n].lstAddonService=null,onlineShoppingCartmain.Packages[n].lstAddonService=o[0].lstAddonService,onlineShoppingCartmain.Packages[n].TotalAddonServicePrice=_onlineCheckout.CalculateServcieAddonTotal(onlineShoppingCartmain.Packages[n].lstAddonService));_onlineCheckout.UpdateMutipleCartItem(this,!1,!0)}_shopdetail.HideAddOnService()}},_onlineCheckout.CalculateServcieAddonTotal=function(t){var i=0;return null!=t&&t.length>0&&e.each(t,function(e,t){i+=parseFloat(t.Price)}),i},_onlineCheckout.CreateOnlineServiceAddonsCollection=function(t,i){var a=[],r=_onlineCheckout.GetServcieDuration(t,i);if(null!=t&&null!=t&&t.length>0){_onlineCheckout.SetAppointmentIdOfSelectedAddonService(t,i);for(var o="",n=0;n<t.length;n++){(c={}).AppTime=0==n?moment(i.ServiceStartTime,"hh:mm A").add(r,"minutes").format("hh:mm A"):moment(o,"hh:mm A").add(t[n-1].Duration,"minutes").format("hh:mm A"),o=c.AppTime,c.AppointmentID=t[n].AppointmentID;var s=new Date(i.StartTime),l=e.datepicker.formatDate("yy-mm-dd",s);c.Appointmentdate=l,c.DepositAmount=0,c.DepositsPercentage=t[n].depositsPercentage,c.Duration=t[n].Duration,c.OldServiceName="",c.OriginalDuration=0,c.OriginalPointRedeem=t[n].pointredeemOriginal,c.OriginalPrice=t[n].OriginalPrice,c.PaidType=t[n].paidType,c.ParentAppointmentID=t[n].ParentAppointmentID,void 0===t[n].IsPaid||0==t[n].IsPaid?(c.PointGiven=t[n].PointGiven,c.PointRedeem=t[n].PointRedeem):1==t[n].IsPaid&&void 0!==t[n].isPointApply&&1==t[n].isPointApply?(c.PointGiven=0,c.PointRedeem=t[n].PointRedeem):1==t[n].IsPaid&&(c.PointGiven=t[n].PointGiven,c.PointRedeem=0),c.Price=t[n].isPointApply?t[n].priceOriginal:t[n].Price,c.OriginalPrice=t[n].priceOriginal,c.ServiceId=t[n].ServiceId,c.ServiceName=t[n].ServiceTitle,c.Status=11,c.PromotionID=i.lstAddonService[n].PromotionID,c.PayableAmount=t[n].payableAmount,c.DiscountId=0,c.ResOccurs=String.isNullOrUndefineOrBlank(t[n].ResOccurs)?0:t[n].ResOccurs,c.CalculatedTaxTypeWise=JSON.stringify(t[n].BusinessTax),"undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell&&(c.PaidType=0,c.PayableAmount=0,void 0!==i.lstAddonService&&null!=i.lstAddonService&&""!=i.lstAddonService&&0==i.lstAddonService[n].PromotionID&&(c.Price=t[n].priceOriginal)),a.push(c)}}if(!String.isNullOrUndefineOrBlank(ReschedualAddonService)&&ReschedualAddonService.length>0){var d=e.grep(ReschedualAddonService,function(e){return 12==e.Status});if(d.length>0)for(n=0;n<d.length;n++){var c={};s=new Date(i.StartTime),l=e.datepicker.formatDate("yy-mm-dd",s);c.AppTime=moment(i.ServiceStartTime,"hh:mm A"),c.Appointmentdate=l,c.AppointmentID=d[n].AppointmentID,c.DepositsPercentage=0,c.Duration=0,c.OldServiceName="",c.OriginalDuration=0,c.OriginalPointRedeem=0,c.ParentAppointmentID=1*i.AppointmentID,c.ServiceId=d[n].ServiceId,c.ServiceName=d[n].ServiceTitle,c.Status=12,a.push(c)}}return a},_onlineCheckout.GetServcieDuration=function(e,t){var i=0,a=0;if(null!=e&&null!=e&&e.length>0){for(var r=0;r<e.length;r++)a+=parseInt(e[r].Duration);i=parseInt(t.Duration)-parseInt(t.CleanupTime)-parseInt(a)}return i},_onlineCheckout.setAddonServicePackageCheckoutData=function(t,i,a,r){var o=r;if(null!=i)for(var n=0;n<i.length;n++){checkoutGridrow={},checkoutGridrow.uniqID=o++,checkoutGridrow.userName=t.userName,checkoutGridrow.userID=t.userID,checkoutGridrow.serviceProviderID=t.serviceProviderID,checkoutGridrow.itemID=i[n].ServiceId,checkoutGridrow.itemName=i[n].ServiceTitle,checkoutGridrow.pointsGained=i[n].PointGiven,checkoutGridrow.pointsRedeem=i[n].PointRedeem,checkoutGridrow.recordType=d.GiftCertificate,checkoutGridrow.barcodeID=g,checkoutGridrow.price=i[n].TotalPrice,checkoutGridrow.giftCertificateChangePrice=i[n].TotalPrice,checkoutGridrow.Relationships=t.Relationships,checkoutGridrow.ChildAge=t.ChildAge,checkoutGridrow.MaxNoFamilyFriends=null!=t.MaxNoFamilyFriends?t.MaxNoFamilyFriends:0,checkoutGridrow.ConstantOriginalServicePrice=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].ConstantOriginalServicePrice)?i[n].TotalPrice:i[n].ConstantOriginalServicePrice:i[n].TotalPrice,checkoutGridrow.OriginalDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].OriginalDiscountRights)?0:i[n].OriginalDiscountRights:0,checkoutGridrow.OriginalDiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].OriginalDiscountType)?1:i[n].OriginalDiscountType:1,checkoutGridrow.ApprovedBy=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].ApprovedBy)?0:i[n].ApprovedBy:0,checkoutGridrow.IsAskApprovalPopup=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].IsAskApprovalPopup)?0:i[n].IsAskApprovalPopup:0,checkoutGridrow.IsShowApprovalPriceDiscount=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].IsShowApprovalPriceDiscount)?0:i[n].IsShowApprovalPriceDiscount:0,null==_onlineCheckout.PackageSharingDetail&&(_onlineCheckout.PackageSharingDetail=[]);var s=e.grep(_onlineCheckout.PackageSharingDetail,function(e){return e.ServiceId==i[n].ServiceId&&e.autoId==t.autoId});null!=s&&s.length>0?checkoutGridrow.SelectedFamilyFriends=s[0].SelectedFamilyFriends:"true"==_onlineCheckout.isFromInvoice.toString().toLowerCase()&&(checkoutGridrow.SelectedFamilyFriends=t.SelectedFamilyFriends),void 0!==i[n].isPresetApply&&1==i[n].isPresetApply||0!=i[n].PromotionID||void 0!==i[n].IsInitialDiscount&&1==i[n].IsInitialDiscount?(checkoutGridrow.discount=i[n].discount,checkoutGridrow.discountedPrice=i[n].TotalPrice-i[n].discount):(checkoutGridrow.discount=_onlineCheckout.isValidForCheckoutInvoice()?i[n].discount:0,checkoutGridrow.discountedPrice=_onlineCheckout.isValidForCheckoutInvoice()?i[n].Price:i[n].TotalPrice),checkoutGridrow.quantity=t.NoOfVisit,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.isSendEmailToRecipient=!1,checkoutGridrow.isSendEmailToSender=!0,checkoutGridrow.isPrint=!1,checkoutGridrow.assignTo=t.userID,checkoutGridrow.expiresOn="never",checkoutGridrow.imagePath="",checkoutGridrow.message="",checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(i[n].taxprice,3),checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(i[n].BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(i[n].BusinessTax)?"[]":JSON.stringify(i[0].BusinessTax)),checkoutGridrow.taxes=i[n].TaxValue,checkoutGridrow.GCAssignToName="",checkoutGridrow.GCServiceName="",checkoutGridrow.GCColor="",checkoutGridrow.gCPreviewURL="",checkoutGridrow.isRecurring=t.IsRecurring,checkoutGridrow.isRecurring?(checkoutGridrow.renewalOn=t.ChargeFrequency,checkoutGridrow.RecurringLimit=0==t.RecurringLimit?-1:t.RecurringLimit,checkoutGridrow.isCarryBal=3!=t.ChargeFrequency&&t.IsCarryForwardBal):(checkoutGridrow.renewalOn=0,checkoutGridrow.RecurringLimit=0,checkoutGridrow.isCarryBal=!1),checkoutGridrow.recGiftCertificateID=_onlineCheckout.isValidForCheckoutInvoice()||!String.isNullOrUndefineOrBlank(i[n].RecGiftCertificateId)&&i[n].RecGiftCertificateId>0?i[n].RecGiftCertificateId:0,"true"==isWidget.toLowerCase()?checkoutGridrow.purchasedAt="My Widget":"true"==isCustomWebsite.toLowerCase()?checkoutGridrow.purchasedAt="My Vagaro Website":checkoutGridrow.purchasedAt="My Vagaro Page",checkoutGridrow.PromotionID=i[n].PromotionID,checkoutGridrow.DiscountID=i[n].DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(i[n].DiscountType)?1==i[n].IsAmount?2:1:i[n].DiscountType:1==i[n].IsAmount?2:1,checkoutGridrow.AmountValue=i[n].AmountValue,checkoutGridrow.isInitialDiscount=i[n].IsInitialDiscount,checkoutGridrow.initialDiscount=i[n].InitialDiscount,checkoutGridrow.isAmountInitialDiscount=i[n].IsAmountForInitialDiscount,checkoutGridrow.billingCycle=t.BillingCycle,!String.isNullOrUndefineOrBlank(t.UsedInBiling)&&t.UsedInBiling>0?checkoutGridrow.usedInBiling=t.UsedInBiling:0!=typeof t.BillingCycle&&(checkoutGridrow.usedInBiling=1),"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,a.push(checkoutGridrow)}return o},_onlineCheckout.GetAddonsServiceId=function(e){var t="";if(null!=e&&""!=e&&e.length>0){for(var i=0;i<e.length;i++)t+=e[i].ServiceId+",";t=t.substring(0,t.length-1)}return t},_onlineCheckout.SuggestUpsellMembershipAddToCart=function(e,t,i,a,r,o,n,s,l,d,c){ShowLoader(!0),Data={},Data.businessID=e,Data.membershipID=t,Data.IsOverride=i,Data.checkInUserID=a,Data.ischeckinApp=r,Data.promotiondetail=o,Data.promotiontitle=n,Data.IsInitialDiscount=s,Data.InitialDiscount=l,Data.IsAmount=d,Data.BillingCycle=c;var u=new vagaro.ajax;u.datamodel.Token="websiteapi/homepage/membershipaddtocart",u.datamodel.IsNewVagaroAPI=!0,u.datamodel.callback=function(e){ShowLoader(!1)},u.datamodel.data=Data,u.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},u.Post()},_onlineCheckout.DeleteMembersipPackageCartItems=function(){if(_onlineCheckout.IsUpSellMemPkgAdd=0,1==e("#divSuggestUpsell").find(".vg-filter-mobile-tab.vg-switch-tab-first.w--current").length)return!0;ShowLoader(!0),_onlineCheckout.RemoveMembersipPackageCartItems(onlineShoppingCart.BusinessID,onlineShoppingCart.loginUserId,"MembershipsPackage",1),onlineShoppingCartmain.Memberships=[],null!=onlineShoppingCartmain.Packages&&onlineShoppingCartmain.Packages.length>0&&(onlineShoppingCartmain.Packages=e.grep(onlineShoppingCartmain.Packages,function(e){return 4!=e.eventType}));var t=e.extend(!0,[],onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail);t.lstMembershipForCheckout=e.grep(t.lstMembershipForCheckout,function(e){return"undefined"==e.IsUpsell||null==e.IsUpsell||1!=e.IsUpsell}),_onlineCheckout.ApplyDiscounts(t.lstGcAndPackagesForCheckout,t.lstUserListForCheckout,t.lstMembershipForCheckout,t.IsPromotionEnable),e("#divSuggestUpsell").find(".vg-filter-mobile-tab").removeClass("w--current"),e("#divSuggestUpsell").find(".vg-switch-tab-first").addClass("w--current"),_onlineCheckout.IsVCFEnable()&&(_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.RemoveUpSell)),ShowLoader(!1)},_onlineCheckout.RemoveMembersipPackageCartItems=function(e,t,i,a){var r={businessID:e,referenceId:0,cardItemType:i,userEmail:"",autoId:a,isCheckInApp:!1,isWorkShop:!1,randomForWorkShop:"",loginUserID:t};vagaro.ajaxCall(ApiURLEnumOnlineCheckout.removecartitem,r,function(e){},function(e){vagaro.alert("Some error occured. Please try again.")},!1,!0)},_onlineCheckout.setSuggestUpsellMembershipsData=function(t,i,a){if(_onlineCheckout.ResetPkgMembershipVariable(),null!=t&&t.length>0){for(var r=0;r<1;r++){if(membershipDetails={},membershipDetails.ActiveMembershipID=null,membershipDetails.ActiveMembershipName=null,membershipDetails.ActualPrice=t[0].Price,membershipDetails.AmountValue=t[0].AmountValue,membershipDetails.ApprovedBy=null,membershipDetails.BillingCycle=t[0].BillingCycle,0!=typeof t[0].BillingCycle?membershipDetails.usedInBiling=1:membershipDetails.usedInBiling=0,membershipDetails.ChargeFrequency=t[0].ChargeFrequency,membershipDetails.isAutoRenewalMembership=t[0].IsRecurring,membershipDetails.isCarryBal=1==membershipDetails.isAutoRenewalMembership&&void 0!==t[0].IsCarryForwardBal&&null!=t[0].IsCarryForwardBal&&"true"==t[0].IsCarryForwardBal.toString().toLowerCase(),membershipDetails.recordType=d.Membership,membershipDetails.barcodeID=v,membershipDetails.ChildAge=t[0].ChildAge,membershipDetails.ConstantOriginalServicePrice=0,membershipDetails.Discount=0,membershipDetails.DiscountID=null,membershipDetails.DiscountType=null,membershipDetails.InitialDiscount=t[0].InitialDiscount,membershipDetails.IsAmount=t[0].IsAmount,membershipDetails.IsAmountForInitialDiscount=t[0].IsAmountForInitialDiscount,membershipDetails.IsAskApprovalPopup=null,membershipDetails.IsFromCreateLink=!1,membershipDetails.IsInitialDiscount=t[0].IsInitialDiscount,membershipDetails.membershipPaymentToBeTaken=t[0].IsRecurring,membershipDetails.IsRecurring=t[0].IsRecurring,membershipDetails.IsShowApprovalPriceDiscount=null,membershipDetails.MaxNoFamilyFriends=null!=t[0].MaxNoFamilyFriends?t[0].MaxNoFamilyFriends:0,membershipDetails.MembershipId=t[0].MembershipID,membershipDetails.itemID=t[0].MembershipID,membershipDetails.MembershipName=t[0].MembershipName,membershipDetails.OriginalDiscountRights=null,membershipDetails.OriginalDiscountType=null,membershipDetails.PerTransactionOne=null,membershipDetails.PerUserOne=null,membershipDetails.Price=t[0].Price,membershipDetails.PromotionID=t[0].PromotionID,membershipDetails.PromotionTitle=t[0].PromotionTitle,membershipDetails.RecurringLimit=t[0].RecurringLimit,membershipDetails.RedeemGCs=null,membershipDetails.Relationships=t[0].Relationships,membershipDetails.SelectedFamilyFriends=null,membershipDetails.Tax=t[0].Tax,membershipDetails.Taxation=0,membershipDetails.UsedInBiling=t[0].UsedInBiling,membershipDetails.UserBusinessMembershipId=null,membershipDetails.autoId=r+200,membershipDetails.isPresetApply=!1,membershipDetails.message=null,membershipDetails.pointsGained=t[0].pointsGained,membershipDetails.productDisc=0,membershipDetails.redeemAmt=0,membershipDetails.redeemTax=0,membershipDetails.serviceDisc=0,membershipDetails.serviceProviderID=t[0].serviceProviderID,membershipDetails.userID=t[0].userID,membershipDetails.DepositsRemaining=0,membershipDetails.DepositsPaid=0,membershipDetails.BusinessTax=String.isNullOrUndefineOrBlank(t[0].Taxes)||"[]"==t[0].Taxes?"[]":JSON.parse(t[0].Taxes),membershipDetails.BusinessTax=_onlineCheckout.ApplyMultipleTax(t[0].Price,membershipDetails),membershipDetails.calculatedTax=parseFloat(t[0].Price*t[0].Tax/100),membershipDetails.ActualTax=membershipDetails.calculatedTax,membershipDetails.TaxValue=t[0].TaxValue,membershipDetails.MembershipUniqueId=t[0].MembershipID+"~UMD",void 0!==totalDailyDealFeeOfAllCart_PMGCA&&""!=totalDailyDealFeeOfAllCart_PMGCA&&totalDailyDealFeeOfAllCart_PMGCA>0){var o=_onlineCheckout.GetEffectiveIsForNewCustomer();!0===o?(membershipDetails.dailydealFee=membershipDetails.Price*dailyDealFeeValue/100,membershipDetails.FMBPercentage=dailyDealFeeValue):!1===o?(membershipDetails.dailydealFee=membershipDetails.Price*dailyDealFeeValue_ExistingUser/100,membershipDetails.FMBPercentage=dailyDealFeeValue_ExistingUser):(membershipDetails.dailydealFee=0,membershipDetails.FMBPercentage=0)}i.push(membershipDetails)}null!=i&&i.length>0&&(i[0].MaxNoFamilyFriends>0?1==a?(e("#scffsharingMS").html(_shopdetail.createHTMLofMembershipUpsell(i[0].MaxNoFamilyFriends,"MS",2)),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(4)):2==a&&_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(2):e("#scffsharingMS").hide())}},_onlineCheckout.setSuggestUpsellPackageData=function(t,i,a){if(_onlineCheckout.ResetPkgMembershipVariable(),null!=t&&t.length>0){for(var r=0;r<t.length;r++){if(packageDetails={},packageDetails.ActualPrice=t[r].Price,packageDetails.AmountValue=t[r].AmountValue,packageDetails.ApprovedBy=null,packageDetails.BillingCycle=t[r].BillingCycle,0!=typeof t[r].BillingCycle?packageDetails.usedInBiling=1:packageDetails.usedInBiling=0,packageDetails.ChargeFrequency=t[r].ChargeFrequency,packageDetails.ChildAge=t[r].ChildAge,packageDetails.ConstantOriginalServicePrice=0,packageDetails.DefaultImage=t[r].DefaultImage,packageDetails.DiscountID=t[r].DiscountID,packageDetails.DiscountType=t[r].DiscountType,packageDetails.InitialDiscount=t[r].InitialDiscount,packageDetails.IsAdminPhoto=t[r].IsAdminPhoto,packageDetails.IsAmount=t[r].IsAmount,packageDetails.IsAmountForInitialDiscount=t[r].IsAmountForInitialDiscount,packageDetails.IsAskApprovalPopup=null,packageDetails.IsCarryForwardBal=t[r].IsCarryForwardBal,packageDetails.IsFromCreateLink=!1,packageDetails.IsInitialDiscount=t[r].IsInitialDiscount,packageDetails.RecordType=d.GiftCertificate,packageDetails.BarcodeID=g,packageDetails.IsRecurring=t[r].IsRecurring,packageDetails.IsRecurring?(packageDetails.renewalOn=t[r].ChargeFrequency,packageDetails.RecurringLimit=0==t[r].RecurringLimit?-1:t[r].RecurringLimit,packageDetails.isCarryBal=3!=t[r].IsRecurring&&t[r].IsCarryForwardBal):(packageDetails.renewalOn=0,packageDetails.RecurringLimit=0,packageDetails.isCarryBal=!1),packageDetails.IsShowApprovalPriceDiscount=null,packageDetails.MaxNoFamilyFriends=null!=t[r].MaxNoFamilyFriends?t[r].MaxNoFamilyFriends:0,packageDetails.NoOfVisit=1,packageDetails.OriginalDiscountRights=null,packageDetails.OriginalDiscountType=null,packageDetails.ParentServiceTitle=t[r].ParentServiceTitle,packageDetails.PerTransactionOne=t[r].PerTransactionOne,packageDetails.PerUserOne=t[r].PerUserOne,packageDetails.Price=t[r].Price,packageDetails.PromotionID=t[r].PromotionID,packageDetails.PromotionTitle=t[r].PromotionTitle,packageDetails.RecGiftCertificateId=t[r].RecGiftCertificateId,packageDetails.Relationships=t[r].Relationships,packageDetails.SelectedFamilyFriends=null,packageDetails.SellPackageServiceID=t[r].SellPackageServiceID,packageDetails.ServiceDesc=t[r].ServiceDesc,packageDetails.ServiceId=t[r].ServiceId,packageDetails.ServiceTitle=t[r].ServiceTitle,packageDetails.Tax=t[r].Tax,packageDetails.TotalAddonServicePrice=0,packageDetails.TotalPrice=t[r].Price,packageDetails.autoId=i.length+(r+500),packageDetails.discount=t[r].discount,packageDetails.eventType=4,packageDetails.isPresetApply=!1,packageDetails.lstAddonService=null,packageDetails.originalDiscount=null,packageDetails.pointsGained=t[r].pointsGained,packageDetails.redeemAmt=0,packageDetails.redeemTax=0,packageDetails.serviceProviderID=t[r].serviceProviderID,packageDetails.sessionDetail=t[r].sessionDetail,packageDetails.userID=t[r].userID,packageDetails.userName=t[r].userName,packageDetails.isSuggestUpsell=1,packageDetails.DepositsRemaining=0,packageDetails.DepositsPaid=0,packageDetails.BusinessTax=String.isNullOrUndefineOrBlank(t[r].Taxes)||"[]"==t[r].Taxes?"[]":JSON.parse(t[r].Taxes),packageDetails.BusinessTax=_onlineCheckout.ApplyMultipleTax(t[r].Price,packageDetails),packageDetails.calculatedTax=parseFloat(t[r].Price*t[r].Tax/100),packageDetails.ActualTax=packageDetails.calculatedTax,packageDetails.TaxValue=t[r].TaxValue,packageDetails.lstPackageForCheckout=String.isNullOrUndefineOrBlank(t[r].PackageJSON)?[]:JSON.parse(t[r].PackageJSON),null!=packageDetails.lstPackageForCheckout&&packageDetails.lstPackageForCheckout.length>0&&(packageDetails.lstPackageForCheckout=e.grep(packageDetails.lstPackageForCheckout,function(e){return 1==e.isPackage&&(e.isPackage=!0),1==e.isCustomPackage&&(e.isCustomPackage=!0),e})),packageDetails.GCUpdatePendingID=!String.isNullOrUndefineOrBlank(packageDetails.lstPackageForCheckout)&&packageDetails.lstPackageForCheckout.length>0?packageDetails.lstPackageForCheckout[0].giftCertificateID:0,void 0!==totalDailyDealFeeOfAllCart_PMGCA&&""!=totalDailyDealFeeOfAllCart_PMGCA&&totalDailyDealFeeOfAllCart_PMGCA>0){var o=_onlineCheckout.GetEffectiveIsForNewCustomer();!0===o?(packageDetails.dailydealFee=packageDetails.Price*dailyDealFeeValue/100,packageDetails.FMBPercentage=dailyDealFeeValue):!1===o?(packageDetails.dailydealFee=packageDetails.Price*dailyDealFeeValue_ExistingUser/100,packageDetails.FMBPercentage=dailyDealFeeValue_ExistingUser):(packageDetails.dailydealFee=0,packageDetails.FMBPercentage=0)}i.push(packageDetails)}null!=i&&i.length>0&&(i[0].MaxNoFamilyFriends>0?1==a?(e("#scffsharingPkg").html(_shopdetail.createHTMLofMembershipUpsell(i[0].MaxNoFamilyFriends,"PKG",5)),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(5)):2==a&&_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(1):e("#scffsharingPkg").hide())}},_onlineCheckout.SuggestUpsellServiceAddToCart=function(t,i,a,r,o,n,s,l,d,c){if(parseFloat(i)>0){var u=_shopdetail.CreateAddonCollection();ShowLoader(!0);var p=new vagaro.ajax;p.datamodel.Token=ApiURLEnumOnlineCheckout.serviceaddtocart,p.datamodel.IsNewVagaroAPI=!0,p.datamodel.callback=function(e){ShowLoader(!1)},Data={},Data.businessID=t,Data.serviceId=i,Data.noOfVisit=a,Data.isCustomPackage=r,Data.promotionDetail=o,Data.promotionTitle=n,Data.IsInitialDiscount=s,Data.InitialDiscount=l,Data.IsAmount=d,Data.BillingCycle=c,Data.ServiceDesc="",Data.lstAddonService=u,p.datamodel.data=Data;try{var h={Action:"Add to Cart",Category:"Deal",PageName:"Deal"};null!=e("#lblSalonName")&&null!=e("#lblSalonName").text()&&(h.BusinessName=e("#lblSalonName").text()),h.BusinessID=t,h.isDealDetails=!0,h.IsListPage=!0,h.IsMapPage=!1,h.isFiltered=!1,h.DealName=n,_vgLogEvent.LogData(h)}catch(e){}p.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},p.Post()}else vagaro.alert("Some error occured. Please try again.")},_onlineCheckout.CalculateAddonTax=function(t){null!=t&&null!=t&&t.length>0&&e.each(t,function(e,t){_onlineCheckout.isValidForCheckoutInvoice()||1==t.isPointApply||(t.Price=t.Originalprice,t.actualPrice=t.Price,t.actualTaxprice=parseFloat(t.Price)*t.tax/100,t.taxprice=_vgClassSessionSelection.ConvertTodecimal(parseFloat(t.Price)*t.tax/100,2,!0))})},_onlineCheckout.ApplyMultipleAddonTax=function(t){null!=t&&null!=t&&t.length>0&&e.each(t,function(t,i){var a=String.isNullOrUndefineOrBlank(i.BusinessTax)||"[]"==i.BusinessTax?"":i.BusinessTax;String.isNullOrUndefineOrBlank(a)||e.grep(a,function(e){void 0===i||1!=i.isPackage&&1!=i.isPointApply?e.CalculatedTax=_onlineCheckout.parseTodecimal(i.Price*e.Tax/100,2):e.CalculatedTax=_onlineCheckout.parseTodecimal(0,2)})})},_onlineCheckout.calculatAddonDepositsPercent=function(e,t){return 100*t/e},_onlineCheckout.calculateAddonsDepositsOnEvents=function(t,i){var a=0;return null!=t&&null!=t&&t.length>0&&e.grep(t,function(e){var t=void 0!==e.IsPartialPoint&&e.IsPartialPoint;e.paidType=_onlineCheckout.arrpaidType.PaidClass,1==e.isPointApply&&!t||1==e.isPackage||0!=e.gcId&&null!=e.gcId||0!=e.Price||0!=e.discount||(e.paidType=_onlineCheckout.arrpaidType.Paid),e.depositsTax=0,t||(e.depositsPaid=0),1==e.isPointApply&&!t||1==e.isPackage||0!=e.gcId&&null!=e.gcId||(_onlineCheckout.isValidForCheckoutInvoice()?(e.OriginalpaidType==_onlineCheckout.arrpaidType.DepositsClass||e.OriginalpaidType==_onlineCheckout.arrpaidType.OfflineDeposit)&&void 0!==e.depositsPercentage&&parseFloat(e.depositsPercentage)>0&&(e.depositsPaid=_onlineCheckout.parseTodecimal(e.Price*e.depositsPercentage/100,2),e.depositsTax=e.taxprice,e.paidType=_onlineCheckout.arrpaidType.DepositsClass):i>=onlineShoppingCart.DepositsLimit&&!_onlineCheckout.isValidForCheckoutInvoice()?null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(e.eventDate)?(e.depositsPaid=0,e.depositsPercentage=0,e.paidType=_onlineCheckout.arrpaidType.UnPaid):0==onlineShoppingCartmain.DepositAmtType&&100!=onlineShoppingCart.DepositsPer&&e.Price>0?(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()?(e.depositsPaid=1==e.IsPartialPoint?e.depositsPaid:_onlineCheckout.calculatedDepositsAmount(e.Price+e.taxprice,0),IsDailyDealFeeCCOFF||totalDepositWhenDepositLessDDFee<cartDailyDealFee&&e.actualPrice>e.dailydealFee?e.depositsPaid=e.dailydealFee:e.actualPrice<e.dailydealFee&&(e.depositsPaid=e.actualPrice)):(e.depositsPaid=1==e.IsPartialPoint?e.depositsPaid:_onlineCheckout.calculatedDepositsAmount(e.Price,0),IsDailyDealFeeCCOFF||totalDepositWhenDepositLessDDFee<cartDailyDealFee&&e.actualPrice>e.dailydealFee?e.depositsPaid=e.dailydealFee:e.actualPrice<e.dailydealFee&&(e.depositsPaid=e.actualPrice)),e.depositsPercentage=Number(e.dailydealFee)>0?onlineShoppingCartmain.DepositsPer:0,e.depositsTax=e.taxprice,e.paidType=_onlineCheckout.arrpaidType.DepositsClass):1==onlineShoppingCartmain.DepositAmtType&&onlineShoppingCart.DepositsPer<e.Price&&e.Price>0?(e.depositsPaid=1==e.IsPartialPoint?e.depositsPaid:onlineShoppingCartmain.DepositsPer,IsDailyDealFeeCCOFF||totalDepositWhenDepositLessDDFee<cartDailyDealFee&&e.actualPrice>e.dailydealFee?e.depositsPaid=e.dailydealFee:e.actualPrice<e.dailydealFee&&(e.depositsPaid=e.actualPrice),e.depositsPercentage=_onlineCheckout.calculatedDepositsAmount(e.Price,1),e.depositsTax=e.taxprice,e.paidType=_onlineCheckout.arrpaidType.DepositsClass):(e.paidType=_onlineCheckout.arrpaidType.PaidClass,e.depositsPaid=0,e.depositsTax=0,e.actualPrice<e.dailydealFee&&cartDailyDealFee>0&&(e.dailydealFee=e.actualPrice),0==e.Price?1==e.isMembershipApply||e.discount>0?e.paidType=_onlineCheckout.arrpaidType.PaidClass:e.paidType=_onlineCheckout.arrpaidType.UnPaid:1==e.isMembershipApply&&0==onlineShoppingCartmain.DepositAmtType&&onlineShoppingCart.DepositsPer<100&&(e.paidType=_onlineCheckout.arrpaidType.PartiallyPaidClass)):(0!=e.Price||1!=e.isMembershipApply&&0!=e.discount?1==e.isMembershipApply?e.paidType=_onlineCheckout.arrpaidType.PartiallyPaidClass:0==e.discount&&(e.paidType=_onlineCheckout.arrpaidType.UnPaid):e.paidType=_onlineCheckout.arrpaidType.PaidClass,e.depositsPaid=0,e.depositsPercentage=0,e.depositsTax=e.taxprice),e.paidType!=_onlineCheckout.arrpaidType.PaidClass&&(e.IsPartialPoint?e.IsDepositsOver?(a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.parseTodecimal(e.Price-e.depositsPaid,2)+_onlineCheckout.parseTodecimal(e.depositsTax,2),2),e.depositsPaid>=e.Price?e.depositsRemaining=_onlineCheckout.parseTodecimal(0,2):e.depositsRemaining=_onlineCheckout.parseTodecimal(e.Price-e.depositsPaid,2)):(a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.parseTodecimal(e.Price-e.depositsPaid-e.PartialPrice,2)+_onlineCheckout.parseTodecimal(e.depositsTax,2),2),e.depositsRemaining=_onlineCheckout.parseTodecimal(e.Price-e.depositsPaid-e.PartialPrice,2)):(a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.parseTodecimal(e.Price-e.depositsPaid,2)+_onlineCheckout.parseTodecimal(e.depositsTax,2),2),e.depositsRemaining=_onlineCheckout.parseTodecimal(e.Price-e.depositsPaid,2))))}),a},_onlineCheckout.ApplyPointsOnAddonEvents=function(t,i,a,r){var o=e.extend(!0,[],a);t.calssdiscountprice=0;var n={IsDealGCApply:!0,PerUserOneFlag:!1};null!=r&&null!=r&&r.length>0&&e.grep(r,function(a){var r=0,s=_onlineCheckout.GetPackageListAddon(o,t,a,n);a.OriginalpaidType=a.paidType,e.grep(i,function(e){if(a.Price>0)if(a.customerID>0&&e.userId>0&&a.customerID==e.userId||a.customerID<=0&&e.userId>0&&a.cUserEmail==e.emailId){r=e.pointsBalance;var t=String.isNullOrUndefineOrBlank(a.PointRedeem)?0:a.PointRedeem;if(!(t>0&&r>0&&r>=t&&("true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==a.isPaid&&0==s.length)||Number(a.dailydealFee)>0||_shopdetail.EnableFMBFee()&&null!=a.PromotionID&&Number(a.PromotionID)>0)if(!(_onlineCheckout.IsPartialPointAllowed&&t>0&&r>0&&("true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==a.isPaid&&0==s.length)||Number(a.dailydealFee)>0||_shopdetail.EnableFMBFee()&&null!=a.PromotionID&&Number(a.PromotionID)>0)a.isPointApply=!1,a.pointsRedeem=0,(void 0===a.Originalprice||String.isNullOrUndefineOrBlank(a.Originalprice))&&(a.Originalprice=parseFloat(a.Price)),a.Originaltaxprice=parseFloat(a.taxprice);else{var i=parseInt(r);if(a.pointsRedeem=i,a.isPointApply=!0,(void 0===a.Originalprice||String.isNullOrUndefineOrBlank(a.Originalprice))&&(a.Originalprice=parseFloat(a.Price)),1==onlineShoppingCartmain.DepositAmtType){var o=_onlineCheckout.calculatedDepositsAmount(a.actualPrice);a.depositsPercentage=o;var n=_shopdetail.GetDepositsAmount(a.actualPrice,o);if((c=Math.ceil(a.PointRedeem*n/parseFloat(a.Originalprice)))>r){a.pointsRedeem=r,a.PartialPrice=_onlineCheckout.parseTodecimal(_onlineCheckout.CalculateApplyPointsClassPrice(a.Price,a.pointsRedeem,a.PointRedeem),2);var l=_shopdetail.parseTodecimal(onlineShoppingCartmain.DepositsPer-a.PartialPrice);a.depositsPaid=l,a.Price=_onlineCheckout.parseTodecimal(parseFloat(a.Price-a.PartialPrice),2),a.IsDepositsOver=!1,a.IsPartialDeposits=!0}else a.depositsPaid=onlineShoppingCartmain.DepositsPer,a.pointsRedeem=c,a.PartialPrice=a.depositsPaid,a.Price=_onlineCheckout.parseTodecimal(parseFloat(a.Price-a.PartialPrice),2),a.IsDepositsOver=!0,a.IsPartialDeposits=!0}else if(0==onlineShoppingCartmain.DepositAmtType&&100!=onlineShoppingCartmain.DepositsPer&&a.Price>0){var d=_onlineCheckout.calculatedDepositsAmount(a.actualPrice),c=Math.ceil(a.PointRedeem*d/parseFloat(a.Originalprice));if(a.depositsPercentage=onlineShoppingCartmain.DepositsPer,c>r){a.pointsRedeem=r,a.PartialPrice=_onlineCheckout.parseTodecimal(_onlineCheckout.CalculateApplyPointsClassPrice(a.Price,a.pointsRedeem,a.PointRedeem),2);l=_shopdetail.parseTodecimal(d-a.PartialPrice);a.depositsPaid=l,a.Price=_onlineCheckout.parseTodecimal(parseFloat(a.Price-a.PartialPrice),2),a.IsDepositsOver=!1,a.IsPartialDeposits=!0}else a.depositsPaid=d,a.pointsRedeem=c,a.PartialPrice=d,a.Price=_onlineCheckout.parseTodecimal(parseFloat(a.Price-a.PartialPrice),2),a.IsDepositsOver=!0,a.IsPartialDeposits=!0}else a.PartialPrice=_onlineCheckout.parseTodecimal(_onlineCheckout.CalculateApplyAddonPointsClassPrice(a.Price,a.PointRedeem,i),2),a.Price=_onlineCheckout.parseTodecimal(parseFloat(a.Price-a.PartialPrice),2);e.pointsBalance=parseInt(r-a.pointsRedeem),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(a.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(a.pointsRedeem),a.IsPartialPoint=!0,a.Originaltaxprice=parseFloat(a.taxprice),1==_onlineCheckout.isValidForCheckoutInvoice()?a.taxprice=0:a.taxprice=_onlineCheckout.parseTodecimal(a.Price*a.tax/100,3)}else a.isPointApply=!0,a.pointsRedeem=t,e.pointsBalance=parseInt(r-t),onlineShoppingCart.AppliedPoints=String.isNullOrUndefineOrBlank(onlineShoppingCart.AppliedPoints)?parseInt(a.pointsRedeem):parseInt(onlineShoppingCart.AppliedPoints)+parseInt(a.pointsRedeem),(void 0===a.Originalprice||String.isNullOrUndefineOrBlank(a.Originalprice))&&(a.Originalprice=parseFloat(a.Price)),a.Price=0,a.Originaltaxprice=parseFloat(a.taxprice),a.taxprice=0,a.actualPrice=0,a.actualTaxprice=0,a.IsPartialPoint=!1}else _onlineCheckout.isValidForCheckoutInvoice()&&(a.isPointApply=!1,a.Originalprice=parseFloat(a.actualPrice),a.Originaltaxprice=parseFloat(a.actualTaxprice));else void 0!==a.isPointApply||a.isPointApply||(a.isPointApply=!1,a.Originalprice=parseFloat(a.actualPrice),a.Originaltaxprice=parseFloat(a.actualTaxprice))}),a.BusinessTax=_onlineCheckout.ApplyMultipleTax(a.Price,a)})},_onlineCheckout.GetAllAddonsWithSeparator=function(e,t){var i={addonids:"",price:"",duration:"",addonsName:""};return e.length>0&&(i.addonids+=Array.prototype.map.call(e,function(e){return e.ServiceId}).join(t),i.addonsName+=Array.prototype.map.call(e,function(e){return e.ServiceTitle}).join(t),i.price+=Array.prototype.map.call(e,function(e){return e.Price}).join(t),i.duration+=Array.prototype.map.call(e,function(e){return e.Duration}).join(t)),i},_onlineCheckout.LoadEventForAddonClass=function(){e("#accordion").off("show.bs.collapse"),e("#accordion").on("show.bs.collapse",function(t){e(".panel-collapse").removeClass("show");var i=0-e(".familyclassheight").scrollTop(),a=e(window).height();e(t.target).css("top",i+"px");var r=e(".panel-heading").width();e(".ffattendeelist-bg").attr("style","Width:"+r+"px");var o=e(t.target).attr("style");e(t.target).css({visibility:"hidden",display:"block"});var n=e(t.target).find(".ffattendeelist-bg").height(),s=e(t.target).find(".ffattendeelist-bg").position().top+i;e(t.target).attr("style",o||""),n+s+10>a&&e(t.target).css("top",i-(n+54)+"px")}),e("div#divclassaddonpopup div.modal-content .familyclassheight").off("scroll").on("scroll",function(t){var i=e("div.panel-collapse.attendeelist.collapse.show",t.target);void 0!==i&&null!=i&&i.length>0&&(e(i).css("height","0px"),e("#divAddonPopupSection").addClass("scrollbackhide"),e(i).parent().find("a.tocollapse").click())})},_onlineCheckout.ApplyPresetDiscountOnEventsAddon=function(t,a,r,o){var n={PromoApplied:!1,addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0,addonDiscountprice:0,FinalTotal:0};e.grep(t,function(t){!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(s){var l=e.grep(a,function(e){return e.ServiceID==s.ServiceId&&e.ItemTypeID==d.ClassAddons});if(null!=l&&l.length>0){if(l=l[0],void 0!==o&&(null!=o||null==o)){var c=s.Originalprice,u=0,p=l.ServiceProviderIDs,h=t.sPID,m=!1;for(i=0;i<p.split(",").length;i++)h==p.split(",")[i]&&(m=!0);var f=moment(t.workshopActualDate),g=moment(l.StartDate.replace("A"," A").replace("P"," P")),v=moment(l.EndDate.replace("A"," A").replace("P"," P"));if(g.diff(f,"min")>0&&(m=!1),""!=l.EndDate&&v.diff(f,"min")<0&&(m=!1),0==r&&(void 0!==s.isPresetApply&&0==s.isPresetApply&&s.DiscountID!=l.PromotionID||void 0===s.isPresetApply||void 0!==s.isPresetApply&&1==s.isPresetApply&&s.DiscountID!=l.PromotionID)&&(m=!1),1==s.isPointApply||null!=s.gcId&&1==s.isPackage||0==m){if(1!=s.isPointApply){if(s.gcId>0&&(c=s.actualPrice),1==s.isMembershipApply){var A=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==s.MembershipID&&e.ItemType==d.ClassAddons&&e.MembershipItemId==s.MembershipItemId});u=_onlineCheckout.parseTodecimal(c*A[0].Discount/100,2)}if(void 0!==s.isPresetApply&&1==s.isPresetApply&&(0==s.IsAmount?u=_onlineCheckout.parseTodecimal(u+c*s.AmountValue/100,2):(u=s.actualPrice<u+s.AmountValue?c:_onlineCheckout.parseTodecimal(u+s.AmountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(u=parseFloat(ConvertTodecimalMorePrecious(parseFloat(u)/(1+s.tax/100),!0,4))))),(null==s.gcId||0==s.gcId||s.gcId>0&&0==s.isPackage)&&0!=s.PromotionID){var C=0;1==s.IsAmount?(C=s.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(C=parseFloat(ConvertTodecimalMorePrecious(parseFloat(C)/(1+s.tax/100),!0,4)))):C=c*s.AmountValue/100,u+=C}s.actualPrice<u&&(u=c),s.discount=u,s.Price=_onlineCheckout.parseTodecimal(c-s.discount,2),s.actualPrice=s.Price,(s.gcId<0||s.gcId>0)&&1==s.isPackage?s.actualTaxprice=0:s.actualTaxprice=_onlineCheckout.parseTodecimal(s.Price*s.tax/100,3),n.addonDiscountprice=_onlineCheckout.parseTodecimal(n.addonDiscountprice+s.discount,2),s.taxprice=s.actualTaxprice,null!=s.gcId&&0==s.isPackage&&(0==s.Price&&(s.gcId=null,_onlineCheckout.RemoveDicount(d.ClassAddons,1,s.eventID,s.autoID)),s.redeemTax=s.actualTaxprice,s.redeemAmt=s.actualPrice),s.BusinessTax=_onlineCheckout.ApplyMultipleTax(s.Price,s),n.addonTotalPrice=_onlineCheckout.parseTodecimal(n.addonTotalPrice+s.Price,2),n.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(n.addonTotalTaxPrice+s.actualTaxprice,2),s.gcId>0&&0==s.isPackage&&(n.addonTotalGCUsed=_onlineCheckout.parseTodecimal(n.addonTotalGCUsed+s.Price,2))}}else{if(0!=s.PromotionID&&(s.PromotionID=0),1==s.isMembershipApply)null!=(A=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==s.MembershipID&&e.ItemType==d.ClassAddons&&e.MembershipItemId==s.MembershipItemId}))&&A.length>0&&1==A[0].IsAllowPreSetDiscount?u=_onlineCheckout.parseTodecimal(c*A[0].Discount/100,2):_onlineCheckout.RemoveDicount(d.ClassAddons,4,s.eventID,s.autoID);(void 0===s.isPresetApply||void 0!==s.isPresetApply&&1==s.isPresetApply||r)&&(0==l.IsAmount?u=_onlineCheckout.parseTodecimal(u+c*l.DiscountValue/100,2):(u=_onlineCheckout.parseTodecimal(u+l.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(u=parseFloat(ConvertTodecimalMorePrecious(parseFloat(u)/(1+s.tax/100),!0,4)))),s.isPresetApply=!0,s.DiscountID=l.PromotionID,s.IsAmount=l.IsAmount,s.AmountValue=l.DiscountValue,n.PromoApplied=!0),c<u&&(u=c),s.discount=u,s.Price=_onlineCheckout.parseTodecimal(c-s.discount,2),s.actualPrice=s.Price,s.actualTaxprice=_onlineCheckout.parseTodecimal(s.Price*s.tax/100,3),n.addonDiscountprice=_onlineCheckout.parseTodecimal(n.addonDiscountprice+s.discount,2),s.isPointApply=!1,s.isPackage=!1,s.taxprice=s.actualTaxprice,null!=s.gcId&&0==s.isPackage&&(0==s.Price&&(s.gcId=null,_onlineCheckout.RemoveDicount(d.ClassAddons,1,s.eventID,s.autoID)),s.redeemTax=s.actualTaxprice,s.redeemAmt=s.actualPrice),s.BusinessTax=_onlineCheckout.ApplyMultipleTax(s.Price,s),n.addonTotalPrice=_onlineCheckout.parseTodecimal(n.addonTotalPrice+s.Price,2),n.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(n.addonTotalTaxPrice+s.taxprice,2),s.gcId>0&&0==s.isPackage&&(n.addonTotalGCUsed=_onlineCheckout.parseTodecimal(n.addonTotalGCUsed+s.Price,2))}}}else if(1!=s.isPointApply){c=s.Originalprice;s.gcId>0&&(c=s.actualPrice);u=0;if(1==s.isMembershipApply){A=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==s.MembershipID&&2==e.ItemType&&e.MembershipItemId==s.MembershipItemId});u=_onlineCheckout.parseTodecimal(c*A[0].Discount/100,2)}if(void 0!==s.isPresetApply&&1==s.isPresetApply&&(0==s.IsAmount?u=_onlineCheckout.parseTodecimal(u+c*s.AmountValue/100,2):(u=s.actualPrice<u+s.AmountValue?c:_onlineCheckout.parseTodecimal(u+s.AmountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(u=parseFloat(ConvertTodecimalMorePrecious(parseFloat(u)/(1+s.tax/100),!0,4))))),(null==s.gcId||0==s.gcId||s.gcId>0&&0==s.isPackage)&&0!=s.PromotionID){C=0;1==s.IsAmount?(C=s.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(C=parseFloat(ConvertTodecimalMorePrecious(parseFloat(C)/(1+s.tax/100),!0,4)))):C=c*s.AmountValue/100,u+=C}s.actualPrice<u&&(u=c),s.discount=u,s.Price=_onlineCheckout.parseTodecimal(c-s.discount,2),s.actualPrice=s.Price,(s.gcId<0||s.gcId>0)&&1==s.isPackage?s.actualTaxprice=0:s.actualTaxprice=_onlineCheckout.parseTodecimal(s.Price*s.tax/100,3),n.addonDiscountprice=_onlineCheckout.parseTodecimal(n.addonDiscountprice+s.discount,2),s.taxprice=s.actualTaxprice,null!=s.gcId&&0==s.isPackage&&(0==s.Price&&(s.gcId=null,_onlineCheckout.RemoveDicount(d.ClassAddons,1,s.eventID,s.autoID)),s.redeemTax=s.actualTaxprice,s.redeemAmt=s.actualPrice),s.BusinessTax=_onlineCheckout.ApplyMultipleTax(s.Price,s),n.addonTotalPrice=_onlineCheckout.parseTodecimal(n.addonTotalPrice+s.Price,2),n.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(n.addonTotalTaxPrice+s.taxprice,2),s.gcId>0&&0==s.isPackage&&(n.addonTotalGCUsed=_onlineCheckout.parseTodecimal(n.addonTotalGCUsed+s.Price,2))}})});var s=parseFloat((n.addonTotalPrice+n.addonTotalTaxPrice-n.addonTotalGCUsed).toFixed(2));return n.addonTotalTaxPrice=parseFloat(n.addonTotalTaxPrice.toFixed(2)),n.addonTotalGCUsed=n.addonTotalGCUsed,n.FinalTotal=s,n.PromoApplied=n.PromoApplied,n.addonDiscountprice=n.addonDiscountprice,n},_onlineCheckout.RemovePresetDiscountOnEventsAddon=function(t,i,a){var r={PromoApplied:!1,addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0,addonDiscountprice:0,FinalTotal:0};e.grep(t,function(t){!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(o){var n=e.grep(i,function(e){return e.ServiceID==o.ServiceId&&e.ItemTypeID==d.ClassAddons});if(null!=n&&n.length>0){n=n[0];var s=o.Originalprice,l=0;if(void 0!==o.isPresetApply&&1==o.isPresetApply&&o.DiscountID==a)l=0==n.IsAmount?_onlineCheckout.parseTodecimal(s*n.DiscountValue/100,2):o.actualPrice<n.DiscountValue?s:_onlineCheckout.parseTodecimal(n.DiscountValue,2),o.discount=o.discount-l,o.Price=_onlineCheckout.parseTodecimal(o.Price+o.discount,2),o.actualPrice=o.Price,(o.gcId<0||o.gcId>0)&&1==o.isPackage?o.actualTaxprice=0:o.actualTaxprice=_onlineCheckout.parseTodecimal(o.Price*t.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+o.discount,2),r.addonDiscountprice=_onlineCheckout.parseTodecimal(r.addonDiscountprice+o.discount,2),o.isPresetApply=!1,o.isPointApply=!1,o.isPackage,o.DiscountID=0,o.IsAmount=!1,o.AmountValue=0,o.taxprice=o.actualTaxprice,null!=o.gcId&&0==o.isPackage&&(o.redeemTax=o.actualTaxprice,o.redeemAmt=o.actualPrice,onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed+l);else{if(1==o.isMembershipApply){var c=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==o.MembershipID&&2==e.ItemType&&e.MembershipItemId==o.MembershipItemId});l=_onlineCheckout.parseTodecimal(s*c[0].Discount/100,2)}o.discount=l,o.Price=o.Price,o.actualPrice=o.Price,(o.gcId<0||o.gcId>0)&&1==o.isPackage?o.actualTaxprice=0:o.actualTaxprice=_onlineCheckout.parseTodecimal(o.Price*t.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+o.discount,2),r.addondiscountprice=_onlineCheckout.parseTodecimal(r.addondiscountprice+o.discount,2),o.taxprice=o.actualTaxprice,null!=o.gcId&&0==o.isPackage&&(0==o.Price?_onlineCheckout.RemoveDicount(d.ClassAddons,1,o.eventID,o.autoID):onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed-o.discount,o.redeemTax=o.actualTaxprice,o.redeemAmt=o.actualPrice)}r.addonTotalPrice=_onlineCheckout.parseTodecimal(r.addonTotalPrice+o.Price,2),r.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(r.addonTotalTaxPrice+o.actualTaxprice,2),o.gcId>0&&0==o.isPackage&&(r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+o.Price,2))}else{s=o.actualPrice,l=0;if(1==o.isMembershipApply){c=e.grep(onlineShoppingCart.lstMembership,function(e){return e.MembershipID==o.MembershipID&&2==e.ItemType&&e.MembershipItemId==o.MembershipItemId});l=_onlineCheckout.parseTodecimal(s*c[0].Discount/100,2)}o.discount=l,o.Price=o.Price,o.actualPrice=o.Price,(o.gcId<0||o.gcId>0)&&1==o.isPackage?o.actualTaxprice=0:o.actualTaxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),onlineShoppingCart.classdiscount=_onlineCheckout.parseTodecimal(onlineShoppingCart.classdiscount+o.discount,2),r.addonDiscountprice=_onlineCheckout.parseTodecimal(r.addonDiscountprice+o.discount,2),o.taxprice=o.actualTaxprice,null!=o.gcId&&0==o.isPackage&&(0==o.Price?_onlineCheckout.RemoveDicount(d.Class,1,o.eventID,o.autoID):onlineShoppingCart.classGCUsed=onlineShoppingCart.classGCUsed-o.discount,o.redeemTax=o.actualTaxprice,o.redeemAmt=o.actualPrice),r.addonTotalPrice=_onlineCheckout.parseTodecimal(r.addonTotalPrice+o.Price,2),r.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(r.addonTotalTaxPrice+o.actualTaxprice,2),o.gcId>0&&0==o.isPackage&&(r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+o.Price,2))}})});var o=parseFloat((r.addonTotalPrice+r.addonTotalTaxPrice-r.addonTotalGCUsed).toFixed(2));return r.addonTotalTaxPrice=parseFloat(r.addonTotalTaxPrice.toFixed(2)),r.addonTotalGCUsed=r.addonTotalGCUsed,r.FinalTotal=o,r.PromoApplied=r.PromoApplied,r.addonDiscountprice=r.addonDiscountprice,r},_onlineCheckout.ApplyMembershipONEventsAddon_ShowDiscount=function(t,i){var a=e.grep(i,function(e){return e.ItemType==d.ClassAddons}),r={addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0,addonDiscountprice:0,FinalTotal:0};if(null!=a&&a.length>0){e.each(t,function(t,i){!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&(e.each(i.lstAddonService,function(t,o){void 0===o.IsOutsideBilling&&(o.IsOutsideBilling=!1),void 0===o.IsWaivedApply&&(o.IsWaivedApply=!1);var n=e.grep(a,function(e){return i.customerID>0&&e.UserID>0&&(i.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,i.customerID))||i.customerID<=0&&e.UserID>0&&i.cUserEmail==e.EmailId});e.each(n,function(e,t){if(t.ServiceProductName.toLowerCase().trim()==o.ServiceTitle.toLowerCase().trim()&&null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))>new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))&&null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))&&0==o.IsOutsideBilling&&0==o.IsWaivedApply&&(o.strAdvanceLimitDate=t.strAdvanceLimitDate,o.IsWaivedApply=!0,o.AppliedName=t.MembershipName),1==o.isMembershipRemove&&t.ServiceProductName.toLowerCase().trim()==o.ServiceTitle.toLowerCase().trim()&&t.Discount>0&&(i.customerID>0&&t.UserID>0&&(i.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,i.customerID))||i.customerID<=0&&t.UserID>0&&i.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)){t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining>0?t.VisitRemaining-1:t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(n,t);return 1==o.isPointApply||!(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)||0==o.PromotionID&&1!=o.isPresetApply||(o.discount,o.Price=o.Originalprice-o.discount,o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),o.actualPrice=o.Price,o.actualTaxprice=o.taxprice),!1}if(o.Price>0&&1!=o.isPointApply&&1!=o.isPackage&&(null==o.gcId||0==o.gcId)&&t.ServiceProductName.toLowerCase().trim()==o.ServiceTitle.toLowerCase().trim()&&t.Discount>0&&(i.customerID>0&&t.UserID>0&&(i.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,i.customerID))||i.customerID<=0&&t.UserID>0&&i.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)&&(!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&(0!=o.PromotionID&&1==t.isPromotionalDiscount||0==o.PromotionID||void 0===o.PromotionID)&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))){var a=parseFloat(o.Originalprice);return o.discount=o.discount+_onlineCheckout.GetMembershipDiscountAmount(o.Originalprice,t),a<o.discount&&(o.discount=a),o.Price=_onlineCheckout.parseTodecimal(o.Originalprice-o.discount,2),a>0&&(o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.taxprice/a,2)),o.isMembershipApply=!0,o.membershipDiscount=t.Discount,o.membershipuserid=t.UserID,o.membershipUniqueID=t.MembershipUniqueId,t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining-1,o.RedeemBusinessId=t.BusinessID,o.BusinessID=onlineShoppingCart.BusinessID,o.MembershipID=t.MembershipID,o.MembershipItemId=t.MembershipItemId,o.membershipName=t.MembershipName,o.GroupId=t.GroupId,o.VisitRemaining=t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(n,t),!1}if(1!=o.isMembershipApply)if(o.discount=0,o.isMembershipApply=!1,o.membershipDiscount=0,o.membershipUniqueID=null,1!=o.isPointApply&&(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)&&void 0!==o.PromotionID&&0!=o.PromotionID){var r=0;r=1==o.IsAmount?o.AmountValue:o.Originalprice*o.AmountValue/100,o.discount=r,o.Price=o.Originalprice-r,o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),o.actualPrice=o.Price,o.actualTaxprice=o.taxprice}else _onlineCheckout.isValidForCheckoutInvoice()&&1!=o.isPointApply&&(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)&&(o.discount=o.originalDiscount,o.Price=o.Originalprice-o.discount,o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),o.actualPrice=o.Price,o.actualTaxprice=o.taxprice)}),r.addonTotalPrice=_onlineCheckout.parseTodecimal(r.addonTotalPrice+o.Price,2),r.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(r.addonTotalTaxPrice+o.taxprice,2),o.gcId>0&&0==o.isPackage&&(r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+o.Price,2),o.classAddonGCUsed=_onlineCheckout.parseTodecimal(o.Price,2)),(o.gcId<0||o.gcId>0)&&1==o.isPackage&&(o.classAddonGCUsed=_onlineCheckout.parseTodecimal(o.Price,2))}),e.each(i.lstAddonService,function(e,t){r.addonDiscountprice+=t.discount})),r.addonDiscountprice=_onlineCheckout.parseTodecimal(r.addonDiscountprice,2)});var o=parseFloat((r.addonTotalPrice+r.addonTotalTaxPrice-r.addonTotalGCUsed).toFixed(2));r.addonTotalTaxPrice=parseFloat(r.addonTotalTaxPrice.toFixed(2)),r.addonTotalGCUsed=r.addonTotalGCUsed,r.addonDiscountprice=r.addonDiscountprice,r.FinalTotal=o}return r},_onlineCheckout.ApplyMembershipONEventsAddon=function(t,i){var a=e.grep(i,function(e){return e.ItemType==d.ClassAddons}),r={addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0,addonDiscountprice:0,addonFinalTotal:0};if(null!=a&&a.length>0){e.each(t,function(t,i){!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&(e.each(i.lstAddonService,function(t,o){var n=e.grep(a,function(e){return i.customerID>0&&e.UserID>0&&(i.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,i.customerID))||i.customerID<=0&&e.UserID>0&&i.cUserEmail==e.EmailId});e.each(n,function(e,t){if(t.ServiceProductName.toLowerCase().trim()==o.ServiceTitle.toLowerCase().trim()&&null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))>new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))&&null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))&&0==o.IsOutsideBilling&&0==o.IsWaivedApply&&(o.strAdvanceLimitDate=t.strAdvanceLimitDate,o.IsWaivedApply=!0,o.AppliedName=t.MembershipName),_onlineCheckout.isValidForCheckoutInvoice()&&(void 0!==o.isPresetApply&&1==o.isPresetApply&&0==t.IsAllowPreSetDiscount||0!=o.PromotionID&&0==t.isPromotionalDiscount))return!1;if(1==o.isMembershipRemove&&t.ServiceProductName.toLowerCase().trim()==o.ServiceTitle.toLowerCase().trim()&&t.Discount>0&&(i.customerID>0&&t.UserID>0&&(i.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,i.customerID))||i.customerID<=0&&t.UserID>0&&i.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining))return t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining>0?t.VisitRemaining-1:t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(n,t),1==o.isPointApply||!(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)||0==o.PromotionID&&1!=o.isPresetApply||(o.Price=o.Originalprice-o.discount,o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),o.actualPrice=o.Price,o.actualTaxprice=o.taxprice),!1;if(o.Price>0&&1!=o.isPointApply&&1!=o.isPackage&&(null==o.gcId||0==o.gcId)&&t.ServiceProductName.toLowerCase().trim()==o.ServiceTitle.toLowerCase().trim()&&t.Discount>0&&(i.customerID>0&&t.UserID>0&&(i.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,i.customerID))||i.customerID<=0&&t.UserID>0&&i.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)&&(1==_onlineCheckout.IsUpSellMemPkgAdd||"true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&(0!=o.PromotionID&&1==t.isPromotionalDiscount||0==o.PromotionID||void 0===o.PromotionID)&&0==o.isPaid&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(i.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))){var a=parseFloat(o.Originalprice);if(_onlineCheckout.isValidForCheckoutInvoice()){if(a=parseFloat(o.Originalprice),1==t.isPromotionalDiscount&&0!=o.PromotionID){var r=_onlineCheckout.GetMembershipDiscountAmount(o.Originalprice,t);o.discount=_onlineCheckout.parseTodecimal(o.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else if(void 0!==o.isPresetApply&&1==o.isPresetApply&&1==t.IsAllowPreSetDiscount){r=_onlineCheckout.GetMembershipDiscountAmount(o.Originalprice,t);o.discount=_onlineCheckout.parseTodecimal(o.discount,2)+_onlineCheckout.parseTodecimal(r,2)}else o.discount=0,o.discount=_onlineCheckout.GetMembershipDiscountAmount(o.Originalprice,t);o.Originalprice=a}else o.discount=o.discount+_onlineCheckout.GetMembershipDiscountAmount(o.Originalprice,t);return a<o.discount&&(o.discount=a),o.Price=_onlineCheckout.parseTodecimal(o.Originalprice-o.discount,2),a>0&&(o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,2)),o.isMembershipApply=!0,o.membershipDiscount=t.Discount,o.membershipUniqueID=t.MembershipUniqueId,o.membershipuserid=t.UserID,t.VisitRemaining=-1==t.VisitRemaining?t.VisitRemaining:t.VisitRemaining-1,o.RedeemBusinessId=t.BusinessID,o.BusinessID=onlineShoppingCart.BusinessID,o.MembershipID=t.MembershipID,o.MembershipItemId=t.MembershipItemId,o.membershipName=t.MembershipName,o.GroupId=t.GroupId,o.VisitRemaining=t.VisitRemaining,_onlineCheckout.SyncMembershipVisitRemaining(n,t),!1}if(1!=o.isMembershipApply&&0==o.isPaid)if(o.discount=0,o.isMembershipApply=!1,o.membershipDiscount=0,o.membershipUniqueID=null,1!=o.isPointApply&&(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)&&void 0!==o.PromotionID&&0!=o.PromotionID){var s=0;s=1==o.IsAmount?o.AmountValue:o.Originalprice*o.AmountValue/100,o.discount=s,o.Price=o.Originalprice-s,o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),o.actualPrice=o.Price,o.actualTaxprice=o.taxprice}else _onlineCheckout.isValidForCheckoutInvoice()&&1!=o.isPointApply&&(null==o.gcId||0==o.gcId||o.gcId>0&&0==o.isPackage)&&(o.discount=o.originalDiscount,o.Price=o.Originalprice-o.discount,o.taxprice=_onlineCheckout.parseTodecimal(o.Price*o.tax/100,3),o.actualPrice=o.Price,o.actualTaxprice=o.taxprice)}),o.BusinessTax=_onlineCheckout.ApplyMultipleTax(o.Price,o),r.addonTotalPrice=_onlineCheckout.parseTodecimal(r.addonTotalPrice+o.Price,2),r.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(r.addonTotalTaxPrice+o.taxprice,2),o.gcId>0&&0==o.isPackage&&(r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+o.Price,2))}),e.each(i.lstAddonService,function(e,t){r.addonDiscountprice+=t.discount})),r.addonDiscountprice=_onlineCheckout.parseTodecimal(r.addonDiscountprice,2)});var o=parseFloat((r.addonTotalPrice+r.addonTotalTaxPrice-r.addonTotalGCUsed).toFixed(2));r.addonTotalTaxPrice=parseFloat(r.addonTotalTaxPrice.toFixed(2)),r.addonTotalGCUsed=r.addonTotalGCUsed,r.addonDiscountprice=r.addonDiscountprice,r.addonFinalTotal=o}else e.each(t,function(e,t){if(!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0){var i=_onlineCheckout.GetAllAddonCalculationDetailsByEvent(t.lstAddonService);r.addonTotalPrice=r.addonTotalPrice+i.addonTotalPrice,r.addonTotalTaxPrice=r.addonTotalTaxPrice+i.addonTotalTaxPrice,r.addonTotalGCUsed=r.addonTotalGCUsed+i.addonTotalGCUsed,r.addonDiscountprice=r.addonDiscountprice+i.addonDiscountprice}});return r},_onlineCheckout.setClassAddonCheckoutData=function(t,i,a,r){if(null!=t&&t.length>0)for(var o=r,n=0;n<t.length;n++){var s=t[n];if(checkoutGridrow={},checkoutGridrow.uniqID=o+1,checkoutGridrow.userName="",checkoutGridrow.emailId=a.cUserEmail,checkoutGridrow.userID=null==a.tmpcustomerID?a.customerID:a.tmpcustomerID,checkoutGridrow.serviceProviderID=a.sPID,checkoutGridrow.itemID=s.ServiceId,checkoutGridrow.packageDetailId=String.isNullOrUndefineOrBlank(s.gcId)?0:s.gcId,checkoutGridrow.itemName=s.ServiceTitle,checkoutGridrow.pointsGained=s.PointGiven,checkoutGridrow.pointsRedeem=s.pointsRedeem,checkoutGridrow.recordType=d.ClassAddons,checkoutGridrow.barcodeID=C,checkoutGridrow.FmbFee=s.dailydealFee,checkoutGridrow.FMBPercentage=s.FMBPercentage,checkoutGridrow.DealBookingType=_onlineCheckout.GetDealBookingType(s.dailydealFee,s.FMBPercentage),checkoutGridrow.price=void 0!==s.isPointApply&&s.isPointApply?s.Originalprice:parseFloat(String.isNullOrUndefineOrBlank(s.Price)?0:s.Price)+parseFloat(String.isNullOrUndefineOrBlank(s.discount)?0:s.discount),checkoutGridrow.discount=String.isNullOrUndefineOrBlank(s.discount)?0:s.discount,checkoutGridrow.discountedPrice=void 0!==s.isPointApply&&s.isPointApply?s.Originalprice:s.Price,void 0!==s.dailydealFee&&null!=s.dailydealFee&&Number(s.dailydealFee)>0&&(checkoutGridrow.price=Math.max(0,checkoutGridrow.price-s.dailydealFee),checkoutGridrow.discountedPrice=Math.max(0,checkoutGridrow.discountedPrice-s.dailydealFee)),checkoutGridrow.quantity=1,checkoutGridrow.packageAssignStatus=void 0!==s.isPackage&&s.isPackage?1:0,checkoutGridrow.pointAssignStatus=void 0!==s.isPointApply&&s.isPointApply?1:0,checkoutGridrow.appointmentDate=a.eventDate,checkoutGridrow.appointmentID=a.appointmentID,checkoutGridrow.appointmentTime=a.startTime,checkoutGridrow.serviceProviderName=a.sPName,checkoutGridrow.startTime=a.startTime,checkoutGridrow.originalServicePriceForPackage=s.Originalprice,checkoutGridrow.businessPackageID=0,checkoutGridrow.PromotionID=s.PromotionID,checkoutGridrow.ConstantOriginalServicePrice=s.Originalprice,_onlineCheckout.isValidForCheckoutInvoice()&&(checkoutGridrow.parentAppointmentID=s.parentAppointmentID,checkoutGridrow.sessionAttendeeID=s.sessionAttendeeID),checkoutGridrow.membershipDiscount=String.isNullOrUndefineOrBlank(s.membershipDiscount)?0:s.membershipDiscount,s.isMembershipApply){var l={};l.BusinessID=a.BusinessID,l.RedeemBusinessId=a.RedeemBusinessId,l.UserID=a.customerID,l.MembershipID=s.MembershipID,l.MembershipItemId=s.MembershipItemId,l.ItemType=20,l.VisitUsed=1,l.Type=2,l.GroupId=s.GroupId,l.ServiceProductName=s.ServiceTitle,checkoutGridrow.MembershipRedeemedDetails=l}if(s.isPackage?(objGC={},objGC.giftcertificateId=s.gcId,objGC.serviceId=s.ServiceId,objGC.redeemAmt=s.redeemAmt,objGC.RedeemServiceId=s.RedeemServiceId,objGC.uniqID=checkoutGridrow.uniqID,objGC.AppointmentID=a.appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,onlineShoppingCart.RedeemedByGC.push(objGC)):!String.isNullOrUndefineOrBlank(s.gcId)&&s.gcId>0&&(objGC={},objGC.giftcertificateId=s.gcId,objGC.serviceId=s.ServiceId,null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(e){e.giftCertificateID==s.gcId&&null!=e.Taxes&&(a.redeemTax=0,s.TaxValue="0",s.taxprice=0)}),objGC.redeemAmt=s.redeemAmt+(String.isNullOrUndefineOrBlank(s.redeemTax)?0:s.redeemTax),objGC.RedeemServiceId=s.RedeemServiceId,objGC.uniqID=checkoutGridrow.uniqID,objGC.AppointmentID=a.appointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,objGC.serviceId>0&&objGC.giftcertificateId>0&&onlineShoppingCart.RedeemedByGC.push(objGC)),checkoutGridrow.calculatedTax=_onlineCheckout.parseTodecimal(s.taxprice,3),checkoutGridrow.BusinessTax=s.BusinessTax,checkoutGridrow.DiscountID=s.DiscountID,checkoutGridrow.DiscountType=_onlineCheckout.isValidForCheckoutInvoice()?String.isNullOrUndefineOrBlank(s.DiscountType)?1==s.IsAmount?2:1:s.DiscountType:1==s.IsAmount?2:1,checkoutGridrow.AmountValue=s.AmountValue,s.isPaid&&(s.paidType==_onlineCheckout.arrpaidType.Deposits&&(checkoutGridrow.price=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(s.payableAmount,2)-_onlineCheckout.parseTodecimal(s.deposit,2),2)),checkoutGridrow.isPaid=s.isPaid,checkoutGridrow.paidType=s.paidType,checkoutGridrow.DiscountID=0,checkoutGridrow.PromotionID=0),(s.paidType==_onlineCheckout.arrpaidType.PaidClass||s.paidType==_onlineCheckout.arrpaidType.Paid)&&onlineShoppingCart.tipPercent>0){_onlineCheckout.TipApplyCounter=++_onlineCheckout.TipApplyCounter;var c=_onlineCheckout.parseTodecimal(s.Price,2);(1==s.isPackage||1==s.isPointApply||s.isMembershipApply)&&(c=_onlineCheckout.parseTodecimal(s.Originalprice,2));var u=0;u=_onlineCheckout.TipApplyCounter==_onlineCheckout.TotalPaidCount||0==c?_onlineCheckout.parseTodecimal(onlineShoppingCart.tipValue-_onlineCheckout.TipAppliedSum,2):_onlineCheckout.parseTodecimal(c*onlineShoppingCart.tipPercent/100,2),checkoutGridrow.calculatedTip=u,_onlineCheckout.TipAppliedSum+=u}s.paidType!=_onlineCheckout.arrpaidType.OfflineDeposit&&s.paidType!=_onlineCheckout.arrpaidType.OfflineDepositPrepay&&s.paidType!=_onlineCheckout.arrpaidType.DepositsClass||(checkoutGridrow.payableAmount=_onlineCheckout.parseTodecimal(s.payableAmount,2),"undefined"==s.depositsRemaining||null==s.depositsRemaining||isNaN(s.depositsRemaining)?checkoutGridrow.DepositsRemaining=0:checkoutGridrow.DepositsRemaining=_onlineCheckout.parseTodecimal(s.depositsRemaining,2),"undefined"==s.depositsPaid||null==s.depositsPaid||isNaN(s.depositsPaid)?checkoutGridrow.DepositsPaid=0:s.IsPartialPoint&&!s.IsDepositsOver?checkoutGridrow.DepositsPaid=_onlineCheckout.parseTodecimal(s.depositsPaid+s.PartialPrice,2):checkoutGridrow.DepositsPaid=_onlineCheckout.parseTodecimal(s.depositsPaid,2),checkoutGridrow.depositsPercentage=_onlineCheckout.parseTodecimal(s.depositsPercentage,3),checkoutGridrow.paidType=s.paidType,s.paidType!=_onlineCheckout.arrpaidType.OfflineDepositPrepay&&(checkoutGridrow.calculatedTax=0,checkoutGridrow.BusinessTax=null)),1==s.IsPartialPoint&&(checkoutGridrow.payableAmount=s.IsPartialDeposits?s.Price-s.PartialPrice:s.Price),checkoutGridrow.calculatedTaxTypeWise="[]",String.isNullOrUndefineOrBlank(s.BusinessTax)||(checkoutGridrow.calculatedTaxTypeWise=String.isNullOrUndefineOrBlank(s.BusinessTax)?"[]":JSON.stringify(s.BusinessTax)),checkoutGridrow.taxes=s.TaxValue,9==s.OriginalpaidType&&(checkoutGridrow.paidType=s.OriginalpaidType,checkoutGridrow.IsChargeFee=s.IsChargeFee),"undefined"==typeof _common||String.isNullOrUndefineOrBlank(_common.IsWidgetForServiceProvider)?checkoutGridrow.WidgetSpId=null:checkoutGridrow.WidgetSpId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,"undefined"==typeof hdnPriceWithTaxSwitch||null!=hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)||(checkoutGridrow.IsIncludeTaxInOnlinePricing=!0),void 0!==s.dailydealFee&&null!=s.dailydealFee&&Number(s.dailydealFee)>0&&(checkoutGridrow.dailydealFee=s.dailydealFee),i.push(checkoutGridrow)}return o},_onlineCheckout.UpdateAttendeeSelectionOnAddonPopup=function(t){e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").html(e(t).find("div.ffshipping-bg").html()),e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-value",e(t).find("div.ffshipping-bg").data("value")),e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-email",e(t).find("div.ffshipping-bg").data("email")),e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-cell",e(t).find("div.ffshipping-bg").data("cell")),e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-cellcountryid",e(t).find("div.ffshipping-bg").data("cellcountryid")),e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-fullname",e(t).find("div.ffshipping-bg").data("fullname")),e(t).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-cellcountryid",e(t).find("div.ffshipping-bg").data("cellcountryid")),e(t).closest("div.panel-default").attr("data-value",e(t).find("div.ffshipping-bg").data("value")),e(t).closest("div.panel-default").attr("data-email",e(t).find("div.ffshipping-bg").data("email")),e(t).closest("div.panel-default").attr("data-cell",e(t).find("div.ffshipping-bg").data("cell")),e(t).closest("div.panel-default").attr("data-cellcountryid",e(t).find("div.ffshipping-bg").data("cellcountryid")),e(t).closest("div.panel-default").attr("data-fullname",e(t).find("div.ffshipping-bg").data("fullname")),e(t).closest("div.collapse").collapse("hide")},_onlineCheckout.AddToCartSuggestUpsellClick=function(t,i,a,r,o,n,s,l,d,c,u,p,h,m,f){if(_onlineCheckout.IsUpSellMemPkgAdd=1,1==i)if(null!=onlineShoppingCartmain.Memberships&&onlineShoppingCartmain.Memberships.length>0){if(onlineShoppingCartmain.Memberships[0].MembershipId==t)return!0;_onlineCheckout.SuccessMembershipUpsellClick(t,!0),setTimeout(function(){e("#tabVagaroPayLater").hide()},100)}else _onlineCheckout.SuccessMembershipUpsellClick(t,!0),setTimeout(function(){e("#tabVagaroPayLater").hide()},100);if(1==a){if(null!=onlineShoppingCartmain.Packages&&onlineShoppingCartmain.Packages.length>0){var g=e.grep(onlineShoppingCartmain.Packages,function(e){return e.ServiceId==t&&4==e.eventType});return null!=g&&g.length>0||(message="A pacakge already exists in your cart, would you like to replace it?",swal({html:!0,title:message,text:"",type:"",showCancelButton:!0,confirmButtonText:"Replace Package",cancelButtonText:"No",closeOnCancel:!0},function(i){i&&(_onlineCheckout.RemoveMembersipPackageCartItems(onlineShoppingCart.BusinessID,onlineShoppingCart.loginUserId,"PackageUpSell",1),onlineShoppingCartmain.Packages=e.grep(onlineShoppingCartmain.Packages,function(e){return 4!=e.eventType}),_onlineCheckout.SuccessPackageUpsellClick(t,!0))}),void setTimeout(function(){e(".gencutom-title").html("Multiple Package in Cart")},100))}_onlineCheckout.SuccessPackageUpsellClick(t,!0)}},_onlineCheckout.SuccessMembershipUpsellClick=function(t,i){null==onlineShoppingCartmain.Memberships&&(onlineShoppingCartmain.Memberships=[]);var a=e.extend(!0,[],_shopdetail.MembershipPackageUpSell.MembershipUpSellData),r=e.grep(a,function(e){return e.IsUpsell=!0,e.MembershipUniqueId=e.MembershipID+"~UMD",e.MembershipID==t});if(void 0!==r&&null!=r&&r.length>0&&void 0!==r[0].IsRecurring&&null!=r[0].IsRecurring&&1==r[0].IsRecurring&&(_onlineCheckout.IsRecurringMembership=!0,e("#tabVagaroPayLater").data("IsFromUpsell",!0),_shopdetail.ResetVPLPaymentMethod(!0,!0)),1==i&&(_onlineCheckout.setSuggestUpsellMembershipsData(r,onlineShoppingCartmain.Memberships,2),null!=r&&r.length>0)){var o=r[0].PromotionDetail,n=r[0].PromotionTitle,s=!1,l=0,d=!1,c=0;String.isNullOrUndefineOrBlank(o)||String.isNullOrUndefineOrBlank(n)?(s=r[0].IsInitialDiscount,l=r[0].InitialDiscount,d=r[0].IsAmount,c=r[0].BillingCycle):c=r[0].BillingCycle,_onlineCheckout.SuggestUpsellMembershipAddToCart(onlineShoppingCart.BusinessID,t,"true",0,!1,o,n,s,l,d,c)}lstCheckoutMembershipDetail=[],e.extend(lstCheckoutMembershipDetail,r);var u=e.extend(!0,[],onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail);u.lstMembershipForCheckout.push.apply(u.lstMembershipForCheckout,lstCheckoutMembershipDetail),_onlineCheckout.ApplyDiscounts(u.lstGcAndPackagesForCheckout,u.lstUserListForCheckout,u.lstMembershipForCheckout,u.IsPromotionEnable),_onlineCheckout.DisplaySelectionInUpsellItem(1,t),_onlineCheckout.IsVCFEnable()&&1==i&&setTimeout(function(){_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.MembershipUpSell)},1e3),ShowLoader(!1)},_onlineCheckout.GetPackageId=function(t){if(null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0){var i=e.grep(onlineShoppingCart.Packages,function(e){return e.GCUpdatePendingID==t});if(null!=i&&i.length>0)return i[0].SellPackageServiceID}return 0},_onlineCheckout.SuccessPackageUpsellClick=function(t,i){null==onlineShoppingCartmain.Packages&&(onlineShoppingCartmain.Packages=[]);var a=e.extend(!0,[],_shopdetail.MembershipPackageUpSell.PackageUpSellData),r=e.grep(a,function(e){return e.ServiceId==t});void 0!==r&&null!=r&&r.length>0&&void 0!==r[0].IsRecurring&&null!=r[0].IsRecurring&&1==r[0].IsRecurring&&(_onlineCheckout.IsRecurringPkg,e("#tabVagaroPayLater").data("IsFromUpsell",!0),_shopdetail.ResetVPLPaymentMethod(!0,!0)),1==i?(_onlineCheckout.setSuggestUpsellPackageData(r,onlineShoppingCartmain.Packages,2),_onlineCheckout.SuggestUpsellServiceAddToCart(onlineShoppingCart.BusinessID,t,0,!0,"","",!1,0,!1,"0")):null!=r&&r.length>0&&e.grep(onlineShoppingCartmain.Packages,function(t,i){r[0].ServiceId==t.ServiceId&&4==t.eventType&&(t.lstPackageForCheckout=String.isNullOrUndefineOrBlank(r[0].PackageJSON)?[]:JSON.parse(r[0].PackageJSON),null!=t.lstPackageForCheckout&&t.lstPackageForCheckout.length>0&&(t.lstPackageForCheckout=e.grep(t.lstPackageForCheckout,function(e){return 1==e.isPackage&&(e.isPackage=!0),1==e.isCustomPackage&&(e.isCustomPackage=!0),e})),t.GCUpdatePendingID=!String.isNullOrUndefineOrBlank(t.lstPackageForCheckout)&&t.lstPackageForCheckout.length>0?t.lstPackageForCheckout[0].giftCertificateID:0)}),lstCheckoutPackageDetail=_shopdetail.createGCPackageForPackageUpSellItem(2);var o=e.extend(!0,[],onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail);o.lstGcAndPackagesForCheckout.push.apply(o.lstGcAndPackagesForCheckout,lstCheckoutPackageDetail),_onlineCheckout.ApplyDiscounts(o.lstGcAndPackagesForCheckout,o.lstUserListForCheckout,o.lstMembershipForCheckout,o.IsPromotionEnable),_onlineCheckout.DisplaySelectionInUpsellItem(2,t),_onlineCheckout.IsVCFEnable()&&1==i&&setTimeout(function(){_onlineCheckout.RemoveVCFFee(),_onlineCheckout.VCFAmountDistribution(_onlineCheckout.ApplyVCFLocation.PackageUpSell)},1e3),ShowLoader(!1)},_onlineCheckout.CheckCartItems=function(){null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(e){_onlineCheckout.SuccessMembershipUpsellClick(e.MembershipId,!1)}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(e){4==e.eventType&&_onlineCheckout.SuccessPackageUpsellClick(e.ServiceId,!1)}),e("#divSuggestUpsell").find(".vg-filter-mobile-tab.segment-tab-middle.package.w--current").length<=0&&1!=e("#divSuggestUpsell").find(".vg-filter-mobile-tab.segment-tab-middle.membership.w--current").length&&e("#divSuggestUpsell").find(".vg-switch-tab-first").addClass("w--current")},_onlineCheckout.IsCheckMemPkgUpsellExists=function(t,i){if(1==t){if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0){var a=e.grep(onlineShoppingCart.Memberships,function(e){return i==e.MembershipId});return null!=a&&a.length>0}return!1}return!0},_onlineCheckout.DisplaySelectionInUpsellItem=function(t,i){1==t&&(e("#Nothanks").removeClass("w--current"),e("#divSuggestUpsell").find(".membership").removeClass("w--current"),e("#M_"+i).addClass("w--current")),2==t&&(e("#Nothanks").removeClass("w--current"),e("#divSuggestUpsell").find(".package").removeClass("w--current"),e("#P_"+i).addClass("w--current"))},_onlineCheckout.CheckCartTotalAmt=function(){var t=0;return null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&e.grep(onlineShoppingCart.Memberships,function(e){t=_shopdetail.parseTodecimal(t,2)+_onlineCheckout.parseTodecimal(e.ActualPrice,2)}),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&e.grep(onlineShoppingCart.Packages,function(e){4==e.eventType&&(t=_shopdetail.parseTodecimal(t,2)+_onlineCheckout.parseTodecimal(e.ActualPrice,2))}),t},_onlineCheckout.ApplyDailyDealONEventsAddon=function(t){var i={addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0,addonDiscountprice:0};return null!=t&&t.length>0&&e.each(t,function(e,t){var a=t.Price;if(_onlineCheckout.isValidForCheckoutInvoice()&&(a=t.actualPrice),t.discount=0,(1!=t.isPointApply||t.IsPartialPoint)&&(t.isPointApply&&t.IsPartialPoint?t.IsPartialPoint&&1==_onlineCheckout.isValidForCheckoutInvoice()?void 0!==t.depositsPercentage&&!String.isNullOrUndefineOrBlank(t.depositsPercentage)&&t.depositsPercentage<100?t.Price=a:t.Price=t.actualPrice:t.IsPartialPoint&&"undefined"!=typeof onlineShoppingCartmain&&void 0!==onlineShoppingCartmain.DepositsPer&&onlineShoppingCartmain.DepositsPer<100&&(t.Price=t.actualPrice):t.Price=a,null!=t.gcId&&(t.gcId>0||t.gcId<0&&1==t.isPackage)&&(t.Price=t.actualPrice),a>0&&(t.isPointApply&&t.IsPartialPoint?t.taxprice=_onlineCheckout.parseTodecimal(a*t.tax/100,3):t.taxprice=_onlineCheckout.parseTodecimal(t.Price*t.taxprice/a,2)),!_onlineCheckout.isValidForCheckoutInvoice()||0!=t.isPackage&&null!=t.isPackage||(t.discount=t.discount,t.Price=a-t.discount,t.actualPrice=t.Price,t.actualTaxprice=t.taxprice),(null==t.gcId||0==t.gcId||t.gcId>0&&0==t.isPackage)&&void 0!==t.PromotionID&&0!=t.PromotionID&&0==t.isPaid)){var r=getCookie("Referral");if(void 0===r||""==r||null==r||null==r)if(null==t.IsDailyDealApply||t.IsDailyDealApply)t.PromotionID=0;else if(t.Price>0){var o=0;1==t.IsAmount?(o=t.AmountValue,void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(o=parseFloat(ConvertTodecimalMorePrecious(parseFloat(o)/(1+t.tax/100),!0,4)))):o=_onlineCheckout.parseTodecimal(a*t.AmountValue/100,2),t.Originalprice<o&&(o=t.Originalprice),t.discount=o,t.isPointApply&&t.IsPartialPoint?t.Price=t.actualPrice-o:t.Price=a-o,t.taxprice=_onlineCheckout.parseTodecimal(t.Price*t.tax/100,3),t.actualPrice=t.Price,t.actualTaxprice=t.taxprice}else t.PromotionID=0;else if(t.Price>0){o=0;o=1==t.IsAmount?t.AmountValue:_onlineCheckout.parseTodecimal(a*t.AmountValue/100,2),t.Originalprice<o&&(o=t.Originalprice),t.discount=o,t.isPointApply&&t.IsPartialPoint?t.Price=t.actualPrice-o:t.Price=a-o,t.taxprice=_onlineCheckout.parseTodecimal(t.Price*t.tax/100,3),t.actualPrice=t.Price,t.actualTaxprice=t.taxprice}else t.PromotionID=0}i.addonDiscountprice=_onlineCheckout.parseTodecimal(i.addonDiscountprice+t.discount,2),t.isPointApply&&t.IsPartialPoint?(t.BusinessTax=_onlineCheckout.ApplyMultipleTax(a,t),i.addonTotalPrice=_onlineCheckout.parseTodecimal(i.addonTotalPrice+t.Price,2)):(t.BusinessTax=_onlineCheckout.ApplyMultipleTax(t.Price,t),i.addonTotalPrice=_onlineCheckout.parseTodecimal(i.addonTotalPrice+t.Price,2)),i.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(i.addonTotalTaxPrice+t.taxprice,2),t.gcId>0&&0==t.isPackage&&(i.addonTotalGCUsed=_onlineCheckout.parseTodecimal(i.addonTotalGCUsed+t.Price,2)),(t.gcId<0||t.gcId>0)&&1==t.isPackage&&(t.classAddonGCUsed=_onlineCheckout.parseTodecimal(t.Price,2))}),i},_onlineCheckout.ApplyPriceBaseGCOnEventsAddon=function(t,i,a){var r={addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0};if(i.length>0){var o=e.grep(i,function(e){return 1==e.eventType&&null==e.quantity&&e.currentBalance>0});if(null!=o&&o.length>0){o.keySort({serviceID:"desc",GiftCertificateAmt:"asc"})}if(o.length>0){if(e.each(t,function(t,i){!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.each(i.lstAddonService,function(t,n){if(n.isPriceBaseGCApply=!1,n.paidType==_onlineCheckout.arrpaidType.PaidClass||n.paidType==_onlineCheckout.arrpaidType.DepositsClass||1==a||_onlineCheckout.isValidForCheckoutInvoice()){var s=e.grep(o,function(e){return i.customerID>0&&e.assignTo>=0||i.customerID<=0&&e.assignTo>=0&&(i.cUserEmail==e.emailId||0==e.assignTo)});if((1!=n.isPointApply||1==n.IsPartialPoint)&&1!=n.isPackage&&(1==a||"true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())){var l=0,d=0;l=parseFloat(n.Price),d=parseFloat(n.taxprice),n.paidType==_onlineCheckout.arrpaidType.DepositsClass&&(l=n.depositsPaid,d=0,1==n.IsPartialPoint&&(l=0==n.IsDepositsOver?n.depositsPaid:n.depositsPaid-n.PartialPrice)),n.RemainingPrice=parseFloat(l),n.RemainingTax=parseFloat(d),null!=onlineShoppingCart.lstGCPkgData&&onlineShoppingCart.lstGCPkgData.length>0&&e.grep(onlineShoppingCart.lstGCPkgData,function(e){e.giftCertificateID==n.gcId&&null!=e.Taxes&&(n.RemainingTax=0)}),n.GCDetail=[],n.redeemAmt=0,n.redeemTax=0,e.grep(s,function(e){if((null==n.gcId||0==n.gcId)&&n.RemainingPrice>0&&e.currentBalance>0)if(e.currentBalance>=n.RemainingPrice){n.isPriceBaseGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=n.RemainingPrice,objGC.giftCertificateNo=e.giftCertificateNo,objGC.IsClass=!0,n.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),n.gcId=e.giftCertificateID,n.redeemAmt=_onlineCheckout.parseTodecimal(n.redeemAmt+n.RemainingPrice,2),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-n.RemainingPrice,2),n.RemainingPrice=0;var t=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==n.gcId});String.isNullOrUndefineOrBlank(t)||(t[0].currentBalance=e.currentBalance)}else if(n.RemainingPrice>e.currentBalance&&e.currentBalance>0){n.isPriceBaseGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=e.currentBalance,objGC.giftCertificateNo=e.giftCertificateNo,objGC.IsClass=!0,n.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),n.gcId=e.giftCertificateID,n.redeemAmt=_onlineCheckout.parseTodecimal(n.redeemAmt+e.currentBalance,2),n.RemainingPrice=_onlineCheckout.parseTodecimal(n.RemainingPrice-e.currentBalance,2),e.currentBalance=0;t=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==n.gcId});String.isNullOrUndefineOrBlank(t)||(t[0].currentBalance=e.currentBalance)}n.RemainingTax>0&&e.currentBalance>0&&(n.RemainingTax=_onlineCheckout.parseTodecimal(n.RemainingTax,3),e.currentBalance>=n.RemainingTax?(n.isPriceBaseGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=n.RemainingTax,objGC.giftCertificateNo=e.giftCertificateNo,n.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),objGC.IsClass=!0,n.redeemTax=_onlineCheckout.parseTodecimal(n.redeemTax+n.RemainingTax,2),e.currentBalance=_onlineCheckout.parseTodecimal(e.currentBalance-n.RemainingTax,2),n.RemainingTax=0):n.RemainingTax>e.currentBalance&&e.currentBalance>0&&(n.isPriceBaseGCApply=!0,objGC={},objGC.GCId=e.giftCertificateID,objGC.GCAmount=e.currentBalance,objGC.giftCertificateNo=e.giftCertificateNo,n.GCDetail.push(objGC),onlineShoppingCart.RedeemedByGCtemp.push(objGC),objGC.IsClass=!0,n.redeemTax=_onlineCheckout.parseTodecimal(n.redeemTax+e.currentBalance,2),n.RemainingTax=_onlineCheckout.parseTodecimal(n.RemainingTax-e.currentBalance,2),e.currentBalance=0))})}}n.BusinessTax=_onlineCheckout.ApplyMultipleTax(n.Price,n),r.addonTotalPrice=_onlineCheckout.parseTodecimal(r.addonTotalPrice+n.Price,2),r.addonTotalTaxPrice=_onlineCheckout.parseTodecimal(r.addonTotalTaxPrice+n.taxprice,2),n.gcId>0&&0==n.isPackage?r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+n.Price+n.redeemTax,2):(n.gcId<0||n.gcId>0)&&1==n.isPackage?r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+n.Price,2):1==n.isPriceBaseGCApply&&(r.addonTotalGCUsed=_onlineCheckout.parseTodecimal(r.addonTotalGCUsed+n.redeemAmt+n.redeemTax,2),n.classAddonGCUsed=_onlineCheckout.parseTodecimal(n.redeemAmt+n.redeemTax,2))})}),_onlineCheckout.isValidForCheckoutInvoice()&&onlineShoppingCart.RedeemedByGCtemp.length>0){onlineShoppingCart.RedeemedByGC=[];var n=onlineShoppingCart.RedeemedByGCtemp.uniqueObjects(["GCId"]);e.grep(n,function(t){_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg==t.Type?(objGC={},objGC.giftcertificateId=t.giftcertificateId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.RedeemServiceId=t.serviceId,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg,e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),onlineShoppingCart.RedeemedByGC.push(objGC)):_onlineCheckout.CheckoutBarcodeCodePrepayOnline.srvcGC==t.Type?(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=t.serviceId,objGC.redeemAmt=0,objGC.uniqID=t.uniqID,objGC.RedeemServiceId=t.serviceId,objGC.AppointmentID=t.AppointmentID,objGC.Type=_onlineCheckout.CheckoutBarcodeCodePrepayOnline.GC,e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.redeemAmt,2))}),objGC.GCredeemAmtForDisc=objGC.redeemAmt,onlineShoppingCart.RedeemedByGC.push(objGC)):(objGC={},objGC.giftcertificateId=t.GCId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=0,objGC.redeemAmt=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type="GC",e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){t.GCId==e.GCId&&(objGC.redeemAmt=_onlineCheckout.parseTodecimal(objGC.redeemAmt+e.GCAmount,2))}),onlineShoppingCart.RedeemedByGC.push(objGC))})}r.addonTotalTaxPrice=parseFloat(r.addonTotalTaxPrice.toFixed(2)),r.addonTotalGCUsed=r.addonTotalGCUsed,r.addonTotalPrice=r.addonTotalPrice}}return r},_onlineCheckout.CheckUserExistanceWhenAddonUpdate=function(t,i,a,r){var o=!1;return e.grep(a.eventEnrollment,function(e){return new Date(e.eventDate).format("yyyy-MM-dd")==new Date(r.eventDate).format("yyyy-MM-dd")&&(1==e.hasOwnProperty("isTempData")&&1!=e.isTempData||0==e.hasOwnProperty("isTempData"))&&e.startTime==r.startTime&&e.eventID==r.eventID&&e.sPID==r.sPID&&(t>0&&e.customerID==t||t<=0&&void 0!==e.cUserEmail&&null!=e.cUserEmail&&e.cUserEmail.toLowerCase()==i.toLowerCase())}).length>0&&(o=!0),o},_onlineCheckout.GetAllAddonCalculationDetailsByEvent=function(t){var i={addonTotalPrice:0,addonTotalTaxPrice:0,addonTotalGCUsed:0,addonDiscountprice:0};return!String.isNullOrUndefineOrBlank(t)&&t.length>0&&e.each(t,function(e,t){i.addonTotalPrice=i.addonTotalPrice+t.Price,i.addonTotalTaxPrice=i.addonTotalTaxPrice+t.taxprice,i.addonDiscountprice=i.addonDiscountprice+t.discount}),i},_onlineCheckout.SetAppointmentIdOfSelectedAddonService=function(t,i){String.isNullOrUndefineOrBlank(t)||e.grep(t,function(t){if(String.isNullOrUndefineOrBlank(ReschedualAddonService))t.AppointmentID=0,t.ParentAppointmentID=0;else{var a=e.grep(ReschedualAddonService,function(e){return e.EventServiceID==1*i.ServiceID&&e.ServiceId==t.ServiceId&&e.ServiceProviderID==i.ServiceProviderID});a.length>0?(a[0].Status=11,t.AppointmentID=1*a[0].AppointmentID,t.ParentAppointmentID=1*i.AppointmentID):(t.AppointmentID=0,t.ParentAppointmentID=0)}})},_onlineCheckout.getiOSCustomerAppVersion=function(){var e=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"",t="";return String.isNullOrUndefineOrBlank(e)||(t=e.split("(vagaroapp")[1].trim().split(")")[0]),t},_onlineCheckout.RecalcGCONAllAddonItems=function(t){e.grep(t,function(t){String.isNullOrUndefineOrBlank(t.lstAddonService)||e.grep(t.lstAddonService,function(e){_onlineCheckout.SDValueIfPropUndefined(e,"redeemAmt",0),_onlineCheckout.SDValueIfPropUndefined(e,"redeemTax",0),onlineShoppingCart.discount=_onlineCheckout.parseTodecimal(onlineShoppingCart.discount+e.discount,2),1!=e.isPointApply&&((e.isGCApply=null!=e.GCDetail&&e.GCDetail.length>0)&&(onlineShoppingCart.RedeemedByGCtemp=onlineShoppingCart.RedeemedByGCtemp.concat(e.GCDetail)),onlineShoppingCart.ccAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.ccAmt+(e.Price+_onlineCheckout.parseTodecimal(e.taxprice,3))-(e.redeemAmt+e.redeemTax),3),onlineShoppingCart.amtPaid=_onlineCheckout.parseTodecimal(onlineShoppingCart.amtPaid+(e.Price+_onlineCheckout.parseTodecimal(e.taxprice,3)),3),onlineShoppingCart.tax=_onlineCheckout.parseTodecimal(onlineShoppingCart.tax+e.taxprice,2),onlineShoppingCart.Rtax=_onlineCheckout.parseTodecimal(onlineShoppingCart.Rtax+e.taxprice,3),onlineShoppingCart.gcAmt=_onlineCheckout.parseTodecimal(onlineShoppingCart.gcAmt+e.redeemAmt+e.redeemTax,2))})})},_onlineCheckout.SDValueIfPropUndefined=function(e,t,i){String.isNullOrUndefineOrBlank(e[t])&&(e[t]=i)},_onlineCheckout.ApplyPresetDiscountOnAddOnPackages=function(t,i,a,r){var o=!1;return e.grep(i,function(i){if(null!=r&&i.autoId+"0"==r.autoId.toString()+r.EnrollAutoID.toString()||null==r){var n=e.grep(a,function(e){return e.ServiceID==i.ServiceId&&3==e.ItemTypeID&&4==i.eventType||e.ServiceID==i.ServiceId&&19==e.ItemTypeID}),s=e.grep(onlineShoppingCartmain.Packages,function(e){return e.autoId==t.autoId}),l=e.grep(s[0].lstAddonService,function(e){return e.ServiceId==i.ServiceId});if(null!=n&&n.length>0){n=n[0];var d=l[0].Price,c=0;0!=i.PromotionID&&(i.PromotionID=0),0==n.IsAmount?c=_onlineCheckout.parseTodecimal(c+d*n.DiscountValue/100,2):(c=_onlineCheckout.parseTodecimal(c+n.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(c=parseFloat(ConvertTodecimalMorePrecious(parseFloat(c)/(1+i.tax/100),!0,4))));var u=t.NoOfVisit;t.SellPackageServiceID>0&&(u=1),d-c<0&&(c=d),i.discount=null!=r?c:c*u,i.Price=_onlineCheckout.parseTodecimal(d*u-i.discount,2),i.ActualPrice=i.Price,i.calculatedTax=_onlineCheckout.parseTodecimal(i.Price*i.tax/100,3),i.ActualTax=i.calculatedTax,i.BusinessTax=_onlineCheckout.ApplyMultipleTax(i.Price,i),i.isPresetApply=!0,i.DiscountID=n.PromotionID,i.IsAmount=n.IsAmount,i.AmountValue=n.DiscountValue,1==i.IsRecurring&&(i.BillingCycle=n.BillingCycle,i.IsInitialDiscount=!1,i.InitialDiscount=0,i.IsAmountForInitialDiscount=!1),o=!0}}}),o},_onlineCheckout.IsVagaroDailDeal=function(){return!String.isNullOrUndefineOrBlank(document.referrer)&&!String.isNullOrUndefineOrBlank(document.location.origin)&&document.referrer.indexOf(document.location.origin)>=0&&document.referrer.indexOf("isdeal")>0},_onlineCheckout.CheckPromotionDetail=function(t,i){if(null!=PromotionDetails&&PromotionDetails.length>0)return e.grep(PromotionDetails,function(e){if(e.PromotionID==i)return 1==_onlineCheckout.CheckFileType(t.toString(),e.ServiceIDs)}).length>0},_onlineCheckout.CheckFileType=function(t,i){return"-1"==i||-1!==e.inArray(t,i.split(","))},_onlineCheckout.IsVCFEnable=function(){var e=_onlineCheckout.parseTodecimal(onlineShoppingCart.FinalCCAmount,2);return 1==onlineShoppingCartmain.IsEnableVCFFee&&e>0&&1==_onlineCheckout.IsValidatePrepayVCFFee()},_onlineCheckout.VCFAmountDistribution=function(t){var i=null;if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0||_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0||!_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&"true"!=isCCRequiredForOnlineClass.toLowerCase()&&"true"==IsCCCapturedAllowed.toLowerCase()&&null!=AllowCCCapturedAbove&&""!=AllowCCCapturedAbove&&_onlineCheckout.loginUserClassCheckoutAmount()>=parseFloat(AllowCCCapturedAbove)&&("false"==IsClassReschedule.toLowerCase()||"true"==IsClassReschedule.toLowerCase()&&(void 0===IsPaid||"false"==IsPaid.toString().toLowerCase()))||1==_onlineCheckout.isCheckoutVPLChanged||null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0){isCheckout=!0,i={},"undefined"==typeof vui||String.isNullOrUndefineOrBlank(vui.stripeRadarSession)||(i.StripeRadarSession=vui.stripeRadarSession),_onlineCheckout.isValidForCheckoutInvoice()?(i.ccAmt=parseFloat(onlineShoppingCart.ccAmt)+parseFloat(onlineShoppingCart.classFinalTotal)+parseFloat(onlineShoppingCart.tipValue)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining+onlineShoppingCart.DepositsRemaining+onlineShoppingCart.FeeDepositsRemaining),i.tax=parseFloat(onlineShoppingCart.tax)+parseFloat(onlineShoppingCart.classTax)+parseFloat(1==String.isNullOrUndefineOrBlank(onlineShoppingCart.classAddonTotalTaxPrice)?0:onlineShoppingCart.classAddonTotalTaxPrice),i.amtPaid=parseFloat(onlineShoppingCart.amtPaid)+parseFloat(onlineShoppingCart.classSubTotal)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining+onlineShoppingCart.DepositsRemaining+onlineShoppingCart.FeeDepositsRemaining),i.gcAmt=parseFloat(onlineShoppingCart.gcAmt)+parseFloat(onlineShoppingCart.classGCUsed),i.vplAmt=parseFloat(onlineShoppingCart.vplAmt)+parseFloat(onlineShoppingCart.classFinalTotal)+parseFloat(onlineShoppingCart.tipValue)-parseFloat(onlineShoppingCart.InvoiceDepositsRemaining+onlineShoppingCart.DepositsRemaining)):(i.gcAmt=onlineShoppingCart.gcAmt,i.ccAmt=parseFloat(onlineShoppingCart.ccAmt)+parseFloat(onlineShoppingCart.classFinalTotal)-parseFloat(onlineShoppingCart.FeeDepositsRemaining),i.amtPaid=onlineShoppingCart.amtPaid-parseFloat(onlineShoppingCart.FeeDepositsRemaining),i.tax=onlineShoppingCart.tax-parseFloat(onlineShoppingCart.FeeTaxDepositsRemaining),i.vplAmt=onlineShoppingCart.vplAmt),i.businessID=onlineShoppingCart.BusinessID,i.CurrencyCode=currencyCode,i.loginUserID=onlineShoppingCart.loginUserId,i.isSaveCard=!1,i.isUserCardonFile=!1,i.onlineGCDevice="",onlineShoppingCart.RedeemedByGCDistri=[],onlineShoppingCart.RedeemedByGCDistri=e.extend(!0,[],onlineShoppingCart.RedeemedByGC),(i.isSaveCard||i.isUserCardonFile)&&(i.isUserCardonFile=!0);var a=[];if(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0){var r=e.grep(onlineShoppingCart.Inventories,function(e){return 1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)});_onlineCheckout.setProductCheckoutData(r,a,i)}if(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&_onlineCheckout.setMembershipCheckoutData(onlineShoppingCart.Memberships,a,i),null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0&&(_onlineCheckout.setGCCheckoutData(onlineShoppingCart.GiftCertificates,a,i),void 0!==_siteBuilderDetail.IsFromGoogleMyBusiness&&1==_siteBuilderDetail.IsFromGoogleMyBusiness&&(i.onlineGCDevice="google")),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&_onlineCheckout.setPackageCheckoutData(onlineShoppingCart.Packages,a,i),null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&(_onlineCheckout.UpdateBusinessTaxForBusinessFee(),_onlineCheckout.setBusinessFeesCheckoutData(onlineShoppingCart.BusinessFee,a,i),i.TotalFeeAmount=onlineShoppingCart.totalFeeAmount,i.TotalFeeTax=onlineShoppingCart.totalFeeTax),1==_onlineCheckout.IsThisNewCustomer)for(var o=0;o<=a.length-1;o++)a[o].isNewCustomer=_onlineCheckout.IsThisNewCustomer;if(1==_onlineCheckout.IsPaidClass()&&null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&_onlineCheckout.setClassCheckoutData(onlineShoppingCart.Events,a,i,!0),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&_onlineCheckout.setServiceCheckoutData(onlineShoppingCart.ServiceInvoice,a,i),_onlineCheckout.isValidForCheckoutInvoice()?(i.invoiceID=_onlineCheckout.InvoiceID,null==onlineShoppingCart.invoiceDetails||String.isNullOrUndefineOrBlank(onlineShoppingCart.invoiceDetails.InvoiceGridObject.isExpiryDate)||1!=onlineShoppingCart.invoiceDetails.InvoiceGridObject.isExpiryDate?i.invExpiredMonthForGCPackage=0:i.invExpiredMonthForGCPackage=String.isNullOrUndefineOrBlank(onlineShoppingCart.invoiceDetails.InvoiceGridObject.ExpiryMonths)?parseInt(0):parseFloat(onlineShoppingCart.invoiceDetails.InvoiceGridObject.ExpiryMonths),i.tip=onlineShoppingCart.tipValue,(void 0===i.loginUserID||null==i.loginUserID||0==i.loginUserID)&&void 0!==onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId&&null!=onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId&&onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId>0&&(i.loginUserID=onlineShoppingCart.invoiceDetails.InvoiceGridObject.PayeeId)):(i.invoiceID=0,i.tip=parseFloat(onlineShoppingCart.tipValue),i.ccAmt=i.ccAmt+i.tip),null!=i&&0==_onlineCheckout.isCheckoutVPLChanged&&(i.vplAmt=0),"undefined"==typeof hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)||"1"!=hdnPriceWithTaxSwitch.value||(i.IsIncludeTaxInOnlinePricing=!0),i.ccAmt>0){i.ccDetails={},i.RedeemedByGC=onlineShoppingCart.RedeemedByGCDistri,i.checkoutGridrow=a,ShowLoader(!0);i.isOnlineCheckout=!0,i.IsVCFDistribution=!0,i.distributionRequestType=0;var n=new vagaro.ajax;n.datamodel.Token="SaveCheckoutCCDistribution",n.datamodel.callback=function(i){if(null!=i&&null!=i.ccDistribution&&i.ccDistribution.length>0){if(i.ccDistribution.length>1){i.ccDistribution=e.grep(i.ccDistribution,function(e){return 1==e.IsConsiderMerchant}),_onlineCheckout.RemoveDuplicateVCFFee();var a=_onlineCheckout.GetVCFFeeList();if(void 0!==a&&null!=a&&a.length>0)for(var r=0;r<i.ccDistribution.length-1;r++){a[0].autoId=onlineShoppingCart.BusinessFee.keySort({autoId:"desc"})[0].autoId+1,onlineShoppingCart.BusinessFee=e.extend(!0,[],e.merge(onlineShoppingCart.BusinessFee,a))}}_onlineCheckout.SetProviderInVCFFee(i.ccDistribution),_onlineCheckout.VCFRecalculateAllDiscount(t)}ShowLoader(!1)},n.datamodel.data=[i],n.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},n.Post()}else t==_onlineCheckout.ApplyVCFLocation.ShippingMethod&&_onlineCheckout.VCFRecalculateAllDiscount(t)}},_onlineCheckout.VCFRecalculateAllDiscount=function(){null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0&&(_onlineCheckout.IsVCFRequire=!0,_onlineCheckout.RemoveVCFFee()),_onlineCheckout.displayFinalCalculatedPrice()},_onlineCheckout.RemoveDuplicateVCFFee=function(){try{if(!String.isNullOrUndefineOrBlank(onlineShoppingCart.BusinessFee)){var t=e.grep(onlineShoppingCart.BusinessFee,function(e){return 1==e.FeeType});if(!String.isNullOrUndefineOrBlank(t)&&t.length>0){var i=e.grep(t,function(e,t){return 1==e.FeeType&&0==t}),a=e.grep(onlineShoppingCart.BusinessFee,function(e){return 0==e.FeeType});!String.isNullOrUndefineOrBlank(a)&&a.length>0?onlineShoppingCart.BusinessFee=e.merge(a,i):onlineShoppingCart.BusinessFee=i}}}catch(e){}},_onlineCheckout.GetVCFFeeList=function(){var t=e.extend(!0,[],onlineShoppingCart.BusinessFee);return e.grep(t,function(e){return 1==e.FeeType})},_onlineCheckout.SetProviderInVCFFee=function(t){if(null!=onlineShoppingCart.BusinessFee&&onlineShoppingCart.BusinessFee.length>0)if(null!=t&&t.length>0){var i=0;e.grep(onlineShoppingCart.BusinessFee,function(e){1==e.FeeType&&(e.ShopOwnerId=t[i].serviceproviderId,e.FeeAccountType=t[i].AccountType,i++)})}else e.grep(onlineShoppingCart.BusinessFee,function(e){1==e.FeeType&&(e.ShopOwnerId=_shopdetail.BookingDetail.spid.split(",")[0],e.FeeAccountType=1,i++)})},_onlineCheckout.IsValidatePrepayVCFFee=function(){return 1==_onlineCheckout.isValidForCheckoutInvoice()||(null!=onlineShoppingCart.Inventories&&onlineShoppingCart.Inventories.length>0||null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0||null!=onlineShoppingCart.GiftCertificates&&onlineShoppingCart.GiftCertificates.length>0||null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0||null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0)&&(null==onlineShoppingCart.Events||onlineShoppingCart.Events.length<0||null!=onlineShoppingCart.Events&&onlineShoppingCart.Events.length>0&&1==_onlineCheckout.IsPrepayBusinessFee())},_onlineCheckout.IsVCFFeeExists=function(){if(null!=onlineShoppingCart.BusinessFee&&1==_onlineCheckout.IsValidatePrepayVCFFee()){var t=e.grep(onlineShoppingCart.BusinessFee,function(e){return 1==e.FeeType});return!String.isNullOrUndefineOrBlank(t)&&t.length>0}return!1},_onlineCheckout.IsVCFFeeApplied=function(){if(null!=onlineShoppingCart.BusinessFee){var t=e.grep(onlineShoppingCart.BusinessFee,function(e){return 1==e.FeeType&&e.CalculatedFees>0});return!String.isNullOrUndefineOrBlank(t)&&t.length>0}return!1},_onlineCheckout.RemoveVCFFee=function(){if(null!=onlineShoppingCart.BusinessFee){var t=0,i=0,a=0,r=0,o=0,n=0;e.grep(onlineShoppingCart.BusinessFee,function(e){1==e.FeeType&&(i+=e.CalculatedFees,t+=e.CalculatedTax,e.CalculatedFees=0,e.CalculatedTax=0,e.Qty=0,e.CalculatedFeesForClass=0,e.CalculatedTaxForClass=0,e.ActualPrice=0,e.ActualTax=0)}),e.grep(onlineShoppingCart.BusinessFee,function(e){e.DisplayCalculatedFees=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(e.CalculatedFees,2)-_onlineCheckout.parseTodecimal(e.CalculatedFeesForClass,2),2),e.DisplayCalculatedTax=_onlineCheckout.parseTodecimal(_onlineCheckout.parseTodecimal(e.CalculatedTax,2)-_onlineCheckout.parseTodecimal(e.CalculatedTaxForClass,2),2),a=_onlineCheckout.parseTodecimal(a+_onlineCheckout.parseTodecimal(e.CalculatedFeesForClass,2)+_onlineCheckout.parseTodecimal(e.CalculatedTaxForClass,2),2),o+=e.DisplayCalculatedFees,n+=e.DisplayCalculatedTax,r=_onlineCheckout.parseTodecimal(r+_onlineCheckout.parseTodecimal(e.CalculatedTaxForClass,2),2)}),onlineShoppingCart.totalFeeAmount=onlineShoppingCart.totalFeeAmount-i,onlineShoppingCart.totalFeeTax=onlineShoppingCart.totalFeeTax-t,onlineShoppingCart.totalFeeAmountPrepay=o,onlineShoppingCart.totalFeeTaxPrepay=n,onlineShoppingCart.FeeDepositsRemaining=a,onlineShoppingCart.FeeTaxDepositsRemaining=r,onlineShoppingCart.ccAmt=onlineShoppingCart.ccAmt-i,onlineShoppingCart.amtPaid=onlineShoppingCart.amtPaid-i}},_onlineCheckout.BindPaymentOption=function(t){var i=[],a=1;if(t.lstGcAndPackagesForCheckout.length>0){var r=[];if(_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0){var o=!1,n=e.grep(t.lstGcAndPackagesForCheckout,function(e,t){return 1==e.isPackage&&(0==e.isCustomPackage||1==e.isCustomPackage&&null==e.serviceID)&&(1==e.isCustomPackage&&null==e.serviceID&&0==o&&(o=!0),!0)});if(null!=n&&n.length>0){n.keySort({expiresOn:"asc",quantity:"asc"});var s=[];1==o&&(e.grep(n,function(i){s.push(i);var a=e.grep(t.lstGcAndPackagesForCheckout,function(e){return 1==e.isPackage&&1==e.isCustomPackage&&i.giftCertificateID==e.giftCertificateID&&null!=e.serviceID});a.length>0&&(s=s.concat(a))}),n=s),null!=n&&n.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(t){e.grep(n,function(e){if(e.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))>=new Date(moment(t.startTime).format("YYYY/MM/DD")))&&0==t.isPaid&&!(void 0!==t.isPresetApply&&0!=t.isPresetApply||void 0!==t.isPointApply&&0!=t.isPointApply||void 0!==t.isPackageApplied&&0!=t.isPackageApplied||void 0!==t.isMembershipApply&&0!=t.isMembershipApply||void 0!==t.isServiceBaseGC&&0!=t.isServiceBaseGC||void 0!==t.isGCApply&&0!=t.isGCApply||!(t.PromotionId<=0))&&-1==jQuery.inArray(e.giftCertificateID,r)){var o={IsEnd:!1};o.Id=e.giftCertificateID,o.DIVId="div_"+_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+e.giftCertificateID,o.Name=_onlineCheckout.PaymentOptionText.TextPkg+(1==e.isCustomPackage?e.pkgName:e.serviceName),o.Type=u,o.Index=a,o.RequestParam=JSON.stringify(o),i.push(o),r.push(e.giftCertificateID),a+=1}})})}}!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(o){e.grep(t.lstGcAndPackagesForCheckout,function(t,n){if(-1==jQuery.inArray(t.giftCertificateID,r)&&1==t.isPackage){var s={IsEnd:!1};t.serviceName.toLowerCase()==o.eventName.toLowerCase()&&0!=t.quantity&&o.eventEnrollment[0].Originalprice>0&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(o.eventEnrollment[0].eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))&&(s.DIVId="div_"+_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+t.giftCertificateID,s.Id=t.giftCertificateID,s.Name=_onlineCheckout.PaymentOptionText.TextPkg+(1==t.isCustomPackage?t.pkgName:t.serviceName),s.Type=u,s.Index=a,s.RequestParam=JSON.stringify(s),i.push(s),r.push(t.giftCertificateID),a+=1),isNullOrUndefineOrBlank(o.eventEnrollment[0].lstAddonService)||e.grep(o.eventEnrollment[0].lstAddonService,function(e,n){-1==jQuery.inArray(t.giftCertificateID,r)&&t.serviceName.toLowerCase()==e.ServiceTitle.toLowerCase()&&0!=t.quantity&&e.Originalprice>0&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(o.eventEnrollment[0].eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))&&(s.Id=t.giftCertificateID,s.DIVId="div_"+_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+t.giftCertificateID,s.Name=_onlineCheckout.PaymentOptionText.TextPkg+(1==t.isCustomPackage?t.pkgName:t.serviceName),s.Type=u,s.Index=a,s.RequestParam=JSON.stringify(s),i.push(s),r.push(t.giftCertificateID),a+=1)})}})}),!isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(o){e.grep(t.lstGcAndPackagesForCheckout,function(e,t){if(-1==jQuery.inArray(e.giftCertificateID,r)&&e.serviceName==o.ProductName&&e.serviceID==(o.IsPartial?o.InventoryMasterID:o.InventoryId)){var n=!1,s={IsEnd:!1};if(s.Id=e.giftCertificateID,s.DIVId="div_"+_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+e.giftCertificateID,s.Name=_onlineCheckout.PaymentOptionText.TextPkg+(1==e.isCustomPackage?e.pkgName:e.serviceName),s.Type=u,s.Index=a,s.RequestParam=JSON.stringify(s),r.push(e.giftCertificateID),a+=1,i.length>0){for(t=0;t<i.length;t++)if(i[t].Id===s.Id){n=!0;break}n||i.push(s)}else i.push(s)}})})}if(t.lstUserListForCheckout.length>0){var l=0,d=0;if(e.grep(t.lstUserListForCheckout,function(t){!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(a){if(r=a,!(_shopdetail.EnableFMBFee()&&null!=r&&void 0!==r.PromotionID&&null!=r.PromotionID&&r.PromotionID>0)){var r,o=void 0===a.Originalprice?a.actualPrice:a.Originalprice;t.userId==a.customerID&&t.pointsBalance>0&&(t.pointsBalance>=_onlineCheckout.ConvertDecimalWithFixed(i.PointRedeem,!1,2)||_onlineCheckout.IsPartialPointAllowed)&&_onlineCheckout.ConvertDecimalWithFixed(i.PointRedeem,!1,2)>0&&o>0&&(l+=1),!isNullOrUndefineOrBlank(a.lstAddonService)&&a.lstAddonService.length>0&&e.grep(a.lstAddonService,function(e){t.userId==a.customerID&&t.pointsBalance>0&&(t.pointsBalance>=_onlineCheckout.ConvertDecimalWithFixed(e.PointRedeem,!1,2)||_onlineCheckout.IsPartialPointAllowed)&&_onlineCheckout.ConvertDecimalWithFixed(e.PointRedeem,!1,2)>0&&e.Originalprice>0&&(l+=1)})}})}),!isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(e){var i=e.pointsRedeem*parseInt(e.Quantity);t.userId==onlineShoppingCart.loginUserId&&t.pointsBalance>0&&i>0&&(t.pointsBalance>=i||_onlineCheckout.IsPartialPointAllowed)&&(l+=1)}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){t.userId==e.userID&&t.pointsBalance>0&&(t.pointsBalance>=_onlineCheckout.ConvertDecimalWithFixed(e.pointredeemOriginal,!1,2)||_onlineCheckout.IsPartialPointAllowed)&&_onlineCheckout.ConvertDecimalWithFixed(e.pointredeemOriginal,!1,2)>0&&e.priceOriginal>0&&(l+=1)}),d+=t.pointsBalance}),l>0){var c={};c.DIVId="div_"+_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Point+"_"+p,c.Id=p,c.Name=_onlineCheckout.PaymentOptionText.TextPoint+d,c.Type=p,c.Index=a,c.IsEnd=!1,c.RequestParam=JSON.stringify(c),i.push(c),a+=1}}if(!isNullOrUndefineOrBlank(t.lstMembershipForCheckout)&&t.lstMembershipForCheckout.length>0){var m=!1;if(!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.each(onlineShoppingCart.Events,function(i,a){e.each(a.eventEnrollment,function(i,a){var r=e.grep(t.lstMembershipForCheckout,function(e){return 0!=e.VisitRemaining&&(a.customerID>0&&e.UserID>0&&(a.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,a.customerID))||a.customerID<=0&&e.UserID>0&&a.cUserEmail==e.EmailId)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))});isNullOrUndefineOrBlank(r)||(m=!0)})}),!isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(i){var a=e.grep(t.lstMembershipForCheckout,function(e){return e.ServiceProductName==i.ProductName&&(e.VisitRemaining>0&&i.Quantity<=e.VisitRemaining||-1==e.VisitRemaining)});isNullOrUndefineOrBlank(a)||(m=!0)}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0){var f=e.grep(t.lstMembershipForCheckout,function(e){return 1==e.ItemType||19==e.ItemType});null!=f&&f.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(t){e.each(f,function(e,i){if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==t.isPresetApply&&1==t.isPresetApply&&0==i.IsAllowPreSetDiscount)return!1;i.ServiceProductName==t.servicename&&(i.VisitRemaining>0&&1<=i.VisitRemaining||-1==i.VisitRemaining)&&(0==t.PromotionId||1==i.isPromotionalDiscount&&0!=t.PromotionId)&&(null==i.strValidUpto||""==i.strValidUpto||null!=i.strValidUpto&&""!=i.strValidUpto&&new Date(moment(t.startTime).format("YYYY/MM/DD"))<=new Date(moment(i.strValidUpto).format("YYYY/MM/DD")))&&(m=!0)})})}if(m)for(var g=0;g<t.lstMembershipForCheckout.length;g++)if(0!=t.lstMembershipForCheckout[g].VisitRemaining){var v={};v.DIVId="div_"+_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS+"_"+t.lstMembershipForCheckout[g].MembershipID,v.Id=t.lstMembershipForCheckout[g].MembershipID,v.Name=_onlineCheckout.PaymentOptionText.TextMS+t.lstMembershipForCheckout[g].MembershipName,v.Type=h,v.Index=a,v.IsEnd=!1,v.RequestParam=JSON.stringify(v);for(var A=!1,C=0;C<i.length;C++)if(i[C].Id===v.Id){A=!0;break}A||(i.push(v),a+=1)}}_onlineCheckout.Model.IsPaymentOption=!1,i.length>0&&(i[i.length-1].IsEnd=!0,e(_onlineCheckout.Controls.DivPaymentOption).html(""),e(_onlineCheckout.Controls.TmplBookingPaymentOption).tmpl(i).appendTo(_onlineCheckout.Controls.DivPaymentOption),_onlineCheckout.Model.IsPaymentOption=!0)},_onlineCheckout.ResetEventEnrollmentFlags=function(){!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.each(onlineShoppingCart.Events,function(t,i){e.each(i.eventEnrollment,function(t,i){i.gcId=null,i.isPackage=!1,i.isMembershipApply=!1,i.isPointApply=!1,i.redeemAmt=0,i.redeemTax=0,i.MembershipID=null,!isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.each(i.lstAddonService,function(e,t){t.gcId=null,t.isPackage=!1,t.isMembershipApply=!1,t.isPointApply=!1,t.redeemAmt=0,t.redeemTax=0})})})},_onlineCheckout.PaymentTabClick=function(t,i){var a=e(t).hasClass(_onlineCheckout.CssClass.ActiveTab),r=[];if(e('.payment-option-mspkgpoint[id^="div_MS_"].w--current').each(function(){r.push(parseInt(e(this).attr("id").replace("div_MS_","")))}),e(".payment-option-mspkgpoint").removeClass(_onlineCheckout.CssClass.ActiveTab),1==a)r=r.filter(function(e){return e!=i.Id}),_onlineCheckout.RemoveDicountByType(i),_onlineCheckout.ReApplyDiscounts(),_onlineCheckout.PaymentOptionSelectDeselect();else{if(e(t).addClass(_onlineCheckout.CssClass.ActiveTab),null!=onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail&&null!=onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail&&null!=onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout&&null!=onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout){var o=e.extend(!0,{},onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail);if(i.Type==h){if(null!=o.lstMembershipForCheckout){var n=e.grep(o.lstMembershipForCheckout,function(e){return e.MembershipID==i.Id});if(n.length>0){var s=n[0].ServiceProductName,l=[];e.grep(o.lstMembershipForCheckout,function(e){e.ServiceProductName==s&&r.indexOf(e.MembershipID)>-1&&e.MembershipID!=i.Id&&l.push(e.MembershipID)}),r=r.filter(function(e){return-1==l.indexOf(e)})}}-1==r.indexOf(i.Id)&&r.push(i.Id)}null!=o.lstMembershipForCheckout&&null!=o.lstMembershipForCheckout&&(o.lstMembershipForCheckout=e.grep(o.lstMembershipForCheckout,function(e){return r.indexOf(e.MembershipID)>-1&&(e.VisitRemaining>0||-1==e.VisitRemaining)})),_onlineCheckout.ApplyDiscounts(o.lstGcAndPackagesForCheckout,o.lstUserListForCheckout,o.lstMembershipForCheckout,o.IsPromotionEnable),onlineShoppingCart.lstGCPkgData=JSON.parse(JSON.stringify(onlineShoppingCartmain.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout)),e.each(onlineShoppingCart.lstGCPkgData,function(e,t){t.ResetcurrentBalance=t.currentBalance})}_onlineCheckout.ResetEventEnrollmentFlags(),_onlineCheckout.ApplyDicountByType(i),_onlineCheckout.ReApplyDiscounts(),_onlineCheckout.PaymentOptionSelectDeselect()}},_onlineCheckout.PaymentOptionSelectDeselect=function(){if(e(_onlineCheckout.Controls.PaymentOptionMsPkgPoint).removeClass(_onlineCheckout.CssClass.ActiveTab),!String.isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){1==e.isPointApply?_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Point+"_"+p,!0):1==e.isPackageApplied?_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+e.redeemID,!0):1==e.isMembershipApply&&_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS+"_"+e.MembershipID,!0)}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){1==t.isPointApply?_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Point+"_"+p,!0):1==t.isPackage?_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+t.gcId,!0):1==t.isMembershipApply&&_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS+"_"+t.MembershipID,!0),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){1==e.isPointApply?_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Point+"_"+p,!0):1==e.isPackage?_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+e.gcId,!0):1==e.isMembershipApply&&_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS+"_"+e.MembershipID,!0)})})}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0){var t=!1,i=!1,a=!1;e.grep(onlineShoppingCart.Inventories,function(e){String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)||(1==e.isPackageApplied&&(t=!0),i=!0),String.isNullOrUndefineOrBlank(e.isPointApply)||1!=e.isPointApply?String.isNullOrUndefineOrBlank(e.isMembershipApply)||1!=e.isMembershipApply?String.isNullOrUndefineOrBlank(e.isPackageApplied)||1!=e.isPackageApplied||(0==i||1==i&&t)&&_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Pkg+"_"+e.MembershipID,!0):(0==i&&0==t&&_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS+"_"+e.MembershipID,!0),1==e.isMembershipApply&&1==i&&(a=!0),1==i&&1==a&&_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.MS+"_"+e.MembershipID,!0)):_onlineCheckout.SelectDeselect(_onlineCheckout.CheckoutBarcodeCodePrepayOnline.Point+"_"+p,!0)})}},_onlineCheckout.SelectDeselect=function(t,i){1==i?e("#div_"+t).addClass(_onlineCheckout.CssClass.ActiveTab):e("#div_"+t).removeClass(_onlineCheckout.CssClass.ActiveTab)},_onlineCheckout.ApplyDicountByType=function(t){if(t.Type==p)_onlineCheckout.RemoveExistingGC(),_onlineCheckout.RemoveExistingDicount(onlineShoppingCart.UsersPoints,t),!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&_onlineCheckout.ApplyPointsONEvents(onlineShoppingCart.Events,onlineShoppingCart.UsersPoints,[]),!isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&(_onlineCheckout.ApplyPointsONProduct(onlineShoppingCart.Inventories,onlineShoppingCart.UsersPoints),e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){i.isPresetApply=!1,i.isGCApply=!1,i.isMembershipApply=!1,i.isPointApply=!1,i.isPointApplyPartial=!1,i.membershipName="",i.packageName="",i.Price=0;var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId}),r=0,o=[],n=[],s=!1,l=!1;if(e.each(a,function(e,t){void 0!==t.isPointApply&&0==t.isPointApply?i.Price+=t.Price:void 0!==t.isPointApply&&1==t.isPointApply&&1==t.IsPartialPoint?i.Price+=t.Price-t.PartialPrice:r+=1,void 0!==t.isPointApply&&1==t.isPointApply&&1==_onlineCheckout.IsPartialPointAllowed&&(i.pointsRedeem+=t.pointsRedeem),i.isPresetApply=1==i.isPresetApply||t.isPresetApply,i.isGCApply=1==i.isGCApply||t.isGCApply,i.isMembershipApply=1!=t.isPackageApplied&&(1==i.isMembershipApply||t.isMembershipApply),i.isPackageApplied=1==i.isPackageApplied||t.isPackageApplied,t.isPackageApplied&&(s=!0),t.isMembershipApply&&(l=!0),t.isMembershipApply&&-1==o.indexOf(t.membershipName)&&o.push(t.membershipName),t.isPackageApplied&&-1==n.indexOf(t.membershipName)&&n.push(t.membershipName)}),s&&null!=n&&n.length>0){var d=n.join();i.packageName=d,i.membershipName=d,i.isPackageBundleApplied=!0}if(l&&null!=o&&o.length>0){var c=o.join();i.membershipName=c,i.isMembershipBundleApplied=!0}a.length==r?i.isPointApply=!0:r>0&&(i.isPointApplyPartial=!0)}})),_onlineCheckout.isValidForCheckoutInvoice()&&!isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&_onlineCheckout.ApplyPointsONServices(onlineShoppingCart.ServiceInvoice,onlineShoppingCart.UsersPoints);else if(t.Type==u){var i=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==t.Id});if(_onlineCheckout.RemoveExistingGC(),_onlineCheckout.RemoveExistingDicount(i,t),!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&i.length>0&&(onlineShoppingCart.Events=_onlineCheckout.CalculatePriceAndTaxOnCartForClass(onlineShoppingCart.Events,!0,i,!0)),_onlineCheckout.isValidForCheckoutInvoice()&&!isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&i.length>0&&_onlineCheckout.ApplyPackageOnServices(onlineShoppingCart.ServiceInvoice,i),!isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0){var a=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return 1==e.eventType}),r=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return 1==e.eventType||2==e.eventType});if(null!=a&&a.length>0){var o={serviceID:"desc",GiftCertificateAmt:"asc"};a.keySort(o)}if(null!=(l=e.grep(onlineShoppingCart.Inventories,function(e){return 1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)}))&&l.length>0){for(var n=[],s=0;s<r.length;s++)r[s].giftCertificateID===t.Id&&n.push(r[s]);_onlineCheckout.ApplyGCONAllItems(l,n,d.Product)}e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){i.isPresetApply=!1,i.isGCApply=!1,i.isMembershipApply=!1,i.isPointApply=!1,i.isPointApplyPartial=!1,i.membershipName="",i.packageName="",i.Price=0;var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId}),r=0,o=[],n=[],s=!1;if(e.each(a,function(e,t){void 0!==t.isPointApply&&0==t.isPointApply?i.Price+=t.Price:r+=1,i.isPresetApply=1==i.isPresetApply||t.isPresetApply,i.isGCApply=1==i.isGCApply||t.isGCApply,i.isPackageApplied=1==i.isPackageApplied||t.isPackageApplied,t.isPackageApplied&&(s=!0),t.isMembershipApply&&-1==o.indexOf(t.membershipName)&&o.push(t.membershipName),t.isPackageApplied&&-1==n.indexOf(t.membershipName)&&n.push(t.membershipName)}),s){if(null!=n&&n.length>0){var l=n.join();i.membershipName=l,i.packageName=l}}else if(null!=o&&o.length>0){var d=o.join();i.membershipName=d}a.length==r?i.isPointApply=!0:r>0&&(i.isPointApplyPartial=!0)}})}}else if(t.Type==h){if(_onlineCheckout.RemoveExistingGC(),_onlineCheckout.RemoveExistingDicount(onlineShoppingCart.lstMembership,t),!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&(e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){t.isMembershipRemove=!1,!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){e.isMembershipRemove=!1})})}),_onlineCheckout.ApplyMembershipONEvents(onlineShoppingCart.Events,onlineShoppingCart.lstMembership)),!isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0){var l;if(null!=(a=e.grep(onlineShoppingCart.lstGCPkgData,function(e,t){return 1==e.eventType}))&&a.length>0){o={serviceID:"desc",GiftCertificateAmt:"asc"};a.keySort(o)}if(null!=(l=e.grep(onlineShoppingCart.Inventories,function(e){return 1==String.isNullOrUndefineOrBlank(e.InventoryBundleCartDetails)}))&&l.length>0){var c=[];for(s=0;s<onlineShoppingCart.lstMembership.length;s++)onlineShoppingCart.lstMembership[s].MembershipID===t.Id&&c.push(onlineShoppingCart.lstMembership[s]);_onlineCheckout.ApplyMembershipONProduct(l,c)}e.each(onlineShoppingCart.Inventories,function(t,i){if(!String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)){i.isPresetApply=!1,i.isGCApply=!1,i.isMembershipApply=!1,i.isPointApply=!1,i.isPointApplyPartial=!1,i.membershipName="",i.packageName="",i.Price=0;var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.MasterInventoryId==i.InventoryId}),r=0,o=[],n=[],s=!1;if(e.each(a,function(e,t){void 0!==t.isPointApply&&0==t.isPointApply?i.Price+=t.Price:r+=1,i.isPresetApply=1==i.isPresetApply||t.isPresetApply,i.isGCApply=1==i.isGCApply||t.isGCApply,i.isMembershipApply=1!=t.isPackageApplied&&(1==i.isMembershipApply||t.isMembershipApply),i.isPackageApplied=1==i.isPackageApplied||t.isPackageApplied,t.isPackageApplied&&(s=!0),t.isMembershipApply&&(isMembershipBundleApplied=!0),t.isMembershipApply&&-1==o.indexOf(t.membershipName)&&o.push(t.membershipName),t.isPackageApplied&&-1==n.indexOf(t.membershipName)&&n.push(t.membershipName)}),s&&null!=n&&n.length>0){var l=n.join();i.membershipName=l,i.packageName=l,i.isPackageBundleApplied=!0}if(isMembershipBundleApplied&&null!=o&&o.length>0){var d=o.join();i.membershipName=d,i.isMembershipBundleApplied=!0}a.length==r?i.isPointApply=!0:r>0&&(i.isPointApplyPartial=!0)}})}_onlineCheckout.isValidForCheckoutInvoice()&&!isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&_onlineCheckout.ApplyMembershipONServices(onlineShoppingCart.ServiceInvoice,onlineShoppingCart.lstMembership)}},_onlineCheckout.RemoveDicountByType=function(t){_onlineCheckout.isValidForCheckoutInvoice()&&!String.isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){t.Type==p&&e.isPointApply?_onlineCheckout.RemoveDicount(d.ServiceInvoice,p,e.AppSrNo):t.Type==u?e.redeemID==t.Id&&_onlineCheckout.RemoveDicount(d.ServiceInvoice,u,e.AppSrNo):1==e.isMembershipApply&&e.MembershipID==t.Id&&_onlineCheckout.RemoveDicount(d.ServiceInvoice,h,e.AppSrNo)}),!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0&&e.grep(onlineShoppingCart.Events,function(i){e.grep(i.eventEnrollment,function(i){t.Type==p?String.isNullOrUndefineOrBlank(i.isPointApply)||1!=i.isPointApply||setTimeout(function(){_onlineCheckout.RemoveDicount(d.Class,p,i.eventID,i.autoID)},200):t.Type==u?i.gcId==t.Id&&setTimeout(function(){_onlineCheckout.RemoveDicount(d.Class,u,i.eventID,i.autoID)},200):t.Type==h&&i.MembershipID==t.Id&&1==i.isMembershipApply&&setTimeout(function(){_onlineCheckout.RemoveDicount(d.Class,h,i.eventID,i.autoID)},200),!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e){t.Type==p?String.isNullOrUndefineOrBlank(e.isPointApply)||1!=e.isPointApply||setTimeout(function(){_onlineCheckout.RemoveDicount(d.ClassAddons,p,i.eventID,i.autoID+"_"+e.ServiceId)},200):t.Type==u?e.gcId==t.Id&&setTimeout(function(){_onlineCheckout.RemoveDicount(d.ClassAddons,u,i.eventID,i.autoID+"_"+e.ServiceId)},200):t.Type==h&&e.MembershipID==t.Id&&1==e.isMembershipApply&&setTimeout(function(){_onlineCheckout.RemoveDicount(d.ClassAddons,h,i.eventID,i.autoID+"_"+e.ServiceId)},200)})})}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(i){var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});t.Type==p?String.isNullOrUndefineOrBlank(i.isPointApply)||1!=i.isPointApply||setTimeout(function(){String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,p,i.autoId):_onlineCheckout.RemoveDicount(d.Product,p,a[0].autoId)},100):t.Type==h?i.MembershipID!=t.Id&&String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)||String.isNullOrUndefineOrBlank(i.isMembershipApply)||1!=i.isMembershipApply||setTimeout(function(){String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,h,i.autoId):_onlineCheckout.RemoveDicount(d.Product,h,a[0].autoId)},100):t.Type==u&&(i.MembershipID!=t.Id&&String.isNullOrUndefineOrBlank(i.InventoryBundleCartDetails)||String.isNullOrUndefineOrBlank(i.isPackageApplied)||1!=i.isPackageApplied||setTimeout(function(){String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,u,i.autoId):_onlineCheckout.RemoveDicount(d.Product,u,a[0].autoId)},100))})},_onlineCheckout.RemoveExistingDicount=function(t,i){if(i.Type==u){if(String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)||e.grep(onlineShoppingCart.Events,function(i){var a=i.eventEnrollment.uniqueObjects(["customerID","cUserEmail"]);if(a.length>0)for(var r=0;r<=a.length-1;r++){var o=[],n=e.grep(t,function(e){return(a[r].customerID>0&&e.assignTo==a[r].customerID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,a[r].customerID)||a[r].customerID<=0&&e.emailId==a[r].cUserEmail)&&null!=e.serviceID&&(e.serviceID==i.eventID||e.serviceName.toLowerCase().trim()==i.eventName.toLowerCase().trim())});null!=n&&n.length>0&&(o=n);var s=1,l=0,c=0;e.grep(i.eventEnrollment,function(e){(a[r].customerID>0&&e.customerID==a[r].customerID||a[r].customerID<=0&&e.cUserEmail==a[r].cUserEmail)&&(0==e.StreamingStatus?c+=1:1==e.StreamingStatus&&(l+=1))});var m=1;l>0&&c>0?(m=2,s=3):0==c&&l>0&&(s=2);for(var f=1;f<=m;f++){var g=e.grep(i.eventEnrollment,function(e){return 1==f&&3==s||1==s?(a[r].customerID>0&&e.customerID==a[r].customerID||a[r].customerID<=0&&e.cUserEmail==a[r].cUserEmail)&&0==e.StreamingStatus:(a[r].customerID>0&&e.customerID==a[r].customerID||a[r].customerID<=0&&e.cUserEmail==a[r].cUserEmail)&&1==e.StreamingStatus});null!=g&&g.length>0&&e.each(g,function(i,a){e.grep(o,function(e){return null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))>new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))&&null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))&&(0==a.IsOutsideBilling&&(a.strAdvanceLimitDate=e.strAdvanceLimitDate),a.IsWaivedApply=!0,a.AppliedName=e.pkgName),(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))}).length>0&&(1==a.isPointApply?_onlineCheckout.RemoveDicount(d.Class,p,a.eventID,a.autoID):1==a.isMembershipApply?_onlineCheckout.RemoveDicount(d.Class,h,a.eventID,a.autoID):String.isNullOrUndefineOrBlank(a.isPackage)||1!=a.isPackage||_onlineCheckout.RemoveDicount(d.Class,u,a.eventID,a.autoID)),e.each(a.lstAddonService,function(i,r){var o=[],n=e.grep(t,function(e){return(r.customerID>0&&e.assignTo==r.customerID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,r.customerID)||r.customerID<=0&&e.emailId==r.cUserEmail)&&null!=e.serviceID&&(e.serviceID==r.ServiceId||e.serviceName.toLowerCase().trim()==r.ServiceTitle.toLowerCase().trim())});null!=n&&n.length>0&&(o=n),e.grep(o,function(e){return null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))>new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))&&null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))&&(0==r.IsOutsideBilling&&(r.strAdvanceLimitDate=e.strAdvanceLimitDate),r.IsWaivedApply=!0,r.AppliedName=e.pkgName),(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(e.strValidUpto).format("YYYY/MM/DD")))}).length>0&&(1==r.isPointApply?_onlineCheckout.RemoveDicount(d.ClassAddons,p,a.eventID,a.autoID+"_"+r.ServiceId):1==r.isMembershipApply?_onlineCheckout.RemoveDicount(d.ClassAddons,h,a.eventID,a.autoID+"_"+r.ServiceId):String.isNullOrUndefineOrBlank(r.isPackage)||1!=r.isPackage||_onlineCheckout.RemoveDicount(d.ClassAddons,u,a.eventID,a.autoID+"_"+r.ServiceId))})})}}}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0){var a=e.grep(t,function(e){return e.giftCertificateID==i.Id});null!=a&&a.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(t){e.grep(a,function(e){e.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))>=new Date(moment(t.startTime).format("YYYY/MM/DD")))&&0==t.isPaid&&(String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply?String.isNullOrUndefineOrBlank(t.isMembershipApply)||1!=t.isMembershipApply||_onlineCheckout.RemoveDicount(d.ServiceInvoice,h,t.AppSrNo):_onlineCheckout.RemoveDicount(d.ServiceInvoice,p,t.AppSrNo))})})}!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(i){var a=e.grep(t,function(e){return 2==e.eventType});null!=a&&a.length>0&&e.each(a,function(t,a){if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==i.isPresetApply&&1==i.isPresetApply)return!1;if(String.isNullOrUndefineOrBlank(i.BundleName)||String.isNullOrUndefineOrBlank(i.isPackageApplied)||1!=i.isPackageApplied||_onlineCheckout.RemoveDicount(d.Product,u,i.autoId),a.serviceName==i.ProductName&&(a.quantity>0&&i.Quantity<=a.quantity||-1==a.quantity)){if(!String.isNullOrUndefineOrBlank(i.isPointApply)&&1==i.isPointApply){var r=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});String.isNullOrUndefineOrBlank(r)?_onlineCheckout.RemoveDicount(d.Product,p,i.autoId):_onlineCheckout.RemoveDicount(d.Product,p,r[0].autoId)}if(!String.isNullOrUndefineOrBlank(i.isMembershipApply)&&1==i.isMembershipApply){r=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});String.isNullOrUndefineOrBlank(r)?_onlineCheckout.RemoveDicount(d.Product,h,i.autoId):_onlineCheckout.RemoveDicount(d.Product,h,r[0].autoId)}if(!String.isNullOrUndefineOrBlank(i.isPackageApplied)&&1==i.isPackageApplied){r=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});String.isNullOrUndefineOrBlank(r)?_onlineCheckout.RemoveDicount(d.Product,u,i.autoId):_onlineCheckout.RemoveDicount(d.Product,u,r[0].autoId)}}})})}else if(i.Type==h){if(String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)||e.each(onlineShoppingCart.Events,function(i,a){e.each(a.eventEnrollment,function(i,r){var o=e.grep(t,function(e){return r.customerID>0&&e.UserID>0&&(r.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,r.customerID))||r.customerID<=0&&e.UserID>0&&r.cUserEmail==e.EmailId});e.each(o,function(e,t){t.ServiceProductName.toLowerCase().trim()==a.eventName.toLowerCase().trim()&&null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(r.eventDate).format("YYYY/MM/DD"))>new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))&&null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(r.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))&&0==r.IsOutsideBilling&&0==r.IsWaivedApply&&(r.strAdvanceLimitDate=t.strAdvanceLimitDate,r.IsWaivedApply=!0,r.AppliedName=t.MembershipName),r.Originalprice>0&&t.ServiceProductName.toLowerCase().trim()==a.eventName.toLowerCase().trim()&&t.Discount>0&&(r.customerID>0&&t.UserID>0&&(r.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,r.customerID))||r.customerID<=0&&t.UserID>0&&r.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)&&(1==_onlineCheckout.IsUpSellMemPkgAdd||"true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&(0!=r.PromotionID&&1==t.isPromotionalDiscount||0==r.PromotionID||void 0===r.PromotionID)&&0==r.isPaid&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(r.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))&&(String.isNullOrUndefineOrBlank(r.isPointApply)||1!=r.isPointApply?String.isNullOrUndefineOrBlank(r.isPackage)||1!=r.isPackage||_onlineCheckout.RemoveDicount(d.Class,u,r.eventID,r.autoID):_onlineCheckout.RemoveDicount(d.Class,p,r.eventID,r.autoID))}),!String.isNullOrUndefineOrBlank(r.lstAddonService)&&r.lstAddonService.length>0&&e.each(r.lstAddonService,function(i,a){var o=e.grep(t,function(e){return r.customerID>0&&e.UserID>0&&(r.customerID==e.UserID||_onlineCheckout.IsUserHaveSharedMS(e.SharedUserIDs,r.customerID))||r.customerID<=0&&e.UserID>0&&r.cUserEmail==e.EmailId});e.each(o,function(e,t){t.ServiceProductName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))>new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))&&null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(a.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))&&0==a.IsOutsideBilling&&0==a.IsWaivedApply&&(a.strAdvanceLimitDate=t.strAdvanceLimitDate,a.IsWaivedApply=!0,a.AppliedName=t.MembershipName),a.Originalprice>0&&t.ServiceProductName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&t.Discount>0&&(r.customerID>0&&t.UserID>0&&(r.customerID==t.UserID||_onlineCheckout.IsUserHaveSharedMS(t.SharedUserIDs,r.customerID))||r.customerID<=0&&t.UserID>0&&r.cUserEmail==t.EmailId)&&(t.VisitRemaining>0||-1==t.VisitRemaining)&&(1==_onlineCheckout.IsUpSellMemPkgAdd||"true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&(0!=a.PromotionID&&1==t.isPromotionalDiscount||0==a.PromotionID||void 0===a.PromotionID)&&0==a.isPaid&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(r.eventDate).format("YYYY/MM/DD"))<=new Date(moment(t.strValidUpto).format("YYYY/MM/DD")))&&(String.isNullOrUndefineOrBlank(a.isPointApply)||1!=a.isPointApply?String.isNullOrUndefineOrBlank(a.isPackage)||1!=a.isPackage||_onlineCheckout.RemoveDicount(d.ClassAddons,u,r.eventID,r.autoID+"_"+a.ServiceId):_onlineCheckout.RemoveDicount(d.ClassAddons,p,r.eventID,r.autoID+"_"+a.ServiceId))})})})}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(i){MembershipList=e.grep(t,function(e){return 3==e.ItemType}),null!=MembershipList&&MembershipList.length>0&&e.each(MembershipList,function(t,a){if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==i.isPresetApply&&1==i.isPresetApply&&0==a.IsAllowPreSetDiscount)return!1;if(String.isNullOrUndefineOrBlank(i.BundleName)||String.isNullOrUndefineOrBlank(i.isPackageApplied)||1!=i.isPackageApplied||_onlineCheckout.RemoveDicount(d.Product,u,i.autoId),a.ServiceProductName==i.ProductName&&(a.VisitRemaining>0&&i.Quantity<=a.VisitRemaining||-1==a.VisitRemaining)){if(!String.isNullOrUndefineOrBlank(i.isPointApply)&&1==i.isPointApply){var r=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});String.isNullOrUndefineOrBlank(r)?_onlineCheckout.RemoveDicount(d.Product,p,i.autoId):_onlineCheckout.RemoveDicount(d.Product,p,r[0].autoId)}if(!String.isNullOrUndefineOrBlank(i.isMembershipApply)&&1==i.isMembershipApply){r=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});String.isNullOrUndefineOrBlank(r)||_onlineCheckout.RemoveDicount(d.Product,h,r[0].autoId)}if(!String.isNullOrUndefineOrBlank(i.isPackageApplied)&&1==i.isPackageApplied){r=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==i.MasterInventoryId});String.isNullOrUndefineOrBlank(r)?_onlineCheckout.RemoveDicount(d.Product,u,i.autoId):_onlineCheckout.RemoveDicount(d.Product,u,r[0].autoId)}}})}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0){var r=e.grep(t,function(e){return 1==e.ItemType||19==e.ItemType});null!=r&&r.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(t){e.each(r,function(e,i){if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==t.isPresetApply&&1==t.isPresetApply&&0==i.IsAllowPreSetDiscount)return!1;i.ServiceProductName==t.servicename&&(i.VisitRemaining>0&&1<=i.VisitRemaining||-1==i.VisitRemaining)&&(0==t.PromotionId||1==i.isPromotionalDiscount&&0!=t.PromotionId)&&(null==i.strValidUpto||""==i.strValidUpto||null!=i.strValidUpto&&""!=i.strValidUpto&&new Date(moment(t.startTime).format("YYYY/MM/DD"))<=new Date(moment(i.strValidUpto).format("YYYY/MM/DD")))&&(String.isNullOrUndefineOrBlank(t.isPointApply)||1!=t.isPointApply?String.isNullOrUndefineOrBlank(t.isPackageApplied)||1!=t.isPackageApplied||_onlineCheckout.RemoveDicount(d.ServiceInvoice,u,t.AppSrNo):_onlineCheckout.RemoveDicount(d.ServiceInvoice,p,t.AppSrNo))})})}}else if(i.Type==p){var o=null;e.grep(t,function(t){null==o&&(o=t.pointsBalance),String.isNullOrUndefineOrBlank(onlineShoppingCart.Events)||e.each(onlineShoppingCart.Events,function(i,a){e.each(a.eventEnrollment,function(i,r){if(r.customerID>0&&t.userId>0&&r.customerID==t.userId||r.customerID<=0&&t.userId>0&&r.cUserEmail==t.emailId){if(r.Originalprice>0){var n=a.PointRedeem;n>0&&o>0&&(o>=n||1==_onlineCheckout.IsPartialPointAllowed)&&("true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==r.isPaid&&(o-=n,String.isNullOrUndefineOrBlank(r.isPackage)||1!=r.isPackage?String.isNullOrUndefineOrBlank(r.isMembershipApply)||1!=r.isMembershipApply||_onlineCheckout.RemoveDicount(d.Class,h,r.eventID,r.autoID):_onlineCheckout.RemoveDicount(d.Class,u,r.eventID,r.autoID))}!String.isNullOrUndefineOrBlank(r.lstAddonService)&&r.lstAddonService.length>0&&e.each(r.lstAddonService,function(e,i){if(i.Originalprice>0&&(r.customerID>0&&t.userId>0&&r.customerID==t.userId||r.customerID<=0&&t.userId>0&&r.cUserEmail==t.emailId)){var a=String.isNullOrUndefineOrBlank(i.PointRedeem)?0:i.PointRedeem;a>0&&o>0&&o>=a&&("true"==isCCRequiredForOnlineClass.toLowerCase()&&!_onlineCheckout.isValidForCheckoutInvoice()||_onlineCheckout.isValidForCheckoutInvoice())&&0==i.isPaid&&(o-=a,String.isNullOrUndefineOrBlank(i.isPackage)||1!=i.isPackage?String.isNullOrUndefineOrBlank(i.isMembershipApply)||1!=i.isMembershipApply||_onlineCheckout.RemoveDicount(d.ClassAddons,h,r.eventID,r.autoID+"_"+i.ServiceId):_onlineCheckout.RemoveDicount(d.ClassAddons,u,r.eventID,r.autoID+"_"+i.ServiceId))}})}})}),!String.isNullOrUndefineOrBlank(onlineShoppingCart.Inventories)&&onlineShoppingCart.Inventories.length>0&&e.grep(onlineShoppingCart.Inventories,function(t){String.isNullOrUndefineOrBlank(t.OriginalPointsRedeem)&&(t.OriginalPointsRedeem=t.pointsRedeem);var i=Math.round(t.OriginalPointsRedeem*(t.IsPartial?_onlineCheckout.parseTodecimal(t.Quantity,2):parseInt(t.Quantity)));if(i>0&&o>=i&&o>0)if(_onlineCheckout.isValidForCheckoutInvoice()&&void 0!==t.isPresetApply&&1==t.isPresetApply);else{if(!String.isNullOrUndefineOrBlank(t.isMembershipApply)&&1==t.isMembershipApply){o-=i;var a=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==t.MasterInventoryId});String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,h,t.autoId):_onlineCheckout.RemoveDicount(d.Product,h,a[0].autoId)}if(!String.isNullOrUndefineOrBlank(t.isPackageApplied)&&1==t.isPackageApplied){o-=i;a=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==t.MasterInventoryId});String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,u,t.autoId):_onlineCheckout.RemoveDicount(d.Product,u,a[0].autoId)}}else if(t.OriginalPointsRedeem>0){if(!String.isNullOrUndefineOrBlank(t.isMembershipApply)&&1==t.isMembershipApply){o-=i;a=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==t.MasterInventoryId});String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,h,t.autoId):_onlineCheckout.RemoveDicount(d.Product,h,a[0].autoId)}if(!String.isNullOrUndefineOrBlank(t.isPackageApplied)&&1==t.isPackageApplied){o-=i;a=e.grep(onlineShoppingCart.Inventories,function(e){return e.InventoryId==t.MasterInventoryId});String.isNullOrUndefineOrBlank(a)?_onlineCheckout.RemoveDicount(d.Product,u,t.autoId):_onlineCheckout.RemoveDicount(d.Product,u,a[0].autoId)}}}),_onlineCheckout.isValidForCheckoutInvoice()&&null!=onlineShoppingCart.ServiceInvoice&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){var t=e.pointredeemOriginal;t>0&&o>=t&&o>0&&(o-=t,String.isNullOrUndefineOrBlank(e.isPackageApplied)||1!=e.isPackageApplied?1==e.isMembershipApply&&_onlineCheckout.RemoveDicount(d.ServiceInvoice,h,e.AppSrNo):_onlineCheckout.RemoveDicount(d.ServiceInvoice,u,e.AppSrNo))})})}},_onlineCheckout.RemoveExistingGC=function(t,i){if(_onlineCheckout.isValidForCheckoutInvoice()&&!isNullOrUndefineOrBlank(onlineShoppingCart.ServiceInvoice)&&onlineShoppingCart.ServiceInvoice.length>0&&e.grep(onlineShoppingCart.ServiceInvoice,function(e){e.isGCApply&&(e.GCDetail=[],e.isGCApply=!1,e.redeemAmt=0,e.redeemTax=0,e.redeemID=null,e.isServiceBaseGC=!1)}),!isNullOrUndefineOrBlank(onlineShoppingCart.Events)&&onlineShoppingCart.Events.length>0){var a=0;e.grep(onlineShoppingCart.Events,function(t){e.grep(t.eventEnrollment,function(t){if(null!=t.gcId&&t.gcId>0&&(1!=t.isPointApply||1==t.IsPartialPoint)&&(void 0===i||void 0!==i&&t.autoID==i)){var r=onlineShoppingCart.lstGCPkgData.filter(function(e){return e.giftCertificateID==t.gcId});r[0].currentBalance=r[0].currentBalance+t.redeemAmt,null!=r[0].quantity&&-1!=r[0].quantity&&(r[0].quantity+=1),a=t.gcId,t.gcId=null,t.GCDetail=[],t.isPriceBaseGCApply=!1,t.isGCApply=!1,t.isDecisionTaken=null,t.redeemAmt=0,t.redeemTax=0,t.isServiceBaseGC=!1,t.isMembershipRemove=!0}!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){if(null!=e.gcId&&e.gcId>0&&(1!=e.isPointApply||1==e.IsPartialPoint)){var t=onlineShoppingCart.lstGCPkgData.filter(function(t){return t.giftCertificateID==e.gcId});!String.isNullOrUndefineOrBlank(t.length)&&t.length>0&&(t[0].currentBalance=t[0].currentBalance+e.redeemAmt,null!=t[0].quantity&&-1!=t[0].quantity&&(t[0].quantity+=1),a=e.gcId,e.gcId=null,e.GCDetail=[],e.isPriceBaseGCApply=!1,e.isGCApply=!1,e.isDecisionTaken=null,e.redeemAmt=0,e.redeemTax=0,e.isServiceBaseGC=!1,e.isMembershipRemove=!0)}})})}),onlineShoppingCart.RedeemedByGCtemp=e.grep(onlineShoppingCart.RedeemedByGCtemp,function(e){return e.GCId!=a})}},_onlineCheckout.DisplayVPLCetegeyOrAffirm=function(t){1==_siteBuilderDetail.isAffirmEnable?1==t&&(e("#tabVagaroPayLaterCertegy").hide(),e("#tabVagaroPayLaterAffirm").show()):1==t&&(e("#tabVagaroPayLaterCertegy").show(),e("#tabVagaroPayLaterAffirm").hide())},_onlineCheckout.StartApplePaySession=function(){try{if(e(_onlineCheckout.Controls.tabApplePay).length>0&&e(_onlineCheckout.Controls.tabApplePay).is(":visible")&&e(_onlineCheckout.Controls.tabApplePay).hasClass("w--current")){var t=_onlineCheckout.GetApplePayAmount();paymentOpenPopup("applepay",t,_onlineCheckout.GPayApplePaySuccessResponse,_siteBuilderDetail.PaymentErrorHandler)}}catch(e){console.error("Apple Pay session init failed:",e)}return!0},_onlineCheckout.GetApplePayAmount=function(){try{if("undefined"!=typeof onlineShoppingCart&&null!=onlineShoppingCart&&void 0!==onlineShoppingCart.FinalCCAmount&&null!=onlineShoppingCart.FinalCCAmount&&!isNaN(onlineShoppingCart.FinalCCAmount))return parseFloat(onlineShoppingCart.FinalCCAmount);let t=e("#divfinalTotalPrice").text();if(!t||""===t.trim())throw new Error("Price text is empty");let i=t.replace(/[^0-9.]/g,"");if(!i||isNaN(i))throw new Error("Invalid price format: "+t);let a=parseFloat(i);if(isNaN(a))throw new Error("Price is not a number after parsing");return a}catch(e){console.error("Error while getting Apple Pay Amount:",e.message)}},_onlineCheckout.resetTipData=function(){"undefined"!=typeof _onlineCheckout&&(_onlineCheckout.TipAppliedSum=0,_onlineCheckout.TipApplyCounter=0)}}(jQuery,window,document),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery),jQuery.fn.pumselect2=jQuery.fn.select2}(function(e){var t=function(){if(e&&e.fn&&e.fn.select2&&e.fn.select2.amd)var t=e.fn.select2.amd;return function(){
/**
               * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
               * Available via the MIT or new BSD license.
               * see: http://github.com/jrburke/almond for details
               */
var e,i,a;t&&t.requirejs||(t?i=t:t={},function(t){var r,o,n,s,l={},d={},c={},u={},p=Object.prototype.hasOwnProperty,h=[].slice,m=/\.js$/;function f(e,t){return p.call(e,t)}function g(e,t){var i,a,r,o,n,s,l,d,u,p,h,f=t&&t.split("/"),g=c.map,v=g&&g["*"]||{};if(e&&"."===e.charAt(0))if(t){for(f=f.slice(0,f.length-1),n=(e=e.split("/")).length-1,c.nodeIdCompat&&m.test(e[n])&&(e[n]=e[n].replace(m,"")),e=f.concat(e),u=0;u<e.length;u+=1)if("."===(h=e[u]))e.splice(u,1),u-=1;else if(".."===h){if(1===u&&(".."===e[2]||".."===e[0]))break;u>0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((f||v)&&g){for(u=(i=e.split("/")).length;u>0;u-=1){if(a=i.slice(0,u).join("/"),f)for(p=f.length;p>0;p-=1)if((r=g[f.slice(0,p).join("/")])&&(r=r[a])){o=r,s=u;break}if(o)break;!l&&v&&v[a]&&(l=v[a],d=u)}!o&&l&&(o=l,s=d),o&&(i.splice(0,s,o),e=i.join("/"))}return e}function v(e,i){return function(){return o.apply(t,h.call(arguments,0).concat([e,i]))}}function A(e){return function(t){l[e]=t}}function C(e){if(f(d,e)){var i=d[e];delete d[e],u[e]=!0,r.apply(t,i)}if(!f(l,e)&&!f(u,e))throw new Error("No "+e);return l[e]}function y(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function b(e){return function(){return c&&c.config&&c.config[e]||{}}}n=function(e,t){var i,a=y(e),r=a[0];return e=a[1],r&&(i=C(r=g(r,t))),r?e=i&&i.normalize?i.normalize(e,function(e){return function(t){return g(t,e)}}(t)):g(e,t):(r=(a=y(e=g(e,t)))[0],e=a[1],r&&(i=C(r))),{f:r?r+"!"+e:e,n:e,pr:r,p:i}},s={require:function(e){return v(e)},exports:function(e){var t=l[e];return void 0!==t?t:l[e]={}},module:function(e){return{id:e,uri:"",exports:l[e],config:b(e)}}},r=function(e,i,a,r){var o,c,p,h,m,g,y=[],b=typeof a;if(r=r||e,"undefined"===b||"function"===b){for(i=!i.length&&a.length?["require","exports","module"]:i,m=0;m<i.length;m+=1)if("require"===(c=(h=n(i[m],r)).f))y[m]=s.require(e);else if("exports"===c)y[m]=s.exports(e),g=!0;else if("module"===c)o=y[m]=s.module(e);else if(f(l,c)||f(d,c)||f(u,c))y[m]=C(c);else{if(!h.p)throw new Error(e+" missing "+c);h.p.load(h.n,v(r,!0),A(c),{}),y[m]=l[c]}p=a?a.apply(l[e],y):void 0,e&&(o&&o.exports!==t&&o.exports!==l[e]?l[e]=o.exports:p===t&&g||(l[e]=p))}else e&&(l[e]=a)},e=i=o=function(e,i,a,l,d){if("string"==typeof e)return s[e]?s[e](i):C(n(e,i).f);if(!e.splice){if((c=e).deps&&o(c.deps,c.callback),!i)return;i.splice?(e=i,i=a,a=null):e=t}return i=i||function(){},"function"==typeof a&&(a=l,l=d),l?r(t,e,i,a):setTimeout(function(){r(t,e,i,a)},4),o},o.config=function(e){return o(e)},e._defined=l,(a=function(e,t,i){t.splice||(i=t,t=[]),f(l,e)||f(d,e)||(d[e]=[e,t,i])}).amd={jQuery:!0}}(),t.requirejs=e,t.require=i,t.define=a)}(),t.define("almond",function(){}),t.define("jquery",[],function(){var t=e||$;return null==t&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),t}),t.define("select2/utils",["jquery"],function(e){var t={};function i(e){var t=e.prototype,i=[];for(var a in t){"function"==typeof t[a]&&("constructor"!==a&&i.push(a))}return i}t.Extend=function(e,t){var i={}.hasOwnProperty;function a(){this.constructor=e}for(var r in t)i.call(t,r)&&(e[r]=t[r]);return a.prototype=t.prototype,e.prototype=new a,e.__super__=t.prototype,e},t.Decorate=function(e,t){var a=i(t),r=i(e);function o(){var i=Array.prototype.unshift,a=t.prototype.constructor.length,r=e.prototype.constructor;a>0&&(i.call(arguments,e.prototype.constructor),r=t.prototype.constructor),r.apply(this,arguments)}t.displayName=e.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<r.length;n++){var s=r[n];o.prototype[s]=e.prototype[s]}for(var l=function(e){var i=function(){};e in o.prototype&&(i=o.prototype[e]);var a=t.prototype[e];return function(){return Array.prototype.unshift.call(arguments,i),a.apply(this,arguments)}},d=0;d<a.length;d++){var c=a[d];o.prototype[c]=l(c)}return o};var a=function(){this.listeners={}};return a.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},a.prototype.trigger=function(e){var t=Array.prototype.slice;this.listeners=this.listeners||{},e in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},a.prototype.invoke=function(e,t){for(var i=0,a=e.length;i<a;i++)e[i].apply(this,t)},t.Observable=a,t.generateChars=function(e){for(var t="",i=0;i<e;i++){t+=Math.floor(36*Math.random()).toString(36)}return t},t.bind=function(e,t){return function(){e.apply(t,arguments)}},t._convertData=function(e){for(var t in e){var i=t.split("-"),a=e;if(1!==i.length){for(var r=0;r<i.length;r++){var o=i[r];(o=o.substring(0,1).toLowerCase()+o.substring(1))in a||(a[o]={}),r==i.length-1&&(a[o]=e[t]),a=a[o]}delete e[t]}}return e},t.hasScroll=function(t,i){var a=e(i),r=i.style.overflowX,o=i.style.overflowY;return(r!==o||"hidden"!==o&&"visible"!==o)&&("scroll"===r||"scroll"===o||(a.innerHeight()<i.scrollHeight||a.innerWidth()<i.scrollWidth))},t.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},t.appendMany=function(t,i){if("1.7"===e.fn.jquery.substr(0,3)){var a=e();e.map(i,function(e){a=a.add(e)}),i=a}t.append(i)},t}),t.define("select2/results",["jquery","./utils"],function(e,t){function i(e,t,a){this.$element=e,this.data=a,this.options=t,i.__super__.constructor.call(this)}return t.Extend(i,t.Observable),i.prototype.render=function(){var t=e('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t,t},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(t){var i=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var a=e('<li role="treeitem" class="select2-results__option"></li>'),r=this.options.get("translations").get(t.message);a.append(i(r(t.args))),this.$results.append(a)},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var i=0;i<e.results.length;i++){var a=e.results[i],r=this.option(a);t.push(r)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},i.prototype.position=function(e,t){t.find(".select2-results").append(e)},i.prototype.sort=function(e){return this.options.get("sorter")(e)},i.prototype.setClasses=function(){var t=this;this.data.current(function(i){var a=e.map(i,function(e){return e.id.toString()}),r=t.$results.find(".select2-results__option[aria-selected]");r.each(function(){var t=e(this),i=e.data(this,"data"),r=""+i.id;null!=i.element&&i.element.selected||null==i.element&&e.inArray(r,a)>-1?t.attr("aria-selected","true"):t.attr("aria-selected","false")});var o=r.filter("[aria-selected=true]");o.length>0?o.first().trigger("mouseenter"):r.first().trigger("mouseenter")})},i.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},i=this.option(t);i.className+=" loading-results",this.$results.prepend(i)},i.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},i.prototype.option=function(t){var i=document.createElement("li");try{var a=this.options.get("defaultselectedid")||"",r=this.options.get("addSelectedClass")||!1;null!=t.id&&t.id==a&&1==r?i.className="select2-results__option defaultselcteditem":i.className="select2-results__option"}catch(e){i.className="select2-results__option"}var o={role:"treeitem","aria-selected":"false"};for(var n in t.disabled&&(delete o["aria-selected"],o["aria-disabled"]="true"),null==t.id&&delete o["aria-selected"],null!=t._resultId&&(i.id=t._resultId),t.title&&(i.title=t.title),t.children&&(o.role="group",o["aria-label"]=t.text,delete o["aria-selected"]),o){var s=o[n];i.setAttribute(n,s)}if(t.children){var l=e(i),d=document.createElement("strong");d.className="select2-results__group down";e(d);this.template(t,d);for(var c=[],u=0;u<t.children.length;u++){var p=t.children[u],h=this.option(p);c.push(h)}var m=e("<ul></ul>",{class:"select2-results__options select2-results__options--nested",style:"display: block;"});m.append(c),l.append(d),l.append(m)}else this.template(t,i);return e.data(i,"data",t),i},i.prototype.bind=function(t,i){var a=this,r=t.id+"-results";this.$results.attr("id",r),t.on("results:all",function(e){a.clear(),a.append(e.data),t.isOpen()&&a.setClasses()}),t.on("results:append",function(e){a.append(e.data),t.isOpen()&&a.setClasses()}),t.on("query",function(e){a.showLoading(e)}),t.on("select",function(){t.isOpen()&&a.setClasses()}),t.on("unselect",function(){t.isOpen()&&a.setClasses()}),t.on("open",function(){a.$results.attr("aria-expanded","true"),a.$results.attr("aria-hidden","false"),a.setClasses(),a.ensureHighlightVisible()}),t.on("close",function(){a.$results.attr("aria-expanded","false"),a.$results.attr("aria-hidden","true"),a.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=a.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=a.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("aria-selected")?a.trigger("close"):a.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=a.getHighlightedResults(),t=a.$results.find("[aria-selected]"),i=t.index(e);if(0!==i){var r=i-1;0===e.length&&(r=0);var o=t.eq(r);o.trigger("mouseenter");var n=a.$results.offset().top,s=o.offset().top,l=a.$results.scrollTop()+(s-n);0===r?a.$results.scrollTop(0):s-n<0&&a.$results.scrollTop(l)}}),t.on("results:next",function(){var e=a.getHighlightedResults(),t=a.$results.find("[aria-selected]"),i=t.index(e)+1;if(!(i>=t.length)){var r=t.eq(i);r.trigger("mouseenter");var o=a.$results.offset().top+a.$results.outerHeight(!1),n=r.offset().top+r.outerHeight(!1),s=a.$results.scrollTop()+n-o;0===i?a.$results.scrollTop(0):n>o&&a.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){a.displayMessage(e)}),e.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=a.$results.scrollTop(),i=a.$results.get(0).scrollHeight-a.$results.scrollTop()+e.deltaY,r=e.deltaY>0&&t-e.deltaY<=0,o=e.deltaY<0&&i<=a.$results.height();r?(a.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):o&&(a.$results.scrollTop(a.$results.get(0).scrollHeight-a.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(t){var i=e(this),r=i.data("data");"true"!==i.attr("aria-selected")?a.trigger("select",{originalEvent:t,data:r}):a.options.get("multiple")?a.trigger("unselect",{originalEvent:t,data:r}):a.trigger("close")}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(t){var i=e(this).data("data");a.getHighlightedResults().removeClass("select2-results__option--highlighted"),a.trigger("results:focus",{data:i,element:e(this)})})},i.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},i.prototype.destroy=function(){this.$results.remove()},i.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),i=this.$results.offset().top,a=e.offset().top,r=this.$results.scrollTop()+(a-i),o=a-i;r-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(r)}},i.prototype.template=function(t,i){var a=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),o=a(t);null==o?i.style.display="none":"string"==typeof o?i.innerHTML=r(o):e(i).append(o)},i}),t.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),t.define("select2/selection/base",["jquery","../utils","../keys"],function(e,t,i){function a(e,t){this.$element=e,this.options=t,a.__super__.constructor.call(this)}return t.Extend(a,t.Observable),a.prototype.render=function(){var t=e('<span class="select2-selection" role="link"aria-autocomplete="list" aria-label="Any Instructor dropdown"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),t.attr("title",this.$element.attr("title")),t.attr("tabindex",this._tabindex),this.$selection=t,t},a.prototype.bind=function(e,t){var a=this,r=(e.id,e.id+"-results");this.container=e,this.$selection.on("focus",function(e){a.trigger("focus",e)}),this.$selection.on("blur",function(e){a.trigger("blur",e)}),this.$selection.on("keydown",function(e){a.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){a.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){a.update(e.data)}),e.on("open",function(){a.$selection.attr("aria-expanded","true"),a.$selection.attr("aria-owns",r),a._attachCloseHandler(e)}),e.on("close",function(){a.$selection.attr("aria-expanded","false"),a.$selection.removeAttr("aria-activedescendant"),a.$selection.removeAttr("aria-owns"),a.$selection.focus(),a._detachCloseHandler(e)}),e.on("enable",function(){a.$selection.attr("tabindex",a._tabindex)}),e.on("disable",function(){a.$selection.attr("tabindex","-1")})},a.prototype._attachCloseHandler=function(t){e(document.body).on("mousedown.select2."+t.id,function(t){var i=e(t.target).closest(".select2");e(".select2.select2-container--open").each(function(){var t=e(this);this!=i[0]&&t.data("element").select2("close")})})},a.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},a.prototype.position=function(e,t){t.find(".selection").append(e)},a.prototype.destroy=function(){this._detachCloseHandler(this.container)},a.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},a}),t.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,i,a){function r(){r.__super__.constructor.apply(this,arguments)}return i.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation" aria-hidden="true"><b role="presentation"></b></span>'),e},r.prototype.bind=function(e,t){var i=this;r.__super__.bind.apply(this,arguments);var a=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",a),this.$selection.attr("aria-labelledby",a),this.$selection.on("mousedown",function(e){1===e.which&&i.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),e.on("selection:update",function(e){i.update(e.data)})},r.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},r.prototype.display=function(e){var t=this.options.get("templateSelection");return this.options.get("escapeMarkup")(t(e))},r.prototype.selectionContainer=function(){return e("<span></span>")},r.prototype.update=function(e){if(0!==e.length){var t=e[0],i=this.display(t),a=this.$selection.find(".select2-selection__rendered");a.empty().append(i),a.prop("title",t.title||t.text)}else this.clear()},r}),t.define("select2/selection/multiple",["jquery","./base","../utils"],function(e,t,i){function a(e,t){a.__super__.constructor.apply(this,arguments)}return i.Extend(a,t),a.prototype.render=function(){var e=a.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},a.prototype.bind=function(t,i){var r=this;a.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(t){var i=e(this).parent().data("data");r.trigger("unselect",{originalEvent:t,data:i})})},a.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},a.prototype.display=function(e){var t=this.options.get("templateSelection");return this.options.get("escapeMarkup")(t(e))},a.prototype.selectionContainer=function(){return e('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>')},a.prototype.update=function(t){if(this.clear(),0!==(t=e.grep(t,function(e){return 0==e.disabled})).length){var a=[],r=this.$selection.find(".select2-selection__rendered");if(t.length>0){var o=0;if(this.$element.find("option").each(function(t){e(this).is(":disabled")||o++}),o==t.length)if("undefined"!=typeof SearchClsOrSrv&&null!=SearchClsOrSrv&&""!=SearchClsOrSrv)if(1==t.length)var n="<span>"+(t[0].title||t[0].text)+"</span>";else n="<span>Any "+SearchClsOrSrv+"</span>";else n="<span>All Selected</span>";else if(1==t.length)n="<span>"+(t[0].title||t[0].text)+"</span>";else if("undefined"!=typeof SearchClsOrSrv&&null!=SearchClsOrSrv&&""!=SearchClsOrSrv)n="<span>"+t.length+" "+SearchClsOrSrv+"s Selected</span>";else n="<span>"+t.length+" Selected</span>";r.empty().append(n)}else{for(var s=0;s<t.length;s++){var l=t[s],d=(n=this.display(l),this.selectionContainer());d.append(n),d.prop("title",l.title||l.text),d.data("data",l),a.push(d)}i.appendMany(r,a)}}},a}),t.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,i){this.placeholder=this.normalizePlaceholder(i.get("placeholder")),e.call(this,t,i)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var i=this.selectionContainer();return i.html(this.display(t)),i.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),i},t.prototype.update=function(e,t){var i=1==t.length&&t[0].id!=this.placeholder.id;if(t.length>1||i)return e.call(this,t);this.clear();var a=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(a)},t}),t.define("select2/selection/allowClear",["jquery","../keys"],function(e,t){function i(){}return i.prototype.bind=function(e,t,i){var a=this;e.call(this,t,i),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){a._handleClear(e)}),t.on("keypress",function(e){a._handleKeyboardClear(e,t)})},i.prototype._handleClear=function(e,t){if(!this.options.get("disabled")){var i=this.$selection.find(".select2-selection__clear");if(0!==i.length){t.stopPropagation();for(var a=i.data("data"),r=0;r<a.length;r++){var o={data:a[r]};if(this.trigger("unselect",o),o.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle")}}},i.prototype._handleKeyboardClear=function(e,i,a){a.isOpen()||i.which!=t.DELETE&&i.which!=t.BACKSPACE||this._handleClear(i)},i.prototype.update=function(t,i){if(t.call(this,i),!(this.$selection.find(".select2-selection__placeholder").length>0||0===i.length)){var a=e('<span class="select2-selection__clear">&times;</span>');a.data("data",i),this.$selection.find(".select2-selection__rendered").prepend(a)}},i}),t.define("select2/selection/search",["jquery","../utils","../keys"],function(e,t,i){function a(e,t,i){e.call(this,t,i)}return a.prototype.render=function(t){var i=e('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></li>');return this.$searchContainer=i,this.$search=i.find("input"),t.call(this)},a.prototype.bind=function(e,t,a){var r=this;e.call(this,t,a),1!=r.options.options.selectAll&&(t.on("open",function(){r.$search.attr("tabindex",0),r.$search.focus()}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.val(""),r.$search.focus()}),t.on("enable",function(){r.$search.prop("disabled",!1)}),t.on("disable",function(){r.$search.prop("disabled",!0)}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r.trigger("blur",e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===i.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(t.length>0){var a=t.data("data");r.searchRemoveChoice(a),e.preventDefault()}}}),this.$selection.on("input",".select2-search--inline",function(e){r.$selection.off("keyup.search")}),this.$selection.on("keyup.search input",".select2-search--inline",function(e){r.handleSearch(e)}))},a.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},a.prototype.update=function(e,t){this.$search.attr("placeholder",""),e.call(this,t),0==t.length&&this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch()},a.prototype.handleSearch=function(){if(1!=this.options.options.selectAll){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1}},a.prototype.searchRemoveChoice=function(e,t){1!=this.options.options.selectAll&&(this.trigger("unselect",{data:t}),this.trigger("open"),this.$search.val(t.text+" "))},a.prototype.resizeSearch=function(){if(1!=this.options.options.selectAll){this.$search.css("width","25px");var e="";if(""!==this.$search.attr("placeholder"))e=this.$selection.find(".select2-selection__rendered").innerWidth();else e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)}},a}),t.define("select2/selection/eventRelay",["jquery"],function(e){function t(){}return t.prototype.bind=function(t,i,a){var r=this,o=["open","opening","close","closing","select","selecting","unselect","unselecting"],n=["opening","closing","selecting","unselecting"];t.call(this,i,a),i.on("*",function(t,i){if(-1!==e.inArray(t,o)){i=i||{};var a=e.Event("select2:"+t,{params:i});r.$element.trigger(a),-1!==e.inArray(t,n)&&(i.prevented=a.isDefaultPrevented())}})},t}),t.define("select2/translation",["jquery","require"],function(e,t){function i(e){this.dict=e||{}}return i.prototype.all=function(){return this.dict},i.prototype.get=function(e){return this.dict[e]},i.prototype.extend=function(t){this.dict=e.extend({},t.all(),this.dict)},i._cache={},i.loadPath=function(e){if(!(e in i._cache)){var a=t(e);i._cache[e]=a}return new i(i._cache[e])},i}),t.define("select2/diacritics",[],function(){return{"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),t.define("select2/data/base",["../utils"],function(e){function t(e,i){t.__super__.constructor.call(this)}return e.Extend(t,e.Observable),t.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},t.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},t.prototype.bind=function(e,t){},t.prototype.destroy=function(){},t.prototype.generateResultId=function(t,i){var a=t.id+"-result-";return a+=e.generateChars(4),null!=i.id?a+="-"+i.id.toString():a+="-"+e.generateChars(4),a},t}),t.define("select2/data/select",["./base","../utils","jquery"],function(e,t,i){function a(e,t){this.$element=e,this.options=t,a.__super__.constructor.call(this)}return t.Extend(a,e),a.prototype.current=function(e){var t=[],a=this;this.$element.find(":selected").each(function(){var e=i(this),r=a.item(e);t.push(r)}),e(t)},a.prototype.select=function(e){var t=this;if(e.selected=!0,i(e.element).is("option"))return e.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(a){var r=[];(e=[e]).push.apply(e,a);for(var o=0;o<e.length;o++){var n=e[o].id;-1===i.inArray(n,r)&&r.push(n)}t.$element.val(r),t.$element.trigger("change")});else{var a=e.id;this.$element.val(a),this.$element.trigger("change")}},a.prototype.unselect=function(e){var t=this;if(this.$element.prop("multiple")){if(e.selected=!1,i(e.element).is("option"))return e.element.selected=!1,void this.$element.trigger("change");this.current(function(a){for(var r=[],o=0;o<a.length;o++){var n=a[o].id;n!==e.id&&-1===i.inArray(n,r)&&r.push(n)}t.$element.val(r),t.$element.trigger("change")})}},a.prototype.bind=function(e,t){var i=this;this.container=e,e.on("select",function(e){i.select(e.data)}),e.on("unselect",function(e){i.unselect(e.data)})},a.prototype.destroy=function(){this.$element.find("*").each(function(){i.removeData(this,"data")})},a.prototype.query=function(e,t){var a=[],r=this;this.$element.children().each(function(){var t=i(this);if(t.is("option")||t.is("optgroup")){var o=r.item(t),n=r.matches(e,o);null!==n&&a.push(n)}}),t({results:a})},a.prototype.addOptions=function(e){t.appendMany(this.$element,e)},a.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var a=i(t),r=this._normalizeItem(e);return r.element=t,i.data(t,"data",r),a},a.prototype.item=function(e){var t={};if(null!=(t=i.data(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var a=e.children("option"),r=[],o=0;o<a.length;o++){var n=i(a[o]),s=this.item(n);r.push(s)}t.children=r}return(t=this._normalizeItem(t)).element=e[0],i.data(e[0],"data",t),t},a.prototype._normalizeItem=function(e){i.isPlainObject(e)||(e={id:e,text:e});return null!=(e=i.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),i.extend({},{selected:!1,disabled:!1},e)},a.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},a}),t.define("select2/data/array",["./select","../utils","jquery"],function(e,t,i){function a(e,t){var i=t.get("data")||[];a.__super__.constructor.call(this,e,t),this.addOptions(this.convertToOptions(i))}return t.Extend(a,e),a.prototype.select=function(e){var t=this.$element.find("option").filter(function(t,i){return i.value==e.id.toString()});0===t.length&&(t=this.option(e),this.addOptions(t)),a.__super__.select.call(this,e)},a.prototype.convertToOptions=function(e){var a=this,r=this.$element.find("option"),o=r.map(function(){return a.item(i(this)).id}).get(),n=[];function s(e){return function(){return i(this).val()==e.id}}for(var l=0;l<e.length;l++){var d=this._normalizeItem(e[l]);if(i.inArray(d.id,o)>=0){var c=r.filter(s(d)),u=this.item(c),p=(i.extend(!0,{},u,d),this.option(u));c.replaceWith(p)}else{var h=this.option(d);if(d.children){var m=this.convertToOptions(d.children);t.appendMany(h,m)}n.push(h)}}return n},a}),t.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,i){function a(t,i){this.ajaxOptions=this._applyDefaults(i.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),e.__super__.constructor.call(this,t,i)}return t.Extend(a,e),a.prototype._applyDefaults=function(e){var t={data:function(e){return{q:e.term}},transport:function(e,t,a){var r=i.ajax(e);return r.then(t),r.fail(a),r}};return i.extend({},t,e,!0)},a.prototype.processResults=function(e){return e},a.prototype.query=function(e,t){var a=this;null!=this._request&&(i.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var r=i.extend({type:"GET"},this.ajaxOptions);function o(){var o=r.transport(r,function(r){var o=a.processResults(r,e);a.options.get("debug")&&window.console&&console.error&&(o&&o.results&&i.isArray(o.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),t(o)},function(){});a._request=o}"function"==typeof r.url&&(r.url=r.url(e)),"function"==typeof r.data&&(r.data=r.data(e)),this.ajaxOptions.delay&&""!==e.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(o,this.ajaxOptions.delay)):o()},a}),t.define("select2/data/tags",["jquery"],function(e){function t(t,i,a){var r=a.get("tags"),o=a.get("createTag");if(void 0!==o&&(this.createTag=o),t.call(this,i,a),e.isArray(r))for(var n=0;n<r.length;n++){var s=r[n],l=this._normalizeItem(s),d=this.option(l);this.$element.append(d)}}return t.prototype.query=function(e,t,i){var a=this;this._removeOldTags(),null!=t.term&&null==t.page?e.call(this,t,function e(r,o){for(var n=r.results,s=0;s<n.length;s++){var l=n[s],d=null!=l.children&&!e({results:l.children},!0);if(l.text===t.term||d)return!o&&(r.data=n,void i(r))}if(o)return!0;var c=a.createTag(t);if(null!=c){var u=a.option(c);u.attr("data-select2-tag",!0),a.addOptions([u]),a.insertTag(n,c)}r.results=n,i(r)}):e.call(this,t,i)},t.prototype.createTag=function(t,i){var a=e.trim(i.term);return""===a?null:{id:a,text:a}},t.prototype.insertTag=function(e,t,i){t.unshift(i)},t.prototype._removeOldTags=function(t){this._lastTag;this.$element.find("option[data-select2-tag]").each(function(){this.selected||e(this).remove()})},t}),t.define("select2/data/tokenizer",["jquery"],function(e){function t(e,t,i){var a=i.get("tokenizer");void 0!==a&&(this.tokenizer=a),e.call(this,t,i)}return t.prototype.bind=function(e,t,i){e.call(this,t,i),this.$search=t.dropdown.$search||t.selection.$search||i.find(".select2-search__field")},t.prototype.query=function(e,t,i){var a=this;t.term=t.term||"";var r=this.tokenizer(t,this.options,function(e){a.select(e)});r.term!==t.term&&(this.$search.length&&(this.$search.val(r.term),this.$search.focus()),t.term=r.term),e.call(this,t,i)},t.prototype.tokenizer=function(t,i,a,r){for(var o=a.get("tokenSeparators")||[],n=i.term,s=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};s<n.length;){var d=n[s];if(-1!==e.inArray(d,o)){var c=n.substr(0,s);r(l(e.extend({},i,{term:c}))),n=n.substr(s+1)||"",s=0}else s++}return{term:n}},t}),t.define("select2/data/minimumInputLength",[],function(){function e(e,t,i){this.minimumInputLength=i.get("minimumInputLength"),e.call(this,t,i)}return e.prototype.query=function(e,t,i){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,i)},e}),t.define("select2/data/maximumInputLength",[],function(){function e(e,t,i){this.maximumInputLength=i.get("maximumInputLength"),e.call(this,t,i)}return e.prototype.query=function(e,t,i){t.term=t.term||"",this.maximumInputLength>0&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,i)},e}),t.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,i){this.maximumSelectionLength=i.get("maximumSelectionLength"),e.call(this,t,i)}return e.prototype.query=function(e,t,i){var a=this;this.current(function(r){var o=null!=r?r.length:0;a.maximumSelectionLength>0&&o>=a.maximumSelectionLength?a.trigger("results:message",{message:"maximumSelected",args:{maximum:a.maximumSelectionLength}}):e.call(a,t,i)})},e}),t.define("select2/dropdown",["jquery","./utils"],function(e,t){function i(e,t){this.$element=e,this.options=t,i.__super__.constructor.call(this)}return t.Extend(i,t.Observable),i.prototype.render=function(){var t=e('<span class="select2-dropdown"><span class="select2-results"></span></span>');return t.attr("dir",this.options.get("dir")),this.$dropdown=t,t},i.prototype.position=function(e,t){},i.prototype.destroy=function(){this.$dropdown.remove()},i}),t.define("select2/dropdown/selectAll",["jquery","../utils"],function(e,t){function i(){}return i.prototype.render=function(t){var i=t.call(this),a=e('<span class="select2-search select2-selectAll--dropdown"><a href="javascript:void(0);" class="selectall">Select All</a><a href="javascript:void(0);" class="selectnone">Select None</a></span>');return this.$selectallContainer=a,this.$selectall=a.find("a.selectall"),this.$selectnone=a.find("a.selectnone"),i.prepend(a),i},i.prototype.bind=function(e,t,i){var a=this;e.call(this,t,i),this.$selectall.on("click",function(e){a.handleselectall(e)}),this.$selectnone.on("click",function(e){a.handleselectnone(e)})},i.prototype.handleselectall=function(t){this.$dropdown.find(".select2-results__option[aria-selected='false']").attr("aria-selected","true"),this.$element.find("option").attr("selected","selected");var i;i=e.map(this.$element.find("option"),function(t){if(0==t.disabled)return e(t).val().toString()}),this.$element.val(i),this.$element.trigger("change")},i.prototype.handleselectnone=function(e){this.$dropdown.find(".select2-results__option[aria-selected='true']").attr("aria-selected","false"),this.$element.find("option").removeAttr("selected"),this.$element.trigger("change",this.$element)},i}),t.define("select2/dropdown/search",["jquery","../utils"],function(e,t){function i(){}return i.prototype.render=function(t){var i=t.call(this),a=e('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=a,this.$search=a.find("input"),i.prepend(a),i},i.prototype.bind=function(t,i,a){var r=this;t.call(this,i,a),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()});var o=function(){return/MSIE\s/.test(navigator.userAgent)&&parseFloat(navigator.appVersion.split("MSIE")[1])<10};this.$search.on("input",function(t){0==o&&e(this).off("keyup")}),this.$search.on("keyup",function(t){o&&e(this).off("input")}),this.$search.on("keyup input",function(e){r.handleSearch(e),r.$search.focus()}),0==/iPad/i.test(navigator.userAgent)&&i.on("open",function(){r.$search.attr("tabindex",0),r.$search.focus(),window.setTimeout(function(){r.$search.focus()},0)}),i.on("close",function(){r.$search.attr("tabindex",-1),r.$search.val("")}),i.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))})},i.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},i.prototype.showSearch=function(e,t){return!0},i}),t.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,i,a){this.placeholder=this.normalizePlaceholder(i.get("placeholder")),e.call(this,t,i,a)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var i=t.slice(0),a=t.length-1;a>=0;a--){var r=t[a];this.placeholder.id===r.id&&i.splice(a,1)}return i},e}),t.define("select2/dropdown/infiniteScroll",["jquery"],function(e){function t(e,t,i,a){this.lastParams={},e.call(this,t,i,a),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return t.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},t.prototype.bind=function(t,i,a){var r=this;t.call(this,i,a),i.on("query",function(e){r.lastParams=e,r.loading=!0}),i.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",function(){var t=e.contains(document.documentElement,r.$loadingMore[0]);!r.loading&&t&&(r.$results.offset().top+r.$results.outerHeight(!1)+50>=r.$loadingMore.offset().top+r.$loadingMore.outerHeight(!1)&&r.loadMore())})},t.prototype.loadMore=function(){this.loading=!0;var t=e.extend({},{page:1},this.lastParams);t.page++,this.trigger("query:append",t)},t.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},t.prototype.createLoadingMore=function(){var t=e('<li class="option load-more" role="treeitem"></li>'),i=this.options.get("translations").get("loadingMore");return t.html(i(this.lastParams)),t},t}),t.define("select2/dropdown/attachBody",["jquery","../utils"],function(e,t){function i(e,t,i){this.$dropdownParent=i.get("dropdownParent")||document.body,e.call(this,t,i)}return i.prototype.bind=function(e,t,i){var a=this,r=!1;e.call(this,t,i),t.on("open",function(){a._showDropdown(),a._attachPositioningHandler(t),r||(r=!0,t.on("results:all",function(){a._positionDropdown(),a._resizeDropdown()}),t.on("results:append",function(){a._positionDropdown(),a._resizeDropdown()}))}),t.on("close",function(){a._hideDropdown(),a._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},i.prototype.position=function(e,t,i){t.attr("class",i.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open");var a=this.options.get("dropdownCssClass")||"";""!=a&&t.addClass(a),t.css({position:"absolute",top:-999999}),this.$container=i},i.prototype.render=function(t){var i=e("<span></span>"),a=t.call(this);return i.append(a),this.$dropdownContainer=i,i},i.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},i.prototype._attachPositioningHandler=function(i){var a=this,r="scroll.select2."+i.id,o="resize.select2."+i.id,n="orientationchange.select2."+i.id,s=this.$container.parents().filter(t.hasScroll);s.each(function(){e(this).data("select2-scroll-position",{x:e(this).scrollLeft(),y:e(this).scrollTop()})}),s.on(r,function(t){var i=e(this).data("select2-scroll-position");e(this).scrollTop(i.y)}),e(window).on(r+" "+o+" "+n,function(e){a._positionDropdown(),a._resizeDropdown()})},i.prototype._detachPositioningHandler=function(i){var a="scroll.select2."+i.id,r="resize.select2."+i.id,o="orientationchange.select2."+i.id;this.$container.parents().filter(t.hasScroll).off(a),e(window).off(a+" "+r+" "+o)},i.prototype._positionDropdown=function(){var t=e(window),i=this.$dropdown.hasClass("select2-dropdown--above"),a=this.$dropdown.hasClass("select2-dropdown--below"),r=null,o=(this.$container.position(),this.$container.offset());o.bottom=o.top+this.$container.outerHeight(!1);var n={height:this.$container.outerHeight(!1)};n.top=o.top,n.bottom=o.top+n.height;var s=this.$dropdown.outerHeight(!1),l=t.scrollTop(),d=t.scrollTop()+t.height(),c=l<o.top-s,u=d>o.bottom+s,p={left:o.left,top:n.bottom};i||a||(r="below"),u||!c||i?!c&&u&&i&&(r="below"):r="above",("above"==r||i&&"below"!==r)&&(p.top=n.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(p)},i.prototype._resizeDropdown=function(){this.$dropdownContainer.width();var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.width="auto"),this.$dropdown.css(e)},i.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},i}),t.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(t){for(var i=0,a=0;a<t.length;a++){var r=t[a];r.children?i+=e(r.children):i++}return i}function t(e,t,i,a){this.minimumResultsForSearch=i.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,i,a)}return t.prototype.showSearch=function(t,i){return!(e(i.data.results)<this.minimumResultsForSearch)&&t.call(this,i)},t}),t.define("select2/dropdown/selectOnClose",[],function(){function e(){}return e.prototype.bind=function(e,t,i){var a=this;e.call(this,t,i),t.on("close",function(){a._handleSelectOnClose()})},e.prototype._handleSelectOnClose=function(){var e=this.getHighlightedResults();e.length<1||this.trigger("select",{data:e.data("data")})},e}),t.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,i){var a=this;e.call(this,t,i),t.on("select",function(e){a._selectTriggered(e)}),t.on("unselect",function(e){a._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var i=t.originalEvent;i&&i.ctrlKey||this.trigger("close")},e}),t.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Please delete "+t+" character";return 1!=t&&(i+="s"),i},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),t.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./dropdown/selectAll","./i18n/en"],function(e,t,i,a,r,o,n,s,l,d,c,u,p,h,m,f,g,v,A,C,y,b,S,k,D,_,I,w,P,T){function B(){this.reset()}return B.prototype.apply=function(u){if(null==(u=e.extend({},this.defaults,u)).dataAdapter){if(null!=u.ajax?u.dataAdapter=m:null!=u.data?u.dataAdapter=h:u.dataAdapter=p,u.minimumInputLength>0&&(u.dataAdapter=d.Decorate(u.dataAdapter,v)),u.maximumInputLength>0&&(u.dataAdapter=d.Decorate(u.dataAdapter,A)),u.maximumSelectionLength>0&&(u.dataAdapter=d.Decorate(u.dataAdapter,C)),u.tags&&(u.dataAdapter=d.Decorate(u.dataAdapter,f)),null==u.tokenSeparators&&null==u.tokenizer||(u.dataAdapter=d.Decorate(u.dataAdapter,g)),null!=u.query){var T=t(u.amdBase+"compat/query");u.dataAdapter=d.Decorate(u.dataAdapter,T)}if(null!=u.initSelection){var B=t(u.amdBase+"compat/initSelection");u.dataAdapter=d.Decorate(u.dataAdapter,B)}}if(null==u.resultsAdapter&&(u.resultsAdapter=i,null!=u.ajax&&(u.resultsAdapter=d.Decorate(u.resultsAdapter,k)),null!=u.placeholder&&(u.resultsAdapter=d.Decorate(u.resultsAdapter,S)),u.selectOnClose&&(u.resultsAdapter=d.Decorate(u.resultsAdapter,I))),null==u.dropdownAdapter){var x=d.Decorate(y,b);u.dropdownAdapter=x,0!==u.minimumResultsForSearch&&(u.dropdownAdapter=d.Decorate(u.dropdownAdapter,_)),0!==u.selectAll&&(u.dropdownAdapter=d.Decorate(u.dropdownAdapter,P)),u.closeOnSelect&&(u.dropdownAdapter=d.Decorate(u.dropdownAdapter,w)),null!=u.dropdownCssClass||null!=u.dropdownCss||u.adaptDropdownCssClass,u.dropdownAdapter=d.Decorate(u.dropdownAdapter,D)}if(null==u.selectionAdapter){if(u.multiple?u.selectionAdapter=r:u.selectionAdapter=a,null!=u.placeholder&&(u.selectionAdapter=d.Decorate(u.selectionAdapter,o)),u.allowClear&&(u.selectionAdapter=d.Decorate(u.selectionAdapter,n)),u.multiple&&(u.selectionAdapter=d.Decorate(u.selectionAdapter,s)),null!=u.containerCssClass||null!=u.containerCss||null!=u.adaptContainerCssClass){var F=t(u.amdBase+"compat/containerCss");u.selectionAdapter=d.Decorate(u.selectionAdapter,F)}u.selectionAdapter=d.Decorate(u.selectionAdapter,l)}if("string"==typeof u.language)if(u.language.indexOf("-")>0){var O=u.language.split("-")[0];u.language=[u.language,O]}else u.language=[u.language];if(e.isArray(u.language)){var M=new c;u.language.push("en");for(var E=u.language,$=0;$<E.length;$++){var N=E[$],L={};try{L=c.loadPath(N)}catch(e){try{N=this.defaults.amdLanguageBase+N,L=c.loadPath(N)}catch(e){u.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+N+'" could not be automatically loaded. A fallback will be used instead.');continue}}M.extend(L)}u.translations=M}else{var U=c.loadPath(this.defaults.amdLanguageBase+"en"),R=new c(u.language);R.extend(U),u.translations=R}return u},B.prototype.reset=function(){function t(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return u[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:d.escapeMarkup,language:T,matcher:function i(a,r){if(""===e.trim(a.term))return r;if(r.children&&r.children.length>0){for(var o=e.extend(!0,{},r),n=r.children.length-1;n>=0;n--){null==i(a,r.children[n])&&o.children.splice(n,1)}return o.children.length>0?o:i(a,o)}var s=t(r.text).toUpperCase(),l=t(a.term).toUpperCase();return s.indexOf(l)>-1?r:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectAll:0,selectOnClose:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},B.prototype.set=function(t,i){var a={};a[e.camelCase(t)]=i;var r=d._convertData(a);e.extend(this.defaults,r)},new B}),t.define("select2/options",["require","jquery","./defaults","./utils"],function(e,t,i,a){function r(t,r){if(this.options=t,null!=r&&this.fromElement(r),this.options=i.apply(this.options),r&&r.is("input")){var o=e(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=a.Decorate(this.options.dataAdapter,o)}}return r.prototype.fromElement=function(e){var i=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.language&&(e.prop("lang")?this.options.language=e.prop("lang").toLowerCase():e.closest("[lang]").prop("lang")&&(this.options.language=e.closest("[lang]").prop("lang"))),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),e.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),e.data("data",e.data("select2Tags")),e.data("tags",!0)),e.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",e.data("ajaxUrl")),e.data("ajax--url",e.data("ajaxUrl")));var r={};r=t.fn.jquery&&"1."==t.fn.jquery.substr(0,2)&&e[0].dataset?t.extend(!0,{},e[0].dataset,e.data()):e.data();var o=t.extend(!0,{},r);for(var n in o=a._convertData(o))t.inArray(n,i)>-1||(t.isPlainObject(this.options[n])?t.extend(this.options[n],o[n]):this.options[n]=o[n]);return this},r.prototype.get=function(e){return this.options[e]},r.prototype.set=function(e,t){this.options[e]=t},r}),t.define("select2/core",["jquery","./options","./utils","./keys"],function(e,t,i,a){var r=function(e,i){null!=e.data("select2")&&e.data("select2").destroy(),this.$element=e,this.id=this._generateId(e),i=i||{},this.options=new t(i,e),r.__super__.constructor.call(this);var a=e.attr("tabindex")||0;e.data("old-tabindex",a),e.attr("tabindex","-1");var o=this.options.get("dataAdapter");this.dataAdapter=new o(e,this.options);var n=this.render();this._placeContainer(n);var s=this.options.get("selectionAdapter");this.selection=new s(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,n);var l=this.options.get("dropdownAdapter");this.dropdown=new l(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,n);var d=this.options.get("resultsAdapter");this.results=new d(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var c=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){c.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),e.data("select2",this)};return i.Extend(r,i.Observable),r.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+i.generateChars(2):i.generateChars(4))},r.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},r.prototype._resolveWidth=function(e,t){var i=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var a=this._resolveWidth(e,"style");return null!=a?a:this._resolveWidth(e,"element")}if("element"==t){var r=e.outerWidth(!1);return r<=0?"auto":r+"px"}if("style"==t){var o=e.attr("style");if("string"!=typeof o)return null;for(var n=o.split(";"),s=0,l=n.length;s<l;s+=1){var d=n[s].replace(/\s/g,"").match(i);if(null!==d&&d.length>=1)return d[1]}return null}return t},r.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},r.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this._sync=i.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var a=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=a?(this._observer=new a(function(i){e.each(i,t._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",t._sync,!1)},r.prototype._registerDataEvents=function(){var e=this;this.dataAdapter.on("*",function(t,i){e.trigger(t,i)})},r.prototype._registerSelectionEvents=function(){var t=this,i=["toggle"];this.selection.on("toggle",function(){t.toggleDropdown()}),this.selection.on("*",function(a,r){-1===e.inArray(a,i)&&t.trigger(a,r)})},r.prototype._registerDropdownEvents=function(){var e=this;this.dropdown.on("*",function(t,i){e.trigger(t,i)})},r.prototype._registerResultsEvents=function(){var e=this;this.results.on("*",function(t,i){e.trigger(t,i)})},r.prototype._registerEvents=function(){var e=this;this.on("open",function(){e.$container.addClass("select2-container--open");var t=this.options.get("dropdownCssClass")||"";""!=t&&e.$container.addClass(t)}),this.on("close",function(){e.$container.removeClass("select2-container--open");var t=this.options.get("dropdownCssClass")||"";""!=t&&e.$container.removeClass(t)}),this.on("enable",function(){e.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){e.$container.addClass("select2-container--disabled")}),this.on("focus",function(){e.$container.addClass("select2-container--focus")}),this.on("blur",function(){e.$container.removeClass("select2-container--focus")}),this.on("query",function(t){e.isOpen()||e.trigger("open"),this.dataAdapter.query(t,function(i){e.trigger("results:all",{data:i,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(i){e.trigger("results:append",{data:i,query:t})})}),this.on("keypress",function(t){var i=t.which;e.isOpen()?i===a.ENTER?(e.trigger("results:select"),t.preventDefault()):i===a.SPACE&&t.ctrlKey?(e.trigger("results:toggle"),t.preventDefault()):i===a.UP?(e.trigger("results:previous"),t.preventDefault()):i===a.DOWN?(e.trigger("results:next"),t.preventDefault()):i!==a.ESC&&i!==a.TAB||(e.close(),t.preventDefault()):(i===a.ENTER||i===a.SPACE||(i===a.DOWN||i===a.UP)&&t.altKey)&&(e.open(),t.preventDefault())})},r.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable")):this.trigger("enable")},r.prototype.trigger=function(e,t){var i=r.__super__.trigger,a={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(e in a){var o=a[e],n={prevented:!1,name:e,args:t};if(i.call(this,o,n),n.prevented)return void(t.prevented=!0)}i.call(this,e,t)},r.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},r.prototype.open=function(){this.isOpen()||(this.trigger("open"),this.trigger("query",{}))},r.prototype.close=function(){this.isOpen()&&this.trigger("close")},r.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},r.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},r.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var e=[];return this.dataAdapter.current(function(t){e=t}),e},r.prototype.val=function(t){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==t||0===t.length)return this.$element.val();var i=t[0];e.isArray(i)&&(i=e.map(i,function(e){return e.toString()})),this.$element.val(i).trigger("change")},r.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},r.prototype.render=function(){var t=e('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return t.attr("dir",this.options.get("dir")),this.$container=t,this.$container.addClass("select2-container--"+this.options.get("theme")),t.data("element",this.$element),t},r}),t.define("select2/compat/utils",["jquery"],function(e){return{syncCssClasses:function(t,i,a){var r,o,n=[];(r=e.trim(t.attr("class")))&&e((r=""+r).split(/\s+/)).each(function(){0===this.indexOf("select2-")&&n.push(this)}),(r=e.trim(i.attr("class")))&&e((r=""+r).split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(o=a(this))&&n.push(o)}),t.attr("class",n.join(" "))}}}),t.define("select2/compat/containerCss",["jquery","./utils"],function(e,t){function i(e){return null}function a(){}return a.prototype.render=function(a){var r=a.call(this),o=this.options.get("containerCssClass")||"";e.isFunction(o)&&(o=o(this.$element));var n=this.options.get("adaptContainerCssClass");if(n=n||i,-1!==o.indexOf(":all:")){o=o.replace(":all:","");var s=n;n=function(e){var t=s(e);return null!=t?t+" "+e:e}}var l=this.options.get("containerCss")||{};return e.isFunction(l)&&(l=l(this.$element)),t.syncCssClasses(r,this.$element,n),r.css(l),r.addClass(o),r},a}),t.define("select2/compat/dropdownCss",["jquery","./utils"],function(e,t){function i(e){return null}function a(){}return a.prototype.render=function(a){var r=a.call(this),o=this.options.get("dropdownCssClass")||"";e.isFunction(o)&&(o=o(this.$element));var n=this.options.get("adaptDropdownCssClass");if(n=n||i,-1!==o.indexOf(":all:")){o=o.replace(":all:","");var s=n;n=function(e){var t=s(e);return null!=t?t+" "+e:e}}var l=this.options.get("dropdownCss")||{};return e.isFunction(l)&&(l=l(this.$element)),t.syncCssClasses(r,this.$element,n),r.css(l),r.addClass(o),r},a}),t.define("jquery.select2",["jquery","require","./select2/core","./select2/defaults"],function(e,t,i,a){if(t("jquery.mousewheel"),null==e.fn.select2){var r=["open","close","destroy"];e.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var a=e.extend({},t,!0);new i(e(this),a)}),this;if("string"==typeof t){var a=this.data("select2");null==a&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2.");var o=Array.prototype.slice.call(arguments,1),n=a[t](o);return e.inArray(t,r)>-1?this:n}throw new Error("Invalid arguments for Select2: "+t)}}return null==e.fn.select2.defaults&&(e.fn.select2.defaults=a),i}),t.define("jquery.mousewheel",["jquery"],function(e){return e}),{define:t.define,require:t.require}}(),i=t.require("jquery.select2");return e.fn.select2.amd=t,i}),function(e){void 0===e.fn.each2&&e.extend(e.fn,{each2:function(t){for(var i=e([0]),a=-1,r=this.length;++a<r&&(i.context=i[0]=this[a])&&!1!==t.call(i[0],a,i););return this}})}(jQuery),function(){var e=!1,t=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){},Class.extend=function(i){var a=this.prototype;e=!0;var r=new this;for(var o in e=!1,i)r[o]="function"==typeof i[o]&&"function"==typeof a[o]&&t.test(i[o])?function(e,t){return function(){var i=this._super;this._super=a[e];var r=t.apply(this,arguments);return this._super=i,r}}(o,i[o]):i[o];function n(){!e&&this.init&&this.init.apply(this,arguments)}return n.prototype=r,n.prototype.constructor=n,n.extend=arguments.callee,n}}(),function(e,t){"use strict";if(window.Select2===t){var i,a,r,o,n,s,l,d,c,u={x:0,y:0},p={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case p.LEFT:case p.RIGHT:case p.UP:case p.DOWN:return!0}return!1},isControl:function(e){switch(e.which){case p.SHIFT:case p.CTRL:case p.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return(e=e.which?e.which:e)>=112&&e<=123}},h={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};l=e(document),c=1,n=function(){return c++},l.on("mousemove",function(e){u.x=e.pageX,u.y=e.pageY}),i=Class.extend({bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(i){var a,r,o,s,l,c=".select2-results";this.opts=i=this.prepareOpts(i),this.id=i.id,i.element.data("select2")!==t&&null!==i.element.data("select2")&&i.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(i.element.attr("id")||"autogen"+n()).replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.containerSelector="#"+this.containerId,this.container.attr("id",this.containerId),this.body=(o=function(){return i.element.closest("body")},l=!1,function(){return!1===l&&(s=o(),l=!0),s}),k(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",i.element.attr("style")),this.container.css(B(i.containerCss)),this.container.addClass(B(i.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").attr("aria-hidden",!0).before(this.container).on("click.select2",S),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),k(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(B(i.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",S),this.results=a=this.container.find(c),this.search=r=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",S),this.results.on("mousemove",function(i){var a=u;a!==t&&a.x===i.pageX&&a.y===i.pageY||e(i.target).trigger("mousemove-filtered",i)}),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",c,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchend",c,this.bind(this.selectHighlighted)),this.dropdown.on("touchmove",c,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",c,this.bind(this.clearTouchMoved)),function(e,t){var i=b(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){g(e.target,t.get())>=0&&i(e)})}(80,this.results),this.dropdown.on("scroll-debounced",c,this.bind(this.loadMoreIfNeeded)),e(this.container,this.dropdown).on("change",".select2-input",this.bind(function(t){t.stopPropagation(),e(t.target).trigger("native-change",t)})),e.fn.mousewheel&&a.mousewheel(function(e,t,i,r){var o=a.scrollTop();r>0&&o-r<=0?(a.scrollTop(0),S(e)):r<0&&a.get(0).scrollHeight-a.scrollTop()+r<=a.height()&&(a.scrollTop(a.get(0).scrollHeight-a.height()),S(e))}),y(r),r.on("keyup-change input paste",this.bind(this.updateResults)),r.on("focus",function(){r.addClass("select2-focused")}),r.on("blur",function(){r.removeClass("select2-focused")}),this.dropdown.on("mouseup",c,this.bind(function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==i.maximumInputLength&&this.search.attr("maxlength",i.maximumInputLength);var p=i.element.prop("disabled");p===t&&(p=!1),this.enable(!p);var h=i.element.prop("readonly");h===t&&(h=!1),this.readonly(h),d=d||function(){var t=e("<div class='select2-measure-scrollbar'></div>");t.appendTo("body");var i={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),i}(),this.autofocus=i.element.prop("autofocus"),i.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",i.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,i=e.data("select2");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),i!==t&&(i.container.remove(),i.liveRegion.remove(),i.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show())},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:v(e.attr("locked"),"locked")||v(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(i){var a,r,o,s,l=this;if("select"===(a=i.element).get(0).tagName.toLowerCase()&&(this.select=r=i.element),r&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in i)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),i=e.extend({},{populateResults:function(a,r,o){var s,d=this.opts.id,c=this.liveRegion,u=this.opts.collapasable,p=r.length;s=function(a,r,h,m){var f,g,v,A,C,y,b,S,k,D,_;for(f=0,g=(a=i.sortResults(a,r,o)).length;f<g;f+=1)A=!(C=!0===(v=a[f]).disabled)&&d(v)!==t,y=v.children&&v.children.length>0,_=!1,void 0!==v.IsDefault&&v.IsDefault?(_=!0,A=!0):_=!1,void 0!==v.children&&0==v.children.length&&0==_||(b=e("<li></li>"),1==u&&void 0!==m&&1==m&&(void 0!==v.isShow&&1==v.isShow?b.css("display",""):b.css("display","none")),b.addClass("select2-results-dept-"+h),b.addClass("select2-result"),b.addClass(A?"select2-result-selectable":"select2-result-unselectable"),C&&b.addClass("select2-disabled"),y&&b.addClass("select2-result-with-children"),_&&b.addClass("select2-result-with-children select2-hilight-title"),b.addClass(l.opts.formatResultCssClass(v)),b.attr("role","presentation"),S=e(document.createElement("div")),void 0!==v.serviceDisplayClass&&null!=v.serviceDisplayClass&&""!=v.serviceDisplayClass&&b.addClass(v.serviceDisplayClass),S.addClass("select2-result-label"),S.attr("id","select2-result-label-"+n()),S.attr("role","option"),(D=i.formatResult(v,S,o,l.opts.escapeMarkup))!==t&&(S.html(D),b.append(S)),y&&((k=e("<ul></ul>")).addClass("select2-result-sub text-primary"),s(v.children,k,h+1,!0),b.append(k)),b.data("select2-data",v),r.append(b),1==u&&1==y&&(b.off("click.custom"),b.on("click.custom",function(){e(this).find("li").is(":visible")?(e(this).find("li").hide(),e(this).removeClass("parentli-expanded")):(e(this).addClass("parentli-expanded"),e(this).find("li").show())}),1==p&&(b.addClass("parentli-expanded"),b.find("li").show())));c.text(i.formatMatches(a.length))},s(r,a,0)}},e.fn.select2.defaults,i),"function"!=typeof i.id&&(o=i.id,i.id=function(e){return e[o]}),e.isArray(i.element.data("select2Tags"))){if("tags"in i)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+i.element.attr("id");i.tags=i.element.data("select2Tags")}if(r?(i.query=this.bind(function(e){var i,r,o,n={results:[],more:!1},s=e.term;o=function(t,i){var a;t.is("option")?e.matcher(s,t.text(),t)&&i.push(l.optionToData(t)):t.is("optgroup")&&(a=l.optionToData(t),t.children().each2(function(e,t){o(t,a.children)}),a.children.length>0&&i.push(a))},i=a.children(),this.getPlaceholder()!==t&&i.length>0&&(r=this.getPlaceholderOption())&&(i=i.not(r)),i.each2(function(e,t){o(t,n.results)}),e.callback(n)}),i.id=function(e){return e.id}):"query"in i||("ajax"in i?((s=i.element.data("ajax-url"))&&s.length>0&&(i.ajax.url=s),i.query=I.call(i.element,i.ajax)):"data"in i?i.query=w(i.data):"tags"in i&&(i.query=P(i.tags),i.createSearchChoice===t&&(i.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),i.initSelection===t&&(i.initSelection=function(t,a){var r=[];e(A(t.val(),i.separator)).each(function(){var t={id:this,text:this},a=i.tags;e.isFunction(a)&&(a=a()),e(a).each(function(){if(v(this.id,t.id))return t=this,!1}),r.push(t)}),a(r)}))),"function"!=typeof i.query)throw"query function not defined for Select2 "+i.element.attr("id");if("top"===i.createSearchChoicePosition)i.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===i.createSearchChoicePosition)i.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof i.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return i},monitorSource:function(){var e,i,a=this.opts.element;a.on("change.select2",this.bind(function(e){!0!==this.opts.element.data("select2-change-triggered")&&this.initSelection()})),e=this.bind(function(){var e=a.prop("disabled");e===t&&(e=!1),this.enable(!e);var i=a.prop("readonly");i===t&&(i=!1),this.readonly(i),k(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(B(this.opts.containerCssClass)),k(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(B(this.opts.dropdownCssClass))}),a.on("propertychange.select2",e),this.mutationCallback===t&&(this.mutationCallback=function(t){t.forEach(e)}),(i=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new i(this.mutationCallback),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var i=e.Event("select2-selecting",{val:this.id(t),object:t});return this.opts.element.trigger(i),!i.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return!0===this.enabledInterface},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e!==this.enabledInterface&&(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,i,a,r,o,n=this.dropdown,s=this.container.offset(),l=this.container.outerHeight(!1),c=this.container.outerWidth(!1),u=n.outerHeight(!1),p=e(window),h=p.width(),m=p.height(),f=p.scrollLeft()+h,g=p.scrollTop()+m,v=s.top+l,A=s.left,C=v+u<=g,y=s.top-u>=p.scrollTop(),b=n.outerWidth(!1),S=A+b<=f;n.hasClass("select2-drop-above")?(i=!0,!y&&C&&(a=!0,i=!1)):(i=!1,!C&&y&&(a=!0,i=!0)),a&&(n.hide(),s=this.container.offset(),l=this.container.outerHeight(!1),c=this.container.outerWidth(!1),u=n.outerHeight(!1),f=p.scrollLeft()+h,g=p.scrollTop()+m,v=s.top+l,S=(A=s.left)+(b=n.outerWidth(!1))<=f,n.show()),this.opts.dropdownAutoWidth?(o=e(".select2-results",n)[0],n.addClass("select2-drop-auto-width"),n.css("width",""),(b=n.outerWidth(!1)+(o.scrollHeight===o.clientHeight?0:d.width))>c?c=b:b=c,S=A+b<=f):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body().css("position")&&(v-=(t=this.body().offset()).top,A-=t.left),S||(A=s.left+this.container.outerWidth(!1)-b),r={left:A,width:c},i?(r.top=s.top-u,r.bottom="auto",this.container.addClass("select2-drop-above"),n.addClass("select2-drop-above")):(r.top=v,r.bottom="auto",this.container.removeClass("select2-drop-above"),n.removeClass("select2-drop-above")),r=e.extend(r,B(this.opts.dropdownCss)),n.css(r)},shouldOpen:function(){var t;return!this.opened()&&(!1!==this._enabled&&!0!==this._readonly&&(t=e.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented()))},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return!!this.shouldOpen()&&(this.opening(),!0)},opening:function(){var t,i=this.containerId,a="scroll."+i,r="resize."+i,o="orientationchange."+i;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),0==(t=e("#select2-drop-mask")).length&&((t=e(document.createElement("div"))).attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body()),t.on("mousedown touchstart click",function(i){m(t);var a,r=e("#select2-drop");r.length>0&&((a=r.data("select2")).opts.selectOnBlur&&a.selectHighlighted({noFocus:!0}),"undefined"!=typeof _common&&void 0!==_common.closeServiceSelection&&_common.closeServiceSelection(),a.close(),i.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var n=this;this.container.parents().add(window).each(function(){e(this).on(r+" "+a+" "+o,function(e){n.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerId,i="scroll."+t,a="resize."+t,r="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(i).off(a).off(r)}),this.clearDropdownAlignmentPreference(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(e.Event("select2-close")),setTimeout(function(){e("#select2-drop-mask").hide()},400)}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return 0==this.opts.maximumSelectionSize?e("#select2-drop ul.select2-results").parent().addClass("selectbox-hide"):e("#select2-drop ul.select2-results").parent().removeClass("selectbox-hide"),B(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var t,i,a,r,o,n,s,l=this.results;(i=this.highlight())<0||(0!=i?(t=this.findHighlightableChoices().find(".select2-result-label"),r=(a=e(t[i])).offset().top+a.outerHeight(!0),i===t.length-1&&(s=l.find("li.select2-more-results")).length>0&&(r=s.offset().top+s.outerHeight(!0)),r>(o=l.offset().top+l.outerHeight(!0))&&l.scrollTop(l.scrollTop()+(r-o)),(n=a.offset().top-l.offset().top)<0&&"none"!=a.css("display")&&l.scrollTop(l.scrollTop()+n)):l.scrollTop(0))},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){for(var i=this.findHighlightableChoices(),a=this.highlight();a>=-1&&a<i.length;){var r=e(i[a+=t]);if(r.hasClass("select2-result-selectable")&&!r.hasClass("select2-disabled")&&!r.hasClass("select2-selected")){this.highlight(a);break}}},highlight:function(t){var i,a,r=this.findHighlightableChoices();if(0===arguments.length)return g(r.filter(".select2-highlighted")[0],r.get());t>=r.length&&(t=r.length-1),t<0&&(t=0),this.removeHighlight(),(i=e(r[t])).addClass("select2-highlighted"),this.ensureHighlightVisible(),this.liveRegion.text(i.text()),(a=i.data("select2-data"))&&this.opts.element.trigger({type:"select2-highlight",val:this.id(a),choice:a})},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var i=e(t.target).closest(".select2-result-selectable");if(i.length>0&&!i.is(".select2-highlighted")){var a=this.findHighlightableChoices();this.highlight(a.index(i))}else 0==i.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e=this.results,t=e.find("li.select2-more-results"),i=e.parent().find("li.select2-more-pager"),a=this.resultsPage+1,r=this,o=this.search.val(),n=this.context;0!==t.length&&t.offset().top-e.offset().top-e.height()<=this.opts.loadMorePadding&&(t.addClass("select2-active"),this.opts.query({element:this.opts.element,term:o,page:a,context:n,matcher:this.opts.matcher,callback:this.bind(function(s){r.opened()&&(r.opts.populateResults.call(this,e,s.results,{term:o,page:a,context:n}),r.postprocessResults(s,!1,!1),null!=i&&i.appendTo(e.parent()).text(B(r.opts.formatPager,a+1)),!0===s.more?(t.detach().appendTo(e).text(B(r.opts.formatLoadMore,a+1)),window.setTimeout(function(){r.loadMoreIfNeeded()},10)):t.remove(),r.positionDropdown(),r.resultsPage=a,r.context=s.context,this.opts.element.trigger({type:"select2-loaded",items:s}))})}))},tokenize:function(){},updateResults:function(i){var a,r,o,n=this.search,s=this.results,l=this.opts,d=this,c=n.val(),u=e.data(this.container,"select2-last-term");if((!0===i||!u||!v(c,u))&&(e.data(this.container,"select2-last-term",c),!0===i||!1!==this.showSearchInput&&this.opened())){o=++this.queryCount;var p=this.getMaximumSelectionSize();if(!(p>=1&&(a=this.data(),e.isArray(a)&&a.length>=p&&T(l.formatSelectionTooBig,"formatSelectionTooBig"))))return n.val().length<l.minimumInputLength?(T(l.formatInputTooShort,"formatInputTooShort")?(m("<li class='select2-no-results'>"+B(l.formatInputTooShort,n.val(),l.minimumInputLength)+"</li>"),e(".select2-more-pager").remove()):m(""),void(i&&this.showSearch&&this.showSearch(!0))):void(l.maximumInputLength&&n.val().length>l.maximumInputLength?T(l.formatInputTooLong,"formatInputTooLong")?m("<li class='select2-no-results'>"+B(l.formatInputTooLong,n.val(),l.maximumInputLength)+"</li>"):m(""):(l.formatSearching&&this.findHighlightableChoices().length<=10&&m("<li class='select2-searching'>"+B(l.formatSearching)+"</li>"),n.addClass("select2-active"),this.removeHighlight(),(r=this.tokenize())!=t&&null!=r&&n.val(r),this.resultsPage=1,l.query({element:l.element,term:n.val(),page:this.resultsPage,context:null,matcher:l.matcher,callback:this.bind(function(a){var r;if(o==this.queryCount)if(this.opened()){if(this.context=a.context===t?null:a.context,this.opts.createSearchChoice&&""!==n.val()&&(r=this.opts.createSearchChoice.call(d,n.val(),a.results))!==t&&null!==r&&d.id(r)!==t&&null!==d.id(r)&&0===e(a.results).filter(function(){return v(d.id(this),d.id(r))}).length&&this.opts.createSearchChoicePosition(a.results,r),0===a.results.length&&T(l.formatNoMatches,"formatNoMatches"))return"s2id_txtSearchServiceMain"==this.containerId||"s2id_ddlLiveStreamClass"==this.containerId||"s2id_ddlServices"==this.containerId||"s2id_txtMobileService"==this.containerId?m(B(l.formatEmptyMessage,n.val())):m("<li class='select2-no-results'>"+B(l.formatNoMatches,n.val())+"</li>"),void s.parent().find("li.select2-more-pager").remove();s.empty(),s.parent().find("li.select2-more-pager").remove(),d.opts.populateResults.call(this,s,a.results,{term:n.val(),page:this.resultsPage,context:null}),!0===a.more&&T(l.formatLoadMore,"formatLoadMore")&&(s.append("<li class='select2-more-results'>"+d.opts.escapeMarkup(B(l.formatLoadMore,this.resultsPage))+"</li>"),s.parent().append("<li class='select2-more-pager'>"+d.opts.escapeMarkup(B(l.formatPager,this.resultsPage))+"</li>"),window.setTimeout(function(){d.loadMoreIfNeeded()},10)),this.postprocessResults(a,i),h(),this.opts.element.trigger({type:"select2-loaded",items:a})}else this.search.removeClass("select2-active")})})));m("<li class='select2-selection-limit'>"+B(l.formatSelectionTooBig,p)+"</li>")}function h(){n.removeClass("select2-active"),d.positionDropdown(),s.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?d.liveRegion.text(s.text()):d.liveRegion.text(d.opts.formatMatches(s.find(".select2-result-selectable").length))}function m(e){s.html(e),h()}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){var e;(e=this.search)[0]!==document.activeElement&&window.setTimeout(function(){var t,i=e[0],a=e.val().length;e.focus(),(i.offsetWidth>0||i.offsetHeight>0)&&i===document.activeElement&&(i.setSelectionRange?i.setSelectionRange(a,a):i.createTextRange&&((t=i.createTextRange()).collapse(!1),t.select()))},0)},selectHighlighted:function(e){if(this._touchMoved)this.clearTouchMoved();else{var i=this.highlight(),a=this.results.find(".select2-highlighted").closest(".select2-result").data("select2-data");a?(this.highlight(i),this.onSelect(a,e)):e&&e.noFocus&&this.close(),"s2id_txtSearchServiceMain"!=this.containerId&&"s2id_ddlLiveStreamClass"!=this.containerId&&"s2id_ddlServices"!=this.containerId&&"s2id_txtMobileService"!=this.containerId||e==t&&this.close()}},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==t?e.text():t)},getPlaceholderOption:function(){if(this.select){var i=this.select.children("option").first();if(this.opts.placeholderOption!==t)return"first"===this.opts.placeholderOption&&i||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===e.trim(i.text())&&""===i.val())return i}},initContainerWidth:function(){var i=function(){var i,a,r,o,n;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if((i=this.opts.element.attr("style"))!==t)for(o=0,n=(a=i.split(";")).length;o<n;o+=1)if(null!==(r=a[o].replace(/\s/g,"").match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i))&&r.length>=1)return r[1];return"resolve"===this.opts.width?(i=this.opts.element.css("width")).indexOf("%")>0?i:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px":null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}.call(this);null!==i&&this.container.css("width",i)}}),a=i.extend({createContainer:function(){return e(document.createElement("div")).attr({class:"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>","   <span class='select2-chosen'>&nbsp;</span><abbr class='select2-search-choice-close'></abbr>","   <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>","   <div class='select2-search' style='display:none;'>","       <label for='' class='select2-offscreen'></label>","       <input type='text' autocomplete='false' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input text-primary' role='combobox' aria-expanded='true'","       aria-autocomplete='list' />","   </div>","   <ul class='select2-results' role='listbox'>","   </ul>","</div>"].join(""))},enableInterface:function(){this._super.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var i,a,r;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this._super.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.search.focus(),(i=this.search.get(0)).createTextRange?((a=i.createTextRange()).collapse(!1),a.select()):i.setSelectionRange&&(r=this.search.val().length,i.setSelectionRange(r,r)),""===this.search.val()&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&(this._super.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this._super.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){e("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this._super.apply(this,arguments)},initContainer:function(){var t,i,a=this.container,r=this.dropdown,o=n();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=a.find(".select2-choice"),this.focusser=a.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+o),this.focusser.attr("aria-labelledby","select2-chosen-"+o),this.results.attr("id","select2-results-"+o),this.search.attr("aria-owns","select2-results-"+o),this.focusser.attr("id","s2id_autogen"+o),i=e("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(i.text()).attr("for",this.focusser.attr("id"));var s=this.opts.element.attr("title");this.opts.element.attr("title",s||i.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(e("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled())if(e.which!==p.PAGE_UP&&e.which!==p.PAGE_DOWN)switch(e.which){case p.UP:case p.DOWN:return this.moveHighlight(e.which===p.UP?-1:1),void S(e);case p.ENTER:return this.selectHighlighted(),void S(e);case p.TAB:return void this.selectHighlighted({noFocus:!0});case p.ESC:return this.cancel(e),void S(e)}else S(e)})),this.search.on("blur",this.bind(function(e){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==p.TAB&&!p.isControl(e)&&!p.isFunctionKey(e)&&e.which!==p.ESC){if(!1!==this.opts.openOnEnter||e.which!==p.ENTER){if(e.which==p.DOWN||e.which==p.UP||e.which==p.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void S(e)}return e.which==p.DELETE||e.which==p.BACKSPACE?(this.opts.allowClear&&this.clear(),void S(e)):void 0}S(e)}})),y(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){this.isInterfaceEnabled()&&(this.clear(),function(e){e.preventDefault(),e.stopImmediatePropagation()}(e),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(i){m(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),S(i)})),r.on("mousedown touchstart",this.bind(function(){this.search.focus()})),t.on("focus",this.bind(function(e){S(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(e.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(t){var i=this.selection.data("select2-data");if(i){var a=e.Event("select2-clearing");if(this.opts.element.trigger(a),a.isDefaultPrevented())return;var r=this.getPlaceholderOption();this.opts.element.val(r?r.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==t&&(this.opts.element.trigger({type:"select2-removed",val:this.id(i),choice:i}),this.triggerChange({removed:i}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.setPlaceholder(),e.nextSearchTerm=e.opts.nextSearchTerm(i,e.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return!!this.getPlaceholder()&&((e=this.getPlaceholderOption())!==t&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===t||null===this.opts.element.val())},prepareOpts:function(){var t=this._super.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var a=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(a))}:"data"in t&&(t.initSelection=t.initSelection||function(i,a){var r=i.val(),o=null;t.query({matcher:function(e,i,a){var n=v(r,t.id(a));return n&&(o=a),n},callback:e.isFunction(a)?function(){a(o)}:e.noop})}),t},getPlaceholder:function(){if(this.select&&this.getPlaceholderOption()===t)return t;this._super.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,i){var a=0,r=this;if(this.findHighlightableChoices().each2(function(e,t){if(v(r.id(t.data("select2-data")),r.opts.element.val()))return a=e,!1}),!1!==i&&(!0===t&&a>=0?this.highlight(a):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;o>=0&&this.showSearch(x(e.results)>=o)}},showSearch:function(t){this.showSearchInput!==t&&(this.showSearchInput=t,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t),e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t))},onSelect:function(e,t){if(this.triggerSelect(e)){var i=this.opts.element.val(),a=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),t&&t.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),v(i,this.id(e))||this.triggerChange({added:e,removed:a})}},updateSelection:function(e){var i,a,r=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),r.empty(),null!==e&&(i=this.opts.formatSelection(e,r,this.opts.escapeMarkup)),i!==t&&r.append(i),(a=this.opts.formatSelectionCssClass(e,r))!==t&&r.addClass(a),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,i=!1,a=null,r=this,o=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],arguments.length>1&&(i=arguments[1]),this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return a=r.optionToData(t),!1}),this.updateSelection(a),this.setPlaceholder(),i&&this.triggerChange({added:a,removed:o});else{if(!e&&0!==e)return void this.clear(i);if(this.opts.initSelection===t)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){r.opts.element.val(e?r.id(e):""),r.updateSelection(e),r.setPlaceholder(),i&&r.triggerChange({added:e,removed:o})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var i,a=!1;if(0===arguments.length)return(i=this.selection.data("select2-data"))==t&&(i=null),i;arguments.length>1&&(a=arguments[1]),e?(i=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),a&&this.triggerChange({added:e,removed:i})):this.clear(a)}}),r=i.extend({createContainer:function(){var t="<input type='text' autocomplete='true' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input standrad-maphour-block'";return t+=">",e(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>","  <li class='select2-search-field other'>","    <label for='' class='select2-offscreen' aria-hidden='true'></label>",t,"  </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""))},prepareOpts:function(){var t=this._super.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var a=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){a.push(i.optionToData(t))}),t(a)}:"data"in t&&(t.initSelection=t.initSelection||function(i,a){var r=A(i.val(),t.separator),o=[];t.query({matcher:function(i,a,n){var s=e.grep(r,function(e){return v(e,t.id(n))}).length;return s&&o.push(n),s},callback:e.isFunction(a)?function(){for(var e=[],i=0;i<r.length;i++)for(var n=r[i],s=0;s<o.length;s++){var l=o[s];if(v(n,t.id(l))){e.push(l),o.splice(s,1);break}}a(e)}:e.noop})}),t},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");t.length&&e&&e[0]==t[0]||(t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),e&&e.length&&(this.close(),e.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",e)))},destroy:function(){e("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this._super.apply(this,arguments)},initContainer:function(){var t,i=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=t=this.container.find(i);var a=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(t){a.search[0].focus(),a.selectChoice(e(this))}),this.search.attr("id","s2id_autogen"+n()),this.search.attr("role","combobox"),this.search.attr("aria-autocomplete","list"),this.search.attr("aria-expanded","false"),this.search.attr("aria-controls","select2-drop"),this.search.prev().text(e("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(i){if(this.isInterfaceEnabled()){++this.keydowns;var a=t.find(".select2-search-choice-focus"),r=a.prev(".select2-search-choice:not(.select2-locked)"),o=a.next(".select2-search-choice:not(.select2-locked)"),n=function(t){var i=0,a=0;if("selectionStart"in(t=e(t)[0]))i=t.selectionStart,a=t.selectionEnd-i;else if("selection"in document){t.focus();var r=document.selection.createRange();a=document.selection.createRange().text.length,r.moveStart("character",-t.value.length),i=r.text.length-a}return{offset:i,length:a}}(this.search);if(a.length&&(i.which==p.LEFT||i.which==p.RIGHT||i.which==p.BACKSPACE||i.which==p.DELETE||i.which==p.ENTER)){var s=a;return i.which==p.LEFT&&r.length?s=r:i.which==p.RIGHT?s=o.length?o:null:i.which===p.BACKSPACE?this.unselect(a.first())&&(this.search.width(10),s=r.length?r:o):i.which==p.DELETE?this.unselect(a.first())&&(this.search.width(10),s=o.length?o:null):i.which==p.ENTER&&(s=null),this.selectChoice(s),S(i),void(s&&s.length||this.open())}if((i.which===p.BACKSPACE&&1==this.keydowns||i.which==p.LEFT)&&0==n.offset&&!n.length)return this.selectChoice(t.find(".select2-search-choice:not(.select2-locked)").last()),void S(i);if(this.selectChoice(null),this.opened())switch(i.which){case p.UP:case p.DOWN:return this.moveHighlight(i.which===p.UP?-1:1),void S(i);case p.ENTER:if(this.selectHighlighted(),"s2id_txtSearchServiceMain"==this.containerId&&"undefined"!=typeof _common&&void 0!==_common.GetChoiceForSeleect2){var l=_common.GetChoiceForSeleect2(e("#txtSearchServiceMain")).text;void 0!==l&&""!=l&&"undefined"!=typeof _common&&void 0!==_common.SetLocationBySearch&&_common.SetLocationBySearch(i)}return void S(i);case p.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case p.ESC:return this.cancel(i),void S(i)}if(i.which!==p.TAB&&!p.isControl(i)&&!p.isFunctionKey(i)&&i.which!==p.BACKSPACE&&i.which!==p.ESC){if(i.which===p.ENTER){if(!1===this.opts.openOnEnter)return;if(i.altKey||i.ctrlKey||i.shiftKey||i.metaKey)return}this.open(),i.which!==p.PAGE_UP&&i.which!==p.PAGE_DOWN||S(i),i.which===p.ENTER&&S(i)}}})),this.search.on("keyup",this.bind(function(e){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(t){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),t.stopImmediatePropagation(),this.opts.element.trigger(e.Event("select2-blur"))})),this.container.on("click",i,this.bind(function(t){this.isInterfaceEnabled()&&(e(t.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.open(),this.focusSearch(),t.preventDefault()))})),this.container.on("focus",i,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active vagaro-dropdown-multilayer"),null!=document.getElementById("divLiveStreamLocationSearchPopUp")&&"undefind"!=typeof document.getElementById("divLiveStreamLocationSearchPopUp")&&"block"==document.getElementById("divLiveStreamLocationSearchPopUp").style.display&&this.dropdown.addClass("select-list-popup"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this._super.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),i=this.getMaxSearchWidth();e!==t&&0===this.getVal().length&&!1===this.search.hasClass("select2-focused")?(this.search.val(e).addClass("select2-default"),this.search.width(i>0?i:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this._super.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&this._super.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var i=[],a=[],r=this;e(t).each(function(){g(r.id(this),i)<0&&(i.push(r.id(this)),a.push(this))}),t=a,this.selection.find(".select2-search-choice").remove(),e(t).each(function(){r.addSelectedChoice(this)}),r.postprocessResults()},tokenize:function(){var e=this.search.val();null!=(e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts))&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e,i){this.triggerSelect(e)&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.clearSearch(),this.updateResults(),!this.select&&this.opts.closeOnSelect||this.postprocessResults(e,!1,!0===this.opts.closeOnSelect),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),i&&i.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(i){var a,r,o=!i.locked,n=e("<li class='select2-search-choice'>    <div></div>    <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),s=e("<li class='select2-search-choice select2-locked'><div></div></li>"),l=o?n:s,d=this.id(i),c=this.getVal();(a=this.opts.formatSelection(i,l.find("div"),this.opts.escapeMarkup))!=t&&l.find("div").replaceWith("<div>"+a+"</div>"),(r=this.opts.formatSelectionCssClass(i,l.find("div")))!=t&&l.addClass(r),o&&l.find(".select2-search-choice-close").on("mousedown",S).on("click dblclick",this.bind(function(t){this.isInterfaceEnabled()&&(this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),S(t),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),l.data("select2-data",i),l.insertBefore(this.searchContainer),c.push(d),this.setVal(c)},unselect:function(t){var i,a,r=this.getVal();if(0===(t=t.closest(".select2-search-choice")).length)throw"Invalid argument: "+t+". Must be .select2-search-choice";if(i=t.data("select2-data")){var o=e.Event("select2-removing");if(o.val=this.id(i),o.choice=i,this.opts.element.trigger(o),o.isDefaultPrevented())return!1;for(;(a=g(this.id(i),r))>=0;)r.splice(a,1),this.setVal(r),this.select&&this.postprocessResults();return t.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(i),choice:i}),this.triggerChange({removed:i}),!0}},postprocessResults:function(e,t,i){var a=this.getVal(),r=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),n=this;r.each2(function(e,t){g(n.id(t.data("select2-data")),a)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),-1==this.highlight()&&!1!==i&&("s2id_txtSearchServiceMain"==this.containerId||"s2id_ddlLiveStreamClass"==this.containerId||"s2id_ddlServices"==this.containerId||"s2id_txtMobileService"==this.containerId||n.highlight(0)),!this.opts.createSearchChoice&&!r.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&T(n.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+B(n.opts.formatNoMatches,n.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-C(this.search)},resizeSearch:function(){var t,i,a,r,o=C(this.search);t=function(t){if(!s){var i=t[0].currentStyle||window.getComputedStyle(t[0],null);(s=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:i.fontSize,fontFamily:i.fontFamily,fontStyle:i.fontStyle,fontWeight:i.fontWeight,letterSpacing:i.letterSpacing,textTransform:i.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),e("body").append(s)}return s.text(t.val()),s.width()}(this.search)+10,i=this.search.offset().left,(r=(a=this.selection.width())-(i-this.selection.offset().left)-o)<t&&(r=a-o),r<40&&(r=a-o),r<=0&&(r=t),this.search.width(Math.floor(r))},getVal:function(){var e;return this.select?null===(e=this.select.val())?[]:e:A(e=this.opts.element.val(),this.opts.separator)},setVal:function(t){var i;this.select?this.select.val(t):(i=[],e(t).each(function(){g(this,i)<0&&i.push(this)}),this.opts.element.val(0===i.length?"":i.join(this.opts.separator)))},buildChangeDetails:function(e,t){t=t.slice(0),e=e.slice(0);for(var i=0;i<t.length;i++)for(var a=0;a<e.length;a++)v(this.opts.id(t[i]),this.opts.id(e[a]))&&(t.splice(i,1),i>0&&i--,e.splice(a,1),a--);return{added:t,removed:e}},val:function(i,a){var r,o=this;if(0===arguments.length)return this.getVal();if((r=this.data()).length||(r=[]),!i&&0!==i)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(a&&this.triggerChange({added:this.data(),removed:r}));if(this.setVal(i),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),a&&this.triggerChange(this.buildChangeDetails(r,this.data()));else{if(this.opts.initSelection===t)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(t){var i=e.map(t,o.id);o.setVal(i),o.updateSelection(t),o.clearSearch(),a&&o.triggerChange(o.buildChangeDetails(r,o.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var t=[],i=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(i.opts.id(e(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(t,i){var a,r,o=this;if(0===arguments.length)return this.selection.children(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get();r=this.data(),t||(t=[]),a=e.map(t,function(e){return o.opts.id(e)}),this.setVal(a),this.updateSelection(t),this.clearSearch(),i&&this.triggerChange(this.buildChangeDetails(r,this.data()))}}),o=r.extend({initContainer:function(){this._super.apply(this,arguments),this.search.on("native-change",this.bind(this.triggerChange)).on("input paste",this.bind(function(){this.setVal(this.search.val())}))},clearSearch:function(){},onSelect:function(e,t){this.triggerSelect(e)&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),!this.select&&this.opts.closeOnSelect||this.postprocessResults(e,!1,!0===this.opts.closeOnSelect),this.opts.closeOnSelect&&this.close(),this.triggerChange({added:e}))},addSelectedChoice:function(e){this.setVal(e.text),this.search.val(e.text)},setVal:function(e){this.select?this.select.val(e):this.opts.element.val(e)}}),e.fn.select2=function(){var i,a,r,o,n,s=Array.prototype.slice.call(arguments,0),l=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search","onSelect"],d=["opened","isFocused","container","dropdown"],c=["val","data"],u={search:"externalSearch"};return this.each(function(){if(0===s.length||"object"==typeof s[0]){if((i=0===s.length?{}:e.extend({},s[0])).element=e(this),i.combobox)return void new window.Select2.class.combobox(i);"select"===i.element.get(0).tagName.toLowerCase()?n=i.element.prop("multiple"):(n=i.multiple||!1,"tags"in i&&(i.multiple=n=!0)),a=n?new window.Select2.class.multi(i):new window.Select2.class.single(i)}else{if("string"!=typeof s[0])throw"Invalid arguments to select2 plugin: "+s;if(g(s[0],l)<0)throw"Unknown method: "+s[0];if(o=t,(a=e(this).data("select2"))===t)return;if("container"===(r=s[0])?o=a.container:"dropdown"===r?o=a.dropdown:(u[r]&&(r=u[r]),o=a[r].apply(a,s.slice(1))),g(s[0],d)>=0||g(s[0],c)&&1==s.length)return!1}}),o===t?this:o},e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,i,a){var r=[];return D(e.text,i.term,r,a),r.join("")},formatSelection:function(e,i,a){return e?a(e.text):t},sortResults:function(e,t,i){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(e,i){return t},formatMatches:function(e){return e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatEmptyMessage:function(){return""},formatInputTooShort:function(e,t){var i=t-e.length;return"Please enter "+i+" or more character"+(1==i?"":"s")},formatInputTooLong:function(e,t){var i=e.length-t;return"Please delete "+i+" character"+(1==i?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(e){return"Loading more results…"},formatPager:function(e){return""},formatSearching:function(){return"Searching…"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==t?null:e.id},collapasable:!1,matcher:function(e,t,i){return f(""+t).toUpperCase().indexOf(f(""+e).toUpperCase())>=0==1&&(void 0!==i&&"object"==typeof i&&(i.isShow=!0),!0)},separator:",",tokenSeparators:[],tokenizer:function(e,i,a,r){var o,n,s,l,d,c=e,u=!1;if(!r.createSearchChoice||!r.tokenSeparators||r.tokenSeparators.length<1)return t;for(;;){for(n=-1,s=0,l=r.tokenSeparators.length;s<l&&(d=r.tokenSeparators[s],!((n=e.indexOf(d))>=0));s++);if(n<0)break;if(o=e.substring(0,n),e=e.substring(n+d.length),o.length>0&&(o=r.createSearchChoice.call(this,o,i))!==t&&null!==o&&r.id(o)!==t&&null!==r.id(o)){for(u=!1,s=0,l=i.length;s<l;s++)if(v(r.id(o),r.id(i[s]))){u=!0;break}u||a(o)}}return c!==e?e:void 0},escapeMarkup:_,blurOnChange:!1,selectOnBlur:!1,selectOnClick:!0,formContainer:"body",adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,i){return t},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){return!(e.opts.minimumResultsForSearch<0)}},e.fn.select2.ajaxDefaults={transport:e.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:I,local:w,tags:P},util:{debounce:b,markMatch:D,escapeMarkup:_,stripDiacritics:f},class:{abstract:i,single:a,multi:r,combobox:o}}}function m(t){var i=e(document.createTextNode(""));t.before(i),i.before(t),i.remove()}function f(e){var t,i,a,r;if(!e||e.length<1)return e;for(t="",i=0,a=e.length;i<a;i++)r=e.charAt(i),t+=h[r]||r;return t}function g(e,t){for(var i=0,a=t.length;i<a;i+=1)if(v(e,t[i]))return i;return-1}function v(e,i){return e===i||e!==t&&i!==t&&(null!==e&&null!==i&&(e.constructor===String?e+""==i+"":i.constructor===String&&i+""==e+""))}function A(t,i){var a,r,o;if(null===t||t.length<1)return[];for(r=0,o=(a=t.split(i)).length;r<o;r+=1)a[r]=e.trim(a[r]);return a}function C(e){return e.outerWidth(!1)-e.width()}function y(i){var a="keyup-change-value";i.on("keydown",function(){e.data(i,a)===t&&e.data(i,a,i.val())}),i.on("keyup",function(){var r=e.data(i,a);r!==t&&i.val()!==r&&(e.removeData(i,a),i.trigger("keyup-change"))})}function b(e,i,a){var r;return a=a||t,function(){var t=arguments;window.clearTimeout(r),r=window.setTimeout(function(){i.apply(a,t)},e)}}function S(e){e.preventDefault(),e.stopPropagation()}function k(t,i,a){var r,o,n=[];(r=t.attr("class"))&&e((r=""+r).split(" ")).each2(function(){0===this.indexOf("select2-")&&n.push(this)}),(r=i.attr("class"))&&e((r=""+r).split(" ")).each2(function(){0!==this.indexOf("select2-")&&(o=a(this))&&n.push(o)}),t.attr("class",n.join(" "))}function D(e,t,i,a){var r=f(e.toUpperCase()).indexOf(f(t.toUpperCase())),o=t.length;r<0?i.push(a(e)):(i.push(a(e.substring(0,r))),i.push("<span class='select2-match'>"),i.push(a(e.substring(r,r+o))),i.push("</span>"),i.push(a(e.substring(r+o,e.length))))}function _(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function I(i){var a,r=null,o=i.quietMillis||100,n=i.url,s=i.minimumInputLengthForAjaxCall||0,l=this;return function(d){window.clearTimeout(a),a=window.setTimeout(function(){var a=i.data,o=n,c=i.transport||e.fn.select2.ajaxDefaults.transport,u={type:i.type||"GET",cache:i.cache||!1,jsonpCallback:i.jsonpCallback||t,dataType:i.dataType||"json"},p=e.extend({},e.fn.select2.ajaxDefaults.params,u);if(a=a?a.call(l,d.term,d.page,d.context):null,o="function"==typeof o?o.call(l,d.term,d.page,d.context):o,r&&"function"==typeof r.abort&&r.abort(),i.params&&(e.isFunction(i.params)?e.extend(p,i.params.call(l)):e.extend(p,i.params)),0==s||s<=a.searchText.length)e.extend(p,{url:o,dataType:i.dataType,data:a,success:function(e){var t=i.results(e,d.page);d.callback(t)}});else{var h=i.results(null,d.page);d.callback(h)}r=c.call(l,p)},o)}}function w(t){var i,a,r=t,o=function(e){return""+e.text};e.isArray(r)&&(r={results:a=r}),!1===e.isFunction(r)&&(a=r,r=function(){return a});var n=r();return n.text&&(o=n.text,e.isFunction(o)||(i=n.text,o=function(e){return e[i]})),function(t){var i,a=t.term,n={results:[]};""!==a?(i=function(r,n){var s,l;if((r=r[0]).children){for(l in s={},r)r.hasOwnProperty(l)&&(s[l]=r[l]);s.children=[],e(r.children).each2(function(e,t){i(t,s.children)}),(s.children.length||t.matcher(a,o(s),r))&&n.push(s)}else t.matcher(a,o(r),r)&&n.push(r)},e(r().results).each2(function(e,t){i(t,n.results)}),t.callback(n)):t.callback(r())}}function P(i){var a=e.isFunction(i);return function(r){var o=r.term,n={results:[]};e(a?i():i).each(function(){var e=this.text!==t,i=e?this.text:this;(""===o||r.matcher(o,i))&&n.results.push(e?this:{id:this,text:this})}),r.callback(n)}}function T(t,i){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw new Error(i+" must be a string, function, or falsy value")}function B(t){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,1);return t.apply(null,i)}return t}function x(t){var i=0;return e.each(t,function(e,t){t.children?i+=x(t.children):i++}),i}}(jQuery),function(e){"use strict";function t(t,i){var a=this,r=t.attr("name")||i.name||"";t.parent().hide();var o=t.css("width");t.parent().show(),"0px"==o&&(o=t.outerWidth()+20),this.$el=t.hide(),this.options=i,this.$parent=e("<div"+e.map(["class","title"],function(e){var t=a.$el.attr(e)||"";return(t=("class"===e?"ms-parent"+(t?" ":""):"")+t)?" "+e+'="'+t+'"':""}).join("")+" />"),this.$choice=e('<button type="button" class="ms-choice"><span class="placeholder" style="color:'+i.placeholdercolor+';">'+i.placeholder+"</span><div></div></button>"),this.$drop=e('<div class="ms-drop '+i.position+'"></div>'),this.$el.after(this.$parent),this.$parent.append(this.$choice),this.$parent.append(this.$drop),this.$el.prop("disabled")&&this.$choice.addClass("disabled"),this.$parent.css("width",i.width||o),this.options.keepOpen||e("body").click(function(t){e(t.target)[0]!==a.$choice[0]&&e(t.target).parents(".ms-choice")[0]!==a.$choice[0]&&(e(t.target)[0]!==a.$drop[0]&&e(t.target).parents(".ms-drop")[0]===a.$drop[0]||!a.options.isOpen||a.close())}),this.selectAllName='name="selectAll'+r+'"',this.selectGroupName='name="selectGroup'+r+'"',this.selectItemName='name="selectItem'+r+'"'}t.prototype={constructor:t,init:function(){var t=this,i=[];this.options.filter&&i.push('<div class="ms-search">','<input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false">',"</div>"),i.push("<ul>"),this.options.selectAll&&!this.options.single&&i.push('<li class="ms-select-all ">',"<label>",'<input type="checkbox" '+this.selectAllName+" /> ",this.options.selectAllDelimiter[0]+this.options.selectAllText+this.options.selectAllDelimiter[1],"</label>","</li>"),e.each(this.$el.children(),function(e,a){i.push(t.optionToHtml(e,a))}),i.push('<li class="ms-no-results">'+this.options.noMatchesFound+"</li>"),i.push("</ul>"),this.$drop.html(i.join("")),this.$drop.find("ul").css("max-height",this.options.maxHeight+"px"),this.$drop.find(".multiple").css("width",this.options.multipleWidth+"px"),this.$searchInput=this.$drop.find(".ms-search input"),this.$selectAll=this.$drop.find("input["+this.selectAllName+"]"),this.$selectGroups=this.$drop.find("input["+this.selectGroupName+"]"),this.$selectItems=this.$drop.find("input["+this.selectItemName+"]:enabled"),this.$disableItems=this.$drop.find("input["+this.selectItemName+"]:disabled"),this.$noResults=this.$drop.find(".ms-no-results"),this.events(),this.updateSelectAll(!0),this.update(!0),this.options.isOpen&&this.open()},optionToHtml:function(t,i,a,r){var o,n=this,s=e(i),l=[],d=this.options.multiple,c=e.map(["class","title"],function(e,t){var i="class"===e&&d,a=s.attr(e)||"";return i||a?" "+e+'="'+(i?"multiple"+(a?" ":""):"")+a+'"':""}).join(""),u=this.options.single?"radio":"checkbox";if(s.is("option")){var p=s.val(),h=n.options.textTemplate(s),m=null!=n.$el.attr("multiple")?s.prop("selected"):"selected"==s.attr("selected"),f=this.options.styler(p)?' style="'+this.options.styler(p)+'"':"";o=r||s.prop("disabled"),this.options.blockSeparator>""&&this.options.blockSeparator==s.val()?l.push("<li"+c+f+">",'<label class="'+this.options.blockSeparator+(o?"disabled":"")+'">',h,"</label>","</li>"):l.push("<li"+c+f+">","<label"+(o?' class="disabled"':"")+">",'<input type="'+u+'" '+this.selectItemName+' value="'+p+'"'+(m?' checked="checked"':"")+(o?' disabled="disabled"':"")+(a?' data-group="'+a+'"':"")+"/> ",h,"</label>","</li>")}else if(!a&&s.is("optgroup")){var g="group_"+t,v=s.attr("label");o=s.prop("disabled"),l.push('<li class="group">','<label class="optgroup'+(o?" disabled":"")+'" data-group="'+g+'">',this.options.hideOptgroupCheckboxes?"":'<input type="checkbox" '+this.selectGroupName+(o?' disabled="disabled"':"")+" /> ",v,"</label>","</li>"),e.each(s.children(),function(e,t){l.push(n.optionToHtml(e,t,g,o))})}return l.join("")},events:function(){var t=this;function i(e){e.preventDefault(),t[t.options.isOpen?"close":"open"]()}var a=this.$el.parent().closest("label")[0]||e("label[for="+this.$el.attr("id")+"]")[0];a&&e(a).off("click").on("click",function(e){"label"===e.target.nodeName.toLowerCase()&&e.target===this&&(i(e),t.options.filter&&t.options.isOpen||t.focus(),e.stopPropagation())}),this.$choice.off("click").on("click",i).off("focus").on("focus",this.options.onFocus).off("blur").on("blur",this.options.onBlur),this.$parent.off("keydown").on("keydown",function(e){if(27===e.which)t.close(),t.$choice.focus()}),this.$searchInput.off("keydown").on("keydown",function(e){9===e.keyCode&&e.shiftKey&&t.close()}).off("keyup").on("keyup",function(e){if(t.options.filterAcceptOnEnter&&(13===e.which||32==e.which)&&t.$searchInput.val())return t.$selectAll.click(),t.close(),void t.focus();t.filter()}),this.$selectAll.off("click").on("click",function(){var i=e(this).prop("checked"),a=t.$selectItems.filter(":visible");a.length===t.$selectItems.length?t[i?"checkAll":"uncheckAll"]():(t.$selectGroups.prop("checked",i),a.prop("checked",i),t.options[i?"onCheckAll":"onUncheckAll"](),t.update()),i&&e(this).closest("li").addClass("selected")}),this.$selectGroups.off("click").on("click",function(){var i=e(this).parent().attr("data-group"),a=t.$selectItems.filter(":visible").filter('[data-group="'+i+'"]'),r=a.length!==a.filter(":checked").length;a.prop("checked",r),t.updateSelectAll(),t.update(),t.options.onOptgroupClick({label:e(this).parent().text(),checked:r,children:a.get()})}),this.$selectItems.off("click").on("click",function(){t.updateSelectAll(),t.update(),t.updateOptGroupSelect(),t.options.onClick({label:e(this).parent().text(),value:e(this).val(),checked:e(this).prop("checked")}),t.options.single&&t.options.isOpen&&!t.options.keepOpen&&t.close()})},open:function(){if(!this.$choice.hasClass("disabled")){if(this.options.isOpen=!0,this.$choice.find(">div").addClass("open"),this.$drop.show(),this.$selectAll.parent().show(),this.$noResults.hide(),0===this.$el.children().length&&(this.$selectAll.parent().hide(),this.$noResults.show()),this.options.container){var t=this.$drop.offset();this.$drop.appendTo(e(this.options.container)),this.$drop.offset({top:t.top,left:t.left})}this.options.filter&&(this.$searchInput.val(""),this.$searchInput.focus(),this.filter()),this.options.onOpen()}},close:function(){this.options.isOpen=!1,this.$choice.find(">div").removeClass("open"),this.$drop.hide(),this.options.container&&(this.$parent.append(this.$drop),this.$drop.css({top:"auto",left:"auto"})),this.options.onClose()},update:function(t){var i=this.getSelects(),a=this.$choice.find(">span");0===i.length?a.addClass("placeholder").html(this.options.placeholder):this.options.countSelected&&i.length<this.options.minimumCountSelected?a.removeClass("placeholder").html((this.options.displayValues?i:this.getSelects("text")).join(this.options.delimiter)):this.options.allSelected&&i.length===this.$selectItems.length+this.$disableItems.length?a.removeClass("placeholder").html(this.options.allSelected):(this.options.countSelected||this.options.etcaetera)&&i.length>this.options.minimumCountSelected?this.options.etcaetera?a.removeClass("placeholder").html((this.options.displayValues?i:this.getSelects("text").slice(0,this.options.minimumCountSelected)).join(this.options.delimiter)+"..."):a.removeClass("placeholder").html(this.options.countSelected.replace("#",i.length).replace("%",this.$selectItems.length+this.$disableItems.length)):a.removeClass("placeholder").html((this.options.displayValues?i:this.getSelects("text")).join(this.options.delimiter)),this.$el.val(this.getSelects()),this.$drop.find("li").removeClass("selected"),this.$drop.find("input["+this.selectItemName+"]:checked").each(function(){e(this).parents("li").first().addClass("selected")});var r=this.$selectItems;r.length===r.filter(":checked").length?this.$drop.find(".ms-select-all").addClass("selected"):this.$drop.find(".ms-select-all").removeClass("selected"),t||this.$el.trigger("change")},updateSelectAll:function(e){var t=this.$selectItems;e||(t=t.filter(":visible")),this.$selectAll.prop("checked",t.length&&t.length===t.filter(":checked").length),this.$selectAll.prop("checked")},updateOptGroupSelect:function(){var t=this.$selectItems.filter(":visible");e.each(this.$selectGroups,function(i,a){var r=e(a).parent().attr("data-group"),o=t.filter('[data-group="'+r+'"]');e(a).prop("checked",o.length&&o.length===o.filter(":checked").length)})},getSelects:function(t){var i=this,a=[],r=[];return this.$drop.find("input["+this.selectItemName+"]:checked").each(function(){a.push(e(this).parents("li").first().text()),r.push(e(this).val())}),"text"===t&&this.$selectGroups.length&&(a=[],this.$selectGroups.each(function(){var t=[],r=e.trim(e(this).parent().text()),o=e(this).parent().data("group"),n=i.$drop.find("["+i.selectItemName+'][data-group="'+o+'"]'),s=n.filter(":checked");if(0!==s.length){if(t.push("["),t.push(r),n.length>s.length){var l=[];s.each(function(){l.push(e(this).parent().text())}),t.push(": "+l.join(", "))}t.push("]"),a.push(t.join(""))}})),"text"===t?a:r},setSelects:function(t){var i=this;this.$selectItems.prop("checked",!1),e.each(t,function(e,t){i.$selectItems.filter('[value="'+t+'"]').prop("checked",!0)}),this.$selectAll.prop("checked",this.$selectItems.length===this.$selectItems.filter(":checked").length),this.update()},enable:function(){this.$choice.removeClass("disabled")},disable:function(){this.$choice.addClass("disabled")},checkAll:function(){this.$selectItems.prop("checked",!0),this.$selectGroups.prop("checked",!0),this.$selectAll.prop("checked",!0),this.update(),this.options.onCheckAll()},uncheckAll:function(){this.$selectItems.prop("checked",!1),this.$selectGroups.prop("checked",!1),this.$selectAll.prop("checked",!1),this.update(),this.options.onUncheckAll()},focus:function(){this.$choice.focus(),this.options.onFocus()},blur:function(){this.$choice.blur(),this.options.onBlur()},refresh:function(){this.init()},filter:function(){var t=this,i=e.trim(this.$searchInput.val()).toLowerCase();0===i.length?(this.$selectItems.parent().show(),this.$disableItems.parent().show(),this.$selectGroups.parent().show()):(this.$selectItems.each(function(){var t=e(this).parent();t[t.text().toLowerCase().indexOf(i)<0?"hide":"show"]()}),this.$disableItems.parent().hide(),this.$selectGroups.each(function(){var i=e(this).parent(),a=i.attr("data-group");i[0===t.$selectItems.filter(":visible").filter('[data-group="'+a+'"]').length?"hide":"show"]()}),this.$selectItems.filter(":visible").length?(this.$selectAll.parent().show(),this.$noResults.hide()):(this.$selectAll.parent().hide(),this.$noResults.show())),this.updateOptGroupSelect(),this.updateSelectAll()}},e.fn.multipleSelect=function(){var i,a=arguments[0],r=arguments,o=["getSelects","setSelects","enable","disable","checkAll","uncheckAll","focus","blur","refresh"];return this.each(function(){var n=e(this),s=n.data("multipleSelect"),l=e.extend({},e.fn.multipleSelect.defaults,n.data(),"object"==typeof a&&a);if(s||(s=new t(n,l),n.data("multipleSelect",s)),"string"==typeof a){if(e.inArray(a,o)<0)throw"Unknown method: "+a;i=s[a](r[1])}else s.init(),r[1]&&(i=s[r[1]].apply(s,[].slice.call(r,2)))}),i||this},e.fn.multipleSelect.defaults={name:"",isOpen:!1,placeholder:"",selectAll:!0,selectAllText:"Select all",selectAllDelimiter:["[","]"],allSelected:"All selected",minimumCountSelected:3,countSelected:"# of % selected",noMatchesFound:"No matches found",multiple:!1,multipleWidth:80,single:!1,filter:!1,width:void 0,maxHeight:250,container:null,position:"bottom",keepOpen:!1,blockSeparator:"",displayValues:!1,delimiter:", ",styler:function(){return!1},textTemplate:function(e){return e.text()},onOpen:function(){return!1},onClose:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onFocus:function(){return!1},onBlur:function(){return!1},onOptgroupClick:function(){return!1},onClick:function(){return!1}}}(jQuery),InfoBox.prototype=new google.maps.OverlayView,InfoBox.prototype.createInfoBoxDiv_=function(){var e,t,i,a=this,r=function(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()};if(!this.div_){if(this.div_=document.createElement("div"),this.setBoxStyle_(),void 0===this.content_.nodeType?this.div_.innerHTML=this.getCloseBoxImg_()+this.content_:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(this.content_)),this.getPanes()[this.pane_].appendChild(this.div_),this.addClickHandler_(),this.div_.style.width?this.fixedWidthSet_=!0:0!==this.maxWidth_&&this.div_.offsetWidth>this.maxWidth_?(this.div_.style.width=this.maxWidth_,this.div_.style.overflow="auto",this.fixedWidthSet_=!0):(i=this.getBoxWidths_(),this.div_.style.width=this.div_.offsetWidth-i.left-i.right+"px",this.fixedWidthSet_=!1),this.panBox_(this.disableAutoPan_),!this.enableEventPropagation_){for(this.eventListeners_=[],t=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],e=0;e<t.length;e++)this.eventListeners_.push(google.maps.event.addDomListener(this.div_,t[e],r));this.eventListeners_.push(google.maps.event.addDomListener(this.div_,"mouseover",function(){this.style.cursor="default"}))}this.contextListener_=google.maps.event.addDomListener(this.div_,"contextmenu",function(e){e.returnValue=!1,e.preventDefault&&e.preventDefault(),a.enableEventPropagation_||r(e)}),google.maps.event.trigger(this,"domready")}},InfoBox.prototype.getCloseBoxImg_=function(){var e="";return""!==this.closeBoxURL_&&(e="<img",e+=" src='"+this.closeBoxURL_+"'",e+=" align=right",e+=" style='",e+=" position: relative;",e+=" cursor: pointer;",e+=" margin: "+this.closeBoxMargin_+";",e+="'>"),e},InfoBox.prototype.addClickHandler_=function(){var e;""!==this.closeBoxURL_?(e=this.div_.firstChild,this.closeListener_=google.maps.event.addDomListener(e,"click",this.getCloseClickHandler_())):this.closeListener_=null},InfoBox.prototype.getCloseClickHandler_=function(){var e=this;return function(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation(),google.maps.event.trigger(e,"closeclick"),e.close()}},InfoBox.prototype.panBox_=function(e){var t,i=0,a=0;if(!e&&(t=this.getMap())instanceof google.maps.Map){t.getBounds().contains(this.position_)||t.setCenter(this.position_),t.getBounds();var r=t.getDiv(),o=r.offsetWidth,n=r.offsetHeight,s=this.pixelOffset_.width,l=this.pixelOffset_.height,d=this.div_.offsetWidth,c=this.div_.offsetHeight,u=this.infoBoxClearance_.width,p=this.infoBoxClearance_.height,h=this.getProjection().fromLatLngToContainerPixel(this.position_);h.x<-s+u?i=h.x+s-u:h.x+d+s+u>o&&(i=h.x+d+s+u-o),this.alignBottom_?h.y<-l+p+c?a=h.y+l-p-c:h.y+l+p>n&&(a=h.y+l+p-n):h.y<-l+p?a=h.y+l-p:h.y+c+l+p>n&&(a=h.y+c+l+p-n),0===i&&0===a||(t.getCenter(),t.panBy(i,a))}},InfoBox.prototype.setBoxStyle_=function(){var e,t;if(this.div_){for(e in this.div_.className=this.boxClass_,this.div_.style.cssText="",t=this.boxStyle_)t.hasOwnProperty(e)&&(this.div_.style[e]=t[e]);this.div_.style.WebkitTransform="translateZ(0)",void 0!==this.div_.style.opacity&&""!==this.div_.style.opacity&&(this.div_.style.MsFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*this.div_.style.opacity+')"',this.div_.style.filter="alpha(opacity="+100*this.div_.style.opacity+")"),this.div_.style.position="absolute",this.div_.style.visibility="hidden",null!==this.zIndex_&&(this.div_.style.zIndex=this.zIndex_)}},InfoBox.prototype.getBoxWidths_=function(){var e,t={top:0,bottom:0,left:0,right:0},i=this.div_;return document.defaultView&&document.defaultView.getComputedStyle?(e=i.ownerDocument.defaultView.getComputedStyle(i,""))&&(t.top=parseInt(e.borderTopWidth,10)||0,t.bottom=parseInt(e.borderBottomWidth,10)||0,t.left=parseInt(e.borderLeftWidth,10)||0,t.right=parseInt(e.borderRightWidth,10)||0):document.documentElement.currentStyle&&i.currentStyle&&(t.top=parseInt(i.currentStyle.borderTopWidth,10)||0,t.bottom=parseInt(i.currentStyle.borderBottomWidth,10)||0,t.left=parseInt(i.currentStyle.borderLeftWidth,10)||0,t.right=parseInt(i.currentStyle.borderRightWidth,10)||0),t},InfoBox.prototype.onRemove=function(){this.div_&&(this.div_.parentNode.removeChild(this.div_),this.div_=null)},InfoBox.prototype.draw=function(){this.createInfoBoxDiv_();var e=this.getProjection().fromLatLngToDivPixel(this.position_);this.div_.style.left=e.x+this.pixelOffset_.width+"px",this.alignBottom_?this.div_.style.bottom=-(e.y+this.pixelOffset_.height)+"px":this.div_.style.top=e.y+this.pixelOffset_.height+"px",this.div_.style.visibility=this.isHidden_?"hidden":"visible"},InfoBox.prototype.setOptions=function(e){void 0!==e.boxClass&&(this.boxClass_=e.boxClass,this.setBoxStyle_()),void 0!==e.boxStyle&&(this.boxStyle_=e.boxStyle,this.setBoxStyle_()),void 0!==e.content&&this.setContent(e.content),void 0!==e.disableAutoPan&&(this.disableAutoPan_=e.disableAutoPan),void 0!==e.maxWidth&&(this.maxWidth_=e.maxWidth),void 0!==e.pixelOffset&&(this.pixelOffset_=e.pixelOffset),void 0!==e.alignBottom&&(this.alignBottom_=e.alignBottom),void 0!==e.position&&this.setPosition(e.position),void 0!==e.zIndex&&this.setZIndex(e.zIndex),void 0!==e.closeBoxMargin&&(this.closeBoxMargin_=e.closeBoxMargin),void 0!==e.closeBoxURL&&(this.closeBoxURL_=e.closeBoxURL),void 0!==e.infoBoxClearance&&(this.infoBoxClearance_=e.infoBoxClearance),void 0!==e.isHidden&&(this.isHidden_=e.isHidden),void 0!==e.visible&&(this.isHidden_=!e.visible),void 0!==e.enableEventPropagation&&(this.enableEventPropagation_=e.enableEventPropagation),this.div_&&this.draw()},InfoBox.prototype.setContent=function(e){this.content_=e,this.div_&&(this.closeListener_&&(google.maps.event.removeListener(this.closeListener_),this.closeListener_=null),this.fixedWidthSet_||(this.div_.style.width=""),void 0===e.nodeType?this.div_.innerHTML=this.getCloseBoxImg_()+e:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(e)),this.fixedWidthSet_||(this.div_.style.width=this.div_.offsetWidth+"px",void 0===e.nodeType?this.div_.innerHTML=this.getCloseBoxImg_()+e:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(e))),this.addClickHandler_()),google.maps.event.trigger(this,"content_changed")},InfoBox.prototype.setPosition=function(e){this.position_=e,this.div_&&this.draw(),google.maps.event.trigger(this,"position_changed")},InfoBox.prototype.setZIndex=function(e){this.zIndex_=e,this.div_&&(this.div_.style.zIndex=e),google.maps.event.trigger(this,"zindex_changed")},InfoBox.prototype.setVisible=function(e){this.isHidden_=!e,this.div_&&(this.div_.style.visibility=this.isHidden_?"hidden":"visible")},InfoBox.prototype.getContent=function(){return this.content_},InfoBox.prototype.getPosition=function(){return this.position_},InfoBox.prototype.getZIndex=function(){return this.zIndex_},InfoBox.prototype.getVisible=function(){return void 0!==this.getMap()&&null!==this.getMap()&&!this.isHidden_},InfoBox.prototype.show=function(){this.isHidden_=!1,this.div_&&(this.div_.style.visibility="visible")},InfoBox.prototype.hide=function(){this.isHidden_=!0,this.div_&&(this.div_.style.visibility="hidden")},InfoBox.prototype.open=function(e,t){var i=this;t&&(this.position_="function"==typeof t.getPosition?t.getPosition():t.position instanceof google.maps.LatLng?t.position:new google.maps.LatLng("function"==typeof t.position.lat?t.position.lat():t.position.lat,"function"==typeof t.position.lng?t.position.lng():t.position.lng),this.moveListener_=google.maps.event.addListener(t,"position_changed",function(){i.setPosition("function"==typeof this.getPosition?this.getPosition():this.position)})),this.setMap(e),this.div_&&this.panBox_()},InfoBox.prototype.close=function(){var e;if(this.closeListener_&&(google.maps.event.removeListener(this.closeListener_),this.closeListener_=null),this.eventListeners_){for(e=0;e<this.eventListeners_.length;e++)google.maps.event.removeListener(this.eventListeners_[e]);this.eventListeners_=null}this.moveListener_&&(google.maps.event.removeListener(this.moveListener_),this.moveListener_=null),this.contextListener_&&(google.maps.event.removeListener(this.contextListener_),this.contextListener_=null),this.setMap(null)},
/*! jQuery UI - v1.11.3 - 2015-02-13
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){function t(t,a){var r,o,n,s=t.nodeName.toLowerCase();return"area"===s?(o=(r=t.parentNode).name,!(!t.href||!o||"map"!==r.nodeName.toLowerCase())&&(!!(n=e("img[usemap='#"+o+"']")[0])&&i(n))):(/^(input|select|textarea|button|object)$/.test(s)?!t.disabled:"a"===s&&t.href||a)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function a(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=r(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function r(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(p.inline?p.dpDiv.parent()[0]:p.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function n(t,i){for(var a in e.extend(t,i),i)null==i[a]&&(t[a]=i[a]);return t}function s(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),a="absolute"===i,r=t?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var t=e(this);return(!a||"static"!==t.css("position"))&&r.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,a){return!!e.data(t,a[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var a=e.attr(i,"tabindex"),r=isNaN(a);return(r||a>=0)&&t(i,!r)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function a(t,i,a,o){return e.each(r,function(){i-=parseFloat(e.css(t,"padding"+this))||0,a&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),o&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var r="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),n={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?n["inner"+i].call(this):this.each(function(){e(this).css(o,a(this,t)+"px")})},e.fn["outer"+i]=function(t,r){return"number"!=typeof t?n["outer"+i].call(this,t):this.each(function(){e(this).css(o,a(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,a){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),a&&a.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,a,r=e(this[0]);r.length&&r[0]!==document;){if(("absolute"===(i=r.css("position"))||"relative"===i||"fixed"===i)&&(a=parseInt(r.css("zIndex"),10),!isNaN(a)&&0!==a))return a;r=r.parent()}return 0}}),e.ui.plugin={add:function(t,i,a){var r,o=e.ui[t].prototype;for(r in a)o.plugins[r]=o.plugins[r]||[],o.plugins[r].push([i,a[r]])},call:function(e,t,i,a){var r,o=e.plugins[t];if(o&&(a||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;o.length>r;r++)e.options[o[r][0]]&&o[r][1].apply(e.element,i)}};var l=0,d=Array.prototype.slice;e.cleanData=function(t){return function(i){var a,r,o;for(o=0;null!=(r=i[o]);o++)try{(a=e._data(r,"events"))&&a.remove&&e(r).triggerHandler("remove")}catch(e){}t(i)}}(e.cleanData),e.widget=function(t,i,a){var r,o,n,s,l={},d=t.split(".")[0];return t=t.split(".")[1],r=d+"-"+t,a||(a=i,i=e.Widget),e.expr[":"][r.toLowerCase()]=function(t){return!!e.data(t,r)},e[d]=e[d]||{},o=e[d][t],n=e[d][t]=function(e,t){return this._createWidget?void(arguments.length&&this._createWidget(e,t)):new n(e,t)},e.extend(n,o,{version:a.version,_proto:e.extend({},a),_childConstructors:[]}),(s=new i).options=e.widget.extend({},s.options),e.each(a,function(t,a){return e.isFunction(a)?void(l[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},r=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,o=this._superApply;return this._super=e,this._superApply=r,t=a.apply(this,arguments),this._super=i,this._superApply=o,t}}()):void(l[t]=a)}),n.prototype=e.widget.extend(s,{widgetEventPrefix:o&&s.widgetEventPrefix||t},l,{constructor:n,namespace:d,widgetName:t,widgetFullName:r}),o?(e.each(o._childConstructors,function(t,i){var a=i.prototype;e.widget(a.namespace+"."+a.widgetName,n,i._proto)}),delete o._childConstructors):i._childConstructors.push(n),e.widget.bridge(t,n),n},e.widget.extend=function(t){for(var i,a,r=d.call(arguments,1),o=0,n=r.length;n>o;o++)for(i in r[o])a=r[o][i],r[o].hasOwnProperty(i)&&void 0!==a&&(t[i]=e.isPlainObject(a)?e.isPlainObject(t[i])?e.widget.extend({},t[i],a):e.widget.extend({},a):a);return t},e.widget.bridge=function(t,i){var a=i.prototype.widgetFullName||t;e.fn[t]=function(r){var o="string"==typeof r,n=d.call(arguments,1),s=this;return o?this.each(function(){var i,o=e.data(this,a);return"instance"===r?(s=o,!1):o?e.isFunction(o[r])&&"_"!==r.charAt(0)?(i=o[r].apply(o,n))!==o&&void 0!==i?(s=i&&i.jquery?s.pushStack(i.get()):i,!1):void 0:e.error("no such method '"+r+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+r+"'")}):(n.length&&(r=e.widget.extend.apply(null,[r].concat(n))),this.each(function(){var t=e.data(this,a);t?(t.option(r||{}),t._init&&t._init()):e.data(this,a,new i(r,this))})),s}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var a,r,o,n=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(n={},a=t.split("."),t=a.shift(),a.length){for(r=n[t]=e.widget.extend({},this.options[t]),o=0;a.length-1>o;o++)r[a[o]]=r[a[o]]||{},r=r[a[o]];if(t=a.pop(),1===arguments.length)return void 0===r[t]?null:r[t];r[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];n[t]=i}return this._setOptions(n),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,a){var r,o=this;"boolean"!=typeof t&&(a=i,i=t,t=!1),a?(i=r=e(i),this.bindings=this.bindings.add(i)):(a=i,i=this.element,r=this.widget()),e.each(a,function(a,n){function s(){return t||!0!==o.options.disabled&&!e(this).hasClass("ui-state-disabled")?("string"==typeof n?o[n]:n).apply(o,arguments):void 0}"string"!=typeof n&&(s.guid=n.guid=n.guid||s.guid||e.guid++);var l=a.match(/^([\w:-]*)\s*(.*)$/),d=l[1]+o.eventNamespace,c=l[2];c?r.delegate(c,d,s):i.bind(d,s)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){var i=this;return setTimeout(function(){return("string"==typeof e?i[e]:e).apply(i,arguments)},t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,a){var r,o,n=this.options[t];if(a=a||{},(i=e.Event(i)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(r in o)r in i||(i[r]=o[r]);return this.element.trigger(i,a),!(e.isFunction(n)&&!1===n.apply(this.element[0],[i].concat(a))||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(a,r,o){"string"==typeof r&&(r={effect:r});var n,s=r?!0===r||"number"==typeof r?i:r.effect||i:t;"number"==typeof(r=r||{})&&(r={duration:r}),n=!e.isEmptyObject(r),r.complete=o,r.delay&&a.delay(r.delay),n&&e.effects&&e.effects.effect[s]?a[t](r):s!==t&&a[s]?a[s](r.duration,r.easing,o):a.queue(function(i){e(this)[t](),o&&o.call(a[0]),i()})}}),e.widget;var c=!1;e(document).mouseup(function(){c=!1}),e.widget("ui.mouse",{version:"1.11.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!c){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,a=1===t.which,r=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&e(t.target).closest(this.options.cancel).length;return!(a&&!r&&this._mouseCapture(t))||(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),c=!0,!0))}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),c=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}e.ui=e.ui||{};var a,r,o=Math.max,n=Math.abs,s=Math.round,l=/left|center|right/,d=/top|center|bottom/,c=/[\+\-]\d+(\.[\d]+)?%?/,u=/^\w+/,p=/%$/,h=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==a)return a;var t,i,r=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=r.children()[0];return e("body").append(r),t=o.offsetWidth,r.css("overflow","scroll"),t===(i=o.offsetWidth)&&(i=r[0].clientWidth),r.remove(),a=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),a=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),r="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth;return{width:"scroll"===a||"auto"===a&&t.height<t.element[0].scrollHeight?e.position.scrollbarWidth():0,height:r?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),a=e.isWindow(i[0]),r=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:a,isDocument:r,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:a||r?i.width():i.outerWidth(),height:a||r?i.height():i.outerHeight()}}},e.fn.position=function(a){if(!a||!a.of)return h.apply(this,arguments);a=e.extend({},a);var p,m,f,g,v,A,C=e(a.of),y=e.position.getWithinInfo(a.within),b=e.position.getScrollInfo(y),S=(a.collision||"flip").split(" "),k={};return A=function(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}(C),C[0].preventDefault&&(a.at="left top"),m=A.width,f=A.height,g=A.offset,v=e.extend({},g),e.each(["my","at"],function(){var e,t,i=(a[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):d.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=d.test(i[1])?i[1]:"center",e=c.exec(i[0]),t=c.exec(i[1]),k[this]=[e?e[0]:0,t?t[0]:0],a[this]=[u.exec(i[0])[0],u.exec(i[1])[0]]}),1===S.length&&(S[1]=S[0]),"right"===a.at[0]?v.left+=m:"center"===a.at[0]&&(v.left+=m/2),"bottom"===a.at[1]?v.top+=f:"center"===a.at[1]&&(v.top+=f/2),p=t(k.at,m,f),v.left+=p[0],v.top+=p[1],this.each(function(){var l,d,c=e(this),u=c.outerWidth(),h=c.outerHeight(),A=i(this,"marginLeft"),D=i(this,"marginTop"),_=u+A+i(this,"marginRight")+b.width,I=h+D+i(this,"marginBottom")+b.height,w=e.extend({},v),P=t(k.my,c.outerWidth(),c.outerHeight());"right"===a.my[0]?w.left-=u:"center"===a.my[0]&&(w.left-=u/2),"bottom"===a.my[1]?w.top-=h:"center"===a.my[1]&&(w.top-=h/2),w.left+=P[0],w.top+=P[1],r||(w.left=s(w.left),w.top=s(w.top)),l={marginLeft:A,marginTop:D},e.each(["left","top"],function(t,i){e.ui.position[S[t]]&&e.ui.position[S[t]][i](w,{targetWidth:m,targetHeight:f,elemWidth:u,elemHeight:h,collisionPosition:l,collisionWidth:_,collisionHeight:I,offset:[p[0]+P[0],p[1]+P[1]],my:a.my,at:a.at,within:y,elem:c})}),a.using&&(d=function(e){var t=g.left-w.left,i=t+m-u,r=g.top-w.top,s=r+f-h,l={target:{element:C,left:g.left,top:g.top,width:m,height:f},element:{element:c,left:w.left,top:w.top,width:u,height:h},horizontal:0>i?"left":t>0?"right":"center",vertical:0>s?"top":r>0?"bottom":"middle"};u>m&&m>n(t+i)&&(l.horizontal="center"),h>f&&f>n(r+s)&&(l.vertical="middle"),l.important=o(n(t),n(i))>o(n(r),n(s))?"horizontal":"vertical",a.using.call(this,e,l)}),c.offset(e.extend(w,{using:d}))})},e.ui.position={fit:{left:function(e,t){var i,a=t.within,r=a.isWindow?a.scrollLeft:a.offset.left,n=a.width,s=e.left-t.collisionPosition.marginLeft,l=r-s,d=s+t.collisionWidth-n-r;t.collisionWidth>n?l>0&&0>=d?(i=e.left+l+t.collisionWidth-n-r,e.left+=l-i):e.left=d>0&&0>=l?r:l>d?r+n-t.collisionWidth:r:l>0?e.left+=l:d>0?e.left-=d:e.left=o(e.left-s,e.left)},top:function(e,t){var i,a=t.within,r=a.isWindow?a.scrollTop:a.offset.top,n=t.within.height,s=e.top-t.collisionPosition.marginTop,l=r-s,d=s+t.collisionHeight-n-r;t.collisionHeight>n?l>0&&0>=d?(i=e.top+l+t.collisionHeight-n-r,e.top+=l-i):e.top=d>0&&0>=l?r:l>d?r+n-t.collisionHeight:r:l>0?e.top+=l:d>0?e.top-=d:e.top=o(e.top-s,e.top)}},flip:{left:function(e,t){var i,a,r=t.within,o=r.offset.left+r.scrollLeft,s=r.width,l=r.isWindow?r.scrollLeft:r.offset.left,d=e.left-t.collisionPosition.marginLeft,c=d-l,u=d+t.collisionWidth-s-l,p="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,h="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,m=-2*t.offset[0];0>c?(0>(i=e.left+p+h+m+t.collisionWidth-s-o)||n(c)>i)&&(e.left+=p+h+m):u>0&&(((a=e.left-t.collisionPosition.marginLeft+p+h+m-l)>0||u>n(a))&&(e.left+=p+h+m))},top:function(e,t){var i,a,r=t.within,o=r.offset.top+r.scrollTop,s=r.height,l=r.isWindow?r.scrollTop:r.offset.top,d=e.top-t.collisionPosition.marginTop,c=d-l,u=d+t.collisionHeight-s-l,p="top"===t.my[1]?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,h="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>c?(0>(a=e.top+p+h+m+t.collisionHeight-s-o)||n(c)>a)&&(e.top+=p+h+m):u>0&&(((i=e.top-t.collisionPosition.marginTop+p+h+m-l)>0||u>n(i))&&(e.top+=p+h+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,a,o,n,s=document.getElementsByTagName("body")[0],l=document.createElement("div");for(n in t=document.createElement(s?"div":"body"),a={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},s&&e.extend(a,{position:"absolute",left:"-1000px",top:"-1000px"}),a)t.style[n]=a[n];t.appendChild(l),(i=s||document.documentElement).insertBefore(t,i.firstChild),l.style.cssText="position: absolute; left: 10.7432222px;",o=e(l).offset().left,r=o>10&&11>o,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?void(this.destroyOnClear=!0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),void this._mouseDestroy())},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),!(this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0)&&(this.handle=this._getHandle(t),!!this.handle&&(this._blockFrames(!0===i.iframeFix?"iframe":i.iframeFix),!0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(e){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var a=this._uiHash();if(!1===this._trigger("drag",t,a))return this._mouseUp({}),!1;this.position=a.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,a=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(a=e.ui.ddmanager.drop(this,t)),this.dropped&&(a=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!a||"valid"===this.options.revert&&a||!0===this.options.revert||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,a)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==i._trigger("stop",t)&&i._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!e(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,a=e.isFunction(i.helper),r=a?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),a&&r[0]===this.element[0]&&this._setPositionRelative(),r[0]===this.element[0]||/(fixed|absolute)/.test(r.css("position"))||r.css("position","absolute"),r},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,a,r=this.options,o=this.document[0];return this.relativeContainer=null,r.containment?"window"===r.containment?void(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):"document"===r.containment?void(this.containment=[0,0,e(o).width()-this.helperProportions.width-this.margins.left,(e(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):r.containment.constructor===Array?void(this.containment=r.containment):("parent"===r.containment&&(r.containment=this.helper[0].parentNode),void((a=(i=e(r.containment))[0])&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(a.scrollWidth,a.offsetWidth):a.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(a.scrollHeight,a.offsetHeight):a.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i))):void(this.containment=null)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,a=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:a?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:a?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,a,r,o,n=this.options,s=this._isRootNode(this.scrollParent[0]),l=e.pageX,d=e.pageY;return s&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(a=this.relativeContainer.offset(),i=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(d=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(d=i[3]+this.offset.click.top)),n.grid&&(r=n.grid[1]?this.originalPageY+Math.round((d-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY,d=i?r-this.offset.click.top>=i[1]||r-this.offset.click.top>i[3]?r:r-this.offset.click.top>=i[1]?r-n.grid[1]:r+n.grid[1]:r,o=n.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-n.grid[0]:o+n.grid[0]:o),"y"===n.axis&&(l=this.originalPageX),"x"===n.axis&&(d=this.originalPageY)),{top:d-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,a){return a=a||this._uiHash(),e.ui.plugin.call(this,t,[i,a,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),a.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,a)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,a){var r=e.extend({},i,{item:a.element});a.sortables=[],e(a.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(a.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,r))})},stop:function(t,i,a){var r=e.extend({},i,{item:a.element});a.cancelHelperRemoval=!1,e.each(a.sortables,function(){var e=this;e.isOver?(e.isOver=0,a.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,r))})},drag:function(t,i,a){e.each(a.sortables,function(){var r=!1,o=this;o.positionAbs=a.positionAbs,o.helperProportions=a.helperProportions,o.offset.click=a.offset.click,o._intersectsWith(o.containerCache)&&(r=!0,e.each(a.sortables,function(){return this.positionAbs=a.positionAbs,this.helperProportions=a.helperProportions,this.offset.click=a.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&e.contains(o.element[0],this.element[0])&&(r=!1),r})),r?(o.isOver||(o.isOver=1,o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},t.target=o.currentItem[0],o._mouseCapture(t,!0),o._mouseStart(t,!0,!0),o.offset.click.top=a.offset.click.top,o.offset.click.left=a.offset.click.left,o.offset.parent.left-=a.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=a.offset.parent.top-o.offset.parent.top,a._trigger("toSortable",t),a.dropped=o.element,e.each(a.sortables,function(){this.refreshPositions()}),a.currentItem=a.element,o.fromOutside=a),o.currentItem&&(o._mouseDrag(t),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",t,o._uiHash(o)),o._mouseStop(t,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),a._refreshOffsets(t),i.position=a._generatePosition(t,!0),a._trigger("fromSortable",t),a.dropped=!1,e.each(a.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,a){var r=e("body"),o=a.options;r.css("cursor")&&(o._cursor=r.css("cursor")),r.css("cursor",o.cursor)},stop:function(t,i,a){var r=a.options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,a){var r=e(i.helper),o=a.options;r.css("opacity")&&(o._opacity=r.css("opacity")),r.css("opacity",o.opacity)},stop:function(t,i,a){var r=a.options;r._opacity&&e(i.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,a){var r=a.options,o=!1,n=a.scrollParentNotHidden[0],s=a.document[0];n!==s&&"HTML"!==n.tagName?(r.axis&&"x"===r.axis||(a.overflowOffset.top+n.offsetHeight-t.pageY<r.scrollSensitivity?n.scrollTop=o=n.scrollTop+r.scrollSpeed:t.pageY-a.overflowOffset.top<r.scrollSensitivity&&(n.scrollTop=o=n.scrollTop-r.scrollSpeed)),r.axis&&"y"===r.axis||(a.overflowOffset.left+n.offsetWidth-t.pageX<r.scrollSensitivity?n.scrollLeft=o=n.scrollLeft+r.scrollSpeed:t.pageX-a.overflowOffset.left<r.scrollSensitivity&&(n.scrollLeft=o=n.scrollLeft-r.scrollSpeed))):(r.axis&&"x"===r.axis||(t.pageY-e(s).scrollTop()<r.scrollSensitivity?o=e(s).scrollTop(e(s).scrollTop()-r.scrollSpeed):e(window).height()-(t.pageY-e(s).scrollTop())<r.scrollSensitivity&&(o=e(s).scrollTop(e(s).scrollTop()+r.scrollSpeed))),r.axis&&"y"===r.axis||(t.pageX-e(s).scrollLeft()<r.scrollSensitivity?o=e(s).scrollLeft(e(s).scrollLeft()-r.scrollSpeed):e(window).width()-(t.pageX-e(s).scrollLeft())<r.scrollSensitivity&&(o=e(s).scrollLeft(e(s).scrollLeft()+r.scrollSpeed)))),!1!==o&&e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(a,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,a){var r=a.options;a.snapElements=[],e(r.snap.constructor!==String?r.snap.items||":data(ui-draggable)":r.snap).each(function(){var t=e(this),i=t.offset();this!==a.element[0]&&a.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,a){var r,o,n,s,l,d,c,u,p,h,m=a.options,f=m.snapTolerance,g=i.offset.left,v=g+a.helperProportions.width,A=i.offset.top,C=A+a.helperProportions.height;for(p=a.snapElements.length-1;p>=0;p--)d=(l=a.snapElements[p].left-a.margins.left)+a.snapElements[p].width,u=(c=a.snapElements[p].top-a.margins.top)+a.snapElements[p].height,l-f>v||g>d+f||c-f>C||A>u+f||!e.contains(a.snapElements[p].item.ownerDocument,a.snapElements[p].item)?(a.snapElements[p].snapping&&a.options.snap.release&&a.options.snap.release.call(a.element,t,e.extend(a._uiHash(),{snapItem:a.snapElements[p].item})),a.snapElements[p].snapping=!1):("inner"!==m.snapMode&&(r=f>=Math.abs(c-C),o=f>=Math.abs(u-A),n=f>=Math.abs(l-v),s=f>=Math.abs(d-g),r&&(i.position.top=a._convertPositionTo("relative",{top:c-a.helperProportions.height,left:0}).top),o&&(i.position.top=a._convertPositionTo("relative",{top:u,left:0}).top),n&&(i.position.left=a._convertPositionTo("relative",{top:0,left:l-a.helperProportions.width}).left),s&&(i.position.left=a._convertPositionTo("relative",{top:0,left:d}).left)),h=r||o||n||s,"outer"!==m.snapMode&&(r=f>=Math.abs(c-A),o=f>=Math.abs(u-C),n=f>=Math.abs(l-g),s=f>=Math.abs(d-v),r&&(i.position.top=a._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=a._convertPositionTo("relative",{top:u-a.helperProportions.height,left:0}).top),n&&(i.position.left=a._convertPositionTo("relative",{top:0,left:l}).left),s&&(i.position.left=a._convertPositionTo("relative",{top:0,left:d-a.helperProportions.width}).left)),!a.snapElements[p].snapping&&(r||o||n||s||h)&&a.options.snap.snap&&a.options.snap.snap.call(a.element,t,e.extend(a._uiHash(),{snapItem:a.snapElements[p].item})),a.snapElements[p].snapping=r||o||n||s||h)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,a){var r,o=a.options,n=e.makeArray(e(o.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});n.length&&(r=parseInt(e(n[0]).css("zIndex"),10)||0,e(n).each(function(t){e(this).css("zIndex",r+t)}),this.css("zIndex",r+n.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,a){var r=e(i.helper),o=a.options;r.css("zIndex")&&(o._zIndex=r.css("zIndex")),r.css("zIndex",o.zIndex)},stop:function(t,i,a){var r=a.options;r._zIndex&&e(i.helper).css("zIndex",r._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,a=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(a)?a:function(e){return e.is(a)},this.proportions=function(){return arguments.length?void(t=arguments[0]):t||(t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight})},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var a=e.ui.ddmanager.droppables[this.options.scope];this._splice(a),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var a=i||e.ui.ddmanager.current,r=!1;return!(!a||(a.currentItem||a.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===a.options.scope&&i.accept.call(i.element[0],a.currentItem||a.element)&&e.ui.intersect(a,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(r=!0,!1):void 0}),!r&&(!!this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(a)),this.element)))},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,a,r){if(!i.offset)return!1;var o=(t.positionAbs||t.position.absolute).left+t.margins.left,n=(t.positionAbs||t.position.absolute).top+t.margins.top,s=o+t.helperProportions.width,l=n+t.helperProportions.height,d=i.offset.left,c=i.offset.top,u=d+i.proportions().width,p=c+i.proportions().height;switch(a){case"fit":return o>=d&&u>=s&&n>=c&&p>=l;case"intersect":return o+t.helperProportions.width/2>d&&u>s-t.helperProportions.width/2&&n+t.helperProportions.height/2>c&&p>l-t.helperProportions.height/2;case"pointer":return e(r.pageY,c,i.proportions().height)&&e(r.pageX,d,i.proportions().width);case"touch":return(n>=c&&p>=n||l>=c&&p>=l||c>n&&l>p)&&(o>=d&&u>=o||s>=d&&u>=s||d>o&&s>u);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,i){var a,r,o=e.ui.ddmanager.droppables[t.options.scope]||[],n=i?i.type:null,s=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(a=0;o.length>a;a++)if(!(o[a].options.disabled||t&&!o[a].accept.call(o[a].element[0],t.currentItem||t.element))){for(r=0;s.length>r;r++)if(s[r]===o[a].element[0]){o[a].proportions().height=0;continue e}o[a].visible="none"!==o[a].element.css("display"),o[a].visible&&("mousedown"===n&&o[a]._activate.call(o[a],i),o[a].offset=o[a].element.offset(),o[a].proportions({width:o[a].element[0].offsetWidth,height:o[a].element[0].offsetHeight}))}},drop:function(t,i){var a=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(a=this._drop.call(this,i)||a),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),a},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var a,r,o,n=e.ui.intersect(t,this,this.options.tolerance,i),s=!n&&this.isover?"isout":n&&!this.isover?"isover":null;s&&(this.options.greedy&&(r=this.options.scope,(o=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===r})).length&&((a=e(o[0]).droppable("instance")).greedyChild="isover"===s)),a&&"isover"===s&&(a.isover=!1,a.isout=!0,a._out.call(a,i)),this[s]=!0,this["isout"===s?"isover":"isout"]=!1,this["isover"===s?"_over":"_out"].call(this,i),a&&"isout"===s&&(a.isout=!1,a.isover=!0,a._over.call(a,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var a=i&&"left"===i?"scrollLeft":"scrollTop",r=!1;return t[a]>0||(t[a]=1,r=t[a]>0,t[a]=0,r)},_create:function(){var t,i,a,r,o=this,n=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!n.aspectRatio,aspectRatio:n.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:n.helper||n.ghost||n.animate?n.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=n.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)a=e.trim(t[i]),(r=e("<div class='ui-resizable-handle "+("ui-resizable-"+a)+"'></div>")).css({zIndex:n.zIndex}),"se"===a&&r.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[a]=".ui-resizable-"+a,this.element.append(r);this._renderAxis=function(t){var i,a,r,o;for(i in t=t||this.element,this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(a=e(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?a.outerHeight():a.outerWidth(),r=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(r,o),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(r=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=r&&r[1]?r[1]:"se")}),n.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){n.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){n.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,a,r=!1;for(i in this.handles)((a=e(this.handles[i])[0])===t.target||e.contains(a,t.target))&&(r=!0);return!this.options.disabled&&r},_mouseStart:function(t){var i,a,r,o=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),a=this._num(this.helper.css("top")),o.containment&&(i+=e(o.containment).scrollLeft()||0,a+=e(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:a},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:i,top:a},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,r=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===r?this.axis+"-resize":r),n.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,a,r=this.originalMousePosition,o=this.axis,n=t.pageX-r.left||0,s=t.pageY-r.top||0,l=this._change[o];return this._updatePrevProperties(),!!l&&(i=l.apply(this,[t,n,s]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),a=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(a)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1)},_mouseStop:function(t){this.resizing=!1;var i,a,r,o,n,s,l,d=this.options,c=this;return this._helper&&(r=(a=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=a?0:c.sizeDiff.width,n={width:c.helper.width()-o,height:c.helper.height()-r},s=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,l=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,d.animate||this.element.css(e.extend(n,{top:l,left:s})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!d.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,a,r,o,n=this.options;o={minWidth:this._isNumber(n.minWidth)?n.minWidth:0,maxWidth:this._isNumber(n.maxWidth)?n.maxWidth:1/0,minHeight:this._isNumber(n.minHeight)?n.minHeight:0,maxHeight:this._isNumber(n.maxHeight)?n.maxHeight:1/0},(this._aspectRatio||e)&&(t=o.minHeight*this.aspectRatio,a=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,r=o.maxWidth/this.aspectRatio,t>o.minWidth&&(o.minWidth=t),a>o.minHeight&&(o.minHeight=a),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>r&&(o.maxHeight=r)),this._vBoundaries=o},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,a=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===a&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===a&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,a=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,r=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,o=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,n=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,s=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,d=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(e.width=t.minWidth),n&&(e.height=t.minHeight),a&&(e.width=t.maxWidth),r&&(e.height=t.maxHeight),o&&d&&(e.left=s-t.minWidth),a&&d&&(e.left=s-t.maxWidth),n&&c&&(e.top=l-t.minHeight),r&&c&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],a=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],r=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(a[t],10)||0,i[t]+=parseInt(r[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize;return{left:this.originalPosition.left+t,width:i.width-t}},n:function(e,t,i){var a=this.originalSize;return{top:this.originalPosition.top+i,height:a.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,a){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,a]))},sw:function(t,i,a){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,a]))},ne:function(t,i,a){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,a]))},nw:function(t,i,a){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,a]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),a=i.options,r=i._proportionallyResizeElements,o=r.length&&/textarea/i.test(r[0].nodeName),n=o&&i._hasScroll(r[0],"left")?0:i.sizeDiff.height,s=o?0:i.sizeDiff.width,l={width:i.size.width-s,height:i.size.height-n},d=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(l,c&&d?{top:c,left:d}:{}),{duration:a.animateDuration,easing:a.animateEasing,step:function(){var a={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};r&&r.length&&e(r[0]).css({width:a.width,height:a.height}),i._updateCache(a),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,a,r,o,n,s,l=e(this).resizable("instance"),d=l.options,c=l.element,u=d.containment,p=u instanceof e?u.get(0):/parent/.test(u)?c.parent().get(0):u;p&&(l.containerElement=e(p),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(p),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,a){i[e]=l._num(t.css("padding"+a))}),l.containerOffset=t.offset(),l.containerPosition=t.position(),l.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},a=l.containerOffset,r=l.containerSize.height,o=l.containerSize.width,n=l._hasScroll(p,"left")?p.scrollWidth:o,s=l._hasScroll(p)?p.scrollHeight:r,l.parentData={element:p,left:a.left,top:a.top,width:n,height:s}))},resize:function(t){var i,a,r,o,n=e(this).resizable("instance"),s=n.options,l=n.containerOffset,d=n.position,c=n._aspectRatio||t.shiftKey,u={top:0,left:0},p=n.containerElement,h=!0;p[0]!==document&&/static/.test(p.css("position"))&&(u=l),d.left<(n._helper?l.left:0)&&(n.size.width=n.size.width+(n._helper?n.position.left-l.left:n.position.left-u.left),c&&(n.size.height=n.size.width/n.aspectRatio,h=!1),n.position.left=s.helper?l.left:0),d.top<(n._helper?l.top:0)&&(n.size.height=n.size.height+(n._helper?n.position.top-l.top:n.position.top),c&&(n.size.width=n.size.height*n.aspectRatio,h=!1),n.position.top=n._helper?l.top:0),r=n.containerElement.get(0)===n.element.parent().get(0),o=/relative|absolute/.test(n.containerElement.css("position")),r&&o?(n.offset.left=n.parentData.left+n.position.left,n.offset.top=n.parentData.top+n.position.top):(n.offset.left=n.element.offset().left,n.offset.top=n.element.offset().top),i=Math.abs(n.sizeDiff.width+(n._helper?n.offset.left-u.left:n.offset.left-l.left)),a=Math.abs(n.sizeDiff.height+(n._helper?n.offset.top-u.top:n.offset.top-l.top)),i+n.size.width>=n.parentData.width&&(n.size.width=n.parentData.width-i,c&&(n.size.height=n.size.width/n.aspectRatio,h=!1)),a+n.size.height>=n.parentData.height&&(n.size.height=n.parentData.height-a,c&&(n.size.width=n.size.height*n.aspectRatio,h=!1)),h||(n.position.left=n.prevPosition.left,n.position.top=n.prevPosition.top,n.size.width=n.prevSize.width,n.size.height=n.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,a=t.containerOffset,r=t.containerPosition,o=t.containerElement,n=e(t.helper),s=n.offset(),l=n.outerWidth()-t.sizeDiff.width,d=n.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(o.css("position"))&&e(this).css({left:s.left-r.left-a.left,width:l,height:d}),t._helper&&!i.animate&&/static/.test(o.css("position"))&&e(this).css({left:s.left-r.left-a.left,width:l,height:d})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance").options,i=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof t.alsoResize||t.alsoResize.parentNode?i(t.alsoResize):t.alsoResize.length?(t.alsoResize=t.alsoResize[0],i(t.alsoResize)):e.each(t.alsoResize,function(e){i(e)})},resize:function(t,i){var a=e(this).resizable("instance"),r=a.options,o=a.originalSize,n=a.originalPosition,s={height:a.size.height-o.height||0,width:a.size.width-o.width||0,top:a.position.top-n.top||0,left:a.position.left-n.left||0},l=function(t,a){e(t).each(function(){var t=e(this),r=e(this).data("ui-resizable-alsoresize"),o={},n=a&&a.length?a:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(n,function(e,t){var i=(r[t]||0)+(s[t]||0);i&&i>=0&&(o[t]=i||null)}),t.css(o)})};"object"!=typeof r.alsoResize||r.alsoResize.nodeType?l(r.alsoResize):e.each(r.alsoResize,function(e,t){l(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,a=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:a.height,width:a.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),a=i.options,r=i.size,o=i.originalSize,n=i.originalPosition,s=i.axis,l="number"==typeof a.grid?[a.grid,a.grid]:a.grid,d=l[0]||1,c=l[1]||1,u=Math.round((r.width-o.width)/d)*d,p=Math.round((r.height-o.height)/c)*c,h=o.width+u,m=o.height+p,f=a.maxWidth&&h>a.maxWidth,g=a.maxHeight&&m>a.maxHeight,v=a.minWidth&&a.minWidth>h,A=a.minHeight&&a.minHeight>m;a.grid=l,v&&(h+=d),A&&(m+=c),f&&(h-=d),g&&(m-=c),/^(se|s|e)$/.test(s)?(i.size.width=h,i.size.height=m):/^(ne)$/.test(s)?(i.size.width=h,i.size.height=m,i.position.top=n.top-p):/^(sw)$/.test(s)?(i.size.width=h,i.size.height=m,i.position.left=n.left-u):((0>=m-c||0>=h-d)&&(t=i._getPaddingPlusBorderDimensions(this)),m-c>0?(i.size.height=m,i.position.top=n.top-p):(m=c-t.height,i.size.height=m,i.position.top=n.top+o.height-m),h-d>0?(i.size.width=h,i.position.left=n.left-u):(h=d-t.width,i.size.width=h,i.position.left=n.left+o.width-h))}}),e.ui.resizable,e.widget("ui.selectable",e.ui.mouse,{version:"1.11.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){(t=e(i.options.filter,i.element[0])).addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,a=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(a.filter,this.element[0]),this._trigger("start",t),e(a.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),a.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var a=e.data(this,"selectable-item");a.startselected=!0,t.metaKey||t.ctrlKey||(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,i._trigger("unselecting",t,{unselecting:a.element}))}),e(t.target).parents().addBack().each(function(){var a,r=e.data(this,"selectable-item");return r?(a=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected"),r.$element.removeClass(a?"ui-unselecting":"ui-selected").addClass(a?"ui-selecting":"ui-unselecting"),r.unselecting=!a,r.selecting=a,r.selected=a,a?i._trigger("selecting",t,{selecting:r.element}):i._trigger("unselecting",t,{unselecting:r.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,a=this,r=this.options,o=this.opos[0],n=this.opos[1],s=t.pageX,l=t.pageY;return o>s&&(i=s,s=o,o=i),n>l&&(i=l,l=n,n=i),this.helper.css({left:o,top:n,width:s-o,height:l-n}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),d=!1;i&&i.element!==a.element[0]&&("touch"===r.tolerance?d=!(i.left>s||o>i.right||i.top>l||n>i.bottom):"fit"===r.tolerance&&(d=i.left>o&&s>i.right&&i.top>n&&l>i.bottom),d?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,a._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),a._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,a._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-unselecting"),a.unselecting=!1,a.startselected=!1,i._trigger("unselected",t,{unselected:a.element})}),e(".ui-selecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-selecting").addClass("ui-selected"),a.selecting=!1,a.selected=!0,a.startselected=!0,i._trigger("selected",t,{selected:a.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=!!this.items.length&&("x"===e.axis||this._isFloating(this.items[0].item)),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var a=null,r=!1,o=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,o.widgetName+"-item")===o?(a=e(this),!1):void 0}),e.data(t.target,o.widgetName+"-item")===o&&(a=e(t.target)),!!a&&(!(this.options.handle&&!i&&(e(this.options.handle,a).find("*").addBack().each(function(){this===t.target&&(r=!0)}),!r))&&(this.currentItem=a,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(t,i,a){var r,o,n=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),n.containment&&this._setContainment(),n.cursor&&"auto"!==n.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",n.cursor),this.storedStylesheet=e("<style>*{ cursor: "+n.cursor+" !important; }</style>").appendTo(o)),n.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",n.opacity)),n.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",n.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!a)for(r=this.containers.length-1;r>=0;r--)this.containers[r]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,a,r,o,n=this.options,s=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?this.scrollParent[0].scrollTop=s=this.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-this.overflowOffset.top<n.scrollSensitivity&&(this.scrollParent[0].scrollTop=s=this.scrollParent[0].scrollTop-n.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?this.scrollParent[0].scrollLeft=s=this.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-this.overflowOffset.left<n.scrollSensitivity&&(this.scrollParent[0].scrollLeft=s=this.scrollParent[0].scrollLeft-n.scrollSpeed)):(t.pageY-this.document.scrollTop()<n.scrollSensitivity?s=this.document.scrollTop(this.document.scrollTop()-n.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<n.scrollSensitivity&&(s=this.document.scrollTop(this.document.scrollTop()+n.scrollSpeed)),t.pageX-this.document.scrollLeft()<n.scrollSensitivity?s=this.document.scrollLeft(this.document.scrollLeft()-n.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<n.scrollSensitivity&&(s=this.document.scrollLeft(this.document.scrollLeft()+n.scrollSpeed))),!1!==s&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(r=(a=this.items[i]).item[0],(o=this._intersectsWithPointer(a))&&a.instance===this.currentContainer&&r!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==r&&!e.contains(this.placeholder[0],r)&&("semi-dynamic"!==this.options.type||!e.contains(this.element[0],r))){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(a))break;this._rearrange(t,a),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var a=this,r=this.placeholder.offset(),o=this.options.axis,n={};o&&"x"!==o||(n.left=r.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(n.top=r.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(n,parseInt(this.options.revert,10)||500,function(){a._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&a.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!a.length&&t.key&&a.push(t.key+"="),a.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},i.each(function(){a.push(e(t.item||this).attr(t.attribute||"id")||"")}),a},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,a=this.positionAbs.top,r=a+this.helperProportions.height,o=e.left,n=o+e.width,s=e.top,l=s+e.height,d=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||a+d>s&&l>a+d,p="y"===this.options.axis||t+c>o&&n>t+c,h=u&&p;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?h:t+this.helperProportions.width/2>o&&n>i-this.helperProportions.width/2&&a+this.helperProportions.height/2>s&&l>r-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),a=t&&i,r=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return!!a&&(this.floating?o&&"right"===o||"down"===r?2:1:r&&("down"===r?2:1))},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),a=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return this.floating&&r?"right"===r&&i||"left"===r&&!i:a&&("down"===a&&t||"up"===a&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){s.push(this)}var a,r,o,n,s=[],l=[],d=this._connectWith();if(d&&t)for(a=d.length-1;a>=0;a--)for(r=(o=e(d[a],this.document[0])).length-1;r>=0;r--)(n=e.data(o[r],this.widgetFullName))&&n!==this&&!n.options.disabled&&l.push([e.isFunction(n.options.items)?n.options.items.call(n.element):e(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);for(l.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),a=l.length-1;a>=0;a--)l[a][0].each(i);return e(s)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,a,r,o,n,s,l,d,c=this.items,u=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],p=this._connectWith();if(p&&this.ready)for(i=p.length-1;i>=0;i--)for(a=(r=e(p[i],this.document[0])).length-1;a>=0;a--)(o=e.data(r[a],this.widgetFullName))&&o!==this&&!o.options.disabled&&(u.push([e.isFunction(o.options.items)?o.options.items.call(o.element[0],t,{item:this.currentItem}):e(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(n=u[i][1],a=0,d=(s=u[i][0]).length;d>a;a++)(l=e(s[a])).data(this.widgetName+"-item",n),c.push({item:l,instance:n,width:0,height:0,left:0,top:0})},refreshPositions:function(t){var i,a,r,o;for(this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),i=this.items.length-1;i>=0;i--)(a=this.items[i]).instance!==this.currentContainer&&this.currentContainer&&a.item[0]!==this.currentItem[0]||(r=this.options.toleranceElement?e(this.options.toleranceElement,a.item):a.item,t||(a.width=r.outerWidth(),a.height=r.outerHeight()),o=r.offset(),a.left=o.left,a.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){var i,a=(t=t||this).options;a.placeholder&&a.placeholder.constructor!==String||(i=a.placeholder,a.placeholder={element:function(){var a=t.currentItem[0].nodeName.toLowerCase(),r=e("<"+a+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===a?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(r)}):"img"===a&&r.attr("src",t.currentItem.attr("src")),i||r.css("visibility","hidden"),r},update:function(e,r){(!i||a.forcePlaceholderSize)&&(r.height()||r.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),r.width()||r.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(a.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),a.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,a,r,o,n,s,l,d,c,u,p=null,h=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(p&&e.contains(this.containers[i].element[0],p.element[0]))continue;p=this.containers[i],h=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(p)if(1===this.containers.length)this.containers[h].containerCache.over||(this.containers[h]._trigger("over",t,this._uiHash(this)),this.containers[h].containerCache.over=1);else{for(r=1e4,o=null,n=(c=p.floating||this._isFloating(this.currentItem))?"left":"top",s=c?"width":"height",u=c?"clientX":"clientY",a=this.items.length-1;a>=0;a--)e.contains(this.containers[h].element[0],this.items[a].item[0])&&this.items[a].item[0]!==this.currentItem[0]&&(l=this.items[a].item.offset()[n],d=!1,t[u]-l>this.items[a][s]/2&&(d=!0),r>Math.abs(t[u]-l)&&(r=Math.abs(t[u]-l),o=this.items[a],this.direction=d?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[h])return void(this.currentContainer.containerCache.over||(this.containers[h]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1));o?this._rearrange(t,o,null,!0):this._rearrange(t,null,this.containers[h].element,!0),this._trigger("change",t,this._uiHash()),this.containers[h]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[h],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[h]._trigger("over",t,this._uiHash(this)),this.containers[h].containerCache.over=1}},_createHelper:function(t){var i=this.options,a=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return a.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]),a[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!a[0].style.width||i.forceHelperSize)&&a.width(this.currentItem.width()),(!a[0].style.height||i.forceHelperSize)&&a.height(this.currentItem.height()),a},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,a,r=this.options;"parent"===r.containment&&(r.containment=this.helper[0].parentNode),("document"===r.containment||"window"===r.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===r.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===r.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(r.containment)||(t=e(r.containment)[0],i=e(r.containment).offset(),a="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(a?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(a?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var a="absolute"===t?1:-1,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(r[0].tagName);return{top:i.top+this.offset.relative.top*a+this.offset.parent.top*a-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:r.scrollTop())*a,left:i.left+this.offset.relative.left*a+this.offset.parent.left*a-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:r.scrollLeft())*a}},_generatePosition:function(t){var i,a,r=this.options,o=t.pageX,n=t.pageY,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(s[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(n=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(n=this.containment[3]+this.offset.click.top)),r.grid&&(i=this.originalPageY+Math.round((n-this.originalPageY)/r.grid[1])*r.grid[1],n=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-r.grid[1]:i+r.grid[1]:i,a=this.originalPageX+Math.round((o-this.originalPageX)/r.grid[0])*r.grid[0],o=this.containment?a-this.offset.click.left>=this.containment[0]&&a-this.offset.click.left<=this.containment[2]?a:a-this.offset.click.left>=this.containment[0]?a-r.grid[0]:a+r.grid[0]:a)),{top:n-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:s.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:s.scrollLeft())}},_rearrange:function(e,t,i,a){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var r=this.counter;this._delay(function(){r===this.counter&&this.refreshPositions(!a)})},_clear:function(e,t){function i(e,t,i){return function(a){i._trigger(e,a,t._uiHash(t))}}this.reverting=!1;var a,r=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(a in this._storedCSS)("auto"===this._storedCSS[a]||"static"===this._storedCSS[a])&&(this._storedCSS[a]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&r.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||r.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(r.push(function(e){this._trigger("remove",e,this._uiHash())}),r.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),r.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),a=this.containers.length-1;a>=0;a--)t||r.push(i("deactivate",this,this.containers[a])),this.containers[a].containerCache.over&&(r.push(i("out",this,this.containers[a])),this.containers[a].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(a=0;r.length>a;a++)r[a].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===e.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.accordion",{version:"1.11.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?void this._activate(t):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||!1!==this.options.active||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),void("disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t))))},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,a=this.headers.length,r=this.headers.index(t.target),o=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(r+1)%a];break;case i.LEFT:case i.UP:o=this.headers[(r-1+a)%a];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[a-1]}o&&(e(t.target).attr("tabIndex",-1),e(o).attr("tabIndex",0),o.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=e()):!1===t.active?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,a=i.heightStyle,r=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),a=t.next(),r=a.uniqueId().attr("id");t.attr("aria-controls",r),a.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===a?(t=r.height(),this.element.siblings(":visible").each(function(){var i=e(this),a=i.css("position");"absolute"!==a&&"fixed"!==a&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===a&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,a=this.active,r=e(t.currentTarget),o=r[0]===a[0],n=o&&i.collapsible,s=n?e():r.next(),l=a.next(),d={oldHeader:a,oldPanel:l,newHeader:n?e():r,newPanel:s};t.preventDefault(),o&&!i.collapsible||!1===this._trigger("beforeActivate",t,d)||(i.active=!n&&this.headers.index(r),this.active=o?e():r,this._toggle(d),a.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&a.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),o||(r.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&r.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),r.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,a=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=a,this.options.animate?this._animate(i,a,t):(a.hide(),i.show(),this._toggleComplete(t)),a.attr({"aria-hidden":"true"}),a.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&a.length?a.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var a,r,o,n=this,s=0,l=e.length&&(!t.length||e.index()<t.index()),d=this.options.animate||{},c=l&&d.down||d,u=function(){n._toggleComplete(i)};return"number"==typeof c&&(o=c),"string"==typeof c&&(r=c),r=r||c.easing||d.easing,o=o||c.duration||d.duration,t.length?e.length?(a=e.show().outerHeight(),t.animate(this.hideProps,{duration:o,easing:r,step:function(e,t){t.now=Math.round(e)}}),void e.hide().animate(this.showProps,{duration:o,easing:r,complete:u,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?s+=i.now:"content"!==n.options.heightStyle&&(i.now=Math.round(a-t.outerHeight()-s),s=0)}})):t.animate(this.hideProps,o,r,u):e.animate(this.showProps,o,r,u)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,a,r,o,n=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:n=!1,a=this.previousFilter||"",r=String.fromCharCode(t.keyCode),o=!1,clearTimeout(this.filterTimer),r===a?o=!0:r=a+r,i=this._filterMenuItems(r),(i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i).length||(r=String.fromCharCode(t.keyCode),i=this._filterMenuItems(r)),i.length?(this.focus(t,i),this.previousFilter=r,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i=this,a=this.options.icons.submenu,r=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),r.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),r=e("<span>").addClass("ui-menu-icon ui-icon "+a).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(r),t.attr("aria-labelledby",i.attr("id"))}),(t=r.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=e(this);i._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),t.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,a;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),a=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",a.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=t.children(".ui-menu")).length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,a,r,o,n,s;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,a=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,r=t.offset().top-this.activeMenu.offset().top-i-a,o=this.activeMenu.scrollTop(),n=this.activeMenu.height(),s=t.outerHeight(),0>r?this.activeMenu.scrollTop(o+r):r+s>n&&this.activeMenu.scrollTop(o+r-n+s))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var a=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));a.length||(a=this.element),this._close(a),this.blur(t),this.activeMenu=a},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var a;this.active&&(a="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),a&&a.length&&this.active||(a=this.activeMenu.find(this.options.items)[t]()),this.focus(i,a)},nextPage:function(t){var i,a,r;return this.active?void(this.isLastItem()||(this._hasScroll()?(a=this.active.offset().top,r=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return 0>(i=e(this)).offset().top-a-r}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]()))):void this.next(t)},previousPage:function(t){var i,a,r;return this.active?void(this.isFirstItem()||(this._hasScroll()?(a=this.active.offset().top,r=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return(i=e(this)).offset().top-a+r>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first()))):void this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),a=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return a.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,a,r=this.element[0].nodeName.toLowerCase(),o="textarea"===r,n="input"===r;this.isMultiLine=!!o||!n&&this.element.prop("isContentEditable"),this.valueMethod=this.element[o||n?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(r){if(this.element.prop("readOnly"))return t=!0,a=!0,void(i=!0);t=!1,a=!1,i=!1;var o=e.ui.keyCode;switch(r.keyCode){case o.PAGE_UP:t=!0,this._move("previousPage",r);break;case o.PAGE_DOWN:t=!0,this._move("nextPage",r);break;case o.UP:t=!0,this._keyEvent("previous",r);break;case o.DOWN:t=!0,this._keyEvent("next",r);break;case o.ENTER:this.menu.active&&(t=!0,r.preventDefault(),this.menu.select(r));break;case o.TAB:this.menu.active&&this.menu.select(r);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(r),r.preventDefault());break;default:i=!0,this._searchTimeout(r)}},keypress:function(a){if(t)return t=!1,void((!this.isMultiLine||this.menu.element.is(":visible"))&&a.preventDefault());if(!i){var r=e.ui.keyCode;switch(a.keyCode){case r.PAGE_UP:this._move("previousPage",a);break;case r.PAGE_DOWN:this._move("nextPage",a);break;case r.UP:this._keyEvent("previous",a);break;case r.DOWN:this._keyEvent("next",a)}}},input:function(e){return a?(a=!1,void e.preventDefault()):void this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(e),void this._change(e))}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(a){a.target===t.element[0]||a.target===i||e.contains(i,a.target)||t.close()})})},menufocus:function(t,i){var a,r;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),void this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)})):(r=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:r})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(r.value),void((a=i.item.attr("aria-label")||r.value)&&e.trim(a).length&&(this.liveRegion.children().hide(),e("<div>").text(a).appendTo(this.liveRegion))))},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),a=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=a,this._delay(function(){this.previous=a,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,a=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,a){a(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,r){a.xhr&&a.xhr.abort(),a.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){r(e)},error:function(){r([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),a=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!a)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):!1!==this._trigger("search",t)?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var a=this;e.each(i,function(e,i){a._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[e](t):void this.search(null,t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var a=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return a.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var u,p,h="ui-button ui-widget ui-state-default ui-corner-all",m="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",f=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,a=t.form,r=e([]);return i&&(i=i.replace(/'/g,"\\'"),r=a?e(a).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),r};e.widget("ui.button",{version:"1.11.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,f),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,a="checkbox"===this.type||"radio"===this.type,r=a?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(h).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===u&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(r)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),a&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return!i.disabled&&void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var a=t.element[0];g(a).not(a).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return!i.disabled&&(e(this).addClass("ui-state-active"),u=this,void t.document.one("mouseup",function(){u=null}))}).bind("mouseup"+this.eventNamespace,function(){return!i.disabled&&void e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(t){return!i.disabled&&void((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"))}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),(i=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(h+" ui-state-active "+m).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),void(t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")))):void this._resetButton()},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"!==this.type){var t=this.buttonElement.removeClass(m),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),a=this.options.icons,r=a.primary&&a.secondary,o=[];a.primary||a.secondary?(this.options.text&&o.push("ui-button-text-icon"+(r?"s":a.primary?"-primary":"-secondary")),a.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+a.primary+"'></span>"),a.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+a.secondary+"'></span>"),this.options.text||(o.push(r?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):o.push("ui-button-text-only"),t.addClass(o.join(" "))}else this.options.label&&this.element.val(this.options.label)}}),e.widget("ui.buttonset",{version:"1.11.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),a=i.filter(":ui-button");i.not(":ui-button").button(),a.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.3"}}),e.extend(a.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return n(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var a,r,o;r="div"===(a=t.nodeName.toLowerCase())||"span"===a,t.id||(this.uuid+=1,t.id="dp"+this.uuid),(o=this._newInst(e(t),r)).settings=e.extend({},i||{}),"input"===a?this._connectDatepicker(t,o):r&&this._inlineDatepicker(t,o)},_newInst:function(t,i){return{id:t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?r(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var a=e(t);i.append=e([]),i.trigger=e([]),a.hasClass(this.markerClassName)||(this._attachments(a,i),a.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var a,r,o,n=this._get(i,"appendText"),s=this._get(i,"isRTL");i.append&&i.append.remove(),n&&(i.append=e("<span class='"+this._appendClass+"'>"+n+"</span>"),t[s?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),("focus"===(a=this._get(i,"showOn"))||"both"===a)&&t.focus(this._showDatepicker),("button"===a||"both"===a)&&(r=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:o,alt:r,title:r}):e("<button type='button'></button>").addClass(this._triggerClass).html(o?e("<img/>").attr({src:o,alt:r,title:r}):r)),t[s?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,a,r,o=new Date(2009,11,20),n=this._get(e,"dateFormat");n.match(/[DM]/)&&(t=function(e){for(i=0,a=0,r=0;e.length>r;r++)e[r].length>i&&(i=e[r].length,a=r);return a},o.setMonth(t(this._get(e,n.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(t(this._get(e,n.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),e.input.attr("size",this._formatDate(e,o).length)}},_inlineDatepicker:function(t,i){var a=e(t);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,a,r,o){var s,l,d,c,u,p=this._dialogInst;return p||(this.uuid+=1,s="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+s+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),(p=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},e.data(this._dialogInput[0],"datepicker",p)),n(p.settings,r||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(l=document.documentElement.clientWidth,d=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+c,d/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",p),this},_destroyDatepicker:function(t){var i,a=e(t),r=e.data(t,"datepicker");a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(r.append.remove(),r.trigger.remove(),a.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&a.removeClass(this.markerClassName).empty(),p===r&&(p=null))},_enableDatepicker:function(t){var i,a,r=e(t),o=e.data(t,"datepicker");r.hasClass(this.markerClassName)&&("input"===(i=t.nodeName.toLowerCase())?(t.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&((a=r.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,a,r=e(t),o=e.data(t,"datepicker");r.hasClass(this.markerClassName)&&("input"===(i=t.nodeName.toLowerCase())?(t.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&((a=r.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(e){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,a){var r,o,s,l,d=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):d?"all"===i?e.extend({},d.settings):this._get(d,i):null:(r=i||{},"string"==typeof i&&((r={})[i]=a),void(d&&(this._curInst===d&&this._hideDatepicker(),o=this._getDateDatepicker(t,!0),s=this._getMinMaxDate(d,"min"),l=this._getMinMaxDate(d,"max"),n(d.settings,r),null!==s&&void 0!==r.dateFormat&&void 0===r.minDate&&(d.settings.minDate=this._formatDate(d,s)),null!==l&&void 0!==r.dateFormat&&void 0===r.maxDate&&(d.settings.maxDate=this._formatDate(d,l)),"disabled"in r&&(r.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),d),this._autoSize(d),this._setDate(d,o),this._updateAlternate(d),this._updateDatepicker(d))))},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,a,r,o=e.datepicker._getInst(t.target),n=!0,s=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),n=!1;break;case 13:return(r=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",o.dpDiv))[0]&&e.datepicker._selectDay(t.target,o.selectedMonth,o.selectedYear,r[0]),(i=e.datepicker._get(o,"onSelect"))?(a=e.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[a,o])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(o,"stepBigMonths"):-e.datepicker._get(o,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(o,"stepBigMonths"):+e.datepicker._get(o,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),n=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),n=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,s?1:-1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(o,"stepBigMonths"):-e.datepicker._get(o,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),n=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,s?-1:1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(o,"stepBigMonths"):+e.datepicker._get(o,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),n=t.ctrlKey||t.metaKey;break;default:n=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):n=!1;n&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,a,r=e.datepicker._getInst(t.target);return e.datepicker._get(r,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(r,"dateFormat")),a=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">a||!i||i.indexOf(a)>-1):void 0},_doKeyUp:function(t){var i=e.datepicker._getInst(t.target);if(i.input.val()!==i.lastVal)try{e.datepicker.parseDate(e.datepicker._get(i,"dateFormat"),i.input?i.input.val():null,e.datepicker._getFormatConfig(i))&&(e.datepicker._setDateFromField(i),e.datepicker._updateAlternate(i),e.datepicker._updateDatepicker(i))}catch(e){}return!0},_showDatepicker:function(t){var i,a,r,o,s,l,d;("input"!==(t=t.target||t).nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),e.datepicker._isDisabledDatepicker(t)||e.datepicker._lastInput===t)||(i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),!1!==(r=(a=e.datepicker._get(i,"beforeShow"))?a.apply(t,[t,i]):{})&&(n(i.settings,r),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return!(o|="fixed"===e(this).css("position"))}),s={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),s=e.datepicker._checkOffset(i,s,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),d=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",function(e){for(var t,i;e.length&&e[0]!==document;){if(("absolute"===(t=e.css("position"))||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),d):i.dpDiv[l||"show"](l?d:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i)))},_updateDatepicker:function(t){this.maxRows=4,p=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,a=this._getNumberOfMonths(t),r=a[1],n=t.dpDiv.find("."+this._dayOverClass+" a");n.length>0&&o.apply(n.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),r>1&&t.dpDiv.addClass("ui-datepicker-multi-"+r).css("width",17*r+"em"),t.dpDiv[(1!==a[0]||1!==a[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,a){var r=t.dpDiv.outerWidth(),o=t.dpDiv.outerHeight(),n=t.input?t.input.outerWidth():0,s=t.input?t.input.outerHeight():0,l=document.documentElement.clientWidth+(a?0:e(document).scrollLeft()),d=document.documentElement.clientHeight+(a?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?r-n:0,i.left-=a&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=a&&i.top===t.input.offset().top+s?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+r>l&&l>r?Math.abs(i.left+r-l):0),i.top-=Math.min(i.top,i.top+o>d&&d>o?Math.abs(o+s):0),i},_findPos:function(t){for(var i,a=this._getInst(t),r=this._get(a,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[r?"previousSibling":"nextSibling"];return[(i=e(t).offset()).left,i.top]},_hideDatepicker:function(t){var i,a,r,o,n=this._curInst;!n||t&&n!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(n,"showAnim"),a=this._get(n,"duration"),r=function(){e.datepicker._tidyDialog(n)},e.effects&&(e.effects.effect[i]||e.effects[i])?n.dpDiv.hide(i,e.datepicker._get(n,"showOptions"),a,r):n.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?a:null,r),i||r(),this._datepickerShowing=!1,(o=this._get(n,"onClose"))&&o.apply(n.input?n.input[0]:null,[n.input?n.input.val():"",n]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),a=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==a)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,a){var r=e(t),o=this._getInst(r[0]);this._isDisabledDatepicker(r[0])||(this._adjustInstDate(o,i+("M"===a?this._get(o,"showCurrentAtPos"):0),a),this._updateDatepicker(o))},_gotoToday:function(t){var i,a=e(t),r=this._getInst(a[0]);this._get(r,"gotoCurrent")&&r.currentDay?(r.selectedDay=r.currentDay,r.drawMonth=r.selectedMonth=r.currentMonth,r.drawYear=r.selectedYear=r.currentYear):(i=new Date,r.selectedDay=i.getDate(),r.drawMonth=r.selectedMonth=i.getMonth(),r.drawYear=r.selectedYear=i.getFullYear()),this._notifyChange(r),this._adjustDate(a)},_selectMonthYear:function(t,i,a){var r=e(t),o=this._getInst(r[0]);o["selected"+("M"===a?"Month":"Year")]=o["draw"+("M"===a?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(r)},_selectDay:function(t,i,a,r){var o,n=e(t);e(r).hasClass(this._unselectableClass)||this._isDisabledDatepicker(n[0])||((o=this._getInst(n[0])).selectedDay=o.currentDay=e("a",r).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=a,this._selectDate(t,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var a,r=e(t),o=this._getInst(r[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),(a=this._get(o,"onSelect"))?a.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,a,r,o=this._get(t,"altField");o&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),a=this._getDate(t),r=this.formatDate(i,a,this._getFormatConfig(t)),e(o).each(function(){e(this).val(r)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,a){if(null==t||null==i)throw"Invalid arguments";if(""===(i="object"==typeof i?""+i:i+""))return null;var r,o,n,s,l=0,d=(a?a.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof d?d:(new Date).getFullYear()%100+parseInt(d,10),u=(a?a.dayNamesShort:null)||this._defaults.dayNamesShort,p=(a?a.dayNames:null)||this._defaults.dayNames,h=(a?a.monthNamesShort:null)||this._defaults.monthNamesShort,m=(a?a.monthNames:null)||this._defaults.monthNames,f=-1,g=-1,v=-1,A=-1,C=!1,y=function(e){var i=t.length>r+1&&t.charAt(r+1)===e;return i&&r++,i},b=function(e){var t=y(e),a="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,r=RegExp("^\\d{"+("y"===e?a:1)+","+a+"}"),o=i.substring(l).match(r);if(!o)throw"Missing number at position "+l;return l+=o[0].length,parseInt(o[0],10)},S=function(t,a,r){var o=-1,n=e.map(y(t)?r:a,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(n,function(e,t){var a=t[1];return i.substr(l,a.length).toLowerCase()===a.toLowerCase()?(o=t[0],l+=a.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+l},k=function(){if(i.charAt(l)!==t.charAt(r))throw"Unexpected literal at position "+l;l++};for(r=0;t.length>r;r++)if(C)"'"!==t.charAt(r)||y("'")?k():C=!1;else switch(t.charAt(r)){case"d":v=b("d");break;case"D":S("D",u,p);break;case"o":A=b("o");break;case"m":g=b("m");break;case"M":g=S("M",h,m);break;case"y":f=b("y");break;case"@":f=(s=new Date(b("@"))).getFullYear(),g=s.getMonth()+1,v=s.getDate();break;case"!":f=(s=new Date((b("!")-this._ticksTo1970)/1e4)).getFullYear(),g=s.getMonth()+1,v=s.getDate();break;case"'":y("'")?k():C=!0;break;default:k()}if(i.length>l&&(n=i.substr(l),!/^\s+/.test(n)))throw"Extra/unparsed characters found in date: "+n;if(-1===f?f=(new Date).getFullYear():100>f&&(f+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=f?0:-100)),A>-1)for(g=1,v=A;!((o=this._getDaysInMonth(f,g-1))>=v);)g++,v-=o;if((s=this._daylightSavingAdjust(new Date(f,g-1,v))).getFullYear()!==f||s.getMonth()+1!==g||s.getDate()!==v)throw"Invalid date";return s},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864e9*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var a,r=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,n=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,s=(i?i.monthNames:null)||this._defaults.monthNames,l=function(t){var i=e.length>a+1&&e.charAt(a+1)===t;return i&&a++,i},d=function(e,t,i){var a=""+t;if(l(e))for(;i>a.length;)a="0"+a;return a},c=function(e,t,i,a){return l(e)?a[t]:i[t]},u="",p=!1;if(t)for(a=0;e.length>a;a++)if(p)"'"!==e.charAt(a)||l("'")?u+=e.charAt(a):p=!1;else switch(e.charAt(a)){case"d":u+=d("d",t.getDate(),2);break;case"D":u+=c("D",t.getDay(),r,o);break;case"o":u+=d("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=d("m",t.getMonth()+1,2);break;case"M":u+=c("M",t.getMonth(),n,s);break;case"y":u+=l("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":p=!0;break;default:u+=e.charAt(a)}return u},_possibleChars:function(e){var t,i="",a=!1,r=function(i){var a=e.length>t+1&&e.charAt(t+1)===i;return a&&t++,a};for(t=0;e.length>t;t++)if(a)"'"!==e.charAt(t)||r("'")?i+=e.charAt(t):a=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":r("'")?i+="'":a=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),a=e.lastVal=e.input?e.input.val():null,r=this._getDefaultDate(e),o=r,n=this._getFormatConfig(e);try{o=this.parseDate(i,a,n)||r}catch(e){a=t?"":a}e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),e.currentDay=a?o.getDate():0,e.currentMonth=a?o.getMonth():0,e.currentYear=a?o.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,a){var r=null==i||""===i?a:"string"==typeof i?function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(e){}for(var a=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,r=a.getFullYear(),o=a.getMonth(),n=a.getDate(),s=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=s.exec(i);l;){switch(l[2]||"d"){case"d":case"D":n+=parseInt(l[1],10);break;case"w":case"W":n+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),n=Math.min(n,e.datepicker._getDaysInMonth(r,o));break;case"y":case"Y":r+=parseInt(l[1],10),n=Math.min(n,e.datepicker._getDaysInMonth(r,o))}l=s.exec(i)}return new Date(r,o,n)}(i):"number"==typeof i?isNaN(i)?a:function(e){var t=new Date;return t.setDate(t.getDate()+e),t}(i):new Date(i.getTime());return(r=r&&"Invalid Date"==""+r?a:r)&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var a=!t,r=e.selectedMonth,o=e.selectedYear,n=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=n.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=n.getMonth(),e.drawYear=e.selectedYear=e.currentYear=n.getFullYear(),r===e.selectedMonth&&o===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(a?"":this._formatDate(e))},_getDate:function(e){return!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay))},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),a="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(a,-i,"M")},next:function(){e.datepicker._adjustDate(a,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(a)},selectDay:function(){return e.datepicker._selectDay(a,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(a,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(a,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,a,r,o,n,s,l,d,c,u,p,h,m,f,g,v,A,C,y,b,S,k,D,_,I,w,P,T,B,x,F,O,M,E,$,N,L,U,R=new Date,G=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),W=this._get(e,"isRTL"),V=this._get(e,"showButtonPanel"),j=this._get(e,"hideIfNoPrevNext"),H=this._get(e,"navigationAsDateFormat"),Y=this._getNumberOfMonths(e),Z=this._get(e,"showCurrentAtPos"),z=this._get(e,"stepMonths"),X=1!==Y[0]||1!==Y[1],q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(e,"min"),Q=this._getMinMaxDate(e,"max"),K=e.drawMonth-Z,ee=e.drawYear;if(0>K&&(K+=12,ee--),Q)for(t=this._daylightSavingAdjust(new Date(Q.getFullYear(),Q.getMonth()-Y[0]*Y[1]+1,Q.getDate())),t=J&&J>t?J:t;this._daylightSavingAdjust(new Date(ee,K,1))>t;)0>--K&&(K=11,ee--);for(e.drawMonth=K,e.drawYear=ee,i=this._get(e,"prevText"),i=H?this.formatDate(i,this._daylightSavingAdjust(new Date(ee,K-z,1)),this._getFormatConfig(e)):i,a=this._canAdjustMonth(e,-1,ee,K)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"e":"w")+"'>"+i+"</span></a>":j?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"e":"w")+"'>"+i+"</span></a>",r=this._get(e,"nextText"),r=H?this.formatDate(r,this._daylightSavingAdjust(new Date(ee,K+z,1)),this._getFormatConfig(e)):r,o=this._canAdjustMonth(e,1,ee,K)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+r+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"w":"e")+"'>"+r+"</span></a>":j?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+r+"'><span class='ui-icon ui-icon-circle-triangle-"+(W?"w":"e")+"'>"+r+"</span></a>",n=this._get(e,"currentText"),s=this._get(e,"gotoCurrent")&&e.currentDay?q:G,n=H?this.formatDate(n,s,this._getFormatConfig(e)):n,l=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",d=V?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(W?l:"")+(this._isInRange(e,s)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+n+"</button>":"")+(W?"":l)+"</div>":"",c=parseInt(this._get(e,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(e,"showWeek"),p=this._get(e,"dayNames"),h=this._get(e,"dayNamesMin"),m=this._get(e,"monthNames"),f=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),A=this._get(e,"selectOtherMonths"),C=this._getDefaultDate(e),y="",S=0;Y[0]>S;S++){for(k="",this.maxRows=4,D=0;Y[1]>D;D++){if(_=this._daylightSavingAdjust(new Date(ee,K,e.selectedDay)),I=" ui-corner-all",w="",X){if(w+="<div class='ui-datepicker-group",Y[1]>1)switch(D){case 0:w+=" ui-datepicker-group-first",I=" ui-corner-"+(W?"right":"left");break;case Y[1]-1:w+=" ui-datepicker-group-last",I=" ui-corner-"+(W?"left":"right");break;default:w+=" ui-datepicker-group-middle",I=""}w+="'>"}for(w+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===S?W?o:a:"")+(/all|right/.test(I)&&0===S?W?a:o:"")+this._generateMonthYearHeader(e,K,ee,J,Q,S>0||D>0,m,f)+"</div><table class='ui-datepicker-calendar'><thead><tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",b=0;7>b;b++)P+="<th scope='col'"+((b+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+"><span title='"+p[T=(b+c)%7]+"'>"+h[T]+"</span></th>";for(w+=P+"</tr></thead><tbody>",B=this._getDaysInMonth(ee,K),ee===e.selectedYear&&K===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,B)),x=(this._getFirstDayOfMonth(ee,K)-c+7)%7,F=Math.ceil((x+B)/7),O=X&&this.maxRows>F?this.maxRows:F,this.maxRows=O,M=this._daylightSavingAdjust(new Date(ee,K,1-x)),E=0;O>E;E++){for(w+="<tr>",$=u?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(M)+"</td>":"",b=0;7>b;b++)N=g?g.apply(e.input?e.input[0]:null,[M]):[!0,""],U=(L=M.getMonth()!==K)&&!A||!N[0]||J&&J>M||Q&&M>Q,$+="<td class='"+((b+c+6)%7>=5?" ui-datepicker-week-end":"")+(L?" ui-datepicker-other-month":"")+(M.getTime()===_.getTime()&&K===e.selectedMonth&&e._keyEvent||C.getTime()===M.getTime()&&C.getTime()===_.getTime()?" "+this._dayOverClass:"")+(U?" "+this._unselectableClass+" ui-state-disabled":"")+(L&&!v?"":" "+N[1]+(M.getTime()===q.getTime()?" "+this._currentClass:"")+(M.getTime()===G.getTime()?" ui-datepicker-today":""))+"'"+(L&&!v||!N[2]?"":" title='"+N[2].replace(/'/g,"&#39;")+"'")+(U?"":" data-handler='selectDay' data-event='click' data-month='"+M.getMonth()+"' data-year='"+M.getFullYear()+"'")+">"+(L&&!v?"&#xa0;":U?"<span class='ui-state-default'>"+M.getDate()+"</span>":"<a class='ui-state-default"+(M.getTime()===G.getTime()?" ui-state-highlight":"")+(M.getTime()===q.getTime()?" ui-state-active":"")+(L?" ui-priority-secondary":"")+"' href='#'>"+M.getDate()+"</a>")+"</td>",M.setDate(M.getDate()+1),M=this._daylightSavingAdjust(M);w+=$+"</tr>"}++K>11&&(K=0,ee++),k+=w+="</tbody></table>"+(X?"</div>"+(Y[0]>0&&D===Y[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}y+=k}return y+=d,e._keyEvent=!1,y},_generateMonthYearHeader:function(e,t,i,a,r,o,n,s){var l,d,c,u,p,h,m,f,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),A=this._get(e,"showMonthAfterYear"),C="<div class='ui-datepicker-title'>",y="";if(o||!g)y+="<span class='ui-datepicker-month'>"+n[t]+"</span>";else{for(l=a&&a.getFullYear()===i,d=r&&r.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!l||c>=a.getMonth())&&(!d||r.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===t?" selected='selected'":"")+">"+s[c]+"</option>");y+="</select>"}if(A||(C+=y+(!o&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",o||!v)C+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(e,"yearRange").split(":"),p=(new Date).getFullYear(),h=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?p+parseInt(e,10):parseInt(e,10);return isNaN(t)?p:t},m=h(u[0]),f=Math.max(m,h(u[1]||"")),m=a?Math.max(m,a.getFullYear()):m,f=r?Math.min(f,r.getFullYear()):f,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";f>=m;m++)e.yearshtml+="<option value='"+m+"'"+(m===i?" selected='selected'":"")+">"+m+"</option>";e.yearshtml+="</select>",C+=e.yearshtml,e.yearshtml=null}return C+=this._get(e,"yearSuffix"),A&&(C+=(!o&&g&&v?"":"&#xa0;")+y),C+"</div>"},_adjustInstDate:function(e,t,i){var a=e.drawYear+("Y"===i?t:0),r=e.drawMonth+("M"===i?t:0),o=Math.min(e.selectedDay,this._getDaysInMonth(a,r))+("D"===i?t:0),n=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(a,r,o)));e.selectedDay=n.getDate(),e.drawMonth=e.selectedMonth=n.getMonth(),e.drawYear=e.selectedYear=n.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),r=i&&i>t?i:t;return a&&r>a?a:r},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,a){var r=this._getNumberOfMonths(e),o=this._daylightSavingAdjust(new Date(i,a+(0>t?t:r[0]*r[1]),1));return 0>t&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(e,o)},_isInRange:function(e,t){var i,a,r=this._getMinMaxDate(e,"min"),o=this._getMinMaxDate(e,"max"),n=null,s=null,l=this._get(e,"yearRange");return l&&(i=l.split(":"),a=(new Date).getFullYear(),n=parseInt(i[0],10),s=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(n+=a),i[1].match(/[+\-].*/)&&(s+=a)),(!r||t.getTime()>=r.getTime())&&(!o||t.getTime()<=o.getTime())&&(!n||t.getFullYear()>=n)&&(!s||s>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return{shortYearCutoff:t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,a){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var r=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(a,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),r,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new a,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.3",e.datepicker,e.widget("ui.dialog",{version:"1.11.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(e=t.parent.children().eq(t.index)).length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,a=this;if(this._isOpen&&!1!==this._trigger("beforeClose",t)){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{(i=this.document[0].activeElement)&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(e){}this._hide(this.uiDialog,this.options.hide,function(){a._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var a=!1,r=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),o=Math.max.apply(null,r);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),a=!0),a&&!i&&this._trigger("focus",t),a},open:function(){var t=this;return this._isOpen?void(this._moveToTop()&&this._focusTabbable()):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),void this._trigger("open"))},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement;this.uiDialog[0]===t||e.contains(this.uiDialog[0],t)||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),a=i.filter(":first"),r=i.filter(":last");t.target!==r[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==a[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){r.focus()}),t.preventDefault()):(this._delay(function(){a.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?void this.uiDialog.removeClass("ui-dialog-buttons"):(e.each(i,function(i,a){var r,o;a=e.isFunction(a)?{click:a,text:i}:a,a=e.extend({type:"button"},a),r=a.click,a.click=function(){r.apply(t.element[0],arguments)},o={icons:a.icons,text:a.showText},delete a.icons,delete a.showText,e("<button></button>",a).button(o).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),void this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,a=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(a,r){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",a,t(r))},drag:function(e,a){i._trigger("drag",e,t(a))},stop:function(r,o){var n=o.offset.left-i.document.scrollLeft(),s=o.offset.top-i.document.scrollTop();a.position={my:"left top",at:"left"+(n>=0?"+":"")+n+" top"+(s>=0?"+":"")+s,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",r,t(o))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,a=this.options,r=a.resizable,o=this.uiDialog.css("position"),n="string"==typeof r?r:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:a.maxWidth,maxHeight:a.maxHeight,minWidth:a.minWidth,minHeight:this._minHeight(),handles:n,start:function(a,r){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",a,t(r))},resize:function(e,a){i._trigger("resize",e,t(a))},stop:function(r,o){var n=i.uiDialog.offset(),s=n.left-i.document.scrollLeft(),l=n.top-i.document.scrollTop();a.height=i.uiDialog.height(),a.width=i.uiDialog.width(),a.position={my:"left top",at:"left"+(s>=0?"+":"")+s+" top"+(l>=0?"+":"")+l,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",r,t(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,a=!1,r={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(a=!0),e in i.resizableRelatedOptions&&(r[e]=t)}),a&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",r)},_setOption:function(e,t){var i,a,r=this.uiDialog;"dialogClass"===e&&r.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&((i=r.is(":data(ui-draggable)"))&&!t&&r.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&((a=r.is(":data(ui-resizable)"))&&!t&&r.resizable("destroy"),a&&"string"==typeof t&&r.resizable("option","handles",t),a||!1===t||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,a=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),a.minWidth>a.width&&(a.width=a.minWidth),e=this.uiDialog.css({height:"auto",width:a.width}).outerHeight(),t=Math.max(0,a.minHeight-e),i="number"==typeof a.maxHeight?Math.max(0,a.maxHeight-e):"none","auto"===a.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,a.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return!!e(t.target).closest(".ui-dialog").length||!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.progressbar",{version:"1.11.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),void this._refreshValue())},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=!1===e,"number"!=typeof e&&(e=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectmenu",{version:"1.11.3",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{class:"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{class:"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{class:"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{class:"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var a=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&a.index!==t.focusIndex&&(t._trigger("focus",e,{item:a}),t.isOpen||t._select(a,e)),t.focusIndex=a.index,t.button.attr("aria-activedescendant",t.menuItems.eq(a.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var a=this,r="";e.each(i,function(i,o){o.optgroup!==r&&(e("<li>",{class:"ui-selectmenu-optgroup ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:o.optgroup}).appendTo(t),r=o.optgroup),a._renderItemData(t,o)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var a=e("<li>");return i.disabled&&a.addClass("ui-state-disabled"),this._setText(a,i.label),a.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,a,r=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),r+=":not(.ui-state-disabled)"),(a="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](r).eq(-1):i[e+"All"](r).eq(0)).length&&this.menuInstance.focus(t,a)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?((e=window.getSelection()).removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection()).rangeCount&&(this.range=e.getRangeAt(0)):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,a){var r=e(a),o=r.parent("optgroup");i.push({element:r,index:t,value:r.val(),label:r.text(),optgroup:o.attr("label")||"",disabled:o.prop("disabled")||r.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,a=this.options,r=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o=[];for(i=a.values&&a.values.length||1,r.length>i&&(r.slice(i).remove(),r=r.slice(0,i)),t=r.length;i>t;t++)o.push("<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>");this.handles=r.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(!0===t.range&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,a,r,o,n,s,l,d=this,c=this.options;return!c.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},a=this._normValueFromMouse(i),r=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(a-d.values(t));(r>i||r===i&&(t===d._lastChangedValue||d.values(t)===c.min))&&(r=i,o=e(this),n=t)}),!1!==this._start(t,n)&&(this._mouseSliding=!0,this._handleIndex=n,o.addClass("ui-state-active").focus(),s=o.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-s.left-o.width()/2,top:t.pageY-s.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,n,a),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,a,r,o;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),(a=i/t)>1&&(a=1),0>a&&(a=0),"vertical"===this.orientation&&(a=1-a),r=this._valueMax()-this._valueMin(),o=this._valueMin()+a*r,this._trimAlignValue(o)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var a,r,o;this.options.values&&this.options.values.length?(a=this.values(t?0:1),2===this.options.values.length&&!0===this.options.range&&(0===t&&i>a||1===t&&a>i)&&(i=a),i!==this.values(t)&&((r=this.values())[t]=i,o=this._trigger("slide",e,{handle:this.handles[t],value:i,values:r}),a=this.values(t?0:1),!1!==o&&this.values(t,i))):i!==this.value()&&(!1!==(o=this._trigger("slide",e,{handle:this.handles[t],value:i}))&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,i){var a,r,o;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(a=this.options.values,r=arguments[0],o=0;a.length>o;o+=1)a[o]=this._trimAlignValue(r[o]),this._change(null,o);this._refreshValue()},_setOption:function(t,i){var a,r=0;switch("range"===t&&!0===this.options.range&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(r=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),a=0;r>a;a+=1)this._change(null,a);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return this._trimAlignValue(e)},_values:function(e){var t,i,a;if(arguments.length)return t=this.options.values[e],this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),a=0;i.length>a;a+=1)i[a]=this._trimAlignValue(i[a]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,a=e-i;return 2*Math.abs(i)>=t&&(a+=i>0?t:-t),parseFloat(a.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step;e=Math.floor((e-t)/i)*i+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,a,r,o,n=this.options.range,s=this.options,l=this,d=!this._animateOff&&s.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(a){i=(l.values(a)-l._valueMin())/(l._valueMax()-l._valueMin())*100,c["horizontal"===l.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[d?"animate":"css"](c,s.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===a&&l.range.stop(1,1)[d?"animate":"css"]({left:i+"%"},s.animate),1===a&&l.range[d?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:s.animate})):(0===a&&l.range.stop(1,1)[d?"animate":"css"]({bottom:i+"%"},s.animate),1===a&&l.range[d?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:s.animate}))),t=i}):(a=this.value(),r=this._valueMin(),o=this._valueMax(),i=o!==r?(a-r)/(o-r)*100:0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[d?"animate":"css"](c,s.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[d?"animate":"css"]({width:i+"%"},s.animate),"max"===n&&"horizontal"===this.orientation&&this.range[d?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:s.animate}),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[d?"animate":"css"]({height:i+"%"},s.animate),"max"===n&&"vertical"===this.orientation&&this.range[d?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:s.animate}))},_handleEvents:{keydown:function(t){var i,a,r,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),!1===this._start(t,o)))return}switch(r=this.options.step,i=a=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:a=this._valueMin();break;case e.ui.keyCode.END:a=this._valueMax();break;case e.ui.keyCode.PAGE_UP:a=this._trimAlignValue(i+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(i-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(i===this._valueMax())return;a=this._trimAlignValue(i+r);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(i===this._valueMin())return;a=this._trimAlignValue(i-r)}this._slide(t,o,a)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.spinner",{version:"1.11.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,a){var r=i.attr(a);void 0!==r&&r.length&&(t[a]=r)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(this._stop(),this._refresh(),void(this.previous!==this.element.val()&&this._trigger("change",e)))},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){this.element[0]===this.document[0].activeElement||(this.element.focus(),this.previous=a,this._delay(function(){this.previous=a}))}var a;a=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),!1!==this._start(t)&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?!1!==this._start(t)&&void this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,a=e.ui.keyCode;switch(t.keyCode){case a.UP:return this._repeat(null,1,t),!0;case a.DOWN:return this._repeat(null,-1,t),!0;case a.PAGE_UP:return this._repeat(null,i.page,t),!0;case a.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span></a><a class='ui-spinner-button ui-spinner-down ui-corner-br'><span class='ui-icon "+this.options.icons.down+"'>&#9660;</span></a>"},_start:function(e){return!(!this.spinning&&!1===this._trigger("start",e))&&(this.counter||(this.counter=1),this.spinning=!0,!0)},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",t,{value:i})||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,a=this.options;return i=e-(t=null!==a.min?a.min:0),e=t+(i=Math.round(i/a.step)*a.step),e=parseFloat(e.toFixed(this._precision())),null!==a.max&&e>a.max?a.max:null!==a.min&&a.min>e?a.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,void this.element.val(this._format(i))}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:s(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null!==e&&e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(null!==(i=this._parse(e))&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:s(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:s(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:s(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:s(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?void s(this._value).call(this,e):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,a;i=(t=t.cloneNode(!1)).href.replace(e,""),a=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(e){}try{a=decodeURIComponent(a)}catch(e){}return t.hash.length>1&&i===a}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=!1!==this.options.active&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,a=location.hash.substring(1);return null===t&&(a&&this.tabs.each(function(i,r){return e(r).attr("aria-controls")===a?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=!!this.tabs.length&&0)),!1!==t&&(-1===(t=this.tabs.index(this.tabs.eq(t)))&&(t=!i&&0)),!i&&!1===t&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),a=this.tabs.index(i),r=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:a++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:r=!1,a--;break;case e.ui.keyCode.END:a=this.anchors.length-1;break;case e.ui.keyCode.HOME:a=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(a);case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(a!==this.options.active&&a);default:return}t.preventDefault(),clearTimeout(this.activating),a=this._focusNextTab(a,r),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(a).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",a)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function a(){return t>r&&(t=0),0>t&&(t=r),t}for(var r=this.tabs.length-1;-1!==e.inArray(a(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?void this._activate(t):"disabled"===e?void this._setupDisabled(t):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||!1!==this.options.active||this._activate(0)),"event"===e&&this._setupEvents(t),void("heightStyle"===e&&this._setupHeightStyle(t)))},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),!1!==t.active&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,a=this.anchors,r=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,a){var r,o,n,s=e(a).uniqueId().attr("id"),l=e(a).closest("li"),d=l.attr("aria-controls");t._isLocal(a)?(n=(r=a.hash).substring(1),o=t.element.find(t._sanitizeSelector(r))):(r="#"+(n=l.attr("aria-controls")||e({}).uniqueId()[0].id),(o=t.element.find(r)).length||(o=t._createPanel(n)).insertAfter(t.panels[i-1]||t.tablist),o.attr("aria-live","polite")),o.length&&(t.panels=t.panels.add(o)),d&&l.data("ui-tabs-aria-controls",d),l.attr({"aria-controls":n,"aria-labelledby":s}),o.attr("aria-labelledby",s)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(a.not(this.anchors)),this._off(r.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,a=0;i=this.tabs[a];a++)!0===t||-1!==e.inArray(a,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,a=this.element.parent();"fill"===t?(i=a.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),a=t.css("position");"absolute"!==a&&"fixed"!==a&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,a=this.active,r=e(t.currentTarget).closest("li"),o=r[0]===a[0],n=o&&i.collapsible,s=n?e():this._getPanelForTab(r),l=a.length?this._getPanelForTab(a):e(),d={oldTab:a,oldPanel:l,newTab:n?e():r,newPanel:s};t.preventDefault(),r.hasClass("ui-state-disabled")||r.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||!1===this._trigger("beforeActivate",t,d)||(i.active=!n&&this.tabs.index(r),this.active=o?e():r,this.xhr&&this.xhr.abort(),l.length||s.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),s.length&&this.load(this.tabs.index(r),t),this._toggle(t,d))},_toggle:function(t,i){function a(){o.running=!1,o._trigger("activate",t,i)}function r(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),n.length&&o.options.show?o._show(n,o.options.show,a):(n.show(),a())}var o=this,n=i.newPanel,s=i.oldPanel;this.running=!0,s.length&&this.options.hide?this._hide(s,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s.hide(),r()),s.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&s.length?i.oldTab.attr("tabIndex",-1):n.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),n.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,a=this._findActive(t);a[0]!==this.active[0]&&(a.length||(a=this.active),i=a.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return!1===t?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;!1!==i&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(!0!==i){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var a=this,r=this.tabs.eq(t),o=r.find(".ui-tabs-anchor"),n=this._getPanelForTab(r),s={tab:r,panel:n};this._isLocal(o[0])||(this.xhr=e.ajax(this._ajaxSettings(o,i,s)),this.xhr&&"canceled"!==this.xhr.statusText&&(r.addClass("ui-tabs-loading"),n.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){n.html(e),a._trigger("load",i,s)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&a.panels.stop(!1,!0),r.removeClass("ui-tabs-loading"),n.removeAttr("aria-busy"),e===a.xhr&&delete a.xhr},1)})))},_ajaxSettings:function(t,i,a){var r=this;return{url:t.attr("href"),beforeSend:function(t,o){return r._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:o},a))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var a=(t.attr("aria-describedby")||"").split(/\s+/);a.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(a.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),a=(t.attr("aria-describedby")||"").split(/\s+/),r=e.inArray(i,a);-1!==r&&a.splice(r,1),t.removeData("ui-tooltip-id"),(a=e.trim(a.join(" ")))?t.attr("aria-describedby",a):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var a=this;return"disabled"===t?(this[i?"_disable":"_enable"](),void(this.options[t]=i)):(this._super(t,i),void("content"===t&&e.each(this.tooltips,function(e,t){a._updateContent(t.element)})))},_disable:function(){var t=this;e.each(this.tooltips,function(i,a){var r=e.Event("blur");r.target=r.currentTarget=a.element[0],t.close(r,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,a=e(t?t.target:this.element).closest(this.options.items);a.length&&!a.data("ui-tooltip-id")&&(a.attr("title")&&a.data("ui-tooltip-title",a.attr("title")),a.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&a.parents().each(function(){var t,a=e(this);a.data("ui-tooltip-open")&&((t=e.Event("blur")).target=t.currentTarget=this,i.close(t,!0)),a.attr("title")&&(a.uniqueId(),i.parents[this.id]={element:this,title:a.attr("title")},a.attr("title",""))}),this._updateContent(a,t))},_updateContent:function(e,t){var i,a=this.options.content,r=this,o=t?t.type:null;return"string"==typeof a?this._open(t,e,a):void((i=a.call(e[0],function(i){e.data("ui-tooltip-open")&&r._delay(function(){t&&(t.type=o),this._open(t,e,i)})}))&&this._open(t,e,i))},_open:function(t,i,a){function r(e){c.of=e,n.is(":hidden")||n.position(c)}var o,n,s,l,d,c=e.extend({},this.options.position);if(a){if(o=this._find(i))return void o.tooltip.find(".ui-tooltip-content").html(a);i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),n=o.tooltip,this._addDescribedBy(i,n.attr("id")),n.find(".ui-tooltip-content").html(a),this.liveRegion.children().hide(),a.clone?(d=a.clone()).removeAttr("id").find("[id]").removeAttr("id"):d=a,e("<div>").html(d).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:r}),r(t)):n.position(e.extend({of:i},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.show&&this.options.show.delay&&(l=this.delayedShow=setInterval(function(){n.is(":visible")&&(r(c.of),clearInterval(l))},e.fx.interval)),this._trigger("open",t,{tooltip:n}),s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var a=e.Event(t);a.currentTarget=i[0],this.close(a,!0)}}},i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(n)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)}},close:function(t){var i,a=this,r=e(t?t.currentTarget:this.element),o=this._find(r);o&&(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),r.data("ui-tooltip-title")&&!r.attr("title")&&r.attr("title",r.data("ui-tooltip-title")),this._removeDescribedBy(r),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){a._removeTooltip(e(this))}),r.removeData("ui-tooltip-open"),this._off(r,"mouseleave focusout keyup"),r[0]!==this.element[0]&&this._off(r,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete a.parents[t]}),o.closing=!0,this._trigger("close",t,{tooltip:i}),o.hiding||(o.closing=!1)))},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),a=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[a]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,a){var r=e.Event("blur"),o=a.element;r.target=r.currentTarget=o[0],t.close(r,!0),e("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}});var v="ui-effects-",A=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var a=c[t.type]||{};return null==e?i||!t.def?null:t.def:(e=a.floor?~~e:parseFloat(e),isNaN(e)?t.def:a.mod?(e+a.mod)%a.mod:0>e?0:e>a.max?a.max:e)}function a(i){var a=l(),r=a._rgba=[];return i=i.toLowerCase(),h(s,function(e,o){var n,s=o.re.exec(i),l=s&&o.parse(s),c=o.space||"rgba";return l?(n=a[c](l),a[d[c].cache]=n[d[c].cache],r=a._rgba=n._rgba,!1):t}),r.length?("0,0,0,0"===r.join()&&e.extend(r,o.transparent),a):o[i]}function r(e,t,i){return 1>6*(i=(i+1)%1)?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var o,n=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,a,r){return new e.Color.fn.parse(t,i,a,r)},d={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},c={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},u=l.support={},p=e("<p>")[0],h=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",u.rgba=p.style.backgroundColor.indexOf("rgba")>-1,h(d,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(r,n,s,c){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(n),n=t);var u=this,p=e.type(r),m=this._rgba=[];return n!==t&&(r=[r,n,s,c],p="array"),"string"===p?this.parse(a(r)||o._default):"array"===p?(h(d.rgba.props,function(e,t){m[t.idx]=i(r[t.idx],t)}),this):"object"===p?(h(d,r instanceof l?function(e,t){r[t.cache]&&(u[t.cache]=r[t.cache].slice())}:function(t,a){var o=a.cache;h(a.props,function(e,t){if(!u[o]&&a.to){if("alpha"===e||null==r[e])return;u[o]=a.to(u._rgba)}u[o][t.idx]=i(r[e],t,!0)}),u[o]&&0>e.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,a.from&&(u._rgba=a.from(u[o])))}),this):t},is:function(e){var i=l(e),a=!0,r=this;return h(d,function(e,o){var n,s=i[o.cache];return s&&(n=r[o.cache]||o.to&&o.to(r._rgba)||[],h(o.props,function(e,i){return null!=s[i.idx]?a=s[i.idx]===n[i.idx]:t})),a}),a},_space:function(){var e=[],t=this;return h(d,function(i,a){t[a.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var a=l(e),r=a._space(),o=d[r],n=0===this.alpha()?l("transparent"):this,s=n[o.cache]||o.to(n._rgba),u=s.slice();return a=a[o.cache],h(o.props,function(e,r){var o=r.idx,n=s[o],l=a[o],d=c[r.type]||{};null!==l&&(null===n?u[o]=l:(d.mod&&(l-n>d.mod/2?n+=d.mod:n-l>d.mod/2&&(n-=d.mod)),u[o]=i((l-n)*t+n,r)))}),this[r](u)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),a=i.pop(),r=l(t)._rgba;return l(e.map(i,function(e,t){return(1-a)*r[t]+a*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),a=i.pop();return t&&i.push(~~(255*a)),"#"+e.map(i,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,d.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,a=e[0]/255,r=e[1]/255,o=e[2]/255,n=e[3],s=Math.max(a,r,o),l=Math.min(a,r,o),d=s-l,c=s+l,u=.5*c;return t=l===s?0:a===s?60*(r-o)/d+360:r===s?60*(o-a)/d+120:60*(a-r)/d+240,i=0===d?0:.5>=u?d/c:d/(2-c),[Math.round(t)%360,i,u,null==n?1:n]},d.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],a=e[2],o=e[3],n=.5>=a?a*(1+i):a+i-a*i,s=2*a-n;return[Math.round(255*r(s,n,t+1/3)),Math.round(255*r(s,n,t)),Math.round(255*r(s,n,t-1/3)),o]},h(d,function(a,r){var o=r.props,s=r.cache,d=r.to,c=r.from;l.fn[a]=function(a){if(d&&!this[s]&&(this[s]=d(this._rgba)),a===t)return this[s].slice();var r,n=e.type(a),u="array"===n||"object"===n?a:arguments,p=this[s].slice();return h(o,function(e,t){var a=u["object"===n?e:t.idx];null==a&&(a=p[t.idx]),p[t.idx]=i(a,t)}),c?((r=l(c(p)))[s]=p,r):l(p)},h(o,function(t,i){l.fn[t]||(l.fn[t]=function(r){var o,s=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":a,d=this[l](),c=d[i.idx];return"undefined"===s?c:("function"===s&&(r=r.call(this,c),s=e.type(r)),null==r&&i.empty?this:("string"===s&&((o=n.exec(r))&&(r=c+parseFloat(o[2])*("+"===o[1]?1:-1))),d[i.idx]=r,this[l](d)))})})}),l.hook=function(t){var i=t.split(" ");h(i,function(t,i){e.cssHooks[i]={set:function(t,r){var o,n,s="";if("transparent"!==r&&("string"!==e.type(r)||(o=a(r)))){if(r=l(o||r),!u.rgba&&1!==r._rgba[3]){for(n="backgroundColor"===i?t.parentNode:t;(""===s||"transparent"===s)&&n&&n.style;)try{s=e.css(n,"backgroundColor"),n=n.parentNode}catch(e){}r=r.blend(s&&"transparent"!==s?s:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(e){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),e.cssHooks.borderColor={expand:function(e){var t={};return h(["Top","Right","Bottom","Left"],function(i,a){t["border"+a+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(A),function(){function t(t){var i,a,r=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,o={};if(r&&r.length&&r[0]&&r[r[0]])for(a=r.length;a--;)"string"==typeof r[i=r[a]]&&(o[e.camelCase(i)]=r[i]);else for(i in r)"string"==typeof r[i]&&(o[i]=r[i]);return o}function i(t,i){var a,o,n={};for(a in i)o=i[a],t[a]!==o&&(r[a]||(e.fx.step[a]||!isNaN(parseFloat(o)))&&(n[a]=o));return n}var a=["add","remove","toggle"],r={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(A.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(r,o,n,s){var l=e.speed(o,n,s);return this.queue(function(){var o,n=e(this),s=n.attr("class")||"",d=l.children?n.find("*").addBack():n;d=d.map(function(){return{el:e(this),start:t(this)}}),o=function(){e.each(a,function(e,t){r[t]&&n[t+"Class"](r[t])})},o(),d=d.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),n.attr("class",s),d=d.map(function(){var t=this,i=e.Deferred(),a=e.extend({},l,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,a),i.promise()}),e.when.apply(e,d.get()).done(function(){o(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),l.complete.call(n[0])})})},e.fn.extend({addClass:function(t){return function(i,a,r,o){return a?e.effects.animateClass.call(this,{add:i},a,r,o):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,a,r,o){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},a,r,o):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,a,r,o,n){return"boolean"==typeof a||void 0===a?r?e.effects.animateClass.call(this,a?{add:i}:{remove:i},r,o,n):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},a,r,o)}}(e.fn.toggleClass),switchClass:function(t,i,a,r,o){return e.effects.animateClass.call(this,{add:i,remove:t},a,r,o)}})}(),function(){function t(t,i,a,r){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(r=i,a=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(r=a,a=i,i={}),e.isFunction(a)&&(r=a,a=null),i&&e.extend(t,i),a=a||i.duration,t.duration=e.fx.off?0:"number"==typeof a?a:a in e.fx.speeds?e.fx.speeds[a]:e.fx.speeds._default,t.complete=r||i.complete,t}function i(t){return!(t&&"number"!=typeof t&&!e.fx.speeds[t])||("string"==typeof t&&!e.effects.effect[t]||(!!e.isFunction(t)||"object"==typeof t&&!t.effect))}e.extend(e.effects,{version:"1.11.3",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(v+t[i],e[0].style[t[i]])},restore:function(e,t){var i,a;for(a=0;t.length>a;a++)null!==t[a]&&(void 0===(i=e.data(v+t[a]))&&(i=""),e.css(t[a],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,a;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":a=0;break;case"center":a=.5;break;case"right":a=1;break;default:a=e[1]/t.width}return{x:a,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),float:t.css("float")},a=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),r={width:t.width(),height:t.height()},o=document.activeElement;try{o.id}catch(e){o=document.body}return t.wrap(a),(t[0]===o||e.contains(t[0],o))&&e(o).focus(),a=t.parent(),"static"===t.css("position")?(a.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,a){i[a]=t.css(a),isNaN(parseInt(i[a],10))&&(i[a]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(r),a.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,a,r){return r=r||{},e.each(i,function(e,i){var o=t.cssUnit(i);o[0]>0&&(r[i]=o[0]*a+o[1])}),r}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(o)&&o.call(r[0]),e.isFunction(t)&&t()}var r=e(this),o=a.complete,s=a.mode;(r.is(":hidden")?"hide"===s:"show"===s)?(r[s](),i()):n.call(r[0],a,i)}var a=t.apply(this,arguments),r=a.mode,o=a.queue,n=e.effects.effect[a.effect];return e.fx.off||!n?r?this[r](a.duration,a.complete):this.each(function(){a.complete&&a.complete.call(this)}):!1===o?this.each(i):this.queue(o||"fx",i)},show:function(e){return function(a){if(i(a))return e.apply(this,arguments);var r=t.apply(this,arguments);return r.mode="show",this.effect.call(this,r)}}(e.fn.show),hide:function(e){return function(a){if(i(a))return e.apply(this,arguments);var r=t.apply(this,arguments);return r.mode="hide",this.effect.call(this,r)}}(e.fn.hide),toggle:function(e){return function(a){if(i(a)||"boolean"==typeof a)return e.apply(this,arguments);var r=t.apply(this,arguments);return r.mode="toggle",this.effect.call(this,r)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),a=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(a=[parseFloat(i),t])}),a}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var a,r,o,n=e(this),s=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(n,t.mode||"hide"),d=t.direction||"up",c=/up|down|vertical/.test(d),u=c?"height":"width",p=c?"top":"left",h=/up|left|vertical|horizontal/.test(d),m={},f="show"===l;n.parent().is(".ui-effects-wrapper")?e.effects.save(n.parent(),s):e.effects.save(n,s),n.show(),r=(a=e.effects.createWrapper(n).css({overflow:"hidden"}))[u](),o=parseFloat(a.css(p))||0,m[u]=f?r:0,h||(n.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),m[p]=f?o:r+o),f&&(a.css(u,0),h||a.css(p,o+r)),a.animate(m,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===l&&n.hide(),e.effects.restore(n,s),e.effects.removeWrapper(n),i()}})},e.effects.effect.bounce=function(t,i){var a,r,o,n=e(this),s=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(n,t.mode||"effect"),d="hide"===l,c="show"===l,u=t.direction||"up",p=t.distance,h=t.times||5,m=2*h+(c||d?1:0),f=t.duration/m,g=t.easing,v="up"===u||"down"===u?"top":"left",A="up"===u||"left"===u,C=n.queue(),y=C.length;for((c||d)&&s.push("opacity"),e.effects.save(n,s),n.show(),e.effects.createWrapper(n),p||(p=n["top"===v?"outerHeight":"outerWidth"]()/3),c&&((o={opacity:1})[v]=0,n.css("opacity",0).css(v,A?2*-p:2*p).animate(o,f,g)),d&&(p/=Math.pow(2,h-1)),(o={})[v]=0,a=0;h>a;a++)(r={})[v]=(A?"-=":"+=")+p,n.animate(r,f,g).animate(o,f,g),p=d?2*p:p/2;d&&((r={opacity:0})[v]=(A?"-=":"+=")+p,n.animate(r,f,g)),n.queue(function(){d&&n.hide(),e.effects.restore(n,s),e.effects.removeWrapper(n),i()}),y>1&&C.splice.apply(C,[1,0].concat(C.splice(y,m+1))),n.dequeue()},e.effects.effect.clip=function(t,i){var a,r,o,n=e(this),s=["position","top","bottom","left","right","height","width"],l="show"===e.effects.setMode(n,t.mode||"hide"),d="vertical"===(t.direction||"vertical"),c=d?"height":"width",u=d?"top":"left",p={};e.effects.save(n,s),n.show(),a=e.effects.createWrapper(n).css({overflow:"hidden"}),o=(r="IMG"===n[0].tagName?a:n)[c](),l&&(r.css(c,0),r.css(u,o/2)),p[c]=l?o:0,p[u]=l?0:o/2,r.animate(p,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||n.hide(),e.effects.restore(n,s),e.effects.removeWrapper(n),i()}})},e.effects.effect.drop=function(t,i){var a,r=e(this),o=["position","top","bottom","left","right","opacity","height","width"],n=e.effects.setMode(r,t.mode||"hide"),s="show"===n,l=t.direction||"left",d="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l?"pos":"neg",u={opacity:s?1:0};e.effects.save(r,o),r.show(),e.effects.createWrapper(r),a=t.distance||r["top"===d?"outerHeight":"outerWidth"](!0)/2,s&&r.css("opacity",0).css(d,"pos"===c?-a:a),u[d]=(s?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+a,r.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}})},e.effects.effect.explode=function(t,i){function a(){v.push(this),v.length===c*u&&(p.css({visibility:"visible"}),e(v).remove(),h||p.hide(),i())}var r,o,n,s,l,d,c=t.pieces?Math.round(Math.sqrt(t.pieces)):3,u=c,p=e(this),h="show"===e.effects.setMode(p,t.mode||"hide"),m=p.show().css("visibility","hidden").offset(),f=Math.ceil(p.outerWidth()/u),g=Math.ceil(p.outerHeight()/c),v=[];for(r=0;c>r;r++)for(s=m.top+r*g,d=r-(c-1)/2,o=0;u>o;o++)n=m.left+o*f,l=o-(u-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*f,top:-r*g}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:f,height:g,left:n+(h?l*f:0),top:s+(h?d*g:0),opacity:h?0:1}).animate({left:n+(h?0:l*f),top:s+(h?0:d*g),opacity:h?1:0},t.duration||500,t.easing,a)},e.effects.effect.fade=function(t,i){var a=e(this),r=e.effects.setMode(a,t.mode||"toggle");a.animate({opacity:r},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var a,r,o=e(this),n=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(o,t.mode||"hide"),l="show"===s,d="hide"===s,c=t.size||15,u=/([0-9]+)%/.exec(c),p=!!t.horizFirst,h=l!==p,m=h?["width","height"]:["height","width"],f=t.duration/2,g={},v={};e.effects.save(o,n),o.show(),a=e.effects.createWrapper(o).css({overflow:"hidden"}),r=h?[a.width(),a.height()]:[a.height(),a.width()],u&&(c=parseInt(u[1],10)/100*r[d?0:1]),l&&a.css(p?{height:0,width:c}:{height:c,width:0}),g[m[0]]=l?r[0]:c,v[m[1]]=l?r[1]:0,a.animate(g,f,t.easing).animate(v,f,t.easing,function(){d&&o.hide(),e.effects.restore(o,n),e.effects.removeWrapper(o),i()})},e.effects.effect.highlight=function(t,i){var a=e(this),r=["backgroundImage","backgroundColor","opacity"],o=e.effects.setMode(a,t.mode||"show"),n={backgroundColor:a.css("backgroundColor")};"hide"===o&&(n.opacity=0),e.effects.save(a,r),a.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(n,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&a.hide(),e.effects.restore(a,r),i()}})},e.effects.effect.size=function(t,i){var a,r,o,n=e(this),s=["position","top","bottom","left","right","width","height","overflow","opacity"],l=["width","height","overflow"],d=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],u=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(n,t.mode||"effect"),h=t.restore||"effect"!==p,m=t.scale||"both",f=t.origin||["middle","center"],g=n.css("position"),v=h?s:["position","top","bottom","left","right","overflow","opacity"],A={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&n.show(),a={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},"toggle"===t.mode&&"show"===p?(n.from=t.to||A,n.to=t.from||a):(n.from=t.from||("show"===p?A:a),n.to=t.to||("hide"===p?A:a)),o={from:{y:n.from.height/a.height,x:n.from.width/a.width},to:{y:n.to.height/a.height,x:n.to.width/a.width}},("box"===m||"both"===m)&&(o.from.y!==o.to.y&&(v=v.concat(c),n.from=e.effects.setTransition(n,c,o.from.y,n.from),n.to=e.effects.setTransition(n,c,o.to.y,n.to)),o.from.x!==o.to.x&&(v=v.concat(u),n.from=e.effects.setTransition(n,u,o.from.x,n.from),n.to=e.effects.setTransition(n,u,o.to.x,n.to))),("content"===m||"both"===m)&&o.from.y!==o.to.y&&(v=v.concat(d).concat(l),n.from=e.effects.setTransition(n,d,o.from.y,n.from),n.to=e.effects.setTransition(n,d,o.to.y,n.to)),e.effects.save(n,v),n.show(),e.effects.createWrapper(n),n.css("overflow","hidden").css(n.from),f&&(r=e.effects.getBaseline(f,a),n.from.top=(a.outerHeight-n.outerHeight())*r.y,n.from.left=(a.outerWidth-n.outerWidth())*r.x,n.to.top=(a.outerHeight-n.to.outerHeight)*r.y,n.to.left=(a.outerWidth-n.to.outerWidth)*r.x),n.css(n.from),("content"===m||"both"===m)&&(c=c.concat(["marginTop","marginBottom"]).concat(d),u=u.concat(["marginLeft","marginRight"]),l=s.concat(c).concat(u),n.find("*[width]").each(function(){var i=e(this),a=i.height(),r=i.width(),n=i.outerHeight(),s=i.outerWidth();h&&e.effects.save(i,l),i.from={height:a*o.from.y,width:r*o.from.x,outerHeight:n*o.from.y,outerWidth:s*o.from.x},i.to={height:a*o.to.y,width:r*o.to.x,outerHeight:a*o.to.y,outerWidth:r*o.to.x},o.from.y!==o.to.y&&(i.from=e.effects.setTransition(i,c,o.from.y,i.from),i.to=e.effects.setTransition(i,c,o.to.y,i.to)),o.from.x!==o.to.x&&(i.from=e.effects.setTransition(i,u,o.from.x,i.from),i.to=e.effects.setTransition(i,u,o.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){h&&e.effects.restore(i,l)})})),n.animate(n.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===n.to.opacity&&n.css("opacity",n.from.opacity),"hide"===p&&n.hide(),e.effects.restore(n,v),h||("static"===g?n.css({position:"relative",top:n.to.top,left:n.to.left}):e.each(["top","left"],function(e,t){n.css(t,function(t,i){var a=parseInt(i,10),r=e?n.to.left:n.to.top;return"auto"===i?r+"px":a+r+"px"})})),e.effects.removeWrapper(n),i()}})},e.effects.effect.scale=function(t,i){var a=e(this),r=e.extend(!0,{},t),o=e.effects.setMode(a,t.mode||"effect"),n=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"hide"===o?0:100),s=t.direction||"both",l=t.origin,d={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},c="horizontal"!==s?n/100:1,u="vertical"!==s?n/100:1;r.effect="size",r.queue=!1,r.complete=i,"effect"!==o&&(r.origin=l||["middle","center"],r.restore=!0),r.from=t.from||("show"===o?{height:0,width:0,outerHeight:0,outerWidth:0}:d),r.to={height:d.height*c,width:d.width*u,outerHeight:d.outerHeight*c,outerWidth:d.outerWidth*u},r.fade&&("show"===o&&(r.from.opacity=0,r.to.opacity=1),"hide"===o&&(r.from.opacity=1,r.to.opacity=0)),a.effect(r)},e.effects.effect.puff=function(t,i){var a=e(this),r=e.effects.setMode(a,t.mode||"hide"),o="hide"===r,n=parseInt(t.percent,10)||150,s=n/100,l={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:r,complete:i,percent:o?n:100,from:o?l:{height:l.height*s,width:l.width*s,outerHeight:l.outerHeight*s,outerWidth:l.outerWidth*s}}),a.effect(t)},e.effects.effect.pulsate=function(t,i){var a,r=e(this),o=e.effects.setMode(r,t.mode||"show"),n="show"===o,s="hide"===o,l=n||"hide"===o,d=2*(t.times||5)+(l?1:0),c=t.duration/d,u=0,p=r.queue(),h=p.length;for((n||!r.is(":visible"))&&(r.css("opacity",0).show(),u=1),a=1;d>a;a++)r.animate({opacity:u},c,t.easing),u=1-u;r.animate({opacity:u},c,t.easing),r.queue(function(){s&&r.hide(),i()}),h>1&&p.splice.apply(p,[1,0].concat(p.splice(h,d+1))),r.dequeue()},e.effects.effect.shake=function(t,i){var a,r=e(this),o=["position","top","bottom","left","right","height","width"],n=e.effects.setMode(r,t.mode||"effect"),s=t.direction||"left",l=t.distance||20,d=t.times||3,c=2*d+1,u=Math.round(t.duration/c),p="up"===s||"down"===s?"top":"left",h="up"===s||"left"===s,m={},f={},g={},v=r.queue(),A=v.length;for(e.effects.save(r,o),r.show(),e.effects.createWrapper(r),m[p]=(h?"-=":"+=")+l,f[p]=(h?"+=":"-=")+2*l,g[p]=(h?"-=":"+=")+2*l,r.animate(m,u,t.easing),a=1;d>a;a++)r.animate(f,u,t.easing).animate(g,u,t.easing);r.animate(f,u,t.easing).animate(m,u/2,t.easing).queue(function(){"hide"===n&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}),A>1&&v.splice.apply(v,[1,0].concat(v.splice(A,c+1))),r.dequeue()},e.effects.effect.slide=function(t,i){var a,r=e(this),o=["position","top","bottom","left","right","width","height"],n=e.effects.setMode(r,t.mode||"show"),s="show"===n,l=t.direction||"left",d="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l,u={};e.effects.save(r,o),r.show(),a=t.distance||r["top"===d?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),s&&r.css(d,c?isNaN(a)?"-"+a:-a:a),u[d]=(s?c?"+=":"-=":c?"-=":"+=")+a,r.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}})},e.effects.effect.transfer=function(t,i){var a=e(this),r=e(t.to),o="fixed"===r.css("position"),n=e("body"),s=o?n.scrollTop():0,l=o?n.scrollLeft():0,d=r.offset(),c={top:d.top-s,left:d.left-l,height:r.innerHeight(),width:r.innerWidth()},u=a.offset(),p=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:u.top-s,left:u.left-l,height:a.innerHeight(),width:a.innerWidth(),position:o?"fixed":"absolute"}).animate(c,t.duration,t.easing,function(){p.remove(),i()})}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery.ui.widget"],e):"object"==typeof exports?e(require("jquery"),require("./vendor/jquery.ui.widget")):e(window.jQuery)}(function(e){"use strict";function t(t){var i="dragover"===t;return function(a){a.dataTransfer=a.originalEvent&&a.originalEvent.dataTransfer;var r=a.dataTransfer;r&&-1!==e.inArray("Files",r.types)&&!1!==this._trigger(t,e.Event(t,{delegatedEvent:a}))&&(a.preventDefault(),i&&(r.dropEffect="copy"))}}e.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))").test(window.navigator.userAgent)||e('<input type="file">').prop("disabled")),e.support.xhrFileUpload=!(!window.ProgressEvent||!window.FileReader),e.support.xhrFormDataFileUpload=!!window.FormData,e.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice),e.widget("blueimp.fileupload",{options:{dropZone:e(document),pasteZone:void 0,fileInput:void 0,replaceFileInput:!0,paramName:void 0,singleFileUploads:!0,limitMultiFileUploads:void 0,limitMultiFileUploadSize:void 0,limitMultiFileUploadSizeOverhead:512,sequentialUploads:!1,limitConcurrentUploads:void 0,forceIframeTransport:!1,redirect:void 0,redirectParamName:void 0,postMessage:void 0,multipart:!0,maxChunkSize:void 0,uploadedBytes:void 0,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,i){return t=this.messages[t]||t.toString(),i&&e.each(i,function(e,i){t=t.replace("{"+e+"}",i)}),t},formData:function(e){return e.serializeArray()},add:function(t,i){if(t.isDefaultPrevented())return!1;(i.autoUpload||!1!==i.autoUpload&&e(this).fileupload("option","autoUpload"))&&i.process().done(function(){i.submit()})},processData:!1,contentType:!1,cache:!1},_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:e.support.blobSlice&&function(){return(this.slice||this.webkitSlice||this.mozSlice).apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime(),this.loaded=0,this.bitrate=0,this.getBitrate=function(e,t,i){var a=e-this.timestamp;return(!this.bitrate||!i||a>i)&&(this.bitrate=(t-this.loaded)*(1e3/a)*8,this.loaded=t,this.timestamp=e),this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var i;return"function"===e.type(t.formData)?t.formData(t.form):e.isArray(t.formData)?t.formData:"object"===e.type(t.formData)?(i=[],e.each(t.formData,function(e,t){i.push({name:e,value:t})}),i):[]},_getTotal:function(t){var i=0;return e.each(t,function(e,t){i+=t.size||1}),i},_initProgressObject:function(t){var i={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,i):t._progress=i},_initResponseObject:function(e){var t;if(e._response)for(t in e._response)e._response.hasOwnProperty(t)&&delete e._response[t];else e._response={}},_onProgress:function(t,i){if(t.lengthComputable){var a,r=Date.now?Date.now():(new Date).getTime();if(i._time&&i.progressInterval&&r-i._time<i.progressInterval&&t.loaded!==t.total)return;i._time=r,a=Math.floor(t.loaded/t.total*(i.chunkSize||i._progress.total))+(i.uploadedBytes||0),this._progress.loaded+=a-i._progress.loaded,this._progress.bitrate=this._bitrateTimer.getBitrate(r,this._progress.loaded,i.bitrateInterval),i._progress.loaded=i.loaded=a,i._progress.bitrate=i.bitrate=i._bitrateTimer.getBitrate(r,a,i.bitrateInterval),this._trigger("progress",e.Event("progress",{delegatedEvent:t}),i),this._trigger("progressall",e.Event("progressall",{delegatedEvent:t}),this._progress)}},_initProgressListener:function(t){var i=this,a=t.xhr?t.xhr():e.ajaxSettings.xhr();a.upload&&(e(a.upload).bind("progress",function(e){var a=e.originalEvent;e.lengthComputable=a.lengthComputable,e.loaded=a.loaded,e.total=a.total,i._onProgress(e,t)}),t.xhr=function(){return a})},_isInstanceOf:function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},_initXHRData:function(t){var i,a=this,r=t.files[0],o=t.multipart||!e.support.xhrFileUpload,n="array"===e.type(t.paramName)?t.paramName[0]:t.paramName;t.headers=e.extend({},t.headers),t.contentRange&&(t.headers["Content-Range"]=t.contentRange),o&&!t.blob&&this._isInstanceOf("File",r)||(t.headers["Content-Disposition"]='attachment; filename="'+encodeURI(r.name)+'"'),o?e.support.xhrFormDataFileUpload&&(t.postMessage?(i=this._getFormData(t),t.blob?i.push({name:n,value:t.blob}):e.each(t.files,function(a,r){i.push({name:"array"===e.type(t.paramName)&&t.paramName[a]||n,value:r})})):(a._isInstanceOf("FormData",t.formData)?i=t.formData:(i=new FormData,e.each(this._getFormData(t),function(e,t){i.append(t.name,t.value)})),t.blob?i.append(n,t.blob,r.name):e.each(t.files,function(r,o){(a._isInstanceOf("File",o)||a._isInstanceOf("Blob",o))&&i.append("array"===e.type(t.paramName)&&t.paramName[r]||n,o,o.uploadName||o.name)})),t.data=i):(t.contentType=r.type||"application/octet-stream",t.data=t.blob||r),t.blob=null},_initIframeSettings:function(t){var i=e("<a></a>").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&i&&i!==location.host&&t.formData.push({name:t.redirectParamName||"redirect",value:t.redirect})},_initDataSettings:function(e){this._isXHRUpload(e)?(this._chunkedUpload(e,!0)||(e.data||this._initXHRData(e),this._initProgressListener(e)),e.postMessage&&(e.dataType="postmessage "+(e.dataType||""))):this._initIframeSettings(e)},_getParamName:function(t){var i=e(t.fileInput),a=t.paramName;return a?e.isArray(a)||(a=[a]):(a=[],i.each(function(){for(var t=e(this),i=t.prop("name")||"files[]",r=(t.prop("files")||[1]).length;r;)a.push(i),r-=1}),a.length||(a=[i.prop("name")||"files[]"])),a},_initFormSettings:function(t){t.form&&t.form.length||(t.form=e(t.fileInput.prop("form")),t.form.length||(t.form=e(this.options.fileInput.prop("form")))),t.paramName=this._getParamName(t),t.url||(t.url=t.form.prop("action")||location.href),t.type=(t.type||"string"===e.type(t.form.prop("method"))&&t.form.prop("method")||"").toUpperCase(),"POST"!==t.type&&"PUT"!==t.type&&"PATCH"!==t.type&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var i=e.extend({},this.options,t);return this._initFormSettings(i),this._initDataSettings(i),i},_getDeferredState:function(e){return e.state?e.state():e.isResolved()?"resolved":e.isRejected()?"rejected":"pending"},_enhancePromise:function(e){return e.success=e.done,e.error=e.fail,e.complete=e.always,e},_getXHRPromise:function(t,i,a){var r=e.Deferred(),o=r.promise();return i=i||this.options.context||o,!0===t?r.resolveWith(i,a):!1===t&&r.rejectWith(i,a),o.abort=r.promise,this._enhancePromise(o)},_addConvenienceMethods:function(t,i){var a=this,r=function(t){return e.Deferred().resolveWith(a,t).promise()};i.process=function(t,o){return(t||o)&&(i._processQueue=this._processQueue=(this._processQueue||r([this])).pipe(function(){return i.errorThrown?e.Deferred().rejectWith(a,[i]).promise():r(arguments)}).pipe(t,o)),this._processQueue||r([this])},i.submit=function(){return"pending"!==this.state()&&(i.jqXHR=this.jqXHR=!1!==a._trigger("submit",e.Event("submit",{delegatedEvent:t}),this)&&a._onSend(t,this)),this.jqXHR||a._getXHRPromise()},i.abort=function(){return this.jqXHR?this.jqXHR.abort():(this.errorThrown="abort",a._trigger("fail",null,this),a._getXHRPromise(!1))},i.state=function(){return this.jqXHR?a._getDeferredState(this.jqXHR):this._processQueue?a._getDeferredState(this._processQueue):void 0},i.processing=function(){return!this.jqXHR&&this._processQueue&&"pending"===a._getDeferredState(this._processQueue)},i.progress=function(){return this._progress},i.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),i=t&&t.split("-"),a=i&&i.length>1&&parseInt(i[1],10);return a&&a+1},_chunkedUpload:function(t,i){t.uploadedBytes=t.uploadedBytes||0;var a,r,o=this,n=t.files[0],s=n.size,l=t.uploadedBytes,d=t.maxChunkSize||s,c=this._blobSlice,u=e.Deferred(),p=u.promise();return!(!(this._isXHRUpload(t)&&c&&(l||d<s))||t.data)&&(!!i||(l>=s?(n.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",n.error])):(r=function(){var i=e.extend({},t),p=i._progress.loaded;i.blob=c.call(n,l,l+d,n.type),i.chunkSize=i.blob.size,i.contentRange="bytes "+l+"-"+(l+i.chunkSize-1)+"/"+s,o._initXHRData(i),o._initProgressListener(i),a=(!1!==o._trigger("chunksend",null,i)&&e.ajax(i)||o._getXHRPromise(!1,i.context)).done(function(a,n,d){l=o._getUploadedBytes(d)||l+i.chunkSize,p+i.chunkSize-i._progress.loaded&&o._onProgress(e.Event("progress",{lengthComputable:!0,loaded:l-i.uploadedBytes,total:l-i.uploadedBytes}),i),t.uploadedBytes=i.uploadedBytes=l,i.result=a,i.textStatus=n,i.jqXHR=d,o._trigger("chunkdone",null,i),o._trigger("chunkalways",null,i),l<s?r():u.resolveWith(i.context,[a,n,d])}).fail(function(e,t,a){i.jqXHR=e,i.textStatus=t,i.errorThrown=a,o._trigger("chunkfail",null,i),o._trigger("chunkalways",null,i),u.rejectWith(i.context,[e,t,a])})},this._enhancePromise(p),p.abort=function(){return a.abort()},r(),p)))},_beforeSend:function(e,t){0===this._active&&(this._trigger("start"),this._bitrateTimer=new this._BitrateTimer,this._progress.loaded=this._progress.total=0,this._progress.bitrate=0),this._initResponseObject(t),this._initProgressObject(t),t._progress.loaded=t.loaded=t.uploadedBytes||0,t._progress.total=t.total=this._getTotal(t.files)||1,t._progress.bitrate=t.bitrate=0,this._active+=1,this._progress.loaded+=t.loaded,this._progress.total+=t.total},_onDone:function(t,i,a,r){var o=r._progress.total,n=r._response;r._progress.loaded<o&&this._onProgress(e.Event("progress",{lengthComputable:!0,loaded:o,total:o}),r),n.result=r.result=t,n.textStatus=r.textStatus=i,n.jqXHR=r.jqXHR=a,this._trigger("done",null,r)},_onFail:function(e,t,i,a){var r=a._response;a.recalculateProgress&&(this._progress.loaded-=a._progress.loaded,this._progress.total-=a._progress.total),r.jqXHR=a.jqXHR=e,r.textStatus=a.textStatus=t,r.errorThrown=a.errorThrown=i,this._trigger("fail",null,a)},_onAlways:function(e,t,i,a){this._trigger("always",null,a)},_onSend:function(t,i){i.submit||this._addConvenienceMethods(t,i);var a,r,o,n,s=this,l=s._getAJAXSettings(i),d=function(){return s._sending+=1,l._bitrateTimer=new s._BitrateTimer,a=a||((r||!1===s._trigger("send",e.Event("send",{delegatedEvent:t}),l))&&s._getXHRPromise(!1,l.context,r)||s._chunkedUpload(l)||e.ajax(l)).done(function(e,t,i){s._onDone(e,t,i,l)}).fail(function(e,t,i){s._onFail(e,t,i,l)}).always(function(e,t,i){if(s._onAlways(e,t,i,l),s._sending-=1,s._active-=1,l.limitConcurrentUploads&&l.limitConcurrentUploads>s._sending)for(var a=s._slots.shift();a;){if("pending"===s._getDeferredState(a)){a.resolve();break}a=s._slots.shift()}0===s._active&&s._trigger("stop")})};return this._beforeSend(t,l),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(o=e.Deferred(),this._slots.push(o),n=o.pipe(d)):(this._sequence=this._sequence.pipe(d,d),n=this._sequence),n.abort=function(){return r=[void 0,"abort","abort"],a?a.abort():(o&&o.rejectWith(l.context,r),d())},this._enhancePromise(n)):d()},_onAdd:function(t,i){var a,r,o,n,s=this,l=!0,d=e.extend({},this.options,i),c=i.files,u=c.length,p=d.limitMultiFileUploads,h=d.limitMultiFileUploadSize,m=d.limitMultiFileUploadSizeOverhead,f=0,g=this._getParamName(d),v=0;if(!h||u&&void 0!==c[0].size||(h=void 0),(d.singleFileUploads||p||h)&&this._isXHRUpload(d))if(d.singleFileUploads||h||!p)if(!d.singleFileUploads&&h)for(o=[],a=[],n=0;n<u;n+=1)f+=c[n].size+m,(n+1===u||f+c[n+1].size+m>h||p&&n+1-v>=p)&&(o.push(c.slice(v,n+1)),(r=g.slice(v,n+1)).length||(r=g),a.push(r),v=n+1,f=0);else a=g;else for(o=[],a=[],n=0;n<u;n+=p)o.push(c.slice(n,n+p)),(r=g.slice(n,n+p)).length||(r=g),a.push(r);else o=[c],a=[g];return i.originalFiles=c,e.each(o||c,function(r,n){var d=e.extend({},i);return d.files=o?n:[n],d.paramName=a[r],s._initResponseObject(d),s._initProgressObject(d),s._addConvenienceMethods(t,d),l=s._trigger("add",e.Event("add",{delegatedEvent:t}),d)}),l},_replaceFileInput:function(t){var i=t.fileInput,a=i.clone(!0);t.fileInputClone=a,e("<form></form>").append(a)[0].reset(),i.after(a).detach(),e.cleanData(i.unbind("remove")),this.options.fileInput=this.options.fileInput.map(function(e,t){return t===i[0]?a[0]:t}),i[0]===this.element[0]&&(this.element=a)},_handleFileTreeEntry:function(t,i){var a,r=this,o=e.Deferred(),n=function(e){e&&!e.entry&&(e.entry=t),o.resolve([e])},s=function(){a.readEntries(function(e){e.length?(l=l.concat(e),s()):function(e){r._handleFileTreeEntries(e,i+t.name+"/").done(function(e){o.resolve(e)}).fail(n)}(l)},n)},l=[];return i=i||"",t.isFile?t._file?(t._file.relativePath=i,o.resolve(t._file)):t.file(function(e){e.relativePath=i,o.resolve(e)},n):t.isDirectory?(a=t.createReader(),s()):o.resolve([]),o.promise()},_handleFileTreeEntries:function(t,i){var a=this;return e.when.apply(e,e.map(t,function(e){return a._handleFileTreeEntry(e,i)})).pipe(function(){return Array.prototype.concat.apply([],arguments)})},_getDroppedFiles:function(t){var i=(t=t||{}).items;return i&&i.length&&(i[0].webkitGetAsEntry||i[0].getAsEntry)?this._handleFileTreeEntries(e.map(i,function(e){var t;return e.webkitGetAsEntry?((t=e.webkitGetAsEntry())&&(t._file=e.getAsFile()),t):e.getAsEntry()})):e.Deferred().resolve(e.makeArray(t.files)).promise()},_getSingleFileInputFiles:function(t){var i,a,r=(t=e(t)).prop("webkitEntries")||t.prop("entries");if(r&&r.length)return this._handleFileTreeEntries(r);if((i=e.makeArray(t.prop("files"))).length)void 0===i[0].name&&i[0].fileName&&e.each(i,function(e,t){t.name=t.fileName,t.size=t.fileSize});else{if(!(a=t.prop("value")))return e.Deferred().resolve([]).promise();i=[{name:a.replace(/^.*\\/,"")}]}return e.Deferred().resolve(i).promise()},_getFileInputFiles:function(t){return t instanceof e&&1!==t.length?e.when.apply(e,e.map(t,this._getSingleFileInputFiles)).pipe(function(){return Array.prototype.concat.apply([],arguments)}):this._getSingleFileInputFiles(t)},_onChange:function(t){var i=this,a={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(a.fileInput).always(function(r){a.files=r,i.options.replaceFileInput&&i._replaceFileInput(a),!1!==i._trigger("change",e.Event("change",{delegatedEvent:t}),a)&&i._onAdd(t,a)})},_onPaste:function(t){var i=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,a={files:[]};i&&i.length&&(e.each(i,function(e,t){var i=t.getAsFile&&t.getAsFile();i&&a.files.push(i)}),!1!==this._trigger("paste",e.Event("paste",{delegatedEvent:t}),a)&&this._onAdd(t,a))},_onDrop:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var i=this,a=t.dataTransfer,r={};a&&a.files&&a.files.length&&(t.preventDefault(),this._getDroppedFiles(a).always(function(a){r.files=a,!1!==i._trigger("drop",e.Event("drop",{delegatedEvent:t}),r)&&i._onAdd(t,r)}))},_onDragOver:t("dragover"),_onDragEnter:t("dragenter"),_onDragLeave:t("dragleave"),_initEventHandlers:function(){this._isXHRUpload(this.options)&&(this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave}),this._on(this.options.pasteZone,{paste:this._onPaste})),e.support.fileInput&&this._on(this.options.fileInput,{change:this._onChange})},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragenter dragleave dragover drop"),this._off(this.options.pasteZone,"paste"),this._off(this.options.fileInput,"change")},_setOption:function(t,i){var a=-1!==e.inArray(t,this._specialOptions);a&&this._destroyEventHandlers(),this._super(t,i),a&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;void 0===t.fileInput?t.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]'):t.fileInput instanceof e||(t.fileInput=e(t.fileInput)),t.dropZone instanceof e||(t.dropZone=e(t.dropZone)),t.pasteZone instanceof e||(t.pasteZone=e(t.pasteZone))},_getRegExp:function(e){var t=e.split("/"),i=t.pop();return t.shift(),new RegExp(t.join("/"),i)},_isRegExpOption:function(t,i){return"url"!==t&&"string"===e.type(i)&&/^\/.*\/[igm]{0,3}$/.test(i)},_initDataAttributes:function(){var t=this,i=this.options,a=this.element.data();e.each(this.element[0].attributes,function(e,r){var o,n=r.name.toLowerCase();/^data-/.test(n)&&(n=n.slice(5).replace(/-[a-z]/g,function(e){return e.charAt(1).toUpperCase()}),o=a[n],t._isRegExpOption(n,o)&&(o=t._getRegExp(o)),i[n]=o)})},_create:function(){this._initDataAttributes(),this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=0,this._initProgressObject(this),this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(t){var i=this;t&&!this.options.disabled&&(t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always(function(e){t.files=e,i._onAdd(null,t)}):(t.files=e.makeArray(t.files),this._onAdd(null,t)))},send:function(t){if(t&&!this.options.disabled){if(t.fileInput&&!t.files){var i,a,r=this,o=e.Deferred(),n=o.promise();return n.abort=function(){return a=!0,i?i.abort():(o.reject(null,"abort","abort"),n)},this._getFileInputFiles(t.fileInput).always(function(e){a||(e.length?(t.files=e,(i=r._onSend(null,t)).then(function(e,t,i){o.resolve(e,t,i)},function(e,t,i){o.reject(e,t,i)})):o.reject())}),this._enhancePromise(n)}if(t.files=e.makeArray(t.files),t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})}),"undefined"==typeof _siteBuilderSocialMedia&&(_siteBuilderSocialMedia={}),_siteBuilderSocialMedia.htmlDecode=function(e){return $("<div/>").html(e).text()},_siteBuilderSocialMedia.businessID=$("#hdnSiteBuilderBusinessID").val();var ApiURLEnumSocialMedia={sharesporstyle:(ApiPath="websiteapi/homepage/")+"sharesporstyle",getstyleimagecommaseparated:ApiPath+"getstyleimagecommaseparated"};function isJsonString(e){try{JSON.parse(e)}catch(e){return!1}return!0}function MyAccountlistener(e){if(null!=e&&"undefined"!=e&&null!=e.data&&"undefined"!=e.data&&isJsonString(e.data||e.originalEvent.data)){var t=JSON.parse(e.data||e.originalEvent.data);if("setMyAccountIframeHeight"===t.eventType)if(void 0!==t.height&&null!=t.height){var i=window.screen.availHeight;window.matchMedia("(max-width: 991px)").matches||(i<820&&(i=820),t.height<i&&(t.height=820)),$(".vagaro-iframe iframe").length>0&&($(".vagaro-iframe iframe")[0].style.cssText="height:"+t.height+"px!important;min-height:"+i+"px !important")}}}_siteBuilderSocialMedia.iosDevices=/iPad|iPhone|iPod|iTouch/.test(navigator.userAgent)&&!window.MSStream,_siteBuilderSocialMedia.InPageWidget_Ios=self!==top&&_siteBuilderSocialMedia.iosDevices,_siteBuilderSocialMedia.InPageWidget_Ios?ScrollTarget=$("body"):ScrollTarget=$(window),_siteBuilderSocialMedia.getscrollTop=function(e){$(e).scrollTop();return _siteBuilderSocialMedia.InPageWidget_Ios?-1*$("#page-wrapper").position().top:$(window).scrollTop()},_siteBuilderSocialMedia.shareBusiness=function(e){switch(e.toLowerCase()){case"facebook":var t={BusinessName:_siteBuilderSocialMedia.htmlDecode(businessName),vagaroUrl:vagaroUrl,imageUrl:$("#dvBusinessImage").attr("data-original")};_siteBuilderSocialMedia.PostonFacebook(null,"BusinessDetail",t);break;case"twitter":var i=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+vagaroUrl:""),a=escape(i+"&text=Check out this business on Vagaro: "+_siteBuilderSocialMedia.htmlDecode(businessName)+"&related=vagaro");_siteBuilderSocialMedia.PostOnTwitter(a);break;case"pinterest":i=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+vagaroUrl:"");var r=$("#dvBusinessImage").attr("data-original"),o="";1==$("#pbusinessDescription").length&&(o=$("#pbusinessDescription").text());a=i+"?"+new URLSearchParams({text:_siteBuilderSocialMedia.htmlDecode(businessName),media:r,description:_siteBuilderSocialMedia.htmlDecode(o).substring(0,500)}).toString();_siteBuilderSocialMedia.PostOnPint(a);break;case"email":_siteBuilderSocialMedia.MailClick(null,null,"BusinessDetail")}_siteBuilderSocialMedia.showHideSharingOptions()},_siteBuilderSocialMedia.PostonFacebook=function(e,t,i){var a;if(_siteBuilderSocialMedia.curtemp=$(e).closest(".brick"),_siteBuilderSocialMedia.Spname="",_siteBuilderSocialMedia.Address="",_siteBuilderSocialMedia.BusinessUrl="",_siteBuilderSocialMedia.image="",_siteBuilderSocialMedia.BusinessName="",_siteBuilderSocialMedia.Servicetitle="",_siteBuilderSocialMedia.Styletitle="",_siteBuilderSocialMedia.msg="","Stylist"==t?(_siteBuilderSocialMedia.Spname=$("#spnProviderName",_siteBuilderSocialMedia.curtemp).html(),_siteBuilderSocialMedia.BusinessName=$(_siteBuilderSocialMedia.curtemp).find("#spnAddress").data().businessname,_siteBuilderSocialMedia.Address=$(_siteBuilderSocialMedia.curtemp).find("#spnAddress").data().address,_siteBuilderSocialMedia.BusinessUrl=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+$("#arating",_siteBuilderSocialMedia.curtemp).attr("href"):""),_siteBuilderSocialMedia.image=$("#imgServiceProvider_"+_siteBuilderDetail.businessID+"_"+_siteBuilderSocialMedia.curtemp.data().spid,_siteBuilderSocialMedia.curtemp).attr("src"),_siteBuilderSocialMedia.msg="Service Provider has been posted."):"Photos"==t?(_siteBuilderSocialMedia.curtemp=$(e).parents(".cust-img-popup-slider"),(void 0===_siteBuilderSocialMedia.curtemp||null==_siteBuilderSocialMedia.curtemp||_siteBuilderSocialMedia.curtemp.length<=0)&&(_siteBuilderSocialMedia.curtemp=$(e).parents(".gallery-solo-image")),_siteBuilderSocialMedia.image=$("#imgServiceImage_"+_siteBuilderSocialMedia.curtemp.data().styleid,_siteBuilderSocialMedia.curtemp).attr("src"),_siteBuilderSocialMedia.BusinessName=$("#divSalonName_"+_siteBuilderSocialMedia.curtemp.data().styleid,_siteBuilderSocialMedia.curtemp).html(),_siteBuilderSocialMedia.Servicetitle=_siteBuilderSocialMedia.curtemp.data().servicetitle,_siteBuilderSocialMedia.Styletitle=_siteBuilderSocialMedia.curtemp.data().styletitle,_siteBuilderSocialMedia.BusinessUrl=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_siteBuilderSocialMedia.curtemp.data().vagarourl.toLowerCase():"")+"/styles",_siteBuilderSocialMedia.msg="Portfolio has been posted."):"Deals"==t?(_siteBuilderSocialMedia.BusinessName=$("#lblPromotionTitleHome").text(),_siteBuilderSocialMedia.titletimestamp=$("#hdnScTitletimestamp").val(),_siteBuilderSocialMedia.vagaroURL=$("#hdnScVagarourl").val(),_siteBuilderSocialMedia.Styletitle=$("#promotionDesHome",".deals-text-cont").text(),_siteBuilderSocialMedia.image=$("#imgPromotion").attr("src"),_siteBuilderSocialMedia.BusinessUrl=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_siteBuilderSocialMedia.vagaroURL:"")+"/deals/"+_siteBuilderSocialMedia.titletimestamp,_siteBuilderSocialMedia.msg="Deals has been posted."):"BusinessDetail"==t&&(_siteBuilderSocialMedia.image=i.imageUrl,_siteBuilderSocialMedia.BusinessName=i.BusinessName,_siteBuilderSocialMedia.BusinessUrl=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+i.vagaroUrl.toLowerCase():""),_siteBuilderSocialMedia.msg="Business has been posted."),a=_siteBuilderSocialMedia,"undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("promotionsharefacebook|"+_siteBuilderSocialMedia.BusinessUrl+"|"+_siteBuilderSocialMedia.Servicetitle)}catch(e){}else _siteBuilderSocialMedia.CheckFacebookControllRenders(a,t)},_siteBuilderSocialMedia.CheckFacebookControllRenders=function(e,t){if($("#dvFaceBookControl").length>0)e.FacebookLoader(e,t);else{ShowLoader(!0),objReqFacebookData={},objReqFacebookData.UserControlPath="~/UserControls/General/ucFacebookLoader.ascx",objReqFacebookData.PageNamePath="~/Home.aspx",objReqFacebookData.isRemoveFormTag=!0;var i=new vagaro.ajax;i.datamodel.IsNewVagaroAPI=!0,i.datamodel.Token="websiteapi/homepage/loadusercontrol",i.datamodel.data=objReqFacebookData,i.datamodel.callback=function(i){ShowLoader(!1),$("body").append(i),$("#dvFaceBookControl").length>0&&null!=t&&e.FacebookLoader(e,t)},i.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert({message:"An Error Has Occurred",title:"Oops!"})},i.Post()}},_siteBuilderSocialMedia.FacebookLoader=function(e,t){"products"==t?e.LoadProductonFacebook():"inventory"==t?e.LoadInventoryonFacebook():$FacebookLoader(function(){FBAPP.funcPostfeature(unescape(e.BusinessName),e.Spname,e.Address,e.BusinessUrl,e.Servicetitle,e.Styletitle,e.image,t,function(t){null!=t&&null!=t&&null!=t.id&&null!=t.id&&vagaro.alertsmall(e.msg)})})},_siteBuilderSocialMedia.PostOnTwitter=function(e){if(e=unescape(e).replace(/<br *\/?>/gi,"\n"),_siteBuilderSocialMedia.TwitterURL="https://twitter.com/intent/tweet?url="+e,_siteBuilderSocialMedia.TwitterURL=encodeURI(_siteBuilderSocialMedia.TwitterURL),"undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("promotionsharetwitter|"+_siteBuilderSocialMedia.TwitterURL)}catch(e){}else _siteBuilderSocialMedia.left=screen.width/2-300,_siteBuilderSocialMedia.top=screen.height/2-160,_siteBuilderSocialMedia.targetWin=window.open(_siteBuilderSocialMedia.TwitterURL,"shareWindow","toolbar=no,location=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=600,height=320,left="+_siteBuilderSocialMedia.left+",top="+_siteBuilderSocialMedia.top),_siteBuilderSocialMedia.targetWin&&!_siteBuilderSocialMedia.targetWin.closed&&void 0!==_siteBuilderSocialMedia.targetWin&&void 0!==_siteBuilderSocialMedia.targetWin.closed||_siteBuilderSocialMedia.alert("Window cannot be opened as popup is blocked in your browser");return!1},_siteBuilderSocialMedia.PostOnPint=function(e){e=(e=unescape(e).replace(/<br *\/?>/gi,"\n")).replace(/#/g,"%23");var t=encodeURIComponent(e);if(_siteBuilderSocialMedia.PinUrl="https://www.pinterest.com/pin/create/button/?url="+t,"undefined"!=typeof isWindowsApp&&isWindowsApp)try{window.external.notify("pinterestpage|"+_siteBuilderSocialMedia.PinUrl)}catch(e){console.error("Error notifying external window:",e)}else _siteBuilderSocialMedia.left=screen.width/2-300,_siteBuilderSocialMedia.top=screen.height/2-140,_siteBuilderSocialMedia.targetWin=window.open(_siteBuilderSocialMedia.PinUrl,"Pinterest","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=600, height=280, top="+_siteBuilderSocialMedia.top+", left="+_siteBuilderSocialMedia.left),_siteBuilderSocialMedia.targetWin&&!_siteBuilderSocialMedia.targetWin.closed&&void 0!==_siteBuilderSocialMedia.targetWin&&void 0!==_siteBuilderSocialMedia.targetWin.closed||vagaro.alertsmall("Window cannot be opened as popup is blocked in your browser");return!1},_siteBuilderSocialMedia.MailClick=function(e,t,i,a){if("undefined"==typeof UserID||null==UserID||""==UserID||parseInt(UserID)<=0)return vagaro.alertmidium("Login is required to send message."),!1;$("#divSpEmail").length<=0?_siteBuilderSocialMedia.LoadSocialMediaSendEmail(e,t,i,a):(_siteBuilderSocialMedia.validator=$("#mailValidateSharing").validate(),$("#divSPpopupcontent").find("input:text,textarea").each(function(){$(this).val(""),$(this).removeClass("loginInput errorInput"),$("#"+$(this).attr("id")+"-error").css("display","none")}),"Stylelist"==i?(_siteBuilderSocialMedia.SPblock=$(t).attr("id","divSpEmailBody").css("position","relative").css("top","0px").css("opacity","1").css("left","0").css("height","auto"),scrollPos=_siteBuilderSocialMedia.getscrollTop(ScrollTarget),$("#divSpEmail").modal("show"),$("html, body").addClass("hide-bgscrollappoint"),$("#hdnUrl").val(location.protocol+"//"+location.host+$("#arating",_siteBuilderSocialMedia.SPblock).attr("href")+"/book-now"),$("#lblSMPName").val(e),$("#divtemplate").html(_siteBuilderSocialMedia.SPblock),$("#arating","#divtemplate").remove(),$("#divDistance","#divtemplate").remove(),$(".galler-caption","#divtemplate").remove(),$("#btnsendEmail").attr("onclick","_siteBuilderSocialMedia.SendMail('Stylist')")):"Photos"==i?($("#txtSenderEmailerror").css("display","none"),$("#txtReceiverEmailerror").css("display","none"),_siteBuilderSocialMedia.styleblock=$(t).clone(),_siteBuilderSocialMedia.styleblock.removeClass("gallery-solo-image"),_siteBuilderSocialMedia.styleblock.show(),_siteBuilderSocialMedia.styleblock.attr("class","gallerydetail w-inline-block"),_siteBuilderSocialMedia.styleblock.find("div#imgServiceImage_"+_siteBuilderSocialMedia.styleblock.data().styleid).attr("style",""),_siteBuilderSocialMedia.styleblock.find("div#imgServiceImage_"+_siteBuilderSocialMedia.styleblock.data().styleid).attr("class",""),_siteBuilderSocialMedia.styleblock.find(".more-photos-text").remove(),_siteBuilderSocialMedia.styleblock.find("#imgLike").remove(),_siteBuilderSocialMedia.styleblock.find(".imgstyles1").addClass("gallery-image-alt"),_siteBuilderSocialMedia.styleblock.find("#forMailDescription").show(),_siteBuilderSocialMedia.imgURL=_siteBuilderSocialMedia.styleblock.find(".imgstyles1").attr("data-original"),_siteBuilderSocialMedia.styleblock.find(".imgstyles1").attr("src",_siteBuilderSocialMedia.imgURL),_siteBuilderSocialMedia.styleblock.find(".imgstyles1").show(),$("#imgServiceImage1",_siteBuilderSocialMedia.styleblock).removeAttr("onclick"),$("#imgServiceImage_"+_siteBuilderSocialMedia.styleblock.data().styleid,_siteBuilderSocialMedia.styleblock).removeAttr("onclick"),_siteBuilderSocialMedia.styleblock.attr("id","divSpEmailBody").removeAttr("onmouseleave").css("position","relative").css("top","0px").css("opacity","1").css("left","0").css("height","auto"),$("#divSpEmail").modal("show"),scrollPos=_siteBuilderSocialMedia.getscrollTop(ScrollTarget),$("html, body").addClass("hide-bgscrollappoint"),_siteBuilderSocialMedia.header="<div class='homegallerypopup flamingo-button bottom-radius-none' style='width:"+_siteBuilderSocialMedia.styleblock.css("width")+"'>"+e+"</div>",$("#divtemplate").html(""),$("#divtemplate").append(_siteBuilderSocialMedia.header),$("#divtemplate").append(_siteBuilderSocialMedia.styleblock),$(".gallery-hover-div",$(_siteBuilderSocialMedia.styleblock)).remove(),$("#divtemplate").html($("#divtemplate").html()),$("#btnsendEmail").attr("onclick","_siteBuilderSocialMedia.SendMail('Photos','"+e.toString().replace(/'/g,"\\'")+"');")):"Deals"==i?($("#divSpEmail").modal("show"),scrollPos=_siteBuilderSocialMedia.getscrollTop(ScrollTarget),$("html, body").addClass("hide-bgscrollappoint"),$("#divtemplate").html(""),BusinessName=$("#lblSalonName").text(),_siteBuilderSocialMedia.titletimestamp=$("#hdnScTitletimestamp").val(),_siteBuilderSocialMedia.vagaroURL=$("#hdnScVagarourl").val(),_siteBuilderSocialMedia.promotionTitle=$("#lblPromotionTitleHome").text(),image=$("#imgPromotion").attr("src"),_siteBuilderSocialMedia.promoUrl=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_siteBuilderSocialMedia.vagaroURL:"")+"/deals/"+_siteBuilderSocialMedia.titletimestamp,_siteBuilderSocialMedia.objPromotionImage=$("#divPromoImage").clone(),$("#divDealSharingMobile",_siteBuilderSocialMedia.objPromotionImage).remove(),_siteBuilderSocialMedia.SPblock=$("<div>",{id:"divSpEmailBody"}).css("position","relative").css("top","0px").css("opacity","1").css("left","0").css("height","auto"),_siteBuilderSocialMedia.SPblock.append('<h1 class="daily-deal-large-header flamingo-background-color"><span id="lblPromotionTitleHome" class="text-capitalize">'+_siteBuilderSocialMedia.promotionTitle+"</span></h1>"),_siteBuilderSocialMedia.SPblock.append('<div class="daily-deal-bus-and-distance-div flamingo-background-color"><div class="bus-name-daily"><span id="lblSalonName">'+BusinessName+"</span></div></div>"),_siteBuilderSocialMedia.SPblock.append('<a class="text-decoration-none" aria-hidden="true" href="'+_siteBuilderSocialMedia.promoUrl+'"><div class="pos-relative">'+_siteBuilderSocialMedia.objPromotionImage.html()+"</div></a>"),$("#divtemplate").append(_siteBuilderSocialMedia.SPblock),$("#btnsendEmail").attr("onclick","_siteBuilderSocialMedia.SendMail('Deals')"),msg="Deals has been posted."):"BusinessDetail"==i&&($("#divSpEmail").modal("show"),scrollPos=_siteBuilderSocialMedia.getscrollTop(ScrollTarget),$("html, body").addClass("hide-bgscrollappoint"),$("#divtemplate").html(""),_siteBuilderSocialMedia.SPblock=$("<div>",{id:"divSpEmailBody"}).css("position","relative").css("top","0px").css("opacity","1").css("left","0").css("height","auto"),_siteBuilderSocialMedia.SPblock.append('<h1 class="daily-deal-large-header"><span id="lblPromotionTitleHome" class="text-capitalize">'+businessName+"</span></h1>"),_siteBuilderSocialMedia.SPblock.append('<a class="text-decoration-none" aria-hidden="true" href="'+vagaroUrl+'"><div class="pos-relative"><img class="lazy daily-detail-banner" src="'+$("#dvBusinessImage").attr("data-original")+'" /></div></a>'),$("#divtemplate").append(_siteBuilderSocialMedia.SPblock),$("#btnsendEmail").attr("onclick","_siteBuilderSocialMedia.SendMail('BusinessDetail')"),_siteBuilderSocialMedia.msg="Business has been posted."))},_siteBuilderSocialMedia.LoadSocialMediaSendEmail=function(e,t,i,a){ShowLoader(!0),objReqSendEmailData={},objReqSendEmailData.UserControlPath="~/UserControls/ucSocialMediaSendEmail.ascx",objReqSendEmailData.PageNamePath="~/Home.aspx",objReqSendEmailData.isRemoveFormTag=!0,objReqSendEmailData.UserControlID="SocialControlStartTag";var r=new vagaro.ajax;r.datamodel.IsNewVagaroAPI=!0,r.datamodel.Token=ApiURLEnumCommon.loadusercontrol,r.datamodel.data=objReqSendEmailData,r.datamodel.callback=function(r){ShowLoader(!1),null!=r&&($("body").append(r),$("#divSpEmail").length>0&&_siteBuilderSocialMedia.MailClick(e,t,i,a))},r.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert({message:"An Error Has Occurred",title:"Oops!"})},r.Post()},_siteBuilderSocialMedia.SendMail=function(e,t){if(_siteBuilderSocialMedia.validate=$("#mailValidateSharing").valid(),1==_siteBuilderSocialMedia.validate){ShowLoader(!0);var i=$("#divtemplate"),a=$("#txtBody",$("#mailValidateSharing")).val(),r=$("#txtSenderName",$("#mailValidateSharing")).val(),o=$("#txtSenderEmail",$("#mailValidateSharing")).val(),n=$("#txtReceiverName",$("#mailValidateSharing")).val(),s=$("#txtReceiverEmail",$("#mailValidateSharing")).val(),l=$("#txtSubject",$("#mailValidateSharing")).val(),d=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,10}(?:\.[a-z]{2})?)$/i,c=!1;if(d.test(s)?$("#txtReceiverEmailerror").css("display","none"):($("#txtReceiverEmailerror").css("display","block"),$("#txtReceiverEmailerror").text("invalid email address"),ShowLoader(!1),c=!0),d.test(o)?$("#txtSenderEmailerror").css("display","none"):($("#txtSenderEmailerror").css("display","block"),$("#txtSenderEmailerror").text("invalid email address"),ShowLoader(!1),c=!0),1!=c){var u,p,h,m,f,g,v="",A="",C="",y=0,b=!0,S="",k="",D="",_=_siteBuilderSocialMedia.businessID;if("Stylist"==e)u=$("#imgServiceProvider",i).attr("src"),p=$("#spnProviderName",i).html(),h=$("#spnAddress",i).html(),m=$("#hdnUrl").val(),f="VagaroUser","none"===$("#btnsave",i).css("display")&&(b=!1);else if("Photos"==e){v=$("#divSpEmailBody").data();u=$("#imgServiceImage_"+v.styleid,i).attr("src"),C=$("#divSalonName_"+v.styleid,i).html(),h=$("#divAddress_"+v.styleid,i).html(),f="Portfolio Sharing",y=$("#hdnLikeCount_"+v.styleid,i).val(),null!=(S="true"==v.isonlineservice.toString().toLowerCase()&&"true"==v.isshowpriceonline.toString().toLowerCase()?v.price.toString():"")&&null!=S&&S.length>0&&(S=("Detail"==BasePage?_shopdetail.currencySymbol:currencysymbol)+S),g="true"==v.isonlineservice.toString().toLowerCase()?v.servicetitle+" "+S:"",A=t,m=IsVagaroDomain()?"/"+v.vagarourl:""}else if("Deals"==e){v=$("#divSpEmailBody").data();u=$("#imgPromotion",i).attr("src"),C=$("#lblSalonName",i).html(),f="Deals Sharing";var I=$("#hdnOldPriceEmail").val();null!=I&&null!=I&&I.length>0&&(k=I),D=$("#hdnPriceEmail").val(),A=$("#lblPromotionTitleHome",i).html(),h=$("#hdnAddress").val(),g=$("#lblmile").html(),m=(IsVagaroDomain()?"/"+$("#hdnScVagarourl").val():"")+"/deals/"+$("#hdnScTitletimestamp").val()}else"BusinessDetail"==e&&(C=businessName,u=$("#dvBusinessImage").attr("data-original"),f="Business Sharing",h="undefined"!=typeof businessAddress?_siteBuilderSocialMedia.htmlDecode(businessAddress):"",m=IsVagaroDomain()?"/"+("undefined"!=typeof vagaroUrl?vagaroUrl:""):"");$("#btnsendEmail","#divSpEmail").attr("disabled",!0);var w={};w.ReceiverName=n,w.SenderName=r,w.Mailto=s,w.Mailfrom=o,w.Subject=l,w.Body=a,w.Image=u,w.SpName=p,w.StyleTitle=A,w.SpAddress=h,w.BusinessUrl=m,w.BusinessName=C,w.MailHeader=f,w.service=g,w.callFrom=e,w.UserLikeCount=y,w.isShowBook=b,w.businessPrice="",w.promotionBeforePrice=k,w.promotionAfterPrice=D,w.UserPhoto="",w.UserCDNUrl="",w.UserName="",w.businessID=_,w.loginUserID=UserID,vagaro.ajaxCall(ApiURLEnumSocialMedia.sharesporstyle,w,_siteBuilderSocialMedia.vgSpEmail_Success,_siteBuilderSocialMedia.vgSpEmail_CallFailed,!1,!0)}}},_siteBuilderSocialMedia.vgSpEmail_Success=function(e){null!=e&&vagaro.alertsmall({message:"Your email sent successfully.",title:"Alert",callback:function(){$("#divSpEmail").modal("hide"),$("html, body").removeClass("hide-bgscrollappoint"),iosDevices&&$("html, body").scrollTop(scrollPos),$("#btnsendEmail","#divSpEmail").attr("disabled",!1)}}),ShowLoader(!1)},_siteBuilderSocialMedia.vgSpEmail_CallFailed=function(e){$("#divSpEmail").modal("hide"),$("html, body").removeClass("hide-bgscrollappoint"),iosDevices&&$("html, body").scrollTop(scrollPos),$("#btnsendEmail","#divSpEmail").attr("disabled",!1),ShowLoader(!1)},_siteBuilderSocialMedia.showHideSharingOptions=function(e){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){_siteBuilderSocialMedia.businessUrl=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+vagaroUrl:"");var t="Check out this business on Vagaro: "+htmlDecode(businessName);void 0!==e&&null!=e?(_siteBuilderSocialMedia.position=e.getBoundingClientRect(),CallbackforMobileApp(0,0,"","","0",'18|~|{\\"message\\": \\"'+t.replace(/"/g,'\\"')+'\\", \\"url\\": \\"'+_siteBuilderSocialMedia.businessUrl+'\\", \\"screenX\\": \\"'+_siteBuilderSocialMedia.position.left+'\\", \\"screenY\\": \\"'+_siteBuilderSocialMedia.position.top+'\\"}')):CallbackforMobileApp(0,0,"","","0",'18|~|{\\"message\\": \\"'+t.replace(/"/g,'\\"')+'\\", \\"url\\": \\"'+_siteBuilderSocialMedia.businessUrl+'\\"}')}else $(".mobile-share-model").is(":visible")?$("#mobile-check").is(":visible")?$(".mobile-share-model").fadeOut():$(".mobile-share-model").slideUp():$("#mobile-check").is(":visible")?$(".mobile-share-model").fadeIn():$(".mobile-share-model").slideDown();event.stopPropagation(),event.preventDefault()},_siteBuilderSocialMedia.showHidedealSharingOptions=function(e){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){var t=$("#hdnScTitletimestamp").val(),i=$("#hdnScVagarourl").val(),a=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+i:"")+"/deals/"+t,r="Check out this deal on Vagaro to for this business: "+htmlDecode(businessName)+"<br />"+promotionTitle;if(void 0!==e&&null!=e){var o=e.getBoundingClientRect();CallbackforMobileApp(0,0,"","","0",'18|~|{\\"message\\": \\"'+r.replace(/"/g,'\\"')+'\\", \\"url\\": \\"'+a+'\\", \\"screenX\\": \\"'+o.left+'\\", \\"screenY\\": \\"'+o.top+'\\"}')}else CallbackforMobileApp(0,0,"","","0",'18|~|{\\"message\\": \\"'+r.replace(/"/g,'\\"')+'\\", \\"url\\": \\"'+a+'\\"}')}else{var n=$("#dvDailyDealsDetail");$("#pageSection").is(":visible")&&(n=$("#pageSection")),$("#mobile-check").is(":visible")?$("#divSharingOptionsMobile",n).is(":visible")?$("#divSharingOptionsMobile",n).fadeOut():$("#divSharingOptionsMobile",n).fadeIn():$("#divSharingOptions",n).is(":visible")?$("#divSharingOptions",n).slideUp():$("#divSharingOptions",n).slideDown()}event.stopPropagation(),event.preventDefault()},_siteBuilderSocialMedia.fetchStylistName=function(e,t){if(_siteBuilderSocialMedia.curDivBlock=e,_siteBuilderSocialMedia.vagaroURL=escape(location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.VagaroURL.toLowerCase():"")+"/styles"),""==_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StylistName||null==_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StylistName||null==_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StylistName){var i={};i.StyleID=_siteBuilderSocialMedia.curDivBlock.data().styleid;var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumSocialMedia.getstyleimagecommaseparated,a.datamodel.data=i,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(e){_siteBuilderSocialMedia.fetchStylistName_Success(e,t)},a.datamodel.Error=_siteBuilderSocialMedia.fetchStylistName_CallFailed,a.Post()}else _siteBuilderSocialMedia.curDivBlock.hasClass("active")?(_siteBuilderSocialMedia.curDivBlock.find(".share-popup").hide(),_siteBuilderSocialMedia.curDivBlock.removeClass("active")):(_siteBuilderSocialMedia.curDivBlock.addClass("active"),$(".share-popup").hide(),_siteBuilderSocialMedia.curDivBlock.find(".share-popup").show()),_siteBuilderSocialMedia.curDivBlock.find(".facebook").unbind(),_siteBuilderSocialMedia.curDivBlock.find(".twitter").unbind(),_siteBuilderSocialMedia.curDivBlock.find(".pinterest").unbind(),_siteBuilderSocialMedia.curDivBlock.find(".email-share-div").unbind(),_siteBuilderSocialMedia.TwitterURL=_siteBuilderSocialMedia.vagaroURL+"&text=Check out what I found @"+unescape(escape(_siteBuilderSocialMedia.curDivBlock.data().businessname))+" - "+_siteBuilderSocialMedia.curDivBlock.data().stylistname+"&related=vagaro",_siteBuilderSocialMedia.curDivBlock.find(".twitter").click(function(){_siteBuilderSocialMedia.PostOnTwitter(_siteBuilderSocialMedia.TwitterURL)}),_siteBuilderSocialMedia.curDivBlock.find(".facebook").click(function(){_siteBuilderSocialMedia.PostonFacebook(t,"Photos")}),_siteBuilderSocialMedia.PinUrl=_siteBuilderSocialMedia.vagaroURL+"&text="+unescape(_siteBuilderSocialMedia.curDivBlock.data().businessname)+" - "+_siteBuilderSocialMedia.curDivBlock.data().styletitle+"&media="+_siteBuilderSocialMedia.curDivBlock.data().image+"&description="+_siteBuilderSocialMedia.curDivBlock.data().servicetitle+_siteBuilderSocialMedia.curDivBlock.data().styledesc,_siteBuilderSocialMedia.curDivBlock.find(".pinterest").click(function(){_siteBuilderSocialMedia.PostOnPint(_siteBuilderSocialMedia.PinUrl)}),_siteBuilderSocialMedia.curDivBlock.find(".email-share-div").click(function(){_siteBuilderSocialMedia.MailClick(_siteBuilderSocialMedia.curDivBlock.data().styletitle,_siteBuilderSocialMedia.curDivBlock,"Photos")})},_siteBuilderSocialMedia.fetchStylistName_Success=function(e,t){$("#divGalleryImageLoader").hide(),null!=e&&null!=e&&(_siteBuilderSocialMedia.curDivBlock.data().stylistname=e.split("|##|")[1],_siteBuilderSocialMedia.curDivBlock.hasClass("active")?(_siteBuilderSocialMedia.curDivBlock.find(".share-popup").hide(),_siteBuilderSocialMedia.curDivBlock.removeClass("active")):(_siteBuilderSocialMedia.curDivBlock.addClass("active"),$(".share-popup").hide(),_siteBuilderSocialMedia.curDivBlock.find(".share-popup").show(),_siteBuilderSocialMedia.curDivBlock.find(".facebook").unbind(),_siteBuilderSocialMedia.curDivBlock.find(".twitter").unbind(),_siteBuilderSocialMedia.curDivBlock.find(".pinterest").unbind(),_siteBuilderSocialMedia.curDivBlock.find(".email-share-div").unbind(),_siteBuilderSocialMedia.TwitterURL=_siteBuilderSocialMedia.vagaroURL+"&text=Check out what I found @"+unescape(escape(_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.BusinessName))+" - "+_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StylistName+"&related=vagaro",_siteBuilderSocialMedia.curDivBlock.find(".twitter").click(function(){_siteBuilderSocialMedia.PostOnTwitter(_siteBuilderSocialMedia.TwitterURL)}),_siteBuilderSocialMedia.curDivBlock.find(".facebook").click(function(){_siteBuilderSocialMedia.PostonFacebook(t,"Photos")}),_siteBuilderSocialMedia.PinUrl=_siteBuilderSocialMedia.vagaroURL+"&text="+unescape(_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.BusinessName)+" - "+_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StyleTitle+"&media="+_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.DefaultStyleImagePath+"&description="+_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.ServiceTitle+_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StyleDesc,_siteBuilderSocialMedia.curDivBlock.find(".pinterest").click(function(){_siteBuilderSocialMedia.PostOnPint(_siteBuilderSocialMedia.PinUrl)}),_siteBuilderSocialMedia.curDivBlock.find(".email-share-div").click(function(){_siteBuilderSocialMedia.MailClick(_siteBuilderSocialMedia.curDivBlock.data().tmplItem.data.StyleTitle,_siteBuilderSocialMedia.curDivBlock,"Photos")})))},_siteBuilderSocialMedia.fetchStylistName_CallFailed=function(e){$("#divGalleryImageLoader").hide()},_siteBuilderSocialMedia.ShowHideSocialIcons=function(e){$(e).parent().parent().parent().find(".share-popup").toggleClass("show"),_siteBuilderSocialMedia.curDivBlock=$(e).parent().parent().parent().closest(".gallery-solo-image"),_siteBuilderSocialMedia.fetchStylistName(_siteBuilderSocialMedia.curDivBlock,e)},_siteBuilderSocialMedia.OpenPin=function(){var e=$(".description").text(),t=screen.width/2-300,i=screen.height/2-140;void 0!==_shopdetail.vagaroUrl&&null!=_shopdetail.vagaroUrl&&""!=_shopdetail.vagaroUrl&&(_shopdetail.vagaroUrl=_shopdetail.vagaroUrl.toLowerCase());var a=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_shopdetail.vagaroUrl:"");"true"==_shopdetail.isCustomWebsite.toString().toLowerCase()&&(a+="/products");var r="http://www.pinterest.com/pin/create/button/?url="+a+"&text="+$("#lblBrandName").html()+" - "+$(".clsproductname").text()+"&media="+$("#hdndefaultimg").val()+"&description="+e,o=window.open(r,"Pintrest","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=600, height=280, top="+i+", left="+t);o&&!o.closed&&void 0!==o&&void 0!==o.closed||vagaro.alertsmall("Window cannot be opened as popup is blocked in your browser")},_siteBuilderSocialMedia.OpenTwitter=function(){void 0!==_shopdetail.vagaroUrl&&null!=_shopdetail.vagaroUrl&&""!=_shopdetail.vagaroUrl&&(_shopdetail.vagaroUrl=_shopdetail.vagaroUrl.toLowerCase());var e=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_shopdetail.vagaroUrl:"");"true"==_shopdetail.isCustomWebsite.toString().toLowerCase()&&(e+="/products");var t="https://twitter.com/intent/tweet?url="+e+"&text=Check out what I found @"+_shopdetail.businessName;$("#lblBrandName").html(),$(".clsproductname").text(),t=encodeURI(t);var i=screen.width/2-300,a=screen.height/2-160,r=window.open(t,"shareWindow","toolbar=no,location=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=600,height=320,left="+i+",top="+a);r&&!r.closed&&void 0!==r&&void 0!==r.closed||vagaro.alertsmall("Window cannot be opened as popup is blocked in your browser")},_siteBuilderSocialMedia.OpenPostonFacebook=function(){$("#dvFaceBookControl").length>0?_siteBuilderSocialMedia.LoadProductonFacebook():_siteBuilderSocialMedia.CheckFacebookControllRenders(_siteBuilderSocialMedia,"products")},_siteBuilderSocialMedia.LoadProductonFacebook=function(){$FacebookLoader(function(){var e=_shopdetail.businessName,t=$("#lblBrandName").html()+" - "+$(".clsproductname").text(),i=$(".description").text(),a=$("#hdndefaultimg").val();void 0!==_shopdetail.vagaroUrl&&null!=_shopdetail.vagaroUrl&&""!=_shopdetail.vagaroUrl&&(_shopdetail.vagaroUrl=_shopdetail.vagaroUrl.toLowerCase());var r=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+_shopdetail.vagaroUrl:"");"true"==_shopdetail.isCustomWebsite.toString().toLowerCase()&&(r+="/products"),$("#divShoppingcartpopup").modal("hide"),FBAPP.funcPostProduct(e,t,i,a,r,function(e){"connected"==FBAPI.status&&vagaro.alertsmall("Product details have been post.")})})},_siteBuilderSocialMedia.LoadInventoryonFacebook=function(){"undefined"!=typeof _siteBuilderDetail&&void 0!==_siteBuilderDetail.variantForCheckout&&null!=_siteBuilderDetail.variantForCheckout&&$FacebookLoader(function(){var e=_shopdetail.businessName,t=_siteBuilderDetail.customersProductDetailsCache.inventory.brand+" - "+_siteBuilderDetail.customersProductDetailsCache.inventory.productName,i=_siteBuilderDetail.customersProductDetailsCache.inventory.description,a=_siteBuilderDetail.customersProductDetailsCache.inventory.defaultImage;void 0!==_shopdetail.vagaroUrl&&null!=_shopdetail.vagaroUrl&&""!=_shopdetail.vagaroUrl&&(_shopdetail.vagaroUrl=_shopdetail.vagaroUrl.toLowerCase());var r=_siteBuilderDetail.customersProductDetailsCache.inventory.productURL;FBAPP.funcPostProduct(e,t,i,a,r,function(e){"connected"==FBAPI.status&&vagaro.alertsmall("Product details have been post.")})})},_siteBuilderSocialMedia.InventoryOpenPin=function(){var e=_siteBuilderDetail.customersProductDetailsCache.inventory.description,t=screen.width/2-300,i=screen.height/2-140,a="http://www.pinterest.com/pin/create/button/?url="+_siteBuilderDetail.customersProductDetailsCache.inventory.productURL+"&text="+_siteBuilderDetail.customersProductDetailsCache.inventory.brand+" - "+_siteBuilderDetail.customersProductDetailsCache.inventory.productName+"&media="+_siteBuilderDetail.customersProductDetailsCache.inventory.defaultImage+"&description="+e,r=window.open(a,"Pintrest","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=600, height=280, top="+i+", left="+t);r&&!r.closed&&void 0!==r&&void 0!==r.closed||vagaro.alertsmall("Window cannot be opened as popup is blocked in your browser")},_siteBuilderSocialMedia.InventoryOpenTwitter=function(){var e="https://twitter.com/intent/tweet?url="+_siteBuilderDetail.customersProductDetailsCache.inventory.productURL+"&text=Check out what I found @"+_shopdetail.businessName;$("#lblBrandName").html(),$(".clsproductname").text(),e=encodeURI(e);var t=screen.width/2-300,i=screen.height/2-160,a=window.open(e,"shareWindow","toolbar=no,location=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=600,height=320,left="+t+",top="+i);a&&!a.closed&&void 0!==a&&void 0!==a.closed||vagaro.alertsmall("Window cannot be opened as popup is blocked in your browser")},window.addEventListener("message",MyAccountlistener,!1),function(e,t){"use strict";if(void 0===e.$Interframe){var i=new Error("Interframe requires jQuery version 1.9.1 or higher, but lower than version 3."),a="undefined"==typeof jQuery?void 0:jQuery;if(void 0===a)throw i;var r=a.fn.jquery.split(" ")[0].split(".");r[0]<2&&r[1]<9||1==r[0]&&9==r[1]&&r[2]<1||r[0]>2&&3==r[0]&&2==r[1]&&r[2];var o=!0,n=!1,s=500,l=250,d=void 0,c=/Chrome/.test(navigator.userAgent),u=!1===c&&/Safari/.test(navigator.userAgent),p=/firefox/i.test(navigator.userAgent),h=0,m=!1,f=!1,g=e.parent!=e&&null!=t.referrer?e.parent:null,v="*",A=[],C=function(e,t){for(var i=A.length-1;i>=0;--i)if(A[i].window===e&&A[i].origin===t)return A[i];return null},y=!0,b=[],S=[],k=0,D=Number.MIN_VALUE,_=Number.MAX_VALUE,I=0,w=a(e).height(),P=a(e).width(),T=function(e){return"<"+e.localName+' id="'+e.id+'" class="'+e.className+'">'},B="object"!=typeof console||"function"!=typeof console.log?function(){}:function(t,i){"number"==typeof t&&h>=t&&console.log("["+e.location.href.replace(/#.*$/,"")+"]\n"+i)},x=function(e,t,i){if("object"==typeof e&&null!==e){var a=JSON.stringify("object"==typeof i?i:{});B(3,"Send "+a+" to "+t),e.postMessage(a,t)}},F=function(e,t){x(e.originalEvent.source,e.originalEvent.origin,t)},O=function(){"object"==typeof e.FB&&(void 0===d&&(d=null,setTimeout(function(){null===d&&(d=!1)},5e3)),(null===d||d)&&FB.Canvas.getPageInfo(function(t){null===d&&(d=!0,f=!0,g=null,B(0,"Facebook canvas detected"),setInterval(O,l)),x(e,e.location.origin,{object:"updateViewport2Window",top:t.scrollTop-t.offsetTop,height:t.clientHeight,width:t.clientWidth})}))},M=function(t,i){!1===f&&O();var r=a("#page-wrapper").length>0?a("#divLoginNew:visible").length>0?a("#divLoginNew")[0].scrollHeight:a("#dvRegister:visible").length>0?a("#dvRegister")[0].scrollHeight:a("#divClassDetailpopup:visible").length>0?a("#divClassDetailpopup")[0].scrollHeight:a("#divShoppingcartpopup:visible").length>0?a("#divShoppingcartpopup")[0].scrollHeight:a("#divGCHistoryPopup:visible").length>0?a("#divGCHistoryPopup")[0].scrollHeight:a("#ffguestmodel:visible").length>0?a("#ffguestmodel")[0].scrollHeight:a("#pnlAddFamilyFriendSharingModal:visible").length>0?a("#pnlAddFamilyFriendSharingModal")[0].scrollHeight:a("#divSPReviewPopup:visible").length>0?screen.height:a("#page-wrapper")[0].scrollHeight:c?a("html")[0].scrollHeight:p?a("body")[0].scrollHeight:u?a("html")[0].scrollHeight:a("body")[0].scrollHeight;if(void 0===t&&(t=r,Math.abs(k-t)<5||Math.abs(k-D)<5&&t+5<D||Math.abs(k-_)<5&&t-5>_))"function"==typeof i&&i(t,r);else if("isEmbedded"==i&&(t=r),!1!==f){var o=a.Event("changing.interframe",{height:t});if(a(e).trigger(o),o.isDefaultPrevented())"function"==typeof i&&i(t,r);else if(d)FB.Canvas.setSize({height:t}),B(1,"FB.Canvas.setSize({ height: "+t+" })"),"function"==typeof i&&i(t,r),setTimeout(function(){x(e,e.location.origin,{object:"updateSize",reqHeight:t,actHeight:t,orgHeight:r})},100);else if(b.push({height:t,callback:i}),0===S.length&&b.length>0){var n=b.shift();for(S.push(n.callback);b.length>0&&b[0].height===n.height;)S.push(b.shift().callback);a("#dvServiceContainer").length&&a("#dvServiceContainer").is(":visible")?x(g,v,{object:"requestSize",height:n.height,isOffsetChange:!1}):x(g,v,{object:"requestSize",height:n.height,isOffsetChange:!0})}}else"function"==typeof i&&i(t,r)};e.$Interframe={inspect:function(){return{mutationObserver:!(!e.MutationObserver&&!e.WebKitMutationObserver),pollingInterval:s,userAgent:navigator.userAgent,isChrome:c,isSafari:u,isFirefox:p,debug:h,isIniting:m,isRegistered:f,isFBParent:d,FBPollingInterval:l,myParent:g,parentOrigin:v,childFrames:A,autoSize:y,sizeRequestThreshold:5,sizeUpdateRequestQ:b,sizeUpdatingQ:S,curHeight:k,curMinHeight:D,curMaxHeight:_,viewport2Window:I,viewportTop:I+a(e).scrollTop(),viewportHeight:w,viewportWidth:P,setPollingInterval:function(e){return"number"==typeof e&&e>100&&(s=e),s},setFBPollingInterval:function(e){return"number"==typeof e&&e>100&&(l=e),l},setDebug:function(e){return"number"==typeof e&&(h=Math.min(Math.max(e,0),3)),h}}},getJQuery:function(){return a},init:function(i,r){if(m)B(2,"$Interframe.init() skipped.");else{B(2,"$Interframe.init() started."),m=!0,"boolean"==typeof i&&(y=i),"number"==typeof r&&(h=r);var l={"register?":function(e,t){void 0!==t&&void 0!==t.type&&"Embedded"==t.type?(a("body,html").removeClass("Embedded_Widget").addClass("Embedded_Widget"),void 0!==t.uid&&""!=t.uid&&a("body").attr("data-uid",t.uid)):void 0!==t&&void 0!==t.type&&"Popup_Widget"==t.type&&a("body,html").removeClass("Popup_Widget").addClass("Popup_Widget"),"*"!==v?B(0,'Received "register?".'):(B(0,'Received "register?". Send "register".'),F(e,{object:"register"}))},register:function(e,t){B(0,'Received "register". Send "registerACK".'),F(e,{object:"registerACK"})},registerACK:function(e,t){"*"!==v?B(0,'Received "registerACK".'):(B(0,'Received "registerACK". Send "registerDone".'),v=e.originalEvent.origin,F(e,{object:"registerDone"}))},registerDone:function(t,i){B(0,'Received "registerDone". Send "registerDoneACK".');var r=function(e,t){for(var i=a("iframe"),r=i.length-1;r>=0;--r)if(i[r].contentWindow===e){for(var o=A.length-1;o>=0;--o)A[o].window===e&&A.splice(o,1);return A.push({window:e,origin:t,frame:i[r]}),A[A.length-1]}return null}(t.originalEvent.source,t.originalEvent.origin);F(t,{object:"registerDoneACK"});var o=e.$Interframe.getViewport2Doc();(null===g||f)&&x(r.window,r.origin,{object:"updateViewport2Window",top:o.top-a(r.frame).offset().top,height:o.height,width:o.width})},registerDoneACK:function(t,i){B(0,'Received "registerDoneACK".'),f=!0,a(e).trigger(a.Event("registered.interframe"))},requestSize:function(t,i){if(a(".vagaro-iframe-100").length>0)for(var r=A.length-1;r>=0;--r){var s;if(A[r].window===t.originalEvent.source&&A[r].origin===t.originalEvent.origin)if(null!==(s=A[r])){var l="";if(void 0!==s.frame&&void 0!==s.frame.dataset&&void 0!==s.frame.dataset.uid&&(l=s.frame.dataset.uid),""!=l){var c=a(s.frame).height(),u=isNaN(i.height)?c:i.height,p=parseFloat(a(s.frame).css("max-height")),h=parseFloat(a(s.frame).css("min-height")),m=Math.max(Math.min(isNaN(p)?u:p,u),isNaN(h)?u:h);B(1,'Received "requestSize". orgH='+c+" reqH="+u+" actH="+m+" minH="+h+" maxH="+p);var f=m>=u?"no":"auto";a(".vagaro-container.vagaro-popup-widget").length>0&&(f="auto");try{a(s.frame).css("height",""),null!=a(s.frame).contents().find("#hdnBusinessID").val()&&"107141"==a(s.frame).contents().find("#hdnBusinessID").val()?(p<u&&(m=u),a(s.frame).attr("height",m).attr("scrolling",f).css("overflow",m>=u?"none":"auto").css("max-height",p<u?m:p)):a(s.frame).attr("height",m).attr("scrolling",f).css("overflow",m>=u?"none":"auto")}catch(e){a(s.frame).attr("height",m).attr("scrolling",f).css("overflow",m>=u?"none":"auto")}var v="100%";if(a("#"+l+" .vagaro-iframe-100").length>0?v=a("#"+l+" .vagaro-iframe-100").width():a("#"+l+" .vagaro-popup").length>0?v=a("#"+l+" .vagaro-popup").width():a("#"+l+" .vagaro-iframe").length>0&&(v=a("#"+l+" .vagaro-iframe").width()),a(s.frame).attr("width",v),n&&!o&&a("body,html").hasClass("Embedded_Widget")&&1==i.isOffsetChange&&c>u&&a(window).scrollTop()!=a("#"+l+" .vagaro-iframe iframe").offset().top&&a(window).scrollTop(a("#"+l+" .vagaro-iframe iframe").offset().top),o=!1,x(s.window,s.origin,{object:"updateSize",reqHeight:u,actHeight:m,orgHeight:c,minHeight:h,maxHeight:p,reqWidth:v,uid:l}),g||d)M(a(e).height()+m-c);else{var y=e.$Interframe.getViewport2Doc();a.each(A,function(){x(this.window,this.origin,{object:"updateViewport2Window",top:y.top-a(this.frame).offset().top,height:y.height,width:y.width})})}}}}else if(null!==(s=C(t.originalEvent.source,t.originalEvent.origin))){c=a(s.frame).height(),u=isNaN(i.height)?c:i.height,p=parseFloat(a(s.frame).css("max-height")),h=parseFloat(a(s.frame).css("min-height")),m=Math.max(Math.min(isNaN(p)?u:p,u),isNaN(h)?u:h);B(1,'Received "requestSize". orgH='+c+" reqH="+u+" actH="+m+" minH="+h+" maxH="+p);f=m>=u?"no":"auto";a(".vagaro-container.vagaro-popup-widget").length>0&&(f="auto");try{null!=a(s.frame).contents().find("#hdnBusinessID").val()&&"107141"==a(s.frame).contents().find("#hdnBusinessID").val()?(p<u&&(m=u),a(s.frame).attr("height",m).attr("scrolling",f).css("overflow",m>=u?"none":"auto").css("max-height",p<u?m:p)):a(s.frame).attr("height",m).attr("scrolling",f).css("overflow",m>=u?"none":"auto")}catch(e){a(s.frame).attr("height",m).attr("scrolling",f).css("overflow",m>=u?"none":"auto")}v="100%";if(a(".vagaro-popup").length>0?v=a(".vagaro-popup").width():a(".vagaro-iframe").length>0&&(v=a(".vagaro-iframe").width()),a(s.frame).attr("width",v),n&&!o&&a("body,html").hasClass("Embedded_Widget")&&1==i.isOffsetChange&&c>u&&a(window).scrollTop()!=a(".vagaro-iframe iframe").offset().top&&a(window).scrollTop(a(".vagaro-iframe iframe").offset().top),o=!1,x(s.window,s.origin,{object:"updateSize",reqHeight:u,actHeight:m,orgHeight:c,minHeight:h,maxHeight:p,reqWidth:v}),g||d)M(a(e).height()+m-c);else{y=e.$Interframe.getViewport2Doc();a.each(A,function(){x(this.window,this.origin,{object:"updateViewport2Window",top:y.top-a(this.frame).offset().top,height:y.height,width:y.width})})}}},updateSize:function(t,i){k=i.actHeight,void 0!==i.reqWidth&&void 0!==i.uid&&void 0!==a("body").attr("data-uid")&&""!=a("body").attr("data-uid")?a("body").attr("data-uid")===i.uid&&a("body").width(i.reqWidth):void 0!==i.reqWidth&&a("body").width(i.reqWidth),void 0!==i.minHeight&&(D=i.minHeight),void 0!==i.maxHeight&&(_=i.maxHeight),B(1,'Received "updateSize". curHeight='+k+" curMinHeight="+D+" curMaxHeight="+_),a.each(S,function(){"function"==typeof this&&this(i.reqHeight,i.actHeight,i.minHeight,i.maxHeight)}),S=[],a(e).trigger(a.Event("changed.interframe",{reqHeight:i.reqHeight,actHeight:i.actHeight,minHeight:i.minHeight,maxHeight:i.maxHeight})),setTimeout(M,s)},checkSize:function(e,t){B(1,'Received "checkSize".'),k=0,void 0!==t&&void 0!==typeof t.isEmbedded?M(0,"isEmbedded"):M()},openinNewWindow:function(e,t){var i;B(1,t.URL),i=t.URL,window.open("about:blank","newtab").location=i},updateViewport2Window:function(t,i){I=i.top,w=i.height,P=i.width,B(1,'Received "updateViewport2Window". viewport2Window='+I+" viewportHeight="+w+" viewportWidth="+P);var r=e.$Interframe.getViewport2Doc();a(e).trigger(a.Event("viewport.interframe",{top:r.top,height:r.height})),a.each(A,function(){x(this.window,this.origin,{object:"updateViewport2Window",top:r.top-a(this.frame).offset().top,height:r.height,width:r.width})})},updateViewportscroll:function(e,t){if(a("body").hasClass("Embedded_Widget")){var i=a(".vagaro-container").offset().top+t.height;a("html, body").animate({scrollTop:i},750,"swing",function(){})}},setStoratevalueintoParent:function(e,t){try{void 0!==t&&null!=t&&void 0!==t.storagedetail&&null!=t.storagedetail&&(""!=t.storagedetail.Value?localStorage.setItem(t.storagedetail.Key,t.storagedetail.Value):localStorage.removeItem(t.storagedetail.Key))}catch(e){B(0,"Error in setStoratevalueintoParent.")}},getStoratevaluefromParent:function(e,t){try{void 0!==t&&null!=t&&void 0!==t.storagedetail&&null!=t.storagedetail&&(t.storagedetail.Value=localStorage.getItem(t.storagedetail.Key),F(e,{object:"getStoratevalueatChild",storagedetail:t.storagedetail}))}catch(e){B(0,"Error in getStoratevaluefromParent.")}},getStoratevalueatChild:function(e,t){try{if(void 0!==t&&null!=t&&void 0!==t.storagedetail&&null!=t.storagedetail&&void 0!==t.storagedetail.callBackFunction){var i=window[t.storagedetail.callBackFunction];"function"==typeof i&&i(t.storagedetail)}}catch(e){B(0,"Error in getStoratevalueatChild.")}},redirectparent:function(e,t){try{void 0!==t&&null!=t&&void 0!==t.redirecturl&&null!=t.redirecturl&&(location.href=t.redirecturl)}catch(e){B(0,"Error in redirectparent.")}},redirectparentscrollTop:function(){try{a(window).scrollTop(0)}catch(e){B(0,"Error in redirectparentscrollTop.")}},setWidgetScroll:function(e,t){try{var i=0;void 0!==t&&null!=t&&void 0!==t.scrollValue&&null!=t.scrollValue&&(i=t.scrollValue,a("html,body").animate({scrollTop:i},400))}catch(e){B(0,"Error in setWidgetScroll.")}},scrollFunction:function(){try{document.getElementById("frameTitle").scrollIntoView({behaviour:"smooth"})}catch(e){B(0,"Error in scrollFunction.")}},adjustIframeHeight:function(){try{a("iframe").height();var e=a(window).height();a("iframe").css("height",.9*e|0)}catch(e){B(0,"Error in adjustIframeHeight.")}},resetIframeHeight:function(){try{a("iframe").not("#chatWindow").css("height","")}catch(e){B(0,"Error in resetIframeHeight.")}},setWidgetAddonpopupScroll:function(){try{var e=(null!=document.getElementById("frameTitle")?document.getElementById("frameTitle"):null!=document.getElementById("mainbody")?document.getElementById("mainbody"):0).offsetTop;a("html,body").animate({scrollTop:e},600)}catch(e){B(0,"Error in setWidgetAddonpopupScroll.")}}};a(e).on("message",function(t){try{B(3,'Received: "'+t.originalEvent.data+'"');var i=JSON.parse(t.originalEvent.data);if(i.hasOwnProperty("object")){if(i.object.indexOf("updateViewportscroll")>=0)return void l[i.object](t,i);if(i.object.indexOf("getStoratevalueatChild")>=0||i.object.indexOf("setStoratevalueintoParent")>=0||i.object.indexOf("getStoratevaluefromParent")>=0)return void l[i.object](t,i);if(i.object.indexOf("register")>=0||t.originalEvent.origin===v&&f||t.originalEvent.source===e)return void l[i.object](t,i);if(null!==C(t.originalEvent.source,t.originalEvent.origin))return void l[i.object](t,i)}B(1,'Ignored: "'+t.originalEvent.data+'" from '+t.originalEvent.origin)}catch(e){return void B(0,'Error processing "'+t.originalEvent.data,'": '+e.message)}}),e.parent!=e&&"string"==typeof t.referrer&&t.referrer.length>0&&(a("body,html").hasClass("Embedded_Widget")?x(e.parent,v,{object:"register",type:"Embedded"}):a("body,html").hasClass("Popup_Widget")?x(e.parent,v,{object:"register",type:"Popup_Widget"}):x(e.parent,v,{object:"register"})),a("iframe").each(function(){a("body").hasClass("Embedded_Widget")?x(this.contentWindow,"*",{object:"register?",type:"Embedded"}):a("body").hasClass("Popup_Widget")?x(this.contentWindow,"*",{object:"register?",type:"Popup_Widget"}):x(this.contentWindow,"*",{object:"register?"})}),a(e).on("resize",function(){null===g&&!0!==d&&(w=a(e).height(),P=a(e).width());var t=e.$Interframe.getViewport2Doc();a.each(A,function(){x(this.window,this.origin,{object:"updateViewport2Window",top:t.top-a(this.frame).offset().top,height:t.height,width:t.width})})}).on("scroll",function(){var t=e.$Interframe.getViewport2Doc();a.each(A,function(){x(this.window,this.origin,{object:"updateViewport2Window",top:t.top-a(this.frame).offset().top,height:t.height,width:t.width})})});var c=e.MutationObserver||e.WebKitMutationObserver;void 0===c?setInterval(function(){y&&M()},s):new c(function(e){y&&M()}).observe(t.body,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),B(2,"$Interframe.init() done."),a(e).trigger(a.Event("init.interframe")),a(".vagaro-iframe iframe").length>0&&(void 0!==a(".vagaro-iframe iframe").css("height")&&a(".vagaro-iframe iframe").css("height",""),void 0!==a(".vagaro-iframe iframe").css("width")&&a(".vagaro-iframe iframe").css("width",""))}},resetViewportheight:function(){w=a(e).height()},getViewport2Window:function(){var t=Math.max(I,0),i=Math.min(I+w,a(e).height()),r={top:I,height:w,width:P,visibleTop:t,visibleHeight:Math.max(i-t,0)};return B(2,"$Interframe.getViewport2Window() = "+JSON.stringify(r)),r},getViewport2Doc:function(){var t=e.$Interframe.getViewport2Window(),i={top:t.top+a(e).scrollTop(),height:t.height,width:t.width,visibleTop:t.visibleTop+a(e).scrollTop(),visibleHeight:t.visibleHeight};return B(2,"$Interframe.getViewport2Doc() = "+JSON.stringify(i)),i},getViewport2Element:function(i){if((i=a(i)).length>0){var r={};if(i[0]===a(t)[0]||i[0]===a("html")[0])r=e.$Interframe.getViewport2Doc();else if(i[0]===a(e)[0])r=e.$Interframe.getViewport2Window();else{var o=i.css("display"),n=i.css("visibility");"none"===o&&i.css("visibility","hidden").css("display","block");var s=e.$Interframe.getViewport2Doc(),l=Math.max(s.top-i.offset().top,0)+i.scrollTop(),d=Math.min(s.top-i.offset().top+s.height,i.height())+i.scrollTop();r={top:s.top-i.offset().top+i.scrollTop(),height:s.height,width:s.width,visibleTop:l,visibleHeight:Math.max(d-l,0)};i.css("display",o).css("visibility","visible"===n?"":n)}}else r=e.$Interframe.getViewport2Doc();return B(2,"$Interframe.getViewport2Element("+T(i[0])+") = "+JSON.stringify(r)),r},centerPopup:function(t,i){if((t=a(t)).length>0){var r=t.css("display"),o=t.css("visibility");switch("none"===r&&t.css("visibility","hidden").css("display","block"),i="number"==typeof i?i:t.outerHeight(),t.css("position")){case"fixed":var n=e.$Interframe.getViewport2Window(),s=n.visibleTop+Math.max((n.visibleHeight-i)/2,0);n.visibleHeight>0&&t.css("top",s+"px").css("bottom",a(e).height()-s-i+"px").css("margin-top","0px").css("margin-bottom","0px");break;case"absolute":for(var l=t.parent();"static"===l.css("position")&&l[0]!==a("html")[0];)l=l.parent();s=(d=e.$Interframe.getViewport2Element(l[0])).visibleTop+Math.max((d.visibleHeight-i)/2,0);d.visibleHeight>0&&t.css("top",s+"px").css("bottom",l.scrollHeight-s-i+"px").css("margin-top","0px").css("margin-bottom","0px");break;case"relative":l=t.parent(),s=(d=e.$Interframe.getViewport2Element(l[0])).visibleTop+Math.max((d.visibleHeight-i)/2,0);d.visibleHeight>0&&t.css("margin-top",s+"px").css("margin-bottom",l.scrollHeight-s-i+"px").css("top","0px").css("bottom","0px");break;case"static":var d;l=t.parent(),s=(d=e.$Interframe.getViewport2Element(l[0])).visibleTop+Math.max((d.visibleHeight-i)/2,0);d.visibleHeight>0&&t.css("margin-top",s+"px").css("margin-bottom",l.scrollHeight-s-i+"px")}t.css("display",r).css("visibility","visible"===o?"":o),B(2,"$Interframe.centerPopup("+T(t[0])+", "+i+")")}},autoSize:function(e){!1===(y=!!e)&&(b=[]),B(2,"$Interframe.autoSize("+e+")")},setSize:function(e){M(e),B(2,"$Interframe.setSize("+e+")")},checkSize:function(e){a.each(A,function(){x(this.window,this.origin,{object:"checkSize",isEmbedded:e})}),B(2,"$Interframe.checkSize()")},getDevice:function(e){n=e},setStoratevalueintoParent:function(e){x(window.parent,"*",{object:"setStoratevalueintoParent",storagedetail:e})},getStoratevaluefromParent:function(e){x(window.parent,"*",{object:"getStoratevaluefromParent",storagedetail:e})},redirectparent:function(e){x(window.parent,"*",{object:"redirectparent",redirecturl:e})},redirectparentscrollTop:function(){x(window.parent,"*",{object:"redirectparentscrollTop"})},scrollFunction:function(){x(window.parent,"*",{object:"scrollFunction"})},adjustIframeHeight:function(){x(window.parent,"*",{object:"adjustIframeHeight"})},resetIframeHeight:function(){x(window.parent,"*",{object:"resetIframeHeight"})},sendEventMessage:function(e){x(window.parent,"*",e)},setWidgetScroll:function(e){x(window.parent,"*",{object:"setWidgetScroll",scrollValue:e})},setWidgetAddonpopupScroll:function(){x(window.parent,"*",{object:"setWidgetAddonpopupScroll"})}},a(e).on("load",function(t){e.$Interframe.init()})}}(window,document),function(e,t,i){i(e).on("registered.interframe",function(e){i("#footer").css("visibility","hidden")}).on("changing.interframe",function(e){e.height<300?e.preventDefault():"function"==typeof Pagination&&(Pagination.frozen=!0)}).on("changed.interframe",function(e){"function"==typeof Pagination&&(Pagination.frozen=!1)}).on("viewport.interframe",function(e){})}(window,document,jQuery),$(document).ready(function(){try{if(!("undefined"!=typeof isWidget&&"true"===String(isWidget).toLowerCase()||location.href.indexOf("Users/BusinessWidget.aspx")>0||window.location.href.toLowerCase().indexOf("type=builder")>0||void 0!==getQueryStringData&&void 0!==getQueryStringData("Type")&&""!=getQueryStringData("Type")&&"Builder"==getQueryStringData("Type")||void 0!==objApplicationType&&"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp||void 0!==objApplicationType&&"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CustomerApp||"undefined"!=typeof IsBrandedApp&&void 0!==bappIsUndefine&&bappIsUndefine(IsBrandedApp)&&!0===IsBrandedApp)){var e=!1;try{new RegExp("(?<name>a)"),new RegExp("(?<id>\\d+)","gm"),new RegExp("(?<=a)b"),e=!0}catch(e){console.log("Named capture groups NOT supported.")}if(e){var t=document.createElement("script");t.src="https://cmp.osano.com/js1OYJVqiJ/4387eb79-890e-4da8-a04c-0e13ea701f15/osano.js",t.async=!0,document.head.appendChild(t),window.showCookiePreferences=function(){window.Osano&&window.Osano.cm?window.Osano.cm.showDrawer("osano-cm-dom-info-dialog-open"):console.log("Osano consent manager not loaded yet")},window.showPrivacyChoices=function(){window.Osano&&window.Osano.cm?window.Osano.cm.showDoNotSell():console.log("Osano consent manager not loaded yet")}}}location.href.indexOf("Users/BusinessWidget.aspx")>0&&$(".osano-cm-window").hide()}catch{}}),
/*!
	Zoom 1.7.21
	license: MIT
	http://www.jacklmoore.com/zoom
*/
function(e){var t={url:!1,callback:!1,target:!1,duration:120,on:"mouseover",touch:!0,onZoomIn:!1,onZoomOut:!1,magnify:1};e.zoom=function(t,i,a,r){var o,n,s,l,d,c,u,p=e(t),h=p.css("position"),m=e(i);return t.style.position=/(absolute|fixed)/.test(h)?h:"relative",t.style.overflow="hidden",a.style.width=a.style.height="",e(a).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:a.width*r,height:a.height*r,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(t),{init:function(){n=p.outerWidth(),o=p.outerHeight(),i===t?(l=n,s=o):(l=m.outerWidth(),s=m.outerHeight()),d=(a.width-n)/l,c=(a.height-o)/s,u=m.offset()},move:function(e){var t=e.pageX-u.left,i=e.pageY-u.top;i=Math.max(Math.min(i,s),0),t=Math.max(Math.min(t,l),0),a.style.left=t*-d+"px",a.style.top=i*-c+"px"}}},e.fn.zoom=function(i){return this.each(function(){var a=e.extend({},t,i||{}),r=a.target&&e(a.target)[0]||this,o=this,n=e(o),s=document.createElement("img"),l=e(s),d="mousemove.zoom",c=!1,u=!1;if(!a.url){var p=o.querySelector("img");if(p&&(a.url=p.getAttribute("data-src")||p.currentSrc||p.src),!a.url)return}n.one("zoom.destroy",function(e,t){n.off(".zoom"),r.style.position=e,r.style.overflow=t,s.onload=null,l.remove()}.bind(this,r.style.position,r.style.overflow)),s.onload=function(){var t=e.zoom(r,o,s,a.magnify);function i(i){t.init(),t.move(i),l.stop().fadeTo(e.support.opacity?a.duration:0,1,!!e.isFunction(a.onZoomIn)&&a.onZoomIn.call(s))}function p(){l.stop().fadeTo(a.duration,0,!!e.isFunction(a.onZoomOut)&&a.onZoomOut.call(s))}"grab"===a.on?n.on("mousedown.zoom",function(a){1===a.which&&(e(document).one("mouseup.zoom",function(){p(),e(document).off(d,t.move)}),i(a),e(document).on(d,t.move),a.preventDefault())}):"click"===a.on?n.on("click.zoom",function(a){return c?void 0:(c=!0,i(a),e(document).on(d,t.move),e(document).one("click.zoom",function(){p(),c=!1,e(document).off(d,t.move)}),!1)}):"toggle"===a.on?n.on("click.zoom",function(e){c?p():i(e),c=!c}):"mouseover"===a.on&&(t.init(),n.on("mouseenter.zoom",i).on("mouseleave.zoom",p).on(d,t.move)),a.touch&&n.on("touchstart.zoom",function(e){e.preventDefault(),u?(u=!1,p()):(u=!0,i(e.originalEvent.touches[0]||e.originalEvent.changedTouches[0]))}).on("touchmove.zoom",function(e){e.preventDefault(),t.move(e.originalEvent.touches[0]||e.originalEvent.changedTouches[0])}).on("touchend.zoom",function(e){e.preventDefault(),u&&(u=!1,p())}),e.isFunction(a.callback)&&a.callback.call(s)},s.setAttribute("role","presentation"),s.alt="",s.src=a.url})},e.fn.zoom.defaults=t}(window.jQuery),BasePage="Detail","undefined"==typeof _siteBuilderDetail&&(_siteBuilderDetail={}),"undefined"==typeof vgAppicationType&&(vgAppicationType=0),_siteBuilderDetail.VconnectInitialized=!1,_siteBuilderDetail.businessID=$("#hdnSiteBuilderBusinessID").val(),_siteBuilderDetail.encryptBusinessID=$("#hdnSiteBuilderEncryptBusinessID").val(),_siteBuilderDetail.staticEncryptBusinessID=$("#hdnSiteBuilderStaticEncryptBusinessID").val(),_siteBuilderDetail.staticEncryptUserID=$("#hdnSiteBuilderEncuserid").val(),_siteBuilderDetail.breadCrumbs=[],_siteBuilderDetail.breadCrumbsBack=[],_siteBuilderDetail.selectedBrands=[],_siteBuilderDetail.selectedOptions=[],_siteBuilderDetail.filterTabs=[],_siteBuilderDetail.selectedVariant=[],_siteBuilderDetail.customersProductDetailsCache=[],_siteBuilderDetail.variantForCheckout=null,_siteBuilderDetail.swiperSyncLarge=null,_siteBuilderDetail.sliderThumbnail=null,_siteBuilderDetail.swiperSyncMain=null,_siteBuilderDetail.isShareLink=!1,_siteBuilderDetail.URLReplaceExp=/[ &\/\\#,+()$~%.'"|:*?<>{}]/g,_siteBuilderDetail.productDetailImageIndex=-1,_siteBuilderDetail.DisplayOptionEnum={Chips:1,Dropdown:2,Image:5,ColorSwatch:4},_siteBuilderDetail.ProductShareOptionsEnum={Facebook:1,X:2,Pinterest:3,CopyLink:4},void 0!==_siteBuilderDetail.businessID&&null!=_siteBuilderDetail.businessID&&"0"!=_siteBuilderDetail.businessID&&0!=_siteBuilderDetail.businessID||(_siteBuilderDetail.businessID=$("#hdnSBDesignBusinessID").val()),_siteBuilderDetail.businessName=$("#busname").text(),_siteBuilderDetail.loginUserId=0,_siteBuilderDetail.isRequestFromVagaro="true",_siteBuilderDetail.isNewCustomTemplate=$("#hdnSiteBuilderIsNewCustomTemplate").val(),_siteBuilderDetail.RootUrl="",_siteBuilderDetail.UserLocationInfo="",_siteBuilderDetail.StaticAkamaiCDNPath="https://vagaro.azureedge.net/static-content",_siteBuilderDetail.SQLGroupID="",_siteBuilderDetail.ClickbusinessLogo=0,_siteBuilderDetail.ReviewSNode,_siteBuilderDetail.ReviewTemplateName="",_siteBuilderDetail.vdsconst="vdsid",_siteBuilderDetail.OnboardBookNowFooter="",_siteBuilderDetail.IsShowNewadd=!1,_siteBuilderDetail.OnBoardingLocationAddress="",_siteBuilderDetail.isAffirmEnable=!0,_siteBuilderDetail.isAPayGPayEnable=!1,_siteBuilderDetail.GPayAndroidSupportedVersion=530,_siteBuilderDetail.APayIOSSupportedVersion=429,_siteBuilderDetail.GPayAndroidBrandedAppSupportedVersion=62,_siteBuilderDetail.GPayAndroidBrandedAppAllowBusinessIds="5139020",_siteBuilderDetail.VeraAccountInfo=null;var GPayApayPaymentMethod=$("#hdnApayGPayPaymentMethods").val();if(GPayApayPaymentMethod)try{var gpayApayParsed=JSON.parse(GPayApayPaymentMethod);if("object"==typeof gpayApayParsed&&null!==gpayApayParsed){_siteBuilderDetail.GPayAndroidSupportedVersion=gpayApayParsed.supportedAndroidVersion||530,_siteBuilderDetail.APayIOSSupportedVersion=gpayApayParsed.supportedIOSVersion||429,_siteBuilderDetail.GPayAndroidBrandedAppSupportedVersion=gpayApayParsed.supportedAndroidBrandedAppVersion||62,_siteBuilderDetail.GPayAndroidBrandedAppAllowBusinessIds=gpayApayParsed.brandedAppAllowedBusinessIds||"5139020";var businessIds=(gpayApayParsed.BusinessId||"").split(",").map(function(e){return e.trim()});businessIds.length>0&&(businessIds.includes(_siteBuilderDetail.businessID)||businessIds.includes("-1"))&&(_siteBuilderDetail.isAPayGPayEnable=!0)}}catch(t){console.warn("Invalid JSON in #hdnApayGPayPaymentMethods, using defaults."),window.paymentDefaults={}}var CountryID=1,isGetLocation=!1,GoogleApiTimeInterval=1,IsFMBEnableForBusiness=!1;_siteBuilderDetail.AllDetailCommon="",_siteBuilderDetail.ComponentResponse={lstStaff:null,lstGiftCard:null,lstService:null,lstMembership:null,lstClass:null,lstBookNow:null,lstPackage:null,lstBusinessDetail:null,lstFacility:null,lstUserInfo:null,lstStyleAndBusinessImage:null,lstCommonConfigKey:null,lstWorkingHours:null,lstPromotions:null,lstAboutReviewPercent:null,lstReview:{Response:null,PageIndex:null,totalPages:null,FilterData:null,SortData:null},lstProduct:{resProdCaches:null,cacheSearchText:null,cacheBranID:null,cacheProductTypeID:null,pageIdxProduct:null},lstColors:null,lstWidgetSpInfo:null},_siteBuilderDetail.template_pageHeaderSection="#srpt-header-section",_siteBuilderDetail.template_navbarMenuSection="#srpt-navbarmenu-section",_siteBuilderDetail.displaynonecls="component-display-hide",_siteBuilderDetail.tabselection="component-tab-selection",_siteBuilderDetail.BusinessLocationImage="BusinessLocationImage/",_siteBuilderDetail.BusinessPathOriginalAkamai="Original/",_siteBuilderDetail.StaticAkamaiImageFolder="Images",_siteBuilderDetail.StylePathOriginalAkamai="Style/Original/",_siteBuilderDetail.DefaultShopImageForAll="no-shop-image-big.gif",_siteBuilderDetail.ImgPlaceholder32="img-placeholder32.png",_siteBuilderDetail.PublicImagesFolder="PublicImages",_siteBuilderDetail.AppleAppStore2x="apple-app-store2x.png",_siteBuilderDetail.GoogleAppStore2x="google-app-store2x.png",_siteBuilderDetail.VagaroLogoPoweredby2x="vagaro-logo-poweredby@2x.png",_siteBuilderDetail.VagaroSmallLogo="vagaro-small-logo-2x-new.png",_siteBuilderDetail.VagaroLogoSvg="vagaro-logo.svg",_siteBuilderDetail.DefaultShopImageForAllNew="no-shop-image-big-new.gif",_siteBuilderDetail.LoaderSmall="loadersmall.gif",_siteBuilderDetail.UserImage200x0PathAkamai="200x0/",_siteBuilderDetail.BusinessLogoPath900x150Akamai="BusinessLogo/900x150/",_siteBuilderDetail.Images2gif="/Images/3.gif",_siteBuilderDetail.ArrowDropdown2x="arrow-dropdown@2x.png",_siteBuilderDetail.BusinessPromotionLogoOrBannerPathAkamai="BusinessPromotion/LogoBannerOriginal/",_siteBuilderDetail.userAgent=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase(),_siteBuilderDetail.iosDevices=/iPad|iPhone|iPod|iTouch/.test(navigator.userAgent)&&!window.MSStream,_siteBuilderDetail.isAndroidMobile=null!=_siteBuilderDetail.userAgent.match(/Android/i)&&null!=_siteBuilderDetail.userAgent.match(/Mobile/i)&&null==_siteBuilderDetail.userAgent.match(/Windows/i)&&$("#mobile-check").is(":visible"),_siteBuilderDetail.isWindowsPhone=_siteBuilderDetail.userAgent.match(/windows phone/i)||!1,_siteBuilderDetail.iPadAndroid=_siteBuilderDetail.userAgent.match(/ipad/i)||_siteBuilderDetail.userAgent.match(/iphone/i)||_siteBuilderDetail.userAgent.match(/itouch/i)||_siteBuilderDetail.userAgent.match(/android/i)||!1,_siteBuilderDetail.isAndroid=!(!_siteBuilderDetail.userAgent.match(/Android/i)&&!_siteBuilderDetail.userAgent.toLowerCase().match(/kf/i)),_siteBuilderDetail.iMacSafari=_siteBuilderDetail.userAgent.match(/safari/i)&&_siteBuilderDetail.userAgent.match(/mac/i)||!1,_siteBuilderDetail.isWebKit=_siteBuilderDetail.userAgent.match(/webkit/i)||!1,_siteBuilderDetail.isEdge=_siteBuilderDetail.userAgent.match(/edge/i)||!1,_siteBuilderDetail.InPageWidget_Ios=self!==top&&_siteBuilderDetail.iosDevices,_siteBuilderDetail.isFromAppClip=null!=_siteBuilderDetail.userAgent.match(/appclip/i),_siteBuilderDetail.isFromAppleClip=null!=_siteBuilderDetail.userAgent.match(/appleclip/i),_siteBuilderDetail.fromCharCode=String.fromCharCode,_siteBuilderDetail.UnderMaintananceMessage="Business is Under Maintenance. This won't take long",_siteBuilderDetail.CommonErrorMessage="Some error occured. Please try again.",_siteBuilderDetail.isFirstTimeLoad=!0,_siteBuilderDetail.flagBackButton=!1,_siteBuilderDetail.UserName="",_siteBuilderDetail.UserEmail="",_siteBuilderDetail.IsCustomWebsite=!1,_siteBuilderDetail.FindObj=null,_siteBuilderDetail.IsReviewTabHide=!1,_siteBuilderDetail.VgCustomComponent="vg-custom-component",_siteBuilderDetail.IsVagaroConnectOpen=!1;var vgCustomComponentDisableDivID="divDisableComponent",vgCustomComponentDisableDivAdded="<div id="+vgCustomComponentDisableDivID+' style="position: absolute;left: 0px;right: 0px;bottom: 0px;top: 0px;z-index: 999;"></div>',ProximityCookieName="proximitystate_v3",tabSegment="",isCheckInApp=!1,_shopdetail={},_ReWritePage="",isBrandedAppForApproval=!1;_siteBuilderDetail.WidgetTypeEnum={Popup:0,Embedded:1,NewWindow:2},_siteBuilderDetail.UserType={Customer:1,ServiceProvider:2,ShopAdmin:4,ShopOwnerServiceProvider:5,VagaroAdmin:6,BusinessUser:0},_siteBuilderDetail.initialReviewpageData={PageIndex:0,totalPages:0,tabName:"about",onRowLoad:"false",Id:"#review-detail",TemplateId:"#srpt-reviewsdetail-filter-section",Response:"Reviews"},_siteBuilderDetail.initialProductpageData={PageIndex:0,totalPages:0,tabName:"product",onRowLoad:"false",Id:"#productinventory",TemplateId:"#srpt-productinventory",Response:"Inventory"},BusinessTabNameEnum={about:"about",staff:"staff",services:"services",gift_certificates:"gift-certificates",classes:"classes",memberships:"memberships",products:"products",book_now:"book-now",reviews:"reviews",shopping_bag:"shopping-bag",styles:"styles",deals:"deals",addreview:"addreview"};var MerchantAccount={NoMerchantAccount:1,CommonMerchantAccountCardDoesNotPresent:2,CommonMerchantAccountCardPresent:3,IndividualMerchantAccount:4};_siteBuilderDetail.PublicPagetitles='[{"Url":"/Home.aspx","PageName":"Home","City_StateTitle":"Book Your Next Salon, Spa, or Fitness Appointment | Vagaro"},{"Url":"/professionals","PageName":"Featured Professional","City_StateTitle":"[Business-Type] Professionals in [City], [State], [Country] | Vagaro"},{"Url":"/listings","PageName":"Business Listing","City_StateTitle":"Find and Book a [Business-Type] in [City], [State], [Country] | Vagaro"},{"Url":"/photos","PageName":"Photos","City_StateTitle":"Find [Portfolio-Type] Photos in [City], [State], [Country] | Vagaro"},{"Url":"/deals","PageName":"Featured Deal","City_StateTitle":"Great [Service-Category] Deals in [City], [State], [Country] | Vagaro"},{"Url":"/dailydealdetail","PageName":"Featured DealDetail","City_StateTitle":"[deal-title] at [business-name] | Vagaro"},{"Url":"/book","PageName":"Service Listing","City_StateTitle":"Find and Book a [Service-Name] in [City], [State], [Country] | Vagaro"},{"Url":"/book","PageName":"Service Listing","City_StateTitle":"Find and Book a [Service-Name] in [City], [State], [Country] | Vagaro"}]',_siteBuilderDetail.activeTabName="about",_siteBuilderDetail.currencySymbol=null,_siteBuilderDetail.TemplateName={Service:1,ServiceDetail:2},_siteBuilderDetail.UnderMaintanance={UnderMaintananceInProgress:"-9",UnderMaintananceComplete:"-10"},_siteBuilderDetail.componentInfo={1:"vg-custom-component[data-custom-component=pageheadersection]",2:"vg-custom-component[data-custom-component=pagemenusection]",3:"vg-custom-component[data-custom-component=pagecustomheadersection]",4:"vg-custom-component[data-custom-component=pageaboutusreviewsection]",5:"vg-custom-component[data-custom-component=pagedescriptionsection]",6:"vg-custom-component[data-custom-component=pagedailydealssection]",7:"vg-custom-component[data-custom-component=pagephotosection]",8:"vg-custom-component[data-custom-component=pagebusinessinfosection]",9:"vg-custom-component[data-custom-component=pagereviewsdetailsection]",10:"vg-custom-component[data-custom-component=writeareview]",11:"vg-custom-component[data-custom-component=pagemembership]",12:"vg-custom-component[data-custom-component=pagepackage]",13:"vg-custom-component[data-custom-component=classes]",14:"vg-custom-component[data-custom-component=pagebooknowsearch]",15:"vg-custom-component[data-custom-component=pageproducts]",16:"vg-custom-component[data-custom-component=pagemapsection]",17:"vg-custom-component[data-custom-component=pageworkinghourssection]"},_siteBuilderDetail.componentMainInfo={pageheadersection:1,pagemenusection:2,pagecustomheadersection:3,pageaboutusreviewsection:4,pagedescriptionsection:5,pagedailydealssection:6,pagephotosection:7,pagebusinessinfosection:8,pagereviewsdetailsection:9,writeareview:10,pagemembership:11,pagepackage:12,classes:13,pagebooknowsearch:14,pageproducts:15,pagemapsection:16,pageworkinghourssection:17},_siteBuilderDetail.HTMLTemplates={MembershipComponent:["SiteBuilder/CommonHTMLTemplates/MembershipComponent.html?v=5","dvMembershiphtmlTemplate","dvMembershiphtmlTemplate-stencil"],PackageComponent:["SiteBuilder/CommonHTMLTemplates/PackageComponent.html?v=6","dvPackagehtmlTemplate","dvPackagehtmlTemplate-stencil"],ProductComponent:["SiteBuilder/CommonHTMLTemplates/ProductVariantComponent.html?v=3","dvProducthtmlTemplate","dvProductTemplate-stencil"],StaffComponent:["SiteBuilder/CommonHTMLTemplates/StaffComponent.html?v=4","srpt-staffdetail","dvStaffTemplate-stencil"],ServiceComponent:["SiteBuilder/CommonHTMLTemplates/ServiceComponent.html?v=10","dvParentTemplate","dvServicehtmlTemplate-stencil"],GiftCardComponent:["SiteBuilder/CommonHTMLTemplates/GiftCardComponent.html?v=7","dvGiftCardTemplate","dvGiftCardhtmlTemplate-stencil"],AboutPageDescriptionsectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageDescriptionsectionComponent.html?v=5","srpt-description-section","srpt-description-section-stencil"],AboutWriteReviewComponent:["SiteBuilder/CommonHTMLTemplates/AboutWriteReviewComponent.html?v=14","divWriteReview"],AboutPageDailyDealsSectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageDailyDealsSectionComponent.html?v=3","srpt-dailydeals-template-section","srpt-dailydeals-section-stencil"],AboutPagePhotoSectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPagePhotoSectionComponent.html?v=5","srpt-photo-section","srpt-photo-section-stencil"],AboutPageStylesComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageStylesComponent.html?v=7","srpt-style-section","srpt-style-htmlsection-stencil"],AboutPageMapSectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageMapSectionComponent.html?v=6","srpt-map-section","srpt-map-section-stencil"],AboutPageWorkingHoursSectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageWorkingHoursSectionComponent.html?v=3","srpt-workinghours-section","srpt-workinghours-section-stencil"],AboutPageBusinessInfoSectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageBusinessInfoSectionComponent.html?v=4","srpt-businessinfo-section","srpt-businessinfo-section-stencil"],AboutPageReviewsDetailSectionComponent:["SiteBuilder/CommonHTMLTemplates/AboutPageReviewsDetailSectionComponent.html?v=6","srpt-reviewsdetail-section","srpt-reviewsdetail-section-stencil"],AboutPageAboutusReviewSection:["SiteBuilder/CommonHTMLTemplates/AboutPageAboutusReviewSection.html?v=4","srpt-aboutusereview-section","srpt-aboutusereview-section-stencil"],FooterComponent:["SiteBuilder/CommonHTMLTemplates/FooterComponent.html?v=2","srpt-footercomponent-section"],PageMenuComponent:["SiteBuilder/CommonHTMLTemplates/PageMenuComponent.html?v=7.30","srpt-navbarmenucom-section"]},_siteBuilderDetail.swalconfirmButtonText={linknotavailbleMessage:"This URL No Longer Exists"},_siteBuilderDetail.swalTextMessage={linknotavailbleMessage:"You have reached a link that no longer exists because this business has modified its settings."},_siteBuilderDetail.MessageType={Info:1,Success:2,Warning:3,Fail:4},_siteBuilderDetail.InPageWidget_Ios?ScrollTarget=$("body"):ScrollTarget=$(window);var ApiURLEnumCommonApi={getcomponentdetailsbypageid:(ApiPath="websiteapi/homepage/")+"getcomponentdetailsbypageid",getshopdetailcomposite:ApiPath+"getshopdetailcomposite",getshoppingcartcomposite:ApiPath+"getshoppingcartcomposite",addtocart:ApiPath+"addtocart",sendemailtosp:ApiPath+"sendemailtosp",getlocationsearchbyplaceid:ApiPath+"getlocationsearchbyplaceid",getinventorybundledetailsbyinventoryid:ApiPath+"getinventorybundledetailsbyinventoryid",getwidgetuserdetails:ApiPath+"getwidgetuserdetails"},V2APIURLEnum={GetCustomersProductCategories:"GetCustomersProductCategories",GetCustomersProductDetail:"GetCustomersProductDetail"};function botCheck(){try{var e=new RegExp("(googlebot/|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)","i"),t=navigator.userAgent;return!!e.test(t)}catch(e){return!1}}function GetLatLong(){try{if(null!=(CountryID=localStorage.getItem("SalesCountryId"))&&null!=CountryID&&CountryID>0)SetCountry(CountryID);else if(botCheck()||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)SetCountry(1);else{var e=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName);null!=e&&null!=e&&!isNaN(parseInt(e.countryid))&&parseInt(e.countryid)>0?SetCountry(parseInt(e.countryid)):SetCountry(1)}}catch(e){}}function GetCountry(e,t){try{if(clearInterval(GoogleApiTimeInterval),null!=(CountryID=localStorage.getItem("SalesCountryId"))&&null!=CountryID&&CountryID>0)SetCountry(CountryID);else if(botCheck()||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)SetCountry(1);else{var i=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName);null!=i&&null!=i&&!isNaN(parseInt(i.countryid))&&parseInt(i.countryid)>0?SetCountry(parseInt(i.countryid)):SetCountry(1)}}catch(e){}}function GetLocalStorage(e,t){try{var i=localStorage.getItem("SalesCountryId");if(null!=i)return void SetCountry(i);var a=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName);null!=a&&null!=a&&!isNaN(parseInt(a.countryid))&&parseInt(a.countryid)>0?SetCountry(parseInt(a.countryid)):SetCountry(1)}catch(e){}}function SetCountry(e){try{new Date;null!=e&&($('a[href*="https://www.vagaro.com/pro"],a[href*="https://www.vagaro.com/en-"]').each(function(t){if(!(t=this.href.trim().toLowerCase()).includes("/professionals")){var i=t.replace(/\/en-(gb|ca|au)\//,"/");this.href=2==e?i.replace("/pro","/en-gb/pro"):3==e?i.replace("/pro","/en-ca/pro"):4==e?i.replace("/pro","/en-au/pro"):i}}),updateResourcesLink("footer-blog","/learn",e),updateResourcesLink("footer-newsroom","/news",e))}catch(e){}}function InitializeTimer(){try{var e=localStorage.getItem("SalesCountryId");if(null!=e)return SetCountry(e),void clearInterval(GoogleApiTimeInterval);isGetLocation?(SetCountry(e),clearInterval(GoogleApiTimeInterval)):GetLatLong()}catch(e){clearInterval(GoogleApiTimeInterval)}}function GetRootUrl(e){return""!=_siteBuilderDetail.RootUrl&&null!=_siteBuilderDetail.RootUrl||GetRootUrlFormat(),_siteBuilderDetail.RootUrl.replace("##segment##",e)}function GetRootUrlFormat(){var e=_siteBuilderDetail.UserLocationInfo;if(""!=e.State&&null!=e.State||""!=e.City&&null!=e.City||""!=e.Country&&null!=e.Country){var t="",i="",a="";"true"==isPromotionUI&&""!=PromotionURL&&(a+="/"+PromotionURL),2==e.CountryID?i="gb":3==e.CountryID?i="ca":4==e.CountryID&&(i="au"),""!=e.City&&null!=e.City&&(t=spacetodash(e.City.toLowerCase())+"--"),""!=e.State&&null!=e.State&&(2==e.CountryID?t+=e.StateName.toLowerCase().replace(" ","-").trim():t+=spacetodash(e.State.toLowerCase())),""!=i&&null!=i&&(t+="--"+spacetodash(i)),a+="/"+t}_siteBuilderDetail.RootUrl=e.RootUrl+"##segment##"+a}function CloseSocialPoup(){$(".mobile-share-social-model").fadeOut(),$("body").removeClass("removescroll-bg")}function lazyLoadWithContainer(e,t){$("."+e).length>0&&$("."+e,$("#"+t)).lazyload({effect:"fadeIn",container:$("#"+t)})}function bappIsUndefine(e){return void 0===e||null==e||""===e||null==e}function baIsUndefine(e){return void 0===e||null==e||""===e||null==e}function DisplayFullView(e){e?(_siteBuilderDetail.IsCustomWebsite?$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]).hide():$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).hide(),IsNewCustomWebsite?$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).show():$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).hide()):isCallFromCheckInApp||(("false"==isWidget.toLowerCase()||"true"==isWidget.toLowerCase()&&(IsFromMultiLocation&&b_themeID>0||w_type==_siteBuilderDetail.WidgetTypeEnum.NewWindow))&&(_siteBuilderDetail.IsCustomWebsite?$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]).show():$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).show()),IsNewCustomWebsite,$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).show()),$("#mobile-check").is(":visible")&&($(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).hide(),"true"==isCustomWebsite.toLowerCase()?$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]).hide():"true"==isWidget.toLowerCase()&&w_type!=_siteBuilderDetail.WidgetTypeEnum.Embedded||"false"==isWidget.toLowerCase()&&("book-now"==tabSegment&&($("#divClassAppResult").is(":visible")||$("#divSearch").is(":visible"))||"classes"==tabSegment&&null!=history.state&&"classes"===history.state.subTab)?$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).show():$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).hide(),shopdetailFixedNavHTML())}_siteBuilderDetail.isCallFromPublicSide=function(){return void 0!==_siteBuilderDetail.isRequestFromVagaro&&"false"!=_siteBuilderDetail.isRequestFromVagaro},_siteBuilderDetail.SetThemeforWizard=function(){var e=getCookie("ThemePreferance");"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()?$("html").addClass("wf-proximanova-n9-active").attr("data-theme","widget"):1==e?$("html").addClass("wf-proximanova-n9-active").attr("data-theme","dark"):2==e?$("html").addClass("wf-proximanova-n9-active").attr("data-theme",""):$("html").addClass("wf-proximanova-n9-active").attr("data-theme","light")},_siteBuilderDetail.PageLoadComponent=function(){if(pageBodyHtml=$(".pagebodycontainer").html().trim(),_siteBuilderDetail.isFirstTimeLoad=!0,_siteBuilderDetail.SetUserLocationData(),_siteBuilderDetail.SetDefaultVariable(),_siteBuilderDetail.SetThemeforWizard(),_siteBuilderDetail.SetFMBMerchantToken(),$("body").addClass("businessdetailpage"),"undefined"!=typeof isFromInstagram&&0!=isFromInstagram&&"undefined"!=typeof isFacebookoAuth&&"true"==isFacebookoAuth&&"undefined"!=typeof isWidget&&"true"!=isWidget){var e=window.location.href.split("/"),t=e[0]+"//"+e[2];$url=$("<a/>"),$url.attr("href",t+"/"+vagaroUrl),$url[0].click()}if("undefined"!=typeof IsBookFromFacebookoAuth&&0!=IsBookFromFacebookoAuth&&"undefined"!=typeof isFacebookoAuth&&"true"==IsBookFromFacebookoAuth&&"true"==isFacebookoAuth&&"undefined"!=typeof isWidget&&"true"!=isWidget&&null!=window.location.href&&""!=window.location.href){var i=window.location.href.replace(/^\//,"").split("/");if(void 0!==i&&i.length>=6)try{_shopdetail.serviceID=i[5].replace("?partner=fb","").replace("&ig_fbb=true",""),null!=_shopdetail.serviceID&&""!=_shopdetail.serviceID&&_shopdetail.serviceID.indexOf("&fbclid")>=0&&(_shopdetail.serviceID=_shopdetail.serviceID.substring(0,_shopdetail.serviceID.lastIndexOf("&")))}catch(e){}}cookieManager.init(DefaultCookieDomainKey,"public"),_siteBuilderDetail.SetScriptFuncInCaseofWidget(),_siteBuilderDetail.SetSecureRequestForNewTabWidget(),_siteBuilderDetail.RegisterNlevelMenu(),_siteBuilderDetail.ChecktabSegment(tabSegment),_siteBuilderDetail.SetHeaderFooterHtml(),IsServiceTab=!1,IsClassTab=!1,_common.backtoTopHide(),void 0!==_shopdetail&&"function"==typeof _shopdetail.setCustomWebBanner&&_shopdetail.setCustomWebBanner(),_siteBuilderDetail.ShowHideMobileBack(),(IsNewCustomWebsite&&$("#mobile-check").is(":visible")||("classes"===tabSegment||"book-now"===tabSegment)&&$("#mobile-check").is(":visible"))&&"detail"==BasePage.toLowerCase()&&($("#mobile-check").is(":visible")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&$("#mobileBack").data("backtabname",_shopdetail.activeTabName),_shopdetail.setSelected(null,tabSegment),bappIsUndefine(IsBrandedApp)||1!=IsBrandedApp||$("#custmobileBack").attr("onclick","javascript:brandedAppbackButtonClick();"),""!=pageBodyHtml||"false"==_siteBuilderDetail.isRequestFromVagaro?($(".dynamicpages").hide(),_siteBuilderDetail.BindShopDetail_Success(_siteBuilderDetail.AllDetailCommon)):null!=_siteBuilderDetail.UserLocationInfo&&"deals"==_siteBuilderDetail.UserLocationInfo.TabSegment?_siteBuilderDetail.LoadComponentDetails_deals():"addreview"==tabSegment?_siteBuilderDetail.PageLoadOpenReviewPopup():"undefined"!=typeof IsNewCustomWebsite&&1==IsNewCustomWebsite&&_siteBuilderDetail.BindShopDetail_Success(_siteBuilderDetail.AllDetailCommon),_siteBuilderDetail.redirecturlonboard(),_siteBuilderDetail.setTitlePage(tabSegment),_siteBuilderDetail.IsCustomWebsite||_siteBuilderDetail.LoadHeaderMenuLink(),_siteBuilderDetail.showLogin();_siteBuilderDetail.SetProximityVariables(_siteBuilderDetail.tabSegment);if(PageBindAdvSearch(),"undefined"!=typeof vgAppicationType&&0==vgAppicationType&&_siteBuilderDetail.findCurrentLocation(null,null,null,null,"loaddatabypage"),_siteBuilderDetail.ShowHideAboutBookNow(tabSegment),"true"===_siteBuilderDetail.isRequestFromVagaro){if($("body").removeClass("sitedrag-area"),IsSecurityApplied&&(setkeepAlive(),setInterval(setkeepAlive,3e4)),TrackFacebookPageView(),IsDoingUpload(),void 0!==_shopdetail.isWidget&&"true"==_shopdetail.isWidget&&2!=IsCookieEnabled()&&0==_common.IsCookieLessWidget())try{$("#newtabredirect").attr("href",location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/Users/BusinessWidget.aspx?BusinessID="+_shopdetail.businessID+"&IsBusinessWidgetPage="+_shopdetail.isWidget+"&IsFacebookPage="+_shopdetail.isFacebook+"&TabsIncluded="+_shopdetail.TabsIncluded+"&IsPopup="+_shopdetail.IsPopup+"&IsFromMultiLocation="+_shopdetail.isFromMultiLocation+"&b_themeID="+_shopdetail.b_themeID+"&MultiLocBusinessID="+_shopdetail.MultiLocBusinessID+"&w_type=2&widgetversion="+WidgetVersion+"&tabatlaunch="+_shopdetail.TabAtLaunch+"&widgetspid="+_shopdetail.WidgetSpId),$("#newtabredirect").text(_siteBuilderDetail.WidgetButtonCustomText(_shopdetail.TabAtLaunch)),$("#newtabredirect").css("margin","10px auto"),$("#newtabredirect").show(),$("#divFooterPresent").css("visibility","hidden"),$("#divFooterPresent").hide()}catch(e){console.log(e)}!function(e){var t=e.getElementsByTagName("SCRIPT")[0],i=e.createElement("SCRIPT");i.type="text/javascript",i.async=!0,i.src="https://assets.pinterest.com/js/pinit.js",t.parentNode.insertBefore(i,t)}(document)}if("true"!=isFacebook&&"true"==isWidget&&w_type==_siteBuilderDetail.WidgetTypeEnum.Embedded&&$("body").addClass("Embedded_WidgetServer"),void 0!==_shopdetail.isWidget&&void 0!==_shopdetail.IsPopup&&"true"==_shopdetail.isWidget&&"true"==_shopdetail.IsPopup&&$("body,html").removeClass("Popup_Widget").addClass("Popup_Widget"),"undefined"!=typeof vgAppicationType&&void 0!==objApplicationType&&vgAppicationType==objApplicationType.CustomerApp){$("body").addClass("vagaroapp-webpage");var a='{\\"BusinessID\\":\\"'+businessID+'\\"}';void 0!==_siteBuilderDetail.userAgent&&null!=_siteBuilderDetail.userAgent&&""!=_siteBuilderDetail.userAgent&&_siteBuilderDetail.userAgent.indexOf("com.vagaro.customerios")>-1&&("undefined"!=typeof isAppClipFirstTime&&null!=isAppClipFirstTime&&""!=isAppClipFirstTime&&1==isAppClipFirstTime?CallbackforMobileApp(0,0,"","","0","43|~|"+a):CallbackforMobileApp(0,0,"","","0","44|~|"+a)),CallbackforMobileApp(0,0,"","","0","53|~|"+a)}if(_siteBuilderDetail.BindMyAccountTabEvents(),_common.isCreateLinkPreserve(!0,!0)&&("memberships"==tabSegment||"about"==tabSegment)){var r=getCookie("EventType");if(""!=MembershipID&&null!=MembershipID&&"memberships"==tabSegment)setTimeout(function(){var e=0;if(1==$("#memberships").is(":visible"))$("#dvMembershipContainer").each(function(){var t=$(this).find(".div-block-18");if(t.length>0){for(var i=0;t.length>i;i++)t[i].dataset.id==MembershipID&&($(t[i]).find("a").click(),e++);if(e>0)return;0==e&&_onlineCheckout.MembershipAddToCart(),MembershipID="",clearCookie("MembershipId")}});else{var t={};t.confirmButtonText=_siteBuilderDetail.swalconfirmButtonText.linknotavailbleMessage,t.swalTextMessage=_siteBuilderDetail.swalTextMessage.linknotavailbleMessage,_siteBuilderDetail.Openswalpopup(t),setTimeout(function(){$(".gencutom-title").html(_siteBuilderDetail.swalconfirmButtonText.linknotavailbleMessage)},100)}},2e3);else if("about"==tabSegment)if("3"==r||"7"==r||"2"==r){var o={};o.confirmButtonText=_siteBuilderDetail.swalconfirmButtonText.linknotavailbleMessage,o.swalTextMessage=_siteBuilderDetail.swalTextMessage.linknotavailbleMessage,_common.Openswalpopup(o),setTimeout(function(){$(".gencutom-title").html(_siteBuilderDetail.swalconfirmButtonText.linknotavailbleMessage)},100),_common.isCreateclearCookie()}else{document.referrer.indexOf("partner=fb")>=0||window.location.href.indexOf("partner=fb")>=0?setTimeout(function(){if(1!=$("#memberships").is(":visible")){var e={};e.confirmButtonText=_siteBuilderDetail.swalconfirmButtonText.linknotavailbleMessage,e.swalTextMessage=_siteBuilderDetail.swalTextMessage.linknotavailbleMessage,_common.Openswalpopup(e),setTimeout(function(){$(".gencutom-title").html(_siteBuilderDetail.swalconfirmButtonText.linknotavailbleMessage)},100)}},2e3):_common.isCreateclearCookie()}}if(1==_common.IsCookieLessWidget()&&(""==UserID||"0"==UserID))var n=window.setInterval(function(){if($("body,html").hasClass("Embedded_Widget")||$("body,html").hasClass("websitebuilder-loaded")){window.clearInterval(n);var e={};e.Key=_siteBuilderDetail.vdsconst,e.callBackFunction="GetStoragevalueforInlineWidget","undefined"!=typeof $Interframe&&void 0!==$Interframe.getStoratevaluefromParent&&$Interframe.getStoratevaluefromParent(e)}},200);_siteBuilderDetail.SetVConnectJsonLoadData(),"function"==typeof IsExistsAlxCookie&&IsExistsAlxCookie()&&LoginAlexaUser()},_siteBuilderDetail.redirecturlonboard=function(){var e=getQueryStringData("Type");if("OnBoarding"==e){if(null!=(t=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase())&&/com.vagaro.iospro/i.test(t)||/com.vagaro.androidpro/i.test(t))_siteBuilderDetail.ResumeWizardImgCallBack(),_siteBuilderDetail.findLocationCallBack(),(i=document.createElement("script")).type="text/javascript",i.onload=setMobileData=e=>{var t={};if((t=JSON.parse(e)).hasOwnProperty("callbackIndex")&&"98"==t.callbackIndex){var i="string"==typeof t?t.locationObject:JSON.parse(t.locationObject);if(null!=i&&void 0!==i.latitude&&void 0!==i.longitude&&0!=i.countryId){var a={coords:{latitude:i.latitude,longitude:i.longitude}};$("#dvtimezone").is(":visible")&&ShowLoader(!0),$("#txtLiveStreamLocationSearch").is(":visible")?setCurrentLocationFromDatabase(a,$("#txtLiveStreamLocationSearch"),_siteBuilderDetail.gblsource,_siteBuilderDetail.gblevent,_siteBuilderDetail.gblevent.choice,"onlocationchange",tabSegment):setCurrentLocationFromDatabase(a,null,null,null,null,"loaddatabypage",tabSegment)}else 0==("undefined"!=typeof isFirstTimeCall&&null!=isFirstTimeCall&&"true"==isFirstTimeCall.toString().toLowerCase())&&_siteBuilderDetail.latLongFailed(null,null,null,"applocationchange",tabSegment)}if(t.hasOwnProperty("backToWeb")&&"9"==t.backToWeb){var r=getQueryStringData("Type");getQueryStringData("IsFromNotification");null!==document.getElementById("divTransferRequestModalDialog")&&"undefined"!==document.getElementById("divTransferRequestModalDialog")&&1==$("#divTransferRequestModalDialog").is(":visible")?_vgVagaroImport.HideTransferRequestPopUp(!1):"OnBoarding"==r&&window.history.back()}},i.addEventListener("load",()=>{console.log("script loaded")}),i.addEventListener("error",e=>{console.log("Error on loading script",e)}),document.body.appendChild(i);$("#Onboard-BookNow-Header").show(),_siteBuilderDetail.OnboardBookNowFooter=$("#Onboard-BookNow-Footer"),$("#Onboard-BookNow-next").hide(),$("#pushdiv").hide(),$("body").addClass("signup-onboarding-booking default-scrollbar"),(navigator.userAgent.match(/androidpro/i)||navigator.userAgent.match(/iPad com.vagaro.iospro/i)||navigator.userAgent.match(/iospro/i)||!1)&&$("html body").addClass("pro-body-section"),$("#Onboard-BookNow-back").on("click",function(e){window.history.back();var t=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();if(null!=t&&/com.vagaro.iospro/i.test(t)||/com.vagaro.androidpro/i.test(t)){var i=getQueryStringData("Type"),a=getQueryStringData("IsFromNotification");"OnBoarding"==i&&"1"==a&&(message='{"navType": 0,"screenType": 0,"screenTitle" : "","message": "","messageType": 0,"action" : "141|~|"}',window.JSInterface.CallWSMethod(message))}}),$("#Onboard-BookNow-next").on("click",function(e){var t={};t.BusinessID=parseFloat(getCookie("BusinessIDForBooking")),t.UserID=UserID,t.Step=47,t.PageURL=window.location.href,t.UserAgent=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"","undefined"!=typeof amplitude?t.AmplitudeDeviceId=amplitude.getInstance().getDeviceId():t.AmplitudeDeviceId="";var i={};i.AddLogInAmplitude=t,_siteBuilderDetail.AjaxOld("AddLogInAmplitudeV2",i,_siteBuilderDetail.AddLogInAmplitudeSuccess,_siteBuilderDetail.AddLogInAmplitudeSuccessFail)})}if("ImportOnBoarding"==e){var t,i;if(null!=(t=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase())&&/com.vagaro.iospro/i.test(t)||/com.vagaro.androidpro/i.test(t))_siteBuilderDetail.ResumeWizardImgCallBack(),_siteBuilderDetail.findLocationCallBack(),_siteBuilderDetail.CallBackForHideShowFooter(!0),(i=document.createElement("script")).type="text/javascript",i.onload=setMobileData=e=>{var t={};if((t=JSON.parse(e)).hasOwnProperty("callbackIndex")&&"98"==t.callbackIndex){var i="string"==typeof t?t.locationObject:JSON.parse(t.locationObject);if(null!=i&&void 0!==i.latitude&&void 0!==i.longitude&&0!=i.countryId){var a={coords:{latitude:i.latitude,longitude:i.longitude}};$("#dvtimezone").is(":visible")&&ShowLoader(!0),$("#txtLiveStreamLocationSearch").is(":visible")?setCurrentLocationFromDatabase(a,$("#txtLiveStreamLocationSearch"),_siteBuilderDetail.gblsource,_siteBuilderDetail.gblevent,_siteBuilderDetail.gblevent.choice,"onlocationchange",tabSegment):setCurrentLocationFromDatabase(a,null,null,null,null,"loaddatabypage",tabSegment)}else 0==("undefined"!=typeof isFirstTimeCall&&null!=isFirstTimeCall&&"true"==isFirstTimeCall.toString().toLowerCase())&&_siteBuilderDetail.latLongFailed(null,null,null,"applocationchange",tabSegment)}if(t.hasOwnProperty("backToWeb")&&"9"==t.backToWeb){var r=getQueryStringData("Type");null!==document.getElementById("divTransferRequestModalDialog")&&"undefined"!==document.getElementById("divTransferRequestModalDialog")&&1==$("#divTransferRequestModalDialog").is(":visible")?_vgVagaroImport.HideTransferRequestPopUp(!1):"ImportOnBoarding"==r&&window.history.back()}},i.addEventListener("load",()=>{console.log("script loaded")}),i.addEventListener("error",e=>{console.log("Error on loading script",e)}),document.body.appendChild(i);_siteBuilderDetail.OnboardBookNowFooter=$("#Onboard-BookNow-Footer"),$("#pushdiv").hide(),$("#Onboard-BookNow-back").on("click",function(e){wbc._postMessage('{"eventType": "BackToimportothersoftware" }')}),$("#Onboard-BookNow-next").text("Cancel"),$("#Onboard-BookNow-next").show(),$("#Onboard-BookNow-next").on("click",function(e){window.parent.location.href="/merchants/calendar"}),$("body").addClass("signup-onboarding-booking import-onboarding-booking default-scrollbar")}},_siteBuilderDetail.removeContentClass=function(){$("#topHeadSection div.container").hasClass("mbhide-header-content")&&$("#topHeadSection div.container").removeClass("mbhide-header-content")},_siteBuilderDetail.addContentClass=function(){$("#topHeadSection div.container").hasClass("mbhide-header-content")||$("#topHeadSection div.container").addClass("mbhide-header-content")},_siteBuilderDetail.SetUserAgentForAppClip=function(){_siteBuilderDetail.userAgent=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase(),_siteBuilderDetail.isFromAppClip=null!=_siteBuilderDetail.userAgent.match(/appclip/i),_siteBuilderDetail.isFromAppleClip=null!=_siteBuilderDetail.userAgent.match(/appleclip/i)},_siteBuilderDetail.WidgetButtonCustomText=function(e){var t="Click to Book";return null==e||(6==e||7==e||9==e?t="Click to Purchase":8==e&&(t="Click to Post Review")),t},_siteBuilderDetail.BindMenu=function(){var e=!1;if("none"!==$("#mobiletabmenu").css("display")&&(e=!0,$("#mobiletabmenu ul").html("")),void 0!==_siteBuilderDetail.UserLocationInfo&&""!=_siteBuilderDetail.UserLocationInfo&&(null!=_siteBuilderDetail.UserLocationInfo.objDynamicMenuData&&_siteBuilderDetail.UserLocationInfo.objDynamicMenuData.forEach(function(t){var i=$("#"+t.menuID).parent();t.menuID==BusinessTabNameEnum.services&&t.isVisible&&(IsServiceTab=!0),t.menuID==BusinessTabNameEnum.classes&&t.isVisible&&(IsClassTab=!0),t.menuID==BusinessTabNameEnum.memberships&&t.isVisible&&$("#"+t.menuID).text(t.DisplayName),i.length>0&&0==t.isVisible?"shopping-bag"==t.menuID?($("#dvShoppingCartIcon").hide(),$("#dvLoginLink").show(),"undefined"!=typeof _common&&"function"==typeof _common.SyncAppNavCtaVisibility&&"function"==typeof _common.VisibleControlLength&&_common.VisibleControlLength("#mobile-check")>0&&_common.SyncAppNavCtaVisibility()):i.hide():"shopping-bag"==t.menuID?1==t.isVisible&&(_common.showHideCart(!0),$("#dvShoppingCartIcon").show(),$("#dvLoginLink").hide()):"true"==isWidget||e||i.length>0&&"hidden"!==i.css("visibility")&&"none"!==i.css("display")?i.show():i.hide(),"true"!=isWidget&&"true"!=isFacebook||t.menuID==BusinessTabNameEnum.about&&i.addClass("widget"),"true"==isWidget&&(t.menuID.toLowerCase()==BusinessTabNameEnum.services&&1==t.isVisible&&$("#widgetdetailmenu #ancServiceTab").show(),t.menuID.toLowerCase()==BusinessTabNameEnum.classes&&1==t.isVisible&&$("#widgetdetailmenu #ancClassTab").show(),t.menuID.toLowerCase()==BusinessTabNameEnum.gift_certificates&&1==t.isVisible&&$("#widgetdetailmenu #ancGiftCertificate").show(),t.menuID.toLowerCase()==BusinessTabNameEnum.memberships&&1==t.isVisible&&($("#widgetdetailmenu #ancMembership").show(),$("#widgetdetailmenu #ancMembership").text(t.DisplayName)),t.menuID.toLowerCase()==BusinessTabNameEnum.products&&1==t.isVisible&&$("#widgetdetailmenu #ancProduct").show(),t.menuID.toLowerCase()==BusinessTabNameEnum.reviews&&1==t.isVisible&&$("#widgetdetailmenu #ancReview").show(),t.menuID.toLowerCase()==BusinessTabNameEnum.book_now&&1==t.isVisible&&$("#widgetdetailmenu #ancbook").show())}),1==e&&"true"!=isWidget)){var t=$("#tabs.navbar-nav").children().clone(!0,!0);$("#mobiletabmenu ul").append(t)}"Detail"==BasePage&&_shopdetail.renderbookdropdown()},_siteBuilderDetail.ChecktabSegment=function(e){"myaccount"==e&&(IsNewCustomWebsite||(_siteBuilderDetail.isFirstTimeLoad=!1),DisplayFullView(!0))},_siteBuilderDetail.SetHeaderFooterHtml=function(){$("#imgLoading").attr("src",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.LoaderSmall);var e=_siteBuilderDetail.UserLocationInfo;null!=e&&null!=e&&""!=e&&null!=e.objUserCustomData&&""!=e.objUserCustomData&&null!=e.objUserCustomData&&(_siteBuilderDetail.IsCustomWebsite=e.objUserCustomData.IsCustomWebsite),$('a[href*="https://www.vagaro.com/pro"],a[href*="https://www.vagaro.com/en-"]').length>0&&GetLocalStorage(),Webflow.ready(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType||"undefined"!=typeof UserName&&""!=UserName&&($(".loginUserIntials").html(FindInitials(FullUserName,"SP")),_home.CommonLogin(!0,UserName,$("#hdnUserImage").val()))},_siteBuilderDetail.RegisterNlevelMenu=function(){$("body").on("click","ul.dropdown-menu [data-toggle='dropdown']",function(e){e.preventDefault(),e.stopPropagation(),0==$(e.target).parents().find(".component-pagesection").hasClass("extra-toggle-nav")&&_siteBuilderDetail.SetMenuDirection($(this)),$(this).siblings().toggleClass("show"),$(this).next().hasClass("show")||$(this).parents(".dropdown-menu").first().find(".show").removeClass("show"),$(this).parents("li.nav-item.dropdown.show").on("hidden.bs.dropdown",function(e){$(".dropdown-submenu .show").removeClass("show")})}),$("body").on("click",function(e){var t=$(".dropdown-menu");t.hasClass("show")&&t.removeClass("show")})},_siteBuilderDetail.SetMenuDirection=function(e){var t=e.closest(_siteBuilderDetail.VgCustomComponent).width(),i=e.offset().left;if(e.siblings().hasClass("show"))e.closest("li.nav-item").hasClass("sub-drop-menu-right")&&e.closest("li.nav-item").removeClass("sub-drop-menu-right");else{var a=e.siblings().width();i+e.width()+a>t&&e.closest("li.nav-item").addClass("sub-drop-menu-right")}},_siteBuilderDetail.SetUserLocationData=function(){null!=_siteBuilderDetail.UserLocationData&&"$$#USERLOCATIONDATA#$$"!=_siteBuilderDetail.UserLocationData&&(_siteBuilderDetail.UserLocationInfo=JSON.parse(_siteBuilderDetail.jsonEscape(_siteBuilderDetail.UserLocationData)))},_siteBuilderDetail.SetVConnectJsonLoadData=function(){if(null!=_siteBuilderDetail.VConnectJsonLoadData&&"$$#VConnectJsonLoadData#$$"!=_siteBuilderDetail.VConnectJsonLoadData&&(_siteBuilderDetail.VConnectJsonLoadData=JSON.parse(_siteBuilderDetail.jsonEscape(_siteBuilderDetail.VConnectJsonLoadData)),"undefined"!=typeof _vagaroConnect&&null!=_siteBuilderDetail.VConnectJsonLoadData&&(_vagaroConnect.model.vagaroConnectPath=_siteBuilderDetail.VConnectJsonLoadData.VagaroConnectWebAppURL),vConnectReactPayload=_siteBuilderDetail.VConnectJsonLoadData,void 0!==window._aiBooking&&"function"==typeof window._aiBooking.loadBookingFromSession))try{window._aiBooking.loadBookingFromSession()}catch(e){}},_siteBuilderDetail.jsonEscape=function(e){try{e=e.split("|^~^|").join("\\");var t=/[\u0000\u0003\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;t.lastIndex=0,t.test(e)&&(e=e.replace(t,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))}catch(e){}return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")},_siteBuilderDetail.SetDefaultVariable=function(){if(isWindowsApp=!1,IsBlockBook="false",isGoogle="false",GoogleEndPointUrl="",GooglePartnerId="",IsFromWidgetPage="false",businessID=_siteBuilderDetail.businessID,encryptBusinessID=_siteBuilderDetail.encryptBusinessID,staticEncryptBusinessID=_siteBuilderDetail.staticEncryptBusinessID,staticEncryptUserID=_siteBuilderDetail.staticEncryptUserID,vagaroUrl="",IsBrandedApp=!1,isPromotionUI="false",BookText="",IsShowPackage=!1,ClassBookText="",backGroundColor="",PromotionURL="",IsAutoAssignEmployee=!1,_IsPartialPointAllowed=!1,null!=_siteBuilderDetail.UserLocationInfo&&"$$#USERLOCATIONDATA#$$"!=_siteBuilderDetail.UserLocationData&&null!=_siteBuilderDetail.UserLocationData){var e=_siteBuilderDetail.UserLocationInfo;if(isStopInvoiceReviewcnt=e.IsStopInvoiceReviewcnt,IsBrandedApp=e.IsBrandedApp,$("#hdnIsBrandedApp").val(IsBrandedApp),IsSingleBusinessBrandedApp=e.IsSingleBusinessBrandedApp,IsBrandedAppBusinessActive=e.IsBrandedAppBusinessActive,IsNewVersionCustomerAppForFbGoogleLogin=e.IsNewVersionCustomerAppForFbGoogleLogin,IsNewVersionCustomerAppWithOldOS=e.IsNewVersionCustomerAppForFbGoogleLoginAndroid,IsForNewCustomer=e.IsForNewCustomer,isOldVersionCustomerApp=e.IsOldVersionCustomerApp,IsSupportNewDialogApp=e.IsSupportNewDialogApp,IsNewCustomWebsite=e.IsNewCustomWebsite,IsCCSupportedCountry=e.IsCCSupportedCountry,IsIOSBrandedApp=e.IsIOSBrandedApp,IsOldOSBrandedApp=e.IsOldOSBrandedApp,DefaultCookieDomainKey=e.DefaultCookieDomainKey,GroupRouteValue=e.GroupRouteValue,DefaultTabPage=e.DefaultTabPage,mobileSessionId=e.MobileSessionId,isDoingUpload=e.IsDoingUpload,IsSupportSingleSignin=e.IsSupportSingleSignin,UserName="",FullUserName="",UserID="",UserType="",UserEmail="",UserCellNo="",CheckinUserPhoto="",FMBFeeEnable=!0===e.FMBFeeEnable,void 0!==e.IsLoadDailyDealPage&&1==e.IsLoadDailyDealPage&&(BasePage="DailyDeal"),void 0!==e.objUserInfo&&null!=e.objUserInfo){var t="";null!=e.objUserInfo.LastName&&(t=e.objUserInfo.LastName.length>1?e.objUserInfo.LastName.substring(0,1):e.objUserInfo.LastName),UserName=e.objUserInfo.FirstName+" "+t,$("#hdnUserName").val(UserName),FullUserName=e.objUserInfo.FullName,$("#hdnFullUserName").val(FullUserName),UserID=e.objUserInfo.UserID.toString(),IsForNewCustomer=1!=e.IsForNewCustomer,$("#hdnUserId").val(UserID),$("#hdnStrUserIdV2").val(e.strUserIDV2.toString()),UserType=e.objUserInfo.UserType,$("#hdnUserType").val(UserType),UserEmail=e.objUserInfo.EmailId,$("#hdnUserEmail").val(UserEmail),UserCellNo=e.objUserInfo.Cell,$("#hdnUserCellNo").val(UserCellNo),null!=e.objUserInfo.Photo&&""!=e.objUserInfo.Photo&&(CheckinUserPhoto=e.objUserInfo.CDNUrl+_siteBuilderDetail.UserImage200x0PathAkamai+e.objUserInfo.Photo,$("#hdnUserImage").val(CheckinUserPhoto)),$("#hdUserAddress").val(e.UserAddress),_home.GetOutStandingReviewAndInvoiceCnt(),$('[id="spnProfile"]').text(FullUserName),$('[id="spnProfile"]').attr("aria-label",FullUserName+" Profile"),$('[id="accprofile"]').attr("aria-label",FullUserName+" Profile")}else if(null!=typeof getQueryStringData&&void 0!==e.IsForNewCustomer&&1==e.IsForNewCustomer){String.isNullOrUndefineOrBlank(QueryStringValue)&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL),"Builder"===getQueryStringData("Type")&&(IsForNewCustomer=1!=e.IsForNewCustomer)}if($("#hdShopAddress").val(e.ShopAddress),tabSegment=e.TabSegment,multiLocationWidgetURL=e.MultiLocwidgetURL,promotionalURL="",googleKeyFormap=e.googleKeyFormap,secGoogleKeyFormap=e.secGoogleKeyFormap,AppendGoogleMapKey=e.AppendGoogleMapKey,strUserID=e.strUserID,isFirstTimeCall=e.isFirstTimeCall,_siteBuilderDetail.AllDetailCommon=e.Model,null!=e.Model&&null!=e.Model.Color?(IsEnablePickUpInStore=e.Model.Color.IsEnablePickUpInStore,BackgroundImageForDetailPage=e.Model.Color.PatternImageName,WallpaperContainerURL=e.Model.Color.WallpaperContainerURL):IsEnablePickUpInStore=!1,_siteBuilderDetail.loginUserId=$("#hdnUserId").length>0?$("#hdnUserId").val():0,UserID=$("#hdnUserId").length>0?$("#hdnUserId").val():0,"undefined"==typeof vgAppicationType||2!=vgAppicationType||void 0!==glbDataCheckIn&&null!=glbDataCheckIn&&void 0!==glbDataCheckIn.scanUserID&&!parseInt(glbDataCheckIn.scanUserID<=0)||CallbackforMobileApp(0,0,"","",0,"2|~|3"),null!=e.objUserCustomData&&null!=e.objUserCustomData){CoreAPIURL=e.objUserCustomData.VagaroCoreAPIURL,CoreAPIURLV2=e.objUserCustomData.VagaroCoreAPIURLV2,VagaroCorePublicAPIURLV2=e.objUserCustomData.VagaroCorePublicAPIURLV2,VagaroCoreAPIURLV3=e.objUserCustomData.VagaroCoreAPIURLV3,_siteBuilderDetail.isAffirmEnable=e.objUserCustomData.VplGatewayType==_vgVPLOnline.VPLGatewayType.Affirm,_siteBuilderDetail.isRequestFromVagaro=e.objUserCustomData.IsRequestFromVagaro.toString(),isFacebook=e.objUserCustomData.IsFaceBook.toString(),isCustomWebsite=e.objUserCustomData.IsCustomWebsite.toString().toLowerCase(),isGoogleCrawler=e.objUserCustomData.IsGoogleCrawler,adminCDNURL=e.objUserCustomData.AdminCDNURL,"myaccount"!=tabSegment&&(groupID=e.objUserCustomData.groupId,regionId=groupID.toLowerCase()),_siteBuilderDetail.SQLGroupID=e.objUserCustomData.groupId,cdnImagePath=e.objUserCustomData.StaticAkamaiCDNPath,isWidget=e.objUserCustomData.IsWidget.toString(),IsFromWidgetPage=isWidget,IsShowMobileAppWidget=e.objUserCustomData.IsShowMobileAppWidget,isshowMobileApp=e.objUserCustomData.IsShowMobileAppWidget.toString(),IsNewReDesignWidget=e.objUserCustomData.IsNewReDesignWidget,TabsIncluded=e.objUserCustomData.TabsIncluded,w_type=e.objUserCustomData.w_type,MultiLocBusinessID=e.objUserCustomData.MultiLocBusinessID,b_themeID=e.objUserCustomData.b_themeID,IsFromMultiLocation=e.objUserCustomData.IsFromMultiLocation,WidgetVersion=e.objUserCustomData.WidgetVersion,TabAtLaunch=e.objUserCustomData.TabAtLaunch,WidgetSpId=e.objUserCustomData.WidgetSpId,IsPopup=e.objUserCustomData.IsPopup,isFacebookoAuth=e.objUserCustomData.IsFaceBookoAuth.toString(),PromotionAppointmentID=e.objUserCustomData.PromotionAppointmentID,isFromTextMarketing=e.objUserCustomData.IsFromTextMarketing,previewID=e.objUserCustomData.PreviewID,InventoryPath=e.objUserCustomData.InventoryPath,ServiceID=e.objUserCustomData.ServiceID,providerID=e.objUserCustomData.ProviderID,styleID=e.objUserCustomData.StyleID,styleName=e.objUserCustomData.StyleName,PromotionID=e.objUserCustomData.PromotionID,HouseCallGroupID=e.HouseCallGroupID;try{void 0!==e.objUserCustomData.BookingTime&&null!=e.objUserCustomData.BookingTime&&""!=e.objUserCustomData.BookingTime&&-1!=e.objUserCustomData.BookingTime.indexOf("'")&&(e.objUserCustomData.BookingTime=e.objUserCustomData.BookingTime.replace(/'/g,""))}catch{}BookingTime=e.objUserCustomData.BookingTime;try{HSnames=e.objUserCustomData.HSnames,""!=HSnames&&(HSnames=JSON.parse(HSnames)),BusinessTypeTitles=e.objUserCustomData.BusinessTypeTitles,""!=BusinessTypeTitles&&(BusinessTypeTitles=JSON.parse(BusinessTypeTitles)),homePageBannerCDNURL=e.objUserCustomData.homePageBannerCDNURL}catch(e){}PromotionProviderIds=e.objUserCustomData.PromotionProviderIds,BookingDate=e.objUserCustomData.BookingDate,GiftCertificateTextOnImagePath=e.objUserCustomData.GiftCertificateTextOnImagePath,IsFromWidgetMenu=e.objUserCustomData.IsFromWidgetMenu,IsFBExtensions=e.objUserCustomData.IsFBExtensions,IsBookFromFacebook=e.objUserCustomData.IsBookFromFacebook.toString(),IsBookFromFacebookoAuth=e.objUserCustomData.IsBookFromFacebookoAuth.toString(),IsPromotionUI=e.objUserCustomData.IsPromotionUI.toString(),IsAllowTipForInvoice=e.objUserCustomData.IsAllowTipForInvoice,EncryptedInvoiceNo=e.objUserCustomData.EncryptedInvoiceNo,isPromotionUI=void 0!==e.objUserCustomData.IsPromotionUI?e.objUserCustomData.IsPromotionUI.toString():"false",PromotionURL=e.objUserCustomData.PromotionURL,_siteBuilderDetail.promotionalURL=e.objUserCustomData.PromotionURL,PromotionSponsorURL=e.objUserCustomData.PromotionSponsorURL,PromotionLogoImage=e.objUserCustomData.PromotionLogoImage,isWindowsApp=e.objUserCustomData.IsWindowsApp,isAppClipFirstTime=e.objUserCustomData.IsAppClipFirstTime,_siteBuilderDetail.isFromAppleClip=1==isAppClipFirstTime?isAppClipFirstTime:_siteBuilderDetail.isFromAppleClip,isGoogle=e.objUserCustomData.IsGoogle.toString(),"false"==isGoogle&&_siteBuilderDetail.checkRwgToken(businessID),GoogleEndPointUrl=e.objUserCustomData.GoogleEndPointUrl,GooglePartnerId=e.objUserCustomData.GooglePartnerId,isCallFromCheckInApp=e.objUserCustomData.IsCheckInApp,isBotCrawler=e.objUserCustomData.IsBotCrawler,isOldVersionCustomerApp=e.objUserCustomData.IsOldVersionCustomerApp,IsSupportNewDialogApp=e.IsSupportNewDialogApp,IsSecurityApplied=e.objUserCustomData.IsSecurityApplied,$("#IsWaitforKeepALive").val(IsSecurityApplied.toString()),DomainName=e.objUserCustomData.DomainName,strcheckinAppThemeColor=e.objUserCustomData.strcheckinAppThemeColor,TitleTimesTamp=e.objUserCustomData.TitleTimesTamp,UnderMaintenanceInterval=e.objUserCustomData.UnderMaintenanceInterval,QueryStringServiceProvideId=e.ServiceProviderId,_shopdetail.IsCalledFromLiveStream=e.objUserCustomData.IsCalledFromLiveStream,QueryStringCovidUserID=e.CovidCleanUserId,ReviewID=e.objUserCustomData.ReviewID;var i=window.location.pathname.includes("/cl/");"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&e.objUserCustomData.IsFromCreateLink&&i&&(_siteBuilderDetail.iosDevices||_siteBuilderDetail.isAndroid)&&(cookieManager.setCookie("UniqueCreateLink",e.objUserCustomData.UniqueCreateLink,365,cookieManager.defaultPath,DefaultCookieDomainKey,!0),cookieManager.setCookie("EventType",e.objUserCustomData.EventType,365,cookieManager.defaultPath,DefaultCookieDomainKey,!0),cookieManager.setCookie("MultiProviderID",e.objUserCustomData.MultiProviderID,365,cookieManager.defaultPath,DefaultCookieDomainKey,!0),cookieManager.setCookie("ServiceID",e.objUserCustomData.ServiceID,365,cookieManager.defaultPath,DefaultCookieDomainKey,!0)),IsFromCreateLink=_common.isCreateLinkPreserve(!0,!0),MembershipID=void 0!==getCookie("UniqueCreateLink")&&""!=getCookie("UniqueCreateLink")&&""!=getCookie("UniqueCreateLink")&&7==getCookie("EventType")?getCookie("UniqueCreateLink").split("~")[2]:0,MultiProviderID=e.objUserCustomData.MultiProviderID,EventType=e.objUserCustomData.EventType,GeoLocationKey=e.objUserCustomData.GeoLocationKey}_siteBuilderDetail.StaticAkamaiCDNPath=cdnImagePath.replace(/\/$/,""),null!=e.Model&&null!=e.Model.BusinessDetail&&null!=e.Model.BusinessDetail&&(_siteBuilderDetail.ComponentResponse.lstBusinessDetail=e.Model.BusinessDetail,businessID=e.Model.BusinessDetail.BusinessID.toString(),$("#hdnToken4").val(bencrypt(businessID)),IsAutoAssignEmployee=e.Model.BusinessDetail.IsAutoAssignEmployee,isAllowFriendsandFamilyBooking=e.Model.BusinessDetail.isAllowFriendsandFamilyBooking,_IsPartialPointAllowed=e.Model.BusinessDetail.IsAllowPartialPoint,businessName=e.Model.BusinessDetail.BusinessName,currencySymbol=e.Model.BusinessDetail.CurrencySymbol,currencyCode=e.Model.BusinessDetail.CurrencyCode,cDNUrl=e.Model.BusinessDetail.CDNUrl,vagaroUrl=e.Model.BusinessDetail.VagaroURL,City=e.Model.BusinessDetail.City,State=e.Model.BusinessDetail.StateName,countryIdBusDetail=e.Model.BusinessDetail.CountryID.toString(),bCountryID=e.Model.BusinessDetail.CountryID.toString(),merchantAccount=e.Model.BusinessDetail.MerchantAccount,isShoppingTabCartOptionEnable=!!e.Model.BusinessDetail.IsShoppingTabCartEnable,shopOwnerID=e.Model.BusinessDetail.ShopOwnerID,businessEmail=e.Model.BusinessDetail.Email,IsEnabledOnlineGC=e.Model.BusinessDetail.IsServiceBasedGCEnabled,BusinessLocationImage=e.Model.BusinessDetail.BusinessLocationImage,IsOnlineCustomerWaitlist=e.Model.BusinessDetail.IsOnlineCustomerWaitlist,AcceptAmex=e.Model.BusinessDetail.AcceptAmex?"True":"False",BusinessDefaultImage=e.Model.BusinessDetail.BusinessDefaultImage,TabBackgroundColor=e.Model.Color.TabBackgroundColor,BusinessDescription=e.Model.Color.BusinessDescription,_siteBuilderDetail.initializeVariable(e.Model.BusinessDetail),promotionCodeId=e.Model.BusinessDetail.PromotionCodeID>0?e.Model.BusinessDetail.PromotionCodeID.toString():"",Address=e.Model.BusinessDetail.City+", ",BookText=e.Model.BusinessDetail.BookText,IsShowPackage=e.Model.BusinessDetail.IsShowPackage.toString(),ClassBookText=e.Model.BusinessDetail.ClassBookText,null!=e.Model.BusinessDetail.StateCode&&(Address+=e.Model.BusinessDetail.StateCode),$("#hdBookText").val(e.Model.BusinessDetail.BookText),$("#hdnClassBookText").val(e.Model.BusinessDetail.ClassBookText),MembershipPackageType=parseInt(e.Model.BusinessDetail.MembershipPackageType),IsBlockBook=e.Model.BusinessDetail.IsBlockBook.toString(),EnableHiipaCompliant=e.Model.BusinessDetail.EnableHiipaCompliant,about_latitude=e.Model.BusinessDetail.LATITUDE,about_longitude=e.Model.BusinessDetail.LONGITUDE,void 0!==e.objUserInfo&&null!=e.objUserInfo&&(_siteBuilderDetail.ComponentResponse.lstUserInfo=e.objUserInfo),void 0!==e.Model.Facility&&null!=e.Model.Facility&&(_siteBuilderDetail.ComponentResponse.lstFacility=e.Model.Facility),void 0!==e.Model.StyleandBusinessImageResult&&null!=e.Model.StyleandBusinessImageResult&&(_siteBuilderDetail.ComponentResponse.lstStyleAndBusinessImage=e.Model.StyleandBusinessImageResult),void 0!==e.Model.CommonApiConfigKeys&&null!=e.Model.CommonApiConfigKeys&&(_siteBuilderDetail.ComponentResponse.lstCommonConfigKey=e.Model.CommonApiConfigKeys),void 0!==e.Model.Color&&null!=e.Model.Color&&(_siteBuilderDetail.ComponentResponse.lstColors=e.Model.Color,"true"==isCustomWebsite&&($("#hdnTabBackgroundColor").val(e.Model.Color.TabBackgroundColor),$("#hdnFontColor").val(e.Model.Color.FontColor),$("#hdnContentHeaderFontColor").val(e.Model.Color.ContentHeaderFontColor),$("#hdnContentFontName").val(e.Model.Color.ContentFontName))),void 0!==e.Model.WidgetSpInfo&&null!=e.Model.WidgetSpInfo&&(_siteBuilderDetail.ComponentResponse.lstWidgetSpInfo=e.Model.WidgetSpInfo),"undefined"!=typeof isBotCrawler&&isBotCrawler&&(void 0!==e.Model.ReviewPercent&&null!=e.Model.ReviewPercent&&(_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent=e.Model.ReviewPercent),void 0!==e.Model.WorkingHours&&null!=e.Model.WorkingHours&&(_siteBuilderDetail.ComponentResponse.lstWorkingHours=e.Model.WorkingHours),void 0!==e.Model.Promotions&&null!=e.Model.Promotions&&(_siteBuilderDetail.ComponentResponse.lstPromotions=e.Model.Promotions),void 0!==e.Model.Reviews&&null!=e.Model.Reviews&&(_siteBuilderDetail.ComponentResponse.lstReview.lstResponse=e.Model.Reviews)),fbEncryptedBusiness=e.FbEncryptedBusiness,PixelId=e.PixelId,GCTextOnImageAkamai=e.GCTextOnImageAkamai,fullVagaroUrl=e.Model.BusinessDetail.FullVagaroUrl,businessAddress=htmlEnc(e.Model.BusinessDetail.City+", "+e.Model.BusinessDetail.StateCode))}},_siteBuilderDetail.isNullUndefined=function(e){return void 0===e||null==e||""==e},_siteBuilderDetail.checkRwgToken=function(e){String.isNullOrUndefineOrBlank(_common.GetGoogleToken(e))||(isGoogle="true")},_siteBuilderDetail.initializeVariable=function(e){_shopdetail.IsOutcallMandatory=1==e.IsOutcallMandatory?"True":"False",_shopdetail.IsMobileServiceMandatory=e.IsMobileServiceMandatory,_shopdetail.IsZoomIntegrated=e.IsZoomIntegrated,_shopdetail.StateCode=e.StateCode,_shopdetail.MerchantTokenID=e.MerchantTokenID,_shopdetail.OutCallTime=null!=e.OutCallTime?e.OutCallTime.toString():"0",_shopdetail.OutCallPrice=e.OutCallPrice.toString(),_shopdetail.OutcallPointRedeem=e.OutcallPointRedeem.toString(),_shopdetail.IsRequireGenderInformation=e.IsRequireGenderInformation,_shopdetail.activeTabName="",_shopdetail.isTabLoaded="Detail"==BasePage,_shopdetail.isWidget=isWidget,_shopdetail.isFacebook=isFacebook,_shopdetail.businessID=businessID,_shopdetail.currencySymbol=currencySymbol,_shopdetail.isCustomWebsite=isCustomWebsite,_shopdetail.isGoogleCrawler=isGoogleCrawler,_shopdetail.CDNUrl=cDNUrl,_shopdetail.AdminCdnURL=adminCDNURL,_shopdetail.MerchantAccount=e.merchantAccount,_shopdetail.ShopownerID=shopOwnerID,_shopdetail.inventoryPath=InventoryPath,_shopdetail.vagaroUrl=vagaroUrl,_shopdetail.businessName=businessName,_shopdetail.serviceID=ServiceID,_shopdetail.providerID=providerID,_shopdetail.styleID=styleID,_shopdetail.styleName=styleName,_shopdetail.bookingRescDateTime="",_shopdetail.bookingDateTime=""!=BookingTime&&null!=BookingTime&&null!=BookingTime?BookingDate+" "+BookingTime:BookingDate,_shopdetail.bookingDateTime=null==_shopdetail.bookingDateTime||null==_shopdetail.bookingDateTime||""==_shopdetail.bookingDateTime?"":_shopdetail.bookingDateTime,_shopdetail.PromotionProviderID="undefined"!=typeof PromotionProviderIds&&null!=PromotionProviderIds&&""!=PromotionProviderIds?PromotionProviderIds:"",_shopdetail.PromotionID=PromotionID,_shopdetail.isCalenderFilled=!1,_shopdetail.isClassCalenderFilled=!1,_shopdetail.TabsIncluded=TabsIncluded,_shopdetail.IsPopup=IsPopup,_shopdetail.businessEmail=businessEmail,_shopdetail.IsEnabledOnlineGC=IsEnabledOnlineGC,_shopdetail.countryId="undefined"!=typeof countryIdBusDetail?countryIdBusDetail:null,_shopdetail.giftCertificateTextOnImagePath=GiftCertificateTextOnImagePath,_shopdetail.PreviewID=previewID,_shopdetail.EventType=null,_shopdetail.b_themeID=b_themeID,_shopdetail.isFromMultiLocation=IsFromMultiLocation,_shopdetail.MultiLocBusinessID=MultiLocBusinessID,_shopdetail.TabAtLaunch=TabAtLaunch,_shopdetail.WidgetSpId=WidgetSpId,_shopdetail.w_type=w_type,_shopdetail.IsFromWidgetMenu=IsFromWidgetMenu,_shopdetail.isFBExtensions="undefined"!=typeof IsFBExtensions&&""!=IsFBExtensions&&null!=IsFBExtensions?IsFBExtensions:"False",_shopdetail.IsBookFromFacebook=IsBookFromFacebook,_shopdetail.IsBookFromFacebookoAuth=IsBookFromFacebookoAuth,_shopdetail.IsEnablePickUpInStore=IsEnablePickUpInStore,_shopdetail.IsGCTabEnabled=e.IsGCTabEnabled,_shopdetail.Telephone=e.Telephone,_shopdetail.TaxesValues=e.TaxesValues,_shopdetail.IsIncludeTaxInOnlinePricing=e.IsIncludeTaxInOnlinePricing,_shopdetail.IsMemPkgReqToBook=1!=isCallFromCheckInApp&&e.IsMemPkgReqToBook,_shopdetail.IsLimitOnlineBooking=1!=isCallFromCheckInApp&&e.IsLimitOnlineBooking,_shopdetail.IsConfimationReq=e.IsConfimationReq,selectedShopId=businessID,_common.isCreateLinkPreserve(!0,!0)&&(_shopdetail.providerID=MultiProviderID,_shopdetail.EventType=EventType,_shopdetail.ServiceID=null==_shopdetail.ServiceID?getCookie("UniqueCreateLink").split("~")[2]:_shopdetail.ServiceID,IsBundle="5"==EventType,glbBundleId="5"==EventType?ServiceID:0),isBrandedAppForApproval=e.isBrandedAppForApproval,_siteBuilderDetail.IsReviewTabHide=e.IsReviewTabHide,_shopdetail.PCPaymentGateWayType=void 0!==e.PCPaymentGateWayType&&null!=e.PCPaymentGateWayType&&""!=e.PCPaymentGateWayType?e.PCPaymentGateWayType:0},$(".busAbouttab").on("click touchstart",function(e){var t=$("#menuBar"),i=$(".mobile-dropdown");t.is(e.target)||0!==t.has(e.target).length||i.is(e.target)||0!==i.has(e.target).length||_common.CloseToggelmobileMenu()}),_siteBuilderDetail.PageLoadAddState=function(e){var t=GetSelectedMenuObject(e);t.length>0&&("false"!=t.attr("data-addstate")&&(tabSegment=e,e==DefaultTabPage?_common.AddState("",e):_common.AddState(e,e)),t.removeAttr("data-addstate"))},_siteBuilderDetail.SetGroupID=function(e){groupID=e,regionId=e,void 0!==e&&(regionId=groupID.toLowerCase())},_siteBuilderDetail.LoadComponentDetails=function(e){try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){var t=(new Date).getTime(),i=event.target.id||"",a={eventName:"TabClicked",timestamp:t,data:{TabName:e}};UserID&&parseInt(UserID)>0&&(a.data.customerId="undefined"!=typeof staticEncryptUserID&&null!==staticEncryptUserID?staticEncryptUserID:""),"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&"btnContinue"!=i?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(a)+"}"):"undefined"!=typeof $Interframe&&"btnContinue"!=i&&$Interframe.sendEventMessage(a)}}catch(e){}if(void 0===e||"about"!=e&&"styles"!=e&&"staff"!=e&&"services"!=e&&"classes"!=e&&"events"!=e&&"gift-certificates"!=e&&"memberships"!=e&&"products"!=e||(IsGallerySp=!1,IsGallerywithsp=!1),"services"==e&&1==_shopdetail.IsLimitOnlineBooking&&(_vgClassSessionSelection.commonProperty.IsFromClass=!1),clearCookie("InventoryId"),clearCookie("InventoryMasterId"),"products"==e?(_siteBuilderDetail.ClearAllFilter(!0),$("#divAppNavCta").hide()):"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),_siteBuilderDetail.SetGroupID(_siteBuilderDetail.SQLGroupID),!isDoubleClicked(GetSelectedMenuObject(e))){if($("#divWriteReview").is(":visible")&&$("#divWriteReview").hide(),"undefined"!=typeof lAppID&&(lAppID=""),null!=e&&1==_siteBuilderDetail.isCallFromPublicSide()&&($("html body").removeClass("isDetailPageClass"),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&$("#mobile-check").is(":visible")&&null!=history.state&&"shopping-bag"===history.state.subTab&&_common.showHideCart(!0),_siteBuilderDetail.PageLoadAddState(e)),Data={},Data.merchantID=_siteBuilderDetail.businessID,Data.page_id=e,Data.IsCustomWebsite=_siteBuilderDetail.IsCustomWebsite,Data.isWidget="undefined"!=typeof isWidget&&"true"==isWidget,"false"==_siteBuilderDetail.isRequestFromVagaro&&"undefined"!=typeof parent&&null!=parent&&void 0!==parent._siteBuilder&&null!=parent._siteBuilder&&void 0!==parent._siteBuilder.pages&&null!=parent._siteBuilder.pages){var r=$.grep(parent._siteBuilder.pages,function(t,i){return t.page_id===e});if(r.length>0||"home"===e){var o={Content:r.length>0?r[0].components:""};_siteBuilderDetail.LoadComponentDetails_Success(o)}}else{var n={Pageid:null,Content:""};if(void 0!==_siteBuilderDetail.templatePagesModal&&null!==_siteBuilderDetail.templatePagesModal&&""!==_siteBuilderDetail.templatePagesModal){_siteBuilderDetail.findNestedWithObj(_siteBuilderDetail.templatePagesModal,e);var s=_siteBuilderDetail.FindObj;_siteBuilderDetail.FindObj=null,_siteBuilderDetail.isNullUndefined(s)||(n.Content=s.components,n.Pageid=s.page_id)}null!==n.Content&&""!==n.Content?_siteBuilderDetail.LoadComponentDetails_Success(n):vagaro.ajaxCall(ApiURLEnumCommonApi.getcomponentdetailsbypageid,Data,_siteBuilderDetail.LoadComponentDetails_Success,_siteBuilderDetail.CommonError,!1,!0)}$("#"+e).closest(".menu-links").find(".navbar-toggler:first").length>0&&("true"===$("#"+e).closest(".menu-links").find(".navbar-toggler:first").attr("aria-expanded")?$("#"+e).closest(".menu-links").find(".navbar-toggler:first").trigger("click"):$("#"+e).closest(".dropdown-menu").find("li").length>0&&$("#"+e).closest(".nav-item.dropdown").trigger("click"))}},_siteBuilderDetail.LoadComponentDetails_Success=function(e){if(_common.backtoTopHide(),_common.VisibleControlLength("#divAddressDetails")>0&&$("#divAddressDetails").modal("hide"),"about"==tabSegment&&"true"!=isWidget&&(_siteBuilderDetail.IsCustomWebsite&&!$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]).is(":visible")?$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]).show():$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).is(":visible")||$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).show(),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).is(":visible")||$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).show()),$.grep(_siteBuilderDetail.templatePagesModal,function(t){t.page_id==e.Pageid&&null==t.components&&(t.components=e.Content)}),$(".pagebodycontainer").html(e.Content),setTimeout(function(){if($(".pagebodycontainer").find("vg-custom-component[data-custom-component=herobanner]").length>0&&void 0!==_carouselWebsiteBuilder){var e=$(".pagebodycontainer").find("vg-custom-component[data-custom-component=herobanner]").find(".carousel"),t=$(".pagebodycontainer").find("vg-custom-component[data-custom-component=herobanner]");_carouselWebsiteBuilder.init(e,$(t).data("config"))}},500),$(".pagebodycontainer").show().removeClass("pagesectionFlex"),!_siteBuilderDetail.isNullUndefined(e)&&!_siteBuilderDetail.isNullUndefined(e.Pageid)&&"home"===e.Pageid&&$(".component-pagesection").hasClass("center-hero-logo")){var t=$(".component-pagesection").attr("data-config");if(!_siteBuilderDetail.isNullUndefined(t)){var i=JSON.parse(t).businesslogo;$(".pagebodycontainer").find(".logo-yield a img").attr("src",i)}$(".pagebodycontainer").find(".logo-yield").css("display","flex")}(IsNewCustomWebsite&&$("#mobile-check").is(":visible")||("classes"===tabSegment||"book-now"===tabSegment)&&$("#mobile-check").is(":visible"))&&"detail"==BasePage.toLowerCase()&&($("#mobile-check").is(":visible")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&_shopdetail.activeTabName!=tabSegment&&$("#mobileBack").data("backtabname",_shopdetail.activeTabName),_shopdetail.setSelected(null,tabSegment),IsNewCustomWebsite||_siteBuilderDetail.InjectMobileMenuForAbout(),$(".dynamicpages").hide(),_siteBuilderDetail.BindShopDetail_Success(_siteBuilderDetail.AllDetailCommon)},_siteBuilderDetail.BindShopDetail_Success=function(e){var t;!0===_siteBuilderDetail.isFirstTimeLoad?(t=$("body").find(_siteBuilderDetail.VgCustomComponent),_siteBuilderDetail.isFirstTimeLoad=!1,_siteBuilderDetail.CallbackMobileApp(e),_siteBuilderDetail.currencySymbol=null!=e&&null!=e.BusinessDetail?e.BusinessDetail.CurrencySymbol:"$"):t=$("body").find(".pagebodycontainer").find(_siteBuilderDetail.VgCustomComponent),"shopping-bag"==tabSegment?$(".scrptbody.thm-shopdetail").addClass("product-book-checkout"):$(".scrptbody.thm-shopdetail").removeClass("product-book-checkout"),"undefined"!=typeof isWidget&&"true"==isWidget&&"about"!=tabSegment&&(redirecttodevicetabname=tabSegment),_siteBuilderDetail.loadFrameComponent(t)},_siteBuilderDetail.loadFrameComponent=function(e){for(var t=0;t<e.length;t++)_siteBuilderDetail.onComponentInitMethod(e[t],e[t].attributes["data-custom-component"].value),"about"!=tabSegment&&_siteBuilderDetail.addContentClass();setTimeout(function(){"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh()},1e3)},_siteBuilderDetail.GetPageHeaderSectionComponent=function(e,t){if(!(1==_siteBuilderDetail.isNullUndefined(_siteBuilderDetail.businessID)||_siteBuilderDetail.businessID<=0)){$("#srpt-topHeader-section-stencil").length>0&&!1===t&&$(e).html($("#srpt-topHeader-section-stencil").html()),$("#srpt-topHeader-custom-section-stencil").length>0&&!0===t&&$(e).html($("#srpt-topHeader-custom-section-stencil").html());var i="srpt-header-section";_siteBuilderDetail.IsCustomWebsite=t,1==_siteBuilderDetail.IsCustomWebsite&&(i="srpt-customheader-section"),_siteBuilderDetail.ReviewSNode=e,_siteBuilderDetail.ReviewTemplateName=i,$("#mobile-check").is(":visible")&&"false"==isWidget.toLowerCase()&&0==_siteBuilderDetail.IsCustomWebsite?_siteBuilderDetail.LoadBusinessOverAllReview():_siteBuilderDetail.BindPageHeaderSectionComponent(null)}},_siteBuilderDetail.LoadBusinessOverAllReview=function(){if(void 0!==_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent&&null!=_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent)_siteBuilderDetail.GetAboutUsReviewSuccess(_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent);else{var e={};e.businessID=_siteBuilderDetail.businessID;var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumAbout.getreviewpercentage,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=_siteBuilderDetail.GetHeaderBusinessReviewSuccess,t.datamodel.data=e,t.datamodel.Error=_siteBuilderDetail.CommonError,t.Post()}},_siteBuilderDetail.GetHeaderBusinessReviewSuccess=function(e){null!=e&&e.length>0&&(_siteBuilderDetail.ComponentResponse.lstBusinessDetail.VenueRank=e[0].VenueRankAverage),_siteBuilderDetail.BindPageHeaderSectionComponent(e)},_siteBuilderDetail.BindPageHeaderSectionComponent=function(e){var t=e&&e.length>0&&e[0].Total?e[0].Total:0,i=e&&e.length>0&&"number"==typeof e[0].VenueRankAverage?e[0].VenueRankAverage:null,a=isNaN(parseFloat(i))?"0.0":parseFloat(i).toFixed(1),r=1===t?"Review":"Reviews";responceObj={StyleandBusinessImageResult:_siteBuilderDetail.ComponentResponse.lstStyleAndBusinessImage,BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Color:_siteBuilderDetail.ComponentResponse.lstColors,lstWidgetSpInfo:_siteBuilderDetail.ComponentResponse.lstWidgetSpInfo,ReviewPercent:e,ReviewText:"("+t+" "+r+")",VenueRankText:a},$(_siteBuilderDetail.ReviewSNode).html($("#"+_siteBuilderDetail.ReviewTemplateName).tmpl(responceObj)),_siteBuilderDetail.GetPageHeaderSectionSuccess(responceObj)},_siteBuilderDetail.GetPageHeaderSectionSuccess=function(e){var t=e.StyleandBusinessImageResult.find(e=>!0===e.IsDefault&&e.BusinessImageID>0);if(null!=t&&null!=t&&""!=t&&"no-shop-image.gif"!=t.DefaultStyleImagePath.trim().toLowerCase()){if($("#dvBusinessImage").attr("data-original",e.BusinessDetail.CDNUrl+_siteBuilderDetail.BusinessPathOriginalAkamai+t.DefaultStyleImagePath),$("#dvBusinessImage").attr("data-id",t.BusinessImageID.toString()),$("#ComBusinessLogo").attr("src",e.BusinessDetail.CDNUrl+_siteBuilderDetail.BusinessPathOriginalAkamai+t.DefaultStyleImagePath),$("#ComBusinessLogo").attr("data-id",t.BusinessImageID.toString()),1==t.DefaultStyleImagePath.trim().startsWith("Default_")&&"true"!=isWidget)$("#divbusinessatab").parent("div").hide(),$("#dvcustheaderParent").addClass("busnoshareimage");else if($("#dvcustheaderParent").removeClass("busnoshareimage"),"true"==isWidget&&null!=e.BusinessDetail.URL&&null!=e.BusinessDetail.URL&&""!=e.BusinessDetail.URL){var i=0==e.BusinessDetail.URL.toLowerCase().indexOf("http")?e.BusinessDetail.URL:"http://"+e.BusinessDetail.URL;$("#divbusinessatab").attr("href",i),$("#divbusinessatab").attr("target","_blank")}}else $("#dvBusinessImage").attr("data-original",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.DefaultShopImageForAll),$("#ComBusinessLogo").attr("src",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.DefaultShopImageForAll);if(_siteBuilderDetail.LoadSocialMediaIcon(e,!1),"true"==isCustomWebsite&&("true"==isCustomWebsite||null!=_shopdetail.isFacebook&&"true"==_shopdetail.isFacebook||null!=_shopdetail.isWidget&&"true"==_shopdetail.isWidget)&&_shopdetail.loadCustomBanner(),"true"==isWidget){var a=$("#topHeadSection");if(a.length>0&&("true"==isFacebook?a.addClass("facebook"):b_themeID>0?a.addClass("multiloc"):w_type==_siteBuilderDetail.WidgetTypeEnum.NewWindow&&a.addClass("newwindowWidget")),w_type==_siteBuilderDetail.WidgetTypeEnum.NewWindow){var r=MultiLocBusinessID>0?MultiLocBusinessID:businessID,o=getCookie("widgetbackurl_"+r);if(null!=o)$("#divbusinessatab").length>0&&(divbusinessatab.attr("href",o).removeAttr("onclick"),divbusinessatab.removeClass("w-lightbox"))}}IsFromMultiLocation&&b_themeID>0&&"true"==isWidget&&($("#divChangeLoc").show(),"true"!=isFacebook&&($("#divBookNow").hide(),w_type!=_siteBuilderDetail.WidgetTypeEnum.NewWindow?($("#divbusinessatab").parent().hide(),$("#dvcustheaderParent").addClass("busnoshareimage"),$("#mobile-check").is(":visible")&&$("#dvcustheaderParent").addClass("multi-img-hide"),$("#topBannerSection").addClass("no-businessimg")):$("#dvcustheaderParent").removeClass("busnoshareimage")),$("#ancChangeLoc").attr("href",multiLocationWidgetURL)),"true"==isWidget&&1==_common.IsWidgetForServiceProvider(!0)&&($("#divbusinesslogoshape").addClass("logoround"),$("#divbusinesslogoshape").removeClass("logosqure"),null!=e&&null!=e.lstWidgetSpInfo&&null!=e.lstWidgetSpInfo.ServiceProviderPhoto&&""!=e.lstWidgetSpInfo.ServiceProviderPhoto?($("#dvBusinessImage").attr("data-original",e.lstWidgetSpInfo.ServiceProviderPhoto),$("#ComBusinessLogo").attr("src",e.lstWidgetSpInfo.ServiceProviderPhoto),$("#divbusinesslogo").show()):$("#divbusinesslogo").hide(),$("#busnamewidgetspname").css("display","block"),$("#busname").addClass("empbus")),isCallFromCheckInApp&&($("body").addClass("checkinappbody"),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).hide(),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).hide()),_shopdetail.renderbookdropdown(),_siteBuilderDetail.InjectMobileMenuForAbout(),$(".lazy-bgimg").lazyload({effect:"fadeIn"}).trigger("lazyload"),_shopdetail.StickHeader()},$(".mobile-share-social-model").click(function(e){$(".mobile-share-mid").is(":visible")&&(e.target.matches("div.mobile-share-popup")||e.target.matches("div.mobile-share-social-model.social-share-popup"))&&$(".mobile-share-social-model").fadeOut()}),$(".mobile-social-menu").click(function(){$(".mobile-share-social-model").fadeIn(),$("body").addClass("removescroll-bg"),$("#mobile-menu").removeClass("mobile_menu_open"),$("html, body").removeClass("overflowHidden mobile_menu_show"),$("#mobilemenutoggle").removeClass("active")}),_siteBuilderDetail.GetnavbarMenuSectionComponent=function(e){var t={},i=-1,a=$(e).hasClass("desk-thumb-menu");if(n=_siteBuilderDetail.templatePagesModal,0==_siteBuilderDetail.isNullUndefined(_siteBuilderDetail.UserLocationInfo.objDynamicMenuData)&&$.grep(n,function(e){e.IsNewCustomWebsite=IsNewCustomWebsite,$.grep(_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,function(t){e.page_id==t.menuID&&(e.isHide=!t.isVisible)})}),!_siteBuilderDetail.isNullUndefined(n))for(var r=0;r<n.length;r++){var o=n[r];o.isHide||(o.isHide=o.IsSystemTab),"$$#$centerlogo$#$$"==o.page_id&&(i=r)}if(a&&($(e).hasClass("center-logo")||$(e).hasClass("border-nav"))){i>-1&&n.splice(i,1);var n,s=2;s=(n=$.grep(n,function(e,t){return 0==e.isHide&&0==e.isShowHidePage})).length%2==1?(n.length+1)/2:n.length/2;n.splice(s,0,{page_id:"$$#$centerlogo$#$$",page_name:"mobile-hide",url_slug:null,parent_page_id:0,title_tag:"",meta_description:null,open_graph_images:null,components:"",isVagaroMenu:!1,isModifed:null,hasSubMenu:!1,isHide:!1})}(t={}).HeaderWithMenu=n,$("#dvMenuTemplate").tmpl(t).appendTo(e),_siteBuilderDetail.BindMenu(),_siteBuilderDetail.AddStateInCaseofLoadPage();var l=$(e).find("#dvShoppingCartIcon");"false"==_siteBuilderDetail.isRequestFromVagaro&&(l.is(":visible")?$(e).removeClass("no-cart-div"):$(e).addClass("no-cart-div")),1==_siteBuilderDetail.isCallFromPublicSide()&&(brandedAppCallBack(),_onlineCheckout.GetCartItemCount());var d=$(e).attr("data-config");if(!vagaroSiteBuilder.isNullUndefined(d)){var c=JSON.parse(d);$(e).find(".mobile-hide a img").css({width:c.logowidth,height:c.logoheight}).attr("src",c.businesslogo),$(e).find("div.logo-yield a img").css({width:c.logowidth,height:c.logoheight}).attr("src",c.businesslogo),$(e).find("a.nav-link").css({"font-size":c.fontsize})}var u=$(e).find(".mobile-hide a img");if(a&&u.is(":visible")){var p="78",h=(P=$(e).find("#tabs")).find("li.nav-item:visible").length;if(h>0)if(h%2>0){var m=$(".mobile-hide").prevAll(":visible"),f=$(".mobile-hide").nextAll(":visible"),g=0,v=0;$.each(m,function(e,t){var i=$(t);g+=i.outerWidth(!0)}),$.each(f,function(e,t){var i=$(t);v+=i.outerWidth(!0)}),p=g-v,P.find("li:last").after('<li class="nav-itm-spacer" style="width:'+p+'px" ></li>')}else P.find(".nav-itm-spacer").remove()}IsNewCustomWebsite&&"true"==_siteBuilderDetail.isRequestFromVagaro&&(_siteBuilderDetail.showLogin(),Webflow.ready()),$(e).removeClass("extra-toggle-nav");var A=0;$.each($(".nav-item:not(.dropdown-submenu)",".menu-links"),function(e,t){var i=$(t);"none"!==i.css("display")&&(A+=i.outerWidth(!0))});var C=0,y=$(e).find(".cart-block");y.is(":visible")&&(C=y.outerWidth(!0));var b=$(e).find("div.logo-yield a img"),S=0;b.is(":visible")&&(S=b.width());var k=0;u.is(":visible")&&(k+=u.width());var D=$(e).find(".book-now-multiple"),_=0;D.length>0&&(_=D.width());var I=A+C+S+k+_;if($(e).find(".menu-normal").width()<I){if($(e).addClass("extra-toggle-nav"),"true"==_siteBuilderDetail.isRequestFromVagaro&&IsNewCustomWebsite){if(!vagaroSiteBuilder.isNullUndefined(d))var w=JSON.parse(d);var P;(P=$(e).find("#tabs")).find("li:last").after('<li class="nav-item desk-log-link"><a class="nav-link loginlink" href="javascript:void(0)" onclick="fnLogout();" style="display: inline; font-size:'+w.fontsize+'">Log Out</a></li><li class="nav-item desk-log-link"><a class="nav-link lnkLogin" href="javascript:void(0);" onclick="showLogin("yes")" title="Login" style="display: none; font-size:'+w.fontsize+'"">Login</a><li>')}}else $(e).removeClass("extra-toggle-nav");IsNewCustomWebsite&&setTimeout(function(){$(".template-top-space").css("margin-top",$(".topmenufixed").height())},100)},_siteBuilderDetail.AddStateInCaseofLoadPage=function(){if(""!=pageBodyHtml||"false"==_siteBuilderDetail.isRequestFromVagaro){if(""!=tabSegment){var e=$("#mobile-check").is(":visible")&&tabSegment==DefaultTabPage?GetSelectedMenuObject(tabSegment):$("#"+tabSegment+":visible");e.length>0?(e.attr("data-addstate","false"),_siteBuilderDetail.PageLoadAddState(tabSegment),_siteBuilderDetail.ShowHideTab(e[0])):0!=e.length||$("#mobile-check").is(":visible")||"book-now"!=tabSegment&&"styles"!=tabSegment?0==e.length&&$("#mobile-check").is(":visible")&&_siteBuilderDetail.SetActiveForInvisibleControl():_siteBuilderDetail.SetActiveForInvisibleControl()}}else"true"==_siteBuilderDetail.isNewCustomTemplate&&_siteBuilderDetail.LoadComponentDetails("home")},_siteBuilderDetail.SetActiveForInvisibleControl=function(){if($("#"+tabSegment).length>0){if($("#"+tabSegment).parent().hasClass("active"))return;$(".menu-links .nav-item").removeClass("active"),$(".menu-links .nav-link").removeClass("active"),$("#"+tabSegment).parent().addClass("active"),$("#"+tabSegment).addClass("active")}},_siteBuilderDetail.imageVagaroError=function(){return _siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.DefaultShopImageForAllNew},_siteBuilderDetail.ShowHideTab=function(e,t){var i=$(e),a=($(".template-wrap"),$(".menu-links")),r=i.parent();if(!r.hasClass("active")){"false"==_siteBuilderDetail.isRequestFromVagaro&&window.top==window.parent&&parent._siteBuilder.updateActiveTabContentInPageArray(),$(".nav-item",a).removeClass("active"),$(".nav-link",a).removeClass("active").attr("aria-selected",!1),r.addClass("active"),r.closest("li.nav-item.dropdown").addClass("active"),i.addClass("active").attr("aria-selected",!0),"false"==_siteBuilderDetail.isRequestFromVagaro&&window.top==window.parent&&parent._siteBuilder.ShowHideTabLeftMenu();var o=e.innerText.split("(")[0].toLowerCase();if("true"==_siteBuilderDetail.isRequestFromVagaro&&_shopdetail.VisibleControlLength("#mobile-check")>0){var n=$("#navbarNavDropdown #"+i.attr("id"));n.length>0&&(n.parent().addClass("active"),n.addClass("active").attr("aria-selected",!0));var s=$("#mobiletabmenu #"+i.attr("id"));s.length>0&&(s.parent().addClass("active"),s.addClass("active").attr("aria-selected",!0))}_siteBuilderDetail.ShowHideAboutBookNow(o)}},_siteBuilderDetail.AddMultipleObject=function(e,t,i){e==_siteBuilderDetail.TemplateName.Service?(this.Services=t,this.BusinessDetail=i):e==_siteBuilderDetail.TemplateName.ServiceDetail&&(t.map(function(e){return e.ServiceTitleRemoveQuote=e.ServiceTitle.replace(/'/g,"\\'"),e.ServiceDescRemoveQuote=e.ServiceDesc.replace(/'/g,"\\'"),e}),this.ServiceList=t,this.BusinessDetail=i)},_siteBuilderDetail.SetClassBookData=function(e,t,i){_siteBuilderDetail.LoadComponentDetails("classes")},_siteBuilderDetail.setBookNowData=function(){_siteBuilderDetail.LoadComponentDetails("book-now")},_siteBuilderDetail.ShowHideMobileBack=function(){var e=!1;void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite||(void 0!==refUrl&&refUrl.length>0&&(refUrl.toLowerCase().indexOf("/listings/")>0||-1!=refUrl.toLowerCase().indexOf(window.location.href))&&tabSegment==DefaultTabPage&&(referrer="false",$("#mobile-check").is(":visible")&&(e=!0)),(flagBackButton=$("#mobile-check").is(":visible")&&("true"==referrer||null!=history.state)&&"home"!=tabSegment&&"/"!=tabSegment&&""!=tabSegment)&&($("#mobileBack").show(),$("#custmobileBack").hide()),e&&(e=!1,$("#mobileBack").show()))},_siteBuilderDetail.GetShoppingBagComponent=function(e){_onlineCheckout.LoadShoppingCartExternal()},_siteBuilderDetail.PassiveAlertMessage=function(e,t){var i=Webflow.require("ix"),a=$(".passive-alert-parent");e==_siteBuilderDetail.MessageType.Warning?($(".passive-alert-parent .passive-alert").removeClass("passive-fail"),$(".passive-alert-parent .passive-alert").addClass("passive-warn")):e==_siteBuilderDetail.MessageType.Fail?($(".passive-alert-parent .passive-alert").removeClass("passive-warn"),$(".passive-alert-parent .passive-alert").addClass("passive-fail")):$(".passive-alert-parent .passive-alert").removeClass("passive-warn passive-fail"),a.find(".passive-msg").html(t);var r={type:"click",selector:".passive-alert-parent",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 400ms ease 0",x:"0px",y:"129px",z:"0px"},{wait:"2s"},{transition:"transform 300ms ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};setTimeout(function(){i.run(r,a)},500)},_siteBuilderDetail.GetBusinessProductComponent=function(e){if(!IsNewCustomWebsite||_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData(e,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,"products")){var t=getCookie("InventoryId"),i=getCookie("InventoryMasterId");(void 0!==t&&!String.isNullOrUndefineOrBlank(t)||void 0!==i&&!String.isNullOrUndefineOrBlank(i))&&(ShowLoader(!0),$(".product-listing-stencil").hide(),$("#divInventoryContainer").hide(),$("#accordion").hide(),$(".div-share-button").hide(),$("#div-search").hide(),_shopdetail.isShareLink=!0),null!=_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches?($(e).html($("#dvProducthtmlTemplate").html()),_siteBuilderDetail.GetLoadBusinessProduct.componentnode=e,_siteBuilderDetail.GetLoadBusinessProduct.config.pageIndex=_siteBuilderDetail.ComponentResponse.lstProduct.pageIdxProduct,_siteBuilderDetail.GetLoadBusinessProduct.config.onRowLoad=_siteBuilderDetail.GetBusinessProductSuccess,_siteBuilderDetail.GetLoadBusinessProduct.loadContent()):(_siteBuilderDetail.GetLoadBusinessProduct.componentnode=e,_siteBuilderDetail.GetLoadBusinessProduct.init(),_siteBuilderDetail.GetLoadBusinessProduct.options.Data.businessID=_siteBuilderDetail.businessID,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.infoRequested=7,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.searchText="",_siteBuilderDetail.GetLoadBusinessProduct.options.Data.productTypeID="",_siteBuilderDetail.GetLoadBusinessProduct.options.Data.brandID="",_siteBuilderDetail.GetLoadBusinessProduct.options.Data.pageIndex=1,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.inventoryID=null,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.pageSize=12,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.cdnUrl=_shopdetail.CDNUrl,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.currencySymbol=_shopdetail.currencySymbol,_siteBuilderDetail.GetLoadBusinessProduct.options.onRowLoad=_siteBuilderDetail.GetBusinessProductSuccess,_siteBuilderDetail.GetLoadBusinessProduct.scroll(),_siteBuilderDetail.GetLoadBusinessProduct.enableScroll())}},_siteBuilderDetail.GetBusinessProductSuccess=function(e,t){DisplayFullView(!1),_common.isCreateLinkPreserve(!0,!0)&&(IsFromCreateLink=!1,clearCookie("UniqueCreateLink"));var i=$("#iframe1").contents().find("body"),a=!1;0!=$("#divProductContainer").length?(1!=e.config.pageIndex&&null!=_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches&&void 0!==_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories&&_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.length>0&&""==$("#divProductContainer").html()&&(a=!0),1!=e.config.pageIndex&&1!=a||($("#divProductContainer").html($("#"+e.config.templateName).html()),$("html body").addClass("addProductbody"))):i.find("div#divProductContainer").html($("#"+e.config.templateName).html()),!1===_siteBuilderDetail.isCallFromPublicSide()&&_common.DisableComponent(15,$("#divProductContainer")),_siteBuilderDetail.BindCategory(""),_siteBuilderDetail.BindBrands(),_siteBuilderDetail.BindOptions(),$("#divInventoryContainer").show(),$("#divNoRecordMobile").hide(),String.isNullOrUndefineOrBlank(t.Inventorys)||0==t.Inventorys.length?($("#mobile-check").is(":visible")?($("#divInventoryContainer").hide(),$("#divNoRecordMobile").show()):$("#divInventoryContainer").html('<div class="norecord">No results found. Please try another search.</div>'),_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=t.Inventorys,_siteBuilderDetail.ComponentResponse.lstProduct.pageIdxProduct=e.config.pageIndex):0!=$("#divInventoryContainer").length?1!=e.config.pageIndex&&1!=a||($("#dvInventoryTemplate").tmpl(t).appendTo("#divInventoryContainer"),ReplaceURL(!1)):($("#dvInventoryTemplate").tmpl(t).appendTo(i.find("div#divInventoryContainer")),ReplaceURL(!1)),0!=$(".product-img").length?$(".product-img").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"):i.find(".product-img").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),0==$(".book-dropdown").length&&i.find(".book-dropdown").click(function(){$(this).hasClass("active")?($(this).removeClass("active"),$(this).closest(".product-dropdown").find(".product-checkboxList").hide()):(i.find(".book-dropdown").removeClass("active"),$(this).addClass("active"),$(".product-checkboxList").hide(),$(this).closest(".product-dropdown").find(".product-checkboxList").show())}),""==_siteBuilderDetail.ComponentResponse.lstProduct.cacheBranID&&""==_siteBuilderDetail.ComponentResponse.lstProduct.cacheProductTypeID&&""==_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText||_siteBuilderDetail.SetFilterCachesForProductTab(),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("products"),_siteBuilderDetail.ProductDropDownEvent(),$("#txtAddtocartQuantity").applyupdown();var r=getCookie("InventoryId"),o=getCookie("InventoryMasterId");1==_shopdetail.isShareLink&&(ShowLoader(!1),$(".product-listing-stencil").hide(),$("#divInventoryContainer").hide(),$("#accordion").hide(),$("#div-search").hide(),String.isNullOrUndefineOrBlank(r)||String.isNullOrUndefineOrBlank(o)?String.isNullOrUndefineOrBlank(r)&&!String.isNullOrUndefineOrBlank(o)?(_siteBuilderDetail.ShowShoppingcartPopup("",o),clearCookie("InventoryMasterId")):!String.isNullOrUndefineOrBlank(r)&&String.isNullOrUndefineOrBlank(o)&&(_siteBuilderDetail.ShowShoppingcartPopup(r,""),clearCookie("InventoryId")):(_siteBuilderDetail.ShowShoppingcartPopup(r,o),clearCookie("InventoryId"),clearCookie("InventoryMasterId"))),_siteBuilderDetail.LoadInventorySearchDropDown()},_siteBuilderDetail.ProductBrandDropdown=function(e){$(e).hasClass("active")?($(e).removeClass("active"),$(e).closest(".product-dropdown").find(".product-checkboxList").hide()):($(".book-dropdown").removeClass("active"),$(e).addClass("active"),$(".product-checkboxList").hide(),$(e).closest(".product-dropdown").find(".product-checkboxList").show())},_siteBuilderDetail.ProductDropDownEvent=function(e,t){0!=$(".product-dropdown .product-checkboxList ul li").length?$(".product-dropdown .product-checkboxList ul li").click(function(){1==$(this).find('label input[type="checkbox"]').prop("checked")?$(this).addClass("selected"):$(this).removeClass("selected")}):$("#iframe1").contents().find("body").find(".product-dropdown .product-checkboxList ul li").click(function(){1==$(this).find('label input[type="checkbox"]').prop("checked")?$(this).addClass("selected"):$(this).removeClass("selected")})},_siteBuilderDetail.GetProductSearchedData=function(){productTypeCSV="",brandCSV="";var e="",t=[],i=[],a=[];if($($("#divProductTypeContainer").find("input[type=checkbox]:checked")).each(function(e){"0"!=$(this).val()&&i.push($(this).val())}),i.length>0&&(productTypeCSV=i.join(",")),$($("#divBrandContainer").find("input[type=checkbox]:checked")).each(function(e){"0"!=$(this).val()&&(a.push($(this).val()),t.push($(this).attr("data-BrandName")))}),a.length>0&&(brandCSV=a.join(","),e=t.join(",")),""==e)$($("#ddlBrand").find("span.placeholder")).html("Select Brand"),1==$("#chkBrandAll").prop("checked")&&($("#chkBrandAll").prop("checked",!1),$(".clsBrandAll").removeClass("selected"));else{var r=$("#divBrandContainer li").length-2,o=$("#divBrandContainer").find("input[type=checkbox]:checked").length;1==$("#chkBrandAll").prop("checked")&&(o-=1),r==o?($($("#ddlBrand").find("span.placeholder")).html("All selected"),$("#chkBrandAll").prop("checked",!0),$(".clsBrandAll").addClass("selected"),$(".clsChkBrand").attr("checked","checked"),$(".clsBrand").addClass("selected")):($("#chkBrandAll").prop("checked",!1),$(".clsBrandAll").removeClass("selected"),o>=4?$($("#ddlBrand").find("span.placeholder")).html(o+" of "+r+" selected"):$($("#ddlBrand").find("span.placeholder")).html(e))}_siteBuilderDetail.LoadProductData($("#txtSearchText").val(),productTypeCSV,brandCSV,1,1)},_siteBuilderDetail.LoadProductData=function(e,t,i,a,r){var o={searchText:e,productType:t,brand:i};1==r?(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText=e,_siteBuilderDetail.ComponentResponse.lstProduct.cacheProductTypeID=t,_siteBuilderDetail.ComponentResponse.lstProduct.cacheBranID=i):_siteBuilderDetail.ComponentResponse.lstProduct={resProdCaches:null,cacheSearchText:e,cacheProductTypeID:t,cacheBranID:i,pageIdxProduct:null},ShowLoader(!0),_siteBuilderDetail.loadProducts(o,r)},_siteBuilderDetail.LoadInventoryData=function(){var e="";_siteBuilderDetail.breadCrumbs.length>0&&(e=_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.filter(e=>e.id===_siteBuilderDetail.breadCrumbs.sort((e,t)=>t.sequence-e.sequence)[0].parentId)[0].productTypeID);var t={searchText:null==_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText?"":_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText,brandIds:_siteBuilderDetail.selectedBrands.map(e=>e.Id).join(","),productTypeIds:e,options:_siteBuilderDetail.selectedOptions.length>0?_siteBuilderDetail.CreateOptionJson(_siteBuilderDetail.selectedOptions):""};$("#divProductPreviewpageOnline").hide(),$("#divProductListSection").show(),$("html body").addClass("addProductbody"),$("#mobile-check").is(":visible")||$("html body").addClass("addProductbody"),$("#mobile-check").is(":visible")&&$("#divProductHeaderMobile").show(),ShowLoader(!0),_siteBuilderDetail.GetLoadBusinessProduct.config.EnablePagescroll=!0,_siteBuilderDetail.GetLoadBusinessProduct.options.EnablePagescroll=!0,_siteBuilderDetail.loadProducts(t)},_siteBuilderDetail.GetLoadBusinessProduct=new PaginationBuilder("","",{Token:ApiURLEnumCommonApi.getshoppingcartcomposite,Data:{},LocalData:{},checkTab:!0,IsAjaxQue:!0,PageSize:12,EnablePagescroll:!0,ScrollTarget:ScrollTarget,initialpageData:_siteBuilderDetail.initialProductpageData,templateName:"dvProductTemplate",pageName:"home",lazyLoadClass:"lazypager",htmltemplatename:"dvProducthtmlTemplate"}),_siteBuilderDetail.loadProducts=function(e,t){_siteBuilderDetail.GetLoadBusinessProduct.componentnode="",_siteBuilderDetail.GetLoadBusinessProduct.init(),_siteBuilderDetail.GetLoadBusinessProduct.options.Data.businessID=_siteBuilderDetail.businessID,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.searchText=e.searchText,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.productTypeIds=e.productTypeIds,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.brandIds=e.brandIds,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.options=e.options,_siteBuilderDetail.GetLoadBusinessProduct.options.onRowLoad=_siteBuilderDetail.GetLoadBusinessProductFilterSuccess,_siteBuilderDetail.GetLoadBusinessProduct.scroll(),_siteBuilderDetail.GetLoadBusinessProduct.enableScroll()},_siteBuilderDetail.GetLoadBusinessProductFilterSuccess=function(e,t){_siteBuilderDetail.productDetailImageIndex=-1,$("html body").removeClass("isDetailPageClass"),null==t.Inventorys||1!=t.Inventorys.length||String.isNullOrUndefineOrBlank($("#txtSearchText").val())?(ShowLoader(!1),$("#divProductPreviewpageOnline").hide(),$("#divProductListSection").show(),$("#divInventoryContainer").show(),$("#divNoRecordMobile").hide(),0==t.Inventorys.length?($("#mobile-check").is(":visible")?($("#divInventoryContainer").hide(),$("#divNoRecordMobile").show()):$("#divInventoryContainer").html('<div class="norecord">No results found. Please try another search.</div>'),7==e.options.Data.infoRequested?_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches=t:_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=t.Inventorys,_siteBuilderDetail.ComponentResponse.lstProduct.pageIdxProduct=e.config.pageIndex):1==e.config.pageIndex&&$("#divInventoryContainer").html($("#dvInventoryTemplate").tmpl(t)),$(".product-img").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),_siteBuilderDetail.BindFilterTabs(),ReplaceURL(!1)):_siteBuilderDetail.ShowShoppingcartPopup(t.Inventorys[0].inventoryId,t.Inventorys[0].inventoryMasterId)},_siteBuilderDetail.LoadInventorySearchDropDown=function(){var e=0,t="",i=$("#txtSearchText").select2({searchInputPlaceholder:"Search",minimumInputLength:3,maximumInputLength:100,combobox:!0,formContainer:"#page-wrapper",dropdownCssClass:"'top-dropdown'",selectOnClick:_siteBuilderDetail.NotmobileorIphone,formatInputTooShort:!1,ajax:{url:location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/WebServices/CommonWebService.asmx/CustomerSearchInventory",dataType:"json",delay:5,quietMillis:250,data:function(e,i){return{search:(t=e||"").trim(),pageindex:i||1,pagesize:10,businessId:_siteBuilderDetail.businessID,groupId:_siteBuilderDetail.SQLGroupID}},results:function(t,i){if($(".search-cancel-icon").show(),$("#svgCloseIcon").show(),null!=t&&t.results.length>0){i=i||1;e=null==t?null:t.total_count;var a=Math.ceil(e/10);displayItems=10*i,i==a&&(displayItems=e);var r=!1;return displayItems<e&&(r=!0),{results:t.results,more:r}}return{results:[]}},cache:!1},formatResult:function(e){var i=e.text;if(t){var a=new RegExp("("+t.trim().replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+")","gi");i=i.replace(a,"<b>$1</b>")}return"<div>"+i+"</div>"},formatNoMatches:function(){return $("#select2-drop").css("display","block"),"No matches found"},formatSelection:function(e){return e.text},sortResults:function(e,t,i){return e},formatPager:function(t){return t>1?(displayItems+=5,displayItems>e?(displayItems-=5,"Items 1 - "+displayItems+" out of "+e):"Items 1 - "+displayItems+" out of "+e):"Items 1 - "+displayItems+" out of "+e}});i.on("selected",function(e){if($("#divProductPreviewpageOnline").is(":visible")&&(_siteBuilderDetail.breadCrumbs=[],$("#swiperSyncMainBody .hasVideoSync1").length>0)){var t=document.getElementById("videoPlayer");String.isNullOrUndefineOrBlank(t)||t.pause()}$(".inventory-product-header").is(":visible")&&($("#divMobileSearch").hide(),$("#txtSearchText").trigger("keyup"),$("#txtSearchText").trigger("focusout")),_siteBuilderDetail.GetProductSearchedData()}),i.on("select2-open",function(e){$("#select2-drop ul.select2-results").parent().addClass("productstab_searchbox")})},_siteBuilderDetail.GetLoadBusinessProductBrandFilterSuccess=function(e,t){ShowLoader(!1),$("#divBrandContainer").html($("#dvBrandTemplate").tmpl(t)),$("#divInventoryContainer").show(),$("#divNoRecordMobile").hide(),0==t.Inventorys.length?($("#mobile-check").is(":visible")?($("#divInventoryContainer").hide(),$("#divNoRecordMobile").show()):$("#divInventoryContainer").html('<div class="norecord">No results found. Please try another search.</div>'),7==e.options.Data.infoRequested?_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches=t:_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=t.Inventorys,_siteBuilderDetail.ComponentResponse.lstProduct.pageIdxProduct=e.config.pageIndex):1==e.config.pageIndex&&$("#divInventoryContainer").html($("#dvInventoryTemplate").tmpl(t)),$(".product-img").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),_siteBuilderDetail.ProductDropDownEvent()},_siteBuilderDetail.ProductTypeChange=function(){productTypeCSV="";var e=[],t=[],i="";if($($("#divProductTypeContainer").find("input[type=checkbox]:checked")).each(function(i){"0"!=$(this).val()&&(e.push($(this).val()),t.push($(this).attr("data-producttypename")))}),e.length>0&&(productTypeCSV=e.join(","),i=t.join(",")),""==i)$($("#ddlProductType").find("span.placeholder")).html("Select Product Type"),1==$("#chkProductTypeAll").prop("checked")&&($("#chkProductTypeAll").prop("checked",!1),$(".clsProductTypeAll").removeClass("selected"));else{var a=$("#divProductTypeContainer li").length-2,r=$("#divProductTypeContainer").find("input[type=checkbox]:checked").length;1==$("#chkProductTypeAll").prop("checked")&&(r-=1),a==r?($($("#ddlProductType").find("span.placeholder")).html("All selected"),$($("#ddlBrand").find("span.placeholder")).html("Select Brand"),$("#chkProductTypeAll").prop("checked",!0),$(".clsProductTypeAll").addClass("selected"),$(".clsChkProductType").attr("checked","checked"),$(".clsProductType").addClass("selected")):($($("#ddlBrand").find("span.placeholder")).html("Select Brand"),$("#chkProductTypeAll").prop("checked",!1),$(".clsProductTypeAll").removeClass("selected"),r>=4?$($("#ddlProductType").find("span.placeholder")).html(r+" of "+a+" selected"):$($("#ddlProductType").find("span.placeholder")).html(i))}_siteBuilderDetail.LoadProductData($("#txtSearchText").val(),productTypeCSV,"",1,0)},_siteBuilderDetail.BrandChange=function(){_siteBuilderDetail.GetProductSearchedData()},_siteBuilderDetail.OnSearchProduct=function(e){if(13==e.keyCode)return _siteBuilderDetail.LoadInventoryData(),!1},_siteBuilderDetail.SetFilterCachesForProductTab=function(){var e=_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText,t=_siteBuilderDetail.ComponentResponse.lstProduct.cacheProductTypeID,i=_siteBuilderDetail.ComponentResponse.lstProduct.cacheBranID;if(null!=e&&$("#txtSearchText").val(e),void 0!==t&&null!=t&&""!=t){var a=[],r=$("#divProductTypeContainer li").length-2;t.split(",").forEach(function(e){var t=$(".clsChkProductType[value="+e+"]");t.length>0&&(t.closest("li").addClass("selected"),t.prop("checked",!0),a.push(t.attr("data-producttypename")))}),a.length>0&&(a.length>=4?a.length==r?($("#chkProductTypeAll").closest("li").addClass("selected"),$("#chkProductTypeAll").prop("checked",!0),$(".clsChkProductType").prop("checked",!0),$($("#ddlProductType").find("span.placeholder")).html("All selected")):$($("#ddlProductType").find("span.placeholder")).html(a.length+" of "+r+" selected"):$($("#ddlProductType").find("span.placeholder")).html(a.join(",")))}if(void 0!==i&&null!=i&&""!=i){var o=[];r=$("#divBrandContainer li").length-2;i.split(",").forEach(function(e){var t=$(".clsChkBrand[value="+e+"]");t.length>0&&(t.closest("li").addClass("selected"),t.prop("checked",!0),o.push(t.attr("data-brandname")))}),o.length>=4?o.length==r?($("#chkBrandAll").closest("li").addClass("selected"),$("#chkBrandAll").prop("checked",!0),$(".clsChkBrand").prop("checked",!0),$($("#ddlBrand").find("span.placeholder")).html("All selected")):$($("#ddlBrand").find("span.placeholder")).html(o.length+" of "+r+" selected"):$($("#ddlBrand").find("span.placeholder")).html(o.join(","))}},_siteBuilderDetail.OnSearcProducthKeyBlur=function(e){_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText=$(e).val().trim()},_siteBuilderDetail.OnSearcProducthKeyUp=function(e){$("#svgCloseIcon").hide(),""!=$(e).val().trim()&&$("#svgCloseIcon").show(),""==_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText&&""==$(e).val().trim()||_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText==$(e).val().trim()||($("#divProductPreviewpageOnline").is(":visible")&&(_siteBuilderDetail.breadCrumbs=[],$("#breadcrumbslist").html("")),_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText=$(e).val().trim(),(_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText.length>2||""==_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText)&&(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData()))},_siteBuilderDetail.ProductTypeSelectAll=function(){1==$("#chkProductTypeAll").prop("checked")?($(".clsChkProductType").attr("checked","checked"),$(".clsProductType").addClass("selected"),$(".clsChkProductType").prop("checked",!0)):($(".clsChkProductType").removeAttr("checked","checked"),$(".clsProductType").removeClass("selected")),_siteBuilderDetail.ProductTypeChange()},_siteBuilderDetail.BrandSelectAll=function(){$("#chkBrandAll").is(":checked")?($(".clsChkBrand").attr("checked","checked"),$(".clsBrand").addClass("selected"),$(".clsChkBrand").prop("checked",!0)):($(".clsChkBrand").removeAttr("checked","checked"),$(".clsBrand").removeClass("selected")),_siteBuilderDetail.GetProductSearchedData()},_siteBuilderDetail.ShowShoppingcartPopup=function(e,t){if("false"==$("#hdnSiteBuilderIsRequestFromVagaro").val())return!1;$("#divProductHeaderMobile").hide(),$(".MainProductImage").html(""),$(".thumbproductimage").html(""),$(".description").html(""),ShowLoader(!0);var i={MerchantId:""};"undefined"!=typeof staticEncryptBusinessID&&null!=staticEncryptBusinessID&&(i.MerchantId=staticEncryptBusinessID);var a=V2APIURLEnum.GetCustomersProductDetail,r=null;String.isNullOrUndefineOrBlank(t)?String.isNullOrUndefineOrBlank(e)||(r={InventoryId:e}):r={InventoryMasterId:t},_siteBuilderDetail.GetLoadBusinessProduct.config.EnablePagescroll=!1,_siteBuilderDetail.GetLoadBusinessProduct.options.EnablePagescroll=!1,vagaro.ajaxCallV2(a,{},null,r,function(t){_siteBuilderDetail.GetCustomersProductDetail_Success(t,e)},_siteBuilderDetail.CommonError,!1,!1,i,!0)},_siteBuilderDetail.GetCustomersProductDetail_Success=function(e,t){if(ShowLoader(!1),e.status==vagaro.VagaroCoreApiStatusCode.OK&&e.responseCode==vagaro.VagaroCoreApiResponseCode.Success&&null!=e.data){var i="./products";if("undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&(isFromTextMarketing&&window.location.pathname.indexOf("/promotiontm/")>0||!isFromTextMarketing&&window.location.pathname.indexOf("/promotion/")>0)&&window.location.pathname.indexOf(PromotionAppointmentID)>0&&(i=PromotionAppointmentID),window.history.pushState("forward",null,i),$("#mobileBack").data("backtabname","products"),_siteBuilderDetail.customersProductDetailsCache=e.data,$("#txtVariantQty").val("1"),$("#divproductbutton").removeClass("div-disable"),String.isNullOrUndefineOrBlank(e.data.inventory))_siteBuilderDetail.CommonError();else{if($("html").scrollTop(0),_siteBuilderDetail.variantForCheckout=null,_siteBuilderDetail.ShowHideProductDetail(!0),$(".span-product-title").text(e.data.inventory.productName),$(".span-product-cat").text(e.data.inventory.brand),$("#spanProductDesc").text(e.data.inventory.description),_siteBuilderDetail.BindBreadCrumbsforProductDetail(e.data.categorys),$("#divProductOptions").html("").hide(),!String.isNullOrUndefineOrBlank(e.data.inventoryOptions)&&2!==e.data.type){var a=e.data.inventoryOptions.sort((e,t)=>e.inventoryMasterName===t.inventoryMasterName?e.sortOrderId-t.sortOrderId:e.inventoryMasterName.localeCompare(t.inventoryMasterName));if($("#divProductOptions").show(),$("#srpt-productOptions").tmpl(a).appendTo($("#divProductOptions")),2===e.data.type||String.isNullOrUndefineOrBlank(t)||String.isNullOrUndefineOrBlank(e.data.variants)||String.isNullOrUndefineOrBlank(e.data.inventoryOptions))_siteBuilderDetail.variantForCheckout=_siteBuilderDetail.DisableorHideOptions(e.data.inventoryOptions,null)[0],String.isNullOrUndefineOrBlank(_siteBuilderDetail.variantForCheckout)&&(_siteBuilderDetail.variantForCheckout=[]),_siteBuilderDetail.variantForCheckout.createLink=e.data.createLink;else{var r=e.data.variants.filter(e=>e.inventoryId==t)[0];!String.isNullOrUndefineOrBlank(r.combination)&&r.combination.length>0&&(r.combination.forEach(t=>{var i=e.data.inventoryOptions.filter(e=>e.vanriants.some(e=>e.id===t.businessOptionVariantId));if(!String.isNullOrUndefineOrBlank(i)){var a={};a.IndexNo=i[0].indexNo,a.OptionOrderId=i[0].sortOrderId,a.VariantId=t.businessOptionVariantId,a.parentIndexNo=1,_siteBuilderDetail.selectedVariant.push(a)}}),_siteBuilderDetail.selectedVariant.forEach(e=>{_siteBuilderDetail.EnableDisableOptions(e.VariantId,e.OptionOrderId,e.IndexNo,e.parentIndexNo,!0)}))}}if(2!==e.data.type||String.isNullOrUndefineOrBlank(e.data.bundleInventoryOptions)||($("#divProductOptions").show(),$("#srpt-bundleMasterProduct").tmpl(e.data.bundleInventoryOptions).appendTo($("#divProductOptions")),_siteBuilderDetail.variantForCheckout=e.data.inventory,_siteBuilderDetail.variantForCheckout.createLink=e.data.createLink,_siteBuilderDetail.variantForCheckout.BundleProduct=_siteBuilderDetail.DisableorHideOptions(null,e.data.bundleInventoryOptions),_siteBuilderDetail.variantForCheckout.BundleProduct=_siteBuilderDetail.variantForCheckout.BundleProduct.concat(e.data.bundleProductWithoutVariants),_siteBuilderDetail.customersProductDetailsCache.bundleInventoryOptions.length+_siteBuilderDetail.customersProductDetailsCache.bundleProductWithoutVariants.length!=_siteBuilderDetail.variantForCheckout.BundleProduct.length&&(_siteBuilderDetail.variantForCheckout=null)),1===e.data.type&&String.isNullOrUndefineOrBlank(e.data.inventoryOptions)&&(_siteBuilderDetail.variantForCheckout=e.data.inventory,_siteBuilderDetail.variantForCheckout.createLink=e.data.createLink),$("#divBundleProduct").html("").hide(),String.isNullOrUndefineOrBlank(e.data.bundleProductWithoutVariants)||($("#divBundleProduct").html("").show(),$("#srpt-bundleProduct").tmpl(e.data.bundleProductWithoutVariants).appendTo($("#divBundleProduct"))),$.each(e.data.additionalDetails,function(e,t){t.srNumber=e+1}),$("#accordionAdditionalDetails").html("").hide(),!String.isNullOrUndefineOrBlank(e.data.additionalDetails)){$("#accordionAdditionalDetails").show(),$("#srpt-accordionAdditionalDetails").tmpl(e.data.additionalDetails.sort((e,t)=>e.sortOrderId-t.sortOrderId)).appendTo($("#accordionAdditionalDetails"));const t=document.querySelectorAll(".additionaldetailsdesc .accordion-item .accordion-body a");t&&t.forEach(e=>{e.setAttribute("target","_blank")})}if(!String.isNullOrUndefineOrBlank(e.data.inventory.inventoryId)&&String.isNullOrUndefineOrBlank(e.data.inventory.inventoryMasterId)&&2==e.data.type&&String.isNullOrUndefineOrBlank(e.data.bundleInventoryOptions)&&(_siteBuilderDetail.variantForCheckout=e.data.inventory,_siteBuilderDetail.variantForCheckout.createLink=e.data.createLink,_siteBuilderDetail.variantForCheckout.BundleProduct=e.data.bundleProductWithoutVariants),null!=_siteBuilderDetail.variantForCheckout)_siteBuilderDetail.SetDataonVariantSelection();else if($("#divproductbutton").addClass("div-disable"),!String.isNullOrUndefineOrBlank(e.data.images)){var o;o=e.data.images.filter(e=>""===e.inventoryId),_siteBuilderDetail.BindSliderImages(o)}}}else _siteBuilderDetail.alertsmall({message:"The product you are looking for is either out of stock or does not exists.",title:"Info",callback:function(){_siteBuilderDetail.BreadCrumbsChange("",0)}})},_siteBuilderDetail.SetDataonVariantSelection=function(){var e=parseFloat(_siteBuilderDetail.variantForCheckout.sellingPriceWithTax).format("#.##");if($("#hdnSellingprice").val(_siteBuilderDetail.variantForCheckout.sellingPrice),$("#hdninvetorytaxes").val(_siteBuilderDetail.variantForCheckout.taxes),$("#hdnIsIncludeTaxInOnlinePricing").val(_shopdetail.IsIncludeTaxInOnlinePricing),$("#hdnpricewithtax").val(_siteBuilderDetail.variantForCheckout.sellingPriceWithTax),$("#hdnTotalQty").val(_siteBuilderDetail.variantForCheckout.quantity),$("#txtAddtocartQuantity").attr("max",1==_siteBuilderDetail.variantForCheckout.isTrackInventory?_siteBuilderDetail.variantForCheckout.quantity:9999),$("#hdnIsTrackInventory").val(_siteBuilderDetail.variantForCheckout.isTrackInventory),$("#hdnPType").val(_siteBuilderDetail.variantForCheckout.type),$("#hdnVPLStatus").val(_siteBuilderDetail.variantForCheckout.vplStatus),$("#btnAddtoCart").removeAttr("onclick"),$("#btnAddtoCart").attr("onclick","javascript:return _siteBuilderDetail.AddInventoryToCart('"+_siteBuilderDetail.variantForCheckout.inventoryId+"',"+_siteBuilderDetail.variantForCheckout.quantity+")"),$("#btnAddtoCartMobile").removeAttr("onclick"),$("#btnAddtoCartMobile").attr("onclick","javascript:return _siteBuilderDetail.AddInventoryToCart('"+_siteBuilderDetail.variantForCheckout.inventoryId+"',"+_siteBuilderDetail.variantForCheckout.quantity+")"),$("#divProductPreviewpageOnline").is(":visible")||$("html body").removeClass("isDetailPageClass"),_siteBuilderDetail.GCVPLText(e,4),_siteBuilderDetail.VariantPriceUpdate(),!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.images)){var t=[];t=_siteBuilderDetail.customersProductDetailsCache.images.filter(e=>""===e.inventoryId);var i=_siteBuilderDetail.customersProductDetailsCache.images.filter(e=>e.inventoryId===_siteBuilderDetail.variantForCheckout.inventoryId);!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.images)&&i.length>0&&(t=i),_siteBuilderDetail.BindSliderImages(t)}ReplaceURL(!0)},_siteBuilderDetail.BindSliderImages=function(e){$("#swiperSyncMainBody").html(""),$("#swiperSyncThumbBody").html(""),$("#swiperSyncLargeBody").html(""),String.isNullOrUndefineOrBlank(e)||($("#srpt-productDetailImages").tmpl(e.sort((e,t)=>e.imageOrder-t.imageOrder)).appendTo($("#swiperSyncMainBody")),$("#srpt-productImages-thumbnail").tmpl(e.sort((e,t)=>e.imageOrder-t.imageOrder)).appendTo($("#swiperSyncThumbBody")),$("#srpt-SelectedProductImageZoom").tmpl(e.sort((e,t)=>e.imageOrder-t.imageOrder)).appendTo($("#swiperSyncLargeBody")),_siteBuilderDetail.ProductDetailImageSlider(!0),$("#swiperSyncThumbBody .swiper-slide").find("[data-isdefault='true']").click())},_siteBuilderDetail.ShowShoppingcartPopup_Success=function(e){if(null!=e&&null!=e.PopupDetail){var t=e.PopupDetail;if(t.length>0){$("#ulBundleDetails",r).html(""),2==t[0].Type&&(Data={},Data.businessID=_siteBuilderDetail.businessID,Data.InventoryIDs=t[0].InventoryID,vagaro.ajaxCall(ApiURLEnumCommonApi.getinventorybundledetailsbyinventoryid,Data,_siteBuilderDetail.GetInventoryBundleDetails_Success,_siteBuilderDetail.CommonError,!1,!0));var a=(parseFloat(t[0].PriceWithTax)*(isNaN(parseFloat(t[0].Quantity))?0:parseFloat(t[0].Quantity))).format("#.##"),r=$("#shoppingcartpopup").eq(0);$(".clssalonname",r).html(""),$(".clsproductname",r).html(t[0].Name.escapeHtml()),$("#priceRow",r).text(_shopdetail.currencySymbol+(t[0].PriceWithTax*t[0].Quantity).format("#.##")),$("#hdnSellingprice",r).val(t[0].SellingPrice),$("#hdninvetorytaxes",r).val(t[0].Taxes),$("#hdnIsIncludeTaxInOnlinePricing",r).val(t[0].IsIncludeTaxInOnlinePricing),$("#hdnpricewithtax",r).val(t[0].PriceWithTax),$("#hdnTotalQty",r).val(t[0].TotalQty),$(".description",r).html("<p>"+t[0].Description.escapeHtml()+"</p>"),$("#btnAddtoCart",r).attr("onclick","javascript:return _siteBuilderDetail.AddItemToCart("+t[0].InventoryID+","+t[0].TotalQty+")"),$("#aPinit",r).attr("onclick","_siteBuilderSocialMedia.OpenPin()"),$("#txtAddtocartQuantity",r).attr("max",1==t[0].IsTrackInventory?t[0].TotalQty:9999),$("#txtAddtocartQuantity",r).val(t[0].Quantity),$("#lblProductType",r).html(t[0].ProductTypeName.escapeHtml()),$("#lblBrandName",r).html(1==t[0].Type?t[0].BrandName.escapeHtml():""),$("#hdnIsTrackInventory",r).val(t[0].IsTrackInventory),$("#hdnPType",r).val(t[0].Type),$("#hdnVPLStatus",r).val(t[0].VPLStatus),_siteBuilderDetail.GCVPLText(a,4),null!==t[0].ImagePath&&$("#hdndefaultimg").val(t[0].ImagePath),$("#txtAddtocartQuantity").val(parseInt(t[0].Quantity));var o="",n=(_shopdetail.CDNUrl,[]),s=[],l=[];for(null!=t[0].ImagePath&&(o=t[0].ImagePath,n.push(o)),null!==t[0].ImageUrl1&&o!=t[0].ImageUrl1&&n.push(t[0].ImageUrl1),null!==t[0].ImageUrl2&&o!=t[0].ImageUrl2&&n.push(t[0].ImageUrl2),null!==t[0].ImageUrl3&&o!=t[0].ImageUrl3&&n.push(t[0].ImageUrl3),null!==t[0].ImageUrl4&&o!=t[0].ImageUrl4&&n.push(t[0].ImageUrl4),i=0;i<n.length;i++)l.push("<div class='aesop-popup-image lazyload'  data-original='"+n[i]+"'></div>"),s.push("<a href='javascript:void(0);' role='link' aria-label='Product Image' onclick='_siteBuilderDetail.ProductslickGoTo("+i+");'><div id='thumbs0"+(i+1)+"' class='thumbnail-image w-inline-block' data-original='"+n[i]+"'></div></a>");$("#carouselgallery1").html(l.join("")),$("#thumbsnew1").html(s.join("")),$(".aesop-popup-image").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),$(".thumbnail-image").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),_siteBuilderDetail.ProductImagegallary(),_siteBuilderDetail.currencySymbol=_shopdetail.currencySymbol,_siteBuilderDetail.PriceUpdate(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#divShoppingcartpopup #divProductSharing").hide(),_siteBuilderDetail.ShowProductDetailSection()}}},_siteBuilderDetail.GetInventoryBundleDetails_Success=function(e){if(e.length>0){for(var t="",i=0;i<e.length;i++)t+="<li class='bundle-product web-body-font'>"+e[i].Name+(e[i].BundleQty>1?" x "+e[i].BundleQty+" Qty":"")+"</li>";var a=$("#shoppingcartpopup").eq(0);$("#ulBundleDetails",a).html(t)}},_siteBuilderDetail.ProductslickGoTo=function(e){$("#carouselgallery1").slickGoTo(e)},_siteBuilderDetail.CloseShoppingcartPopup=function(){$("#divShoppingcartpopup").modal("hide")},_siteBuilderDetail.ProductImagegallary=function(){"object"==typeof $("#carouselgallery1").getSlick()&&$("#carouselgallery1").unslick(),$("#carouselgallery1").slick({slidesToShow:1,slidesToScroll:1,arrows:!0,dots:!1,infinite:!1})},_siteBuilderDetail.VariantPriceUpdate=function(){var e=$("#txtVariantQty"),t=e.val();try{/\D/g.test(t)&&(t=1,e.val("1"))}catch(t){e.val("1")}var i=$("#hdnPType").val();if(2==parseInt(i)){var a=0,r=0;String.isNullOrUndefineOrBlank(_siteBuilderDetail.variantForCheckout.BundleProduct)||(a=_siteBuilderDetail.variantForCheckout.BundleProduct.reduce((e,t)=>e+t.sellingPrice,0),r=_siteBuilderDetail.variantForCheckout.BundleProduct.reduce((e,t)=>e+t.sellingPriceWithTax,0)),$("#hdnSellingprice").val(a),$("#hdnpricewithtax").val(r);const e=Object.values(_siteBuilderDetail.variantForCheckout.BundleProduct.reduce((e,t)=>{let i=t.combination&&t.combination.length>0?1:t.bundleQty;return e[t.inventoryId]?e[t.inventoryId].qty+=i:e[t.inventoryId]={inventoryId:t.inventoryId,qty:i,actualQty:t.quantity},e},{})).reduce((e,t)=>{let i=Math.trunc(t.actualQty/t.qty);return i<e?i:e},1/0);$("#hdnTotalQty").val(isNaN(e)?0:parseInt(e))}var o=$("#hdnSellingprice").val(),n=$("#hdnpricewithtax").val(),s=(_siteBuilderDetail.currencySymbol,$("#hdnTotalQty").val()),l=$("#hdnIsTrackInventory").val();if($(".span-product-currency").text(_siteBuilderDetail.currencySymbol),"Out of Stock"!=$("h4").text()){if(void 0!==o&&void 0!==t&&("true"==$("#hdnIsIncludeTaxInOnlinePricing").val()?(n=String.isNullOrUndefineOrBlank(n)?"0":n,$(".span-product-price").text((parseFloat(n)*parseFloat(1)).format("#.##"))):(o=String.isNullOrUndefineOrBlank(o)?"0":o,$(".span-product-price").text((parseFloat(o)*parseFloat(1)).format("#.##")))),"true"==l&&parseInt(t)>parseInt(s))return _siteBuilderDetail.alertsmall({message:"This product is out of stock based on the quantity you have selected.",title:"Out of Stock",callback:function(){setTimeout(function(){$("#txtVariantQty").focus()},100),t=s,e.val(t)}}),!1;if("undefined"!=$("#hdnVPLStatus").val()&&null!=$("#hdnVPLStatus").val()){var d="true"==$("#hdnIsIncludeTaxInOnlinePricing").val()?n:o,c=(parseFloat(d)*parseFloat(1)).format("#.##");_siteBuilderDetail.GCVPLText(c,4)}}},_siteBuilderDetail.PriceUpdate=function(){var e=$("#txtAddtocartQuantity"),t=e.val();try{/\D/g.test(t)&&(t=1,e.val("1"))}catch(t){e.val("1")}var i=$("#hdnSellingprice").val(),a=_siteBuilderDetail.currencySymbol,r=$("#hdnTotalQty").val(),o=$("#hdnIsTrackInventory").val();$("#hdnPType").val();if("Out of Stock"!=$("h4").text()&&("true"==o&&parseInt(t)>parseInt(r)?_siteBuilderDetail.alertsmall({message:"This product is out of stock based on the quantity you have selected.",title:"Out of Stock",callback:function(){setTimeout(function(){$("#txtAddtocartQuantity").focus()},100),t=r,e.val(t),void 0!==i&&("true"==$("#hdnIsIncludeTaxInOnlinePricing").val()?$("#priceRow").text(a+(parseFloat($("#hdnpricewithtax").val())*(isNaN(parseFloat(t))?0:parseFloat(t))).format("#.##")):$("#priceRow").text(a+(parseFloat(i)*(isNaN(parseFloat(t))?0:parseFloat(t))).format("#.##")))}}):null!=i&&null!=t&&("true"==$("#hdnIsIncludeTaxInOnlinePricing").val()?$("#priceRow").text(a+(parseFloat($("#hdnpricewithtax").val())*(isNaN(parseFloat(t))?0:parseFloat(t))).format("#.##")):$("#priceRow").text(a+(parseFloat(i)*(isNaN(parseFloat(t))?0:parseFloat(t))).format("#.##"))),"undefined"!=$("#hdnVPLStatus").val()&&null!=$("#hdnVPLStatus").val())){var n="true"==$("#hdnIsIncludeTaxInOnlinePricing").val()?$("#hdnpricewithtax").val():i,s=(parseFloat(n)*(isNaN(parseFloat(t))?0:parseFloat(t))).format("#.##");_siteBuilderDetail.GCVPLText(s,4)}},_siteBuilderDetail.itemQtyDown=function(e){var t=$(e),i=t.closest(".item-quantitychange").find(".itemqtyinput").val();if(i>=2){var a=parseInt(i)-1;t.closest(".item-quantitychange").find(".itemqtyinput").val(a)}_siteBuilderDetail.PriceUpdate()},_siteBuilderDetail.itemQtyUp=function(e){var t=$(e),i=t.closest(".item-quantitychange").find(".itemqtyinput").val();if(i<999){var a=parseInt(i)+1;t.closest(".item-quantitychange").find(".itemqtyinput").val(a)}_siteBuilderDetail.PriceUpdate()},_siteBuilderDetail.onKeyPressBlockNumbers=function(e){var t=window.event?window.event.keyCode:e.which;if(46!=t&&(32==t||39==t||46==t||8==t||9==t||189==t||0==t))return t;var i=String.fromCharCode(t),a=/\d/;return window.event?event.returnValue=a.test(i):a.test(i)},_siteBuilderDetail.ValidOnlyNumber=function(e){var t=$(e),i=t.val();try{/\D/g.test(i)&&(i=1,t.val("1")),i=""==i?1:i,i=parseInt(i),0==isNaN(i)&&i>0==0&&t.val("1")}catch(e){t.val("1")}_siteBuilderDetail.PriceUpdate()},_siteBuilderDetail.AddInventoryToCart=function(e,t){if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){var i={eventName:"ProductAddedToCart",timestamp:(new Date).getTime(),data:{productName:$("#spanProductTitle").text(),quantity:$("#txtVariantQty").val()}};"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(i)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(i)}$("html body").removeClass("isDetailPageClass");var a=$("#txtVariantQty"),r=(t=$("#hdnTotalQty").val(),$("#hdnIsTrackInventory").val());$("#hdnPType").val();return _siteBuilderDetail.InvetoryID=0,_siteBuilderDetail.encInvetoryId=e,_siteBuilderDetail.loginQty=a.val(),_siteBuilderDetail.loginTotalQuantity=t,String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.inventoryOptions)||_siteBuilderDetail.customersProductDetailsCache.inventoryOptions.length==_siteBuilderDetail.selectedVariant.length?"true"==r&&0==parseFloat(t)?(_siteBuilderDetail.alertsmall({message:"This product is out of stock.",title:"Out of Stock",callback:function(){}}),!1):"true"==r&&parseFloat(a.val())>parseFloat(t)?(alert("Available Quantity is : <b>"+t+"</b><br/>Please Update Quantity"),!1):""!=a.val()?_siteBuilderDetail.AddToCart(0,a.val(),t,1,"",e):void _siteBuilderDetail.alertsmall({message:"Quantity must be greater than 0.",title:"Alert",callback:function(){$("#txtVariantQty").val("1"),$(".span-product-currency").text(_siteBuilderDetail.currencySymbol),$(".span-product-price").text(parseFloat($("#hdnSellingprice").val()).format("#.##"));var e=_siteBuilderDetail.currencySymbol+parseFloat($("#hdnSellingprice").val()).format("#.##");_siteBuilderDetail.GCVPLText(e,4)}}):(_siteBuilderDetail.alertsmall({message:"Please select all options.",title:"Select Option"}),!1)},_siteBuilderDetail.AddItemToCart=function(e,t){var i=$("#txtAddtocartQuantity"),a=(t=$("#hdnTotalQty").val(),$("#hdnIsTrackInventory").val());$("#hdnPType").val();return _siteBuilderDetail.InvetoryID=e,_siteBuilderDetail.loginQty=i.val(),_siteBuilderDetail.loginTotalQuantity=t,"true"==a&&0==parseFloat(t)?(_siteBuilderDetail.alertsmall({message:"This product is out of stock.",title:"Out of Stock",callback:function(){}}),!1):"true"==a&&parseFloat(i.val())>parseFloat(t)?(alert("Available Quantity is : <b>"+t+"</b><br/>Please Update Quantity"),!1):""!=i.val()?(_siteBuilderDetail.AddToCart(e,i.val(),t,1,""),!0):void _siteBuilderDetail.alertsmall({message:"Quantity must be greater than 0.",title:"Alert",callback:function(){$("#txtAddtocartQuantity").val("1"),$("#priceRow").text(_siteBuilderDetail.currencySymbol+parseFloat($("#hdnSellingprice").val()).format("#.##"));var e=_siteBuilderDetail.currencySymbol+parseFloat($("#hdnSellingprice").val()).format("#.##");_siteBuilderDetail.GCVPLText(e,4)}})},_siteBuilderDetail.AddToCart=function(e,t,i,a,r,o){if(UserID<=0&&0===a)return loginInventoryID=e,loginTotalQuantity=i,loginAddToCartImage=r,$("#divShoppingcartpopup").modal("hide"),$("html, body").removeClass("hide-bgscrollProd"),showCommonLoginPopup("Products"),!1;if(1===a&&UserID<=0)return loginInventoryID=e,loginQty=t,loginTotalQuantity=i,$("#divShoppingcartpopup").modal("hide"),$("html, body").removeClass("hide-bgscrollProd"),showCommonLoginPopup("ShoppingcartPopup"),!1;if(_siteBuilderDetail.AddToCartProduct=new PaginationBuilder("","",{Token:ApiURLEnumCommonApi.addtocart,Data:{},LocalData:{},checkTab:!0,IsAjaxQue:!1,Loader:$("#apgLoading"),pageName:"home",lazyLoadClass:"lazypager"}).init(),_siteBuilderDetail.AddToCartProduct.options.Data.businessID=_siteBuilderDetail.businessID,_siteBuilderDetail.AddToCartProduct.options.Data.inventoryID=e,_siteBuilderDetail.AddToCartProduct.options.Data.encInvetoryId=String.isNullOrUndefineOrBlank(o)?"":o,!String.isNullOrUndefineOrBlank(_siteBuilderDetail.variantForCheckout)&&!String.isNullOrUndefineOrBlank(_siteBuilderDetail.variantForCheckout.BundleProduct)&&_siteBuilderDetail.variantForCheckout.BundleProduct.length>0){new Array;const e=Object.values(_siteBuilderDetail.variantForCheckout.BundleProduct.reduce((e,t)=>{let i=t.combination&&t.combination.length>0?1:t.bundleQty;return e[t.inventoryId]?e[t.inventoryId].qty+=i:e[t.inventoryId]={inventoryId:t.inventoryId,qty:i},e},{}));_siteBuilderDetail.AddToCartProduct.options.Data.BundleInventoryJson=JSON.stringify(e)}_siteBuilderDetail.AddToCartProduct.options.Data.quantity=t,_siteBuilderDetail.AddToCartProduct.options.Data.totalQuantity=i,_siteBuilderDetail.AddToCartProduct.options.Data.isFromPoupup=a,_siteBuilderDetail.AddToCartProduct.options.Data.loginUserID=UserID,_siteBuilderDetail.AddToCartProduct.options.onRowLoad=_siteBuilderDetail.AddToCart_Success,_siteBuilderDetail.AddToCartProduct.scroll()},_siteBuilderDetail.AddToCart_Success=function(e,t){$("html body").removeClass("isDetailPageClass");var i=e.config.Data,a=parseFloat($("#hdnSellingprice").val()),r=i.encInvetoryId;if(String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.inventory)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.inventory.inventoryMasterId)||(r=i.InvetoryMasterId),0===i.isFromPoupup){if(-1===t)return alert("No more quantity is available for this product."),!1;_onlineCheckout.GetCartItemCount(t,$('[data-inventryid="'+r+'"]'),a)}else{if(-1===t)return alert("No more quantity is available for this product."),!1;1===t&&_common.PassiveAlertSuccessgreen("Added to Cart"),$("#txtVariantQty").val("1"),$("#divProductPreviewpageOnline").hide(),$("#divProductListSection").show(),$("html body").addClass("addProductbody"),$("#mobile-check").is(":visible")||$("html body").addClass("addProductbody"),1==_shopdetail.isShareLink&&(_shopdetail.isShareLink=!1,$("#divInventoryContainer").show(),$("#accordion").show(),$(".div-share-button").show(),$("#div-search").show(),_siteBuilderDetail.breadCrumbs=[],$("#breadcrumbslist").html(""),_siteBuilderDetail.ClearAllFilter(),_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData()),_onlineCheckout.GetCartItemCount(t,$('[data-inventryid="'+r+'"]'),a),_onlineCheckout.GetCartItemCount(t)}},_siteBuilderDetail.sendMessagetoprovider=function(){var e=_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.DefaultShopImageForAll;0==_siteBuilderDetail.isVConnectBetaRelease?_siteBuilderDetail.emailServiceProviderOld(businessName,shopOwnerID,"salon",null!=BusinessDefaultImage?BusinessDefaultImage:e):_siteBuilderDetail.emailServiceProvider(businessName,shopOwnerID,"salon",null!=BusinessDefaultImage?BusinessDefaultImage:e)},_siteBuilderDetail.emailServiceProvider=function(e,t,i,a){if(void 0===_siteBuilderDetail.loginUserId||null==_siteBuilderDetail.loginUserId||""==_siteBuilderDetail.loginUserId||"0"==_siteBuilderDetail.loginUserId)return"salon"==i&&(CommonFromPage="CustomerMessagePage"),void showLogin();if(1==_siteBuilderDetail.isVConnectBetaRelease)_siteBuilderDetail.OpenVagaroConnectChat();else{var r=_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.DefaultShopImageForAll;_siteBuilderDetail.emailServiceProviderOld(e,shopOwnerID,"salon",null!=BusinessDefaultImage?BusinessDefaultImage:r)}},_siteBuilderDetail.emailServiceProviderOld=function(e,t,i,a){void 0!==_siteBuilderDetail.loginUserId&&null!=_siteBuilderDetail.loginUserId&&""!=_siteBuilderDetail.loginUserId&&"0"!=_siteBuilderDetail.loginUserId?($("#divSPEmailPopupContent").find("input:text,textarea").each(function(){$(this).val(""),$(this).removeClass("loginInput errorInput"),$("#"+$(this).attr("id")+"-error").css("display","none")}),"sp"==i&&($("#txtSubject").val("Email to Service Provider"),UserID>0&&($("#txtSenderName").val(FullUserName),$("#txtSenderEmail").val(UserEmail))),$("#divSPEmailPopup").modal("show"),centerModal("#divSPEmailPopup"),$("#lblSPName").text(e),$("#lblSPName").focus(),$("#hdnSPEmail").val(t),$("#imgPopupPhoto").attr("data-original",a),$("#imgPopupPhoto").find(".review-profile-inner-text").text(_siteBuilderDetail.FindInitials(e,"SP")),$(".messagelazypager").lazyload({effect:"fadeIn",event:"lazyload",isShowIntials:!0,intial_selecter:".intialsname"}).trigger("lazyload"),"salon"===i?($("#hdnIsForSalon").val(1),$("#txtSubject").val("Message to Business")):$("#hdnIsForSalon").val(0)):vagaro.alertmidium("Login is required to send message.")},_siteBuilderDetail.SendMailtoSP=function(){if(1==$("#SPmailValidate").valid()){var e=$("#txtSubject").val(),t=$("#txtBody").val(),i=$("#txtSenderName").val(),a=$("#txtSenderEmail").val(),r=$("#lblSPName").text(),o=$("#hdnSPEmail").val(),n=_siteBuilderDetail.businessID;"1"===$("#hdnIsForSalon").val()&&(r=$("#hdShopOwnerName").val()+" ("+$("#lblSPName").text()+")"),_siteBuilderDetail.SendMailSP=new PaginationBuilder("","",{Token:ApiURLEnumCommonApi.sendemailtosp,Data:{},LocalData:{},checkTab:!0,IsAjaxQue:!1,Loader:$("#apgLoading"),pageName:"home",lazyLoadClass:"lazypager"}).init();var s=window.location.href;_siteBuilderDetail.SendMailSP.options.Data.sSubject=e,_siteBuilderDetail.SendMailSP.options.Data.sbody=t,_siteBuilderDetail.SendMailSP.options.Data.sSenderName=i,_siteBuilderDetail.SendMailSP.options.Data.sSenderEmail=a,_siteBuilderDetail.SendMailSP.options.Data.sSPName=r,_siteBuilderDetail.SendMailSP.options.Data.sBusinessID=n,_siteBuilderDetail.SendMailSP.options.Data.PageUrl=s,_siteBuilderDetail.SendMailSP.options.Data.sImageurl="",_siteBuilderDetail.SendMailSP.options.Data.sContactNo="",_siteBuilderDetail.SendMailSP.options.Data.sSPId=o,_siteBuilderDetail.SendMailSP.options.Data.loginUserID=_siteBuilderDetail.loginUserId,_siteBuilderDetail.SendMailSP.options.onRowLoad=_siteBuilderDetail.SendMailtoSPSuccess,_siteBuilderDetail.SendMailSP.scroll()}},_siteBuilderDetail.SendMailtoSPSuccess=function(e,t){""!=t&&null!=t&&"1"==t.toString()?(_siteBuilderDetail.HideMailPopup("divSPEmailPopup"),_siteBuilderDetail.PassiveAlertMessage(_siteBuilderDetail.MessageType.Success,"Message sent to "+$("#lblSPName").text()+"."),$("#btnMassage").attr("aria-label","Message sent to "+$("#lblSPName").text()+".").attr("tabindex",-1).focus(),setTimeout(function(){$("#btnMassage").removeAttr("aria-label")},2e3)):(_siteBuilderDetail.HideMailPopup("divSPEmailPopup"),_siteBuilderDetail.PassiveAlertMessage(_siteBuilderDetail.MessageType.Fail,"Message sending failed"),$("#btnMassage").attr("aria-label","Message sending failed").attr("tabindex",-1).focus(),setTimeout(function(){$("#btnMassage").removeAttr("aria-label")},2e3))},_siteBuilderDetail.htmlDecode=function(e){return $("<div/>").html(e).text()},_siteBuilderDetail.HideMailPopup=function(e){$("#"+e).modal("hide"),_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())?($("#hdnSPReview").val(""),_siteBuilderDetail.ComponentResponse.lstReview.Response=null,$("#divSPReviewPopupContent").hide()):$("#btnMassage").focus()},_siteBuilderDetail.FindInitials=function(e,t){var i=/[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/,a=["ASS","WTF","SEX","SUK","FUK","DIE","BUM","TIT","BCH","DAM","HAH","OUT"];if(null!=e&&""!=e){var r=(e=e.replace("s+","")).split(" "),o="";if(r.length>0){for(var n=0;n<r.length;n++){var s=r[n].substr(0,1);1!=i.test(s)&&s==s.toUpperCase()&&0==_siteBuilderDetail.is_numeric(s)&&(o+=s)}o.length<=0&&(o=e.substr(0,1))}else o=r[0].substr(0,1);return o.length>=3?(o=o.substr(0,3),_siteBuilderDetail.Arrcontains(a,o)&&(o=o.substr(0,o.length-1)),a=null,"SP"==t?o.substr(0,2).toUpperCase():o.toUpperCase()):o.toUpperCase()}return e},_siteBuilderDetail.Arrcontains=function(e,t){for(var i=0;i<e.length;i++)if(e[i]===t)return!0;return!1},_siteBuilderDetail.is_numeric=function(e){return/^\d+$/.test(e)},_siteBuilderDetail.getscrollTop=function(e){$(e).scrollTop();return _siteBuilderDetail.InPageWidget_Ios?-1*$("#page-wrapper").position().top:$(window).scrollTop()},_siteBuilderDetail.BookNow=function(e){if("pagebooknowsearch"===$(e).data("customComponent")){if(IsNewCustomWebsite&&!_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData(e,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,"book-now"))return;_shopdetail.LoadBookNowUserControl(e)}},_siteBuilderDetail.ShowSharePopup=function(e){$(e).parent().parent().parent().find(".share-popup").toggleClass("show");var t=$(e).parent().parent().parent().closest(".gallery-solo-image");_siteBuilderDetail.fetchStylistName(t,e)},_siteBuilderDetail.ApplyEnScroll=function(e){_siteBuilderDetail.iPadAndroid||_siteBuilderDetail.iMacSafari||_siteBuilderDetail.isWindowsPhone||_siteBuilderDetail.isWebKit&&!_siteBuilderDetail.isEdge||Ps.initialize(document.querySelector(e),{suppressScrollY:!1})},$(document).mouseup(function(e){var t=$(".product-dropdown");t.is(e.target)||0!==t.has(e.target).length||$(".product-checkboxList").hide()}),$(document).on("show.bs.modal",".modal",function(){var e=1040+10*_common.VisibleControlLength(".modal");$(this).css("z-index",e);const t=localStorage.getItem("RedirectSource");null!=t&&"HomeBtn"===t&&(_shopdetail.GetAddOnServiceDetail("txtService1",""),localStorage.removeItem("RedirectSource")),setTimeout(function(){$(".modal-backdrop").not(".modal-stack").css("z-index",e-1).addClass("modal-stack")},0)}),_siteBuilderDetail.lBusinessPromoCodeID=$("#hdBusinessPromoCodeID").length>0?$("#hdBusinessPromoCodeID").val():null,_siteBuilderDetail.NotmobileorIphone=!0,_siteBuilderDetail.lattitude="",_siteBuilderDetail.longitude="",_siteBuilderDetail.countryid="",_siteBuilderDetail.zip="",_siteBuilderDetail.state="",_siteBuilderDetail.serviceDateTime="",_siteBuilderDetail.CountryNames=["United States","United States","United Kingdom","Canada","Australia"],_siteBuilderDetail.CurrentLocation="",_siteBuilderDetail.cltrlLocationSearch,_siteBuilderDetail.ProximityCookieName="proximitystate_v3",_siteBuilderDetail.ProximityIsCurrentLocation="proximityiscurrentLocation",_siteBuilderDetail.isSetIsCurrentLocationCookie=!1,_siteBuilderDetail.gblsource="",_siteBuilderDetail.gblevent="",_siteBuilderDetail.flagAddState=!1,_siteBuilderDetail.businesstypes="",_siteBuilderDetail.EmptyProximityValue=function(){return JSON.parse('{"lat":"","long":"","countryid":"1","zip":"","city":"","state":"","currencysymbol":"$","businesstypes":"","service":"","serviceDate":"","serviceTime":""}')},_siteBuilderDetail.tabSegment="about",_siteBuilderDetail.promotionalURL="",_siteBuilderDetail.styleCategoryName="",ProximitySearch=function(e,t,i){this.$searchelement=e,this.$countrycomboelement=t,this.$countrylistelement=i,this.$select2object={},this.$searchelement.on("select2-focus",function(t){$("#mobile-check").is(":visible")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType?e.parent().find(".select2-input").val(""):setTimeout(function(){e.parent().find(".select2-input").val("")},20),setTimeout(function(){$(t.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common"),$("html, body").addClass("moboverflow-hide"),$("#select2-drop-mask").addClass("hidemask"),$("html, body").scrollTop(0)},200)}),this.$searchelement.on("select2-open",function(e){$(e.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common"),$("html, body").addClass("moboverflow-hide"),$("#select2-drop-mask").addClass("hidemask"),$("html, body").scrollTop(0)}),this.$searchelement.on("selected",function(t){t.choice.text=t.choice.cityState;var i=!1,a=1==$(t.target).data().instantsearch;if(_siteBuilderDetail.isSetIsCurrentLocationCookie=!1,isLocationByDefault=!1,2==t.choice.type){if($(t.target).data("selectedid",""),void 0!==t.choice.vagarourl!=null&&""!=t.choice.vagarourl){i=!0;var r=window.location.href.split("/"),o=r[0]+"//"+r[2]+t.choice.vagarourl;$url=$("<a/>"),$url.attr("href",o),$url[0].click()}}else{if("location"==t.choice.type){if((1==a||iosDevices||_siteBuilderDetail.iPadAndroid||_siteBuilderDetail.isAndroidMobile||_siteBuilderDetail.isWindowsPhone||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&(_siteBuilderDetail.isSetIsCurrentLocationCookie=!0),"undefined"!=typeof vgAppicationType&&1==vgAppicationType)return void CallbackforMobileApp(0,1,"","",0,27);$(t.target).data("selectedid",t.choice.id),_siteBuilderDetail.gblsource=$(t.target).data().purpose,_siteBuilderDetail.gblevent=t;var n=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();return null!=n&&/com.vagaro.androidpro/i.test(n)?_siteBuilderDetail.findLocationCallBack():_siteBuilderDetail.findCurrentLocation(e,_siteBuilderDetail.gblsource,_siteBuilderDetail.gblevent,t.choice,"onlocationchange"),void t.stopPropagation()}$(t.target).data("selectedid",t.choice.id)}if(_siteBuilderDetail.SetChoiceForSeleect2(e,t.choice),$(t.target).data("response",JSON.stringify(t.choice)),"txtLiveStreamLocationSearch"==$(t.target).attr("id")){_siteBuilderDetail.gblsource=$(t.target).data().purpose,_siteBuilderDetail.gblevent=t,ShowLoader(!0);var s=/^\d+$/.test(t.choice.id);_siteBuilderDetail.flagAddState=!0,1==s?(_siteBuilderDetail.onSearchClick(_siteBuilderDetail.gblsource,_siteBuilderDetail.gblevent,t.choice,!1,_siteBuilderDetail.flagAddState),$("#txtLiveStreamLocationSearch").select2("destroy"),$("#txtLiveStreamLocationSearch").off("selected"),$("#txtLiveStreamLocationSearch").off("select2-close"),$("#divLiveStreamLocationSearchPopUp").modal("hide"),void 0!==_siteBuilderDetail.isSetIsCurrentLocationCookie&&_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityIsCurrentLocation,_siteBuilderDetail.isSetIsCurrentLocationCookie),_common.UpdateTimeZoneLocationCookie(!0),ShowLoader(!1)):(Data={},Data.placeID=t.choice.id,vagaro.ajaxCall(ApiURLEnumCommonApi.getlocationsearchbyplaceid,Data,_siteBuilderDetail.GetLocationSearchByPlaceId_Success,_siteBuilderDetail.CommonError,!1,!0))}else if(a&&0==i){_siteBuilderDetail.gblsource=$(t.target).data().purpose,_siteBuilderDetail.gblevent=t;s=/^\d+$/.test(t.choice.id);_siteBuilderDetail.flagAddState=!0,"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(_siteBuilderDetail.flagAddState="home"==_siteBuilderDetail.tabSegment.toLowerCase()||"/"==_siteBuilderDetail.tabSegment||""==_siteBuilderDetail.tabSegment,$("#txtSearchServiceMain").select2("close")),1==s?_siteBuilderDetail.onSearchClick(_siteBuilderDetail.gblsource,_siteBuilderDetail.gblevent,t.choice,!1,_siteBuilderDetail.flagAddState):(Data={},Data.placeID=t.choice.id,vagaro.ajaxCall(ApiURLEnumCommonApi.getlocationsearchbyplaceid,Data,_siteBuilderDetail.GetLocationSearchByPlaceId_Success,_siteBuilderDetail.CommonError,!1,!0))}t.stopPropagation()}),this.$searchelement.on("select2-blur",function(e){e.preventDefault(),1==$(e.currentTarget).data().instantsearch&&""==$(e.currentTarget).val()&&_siteBuilderDetail.ProxymityValueChaning()}),this.$searchelement.on("select2-close",function(t){$("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){$("#select2-drop-mask").off("touchstart.custom")},500);var i=e.data("select2").getVal().toString(),a=_siteBuilderDetail.GetChoiceForSeleect2(e);""!=i&&void 0!==a.id?1==$(t.currentTarget).data().instantsearch?e.select2("val",a.id):e.select2("data",{id:a.id,text:a.text}):1==$(t.currentTarget).data().instantsearch?_siteBuilderDetail.ProxymityValueChaning():(e.select2("data",{id:"",text:""}),_siteBuilderDetail.SetDefaultForSeleect2(e)),$(".select2-more-pager").remove()}),null!=this.$countrylistelement&&this.$countrylistelement.find("a").click(function(){$("#divCountryName").html($(this).html()),$("#hdngblCountryId").data("countryid",$(this).data("countryid")),$("#navCountryList").trigger("w-close.w-dropdown")})},_siteBuilderDetail.GetLocationSearchByPlaceId_Success=function(e){null!=e&&($("#txtLiveStreamLocationSearch").select2("destroy"),$("#txtLiveStreamLocationSearch").off("selected"),$("#txtLiveStreamLocationSearch").off("select2-close"),$("#divLiveStreamLocationSearchPopUp").modal("hide"),_siteBuilderDetail.onSearchClick(_siteBuilderDetail.gblsource,_siteBuilderDetail.gblevent,e,!1,_siteBuilderDetail.flagAddState),IsNewAddressHtml?(_siteBuilderDetail.IsShowNewadd=!0,"undefined"!=typeof bk&&null!=bk&&(bk.timeSlotsCache={}),void 0!==_siteBuilderDetail.isSetIsCurrentLocationCookie&&_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityIsCurrentLocation,_siteBuilderDetail.isSetIsCurrentLocationCookie),_shopdetail.NewAddressHtml(),void 0!==_onlineCheckout.isClassCheckout&&_onlineCheckout.isClassCheckout&&_onlineCheckout.ChangeCustomerStartTime(e.timeZoneOffSet,e.countryID,e.IsSupportDayLight),_shopdetail.ChangeCustomerStartTime(e.timeZoneOffSet,e.countryID,e.IsSupportDayLight),$("html, body").removeClass("moboverflow-hide"),_shopdetail.setLocationCookieData()):("undefined"!=typeof bk&&null!=bk&&(bk.timeSlotsCache={}),void 0!==_siteBuilderDetail.isSetIsCurrentLocationCookie&&_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityIsCurrentLocation,_siteBuilderDetail.isSetIsCurrentLocationCookie),"txtLiveStreamLocationSearch"==$(_siteBuilderDetail.gblevent.target).attr("id")&&_shopdetail.RebindAfterLocationChange(),ShowLoader(!1)))},ProximitySearch.prototype={CountrySelected:function(e,t,i,a){i.data("countryid",$(e).attr("data-countryid")),i.data("currencysymbol",$(e).attr("data-currencysymbol")),$("#divCountryName").html($(e).html()),a.data("selectedid","");_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName)},init:function(e,t){var i=this.$countrycomboelement,a=0,r=20;this.$searchelement.val("");var o="";if("undefined"!=typeof regionId&&""!=regionId&&(o="/"+regionId),void 0===this.$searchelement.data("select2")&&(this.$select2object=this.$searchelement.select2({searchInputPlaceholder:1==t?"Business Name or Location":"City, Zip / Postal code",minimumInputLength:0,maximumInputLength:100,combobox:!0,formContainer:"#page-wrapper",dropdownCssClass:e,selectOnClick:_siteBuilderDetail.NotmobileorIphone,formatInputTooShort:!1,ajax:{type:"POST",contentType:"application/json; charset=utf-8",url:o+"/WebServices/CommonWebService.asmx/GetBusinessLocationSearch",dataType:"json",minimumInputLengthForAjaxCall:3,data:function(e,a){return{searchText:e.replace("‘","'").replace("’","'").replace("“",'"').replace("”",'"'),countryId:void 0===i.data("countryid")?void 0===CountryID?1:CountryID:parseInt(i.data("countryid")),businesspromoid:_siteBuilderDetail.lBusinessPromoCodeID,latitude:""!=_siteBuilderDetail.lattitude?parseFloat(_siteBuilderDetail.lattitude):0,longitude:""!=_siteBuilderDetail.longitude?parseFloat(_siteBuilderDetail.longitude):0,includebusiness:t,currentlocation:_siteBuilderDetail.CurrentLocation,pagenumber:a,countryName:$("#divCountryName").text()}},results:function(e,t){if(arrresults=[],null!=e&&e.length>0){if(arrBusiness=[],arrLocation=[],$.grep(e,function(e,t){if(1==e.type&&null!=e.cityState&&""!=e.cityState){var i={};null!=e.place_id&&""!=e.place_id?(i.id=e.place_id,i.text=e.cityState+', <span class="countrygreycolor">'+e.countryName+"</span>",i.cityState=e.cityState):(i.id=t+1,i.text=e.cityState,i.latitude=e.latitude,i.longitude=e.longitude,i.state=e.state,i.zipCode=e.zipCode,i.currencySymbol=e.currencySymbol,1!=e.countryID?i.stateCode=e.stateCode.replace("AU-","").replace("GB-","").replace("CA-",""):i.stateCode=e.stateCode,i.city=e.city,i.cityState=_siteBuilderDetail.SetCityState(i.city,i.state)),i.countryID=e.countryID,i.countryName=e.countryName,i.type=e.type,i.cssClass="parent-text location-icon-select",arrLocation.push(i)}else if(2==e.type){(i={}).id=e.vagaroURL+"|"+e.businessID,i.text=e.businessName,i.cssClass="parent-text",i.appendText=e.cityState,i.childCssClass="child-text",i.type=e.type,i.vagarourl=e.vagaroURL,arrBusiness.push(i)}}),e.length>0&&1==e[0].includebusiness){var i={};"1"==t?(arrLocation.length>0&&((i={}).id="Locations",i.text="Locations",i.cssClass="selectlocation-icon",i.disabled=!0,i.children=arrLocation,arrresults.push(i)),arrBusiness.length>0&&((i={}).id="Businesses",i.text="Businesses",i.cssClass="selectbusiness-icon",i.disabled=!0,i.children=arrBusiness,arrresults.push(i))):arrresults=arrBusiness}else arrresults=arrLocation;var o=20;if("1"==t){o=25;var n={id:"location",text:"Current Location",cssClass:"currentlocation-icon",type:"location"};arrresults.splice(0,0,n)}a=e.length>0?e[0].totalCount:0;var s=Math.ceil(a/o);r=o*t,t==s&&(r=a);var l=!1;return r<a&&(l=!0),{results:arrresults,more:l}}n={id:"location",text:"Current Location",cssClass:"currentlocation-icon",type:"location"};return arrresults.splice(0,0,n),{results:arrresults,more:!1}},params:{error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}}},cache:!1},initSelection:function(e,t){var i=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName);if(null!=i&&""!=i.state){var a={},r=null==i.state?"":2==i.countryid?i.state:i.state.toUpperCase();if(void 0!==i.city&&null!=i.city&&""!=i.city)a={id:"",text:i.city+", "+r+", "+(null!=i.countryid&&""!=i.countryid?_siteBuilderDetail.CountryNames[parseInt(i.countryid)]:"United States")};else a={id:"",text:(String.isNullOrUndefineOrBlank(i.stateName)?r:i.stateName)+", "+(null!=i.countryid&&""!=i.countryid?_siteBuilderDetail.CountryNames[parseInt(i.countryid)]:"United States")};t(a)}},formatResult:function(e){var t="",i=e.text;(t=1==e.hasOwnProperty("cssClass")?'<div class="'+e.cssClass+'">'+i+"</div>":"<div>"+i+"</div>",1==e.hasOwnProperty("appendText")&&""!=e.appendText)&&(t=t+"<span"+(e.hasOwnProperty("childCssClass")?' class="'+e.childCssClass+'"':"")+">"+e.appendText+"</span>");return t},formatSelection:function(e){return e.text},sortResults:function(e,t,i){return e},formatPager:function(e){return e>1&&(r+=5)>a?"Items 1 - "+(r-=5)+" out of "+a:"Items 1 - "+r+" out of "+a}})),null!=this.$countrylistelement&&(this.CountrySelected(this.$countrylistelement.find("a[data-countryid='"+_siteBuilderDetail.countryid+"']").get(0),!1,this.$countrycomboelement,this.$searchelement),null!=_siteBuilderDetail.state&&""!=_siteBuilderDetail.state)){var n="";n=void 0!==city&&null!=city&&""!=city?_siteBuilderDetail.lattitude+"#"+_siteBuilderDetail.longitude+"#"+_siteBuilderDetail.zip+"#"+_siteBuilderDetail.city.toLowerCase()+"#"+_siteBuilderDetail.state.toLowerCase():_siteBuilderDetail.lattitude+"#"+_siteBuilderDetail.longitude+"#"+_siteBuilderDetail.zip+"#"+_siteBuilderDetail.state.toLowerCase(),this.$searchelement.select2("val",n);var s={id:n};_siteBuilderDetail.SetChoiceForSeleect2(this.$searchelement,s),this.$searchelement.data("selectedid",n)}return this}},_siteBuilderDetail.SetChoiceForSeleect2=function(e,t){e.data("choice",JSON.stringify(t))},_siteBuilderDetail.GetChoiceForSeleect2=function(e){try{return JSON.parse(e.data("choice"))}catch(e){return{}}},_siteBuilderDetail.AddState=function(e,t){var i="";"true"==isPromotionUI&&null!=_siteBuilderDetail.promotionalURL&&null!=_siteBuilderDetail.promotionalURL&&_siteBuilderDetail.promotionalURL.length>0&&(i="/"+_siteBuilderDetail.promotionalURL);var a=!0,r="",o={1:"us",2:"--gb",3:"--ca",4:"--au"},n=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName),s="",l="",d="",c="";if(null!=n&&void 0!==n&&(null!=n.city&&void 0!==n.city&&""!=n.city&&(s=n.city.toLowerCase().replace(" ","-").trim()+"--",l=n.city.toLowerCase().trim().replace(/\s+/g,"-")),null!=n.state&&void 0!==n.state&&""!=n.state&&(d=2==n.countryid?n.stateName.toLowerCase().replace(" ","-").trim():n.state.toLowerCase().trim()),null!=n.countryid&&void 0!==n.countryid&&""!=n.countryid&&(c=n.countryid)),s=_siteBuilderDetail.RemoveAccents(_siteBuilderDetail.GetPlainTextForLocationSearch(s)),l=_siteBuilderDetail.RemoveAccents(_siteBuilderDetail.GetPlainTextForLocationSearch(l)),window.history&&history.pushState){if("detail"!=BasePage.toLowerCase())return!1;if(null!=e&&null!=e&&""!=e&&$.inArray(e.toLowerCase(),["about","staff","services","classes","reviews","products","gift-certificates","memberships","book-now","addreview","styles","shopping-bag"])<0&&e.indexOf("dealsindividual")<0)return;var u=location.href.split("?"),p="";u.length>=2&&(p="?"+u[1]);var h={basepage:BasePage,sectionName:e,subTab:t};window.location.href.indexOf("BusinessWidget.aspx")>=0?history.pushState(h,e,window.location.href):null!=e&&null!=e&&""!=e&&e.indexOf("dealsindividual")>=0?((e=e.split("dealsindividual")[0]).indexOf("isdeal")>=0&&p.indexOf("isdeal")>=0&&(e=e.split("?")[0]),history.pushState(h,e,(window.location.href.match("/$")?"../":"/")+e+p)):history.pushState(h,e,(window.location.href.match("/$")?"../":"/")+vagaroUrl.toLowerCase()+"/"+e+p)}else a=!1;return""!=_siteBuilderDetail.styleCategoryName&&void 0!==_siteBuilderDetail.styleCategoryName&&null!=_siteBuilderDetail.styleCategoryName?$("#photos").attr("href",(window.location.href.match("/$")?"../":"/")+"photos"+i+r.concat("/",_siteBuilderDetail.styleCategoryName.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",s,d,1==c?"":o[c])):$("#photos").attr("href",(window.location.href.match("/$")?"../":"/")+"photos"+i+r.concat("/",s,d,1==c?"":o[c])),""!=_siteBuilderDetail.businesstypes&&void 0!==_siteBuilderDetail.businesstypes&&null!=_siteBuilderDetail.businesstypes?($("#professionals").attr("href",(window.location.href.match("/$")?"../":"/")+"professionals"+i+r.concat("/",_siteBuilderDetail.businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==c?"":o[c])),$("#deals").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+i+r.concat("/",_siteBuilderDetail.businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==c?"":o[c])),$("#dailyDealsFooter").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+i+r.concat("/",_siteBuilderDetail.businesstypes.toLowerCase().trim().split(/[,]+/).slice()[0].replace(/\s+/g,"-"),"/",l,"--",d,1==c?"":o[c]))):($("#professionals").attr("href",(window.location.href.match("/$")?"../":"/")+"professionals"+i+r.concat("/",s,d,1==c?"":o[c])),$("#deals").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+i+r.concat("/",s,d,1==c?"":o[c])),$("#dailyDealsFooter").attr("href",(window.location.href.match("/$")?"../":"/")+"deals"+i+r.concat("/",s,d,1==c?"":o[c]))),a},_siteBuilderDetail.SetCityState=function(e,t){return void 0!==t&&null!=t||(t=""),void 0!==e&&null!=e&&""!=e?e+", "+t.toUpperCase():t.toUpperCase()},_siteBuilderDetail.IsCookieEnabled=function(){if(navigator.cookieEnabled){try{if(inIframe()&&/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor))return document.cookie="IsCookieEnable=yes;",-1==document.cookie.indexOf("IsCookieEnable=")?1:2}catch(e){}return 2}return 0},_siteBuilderDetail.alertsmall=function(e){"undefined"!=typeof bootbox&&bootbox.alertsmall(e)},_siteBuilderDetail.SetDefaultCookie=function(e){var t=_siteBuilderDetail.EmptyProximityValue();return t.countryid="1",t.currencysymbol="$",t.lat="37.78222",t.long="-122.46178",t.zip="",t.city="San Francisco",t.state="CA",t.stateName="California",void 0!==e&&void 0!==e.businesstypes&&(t.businesstypes=e.businesstypes),t},_siteBuilderDetail.SetDefaultForSeleect2=function(e){e.data("choice",JSON.stringify({id:"",text:""}))},_siteBuilderDetail.onSearchClick=function(e,t,i,a,r){var o,n,s;if("locationSearch"==e?(o=$("#txtLocationSearch"),n=$(t.target).closest(".list-unstyled").find(".select2-input"),s=$("#hdngblCountryId")):"LiveStreamBusinessLocationSearch"==e&&(o=$("#txtLiveStreamLocationSearch"),n=$(t.target).closest(".list-unstyled").find(".select2-input"),s=$("#hdngblCountryId")),""!=n.val()&&""!=o.data().selectedid){var l="";if(l=void 0!==i?i:o.data().selectedid,_siteBuilderDetail.ManageProximityState(l,n.val(),void 0!==a&&a),"txtLiveStreamLocationSearch"!=$(t.target).attr("id")){if(void 0!==i&&0==(void 0!==r&&0==r)&&_siteBuilderDetail.AddState(_siteBuilderDetail.tabSegment),null!=l&&"object"!=typeof l&&l.indexOf("|")>-1){var d=window.location.href.split("/"),c=d[0]+"//"+d[2],u=l.split("|")[0];if(businessURL=c+u,null!=businessURL&&""!=businessURL)return $url=$("<a/>"),$url.attr("href",businessURL),void $url[0].click();var p=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName);if(null==p)return;return p.countryid==s.attr("data-countryid")?($url=$("<a/>"),$url.attr("href",businessURL),void $url[0].click()):void(setCurrentLocationforBusiness=!0)}if("detail"==BasePage.toLowerCase()){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&("undefined"!=typeof IsBrandedApp||null!=IsBrandedApp||""!=IsBrandedApp||null!=IsBrandedApp)&&1==IsBrandedApp)return;var h="/listings";return"true"==isPromotionUI&&void 0!==_siteBuilderDetail.promotionalURL&&null!=_siteBuilderDetail.promotionalURL&&_siteBuilderDetail.promotionalURL.length>0&&(h=h+"/"+_siteBuilderDetail.promotionalURL),void(window.location.href=h)}}}else _siteBuilderDetail.alertsmall({message:"Please provide a location.",title:"Alert",callback:function(){_siteBuilderDetail.ProxymityValueChaning()}})},_siteBuilderDetail.ManageProximityState=function(e,t,i){var a=_siteBuilderDetail.EmptyProximityValue();(a.businesstypes=_siteBuilderDetail.businesstypes,""!=t&&void 0!==e&&null!=e&&"object"==typeof e&&(a.countryid=e.countryID,a.currencysymbol=e.currencySymbol,a.lat=e.latitude,a.long=e.longitude,a.zip=e.zipCode,a.city=e.city,a.state=e.stateCode,a.stateName=e.state,a.utcOffset=e.utcOffset,a.timeZoneOffSet=e.timeZoneOffSet,a.isSupportDayLight=e.IsSupportDayLight),_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityCookieName,a),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#spnAppLocationSearch").text(_siteBuilderDetail.SetCityState(e.city,e.stateCode.toUpperCase())),i||"undefined"==typeof vgAppicationType||1!=vgAppicationType)||CallbackforMobileApp(0,0,"","","0","21|~|"+('{\\"cityName\\":\\"'+_siteBuilderDetail.SetCityState(a.city,a.state.toUpperCase())+'\\", \\"latitude\\":\\"'+a.lat+'\\", \\"longitude\\":\\"'+a.long+'\\", \\"countryId\\":'+a.countryid+"}"))},_siteBuilderDetail.findCurrentLocation=function(e,t,i,a,r,o){var n=getQueryStringData("Type");"OnBoarding"!=n&&"ImportOnBoarding"!=n&&("undefined"!=typeof navigator&&null!=typeof navigator&&void 0!==navigator.geolocation&&null!=navigator.geolocation?("True"==$("#hdnIsZoomIntegrated").val()||r&&""!=r&&"onlocationchange"==r)&&(void 0!==navigator.permissions&&null!=navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(function(n){"prompt"==n.state||"granted"==n.state&&"onlocationchange"==r?navigator.geolocation.getCurrentPosition(function(n){isFirstTimeCall="false",null==i&&$("#dvtimezone").is(":visible")&&ShowLoader(!0),setCurrentLocationFromDatabase(n,e,t,i,a,r,o)},function(a){0==("undefined"!=typeof isFirstTimeCall&&null!=isFirstTimeCall&&"true"==isFirstTimeCall.toString().toLowerCase())&&_siteBuilderDetail.latLongFailed(e,t,i,r,o),isFirstTimeCall="false"}):"denied"==n.state&&"onlocationchange"==r&&bootbox.confirm({title:"Location",message:"Allow access to Location Services to get your current location.",buttons:{cancel:{label:"Cancel",className:"location-popup-cancel-button-hiden"}},callback:function(e){}})}):navigator.geolocation.getCurrentPosition(function(n){null==i&&$("#dvtimezone").is(":visible")&&ShowLoader(!0),isFirstTimeCall="false",setCurrentLocationFromDatabase(n,e,t,i,a,r,o)},function(){0==("undefined"!=typeof isFirstTimeCall&&null!=isFirstTimeCall&&"true"==isFirstTimeCall.toString().toLowerCase())&&_siteBuilderDetail.latLongFailed(e,t,i,r,o),isFirstTimeCall="false"})):_siteBuilderDetail.latLongFailed(e,t,i,r,o))},_siteBuilderDetail.findLocationCallBack=function(){var e=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();if(null!=e&&/com.vagaro.iospro/i.test(e)||/com.vagaro.androidpro/i.test(e)){var t='{"action": "98","jsonData": '+JSON.stringify({})+',"message": "","messageType": 0,"navType": 0,"screenTitle": "","screenType": 0}';null!=window.JSInterface?window.JSInterface.CallWSMethod(t):window.location="js-call:myObjectiveCFunction:5006||~||"+t}},_siteBuilderDetail.ResumeWizardImgCallBack=function(){var e=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();if(null!=e&&/com.vagaro.iospro/i.test(e)||/com.vagaro.androidpro/i.test(e)){var t=getQueryStringData("Type"),i=JSON.stringify({barType:2,isHide:!1,isFromWizard:!0,imgUrl:"https://vagaro.azureedge.net/static-content/Images/vagarologo3x.png",imgUrl_White:"https://vagaro.azureedge.net/static-content/Images/wht-vagarologo3x.png"}).replace(/\\\"/g,'"').replace(/"/g,'\\"');if(null!=window.JSInterface){var a='{"message": "","messageType": 0,"screenTitle": "","screenType": 0,"navType": 0,"action": "91|~|'+i+'" }';window.JSInterface.CallWSMethod(a)}else{"ImportOnBoarding"==t&&(i=JSON.stringify({barType:2,isHide:!1,isFromWizard:!1,imgUrl:"https://vagaro.azureedge.net/static-content/Images/vagarologo3x.png",imgUrl_White:"https://vagaro.azureedge.net/static-content/Images/wht-vagarologo3x.png"}).replace(/\\\"/g,'"').replace(/"/g,'\\"'));a='{"message": "","messageType": 0,"screenTitle": "","screenType": 0,"navType": 0,"action": "91|~|'+i+'" }';window.location="js-call:myObjectiveCFunction:5006||~||"+a}}},_siteBuilderDetail.ProxymityValueChaning=function(e){_siteBuilderDetail.SetProximityVariables(e),null!=_siteBuilderDetail.cltrlLocationSearch&&_siteBuilderDetail.cltrlLocationSearch.init("top-dropdown",!1)},_siteBuilderDetail.SetProximityVariables=function(e){if(0!=_siteBuilderDetail.IsCookieEnabled()&&1!=_siteBuilderDetail.IsCookieEnabled()){var t=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName);return null!=t?(_siteBuilderDetail.lattitude=t.lat,_siteBuilderDetail.longitude=t.long,_siteBuilderDetail.countryid=t.countryid,_siteBuilderDetail.zip=t.zip,_siteBuilderDetail.city=t.city,_siteBuilderDetail.state=t.state,_siteBuilderDetail.stateName=t.stateName,currencysymbol=_siteBuilderDetail.currencysymbol=t.currencysymbol,_siteBuilderDetail.businesstypes=t.businesstypes,utcOffset=t.utcOffset,e&&""!=_siteBuilderDetail.serviceDateTime||(_siteBuilderDetail.serviceDateTime=_siteBuilderDetail.getLocationDate())):_siteBuilderDetail.countryid=1,!0}},_siteBuilderDetail.setCookie=function(e,t){cookieManager.setCookie(e,t,365,cookieManager.defaultPath,cookieManager.defaultDomain,!1),e==_siteBuilderDetail.ProximityCookieName&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==_siteBuilderDetail.isAndroid&&1==_siteBuilderDetail.isAndroid&&CallbackforMobileApp(0,0,"","","0","33")},_siteBuilderDetail.getCookie=function(e){return cookieManager.getCookie(e)},_siteBuilderDetail.latLongFailed=function(e,t,i,a,r){var o=_siteBuilderDetail.getCookie(_siteBuilderDetail.ProximityCookieName),n=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";$.ajax({type:"POST",url:n+"WebServices/MySampleService.asmx/GetLocation",contentType:"application/json; charset=utf-8",success:function(n){if("onlocationchange"==a&&void 0!==n&&null!=n&&"success"==n.status.toLowerCase()){var s={};if(void 0==={us:"1",gb:"2",ca:"3",au:"4"}[n.countryCode.toLowerCase()]){var l=_siteBuilderDetail.SetDefaultCookie(o);s.latitude=l.lat,s.longitude=l.long,s.zipCode=l.zip,s.cityState=_siteBuilderDetail.SetCityState(l.city,l.state.toUpperCase()),s.city=l.city,s.stateName=l.stateName,s.state=l.state.toUpperCase(),s.stateCode=l.state,s.countryID=_siteBuilderDetail.countryid}else s.countryID=_siteBuilderDetail.countryId,s.latitude=n.lat,s.longitude=n.lon,s.zipCode=n.zip,s.cityState=_siteBuilderDetail.SetCityState(n.city,n.region.toUpperCase()),s.countryName=n.country,s.city=n.city,s.stateName=n.regionName,s.state=n.region.toUpperCase(),s.stateCode=n.region;if(s.currencySymbol="2"==s.countryID?"£":"$",s.type=1,s.id="location",s.text=_siteBuilderDetail.SetCityState(s.city,s.stateCode.toUpperCase()),_siteBuilderDetail.SetChoiceForSeleect2(e,s),e.select2("data",s),$(i.target).data("response",JSON.stringify(s)),1==$(i.target).data().instantsearch){var d=!0;"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(d="home"==r.toLowerCase()||"/"==r||""==r),_siteBuilderDetail.onSearchClick(t,i,s,!1,d)}"txtLiveStreamLocationSearch"==i.currentTarget.id&&($("#txtLiveStreamLocationSearch").select2("destroy"),$("#txtLiveStreamLocationSearch").off("selected"),$("#txtLiveStreamLocationSearch").off("select2-close"),$("#divLiveStreamLocationSearchPopUp").modal("hide"),_siteBuilderDetail.onSearchClick(_siteBuilderDetail.gblsource,i,s,!1,_siteBuilderDetail.flagAddState),void 0!==_siteBuilderDetail.isSetIsCurrentLocationCookie&&_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityIsCurrentLocation,_siteBuilderDetail.isSetIsCurrentLocationCookie),"txtLiveStreamLocationSearch"==$(_siteBuilderDetail.gblevent.target).attr("id")&&_shopdetail.RebindAfterLocationChange(),ShowLoader(!1))}}})},_siteBuilderDetail.getLocationDate=function(){var e=_siteBuilderDetail.iPadAndroid||_siteBuilderDetail.isWindowsPhone?15:5,t=new Date;if(t.getHours()>=19){t=t.setTime(t.getTime()+216e5),t=new Date(t),t=new Date(t.getFullYear(),t.getMonth(),t.getDate(),9,0,0)}var i=t.format("nn"),a=parseInt(parseInt(i)%e);return a>0&&(i=i-a+e,t.setMinutes(i)),t},_siteBuilderDetail.GetPlainTextForLocationSearch=function(e){for(var t=["/"," "],i=e,a=0;a<e.length;a++)-1!=t.indexOf(e[a])&&(i=" "==e[a]?i.replace(e[a],"-"):i.replace(e[a],""));return i},_siteBuilderDetail.RemoveAccents=function(e){var t,i,a=(e=e.split("")).length;for(t=0;t<a;t++)-1!=(i="ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž".indexOf(e[t]))&&(e[t]="AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"[i]);return e.join("")},_siteBuilderDetail.showLogin=function(){var e=_siteBuilderDetail.UserLocationInfo;if(null!=e&&null!=e&&""!=e&&null!=e.objUserInfo&&""!=e.objUserInfo&&null!=e.objUserInfo){_siteBuilderDetail.UserEmail=e.objUserInfo.EmailId,$(".lnkLogin").hide(),(_siteBuilderDetail.IsCustomWebsite||1==IsNewCustomWebsite)&&$("#divUserName").removeClass("custom-theme-nav"),IsNewCustomWebsite&&"true"==_siteBuilderDetail.isRequestFromVagaro&&$("#dvShoppingCartIcon").is(":visible")?$("#divLoginDetail").hide():$("#divLoginDetail").removeAttr("style"),$("#divLoginDetailCart").removeAttr("style");var t="";null!=e.objUserInfo.LastName&&(t=e.objUserInfo.LastName.length>1?e.objUserInfo.LastName.substring(0,1):e.objUserInfo.LastName),_siteBuilderDetail.UserName=e.objUserInfo.FirstName+" "+t,IsNewCustomWebsite?$("#divUserName").text("Hi,"+_siteBuilderDetail.UserName):$("#divUserName").text("Welcome, "+_siteBuilderDetail.UserName),$(".loginUserIntials").text(_siteBuilderDetail.FindInitials(FullUserName,"SP")),$("#divUserPhoto").attr("data-original",CheckinUserPhoto),$("#divUserPhoto").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),$(".profilesidePic").html($("#divUserPhoto").clone()).find("#divUserPhoto").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),$(".loginlink").show(),e.objUserInfo.UserType==_siteBuilderDetail.UserType.ShopAdmin.toString()||e.objUserInfo.UserType==_siteBuilderDetail.UserType.ServiceProvider.toString()||e.objUserInfo.UserType==_siteBuilderDetail.UserType.ShopOwnerServiceProvider.toString()||1==e.objUserInfo.IsAdmin?$("#lnkCalender").show():$("#lnkCalender").hide()}else $(".loginlink").hide(),$(".lnkLogin").show(),$("#divUserName").html("").addClass("hide-notlogged"),$("#divLoginDetail").hide(),$("#divLoginDetailCart").hide(),(_siteBuilderDetail.IsCustomWebsite||1==IsNewCustomWebsite)&&$("#divUserName").addClass("custom-theme-nav")},_siteBuilderDetail.CalendarLinkClick=function(e,t){t.ctrlKey&&"a"==t.target.tagName.toLowerCase()?(e.target="_blank",e.href="/ShopOwner/ChooseBusiness.aspx",e.target=""):location.href="../../../ShopOwner/ChooseBusiness.aspx"},_siteBuilderDetail.lazyloadImages=function(){$(".lazy-bgimg").length>0&&$(".lazy-bgimg").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload"),$(".lazy-img").length>0&&$("img.lazy-img").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload")},_siteBuilderDetail.LoadHeaderMenuLink=function(){"true"==isPromotionUI?($("#imgLogo").attr("alt","Sola"),$("#imgLogoMobile").attr("data-original",adminCDNURL+"/"+_siteBuilderDetail.BusinessPromotionLogoOrBannerPathAkamai+"/"+PromotionLogoImage),$("#imgLogo").attr("src",adminCDNURL+"/"+_siteBuilderDetail.BusinessPromotionLogoOrBannerPathAkamai+"/"+PromotionLogoImage),$("#ancHome").attr("onclick","").attr("href",PromotionSponsorURL).attr("target","_blank"),$("#ancHomeMobile").attr("onclick","").attr("href",PromotionSponsorURL).attr("target","_blank")):($("#imgLogo").attr("alt","Vagaro"),$("#imgLogoMobile").attr("data-original",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.PublicImagesFolder+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.VagaroSmallLogo),$("#imgLogo").attr("src",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.PublicImagesFolder+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.VagaroLogoSvg),$("#ancHome").attr("href","/"),$("#ancHome").removeAttr("rel")),$(".dropdown-arrow").attr("src",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.PublicImagesFolder+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.ArrowDropdown2x),$(".apple-app-store-link").attr("data-original","https://vagaro.azureedge.net/static/assets/vgFooter-ApplePay.png"),$(".google-app-store-link").attr("data-original","https://vagaro.azureedge.net/static/assets/vgFooter-GooglePay.png"),$(".vagaro-poweredlogo").attr("data-original",_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.VagaroLogoPoweredby2x),_siteBuilderDetail.lazyloadImages(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&($("#custrightnav").hide(),$("#custrightnavLogo").hide(),_siteBuilderDetail.isFromAppClip?_siteBuilderDetail.hideHeadeForAppclip():_siteBuilderDetail.hideVIcon(),_siteBuilderDetail.HideFooter()),"undefined"!=typeof vgAppicationType&&2==vgAppicationType&&(_siteBuilderDetail.HideHeader(),_siteBuilderDetail.HideFooter());var e=$(".menu-link-top").find('a[data-tab="headertopmenu"]');($.grep(e,function(e){var t=$(e).attr("data-segment");if(void 0!==t&&null!=t)switch(t){case"listings":$(e).attr("href",GetRootUrl("listings"));break;case"professionals":$(e).attr("href",GetRootUrl("professionals"));break;case"photos":$(e).attr("href",GetRootUrl("photos"));break;case"deals":var i=GetRootUrl("deals");$(e).attr("href",i),$("#dailyDealsFooter").attr("href",i)}}),$("#desktop-menu").length)&&($("#mobile-menu").html(""),$("#desktop-menu").children().clone(!0,!0).appendTo("#mobile-menu"),$("#mobile-menu a").each(function(){$(this).removeClass("profile-dropdown-links w-dropdown-link w-hidden-main").addClass("mobile-dropdown-link"),$(this).removeAttr("rel")}),$(".profilesidePicMobile").html($("#divUserPhoto").clone()).find("#divUserPhoto").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"))},_siteBuilderDetail.hideVIcon=function(){$("#mobilemenutoggle").hide()},_siteBuilderDetail.hideHeadeForAppclip=function(){$("#mobilemenutoggle").removeAttr("onclick"),$("#mobilemenutoggle").find(".dropdown-arrow").hide()},_siteBuilderDetail.HideFooter=function(){$("#footerdiv").hide(),$("#pushdiv").hide(),$("#divFooterPresent").removeClass("footerpresent")},_siteBuilderDetail.HideHeader=function(){$("#menuBar").hide()},_siteBuilderDetail.GetBusinessInfoByID=function(e){var t={merchantID:_siteBuilderDetail.businessID,IsCustomWebsite:_siteBuilderDetail.IsCustomWebsite},i=new vagaroSiteBuilder.ajax;i.datamodel.Token="api/sitebuilder/getbusinessinfobyid",i.datamodel.data=t,i.datamodel.IsVagaroURL=!1,i.datamodel.callback=function(t){$(e).html(t.pageMenu)},i.datamodel.Error=_siteBuilderDetail.CommonError,i.Post()},_siteBuilderDetail.imageErrorStyle=function(e){e.src=_siteBuilderDetail.StaticAkamaiCDNPath+"/Images/detail-banner-default-img.jpg"},_siteBuilderDetail.GetHTMLTemplate=function(e,t,i){var a=function(){0==_siteBuilderDetail.isNullUndefined(t)&&"function"==typeof t&&t()};$("#dvStyleComponentScripts").find("#"+e[1]).length<=0?(window.location.href.toLowerCase().indexOf("http://")>=0&&(vagaroSiteBuilder.BaseURLOfVagaroAPI=vagaroSiteBuilder.BaseURLOfVagaroAPI.replace("https","http")),$.get(vagaroSiteBuilder.BaseURLOfVagaroAPI+e[0],null,function(t){$(t).appendTo("#dvStyleComponentScripts"),$("#"+e[2]).length>0&&$(i).html($("#"+e[2]).html()),a()})):($("#"+e[2]).length>0&&$(i).html($("#"+e[2]).html()),a())},_siteBuilderDetail.BusinessLogoClick=function(e){"pointer"==$(e).css("cursor")?(_siteBuilderDetail.ClickbusinessLogo=1,$($("#divBusinessPhotos .cust-img-popup-slider")[0]).find("#imgServiceImage_0").click()):(_siteBuilderDetail.IsCustomerAppORMobileViewWithoutWidget()&&"book-now"==tabSegment&&($("#divClassAppResult").is(":visible")||$("#divSearch").is(":visible"))||"classes"==tabSegment&&null!=history.state&&"classes"===history.state.subTab)&&_siteBuilderDetail.LoadBusinessDetailPageForCustomerApp()},_siteBuilderDetail.isRequestFromVagaro=$("#hdnSiteBuilderIsRequestFromVagaro").val(),_siteBuilderDetail.ScrollToToZeroReview=function(){$("html, body").animate({scrollTop:0},"slow","linear",function(){$("#backtotop").length&&$("#backtotop").css("display","none")}),$("#about").attr("tabindex",-1).attr("role","heading").focus()},ScrollTarget.scroll(function(){if($("#secAboutReviews").is(":visible"))if("reviews"!=tabSegment){var e=$("#secAboutReviews").offset().top,t=$("#secAboutReviews").outerHeight(),i=ScrollTarget.height(),a=_siteBuilderDetail.getscrollTop(this);isreview=!1,_siteBuilderDetail.InPageWidget_Ios?isreview=e+t+50<=i:isreview=a>e+t+50-i,isreview?($("#backtotop").css("display","block"),$(".backtotopicon").attr("role","button").attr("aria-label","go back to top location")):($("#backtotop").css("display","none"),$(".backtotopicon").removeAttr("role","button").removeAttr("aria-label","go back to top location"))}else(a=_siteBuilderDetail.getscrollTop(this))>30?$("#backtotop").css("display","block"):$("#backtotop").css("display","none")}),_siteBuilderDetail.setTitlePage=function(e){1==_siteBuilderDetail.isCallFromPublicSide()&&"myaccount"!=e&&e!=BusinessTabNameEnum.shopping_bag&&e!=BusinessTabNameEnum.classes&&e!=BusinessTabNameEnum.styles&&e!=BusinessTabNameEnum.deals&&e!=BusinessTabNameEnum.reviews&&e!=BusinessTabNameEnum.addreview&&(document.title=null==$("meta[property='og:title']").attr("content")?$("#busname").text()+" in "+$(".location-text").text().trim().replace(",","")+" | Vagaro":$("meta[property='og:title']").attr("content"))},_siteBuilderDetail.titleCase=function(e){for(var t=null==e?"":e.toLowerCase().split(" "),i=0;i<t.length;i++)t[i]=t[i].charAt(0).toUpperCase()+t[i].substring(1);return t.join(" ")},_siteBuilderDetail.GetClassesComponent=function(e){if("classes"===$(e).data("customComponent")){if(IsNewCustomWebsite&&!_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData(e,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,"classes"))return;$(e).html($("#class-section").html()),_vgClassSessionSelection.LoadClassUserControl()}},_siteBuilderDetail.CallBackForHideShowFooter=function(e){var t=JSON.stringify({barType:1,isHide:!1}).replace(/\\\"/g,'"').replace(/"/g,'\\"'),i='{"message": "","messageType": 0,"screenTitle": "","screenType": 0,"navType": 0,"action": "90|~|'+t+'" }';(e&&(t=JSON.stringify({barType:1,isHide:!0}).replace(/\\\"/g,'"').replace(/"/g,'\\"'),i='{"message": "","messageType": 0,"screenTitle": "","screenType": 0,"navType": 0,"action": "90|~|'+t+'" }'),null!=window.JSInterface)?window.JSInterface.CallWSMethod(i):"ImportOnBoarding"==getQueryStringData("Type")&&0==e?setTimeout(function(){window.location="js-call:myObjectiveCFunction:5006||~||"+i},800):window.location="js-call:myObjectiveCFunction:5006||~||"+i},_siteBuilderDetail.CallbackMobileApp=function(e){if(0!=_siteBuilderDetail.isCallFromPublicSide()){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof IsBrandedApp&&1==IsBrandedApp){_siteBuilderDetail.IsCustomWebsite=!1;var t=e.Images.find(e=>1==e.IsDefault),i=e.BusinessDetail.CDNUrl+_siteBuilderDetail.BusinessPathOriginalAkamai+t.BusinessImagePath,a=window.location.protocol+"//"+e.CommonApiConfigKeys.SiteAddressLink+"/"+e.BusinessDetail.VagaroURL,r='{\\"city\\":\\"'+e.BusinessDetail.City+'\\",\\"stateName\\":\\"'+e.BusinessDetail.StateName+'\\",\\"businessImage\\":\\"'+i+'\\",\\"businessName\\":\\"'+e.BusinessDetail.BusinessName+'\\",\\"lATITUDE\\":\\"'+e.BusinessDetail.LATITUDE+'\\",\\"lONGITUDE\\":\\"'+e.BusinessDetail.LONGITUDE+'\\",\\"vagaroURL\\":\\"'+a+'\\"}';setTimeout(function(){CallbackforMobileApp(0,0,"","","0","16|~|"+r)},3e3)}baIsUndefine(IsBrandedApp)||1!=IsBrandedApp||CallbackforMobileApp(0,0,"","",0,35),baIsUndefine(IsBrandedApp)||1!=IsBrandedApp||baIsUndefine(IsBrandedAppBusinessActive)||0!=IsBrandedAppBusinessActive||CallbackforMobileApp(0,0,"","",0,"36|~|"+_siteBuilderDetail.businessID)}},_siteBuilderDetail.GetAboutMenuSection=function(e){(IsFromMultiLocation||w_type==_siteBuilderDetail.WidgetTypeEnum.NewWindow||w_type==_siteBuilderDetail.WidgetTypeEnum.Popup&&$("#mobile-check").is(":visible"))&&$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).show(),shopdetailFixedNavHTML(e),$("#mobiletabmenu li.active").removeClass("active")},_siteBuilderDetail.CommonError=function(){ShowLoader(!1),vagaro.alert(_siteBuilderDetail.CommonErrorMessage)},_siteBuilderDetail.PaymentErrorHandler=function(e){ShowLoader(!1);var t=e||_siteBuilderDetail.CommonErrorMessage||"Payment could not be completed.";vagaro.alert(t)},_siteBuilderDetail.ShowHideAboutBookNow=function(e){null!=e&&""!=e&&"about"==e.trim()?($("html body").removeClass("addProductbody"),$("body").removeClass("showbusinesslogo").addClass("busAbouttab"),$(".mobilebusinessname").removeClass("mb-web-subheading-font"),Webflow.require("lightbox").ready(),$("#divbusinessatab").css("cursor","pointer")):($("body").removeClass("busAbouttab").addClass("showbusinesslogo"),$(".mobilebusinessname").addClass("mb-web-subheading-font"),$(".w-lightbox").off(".w-lightbox"),$("#divbusinessatab").css("cursor",""))},_siteBuilderDetail.HideWriteReviewPopup=function(e){$("#dvDailyDealsDetail").hide(),$("#divWriteReview").hide(),e||(_siteBuilderDetail.IsCustomWebsite?_siteBuilderDetail.ShowComponent(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]):_siteBuilderDetail.ShowComponent(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]),_siteBuilderDetail.ShowComponent(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection])),$(".pagebodycontainer").show().removeClass("pagesectionFlex")},_siteBuilderDetail.HideComponent=function(e){$(e).hide()},_siteBuilderDetail.ShowComponent=function(e){$(e).show()},_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData=function(e,t,i){var a;$.each(t,function(e,t){t.menuID===i&&(a=t)});var r=!0;return _siteBuilderDetail.isNullUndefined(a)?r=!1:_siteBuilderDetail.isNullUndefined(_siteBuilderDetail.UserLocationInfo.objDynamicMenuData.find(e=>e.menuID===a.menuID))||(r=_siteBuilderDetail.UserLocationInfo.objDynamicMenuData.find(e=>e.menuID===a.menuID).isVisible),!!r||($(e).html("<div class='not-access-modual'><h1> You do not have access to this module.</h1></div>"),!1)},_siteBuilderDetail.findNestedWithObj=function(e,t,i){if(Array.isArray(e)&&e.length>0)for(var a=0;a<e.length;a++){var r=e[a];if(GetSlugTabPageName(r.url_slug)==t)return void(_siteBuilderDetail.FindObj=r);if(1==IsNewCustomWebsite&&!_siteBuilderDetail.isNullUndefined(i)){if(i==LoadMenuTypeEnum.booknow&&r.isBooknowEnable&&!r.isShowHidePage)return void(_siteBuilderDetail.FindObj=r);if(i==LoadMenuTypeEnum.classes&&r.isClassesEnable&&!r.isShowHidePage)return void(_siteBuilderDetail.FindObj=r)}Array.isArray(r.pages)&&r.pages.length>0&&_siteBuilderDetail.findNestedWithObj(r.pages,t,i)}},_siteBuilderDetail.FormatPhone=function(e){var t=e.replace(/\D/g,""),i={0:"(",3:") ",6:"-"};e="";for(var a=0;a<t.length;a++)e+=(i[a]||"")+t[a];return e},_siteBuilderDetail.LinkbuttonRedirectChanges=function(e){if(!0===_siteBuilderDetail.isCallFromPublicSide()){var t=JSON.parse($(e).attr("data-config")).buttonLink,i=JSON.parse($(e).attr("data-config")).redirectLink;_siteBuilderDetail.isNullUndefined(i)||("url"===t?window.open(i,"_blank"):"page"===t&&(document.location.href=i))}},_siteBuilderDetail.InjectMobileMenuForAbout=function(){var e=!1;if($("#mobile-check").is(":visible")&&(e=!0),1==e&&"true"!=isWidget){if(tabSegment==DefaultTabPage){$("#mobiletabmenu ul").html("");var t=$("#tabs.navbar-nav").children().clone(!0,!0),i=$("#topHeadSection").clone(!0,!0);$("<div id='mobiletabmenu' class='mobiletabmenu'><ul class='nav nav-pills' role='tablist'></ul></div>").prependTo(".pagebodycontainer"),$("#mobiletabmenu ul").append(t),$("<div id='mobilemenuheader'></div>").prependTo(".pagebodycontainer"),$("#mobilemenuheader").append(i),"about"==tabSegment&&_siteBuilderDetail.removeContentClass(),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).hide(),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).hide()}else $(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]).hide(),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]).hide();null!=tabSegment&&""!=tabSegment&&"about"==tabSegment?($(".mobilebusinessname").removeClass("mb-web-subheading-font"),$(".viewbusienss").hide()):($(".mobilebusinessname").addClass("mb-web-subheading-font"),$(".viewbusienss").show())}};var Isreaload="41";function LoadAutoReloadIFrame(){!function(e){var t=document.createElement("iframe");t.id="autoreloadiframe",t.style.display="none",t.src=e+"/Autoreload.aspx",document.body.appendChild(t)}(location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")),window.setInterval("reloadIFrame();",12e4)}function reloadIFrame(){var e=document.getElementById("autoreloadiframe");null!=e&&null!=e&&(e.src=e.src)}function setkeepAlive(){!function(e){var t=document.createElement("iframe");t.style.display="none",t.onload=function(){t.parentNode.removeChild(t)};try{t.src=e+"/keepalive.aspx?id="+(Math.random()+1).toString(36).substring(2)}catch(i){t.src=e+"/keepalive.aspx?id=w5a2g"}document.body.appendChild(t)}(location.protocol+"//"+location.hostname+(location.port?":"+location.port:""))}function getSelectInventory(e,t){return t.length>0&&t.forEach(function(i){(e=_siteBuilderDetail.GetSelectedOptionVariant(e,i.VariantId)).length>0&&getSelectInventory(e,t)}),e}function getSiteBuilderObj(){return window.self==window.top&&"undefined"!=typeof _websiteDesigner?_websiteDesigner.getIframeSiteBuilderDetailObj():_siteBuilderDetail}function scrollToBottom(e,t){var i=!0,a=$("#iframe1");if(0!=a.length&&("undefined"==typeof _siteBuilderDetail||null==_siteBuilderDetail||"true"!=_siteBuilderDetail.isRequestFromVagaro)){var r=a.contents();if(0==vagaroSiteBuilder.isNullUndefined(e)&&0==vagaroSiteBuilder.isNullUndefined(e.offset())&&i){r=a.contents();var o,n=getMenuCompHeight(r);if(t){var s=e.prev(".dragDiv"),l=0;s.length>0&&(l=s.outerHeight()),o=e.offset().top-n-l-10}else{var d=0,c=-1;e.children(":visible").each(function(e,t){var i=$(t);c!=i.offset().top&&(d+=i.outerHeight()),c=i.offset().top});var u=Math.max(d/2,50);o=e.offset().top+u-n-10}i=!1,r.find("html,body").animate({scrollTop:o},800,function(){i=!0})}}}function GetStoragevalueforInlineWidget(e){if(void 0!==e&&null!=e&&void 0!==e.Value&&null!=e.Value)Data={},Data.vdsid=e.Value,tmpvdsid=e.Value,vagaro.ajaxCall(ApiURLEnumCommonApi.getwidgetuserdetails,Data,function(e){if(null!=e&&""!=e){widgetcookievalue=tmpvdsid,_siteBuilderDetail.ComponentResponse.lstUserInfo=_siteBuilderDetail.UserLocationInfo.objUserInfo=e;var t="";null!=e.LastName&&(t=e.LastName.length>1?e.LastName.substring(0,1):e.LastName),UserName=e.FirstName+" "+t,$("#hdnUserName").val(UserName),FullUserName=e.FullName,$("#hdnFullUserName").val(FullUserName),UserID=e.UserID.toString(),IsForNewCustomer=1!=_siteBuilderDetail.UserLocationInfo.IsForNewCustomer,$("#hdnUserId").val(UserID),UserType=e.UserType,$("#hdnUserType").val(UserType),UserEmail=e.EmailId,$("#hdnUserEmail").val(UserEmail),UserCellNo=e.Cell,$("#hdnUserCellNo").val(UserCellNo),null!=e.Photo&&""!=e.Photo&&(CheckinUserPhoto=e.CDNUrl+_siteBuilderDetail.UserImage200x0PathAkamai+e.Photo,$("#hdnUserImage").val(CheckinUserPhoto)),$("#hdUserAddress").val(_siteBuilderDetail.UserLocationInfo.UserAddress),$('[id="spnProfile"]').text(FullUserName),_siteBuilderDetail.showLogin(),void 0!==callBackLoginToHome&&"function"==typeof callBackLoginToHome&&callBackLoginToHome(!0),$("#divUserName").removeClass("hide-notlogged")}else try{var i={};i.Key=_siteBuilderDetail.vdsconst,i.Value="","undefined"!=typeof $Interframe&&void 0!==$Interframe.setStoratevalueintoParent&&$Interframe.setStoratevalueintoParent(i)}catch(e){}tmpvdsid=""},_siteBuilderDetail.CommonError,!1,!0);else try{(e={}).Key=_siteBuilderDetail.vdsconst,e.Value="","undefined"!=typeof $Interframe&&void 0!==$Interframe.setStoratevalueintoParent&&$Interframe.setStoratevalueintoParent(e)}catch(e){}}function CheckBusinessUnderMaintenance(e,t){if(e>0){var i={};i.businessId=e,i.groupID=t;var a={};a.Data=""+JSON.stringify([i]),a.Token="CheckBusinessUnderMaintenance",CallProxyMethodWithOutCoreJS(a,this.CheckBusinessUnderMaintenanceSuccess,function(e){})}}function CheckBusinessUnderMaintenanceSuccess(e){null!=e&&null!=e&&e&&location.reload(!0)}function CallProxyMethodWithOutCoreJS(e,t,i){var a="MySampleService.asmx/PageMethodsProxyJson",r=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";"undefined"!=typeof regionId&&""!=regionId&&(r=r+regionId+"/");try{void 0!==e&&null!=e&&null!=e&&(a=a+"?token="+e.Token)}catch(e){}a=r+"WebServices/"+a,$.ajax({url:a,type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify(e),dataType:"json",async:!0,success:function(e){t(e.d)},error:i,beforeSend:function(e){e.setRequestHeader("K",getek()),e.setRequestHeader("I",getei()),e.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&e.setRequestHeader("keepAlive",keepAlive),1==$("#hdnToken1").length&&void 0!==$("#hdnToken1").val()&&e.setRequestHeader("token1",$("#hdnToken1").val()),1==$("#hdnToken2").length&&void 0!==$("#hdnToken2").val()&&e.setRequestHeader("token2",$("#hdnToken2").val()),1==$("#hdnToken0").length&&void 0!==$("#hdnToken0").val()&&e.setRequestHeader("token0",$("#hdnToken0").val())}})}function TrackFacebookPageView(){setTimeout(function(){if("undefined"!=typeof fbq&&""!=fbEncryptedBusiness)try{"undefined"!=typeof PixelId&&""!=PixelId&&fbq("init",PixelId),setTimeout(function(){fbq("track","PageView",{business_id:fbEncryptedBusiness,facebook_cta:"true"==isFacebookoAuth?1:0})},200)}catch(e){}},500)}function GetBusinessID(){return businessID}function IsDoingUpload(){"true"==isDoingUpload&&($("#mobilemenutoggle").attr("onclick","javascript:void(0);"),$(".dropdown-arrow").hide())}function ReplaceURL(e){if(0==location.pathname.includes("/product-detail/"))if(e){$(".div-share-button").show();var t=location.origin+"/"+location.pathname.split("/")[1]+"/"+location.pathname.split("/")[2]+"/"+$("#spanProductCat").text().trim().toLowerCase().replace(_siteBuilderDetail.URLReplaceExp,"-")+"/"+$("#spanProductTitle").text().trim().toLowerCase().replace(_siteBuilderDetail.URLReplaceExp,"-")+"/"+_siteBuilderDetail.variantForCheckout.createLink;"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&isFromTextMarketing&&window.location.pathname.indexOf("/promotiontm/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0?t+=window.location.pathname.substring(window.location.pathname.indexOf("/promotiontm/")):"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&!isFromTextMarketing&&window.location.pathname.indexOf("/promotion/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0&&(t+=window.location.pathname.substring(window.location.pathname.indexOf("/promotion/"))),history.replaceState(null,null,t)}else{var i="";location.pathname.includes("/products/connect")&&void 0!==getCookie("connectroute")&&null!=getCookie("connectroute")&&getCookie("connectroute")?i="/connect":location.pathname.includes("/products/connect")&&void 0!==getCookie("connectairoute")&&null!=getCookie("connectairoute")&&getCookie("connectairoute")?i="/connectai":"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&isFromTextMarketing&&window.location.pathname.indexOf("/promotiontm/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0?i=window.location.pathname.substring(window.location.pathname.indexOf("/promotiontm/")):"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&"undefined"!=typeof isFromTextMarketing&&!isFromTextMarketing&&window.location.pathname.indexOf("/promotion/")>0&&window.location.pathname.indexOf(PromotionAppointmentID)>0&&(i=window.location.pathname.substring(window.location.pathname.indexOf("/promotion/")));t=location.origin+"/"+location.pathname.split("/")[1]+"/products"+i;history.replaceState(null,null,t)}}_siteBuilderDetail.onComponentInitMethod=function(e,t){switch(t){case"pageproducts":_siteBuilderDetail.onProductInitMethod(e,!0);break;case"pagebusinessinfosection":_siteBuilderDetail.onBusinessInfoSectionInitMethod(e,!0);break;case"pageaboutusreviewsection":_siteBuilderDetail.onAboutusReviewSectionInitMethod(e,!0);break;case"pagemapsection":_siteBuilderDetail.onBusinessMapSectionInitMethod(e,!0);break;case"pageworkinghourssection":_siteBuilderDetail.onBusinesHoursSectionInitMethod(e,!0);break;case"pagestaff":_siteBuilderDetail.onBusinesStaffSectionInitMethod(e,!0);break;case"pagebooknowsearch":getSiteBuilderObj().BookNow(e);break;case"pagedailydealssection":_siteBuilderDetail.onDailyDealSectionInitMethod(e,!0);break;case"pagephotosection":_siteBuilderDetail.onBusinessPhotoSectionInitMethod(e,!0);break;case"pageservices":_siteBuilderDetail.onServiceInitMethod(e,!0);break;case"pagemembership":_siteBuilderDetail.onMembershipInitMethod(e,!0);break;case"pagepackage":_siteBuilderDetail.onPackageInitMethod(e,!0);break;case"pagegiftcard":_siteBuilderDetail.onGiftCardInitMethod(e,!0);break;case"pagedescriptionsection":_siteBuilderDetail.onBusinessDescriptionSectionInitMethod(e,!0);break;case"pagemenusection":_siteBuilderDetail.onPageMenuSectionInitMethod(e,!0);break;case"pagefootersection":_siteBuilderDetail.onPageFooterSectionInitMethod(e,!0);break;case"pageheadersection":getSiteBuilderObj().GetPageHeaderSectionComponent(e,!1);break;case"pagecustomheadersection":getSiteBuilderObj().GetPageHeaderSectionComponent(e,!0);break;case"pagemyaccount":getSiteBuilderObj().GetMyAccountTab(e);break;case"pagestyles":_siteBuilderDetail.onStyleSectionInitMethod(e,!0);break;case"classes":getSiteBuilderObj().GetClassesComponent(e);break;case"shoppingBag":getSiteBuilderObj().GetShoppingBagComponent(e);break;case"pagereviewsdetailsection":_siteBuilderDetail.onPageReviewSectionInitMethod(e,!0);break;case"aboutmenusection":_siteBuilderDetail.GetAboutMenuSection(e)}},_siteBuilderDetail.onBusinessDescriptionSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageDescriptionsectionComponent,function(){return getSiteBuilderObj().GetDescriptionSectionComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onPageMenuSectionInitMethod=function(e,t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.PageMenuComponent,function(){if(getSiteBuilderObj().GetnavbarMenuSectionComponent(e),!vagaroSiteBuilder.isNullUndefined($(e).attr("data-config"))){var t=JSON.parse($(e).attr("data-config")).businesslogo,i=JSON.parse($(e).attr("data-config")).logowidth,a=JSON.parse($(e).attr("data-config")).logoheight;$(e).find("li.mobile-hide a img").attr("src",t),_siteBuilderDetail.StyleManagerSetStyle($(e).find("li.mobile-hide a img"),"width",i),_siteBuilderDetail.StyleManagerSetStyle($(e).find("li.mobile-hide a img"),"height",a),$(e).find("div.logo-yield a img").attr("src",t),_siteBuilderDetail.StyleManagerSetStyle($(e).find("div.logo-yield a img"),"width",i),_siteBuilderDetail.StyleManagerSetStyle($(e).find("div.logo-yield a img"),"height",a)}return!1},e)},_siteBuilderDetail.onPageFooterSectionInitMethod=function(e,t){!0===t&&getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.FooterComponent,function(){var t=$("#srpt-footercomponent-section"),i=getSiteBuilderObj().UserLocationInfo.Model.BusinessDetail;i.BusinessAddress=i.Street+","+i.City+","+i.StateCode+","+i.Zip,i.BusinessPhoneNo=i.Telephone;var a={BusinessAddress:i.BusinessAddress,Businessphone:vagaroSiteBuilder.isNullUndefined(i.BusinessPhoneNo)?getSiteBuilderObj().FormatPhone("8055551234"):getSiteBuilderObj().FormatPhone(i.BusinessPhoneNo)};if(t.length>0&&t.tmpl(a).appendTo(e),!vagaroSiteBuilder.isNullUndefined($(e).attr("data-config"))){var r=JSON.parse($(e).attr("data-config")).businesslogo,o=JSON.parse($(e).attr("data-config")).logowidth,n=JSON.parse($(e).attr("data-config")).logoheight,s=JSON.parse($(e).attr("data-config")).footer_address,l=JSON.parse($(e).attr("data-config")).footer_phone,d=JSON.parse($(e).attr("data-config")).footer_custom,c=JSON.parse($(e).attr("data-config")).footer_customdata,u=JSON.parse($(e).attr("data-config")).hidepower;$(e).find("footer div.logo-yield a img").attr("src",r),_siteBuilderDetail.StyleManagerSetStyle($(e).find("footer div.logo-yield a img"),"width",o),_siteBuilderDetail.StyleManagerSetStyle($(e).find("footer div.logo-yield a img"),"height",n),_siteBuilderDetail.StyleManagerSetStyle($(e).find("footer.temp-footer"),"background-color",$(e).css("background-color")),_siteBuilderDetail.StyleManagerSetStyle($(e).find(".temp-address"),"color",$(e).css("color")),_siteBuilderDetail.StyleManagerSetStyle($(e).find("a.vagaro-poweredlogo.lazy-bgimg"),"display",u),_siteBuilderDetail.StyleManagerSetStyle($(e).find("#footer_address"),"display",s),_siteBuilderDetail.StyleManagerSetStyle($(e).find("#footer_phone"),"display",l),_siteBuilderDetail.StyleManagerSetStyle($(e).find("#footer_custom"),"display",d),$(e).find("#footer_custom").html(c)}var p=$("#iframe1").contents().find("body");return"false"===getSiteBuilderObj.isRequestFromVagaro&&p.find(".temp-footer").click(),!1},e)},_siteBuilderDetail.onStyleSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageStylesComponent,function(){return getSiteBuilderObj().GetBusinessStylesComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onPageReviewSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageReviewsDetailSectionComponent,function(){return getSiteBuilderObj().GetBusinessReviewComponent(e),!1},e)}},_siteBuilderDetail.onMembershipInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.MembershipComponent,function(){return getSiteBuilderObj().GetBusinessMembershipComponent(e),scrollToBottom($(e),!0),_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.loadAffirm(),!1},e)}},_siteBuilderDetail.onPackageInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.PackageComponent,function(){return getSiteBuilderObj().GetBusinessPackageComponent(e),scrollToBottom($(e),!0),_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.loadAffirm(),!1},e)}},_siteBuilderDetail.onGiftCardInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.GiftCardComponent,function(){return getSiteBuilderObj().GetGiftCardComponent(e),scrollToBottom($(e),!0),_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.loadAffirm(),!1},e)}},_siteBuilderDetail.InitAccordionAffirmRefresh=function(){var e={},t=$("#accordion .widget-service-box.show");if(t.length>0){var i=t.attr("id")||t.index();e[i]=!0,t.find("[data-amount]").addClass("affirm-as-low-as")}_siteBuilderDetail.loadAffirm();var a=0,r=setInterval(function(){"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?(clearInterval(r),affirm.ui.refresh()):++a>10&&(clearInterval(r),console.warn("Affirm failed to initialize on page load."))},300);$(document).off("show.bs.collapse.affirm").on("show.bs.collapse.affirm","#accordion .widget-service-box",function(){var t=$(this),i=t.attr("id")||t.index();if(t.find("[data-amount]").addClass("affirm-as-low-as"),!e[i]){e[i]=!0;var a=0,r=setInterval(function(){"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?(clearInterval(r),affirm.ui.refresh()):++a>10&&(clearInterval(r),console.warn("Affirm failed to load in time."))},300)}}),$(document).off("hide.bs.collapse.affirm").on("hide.bs.collapse.affirm","#accordion .widget-service-box",function(){$(this).find("[data-amount]").removeClass("affirm-as-low-as")})},_siteBuilderDetail.onServiceInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.ServiceComponent,function(){return getSiteBuilderObj().GetBusinessServiceComponent(e),scrollToBottom($(e),!0),setTimeout(function(){_siteBuilderDetail.InitAccordionAffirmRefresh()},1e3),!1},e)}},_siteBuilderDetail.onBusinessPhotoSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPagePhotoSectionComponent,function(){var t=getSiteBuilderObj();return void 0!==e&&"pagephotosection"===e.getAttribute("data-custom-component")&&t.GetPhotoSectionComponent(e),t.afterInit=function(){try{var t=JSON.parse($(e).attr("data-config")).gridgutter;$(e).find(".cust-img-popup-slider").css("margin-right",t)}catch(e){}},scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onProductInitMethod=function(e,t){if(t){var i={MerchantId:""};"undefined"!=typeof staticEncryptBusinessID&&null!=staticEncryptBusinessID&&(i.MerchantId=staticEncryptBusinessID),vagaro.ajaxCallV2(V2APIURLEnum.GetCustomersProductCategories,{},null,null,_siteBuilderDetail.GetProductCategories_Success,_siteBuilderDetail.GetProductCategories_Fail,!1,!1,i,!0);getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.ProductComponent,function(){return getSiteBuilderObj().GetBusinessProductComponent(e),scrollToBottom($(e),!0),_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.loadAffirm(),!1},e)}},_siteBuilderDetail.GetProductCategories_Success=function(e){e.status==vagaro.VagaroCoreApiStatusCode.OK&&e.responseCode==vagaro.VagaroCoreApiResponseCode.Success&&(_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories=e.data.categories,_siteBuilderDetail.ComponentResponse.lstProduct.cacheBrands=e.data.brands,_siteBuilderDetail.ComponentResponse.lstProduct.cacheOptions=e.data.options,_siteBuilderDetail.ProductTabHeader(!0),_siteBuilderDetail.BindCategory(""),_siteBuilderDetail.BindBrands(),_siteBuilderDetail.BindOptions())},_siteBuilderDetail.GetProductCategories_Fail=function(){},_siteBuilderDetail.categoryFilterList=function(e){var t=[];return void 0!==_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories&&null!=_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories&&_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.length>0&&(t=_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.filter(t=>""==e?t.parentCategoryId==e:t.id==e).map(e=>({...e,isParent:!0,children:_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.filter(t=>t.parentCategoryId===e.id)}))),t},_siteBuilderDetail.BindCategory=function(e){void 0!==_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories&&null!=_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories&&_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.length>0&&(categoryList=_siteBuilderDetail.categoryFilterList(e),categoryList.length>0&&(categoryList[0].children.length>0||""==e)&&($("#collapseOneList").html(""),$("#srpt-parentcategory").tmpl(categoryList).appendTo($("#collapseOneList"))))},_siteBuilderDetail.BindChildCategory=function(e,t){categoryList=_siteBuilderDetail.categoryFilterList(e),categoryList.length>0&&categoryList[0].children.length>0&&_siteBuilderDetail.BindCategory(e),categoryList.length>0&&categoryList[0].children.length<6&&$("html, body").animate({scrollTop:0},"slow");var i=_siteBuilderDetail.ComponentResponse.lstProduct.cacheCategories.filter(e=>e.id==categoryList[0].parentCategoryId&&""==e.parentCategoryId);String.isNullOrUndefineOrBlank(i)||1!=i.length||0!=_siteBuilderDetail.breadCrumbs.length||((a={}).parentId=i[0].id,a.name=i[0].name,a.isLastChild=!1,a.sequence=_siteBuilderDetail.breadCrumbs.length+1,_siteBuilderDetail.breadCrumbs.push(a));if(0==_siteBuilderDetail.breadCrumbs.filter(t=>t.parentId==e).length){var a;_siteBuilderDetail.breadCrumbs.filter(t=>t.isLastChild&&t.parent!=e).length>0&&(_siteBuilderDetail.breadCrumbs=_siteBuilderDetail.breadCrumbs.filter(e=>!e.isLastChild)),(a={}).parentId=e,a.name=t,a.isLastChild=null!=categoryList&&0==categoryList[0].children.length,a.sequence=_siteBuilderDetail.breadCrumbs.length+1,_siteBuilderDetail.breadCrumbs.push(a);const i=_siteBuilderDetail.breadCrumbs.length;_siteBuilderDetail.breadCrumbs=_siteBuilderDetail.breadCrumbs.map(e=>({...e,count:i})),$("#breadcrumbslist").html(""),$("#srpt-categorybreadcrumbslist").tmpl(_siteBuilderDetail.breadCrumbs.sort((e,t)=>e.sequence-t.sequence)).appendTo($("#breadcrumbslist"))}$("#mobile-check").is(":visible")||(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData()),_siteBuilderDetail.SowHideMobileFilterFooter()},_siteBuilderDetail.SowHideMobileFilterFooter=function(){$("#divFiltermenuFooter").hide(),$("#mobile-check").is(":visible")&&(_siteBuilderDetail.breadCrumbs.length>0||_siteBuilderDetail.filterTabs.length>0)&&$("#divFiltermenuFooter").show()},_siteBuilderDetail.BreadCrumbsChange=function(e,t){$("html body").removeClass("isDetailPageClass");var i=_siteBuilderDetail.breadCrumbs.filter(e=>e.sequence<=t);if(i.length>0&&(_siteBuilderDetail.breadCrumbs=i),0==t&&$("#swiperSyncMainBody .hasVideoSync1").length>0){var a=document.getElementById("videoPlayer");String.isNullOrUndefineOrBlank(a)||a.pause()}const r=_siteBuilderDetail.breadCrumbs.length;_siteBuilderDetail.breadCrumbs=_siteBuilderDetail.breadCrumbs.map(e=>({...e,count:r})),$("#divInventoryContainer").show(),$("#accordion").show(),$(".div-share-button").show(),$("#div-search").show(),_siteBuilderDetail.ProductTabHeader(!0),_siteBuilderDetail.BindCategory(e),""==e?(_siteBuilderDetail.breadCrumbs=new Array,_siteBuilderDetail.ClearAllFilter(),$("#mobile-check").is(":visible")&&(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData())):(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData()),$("#breadcrumbslist").html(""),$("#srpt-categorybreadcrumbslist").tmpl(_siteBuilderDetail.breadCrumbs.sort((e,t)=>e.sequence-t.sequence)).appendTo($("#breadcrumbslist"))},_siteBuilderDetail.BindBrands=function(){void 0!==_siteBuilderDetail.ComponentResponse.lstProduct.cacheBrands&&null!=_siteBuilderDetail.ComponentResponse.lstProduct.cacheBrands&&_siteBuilderDetail.ComponentResponse.lstProduct.cacheBrands.length>0&&($("#brandList").html(""),$("#srpt-brandlist").tmpl(_siteBuilderDetail.ComponentResponse.lstProduct.cacheBrands).appendTo($("#brandList")))},_siteBuilderDetail.BindOptions=function(){if(void 0!==_siteBuilderDetail.ComponentResponse.lstProduct.cacheOptions&&null!=_siteBuilderDetail.ComponentResponse.lstProduct.cacheOptions&&_siteBuilderDetail.ComponentResponse.lstProduct.cacheOptions.length>0){const e=_siteBuilderDetail.ComponentResponse.lstProduct.cacheOptions;e.forEach((e,t)=>{e.index=t}),$("#optionsList").html(""),$("#srpt-optionlist").tmpl(e).appendTo($("#optionsList"))}},_siteBuilderDetail.BrandCheckChange=function(e,t,i){var a=null;if(String.isNullOrUndefineOrBlank(_siteBuilderDetail.filterTabs)&&(_siteBuilderDetail.filterTabs=[]),String.isNullOrUndefineOrBlank(_siteBuilderDetail.selectedBrands)&&(_siteBuilderDetail.selectedBrands=[]),1==e.checked){var r={};r.Id=t,r.Name=i,r.Sequence=_siteBuilderDetail.filterTabs.length,r.Type=1,_siteBuilderDetail.selectedBrands.push(r),_siteBuilderDetail.filterTabs.push(r),$(e.parentElement.parentElement).addClass("active"),$("html, body").animate({scrollTop:0},"slow")}else Array.isArray(_siteBuilderDetail.selectedBrands)&&(a=_siteBuilderDetail.selectedBrands.filter(e=>e.Id==t)[0].Sequence,_siteBuilderDetail.selectedBrands=_siteBuilderDetail.selectedBrands.filter(e=>e.Id!==t),_siteBuilderDetail.filterTabs=_siteBuilderDetail.filterTabs.filter(e=>e.Id!==t)),$(e.parentElement.parentElement).removeClass("active");$("#mobile-check").is(":visible")||(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData()),_siteBuilderDetail.BindFilterTabs(a)},_siteBuilderDetail.CreateOptionJson=function(e){const t={};return e.forEach(e=>{t[e.Id]?t[e.Id]+=`, ${e.Name}`:t[e.Id]=e.Name}),JSON.stringify(t)},_siteBuilderDetail.OptionCheckChange=function(e,t,i){var a=null;if(String.isNullOrUndefineOrBlank(_siteBuilderDetail.filterTabs)&&(_siteBuilderDetail.filterTabs=[]),String.isNullOrUndefineOrBlank(_siteBuilderDetail.selectedOptions)&&(_siteBuilderDetail.selectedOptions=[]),1==e.checked){var r={};r.Id=i,r.Name=t,r.Sequence=_siteBuilderDetail.filterTabs.length,r.Type=2,_siteBuilderDetail.selectedOptions.push(r),_siteBuilderDetail.filterTabs.push(r),$(e.parentElement.parentElement).addClass("active"),$("html, body").animate({scrollTop:0},"slow")}else Array.isArray(_siteBuilderDetail.selectedOptions)&&(a=_siteBuilderDetail.selectedOptions.filter(e=>e.Name===t)[0].Sequence,_siteBuilderDetail.selectedOptions=_siteBuilderDetail.selectedOptions.filter(e=>e.Name!==t),_siteBuilderDetail.filterTabs=_siteBuilderDetail.filterTabs.filter(e=>e.Name!==t)),$(e.parentElement.parentElement).removeClass("active");$("#mobile-check").is(":visible")||(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData()),_siteBuilderDetail.BindFilterTabs(a)},_siteBuilderDetail.BindFilterTabs=function(e){void 0!==e&&null!=e&&(_siteBuilderDetail.filterTabs=_siteBuilderDetail.filterTabs.map(t=>({...t,Sequence:e<t.Sequence?t.Sequence-1:t.Sequence}))),$("#divFilterTabs").hide(),!String.isNullOrUndefineOrBlank(_siteBuilderDetail.filterTabs)&&_siteBuilderDetail.filterTabs.length>0&&($("#divFilterTabs").show(),$("#ul-filter-tabs").html(""),$("#srpt-filtertabs").tmpl(_siteBuilderDetail.filterTabs).appendTo($("#ul-filter-tabs")),$("#ul-filter-tabs").append("<li><span class='spnClearAll'><button class='filterBtnClearAll' onclick='_siteBuilderDetail.ClearAllFilter()'>Clear All</button></span></li>")),_siteBuilderDetail.SowHideMobileFilterFooter()},_siteBuilderDetail.ClearFilter=function(e,t){var i=new Event("click");if(1==e)(a=document.getElementById("brand_"+t))&&(a.checked=!1,a.dispatchEvent(i));else if(2==e){var a;(a=document.getElementById("optionChild_"+t))&&(a.checked=!1,a.dispatchEvent(i))}},_siteBuilderDetail.ClearAllFilter=function(e){_shopdetail.isShareLink=!1,$("#ul-filter-tabs").html(""),_siteBuilderDetail.selectedBrands=[],_siteBuilderDetail.selectedOptions=[],_siteBuilderDetail.filterTabs=[],_siteBuilderDetail.selectedVariant=[],_siteBuilderDetail.customersProductDetailsCache=[],_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText="",$(".product-child-options:checked").each(function(){$(this).parent().parent().removeClass("active")}),$(".product-child-options:checked").prop("checked",!1),$(".product-brand-list:checked").each(function(){$(this).parent().parent().removeClass("active")}),$(".product-brand-list:checked").prop("checked",!1),void 0!==e&&1==e?(_siteBuilderDetail.breadCrumbs=[],$("#breadcrumbslist").html(""),String.isNullOrUndefineOrBlank(_siteBuilderDetail.GetLoadBusinessProduct)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.GetLoadBusinessProduct.options.Data)||(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches=null,_siteBuilderDetail.GetLoadBusinessProduct.options.Data.options="",_siteBuilderDetail.GetLoadBusinessProduct.options.Data.productTypeIds="",_siteBuilderDetail.GetLoadBusinessProduct.options.Data.brandIds="")):("none"!==$("#mobiletabmenu").css("display")&&(_siteBuilderDetail.breadCrumbs=[],$("#breadcrumbslist").html(""),_siteBuilderDetail.BindCategory(0)),_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData())},_siteBuilderDetail.ProductDetailImageSlider=function(e){_siteBuilderDetail.ProductDetailImageSliderLargeReset();var t=4;!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache)&&!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.images)&&_siteBuilderDetail.customersProductDetailsCache.images.length>t&&(t=_siteBuilderDetail.customersProductDetailsCache.images.length),_siteBuilderDetail.sliderThumbnail&&e&&(_siteBuilderDetail.sliderThumbnail.destroy(!0,!0),_siteBuilderDetail.sliderThumbnail=null),_siteBuilderDetail.sliderThumbnail=new Swiper("#swiperSyncThumb",{slidesPerView:4,freeMode:!0,watchSlidesVisibility:!0,watchSlidesProgress:!0,loop:!1}),_siteBuilderDetail.swiperSyncMain&&e&&(_siteBuilderDetail.swiperSyncMain.destroy(!0,!0),_siteBuilderDetail.swiperSyncMain=null),_siteBuilderDetail.swiperSyncMain=new Swiper("#swiperSyncMain",{slidesPerView:1,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},thumbs:{swiper:_siteBuilderDetail.sliderThumbnail},pagination:{el:".swiper-pagination",clickable:!0,renderBullet:function(e,t){const i=document.querySelectorAll("#swiperSyncMain .swiper-slide")[e];return`<span class="${t} ${i&&i.querySelector("video")?"hasVideoDot":""}" \n              role="button" aria-label="Go to slide ${e+1}"></span>`}},on:{slideChange:function(){const e=this.activeIndex;document.querySelectorAll("#swiperSyncMain .swiper-pagination span").forEach((t,i)=>{i===e?t.classList.add("swiper-pagination-bullet-active"):t.classList.remove("swiper-pagination-bullet-active")});var t=$("#swiperSyncMain").find("video")[0];t&&!t.paused&&t.pause();var i=$("#modalProductImg").find("video")[0];i&&!i.paused&&i.pause()}}}),_siteBuilderDetail.ProductDetailImageSliderLarge(),$(document).ready(function(){$("#modalProductImg").off("hidden.bs.modal").on("hidden.bs.modal",function(){_siteBuilderDetail.ProductDetailImageSliderLargeReset();var e=$("#modalProductImg").find("video")[0];e&&!e.paused&&e.pause()})}),$("#swiperSyncThumb").on("click",".swiper-slide",function(e){if(e.preventDefault(),$("#swiperSyncThumb .swiper-slide-thumb-active .hasVideoSync2").is(":visible"))setTimeout(()=>{const e=document.getElementById("videoPlayer");e&&e.play().catch(e=>{console.error("Playback error:",e)})},500);else if($("#swiperSyncThumb .hasVideoSync2").length>0){const e=document.getElementById("videoPlayer");e&&e.pause()}})},_siteBuilderDetail.ProductDetailImageSliderLarge=function(){function e(){const e=window.innerHeight;document.documentElement.style.setProperty("--vh",`${e}px`)}_siteBuilderDetail.swiperSyncLarge=new Swiper("#swiperSyncLarge",{loop:!1,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},slidesPerView:1,spaceBetween:0,speed:500,allowTouchMove:!(window.innerWidth>768),panOnMouseMove:!1,...window.innerWidth<=768&&{zoom:{maxRatio:6,minRatio:1,toggle:!0}},on:{zoomChange(e,t,i){if(window.innerWidth<=768){_siteBuilderDetail.ProductDetailImageSliderLargeReset();const i=e.el.querySelector(".swiper-slide-active .swiper-zoom-container");t>1?(document.body.classList.add("zoom-active"),e.allowTouchMove=!1):(document.body.classList.remove("zoom-active"),e.allowTouchMove=window.innerWidth<=768,e.zoomHandleMouseMove&&(i.removeEventListener("mousemove",e.zoomHandleMouseMove),e.zoomHandleMouseMove=null))}},slideChange(e){const t=document.querySelector("#swiperSyncLarge .swiper-button-prev"),i=document.querySelector("#swiperSyncLarge .swiper-button-next"),a=0===e.activeIndex,r=e.activeIndex===e.slides.length-1;t.style.display=a?"none":"block",i.style.display=r?"none":"block",e.zoom&&e.zoom.scale>1&&e.zoom.out();const o=$("#swiperSyncMain").find("video")[0];o&&!o.paused&&o.pause();const n=$("#modalProductImg").find("video")[0];n&&!n.paused&&n.pause(),e.slides.forEach((e,t)=>{const i=document.querySelectorAll("#swiperSyncLarge .swiper-pagination-bullet")[t];i&&(e.querySelector("video")?i.classList.add("hasVideoDot"):i.classList.remove("hasVideoDot"))})}},pagination:{el:".swiper-pagination",clickable:!0,renderBullet:function(e,t){const i=document.querySelectorAll("#swiperSyncLarge .swiper-slide")[e];return`<span class="${t} ${i&&i.querySelector("video")?"hasVideoDot":""}" \n       role="button" aria-label="Go to slide ${e+1}"></span>`}}}),window.addEventListener("resize",()=>{const e=window.innerWidth<=768;_siteBuilderDetail.swiperSyncLarge.allowTouchMove=e,e&&_siteBuilderDetail.swiperSyncLarge.update()}),_siteBuilderDetail.swiperSyncLarge.on("init",function(){const e=document.querySelector("#swiperSyncLarge .swiper-button-prev"),t=document.querySelector("#swiperSyncLarge .swiper-button-next");e.style.display="none",t.style.display=_siteBuilderDetail.swiperSyncLarge.slides.length>1?"block":"none"}),window.innerWidth>=768&&_siteBuilderDetail.ProductZoomJqueryFunc(),e(),window.addEventListener("resize",e)},_siteBuilderDetail.ProductZoomJqueryFunc=function(){$("html body").removeClass("zoomedImageClass");const e=$(".previewImageItem");"function"==typeof $.fn.zoom&&e&&(e.trigger("zoom.destroy"),e.zoom({on:"click",magnify:.8,onZoomIn:function(){e.addClass("activeZoom"),$("html body").addClass("zoomedImageClass")},onZoomOut:function(){e.removeClass("activeZoom"),$("html body").removeClass("zoomedImageClass")}}))},_siteBuilderDetail.ProductDetailImageSliderLargeReset=function(){_siteBuilderDetail&&_siteBuilderDetail.swiperSyncLarge?(_siteBuilderDetail.swiperSyncLarge.slides.forEach(e=>{const t=e.querySelector(".swiper-zoom-container");t&&(t.style.transform="translate3d(0px, 0px, 0px) scale(1)");const i=e.querySelector("img");i&&(i.style.transform="translate3d(0px, 0px, 0px) scale(1)")}),_siteBuilderDetail.swiperSyncLarge.slides.forEach(e=>{const t=e.querySelector(".swiper-zoom-container");t&&_siteBuilderDetail.swiperSyncLarge.zoomHandleMouseMove&&(t.removeEventListener("mousemove",_siteBuilderDetail.swiperSyncLarge.zoomHandleMouseMove),_siteBuilderDetail.swiperSyncLarge.zoomHandleMouseMove=null)}),document.body.classList.remove("zoomedImageClass"),_siteBuilderDetail.swiperSyncLarge.allowTouchMove=!1):console.error("_siteBuilderDetail.swiperSyncLarge is not defined")},$(document).on("keydown",function(e){if($("#modalProductImg:visible").length>0){const t=_siteBuilderDetail.swiperSyncLarge;t&&(39===e.keyCode?(t.slideNext(),e.preventDefault()):37===e.keyCode&&(t.slidePrev(),e.preventDefault()))}}),_siteBuilderDetail.DisableorHideOptions=function(e,t){return _siteBuilderDetail.selectedVariant=[],_siteBuilderDetail.objVariant=[],2===_siteBuilderDetail.customersProductDetailsCache.inventory.type?t.forEach(function(e){e.options.forEach(function(t){String.isNullOrUndefineOrBlank(t.variants)||t.variants.forEach(function(i){var a=_siteBuilderDetail.GetSelectedOptionVariant(_siteBuilderDetail.customersProductDetailsCache.variants,i.id);if(a.length>0&&_siteBuilderDetail.selectedVariant.length>0){var r=_siteBuilderDetail.selectedVariant.filter(i=>i.OptionOrderId<t.sortOrderId&&i.parentIndexNo==e.indexNo);r.length>0&&r.forEach(function(e){a=_siteBuilderDetail.GetSelectedOptionVariant(a,e.VariantId)})}_siteBuilderDetail.OptionsOperation(a,i.id,e.indexNo,t.displayAs,i.colorCode,t.indexNo,t.sortOrderId,i.variantName)})})}):e.forEach(function(e){String.isNullOrUndefineOrBlank(e.vanriants)||e.vanriants.forEach(function(t){var i=_siteBuilderDetail.GetSelectedOptionVariant(_siteBuilderDetail.customersProductDetailsCache.variants,t.id);if(i.length>0&&_siteBuilderDetail.selectedVariant.length>0){var a=_siteBuilderDetail.selectedVariant.filter(t=>t.OptionOrderId<e.sortOrderId&&1==t.parentIndexNo);a.length>0&&a.forEach(function(e){i=_siteBuilderDetail.GetSelectedOptionVariant(i,e.VariantId)})}_siteBuilderDetail.OptionsOperation(i,t.id,1,e.displayAs,t.colorCode,e.indexNo,e.sortOrderId,t.variantName)})}),_siteBuilderDetail.objVariant},_siteBuilderDetail.OptionsOperation=function(e,t,i,a,r,o,n,s){if(!String.isNullOrUndefineOrBlank(e)&&e.length>0){if(0==e.filter(e=>e.quantity>=1).length&&2==e[0].zeroQuantityVisibility)_siteBuilderDetail.SoldOutOptions(t,i,a,r);else if(!_siteBuilderDetail.selectedVariant.some(e=>e.OptionOrderId==n&&e.parentIndexNo==i)){var l={};if(l.IndexNo=o,l.OptionOrderId=n,l.VariantId=t,l.parentIndexNo=i,_siteBuilderDetail.selectedVariant.push(l),2==_siteBuilderDetail.customersProductDetailsCache.inventory.type){if(1==e.length&&!_siteBuilderDetail.objVariant.some(t=>t.inventoryId==e[0].inventoryId&&t.parentIndexNo==i)){var d={...e[0]};d.parentIndexNo=i,_siteBuilderDetail.objVariant.push(d)}}else 1==e.length&&_siteBuilderDetail.objVariant.push(e[0]);_siteBuilderDetail.ActiveOptions(t,i,a,r,o,n,s,!0)}}else _siteBuilderDetail.SoldOutOptions(t,i,a,r)},_siteBuilderDetail.ActiveOptions=function(e,t,i,a,r,o,n,s){if(i==_siteBuilderDetail.DisplayOptionEnum.Chips)document.getElementById("option_chip_"+t+"_"+e).disabled=!1,s&&document.getElementById("option_chip_"+t+"_"+e).classList.add("active");else if(i==_siteBuilderDetail.DisplayOptionEnum.Dropdown)document.getElementById("option_dropdown_"+t+"_"+e).classList.remove("disabled"),s&&(_siteBuilderDetail.selectOption(n,e,!0,o,r,t),document.getElementById("option_dropdown_"+t+"_"+e).classList.add("active"));else if(i==_siteBuilderDetail.DisplayOptionEnum.Image){(l=document.getElementById("option_image_"+t+"_"+e)).classList.remove("optiondivdisabled"),l.classList.remove("SoldOut"),s&&(l.classList.add("active-select"),String.isNullOrUndefineOrBlank(n)||$("#optionvalue-"+o+"-"+r+"-"+t).text(n))}else if(i==_siteBuilderDetail.DisplayOptionEnum.ColorSwatch){var l;(l=document.getElementById("option_color_"+t+"_"+e)).classList.remove("optiondivdisabled"),l.classList.remove("active-sold"),l.classList.remove(a),l.innerHTML="",s&&(l.classList.add("active-select"),String.isNullOrUndefineOrBlank(n)||$("#optionvalue-"+o+"-"+r+"-"+t).text(n))}},_siteBuilderDetail.SoldOutOptions=function(e,t,i,a){if(i==_siteBuilderDetail.DisplayOptionEnum.Chips)document.getElementById("option_chip_"+t+"_"+e).disabled=!0,document.getElementById("option_chip_"+t+"_"+e).classList.remove("active");else if(i==_siteBuilderDetail.DisplayOptionEnum.Dropdown)document.getElementById("option_dropdown_"+t+"_"+e).classList.remove("active"),document.getElementById("option_dropdown_"+t+"_"+e).classList.add("disabled");else if(i==_siteBuilderDetail.DisplayOptionEnum.Image){(r=document.getElementById("option_image_"+t+"_"+e)).classList.add("optiondivdisabled"),r.classList.add("SoldOut"),r.classList.remove("active-select"),r.innerHTML=r.innerHTML+"<span class='active-sold' style='color:#333;'>Sold Out</span>"}else if(i==_siteBuilderDetail.DisplayOptionEnum.ColorSwatch){var r,o="";String.isNullOrUndefineOrBlank(a)||(o=_siteBuilderDetail.InvertColor(a,!0)),(r=document.getElementById("option_color_"+t+"_"+e)).classList.add("optiondivdisabled"),r.classList.add("active-sold"),r.classList.add(o),r.classList.remove("active-select"),r.innerHTML="<span class='active-sold' style='color:#333;'>Sold Out</span>"}},_siteBuilderDetail.variantQtyDown=function(){var e=$("#txtVariantQty").val();if(e>=2){var t=parseInt(e)-1;$("#txtVariantQty").val(t)}null!=_siteBuilderDetail.variantForCheckout&&_siteBuilderDetail.SetDataonVariantSelection()},_siteBuilderDetail.variantQtyUp=function(){var e=$("#txtVariantQty").val();if(e<999){var t=parseInt(e)+1;$("#txtVariantQty").val(t)}null!=_siteBuilderDetail.variantForCheckout&&_siteBuilderDetail.SetDataonVariantSelection()},_siteBuilderDetail.InvertColor=function(e,t){if(0===e.indexOf("#")&&(e=e.slice(1)),e.length<3&&(e="ffffff"),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6!==e.length)throw new Error("Invalid HEX color.");var i=parseInt(e.slice(0,2),16),a=parseInt(e.slice(2,4),16),r=parseInt(e.slice(4,6),16);return t?.299*i+.587*a+.114*r>162?"appTextBlack":"appTextWhite":(i=(255-i).toString(16),a=(255-a).toString(16),r=(255-r).toString(16),"#"+_siteBuilderDetail.PadZero(i)+_siteBuilderDetail.PadZero(a)+_siteBuilderDetail.PadZero(r))},_siteBuilderDetail.PadZero=function(e,t){return t=t||2,(new Array(t).join("0")+e).slice(-t)},_siteBuilderDetail.GetSelectedOptionVariant=function(e,t){return selectedVariant=e.filter(e=>e.combination.some(e=>e.businessOptionVariantId===t))},_siteBuilderDetail.ChipOprtionClick=function(e,t,i,a,r){$(".option-chip-"+i+"-"+a+"-"+r).removeClass("active"),$(e).addClass("active"),_siteBuilderDetail.EnableDisableOptions(t,i,a,r,!1)},_siteBuilderDetail.DropDownOprtionClick=function(e,t,i,a,r){$(".option-dropdown-"+i+"-"+a+"-"+r).removeClass("active"),$(e).addClass("active"),_siteBuilderDetail.EnableDisableOptions(t,i,a,r,!1)},_siteBuilderDetail.ColorOprtionClick=function(e,t,i,a,r,o){$(".option-color-"+i+"-"+a+"-"+r).removeClass("active-select"),$(e).addClass("active-select"),$("#optionvalue-"+i+"-"+a+"-"+r).text(o),_siteBuilderDetail.EnableDisableOptions(t,i,a,r,!1)},_siteBuilderDetail.ImageOprtionClick=function(e,t,i,a,r,o){$(".option-image-"+i+"-"+a+"-"+r).removeClass("active-select"),$(e).addClass("active-select"),$("#optionvalue-"+i+"-"+a+"-"+r).text(o),_siteBuilderDetail.EnableDisableOptions(t,i,a,r,!1)},_siteBuilderDetail.EnableDisableOptions=function(e,t,i,a,r){var o=_siteBuilderDetail.customersProductDetailsCache.inventory.type;if(0==_siteBuilderDetail.selectedVariant.filter(e=>e.OptionOrderId==t&&e.parentIndexNo==a).length){var n={};n.IndexNo=i,n.OptionOrderId=t,n.VariantId=e,n.parentIndexNo=a,_siteBuilderDetail.selectedVariant.push(n)}_siteBuilderDetail.selectedVariant.filter(e=>e.OptionOrderId==t&&e.parentIndexNo==a).map(function(t){return t.VariantId=e,t}),2==o?(rebindMasterList=_siteBuilderDetail.customersProductDetailsCache.bundleInventoryOptions.filter(e=>e.indexNo==a),rebindMasterList.length>0&&(rebindOptionList=rebindMasterList[0].options.filter(e=>e.sortOrderId>(1==r?t-1:t)),rebindOptionList.forEach(function(e){String.isNullOrUndefineOrBlank(e.variants)||e.variants.forEach(function(t){var i=!1,r=_siteBuilderDetail.GetSelectedOptionVariant(_siteBuilderDetail.customersProductDetailsCache.variants,t.id);if(r.length>0&&_siteBuilderDetail.selectedVariant.length>0){var n=_siteBuilderDetail.selectedVariant.filter(t=>t.OptionOrderId<e.sortOrderId&&t.parentIndexNo==a);n.length>0&&n.forEach(function(e){r=_siteBuilderDetail.GetSelectedOptionVariant(r,e.VariantId)})}if(String.isNullOrUndefineOrBlank(r))_siteBuilderDetail.selectedVariant=_siteBuilderDetail.selectedVariant.filter(e=>e.VariantId!=t.id),_siteBuilderDetail.SoldOutOptions(t.id,a,e.displayAs,t.colorCode);else if(0==r.filter(e=>e.quantity>(2==o?e.bundleQty:0)).length&&2==r[0].zeroQuantityVisibility)_siteBuilderDetail.selectedVariant=_siteBuilderDetail.selectedVariant.filter(e=>e.VariantId!=t.id),_siteBuilderDetail.SoldOutOptions(t.id,a,e.displayAs,t.colorCode);else{if(i=_siteBuilderDetail.selectedVariant.some(i=>i.OptionOrderId==e.sortOrderId&&i.parentIndexNo==a&&i.VariantId==t.id),!_siteBuilderDetail.selectedVariant.some(t=>t.OptionOrderId==e.sortOrderId&&t.parentIndexNo==a)){var s={};s.IndexNo=e.IndexNo,s.OptionOrderId=e.sortOrderId,s.VariantId=t.id,s.parentIndexNo=a,_siteBuilderDetail.selectedVariant.push(s),i=!0}_siteBuilderDetail.ActiveOptions(t.id,a,e.displayAs,t.colorCode,e.indexNo,e.sortOrderId,t.variantName,i)}})}))):(rebindOptionList=_siteBuilderDetail.customersProductDetailsCache.inventoryOptions.filter(e=>e.sortOrderId>(1==r?t-1:t)),rebindOptionList.forEach(function(e){String.isNullOrUndefineOrBlank(e.vanriants)||e.vanriants.forEach(function(t){var i=!1,r=_siteBuilderDetail.GetSelectedOptionVariant(_siteBuilderDetail.customersProductDetailsCache.variants,t.id);if(r.length>0&&_siteBuilderDetail.selectedVariant.length>0){var n=_siteBuilderDetail.selectedVariant.filter(t=>t.OptionOrderId<e.sortOrderId&&t.parentIndexNo==a);n.length>0&&n.forEach(function(e){r=_siteBuilderDetail.GetSelectedOptionVariant(r,e.VariantId)})}if(String.isNullOrUndefineOrBlank(r))_siteBuilderDetail.selectedVariant=_siteBuilderDetail.selectedVariant.filter(e=>e.VariantId!=t.id),_siteBuilderDetail.SoldOutOptions(t.id,a,e.displayAs,t.colorCode);else if(0==r.filter(e=>e.quantity>(2==o?e.bundleQty:0)).length&&2==r[0].zeroQuantityVisibility)_siteBuilderDetail.selectedVariant=_siteBuilderDetail.selectedVariant.filter(e=>e.VariantId!=t.id),_siteBuilderDetail.SoldOutOptions(t.id,a,e.displayAs,t.colorCode);else{if(i=_siteBuilderDetail.selectedVariant.some(i=>i.OptionOrderId==e.sortOrderId&&i.parentIndexNo==a&&i.VariantId==t.id),!_siteBuilderDetail.selectedVariant.some(t=>t.OptionOrderId==e.sortOrderId&&t.parentIndexNo==a)){var s={};s.IndexNo=e.IndexNo,s.OptionOrderId=e.sortOrderId,s.VariantId=t.id,s.parentIndexNo=a,_siteBuilderDetail.selectedVariant.push(s),i=!0}_siteBuilderDetail.ActiveOptions(t.id,a,e.displayAs,t.colorCode,e.indexNo,e.sortOrderId,t.variantName,i)}})}));var s=_siteBuilderDetail.customersProductDetailsCache.variants,l=_siteBuilderDetail.selectedVariant.filter(e=>e.parentIndexNo==a);if(s.length>0&&l.length>0&&l.forEach(function(e){s=_siteBuilderDetail.GetSelectedOptionVariant(s,e.VariantId)}),1==s.length)if(2==o){var d={...s[0]};d.parentIndexNo=a,_siteBuilderDetail.variantForCheckout.BundleProduct[a-1]=d}else _siteBuilderDetail.variantForCheckout=s[0];$("#divproductbutton").removeClass("div-disable"),2==o&&_siteBuilderDetail.customersProductDetailsCache.bundleInventoryOptions.length+_siteBuilderDetail.customersProductDetailsCache.bundleProductWithoutVariants.length!=_siteBuilderDetail.variantForCheckout.BundleProduct.length&&(_siteBuilderDetail.variantForCheckout=null),null!=_siteBuilderDetail.variantForCheckout?_siteBuilderDetail.SetDataonVariantSelection():$("#divproductbutton").addClass("div-disable")},_siteBuilderDetail.ProductShareOptions=function(e){var t=_siteBuilderDetail.CreateProductShareLink();if(t=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/"+vagaroUrl+"/products/"+$("#spanProductCat").text().trim().toLowerCase().replace(_siteBuilderDetail.URLReplaceExp,"-")+"/"+$("#spanProductTitle").text().trim().toLowerCase().replace(_siteBuilderDetail.URLReplaceExp,"-")+"/"+t,_siteBuilderDetail.customersProductDetailsCache.inventory.productURL=t,!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.images)){var i=_siteBuilderDetail.customersProductDetailsCache.images.filter(e=>1==e.isDefault)[0];_siteBuilderDetail.customersProductDetailsCache.inventory.defaultImage=i.cdnUrl+"Inventory/350x350/"+i.imageUrl}return String.isNullOrUndefineOrBlank(t)?_siteBuilderDetail.PassiveAlertMessage(_siteBuilderDetail.MessageType.Fail,"Failed to copy link."):e==_siteBuilderDetail.ProductShareOptionsEnum.CopyLink?navigator.clipboard.writeText(t).then(function(){_siteBuilderDetail.PassiveAlertMessage(_siteBuilderDetail.MessageType.Success,"Link copied to clipboard.")},function(e){_siteBuilderDetail.PassiveAlertMessage(_siteBuilderDetail.MessageType.Fail,"Failed to copy link.")}):e==_siteBuilderDetail.ProductShareOptionsEnum.Facebook?$("#dvFaceBookControl").length>0?_siteBuilderSocialMedia.LoadInventoryonFacebook():_siteBuilderSocialMedia.CheckFacebookControllRenders(_siteBuilderSocialMedia,"inventory"):e==_siteBuilderDetail.ProductShareOptionsEnum.Pinterest?_siteBuilderSocialMedia.InventoryOpenPin():e==_siteBuilderDetail.ProductShareOptionsEnum.X&&_siteBuilderSocialMedia.InventoryOpenTwitter(),!1},_siteBuilderDetail.CreateProductShareLink=function(){var e="";return String.isNullOrUndefineOrBlank(_siteBuilderDetail.variantForCheckout)||(e=_siteBuilderDetail.variantForCheckout.createLink),e},_siteBuilderDetail.OpenMobileSearch=function(){$("#divMobileSearch").is(":visible")?_siteBuilderDetail.CloseMobileSearch():($("#divMobileSearch").show(),$("#txtSearchText").focus(),$(".select2-search-field .select2-input.standrad-maphour-block").focus())},_siteBuilderDetail.CloseMobileSearch=function(){return $("#divMobileSearch").hide(),$("#txtSearchText").val(""),$("#txtSearchText").trigger("keyup"),!1},_siteBuilderDetail.OpenCloseMobileFilter=function(e){$("#divProductMenus").is(":visible")?($("#divProductMenus").removeClass("product-filter-menu"),$("#searchButton").show(),$("#btnMobileFilter").show(),$("#divProductHeadingTextMobile").text("Products"),1==e&&_siteBuilderDetail.ClearAllFilter()):($("#divProductMenus").addClass("product-filter-menu"),$("#searchButton").hide(),$("#btnMobileFilter").hide(),$("#divProductHeadingTextMobile").text("Filters"),$("html body").removeClass("isDetailPageClass"))},_siteBuilderDetail.ApplyMobileFilter=function(){_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData(),_siteBuilderDetail.OpenCloseMobileFilter(!1)},_siteBuilderDetail.ClearMobileSearchText=function(e){$("#txtSearchText").select2("destroy"),_siteBuilderDetail.LoadInventorySearchDropDown(),$("#txtSearchText").select2("open"),$("#svgCloseIcon").hide(),$(".search-cancel-icon").hide(),_siteBuilderDetail.ComponentResponse.lstProduct.cacheSearchText="",e&&_siteBuilderDetail.ClearAllFilter(),$("#divProductListSection").is(":visible")&&(_siteBuilderDetail.ComponentResponse.lstProduct.resProdCaches.Inventorys=null,_siteBuilderDetail.LoadInventoryData())},_siteBuilderDetail.BindBreadCrumbsforProductDetail=function(e){String.isNullOrUndefineOrBlank(e)||(_siteBuilderDetail.breadCrumbs=[],_siteBuilderDetail.CreateBreadCrumbsArray(e),$("#breadcrumbslist").html(""),$("#srpt-categorybreadcrumbslist").tmpl(_siteBuilderDetail.breadCrumbs.sort((e,t)=>e.sequence-t.sequence)).appendTo($("#breadcrumbslist")))},_siteBuilderDetail.CreateBreadCrumbsArray=function(e,t){if(String.isNullOrUndefineOrBlank(t)){var i=e.filter(e=>""===e.parentCategoryId);if(!String.isNullOrUndefineOrBlank(i))(a={}).parentId=i[0].id,a.name=i[0].name,a.isLastChild=!1,a.sequence=_siteBuilderDetail.breadCrumbs.length+1,a.count=e.length,_siteBuilderDetail.breadCrumbs.push(a),_siteBuilderDetail.CreateBreadCrumbsArray(e,i[0].id)}else{var a;i=e.filter(e=>e.parentCategoryId===t);if(!String.isNullOrUndefineOrBlank(i))(a={}).parentId=i[0].id,a.name=i[0].name,a.isLastChild=null!=e&&e.length==_siteBuilderDetail.breadCrumbs.length,a.sequence=_siteBuilderDetail.breadCrumbs.length+1,a.count=e.length,_siteBuilderDetail.breadCrumbs.push(a),_siteBuilderDetail.CreateBreadCrumbsArray(e,i[0].id)}},_siteBuilderDetail.ProductTabHeader=function(e){if($(".dd-mobile-emp-heading").hide(),$(".dd-mobile-emp-heading").html(""),1==e&&"none"!==$("#mobiletabmenu").css("display")){$(".dd-mobile-emp-heading").show().addClass("inventory-product-header"),$(".dd-mobile-emp-heading").html('<div class="Inventory-product-header"><div class="product-header-inner-div"><div id="divProductHeadingTextMobile" class="thm-textColor mb-0 product-heading-text" id="">Products</div></div><div class="header-icons" style=><div class="mobile-header-btn"><button href="#" id="searchButton" class="fa-regular fa-magnifying-glass" onclick="_siteBuilderDetail.OpenMobileSearch()" aria-hidden="true" style="background: transparent; padding-right: 10px; display: inline-block;"></button></div><div class="mobile-header-btn"><button href="#" id="btnMobileFilter" class="fa-regular fa-sliders" onclick="_siteBuilderDetail.OpenCloseMobileFilter(true)" aria-hidden="true" ></button></div></div></div>')}},_siteBuilderDetail.ShowHideProductDetail=function(e){e?(_siteBuilderDetail.breadCrumbsBack=_siteBuilderDetail.breadCrumbs,$(".header-icons").hide(),$("#divProductPreviewpageOnline").show(),$("html body").addClass("isDetailPageClass"),$("html, body").animate({scrollTop:0},"slow"),$("#divProductPreviewpageOnline").is(":visible")||$("#custom-dots").html(""),$("#divProductListSection").hide(),$("html body").addClass("addProductbody"),$("#mobile-check").is(":visible")||$("html body").addClass("addProductbody")):($(".header-icons").show(),_siteBuilderDetail.breadCrumbs=_siteBuilderDetail.breadCrumbsBack,$("#breadcrumbslist").html(""),$("#srpt-categorybreadcrumbslist").tmpl(_siteBuilderDetail.breadCrumbs.sort((e,t)=>e.sequence-t.sequence)).appendTo($("#breadcrumbslist")),$("#divProductPreviewpageOnline").hide(),$("#divProductListSection").show(),$("html body").addClass("addProductbody"),$("#mobile-check").is(":visible")||$("html body").addClass("addProductbody"),$("html body").removeClass("isDetailPageClass"),$("#custom-dots, #custom-dots-modal").html(""))},_siteBuilderDetail.ShowHideSharingOptions=function(){var e=_siteBuilderDetail.CreateProductShareLink();if(e=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/"+vagaroUrl+"/products/"+$("#spanProductCat").text().trim().toLowerCase().replace(_siteBuilderDetail.URLReplaceExp,"-")+"/"+$("#spanProductTitle").text().trim().toLowerCase().replace(_siteBuilderDetail.URLReplaceExp,"-")+"/"+e,"undefined"!=typeof vgAppicationType&&1==vgAppicationType){var t="Check out this product on Vagaro.";"undefined"!=typeof btnShare&&null!=btnShare?(_siteBuilderSocialMedia.position=btnShare.getBoundingClientRect(),CallbackforMobileApp(0,0,"","","0",'18|~|{\\"message\\": \\"'+t.replace(/"/g,'\\"')+'\\", \\"url\\": \\"'+e+'\\", \\"screenX\\": \\"'+_siteBuilderSocialMedia.position.left+'\\", \\"screenY\\": \\"'+_siteBuilderSocialMedia.position.top+'\\"}')):CallbackforMobileApp(0,0,"","","0",'18|~|{\\"message\\": \\"'+t.replace(/"/g,'\\"')+'\\", \\"url\\": \\"'+e+'\\"}')}},document.addEventListener("DOMContentLoaded",function(){let e=null;_siteBuilderDetail.invnewDropdown=function(t,i,a){const r="inventory-drp-preview-"+t+"-"+i+"-"+a,o=document.getElementById(r);if(o){if(e&&e!==r){const t=document.getElementById(e);t&&t.classList.remove("active")}const t=o.classList.contains("active");o.classList.toggle("active",!t),e=t?null:r,event.stopPropagation()}},document.addEventListener("click",function(t){if(e){const i=document.getElementById(e);i&&!i.contains(t.target)&&(i.classList.remove("active"),e=null)}}),document.querySelectorAll("[data-toggle-dropdown]").forEach(function(e){e.addEventListener("click",function(e){const t=this.getAttribute("data-dropdown-id");_siteBuilderDetail.invnewDropdown(t)})})}),_siteBuilderDetail.selectOption=function(e,t,i,a,r,o){const n=document.getElementById("inventory-drp-text-"+a+"-"+r+"-"+o);n.innerText=e,n.setAttribute("data-value",t),null!=typeof i&&0!=i||_siteBuilderDetail.invnewDropdown(a,r,o)},_siteBuilderDetail.onBusinessInfoSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageBusinessInfoSectionComponent,function(){return getSiteBuilderObj().GetBusinessInfoComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onAboutusReviewSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageAboutusReviewSection,function(){return getSiteBuilderObj().GetAboutUsReviewSectionComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onBusinessMapSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageMapSectionComponent,function(){return getSiteBuilderObj().GetBusinessMapComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onBusinesHoursSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageWorkingHoursSectionComponent,function(){return getSiteBuilderObj().GetBusinessHoursComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onBusinesStaffSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.StaffComponent,function(){return getSiteBuilderObj().GetBusinessStaffComponent(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.onDailyDealSectionInitMethod=function(e,t){if(t){getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageDailyDealsSectionComponent,function(){return getSiteBuilderObj().GetDailyDealSection(e),scrollToBottom($(e),!0),!1},e)}},_siteBuilderDetail.SetScriptFuncInCaseofWidget=function(){if("true"==isWidget.toLowerCase()){var e=function(){$(window).on("viewport.interframe",function(e){"none"!==$("#widgetPagerelement").css("display")&&e.top>=$("#widgetPagerelement").offset().top-e.height-50&&null!=currentscrollpager&&null!=currentscrollpager&&currentscrollpager.options.EnablePagescroll&&currentscrollpager.scroll()})};window.addEventListener?window.addEventListener("load",e,!1):window.attachEvent("onload",e)}},_siteBuilderDetail.SetSecureRequestForNewTabWidget=function(){if(self===top&&window.location.href.toLowerCase().indexOf("http://")>=0&&window.location.href.toLowerCase().indexOf("businesswidget.aspx")>=0){var e=window.location.href.replace("http","https");$url=$("<a/>"),$url.attr("href",e),$url[0].click()}self===top&&window.location.href.toLowerCase().indexOf("businesswidget.aspx")>=0&&document.getElementById("mainbody").classList.add("Newtab_Widget")},_siteBuilderDetail.redirecturl=function(e){var t=_siteBuilderDetail.getMyAccountURL(e);$url=$("<a/>"),$url.attr("href",t),$url[0].click()},_siteBuilderDetail.BindMyAccountTabEvents=function(){var e="-1";null!=_siteBuilderDetail.UserLocationInfo&&null!=_siteBuilderDetail.UserLocationInfo&&null!=_siteBuilderDetail.UserLocationInfo.objUserInfo&&null!=_siteBuilderDetail.UserLocationInfo.objUserInfo&&null!=_siteBuilderDetail.UserLocationInfo.objUserInfo.UserType&&null!=_siteBuilderDetail.UserLocationInfo.objUserInfo.UserType&&(e=_siteBuilderDetail.UserLocationInfo.objUserInfo.UserType),$("[id='accpayrollhistory']").css("display","block"),parseInt(e)==_siteBuilderDetail.UserType.Customer&&$("[id='accpayrollhistory']").css("display","none"),_common.IsCookieLessWidget()?($("[id='accprofile']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('profile')"),$("[id='accappointments']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('appointments')"),$("[id='accproducts']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('products')"),$("[id='accbookmarks']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('bookmarks')"),$("[id='accpoints']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('points')"),$("[id='accreviews']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('reviews')"),$("[id='accgift']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('gift')"),$("[id='accpackages']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('packages')"),$("[id='accmemberShips']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('memberships')"),$("[id='myaccountivoices']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('invoices')"),$("[id='myaccountpaymentmethods']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('paymentmethods')"),$("[id='accfamilyFriends']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('familyfriends')"),$("[id='accnotification']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('notification')"),parseInt(e)!=_siteBuilderDetail.UserType.Customer&&$("[id='accpayrollhistory']").attr("href","javascript:void(0)").attr("onclick","_siteBuilderDetail.redirecturl('payrollhistory')")):($("[id='accprofile']").attr("href",_siteBuilderDetail.getMyAccountURL("profile")),$("[id='accappointments']").attr("href",_siteBuilderDetail.getMyAccountURL("appointments")),$("[id='accproducts']").attr("href",_siteBuilderDetail.getMyAccountURL("products")),$("[id='accbookmarks']").attr("href",_siteBuilderDetail.getMyAccountURL("bookmarks")),$("[id='accpoints']").attr("href",_siteBuilderDetail.getMyAccountURL("points")),$("[id='accreviews']").attr("href",_siteBuilderDetail.getMyAccountURL("reviews")),$("[id='accgift']").attr("href",_siteBuilderDetail.getMyAccountURL("gift")),$("[id='accpackages']").attr("href",_siteBuilderDetail.getMyAccountURL("packages")),$("[id='accmemberShips']").attr("href",_siteBuilderDetail.getMyAccountURL("memberships")),$("[id='myaccountivoices']").attr("href",_siteBuilderDetail.getMyAccountURL("invoices")),$("[id='myaccountpaymentmethods']").attr("href",_siteBuilderDetail.getMyAccountURL("paymentmethods")),$("[id='accfamilyFriends']").attr("href",_siteBuilderDetail.getMyAccountURL("familyfriends")),$("[id='accnotification']").attr("href",_siteBuilderDetail.getMyAccountURL("notification")),parseInt(e)!=_siteBuilderDetail.UserType.Customer&&$("[id='accpayrollhistory']").attr("href",_siteBuilderDetail.getMyAccountURL("payrollhistory")))},_siteBuilderDetail.getMyAccountURL=function(e){var t=CheckToRedirect(),i="";return t.length>0?("undefined"!=typeof event&&null!=event&&event.preventDefault(),i="/myaccount/"+e+t):("undefined"!=typeof event&&null!=event&&event.preventDefault(),i="/myaccount/"+e),_common.IsCookieLessWidget()&&"undefined"!=typeof widgetcookievalue&&""!=widgetcookievalue&&(i=i+"&wid="+encodeURIComponent(widgetcookievalue)),i},_siteBuilderDetail.AjaxOld=function(e,t,i,a){var r=new vagaro.ajax;r.datamodel.Token=e,r.datamodel.data=t,r.datamodel.callback=i,r.datamodel.Error=a,r.Post()},_siteBuilderDetail.AddLogInAmplitudeSuccess=function(e){console.log("success"),window.location.href="/businesssignup/merchants/thankyou"},_siteBuilderDetail.AddLogInAmplitudeSuccessFail=function(e){console.log("error")},_siteBuilderDetail.StyleManagerSetStyle=function(e,t,i){var a="."+$(e.closest(_siteBuilderDetail.VgCustomComponent)).attr("data-custom-component")+" ."+e.attr("data-cls");return e.closest("body").find(a).each(function(e,a){$(a).css(t,i)}),e.css(t,i),e},_siteBuilderDetail.LoadSocialMediaIcon=function(e,t){if("true"==isCustomWebsite){if(null!=e&&null!=e.Color){null!=e.Color.TwitterLink&&""!=e.Color.TwitterLink&&($("#ancTwitter").removeClass("d-none"),$("#ancTwitter").attr("href","http"==e.Color.TwitterLink.substring(0,4)?e.Color.TwitterLink:"http://"+e.Color.TwitterLink)),null!=e.Color.FacebookLink&&""!=e.Color.FacebookLink&&($("#ancFacebook").removeClass("d-none"),$("#ancFacebook").attr("href","http"==e.Color.FacebookLink.substring(0,4)?e.Color.FacebookLink:"http://"+e.Color.FacebookLink)),null!=e.Color.MySpaceLink&&""!=e.Color.MySpaceLink&&($("#ancMyspace").removeClass("d-none"),$("#ancMyspace").attr("href","http"==e.Color.MySpaceLink.substring(0,4)?e.Color.MySpaceLink:"http://"+e.Color.MySpaceLink)),null!=e.Color.MySpaceLink&&""!=e.Color.MySpaceLink&&($("#ancMyspace").removeClass("d-none"),$("#ancMyspace").attr("href","http"==e.Color.MySpaceLink.substring(0,4)?e.Color.MySpaceLink:"http://"+e.Color.MySpaceLink)),null!=e.Color.YoutubeLink&&""!=e.Color.YoutubeLink&&($("#ancYouTube").removeClass("d-none"),$("#ancYouTube").attr("href","http"==e.Color.YoutubeLink.substring(0,4)?e.Color.YoutubeLink:"http://"+e.Color.YoutubeLink)),null!=e.Color.LinkedinLink&&""!=e.Color.LinkedinLink&&($("#ancLinkedIn").removeClass("d-none"),$("#ancLinkedIn").attr("href","http"==e.Color.LinkedinLink.substring(0,4)?e.Color.LinkedinLink:"http://"+e.Color.LinkedinLink)),null!=e.Color.YelpLink&&""!=e.Color.YelpLink&&($("#ancYelp").removeClass("d-none"),$("#ancYelp").attr("href","http"==e.Color.YelpLink.substring(0,4)?e.Color.YelpLink:"http://"+e.Color.YelpLink)),null!=e.Color.BlogLink&&""!=e.Color.BlogLink&&($("#ancBlog").removeClass("d-none"),$("#ancBlog").attr("href","http"==e.Color.BlogLink.substring(0,4)?e.Color.BlogLink:"http://"+e.Color.BlogLink)),null!=e.Color.PinterestLink&&""!=e.Color.PinterestLink&&($("#ancPinterest").removeClass("d-none"),$("#ancPinterest").attr("href","http"==e.Color.PinterestLink.substring(0,4)?e.Color.PinterestLink:"http://"+e.Color.PinterestLink)),null!=e.Color.InstagramLink&&""!=e.Color.InstagramLink&&($("#ancInstagram").removeClass("d-none"),$("#ancInstagram").attr("href","http"==e.Color.InstagramLink.substring(0,4)?e.Color.InstagramLink:"http://"+e.Color.InstagramLink)),null!=e.Color.GooglePlusLink&&""!=e.Color.GooglePlusLink&&($("#ancGooglePlus").removeClass("d-none"),$("#ancGooglePlus").attr("href","http"==e.Color.GooglePlusLink.substring(0,4)?e.Color.GooglePlusLink:"http://"+e.Color.GooglePlusLink)),null!=e.Color.TikTokLink&&""!=e.Color.TikTokLink&&($("#ancTikTok").removeClass("d-none"),$("#ancTikTok").attr("href","http"==e.Color.TikTokLink.substring(0,4)?e.Color.TikTokLink:"http://"+e.Color.TikTokLink));var i=$("#ancHomeMobile");i.length>0&&(t?(i.attr("onclick","javascript:_common.loadHome(event);_common.CloseToggelmobileMenu();closeMobileSearch()"),i.attr("href",location.protocol+"//"+location.host+"/"+vagaroUrl)):(i.removeAttr("onclick"),i.on("click",function(){return _shopdetail.backToShopDetail("./"+vagaroUrl),!1}),i.attr("href","javascript:void(0);")))}$("#mobile-check").is(":visible")&&fnShowSocialMediaIconInMobiles()}},_siteBuilderDetail.LoadBusinessDetailPageForCustomerApp=function(){"btnCloseSharingBusiness"!=event.target.id&&"spnbookbtn"!=event.target.id&&"divbookservice"!=event.target.id&&"divbookclass"!=event.target.id&&_siteBuilderDetail.IsCustomerAppORMobileViewWithoutWidget()&&$(".nav-link#about").trigger("click")},_siteBuilderDetail.IsCustomerAppORMobileViewWithoutWidget=function(){return"undefined"!=typeof vgAppicationType&&1==vgAppicationType||$("#mobile-check").is(":visible")&&"undefined"!=typeof isWidget&&"false"==isWidget.toLowerCase()},_siteBuilderDetail.OpenVagaroConnectChat=function(){"undefined"!=typeof _vagaroConnect&&($('meta[name="viewport"]').attr("content","width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"),_vagaroConnect.model.isChatIframeLoaded?!1===$(_vagaroConnect.controls.chatFrame).is(":visible")&&_vagaroConnect.ShowChatFrame(2):(ShowLoader(!0),_vagaroConnect.Init()))},_siteBuilderDetail.HideVagaroConnectChat=function(){if($("#chatFrame").removeClass("vc-iframeCustomer_extend"),$("#chatFrame").removeClass("vc-iframeCustomer_minimize"),1==_siteBuilderDetail.connectcurrentUrl&&(navigator.userAgent.indexOf("com.vagaro.customerios")>-1||navigator.userAgent.indexOf("com.vagaro.customerandroid")>-1)&&(_siteBuilderDetail.connectcurrentUrl=!1,CallbackforMobileApp(0,0,"","",0,1)),CommonFromPage="DefaultMaster",$("#chatWindow").attr("src",""),$("#chatFrame").hide(),"undefined"!=typeof _vagaroConnect&&(_vagaroConnect.model.isChatIframeLoaded=!1),"undefined"!=typeof window&&null!=window.document.getElementById("hdnChatConversionId")&&"undefined"!=window.document.getElementById("hdnChatConversionId")&&(window.document.getElementById("hdnChatConversionId").value=""),1==_siteBuilderDetail.connectcurrentUrl&&$("#mobile-check").is(":visible"))return _siteBuilderDetail.connectcurrentUrl=!1,void window.history.go(-2)},_siteBuilderDetail.ShowLoaderVagaroConnect=function(e){1==e?$("#chatLoader").show():0==e&&$("#chatLoader").hide()},_siteBuilderDetail.OnProductImageClick=function(e){if(ShowLoader(!0),$("html body").removeClass("zoomedImageClass"),!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.images)){var t=[];if(t=_siteBuilderDetail.customersProductDetailsCache.images.filter(e=>""===e.inventoryId),!String.isNullOrUndefineOrBlank(_siteBuilderDetail.variantForCheckout.inventoryId)){var i=_siteBuilderDetail.customersProductDetailsCache.images.filter(e=>e.inventoryId===_siteBuilderDetail.variantForCheckout.inventoryId);!String.isNullOrUndefineOrBlank(_siteBuilderDetail.customersProductDetailsCache.images)&&i.length>0&&(t=i)}var a=!1;const n=t.find(t=>t.imageUrl===e.split("Original/")[1]);if(String.isNullOrUndefineOrBlank(n)||(a=n.isVideo),$("#swiperSyncMainBody .hasVideoSync1").length>0&&a){var r=document.getElementById("videoPlayer");String.isNullOrUndefineOrBlank(r)||r.pause()}if(_siteBuilderDetail.swiperSyncLarge&&(_siteBuilderDetail.swiperSyncLarge.destroy(!0,!0),_siteBuilderDetail.swiperSyncLarge=null),_siteBuilderDetail.ProductDetailImageSliderLarge(),_siteBuilderDetail.swiperSyncLarge){var o=_siteBuilderDetail.findAnimatedImageIndex(e);_siteBuilderDetail.swiperSyncLarge.slideTo(o)}$("#modalProductImg").modal("show"),ShowLoader(!1),a&&setTimeout(function(){var e=document.getElementById("videoPlayer1");String.isNullOrUndefineOrBlank(e)||e.play()},400)}},_siteBuilderDetail.findAnimatedImageIndex=function(e){const t=document.querySelectorAll("#swiperSyncLarge .swiper-slide");for(let i=0;i<t.length;i++){const a=t[i].querySelector("img");if(a&&a.src===e)return i}return-1},_siteBuilderDetail.CheckVPLForMarketingDailyDealsReferral=function(e,t,i,a,r){try{return!(void 0!==getCookie("referral")&&""!==getCookie("referral")||void 0!==e&&""!==e||!(null!=t||t>0)||0==i&&a<r)}catch{return!1}},_siteBuilderDetail.SetFMBMerchantToken=function(){try{if(void 0!==_shopdetail&&null!=_shopdetail&&(!_shopdetail.MerchantTokenID||String.isNullOrUndefineOrBlank(_shopdetail.MerchantTokenID)||0===_shopdetail.MerchantTokenID||"0"===_shopdetail.MerchantTokenID||"undefined"!=typeof isShoppingTabCartOptionEnable&&!1===isShoppingTabCartOptionEnable||"undefined"!=typeof merchantAccount&&1===merchantAccount)){var e={BusinessID:parseInt(businessID)||0},t=new vagaro.ajax;t.datamodel.Token=VagaroCorePublicAPIURLV2+"checkout/getveraaccountinfo",t.datamodel.IsNewVagaroAPI=!0,t.datamodel.data=e,"undefined"!=typeof staticEncryptBusinessID&&null!=staticEncryptBusinessID&&""!=staticEncryptBusinessID&&(t.datamodel.merchantId=staticEncryptBusinessID),t.datamodel.callback=function(e){e&&e.Status==vagaro.VagaroCoreApiStatusCode.OK&&e.ResponseCode==vagaro.VagaroCoreApiResponseCode.Success&&null!=e.Data?_siteBuilderDetail.VeraAccountInfo=e.Data:_siteBuilderDetail.VeraAccountInfo=null},t.datamodel.Error=function(e){_siteBuilderDetail.VeraAccountInfo=null,console.log("SetFMBMerchantToken Error",e)},t.Post()}else _siteBuilderDetail.VeraAccountInfo=null}catch(e){_siteBuilderDetail.VeraAccountInfo=null,console.log("SetFMBMerchantToken Exception",e)}},_siteBuilderDetail.loadAffirm=function(){window._affirm_config={public_api_key:"2R7SFEUXUE01IRXR",script:"https://cdn1.affirm.com/js/v2/affirm.js"},window.affirm||document.querySelector('script[src*="affirm.com/js/v2/affirm.js"]')||function(e,t,i,a,r,o,n){var s,l=e[i]||{},d=document.createElement(o),c=function(e,t,i){return function(){e[t]._.push([i,arguments])}};l[a]=c(l,a,"set"),s=l[a],l[r]={},l[r]._=[],s._=[],l[r][n]=c(l,r,n);for(var u=0,p=["set","add","save","post","open","empty","reset","on","off","trigger","ready","setProduct"];u<p.length;u++)s[p[u]]=c(l,a,p[u]);u=0;for(var h=["get","token","url","items"];u<h.length;u++)s[h[u]]=function(){};d.async=!0,d.src=t[o],document.head.appendChild(d),delete t[o],s(t),e[i]=l}(window,_affirm_config,"affirm","checkout","ui","script","ready")};var countryInitialized=!1;const originalSetCountry=window.SetCountry;function updateResourcesLink(e,t,i){var a=document.getElementById(e);if(a){var r=a.href||a.getAttribute("href");if(r)switch(r=r.replace(/\/en-(gb|ca|au)\//,"/"),i){case 2:a.href=r.replace(t,"/en-gb"+t);break;case 3:a.href=r.replace(t,"/en-ca"+t);break;case 4:a.href=r.replace(t,"/en-au"+t);break;default:a.href=r}}}function dummyreleaseapijs(){}window.SetCountry=function(e){countryInitialized||originalSetCountry(e)},$(document).ready(function(){var e={1:"san-francisco--ca",2:"london--greater-london--gb",4:"sydney--nsw--au",3:"edmonton--ab--ca"};function t(e){1==e?$("#footer-booth-renter").show():$("#footer-booth-renter").hide()}function i(e){const t=window.location.origin.toLowerCase();$(".footer-link").each(function(){const i=$(this).data("path");if(i){let a="deals"===i?`${t}/deals/${e}`:`${t}/listings/${i}/${e}`;$(this).attr("href",a),$(this).attr("title",this.innerText)}})}function a(e){let t="",i="";switch(e){case 2:t="020 4538 9934 ext. 1",i="020 3876 9856 ext. 2";break;case 3:t="(778) 743 0050 ext. 1",i="(778) 897 2477 ext. 2";break;case 4:t="(02) 3813 8768 ext. 1",i="(02) 8319 9138 ext. 2";break;default:t="(925) 718-0971 ext. 1",i="(925) 464-1932 ext. 2"}const a="tel:"+t.replace(/[^\d+]/g,""),r="tel:"+i.replace(/[^\d+]/g,"");$("#contact-sales").text(" "+t).parent("a").attr("href",a),$("#contact-support").text(" "+i).parent("a").attr("href",r)}$(".dd-button").on("click",function(e){e.stopPropagation(),$(".dd-menu").toggleClass("show")}),$(document).on("click",function(e){$(e.target).closest(".dropdown, .dd-button").length||$(".dd-menu").removeClass("show")}),$(".dd-menu li.footer-web-body-font").on("click",function(r){r.stopPropagation();var o=$(this).data("value"),n=$(this).data("flag"),s=$(this).text().trim(),l=e[o]||"san-francisco--ca";$("#selected-flag").attr("src",n),$("#selected-country").text(s),$("#hdnCountryId").val(o),originalSetCountry(o),a(o),$(".dd-menu li.footer-web-body-font").show(),$(this).hide(),$(".dd-menu").removeClass("show"),i(l),t(o)});var r=parseInt($("#hdnCountryId").val(),10)||1,o=$(".dd-menu li.footer-web-body-font[data-value='"+r+"']");$("#selected-flag").attr("src",o.data("flag")),$("#selected-country").text(o.text().trim()),countryInitialized=!0,originalSetCountry(r),a(r),o.hide(),i(e[r]||"san-francisco--ca"),t(r),updateResourcesLink("footer-blog","/learn",r),updateResourcesLink("footer-newsroom","/news",r)});var countryid="",city="";isNotSetByCookie=!1;var marker,map,ctlrMain,ctlrListing,Services,ctrlBusinessSearch,cltrlLocationSearch,ctrlMobileCityState,cltrlBusinessLocationSearch,homePageBannerCDNURL,countryLat,businessSearchMode=void 0===businessSearchMode?2:businessSearchMode,businessSearchModeForSelection=[0,2],removeMarkers=[],isFavouriteBusiness=!1,isServiceAnyTime=!1,serviceDateTime="",ProximityIsCurrentLocation="proximityiscurrentLocation",lBusinessPromoCodeID=$("#hdBusinessPromoCodeID").length>0?$("#hdBusinessPromoCodeID").val():null,distanceRadius=105,EmptyProximityValue=function(){return JSON.parse('{"lat":"","long":"","countryid":"1","zip":"","city":"","state":"","currencysymbol":"$","businesstypes":"","service":"","serviceDate":"","serviceTime":""}')},TrakingInfoValue=function(){return JSON.parse('{"Action":"","PageName":"","busionessName":"","businessID":"","Category":"","dealName":""}')},currentSorting=0,IsSetBubbleCount=!1,IsAjaxEnabled="True",strBusinessPromoURL=$("#hdBusinessPromoURL").val(),noDataMsg="No data available for selected location.",state="",serviceDateFormat="MMM D [at] h:mm A",isAdvanceSearch=!1,datePicker_contentWindow="body",bussinessTypesByCategoryname=[],bussinessTypeIdsByCategoryname=[],serviceDate="",serviceTime="",keyphrasedata="",h1ByCategoryname=[],titleByCategoryname=[],categoryByCategoryname=[];function resetAllCheckBox(){$('.filters-div  input[type="checkbox"]').filter(function(){return!0}).prop("checked",!1),businesstypes="",businesstypeids="",category="",h1="",title="",selectClassCategory(null,!1);var e=getCookie(ProximityCookieName);null!=e&&(e.businesstypes="",setCookie(ProximityCookieName,e)),$("#professionalFilter   .filter-result-text ,.mobile-filter-result .filter-result-text").filter(function(){return!0}).remove(),isPromotionBusiness=_featuredDtl.IsPrmotion(),isPromotionBusiness?($(".mobile-filter-result").addClass("promoicon").removeClass("atmobileicon"),$(".imgpromcheck").show()):($(".mobile-filter-result").removeClass("promoicon"),$(".imgpromcheck").hide()),1==$("#mobile-check").is(":visible")?(HasIdExists(3)||HasIdExists(1)||HasIdExists(2))&&togglebusinesssearch(businessSearchMode):($(".business-toggle").click(),ResetBusinessSearchMode(),togglebusinesssearch(2)),$(".atmobilecheck").hide(),$(".atstreamcheck").hide(),$(".athomecheck").hide(),$(".mobile-filter-result").removeClass("atmobileicon"),$("#atBusiness").removeClass("active"),$("#atMobile").removeClass("active"),$("#atStream").removeClass("active"),HasIdExists(1)&&($(".atmobilecheck").show(),$(".mobile-filter-result").addClass("atmobileicon"),$("#atMobile").addClass("active")),HasIdExists(3)&&($(".atstreamcheck").show(),$("#atStream").addClass("active")),HasIdExists(2)&&($(".athomecheck").show(),$("#atBusiness").addClass("active")),businessFacilities="",kidsFacilitiesdata="",kidsFacilities=""}function PageBindAdvSearch(){if(1!=$("#sliderHomePageHero1").hasClass("hideDots")){$("#txtLocationSearch").length>0&&(cltrlLocationSearch=new ProximitySearch($("#txtLocationSearch"),$("#hdngblCountryId"),$("#navCountryList")).init("top-dropdown",!0));try{setTimeout(function(){$("#txtLocationSearch").select2("destroy")},1e3)}catch(e){}$("#txtBusinessLocationSearch1").length>0&&(cltrlLocationSearch=new ProximitySearch($("#txtBusinessLocationSearch1"),$("#hdngblCountryId"),$("#navCountryList")).init("service-where-dropdown mobcommon-dropdown",!0)),null!=AdminServiceList.results&&0!=AdminServiceList.results.length||("undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()?AdminServiceList.results=[]:InitAdminServices());var e="";e=(new Date).getMonth()>6?(new Date).getFullYear()+1:(new Date).getFullYear(),applydatepicker({divid:"#divHomeServicesDate1",textid:"#txtHomeServicesDate1",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.MiniDate)+" [at] h:mm A",defaultDateTime:serviceDateTime,pickTime:!0,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,yearStart:(new Date).getFullYear(),yearEnd:e,callBackOnChange:HomeServicesDateChange}),setTimeout(function(){ClearHomeServicesDate1()},200),_home.loadHeroList(),$("#sliderHomePageHero1").sliderResponsive({hideDots:"on"})}}function HideShowControl(e,t){var i=e.split(",");$.each(i,function(e){""!=i[e]&&(1==t?$('.filters-div  input[value="'+i[e]+'"]').parent().parent().hide():$('.filters-div  input[value="'+i[e]+'"]').parent().parent().show())})}function setDateTimeforServiceNew(e){var t=getLocationDate(),i=e,a=$("#"+e).find("input").attr("id"),r=t.format("nn"),o=iPadAndroid||isWindowsPhone?15:5;if((s=parseInt(parseInt(r)%o))>0&&(r=r-s+o,t.setMinutes(r)),""!=serviceDateTime&&void 0!==serviceDateTime){t>(n=new Date(serviceDateTime))&&(serviceDateTime=t,n=t),setdatepickervalue({divid:"#"+i,textid:"#"+a,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.MiniDate)+" [at] h:mm A"},n)}else{var n,s=0;if(t<(n=getdatepickervalue("#"+a))){var l=n.format("nn");(s=parseInt(parseInt(l)%o))>0&&(l=l-s+o,n.setMinutes(l)),t=n}iPadAndroid||isWindowsPhone||$("#"+a).datetimepicker({minDateTime:new Date(t)}),setdatepickervalue({divid:"#"+i,textid:"#"+a,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.MiniDate)+" [at] h:mm A"},t)}}function CheckLiveStreamCategoryNextPrevious(){checkOverflow("divStreamListingFilters","divStreamLastSlide","N")?$("#divStreamNextFilter").show():$("#divStreamNextFilter").hide(),checkOverflow("divStreamListingFilters","divStreamFirstSlide","P")?$("#divStreamPrevFilter").show():$("#divStreamPrevFilter").hide()}function checkOverflow(e,t,i){if($("#"+e).length>0&&$("#"+t).length>0){var a=$("#"+e).width(),r=$("#"+t).position().left;if("N"==i&&r>a)return!0;if("P"==i&&r<0)return!0}return!1}function selectClassCategory(e,t){null!=e&&$(e).length>0?(1==t?($(e).parent().addClass("active"),$(".stream-more").addClass("selected"),$("#"+e.id.replace("li","")).addClass("selected")):$(e).addClass("selected"),String.isNullOrUndefineOrBlank(_gblLiveStreamSearchServiceName)?(_gblLiveStreamSearchServiceId=$(e).data("livestreamid"),_gblLiveStreamSearchServiceName=$(e).data("livestream")):(_gblLiveStreamSearchServiceId=_gblLiveStreamSearchServiceId+","+$(e).data("livestreamid"),_gblLiveStreamSearchServiceName=_gblLiveStreamSearchServiceName+","+$(e).data("livestream"))):($(".stream-more").removeClass("selected"),$("#divStreamListingFilters a").removeClass("selected"),$(".LiveStreamClassListCss").removeClass("active"),_gblLiveStreamSearchServiceId=0,_gblLiveStreamSearchServiceName="")}function setdefaultSortingOption(e,t){$(".professional-sorting").hide(),$(".gallery-sorting").hide(),$(".listpage-sorting").hide(),"listSort"==e?($(".listpage-sorting").show(),$(".listpage-sorting a").hide(),"listings"==t?$(".listpage-sorting").find(".listings").show():"listingsLive"==t?($("body").addClass("livestreampage"),LoadLiveStreamPage()):"deals"==t?$(".listpage-sorting").find(".deals").show():"book"!=t&&"class"!=t||$(".listpage-sorting").find(".book").show()):"gallerySort"==e?$(".gallery-sorting").show():"professionalSort"==e&&$(".professional-sorting").show()}function loadData(e,t){if("undefined"!=typeof AdminServiceList&&null!=AdminServiceList&&""!=AdminServiceList||("undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()?AdminServiceList.results=[]:InitAdminServices()),!IsSetBubbleCount&&"undefined"!=typeof UserID&&null!=UserID&&""!=UserID&&parseInt(UserID)>0&&(_home.GetOutStandingReviewAndInvoiceCnt(),IsSetBubbleCount=!0),filledHeartIcon=cdnImagePath+"/PublicImages/Images/heart-icon@2x.png",emptyHeartIcon=cdnImagePath+"/PublicImages/Images/heart-icon-empty@2x.png",$("#dvDailyDealsDetail").hide(),$("#ulFeatureBusiness").removeClass("daily home-page-section"),_featuredDtl.HideAdvanceSearch(),_featuredDtl.HideGalleryFilter(),"DailyDeal"!=BasePage){if("Home"==BasePage&&"False"!=IsAjaxEnabled){null!=e&&(tabSegment=-1!=e.indexOf("/")&&-1!=e.indexOf("book")?e.split("/")[0]:e),$(".redo-search-btn").hide(),setMobileLocation(),addPageHistoryWinApp(BasePage,tabSegment,""),(""!=strBusinessPromoURL&&""==tabSegment||tabSegment==_common.liveStreamClasses)&&(tabSegment="listings"),t&&(currentSorting=0,$(".nDropDownMenus").find("a").removeClass("sort-active"),$(".nDropDownMenusFilter").find("a").removeClass("sort-active"),$(".divSorting").hide(),$("#divProfessionalSorting").hide(),$(".divSortingGalleryFilter").hide());var i="book"==tabSegment||"class"==tabSegment?-382:-280;switch(infobox=new InfoBox({content:document.getElementById("infobox"),disableAutoPan:!1,maxWidth:0,pixelOffset:new google.maps.Size(-125,i),zIndex:null,boxStyle:{width:"250px",opacity:"inherit"},closeBoxURL:"",infoBoxClearance:new google.maps.Size(1,1)}),"deals"!=tabSegment&&(dealserviceId=null),"professionals"==tabSegment?$("#divSearchStylist").show():$("#divSearchStylist").hide(),cloneSortoptions(),$(".prof-right-padding").addClass("data-padding-right"),$("#mobileFilter").removeClass("listing-mapfiler"),$("#mobilefilterChange").removeClass("listing-mapfiler"),$("#mobileServiceChange").addClass("listing-mapfiler"),$("#Div1111").addClass("listing-mapfiler"),$("#mobileDateChange").addClass("listing-mapfiler"),$("#ancFilter").attr("style",""),$("#pageSection").removeClass("booking-dateshow"),$("#divFilterMode").hide(),$("#divFilterModeMobile").hide(),$("#dvAdvanceFilter").removeClass("business-type-hide service-dtpick-hide"),$("#map_list_optiondiv").removeClass("with-filterhere"),$("#pageSection").removeClass("mobile-listing-business"),$("#myLikeNoDataMsg").text(noDataMsg),tabSegment){case"book":case"class":case"listings":$("#pHeaderText").html(""),$(".infoBox").hide(),"book"==tabSegment||"class"==tabSegment?$("#divNodataFeature").hide():$("#divNodataFeatureServices").hide(),$("#pageSection").addClass("mobile-listing-business"),$("#mobile-check").is(":visible")?$("#divFilterModeMobile").show():$("#divFilterMode").show(),"listings"==tabSegment&&$("#dvAdvanceFilter").addClass("service-dtpick-hide"),$("#btnMobile").show(),$("#btnMobileForMobile").show(),$(".nDropDownMenus #aSortOption_8").hide(),$(".nDropDownMenus #aSortOption_3").show(),$(".nDropDownMenus #aSortOption_9").hide(),$(".nDropDownMenus #aSortOption_10").hide(),(currentSorting=getSortingValue())>0&&($(".nDropDownMenus").find("a").removeClass("sort-active"),$(".nDropDownMenus #aSortOption_"+currentSorting).addClass("sort-active")),$("body").addClass("listing-like-page"),$("#dealListing").css("display","none"),$("#pageSection").removeClass("daily-deals-wrap"),$("#divListing").removeClass("daily-deals"),$("#dvAdvanceFilter").attr("style","display:block;"),$("#divGalleryFilter").attr("style","display:none;"),$("#professionalFilter").attr("style","display:block;"),$("#mobileServiceChange").removeClass("listing-mapfiler"),$("#mobilefilterChange").removeClass("listing-mapfiler"),$("#mobileFilter").addClass("listing-mapfiler"),$("#map_list_optiondiv").addClass("with-filterhere");var a="",r="",o="";if(null!=(C=getCookie(ProximityCookieName))){var n="";if(void 0!==C.businesstypes&&null!=C.businesstypes&&""!=C.businesstypes){$(".filter-pill-pkg").addClass("applied");for(var s=C.businesstypes.split(","),l=0;l<s.length;l++)n=n+", "+_featuredDtl.GetPluralBusinessType(s[l])}else $(".filter-pill-pkg").removeClass("applied");var d=void 0!==C.category&&"undefined"!=typeof isDealFilterApplied&&0==isDealFilterApplied?C.category.toLowerCase():C.businesstypes.toLowerCase(),c=jQuery.grep(HSnames,function(e){return e.HeroCategoryName.toLowerCase()==d});!String.isNullOrUndefineOrBlank(c)&&c.length>0&&"undefined"!=typeof isDealFilterApplied&&0==isDealFilterApplied?(o=c[0].H1,title=c[0].Title):(o="",title=""),a=C.businesstypes&&null!=C.businesstypes?n.replace(/^,|,$/g,"").trim():" Salons",r=null!=countryid&&"undefined"!=countryid&&"2"==countryid?null!=C.city&&null!=C.city&&""!=C.city?" in "+htmlEncode(C.city):"":null!=C.city&&null!=C.city&&""!=C.city?" in "+_common.SetCityState(htmlEncode(C.city),htmlEncode(state)):" in "+htmlEncode(state)}if("book"==tabSegment||"class"==tabSegment){if(void 0!==$("#txtServiceDate")&&null!=$("#txtServiceDate")&&$("#txtServiceDate").length>0&&"anytime"==$("#txtServiceDate").val().toString().toLowerCase()?($(".nDropDownMenus #aSortOption_9").hide(),$(".nDropDownMenus #aSortOption_10").hide()):($(".nDropDownMenus #aSortOption_9").show(),$(".nDropDownMenus #aSortOption_10").show()),$("#pageSection").addClass("booking-dateshow"),$("#mobileDateChange").removeClass("listing-mapfiler"),$("#divServiceDate").show(),businesstypes="","undefined"!=typeof serviceName&&null!=serviceName&&serviceName&&(service=serviceName,serviceName=""),LoadAdminServicesKeyphrase(),null!=keyphrasedata&&""!=keyphrasedata?$("#hHeaderText").html("Best "+keyphrasedata+r):$("#hHeaderText").html("Best "+service+r),"class"==tabSegment?$("#ddlBusMode").hide():($("#ddlBusMode").hide(),$("#ancFilter").attr("style","")),$("#atBusiness").removeClass("active"),$("#atMobile").removeClass("active"),$("#atStream").removeClass("active"),$(".athomecheck").hide(),HasIdExists(1)&&$("#atMobile").addClass("active"),HasIdExists(3)&&$("#atStream").addClass("active"),HasIdExists(2)&&($("#atBusiness").addClass("active"),$(".athomecheck").show()),!String.isNullOrUndefineOrBlank(service)&&!String.isNullOrUndefineOrBlank(C.city)&&$("#hHeaderBestsalon").length>0)if(LoadAdminServicesKeyphrase(),null!=keyphrasedata&&""!=keyphrasedata){var u=$("<div>").text(keyphrasedata).html();$("#hHeaderBestsalon").text("Best "+u+" in Nearby Cities")}else{u=$("<div>").text(service).html();$("#hHeaderBestsalon").text("Best "+u+" in Nearby Cities")}else{$("#hHeaderBestsalon").text("Best Salons in Nearby Cities")}!String.isNullOrUndefineOrBlank(service)&&!String.isNullOrUndefineOrBlank(C.city)&&$("#hHeaderRelatedSearch").length>0?(LoadAdminServicesKeyphrase(),null!=keyphrasedata&&""!=keyphrasedata?$("#hHeaderRelatedSearch").html("Related Searches to "+keyphrasedata):$("#hHeaderRelatedSearch").html("Related Searches to "+service)):$("#hHeaderRelatedSearch").html("Related Searches")}else{null==typeof a&&(a="Salons"),service="",_common.ClearService(),1==localStorage.getItem("isReloadPage")&&(a=localStorage.getItem("setbusinessType"));var p=a.replace(/\w+/g,function(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()});if(1==isAdvanceSearch&&localStorage.setItem("setbusinessType",a),p=p.trim(),void 0!==o&&null!=o&&""!=o&&$("#hHeaderBestsalon").length>0&&0==String.isNullOrUndefineOrBlank(d)){var h=$("<div>").text(o).html();$("#hHeaderBestsalon").html(h+" in Nearby Cities")}else if(void 0!==p&&null!=p&&""!=p&&"salons"!=p.toLowerCase()){u=$("<div>").text(a).html();$("#hHeaderBestsalon").html(u+" in Nearby Cities")}else $("#hHeaderBestsalon").html("Best Salons in Nearby Cities");if(void 0!==o&&null!=o&&""!=o&&$("#hHeaderRelatedSearch").length>0&&0==String.isNullOrUndefineOrBlank(d)?$("#hHeaderRelatedSearch").html("Related Searches to "+o):void 0!==p&&null!=p&&""!=p&&"yoga"!=p.toLowerCase()?$("#hHeaderRelatedSearch").html("Related Searches to "+a):$("#hHeaderRelatedSearch").html("Related Searches"),"undefined"!=o&&null!=o&&""!=o&&null!=p&&"undefined"!=p&&""!=p)$("#hHeaderText").html(o+r);else if($("#hHeaderText").html(a+r),null!=BusinessTypeTitles){var m=BusinessTypeTitles.filter(function(e){return e.HeaderType==p});if(null!=m&&m.length>0){var f=m[0];String.isNullOrUndefineOrBlank(f.City_StateHeader)||$("#hHeaderText").html(f.City_StateHeader.replace("[Business Type]",p).replace("[City]",city).replace("[State]",state.toUpperCase()))}}businesstypes=C.businesstypes,o=""}_common.setBookAService(service),null!=AdminServiceList.results&&0!=AdminServiceList.results.length||("undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()?AdminServiceList.results=[]:InitAdminServices()),null!=serviceDateTime&&null!=serviceDateTime&&""!=serviceDateTime||(serviceDateTime=getLocationDate());try{1==localStorage.getItem("isReloadPage")&&(localStorage.getItem("serviceDateTime").toLowerCase()==AnyTime.toLowerCase()?(isServiceAnyTime=!0,$("#txtMobileServiceDate").val(AnyTime),$("#txtServiceDate").val(AnyTime),serviceDateTime=getLocationDate()):serviceDateTime=new Date(localStorage.getItem("serviceDateTime")))}catch(e){}if(""!=serviceDate&&null!=serviceDate&&"Date"!=serviceDate||(serviceDate=serviceDateTime.format("MMM dd,yyyy")),""!=serviceTime&&null!=serviceTime&&"Time"!=serviceTime||(serviceTime=serviceDateTime.format("hh:nn a/p")),$("#mobile-check").is(":visible")){var g="";g=(new Date).getMonth()>6?(new Date).getFullYear()+1:(new Date).getFullYear(),applydatepicker({divid:"#mobileDateChange",textid:"#txtMobileServiceDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.LargeDateWithTime),callBackOnHide:onServicedateChange,defaultDateTime:serviceDateTime,pickTime:!0,formatTime:"h:mm A",contentWindow:datePicker_contentWindow,yearStart:(new Date).getFullYear(),yearEnd:g})}else applydatepicker({divid:"#divServiceDate",textid:"#txtServiceDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.MiniDate)+" [at] h:mm A",callBackOnHide:onServicedateChange,defaultDateTime:serviceDateTime,pickTime:!0,formatTime:"h:mm A",contentWindow:datePicker_contentWindow});null!=countryid&&"undefined"!=countryid&&"2"==countryid?$("#aCityState").html(htmlEncode(C.city)):$("#aCityState").html(_common.SetCityState(htmlEncode(C.city),htmlEncode(C.state))),$("#txtMobileCityState").val(_common.SetCityState(htmlEncode(C.city),htmlEncode(C.state))),ScrollTarget.addClass("map-scroll"),$("html, body").animate({scrollTop:0}),$("#spntextlist").html("Businesses Available in ");var v=parseInt($("#spnTotalRecords").html());if((isNaN(v)||0==v)&&$("#spnTotalRecords").html("No").attr("aria-label","No"),""!=C.businesstypes&&isNotSetByCookie){var A=jQuery.grep(HSnames,function(e){return e.HeroCategoryName.toLowerCase()==C.businesstypes.toLowerCase()});String.isNullOrUndefineOrBlank(A[0])||(C.businesstypes=A[0].HSBusinessType),generateCheckboxList(C.businesstypes,"chkbusiness"),isNotSetByCookie=!1}if(1==localStorage.getItem("isReloadPage")&&(generateCheckboxList(localStorage.getItem("businesstypes"),"chkbusiness"),localStorage.setItem("isReloadPage",0)),"listings"==tabSegment&&"undefined"!=typeof isStoreFilterInListing&&"true"==isStoreFilterInListing&&(generateCheckboxList(storeKeyWordForListingWithSpace,"chkFacilities",!0),generateCheckboxList(StoreKeyWordForGCListingWithSpace,"chkFacilities",!0),isStoreFilterInListing="false"),"listings"==tabSegment&&"undefined"!=typeof isCovidFilterInListing&&"true"==isCovidFilterInListing&&(generateCheckboxList(covidKeyWordForListingWithSpace,"chkFacilities",!0),isCovidFilterInListing="false"),"listings"==tabSegment&&"undefined"!=typeof isLiveStreamRoutingURL&&"true"==isLiveStreamRoutingURL){if(!String.isNullOrUndefineOrBlank(liveStreamCategoryName))$("#LiveStream"+liveStreamCategoryName.toLowerCase()).length>=0&&selectClassCategory($("#LiveStream"+liveStreamCategoryName.toLowerCase()),!1);_common.SelectLiveStreamClasses(),isLiveStreamRoutingURL="false"}loadGoogleMaps(!0,"map_canvas"),mapFlag=!0,setdefaultSortingOption("listSort",tabSegment),isServiceAnyTime&&($("#txtMobileServiceDate").val(AnyTime),$("#txtServiceDate").val(AnyTime),setTimeout(function(){$("#txtServiceDate").val(AnyTime),$("#txtMobileServiceDate").val(AnyTime)},100)),void 0!==isClickForOnlineGCStore&&1==isClickForOnlineGCStore&&_featuredDtl.loadAdvanceSearch(),void 0!==isClickForBNPL&&1==isClickForBNPL&&_featuredDtl.loadAdvanceSearch();break;case"professionals":$(".nDropDownMenus #aSortOption_8").hide(),$("#divNodataFeatureServices").hide(),$(".prof-right-padding").removeClass("data-padding-right"),(currentSorting=getSortingValue())>0&&($(".nDropDownMenusFilter").find("a").removeClass("sort-active"),$(".nDropDownMenusFilter #aSortOption_filter_"+currentSorting).addClass("sort-active")),myLikesCurrentValue>0&&setMylikesGalleryDDLSelection("professionals"),""!=(C=getCookie(ProximityCookieName)).businesstypes&&isNotSetByCookie&&(generateCheckboxList(C.businesstypes,"chkbusiness"),isNotSetByCookie=!1),$("#dealListing").css("display","none;"),$("#professionalFilter").attr("style","display:block;"),$("#pageSection").removeClass("daily-deals-wrap"),$("#divListing").removeClass("daily-deals"),$("#dvAdvanceFilter").attr("style","display:block;"),$("#divGalleryFilter").attr("style","display:none;"),setdefaultSortingOption("professionalSort",tabSegment);break;case"photos":$("#divNodataFeatureServices").hide(),$(".nDropDownMenus #aSortOption_8").hide(),$(".prof-right-padding").removeClass("data-padding-right"),(currentSorting=getSortingValue())>0&&($(".nDropDownMenusGalleryFilter").find("a").removeClass("sort-active"),$(".nDropDownMenusGalleryFilter #aSortOption_Galleryfilter_"+currentSorting).addClass("sort-active")),$("body").addClass("listing-like-page"),$("#divGalleryFilter").attr("style","display:block;"),$("#dvAdvanceFilter").attr("style","display:none;"),$("#dealListing").css("display","none"),$("#pageSection").removeClass("daily-deals-wrap"),$("#divListing").removeClass("daily-deals");var C=getCookie(ProximityCookieName);window.location.href.includes(myLikedStyleUrlValue)&&0==isLoadDataCallFromDDL&&(myLikesCurrentValue=1),myLikesCurrentValue>0?(setMylikesGalleryDDLSelection("photos"),$("#sectionheader h1").html((null!=portfolioTypes&&null!=portfolioTypes?portfolioTypes+" ":"")+"My Liked Styles"),$("#sectionheader p").html(null!=portfolioTypes&&null!=portfolioTypes?portfolioTypes+" ":"")):(null!=countryid&&"undefined"!=countryid&&"2"==countryid?$("#sectionheader h1").html((null!=portfolioTypes&&null!=portfolioTypes?portfolioTypes+" ":"")+"Styles"+(htmlEncode(C.city)&&null!=C.city&&""!=C.city?" in "+htmlEncode(C.city):" in "+htmlEncode(state))):$("#sectionheader h1").html((null!=portfolioTypes&&null!=portfolioTypes?portfolioTypes+" ":"")+"Styles"+(htmlEncode(C.city)&&null!=C.city&&""!=C.city?" in "+_common.SetCityState(htmlEncode(C.city),htmlEncode(state)):" in "+htmlEncode(state))),$("#sectionheader p").html("Find a"+(null!=portfolioTypes&&null!=portfolioTypes?" "+portfolioTypes:"")+" salon styles near you. Check out the specialties offered and book an appointment online easily"+(htmlEncode(C.city)&&null!=C.city&&""!=C.city?" in "+_common.SetCityState(htmlEncode(C.city),htmlEncode(state)):" in "+htmlEncode(state))+"! Browse portfolios and check out any products for sale.")),null!=_featured.catchStyleInfo&&0!=_featured.catchStyleInfo.length||_featured.getMainStyleCategory(),setdefaultSortingOption("gallerySort",tabSegment);break;case"deals":$("#divNodataFeatureServices").hide(),$("#divProfessionalSorting").hide(),$(".divSortingGalleryFilter").hide(),$(".divSorting").show(),$(".nDropDownMenus #aSortOption_8").show(),$(".nDropDownMenus #aSortOption_3").hide(),$(".nDropDownMenus #aSortOption_9").hide(),$(".nDropDownMenus #aSortOption_10").hide(),(currentSorting=getSortingValue())>0&&($(".nDropDownMenus").find("a").removeClass("active"),$(".nDropDownMenus #aSortOption_"+currentSorting).addClass("active")),myLikesCurrentValue>0&&setMylikesGalleryDDLSelection("deals"),""!=(C=getCookie(ProximityCookieName)).businesstypes&&isNotSetByCookie&&(generateCheckboxList(C.businesstypes,"chkbusiness"),isNotSetByCookie=!1),$("#dealListing").css("display",""),$("#ulFeatureBusiness").addClass("daily home-page-section"),$(".infoBox").hide(),$("#dvAdvanceFilter").attr("style","display:block;"),$("#divGalleryFilter").attr("style","display:none;"),$("#pageSection").addClass("daily-deals-wrap"),$("#divListing").addClass("daily-deals"),$("#spntextlist").html("daily deals available in "),$("body").addClass("listing-like-page");C=getCookie(ProximityCookieName);null!=countryid&&"undefined"!=countryid&&"2"==countryid?($("#spnCityState").html(htmlEncode(C.city)),$("#aCityState").html(htmlEncode(C.city)),$("#txtMobileCityState").val(htmlEncode(C.city))):($("#spnCityState").html(_common.SetCityState(htmlEncode(C.city),htmlEncode(state))),$("#aCityState").html(_common.SetCityState(htmlEncode(C.city),htmlEncode(state))),$("#txtMobileCityState").val(_common.SetCityState(htmlEncode(C.city),htmlEncode(state)))),ScrollTarget.addClass("map-scroll"),$("html, body").animate({scrollTop:0}),(v=$("#ulFeatureBusiness").find(".listings-business-parent-div").length)>0?loadGoogleMaps(!1,"map_canvas"):(loadGoogleMaps(!0,"map_canvas"),mapFlag=!0,$("#divNodataFeature").hide()),$("#dvDailyDealsDetail").html(""),$("#dvDailyDealsDetail").hide(),$("#pageSection").addClass("pagesectionFlex"),$("#professionalFilter").attr("style","display:block;"),$("#divServiceFilters").hide(),setdefaultSortingOption("listSort",tabSegment);break;case"/":case"home":LoadUpcomingLiveStreamClasses(UpComingLiveStreamFromType.Home),myLikesCurrentValue>0&&setMylikesGalleryDDLSelection("home")}var y=_common.getPager(tabSegment);""!=y?_featuredDtl.ShowFeature(y,"#"+tabSegment.split("/")[0],!0):_featuredDtl.ShowFeature(null,null,!0),""!=tabSegment&&"photos"!=tabSegment?($("#mobileApplyFilter").attr("onclick","_featuredDtl.loadAdvanceSearch();"),checkOverflow("divListingFilters","divLastSlide","N")?$("#divNextFilter").show():$("#divNextFilter").hide(),checkOverflow("divListingFilters","divFirstSlide","P")?$("#divPrevFilter").show():$("#divPrevFilter").hide(),CheckLiveStreamCategoryNextPrevious()):"photos"==tabSegment?($("#mobileApplyFilter").attr("onclick","_featured.loadGalleryFilters();"),checkOverflow("divGalleryFilters","divLastSlideGallery","N")?$("#divNextFilterGallery").show():$("#divNextFilterGallery").hide(),checkOverflow("divGalleryFilters","divFirstSlideGallery","P")?$("#divPrevFilterGallery").show():$("#divPrevFilterGallery").hide()):($("#divNextFilter").hide(),$("#divPrevFilter").hide(),$("#divNextFilterGallery").hide(),$("#divPrevFilterGallery").hide(),$("#divStreamNextFilter").hide(),$("#divStreamPrevFilter").hide()),($("#mobile-check").is(":visible")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&"home"!=tabSegment.toLowerCase()&&"/"!=tabSegment&&""!=tabSegment?("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&null==window.history.state?($("#mobileBack").hide(),$("#custmobileBack").show()):($("#mobileBack").show(),$("#custmobileBack").hide()),$(".atmobilecheck").hide(),$(".atstreamcheck").hide(),$(".athomecheck").hide(),$(".mobile-filter-result").removeClass("atmobileicon"),HasIdExists(1)&&($("#mobileFilter .location-text-mobile").css("display","none"),$(".atmobilecheck").show(),$(".mobile-filter-result").addClass("atmobileicon")),HasIdExists(3)&&$(".atstreamcheck").show(),HasIdExists(2)&&$(".athomecheck").show()):isFilterScreen?($("#mobileBack").show(),$("#custmobileBack").hide()):($("#mobileBack").hide(),$("#custmobileBack").hide())}}else location.href="../../deals"}function setMobileLocation(e){($("#txtMobileCityState").removeAttr("onclick"),$("#txtMobileCityState").removeAttr("readonly"),0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"book"==tabSegment.toLowerCase()))&&($("#txtMobileCityState").data("select2")&&1!=e||$("#txtMobileCityState").length>0&&(ctrlMobileCityState=new ProximitySearch($("#txtMobileCityState"),$("#hdngblCountryId"),$("#navCountryList")).init("mob-dropdown mobcommon-dropdown",!0)))}function getSortingValue(){return"photos"==tabSegment&&0==currentSorting&&(currentSorting=3),""!=lattitude&&null!=lattitude&&null!=longitude&&""!=longitude&&0==currentSorting&&(currentSorting=5),currentSorting}function cloneSortoptions(e,t){if(_common.VisibleControlLength("#mobile-check")>0&&0==$(".professional-sorting").length){var i=$(".divSortingFilter").clone(),a=$(".divSortingGalleryFilter").clone(),r=$(".divSorting").clone();i.appendTo("header .nav-bar").addClass("professional-sorting"),a.appendTo("header .nav-bar").addClass("gallery-sorting"),r.appendTo("header .nav-bar").addClass("listpage-sorting"),$(".professional-sorting").hide(),$(".gallery-sorting").hide(),$(".listpage-sorting").hide(),$(Webflow.ready)}}function generateCheckboxList(e,t,i){if(null!=e){var a=document.querySelector("#divListingFilters"),r=document.querySelector(".mobile-filter-result"),o=e.replace("Buy Now, Pay Later","Buy Now| Pay Later").split(",").map(e=>e.trim().replace("Buy Now| Pay Later","Buy Now, Pay Later"));if(!document.querySelector("#divFirstSlide")){var n=document.createElement("div");n.id="divFirstSlide",n.className="w-inline-block",n.setAttribute("aria-hidden","true"),a.appendChild(n)}if(o.forEach(function(e){if(""!==e&&!1===filterHaveValue(e,t)){var o=null;void 0!==i&&!0===i?"undefined"!=typeof storeKeyWordForListingWithSpace&&e.toLowerCase()===storeKeyWordForListingWithSpace.toLowerCase()||"undefined"!=typeof StoreKeyWordForGCListingWithSpace&&e.toLowerCase()===StoreKeyWordForGCListingWithSpace.toLowerCase()?((o=document.createElement("a")).id="ancListingOnlineStore",o.className="filter-result-text w-inline-block "+t,o.href="javascript:void(0);",a.appendChild(o)):"undefined"!=typeof covidKeyWordForListingWithSpace&&e.toLowerCase()===covidKeyWordForListingWithSpace.toLowerCase()&&((o=document.createElement("a")).id="ancListingCovid",o.className="filter-result-text w-inline-block "+t,o.href="javascript:void(0);",a.appendChild(o)):((o=document.createElement("a")).className="filter-result-text w-inline-block "+t+" vagaro-dismiss-tag",o.href="javascript:void(0);",o.setAttribute("aria-label",e),a.appendChild(o)),(n=document.createElement("div")).className="inner-bubble-text vagaro-dismiss-inner-txt",n.setAttribute("aria-hidden","true"),n.innerText=e,o.appendChild(n),(s=document.createElement("div")).className="vagaro-dismiss-img",o.appendChild(s),(l=document.createElement("img")).src=$("#hdcdnImagePath").val()+"PublicImages/Images/vagaro-tag-close-2.svg",l.className="inner-bubble-x",l.title="",l.alt="",l.setAttribute("role","button"),l.setAttribute("aria-label","Close"+e),l.width=10,l.height=10,s.appendChild(l),s.addEventListener("click",function(){removecheckBox(e,t)})}var n,s,l;""!==e&&!1===MobilefilterHaveValue(e,t)&&((o=document.createElement("a")).className="filter-result-text w-inline-block "+t+" vagaro-dismiss-tag",o.href="javascript:void(0);",o.setAttribute("aria-label",e),r.appendChild(o),(n=document.createElement("div")).className="inner-bubble-text vagaro-dismiss-inner-txt",n.setAttribute("aria-hidden","true"),n.innerText=e,o.appendChild(n),(s=document.createElement("div")).className="vagaro-dismiss-img",o.appendChild(s),(l=document.createElement("img")).src=$("#hdcdnImagePath").val()+"PublicImages/Images/vagaro-tag-close-2.svg",l.className="inner-bubble-x",l.title="",l.alt="",l.setAttribute("role","button"),l.setAttribute("aria-label","Close"+e),l.width=10,l.height=10,s.appendChild(l),s.addEventListener("click",function(){removecheckBox(e,t)}))}),document.querySelector("#divLastSlide")&&document.querySelector("#divLastSlide").remove(),!document.querySelector("#divLastSlide")){var s=document.createElement("div");s.id="divLastSlide",s.className="w-inline-block",s.setAttribute("aria-hidden","true"),a.appendChild(s)}nofilterHideShow()}}!function(e){_featured={},_featuredDtl={},_featuredDtl.IsPrmotion=function(){var t=!1;return e("#divEstablishment > div").length>0&&(t=e("#divEstablishment input[data-model=-2]:checkbox").prop("checked")),t},_featuredDtl.GetPluralBusinessType=function(e){if(""!=e&&void 0!==e){return"Acupuncture"==e?"Acupuncturists":"Cycling"==e?"Cyclists":["Cryotherapy","Holistic Therapy","Therapy","Physical Therapy"].indexOf(e.trim())>-1?e=e.substring(0,e.length-1)+"ies":["Barber","Braids","Lash Bar","Makeup","Permanent Makeup","Pilates","Tattoos","Tennis","Electrolysis","Extensions","Gyrotonic","Golf","Martial Arts","Swimming","Waxing","Yoga","Locs","Other","Sugaring","Teeth Whitening","Threading"].indexOf(e.trim())>-1?e:e+"s"}return""},_featuredDtl.ShowFeature=function(t,i){if(e("#divMapView").addClass("hide-map"),e("#alist a").addClass("active"),e("#mapArea a").removeClass("active"),e(".right-nav-div a").removeClass("active"),ScrollTarget.removeClass("map-scroll"),e("#dvServices").hide(),e("#divTopServices").hide(),e("#divServicesMainContainer").hide(),e("#divServicePromotions").hide(),e("#divServiceMap").hide(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType){var a=getCookie(ProximityCookieName);e("#spnAppLocationSearch").html(_common.SetCityState(a.city,a.state.toUpperCase())),e("#customerAppLocationSearch").show()}if(nofilterHideShow(),null!=t&&null!=t){var r=!1;e("#liAdvanceSearch,#liMap,#divServiceProvider").hide(),e("#liNearest,#liMostFar,#liBusinessRank,#liEndingSoon,#liNewest,#liHighestRated,#liLowestRated,#liOldest,#liHighestCost,#liLowestCost,#liAlphabeticSortAsc,#liAlphabeticSortDesc,#mapArea,#alist").css("display","none"),e("#liHighestRated a").html("Highest Rated"),e("#ulFeatureBusiness").show(),e("#dvFeatureBusiness").show(),"#listings"!=i&&e("#divFAQSearchServiceHead").hide(),"#listings"==i?(e(".divSorting").show(),e("#divListing").show(),e("#dvDailyDealsDetail").hide(),e("#divServiceFilters").css("display","flex"),e("#divProfessionalSorting").hide(),e(".divSortingGalleryFilter").hide(),window.location.href.indexOf(_common.liveStreamClasses)>-1&&(r=!0)):"#professionals"==i?(e(".divSorting").hide(),e("#divServiceProvider").show(),e("#divServiceFilters").hide(),e("#divProfessionalSorting").show(),e(".divSortingGalleryFilter").hide()):"#book"==i||"#class"==i?(e(".divSorting").show(),e("#divServiceFilters").css("display","flex"),e("#dvDailyDealsDetail").hide(),e("#divProfessionalSorting").hide(),e(".divSortingGalleryFilter").hide(),window.location.href.indexOf(_common.liveStreamClasses)>-1&&(r=!0)):"#photos"==i&&(e(".divSorting").hide(),e("#dvDailyDealsDetail").hide(),e("#divServiceFilters").hide(),e("#divProfessionalSorting").hide(),e(".divSortingGalleryFilter").show()),e(i).addClass("active"),0==r&&(t.init(),t.enableScroll(),t.load()),e("#dvHome").hide()}else _home.loadHomePageData(),e("#dvHome").show(),e("#dvFeatureBusiness").hide()},_featuredDtl.HideAdvanceSearch=function(){e("#AdvanceFilterContent").hide(),e("html, body").removeClass("overflowHidden")},_featuredDtl.HideGalleryFilter=function(){e("#divGalleryFilterContent").hide(),e("html, body").removeClass("overflowHidden")},_featuredDtl.showHidDistanceRadius=function(){""!=lattitude&&null!=lattitude&&null!=longitude&&""!=longitude?e("#divdistanceMiles").css("display","flex"):e("#divdistanceMiles").css("display","none")},_featuredDtl.loadAdvanceSearch=function(){try{var t={Action:"Deal Details",PageName:"Deal",Category:"Deal",BusinessName:"",BusinessID:"",isDealDetails:!1,IsListPage:!1,IsMapPage:!1,isFiltered:!0,DealName:""};_vgLogEvent.LogData(t)}catch(e){}if(void 0!==isClickForOnlineGCStore&&1==isClickForOnlineGCStore||void 0!==isClickForBNPL&&1==isClickForBNPL?e("#AdvanceFilterContent").hide():e("#AdvanceFilterContent").show(),e("html, body").addClass("overflowHidden"),DistanceText=3==countryid||4==countryid?"km":"mi",e("#divAdOtheLocation").show(),0==e("#divEstablishment > div").size()){e("#adfilterLoader").css("display","");var i=new vagaro.ajax;i.datamodel.Token="GetFacilitiesForAdvanceSearchPublic",i.datamodel.callback=_featuredDtl.loadAdvanceSearchCallback,i.datamodel.data=[],i.datamodel.Error=function(e){},i.Post()}else setCheckBox(businesstypes),void 0!==isClickForOnlineGCStore&&1==isClickForOnlineGCStore&&(setCheckBox("Online GC Store"),_featured.getAdvanceSearchData("homepagestore")),void 0!==isClickForBNPL&&1==isClickForBNPL&&(isClickForBNPL=!1,setCheckBox("Buy Now, Pay Later"),_featured.getAdvanceSearchData()),"undefined"!=typeof isCovidFilterInListing&&"true"==isCovidFilterInListing&&setCheckBox("COVID-19 Ready"),void 0!==countryid&&("undefined"==typeof IsCCSupportedCountry||1!=IsCCSupportedCountry)||"listings"!=tabSegment?HideShowControl("Online Store",!0):HideShowControl("Online Store",!1),"listings"==tabSegment||"book"==tabSegment||"class"==tabSegment?(e("#divAdOnlineStream").show(),e(".filter-tabs-menu").removeClass("filt-lastCurv")):(e("#divAdOnlineStream").hide(),e(".filter-tabs-menu").addClass("filt-lastCurv")),_featuredDtl.showHidUserFavourite();null!=UserID&&""!=UserID?(e("#divEstablishment").removeClass("nthchild-issue"),e("#divEstablishment > div:nth-child(1)").css("display","").addClass("filters-first"),e("#divEstablishment > div:nth-child(2)").removeClass("filters-first")):(e("#divEstablishment").addClass("nthchild-issue"),e("#divEstablishment > div:nth-child(2)").addClass("filters-first")),e("#divMapView").addClass("hide-map"),e("#ulFeatureBusiness").css("display",""),ScrollTarget.removeClass("map-scroll"),e("#alist a").addClass("active"),e("#mapArea a").removeClass("active"),e("html,body,#page-content-wrapper").animate({scrollTop:0},1e3),togglebusinesssearch(businessSearchMode),_featuredDtl.showHidDistanceRadius(),setTimeout(function(){e("#divbt").attr("tabindex","-1").attr("role","heading").focus()},100)},_featuredDtl.loadAdvanceSearchCallback=function(t){_featured.advanceFilterData=t;var i=e("#divEstablishment");i.html("");var a=e("#divLanguage");a.html("");var r=e("#divPayment");r.html("");var o=e("#divBusinessType");o.html("");var n=t;e("#txtBusinessLocationSearch,#professionalFilter,#txtServiceProviderPublicpage,#aSearchStylist,#ancFilter,.athomecheck,#divAdBusiness,#divAdOtheLocation,#divAdOnlineStream,#ulFeatureBusiness,#s2id_autogen1").attr("tabindex",-1),e("#divbt,#divamt,#divlan,#divpay").attr("tabindex",0);var s=jQuery.grep(n,function(e){return e.FacilityHeader.toLowerCase().indexOf("business type")>=0}).sort(function(e,t){return e.FacilityValue.localeCompare(t.FacilityValue)}),l=jQuery.grep(n,function(e){return e.FacilityHeader.toLowerCase().indexOf("payment")<0&&e.FacilityHeader.toLowerCase().indexOf("language")<0&&e.FacilityHeader.toLowerCase().indexOf("business type")&&e.FacilityHeader.toLowerCase().indexOf("highlights")<0}),d=jQuery.grep(n,function(e){return e.FacilityHeader.toLowerCase().indexOf("language")>=0}),c=jQuery.grep(n,function(e){return e.FacilityHeader.toLowerCase().indexOf("payment")>=0}),u="",p="",h="",m="",f="";if(""!=businesstypes)u=","+businesstypes.toLowerCase()+",";else{var g=getCookie(ProximityCookieName);u=g.businesstypes&&null!=g.businesstypes?","+g.businesstypes.replace("-"," ").toLowerCase()+",":""}""!=businessFacilities&&(p=","+businessFacilities.toLowerCase()+","),""!=kidsFacilities&&(h=","+kidsFacilities.toString().toLowerCase()+","),""!=isPromotionBusiness&&(m=isPromotionBusiness),""!=isFavouriteBusiness&&(f=isFavouriteBusiness),e.each(l,function(t){var a=null!=l[t].FacilityHeader&&""!=l[t].FacilityHeader?l[t].FacilityHeader.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",r=null!=l[t].FacilityHeaderID&&""!=l[t].FacilityHeaderID?l[t].FacilityHeaderID:"",o=null!=l[t].FacilityValue&&""!=l[t].FacilityValue?l[t].FacilityValue.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",n=null!=l[t].FacilityValueID&&""!=l[t].FacilityValueID?l[t].FacilityValueID:"",s="",d=!1;(-1!=p.indexOf(","+l[t].FacilityValue.toLowerCase()+",")||"promotion"==l[t].FacilityValue.toLowerCase()&&m||"my favorite"==l[t].FacilityValue.toLowerCase()&&f||"kid friendly"==l[t].FacilityValue.toLowerCase()&&-1!=h.indexOf(",1,")||"kids only"==l[t].FacilityValue.toLowerCase()&&-1!=h.indexOf(",2,")||void 0!==isClickForOnlineGCStore&&1==isClickForOnlineGCStore&&(l[t].FacilityValue.toLowerCase().indexOf("onlinegcstore")>-1||l[t].FacilityValue.toLowerCase().indexOf(StoreKeyWordForGCListingWithSpace.toLowerCase())>-1)||e("#ancListingOnlineStore").length>0&&l[t].FacilityValue.toLowerCase().indexOf(storeKeyWordForListingWithSpace.toLowerCase())>-1||e("#ancListingOnlineStore").length>0&&l[t].FacilityValue.toLowerCase().indexOf(StoreKeyWordForGCListingWithSpace.toLowerCase())>-1||e("#ancListingCovid").length>0&&l[t].FacilityValue.toLowerCase().indexOf(covidKeyWordForListingWithSpace.toLowerCase())>-1)&&(d=!0),s=0==i.children().size()?e('<div class="filters-checkbox filters-first"/>').appendTo(i):e('<div class="filters-checkbox"/>').appendTo(i);var c=e('<div class="checkbox-custom-black vagaro-checkbox"/>');e(c).appendTo(s);e("<input />",{type:"checkbox",value:l[t].FacilityValue,id:l[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")}).attr("data-model",l[t].ControlType).attr("data-facilityheader",""!=a.trim()?a:o).attr("data-facilityvalue",o).attr("data-facilityheaderid",r).attr("data-facilityvalueid",n).prop("checked",d).attr("aria-checked",d).attr("onclick","_featured.AdvancefilterValues(this);").attr("role","checkbox").attr("tabindex",0).appendTo(c),e("<label/>",{id:"label"+l[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")}).text(l[t].FacilityValue).attr("for",l[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")).attr("tabindex",0).attr("role","checkbox").attr("aria-checked",d).appendTo(c)}),e.each(d,function(t){var i="",r=!1,o=null!=d[t].FacilityHeader&&""!=d[t].FacilityHeader?d[t].FacilityHeader.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",n=null!=d[t].FacilityHeaderID&&""!=d[t].FacilityHeaderID?d[t].FacilityHeaderID:"",s=null!=d[t].FacilityValue&&""!=d[t].FacilityValue?d[t].FacilityValue.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",l=null!=d[t].FacilityValueID&&""!=d[t].FacilityValueID?d[t].FacilityValueID:"";-1!=p.indexOf(","+d[t].FacilityValue.toLowerCase()+",")&&(r=!0),i=0==a.children().size()?e('<div class="filters-checkbox filters-first"/>').appendTo(a):e('<div class="filters-checkbox"/>').appendTo(a);var c=e('<div class="checkbox-custom-black vagaro-checkbox"/>');e(c).appendTo(i);var u=d[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,""),h=String.isNullOrUndefineOrBlank(u)||"other"!=u.toLowerCase()?u:"divlanguage"+u;e("<input />",{type:"checkbox",value:d[t].FacilityValue,id:h}).attr("data-model",d[t].ControlType).attr("data-facilityheader",o).attr("data-facilityvalue",s).attr("data-facilityheaderid",n).attr("data-facilityvalueid",l).attr("aria-checked",r).attr("onclick","_featured.AdvancefilterValues(this);").attr("role","checkbox").attr("tabindex",0).prop("checked",r).appendTo(c),e("<label/>",{id:"lbl"+h}).text(d[t].FacilityValue).attr("for",h).attr("tabindex",0).attr("role","checkbox").attr("aria-checked",r).appendTo(c)}),e.each(c,function(t){var i=null!=c[t].FacilityHeader&&""!=c[t].FacilityHeader?c[t].FacilityHeader.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",a=null!=c[t].FacilityHeaderID&&""!=c[t].FacilityHeaderID?c[t].FacilityHeaderID:"",o=null!=c[t].FacilityValue&&""!=c[t].FacilityValue?c[t].FacilityValue.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",n=null!=c[t].FacilityValueID&&""!=c[t].FacilityValueID?c[t].FacilityValueID:"",s="",l=!1;-1!=p.indexOf(","+c[t].FacilityValue.toLowerCase()+",")&&(l=!0),("vagaro pay later"==c[t].FacilityValue.toLowerCase()&&"Vagaro Pay Later"==businesstypes||void 0!==isClickForBNPL&&1==isClickForBNPL&&c[t].FacilityValue.toLowerCase().indexOf("buy now, pay later")>-1)&&(l=!0),s=0==r.children().size()?e('<div class="filters-checkbox filters-first"/>').appendTo(r):e('<div class="filters-checkbox"/>').appendTo(r);var d=e('<div class="checkbox-custom-black vagaro-checkbox"/>');e(d).appendTo(s);e("<input />",{type:"checkbox",value:c[t].FacilityValue,id:c[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")}).attr("data-model",c[t].ControlType).attr("data-facilityheader",i).attr("data-facilityvalue",o).attr("data-facilityheaderid",a).attr("data-facilityvalueid",n).attr("aria-checked",l).attr("onclick","_featured.AdvancefilterValues(this);").attr("role","checkbox").attr("tabindex",0).prop("checked",l).appendTo(d),e("<label/>",{id:"lbl"+c[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")}).text(c[t].FacilityValue).attr("for",c[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")).attr("tabindex",0).attr("role","checkbox").attr("aria-checked",l).appendTo(d)});var v=jQuery.grep(s,function(e){return e.MasterServiceCategoryOrder}).sort(function(e,t){return e.MasterServiceCategoryOrder-t.MasterServiceCategoryOrder}),A=[],C=0;if(0==v.length&&(A.businessType="Business Types"),0!=v.length&&"Business Types"!=A.businessType)for(var y=0;y<v.length;y++)e.inArray(v[y].MasterServiceCategoryName,A)<0&&(A[C]=v[y].MasterServiceCategoryName,C++);(A=jQuery.grep(A,function(e){return"Other"!=e})).push("Other");for(y=0;y<A.length;y++){var b=A[y];s=[],s=jQuery.grep(v,function(e){return e.MasterServiceCategoryName.toLowerCase()==b.toLowerCase()}).sort(function(e,t){return e.FacilityValue.localeCompare(t.FacilityValue)});var S,k,D=!1;e.each(s,function(t){var i=null!=s[t].FacilityHeader&&""!=s[t].FacilityHeader?s[t].FacilityHeader.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",a=null!=s[t].FacilityHeaderID&&""!=s[t].FacilityHeaderID?s[t].FacilityHeaderID:"",r=null!=s[t].FacilityValue&&""!=s[t].FacilityValue?s[t].FacilityValue.trim().toLowerCase().replace(/[^a-zA-Z0-9]+/g,""):"",n=null!=s[t].FacilityValueID&&""!=s[t].FacilityValueID?s[t].FacilityValueID:"",l="",d=!1;if(-1!=u.indexOf(","+s[t].FacilityValue.toLowerCase()+",")&&(d=!0),0==D){$divbType1=e('<div class="_4-col-flex-filter filtercheckboxdiv w-clearfix bottom"/>').appendTo(o),k=e('<div class="filter-title web-display-small"/>').appendTo($divbType1);e("<label/>",{id:"lbl"+b.charAt(0).toUpperCase()+b.slice(1)}).text(b.charAt(0).toUpperCase()+b.slice(1)).appendTo(k);S=e('<div class="filter-cateinput"/>').appendTo($divbType1),l=e('<div class="filters-checkbox filters-first"/>').appendTo(S),D=!0}else l=e('<div class="filters-checkbox"/>').appendTo(S);var c=e('<div class="checkbox-custom-black vagaro-checkbox"/>');e(c).appendTo(l);e("<input />",{type:"checkbox",value:s[t].FacilityValue,id:s[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")}).attr("data-model",s[t].ControlType).attr("data-facilityheader",i).attr("data-facilityvalue",r).attr("data-facilityheaderid",a).attr("data-facilityvalueid",n).attr("aria-checked",d).attr("onclick","_featured.AdvancefilterValues(this);").attr("role","checkbox").attr("tabindex",0).prop("checked",d).appendTo(c),e("<label/>",{id:"lbl"+s[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")}).text(s[t].FacilityValue).attr("for",s[t].FacilityValue.replace(/[^a-zA-Z0-9]+/g,"")).attr("tabindex",0).attr("role","checkbox").attr("aria-checked",d).appendTo(c)})}e("#adfilterLoader").css("display","none"),_featuredDtl.clearAdvanceRating(),_featuredDtl.cleardistanceRadius(),_featuredDtl.showHidUserFavourite(),null!=UserID&&""!=UserID?(e("#divEstablishment").removeClass("nthchild-issue"),e("#divEstablishment > div:nth-child(1)").css("display","").addClass("filters-first"),e("#divEstablishment > div:nth-child(2)").removeClass("filters-first")):(e("#divEstablishment").addClass("nthchild-issue"),e("#divEstablishment > div:nth-child(2)").addClass("filters-first")),void 0!==isClickForOnlineGCStore&&1==isClickForOnlineGCStore&&_featured.getAdvanceSearchData("homepagestore"),void 0!==isClickForBNPL&&1==isClickForBNPL&&(isClickForBNPL=!1,_featured.getAdvanceSearchData()),HideShowControl("Online Store",void 0!==countryid&&"1"!=countryid&&1!=countryid||"listings"!=tabSegment),"listings"==tabSegment||"book"==tabSegment||"class"==tabSegment?(e("#divAdOnlineStream").show(),e(".filter-tabs-menu").removeClass("filt-lastCurv")):(e("#divAdOnlineStream").hide(),e(".filter-tabs-menu").addClass("filt-lastCurv")),(e("#divFilterModeMobile #btnAtBusinessMobile").hasClass("active")||e("#divFilterModeMobile #btnMobileForMobile").hasClass("active")||e("#listStreamFilterId").length>0)&&e("#listStreamFilterId").hide()},_featuredDtl.clearAdvanceRating=function(){e("#rating-input").prev().html(""),e("#rating-input").val(-1),e("#rating-input").rating({min:0,max:5,step:1})},_featuredDtl.cleardistanceRadius=function(){distanceRadius=105},_featuredDtl.showHidUserFavourite=function(){e("#divAdvanceSearch ul li:first").hide()}}(jQuery,window,document),HomeServicesDateChange=function(){("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("html, body").width()<767||$("#mobile-check").is(":visible"))&&$("#spnHomeServicesDate").show()};var onServicedateChange=function(e,t){var i=getdatepickervalue(t),a=i.format("MMM dd,yyyy"),r=i.format("hh:nn a/p"),o=!1;$("#mobile-check").is(":visible")&&isServiceAnyTime&&serviceDate==a&&serviceTime==r&&(o=!0),isServiceAnyTime=$(t).val().toLowerCase()==AnyTime.toLowerCase(),$("#mobile-check").is(":visible")?setdatepickervalue({divid:"#mobileDateChange",textid:"#txtMobileServiceDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.LargeDateWithTime)},i):DatePickerFormat(VagaroCountryDateFormat.MiniDate),(o||serviceDate!=a||serviceTime!=r||$("#mobile-check").is(":visible")&&1==isServiceAnyTime)&&_featured.applyServiceFilters()};function filterHaveValue(e,t){return $("#professionalFilter ."+t+" > .inner-bubble-text").filter(function(){return $.trim(this.innerHTML.replace("&amp;","&"))==$.trim(e)}).length>0}function MobilefilterHaveValue(e,t){return $(".mobile-filter-result ."+t+" > .inner-bubble-text").filter(function(){return $.trim(this.innerHTML)==$.trim(e)}).length>0}function nofilterHideShow(){"photos"==tabSegment?($(".mobile-galleryfilter-result").show(),$(".mobile-filter-result").hide(),$("#mobileFilter .mobile-galleryfilter-result a").length>0||$(".imgpromcheck").is(":visible")||$(".atmobilecheck").is(":visible")?($("#mobileFilter .mobile-galleryfilter-result").css("display","block").addClass("vagaro-tag-dismiss"),$("#mobileFilter .location-text-mobile").css("display","none")):($("#mobileFilter .mobile-galleryfilter-result").css("display","none").removeClass("vagaro-tag-dismiss"),$("#mobileFilter .location-text-mobile").css("display","block"))):($(".mobile-galleryfilter-result").hide(),$(".mobile-filter-result").show(),$("#mobileFilter .mobile-filter-result a").length>0||$(".imgpromcheck").is(":visible")||$(".atmobilecheck").is(":visible")?($("#mobileFilter .mobile-filter-result").css("display","flex").addClass("vagaro-tag-dismiss"),$("#mobileFilter .location-text-mobile").css("display","none")):($("#mobileFilter .mobile-filter-result").css("display","none").removeClass("vagaro-tag-dismiss"),$("#mobileFilter .location-text-mobile").css("display","flex")))}function loadGoogleMaps(e,t){DeleteMarkers(),ShowLoader(!0);var i=new google.maps.LatLngBounds;if(e&&"undefined"!=typeof google){if(initializeGoogle(t),null==map){var a=new google.maps.LatLng(countryLat,countryLon);return void i.extend(a)}ShowLoader(!1)}google.maps.event.addListener(map,"tilesloaded",function(e){ShowLoader(!1)}),google.maps.event.addListenerOnce(map,"idle",function(){ShowLoader(!1)});try{if(isRedomap){if(IsDefaultLocation){var r=getCookie(ProximityCookieName);a=new google.maps.LatLng(r.lat,r.long);i.extend(a)}isRedomap=!1}else map.setCenter(i.getCenter(),map.fitBounds(i))}catch(e){}}function DeleteMarkers(){"undefined"!=typeof google&&removeMarkers.length>0&&(clearMarkers(),infobox&&infobox.close(),removeMarkers=[],BusinessArr=[])}function initializeGoogle(e){var t="cooperative";(iPadAndroid||isWindowsPhone)&&(t="greedy"),1==countryid?(countryLat=38.1345,countryLon=-97.3828,countryZoom=4):2==countryid?(countryLat=52.5629,countryLon=-1.8017,countryZoom=5):3==countryid?(countryLat=54.9776,countryLon=-102.3046,countryZoom=3):4==countryid?(countryLat=-26.11598,countryLon=133.7695,countryZoom=4):(null!=countryid&&null!=countryid||(countryLat=38.1345),countryLon=-97.3828,countryZoom=4);var i=[{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"landscape",stylers:[{visibility:"off"}]}],a={mapTypeId:"roadmap",center:new google.maps.LatLng(countryLat,countryLon),zoom:countryZoom,gestureHandling:t,mapTypeControl:!1,streetViewControl:!1,styles:i};if(null==map){var r=document.getElementById(e);if("undefined"!=typeof GoogleMapId&&GoogleMapId&&(a.mapId=GoogleMapId,delete a.styles),a.minZoom=5,map=new google.maps.Map(r,a),"undefined"!=typeof GoogleMapId&&GoogleMapId){var o=new google.maps.StyledMapType(i);map.mapTypes.set("vagaro_map",o),map.setMapTypeId("vagaro_map")}firsttimeMap=!1}0==isRedomap&&google.maps.event.addListener(map,"dragend",function(){$(".redo-search-btn").show()})}function getLocationDate(){var e=iPadAndroid||isWindowsPhone?15:5,t=new Date;if(t.getHours()>=19){t=t.setTime(t.getTime()+216e5),t=new Date(t),t=new Date(t.getFullYear(),t.getMonth(),t.getDate(),9,0,0)}var i=t.format("nn"),a=parseInt(parseInt(i)%e);return a>0&&(i=i-a+e,t.setMinutes(i)),t}function onSearchClick(e,t,i,a,r){var o,n,s;if("locationSearch"==e?(o=$("#txtLocationSearch"),n=$(t.target).closest(".list-unstyled").find(".select2-input"),s=$("#hdngblCountryId")):"BusinesslocationSearch"==e&&(o=$(IdBusinessLocationSearch),n=$(t.target).closest(".list-unstyled").find(".select2-input"),s=$("#hdngblCountryId")),""!=n.val()&&""!=o.data().selectedid){var l="";if(ManageProximityState(l=void 0!==i?i:o.data().selectedid,n.val(),void 0!==a&&a),void 0===i||0!=(void 0!==r&&0==r)||1!=$("#mobile-check").is(":visible")||!HasIdExists(3)||"/"!==window.location.pathname&&""!==window.location.pathname||"listings"!=tabSegment?void 0!==i&&0==(void 0!==r&&0==r)&&-1==window.location.href.indexOf(_common.liveStreamClasses)&&_common.AddState(tabSegment):(_common.AddState("live-stream-classes"),$("body").hasClass("livestreampage")||($("body").addClass("livestreampage"),LoadLiveStreamPage())),null!=l&&"object"!=typeof l&&l.indexOf("|")>-1){var d=window.location.href.split("/"),c=d[0]+"//"+d[2],u=l.split("|")[0];if(businessURL=c+u,null!=businessURL&&""!=businessURL)return $url=$("<a/>"),$url.attr("href",businessURL),void $url[0].click();var p=getCookie(ProximityCookieName);if(null==p)return;return p.countryid==s.attr("data-countryid")?($url=$("<a/>"),$url.attr("href",businessURL),void $url[0].click()):void(setCurrentLocationforBusiness=!0)}if("detail"==BasePage.toLowerCase()){if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&("undefined"!=typeof IsBrandedApp||null!=IsBrandedApp||""!=IsBrandedApp||null!=IsBrandedApp)&&1==IsBrandedApp)return;var h="/listings";return"undefined"!=typeof promotionalURL&&null!=promotionalURL&&promotionalURL.length>0&&(h=h+"/"+promotionalURL),void(window.location.href=h)}"undefined"!=typeof isSetIsCurrentLocationCookie&&setCookie(ProximityIsCurrentLocation,isSetIsCurrentLocationCookie),ProximityValueChanged(null,!1,"BusinesslocationSearch"==e),pageReload()}else{if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){var m=$("#txtLocationSearch");return o.data().selectedid="location",void setCurrentLocationFromDatabase({coords:{latitude:37.78222,longitude:-122.46178}},m,"locationSearch",{target:m},{text:"San Francisco, CA"},"applocationchange","/")}vagaro.alertsmall({message:"Please provide a location.",title:"Alert",callback:function(){ProxymityValueChaning()}})}}function ManageProximityState(e,t,i){var a=EmptyProximityValue();(a.businesstypes=businesstypes,""!=t&&void 0!==e&&null!=e&&"object"==typeof e&&(a.countryid=e.countryID,a.currencysymbol=e.currencySymbol,a.lat=e.latitude,a.long=e.longitude,a.zip=e.zipCode,a.city=e.city,a.state=e.stateCode,a.stateName=e.state,a.utcOffset=e.utcOffset,a.timeZoneOffSet=e.timeZoneOffSet,a.isSupportDayLight=e.IsSupportDayLight),setCookie(ProximityCookieName,a),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#spnAppLocationSearch").html(_common.SetCityState(e.city,e.stateCode.toUpperCase())),i||"undefined"==typeof vgAppicationType||1!=vgAppicationType)||CallbackforMobileApp(0,0,"","","0","21|~|"+('{\\"cityName\\":\\"'+_common.SetCityState(a.city,a.state.toUpperCase())+'\\", \\"latitude\\":\\"'+a.lat+'\\", \\"longitude\\":\\"'+a.long+'\\", \\"countryId\\":'+a.countryid+"}"))}function ProxymityValueChaning(e){SetProximityVariables(e),null!=cltrlLocationSearch&&cltrlLocationSearch.init("top-dropdown",!1),null!=ctrlMobileCityState&&ctrlMobileCityState.init("mob-dropdown mobcommon-dropdown",!1)}function SetProximityVariables(e){if(0!=IsCookieEnabled()&&1!=IsCookieEnabled()){var t=getCookie(ProximityCookieName);return null!=t?(lattitude=t.lat,longitude=t.long,countryid=t.countryid,zip=t.zip,city=t.city,state=t.state,stateName=t.stateName,currencysymbol=t.currencysymbol,businesstypes=t.businesstypes,utcOffset=t.utcOffset,e&&""!=serviceDateTime||(serviceDateTime=getLocationDate())):countryid=1,!0}}function ProximityValueChanged(e,t,i){ProxymityValueChaning(i),isFilterScreen||(void 0===tabSegment||"listings"!=tabSegment&&"class"!=tabSegment||1!=$("#btnLiveStreamMobile").hasClass("active")?loadData(e,t):(setdefaultSortingOption("listSort","listingsLive"),1==$("#mobile-check").is(":visible")&&loadData(e,t)))}function setCurrentLocationFromDatabase(e,t,i,a,r,o,n){try{if(String.isNullOrUndefineOrBlank(e))return;var s=e.coords.latitude,l=e.coords.longitude,d=new vagaro.ajax;d.datamodel.Token="GetCurrentLocation",d.datamodel.data=[s,l,25,!1],d.datamodel.callback=function(e){if(null!=e){if(e.stateName=e.state,IsDefaultLocation=e.IsDefaultLocation,CountryID=e.countryID,e.state=e.stateCode.toLowerCase().replace(/\b[a-z]/g,function(e){return e.toUpperCase()}),"applocationchange"==o&&void 0!==$(a.target).attr("id").toLowerCase()&&"txtlivestreamlocationsearch"==$(a.target).attr("id").toLowerCase()&&(o="applocationchangeLiveStream"),"onlocationchange"==o||"applocationchange"==o){e.id="location",e.text=_common.SetCityState(e.city,e.stateCode.toLowerCase().replace(/\b[a-z]/g,function(e){return e.toUpperCase()})),t.select2("data",e),$(a.target).data("response",JSON.stringify(e)),$(a.target).attr("id").toLowerCase()!=DocIdBusinessLocationSearch&&$(IdBusinessLocationSearch).length>0&&$(IdBusinessLocationSearch).data("response",JSON.stringify(e)),_common.SetChoiceForSeleect2(t,e);try{"applocationchange"==o&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$(a.target).attr("id").toLowerCase()!=DocIdBusinessLocationSearch&&IdBusinessLocationSearch.data("selectedid","")}catch(e){}if(1==$(a.target).data().instantsearch){var r=!0;"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==n&&null!=n&&(r="home"==n.toLowerCase()||"/"==n||""==n,$("html,body").removeClass("mob-overflow-hidden")),onSearchClick(i,a,e,"applocationchange"==o,r)}}else if("loaddatabypage"==o){var s=EmptyProximityValue(),l=getCookie(ProximityCookieName);if($(IdBusinessLocationSearch).length>0&&$(IdBusinessLocationSearch).data("response",JSON.stringify(e)),void 0!==e&&null!=e){if(void 0===e.countryID?s=_common.SetDefaultCookie(l):(s.countryid=e.countryID,s.currencysymbol="2"==e.countryID?"£":"$",s.lat=e.latitude,s.long=e.longitude,s.zip=e.zipCode,s.city=e.city,s.state=e.state,s.timeZoneOffSet=e.timeZoneOffSet,s.isSupportDayLight=e.IsSupportDayLight),ipLocation=e.latitude+","+e.longitude,"undefined"!=typeof vgAppicationType&&1==vgAppicationType)CallbackforMobileApp(0,0,"","","0","21|~|"+('{\\"cityName\\":\\"'+_common.SetCityState(s.city,s.state.toUpperCase())+'\\", \\"latitude\\":\\"'+s.lat+'\\", \\"longitude\\":\\"'+s.long+'\\", \\"countryId\\":'+s.countryid+"}"))}else s=_common.SetDefaultCookie(l);setCookie(ProximityCookieName,s),null==a&&$("#dvtimezone").is(":visible")?_common.UpdateTimeZoneLocationCookie(!0):_common.UpdateTimeZoneLocationCookie(!1),SetProximityVariables(),setDropDown(!0),isRedomap&&0==("undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&_common.AddState(n),loadData(n,!0)}"undefined"!=typeof _siteBuilderDetail?"applocationchangeLiveStream"==o?($("#txtLiveStreamLocationSearch").select2("destroy"),$("#txtLiveStreamLocationSearch").off("selected"),$("#txtLiveStreamLocationSearch").off("select2-close"),$("#divLiveStreamLocationSearchPopUp").modal("hide"),_siteBuilderDetail.gblsource="LiveStreamBusinessLocationSearch",_siteBuilderDetail.onSearchClick(_siteBuilderDetail.gblsource,a,e,!1,_siteBuilderDetail.flagAddState),void 0!==_siteBuilderDetail.isSetIsCurrentLocationCookie&&_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityIsCurrentLocation,_siteBuilderDetail.isSetIsCurrentLocationCookie),IsNewAddressHtml?(_siteBuilderDetail.IsShowNewadd=!0,_shopdetail.NewAddressHtml(),void 0!==_onlineCheckout.isClassCheckout&&_onlineCheckout.isClassCheckout&&_onlineCheckout.ChangeCustomerStartTime(e.timeZoneOffSet,e.countryID,e.IsSupportDayLight),_shopdetail.ChangeCustomerStartTime(e.timeZoneOffSet,e.countryID,e.IsSupportDayLight),$("html, body").removeClass("moboverflow-hide")):(_common.UpdateTimeZoneLocationCookie(!0),ShowLoader(!1))):"txtLiveStreamLocationSearch"==a.currentTarget.id&&($("#txtLiveStreamLocationSearch").select2("destroy"),$("#txtLiveStreamLocationSearch").off("selected"),$("#txtLiveStreamLocationSearch").off("select2-close"),$("#divLiveStreamLocationSearchPopUp").modal("hide"),_siteBuilderDetail.onSearchClick(_siteBuilderDetail.gblsource,a,e,!1,_siteBuilderDetail.flagAddState),void 0!==_siteBuilderDetail.isSetIsCurrentLocationCookie&&_siteBuilderDetail.setCookie(_siteBuilderDetail.ProximityIsCurrentLocation,_siteBuilderDetail.isSetIsCurrentLocationCookie),IsNewAddressHtml?(_siteBuilderDetail.IsShowNewadd=!0,_shopdetail.NewAddressHtml(),void 0!==_onlineCheckout.isClassCheckout&&_onlineCheckout.isClassCheckout&&_onlineCheckout.ChangeCustomerStartTime(e.timeZoneOffSet,e.countryID,e.IsSupportDayLight),_shopdetail.ChangeCustomerStartTime(e.timeZoneOffSet,e.countryID,e.IsSupportDayLight),$("html, body").removeClass("moboverflow-hide")):("txtLiveStreamLocationSearch"==$(_siteBuilderDetail.gblevent.target).attr("id")&&_common.UpdateTimeZoneLocationCookie(!0),ShowLoader(!1))):String.isNullOrUndefineOrBlank($(a.target).attr("id"))||"txtLiveStreamLocationSearch"!=$(a.target).attr("id")||_common.SetLocationBySearch(a,!0)}},d.datamodel.Error=function(e){alert("Oops, we cant's find your location")},d.Post()}catch(e){}}function pageReload(){if(1==isAdvanceSearch){if(localStorage.setItem("isAdvanceSearchMenu",1),isAdvanceSearch=!1,"home"==BasePagePervious.toLowerCase()){HideAdvanceSearchModel();try{if($("#txtLocationSearch").val($("#txtBusinessLocationSearch1").val()),$("#txtBusinessLocationSearch").val($("#txtBusinessLocationSearch1").val()),""!=$("#txtBusinessLocationSearch1").data("selectedid")){var e=$("#txtBusinessLocationSearch1").data("selectedid");$("#txtLocationSearch").select2("val",e),$("#txtBusinessLocationSearch").select2("val",e),$("#txtLocationSearch").data("selectedid",e).data("isselected",!0),$("#txtBusinessLocationSearch").data("selectedid",e).data("isselected",!0),isLocationByDefault=!0}}catch(e){}}else localStorage.setItem("isReloadPage",1),location.reload();return!1}try{if($("#txtLocationSearch").val($(IdBusinessLocationSearch).val()),""!=$(IdBusinessLocationSearch).data("selectedid")){e=$(IdBusinessLocationSearch).data("selectedid");$("#txtLocationSearch").select2("val",e),$("#txtLocationSearch").data("selectedid",e).data("isselected",!0)}!$("#divFilterModeMobile #btnAtBusinessMobile").hasClass("active")&&!$("#divFilterModeMobile #btnMobileForMobile").hasClass("active")&&!$("#divFilterModeMobile #btnLiveStreamMobile").hasClass("active")&&$("#listStreamFilterId").length>0&&($("#listStreamFilterId").hide(),$("#divFilterModeMobile #btnAtBusinessMobile").addClass("active"))}catch(e){}}var BasePagePervious=BasePage,isLocationByDefault=!1;function HideAdvanceSearchModel(){return $(".transform-active").is(":visible")&&($(".new-header-design").toggleClass("transform-active",500),$("#menuBar").toggleClass("header-border-none"),$(".search-backdrop").toggleClass("backdrop-visible"),$(".search-nav-bar").toggleClass("hidden-class")),setAdvSearchDefaultName(),!1}function setAdvSearchDefaultName(){1==isAdvanceSearch?(IdSearchServiceMain="#txtSearchServiceMain1",DocIdSearchServiceMain="txtSearchServiceMain1",IdBusinessLocationSearch="#txtBusinessLocationSearch1",DocIdBusinessLocationSearch="txtBusinessLocationSearch1",IdHomeServicesDate="#txtHomeServicesDate1"):(IdSearchServiceMain="#txtSearchServiceMain",DocIdSearchServiceMain="txtSearchServiceMain",IdBusinessLocationSearch="#txtBusinessLocationSearch",DocIdBusinessLocationSearch="txtBusinessLocationSearch",IdHomeServicesDate="#txtHomeServicesDate")}function dummyreleasesearch(){}function isMobileDevice(){return/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)}$("#txtLocationSearch,.search-backdrop, #s2id_autogen1").click(function(){($(".new-header-design").toggleClass("transform-active",500),$("#menuBar").toggleClass("header-border-none"),$(".search-backdrop").toggleClass("backdrop-visible"),$(".search-nav-bar").toggleClass("hidden-class"),isAdvanceSearch=!1,$(".transform-active").is(":visible"))?(BasePage="Home",isAdvanceSearch=!0,setAdvSearchDefaultName(),PageBindAdvSearch(),$("#txtBusinessLocationSearch1").select2("focus"),$("#txtBusinessLocationSearch1").data("select2").val($("#txtLocationSearch").val()),isLocationByDefault=!0):BasePage=BasePagePervious}),LoadAdminServicesKeyphrase=function(){var e=service;if(void 0!==e&&""!=e){if(!AdminServiceList||!Array.isArray(AdminServiceList.results))return void(keyphrasedata="");var t,i=AdminServiceList.results;t=findObjectBytext(i,e),keyphrasedata=null!=t?t.Keyphrase:service}},function(e){"use strict";e.fn.sliderResponsive=function(t){var i,a=e.extend({slidePause:3e3,fadeSpeed:400,autoPlay:"on",showArrows:"off",hideDots:"on",hoverZoom:"off",titleBarTop:"off"},t),r=e(this),o=r.find("> div").length,n=0;function s(){i=setInterval(function(){l()},a.slidePause)}function l(){(n=r.find(".show").index()+1)>o-1&&(n=0),d()}function d(){r.find(".show").removeClass("show").fadeOut(),r.find("> div").eq(n).fadeIn(a.fadeSpeed).addClass("show");var t=r.find("> div").eq(n).data("service-name");e(".service-name").text(t)}return r.find("div:first-of-type").addClass("show"),r.find("> div").not(".show").fadeOut(),"on"===a.autoPlay&&s(),"on"===a.showArrows&&r.addClass("showArrows"),"on"===a.hideDots&&r.addClass("hideDots"),"off"===a.hoverZoom&&r.addClass("hoverZoomOff"),"on"===a.titleBarTop&&r.addClass("titleBarTop"),r.mouseover(function(){"on"===a.autoPlay&&clearInterval(i)}),r.mouseout(function(){"on"===a.autoPlay&&s()}),r.find("> .right").click(l),r.find("> .left").click(function(){(n=r.find(".show").index()-1)<0&&(n=o-1);d()}),r.find(" > ul > li").click(function(){n=e(this).index(),d(e(this).index())}),r}}(jQuery),$(document).ready(function(){$("#sliderHomePageHero").find("> div").length>0&&$("#sliderHomePageHero").sliderResponsive({hideDots:"on"}),$(document).on("touchstart click",function(e){$(e.target).closest(".homepage-slider-mobile-button").length||$(e.target).closest("#divHomePageBannerMobileBeauty").length||$(e.target).closest("#divHomePageBannerMobileFitness").length||$(e.target).closest("#divHomePageBannerMobileWellness").length||$(".tips-mobile-section").animate({bottom:"-100%"},{duration:200,complete:function(){$(".tips-mobile-section-fade").hide()}})})}),function(){var e=history.pushState,t=history.replaceState;history.pushState=function(){e.apply(history,arguments),window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange"))},history.replaceState=function(){t.apply(history,arguments),window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange"))},window.addEventListener("popstate",function(){window.dispatchEvent(new Event("locationchange"))})}(),window.addEventListener("locationchange",function(){var e=window.location.href;"undefined"==typeof VParentDomain&&(VParentDomain=""),$("#mobile-check").is(":visible")||"undefined"!=typeof vgAppicationType&&1==vgAppicationType||($("#divMasterTopSerachBar").show(),(null!=history&&null!=history.state&&null!=history.state.sectionName&&null!=history.state.basepage&&"home"==history.state.sectionName.toLowerCase()&&"home"==history.state.basepage.toLowerCase()||e==VParentDomain)&&$("#divMasterTopSerachBar").hide())}),function(){var e="websiteapi/homepage/";isCheckInApp=!1;var t=!1,i=[];PromotionProviderID="";var a={geteventcartdetail:"geteventcartdetail",getnextavailabledateworkshop:"getnextavailabledateworkshop",checkuserexistanceinevent:"checkuserexistanceinevent",geteventdetailandavailabledates:"geteventdetailandavailabledates",savewaitlist:"savewaitlist",getavailablemultievents:e+"getavailablemultievents",LoadUserControl:e+"loadusercontrol",getonlinebookingtabdetail:e+"getonlinebookingtabdetail",getavailabledates:"getavailabledates",getavailabledatesforevents:e+"getavailabledatesforevents",GetCalendarDepositSettingAndCCDetails:"appointment/getcalendardepositsettingandccdetails",geteventdetailforreschedule:e+"geteventdetailforreschedule",geteventdetailforrescheduleforworkshop:e+"geteventdetailforrescheduleforworkshop"};$('INPUT[type="text"]',".eventcreditCardInfo").change(function(){$(this).removeClass("errorInput"),$(this).removeClass("errorInputCal")}),$('INPUT[type="password"]',".eventcreditCardInfo").change(function(){$(this).removeClass("errorInput"),$(this).removeClass("errorInputCal")}),$("textarea",".eventcreditCardInfo").change(function(){$(this).removeClass("errorInput"),$(this).removeClass("errorInputCal")}),$("select",".eventcreditCardInfo").change(function(){$(this).removeClass("errorInput"),$(this).removeClass("errorInputCal")}),$(".dropdowndiv",".eventcreditCardInfo").on("change","select",function(){$(this).closest("div").removeClass("errorInput"),$(this).closest("div").removeClass("errorInputCal")}),Date.isLeapYear=function(e){return e%4==0&&e%100!=0||e%400==0},Date.getDaysInMonth=function(e,t){return[31,Date.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())},Date.prototype.addMonths=function(e){var t=this.getDate();return this.setDate(1),this.setMonth(this.getMonth()+e),this.setDate(Math.min(t,this.getDaysInMonth())),this},Array.prototype.uniqueObjects=function(e){function t(t,i){var a;if(e){for(var r=0;r<e.length;r++)if(t[a=e[r]]!=i[a])return!1}else for(a in t)if(t[a]!=i[a])return!1;return!0}return this.filter(function(e,i,a){for(var r=0;r<i;r++)if(t(e,a[r]))return!1;return!0})},Array.prototype.keySort=function(e){var t=function(e,t){var i,a=0;for(i in e)if(e.hasOwnProperty(i)){if(a==t)return i;a++}return!1},i=function(e,t,i){return i=null!==i?i:1,e==t?0:e>t?1*i:-1*i},a=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i}(e=e||{});if(!a)return this.sort(i);for(var r in e)e[r]="desc"==e[r]||-1==e[r]?-1:"skip"==e[r]||0===e[r]?0:1;return this.sort(function(r,o){for(var n=0,s=0;0===n&&s<a;){var l=t(e,s);if(l){var d=e[l];n=i(r[l],o[l],d),s++}}return n}),this},String.prototype.getTextFromHtml||(String.prototype.getTextFromHtml=function(){var e=this;try{e=$(document.createElement("div")).html(e).text()}catch(e){}return e});var r=new Array,o=[],n=[],s=null,l=null,d=null,c="Class",u="Classes";IsOnlineCustomerWaitlist=!1;var p=5,h=1,m=2,f=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],g=["January","February","March","April","May","June","July","August","September","October","November","December"];"undefined"!=typeof ChangeAppStatus&&ChangeAppStatus.IsSearchFromInHouseClass()&&((_shopdetail={}).serviceID="",_shopdetail.providerID="",_shopdetail.PromotionID="",_shopdetail.bookingDateTime="",_shopdetail.isClassCalenderFilled=!1,_shopdetail.lastClassBookingDateConfigured=!1,_shopdetail.lastClassBookingLimit="",_shopdetail.lastClassBookingDate=""),_vgClassSessionSelection={localData:{},model:{IsOnline:!0,IsSearchFromInHouseClass:!1,ExceptionStorage:"Exception",EventStorage:"Event",WaitlistEventStorage:"Waitlist",ddlRecurringType:"ddlRecurringType",divWeek:"divWeek",liWeekDays:"liWeekDays",divMonth:"divMonth",txtNoofAttendees:"txtNoofAttendees",strSessionCountmsg:"Number of sessions cannot be less than selected week days.",ClassFullExceptionData:null,divStreamingEventPrice:"#divStreamingEventPrice",divStreamingEventPrice_Old:"#divStreamingEventPrice_Old",aAtBusinessStream:"#aAtBusinessStream",aLiveStream:"#aLiveStream",hdnUserIDAppointment:null,Somethingwentwrong:"Something went wrong.",txtCustomerSearchClass:null,DateFormatdddMMMDDYYYY:"ddd, MMM DD, YYYY",DateFormathmmA:"h:mm A",WaitlistBookSuccess:"Waitlist {0} booked successfully.",RescheduleBookSuccess:"The customer's {0} has been rescheduled.",ClassBookSuccess:" has been booked.",RescheduleAppointmentID:0,FeeStorage:"Fee",AttendeeAddonDetails:[]},commonProperty:{ClassFull:1,SPNotAvalable:2,UnAvailableDate:3,availabledates:"",otherSPavailabledates:"",businessID:0,SPID:0,UserID:0,UserCellNo:"",FullUserName:"",teacherName:"",UserEmail:"",eventID:0,eventName:"",tax:0,smallImage:"",startTime:"",shortStartTime:"",appointmentId:0,sessiondetail:"",streamingStatus:0,gCOrPackageDetail:"",cartUserList:"",isYearlySelection:!1,workshopEventOn:"",workshopEventDays:"",workshopEventDate:"",enableSessionDate:[],isWaitlist:!1,isWorkShop:!1,PromotionID:0,IsAmount:!1,AmountValue:0,IsOpenClassPopup:0,PreviousClassRow:"",lstfamilyfriendmembers:{},pointRedeem:0,MultiSPIdOpen:"",MultiSPIsClose:!1,DepositPaid:0,DepositsPaidDate:null,IsPaid:!1,promotionamt:0,CalculatedTaxTypeWise:[],isAddonPopup:!1,IsFromClass:!1,MembershipPackageDetailsForClass:null},TypeClass:{Single:1,Multiple:2,Any:3},offlineProperty:{ddAtWeeks:"ddAtWeeks",ddAtMonth:"ddAtMonth",lblAtDay:"lblAtDay",ddlblAtWeek:"ddlblAtWeek"},StreamingFilterType:{InHouseAndLiveStream:1,InHouse:2,LiveStream:3},StreamingDBFilterType:{InHouse:1,LiveStream:2,InHouseAndLiveStream:3},StreamingStatusEnum:{InHouse:0,LiveStream:1},SearchClassFrom:{Search:1,Rebook:2,Reschedule:3},ComponentResponse:{lstClass:null},Controls:{ClassSectionStencil:"#class-section-stencil",ClassesMainDiv:"#classesMainDiv",ddlFilterTypes:"#ddlFilterTypes",dvStreamType:"#dvStreamType",PageName:"searchnewclass",liSelectedClassName:"drpselected",searchClassPopup:"#searchClassPopup",txtCustomerSearchAppointment:"[id$=txtCustomerSearchClass]",hdnUserIDAppointment:"[id$=hdnUserIDAppointment]",dvBtSearchEdit:"#dvBtSearchEditCls",dvBtSearchHistory:"#dvBtSearchHistoryCls",SearchClassFromCalendar:"SearchClassFromCalendar",AddOnList:"#ClassAddOnList",tmplAddOnCategory:"#tmplClassAddOnCategory",tmplAddOnService:"#tmplClassAddOnService",AddonServices:"#Service_",divAddonPopupSection:"#divAddonPopupSection",divHdrEventPrice:"#divHdrEventPrice"},initOffline:function(e){this.model.IsOnline=e,this.model.IsSearchFromInHouseClass=_vgClassSessionSelection.IsSearchFromInHouseClass(),$("#ddAtWeeks input").each(function(){var e=$(this);e.off("change"),e.on("change",function(){_vgClassSessionSelection.WeekdayCheckbox_Change(e)})})},NoOfSessionChangedOffline:function(e,t){""==e.get_value()&&(e.set_value(1),e.set_textBoxValue("1")),_vgCal.ManageAtnd.ShowHideAtCount(),_vgClassSessionSelection.CalcAndDisplayPriceOffline()},Getgrouparray:function(){return r},GetStartDate:function(){return this.model.IsOnline?getdatepickervalue("#txtEventFromDate"):getdatepickervalue(_EndtextsessionDatePickerID,null,!0,null,!0)},GetDayNo:function(){return this.model.IsOnline?parseInt($("#txtNoofDays").val()):parseInt($("#txtSessionClassMntDate").val())},GetNoOfSessions:function(){return this.model.IsOnline?parseInt($("#txtQuantity").val()):void 0!==_vgClassSessionSelection.commonProperty.availabledates&&void 0!==_vgClassSessionSelection.commonProperty.availabledates.eventDetail&&null!=_vgClassSessionSelection.commonProperty.availabledates.eventDetail&&_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop&&void 0!==_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&null!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates?_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length:""==$("#txtSessionFrequency").val()?1:parseInt($("#txtSessionFrequency").val())},GetNoOfweeks:function(){return this.model.IsOnline?parseInt($("#txtNoofWeeks").val()):parseInt($("#txtSessionWksFrequency").val())},GetNoOfAttendees:function(){return this.model.IsOnline?parseInt($("#"+this.model.txtNoofAttendees).val()):_vgCal.ManageAtnd.GetNoOfAttendee()},GetRecurringType:function(){var e="";this.model.IsOnline?e=$("#"+this.model.ddlRecurringType).val():e=$("#classSelectionRepeat").find("a.active").data("value").toString();return e},toWords:function(e){var t=["","thousand","million","billion","trillion"],i=["zero","one","two","three","four","five","six","seven","eight","nine"],a=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],r=["twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if((e=(e=e.toString()).replace(/[\, ]/g,""))!=parseFloat(e))return"not a number";var o=e.indexOf(".");if(-1==o&&(o=e.length),o>15)return"too big";for(var n=e.split(""),s="",l=0,d=0;d<o;d++)(o-d)%3==2?"1"==n[d]?(s+=a[Number(n[d+1])]+" ",d++,l=1):0!=n[d]&&(s+=r[n[d]-2]+" ",l=1):0!=n[d]&&(s+=i[n[d]]+" ",(o-d)%3==0&&(s+="hundred "),l=1),(o-d)%3==1&&(l&&(s+=t[(o-d-1)/3]+" "),l=0);if(o!=e.length){var c=e.length;s+="point ";for(d=o+1;d<c;d++)s+=i[n[d]]+" "}return s.replace(/\s+/g," ")},HideShowWeekOrMonth:function(){$(".signupweek-day").removeClass("signup-weeks-width");var e=this.GetRecurringType();if(this.model.IsOnline)switch(e){case"1":$("#"+this.model.divWeek).hide(),$("#"+this.model.liWeekDays).hide(),$("#"+this.model.divMonth).hide();break;case"2":$("#"+this.model.divWeek).show(),$("#"+this.model.liWeekDays).show(),$("#"+this.model.divMonth).hide();break;case"3":$("#"+this.model.divWeek).hide(),$("#"+this.model.liWeekDays).hide(),$("#"+this.model.divMonth).show(),1==isCheckInApp&&$(".signupweek-day").addClass("signup-weeks-width")}else switch(e){case"1":$("#"+this.offlineProperty.ddAtMonth).slideUp(),$("#"+this.offlineProperty.ddAtWeeks).hide(),$("#ddAtMonth").addClass("datepicket-top-pos"),$("#"+this.offlineProperty.ddlblAtWeek).slideUp();break;case"2":$("#"+this.offlineProperty.ddAtMonth).slideDown(),$("#"+this.offlineProperty.ddAtWeeks).show(),$("#ddAtMonth").removeClass("datepicket-top-pos"),$("#"+this.offlineProperty.lblAtDay).text("Every:"),$("#divSessionWksFrequency").css("display","block"),$("#divSessionClassMntDate").css("display","none"),$("#"+this.offlineProperty.ddlblAtWeek).slideDown(),$("#txtSessionWksFrequency").val("1");break;case"3":$("#"+this.offlineProperty.ddAtWeeks).hide(),$("#ddAtMonth").addClass("datepicket-top-pos"),$("#"+this.offlineProperty.ddAtMonth).slideDown(),$("#"+this.offlineProperty.lblAtDay).text("Day:"),$("#divSessionWksFrequency").css("display","none"),$("#divSessionClassMntDate").css("display","block"),$("#"+this.offlineProperty.ddlblAtWeek).slideUp(),$("#txtSessionClassMntDate").val("1")}},GetSessionStorage:function(e){var t=[];if(0==this.model.IsOnline){if(void 0!==localStorage[e])try{t=JSON.parse(localStorage[e])}catch(e){t=[]}}else if(1==this.model.IsOnline){if(_vgClassSessionSelection.model.WaitlistEventStorage===e){try{t=JSON.parse(localStorage[e])}catch(e){t=[]}return t}var i;if("undefined"!=typeof onlineShoppingCartmain&&null!=onlineShoppingCartmain&&(i=onlineShoppingCartmain),$("#shoppingcartsecond").length>0&&("block"==$("#shoppingcartsecond").css("display").toLowerCase()||"flex"==$("#shoppingcartsecond").css("display").toLowerCase()||$("#shoppingcartsecond").is(":visible"))&&(i=onlineShoppingCart),void 0!==i&&null!=i)try{_vgClassSessionSelection.model.EventStorage===e&&null!=i.Events?t=i.Events:_vgClassSessionSelection.model.ExceptionStorage===e&&null!=i.Exceptions&&(t=i.Exceptions)}catch(e){t=[]}}return t},SetIntoSessionStorage:function(e,t,i){if(0==this.model.IsOnline)_vgClassSessionSelection.commonProperty.isWaitlist&&_vgClassSessionSelection.model.EventStorage===e?localStorage[this.model.WaitlistEventStorage]=JSON.stringify(t):localStorage[e]=JSON.stringify(t);else if(1==this.model.IsOnline){var a;if(_vgClassSessionSelection.commonProperty.isWaitlist&&_vgClassSessionSelection.model.EventStorage===e)localStorage[this.model.WaitlistEventStorage]=JSON.stringify(t);else if("undefined"!=typeof onlineShoppingCartmain&&null!=onlineShoppingCartmain&&(a=onlineShoppingCartmain),$("#shoppingcartsecond").length>0&&("block"==$("#shoppingcartsecond").css("display").toLowerCase()||"flex"==$("#shoppingcartsecond").css("display").toLowerCase()||$("#shoppingcartsecond").is(":visible"))&&(a=onlineShoppingCart),void 0!==a&&null!=a&&null!=a||(a={}),_vgClassSessionSelection.model.EventStorage===e){a.Events=t;var r=!0;if(String.isNullOrUndefineOrBlank(a.Events)||$.each(a.Events,function(e,t){!String.isNullOrUndefineOrBlank(t.eventEnrollment)&&t.eventEnrollment.length>0&&$.each(t.eventEnrollment,function(e,t){1==t.isTempData&&(r=!1)})}),r&&("undefined"==typeof IsClassReschedule||"undefined"!=typeof IsClassReschedule&&"false"==IsClassReschedule.toLowerCase())){if(void 0!==_shopdetail&&null!=_shopdetail&&null!=_shopdetail.IsMemPkgReqToBook&&1==_shopdetail.IsMemPkgReqToBook){var o=_shopdetail.MembershipPackageDetails.Data.UserMemberShipAndPackageInformation.RequiredServices.split(",");null!=o&&o.length>0&&o.forEach(function(e){for(var i=0;i<t.length;i++)e==String(t[i].eventID)&&(t[i].IsMemPkgRequired=!0)})}_onlineCheckout.classAddToCart(t,i),s=[]}}else _vgClassSessionSelection.model.ExceptionStorage===e&&(a.Exceptions=t)}},ClearSessionStorage:function(e){0==this.model.IsOnline&&localStorage.removeItem(e)},validateFebDate:function(e,t){return!(e>29||29==e&&!(t%4==0&&(t%100!=0||t%400==0)))},GetevenetCapacity:function(e,t){var i=0,a=this.GetSessionStorage(this.model.EventStorage);if(null!=typeof t&&""!=t&&null!=t||(t=!1),a.length>0)for(var r=0;r<=a.length-1;r++){i+=$.grep(a[r].eventEnrollment,function(i){return 1==t?1!=i.isTempData&&i.appointmentID==e&&1==i.StreamingStatus:1!=i.isTempData&&i.appointmentID==e&&1!=i.StreamingStatus}).length}return i},ManageEventTempAndRealData:function(e,t,i){var a=this.GetSessionStorage(this.model.EventStorage),r=[];if(a.length>0)for(var o=0;o<=a.length-1;o++){var n=$.grep(a[o].eventEnrollment,function(e){return 1!=e.isTempData});if(n.length>0){if(1==t){var s={cFirstName:"asc",cLastName:"asc",eventDate:"asc"};n.keySort(s),a[o].eventEnrollment=n}else a[o].eventEnrollment=n;if(1==e){var l=_vgClassSessionSelection.GetCartUserDetail(),d=$.grep(a[o].eventEnrollment,function(e){if(null!=l&&l.length>0){var t=$.grep(l,function(t){return e.customerID>0&&t.userId==e.customerID||0==e.customerID&&t.emailId==e.cUserEmail});if(null!=t&&t.length>0)return!1}return!0});if(null!=d&&d.length>0){var c=d.uniqueObjects(["customerID","cUserEmail"]);c.length>0&&(r=r.concat(c))}}}else a.splice(o,1)}if(a.length>0){if(1==t){s={eventName:"asc"};a.keySort(s)}0!=i&&this.SetIntoSessionStorage(this.model.EventStorage,a)}else this.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage);return r},GetGCorPackage:function(){var e=[];if(""!=this.commonProperty.gCOrPackageDetail)try{e=JSON.parse(this.commonProperty.gCOrPackageDetail)}catch(t){e=[]}return e},GetCartUserDetail:function(){var e=[];if(""!=this.commonProperty.cartUserList)try{e=JSON.parse(this.commonProperty.cartUserList)}catch(t){e=[]}return e},ConfirmEventData:function(e,t){var i=this.GetSessionStorage(this.model.EventStorage);if(i.length>0)for(var a=0;a<=i.length-1;a++)if(i[a].eventID==e)for(j=0;j<=i[a].eventEnrollment.length-1;j++)i[a].eventEnrollment[j].isTempData=!1;this.SetIntoSessionStorage(this.model.EventStorage,i,t)},GetAllSessionDates:function(e){var t=1,i=this.GetRecurringType();_vgClassSessionSelection.commonProperty.isYearlySelection&&(t=12);var a=[];if("2"==i){if(1==this.model.IsOnline?$(".dayselection input:checked").each(function(){a.push($(this).data("dayid"))}):$("#rptDayClassSession").find("a").each(function(e,t){$(this).hasClass("active")&&a.push(parseInt($(this).attr("data-dayid")))}),0==a.length){var r="Please select at least one day.";return 1==this.model.IsOnline?vagaro.alertsmall(r):_vgCal.Common.ShowMsg(r),!1}if(1==this.model.IsOnline&&a.length>0){var o=this.GetNoOfSessions();if(a.length>o)return document.querySelector(".bootbox, .custom-alert")||vagaro.alertsmall(this.model.strSessionCountmsg),!1}}if(3==e)return!0;var n=new Date(this.GetStartDate()),s=this.GetDayNo(),l=this.GetNoOfweeks(),d=[],c=this.GetNoOfSessions();void 0!==_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&null!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop&&c!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length&&(c=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length);for(var u=1;u<=c;){var p=null;if("1"==i)u+=1,d.push(new Date(n)),n.setDate(n.getDate()+1);else if("2"==i){if(p=new Date(n),0==n.getDay()){var h=7*(parseInt(l)-1);n.setDate(n.getDate()+h)}if(n.setDate(n.getDate()+1),_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop){var m=moment(p).format("YYYY-MM-DD"),f="";if(void 0!==_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&null!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&(f=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.find(function(e){return e.strEventDate===m})),$.inArray(p.getDay(),a)<0||!f)continue;u+=1,d.push(p)}else{if($.inArray(p.getDay(),a)<0)continue;u+=1,d.push(p)}}else if("3"==i){if(n.getDate()>s){var g=n.getMonth()+1,v=n.getFullYear();12==g&&(g=0,v+=1),n=1==g&&0==_vgClassSessionSelection.validateFebDate(s,v)?n.addMonths(t):new Date(v,g,s);continue}if(n.getDate()<s){n=1==n.getMonth()&&0==_vgClassSessionSelection.validateFebDate(s,n.getFullYear())?n.addMonths(t):new Date(n.getFullYear(),n.getMonth(),s);continue}if(_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop){p=new Date(n);m=moment(p).format("YYYY-MM-DD"),f="";void 0!==_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&null!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&(f=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.find(function(e){return e.strEventDate===m})),f&&(u+=1,d.push(new Date(n))),n=n.addMonths(t)}else u+=1,d.push(new Date(n)),n=n.addMonths(t)}}return d},ConfirmException:function(){_vgClassSessionSelection.EventShowLoader(!0);var e=1==_vgClassSessionSelection.commonProperty.isWaitlist?this.GetSessionStorage(this.model.WaitlistEventStorage):this.GetSessionStorage(this.model.EventStorage),t=[];_vgClassSessionSelection.commonProperty.isWaitlist||(t=this.GetSessionStorage(this.model.ExceptionStorage));var i=!1;if(1==_vgClassSessionSelection.model.IsOnline&&void 0!==$("#btnConfirm").data("to")&&2==parseInt($("#btnConfirm").data("to"))&&(i=!0),t.length>0){var a=$.grep(t,function(e){return 0==e.isExNotHandle});if(a.length>0){var r={};if(r.eventID=this.commonProperty.eventID,r.eventName=this.commonProperty.eventName,r.tax=this.commonProperty.tax,r.smallimage=this.commonProperty.smallImage,r.sessiondetail=this.commonProperty.sessiondetail,r.eventEnrollment=[],e.length>0){var o=$.grep(e,function(e){return e.eventID==r.eventID});if(o.length>0&&o[0].eventEnrollment.length>0){r.eventEnrollment=o[0].eventEnrollment;for(var n=0;n<=r.eventEnrollment.length-1;n++)r.eventEnrollment[n].isTempData=!1}}for(var s=0;s<=a.length-1;s++){var l={};if(0==r.eventEnrollment.length?l.autoID=1:l.autoID=Math.max.apply(Math,r.eventEnrollment.map(function(e){return e.autoID}))+1,l.eventID=r.eventID,l.customerID=a[s].customerID,l.cFirstName=a[s].cFirstName,l.cLastName=a[s].cLastName,l.cUserEmail=a[s].cUserEmail,l.cUserCellNo=a[s].cUserCellNo,l.cCellcountryID=a[s].cCellcountryID,l.cDialingCode=a[s].cDialingCode,l.eventDate=a[s].eventDate,l.IsWorkShop=a[s].IsWorkShop,l.StreamingStatus=a[s].StreamingStatus,l.isTempData=!1,0==a[s].isMultipleSP){var d=a[s].SPAvalibility[0];l.sPID=a[s].SPID,l.sPName=a[s].SPName,l.appointmentID=parseInt(d.appointmentID),l.startTime=d.strStartTime,l.endTime=d.strEndTime,l.duration=d.eventDuration,0==_vgClassSessionSelection.model.IsOnline&&1==a[s].isCapacityFull&&(l.isHandleDuetoException=!0)}else{var c=$("#ddlSPDetail-"+a[s].autoId);if("-1"==c.val())continue;d=$.grep(a[s].SPAvalibility,function(e){return e.serviceProviderID==parseInt(c.val())});if(d.length>0){l.sPID=parseInt(c.val());var u=$("#ddlSPDetail-"+a[s].autoId+" option:selected");l.sPName=u.text(),0==_vgClassSessionSelection.model.IsOnline&&void 0!==u.data("isspfull")&&1==u.data("isspfull")&&(l.isHandleDuetoException=!0),l.appointmentID=parseInt(d[0].appointmentID),l.startTime=d[0].strStartTime,l.endTime=d[0].strEndTime,l.duration=d[0].eventDuration}}0==this.model.IsOnline&&(l.isEventTempData=!0),r.eventEnrollment.push(l)}if(r.eventEnrollment.length>0){if(e.length>0)e=$.grep(e,function(e){return e.eventID!=r.eventID});e.push(r),this.SetIntoSessionStorage(this.model.EventStorage,e,i)}}else{for(var p=0;p<=e.length-1;p++)if(e[p].eventID==_vgClassSessionSelection.commonProperty.eventID)if(e[p].eventEnrollment.length<=0)_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage);else for(var h=0;h<=e[p].eventEnrollment.length-1;h++)e[p].eventEnrollment[h].isTempData=!1;if(e.length>0){if(0==_vgClassSessionSelection.model.IsOnline&&null!=typeof txtDepositCls&&null!=txtDepositCls&&""!=txtDepositCls&&parseFloat(txtDepositCls.value)>0)if(ExecCnt=e[0].eventEnrollment.length,t.length>0&&$.grep(t,function(e){1!=e.RemarksType&&(ExecCnt+=1)}),100==parseFloat($("#txtDepositCls").data("percentage"))){var m=CalendarConfiguration.CommonDetails.BusinessTaxes,f=_vgCal.ManageAtnd.model.Taxation,g=0;if(_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop){var v=this.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream?_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates[0].workShopStreamingSellPrice:_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates[0].workShopSellPrice;g=this.CalcSessionPriceForWorkShop(v,this.GetNoOfSessions()/ExecCnt,this.GetNoOfAttendees(),!0)}else g=this.CalcSessionPrice(this.commonProperty.sessiondetail,this.GetNoOfSessions()/ExecCnt,this.GetNoOfAttendees(),!0,this.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream);var A=_vgClassSessionSelection.AddFeesToDepositPopupForException(parseFloat(g),8),C=_vgClassSessionSelection.CalculateTaxForFees(m),y=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(_vgClassSessionSelection.GetTaxTotalForService(m,f),!1,2),b=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(g*parseFloat(y)/100,!1,4);_vgCal.ManageAtnd.model.Tax=b+C,txtDepositCls.value=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(parseFloat(g)+b+A+C,!0,2),_vgCal.ManageAtnd.model.NewApp_txtPriceCls=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(parseFloat(g),!0,2)}else txtDepositCls.value=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(parseFloat($("#txtDepositCls").data("originalprice"))/ExecCnt,!0,2);this.SetIntoSessionStorage(this.model.EventStorage,e,i)}}}if(1==this.model.IsOnline)if(_vgClassSessionSelection.commonProperty.isWaitlist&&e.length>0){var S=1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?e[0].eventEnrollment.uniqueObjects(["cUserEmail"]):e[0].eventEnrollment;_vgClassSessionSelection.SaveWaitlistClass(S,e[0].eventEnrollment)}else 2==parseInt($("#btnConfirm").data("to"))&&0==i&&($("#licartIcon a").attr("data-isbypass","true"),$("#licartIcon a").click()),_vgClassSessionSelection.ShowHideClassPopup(!1),_vgClassSessionSelection.EventShowLoader(!1);else{if(_vgClassSessionSelection.EventShowLoader(!1),0==e.length)return void _vgClassSessionSelection.commonMessageAlert("Please select teacher.");if(_vgClassSessionSelection.commonProperty.isWaitlist&&e.length>0){S=1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?e[0].eventEnrollment.uniqueObjects(["cUserEmail"]):e[0].eventEnrollment;_vgClassSessionSelection.SaveWaitlistClass(S,e[0].eventEnrollment)}else _vgClassSessionSelection.SaveAttendeeOffline()}},RemoveAddedEnrollmentOffline:function(){var e=1==_vgClassSessionSelection.commonProperty.isWaitlist?_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.WaitlistEventStorage):_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(e.length>0)for(var t=0;t<=e.length-1;t++){var i=$.grep(e[t].eventEnrollment,function(e){return 1!=e.isEventTempData});i.length>0?e[t].eventEnrollment=i:e.splice(t,1)}e.length>0?_vgClassSessionSelection.SetIntoSessionStorage(_vgClassSessionSelection.commonProperty.isWaitlist?_vgClassSessionSelection.model.WaitlistEventStorage:_vgClassSessionSelection.model.EventStorage,e):_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.commonProperty.isWaitlist?_vgClassSessionSelection.model.WaitlistEventStorage:_vgClassSessionSelection.model.EventStorage)},CreateEventCollection:function(t){var i=[];if(4==t||5==t?i=o:(0==this.model.IsOnline&&o.splice(0,o.length),o.length<=0?(i=this.GetAllSessionDates(t),o=i):i=o),i.length>0){var n=[],s=[];_vgClassSessionSelection.commonProperty.isWaitlist||(s=this.GetSessionStorage(this.model.EventStorage));var l={};if(l.eventID=this.commonProperty.eventID,l.eventName=this.commonProperty.eventName,l.CalculatedTaxTypeWise=this.commonProperty.CalculatedTaxTypeWise,l.tax=this.commonProperty.tax,l.smallimage=this.commonProperty.smallImage,l.sessiondetail=this.commonProperty.sessiondetail,l.promotiondetail=_vgClassSessionSelection.GetClassPromotionWithLastMinute(this.commonProperty.promotiondetail),l.eventDesc=$("#eventDescription").text().trim(),l.eventEnrollment=[],s.length>0)(_=$.grep(s,function(e){return e.eventID==l.eventID})).length>0&&(l.eventEnrollment=$.grep(_[0].eventEnrollment,function(e){return 1!=e.isTempData}),l.eventEnrollment.length<=0&&(l.eventEnrollment=[]));var d=1;this.model.IsOnline?r.length>0&&(d=r.length+1):d=this.GetNoOfAttendees();var c=[];"undefined"!=typeof _vgClassSessionSelection&&1==_vgClassSessionSelection.model.IsOnline&&1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop&&void 0!==_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&$.grep(i,function(e){$.grep(_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates,function(t){if(moment(e).format("DD/MM/YYYY")==moment(t.strEventDate).format("DD/MM/YYYY"))return c.push(e),!1})}),c.length>0&&(i=c);for(var u=Math.random().toString(36).substring(7),p=0;p<=i.length-1;p++)if(_vgClassSessionSelection.model.IsOnline){var h=0;$("div.clsaccordion").find(".panel-default").each(function(){var e="",t="",a="",r=0,o="",s=0,d=0;if(_vgClassSessionSelection.model.IsOnline)r=$(this).attr("data-value"),e=$(this).attr("data-fullname").split(" ")[0],t=void 0!==$(this).attr("data-fullname").split(" ")[1]?$(this).attr("data-fullname").split(" ")[1]:"",a=$(this).attr("data-email"),o=$(this).attr("data-cell"),s=$(this).attr("data-cellcountryid"),void 0!==$(this).attr("data-dialingCode")&&null!=$(this).attr("data-dialingCode")&&""!=$(this).attr("data-dialingCode")&&(d=$(this).attr("data-dialingCode"));else{var c=_vgCal.ManageAtnd.objAtList[h];r=c.Id,e=c.fName,t=c.lName,a=c.Email}var m,f=_vgClassSessionSelection.commonProperty.SPID;if(null!=(m=$.grep(_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates,function(e){return e.strEventDate==i[p].format("yyyy-MM-dd")&&e.serviceProviderID==f}))&&m.length>0){var g=!1;if(_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?m[0].streamingEventCapacity<m[0].streamingNoOfAttendees+_vgClassSessionSelection.GetevenetCapacity(m[0].appointmentID,!0)+(h+1)&&(g=!0):m[0].eventCapacity<m[0].noOfAttendees+_vgClassSessionSelection.GetevenetCapacity(m[0].appointmentID,!1)+(h+1)&&(g=!0),_vgClassSessionSelection.model.IsOnline&&g&&0==_vgClassSessionSelection.commonProperty.isWaitlist){(y={}).eventID=l.eventID,y.appointmentID=parseInt(m[0].appointmentID),y.eventDate=i[p],y.workshopActualDate=i[p].format("MM/dd/yyyy")+" "+m[0].strStartTime,y.customerID=r,y.cFirstName=e,y.cLastName=t,y.cUserEmail=a,y.cUserCellNo=o,y.cCellcountryID=s,y.cDialingCode=d,y.teacherName=_vgClassSessionSelection.commonProperty.teacherName,y.isExNotHandle=!0,y.Remarks="This class is full.",y.RemarksType=_vgClassSessionSelection.commonProperty.ClassFull,y.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,y.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,y.randomForWorkShop=u,y.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,y.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,y.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,y.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?1:0,n.push(y)}else{var v={};if(0==_vgClassSessionSelection.model.IsOnline&&g&&0==_vgClassSessionSelection.commonProperty.isWaitlist)(y={}).eventID=l.eventID,y.appointmentID=parseInt(m[0].appointmentID),y.eventDate=i[p],y.workshopActualDate=i[p].format("MM/dd/yyyy")+" "+m[0].strStartTime,y.customerID=r,y.cFirstName=e,y.cLastName=t,y.cUserEmail=a,y.cUserCellNo=o,y.cCellcountryID=s,y.cDialingCode=d,y.teacherName=_vgClassSessionSelection.commonProperty.teacherName,y.isExNotHandle=!0,y.Remarks="This class is full.",y.RemarksType=_vgClassSessionSelection.commonProperty.ClassFull,y.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,y.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,y.randomForWorkShop=u,y.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,y.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,y.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,y.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?1:0,n.push(y),v.isHandleDuetoException=!0;0==l.eventEnrollment.length?v.autoID=1:v.autoID=Math.max.apply(Math,l.eventEnrollment.map(function(e){return e.autoID}))+1;var A=moment(m[0].strEndTime,"hh:mm A").subtract(m[0].CleanupTime,"minutes").format("hh:mm A");if(v.eventID=l.eventID,v.appointmentID=parseInt(m[0].appointmentID),v.customerID=r,v.cFirstName=e,v.cLastName=t,v.cUserEmail=a,v.cUserCellNo=o,v.cCellcountryID=s,v.cDialingCode=d,v.sPID=_vgClassSessionSelection.commonProperty.SPID,v.sPName=_vgClassSessionSelection.commonProperty.teacherName,v.eventDate=i[p],v.workshopActualDate=i[p].format("MM/dd/yyyy")+" "+m[0].strStartTime,v.startTime=m[0].strStartTime,v.endTime=A,v.duration=m[0].eventDuration,v.isTempData=!0,v.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,1==v.IsWorkShop&&_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream&&0!=m[0].workShopStreamingSellPrice&&0!=m[0].workShopNoofSessions?v.workShopIndividualPrice=m[0].workShopStreamingSellPrice/m[0].workShopNoofSessions:1==v.IsWorkShop&&_vgClassSessionSelection.commonProperty.streamingStatus!=_vgClassSessionSelection.StreamingDBFilterType.LiveStream&&0!=m[0].workShopSellPrice&&0!=m[0].workShopNoofSessions?v.workShopIndividualPrice=m[0].workShopSellPrice/m[0].workShopNoofSessions:v.workShopIndividualPrice=0,v.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,v.randomForWorkShop=u,v.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,v.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,v.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,v.PromotionID=0,v.IsAmount=!1,v.AmountValue=0,v.PerUserOne="0",v.discount=0,void 0!==l.promotiondetail&&""!=l.promotiondetail){var C=l.promotiondetail.split("-");v.PromotionID=l.promotiondetail.split("-")[0],v.IsAmount=0!=l.promotiondetail.split("-")[1],v.AmountValue=l.promotiondetail.split("-")[2],v.PerUserOne=l.promotiondetail.split("-")[3],C.length>4?v.PerTransactionOne=l.promotiondetail.split("-")[4]:v.PerTransactionOne="0",v.PromotionTitle=l.promotiondetail.split("|~~|")[1]}v.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?1:0,v.lstAddonService=_vgClassSessionSelection.CreateAddonCollection(v),l.eventEnrollment.push(v)}}else{var y;(y={}).eventID=l.eventID,y.appointmentID=0,y.eventDate=i[p],y.workshopActualDate=i[p].format("MM/dd/yyyy"),y.customerID=r,y.cFirstName=e,y.cLastName=t,y.cUserEmail=a,y.cUserCellNo=o,y.cCellcountryID=s,y.cDialingCode=d,y.teacherName=_vgClassSessionSelection.commonProperty.teacherName,y.isExNotHandle=!0,y.Remarks="This service provider is not available.",y.RemarksType=_vgClassSessionSelection.commonProperty.SPNotAvalable,y.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,y.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,y.randomForWorkShop=u,y.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,y.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,y.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,y.isWaitlist=_vgClassSessionSelection.commonProperty.isWaitlist,y.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?1:0,n.push(y)}h+=1})}else for(h=0;h<=d-1;h++){var m,f,g,v,A=_vgCal.ManageAtnd.objAtList[h];v=A.Id,m=A.fName,f=A.lName,g=A.Email;var C,y=this.commonProperty.SPID;if(null!=(C=$.grep(this.commonProperty.availabledates.eventAvailableDates,function(e){return e.strEventDate==i[p].format("yyyy-MM-dd")&&e.serviceProviderID==y}))&&C.length>0){var b={};if(0==this.model.IsOnline&&(this.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse&&C[0].eventCapacity<C[0].noOfAttendees+this.GetevenetCapacity(C[0].appointmentID,!1)+(h+1)||this.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream&&C[0].streamingEventCapacity<C[0].streamingNoOfAttendees+this.GetevenetCapacity(C[0].appointmentID,!0)+(h+1))&&0==_vgClassSessionSelection.commonProperty.isWaitlist)(I={}).eventID=l.eventID,I.appointmentID=parseInt(C[0].appointmentID),I.eventDate=i[p],I.workshopActualDate=i[p].format("MM/dd/yyyy")+" "+C[0].strStartTime,I.customerID=v,I.cFirstName=m,I.cLastName=f,I.cUserEmail=g,I.cUserCellNo="",I.cCellcountryID=0,I.cDialingCode=0,I.teacherName=this.commonProperty.teacherName,I.isExNotHandle=!0,I.Remarks="This class is full.",I.RemarksType=_vgClassSessionSelection.commonProperty.ClassFull,I.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,I.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,I.randomForWorkShop=u,I.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,I.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,I.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,I.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus,n.push(I),b.isHandleDuetoException=!0;if(0==l.eventEnrollment.length?b.autoID=1:b.autoID=Math.max.apply(Math,l.eventEnrollment.map(function(e){return e.autoID}))+1,b.eventID=l.eventID,b.appointmentID=parseInt(C[0].appointmentID),b.customerID=v,b.cFirstName=m,b.cLastName=f,b.cUserEmail=g,b.cUserCellNo="",b.cCellcountryID=0,b.cDialingCode=0,b.sPID=this.commonProperty.SPID,b.sPName=this.commonProperty.teacherName,b.eventDate=i[p],b.workshopActualDate=i[p].format("MM/dd/yyyy")+" "+C[0].strStartTime,b.startTime=C[0].strStartTime,b.endTime=C[0].strEndTime,b.duration=C[0].eventDuration,b.isTempData=!0,b.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,1==b.IsWorkShop&&_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream&&0!=C[0].workShopStreamingSellPrice&&0!=C[0].workShopNoofSessions?b.workShopIndividualPrice=C[0].workShopStreamingSellPrice/C[0].workShopNoofSessions:1==b.IsWorkShop&&_vgClassSessionSelection.commonProperty.streamingStatus!=_vgClassSessionSelection.StreamingDBFilterType.LiveStream&&0!=C[0].workShopSellPrice&&0!=C[0].workShopNoofSessions?b.workShopIndividualPrice=C[0].workShopSellPrice/C[0].workShopNoofSessions:b.workShopIndividualPrice=0,b.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,b.randomForWorkShop=u,b.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,b.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,b.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,b.PromotionID=0,b.IsAmount=!1,b.AmountValue=0,b.PerUserOne="0",b.discount=0,void 0!==l.promotiondetail&&""!=l.promotiondetail){var S=l.promotiondetail.split("-");b.PromotionID=l.promotiondetail.split("-")[0],b.IsAmount=0!=l.promotiondetail.split("-")[1],b.AmountValue=l.promotiondetail.split("-")[2],b.PerUserOne=l.promotiondetail.split("-")[3],S.length>4?b.PerTransactionOne=l.promotiondetail.split("-")[4]:b.PerTransactionOne="0",b.PromotionTitle=l.promotiondetail.split("|~~|")[1]}b.paidType=0,b.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus,b.lstAddonService=_vgClassSessionSelection.CreateClassAttendeeAddonCollection(v),l.eventEnrollment.push(b)}else{(I={}).eventID=l.eventID,I.appointmentID=0,I.eventDate=i[p],I.workshopActualDate=i[p].format("MM/dd/yyyy"),I.customerID=v,I.cFirstName=m,I.cLastName=f,I.cUserEmail=g,I.cUserCellNo="",I.cCellcountryID=0,I.cDialingCode=0,I.teacherName=this.commonProperty.teacherName,I.isExNotHandle=!0,I.Remarks="This service provider is not available.",I.RemarksType=_vgClassSessionSelection.commonProperty.SPNotAvalable,I.IsWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,I.noOfWorkShop=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length,I.randomForWorkShop=u,I.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,I.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,I.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,I.isWaitlist=_vgClassSessionSelection.commonProperty.isWaitlist,I.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus,n.push(I)}}if(1==this.model.IsOnline&&l.eventEnrollment.length>0&&1==l.eventEnrollment[0].IsWorkShop&&(ExceptionWorkShop=[],n.length>0)){var k={},D=n.filter(function(e){return!k[e.cUserEmail]&&(k[e.cUserEmail]=!0,!0)});for(p=0;p<=D.length-1;p++)var _=$.grep(l.eventEnrollment,function(e){return e.cUserEmail==D[p].cUserEmail});for(p=0;p<=_.length-1;p++){var I,w=l.eventEnrollment.indexOf(_[p]);-1!==w&&l.eventEnrollment.splice(w,1),(I={}).eventID=_[p].eventID,I.appointmentID=parseInt(_[p].appointmentID),I.eventDate=_[p].eventDate,I.workshopActualDate=_[p].workshopActualDate,I.customerID=_[p].customerID,I.cFirstName=_[p].cFirstName,I.cLastName=_[p].cLastName,I.cUserEmail=_[p].cUserEmail,I.cUserCellNo=_[p].cUserCellNo,I.cCellcountryID=_[p].cCellcountryID,I.cDialingCode=_[p].cDialingCode,I.teacherName=_[p].teacherName,I.isExNotHandle=!0,I.Remarks="This class is full.",I.RemarksType=_vgClassSessionSelection.commonProperty.ClassFull,I.IsWorkShop=_[p].IsWorkShop,I.noOfWorkShop=_[p].noOfWorkShop,I.randomForWorkShop=_[p].randomForWorkShop,I.workshopEventOn=_[p].workshopEventOn,I.workshopEventDays=_[p].workshopEventDays,I.workshopEventDate=_[p].workshopEventDate,I.StreamingStatus=_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?1:0,n.push(I)}n.keySort({eventDate:"asc"})}if(s.length>0)s=$.grep(s,function(e){return e.eventID!=l.eventID});if(l.eventEnrollment.length>0&&s.push(l),s.length>0&&this.SetIntoSessionStorage(this.model.EventStorage,s),this.ClearSessionStorage(this.model.ExceptionStorage),n.length>0){this.SetIntoSessionStorage(this.model.ExceptionStorage,n);var P=null;if(""!=this.commonProperty.otherSPavailabledates)try{P=JSON.parse(this.commonProperty.otherSPavailabledates)}catch(e){P=null}if(null!=P||_vgClassSessionSelection.commonProperty.isWaitlist)this.SessionExceptionDetail(P);else{var T={};T.eventId=l.eventID,T.businessID=this.commonProperty.businessID,T.serviceProviderID=this.commonProperty.SPID,T.startTime=this.commonProperty.startTime;var B=null;1==this.model.IsOnline?(T.type=3,B=_vgClassSessionSelection.CallFailed):(T.type=4,B=function(e){_vgCal.Common.ShowMsg("Something went wrong")}),vagaro.ajaxCall(e+a.geteventdetailandavailabledates,T,_vgClassSessionSelection.ShowExceptionDetailSuccess,B,!1,!0)}}else if(_vgClassSessionSelection.EventShowLoader(!1),1==this.model.IsOnline)if(_vgClassSessionSelection.commonProperty.isWaitlist){var x=1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?l.eventEnrollment.uniqueObjects(["cUserEmail"]):l.eventEnrollment;_vgClassSessionSelection.SaveWaitlistClass(x,l.eventEnrollment)}else 2==t||5==t?this.ConfirmEventData(l.eventID,!0):this.ConfirmEventData(l.eventID),$("#lblEventCart").html(s.length),_vgClassSessionSelection.ShowHideClassPopup(!1);else{if(0==s.length)return void _vgClassSessionSelection.commonMessageAlert("Please select teacher.");if(_vgClassSessionSelection.commonProperty.isWaitlist){x=1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?l.eventEnrollment.uniqueObjects(["cUserEmail"]):l.eventEnrollment;_vgClassSessionSelection.SaveWaitlistClass(x,l.eventEnrollment)}else _vgClassSessionSelection.SaveAttendeeOffline()}}},CreateEventCollection_ShowDiscount:function(e,t,i){try{_vgClassSessionSelection.EventShowLoader(!0);var a=[],r=$("#hdnAppointmentId").val(),o=$("#tr-"+r),n=$("#td-"+r),s=parseInt($("#hdnserviceProviderID").val()),l=$("#td"+r+"ClassName").data("classname");String.isNullOrUndefineOrBlank(l)||-1==l.indexOf("&lt;div class")&&-1==l.indexOf("<div class")||(-1!=l.indexOf("&lt;div class")?l=l.substr(0,l.indexOf("&lt;div")):-1!=l.indexOf("<div class")&&(l=l.substr(0,l.indexOf("<div class"))));var d,c,u,p=n.html();if(_vgClassSessionSelection.isCallFromPublic()){d={},r=(c=_publicEvent).objEventDetails.AppointmentID,s=c.objEventDetails.ServiceProviderID,l=c.objEventDetails.ServiceTitle,p=c.objEventDetails.ServiceProviderName;var h={eventDetail:[]},m={};if(m.isWorkShop=c.objEventDetails.IsWorkShop,m.tax=c.objEventDetails.Tax,h.eventDetail.push(m),1==c.objEventDetails.IsWorkShop)h.eventAvailableDates=c.lstEventAvailableDate;else{var f=[],g={},v=moment(new Date(c.objEventDetails.StrStartTime));g.appointmentID=c.objEventDetails.AppointmentID,g.endTime=c.objEventDetails.EndTime,g.eventCapacity=0,g.eventDuration=c.objEventDetails.EventDuration,g.firstName=null,g.isWorkShopStarted=!1,g.lastName=null,g.noOfAttendees=0,g.ruleDefinition=null,g.ruleType=0,g.serviceProviderID=s,g.serviceProviderName=c.objEventDetails.FirstName+c.objEventDetails.LastName.length>0?" "+c.objEventDetails.LastName.substring(0,1)+".":"",g.startTime=c.objEventDetails.StartTime,g.strAvailableDates=v.format("MMM-DD-YYYY"),g.strEventDate=v.format("YYYY-MM-DD"),g.strStartTime=v.format("hh:mm A"),g.strEndTime=v.add(c.objEventDetails.Duration,"minutes").format("hh:mm A"),g.streamingEventCapacity=c.objEventDetails.StreamingEventCapacity,g.streamingNoOfAttendees=c.objEventDetails.StreamingNoOfAttendees,g.workShopNoofSessions=0,g.workShopSellPrice=0,g.workShopStreamingSellPrice=0,f.push(g),h.eventAvailableDates=f}d=h;var A=new Date(c.objEventDetails.StrStartTime);a.push(new Date(A.getFullYear(),A.getMonth(),A.getDate()))}else d=JSON.parse(o.data("availabledates")),a=this.GetAllSessionDates(e);if(a.length>0){var C={};if(_vgClassSessionSelection.isCallFromPublic()?(C.eventID=c.objEventDetails.ServiceID,C.eventName=l,C.tax=c.objEventDetails.Tax,C.smallimage="",C.sessiondetail=c.objEventDetails.SessionDetail,C.promotiondetail=_vgClassSessionSelection.GetClassPromotionWithLastMinute(c.objEventDetails.PromotionDetail),C.PointRedeem=c.objEventDetails.PointRedeem):(C.eventID=parseInt($("#hdneventId").val()),C.eventName=l,C.tax=parseFloat(o.data("tax")),C.smallimage=o.data("smallimage"),C.sessiondetail=o.data("sessiondetail"),C.promotiondetail=_vgClassSessionSelection.GetClassPromotionWithLastMinute(o.data("promotiondetail")),C.PointRedeem=o.data("pointsredeem")),C.eventEnrollment=[],t.length>0){C.autoId=Math.max.apply(Math,t.map(function(e){return e.autoId}))+1,$.grep(t,function(e){if(e.eventEnrollment.length>0){$.grep(e.eventEnrollment,function(e){void 0===e.IsWorkShop&&(e.IsWorkShop=!1),void 0===e.customerID&&(e.customerID=0)});e.eventEnrollment.keySort({cFirstName:"asc",cLastName:"asc",eventDate:"asc"})}});var y=$.grep(t,function(e){return e.eventID==C.eventID});y.length>0&&(C.eventEnrollment=$.grep(y[0].eventEnrollment,function(e){return e.IsWorkShop=d.eventDetail.isWorkShop,1!=e.isTempData}),C.eventEnrollment.length<=0&&(C.eventEnrollment=[]))}else C.autoId=1;var b=Math.random().toString(36).substring(7);if(_vgClassSessionSelection.isCallFromPublic())for(var S=0;S<=a.length-1;S++){var k=0,D="",_="",I="",w=0,P="",T=0,B=0;_vgClassSessionSelection.model.IsOnline&&(w=UserID,D="",_="",I="",P="",T=0,B=0);var x,F=[];x=$.grep(d.eventAvailableDates,function(e){return e.strEventDate==a[S].format("yyyy-MM-dd")&&e.serviceProviderID==s}),C.eventEnrollment.length>0&&null!=x&&x.length>0&&(F=$.grep(C.eventEnrollment,function(e){return e.appointmentID==x[0].appointmentID&&e.sPID==x[0].serviceProviderID&&new Date(e.eventDate).format("yyyy-MM-dd")==x[0].strEventDate&&e.startTime==x[0].strStartTime&&e.endTime==x[0].strEndTime&&e.customerID==UserID&&e.StreamingStatus==i}));var O={};if(null!=x&&x.length>0&&0==F.length){if(0==C.eventEnrollment.length?O.autoID=1:O.autoID=Math.max.apply(Math,C.eventEnrollment.map(function(e){return e.autoID}))+1,O.IsFromHomePage=!0,O.eventID=C.eventID,O.appointmentID=parseInt(x[0].appointmentID),O.customerID=w,O.cFirstName=D,O.cLastName=_,O.cUserEmail=I,O.cUserCellNo=P,O.cCellcountryID=T,O.cDialingCode=B,O.sPID=parseInt(s),O.sPName=p,O.eventDate=moment(a[S]).toISOString(),O.workshopActualDate=a[S].format("MM/dd/yyyy")+" "+x[0].strStartTime,O.startTime=x[0].strStartTime,O.endTime=x[0].strEndTime,O.duration=x[0].eventDuration,O.isTempData=!1,O.IsWorkShop=c.objEventDetails.IsWorkShop,O.StreamingStatus=_vgClassSessionSelection.StreamingStatusEnum.LiveStream,1==O.IsWorkShop&&O.StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream&&0!=x[0].workShopStreamingSellPrice&&0!=x[0].workShopNoofSessions?O.workShopIndividualPrice=x[0].workShopStreamingSellPrice/x[0].workShopNoofSessions:1==O.IsWorkShop&&O.StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse&&0!=x[0].workShopSellPrice&&0!=x[0].workShopNoofSessions?O.workShopIndividualPrice=x[0].workShopSellPrice/x[0].workShopNoofSessions:O.workShopIndividualPrice=0,O.noOfWorkShop=d.eventAvailableDates.length,O.randomForWorkShop=b,O.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,O.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,O.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,O.PromotionID=0,O.IsAmount=!1,O.AmountValue=0,O.discount=0,void 0!==C.promotiondetail&&""!=C.promotiondetail){var M=C.promotiondetail.split("-");O.PromotionID=C.promotiondetail.split("-")[0],O.IsAmount=0!=C.promotiondetail.split("-")[1],O.AmountValue=parseFloat(C.promotiondetail.split("-")[2]),O.PerUserOne=C.promotiondetail.split("-")[3],M.length>4?O.PerTransactionOne=C.promotiondetail.split("-")[4]:O.PerTransactionOne="0",O.PromotionTitle=C.promotiondetail.split("|~~|")[1]}C.eventEnrollment.push(O)}else if(0==F.length){if(0==C.eventEnrollment.length?O.autoID=1:O.autoID=Math.max.apply(Math,C.eventEnrollment.map(function(e){return e.autoID}))+1,O.IsFromHomePage=!0,O.eventID=C.eventID,O.appointmentID=parseInt(0),O.customerID=w,O.cFirstName=D,O.cLastName=_,O.cUserEmail=I,O.cUserCellNo=P,O.cCellcountryID=T,O.cDialingCode=B,O.sPID=parseInt(s),O.sPName=p,O.eventDate=moment(a[S]).toISOString(),O.workshopActualDate=a[S].format("MM/dd/yyyy"),O.startTime="",O.endTime="",O.duration=parseInt(0),O.isTempData=!1,O.IsWorkShop=c.objEventDetails.IsWorkShop,O.workShopIndividualPrice=0,O.noOfWorkShop=d.eventAvailableDates.length,O.randomForWorkShop=b,O.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,O.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,O.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,O.PromotionID=0,O.IsAmount=!1,O.AmountValue=0,O.discount=0,void 0!==C.promotiondetail&&""!=C.promotiondetail){M=C.promotiondetail.split("-");O.PromotionID=C.promotiondetail.split("-")[0],O.IsAmount=0!=C.promotiondetail.split("-")[1],O.AmountValue=parseFloat(C.promotiondetail.split("-")[2]),O.PerUserOne=C.promotiondetail.split("-")[3],M.length>4?O.PerTransactionOne=C.promotiondetail.split("-")[4]:O.PerTransactionOne="0",O.PromotionTitle=C.promotiondetail.split("|~~|")[1]}O.StreamingStatus=i,C.eventEnrollment.push(O)}k+=1}else{"0"==$("div.clsaccordion").find(".panel-default").length&&_vgClassSessionSelection.SetDefaultattendee();for(var E=0;E<=a.length-1;E++){$("div.clsaccordion").find(".panel-default").each(function(){if(void 0!==$(this).attr("data-value")){var e="",t="",r="",o=0,n="",l=0,c="";_vgClassSessionSelection.model.IsOnline&&(o=$(this).attr("data-value"),e=$(this).attr("data-fullname").split(" ")[0],t=void 0!==$(this).attr("data-fullname").split(" ")[1]?$(this).attr("data-fullname").split(" ")[1]:"",r=$(this).attr("data-email"),n=$(this).attr("data-cell"),l=$(this).attr("data-cellcountryid"),c=void 0!==$(this).attr("data-dialingCode")&&null!=$(this).attr("data-dialingCode")&&""!=$(this).attr("data-dialingCode")?$(this).attr("data-dialingCode"):"");var u,h=[];u=$.grep(d.eventAvailableDates,function(e){return e.strEventDate==a[E].format("yyyy-MM-dd")&&e.serviceProviderID==s}),C.eventEnrollment.length>0&&null!=u&&u.length>0&&(h=$.grep(C.eventEnrollment,function(e){return e.appointmentID==u[0].appointmentID&&e.sPID==u[0].serviceProviderID&&new Date(e.eventDate).format("yyyy-MM-dd")==u[0].strEventDate&&e.startTime==u[0].strStartTime&&e.endTime==u[0].strEndTime&&e.customerID==UserID&&e.StreamingStatus==i}));var m={};if(null!=u&&u.length>0&&0==h.length){if(0==C.eventEnrollment.length?m.autoID=1:m.autoID=Math.max.apply(Math,C.eventEnrollment.map(function(e){return e.autoID}))+1,m.eventID=C.eventID,m.appointmentID=parseInt(u[0].appointmentID),m.customerID=o,m.cFirstName=e,m.cLastName=t,m.cUserEmail=r,m.cUserCellNo=n,m.cCellcountryID=l,m.cDialingCode=c,m.sPID=parseInt(s),m.sPName=p,m.eventDate=moment(a[E]).toISOString(),m.workshopActualDate=a[E].format("MM/dd/yyyy")+" "+u[0].strStartTime,m.startTime=u[0].strStartTime,m.endTime=u[0].strEndTime,m.duration=u[0].eventDuration,m.isTempData=!1,m.IsWorkShop=d.eventDetail.isWorkShop,m.StreamingStatus=void 0!==i?i:0,1==m.IsWorkShop&&m.StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream&&0!=u[0].workShopStreamingSellPrice&&0!=u[0].workShopNoofSessions?m.workShopIndividualPrice=u[0].workShopStreamingSellPrice/u[0].workShopNoofSessions:1==m.IsWorkShop&&m.StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse&&0!=u[0].workShopSellPrice&&0!=u[0].workShopNoofSessions?m.workShopIndividualPrice=u[0].workShopSellPrice/u[0].workShopNoofSessions:m.workShopIndividualPrice=0,m.noOfWorkShop=d.eventAvailableDates.length,m.randomForWorkShop=b,m.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,m.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,m.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,m.PromotionID=0,m.IsAmount=!1,m.AmountValue=0,m.discount=0,void 0!==C.promotiondetail&&""!=C.promotiondetail){var f=C.promotiondetail.split("-");m.PromotionID=C.promotiondetail.split("-")[0],m.IsAmount=0!=C.promotiondetail.split("-")[1],m.AmountValue=parseFloat(C.promotiondetail.split("-")[2]),m.PerUserOne=C.promotiondetail.split("-")[3],f.length>4?m.PerTransactionOne=C.promotiondetail.split("-")[4]:m.PerTransactionOne="0",m.PromotionTitle=C.promotiondetail.split("|~~|")[1]}C.eventEnrollment.push(m)}else if(0==h.length){if(0==C.eventEnrollment.length?m.autoID=1:m.autoID=Math.max.apply(Math,C.eventEnrollment.map(function(e){return e.autoID}))+1,m.eventID=C.eventID,m.appointmentID=parseInt(0),m.customerID=o,m.cFirstName=e,m.cLastName=t,m.cUserEmail=r,m.cUserCellNo=n,m.cCellcountryID=l,m.cDialingCode=c,m.sPID=parseInt(s),m.sPName=p,m.eventDate=moment(a[E]).toISOString(),m.workshopActualDate=a[E].format("MM/dd/yyyy"),m.startTime="",m.endTime="",m.duration=parseInt(0),m.isTempData=!1,m.IsWorkShop=d.eventDetail.isWorkShop,m.workShopIndividualPrice=0,m.noOfWorkShop=d.eventAvailableDates.length,m.randomForWorkShop=b,m.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,m.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,m.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,m.PromotionID=0,m.IsAmount=!1,m.AmountValue=0,m.discount=0,void 0!==C.promotiondetail&&""!=C.promotiondetail){f=C.promotiondetail.split("-");m.PromotionID=C.promotiondetail.split("-")[0],m.IsAmount=0!=C.promotiondetail.split("-")[1],m.AmountValue=parseFloat(C.promotiondetail.split("-")[2]),m.PerUserOne=C.promotiondetail.split("-")[3],f.length>4?m.PerTransactionOne=C.promotiondetail.split("-")[4]:m.PerTransactionOne="0",m.PromotionTitle=C.promotiondetail.split("|~~|")[1]}m.StreamingStatus=void 0!==i?i:0,C.eventEnrollment.push(m)}0}})}}}if(C.eventEnrollment.length>0)for(S=0;S<C.eventEnrollment.length;S++)for(k=0;k<a.length;k++){if(new Date(C.eventEnrollment[S].eventDate).format("yyyy-MM-dd")==a[k].format("yyyy-MM-dd")&&C.eventEnrollment[S].sPID==s){C.eventEnrollment[S].isShowDiscount=!0;break}C.eventEnrollment[S].isShowDiscount=!1}if(t.length>0)t=$.grep(t,function(e){return e.eventID!=C.eventID});if(C.eventEnrollment.length>0&&t.push(C),void 0!==u&&null!=u&&null!=u||(u={}),"Event"===_vgClassSessionSelection.model.EventStorage&&(u.Events=t,$.grep(u.Events,function(e){e.classGCUsed=0,$.grep(e.eventEnrollment,function(e){e.isPointApply=!1,e.isPresetApply=!1,e.gcId=null,e.isPackage=null,e.isMembershipApply=null,e.isPriceBaseGCApply=!1})})),String.isNullOrUndefineOrBlank(u.Events)){var N=C.sessiondetail,L=$("#txtQuantity"),U=$("#txtNoofAttendees");i==_vgClassSessionSelection.StreamingStatusEnum.InHouse?($("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+_vgClassSessionSelection.CalcSessionPrice(N,L.val(),U.val(),!0,!1)),$("#divEventPrice_Old").html($("#divEventPrice").html())):($(this.model.divStreamingEventPrice).html(_vgClassSessionSelection.GetcurrencySymbol()+_vgClassSessionSelection.CalcSessionPrice(N,L.val(),U.val(),!0,!0)),$(this.model.divStreamingEventPrice_Old).html($("#divEventPrice").html()));var R=C.promotiondetail;if(""!=R.trim()){var G=R.split("-")[3];i==_vgClassSessionSelection.StreamingStatusEnum.InHouse?$("#divEventPrice_Old").show():$(this.model.divStreamingEventPrice_Old).show();var W=_vgClassSessionSelection.CalcSessionPrice(N,L.val(),U.val(),!0,i!=_vgClassSessionSelection.StreamingStatusEnum.InHouse),V=U.val(),j=W/L.val();if(j>0){i==_vgClassSessionSelection.StreamingStatusEnum.InHouse?$("#divEventPrice_Old").show():$(this.model.divStreamingEventPrice_Old).show();var H=0,Y=0;j<(Y=0==R.split("-")[1]?j*R.split("-")[2]/100:R.split("-")[2])&&(Y=j),"1"==G?(H=j-Y,H+=(W-j)*V):H=(W-Y)*V,$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(H,2).format("#.##"))}}else i==_vgClassSessionSelection.StreamingStatusEnum.InHouse?$("#divEventPrice_Old").hide():$(this.model.divStreamingEventPrice_Old).hide()}else{var Z=parseInt(_vgClassSessionSelection.GetCommonBusinessID());_vgClassSessionSelection.isCallFromPublic()&&(Z=c.objEventDetails.BusinessID),u.BusinessID=Z,u.loginUserId=parseInt(UserID),onlineShoppingCart=u,onlineShoppingCartmain=u,_onlineCheckout.CalculatePriceAndTaxOnCartForClass(u.Events),_onlineCheckout.getUserGCDetail_ShowDiscount(0,!0);var z=$.grep(onlineShoppingCart.Events,function(e){return e.eventID==C.eventID});if(z[0].eventEnrollment.length>0){var X=0,q=0,J=0,Q=!1;if(filterPkgAndMembership=$.grep(z[0].eventEnrollment,function(e){return 0==Q&&e.StreamingStatus==i&&(void 0!==e.Originalprice&&null!=e.Originalprice&&(X=e.Originalprice),Q=!0),1==e.isShowDiscount&&e.customerID>0&&UserID>0&&e.customerID==UserID}),!String.isNullOrUndefineOrBlank(filterPkgAndMembership)){var K=0,ee=0,te=0,ie=0,ae=0,re=0,oe=[];$.each(filterPkgAndMembership,function(e,t){if(void 0!==t.isPointApply&&1==t.isPointApply){var i=++ee>1?'<span class="msgcounter">'+ee+"</span>":"";$("#divApplyisPointApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part badge-button-positive"><div class="sign-icon" aria-hidden="true">&#xf058;</div><span class="green-text">Points Applied '+i+"</span></div></div>"),$("#divApplyisPointApply").show(),J=1}if(1!=t.isPointApply&&(null==t.gcId||0==t.gcId||t.gcId>0&&0==t.isPackage)&&t.PromotionID>0){var a=++ie>1?'<span class="msgcounter">'+ie+"</span>":"",r="";void 0!==t.PromotionTitle&&null!=t.PromotionTitle&&(r=t.PromotionTitle.length>0?"("+t.PromotionTitle+")":""),$("#divApplyDailyDeal").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part badge-button-positive"><div class="sign-icon" aria-hidden="true">&#xf058;</div><span class="green-text">Daily Deal Applied '+r+" "+a+"</span></div></div>"),$("#divApplyDailyDeal").show(),J>0?J+=1:J=0}if(t.gcId>0&&0==t.isPackage||1==t.isPriceBaseGCApply){var o=++te>1?'<span class="msgcounter">'+te+"</span>":"";$("#divApplyGC").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part badge-button-positive"><div class="sign-icon" aria-hidden="true">&#xf058;</div><span class="green-text">Gift Card Applied '+o+"</span></div></div>"),$("#divApplyGC").show(),J>0?J+=1:J=0}if(void 0!==t.isPackage&&t.gcId>0&&1==t.isPackage){K=0;var n="",s="";oe.push(t.pkgName);var l=oe.filter(function(e,t,i){return t==i.indexOf(e)});if(l.length>0){for(var d="",c=0;c<l.length;c++){for(var u=0;u<oe.length;u++)oe[u]==l[c]&&(n=++K>1?'<span class="msgcounter">'+K+"</span>":"",s=l[c].length>0?"("+l[c]+")":"");d+='<div id="divApplyPkg_'+c+'" class="subclss"><div class="brand-name-checkout thm-textColor"><div class= "applied-green-part badge-button-positive"><div class="sign-icon" aria-hidden="true">&#xf058;</div><span class="green-text">Package Applied '+s+" "+n+"</span></div></div></div>",K=0}$("#divOuterApplyPkg").html(d),$("#divOuterApplyPkg").show(),J>0?J+=1:J=0}}if(void 0!==t.isMembershipApply&&1==t.isMembershipApply){var p=++ae>1?'<span class="msgcounter">'+ae+"</span>":"",h=t.membershipName.length>0?"("+t.membershipName+")":"";$("#divApplyisMembershipApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part badge-button-positive"><div class="sign-icon" aria-hidden="true">&#xf058;</div><span class="green-text">Membership Applied '+h+" "+p+"</span></div></div>"),$("#divApplyisMembershipApply").show(),J>0?J+=1:J=0}if(void 0!==t.IsWaivedApply&&1==t.IsWaivedApply){var m=++re>1?'<span class="msgcounter">'+re+"</span>":"",f=t.AppliedName.length>0?"("+t.AppliedName+")":"";$("#divApplyIsWaivedApplyApply").html('<div class="brand-name-checkout thm-textColor"><div class= "applied-green-part badge-button-positive"><div class="sign-icon" aria-hidden="true">&#xf058;</div><span class="green-text">Deposit is Waived '+f+" "+m+"</span></div></div>"),$("#divApplyIsWaivedApplyApply").show()}1!=_vgClassSessionSelection.isCallFromPublic()&&($(".class-msg-inn").height()>=85?$(".class-msg-ul").addClass("show-cl-more").removeClass("rm-cls-height"):$(".class-msg-ul").removeClass("show-cl-more").addClass("rm-cls-height"))})}var ne="0";void 0!==z[0].promotiondetail&&""!=z[0].promotiondetail&&X>0&&(ne=z[0].promotiondetail.split("-")[3],0==z[0].promotiondetail.split("-")[1]?q=_onlineCheckout.parseTodecimal(X*z[0].promotiondetail.split("-")[2]/100,2):(q=z[0].promotiondetail.split("-")[2])<0&&(q=0));for(var se=0,le=0,de=0,ce=0,ue=0,pe=0;pe<filterPkgAndMembership.length;pe++)if(filterPkgAndMembership[pe].StreamingStatus==i){var he=0;if(ue=0,de=0,OriginalAmountSession=0,void 0!==filterPkgAndMembership[pe].Originalprice&&null!=filterPkgAndMembership[pe].Originalprice&&(de=filterPkgAndMembership[pe].Originalprice,OriginalAmountSession=filterPkgAndMembership[pe].Originalprice),1==filterPkgAndMembership[pe].isPointApply&&(0==he&&(se+=filterPkgAndMembership[pe].actualPrice),de=filterPkgAndMembership[pe].actualPrice,ue=filterPkgAndMembership[pe].actualPrice,ce=1,he=1),filterPkgAndMembership[pe].gcId>0&&1==filterPkgAndMembership[pe].isPackage&&(0==he&&(se+=filterPkgAndMembership[pe].actualPrice),de=filterPkgAndMembership[pe].actualPrice,ue+=filterPkgAndMembership[pe].actualPrice,ce=1,he=1),1!=filterPkgAndMembership[pe].isPointApply&&(null==filterPkgAndMembership[pe].gcId||0==filterPkgAndMembership[pe].gcId||filterPkgAndMembership[pe].gcId>0&&0==filterPkgAndMembership[pe].isPackage)&&filterPkgAndMembership[pe].PromotionID>0&&(0==he&&(se+=OriginalAmountSession),ue+=parseFloat(q),ce=1,he=1),1==filterPkgAndMembership[pe].isMembershipApply)0==he&&(se+=OriginalAmountSession),ue+=_onlineCheckout.parseTodecimal(OriginalAmountSession*filterPkgAndMembership[pe].membershipDiscount/100,2),ce=1,he=1;if(filterPkgAndMembership[pe].gcId>0&&0==filterPkgAndMembership[pe].isPackage&&(0==he&&(se+=OriginalAmountSession),ue+=OriginalAmountSession,ce=1,he=1),1==filterPkgAndMembership[pe].isPriceBaseGCApply){if(0==he&&(se+=OriginalAmountSession),filterPkgAndMembership[pe].GCDetail.length>0)for(var me=0,fe=0;fe<filterPkgAndMembership[pe].GCDetail.length;fe++)me+=filterPkgAndMembership[pe].GCDetail[fe].GCAmount;ue+=me,ce=1,he=1}0==he&&(se+=OriginalAmountSession),se<0&&(se=0),ue>=de||(0==le?le=de-ue:le+=de-ue)}X<parseFloat(q)&&(q=X);var ge=this.GetNoOfAttendees();if(ge>1){var ve=parseInt($("#txtQuantity").val());se+=X*ve*(ge-1),le+="1"==ne?X*ve*(ge-1):(X-parseFloat(q))*ve*(ge-1)}if(ce>0&&1!=J&&se!=le)if(i==_vgClassSessionSelection.StreamingStatusEnum.InHouse)$("#divEventPrice_Old").html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(se,2).format("#.##")).attr("aria-label","Old price "+$("#divEventPrice_Old").html()),$("#divEventPrice_Old").show(),$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(le,2).format("#.##")).attr("aria-label","New price "+$("#divEventPrice").html()),_siteBuilderDetail.GCVPLText(le,1);else if(_vgClassSessionSelection.isCallFromPublic()){var Ae="2"==$("#tr"+_publicEvent.objEventDetails.AppointmentID).attr("data-countryid")?"£":"$",Ce=_onlineCheckout.parseTodecimal(le,2).format("#.##");0==Ce?(Ce="Free",$("#PopupEventPrice").attr("aria-label","Discounted Price is "+Ae+_onlineCheckout.parseTodecimal(se,2).format("#.##")+" , "+Ce).attr("role","banner")):(Ce=Ae+Ce,$("#PopupEventPrice").attr("aria-label","Discounted Price is "+Ae+_onlineCheckout.parseTodecimal(se,2).format("#.##")+" Original Price is  "+Ce).attr("role","banner")),$("#PopupEventPrice").html('<span class=\'greenbutton-line-through\' style="margin-right:5px;" aria-hidden="true">'+Ae+_onlineCheckout.parseTodecimal(se,2).format("#.##")+' </span><span aria-hidden="true">'+Ce+"</span>")}else $(this.model.divStreamingEventPrice_Old).html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(se,2).format("#.##")).attr("aria-label","Old Price is "+$(this.model.divStreamingEventPrice_Old).html()),$(this.model.divStreamingEventPrice_Old).show(),$(this.model.divStreamingEventPrice).html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(le,2).format("#.##")).attr("aria-label","New Price is "+$(this.model.divStreamingEventPrice).html()),_siteBuilderDetail.isAffirmEnable,_siteBuilderDetail.GCVPLText(le,2);else i==_vgClassSessionSelection.StreamingStatusEnum.InHouse?($("#divEventPrice_Old").hide(),$("#divEventPrice_Old").html("").attr("aria-label",""),$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(se,2).format("#.##")),_siteBuilderDetail.GCVPLText(le,1)):($(this.model.divStreamingEventPrice_Old).hide(),$(this.model.divStreamingEventPrice_Old).html(""),$(this.model.divStreamingEventPrice).html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(se,2).format("#.##")).attr("aria-label","Price is "+$(this.model.divStreamingEventPrice).html()),_siteBuilderDetail.GCVPLText(le,2));_vgClassSessionSelection.commonProperty.streamingAmount=_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(le,2).format("#.##")}}_vgClassSessionSelection.EventShowLoader(!1)}catch(e){_vgClassSessionSelection.EventShowLoader(!1),onlineShoppingCart={},onlineShoppingCartmain={}}},GetFrequencyName:function(e){return 1==e?"Daily":2==e?"Weekly":3==e?"Monthly":4==e?"Yearly":"Off"},GetFrequency:function(e,t){var i="";if(1==e)i="day";else if(2==e){var a=t.split("~");i=a.length>0?1==a[0]?"week":a[0]+" weeks":"week"}else i=3==e?"month":4==e?"year":"day";return i},GetFrequencyDays:function(e,t){var i="";if(2==e){if((n=t.split("~")).length>1)for(var a=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),r=n[1].split(","),o=0;o<r.length;o++)i+=a[r[o]-1]+"<br />"}else if(3==e)i=t+_vgClassSessionSelection.nth(t);else if(4==e){var n;if((n=t.split("~")).length>1){i=n[1]+_vgClassSessionSelection.nth(n[1])+" "+["January","February","March","April","May","June","July","August","September","October","November","December"][n[0]-1]}}return i},nth:function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},FormatDate:function(e){return new Date(e).format("MMM-dd-yyyy")},FormatDateCustom:function(e){return new Date(e).format("MMM DD, YYYY")},ShowExceptionDetailSuccess:function(e){if(1==_vgClassSessionSelection.model.IsOnline){var t=parseInt($("#hdnAppointmentId").val());$("#tr-"+t).data("otherSPavailabledates",JSON.stringify(e)),_vgClassSessionSelection.commonProperty.otherSPavailabledates=e}_vgClassSessionSelection.SessionExceptionDetail(e),$("#CheckoutGroupPopup").modal("hide")},SessionExceptionDetail:function(e){_vgClassSessionSelection.commonProperty.SPID;try{var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.ExceptionStorage);if(null!=e&&e.eventAvailableDates.length>0){n=[];for(var i=0,a=0;a<=t.length-1;a++){t[a].autoId=a+1;var r=[];if(0==this.model.IsOnline?t[a].RemarksType==this.commonProperty.SPNotAvalable&&(r=$.grep(e.eventAvailableDates,function(e){return e.strEventDate==new Date(t[a].eventDate).format("yyyy-MM-dd")})):r=$.grep(e.eventAvailableDates,function(e){return e.strEventDate==new Date(t[a].eventDate).format("yyyy-MM-dd")}),r.length>0)if(1==this.model.IsOnline&&(r=$.grep(r,function(e){return t[a].StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream?e.streamingEventCapacity>=e.streamingNoOfAttendees+_vgClassSessionSelection.GetevenetCapacity(e.appointmentID,!0)+1:e.eventCapacity>=e.noOfAttendees+_vgClassSessionSelection.GetevenetCapacity(e.appointmentID,!1)+1})),null!=r&&r.length>0){t[a].isExNotHandle=!1;var o=r.uniqueObjects(["serviceProviderID"]);if(null!=o&&o.length>1){var s=r.uniqueObjects(["serviceProviderID"]);t[a].isMultipleSP=!0,t[a].SPAvalibility=s,t[a].SPArray=[],$.each(s,function(e,i){var r=$.grep(n,function(e){return e.appointmentID==i.appointmentID&&e.SPID==i.serviceProviderID});if(null==r||0==r.length){var o={};o.appointmentID=i.appointmentID,o.SPID=i.serviceProviderID,o.eventCapacity=i.eventCapacity,o.noOfAttendees=0,o.streamingNoOfAttendees=0,t[a].StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse?o.noOfAttendees=i.noOfAttendees+_vgClassSessionSelection.GetevenetCapacity(i.appointmentID,!1):o.streamingNoOfAttendees=i.streamingNoOfAttendees+_vgClassSessionSelection.GetevenetCapacity(i.appointmentID,!0),o.streamingEventCapacity=i.streamingEventCapacity,n.push(o)}clsSPArray={},clsSPArray.SPID=i.serviceProviderID,clsSPArray.SPName=i.serviceProviderName,clsSPArray.appointmentID=i.appointmentID,t[a].SPArray.push(clsSPArray)})}else if(null!=o&&o.length>0){t[a].isExNotHandle=!1,t[a].isMultipleSP=!1,t[a].SPAvalibility=[],t[a].SPAvalibility=r,t[a].SPID=r[0].serviceProviderID,t[a].SPName=r[0].serviceProviderName,0==this.model.IsOnline&&(t[a].StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse?r[0].eventCapacity<r[0].noOfAttendees+_vgClassSessionSelection.GetevenetCapacity(r[0].appointmentID,!1)+1?t[a].isCapacityFull=!0:t[a].isCapacityFull=!1:r[0].streamingEventCapacity<r[0].streamingNoOfAttendees+_vgClassSessionSelection.GetevenetCapacity(r[0].appointmentID,!0)+1?t[a].isCapacityFull=!0:t[a].isCapacityFull=!1);var l=r[0];t[a].StreamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse?l.noOfAttendees+=1:l.streamingNoOfAttendees+=1;var d=$.grep(e.eventAvailableDates,function(e){return e.appointmentID!=l.appointmentID});d.push(l),e.eventAvailableDates=d}}else i+=1,t[a].SPName="--",t[a].isExNotHandle=!0,t[a].Remarks="This class is full.";else(1==this.model.IsOnline||0==this.model.IsOnline&&t[a].RemarksType==this.commonProperty.SPNotAvalable)&&(i+=1),t[a].isExNotHandle=!0,t[a].Remarks="This service provider is not available."}this.SetIntoSessionStorage(this.model.ExceptionStorage,t)}else if(0==this.model.IsOnline){var c=$.grep(t,function(e){return e.RemarksType==_vgClassSessionSelection.commonProperty.ClassFull});i=null==c||c.length<=0?t.length:0}else i=t.length;var u=!1;this.GetNoOfSessions()*this.GetNoOfAttendees()>i&&(u=!0),1==this.model.IsOnline?(0==u?$("#btnConfirm").hide():$("#btnConfirm").show(),this.DisplayStep(2)):(_vgCal.ManageAtnd.model.IsShowExceptionConfirmBtn=u,_vgCal.ManageAtnd.ShowSessionException(!0),"undefined"==typeof InHouseDeposit||null==typeof InHouseDeposit||1!=InHouseDeposit.ClassMultiAttendeeCheckoutType.IndividualCheckout&&2!=InHouseDeposit.ClassMultiAttendeeCheckoutType.IndividualCheckout?$("#btnAddAtndMulti").show():$("#btnAddAtndMulti").hide()),$("#bodyExceptionDetail1").html("");var p=[];(p=0==this.model.IsOnline?t.uniqueObjects(["customerID"]):t.uniqueObjects(["cUserEmail"])).length>1||1==_vgClassSessionSelection.model.IsOnline&&1==p.length&&p[0].customerID!=_vgClassSessionSelection.commonProperty.UserID?$.grep(t,function(e){e.isMultiUserUser=!0}):$.grep(t,function(e){e.isMultiUserUser=!1}),$(".divEventExceptionDetail").html("The following classes cannot be booked:"),$(".divEventExceptionDetail").show(),void 0!==_shopdetail&&void 0!==_shopdetail.lastClassBookingDate&&(t=this.validateAvailabilityException(_shopdetail.lastClassBookingDate,_shopdetail.lastClassBookingLimit,t)),$("#ExceptionDetailTemplate1").tmpl(t).appendTo("#bodyExceptionDetail1"),_vgClassSessionSelection.EventShowLoader(!1)}catch(e){_vgClassSessionSelection.EventShowLoader(!1)}},validateAvailabilityException:function(e,t,i){var a=new Date(e);a.setDate(a.getDate()-1);var r=!1,o=i.filter(function(e){return e.eventDate>a});if(null!=o&&o.length>0)for(var n=0;n<i.length;n++)i[n].RemarksType=3,i[n].lastLimit=t,r=!0;return 1==r?$("#divClassDetailpopup").find("#btnConfirm").text("I Understand"):$("#divClassDetailpopup").find("#btnConfirm").text("Confirm"),i},OtherSPChangeOffline:function(e){var t=$(e).data("previousspid"),i=($(e).data("previousappid"),$(e).val()),a=parseInt($(e).find("option:selected").data("appid"));if("-1"!=i){var r=$.grep(n,function(e){return e.SPID==parseInt(i)&&e.appointmentID==a}),o=$("option[value='"+i+"']:selected",$("select[data-eventdate='"+$(e).data("eventdate")+"']")),s=$(e).data("streamingstatus");if(void 0!==s&&""!=s||(s=_vgClassSessionSelection.StreamingStatusEnum.InHouse),(s==_vgClassSessionSelection.StreamingStatusEnum.InHouse?r[0].eventCapacity:r[0].streamingEventCapacity)<(s==_vgClassSessionSelection.StreamingStatusEnum.InHouse?r[0].noOfAttendees:r[0].streamingNoOfAttendees)+o.length){if(!_vgCal.Common.ShowConfirm("By proceeding further, a system will exceed class capacity. Are you sure you want to proceed?"))return void(void 0!==t&&""!=t?$(e).val(t):$(e).val("-1"));$(e).find("option:selected").data("isspfull",!0)}else $(e).find("option:selected").data("isspfull",!1)}void 0!==t&&""!=t&&"-1"!=t&&$(e).find("option[value='"+t+"']").data("isspfull",!1),$(e).data("previousspid",i),$(e).data("previousappid",a)},OtherSPChange:function(e){var t=$(e).data("previousspid"),i=$(e).data("previousappid"),a=parseInt($(e).val()),r=parseInt($(e).find("option:selected").data("appid")),o=$(e).data("streamingstatus");void 0!==o&&""!=o||(o=_vgClassSessionSelection.StreamingStatusEnum.InHouse);var s=[];void 0!==t&&""!=t&&void 0!==i&&""!=i&&$.grep(n,function(e){e.SPID==parseInt(t)&&e.appointmentID==parseInt(i)&&(o==_vgClassSessionSelection.StreamingStatusEnum.LiveStream?e.streamingNoOfAttendees-=1:e.noOfAttendees-=1)}),-1!=a?($(e).data("previousspid",a),$(e).data("previousappid",r),$.grep(n,function(e){return e.SPID==a&&e.appointmentID==r&&(o==_vgClassSessionSelection.StreamingStatusEnum.LiveStream&&e.streamingEventCapacity>=e.streamingNoOfAttendees+1?e.streamingNoOfAttendees+=1:e.eventCapacity>=e.noOfAttendees+1&&(e.noOfAttendees+=1)),e.SPID==a&&e.appointmentID==r})):($(e).data("previousspid",""),$(e).data("previousappid","")),$.grep($("option",$(e)),function(e){if("-1"!=$(e).val()){var t=$.grep(n,function(t){return t.SPID==parseInt($(e).val())&&t.appointmentID==parseInt($(e).data("appid"))});null!=t&&t.length>0&&(s=s.concat(t))}});var l="(Not Available)";if(s.length>0)for(var d=0;d<=s.length-1;d++)$.grep($("option",$("select[data-eventdate='"+$(e).data("eventdate")+"']").not(e)),function(e){"-1"!=$(e).val()&&parseInt($(e).val())==s[d].SPID&&0==$(e).is(":selected")&&(o==_vgClassSessionSelection.StreamingStatusEnum.InHouse&&s[d].eventCapacity==s[d].noOfAttendees||o==_vgClassSessionSelection.StreamingStatusEnum.LiveStream&&s[d].streamingEventCapacity==s[d].streamingNoOfAttendees?($(e).prop("disabled",!0),$(e).html().toString().indexOf(l)<=0?$(e).html($(e).html()+l):($(e).prop("disabled",!0),$(e).html().toString().indexOf(l)<=0&&$(e).html($(e).html()+l))):($(e).prop("disabled",!1),$(e).html($(e).html().replace(l,""))))})},DisplayStep:function(e){if(void 0!==_shopdetail&&null!=_shopdetail&&(1==_shopdetail.IsMemPkgReqToBook||1==_shopdetail.IsLimitOnlineBooking)){var t=_shopdetail.LiveStreamSignUp;if(void 0!==t&&null!=t&&1==e)return!1}var i=$("#divSessionDetail"),a=$("#divSessionFooter"),r=$("#divExceptionDetail1"),o=$("#divExceptionFooter"),n=$("#divUserDetail"),s=$("#divUserFooter");return _vgClassSessionSelection.ResetMoreButton(),1==e?(r.hide(),o.hide(),n.hide(),s.hide(),i.show(),a.show(),$("#classDetailpopup").removeClass("classstep1"),centerModal($("#divClassDetailpopup")),void 0!==setPopupPosi&&void 0!==IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&(iOS||isAndroidMobile||($("#divClassDetailpopup").addClass("wbDivClassDetailpopup"),setPopupPosi($("#divClassDetailpopup")))),$("#divEventName").show().attr("tabindex","-1").attr("role","heading").attr("aria-level","1").focus(),$("#ancHome").attr("tabindex","-1"),""!=$("#eventDescription").text().trim()&&$("#eventDescription").show(),$(".more-gradient").show(),$("#divAddFriendsToWk").hide(),$("#divWkName").hide(),$("#divWkTotalPrice").hide(),$("#divClassShowDiscount").show(),$(_vgClassSessionSelection.Controls.divHdrEventPrice).hide()):2==e?(i.hide(),a.hide(),n.hide(),s.hide(),r.show(),o.show(),$("#divClassShowDiscount").hide(),$("#classDetailpopup").addClass("classstep1"),centerModal($("#divClassDetailpopup")),void 0!==setPopupPosi&&void 0!==IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&(iOS||isAndroidMobile||($("#divClassDetailpopup").addClass("wbDivClassDetailpopup"),setPopupPosi($("#divClassDetailpopup"))))):3==e&&(i.hide(),a.hide(),r.hide(),o.hide(),n.show(),s.show(),$("#classDetailpopup").addClass("classstep1"),centerModal($("#divClassDetailpopup")),void 0!==setPopupPosi&&void 0!==IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&(iOS||isAndroidMobile||($("#divClassDetailpopup").addClass("wbDivClassDetailpopup"),setPopupPosi($("#divClassDetailpopup"))))),!1},BackToPreviousStep:function(){_vgClassSessionSelection.EventShowLoader(!0),this.DisplayStep(parseInt($("#btnBack").data("from"))),_vgClassSessionSelection.commonProperty.isWaitlist||this.ManageEventTempAndRealData(!1,!1),_vgClassSessionSelection.EventShowLoader(!1)},removegroup:function(e){$("#eventusergroup"+e).remove(),(r=jQuery.grep(r,function(t){return t!=e})).length+1>19?$("#addnew").hide():$("#addnew").show(),1==_vgClassSessionSelection.commonProperty.isWorkShop&&(_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?$("#divWkTotalPrice_sub").html(_vgClassSessionSelection.GetcurrencySymbol()+_vgClassSessionSelection.CalcSessionPrice(_vgClassSessionSelection.commonProperty.sessiondetail,_vgClassSessionSelection.GetNoOfSessions(),r.length+1,!0,!0)):$("#divWkTotalPrice_sub").html($("#divEventPrice").html()))},RemoveAttendee:function(e){var t=$(e).closest(".panel-default");$("div.clsaccordion").find(t).remove();var i=this.GetNoOfAttendees()-1;$("#txtNoofAttendees").val(i),_vgClassSessionSelection.CalculateSessionPrice(),_vgClassSessionSelection.ShowDiscountOnEvent(),_vgClassSessionSelection.BindFamilyFriendList(i)},CloseSelectiononlowendDevices:function(e){$(e).closest("div.collapse").collapse("hide"),$("#divAddonPopupSection").removeClass("scrollbackhide")},addControl:function(){var e=2;null!=r&&0==r.length?r.push(e):(r.push(r[r.length-1]+1),e=r[r.length-1]),r.length+1>19?$("#addnew").hide():$("#addnew").show(),1==_vgClassSessionSelection.commonProperty.isWorkShop&&(_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?$("#divWkTotalPrice_sub").html(_vgClassSessionSelection.GetcurrencySymbol()+_vgClassSessionSelection.CalcSessionPrice(_vgClassSessionSelection.commonProperty.sessiondetail,_vgClassSessionSelection.GetNoOfSessions(),r.length+1,!0,!0)):$("#divWkTotalPrice_sub").html($("#divEventPrice").html())),$("#grouptemplate ul").attr("id","eventusergroup"+e),$("#eventusergroup").append($("#grouptemplate").html()),$("#grouptemplate ul").removeAttr("id"),$("#eventusergroup"+e+" img").attr("id","imgid"+e),$("#eventusergroup"+e+" .clsremoveUser").attr("onclick","_vgClassSessionSelection.removegroup("+e+")"),$("#eventusergroup #txtFirstName").attr("id","txtFirstName"+e),$("#eventusergroup #txtLastName").attr("id","txtLastName"+e),$("#eventusergroup #txtEmailId").attr("id","txtEmailId"+e),$("#eventusergroup #txtCellNo").attr("id","txtCellNo"+e),$("#eventusergroup #divFirstName").attr("id","divFirstName"+e),$("#eventusergroup #divLastName").attr("id","divLastName"+e),$("#eventusergroup #divEmailId").attr("id","divEmailId"+e)},validate:function(e,t,i){if(1!=$(e).hasClass("noValidate")||1!=$(e).is(":disabled")){var a=!0;if("cell"==t)return""!=$(e).val()?/^0?\d{10}$/i.test($(e).val())?($(e).removeClass("errorInput"),$(e).siblings("div.validatemsg").hide(),!0):($(e).addClass("errorInput"),$(e).siblings("div.validatemsg").show(),$(e).siblings("div.validatemsg").html("cell should be of 10 digits."),!1):($(e).removeClass("errorInput"),$(e).siblings("div.validatemsg").hide(),!0);var r=$.trim($(e).val());if(""!=r||$(e).hasClass("select2-focusser")||$(e).hasClass("select2-input")){if("email"==t){if(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,10}(?:\.[a-z]{2})?)$/i.test(r)){if(0==i){var o=0;if($("#eventusergroup input[data-type]").each(function(){if($.trim($(this).val()).toLowerCase()==r.toLowerCase()&&(o+=1)>1)return!1}),o>1)$(e).siblings("div.validatemsg").html("duplicate email exist"),$(e).addClass("errorInput"),$(e).siblings("div.validatemsg").show(),a=!1;else{var n=_vgClassSessionSelection.commonProperty.eventID,s=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(s.length>0){var l=$.grep(s,function(e){return e.eventID==n});l.length>0&&_vgClassSessionSelection.CheckUserExistance(0,$(e).val().trim(),l[0])&&($(e).siblings("div.validatemsg").html("this user is already exists in cart."),$(e).addClass("errorInput"),$(e).siblings("div.validatemsg").show(),a=!1)}}}}else $(e).addClass("errorInput"),$(e).siblings("div.validatemsg").show(),$(e).siblings("div.validatemsg").html("invalid email address"),a=!1}}else $(e).addClass("errorInput"),a=!1;return 1==a&&($(e).removeClass("errorInput"),$(e).siblings("div.validatemsg").hide()),a}},validateForUserExistance:function(e,t,i){var a=!0,r=_vgClassSessionSelection.ResponseValidateForExistance(e,$(t).val(),i);return null!=r&&($(t).siblings("div").html(r.Msg),$(t).addClass("errorInput"),$(t).siblings("div").show(),a=!1),1==a&&($(t).removeClass("errorInput"),$(t).siblings("div").hide()),a},clearcontrol:function(){$("div.clsaccordion").find(".panel-default").remove(),ZenSwipeCardDetails={},isCCChanged=!1},SetFamilyFriendListData:function(e,t,i){ShowLoader(!0);var a=1;$.each(e,function(e,t){t.Index=a,t.Tag="",t.IsDisabled=0,t.IsMemPkgReqToBook=_shopdetail.IsMemPkgReqToBook,t.IsLimitOnlineBooking=_shopdetail.IsLimitOnlineBooking,a++}),_vgClassSessionSelection.AddOnServiceBind(e,t,i),$(".clsaccordion").empty();var r=0;if($.each(e,function(t,i){r++,i.Index=r,void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking&&void 0!==_shopdetail.DisplayEmpNotAccptNewClientsBadgeFnFPopUp&&1==_shopdetail.DisplayEmpNotAccptNewClientsBadgeFnFPopUp($("#hdnserviceProviderID").val(),i.UserID)&&(e[t].Tag="NOT ACCEPTING NEW CLIENTS",e[t].IsDisabled=1)}),void 0!==_shopdetail&&null!=_shopdetail&&null!=_shopdetail.IsMemPkgReqToBook&&1==_shopdetail.IsMemPkgReqToBook){var o=!1;if(void 0!==_shopdetail&&void 0!==_shopdetail.MembershipPackageDetails&&void 0!==_shopdetail.MembershipPackageDetails.Data&&null!=_shopdetail&&null!=_shopdetail.MembershipPackageDetails&&null!=_shopdetail.MembershipPackageDetails.Data&&null!=_shopdetail.MembershipPackageDetails.Data.UserMemberShipAndPackageInformation&&!String.isNullOrUndefineOrBlank(_shopdetail.MembershipPackageDetails.Data.UserMemberShipAndPackageInformation.RequiredServices)){var n=_shopdetail.MembershipPackageDetails.Data.UserMemberShipAndPackageInformation.RequiredServices.split(","),s=_vgClassSessionSelection.commonProperty.eventID;void 0!==s&&null!=s&&s>0&&$.each(n,function(e,t){t==s&&(o=!0)})}o&&$.each(e,function(e,t){if(""==t.Tag){var i=$.grep(_vgClassSessionSelection.FamilyFriendsMembershipPackage.Data.FamilyFriendsMembershipPackage,function(e){return e.UserID==t.UserID});i.length>0&&(0!=i[0].ItemId?t.Tag=i[0].Tag:t.UserID!=UserID||void 0!==_shopdetail.BookingDetail.fnfUserId?(t.Tag="Membership/Package Required To Book",t.IsDisabled=1):t.Tag="")}})}var l=[],d=(a=0,0),c=!1;if(null!=_vgClassSessionSelection.commonProperty.ClassPropertyData){var u=_vgClassSessionSelection.commonProperty.ClassPropertyData.serviceProviderID;_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.forEach(function(e){c=e.ServiceProviderID!=u||1!=e.Existing||e.UserID!=UserID})}if(void 0!==_shopdetail&&null!=_shopdetail&&null!=_shopdetail.IsLimitOnlineBooking&&1==_shopdetail.IsLimitOnlineBooking&&1==c){var p=""==$("#hdnSelSPID").val()?UserID:$("#hdnSelSPID").val();e.forEach(function(e){if(e.UserID==Number(p)){var t={};1==++a&&(t.Index=a,t.UserId=e.UserID,t.FullName=e.FullName,t.Photo=e.Photo,t.Email=e.Email,t.Phone=e.Phone,t.Tag=e.Tag),l[a]=t,d=a}})}else for(;t>0;){t--;var h={};1==++a?(h.Tag=e[0].Tag,h.IsDisabled=e[0].IsDisabled,h.Index=a,h.UserId=e[0].UserID,h.FullName=e[0].FullName,h.Photo=e[0].Photo,h.Email=e[0].Email,h.Phone=e[0].Phone,void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking&&(h.Tag=e[0].Tag)):(h.Index=a,h.UserId="",h.FullName="",h.Photo="",h.Email="",h.Phone="",h.Tag="",h.IsDisabled=0),l[a]=h}if($("#AttendeelistTemplate").tmpl(l).appendTo(".clsaccordion"),$("#SubAttendeelistTemplate").tmpl(e).appendTo(".clsfamilyandfriends"),void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking){if(void 0!==_shopdetail.EmployeeNotAcceptingNewClientsDetails)0==$.grep(_shopdetail.EmployeeNotAcceptingNewClientsDetails,function(e,t){return e.ServiceProviderID==$("#hdnserviceProviderID").val()}).length&&$("#FamilyandFriendsbottomlinks").tmpl().appendTo(".clsfamilyandfriends");if(1==_shopdetail.IsLimitOnlineBooking&&""!=$("#hdnSelSPID").val()){var m=$("#hdnSelSPID").val();_shopdetail.FnfUserSelectionForClass($(".clsuid"+m))}else 1!=_shopdetail.IsLimitOnlineBooking&&1!=_shopdetail.IsMemPkgReqToBook&&$("#FamilyandFriendsbottomlinks").tmpl().appendTo(".clsfamilyandfriends")}else $("#FamilyandFriendsbottomlinks").tmpl().appendTo(".clsfamilyandfriends");$(".modal:visible").each(function(e,t){centerModal(t)}),ShowLoader(!1),void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking&&e.length>0&&(void 0===e[0].Tag||""==e[0].Tag||d>0?($("#btnSearchAvailability").hide(),$("#btnUAddtoCart").show(),$("#btnUCheckOut").show()):($("#btnSearchAvailability").show(),$("#btnUAddtoCart").hide(),$("#btnUCheckOut").hide()))},BindFamilyFriendList:function(e){_vgClassSessionSelection.localData.AddonsList=[],_vgClassSessionSelection.commonProperty.streamingAmount.replace(_vgClassSessionSelection.GetcurrencySymbol(),"").replace(",","")>0?($(_vgClassSessionSelection.Controls.divHdrEventPrice).text(_vgClassSessionSelection.commonProperty.streamingAmount.replace(",","")),$(_vgClassSessionSelection.Controls.divHdrEventPrice).show()):($(_vgClassSessionSelection.Controls.divHdrEventPrice).text("FREE"),$(_vgClassSessionSelection.Controls.divHdrEventPrice).show()),$(_vgClassSessionSelection.Controls.AddOnList).empty(),$(_vgClassSessionSelection.Controls.divAddonPopupSection).hide(),$(".moblie-devider").hide(),$(".m-addon-text").hide(),_vgClassSessionSelection.CalculateTotalPrice();try{var t=_vgClassSessionSelection.commonProperty.lstfamilyfriendmembers;if(void 0!==t&&null!=t&&t.length>0)_vgClassSessionSelection.SetFamilyFriendListData(t,e,!1);else{var i={UserID:UserID,ServiceId:parseInt(_vgClassSessionSelection.commonProperty.eventID),BusinessID:parseInt(_vgClassSessionSelection.GetCommonBusinessID()),ServiceProviderID:parseInt($("#hdnserviceProviderID").val())},a=new vagaro.ajax;a.datamodel.Token="GetListofFamilyFriendtoBook",a.datamodel.data=[i],a.datamodel.callback=function(t){ShowLoader(!0),_vgClassSessionSelection.SetFamilyFriendListData(t,e,!1)},a.datamodel.Error=_vgClassSessionSelection.CallFailed,a.Post()}}catch(e){}},AddUser:function(){var e=this.GetNoOfAttendees();if(_vgClassSessionSelection.BindFamilyFriendList(e),e!=r.length+1)if(e>r.length+1)for(var t=r.length+1;t<=e-1;t++)this.addControl();else{var i=$.extend(!0,[],r);i=i.reverse();for(var a=1;a<=i.length+1-e;a++)_vgClassSessionSelection.removegroup(i[a])}$("#eventusergroup input").each(function(){$(this).removeClass("errorInput"),$(this).siblings("div").hide()}),$(".dynemicData input").attr("autocomplete","new-password"),1==this.model.IsOnline&&this.DisplayStep(3)},CheckLogiUserCheckExistance:function(e){if(0!=this.GetAllSessionDates(3)){o=this.GetAllSessionDates(1);var t=this.commonProperty.eventID,i=this.GetSessionStorage(this.model.EventStorage);if(i.length>0){var a=$.grep(i,function(e){return e.eventID==t});if(a.length>0&&this.CheckUserExistance(this.commonProperty.UserID,"",a[0])){_vgClassSessionSelection.EventShowLoader(!1);var r="Would you like to add a friend to this class?";1==this.model.IsOnline?"undefined"!=typeof bootbox&&_vgClassSessionSelection.AlreadyEnrolled(r):_vgCal.Common.ShowConfirm(r)&&(_vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.SetDefaultUser(!1),_vgCal.ManageAtnd.ShowStep2(!0),_vgClassSessionSelection.EventShowLoader(!1))}else _vgClassSessionSelection.clearcontrol(),_vgClassSessionSelection.SetDefaultattendee(),1==this.model.IsOnline?_vgClassSessionSelection.CheckUserExistanceInEvent(e):_vgClassSessionSelection.CreateEventCollection(e)}else _vgClassSessionSelection.clearcontrol(),_vgClassSessionSelection.SetDefaultattendee(),1==this.model.IsOnline?_vgClassSessionSelection.CheckUserExistanceInEvent(e):_vgClassSessionSelection.CreateEventCollection(e)}else _vgClassSessionSelection.EventShowLoader(!1)},SetDefaultattendee:function(){var e=[],t={Index:1};t.UserId=parseInt(UserID),t.FullName=FullUserName+" (Me)",t.Photo="",t.Email="undefined"!=typeof UserEmail&&null!=UserEmail?UserEmail.trim():"",t.Phone=UserCellNo,e[1]=t,$("#AttendeelistTemplate").tmpl(e).appendTo(".clsaccordion")},CheckUserExistanceInEvent:function(t){var i=_vgClassSessionSelection,r=$("<XMLDocument/>");r.append(i.createXmlElement("appointments"));var n=[];if(o.length<=0?(n=this.GetAllSessionDates(t),o=n):n=o,n.length>0){for(var s=0;s<=n.length-1;s++){var l,d=this.commonProperty.SPID;if(null!=(l=$.grep(this.commonProperty.availabledates.eventAvailableDates,function(e){return e.strEventDate==n[s].format("yyyy-MM-dd")&&e.serviceProviderID==d}))&&l.length>0){var c=i.createXmlElement("appointment");if(c.append(i.createXmlElement("appid",l[0].appointmentID)),!_vgClassSessionSelection.model.IsSearchFromInHouseClass&&$("div.clsaccordion").find(".panel-default").length>0)$("div.clsaccordion").find(".panel-default").each(function(){EUserID=$(this).attr("data-value"),EUserEmailID=$(this).attr("data-Email");var e=i.createXmlElement("user");e.append(i.createXmlElement("email",EUserEmailID)),e.append(i.createXmlElement("userId",EUserID)),c.append(e)});else if(_vgClassSessionSelection.model.IsSearchFromInHouseClass||0!==$("div.clsaccordion").find(".panel-default").length){EUserID=_vgClassSessionSelection.getSelectedCustomer(),EUserEmailID="",(u=i.createXmlElement("user")).append(i.createXmlElement("email",EUserEmailID)),u.append(i.createXmlElement("userId",EUserID)),c.append(u)}else{var u;EUserID=_vgClassSessionSelection.commonProperty.UserID,EUserEmailID=_vgClassSessionSelection.commonProperty.UserEmail,(u=i.createXmlElement("user")).append(i.createXmlElement("email",EUserEmailID)),u.append(i.createXmlElement("userId",EUserID)),c.append(u)}r.find("appointments").append(c)}}if(r.find("appointments").find("appointment").length>0){var p={businessId:_vgClassSessionSelection.GetCommonBusinessID(),userData:r.html(),isWaitlist:_vgClassSessionSelection.commonProperty.isWaitlist};vagaro.ajaxCall(e+a.checkuserexistanceinevent,p,function(e){if(null==e||0==e.length){if(1==t||2==t||4==t||5==t)i.CreateEventCollection(t);else if(3==t)i.SetDefaultUser(!0),i.AddUser(),i.EventShowLoader(!1);else if(6==t){var a=_vgCal.ManageAtnd.model.modalAttendee;$("#"+_vgCal.ManageAtnd.model.btnBack).hide(),$("#"+a).show(),_vgClassSessionSelection.CalcAndDisplayPriceClassLocation(),$("#dvClassInfo").show(),void 0!==_vgClassSessionSelection.commonProperty.isWorkShop&&1==_vgClassSessionSelection.commonProperty.isWorkShop?$("#dvClsLocationTitle").html(_vgCal.ManageAtnd.TextValues.WorkshopKeyword+" Location:"):$("#dvClsLocationTitle").html(_vgCal.Common.model.ClassKeyWord+" Location:"),$("#dvClassLiveOrAtBusiness").show(),_vgClassSessionSelection.EventShowLoader(!1),SetTopLeft(".calendar-popups-center")}}else if(1==t||2==t||3==t){if(i.EventShowLoader(!1),"undefined"!=typeof bootbox)if(1==isCheckInApp){var r=_vgClassSessionSelection.ResponseValidateForExistance(i.commonProperty.UserID,"",e);bootbox.alert(r.Title),_vgClassSessionSelection.ShowHideClassPopup(!1)}else{r=_vgClassSessionSelection.ResponseValidateForExistance(i.commonProperty.UserID,"",e);bootbox.confirm({title:r.Title,message:r.Message,buttons:{confirm:{label:"Add a Friend"}},callback:function(e){e&&(i.EventShowLoader(!0),i.SetDefaultUser(!1),1==t||2==t?i.DisplayStep(3):3==t&&i.AddUser(),i.EventShowLoader(!1))}})}}else if(4==t||5==t){var n=0;$("#eventusergroup input[data-type]").each(function(){0==i.validateForUserExistance(1==$(this).is(":disabled")?i.commonProperty.UserID:0,$(this),e)&&1==(n+=1)&&$(this).focus()}),0==n?i.CreateEventCollection(t):i.EventShowLoader(!1)}else if(6==t){r=_vgClassSessionSelection.ResponseValidateForExistance(_vgClassSessionSelection.getSelectedCustomer(),"",e);return window.parent.ShowHideWarningMessageCommon(r.Title),_vgCal.ManageAtnd.objAtList=[],o=[],_vgCal.ManageAtnd.Reset(),_vgClassSessionSelection.EventShowLoader(!1),!1}},_vgClassSessionSelection.CallFailed,!1,!0)}else 1==t||2==t||4==t||5==t?i.CreateEventCollection(t):3==t&&(i.SetDefaultUser(!0),i.AddUser(),i.EventShowLoader(!1))}else i.EventShowLoader(!1)},ResponseValidateForExistance:function(e,t,i){responseClass=[],responseWaitlist=[];var a={};$.grep(i,function(i){(e>0&&i.userId==e||0==e&&i.emailId==t)&&(1==i.type?responseClass.push(i):2==i.type&&responseWaitlist.push(i))});if(_vgClassSessionSelection.model.IsSearchFromInHouseClass){cache_glbData="object"==typeof localStorage&&void 0!==localStorage[cache_custlist]&&localStorage[cache_custlist].length>0?JSON.parse(localStorage[cache_custlist]||[]):[];var r=_vgClassSessionSelection.getSelectedCustomer(),o=cache_glbData.filter(function(e){return e.ID==r?e:null});if((isFromRebook||isFromReschedual)&&(null==o||null!=o&&0==o.length)&&void 0!==$("#txtCustomerSearchClass").attr("custDetail")&&null!=$("#txtCustomerSearchClass").attr("custDetail")&&""!=$("#txtCustomerSearchClass").attr("custDetail")){o=[];var n=JSON.parse($("#txtCustomerSearchClass").attr("custDetail"));o.push(n)}responseClass.length>0&&responseWaitlist.length>0?(a.Title=o[0].FN+" is already enrolled in this class and waitlist",a.Message="You are already enrolled in this class and waitlist. Would you like to add a friend to the class and waitlist?",a.Msg="this user is already enrolled class and waitlist."):responseClass.length>0?(a.Title=o[0].FN+" is already enrolled in this class",a.Message="You are already enrolled in this class. Would you like to add a friend to the class?",a.Msg="this user is exists in waitlist."):responseWaitlist.length>0&&(a.Title=o[0].FN+" is already enrolled in this waitlist",a.Message="You are already enrolled in this waitlist. Would you like to add a friend to the waitlist?",a.Msg="this user is exists in waitlist.")}else responseClass.length>0&&responseWaitlist.length>0?(a.Title="You are Already Enrolled Class and Waitlist",a.Message="You are already enrolled in this class and waitlist. Would you like to add a friend to the class and waitlist?",a.Msg="this user is already enrolled class and waitlist."):responseClass.length>0?(a.Title="You are Already Enrolled in Class",a.Message="You are already enrolled in this class. Would you like to add a friend to the class?",a.Msg="this user is exists in waitlist."):responseWaitlist.length>0&&(a.Title="You are Already Enrolled in Waitlist",a.Message="You are already enrolled in this waitlist. Would you like to add a friend to the waitlist?",a.Msg="this user is exists in waitlist.");return 1==$.isEmptyObject(a)?null:a},AddUserWithCheckExistance:function(e){if(0!=this.GetAllSessionDates(e)){o=this.GetAllSessionDates(1);var t=this.commonProperty.eventID,i=this.GetSessionStorage(this.model.EventStorage);if(i.length>0){var a=$.grep(i,function(e){return e.eventID==t});if(a.length>0&&this.CheckUserExistance(this.commonProperty.UserID,"",a[0])){_vgClassSessionSelection.EventShowLoader(!1);var r="Would you like to add a friend to this class?";1==this.model.IsOnline?"undefined"!=typeof bootbox&&bootbox.confirm({title:"This Class is Already in Your Cart",message:r,buttons:{confirm:{label:"Add a Friend"}},callback:function(e){e&&(_vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.SetDefaultUser(!1),_vgClassSessionSelection.AddUser(),_vgClassSessionSelection.EventShowLoader(!1))}}):_vgCal.Common.ShowConfirm(r)&&(_vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.SetDefaultUser(!1),_vgClassSessionSelection.AddUser(),_vgClassSessionSelection.EventShowLoader(!1))}else this.SetDefaultUser(!0),1==this.model.IsOnline?_vgClassSessionSelection.CheckUserExistanceInEvent(e):(this.AddUser(),_vgClassSessionSelection.EventShowLoader(!1))}else this.SetDefaultUser(!0),1==this.model.IsOnline?_vgClassSessionSelection.CheckUserExistanceInEvent(e):(this.AddUser(),_vgClassSessionSelection.EventShowLoader(!1))}else _vgClassSessionSelection.EventShowLoader(!1)},UserValidate:function(e){var t=_vgClassSessionSelection;t.EventShowLoader(!0);var i=0;$("div.clsaccordion").find(".panel-default").each(function(){void 0===$(this).attr("data-value")&&(i+=1)});var a=_vgClassSessionSelection.AddonValidate();if(0==i&&a){var r=0,o=$("div.clsaccordion").find(".panel-default").attr("data-value"),n=$("div.clsaccordion").find(".panel-default").attr("data-email"),s=_vgClassSessionSelection.commonProperty.eventID,l=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(l.length>0){var d=$.grep(l,function(e){return e.eventID==s});d.length>0&&_vgClassSessionSelection.CheckUserExistance(o,n,d[0])&&(_vgClassSessionSelection.commonMessageAlert("This user is already exists in cart."),r+=1,t.EventShowLoader(!1))}0==r&&(t.CheckUserExistanceInEvent(e),_onlineCheckout.Clear_ShowDiscount())}else 0!=i&&_vgClassSessionSelection.commonMessageAlert("Select All Attendees."),t.EventShowLoader(!1);return!1},SetDefaultUser:function(e){var t=$(".staticData #txtFirstName1"),i=$(".staticData #txtLastName1"),a=$(".staticData #txtEmailId1"),r=$(".staticData #txtCellNo1");if(e)t.val(this.commonProperty.FullUserName.split(" ")[0]),void 0!==this.commonProperty.FullUserName.split(" ")[1]?i.val(this.commonProperty.FullUserName.split(" ")[1]):i.val(""),a.val(this.commonProperty.UserEmail),r.val(this.commonProperty.UserCellNo),t.attr("disabled",!0),i.attr("disabled",!0),a.attr("disabled",!0),r.attr("disabled",!0),t.data("isdefaultuser",!0),$("#divClassShowDiscount").show();else{t.attr("disabled",!1),i.attr("disabled",!1),a.attr("disabled",!1),r.attr("disabled",!1),t.val(""),i.val(""),a.val(""),r.val("");var o=$("#otherUserPreviousDetail"),n=o.data("fname"),s=o.data("lname"),l=o.data("email"),d=o.data("cell");void 0!==n&&null!=n&&void 0!==s&&null!=s&&void 0!==l&&null!=l&&void 0!==d&&null!=d&&(t.val(n),i.val(s),a.val(l),r.val(d)),t.data("isdefaultuser",!1),$("#divClassShowDiscount").hide()}1==_vgClassSessionSelection.commonProperty.isWorkShop?($("#divEventName").hide(),$("#eventDescription").hide(),$(".more-gradient").hide(),_vgClassSessionSelection.commonProperty.isWaitlist?$("#divAddFriendsToWk").html("<span>Add Friends to Waitlist</span>"):$("#divAddFriendsToWk").html("<span>Add Friends to Workshop</span>"),$("#divAddFriendsToWk").show(),$("#divWkName").html(_vgClassSessionSelection.commonProperty.eventName),$("#divWkName").show(),_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?$("#divWkTotalPrice_sub").html($(this.model.divStreamingEventPrice).html()):$("#divWkTotalPrice_sub").html($("#divEventPrice").html()),$("#divWkTotalPrice").show()):($("#divEventName").show(),$("#divEventName").focus(),""!=$("#eventDescription").val().trim()&&$("#eventDescription").show(),$(".more-gradient").show())},CheckUserExistance:function(e,t,i){var a=!1;if(o.length>0)for(var r=0;r<=o.length-1;r++){if($.grep(i.eventEnrollment,function(i){return new Date(i.eventDate).format("yyyy-MM-dd")==new Date(o[r]).format("yyyy-MM-dd")&&(1==i.hasOwnProperty("isTempData")&&1!=i.isTempData||0==i.hasOwnProperty("isTempData"))&&i.startTime==_vgClassSessionSelection.commonProperty.shortStartTime&&i.eventID==_vgClassSessionSelection.commonProperty.eventID&&i.sPID==_vgClassSessionSelection.commonProperty.SPID&&(e>0&&i.customerID==e||e<=0&&void 0!==i.cUserEmail&&null!=i.cUserEmail&&i.cUserEmail.toLowerCase()==t.toLowerCase())}).length>0){a=!0;break}}return a},GetUserShortDetail:function(e,t){return e+" "+(t.length>1?t.substring(0,1):t)+"."},EventShowLoader:function(e){1==_vgClassSessionSelection.model.IsOnline?ShowLoader(e):_vgCal.Common.model.IsNewAPI?_vgClassSessionSelection.model.IsSearchFromInHouseClass?ShowLoadingPanel(e):ChangeAppStatus.ShowLoadingPanel(e):_vgCal.Common.ShowLoader(e)},GetTaxTotalForService:function(e,t){var i=0;if(void 0!==e&&null!=e&&""!=e)return $.each(e,function(e,a){null!=t&&t.length>0&&t.split(",").indexOf(""+a.BusinessTaxID)>-1&&(i=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(i+_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(a.Tax,!1,3),!1,3))}),i},GetTaxesForService:function(e,t){return null!=e?$.grep(e,function(e){if(null!=t&&t.length>0&&t.split(",").indexOf(""+e.BusinessTaxID)>-1)return e.IsRemoveTax=!1,e.CalculatedTax=0,!0}):null},AddFeesToDepositPopupForException:function(e,t){var i=[],a={};a.Price=e,a.paidType=1==t?1:4,i.push(a),InHouseDeposit.AddFeesForAppointments(i,!1,t);var r=0;return $.each(InHouseDeposit.model.CalculatedFees,function(e,t){r+=t.Price}),_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(r,!1,2)},AddFeesToDepositPopup:function(e,t,i){var a=[];if(8==t)for(var r=1==i?1:_vgClassSessionSelection.GetNoOfSessions(),o=0;o<r;o++){(n={}).Price=1==i?e:e/_vgClassSessionSelection.GetNoOfSessions(),n.paidType=4,a.push(n)}else if(1==t){var n;(n={}).Price=e,n.paidType=1,a.push(n)}InHouseDeposit.AddFeesForAppointments(a,!1,t);var s=0;return $.each(InHouseDeposit.model.CalculatedFees,function(e,t){s+=t.Price}),_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(s,!1,2)},CalculateTaxForFees:function(e){var t=0;return $.each(InHouseDeposit.model.CalculatedFees,function(i,a){var r=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(_vgClassSessionSelection.GetTaxTotalForService(e,a.BusinessTaxIDs),!1,2),o=_vgAddEditApp.AddEditApp.ConvertDecimalWithFixed(a.Price*parseFloat(r)/100,!1,3);t+=o}),t},EnableDatesOffline:function(t,i,r,o,n,s){var l=new Date(o);setdatepickervalue({divid:_EnddivsessionDatePickerID,textid:_EndtextsessionDatePickerID,flagVgMultiMonthDatePicker:!0},l);var d={};d.eventId=t,d.businessID=i,d.serviceProviderID=r,d.startTime=_vgCal.Common.GetFormattedDateStr(l,_vgCal.Common.model.DateTimeOldFormat),d.type=2,this.commonProperty.eventID=t,this.commonProperty.businessID=i,this.commonProperty.SPID=r,this.commonProperty.teacherName=n,this.commonProperty.eventName=s,this.commonProperty.startTime=_vgCal.Common.GetFormattedDateStr(l,_vgCal.Common.model.DateTimeOldFormat);var c=l.format("ddd");$("#rptAt"+c).addClass("active").removeClass("disabled"),$("#rptAt"+c).attr("data-disable","0"),vagaro.ajaxCall(e+a.geteventdetailandavailabledates,d,function(e){if(null!=e){_vgClassSessionSelection.commonProperty.enableSessionDate=[];for(var t=e.eventAvailableDates,i=0;i<t.length;i++){var a=new Date(moment(t[i].strEventDate)._d);_vgClassSessionSelection.commonProperty.enableSessionDate.push(a.format("MMM dd,yyyy"))}destroydatepicker({divid:_EnddivsessionDatePickerID,textid:_EndtextsessionDatePickerID,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),parentID:_EnddivsessionDatePickerID,isMobileFriendly:!1,arrValidDates:_vgClassSessionSelection.commonProperty.enableSessionDate}),setdatepickervalue({divid:_EnddivsessionDatePickerID,textid:_EndtextsessionDatePickerID,flagVgMultiMonthDatePicker:!0},l),_vgClassSessionSelection.commonProperty.availabledates=e;var r=0;if(_vgClassSessionSelection.commonProperty.CalculatedTaxTypeWise=[],"undefined"!=typeof CalendarConfiguration&&void 0!==CalendarConfiguration.CommonDetails&&void 0!==CalendarConfiguration.CommonDetails.BusinessTaxes&&null!=e.eventDetail.TaxesValues&&e.eventDetail.TaxesValues.length>0){var o=JSON.parse(e.eventDetail.TaxesValues).Taxes,n=$.map(o,function(e){return e.BusinessTaxID}).join();r=_vgClassSessionSelection.GetTaxTotalForService(CalendarConfiguration.CommonDetails.BusinessTaxes,n),_vgClassSessionSelection.commonProperty.CalculatedTaxTypeWise=_vgClassSessionSelection.GetTaxesForService(CalendarConfiguration.CommonDetails.BusinessTaxes,n)}if(_vgClassSessionSelection.commonProperty.tax=r,_vgClassSessionSelection.commonProperty.sessiondetail=e.eventDetail.sessionDetail,_vgClassSessionSelection.commonProperty.pointRedeem=e.eventAvailableDates[0].pointRedeem,_vgClassSessionSelection.model.IsSearchFromInHouseClass&&(_vgCal.ManageAtnd.btnAtNext_click(),"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase())){$("#txtSessionFrequency").attr("disabled","disabled"),$("#divSessionFrequencyActive a").css("pointer-events","none"),$("#classSelectionRepeat a").addClass("disabled"),$("#classSelectionRepeat a").css("pointer-events","none"),$("#rptDayClassSession a").addClass("disabled"),$("#rptDayClassSession a").css("pointer-events","none"),$("#txtSessionWksFrequency").attr("disabled","disabled"),$("#divSessionWksFrequencyActive a").css("pointer-events","none"),$("#txtsessionEndDate").attr("disabled","disabled");var s=$("#"+_vgCal.ManageAtnd.model.btnAddAtnd),d=$("#"+_vgCal.ManageAtnd.model.btnAddAtndCheckOut);s.val("Reschedule Attendee"),"undefined"!=typeof isReschedulePaidAppt&&isReschedulePaidAppt&&(txtDepositCls.value=0,$("#ddAppDepositCls").hide(),void 0!==_vgClassSessionSelection.commonProperty.DepositPaid&&null!=_vgClassSessionSelection.commonProperty.DepositPaid&&_vgClassSessionSelection.commonProperty.DepositPaid>0?($("#lblDepositDueEdit").text(CurrencySymbol+" "+InHouseDeposit.ConvertDecimalWithFixed(_vgClassSessionSelection.commonProperty.DepositPaid,!0,2)),void 0!==_vgClassSessionSelection.commonProperty.DepositsPaidDate&&null!=_vgClassSessionSelection.commonProperty.DepositsPaidDate&&""!=_vgClassSessionSelection.commonProperty.DepositsPaidDate&&$("#lblDepositPaidDate").text("Deposit paid on "+moment(new Date(_vgClassSessionSelection.commonProperty.DepositsPaidDate)).format("MMM DD, YYYY")+"."),$("#ddAppDepositEdit").show()):$("#ddAppDepositEdit").hide(),s.css("display","inline-block")),(0==_vgCal.ManageAtnd.model.IsAskForDeposit||"undefined"!=typeof isReschedulePaidAppt&&isReschedulePaidAppt)&&d.hide()}}else _vgCal.Common.ShowMsg("Something went wrong."),_vgClassSessionSelection.commonProperty.enableSessionDate=[],_vgClassSessionSelection.commonProperty.availabledates=null,_vgClassSessionSelection.commonProperty.tax=0,_vgClassSessionSelection.commonProperty.sessiondetail=null,_vgClassSessionSelection.commonProperty.workShopSellPrice=0,_vgClassSessionSelection.commonProperty.workShopNoofSessions=0},function(e){_vgCal.Common.ShowMsg("Something went wrong.")},!1,!0)},IsValidForOffline:function(){var e=!0;if(_vgClassSessionSelection.commonProperty.isWaitlist&&this.commonProperty.availabledates.eventAvailableDates[0].streamingEventCapacity>0&&0==this.commonProperty.availabledates.eventAvailableDates[0].eventCapacity){var t="Waitlist not available for online streaming.";_vgCal.Common.ShowMsg(t),e=!1}var i=getdatepickervalue(_EndtextsessionDatePickerID,null,!0,null,!0);null!=i&&""!=i||($("#divsessionEndDate").addClass("errorInput"),e=!1);var a=this.GetRecurringType(),r=[];if("2"==a){if($("#rptDayClassSession").find("a").each(function(e,t){$(this).hasClass("active")&&r.push(parseInt($(this).attr("data-dayid")))}),0==r.length){t="Please select at least one day.";_vgClassSessionSelection.model.IsSearchFromInHouseClass?vagaro.alertsmall(t):_vgCal.Common.ShowMsg(t),e=!1}if(r.length>0){var o=this.GetNoOfSessions();r.length>o&&(this.commonMessageAlert(this.model.strSessionCountmsg,1),e=!1)}if(""==$("#txtSessionWksFrequency").val()){t="Please enter Weekly Frequency";_vgCal.Common.ShowMsg(t),e=!1}}return e},ResetOffline:function(){$("#txtSessionFrequency").val("1"),$("#txtSessionWksFrequency").val("1"),$("#txtSessionClassMntDate").val("1"),$("#rptDayClassSession").find("a").each(function(e,t){$(this).hasClass("active")&&$(this).removeClass("active")}),$("#rptAtSun").attr("data-disable","1").addClass("disabled"),$("#rptAtMon").attr("data-disable","1").addClass("disabled"),$("#rptAtTue").attr("data-disable","1").addClass("disabled"),$("#rptAtWed").attr("data-disable","1").addClass("disabled"),$("#rptAtThu").attr("data-disable","1").addClass("disabled"),$("#rptAtFri").attr("data-disable","1").addClass("disabled"),$("#rptAtSat").attr("data-disable","1").addClass("disabled"),$("#classSelectionRepeat").find("a").each(function(e,t){$(this).hasClass("active")&&$(this).removeClass("active")}),$("#classSelectionRepeat").find("a").eq(0).addClass("active"),this.HideShowWeekOrMonth(),$("#divsessionEndDate").removeClass(_vgCal.SPopup.errorClass),o.splice(0,o.length)},txtAtStartDt_OnDayRenderOffline:function(e,t){var i=new Date(t.get_date()[0],t.get_date()[1]-1,t.get_date()[2]),a=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates;0==$.grep(a,function(e){return e.strEventDate==i.format("yyyy-MM-dd")}).length&&(t.get_cell().innerHTML="<div style='color:#999; margin-right:4px;'>"+i.getDate()+"</div>",t.get_cell().className="rcOtherMonth",t.get_cell().DayId="")},txtAtStartDt_popupOpeningOffline:function(e,t){},CalcAndDisplayPriceOffline:function(){if(null!=this.commonProperty.sessiondetail&&void 0!==this.commonProperty.sessiondetail){var e=0;e=null!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length>0?(_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop,this.CalcSessionPrice(this.commonProperty.sessiondetail,this.GetNoOfSessions(),this.GetNoOfAttendees(),!0,this.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream)):this.CalcSessionPrice(this.commonProperty.sessiondetail,this.GetNoOfSessions(),this.GetNoOfAttendees(),!0,this.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream);var t=parseFloat(e)+parseFloat(0);_vgCal.ManageAtnd.SetSessionPriceData(e,0,t.toFixed(2)),_vgClassSessionSelection.model.IsSearchFromInHouseClass&&_vgClassSessionSelection.CalcAndDisplayPriceClassLocation(),0==_vgClassSessionSelection.commonProperty.IsPaid&&_vgCal.ManageAtnd.setDepositeTextCls(_vgCal.Common.DepositOpType.AddEdit)}},SetCustomerInfoOffline:function(e,t,i){this.commonProperty.FullUserName=e,this.commonProperty.UserEmail=t,this.commonProperty.UserID=i},SaveAttendeeOffline:function(){if(1==_vgCal.ManageAtnd.objAtList.length&&txtDepositCls.value>0&&1!=txtDepositCls.disabled){InHouseDeposit.ShowhideCommonLoadingPanel(!0);var e=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);InHouseDeposit.ShowInHouseDepositPopup(e,InHouseDeposit.AppClassType.ClassFormCalendar,!0)}else this.validateClassDataOnAddAttendee(_vgCal.Common.model.logInUId,3,"Calendar")},StringToDate:function(e,t){var i=e.split(t);return new Date(parseInt(i[0],10),parseInt(i[1],10)-1,parseInt(i[2],10))},CalcSessionPrice:function(e,t,i,a,r,o){var n=0,s=0;null!=typeof r&&""!=r&&null!=r||(r=!1);var l,d=e.split(",");if("true"==_vgClassSessionSelection.commonProperty.isWorkShop){for(var c=0;c<=d.length-1&&parseInt(t)<=parseInt(d[c].split("-")[1]);c++)n=parseInt(d[c].split("-")[1]),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing||"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value&&1!=o?(s=d[c].split("-").length>4?1==r?parseFloat(d[c].split("-")[5]):parseFloat(d[c].split("-")[4]):1==r?parseFloat(d[c].split("-")[3]):parseFloat(d[c].split("-")[2]),s=_vgClassSessionSelection.ConvertTodecimal(s,2,!1)):s=1==r?parseFloat(d[c].split("-")[3]):parseFloat(d[c].split("-")[2]);"undefined"!=typeof _vgAddon&&("undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?_vgAddon.Model.ClassPrice=_vgClassSessionSelection.CalculateSessionPriceAddOn(t,d,r):_vgAddon.Model.ClassPrice=s),l=parseInt(t)*s/n*parseInt(i)}else{for(c=0;c<=d.length-1&&parseInt(t)>=parseInt(d[c].split("-")[1]);c++)n=parseInt(d[c].split("-")[1]),s=(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing||"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value&&1!=o)&&d[c].split("-").length>4?1==r?parseFloat(d[c].split("-")[5]):parseFloat(d[c].split("-")[4]):1==r?parseFloat(d[c].split("-")[3]):parseFloat(d[c].split("-")[2]),s=_vgClassSessionSelection.ConvertTodecimal(s,2,!1);"undefined"!=typeof _vgAddon&&("undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?_vgAddon.Model.ClassPrice=_vgClassSessionSelection.CalculateSessionPriceAddOn(t,d,r):_vgAddon.Model.ClassPrice=s),l=parseInt(t)*s/n*parseInt(i)}return 0==a?l:_vgClassSessionSelection.ConvertTodecimal(l,2,!1)},CalculateSessionPriceAddOn:function(e,t,i){var a=0;if(void 0!==t&&null!=t&&t.length>0)for(var r=0;r<=t.length-1&&parseInt(e)>=parseInt(t[r].split("-")[1]);r++)a=t[r].split("-").length>4?1==i?parseFloat(t[r].split("-")[5]):parseFloat(t[r].split("-")[4]):1==i?parseFloat(t[r].split("-")[3]):parseFloat(t[r].split("-")[2]);return a},CalcSessionPriceForOnlineWorkShop:function(e){for(var t=0,i=0;i<=e.length-1;i++)t+=e[i].workShopIndividualPrice;return _vgClassSessionSelection.ConvertTodecimal(t,2,!1)},CalcSessionPriceForWorkShop:function(e,t,i,a){var r=e*parseInt(i);return"undefined"!=typeof _vgAddon&&(_vgAddon.Model.ClassPrice=parseFloat(e).toFixed(2)),0==a?r:_vgClassSessionSelection.ConvertTodecimal(r,2,!1)},ConvertTodecimal:function(e,t,i){return 1==i?parseFloat(Number(Math.round(e+"e"+t)+"e-"+t).toFixed(t)):Number(Math.round(e+"e"+t)+"e-"+t).toFixed(t)},GetDepositPercentage:function(e){var t=0,i=[];if($.grep(_vgCal.ManageAtnd.objAtList,function(t){t.Id==e&&1==t.IsAllowDeposit&&i.push(t)}),i.length>=1)if(_vgCal.ManageAtnd.model.IsClsDepositAmtType)if("undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value){var a=0,r=CalendarConfiguration.CommonDetails.BusinessTaxes;if(null!=r&&r.length>0&&!String.isNullOrUndefineOrBlank(_vgCal.ManageAtnd.model.Taxation)){var o=_vgCal.ManageAtnd.model.Taxation.split(",");if(null!=o&&o.length>0)for(var n=0;n<o.length;n++)for(var s=0;s<r.length;s++)r[s].BusinessTaxID==parseInt(o[n])&&(a+=r[s].Tax)}if(a>0){var l=_vgClassSessionSelection.ConvertTodecimal(_vgClassSessionSelection.ConvertTodecimal(_vgCal.ManageAtnd.objAtList[0].Price.replace('"',"").replace("$","").replace("£",""),2,!1)/(1+a/100),2,!1);t=_vgClassSessionSelection.ConvertTodecimal(100*_vgCal.ManageAtnd.model.ClsDepositsPercentage/l,2,!1)}else t=_vgClassSessionSelection.ConvertTodecimal(100*_vgCal.ManageAtnd.model.ClsDepositsPercentage/_vgClassSessionSelection.ConvertTodecimal(_vgCal.ManageAtnd.objAtList[0].Price.replace('"',"").replace("$","").replace("£",""),2,!1),2,!1)}else t=_vgClassSessionSelection.ConvertTodecimal(100*_vgCal.ManageAtnd.model.ClsDepositsPercentage/_vgClassSessionSelection.ConvertTodecimal(_vgCal.ManageAtnd.objAtList[0].Price.replace('"',"").replace("$","").replace("£",""),2,!1),2,!1);else t=_vgCal.ManageAtnd.model.ClsDepositsPercentage;return t},validateClassDataOnAddAttendee:function(e,t,i,a){var r=this.commonProperty.businessID,o=0,n=[];this.model.IsOnline?(o=_shopdetail.countryId,r=parseInt(_vgClassSessionSelection.GetCommonBusinessID()),n=_vgClassSessionSelection.GetCartUserDetail()):o=_vgCal.Common.model.BusinessCountryId;var s=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),l=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.FeeStorage),d="";if(l.length>0){var c=$("<XMLDocument/>");c.append(_vgClassSessionSelection.createXmlElement("FeeXMLList")),$.each(l,function(e,t){var i=_vgClassSessionSelection.createXmlElement("FeeXMLData");if(i.append(_vgClassSessionSelection.createXmlElement("appointmentId",t.appointmentId)),i.append(_vgClassSessionSelection.createXmlElement("serviceProviderId",t.serviceProviderId)),i.append(_vgClassSessionSelection.createXmlElement("userid",t.userid)),i.append(_vgClassSessionSelection.createXmlElement("price",t.price)),i.append(_vgClassSessionSelection.createXmlElement("tax",t.tax)),i.append(_vgClassSessionSelection.createXmlElement("itemId",t.itemId)),i.append(_vgClassSessionSelection.createXmlElement("discountGCPrice",t.discountGCPrice)),i.append(_vgClassSessionSelection.createXmlElement("ispointapply",t.ispointapply)),i.append(_vgClassSessionSelection.createXmlElement("pointsredeem",t.pointsredeem)),i.append(_vgClassSessionSelection.createXmlElement("ismembershipapply",t.ismembershipapply)),i.append(_vgClassSessionSelection.createXmlElement("membershipdiscountprice",t.membershipdiscountprice)),i.append(_vgClassSessionSelection.createXmlElement("membershipRedeemedDetails",t.membershipRedeemedDetails)),i.append(_vgClassSessionSelection.createXmlElement("isWorkShop",t.isWorkShop)),i.append(_vgClassSessionSelection.createXmlElement("redeemServiceId",t.redeemServiceId)),i.append(_vgClassSessionSelection.createXmlElement("ispresetapply",t.ispresetapply)),i.append(_vgClassSessionSelection.createXmlElement("presetDiscount",t.presetDiscount)),i.append(_vgClassSessionSelection.createXmlElement("discountID",t.discountID)),i.append(_vgClassSessionSelection.createXmlElement("amountValue",t.amountValue)),i.append(_vgClassSessionSelection.createXmlElement("isAmount",t.isAmount)),i.append(_vgClassSessionSelection.createXmlElement("promotionID",t.promotionID)),i.append(_vgClassSessionSelection.createXmlElement("isNewCustomer",t.isNewCustomer)),i.append(_vgClassSessionSelection.createXmlElement("paidtype",t.paidtype)),i.append(_vgClassSessionSelection.createXmlElement("payableamount",t.payableamount)),i.append(_vgClassSessionSelection.createXmlElement("depositspaid",t.depositspaid)),i.append(_vgClassSessionSelection.createXmlElement("depositsremaining",t.depositsremaining)),i.append(_vgClassSessionSelection.createXmlElement("depositspercentage",t.depositspercentage)),i.append(_vgClassSessionSelection.createXmlElement("redeemAmount",t.redeemAmount)),i.append(_vgClassSessionSelection.createXmlElement("redeemTax",t.redeemTax)),i.append(_vgClassSessionSelection.createXmlElement("taxes",t.taxes)),i.append(_vgClassSessionSelection.createXmlElement("calculatedtaxtypewise",void 0!==t.calculatedtaxtypewise&&null!=t.calculatedtaxtypewise&&""!=t.calculatedtaxtypewise&&"null"!=t.calculatedtaxtypewise?t.calculatedtaxtypewise:"[]")),i.append(_vgClassSessionSelection.createXmlElement("itemName",t.itemName)),i.append(_vgClassSessionSelection.createXmlElement("quantity",t.quantity)),i.append(_vgClassSessionSelection.createXmlElement("eventType",t.eventType)),i.append(_vgClassSessionSelection.createXmlElement("AmountType",t.AmountType)),i.append(_vgClassSessionSelection.createXmlElement("discount",t.discount)),1==t.isPriceBaseGCApply){var a=[],r=[];1==t.isPriceBaseGCApply?i.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!0)):i.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!1)),1==t.isPriceBaseGCApply&&$.each(t.GCDetailPriceBase,function(e,t){a.push(t.GCId),r.push(t.GCAmount)}),i.append(_vgClassSessionSelection.createXmlElement("gcid",void 0===t.gcId||null==t.gcId?0:t.gcId)),i.append(_vgClassSessionSelection.createXmlElement("gcids",0==a.length?0:a.join(","))),i.append(_vgClassSessionSelection.createXmlElement("gcamount",0==r.length?0:r.join(",")))}c.find("FeeXMLList").append(i)}),d=c.html()}if("undefined"!=typeof InHouseDeposit&&null!=InHouseDeposit&&void 0!==s&&null!=s&&""!=s&&s.length>0&&(InHouseDeposit.model.ObjGlobalChangeStatus=s[0].eventEnrollment),1==this.model.IsOnline&&s.length<=0)return $("#lblEventCart").html("0"),void _vgClassSessionSelection.commonMessageAlert("Something went wrong. Please search again.");var u=0,p=0;if("undefined"!=typeof InHouseDeposit&&null!=InHouseDeposit&&InHouseDeposit.model.Tip>0){var h=0;$.grep(s,function(e){$.grep(e.eventEnrollment,function(e){e.paidType==InHouseDeposit.arrpaidType.PaidClass&&(u+=1,h=1==e.isPackage||1==e.isPointApply?InHouseDeposit.ConvertDecimalWithFixed(h+e.Originalprice,!1,2):InHouseDeposit.ConvertDecimalWithFixed(h+e.Price,!1,2))})}),h>0&&0==InHouseDeposit.model.TipPer&&(InHouseDeposit.model.TipPer=InHouseDeposit.ConvertDecimalWithFixed(100*InHouseDeposit.model.Tip/h,!1,2))}var m=0,f=0,g=$("<XMLDocument/>"),v="",A="";g.append(_vgClassSessionSelection.createXmlElement("EventList"));var C=null,y=!1;_vgClassSessionSelection.model.IsSearchFromInHouseClass||(isFromRebook=!1),$.each(s,function(e,i){var a=_vgClassSessionSelection.createXmlElement("event");a.append(_vgClassSessionSelection.createXmlElement("eventId",i.eventID)),a.append(_vgClassSessionSelection.createXmlElement("eventname",i.eventName)),a.append(_vgClassSessionSelection.createXmlElement("eventimage",i.smallimage)),$.each(i.eventEnrollment,function(e,r){if(null==(C=null)||null==C){C=_vgClassSessionSelection.createXmlElement("appointment");var o=!1;if(o=void 0===r.isHandleDuetoException?_vgClassSessionSelection.IsHandledExceptionOffline(r.appointmentID):r.isHandleDuetoException,C.append(_vgClassSessionSelection.createXmlElement("isHandleDuetoException",1==o?"1":"0")),C.append(_vgClassSessionSelection.createXmlElement("appId",r.appointmentID)),C.append(_vgClassSessionSelection.createXmlElement("spid",r.sPID)),C.append(_vgClassSessionSelection.createXmlElement("appstarttime",new Date(r.eventDate).format("yyyy-MM-dd")+" "+r.startTime)),5!=t&&null!=txtDepositCls&&null!=txtDepositCls&&""!=txtDepositCls&&null!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls&&null!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls&&""!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls)if(0!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls&&0!=txtDepositCls.value)if("undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value&&_vgCal.ManageAtnd.objAtList.length<=1){if(void 0!==InHouseDeposit.model.AppObj[0].eventEnrollment&&null!=InHouseDeposit.model.AppObj[0].eventEnrollment&&InHouseDeposit.model.AppObj[0].eventEnrollment.length>0){var s,l=0;$.grep(InHouseDeposit.model.AppObj[0].eventEnrollment,function(e,t){if(e.depositsPercentage<100){l+=e.Price;var i=parseFloat(InHouseDeposit.ConvertDecimalWithFixed(100*parseFloat(e.depositsPaid)/e.Price,!0,2));if(e.depositsPercentage=i,e.lstAddonService.length>0)for(var a=0;a<e.lstAddonService.length;a++)l+=e.lstAddonService[a].Price,e.lstAddonService[a].depositsPercentage<100&&(e.lstAddonService[a].depositsPercentage=parseFloat(InHouseDeposit.ConvertDecimalWithFixed(100*parseFloat(e.lstAddonService[a].depositsPaid)/e.lstAddonService[a].Price,!0,2)))}}),1*(s=100*txtDepositCls.value/l)>100&&(s=100),C.append(_vgClassSessionSelection.createXmlElement("DepositsPercentage",s))}}else if(_vgCal.ManageAtnd.objAtList.length>1)C.append(_vgClassSessionSelection.createXmlElement("DepositsPercentage",_vgClassSessionSelection.GetDepositPercentage(r.customerID)));else 1*(s=100*txtDepositCls.value/_vgCal.ManageAtnd.model.NewApp_txtPriceCls)>100&&(s=100),C.append(_vgClassSessionSelection.createXmlElement("DepositsPercentage",s));if(100==r.depositsPercentage){if("undefined"!=r.CalculatedTaxTypeWise&&null!=r.CalculatedTaxTypeWise&&r.CalculatedTaxTypeWise.length>0){C.append(_vgClassSessionSelection.createXmlElement("calculatedtaxtypewise",JSON.stringify(r.CalculatedTaxTypeWise)));var d=$.map(r.CalculatedTaxTypeWise,function(e){return e.BusinessTaxID}).join();C.append(_vgClassSessionSelection.createXmlElement("taxes",d))}}else if("undefined"!=typeof hdnPriceWithTaxSwitch&&null!=hdnPriceWithTaxSwitch&&null!=hdnPriceWithTaxSwitch&&!String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)&&"1"==hdnPriceWithTaxSwitch.value&&"undefined"!=r.CalculatedTaxTypeWise&&null!=r.CalculatedTaxTypeWise&&r.CalculatedTaxTypeWise.length>0){C.append(_vgClassSessionSelection.createXmlElement("calculatedtaxtypewise",JSON.stringify(r.CalculatedTaxTypeWise)));d=$.map(r.CalculatedTaxTypeWise,function(e){return e.BusinessTaxID}).join()}a.append(C)}else C=C.parent();if(C.append(_vgClassSessionSelection.createXmlElement("fname",r.cFirstName)),C.append(_vgClassSessionSelection.createXmlElement("lname",r.cLastName)),C.append(_vgClassSessionSelection.createXmlElement("email",r.cUserEmail)),C.append(_vgClassSessionSelection.createXmlElement("cellno",r.cUserCellNo)),C.append(_vgClassSessionSelection.createXmlElement("cellcountryid",r.cCellcountryID)),C.append(_vgClassSessionSelection.createXmlElement("dialingCode",r.cDialingCode)),C.append(_vgClassSessionSelection.createXmlElement("isWorkShop",r.IsWorkShop)),C.append(_vgClassSessionSelection.createXmlElement("streamingstatus",r.StreamingStatus)),v=r.cUserEmail,A=r.cFirstName+r.cLastName,1==_vgClassSessionSelection.model.IsOnline){if(0==r.customerID)null!=(k=$.grep(n,function(e){return 0==r.customerID&&e.emailId==r.cUserEmail}))&&k.length>0?C.append(_vgClassSessionSelection.createXmlElement("userid",k[0].userId)):C.append(_vgClassSessionSelection.createXmlElement("userid",r.customerID));else C.append(_vgClassSessionSelection.createXmlElement("userid",r.customerID));1==t&&(1==r.isPackage||0==r.isPackage)&&r.gcId>0&&(C.append(_vgClassSessionSelection.createXmlElement("ispackage",r.isPackage)),C.append(_vgClassSessionSelection.createXmlElement("gcid",r.gcId)))}else C.append(_vgClassSessionSelection.createXmlElement("userid",r.customerID));if(p=r.customerID,5==t){if(C.append(_vgClassSessionSelection.createXmlElement("paidtype",r.paidType)),r.paidType!=InHouseDeposit.arrpaidType.DepositsClass&&r.paidType!=InHouseDeposit.arrpaidType.PartiallyPaidClass||void 0!==r.depositsPaid&&(C.append(_vgClassSessionSelection.createXmlElement("depositspercentage",r.depositsPercentage)),C.append(_vgClassSessionSelection.createXmlElement("depositspaid",r.depositsPaid)),C.append(_vgClassSessionSelection.createXmlElement("payableamount",r.Price)),C.append(_vgClassSessionSelection.createXmlElement("depositsremaining",_vgClassSessionSelection.ConvertTodecimal(r.Price-r.depositsPaid,2,!1)))),InHouseDeposit.model.TipPer>0&&r.paidType==InHouseDeposit.arrpaidType.PaidClass){var c=InHouseDeposit.ConvertDecimalWithFixed(r.Price,!1,2);1!=r.isPackage&&1!=r.isPointApply||(c=InHouseDeposit.ConvertDecimalWithFixed(r.Originalprice,!1,2));var h=0;h=(f+=1)==u?InHouseDeposit.ConvertDecimalWithFixed(InHouseDeposit.model.Tip-m,!1,2):InHouseDeposit.ConvertDecimalWithFixed(c*InHouseDeposit.model.TipPer/100,!1,2),C.append(_vgClassSessionSelection.createXmlElement("tipAmount",h)),m+=h}if(C.append(_vgClassSessionSelection.createXmlElement("promotionid",0)),(1==r.isPackage||0==r.isPackage)&&r.gcId>0||1==r.isPriceBaseGCApply){var g=[],b=[];1==r.isPriceBaseGCApply?C.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!0)):C.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!1)),C.append(_vgClassSessionSelection.createXmlElement("ispackage",r.isPackage)),1==r.isPriceBaseGCApply&&$.each(r.GCDetailPriceBase,function(e,t){g.push(t.GCId),b.push(t.GCAmount)}),C.append(_vgClassSessionSelection.createXmlElement("gcid",void 0===r.gcId||null==r.gcId?0:r.gcId)),C.append(_vgClassSessionSelection.createXmlElement("gcids",0==g.length?0:g.join(","))),C.append(_vgClassSessionSelection.createXmlElement("gcamount",0==b.length?0:b.join(","))),r.RedeemServiceId>0&&C.append(_vgClassSessionSelection.createXmlElement("redeemserviceid",r.RedeemServiceId))}if(1==r.isPointApply){var S=0;1==r.IsPartialPointApply&&(S=r.PartialServicePrice),C.append(_vgClassSessionSelection.createXmlElement("ispointapply",r.isPointApply)),C.append(_vgClassSessionSelection.createXmlElement("ispartialpointapply",r.IsPartialPointApply)),C.append(_vgClassSessionSelection.createXmlElement("partialserviceprice",S)),C.append(_vgClassSessionSelection.createXmlElement("pointsredeem",r.pointsRedeem))}if(1==r.isMembershipApply&&null!=r.membershipUniqueID&&null!=r.membershipUniqueID&&""!=r.membershipUniqueID){C.append(_vgClassSessionSelection.createXmlElement("ismembershipapply",r.isMembershipApply)),C.append(_vgClassSessionSelection.createXmlElement("membershipdiscountpercentage",r.membershipDiscount)),C.append(_vgClassSessionSelection.createXmlElement("membershipuserid",r.membershipuserid)),C.append(_vgClassSessionSelection.createXmlElement("membershipuniqueid",r.membershipUniqueID));var k,D=null;if((D=_vgClassSessionSelection.createXmlElement("membershipredeemeddetails")).append(_vgClassSessionSelection.createXmlElement("businessid",r.BusinessID)),D.append(_vgClassSessionSelection.createXmlElement("redeembusinessid",r.RedeemBusinessId)),0==r.customerID)null!=(k=$.grep(n,function(e){return 0==r.customerID&&e.emailId==r.cUserEmail}))&&k.length>0?D.append(_vgClassSessionSelection.createXmlElement("userid",k[0].userId)):D.append(_vgClassSessionSelection.createXmlElement("userid",r.customerID));else D.append(_vgClassSessionSelection.createXmlElement("userid",r.customerID));D.append(_vgClassSessionSelection.createXmlElement("membershipuserid",r.membershipuserid)),D.append(_vgClassSessionSelection.createXmlElement("membershipid",r.MembershipID)),D.append(_vgClassSessionSelection.createXmlElement("membershipitemid",r.MembershipItemId)),D.append(_vgClassSessionSelection.createXmlElement("groupid",r.GroupId)),D.append(_vgClassSessionSelection.createXmlElement("isunlimitedvisit",-1==r.VisitRemaining)),D.append(_vgClassSessionSelection.createXmlElement("serviceproductname",i.eventName.trim())),C.append(D)}_vgCal.ManageAtnd.model.IsCheckout=!1}if(C.append(_vgClassSessionSelection.createXmlElement("userclassdetail",$("#p-cart-"+r.eventID+"-"+r.autoID).text())),_vgClassSessionSelection.model.IsOnline||"undefined"!=typeof isFromReschedual&&null!=isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&_vgClassSessionSelection.model.IsSearchFromInHouseClass){var _=_vgClassSessionSelection.GetRescheduleDetail();null!=_&&(y=!0,C.append(_vgClassSessionSelection.createXmlElement("eventsessionattendeeid",_.EventSessionAttendeesId)))}C.append(_vgClassSessionSelection.createXmlElement("isAddon",!1)),C.append(_vgClassSessionSelection.createXmlElement("uniqueAddonID","addon"+r.appointmentID+r.autoID)),null!=r.lstAddonService&&r.lstAddonService.length>0&&_vgClassSessionSelection.CreateClassAttendeeAddonXMl(r.lstAddonService,r,a,t)}),g.find("EventList").append(a)});this.EventShowLoader(!0);var b="",S={},k={};if(k.businessId=r,k.loggedInUserId=e,k.countryId=o,k.classXmlData=g.html().replace(new RegExp("&nbsp;","g")," "),k.FeeXMLData=d,k.operationType=t,k.device=i,"undefined"!=typeof isFromCheckout&&isFromCheckout&&(k.device="Checkout"),k.isCardOnFile=!1,k.isReschedule=y,k.IsRebook=isFromRebook,"undefined"!=typeof SearchIsWaitingtoReal&&"true"==SearchIsWaitingtoReal.toLowerCase()&&_vgClassSessionSelection.model.IsSearchFromInHouseClass&&(k.IsWaitingtoReal="true"==SearchIsWaitingtoReal.toLowerCase(),k.WaitlistID=SearchWaitlistID),k.TrackingId=void 0!==a?a:"",this.model.IsOnline){k.userFullName=FullUserName,k.userEmail=UserEmail,k.currencySymbol=_vgClassSessionSelection.GetcurrencySymbol();var D="",_="",I="",w="",P="",T="",B="";if(1==_shopdetail.IsCCDetailEnable()){if("block"==$(".divcreditCardWrapper").css("display").toLowerCase()&&0==isCCChanged){k.isCardOnFile=!0;var x=$("#txEventCCNo");D=$("#cboEventCardType").val(),_=$(x).val(),I=$("#txtEventSecurityCode").val(),w=$("#txtEventFName").val(),P=$("#txtEventMName").val(),T=$("#txtEventLName").val(),B=$("#hdnCCTokenID").val()}else 1==isCCChanged&&null!=ZenSwipeCardDetails.cc_no&&(D=ZenSwipeCardDetails.cc_type,_=ZenSwipeCardDetails.cc_no,I=ZenSwipeCardDetails.cvv,w=ZenSwipeCardDetails.first_name,P=ZenSwipeCardDetails.middle_name,T=ZenSwipeCardDetails.last_name,B=ZenSwipeCardDetails.card_token);b="<root>",b+="<UserCCDetail><UCCType>"+D+"</UCCType>",b+="<UCCNo>"+_.substr(_.length-4)+"</UCCNo>",b+="<UCCSecurityCode>"+I+"</UCCSecurityCode>",b+="<UCCFirstName>"+w.escapeHtml()+"</UCCFirstName>",b+="<UCCMiddleName>"+P.escapeHtml()+"</UCCMiddleName>",b+="<UCCLastName>"+T.escapeHtml()+"</UCCLastName>",b+="<UCCTokenID>"+B+"</UCCTokenID>",b+="</UserCCDetail></root>",S.UCCNo=_,S.UCCType=D,S.UCCSecurityCode=I,S.UCCFirstName=w,S.UCCMiddleName=P,S.UCCLastName=T,S.CardTokenId=B}k.objUserCCDetails=S,k.strUserCCXML=b,k.bookText=$("#hdnClassBookText").val();var F=_vgClassSessionSelection.GetRescheduleDetail();1==y&&null!=F&&(k.OldSPID=F.providerID,k.OldAppDate=$("#hdnDate").val()+" "+BookingTime)}else{k.currencyCode=_vgClassSessionSelection.GetCurrencyCode();var O=0;if(5==t){O=1,k.userFullName=A,k.userEmail=v,k.currencySymbol=CurrencySymbol,k.isCardOnFile=InHouseDeposit.model.IsCCNewApply&&null!=InHouseDeposit.model.zenSwipeCardDetails&&"undefined"!=InHouseDeposit.model.zenSwipeCardDetails.save_card&&InHouseDeposit.model.zenSwipeCardDetails.save_card;D="",_="",I="",w="",P="",T="",B="";var M="",E="";if(InHouseDeposit.model.IsCCApply){var N={},L=0,U=0;InHouseDeposit.model.SelectedCCId.toString().length>=5?(L=InHouseDeposit.model.SelectedCCId.toString().substring(0,4),U=parseInt(InHouseDeposit.model.SelectedCCId.toString().substring(4,5))-1):(L=InHouseDeposit.model.SelectedCCId.toString().substring(0,4),U=0),$.each(InHouseDeposit.model.PopupData.DepositPaymentOption.lstUserCCDetailsWithFF,function(e,t){InHouseDeposit.model.PopupData.DepositPaymentOption.lstUserCCDetailsWithFF[e].CreditCardNumber==parseInt(L)&&e==U&&(N=InHouseDeposit.model.PopupData.DepositPaymentOption.lstUserCCDetailsWithFF[e])}),D=N.CreditCardType,_=N.CreditCardNumber,I=N.SecurityCode,w=null==N.CCFirstName?"":N.CCFirstName,P=null==N.CCMiddleName?"":N.CCMiddleName,T=null==N.CCLastName?"":N.CCLastName,B=N.CardTokenId,b="<root>",b+="<UserCCDetail><UCCType>"+D+"</UCCType>",b+="<UCCNo>"+_.substr(_.length-4)+"</UCCNo>",b+="<UCCSecurityCode>"+I+"</UCCSecurityCode>",b+="<UCCFirstName>"+w.escapeHtml()+"</UCCFirstName>",b+="<UCCMiddleName>"+P.escapeHtml()+"</UCCMiddleName>",b+="<UCCLastName>"+T.escapeHtml()+"</UCCLastName>",b+="<UCCTokenID>"+B+"</UCCTokenID>",b+="</UserCCDetail></root>",S.UCCNo=_,S.UCCType=D,S.UCCSecurityCode=I,S.UCCFirstName=w,S.UCCMiddleName=P,S.UCCLastName=T,S.CardTokenId=B}else if(InHouseDeposit.model.IsCCNewApply){D=(N=InHouseDeposit.model.zenSwipeCardDetails).cc_type,_=N.cc_no,I=N.cvv,w=null==N.first_name?"":N.first_name,P=null==N.middle_name?"":N.middle_name,T=null==N.last_name?"":N.last_name,M=null==N.expire_month?"":N.expire_month,E=null==N.expire_year?"":N.expire_year,B=N.card_token,b="<root>",b+="<UserCCDetail><UCCType>"+D+"</UCCType>",b+="<UCCNo>"+_.substr(_.length-4)+"</UCCNo>",b+="<UCCSecurityCode>"+I+"</UCCSecurityCode>",b+="<UCCExpMonth>"+M+"</UCCExpMonth>",b+="<UCCExpYear>"+E+"</UCCExpYear>",b+="<UCCFirstName>"+w.escapeHtml()+"</UCCFirstName>",b+="<UCCMiddleName>"+P.escapeHtml()+"</UCCMiddleName>",b+="<UCCLastName>"+T.escapeHtml()+"</UCCLastName>",b+="<UCCTokenID>"+B+"</UCCTokenID>",b+="</UserCCDetail></root>",S.UCCNo=_,S.UCCType=D,S.UCCSecurityCode=I,S.UCCExpMonth=M,S.UCCExpYear=E,S.UCCFirstName=w,S.UCCMiddleName=P,S.UCCLastName=T,S.CardTokenId=B,S.UserID=p}k.objUserCCDetails=S,k.strUserCCXML=b}else k.objUserCCDetails=S,k.strUserCCXML=b;if("undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&_vgClassSessionSelection.model.IsSearchFromInHouseClass){F=_vgClassSessionSelection.GetRescheduleDetail();1==y&&null!=F&&(k.OldSPID=F.providerID,k.OldAppDate=$("#hdnDate").val()+" "+BookingTime)}"undefined"==typeof InHouseDeposit||null==InHouseDeposit||void 0===InHouseDeposit.model.SelectpaymentMethodType||InHouseDeposit.model.SelectpaymentMethodType!=InHouseDeposit.paymentMethodType.Checkout&&InHouseDeposit.model.SelectpaymentMethodType!=InHouseDeposit.paymentMethodType.Invoice||(O=2),"undefined"!=typeof InHouseDeposit&&null!=InHouseDeposit&&void 0!==InHouseDeposit.model.ClassMultiAttendeeCheckoutType&&InHouseDeposit.model.ClassMultiAttendeeCheckoutType==InHouseDeposit.ClassMultiAttendeeCheckoutType.IndividualCheckout&&(O=3),k.DepositType=O}0==this.model.IsOnline?(_vgClassSessionSelection.model.ClassFullExceptionData=null,this.IsClassBookingFullOffline(k,function(e){if(null!=e){var t=$.grep(e,function(e,t){return 1==e.isFull});t.length>0?(_vgClassSessionSelection.model.ClassFullExceptionData=t,_vgClassSessionSelection.ShowClassFullMsgOffline(t)):(_vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.validateClassData(k,g))}else _vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.validateClassData(k,g)})):this.validateClassData(k,g)},validateClassData:function(e,t){"undefined"!=typeof vui&&(e.StripeRadarSession=vui.stripeRadarSession);var i=new vagaro.ajax;i.datamodel.Token="ValidateClassBookingData",i.datamodel.data=[e],i.datamodel.callback=this.validateClassDataOnAddAttendeeSuccess,i.datamodel.Error=function(e){_vgClassSessionSelection.commonMessageAlert(errorMessage),_vgClassSessionSelection.EventShowLoader(!1)},_vgClassSessionSelection.localData.rootXmlData=t,i.Post()},validateClassDataOnAddAttendeeSuccess:function(e){_vgClassSessionSelection.EventShowLoader(!1);var t="";if(0==_vgClassSessionSelection.model.IsOnline){var i=getdatepickervalue(_EndtextsessionDatePickerID,null,!0,null,!0);""!=i&&(t=i.format("MM/dd/yyyy"))}_vgClassSessionSelection.localData.rootXmlData;_vgClassSessionSelection.localData.rootXmlData="";var a,r=0,o=0;if(null!=e&&void 0!==e[0])if(r=e[0].ClsGrpID,o=e[0].DepositGroupID,1==e[0].type)$.each(e,function(e,t){a=_vgClassSessionSelection.findClassObjByAppId(t.appointmentId),t.className=a.className,t.sessionTime=a.startTime,t.spName=a.sPName,t.eventDate=_vgClassSessionSelection.FormatDate(a.eventDate),t.isVacancyFull=t.vacancy<=0}),$("#tBodyClassValidationTemp").html(""),$("#classValidationCheckoutTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"),_vgClassSessionSelection.model.IsOnline?($("#validationpopup").html($("#divClassValidationTemp").html()),$("#divClassValidationpopup").modal("show")):(_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_vgClassSessionSelection.commonMessageAlert($("#divClassValidationTemp").html()));else if(2==e[0].type)$.each(e,function(e,t){if(a=_vgClassSessionSelection.findClassObjByAppId(t.appointmentId),t.className=a.className,t.sessionTime=a.startTime,t.spName=a.sPName,t.eventDate=_vgClassSessionSelection.FormatDate(a.eventDate),""!=t.userDataXml){var i=t.userDataXml.split(" ")[0],r="";void 0!==t.userDataXml.split(" ")[1]&&(r=t.userDataXml.split(" ")[1]),t.username=""!=r?_vgClassSessionSelection.GetUserShortDetail(i,r):i+"."}else t.username=""}),$("#tBodyClassValidationTemp").html(""),$("#UserAlreadyEnrolledTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"),_vgClassSessionSelection.model.IsOnline?($("#validationpopup").html($("#divClassValidationTemp").html()),$("#divClassValidationpopup").modal("show")):(_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_objMessagePopup.SetWidth(650).Show("Alert",$("#divClassValidationTemp").html(),"OK","","",function(){_objMessagePopup.Hide()},function(){_objMessagePopup.Hide()},null));else if(7==e[0].type)$.each(e,function(e,t){a=_vgClassSessionSelection.findClassObjByAppId(t.appointmentId),t.className=a.className,t.sessionTime=a.startTime,t.spName=a.sPName,t.eventDate=_vgClassSessionSelection.FormatDate(a.eventDate)}),$("#tBodyClassValidationTemp").html(""),$("#ClassDeleteTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"),_vgClassSessionSelection.model.IsOnline?($("#validationpopup").html($("#divClassValidationTemp").html()),$("#divClassValidationpopup").modal("show")):(_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_vgClassSessionSelection.commonMessageAlert($("#divClassValidationTemp").html()));else if(8==e[0].type)_vgClassSessionSelection.commonMessageAlert("Your order is not free of cost. It requires credit card information. Please go back and search again.",2);else if(9!=e[0].type&&10!=e[0].type&&11!=e[0].type&&12!=e[0].type&&13!=e[0].type||1!=_vgClassSessionSelection.model.IsOnline)if(3==e[0].type){if(isCCChanged=!1,0==_vgClassSessionSelection.model.IsOnline){if(_vgCal.ManageAtnd.model.IsCheckout){if("undefined"!=typeof InHouseDeposit&&null!=typeof InHouseDeposit&&void 0!==InHouseDeposit.model.SelectpaymentMethodType&&InHouseDeposit.model.SelectpaymentMethodType>0&&InHouseDeposit.model.SelectpaymentMethodType==InHouseDeposit.paymentMethodType.Invoice)return void InHouseDeposit.SaveClassInvoiceDetails(e[0].lstEventSessionAttendee,o);_vgCal.Common.model.IsNewAPI?ChangeAppStatus.RedirectToCheckout(r,t,o):_vgCal.Common.RedirectToCheckout(r,t)}else _vgCal.Common.model.IsNewAPI?ManageClasses.RetrieveAttendeeData():_vgCal.SPopup.RetrieveAttendeeData(),_vgClassSessionSelection.ShowClassProgressOffline();"undefined"!=typeof InHouseDeposit&&null!=typeof InHouseDeposit&&void 0!==InHouseDeposit.model.SelectpaymentMethodType&&InHouseDeposit.model.SelectpaymentMethodType>0&&InHouseDeposit.model.SelectpaymentMethodType!=InHouseDeposit.paymentMethodType.Checkout?InHouseDeposit.ShowHideSuccessFailedPopup(!0,!0):(_vgCal.ManageAtnd.ShowPopup(!1),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage))}}else if(4==e[0].type)if(0==_vgClassSessionSelection.model.IsOnline){if(_vgCal.ManageAtnd.model.IsCheckout){if("undefined"!=typeof InHouseDeposit&&null!=typeof InHouseDeposit&&void 0!==InHouseDeposit.model.SelectpaymentMethodType&&InHouseDeposit.model.SelectpaymentMethodType>0&&InHouseDeposit.model.SelectpaymentMethodType==InHouseDeposit.paymentMethodType.Invoice)return void InHouseDeposit.SaveClassInvoiceDetails(e[0].lstEventSessionAttendee,o);_vgCal.Common.model.IsNewAPI?ChangeAppStatus.RedirectToCheckout(r,t,o,e[0].lstEventSessionAttendee[0].userId):_vgCal.Common.RedirectToCheckout(r,t)}else _vgClassSessionSelection.model.IsSearchFromInHouseClass||(_vgCal.Common.model.IsNewAPI?ManageClasses.RetrieveAttendeeData():_vgCal.SPopup.RetrieveAttendeeData(),_vgClassSessionSelection.ShowClassProgressOffline());if("undefined"!=typeof InHouseDeposit&&null!=typeof InHouseDeposit&&void 0!==InHouseDeposit.model.SelectpaymentMethodType&&InHouseDeposit.model.SelectpaymentMethodType>0&&InHouseDeposit.model.SelectpaymentMethodType!=InHouseDeposit.paymentMethodType.Checkout)InHouseDeposit.ShowHideSuccessFailedPopup(!0,!0),InHouseDeposit.model.IsChangeStatus=e[0].IsChangeStatus;else if(_vgClassSessionSelection.model.IsSearchFromInHouseClass&&0==_vgCal.ManageAtnd.model.IsCheckout){_vgCal.ManageAtnd.ShowPopup(!1),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage);var n="Class";isWorkShopOrClass&&(n="Workshop");var s=n+_vgClassSessionSelection.model.ClassBookSuccess;_vgClassSessionSelection.IsSearchFromInHouseClass()&&("undefined"!=typeof SearchIsWaitingtoReal&&"true"==SearchIsWaitingtoReal.toLowerCase()?s=_vgClassSessionSelection.model.WaitlistBookSuccess.replace("{0}",n.toLowerCase()):"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&(s=_vgClassSessionSelection.model.RescheduleBookSuccess.replace("{0}",n.toLowerCase()))),void 0!==window.parent.Webflow&&void 0!==window.parent.SetErrorDisplayMessage?window.parent.SetErrorDisplayMessage("1",s,null):void 0!==window.parent.ShowHideDoneMessageCommon&&window.parent.ShowHideDoneMessageCommon(s,2e3),"undefined"!=typeof isFromCheckout&&1==isFromCheckout?CloseRebook():CloseWindowAndRedirect(SelectedSP,SelectedDate)}else _vgCal.ManageAtnd.ShowPopup(!1),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),1==e[0].IsChangeStatus?_vgCal.Common.model.IsNewAPI?Scheduler.RefreshCalendar():_vgCal.Common.RefreshCalendar():"undefined"!=typeof InHouseDeposit&&null!=typeof InHouseDeposit&&InHouseDeposit.CloseInhousePopup()}else _vgClassSessionSelection.commonProperty.gCOrPackageDetail="",_vgClassSessionSelection.commonProperty.cartUserList="",_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),$("#btnCloseWidgetGCMessageTop").data("CallFrom","Class"),ThankYouPopup_lblThankYou().innerHTML="Thank you for your enrollment!",ThankYouPopup_lblRequestMsg().innerHTML="",ShowWidgetGCMessage();else if(5==e[0].type)0==_vgClassSessionSelection.model.IsOnline?_vgClassSessionSelection.commonMessageAlert("Something went wrong. Please search again."):(_vgClassSessionSelection.commonMessageAlert("Something went wrong. Please search again."),1==isCCChanged&&LoadCCFrame());else if(6==e[0].type)if(1==_vgClassSessionSelection.model.IsOnline){var l="";if(1==isCCChanged&&LoadCCFrame(),""!=e[0].successSPlist)for(var d=e[0].successSPlist.split(","),c=0;c<=d.length-1;c++)d.length>1&&c==d.length-2?l+=_vgClassSessionSelection.findSPnameByspid(parseInt(d[c]))+" and ":l+=_vgClassSessionSelection.findSPnameByspid(parseInt(d[c]))+",";if(null!=e[0].failSPlistAndReason&&e[0].failSPlistAndReason.length>0){var u=e[0].failSPlistAndReason,p=[];for(c=0;c<=u.length-1;c++)$.grep(u[c].spID,function(e){var t={};t.spID=parseInt(e),t.spName=_vgClassSessionSelection.findSPnameByspid(parseInt(e)),t.failReason=u[c].failReason,p.push(t)});if(""!=e[0].successSPlist&&""!=l){var h=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(h.length>0)for(var m=0;m<=h.length-1;m++){var f=[];for(c=0;c<=p.length-1;c++){var g=$.grep(h[m].eventEnrollment,function(e){return e.sPID==p[c].spID});g.length>0&&(f=f.concat(g))}f.length>0?h[m].eventEnrollment=f:h.splice(m,1)}h.length>0&&_vgClassSessionSelection.SetIntoSessionStorage(_vgClassSessionSelection.model.EventStorage,h)}}if(""!=e[0].successSPlist&&""!=l){A=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);$("#cartSummaryDectail").html(""),$("#NewEvenetCartDetail123").tmpl(_shopdetail.CalculatePriceAndTaxOnCart(A,null,null,!0)).appendTo("#newCartSummaryDectail123"),$.grep(A,function(e){1==e.eventEnrollment.length&&$("#deleteitem-"+e.eventID).hide()}),_vgClassSessionSelection.commonProperty.gCOrPackageDetail="",_vgClassSessionSelection.commonProperty.cartUserList="",$("#spnSceessSPS").html(l.escapeHtml().slice(0,-1)),$("#dvSucessProviders").show(),$("#EventPaymentheadermsg").text("Enrollment is patially done"),$("#btnPaymentFailClse").data("failtype","1")}else $("#dvSucessProviders").hide(),$("#EventPaymentheadermsg").text("Enrollment didn't go through"),$("#btnPaymentFailClse").data("failtype","2");$("#tblPartialPayment tr").not(":first").remove(),$("#classPaymentFailTemplate").tmpl(p).insertAfter("#trPartialPayment"),$("#partialPaymentValidationpopup").html($("#divClassPaymentFailTemp").html()),_shopdetail.ShowHideClassPaymentPopup(!0)}else"undefined"!=typeof InHouseDeposit&&null!=typeof InHouseDeposit&&InHouseDeposit.ShowHideSuccessFailedPopup(!1,!0);else _vgClassSessionSelection.commonMessageAlert("Something went wrong. Please search again.");else{var v=_vgClassSessionSelection.GetGCorPackage();$.each(e,function(t,i){var a=_vgClassSessionSelection.findClassObjByGcId(i.gcId);a.length>0&&(i.className=a[0].className,i.username=_vgClassSessionSelection.GetUserShortDetail(a[0].cFirstName,a[0].cLastName),1==a[0].isPackage?i.giftcertificate="package":0==a[0].isPackage?i.giftcertificate="gift card":i.giftcertificate="",$.grep(v,function(t){if(t.giftCertificateID==i.gcId)if(9==e[0].type||10==e[0].type||11==e[0].type||13==e[0].type)t.quantity=0,t.currentBalance=0;else if(12==e[0].type){var a=Math.floor(parseFloat((t.currentBalance/t.quantity*100).toFixed(2)))/100;t.currentBalance=Math.floor(parseFloat((a*i.vacancy*100).toFixed(2)))/100,t.quantity=i.vacancy}}))}),$("#tBodyClassValidationTemp").html(""),9==e[0].type?$("#GCNotAvalableTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"):10==e[0].type?$("#GCExpiredTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"):11==e[0].type?$("#GCVoidedTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"):12==e[0].type?$("#GCNotServiceBalTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"):13==e[0].type&&$("#GCNotPriceBalTemplate").tmpl(e).appendTo("#tBodyClassValidationTemp"),_vgClassSessionSelection.commonProperty.gCOrPackageDetail=JSON.stringify(v);var A=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);$("#cartSummaryDectail").html(""),$("#EvenetCartDetail").tmpl(_shopdetail.CalculatePriceAndTaxOnCart(A,null,null,!0)).appendTo("#cartSummaryDectail"),$.grep(A,function(e){1==e.eventEnrollment.length&&$("#deleteitem-"+e.eventID).hide()}),$("#validationpopup").html($("#divClassValidationTemp").html()),$("#divClassValidationpopup").modal("show")}else _vgClassSessionSelection.commonMessageAlert("Something went wrong. Please search again.")},commonMessageAlert:function(e,t){1!=this.model.IsOnline&&!_vgClassSessionSelection.model.IsSearchFromInHouseClass||2!=t?1!=this.model.IsOnline&&!_vgClassSessionSelection.model.IsSearchFromInHouseClass||1!=t&&void 0!==t?_vgCal.Common.ShowMsg(e):vagaro.alertsmall(e):vagaro.alert(e)},createXmlElement:function(e,t,i){var a;if(a="Edge"==_vgClassSessionSelection.get_browser().name?$("<"+e.toLowerCase()+" />"):$("<"+e+" />"),void 0!==i&&null!=i&&1==i){if(void 0===t)return a;var r=a.text(t);return 1==r.length&&(r[0].innerHTML=r[0].innerHTML.replace(/&nbsp;/g," ")),r}return null==t?a:a.text(t)},get_browser:function(){var e,t=navigator.userAgent,i=t.match(/(opera|chrome|safari|firefox|msie|trident|edge(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(i[1]))return{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""};if("Chrome"===i[1]){if(null!=(e=t.match(/\bOPR\/(\d+)/)))return{name:"Opera",version:e[1]};if(null!=(e=t.match(/\bEdge\/(\d+)/)))return{name:"Edge",version:e[1]}}return i=i[2]?[i[1],i[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&i.splice(1,1,e[1]),{name:i[0],version:i[1]}},findXmlNodeByVal:function(e,t,i){var a=null;return $.each(e.find(t),function(e,t){$(t).html()!=i.toString()||(a=$(t))}),a},findClassObjByAppId:function(e){var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),i=null;return $.each(t,function(t,a){$.each(a.eventEnrollment,function(t,r){if(r.appointmentID==e)return(i=r).className=a.eventName,i})}),i},findClassObjByGcId:function(e){var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),i=[];e:for(var a=0;a<=t.length-1;a++)for(var r=0;r<=t[a].eventEnrollment.length-1;r++)if(t[a].eventEnrollment[r].gcId==e){t[a].eventEnrollment[r].className=t[a].eventName,i=i.concat(t[a].eventEnrollment[r]);break e}return i},findClassObjByGcIdAndEventId:function(e,t){var i=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),a=[];e:for(var r=0;r<=i.length-1;r++)for(var o=0;o<=i[r].eventEnrollment.length-1;o++)if(i[r].eventEnrollment[o].gcId==e&&i[r].eventEnrollment[o].eventID==t){i[r].eventEnrollment[o].className=i[r].eventName,a=a.concat(i[r].eventEnrollment[o]);break e}return a},findSPnameByspid:function(e){var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),i="";return t.length>0&&$.each(t,function(t,a){var r=$.grep(a.eventEnrollment,function(t){return t.sPID==e});if(void 0!==r&&null!=r&&r.length>0)return i=r[0].sPName,!1}),i},WeekdayCheckbox_Change:function(e){},IsClassBookingFullOffline:function(e,t){var i=new vagaro.ajax;i.datamodel.Token="IsClassBookingFull",i.datamodel.data=[e],i.datamodel.callback=function(e){_vgClassSessionSelection.IsClassBookingFullOffline_Success(e,t)},i.datamodel.Error=function(e){_vgClassSessionSelection.commonMessageAlert("Some error has occured"),_vgClassSessionSelection.EventShowLoader(!1)},i.Post()},IsClassBookingFullOffline_Success:function(e,t){_vgClassSessionSelection.EventShowLoader(!1),null!=e&&"function"==typeof t&&t(e)},ShowClassFullMsgOffline:function(e){var t=_vgClassSessionSelection.GetClassFullMsgOffline(e);_objMessagePopup.SetWidth(615).SetHeight(466).SetHideCallback(function(){_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_vgClassSessionSelection.model.ClassFullExceptionData=null}).Show("Confirm",t,"Cancel","Proceed","",function(){_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_vgClassSessionSelection.model.ClassFullExceptionData=null,_objMessagePopup.Hide()},function(){_vgClassSessionSelection.SaveAttendeeOffline(),_objMessagePopup.SetHideCallback(null).Hide()},null)},GetClassFullMsgOffline:function(e){var t="";t='<div id="divExceptionDetailFull" style="padding-right: 15px;">',t+='<table id="tblExceptionDetailFull" class="fixed_headers">',t+="<thead>",t+="<tr>",t+="<th>Date</th>",t+='<th style="border-right:0">Remarks</th>',t+="</tr>",t+="</thead>",t+='<tbody id="bodyExceptionDetailFull">';for(var i=0;i<e.length;i++){var a=this.GetEventDetailByApptId(e[i].apptId);t+="<tr>",t+="<td>"+a.eventDate+"</td>",t+='<td>The class that You want to book with teacher "'+a.teacherName+'" is full.<br><div class="ExRedAlert">PLEASE READ: By proceeding further, a system will exceed class capacity.</div></td>',t+="</tr>"}return t+=" </tbody>",t+=" </table>",t+="</div>"},GetEventDetailByApptId:function(e){var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),i={};return $.each(t,function(t,a){$.each(a.eventEnrollment,function(t,r){r.appointmentID==e&&(i.eventID=a.eventID,i.eventName=a.eventName,i.eventDate=new Date(r.eventDate).format("MMM-dd-yyyy"),i.eventTime=r.startTime,i.teacherName=r.sPName,!0)})}),i},IsHandledExceptionOffline:function(e){var t=!1;return null==this.model.ClassFullExceptionData||void 0===this.model.ClassFullExceptionData||$.each(this.model.ClassFullExceptionData,function(i,a){a.apptId==e&&1==a.isFull&&(t=!0)}),t},ShowClassProgressOffline:function(){for(var e=this.GetEnrollmentUserDataFromStorage(),t=new Array,i=0,a=0;a<e.length;a++)t.push(e[a].appId),0==i&&(i=e[a].users.length);_vgCal.Common.model.IsNewAPI?Scheduler.ShowClassProgressBar(t,i,_vgClassSessionSelection.commonProperty.streamingStatus):_vgCal.Common.ShowClassProgressBar(t,i,_vgClassSessionSelection.commonProperty.streamingStatus)},GetEnrollmentUserDataFromStorage:function(){var e=new Array,t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);return $.each(t,function(t,i){$.each(i.eventEnrollment,function(t,i){var a=i.appointmentID,r=$.grep(e,function(e){return e.appId==a});if(r.length>0)r[0].users.push(i.customerID);else{var o={};o.appId=a,o.users=new Array,o.users.push(i.customerID),e.push(o)}})}),e},LoadEventsDataFailCallback:function(e){0==isCheckInApp&&_shopdetail.CloseClassSearchProgress(),vagaro.alert("Some Error occured")},getSunday:function(e){var t=(e=new Date(e)).getDay(),i=e.getDate()-t;return new Date(e.setDate(i))},LoadEventsDataCallback:function(e){if(1!=isCheckInApp||("none"==$("#checkInClassList").css("display")&&(null==e||null!=e&&0==e.length)&&(setTimeout(function(){$("#divEmptyScreen").show()},500),Webflow.destroy(),Webflow.ready()),"none"==$("#checkInClassList").css("display")&&null==e||$("#divDoneButton").show(),null!=e)){0==isCheckInApp&&bkEvent.addResponseToCache(e);var t,i,a=null,r=null;if(0==isCheckInApp)t=getdatepickervalue("#txtdivSearchDate",null,!0,!0),i=getdatepickervalue("#txtdivClassSearchDateEnd",null,!0,!0);else if(null!=e&&e.length>0){var o=new Date(moment(new Date(e[0].strStartTime.replace(new RegExp("-","g")," "))).format("MMM DD,YYYY")),n=new Date(o.getFullYear(),o.getMonth(),o.getDate());t=new Date(n),i=new Date(n)}else t=null,i=null;a=null!=t?t:new Date,r=null!=i?i:new Date;new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");var s=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"),l=null;if(null!=e&&e.length>0){var d=_vgClassSessionSelection.getSunday(a),c=new Date(d);c=new Date(c.setDate(d.getDate()+6)),0==isCheckInApp&&_vgClassSessionSelection.setClassSliderDate(d,c),l=_vgClassSessionSelection.StringToDate(e[0].strbusinessDate,"-"),$("#hdnBusinessDate").val(l.format("yyyy-MM-dd"))}for(var u=[],p=0,h=a;h<=r;h.setDate(h.getDate()+1))if(!(h<l)){p+=1;var m={};m.dayName=s[h.getDay()];m.dateName=["January","February","March","April","May","June","July","August","September","October","November","December"][h.getMonth()]+" "+h.getDate(),m.fullFormatedDate=h.format("MMM dd,yyyy"),m.rowNo=p;var f=e.filter(function(e){return h.getDay()==e.dayNo?e:null});if(m.eventDetail=[],null!=f&&f.length>0)for(var g=0;g<=f.length-1;g++){var v={};if(v.eventDate=new Date(h),v.isFrom=_vgClassSessionSelection.model.IsSearchFromInHouseClass?_vgClassSessionSelection.SearchClassFrom.Search:0,v.strsessionDetail=f[g].sessionDetail,v.availableTime=f[g].availableTime,v.availableEndTime=f[g].availableEndTime,v.className=f[g].className,v.serviceDesc=f[g].serviceDesc,v.teacherName=f[g].teacherName,v.eventDuration=f[g].eventDuration,v.appointmentID=f[g].appointmentID,v.eventType=f[g].eventType,v.totalNoOfAttendees=f[g].noOfAttendees,v.eventCapacity=f[g].eventCapacity,v.strpromotionDetail=f[g].promotionDetail,v.pointsredeem=f[g].PointRedeem,v.totalStreamingNoOfAttendees=f[g].StreamingNoOfAttendees,v.streamingEventCapacity=f[g].StreamingEventCapacity,f[g].noOfAttendees<f[g].eventCapacity?v.remainingCapacity=f[g].eventCapacity-f[g].noOfAttendees:v.remainingCapacity=0,f[g].StreamingNoOfAttendees<f[g].StreamingEventCapacity?v.streamingRemainingCapacity=f[g].StreamingEventCapacity-f[g].StreamingNoOfAttendees:v.streamingRemainingCapacity=0,v.streamingType=f[g].StreamingType,v.isZoomIntegrated=f[g].IsZoomIntegrated,0==isCheckInApp){var A=_vgClassSessionSelection.GetRescheduleDetail();v.EventSessionAttendeesId=null!=A?A.EventSessionAttendeesId:0}else v.fullFormatedDate=v.eventDate.format("MMM dd, yyyy");v.isBrandedAppForApproval=void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&isBrandedAppForApproval,v.sessionDetail=[];for(var C=f[g].sessionDetail.split(","),y=0;y<=C.length-1;y++){var b={};b.appointmentID=f[g].appointmentID,b.eventId=f[g].eventId,b.serviceProviderID=f[g].serviceProviderID,b.strStartTime=f[g].strStartTime,b.session=C[y].split("-")[1],b.streamingAmount=0,b.streamingType=f[g].StreamingType,f[g].StreamingType==_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream?(b.amount=C[y].split("-")[2],b.streamingAmount=C[y].split("-")[3]):f[g].StreamingType==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?b.amount=C[y].split("-")[3]:b.amount=C[y].split("-")[2],b.currencySymbol=_vgClassSessionSelection.GetcurrencySymbol(),v.sessionDetail.push(b)}m.eventDetail.push(v)}m.eventDetail.length>0&&u.push(m)}if(0==isCheckInApp&&_shopdetail.CloseClassSearchProgress(),$("#tblEventDetail").html(""),u.length>0&&($("#EventHeaderTemplate").tmpl(u).appendTo("#tblEventDetail"),Webflow.destroy(),Webflow.ready()),0==isCheckInApp){$("#divEventDetail").show(),$(".book-wrapper").addClass("searched-appointment"),$("body").addClass("searched-appointment-body");$("#hdnMonthName").html();$("#divClassAppResult").show()}}},LoadEventsDataCallbackForClassTab:function(e){_vgClassSessionSelection.commonProperty.IsFromClass=!0;try{if(void 0!==_shopdetail&&void 0!==_shopdetail.BusinessStartTime&&"undefined"!=_shopdetail.clsTimeZoneData&&null!=_shopdetail.clsTimeZoneData&&_shopdetail.BusinessStartTime(_shopdetail.clsTimeZoneData.TIME_ZONE,_shopdetail.clsTimeZoneData.CountryID,_shopdetail.clsTimeZoneData.CUSTOM_DAY_LIGHT_SAVING,e),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&(String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail)&&_shopdetail.GetWidgetServicesDetail(),!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail)&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail.ServiceIds))){var t=_shopdetail.WidgetServicesDetail.ServiceIds.split("|"),a="";if(t.length>1&&!String.isNullOrUndefineOrBlank(t[1])?a=t[1]:1==t.length&&(a=_shopdetail.WidgetServicesDetail.ServiceIds),!String.isNullOrUndefineOrBlank(a)&&null!=e&&e.length>0){var r=0,o=$.extend(!0,[],e);e=$.map(e,function(e){if(1==_onlineCheckout.CheckFileType(e.eventId.toString(),a))return r=1,e}),0==r&&0==IsFromMultiLocation&&0==isWidget&&(e=o)}}if(1==isCheckInApp){if("none"==$("#checkInClassList").css("display")&&(null==e||null!=e&&0==e.length)&&(Webflow.destroy(),Webflow.ready()),null==e)return}else{var n="undefined"!=typeof _common&&1==_common.isCreateLinkPreserve(!0,!0)?_common.isCreateLinkPreserve(!1):null;if(null!=n&&n.length>0){var s=[];$.grep(n,function(t){"-1"!=t&&$.grep(e,function(e){e.serviceProviderID==parseInt(t)&&s.push(e)})}),"-1"!=n[0]&&(e=s)}if(void 0===e||null==e||""==e){$("#AppProgressModalForClass").modal("hide"),$("#date-class-slider-containerForClass .selected").removeClass("selected"),$("#date-class-slider-containerForClass div.enabled").removeClass("enabled").addClass("inactive"),$("body").addClass("searched-appointment-body"),$("#tblEventDetailForClass").html(""),$("#dvNoClasses").css("display",""),$("#divEventDetailForClass").css("display","none"),$("#dvtimezone").hide(),_vgClassSessionSelection.CloseClassSearchProgressForClassTab();var l={confirmButtonText:"Class Not Scheduled"};if(void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking){var d=$("#hdnInstructorIDForClass").val();if(""==_shopdetail.getFilteredServiceProviderId(d))if(1==$("select[id=cboServiceProviderWaitlist_Search] :selected").length){var c=$("select[id=cboServiceProviderWaitlist_Search] :selected").text();l.swalTextMessage="Sorry, "+c+" is Not Accepting New Customers"}else l.swalTextMessage="Sorry, the Selected Employees are Not Accepting New Customers";else l.swalTextMessage="There are no dates scheduled for the selected class and instructor."}else l.swalTextMessage="There are no dates scheduled for the selected class and instructor.";return _common.Openswalpopup(l),void setTimeout(function(){$(".gencutom-title").html(l.confirmButtonText)},100)}$("#dvNoClasses").css("display","none"),$("#divEventDetailForClass").css("display",""),bkEvent.addResponseToCache(e)}var u,p,h=null,m=null;if(0==isCheckInApp)u=new Date($("#hdnStartDateForClass").val()),p=new Date($("#hdnEndDateForClass").val());else if(null!=e&&e.length>0){var f=new Date(moment(new Date(e[0].strStartTime.replace(new RegExp("-","g")," "))).format("MMM DD,YYYY")),g=new Date(f.getFullYear(),f.getMonth(),f.getDate());u=new Date(g),p=new Date(g)}else u=null,p=null;h=null!=u?u:new Date,m=null!=p?p:new Date;var v=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),A=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"),C=null;if(null!=e&&e.length>0){var y=_vgClassSessionSelection.getSunday(h),b=new Date(y);b=new Date(b.setDate(y.getDate()+6)),0==isCheckInApp&&_vgClassSessionSelection.setClassSliderDate(y,b),C=_vgClassSessionSelection.StringToDate(e[0].strbusinessDate,"-"),$("#hdnBusinessDate").val(C.format("yyyy-MM-dd"))}for(var S=[],k=0,D=h;D<=m;D.setDate(D.getDate()+1))if(!(D<C)){k+=1;var _={};_.dayName=A[D.getDay()],_.dayNameFull=v[D.getDay()];var I=["January","February","March","April","May","June","July","August","September","October","November","December"];_.dateName=I[D.getMonth()].substring(0,3)+" "+D.getDate(),_.fullFormatedDate=countryDateFormat(D,VagaroCountryDateFormat.LargeDate),_.fullFormatedDateLabel=_.dayNameFull+" - "+I[D.getMonth()]+" "+D.getDate()+", "+D.getFullYear(),_.rowNo=k;var w=e.filter(function(e){return D.getDay()==e.dayNo?e:null});if(null!=w&&w.length>0)for(var P=0;P<=w.length-1;P++)"1"!=bkClassAvailableDates.model.csvFilterType&&"3"!=bkClassAvailableDates.model.csvFilterType||String.isNullOrUndefineOrBlank(w[P].IsLivestreamAvl)||1!=w[P].IsLivestreamAvl||String.isNullOrUndefineOrBlank(w[P].availableDisplayTime)||String.isNullOrUndefineOrBlank(w[P].availableDisplayEndTime)||(w[P].availableTime=w[P].availableDisplayTime.split("|")[1],w[P].availableEndTime=w[P].availableDisplayEndTime.split("|")[1]);_.eventDetail=[];if(null!=w&&w.length>0)for(P=0;P<=w.length-1;P++){var T={};if(T.eventDate=new Date(D),T.isFrom=_vgClassSessionSelection.model.IsSearchFromInHouseClass?_vgClassSessionSelection.SearchClassFrom.Search:0,T.strsessionDetail=w[P].sessionDetail,T.availableTime=w[P].availableTime,T.availableEndTime=w[P].availableEndTime,T.availableTimeWithFormat=w[P].availableTime.replace(/^0+/,""),T.availableEndTimeWithFormat=w[P].availableEndTime.replace(/^0+/,""),T.className=w[P].className,T.photo=w[P].photo,T.serviceDesc=w[P].serviceDesc,T.teacherName=w[P].teacherName,T.eventDuration=w[P].eventDuration,T.appointmentID=w[P].appointmentID,T.eventType=w[P].eventType,T.totalNoOfAttendees=w[P].noOfAttendees,T.eventCapacity=w[P].eventCapacity,T.isDisplayClassSeat=w[P].isDisplayClassSeat,T.IsWaitlistAvailable=IsOnlineCustomerWaitlist,T.isWorkShop=w[P].isWorkShop,T.strpromotionDetail=w[P].promotionDetail,T.pointsredeem=w[P].PointRedeem,T.totalStreamingNoOfAttendees=w[P].StreamingNoOfAttendees,T.streamingEventCapacity=w[P].StreamingEventCapacity,w[P].noOfAttendees<w[P].eventCapacity?T.remainingCapacity=w[P].eventCapacity-w[P].noOfAttendees:T.remainingCapacity=0,w[P].StreamingNoOfAttendees<w[P].StreamingEventCapacity?T.streamingRemainingCapacity=w[P].StreamingEventCapacity-w[P].StreamingNoOfAttendees:T.streamingRemainingCapacity=0,T.streamingType=w[P].StreamingType,T.isZoomIntegrated=w[P].IsZoomIntegrated,1==T.isZoomIntegrated&&T.streamingEventCapacity>0&&!0,T.IsAttendeeEnrolled=w[P].IsAttendeeEnrolled,0==isCheckInApp){var B=_vgClassSessionSelection.GetRescheduleDetail();null!=B?(T.EventSessionAttendeesId=B.EventSessionAttendeesId,T.IsWaitlistAvailable=!1):T.EventSessionAttendeesId=0}else T.fullFormatedDate=T.eventDate.format("MMM dd, yyyy");T.isBrandedAppForApproval=void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&isBrandedAppForApproval,T.sessionDetail=[];for(var x=w[P].sessionDetail.split(","),F=0;F<=x.length-1;F++){var O={};O.appointmentID=w[P].appointmentID,O.eventId=w[P].eventId,O.serviceProviderID=w[P].serviceProviderID,O.strStartTime=w[P].strStartTime,O.session=x[F].split("-")[1],O.streamingAmount=0,O.streamingType=w[P].StreamingType,w[P].StreamingType==_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream?"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?(O.amount=x[F].split("-")[4],O.streamingAmount=x[F].split("-")[5]):(O.amount=x[F].split("-")[2],O.streamingAmount=x[F].split("-")[3]):w[P].StreamingType==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?O.amount=x[F].split("-")[5]:O.amount=x[F].split("-")[3]:"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?O.amount=x[F].split("-")[4]:O.amount=x[F].split("-")[2],O.currencySymbol=_vgClassSessionSelection.GetcurrencySymbol(),T.sessionDetail.push(O),0==F&&("undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?T.firstSessionPrice=O.currencySymbol+x[F].split("-")[4]:T.firstSessionPrice=O.currencySymbol+x[F].split("-")[2],w[P].StreamingType==_vgClassSessionSelection.StreamingDBFilterType.LiveStream||w[P].StreamingType==_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream?"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?T.firstStreamingSessionPrice=O.currencySymbol+x[F].split("-")[5]:T.firstStreamingSessionPrice=O.currencySymbol+x[F].split("-")[3]:T.firstStreamingSessionPrice=O.currencySymbol+O.streamingAmount)}_.eventDetail.push(T)}if(i=e,"undefined"!=e&&"undefined"!=_shopdetail.timeZone&&null!=e&&null!=_shopdetail.timeZone)for(P=0;P<=e.length-1;P++)if(1==e[P].isZoomIntegrated&&e[P].StreamingEventCapacity>0){$("#dvtimezone").show(),$("#timezone").text("All times are in "+_shopdetail.timeZone);break}_.eventDetail.length>0&&S.push(_)}if(0==isCheckInApp){_vgClassSessionSelection.CloseClassSearchProgressForClassTab(),$("#tblEventDetailForClass").html(""),S.length>0&&($("#EventHeaderTemplate").tmpl(S).appendTo("#tblEventDetailForClass"),Webflow.destroy(),Webflow.ready(),setTimeout(function(){$("div.tooltip-container > .idescicone").bind("click",function(){_vgClassSessionSelection.ShowClassDescPopup($(this).attr("data-servicedesc"),$(this).attr("data-className"),$(this).attr("data-eventDuration"),$(this).attr("data-photo"),$(this).attr("data-price"),$(this).attr("data-isworkshop"),$(this).attr("data-appid"),$(this).attr("data-eventid"),$(this).attr("data-spid"),$(this).attr("data-strtime"),$(this).attr("data-zoomintegrated"),$(this).attr("data-streamingtype"),$(this).attr("data-streamingamount"))})},500)),$("#divEventDetailForClass").show(),$(".book-wrapper").addClass("searched-appointment"),$("body").addClass("searched-appointment-body");$("#hdnMonthNameForClass").html();$("#divClassAppResultForClass").show()}else $("#tblEventDetail").html(""),S.length>0&&($("#EventHeaderTemplate").tmpl(S).appendTo("#tblEventDetail"),Webflow.destroy(),Webflow.ready(),setTimeout(function(){$("div.tooltip-container > .idescicone").bind("touchstart",function(){_vgClassSessionSelection.ShowClassDescPopup($(this).attr("data-servicedesc"),$(this).attr("data-className"),$(this).attr("data-eventDuration"),$(this).attr("data-photo"),$(this).attr("data-price"),$(this).attr("data-isworkshop"),$(this).attr("data-appid"),$(this).attr("data-eventid"),$(this).attr("data-spid"),$(this).attr("data-strtime"),$(this).attr("data-zoomintegrated"),$(this).attr("data-streamingtype"),$(this).attr("data-streamingamount"))})},500)),ShowLoader(!1);if(void 0!==_shopdetail&&null!=_shopdetail&&(1==_shopdetail.IsMemPkgReqToBook||1==_shopdetail.IsLimitOnlineBooking)){var M=_shopdetail.LiveStreamSignUp;void 0!==M&&null!=M&&(_vgClassSessionSelection.DisplayStep(3),_vgClassSessionSelection.ShowEventDetailPopup(M.AppointmentID,M.Session,M.Amount,M.ServiceID,M.ServiceProviderID,M.StrStartTime))}if(void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking){var E=_shopdetail.DisplayEmpNotAccptNewClientsBadge(Number(_vgClassSessionSelection.commonProperty.spIdClass));""!=_vgClassSessionSelection.commonProperty.spNameClass&&null!=_vgClassSessionSelection.commonProperty.spNameClass&&E&&($("#employeefnfHeader").html('<div class="web-display-small membership-modal-heading">'+_vgClassSessionSelection.commonProperty.spNameClass+' Not Accepting New Clients</div> <div class="web-body-font">'+_vgClassSessionSelection.commonProperty.spNameClass+" is currently not accepting clients at this time. Please try your search again.</div>"),$("#btnfnfBook").hide(),$(".familycktfrndlistPopup").hide(),$(".familycktbook").hide(),$("#btnfnfNotAcceptClose").html("Search Availability").removeClass("btn btn-default secondary-button back-btn-hide").addClass("btn thm-contentButton green-primary-button"),$("#employeefnfpopup").modal("show"))}}catch(e){1==isCheckInApp?(Webflow.destroy(),Webflow.ready()):($("#dvNoClasses").css("display",""),$("#divEventDetailForClass").css("display","none"),_vgClassSessionSelection.CloseClassSearchProgressForClassTab()),ShowLoader(!1)}$(".signup-disabled").parent(".book-class-btn").addClass("full")},ResetEventPopupDetail:function(e){$("#txtNoofAttendees").val("1"),$("#ddlRecurringType").val("2"),_vgClassSessionSelection.HideShowWeekOrMonth(),_vgClassSessionSelection.DisplayStep(1),0==isCheckInApp&&$("#btnEventAddtoCart").hide(),e?($("#btnCheckOut").html("Add to Waitlist"),$("#btnUCheckOut").html("Add to Waitlist")):($("#btnCheckOut").html("Checkout"),$("#btnUCheckOut").html("Checkout")),0==isCheckInApp?($("#btnCheckOut").hide(),$("#btnNext").show()):($("#btnCheckOut").show(),$("#btnNext").hide()),$("#txtNoofWeeks").val("1"),$("#txtNoofDays").val("1"),$(".dayselection :input").removeAttr("checked"),$(".dayselection :input").attr("disabled",!0),$(".dayselection :input").attr("data-disable","1"),$(".dayselection input").each(function(){var e=$(this);e.off("change"),e.on("change",function(){_vgClassSessionSelection.WeekdayCheckbox_Change(e)})})},ResetCalendarControl:function(e,t){for(var i=[],a=0;a<=e.eventAvailableDates.length-1;a++){i.push(moment(new Date(e.eventAvailableDates[a].strAvailableDates.replace(new RegExp("-","g")," "))).format("MMM DD,YYYY"));var r=_vgClassSessionSelection.StringToDate(e.eventAvailableDates[a].strEventDate,"-");$("#day-"+r.getDay()).prop("disabled",!1),$("#day-"+r.getDay()).attr("data-disable","0")}destroydatepicker({divid:"#divEventFromDate",textid:"#txtEventFromDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",arrValidDates:i,contentWindow:datePicker_contentWindow}),setdatepickervalue({divid:"#divEventFromDate",textid:"#txtEventFromDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate)},new Date($("#hdnEventTime-"+t).val()))},SetCalendarControlForWorkshop:function(e,t){for(var i=[],a=0;a<=e.eventAvailableDates.length-1;a++){i.push(moment(new Date(e.eventAvailableDates[a].strAvailableDates.replace(new RegExp("-","g")," "))).format("MMM DD,YYYY"));var r=_vgClassSessionSelection.StringToDate(e.eventAvailableDates[a].strEventDate,"-");$("#day-"+r.getDay()).prop("disabled",!0),$("#day-"+r.getDay()).attr("data-disable","0"),$("#day-"+r.getDay()).prop("checked",!0)}destroydatepicker({divid:"#divEventFromDate",textid:"#txtEventFromDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",arrValidDates:i,contentWindow:datePicker_contentWindow}),setdatepickervalue({divid:"#divEventFromDate",textid:"#txtEventFromDate",dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate)},new Date($("#hdnEventTime-"+t).val())),$("#txtEventFromDate").attr("aria-label",$("#txtEventFromDate").val().replaceAll("-"," "))},ValidateMembershipPackageForClass:function(e,t){var i="",a="";if(1==_shopdetail.IsMemPkgReqToBook&&null!=MembershipPackageDetails&&1e3==MembershipPackageDetails.ResponseCode&&null!=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation&&null!=MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse&&MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse.length>0){var r=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation;if(r.IsMemPkgReqToBook&&null!=r.RequiredServices&&""!=r.RequiredServices){var o=r.RequiredServices.split(","),n=e.split(","),s=t.split("||~||"),l=[],d=!1;$.each(n,function(e,t){-1!=jQuery.inArray(t,o)&&(d=!0,l.push(s[e]))}),d&&(a=l.join(", "))}!r.IsMemPkgReqToBook||r.IsUserHasRequiredMembership||r.IsUserHasRequiredPackage||null==r.RequiredServices||""==r.RequiredServices||(i="no",r.UserHasFamilyFriend)}return{UserHasReqMemPack:i,FnfHasReqMemPack:"",ReqServicesNames:a}},OpenAlertForNotAceeptNewClient:function(){},ShowEventDetailPopup:function(t,r,o,n,s,l,d,c){var u=!1;if(_vgClassSessionSelection.model.IsSearchFromInHouseClass)_vgClassSessionSelection.handleEventCartDetails(t,r,o,n,s,l,d,c,u);else if(UserID<=0){$.grep(i,function(e){e.serviceProviderID==s&&(_vgClassSessionSelection.commonProperty.spNameClass=e.teacherName,_vgClassSessionSelection.commonProperty.spIdClass=e.serviceProviderID)});var p=readAlexaCookie("_vgamzn");String.isNullOrUndefineOrBlank(p)?showCommonLoginPopup("ClassSignup"):(void 0!==sFromPage&&(sFromPage="ClassSignup"),signin(null,null,null,p,"","","",8,!1,!0,EncPV(""),getek(),getei(),""))}else if(1!=bkEvent.IsSelectedFromPopUp)if(1==_shopdetail.IsMemPkgReqToBook){var h=null==bkEvent.ServiceProviderID?s:bkEvent.ServiceProviderID,m={businessID:_vgClassSessionSelection.GetCommonBusinessID(),customerId:UserID,isCheckinApp:isCheckInApp};vagaro.ajaxCall(e+a.geteventcartdetail,m,function(e){null!=(e=JSON.parse(e)).Memberships&&e.Memberships.length>0?(u=!0,bkEvent.SelectedMembership=null):u=!1,_vgClassSessionSelection.handleEventCartDetails(t,r,o,n,s,l,d,c,u)},function(e){},!1,!0)}else if(1==_shopdetail.IsLimitOnlineBooking){h=null==bkEvent.ServiceProviderID?s:bkEvent.ServiceProviderID;if(void 0!==bkEvent.ServiceProviderID)$.grep(_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees,function(e){return e.ServiceProviderID==h&&e.UserID==UserID&&1==e.Existing}).length>0&&_vgClassSessionSelection.handleEventCartDetails(t,r,o,n,h,l,d,c,u);else _vgClassSessionSelection.handleEventCartDetails(t,r,o,n,s,l,d,c,u)}else 0==_shopdetail.IsMemPkgReqToBook&&0==_shopdetail.IsLimitOnlineBooking&&_vgClassSessionSelection.handleEventCartDetails(t,r,o,n,s,l,d,c,u);else _vgClassSessionSelection.handleEventCartDetails(t,r,o,n,s,l,d,c,u)},ClearEventCartObj:function(){bkEvent.AppointmentID=void 0,bkEvent.Session=void 0,bkEvent.Amount=void 0,bkEvent.EventId=void 0,bkEvent.ServiceProviderID=void 0,bkEvent.StrStartTime=void 0,bkEvent.IsWorkShop=void 0,bkEvent.IsWaitlist=void 0},handleEventCartDetails:function(t,r,o,n,s,l,d,c,u){var p="";null==n&&(t=bkEvent.AppointmentID,r=bkEvent.Session,o=bkEvent.Amount,n=bkEvent.EventId,s=bkEvent.ServiceProviderID,l=bkEvent.StrStartTime,d=bkEvent.IsWorkShop,c=bkEvent.IsWaitlist),i.forEach(function(e){e.eventId===n&&(p=e.className)});var h="";i.forEach(function(e){e.serviceProviderID==s&&(h=e.teacherName)});var m=!1;if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.DisplayEmpNotAccptNewClientsBadge&&void 0!==_shopdetail.OpenNotAcceptingNewClientsFnFPopupForClass){if(m=_shopdetail.DisplayEmpNotAccptNewClientsBadge(s),1==_shopdetail.IsLimitOnlineBooking&&1==m&&1!=bkEvent.IsSelectedFromPopUp)return void _shopdetail.OpenNotAcceptingNewClientsFnFPopupForClass(h,t,r,o,n,s,l,d,c,u,p);if(void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsMemPkgReqToBook&&!u&&1!=bkEvent.IsSelectedFromPopUp){var f=_vgClassSessionSelection.ValidateMembershipPackageForClass(n.toString(),p);if(""!=f.ReqServicesNames&&"no"==f.UserHasReqMemPack)return bkEvent.AppointmentID=t,bkEvent.Session=r,bkEvent.Amount=o,bkEvent.EventId=n,bkEvent.ServiceProviderID=s,bkEvent.StrStartTime=l,bkEvent.IsWorkShop=d,bkEvent.IsWaitlist=c,void _shopdetail.OpenMembershipPopup(f.ReqServicesNames)}}$("#employeefnfpopup").modal("hide"),SelectedSP=s,SelectedDate=l,isWorkShopOrClass=d,objectArgument={},objectArgument.appointmentID=t,objectArgument.session=r,objectArgument.amount=o,objectArgument.eventId=n,objectArgument.serviceProviderID=s,objectArgument.strStartTime=l,objectArgument.isWorkShop=d,objectArgument.IsWaitlist=c,_vgClassSessionSelection.commonProperty.isWorkShop=void 0!==d&&d;m=!1;if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.DisplayEmpNotAccptNewClientsBadge&&(m=_shopdetail.DisplayEmpNotAccptNewClientsBadge(s),1==_shopdetail.IsLimitOnlineBooking&&1==m&&(_vgClassSessionSelection.commonProperty.ClassPropertyData=objectArgument)),_vgClassSessionSelection.model.IsSearchFromInHouseClass){if(null==_vgAddon.Model.GlobalAddonServiceData&&(_vgAddon.BindAllAddonDataByBusiness_New(CalendarConfiguration.model.CalenderDetails.BusinessID,lLogedInUserID),_vgAddon.GetOnlineServiceDetail()),$("#hdnaddonids").val().length>0&&""!=$("#hdnaddonids").val()){var g=$("#hdnaddonids").val().split("~");if(g.length>0)for(var v=0;v<g.length;v++){var A=_vgAddon.FilterAddonServiceBySPId(g[v],n,s);A.length>0&&_vgClassSessionSelection.model.AttendeeAddonDetails.push(A[0])}}if(businessID=BusinessID,UserID=iLoggedinUserID,_vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.getSelectedCustomer()>0){$("#hdnAppointmentId").val(t);var C=bkEvent.getResponseFromCache();if(null!=C)var y=C.filter(function(e){return e.appointmentID==t?e:null});if(null!=y&&y.length>0){var b=void 0===y[0].StreamingEventCapacity?0:y[0].StreamingEventCapacity;b>0?$(this.model.aLiveStream).show():$(this.model.aLiveStream).hide(),y[0].eventCapacity>0?$(this.model.aAtBusinessStream).show():$(this.model.aAtBusinessStream).hide(),"false"==isFromReschedual?(y[0].eventCapacity>0&&(_vgClassSessionSelection.commonProperty.streamingStatus=_vgClassSessionSelection.StreamingStatusEnum.InHouse,$(this.model.aAtBusinessStream).click()),0==y[0].eventCapacity&&b>0&&(_vgClassSessionSelection.commonProperty.streamingStatus=_vgClassSessionSelection.StreamingStatusEnum.LiveStream,$(this.model.aLiveStream).click())):b>0&&_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream?($(this.model.aLiveStream).show(),$(this.model.aAtBusinessStream).hide(),$(this.model.aLiveStream).click()):($(this.model.aLiveStream).hide(),$(this.model.aAtBusinessStream).show(),$(this.model.aAtBusinessStream).click()),_vgCal.ManageAtnd.SetPopupDataAndShow(t,s,moment(l.replace(/-/g,"/")).toDate(),n.toString(),y[0].teacherName,y[0].eventCapacity,b,!0,y[0].className),$("#txtSessionFrequency").val(r),$("#spnClassDateTime").text(countryDateFormat(l,VagaroCountryDateFormat.SmallDateWithTime)),$("#spnClassNameSpName").text(y[0].className+" with "+y[0].teacherName)}}else vagaro.alertsmall("Please select customer to book a class"),_vgClassSessionSelection.EventShowLoader(!1)}else{_vgClassSessionSelection.DisplayStep(1),_vgClassSessionSelection.commonProperty.isWaitlist=void 0!==c&&c,$("#eventDescription").html("").removeClass("height60").removeAttr("style"),$("#eventimage").css("background-image","url()"),$("#divEventName").html(""),$("#divClassDetailpopup").modal("show"),$("body").addClass("widgetpopupOpen"),$("#divApplyisPointApply").hide(),$("#divApplyDailyDeal").hide(),$("#divApplyGC").hide(),$("#divOuterApplyPkg").hide(),$("#divApplyisMembershipApply").hide(),void 0!==setPopupPosi&&void 0!==IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&(iOS||isAndroidMobile||($("#divClassDetailpopup").addClass("wbDivClassDetailpopup"),setPopupPosi($("#divClassDetailpopup")))),ShowLoader(!0);var S=$("#tr-"+t);$("#hdnAppointmentId").val(t);var k=S.data("sessiondetail"),D=_vgClassSessionSelection.CalcSessionPrice(k,r,1,!0,!1);$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+D).attr("aria-label","Price is "+$("#divEventPrice").html()),_vgClassSessionSelection.commonProperty.streamingAmount=_vgClassSessionSelection.GetcurrencySymbol()+D,_siteBuilderDetail.GCVPLText(D,1),_vgClassSessionSelection.ResetStreamingStatus(S.data("streamingtype"),S.data("hasstreamcapacity")),_vgClassSessionSelection.setStreamingClassType(1==_vgClassSessionSelection.commonProperty.isWaitlist?_vgClassSessionSelection.StreamingDBFilterType.InHouse:S.data("streamingtype"),S.data("hasstreamcapacity"));var _;_=_vgClassSessionSelection.CalcSessionPrice(k,r,1,!0,!0),$(this.model.divStreamingEventPrice).html(_vgClassSessionSelection.GetcurrencySymbol()+_),_siteBuilderDetail.GCVPLText(_,2);var I=_vgClassSessionSelection.GetClassPromotionWithLastMinute(S.data("promotiondetail"));if(_vgClassSessionSelection.UpdateClassDealDiscountBadge(I,D),""!=I.trim()){var w;if(D>0)void 0===(w=getCookie("Referral"))||""==w||null==w||null==w?null!=I&&null!=I&&null!=I.split("|~~|")[2]&&null!=I.split("|~~|")[2]&&"0"==I.split("|~~|")[2]?($("#divEventPrice_Old").html($("#divEventPrice").html()).attr("aria-label","Old price "+$("#divEventPrice").html()),_vgClassSessionSelection.CalculatePromotionPriceDetail("#divEventPrice_Old","#divEventPrice",D,I)):$("#divEventPrice_Old").html(""):($("#divEventPrice_Old").html($("#divEventPrice").html()).attr("aria-label","Old price "+$("#divEventPrice").html()),_vgClassSessionSelection.CalculatePromotionPriceDetail("#divEventPrice_Old","#divEventPrice",D,I)),_siteBuilderDetail.GCVPLText(_vgClassSessionSelection.promotionamt,1);else $("#divEventPrice_Old").hide();if(_>0)void 0===(w=getCookie("Referral"))||""==w||null==w||null==w?null!=I&&null!=I&&null!=I.split("|~~|")[2]&&null!=I.split("|~~|")[2]&&"0"==I.split("|~~|")[2]?($(this.model.divStreamingEventPrice_Old).html($(this.model.divStreamingEventPrice).html()).attr("aria-label","Old Price "+$(this.model.divStreamingEventPrice).html()),_vgClassSessionSelection.CalculatePromotionPriceDetail(this.model.divStreamingEventPrice_Old,this.model.divStreamingEventPrice,_,I)):$(this.model.divStreamingEventPrice_Old).html(""):($(this.model.divStreamingEventPrice_Old).html($(this.model.divStreamingEventPrice).html()).attr("aria-label","Old Price "+$(this.model.divStreamingEventPrice).html()),_vgClassSessionSelection.CalculatePromotionPriceDetail(this.model.divStreamingEventPrice_Old,this.model.divStreamingEventPrice,_,I)),_siteBuilderDetail.GCVPLText(_vgClassSessionSelection.promotionamt,2);else $(this.model.divStreamingEventPrice_Old).hide()}else $("#divEventPrice_Old").hide(),$(this.model.divStreamingEventPrice_Old).hide(),$("#divEventPrice_Old").html("").attr("aria-label",""),$(this.model.divStreamingEventPrice_Old).html("").attr("aria-label","");if($("#hdneventId").val(n),$("#hdnserviceProviderID").val(s),$("#hdnStartTime").val(l),$("#txtQuantity").val(r),_vgClassSessionSelection.clearcontrol(),_vgClassSessionSelection.ResetEventPopupDetail(_vgClassSessionSelection.commonProperty.isWaitlist),_vgClassSessionSelection.PreviousClassRow!=t+"_"+$("#td"+t+"ClassName").data("classname")&&(_vgClassSessionSelection.PreviousClassRow=t+"_"+$("#td"+t+"ClassName").data("classname"),_onlineCheckout.Clear_ShowDiscount()),1==isCheckInApp)$("#btnEventAddtoCart").hide(),$("#btnUAddtoCart").hide(),parseInt($("#txtQuantity").val())>1?$(".signupweek-day").show():$(".signupweek-day").hide(),$("html").addClass("stopscroll");_vgClassSessionSelection.commonProperty.isWaitlist?($("#hdnAppointmentId").data("iswaitlist",_vgClassSessionSelection.commonProperty.isWaitlist),$("#btnEventAddtoCart").hide(),$("#btnUAddtoCart").hide(),$("#btnCheckOut").html("Add to Waitlist"),$("#btnUCheckOut").html("Add to Waitlist")):$("#hdnAppointmentId").data("iswaitlist",!1);var P=$("#tr-"+t),T=null;if(""!=P.data("availabledates"))try{T=JSON.parse(P.data("availabledates"))}catch(e){T=null}if(P.length>0&&""!=P.data("image")&&null!=T){if(""!=P.data("description").escapeHtml().getTextFromHtml()?$("#eventDescription").html(P.data("description").escapeHtml().getTextFromHtml()):$("#eventDescription").hide(),$("#eventDescription")[0].scrollHeight<=80?($(".classevent-desc .more-div").hide(),$("#eventDescription").removeClass("height60")):($("#eventDescription").addClass("height60"),$(".classevent-desc .more-div").show()),$("#eventimage").css("background-image","url("+P.data("image")+")"),$("#divEventName").html($("#td"+t+"ClassName").html()),void 0!==d&&1==d){var B=_vgClassSessionSelection.GetWorkshopDates(T.eventAvailableDates);T.eventAvailableDates.length!=r&&(D=_vgClassSessionSelection.ConvertTodecimal(T.eventAvailableDates.length*D/r,2,!1),$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+D).attr("aria-label","Price is "+$("#divEventPrice").html())),$("#divEventAllDates").html(B),$("#divClassDetailpopup").addClass("workshop-class"),$(".signupweek-day").hide(),$("#divWorkshopDetail").show(),$("#depositClassFooterSecPrice").show(),_vgClassSessionSelection.SetCalendarControlForWorkshop(T,t);var x=P.data("ruleType");$("#ddlRecurringType").val(x),3==x?($("#txtNoofDays").val(P.data("ruleDefinition")),_vgClassSessionSelection.commonProperty.isYearlySelection=!1):2==x?($("#txtNoofWeeks").val(P.data("ruleDefinition")),_vgClassSessionSelection.commonProperty.isYearlySelection=!1):1==x?($("#ddlRecurringType").val(2),_vgClassSessionSelection.commonProperty.isYearlySelection=!1):4==x&&($("#txtNoofDays").val(P.data("ruleDefinition")),$("#ddlRecurringType").val(3),_vgClassSessionSelection.commonProperty.isYearlySelection=!0),_vgClassSessionSelection.HideShowWeekOrMonth()}else $(".signupweek-day").show(),$("#divWorkshopDetail").hide(),$("#divClassDetailpopup").removeClass("workshop-class"),_vgClassSessionSelection.ResetCalendarControl(T,t),$("#day-"+_vgClassSessionSelection.GetStartDate().getDay()).prop("checked",!0);_vgClassSessionSelection.ShowDiscountOnEvent(),$("#divEventName").focus(),ShowLoader(!1)}else{var F={};F.eventId=n,0==isCheckInApp?_vgClassSessionSelection.model.IsSearchFromInHouseClass?F.businessID=BusinessID:F.businessID=_shopdetail.businessID:(F.businessID=glbDataCheckIn.businessID,F.userID=UserID),F.serviceProviderID=s,F.startTime=l,F.type=1,vagaro.ajaxCall(e+a.geteventdetailandavailabledates,F,_vgClassSessionSelection.ShowEventDetailSuccess,0==isCheckInApp?_common.CallFailed:{},!1,!0),$("#divEventName").focus()}_vgClassSessionSelection.ClearEventCartObj()}},CalculatePromotionMultipleSessionDetail:function(e,t,i,a,r,o){$(e).show();var n=0;0==a.split("-")[1]?(n=i-i*a.split("-")[2]/100,_vgClassSessionSelection.promotionamt=n):(n=i-a.split("-")[2]*r.val()*o.val())<0&&(n=0),$(t).html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(n,2))},CalculatePromotionPriceDetail:function(e,t,i,a){$(e).show();var r=i,o=0;0==a.split("-")[1]?(o=_onlineCheckout.parseTodecimal(r-r*a.split("-")[2]/100,2),_vgClassSessionSelection.promotionamt=o):(o=r-a.split("-")[2])<0&&(o=0),$(t).html(_vgClassSessionSelection.GetcurrencySymbol()+_onlineCheckout.parseTodecimal(o,2)).attr("aria-label","New Price "+$(t).html())},ShowEventDetailSuccess:function(e){ShowLoader(!1);var t=$("#hdnAppointmentId").val(),i=$("#tr-"+t);if(e.eventDetail.isWorkShop){$("#divClassDetailpopup").addClass("workshop-class"),$(".signupweek-day").hide(),$("#divWorkshopDetail").show(),$("#depositClassFooterSecPrice").show(),$("#divSPName").html(FullUserName+" With "+e.eventAvailableDates[0].serviceProviderName);var a=e.eventAvailableDates[0].workShopNoofSessions+" sessions every "+_vgClassSessionSelection.GetFrequency(e.eventAvailableDates[0].ruleType,e.eventAvailableDates[0].ruleDefinition);1!=e.eventAvailableDates[0].ruleType?a+=" on:":a+=" :",i.data("EventOn",a);var r=_vgClassSessionSelection.GetFrequencyDays(e.eventAvailableDates[0].ruleType,e.eventAvailableDates[0].ruleDefinition);i.data("EventDays",r);var o="Starting on "+new Date(moment(e.eventAvailableDates[0].strEventDate).toISOString()).format("MMM dd, yyyy").replace(/ 0+/g," ");i.data("EventDate",o);var n=_vgClassSessionSelection.GetWorkshopDates(e.eventAvailableDates);e.eventAvailableDates.length!=e.eventAvailableDates[0].workShopNoofSessions&&(sessionoldamt=_vgClassSessionSelection.ConvertTodecimal(e.eventAvailableDates.length*e.eventAvailableDates[0].workShopSellPrice/e.eventAvailableDates[0].workShopNoofSessions,2,!1),$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+sessionoldamt).attr("aria-label","Price is "+$("#divEventPrice").html())),$("#divEventAllDates").html(n),_vgClassSessionSelection.commonProperty.workshopEventOn=a,2==e.eventAvailableDates[0].ruleType?_vgClassSessionSelection.commonProperty.workshopEventDays=r.replace(/<br\s*\/?>/gi,", ").slice(0,-2):_vgClassSessionSelection.commonProperty.workshopEventDays=r,_vgClassSessionSelection.commonProperty.workshopEventDate=o,_vgClassSessionSelection.SetCalendarControlForWorkshop(e,t)}else $("#divWorkshopDetail").hide(),$(".signupweek-day").show(),$("#divClassDetailpopup").removeClass("workshop-class"),_vgClassSessionSelection.ResetCalendarControl(e,t),$("#day-"+_vgClassSessionSelection.GetStartDate().getDay()).prop("checked",!0);var s=e.eventDetail;if($("#divEventName").html($("#td"+t+"ClassName").html()),i.data("image",s.photo),i.data("smallimage",s.smallphoto),i.data("tax",s.tax),i.data("description",s.eventDesc.escapeHtml()),i.data("availabledates",JSON.stringify(e)),""!=s.eventDesc.escapeHtml().getTextFromHtml()?$("#eventDescription").html(s.eventDesc.escapeHtml().getTextFromHtml()):$("#eventDescription").hide(),$("#eventDescription")[0].scrollHeight<=80?($(".classevent-desc .more-div").hide(),$("#eventDescription").removeClass("height60")):($("#eventDescription").addClass("height60"),$(".classevent-desc .more-div").show()),-1!=s.photo.toLowerCase().indexOf("no-shop-image-big")?$("#eventimage").parent(".event-ph-description").addClass("no-eventimg"):($("#eventimage").parent(".event-ph-description").removeClass("no-eventimg"),$("#eventimage").css("background-image","url("+s.photo+")")),""!=s.businessImage&&$("#imgebusinessimage").attr("src",s.businessImage),e.eventDetail.isWorkShop&&null!=e.eventAvailableDates&&e.eventAvailableDates.length>0){var l=e.eventAvailableDates[0].ruleType,d=e.eventAvailableDates[0].ruleDefinition;if(null!=d&&""!=d||(d=1),3==l)$("#txtNoofDays").val(d),$("#ddlRecurringType").val(l),_vgClassSessionSelection.commonProperty.isYearlySelection=!1;else if(2==l){$("#ddlRecurringType").val(l),(c=d.split("~")).length>0&&(d=c[0],$("#txtNoofWeeks").val(d)),_vgClassSessionSelection.commonProperty.isYearlySelection=!1}else if(1==l)$("#ddlRecurringType").val(2),_vgClassSessionSelection.commonProperty.isYearlySelection=!1;else if(4==l){var c;$("#ddlRecurringType").val(3),(c=d.split("~")).length>1&&(d=c[1],$("#txtNoofDays").val(d)),_vgClassSessionSelection.commonProperty.isYearlySelection=!0}_vgClassSessionSelection.HideShowWeekOrMonth(),i.data("ruleType",l),i.data("ruleDefinition",d)}if(1==isCheckInApp&&($("#divClassDetailpopup").show(),$("#txtNoofAttendees").prop("disabled",!0),$("#divNoofAttendees").css("display","none"),$("html").addClass("stopscroll")),_vgClassSessionSelection.ShowDiscountOnEvent(),void 0!==_shopdetail&&null!=_shopdetail&&(1==_shopdetail.IsMemPkgReqToBook||1==_shopdetail.IsLimitOnlineBooking)){var u=_shopdetail.LiveStreamSignUp;void 0!==u&&null!=u&&(_vgClassSessionSelection.AddToEventCart(3),clearCookie("LiveStreamSignUp"),$("#btnBackSecondPopup").hide(),$("#btnCancelSecondPopup").show())}},ResetStreamingStatus:function(e,t){$(this.model.aLiveStream).show(),$(this.model.aAtBusinessStream).show(),_vgClassSessionSelection.commonProperty.streamingStatus=1,1==e&&0==t?$("#dvStreamingStatus").find("a").addClass("active"):($("#dvStreamingStatus").find("a").removeClass("active"),$("#dvStreamingStatus").find("a#aLiveStream").addClass("active"),$("#aLiveStream").click())},setStreamingClassType:function(e,t){void 0!==e&&""!=e?e==_vgClassSessionSelection.StreamingDBFilterType.InHouse?($(this.model.aLiveStream).hide(),$(this.model.aAtBusinessStream).show(),$(this.model.aAtBusinessStream).click()):e==_vgClassSessionSelection.StreamingDBFilterType.LiveStream?($(this.model.aAtBusinessStream).hide(),void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&1==isBrandedAppForApproval?$(this.model.aLiveStream).hide():($(this.model.aLiveStream).show(),$(this.model.aLiveStream).click())):(1==t?void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&1==isBrandedAppForApproval?$(this.model.aLiveStream).hide():$(this.model.aLiveStream).show():$(this.model.aLiveStream).hide(),$(this.model.aAtBusinessStream).show()):(1==t?void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&1==isBrandedAppForApproval?$(this.model.aLiveStream).hide():$(this.model.aLiveStream).show():$(this.model.aLiveStream).hide(),$(this.model.aAtBusinessStream).show())},SetStreamingStatus:function(e,t){if($("#dvStreamingStatus").find("a").removeClass("active").attr("aria-checked",!1),_vgClassSessionSelection.model.IsSearchFromInHouseClass)txtDepositCls.value=0,_vgClassSessionSelection.commonProperty.streamingStatus=e,_vgClassSessionSelection.CalcAndDisplayPriceOffline();else if(e==_vgClassSessionSelection.StreamingDBFilterType.InHouse){var i=$("#hdnAppointmentId").val();if(0==$("#tr-"+i).data("hasinhousecapacity")&&1!=objectArgument.IsWaitlist)return 1==IsOnlineCustomerWaitlist?void bootbox.confirm({title:"Confirmation",message:"A class can't take any new enrollment in At Businesss as it is full, Would you like to add Waitlist?",buttons:{confirm:{label:"Add to Waitlist"}},callback:function(e){e&&_vgClassSessionSelection.ShowEventDetailPopup(objectArgument.appointmentID,objectArgument.session,objectArgument.amount,objectArgument.eventId,objectArgument.serviceProviderID,objectArgument.strStartTime,objectArgument.isWorkShop,!0)}}):void vagaro.alertsmall("A class can't take any new enrollment in At Businesss as it is full.")}$(t).addClass("active").attr("aria-checked",!0),_vgClassSessionSelection.commonProperty.streamingStatus=e,void 0===_shopdetail||null==_shopdetail||1!=_shopdetail.IsMemPkgReqToBook&&1!=_shopdetail.IsLimitOnlineBooking||void 0===_shopdetail.LiveStreamSignUp||null==_shopdetail.LiveStreamSignUp?_vgClassSessionSelection.commonProperty.streamingAmount=$(t).find("span.new").text():_vgClassSessionSelection.commonProperty.streamingAmount=_vgClassSessionSelection.GetcurrencySymbol()+_shopdetail.LiveStreamSignUp.Amount},CalculateSessionPrice:function(){var e=$("#hdnAppointmentId").val(),t=$("#tr-"+e),i=t.data("sessiondetail"),a=$("#txtQuantity");(""==a.val()||parseInt(a.val())<=0)&&a.val("1");var r=$("#txtNoofAttendees");(""==r.val()||parseInt(r.val())<=0)&&r.val("1"),parseInt(r.val())>1&&($("#btnEventAddtoCart").hide(),$("#btnUAddtoCart").hide(),$("#btnCheckOut").hide(),$("#btnNext").show());var o=_vgClassSessionSelection.CalcSessionPrice(i,a.val(),r.val(),!0,!1);$("#divEventPrice").html(_vgClassSessionSelection.GetcurrencySymbol()+o).attr("aria-label","new price is "+$("#divEventPrice").html()),$("#divEventPrice_Old").html($("#divEventPrice").html()).attr("aria-label","old price is "+$("#divEventPrice_Old").html());parseInt($("#divEventPrice_Old").text().replace("$"," "));_siteBuilderDetail.GCVPLText(o,1);var n;n=_vgClassSessionSelection.CalcSessionPrice(i,a.val(),r.val(),!0,!0),$(this.model.divStreamingEventPrice).html(_vgClassSessionSelection.GetcurrencySymbol()+n),$(this.model.divStreamingEventPrice_Old).html($(this.model.divStreamingEventPrice).html()),_siteBuilderDetail.GCVPLText(n,2);var s=_vgClassSessionSelection.GetClassPromotionWithLastMinute(t.data("promotiondetail"));_vgClassSessionSelection.UpdateClassDealDiscountBadge(s,o),""!=s.trim()?(o>0?(_vgClassSessionSelection.CalculatePromotionMultipleSessionDetail("#divEventPrice_Old","#divEventPrice",o,s,a,r),_siteBuilderDetail.GCVPLText(_vgClassSessionSelection.promotionamt,1)):$("#divEventPrice_Old").hide(),n>0?(_vgClassSessionSelection.CalculatePromotionMultipleSessionDetail(this.model.divStreamingEventPrice_Old,this.model.divStreamingEventPrice,n,s,a,r),_siteBuilderDetail.GCVPLText(n,2)):$(this.model.divStreamingEventPrice_Old).hide()):($("#divEventPrice_Old").hide(),$("#divEventPrice_Old").html("").attr("aria-label",""),$(this.model.divStreamingEventPrice_Old).hide()),1==isCheckInApp&&(a.val()>=1?$(".signupweek-day").show():$(".signupweek-day").hide())},CloseDateControl:function(){HideShowdatepicker(!1,{divid:"#divEventFromDate",textid:"#txtEventFromDate"})},ShowHideClassPopup:function(e){1==e?($("#divClassDetailpopup").modal("show"),$("body").addClass("widgetpopupOpen"),1==isCheckInApp&&$("html").addClass("stopscroll")):(_vgClassSessionSelection.CloseDateControl(),$("#divClassDetailpopup").modal("hide"),$("body").removeClass("widgetpopupOpen"),1==isCheckInApp&&$("html").removeClass("stopscroll"),onlineShoppingCart={},onlineShoppingCartmain={},$("#btnBackSecondPopup").show(),$("#btnCancelSecondPopup").hide(),bkEvent.IsSelectedFromPopUp=!1),_vgClassSessionSelection.commonProperty.ClassPropertyData=null,$("#tr-"+$("#hdnAppointmentId").val()).find(".dropdown-toggle").attr("tabindex","-1").focus()},ShowHideClassTooltipPopup:function(e){1==e?($("#divClassDetailTooltippopup").modal("show"),void 0!==setPopupPosi&&void 0!==IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&(iOS||isAndroidMobile||setPopupPosi($("#divClassDetailTooltippopup"))),1==isCheckInApp&&$("html").addClass("stopscroll")):(_vgClassSessionSelection.CloseDateControl(),$("#divClassDetailTooltippopup").modal("hide"),1==isCheckInApp&&$("html").removeClass("stopscroll"))},GetNextWorkShop:function(t,i,r,o,n,s,l,d){if(l){var c={businessID:glbDataCheckIn.businessID,startDate:i,eventID:r,appointmentId:t};vagaro.ajaxCall(e+a.getnextavailabledateworkshop,c,function(e){null==e?vagaro.alert({message:"This workshop started. Workshops are a series of sessions that must be attended from the beginning.",title:"Workshop in Progress"}):e.IsFirstDate?_vgClassSessionSelection.ShowEventDetailPopup(t,o,n,r,s,i,!0,d):null==e.FutureStartDate?vagaro.alert({message:"This workshop started on "+countryDateFormat(moment(new Date(e.strCurrentStartDate.replace(new RegExp("-","g")," "))),VagaroCountryDateFormat.SmallDate)+". Workshops are a series of sessions that must be attended from the beginning.",title:"Workshop in Progress"}):"undefined"!=typeof bootbox&&bootbox.confirm({title:"Workshop in Progress",message:"This workshop started on "+countryDateFormat(moment(new Date(e.strCurrentStartDate.replace(new RegExp("-","g")," "))),VagaroCountryDateFormat.SmallDate)+". Workshops are a series of sessions that must be attended from the beginning. Would you like to join the next workshop on "+countryDateFormat(moment(new Date(e.strFutureStartDate.replace(new RegExp("-","g")," "))),VagaroCountryDateFormat.SmallDate)+"?",buttons:{cancel:{label:"Cancel"},confirm:{label:"Continue"}},callback:function(t){if(t){var i=e.strFutureStartDate,r=$("<XMLDocument/>");r.append(_vgClassSessionSelection.createXmlElement("searchDetails"));var o=_vgClassSessionSelection.createXmlElement("searchDetail");o.append(_vgClassSessionSelection.createXmlElement("serviceId","-3")),o.append(_vgClassSessionSelection.createXmlElement("spId","-3")),r.find("searchDetails").append(o);var n={};n.businessID=glbDataCheckIn.businessID,n.sSatrtDate=i,n.sEndDate=i,n.searchdetails=r.html(),n.userID=glbDataCheckIn.scanUserID,n.promotionID=0,ajaxapi(a.getavailablemultievents,n,_vgClassSessionSelection.LoadEventsDataCallbackForClassTab,_vgClassSessionSelection.LoadEventsDataFailCallback,!1),ShowLoader(!1)}}})},function(e){},!1,!0)}else{var u={businessID:_shopdetail.businessID,startDate:i,eventID:r,appointmentId:t};vagaro.ajaxCall(e+a.getnextavailabledateworkshop,u,function(e){null==e?vagaro.alert({message:"This workshop started. Workshops are a series of sessions that must be attended from the beginning.",title:"Workshop in Progress"}):e.IsFirstDate||_vgClassSessionSelection.model.IsSearchFromInHouseClass?_vgClassSessionSelection.ShowEventDetailPopup(t,o,n,r,s,i,!0,d):null==e.FutureStartDate?vagaro.alert({message:"This workshop started on "+countryDateFormat(moment(new Date(e.strCurrentStartDate.replace(new RegExp("-","g")," "))),VagaroCountryDateFormat.SmallDate)+". Workshops are a series of sessions that must be attended from the beginning.",title:"Workshop in Progress"}):"undefined"!=typeof bootbox&&bootbox.confirm({title:"Workshop in Progress",message:"This workshop started on "+countryDateFormat(moment(new Date(e.strCurrentStartDate.replace(new RegExp("-","g")," "))),VagaroCountryDateFormat.SmallDate)+". Workshops are a series of sessions that must be attended from the beginning. Would you like to join the next workshop on "+countryDateFormat(moment(new Date(e.strFutureStartDate.replace(new RegExp("-","g")," "))),VagaroCountryDateFormat.SmallDate)+"?",buttons:{cancel:{label:"Cancel"},confirm:{label:"Continue"}},callback:function(t){if(t){var i=_common.GetChoiceForSeleect2($("#txtSP5"));void 0!==i.id&&null!=i.id&&""!=i.id&&($("#txtSP5").select2("data",{id:"",text:""}),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#txtSP5Mobile").val(""),_common.SetDefaultForSeleect2($("#txtSP5")),$("#hdnInstructorIDForClass").val(""),_shopdetail.FillClassDatesForClass());var a=moment(e.strFutureStartDate)._d;$("#hdnStartDateForClass").val(a);try{var r=_shopdetail.getSunday(a),o=new Date(r);o=new Date(o.setDate(r.getDate()+6)),_shopdetail.setClassSliderDateForClass(r,o)}catch(e){}LoadClassDataOnline(a),ShowLoader(!1)}}})},function(e){},!1,!0)}},VisibleControlLength:function(e){return $(e).filter(function(){return"none"!==$(this).css("display")}).length},ShowClassDescPopup:function(t,i,r,o,n,s,l,d,c,u,p,h,m){if($(".clstip-name").html(i),$("#clstip-minlabel").html(r),$(".clstip-min").attr("aria-label",r.replace("hr","Hour")),$(".clstip-description").html(t),""!=o?($(".clstip-img").css("background-image","url("+o+")"),$(".clstip-img-name").removeClass("no-cls-img")):$(".clstip-img-name").addClass("no-cls-img"),void 0===n||""==n||null==n||h!=_vgClassSessionSelection.StreamingDBFilterType.InHouse&&h!=_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream)$("#clstip-price").html(""),$("#clstip-price").hide();else{var f=n;if(h==_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream)f='<div class="vg-service-video clstip-livestream"><em aria-label="In House Logo" role="img">&#xf54e;</em><span>At Business - </span>&nbsp;'+n+" </div> ";$("#clstip-price").html(f),$("#clstip-price").show()}if(void 0===p||"true"!=p||h!=_vgClassSessionSelection.StreamingDBFilterType.LiveStream&&h!=_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream||void 0===m||""==m||null==m)$("#clsstreamtip-price").html(""),$("#clsstreamtip-price").hide();else if(void 0!==isBrandedAppForApproval&&null!=isBrandedAppForApproval&&1==isBrandedAppForApproval)$("#clsstreamtip-price").html(""),$("#clsstreamtip-price").hide();else{f=m;if(h==_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream)f='<div class="vg-service-video clstip-livestream"><em aria-label="Live Stream Logo" role="img">&#xf03d;</em><span>Live Stream - </span>&nbsp;'+m+" </div>";$("#clsstreamtip-price").html(f),$("#clsstreamtip-price").show()}if(null!=s&&"true"==s){$("#divClassDetailTooltippopup .modal-dialog").addClass("workshop-show"),$("#hdnAppointmentId").val(l);var g=$("#tr-"+l),v=null;if(""!=g.data("availabledates"))try{v=JSON.parse(g.data("availabledates"))}catch(e){v=null}if(null!=v){var A=_vgClassSessionSelection.GetWorkshopDates(v.eventAvailableDates);$(".clstip-workshopdates").html(A),$("#divworkshopdetails").show(),$("#depositClassFooterSecPrice").show(),$("#divClassDetailTooltippopup").on("show.bs.modal",function(){centerModal($("#divClassDetailTooltippopup"))}).modal("show")}else{var C={};C.eventId=parseInt(d),0==isCheckInApp?_vgClassSessionSelection.model.IsSearchFromInHouseClass?C.businessID=BusinessID:C.businessID=_shopdetail.businessID:(C.businessID=glbDataCheckIn.businessID,C.userID=UserID),C.serviceProviderID=parseInt(c),C.startTime=u,C.type=1,vagaro.ajaxCall(e+a.geteventdetailandavailabledates,C,_vgClassSessionSelection.GetEventDetailAndAvailableDatesSuccess,0==isCheckInApp?_vgClassSessionSelection.CallFailed2:{},!1,!0)}}else $("#divClassDetailTooltippopup .modal-dialog").removeClass("workshop-show"),$("#divworkshopdetails").hide(),$("#divClassDetailTooltippopup").on("show.bs.modal",function(){centerModal($("#divClassDetailTooltippopup")),$(".clstip-name").focus()}).modal("show")},AddToEventCart:function(e){if("undefined"!=typeof divEventPrice&&null!=divEventPrice&&(_vgClassSessionSelection.commonProperty.streamingAmount=divEventPrice.textContent),"undefined"!=typeof onlineShoppingCart&&(onlineShoppingCart={}),"undefined"!=typeof onlineShoppingCartmain&&(onlineShoppingCartmain={}),void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&_siteBuilderDetail&&_siteBuilderDetail.ComponentResponse&&_siteBuilderDetail.ComponentResponse.lstBusinessDetail&&!1===_siteBuilderDetail.ComponentResponse.lstBusinessDetail.IsShoppingTabCartEnable&&$("#btnUAddtoCart").hide(),1==isCheckInApp&&($("body").removeClass("future-appointment-show"),$(".book-future-appt").removeClass("show")),null==getdatepickervalue("#txtEventFromDate"))return vagaro.alertsmall("Please select today's date."),!1;if(_vgClassSessionSelection.commonProperty.streamingStatus<=0)return vagaro.alertsmall("Please select where would you like to take this class?"),!1;ShowLoader(!0);var t=$("#hdnAppointmentId").val(),i=$("#tr-"+t),a=$("#td-"+t),r=parseInt($("#hdnserviceProviderID").val()),o=$("#td"+t+"ClassName").data("classname");-1==o.indexOf("&lt;div class")&&-1==o.indexOf("<div class")||(-1!=o.indexOf("&lt;div class")?o=o.substr(0,o.indexOf("&lt;div")):-1!=o.indexOf("<div class")&&(o=o.substr(0,o.indexOf("<div class")))),_vgClassSessionSelection.commonProperty.appointmentId=parseInt(t),_vgClassSessionSelection.commonProperty.availabledates=JSON.parse(i.data("availabledates"));for(var n=0;n<_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length;n++)"11:59 PM"==_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates[n].strEndTime&&(_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates[n].strEndTime="12:00 AM");_vgClassSessionSelection.commonProperty.otherSPavailabledates="",_vgClassSessionSelection.commonProperty.businessID=parseInt(_vgClassSessionSelection.GetCommonBusinessID()),_vgClassSessionSelection.commonProperty.SPID=parseInt(r),_vgClassSessionSelection.commonProperty.UserID=parseInt(UserID),null!=UserCellNo?_vgClassSessionSelection.commonProperty.UserCellNo=UserCellNo:_vgClassSessionSelection.commonProperty.UserCellNo="",_vgClassSessionSelection.commonProperty.FullUserName=FullUserName,_vgClassSessionSelection.commonProperty.teacherName=a.html(),_vgClassSessionSelection.commonProperty.UserEmail="undefined"!=typeof UserEmail&&null!=UserEmail?UserEmail.trim():"",_vgClassSessionSelection.commonProperty.eventID=parseInt($("#hdneventId").val()),_vgClassSessionSelection.commonProperty.tax=parseFloat(i.data("tax")),_vgClassSessionSelection.commonProperty.smallImage=i.data("smallimage"),_vgClassSessionSelection.commonProperty.startTime=$("#hdnStartTime").val(),_vgClassSessionSelection.commonProperty.shortStartTime=i.data("availabletime"),_vgClassSessionSelection.commonProperty.sessiondetail=i.data("sessiondetail"),_vgClassSessionSelection.commonProperty.promotiondetail=i.data("promotiondetail"),_vgClassSessionSelection.commonProperty.isWaitlist=$("#hdnAppointmentId").data("iswaitlist"),_vgClassSessionSelection.commonProperty.eventName=o,_vgClassSessionSelection.GetEventCartDetail(e)},GetEventCartDetail:function(t){if(_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage).length<=0){var i={businessID:_vgClassSessionSelection.GetCommonBusinessID(),customerId:UserID,isCheckinApp:isCheckInApp};vagaro.ajaxCall(e+a.geteventcartdetail,i,function(e){null!=(e=JSON.parse(e)).Events&&null!=e.Events&&e.Events.length>0?($.each(e.Events,function(e,t){null!=t.tax?t.tax=parseFloat(t.tax):t.tax=0,$.each(t.eventEnrollment,function(e,t){t.eventDate=moment(t.eventDate).toISOString()})}),onlineShoppingCartmain=e):onlineShoppingCartmain={},3!=t?_vgClassSessionSelection.CheckLogiUserCheckExistance(t):_vgClassSessionSelection.AddUserWithCheckExistance(t)},function(e){},!1,!0)}else 3!=t?_vgClassSessionSelection.CheckLogiUserCheckExistance(t):_vgClassSessionSelection.AddUserWithCheckExistance(t)},ShowDiscountOnEvent:function(){UserID>0&&_vgClassSessionSelection.GetEventCartDetail_ShowDiscount()},UpdateAttendeeSelection:function(e){if(_vgClassSessionSelection.VerifyAttendeeSelection(e)&&_vgClassSessionSelection.VerifyAttendeeSelectionincart(e)&&($(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").html($(e).find("div.ffshipping-bg").html()),$(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-value",$(e).find("div.ffshipping-bg").data("value")),$(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-email",$(e).find("div.ffshipping-bg").data("email")),$(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-cell",$(e).find("div.ffshipping-bg").data("cell")),$(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-cellcountryid",$(e).find("div.ffshipping-bg").data("cellcountryid")),$(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-fullname",$(e).find("div.ffshipping-bg").data("fullname")),$(e).closest("div.panel-default").find("div.panel-heading").find("div.ffshipping-bg").attr("data-cellcountryid",$(e).find("div.ffshipping-bg").data("cellcountryid")),$(e).closest("div.panel-default").attr("data-value",$(e).find("div.ffshipping-bg").data("value")),$(e).closest("div.panel-default").attr("data-email",$(e).find("div.ffshipping-bg").data("email")),$(e).closest("div.panel-default").attr("data-cell",$(e).find("div.ffshipping-bg").data("cell")),$(e).closest("div.panel-default").attr("data-cellcountryid",$(e).find("div.ffshipping-bg").data("cellcountryid")),$(e).closest("div.panel-default").attr("data-fullname",$(e).find("div.ffshipping-bg").data("fullname")),$(e).closest("div.collapse").collapse("hide"),void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking)){$(e).closest("div.panel-default").attr("data-tag","");var t=$("div.clsaccordion").find(".panel-default")[0].dataset.tag;void 0!==t&&""!=t?($("#btnSearchAvailability").show(),$("#btnUAddtoCart").hide(),$("#btnUCheckOut").hide()):($("#btnSearchAvailability").hide(),$("#btnUAddtoCart").show(),$("#btnUCheckOut").show())}},VerifyAttendeeSelection:function(e){var t=$(e).closest("div.panel-default").attr("data-value"),i=$(e).find("div.ffshipping-bg").attr("data-value");if(t==i)return!0;var a=$("div.clsaccordion").find(".panel-default").map(function(){return $(this).attr("data-value")}).get();return!(jQuery.inArray(i.toString(),a)>-1)||(swal({title:"Attendee Already Added",text:"This attendee is already added.",type:"warning",customClass:"swal-white-greenbtn"}),$(e).closest("div.collapse").collapse("hide"),!1)},VerifyAttendeeSelectionincart:function(e){try{var t=$(e).find("div.ffshipping-bg").attr("data-value"),i=$(e).find("div.ffshipping-bg").attr("data-email"),a=_vgClassSessionSelection.commonProperty.eventID,r=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(r.length>0){var o=$.grep(r,function(e){return e.eventID==a});return!(o.length>0&&_vgClassSessionSelection.CheckUserExistance(t,i,o[0])&&0==_vgClassSessionSelection.commonProperty.isAddonPopup)||(_vgClassSessionSelection.commonMessageAlert("this user is already exists in cart."),$(e).closest("div.collapse").collapse("hide"),!1)}return!0}catch(e){}},AddGuestUsertoSelection:function(){var e=$("#txtFFGuestfirstName").val().trim(),t=$("#txtFFGuestlastName").val().trim(),i=$("#txtFFGuestEmail").val().trim(),a=$("#txtFFGuestPhone").val(),r=0,o=1,n={};if(!guestcellPhone.validatePhoneNumber(!0)){var s=guestcellPhone.getValidateMessage();return 3==s.WarningType?($("#divCellNo").html("cell should be of 10 digits."),$("#divCellNo").show()):1==s.WarningType?($("#divCellNo").html("required"),$("#divCellNo").show()):($("#divCellNo").html(s.WarningMessage),$("#divCellNo").show()),!1}$("#divCellNo").hide(),a=(n=guestcellPhone.getPhoneData()).phoneNo,r=n.countryId,o=n.dialingCode;var l=0;if($("#ffguestdetail input").each(function(){0==_vgClassSessionSelection.validate($(this),$(this).attr("data-type"),0)&&1==(l+=1)&&$(this).focus()}),0==l){var d=$("#ffguestmodel").attr("data-value"),c=$("div.clsaccordion").find(".panel-default").map(function(){if(void 0!==$(this).attr("data-email"))return $(this).attr("data-email").trim().toLowerCase()}).get();if(jQuery.inArray(i.toLowerCase(),c)>-1)return _vgClassSessionSelection.commonMessageAlert("Duplicate Guest, Already added this Guest in selection"),$("#ffguestmodel").modal("toggle"),$(".bootbox-alert").addClass("ffonlineclassbootbox"),void $("#"+d).siblings("div.attendeelist").collapse("hide");var u=e+" "+t,p='<div class="ffshipping-bg" data-value="0" data-email="'+i+'" data-cell="'+a+'" data-cellcountryid="'+r+'" data-fullname="'+u+'" data-dialingCode="'+o+'"><div class="avtar">'+FindInitials(u,"SP")+'</div><divclass="w-clearfix"><div class="avtar-name">'+e+" "+t+'</div><div class="avtar-subtitle">Guest</div></div></div>';$("#"+d).find(".ffshipping-bg").html(p),$("#ffguestmodel").modal("toggle"),$("#"+d).siblings("div.collapse").collapse("hide");var h='<li class="mid-tabs familycktfrndlistdetails" data-value="0" onclick="_vgClassSessionSelection.UpdateAttendeeSelection(this)">'+p+"</li>";$("#"+d).siblings("div.attendeelist").find("#lstoffamilyandfriends").find(" > li:nth-last-child(2)").before(h),$("#"+d).closest("div.panel-default").attr("data-value","0"),$("#"+d).closest("div.panel-default").attr("data-email",i),$("#"+d).closest("div.panel-default").attr("data-cell",a),$("#"+d).closest("div.panel-default").attr("data-cellcountryid",r),$("#"+d).closest("div.panel-default").attr("data-fullname",u),$("#"+d).closest("div.panel-default").attr("data-dialingCode",o),setTimeout(function(){$("#divUserDetail").attr("aria-label","").attr("tabindex",-1).focus()},1e3),void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&void 0!==$("#divClassDetailpopup")&&null!=$("#divClassDetailpopup")&&null!=$("#divClassDetailpopup")&&$("#divClassDetailpopup").css({"overflow-x":"hidden","overflow-y":"auto"})}},GetEventCartDetail_ShowDiscount:function(){var t=$("#tr-"+$("#hdnAppointmentId").val()),i=void 0!==t.data("streamingtype")?t.data("streamingtype"):_vgClassSessionSelection.StreamingDBFilterType.InHouse,r=1;i==_vgClassSessionSelection.StreamingDBFilterType.InHouseAndLiveStream&&(r=2),$("#divApplyisPointApply").hide(),$("#divApplyDailyDeal").hide(),$("#divApplyGC").hide(),$("#divOuterApplyPkg").hide(),$("#divApplyisMembershipApply").hide(),$("#divApplyIsWaivedApplyApply").hide(),$("#liWeekDays .dayselection label").attr("aria-checked",!1),$("#liWeekDays input[type=checkbox]:checked").next("label").attr("aria-checked",!0);var o=[];if(null!=s&&(o=$.extend(!0,[],s.Events)),null==o||o.length<=0){var n={businessID:_vgClassSessionSelection.GetCommonBusinessID(),customerId:UserID,isCheckinApp:isCheckInApp};vagaro.ajaxCall(e+a.geteventcartdetail,n,function(e){var t;if(null!=(e=JSON.parse(e)).Events&&null!=e.Events&&e.Events.length>0?($.each(e.Events,function(e,t){null!=t.tax?t.tax=parseFloat(t.tax):t.tax=0,$.each(t.eventEnrollment,function(e,t){t.eventDate=moment(t.eventDate).toISOString()})}),onlineShoppingCartmain=e):onlineShoppingCartmain=null,null!=onlineShoppingCartmain){s=$.extend(!0,[],onlineShoppingCartmain);var a=1;$.grep(s.Events,function(e){e.autoId=a,a+=1}),t=$.extend(!0,[],s.Events)}else t=[];for(var o=1;o<=r;o++){var n=[];t.length>0&&(n=$.extend(!0,[],t)),1==o&&3==i||1==i?_vgClassSessionSelection.CreateEventCollection_ShowDiscount(1,n,_vgClassSessionSelection.StreamingStatusEnum.InHouse):_vgClassSessionSelection.CreateEventCollection_ShowDiscount(1,n,_vgClassSessionSelection.StreamingStatusEnum.LiveStream)}},function(e){},!1,!0)}else for(var l=1;l<=r;l++){var d=[];o.length>0&&(d=$.extend(!0,[],o)),1==l&&3==i||1==i?_vgClassSessionSelection.CreateEventCollection_ShowDiscount(1,d,_vgClassSessionSelection.StreamingStatusEnum.InHouse):_vgClassSessionSelection.CreateEventCollection_ShowDiscount(1,d,_vgClassSessionSelection.StreamingStatusEnum.LiveStream)}},getFilterEnrollmentDataByStreamStatus:function(e,t){var i=[];e.length>0&&(i=$.extend(!0,[],e),i=$.grep(i,function(e){if(e.eventEnrollment.length>0){var i=$.grep(e.eventEnrollment,function(e){return e.StreamingStatus==t});e.eventEnrollment=i}}));return i},SetButtonValue:function(e,t){$("#btnBack").data("from",e),$("#btnConfirm").data("to",t)},GetCommonBusinessID:function(){return 0==isCheckInApp?_vgClassSessionSelection.model.IsSearchFromInHouseClass?BusinessID:_shopdetail.businessID:null!=glbDataCheckIn.businessID?glbDataCheckIn.businessID:0},GetcurrencySymbol:function(){var e=0;return 0==isCheckInApp?e=_vgClassSessionSelection.model.IsSearchFromInHouseClass?_vgCal.Common.model.CurrencySymbol:_shopdetail.currencySymbol:(glbDataCheckIn.currency,e=null!=glbDataCheckIn.currency?glbDataCheckIn.currency:""),e},GetCurrencyCode:function(){return String.isNullOrUndefineOrBlank(currencyCode)?"":currencyCode},AlreadyEnrolled:function(e){1==isCheckInApp?(_vgClassSessionSelection.ShowHideClassPopup(!1),$("#licartIcon a").attr("data-isbypass","true"),$("#licartIcon a").click()):bootbox.confirm({title:"This Class is Already in Your Cart",message:e,buttons:{confirm:{label:"Add a Friend"}},callback:function(e){e&&(_vgClassSessionSelection.EventShowLoader(!0),_vgClassSessionSelection.SetDefaultUser(!1),_vgClassSessionSelection.AddUser(),_vgClassSessionSelection.EventShowLoader(!1))}})},CallFailed:function(e){1==isCheckInApp||_common.CallFailed()},Convert2digitFormat:function(e){return parseFloat(Math.round(100*e)/100).toFixed(2)},EventFullMessageCheckIn:function(){vagaro.alertsmall("A class can't take any new enrollment as it is full.")},GetEventDetailAndAvailableDatesSuccess:function(e){if(null!=e&&e.eventDetail.isWorkShop){var t=parseInt($("#hdnAppointmentId").val());$("#tr-"+t).data("availabledates",JSON.stringify(e));var i=_vgClassSessionSelection.GetWorkshopDates(e.eventAvailableDates);$(".clstip-workshopdates").html(i),$("#divworkshopdetails").show(),$("#depositClassFooterSecPrice").show(),$("#divClassDetailTooltippopup").on("show.bs.modal",function(){centerModal($("#divClassDetailTooltippopup"))}).modal("show")}},GetWorkshopDates:function(e){for(var t=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"),i="",a="",r=0;r<e.length;r++){var o=e[r],n=new Date(moment(o.strEventDate).toISOString());t[n.getDay()];"11:59 PM"==o.strEndTime&&(o.strEndTime="12:00 AM"),a=void 0!==e[r].CleanupTime&&null!=typeof e[r].CleanupTime&&e[r].CleanupTime>0?moment(o.strEndTime,"hh:mm A").subtract(e[r].CleanupTime,"minutes").format("hh:mm A"):o.strEndTime,i=i+countryDateFormat(n,VagaroCountryDateFormat.LargeDate)+" ("+o.strStartTime.replace(/^0+/,"")+" - "+a.replace(/^0+/,"")+")<br/>"}return i},SetSelectionRepeatVal:function(e){$("#classSelectionRepeat").find("a").each(function(e,t){$(this).hasClass("active")&&$(this).removeClass("active")}),$("#classSelectionRepeat").find("a").eq(e).addClass("active")},SetDayClassSession:function(e){0==$(e).attr("data-disable")&&($(e).hasClass("active")?$(e).removeClass("active"):$(e).addClass("active"))},isCalNumberKey:function(e){var t=e.which?e.which:event.keyCode;return!(t>31&&(t<48||t>57))},CheckIsMinNum:function(e){var t=parseInt(e.value);e.value=t>0?t>12?"12":t.toString():"1"},upWksNumber:function(){$("#divSessionFrequencyActive").removeClass("active"),$("#divSessionWksFrequencyActive").addClass("active");var e=document.getElementById("txtSessionWksFrequency").value;if(""==e||null==e||NaN==e)document.getElementById("txtSessionWksFrequency").value="1";else if((e=parseInt(e))>12)document.getElementById("txtSessionWksFrequency").value="1";else{var t=e+1;t<13&&(document.getElementById("txtSessionWksFrequency").value=t.toString())}},downWksNumber:function(){$("#divSessionFrequencyActive").removeClass("active"),$("#divSessionWksFrequencyActive").addClass("active");var e=document.getElementById("txtSessionWksFrequency").value;if(""==e||null==e||"NaN"==e)document.getElementById("txtSessionWksFrequency").value="1";else if((e=parseInt(e))>0){var t=e-1;t>0&&(document.getElementById("txtSessionWksFrequency").value=t.toString())}else document.getElementById("txtSessionWksFrequency").value="1"},isCalMinDateNumber:function(e){var t=parseInt(e.value);e.value=t>0?t>31?"31":t.toString():""},downClassDateNumber:function(){$("#divSessionFrequencyActive").removeClass("active"),$("#divSessionClassMntDateActive").addClass("active");var e=document.getElementById("txtSessionClassMntDate").value;if(""==e||null==e||"NaN"==e)document.getElementById("txtSessionClassMntDate").value="1";else if((e=parseInt(e))>0){var t=e-1;t>0&&(document.getElementById("txtSessionClassMntDate").value=t.toString())}else document.getElementById("txtSessionClassMntDate").value="1"},upClassDateNumber:function(){$("#divSessionFrequencyActive").removeClass("active"),$("#divSessionClassMntDateActive").addClass("active");var e=document.getElementById("txtSessionClassMntDate").value;if(""==e||null==e||NaN==e)document.getElementById("txtSessionClassMntDate").value="1";else if((e=parseInt(e))>31)document.getElementById("txtSessionClassMntDate").value="1";else{var t=e+1;t<32&&(document.getElementById("txtSessionClassMntDate").value=t.toString())}},CheckSessionMinNum:function(e){var t=parseInt(e.value);e.value=t>0?t>20?"20":t.toString():"1",_vgCal.ManageAtnd.ShowHideAtCount(),_vgClassSessionSelection.CalcAndDisplayPriceOffline()},upSessionNumber:function(){$("#divSessionWksFrequencyActive").removeClass("active"),$("#divSessionClassMntDateActive").removeClass("active"),$("#divSessionFrequencyActive").addClass("active");var e=document.getElementById("txtSessionFrequency").value;if(""==e||null==e||NaN==e)document.getElementById("txtSessionFrequency").value="1";else if((e=parseInt(e))>20)document.getElementById("txtSessionFrequency").value="1";else{var t=e+1;t<21&&(document.getElementById("txtSessionFrequency").value=t.toString())}_vgCal.ManageAtnd.ShowHideAtCount(),_vgClassSessionSelection.CalcAndDisplayPriceOffline()},downSessionNumber:function(){$("#divSessionWksFrequencyActive").removeClass("active"),$("#divSessionClassMntDateActive").removeClass("active"),$("#divSessionFrequencyActive").addClass("active");var e=document.getElementById("txtSessionFrequency").value;if(""==e||null==e||"NaN"==e)document.getElementById("txtSessionFrequency").value="1";else if((e=parseInt(e))>0){var t=e-1;t>0&&(document.getElementById("txtSessionFrequency").value=t.toString())}else document.getElementById("txtSessionFrequency").value="1";_vgCal.ManageAtnd.ShowHideAtCount(),_vgClassSessionSelection.CalcAndDisplayPriceOffline()},WaitlistSuccessMessage:function(e,t){1==t&&($("#ancCheckoutSuccessClass").removeAttr("onclick"),$("#ancCheckoutSuccessClass").attr("onclick","_onlineCheckout.SuccessCheckinAPP();")),Webflow.destroy(),Webflow.ready(),1==e?("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,"22|~|1"),$("#divCheckInAppDetails").hide(),$("#dvCheckoutSuccessClass").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),$("#dvCheckoutSuccessMSGClass").html("You're on the waitlist"),$("#dvCheckoutSuccessMSG1Class").hide()):($("#divCheckInAppDetails").hide(),$("#dvCheckoutSuccessClass").show().attr("style","display:-webkit-box; display:-webkit-flex; display: -ms-flexbox; display:flex;"),$("#dvCheckoutSuccessMSGClass").html("You're on the waitlist"),$("#dvCheckoutSuccessMSG1Class").show().css("display","flex")),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&CallbackforMobileApp(0,0,"","",0,29)},SaveWaitlistClass:function(t,i){for(var r=[],o=0;o<=t.length-1;o++){var n=t[o],s={};if(s.UserId=parseInt(n.customerID),s.EmailId=n.cUserEmail,s.CountryId=1,1==this.model.IsOnline&&0==isCheckInApp&&(s.CountryId=parseInt(_shopdetail.countryId)),s.FirstName=n.cFirstName.toString(),s.LastName=n.cLastName.toString(),s.Cell=n.cUserCellNo,s.CellCountryID=n.cCellcountryID,s.DialingCode=n.cDialingCode,s.ServiceId=parseInt(n.eventID),s.ServiceProviderId=parseInt(n.sPID),s.ServiceProviderName=n.sPName,s.EventName=_vgClassSessionSelection.commonProperty.eventName,s.AddOnIDs="",null!=n.lstAddonService&&n.lstAddonService.length>0)for(var l=0;l<n.lstAddonService.length;l++)s.AddOnIDs+=n.lstAddonService[l].ServiceId.toString()+",";s.AddOnIDs=s.AddOnIDs.replace(/,s*$/,"");var d=[];1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?$.each(i,function(e,t){t.cUserEmail==n.cUserEmail&&(objChildWaitlistDetail={},objChildWaitlistDetail.ReqStartTime=t.workshopActualDate,objChildWaitlistDetail.AppointmentId=t.appointmentID,d.push(objChildWaitlistDetail))}):(objChildWaitlistDetail={},objChildWaitlistDetail.ReqStartTime=n.workshopActualDate,objChildWaitlistDetail.AppointmentId=n.appointmentID,d.push(objChildWaitlistDetail)),s.lstChildWaitlistDetail=d,r.push(s)}var c={Device:"Website",Calledfrom:"Calendar"};if(1==this.model.IsOnline&&0==isCheckInApp){if("true"==isFacebook?c.Calledfrom="FacebookWidget":"true"==isWidget?c.Calledfrom="Widget":"true"==isGoogle?c.Calledfrom="Google":c.Calledfrom="Shopdetail","undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions?c.Device="Insta":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()&&(c.Device="Facebook"),"undefined"!=typeof isWindowsApp&&1==isWindowsApp)c.Device="Windows";else if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){c.Device="CustomerApp";var u=null!=navigator.userAgent?navigator.userAgent:"";u.toLowerCase().indexOf("customerios")>-1?c.Device="iOS":u.toLowerCase().indexOf("customerandroid amazon")>-1?c.Device="Amazon":u.toLowerCase().indexOf("customerandroid")>-1&&(c.Device="Android"),"undefined"!=typeof IsBrandedApp&&null!=IsBrandedApp&&""!==IsBrandedApp&&null!=IsBrandedApp&&1==IsBrandedApp&&(c.Device=c.Device+" Branded")}else if(vgAppicationType==objApplicationType.CheckinApp)c.Device="CheckIn";else if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.VisibleControlLength&&_shopdetail.VisibleControlLength("#mobile-check")>0){c.Device="MobileWeb","undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions?c.Device="Insta":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()&&(c.Device="Facebook");var p=navigator.userAgent;OpenedFrom={iphone:p.match(/(iPhone|iPod)/),blackberry:p.match(/BlackBerry/),kindle:p.match(/Silk/),android:p.match(/Android/),windows:p.match(/Windows/),ipad:p.match(/iPad/)},OpenedFrom.windows?c.Device=c.Device+" Windows Phone":OpenedFrom.iphone?c.Device=c.Device+" iPhone":OpenedFrom.android?c.Device=c.Device+" Android":OpenedFrom.blackberry?c.Device=c.Device+" Blackberry":OpenedFrom.ipad?c.Device=c.Device+" iPad":OpenedFrom.kindle&&(c.Device=c.Device+" kindle")}}else 1==this.model.IsOnline&&1==isCheckInApp&&(c.Calledfrom="Shopdetail",c.Device="CheckIn");c.BusinessID=_vgClassSessionSelection.commonProperty.businessID;var h=0;h=1==this.model.IsOnline?UserID:_vgCal.Common.model.logInUId,c.LoginUserID=h,c.UserID=h,c.IsOnline=_vgClassSessionSelection.model.IsOnline,c.AppointmentType=1==_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?3:2,c.MasterWaitlistDetails=r,_vgClassSessionSelection.EventShowLoader(!0);var m=new vagaro.ajax;m.datamodel.Token=e+a.savewaitlist,m.datamodel.data=c,m.datamodel.IsNewVagaroAPI=!0,m.datamodel.callback=_vgClassSessionSelection.SuccessSaveWaitlist,m.datamodel.Error=_vgClassSessionSelection.CallFailed,m.Post()},SuccessSaveWaitlist:function(e){if(null!=e){if(null!=e.ErrorSummary&&e.ErrorSummary.length>0){if(7==e.ErrorSummary[0].type)$.each(e.ErrorSummary,function(e,t){t.className=t.eventName,t.sessionTime=moment(t.reqStartTime).format("hh:mm A"),t.spName=t.serviceProviderName,t.eventDate=new Date(moment(t.reqStartTime)).format("MMM-dd-yyyy")}),$("#tBodyClassValidationTemp").html(""),$("#ClassDeleteTemplate").tmpl(e.ErrorSummary).appendTo("#tBodyClassValidationTemp"),_vgClassSessionSelection.model.IsOnline?($("#validationpopup").html($("#divClassValidationTemp").html()),$("#divClassValidationpopup").modal("show")):(_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_vgClassSessionSelection.commonMessageAlert($("#divClassValidationTemp").html()));else if(16==e.ErrorSummary[0].type){var t="";$.grep(e.ErrorSummary,function(e){t+=e.firstName+" "+e.lastName+", "}),e.ErrorSummary[0].userDataXml=t.trimRight().slice(0,-1);var i=[];i.push(e.ErrorSummary[0]),$("#tBodyClassValidationTemp").html(""),$("#ClassOnlineBookBlockTemplate").tmpl(i).appendTo("#tBodyClassValidationTemp"),$("#validationpopup").html($("#divClassValidationTemp").html()),$("#divClassValidationpopup").modal("show")}else 2==e.ErrorSummary[0].type&&0==_vgClassSessionSelection.model.IsOnline&&($.each(e.ErrorSummary,function(e,t){t.className=t.eventName,t.sessionTime=moment(t.reqStartTime).format("hh:mm A"),t.spName=t.serviceProviderName,t.eventDate=new Date(moment(t.reqStartTime)).format("MMM-dd-yyyy"),t.apptId=t.appointmentId,t.status=1==t.status?"enrolled":"waitlisted",""!=t.firstName||""!=t.lastName?t.username=""!=t.lastName?_vgClassSessionSelection.GetUserShortDetail(t.firstName,t.lastName):t.firstName+".":t.username=""}),$("#tBodyClassValidationTemp").html(""),$("#UserAlreadyWaitlistTemplate").tmpl(e.ErrorSummary).appendTo("#tBodyClassValidationTemp"),_vgClassSessionSelection.RemoveAddedEnrollmentOffline(),_objMessagePopup.SetWidth(650).Show("Alert",$("#divClassValidationTemp").html(),"OK","","",function(){_objMessagePopup.Hide()},function(){_objMessagePopup.Hide()},null));return void _vgClassSessionSelection.EventShowLoader(!1)}1==_vgClassSessionSelection.model.IsOnline?(_vgClassSessionSelection.ShowHideClassPopup(!1),_vgClassSessionSelection.WaitlistSuccessfullBooked(e)):_vgClassSessionSelection.WaitlistOfflineMessage(!0,e.WaitlistMasters.length)}else 1==_vgClassSessionSelection.model.IsOnline?($("#divClassDetailpopup").modal("hide"),_vgWaitlist.ShowFailMessage("Some error occured.Please try again later")):_vgClassSessionSelection.WaitlistOfflineMessage(!1,0);_vgClassSessionSelection.EventShowLoader(!1)},WaitlistOfflineMessage:function(e,t){if(e)if(SetErrorDisplayMessage("1","Waitlist has been saved.",""),0==$("#spanFeature").hasClass("available-show")||""==$("#lblFeatureCount").text())$("#spanFeature").addClass("available-show"),$("#lblFeatureCount").html(t);else try{var i=parseInt($("#lblFeatureCount").text());i+=t,$("#lblFeatureCount").text(i)}catch(e){}else SetErrorDisplayMessage("0","Some error occured.Please try again later","");_vgCal.ManageAtnd.ShowPopup(!1),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.WaitlistEventStorage)},WaitlistSuccessfullBooked:function(e){if(1!=isCheckInApp){_shopdetail.RemoveAllControls(!0,!0),_shopdetail.SetControls(null),$("#no-appointment-found").hide();var t={},i=e.WaitlistDetails,a=e.WaitlistProviders,r=e.WaitlistDetails,o=[];$.grep(r,function(e){var i={};i.date=_vgWaitlist.GetDateTimeForDisplay(e.strReqStartTime,1),i.time=_vgWaitlist.GetDateTimeForDisplay(e.strReqStartTime,2),o.push(i),t.TimeSlots=o});var n=[],s={},l=_vgWaitlist.GetServiceProvidersDetail(i[0].ServiceProviderID,a),d={};d.servicename=i[0].ServiceTitle,d.image=l[0].image,d.spname=l[0].spname,d.spinit=l[0].spinit;var c=[];if(null!=i[0].AddOnIDs&&null!=i[0].AddOnIDs&&""!=i[0].AddOnIDs)for(var u=i[0].AddOnIDs.split("|~|"),p=0;p<u.length;p++)c.push({AddonName:u[p]});d.lstAddonService=c,s.typeService=_vgWaitlist.localData.TypeService.Single,s.serviceList=[],s.serviceList.push(d),n.push(s),t.lstWaitlistServices=n,_vgWaitlist.localData.ThankYouResponse=[],_vgWaitlist.localData.ThankYouResponse.push(t),_vgWaitlist.Waitlist_ThankyouScreen()}else _vgClassSessionSelection.WaitlistSuccessMessage(!0,isCheckInApp)},SearchAvailabilityClick:function(){_vgClassSessionSelection.ClearEventCartObj(),$("#employeefnfpopup").modal("hide"),$("#hdnSearchAvailabilityBtn").val("1"),bkClassAvailableDates.removeCacheByCurKey(),bkClassAvailableDates.timeSlotsCache={},bkClassAvailableDates.model={},void 0!==bkEvent.model.searchFromDate&&(bkEvent.removeCacheByCurKey(),bkEvent.timeSlotsCache={},bkEvent.model={}),_vgClassSessionSelection.ShowHideClassPopup(!1),_vgClassSessionSelection.FillClassDatesForClass(),_vgClassSessionSelection.commonProperty.spNameClass="",_vgClassSessionSelection.commonProperty.spIdClass=""},isCallFromPublic:function(){return"undefined"!=typeof BasePage&&"Home"==BasePage},GetEventCartDetail_ShowDiscountPublic:function(){_onlineCheckout.Clear_ShowDiscount();var e=[],t=[];e.length>0&&(t=$.extend(!0,[],e)),_vgClassSessionSelection.CreateEventCollection_ShowDiscount(1,t,_vgClassSessionSelection.StreamingStatusEnum.LiveStream)},AddEventFromPublic:function(t){"undefined"!=typeof onlineShoppingCart&&(onlineShoppingCart={}),"undefined"!=typeof onlineShoppingCartmain&&(onlineShoppingCartmain={});var i=!1;void 0!==t&&null!=t&&(i=t);var r=[];if(null!=s&&(r=$.extend(!0,[],s.Events)),null==r||r.length<=0){var o={businessID:_publicEvent.objEventDetails.BusinessID,customerId:UserID,isCheckinApp:isCheckInApp,IsLiveStream:!0};vagaro.ajaxCall(e+a.geteventcartdetail,o,function(e){var t;if(null!=(e=JSON.parse(e)).Events&&null!=e.Events&&e.Events.length>0?($.each(e.Events,function(e,t){null!=t.tax?t.tax=parseFloat(t.tax):t.tax=0,$.each(t.eventEnrollment,function(e,t){t.eventDate=moment(t.eventDate).toISOString()})}),onlineShoppingCartmain=e):onlineShoppingCartmain=null,null!=onlineShoppingCartmain){s=$.extend(!0,[],onlineShoppingCartmain);var a=1;$.grep(s.Events,function(e){e.autoId=a,a+=1}),t=$.extend(!0,[],s.Events)}else t=[];var r=[];t.length>0&&(r=$.extend(!0,[],t)),_vgClassSessionSelection.ClassAddToCartPublic(r,i)},function(e){},!1,!0)}else{var n=[];r.length>0&&(n=$.extend(!0,[],r)),_vgClassSessionSelection.ClassAddToCartPublic(n,i)}},ClassAddToCartPublic:function(e){var t=[],i=_publicEvent,a=i.objEventDetails,r=moment(new Date(a.StrStartTime)),o=a.ServiceProviderID,n=a.FirstName+(a.LastName.length>0?" "+a.LastName.substring(0,1)+".":""),s={},l=[];if(1==a.IsWorkShop)s.eventAvailableDates=i.lstEventAvailableDate,$.grep(_publicEvent.lstEventAvailableDate,function(e){var t=new Date(e.strAvailableDates);l.push(new Date(t.getFullYear(),t.getMonth(),t.getDate()))});else{var d=[],c={};c.appointmentID=a.AppointmentID,c.endTime=a.EndTime,c.eventCapacity=0,c.eventDuration=a.EventDuration,c.firstName=null,c.isWorkShopStarted=!1,c.lastName=null,c.noOfAttendees=0,c.ruleDefinition=null,c.ruleType=0,c.serviceProviderID=o,c.serviceProviderName=n,c.startTime=a.StartTime,c.strAvailableDates=r.format("MMM-DD-YYYY"),c.strEventDate=r.format("YYYY-MM-DD"),c.strStartTime=r.format("hh:mm A"),c.strEndTime=r.add(a.Duration,"minutes").format("hh:mm A"),c.streamingEventCapacity=a.StreamingEventCapacity,c.streamingNoOfAttendees=a.StreamingNoOfAttendees,c.workShopNoofSessions=0,c.workShopSellPrice=0,c.workShopStreamingSellPrice=0,d.push(c),s.eventAvailableDates=d;var u=new Date(a.StrStartTime);l.push(new Date(u.getFullYear(),u.getMonth(),u.getDate()))}var p={};if(p.eventID=a.ServiceID,p.eventName=a.ServiceTitle,p.tax=0,p.smallimage=a.ServicePhoto,p.sessiondetail=a.SessionDetail,p.promotiondetail=a.PromotionDetail,p.eventEnrollment=[],t.length>0){var h=$.grep(t,function(e){return e.eventID==p.eventID});h.length>0&&(p.eventEnrollment=$.grep(h[0].eventEnrollment,function(e){return 1!=e.isTempData}),p.eventEnrollment.length<=0&&(p.eventEnrollment=[]))}var m=Math.random().toString(36).substring(7),f="",g="",v=UserID,A="";"undefined"!=typeof FullUserName&&(f=FullUserName.split(" ")[0],"undefined"!=FullUserName.split(" ")[1]&&(g=FullUserName.split(" ")[1])),A=void 0!==$(this).attr("data-dialingCode")&&null!=$(this).attr("data-dialingCode")&&""!=$(this).attr("data-dialingCode")?$(this).attr("data-dialingCode"):"";for(var C=0;C<=l.length-1;C++){var y;if(null!=(y=$.grep(s.eventAvailableDates,function(e){return e.strEventDate==l[C].format("yyyy-MM-dd")&&e.serviceProviderID==o}))&&y.length>0){var b={};if(0==p.eventEnrollment.length?b.autoID=1:b.autoID=Math.max.apply(Math,p.eventEnrollment.map(function(e){return e.autoID}))+1,b.IsFromHomePage=!0,b.eventID=p.eventID,b.appointmentID=parseInt(y[0].appointmentID),b.customerID=v,b.cFirstName=f,b.cLastName=g,b.cUserEmail="",b.cUserCellNo="",b.cCellcountryID=0,b.cDialingCode=A,b.sPID=o,b.sPName=n,b.eventDate=l[C],b.workshopActualDate=l[C].format("MM/dd/yyyy")+" "+y[0].strStartTime,b.startTime=y[0].strStartTime,b.endTime=y[0].strEndTime,b.duration=y[0].eventDuration,b.isTempData=!1,b.IsWorkShop=a.IsWorkShop,1==b.IsWorkShop&&0!=y[0].workShopStreamingSellPrice&&0!=y[0].workShopNoofSessions?b.workShopIndividualPrice=y[0].workShopStreamingSellPrice/y[0].workShopNoofSessions:b.workShopIndividualPrice=0,b.noOfWorkShop=s.eventAvailableDates.length,b.randomForWorkShop=m,b.workshopEventOn=_vgClassSessionSelection.commonProperty.workshopEventOn,b.workshopEventDays=_vgClassSessionSelection.commonProperty.workshopEventDays,b.workshopEventDate=_vgClassSessionSelection.commonProperty.workshopEventDate,b.PromotionID=0,b.IsAmount=!1,b.AmountValue=0,b.PerUserOne="0",b.discount=0,void 0!==p.promotiondetail&&""!=p.promotiondetail){var S=p.promotiondetail.split("-");b.PromotionID=p.promotiondetail.split("-")[0],b.IsAmount=0!=p.promotiondetail.split("-")[1],b.AmountValue=p.promotiondetail.split("-")[2],b.PerUserOne=p.promotiondetail.split("-")[3],S.length>4?b.PerTransactionOne=p.promotiondetail.split("-")[4]:b.PerTransactionOne="0",b.PromotionTitle=p.promotiondetail.split("|~~|")[1]}b.StreamingStatus=_vgClassSessionSelection.StreamingStatusEnum.LiveStream,p.eventEnrollment.push(b)}}try{if(void 0!==e&&null!=e&&1==e){var k={};null!=$("#PopupBtnSignUp")&&null!=$("#PopupBtnSignUp").text()&&(k.Action=$("#PopupBtnSignUp").text()),k.Category="Live Stream",k.PageName="Live Stream",null!=$("#PopupBusinessName")&&null!=$("#PopupBusinessName").text()&&(k.BusinessName=$("#PopupBusinessName").text()),k.TypeofService="Live Stream","Live Stream"==k.TypeofService&&(k.isLiveStream=!0,k.isInHouse=!1,k.isSignupFree=!0),_vgLogEvent.LogData(k)}}catch(e){}if(t.length>0)t=$.grep(t,function(e){return e.eventID!=p.eventID});p.eventEnrollment.length>0&&t.push(p),this.SetIntoSessionStorage(this.model.EventStorage,t,!0)},LoadClassUserControl:function(){if($(_vgClassSessionSelection.Controls.ClassSectionStencil).length>0&&$(_vgClassSessionSelection.Controls.ClassesMainDiv).html($(_vgClassSessionSelection.Controls.ClassSectionStencil).html()),ShowLoader(!0),null!=_vgClassSessionSelection.ComponentResponse.lstClass)_vgClassSessionSelection.CallSuccess_LoadUserControl(_vgClassSessionSelection.ComponentResponse.lstClass);else{var e={UserControlPath:"~/UserControls/ucDetailClass.ascx",isRemoveFormTag:!0,Parameters:{}};1==_vgClassSessionSelection.model.IsOnline?(e.PageNamePath="~/detail.aspx",e.Parameters.BusinessID=businessID):(e.PageNamePath="~/SearchClassFromCalendar.aspx",e.Parameters.BusinessID=BusinessID);var t=new vagaro.ajax;t.datamodel.Token=a.LoadUserControl,t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=_vgClassSessionSelection.CallSuccess_LoadUserControl,t.datamodel.Error=_vgClassSessionSelection.LoadUserControlFailed,t.Post(),void 0!==_shopdetail&&void 0!==_shopdetail.GetPromotionsByBusinessID&&_shopdetail.GetPromotionsByBusinessID(),void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking&&(void 0!==_shopdetail.LoadEmpNotAcceptingNewClients&&_shopdetail.LoadEmpNotAcceptingNewClients(),null!=UserID&&"0"!=UserID&&void 0!==_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees&&_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees())}},CallSuccess_LoadUserControl:function(e){var t;1==_vgClassSessionSelection.model.IsOnline?(DisplayFullView(!1),ShowLoader(!1),(t=$(_vgClassSessionSelection.Controls.ClassesMainDiv)).length>0&&(t.html(""),!1===_siteBuilderDetail.isCallFromPublicSide()&&_common.DisableComponent(13,t),t.append(e),_vgClassSessionSelection.ComponentResponse.lstClass=e,_vgClassSessionSelection.ChangeStreamingFilterDropDown(),t.show(),"undefined"!=typeof isBotCrawler&&0==isBotCrawler&&("undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail.IsCustomerAppORMobileViewWithoutWidget()&&$("#covidbadgeblock").is(":visible")&&($("#covidbadgeblock").data("ismanuallyhide",!0),$("#covidbadgeblock").hide()),_vgClassSessionSelection.LoadEventForClassControl(),_vgClassSessionSelection.LoadClassTab(null)))):(t=$(_vgClassSessionSelection.Controls.ClassesMainDiv)).length>0&&(t.html(""),t.append(e),_vgClassSessionSelection.ComponentResponse.lstClass=e,_vgClassSessionSelection.ChangeStreamingFilterDropDown(),t.show(),_vgClassSessionSelection.LoadEventForClassControl(),_vgClassSessionSelection.LoadClassTab(null))},LoadUserControlFailed:function(){ShowLoader(!1),vagaro.alert({message:"An Error Has Occurred",title:"Oops!"})},ChangeStreamingFilterDropDown:function(){1==_vgClassSessionSelection.model.IsOnline&&null!=typeof _shopdetail.IsZoomIntegrated&&1==_shopdetail.IsZoomIntegrated&&void 0!==isBrandedAppForApproval&&0==isBrandedAppForApproval||0==_vgClassSessionSelection.model.IsOnline&&null!=typeof window.parent.CalendarConfiguration&&null!=typeof window.parent.CalendarConfiguration.model&&void 0!==window.parent.CalendarConfiguration.model.CalenderDetails&&void 0!==window.parent.CalendarConfiguration.model.CalenderDetails.IsZoomIntegreted&&1==window.parent.CalendarConfiguration.model.CalenderDetails.IsZoomIntegreted?($(_vgClassSessionSelection.Controls.ddlFilterTypes).val(_vgClassSessionSelection.StreamingFilterType.InHouseAndLiveStream),$(_vgClassSessionSelection.Controls.dvStreamType).show(),$("#divSearchForClass").removeClass("no-StreamType")):($(_vgClassSessionSelection.Controls.ddlFilterTypes).val(_vgClassSessionSelection.StreamingFilterType.InHouse),$(_vgClassSessionSelection.Controls.dvStreamType).hide(),$("#divSearchForClass").addClass("no-StreamType"))},LoadEventForClassControl:function(){$("#txtQuantity, #txtNoofAttendees").blur(function(){_vgClassSessionSelection.CalculateSessionPrice(),_vgClassSessionSelection.ShowDiscountOnEvent()}),$("#txtQuantity, #txtNoofAttendees").change(function(){_vgClassSessionSelection.CalculateSessionPrice(),_vgClassSessionSelection.ShowDiscountOnEvent()}),$("#txtAddtocartQuantity").applyupdown();var e=iPadAndroid?"touchstart":"click";$("#txtQuantity").applyupdown(!0,e),$("#txtNoofAttendees").applyupdown(!0,e),$(".cancel-select-service").on("touchstart click",function(e){e.preventDefault(),e.stopPropagation(),$("#select2-drop-mask").click()}),$("#accordion").on("show.bs.collapse",function(e){$(".panel-collapse").removeClass("show");var t=0-$(".familyclassheight").scrollTop(),i=$(window).height();$(e.target).css("top",t+"px");var a=$(".panel-heading").width();$(".ffattendeelist-bg").attr("style","Width:"+a+"px");var r=$(e.target).attr("style");$(e.target).css({visibility:"hidden",display:"block"});var o=$(e.target).find(".ffattendeelist-bg").height(),n=$(e.target).find(".ffattendeelist-bg").position().top+t;$(e.target).attr("style",r||""),o+n+10>i&&$(e.target).css("top",t-(o+54)+"px")}),$("div#divClassDetailpopup div#classDetailpopup div.modal-content.familyclassheight").on("scroll",function(e){var t=$("div.panel-collapse.attendeelist.collapse.show",e.target);void 0!==t&&null!=t&&t.length>0&&($(t).css("height","0px"),$("#divAddonPopupSection").addClass("scrollbackhide"),$(t).parent().find("a.tocollapse").click())})},SetPriceTaxSwitch:function(e){e.lstOnlineServiceDetail.length>0&&1==e.lstOnlineServiceDetail[0].IsIncludeTaxInOnlinePricing&&displayPriceWithTaxRegion.includes(groupID)?hdnPriceWithTaxSwitch.value="1":hdnPriceWithTaxSwitch.value="0"},LoadClassTab:function(e){if(1==_vgClassSessionSelection.model.IsOnline){if("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("classes"),_common.backtoTopHide(),_common.ScrollToToZero(),"true"==IsBlockBook.toLowerCase())return void _vgClassSessionSelection.HideShowDisableBookMessageForClass(!0);_vgClassSessionSelection.HideShowDisableBookMessageForClass(!1),"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)&&(_shopdetail.providerID=_common.isCreateLinkPreserve(!1),_shopdetail.serviceID="undefined"!=getCookie("ServiceID")?getCookie("ServiceID"):"")}else _shopdetail.providerID="undefined"!=getCookie("ProviderID")?getCookie("ProviderID"):"",_shopdetail.serviceID="undefined"!=getCookie("ServiceID")?getCookie("ServiceID"):"";if($(".scrollme").removeClass("scrollme"),$("#hdnClassIDForClass").val(""),$("#hdnInstructorIDForClass").val(""),_shopdetail.LiveStreamSignUp="undefined"!=getCookie("LiveStreamSignUp")?getCookie("LiveStreamSignUp"):"",null!=d)isFromReschedual="false",$("#hdnRescheduleDetail").val(""),_vgClassSessionSelection.RemoveAllControlsForClass(),_vgClassSessionSelection.BindDropDownForClass(),_shopdetail.providerID>0&&_vgClassSessionSelection.SetOnlIneBookingDetailForClass(),_vgClassSessionSelection.FillClassDatesForClass(),void 0!==_shopdetail&&void 0!==_shopdetail.BusinessStartTime&&"undefined"!=d.clsTimeZone&&null!=d.clsTimeZone&&_shopdetail.BusinessStartTime(d.clsTimeZone.TIME_ZONE,d.clsTimeZone.CountryID,d.clsTimeZone.CUSTOM_DAY_LIGHT_SAVING);else{bkEvent.init(),bkEvent.IsSelectedFromPopUp=!1,bkClassAvailableDates.init();var t=new vagaro.ajax;t.datamodel.IsNewVagaroAPI=!0,t.datamodel.Token=a.getonlinebookingtabdetail,t.datamodel.Error=_vgClassSessionSelection.CallFailed2;var i={businessID:1==_vgClassSessionSelection.model.IsOnline?businessID:BusinessID,shouldIncludePakcage:!1,loadClasses_Service_Both:!0,isFromOffline:0==_vgClassSessionSelection.model.IsOnline};"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)&&(i.ServiceID=$.isNumeric(_shopdetail.serviceID)?_shopdetail.serviceID:""),_vgClassSessionSelection.GetWBTypeQuerySting()&&_vgClassSessionSelection.GetWBEventQuerySting()?(i.IsNewWebsiteBuilder=!0,i.IncludededClassId=_vgClassSessionSelection.getWBClassIdsData("IncludedIds"),i.ExcludededClassId=_vgClassSessionSelection.getWBClassIdsData("ExcludedIds"),i.IsAllowAllLocation=_vgClassSessionSelection.getWBIsAllowAlllocation()):(i.IsNewWebsiteBuilder=!1,i.IncludededClassId="",i.ExcludededClassId="",i.IsAllowAllLocation=!1),i.Referral=!!getCookie("Referral"),t.datamodel.data=i,t.datamodel.callback=function(e){if(null!=e){if(_vgClassSessionSelection.SetPriceTaxSwitch(e),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&(_shopdetail.GetWidgetServicesDetail(),!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail)&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail.ServiceIds))){var t=_shopdetail.WidgetServicesDetail.ServiceIds.split("|"),i="";if(t.length>1&&!String.isNullOrUndefineOrBlank(t[1])?i=t[1]:1==t.length&&(i=_shopdetail.WidgetServicesDetail.ServiceIds),!String.isNullOrUndefineOrBlank(i)){if(null!=e.lstOnlineServiceDetail&&e.lstOnlineServiceDetail.length>0){var a=0,r=$.extend(!0,[],e.lstOnlineServiceDetail);e.lstOnlineServiceDetail=$.map(e.lstOnlineServiceDetail,function(e){if(1==_onlineCheckout.CheckFileType(e.serviceID.toString(),i))return a=1,e}),0==a&&0==IsFromMultiLocation&&(e.lstOnlineServiceDetail=r)}if(null!=e.lstOnlineServiceParent&&e.lstOnlineServiceParent.length>0){a=0;var o=0,n=$.extend(!0,[],e.lstOnlineServiceParent);e.lstOnlineServiceParent=$.map(e.lstOnlineServiceParent,function(e){if(1==_onlineCheckout.CheckFileType(e.id.toString(),i)&&(e.children=$.map(e.children,function(e){if(1==_onlineCheckout.CheckFileType(e.id.toString(),i))return a=1,e}),e.children.length>0))return o=1,e}),0==a&&0==o&&0==IsFromMultiLocation&&(e.lstOnlineServiceParent=n)}}}var s=!1,l=null;if(1==_vgClassSessionSelection.model.IsOnline)s=_siteBuilderDetail.ComponentResponse.lstBusinessDetail.IsDisplayPhoneNumber,l=_siteBuilderDetail.ComponentResponse.lstBusinessDetail.Telephone;if(e.lstOnlineServiceParent.length<=0)1==s&&(null!=l||l.length>=10)?(_vgClassSessionSelection.ShowCalltoBook(l),$("#divEmptystate").hide()):(1==_vgClassSessionSelection.model.IsOnline?$("#divEmptystate").show():($("#divSearchCustCls").hide(),$("#divEmptystate").css("display","flex"),$("#divClsEmpty").html("There are no classes available.")),$("#divcalltobook").hide());else if(e.lstOnlineServiceProviderDetail.length<=0||"undefined"!=typeof _common&&1==_common.IsInActiveOnlineBooking(e.lstOnlineServiceProviderDetail))$("#hdnServiceProviderExists").val(!1),1==s&&(null!=l||l.length>=10)?(_vgClassSessionSelection.ShowCalltoBook(l),$("#divEmptystate").hide()):(1==_vgClassSessionSelection.model.IsOnline?$("#divEmptystate").show():($("#divSearchCustCls").hide(),$("#divEmptystate").css("display","flex"),$("#divClsEmpty").html("There are no classes available.")),$("#divcalltobook").hide());else{if($("#divSearchCustCls").show(),$("#hdnServiceProviderExists").val(!0),_vgClassSessionSelection.RemoveAllControlsForClass(),(d=e).lstOnlineServiceParent=$.grep(d.lstOnlineServiceParent,function(e){return 2==e.eventType&&(e.children=$.grep(e.children,function(e){return 1==e.isOnlineService})),e}),_vgClassSessionSelection.BindDropDownForClass(),"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()||"true"==isFromRebook.toLowerCase()||_shopdetail.providerID>0||"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)||"undefined"!=typeof isGoogle&&"true"==isGoogle.toLowerCase())_vgClassSessionSelection.SetOnlIneBookingDetailForClass(),"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&0==_vgClassSessionSelection.model.IsOnline&&$("#txtService5").select2("disable");else if("undefined"!=typeof isWaitingtoreal&&"undefined"!=typeof waitlistID&&"undefined"!=typeof WaitlistMain&&"undefined"!=typeof WaitlistEventType&&1==isWaitingtoreal&&0!=waitlistID&&null!=WaitlistMain&&WaitlistEventType==m){null!=WaitlistMain.lstServiceSPForRealAppointment&&WaitlistMain.lstServiceSPForRealAppointment.length>0&&_vgClassSessionSelection.SetClassDataForClass(WaitlistMain.lstServiceSPForRealAppointment[0].ServiceID,WaitlistMain.lstServiceSPForRealAppointment[0].ActualProviderID);var c;c=moment(new Date(WaitlistMain.StartTime)).format("MMM DD,YYYY"),_shopdetail.bookingDateTime=c,WaitlistMain=null}void 0!==_shopdetail&&void 0!==_shopdetail.BusinessStartTime&&"undefined"!=e.clsTimeZone&&null!=e.clsTimeZone&&_shopdetail.BusinessStartTime(e.clsTimeZone.TIME_ZONE,e.clsTimeZone.CountryID,e.clsTimeZone.CUSTOM_DAY_LIGHT_SAVING),_vgClassSessionSelection.FillClassDatesForClass()}e.lstOnlineServiceDetail[0]}},t.Post()}1==_vgClassSessionSelection.model.IsOnline&&(redirecttodevicetabname=ClassTabName)},HideShowDisableBookMessageForClass:function(e){e?($("#divBlockBookMessageForClass").show(),$("#divClassAppResultForClass").hide(),$("#divEmptystate").hide()):($("#divBlockBookMessageForClass").hide(),$("#divClassAppResultForClass").show())},RemoveAllControlsForClass:function(){$("#txtService5").select2("data",{id:"",text:""}),_vgClassSessionSelection.SetDefaultForSeleect2($("#txtService5")),$("#txtService5").select2("enable"),$("#divSearchForClass").removeClass("no-serviceselection"),$("#txtSP5").select2("data",{id:"",text:""}),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#txtSP5Mobile").val(""),_vgClassSessionSelection.SetDefaultForSeleect2($("#txtSP5"))},BindDropDownForClass:function(){if(null!=d){var e={dropdownCssClass:"service-what-dropdown service-commondrop service-book-drop classAppSelectNew",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Any Class"};e.collapasable=_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0,e.selectAllText=$("#mobile-check").is(":visible"),e.scrollTop=$("#mobile-check").is(":visible");var t=$("#cboServiceProviderWaitlist_Search");if(d.lstOnlineServiceParent.length>0&&(e.data=d.lstOnlineServiceParent,window.location.href.toLowerCase().indexOf("businesswidget.aspx")>0)){var i=d.lstOnlineServiceParent;try{if(null!=i&&1===i.length&&"undefined"!==i[0].children&&null!=i[0].children&&1===i[0].children.length){var a=i[0].children[0];if($("#hdnClassIDForClass").val(a.id),$("#txtService5").val(a.id).trigger("change"),_vgClassSessionSelection.SetChoiceForSeleect2($("#txtService5"),a),$(".service-namepromo","#divdd-select-search5").html(a.text),a.promotext&&""!==a.promotext){var r=a.isCurrencySymbol?currencySymbol+a.promotext:a.promotext;$(".promo-digit","#divdd-select-search5").html('<div class="vg-service-video"><em></em><span>'+r+"</span></div>"),$("#divdd-select-search5").show()}else $(".promo-digit","#divdd-select-search5").html(""),$(".promo-digit").hide(),$("#divdd-select-search5").show()}}catch(e){}}$("#txtService5").length>0&&new _vgClassSessionSelection.ApplySelect2Controls($("#txtService5"),e);var o=!0;if(null!=_shopdetail.serviceID&&""!=_shopdetail.serviceID){var n=$.extend(!0,[],d.lstOnlineServiceParent),s=_vgClassSessionSelection.GetSelectedServiceDetail(n,_shopdetail.serviceID);t.data("selecteddetail",JSON.stringify(s)),null!=s&&(_vgClassSessionSelection.SetChoiceForSeleect2(t,s),t.select2("data",{id:s.id,text:s.text}),$("#hdnClassIDForClass").val(s.id),_vgClassSessionSelection.bindMobilefilterdata(t,s.id),1==s.hasOwnProperty("eventType")&&void 0!==s.promotext&&""!=s.promotext&&1==(o=_vgClassSessionSelection.ClassPromotionForNewCustomer(s))&&($(".service-namepromo","#divdd-select-search5").html(s.text),$(".promo-digit","#divdd-select-search5").html('<div class="vg-service-video"><em></em><span>'+(1==s.isCurrencySymbol?currencySymbol+s.promotext:s.promotext)+"</span></div>"),$("#divdd-select-search5").show()))}var l={dropdownCssClass:"service-providerdrop classAppSelectNew",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Any Instructor"};if(l.data=d.lstOnlineServiceProviderDetail,l.collapasable=!1,$("#cboServiceProviderWaitlist_Search").length>0&&new _vgClassSessionSelection.ApplySelect2Controls($("#txtSP5"),l),_vgClassSessionSelection.BindServiceProvideReInit("cboServiceProviderWaitlist_Search"),selectedValues=0,"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)&&(String.isNullOrUndefineOrBlank(_shopdetail.providerID)||0==_shopdetail.providerID?(_shopdetail.providerID=_common.isCreateLinkPreserve(!1),selectedValues=_shopdetail.providerID):selectedValues=_shopdetail.providerID,(String.isNullOrUndefineOrBlank(_shopdetail.serviceID)||0==_shopdetail.serviceID)&&(_shopdetail.serviceID=getCookie("ServiceID"))),_vgClassSessionSelection.GetWBTypeQuerySting()&&_vgClassSessionSelection.GetWBEventQuerySting()){var c=_vgClassSessionSelection.GetClassIDForWB();void 0!==c&&null!=c&&""!=c&&(_shopdetail.serviceID=parseInt(c))}0==selectedValues&&null!=_shopdetail.PromotionProviderID&&null!=_shopdetail.serviceID&&""!=_shopdetail.serviceID?(selectedValues=_shopdetail.PromotionProviderID.split(","),_vgClassSessionSelection.SetClassDataForClass(_shopdetail.serviceID,selectedValues),o&&($("#hdnInstructorIDForClass").val(_shopdetail.PromotionProviderID),$("#cboServiceProviderWaitlist_Search").data("ClassPromotionProviderID",_shopdetail.PromotionProviderID)),$("#cboServiceProviderWaitlist_Search").val(selectedValues).trigger("change")):_vgClassSessionSelection.BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search",selectedValues),"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)&&$("#cboServiceProviderWaitlist_Search").attr("disabled","disabled")}$(".service-searchinput input").attr("autocomplete","off")},SetOnlIneBookingDetailForClass:function(){if(_vgClassSessionSelection.model.IsSearchFromInHouseClass||"true"==isGoogle&&(microServiceID=_shopdetail.serviceID),"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()){var e={};e.EventSessionAttendeesId=parseInt(EventSessionAttendeesId),e.serviceID=parseInt(_shopdetail.serviceID),e.providerID=parseInt(_shopdetail.providerID),$("#hdnRescheduleDetail").val(JSON.stringify(e))}(null!=_shopdetail.serviceID&&""!=_shopdetail.serviceID||null!=_shopdetail.providerID&&""!=_shopdetail.providerID)&&1!=_shopdetail.isClassCalenderFilled?(ShowLoader(!0),0!=$("#hdnServiceProviderExists").val()?_vgClassSessionSelection.SetClassDataForClass(_shopdetail.serviceID,_shopdetail.providerID):ShowLoader(!1)):ShowLoader(!1)},SetClassDataForClass:function(e,t){var i=new Array;""!=t&&0!=t&&null!=t||("undefined"!=typeof _common&&void 0!==_common.IsWidgetForServiceProvider&&1==_common.IsWidgetForServiceProvider(!0)?t=_common.IsWidgetForServiceProvider(!1):"true"==isGoogle&&(t="-1")),Array.isArray(t)?i=t:$.grep(t.toString().split(","),function(e){i.push(e)}),"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)&&(String.isNullOrUndefineOrBlank(_shopdetail.providerID)&&0==_shopdetail.providerID||Array.isArray(_shopdetail.providerID)?(_shopdetail.providerID=_common.isCreateLinkPreserve(!1),i=_shopdetail.providerID):i=_shopdetail.providerID.split(","),(String.isNullOrUndefineOrBlank(_shopdetail.serviceID)||0==_shopdetail.serviceID)&&(_shopdetail.serviceID=getCookie("ServiceID"))),_vgClassSessionSelection.BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search",i);var a="undefined"!=typeof _common?_common.isCreateLinkPreserve(!1):"";if("undefined"==typeof _common||!_common.isCreateLinkPreserve(!0,!0)||Array.isArray(a)&&"-1"==a.join(",")||$("#cboServiceProviderWaitlist_Search").attr("disabled","disabled"),null!=t&&""!=t&&t>0&&null!=d){var r=$.extend(!0,[],d.lstOnlineServiceProviderDetail);if(null!=(n=_vgClassSessionSelection.GetSelectedSPDetail(r,t))){var o=$("#txtSP5");o.data("selecteddetail",JSON.stringify(n)),void 0!==o.data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2(o,n),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#txtSP5Mobile").val(n.id),o.select2("data",{id:n.id,text:n.text})}$("#hdnInstructorIDForClass").val(t)}else $("#hdnInstructorIDForClass").val("");if(null!=e&&""!=e&&parseInt(e)>0&&null!=d){var n;r=$.extend(!0,[],d.lstOnlineServiceParent);if(null!=(n=_vgClassSessionSelection.GetSelectedServiceDetail(r,e))){var s=$("#txtService5");_vgClassSessionSelection.SetControls(n.eventType),s.data("selecteddetail",JSON.stringify(n)),void 0!==s.data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2(s,n),s.select2("data",{id:n.id,text:n.text})}$("#hdnClassIDForClass").val(e)}else $("#hdnClassIDForClass").val("");var l=new Array;l.push(t),"undefined"!=typeof _common&&_common.isCreateLinkPreserve(!0,!0)&&(String.isNullOrUndefineOrBlank(_shopdetail.providerID)&&0==_shopdetail.providerID||Array.isArray(_shopdetail.providerID)?_shopdetail.providerID=_common.isCreateLinkPreserve(!1):l=_shopdetail.providerID.split(","),(String.isNullOrUndefineOrBlank(_shopdetail.serviceID)||0==_shopdetail.serviceID)&&(_shopdetail.serviceID=getCookie("ServiceID"))),_vgClassSessionSelection.BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search",l);var c="undefined"!=typeof _common?_common.isCreateLinkPreserve(!1):"";"undefined"==typeof _common||!_common.isCreateLinkPreserve(!0,!0)||Array.isArray(c)&&"-1"==c.join(",")||$("#cboServiceProviderWaitlist_Search").attr("disabled","disabled")},IsWidgetForServiceProvider:function(e){return!String.isNullOrUndefineOrBlank(_shopdetail.isWidget)&&"true"==_shopdetail.isWidget&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetSpId)&&_shopdetail.WidgetSpId>0&&(1==e||_shopdetail.WidgetSpId)},BindServiceProviderWaitlistSetValue_Serachpopup:function(e,t){$("#"+e).val(t);$("#"+e+" option:selected").val();var i="Select Professional";"undefined"!=typeof lServiceID&&null!=lServiceID&&""!=lServiceID&&"-1"!=lServiceID?(i=$("#"+e+" option:selected").text(),$("#select2-"+e+"-container").attr("title",i),$("#select2-"+e+"-container").html(i)):($("#select2-"+e+"-container").attr("title",i),$("#select2-"+e+"-container").html(i))},BindServiceProvideReInit:function(e){$("#"+e).pumselect2().on("select2:open",function(e){$("span.select2-container.select2-container--default.select2-container--open").addClass("fullServiceAjax-dropdownList"),$("span.select2-container.select2-container--default.select2-container--open").addClass("presetdiscount-dropdownMultiCustom"),$("span.select2-container.select2-container--default.select2-container--open").addClass("vagaro-dropdown-multiselect"),$("span.select2-container.select2-container--default.select2-container--open").addClass("serviceProviderCust"),$("span.select2-container.select2-container--default.select2-container--open").addClass("dd-service-dropdown"),$("span.select2-container.select2-container--default.select2-container--open").addClass("deal-service-dropdown"),$("span.select2-container.select2-container--default.select2-container--open").addClass("dd-class-dropdown-css"),$("span.select2-container.select2-container--default.select2-container--open").addClass("inMobileFullscreeen"),$("span.select2-container.select2-container--default.select2-container--open").addClass("multi-serarchbox-design")})},BindServiceProviderWaitlist_Serachpopup:function(e,t){var i;""!=t&&0!=t&&null!=t||"undefined"!=typeof _common&&void 0!==_common.IsWidgetForServiceProvider&&1==_common.IsWidgetForServiceProvider(!0)&&(t=_common.IsWidgetForServiceProvider(!1),$("#cboServiceProviderWaitlist_Search").attr("disabled","disabled"),$("#hdnInstructorIDForClass").val(t));var a=$("#"+e);void 0!==a.data("select2")&&a.pumselect2("destroy"),a.pumselect2({placeholder:"Service Provider",closeOnSelect:!1,templateResult:function(e){if(!e.id)return e.text;var t=a.data("ClassPromotionProviderID");if(void 0!==a.data("ClassPromotionProviderID")&&null!=a.data("ClassPromotionProviderID")||(t=""),""!==t&&t.split(",").includes(e.id)&&0==e.disabled){var r=getCookie("Referral");if(void 0===r||""==r||null==r||null==r){if(void 0!==i&&null!=i&&!i.IsDailyDealApply)var o=$('<span class="multicheck-checkbox"></span><label class="labelpadd">'+e.text+'<div class="promo-digit percent-off-text w-inline-block badge-button-positive ml-2 srv-badge-title-promo srv-drp-bedge"><div class="vg-service-video"><em>&#xf02b</em><span>Daily Deal</span></div></div></label')}else o=$('<span class="multicheck-checkbox"></span><label class="labelpadd">'+e.text+'<div class="promo-digit percent-off-text w-inline-block badge-button-positive ml-2 srv-badge-title-promo srv-drp-bedge"><div class="vg-service-video"><em>&#xf02b</em><span>Daily Deal</span></div></div></label')}else o=$('<span class="multicheck-checkbox"></span><label class="labelpadd">'+e.text+"</label>");return o}}).on("select2:open",function(e){$("span.select2-container.select2-container--default.select2-container--open").addClass("fullServiceAjax-dropdownList"),$("span.select2-container.select2-container--default.select2-container--open").addClass("presetdiscount-dropdownMultiCustom"),$("span.select2-container.select2-container--default.select2-container--open").addClass("serviceProviderCust"),$("span.select2-container.select2-container--default.select2-container--open").addClass("dd-service-dropdown"),$("span.select2-container.select2-container--default.select2-container--open").addClass("deal-service-dropdown"),$("span.select2-container.select2-container--default.select2-container--open").addClass("dd-class-dropdown-css"),$("span.select2-container.select2-container--default.select2-container--open").addClass("inMobileFullscreeen"),$("span.select2-container.select2-container--default.select2-container--open").addClass("multi-serarchbox-design");var t=$("#cboServiceProviderWaitlist_Search > option").length+1!=$("#cboServiceProviderWaitlist_Search  :selected").length&&0!=$("#cboServiceProviderWaitlist_Search  :selected").length?$("#cboServiceProviderWaitlist_Search").val().join(","):"";(t=t.split(","),_vgClassSessionSelection.commonProperty.MultiSPIdOpen=t,_vgClassSessionSelection.commonProperty.MultiSPIsClose=!1,$("#mobile-check").is(":visible")&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof IsSupportNewDialogApp&&IsSupportNewDialogApp)?CallbackforMobileApp(0,0,"","",0,"50|~|"+('{\\"returnObject\\": {\\"ControlId\\": \\"'+("#"+e.currentTarget.id)+'\\"}}')):$(".dd-employee-btn").show();$(".select2-search__field",".inMobileFullscreeen").attr("placeholder","Search Instructors"),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.VisibleControlLength&&_shopdetail.VisibleControlLength("#mobile-check")>0&&($(".dd-mobile-emp-heading").text("Instructor"),$(".dd-mobile-emp-heading").show()),setTimeout(function(){$("html, body").scrollTop(0)},20)}).on("select2:close",function(e){if(!_vgClassSessionSelection.commonProperty.MultiSPIsClose){var t=$("#cboServiceProviderWaitlist_Search > option").length+1!=$("#cboServiceProviderWaitlist_Search  :selected").length&&0!=$("#cboServiceProviderWaitlist_Search  :selected").length?$("#cboServiceProviderWaitlist_Search").val().join(","):"";$("#hdnInstructorIDForClass").val(t),t=t.split(","),_vgClassSessionSelection.CompareTwoArray(t,_vgClassSessionSelection.commonProperty.MultiSPIdOpen)||_vgClassSessionSelection.FillClassDatesForClass()}_vgClassSessionSelection.commonProperty.MultiSPIsClose=!0,$("#mobile-check").is(":visible")&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof IsSupportNewDialogApp&&IsSupportNewDialogApp&&CallbackforMobileApp(0,0,"","",0,"50|~|2"),$(".dd-employee-btn").hide(),$(".dd-mobile-emp-heading").hide()}),a.empty(),$('input[type="search"]').attr("readonly",!0),$('input[type="search"]').css("cursor","pointer");var r=JSON.parse($("#hdnStrSpList").val()),o=$.extend(!0,[],r),n=$.extend(!0,[],r);"GCPromo"==$("#txtService5").data("type")&&$("#txtService5").data("GCPromoList",n);var s=$("#txtService5").data("choice");if(""!=s)try{var l=JSON.parse(s);l.hasOwnProperty("id")&&""!=l.id&&(o=_vgClassSessionSelection.FilterSPOffline(n,l)),i=l}catch(e){}$.grep(o,function(e){0==e.isServiceProvide?(void 0!==t&&null!=t&&""!=t&&(t=jQuery.grep(t,function(t){return t!=e.ServiceProviderID})),a.append($("<option disabled></option>").val(e.ServiceProviderID).html(e.ServiceProviderName))):a.append($("<option></option>").val(e.ServiceProviderID).html(e.ServiceProviderName))}),a.data("isSkipChangeEvent",!0);try{var c="#"+e;if(1==$(c+" > option").length){var u=new Array;u.push($(c+" > option").val()),a.val(u).trigger("change"),$(c).attr("disabled","disabled")}else window.location.href.toLowerCase().indexOf("businesswidget.aspx")>0&&void 0!==d.lstOnlineServiceParent&&null!=d.lstOnlineServiceParent&&d.lstOnlineServiceParent.length>0&&1===d.lstOnlineServiceParent[0].children.length&&(t=_common.IsWidgetForServiceProvider(!1)),void 0!==t&&null!=t&&""!=t?a.val(t).trigger("change"):a.val("").trigger("change")}catch(e){a.val("").trigger("change")}},CompareTwoArray:function(e,t){if(e.length!=t.length)return!1;var i=jQuery.extend(!0,[],e),a=jQuery.extend(!0,[],t);i.sort(),a.sort();for(var r=0,o=i.length;r<o;r++)if(i[r]!==a[r])return!1;return!0},GetSelectedSPDetail:function(e,t){var i=$.grep(e,function(e){return e.id==t});return i.length>0?i[0]:null},GetSelectedServiceDetail:function(e,t){var i=$.grep(e,function(e){var i=$.grep(e.children,function(e){return e.id==t});return null!=i&&i.length>0&&(e.children=i,!0)});return i.length>0&&i[0].children.length>0?i[0].children[0]:null},ApplySelect2Controls:function(e,t){void 0!==t.placeholder&&""!=t||((t={}).dropdownCssClass="",t.isSearchRequire=!1,t.selectOnClick=!0,t.placeholder="",t.maxInputLen=100),void 0===t.maxInputLen&&(t.maxInputLen=100),"2"==e.data("type")&&void 0!==t.data&&_vgClassSessionSelection.bindMobileOptions(t.data,e.attr("id"),""),e.select2("destroy"),e.off("selected"),e.off("select2-close"),e.select2({searchInputPlaceholder:void 0!==t.placeholder&&""!=t.placeholder?t.placeholder:"",combobox:t.isSearchRequire,collapasable:_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&t.collapasable,selectOnClick:!0,minimumInputLength:0,maximumInputLength:100,dropdownCssClass:t.dropdownCssClass,formContainer:"#page-wrapper",data:function(){if(void 0!==t.data){var i=$.extend(!0,[],t.data),a=$.extend(!0,[],t.data);if("GCPromo"==e.data("type")&&e.data("GCPromoList",a),"2"==e.data("type")){var r=$("#txtService"+e.data("section")).data("choice");if(""!=r)try{var o=JSON.parse(r);o.hasOwnProperty("id")&&""!=o.id&&(i=_vgClassSessionSelection.FilterSP(a,o))}catch(e){}var n={id:"-1"};0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName?n.text="Select Any Instructor":n.text="Select Any Provider",n.cssClass="currentlocation-icon",n.type="Any",i.splice(0,0,n)}else if("1"==e.data("type")){var s=$("#txtSP"+e.data("section")).data("choice");if(""!=s)try{var l=JSON.parse(s);if(l.hasOwnProperty("id")&&""!=l.id&&(i=_vgClassSessionSelection.FilterService(a,l)),0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName){n={id:"-1",text:"Select Any Class",cssClass:"currentlocation-icon",type:"Any"};i.splice(0,0,n)}}catch(e){}}return{results:i}}return null},initSelection:function(e,t){},formatResult:function(t){var i=_vgClassSessionSelection.ClassPromotionForNewCustomer(t),a=getCookie("Referral");return(void 0===a||""==a||null==a||null==a)&&t.IsDailyDealApply?1==t.hasOwnProperty("eventType")&&void 0!==t.IsZoomIntegrated&&1==t.IsZoomIntegrated?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+t.text+'</div> <div class="w-inline-block font-awesome solid sm-booknow-video">&#xf03d;<div></div>':1==t.hasOwnProperty("eventType")&&void 0!==t.isOutCallService&&1==t.isOutCallService?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+t.text+'</div> <div class="w-inline-block font-awesome solid sm-car-icon">&#xf1b9;<div></div>':markup=t.text:"GCPromo"!=e.data("type")||void 0===t.promotext||""==t.promotext||_vgClassSessionSelection.model.IsSearchFromInHouseClass?1!=t.hasOwnProperty("eventType")||void 0===t.promotext||""==t.promotext||_vgClassSessionSelection.model.IsSearchFromInHouseClass?1==t.hasOwnProperty("eventType")&&void 0!==t.IsZoomIntegrated&&1==t.IsZoomIntegrated?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+t.text+'</div> <div class="w-inline-block font-awesome solid sm-booknow-video">&#xf03d;<div></div>':1==t.hasOwnProperty("eventType")&&void 0!==t.isOutCallService&&1==t.isOutCallService?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+t.text+'</div> <div class="w-inline-block font-awesome solid sm-car-icon">&#xf1b9;<div></div>':markup=t.text:void 0!==t.IsZoomIntegrated&&1==t.IsZoomIntegrated?markup='<div class="promodigittextrow"> <div class="service-namepromo w-inline-block">'+t.text+'</div><div><div class="promo-digit percent-off-text w-inline-block badge-button-alert">'+(1==t.isCurrencySymbol?currencySymbol+t.promotext:t.promotext)+' </div> <div class="w-inline-block font-awesome solid sm-booknow-video">&#xf03d;<div></div> </div>':1==t.hasOwnProperty("eventType")&&void 0!==t.isOutCallService&&1==t.isOutCallService?markup='<div class="promodigittextrow"> <div class="service-namepromo w-inline-block">'+t.text+'</div><div><div class="promo-digit percent-off-text w-inline-block badge-button-alert">'+(1==t.isCurrencySymbol?currencySymbol+t.promotext:t.promotext)+' </div> <div class="w-inline-block font-awesome solid sm-car-icon">&#xf1b9;<div></div> </div>':markup=1==i?'<div class="promodigittextrow srv-drp-bedge class-text-para"> <div class="service-namepromo w-inline-block">'+t.text+'</div><div><div class="promo-digit percent-off-text w-inline-block badge-button-positive srv-drp-bedge"><div class="vg-service-video"><em>&#xf02b</em><span>'+(1==t.isCurrencySymbol?currencySymbol+t.promotext:t.promotext)+"</span></div></div></div></div></div>":'<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+t.text+"</div>":markup='<div class="promodigittextrow"> <div class="w-inline-block">'+t.text+' <span class="promo-bold">('+(1==t.isCurrencySymbol?currencySymbol+t.promotext:t.promotext)+")</span></div></div>",markup},matcher:function(t,i,a){var r=/\s\s+/g,o=/[^0-9a-zA-Z\" \"]+/gi,n=/[^0-9a-zA-Z\"\. \"]+/gi;if("1"==e.data("type")){var s=t.lastIndexOf("(");-1!=s&&(t=t.substring(0,s-1))}else if("2"==e.data("type")&&("Select Any Provider"==i||"Select Any Instructor"==i))return!0;for(var l=t.replace(r," "),d=(l="GCPromo"==e.data("type")?l.toLowerCase().replace(n,""):l.toLowerCase().replace(o,"")).split(" "),c="",u=d.length,p=0,h=0;h<=d.length-1;h++){var m=i.replace(r," ");if(((m="GCPromo"==e.data("type")?m.toLowerCase().replace(n,""):m.toLowerCase().replace(o,"")).match("^"+d[h])||-1!=m.indexOf(" "+d[h]))&&((""==c||d[h].indexOf(c)<0)&&(p+=1),c=" "+m,p>=u))break}return p>=u&&("#txtGCPromoAmount"==e.selector&&$("#select2-drop").show(),a.isShow=!0,!0)},formatNoMatches:function(){if("#txtGCPromoAmount"!=e.selector)return $(".select2-results .select2-no-results").remove(),"No matches found";$("#select2-drop").hide()}}).on("selected",function(t){if(_vgClassSessionSelection.closeServiceSelection(),"txtService5"==t.currentTarget.id||"txtSP5"==t.currentTarget.id){"txtService5"==t.currentTarget.id?-1==t.choice.id?$("#hdnClassIDForClass").val(""):$("#hdnClassIDForClass").val(t.choice.id):"txtSP5"==t.currentTarget.id&&(-1==t.choice.id?$("#hdnInstructorIDForClass").val(""):$("#hdnInstructorIDForClass").val(t.choice.id)),_vgClassSessionSelection.FillClassDatesForClass(),_vgClassSessionSelection.bindMobilefilterdata(e,t.choice),$(t.target).data("selecteddetail",JSON.stringify(t.choice)),void 0!==e.data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2(e,t.choice);var i=$("#cboServiceProviderWaitlist_Search > option").length+1!=$("#cboServiceProviderWaitlist_Search  :selected").length&&0!=$("#cboServiceProviderWaitlist_Search  :selected").length?$("#cboServiceProviderWaitlist_Search").val().join(","):"";return i=i.split(","),_vgClassSessionSelection.BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search",i),void(_vgClassSessionSelection.ClassPromotionForNewCustomer(t.choice)?$("#cboServiceProviderWaitlist_Search").data("ClassPromotionProviderID",t.choice.PromotionProviders):$("#cboServiceProviderWaitlist_Search").data("ClassPromotionProviderID",null))}if("GCPromo"==e.data("type")&&(_vgClassSessionSelection.bindMobilefilterdata(e,t.choice),$(t.target).data("selecteddetail",JSON.stringify(t.choice)),void 0!==e.data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2(e,t.choice)),"1"==e.data("type")){$("#hdnStyleID").val(""),_shopdetail.PromotionID="",_vgClassSessionSelection.clearCookie("PromotionID"),$("#hdnPromotionID").val("");var a=!1;if(void 0!==e.data("isstatic")){var r=null,o=$("#txtService1").data("selecteddetail");if(""!=o)try{r=JSON.parse(o).eventType}catch(t){r=null}(null!=r&&t.choice.eventType!=r||t.choice.eventType==p)&&(_vgClassSessionSelection.RemoveAllControls(),t.choice.eventType==h&&_vgClassSessionSelection.GetAvailibilityForService(!1,!1),1==_shopdetail.isClassCalenderFilled&&t.choice.eventType==m&&(a=!0)),null==r||(r!=p&&r!=h||t.choice.eventType!=m)&&(r!=m||t.choice.eventType!=p&&t.choice.eventType!=h)||t.choice.eventType!=p&&t.choice.eventType!=h||HideShowClassServiceAndClearControl(!1)}_vgClassSessionSelection.SetControls(t.choice.eventType),HideShowWaitlistButton(!1),t.choice.eventType==p?($("#divSearch").addClass("no-serviceselection"),$("#mobile-appointments").prop("checked",!1),$("#dvOutCallSection").hide(),$("#Book24Container").hide(),$("#ucServiceCombo_hidEventType").val(""),_vgClassSessionSelection.SetServiceBundle(t.choice.id),_vgClassSessionSelection.GetAvailibilityForService(!0,!1)):(_vgClassSessionSelection.bindMobilefilterdata(e,t.choice),$("#divSearch").removeClass("no-serviceselection"),$("#ucServiceCombo_hidEventType").val(t.choice.eventType.toString()),_vgClassSessionSelection.AddServiceButtonDisplay(),$("#Book24Container").hide()),t.choice.eventType==h?1==_vgClassSessionSelection.OutCallCalculation(e.data("section"),t.choice)&&($(t.target).data("selecteddetail",JSON.stringify(t.choice)),void 0!==e.data("choice")&&(_vgClassSessionSelection.SetChoiceForSeleect2(e,t.choice),$("#txtSP"+e.data("section")).select2("enable"),1==l.lstOnlineServiceProviderDetail.length&&($("#txtSP"+e.data("section")).select2("disable"),$("#txtSP"+e.data("section")).select2("data",{id:l.lstOnlineServiceProviderDetail[0].id,text:l.lstOnlineServiceProviderDetail[0].text})))):($(t.target).data("selecteddetail",JSON.stringify(t.choice)),void 0!==e.data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2(e,t.choice)),t.choice.eventType==m&&($("#dvOutCallSection").hide(),HideShowClassServiceAndClearControl(!0),1==a||(_shopdetail.isClassCalenderFilled=!1))}else"2"==e.data("type")&&"-1"!=t.val&&_vgClassSessionSelection.onProviderSelect($(t.target),t.choice)}).on("select2-opening",function(t){e.select2("data",{id:"",text:""}),"txtGCPromoAmount"==t.currentTarget.id&&$("#"+t.currentTarget.id).data("selecteddetail",""),$("#cboServiceProviderWaitlist_Search").select2("close"),$("#cboServiceProviderWaitlist_Search1").select2("close"),$("#cboServiceProviderWaitlist_Search2").select2("close")}).on("select2-open",function(i){var a=_vgClassSessionSelection.GetChoiceForSeleect2(e);void 0!==a.id&&"txtGCPromoAmount"!=i.currentTarget.id&&e.select2("data",{id:a.id,text:a.text}),(void 0===t.selectAllText||t.selectAllText)&&setTimeout(function(){$(i.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100),($(i.target).attr("id").indexOf("txtService")>=0||"GCPromo"==e.data("type"))&&("GCPromo"==e.data("type")&&($("#dvInnerGCContainer").length&&$("#dvInnerGCContainer").addClass("gc-transformnone"),$(i.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common")),$(i.target).closest(".service-book-what").addClass("book-service-open"),setTimeout(function(){$("html, body").addClass("moboverflow-hide")},200),$("#select2-drop-mask").addClass("hidemask"),(void 0===t.scrollTop||t.scrollTop)&&setTimeout(function(){$("html, body").scrollTop(0)},50),(void 0===t.selectAllText||t.selectAllText)&&setTimeout(function(){$(i.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100))}).on("change",function(t){if(void 0!==e.data("choice")&&"2"==e.data("type")&&!e.data("select2").opened()){var i=e.data("select2").getVal().toString(),a=_vgClassSessionSelection.GetChoiceForSeleect2(e);""!=i&&void 0!==a.id&&""!=a.id||"txtSP5"!=t.currentTarget.id&&_vgClassSessionSelection.GetAvailibilityForService(!1,!0)}}).on("select2-close",function(t){if(_vgClassSessionSelection.closeServiceSelection(),$("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){$("#select2-drop-mask").off("touchstart.custom")},500),void 0!==e.data("choice")){var i=e.data("select2").getVal().toString(),a=_vgClassSessionSelection.GetChoiceForSeleect2(e);if(""!=i&&"Select Any Provider"!=i&&"Select Any Instructor"!=i&&"Select Any Class"!=i&&void 0!==a.id){var r=getCookie("Referral");if(void 0===r||""==r||null==r||null==r)if(a.IsDailyDealApply)"GCPromo"==e.data("type")?($(".txtAmounterrortext").hide(),$("#txtGCPromoAmount").removeClass("errorInput"),i==a.text?(e.select2("data",{id:a.id,text:a.text+" ("+a.promotext+")"}),"txtGCPromoAmount"==t.currentTarget.id&&$("#div_amount").html("$"+a.Price.toFixed(2).replace(".00",""))):_vgClassSessionSelection.BindGCpromoPrice(e,i)):e.select2("data",{id:a.id,text:a.text}),""==a.id&&_vgClassSessionSelection.bindMobilefilterdata($("#txtSP"+e.data("section")),null);else{if("1"!=e.data("type")||1!=a.hasOwnProperty("eventType")||void 0===a.promotext||""==a.promotext||_vgClassSessionSelection.model.IsSearchFromInHouseClass)"GCPromo"==e.data("type")?($(".txtAmounterrortext").hide(),$("#txtGCPromoAmount").removeClass("errorInput"),i==a.text?(e.select2("data",{id:a.id,text:a.text+" ("+a.promotext+")"}),"txtGCPromoAmount"==t.currentTarget.id&&$("#div_amount").html("$"+a.Price.toFixed(2).replace(".00",""))):_vgClassSessionSelection.BindGCpromoPrice(e,i)):e.select2("data",{id:a.id,text:a.text});else if(1==_vgClassSessionSelection.ClassPromotionForNewCustomer(a))e.select2("data",{id:a.id,text:a.text+" ("+(1==a.isCurrencySymbol?currencySymbol+a.promotext:a.promotext)+")"}),o=(o=e.selector).replace("txtService","divdd-select-search"),$(".service-namepromo",o).html(a.text),$(".promo-digit",o).html('<div class="vg-service-video"><em></em><span>'+(1==a.isCurrencySymbol?currencySymbol+a.promotext:a.promotext)+"</span></div>"),$(o).show();else e.select2("data",{id:a.id,text:a.text});""==a.id&&_vgClassSessionSelection.bindMobilefilterdata($("#txtSP"+e.data("section")),null)}else{var o;if("1"!=e.data("type")||1!=a.hasOwnProperty("eventType")||void 0===a.promotext||""==a.promotext||_vgClassSessionSelection.model.IsSearchFromInHouseClass)"GCPromo"==e.data("type")?($(".txtAmounterrortext").hide(),$("#txtGCPromoAmount").removeClass("errorInput"),i==a.text?(e.select2("data",{id:a.id,text:a.text+" ("+a.promotext+")"}),"txtGCPromoAmount"==t.currentTarget.id&&$("#div_amount").html("$"+a.Price.toFixed(2).replace(".00",""))):_vgClassSessionSelection.BindGCpromoPrice(e,i)):e.select2("data",{id:a.id,text:a.text});else if(1==_vgClassSessionSelection.ClassPromotionForNewCustomer(a))e.select2("data",{id:a.id,text:a.text+" ("+(1==a.isCurrencySymbol?currencySymbol+a.promotext:a.promotext)+")"}),o=(o=e.selector).replace("txtService","divdd-select-search"),$(".service-namepromo",o).html(a.text),$(".promo-digit",o).html('<div class="vg-service-video"><em></em><span>'+(1==a.isCurrencySymbol?currencySymbol+a.promotext:a.promotext)+"</span></div>"),$(o).show();else e.select2("data",{id:a.id,text:a.text});""==a.id&&_vgClassSessionSelection.bindMobilefilterdata($("#txtSP"+e.data("section")),null)}}else"GCPromo"==e.data("type")?_vgClassSessionSelection.BindGCpromoPrice(e,i):e.select2("data",{id:"",text:""}),_vgClassSessionSelection.bindMobilefilterdata($("#txtSP"+e.data("section")),null),_vgClassSessionSelection.SetDefaultForSeleect2(e)}(iPadAndroid||isWindowsPhone)&&(1==("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase())?document.activeElement.blur():$("#ancSearchbook:visible").focus())}),(e.attr("id").indexOf("txtService")>=0||"GCPromo"==e.data("type"))&&e.on("select2-focus",function(i){setTimeout(function(){"GCPromo"==e.data("type")&&($("#dvInnerGCContainer").length&&$("#dvInnerGCContainer").addClass("gc-transformnone"),$(i.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common")),$(i.target).closest(".service-book-what").addClass("book-service-open"),$("#select2-drop-mask").addClass("hidemask"),setTimeout(function(){$("html, body").addClass("moboverflow-hide")},200),(void 0===t.scrollTop||t.scrollTop)&&$("html, body").scrollTop(0)},200)}),1==_vgClassSessionSelection.model.IsOnline&&applyJqueryScroll(".select2-results")},FillClassDatesForClass:function(){var e=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);$("#lblEventCart").html(e.length);var t;if(bkClassAvailableDates.model.csvServiceID=$("#hdnClassIDForClass").val(),void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking&&($("#cboServiceProviderWaitlist_Search")[0],null!=$("#cboServiceProviderWaitlist_Search")[0]&&null!=$("#cboServiceProviderWaitlist_Search")[0]&&($("#cboServiceProviderWaitlist_Search")[0].options,1)&&null!=$("#cboServiceProviderWaitlist_Search")[0].options&&null!=$("#cboServiceProviderWaitlist_Search")[0].options)){var i=[];if($.each($("#cboServiceProviderWaitlist_Search")[0].options,function(e,t){t.selected&&i.push(t)}),0==i.length){var r=Array.from($("#cboServiceProviderWaitlist_Search")[0].options).map(function(e){return e.value});$("#hdnInstructorIDForClass").val(r.join(","))}}if(bkClassAvailableDates.model.csvSPID=$("#hdnInstructorIDForClass").val(),1==_vgClassSessionSelection.model.IsOnline){var o=getCookie("IsFilterClassCookieName");void 0!==o&&1==o&&($(_vgClassSessionSelection.Controls.ddlFilterTypes).val(_vgClassSessionSelection.StreamingFilterType.LiveStream),clearCookie("IsFilterClassCookieName"))}if(bkClassAvailableDates.model.csvFilterType=$(_vgClassSessionSelection.Controls.ddlFilterTypes).val(),null!=(t=bkClassAvailableDates.getResponseFromCache()))_vgClassSessionSelection.FillClassDatesCallbackForClass(t);else{var n=bkClassAvailableDates.model.csvServiceID,s=bkClassAvailableDates.model.csvSPID,l=bkClassAvailableDates.model.csvFilterType;void 0!==_shopdetail.lastClassBookingDateConfigured&&(_shopdetail.lastClassBookingDateConfigured=!1);var d=new vagaro.ajax;d.datamodel.Token=a.getavailabledatesforevents,d.datamodel.IsNewVagaroAPI=!0,d.datamodel.Error=_vgClassSessionSelection.CallFailed2;var c={};c.businessID=1==_vgClassSessionSelection.model.IsOnline?businessID:BusinessID,void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.getFilteredServiceProviderId&&1==_shopdetail.IsLimitOnlineBooking&&(s=_shopdetail.getFilteredServiceProviderId(s)),c.sPIDs=s,c.eventIds=n,c.isFromOffline=0==_vgClassSessionSelection.model.IsOnline,c.streamingStatus=l,"undefined"==typeof _siteBuilderDetail||String.isNullOrUndefineOrBlank(_siteBuilderDetail)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo.objUserCustomData)?c.widgetServiceId=0:c.widgetServiceId=parseInt(_siteBuilderDetail.UserLocationInfo.objUserCustomData.WidgetServiceId),_vgClassSessionSelection.GetWBTypeQuerySting()&&_vgClassSessionSelection.GetWBEventQuerySting()?(c.IsNewWebsiteBuilder=!0,c.IncludededClassId=_vgClassSessionSelection.getWBClassIdsData("IncludedIds"),c.ExcludededClassId=_vgClassSessionSelection.getWBClassIdsData("ExcludedIds"),c.IsAllowAllLocation=_vgClassSessionSelection.getWBIsAllowAlllocation()):(c.IsNewWebsiteBuilder=!1,c.IncludededClassId="",c.ExcludededClassId="",c.IsAllowAllLocation=!1),d.datamodel.data=c,ShowLoader(!0),d.datamodel.callback=_vgClassSessionSelection.FillClassDatesCallbackForClass,d.Post()}},ShowCalltoBook:function(e){var t;10==e.length&&11==e.length||(t=e.replace(/\D/g,""),e=t);var i=null;10!=e.length&&11!=e.length||(i=_vgClassSessionSelection.FormatPhone(e)),$("#divcalltobook").show(),10==e.length||11==e.length?$(".dang-description").html("Call the business to book a class: <a class='text-link-primary' style='cursor: pointer;text-decoration: underline;' href='tel:"+e+"' > "+i+"</a>."):$(".dang-description").html("Call the business to book a class: <a class='text-link-primary' style='cursor: pointer;text-decoration: underline;' href='#' > "+e+"</a>.")},FormatPhone:function(e){var t;11==e.length?t={0:"(",4:") ",7:"-"}:10==e.length&&(t={0:"(",3:") ",6:"-"});for(var i=e.replace(/\D/g,""),a=(e="",0);a<i.length;a++)e+=(t[a]||"")+i[a];return e},FilterSP:function(e,t){return $.grep(e,function(e){var i=null;if(null!=d&&(0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName)){if(-1==t.id)return!0;i=$.grep(d.lstOnlineServiceAndProviderMapping,function(i){return i.serviceProviderID==(void 0===e.id?e.ServiceProviderID:e.id)&&i.serviceID==t.id})}else 0;return null!=i&&i.length>0})},FilterSPOffline:function(e,t){return $.grep(e,function(e){var i=null;if(null!=d&&(0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName)){if(-1==t.id)return e.isServiceProvide=!0,!0;i=$.grep(d.lstOnlineServiceAndProviderMapping,function(i){return i.serviceProviderID==(void 0===e.id?e.ServiceProviderID:e.id)&&i.serviceID==t.id})}else 0;return null!=i&&i.length>0?(e.isServiceProvide=!0,!0):(e.isServiceProvide=!1,!0)})},bindMobilefilterdata:function(e,t){if(_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0){var i="";null!=d&&(0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName)&&(i=$.extend(!0,[],d.lstOnlineServiceProviderDetail));var a=null;a=null==t?i:_vgClassSessionSelection.FilterSP(i,t);var r=$("#txtSP"+e.data("section")+"Mobile").val();_vgClassSessionSelection.bindMobileOptions(a,"txtSP"+e.data("section"),r)}},bindMobileOptions:function(e,t,i){for(var a="",r=0;r<e.length;r++)a+="<option selected value="+e[r].id+">"+e[r].text+"</option>";0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName?a="<option selected value='' selected='selected'>Any Instructor</option>"+a:e.length>1&&(a="<option selected value='' selected='selected'>Any Service Provider</option>"+a),1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName!=ClassTabName&&1==e.length?($("#"+t+"Mobile").empty().append(a),$("#"+t+"Mobile").prop("disabled",!0)):($("#"+t+"Mobile").empty().append(a).val(i),$("#"+t+"Mobile").prop("disabled",!1))},SetControls:function(e){null==e?(_vgClassSessionSelection.IsBusinessHaveOnlyClass()||_vgClassSessionSelection.IsClassSelected()?($("#dvServiceClassText").text(u+" (required)"),$("#spnAddService, #spnAddServiceMobile").text("Add "+c)):($("#dvServiceClassText").text("Service (required)"),$("#spnAddService, #spnAddServiceMobile").text("Add Service")),$("#dvAddService, #dvAddServiceMobile").hide()):0==e?$("#dvServiceClassText").text(BusinessPackageKeyWord+" (required)"):1==e?($("#dvServiceClassText").text("Service (required)"),$("#spnAddService, #spnAddServiceMobile").text("Add Service")):2==e&&($("#dvServiceClassText").text(u+" (required)"),$("#spnAddService, #spnAddServiceMobile").text("Add "+c)),null!=e&&$("#dvAddService, #dvAddServiceMobile").show()},IsBusinessHaveOnlyClass:function(){return!1},IsClassSelected:function(){return $("#ucServiceCombo_hidEventType").length>0&&"2"==$("#ucServiceCombo_hidEventType").val()},FilterService:function(e,t){return null!=d&&(0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName)?$.grep(e,function(e){if(-1==t.id)return!0;var i=$.grep(d.lstOnlineServiceAndProviderMapping,function(i){return i.serviceProviderID==t.id&&i.serviceID==e.id});return null!=i&&i.length>0}):$.grep(e,function(e){if(e.eventType!=p){var i=$.grep(e.children,function(e){var i=$.grep(l.lstOnlineServiceAndProviderMapping,function(i){return i.serviceProviderID==t.id&&i.serviceID==e.id});return null!=i&&i.length>0});return null!=i&&i.length>0&&(e.children=i,!0)}return!0})},RemoveAllControls:function(e,t){$(".dvSectionDynamic").hide();for(var i=1;i<=4;i++)1==i&&1!=e||($("#txtService"+i).select2("data",{id:"",text:""}),_vgClassSessionSelection.SetDefaultForSeleect2($("#txtService"+i)),$("#txtService"+i).select2("enable"),1==e&&($("#divSearch").removeClass("no-serviceselection"),$("#mobile-appointments").prop("checked",!1),$("#dvOutCallSection").hide(),0==_vgClassSessionSelection.IsClassSelected()&&$("#ucServiceCombo_hidEventType").val(""))),$("#txtSP"+i).select2("data",{id:"",text:""}),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#txtSP"+i+"Mobile").val(""),_vgClassSessionSelection.SetDefaultForSeleect2($("#txtSP"+i));if(1==t){var a=null;if("undefined"!=typeof txtdateId&&(a=$find(txtdateId)),"undefined"==typeof isClearDate&&(isClearDate=!0),null!=a&&1==isClearDate&&$("#date-slider-container div.enabled:first").length>0){var r=new Date($("#date-slider-container div.enabled:first").data().availdate),o=void 0!==$("#date-slider-container div.selected:first").data()&&null!=$("#date-slider-container div.selected:first").data()?new Date($("#date-slider-container div.selected:first").data().availdate):new Date;setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},r<o?r:o)}isClearDate=!0,$("#Book24Container").html(""),$("#hdnPromotionID").val(""),$("#hdnStyleID").val("")}},GetAvailibilityForService:function(t,i){var r=1;if(1==t&&(r=2),1==i){var o=$("#txtService1").data("choice");if(""!=o)try{var n=JSON.parse(o);n.hasOwnProperty("id")&&""!=n.id&&n.eventType==p&&(r=2)}catch(e){}}for(var s=_vgClassSessionSelection.VisibleControlLength("#dvSections .dvSectionDynamic")+1,l=[],d=r;d<=s;d++){var c=$("#txtSP"+d).data("choice");if(""!=c)try{var u=JSON.parse(c);u.hasOwnProperty("id")&&""!=u.id&&$.inArray(u.id,l)<=-1&&l.push(u.id)}catch(e){}}ShowLoader(!0),Data={},Data.businessID=1==_vgClassSessionSelection.model.IsOnline?businessID:BusinessID,Data.spID=l.length>0?l.join():"",vagaro.ajaxCall(e+a.getavailabledates,Data,CheckDates_CallSuccess,CallFailed1,!1,!0)},SetServiceBundle:function(e){if(null!=l.lstOnlineServiceBundleDetail){var t=$.grep(l.lstOnlineServiceBundleDetail,function(t){return t.businessPackageID==e});if(null!=t&&t.length>0){for(var i=0;i<=t.length-1;i++){var a=i+2;$("#dvSection"+a).show(),_vgClassSessionSelection.BindDropDown(a);var r={id:t[i].serviceId,text:t[i].serviceTitle};$("#txtService"+a).select2("data",r),$("#txtService"+a).select2("disable"),$("#txtService"+a).data("selecteddetail",r),void 0!==$("#txtService"+a).data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2($("#txtService"+a),r);var o={};o.id=r.id,o.text=r.text,_vgClassSessionSelection.bindMobilefilterdata($("#txtSP"+a),o)}$("#dvAddService, #dvAddServiceMobile").hide()}}},BindDropDown:function(e,t){var i={dropdownCssClass:"service-what-dropdown service-commondrop service-book-drop classAppSelectNew",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Select Service"};if(i.collapasable=_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0,i.selectAllText=$("#mobile-check").is(":visible"),i.scrollTop=$("#mobile-check").is(":visible"),"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&void 0!==getCookie("AppointmentID")&&""!=getCookie("AppointmentID")&&(t=h),1!=e){t==m&&(i.placeholder="Select "+c);var a=$.extend(!0,[],l.lstOnlineServiceParent);a=$.grep(a,function(e){return e.eventType==t&&(e.children=$.grep(e.children,function(e){return e.eventType==t})),e.eventType==t}),i.data=a}else _vgClassSessionSelection.IsBusinessHaveOnlyClass()&&(i.placeholder="Select "+c),void 0!==_shopdetail.serviceID&&""==_shopdetail.serviceID&&"2"==$("#ucServiceCombo_hidEventType").val()&&$("#ucServiceCombo_hidEventType").val(""),i.data=l.lstOnlineServiceParent;$("#txtService"+e).length>0&&(1!=l.lstOnlineServiceProviderDetail.length||null!=_shopdetail.serviceID&&""!=_shopdetail.serviceID||_vgClassSessionSelection.onProviderSelect($("#txtSP"+e),{id:l.lstOnlineServiceProviderDetail[0].id,text:l.lstOnlineServiceProviderDetail[0].text}),new _vgClassSessionSelection.ApplySelect2Controls($("#txtService"+e),i));var r={dropdownCssClass:"service-providerdrop",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Any Service Provider"};r.data=l.lstOnlineServiceProviderDetail,r.collapasable=!1,$("#txtSP"+e).length>0&&(new _vgClassSessionSelection.ApplySelect2Controls($("#txtSP"+e),r),$("#txtSP"+e).select2("enable"),1==l.lstOnlineServiceProviderDetail.length&&($("#txtSP"+e).select2("disable"),$("#txtSP"+e).select2("data",{id:l.lstOnlineServiceProviderDetail[0].id,text:l.lstOnlineServiceProviderDetail[0].text})))},onProviderSelect:function(e,t){e.data("selecteddetail",JSON.stringify(t)),void 0!==e.data("choice")&&_vgClassSessionSelection.SetChoiceForSeleect2(e,t),_vgClassSessionSelection.isExistsServiceProviderForSameTime(e),_vgClassSessionSelection.GetAvailibilityForService(!1,!0)},isExistsServiceProviderForSameTime:function(e){var t=$("#txtService1").data("choice"),i=!1;if(""!=t){try{var a=[],r=JSON.parse(t);if(r.hasOwnProperty("id")&&""!=r.id&&r.eventType==p){if(null!=r.lstServiceBundleDetail&&r.lstServiceBundleDetail.length>0&&(i=2==r.lstServiceBundleDetail[0].isServicePerformAtSameTime),1==i)for(var o=_vgClassSessionSelection.VisibleControlLength("#dvSections .dvSectionDynamic")+1,n=2;n<=o;n++){var s=$("#txtSP"+n).data("choice");if(""!=s)try{var l=JSON.parse(s);l.hasOwnProperty("id")&&""!=l.id&&a.push(l.id)}catch(e){}}}if(1==i)for(n=0;n<=a.length;++n)for(var d=n+1;d<=a.length;++d)if(""!=a[d]&&""!=a[n]&&a[n]==a[d])return vagaro.alert("Services in this service bundle could not be booked with same provider.Please select different Provider for All Services."),e.select2("data",{id:"",text:""}),$(e.selector+"Mobile").val(""),_vgClassSessionSelection.SetDefaultForSeleect2(e),!1}catch(e){return!0}return!0}},AddServiceButtonDisplay:function(){_vgClassSessionSelection.VisibleControlLength("#dvSections .dvSectionDynamic")>=2||"true"==IsRescheduleAppointment.toLowerCase()&&""!=lAppID||_vgClassSessionSelection.IsClassSelected()&&null!=_vgClassSessionSelection.GetRescheduleDetail()?$("#dvAddService, #dvAddServiceMobile").hide():$("#dvAddService, #dvAddServiceMobile").show()},GetRescheduleDetail:function(){var e=$("#hdnRescheduleDetail");if(""==e.val())return null;try{return JSON.parse(e.val())}catch(e){return null}},OutCallCalculation:function(e,t){if($("#mobile-appointments").prop("checked",!1),0!=IsMobileServiceMandatoryInBusiness){1==e&&1==t.isOutCallService&&$("#dvAddService, #dvAddServiceMobile").hide();var i=!1;if(_vgClassSessionSelection.VisibleControlLength("#dvSections .dvSectionDynamic")>0){for(var a=1;a<=3;a++)if(a!=e){var r=$("#txtService"+a).data("selecteddetail");if(""!=r)try{1==JSON.parse(r).isOutCallService&&(i=!0)}catch(e){}}if(1==i&&0==t.isOutCallService||0==i&&1==t.isOutCallService)return vagaro.alertsmall({message:"You cannot combine Mobile Services with non-Mobile Services.",title:"Alert",callback:function(){}}),$("#txtService"+e).select2("data",{id:"",text:""}),_vgClassSessionSelection.SetDefaultForSeleect2($("#txtService"+e)),$("#txtService"+e).data("selecteddetail",""),!1}1==t.isOutCallService?($("#dvOutCallSection").show(),$("#hrfChangeBusinessCall").hide(),$("#hrfChangeHouseCall").hide(),$("#dvAtBusiness").hide(),$("#mobile-appointments").prop("checked",!0)):$("#dvOutCallSection").hide()}else _vgClassSessionSelection.VisibleControlLength("#dvSections .dvSectionDynamic")>0||0==t.isOutCallService?$("#dvOutCallSection").hide():1==t.isOutCallService&&(void 0!==t.directFromService&&""!=t.directFromService&&1==t.directFromService&&($("#dvHouseCall").removeClass("active"),$("#dvBussiness").addClass("active")),$("#dvOutCallSection").show(),$("#hrfChangeBusinessCall").show(),$("#hrfChangeHouseCall").show(),$("#dvAtHouse").hide());return!0},BindGCpromoPrice:function(e,t){var i=e.data("GCPromoList"),a=$.grep(i,function(e){return parseFloat(t)==parseFloat(e.Price)});a.length>0?(t=a[0].Price,e.select2("data",{id:a[0].id,text:a[0].text+" ("+a[0].promotext+")"}),$("#div_amount").html("$"+t.toFixed(2).replace(".00",""))):1==$.isNumeric(t)&&parseFloat(t)>0?parseFloat(t)>999999?(e.select2("data",{id:"",text:""}),$("#div_amount").html("")):(t.indexOf(".")>0&&(t=parseFloat(t).toFixed(2)),$("#div_amount").html("$"+t.replace(".00","")),e.select2("data",{id:t,text:t})):(e.select2("data",{id:"",text:""}),$("#div_amount").html(""))},FillClassDatesCallbackForClass:function(e){if(e.length>0&&void 0!==_shopdetail.lastClassBookingDateConfigured&&0==_shopdetail.lastClassBookingDateConfigured){_shopdetail.lastClassBookingLimit=e[e.length-1];var i=new Date;i.setDate(i.getDate()+(Number(_shopdetail.lastClassBookingLimit)-1)),_shopdetail.lastClassBookingDate=i,e.pop(),_shopdetail.lastClassBookingDateConfigured=!0}if(bkClassAvailableDates.addResponseToCache(e),e.length<=0&&t){if(_vgClassSessionSelection.VisibleControlLength("#divmainEventdetailForClass")<=0){$("#divmainEventdetailForClass").show();try{_vgClassSessionSelection.LoadClassSliderDatePickerForClass(new Date)}catch(e){}}_vgClassSessionSelection.ClearBook24()}else _vgClassSessionSelection.LoadClassSliderDatePickerForClass(e);if(t=!1,ShowLoader(!1),void 0===e!=null&&e.length>0){if(""!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime){var a=new Date(moment(new Date(_shopdetail.bookingDateTime.replace(new RegExp(",","g")," "))).format("MMM DD,YYYY")),r=new Date(moment(new Date(e[0].replace(new RegExp(",","g")," "))).format("MMM DD,YYYY"));a<r&&(a=r),$("#hdnStartDateForClass").val(a)}else $("#hdnStartDateForClass").val(e[0]);_vgClassSessionSelection.LoadClassDataOnline(e),_vgClassSessionSelection.GetQueryStringData("device","myaccount")||_vgClassSessionSelection.ClearBook24()}else{if(_vgClassSessionSelection.VisibleControlLength("#divmainEventdetailForClass")<=0){$("#divmainEventdetailForClass").show();try{_vgClassSessionSelection.LoadClassSliderDatePickerForClass(new Date)}catch(e){}}$("#date-class-slider-containerForClass .selected").removeClass("selected"),$("#date-class-slider-containerForClass div.enabled").removeClass("enabled").addClass("inactive"),$("body").addClass("searched-appointment-body"),$("#divEventDetailForClass").hide(),$("#tblEventDetailForClass").html(""),$("#dvtimezone").hide();var o={confirmButtonText:"Class Not Scheduled"};if(void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking){var n=$("#hdnInstructorIDForClass").val();if(""==_shopdetail.getFilteredServiceProviderId(n))if(1==$("select[id=cboServiceProviderWaitlist_Search] :selected").length){var s=$("select[id=cboServiceProviderWaitlist_Search] :selected").text();o.swalTextMessage="Sorry, "+s+" is Not Accepting New Customers"}else o.swalTextMessage="Sorry, the Selected Employees are Not Accepting New Customers";else o.swalTextMessage="There are no dates scheduled for the selected class and instructor."}else o.swalTextMessage="There are no dates scheduled for the selected class and instructor.";_common.Openswalpopup(o),setTimeout(function(){$(".gencutom-title").html(o.confirmButtonText)},100)}},LoadClassSliderDatePickerForClass:function(e){$("#divmainEventdetailForClass").data("availabedates",JSON.stringify(e)),$("#divClassAppResultForClass").show();var t=$("#slider-class-dataForClass");t.html(""),t.unslick();var i="",a=_vgClassSessionSelection.getSunday(new Date),r=new Date(_shopdetail.lastClassBookingDate);r.setDate(r.getDate()-1),r=_vgClassSessionSelection.getSunday(r),r=new Date(r.setDate(r.getDate()+6));var o=Math.floor((r.getTime()-a.getTime())/864e5);o<50&&r.setDate(r.getDate()+(42-o));var n=$("#DateTemplatesForClass").html();AvailableMinDateForClass=e.length>0?new Date(e[0]):new Date,AvailableMaxDateForClass=new Date(e[e.length-1]);var s=new Date(e[0]).format("MMM dd,yyyy");new Date(s)<AvailableMinDateForClass&&(s=new Date(AvailableMinDateForClass)),new Date(s)>AvailableMaxDateForClass&&(s=new Date(AvailableMaxDateForClass));for(;a<=r;){var l=new Date(a);l=new Date(l.setDate(a.getDate()+6));var d=n;d=(d=(d=(d=(d=(d=(d=(d=(d=d.replace("{{availableStartDate}}",a.format("MMM dd,yyyy"))).replace("{{availableEndDate}}",l.format("MMM dd,yyyy"))).replace("{{startDate}}",a.format("yyyy-MM-dd"))).replace("{{WeekNo}}",f[new Date(a).getMonth()])).replace("{{WeekNoLabel}}",g[new Date(a).getMonth()])).replace("{{WeekStart}}",new Date(a).getDate())).replace("{{WeekStartLabel}}",new Date(a).getDate())).replace("{{WeekEnd}}",new Date(l).getDate())).replace("{{WeekEndLable}}",new Date(l).getDate());for(var c=0,u=0,p=a;p<=l;p.setDate(p.getDate()+1))$.inArray(p.format("MMM dd,yyyy"),e)<0&&(c+=1),u+=1;i+=d=c!=u?(d=d.replace("{{selectedClass}}","enabled")).replace("{{onclickcall}}","_vgClassSessionSelection.SetClassStartDateForClass(this);"):(d=d.replace("{{selectedClass}}","inactive")).replace("{{onclickcall}}","return false;")}$("#slider-class-dataForClass").append(i),$("#slider-class-dataForClass .inactive").attr("aria-hidden",!0);var h=new Date(AvailableMinDateForClass);$("#slider-class-dataForClass").slick({infinite:!1,slidesToShow:7,speed:800,prevArrow:'<div tabindex="0" data-role="none" class="owl-prev font-awesome-light " onclick="_vgClassSessionSelection.bounceClassDateControl(this,0);" role="button" aria-label="Prevous">&#xF104;</div>',nextArrow:'<div tabindex="0" data-role="none" class="owl-next font-awesome-light " onclick="_vgClassSessionSelection.bounceClassDateControl(this,1);" role="button" aria-label="Next">&#xF105;</div>',onAfterChange:function(e,t){"Next"!=e.CurrentSlideDirection&&"Prev"!=e.CurrentSlideDirection||_vgClassSessionSelection.ChangeClassWeekForClass(e,t)},slidesToScroll:7,responsive:[{breakpoint:768,settings:{arrows:!1}}]});var m=_vgClassSessionSelection.getSunday(h),v=new Date(m);v=new Date(v.setDate(m.getDate()+6)),_vgClassSessionSelection.setClassSliderDateForClass(m,v)},ChangeClassWeekForClass:function(e,t){for(var i,a,r=$("#date-class-slider-containerForClass .slick-active"),o=0;o<=r.length-1;o++){var n=$(r[o]),s=n.attr("index");if(null!=s&&void 0!==s&&Number(s)%7==0){i=new Date(n.eq(0).data().availdatestart),a=new Date(n.eq(0).data().availdateend);break}}_vgClassSessionSelection.setClassSliderDateForClass(i,a)},setClassSliderDateForClass:function(e,t){var i=e.format("MMM dd,yyyy"),a=t.format("MMM dd,yyyy"),r=$("#date-class-slider-containerForClass").find("[data-availdatestart='"+i+"'][data-availdateend='"+a+"']").closest("div").attr("index");if(null!=r&&void 0!==r){Number(r)%7&&(r-=Number(r)%7),$("#slider-class-dataForClass").slickGoTo(r);var o=$("#date-class-slider-containerForClass").find("[index='"+r+"']");if(o.length>0){var n=$("#date-class-slider-containerForClass div.slick-active.selected:first");if(n.length>0){var s=_vgClassSessionSelection.StringToDate(n.data().startdate,"-");$("#hdnMonthNameForClass").html(_vgClassSessionSelection.weeks_between(s,!0))}else{var l=_vgClassSessionSelection.StringToDate(o.eq(0).data().startdate,"-");$("#hdnMonthNameForClass").html(_vgClassSessionSelection.weeks_between(l,!0))}}}},weeks_between:function(e,t){var i=_vgClassSessionSelection.getSunday(new Date);i=new Date(i.setDate(i.getDate()-1));var a=e.getTime(),r=i.getTime(),o=Math.abs(a-r),n=Math.floor(o/6048e5);return 1==n?"Next Week":n>1?"In "+n+" Weeks":"This Week"},ClearBook24:function(){_shopdetail.serviceID="",_shopdetail.providerID="",_shopdetail.styleID="",_shopdetail.styleName="",_shopdetail.bookingDateTime="",_shopdetail.EventType=null,_vgClassSessionSelection.clearCookie("ProviderID"),_vgClassSessionSelection.clearCookie("StyleID"),_vgClassSessionSelection.clearCookie("StyleName"),_vgClassSessionSelection.clearCookie("BookingDate"),_vgClassSessionSelection.clearCookie("BookingTime"),_vgClassSessionSelection.clearCookie("BusinessPackageID"),_vgClassSessionSelection.clearCookie("AppointmentID"),_vgClassSessionSelection.clearCookie("IsFromReschedual"),_vgClassSessionSelection.clearCookie("IsClassSelected"),_vgClassSessionSelection.clearCookie("IsFromRebook"),_vgClassSessionSelection.clearCookie("PromotionPIds"),"undefined"==typeof _common||_common.isCreateLinkPreserve(!0)||(_vgClassSessionSelection.clearCookie("ServiceID"),_vgClassSessionSelection.clearCookie("LiveStreamSignUp"),_vgClassSessionSelection.clearCookie("MultiProviderID"),_vgClassSessionSelection.clearCookie("UniqueCreateLink"),_vgClassSessionSelection.clearCookie("EventType")),void 0!==isClassSelected&&(isClassSelected="false"),"undefined"!=typeof isFromReschedual&&(isFromReschedual="false"),_vgClassSessionSelection.clearCookie("EventSessionAttendeesId"),ShowLoader(!1)},LoadClassDataOnline:function(e){var t=new Date;if(void 0!==$("#hdnStartDateForClass")&&""!=$("#hdnStartDateForClass").val()&&(t=new Date($("#hdnStartDateForClass").val())),document.getElementById("apgSearchProgressForClass").style.display="",void 0!==e&&null!=e&&_vgClassSessionSelection.VisibleControlLength("#divmainEventdetailForClass")<=0){$("#divmainEventdetailForClass").show();try{_vgClassSessionSelection.LoadClassSliderDatePickerForClass(e)}catch(e){}}bkEvent.model.csvServiceID=$("#hdnClassIDForClass").val(),bkEvent.model.csvSPID=$("#hdnInstructorIDForClass").val(),bkEvent.model.csvSPID=""==bkEvent.model.csvSPID?"0":bkEvent.model.csvSPID,bkEvent.model.csvFilterType=$(_vgClassSessionSelection.Controls.ddlFilterTypes).val();var i=_vgClassSessionSelection.getSunday(new Date(t));t.format("MMM dd,yyyy")!=i.format("MMM dd,yyyy")&&(t=new Date(i));var a=new Date(t),r=new Date(_shopdetail.lastClassBookingDate);a.setDate(t.getDate()+6),a>r&&(a=r);var o=$("#date-class-slider-containerForClass").find("[data-availdatestart='"+t.format("MMM dd,yyyy")+"'],[data-availdateend='"+a.format("MMM dd,yyyy")+"']");o.length>0&&($("#date-class-slider-containerForClass .selected").removeClass("selected"),$("#date-class-slider-containerForClass").addClass(""),$(o).removeClass("filter-button"),$(o).addClass("selected"),$("#hdnStartDateForClass").val(new Date(t)),$("#hdnEndDateForClass").val(new Date(a)),_vgClassSessionSelection.LoadClassDataForClassTab())},LoadClassDataForClassTab:function(){void 0===_shopdetail||null==_shopdetail||1!=_shopdetail.IsLimitOnlineBooking&&1!=_shopdetail.IsMemPkgReqToBook||(_shopdetail.LoadMembershipPackageData(),_vgClassSessionSelection.commonProperty.MembershipPackageDetailsForClass=_shopdetail.MembershipPackageDetails);var e=null,t=null,i=new Date($("#hdnStartDateForClass").val()),r=new Date($("#hdnEndDateForClass").val());e=null!=i?i.format("ddd MMM-dd-yyyy"):(new Date).format("ddd MMM-dd-yyyy"),t=null!=r?r.format("ddd MMM-dd-yyyy"):(new Date).format("ddd MMM-dd-yyyy"),$("#spnSearchTypeForClass").html("Classes"),$("#divDateForClass").html(e+" to "+t),$("#AppProgressModalForClass").modal("show");var o,n=0,s=0,l=_vgClassSessionSelection.StreamingFilterType.InHouseAndLiveStream;if(bkEvent.model.searchFromDate=e,bkEvent.model.searchToDate=t,null==(o=bkEvent.getResponseFromCache())||"SearchClass"==$("#hdnSearchClass").val()){n=bkEvent.model.csvServiceID,s=bkEvent.model.csvSPID,l=bkEvent.model.csvFilterType;var c=$("<XMLDocument/>");if(c.append(_vgClassSessionSelection.createXmlElement("searchDetails")),""==n&&""!=$("#hdnClassIDForClass").val()&&(n=$("#hdnClassIDForClass").val()),"0"!=s&&""!=$("#hdnInstructorIDForClass").val()){if(s=$("#hdnInstructorIDForClass").val(),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.getFilteredServiceProviderId&&1==_shopdetail.IsLimitOnlineBooking&&(s=_shopdetail.getFilteredServiceProviderId(s),$("#hdnSearchAvailabilityBtn").val(""),""==s))return _vgClassSessionSelection.FillClassDatesCallbackForClass([]),_vgClassSessionSelection.LoadEventsDataCallbackForClassTab([]),void _vgClassSessionSelection.EventShowLoader(!1);if(0!=n||0!=s){s=s.split(",");for(var u=0;u<s.length;u++){(h=_vgClassSessionSelection.createXmlElement("searchDetail")).append(_vgClassSessionSelection.createXmlElement("serviceId",n)),h.append(_vgClassSessionSelection.createXmlElement("spId",s[u])),h.append(_vgClassSessionSelection.createXmlElement("streamingstatus",l)),c.find("searchDetails").append(h)}}}else if("0"==s&&""!=$("#hdnStrSpList").val()){var p=$("#hdnStrSpList").val();if(s="",p=JSON.parse(p),0!=n||0!=s)for(u=0;u<p.length;u++){var h;(h=_vgClassSessionSelection.createXmlElement("searchDetail")).append(_vgClassSessionSelection.createXmlElement("serviceId",n)),h.append(_vgClassSessionSelection.createXmlElement("spId",p[u].ServiceProviderID)),h.append(_vgClassSessionSelection.createXmlElement("streamingstatus",l)),c.find("searchDetails").append(h)}}var m=_vgClassSessionSelection.createXmlElement("searchDetail");m.append(_vgClassSessionSelection.createXmlElement("serviceId",-2)),m.append(_vgClassSessionSelection.createXmlElement("spId",-2)),m.append(_vgClassSessionSelection.createXmlElement("streamingstatus",l)),c.find("searchDetails").append(m);var f=0;void 0!==getCookie("PromotionID")&&(f=getCookie("PromotionID"),setCookie("PromotionID",0));var g=new vagaro.ajax;g.datamodel.Token=a.getavailablemultievents,g.datamodel.IsNewVagaroAPI=!0;var v={};if(v.businessID=1==_vgClassSessionSelection.model.IsOnline?businessID:BusinessID,v.sSatrtDate=e,v.sEndDate=t,!String.isNullOrUndefineOrBlank(d.clsTimeZone)){v.Bus_TimeZone=d.clsTimeZone.TIME_ZONE,v.Bus_CountryID=d.clsTimeZone.CountryID,v.Bus_DayLightSaving=d.clsTimeZone.CUSTOM_DAY_LIGHT_SAVING,v.DAY_LIGHT_SAVING=d.clsTimeZone.DAY_LIGHT_SAVING;var A=getCookie("proximitystate_v3");String.isNullOrUndefineOrBlank(A)||(v.Cust_Timezone=A.timeZoneOffSet,v.Cust_CountryID=A.countryid,v.Cust_IsDayLightSaving=A.isSupportDayLight)}if(v.searchdetails=c.html(),_vgClassSessionSelection.model.IsSearchFromInHouseClass){var C=getSelectedCustomer();!_vgClassSessionSelection.model.IsSearchFromInHouseClass||""!=C&&0!=C||(C=UserID)}v.userID=_vgClassSessionSelection.model.IsSearchFromInHouseClass?C:UserID,v.promotionID=f,v.isFromOffline=0==_vgClassSessionSelection.model.IsOnline,_vgClassSessionSelection.GetWBTypeQuerySting()&&_vgClassSessionSelection.GetWBEventQuerySting()?(v.IsNewWebsiteBuilder=!0,v.IncludededClassId=_vgClassSessionSelection.getWBClassIdsData("IncludedIds"),v.ExcludededClassId=_vgClassSessionSelection.getWBClassIdsData("ExcludedIds"),v.IsAllowAllLocation=_vgClassSessionSelection.getWBIsAllowAlllocation()):(v.IsNewWebsiteBuilder=!1,v.IncludededClassId="",v.ExcludededClassId="",v.IsAllowAllLocation=!1),g.datamodel.data=v,g.datamodel.callback=_vgClassSessionSelection.LoadEventsDataCallbackForClassTab,g.datamodel.Error=_vgClassSessionSelection.LoadEventsDataFailCallback,g.Post(),$("#hdnSearchClass").val("")}else _vgClassSessionSelection.LoadEventsDataCallbackForClassTab(o)},GetWBTypeQuerySting:function(){var e=window.document.URL;if(void 0!==e&&null!=e&&""!=e){var t=e.slice(e.indexOf("?")+1).split("&");if(t.length>0)for(var i=0;i<t.length;i+=1){var a=t[i];if(sParameterName=(a||"").split("="),2==sParameterName.length&&"Type"===sParameterName[0]&&"Builder"===sParameterName[1])return!0}}return!1},GetQueryStringData:function(e,t){var i=window.document.URL;if(void 0!==i&&null!=i&&""!=i){var a=i.slice(i.indexOf("?")+1).split("&");if(a.length>0)for(var r=0;r<a.length;r+=1){var o=a[r];if(sParameterName=(o||"").split("="),2==sParameterName.length&&sParameterName[0]===e&&sParameterName[1]===t)return!0}}return!1},GetWBEventQuerySting:function(){var e=window.document.URL;if(void 0!==e&&null!=e&&""!=e){var t=e.slice(e.indexOf("?")+1).split("&");if(t.length>0)for(var i=0;i<t.length;i+=1){var a=t[i];if(sParameterName=(a||"").split("="),2==sParameterName.length&&"Event"===sParameterName[0]&&"WBBusinessClasses"===sParameterName[1])return!0}}return!1},getWBIsAllowAlllocation:function(){var e=window.document.URL;if(void 0!==e&&null!=e&&""!=e){var t=e.slice(e.indexOf("?")+1).split("&");if(t.length>0)for(var i=0;i<t.length;i+=1){var a=t[i];if(sParameterName=(a||"").split("="),2==sParameterName.length&&"AllowLocation"===sParameterName[0]&&"true"===sParameterName[1])return!0}}return!1},GetClassIDForWB:function(){var e=window.document.URL;if(void 0!==e&&null!=e&&""!=e){var t=e.slice(e.indexOf("?")+1).split("&");if(t.length>0)for(var i=0;i<t.length;i+=1){var a=t[i];if(sParameterName=(a||"").split("="),2==sParameterName.length&&"ClassID"===sParameterName[0]&&void 0!==sParameterName[1]&&null!=sParameterName[1]&&""!=sParameterName[1])return sParameterName[1]}}return""},getWBClassIdsData:function(e){var t=window.document.URL;if(void 0!==t&&null!=t&&""!=t){var i=t.slice(t.indexOf("?")+1).split("&");if(i.length>0)for(var a=0;a<i.length;a+=1){var r=i[a];if(sParameterName=(r||"").split("="),2==sParameterName.length&&sParameterName[0]===e)return void 0!==sParameterName[1]&&null!=sParameterName[1]&&""!=sParameterName[1]?sParameterName[1]:""}}return""},SetClassStartDateForClass:function(e){0==_vgClassSessionSelection.VisibleControlLength("#mobile-check")&&($(e).attr("tabindex",0).focus(),$("#txtService5").select2("focus")),$("#hdnStartDateForClass").val(_vgClassSessionSelection.StringToDate($(e).data().startdate,"-")),$("#hdnMonthNameForClass").html(_vgClassSessionSelection.weeks_between(_vgClassSessionSelection.StringToDate($(e).data().startdate,"-"),!0)),_vgClassSessionSelection.LoadClassDataOnline()},bounceClassDateControl:function(e,t){1==$(e).hasClass("slick-disabled")&&(0==t?$("#slider-class-data").animate({left:"+=50px"},400,"easeOutSine",function(){$("#slider-class-data").animate({left:0},600,"easeOutBounce")}):$("#slider-class-data").animate({right:"+=50px"},400,"easeOutSine",function(){$("#slider-class-data").animate({right:0},600,"easeOutBounce")}))},CloseClassSearchProgressForClassTab:function(){setTimeout(function(){$("#AppProgressModalForClass").modal("hide")},800)},setClassSliderDate:function(e,t){var i=e.format("MMM DD,YYYY"),a=t.format("MMM DD,YYYY"),r=$("#date-class-slider-container").find("[data-availdatestart='"+i+"'][data-availdateend='"+a+"']").closest("div").attr("index");if(null!=r&&void 0!==r){Number(r)%7&&(r-=Number(r)%7),$("#slider-class-data").slickGoTo(r);var o=$("#date-class-slider-container").find("[index='"+r+"']");if(o.length>0){var n=$("#date-class-slider-container div.slick-active.selected:first");if(n.length>0){var s=_vgClassSessionSelection.StringToDate(n.data().startdate,"-");$("#hdnMonthName").html(_vgClassSessionSelection.weeks_between(s,!0))}else{var l=_vgClassSessionSelection.StringToDate(o.eq(0).data().startdate,"-");$("#hdnMonthName").html(_vgClassSessionSelection.weeks_between(l,!0))}}}},SetDefaultForSeleect2:function(e){e.data("choice",JSON.stringify({id:"",text:""}))},SetChoiceForSeleect2:function(e,t){e.data("choice",JSON.stringify(t))},clearCookie:function(e){return cookieManager.removeCookie(e,cookieManager.defaultPath,cookieManager.defaultDomain)},GetChoiceForSeleect2:function(e){try{return JSON.parse(e.data("choice"))}catch(e){return{}}},closeServiceSelection:function(){$(".book-service-open").removeClass("book-service-open"),$(".book-service-open-common").removeClass("book-service-open-common"),$(".gc-transformnone").removeClass("gc-transformnone"),$("html, body").removeClass("moboverflow-hide"),setTimeout(function(){"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("html, body").hasClass("moboverflow-hide")&&$("html, body").removeClass("moboverflow-hide")},200)},CallFailed2:function(){vagaro.alert("Some Error occured")},SearchAssignVariables:function(){var e={},t=_vgClassSessionSelection.Controls.PageName;null!=glbPageName&&null!=cache_PageType&&cache_PageType[t]!=glbPageName&&(e.liSelectedClassName=_vgClassSessionSelection.Controls.liSelectedClassName,e.isFromiPadAndroid="true"=="<%=IsFromIpad %>".toLowerCase(),e.isLoadCustFromDB="true"=="<%= Vagaro.Config.AppSettingManager.AppSettingValues.IsLoadCustFromDB %>".toLowerCase(),e.syncDuration=parseInt("<%= Vagaro.Config.AppSettingManager.AppSettingValues.custListSyncDuration %>"),e.HasCustomerRight=!0,e.BusinessId=BusinessID),InitializecomponentWrapper(t,e)},SelectCustomerClass:function(e){if(null!=e){var t=$(e);_vgClassSessionSelection.model.hdnUserIDAppointment=_vgClassSessionSelection.GethdnUserIDAppointmentControl(),t.data("custid")!=_vgClassSessionSelection.model.hdnUserIDAppointment.val()&&(_vgClassSessionSelection.SelectCustomer(t.data("custid"),t.data("fullname")),_vgClassSessionSelection.model.hdnUserIDAppointment.val(t.data("custid")))}},GethdnUserIDAppointmentControl:function(){return null==_vgClassSessionSelection.model.hdnUserIDAppointment&&(_vgClassSessionSelection.model.hdnUserIDAppointment=$(_vgClassSessionSelection.Controls.hdnUserIDAppointment)),_vgClassSessionSelection.model.hdnUserIDAppointment},SelectCustomer:function(e,t){""!=e&&""!=e?("true"==$("#hdnHasCustomerViewRight").val().toLowerCase()?$(_vgClassSessionSelection.Controls.dvBtSearchHistory).show():"true"==$("#hdnHasCustomerRight").val().toLowerCase()&&($(_vgClassSessionSelection.Controls.dvBtSearchEdit).show(),$(_vgClassSessionSelection.Controls.dvBtSearchHistory).show()),Ajax_BussinessID=BusinessID,"undefined"!=typeof isFormsEnable&&""!=isFormsEnable&&"true"==isFormsEnable.toLowerCase()?NeedToFillFormsForNewCustomer(e,function(t){null!=t&&null!=t.d&&t.d.length>0?NewCustomerFormStatus="1":NewCustomerFormStatus="","undefined"!=typeof canViewNotes&&""!=canViewNotes&&"true"==canViewNotes.toLowerCase()&&ShowPopupNotesModal(e,null)},function(){window.parent.ShowHideWarningMessageCommon(_vgClassSessionSelection.model.Somethingwentwrong)}):"undefined"!=typeof canViewNotes&&""!=canViewNotes&&"true"==canViewNotes.toLowerCase()&&ShowPopupNotesModal(e,null),UserID=e,null!=bkEvent.model.cacheLen&&null!=bkEvent.model.cacheLen&&_vgClassSessionSelection.IsSearchFromInHouseClass()&&(bkEvent.timeSlotsCache={},_vgClassSessionSelection.LoadClassDataForClassTab())):($(_vgClassSessionSelection.Controls.dvBtSearchEdit).hide(),$(_vgClassSessionSelection.Controls.dvBtSearchHistory).hide())},AddCustomerInSearchAppointmentPage:function(e,t){var i=_vgClassSessionSelection.GetCustomerSearchClassControl(),a=_vgClassSessionSelection.GethdnUserIDAppointmentControl();i.val(e),a.val(t),_vgClassSessionSelection.SelectCustomer(t,e)},GetCustomerSearchClassControl:function(){return null==_vgClassSessionSelection.model.txtCustomerSearchClass&&(_vgClassSessionSelection.model.txtCustomerSearchClass=$(_vgClassSessionSelection.Controls.txtCustomerSearchAppointment)),_vgClassSessionSelection.model.txtCustomerSearchClass},showNewEditCustomerPopup:function(e){1==e?openCustomerPopup("0",_vgClassSessionSelection.Controls.SearchClassFromCalendar):(ShowLoader(!0),openCustomerPopup(_vgClassSessionSelection.getSelectedCustomer(),_vgClassSessionSelection.Controls.SearchClassFromCalendar))},getSelectedCustomer:function(){return void 0===_vgClassSessionSelection.GethdnUserIDAppointmentControl()||null==_vgClassSessionSelection.GethdnUserIDAppointmentControl().val()?0:_vgClassSessionSelection.GethdnUserIDAppointmentControl().val()},setSearchCustomer:function(e){var t=e;(t.length<=0||null==t||""==t)&&($(_vgClassSessionSelection.Controls.txtCustomerSearchAppointment).val(""),$(_vgClassSessionSelection.Controls.dvBtSearchEdit).hide(),$(_vgClassSessionSelection.Controls.dvBtSearchHistory).hide(),null==_vgClassSessionSelection.model.hdnUserIDAppointment&&(_vgClassSessionSelection.model.hdnUserIDAppointment=$(_vgClassSessionSelection.Controls.hdnUserIDAppointment)),_vgClassSessionSelection.model.hdnUserIDAppointment.val(0))},CallHistoryAppointment:function(){_vgClassSessionSelection.CallCustomerHistoryMain(_vgClassSessionSelection.getSelectedCustomer(),1,0,BusinessID,0,"",!1,!1,!1,!1,0,"")},CallCustomerHistoryMain:function(e,t,i,a,r,o,n,s,l,d,c,u){var p="CustomerHistoryPopUp.aspx";try{void 0!==window.parent.location.href&&null!=window.parent.location.href&&window.parent.location.href.includes("/merchants/calendar")&&(p="CustomerHistoryPopUp.aspx?cal=1")}catch(e){console.log(e)}ShowDynamicPopupForShopOwner(p,510,970,"DivCustomerHistoryPopUp","Customer Details",null,null,"cust-history- reponsive");var h=$("#iFrame_DivCustomerHistoryPopUp"),m=h[0].contentWindow,f="0",g=$("#hdnHasCustomerRight").val();"true"==g.toString().toLowerCase()?f="2":"false"==g.toString().toLowerCase()&&"true"==viewCustomer_app.toString().toLowerCase()&&(f="1"),h.load(function(){this.contentWindow.FillCustomerInfoFromCustomerID(e,t,i,a,r,o,n,s,l,d,c,u,f)}),null!=m.FillCustomerInfoFromCustomerID&&m.FillCustomerInfoFromCustomerID(e,t,i,a,r,o,n,s,l,d,c,u,f)},IsSearchFromInHouseClass:function(){return window.location.toString().indexOf("SearchClassFromCalendar.aspx")>-1},CalcAndDisplayPriceClassLocation:function(){if(""!=_vgClassSessionSelection.commonProperty.availabledates){var e=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.filter(function(e){return e.appointmentID==$("#hdnAppointmentId").val()?e:null}),t=0,i=_vgCal.Common.model.CurrencySymbol;null!=e&&e.length>0&&null!=_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates&&_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length>0&&(_vgClassSessionSelection.commonProperty.availabledates.eventDetail.isWorkShop?(e[0].streamingEventCapacity>0&&(t=0,t=(t=_vgClassSessionSelection.CalcSessionPrice(_vgClassSessionSelection.commonProperty.sessiondetail,_vgClassSessionSelection.GetNoOfSessions(),_vgClassSessionSelection.GetNoOfAttendees(),!1,!0,!1))*_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length/parseFloat(_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates[0].workShopNoofSessions),$("#divStreamingEventPrice").text(i+_vgClassSessionSelection.ConvertTodecimal(t,2,!1))),e[0].eventCapacity>0&&(t=0,t=(t=_vgClassSessionSelection.CalcSessionPrice(_vgClassSessionSelection.commonProperty.sessiondetail,_vgClassSessionSelection.GetNoOfSessions(),_vgClassSessionSelection.GetNoOfAttendees(),!1,!1,!1))*_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates.length/parseFloat(_vgClassSessionSelection.commonProperty.availabledates.eventAvailableDates[0].workShopNoofSessions),$("#divEventPrice").text(i+_vgClassSessionSelection.ConvertTodecimal(t,2,!1)))):(e[0].streamingEventCapacity>0&&(t=0,t=_vgClassSessionSelection.CalcSessionPrice(_vgClassSessionSelection.commonProperty.sessiondetail,_vgClassSessionSelection.GetNoOfSessions(),_vgClassSessionSelection.GetNoOfAttendees(),!0,!0),$("#divStreamingEventPrice").text(i+_vgClassSessionSelection.ConvertTodecimal(t,2,!1)),_vgClassSessionSelection.model.IsSearchFromInHouseClass&&1==_vgClassSessionSelection.commonProperty.streamingStatus&&(_vgAddon.Model.ClassPrice=parseFloat(t))),e[0].eventCapacity>0&&(t=0,t=_vgClassSessionSelection.CalcSessionPrice(_vgClassSessionSelection.commonProperty.sessiondetail,_vgClassSessionSelection.GetNoOfSessions(),_vgClassSessionSelection.GetNoOfAttendees(),!0,!1),$("#divEventPrice").text(i+_vgClassSessionSelection.ConvertTodecimal(t,2,!1)))))}},GetCalendarDepositSettingAndCCDetails:function(e,t,i){InHouseDeposit.AjaxPostCall(a.GetCalendarDepositSettingAndCCDetails,e,t,i,!1,!0)},RescheduleClass:function(e,t){"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?($("#lblPriceSessionEnrollment").hide(),$("#lblPriceWithTaxSessionEnrollment").show()):($("#lblPriceSessionEnrollment").show(),$("#lblPriceWithTaxSessionEnrollment").hide()),_vgClassSessionSelection.model.RescheduleAppointmentID=t;var i={};i.appointmentId=t,i.eventSessionAttendeesId=e,i.businessID=parseInt(_vgClassSessionSelection.GetCommonBusinessID()),_vgClassSessionSelection.model.IsSearchFromInHouseClass?i.loginUserID=parseInt(_vgClassSessionSelection.getSelectedCustomer()):i.loginUserID=parseInt(_shopdetail.GetRescheduleUserID());var r=new vagaro.ajax;r.datamodel.Token=a.geteventdetailforreschedule,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.Error=_vgClassSessionSelection.CallFailed,r.datamodel.data=i,r.datamodel.callback=_vgClassSessionSelection.RescheduleClassSuccessCallback,r.Post()},RescheduleClassSuccessCallback:function(e){if(null!=e)if(void 0!==e.AddOnDetails&&null!=e.AddOnDetails&&(_vgClassSessionSelection.model.AttendeeAddonDetails=JSON.parse(e.AddOnDetails)),0==e.isUserExists&&(0==e.isClassFull&&!_vgClassSessionSelection.model.IsSearchFromInHouseClass||_vgClassSessionSelection.model.IsSearchFromInHouseClass)){if(1!=e.IsReschedule)return null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline?(vagaro.alert({message:"Rescheduling cannot be done. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Class"}),!1):(vagaro.alert({message:'A deposit was taken upon initial booking with a different merchant account. This can only be rescheduled with an employee using "'+e.MerchantAccountName+'" Merchant Account.',title:"Unable to Reschedule"}),!1);if(_vgClassSessionSelection.model.IsSearchFromInHouseClass){e.StreamingStatus>0?_vgClassSessionSelection.commonProperty.streamingStatus=_vgClassSessionSelection.StreamingStatusEnum.LiveStream:_vgClassSessionSelection.commonProperty.streamingStatus=_vgClassSessionSelection.StreamingStatusEnum.InHouse;var t=_vgClassSessionSelection.CheckRescheduleLocation(_vgClassSessionSelection.model.RescheduleAppointmentID);1==t?vagaro.alertsmall("You can not reschedule In-House class to Live Stream."):2==t?vagaro.alertsmall("You can not reschedule Live Stream class to In-House."):(isFromReschedual="true",_vgCal.ManageAtnd.objAtList=[],_vgClassSessionSelection.commonProperty.DepositPaid=e.DepositPaid,_vgClassSessionSelection.commonProperty.DepositsPaidDate=e.DepositsPaidDateFormated,_vgClassSessionSelection.commonProperty.IsPaid=e.isPaid,_vgClassSessionSelection.ShowEventDetailPopup(e.appointmentID,1,e.oldPrice,e.eventID,e.serviceProviderID,e.strEventDate+" "+e.strStartTime,!1,!1))}else{if(null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline){if(e.IsPriceChange)return vagaro.alert({message:"This class is a different price than the original. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Class"}),!1;if(e.IsClassWorkshopCrossBooking)return vagaro.alert({message:"The rescheduling must be done between classes. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Class"}),!1}var i;i=void 0!==e.CleanupTime&&null!=typeof e.CleanupTime&&e.CleanupTime>0?moment(e.strEndTime,"hh:mm A").subtract(e.CleanupTime,"minutes").format("hh:mm A"):e.strEndTime;var a=[],r={autoId:1};r.eventID=e.eventID,r.eventName=e.title,r.tax=e.tax,r.smallimage=e.photo,r.sessiondetail=null,r.PointRedeem=e.pointRedeem,r.PointGiven=e.pointGiven,r.eventEnrollment=[];var o={autoID:1};if(o.eventID=r.eventID,o.appointmentID=parseInt(e.appointmentID),o.customerID=_shopdetail.GetRescheduleUserID(),o.cFirstName=_shopdetail.GetRescheduleUserName(0),o.cLastName=_shopdetail.GetRescheduleUserName(1),o.cUserEmail=_shopdetail.GetRescheduleUserEmailId(),o.cUserCellNo=_shopdetail.GetRescheduleCellNo(),o.sPID=e.serviceProviderID,o.sPName=e.serviceProviderName,o.eventDate=_shopdetail.StringToDate(e.strEventDate,"-"),o.startTime=e.strStartTime,o.endTime=i,o.duration=e.eventDuration,o.isTempData=!1,o.oldPrice=e.oldPrice,o.IsWorkShop=!1,o.workshopEventOn="",o.workshopEventDays="",o.workshopEventDate="",o.paidType=0,o.StreamingStatus=e.StreamingStatus,o.CustomerStartTime=null,o.CustomerEndTime=null,o.CustomerTimeZone="",o.UtcStartTime=null,o.DurationValue=0,void 0!==e.AddOnDetails&&null!=e.AddOnDetails&&""!=e.AddOnDetails?(o.lstAddonService=JSON.parse(e.AddOnDetails),$.each(o.lstAddonService,function(e,t){t.isPointApply=!1,t.isPresetApply=!1,t.gcId=null,t.isPackage=null,t.isMembershipApply=null,t.isPriceBaseGCApply=!1,t.ServiceId=t.ServiceID,t.paidType=t.PaidType,t.price=t.Price,t.Originalprice=t.Price,t.discount=0,t.IsShowPriceOnline=!0})):o.lstAddonService=null,null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline&&null!=e.isPaid&&null!=e.isPaid&&0==e.isPaid&&null!=e.newPrice&&null!=e.newPrice&&(o.oldPrice=e.newPrice),0==e.isPaid){if(r.promotiondetail=$("#tr-"+e.appointmentID).data("promotiondetail"),void 0!==r.promotiondetail&&""!=r.promotiondetail){r.promotiondetail=r.promotiondetail.trim();var n=r.promotiondetail.split("-");o.PromotionID=r.promotiondetail.split("-")[0],o.IsAmount=0!=r.promotiondetail.split("-")[1],o.AmountValue=r.promotiondetail.split("-")[2],o.PerUserOne=r.promotiondetail.split("-")[3],n.length>4?o.PerTransactionOne=r.promotiondetail.split("-")[4]:o.PerTransactionOne="0",o.PromotionTitle=r.promotiondetail.split("|~~|")[1]}}else r.classGCUsed=0,r.calssdiscountprice=0,o.isPointApply=!1,o.isPresetApply=!1,o.gcId=null,o.isPackage=null,o.isMembershipApply=null,o.isPriceBaseGCApply=!1;if(r.eventEnrollment.push(o),a.push(r),a.length>0)if(1==e.StreamingStatus)_shopdetail.GetEventTimeZoneReschedule(a,e.StreamingStatus,e.isPaid);else{var s={};s.isPaid=1==e.isPaid,s.EventDetail=a,$("#ancShoppingCartIcon").data("classreshedule",JSON.stringify(s)),$("#ancShoppingCartIcon").attr("data-isbypass","true"),$("#ancShoppingCartIcon").click()}}}else if(1==e.isUserExists&&0==e.isClassFull||1==e.isUserExists&&1==e.isClassFull)if(_vgClassSessionSelection.model.IsSearchFromInHouseClass){var l=_vgClassSessionSelection.getSelectedCustomer(),d=cache_glbData.filter(function(e){return e.ID==l?e:null});if((null==d||null!=d&&0==d.length)&&void 0!==$("#txtCustomerSearchClass").attr("custDetail")&&null!=$("#txtCustomerSearchClass").attr("custDetail")&&""!=$("#txtCustomerSearchClass").attr("custDetail")){d=[];var c=JSON.parse($("#txtCustomerSearchClass").attr("custDetail"));d.push(c)}var u=d[0].FN.split(" "),p=u[0]+" "+u[1];vagaro.alertsmall(p+" is already enrolled in this class.")}else vagaro.alertsmall("You are already enrolled in this class.");else 0==e.isUserExists&&1==e.isClassFull&&vagaro.alertsmall("A class can't take any new enrollment as it is full.");ShowLoader(!1),"undefined"!=typeof IsRescheduleAppointment&&"true"==IsRescheduleAppointment.toLowerCase()&&($("#apgSearchProgress").hide(),$("#apgProgress").hide())},RescheduleClassForWorkShop:function(e,t){"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?($("#lblPriceSessionEnrollment").hide(),$("#lblPriceWithTaxSessionEnrollment").show()):($("#lblPriceSessionEnrollment").show(),$("#lblPriceWithTaxSessionEnrollment").hide()),_vgClassSessionSelection.model.RescheduleAppointmentID=t;var i={};i.appointmentId=t,i.eventSessionAttendeesId=e,i.businessID=parseInt(_vgClassSessionSelection.GetCommonBusinessID()),_vgClassSessionSelection.model.IsSearchFromInHouseClass?i.loginUserID=parseInt(_vgClassSessionSelection.getSelectedCustomer()):i.loginUserID=parseInt(_shopdetail.GetRescheduleUserID());var r=new vagaro.ajax;r.datamodel.IsNewVagaroAPI=!0,r.datamodel.Token=a.geteventdetailforrescheduleforworkshop,r.datamodel.Error=_vgClassSessionSelection.CallFailed,r.datamodel.data=i,r.datamodel.callback=_vgClassSessionSelection.RescheduleClassSuccessCallbackForWorkShop,r.Post()},RescheduleClassSuccessCallbackForWorkShop:function(e){if(null!=e&&e.length>0)if(0==e[0].isUserExists&&(0==e[0].isClassFull&&!_vgClassSessionSelection.model.IsSearchFromInHouseClass||_vgClassSessionSelection.model.IsSearchFromInHouseClass)){if(1!=e[0].IsReschedule)return null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline?(vagaro.alert({message:"Rescheduling cannot be done. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Workshop"}),!1):(vagaro.alert({message:'A deposit was taken upon initial booking with a different merchant account. This can only be rescheduled with an employee using "'+e[0].MerchantAccountName+'" Merchant Account.',title:"Unable to Reschedule"}),!1);if(_vgClassSessionSelection.model.IsSearchFromInHouseClass){e[0].StreamingStatus>0?_vgClassSessionSelection.commonProperty.streamingStatus=_vgClassSessionSelection.StreamingStatusEnum.LiveStream:_vgClassSessionSelection.commonProperty.streamingStatus=_vgClassSessionSelection.StreamingStatusEnum.InHouse;var t=_vgClassSessionSelection.CheckRescheduleLocation(_vgClassSessionSelection.model.RescheduleAppointmentID);1==t?vagaro.alertsmall("You can not reschedule In-House class to Live Stream."):2==t?vagaro.alertsmall("You can not reschedule Live Stream class to In-House."):(isFromReschedual="true",_vgClassSessionSelection.commonProperty.DepositPaid=e[0].DepositPaid,_vgClassSessionSelection.commonProperty.DepositsPaidDate=e[0].DepositsPaidDateFormated,_vgClassSessionSelection.commonProperty.IsPaid=e[0].isPaid,_vgClassSessionSelection.ShowEventDetailPopup(e[0].appointmentID,1,e[0].oldPrice,e[0].eventID,e[0].serviceProviderID,e[0].strEventDate+" "+e[0].strStartTime,!1,!1))}else{if(null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline){if(e[0].IsPriceChange)return vagaro.alert({message:"This workshop is a different price than the original. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Workshop"}),!1;if(e[0].IsClassWorkshopCrossBooking)return vagaro.alert({message:"The rescheduling must be done between workshop. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Workshop"}),!1}var i=[],a={autoId:1};a.eventID=e[0].eventID,a.eventName=e[0].title,a.tax=e[0].tax,a.smallimage=e[0].photo,a.sessiondetail=null,a.PointRedeem=e[0].pointRedeem,a.PointGiven=e[0].pointGiven;var r=e[0].workShopNoofSessions+" sessions every "+_vgClassSessionSelection.GetFrequency(e[0].ruleType,e[0].ruleDefinition);1!=e[0].ruleType&&(r+=" on: ");var o=_vgClassSessionSelection.GetFrequencyDays(e[0].ruleType,e[0].ruleDefinition),n="Starting on "+new Date(e[0].strEventDate).format("MMM dd, yyyy").replace(/ 0+/g," ");2==e[0].ruleType&&(o=o.replace(/<br\s*\/?>/gi,", ").slice(0,-2));var s=e.length;if(a.eventEnrollment=[],$.each(e,function(t,i){var l;l=void 0!==i.CleanupTime&&null!=typeof i.CleanupTime&&i.CleanupTime>0?moment(i.strEndTime,"hh:mm A").subtract(i.CleanupTime,"minutes").format("hh:mm A"):i.strEndTime;var d={};if(d.autoID=t+1,d.eventID=i.eventID,d.appointmentID=parseInt(i.appointmentID),d.customerID=_shopdetail.GetRescheduleUserID(),d.cFirstName=_shopdetail.GetRescheduleUserName(0),d.cLastName=_shopdetail.GetRescheduleUserName(1),d.cUserEmail=_shopdetail.GetRescheduleUserEmailId(),d.cUserCellNo=_shopdetail.GetRescheduleCellNo(),d.sPID=i.serviceProviderID,d.sPName=i.serviceProviderName,d.eventDate=_shopdetail.StringToDate(i.strEventDate,"-"),d.startTime=i.strStartTime,d.endTime=l,d.duration=i.eventDuration,d.isTempData=!1,d.oldPrice=i.oldPrice*s,d.IsWorkShop=!0,d.workshopEventOn=r,d.workshopEventDays=o,d.workshopEventDate=n,d.paidType=0,d.StreamingStatus=i.StreamingStatus,d.CustomerStartTime=null,d.CustomerEndTime=null,d.CustomerTimeZone="",d.UtcStartTime=null,d.DurationValue=0,void 0!==i.AddOnDetails&&null!=i.AddOnDetails&&""!=i.AddOnDetails?(d.lstAddonService=JSON.parse(i.AddOnDetails),$.each(d.lstAddonService,function(e,t){t.isPointApply=!1,t.isPresetApply=!1,t.gcId=null,t.isPackage=null,t.isMembershipApply=null,t.isPriceBaseGCApply=!1,t.ServiceId=t.ServiceID,t.paidType=t.PaidType,t.price=t.Price,t.Originalprice=t.Price,t.discount=0,t.IsShowPriceOnline=!0})):d.lstAddonService=null,null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline&&null!=i.newPrice&&null!=i.newPrice&&(d.oldPrice=i.newPrice),0==e[0].isPaid){if(a.promotiondetail=$("#tr-"+i.appointmentID).data("promotiondetail"),void 0!==a.promotiondetail&&""!=a.promotiondetail){a.promotiondetail=a.promotiondetail.trim();var c=a.promotiondetail.split("-");d.PromotionID=a.promotiondetail.split("-")[0],d.IsAmount=0!=a.promotiondetail.split("-")[1],d.AmountValue=a.promotiondetail.split("-")[2],d.PerUserOne=a.promotiondetail.split("-")[3],c.length>4?d.PerTransactionOne=a.promotiondetail.split("-")[4]:d.PerTransactionOne="0",d.PromotionTitle=a.promotiondetail.split("|~~|")[1]}null!=_vgClassSessionSelection.model.IsOnline&&null!=_vgClassSessionSelection.model.IsOnline&&_vgClassSessionSelection.model.IsOnline&&null!=e[0].isPaid&&null!=e[0].isPaid&&0==e[0].isPaid&&null!=i.newPrice&&null!=i.newPrice&&(d.oldPrice=i.newPrice)}else a.classGCUsed=0,a.calssdiscountprice=0,d.isPointApply=!1,d.isPresetApply=!1,d.gcId=null,d.isPackage=null,d.isMembershipApply=null,d.isPriceBaseGCApply=!1;a.eventEnrollment.push(d)}),i.push(a),i.length>0){var l=0;if($.grep(i,function(e){$.grep(e.eventEnrollment,function(e){l=1==e.IsWorkShop&&1==e.StreamingStatus?1:0})}),1==l)_shopdetail.GetEventTimeZoneReschedule(i,l,e[0].isPaid);else{var d={};d.isPaid=1==e[0].isPaid,d.EventDetail=i,$("#ancShoppingCartIcon").data("classreshedule",JSON.stringify(d)),$("#ancShoppingCartIcon").attr("data-isbypass","true"),$("#ancShoppingCartIcon").click()}}}}else if(1==e[0].isUserExists&&0==e[0].isClassFull||1==e[0].isUserExists&&1==e[0].isClassFull)if(_vgClassSessionSelection.model.IsSearchFromInHouseClass){var c=_vgClassSessionSelection.getSelectedCustomer(),u=cache_glbData.filter(function(e){return e.ID==c?e:null});if((null==u||null!=u&&0==u.length)&&void 0!==$("#txtCustomerSearchClass").attr("custDetail")&&null!=$("#txtCustomerSearchClass").attr("custDetail")&&""!=$("#txtCustomerSearchClass").attr("custDetail")){u=[];var p=JSON.parse($("#txtCustomerSearchClass").attr("custDetail"));u.push(p),p=u[0].FN.split(" ")}var h=p[0]+" "+p[1];vagaro.alertsmall(h+" is already enrolled in this class.")}else vagaro.alertsmall("You are already enrolled in this class.");else 0==e[0].isUserExists&&1==e[0].isClassFull&&vagaro.alertsmall("A class can't take any new enrollment as it is full.");ShowLoader(!1)},GetCoreAPIURLWithToken:function(e,t){try{var i="",a=CoreAPIURL.split("/");return a[3]=t,""==(i=a.join("/")+e)&&(i=CoreAPIURL+e),i}catch(t){return CoreAPIURL+e}},CheckRescheduleLocation:function(e){var t=bkEvent.getResponseFromCache();if(null!=t)var i=t.filter(function(t){return t.appointmentID==e?t:null});var a=0;if(null!=i&&i.length>0){var r=void 0===i[0].StreamingEventCapacity?0:i[0].StreamingEventCapacity;_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.LiveStream&&0==r&&(a=2),_vgClassSessionSelection.commonProperty.streamingStatus==_vgClassSessionSelection.StreamingStatusEnum.InHouse&&0==i[0].eventCapacity&&(a=1)}return a},CalAccPriceWithTax:function(e,t){var i;return i=parseFloat(ConvertTodecimalMorePrecious(t/100*parseFloat(e),!0,2))+parseFloat(e),parseFloat(i).toFixed(2)},ConvertTodecimalMorePrecious:function(e,t,i){return isNaN(parseFloat(e))&&(e=0),t?Number(Math.round(e+"e"+i)+"e-"+i).toFixed(i):parseFloat(Number(Math.round(e+"e"+i)+"e-"+i).toFixed(i))},AddOnServiceBind:function(e,t,i){if(null!=e&&null!=e)if(null!=e[0].AddonsList&&e[0].AddonsList.length>0){$(_vgClassSessionSelection.Controls.divAddonPopupSection).show(),$(".moblie-devider").show(),$(".m-addon-text").show();var a=e[0].AddonsList;_vgClassSessionSelection.localData.AddonsList=a;var r=$("#hdnAppointmentId").val(),o=$("#tr-"+r).data("promotiondetail"),n=_vgClassSessionSelection.GetClassPromotionWithLastMinute(o),s=!String.isNullOrUndefineOrBlank(n)&&1==String(n).split("-")[5];$(_vgClassSessionSelection.Controls.AddOnList).empty();var l=$.grep(a,function(e){return 0==e.ServiceLevel}),d=0;$.each(l,function(e){var r=$.grep(a,function(t){return t.ParentServiceID==l[e].ServiceId&&1==t.IsOnlineService});l[e].MinItem=l[e].MinItem>r.length?r.length:l[e].MinItem,l[e].MaxItem=l[e].MaxItem>r.length?r.length:l[e].MaxItem,null!=r&&r.length>0&&(d++,r=r.map(function(a){a.IsRequired=l[e].IsRequired,a.MinItem=l[e].MinItem,a.MaxItem=l[e].MaxItem,a.PromotionDetail=_vgClassSessionSelection.GetAddonDealWithLastMinute(a.PromotionDetail,s),a.NewPrice=i?a.Price:_vgClassSessionSelection.calculateAddonPrice(a.Price,t,$("#txtQuantity").val(),i);try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing){var r=a.Taxes;if(""!=r&&null!=r&&"0"!=r){var o=r.split(","),n=0;if(""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(o.length>0)for(var d=0;d<o.length;d++){var c=JSON.parse(_shopdetail.TaxesValues).Taxes;$.grep(c,function(e){e.BusinessTaxID==o[d]&&(n+=e.Tax)})}a.NewPrice=CalAccPriceWithTax(a.NewPrice,n)}}}}catch(e){}return a.Photo=a.Photo.indexOf("no-shop-image-big.")>0?"":a.Photo,a}),_vgClassSessionSelection.CreateNoneOTAboveObject(r),$(_vgClassSessionSelection.Controls.tmplAddOnCategory).tmpl(l[e]).appendTo(_vgClassSessionSelection.Controls.AddOnList),$(_vgClassSessionSelection.Controls.tmplAddOnService).tmpl(r).appendTo(_vgClassSessionSelection.Controls.AddonServices+r[0].ParentServiceID))}),0==d&&($(_vgClassSessionSelection.Controls.AddOnList).empty(),$(_vgClassSessionSelection.Controls.divAddonPopupSection).hide(),$(".moblie-devider").hide(),$(".m-addon-text").hide());try{if(1==isWaitingtoreal&&null!=Waitlistdata&&null!=typeof Waitlistdata){var c=JSON.parse(Waitlistdata);if(null!=c.lstServiceSPForRealAppointment&&""!=c.lstServiceSPForRealAppointment)for(var u=0;u<c.lstServiceSPForRealAppointment.length;u++){var p=c.lstServiceSPForRealAppointment[u].AddOnIDs.split(",");if(null!=p&&null!=p&&p.length>0)for(var h=0;h<p.length;h++)$("#check_"+p[h]).prop("checked",!0),$("#rdo_"+ +p[h]).prop("checked",!0)}}}catch(e){}_vgClassSessionSelection.CalculateTotalPrice()}else $(_vgClassSessionSelection.Controls.AddOnList).empty(),$(_vgClassSessionSelection.Controls.divAddonPopupSection).hide(),$(".moblie-devider").hide(),$(".m-addon-text").hide();else $(_vgClassSessionSelection.Controls.AddOnList).empty(),$(_vgClassSessionSelection.Controls.divAddonPopupSection).hide(),$(".moblie-devider").hide(),$(".m-addon-text").hide()},CalculateTotalPrice:function(e){if(void 0!==e&&null!=e){var t=parseInt($(e).attr("data-parentserviceid"));if(0==_vgClassSessionSelection.OnEventAddonValidate(t))return $(e).prop("checked",!1),!1}var i="FREE"==$(_vgClassSessionSelection.Controls.divHdrEventPrice).text()?0:parseFloat($(_vgClassSessionSelection.Controls.divHdrEventPrice).text().replace(_vgClassSessionSelection.GetcurrencySymbol(),""));$.each($("#divAddonPopupSection input[type='checkbox']:checked"),function(e,t){if("true"==$(t).attr("data-IsShowPriceOnline")){var a=void 0===$(t).attr("data-newprice")?0:parseFloat($(t).attr("data-newprice"));i+=parseFloat(a)}}),$.each($("#divAddonPopupSection input[type='radio']:checked"),function(e,t){if("true"==$(t).attr("data-IsShowPriceOnline")){var a=void 0===$(t).attr("data-newprice")?0:parseFloat($(t).attr("data-newprice"));i+=parseFloat(a)}}),i=_onlineCheckout.parseTodecimal(i,2).format("#.##"),$(".TotalClassPrice").text(_vgClassSessionSelection.GetcurrencySymbol()+i),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#hdnAdjustClassTotalPrice").val(i)},CreateAddonCollection:function(e){var t=[];return $.each($("#divAddonPopupSection input[type='checkbox']:checked"),function(i,a){var r={};r.ServiceTitle=$(a).attr("data-serviceTitle"),r.Price=parseFloat($(a).attr("data-price")),r.Originalprice=parseFloat($(a).attr("data-price")),r.ServiceId=$(a).attr("data-serviceid"),r.ParentServiceID=$(a).attr("data-parentserviceId"),r.ServiceDesc=$(a).attr("data-serviceDisc"),r.IsShowPriceOnline=$(a).attr("data-IsShowPriceOnline"),r.customerID=e.customerID,r.cUserEmail=e.cUserEmail,r.autoID=e.autoID+"_"+r.ServiceId,r.eventID=e.eventID;var o=$(a).attr("data-promotiondetail");if(void 0!==o&&""!=o){var n=o.split("-");r.PromotionID=o.split("-")[0],r.IsAmount=0!=o.split("-")[1],r.AmountValue=o.split("-")[2],r.PerUserOne=o.split("-")[3],n.length>4?r.PerTransactionOne=o.split("-")[4]:r.PerTransactionOne="0",r.PromotionTitle=o.split("|~~|")[1]}t.push(r)}),$.each($("#divAddonPopupSection input[type='radio']:checked"),function(i,a){if("true"!=$(a).attr("data-IsNOTA")){var r={};r.ServiceTitle=$(a).attr("data-serviceTitle"),r.Price=parseFloat($(a).attr("data-price")),r.Originalprice=parseFloat($(a).attr("data-price")),r.ServiceId=$(a).attr("data-serviceid"),r.ParentServiceID=$(a).attr("data-parentserviceId"),r.ServiceDesc=$(a).attr("data-serviceDisc"),r.IsShowPriceOnline=$(a).attr("data-IsShowPriceOnline"),r.customerID=e.customerID,r.cUserEmail=e.cUserEmail,r.autoID=e.autoID+"_"+r.ServiceId,r.eventID=e.eventID;var o=$(a).attr("data-promotiondetail");if(void 0!==o&&""!=o){var n=o.split("-");r.PromotionID=o.split("-")[0],r.IsAmount=0!=o.split("-")[1],r.AmountValue=o.split("-")[2],r.PerUserOne=o.split("-")[3],n.length>4?r.PerTransactionOne=o.split("-")[4]:r.PerTransactionOne="0",r.PromotionTitle=o.split("|~~|")[1]}t.push(r)}}),t},AddonValidate:function(){var e=_vgClassSessionSelection.localData.AddonsList;if(null==e||null==e||0==e.length)return!0;var t=$.grep(e,function(e){return 0==e.ServiceLevel}),i=0;return $.each(t,function(a){var r=$.grep(e,function(e){return e.ParentServiceID==t[a].ServiceId&&1==e.IsOnlineService});if(null!=r&&r.length>0){var o=_vgClassSessionSelection.ValidateAddonService(r,t[a].MinItem,t[a].MaxItem,t[a].IsRequired,!1);$("#errMsg_"+t[a].ServiceId).text(o),$("#divErrorAddon_"+t[a].ServiceId).hide(),""!=o&&($("#divErrorAddon_"+t[a].ServiceId).show(),i++)}}),0==i},ValidateAddonService:function(e,t,i,a,r){var o="",n=0;if(0!=t||1==a||0!=i){if($.each(e,function(a){1==t&&1==i?$("#rdo_"+e[a].ServiceId).prop("checked")&&n++:$("#check_"+e[a].ServiceId).prop("checked")&&n++}),1==a&&t>0){if(t>n&&!r){var s=t>1?" add-ons.":" add-on.";o="Please select at least "+_vgClassSessionSelection.NumberToWord(t)+s}else if(0!=i&&n>i){s=i>1?" add-ons.":" add-on.";o="Please select total "+_vgClassSessionSelection.NumberToWord(i)+s}}else if(0!=i&&n>i){s=i>1?" add-ons.":" add-on.";o="Please select total "+_vgClassSessionSelection.NumberToWord(i)+s}return o}return o},calculateAddonPrice:function(e,t,i){for(var a=$("#hdnAppointmentId").val(),r=$("#tr-"+a).data("sessiondetail").split(","),o=0;o<=r.length-1&&parseInt(i)>=parseInt(r[o].split("-")[1]);o++)parseInt(r[o].split("-")[1]);return parseInt(i)*e*parseInt(t)},NumberToWord:function(e){var t="";return[{value:1e7,str:"crore"},{value:1e5,str:"lakh"},{value:1e3,str:"thousand"},{value:100,str:"hundred"},{value:90,str:"ninety"},{value:80,str:"eighty"},{value:70,str:"seventy"},{value:60,str:"sixty"},{value:50,str:"fifty"},{value:40,str:"forty"},{value:30,str:"thirty"},{value:20,str:"twenty"},{value:19,str:"nineteen"},{value:18,str:"eighteen"},{value:17,str:"seventeen"},{value:16,str:"sixteen"},{value:15,str:"fifteen"},{value:14,str:"fourteen"},{value:13,str:"thirteen"},{value:12,str:"twelve"},{value:11,str:"eleven"},{value:10,str:"ten"},{value:9,str:"nine"},{value:8,str:"eight"},{value:7,str:"seven"},{value:6,str:"six"},{value:5,str:"five"},{value:4,str:"four"},{value:3,str:"three"},{value:2,str:"two"},{value:1,str:"one"}].forEach(function(i){if(e>=i.value){if(!(e<=99)){var a=Math.floor(e/i.value),r=e%i.value;return r>0?NumberToWord(a)+" "+i.str+" "+NumberToWord(r):NumberToWord(a)+" "+i.str}t+=i.str,(e-=i.value)>0&&(t+=" ")}}),t},ResetMoreButton:function(){$("#eventDescription").css("height",""),$("#btnMoreContent").html("More"),$("#btnMoreContent").removeClass("active")},CreateClassAttendeeAddonCollection:function(e){for(var t=[],i=_vgSearchAddon.Model.SelectedAddonService,a=0;a<i.length;a++)for(var r=0;r<i[a].lstAddonService.length;r++){var o={};o.ServiceTitle=i[a].lstAddonService[r].ServiceTitle,"undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value?o.Price=parseFloat(ConvertTodecimalMorePrecious(parseFloat(i[a].lstAddonService[r].Price)/(1+_vgClassSessionSelection.GetTaxTotalForService(CalendarConfiguration.CommonDetails.BusinessTaxes,i[a].lstAddonService[r].Taxation)/100),!0,2)):o.Price=i[a].lstAddonService[r].Price,o.ServiceId=i[a].lstAddonService[r].serviceId,o.Duration=i[a].lstAddonService[r].Duration,o.ServiceDesc=i[a].lstAddonService[r].ServiceDesc,o.Taxation=_vgClassSessionSelection.GetTaxTotalForService(CalendarConfiguration.CommonDetails.BusinessTaxes,i[a].lstAddonService[r].Taxation),o.CalculatedTaxTypeWise=_vgClassSessionSelection.GetTaxesForService(CalendarConfiguration.CommonDetails.BusinessTaxes,i[a].lstAddonService[r].Taxation),o.pointsRedeem=i[a].lstAddonService[r].PointRedeem,t.push(o)}return t},CreateClassAttendeeAddonXMl:function(e,t,i,a){var r=_vgClassSessionSelection.GetCartUserDetail();$.each(e,function(e,o){var n=null;n=_vgClassSessionSelection.createXmlElement("appointment");var s;if((s=t.isHandleDuetoException,n.append(_vgClassSessionSelection.createXmlElement("isHandleDuetoException",1==s?"1":"0")),n.append(_vgClassSessionSelection.createXmlElement("appId",t.appointmentID)),n.append(_vgClassSessionSelection.createXmlElement("spid",t.sPID)),n.append(_vgClassSessionSelection.createXmlElement("spname","")),n.append(_vgClassSessionSelection.createXmlElement("isworkshop",t.IsWorkShop)),n.append(_vgClassSessionSelection.createXmlElement("appstarttime",new Date(t.eventDate).format("yyyy-MM-dd")+" "+t.startTime)),i.append(n),n.append(_vgClassSessionSelection.createXmlElement("fname",t.cFirstName)),n.append(_vgClassSessionSelection.createXmlElement("lname",t.cLastName)),n.append(_vgClassSessionSelection.createXmlElement("email",t.cUserEmail)),n.append(_vgClassSessionSelection.createXmlElement("cellno",t.cUserCellNo)),5!=a&&null!=txtDepositCls&&null!=txtDepositCls&&""!=txtDepositCls&&null!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls&&null!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls&&""!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls)&&(0!=_vgCal.ManageAtnd.model.NewApp_txtPriceCls&&0!=txtDepositCls.value))if("undefined"!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value&&_vgCal.ManageAtnd.objAtList.length<=1){if(void 0!==InHouseDeposit.model.AppObj[0].eventEnrollment&&null!=InHouseDeposit.model.AppObj[0].eventEnrollment&&InHouseDeposit.model.AppObj[0].eventEnrollment.length>0){var l,d=0;$.grep(InHouseDeposit.model.AppObj[0].eventEnrollment,function(e,t){if(e.depositsPercentage<100){d+=e.Price;var i=parseFloat(InHouseDeposit.ConvertDecimalWithFixed(100*parseFloat(e.depositsPaid)/e.Price,!0,2));if(e.depositsPercentage=i,e.lstAddonService.length>0)for(var a=0;a<e.lstAddonService.length;a++)d+=e.lstAddonService[a].Price,e.lstAddonService[a].depositsPercentage<100&&(e.lstAddonService[a].depositsPercentage=parseFloat(InHouseDeposit.ConvertDecimalWithFixed(100*parseFloat(e.lstAddonService[a].depositsPaid)/e.lstAddonService[a].Price,!0,2)))}}),1*(l=100*txtDepositCls.value/d)>100&&(l=100),n.append(_vgClassSessionSelection.createXmlElement("DepositsPercentage",l))}}else _vgCal.ManageAtnd.objAtList.length>1?n.append(_vgClassSessionSelection.createXmlElement("DepositsPercentage",_vgClassSessionSelection.GetDepositPercentage(t.customerID))):(1*(l=100*txtDepositCls.value/_vgCal.ManageAtnd.model.NewApp_txtPriceCls)>100&&(l=100),n.append(_vgClassSessionSelection.createXmlElement("DepositsPercentage",l)));if(100==o.depositsPercentage){if("undefined"!=o.CalculatedTaxTypeWise&&null!=o.CalculatedTaxTypeWise&&o.CalculatedTaxTypeWise.length>0){var c=0;$.each(o.CalculatedTaxTypeWise,function(e,t){c+=t.Tax}),n.append(_vgClassSessionSelection.createXmlElement("addontaxation",c)),n.append(_vgClassSessionSelection.createXmlElement("calculatedtaxtypewise",JSON.stringify(o.CalculatedTaxTypeWise)));var u=$.map(o.CalculatedTaxTypeWise,function(e){return e.BusinessTaxID}).join();n.append(_vgClassSessionSelection.createXmlElement("taxes",u))}}else if("undefined"!=typeof hdnPriceWithTaxSwitch&&null!=hdnPriceWithTaxSwitch&&null!=hdnPriceWithTaxSwitch&&!String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)&&"1"==hdnPriceWithTaxSwitch.value&&"undefined"!=o.CalculatedTaxTypeWise&&null!=o.CalculatedTaxTypeWise&&o.CalculatedTaxTypeWise.length>0){n.append(_vgClassSessionSelection.createXmlElement("calculatedtaxtypewise",JSON.stringify(o.CalculatedTaxTypeWise)));u=$.map(o.CalculatedTaxTypeWise,function(e){return e.BusinessTaxID}).join()}if(5==a){if(n.append(_vgClassSessionSelection.createXmlElement("paidtype",o.paidType)),o.paidType!=InHouseDeposit.arrpaidType.DepositsClass&&o.paidType!=InHouseDeposit.arrpaidType.PartiallyPaidClass||void 0!==o.depositsPaid&&(n.append(_vgClassSessionSelection.createXmlElement("depositspercentage",o.depositsPercentage)),n.append(_vgClassSessionSelection.createXmlElement("depositspaid",o.depositsPaid)),n.append(_vgClassSessionSelection.createXmlElement("payableamount",o.Price)),n.append(_vgClassSessionSelection.createXmlElement("depositsremaining",_vgClassSessionSelection.ConvertTodecimal(o.Price-o.depositsPaid,2,!1)))),InHouseDeposit.model.TipPer>0&&o.paidType==InHouseDeposit.arrpaidType.PaidClass){var p=InHouseDeposit.ConvertDecimalWithFixed(wadPrice,!1,2);1!=o.isPackage&&1!=o.isPointApply||(p=InHouseDeposit.ConvertDecimalWithFixed(o.Originalprice,!1,2));var h=0;tipCalculatedCount+=1,h=tipCalculatedCount==PaidClassCount?InHouseDeposit.ConvertDecimalWithFixed(InHouseDeposit.model.Tip-tipCalculated,!1,2):InHouseDeposit.ConvertDecimalWithFixed(p*InHouseDeposit.model.TipPer/100,!1,2),n.append(_vgClassSessionSelection.createXmlElement("tipAmount",h)),tipCalculated+=h}if(n.append(_vgClassSessionSelection.createXmlElement("promotionid",0)),(1==o.isPackage||0==o.isPackage)&&o.gcId>0||1==o.isPriceBaseGCApply){var m=[],f=[];1==o.isPriceBaseGCApply?n.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!0)):n.append(_vgClassSessionSelection.createXmlElement("ispricebasedgc",!1)),n.append(_vgClassSessionSelection.createXmlElement("ispackage",o.isPackage)),1==o.isPriceBaseGCApply&&$.each(o.GCDetailPriceBase,function(e,t){m.push(t.GCId),f.push(t.GCAmount)}),n.append(_vgClassSessionSelection.createXmlElement("gcid",void 0===o.gcId||null==o.gcId?0:o.gcId)),n.append(_vgClassSessionSelection.createXmlElement("gcids",0==m.length?0:m.join(","))),n.append(_vgClassSessionSelection.createXmlElement("gcamount",0==f.length?0:f.join(","))),o.RedeemServiceId>0&&n.append(_vgClassSessionSelection.createXmlElement("redeemserviceid",o.RedeemServiceId))}if(1==o.isPointApply){var g=0;1==o.IsPartialPointApply&&(g=o.PartialServicePrice),n.append(_vgClassSessionSelection.createXmlElement("ispartialpointapply",o.IsPartialPointApply)),n.append(_vgClassSessionSelection.createXmlElement("partialserviceprice",g)),n.append(_vgClassSessionSelection.createXmlElement("ispointapply",o.isPointApply)),n.append(_vgClassSessionSelection.createXmlElement("pointsredeem",o.pointsRedeem))}if(1==o.isMembershipApply&&null!=o.membershipUniqueID&&null!=o.membershipUniqueID&&""!=o.membershipUniqueID){n.append(_vgClassSessionSelection.createXmlElement("ismembershipapply",o.isMembershipApply)),n.append(_vgClassSessionSelection.createXmlElement("membershipdiscountpercentage",o.membershipDiscount)),n.append(_vgClassSessionSelection.createXmlElement("membershipuserid",o.membershipuserid)),n.append(_vgClassSessionSelection.createXmlElement("membershipuniqueid",o.membershipUniqueID));var v=null;if((v=_vgClassSessionSelection.createXmlElement("membershipredeemeddetails")).append(_vgClassSessionSelection.createXmlElement("businessid",o.BusinessID)),v.append(_vgClassSessionSelection.createXmlElement("redeembusinessid",o.RedeemBusinessId)),0==t.customerID)null!=(A=$.grep(r,function(e){return 0==t.customerID&&e.emailId==t.cUserEmail}))&&A.length>0?v.append(_vgClassSessionSelection.createXmlElement("userid",A[0].userId)):v.append(_vgClassSessionSelection.createXmlElement("userid",t.customerID));else v.append(_vgClassSessionSelection.createXmlElement("userid",t.customerID));v.append(_vgClassSessionSelection.createXmlElement("membershipuserid",o.membershipuserid)),v.append(_vgClassSessionSelection.createXmlElement("membershipid",o.MembershipID)),v.append(_vgClassSessionSelection.createXmlElement("membershipitemid",o.MembershipItemId)),v.append(_vgClassSessionSelection.createXmlElement("groupid",o.GroupId)),v.append(_vgClassSessionSelection.createXmlElement("isunlimitedvisit",-1==o.VisitRemaining)),v.append(_vgClassSessionSelection.createXmlElement("serviceproductname",o.eventName.trim())),n.append(v)}_vgCal.ManageAtnd.model.IsCheckout=!1}else n.append(_vgClassSessionSelection.createXmlElement("paidtype",t.paidType));n.append(_vgClassSessionSelection.createXmlElement("streamingstatus",t.StreamingStatus));var A,C="";0==t.customerID?(C=A=$.grep(r,function(e){return 0==t.customerID&&e.emailId==t.cUserEmail}),null!=A&&A.length>0?n.append(_vgClassSessionSelection.createXmlElement("userid",A[0].userId)):n.append(_vgClassSessionSelection.createXmlElement("userid",t.customerID))):(C=$.grep(r,function(e){return e.userId==t.customerID}),n.append(_vgClassSessionSelection.createXmlElement("userid",t.customerID)));if(null!=C&&C.length>0&&n.append(_vgClassSessionSelection.createXmlElement("isnewcustomer",C[0].isNewCustomer)),0==isCheckInApp){var y=!1;$(".cartremoverdtl").each(function(e,t){void 0!==$(t).attr("data-isWorkShop")&&"true"==$(t).attr("data-isWorkShop").toLowerCase()&&(y=!0)});var b=_vgClassSessionSelection.GetRescheduleDetail();null!=b&&(y||(isReschedule=!0),n.append(_vgClassSessionSelection.createXmlElement("eventsessionattendeeid",b.EventSessionAttendeesId)))}n.append(_vgClassSessionSelection.createXmlElement("isAddon",!0)),n.append(_vgClassSessionSelection.createXmlElement("uniqueAddonID","addon"+t.appointmentID+t.autoID)),n.append(_vgClassSessionSelection.createXmlElement("serviceid",o.ServiceId)),n.append(_vgClassSessionSelection.createXmlElement("addonname",o.ServiceTitle)),n.append(_vgClassSessionSelection.createXmlElement("price",o.Price))})},OnEventAddonValidate:function(e){var t=_vgClassSessionSelection.localData.AddonsList;if(null==t||null==t||0==t.length)return!0;var i=$.grep(t,function(t){return 0==t.ServiceLevel&&t.ServiceId==e}),a=0;return $.each(i,function(e){var r=$.grep(t,function(t){return t.ParentServiceID==i[e].ServiceId&&1==t.IsOnlineService});if(null!=r&&r.length>0){var o=_vgClassSessionSelection.ValidateAddonService(r,i[e].MinItem,i[e].MaxItem,i[e].IsRequired,!0);$("#errMsg_"+i[e].ServiceId).text(o),$("#divErrorAddon_"+i[e].ServiceId).hide(),""!=o&&a++}}),0==a},CreateNoneOTAboveObject:function(e){if(0==e[0].IsRequired&&(1==e[0].MinItem&&1==e[0].MaxItem||0==e[0].MinItem&&1==e[0].MaxItem)){var t={};t.MinItem=e[0].MinItem,t.MaxItem=e[0].MaxItem,t.ServiceId=e[0].ServiceId+e[0].ParentServiceID,t.ParentServiceID=e[0].ParentServiceID,t.ServiceTitle="None of the above",t.ServiceDesc="",t.IsShowPriceOnline=!1,t.Photo="",t.Price=0,t.NewPrice=0,t.PromotionDetail="",t.IsNOTA=!0,e.push(t)}},ClassPromotionForNewCustomer:function(e){var t=!0;try{if(1==e.hasOwnProperty("promotionID")){var i=e.promotionID;if(void 0!==i&&null!=i&&void 0!==PromotionDetails&&null!=PromotionDetails){var a=$.grep(PromotionDetails,function(e){return e.PromotionID==i});null!=a&&a.length>0&&"2"==a[0].CustomerFilters&&0==IsForNewCustomer&&"0"!=UserID&&(t=!1),null!=a&&a.length>0&&"1"==a[0].CustomerFilters&&1==IsForNewCustomer&&"0"!=UserID&&(t=!1)}}}catch(e){}return t},GetClassPromotionWithLastMinute:function(e){try{if(String.isNullOrUndefineOrBlank(e))return e;if(void 0===PromotionDetails||null==PromotionDetails)return e;var t=e.split("-")[5];if(1==t){var i=jQuery.grep(PromotionDetails,function(e){return e.IsLastMinuteBooked==t});return i.length>0&&void 0!==i[0].IsLastMinuteBooked&&null!=i[0].IsLastMinuteBooked&&0!=i[0].IsLastMinuteBooked?e:""}}catch(e){}return e},GetAddonDealWithLastMinute:function(e,t){try{if(String.isNullOrUndefineOrBlank(e))return e;var i=e.split("|~~|");if(i.length<4)return e;for(var a="",r="",o=0;o+3<i.length;o+=4){var n=i[o]+"|~~|"+i[o+1]+"|~~|"+i[o+2]+"|~~|"+i[o+3];1==i[o].split("-")[5]?""===r&&(r=n):""===a&&(a=n)}return t&&""!==r?r:a}catch(t){return e}},UpdateClassDealDiscountBadge:function(e,t){try{var i=$(".promo-digit","#divdd-select-search5");if(0===i.length)return;if(String.isNullOrUndefineOrBlank($("#hdnClassIDForClass").val()))return;if(null==e||""===e.toString().trim())return void i.html("").hide();var a=e.toString().split("-"),r=a[1],o=Number(a[2]);if(isNaN(o)||o<=0)return void i.html("").hide();var n=void 0!==_shopdetail?_shopdetail.currencySymbol:"",s="";if(0==r){s=(o%1==0?o.toString():o.toFixed(2))+"% OFF"}else{var l=Number(t)-o;(isNaN(l)||l<0)&&(l=0),s=n+l.toFixed(2)}i.html('<div class="vg-service-video"><em>&#xf02b</em><span>'+s+"</span></div>").show(),$("#divdd-select-search5").show()}catch(e){}}},bkClassAvailableDates={timeSlotsCache:{},model:{},init:function(){this.model.cacheLen=3,this.model.cacheDuration=5},getCacheKey:function(){return this.model.csvServiceID.toString()+"-"+this.model.csvSPID.toString()+"-"+this.model.csvFilterType.toString()},addResponseToCache:function(e){if(void 0===this.timeSlotsCache[this.getCacheKey()]||null===this.timeSlotsCache[this.getCacheKey()]){this.timeSlotsCache[this.getCacheKey()]={timestamp:new Date,resp:e},Object.keys||(Object.keys=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i);return t});var t=Object.keys(this.timeSlotsCache);t.length>this.model.cacheLen&&delete this.timeSlotsCache[t[0]]}},getResponseFromCache:function(){if(void 0!==this.timeSlotsCache[this.getCacheKey()]&&null!==this.timeSlotsCache[this.getCacheKey()]){var e=this.timeSlotsCache[this.getCacheKey()].timestamp,t=new Date;if(t.setMinutes(t.getMinutes()-this.model.cacheDuration),e>t)return this.timeSlotsCache[this.getCacheKey()].resp;this.removeCacheByCurKey()}return null},removeCacheByCurKey:function(){delete this.timeSlotsCache[this.getCacheKey()]}},bkEvent={timeSlotsCache:{},model:{},init:function(){this.model.cacheLen=3,this.model.cacheDuration=30},getCacheKey:function(){return this.model.searchFromDate.toString()+"-"+this.model.searchToDate.toString()+"-"+this.model.csvServiceID.toString()+"-"+this.model.csvSPID.toString()+"-"+this.model.csvFilterType.toString()},addResponseToCache:function(e){if(void 0===this.timeSlotsCache[this.getCacheKey()]||null===this.timeSlotsCache[this.getCacheKey()]){this.timeSlotsCache[this.getCacheKey()]={timestamp:new Date,resp:e},Object.keys||(Object.keys=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i);return t});var t=Object.keys(this.timeSlotsCache);t.length>this.model.cacheLen&&delete this.timeSlotsCache[t[0]]}},getResponseFromCache:function(){if(void 0!==this.timeSlotsCache[this.getCacheKey()]&&null!==this.timeSlotsCache[this.getCacheKey()]){var e=this.timeSlotsCache[this.getCacheKey()].timestamp,t=new Date;if(t.setMinutes(t.getMinutes()-this.model.cacheDuration),e>t)return this.timeSlotsCache[this.getCacheKey()].resp;this.removeCacheByCurKey()}return null},removeCacheByCurKey:function(){delete this.timeSlotsCache[this.getCacheKey()]}}}(),$(document).on("click",".addguestlink",function(){$(this).closest("div.panel-default").find("div.panel-heading").attr("id");$("#ffguestmodel").attr("data-value",$(this).closest("div.panel-default").find("div.panel-heading").attr("id")),$("#ffguestdetail input").each(function(){$(this).val(""),$(this).removeClass("errorInput")}),$("#ffguestdetail div.validatemsg").each(function(){$(this).hide()}),$("html, body").animate({scrollTop:0},"swing",function(){})}),$(document).on("click",".classAppointment .w-dropdown-toggle",function(){var e=$(this).offset().top,t=$(".AppSearchResult").height()+50-($(this).offset().top+$(this).outerHeight()),i=$(".w-dropdown-list").height()+$(".w-dropdown-toggle").outerHeight();$(".w-dropdown-list").removeClass("activeFlip activeFlipTop"),e<i?$(this).next(".w-dropdown-list").addClass("activeFlip"):$(".w-dropdown-list").removeClass("activeFlip"),t<i?$(this).next(".w-dropdown-list").addClass("activeFlipTop"):$(".w-dropdown-list").removeClass("activeFlipTop")}),$(window).resize(function(){var e=$(".panel-heading").width();$(".ffattendeelist-bg").attr("style","Width:"+e+"px")}),$(window).on("orientationchange",function(){try{isMobileDevice()&&$("#classDetailpopup").is(":visible")&&setTimeout(function(){try{var e=$("#hdnAppointmentId").val(),t=$("#tr-"+e),i=null;if(t.length&&""!=t.data("availabledates"))try{i=JSON.parse(t.data("availabledates"))}catch(e){i=null}i&&null!=e&&""!==e&&_vgClassSessionSelection.ResetCalendarControl(i,e)}catch(e){}},300)}catch(e){}}),function(e,t,i){i(e).on("load",function(){if("undefined"!=typeof $Interframe&&void 0!==i.fn.modal){var t=i.fn.modal.Constructor.prototype.show;i.extend(i.fn.modal.Constructor.prototype,{show:function(a){var r=i(this.$element);void 0===this.$element&&(r=i(this._element));var o=r.not(".in,.show").find(".modal-dialog");if(0==o.length&&(o=r.find(".modal-dialog")),o.length>0){o.css("margin-top","0px").css("margin-bottom","0px").css("top","0px").css("bottom","0px"),r.css("display","block"),$Interframe.centerPopup(o);var n=function(e){$Interframe.centerPopup(o)};i(this.$element).on("shown.bs.modal",function(t){n(),i(e).on("viewport.interframe",n)}).on("hidden.bs.modal",function(t){i(e).off("viewport.interframe",n)})}return t.call(this,a)}})}})}(window,document,jQuery),
/*!
 * Webflow: Front-end site library
 * @license MIT
 * Inline scripts may access the api using an async handler:
 *   var Webflow = Webflow || [];
 *   Webflow.push(readyFunction);
 */
function(){"use strict";function e(e,t){return e(t={exports:{}},t.exports),t.exports
/*!
     * tram.js v0.8.2-global
     * Cross-browser CSS3 transitions in JavaScript
     * https://github.com/bkwld/tram
     * MIT License
     */}window.tram=function(e){function t(e,t){return(new $.Bare).init(e,t)}function i(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function a(e){var t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,255&t]}function r(e,t,i){return"#"+(1<<24|e<<16|t<<8|i).toString(16).slice(1)}function o(){}function n(e,t,i){l("Units do not match ["+e+"]: "+t+", "+i)}function s(e,t,i){if(void 0!==t&&(i=t),void 0===e)return i;var a=i;return q.test(e)||!J.test(e)?a=parseInt(e,10):J.test(e)&&(a=1e3*parseFloat(e)),0>a&&(a=0),a==a?a:i}function l(e){j.debug&&window&&window.console.warn(e)}var d=function(e,t){function i(e){return"object"==typeof e}function a(e){return"function"==typeof e}function r(){}return function o(n,s){function l(){var e=new d;return a(e.init)&&e.init.apply(e,arguments),e}function d(){}void 0===s&&(s=n,n=Object),l.Bare=d;var c,u=r[e]=n[e],p=d[e]=l[e]=new r;return p.constructor=l,l.mixin=function(t){return d[e]=l[e]=o(l,t)[e],l},l.open=function(e){if(c={},a(e)?c=e.call(l,p,u,l,n):i(e)&&(c=e),i(c))for(var r in c)t.call(c,r)&&(p[r]=c[r]);return a(p.init)||(p.init=n),l},l.open(s)}}("prototype",{}.hasOwnProperty),c={ease:["ease",function(e,t,i,a){var r=(e/=a)*e,o=r*e;return t+i*(-2.75*o*r+11*r*r+-15.5*o+8*r+.25*e)}],"ease-in":["ease-in",function(e,t,i,a){var r=(e/=a)*e,o=r*e;return t+i*(-1*o*r+3*r*r+-3*o+2*r)}],"ease-out":["ease-out",function(e,t,i,a){var r=(e/=a)*e,o=r*e;return t+i*(.3*o*r+-1.6*r*r+2.2*o+-1.8*r+1.9*e)}],"ease-in-out":["ease-in-out",function(e,t,i,a){var r=(e/=a)*e,o=r*e;return t+i*(2*o*r+-5*r*r+2*o+2*r)}],linear:["linear",function(e,t,i,a){return i*e/a+t}],"ease-in-quad":["cubic-bezier(0.550, 0.085, 0.680, 0.530)",function(e,t,i,a){return i*(e/=a)*e+t}],"ease-out-quad":["cubic-bezier(0.250, 0.460, 0.450, 0.940)",function(e,t,i,a){return-i*(e/=a)*(e-2)+t}],"ease-in-out-quad":["cubic-bezier(0.455, 0.030, 0.515, 0.955)",function(e,t,i,a){return(e/=a/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t}],"ease-in-cubic":["cubic-bezier(0.550, 0.055, 0.675, 0.190)",function(e,t,i,a){return i*(e/=a)*e*e+t}],"ease-out-cubic":["cubic-bezier(0.215, 0.610, 0.355, 1)",function(e,t,i,a){return i*((e=e/a-1)*e*e+1)+t}],"ease-in-out-cubic":["cubic-bezier(0.645, 0.045, 0.355, 1)",function(e,t,i,a){return(e/=a/2)<1?i/2*e*e*e+t:i/2*((e-=2)*e*e+2)+t}],"ease-in-quart":["cubic-bezier(0.895, 0.030, 0.685, 0.220)",function(e,t,i,a){return i*(e/=a)*e*e*e+t}],"ease-out-quart":["cubic-bezier(0.165, 0.840, 0.440, 1)",function(e,t,i,a){return-i*((e=e/a-1)*e*e*e-1)+t}],"ease-in-out-quart":["cubic-bezier(0.770, 0, 0.175, 1)",function(e,t,i,a){return(e/=a/2)<1?i/2*e*e*e*e+t:-i/2*((e-=2)*e*e*e-2)+t}],"ease-in-quint":["cubic-bezier(0.755, 0.050, 0.855, 0.060)",function(e,t,i,a){return i*(e/=a)*e*e*e*e+t}],"ease-out-quint":["cubic-bezier(0.230, 1, 0.320, 1)",function(e,t,i,a){return i*((e=e/a-1)*e*e*e*e+1)+t}],"ease-in-out-quint":["cubic-bezier(0.860, 0, 0.070, 1)",function(e,t,i,a){return(e/=a/2)<1?i/2*e*e*e*e*e+t:i/2*((e-=2)*e*e*e*e+2)+t}],"ease-in-sine":["cubic-bezier(0.470, 0, 0.745, 0.715)",function(e,t,i,a){return-i*Math.cos(e/a*(Math.PI/2))+i+t}],"ease-out-sine":["cubic-bezier(0.390, 0.575, 0.565, 1)",function(e,t,i,a){return i*Math.sin(e/a*(Math.PI/2))+t}],"ease-in-out-sine":["cubic-bezier(0.445, 0.050, 0.550, 0.950)",function(e,t,i,a){return-i/2*(Math.cos(Math.PI*e/a)-1)+t}],"ease-in-expo":["cubic-bezier(0.950, 0.050, 0.795, 0.035)",function(e,t,i,a){return 0===e?t:i*Math.pow(2,10*(e/a-1))+t}],"ease-out-expo":["cubic-bezier(0.190, 1, 0.220, 1)",function(e,t,i,a){return e===a?t+i:i*(1-Math.pow(2,-10*e/a))+t}],"ease-in-out-expo":["cubic-bezier(1, 0, 0, 1)",function(e,t,i,a){return 0===e?t:e===a?t+i:(e/=a/2)<1?i/2*Math.pow(2,10*(e-1))+t:i/2*(2-Math.pow(2,-10*--e))+t}],"ease-in-circ":["cubic-bezier(0.600, 0.040, 0.980, 0.335)",function(e,t,i,a){return-i*(Math.sqrt(1-(e/=a)*e)-1)+t}],"ease-out-circ":["cubic-bezier(0.075, 0.820, 0.165, 1)",function(e,t,i,a){return i*Math.sqrt(1-(e=e/a-1)*e)+t}],"ease-in-out-circ":["cubic-bezier(0.785, 0.135, 0.150, 0.860)",function(e,t,i,a){return(e/=a/2)<1?-i/2*(Math.sqrt(1-e*e)-1)+t:i/2*(Math.sqrt(1-(e-=2)*e)+1)+t}],"ease-in-back":["cubic-bezier(0.600, -0.280, 0.735, 0.045)",function(e,t,i,a,r){return void 0===r&&(r=1.70158),i*(e/=a)*e*((r+1)*e-r)+t}],"ease-out-back":["cubic-bezier(0.175, 0.885, 0.320, 1.275)",function(e,t,i,a,r){return void 0===r&&(r=1.70158),i*((e=e/a-1)*e*((r+1)*e+r)+1)+t}],"ease-in-out-back":["cubic-bezier(0.680, -0.550, 0.265, 1.550)",function(e,t,i,a,r){return void 0===r&&(r=1.70158),(e/=a/2)<1?i/2*e*e*((1+(r*=1.525))*e-r)+t:i/2*((e-=2)*e*((1+(r*=1.525))*e+r)+2)+t}]},u={"ease-in-back":"cubic-bezier(0.600, 0, 0.735, 0.045)","ease-out-back":"cubic-bezier(0.175, 0.885, 0.320, 1)","ease-in-out-back":"cubic-bezier(0.680, 0, 0.265, 1)"},p=document,h=window,m="bkwld-tram",f=/[\-\.0-9]/g,g=/[A-Z]/,v="number",A=/^(rgb|#)/,C=/(em|cm|mm|in|pt|pc|px)$/,y=/(em|cm|mm|in|pt|pc|px|%)$/,b=/(deg|rad|turn)$/,S="unitless",k=/(all|none) 0s ease 0s/,D=/^(width|height)$/,_=" ",I=p.createElement("a"),w=["Webkit","Moz","O","ms"],P=["-webkit-","-moz-","-o-","-ms-"],T=function(e){if(e in I.style)return{dom:e,css:e};var t,i,a="",r=e.split("-");for(t=0;t<r.length;t++)a+=r[t].charAt(0).toUpperCase()+r[t].slice(1);for(t=0;t<w.length;t++)if((i=w[t]+a)in I.style)return{dom:i,css:P[t]+e}},B=t.support={bind:Function.prototype.bind,transform:T("transform"),transition:T("transition"),backface:T("backface-visibility"),timing:T("transition-timing-function")};if(B.transition){var x=B.timing.dom;if(I.style[x]=c["ease-in-back"][0],!I.style[x])for(var F in u)c[F][0]=u[F]}var O=t.frame=function(){var e=h.requestAnimationFrame||h.webkitRequestAnimationFrame||h.mozRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame;return e&&B.bind?e.bind(h):function(e){h.setTimeout(e,16)}}(),M=t.now=function(){var e=h.performance,t=e&&(e.now||e.webkitNow||e.msNow||e.mozNow);return t&&B.bind?t.bind(e):Date.now||function(){return+new Date}}(),E=d(function(t){function a(e,t){var i=function(e){for(var t=-1,i=e?e.length:0,a=[];++t<i;){var r=e[t];r&&a.push(r)}return a}((""+e).split(_)),a=i[0];t=t||{};var r=z[a];if(!r)return l("Unsupported property: "+a);if(!t.weak||!this.props[a]){var o=r[0],n=this.props[a];return n||(n=this.props[a]=new o.Bare),n.init(this.$el,i,r,t),n}}function r(e,t,i){if(e){var r=typeof e;if(t||(this.timer&&this.timer.destroy(),this.queue=[],this.active=!1),"number"==r&&t)return this.timer=new W({duration:e,context:this,complete:o}),void(this.active=!0);if("string"==r&&t){switch(e){case"hide":d.call(this);break;case"stop":n.call(this);break;case"redraw":c.call(this);break;default:a.call(this,e,i&&i[1])}return o.call(this)}if("function"==r)return void e.call(this,this);if("object"==r){var l=0;p.call(this,e,function(e,t){e.span>l&&(l=e.span),e.stop(),e.animate(t)},function(e){"wait"in e&&(l=s(e.wait,0))}),u.call(this),l>0&&(this.timer=new W({duration:l,context:this}),this.active=!0,t&&(this.timer.complete=o));var h=this,m=!1,f={};O(function(){p.call(h,e,function(e){e.active&&(m=!0,f[e.name]=e.nextStyle)}),m&&h.$el.css(f)})}}}function o(){if(this.timer&&this.timer.destroy(),this.active=!1,this.queue.length){var e=this.queue.shift();r.call(this,e.options,!0,e.args)}}function n(e){var t;this.timer&&this.timer.destroy(),this.queue=[],this.active=!1,"string"==typeof e?(t={})[e]=1:t="object"==typeof e&&null!=e?e:this.props,p.call(this,t,h),u.call(this)}function d(){n.call(this),this.el.style.display="none"}function c(){this.el.offsetHeight}function u(){var e,t,i=[];for(e in this.upstream&&i.push(this.upstream),this.props)(t=this.props[e]).active&&i.push(t.string);i=i.join(","),this.style!==i&&(this.style=i,this.el.style[B.transition.dom]=i)}function p(e,t,r){var o,n,s,l,d=t!==h,c={};for(o in e)s=e[o],o in X?(c.transform||(c.transform={}),c.transform[o]=s):(g.test(o)&&(o=i(o)),o in z?c[o]=s:(l||(l={}),l[o]=s));for(o in c){if(s=c[o],!(n=this.props[o])){if(!d)continue;n=a.call(this,o)}t.call(this,n,s)}r&&l&&r.call(this,l)}function h(e){e.stop()}function f(e,t){e.set(t)}function v(e){this.$el.css(e)}function A(e,i){t[e]=function(){return this.children?C.call(this,i,arguments):(this.el&&i.apply(this,arguments),this)}}function C(e,t){var i,a=this.children.length;for(i=0;a>i;i++)e.apply(this.children[i],t);return this}t.init=function(t){if(this.$el=e(t),this.el=this.$el[0],this.props={},this.queue=[],this.style="",this.active=!1,j.keepInherited&&!j.fallback){var i=Y(this.el,"transition");i&&!k.test(i)&&(this.upstream=i)}B.backface&&j.hideBackface&&H(this.el,B.backface.css,"hidden")},A("add",a),A("start",r),A("wait",function(e){e=s(e,0),this.active?this.queue.push({options:e}):(this.timer=new W({duration:e,context:this,complete:o}),this.active=!0)}),A("then",function(e){return this.active?(this.queue.push({options:e,args:arguments}),void(this.timer.complete=o)):l("No active transition timer. Use start() or wait() before then().")}),A("next",o),A("stop",n),A("set",function(e){n.call(this,e),p.call(this,e,f,v)}),A("show",function(e){"string"!=typeof e&&(e="block"),this.el.style.display=e}),A("hide",d),A("redraw",c),A("destroy",function(){n.call(this),e.removeData(this.el,m),this.$el=this.el=null})}),$=d(E,function(t){function i(t,i){var a=e.data(t,m)||e.data(t,m,new E.Bare);return a.el||a.init(t),i?a.start(i):a}t.init=function(t,a){var r=e(t);if(!r.length)return this;if(1===r.length)return i(r[0],a);var o=[];return r.each(function(e,t){o.push(i(t,a))}),this.children=o,this}}),N=d(function(e){function t(){var e=this.get();this.update("auto");var t=this.get();return this.update(e),t}function i(e){var t=/rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(e);return(t?r(t[1],t[2],t[3]):e).replace(/#(\w)(\w)(\w)$/,"#$1$1$2$2$3$3")}var a=500,o="ease",n=0;e.init=function(e,t,i,r){this.$el=e,this.el=e[0];var l=t[0];i[2]&&(l=i[2]),Z[l]&&(l=Z[l]),this.name=l,this.type=i[1],this.duration=s(t[1],this.duration,a),this.ease=function(e,t,i){return void 0!==t&&(i=t),e in c?e:i}(t[2],this.ease,o),this.delay=s(t[3],this.delay,n),this.span=this.duration+this.delay,this.active=!1,this.nextStyle=null,this.auto=D.test(this.name),this.unit=r.unit||this.unit||j.defaultUnit,this.angle=r.angle||this.angle||j.defaultAngle,j.fallback||r.fallback?this.animate=this.fallback:(this.animate=this.transition,this.string=this.name+_+this.duration+"ms"+("ease"!=this.ease?_+c[this.ease][0]:"")+(this.delay?_+this.delay+"ms":""))},e.set=function(e){e=this.convert(e,this.type),this.update(e),this.redraw()},e.transition=function(e){this.active=!0,e=this.convert(e,this.type),this.auto&&("auto"==this.el.style[this.name]&&(this.update(this.get()),this.redraw()),"auto"==e&&(e=t.call(this))),this.nextStyle=e},e.fallback=function(e){var i=this.el.style[this.name]||this.convert(this.get(),this.type);e=this.convert(e,this.type),this.auto&&("auto"==i&&(i=this.convert(this.get(),this.type)),"auto"==e&&(e=t.call(this))),this.tween=new G({from:i,to:e,duration:this.duration,delay:this.delay,ease:this.ease,update:this.update,context:this})},e.get=function(){return Y(this.el,this.name)},e.update=function(e){H(this.el,this.name,e)},e.stop=function(){(this.active||this.nextStyle)&&(this.active=!1,this.nextStyle=null,H(this.el,this.name,this.get()));var e=this.tween;e&&e.context&&e.destroy()},e.convert=function(e,t){if("auto"==e&&this.auto)return e;var a,r="number"==typeof e,o="string"==typeof e;switch(t){case v:if(r)return e;if(o&&""===e.replace(f,""))return+e;a="number(unitless)";break;case A:if(o){if(""===e&&this.original)return this.original;if(t.test(e))return"#"==e.charAt(0)&&7==e.length?e:i(e)}a="hex or rgb string";break;case C:if(r)return e+this.unit;if(o&&t.test(e))return e;a="number(px) or string(unit)";break;case y:if(r)return e+this.unit;if(o&&t.test(e))return e;a="number(px) or string(unit or %)";break;case b:if(r)return e+this.angle;if(o&&t.test(e))return e;a="number(deg) or string(angle)";break;case S:if(r)return e;if(o&&y.test(e))return e;a="number(unitless) or string(unit or %)"}return function(e,t){l("Type warning: Expected: ["+e+"] Got: ["+typeof t+"] "+t)}(a,e),e},e.redraw=function(){this.el.offsetHeight}}),L=d(N,function(e,t){e.init=function(){t.init.apply(this,arguments),this.original||(this.original=this.convert(this.get(),A))}}),U=d(N,function(e,t){e.init=function(){t.init.apply(this,arguments),this.animate=this.fallback},e.get=function(){return this.$el[this.name]()},e.update=function(e){this.$el[this.name](e)}}),R=d(N,function(e,t){function i(e,t){var i,a,r,o,n;for(i in e)r=(o=X[i])[0],a=o[1]||i,n=this.convert(e[i],r),t.call(this,a,n,r)}e.init=function(){t.init.apply(this,arguments),this.current||(this.current={},X.perspective&&j.perspective&&(this.current.perspective=j.perspective,H(this.el,this.name,this.style(this.current)),this.redraw()))},e.set=function(e){i.call(this,e,function(e,t){this.current[e]=t}),H(this.el,this.name,this.style(this.current)),this.redraw()},e.transition=function(e){var t=this.values(e);this.tween=new V({current:this.current,values:t,duration:this.duration,delay:this.delay,ease:this.ease});var i,a={};for(i in this.current)a[i]=i in t?t[i]:this.current[i];this.active=!0,this.nextStyle=this.style(a)},e.fallback=function(e){var t=this.values(e);this.tween=new V({current:this.current,values:t,duration:this.duration,delay:this.delay,ease:this.ease,update:this.update,context:this})},e.update=function(){H(this.el,this.name,this.style(this.current))},e.style=function(e){var t,i="";for(t in e)i+=t+"("+e[t]+") ";return i},e.values=function(e){var t,a={};return i.call(this,e,function(e,i,r){a[e]=i,void 0===this.current[e]&&(t=0,~e.indexOf("scale")&&(t=1),this.current[e]=this.convert(t,r))}),a}}),G=d(function(t){function i(){var e,t,a,r=l.length;if(r)for(O(i),t=M(),e=r;e--;)(a=l[e])&&a.render(t)}var s={ease:c.ease[1],from:0,to:1};t.init=function(e){this.duration=e.duration||0,this.delay=e.delay||0;var t=e.ease||s.ease;c[t]&&(t=c[t][1]),"function"!=typeof t&&(t=s.ease),this.ease=t,this.update=e.update||o,this.complete=e.complete||o,this.context=e.context||this,this.name=e.name;var i=e.from,a=e.to;void 0===i&&(i=s.from),void 0===a&&(a=s.to),this.unit=e.unit||"","number"==typeof i&&"number"==typeof a?(this.begin=i,this.change=a-i):this.format(a,i),this.value=this.begin+this.unit,this.start=M(),!1!==e.autoplay&&this.play()},t.play=function(){this.active||(this.start||(this.start=M()),this.active=!0,function(e){1===l.push(e)&&O(i)}(this))},t.stop=function(){this.active&&(this.active=!1,function(t){var i,a=e.inArray(t,l);a>=0&&(i=l.slice(a+1),l.length=a,i.length&&(l=l.concat(i)))}(this))},t.render=function(e){var t,i=e-this.start;if(this.delay){if(i<=this.delay)return;i-=this.delay}if(i<this.duration){var a=this.ease(i,0,1,this.duration);return t=this.startRGB?function(e,t,i){return r(e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1]),e[2]+i*(t[2]-e[2]))}(this.startRGB,this.endRGB,a):function(e){return Math.round(e*d)/d}(this.begin+a*this.change),this.value=t+this.unit,void this.update.call(this.context,this.value)}t=this.endHex||this.begin+this.change,this.value=t+this.unit,this.update.call(this.context,this.value),this.complete.call(this.context),this.destroy()},t.format=function(e,t){if(t+="","#"==(e+="").charAt(0))return this.startRGB=a(t),this.endRGB=a(e),this.endHex=e,this.begin=0,void(this.change=1);if(!this.unit){var i=t.replace(f,"");i!==e.replace(f,"")&&n("tween",t,e),this.unit=i}t=parseFloat(t),e=parseFloat(e),this.begin=this.value=t,this.change=e-t},t.destroy=function(){this.stop(),this.context=null,this.ease=this.update=this.complete=o};var l=[],d=1e3}),W=d(G,function(e){e.init=function(e){this.duration=e.duration||0,this.complete=e.complete||o,this.context=e.context,this.play()},e.render=function(e){e-this.start<this.duration||(this.complete.call(this.context),this.destroy())}}),V=d(G,function(e,t){e.init=function(e){var t,i;for(t in this.context=e.context,this.update=e.update,this.tweens=[],this.current=e.current,e.values)i=e.values[t],this.current[t]!==i&&this.tweens.push(new G({name:t,from:this.current[t],to:i,duration:e.duration,delay:e.delay,ease:e.ease,autoplay:!1}));this.play()},e.render=function(e){var t,i,a=!1;for(t=this.tweens.length;t--;)(i=this.tweens[t]).context&&(i.render(e),this.current[i.name]=i.value,a=!0);return a?void(this.update&&this.update.call(this.context)):this.destroy()},e.destroy=function(){if(t.destroy.call(this),this.tweens){var e;for(e=this.tweens.length;e--;)this.tweens[e].destroy();this.tweens=null,this.current=null}}}),j=t.config={debug:!1,defaultUnit:"px",defaultAngle:"deg",keepInherited:!1,hideBackface:!1,perspective:"",fallback:!B.transition,agentTests:[]};t.fallback=function(e){if(!B.transition)return j.fallback=!0;j.agentTests.push("("+e+")");var t=new RegExp(j.agentTests.join("|"),"i");j.fallback=t.test(navigator.userAgent)},t.fallback("6.0.[2-5] Safari"),t.tween=function(e){return new G(e)},t.delay=function(e,t,i){return new W({complete:t,duration:e,context:i})},e.fn.tram=function(e){return t.call(null,this,e)};var H=e.style,Y=e.css,Z={transform:B.transform&&B.transform.css},z={color:[L,A],background:[L,A,"background-color"],"outline-color":[L,A],"border-color":[L,A],"border-top-color":[L,A],"border-right-color":[L,A],"border-bottom-color":[L,A],"border-left-color":[L,A],"border-width":[N,C],"border-top-width":[N,C],"border-right-width":[N,C],"border-bottom-width":[N,C],"border-left-width":[N,C],"border-spacing":[N,C],"letter-spacing":[N,C],margin:[N,C],"margin-top":[N,C],"margin-right":[N,C],"margin-bottom":[N,C],"margin-left":[N,C],padding:[N,C],"padding-top":[N,C],"padding-right":[N,C],"padding-bottom":[N,C],"padding-left":[N,C],"outline-width":[N,C],opacity:[N,v],top:[N,y],right:[N,y],bottom:[N,y],left:[N,y],"font-size":[N,y],"text-indent":[N,y],"word-spacing":[N,y],width:[N,y],"min-width":[N,y],"max-width":[N,y],height:[N,y],"min-height":[N,y],"max-height":[N,y],"line-height":[N,S],"scroll-top":[U,v,"scrollTop"],"scroll-left":[U,v,"scrollLeft"]},X={};B.transform&&(z.transform=[R],X={x:[y,"translateX"],y:[y,"translateY"],rotate:[b],rotateX:[b],rotateY:[b],scale:[v],scaleX:[v],scaleY:[v],skew:[b],skewX:[b],skewY:[b]}),B.transform&&B.backface&&(X.z=[y,"translateZ"],X.rotateZ=[b],X.scaleZ=[v],X.perspective=[C]);var q=/ms/,J=/s|\./;return e.tram=t}(window.jQuery);var t={},i=e(function(e){var i=window.$,a=t&&i.tram;
/*!
         * Webflow._ (aka) Underscore.js 1.6.0 (custom build)
         * _.each
         * _.map
         * _.find
         * _.filter
         * _.any
         * _.contains
         * _.delay
         * _.defer
         * _.throttle (webflow)
         * _.debounce
         * _.keys
         * _.has
         * _.now
         *
         * http://underscorejs.org
         * (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
         * Underscore may be freely distributed under the MIT license.
         * @license MIT
         */
e.exports=function(){var e={VERSION:"1.6.0-Webflow"},t={},i=Array.prototype,r=Object.prototype,o=Function.prototype,n=(i.push,i.slice),s=(i.concat,r.toString,r.hasOwnProperty),l=i.forEach,d=i.map,c=(i.reduce,i.reduceRight,i.filter),u=(i.every,i.some),p=i.indexOf,h=(i.lastIndexOf,Array.isArray,Object.keys),m=(o.bind,e.each=e.forEach=function(i,a,r){if(null==i)return i;if(l&&i.forEach===l)i.forEach(a,r);else if(i.length===+i.length){for(var o=0,n=i.length;o<n;o++)if(a.call(r,i[o],o,i)===t)return}else{var s=e.keys(i);for(o=0,n=s.length;o<n;o++)if(a.call(r,i[s[o]],s[o],i)===t)return}return i});e.map=e.collect=function(e,t,i){var a=[];return null==e?a:d&&e.map===d?e.map(t,i):(m(e,function(e,r,o){a.push(t.call(i,e,r,o))}),a)},e.find=e.detect=function(e,t,i){var a;return f(e,function(e,r,o){if(t.call(i,e,r,o))return a=e,!0}),a},e.filter=e.select=function(e,t,i){var a=[];return null==e?a:c&&e.filter===c?e.filter(t,i):(m(e,function(e,r,o){t.call(i,e,r,o)&&a.push(e)}),a)};var f=e.some=e.any=function(i,a,r){a||(a=e.identity);var o=!1;return null==i?o:u&&i.some===u?i.some(a,r):(m(i,function(e,i,n){if(o||(o=a.call(r,e,i,n)))return t}),!!o)};e.contains=e.include=function(e,t){return null!=e&&(p&&e.indexOf===p?-1!=e.indexOf(t):f(e,function(e){return e===t}))},e.delay=function(e,t){var i=n.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},e.defer=function(t){return e.delay.apply(e,[t,1].concat(n.call(arguments,1)))},e.throttle=function(e){var t,i,r;return function(){t||(t=!0,i=arguments,r=this,a.frame(function(){t=!1,e.apply(r,i)}))}},e.debounce=function(t,i,a){var r,o,n,s,l,d=function(){var c=e.now()-s;c<i?r=setTimeout(d,i-c):(r=null,a||(l=t.apply(n,o),n=o=null))};return function(){n=this,o=arguments,s=e.now();var c=a&&!r;return r||(r=setTimeout(d,i)),c&&(l=t.apply(n,o),n=o=null),l}},e.defaults=function(t){if(!e.isObject(t))return t;for(var i=1,a=arguments.length;i<a;i++){var r=arguments[i];for(var o in r)void 0===t[o]&&(t[o]=r[o])}return t},e.keys=function(t){if(!e.isObject(t))return[];if(h)return h(t);var i=[];for(var a in t)e.has(t,a)&&i.push(a);return i},e.has=function(e,t){return s.call(e,t)},e.isObject=function(e){return e===Object(e)},e.now=Date.now||function(){return(new Date).getTime()},e.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var g=/(.)^/,v={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},A=/\\|'|\r|\n|\u2028|\u2029/g,C=function(e){return"\\"+v[e]};return e.template=function(t,i,a){!i&&a&&(i=a),i=e.defaults({},i,e.templateSettings);var r=RegExp([(i.escape||g).source,(i.interpolate||g).source,(i.evaluate||g).source].join("|")+"|$","g"),o=0,n="__p+='";t.replace(r,function(e,i,a,r,s){return n+=t.slice(o,s).replace(A,C),o=s+e.length,i?n+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":a?n+="'+\n((__t=("+a+"))==null?'':__t)+\n'":r&&(n+="';\n"+r+"\n__p+='"),e}),n+="';\n",i.variable||(n="with(obj||{}){\n"+n+"}\n"),n="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+n+"return __p;\n";try{var s=new Function(i.variable||"obj","_",n)}catch(e){throw e.source=n,e}var l=function(t){return s.call(this,t,e)},d=i.variable||"obj";return l.source="function("+d+"){\n"+n+"}",l},e}()}),a=i&&"object"==typeof i&&"default"in i?i.default:i,r=e(function(e){var i={},r={},o=[],n=window.Webflow||[],s=window.jQuery,l=s(window),d=s(document),c=s.isFunction,u=i._=a,p=t&&s.tram,h=!1,m=!1,f=window.Modernizr;function g(e){i.env()&&(c(e.design)&&l.on("__wf_design",e.design),c(e.preview)&&l.on("__wf_preview",e.preview)),c(e.destroy)&&l.on("__wf_destroy",e.destroy),e.ready&&c(e.ready)&&function(e){if(h)return void e.ready();if(u.contains(o,e.ready))return;o.push(e.ready)}(e)}function v(e){c(e.design)&&l.off("__wf_design",e.design),c(e.preview)&&l.off("__wf_preview",e.preview),c(e.destroy)&&l.off("__wf_destroy",e.destroy),e.ready&&c(e.ready)&&function(e){o=u.filter(o,function(t){return t!==e.ready})}(e)}p.config.hideBackface=!1,p.config.keepInherited=!0,i.define=function(e,t,i){r[e]&&v(r[e]);var a=r[e]=t(s,u,i)||{};return g(a),a},i.require=function(e){return r[e]},i.push=function(e){h?c(e)&&e():n.push(e)},i.env=function(e){var t=window.__wf_design,i=void 0!==t;return e?"design"===e?i&&t:"preview"===e?i&&!t:"slug"===e?i&&window.__wf_slug:"editor"===e?window.WebflowEditor:"test"===e?window.__wf_test:"frame"===e?window!==window.top:void 0:i};var A,C=navigator.userAgent.toLowerCase(),y=navigator.appVersion.toLowerCase(),b=i.env.touch="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,S=i.env.chrome=/chrome/.test(C)&&/Google/.test(navigator.vendor)&&parseInt(y.match(/chrome\/(\d+)\./)[1],10),k=i.env.ios=f&&f.ios;i.env.safari=/safari/.test(C)&&!S&&!k,b&&d.on("touchstart mousedown",function(e){A=e.target}),i.validClick=b?function(e){return e===A||s.contains(e,A)}:function(){return!0};var D,_="resize.webflow orientationchange.webflow load.webflow",I="scroll.webflow "+_;function w(e,t){var i=[],a={};return a.up=u.throttle(function(e){u.each(i,function(t){t(e)})}),e&&t&&e.on(t,a.up),a.on=function(e){"function"==typeof e&&(u.contains(i,e)||i.push(e))},a.off=function(e){i=arguments.length?u.filter(i,function(t){return t!==e}):[]},a}function P(e){c(e)&&e()}function T(){D&&(D.reject(),l.off("load",D.resolve)),D=new s.Deferred,l.on("load",D.resolve)}i.resize=w(l,_),i.scroll=w(s("#page-wrapper"),I),i.redraw=w(),i.location=function(e){window.location=e},i.env()&&(i.location=function(e){window.dispatchEvent(new CustomEvent("__wf_location",{detail:e}))}),i.ready=function(){h=!0,m?(m=!1,u.each(r,g)):u.each(o,P),u.each(n,P),i.resize.up()},i.load=function(e){D.then(e)},i.destroy=function(e){e=e||{},m=!0,l.triggerHandler("__wf_destroy"),null!=e.domready&&(h=e.domready),u.each(r,v),i.resize.off(),i.scroll.off(),i.redraw.off(),o=[],n=[],"pending"===D.state()&&T()},s(i.ready),T(),e.exports=window.Webflow=i}),o=r&&"object"==typeof r&&"default"in r?r.default:r,n=(e(function(e){var t=o;t.define("brand",e.exports=function(e){var i,a={},r=e("html"),o=e("body"),n=window.location,s=/PhantomJS/i.test(navigator.userAgent);function l(){var e=o.children(".w-webflow-badge"),a=e.length&&e.get(0)===i,r=t.env("editor");a?r&&e.remove():(e.length&&e.remove(),r||o.append(i))}return a.ready=function(){var t,a,o,d=r.attr("data-wf-status"),c=r.attr("data-wf-domain")||"";/\.webflow\.io$/i.test(c)&&n.hostname!==c&&(d=!0),d&&!s&&(i=i||(t=e('<a class="w-webflow-badge"></a>').attr("href","https://webflow.com?utm_campaign=brandjs"),a=e("<img>").attr("src","https://d1otoma47x30pg.cloudfront.net/img/webflow-badge-icon.60efbf6ec9.svg").css({marginRight:"8px",width:"16px"}),o=e("<img>").attr("src","https://d1otoma47x30pg.cloudfront.net/img/webflow-badge-text.6faa6a38cd.svg"),t.append(a,o),t[0]),l(),setTimeout(l,500))},a})}),e(function(e){var t=window.jQuery,i={},a=[],r=".w-ix",o={reset:function(e,t){t.__wf_intro=null},intro:function(e,a){a.__wf_intro||(a.__wf_intro=!0,t(a).triggerHandler(i.types.INTRO))},outro:function(e,a){a.__wf_intro&&(a.__wf_intro=null,t(a).triggerHandler(i.types.OUTRO))}};i.triggers={},i.types={INTRO:"w-ix-intro"+r,OUTRO:"w-ix-outro"+r},i.init=function(){for(var e=a.length,r=0;r<e;r++){var n=a[r];n[0](0,n[1])}a=[],t.extend(i.triggers,o)},i.async=function(){for(var e in o){var t=o[e];o.hasOwnProperty(e)&&(i.triggers[e]=function(e,i){a.push([t,i])})}},i.async(),e.exports=i})),s=n&&"object"==typeof n&&"default"in n?n.default:n;e(function(e){var t=o,i=s;t.define("dropdown",e.exports=function(e,a){var r,o,n={},s=e(document),l=t.env(),d=t.env.touch,c=".w-dropdown",u="w--open",p="w-close"+c,h=i.triggers,m=!1;function f(){o=l&&t.env("design"),(r=s.find(c)).each(g)}function g(t,i){var r=e(i),n=e.data(i,c);n||(n=e.data(i,c,{open:!1,el:r,config:{}})),n.list=r.children(".w-dropdown-list"),n.toggle=r.children(".w-dropdown-toggle"),n.links=n.list.children(".w-dropdown-link"),n.outside=function(t){t.outside&&s.off("tap"+c,t.outside);return a.debounce(function(i){if(t.open){var a=e(i.target);a.closest(".w-dropdown-toggle").length||t.el.is(a.closest(c))||y(t)}})}(n),n.complete=function(e){return function(){e.list.removeClass(u),e.toggle.removeClass(u),e.manageZ&&e.el.css("z-index","")}}(n),n.leave=function(e){return function(){e.hovering=!1,y(e)}}(n),r.off(c),n.toggle.off(c),v(n),n.nav&&n.nav.off(c),n.nav=r.closest(".w-nav"),n.nav.on(p,A(n)),o?r.on("setting"+c,A(n)):(n.toggle.on("tap"+c,function(e){return a.debounce(function(){e.open?y(e):C(e)})}(n)),n.config.hover&&n.toggle.on("mouseenter"+c,function(e){return function(){e.hovering=!0,C(e)}}(n)),r.on(p,A(n)),l&&y(n))}function v(e){var t=Number(e.el.css("z-index"));e.manageZ=900===t||901===t,e.config={hover:Boolean(e.el.attr("data-hover"))&&!d,delay:Number(e.el.attr("data-delay"))||0}}function A(e){return function(t,i){return i=i||{},"w-close"===t.type?y(e):"setting"===t.type?(v(e),!0===i.open&&C(e),void(!1===i.open&&y(e,!0))):void 0}}function C(i){i.open||(!function(t){var i=t.el[0];r.each(function(t,a){var r=e(a);r.is(i)||r.has(i).length||r.triggerHandler(p)})}(i),i.open=!0,i.list.addClass(u),i.toggle.addClass(u),h.intro(0,i.el[0]),t.redraw.up(),i.manageZ&&i.el.css("z-index",901),o||s.on("tap"+c,i.outside),i.hovering&&i.el.on("mouseleave"+c,i.leave),window.clearTimeout(i.delayId))}function y(e,t){if(e.open&&(!e.config.hover||!e.hovering)){e.open=!1;var i=e.config;if(h.outro(0,e.el[0]),s.off("tap"+c,e.outside),e.el.off("mouseleave"+c,e.leave),window.clearTimeout(e.delayId),!i.delay||t)return e.complete();e.delayId=window.setTimeout(e.complete,i.delay)}}return n.ready=f,n.design=function(){m&&s.find(c).each(function(t,i){e(i).triggerHandler(p)}),m=!1,f()},n.preview=function(){m=!0,f()},n})}),e(function(e){var t=o;t.define("edit",e.exports=function(e,i,a){if(a=a||{},(t.env("test")||t.env("frame"))&&!a.fixture)return{exit:1};var r,o=e(window),n=e(document.documentElement),s=document.location,l="hashchange",d=a.load||function(){r=!0,window.WebflowEditor=!0,o.off(l,u),e.ajax({url:m("https://editor-api.webflow.com/api/editor/view"),data:{siteId:n.attr("data-wf-site")},xhrFields:{withCredentials:!0},dataType:"json",crossDomain:!0,success:p})},c=!1;try{c=localStorage&&localStorage.getItem&&localStorage.getItem("WebflowEditor")}catch(e){}function u(){r||/\?edit/.test(s.hash)&&d()}function p(t){var i;t?function(t,i){e.ajax({type:"GET",url:t,dataType:"script",cache:!0}).then(i,h)}((i=t.scriptPath,i.indexOf("//")>=0?i:m("https://editor-api.webflow.com"+i)),function(){window.WebflowEditor(t)}):console.error("Could not load editor data")}function h(e,t,i){throw console.error("Could not load editor script: "+t),i}function m(e){return e.replace(/([^:])\/\//g,"$1/")}return c?d():s.search?(/[?&](edit)(?:[=&?]|$)/.test(s.search)||/\?edit$/.test(s.href))&&d():o.on(l,u).triggerHandler(l),{}})}),e(function(e){
/*!
         * jQuery-ajaxTransport-XDomainRequest - v1.0.3
         * 2014-12-16 WEBFLOW - Removed UMD wrapper
         * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
         * Copyright (c) 2014 Jason Moon (@JSONMOON)
         * @license MIT (/blob/master/LICENSE.txt)
         */
e.exports=function(e){if(!e.support.cors&&e.ajaxTransport&&window.XDomainRequest){var t=/^https?:\/\//i,i=/^get|post$/i,a=new RegExp("^"+location.protocol,"i");e.ajaxTransport("* text html xml json",function(r,o,n){if(r.crossDomain&&r.async&&i.test(r.type)&&t.test(r.url)&&a.test(r.url)){var s=null;return{send:function(t,i){var a="",n=(o.dataType||"").toLowerCase();s=new XDomainRequest,/^\d+$/.test(o.timeout)&&(s.timeout=o.timeout),s.ontimeout=function(){i(500,"timeout")},s.onload=function(){var t="Content-Length: "+s.responseText.length+"\r\nContent-Type: "+s.contentType,a={code:200,message:"success"},r={text:s.responseText};try{if("html"===n||/text\/html/i.test(s.contentType))r.html=s.responseText;else if("json"===n||"text"!==n&&/\/json/i.test(s.contentType))try{r.json=e.parseJSON(s.responseText)}catch(e){a.code=500,a.message="parseerror"}else if("xml"===n||"text"!==n&&/\/xml/i.test(s.contentType)){var o=new ActiveXObject("Microsoft.XMLDOM");o.async=!1;try{o.loadXML(s.responseText)}catch(e){o=void 0}if(!o||!o.documentElement||o.getElementsByTagName("parsererror").length)throw a.code=500,a.message="parseerror","Invalid XML: "+s.responseText;r.xml=o}}catch(e){throw e}finally{i(a.code,a.message,r,t)}},s.onprogress=function(){},s.onerror=function(){i(500,"error",{text:s.responseText})},o.data&&(a="string"===e.type(o.data)?o.data:e.param(o.data)),s.open(r.type,r.url),s.send(a)},abort:function(){s&&s.abort()}}}})}}(window.jQuery)}),e(function(e){var t=o;t.define("forms",e.exports=function(e,i){var a,r,o,n={},s=e(document),l=window.location,d=window.XDomainRequest&&!window.atob,c=".w-form",u=/e(-)?mail/i,p=/^\S+@\S+$/,h=window.alert,m=t.env(),f=/list-manage[1-9]?.com/i,g=i.debounce(function(){h("Oops! This page has improperly configured forms. Please contact your website administrator to fix this issue.")},100);function v(t,i){var a=e(i),o=e.data(i,c);o||(o=e.data(i,c,{form:a})),A(o);var n=a.closest("div.w-form");o.done=n.find("> .w-form-done"),o.fail=n.find("> .w-form-fail");var s=o.action=a.attr("action");o.handler=null,o.redirect=a.attr("data-redirect"),f.test(s)?o.handler=S:s||(r?o.handler=b:g())}function A(e){var t=e.btn=e.form.find(':input[type="submit"]');e.wait=e.btn.attr("data-wait")||null,e.success=!1,t.prop("disabled",!1),e.label&&t.val(e.label)}function C(e){var t=e.btn,i=e.wait;t.prop("disabled",!0),i&&(e.label=t.val(),t.val(i))}function y(t,i){var a=null;return i=i||{},t.find(':input:not([type="submit"])').each(function(r,o){var n=e(o),s=n.attr("type"),l=n.attr("data-name")||n.attr("name")||"Field "+(r+1),d=n.val();if("checkbox"===s&&(d=n.is(":checked")),"radio"===s){if(null===i[l]||"string"==typeof i[l])return;d=t.find('input[name="'+n.attr("name")+'"]:checked').val()||null}"string"==typeof d&&(d=e.trim(d)),i[l]=d,a=a||function(e,t,i,a){var r=null;"password"===t?r="Passwords cannot be submitted.":e.attr("required")&&(a?(u.test(i)||u.test(e.attr("type")))&&(p.test(a)||(r="Please enter a valid email address for: "+i)):r="Please fill out the required field: "+i);return r}(n,s,l,d)}),a}function b(i){A(i);var a=i.form,o={name:a.attr("data-name")||a.attr("name")||"Untitled Form",source:l.href,test:t.env(),fields:{},dolphin:/pass[\s-_]?(word|code)|secret|login|credentials/i.test(a.html())};D(i);var n=y(a,o.fields);if(n)return h(n);if(C(i),r){var s="https://webflow.com/api/v1/form/"+r;d&&s.indexOf("https://webflow.com")>=0&&(s=s.replace("https://webflow.com","http://formdata.webflow.com")),e.ajax({url:s,type:"POST",data:o,dataType:"json",crossDomain:!0}).done(function(){i.success=!0,k(i)}).fail(function(){k(i)})}else k(i)}function S(t){A(t);var a=t.form,r={};if(!/^https/.test(l.href)||/^https/.test(t.action)){D(t);var o,n=y(a,r);if(n)return h(n);C(t),i.each(r,function(e,t){u.test(t)&&(r.EMAIL=e),/^((full[ _-]?)?name)$/i.test(t)&&(o=e),/^(first[ _-]?name)$/i.test(t)&&(r.FNAME=e),/^(last[ _-]?name)$/i.test(t)&&(r.LNAME=e)}),o&&!r.FNAME&&(o=o.split(" "),r.FNAME=o[0],r.LNAME=r.LNAME||o[1]);var s=t.action.replace("/post?","/post-json?")+"&c=?",d=s.indexOf("u=")+2;d=s.substring(d,s.indexOf("&",d));var c=s.indexOf("id=")+3;c=s.substring(c,s.indexOf("&",c)),r["b_"+d+"_"+c]="",e.ajax({url:s,data:r,dataType:"jsonp"}).done(function(e){t.success="success"===e.result||/already/.test(e.msg),t.success||console.info("MailChimp error: "+e.msg),k(t)}).fail(function(){k(t)})}else a.attr("method","post")}function k(e){var i=e.form,a=e.redirect,r=e.success;r&&a?t.location(a):(e.done.toggle(r),e.fail.toggle(!r),i.toggle(!r),A(e))}function D(e){e.evt&&e.evt.preventDefault(),e.evt=null}return n.ready=n.design=n.preview=function(){!function(){if(r=e("html").attr("data-wf-site"),!(a=e(c+" form")).length)return;a.each(v)}(),m||o||(o=!0,s.on("submit",c+" form",function(t){var i=e.data(this,c);i.handler&&(i.evt=t,i.handler(i))}))},n})}),e(function(e){var t=o,i=s;t.define("ix",e.exports=function(e,a){var r,o,n={},s=e(window),l=".w-ix",d=e.tram,c=t.env,u=c(),p=c.chrome&&c.chrome<35,h="none 0s ease 0s",m=e(),f={},g=[],v=[],A=[],C=1,y={tabs:".w-tab-link, .w-tab-pane",dropdown:".w-dropdown",slider:".w-slide",navbar:".w-nav"};function b(e){e&&(f={},a.each(e,function(e){f[e.slug]=e.value}),S())}function S(){var a=e("[data-ix]");a.length&&(a.each(_),a.each(k),g.length&&(t.scroll.on(I),setTimeout(I,1)),v.length&&t.load(w),A.length&&setTimeout(P,C),i.init(),t.redraw.up())}function k(r,o){var s=e(o),d=s.attr("data-ix"),c=f[d];if(c){var p=c.triggers;p&&(n.style(s,c.style),a.each(p,function(e){var a={},r=e.type,o=e.stepsB&&e.stepsB.length;function n(){T(e,s,{group:"A"})}function d(){T(e,s,{group:"B"})}if("load"!==r){if("click"===r)return s.on("click"+l,function(i){t.validClick(i.currentTarget)&&("#"===s.attr("href")&&i.preventDefault(),T(e,s,{group:a.clicked?"B":"A"}),o&&(a.clicked=!a.clicked))}),void(m=m.add(s));if("hover"===r)return s.on("mouseenter"+l,n),s.on("mouseleave"+l,d),void(m=m.add(s));if("scroll"!==r){var c=y[r];if(c){var p=s.closest(c);return p.on(i.types.INTRO,n).on(i.types.OUTRO,d),void(m=m.add(p))}}else g.push({el:s,trigger:e,state:{active:!1},offsetTop:D(e.offsetTop),offsetBot:D(e.offsetBot)})}else e.preload&&!u?v.push(n):A.push(n)}))}}function D(e){if(!e)return 0;e=String(e);var t=parseInt(e,10);return t!=t?0:(e.indexOf("%")>0&&(t/=100)>=1&&(t=.999),t)}function _(t,i){e(i).off(l)}function I(){for(var e=s.scrollTop(),t=s.height(),i=g.length,a=0;a<i;a++){var r=g[a],o=r.el,n=r.trigger,l=n.stepsB&&n.stepsB.length,d=r.state,c=o.offset().top,u=o.outerHeight(),p=r.offsetTop,h=r.offsetBot;p<1&&p>0&&(p*=t),h<1&&h>0&&(h*=t);var m=c+u-p>=e&&c+h<=e+t;m!==d.active&&((!1!==m||l)&&(d.active=m,T(n,o,{group:m?"A":"B"})))}}function w(){for(var e=v.length,t=0;t<e;t++)v[t]()}function P(){for(var e=A.length,t=0;t<e;t++)A[t]()}function T(t,i,a,o){var n=(a=a||{}).done,s=t.preserve3d;if(!r||a.force){var l=a.group||"A",c=t["loop"+l],h=t["steps"+l];if(h&&h.length){if(h.length<2&&(c=!1),!o){var m=t.selector;m&&(i=t.descend?i.find(m):t.siblings?i.siblings(m):e(m),u&&i.attr("data-ix-affect",1)),p&&i.addClass("w-ix-emptyfix"),s&&i.css("transform-style","preserve-3d")}for(var f=d(i),g={omit3d:!s},v=0;v<h.length;v++)B(f,h[v],g);g.start?f.then(A):A()}}function A(){if(c)return T(t,i,a,!0);"auto"===g.width&&f.set({width:"auto"}),"auto"===g.height&&f.set({height:"auto"}),n&&n()}}function B(e,i,a){var r="add",o="start";a.start&&(r=o="then");var n=i.transition;if(n){n=n.split(",");for(var s=0;s<n.length;s++){var l=n[s];e[r](l)}}var d=x(i,a)||{};if(null!=d.width&&(a.width=d.width),null!=d.height&&(a.height=d.height),null==n){a.start?e.then(function(){var i=this.queue;this.set(d),d.display&&(e.redraw(),t.redraw.up()),this.queue=i,this.next()}):(e.set(d),d.display&&(e.redraw(),t.redraw.up()));var c=d.wait;null!=c&&(e.wait(c),a.start=!0)}else{if(d.display){var u=d.display;delete d.display,a.start?e.then(function(){var e=this.queue;this.set({display:u}).redraw(),t.redraw.up(),this.queue=e,this.next()}):(e.set({display:u}).redraw(),t.redraw.up())}e[o](d),a.start=!0}}function x(e,t){var i=t&&t.omit3d,a={},r=!1;for(var o in e)"transition"!==o&&"keysort"!==o&&(!i||"z"!==o&&"rotateX"!==o&&"rotateY"!==o&&"scaleZ"!==o)&&(a[o]=e[o],r=!0);return r?a:null}return n.init=function(e){setTimeout(function(){b(e)},1)},n.preview=function(){r=!1,C=100,setTimeout(function(){b(window.__wf_ix)},1)},n.design=function(){r=!0,n.destroy()},n.destroy=function(){o=!0,m.each(_),t.scroll.off(I),i.async(),g=[],v=[],A=[]},n.ready=function(){if(u)return c("design")?n.design():n.preview();f&&o&&(o=!1,S())},n.run=T,n.style=u?function(t,i){var a=d(t);if(e.isEmptyObject(i))return;t.css("transition","");var r=t.css("transition");r===h&&(r=a.upstream=null);a.upstream=h,a.set(x(i)),a.upstream=r}:function(e,t){d(e).set(x(t))},n})}),e(function(e){var t=o;function i(e,t,i){var a,r,o,n=i.tram,s=Array.isArray,l=/(^|\s+)/g,d=[];function c(e,t){return d=s(e)?e:[e],r||c.build(),n(_(r.lightbox,"hide").focus()).add("opacity .3s").start({opacity:1}),D(r.html,"noscroll"),c.show(t||0)}function u(e){return function(t){this===t.target&&(t.stopPropagation(),t.preventDefault(),e())}}c.build=function(){return c.destroy(),(r={html:i(t.documentElement),empty:i()}).arrowLeft=w("control left inactive"),r.arrowRight=w("control right inactive"),r.close=w("control close"),r.spinner=w("spinner"),r.strip=w("strip"),o=new b(r.spinner,S("hide")),r.content=w("content").append(r.spinner,r.arrowLeft,r.arrowRight,r.close),r.container=w("container").append(r.content,r.strip),r.lightbox=w("backdrop hide").append(r.container),r.strip.on("tap",k("item"),f),r.content.on("swipe",g).on("tap",k("left"),p).on("tap",k("right"),h).on("tap",k("close"),m).on("tap",k("image, caption"),h),r.container.on("tap",k("view, strip"),m).on("dragstart",k("img"),A),r.lightbox.on("keydown",C).on("focusin",v),i("body").append(r.lightbox.prop("tabIndex",0)),c},c.destroy=function(){r&&(_(r.html,"noscroll"),r.lightbox.remove(),r=void 0)},c.show=function(e){if(e!==a){var t=d[e];if(!t)return c.hide();var s,l,u=a;return a=e,o.show(),function(e,t){var i=w("img","img");i.one("load",function(){t(i)}),i.attr("src",e)}(t.html&&(s=t.width,l=t.height,"data:image/svg+xml;charset=utf-8,"+encodeURI('<svg xmlns="http://www.w3.org/2000/svg" width="'+s+'" height="'+l+'"/>'))||t.url,function(s){if(e===a){var l,c,p=w("figure","figure").append(D(s,"image")),h=w("frame").append(p),m=w("view").append(h);t.html&&((c=(l=i(t.html)).is("iframe"))&&l.on("load",f),p.append(D(l,"embed"))),t.caption&&p.append(w("caption","figcaption").text(t.caption)),r.spinner.before(m),c||f()}function f(){var t;(o.hide(),e===a)?(I(r.arrowLeft,"inactive",e<=0),I(r.arrowRight,"inactive",e>=d.length-1),r.view?(n(r.view).add("opacity .3s").start({opacity:0}).then((t=r.view,function(){t.remove()})),n(m).add("opacity .3s").add("transform .3s").set({x:e>u?"80px":"-80px"}).start({opacity:1,x:0})):m.css("opacity",1),r.view=m,r.items&&D(_(r.items,"active").eq(e),"active")):m.remove()}}),c}},c.hide=function(){return n(r.lightbox).add("opacity .3s").start({opacity:0}).then(y),c},c.prev=function(){a>0&&c.show(a-1)},c.next=function(){a<d.length-1&&c.show(a+1)};var p=u(c.prev),h=u(c.next),m=u(c.hide),f=function(e){var t=i(this).index();e.preventDefault(),c.show(t)},g=function(e,t){e.preventDefault(),"left"===t.direction?c.next():"right"===t.direction&&c.prev()},v=function(){this.focus()};function A(e){e.preventDefault()}function C(e){var t=e.keyCode;27===t?c.hide():37===t?c.prev():39===t&&c.next()}function y(){r&&(_(r.html,"noscroll"),D(r.lightbox,"hide"),r.strip.empty(),r.view&&r.view.remove(),_(r.content,"group"),D(r.arrowLeft,"inactive"),D(r.arrowRight,"inactive"),a=r.view=void 0)}function b(e,t,i){this.$element=e,this.className=t,this.delay=i||200,this.hide()}function S(e,t){return e.replace(l,(t?" .":" ")+"w-lightbox-")}function k(e){return S(e,!0)}function D(e,t){return e.addClass(S(t))}function _(e,t){return e.removeClass(S(t))}function I(e,t,i){return e.toggleClass(S(t),i)}function w(e,a){return D(i(t.createElement(a||"div")),e)}return b.prototype.show=function(){var e=this;e.timeoutId||(e.timeoutId=setTimeout(function(){e.$element.removeClass(e.className),delete e.timeoutId},e.delay))},b.prototype.hide=function(){var e=this;if(e.timeoutId)return clearTimeout(e.timeoutId),void delete e.timeoutId;e.$element.addClass(e.className)},function(){var i=e.navigator.userAgent,a=i.match(/(iPhone|iPad|iPod);[^OS]*OS (\d)/);if(i.indexOf("Android ")>-1&&-1===i.indexOf("Chrome")||a&&!(a[2]>7)){var r=t.createElement("style");t.head.appendChild(r),e.addEventListener("orientationchange",o,!0),o()}function o(){var t=e.innerHeight,i=e.innerWidth,a=".w-lightbox-content, .w-lightbox-view, .w-lightbox-view:before {height:"+t+"px}.w-lightbox-view {width:"+i+"px}.w-lightbox-group, .w-lightbox-group .w-lightbox-view, .w-lightbox-group .w-lightbox-view:before {height:"+.86*t+"px}.w-lightbox-image {max-width:"+i+"px;max-height:"+t+"px}.w-lightbox-group .w-lightbox-image {max-height:"+.86*t+"px}.w-lightbox-strip {padding: 0 "+.01*t+"px}.w-lightbox-item {width:"+.1*t+"px;padding:"+.02*t+"px "+.01*t+"px}.w-lightbox-thumbnail {height:"+.1*t+"px}@media (min-width: 768px) {.w-lightbox-content, .w-lightbox-view, .w-lightbox-view:before {height:"+.96*t+"px}.w-lightbox-content {margin-top:"+.02*t+"px}.w-lightbox-group, .w-lightbox-group .w-lightbox-view, .w-lightbox-group .w-lightbox-view:before {height:"+.84*t+"px}.w-lightbox-image {max-width:"+.96*i+"px;max-height:"+.96*t+"px}.w-lightbox-group .w-lightbox-image {max-width:"+.823*i+"px;max-height:"+.84*t+"px}}";r.textContent=a}}(),c}t.define("lightbox",e.exports=function(e){var a,r,o={},n=i(window,document,e),s=e(document),l=t.env(),d=".w-lightbox";function c(e){var t,i,a=e.el.children(".w-json").html();if(a){try{a=JSON.parse(a)}catch(e){console.error("Malformed lightbox JSON configuration.",e)}!function(e){e.images&&(e.images.forEach(function(e){e.type="image"}),e.items=e.images);e.embed&&(e.embed.type="video",e.items=[e.embed]);e.groupId&&(e.group=e.groupId)}(a),(t=a.group)?((i=r[t])||(i=r[t]=[]),e.items=i,a.items.length&&(e.index=i.length,i.push.apply(i,a.items))):e.items=a.items}else e.items=[]}return o.ready=o.design=o.preview=function(){a=l&&t.env("design"),n.destroy(),r={},s.find(d).webflowLightBox()},jQuery.fn.extend({webflowLightBox:function(){e.each(this,function(t,i){var r=e.data(i,d);r||(r=e.data(i,d,{el:e(i),mode:"images",images:[],embed:""})),r.el.off(d),c(r),a?r.el.on("setting"+d,c.bind(null,r)):r.el.on("tap"+d,function(e){return function(){e.items.length&&n(e.items,e.index||0)}}(r)).on("click"+d,function(e){e.preventDefault()})})}}),o})}),e(function(e){var t=o;t.define("links",e.exports=function(e,i){var a,r,o,n={},s=e(window),l=t.env(),d=window.location,c=document.createElement("a"),u="w--current",p=/^#[a-zA-Z][\w:.-]*$/,h=/index\.(html|php)$/,m=/\/$/;function f(t){var i=a&&t.getAttribute("href-disabled")||t.getAttribute("href");if(c.href=i,!(i.indexOf(":")>=0)){var n=e(t);if(0===i.indexOf("#")&&p.test(i)){var s=e(i);s.length&&r.push({link:n,sec:s,active:!1})}else if("#"!==i){var l=c.href===d.href||i===o||h.test(i)&&m.test(o);v(n,u,l)}}}function g(){var e=s.scrollTop(),t=s.height();i.each(r,function(i){var r=i.link,o=i.sec,n=o.offset().top,s=o.outerHeight(),l=.5*t,d=o.is(":visible")&&n+s-l>=e&&n+l<=e+t;i.active!==d&&(i.active=d,v(r,u,d),a&&(r[0].__wf_current=d))})}function v(e,t,i){var a=e.hasClass(t);i&&a||(i||a)&&(i?e.addClass(t):e.removeClass(t))}return n.ready=n.design=n.preview=function(){a=l&&t.env("design"),o=t.env("slug")||d.pathname||"",t.scroll.off(g),r=[];for(var e=document.links,i=0;i<e.length;++i)f(e[i]);r.length&&(t.scroll.on(g),g())},n})}),e(function(e){var t=o;t.define("maps",e.exports=function(e,i){var a={},r=(e(document),null);function o(){(void 0).each(n)}function n(e,t){var i=l(t);r.maps.event.trigger(i.map,"resize"),i.setMapPosition()}a.ready=function(){},a.destroy=function(){t.resize.off(o),t.redraw.off(o)};var s="w-widget-map";function l(i,a){var o=e.data(i,s);if(o)return o;var n=e(i);o=e.data(i,s,{latLng:"51.511214,-0.119824",tooltip:"",style:"roadmap",zoom:12,marker:new r.maps.Marker({draggable:!1}),infowindow:new r.maps.InfoWindow({disableAutoPan:!0})});var l=a.widgetLatlng||o.latLng;o.latLng=l;var d=l.split(","),c=new r.maps.LatLng(d[0],d[1]);o.latLngObj=c;var u=!(t.env.touch&&a.disableTouch);o.map=new r.maps.Map(i,{center:o.latLngObj,zoom:o.zoom,maxZoom:18,mapTypeControl:!1,panControl:!1,streetViewControl:!1,scrollwheel:!a.disableScroll,draggable:u,zoomControl:!0,zoomControlOptions:{style:r.maps.ZoomControlStyle.SMALL},mapTypeId:o.style}),o.marker.setMap(o.map),o.setMapPosition=function(){o.map.setCenter(o.latLngObj);var e=0,t=0,i=n.css(["paddingTop","paddingRight","paddingBottom","paddingLeft"]);e-=parseInt(i.paddingLeft,10),e+=parseInt(i.paddingRight,10),t-=parseInt(i.paddingTop,10),t+=parseInt(i.paddingBottom,10),(e||t)&&o.map.panBy(e,t),n.css("position","")},r.maps.event.addListener(o.map,"tilesloaded",function(){r.maps.event.clearListeners(o.map,"tilesloaded"),o.setMapPosition()}),o.setMapPosition(),o.marker.setPosition(o.latLngObj),o.infowindow.setPosition(o.latLngObj);var p=a.widgetTooltip;p&&(o.tooltip=p,o.infowindow.setContent(p),o.infowindowOpen||(o.infowindow.open(o.map,o.marker),o.infowindowOpen=!0));var h=a.widgetStyle;h&&o.map.setMapTypeId(h);var m=a.widgetZoom;return null!=m&&(o.zoom=m,o.map.setZoom(Number(m))),r.maps.event.addListener(o.marker,"click",function(){window.open("https://maps.google.com/?z="+o.zoom+"&daddr="+o.latLng+"&key="+googleKeyFormap)}),o}return a})}),e(function(e){var t=o;t.define("scroll",e.exports=function(e){var i=e(document),a=window,r=a.location,o=function(){try{return Boolean(a.frameElement)}catch(e){return!0}}()?null:a.history,n=/^[a-zA-Z0-9][\w:.-]*$/;function s(i,s){if(n.test(i)){var l=e("#"+i);if(l.length){if(s&&(s.preventDefault(),s.stopPropagation()),r.hash!==i&&o&&o.pushState&&(!t.env.chrome||"file:"!==r.protocol))(o.state&&o.state.hash)!==i&&o.pushState({hash:i},"","#"+i);var d=t.env("editor")?".w-editor-body":"body",c=e("header, "+d+" > .header, "+d+" > .w-nav:not([data-no-scroll])"),u="fixed"===c.css("position")?c.outerHeight():0;a.setTimeout(function(){!function(t,i){var r=e(a).scrollTop(),o=t.offset().top-i;if("mid"===t.data("scroll")){var n=e(a).height()-i,s=t.outerHeight();s<n&&(o-=Math.round((n-s)/2))}var l=1;e("body").add(t).each(function(){var t=parseFloat(e(this).attr("data-scroll-time"),10);!isNaN(t)&&(0===t||t>0)&&(l=t)}),Date.now||(Date.now=function(){return(new Date).getTime()});var d=Date.now(),c=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||function(e){a.setTimeout(e,15)},u=(472.143*Math.log(Math.abs(r-o)+125)-2e3)*l,p=function(){var e=Date.now()-d;a.scroll(0,function(e,t,i,a){if(i>a)return t;return e+(t-e)*(r=i/a,r<.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1);var r}(r,o,e,u)),e<=u&&c(p)};p()}(l,u)},s?0:300)}}}return{ready:function(){r.hash&&s(r.hash.substring(1));var a=r.href.split("#")[0];i.on("click","a.anchorhashscroll",function(i){if(!(t.env("design")||window.$.mobile&&e(i.currentTarget).hasClass("ui-link")))if("#"!==this.getAttribute("href")){var r=this.href.split("#"),o=r[0]===a?r[1]:null;o&&s(o,i)}else i.preventDefault()})}}})}),e(function(e){var t=o,i=s;t.define("tabs",e.exports=function(e){var a,r,o={},n=e.tram,s=e(document),l=t.env,d=l.safari,c=l(),u="data-w-tab",p=".w-tabs",h="w--current",m="w--tab-active",f=i.triggers,g=!1;function v(){r=c&&t.env("design"),(a=s.find(p)).length&&(a.each(y),t.env("preview")&&!g&&a.each(C),A(),t.redraw.on(o.redraw))}function A(){t.redraw.off(o.redraw)}function C(t,i){var a=e.data(i,p);a&&(a.links&&a.links.each(f.reset),a.panes&&a.panes.each(f.reset))}function y(t,i){var a=e(i),o=e.data(i,p);if(o||(o=e.data(i,p,{el:a,config:{}})),o.current=null,o.menu=a.children(".w-tab-menu"),o.links=o.menu.children(".w-tab-link"),o.content=a.children(".w-tab-content"),o.panes=o.content.children(".w-tab-pane"),o.el.off(p),o.links.off(p),function(e){var t={};t.easing=e.el.attr("data-easing")||"ease";var i=parseInt(e.el.attr("data-duration-in"),10);i=t.intro=i==i?i:0;var a=parseInt(e.el.attr("data-duration-out"),10);a=t.outro=a==a?a:0,t.immediate=!i&&!a,e.config=t}(o),!r){o.links.on("click"+p,function(e){return function(t){var i=t.currentTarget.getAttribute(u);i&&b(e,{tab:i})}}(o));var n=o.links.filter("."+h).attr(u);n&&b(o,{tab:n,immediate:!0})}}function b(i,a){a=a||{};var r=i.config,o=r.easing,s=a.tab;if(s!==i.current){i.current=s,i.links.each(function(t,i){var a=e(i);i.getAttribute(u)===s?a.addClass(h).each(f.intro):a.hasClass(h)&&a.removeClass(h).each(f.outro)});var l=[],c=[];i.panes.each(function(t,i){var a=e(i);i.getAttribute(u)===s?l.push(i):a.hasClass(m)&&c.push(i)});var p=e(l),v=e(c);if(a.immediate||r.immediate)return p.addClass(m).each(f.intro),v.removeClass(m),void(g||t.redraw.up());v.length&&r.outro?(v.each(f.outro),n(v).add("opacity "+r.outro+"ms "+o,{fallback:d}).start({opacity:0}).then(A)):A()}function A(){if(v.removeClass(m).css({opacity:"",transition:"",transform:"",width:"",height:""}),p.addClass(m).each(f.intro),t.redraw.up(),!r.intro)return n(p).set({opacity:1});n(p).set({opacity:0}).redraw().add("opacity "+r.intro+"ms "+o,{fallback:d}).start({opacity:1})}}return o.ready=o.design=o.preview=v,o.redraw=function(){g=!0,v(),g=!1},o.destroy=function(){(a=s.find(p)).length&&(a.each(C),A())},o})}),e(function(e){o.define("touch",e.exports=function(e){var t={},i=!document.addEventListener,a=window.getSelection;function r(t){var i,r,n,s=!1,l=!1,d=!1,c=Math.min(Math.round(.04*window.innerWidth),40);function u(t){if(1!=function(t){try{return void 0!==t&&void 0!==e(t.target)&&void 0!==e(t.target).prop("type")&&"range"==e(t.target).prop("type")}catch(e){return!1}}(t)){var a=t.touches;a&&a.length>1||(s=!0,l=!1,a?(d=!0,i=a[0].clientX,r=a[0].clientY):(i=t.clientX,r=t.clientY),n=i)}}function p(e){if(s){if(d&&"mousemove"===e.type)return e.preventDefault(),void e.stopPropagation();var t=e.touches,u=t?t[0].clientX:e.clientX,p=t?t[0].clientY:e.clientY,h=u-n;n=u,Math.abs(h)>c&&a&&""===String(a())&&(o("swipe",e,{direction:h>0?"right":"left"}),m()),(Math.abs(u-i)>10||Math.abs(p-r)>10)&&(l=!0)}}function h(e){if(s){if(s=!1,d&&"mouseup"===e.type)return e.preventDefault(),e.stopPropagation(),void(d=!1);l||o("tap",e)}}function m(){s=!1}t.addEventListener("touchstart",u,!1),t.addEventListener("touchmove",p,!1),t.addEventListener("touchend",h,!1),t.addEventListener("touchcancel",m,!1),t.addEventListener("mousedown",u,!1),t.addEventListener("mousemove",p,!1),t.addEventListener("mouseup",h,!1),t.addEventListener("mouseout",m,!1),this.destroy=function(){t.removeEventListener("touchstart",u,!1),t.removeEventListener("touchmove",p,!1),t.removeEventListener("touchend",h,!1),t.removeEventListener("touchcancel",m,!1),t.removeEventListener("mousedown",u,!1),t.removeEventListener("mousemove",p,!1),t.removeEventListener("mouseup",h,!1),t.removeEventListener("mouseout",m,!1),t=null}}function o(t,i,a){var r=e.Event(t,{originalEvent:i});e(i.target).trigger(r,a)}return i&&(e.event.special.tap={bindType:"click",delegateType:"click"}),t.init=function(t){return i?null:(t="string"==typeof t?e(t).get(0):t)?new r(t):null},t.instance=t.init(document),t})})}(),Webflow.require("ix").init([{slug:"new-interaction",name:"New Interaction",value:{style:{},triggers:[{type:"scroll",selector:".fixed-tabs-div",stepsA:[{display:"none",opacity:0,transition:"opacity 500ms ease 0ms"}],stepsB:[{display:"block",opacity:1,transition:"opacity 200ms ease 0ms"}]}]}},{slug:"popup-date-picker",name:"Popup Date Picker",value:{style:{},triggers:[{type:"click",selector:".calendar-overall-div",stepsA:[{display:"block",opacity:0},{display:"block",opacity:1,transition:"opacity 500ms ease 0ms"}],stepsB:[{display:"block",opacity:0,transition:"opacity 500ms ease 0ms"},{display:"none",opacity:0}]}]}},{slug:"book-date-popup",name:"Book Date Popup",value:{style:{},triggers:[{type:"click",selector:".book-calendar-overall-div",stepsA:[{display:"block",opacity:0},{display:"block",opacity:1,transition:"opacity 500ms ease 0ms"}],stepsB:[{display:"block",opacity:0,transition:"opacity 500ms ease 0ms"},{display:"none",opacity:0}]}]}},{slug:"mobile-search-div",name:"Mobile Search Div",value:{style:{},triggers:[{type:"click",selector:".mobile-search-background-div",stepsA:[{display:"block",opacity:1,transition:"opacity 500ms ease 0ms"}],stepsB:[]}]}},{slug:"mobile-search-close",name:"Mobile Search Close",value:{style:{},triggers:[{type:"click",selector:".mobile-search-background-div",stepsA:[{display:"none",opacity:0,transition:"opacity 500ms ease 0ms"}],stepsB:[]}]}},{slug:"aesop-product-popup",name:"Aesop Product Popup",value:{style:{},triggers:[{type:"click",selector:".product-popup-background",stepsA:[{display:"flex",display:"-webkit-box",opacity:0},{display:"-webkit-box",display:"flex",opacity:1,transition:"opacity 500ms ease 0ms"}],stepsB:[]}]}},{slug:"close-product-popup",name:"Close Product Popup",value:{style:{},triggers:[{type:"click",selector:".product-popup-background",stepsA:[{opacity:0,transition:"opacity 500ms ease 0ms"},{display:"none"}],stepsB:[]}]}},{slug:"background-click-dissappear",name:"Background Click Dissappear",value:{style:{},triggers:[{type:"click",stepsA:[{opacity:0,transition:"opacity 500ms ease 0ms"},{display:"none"}],stepsB:[]}]}},{slug:"mobile-close-product-popup",name:"Mobile Close Product Popup",value:{style:{},triggers:[]}},{slug:"mobile-menu-expand",name:"Mobile Menu Expand",value:{style:{},triggers:[{type:"click",selector:".mobile-menu-background-div",stepsA:[{display:"block",opacity:0},{display:"block",opacity:1,transition:"opacity 500ms ease 0ms"}],stepsB:[{display:"block",opacity:0,transition:"opacity 500ms ease 0ms"},{display:"none",opacity:0}]}]}},{slug:"show-map",name:"Show Map",value:{style:{},triggers:[{type:"click",selector:".listings-map-40",stepsA:[{display:"block",opacity:1,transition:"opacity 500ms ease 0ms"}],stepsB:[{display:"none",opacity:0,transition:"opacity 500ms ease 0ms"}]}]}},{slug:"new-interaction-2",name:"New Interaction 2",value:{style:{},triggers:[{type:"hover",selector:".edit-link-block",stepsA:[{display:"block"}],stepsB:[]}]}},{slug:"mobile-show-pricing",name:"Mobile Show Pricing",value:{style:{},triggers:[{type:"click",selector:".hidden-mobile",stepsA:[{display:"block"}],stepsB:[]}]}},{slug:"change-address",name:"Change Address",value:{style:{},triggers:[{type:"click",selector:".change-address-div",stepsA:[{display:"block"}],stepsB:[]}]}},{slug:"change-address-2",name:"Change Address 2",value:{style:{},triggers:[{type:"click",selector:".change-address-div",stepsA:[{display:"none"}],stepsB:[]}]}},{slug:"heart-appear",name:"Heart Appear",value:{style:{},triggers:[{type:"hover",selector:".heart-appear",stepsA:[{opacity:1,transition:"opacity 200 ease 0"}],stepsB:[{opacity:0,transition:"opacity 200 ease 0"}]}]}},{slug:"like-heart",name:"Like Heart",value:{style:{},triggers:[{type:"click",selector:".heart-appear-fill",siblings:!0,stepsA:[{display:"block",opacity:1,transition:"opacity 200 ease 0"}],stepsB:[]}]}},{slug:"like-disappear",name:"Like Disappear",value:{style:{},triggers:[{type:"click",stepsA:[{display:"none",opacity:0,transition:"opacity 200 ease 0"}],stepsB:[]}]}},{slug:"show-text-editor",name:"Show Text Editor",value:{style:{},triggers:[{type:"click",selector:".text-editor-div",stepsA:[{display:"block",opacity:0},{display:"block",opacity:1,transition:"opacity 300ms ease 0"}],stepsB:[{display:"block",opacity:0,transition:"opacity 300ms ease 0"},{display:"none",opacity:0}]}]}},{slug:"expand-services",name:"Expand Services",value:{style:{},triggers:[{type:"click",selector:".expand-services",siblings:!0,stepsA:[{display:"block",opacity:1,transition:"opacity 200 ease 0"}],stepsB:[{display:"none",opacity:0,transition:"opacity 200 ease 0"}]}]}},{slug:"show-more-description",name:"Show More Description",value:{style:{},triggers:[{type:"click",selector:".listing-business-description",stepsA:[{height:"auto",transition:"height 200 ease 0"}],stepsB:[{height:"41px",transition:"height 200 ease 0"}]}]}},{slug:"gallery-solo-hover-heart",name:"Gallery Solo Hover Heart",value:{style:{},triggers:[{type:"hover",selector:".gallery-hover-div",descend:!0,stepsA:[{display:"flex",opacity:1,transition:"opacity 200 ease 0",display:"-webkit-box",display:"-ms-flexbox"}],stepsB:[{display:"none"}]}]}},{slug:"open-gallery-popup",name:"Open Gallery Popup",value:{style:{},triggers:[{type:"click",selector:".gallery-popup-div",stepsA:[{display:"flex",display:"-webkit-box",transition:"transform 200 ease 0"}],stepsB:[]}]}},{slug:"where-dropdown",name:"Where Dropdown",value:{style:{},triggers:[{type:"click",selector:".where-dropdown",descend:!0,stepsA:[{display:"block"}],stepsB:[{display:"none"}]}]}},{slug:"message-service-provider",name:"Message Service Provider",value:{style:{},triggers:[{type:"click",selector:".message-service-provider-background",stepsA:[{display:"flex",display:"-webkit-box"}],stepsB:[]}]}},{slug:"hide-message-service-provider",name:"Hide Message Service Provider",value:{style:{},triggers:[{type:"click",stepsA:[{display:"none"}],stepsB:[]}]}},{slug:"show-phone-number",name:"Show Phone Number",value:{style:{},triggers:[{type:"click",selector:".show-phone-number",stepsA:[{display:"block"}],stepsB:[{display:"none"}]}]}},{slug:"open-shopping-cart",name:"Open Shopping Cart",value:{style:{},triggers:[{type:"click",selector:".shopping-cart-background",stepsA:[{display:"block"}],stepsB:[{display:"none"}]}]}},{slug:"close-shopping-cart",name:"Close Shopping Cart",value:{style:{},triggers:[{type:"click",stepsA:[{display:"none"}],stepsB:[]}]}},{slug:"hover-day-circle",name:"Hover Day Circle",value:{style:{},triggers:[{type:"hover",selector:".day-circle",descend:!0,stepsA:[{display:"flex",opacity:1,transition:"opacity 200 ease 0"}],stepsB:[]}]}},{slug:"open-filters",name:"Open Filters",value:{style:{},triggers:[{type:"click",selector:".filter-background",stepsA:[{display:"block"}],stepsB:[]}]}},{slug:"close-filter",name:"Close Filter",value:{style:{},triggers:[{type:"click",selector:".filter-background",stepsA:[{display:"none"}],stepsB:[]}]}},{slug:"checkbox-click",name:"Checkbox Click",value:{style:{},triggers:[{type:"click",selector:".inner-check",descend:!0,stepsA:[{display:"flex"}],stepsB:[{display:"none"}]}]}},{slug:"show-delete-item-x",name:"Show Delete Item X",value:{style:{},triggers:[{type:"hover",selector:".delete-item-link",descend:!0,stepsA:[{display:"flex",opacity:0},{display:"flex",opacity:1,transition:"opacity 300ms ease 0"}],stepsB:[{display:"none"},{display:"flex",opacity:0}]}]}},{slug:"show-quantity-dropdown-arrow",name:"Show Quantity Dropdown Arrow",value:{style:{},triggers:[{type:"hover",selector:".quantity-dropdown-arrow",descend:!0,stepsA:[{opacity:.8,transition:"opacity 300ms ease 0"}],stepsB:[{opacity:0,transition:"opacity 300ms ease 0"}]}]}},{slug:"review-show-more-stars",name:"Review Show More Stars",value:{style:{},triggers:[{type:"click",selector:".second-stars-div",stepsA:[{display:"block",height:"0px"},{display:"block",height:"auto",transition:"height 300ms ease 0"}],stepsB:[]}]}},{slug:"hide-your-review-div",name:"Hide Your Review Div",value:{style:{},triggers:[{type:"click",selector:".your-review-div",stepsA:[{height:"0px",transition:"height 300ms ease 0"}],stepsB:[]},{type:"click",selector:".review-form-wrapper",stepsA:[{display:"block",height:"0px"},{display:"block",height:"auto",transition:"transform 200 ease 0, height 300ms ease 0"}],stepsB:[]}]}},{slug:"show-review-form-wrapper",name:"Show Review Form Wrapper",value:{style:{},triggers:[{type:"click",selector:".review-form-wrapper",stepsA:[{display:"block",opacity:0},{display:"block",opacity:1,transition:"opacity 200 ease 0"}],stepsB:[]}]}},{slug:"hero-list-move",name:"Hero List Move",value:{style:{x:"0px",y:"50px",z:"0px"},triggers:[{type:"load",loopA:!0,stepsA:[{wait:"2s"},{transition:"transform 250ms ease-out 0",x:"0px",y:"0px",z:"0px"},{wait:"3s"},{transition:"transform 250ms ease-out 0",x:"0px",y:"-50px",z:"0px"},{wait:"3s"},{transition:"transform 250ms ease-out 0",x:"0px",y:"-100px",z:"0px"},{wait:"3s"},{transition:"transform 250ms ease-out 0",x:"0px",y:"-150px",z:"0px"},{wait:"3s"},{transition:"transform 250ms ease-out 0",x:"0px",y:"-200px",z:"0px"},{wait:"3s"},{transition:"transform 600ms ease-out 0",x:"0px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"open-mobile-dropown",name:"Open Mobile Dropown",value:{style:{},triggers:[{type:"click",selector:".mobile-dropdown",preserve3d:!0,stepsA:[{display:"block",opacity:0,x:"0px",y:"-100px",z:"0px"},{display:"block",opacity:1,transition:"transform 200 ease 0, opacity 200 ease 0",x:"0px",y:"0px",z:"0px"}],stepsB:[{display:"block",opacity:0,transition:"transform 200 ease 0, opacity 200 ease 0",x:"0px",y:"-100px",z:"0px"},{display:"none"}]}]}},{slug:"move-categories-left",name:"Move Categories Left",value:{style:{},triggers:[{type:"click",selector:".service-parent-div",preserve3d:!0,stepsA:[{transition:"transform 200 ease 0",x:"-667px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"hide-map-icon",name:"Hide Map Icon",value:{style:{},triggers:[{type:"click",stepsA:[{opacity:0,transition:"opacity 100ms ease 0"}],stepsB:[{opacity:1,transition:"opacity 100ms ease 0"}]}]}},{slug:"show-map-icon",name:"Show Map Icon",value:{style:{},triggers:[{type:"click",stepsA:[],stepsB:[]}]}},{slug:"show-service-link",name:"Show Service Link",value:{style:{},triggers:[{type:"hover",selector:".service-link",descend:!0,stepsA:[{display:"inline-block"}],stepsB:[{display:"none"}]},{type:"click",selector:".service-mobile-hide",descend:!0,stepsA:[{display:"block"}],stepsB:[{display:"none"}]}]}},{slug:"show-order-summary",name:"Show Order Summary",value:{style:{},triggers:[{type:"click",selector:".show-hide-div",stepsA:[{display:"flex",height:"0px"},{display:"block",height:"auto",transition:"height 300ms ease 0"}],stepsB:[{display:"flex",height:"0px",transition:"height 300ms ease 0"},{display:"none"}]},{type:"click",selector:".dropdown-checkout",descend:!0,preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",rotateX:"0deg",rotateY:"0deg",rotateZ:"-90deg"}],stepsB:[{transition:"transform 300ms ease 0",rotateX:"0deg",rotateY:"0deg",rotateZ:"90deg"}]},{type:"click",selector:".view-order-summary",descend:!0,stepsA:[{opacity:0,transition:"opacity 200 ease 0"}],stepsB:[{opacity:1,transition:"opacity 200 ease 0"}]}]}},{slug:"initial-show-none",name:"Initial Show None",value:{style:{display:"none"},triggers:[]}},{slug:"add-service",name:"Add Service",value:{style:{},triggers:[{type:"click",selector:".add-service-2",stepsA:[{display:"flex",height:"0px"},{display:"flex",height:"auto",transition:"height 500ms ease 0"}],stepsB:[]}]}},{slug:"hover-back-arrow",name:"Hover Back Arrow",value:{style:{},triggers:[{type:"hover",selector:".back-arrow",preserve3d:!0,stepsA:[{transition:"transform 200 ease 0",x:"-4px",y:"0px",z:"0px"}],stepsB:[{transition:"transform 200 ease 0",x:"0px",y:"0px",z:"0px"}]}]}},{slug:"login-load",name:"Login Load",value:{style:{},triggers:[{type:"load",stepsA:[{opacity:0,x:"0px",y:"-400px",z:"0px"},{opacity:1,transition:"transform 1000ms ease-in-out-back 0, opacity 200 ease 0",x:"0px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"open-class-booking",name:"open class booking",value:{style:{},triggers:[{type:"click",selector:".class-popup-background",stepsA:[{display:"flex"}],stepsB:[]},{type:"click",selector:".review-modal",stepsA:[{display:"block",opacity:1,transition:"opacity 200 ease 0"}],stepsB:[]}]}},{slug:"close-class-modal",name:"Close Class Modal",value:{style:{},triggers:[{type:"click",selector:".class-popup-background",stepsA:[{display:"none"}],stepsB:[]},{type:"click",selector:".review-modal",stepsA:[{display:"none"}],stepsB:[]}]}},{slug:"bg-modal-hide",name:"BG Modal Hide",value:{style:{},triggers:[{type:"click",stepsA:[{display:"none"}],stepsB:[]},{type:"click",selector:".modal",stepsA:[{display:"none"}],stepsB:[]}]}},{slug:"review-back-button",name:"Review Back Button",value:{style:{},triggers:[{type:"click",selector:".review-form-wrapper",stepsA:[{height:"0px",transition:"height 300ms ease 0"}],stepsB:[]},{type:"click",selector:".review-stars",stepsA:[{height:"auto",transition:"height 300ms ease 0"}],stepsB:[]}]}},{slug:"close-review-modal",name:"Close Review Modal",value:{style:{},triggers:[{type:"click",selector:".review-modal",stepsA:[{opacity:0,transition:"opacity 300ms ease 0"},{display:"none"}],stepsB:[]},{type:"click",selector:".review-background-div",stepsA:[{opacity:0,transition:"opacity 300ms ease 0"},{display:"none"}],stepsB:[]}]}},{slug:"close-class-modal-2",name:"Close Class Modal 2",value:{style:{},triggers:[{type:"click",selector:".review-modal",stepsA:[{opacity:0,transition:"opacity 300ms ease 0"},{display:"none"}],stepsB:[]},{type:"click",selector:".class-popup-background",stepsA:[{opacity:0,transition:"opacity 300ms ease 0"},{display:"none"}],stepsB:[]}]}},{slug:"gc-category-slide",name:"GC Category Slide",value:{style:{},triggers:[{type:"click",selector:".gc-flex-container",preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",x:"-150%",y:"0px",z:"0px"}],stepsB:[]},{type:"click",selector:".build-gc-container",preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",x:"-101%",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"back-to-gc-categories",name:"Back to GC Categories",value:{style:{},triggers:[{type:"click",selector:".build-gc-container",preserve3d:!0,stepsA:[{transition:"transform 400ms ease 0",x:"0%",y:"0px",z:"0px"}],stepsB:[]},{type:"click",selector:".gc-flex-container",preserve3d:!0,stepsA:[{transition:"transform 400ms ease 0",x:"0px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"calendar-fall",name:"Calendar Fall",value:{style:{opacity:0,x:"0px",y:"-100px",z:"0px"},triggers:[{type:"load",stepsA:[{wait:"400ms"},{opacity:1,transition:"transform 400ms ease-out-back 0, opacity 200 ease 0",x:"0px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"cal-success-check",name:"Cal Success Check",value:{style:{scaleX:.01,scaleY:.01,scaleZ:1},triggers:[{type:"load",stepsA:[{wait:"1200ms"},{transition:"transform 200 ease-out-back 0",scaleX:1,scaleY:1,scaleZ:1}],stepsB:[]}]}},{slug:"fade-in",name:"Fade In",value:{style:{opacity:0,x:"0px",y:"13px",z:"0px"},triggers:[{type:"load",stepsA:[{opacity:1,transition:"opacity 500ms ease 0, transform 500ms ease 0",x:"0px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"fade-in-delay",name:"Fade in Delay",value:{style:{opacity:0},triggers:[{type:"load",stepsA:[{wait:"1500ms"},{opacity:1,transition:"opacity 1000ms ease 0"}],stepsB:[]}]}},{slug:"cal-success-check",name:"Cal Success Check",value:{style:{scaleX:.01,scaleY:.01,scaleZ:1},triggers:[{type:"load",stepsA:[{wait:"800ms"},{transition:"transform 200 ease-out-back 0",scaleX:1,scaleY:1,scaleZ:1}],stepsB:[]}]}},{slug:"cal-success-check-2",name:"Cal Success Check 2",value:{style:{scaleX:.01,scaleY:.01,scaleZ:1},triggers:[{type:"load",stepsA:[{wait:"800ms"},{transition:"transform 200 ease-out-back 0",scaleX:1,scaleY:1,scaleZ:1}],stepsB:[]}]}},{slug:"fade-in2",name:"Fade In",value:{style:{opacity:0,x:"0px",y:"13px",z:"0px"},triggers:[{type:"load",stepsA:[{opacity:1,transition:"opacity 500ms ease 0, transform 500ms ease 0",x:"0px",y:"0px",z:"0px"}],stepsB:[]}]}},{slug:"fade-in-delay2",name:"Fade in Delay",value:{style:{opacity:0},triggers:[{type:"load",stepsA:[{wait:"1500ms"},{opacity:1,transition:"opacity 1000ms ease 0"}],stepsB:[]}]}}]);var $=jQuery.noConflict(),$window=$(window);!function(e){iPadAndroid?e("body").addClass("touchDevice ipadandroid"):e("body").addClass("desktop"),iOS&&e("html, body").addClass("iosdevice"),isiOSPRO&&e("html, body").addClass("iosPro"),iMacSafari&&e("body").addClass("mac-safari"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&e("html, body").addClass("vgcustomerapp"),e(".thm-topHeadBG").hasClass("facebook")&&e("html, body").addClass("facebookwidget"),-1==navigator.appVersion.indexOf("Win")||-1==navigator.userAgent.indexOf("Safari")||-1!=navigator.userAgent.indexOf("Chrome")||isWindowsPhoneTemp||e("body").addClass("windowsSafari"),isWindowsPhoneTemp&&e("body").addClass("windowsPhone touchDevice").removeClass("desktop"),isWebKit&&!isEdge&&(isWindowsPhone&&!iMacSafari||iPadAndroid||e("body").addClass("webkit-desktop")),e(document).ready(function(){$window.on("resize",function(){footerBottomfixed(),"undefined"!=typeof _featured&&void 0!==_featured.centerGalleryPopup?_featured.centerGalleryPopup():void 0!==_common.centerGalleryPopup&&_common.centerGalleryPopup(),centerModalPopup()}),"undefined"==typeof BasePage||"Home"!=BasePage&&"MyAccount"!=BasePage&&""!=BasePage||(lazyloadImages(),centerModalPopup())}),e(window).on("load",function(){document.getElementById("hero-list")&&setInterval(function(){heroTextSlider()},3e3),footerBottomfixed()})}(jQuery);var mobileMenu=function(){$("#desktop-menu").length&&($("#desktop-menu").children().clone(!0,!0).appendTo("#mobile-menu"),$("#mobile-menu a").each(function(){$(this).removeClass("profile-dropdown-links w-dropdown-link w-hidden-main").addClass("mobile-dropdown-link")}),_common.ApplyEnScroll("#mobile-menu"),$(".profilesidePicMobile").html($("#divUserPhoto").clone()).find("#divUserPhoto").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"))},footerBottomfixed=function(){setTimeout(function(){if($("#footerdiv").length){var e;$("#footerdiv").css("height","auto"),e=$("#footerdiv").outerHeight(!0),$(".content-wrapper.footerpresent").css("margin-bottom","-"+e+"px"),$("#pushdiv").css("height",e),$("#footerdiv").css("height",e);var t=$(window).height()-(e+50);$(".profile-page").css("min-height",t)}},300)},shopdetailFixedNavHTML=function(e){if($("#downloadApp").hide(),$("#navbar").length){if(_shopdetail.VisibleControlLength("#mobile-check")>0){if("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()){"undefined"==typeof isshowMobileApp&&(isshowMobileApp="true");try{"true"==isshowMobileApp.toLowerCase()&&0==$("#downloadApp").is(":visible")&&(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone)&&$("#downloadApp").show()}catch(e){}"undefined"!=typeof w_type&&"1"!=w_type&&$(".thm-topHeadBG").show(),$("#download_ios").hide(),$("#download_and").hide(),$("#download_win").hide(),iOS?$("#download_ios").show():iPadAndroid?$("#download_and").show():isWindowsPhone?$("#download_win").show():$("#downloadApp").hide(),$("#downloadApp a").on("click",function(e){var t={BusinessID:parseInt(_siteBuilderDetail.businessID)},i=new vagaro.ajax;i.datamodel.async=!1,i.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken("MyAccount/GetBrandedAppDetail",_siteBuilderDetail.SQLGroupID),i.datamodel.data=t,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){e.preventDefault(),null!=t.Data&&1==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsBrandedAppEnabled?!String.isNullOrUndefineOrBlank(t.Data.iTunesURL)&&iOS?window.open(t.Data.iTunesURL,"_blank"):!String.isNullOrUndefineOrBlank(t.Data.PlayStoreURL)&&iPadAndroid?window.open(t.Data.PlayStoreURL,"_blank"):RedirectToIPhoneAndroidApp():RedirectToIPhoneAndroidApp()},i.datamodel.Error=_common.CallFailed,i.Post()})}if($("#clickOnMenuAbove,#clickOnMenuOr").hide(),void 0!==e){var t=$("#tabs.navbar-nav").children().clone(!0,!0);$("<div id='mobiletabmenu' class='mobiletabmenu thm-mobilenavsection clstopheadermenu2'></div>").prependTo(e),$(e).find("#mobiletabmenu").html(""),t.prependTo($(e).find("#mobiletabmenu")),$("#clickOnMenuAbove,#clickOnMenuOr").show()}$("#mobiletabmenu li").addClass("mobile-menu").removeClass("tab"),$("#mobiletabmenu a").removeClass("active tab w--current")}lazyLoadWithContainer("lazystyle","divBusinessPhotos"),lazyLoadWithContainer("lazypromotion","detailPromotion")}};function RedirectToIPhoneAndroidApp(){iOS?RedirecttoApp("iPhone"):iPadAndroid?RedirecttoApp("Android"):isWindowsPhone&&("undefined"!=typeof w_type&&"1"==w_type?window.open("http://www.windowsphone.com/s?appid=8346ba41-3bf5-4843-8824-c8a6269acd39","_blank"):window.location.href="http://www.windowsphone.com/s?appid=8346ba41-3bf5-4843-8824-c8a6269acd39")}function RedirectToIPhoneAndroidAppNew(){iOS?RedirecttoAppNew("iPhone"):iPadAndroid?RedirecttoAppNew("Android"):isWindowsPhone&&("undefined"!=typeof w_type&&"1"==w_type?window.open("http://www.windowsphone.com/s?appid=8346ba41-3bf5-4843-8824-c8a6269acd39","_blank"):window.location.href="http://www.windowsphone.com/s?appid=8346ba41-3bf5-4843-8824-c8a6269acd39")}function ClearHomeServicesDate(){$("#txtHomeServicesDate").val("Anytime"),$("#txtHomeServicesDate").data("date",getLocationDate()),$("#spnHomeServicesDate").hide()}function ClearHomeServicesDate1(){$("#txtHomeServicesDate1").data("date",getLocationDate()),$("#spnHomeServicesDate1").hide()}function openMobileSearch(e){1==$("#txtSearchServiceMain").length&&""==$("#txtSearchServiceMain").val()&&($("#divBusType").attr("style",""),$("#aMobileTab").show(),$("#btnSearchBuss").removeClass("mob-class-serachspace")),"book"==tabSegment&&($("#dvHome").show(),$("#dvFeatureBusiness").hide()),$("#search-bar-wrapper-all").fadeIn("500"),$("html,body").addClass("mob-overflow-hidden"),$("body").addClass("banner-hide-custapp"),"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==e&&1==e&&CallbackforMobileApp(0,0,"","",0,24);try{if($("#spnHomeServicesDate").hide(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType){isFilterScreen=!0,$("#btnBackHomeSearch").data("isFilterclicked","1"),$("#mobileBack").show(),ClearHomeServicesDate();var t={id:"",text:""};$("body").removeClass("listing-like-page"),$(".sort-dropdown-div.w-dropdown.divSorting.listpage-sorting").hide(),$("#txtBusinessLocationSearch").select2("data",t),_common.SetChoiceForSeleect2($("#txtBusinessLocationSearch"),t),isBackHomeScreen=!0}else $("body").addClass("desktopcustomerbody"),$("#mobilemenutoggle").hide(),isMobileBrowserFilterScreen=!0}catch(e){}}function closeMobileSearch(){$("#select2-drop-mask").click(),$("#search-bar-wrapper-all").fadeOut("400"),$("body").removeClass("banner-hide-custapp"),$("html,body").removeClass("mob-overflow-hidden"),"undefined"!=typeof _common&&"function"==typeof _common.RefreshAppPromo&&_common.RefreshAppPromo(),"book"==tabSegment&&($("#dvHome").hide(),$("#dvFeatureBusiness").show()),$("#mobile-check").is(":visible")&&($("#mobilemenutoggle").show(),isMobileBrowserFilterScreen=!1)}function lazyloadImages(){$(".lazy").length>0&&$(".lazy").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload"),$(".lazy-bgimg").length>0&&$(".lazy-bgimg").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload"),$(".lazy-img").length>0&&$("img.lazy-img").lazyload({event:"lazyload",effect:"fadeIn"}).trigger("lazyload")}function lazyLoadWithContainer(e,t){$("."+e).length>0&&$("."+e,$("#"+t)).lazyload({effect:"fadeIn",container:$("#"+t)})}var numMinuspixel=0;if(document.getElementById("hero-list")){var heroListElm=document.getElementById("hero-list").childElementCount;$("#hero-list").css("transform","translate3d(0,0,0)")}var i=1;function heroTextSlider(){heroListElm=document.getElementById("hero-list").childElementCount,i<heroListElm?($("#hero-list").removeClass("transition600ms"),numMinuspixel-=50,$("#hero-list").css("transform","translateY("+numMinuspixel+"px)"),i+=1):i<=heroListElm&&($("#hero-list").addClass("transition600ms"),numMinuspixel=0,i=1,$("#hero-list").css("transform","translateY(0px)"))}function centerModalPopup(){$(".popup-modal-main:visible").css({top:($(window).height()-$(".popup-modal-main:visible").outerHeight())/2})}function closeModalPopup(e){$(e).closest(".popup-container-main").fadeOut(300)}function openModalPopup(e){var t=$(e).attr("data-id");$("#"+t).fadeIn(300),centerModalPopup()}function truncateText(e,t,i,a){return e.length>i?e.substring(t,i)+(a?"...":""):e.substring(t,i)}function toCamelCase(e){if(void 0!==e&&null!=e||(e=""),e.length>1){var t="",a=e.split(" ");if(null!=a&&a.length>0)for(i=0;i<a.length;i++)t+=(i>0?" ":"")+a[i].substr(0,1).toUpperCase()+a[i].substr(1,a[i].length-1).toLowerCase();return t}return e.toUpperCase()}function htmlDecode(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'").replace(/&#34;/g,'"')}!function(e){e.mobiscroll.themes.jqm={defaults:{jqmBorder:"a",jqmBody:"c",jqmHeader:"b",jqmWheel:"d",jqmClickPick:"c",jqmSet:"b",jqmCancel:"c"},init:function(t,i){var a=i.settings;e(".dw",t).removeClass("dwbg").addClass("ui-overlay-shadow ui-corner-all ui-body-"+a.jqmBorder),e(".dwb-s span",t).attr("data-role","button").attr("data-theme",a.jqmSet),e(".dwb-n span",t).attr("data-role","button").attr("data-theme",a.jqmCancel),e(".dwb-c span",t).attr("data-role","button").attr("data-theme",a.jqmCancel),e(".dwwb",t).attr("data-role","button").attr("data-theme",a.jqmClickPick),e(".dwv",t).addClass("ui-header ui-bar-"+a.jqmHeader),e(".dwwr",t).addClass("ui-body-"+a.jqmBody),e(".dwpm .dwwl",t).addClass("ui-body-"+a.jqmWheel),e(".dwpm .dwl",t).addClass("ui-body-"+a.jqmBody),t.trigger("create"),e(".dwo",t).click(function(){i.cancel()})}}}(jQuery),jQuery.mobiscroll.themes.android={defaults:{dateOrder:"Mddyy",mode:"clickpick",height:50,showLabel:!1}},function(e){var t={defaults:{dateOrder:"Mddyy",mode:"mixed",rows:5,width:40,height:36,showLabel:!1,useShortLabels:!0}};e.mobiscroll.themes["android-ics"]=t,e.mobiscroll.themes["android-ics light"]=t}(jQuery),jQuery.mobiscroll.themes.ios={defaults:{dateOrder:"MMdyy",rows:5,height:35,width:30,headerText:!1,showLabel:!1,useShortLabels:!0}},function(e){var t=e.mobiscroll,i={invalid:[],showInput:!0,inputClass:""},a=function(t){var a,r,o=e.extend({},t.settings),n=e.extend(t.settings,i,o),s=e(this),l=this.id+"_dummy",d=0,c=0,u={},p=n.wheelArray||function t(i){var a=[];return d=d>c++?d:c,i.children("li").each(function(i){var r=e(this),o=r.clone();o.children("ul,ol").remove();var n=o.html().replace(/^\s\s*/,"").replace(/\s\s*$/,""),s=!!r.data("invalid"),l={key:r.data("val")||i,value:n,invalid:s,children:null},d=r.children("ul,ol");d.length&&(l.children=t(d)),a.push(l)}),c--,a}(s),h=function(e){var t,i=[];for(t=0;t<e;t++)i[t]=n.labels&&n.labels[t]?n.labels[t]:t;return i}(d),m=[],f=function(e){var t,i=[],a=e,r=!0,o=0;for(;r;)t=y(a),i[o++]=t.key,(r=t.children)&&(a=t.children);return i}(p),g=C(f,d);function v(t,i,a,r){for(var o=0;o<i;){var n=e(".dwwl"+o,t),s=A(r,o,a);e.each(s,function(t,i){e('.dw-li[data-val="'+i+'"]',n).removeClass("dw-v")}),o++}}function A(e,t,i){for(var a,r=0,o=i,n=[];r<t;){var s=e[r];for(a in o)if(o[a].key==s){o=o[a].children;break}r++}for(r=0;r<o.length;)o[r].invalid&&n.push(o[r].key),r++;return n}function C(e,t,i){var a,r,o,n=0,s=[],l=p;if(t)for(a=0;a<t;a++)s[a]=[{}];for(;n<e.length;){for(s[n]=[b(l,h[n])],a=0,o=void 0;a<l.length&&void 0===o;)l[a].key==e[n]&&(void 0!==i&&n<=i||void 0===i)&&(o=a),a++;if(void 0!==o&&l[o].children)n++,l=l[o].children;else{if(!(r=y(l))||!r.children)return s;n++,l=r.children}}return s}function y(e,t){if(!e)return!1;for(var i,a=0;a<e.length;)if(!(i=e[a++]).invalid)return t?a-1:i;return!1}function b(e,t){for(var i={keys:[],values:[],label:t},a=0;a<e.length;)i.values.push(e[a].value),i.keys.push(e[a].key),a++;return i}function S(t,i){e(".dwc",t).css("display","").slice(i).hide()}function k(e,t){var i,a,r,o=[],n=p,s=0,l=!1;if(void 0!==e[s]&&s<=t)for(i=0,a=e[s],r=void 0;i<n.length&&void 0===r;)n[i].key!=e[s]||n[i].invalid||(r=i),i++;else a=n[r=y(n,!0)].key;for(l=void 0!==r&&n[r].children,o[s]=a;l;){if(n=n[r].children,l=!1,r=void 0,void 0!==e[++s]&&s<=t)for(i=0,a=e[s],r=void 0;i<n.length&&void 0===r;)n[i].key!=e[s]||n[i].invalid||(r=i),i++;else a=n[r=!1===(r=y(n,!0))?void 0:r].key;l=!(void 0===r||!y(n[r].children))&&n[r].children,o[s]=a}return{lvl:s+1,nVector:o}}return e("#"+l).remove(),n.showInput&&(a=e('<input type="text" id="'+l+'" value="" class="'+n.inputClass+'" readonly />').insertBefore(s),t.settings.anchor=a,n.showOnFocus&&a.focus(function(){t.show()}),n.showOnTap&&t.tap(a,function(){t.show()})),n.wheelArray||s.hide().closest(".ui-field-contain").trigger("create"),{width:50,wheels:g,headerText:!1,onBeforeShow:function(e){var i=t.temp;m=i.slice(0),t.settings.wheels=C(i,d,d),r=!0},onSelect:function(e,t){a&&a.val(e)},onChange:function(e,t){a&&"inline"==n.display&&a.val(e)},onClose:function(){a&&a.blur()},onShow:function(t){e(".dwwl",t).on("mousedown touchstart",function(){clearTimeout(u[e(".dwwl",t).index(this)])})},validate:function(e,i,a){var o=t.temp;if(void 0!==i&&m[i]!=o[i]||void 0===i&&!r){t.settings.wheels=C(o,null,i);var n=[],s=(i||0)+1,l=k(o,i);for(void 0!==i&&(t.temp=l.nVector.slice(0));s<l.lvl;)n.push(s++);if(S(e,l.lvl),m=t.temp.slice(0),n.length)return r=!0,t.settings.readonly=function(e,t){for(var i=[];e;)i[--e]=!0;return i[t]=!1,i}(d,i),clearTimeout(u[i]),u[i]=setTimeout(function(){t.changeWheel(n),t.settings.readonly=!1},1e3*a),!1;v(e,l.lvl,p,t.temp)}else{v(e,(l=k(o,o.length)).lvl,p,o),S(e,l.lvl)}r=!1}}};e.each(["list","image","treelist"],function(e,i){t.presets[i]=a,t.presetShort(i)})}(jQuery),function(e){var t={inputClass:"",invalid:[],rtl:!1,group:!1,groupLabel:"Groups"};e.mobiscroll.presetShort("select"),e.mobiscroll.presets.select=function(i){var a,r,o,n,s,l=e.extend({},i.settings),d=e.extend(i.settings,t,l),c=e(this),u=c.prop("multiple"),p=this.id+"_dummy",h=u?c.val()?c.val()[0]:e("option",c).attr("value"):c.val(),m=c.find('option[value="'+h+'"]').parent(),f=m.index()+"",g=f,v=(e('label[for="'+this.id+'"]').attr("for",p),e('label[for="'+p+'"]')),A=void 0!==d.label?d.label:v.length?v.text():c.attr("name"),C=[],y=[],b={},S=d.readonly;function k(){var t,i=0,a=[],r=[],o=[[]];return d.group?(d.rtl&&(i=1),e("optgroup",c).each(function(t){a.push(e(this).attr("label")),r.push(t)}),o[i]=[{values:a,keys:r,label:d.groupLabel}],t=m,i+=d.rtl?-1:1):t=c,a=[],r=[],e("option",t).each(function(){var t=e(this).attr("value");a.push(e(this).text()),r.push(t),e(this).prop("disabled")&&C.push(t)}),o[i]=[{values:a,keys:r,label:A}],o}function D(e,t){var r=[];if(u){var n=[],l=0;for(l in i._selectedValues)n.push(b[l]),r.push(l);s.val(n.join(", "))}else s.val(e),r=t?i.values[o]:null;t&&(a=!0,c.val(r).trigger("change"))}function _(e){if(u&&e.hasClass("dw-v")&&e.closest(".dw").find(".dw-ul").index(e.closest(".dw-ul"))==o){var t=e.attr("data-val");return e.hasClass("dw-msel")?(e.removeClass("dw-msel").removeAttr("aria-selected"),delete i._selectedValues[t]):(e.addClass("dw-msel").attr("aria-selected","true"),i._selectedValues[t]=t),"inline"==d.display&&D(t,!0),!1}}d.group&&!e("optgroup",c).length&&(d.group=!1),d.invalid.length||(d.invalid=C),d.group?d.rtl?(r=1,o=0):(r=0,o=1):(r=-1,o=0),e("#"+p).remove(),s=e('<input type="text" id="'+p+'" class="'+d.inputClass+'" readonly />').insertBefore(c),e("option",c).each(function(){b[e(this).attr("value")]=e(this).text()}),d.showOnFocus&&s.focus(function(){i.show()}),d.showOnTap&&i.tap(s,function(){i.show()});for(var I=c.val()||[],w=0;w<I.length;w++)i._selectedValues[I[w]]=I[w];return D(b[h]),c.off(".dwsel").on("change.dwsel",function(){a||i.setValue(u?c.val()||[]:[c.val()],!0),a=!1}).hide().closest(".ui-field-contain").trigger("create"),i._setValue||(i._setValue=i.setValue),i.setValue=function(t,a,r,n,s){var l,p=e.isArray(t)?t[0]:t;if(h=void 0!==p?p:e("option",c).attr("value"),u){i._selectedValues={};for(var v=0;v<t.length;v++)i._selectedValues[t[v]]=t[v]}if(d.group?(m=c.find('option[value="'+h+'"]').parent(),g=m.index(),l=d.rtl?[h,m.index()]:[m.index(),h],g!==f&&(d.wheels=k(),i.changeWheel([o]),f=g+"")):l=[h],i._setValue(l,a,r,n,s),a){var A=!!u||h!==c.val();D(b[h],A)}},i.getValue=function(e){return(e?i.temp:i.values)[o]},{width:50,wheels:void 0,headerText:!1,multiple:u,anchor:s,formatResult:function(e){return b[e[o]]},parseValue:function(){var t=c.val()||[],a=0;if(u)for(i._selectedValues={};a<t.length;a++)i._selectedValues[t[a]]=t[a];return h=u?c.val()?c.val()[0]:e("option",c).attr("value"):c.val(),m=c.find('option[value="'+h+'"]').parent(),g=m.index(),f=g+"",d.group&&d.rtl?[h,g]:d.group?[g,h]:[h]},validate:function(t,a,s){if(void 0===a&&u){var l=i._selectedValues,p=0;for(p in e(".dwwl"+o+" .dw-li",t).removeClass("dw-msel").removeAttr("aria-selected"),l)e(".dwwl"+o+' .dw-li[data-val="'+l[p]+'"]',t).addClass("dw-msel").attr("aria-selected","true")}if(a===r)if((g=i.temp[r])!==f){if(m=c.find("optgroup").eq(g),g=m.index(),h=(h=m.find("option").eq(0).val())||c.val(),d.wheels=k(),d.group)return i.temp=d.rtl?[h,g]:[g,h],d.readonly=[d.rtl,!d.rtl],clearTimeout(n),n=setTimeout(function(){i.changeWheel([o]),d.readonly=S,f=g+""},1e3*s),!1}else d.readonly=S;else h=i.temp[o];var v=e(".dw-ul",t).eq(o);e.each(d.invalid,function(t,i){e('.dw-li[data-val="'+i+'"]',v).removeClass("dw-v")})},onBeforeShow:function(e){d.wheels=k(),d.group&&(i.temp=d.rtl?[h,m.index()]:[m.index(),h])},onMarkupReady:function(t){var a;if(e(".dwwl"+r,t).on("mousedown touchstart",function(){clearTimeout(n)}),u)for(a in t.addClass("dwms"),e(".dwwl",t).eq(o).addClass("dwwms").attr("aria-multiselectable","true"),e(".dwwl",t).on("keydown",function(t){32==t.keyCode&&(t.preventDefault(),t.stopPropagation(),_(e(".dw-sel",this)))}),y={},i._selectedValues)y[a]=i._selectedValues[a]},onValueTap:_,onSelect:function(e){D(e,!0),d.group&&(i.values=null)},onCancel:function(){var e;if(d.group&&(i.values=null),u)for(e in i._selectedValues={},y)i._selectedValues[e]=y[e]},onChange:function(e){"inline"!=d.display||u||(s.val(e),a=!0,c.val(i.temp[o]).trigger("change"))},onClose:function(){s.blur()}}}}(jQuery);var BusinessLocationImage="",ApiURLEnumWaitlist=(ProximityCookieName="proximitystate_v3",ApiPath="websiteapi/homepage/",{LoadUserControl:"loadusercontrol",savewaitlist:"savewaitlist",GetWaitListDetails:(MyAccountApiPath="myaccountapi/homepage/")+"getwaitlistdetails",GetAvailableDatesWaitlist:MyAccountApiPath+"getavailabledateswaitlist",UpdateWaitlist:MyAccountApiPath+"updatewaitlist"});_vgWaitlist={TimeSlot:{Anytime:1,Morning:2,Afternoon:3,Evening:4},TimeSlotStr:{Anytime:"Anytime",Morning:"Morning",Afternoon:"Afternoon",Evening:"Evening"},UnderMaintanance:{UnderMaintananceInProgress:"-9",UnderMaintananceComplete:"-10"},localData:{BusinessID:0,WaitlistID:0,GroupId:"",UserID:0,Comment:"",LoginUserID:0,SelectedServices:"",isOutCallService:!1,BusinessPackageID:"",IsWaitlistMultiService:!1,isServicePerformAtSameTime:!1,MasterSPServiceDetail:[],MasterSPServiceDetailSave:[],SelectedServiceProviderList:[],SelectedDates:[],ServiceProviderWorkingHours:[],SelectedServiceProviderWorkingHours:[],ThankYouResponse:[],IsOnline:!0,TimeSlot:{Anytime:1,Morning:2,Afternoon:3,Evening:4},TimeSlotStr:{Anytime:"Anytime",Morning:"Morning",Afternoon:"Afternoon",Evening:"Evening"},EventType:{ServiceBundle:0,Service:1,Class:2},TypeService:{Single:1,Multiple:2,Any:3},IsRemove:0,IsOnChangeSP:0,DatePickerSectedDate:"",EditResponse:null,txtAnyProvider:"Any Provider",DateFormateForMoment:"MMM D, YYYY",DateFormateFor_MomentNew:"dddd, MMMM D, YYYY",TimeFormat:"hh:nn a/p",objWaitlistData:[],objReturnval:new Array,indexOfPicker:1,minDateForOffline:"",maxDateForOffline:"",waitlistSelectedDate:"",objWaitlistDataForMobile:[],isCalledForMobileDateChanged:!1,SelectTimeText:"Select Time",UnderMaintananceMessage:"Business is Under Maintenance. This won't take long",lstfamilyfriendmembers:{},CurrentEditId:"",FromMyAccount:!1},model:{divWaitlistpopup:"divWaitlistpopup",cboServiceProviderWaitlist:"cboServiceProviderWaitlist",txtWaitlistDate:"txtWaitlistDate",divWaitlistDate:"divWaitlistDate",WaitlistTimesInputCheck:"WaitlistTimesInputCheck",chkAnytime:"chkAnytime",chkMorning:"chkMorning",chkAfternoon:"chkAfternoon",chkEvening:"chkEvening",divSPWaitlist:"divSPWaitlist",divBundleWaitlist:"divBundleWaitlist",lblSPWaitlist:"lblSPWaitlist",lblBundleNameWaitlist:"lblBundleNameWaitlist",divServiceNameWaitlist:"divServiceNameWaitlist",divSP1Waitlist:"divSP1Waitlist",selectedcurrentClassDiv:"select-cross-position",newdatepicker:"newdatepicker",newdivSearchDate:"NewdivSearchDate",txtdivSearchTime:"txtdivSearchTime"},initOffline:function(e){this.localData.IsOnline=e},ShowWaitlistPopup:function(){if(UserID<=0)return showCommonLoginPopup("BookWaitlistAppointment"),!1;if($("body").addClass("show-passive-alert-popup"),$("html").addClass("waitlistpopupHidden"),$("#AddWaitlistDateTime").removeClass("btn-margin-left"),_vgWaitlist.localData.BusinessID=$("#hdnBusinessID").val(),_vgWaitlist.ShowLoaderWaitlist(!0),_vgWaitlist.ClearData(),"undefined"!=typeof groupID&&(_vgWaitlist.localData.GroupId=groupID),_vgWaitlist.BindServiceProvider(),_vgWaitlist.GetSelectedData(),_vgWaitlist.BindFamilyFriendList(),_vgWaitlist.localData.WaitlistID=0,_vgWaitlist.ResetWaitlistDatetimeControl(!1),"undefined"!=typeof _common&&void 0!==_common.isCreateLinkPreserve&&_common.isCreateLinkPreserve(!0)&&(lSPID=_common.isCreateLinkPreserve(!1),"-1"!=lSPID[0]))try{"undefined"!=typeof lSPID&&null!=lSPID&&""!=lSPID&&($("#cboServiceProviderWaitlist1").val(lSPID).trigger("change"),$("#cboServiceProviderWaitlist1").attr("disabled","disabled"))}catch(e){$("#cboServiceProviderWaitlist1").val("").trigger("change"),$("#cboServiceProviderWaitlist1").removeAttr("disabled")}if("undefined"!=typeof _common&&void 0!==_common.IsWidgetForServiceProvider&&_common.IsWidgetForServiceProvider(!0)){var e=_common.IsWidgetForServiceProvider(!1);$("#cboServiceProviderWaitlist1").val(e).trigger("change"),$("#cboServiceProviderWaitlist1").prop("disabled",!0)}},ShowHideWaitlistPopup:function(e){1==e?($(".Waitlistpopupbody").scrollTop(0),setTimeout(function(){$("#"+this.model.divWaitlistpopup).modal("show")},1e3),$("body").addClass("widgetpopupOpen")):($(".select2-container").removeClass("waitlist-dropdownList"),$("body").removeClass("show-passive-alert-popup"),$("html").removeClass("waitlistpopupHidden"),$("#"+this.model.divWaitlistpopup).modal("hide"),$("body").removeClass("widgetpopupOpen"))},BindServiceProvider:function(){for(var e=void 0!==$("#hdnServiceLimit").val()&&""!=$("#hdnServiceLimit").val()&&null!=$("#hdnServiceLimit").val()?$("#hdnServiceLimit").val():3,t=1;t<=e;t++){var i=$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+t);void 0!==i.data("select2")&&i.pumselect2("destroy"),i.pumselect2({placeholder:"Service Provider",closeOnSelect:!1,templateResult:function(e){return e.id?$('<span class="multicheck-checkbox"></span><label class="labelpadd">'+e.text+"</label>"):e.text}}).on("select2:open",function(e){$("span.select2-container.select2-container--default.select2-container--open").addClass("waitlist-dropdownList vagaro-dropdown-multiselect"),1==_vgWaitlist.localData.SelectedServices.length&&1==$("#"+_vgWaitlist.model.divSP1Waitlist).hasClass("WaitListServiceFullWidth")&&$("span.select2-container.select2-container--default.select2-container--open").addClass("waitlist-dropdownList vagaro-dropdown-multiselect dropdown-full-width")}),$("#"+this.model.cboServiceProviderWaitlist+t).empty()}},BindFamilyFriendList:function(){try{var e=_vgWaitlist.localData.lstfamilyfriendmembers;if(void 0!==e&&null!=e&&e.length>0)$(".familycktfrnd ul").empty(),$("#familycktfrndlistTemplate").tmpl(e).appendTo(".familycktfrndlist");else{var t=new vagaro.ajax;t.datamodel.Token="GetListofFamilyFriendtoBook",t.datamodel.data=[{UserID:UserID}],t.datamodel.callback=function(e){var t=1;$.each(e,function(e,i){i.Index=t,t++}),_vgWaitlist.localData.lstfamilyfriendmembers=e,$(".familycktfrnd ul").empty(),$("#familycktfrndlistTemplate").tmpl(e).appendTo(".familycktfrndlist")},t.datamodel.Error=_vgWaitlist.CallFailed,t.Post()}}catch(e){}},GetSelectedData:function(){_vgWaitlist.localData.SelectedServices=[],_vgWaitlist.localData.SelectedServicesDetails=[],_vgWaitlist.localData.MasterSPServiceDetail=[];for(var e=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,t=0,i=1;i<=e;i++){var a=$("#txtService"+i).data("choice");if(""!=a)try{var r=JSON.parse(a);if(!r.hasOwnProperty("id")||""==r.id)return _vgWaitlist.ShowWarningMessage("Please select a service first."),void _vgWaitlist.ShowLoaderWaitlist(!1);if(1==i&&r.eventType==arrEventType.ServiceBundle){_vgWaitlist.localData.BusinessPackageID=r.id,_vgWaitlist.localData.isServicePerformAtSameTime=2==r.lstServiceBundleDetail[0].isServicePerformAtSameTime,$("#"+_vgWaitlist.model.lblBundleNameWaitlist).text(r.text);continue}1==_vgWaitlist.BindSPDropdown(i,t+1,r)&&(t+=1)}catch(e){}}var o=""!=_vgWaitlist.localData.BusinessPackageID?e-1:e;t>0&&""==_vgWaitlist.localData.BusinessPackageID||""!=_vgWaitlist.localData.BusinessPackageID&&o==t?($("#"+_vgWaitlist.model.divBundleWaitlist).hide(),""!=_vgWaitlist.localData.BusinessPackageID&&$("#"+_vgWaitlist.model.divBundleWaitlist).show(),1==t&&o==t?($("#"+_vgWaitlist.model.lblSPWaitlist+"1").text("Select Professional:"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).removeClass("WaitlistDisc"),$("#"+_vgWaitlist.model.divSP1Waitlist).removeClass("WaitListServiceFull"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).addClass("WaitlistDiscfullwidth"),$(".newaddwaitlistdatepicker").removeClass("multiNewadddatepicker"),$("#"+_vgWaitlist.model.divSP1Waitlist).addClass("WaitListServicehalfWidth"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&($("#divwaitlistServiceTitle").show(),$("#divwaitlistServiceTitle").html(r.text))):(t>1||o!=t)&&($("#"+_vgWaitlist.model.divServiceNameWaitlist).removeClass("WaitlistDiscfullwidth"),$("#"+_vgWaitlist.model.divSP1Waitlist).removeClass("WaitListServicehalfWidth "),$("#"+_vgWaitlist.model.divServiceNameWaitlist).addClass("WaitlistDisc"),$("#"+_vgWaitlist.model.divSP1Waitlist).addClass("WaitListServiceFull"),$(".newaddwaitlistdatepicker").addClass("multiNewadddatepicker"),$("#divwaitlistServiceTitle").hide(),$("#divwaitlistServiceTitle").html("")),_vgWaitlist.GetAvailableDates(null)):_vgWaitlist.ShowErrorMessage()},ShowErrorMessage:function(){_vgWaitlist.ShowWarningMessage("There is a no provider providing this service"),_vgWaitlist.ShowLoaderWaitlist(!1)},BindSPDropdown:function(e,t,i){var a=$("#txtSP"+e).data("select2");if(void 0!==a){var r=a.opts.data().results;if(r.length>0&&(r=r.slice(1)),r.length>0){if(_vgWaitlist.localData.SelectedServices.push(i.id),"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee){var o={};o.ServiceId=i.id,o.ServiceName=i.text,o.Photo=i.photo,_vgWaitlist.localData.SelectedServicesDetails.push(o)}_vgWaitlist.localData.isOutCallService=i.isOutCallService,$("#"+_vgWaitlist.model.divSPWaitlist+t).show(),$("#"+_vgWaitlist.model.lblSPWaitlist+t).text(i.text);var n=$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+t),s=$.extend(!0,[],r),l="#txtService"+e,d=$(l).data("choice"),c=$(l).data("addon");if(""!=d)try{var u=JSON.parse(d),p=null!=c?JSON.parse(c):[];u.hasOwnProperty("id")&&""!=u.id&&(filterData=_shopdetail.FilterSPMulti(s,u,p))}catch(e){filterData=r}$.grep(filterData,function(e){var t={};t.ServiceId=i.id,t.SPIds=e.id,t.SPName=e.text,t.Servicename=i.text,_vgWaitlist.localData.MasterSPServiceDetail.push(t),0==e.isServiceProvide?n.append($("<option disabled></option>").val(e.id).html(e.text)):n.append($("<option></option>").val(e.id).html(e.text))}),n.data("isSkipChangeEvent",!0);var h=$("#txtSP"+e).data("choice");if(""!=h)try{var m=JSON.parse(h);m.hasOwnProperty("id")&&""!=m.id?n.val(m.id).trigger("change"):n.val("").trigger("change")}catch(e){n.val("").trigger("change")}else n.val("").trigger("change");return!0}}return!1},GetGroupId:function(){return void 0!==_vgWaitlist.localData.GroupId&&null!=_vgWaitlist.localData.GroupId?_vgWaitlist.localData.GroupId:""},GetAvailableDates:function(e,t){if(null!=e){var i;if(void 0!==(i=void 0!==$(e).context?$("#"+$(e).context.id):$("#"+$(e).attr("id"))).data("isSkipChangeEvent")&&1==i.data("isSkipChangeEvent"))return void i.data("isSkipChangeEvent",!1);_vgWaitlist.ReSetControls()}var a=_vgWaitlist.GetServiceProviders(!0);if(""==a)destroydatepicker({divid:"#"+_vgWaitlist.model.newdivSearchDate+_vgWaitlist.localData.indexOfPicker,textid:"#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:[""],isApplyInWidget:!0,isMobileFriendly:!1}),$("#WaitlistTimeDate").hide(),_vgWaitlist.ReSetControls(),_vgWaitlist.ShowErrorMessage();else{"-1"==a&&(a="");var r={},o=new vagaro.ajax;r.businessID=_vgWaitlist.localData.BusinessID,r.spID=a,o.datamodel.Token=ApiURLEnumWaitlist.GetAvailableDatesWaitlist,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.data=r,o.datamodel.callback=1==t?_vgWaitlist.AvailableDates_CallSuccessForEdit:_vgWaitlist.AvailableDates_CallSuccess,o.datamodel.Error=_vgWaitlist.CallFailed,o.datamodel.GroupToken=_vgWaitlist.GetGroupId(),o.Post()}},AvailableDates_CallSuccess:function(e){if(_vgWaitlist.ShowLoaderWaitlist(!1),null!=e&&e.length>0&&""!=e[0]&&_vgWaitlist.localData.MasterSPServiceDetail.length>0){if($("#"+_vgWaitlist.model.divWaitlistpopup).modal("show"),prepaidEnscroll_waitlist(),void 0!==_shopdetail&&void 0!==_shopdetail.lastAppBookingDate){var t,i;new Date(moment(e[0])._d),(t=new Date(moment(e[e.length-1])._d)).setDate(t.getDate()+1),i=new Date(t),i=_shopdetail.getSunday(i),i=new Date(i.setDate(i.getDate()+6));for(var a=t;a<=i;a.setDate(a.getDate()+1))e.push(a.format("MMM dd,yyyy"))}if(_vgWaitlist.localData.objReturnval=e,1==_vgWaitlist.localData.objWaitlistData.length&&_vgWaitlist.DestroyApplyDateTimePicker(_vgWaitlist.localData.indexOfPicker,_vgWaitlist.localData.objReturnval),$("#txtdivSearchDate").length>0){var r=getdatepickervalue("#txtdivSearchDate",null,!0,!0);null!=r&&(-1==e.indexOf(r.format("MMM dd,yyyy"))&&(r=new Date(moment(e[0])._d)),setdatepickervalue({divid:"#"+_vgWaitlist.model.newdivSearchDate+_vgWaitlist.localData.indexOfPicker,textid:"#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(r)),_vgWaitlist.localData.waitlistSelectedDate=r,_vgWaitlist.localData.objWaitlistData[0].DateW=moment(r).format(_vgWaitlist.localData.DateFormateForMoment))}_vgWaitlist.GetServiceProviderWorkingHours(void 0,_vgWaitlist.localData.indexOfPicker),void 0!==setPopupPosi&&void 0!==getQueryStringData&&"Builder"==getQueryStringData("Type")&&setPopupPosi($("#"+_vgWaitlist.model.divWaitlistpopup))}else{destroydatepicker({divid:"#"+_vgWaitlist.model.newdivSearchDate+_vgWaitlist.localData.indexOfPicker,textid:"#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:[""],isApplyInWidget:!0,isMobileFriendly:!1,onGenerate:_vgWaitlist.onGenerateNew});var o=$("#"+_vgWaitlist.model.divWaitlistpopup);0==o.is(":visible")&&0==o.hasClass("in")&&_vgWaitlist.ShowErrorMessage()}},AvailableDates_CallSuccessForEdit:function(e){null!=e&&e.length>0&&""!=e[0]&&_vgWaitlist.localData.MasterSPServiceDetail.length>0?($("#dvwaitlistPopupHeader").text("Edit Waitlist"),$("#btnAddWaitlistOnline").text("Edit Waitlist"),$(".Waitlistpopupbody").scrollTop(0),$("#"+_vgWaitlist.model.divWaitlistpopup).modal("show"),void 0!==setPopupPosi&&"undefined"!=typeof WebsiteBuilderType&&"Builder"==WebsiteBuilderType&&setPopupPosi($("#"+_vgWaitlist.model.divWaitlistpopup)),_vgWaitlist.localData.objReturnval=e,_vgWaitlist.ShowLoaderWaitlist(!1),$.grep(_vgWaitlist.localData.SelectedServiceProviderWorkingHours,function(t){$.grep(e,function(e){if(moment(t.dtWaitlistDate).format("MMM DD,YYYY")==e){var i=$.extend(!0,{},t);t.arrIntervals=[];var a={};a.TimeW=i.TimeW,a.DateW=i.DateW,a.copyobjSelectedServiceProviderWorkingHours=i,_vgWaitlist.localData.objWaitlistData.push(a)}})}),5==_vgWaitlist.localData.objWaitlistData.length&&$("#WaitlistTimeDate").hide(),_vgWaitlist.ResetWaitlistDatetimeControl(!0)):(destroydatepicker({divid:"#"+_vgWaitlist.model.newdivSearchDate+_vgWaitlist.localData.indexOfPicker,textid:"#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:[""],isApplyInWidget:!0,isMobileFriendly:!1,onGenerate:_vgWaitlist.onGenerateNew}),_vgWaitlist.ShowErrorMessage())},CallFailed:function(e){_vgWaitlist.ShowLoaderWaitlist(!1)},ShowLoaderWaitlist:function(e){1==_vgWaitlist.localData.IsOnline?ShowLoader(e):_vgCal.Common.ShowLoader(e)},GetServiceProviderWorkingHours:function(e,t){if(_vgWaitlist.localData.indexOfPicker=t,void 0!==e&&$.grep(_vgWaitlist.localData.objWaitlistData,function(t){return t.DateW!=moment(e).format(_vgWaitlist.localData.DateFormateForMoment)}).length>5)return _vgWaitlist.ShowWarningMessage("Please add only 5 dates for waitlist"),$("#selectWaitlist"+_vgWaitlist.localData.indexOfPicker).find("input[type=checkbox]:checkbox").prop("checked",!1),$("#selectWaitlist"+_vgWaitlist.localData.indexOfPicker).find("input[type=checkbox]:checkbox").attr("disabled",!0),!1;if(1==_vgWaitlist.localData.IsOnline&&void 0!==e)for(var i=_shopdetail.VisibleControlLength(".divSPWaitlist"),a=1;a<=i;a++)$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+a).select2("close");_vgWaitlist.ShowLoaderWaitlist(!0);var r=$("#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker),o=$.grep(_vgWaitlist.localData.SelectedServiceProviderWorkingHours,function(e){return e.SelectedDate==moment(r.val()).format("MMM-DD-YYYY")});if(o.length>0)_vgWaitlist.EnableIntervalNew(o[0],_vgWaitlist.localData.indexOfPicker),_vgWaitlist.ShowLoaderWaitlist(!1);else if(1==_vgWaitlist.localData.IsOnline){"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee&&(i=_shopdetail.VisibleControlLength(".divSPWaitlist"),$("#lblSPWaitlist1").show(),void 0===_vgWaitlist.localData.BusinessPackageID||"0"==_vgWaitlist.localData.BusinessPackageID||""==_vgWaitlist.localData.BusinessPackageID?(1==i&&($("#lblSPWaitlist1").hide(),$("#divSP1Waitlist").hide()),$(".WaitListServiceFull").hide()):$(".WaitListServiceFull").hide());var n=_vgWaitlist.GetServiceProviders(!1),s={};s.BusinessID=_vgWaitlist.localData.BusinessID,s.ServiceProviderID=n,s.strSelectedDate=r.val(),s.loginUserID=UserID;var l=new vagaro.ajax;l.datamodel.Token="GetServiceProviderWorkingHours",l.datamodel.data=[s],l.datamodel.callback=_vgWaitlist.SuccessServiceProviderWorkingHours,l.datamodel.Error=_vgWaitlist.CallFailed,l.datamodel.GroupToken=_vgWaitlist.GetGroupId(),l.Post()}else 0==_vgWaitlist.localData.IsOnline&&null!=(r=getdatepickervalue("#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker,!1,!1,!1))&&_vgWaitlist.SetWorkingHoursOffline(r)},SetWorkingHoursOffline:function(e){var t={Morning:!0,AfterNoon:!0,Evening:!0,IsSelected:!1};t.Day=e.getDate(),t.Month=e.getMonth(),t.Year=e.getFullYear(),t.SelectedDate=moment(e).format("MMM-DD-YYYY"),t.dtWaitlistDate=new Date(e),t.arrIntervals=[],_vgWaitlist.localData.SelectedServiceProviderWorkingHours.push(t),_vgWaitlist.EnableIntervalNew(t,_vgWaitlist.localData.indexOfPicker),_vgWaitlist.ShowLoaderWaitlist(!1)},SuccessServiceProviderWorkingHours:function(e){if(null!=e){var t={};(t=$.extend(!0,{},e)).arrIntervals=[],_vgWaitlist.localData.SelectedServiceProviderWorkingHours.push(t),_vgWaitlist.EnableIntervalNew(t,_vgWaitlist.localData.indexOfPicker),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&1==_vgWaitlist.localData.isCalledForMobileDateChanged&&(_vgWaitlist.localData.isCalledForMobileDateChanged=!1,_vgWaitlist.BindIntervalNewForMobile(_vgWaitlist.localData.indexOfPicker))}_vgWaitlist.ShowLoaderWaitlist(!1)},EnableInterval:function(e){$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").attr("disabled",!0),1==e.Morning&&1==e.AfterNoon&&1==e.Evening?$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").attr("disabled",!1):(1==e.Morning&&$("#"+_vgWaitlist.model.chkMorning).attr("disabled",!1),1==e.AfterNoon&&$("#"+_vgWaitlist.model.chkAfternoon).attr("disabled",!1),1==e.Evening&&$("#"+_vgWaitlist.model.chkEvening).attr("disabled",!1)),$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").prop("checked",!1)},EnableIntervalNew:function(e,t){$("#selectWaitlist"+t).find("input[type=checkbox]").attr("disabled",!0),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#selectWaitlist"+t).find("li").addClass("rescheck-disable"),1==e.Morning&&1==e.AfterNoon&&1==e.Evening?($("#selectWaitlist"+t).find("input[type=checkbox]").attr("disabled",!1),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#selectWaitlist"+t).find("li").removeClass("rescheck-disable")):(1==e.Morning&&($("#CheckMorning"+t).attr("disabled",!1),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#CheckMorning"+t).parents("li").removeClass("rescheck-disable")),1==e.AfterNoon&&($("#CheckAfternoon"+t).attr("disabled",!1),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#CheckAfternoon"+t).parents("li").removeClass("rescheck-disable")),1==e.Evening&&($("#CheckEvening"+t).attr("disabled",!1),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&$("#CheckEvening"+t).parents("li").removeClass("rescheck-disable"))),$("#selectWaitlist"+t).find("input[type=checkbox]:checked").prop("checked",!1)},GetInterval:function(e){return e<12?_vgWaitlist.TimeSlot.Morning:e>=12&&e<17?_vgWaitlist.TimeSlot.Afternoon:e>=17?_vgWaitlist.TimeSlot.Evening:void 0},DispalySelecedDates:function(e){0==$.grep(_vgWaitlist.localData.SelectedDates,function(t){return null!=e&&t.SelectedDate==e.SelectedDate&&t.arrIntervals.length>0?(t.IsSelected=!0,!0):(t.IsSelected=!1,!1)}).length&&null!=e&&($("#"+_vgWaitlist.model.txtWaitlistDate+'_picker .xdsoft_calendar td[data-date="'+e.Day+'"][data-month="'+e.Month+'"][data-year="'+e.Year+'"]').addClass("xdsoft_current"),$("#"+_vgWaitlist.model.txtWaitlistDate).data("SelectedByUser",!0))},SelectTimeSlots:function(e){var t=$("#"+_vgWaitlist.model.txtWaitlistDate),i=$("#"+_vgWaitlist.model.txtWaitlistDate+"_picker .xdsoft_calendar td.xdsoft_current.select-cross");if(i.length>0){var a=$(i[0]),r=new Date(a.data("year"),a.data("month"),a.data("date"));moment(r).format("MMM-DD-YYYY")!=t.val()&&setdatepickervalue({divid:"#"+_vgWaitlist.model.divWaitlistDate,textid:"#"+_vgWaitlist.model.txtWaitlistDate},r)}var o=-1,n=$.grep(_vgWaitlist.localData.SelectedDates,function(i,a){return i.SelectedDate==t.val()?(_vgWaitlist.SetInterval(i,parseInt($(e).val())),0==i.arrIntervals.length&&(o=a),!0):(i.IsSelected=!1,!1)});o>-1&&_vgWaitlist.localData.SelectedDates.splice(o,1),0==n.length&&$.grep(_vgWaitlist.localData.SelectedServiceProviderWorkingHours,function(i){if(i.SelectedDate==t.val()){var a=$.extend(!0,{},i);_vgWaitlist.SetInterval(a,parseInt($(e).val())),_vgWaitlist.localData.SelectedDates.push(a)}})},SetInterval:function(e,t){if(null!=t){var i=$("."+_vgWaitlist.model.WaitlistTimesInputCheck+' :checkbox[value="'+t+'"]');if(i.length>0&&1==i.is(":checked")){if(t!=_vgWaitlist.TimeSlot.Anytime&&-1==$.inArray(t,e.arrIntervals)){var a=$.inArray(_vgWaitlist.TimeSlot.Anytime,e.arrIntervals);a>-1&&e.arrIntervals.splice(a,1),e.arrIntervals.push(t),e.arrIntervals.sort()}else t==_vgWaitlist.TimeSlot.Anytime&&(e.arrIntervals=[],e.arrIntervals.push(_vgWaitlist.TimeSlot.Anytime));t!=_vgWaitlist.TimeSlot.Anytime&&3==e.arrIntervals.length&&(e.arrIntervals=[],e.arrIntervals.push(_vgWaitlist.TimeSlot.Anytime))}else{var r=$.inArray(t,e.arrIntervals);r>-1&&e.arrIntervals.splice(r,1)}}_vgWaitlist.BindInterval(e.arrIntervals);var o="xdsoft_current",n="xdsoft_current select-cross",s=$("#"+_vgWaitlist.model.txtWaitlistDate+'_picker .xdsoft_calendar td[data-date="'+e.Day+'"][data-month="'+e.Month+'"][data-year="'+e.Year+'"]');if(e.arrIntervals.length>0){if(e.IsSelected=!0,s.length>0&&(s.removeClass(o).addClass(n),0==$(".selectdatesi").length)){var l=s.find("div");l.addClass(_vgWaitlist.model.selectedcurrentClassDiv),l.append("<span class ='selectdatesi' onclick='_vgWaitlist.RemoveDate(this);' ontouchstart='_vgWaitlist.RemoveDate(this);' >&#xf00d;</span>")}}else e.IsSelected=!1,$(".selectdatesi").remove(),s.length>0&&s.removeClass(n).addClass(o)},BindInterval:function(e){$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").prop("checked",!1),$.grep(e,function(e){$("."+_vgWaitlist.model.WaitlistTimesInputCheck+' :checkbox[value="'+e+'"]').prop("checked",!0)})},BindIntervalNew:function(e,t){$("#selectWaitlist"+parseInt(t)).find("input[type=checkbox]:checked").removeAttr("checked");var i=e.split(",");$.each(i,function(e,i){$("#selectWaitlist"+parseInt(t)+' :checkbox[value="'+i+'"]').prop("checked",!0)})},BindIntervalNewForMobile:function(e){$(".rescheckbox-part").removeClass("info"),$("#divMobileTimeSlot").show(),$("#divWaitlistpopup").css("top","0px"),$("#divMainWaitlist").hide(),$("#btnAddWaitlistOnline").hide(),$("#saveAvailabilitybtn").show(),$("#divMainWaitlistLabel").hide(),$("#divSaveTimeSlotLabel").show(),$("#btnCancelWaitlist").hide(),$("#selectDate1").val($("#newdatepicker"+e).val()),_vgWaitlist.localData.objWaitlistDataForMobile=[];var t={};t.DateW=moment($("#selectDate1").val()).format(_vgWaitlist.localData.DateFormateForMoment);var i=[];$("#selectWaitlist"+e+" input:checked").each(function(){i.push($(this).val())}),t.TimeW=i.join(","),_vgWaitlist.localData.objWaitlistDataForMobile.push(t),1==_vgWaitlist.localData.objWaitlistData.length&&(_vgWaitlist.localData.objWaitlistData[0].DateW=t.DateW),$("#selectWaitlistMobile").find("input[type=checkbox]:checked").removeAttr("checked");var a=$.grep(_vgWaitlist.localData.SelectedServiceProviderWorkingHours,function(e){return e.SelectedDate==moment($("#selectDate1").val()).format("MMM-DD-YYYY")});a.length>0&&_vgWaitlist.EnableIntervalNew(a[0],"Mobile");var r=$("#selectWaitlist"+e).find("input[type=checkbox]:checked");$("#saveAvailabilitybtn").attr("onclick","_vgWaitlist.SaveAvailability("+e+");"),$("#selectWaitlistMobile").find("input[type=checkbox]").attr("onclick","_vgWaitlist.validateTimeForMobile('Mobile', this,"+e+");"),$.each(r,function(e,t){$('#selectWaitlistMobile :checkbox[value="'+t.value+'"]').prop("checked",!0).closest("li").addClass("info"),$('#selectWaitlistMobile :checkbox[value="'+t.value+'"]').prop("checked",!0).attr("aria-checked",!0)})},BackButtonMobileClick:function(){_vgWaitlist.ResetWaitlistDatetimeControl(!1),$("#divMobileTimeSlot").hide(),$("#divWaitlistpopup").css("top","50px"),$("#divMainWaitlist").show(),$("#btnAddWaitlistOnline").show(),$("#saveAvailabilitybtn").hide(),$("#divMainWaitlistLabel").show(),$("#divSaveTimeSlotLabel").hide(),$("#btnCancelWaitlist").show()},SaveAvailability:function(e){""!=_vgWaitlist.localData.objWaitlistDataForMobile[0].TimeW?(_vgWaitlist.localData.objWaitlistData[e-1].TimeW!=_vgWaitlist.localData.objWaitlistDataForMobile[0].TimeW&&(_vgWaitlist.localData.objWaitlistData[e-1].TimeW="",_vgWaitlist.localData.objWaitlistData[e-1].TimeW=_vgWaitlist.localData.objWaitlistDataForMobile[0].TimeW,1==_vgWaitlist.localData.objWaitlistDataForMobile.length&&(_vgWaitlist.localData.objWaitlistData[0].DateW=_vgWaitlist.localData.objWaitlistDataForMobile[0].DateW)),_vgWaitlist.BackButtonMobileClick()):_vgWaitlist.ShowWarningMessage("Please select time for waitlist.")},validateTimeForMobile:function(e,t,i){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker"+i).val()))return $(t).prop("checked",!1),!1;$(t).closest("li").addClass("info"),$(t).attr("aria-checked",!0);var a=$(t).next().find("span").html();1==$("#selectWaitlist"+e+" #CheckAnytime"+e).prop("checked")&&a==_vgWaitlist.TimeSlotStr.Anytime?($("#selectWaitlist"+e+" #CheckMorning"+e).prop("checked",!1).closest("li").removeClass("info"),$("#selectWaitlist"+e+" #CheckMorning"+e).attr("aria-checked",!1),$("#selectWaitlist"+e+" #CheckAfternoon"+e).prop("checked",!1).closest("li").removeClass("info"),$("#selectWaitlist"+e+" #CheckAfternoon"+e).attr("aria-checked",!1),$("#selectWaitlist"+e+" #CheckEvening"+e).prop("checked",!1).closest("li").removeClass("info"),$("#selectWaitlist"+e+" #CheckEvening"+e).attr("aria-checked",!1)):a!=_vgWaitlist.TimeSlotStr.Morning&&a!=_vgWaitlist.TimeSlotStr.Afternoon&&a!=_vgWaitlist.TimeSlotStr.Evening||1!=$("#selectWaitlist"+e+" #Check"+a+e).prop("checked")||($("#selectWaitlist"+e+" #CheckAnytime"+e).prop("checked",!1).closest("li").removeClass("info"),$("#selectWaitlist"+e+" #CheckAnytime"+e).attr("aria-checked",!1)),1==$("#selectWaitlist"+e+" #CheckMorning"+e).prop("checked")&&1==$("#selectWaitlist"+e+" #CheckAfternoon"+e).prop("checked")&&1==$("#selectWaitlist"+e+" #CheckEvening"+e).prop("checked")&&($("#selectWaitlist"+e).find("input[type=checkbox]").prop("checked",!1).closest("li").removeClass("info"),$("#selectWaitlist"+e).find("input[type=checkbox]").attr("aria-checked",!1),$("#selectWaitlist"+e+" #CheckAnytime"+e).prop("checked",!0).closest("li").addClass("info"),$("#selectWaitlist"+e+" #CheckAnytime"+e).attr("aria-checked",!0)),0==$(t).prop("checked")&&($(t).closest("li").removeClass("info"),$(t).attr("aria-checked",!1));var r=[],o=[];$("#txtdivSearchTime"+i).val(_vgWaitlist.localData.SelectTimeText),$("#selectWaitlist"+e+" input:checked").each(function(){$(this).val()==_vgWaitlist.TimeSlot.Anytime&&(r.push(_vgWaitlist.TimeSlotStr.Anytime),o.push(_vgWaitlist.TimeSlot.Anytime)),$(this).val()==_vgWaitlist.TimeSlot.Morning&&(r.push(_vgWaitlist.TimeSlotStr.Morning),o.push(_vgWaitlist.TimeSlot.Morning)),$(this).val()==_vgWaitlist.TimeSlot.Afternoon&&(r.push(_vgWaitlist.TimeSlotStr.Afternoon),o.push(_vgWaitlist.TimeSlot.Afternoon)),$(this).val()==_vgWaitlist.TimeSlot.Evening&&(r.push(_vgWaitlist.TimeSlotStr.Evening),o.push(_vgWaitlist.TimeSlot.Evening))}),r.length>0&&$("#txtdivSearchTime"+i).val(r.join(", ")),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?(_vgWaitlist.localData.objWaitlistDataForMobile[0].TimeW=o.join(","),1==_vgWaitlist.localData.objWaitlistDataForMobile.length&&(_vgWaitlist.localData.objWaitlistDataForMobile[0].DateW=moment($("#newdatepicker1").val()).format(_vgWaitlist.localData.DateFormateForMoment))):(_vgWaitlist.localData.objWaitlistData[i-1].TimeW=o.join(","),1==_vgWaitlist.localData.objWaitlistData.length&&(_vgWaitlist.localData.objWaitlistData[0].DateW=moment($("#newdatepicker1").val()).format(_vgWaitlist.localData.DateFormateForMoment)))},RemoveDate:function(e){var t=$(e).parents("td");if(t.length>0){var i=new Date(t.data("year"),t.data("month"),t.data("date")),a=$.grep(_vgWaitlist.localData.SelectedDates,function(e){return e.SelectedDate!=moment(i).format("MMM-DD-YYYY")});_vgWaitlist.localData.SelectedDates=a,t.removeClass("xdsoft_current select-cross"),e.remove(),$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").prop("checked",!1),$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").attr("disabled",!0)}},GetServiceProviders:function(e){for(var t="",i=[],a=[],r=_shopdetail.VisibleControlLength(".divSPWaitlist"),o=1;o<=r;o++)null!=$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+o).val()&&$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+o).val().length>0&&$.grep($("#"+_vgWaitlist.model.cboServiceProviderWaitlist+o).val(),function(e){var t={};t.SPIds=e,a.push(t)});if(0==a.length){var n=_vgWaitlist.localData.MasterSPServiceDetail.uniqueObjects(["SPIds"]);if(1==e&&0==a.length&&n.length>0)return"-1";a=n}else a=a.uniqueObjects(["SPIds"]);return $.grep(a,function(e){i.push(e.SPIds)}),i.length>0&&(t=i.join(",")),t},onGenerate:function(e,t){var i="xdsoft_current",a="xdsoft_current select-cross",r=!1,o=null,n=!1,s=$("#"+_vgWaitlist.model.txtWaitlistDate);$(".selectdatesi").remove();var l=$.grep(_vgWaitlist.localData.SelectedDates,function(t){var s=$("#"+_vgWaitlist.model.txtWaitlistDate+'_picker .xdsoft_calendar td[data-date="'+t.Day+'"][data-month="'+t.Month+'"][data-year="'+t.Year+'"]');return s.length>0&&(0==r&&(r=!0,o=t),1==t.IsSelected||null!=e&&0==n&&t.SelectedDate==moment(new Date(e)).format("MMM-DD-YYYY")?(null!=e&&0==n&&t.SelectedDate==moment(new Date(e)).format("MMM-DD-YYYY")&&(n=!0),s.find("div").addClass(_vgWaitlist.model.selectedcurrentClassDiv),s.removeClass(i).addClass(a).find("div").append("<span class ='selectdatesi' onclick='_vgWaitlist.RemoveDate(this);' ontouchstart='_vgWaitlist.RemoveDate(this);' >&#xf00d;</span>"),t.arrIntervals.length>0&&(_vgWaitlist.EnableInterval(t),_vgWaitlist.BindInterval(t.arrIntervals)),!0):(s.removeClass(a).addClass(i),!1))});if(1!=r||0!=n||0!=l.length||void 0!==s.data("SelectedByUser")&&0!=s.data("SelectedByUser")||(d=$("#"+_vgWaitlist.model.txtWaitlistDate+'_picker .xdsoft_calendar td[data-date="'+o.Day+'"][data-month="'+o.Month+'"][data-year="'+o.Year+'"]')).length>0&&(d.find("div").addClass(_vgWaitlist.model.selectedcurrentClassDiv),d.removeClass(i).addClass(a).find("div").append("<span class ='selectdatesi' onclick='_vgWaitlist.RemoveDate(this);' ontouchstart='_vgWaitlist.RemoveDate(this);' >&#xf00d;</span>"),o.arrIntervals.length>0&&(_vgWaitlist.EnableInterval(o),_vgWaitlist.BindInterval(o.arrIntervals))),0==r&&$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").prop("checked",!1),null!=e&&0==n){var d=$("#"+_vgWaitlist.model.txtWaitlistDate+'_picker .xdsoft_calendar td[data-date="'+e.getDate()+'"][data-month="'+e.getMonth()+'"][data-year="'+e.getFullYear()+'"]');(void 0===s.data("SelectedByUser")||0==s.data("SelectedByUser"))&&d.length>0&&d.removeClass(i).removeClass(a)}s.data("SelectedByUser",!1),0==$("#"+_vgWaitlist.model.txtWaitlistDate+"_picker .xdsoft_calendar td").hasClass("xdsoft_current")&&$("."+_vgWaitlist.model.WaitlistTimesInputCheck+" :checkbox").attr("disabled",!0)},onGenerateNew:function(e,t,i){var a=!1;_vgClassSessionSelection.VisibleControlLength("#mobile-check")&&(a=!0);var r="xdsoft_current";$(".xdsoft_calendar td").removeClass(r),a&&(r="vg_current",$("#vgCalendar_"+_vgWaitlist.model.newdatepicker+i+" .vg_calendar-date-div td").removeClass(r)),$("#"+_vgWaitlist.model.newdatepicker+i),$.grep(_vgWaitlist.localData.objWaitlistData,function(t,o){if(a)s=moment(t.DateW)._d,(n=$("#vgCalendar_"+_vgWaitlist.model.newdatepicker+i+' .vg_calendar-date-div td[data-value="'+moment(s).format("YYYY-MM-DD")+'"]')).length>0?n.addClass(r):0==_vgWaitlist.localData.objWaitlistData.filter(function(t){return t.DateW==moment(e).format(_vgWaitlist.localData.DateFormateForMoment)}).length&&$("#vgCalendar_"+_vgWaitlist.model.newdatepicker+i+' .vg_calendar-date-div td[data-value="'+moment(e).format("YYYY-MM-DD")+'"]').removeClass(r);else{var n,s=moment(t.DateW)._d;(n=$("#"+_vgWaitlist.model.newdatepicker+i+'_picker .xdsoft_calendar td[data-date="'+s.getDate()+'"][data-month="'+s.getMonth()+'"][data-year="'+s.getFullYear()+'"]')).length>0?n.addClass(r):0==_vgWaitlist.localData.objWaitlistData.filter(function(t){return t.DateW==moment(e).format(_vgWaitlist.localData.DateFormateForMoment)}).length&&$("#"+_vgWaitlist.model.newdatepicker+i+'_picker .xdsoft_calendar td[data-date="'+e.getDate()+'"][data-month="'+e.getMonth()+'"][data-year="'+e.getFullYear()+'"]').removeClass(r)}var l=o+1;if(t.DateW==moment(new Date(e)).format(_vgWaitlist.localData.DateFormateForMoment)){var d=$.grep(_vgWaitlist.localData.SelectedServiceProviderWorkingHours,function(e){return e.SelectedDate==moment(t.DateW).format("MMM-DD-YYYY")});d.length>0?_vgWaitlist.EnableIntervalNew(d[0],l):_vgWaitlist.localData.SelectedServiceProviderWorkingHours.length>0&&(_vgWaitlist.localData.isCalledForMobileDateChanged=!0,_vgWaitlist.GetServiceProviderWorkingHours(void 0,l)),_vgWaitlist.BindIntervalNew(t.TimeW,l)}})},ClearData:function(){_vgWaitlist.localData.GroupId="",_vgWaitlist.localData.SelectedServices=[],_vgWaitlist.localData.isOutCallService=!1,_vgWaitlist.localData.BusinessPackageID="",_vgWaitlist.localData.isServicePerformAtSameTime=!1,_vgWaitlist.localData.SelectedDates=[],_vgWaitlist.localData.ServiceProviderWorkingHours=[],_vgWaitlist.localData.SelectedServiceProviderWorkingHours=[],_vgWaitlist.localData.objWaitlistData=[],_vgWaitlist.localData.indexOfPicker=1,$("#WaitlistTimeDate").show(),_vgWaitlist.localData.IsOnline=!0,_vgWaitlist.localData.MasterSPServiceDetail=[],_vgWaitlist.localData.EditResponse=null;for(var e=void 0!==$("#hdnServiceLimit").val()&&null!=$("#hdnServiceLimit").val()&&null!=$("#hdnServiceLimit").val()&&""!=$("#hdnServiceLimit").val()?$("#hdnServiceLimit").val():3,t=1;t<=5;t++)$("#"+_vgWaitlist.model.newdatepicker+t).val(""),$("#selectWaitlist"+t+" :checkbox").attr("onclick","_vgWaitlist.validateTimeForMobile("+t+", this,"+t+");").prop("checked",!1).attr("disabled",!0);for(t=1;t<=e;t++)$("#"+_vgWaitlist.model.divSPWaitlist+ +t).hide();$("#"+_vgWaitlist.model.divBundleWaitlist).hide(),$("#dvwaitlistPopupHeader").text("Add to Waitlist"),$("#btnAddWaitlistOnline").text("Add to Waitlist")},ClearDataOffline:function(){_vgWaitlist.localData.SelectedServices=[],_vgWaitlist.localData.isOutCallService=!1,_vgWaitlist.localData.BusinessPackageID="",_vgWaitlist.localData.SelectedDates=[],_vgWaitlist.localData.ServiceProviderWorkingHours=[],_vgWaitlist.localData.SelectedServiceProviderWorkingHours=[],_vgWaitlist.localData.IsOnline=!1,_vgWaitlist.localData.MasterSPServiceDetail=[],_vgWaitlist.localData.BusinessID=0,_vgWaitlist.localData.UserID=0,_vgWaitlist.localData.LoginUserID=0,_vgWaitlist.localData.Comment="",$("#WaitlistTimeDate").show(),_vgWaitlist.localData.objWaitlistData=[],_vgWaitlist.localData.indexOfPicker=1,_vgWaitlist.localData.objReturnval=[""];for(var e=1;e<=5;e++)$("#selectWaitlist"+e+" :checkbox").attr("onclick","_vgWaitlist.validateTimeForMobile("+e+", this,"+e+");").prop("checked",!1).attr("disabled",!0);_vgWaitlist.DestroyApplyDateTimePicker(_vgWaitlist.localData.indexOfPicker,""),setdatepickervalue({divid:"#"+_vgWaitlist.model.newdivSearchDate+_vgWaitlist.localData.indexOfPicker,textid:"#"+_vgWaitlist.model.newdatepicker+_vgWaitlist.localData.indexOfPicker,isMobileFriendly:!1},_vgWaitlist.localData.waitlistSelectedDate),_vgWaitlist.ResetWaitlistDatetimeControl(!1)},ReSetControls:function(){_vgWaitlist.localData.SelectedDates=[],_vgWaitlist.localData.SelectedServiceProviderWorkingHours=[],$("#WaitlistTimeDate").show(),_vgWaitlist.localData.objWaitlistData=[],_vgWaitlist.localData.indexOfPicker=1,_vgWaitlist.localData.objReturnval=[""],_vgWaitlist.ResetWaitlistDatetimeControl(!1),$("#selectWaitlist1").find("input[type=checkbox]:checkbox").prop("checked",!1).attr("disabled",!0),$(".xdsoft_calendar td").removeClass("xdsoft_current"),$(".xdsoft_calendar td").removeClass("xdsoft_current select-cross"),$(".selectdatesi").remove()},ValiDateWaitlistOffline:function(){var e=NewApp_hdnCustomerID.value;if(0==e.length||"-1"==e||""==e.value)return SetErrorDisplayMessage("2","Please select a customer to book an waitlist.",""),!1;if(_vgWaitlist.localData.UserID=parseInt(NewApp_hdnCustomerID.value),_vgWaitlist.localData.MasterSPServiceDetailSave=[],0!=_vgWaitlist.localData.BusinessPackageID||1==_vgWaitlist.localData.IsWaitlistMultiService){var t=GetSelectedServies(hdnAppDate.value),i=t.split("|")[0].split(","),a=t.split("|")[1].split("~"),r=[];t.split("|").length>8&&(r=JSON.parse(t.split("|")[9]));for(var o=0;o<=i.length-1;o++){(l={}).SPIds=a[o],l.ServiceId=i[o];var n="";!String.isNullOrUndefineOrBlank(r)&&r.length>0&&(n=$.map(r[o],function(e){return e.serviceId}).join(",")),l.ServiceAddOnID=n,_vgWaitlist.localData.MasterSPServiceDetailSave.push(l)}}else{var s=null!=$("#cboServiceProviderWaitlist").val()&&""!=$("#cboServiceProviderWaitlist").val()?$("#cboServiceProviderWaitlist").val():0;if(0==s)return SetErrorDisplayMessage("2","Please select professional to book an waitlist.",""),!1;var l,d=parseInt(GetServiceID());(l={}).SPIds=s,l.ServiceId=d,_vgWaitlist.localData.MasterSPServiceDetailSave.push(l)}if(_vgWaitlist.localData.objWaitlistData.map(function(e){return e.TimeW}).indexOf("")>-1)return _vgWaitlist.ShowWarningMessage("Please Select Date and Time for Waitlist."),!1;if(1==_vgWaitlist.DuplicateDates())return _vgWaitlist.ShowWarningMessage("Please select unique dates."),!1;_vgWaitlist.localData.objWaitlistData.sort(function(e,t){return new Date(e.DateW)-new Date(t.DateW)});var c=$.grep(_vgWaitlist.localData.objWaitlistData,function(e){return e.TimeSlots=e.TimeW,e.FullDate=moment(new Date(e.DateW.replace(/-/g,"/"))).format("MMM-DD-YYYY"),!0});if(0==c.length)return _vgWaitlist.ShowWarningMessage("Please Select Date and Time for Waitlist."),!1;_vgWaitlist.SaveWaitlist(c),disableAppBookButton()},DestroyApplyDateTimePicker:function(e,t){if(1==_vgWaitlist.localData.IsOnline){var i=!1;_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&(i=!0),destroydatepicker({divid:"#"+_vgWaitlist.model.newdivSearchDate+e,textid:"#"+_vgWaitlist.model.newdatepicker+e,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isMobileFriendly:i,arrValidDates:t,onGenerate:function(t,i){_vgWaitlist.onGenerateNew(t,i,e)},BeforecallBackOnOpenForMobile:function(t){setdatepickervalue({divid:"#"+_vgWaitlist.model.newdivSearchDate+e,textid:"#"+_vgWaitlist.model.newdatepicker+e,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(t))},AftercallBackOnOpenForMobile:function(t){setTimeout(function(){_vgWaitlist.onGenerateNew(t,void 0,e)},500)},numberOfMonths:8,callBackOnChange:function(t){if(_vgWaitlist.localData.objWaitlistData[e-1].DateW!=moment(t).format(_vgWaitlist.localData.DateFormateForMoment)&&(_vgWaitlist.localData.objWaitlistData[e-1].TimeW="",_vgWaitlist.localData.objWaitlistData[e-1].DateW=moment(t).format(_vgWaitlist.localData.DateFormateForMoment),$("#selectWaitlist"+e).find("input[type=checkbox]").prop("checked",!1),$("#txtdivSearchTime"+e).val(_vgWaitlist.localData.SelectTimeText)),1==_vgWaitlist.DuplicateDates($("#newdatepicker"+e).val()))return!1;$("#newdivSearchTime"+e).click(),i&&_vgWaitlist.onGenerateNew(t,void 0,e)},flagVgMultiMonthDatePicker:!0,preset:"date",unavailableShowDate:!0,isApplyInWidget:!0,scrollMonth:!1})}else 0==_vgWaitlist.localData.IsOnline&&destroydatepicker({divid:"#"+_vgWaitlist.model.newdivSearchDate+e,textid:"#"+_vgWaitlist.model.newdatepicker+e,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isMobileFriendly:!1,onGenerate:function(t,i){_vgWaitlist.onGenerateNew(t,i,e)},callBackOnChange:function(t){_vgWaitlist.localData.objWaitlistData[e-1].DateW!=moment(t).format(_vgWaitlist.localData.DateFormateForMoment)&&(_vgWaitlist.localData.objWaitlistData[e-1].TimeW="",_vgWaitlist.localData.objWaitlistData[e-1].DateW=moment(t).format(_vgWaitlist.localData.DateFormateForMoment),$("#selectWaitlist"+e).find("input[type=checkbox]").prop("checked",!1),$("#txtdivSearchTime"+e).val(_vgWaitlist.localData.SelectTimeText)),$("#newdivSearchTime"+e).click()},flagVgMultiMonthDatePicker:!0,preset:"date",unavailableShowDate:!0,isApplyInWidget:!1,MinDate:_vgWaitlist.localData.minDateForOffline,MaxDate:_vgWaitlist.localData.maxDateForOffline})},GetDatesForWaitlist:function(e,t){var i=t;return i=new Date(Math.max.apply(null,_vgWaitlist.localData.objWaitlistData.map(function(e){return new Date(e.DateW)}))),1==_vgWaitlist.localData.IsOnline?(e=$.grep(e,function(e){return new Date(e)>i})).length>0&&(i=e[0]):i.setDate(i.getDate()+1),i},AddWaitlistDateTime:function(e){if(5!=_vgWaitlist.localData.objWaitlistData.length){var t={DateW:""};if(-1==_vgWaitlist.localData.objWaitlistData.map(function(e){return e.TimeW}).indexOf("")){_vgWaitlist.DestroyApplyDateTimePicker(parseInt(_vgWaitlist.localData.objWaitlistData.length+1),_vgWaitlist.localData.objReturnval);var i=_vgWaitlist.GetDatesForWaitlist(_vgWaitlist.localData.objReturnval,_vgWaitlist.localData.waitlistSelectedDate);setdatepickervalue({divid:"#"+_vgWaitlist.model.newdivSearchDate+parseInt(_vgWaitlist.localData.objWaitlistData.length+1),textid:"#"+_vgWaitlist.model.newdatepicker+parseInt(_vgWaitlist.localData.objWaitlistData.length+1),flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(i)),t.DateW=moment($("#newdatepicker"+parseInt(_vgWaitlist.localData.objWaitlistData.length+1)).val()).format(_vgWaitlist.localData.DateFormateForMoment),t.TimeW=0==_vgWaitlist.localData.IsOnline?""+_vgWaitlist.TimeSlot.Anytime:"",_vgWaitlist.localData.objWaitlistData.push(t),$("#AddWaitlistDateTime").addClass("btn-margin-left"),$("#WaitlistDateTime"+parseInt(_vgWaitlist.localData.objWaitlistData.length)).show(),_vgWaitlist.ResetWaitlistDatetimeControl(!1),$("#NewdivSearchDate"+parseInt(_vgWaitlist.localData.objWaitlistData.length)).attr("tabindex",-1).focus()}else _vgWaitlist.ShowWarningMessage("Please update time for date",e)}else _vgWaitlist.ShowWarningMessage("Please add only 5 dates for waitlist",e);5==_vgWaitlist.localData.objWaitlistData.length&&$("#WaitlistTimeDate").hide()},HideWaitlistDateTime:function(e){$("#WaitlistTimeDate").show(),$(e).parents("[id^=WaitlistDateTime]").hide();var t=$(e).parents("[id^=WaitlistDateTime]").attr("id").substr(-1);_vgWaitlist.localData.objWaitlistData.splice(t-1,1),1==_vgWaitlist.localData.objWaitlistData.length&&$("#AddWaitlistDateTime").removeClass("btn-margin-left"),_vgWaitlist.ResetWaitlistDatetimeControl(!1),$("#AddWaitlistDateTime").attr("tabindex",-1).focus()},ResetWaitlistDatetimeControl:function(e){if(0==_vgWaitlist.localData.objWaitlistData.length){var t={};t.DateW=""!=$("#newdatepicker1").val()?moment($("#newdatepicker1").val()).format(_vgWaitlist.localData.DateFormateForMoment):"",t.TimeW=0==_vgWaitlist.localData.IsOnline?""+_vgWaitlist.TimeSlot.Anytime:"",_vgWaitlist.localData.objWaitlistData.push(t)}$('[id^="WaitlistDateTime"]').hide();for(var i=1;i<=5;i++)$("#newdatepicker"+i).val(""),setdatepickervalue({divid:"#"+_vgWaitlist.model.newdivSearchDate+i,textid:"#"+_vgWaitlist.model.newdatepicker+i,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},""),$("#txtdivSearchTime"+i).val(_vgWaitlist.localData.SelectTimeText),$("#selectWaitlist"+i).find("input[type=checkbox]:checked").removeAttr("checked");$.each(_vgWaitlist.localData.objWaitlistData,function(t,i){var a=t+1;if($("#newdatepicker"+a).val(i.DateW),_vgWaitlist.localData.objReturnval.length>0&&(e&&(_vgWaitlist.DestroyApplyDateTimePicker(a,_vgWaitlist.localData.objReturnval),""!=i.DateW&&_vgWaitlist.EnableIntervalNew(i.copyobjSelectedServiceProviderWorkingHours,a)),setdatepickervalue({divid:"#"+_vgWaitlist.model.newdivSearchDate+a,textid:"#"+_vgWaitlist.model.newdatepicker+a,flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(i.DateW))),$("#txtdivSearchTime"+a).val(""!=i.TimeW?_vgWaitlist.TimeSlotValueReverse(i.TimeW):_vgWaitlist.localData.SelectTimeText),$("#selectWaitlist"+a).find("input[type=checkbox]:checked").removeAttr("checked"),""!=i.TimeW){var r=i.TimeW.split(",");$.each(r,function(e,t){$("#selectWaitlist"+a+' :checkbox[value="'+t+'"]').prop("checked",!0)})}$("#WaitlistDateTime"+a).show()})},DuplicateDates:function(e){if(void 0!==e&&""!=e)return _vgWaitlist.localData.objWaitlistData.filter(function(t){return t.DateW==e}).length>1&&(_vgWaitlist.ShowWarningMessage("Please select unique dates."),!0);var t=_vgWaitlist.localData.objWaitlistData.map(function(e){return e.DateW});return!!t.some(function(e,i){return t.indexOf(e)!=i})},TimeSlotValue:function(e){var t=e.trim().split(","),i=new Array;return $.grep(t,function(e){e.trim()==_vgWaitlist.TimeSlotStr.Anytime?i.push(_vgWaitlist.TimeSlot.Anytime):e.trim()==_vgWaitlist.TimeSlotStr.Morning?i.push(_vgWaitlist.TimeSlot.Morning):e.trim()==_vgWaitlist.TimeSlotStr.Afternoon?i.push(_vgWaitlist.TimeSlot.Afternoon):e.trim()==_vgWaitlist.TimeSlotStr.Evening&&i.push(_vgWaitlist.TimeSlot.Evening)}),i.sort().join(",")},TimeSlotValueReverse:function(e){var t=e.trim().split(","),i=new Array;return $.grep(t,function(e){e==_vgWaitlist.TimeSlot.Anytime?i.push(_vgWaitlist.TimeSlotStr.Anytime):e==_vgWaitlist.TimeSlot.Morning?i.push(_vgWaitlist.TimeSlotStr.Morning):e==_vgWaitlist.TimeSlot.Afternoon?i.push(_vgWaitlist.TimeSlotStr.Afternoon):e==_vgWaitlist.TimeSlot.Evening&&i.push(_vgWaitlist.TimeSlotStr.Evening)}),i.join(", ")},SubmitWaitlist:function(){if(_vgWaitlist.localData.objWaitlistData.map(function(e){return e.TimeW}).indexOf("")>-1)return _vgWaitlist.ShowWarningMessage("Please Select Date and Time for Waitlist."),!1;_vgWaitlist.localData.objWaitlistData.sort(function(e,t){return new Date(e.DateW)-new Date(t.DateW)});var e=$.grep(_vgWaitlist.localData.objWaitlistData,function(e){return e.TimeSlots=e.TimeW,e.FullDate=moment(new Date(e.DateW.replace(/-/g,"/"))).format("MMM-DD-YYYY"),!0});if(0==e.length)return _vgWaitlist.ShowWarningMessage("Please Select Date and Time for Waitlist."),!1;_vgWaitlist.localData.MasterSPServiceDetailSave=[];var t=[],i=!1;if(void 0!==_vgWaitlist.localData.SelectedServices&&_vgWaitlist.localData.SelectedServices.length>0){for(var a=_vgWaitlist.localData.SelectedServices,r=0;r<=a.length-1;r++){for(var o=r+1,n=$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+o).val(),s="",l=r+1,d=0;d<SelectedAddonService.length;d++)if(SelectedAddonService[d].MainServiceID==a[r]&&SelectedAddonService[d].SrNo==l)for(var c=0;c<SelectedAddonService[d].lstAddonService.length;c++)s+=SelectedAddonService[d].lstAddonService[c].ServiceId+",";if(s=s.substring(0,s.length-1),null!=n&&n.length>0){if(objMasterSPServiceDetailSave={},objMasterSPServiceDetailSave.SPIds=n.join(","),""!=_vgWaitlist.localData.BusinessPackageID&&1==_vgWaitlist.localData.isServicePerformAtSameTime&&($.grep(n,function(e){0==i&&(-1==$.inArray(e,t)?t.push(e):i=!0)}),1==i))break;objMasterSPServiceDetailSave.ServiceAddOnID=s,objMasterSPServiceDetailSave.ServiceId=a[r],_vgWaitlist.localData.MasterSPServiceDetailSave.push(objMasterSPServiceDetailSave)}else objMasterSPServiceDetailSave={},objMasterSPServiceDetailSave.SPIds=0,objMasterSPServiceDetailSave.ServiceId=a[r],objMasterSPServiceDetailSave.ServiceAddOnID=s,_vgWaitlist.localData.MasterSPServiceDetailSave.push(objMasterSPServiceDetailSave)}if(""!=_vgWaitlist.localData.BusinessPackageID&&1==_vgWaitlist.localData.isServicePerformAtSameTime&&1==i)return _vgWaitlist.localData.MasterSPServiceDetailSave=[],_vgWaitlist.ShowWarningMessage("Services in this service bundle could not be booked with same provider.Please select different Provider for All Services."),!1}0==_vgWaitlist.localData.WaitlistID?_vgWaitlist.SaveWaitlist(e):_vgWaitlist.UpdateWaitlist()},SaveWaitlist:function(e){var t={Device:"Website",Calledfrom:"Calendar"};if(1==_vgWaitlist.localData.IsOnline)if("true"==isFacebook?t.Calledfrom="FacebookWidget":"true"==isWidget?t.Calledfrom="Widget":"true"==isGoogle?t.Calledfrom="Google":t.Calledfrom="Shopdetail","undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions?t.Device="Insta":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()&&(t.Device="Facebook"),"undefined"!=typeof isWindowsApp&&1==isWindowsApp)t.Device="Windows";else if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){t.Device="CustomerApp";var i=null!=navigator.userAgent?navigator.userAgent:"";i.toLowerCase().indexOf("customerios")>-1?t.Device="iOS":i.toLowerCase().indexOf("customerandroid amazon")>-1?t.Device="Amazon":i.toLowerCase().indexOf("customerandroid")>-1&&(t.Device="Android"),"undefined"!=typeof IsBrandedApp&&null!=IsBrandedApp&&""!==IsBrandedApp&&null!=IsBrandedApp&&1==IsBrandedApp&&(t.Device=t.Device+" Branded")}else if(vgAppicationType==objApplicationType.CheckinApp)t.Device="CheckIn";else if(_shopdetail.VisibleControlLength("#mobile-check")>0){t.Device="MobileWeb","undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions?t.Device="Insta":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()&&(t.Device="Facebook");var a=navigator.userAgent;OpenedFrom={iphone:a.match(/(iPhone|iPod)/),blackberry:a.match(/BlackBerry/),kindle:a.match(/Silk/),android:a.match(/Android/),windows:a.match(/Windows/),ipad:a.match(/iPad/)},OpenedFrom.windows?t.Device=t.Device+" Windows Phone":OpenedFrom.iphone?t.Device=t.Device+" iPhone":OpenedFrom.android?t.Device=t.Device+" Android":OpenedFrom.blackberry?t.Device=t.Device+" Blackberry":OpenedFrom.ipad?t.Device=t.Device+" iPad":OpenedFrom.kindle&&(t.Device=t.Device+" kindle")}var r=_vgWaitlist.localData.isOutCallService;if(1==_vgWaitlist.localData.IsOnline){$("#dvOutCallSection").is(":visible")&&(r=$("#mobile-appointments").prop("checked"));var o=$(".familycktfrnd ul li.selected").data("value");if(void 0===o||null==o||o<0)return vagaro.alert("Sorry something went wrong, please try again!"),!1;t.LoginUserID=UserID,t.UserID=o,t.Comment=""}else t.LoginUserID=_vgWaitlist.localData.LoginUserID,t.UserID=_vgWaitlist.localData.UserID,t.Comment=_vgWaitlist.localData.Comment;_vgWaitlist.ShowLoaderWaitlist(!0);var n=new vagaro.ajax;if(t.BusinessID=_vgWaitlist.localData.BusinessID,t.IsOnline=_vgWaitlist.localData.IsOnline,t.AppointmentType=_vgWaitlist.localData.EventType.Service,t.BusinessPackageID=""==_vgWaitlist.localData.BusinessPackageID||0==_vgWaitlist.localData.BusinessPackageID?null:_vgWaitlist.localData.BusinessPackageID,t.IsOutCall=r,t.WaitlistDetails=e,t.ServiceProviderServices=_vgWaitlist.localData.MasterSPServiceDetailSave,"undefined"!=typeof ChangeAppStatus&&1==ChangeAppStatus.IsNewCall()){$.grep(t.WaitlistDetails,function(e){void 0!==navigator.userAgent&&navigator.userAgent.search("Firefox")>=0?e.FullDate=moment(new Date(e.FullDate.replace(/-/g,"/"))).format("YYYY-MM-DD"):e.FullDate=moment(new Date(e.FullDate)).format("YYYY-MM-DD")}),$.grep(t.ServiceProviderServices,function(e){if(e.SPIds=e.SPIds.toString(),e.ServiceId=parseInt(e.ServiceId),void 0===_vgWaitlist.localData.BusinessPackageID||"0"==_vgWaitlist.localData.BusinessPackageID||""==_vgWaitlist.localData.BusinessPackageID){var t="";if(null!=arrMulSearchObject&&arrMulSearchObject.length>0){for(var i=0;i<arrMulSearchObject.length;i++)if(arrMulSearchObject[i].Service==e.ServiceId&&null!=arrMulSearchObject[i].AddonDetail&&arrMulSearchObject[i].AddonDetail.length>0)for(var a=0;a<arrMulSearchObject[i].AddonDetail.length;a++)t+=""==t?arrMulSearchObject[i].AddonDetail[a].ServiceID.toString():","+arrMulSearchObject[i].AddonDetail[a].ServiceID.toString()}else{var r=_vgAddon.BindMulitAddons();for(i=0;i<r.length;i++)t+=""==t?r[i].ServiceID.toString():","+r[i].ServiceID.toString()}e.ServiceAddOnID=t}});var s={Comment:t.Comment,AppointmentType:t.AppointmentType,BusinessPackageID:parseInt(t.BusinessPackageID),IsOutCall:t.IsOutCall,WaitlistDetails:t.WaitlistDetails,ServiceProviderServices:t.ServiceProviderServices,CalledFrom:t.Calledfrom,UserID:parseInt(t.UserID),IsCallFromMobile:!1,IsOnline:t.IsOnline,BusinessID:parseInt(t.BusinessID),Device:t.Device,LoginUserID:parseInt(t.LoginUserID),MasterWaitlistDetails:null};Scheduler.AjaxPostCall(VagaroCoreApiURLEnum.ManageWaitlist,s,_vgWaitlist.SuccessSaveWaitlist,_vgWaitlist.CallFailed)}else n.datamodel.Token=ApiPath+ApiURLEnumWaitlist.savewaitlist,n.datamodel.data=t,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=_vgWaitlist.SuccessSaveWaitlist,n.datamodel.Error=_vgWaitlist.CallFailed,n.Post()},UpdateWaitlist:function(){var e=$.grep(_vgWaitlist.localData.objWaitlistData,function(e){return""!=e.TimeSlots});if(e.length<=0)return _vgWaitlist.ShowWarningMessage("Please Select Date and Time for Waitlist."),!1;_vgWaitlist.ShowLoaderWaitlist(!0);var t={},i=new vagaro.ajax;t.WaitlistID=_vgWaitlist.localData.WaitlistID,t.businessID=_vgWaitlist.localData.BusinessID,t.loginUserID=UserID,t.lstWaitlistDetail=e,t.lstMasterSPServiceDetail=_vgWaitlist.localData.MasterSPServiceDetailSave,i.datamodel.Token=ApiURLEnumWaitlist.UpdateWaitlist,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=t,i.datamodel.callback=_vgWaitlist.SuccessUpdateWaitlist,i.datamodel.Error=_vgWaitlist.CallFailed,i.datamodel.GroupToken=_vgWaitlist.GetGroupId(),i.Post()},SuccessSaveWaitlist:function(e){var t=!1;if("undefined"!=typeof ChangeAppStatus&&1==ChangeAppStatus.IsNewCall()){if(t=!0,e.CustomCode!=VagaroApiResponseEnum.ResponseCode.Success)return _vgWaitlist.ShowLoaderWaitlist(!1),void 0!==e.Message&&null!=e.Message&&""!=e.Message.toString().trim()?msg=e.Message:msg="something went wrong, please try again!",void _vgWaitlist.ShowFailMessage(msg);e=e.Data}if(null!=e&&0!=e){if(1==t){if(null!=e.ErrorSummary&&e.ErrorSummary.length>0&&16==e.ErrorSummary[0].Type)return _vgWaitlist.ShowLoaderWaitlist(!1),_shopdetail.HideShowDisableBookMessageForApps(!0),void $("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide")}else if(null!=e.ErrorSummary&&e.ErrorSummary.length>0&&16==e.ErrorSummary[0].type)return _vgWaitlist.ShowLoaderWaitlist(!1),_shopdetail.HideShowDisableBookMessageForApps(!0),void $("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide");if(1==_vgWaitlist.localData.IsOnline)$("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide"),$("html").removeClass("waitlistpopupHidden"),_shopdetail.VisibleControlLength("#mobile-check")>0&&$("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide"),_vgWaitlist.WaitlistSuccessfullBooked(e);else if(_vgWaitlist.ShowSucessMessage("Waitlist has been saved."),_vgWaitlist.ClaearWaitlistDataOffline(),0==$("#spanFeature").hasClass("available-show")||""==$("#lblFeatureCount").text())$("#spanFeature").addClass("available-show"),$("#lblFeatureCount").html("1");else try{var i=parseInt($("#lblFeatureCount").text());i+=1,$("#lblFeatureCount").text(i)}catch(e){}}else 1==_vgWaitlist.localData.IsOnline?($("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide"),$("html").removeClass("waitlistpopupHidden")):enableAppBookButton(),_vgWaitlist.ShowFailMessage("Some error occured.Please try again later");_vgWaitlist.ShowLoaderWaitlist(!1)},ClaearWaitlistDataOffline:function(){try{var e=$("#divCustomers"),t=$("#ulCustomers");null!=e&&e.is(":visible")&&e.slideUp(250,function(){t.unbind("scroll")}),$("#divSingleAppointment").hide(),flgIsMultiAppointment=!1,ClearMultiSelectAppointments(),getResourceCombo().options.length=0,AddItemsToDDL("0","Select Resource",!0),lblBookedBy.innerHTML=""}catch(e){}},EditWaitlist:function(e,t,i,a){_vgWaitlist.ShowLoaderWaitlist(!0),_vgWaitlist.ClearData(),_vgWaitlist.BindServiceProvider(),_vgWaitlist.localData.GroupId=i,_vgWaitlist.localData.CurrentEditId=".clswlEdit"+e+i,$("#"+_vgWaitlist.model.lblBundleNameWaitlist).val("");var r={},o=new vagaro.ajax;_vgWaitlist.localData.FromMyAccount=!0,r.strWaitlistID=e,r.strBusinessId=t,o.datamodel.Token=ApiURLEnumWaitlist.GetWaitListDetails,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.data=r,o.datamodel.callback=_vgWaitlist.EditWaitlistSuccess,o.datamodel.Error=_vgWaitlist.CallFailed,o.datamodel.GroupToken=i,o.Post()},EditWaitlistSuccess:function(e){if(void 0!==e&&null!=e&&null!=e.selectedWaitlistMaster){if(null!=e.selectedWaitlistMaster.WaitlistID&&(e.selectedWaitlistMaster.WaitlistID==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceInProgress)||e.selectedWaitlistMaster.WaitlistID==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceComplete)))return e.selectedWaitlistMaster.WaitlistID==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceInProgress)?_vgWaitlist.ShowFailMessage(_vgWaitlist.localData.UnderMaintananceMessage):e.selectedWaitlistMaster.WaitlistID==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceComplete)&&location.reload(!0),void _vgWaitlist.ShowLoaderWaitlist(!1);if(1==e.selectedWaitlistMaster.IsBlock)return _vgWaitlist.ShowLoaderWaitlist(!1),void _vgWaitlist.ShowFailMessage("Your booking is blocked");_vgWaitlist.localData.BusinessID=e.selectedWaitlistMaster.BusinessID,_vgWaitlist.localData.WaitlistID=e.selectedWaitlistMaster.WaitlistID,_vgWaitlist.localData.EditResponse=e,_vgWaitlist.GetSelectedDataForEdit()}else _vgWaitlist.ShowFailMessage("Some error occured.Please try again later");_vgWaitlist.ShowLoaderWaitlist(!1)},GetSelectedDataForEdit:function(){var e=_vgWaitlist.localData.EditResponse.selectedWaitlistDetails,t=0,i=[],a=$.grep(e,function(a,r){if(-1==$.inArray(a.WaitlistDate,i)){var o={},n=moment(a.strWaitlistDate)._d;o.dtWaitlistDate=new Date(n),o.SelectedDate=moment(n).format("MMM-DD-YYYY"),o.Day=n.getDate(),o.Month=n.getMonth(),o.Year=n.getFullYear(),o.IsSelected=!1,o.arrIntervals=[],$.grep(a.ReqIntervals.split(","),function(e){o.arrIntervals.push(parseInt(e))}),o.Morning=a.Morning,o.AfterNoon=a.AfterNoon,o.Evening=a.Evening,o.DateW=moment(n).format(_vgWaitlist.localData.DateFormateForMoment),o.TimeW=a.ReqIntervals,_vgWaitlist.localData.SelectedServiceProviderWorkingHours.push(o),i.push(a.WaitlistDate)}if(e[0].WaitlistDate==a.WaitlistDate)return 1==_vgWaitlist.BindSPDropdownForEdit(t+1,a)&&(t+=1),!0});if(t>0&&a.length==t){var r=_vgWaitlist.localData.EditResponse.selectedWaitlistMaster;r.EventType==arrEventType.Service&&r.BusinessPackageID>0&&(_vgWaitlist.localData.BusinessPackageID=r.BusinessPackageID,_vgWaitlist.localData.isServicePerformAtSameTime=2==r.IsServicePerformSameTime,$("#"+_vgWaitlist.model.lblBundleNameWaitlist).text(r.ServiceBundleName),$("#"+_vgWaitlist.model.divBundleWaitlist).show()),1==t?($("#"+_vgWaitlist.model.lblSPWaitlist+"1").text("Select Professional:"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).removeClass("WaitlistDisc"),$("#"+_vgWaitlist.model.divSP1Waitlist).removeClass("WaitListServiceFull"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).addClass("WaitlistDiscfullwidth"),$("#"+_vgWaitlist.model.divSP1Waitlist).addClass("WaitListServicehalfWidth "),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0&&($("#divwaitlistServiceTitle").show(),$("#divwaitlistServiceTitle").html(e[0].ServiceTitle))):t>1&&($("#"+_vgWaitlist.model.divServiceNameWaitlist).removeClass("WaitlistDiscfullwidth"),$("#"+_vgWaitlist.model.divSP1Waitlist).removeClass("WaitListServicehalfWidth "),$("#"+_vgWaitlist.model.divServiceNameWaitlist).addClass("WaitlistDisc"),$("#"+_vgWaitlist.model.divSP1Waitlist).addClass("WaitListServiceFull"),$("#divwaitlistServiceTitle").hide(),$("#divwaitlistServiceTitle").html("")),1==t?$(".newaddwaitlistdatepicker").removeClass("multiNewadddatepicker"):t>3?$(".newaddwaitlistdatepicker").addClass("multiNewadddatepicker"):$(".newaddwaitlistdatepicker").removeClass("multiNewadddatepicker"),_vgWaitlist.GetAvailableDates(null,!0)}else _vgWaitlist.ShowErrorMessage()},BindSPDropdownForEdit:function(e,t){var i=[];""!=t.AllServiceProviderID&&(i=t.AllServiceProviderID.split(","));var a=_vgWaitlist.localData.EditResponse.selectedWaitlistAllProviders;if(i.length>0){var r=$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+e);if(0==$.grep(i,function(e){var i=$.grep(a,function(t){return t.spid==e});if(i.length>0){var o={};return o.ServiceId=t.ServiceID,o.Servicename=t.ServiceTitle,o.SPIds=e,o.SPName=i[0].spName,r.append($("<option></option>").val(o.SPIds).html(o.SPName)),_vgWaitlist.localData.MasterSPServiceDetail.push(o),!0}return!1}).length)return!1;if(_vgWaitlist.localData.SelectedServices.push(t.ServiceID),$("#"+_vgWaitlist.model.divSPWaitlist+e).show(),$("#"+_vgWaitlist.model.lblSPWaitlist+e).text(t.ServiceTitle),r.data("isSkipChangeEvent",!0),"0"!=t.ServiceProviderID){var o=t.FilterServiceProviderID.split(",");o.length>0?r.val(o).trigger("change"):r.val("").trigger("change")}else r.val("").trigger("change");return!0}return!1},EditWaitlistSuccess1:function(e){if(void 0!==e&&null!=e){var t=e.ServiceProviderList,i=e.SelectedServiceProviderList,a=e.AvaibaleDatesList,r=e.SelectedWaitlist,o=e.SelectedWaitlistDetails,n=0;_vgWaitlist.localData.BusinessID=r[0].BusinessID,_vgWaitlist.localData.WaitlistID=r[0].WaitlistID,_vgWaitlist.localData.IsOnChangeSP=1,$("#"+_vgWaitlist.model.lblBundleNameWaitlist).val(""),$("#"+_vgWaitlist.model.divBundleWaitlist).hide(),""!=r[0].ServiceTitle&&($("#"+_vgWaitlist.model.lblBundleNameWaitlist).text(r[0].ServiceTitle),$("#"+_vgWaitlist.model.divBundleWaitlist).show());var s=o.uniqueObjects(["ServiceID"]);_vgWaitlist.localData.SelectedServices=[],$.grep(i,function(e){n++;var i=$.grep(s,function(t){return t.ServiceID==e.ServiceID});if(_vgWaitlist.localData.SelectedServices.push(i[0].ServiceID),$("#"+_vgWaitlist.model.lblSPWaitlist+n).text(i[0].ServiceTitle),$("#"+_vgWaitlist.model.divSPWaitlist+n).show(),$.grep(t,function(t){objMasterSPServiceDetail={},objMasterSPServiceDetail.SPIds=t.ServiceProviderID,_vgWaitlist.localData.MasterSPServiceDetail.push(objMasterSPServiceDetail),t.ServiceID==e.ServiceID&&$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+n).append($("<option></option>").val(t.ServiceProviderID).html(t.Name))}),0==e.ServiceProviderID)$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+n).trigger("change");else{var a=e.ServiceProviderID.split(",");$("#"+_vgWaitlist.model.cboServiceProviderWaitlist+n).val(a).trigger("change")}}),1==i.length?($("#"+_vgWaitlist.model.lblSPWaitlist+"1").text("Select Professional:"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).removeClass("WaitlistDisc"),$("#"+_vgWaitlist.model.divSP1Waitlist).removeClass("WaitListServiceFull"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).addClass("WaitlistDiscfullwidth"),$("#"+_vgWaitlist.model.divSP1Waitlist).addClass("WaitListServicehalfWidth")):($("#"+_vgWaitlist.model.divServiceNameWaitlist).removeClass("WaitlistDiscfullwidth"),$("#"+_vgWaitlist.model.divSP1Waitlist).removeClass("WaitListServicehalfWidth"),$("#"+_vgWaitlist.model.divServiceNameWaitlist).addClass("WaitlistDisc"),$("#"+_vgWaitlist.model.divSP1Waitlist).addClass("WaitListServiceFull"));var l=o.uniqueObjects(["ReqStartTime"]);$.grep(l,function(e){var t={};t.FullDate=e.ReqStartTime,t.Date=e.Day,t.Month=e.Month,t.Year=e.Year,t.TimeSlots=e.ReqIntervals,t.IsSelected=!1,_vgWaitlist.localData.SelectedDates.push(t)}),new Date;var d=[];$.grep(a,function(e){d.push(e.AvailableDate)}),_vgClassSessionSelection=void 0,destroydatepicker({divid:"#"+_vgWaitlist.model.divWaitlistDate,textid:"#"+_vgWaitlist.model.txtWaitlistDate,flagVgMultiMonthDatePicker:!0,dateTimeFormat:"MMM-DD-YYYY",preset:"date",unavailableShowDate:!0,arrValidDates:d,contentWindow:datePicker_contentWindow,isApplyInWidget:!0,inline:!0,contentWindow:"cboServiceProviderWaitlist",isMobileFriendly:!1,callBackOnChange:_vgWaitlist.GetServiceProviderWorkingHours,onGenerate:_vgWaitlist.DispalySelecedDates}),$(".Waitlistpopupbody").scrollTop(0),$("#"+_vgWaitlist.model.divWaitlistpopup).modal("show"),_vgWaitlist.DispalySelecedDates(),_vgWaitlist.localData.IsOnChangeSP=0}_vgWaitlist.ShowLoaderWaitlist(!1)},SuccessUpdateWaitlist:function(e){if(null!=e){var t=e,i=t.lstErrorSummary;if(null!=i&&i.length>0){if(e.lstErrorSummary[0].UnderMaintananceStatus==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceInProgress)||e.lstErrorSummary[0].UnderMaintananceStatus==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceComplete))return e.lstErrorSummary[0].UnderMaintananceStatus==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceInProgress)?_vgWaitlist.ShowFailMessage(_vgWaitlist.localData.UnderMaintananceMessage,_vgWaitlist.localData.CurrentEditId):e.lstErrorSummary[0].UnderMaintananceStatus==parseInt(_vgWaitlist.UnderMaintanance.UnderMaintananceComplete)&&location.reload(!0),void _vgWaitlist.ShowLoaderWaitlist(!1);if(16==i[0].type)return _vgWaitlist.ShowLoaderWaitlist(!1),$("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide"),void _vgWaitlist.ShowFailMessage("Your booking is blocked",_vgWaitlist.localData.CurrentEditId)}var a=t.waitlistMaster,r=$("#divWaitlistDetail"+a.WaitlistID+t.GroupId),o=t.lstwaitlistDetail,n=t.lstWaitlistProviders,s=o[0].ReqStartTime,l=[],d=[],c=$.grep(o,function(e){if(-1==$.inArray(e.ReqStartTime,d)){var t={};t.WaitlistID=e.WaitlistID,t.WaitlistDetailID=e.WaitlistDetailID,t.DisplayDate=moment(e.strReqStartTime).format("MMM D");var i=e.ReqIntervals.split(","),a=[];$.grep(i,function(e){parseInt(e)==_vgWaitlist.TimeSlot.Morning?a.push(_vgWaitlist.TimeSlotStr.Morning):parseInt(e)==_vgWaitlist.TimeSlot.Afternoon?a.push(_vgWaitlist.TimeSlotStr.Afternoon):parseInt(e)==_vgWaitlist.TimeSlot.Evening?a.push(_vgWaitlist.TimeSlotStr.Evening):a.push(_vgWaitlist.TimeSlotStr.Anytime)}),t.TimeSlots=a.join(", ").trim(),l.push(t),d.push(e.ReqStartTime)}if(e.ReqStartTime==s){var r="";if("0"==e.ServiceProviderID)r=_vgWaitlist.localData.txtAnyProvider;else{var o=[];$.grep(e.ServiceProviderID.split(","),function(e){var t=$.grep(n,function(t){return t.SPID==parseInt(e)});t.length>0&&o.push(t[0].ServiceProviderName)}),o.length>0&&(o.length>1?r=o.join(" or ").trim():o.length>0&&(r=o[0]))}return e.strProviderName=r,!0}return!1}),u=$("#ServiceProviderName"+a.WaitlistID+t.GroupId);if(1==c.length)$(u).html("with "+c[0].strProviderName);else{var p="";$.grep(c,function(e){""!=p&&(p+="</BR>"),p+=e.ServiceTitle+" with "+e.strProviderName}),$(u).html(p)}$(r).empty(),$("#divOriginalPrice"+a.WaitlistID+t.GroupId).html(parseFloat(e.waitlistMaster.Price+e.waitlistMaster.OutCallPrice)),$("#scriptWaitlistDetail").tmpl(l).appendTo("#divWaitlistDetail"+a.WaitlistID+t.GroupId),_vgWaitlist.ShowLoaderWaitlist(!1),$("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide"),_vgWaitlist.ShowSucessMessage("Waitlist has been updated.",_vgWaitlist.localData.CurrentEditId),setTimeout(function(){_vgWaitlist.localData.CurrentEditId.attr("aria-label","Waitlist has been updated.")},500)}else _vgWaitlist.ShowLoaderWaitlist(!1),$("#"+_vgWaitlist.model.divWaitlistpopup).modal("hide"),_vgWaitlist.ShowFailMessage("Some error occured.Please try again later",_vgWaitlist.localData.CurrentEditId)},ShowSucessMessage:function(e,t){1==_vgWaitlist.localData.IsOnline?"true"==isWidget?vagaro.alertsmall(e):_common.PassiveAlertSuccessgreen(e,t):SetErrorDisplayMessage("1",e,"")},ShowFailMessage:function(e,t){1==_vgWaitlist.localData.IsOnline?"true"==isWidget?vagaro.alertsmall(e):_common.PassiveAlertfail(e,t):SetErrorDisplayMessage("0",e,"")},ShowWarningMessage:function(e,t){1==_vgWaitlist.localData.IsOnline?"true"==isWidget?vagaro.alertsmall(e):_common.PassiveAlertwarning(e,t):SetErrorDisplayMessage("2",e,"")},WaitlistSuccessfullBooked:function(e){_shopdetail.RemoveAllControls(!0,!0),_shopdetail.SetControls(null),_shopdetail.VisibleControlLength("#mobile-check")>0&&_shopdetail.backpage(),$("#no-appointment-found").hide(),$("#divWaitlistAppointment").hide();var t={},i=e.WaitlistDetails,a=e.WaitlistProviders,r=i.uniqueObjects(["ReqStartTime"]),o=[];$.grep(r,function(e){var i={};i.date=e.strReqStartTime,i.dateLable=moment(e.strReqStartTime).format(_vgWaitlist.localData.DateFormateFor_MomentNew);var a=e.ReqIntervals.split(","),r=[];$.grep(a,function(e){parseInt(e)==_vgWaitlist.TimeSlot.Morning?r.push(_vgWaitlist.TimeSlotStr.Morning):parseInt(e)==_vgWaitlist.TimeSlot.Afternoon?r.push(_vgWaitlist.TimeSlotStr.Afternoon):parseInt(e)==_vgWaitlist.TimeSlot.Evening?r.push(_vgWaitlist.TimeSlotStr.Evening):r.push(_vgWaitlist.TimeSlotStr.Anytime)}),i.time=r.join(", ").trim(),o.push(i),t.TimeSlots=o});var n=[];$.grep(i,function(e){if(e.ReqStartTime==i[0].ReqStartTime){var t={};if("0"==e.ServiceProviderID){var r={};if(r.servicename=e.ServiceTitle,r.proiderList=_vgWaitlist.GetServiceProvidersDetail(e.FilterServiceProviderID,a),r.lstAddonService=[],null!=e.AddOnIDs&&null!=e.AddOnIDs&&""!=e.AddOnIDs.trim())for(var o=0;o<e.AddOnIDs.split("|~|").length;o++)r.lstAddonService.push({AddonName:e.AddOnIDs.split("|~|")[o]});if("undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee){var s=_vgWaitlist.localData.SelectedServicesDetails.filter(t=>t.ServiceId==e.ServiceID);String.isNullOrUndefineOrBlank(s)||(r.image=s[0].Photo)}t.typeService=_vgWaitlist.localData.TypeService.Any,t.serviceList=[],t.serviceList.push(r),n.push(t)}else{var l=_vgWaitlist.GetServiceProvidersDetail(e.FilterServiceProviderID,a);if(1==l.length){var d={};if(d.servicename=e.ServiceTitle,d.image=l[0].image,d.spname=l[0].spname,d.spinit=l[0].spinit,d.lstAddonService=[],null!=e.AddOnIDs&&null!=e.AddOnIDs&&""!=e.AddOnIDs.trim())for(o=0;o<e.AddOnIDs.split("|~|").length;o++)d.lstAddonService.push({AddonName:e.AddOnIDs.split("|~|")[o]});"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee&&(s=_vgWaitlist.localData.SelectedServicesDetails.filter(t=>t.ServiceId==e.ServiceID),String.isNullOrUndefineOrBlank(s)||(d.image=s[0].Photo)),t.typeService=_vgWaitlist.localData.TypeService.Single,t.serviceList=[],t.serviceList.push(d),n.push(t)}else{var c={};if(c.servicename=e.ServiceTitle,c.proiderList=l,c.lstAddonService=[],null!=e.AddOnIDs&&null!=e.AddOnIDs&&""!=e.AddOnIDs.trim())for(o=0;o<e.AddOnIDs.split("|~|").length;o++)c.lstAddonService.push({AddonName:e.AddOnIDs.split("|~|")[o]});"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee&&(s=_vgWaitlist.localData.SelectedServicesDetails.filter(t=>t.ServiceId==e.ServiceID),String.isNullOrUndefineOrBlank(s)||(c.image=s[0].Photo)),t.typeService=_vgWaitlist.localData.TypeService.Multiple,t.serviceList=[],t.serviceList.push(c),n.push(t)}}}}),t.lstWaitlistServices=n,_vgWaitlist.localData.ThankYouResponse=[],_vgWaitlist.localData.ThankYouResponse.push(t),_vgWaitlist.Waitlist_ThankyouScreen()},Waitlist_ThankyouScreen:function(){var e={UserControlPath:"~/UserControls/ShopDetail/ucAppoinmentBooked.ascx",PageNamePath:"~/detail.aspx",isRemoveFormTag:!1,Parameters:{}},t=new vagaro.ajax;t.datamodel.Token=ApiPath+ApiURLEnumWaitlist.LoadUserControl,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(e){$(".pagebodycontainer").html($("#bookingthankyouDiv").html());var t=$("#dvOnlineAppoinmentBooked");_common.ScrollToToZero();var i=$("#dvOnlineAppoinmentBooked");i.html(""),i.append(e),i.show(),$("#pageSection").hide().removeClass("pagesectionFlex"),$("html, body").removeClass("overflowHidden"),$("html, body").removeClass("modal-open"),$(".modal-backdrop").last().remove(),t.find("#divThankyouAppointment").hide(),t.find("#divThankyouWaitlistdetail").show(),t.find(".appt-location-map").attr("style","background-image: url("+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.CDNUrl+_siteBuilderDetail.BusinessLocationImage+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.BusinessLocationImage+")"),1==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsMobileServiceMandatory&&$(".appt-location-map").removeClass("map-marker-div"),$("#tmplWaitlistMain").tmpl(_vgWaitlist.localData.ThankYouResponse).appendTo("#divappbokingdtl"),t.find("#divAppointment").addClass("appointment-waitlist"),t.find(".apptproviderimg").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),Webflow.destroy(),Webflow.ready(),DisplayFullView(!0),("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()||"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp)&&$("#btnAddWaitlist1").hide(),1==_siteBuilderDetail.isFromAppClip?t.find("#appt-location-map").hide():t.find("#appt-location-map").show(),1!=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsMobileServiceMandatory?t.find("#appt-location-map").show():t.find("#appt-location-map").hide(),(1==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsMobileServiceMandatory||2==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsMobileServiceMandatory)&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0&&$(".appt-location-map").css("background-size","contain")},t.datamodel.data=e,t.datamodel.Error=CallFail_LoadUserControlWithProxy,t.Post(),_shopdetail.SetGoogleMapDirection()},GetServiceProvidersDetail:function(e,t){var i=e.split(","),a=[];return $.grep(i,function(e){$.grep(t,function(t){parseInt(e)==t.SPID&&(objDisplayProvider={},objDisplayProvider.spname=t.ServiceProviderName,objDisplayProvider.image=t.Photo,objDisplayProvider.spinit=FindInitials(t.ServiceProviderName.length>2?t.ServiceProviderName:"","SP"),a.push(objDisplayProvider))})}),a},GetDateTimeForDisplay:function(e,t){return 1==t?moment(new Date(e)).format("ddd, MMM D, YYYY"):moment(new Date(e)).format("h:mm A")},LoadWaitListEvents:function(){$("#newdivSearchTime1").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker1").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(1):($("#selectWaitlist1").toggle(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime2").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker2").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(2):($("#selectWaitlist1").hide(),$("#selectWaitlist2").toggle(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime3").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker3").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(3):($("#selectWaitlist1").hide(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").toggle(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime4").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker4").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(4):($("#selectWaitlist1").hide(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").toggle(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime5").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker5").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(5):($("#selectWaitlist1").hide(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").toggle())})}},$(document).ready(function(){$("#newdivSearchTime1").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker1").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(1):($("#selectWaitlist1").toggle(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime2").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker2").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(2):($("#selectWaitlist1").hide(),$("#selectWaitlist2").toggle(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime3").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker3").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(3):($("#selectWaitlist1").hide(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").toggle(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime4").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker4").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(4):($("#selectWaitlist1").hide(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").toggle(),$("#selectWaitlist5").hide())}),$("#newdivSearchTime5").click(function(){if(1==_vgWaitlist.DuplicateDates($("#newdatepicker5").val()))return!1;SetTopLeft(".calendar-popups-center"),_vgClassSessionSelection.VisibleControlLength("#mobile-check")>0?_vgWaitlist.BindIntervalNewForMobile(5):($("#selectWaitlist1").hide(),$("#selectWaitlist2").hide(),$("#selectWaitlist3").hide(),$("#selectWaitlist4").hide(),$("#selectWaitlist5").toggle())})}),$(document).keyup(function(e){if(13==e.which&&$("#divWaitlistpopup:visible").length&&iosDevices&&"false"==isWidget)return $(".modal:visible").each(function(e,t){centerModal(t)}),!1}),$(document).click(function(e){var t=$(".classForOutSideClick");t.is(e.target)||0!==t.has(e.target).length||$(".clsCloseDropDown").hide()}),function(e){var t;e.mobiscroll.themes.wp={defaults:{width:70,height:68,accent:"none",dateOrder:"mmMMddDDyy",showLabel:!1,onAnimStart:function(i,a,r){e(".dwwl"+a,i).addClass("wpam"),clearTimeout(t[a]),t[a]=setTimeout(function(){e(".dwwl"+a,i).removeClass("wpam")},1e3*r+100)}},init:function(i,a){var r,o;t={},e(".dw",i).addClass("wp-"+a.settings.accent),e(".dwwl",i).on("touchstart mousedown DOMMouseScroll mousewheel",".dw-sel",function(){r=!0,o=e(this).closest(".dwwl").hasClass("wpa"),e(".dwwl",i).removeClass("wpa"),e(this).closest(".dwwl").addClass("wpa")}).on("touchmove mousemove",function(){r=!1}).on("touchend mouseup",function(){r&&o&&e(this).closest(".dwwl").removeClass("wpa")})}},e.mobiscroll.themes["wp light"]=e.mobiscroll.themes.wp}(jQuery),Date.prototype.formatFullYear=function(){var e=this;return e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()},function(e){var t=e.mobiscroll,i=new Date,a={dateFormat:"mm/dd/yy",dateOrder:"mmddy",timeWheels:"hhiiA",timeFormat:"hh:ii A",startYear:i.getFullYear()-100,endYear:i.getFullYear()+1,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortYearCutoff:"+10",monthText:"Month",dayText:"Day",yearText:"Year",hourText:"Hours",minuteText:"Minutes",secText:"Seconds",ampmText:"&nbsp;",nowText:"Now",showNow:!1,stepHour:1,stepMinute:1,stepSecond:1,separator:" ",mergeDate:!0,mergeTime:!0},r=function(i){var r,o=e(this),n={};if(o.is("input")){switch(o.attr("type")){case"date":r="yy-mm-dd";break;case"datetime":r="yy-mm-ddTHH:ii:ssZ";break;case"datetime-local":r="yy-mm-ddTHH:ii:ss";break;case"month":r="yy-mm",n.dateOrder="mmyy";break;case"time":r="HH:ii:ss"}var s=o.attr("min"),l=o.attr("max");s&&(n.minDate=t.parseDate(r,s)),l&&(n.maxDate=t.parseDate(r,l))}var d,c,u,p,h,m,f,g=e.extend({},i.settings),v=e.extend(i.settings,a,n,g),A=0,C=[],y=[],b={},S={y:v.mergeDate?"formatFullYear":"getFullYear",m:"getMonth",d:"getDate",h:v.mergeTime?function(e){var t=e.getHours(),i=Z(t,x)+":"+z(e)+":"+X(e);return i}:function(e){var t=e.getHours();return t=P&&t>=12?t-12:t,Z(t,x)},i:z,s:function(e){return Z(e.getSeconds(),O)},a:X},k=v.preset,D=v.dateOrder,_=v.timeWheels,I=D.match(/D/),w=_.match(/a/i),P=_.match(/h/),T="datetime"==k?v.dateFormat+v.separator+v.timeFormat:"time"==k?v.timeFormat:v.dateFormat,B=new Date,x=v.stepHour,F=v.stepMinute,O=v.stepSecond,M=v.minDate||new Date(v.startYear,0,1),E=v.maxDate||new Date(v.endYear,11,31,23,59,59);if(r=r||T,k.match(/date/i)){if(e.each(["y","m","d"],function(e,t){(d=D.search(new RegExp(t,"i")))>-1&&y.push({o:d,v:t})}),y.sort(function(e,t){return e.o>t.o?1:-1}),e.each(y,function(e,t){b[t.v]=e}),h=[],v.mergeDate){for(p=[],u=[],m=M.getFullYear(),f=E.getFullYear(),A++,d=m;d<=f;d++)for(j=0;j<12;j++)for(c=1;c<32;c++){v.monthNamesShort[j];var $=d,N=32-new Date(d,j,32).getDate(),L=new Date(d,j,c,M.getHours(),M.getMinutes(),M.getSeconds(),M.getMilliseconds());N>=c&&(1==v.unavailableShowDate&&void 0!==v.validDates&&null!=v.validDates&&v.validDates.length>0&&-1==e.inArray(moment(L).format("MMM DD,YYYY"),v.validDates)?p.push(v.dayNamesShort[L.getDay()]+", "+v.monthNamesShort[j]+" "+c+", "+$+" - Unavailable"):p.push(v.dayNamesShort[L.getDay()]+", "+v.monthNamesShort[j]+" "+c+", "+$),u.push(c+"-"+j+"-"+d))}Y(h,u,p,"Date")}else for(c=0;c<3;c++)if(c==b.y){for(A++,p=[],u=[],m=M.getFullYear(),f=E.getFullYear(),d=m;d<=f;d++)u.push(d),p.push(D.match(/yy/i)?d:(d+"").substr(2,2));Y(h,u,p,v.yearText)}else if(c==b.m){for(A++,p=[],u=[],d=0;d<12;d++){var U=D.replace(/[dy]/gi,"").replace(/mm/,d<9?"0"+(d+1):d+1).replace(/m/,d+1);u.push(d),p.push((U.match(/MM/)?U.replace(/MM/,'<span class="dw-mon">'+v.monthNames[d]+"</span>"):U.replace(/M/,'<span class="dw-mon">'+v.monthNamesShort[d]+"</span>"))+(d+1<10?"0":"")+(d+1))}Y(h,u,p,v.monthText)}else if(c==b.d){for(A++,p=[],u=[],d=1;d<32;d++)u.push(d),p.push(D.match(/dd/i)&&d<10?"0"+d:d);Y(h,u,p,v.dayText)}C.push(h)}if(k.match(/time/i)){if(y=[],e.each(["h","i","s","a"],function(e,t){(e=_.search(new RegExp(t,"i")))>-1&&y.push({o:e,v:t})}),y.sort(function(e,t){return e.o>t.o?1:-1}),e.each(y,function(e,t){b[t.v]=A+e}),h=[],v.mergeTime){A++,p=[],u=[];var R=[];if(P)R=_.match(/A/)?["AM","PM"]:["am","pm"];for(d=0;d<(P?R.length:1);d++)for(j=0;j<(P?12:24);j+=x)for(c=0;c<60;c+=F){P&&R[d];var G=P&&0==j?12:j<10?"0"+j:j,W=(c<10?"0":"")+c,V=parseInt(G);0==d&&12==V?V=0:d>0&&V<12&&(V+=12),u.push(V+":"+c),p.push(G+":"+W+" "+R[d])}Y(h,u,p,v.hourText)}else for(c=A;c<A+4;c++)if(c==b.h){for(A++,p=[],u=[],d=0;d<(P?12:24);d+=x)u.push(d),p.push(P&&0==d?12:_.match(/hh/i)&&d<10?"0"+d:d);Y(h,u,p,v.hourText)}else if(c==b.i){for(A++,p=[],u=[],d=0;d<60;d+=F)u.push(d),p.push(_.match(/ii/)&&d<10?"0"+d:d);Y(h,u,p,v.minuteText)}else if(c==b.s){for(A++,p=[],u=[],d=0;d<60;d+=O)u.push(d),p.push(_.match(/ss/)&&d<10?"0"+d:d);Y(h,u,p,v.secText)}else if(c==b.a){A++,Y(h,[0,1],_.match(/A/)?["AM","PM"]:["am","pm"],v.ampmText)}C.push(h)}function H(e,t,i){var a;return void 0!==b[t]?v.mergeDate&&"y"==t?(a=e[b[t]].split("-"))[0]+"-"+parseInt(a[1])+"-"+a[2]:v.mergeTime&&"h"==t?(a=e[b[t]].split(":"))[0]+":"+a[1]:+e[b[t]]:void 0!==i?i:B[S[t]]?B[S[t]]():S[t](B)}function Y(e,t,i,a){e.push({values:i,keys:t,label:a})}function Z(e,t){return Math.floor(e/t)*t}function z(e){return Z(e.getMinutes(),F)}function X(e){return w&&e.getHours()>11?1:0}function q(e){if(v.mergeDate){var t=H(e,"y").split("-"),i=[0,0];return"date"!=v.preset&&(i=H(e,"h",0).split(":")),new Date(t[2],t[1],t[0],i[0],i[1],H(e,"s",0))}i=H(e,"h",0);return new Date(H(e,"y"),H(e,"m"),H(e,"d",1),H(e,"a")?i+12:i,H(e,"i",0),H(e,"s",0))}function J(t){var i=!0;return null!=v.invalid&&null!=v.invalid.dates&&e.each(v.invalid.dates,function(e,a){a.getFullYear()==t.getFullYear()&&a.getMonth()==t.getMonth()&&a.getDate()==t.getDate()&&(i=!1)}),null!=v.validDates&&(i=!1,e.each(v.validDates,function(e,a){(a=moment(a)._d).getFullYear()==t.getFullYear()&&a.getMonth()==t.getMonth()&&a.getDate()==t.getDate()&&(i=!0)})),i}function Q(t){var i=!0;return null!=v.disabledWeekDays&&(i=!1,e.each(v.disabledWeekDays,function(e,a){a==t.getDay()&&(i=!0)})),i}function K(e,t){var i=t.split(":");if(i.length>1){if(-1!=i[1].toLowerCase().indexOf("am"))12==parseInt(i[0])?e.setHours(0):e.setHours(parseInt(i[0]));else if(-1!=i[1].toLowerCase().indexOf("pm")){12==(a=parseInt(i[0],10))||(a+=12),e.setHours(a)}else e.setHours(parseInt(i[0]));e.setMinutes(parseInt(i[1])),e.setSeconds(0),e.setMilliseconds(0)}else{if(-1!=i[0].toLowerCase().indexOf("am"))12==parseInt(i[0])?e.setHours(0):e.setHours(parseInt(i[0]));else if(-1!=i[0].toLowerCase().indexOf("pm")){var a;12==(a=parseInt(i[0],10))||(a+=12),e.setHours(a)}else e.setHours(parseInt(i[0]));e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}return e}return i.setDate=function(e,t,a,r){var o;for(o in b)i.temp[b[o]]=e[S[o]]?e[S[o]]():S[o](e);i.setValue(i.temp,t,a,r)},i.getDate=function(e){return q(e?i.temp:i.values)},{button3Text:v.showNow?v.nowText:void 0,button3:v.showNow?function(){i.setDate(new Date,!1,.3,!0)}:void 0,wheels:C,headerText:function(e){return t.formatDate(T,q(i.temp),v)},formatResult:function(e){return t.formatDate(r,q(e),v)},parseValue:function(e){var i,a=new Date,o=[];try{a=t.parseDate(r,e,v)}catch(e){}for(i in b)o[b[i]]=a[S[i]]?a[S[i]]():S[i](a);return o},validate:function(t,a){var r=i.temp,o={y:M.getFullYear(),m:0,d:1,h:0,i:0,s:0,a:0},n={y:E.getFullYear(),m:11,d:31,h:Z(P?11:23,x),i:Z(59,F),s:Z(59,O),a:1},s=!0,l=!0;(v.mergeDate||v.mergeTime)&&(o={y:M.getFullYear(),m:M.getMonth(),d:M.getDate(),h:M.getHours(),i:M.getMinutes(),s:0,a:0},n={y:E.getFullYear(),m:11,d:31,h:Z(23),i:Z(59,F),s:Z(59,O),a:1}),e.each(["y","m","d","a","h","i","s"],function(i,a){if(void 0!==b[a]){var d,c,u,p=o[a],h=n[a],m=31,f=H(r,a),g=e(".dw-ul",t).eq(b[a]);if(d=H(r,"y"),c=H(r,"m"),u=H(r,"d"),"d"==a&&(h=m=32-new Date(d,c,32).getDate(),I&&e(".dw-li",g).each(function(){var t=e(this),i=t.data("val"),a=new Date(d,c,i).getDay(),r=D.replace(/[my]/gi,"").replace(/dd/,i<10?"0"+i:i).replace(/d/,i);e(".dw-i",t).html(r.match(/DD/)?r.replace(/DD/,'<span class="dw-day">'+v.dayNames[a]+"</span>"):r.replace(/D/,'<span class="dw-day">'+v.dayNamesShort[a]+"</span>"))})),s&&M&&(p=M[S[a]]?M[S[a]]():S[a](M)),l&&E&&(h=E[S[a]]?E[S[a]]():S[a](E)),"y"!=a&&(!v.mergeTime||"h"!=a)){var A=e(".dw-li",g).index(e('.dw-li[data-val="'+p+'"]',g)),C=e(".dw-li",g).index(e('.dw-li[data-val="'+h+'"]',g));e(".dw-li",g).removeClass("dw-v").slice(A,C+1).addClass("dw-v"),"d"!=a&&"y"!=a||e(".dw-li",g).removeClass("dw-h").slice(m).addClass("dw-h")}if(v.mergeTime&&"h"==a){var y=r[0].split("-"),k=r[1].split(":"),_=new Date(y[2],y[1],y[0],k[0],k[1]);if(_<M&&(_=M),_>E&&(_=E),null!=v.disabledMobileTimePicker&&void 0!==v.disabledMobileTimePicker)if(v.disabledMobileTimePicker.length>0){var w=_.getDay()+1,P=v.disabledMobileTimePicker.filter(function(e){return e.DayID===w})[0];if(null!=typeof P&&null!=P){var T,B,x=new Date(_);T=new Date(K(x,P.FromTime)),f=_>(B=new Date(K(x,P.ToTime)))?B.getHours()+":"+B.getMinutes():T>_?T.getHours()+":"+T.getMinutes():_.getHours()+":"+_.getMinutes()}else f=_.getHours()+":"+_.getMinutes()}else f=_.getHours()+":"+_.getMinutes();else f=_.getHours()+":"+_.getMinutes()}else if(v.mergeDate&&"y"==a){var F=new Date(parseInt(f.split("-")[2]),parseInt(f.split("-")[1]),parseInt(f.split("-")[0]));F<new Date(parseInt(p.split("-")[2]),parseInt(p.split("-")[1]),parseInt(p.split("-")[0]))&&(f=p),F>new Date(parseInt(h.split("-")[2]),parseInt(h.split("-")[1]),parseInt(h.split("-")[0]))&&(f=h)}else f<p&&(f=p),f>h&&(f=h);if(s&&(s=f==p),l&&(l=f==h),null!=v.invalid)if(v.mergeDate&&"y"==a){var O=new Date(parseInt(f.split("-")[2]),parseInt(f.split("-")[1]),parseInt(f.split("-")[0])),$=!0;if(e.each(v.invalid.dates,function(e,t){t.getFullYear()==tedateToSelectmpDate.getFullYear()&&t.getMonth()==O.getMonth()&&t.getDate()==O.getDate()&&($=!1)}),!$){var N=!1,L=new Date(O);for(intI=1;intI<=31&&(e(".dw-li",g).eq(L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear()).removeClass("dw-v"),L.setDate(L.getDate()-1),!(L<M||L>E));intI++)if(J(L)){f=L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear(),N=!0;break}if(!N){var L=new Date(O);for(intI=1;intI<=31&&(e(".dw-li",g).eq(L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear()).removeClass("dw-v"),L.setDate(L.getDate()+1),!(L<M||L>E));intI++)if(J(L)){f=L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear(),N=!0;break}}if(!N)f=(L=new Date).getDate()+"-"+L.getMonth()+"-"+L.getFullYear()}}else if(!v.mergeDate&&"d"==a){var U=[];if(v.invalid.dates&&e.each(v.invalid.dates,function(e,t){t.getFullYear()==d&&t.getMonth()==c&&U.push(t.getDate()-1)}),v.invalid.daysOfWeek){var R,G=new Date(d,c,1).getDay();e.each(v.invalid.daysOfWeek,function(e,t){for(R=t-G;R<m;R+=7)R>=0&&U.push(R)})}v.invalid.daysOfMonth&&e.each(v.invalid.daysOfMonth,function(e,t){(t=(t+"").split("/"))[1]?t[0]-1==c&&U.push(t[1]-1):U.push(t[0]-1)}),e.each(U,function(t,i){e(".dw-li",g).eq(i).removeClass("dw-v")})}if(null!=v.validDates)if(v.mergeDate&&"y"==a){$=!1,O=new Date(parseInt(f.split("-")[2]),parseInt(f.split("-")[1]),parseInt(f.split("-")[0]));if(e.each(v.validDates,function(e,t){(t=moment(t)._d).getFullYear()==O.getFullYear()&&t.getMonth()==O.getMonth()&&t.getDate()==O.getDate()&&($=!0)}),!$){N=!1,L=new Date(O);for(intI=1;intI<=186&&(e(".dw-li",g).eq(L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear()).removeClass("dw-v"),L.setDate(L.getDate()-1),!(L<M||L>E));intI++)if(J(L)){f=L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear(),N=!0;break}if(!N){L=new Date(O);for(intI=1;intI<=186;intI++)if(e(".dw-li",g).eq(L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear()).removeClass("dw-v"),L.setDate(L.getDate()+1),J(L)){f=L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear(),N=!0;break}}if(!N)f=(L=new Date).getDate()+"-"+L.getMonth()+"-"+L.getFullYear();e(".dw-li",g).eq(f).removeClass("dw-v")}}else if(!v.mergeDate&&"d"==a&&v.validDates.length>0){$=!1,O=new Date(d,c,u);var W=new Date(O);if(e.each(v.validDates,function(e,t){(t=moment(t)._d).getFullYear()==O.getFullYear()&&t.getMonth()==O.getMonth()&&t.getDate()==O.getDate()&&($=!0)}),!$){N=!1,L=new Date(O);for(intI=1;intI<=186;intI++){var V=e(".dw-ul",t).eq(b.y);e(".dw-li",V).eq(L.getFullYear()).removeClass("dw-v");var j=e(".dw-ul",t).eq(b.m);e(".dw-li",j).eq(L.getMonth()+1).removeClass("dw-v");var Y=e(".dw-ul",t).eq(b.d);if(e(".dw-li",Y).eq(L.getDate()).removeClass("dw-v"),L.setDate(L.getDate()-1),L<M||L>E)break;if(J(L)){W=new Date(L),N=!0;break}}if(!N){L=new Date(O);for(intI=1;intI<=186;intI++){V=e(".dw-ul",t).eq(b.y);e(".dw-li",V).eq(L.getFullYear()).removeClass("dw-v");j=e(".dw-ul",t).eq(b.m);e(".dw-li",j).eq(L.getMonth()+1).removeClass("dw-v");Y=e(".dw-ul",t).eq(b.d);if(e(".dw-li",Y).eq(L.getDate()).removeClass("dw-v"),L.setDate(L.getDate()+1),L<M||L>E)break;if(J(L)){W=new Date(L),N=!0;break}}}N||(W=new Date),O!=W&&(r[b.y]=W.getFullYear(),r[b.m]=W.getMonth(),f=W.getDate())}}if(null==v.validDates&&null!=v.disabledWeekDays&&void 0!==v.disabledWeekDays&&v.mergeDate&&"y"==a){$=!0;var Z=(O=new Date(parseInt(f.split("-")[2]),parseInt(f.split("-")[1]),parseInt(f.split("-")[0]))).getDay();if(e.each(v.disabledWeekDays,function(e,t){t==Z&&($=!1)}),!$){N=!1,L=new Date(O);for(intI=1;intI<=186&&(e(".dw-li",g).eq(L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear()).removeClass("dw-v"),L.setDate(L.getDate()-1),!(L<M||L>E));intI++)if(!Q(L)){f=L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear(),N=!0;break}if(!N){L=new Date(O);for(intI=1;intI<=186&&(e(".dw-li",g).eq(L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear()).removeClass("dw-v"),L.setDate(L.getDate()+1),!(L<M||L>E));intI++)if(!Q(L)){f=L.getDate()+"-"+L.getMonth()+"-"+L.getFullYear(),N=!0;break}}if(!N)f=(L=new Date).getDate()+"-"+L.getMonth()+"-"+L.getFullYear();e(".dw-li",g).eq(f).removeClass("dw-v")}}r[b[a]]=f}})}}};e.each(["date","time","datetime"],function(e,i){t.presets[i]=r,t.presetShort(i)}),t.formatDate=function(t,i,r){if(!i)return null;var o,n=e.extend({},a,r),s=function(e){for(var i=0;o+1<t.length&&t.charAt(o+1)==e;)i++,o++;return i},l=function(e,t,i){var a=""+t;if(s(e))for(;a.length<i;)a="0"+a;return a},d=function(e,t,i,a){return s(e)?a[t]:i[t]},c="",u=!1;for(o=0;o<t.length;o++)if(u)"'"!=t.charAt(o)||s("'")?c+=t.charAt(o):u=!1;else switch(t.charAt(o)){case"d":c+=l("d",i.getDate(),2);break;case"D":c+=d("D",i.getDay(),n.dayNamesShort,n.dayNames);break;case"o":c+=l("o",(i.getTime()-new Date(i.getFullYear(),0,0).getTime())/864e5,3);break;case"m":c+=l("m",i.getMonth()+1,2);break;case"M":c+=d("M",i.getMonth(),n.monthNamesShort,n.monthNames);break;case"y":c+=s("y")?i.getFullYear():(i.getYear()%100<10?"0":"")+i.getYear()%100;break;case"h":var p=i.getHours();c+=l("h",p>12?p-12:0==p?12:p,2);break;case"H":c+=l("H",i.getHours(),2);break;case"i":c+=l("i",i.getMinutes(),2);break;case"s":c+=l("s",i.getSeconds(),2);break;case"a":c+=i.getHours()>11?"pm":"am";break;case"A":c+=i.getHours()>11?"PM":"AM";break;case"'":s("'")?c+="'":u=!0;break;default:c+=t.charAt(o)}return c},t.parseDate=function(t,i,r){var o=new Date;if(!t||!i)return o;i="object"==typeof i?i.toString():i+"";var n,s=e.extend({},a,r),l=s.shortYearCutoff,d=o.getFullYear(),c=o.getMonth()+1,u=o.getDate(),p=-1,h=o.getHours(),m=o.getMinutes(),f=0,g=-1,v=!1,A=function(e){var i=n+1<t.length&&t.charAt(n+1)==e;return i&&n++,i},C=function(e){A(e);var t=new RegExp("^\\d{1,"+("@"==e?14:"!"==e?20:"y"==e?4:"o"==e?3:2)+"}"),a=i.substr(S).match(t);return a?(S+=a[0].length,parseInt(a[0],10)):0},y=function(e,t,a){var r,o=A(e)?a:t;for(r=0;r<o.length;r++)if(i.substr(S,o[r].length).toLowerCase()==o[r].toLowerCase())return S+=o[r].length,r+1;return 0},b=function(){S++},S=0;for(n=0;n<t.length;n++)if(v)"'"!=t.charAt(n)||A("'")?b():v=!1;else switch(t.charAt(n)){case"d":u=C("d");break;case"D":y("D",s.dayNamesShort,s.dayNames);break;case"o":p=C("o");break;case"m":c=C("m");break;case"M":c=y("M",s.monthNamesShort,s.monthNames);break;case"y":d=C("y");break;case"H":h=C("H");break;case"h":h=C("h");break;case"i":m=C("i");break;case"s":f=C("s");break;case"a":g=y("a",["am","pm"],["am","pm"])-1;break;case"A":g=y("A",["am","pm"],["am","pm"])-1;break;case"'":A("'")?b():v=!0;break;default:b()}if(d<100&&(d+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d<=("string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10))?0:-100)),p>-1)for(c=1,u=p;;){var k=32-new Date(d,c-1,32).getDate();if(u<=k)break;c++,u-=k}h=-1==g?h:g&&h<12?h+12:g||12!=h?h:0;var D=new Date(d,c-1,u,h,m,f);if(D.getFullYear()!=d||D.getMonth()+1!=c||D.getDate()!=u)throw"Invalid date";return D}}(jQuery);var dtCh="/",minYear=1900,maxYear=2100;function isInteger(e){var t;for(t=0;t<e.length;t++){var i=e.charAt(t);if(i<"0"||i>"9")return!1}return!0}function stripCharsInBag(e,t){var i,a="";for(i=0;i<e.length;i++){var r=e.charAt(i);-1==t.indexOf(r)&&(a+=r)}return a}function daysInFebruary(e){return e%4!=0||e%100==0&&e%400!=0?28:29}function DaysArray(e){for(var t=new Array(12),i=1;i<=e;i++)t[i]=31,4!=i&&6!=i&&9!=i&&11!=i||(t[i]=30),2==i&&(t[i]=29);return t}function chkDate(e,t){var i=DaysArray(12),a=e.indexOf(dtCh),r=e.indexOf(dtCh,a+1),o=e.substring(0,a),n=e.substring(a+1,r),s=e.substring(r+1);strYr=s,"0"==n.charAt(0)&&n.length>1&&(n=n.substring(1)),"0"==o.charAt(0)&&o.length>1&&(o=o.substring(1));for(var l=1;l<=3;l++)"0"==strYr.charAt(0)&&strYr.length>1&&(strYr=strYr.substring(1));if(month=parseInt(o),day=parseInt(n),year=parseInt(strYr),-1==a||-1==r)return!1;if(o.length<1||month<1||month>12)return!1;if(1==month){if(day>31)return!1}else if(day>i[month])return!1;if(n.length<1||day<1||day>31||2==month&&day>daysInFebruary(year))return!1;if(4!=s.length||0==year||year<minYear||year>maxYear)return!1;if(-1!=e.indexOf(dtCh,r+1)||0==isInteger(stripCharsInBag(e,dtCh)))return!1;if(t){var d=new Date;if(new Date(e).getTime()>d.getTime())return!1}return!0}var iPadAndroid=(userAgent=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase()).match(/ipad/i)||userAgent.match(/iphone/i)||userAgent.match(/itouch/i)||userAgent.match(/android/i)||!1;function dummyreleasefamily(){}!function(e){_sharing={},_sharing.BusinessID=0,_sharing.LoggedInUserId=0,_sharing.isLoadCustFromDB,_sharing.syncDuration,_sharing.IsDisableAutoFillFromInputBox="True",_sharing._URL=window.URL||window.webkitURL,_sharing.UploadedFFImageName="",_sharing.UploadedFFImageStream="",_sharing.OldUploadedFFImageName="",_sharing.IsImageUploaded=!1,_sharing.FFUserEmailId="",_sharing.PreviousFFUserEmailId="",_sharing.FFUserId=0,_sharing.UserFamilyFriendID=0,_sharing.FFMasterUserId=0,_sharing.FFMasterUserFullName="",_sharing.UserExistsMsg="Only employees can edit their own profile.",_sharing.defaultYear="",_sharing.UserImageSize="",_sharing.parentPage="",_sharing.SelectedFFRelation="",_sharing.ExistingUserRelationWithMaster="",_sharing.ExistingUserRelation="",_sharing.FFIsInvitationAccepted=0,_sharing.IsEditMode=!1,_sharing.IsViceVersaUser=!1,_sharing.curSelectedEleForAction=null,_sharing.VagaroYearsTaken=0,_sharing.IsUserCellNotValid=!1,_sharing.CountryId=1,_sharing.CellCountryID=1,_sharing.IsFirstTimeKeyUp=!1,_sharing.mousedownHappened=!1,_sharing.IndexedPetDbData=null,_sharing.SourceButtonName="",_sharing.IsOnLineShoppingCart=!0,_sharing.IsOverrideInfo=!0,_sharing.Age=-1,_sharing.IsShareAppointments=!1,_sharing.ExistingIsShareAppointments=!1,_sharing.IsShareAppointmentsAccepted=0,_sharing.strFFMasterUserId="",_sharing.strFFUserId="",_sharing.strUserFamilyFriendID="";var t=!1,a={};e("#hdnCellCountryID").val();DefaultCellCountryID="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:"undefined"!=typeof glbBusinessCountryId&&null!=glbBusinessCountryId?glbBusinessCountryId:"undefined"!=typeof BusinessCountryID&&null!=BusinessCountryID?BusinessCountryID:1,e(document).ready(function(){if("true"==_sharing.IsDisableAutoFillFromInputBox.toLowerCase())try{var i=get_browser();navigator.userAgent.search("Firefox")>=0?i.version>38?e("#textfiled").attr("autocomplete","new-password"):e("#textfiled").attr("autocomplete","off"):navigator.userAgent.search("Edge")>=0?e("#textfiled").attr("autocomplete","off"):navigator.userAgent.search("Chrome")>=0?i.version>64?e("#textfiled").attr("autocomplete","new-password"):e("#textfiled").attr("autocomplete","false"):e("#textfiled").attr("autocomplete","off")}catch(e){}setTimeout(function(){"undefined"!=typeof _siteBuilderDetail&&"true"!=_siteBuilderDetail.isRequestFromVagaro||(_sharing.bindImageUploadEventsForFFSharing(),_sharing.BindYearandWeight(),_sharing.GetAllPetDetails());try{if(window.parent.location.href.toString().toLowerCase().indexOf("/livestream/")<-1)return}catch(e){}},500);try{i=get_browser();navigator.userAgent.search("Firefox")>=0?i.version>38?e("div#pnlAddFamilyFriendSharingModal input[type='text'].addeditff-txtinput").attr("autocomplete","new-password"):e("div#pnlAddFamilyFriendSharingModal input[type='text'].addeditff-txtinput").attr("autocomplete","off"):navigator.userAgent.search("Edge")>=0?e("div#pnlAddFamilyFriendSharingModal input[type='text'].addeditff-txtinput").attr("autocomplete","off"):navigator.userAgent.search("Chrome")>=0?i.version>64?e("div#pnlAddFamilyFriendSharingModal input[type='text'].addeditff-txtinput").attr("autocomplete","new-password"):e("div#pnlAddFamilyFriendSharingModal input[type='text'].addeditff-txtinput").attr("autocomplete","false"):e("div#pnlAddFamilyFriendSharingModal input[type='text'].addeditff-txtinput").attr("autocomplete","off")}catch(e){}e("div#pnlAddFamilyFriendSharingModal").on("click",function(){void 0!==e("#selFFSpeciesBreed").data("select2")&&void 0!==e("#selFFSpeciesBreed").data("isopen")&&e("#selFFSpeciesBreed").data("isopen")&&e("#selFFSpeciesBreed").select2("close")}),e("#ffdivEditDelete, #aCaneclEditFFProfilePic").click(function(){e(".ff-gallery-edit-dropdown").toggle()}),e("#divAddEditPopupFFProfilePic3DotMenu").mouseleave(function(){e(".ff-gallery-edit-dropdown").hide()}),DefaultCellCountryID="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:"undefined"!=typeof glbBusinessCountryId&&null!=glbBusinessCountryId?glbBusinessCountryId:"undefined"!=typeof BusinessCountryID&&null!=BusinessCountryID?BusinessCountryID:1;void 0!==getCookie&&void 0!==ProximityCookieName&&null!=typeof ProximityCookieName&&""!=typeof ProximityCookieName&&getCookie(ProximityCookieName),t=!0}),e("#txtCustomerSearchFriend").on("click",function(e){_sharing.FriendsAssignVariables(),txtSearchCustomer_focus()}),e("#txtCustomerSearchFriend").on("keyup",function(t){if(1==_sharing.IsFirstTimeKeyUp){if(""==e(this).val())return!1;_sharing.FriendsAssignVariables(),txtSearchCustomer_focus(),_sharing.IsFirstTimeKeyUp=!1}}),_sharing.HideParent=function(){setTimeout(function(){e("#ulCustomersFriends > li").each(function(){e(this).attr("data-custid")==document.getElementById("hdnUserID").value&&e(this).hide()})},100)},_sharing.BindYearandWeight=function(){var t=new Date,i=t.getFullYear()-(0==_sharing.VagaroYearsTaken?120:_sharing.VagaroYearsTaken),a=t.getFullYear();if(e("#cboFFYear").empty(),e("#cboFFYear").append(e("<option></option>").val(-1).html("Year")),i<a)for(var r=i;r<=a;r++)e("#cboFFYear").append(e("<option></option>").val(r).html(r));1==_sharing.CountryId||2==_sharing.CountryId?e("#txtFFWeight").attr("placeholder","Enter Weight (lbs)"):3!=_sharing.CountryId&&4!=_sharing.CountryId||e("#txtFFWeight").attr("placeholder","Enter Weight (KG)")},_sharing.FriendsAssignVariables=function(){var e={},t="searchfriendfamilycustomer";null!=glbPageName&&null!=cache_PageType&&cache_PageType[t]!=glbPageName&&(e.liSelectedClassName="drpselected",e.isFromiPadAndroid="true"==iPadAndroid.toString(),e.isLoadCustFromDB="true"==_sharing.isLoadCustFromDB.toLowerCase(),e.syncDuration=parseInt(_sharing.syncDuration),e.HasCustomerRight=!0,e.BusinessId=_sharing.BusinessID),InitializecomponentWrapper(t,e)},_sharing.containsAlphabet=function(e){return/[a-zA-Z]/.test(e)},_sharing.ShowFriendFamilyPopup=function(){_sharing.IsHasCustomerModifyRights()&&("onlinemyaccount"==_sharing.parentPage.toLowerCase()||"onlineclassbook"==_sharing.parentPage.toLowerCase()||"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase()?_sharing.OpenCreateNewFamilyFriendPopup():(e("#pnlFamilyFriendSharingModal").modal("show"),_sharing.IsFirstTimeKeyUp=!0),"checkout"==_sharing.parentPage.toLowerCase()&&_checkout.SetTabIndex())},e("#pnlFamilyFriendSharingModal").on("show.bs.modal",function(){centerModal(this),e("#txtCustomerSearchFriend").val(""),"customermodule"==_sharing.parentPage.toLowerCase()?(_sharing.FFMasterUserId=e("#hdnCustomerID").length>0?parseInt(e("#hdnCustomerID").val()):0,_sharing.FFMasterUserFullName=e("#FullName").length>0?e("#FullName").text():"User"):"checkout"==_sharing.parentPage.toLowerCase()?(_sharing.FFMasterUserId=parseInt(_checkoutCalculate.payeeId),_sharing.FFMasterUserFullName=_checkoutCalculate.payeeFirstName+" "+_checkoutCalculate.payeeLastName):"onlinemyaccount"!=_sharing.parentPage.toLowerCase()&&"onlineclassbook"!=_sharing.parentPage.toLowerCase()&&"onlineshoppingcart"!=_sharing.parentPage.toLowerCase()&&"booknowupsell"!=_sharing.parentPage.toLowerCase()||(_sharing.FFMasterUserId=UserID,_sharing.FFMasterUserFullName=FullUserName)}),e("#pnlFamilyFriendSharingModal").on("shown.bs.modal",function(){e("#txtCustomerSearchFriend").focus()}),e("#pnlAddFamilyFriendSharingModal").on("show.bs.modal",function(){centerModal(this),e("#divAddEditFamilyFriendContent").scrollTop(0),e("#divAddNewFamilyFriendTabLink a.w-tab-link:first").click(),"customermodule"==_sharing.parentPage.toLowerCase()?(_sharing.FFMasterUserId=e("#hdnCustomerID").length>0?parseInt(e("#hdnCustomerID").val()):0,_sharing.FFMasterUserFullName=e("#FullName").length>0?e("#FullName").text():"User"):"checkout"==_sharing.parentPage.toLowerCase()?(_sharing.FFMasterUserId=parseInt(_checkoutCalculate.payeeId),_sharing.FFMasterUserFullName=_checkoutCalculate.payeeFirstName+" "+_checkoutCalculate.payeeLastName):"onlineclassbook"==_sharing.parentPage.toLowerCase()||"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase()?(_sharing.FFMasterUserId=UserID,_sharing.FFMasterUserFullName=FullUserName):"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&(_sharing.FFMasterUserId=UserID,_sharing.FFMasterUserFullName=FullUserName,_sharing.strFFMasterUserId=strUserID),e(".span-masteruser-fullname").html(_sharing.FFMasterUserFullName),_sharing.IsCCPaymentSupport?e("#divShareCCChkContainer").show():e("#divShareCCChkContainer").hide(),_sharing.ShowHideLoadingPanel(!1),void 0!==setPopupPosi&&"undefined"!=typeof WebsiteBuilderType&&"Builder"==WebsiteBuilderType&&(iOS||isAndroidMobile||(e("#pnlAddFamilyFriendSharingModal").addClass("modalforWb"),setPopupPosi(e("#pnlAddFamilyFriendSharingModal"))))}),e("#pnlAddFamilyFriendSharingModal").on("shown.bs.modal",function(){"undefined"==typeof vgAppicationType&&e("#divAddNewFamilyFriendContainer div.ff-info-parent").find(":text").filter(":visible:enabled").first().focus()}),e("#pnlAddFamilyFriendSharingModal").on("hide.bs.modal",function(){_sharing.ClearControls()}),e("#pnlFamilyFriendSharingModal").on("hidden.bs.modal",function(){e("#divCustomersFriends").hide(),e("body").removeClass("familyfriendpopup")}),e("#pnlAddFamilyFriendSharingModal").on("hidden.bs.modal",function(){e("#pnlFamilyFriendSharingModal").is(":visible")&&e("#txtCustomerSearchFriend").focus()}),_sharing.ajaxCall=function(e,t,i,a,r,o,n){var s=new vagaro.ajax;s.datamodel.Token=e,s.datamodel.data=t,s.datamodel.callback=i,s.datamodel.Error=a,!0===n&&(s.datamodel.IsNewVagaroAPI=n),!1===o&&(s.datamodel.async=!1),!0===r?s.PostQue():s.Post()},e("#txtFFWeight").keypress(function(t){var i=e(this);46==t.which&&-1==i.val().indexOf(".")||!(t.which<48||t.which>57)||0==t.which||8==t.which||t.preventDefault();var a=e(this).val();-1!=a.indexOf(".")&&a.substring(a.indexOf(".")).length>2&&0!=t.which&&8!=t.which&&e(this)[0].selectionStart>=a.length-2&&t.preventDefault()}),_sharing.restrictAlphabets=function(e){var t=e.which||e.keycode;return t>=48&&t<=57||8==t||t>=35&&t<=40||46==t},_sharing.OpenCreateNewFamilyFriendPopup=function(t){_sharing.parentPage=void 0!==t&&null!=t&&""!=t.trim()?t:_sharing.parentPage,void 0!==_sharing.parentPage&&null!=_sharing.parentPage&&"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&e(".active-menuclick").length>0&&void 0!==GatherClickElement&&(GatherClickElement(e(".active-menuclick")),e(".active-menuclick").removeClass("active-menuclick")),0==_sharing.IsEditMode&&(e("#txtFFPhone").length>0&&friendfamilycellPhone.setPhoneData(_sharing.CellCountryID,""),e("#txtFFPhoneOpt").length>0&&childcellphone.setPhoneData(_sharing.CellCountryID,"")),_sharing.IsHasCustomerModifyRights&&(e("#pnlAddFamilyFriendSharingModal").modal("show"),void 0!==setPopupPosi&&void 0!==getQueryStringData&&"Builder"==getQueryStringData("Type")&&(iOS||isAndroidMobile||(e("#pnlAddFamilyFriendSharingModal").addClass("modalforWb"),setPopupPosi(e("#pnlAddFamilyFriendSharingModal")))))},_sharing.CloseCreateNewFamilyFriendPopup=function(){e("#pnlAddFamilyFriendSharingModal").modal("hide")},_sharing.onTabChange=function(i,a,r){e("#divAddNewFamilyFriendContainer").hasClass("hide-block-ffsharing")&&(_sharing.AddErrorHideClassforFFSharing(!1),DefaultCellCountryID="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:"undefined"!=typeof glbBusinessCountryId&&null!=glbBusinessCountryId?glbBusinessCountryId:"undefined"!=typeof BusinessCountryID&&null!=BusinessCountryID?BusinessCountryID:1,void 0!==getCookie&&void 0!==ProximityCookieName&&null!=typeof ProximityCookieName&&""!=typeof ProximityCookieName&&(cookie=getCookie(ProximityCookieName)),1==t&&(friendfamilycellPhone=e("#txtFFPhone").PhonePlugin({UserRole:2,ControlText:"Primary Phone",CurrentLocationCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):DefaultCellCountryID,CountryId:"undefined"!=typeof CellCountryID&&null!=CellCountryID?CellCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):DefaultCellCountryID}),childcellphone=e("#txtFFPhoneOpt").PhonePlugin({UserRole:2,ControlText:"Primary Phone",CurrentLocationCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):DefaultCellCountryID,CountryId:"undefined"!=typeof CellCountryID&&null!=CellCountryID?CellCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):DefaultCellCountryID})),t=!1),_sharing.SelectedFFRelation=i,e("#divAddNewFamilyFriendContainer .ffsharing-showhide").hide(),e("#divAddNewFamilyFriendContainer .ffsharing-"+i.toLowerCase()).show(),e("#divAddNewFamilyFriendTabLink a.w-tab-link").removeClass("w--current").attr("aria-selected",!1),e(a).addClass("w--current").attr("aria-selected",!0),"pet"==i.toLowerCase()?e("div#divAddNewFamilyFriendContainer div.w-tab-body.ffsharing-tabbody").addClass("border-bottom-none"):e("div#divAddNewFamilyFriendContainer div.w-tab-body.ffsharing-tabbody").removeClass("border-bottom-none"),3!=e("#divFFGendarSelectOptions").val()||"pet"!=_sharing.SelectedFFRelation.toLowerCase()&&"child"!=_sharing.SelectedFFRelation.toLowerCase()&&"friend"!=_sharing.SelectedFFRelation.toLowerCase()?e("#divFFGendarSelectOptions").val(3):(e("#divFFGendarSelectOptions").val(3),e("#divFFGendarSelectOptions").removeClass("errorInput")),"undefined"==typeof vgAppicationType&&e("#divAddNewFamilyFriendContainer div.ff-info-parent").find(":text").filter(":visible:enabled").first().focus()},_sharing.onToggleChange=function(t){null==t&&"undefined"==t&&""==t||(1==t.checked?(e(t).attr("aria-label","Toggle on for"),e(t).next().attr("aria-checked",!0)):(e(t).attr("aria-label","Toggle off for"),e(t).next().attr("aria-checked",!1))),e("#ADDlblTitle").removeAttr("tabindex")},_sharing.checkBirthDate=function(){var t=e("#cboFFDay").val(),i=e("#cboFFMonth").val(),a=e("#cboFFYear").val(),r=!0;return"-1"==t&&"-1"==i&&"-1"==a||(r=!1,r=chkDate(i+"/"+t+"/"+a,!0)),r},_sharing.applyValidationToElement=function(t,i){t.firstFalseElement=t.isValid?i:t.firstFalseElement,t.isValid=!1,e("#"+i).addClass("errorInput")},_sharing.IsAllInputDetailsValid=function(t){if(_sharing.mousedownHappened)return _sharing.mousedownHappened=!1,!0;var i=e("#cboFFDay").val(),a=e("#cboFFMonth").val(),r=e("#cboFFYear").val();_sharing.Age=_sharing.CalculateAge(a+"/"+i+"/"+r);var o={isValid:!0,firstFalseElement:null},n=""!=e("#hdnIsSubmitedFormOnce").val()&&"True"==e("#hdnIsSubmitedFormOnce").val(),s=/^[A-Za-z0-9_\+-]+(\.[A-Za-z0-9_\+-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.([A-Za-z]{2,10})$/;return e("#txtFFEmail:visible:enabled").length>0&&(void 0!==t&&"txtFFEmail"==t.id||void 0===t)&&(""==e.trim(e("#txtFFEmail").val())?n&&_sharing.applyValidationToElement(o,"txtFFEmail"):e("#txtFFEmail").val().length>100||!s.test(e("#txtFFEmail").val())?n&&(_sharing.applyValidationToElement(o,"txtFFEmail"),e("#txtFFEmail").val().length>100?_sharing.ShowHidePassiveAlert(2,"Email addresses cannot exceed more than 100 characters."):_sharing.ShowHidePassiveAlert(2,"Please enter a valid email address.")):(n&&e("#txtFFEmail").removeClass("errorInput"),void 0!==t&&"txtFFEmail"==t.id&&_sharing.CheckCustomerExists(e("#txtFFEmail")))),e("#txtFFEmailOpt:visible:enabled").length>0&&""!=e.trim(e("#txtFFEmailOpt").val())?(void 0!==t&&"txtFFEmailOpt"==t.id||void 0===t)&&(e("#txtFFEmailOpt").val().length>100||!s.test(e("#txtFFEmailOpt").val())?n&&(_sharing.applyValidationToElement(o,"txtFFEmailOpt"),e("#txtFFEmailOpt").val().length>100?_sharing.ShowHidePassiveAlert(2,"Email addresses cannot exceed more than 100 characters."):_sharing.ShowHidePassiveAlert(2,"Please enter a valid email address.")):(n&&e("#txtFFEmailOpt").removeClass("errorInput"),void 0!==t&&"txtFFEmailOpt"==t.id&&_sharing.CheckCustomerExists(e("#txtFFEmailOpt")))):e("#txtFFEmailOpt").removeClass("errorInput"),e("#txtFFWeight:visible:enabled").length>0&&""!=e.trim(e("#txtFFWeight").val())?(void 0!==t&&"txtFFWeight"==t.id&&n||void 0===t)&&(isNaN(parseFloat(e("#txtFFWeight").val()))||parseFloat(e("#txtFFWeight").val()).toFixed(2)>999.99?(_sharing.applyValidationToElement(o,"txtFFWeight"),_sharing.ShowHidePassiveAlert(2,"Please enter valid weight. It should not be greater then 999.99.")):e("#txtFFWeight").removeClass("errorInput")):e("#txtFFWeight").removeClass("errorInput"),e("#txtFFfirstName:visible:enabled").length>0&&(void 0!==t&&"txtFFfirstName"==t.id&&n||void 0===t)&&(""==e.trim(e("#txtFFfirstName").val())?_sharing.applyValidationToElement(o,"txtFFfirstName"):e("#txtFFfirstName").val().length>100?(_sharing.applyValidationToElement(o,"txtFFfirstName"),_sharing.ShowHidePassiveAlert(2,"First name cannot be more than 100 characters.")):e("#txtFFfirstName").removeClass("errorInput")),e("#txtFFlastName:visible:enabled").length>0&&(void 0!==t&&"txtFFlastName"==t.id&&n||void 0===t)&&(""==e.trim(e("#txtFFlastName").val())?_sharing.applyValidationToElement(o,"txtFFlastName"):e("#txtFFlastName").val().length>100?(_sharing.applyValidationToElement(o,"txtFFlastName"),_sharing.ShowHidePassiveAlert(2,"Last name cannot be more than 100 characters.")):e("#txtFFlastName").removeClass("errorInput")),e("#divFFGendarSelectOptions:visible:enabled").length>0&&(void 0!==t&&"divFFGendarSelectOptions"==t.id&&n||void 0===t)&&(-1==e("#divFFGendarSelectOptions").val()?_sharing.applyValidationToElement(o,"divFFGendarSelectOptions"):e("#divFFGendarSelectOptions").removeClass("errorInput")),e("#cboFFMonth:visible:enabled").length>0&&e("#cboFFDay:visible:enabled").length>0&&e("#cboFFYear:visible:enabled").length>0&&void 0===t&&n&&(_sharing.checkBirthDate()?(e("#cboFFMonth").removeClass("errorInput"),e("#cboFFDay").removeClass("errorInput"),e("#cboFFYear").removeClass("errorInput")):(o.isValid=!1,e("#cboFFMonth").addClass("errorInput"),e("#cboFFDay").addClass("errorInput"),e("#cboFFYear").addClass("errorInput"))),e("#divShareCCChkContainer:visible").length>0&&e("#ffCCfile:enabled").length>0&&_sharing.IsCCPaymentSupport&&0==_sharing.IsCallFromOnlinePage()&&(1==e("#ffCCfile").prop("checked")&&0==_sharing.IsOnLineShoppingCart?(_sharing.applyValidationToElement(o,"ffCCfile"),swal({title:"",text:"Credit Card Processing is required to add a card on file. Would you like to sign up for Credit Card Processing?",timer:4e3,showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Sign Up for Credit Card Processing",cancelButtonText:"Not Now",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(e){e&&(window.location.href="/merchants/settings/premiumfeature/creditcardzenswipecms")}),setTimeout(function(){e(".gencutom-title").html("Credit Card Processing Required")},100),e("#ffCCfile").prop("checked",!1).attr("aria-label","Toggle off for").next().attr("aria-checked",!1)):e("#ffCCfile").removeClass("errorInput")),1==e("#ffShareAppointments").prop("checked")&&n?o.isValid=_sharing.CheckDateofbirthandEmail(!0,o.isValid):n&&(o.isValid=_sharing.CheckDateofbirthandEmail(!1,o.isValid)),void 0===t&&n&&_sharing.FFMasterUserId==_sharing.FFUserId&&(o.isValid=!1,_sharing.ShowHidePassiveAlert(2,"This user has already been added to this customer's Family & Friends Sharing.")),o.isValid||null==o.firstFalseElement||void 0!==t||e("#"+o.firstFalseElement).focus(),-1!=_sharing.Age&&_sharing.Age>=0&&_sharing.Age<18&&"Child"==_sharing.SelectedFFRelation&&e("#ffShareAppointments").prop("checked",!0).attr("aria-label","Toggle on for").next().attr("aria-checked",!0),null!=t&&"undefined"!=t&&""!=t&&"checkbox"==t.type&&(1==t.checked?e(t).attr("aria-label","Toggle on for").next().attr("aria-checked",!0):e(t).attr("aria-label","Toggle off for").next().attr("aria-checked",!1)),o.isValid},_sharing.ClearControls=function(){_sharing.strFFMasterUserId="",_sharing.strFFUserId="",_sharing.strUserFamilyFriendID="",_sharing.UploadedFFImageName="",_sharing.SelectedFFRelation="",_sharing.ExistingUserRelationWithMaster="",_sharing.ExistingUserRelation="",_sharing.FFIsInvitationAccepted=0,_sharing.OldUploadedFFImageName="",_sharing.UploadedFFImageStream="",_sharing.IsImageUploaded=!1,_sharing.FFUserEmailId="",_sharing.PreviousFFUserEmailId="",_sharing.FFUserId=0,_sharing.UserFamilyFriendID=0,_sharing.IsEditMode=!1,_sharing.IsViceVersaUser=!1,_sharing.IsUserCellNotValid=!1,_sharing.EnableDisableControl(!1),e("#divAddEditPopupFFProfilePicPreview").css("background-image",""),e("#divAddEditPopupFFProfilePicPreview").removeClass("ffsolidborder"),e("#divAddEditPopupFFProfilePicTextCont").show(),e("#divAddEditPopupFFProfilePic3DotMenu").hide(),e("#ffallowperson").prop("checked",!1).attr("aria-label","Toggle off for").next().attr("aria-checked",!1),e("#ffCCfile").prop("checked",!1).attr("aria-label","Toggle off for").next().attr("aria-checked",!1),e("#ffnotif").prop("checked",!1).attr("aria-label","Toggle off for").next().attr("aria-checked",!1),e("#AddEditPopupFFProfilePicUpload").val(null),e("#txtFFEmail").val(""),e("#txtFFEmail").removeClass("errorInput"),e("#txtFFPhone").val(""),e("#txtFFPhone").removeClass("errorInput"),e("#txtFFfirstName").val(""),e("#txtFFfirstName").removeClass("errorInput"),e("#txtFFlastName").val(""),e("#txtFFlastName").removeClass("errorInput"),e("#txtFFEmailOpt").val(""),e("#txtFFEmailOpt").removeClass("errorInput"),e("#txtFFPhoneOpt").val(""),e("#txtFFPhoneOpt").removeClass("errorInput");var t={id:"",text:"",species:""};e("#selFFSpeciesBreed").select2("data",t),_sharing.SetChoiceForSeleect2(e("#selFFSpeciesBreed"),t),e("#selFFSpeciesBreed").removeClass("errorInput"),e("#txtFFWeight").val(""),e("#txtFFWeight").removeClass("errorInput"),e("#hdnIsSubmitedFormOnce").val(""),e("#hdnFFUserEmailId").val(""),e("#divFFGendarSelectOptions").val(3),e("#divFFGendarSelectOptions").removeClass("errorInput"),e("#cboFFMonth").removeClass("errorInput"),e("#cboFFDay").removeClass("errorInput"),e("#cboFFYear").removeClass("errorInput"),e("#cboFFMonth").val(-1),e("#cboFFDay").val(-1),e("#cboFFYear").val(-1),e("div.addedit-ffpopup-uploadpropic-cnt div.drag-drop-new").removeClass("drag-drop-error"),"undefined"==typeof vgAppicationType&&e("#divAddNewFamilyFriendContainer div.ff-info-parent").find(":text").filter(":visible:enabled").first().focus(),e("#ffShareAppointments").prop("checked",!1).attr("aria-label","Toggle off for").next().attr("aria-checked",!1),e(".invitationtag").hide(),e("#lnkResend").hide(),_sharing.IsShareAppointments=!1,_sharing.ExistingIsShareAppointments=!1,_sharing.IsShareAppointmentsAccepted=0},_sharing.GetMasterRelation=function(e){return"Parent"==e?1==_sharing.IsEditMode&&null!=_sharing.ExistingUserRelationWithMaster&&"pet"==_sharing.ExistingUserRelationWithMaster.toLowerCase()?"Pet":"Child":"Child"==e||"Pet"==e?"Parent":e},_sharing.AddEditUserFamilyFriend=function(){if(e("#hdnIsSubmitedFormOnce").val("True"),_sharing.IsAllInputDetailsValid()){var t=e("#txtFFEmailOpt:visible").length>0,i=e("#txtFFEmail:visible").length>0,a=i?e("#txtFFEmail").val():t?e("#txtFFEmailOpt").val():null;if(t&&(null==a||null==a||""==a)||!i&&!t)_sharing.ProceedAddEditUserFamilyFriend(null);else{var r={};r.EmailId=a,r.ParentPage=_sharing.parentPage;var o={};o.objEntity=r,_sharing.ShowHideLoadingPanel(!0),_sharing.ajaxCall("CheckUserExistsByEmailID",o,_sharing.ProceedAddEditUserFamilyFriend,_sharing.CallFailedCustomerJSON,!1)}}},_sharing.ProceedAddEditUserFamilyFriend=function(t){if(_sharing.ShowHideLoadingPanel(!1),!(!t||t&&_sharing.IsEditMode&&t.UserID===_sharing.FFUserId)){var i=e("#txtFFEmail:visible").length>0?e("#txtFFEmail"):e("#txtFFEmailOpt:visible").length>0?e("#txtFFEmailOpt"):null;return _sharing.ShowHidePassiveAlert(2,"A user with this email address already exists. Vagaro does not allow more than one user with the same email address."),e(i).val(""),e(i).focus(),e("#txtFFfirstName").val(""),void e("#txtFFlastName").val("")}var r={};r.IsOnlyUpdateInOffline=_sharing.IsCallFromOnlinePage()&&("onlinemyaccount"==_sharing.parentPage.toLowerCase()||"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase()),r.CallingParentPage=_sharing.parentPage,r.IsSyncInSelfGroup=_sharing.IsCallFromOnlinePage(),"onlinemyaccount"==_sharing.parentPage.toLowerCase()?(r.strUserID=_sharing.strFFUserId,r.strUserFamilyFriendID=1==_sharing.IsViceVersaUser?"":_sharing.strUserFamilyFriendID,r.strMasterUserID=0==String.isNullOrUndefineOrBlank(_sharing.strFFMasterUserId)?_sharing.strFFMasterUserId:""):(r.UserID=_sharing.FFUserId,r.UserFamilyFriendID=1==_sharing.IsViceVersaUser?0:_sharing.UserFamilyFriendID,r.MasterUserID=0==isNaN(_sharing.FFMasterUserId)?_sharing.FFMasterUserId:0),r.IsInvitationAccepted=_sharing.FFIsInvitationAccepted,r.imageInputStream=_sharing.UploadedFFImageStream,void 0!==_sharing.UploadedFFImageName&&null!=_sharing.UploadedFFImageName&&_sharing.UploadedFFImageName.indexOf("://")>0?r.originalImageName=_sharing.UploadedFFImageName.substring(_sharing.UploadedFFImageName.lastIndexOf("/")+1):r.originalImageName=_sharing.UploadedFFImageName,r.oldFileName=_sharing.OldUploadedFFImageName,r.Relation=_sharing.SelectedFFRelation,r.RelationWithMaster=_sharing.GetMasterRelation(_sharing.SelectedFFRelation),r.PreviousRelation=_sharing.ExistingUserRelation,r.PreviousShareAppointments=_sharing.ExistingIsShareAppointments,"onlineappointment"==_sharing.parentPage.toLowerCase()?(r.IsAllowBook=!0,r.IsShareCC=!1,r.IsCCNotification=!0,r.IsShareAppointments=!1,r.IsShareAppointmentsAccepted=0):(r.IsAllowBook=e("#ffallowperson").prop("checked"),r.IsShareCC=e("#ffCCfile").prop("checked"),r.IsCCNotification=e("#ffnotif").prop("checked"),r.IsShareAppointments=e("#ffShareAppointments").prop("checked"),r.IsShareAppointmentsAccepted=_sharing.IsShareAppointmentsAccepted,e("#ffShareAppointments").prop("checked")?e("#ffShareAppointments").prop("checked")&&1==_sharing.ExistingIsShareAppointments&&1!=_sharing.IsShareAppointmentsAccepted&&(r.IsShareAppointments=!0,r.IsShareAppointmentsAccepted=_sharing.IsShareAppointmentsAccepted):1==_sharing.ExistingIsShareAppointments&&1!=_sharing.IsShareAppointmentsAccepted?(r.IsShareAppointments=!0,r.IsShareAppointmentsAccepted=_sharing.IsShareAppointmentsAccepted):(r.IsShareAppointments=!1,r.IsShareAppointmentsAccepted=0));var o=_sharing.GetChoiceForSeleect2(e("#selFFSpeciesBreed"));if(void 0!==o&&null!=o&&void 0!==o.id&&null!=o.id&&""!=o.id){var n=o.id.split("_");r.Species=n[0],r.Breed=n[1]}else r.Species=null,r.Breed=null;r.Weight=""==e("#txtFFWeight").val()||isNaN(parseInt(e("#txtFFWeight").val()))?null:parseFloat(e("#txtFFWeight").val()).toFixed(2),"onlinemyaccount"==_sharing.parentPage.toLowerCase()?(r.strBusinessId=strVgBusienssId,r.strLoginUserId=strUserID):(r.businessID=_sharing.BusinessID,r.loginUserID=_sharing.LoggedInUserId),r.device=_sharing.parentPage;var s=e("#txtFFPhone:visible").length>0?e("#txtFFPhone"):e("#txtFFPhoneOpt:visible").length>0?e("#txtFFPhoneOpt"):null,l=e("#txtFFEmail:visible").length>0?e("#txtFFEmail"):e("#txtFFEmailOpt:visible").length>0?e("#txtFFEmailOpt"):null;if(r.Cell=void 0!==s&&null!=s?e(s).val():null,r.CustomerEmail=null!=l?e(l).val():null,0==_sharing.IsOverrideInfo&&(r.Cell=e("#txtFFPhone:visible").length>0?_sharing.txtFFPhone:e("#txtFFPhoneOpt:visible").length>0?_sharing.txtFFPhoneOpt:null,r.CustomerEmail=e("#txtFFEmail:visible").length>0?_sharing.txtFFEmail:e("#txtFFEmailOpt:visible").length>0?_sharing.txtFFEmailOpt:null),e("#txtFFPhone:visible").length>0||e("#txtFFPhoneOpt:visible").length>0){var d={};if(e("#txtFFPhone:visible").length>0&&!friendfamilycellPhone.validatePhoneNumber(!0)||e("#txtFFPhoneOpt:visible").length>0&&!childcellphone.validatePhoneNumber(!0)){var c=e("#txtFFPhone:visible").length>0?friendfamilycellPhone.getValidateMessage():childcellphone.getValidateMessage();return 3==c.WarningType?_sharing.ShowHidePassiveAlert(2,"A phone number must be 10 digits."):_sharing.ShowHidePassiveAlert(2,c.WarningMessage),!1}d=e("#txtFFPhone:visible").length>0?friendfamilycellPhone.getPhoneData():childcellphone.getPhoneData(),r.CellCountryID=d.countryId,r.DialingCode=d.dialingCode,r.Cell=d.phoneNo,r.CountryID="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:1}if(r.FirstName=1==_sharing.IsOverrideInfo?_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val()):_sharing.txtFFfirstName,r.LastName=1==_sharing.IsOverrideInfo?_sharing.FnReplaceFamilyFriendSharing(e("#txtFFlastName").val()):_sharing.txtFFlastName,r.Gender=1==_sharing.IsOverrideInfo?e("#divFFGendarSelectOptions").val():_sharing.divFFGendarSelectOptions,e("#cboFFDay:visible").length>0&&e("#cboFFMonth:visible").length>0&&e("#cboFFYear:visible").length>0){var u=1==_sharing.IsOverrideInfo?e("#cboFFDay").val():_sharing.cboFFDay,p=1==_sharing.IsOverrideInfo?e("#cboFFMonth").val():_sharing.cboFFMonth,h=1==_sharing.IsOverrideInfo?e("#cboFFYear").val():_sharing.cboFFYear;"-1"!=u&&"-1"!=p?(r.Year="-1"!=h?h:_sharing.defaultYear,r.Month=p,r.Day=u):(r.Year=null,r.Month=null,r.Day=null)}_sharing.ShowHideLoadingPanel(!0);var m={};m.objReq=r,m.ObjFFData=a,setTimeout(function(){_sharing.ajaxCall("AddEditUserFamilyFriend",m,_sharing.onSuccessSaveFriendFamily,_sharing.onFailSaveFriendFamily,!1,!1)},100)},_sharing.CreateCurrentFamilyobject=function(e){a.Day=e.Day,a.Month=e.Month,a.Year=e.Year,a.FirstName=e.FirstName,a.LastName=e.LastName,a.Cell=e.Phone,a.originalImageName=e.ImageName,a.CustomerEmail=e.Email,a.Gender=e.Gender,a.Species=e.Species,a.Breed=e.Breed,a.Weight=e.Weight},_sharing.FnReplaceFamilyFriendSharing=function(e){return e.replace(/[^a-zA-Z ]/g,"")},_sharing.onSuccessSaveFriendFamily=function(t){if(null!=t&&1==t.Result){if("onlinemyaccount"==_sharing.parentPage.toLowerCase()&&String.isNullOrUndefineOrBlank(t.strUserID))_sharing.ShowHidePassiveAlert(3,"Something went wrong. Please try again.");else if("onlinemyaccount"!=_sharing.parentPage.toLowerCase()&&t.UserID<=0)_sharing.ShowHidePassiveAlert(3,"Something went wrong. Please try again.");else{if("onlinemyaccount"==_sharing.parentPage.toLowerCase()?_sharing.strFFUserId=t.strUserID:_sharing.FFUserId=t.UserID,"customermodule"==_sharing.parentPage.toLowerCase())"#profile"==e("#CustomerTab .active a").attr("data-href").toLowerCase()?_shareListing.GetUserFamilyAndFriendDetails(_sharing.FFMasterUserId,_sharing.BusinessID):"#memberships"==e("#CustomerTab .active a").attr("data-href").toLowerCase()?(e("#divMemberChipsForMS").html(""),membershipUserFamily=null,MemEditSelectedFamilyFriendsCount=0,MemEditSelectedFamilyFriendsArr=null,GetMembershipUserFamilyFriendDetails(parseInt(_MembershipTable.CustomerID))):"#packages"==e("#CustomerTab .active a").attr("data-href").toLowerCase()?(e("#divMemberChipsForCustomPKG").html(""),e("#divMemberChipsForNormalPKG").html(""),_vgPackageManagement.model.packageUserFamily=null,_vgPackageManagement.model.SelectedFamilyFriendsCount=0,_vgPackageManagement.model.SelectedFamilyFriendsArr=null,_vgPackageManagement.GetPackageUserFamilyFriendDetails(parseInt(_vgPackageManagement.model.customerID))):_shareListing.GetUserFamilyAndFriendDetails(_sharing.FFMasterUserId,_sharing.BusinessID);else if("onlinemyaccount"==_sharing.parentPage.toLowerCase())_shareListing.GetUserFamilyAndFriendDetails(_sharing.strFFMasterUserId,strVgBusienssId);else if("checkout"==_sharing.parentPage.toLowerCase())1==FFDetailsBindFor?e("#divMemberChipsForCustomPKG").html(""):e("#divMemberChipsForMS").html(""),FamilyAndFriendsDetails=null,SelectedFamilyFriendsCount=0,SelectedFamilyFriendsArr=null,_checkout.GetFamilyAndFriendsDetailsByUserID(!0);else if("onlineappointment"==_sharing.parentPage.toLowerCase()){t.FullName=t.FirstName+" "+t.LastName,e(".familycktfrndlist").children(".familycktfrndlistblok:not(.init)").removeClass("selected");var i=e("#FFlistingOnlineAppBook").children(".familycktfrndlistblok").map(function(){if(void 0!==e(this).attr("data-value"))return e(this).attr("data-value").trim()}).get();if(jQuery.inArray(t.UserID.toString(),i)>-1){var a=e("*[data-value="+t.UserID+"]");e(a).addClass("selected"),e(a).find(".avtar-name").html(t.FullName),e(".familycktfrndlist").children(".init").html(a.html()),e(".familycktfrndlist").children(".init").find(".fficons").css("display","block"),e("#addnewffpopup").hide()}else{var r=e("#OnlineAddfamilyfrndTemplate").tmpl(t);e(".familycktfrndlist").find(" > li:nth-last-child(1)").before(r),e(".familycktfrndlist").children(".init").html(r.html()),e(".familycktfrndlist").children(".init").find(".fficons").css("display","block"),e("#addnewffpopup").hide()}var o=e(".familycktfrnd ul li.selected").data("value"),n=e("<XMLDocument/>");n.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",1)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(var s=0;s<_shopdetail.BookingDetail.serviceid.split(",").length;s++){var l=_vgClassSessionSelection.createXmlElement("n",_shopdetail.BookingDetail.serviceid.split(",")[s]);n.find("ns").append(l)}var d=0;if("undefined"!=typeof isWaitingtoreal&&"undefined"!=typeof waitlistID&&0!=isWaitingtoreal&&0!=waitlistID&&(d=waitlistID),void 0!==o&&o>0){var c={};c.lBusinessID=e("#hdnBusinessID").val(),c.isOutcall=_shopdetail.BookingDetail.isoutcall,c.lUserID=o,c.ServiceId=_shopdetail.BookingDetail.serviceid,c.ServiceDate=_shopdetail.BookingDetail.date,c.IsPaid=IsPaid,c.ServiceList=n.html(),c.WaitlistID=d,c.EncryptUserId=t.EncryptUserId;var u=new vagaro.ajax;u.datamodel.Token="GetDiscountDetailofUserToBookApp",u.datamodel.data=[c],u.datamodel.callback=function(e){_shopdetail.GetDiscountDetailofUserToBookAppResponse(e,1)},u.datamodel.Error=function(e){_shopdetail.HideShowLoader(!1)},u.Post(),_shopdetail.ValidateAndGetFormDetailsforFFSharing()}else"bookwithcc"==_sharing.SourceButtonName.toLowerCase()?_shopdetail.ValidateBookingDataWithCC():"bookwithoutcc"==_sharing.SourceButtonName.toLowerCase()&&_shopdetail.ValidateBookingDataWithoutCC(),_sharing.SourceButtonName=""}else if("onlineclassbook"==_sharing.parentPage.toLowerCase()){var p=_shareListing.OnlineClassBookElement,h=e(p).closest(".attendeelist").siblings(".panel-heading").attr("id");t.FullName=t.FirstName+" "+t.LastName,t.Email=_sharing.FFUserEmailId;i=e("div.clsaccordion").find(".panel-default").map(function(){if(void 0!==e(this).attr("data-value"))return e(this).attr("data-value").trim()}).get();if(jQuery.inArray(t.UserID.toString(),i)>-1)_sharing.ShowHidePassiveAlert(2,"This User! has been already selected in other attendee list"),e("#"+h).siblings("div.collapse").collapse("hide");else{r=e("#OnlineAddFFSubAttendeelistTemplate").tmpl(t);var m=e("#OnlineAddFFClassSelectionTemplate").tmpl(t);e("#"+h).find(".ffshipping-bg").html(m),e("#"+h).siblings("div.collapse").collapse("hide"),e("#"+h).siblings("div.attendeelist").find("#lstoffamilyandfriends").find(" > li:nth-last-child(2)").before(r),e("#"+h).closest("div.panel-default").attr("data-value",t.UserID),e("#"+h).closest("div.panel-default").attr("data-email",t.Email),e("#"+h).closest("div.panel-default").attr("data-fullname",t.FullName)}void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication&&void 0!==e("#divClassDetailpopup")&&null!=e("#divClassDetailpopup")&&null!=e("#divClassDetailpopup")&&e("#divClassDetailpopup").css({"overflow-x":"hidden","overflow-y":"auto"})}else"onlineshoppingcart"==_sharing.parentPage.toLowerCase()?(null!=onlineShoppingCart.Memberships&&onlineShoppingCart.Memberships.length>0&&(_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.RelationshipsArr=null,_onlineCheckout.ChildAge="",_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.SelectedFamilyFriendsCount=null,_onlineCheckout.MaxNoFamilyFriends=null,_onlineCheckout.SelectedFamilyFriendsArr=null,e("#divMemberChipsForMS").empty(),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(2)),null!=onlineShoppingCart.Packages&&onlineShoppingCart.Packages.length>0&&(_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.PackageSharingDetail=null,e.each(onlineShoppingCart.Packages,function(t,i){e("#"+i.ServiceId+"_"+i.autoId).empty(),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(1)}))):"booknowupsell"==_sharing.parentPage.toLowerCase()&&(currentPage="booknowupsell",void 0!==_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&(_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.RelationshipsArr=null,_onlineCheckout.ChildAge="",_onlineCheckout.SelectedFamilyFriendsCount=null,_onlineCheckout.MaxNoFamilyFriends=null,_onlineCheckout.SelectedFamilyFriendsArr=null,_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(4)),void 0!==_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&(_onlineCheckout.FamilyAndFriendsDetails=null,_onlineCheckout.PackageSharingDetail=null,e.each(_shopdetail.BookingDetail.PackageUpSellData,function(t,i){e("#divMemberChipsForMS").empty(),_onlineCheckout.GetFamilyAndFriendsDetailsandBindforPkgMS(5)})));var f=e("#txtFFPhone:visible").length>0?e("#txtFFPhone"):e("#txtFFPhoneOpt:visible").length>0?e("#txtFFPhoneOpt"):null,g=new Object;g.CustomerID=_sharing.FFUserId,g.FullName=e("#txtFFfirstName").val().trim()+" "+e("#txtFFlastName").val().trim(),g.glbCell=null!=f?e(f).val().trim():"",_sharing.AddNewCustomerInLocalStorage_Cust(g,!1),_sharing.IsEditMode?_sharing.ShowHidePassiveAlert(1,_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" has been updated in your Family & Friends Sharing.","#headingfamily"):(_sharing.ShowHidePassiveAlert(1,_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" has been added to Family & Friends Sharing.","#divEditProfile2"),e("#divUserDetail").attr("aria-label",_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" has been added to Family & Friends Sharing.").attr("tabindex",-1),setTimeout(function(){e("#divUserDetail").attr("tabindex",-1).focus()},1e3),setTimeout(function(){e("#divUserDetail").removeAttr("aria-label")},2e3)),"onlineappointment"==_sharing.parentPage.toLowerCase()&&_sharing.ClearControls()}_sharing.CloseCreateNewFamilyFriendPopup(),e("#pnlFamilyFriendSharingModal").modal("hide")}else _sharing.IsEditMode?_sharing.ShowHidePassiveAlert(3,_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" failed to be updated in your Family & Friends Sharing. Please try again."):_sharing.ShowHidePassiveAlert(3,_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" failed to be added as a Family & Friends Sharing. Please try again.");_sharing.ShowHideLoadingPanel(!1)},_sharing.onFailSaveFriendFamily=function(t){_sharing.ShowHideLoadingPanel(!1),_sharing.IsEditMode?_sharing.ShowHidePassiveAlert(3,_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" failed to be updated in your Family & Friends Sharing. Please try again."):_sharing.ShowHidePassiveAlert(3,_sharing.FnReplaceFamilyFriendSharing(e("#txtFFfirstName").val())+" failed to be added as a Family & Friends Sharing. Please try again."),_sharing.CloseCreateNewFamilyFriendPopup()},_sharing.ToggleMenuClick=function(t){e(".active-menuclick").removeClass("active-menuclick"),e(t).addClass("active-menuclick")},_sharing.deleteUserFamilyAndFriend=function(t,i,a,r,o){swal({title:"",text:"Are you sure want to remove "+unescape(o)+" from Family & Friends Sharing?",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Remove",cancelButtonText:"Cancel",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(e){void 0!==e&&null!=e&&1==e?(_sharing.curSelectedEleForAction=r,_sharing.UserFamilyAndFriendActions(t,i,1,a)):_sharing.curSelectedEleForAction=null}),setTimeout(function(){e(".gencutom-title").html("Remove from Family & Friends Sharing")},100)},_sharing.attachUserToBusiness=function(t,i,a){_sharing.IsHasCustomerModifyRights()&&(swal({title:"",text:"Are you sure you want to attach this user to business?",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Attach",cancelButtonText:"Cancel",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(e){void 0!==e&&null!=e&&1==e?(_sharing.curSelectedEleForAction=a,_sharing.UserFamilyAndFriendActions(t,i,2,!1)):_sharing.curSelectedEleForAction=null}),setTimeout(function(){e(".gencutom-title").html("Attach User To Business")},100))},_sharing.resendInvitation=function(t,i,a,r){swal({title:"",text:"Are you sure you want to resend invitaion?",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Send",cancelButtonText:"Cancel",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(o){void 0!==o&&null!=o&&1==o?(_sharing.curSelectedEleForAction=e(a).closest("div.ffsharing-mem-container"),_sharing.UserFamilyAndFriendActions(t,i,r,!0)):_sharing.curSelectedEleForAction=null}),setTimeout(function(){e(".gencutom-title").html("Resend Invitation")},100)},_sharing.UserFamilyAndFriendActions=function(t,i,a,r){var o={};"customermodule"==_sharing.parentPage.toLowerCase()?_sharing.FFMasterUserId=e("#hdnCustomerID").length>0?parseInt(e("#hdnCustomerID").val()):0:"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&(_sharing.strFFMasterUserId=strUserID),_sharing.containsAlphabet(t)?o.strUserFamilyFriendID=t:o.UserFamilyFriendID=t,_sharing.containsAlphabet(i)?(o.strMasterUserID=1==a&&0==r?i:_sharing.strFFMasterUserId,o.strUserID=1==a&&0==r?_sharing.strFFMasterUserId:i,o.strLoginUserId=strUserID,o.strBusinessId=strVgBusienssId):(o.MasterUserID=1==a&&0==r?i:_sharing.FFMasterUserId,o.UserID=1==a&&0==r?_sharing.FFMasterUserId:i,o.loginUserID=_sharing.LoggedInUserId,o.businessID=_sharing.BusinessID),o.Action=a,o.IsOnlyUpdateInOffline=_sharing.IsCallFromOnlinePage(),o.ParentPage=_sharing.parentPage.toLowerCase(),_sharing.ShowHideLoadingPanel(!0);var n={};n.objRequest=o,setTimeout(function(){_sharing.ajaxCall("UserFamilyAndFriendActions",n,_sharing.onSuccessUserFamilyAndFriendActions,_sharing.onFailCommonMethod,!1,!1)},100)},_sharing.onSuccessUserFamilyAndFriendActions=function(t){if(_sharing.ShowHideLoadingPanel(!1),t.Result){if(1==t.Action){var i="";if(("customermodule"==_sharing.parentPage.toLowerCase()||"onlinemyaccount"==_sharing.parentPage.toLowerCase())&&e(_sharing.curSelectedEleForAction).length>0){i=e(_sharing.curSelectedEleForAction).data("userfullname");var a=e(_sharing.curSelectedEleForAction).closest("div.ffsharing-mem-container");e(a).remove(),e("div#divFamilyFriendListingContainer div#familyListDiv div#familyListID div.ffsharing-mem-container").length<=0&&e("#txtFamily").hide(),e("div#divFamilyFriendListingContainer div#familyListDiv div#FriendlistID div.ffsharing-mem-container").length<=0&&e("#txtFriends").hide(),e("div#divFamilyFriendListingContainer div#familyListDiv div.ffsharing-mem-container").length<=0&&(e("div#divFamilyFriendListingContainer div#familyListDiv").hide(),e("div#divFamilyFriendListingContainer div#addFamilyDiv").show())}""!=i?_sharing.ShowHidePassiveAlert(1,i+" has been removed from Family & Friends Sharing.","#headingfamily"):_sharing.ShowHidePassiveAlert(1,"User has been removed from Family & Friends Sharing.","#headingfamily")}else if(2==t.Action){if("customermodule"==_sharing.parentPage.toLowerCase()){var r="",o="";e(_sharing.curSelectedEleForAction).length>0&&(r=e(_sharing.curSelectedEleForAction).data("userfullname"),o=e(_sharing.curSelectedEleForAction).data("userphone").toString());var n=new Object;n.CustomerID=t.UserID,n.FullName=r,n.glbCell=o,_sharing.AddNewCustomerInLocalStorage_Cust(n,!0),_shareListing.GetUserFamilyAndFriendDetails(_sharing.FFMasterUserId,_sharing.BusinessID)}_sharing.ShowHidePassiveAlert(1,"Customer added to the customer list.")}else if(3==t.Action||5==t.Action){if("customermodule"==_sharing.parentPage.toLowerCase()||"onlinemyaccount"==_sharing.parentPage.toLowerCase())if(e(_sharing.curSelectedEleForAction).length>0){var s=e(_sharing.curSelectedEleForAction).find("div.div-ffinvitation-state-bedge");null!=s&&e(s).length>0&&(e(s).text("Invitation Pending"),e(s).removeClass("denied-tag-2").addClass("pending-tag-2"))}else e(".invitationtag").hide(),e(".pending-tag").show(),"onlinemyaccount"==_sharing.parentPage.toLowerCase()?_shareListing.GetUserFamilyAndFriendDetails(_sharing.strFFMasterUserId,strVgBusienssId):_shareListing.GetUserFamilyAndFriendDetails(_sharing.FFMasterUserId,_sharing.BusinessID);_sharing.ShowHidePassiveAlert(1,"Invitation sent successfully.")}}else _sharing.ShowHidePassiveAlert(3,"Something Went Wrong. Please try again.");_sharing.curSelectedEleForAction=null},_sharing.onFailCommonMethod=function(e){_sharing.ShowHideLoadingPanel(!1),_sharing.curSelectedEleForAction=null,_sharing.ShowHidePassiveAlert(3,"Something Went Wrong. Try again.")},_sharing.checkUserAlreadyFamilyFriend=function(e){"onlinemyaccount"==_sharing.parentPage.toLowerCase()?_sharing.GetUserFamilyAndFriendDetailsById(strVgBusienssId,e):_sharing.GetUserFamilyAndFriendDetailsById(0,e)},_sharing.GetUserFamilyAndFriendDetailsById=function(t,i){"customermodule"==_sharing.parentPage.toLowerCase()?_sharing.FFMasterUserId=e("#hdnCustomerID").length>0?parseInt(e("#hdnCustomerID").val()):0:"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase()?_sharing.FFMasterUserId=UserID:"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&(_sharing.strFFMasterUserId=strUserID);var a={};_sharing.containsAlphabet(t)?a.strUserFamilyFriendID=t:a.UserFamilyFriendID=t,_sharing.containsAlphabet(i)?a.strUserID=i:a.UserID=i,String.isNullOrUndefineOrBlank(_sharing.strFFMasterUserId)?a.MasterUserID=_sharing.FFMasterUserId:a.strMasterUserID=_sharing.strFFMasterUserId,a.IsLoadFromOffline=_sharing.IsCallFromOnlinePage(),a.ParentPage=_sharing.parentPage.toLowerCase(),0==_sharing.IsCallFromOnlinePage()&&(a.strBusinessId=ReactBId),_sharing.ShowHideLoadingPanel(!0);var r={};r.objRequest=a,setTimeout(function(){_sharing.ajaxCall("GetFamilyAndFriendDetailsByFriendFamilyId",r,_sharing.onSuccessGetUserFamilyAndFriendDetailsById,_sharing.onFailCommonMethod,!1,!1)},100)},_sharing.GetUserFamilyAndFriendDetailsByEmail=function(e){var t={};t.IsLoadFromOffline=_sharing.IsCallFromOnlinePage(),t.ParentPage=_sharing.parentPage.toLowerCase(),String.isNullOrUndefineOrBlank(_sharing.strFFMasterUserId)?t.MasterUserID=_sharing.FFMasterUserId:t.strMasterUserID=_sharing.strFFMasterUserId,t.EmailId=e;var i={};i.objRequest=t,_sharing.ajaxCall("GetFamilyAndFriendDetailsByFriendFamilyId",i,_sharing.onSuccessGetUserFamilyAndFriendDetailsById,_sharing.onFailCommonMethod,!1,!1)},_sharing.onSuccessGetUserFamilyAndFriendDetailsById=function(e){_sharing.CreateCurrentFamilyobject(e),"onlinemyaccount"==_sharing.parentPage.toLowerCase()?null!=e&&e.IsUserAvailable&&0==e.IsDeleted&&(_sharing.IsEditMode=!0,_sharing.OpenCreateNewFamilyFriendPopup(_sharing.parentPage),_sharing.bindUserFamilyFriendData(e)):null!=e&&e.UserID>0&&e.MasterUserID>0&&0==e.IsDeleted&&(_sharing.IsEditMode=!0,_sharing.OpenCreateNewFamilyFriendPopup(_sharing.parentPage),_sharing.bindUserFamilyFriendData(e)),_sharing.ShowHideLoadingPanel(!1)},_sharing.bindUserFamilyFriendData=function(t){if(null!=t){"onlinemyaccount"==_sharing.parentPage.toLowerCase()?(_sharing.strFFUserId=t.strUserID,_sharing.strUserFamilyFriendID=t.strUserFamilyFriendID):(_sharing.FFUserId=t.UserID,_sharing.UserFamilyFriendID=t.UserFamilyFriendID),_sharing.FFIsInvitationAccepted=t.IsInvitationAccepted,_sharing.ExistingUserRelationWithMaster=t.IsViceVersaUser?t.Relation:t.RelationOfMaster,_sharing.ExistingUserRelation=t.IsViceVersaUser?t.RelationOfMaster:t.Relation;var i,a=t.IsViceVersaUser?t.RelationOfMaster.toLowerCase():t.Relation.toLowerCase();if(e("#divAddNewFamilyFriendTabLink a.w-tab-link.fftablink-"+a).click(),_sharing.IsViceVersaUser=t.IsViceVersaUser,null!=t.Photo&&""!=t.Photo&&(_sharing.UploadedFFImageName=t.Photo,_sharing.OldUploadedFFImageName=t.Photo,_sharing.setImageOnAddEdit(_sharing.UploadedFFImageName)),1==_sharing.IsEditMode||0==_sharing.IsCallFromOnlinePage()||1==_sharing.IsCallFromOnlinePage()){if(e("#txtFFfirstName").val(t.FirstName),e("#txtFFlastName").val(t.LastName),e("#txtFFPhone").removeClass("errorInput"),e("#txtFFPhoneOpt").removeClass("errorInput"),null!=t.Phone&&""!=t.Phone)l=(l=t.Phone).replace(/-/g,""),e("#txtFFPhone").val(l),e("#txtFFPhoneOpt").val(l),null!=t.IsCellValid&&0==t.IsCellValid&&(_sharing.ShowHidePassiveAlert(2,"Please enter a valid phone number."),e("#txtFFPhone").addClass("errorInput"),e("#txtFFPhoneOpt").addClass("errorInput"),_sharing.IsUserCellNotValid=!0);if(e("#txtFFPhone:visible").length>0){var r=document.getElementById("txtFFPhone");null!=t.Phone&&t.CellCountryID>0?t.Phone=r.value=friendfamilycellPhone.setPhoneData(t.CellCountryID,t.Phone):t.Phone=r.value=""}else if(e("#txtFFPhoneOpt:visible").length>0){r=document.getElementById("txtFFPhoneOpt");null!=t.Phone&&t.CellCountryID>0?t.Phone=r.value=childcellphone.setPhoneData(t.CellCountryID,t.Phone):t.Phone=r.value=""}null!=t.Email&&""!=t.Email&&(_sharing.FFUserEmailId=t.Email,_sharing.PreviousFFUserEmailId=t.Email,e("#hdnFFUserEmailId").val(t.Email),e("#txtFFEmail").val(t.Email),e("#txtFFEmailOpt").val(t.Email));var o=t.Day,n=t.Month,s=t.Year;e("#cboFFMonth").val(n),e("#cboFFDay").val(o),s==_sharing.defaultYear?e("#cboFFYear").val(-1):e("#cboFFYear").val(s),e("#divFFGendarSelectOptions").val(t.Gender),_sharing.IsOverrideInfo=!0}else{var l;if(_sharing.txtFFfirstName=t.FirstName,_sharing.txtFFlastName=t.LastName,null!=t.Phone&&""!=t.Phone)l=(l=t.Phone).replace(/-/g,""),_sharing.txtFFPhone=l,_sharing.txtFFPhoneOpt=l;null!=t.Email&&""!=t.Email&&(_sharing.FFUserEmailId=t.Email,_sharing.PreviousFFUserEmailId=t.Email,e("#hdnFFUserEmailId").val(t.Email),_sharing.txtFFEmail=t.Email,_sharing.txtFFEmailOpt=t.Email);o=t.Day,n=t.Month,s=t.Year;_sharing.cboFFMonth=n,_sharing.cboFFDay=o,s==_sharing.defaultYear?_sharing.cboFFYear=-1:_sharing.cboFFYear=s,_sharing.divFFGendarSelectOptions=t.Gender}if(null!=t.Species&&""!=t.Species.trim()&&null!=t.Breed&&""!=t.Breed.trim()){var d={id:t.Species+"_"+t.Breed,text:t.Breed,species:t.Species};e("#selFFSpeciesBreed").select2("data",d),_sharing.SetChoiceForSeleect2(e("#selFFSpeciesBreed"),d)}null!=t.Weight&&0!=t.Weight&&e("#txtFFWeight").val(t.Weight),e("#ffallowperson").prop("checked",t.IsAllowtoBookApp).attr("aria-label","Toggle on for").next().attr("aria-checked",!0),e("#ffCCfile").prop("checked",t.IsShareCC).attr("aria-label","Toggle on for").next().attr("aria-checked",!0),e("#ffnotif").prop("checked",t.IsCCNotification).attr("aria-label","Toggle on for").next().attr("aria-checked",!0),_sharing.IsShareAppointments=t.IsShareAppointments,_sharing.IsEditMode&&(_sharing.IsShareAppointmentsAccepted=t.IsShareAppointmentsAccepted),_sharing.ExistingIsShareAppointments=t.IsShareAppointments,e(".invitationtag").hide(),1!=_sharing.IsViceVersaUser&&(!String.isNullOrUndefineOrBlank(_sharing.strUserFamilyFriendID)||"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&!String.isNullOrUndefineOrBlank(_sharing.strFFUserId)?1==_sharing.ExistingIsShareAppointments&&1!=_sharing.IsShareAppointmentsAccepted?1==_sharing.IsShareAppointments&&_sharing.IsEditMode&&(e("#lnkResend").attr("onclick",'_sharing.resendInvitation("'+_sharing.strUserFamilyFriendID+'","'+_sharing.strFFUserId+'",this,5)'),e("#lnkResend").show(),i=0==_sharing.IsShareAppointmentsAccepted?".pending-tag":".red-tag",e(i).show()):(e("#lnkResend").hide(),e("#ffShareAppointments").prop("checked",_sharing.IsShareAppointments).attr("aria-label","Toggle on for").next().attr("aria-checked",!0)):(_sharing.UserFamilyFriendID>0||"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&_sharing.FFUserId>0)&&(1==_sharing.ExistingIsShareAppointments&&1!=_sharing.IsShareAppointmentsAccepted?1==_sharing.IsShareAppointments&&_sharing.IsEditMode&&(e("#lnkResend").attr("onclick","_sharing.resendInvitation("+_sharing.UserFamilyFriendID+","+_sharing.FFUserId+",this,5)"),e("#lnkResend").show(),i=0==_sharing.IsShareAppointmentsAccepted?".pending-tag":".red-tag",e(i).show()):(e("#lnkResend").hide(),e("#ffShareAppointments").prop("checked",_sharing.IsShareAppointments).attr("aria-label","Toggle on for").next().attr("aria-checked",!0))))}"1"!=t.UserType&&(_sharing.EnableDisableControl(!0),_sharing.ShowHidePassiveAlert(2,_sharing.UserExistsMsg))},_sharing.isAdvancedUpload=function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&"FormData"in window},_sharing.isSupportedBrowser=function(){return window.File&&window.FileReader&&window.FileList&&window.Image},_sharing.isValidImage=function(e){var t=jQuery.Deferred(),i=new Image;return i.onload=function(){this.width+this.height!==0?t.resolve(!0):this.onerror()},i.onerror=function(){_sharing.ShowHidePassiveAlert(2,"Unable to upload image. Please try again."),t.resolve(!1)},i.src=_sharing._URL.createObjectURL(e),t.promise()},_sharing.bindImageUploadEventsForFFSharing=function(){if(_sharing.isAdvancedUpload()){var t=e("div.addedit-ffpopup-uploadpropic-cnt div.drag-drop-new");t.off(),t.on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}).on("dragover dragenter",function(){t.addClass("drag-drop-active")}).on("dragleave dragend drop",function(){t.removeClass("drag-drop-active")}).on("drop",function(i){glbdroppedFile=i.originalEvent.dataTransfer.files;var a=!0,r=glbdroppedFile[0];isValidFileWeb(/(gif|png|jpg|jpeg|bmp|GIF|PNG|JPG|JPEG|BMP)$/i,r.name)||(e(this).closest(".drag-drop-new").addClass("drag-drop-error").removeClass("drag-drop-active"),_sharing.ShowHidePassiveAlert(2,"Please upload a jpg, gif, png or bmp file.","#btnFFCustomerSave"),a=!1);try{if(a){var o=4194304;if(r.size>o){var n=parseFloat(4.096).toFixed(0);_sharing.ShowHidePassiveAlert(2,"This image is too large. (Maximum upload size is "+n+" MB.) Please try again.","#btnFFCustomerSave"),e(this).closest(".drag-drop-new").addClass("drag-drop-error").removeClass("drag-drop-active"),a=!1}}}catch(i){a=!0}a&&(t.addClass("drag-drop-active").removeClass("drag-drop-error"),null!=r&&_sharing.setCommonUploadedImage(r,parent)),t.removeClass("drag-drop-active")}),e("#AddEditPopupFFProfilePicUpload").off(),e("#AddEditPopupFFProfilePicUpload").on("change",function(i){if(e("#AddEditPopupFFProfilePicUpload").parent().find("div.drag-drop-new").removeClass("drag-drop-active"),!(i.target.files.length<=0)){glbdroppedFile=!1;var a=!0,r=i.target.files[0];isValidFileWeb(/(gif|png|jpg|jpeg|bmp|GIF|PNG|JPG|JPEG|BMP)$/i,r.name)||(e("#divAddEditPopupFFProfilePicPreview.drag-drop-new").addClass("drag-drop-error").removeClass("drag-drop-active"),_sharing.ShowHidePassiveAlert(2,"Please upload a jpg, gif, png or bmp file.","#btnFFCustomerSave"),a=!1);try{if(a){var o=4194304;if(r.size>o){var n=parseFloat(4.096).toFixed(0);_sharing.ShowHidePassiveAlert(2,"This image is too large. (Maximum upload size is "+n+" MB.) Please try again.","#btnFFCustomerSave"),e("#divAddEditPopupFFProfilePicPreview.drag-drop-new").addClass("drag-drop-error").removeClass("drag-drop-active"),a=!1}}}catch(i){a=!0}a&&(t.addClass("drag-drop-active").removeClass("drag-drop-error"),null!=r&&_sharing.setCommonUploadedImage(r,parent)),t.removeClass("drag-drop-active")}}),e(".FFdragImage").click(function(){document.getElementById("AddEditPopupFFProfilePicUpload").click()})}},_sharing.setUploadedImage=function(t,i,a){var r=null;try{r=a=e(a)}catch(e){r=window}_sharing.ShowHideLoadingPanel(!1),e(r).find(".drag-drop-new").hasClass("drag-drop-error")||(0!=glbdroppedFile||0!=e("#AddEditPopupFFProfilePicUpload").get(0).files.length?_sharing.isSupportedBrowser()&&_sharing.isValidImage(i).then(function(e){e&&(_sharing.UploadedFFImageName=i.name,_sharing.UploadedFFImageStream=t,_sharing.IsImageUploaded=!0,_sharing.setImageOnAddEdit(t))}):e(r).find(".drag-drop-new").addClass("drag-drop-error"))},_sharing.setCommonUploadedImage=function(e,t){_sharing.ShowHideLoadingPanel(!0);var i,a="";if(regex=new RegExp("[^.]+$"),a=e.name.match(regex)[0],i=e.name.toLowerCase().replace(/\.heic/,".jpeg"),"heic"!=a.toLowerCase()){var r=new FileReader;r.onload=function(i){_sharing.setUploadedImage(i.target.result,e,t)},r.readAsDataURL(e)}else getJPEGFileFromHEICWeb(e,i,function(e){var i=new FileReader;i.onload=function(i){_sharing.setUploadedImage(i.target.result,e,t)},i.readAsDataURL(e)})},_sharing.setImageOnAddEdit=function(t){e("#divAddEditPopupFFProfilePicPreview").css("background-image","url('"+t+"')"),e("#divAddEditPopupFFProfilePicPreview").addClass("ffsolidborder"),e("#divAddEditPopupFFProfilePicTextCont").hide(),e("#divAddEditPopupFFProfilePic3DotMenu").show()},_sharing.deleteFFProfilePic=function(){swal({title:"",text:"Are you sure want to remove profile picture of this user?",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Remove",cancelButtonText:"Cancel",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(t){void 0!==t&&null!=t&&1==t&&(_sharing.UploadedFFImageName="",_sharing.UploadedFFImageStream="",_sharing.IsImageUploaded=!1,e("#AddEditPopupFFProfilePicUpload").val(null),e("#divAddEditPopupFFProfilePicPreview").css("background-image",""),e("#divAddEditPopupFFProfilePicPreview").removeClass("ffsolidborder"),e("#divAddEditPopupFFProfilePicTextCont").show(),e("#divAddEditPopupFFProfilePic3DotMenu").hide())}),setTimeout(function(){e(".gencutom-title").html("Remove Profile Picture")},100)},_sharing.CheckCustomerExists=function(t){if("onlineappointment"==_sharing.parentPage.toLowerCase()||e("#pnlAddFamilyFriendSharingModal").is(":visible")){var i=e(t).val();if(trim(i).toLowerCase()!=trim(document.getElementById("hdnFFUserEmailId").value).toLowerCase()){var a={};if(_sharing.IsCallFromOnlinePage()){a.EmailId=i,a.ParentPage=_sharing.parentPage,"onlinemyaccount"==_sharing.parentPage.toLowerCase()&&(a.strFFMasterUserId=_sharing.strFFMasterUserId);var r={};r.objEntity=a,_sharing.ajaxCall("CheckUserExistsByEmailID",r,_sharing.CallCustomerSuccessEmail,_sharing.CallFailedCustomerJSON,!1)}else a.strUserName=i,a.lBusinessID=_sharing.BusinessID,setTimeout(function(){CallWSJSON("VagaroWebOffline.asmx/CheckUserExistsByEmailID",JSON.stringify(a),_sharing.CallCustomerSuccessEmail,_sharing.CallFailedCustomerJSON)},100)}}},_sharing.CallCustomerSuccessEmail=function(t){_sharing.ShowHideLoadingPanel(!1),0==_sharing.IsCallFromOnlinePage()&&(t=t.d);var i=e("#txtFFEmail:visible").length>0?e("#txtFFEmail"):e("#txtFFEmailOpt:visible").length>0?e("#txtFFEmailOpt"):null;if(null!=i){var a=!1,r=!0;if(null!=t){if(_sharing.IsEditMode)return _sharing.ShowHidePassiveAlert(2,"A user with this email address already exisits. Vagaro does not allow more than one user with the same email address."),e(i).val(_sharing.PreviousFFUserEmailId),void e(i).focus();if(t.UserID==_sharing.FFMasterUserId&&"onlinemyaccount"!=_sharing.parentPage.toLowerCase())return _sharing.ShowHidePassiveAlert(2,"This user has already been added to this customer's Family & Friends Sharing."),e(i).val(_sharing.PreviousFFUserEmailId),void e(i).focus();if("onlinemyaccount"==_sharing.parentPage.toLowerCase()&&t.strUserID==_sharing.strFFMasterUserId)return _sharing.ShowHidePassiveAlert(2,"This user has already been added to this customer's Family & Friends Sharing."),e(i).val(_sharing.PreviousFFUserEmailId),void e(i).focus();1==t.UserType?1==_sharing.IsCallFromOnlinePage()?_sharing.confirmDialognAction(!0,t):(a="This email is used by an existing Vagaro user “"+t.FirstName+" "+t.LastName+"”. Would you like to continue adding "+t.FirstName+" "+t.LastName+" to Family and Friends Sharing?",swal({title:"",text:a,timer:4e3,showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Use This Profile",cancelButtonText:"Cancel",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(e){void 0!==e&&null!=e&&(e?_sharing.confirmDialognAction(!0,t):_sharing.confirmDialognAction(!1,t))}),setTimeout(function(){e(".gencutom-title").html("Use Existing Vagaro Profile")},100)):"onlineappointment"==_sharing.parentPage.toLowerCase()?(a="This email is used by an existing Vagaro user “"+t.FirstName+" "+t.LastName+"”. Would you like to continue adding "+t.FirstName+" "+t.LastName+" to Family and Friends Sharing?",swal({title:"",text:a,timer:4e3,showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Use This Profile",cancelButtonText:"Cancel",animation:"slide-from-bottom",closeOnConfirm:!0,closeOnCancel:!0,customClass:"sweet-alert-model text-left"},function(e){void 0!==e&&null!=e&&(e?(_sharing.EnableDisableControl(!0),_sharing.confirmDialognAction(!0,t)):_sharing.confirmDialognAction(!1,t))}),setTimeout(function(){e(".gencutom-title").html("Use Existing Vagaro Profile")},100)):(_sharing.ShowHidePassiveAlert(2,_sharing.UserExistsMsg),r=!1,_sharing.confirmDialognAction(!0,t))}else{var o=e(i).val();_sharing.FFUserEmailId=o,_sharing.PreviousFFUserEmailId=o,e("#hdnFFUserEmailId").val(o)}r||_sharing.EnableDisableControl(!0)}},_sharing.CallFailedCustomerJSON=function(e){_sharing.ShowHideLoadingPanel(!1);try{var t=JSON.parse(e.responseText);_sharing.ShowHidePassiveAlert(2,t.Message)}catch(e){_sharing.ShowHidePassiveAlert(3,"Something went wrong, Try Again.")}},_sharing.EnableDisableControl=function(t){t?(e("div.addedit-ffpopup-uploadpropic-cnt div.drag-drop-new").off(),e("#AddEditPopupFFProfilePicUpload").off(),e("#aDeleteFFProfilePic").removeAttr("onclick")):(_sharing.bindImageUploadEventsForFFSharing(),e("#aDeleteFFProfilePic").attr("onclick","_sharing.deleteFFProfilePic()"));e("#AddEditPopupFFProfilePicUpload").prop("disabled",t),e("#txtFFEmail").prop("disabled",t),e("#txtFFEmailOpt").prop("disabled",t),e("#txtFFPhone").prop("disabled",t),e("#txtFFPhoneOpt").prop("disabled",t),e("#txtFFfirstName").prop("disabled",t),e("#txtFFlastName").prop("disabled",t),e("#cboFFMonth").prop("disabled",t),e("#cboFFDay").prop("disabled",t),e("#cboFFYear").prop("disabled",t),e("#divFFGendarSelectOptions").prop("disabled",t)},_sharing.confirmDialognAction=function(t,i){if(_sharing.IsOverrideInfo=!0,1==t){if("onlinemyaccount"==_sharing.parentPage.toLowerCase()?_sharing.strFFUserId=i.strUserID:_sharing.FFUserId=i.UserID,_sharing.FFUserEmailId=i.EmailId,_sharing.PreviousFFUserEmailId=i.EmailId,1==_sharing.IsEditMode||0==_sharing.IsCallFromOnlinePage()||1==_sharing.IsCallFromOnlinePage()){if(""!=i.Cell&&null!=i.IsCellValid&&0==i.IsCellValid){_sharing.ShowHidePassiveAlert(2,"Please enter a valid phone number."),e("#txtFFPhone").addClass("errorInput"),e("#txtFFPhoneOpt").addClass("errorInput"),_sharing.IsUserCellNotValid=!0}else e("#txtFFPhone").removeClass("errorInput"),e("#txtFFPhoneOpt").removeClass("errorInput");if(e("#hdnFFUserEmailId").val(i.EmailId),e("#txtFFfirstName").val(i.FirstName),e("#txtFFlastName").val(i.LastName),e("#txtFFEmail").val(i.EmailId),e("#txtFFEmailOpt").val(i.EmailId),e("#txtFFPhone").val(i.Cell),e("#txtFFPhoneOpt").val(i.Cell),"undefined"!=i.sBirthDate&&null!=i.sBirthDate&&""!=i.sBirthDate)(a=i.sBirthDate.split("/")).length>0&&(vDay=a[1],vMonth=a[0],vYear=a[2],vDay=vDay.replace(/^0+/,""),e("#cboFFDay").val(vDay),vMonth=vMonth.replace(/^0+/,""),e("#cboFFMonth").val(vMonth),vYear==_sharing.defaultYear?e("#cboFFYear").val("-1"):e("#cboFFYear").val(vYear));e("#divFFGendarSelectOptions").val(i.Gender)}else{var a;if(e("#hdnFFUserEmailId").val(i.EmailId),_sharing.txtFFfirstName=i.FirstName,_sharing.txtFFlastName=i.LastName,_sharing.txtFFEmail=i.EmailId,_sharing.txtFFEmailOpt=i.EmailId,_sharing.txtFFPhone=i.Cell,_sharing.txtFFPhoneOpt=i.Cell,"undefined"!=i.sBirthDate&&null!=i.sBirthDate&&""!=i.sBirthDate)(a=i.sBirthDate.split("/")).length>0&&(vDay=a[1],vMonth=a[0],vYear=a[2],vDay=vDay.replace(/^0+/,""),_sharing.cboFFDay=vDay,vMonth=vMonth.replace(/^0+/,""),_sharing.cboFFMonth=vMonth,vYear==_sharing.defaultYear?_sharing.cboFFYear=-1:_sharing.cboFFYear=vYear,_sharing.Age=_sharing.CalculateAge(i.sBirthDate));_sharing.divFFGendarSelectOptions=i.Gender,0==i.IsFirstTimeCustomer?_sharing.IsOverrideInfo=!1:_sharing.IsOverrideInfo=!0}""!=i.Photo&&null!=i.Photo&&(_sharing.UploadedFFImageStream="",_sharing.UploadedFFImageName=i.CDNUrl+_sharing.UserImageSize+"/"+i.Photo,_sharing.OldUploadedFFImageName=i.CDNUrl+_sharing.UserImageSize+"/"+i.Photo,_sharing.setImageOnAddEdit(_sharing.UploadedFFImageName)),"onlinemyaccount"==_sharing.parentPage.toLowerCase()?_sharing.GetUserFamilyAndFriendDetailsByEmail(i.EmailId):_sharing.checkUserAlreadyFamilyFriend(i.UserID)}else{var r=e("#txtFFEmail:visible").length>0?e("#txtFFEmail"):e("#txtFFEmailOpt:visible").length>0?e("#txtFFEmailOpt"):null;""!=_sharing.PreviousFFUserEmailId?(e("#hdnFFUserEmailId").val(_sharing.PreviousFFUserEmailId),null!=r&&(e(r).val(_sharing.PreviousFFUserEmailId),e(r).focus())):(e("#hdnFFUserEmailId").val(""),null!=r&&(e(r).val(""),e(r).focus()))}},_sharing.CheckCustomerExistsByID=function(e){if(0!=e){var t={};t.lUserID=e,t.lBusinessID=_sharing.BusinessID,t.AllCCDeatils=!1,CallWSJSON("VagaroWebOffline.asmx/GetCustomerDetailsByIDNew",JSON.stringify(t),_sharing.CallEditCustomer,_sharing.CallFailedCustomerJSON)}},_sharing.CallEditCustomer=function(t){if(null!=(t=t.d)){_sharing.FFUserId=t.UserID,_sharing.OpenCreateNewFamilyFriendPopup(),null!=t.Photo&&""!=t.Photo&&(-1!=t.Photo.indexOf("user-")&&-1!=t.Photo.indexOf("http")||(_sharing.UploadedFFImageName=t.Photo,_sharing.OldUploadedFFImageName=t.Photo,_sharing.setImageOnAddEdit(_sharing.UploadedFFImageName))),e("#txtFFfirstName").val(t.FirstName),e("#txtFFlastName").val(t.LastName);var i=t.Cell;if(i=i.replace(/-/g,""),e("#txtFFPhone").val(i),e("#txtFFPhoneOpt").val(i),""!=i&&null!=t.IsCellValid&&0==t.IsCellValid?(_sharing.ShowHidePassiveAlert(2,"Please enter a valid phone number."),e("#txtFFPhone").addClass("errorInput"),e("#txtFFPhoneOpt").addClass("errorInput"),_sharing.IsUserCellNotValid=!0):(e("#txtFFPhone").removeClass("errorInput"),e("#txtFFPhoneOpt").removeClass("errorInput")),null!=t.Cell&&t.CellCountryID>0&&(friendfamilycellPhone.setPhoneData(t.CellCountryID,t.Cell),childcellphone.setPhoneData(t.CellCountryID,t.Cell)),null!=t.EmailId&&""!=t.EmailId&&(_sharing.FFUserEmailId=t.EmailId,_sharing.PreviousFFUserEmailId=t.EmailId,e("#hdnFFUserEmailId").val(t.EmailId),e("#txtFFEmail").val(t.EmailId),e("#txtFFEmailOpt").val(t.EmailId)),null!=t.BirthDate){t.BirthDate=moment(new Date(t.sBirthDate))._d;var a=t.BirthDate.getDate(),r=t.BirthDate.getMonth(),o=t.BirthDate.getFullYear();e("#cboFFMonth").val(r+1),e("#cboFFDay").val(a),o==_sharing.defaultYear?e("#cboFFYear").val(-1):e("#cboFFYear").val(o)}e("#divFFGendarSelectOptions").val(t.Gender),_sharing.checkUserAlreadyFamilyFriend(t.UserID)}"1"!=t.UserType&&(_sharing.EnableDisableControl(!0),_sharing.ShowHidePassiveAlert(2,_sharing.UserExistsMsg)),_sharing.ShowHideLoadingPanel(!1)},_sharing.AddNewCustomerInLocalStorage_Cust=function(t,i){if(_sharing.IsLocalStorageSupported()&&void 0!==localStorage.cusList)try{var a=JSON.parse(localStorage.cusList||[]);if(void 0!==a&&null!=a&&void 0!==t&&null!=t){i=void 0!==i&&null!=i&&1==i;var r=e.grep(a,function(e){return e.ID==t.CustomerID});if((void 0===r||null==r||r.length<=0)&&0==i)return;var o={};o.ID=t.CustomerID.toString(),o.FN=t.FullName,o.C=t.glbCell,o.D=i?"":r[0].D,o.N=i?"":r[0].N,(a=e.grep(a,function(e){return e.ID!=t.CustomerID})).push(o),localStorage.cusList=JSON.stringify(a),localStorage.data="Change","checkout"==_sharing.parentPage.toLowerCase()?setCheckoutCustomerLocalStorageData():"customermodule"==_sharing.parentPage.toLowerCase()&&setCustomerModuleCustomerLocalStorageData()}}catch(e){localStorage.removeItem("cusList"),localStorage.removeItem("cusSynInfo")}},_sharing.GetSetLocalStorageForPetDetails=function(e){var t=null;try{_sharing.IsLocalStorageSupported()&&(null!=e&&e.length>0?localStorage.setItem("petdetails",JSON.stringify(e)):null==e&&void 0!==localStorage.petdetails&&(t=JSON.parse(localStorage.getItem("petdetails"))))}catch(e){t=null,localStorage.removeItem("petdetails")}return t},_sharing.GetSetIndexedDBForPetDetails=function(e){return new Promise(function(t,a){try{if(!_sharing.IsIndexedDBSupported())return void t([]);var r,o=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,n=new Date,s=n.getFullYear()+""+_sharing.fixDigit(n.getMonth()+1)+_sharing.fixDigit(n.getDate());if(null!=e&&e.length>0){(l=o.open("PetDB",s)).onupgradeneeded=function(t){var a=t.target.result;if(!a.objectStoreNames.contains("petDetails")){var r=a.createObjectStore("petDetails",{keyPath:"speciesId",autoIncrement:!0});r.createIndex("text","text",{unique:!1});var o=e.length;for(i in e)o>0&&(o--,r.add(e[i]))}},l.onsuccess=function(e){t(l.result)},l.onerror=function(e){a(e)}}else{var l,d=!1;(l=o.open("PetDB",s)).onupgradeneeded=function(){d=!0},l.onsuccess=function(e){if(!(r=e.target.result).objectStoreNames.contains("petDetails")||d)return r.close(),o.deleteDatabase("PetDB"),void t([]);var i=r.transaction(["petDetails"],"readonly").objectStore("petDetails"),n=[],s=i.openCursor();s.onsuccess=function(e){var i=e.target.result;i?(n.push(i.value),i.continue()):(_sharing.IndexedPetDbData=n,t(n))},s.onerror=function(){a("Read error")}},l.onerror=function(e){a(e)}}}catch(e){a(e)}})},_sharing.fixDigit=function(e){return 1===e.toString().length?"0"+e:e},_sharing.IsIndexedDBSupported=function(){return!!(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB)},_sharing.IsLocalStorageSupported=function(){var e=!1;try{"object"==typeof localStorage&&(localStorage.setItem("localStorage",1),localStorage.removeItem("localStorage"),e=!0)}catch(t){e=!1}return e},_sharing.ShowHideLoadingPanel=function(e){"onlinemyaccount"==_sharing.parentPage.toLowerCase()||"onlineappointment"==_sharing.parentPage.toLowerCase()||"onlineclassbook"==_sharing.parentPage.toLowerCase()||"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase()?ShowLoader(e):""!=_sharing.parentPage.trim()&&ShowLoadingPanel(e)},_sharing.ShowHidePassiveAlert=function(e,t,i){"onlinemyaccount"==_sharing.parentPage.toLowerCase()||"onlineappointment"==_sharing.parentPage.toLowerCase()||"onlineclassbook"==_sharing.parentPage.toLowerCase()||"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase()?1==e?_common.PassiveAlertSuccessgreen(t,i):2==e?_common.PassiveAlertwarning(t,i):3==e&&_common.PassiveAlertfail(t):1==e?ShowHideDoneMessage(t):2==e?ShowHideWarningMessage(t):3==e&&ShowHideFailedMessage(t)},_sharing.GetAllPetDetails=async function(){try{const t=await _sharing.GetSetIndexedDBForPetDetails(null);if(t&&t.length>0)_sharing.bindPetDatabaseToSelect(t);else{var e={objRequest:{businessID:_sharing.BusinessID,loginUserID:_sharing.LoggedInUserId}};_sharing.ShowHideLoadingPanel(!0),_sharing.ajaxCall("websiteapi/homepage/getallpetdetails",e,_sharing.onSuccessGetAllPetDetails,_sharing.onFailCommonMethod,!1,!1,!0)}}catch(e){console.log("Error:",e)}},_sharing.onSuccessGetAllPetDetails=function(e){null!=e&&e.length>0&&(_sharing.bindPetDatabaseToSelect(e),_sharing.GetSetIndexedDBForPetDetails(e)),_sharing.ShowHideLoadingPanel(!1)},_sharing.bindPetDatabaseToSelect=function(t){if(null!=t&&t.length>0){var i={dropdownCssClass:"familypetdrop",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Select Species/Breed",collapasable:!1,selectAllText:!1,scrollTop:!1};i.data=t,_sharing.BindSelect2Dropdown(e("#selFFSpeciesBreed"),i)}},_sharing.BindSelect2Dropdown=function(t,i){void 0!==i.placeholder&&""!=i||((i={}).dropdownCssClass="",i.isSearchRequire=!1,i.selectOnClick=!0,i.placeholder=""),t.select2("destroy"),t.off("selected"),t.off("select2-close"),t.select2({searchInputPlaceholder:void 0!==i.placeholder&&""!=i.placeholder?i.placeholder:"",combobox:i.isSearchRequire,collapasable:!1,selectOnClick:!0,minimumInputLength:0,maximumInputLength:100,dropdownCssClass:i.dropdownCssClass,formContainer:"#page-wrapper",data:function(){return void 0!==i.data?{results:e.extend(!0,[],i.data)}:null},matcher:function(e,t,i){for(var a=/\s\s+/g,r=/[^0-9a-zA-Z\" \"]+/gi,o=e.replace(a," "),n=(o=o.toLowerCase().replace(r,"")).split(" "),s="",l=n.length,d=0,c=0;c<=n.length-1;c++){var u="";if(((u=(u=void 0===i.id?t.replace(a," "):(u=i.id.replace(a," ")).replace("_"," ")).toLowerCase().replace(r,"")).match("^"+n[c])||-1!=u.indexOf(" "+n[c]))&&((""==s||n[c].indexOf(s)<0)&&(d+=1),s=" "+u,d>=l))break}return d>=l&&(i.isShow=!0,!0)},formatNoMatches:function(){return e(".select2-results .select2-no-results").remove(),"No matches found"}}).on("select2-opening",function(e){t.select2("data",{id:"",text:"",species:""})}).on("selected",function(i){e(i.target).data("selecteddetail",JSON.stringify(i.choice)),void 0!==t.data("choice")&&_sharing.SetChoiceForSeleect2(t,i.choice)}).on("select2-open",function(a){e(this).data("isopen",!0);var r=_sharing.GetChoiceForSeleect2(t);void 0!==r.id&&t.select2("data",{id:r.id,text:r.text}),(void 0===i.selectAllText||i.selectAllText)&&setTimeout(function(){e(a.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100)}).on("change",function(e){if(void 0!==t.data("choice")&&""==t.data("select2").getVal().toString()){var i={id:"",text:"",species:""};t.select2("data",i),_sharing.SetChoiceForSeleect2(t,i)}}).on("select2-close",function(t){e(this).data("isopen",!1),e("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){e("#select2-drop-mask").off("touchstart.custom")},500)})},_sharing.SetChoiceForSeleect2=function(e,t){e.data("choice",JSON.stringify(t))},_sharing.GetChoiceForSeleect2=function(e){try{return JSON.parse(e.data("choice"))}catch(e){return{}}},_sharing.SetDefaultForSeleect2=function(e){e.data("choice",JSON.stringify({id:"",text:""}))},_sharing.IsCallFromOnlinePage=function(){return void 0!==_sharing.parentPage&&null!=_sharing.parentPage&&("onlinemyaccount"==_sharing.parentPage.toLowerCase()||"onlineappointment"==_sharing.parentPage.toLowerCase()||"onlineclassbook"==_sharing.parentPage.toLowerCase()||"onlineshoppingcart"==_sharing.parentPage.toLowerCase()||"booknowupsell"==_sharing.parentPage.toLowerCase())},_sharing.IsSpecificParentPage=function(e){var t=!1;return void 0!==e&&null!=e&&""!=e.trim()&&(t=void 0!==_sharing.parentPage&&null!=_sharing.parentPage&&""!=_sharing.parentPage.trim()&&_sharing.parentPage.toLowerCase()==e.toLowerCase()),t},_sharing.IsHasCustomerModifyRights=function(){var e=!1;return _sharing.IsSpecificParentPage("CustomerModule")&&"undefined"!=typeof GetCustomerRight||_sharing.IsSpecificParentPage("CustomerHistory")&&"undefined"!=typeof GetCustomerRight?e="2"==GetCustomerRight():_sharing.IsSpecificParentPage("checkout")&&void 0!==_checkout.HasCustomerModifyRights?e=_checkout.HasCustomerModifyRights:(_sharing.IsSpecificParentPage("onlinemyaccount")||_sharing.IsSpecificParentPage("onlineappointment")||_sharing.IsSpecificParentPage("onlineclassbook")||_sharing.IsSpecificParentPage("onlineshoppingcart")||_sharing.IsSpecificParentPage("booknowupsell"))&&(e=!0),e||_sharing.ShowHidePassiveAlert(2,"Sorry you don`t have permission."),e},e("#btnFFCustomerClose").mousedown(function(){_sharing.mousedownHappened=!0}),_sharing.CheckAnyTabSelected=function(){return 1===e("#divAddNewFamilyFriendTabLink a.w-tab-link.w--current").length?(e("#divAddNewFamilyFriendTabLink").removeClass("error-ffsharing-tab-select"),e("#dvFFSharingError").html(""),!0):(e("#divAddNewFamilyFriendTabLink").addClass("error-ffsharing-tab-select"),e("#dvFFSharingError").html("required."),!1)},_sharing.AddErrorHideClassforFFSharing=function(t){t?(e("#divAddNewFamilyFriendTabLink").removeClass("error-ffsharing-tab-select"),e("#dvFFSharingError").html(""),e("#divAddNewFamilyFriendTabLink a.w-tab-link").removeClass("w--current"),e("#divAddNewFamilyFriendContainer").addClass("hide-block-ffsharing"),e("#dvFFSharingOp").addClass("hide-block-ffsharing")):(e("#divAddNewFamilyFriendTabLink").removeClass("error-ffsharing-tab-select"),e("#dvFFSharingError").html(""),e("#divAddNewFamilyFriendContainer").removeClass("hide-block-ffsharing"),e("#dvFFSharingOp").removeClass("hide-block-ffsharing"))},_sharing.CalculateAge=function(e){var t=-1;if(null!=e){var i=new Date,a=e.split("/");if("-1"!=a[0]&&"-1"!=a[1]&&"-1"!=a[2]){var r=new Date(a[2],1*a[0]-1,a[1]);t=Math.floor((i.getTime()-r.getTime())/315576e5)}}return t},_sharing.CheckDateofbirthandEmail=function(t,i){var a;e("#txtFFfirstName").val(),e("#txtFFlastName").val();if("Child"==_sharing.SelectedFFRelation)if(t){a=e.trim(e("#txtFFEmailOpt").val());var r=e("#cboFFDay").val(),o=e("#cboFFMonth").val(),n=e("#cboFFYear").val();_sharing.Age=_sharing.CalculateAge(o+"/"+r+"/"+n),""==a?(e("#txtFFEmailOpt").addClass("errorInput"),"-1"==r||"-1"==o||"-1"==n?(e("#cboFFMonth").addClass("errorInput"),e("#cboFFDay").addClass("errorInput"),e("#cboFFYear").addClass("errorInput"),i=!1):_sharing.Age<18&&_sharing.Age>=0?(e("#txtFFEmailOpt").removeClass("errorInput"),e("#lblOptional").show()):(e("#txtFFEmailOpt").addClass("errorInput"),e("#lblOptional").hide(),i=!1)):(e("#cboFFMonth").removeClass("errorInput"),e("#cboFFDay").removeClass("errorInput"),e("#cboFFYear").removeClass("errorInput"),_sharing.Age<18&&_sharing.Age>=0?e("#lblOptional").show():e("#lblOptional").hide())}else 1==_sharing.ExistingIsShareAppointments&&1!=_sharing.IsShareAppointmentsAccepted?-1!=_sharing.Age?""==e.trim(e("#txtFFEmailOpt").val())&&_sharing.Age>18?(e("#txtFFEmailOpt").addClass("errorInput"),e("#lblOptional").hide(),i=!1):(e("#lblOptional").show(),e("#txtFFEmailOpt").removeClass("errorInput")):""==e.trim(e("#txtFFEmailOpt").val())?(e("#txtFFEmailOpt").addClass("errorInput"),e("#lblOptional").hide(),i=!1):(e("#lblOptional").show(),e("#txtFFEmailOpt").removeClass("errorInput")):(e("#lblOptional").show(),e("#txtFFEmailOpt").removeClass("errorInput")),e("#cboFFMonth").removeClass("errorInput"),e("#cboFFDay").removeClass("errorInput"),e("#cboFFYear").removeClass("errorInput"),-1!=_sharing.Age&&_sharing.Age>=0&&_sharing.Age<18&&(swal({title:"",text:"This setting is defaulted on and cannot be turned off because your child is under the age of 18.",customClass:"swal-white-greenbtn sweet-alert-model employee-exists"},function(t){swal.close(),e("#ffShareAppointments").prop("checked",!0).attr("aria-label","Toggle on for").next().attr("aria-checked",!0)}),e(".gencutom-title").html("Viewing Your Child's Appointments"));return i},_sharing.CheckIsInvitationAccepted=function(){var t=e("#txtFFfirstName").val()+" "+e("#txtFFlastName").val();null!=t&&"undefined"!=t&&""!=t.trim()&&(_sharing.FFMasterUserFullName=t),1==e("#ffShareAppointments").prop("checked")?1!=_sharing.FFIsInvitationAccepted?(swal({title:"",text:_sharing.FFMasterUserFullName+" will be sent the Family & Friends Sharing email and must accept the invitation to activate the View Appointment Setting.",customClass:"swal-white-greenbtn sweet-alert-model employee-exists"},function(e){swal.close(),_sharing.CheckDateofbirthandEmail(!0,!0)}),e("#pnlAddFamilyFriendSharingModal").length>0&&e("#pnlAddFamilyFriendSharingModal").removeAttr("tabindex"),e(".gencutom-title").html("Family & Friends Acceptance Required")):_sharing.CheckDateofbirthandEmail(!0,!0):_sharing.ExistingIsShareAppointments&&1!=_sharing.IsShareAppointmentsAccepted?_sharing.CheckDateofbirthandEmail(!0,!0):(_sharing.IsShareAppointments=!1,_sharing.CheckDateofbirthandEmail(!1,!0))}}(jQuery,window,document),function(e){_shareListing={},_shareListing.listDiv=e("#familyListDiv"),_shareListing.parentPage="",_shareListing.IsOnlineCall=!1,_shareListing.MasterUserId=0,_shareListing.BusinessID=0,_shareListing.strMasterUserId="",_shareListing.strBusinessID="",_shareListing.InvitationPendingType=0,_shareListing.InvitationAcceptedType=1,_shareListing.InvitationDenyedType=2,_shareListing.OnlineClassBookElement=null,e(document).on("touchstart click",function(t){e(t.target).closest("._3-circle-menu-pkg").length||e(t.target).closest(".dots-dropdownparent").length||(e(".dots-dropdown").hide(),e("._3-circle-menu-pkg").removeClass("active"),e("#scrollright .custmng-gridcont:visible").length&&e("#scrollright .custmng-gridcont:visible").removeClass("custHeight100"))}),_shareListing.GetUserFamilyAndFriendDetails=function(e,t){var i={};_shareListing.containsAlphabet(e)?(_shareListing.strMasterUserId=e,i.strLoginUserId=_shareListing.strMasterUserId):(_shareListing.MasterUserId=parseInt(e),i.UserID=_shareListing.MasterUserId),_shareListing.containsAlphabet(t)?(_shareListing.strBusinessID=t,i.strBusinessId=_shareListing.strBusinessID):(_shareListing.BusinessID=parseInt(t),i.businessID=_shareListing.BusinessID),i.IsInvitationAccepted=null,_shareListing.IsOnlineCall=_shareListing.IsCallFromOnlinePage(),i.IsLoadFromOffline=_shareListing.IsOnlineCall,i.ParentPage=_shareListing.parentPage,_shareListing.ShowHideLoadingPanel(!0);var a={};a.objRequest=i,setTimeout(function(){_shareListing.ajaxCall("GetFamilyAndFriendsDetailsByUserID",a,_shareListing.onSuccessGetUserFamilyAndFriendDetails,_shareListing.onFailGetUserFamilyAndFriendDetails,!1,!1)},100)},_shareListing.containsAlphabet=function(e){return/[a-zA-Z]/.test(e)},_shareListing.SetClassBookingParentPage=function(e,t){_shareListing.parentPage=t,_sharing.parentPage=t,_shareListing.loadAddEditFamilyFriendUserControl(1,0,0,!1,e,""),_shareListing.OnlineClassBookElement=e},_shareListing.onSuccessGetUserFamilyAndFriendDetails=function(t){if(_shareListing.ShowHideLoadingPanel(!1),_shareListing.BindFamilyFriendInUserProfile(t),"undefined"!=typeof FFCustIDEditSetting&&0!=FFCustIDEditSetting){var i=e("#divFFUserDetail"+FFCustIDEditSetting);i.length>0&&(i.find(".btnEdit").click(),FFCustIDEditSetting=0)}},_shareListing.onFailGetUserFamilyAndFriendDetails=function(e){_shareListing.ShowHideLoadingPanel(!1),ShowHideFailedMessage("Something Went Wrong. Family and Friends Listing Failed.")},_shareListing.loadAddEditFamilyFriendUserControl=function(t,i,a,r,o,n){if(_shareListing.IsHasCustomerModifyRights(o))if(_shareListing.IsOnlineCall=_shareListing.IsCallFromOnlinePage(),_shareListing.IsOnlineCall&&e("#divAddEditFamilyFriendUserControlContainer").length>0&&(""==e("#divAddEditFamilyFriendUserControlContainer").html()||null==e("#divAddEditFamilyFriendUserControlContainer").html())){_shareListing.ShowHideLoadingPanel(!0),e("#divAddEditFamilyFriendUserControlContainer").html("");var s={UserControlPath:"~/ShopOwner/UserControls/ucFamilyFriendSharing.ascx",PageNamePath:"~/Public.Master",isRemoveFormTag:!0};"undefined"!=typeof BasePage&&"MyAccount"!=BasePage?s.Parameters={IsFromDetail:!0}:"undefined"!=typeof BasePage&&"MyAccount"==BasePage&&(s.Parameters={IsFromMyAccount:!0}),setTimeout(function(){vagaro.ajaxCall(ApiURLEnumCommon.loadusercontrol,s,function(s){e("#divAddEditFamilyFriendUserControlContainer").html(s),_shareListing.ShowHideLoadingPanel(!1),_sharing.parentPage=_shareListing.parentPage,"onlineclassbook"!=_shareListing.parentPage.toLowerCase()&&"onlineshoppingcart"!=_shareListing.parentPage.toLowerCase()&&"booknowupsell"!=_shareListing.parentPage.toLowerCase()||("undefined"!=typeof AppBookBusinessID&&null!=AppBookBusinessID?_sharing.BusinessID=AppBookBusinessID:_sharing.BusinessID=businessID),setTimeout(function(){_sharing.parentPage=_shareListing.parentPage,1==t?_sharing.ShowFriendFamilyPopup():2==t?_sharing.GetUserFamilyAndFriendDetailsById(i,a):3==t?_sharing.deleteUserFamilyAndFriend(i,a,r,o,n):4==t&&_sharing.resendInvitation(i,a,o,3)},300)},function(e){_shareListing.ShowHideLoadingPanel(!1),_shareListing.ShowHidePassiveAlert(3,"Something Went Wrong.")},!1,!0)},100)}else 1==t?_sharing.ShowFriendFamilyPopup():2==t?_sharing.GetUserFamilyAndFriendDetailsById(i,a):3==t?_sharing.deleteUserFamilyAndFriend(i,a,r,o,n):4==t&&_sharing.resendInvitation(i,a,o,3)},_shareListing.BindFamilyFriendInUserProfile=function(t){if(_shareListing.IsOnlineCall=_shareListing.IsCallFromOnlinePage(),void 0!==t&&null!=t&&t.length>0){var i=e("#familyListID"),a=e("#FriendlistID");i.html(""),a.html("");var r=e.grep(t,function(e){return"Friend"==e.Relation}).sort(function(e,t){return e.FullName.localeCompare(t.FullName)}),o=e.grep(t,function(e){return"Friend"!=e.Relation}).sort(function(e,t){return e.FullName.localeCompare(t.FullName)});e("#tmplFamilyFriend").tmpl(o).appendTo(i),e("#tmplFamilyFriend").tmpl(r).appendTo(a),e("#addFamilyDiv").hide(),e("#familyListDiv").show(),o.length>0?e("#txtFamily").show():e("#txtFamily").hide(),r.length>0?e("#txtFriends").show():e("#txtFriends").hide(),e("._3-circle-menu-pkg",_shareListing.listDiv).off(),e("._3-circle-menu-pkg",_shareListing.listDiv).click(function(){e(".dots-dropdown",e(this).parent()).toggle(),e(".dots-dropdown",_shareListing.listDiv).not(e(this).parent().find(".dots-dropdown")).hide();var t=e(this).parent().find(".dots-dropdown").height(),i=e(window).height();t+(_shareListing.IsCallFromOnlinePage()?e(this).offset().top-e(window).scrollTop():e(this).offset().top)+50>i?e(".dots-dropdown").addClass("ffdropdownbottom"):e(".dots-dropdown").removeClass("ffdropdownbottom")})}else e("#familyListDiv").hide(),e("#addFamilyDiv").show();_shareListing.IsOnlineCall?(e("#divFamilyFriendListingContainer .span-addnewfamily-plussign").show(),e("#divEmptyFamilyFriendTitle").hide()):(e("#divFamilyFriendListingContainer .span-addnewfamily-plussign").hide(),e("#divEmptyFamilyFriendTitle").show())},_shareListing.ajaxCall=function(e,t,i,a,r,o){var n=new vagaro.ajax;n.datamodel.Token=e,n.datamodel.data=t,n.datamodel.callback=i,n.datamodel.Error=a,!1===o&&(n.datamodel.async=!1),!0===r?n.PostQue():n.Post()},_shareListing.ShowHideLoadingPanel=function(e){_shareListing.IsSpecificParentPage("onlinemyaccount")||_shareListing.IsSpecificParentPage("onlineclassbook")||_shareListing.IsSpecificParentPage("onlineshoppingcart")||_shareListing.IsSpecificParentPage("booknowupsell")?ShowLoader(e):ShowLoadingPanel(e)},_shareListing.ShowHidePassiveAlert=function(e,t,i){_shareListing.IsSpecificParentPage("onlinemyaccount")?1==e?_common.PassiveAlertSuccessgreen(t):2==e?_common.PassiveAlertwarning(t,i):3==e&&_common.PassiveAlertfail(t):"undefined"!=typeof isCustomerHistoryPage&&null!=isCustomerHistoryPage&&(1==isCustomerHistoryPage||"undefined"!=typeof isCustomerHistoryonLiveStreamPage&&1==isCustomerHistoryonLiveStreamPage)?1==e&&void 0!==window.parent.ShowHideDoneMessageCommon?window.parent.ShowHideDoneMessageCommon(t):2==e&&void 0!==window.parent.ShowHideWarningMessageCommon?window.parent.ShowHideWarningMessageCommon(t):3==e&&void 0!==window.parent.ShowHideFailedMessageCommon?window.parent.ShowHideFailedMessageCommon(t):1==e?ShowHideDoneMessage(t):2==e?ShowHideWarningMessage(t):3==e&&ShowHideFailedMessage(t):1==e?ShowHideDoneMessage(t):2==e?ShowHideWarningMessage(t):3==e&&ShowHideFailedMessage(t)},_shareListing.IsCallFromOnlinePage=function(){return void 0!==_shareListing.parentPage&&null!=_shareListing.parentPage&&("onlinemyaccount"==_shareListing.parentPage.toLowerCase()||"onlineclassbook"==_shareListing.parentPage.toLowerCase()||"onlineshoppingcart"==_shareListing.parentPage.toLowerCase()||"booknowupsell"==_shareListing.parentPage.toLowerCase())},_shareListing.IsSpecificParentPage=function(e){var t=!1;return void 0!==e&&null!=e&&""!=e.trim()&&(t=void 0!==_shareListing.parentPage&&null!=_shareListing.parentPage&&""!=_shareListing.parentPage.trim()&&_shareListing.parentPage.toLowerCase()==e.toLowerCase()),t},_shareListing.IsHasCustomerModifyRights=function(e){var t=!1;return _shareListing.IsSpecificParentPage("OfflineCustomerManagement")&&"undefined"!=typeof GetCustomerRight?t="2"==GetCustomerRight():(_shareListing.IsSpecificParentPage("onlinemyaccount")||_shareListing.IsSpecificParentPage("onlineclassbook")||_shareListing.IsSpecificParentPage("onlineshoppingcart")||_shareListing.IsSpecificParentPage("booknowupsell"))&&(t=!0),t||_shareListing.ShowHidePassiveAlert(2,"Sorry you don`t have permission.",e),t}}(jQuery,window,document),_siteBuilderDetail.ReviewPhotoArray=[],_siteBuilderDetail.GetAboutUsReview=null,_siteBuilderDetail.GetBusinessReview=null,_siteBuilderDetail.DefaultAddNewImage="no-Image-blank1.jpg",_siteBuilderDetail.DefaultUserMaleImg155="user-male-img_155_new.png",_siteBuilderDetail.VagaroDayOfWeekEnum={Sunday:1,Monday:2,Tuesday:3,Wednesday:4,Thursday:5,Friday:6,Saturday:7},_siteBuilderDetail.GoogleStaticMapURLFormate="https://maps.googleapis.com/maps/api/staticmap?center={0}&zoom=16&size=1024x1024&style=feature:poi|visibility:off&markers=icon:https://vagaro.azureedge.net/static-content/Images/flamingo-map-newicon-new@2x.png|{0}&key={1}",_siteBuilderDetail.IsDeal="?isdeal=yes",_siteBuilderDetail.isFavorite="",_siteBuilderDetail.mainDiv="",_siteBuilderDetail.StyleCdnUrl="",_siteBuilderDetail.reloadstyle=!0,_siteBuilderDetail.likestyle=null,_siteBuilderDetail.emptyHeartClass="unliked",_siteBuilderDetail.divStyleImages="",_siteBuilderDetail.ReviewPhotoAdd="ReviewPhoto/Original/",_siteBuilderDetail.UserGiveReview="",_siteBuilderDetail.UserGiveReviewConfirmButtonText="",_siteBuilderDetail.imagelogocount=0,_siteBuilderDetail.ScrollPos=0,_siteBuilderDetail.connectcurrentUrl=!1;var REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/i,ApiURLEnumAbout={getserviceproviderbybusinessid:(ApiPath="websiteapi/homepage/")+"getserviceproviderbybusinessid",getshopdetailstyle:ApiPath+"getshopdetailstyle",getstyleimagecommaseparated:ApiPath+"getstyleimagecommaseparated",savemyreviewpopup:"savemyreviewpopup",getuserinfo:ApiPath+"getuserinfo",getworkinghours:ApiPath+"getworkinghours",getpromotions:ApiPath+"getpromotions",getreviews:ApiPath+"getreviews",getreviewpercentage:ApiPath+"getreviewpercentage",checkuserreviews:ApiPath+"checkuserreviews",getdealsv3:"businesses/{0}/deals?pagination=false"};_siteBuilderDetail.GetCoreAPIURLV3=function(){return"undefined"!=typeof VagaroCoreAPIURLV3&&null!=VagaroCoreAPIURLV3?VagaroCoreAPIURLV3:""},_siteBuilderDetail.initialStylepageData={PageIndex:1,totalPages:0,tabName:"photos",onRowLoad:null,Id:"#ulFeatureBusiness",TemplateId:"#srpt-style-section",Response:"Styles"},_siteBuilderDetail.GetCitiesPopUpDetail={},_siteBuilderDetail.isVConnectBetaRelease=!1,_siteBuilderDetail.GetAboutUsReviewSectionComponent=function(e){_siteBuilderDetail.LoadOverAllReview()},_siteBuilderDetail.showLogoAndBusinessName=function(){try{var e=$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]),t=$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]),i=$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]);_siteBuilderDetail.IsCustomWebsite&&!e.is(":visible")?e.show():t.is(":visible")||t.show(),i.is(":visible")||i.show()}catch(e){}},_siteBuilderDetail.LoadOverAllReview=function(){if(void 0!==_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent&&null!=_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent)_siteBuilderDetail.GetAboutUsReviewSuccess(_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent);else{var e={};e.businessID=_siteBuilderDetail.businessID,e.ServiceProviderId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null;var t=new vagaro.ajax;t.datamodel.Token=ApiURLEnumAbout.getreviewpercentage,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=_siteBuilderDetail.GetAboutUsReviewSuccess,t.datamodel.data=e,t.datamodel.Error=CallFail_LoadUserControlWithProxy,t.Post()}},_siteBuilderDetail.GetAboutUsReviewSuccess=function(e){e.length>0&&(_siteBuilderDetail.ComponentResponse.lstBusinessDetail.VenueRank=e[0].VenueRankAverage);var t={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,ReviewPercent:e,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey};_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent=e,$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageaboutusreviewsection]).html($("#srpt-aboutusereview-section").tmpl(t)),1==_siteBuilderDetail.IsCustomWebsite&&($("#btnBookMark").removeClass("secondary-button"),$("#btnAboutAddReview").removeClass("secondary-button")),_shopdetail.showFavorites(),"reviews"==tabSegment&&$("#btnBookMark").hide()},_siteBuilderDetail.ScrollToTopAnchor=function(e){var t=0;_siteBuilderDetail.InPageWidget_Ios&&(t=_siteBuilderDetail.getscrollTop(ScrollTarget)),$("html,body").animate({scrollTop:$(e).offset().top+t-74},"slow"),$("#reviewheader").focus()},_siteBuilderDetail.checkUserFavourite=function(){if(!(UserID>0))return _shopdetail.bookmarkonlogin=!0,showLogin(),bappIsUndefine(IsBrandedApp)||1!=IsBrandedApp||CallbackforMobileApp(0,0,"","",0,37),!1;ShowLoader(!0),_shopdetail.addToFavorite(),ShowLoader(!1)},_siteBuilderDetail.saveReview=function(){if(0==_siteBuilderDetail.keyup($("#txtSPComments"))||0==_siteBuilderDetail.keyup($("#txtComments")))return!1;ShowLoader(!0);var e="Close",t="";if(_siteBuilderDetail.UserGiveReview.length>0)return t=_siteBuilderDetail.UserGiveReview,e=_siteBuilderDetail.UserGiveReviewConfirmButtonText,swal({title:"",text:t,customClass:"sweet-alert-model text-left",confirmButtonColor:"#DD6B55",showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:e,html:!0,animation:"slide-from-bottom"},function(e){e&&_siteBuilderDetail.CloseReviewPopup()}),$(".gencustom-close").attr("style","display:none !important"),setTimeout(function(){$(".gencutom-title").html("Unable to Write Review")},200),ShowLoader(!1),!1;$("#btnsendSPEmail","#divBusinessReviewPopup").attr("disabled",!0);var i=$("#ddlSP").val();""!=i&&"0"!=i||(i=null);var a=$("#dv-overall .selected:last").attr("data-value"),r=$("#dv-punctuality .selected:last").attr("data-value"),o=$("#dv-value .selected:last").attr("data-value"),n=$("#dv-service .selected:last").attr("data-value"),s=$("#dv-covid .selected:last").attr("data-value"),l=parseInt(null==a?"0":a),d=parseInt(null==o?"0":o),c=parseInt(null==r?"0":r),u=parseInt(null==n?"0":n),p=parseInt(null==s?"0":s),h=!0;if(void 0!==_siteBuilderDetail.ComponentResponse.lstBusinessDetail&&null!=_siteBuilderDetail.ComponentResponse.lstBusinessDetail&&(h=(_siteBuilderDetail.ComponentResponse.lstBusinessDetail.isDisplayCovidCheckin,!0)),l<=0||d<=0||c<=0||u<=0)return t="All reviews are mandatory.",swal({title:"",text:t,customClass:"sweet-alert-model text-left",confirmButtonColor:"#DD6B55",showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:e,html:!0,animation:"slide-from-bottom"}),$(".gencustom-close").attr("style","display:none !important"),ShowLoader(!1),!1;var m=$("#txtComments").val(),f="",g=$("#ddlSP").val();"0"!=g&&(f=$("#txtSPComments").val());var v=groupID;void 0===v&&(v="");for(var A=[],C=0;C<_siteBuilderDetail.ReviewPhotoArray.length;C++)if(0==_siteBuilderDetail.ReviewPhotoArray[C].temp_delete){var y={ImageInputStream:null};y.ImageName=_siteBuilderDetail.ReviewPhotoArray[C].ImageName,y.ActionName=_siteBuilderDetail.ReviewPhotoArray[C].ActionName,y.Image_Type=_siteBuilderDetail.ReviewPhotoArray[C].Image_Type,A.push(y)}var b={};b.iBusinessID=_siteBuilderDetail.businessID,b.rnkPunctuality=l,b.rnkVenue=c,b.rnkValue=d,b.rnkService=u,b.VenueReview=m,b.SPReview=f,b.loginUserID=UserID,b.iSPID=i,b.isFromShopdetail=!0,b.cboServiceProviderValue=g,b.reviewPoint=0,b.sGroup=v,b.ReviewPhotoArray=A,b.iUserID=null,window.location.href.includes("vplcheckout")?(b.rnkCovid=0,b.rnkVPL=p):(b.rnkCovid=p,b.rnkVPL=0),b.IsCovidBusiness=h,"undefined"!=typeof QueryStringCovidUserID&&null!=QueryStringCovidUserID&&""!=QueryStringCovidUserID?b.isFromCovidCleanCheckout=!0:b.isFromCovidCleanCheckout=!1;var S=new vagaro.ajax;S.datamodel.Token="websiteapi/myaccount/"+ApiURLEnumAbout.savemyreviewpopup,S.datamodel.IsNewVagaroAPI=!0,S.datamodel.data=b,S.datamodel.callback=function(i){if(i==_siteBuilderDetail.UnderMaintanance.UnderMaintananceInProgress||i==_siteBuilderDetail.UnderMaintanance.UnderMaintananceComplete){if(i==_siteBuilderDetail.UnderMaintanance.UnderMaintananceInProgress)return ShowLoader(!1),vagaro.alertsmall({message:_siteBuilderDetail.UnderMaintananceMessage,title:"Info"}),!1;if(i==_siteBuilderDetail.UnderMaintanance.UnderMaintananceComplete)return location.reload(!0),!1}if(ShowLoader(!1),"-1"==i)t="Sorry! For this salon, you can not give more than one review per day.";else if("-2"==i)t="All reviews are mandatory.";else if("-3"==i)t="You can't give reviews to yourself.";else if("-4"==i)e="OK",t="You are an employee at this business. Employees cannot write reviews for their own business.";else{if("-5"==i)return ShowLoader(!1),_siteBuilderDetail.HideWriteReviewPopup(),CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed),"true"==_shopdetail.isWidget||"true"==_shopdetail.isFacebook?vagaro.alertsmall("Sorry! You can't give a review to the salon as you are an inactive user."):window.location=location.protocol+"//"+location.host,!1;if("-7"==i)t="You cannot give a review to a business you have never visited.";else if(i.indexOf("1|")>-1){var a=i.split("|");_siteBuilderDetail.ComponentResponse.lstAboutReviewPercent=null,_siteBuilderDetail.LoadOverAllReview(),void 0!==_siteBuilderDetail.GetBusinessReview&&null!=_siteBuilderDetail.GetBusinessReview&&(_siteBuilderDetail.ComponentResponse.lstReview={Response:null,PageIndex:null,totalPages:null,FilterData:null,SortData:null},_siteBuilderDetail.LoadBusinessReviewDetail(!1)),ReviewPhotoArray=_siteBuilderDetail.ReviewPhotoArray,_shopdetail.saveImagesOnAkamai(a[8],_siteBuilderDetail.businessID,v,!1,!0,UserID);var r;r=$.grep(_siteBuilderDetail.ReviewPhotoArray,function(e){return"Add"==e.ActionName}),1==$("#divReviewFacebook .w--current").data("checked")?$FacebookLoader(function(){var e="My Ratings:"+c+"/5",t=m,i=location.protocol+"//"+location.host+"/"+_shopdetail.vagaroUrl;0==r||null==r?($("#divReviewFacebook #afboff").click(),$("#hdnAboutReviewSortType").val("1"),_siteBuilderDetail.CloseReviewPopup(!0),ShowLoader(!1),_common.PassiveAlertSuccess("Your review has been posted.","#btnAboutAddReview")):ShowLoader(!0),FBAPP.funcPostReview(businessName,e,t,BusinessDefaultImage,i,function(){})}):($("#hdnAboutReviewSortType").val("1"),0==r||null==r?(_siteBuilderDetail.CloseReviewPopup(!0),ShowLoader(!1),_common.PassiveAlertSuccess("Your review has been posted.","#btnAboutAddReview")):ShowLoader(!0))}else vagaro.alert("Sorry something went wrong, please try again!"),ShowLoader(!1)}if(t.length>0)return swal({title:"",text:t,customClass:"sweet-alert-model text-left",confirmButtonColor:"#DD6B55",showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:e,html:!0,animation:"slide-from-bottom"},function(e){e&&_siteBuilderDetail.CloseReviewPopup()}),$(".gencustom-close").attr("style","display:none !important"),setTimeout(function(){$(".gencutom-title").html("Unable to Write Review")},200),ShowLoader(!1),!1},S.datamodel.Error=function(e){ShowLoader(!1)},S.Post(),setTimeout(function(){$("#btnsendSPEmail","#divBusinessReviewPopup").attr("disabled",!1)},1e3)},_siteBuilderDetail.CheckReviewFacebookClick=function(){1==_siteBuilderDetail.IsCustomWebsite?(Webflow.destroy(),Webflow.ready(),1==$("#divReviewFacebook .w--current").data("checked")&&$("#dvFaceBookControl").length<=0&&_common.CheckFacebookControllRenders()):($("#afbon").removeClass("text-inverse"),$("#afbon").removeClass("palette-green-primary"),Webflow.destroy(),Webflow.ready(),$("#afboff").addClass("text-inverse"),$("#afboff").addClass("palette-green-primary"),1==$("#divReviewFacebook .w--current").data("checked")&&($("#afbon").addClass("text-inverse"),$("#afbon").addClass("palette-green-primary"),$("#afboff").removeClass("text-inverse"),$("#afboff").removeClass("palette-green-primary"),$("#dvFaceBookControl").length<=0&&_common.CheckFacebookControllRenders()))},_siteBuilderDetail.CloseReviewPopup=function(e){_siteBuilderDetail.HideWriteReviewPopup(),"reviews"==tabSegment?e?$("#reviews").click():_common.AddState("reviews","reviews"):"staff"!=tabSegment||String.isNullOrUndefineOrBlank($("#hdnSPReview").val())?"book-now"!=tabSegment||String.isNullOrUndefineOrBlank($("#hdnSPReview").val())?(e&&(_siteBuilderDetail.LoadOverAllReview(),void 0!==_siteBuilderDetail.GetBusinessReview&&null!=_siteBuilderDetail.GetBusinessReview&&_siteBuilderDetail.LoadBusinessReviewDetail(!0)),_siteBuilderDetail.LoadComponentDetails(DefaultTabPage),_common.AddState("",DefaultTabPage)):(_siteBuilderDetail.HideMailPopup("divSPReviewPopup"),_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1,!0),$("#mobileBack").data("backtabname","about")):(_siteBuilderDetail.HideMailPopup("divSPReviewPopup"),_siteBuilderDetail.LoadComponentDetails(tabSegment)),_siteBuilderDetail.UserGiveReview=""},_siteBuilderDetail.onSPchange=function(){"0"==$("select#ddlSP option:selected").val()?$("#ddSPReview").css("display","none"):($("#ddSPReview").css("display",""),$(".field-label.spname").text("Leave a review for "+$("#ddlSP option:selected").text()+" (optional):"),$("#txtSPComments").attr("placeholder",$("#ddlSP option:selected").text()+" appreciates your feedback."))},_siteBuilderDetail.fillstar=function(e){$(e).prevAll().addClass("glyphicon-star").removeClass("glyphicon-star-empty"),$(e).addClass("glyphicon-star").removeClass("glyphicon-star-empty"),$(e).nextAll().addClass("glyphicon-star-empty").removeClass("glyphicon-star")},_siteBuilderDetail.emptystar=function(e){$(e).parent().children(".rating-symbol").each(function(e){$(this).hasClass("glyphicon-star-empty")||$(this).addClass("glyphicon-star-empty")})},_siteBuilderDetail.clickcovidstar=function(e){var t=parseInt($(e).data("value"),10),i=$(e).parent().children(".rating-symbol");$(e).siblings().removeClass("selected");try{if(1==_siteBuilderDetail.ComponentResponse.lstBusinessDetail.isDisplayCovidCheckin&&$(e).parent().parent().length>0&&$(e).parent().parent()[0].id.toString().toLowerCase().indexOf("covid")>-1){for(var a,r=0,o=$(e).parent().children(".rating-symbol").length,n=0;n<o;n++){var s=$(e).parent().children(".rating-symbol")[n];if($(s).hasClass("glyphicon-star-empty")){a=$(e).parent().children(".rating-symbol")[n-1],r=n-1;break}}null!=a&&null!=a||(a=$(e).parent().children(".rating-symbol")[o-1],r=o-1);for(var l=0;l<o;l++)covid=$(e).parent().children(".rating-symbol")[l],l!=r&&$(covid).removeClass("select");if($(a).hasClass("select")){$(a).removeClass("select"),$(a).removeClass("selected");for(var d=0;d<=r;d++){s=$(e).parent().children(".rating-symbol")[d];$(s).hasClass("glyphicon-star-empty")||$(s).addClass("glyphicon-star-empty"),$(s).hasClass("glyphicon-star")&&$(s).removeClass("glyphicon-star")}return}$(a).addClass("select")}}catch(e){}for(n=0;n<t;n++)$(i[n]).addClass("selected");$.grep($(e).parent("div").find("div").siblings("div.rating-symbol.glyphicon-star-empty.glyphicon"),function(e,t){var i=$(e).parent("div").find("div").siblings(".selected").length,a=t+1;i<a?$(e).attr("aria-label",a+" Star").attr("aria-live","polite"):$(e).attr("aria-label",i+" out of 5 stars Selected").attr("aria-live","polite")})},_siteBuilderDetail.clickstar=function(e){var t=parseInt($(e).data("value"),10),a=$(e).parent().children(".rating-symbol");for($(e).siblings().removeClass("selected"),i=0;i<t;i++)$(a[i]).addClass("selected")},_siteBuilderDetail.DeleteReviewImage=function(e){var t=$(e).closest(".review-editpic"),i=$(e).closest(".review-gallery-image"),a=$(i).attr("img_name"),r=$(i).attr("img_upload_name"),o=$(i).attr("position");$(i).css("background-image","none"),$(e).closest(".review-editpic").hide(),null!=a&&null==r||null!=a&&null==r?(_siteBuilderDetail.ReviewPhotoArray[o].ActionName="Delete",_siteBuilderDetail.ReviewPhotoArray[o].temp_delete=!0):(_siteBuilderDetail.ReviewPhotoArray[o].ImageName=r,_siteBuilderDetail.ReviewPhotoArray[o].ActionName="Delete",_siteBuilderDetail.ReviewPhotoArray[o].temp_delete=!1),!(null!=navigator.userAgent.match(/iPad/i))&&_siteBuilderDetail.iosDevices||_siteBuilderDetail.isAndroidMobile||_siteBuilderDetail.isWindowsPhone?$(".add-reviewbtn-bg").show():$("div.reviewProfile").css("display","flex"),$(".reviewProfile-bg").append($(t))},_siteBuilderDetail.BindServiceProvider=function(e){var t=new vagaro.ajax,i={};i.businessID=e,t.datamodel.Token=ApiURLEnumAbout.getserviceproviderbybusinessid,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(e){setTimeout(function(){var t=$("#ddlSP");if(e.length>0){var i=1==_common.isCreateLinkPreserve(!0,!0)?_common.isCreateLinkPreserve(!1):null;if(null!=i&&i.length>0){var a=[];$.grep(i,function(t){"-1"!=t&&$.grep(e,function(e){e.ServiceProviderID==parseInt(t)&&a.push(e)})}),e=a.length>0?a:e}t.children("option:not(:first)").remove(),$(e).each(function(){$("<option />",{val:this.ServiceProviderID}).html(this.ServiceProviderName.escapeHtml()).appendTo(t)});var r=QueryStringServiceProvideId;if("undefined"!=r&&null!=r&&""!=r)$.grep(e,function(e){return e.ServiceProviderID.toString()==r}).length>0&&($(t).val(r),_siteBuilderDetail.onSPchange(),$(".select-service-provider-div").css("display","none"),parseInt(UserID)>0&&(QueryStringServiceProvideId=null));if(ShowLoader(!1),_common.IsWidgetForServiceProvider(!0)){var o=_common.IsWidgetForServiceProvider(!1);t.val(o),t.prop("disabled",!0)}else String.isNullOrUndefineOrBlank($("#hdnSPReview").val())||$("#ddlSP").val($("#hdnSPReview").val())}},500)},t.datamodel.data=i,t.datamodel.Error=function(e){},t.Post()},_siteBuilderDetail.PageLoadOpenReviewPopup=function(){_siteBuilderDetail.OpenReviewPopup()},_siteBuilderDetail.CheckUserReview=function(){if(ShowLoader(!0),""==UserID||"0"==UserID)return!1;var e=groupID;void 0===e&&(e="");var t={};t.iBusinessID=_siteBuilderDetail.businessID,t.loginUserID=UserID,t.sGroup=e,"undefined"!=typeof QueryStringCovidUserID&&null!=QueryStringCovidUserID&&""!=QueryStringCovidUserID?t.isFromCovidCleanCheckout=!0:t.isFromCovidCleanCheckout=!1;var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumAbout.checkuserreviews,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=t,i.datamodel.callback=function(e){e=e.ReturnValue,ShowLoader(!1);var t="Close",i="";if("-1"==e?i="Sorry! For this salon, you can not give more than one review per day.":"-4"==e?(t="OK",i="You are an employee at this business. Employees cannot write reviews for their own business."):"-5"==e?(_siteBuilderDetail.HideWriteReviewPopup(),CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed),"true"==_shopdetail.isWidget||"true"==_shopdetail.isFacebook?i="Sorry! You can't give a review to the salon as you are an inactive user.":window.location=location.protocol+"//"+location.host):"-7"==e&&(i="You cannot give a review to a business you have never visited."),i.length>0)return _siteBuilderDetail.UserGiveReview=i,_siteBuilderDetail.UserGiveReviewConfirmButtonText=t,swal({title:"",text:i,customClass:"sweet-alert-model text-left",confirmButtonColor:"#DD6B55",showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:t,html:!0,animation:"slide-from-bottom"},function(e){e&&_siteBuilderDetail.CloseReviewPopup()}),$(".gencustom-close").attr("style","display:none !important"),setTimeout(function(){$(".gencutom-title").html("Unable to Write Review")},200),!1},i.datamodel.Error=function(e){ShowLoader(!1)},i.Post()},_siteBuilderDetail.OpenReviewPopup=function(){if(_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())&&($("#divSPReviewPopup").modal("hide"),$("#divSPReviewPopupContent").hide()),_common.ScrollToToZero(),Webflow.destroy(),Webflow.ready(),$(".select-service-provider-div").css("display",""),""==$("#divWriteReview").html()&&(ShowLoader(!0),$("#divWriteReview").load(vagaroSiteBuilder.BaseURLOfVagaroAPI+_siteBuilderDetail.HTMLTemplates.AboutWriteReviewComponent[0],function(){_siteBuilderDetail.bindAdvanceUpload(),UserID>0&&_siteBuilderDetail.SetReviewData(),$("#covidReadness").click(function(){$("#covidReadnessPopup").modal("show")}),$("#covidReadness .close").click(function(){$("#covidReadnessPopup").modal("hide")}),$("#dvisCovid").hide()})),_siteBuilderDetail.BindServiceProvider(_shopdetail.businessID),_siteBuilderDetail.clrReviewPopupCtrl(),"undefined"!=typeof QueryStringCovidUserID&&null!=QueryStringCovidUserID&&""!=QueryStringCovidUserID&&(UserID=parseInt(QueryStringCovidUserID)),!(UserID>0))return showCommonLoginPopup("ReviewUC"),bappIsUndefine(IsBrandedApp)||1!=IsBrandedApp||CallbackforMobileApp(0,0,"","",0,37),!1;_siteBuilderDetail.IsCustomWebsite?_siteBuilderDetail.HideComponent(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagecustomheadersection]):_siteBuilderDetail.HideComponent(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageheadersection]),_siteBuilderDetail.HideComponent(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemenusection]),$(".pagebodycontainer").addClass("pagesectionFlex"),$("#divWriteReview").show(),""!=$("#divWriteReview").html()&&_siteBuilderDetail.SetReviewData(),_siteBuilderDetail.CheckUserReview(),setTimeout(function(){window.location.href.includes("vplcheckout")?($("#covidReadinessId").hide(),$("#vplReadinessId").show()):($("#covidReadinessId").show(),$("#vplReadinessId").hide())},500)},_siteBuilderDetail.SetReviewData=function(){_siteBuilderDetail.setUserProfileAndNameInAddReviewScreen(CheckinUserPhoto,FullUserName),$("#imgReviewBusinessLogo").attr("data-original",BusinessDefaultImage).addClass("reviewlazypager"),$("#imgReviewBusinessLogo").attr("src",BusinessDefaultImage),$(".reviewlazypager").lazyload({effect:"fadeIn"}).trigger("lazyload"),$("#imgReviewBusinessLogo").attr("onerror","_siteBuilderDetail.imageUserError(this)"),$("#divReviewBusinessName").find("div.review-business-name").text(businessName),$("#divReviewBusinessName").find("div.review-locations").text(Address),"false"!=$("#btnAboutAddReview").attr("data-addstate")&&_common.AddState("addreview","addreview"),$("#btnAboutAddReview").removeAttr("data-addstate"),("undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions||void 0!==_shopdetail.isFBExtensions&&"true"==_shopdetail.isFBExtensions.toLowerCase())&&$("#divwritereviewfb").hide(),("undefined"!=typeof isWindowsApp&&1==isWindowsApp||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)&&$("#divwritereviewfb").hide(),_shopdetail.setSelected(null,"addreview"),$("#imgReviewBusinessLogo").attr("tabindex","0"),$("#divSelect2Parent").attr("tabindex","-1"),$("#imgReviewBusinessLogo").focus()},_siteBuilderDetail.clrReviewPopupCtrl=function(){$(".rating-symbol").removeClass("selected"),$("#ddlSP").val("0"),$("#txtComments").val(""),$("#txtSPComments").val(""),$("#divReviewFacebook #afboff").click(),$("#ddSPReview").css("display","none"),$(".rating-symbol",$("#divWriteReview")).removeClass("glyphicon-star").addClass("glyphicon-star-empty"),_siteBuilderDetail.UserGiveReview="",_siteBuilderDetail.UserGiveReviewConfirmButtonText="",_siteBuilderDetail.resetImageControl()},_siteBuilderDetail.resetImageControl=function(){_siteBuilderDetail.ReviewPhotoArray=[],$(".img1").css("background-image","none"),$(".img2").css("background-image","none"),$(".img3").css("background-image","none"),$(".review-gallery-image").removeAttr("img_name"),$(".eview-gallery-image").removeAttr("img_upload_name"),$(".review-editpic").hide(),!(null!=navigator.userAgent.match(/iPad/i))&&_siteBuilderDetail.iosDevices||_siteBuilderDetail.isAndroidMobile||_siteBuilderDetail.isWindowsPhone?($(".add-reviewbtn-bg").show(),$("div.reviewProfile").hide()):($("div.reviewProfile").css("display","flex"),$(".add-reviewbtn-bg").hide()),$(".reviewProfile").removeClass("drag-drop-error"),$(".fileuplink").text("Choose File"),$(".filetypeinput").val(""),$(".reviewProfile-bg").append($(".review_img1")),$(".reviewProfile-bg").append($(".review_img2")),$(".reviewProfile-bg").append($(".review_img3"))},_siteBuilderDetail.setUserProfileAndNameInAddReviewScreen=function(e,t){if($(".Review-username").html(t),String.isNullOrUndefineOrBlank(e)){if($(".review-userImg").length>0){var i;if($(".review-userImg").attr("data-original",""),"none"==(i=_siteBuilderDetail.GetFileNameFromCDNUrl(_siteBuilderDetail.GetUserProfileImageDataOriginal($(".review-userImg")),!1))||""==i){var a=t.split(" ");$(".review-userImg").css("background-image","url('')"),$(".review-userImg").html(_siteBuilderDetail.FindInitials(a[0]+" "+a[1],"SP")),_siteBuilderDetail.AddRemoveDivoverlay(!1)}}}else $(".review-userImg").css("background-image","url("+e+")"),$(".review-userImg").attr("data-original",e),$(".review-userImg").text(""),_siteBuilderDetail.AddRemoveDivoverlay(!0)},_siteBuilderDetail.AddRemoveDivoverlay=function(e){1==e?$("#dvEditdelete").addClass("edit-delete-overlay"):$("#dvEditdelete").removeClass("edit-delete-overlay")},_siteBuilderDetail.GetFileNameFromCDNUrl=function(e,t){if(null!=e||null!=e){var i="";return(i=1==t?e.substring(e.lastIndexOf("\\")+1):e.substring(e.lastIndexOf("/")+1,e.length)).toLowerCase().indexOf(_siteBuilderDetail.DefaultAddNewImage)>-1?"":i}},_siteBuilderDetail.GetUserProfileImageDataOriginal=function(e){return $(e).attr("data-original")},_siteBuilderDetail.bindAdvanceUpload=function(){if(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone?($(".notification-text-other").hide(),$(".or-reg").hide()):($(".notification-text-other").show(),$(".or-reg").show()),_siteBuilderDetail.callJsForPhotoDesign(),_siteBuilderDetail.isAdvancedUpload()){var e=$("div.reviewProfile-bg div.reviewProfile");e.off(),e.on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}).on("dragover dragenter",function(){e.addClass("drag-drop-active")}).on("dragleave dragend drop",function(){e.removeClass("drag-drop-active")}).on("drop",function(t){ShowLoader(!0),glbdroppedFile=t.originalEvent.dataTransfer.files;var i=!0,a=glbdroppedFile[0];if("undefined"!=a&&null!=a){isValidFile(/(png|jpg|jpeg|PNG|JPG|JPEG|gif|bmp)$/i,a.name)||($(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),_common.PassiveAlertWarning("Please select correct photo file.","#btnsendSPEmail"),i=!1,ShowLoader(!1));try{if(i){var r=4194587;if(a.size>r){var o=parseFloat(4.0962763671875).toFixed(0);_common.PassiveAlertWarning("File size limit exceeds "+o+" MB.","#btnsendSPEmail"),$(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),i=!1,ShowLoader(!1)}0==a.size&&(_common.PassiveAlertWarning("File size can not be 0","#btnsendSPEmail"),$(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),i=!1,ShowLoader(!1))}}catch(t){i=!0}if(i){if(ShowLoader(!0),e.addClass("drag-drop-active").removeClass("drag-drop-error"),$(this).parent().find(".fileuplink").text("Choose File"),a){if(regex=new RegExp("[^.]+$"),"heic"==a.name.match(regex)[0].toLowerCase())return void _siteBuilderDetail.convertHEICToJPEG(a.name,a);var n=new FileReader;n.onload=function(e){_siteBuilderDetail.parseOrientation(_siteBuilderDetail.getOrientation(e.target.result),a,e.target.result)},n.readAsArrayBuffer(a)}e.removeClass("drag-drop-active"),$(".filetypeinput").val(""),ShowLoader(!1)}}else ShowLoader(!1)}),$("#imageUpload,#imageuploadmobile").off(),$("#imageUpload,#imageuploadmobile").on("change",function(t){ShowLoader(!0);var i=!0,a=t.target.files[0];if("undefined"!=a&&null!=a){isValidFile(/(png|jpg|jpeg|PNG|JPG|JPEG|gif|bmp)$/i,a.name)||($(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),_common.PassiveAlertWarning("Please select correct photo file.","#btnsendSPEmail"),i=!1,ShowLoader(!1));try{if(i){var r=4194587;if(a.size>r){var o=parseFloat(4.0962763671875).toFixed(0);_common.PassiveAlertWarning("File size limit exceeds "+o+" MB.","#btnsendSPEmail"),$(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),i=!1,ShowLoader(!1)}0==a.size&&(_common.PassiveAlertWarning("File size can not be 0","#btnsendSPEmail"),$(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),i=!1,ShowLoader(!1))}}catch(t){i=!0}if(i){if($(this).parent().find(".fileuplink").text("Choose File"),e.addClass("drag-drop-active").removeClass("drag-drop-error"),ShowLoader(!0),a){if(regex=new RegExp("[^.]+$"),"heic"==a.name.match(regex)[0].toLowerCase())return void _siteBuilderDetail.convertHEICToJPEG(a.name,a);var n=new FileReader;n.onload=function(e){_siteBuilderDetail.parseOrientation(_siteBuilderDetail.getOrientation(e.target.result),a,e.target.result)},n.readAsArrayBuffer(this.files[0])}e.removeClass("drag-drop-active"),$(".filetypeinput").val(""),$(".filetypeinputformobile").val(""),ShowLoader(!1)}}else ShowLoader(!1)}),$(".reviewProfile").on("click",function(){document.getElementById("imageUpload").click()}),$(".add-reviewbtn-bg").off(),$(".add-reviewbtn-bg").click(function(){document.getElementById("imageuploadmobile").click()})}},_siteBuilderDetail.isAdvancedUpload=function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&"FormData"in window},_siteBuilderDetail.callJsForPhotoDesign=function(){$("._3-dots-link-block").off("click"),$("._3-dots-link-block").click(function(){$(this).hasClass("active")?($(this).removeClass("active"),$(this).next(".review-gallery-edit-dropdown").removeClass("show")):($(this).addClass("active"),$(this).next(".review-gallery-edit-dropdown").addClass("show"))}),$(".review-gallery-image").off("hover"),$(".review-gallery-image").hover(function(){},function(){$(this).find("._3-dots-link-block").removeClass("active"),$(this).find(".review-gallery-edit-dropdown").removeClass("show")}),_siteBuilderDetail.iPadAndroid?$("body").addClass("touchDevice"):$("body").addClass("desktop"),_siteBuilderDetail.iPadAndroid&&($("#gallery-sortable").removeClass("gallerySortable"),$("#gallery-sortable").addClass("gallerySortableipad"),$("body").off("on"),$("body").on("touchstart",".addphoto-reviewProfile .review-gallery-image",function(){$(this).hasClass("hover")||($(".addphoto-reviewProfile .review-gallery-image").removeClass("hover"),$(".review-gallery-edit-dropdown").removeClass("show"),$(this).addClass("hover"))}))},_siteBuilderDetail.parseOrientation=function(e,t,i){var a=0,r=1,o=1;switch(e){case 2:r=-1;break;case 3:a=-180;break;case 4:o=-1;break;case 5:a=90,o=-1;break;case 6:a=90;break;case 7:a=90,r=-1;break;case 8:a=-90;break;default:return _siteBuilderDetail.SetAddImage(_siteBuilderDetail.arrayBufferToDataURL(i,"image/jpeg"),t.name,t.type,t)}var n={};n.rotate=a,n.scaleX=r,n.scaleY=o;var s=_siteBuilderDetail.arrayBufferToDataURL(i,"image/jpeg");return n.url=s,_siteBuilderDetail.createImage(n,t)},_siteBuilderDetail.arrayBufferToDataURL=function(e,t){var i=new Uint8Array(e),a="";if("function"==typeof i.forEach)i.forEach(function(e){a+=_siteBuilderDetail.fromCharCode(e)});else for(var r=i.length,o=0;o<r;o+=1)a+=_siteBuilderDetail.fromCharCode(i[o]);return"data:"+t+";base64,"+btoa(a)},_siteBuilderDetail.createImage=function(e,t){var i=new Image;i.onload=function(){e.naturalWidth=i.naturalWidth,e.naturalHeight=i.naturalHeight;var a=e.naturalWidth,r=e.naturalHeight,o=e.rotate,n=void 0===o?0:o,s=e.scaleX,l=void 0===s?1:s,d=e.scaleY,c=void 0===d?1:d,u=document.createElement("canvas"),p=u.getContext("2d"),h=a,m=r,f=-h/2,g=-m/2,v=h,A=m;u.width=_siteBuilderDetail.normalizeDecimalNumber(h),u.height=_siteBuilderDetail.normalizeDecimalNumber(m);return p.fillStyle="transparent",p.fillRect(0,0,h,m),p.save(),p.translate(h/2,m/2),p.rotate(n*Math.PI/180),p.scale(l,c),p.drawImage(i,Math.floor(_siteBuilderDetail.normalizeDecimalNumber(f)),Math.floor(_siteBuilderDetail.normalizeDecimalNumber(g)),Math.floor(_siteBuilderDetail.normalizeDecimalNumber(v)),Math.floor(_siteBuilderDetail.normalizeDecimalNumber(A))),_siteBuilderDetail.SetAddImage(u.toDataURL(),t.name,t.type,t)},i.alt=t.name,i.src=e.url},_siteBuilderDetail.SetAddImage=function(e,t,i,a){var r,o,n={};n.ImageInputStream=e,n.ImageName=t,n.ActionName="Add",n.temp_delete=!1,n.Image_Type=i,n.file=a,o=_siteBuilderDetail.ReviewPhotoArray.push(n)-1;var s=$.grep(_siteBuilderDetail.ReviewPhotoArray,function(e){return"Add"==e.ActionName||"Edit"==e.ActionName});s.length>0&&(r=s.length);var l=null!=navigator.userAgent.match(/iPad/i);r<3?!l&&_siteBuilderDetail.iosDevices||_siteBuilderDetail.isAndroidMobile||_siteBuilderDetail.isWindowsPhone?$(".add-reviewbtn-bg").show():$("div.reviewProfile").css("display","flex"):!l&&_siteBuilderDetail.iosDevices||_siteBuilderDetail.isAndroidMobile||_siteBuilderDetail.isWindowsPhone?$(".add-reviewbtn-bg").hide():$("div.reviewProfile").hide(),_siteBuilderDetail.setPhotoToViewer(e,t,null,o)},_siteBuilderDetail.getOrientation=function(e){var t=new DataView(e),i=void 0,a=void 0,r=void 0,o=void 0;if(255===t.getUint8(0)&&216===t.getUint8(1))for(var n=t.byteLength,s=2;s<n;){if(255===t.getUint8(s)&&225===t.getUint8(s+1)){r=s;break}s+=1}if(r){var l=r+4,d=r+10;if("Exif"===_siteBuilderDetail.getStringFromCharCode(t,l,4)){var c=t.getUint16(d);if(((a=18761===c)||19789===c)&&42===t.getUint16(d+2,a)){var u=t.getUint32(d+4,a);u>=8&&(o=d+u)}}}if(o){var p=t.getUint16(o,a),h=void 0,m=void 0;for(m=0;m<p;m+=1)if(h=o+12*m+2,274===t.getUint16(h,a)){h+=8,i=t.getUint16(h,a),t.setUint16(h,1,a);break}}return i},_siteBuilderDetail.getStringFromCharCode=function(e,t,i){var a="",r=void 0;for(i+=t,r=t;r<i;r+=1)a+=_siteBuilderDetail.fromCharCode(e.getUint8(r));return a},_siteBuilderDetail.normalizeDecimalNumber=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return REGEXP_DECIMALS.test(e)?Math.round(e*t)/t:e},_siteBuilderDetail.setPhotoToViewer=function(e,t,i,a){for(var r=null,o=document.getElementsByClassName("review-gallery-image"),n=0;n<o.length;n++)if("none"===$(o[n]).css("background-image")){r=n;break}if(null!=r){$(o[r]).css("background-image","url("+e+")"),$(o[r]).attr("img_name",t),$(o[r]).attr("img_upload_name",i),$(o[r]).attr("position",a);var s=$(o[r]).closest(".review-editpic");$(s).show()}},_siteBuilderDetail.imageUserError=function(e){e.src=_siteBuilderDetail.StaticAkamaiCDNPath+"/"+_siteBuilderDetail.StaticAkamaiImageFolder+"/"+_siteBuilderDetail.DefaultUserMaleImg155},_siteBuilderDetail.GetDescriptionSectionComponent=function(e){if(_siteBuilderDetail.ComponentResponse.lstBusinessDetail,null!=_siteBuilderDetail.ComponentResponse.lstBusinessDetail){var t={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail};_siteBuilderDetail.GetDescriptionSectionSuccess(t)}},_siteBuilderDetail.GetSpecialInstruction=function(e){var t=_siteBuilderDetail.htmlDecode(e);$("#dvSpecialInstruction").html(t)},_siteBuilderDetail.GetDescriptionSectionSuccess=function(e){var t=_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagedescriptionsection];if(e.BusinessDetail.YouTubeVideo=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.YouTubeVideo,null!=e.BusinessDetail){$(t).html($("#srpt-description-section").tmpl(e));var i=_siteBuilderDetail.htmlDecode(e.BusinessDetail.Description),a=e.BusinessDetail.CovidHighlightMessage;if($("#pbusinessDescription").html(i),$(".video-full-youtube").html(e.BusinessDetail.YouTubeVideo),0==_siteBuilderDetail.IsCustomWebsite&&""==e.BusinessDetail.Description||null==e.BusinessDetail.Description)return $(t).html($("#srpt-description-section").tmpl(e)),void(""==e.BusinessDetail.CovidHighlightMessage||null==e.BusinessDetail.CovidHighlightMessage?$("#mobile-check").is(":visible")?($(".bus-desc-title").hide(),$("#pbusinessDescription").hide(),$(".bus-coviddesc-title").hide(),$("#pCovidHightLightDescription").hide(),$("#dvcovidmsg").hide()):_siteBuilderDetail.HideComponent(t):($("#pCovidHightLightDescription").html(a),$("#mobile-check").is(":visible")&&($(".bus-desc-title").hide(),$("#pbusinessDescription").hide())));"undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail.IsCustomerAppORMobileViewWithoutWidget()&&0==$("#covidbadgeblock").is(":visible")&&1==$("#covidbadgeblock").data("ismanuallyhide")&&$("#mobilemenuheader").find("#covidbadgeblock").hide(),""==e.BusinessDetail.CovidHighlightMessage||null==e.BusinessDetail.CovidHighlightMessage?($(".bus-coviddesc-title").hide(),$("#pCovidHightLightDescription").hide(),$("#dvcovidmsg").hide()):$("#pCovidHightLightDescription").html(a)}_siteBuilderDetail.IsCustomWebsite&&(null!=BusinessDescription&&""!=BusinessDescription&&$("#pbusinessDescription").html(BusinessDescription),BusinessDescription.includes("<form")&&$("#pbusinessDescription").html("<style>form {{width:100%; height:auto; display:table;}}</style>"+BusinessDescription))},_siteBuilderDetail.GetDailyDealSection=function(e){if(_siteBuilderDetail.ComponentResponse.lstPromotions,null!=_siteBuilderDetail.ComponentResponse.lstPromotions)_siteBuilderDetail.GetDailyDealsSuccess(_siteBuilderDetail.ComponentResponse.lstPromotions,e);else if("undefined"!=typeof isBotCrawler&&0==isBotCrawler&&""!=_siteBuilderDetail.GetCoreAPIURLV3()&&_siteBuilderDetail.staticEncryptBusinessID)_siteBuilderDetail.GetDailyDealsV3(e);else if("undefined"!=typeof isBotCrawler&&0==isBotCrawler){var t={};t.businessID=_siteBuilderDetail.businessID,t.CountryID=countryIdBusDetail;var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumAbout.getpromotions,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){_siteBuilderDetail.GetDailyDealsSuccess(t,e)},i.datamodel.data=t,i.datamodel.Error=CallFail_LoadUserControlWithProxy,i.Post()}},_siteBuilderDetail.GetDailyDealsV3=function(e){var t=(_siteBuilderDetail.SQLGroupID||("undefined"!=typeof groupID?groupID:"")).toLowerCase(),i=_siteBuilderDetail.GetCoreAPIURLV3().replace("{0}",t)+ApiURLEnumAbout.getdealsv3.replace("{0}",encodeURIComponent(_siteBuilderDetail.staticEncryptBusinessID));$.ajax({url:i,type:"GET",dataType:"json",beforeSend:function(e){e.setRequestHeader("grouptoken",t),e.setRequestHeader("X-Service-Type","settings")}}).done(function(t){var i=[];null!=t&&1e3==t.responseCode&&null!=t.data&&(i=_siteBuilderDetail.MapDailyDealsV3(t.data)),_siteBuilderDetail.GetDailyDealsSuccess(i,e)}).fail(CallFail_LoadUserControlWithProxy)},_siteBuilderDetail.MapDailyDealsV3=function(e){for(var t="undefined"!=typeof countryIdBusDetail&&2==countryIdBusDetail?"£":"$",i=function(e){return parseFloat(Number(e).toFixed(2)).toString()},a=[],r=0;r<e.length;r++){var o=e[r],n=null!=o.promotionDiscount?o.promotionDiscount:0,s=null!=o.dealDiscountAmtType?o.dealDiscountAmtType:0,l=null!=o.serviceOldPrice?o.serviceOldPrice:0,d="";n>0&&s>0?1==s?d="UP TO "+t+i(n)+" OFF":2==s?d="UP TO "+i(n)+"% OFF":3==s&&(d=i(n)+t+" OFF"):0==l&&n>0?d=100==parseInt(n)?"Free":i(n)+"% OFF":(l>0&&0==n||n<0)&&(d="Free"),a.push({PromotionID:o.promotionId,PromotionTitle:o.name||"",Image:o.image,PromotionContainerURL:(o.promotionContainerUrl||"").replace(/\/+$/,""),PromotionDiscount:n,DealDiscountAmtType:s,IsAdminPromotion:o.isAdminPromotion,DealId:o.dealId,DiscountHtml:d,ServiceOldPrice:null!=o.serviceOldPrice?o.serviceOldPrice:null})}return a},_siteBuilderDetail.GetDailyDealsSuccess=function(e,t){$(t).html($("#srpt-dailydeals-section").html());var i=_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagedailydealssection];_siteBuilderDetail.ComponentResponse.lstPromotions=e;var a={Promotions:e,BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail};if(0!=a.Promotions.length){_siteBuilderDetail.ShowComponent(i),$("#detailPromotion").html(""),$("#srpt-dailydeals-template-section").tmpl(a.Promotions).appendTo("#detailPromotion"),null!=_shopdetail.isWidget&&"false"==_shopdetail.isWidget&&null!=_shopdetail.isFacebook&&"false"==_shopdetail.isFacebook&&a.Promotions.length<4&&($("#btnDealsinnerPre").hide(),$("#btnDealsinnerNext").hide());for(var r=0;r<a.Promotions.length;r++){var o=a.Promotions[r].PromotionTitle.replace(new RegExp("[^a-zA-Z0-9-]","g"),"");$("#aUrl_"+a.Promotions[r].PromotionID).attr("href",(IsVagaroDomain()?"about"==tabSegment&&"undefined"!=typeof isBotCrawler&&1==isBotCrawler?window.location.origin+"/"+vagaroUrl.toLowerCase():a.BusinessDetail.VagaroURL:"")+"/deals/"+o+"-"+a.Promotions[r].PromotionID+_siteBuilderDetail.IsDeal),$("#aUrl_"+a.Promotions[r].PromotionID).attr("onclick","_shopdetail.activeTabName = 'dealsindividual'; _siteBuilderDetail.DailyDealsDetail("+a.Promotions[r].PromotionID+",'"+(IsVagaroDomain()?a.BusinessDetail.VagaroURL:"")+"/deals/"+o+"-"+a.Promotions[r].PromotionID+_siteBuilderDetail.IsDeal+"' , event)")}$(".lazypromotion").lazyload({effect:"fadeIn",event:"lazyload"}).trigger("lazyload"),$("#detailPromotion").length>0&&1==$("#detailPromotion").is(":visible")&&_common.ApplyEnScroll("#detailPromotion"),!1===_siteBuilderDetail.isCallFromPublicSide()&&_common.DisableComponent(6,$(".daily-deals"))}else void 0!==_siteBuilderDetail.isRequestFromVagaro&&"true"!=_siteBuilderDetail.isRequestFromVagaro?$(i).html("<div class='not-access-modual'><h1> You do not have access to this module.</h1></div>"):_siteBuilderDetail.HideComponent(i)},_siteBuilderDetail.nextPrevious=function(e,t,i,a){var r=$("#"+e).width();$("#"+i).removeClass("slide-disabled"),$("#"+i).removeAttr("disabled"),$("#"+a).removeClass("slide-disabled"),$("#"+a).removeAttr("disabled");var o,n=document.getElementById(e).scrollWidth,s=$("#"+e).scrollLeft();0==t?((o=s-r)<0&&(o=0),o<=0&&$("#"+i).addClass("slide-disabled"),$("#"+e).animate({scrollLeft:o},500)):((o=s+r)>n&&(o=n),o+r>=n&&$("#"+a).addClass("slide-disabled"),$("#"+e).animate({scrollLeft:o},500));return lazyLoadWithContainer("lazypromotion","detailPromotion"),!1},_siteBuilderDetail.dragOnSlider=function(e,t,i,a){e.offsetX<0?_siteBuilderDetail.nextPrevious(t,1,i,a):e.offsetX>0&&_siteBuilderDetail.nextPrevious(t,0,i,a)},_siteBuilderDetail.GetPhotoSectionComponent=function(e){if(_siteBuilderDetail.ComponentResponse.lstStyleAndBusinessImage,null!=_siteBuilderDetail.ComponentResponse.lstStyleAndBusinessImage){var t={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,StyleandBusinessImageResult:_siteBuilderDetail.ComponentResponse.lstStyleAndBusinessImage,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.CommonApiConfigKeys};_siteBuilderDetail.GetPhotoSectionSuccess(t)}},_siteBuilderDetail.GetPhotoSectionSuccess=function(e){var t=_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagephotosection],i=e.StyleandBusinessImageResult.find(e=>e.IsDefault);0==e.StyleandBusinessImageResult.length||null!=i&&null!=i&&1==e.StyleandBusinessImageResult.length?"true"===_siteBuilderDetail.isRequestFromVagaro?(1==e.StyleandBusinessImageResult.length&&$(t).html($("#srpt-photo-section").tmpl(e)),_siteBuilderDetail.HideComponent(t)):($(t).find(".photos-div-block").hide(),$(t).find(".showDefaultGallery").show()):("none"!==$(t).css("display")&&"false"!==_siteBuilderDetail.isRequestFromVagaro||("true"===_siteBuilderDetail.isRequestFromVagaro?_siteBuilderDetail.ShowComponent(t):($(t).find(".photos-div-block").show(),$(t).find(".showDefaultGallery").hide())),$(t).html($("#srpt-photo-section").tmpl(e)),!1===_siteBuilderDetail.isNullUndefined(_siteBuilderDetail.afterInit)&&"function"==typeof _siteBuilderDetail.afterInit&&_siteBuilderDetail.afterInit(),setTimeout(function(){$(".lazystyle").lazyload({threshold:200,effect:"fadeIn"}).trigger("lazyload")},500))},_siteBuilderDetail.GetBusinessStylesComponent=function(e){_siteBuilderDetail.GetBusinessStyles=new PaginationBuilder("",e,{Token:ApiURLEnumAbout.getshopdetailstyle,Data:{},LocalData:{},checkTab:!0,PageSize:20,IsAjaxQue:!1,initialpageData:_siteBuilderDetail.initialStylepageData,EnablePagescroll:!0,ScrollTarget:ScrollTarget,WallWidth:280,templateName:"srpt-style-section",Loader:$("#tmpapgLoading"),pageName:"styles",htmltemplatename:"srpt-style-htmlsection"}).init(),(isWindowsPhone||isiPhone4)&&(_siteBuilderDetail.GetBusinessStyles.options.WallWidth=null),_siteBuilderDetail.GetBusinessStyles.options.Data.businessId=_siteBuilderDetail.businessID,_siteBuilderDetail.GetBusinessStyles.options.Data.userid=UserID,_siteBuilderDetail.GetBusinessStyles.options.Data.calledFrom=_siteBuilderDetail.businessID>0?2:1,_siteBuilderDetail.GetBusinessStyles.options.Data.isCustomWebsite="undefined"!=typeof isCustomWebsite?isCustomWebsite:"",_siteBuilderDetail.GetBusinessStyles.options.Data.radious=105,_siteBuilderDetail.GetBusinessStyles.options.Data.latitude=_siteBuilderDetail.businessID>0?null:_siteBuilderDetail.lattitude,_siteBuilderDetail.GetBusinessStyles.options.Data.longitude=_siteBuilderDetail.businessID>0?null:_siteBuilderDetail.longitude,_siteBuilderDetail.GetBusinessStyles.options.Data.countryID=null==_siteBuilderDetail.countryid?null:_siteBuilderDetail.countryid,_siteBuilderDetail.GetBusinessStyles.options.Data.promotionCodeID=_siteBuilderDetail.businessID>0?null:_siteBuilderDetail.lBusinessPromoCodeID,_siteBuilderDetail.GetBusinessStyles.options.Data.BusinessImageID=String.isNullOrUndefineOrBlank($("#hdnComponentId").val())?0:$("#hdnComponentId").val(),"undefined"!=typeof styleCategoryIds?_siteBuilderDetail.GetBusinessStyles.options.Data.styleCategoryIds=styleCategoryIds:_siteBuilderDetail.GetBusinessStyles.options.Data.styleCategoryIds="",_siteBuilderDetail.GetBusinessStyles.options.onRowLoad=_siteBuilderDetail.GetBusinessStylesSuccess,_siteBuilderDetail.GetBusinessStyles.scroll()},_siteBuilderDetail.GetBusinessStylesSuccess=function(e,t){if(DisplayFullView(!1),null!=t&&0!=t.length){if(null!=t){var i=1;$.grep(t,function(e){var t={};t.styleid=e.StyleID,t.serviceid=e.ServiceID,t.spid=e.ServiceProviderID,t.styletitle=e.StyleTitle,t.businessemail=e.BusinessEmail,t.vagarourl=e.VagaroURL,t.styledesc=e.StyleDesc,t.servicetitle=e.ServiceTitle,e.BookingobjectJson=JSON.stringify(t),null!=$("#dvBusinessImage img").attr("alt")&&(e.BusinessNamestyleALT=$("#dvBusinessImage img").attr("alt").replace("Logo","Style "+i++))})}1==e.config.pageIndex&&$("#"+e.config.templateName).tmpl(t).appendTo("#ulFeatureBusiness"),$(".walllazy").lazyload({threshold:200,event:"lazyload",effect:"fadeIn",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),_siteBuilderDetail.GetBusinessStyles.enableScroll(),String.isNullOrUndefineOrBlank($("#hdnComponentId").val())?String.isNullOrUndefineOrBlank($("#hdnComponentName").val())||"photos"!=$("#hdnComponentName").val()||_shopdetail.setSelected(null,"styles"):($("#ulFeatureBusiness img").filter('[data-businessimageid="'+$("#hdnComponentId").val()+'"]').length>0?$("#ulFeatureBusiness img").filter('[data-businessimageid="'+$("#hdnComponentId").val()+'"]').trigger("click"):$("#ulFeatureBusiness .gallery-solo-image").filter('[data-styleid="'+$("#hdnComponentId").val()+'"]').length>0&&($("#ulFeatureBusiness .gallery-solo-image").filter('[data-styleid="'+$("#hdnComponentId").val()+'"]').addClass("hover"),$("#ulFeatureBusiness .gallery-solo-image").filter('[data-styleid="'+$("#hdnComponentId").val()+'"]').find("img").trigger("click")),$("#hdnComponentId").val(""),_shopdetail.setSelected(null,"styles"))}else $("#divNoGallery").show()};var saveWindowScrollPos,saveBodyScrollPos=0;function dummyrelease(){}_siteBuilderDetail.galleryhover=function(e,t,i,a){if(saveWindowScrollPos=$(window).scrollTop(),_siteBuilderDetail.iPadAndroid||_siteBuilderDetail.isWindowsPhone){var r=$(t).closest(".cust-img-popup-slider");void 0!==i&&"false"==i.toString()&&_siteBuilderDetail.openGalleryPopup(t),$(r).hasClass("hover")?($(r).removeClass("hover"),_siteBuilderDetail.openGalleryPopup(t)):(e.stopPropagation(),e.preventDefault(),$(".gallery-solo-image").removeClass("hover"),$(r).addClass("hover"))}else null==$(this).attr("alt")&&1==_siteBuilderDetail.ClickbusinessLogo?_siteBuilderDetail.imagelogocount=0:_siteBuilderDetail.imagelogocount=1,_siteBuilderDetail.openGalleryPopup(t);void 0!==a&&""!=a&&""!=a||(a="#divstyles"),styleCounter=$(".imgstyles",a).index($(t,a)),styleCounter==$(".imgstyles",a).length-1?_siteBuilderDetail.NextPreAddRemoveInactive():0==styleCounter?_siteBuilderDetail.PrevNextAddRemoveInactive():_siteBuilderDetail.PrevNextBtnRemoveInactive(),1==$(".imgstyles",a).length&&_siteBuilderDetail.PrevNextBtnAddInactive(),$("#btnStyleNext").attr("data-parentdivid",a),$("#btnStylePrev").attr("data-parentdivid",a)},_siteBuilderDetail.openGalleryPopup=function(e,t){var i=_siteBuilderDetail.getscrollTop(ScrollTarget);saveBodyScrollPos=i,0==_siteBuilderDetail.ScrollPos&&(_siteBuilderDetail.ScrollPos=_siteBuilderDetail.getscrollTop(ScrollTarget)),_siteBuilderDetail.mainDiv=$(e).parents(".cust-img-popup-slider");var a=_siteBuilderDetail.mainDiv.data(),r=$("#divStyleImages"),o=r.clone(),n="50px";if(null!=t&&"P"==t&&(n="-50px"),o.css({transform:"translateX("+n+")",transition:"opacity 300ms,transform 300ms",opacity:"0","z-index":"1003"}),r.before(o),r.fadeOut(),r.attr("id","divStyleImages_Old"),r.remove(),setTimeout(function(){o.css({transform:"translateX(0px)",transition:"opacity 300ms,transform 300ms",opacity:"1","z-index":"1003"}),$("html, body").addClass("overflowHidden")},200),a.styleid>0){$("#imgLikePopUp").show(),$("#btnBookPopUp").show(),$("#divSharePopUp").show(),$(".share-div-overall").show(),$("#galleryPopup").removeClass("gallery-single-imagepopup"),_siteBuilderDetail.StyleCdnUrl=a.cdnurl,_siteBuilderDetail.fetchStyleImages(a.styleid);var s=$("#divSalonName_"+a.styleid,_siteBuilderDetail.mainDiv).html(),l=$("#divAddress_"+a.styleid,_siteBuilderDetail.mainDiv).html(),d="true"==a.isonlineservice.toString().toLowerCase()&&"true"==a.isshowpriceonline.toString().toLowerCase()?parseFloat(a.price).format("#.##").toString():"";"true"!=a.isonlineservice.toString().toLowerCase()&&$("#btnBookPopUp").hide(),null!=d&&null!=d&&d.length>0?($("#divPricePopUp").html(currencySymbol+d),$("#divPricePopUp").show()):($("#divPricePopUp").html("&nbsp;"),$("#divPricePopUp").hide()),$(_siteBuilderDetail.mainDiv).find(".btnlike").hasClass(_siteBuilderDetail.emptyHeartClass)?$("#imgLikePopUp").addClass(_siteBuilderDetail.emptyHeartClass):$("#imgLikePopUp").removeClass(_siteBuilderDetail.emptyHeartClass),$("#divSocialIconsPopUp").hide(),$("#divSharePopUp").unbind(),$("#divSharePopUp").click(function(){var t=escape(location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+a.vagarourl.toLowerCase():"")+"/styles");$("#divSocialIconsPopUp").find(".facebook").unbind(),$("#divSocialIconsPopUp").find(".twitter").unbind(),$("#divSocialIconsPopUp").find(".pinterest").unbind(),$("#divSocialIconsPopUp").find(".email-share-div").unbind(),$("#divSocialIconsPopUp").find(".facebook").click(function(){_siteBuilderSocialMedia.PostonFacebook(e,"Photos")});var i=t+"&text=Check out what I found @"+unescape(escape(a.businessname))+" - "+a.stylistname+"&related=vagaro";$("#divSocialIconsPopUp").find(".twitter").click(function(){_siteBuilderSocialMedia.PostOnTwitter(i)});var r=t+"&text="+unescape(a.businessname)+" - "+a.styletitle+"&media="+a.image+"&description="+a.servicetitle+a.styledesc;$("#divSocialIconsPopUp").find(".pinterest").click(function(){_siteBuilderSocialMedia.PostOnPint(r)}),$("#divSocialIconsPopUp").find(".email-share-div").click(function(){_siteBuilderSocialMedia.MailClick(a.styletitle,_siteBuilderDetail.mainDiv,"Photos")}),$("#divSocialIconsPopUp").toggle()}),$("#imgLikePopUp").unbind(),$("#imgLikePopUp").click(function(){$("#divSocialIconsPopUp").hide(),UserID>0?_common.clickToLikeStyle(e):(_common.reloadstyle=!1,_common.isFromLikeStyle=!0,_common.likestyle=e,showLogin("LikeStyles"))}),$("#divServiceTitlePopup").text(a.styletitle),$("#divSalonNamePopUp").html(s),$("#divAddressPopUp").html(l),$("#divStyleDescPopUp").text(a.styledesc),$("#divStylistName").html(""!=a.stylistname?"by "+a.stylistname:"");var c=_siteBuilderDetail.GetBookDataFromObjectData(_siteBuilderDetail.mainDiv.data());$("#btnBookPopUp").attr("onclick","javascript:_common.RedirectToBook24("+JSON.stringify(c)+",event);"),$("#galleryPopup").show(),$("html, body").addClass("overflowHidden"),_siteBuilderDetail.centerGalleryPopup(),$("#divListing").mouseup(function(e){var t=$(".gallery-popup-white-overall");t.is(e.target)||0!==t.has(e.target).length||_siteBuilderDetail.closeGalleryPopup(i)}),$("#galleryPopup").mouseup(function(e){var t=$(".gallery-popup-white-overall");t.is(e.target)||0!==t.has(e.target).length||(_siteBuilderDetail.closeGalleryPopup(i),$("html, body").removeClass("overflowHidden"))}),$("#divGalleryPopup").scroll(function(){if($("#divStyleImages").find(".gallery-popup-img").length>1){var e=0;$(".gallery-popup-img",$("#divStyleImages")).each(function(){if($("#styleImage_"+e).attr("src").indexOf("no-shop-image-big-new.gif")>-1){var t=$("#styleImage_"+e).attr("data-original");$("body").append('<img src="'+t+'" id="imgDummy" />'),$("#imgDummy").width()>0&&$("#styleImage_"+e).lazyload({effect:"fadeIn"}),$("#imgDummy").remove()}e++})}})}else{$("#galleryPopup").show(),$("html, body").addClass("overflowHidden"),$("#imgLikePopUp").hide(),$("#btnBookPopUp").hide(),$("#divSharePopUp").hide(),$(".share-div-overall").hide(),$("#galleryPopup").addClass("gallery-single-imagepopup"),$("#divGalleryPopup").removeClass("singleimagepopup doulbleimagepopup");var u=$("#divStyleImages");u.html("");var p=$("#divStyleImageTemplate").html();u.append(p),$(e).attr("src").indexOf(";base64,")>-1?$("#styleImage",u).attr("src",$(e).attr("data-original")):$("#styleImage",u).attr("src",$(e).attr("src")),$("#ComBusinessLogo").length>0&&null!=$("#ComBusinessLogo")[0].getAttribute("alt")&&(0==_siteBuilderDetail.imagelogocount?($("#styleImage",u).attr("alt",$("#ComBusinessLogo")[0].getAttribute("alt")),$("#styleImage",u).attr("title",$("#ComBusinessLogo")[0].getAttribute("alt")),_siteBuilderDetail.imagelogocount=1,_siteBuilderDetail.ClickbusinessLogo=0):($("#styleImage",u).attr("alt","Gallery Logo"),$("#styleImage",u).attr("title","Gallery Image"))),$("#divServiceTitlePopup").html(""),$("#divStylistName").html(""),$("#divSalonNamePopUp").html(""),$("#divAddressPopUp").html(""),$("#divStyleDescPopUp").html(""),$("#galleryPopup").mouseup(function(e){var t=$(".gallery-popup-white-overall");t.is(e.target)||0!==t.has(e.target).length||(_siteBuilderDetail.closeGalleryPopup(saveWindowScrollPos),$("html, body").removeClass("overflowHidden"))})}"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#galleryPopup #divSharePopUp").hide(),_siteBuilderDetail.GalleryPopupSwipe()},_siteBuilderDetail.GetBookDataFromObjectData=function(e){var t={};return void 0!==e.serviceid&&"0"!=e.serviceid&&(t.serviceid=e.serviceid),void 0!==e.spid&&"0"!=e.spid&&(t.spid=e.spid),void 0!==e.styleid&&"0"!=e.styleid&&(t.styleid=e.styleid),void 0!==e.styletitle&&null!=e.styletitle&&""!=e.styletitle&&(t.styletitle=e.styletitle),void 0!==e.bookingDateTime&&null!=e.bookingDateTime&&""!=e.bookingDateTime&&(t.bookingDateTime=e.bookingDateTime),void 0!==e.vagarourl&&null!=e.vagarourl&&""!=e.vagarourl&&(t.vagarourl=e.vagarourl.toLowerCase()),t},_siteBuilderDetail.centerGalleryPopup=function(){var e=$("#galleryPopup:visible").height();$(".gallery-popup-white-overall").css("max-height",e)},isProssed=!1,_siteBuilderDetail.closeGalleryPopup=function(e){$("#galleryPopup").hide(),$("html, body").removeClass("overflowHidden"),$("#divListing").unbind(),$("html, body").scrollTop(saveWindowScrollPos),(_siteBuilderDetail.iosDevices||_siteBuilderDetail.iPadAndroid||_siteBuilderDetail.isAndroidMobile||_siteBuilderDetail.isWindowsPhone)&&$("#divBookNowMasterPage").addClass("mobile-book-div"),_siteBuilderDetail.ScrollPos=0},_siteBuilderDetail.NextStyle=function(e){e.stopPropagation(),e.preventDefault();var t=$("#btnStyleNext").attr("data-parentdivid"),i=$(".imgstyles",t)[styleCounter+1];null!=i?(_siteBuilderDetail.openGalleryPopup(i,"N"),styleCounter+=1,_siteBuilderDetail.imagelogocount=1,styleCounter==$(".imgstyles",t).length-1?_siteBuilderDetail.NextPreAddRemoveInactive():_siteBuilderDetail.PrevNextBtnRemoveInactive()):_siteBuilderDetail.NextPreAddRemoveInactive(),1==$(".imgstyles",t).length&&_siteBuilderDetail.PrevNextBtnAddInactive()},_siteBuilderDetail.PrevStyle=function(e){e.stopPropagation(),e.preventDefault();var t=$("#btnStylePrev").attr("data-parentdivid"),i=$(".imgstyles",t)[parseInt(styleCounter)-1];null!=i?(styleCounter-=1,0==styleCounter&&(_siteBuilderDetail.imagelogocount=0),_siteBuilderDetail.openGalleryPopup(i,"P"),_siteBuilderDetail.imagelogocount=1,0==styleCounter?_siteBuilderDetail.PrevNextAddRemoveInactive():_siteBuilderDetail.PrevNextBtnRemoveInactive()):_siteBuilderDetail.PrevNextAddRemoveInactive(),1==$(".imgstyles",t).length&&_siteBuilderDetail.PrevNextBtnAddInactive()},$(document).on("keydown",function(e){if("block"==$("#galleryPopup").css("display")&&(37===e.which&&_siteBuilderDetail.PrevStyle(e),39===e.which&&_siteBuilderDetail.NextStyle(e),27===e.which))return _siteBuilderDetail.closeGalleryPopup(_siteBuilderDetail.ScrollPos),!1}),_siteBuilderDetail.LoadMoreGallery=function(e){$(".w-lightbox").off(".w-lightbox"),$("#divbusinessatab").css("cursor",""),_siteBuilderDetail.LoadComponentDetails("styles"),_siteBuilderDetail.RemoveActiveAboutTab()},_siteBuilderDetail.fetchStyleImages=function(e){$("#divGalleryImageLoader").show(),_siteBuilderDetail.divStyleImages=$("#divStyleImages"),_siteBuilderDetail.divStyleImages.html(""),Data={},Data.StyleID=e,vagaro.ajaxCall(ApiURLEnumAbout.getstyleimagecommaseparated,Data,_siteBuilderDetail.GetStyleImageCommaSeparated_Success,_siteBuilderDetail.GetStyleImageCommaSeparated_CallFailed,!1,!0)},_siteBuilderDetail.GetStyleImageCommaSeparated_Success=function(e){if($("#divGalleryImageLoader").hide(),null!=e&&null!=e){var t=e.split("|##|");if(void 0!==_siteBuilderDetail.mainDiv&&void 0!==_siteBuilderDetail.mainDiv.data&&void 0!==_siteBuilderDetail.mainDiv.data().price&&null!=_siteBuilderDetail.mainDiv.data().price&&""!=_siteBuilderDetail.mainDiv.data().price&&""!=_siteBuilderDetail.mainDiv.data().price&&(_siteBuilderDetail.mainDiv.data().price=parseFloat(_siteBuilderDetail.mainDiv.data().price)),""==_siteBuilderDetail.mainDiv.data().stylistname||null==_siteBuilderDetail.mainDiv.data().stylistname||null==_siteBuilderDetail.mainDiv.data().stylistname){_siteBuilderDetail.mainDiv.data().stylistname=t[1],$("#divStylistName").html(""!=_siteBuilderDetail.mainDiv.data().stylistname?"by "+_siteBuilderDetail.mainDiv.data().stylistname:"");var a=_siteBuilderDetail.GetBookDataFromObjectData(_siteBuilderDetail.mainDiv.data());$("#btnBookPopUp").attr("onclick","javascript:_common.RedirectToBook24("+JSON.stringify(a)+",event);")}var r=t[0].split("|~|");if(_siteBuilderDetail.divStyleImages=$("#divStyleImages"),_siteBuilderDetail.divStyleImages.html(""),null!=r&&null!=r&&r.length>0)for($("#divGalleryPopup").removeClass("singleimagepopup doulbleimagepopup"),1==r.length?$("#divGalleryPopup").addClass("singleimagepopup"):2==r.length&&$("#divGalleryPopup").addClass("doulbleimagepopup"),i=0;i<r.length;i++){var o=r[i].split("|~~|");if(o.length>0){var n=$("#divStyleImageTemplate").html();_siteBuilderDetail.divStyleImages.append(n),o[0]=o[0].escapeHtml(),$("#styleTitle",_siteBuilderDetail.divStyleImages).html(o[0]).attr("id","styleTitle_"+i),o.length>1&&$("#styleImage",_siteBuilderDetail.divStyleImages).attr("data-original",_siteBuilderDetail.StyleCdnUrl+"/Style/Original/"+o[1]).attr("id","styleImage_"+i)}}lazyLoadWithContainer("lazystyle","divGalleryPopup")}},_siteBuilderDetail.GetStyleImageCommaSeparated_CallFailed=function(e){$("#divGalleryImageLoader").hide()},_siteBuilderDetail.GetBusinessMapComponent=function(e){if(null!=_siteBuilderDetail.ComponentResponse.lstBusinessDetail&&"undefined"!=typeof UserID&&0==UserID)_siteBuilderDetail.GetBusinessMapSuccess(null);else if(null!=_siteBuilderDetail.ComponentResponse.lstBusinessDetail&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo&&"undefined"!=typeof UserID&&UserID>0)_siteBuilderDetail.GetBusinessMapSuccess(_siteBuilderDetail.ComponentResponse.lstUserInfo);else if("undefined"!=typeof UserID&&UserID>0&&0==isBotCrawler){var t={};t.loginUserID=UserID;var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumAbout.getuserinfo,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=_siteBuilderDetail.GetBusinessMapSuccess,i.datamodel.data=t,i.datamodel.Error=CallFail_LoadUserControlWithProxy,i.Post()}},_siteBuilderDetail.isAppendGoogleMapKey=function(){return AppendGoogleMapKey?"&key="+secGoogleKeyFormap:""},_siteBuilderDetail.GetBusinessMapSuccess=function(e){ISAndroidOrIOSDevicesAndBrowser()||_siteBuilderDetail.showLogoAndBusinessName(),null!=e&&0!=e.UserID||(e=null),_siteBuilderDetail.ComponentResponse.lstUserInfo=e;var t={User:e,BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey},i="",a="",r="";_siteBuilderDetail.GetCitiesPopUpDetail={BusinessID:t.BusinessDetail.BusinessID,IsMobileServiceMandatory:t.BusinessDetail.IsMobileServiceMandatory,IsOutcallMandatory:t.BusinessDetail.IsOutcallMandatory,selectedCount:0,selectedText:"",businessName:t.BusinessDetail.BusinessName,HasOutCallService:t.BusinessDetail.HasOutCallService},1!=_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory&&2!=_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory||1!=_siteBuilderDetail.GetCitiesPopUpDetail.IsOutcallMandatory||_siteBuilderDetail.GetCityDetail();var o=t.BusinessDetail.CountryID,n="";if(n=2==o?"United Kingdom":3==o?"Canada":4==o?"Australia":"United States",1==_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0?_siteBuilderDetail.GetCitiesPopUpDetail.selectedText="We are a Mobile Business Servicing "+_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount+" Cities":1==_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory&&0==_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount?_siteBuilderDetail.GetCitiesPopUpDetail.selectedText="Canada"==n||"Australia"==n?"We are a Mobile Business Servicing Everywhere in "+n:"We are a Mobile Business Servicing Everywhere in the "+n:2==_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0?_siteBuilderDetail.GetCitiesPopUpDetail.selectedText="We are a Mobile Business Servicing "+_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount+" Cities":2==_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory&&0==_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount&&(_siteBuilderDetail.GetCitiesPopUpDetail.selectedText="Canada"==n||"Australia"==n?"We are a Mobile Business Servicing Everywhere in "+n:"We are a Mobile Business Servicing Everywhere in the "+n),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pagemapsection]).html($("#srpt-map-section").tmpl(t)),null!=_shopdetail.isWidget&&"false"==_shopdetail.isWidget&&null!=_shopdetail.isFacebook&&"false"==_shopdetail.isFacebook){if(i=null==t.User||null==t.User.Street||""==t.User.Street||null==t.User.City||""==t.User.City||null==t.User.StateName||""==t.User.StateName||null==t.User.Zip||""==t.User.Zip?"":encodeURI(t.User.Street.replace("#"," No ").replace("'","\\'").replace("\n","").replace("\r","")+","+t.User.City+","+t.User.StateName+","+t.User.Zip),""!=t.CommonApiConfigKeys.GoogleMapBusinessID&&null!=t.CommonApiConfigKeys.GoogleMapBusinessID&&t.CommonApiConfigKeys.GoogleMapBusinessID.includes(","+t.BusinessDetail.BusinessID.toString()+",")&&null!=t.BusinessDetail.LATITUDE&&0!=t.BusinessDetail.LATITUDE&&null!=t.BusinessDetail.LONGITUDE&&0!=t.BusinessDetail.LONGITUDE)if(a=t.BusinessDetail.LATITUDE.toString()+","+t.BusinessDetail.LONGITUDE.toString(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType)1==_siteBuilderDetail.isFromAppClip?($("#btnDirections").removeAttr("href").removeAttr("onclick"),$("#map_businessMap1").removeAttr("href").removeAttr("onclick")):($("#btnDirections").attr("onclick","javascript:CallbackforMobileApp(0, 0, '', '', '0', '8|~|{\\\"latitude\\\": \\\""+t.BusinessDetail.LATITUDE.toString()+'\\", \\"longitude\\": \\"'+t.BusinessDetail.LONGITUDE.toString()+"\\\"}');"),$("#map_businessMap1").attr("onclick","javascript:CallbackforMobileApp(0, 0, '', '', '0', '8|~|{\\\"latitude\\\": \\\""+t.BusinessDetail.LATITUDE.toString()+'\\", \\"longitude\\": \\"'+t.BusinessDetail.LONGITUDE.toString()+"\\\"}');"));else{var s="https://maps.google.com/maps?daddr="+a+"&saddr="+i+"&hl=en"+_siteBuilderDetail.isAppendGoogleMapKey();$("#map_businessMap1").attr("href",s)}else{a=encodeURI(t.BusinessDetail.Street.replace("#"," No ").replace("'","\\'").replace("\n","").replace("\r","")+","+t.BusinessDetail.City+","+t.BusinessDetail.StateName+","+t.BusinessDetail.Zip);r=t.BusinessDetail.LATITUDE+","+t.BusinessDetail.LONGITUDE;if("undefined"!=typeof vgAppicationType&&1==vgAppicationType)1==_siteBuilderDetail.isFromAppClip?($("#btnDirections").removeAttr("href").removeAttr("onclick"),$("#map_businessMap1").removeAttr("href").removeAttr("onclick")):($("#btnDirections").removeAttr("target"),$("#btnDirections").attr("target","_self"),$("#map_businessMap1").removeAttr("target"),$("#map_businessMap1").attr("target","_self"),$("#btnDirections").attr("onclick","javascript:CallbackforMobileApp(0, 0, '', '', '0', '8|~|{\\\"latitude\\\": \\\""+t.BusinessDetail.LATITUDE.toString()+'\\", \\"longitude\\": \\"'+t.BusinessDetail.LONGITUDE.toString()+"\\\"}');"),$("#map_businessMap1").attr("onclick","javascript:CallbackforMobileApp(0, 0, '', '', '0', '8|~|{\\\"latitude\\\": \\\""+t.BusinessDetail.LATITUDE.toString()+'\\", \\"longitude\\": \\"'+t.BusinessDetail.LONGITUDE.toString()+"\\\"}');"));else{s="";s=t.CommonApiConfigKeys.GoogleMapBasedOnAdressBusinessID.includes(","+t.BusinessDetail.BusinessID.toString()+",")||1==t.BusinessDetail.IsShowMarkerFromAddress||_siteBuilderDetail.userAgent.includes("iPhone")||_siteBuilderDetail.userAgent.includes("Android")?"https://maps.google.com/maps?daddr="+a+"&saddr="+i+"&hl=en"+_siteBuilderDetail.isAppendGoogleMapKey():"https://maps.google.com/maps?daddr="+r+"&saddr="+i+"&hl=en"+_siteBuilderDetail.isAppendGoogleMapKey(),1==t.BusinessDetail.IsMobileServiceMandatory&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0?($("#map_businessMap1").attr("onclick","_siteBuilderDetail.ShowCityModal()"),$("#map_businessMap1").removeAttr("href",s),$("#map_businessMap1").css("cursor","pointer")):1==t.BusinessDetail.IsMobileServiceMandatory&&0==_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount||2==t.BusinessDetail.IsMobileServiceMandatory&&0==_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount?$("#map_businessMap1").removeAttr("href",s):$("#map_businessMap1").attr("onclick","_siteBuilderDetail.RedirectToMap('"+s+"')"),1==t.BusinessDetail.IsMobileServiceMandatory&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0?($("#btnDirections").removeAttr("href",s),$("#btnDirections").css("cursor","pointer"),$("#btnDirections1").remove()):2==t.BusinessDetail.IsMobileServiceMandatory&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0?($("#btnDirections").removeAttr("onclick"),$("#btnDirections").attr("onclick","_siteBuilderDetail.RedirectToMap('"+s+"')")):1==t.BusinessDetail.IsMobileServiceMandatory&&0==_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount?($("#btnDirections").removeAttr("href",s).removeAttr("onclick"),$("#btnDirections1").remove()):2==t.BusinessDetail.IsMobileServiceMandatory&&0==_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount?($("#btnDirections").attr("onclick","_siteBuilderDetail.RedirectToMap('"+s+"')"),$("#map_businessMap1").attr("onclick","_siteBuilderDetail.RedirectToMap('"+s+"')")):$("#btnDirections").attr("onclick","_siteBuilderDetail.RedirectToMap('"+s+"')"),1==_siteBuilderDetail.GetCitiesPopUpDetail.HasOutCallService&&2==t.BusinessDetail.IsMobileServiceMandatory?$("#btnDirections1").show():$("#btnDirections1").hide()}}var l="";null!=t.BusinessDetail.BusinessLocationImage&&""!=t.BusinessDetail.BusinessLocationImage&&(l=t.BusinessDetail.CDNUrl+_siteBuilderDetail.BusinessLocationImage+t.BusinessDetail.BusinessLocationImage),$("#map_businessMap1").attr("data-original",l),1==t.BusinessDetail.IsMobileServiceMandatory&&"We are a Mobile Business Servicing Everywhere"!=_siteBuilderDetail.GetCitiesPopUpDetail.selectedText||$(".map-div").addClass("map-marker-circle"),_siteBuilderDetail.lazyloadImages()}},_siteBuilderDetail.RedirectToMap=function(e){$url=$("<a/>"),$url.attr("href",e),$url.attr("target","_blank"),$url[0].click()},_siteBuilderDetail.GetBusinessHoursComponent=function(e){if(null!=_siteBuilderDetail.ComponentResponse.lstWorkingHours)_siteBuilderDetail.GetBusinessHoursSuccess(_siteBuilderDetail.ComponentResponse.lstWorkingHours);else{var t={};t.businessID=_shopdetail.businessID;var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumAbout.getworkinghours,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=_siteBuilderDetail.GetBusinessHoursSuccess,i.datamodel.data=t,i.datamodel.Error=CallFail_LoadUserControlWithProxy,i.Post()}},_siteBuilderDetail.GetBusinessHoursSuccess=function(e){var t={WorkingHours:e,BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail};_siteBuilderDetail.ComponentResponse.lstWorkingHours=e,_siteBuilderDetail.isVConnectBetaRelease=JSON.parse($("#hdnVConnectBetaRelease").val().toLowerCase()),$(_siteBuilderDetail.componentInfo[_siteBuilderDetail.componentMainInfo.pageworkinghourssection]).html($("#srpt-workinghours-section").tmpl(t)),$("#divWorkingHoursDay").html(""),$("#divWorkingHours").html("");var i="",a="";if(null!=t.WorkingHours?($.each(_siteBuilderDetail.VagaroDayOfWeekEnum,function(e,r){if(void 0!==t.WorkingHours[e]){var o=t.WorkingHours[e],n="web-body-font ";if(null!=t.BusinessDetail.businessDateTime&&"undefined"!=t.BusinessDetail.businessDateTime)moment(t.BusinessDetail.businessDateTime).format("dddd")==e&&moment(t.BusinessDetail.businessDateTime).format("HH:mm:ss")>o.OpenTime&&moment(t.BusinessDetail.businessDateTime).format("HH:mm:ss")<o.CloseTime&&(n="web-subheading-font ");var s=o.CloseTime;23==moment(s,"HH:mm").hours()&&59==moment(s,"HH:mm").minutes()&&(s="00:00:00"),i=i+"<div itemprop='openingHours' content='"+e+" "+moment(o.OpenTime,"HH:mm").format("h:mm A")+" - "+moment(o.CloseTime,"HH:mm").format("h:mm A")+"'class='"+n+"hours ' role='listitem' aria-label='Business hours on "+e+" is from "+moment(o.OpenTime,"HH:mm").format("h:mm A")+" to "+moment(o.CloseTime,"HH:mm").format("h:mm A")+"'>"+e+"</div>",a=0==moment(o.OpenTime,"HH:mm").minutes()&&o.OpenTime==s?a+"<div class='"+n+"hours'>Open 24 hrs</div>":a+"<div class='"+n+"hours '>"+moment(o.OpenTime,"HH:mm").format("h:mm A")+" - "+moment(o.CloseTime,"HH:mm").format("h:mm A")+"</div>"}else i=i+"<div class='hours web-body-font'>"+e+"</div>",a+="<div class='hours web-body-font'>Closed</div>"}),$("#divWorkingHoursDay").html(i),$("#divWorkingHours").html(a),$(".working-hours-title").show()):$(".working-hours-title").hide(),0==t.BusinessDetail.ShowVagaroConnectMessagingInfo&&$("#btnMassage").css("display","none"),0==t.BusinessDetail.ShowContactInfo)$("#btnCall").css("display","none");else if($("#dvworkinghoursMessageCall").show(),""!=t.BusinessDetail.Telephone&&null!=t.BusinessDetail.Telephone){var r=_siteBuilderDetail.SetMobileCallLink(t.BusinessDetail.Telephone);"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#btnCall").attr("onclick",r.strCallBack),$("#btnCall").attr("href",r.strHref)}else $("#btnCall").css("display","none")},_siteBuilderDetail.GetBusinessInfoComponent=function(e){if(String.isNullOrUndefineOrBlank(_siteBuilderDetail)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo.objUserInfo)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo.objUserInfo.CountryID)||1!=parseInt(_siteBuilderDetail.UserLocationInfo.objUserInfo.CountryID)||String.isNullOrUndefineOrBlank(_siteBuilderDetail.UserLocationInfo.IsVPLBusiness)||1!=_siteBuilderDetail.UserLocationInfo.IsVPLBusiness?$("#accvpaylater").css("display","none"):$("#accvpaylater").css("display","block"),null!=_siteBuilderDetail.ComponentResponse.lstFacility&&null!=_siteBuilderDetail.ComponentResponse.lstBusinessDetail){var t={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Facility:_siteBuilderDetail.ComponentResponse.lstFacility};_siteBuilderDetail.GetBusinessInfoSuccess(t,e)}},_siteBuilderDetail.GetBusinessInfoSuccess=function(e,t){if($(t).html($("#dvBuinfohtmlTemplate").html()),$("#srpt-businessinfo-section").tmpl(e.BusinessDetail).appendTo("#dvBuinfoContainer"),null!=e&&null!=e.Facility&&null!=_shopdetail.isFacebook&&"false"==_shopdetail.isFacebook&&null!=_shopdetail.isWidget&&"false"==_shopdetail.isWidget&&null!=e.Facility){var i=jQuery.extend(!0,{},e.Facility),a="";if(e.BusinessDetail.Telephone=""==e.BusinessDetail.Telephone||null==e.BusinessDetail.Telephone?"":_siteBuilderDetail.PhoneNumberCountryFormat(e.BusinessDetail.Telephone,e.BusinessDetail.CountryID),""!=e.BusinessDetail.URL&&null!=e.BusinessDetail.URL)if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){var r="CallbackforMobileApp(0, 0, '', '', '0', '10|~|{\\\"url\\\":\\\""+_siteBuilderDetail.ValidateHyperlink(e.BusinessDetail.URL)+"\\\"}');";a=a+'<div class="business-details-div"><div><h2 class="bus-details title thm-contentTitle new-vgcustm-title" aria-live=\'polite\'>Website</h2><a class="business-type-description link" rel="nofollow" href="javascript:void(0);" onclick="javascript:'+htmlEnc(r)+'">'+e.BusinessDetail.URL+"</a></div></div>"}else a=a+'<div class="business-details-div"><div><h2 class="bus-details title thm-contentTitle Business Type" aria-live=\'polite\'>Website</h2><a class="business-type-description link" rel="nofollow" target=\'_blank\' href="'+_siteBuilderDetail.ValidateHyperlink(e.BusinessDetail.URL)+'">'+e.BusinessDetail.URL+"</a></div></div>";""!=e.BusinessDetail.Telephone&&null!=e.BusinessDetail.Telephone&&e.BusinessDetail.ShowContactInfo&&(resultData=_siteBuilderDetail.SetMobileCallLink(e.BusinessDetail.Telephone),a=a+'<div class="business-details-div"><h2 class="business-details-title thm-contentTitle new-vgcustm-title web-display-small">Phone</h2><div itemprop=\'telephone\' class="business-type-description web-body-font"><a href="'+resultData.strHref+'" onclick="'+resultData.strCallBack+'" class="business-type-description link mobile-only web-body-font">'+e.BusinessDetail.Telephone+"</a></div></div>");var o=!1,n=!1;""!=i["Other Languages"]&&null!=i["Other Languages"]&&null!=i["Other Languages"]&&(n=!0),(""!=i["Spoken languages"]&&null!=i["Spoken languages"]&&null!=i["Spoken languages"]||""!=i["Spoken Languages"]&&null!=i["Spoken Languages"]&&null!=i["Spoken Languages"])&&(o=!0),$.each(i,function(e,t){var r=t;if(""==e.trim()||null==e||"cancellation policy"==e.toLowerCase()||"other languages"==e.toLowerCase()&&0!=o||("spoken languages"==e.toLowerCase()&&1==n?(r.FacilityValues+=", "+i["Other Languages"].FacilityValues,r.FacilityValues=r.FacilityValues.replace(/(^[,\s]+)|([,\s]+$)/g,"")):"other languages"==e.toLowerCase()&&(e="Spoken languages"),""!=r.FacilityValues&&null!=r.FacilityValues&&(a+='<div class="business-details-div"><h2 class="business-details-title thm-contentTitle new-vgcustm-title web-display-small">'+e+'</h2><div class="business-type-description web-body-font">'+r.FacilityValues+"</div></div>")),""!=e.trim()&&null!=e&&"cancellation policy"==e.toLowerCase()&&""!=r.FacilityValues.trim()){var s=r.FacilityValues.split("|~|");$(".dvcancelpolicy").show(),$("#dvcancellationpolicy").html(""),void 0!==s&&null!=s&&s.length>0&&$("#dvcancellationpolicy").html("<div>"+s[0]+"</div>"),void 0!==s&&null!=s&&s.length>1&&null!=s[1]&&""!=s[1].toString().trim()?($("#dvClasscancellationpolicy").show(),$("#hdClasscancellationpolicy").show(),$("#dvClasscancellationpolicy").html("<div>"+s[1]+"</div>")):($("#dvClasscancellationpolicy").hide(),$("#hdClasscancellationpolicy").hide()),void 0!==s&&null!=s&&s.length>0&&null!=s[0]&&""!=s[0].toString().trim()?($("#dvcancellationpolicy").show(),$("#hdcancellationpolicy").show()):($("#dvcancellationpolicy").hide(),$("#hdcancellationpolicy").hide())}}),$("#divFeaturesFacilities").html(a)}null!=e&&null!=e.BusinessDetail&&null!=e.BusinessDetail.SpecialInstruction&&""!=e.BusinessDetail.SpecialInstruction&&_siteBuilderDetail.GetSpecialInstruction(e.BusinessDetail.SpecialInstruction)},_siteBuilderDetail.SetMobileCallLink=function(e){var t={},i="javascript:void(0);",a="tel:"+e.replace("-","").replace("(","").replace(")","").replace(" ","");return"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(a="javascript:void(0);",i="javascript:CallbackforMobileApp(0, 0, '', '', '0', '15|~|{\\\"tel\\\":\\\""+e.replace("-","").replace("(","").replace(")","").replace(" ","")+"\\\"}');"),t.strHref=a,t.strCallBack=i,t},_siteBuilderDetail.ValidateHyperlink=function(e){return new RegExp("^(http|https)://","i").test(e)?e:"http://"+e},_siteBuilderDetail.formatPhoneNumber=function(e){if(""!=e&&null!=e){var t=(""+e).replace(/\D/g,""),i=t.match(/^(\d{3})(\d{3})(\d{4})$/);return i?"("+i[1]+") "+i[2]+"-"+i[3]:t}},_siteBuilderDetail.onReviewError=function(e,t){$("#divReviewPhotos"+e).find("div#"+t).hide(),$("#divReviewPhotos"+e).find("div#"+t).parent().hide()},_siteBuilderDetail.GetBusinessReviewComponent=function(e){var t=!1,i=$("#spReviews");if(_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())&&(t=!0,_common.VisibleControlLength("#mobile-check")>0&&(i=$(".modal-body"))),"undefined"!=typeof isBotCrawler&&1==isBotCrawler){if(null!=_siteBuilderDetail.UserLocationInfo.Model.Reviews&&"0"!=_siteBuilderDetail.UserLocationInfo.Model.Reviews.length)return _siteBuilderDetail.GetBusinessReview=new PaginationBuilder("",e,{Token:ApiURLEnumAbout.getreviews,Data:{},LocalData:{},PageSize:20,IsAjaxQue:!1,checkTab:!0,EnablePagescroll:!0,NoDataFoundDiv:$("#divReviewNoData"),ScrollTarget:t?i:ScrollTarget,initialpageData:_siteBuilderDetail.initialReviewpageData,templateName:"srpt-reviewsdetail-section",Loader:$("#tmpapgLoading"),pageName:"about",lazyLoadClass:"lazypager"}).init(),responseData={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Reviews:_siteBuilderDetail.UserLocationInfo.Model.Reviews,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey},_siteBuilderDetail.GetBusinessReview.componentnode=e,$(e).html($("#srpt-reviewsdetail-section").tmpl(responseData)),$(".reviewlazypager").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".intialsname"}).trigger("lazyload"),!1}else null!=_siteBuilderDetail.ComponentResponse.lstReview.Response?(responseData={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Reviews:[],CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey},_siteBuilderDetail.GetBusinessReview.componentnode=e,$(e).html($("#srpt-reviewsdetail-section").tmpl(responseData)),_siteBuilderDetail.GetBusinessReview.config.pageIndex=_siteBuilderDetail.ComponentResponse.lstReview.PageIndex,_siteBuilderDetail.GetBusinessReview.options.initialpageData=_siteBuilderDetail.initialReviewpageData,_siteBuilderDetail.GetBusinessReview.loadContent(),_siteBuilderDetail.SetReviewDataWhileCaches()):"undefined"!=typeof isBotCrawler&&0==isBotCrawler&&(_siteBuilderDetail.GetBusinessReview=new PaginationBuilder("",e,{Token:ApiURLEnumAbout.getreviews,Data:{},LocalData:{},PageSize:20,IsAjaxQue:!1,checkTab:!0,EnablePagescroll:!0,NoDataFoundDiv:$("#divReviewNoData"),ScrollTarget:t?i:ScrollTarget,initialpageData:_siteBuilderDetail.initialReviewpageData,templateName:"srpt-reviewsdetail-section",Loader:$("#tmpapgLoading"),pageName:"about",lazyLoadClass:"lazypager"}).init(),_siteBuilderDetail.LoadBusinessReviewDetail(!1)),null!=_siteBuilderDetail.ComponentResponse.lstReview.PageIndex||String.isNullOrUndefineOrBlank(ReviewID)||setTimeout(function(){_siteBuilderDetail.ScrollToTopAnchor("#secAboutReviewsDetail")},2e3)},_siteBuilderDetail.convertHEICToJPEG=function(e,t){e=e.toLowerCase().replace(/\.heic/,".jpeg"),isWebBrowserSupportHEIC()?getJPEGFileFromHEICWeb(t,e,function(e){var t=new FileReader;t.onload=function(t){_siteBuilderDetail.parseOrientation(_siteBuilderDetail.getOrientation(t.target.result),e,t.target.result),ShowLoader(!1)},t.readAsArrayBuffer(e)}):HEICReadFile(t,function(t){var i=[];i.push({imageName:e.toLowerCase().replace(/\.heic/,".jpeg"),base64:t.target.result});var a={fromPage:"customerappreview",images:i},r={navType:0,screenType:0,screenTitle:"",message:"",messageType:0,action:"104|~|"+JSON.stringify(a)};HEICtoJPGPostMessage("5008||~||"+JSON.stringify(r))})},_siteBuilderDetail.GetBusinessReviewSuccess=function(e,t){"1"==$("#hdnremoveReviewfilter").val()&&$("#btnReviewFilter").hide(),_siteBuilderDetail.ComponentResponse.lstReview.FilterData=e.options.Data.FilterType,_siteBuilderDetail.ComponentResponse.lstReview.SortData=e.options.Data.SortType,"reviews"==tabSegment&&(DisplayFullView(!1),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("reviews")),null==t||null!=t.Reviews&&0==t.Reviews.length?($("#divReviewNoData").show(),$("#secAboutReviewsDetail .sort-div").hide(),_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())&&$("#spReviews #tabbtnAboutFilterReviws").hide()):($("#divReviewNoData").hide(),$("#aboutReviwSortList").find(".sort-dropdown").removeClass("active").attr("aria-selected",!1),$("#aboutReviwFilterList").find(".sort-dropdown").removeClass("active").attr("aria-selected",!1),$("#aboutReviwSortList").find("[data-sort='"+$("#hdnAboutReviewSortType").val()+"']").addClass("active").attr("aria-selected",!0),$("#aboutReviwFilterList").find("[data-filter='"+$("#hdnAboutReviewFilterType").val()+"']").addClass("active").attr("aria-selected",!0),$(".reviewlazypager").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".intialsname"}).trigger("lazyload"),"reviews"==tabSegment?($("#tabbtnAboutFilterReviws").hide(),_siteBuilderDetail.GetBusinessReview.options.Data.currentPageIndex*_siteBuilderDetail.GetBusinessReview.config.PageSize>t.Reviews[0].TotalPage&&(_siteBuilderDetail.GetBusinessReview.config.EnablePagescroll=!1,_siteBuilderDetail.GetBusinessReview.enableScroll()),_siteBuilderDetail.GetBusinessReview.options.Data.currentPageIndex<2&&$("#divAboutMoreReview").hide(),1==_siteBuilderDetail.GetBusinessReview.options.Data.currentPageIndex&&parseInt($("#hdnAboutReviewFilterType").val())>0&&(null==t.Reviews||""==t.Reviews[0].VenueReview&&""==t.Reviews[0].ServiceProviderReview)&&($("#hdnAboutReviewFilterType").val("0"),$("#ancReviewwithcomment").attr("aria-selected","false"),$("#ancallreview").attr("aria-selected","true"),$("#ancReviewwithcomment").removeClass("active"),$("#ancallreview").addClass("active"),$("#btnReviewFilter").hide(),$("#hdnremoveReviewfilter").val("1"),_siteBuilderDetail.GetBusinessReview.config.Data.FilterType="0")):(1==_siteBuilderDetail.GetBusinessReview.options.Data.currentPageIndex&&parseInt($("#hdnAboutReviewFilterType").val())>0&&(null==t.Reviews||""==t.Reviews[0].VenueReview&&""==t.Reviews[0].ServiceProviderReview)&&($("#hdnAboutReviewFilterType").val("0"),$("#ancReviewwithcomment").attr("aria-selected","false"),$("#ancallreview").attr("aria-selected","true"),$("#ancReviewwithcomment").removeClass("active"),$("#ancallreview").addClass("active"),$("#btnReviewFilter").hide(),$("#hdnremoveReviewfilter").val("1"),_siteBuilderDetail.GetBusinessReview.config.Data.FilterType="0"),_siteBuilderDetail.GetBusinessReview.options.Data.currentPageIndex>=2?(_siteBuilderDetail.GetBusinessReview.config.EnablePagescroll=!1,_siteBuilderDetail.GetBusinessReview.config.totalPages>2&&$("#divAboutMoreReview").show()):($("#divAboutMoreReview").hide(),_siteBuilderDetail.GetBusinessReview.config.EnablePagescroll=!0)),e.options.Data.isScrollPaging&&"1"==$("#hdnFilterClick").val()?($("#ancHome").attr("tabindex","-1"),$("#btnReviewFilter").attr("tabindex","1").focus()):e.options.Data.isScrollPaging||"1"!=$("#hdnFilterClick").val()||($("#ancHome").attr("tabindex","1"),$("#btnReviewFilter").attr("tabindex","")),e.options.Data.isScrollPaging&&"1"==$("#hdnSortClick").val()?($("#ancHome").attr("tabindex","-1"),$("#btnReviewSort").attr("tabindex","1").focus()):e.options.Data.isScrollPaging||"1"!=$("#hdnSortClick").val()||($("#ancHome").attr("tabindex","1"),$("#btnReviewSort").attr("tabindex","")),_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())&&(_siteBuilderDetail.GetBusinessReview.config.EnablePagescroll=!0,$("#divAboutMoreReview").hide(),$("#spReviews #aboutReviwSortList .sort-dropdown[data-sort=5]").hide(),$("#spReviews #tabbtnAboutFilterReviws").hide(),_siteBuilderDetail.PopupReviewHieght()),_siteBuilderDetail.GetBusinessReview.enableScroll(),String.isNullOrUndefineOrBlank($("#hdnComponentId").val())?String.isNullOrUndefineOrBlank($("#hdnComponentName").val())||"reviews"!=$("#hdnComponentName").val()?String.isNullOrUndefineOrBlank($("#hdnComponentName").val())||"reviewsback"!=$("#hdnComponentName").val()||_shopdetail.setSelected(null,"about"):(_shopdetail.setSelected(null,"reviews"),$("#hdnComponentName").val("reviewsback")):_siteBuilderDetail.OpenReview())},_siteBuilderDetail.LoadBusinessReviewDetail=function(e){var t=$("#hdnAboutReviewSortType").val(),i=$("#hdnAboutReviewFilterType").val();_siteBuilderDetail.GetBusinessReview.options.Data.businessID=_siteBuilderDetail.businessID,_siteBuilderDetail.GetBusinessReview.options.Data.SortType=t,_siteBuilderDetail.GetBusinessReview.options.Data.FilterType=i,_siteBuilderDetail.GetBusinessReview.options.Data.ReviewGUID=String.isNullOrUndefineOrBlank(ReviewID)?"":ReviewID,_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())?_siteBuilderDetail.GetBusinessReview.options.Data.ServiceProviderId=$("#hdnSPReview").val():_siteBuilderDetail.GetBusinessReview.options.Data.ServiceProviderId=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):null,_siteBuilderDetail.GetBusinessReview.options.Data.ReviewID=String.isNullOrUndefineOrBlank($("#hdnComponentId").val())?0:$("#hdnComponentId").val(),_siteBuilderDetail.GetBusinessReview.options.onRowLoad=_siteBuilderDetail.GetBusinessReviewSuccess,e?_siteBuilderDetail.GetBusinessReview.scrollpaging():_siteBuilderDetail.GetBusinessReview.scroll()},_siteBuilderDetail.viewMoreReview=function(){_siteBuilderDetail.ComponentResponse.lstReview.Response=null,_siteBuilderDetail.LoadComponentDetails("reviews"),_siteBuilderDetail.RemoveActiveAboutTab()},_siteBuilderDetail.ReviewSorting=function(e){$("#aboutReviwSortList").trigger("w-close.w-dropdown"),$(e).data("sort")!=$("#hdnAboutReviewSortType").val()&&($(e).parent().find(".sort-dropdown").removeClass("active"),$(e).addClass("active"),$(e).parent().find(".sort-dropdown").attr("aria-selected",!1),$(e).attr("aria-selected",!0),$("#hdnAboutReviewSortType").val($(e).data("sort")),_siteBuilderDetail.ComponentResponse.lstReview={Response:null,PageIndex:null,totalPages:null,FilterData:null,SortData:null},$("#hdnSortClick").val(1),_siteBuilderDetail.LoadBusinessReviewDetail(!0),setTimeout(function(){$("#btnReviewSort").attr("tabindex",-1).focus()},500),_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())&&$("#spReviews").scrollTop(0))},_siteBuilderDetail.FilterReviews=function(e){$("#aboutReviwFilterList").trigger("w-close.w-dropdown"),$(e).data("filter")!=$("#hdnAboutReviewFilterType").val()&&($(e).parent().find(".sort-dropdown").removeClass("active"),$(e).addClass("active"),$(e).parent().find(".sort-dropdown").attr("aria-selected",!1),$(e).attr("aria-selected",!0),$("#hdnAboutReviewFilterType").val($(e).data("filter")),_siteBuilderDetail.ComponentResponse.lstReview={Response:null,PageIndex:null,totalPages:null,FilterData:null,SortData:null},$("#hdnFilterClick").val(1),_siteBuilderDetail.LoadBusinessReviewDetail(!0),_common.VisibleControlLength("#divSPReviewPopupContent")>0&&!String.isNullOrUndefineOrBlank($("#hdnSPReview").val())&&$("#spReviews").scrollTop(0))},_siteBuilderDetail.GetReviewStartWidth=function(e){var t=parseFloat(e);return isNaN(t)?"0.0%":(100*t/5).toFixed(1)+"%"},_siteBuilderDetail.NextPreAddRemoveInactive=function(){$("#btnStyleNext").addClass("w-lightbox-inactive"),$("#btnStylePrev").removeClass("w-lightbox-inactive")},_siteBuilderDetail.PrevNextBtnAddInactive=function(){$("#btnStyleNext").addClass("w-lightbox-inactive"),$("#btnStylePrev").addClass("w-lightbox-inactive")},_siteBuilderDetail.PrevNextBtnRemoveInactive=function(){$("#btnStyleNext").removeClass("w-lightbox-inactive"),$("#btnStylePrev").removeClass("w-lightbox-inactive")},_siteBuilderDetail.PrevNextAddRemoveInactive=function(){$("#btnStylePrev").addClass("w-lightbox-inactive"),$("#btnStyleNext").removeClass("w-lightbox-inactive")},_siteBuilderDetail.RemoveActiveAboutTab=function(){_siteBuilderDetail.ShowHideAboutBookNow(tabSegment),$(".nav-item",".menu-links").removeClass("active"),$(".nav-link",".menu-links").removeClass("active")},_siteBuilderDetail.GalleryPopupSwipe=function(){$("#divGalleryPopup").swipe({swipeLeft:function(e,t,i,a,r){e.preventDefault(),_siteBuilderDetail.NextStyle(e)},swipeRight:function(e,t,i,a,r){e.preventDefault(),_siteBuilderDetail.PrevStyle(e)}}),$("#divGalleryPopup").swipe({fingers:1})},_siteBuilderDetail.SetReviewDataWhileCaches=function(e,t){if(null!=typeof e&&null!=e){$("#aboutReviwFilterList").find(".sort-dropdown").removeClass("active").attr("aria-selected",!1);var i=$("#aboutReviwFilterList .sort-dropdown[data-filter="+e+"]");i.length>0&&(i.addClass("active"),i.attr("aria-selected",!0))}if(null!=typeof t&&null!=t){$("#aboutReviwSortList").find(".sort-dropdown").removeClass("active").attr("aria-selected",!1);var a=$("#aboutReviwSortList .sort-dropdown[data-sort="+t+"]");a.length>0&&(a.addClass("active"),a.attr("aria-selected",!0))}},_siteBuilderDetail.FormatPhoneByCountry=function(e,t){try{if(null!=e&&void 0!==e&&0!=e.length&&e.length>8){var i=e.replace(/\D/g,""),a={0:"(",3:") ",6:"-"};void 0!==t&&null!=t&&1*t>0&&(2==t&&10==i.length||4==t&&9==i.length)&&(i="0"+i),void 0!==t&&null!=t&&1*t>0&&(2==t?a={3:" ",7:" "}:3==t?a={3:"-",6:"-"}:4==t&&(a={0:"(",2:") ",6:" "})),e="";for(var r=0;r<i.length;r++)e+=(a[r]||"")+i[r]}return e}catch(t){return e}},_siteBuilderDetail.PhoneNumberCountryFormat=function(e,t){try{if(e=e.replace(/([()-\s])+/g,""),void 0!==t&&null!=t&&""!=t){var i=t,a=e,r=a.length;if(r<=0)return;if("2"!=i&&11==r&&0==a[0]&&(r=(a=a.substring(1)).length),"1"!=i&&"3"!=i||10!=r){if("2"==i){if(10==r&&0!=a[0]?r=(a=0+a).length:(r<=10||12==r)&&0==a[0]&&(r=(a=a.substring(1)).length),10==r||11==r){var o="";e=o=1==a.substring(0,2)?a.replace(/(\d{5})\-?(\d{6})/,"$1 $2"):2==a.substring(0,2)?a.replace(/(\d{3})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3"):7==a.substring(0,2)?a.replace(/(\d{5})\-?(\d{3})\-?(\d{3})/,"$1 $2 $3"):a.replace(/(\d{3})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3")}}else if("4"==i){if(9==r&&0!=a[0]?r=(a=0+a).length:(r<=9||r>10)&&0==a[0]&&(r=(a=a.substring(1)).length),9==r||10==r)e=o=a.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3")}}else if("3"==i)e=o=a.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"$1-$2-$3");else e=o=a.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1) $2-$3")}else{o=e.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1)-$2-$3");e=o}}catch(e){}return e},_siteBuilderDetail.keyup=function(e){var t=!0,i=$(e).val(),a=i.length;return void 0===i||null==i||""==i||null==i?a=0:a>2500&&($(e).val(i.trim().substring(0,2500)),a=2500,$(e).focus(),t=!1),"txtSPComments"==$(e).attr("id")?$("#spReviewCharCount").html(a):"txtComments"==$(e).attr("id")&&$("#businessReviewCharCount").html(a),t},_siteBuilderDetail.OpenReview=function(){var e=$.grep(_siteBuilderDetail.ComponentResponse.lstReview.Response,function(e){return e.ReviewID==$("#hdnComponentId").val()});if(e.length>0){$("#divSPReviewPopup").modal("show"),$("#divSPReviewPopupContent").show(),$(".sp-details").hide(),$("#divSPReviewPopup").addClass("applemapurl"),$(".modal-backdrop").addClass("backdrophide"),centerModal("#divSPReviewPopup"),$("#galleryPopup").css("z-index","1056");getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageReviewsDetailSectionComponent,function(){responseData={BusinessDetail:_siteBuilderDetail.ComponentResponse.lstBusinessDetail,Reviews:e,CommonApiConfigKeys:_siteBuilderDetail.ComponentResponse.lstCommonConfigKey};var t=$("#spReviews")[0];$(t).html($("#srpt-reviewsdetail-section").tmpl(responseData)),$("#spReviews .reviews-title-buttons-div").hide(),$("#reviewheader .web-display-small").html("Review"),$("#hdnComponentId").val(""),_siteBuilderDetail.PopupReviewHieght(),_shopdetail.setSelected(null,"reviews"),$("#hdnComponentName").val("reviewsback")},$("#spReviews")[0])}},_siteBuilderDetail.ShowCityModal=function(){if((1==_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory||2==_siteBuilderDetail.GetCitiesPopUpDetail.IsMobileServiceMandatory)&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0&&1==_siteBuilderDetail.GetCitiesPopUpDetail.IsOutcallMandatory)return _siteBuilderDetail.GetCityDetail(),$("#selectCitiesModal").modal("show"),$("#lblCities").text(_siteBuilderDetail.GetCitiesPopUpDetail.businessName+"'s Service Cities"),!1},_siteBuilderDetail.GetCityDetail=function(){try{var e=0,t={};t.BusinessID=Number(_siteBuilderDetail.GetCitiesPopUpDetail.BusinessID),t.UserID=UserID;var i=new vagaro.ajax;i.datamodel.Token="GetBusinessMobileServiceCities",i.datamodel.data=t,i.datamodel.async=!1,ShowLoader(!0),i.datamodel.callback=function(t){null!=t&&t.length>0&&($("#selectNearByCities").empty(),t.forEach(function(t){var i="";t.IsSelected&&(e++,i=`<div class="customcheck-box-singal default-hoverable-checkbox">\n                        <label>${t.City}</label>\n                        </div>`),$("#selectNearByCities").append(i)}),_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount=e),ShowLoader(!1)},i.datamodel.Error=function(e){ShowLoader(!1)},i.Post()}catch(e){}};var ApiURLEnumStaff={getshopdetailcompositestaff:(ApiPath="websiteapi/homepage/")+"getshopdetailcompositestaff"},SPImgHeightInPopup=260,SPImgWidthInPopup=260;function reportWindowSize(){_siteBuilderDetail.PopupReviewHieght()}_siteBuilderDetail.StaffTemplateName="#dvStaffTemplate",_siteBuilderDetail.StaffHTMLTemplateName="#dvStaffhtmlTemplate",_siteBuilderDetail.GetBusinessStaffComponent=function(e){if(null!=_siteBuilderDetail.ComponentResponse.lstStaff)_siteBuilderDetail.GetBusinessStaffSuccess(_siteBuilderDetail.ComponentResponse.lstStaff,e);else{var t={businessID:_shopdetail.businessID,loginUserID:UserID,bookText:BookText},i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumStaff.getshopdetailcompositestaff,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){_siteBuilderDetail.GetBusinessStaffSuccess(t,e)},i.datamodel.data=t,i.datamodel.Error=function(){},i.Post()}},_siteBuilderDetail.GetBusinessStaffSuccess=function(e,t){DisplayFullView(!1),_siteBuilderDetail.ComponentResponse.lstReview.Response=null,_siteBuilderDetail.ComponentResponse.lstStaff=e,$(t).html($(_siteBuilderDetail.StaffHTMLTemplateName).html());var i=1==_common.isCreateLinkPreserve(!0,!0)?_common.isCreateLinkPreserve(!1):null;if(null!=i&&i.length>0){var a=[];$.grep(i,function(t){"-1"!=t&&$.grep(e.ServiceProviders,function(e){e.ServiceProviderID==parseInt(t)&&a.push(e)})}),e.ServiceProviders=a.length>0?a:e.ServiceProviders}_siteBuilderDetail.isVConnectBetaRelease=JSON.parse($("#hdnVConnectBetaRelease").val().toLowerCase()),0!=$("#dvStaffContainer").length?($("#dvStaffContainer").html(""),$(_siteBuilderDetail.StaffTemplateName).tmpl(e).appendTo("#dvStaffContainer")):($("#iframe1").contents().find("body").find("#dvStaffContainer").html(""),$(_siteBuilderDetail.StaffTemplateName).tmpl(e).appendTo($("#iframe1").contents().find("body").find("#dvStaffContainer"))),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("staff"),$(".stafflazypager").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".intialsname"}).trigger("lazyload"),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("staff")},_siteBuilderDetail.SPReviews=function(e){_siteBuilderDetail.ComponentResponse.lstReview.Response=null,$("#hdnSPReview").val(e),$("#divSPReviewPopup").modal("show"),$("#divSPReviewPopupContent").show(),$(".modal-backdrop").addClass("backdrophide"),$(".sp-details").show(),$("#divSPReviewPopup").removeClass("applemapurl"),centerModal("#divSPReviewPopup"),$("#galleryPopup").css("z-index","1056");var t=null;if(null!=_siteBuilderDetail.ComponentResponse.lstStaff){t=$.grep(_siteBuilderDetail.ComponentResponse.lstStaff.ServiceProviders,function(t){return t.ServiceProviderID==e});_siteBuilderDetail.ServiceProviderDetailinPopup(t[0])}else{var i={businessID:_shopdetail.businessID,loginUserID:UserID,bookText:BookText},a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumStaff.getshopdetailcompositestaff,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(i){_siteBuilderDetail.ComponentResponse.lstStaff=i,t=$.grep(_siteBuilderDetail.ComponentResponse.lstStaff.ServiceProviders,function(t){return t.ServiceProviderID==e}),_siteBuilderDetail.ServiceProviderDetailinPopup(t[0])},a.datamodel.data=i,a.datamodel.Error=function(){},a.Post()}getSiteBuilderObj().GetHTMLTemplate(getSiteBuilderObj().HTMLTemplates.AboutPageReviewsDetailSectionComponent,function(){return getSiteBuilderObj().GetBusinessReviewComponent($("#spReviews")[0]),$("#spReviews").scrollTop(0),!1},$("#spReviews")[0])},_siteBuilderDetail.ServiceProviderDetailinPopup=function(e){if((void 0===e.ServiceProviderPhotoURLForReviewPopup||""==e.ServiceProviderPhotoURLForReviewPopup||null!=e.ServiceProviderPhotoURLForReviewPopup&&(e.ServiceProviderPhotoURLForReviewPopup.indexOf("user-male-img_155_new.png")>-1||e.ServiceProviderPhotoURLForReviewPopup.indexOf("user-female-img_155.jpg")>-1))&&(e.ServiceProviderPhotoURLForReviewPopup=null),$("#spDetails").html(""),$("#sp-detail-tmpl").tmpl(e).appendTo("#spDetails"),$(".stafflazypager").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".intialsname"}).trigger("lazyload"),_common.VisibleControlLength("#mobile-check")>0)if(SPImgHeightInPopup=40,null!=e.ServiceProviderPhotoURLForReviewPopup){const t=new Image;t.onload=function(e){SPImgHeightInPopup=SPImgWidthInPopup=260,e.target.height<260&&(SPImgHeightInPopup=e.target.height),e.target.width<260&&(SPImgWidthInPopup=e.target.width),$("#divSPReviewPopup.modal .sp-details .profile-img-block").height(SPImgHeightInPopup),$("#divSPReviewPopup.modal .sp-details .profile-img-block").width(SPImgWidthInPopup),SPImgHeightInPopup=40,$(".sp-description")[0].scrollHeight>SPImgHeightInPopup&&($("#divMoreContent").show(),$(".sp-description").css({height:SPImgHeightInPopup+"px"}))},t.src=e.ServiceProviderPhotoURLForReviewPopup}else $(".sp-description")[0].scrollHeight>SPImgHeightInPopup&&($("#divMoreContent").show(),$(".sp-description").css({height:SPImgHeightInPopup+"px"}));else if(null!=e.ServiceProviderPhotoURLForReviewPopup){const t=new Image;t.onload=function(e){SPImgHeightInPopup=SPImgWidthInPopup=260,e.target.height<260&&(SPImgHeightInPopup=e.target.height),e.target.width<260&&(SPImgWidthInPopup=e.target.width),$("#divSPReviewPopup.modal .sp-details .profile-img-block").height(SPImgHeightInPopup),$("#divSPReviewPopup.modal .sp-details .profile-img-block").width(SPImgWidthInPopup),$("#divSPReviewPopup.modal .sp-details .review-name-date-div").css("margin-left",SPImgWidthInPopup+24+"px"),$(".sp-description")[0].scrollHeight+70>SPImgHeightInPopup&&($("#divMoreContent").show(),$(".sp-description").css({height:SPImgHeightInPopup-77+"px"}))},t.src=e.ServiceProviderPhotoURLForReviewPopup}else SPImgHeightInPopup=117,$(".sp-description")[0].scrollHeight>40&&($("#divMoreContent").show(),$(".sp-description").css({height:SPImgHeightInPopup-77+"px"}))},_siteBuilderDetail.ShowMoreContent=function(e){var t=$("#btnMoreContent"),i=$(".sp-description");t.hasClass("active")?(_common.VisibleControlLength("#mobile-check")>0?i.css({height:SPImgHeightInPopup+"px"}):i.css({height:SPImgHeightInPopup-77+"px"}),t.removeClass("active").html("More")):(i.addClass("active").css({height:"auto"}),t.addClass("active").html("Less")),_siteBuilderDetail.PopupReviewHieght(),e.stopPropagation(),e.preventDefault()},_siteBuilderDetail.PopupReviewHieght=function(){if($(window).width()>767){var e=$(window).height()-($(".sp-details").length?$(".sp-details").outerHeight(!0):0)-($(".review-header").length?$(".review-header").outerHeight(!0):0)-147;$("#spReviews").css("max-height",e)}},_siteBuilderDetail.ScrollToTop=function(){$(".modal-body.more-padding").scrollTop(0)},window.onresize=reportWindowSize;var ApiURLEnumService={getshopdetailcompositeservice:(ApiPath="websiteapi/homepage/")+"getshopdetailcompositeservice"};function getCookieValue(e){for(var t=e+"=",i=document.cookie.split(";"),a=0;a<i.length;a++){for(var r=i[a];" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf(t)){var o=r.substring(t.length,r.length);return null==o||null==o||""==o||"undefined"==o?null:o}}return null}function LoadAccordion(){if($(".card","#dvServiceContainer").length<=1)(e=$(".card","#dvServiceContainer").eq(0)).find("div.card-header").attr("aria-expanded","true"),e.find("div.collapse").addClass("show"),e.find("div.card-header").removeClass("collapsed");else if("undefined"==typeof businessID||String.isNullOrUndefineOrBlank(businessID)||288382!=businessID&&254637!=businessID){if($(".ServiceTitleCount","#dvServiceContainer").length<=50)(e=$(".card","#dvServiceContainer")).find("div.card-header").attr("aria-expanded","true"),e.find("div.collapse").addClass("show"),e.find("div.card-header").removeClass("collapsed");else if($(".ServiceTitleCount","#dvServiceContainer").length>0){var e;(e=$(".card","#dvServiceContainer").first()).find("div.card-header").attr("aria-expanded","true"),e.find("div.collapse").addClass("show"),e.find("div.card-header").removeClass("collapsed")}}else(e=$(".card","#dvServiceContainer")).find("div.card-header").attr("aria-expanded","false"),e.find("div.collapse").addClass("hide");$("#dvServiceContainer").on("shown.bs.collapse",function(e){var t=Math.round($(e.target).offset().top-($("#tabs").height()+2*$(".nav-bar").height()+25));InPageWidget_Ios?(screenheight=_common.getscrollTop(ScrollTarget),void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite&&(screenheight+=50),$("html,body").animate({scrollTop:$(e.target).offset().top+screenheight-165},"slow","linear")):_common.nestedHiddenElement("#mobile-check")>0?(void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite&&(t+=150),$("html, body").animate({scrollTop:t},"slow")):(void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite&&(t+=50),$("html, body").animate({scrollTop:t},"slow"));try{$("#aServiceBusImage",e.target).closest("div.serviceBoxColor").hasClass("opened")||$("#aServiceBusImage",e.target).closest("div.serviceBoxColor").addClass("opened"),$("#aServiceBusImage",e.target).closest("div.serviceBoxColor").hasClass("opened")?$("#aServiceBusImage",e.target).lazyload():$("#aServiceBusImage",e.target).lazyload({effect:"fadeIn",imgLoadClass:"loaded"})}catch(e){}})}_siteBuilderDetail.ServiceTemplateName="#dvParentTemplate",_siteBuilderDetail.ServiceHTMLTemplateName="#dvServicehtmlTemplate",_siteBuilderDetail.GetBusinessServiceComponent=function(e){if(null!=_siteBuilderDetail.ComponentResponse.lstService)_siteBuilderDetail.GetBusinessServiceSuccess(_siteBuilderDetail.ComponentResponse.lstService,e);else{var t=getCookieValue("Referral"),i={businessID:_shopdetail.businessID,loginUserID:UserID,pageIndex:1,pageSize:null,IsForNewCustomer:0,IsPackageInclude:1,bookText:BookText,classBookText:ClassBookText,currencySymbol:currencySymbol,MerchantAccount:_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MerchantAccount,IsShowCustomPackage:_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsShowCustomPackage,IsOutcallMandatory:_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsOutcallMandatory,OutcallPointRedeem:_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.OutcallPointRedeem,OutCallPrice:_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.OutCallPrice,IsMobileServiceMandatory:_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsMobileServiceMandatory,ServiceProviderId:1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):1==_common.isCreateLinkPreserve(!0,!0)&&"-1"!=_common.isCreateLinkPreserve(!1).join(",")?_common.isCreateLinkPreserve(!1).join(","):null,Referral:void 0===t||null==t||"undefined"==t||null==t||""==t?0:1};newserviceproviderforwidget=i.ServiceProviderId;var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumService.getshopdetailcompositeservice,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(t){_siteBuilderDetail.GetBusinessServiceSuccess(t,e)},a.datamodel.data=i,a.datamodel.Error=function(){ShowLoader(!1)},a.Post()}},_siteBuilderDetail.GetBusinessServiceSuccess=function(e,t){"undefined"==typeof isWidget||"true"!=isWidget.toLowerCase()?_siteBuilderDetail._continueGetBusinessServiceSuccess(e,t):_shopdetail.GetWidgetServicesDetail(function(){if(!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail)&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail.ServiceIds)){var i=_shopdetail.WidgetServicesDetail.ServiceIds.split("|");if(i.length>0&&!String.isNullOrUndefineOrBlank(i[0])){if(null!=e.Services&&e.Services.length>0){var a=0,r=$.extend(!0,[],e.Services);e.Services=$.map(e.Services,function(e){if(1==_onlineCheckout.CheckFileType(e.ServiceCategoryID.toString(),i[0])&&(e.ServiceList=$.map(e.ServiceList,function(e){if(1==_onlineCheckout.CheckFileType(e.ServiceID.toString(),i[0]))return a=1,e}),e.ServiceList.length>0))return e}),0==a&&0==IsFromMultiLocation&&(e.Services=r)}if(null!=e.ServicesData&&e.ServicesData.length>0){a=0;var o=$.extend(!0,[],e.ServicesData);e.ServicesData=$.map(e.ServicesData,function(e){if(1==_onlineCheckout.CheckFileType(e.ServiceID.toString(),i[0]))return a=1,e}),0==a&&0==IsFromMultiLocation&&(e.ServicesData=o)}}}if((0==e.Services.length||0==e.ServicesData.length)&&0==_siteBuilderDetail.isNullUndefined(_siteBuilderDetail.UserLocationInfo.objDynamicMenuData))return _siteBuilderDetail.UserLocationInfo.objDynamicMenuData[_siteBuilderDetail.GetDynamicMenuDataID("services")].isVisible=!1,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData[_siteBuilderDetail.GetDynamicMenuDataID("book-now")].isVisible=!1,$("#widgetdetailmenu #ancServiceTab").hide(),1==_siteBuilderDetail.UserLocationInfo.objDynamicMenuData[_siteBuilderDetail.GetDynamicMenuDataID("gift-certificates")].isVisible?_siteBuilderDetail.LoadComponentDetails("gift-certificates"):1==_siteBuilderDetail.UserLocationInfo.objDynamicMenuData[_siteBuilderDetail.GetDynamicMenuDataID("classes")].isVisible?_siteBuilderDetail.LoadComponentDetails("classes"):1==_siteBuilderDetail.UserLocationInfo.objDynamicMenuData[_siteBuilderDetail.GetDynamicMenuDataID("memberships")].isVisible?_siteBuilderDetail.LoadComponentDetails("memberships"):1==_siteBuilderDetail.UserLocationInfo.objDynamicMenuData[_siteBuilderDetail.GetDynamicMenuDataID("reviews")].isVisible&&_siteBuilderDetail.LoadComponentDetails("reviews"),void _siteBuilderDetail.BindMenu();_siteBuilderDetail._continueGetBusinessServiceSuccess(e,t)})},_siteBuilderDetail._continueGetBusinessServiceSuccess=function(e,t){SelectedAddonService=[],_shopdetail.localData.SelectedAddonsList="",ServiceDataList=e.ServicesData,lstOnlineServiceBundleDetail=e.lstOnlineServiceBundleDetail,ShowLoader(!1),DisplayFullView(!1),$(t).html($(_siteBuilderDetail.ServiceHTMLTemplateName).html()),_siteBuilderDetail.ComponentResponse.lstService=e,null==e.BusinessDetail&&(e.BusinessDetail={}),e.BusinessDetail.MerchantAccount=merchantAccount,e.BusinessDetail.CountryID=countryIdBusDetail,e.BusinessDetail.IsShowPackage="true"==IsShowPackage,$("#dvServiceContainer").html(""),0!=$("#dvServiceContainer").length?$(_siteBuilderDetail.ServiceTemplateName).tmpl(e).appendTo("#dvServiceContainer"):$(_siteBuilderDetail.ServiceTemplateName).tmpl(e).appendTo($("#iframe1").contents().find("body").find("#dvServiceContainer")),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("services"),$(".servicelazypager").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:_siteBuilderDetail.imageVagaroError()}).trigger("lazyload"),LoadAccordion(),void 0!==_shopdetail&&null!=_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.GetPromotionsByBusinessID&&null!=_shopdetail.GetPromotionsByBusinessID&&null!=_shopdetail.GetPromotionsByBusinessID&&_shopdetail.GetPromotionsByBusinessID();try{e&&void 0!==e.IsFMBEnableForBusiness&&(IsFMBEnableForBusiness=e.IsFMBEnableForBusiness)}catch(e){}try{"function"==typeof _siteBuilderDetail.FireServicesTabPageVisited&&_siteBuilderDetail.FireServicesTabPageVisited()}catch(e){}},_siteBuilderDetail.FireServicesTabPageVisited=function(){try{if(void 0===_shopdetail||!_shopdetail)return;var e="";try{e="function"==typeof getCookie&&getCookie("VeraSourceType")||""}catch(t){e=""}if("vera-email"!=(e=e.toString().toLowerCase())&&"vera-push"!=e)return;var t=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i={Step:141,PageURL:window.location.href,UserAgent:t,AmplitudeDeviceId:"undefined"!=typeof _onlineCheckout&&_onlineCheckout&&"function"==typeof _onlineCheckout.GetAmplitudeDeviceId?_onlineCheckout.GetAmplitudeDeviceId():"",BusinessID:_shopdetail&&_shopdetail.businessID?_shopdetail.businessID:0,UserID:$("#hdnLoggedInUserid").val()&&"0"!=$("#hdnLoggedInUserid").val()?$("#hdnLoggedInUserid").val():"undefined"!=typeof UserID?UserID:0,UserIDEnc:"",BusinessName:_shopdetail&&_shopdetail.businessName?_shopdetail.businessName:"",IsDailyDealEnabled:void 0!==PromotionDetails&&PromotionDetails&&PromotionDetails.length>0,IsFillMyBooksEnabled:void 0!==IsFMBEnableForBusiness&&IsFMBEnableForBusiness,IsFromEmail:"vera-email"==e,IsFromPush:"vera-push"==e,DeviceModel:t,DealType:""};"function"==typeof _shopdetail.AjaxOld&&_shopdetail.AjaxOld("AddLogInAmplitudeCoreV2",{AddLogInAmplitude:i},function(){},function(){})}catch(e){}},_siteBuilderDetail.GetDynamicMenuDataID=function(e){return _siteBuilderDetail.UserLocationInfo.objDynamicMenuData.findIndex(t=>t.menuID==e.toString())},_siteBuilderDetail.GCServiceList="",_siteBuilderDetail.IsFromGoogleMyBusiness=!1,_siteBuilderDetail.divGiftCardContainer="#dvGiftCardContainer",_siteBuilderDetail.divEmptyGiftCardContainer="#dvEmptyGiftCardContainer",_siteBuilderDetail.divInnerGCContainer="#dvInnerGCContainer",_siteBuilderDetail.divgcLimitNote="#divgcLimitNote",_siteBuilderDetail.strAddress="",_siteBuilderDetail.activetabtype="",_siteBuilderDetail.service="",_siteBuilderDetail.iFrame1="#iframe1",_siteBuilderDetail.hdnServicePriceForGC="#hdnServicePriceForGC",_siteBuilderDetail.hdnServiceSessionDetailForGC="#hdnServiceSessionDetailForGC",_siteBuilderDetail.txtMaxQuantity="#txtMaxQuantity",_siteBuilderDetail.arrowupdown=".arrow-up-down",_siteBuilderDetail.tab_serviceDropDown="#tab_serviceDropDown",_siteBuilderDetail.txtAmount="#txtAmount",_siteBuilderDetail.hdnServiceIDForGC="#hdnServiceIDForGC",_siteBuilderDetail.disabled="disabled",_siteBuilderDetail.spcount="#spcount",_siteBuilderDetail.txtSalonServicesForGCerrortext=".txtSalonServicesForGCerrortext",_siteBuilderDetail.spservice="#spservice",_siteBuilderDetail.ddQuantity="#ddQuantity",_siteBuilderDetail.errorInput="errorInput",_siteBuilderDetail.lblAmount="#lblAmount",_siteBuilderDetail.hdnServiceTitleForGC="#hdnServiceTitleForGC",_siteBuilderDetail.txtSalonServicesForGC="#txtSalonServicesForGC",_siteBuilderDetail.div_gcContainer="#div_gcContainer",_siteBuilderDetail.slidedisabled="slide-disabled",_siteBuilderDetail.choice="choice",_siteBuilderDetail.txtmessage="#txtmessage",_siteBuilderDetail.txservice="service",_siteBuilderDetail.wcurrent="w--current",_siteBuilderDetail.txtGCEmail="#txtGCEmail",_siteBuilderDetail.txtfullname="#txtfullname",_siteBuilderDetail.dataphotoid="data-photoid",_siteBuilderDetail.gcpreview="#gcpreview",_siteBuilderDetail.datawtab="data-w-tab",_siteBuilderDetail.data="data",_siteBuilderDetail.tab1="Tab 1",_siteBuilderDetail.tab2="Tab 2",_siteBuilderDetail.tabscontent2=".tabs-content-2",_siteBuilderDetail.wtabactive="w--tab-active",_siteBuilderDetail.tab_amount="#tab_amount",_siteBuilderDetail.tab_service="#tab_service",_siteBuilderDetail.upDownArow=".upDownArow",_siteBuilderDetail.div_amount="#div_amount",_siteBuilderDetail.divmessage="#divmessage",_siteBuilderDetail.divfullname="#divfullname",_siteBuilderDetail.gcprintcont=".gc-printcont",_siteBuilderDetail.divaddress="#divaddress",_siteBuilderDetail.backgroundimage="background-image",_siteBuilderDetail.color="color",_siteBuilderDetail.Contact="Contact",_siteBuilderDetail.active="active",_siteBuilderDetail.gcthumb=".gc-thumb",_siteBuilderDetail.ulGcImagesData="#ulGcImagesData",_siteBuilderDetail.bookserviceopen="book-service-open",_siteBuilderDetail.bookserviceopencommon="book-service-open-common",_siteBuilderDetail.gctransformnone="gc-transformnone",_siteBuilderDetail.moboverflowhide="moboverflow-hide",_siteBuilderDetail.htmlbody="html, body",_siteBuilderDetail.mobiletoggle=".mobile-toggle",_siteBuilderDetail.aMobileTab="#aMobileTab",_siteBuilderDetail.aBusinessTab="#aBusinessTab",_siteBuilderDetail.businesstoggle=".business-toggle",_siteBuilderDetail.ulFeatureBusiness="#ulFeatureBusiness",_siteBuilderDetail.dvAdvanceFilter="#dvAdvanceFilter",_siteBuilderDetail.servicedtpickhide="service-dtpick-hide",_siteBuilderDetail.businesstypehide="business-type-hide",_siteBuilderDetail.divServiceDate="#divServiceDate",_siteBuilderDetail.txtMobileService="txtMobileService",_siteBuilderDetail.ddlServices="ddlServices",_siteBuilderDetail.select2input=".select2-input",_siteBuilderDetail.professionalsorting=".professional-sorting",_siteBuilderDetail.gallerysorting=".gallery-sorting",_siteBuilderDetail.listpagesorting=".listpage-sorting",_siteBuilderDetail.select2dropmask="#select2-drop-mask",_siteBuilderDetail.mobilecheck="#mobile-check",_siteBuilderDetail.listings="listings",_siteBuilderDetail.listSort="listSort",_siteBuilderDetail.xdsoft_datetimepicker="xdsoft_datetimepicker",_siteBuilderDetail.hidemask="hidemask",_siteBuilderDetail.dvDealMobileService="dvDealMobileService",_siteBuilderDetail.searchaddservclass="searchaddservclass",_siteBuilderDetail.checkdivservicemobcommoninput="div:not(.service-mob-commoninput)",_siteBuilderDetail.divBusType="#divBusType",_siteBuilderDetail.btnSearchBuss="#btnSearchBuss",_siteBuilderDetail.mobclassserachspace="mob-class-serachspace",_siteBuilderDetail.txtSearchServiceMain="#txtSearchServiceMain",_siteBuilderDetail.select2="select2",_siteBuilderDetail.select2dropwhatdropdown="#select2-drop.service-what-dropdown",_siteBuilderDetail.servicedataonly="service-data-only",_siteBuilderDetail.apgLoading="#apgLoading",_siteBuilderDetail.lazypager="lazypager",_siteBuilderDetail.dvGiftCardhtmlTemplate="dvGiftCardhtmlTemplate",_siteBuilderDetail.lazyload="lazyload",_siteBuilderDetail.body="body",_siteBuilderDetail.dvGiftCardInnerDetailTemplate="dvGiftCardInnerDetailTemplate",_siteBuilderDetail.undefined="undefined",_siteBuilderDetail.visible=":visible",_siteBuilderDetail.click="click",_siteBuilderDetail.txtAmounterror="#txtAmount-error",_siteBuilderDetail.borderBottom="palette-border-bottom",_siteBuilderDetail.secondaryTab="palette-tab-secondary",_siteBuilderDetail.secondaryText="palette-tab-secondary",_siteBuilderDetail.txtScheduleDate="#txtScheduleDate",_siteBuilderDetail.txtReciverPhoneNo="#txtReciverPhoneNo",_siteBuilderDetail.divScheduleDate="#divScheduleDate";var ApiURLEnumGC={getgiftcertificatecategory:ApiPath+"getgiftcertificatecategory",getgiftcertificateimgbycategory:ApiPath+"getgiftcertificateimgbycategory",getgiftcertificateexpmonth:ApiPath+"getgiftcertificateexpmonth",bindsalonservicecomboforgc:ApiPath+"bindsalonservicecomboforgc",getcustomernamebyemailid:ApiPath+"getcustomernamebyemailid",bindcomboforgcdiscount:ApiPath+"bindcomboforgcdiscount"},ShowVPLNoOfPayment={Hide:0,Show:1};_siteBuilderDetail.GetGiftCardComponent=function(e){if(!IsNewCustomWebsite||_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData(e,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,"gift-certificates"))if(null!=_siteBuilderDetail.ComponentResponse.lstGiftCard)_siteBuilderDetail.GetGiftCardSuccess(_siteBuilderDetail.ComponentResponse.lstGiftCard,e);else if("undefined"!=typeof isBotCrawler&&0==isBotCrawler){var t={};t.businessID=_shopdetail.businessID,t.loginUserID=UserID,t.groupId=groupID,t.businessUrl=cDNUrl;var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumGC.getgiftcertificatecategory,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){_siteBuilderDetail.GetGiftCardSuccess(t,e)},i.datamodel.data=t,i.datamodel.Error=CallFail_LoadUserControlWithProxy,i.Post()}},_siteBuilderDetail.GetGiftCardSuccess=function(e,t){try{const e=new URLSearchParams(window.location.search);void 0!==e&&1==e.has("utm_campaign")&&1==e.has("utm_source")&&1==e.has("utm_medium")&&"giftcard-store"==e.get("utm_campaign")&&"gmb"==e.get("utm_source")&&"organic"==e.get("utm_medium")&&(_siteBuilderDetail.IsFromGoogleMyBusiness=!0)}catch(e){}_siteBuilderDetail.ComponentResponse.lstGiftCard=e,DisplayFullView(!1),$(t).html($("#"+_siteBuilderDetail.dvGiftCardhtmlTemplate).html()),null===e.GiftCards||""===e.GiftCards||void 0===e.GiftCards||0===e.GiftCards.length?$(_siteBuilderDetail.divGiftCardContainer).length>0&&$(_siteBuilderDetail.divEmptyGiftCardContainer).length>0?($(_siteBuilderDetail.divGiftCardContainer).hide(),$(_siteBuilderDetail.divEmptyGiftCardContainer).show()):($(_siteBuilderDetail.iFrame1).contents().find(_siteBuilderDetail.body).find(_siteBuilderDetail.divGiftCardContainer).hide(),$(_siteBuilderDetail.iFrame1).contents().find(_siteBuilderDetail.body).find(_siteBuilderDetail.divEmptyGiftCardContainer).show()):($(_siteBuilderDetail.divGiftCardContainer).length>0?($(_siteBuilderDetail.divGiftCardContainer).show(),$(_siteBuilderDetail.divEmptyGiftCardContainer).hide(),$("#dvGiftCardTemplate").tmpl(e).appendTo(_siteBuilderDetail.divGiftCardContainer)):($(_siteBuilderDetail.iFrame1).contents().find(_siteBuilderDetail.body).find(_siteBuilderDetail.divGiftCardContainer).show(),$(_siteBuilderDetail.iFrame1).contents().find(_siteBuilderDetail.body).find(_siteBuilderDetail.divEmptyGiftCardContainer).hide(),$("#dvGiftCardTemplate").tmpl(e).appendTo($(_siteBuilderDetail.iFrame1).contents().find(_siteBuilderDetail.body).find(_siteBuilderDetail.divGiftCardContainer))),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("gift-certificates"),$(".giftcardlazypager").lazyload({effect:"fadeIn",failure_limit:50,event:_siteBuilderDetail.lazyload,data_error:_siteBuilderDetail.imageVagaroError()}).trigger(_siteBuilderDetail.lazyload)),"undefined"==typeof isWidget||"true"!=isWidget.toLowerCase()||_shopdetail.MerchantAccount!=MerchantAccount.NoMerchantAccount&&_shopdetail.IsGCTabEnabled||($("#dvGiftCardContainer").hide(),$(_siteBuilderDetail.divEmptyGiftCardContainer).hide(),$("#divGCMessage").show().text(" '"+businessName+"' does not sell gift card online, please call '"+_shopdetail.Telephone+"' for more information."))},_siteBuilderDetail.GetImagesBasedOnCategory=function(e){_siteBuilderDetail.strAddress="",$("#hdnGCID").val(e),_siteBuilderDetail.GetBusinessAddress(),_siteBuilderDetail.createGC(e),$(_siteBuilderDetail.htmlbody).scrollTop(0)},_siteBuilderDetail.GetBusinessAddress=function(){void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail&&void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.Telephone&&""!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.Telephone&&(void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.Street&&""!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.Street&&(_siteBuilderDetail.strAddress+=_siteBuilderDetail.AllDetailCommon.BusinessDetail.Street+", "),void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.City&&""!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.City&&(_siteBuilderDetail.strAddress+=_siteBuilderDetail.AllDetailCommon.BusinessDetail.City+", "),void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.StateCode&&""!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.StateCode&&_shopdetail.countryId==countryDetailList.USA?_siteBuilderDetail.strAddress+=_siteBuilderDetail.AllDetailCommon.BusinessDetail.StateCode+" ":void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.StateName&&""!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.StateName&&_shopdetail.countryId!=countryDetailList.USA&&(_siteBuilderDetail.strAddress+=_siteBuilderDetail.AllDetailCommon.BusinessDetail.StateName+" "),void 0!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.Zip&&""!==_siteBuilderDetail.AllDetailCommon.BusinessDetail.Zip&&(_siteBuilderDetail.strAddress+=_siteBuilderDetail.AllDetailCommon.BusinessDetail.Zip),1===_siteBuilderDetail.AllDetailCommon.BusinessDetail.IsMobileServiceMandatory&&(_siteBuilderDetail.strAddress=""),_siteBuilderDetail.strAddress+="\r\n"+_siteBuilderDetail.Contact+": "+_siteBuilderDetail.FormatPhoneByCountry(_siteBuilderDetail.AllDetailCommon.BusinessDetail.Telephone,_shopdetail.countryId))},_siteBuilderDetail.createGC=function(e){UserID>0?(_siteBuilderDetail.GiftcertificatePager=new PaginationBuilder("","",{Token:ApiURLEnumGC.getgiftcertificateimgbycategory,Data:{},LocalData:{},checkTab:!0,IsAjaxQue:!1,templateName:_siteBuilderDetail.dvGiftCardInnerDetailTemplate,Loader:$(_siteBuilderDetail.apgLoading),pageName:"home",lazyLoadClass:_siteBuilderDetail.lazypager,htmltemplatename:_siteBuilderDetail.dvGiftCardhtmlTemplate}).init(),_siteBuilderDetail.GiftcertificatePager.options.Data.businessID=_siteBuilderDetail.businessID,_siteBuilderDetail.GiftcertificatePager.options.Data.gcCategoryID=e,_siteBuilderDetail.GiftcertificatePager.options.Data.groupId=_siteBuilderDetail.SQLGroupID,_siteBuilderDetail.GiftcertificatePager.options.Data.businessUrl=_siteBuilderDetail.AllDetailCommon.BusinessDetail.CDNUrl,_siteBuilderDetail.GiftcertificatePager.options.onRowLoad=_siteBuilderDetail.onGcImageDataLoad,_siteBuilderDetail.GiftcertificatePager.scroll(),$(_siteBuilderDetail.gcpreview).css(_siteBuilderDetail.backgroundimage,"")):showCommonLoginPopup("GiftCertificate")},_siteBuilderDetail.onGcImageDataLoad=function(e,t){if(null!=t&&""!==t&&void 0!==t.GiftCardsImageList&&t.GiftCardsImageList.length>0&&void 0!==t.GiftCardsImageList[0].GiftCertificatePhotoImg){$(_siteBuilderDetail.divInnerGCContainer).html(""),$(_siteBuilderDetail.divGiftCardContainer).hide(),$(_siteBuilderDetail.divInnerGCContainer).show(),$("#"+e.config.templateName).tmpl(t).appendTo(_siteBuilderDetail.divInnerGCContainer),_common.setServiceCancelButtonMobile("btnCancelGC"),$("#txtMaxQuantity").applyupdown(),$(_siteBuilderDetail.divGiftCardContainer).addClass("inactive-gcflex");var i=Webflow.require("ix"),a=$(_siteBuilderDetail.divGiftCardContainer),r={type:"click",selector:_siteBuilderDetail.divGiftCardContainer,preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",x:"-150%",y:"0px",z:"0px"}],stepsB:[]};i.run(r,a),setTimeout(function(){var e=Webflow.require("ix"),t=$(_siteBuilderDetail.divInnerGCContainer),i={type:"click",selector:_siteBuilderDetail.divInnerGCContainer,preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",x:"0%",y:"0px",z:"0px"}],stepsB:[]};e.run(i,t)},100);var o=$("#GCspn"+e.config.Data.gcCategoryID).text();$("#spnGCcategoryName").html(o),$("#spnGCcategoryBack").focus(),$("#hdnGCcategoryName").val(o),$("#divBusinessfrom").html("From: "+FullUserName),"object"==typeof $(_siteBuilderDetail.ulGcImagesData).getSlick()&&$(_siteBuilderDetail.ulGcImagesData).unslick(),_siteBuilderDetail.strAddress.indexOf(_siteBuilderDetail.Contact)>0?$(_siteBuilderDetail.divaddress).html(_siteBuilderDetail.strAddress.substring(0,_siteBuilderDetail.strAddress.indexOf(_siteBuilderDetail.Contact))+"</br>"+_siteBuilderDetail.strAddress.substring(_siteBuilderDetail.strAddress.indexOf(_siteBuilderDetail.Contact))):$(_siteBuilderDetail.divaddress).html(""),$(_siteBuilderDetail.div_amount).html(""),$(_siteBuilderDetail.lblAmount).html(""),$(_siteBuilderDetail.divmessage).html(""),$(_siteBuilderDetail.spservice).html(""),$(_siteBuilderDetail.divfullname).html(""),$(_siteBuilderDetail.txtAmount).val(""),$(_siteBuilderDetail.txtmessage).val(""),$(_siteBuilderDetail.txtfullname).val(""),$(_siteBuilderDetail.txtGCEmail).val(""),$(_siteBuilderDetail.spcount).html("( 0 visit)"),$(_siteBuilderDetail.txtScheduleDate).val(""),$(_siteBuilderDetail.txtReciverPhoneNo).val(""),$("#divbusiness").html(businessName),$(_siteBuilderDetail.txtAmount).attr(_siteBuilderDetail.disabled,!1),$(_siteBuilderDetail.hdnServiceIDForGC).val(""),$(_siteBuilderDetail.hdnServiceTitleForGC).val(""),$(_siteBuilderDetail.hdnServicePriceForGC).val(""),$(_siteBuilderDetail.hdnServiceSessionDetailForGC).val(""),$(_siteBuilderDetail.txtMaxQuantity).val(1),$(_siteBuilderDetail.ddQuantity).hide(),$(_siteBuilderDetail.ulGcImagesData+" div").length>0&&$(_siteBuilderDetail.ulGcImagesData+" div").first().children().length>0&&_siteBuilderDetail.GCFirstImageload(t.GiftCardsImageList[0]),_common.ApplyEnScroll("#ulGcImagesData"),_siteBuilderDetail.GetGiftCeritficateExpireMonth(),null==t.GCLimitNote||String.isNullOrUndefineOrBlank(t.GCLimitNote)||($(_siteBuilderDetail.divgcLimitNote).html(t.GCLimitNote),$(_siteBuilderDetail.divgcLimitNote).show())}},_siteBuilderDetail.GCFirstImageload=function(e){$(_siteBuilderDetail.ulGcImagesData).find(_siteBuilderDetail.gcthumb).each(function(){$(this).removeClass(_siteBuilderDetail.active)}),$(_siteBuilderDetail.ulGcImagesData+" div").first().children().first().addClass(_siteBuilderDetail.active),_siteBuilderDetail.strAddress.indexOf(_siteBuilderDetail.Contact)>0?$(_siteBuilderDetail.divaddress).html(_siteBuilderDetail.strAddress.substring(0,_siteBuilderDetail.strAddress.indexOf(_siteBuilderDetail.Contact))+"</br>"+_siteBuilderDetail.strAddress.substring(_siteBuilderDetail.strAddress.indexOf(_siteBuilderDetail.Contact))):$(_siteBuilderDetail.divaddress).html(""),$(_siteBuilderDetail.gcpreview).css(_siteBuilderDetail.backgroundimage,"url("+e.GiftCertificatePhotoImg+")"),$(_siteBuilderDetail.gcpreview).attr(_siteBuilderDetail.dataphotoid,e.GiftCertificatePhotoID),$(_siteBuilderDetail.gcprintcont).css(_siteBuilderDetail.color,e.GCFontColor),applydatepicker({divid:_siteBuilderDetail.divScheduleDate,textid:_siteBuilderDetail.txtScheduleDate,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDateWithTime),parentID:_siteBuilderDetail.divScheduleDate,isMobileFriendly:!1,scrollMonth:!1,MinDate:new Date,MaxDate:new Date("2099-01-01"),yearEnd:(new Date).getFullYear()+76,pickTime:!0,formatTime:"h:mm A",callBackOnChange:_siteBuilderDetail.setMinmaxTimeOnDateChange,callBackOnHide:_siteBuilderDetail.setMinmaxTimeOnDateChange}),setdatepickervalue({divid:_siteBuilderDetail.divScheduleDate,textid:_siteBuilderDetail.txtScheduleDate,flagVgMultiMonthDatePicker:!0},"Send Now"),reciverPhoneNumber=$(_siteBuilderDetail.txtReciverPhoneNo).PhonePlugin({UserRole:2,ControlText:"Mobile Phone",CurrentLocationCountryID:void 0!==CountryID&&null!=CountryID?CountryID:_shopdetail.countryId,ScrollType:1})},_siteBuilderDetail.setScheduleStartDateTime=function(){$("#divEOptional").css("display","inline-block"),$("#divPNOptional").css("display","inline-block"),setdatepickervalue({divid:divScheduleDate,textid:_siteBuilderDetail.txtScheduleDate,flagVgMultiMonthDatePicker:!0},"Send Now")},_siteBuilderDetail.setMinmaxTimeOnDateChange=function(e){"Send Now"!=$("#txtScheduleDate").val()&&($("#divEOptional").css("display","none"),$("#divPNOptional").css("display","none"))},_siteBuilderDetail.setSendon=function(){String.isNullOrUndefineOrBlank($("#txtGCEmail").val())?($("#txtScheduleDate").prop("disabled",!0),setdatepickervalue({divid:_siteBuilderDetail.divScheduleDate,textid:_siteBuilderDetail.txtScheduleDate,flagVgMultiMonthDatePicker:!0},"Send Now")):$("#txtScheduleDate").prop("disabled",!1)},_siteBuilderDetail.GetGiftCeritficateExpireMonth=function(){Data={},Data.businessID=_siteBuilderDetail.businessID,Data.groupId=_siteBuilderDetail.SQLGroupID,vagaro.ajaxCall(ApiURLEnumGC.getgiftcertificateexpmonth,Data,_siteBuilderDetail.GCExpMonthCallback,_siteBuilderDetail.CommonError,!1,!0)},_siteBuilderDetail.HideServiceTab=function(){$(".gc-category-container").find("[data-w-tab='Tab 2']").hide()},_siteBuilderDetail.GCExpMonthCallback=function(e){if(null!==e&&""!==e&&($("#hdnExpireDate").val(e),null!=e&&""!==e)){let t=$("#hdnBusinessContryId").val();void 0!==t&&null!=t&&""!=t?$("#divexpried").html(countryDateFormat(e,VagaroCountryDateFormat.SmallDate,t)):$("#divexpried").html(moment(e).format("MMM-DD-YYYY"))}if(!1===_siteBuilderDetail.AllDetailCommon.BusinessDetail.IsServiceBasedGCEnabled&&_siteBuilderDetail.HideServiceTab(),""===_siteBuilderDetail.GCServiceList){if(Data={},Data.businessID=_siteBuilderDetail.businessID,Data.groupId=_siteBuilderDetail.SQLGroupID,Data.ServiceProviderID=null,Data.ShouldIncludeAddons=!0,_common.IsWidgetForServiceProvider(!0)){var t=_common.IsWidgetForServiceProvider(!1);Data.ServiceProviderID=t.toString()}if(_common.isCreateLinkPreserve(!0,!0)){t=_common.isCreateLinkPreserve(!1).join(",");Data.ServiceProviderID="-1"!=t?t:""}vagaro.ajaxCall(ApiURLEnumGC.bindsalonservicecomboforgc,Data,_siteBuilderDetail.BindServiceSuccess,_siteBuilderDetail.CommonError,!1,!0)}else _siteBuilderDetail.BindServiceSuccess(null)},_siteBuilderDetail.BindServiceSuccess=function(e){""===_siteBuilderDetail.GCServiceList&&null!==e&&(_siteBuilderDetail.GCServiceList=JSON.parse(e));var t={dropdownCssClass:"service-what-dropdown",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Select Service"};t.serviceList=_siteBuilderDetail.GCServiceList,t.FromGC=!0,t.selectAllText=$(_siteBuilderDetail.mobilecheck).is(_siteBuilderDetail.visible),t.scrollTop=$(_siteBuilderDetail.mobilecheck).is(_siteBuilderDetail.visible);new ctlrSearchService($(_siteBuilderDetail.txtSalonServicesForGC),t);0==_siteBuilderDetail.GCServiceList.results.length&&_siteBuilderDetail.HideServiceTab();var i={};i.businessID=businessID,i.loginUserID=UserID;var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumGC.bindcomboforgcdiscount,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=_siteBuilderDetail.GCDiscountCallback,a.datamodel.data=i,a.datamodel.Error=function(e){},a.Post()},_siteBuilderDetail.GCVPLText=function(e,t){if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&_siteBuilderDetail.isAffirmEnable)return $("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),$("#VPLImageBfr").css("display","none"),$("#dvservicemsg").css("display","none"),void $("#VPLImageaftr").css("display","none");var i=e;if(4==t)i=Number(e.replace(/[^0-9.-]+/g,""));if(_siteBuilderDetail.isAffirmEnable){const e="https://vagaro.azureedge.net/static/assets/new_affirm_logo2.png";$("#VPLImageaftr1 img, #VPLImageBfr1 img, #VPLImageBfr img, #VPLImageaftr img, #VPLStreamingEventImageaftr img").attr("src",e).addClass("AffirmImageLogo")}if(2==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.VPLStatus)if(3==t&&0==i&&null==i&&""===i&&""==$("#txtGCPromoAmount").val()&&""==$("#txtAmount").val()&&$("#tab_amount").trigger("click"))$("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),$("#VPLImageBfr").css("display","none"),$("#dvservicemsg").css("display","none"),$("#VPLImageaftr").css("display","none");else if(3==t||2==t||0!=i&&null!=i&&""!==i)if(1!=t&&3!=t&&4!=t||null==i||""==i||0==i){if(2==t&&null!=i&&""!=i&&0!=i){a=(a=i/4).toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,"),i<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount?($("#StreamingEventvplmsg").css("display","inline"),$("#StreamingEventvplmsg")[0].innerText=" or 4 payments of "+_shopdetail.currencySymbol+a+" with ",$("#VPLStreamingEventImageaftr").css("display","inline"),_siteBuilderDetail.isAffirmEnable&&($("#StreamingEventvplmsg")[0].innerText="Pay over time for orders of $"+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",$("#StreamingEventvplmsg").addClass("affirm-as-low-as"),$("#StreamingEventvplmsg").attr("data-page-type","product"),$("#StreamingEventvplmsg").attr("data-amount",Math.round(100*i)),$("#VPLStreamingEventImageaftr").css("display","none"),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?affirm.ui.refresh():$("#VPLStreamingEventImageaftr").css("display","block")),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&parseFloat(i)<parseFloat(_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount)&&$("#StreamingEventvplmsg").css("display","none")):($("#StreamingEventvplmsg").hide(),$("#VPLStreamingEventImageaftr").css("display","none")),$("#VPLStreamingEventImageBfr").css("display","none")}}else{var a;a=(a=i/4).toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,"),i<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount?($("#dvVPLGc").css("display","block"),$("#dvVPLGc")[0].innerText=" or 4 payments of "+_shopdetail.currencySymbol+a+" with ",$("#VPLImageaftr1").css("display","block"),_siteBuilderDetail.isAffirmEnable&&($("#dvVPLGc")[0].innerText="Pay over time for orders of $"+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",$("#dvVPLGc").addClass("affirm-as-low-as"),$("#dvVPLGc").attr("data-page-type","product"),$("#dvVPLGc").attr("data-amount",Math.round(100*i)),$("#VPLImageaftr1").css("display","none"),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?affirm.ui.refresh():$("#VPLImageaftr1").css("display","block")),!_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&parseFloat(i)<parseFloat(_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount)&&$("#dvVPLGc").css("display","none")):($("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none")),$("#VPLImageBfr1").css("display","none"),$("#VPLImageBfr").css("display","none"),$("#dvservicemsg").css("display","none"),$("#VPLImageaftr").css("display","none"),$("#VPLImageaftr1").attr("aria-label"," or 4 payments of "+_shopdetail.currencySymbol+a+" with vagaro pay later"),!_siteBuilderDetail.isAffirmEnable&&_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&parseFloat(i)<parseFloat(_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount)&&$("#VPLImageaftr1").css("display","none")}else $("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),$("#VPLImageBfr").css("display","none"),$("#dvservicemsg").css("display","none"),$("#VPLImageaftr").css("display","none"),$("#StreamingEventvplmsg").hide(),$("#VPLStreamingEventImageaftr").css("display","none"),$("#VPLStreamingEventImageBfr").css("display","none");else $("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),$("#VPLImageBfr").css("display","none"),$("#dvservicemsg").css("display","none"),$("#VPLImageaftr").css("display","none")},_siteBuilderDetail.GCDiscountCallback=function(e){if(e.length>0){e.keySort({Price:"asc",PriceAfterDiscount:"asc"});var t={dropdownCssClass:"service-what-dropdown service-commondrop service-book-drop",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,maxInputLen:10,placeholder:"Select or Enter Gift Card Amount"};t.collapasable=_shopdetail.VisibleControlLength("#mobile-check")>0,t.selectAllText=$("#mobile-check").is(":visible"),t.scrollTop=$("#mobile-check").is(":visible"),t.data=e,new _shopdetail.ApplySelect2Controls($("#txtGCPromoAmount"),t);var i="";if(void 0!==getCookie("gcAmount")&&""!=getCookie("gcAmount")&&(i=getCookie("gcAmount"),clearCookie("gcAmount")),""!=i){var a=$.extend(!0,[],e),r=_shopdetail.GetSelectedCGDetail(a,i);$("#txtGCPromoAmount").data("selecteddetail",JSON.stringify(r)),null!=r&&(_common.SetChoiceForSeleect2($("#txtGCPromoAmount"),r),$("#txtGCPromoAmount").select2("data",{id:r.id,text:r.text+" ("+r.promotext+")"}),$("#div_amount").html(("undefined"!=typeof currencySymbol&&null!=currencySymbol?currencySymbol:"")+r.Price.toFixed(2).replace(".00","")),_shopdetail.bindMobilefilterdata($("#txtGCPromoAmount"),r.id))}$("#txtAmount").hide(),$("#tab_PriceDropDown").show()}else $("#txtAmount").show(),$("#txtGCPromoAmount").select2("data",{id:"",text:""}),$("#tab_PriceDropDown").hide()},$(document).mouseup(function(e){var t=$(".gc-select-div");t.length>0&&(t.is(e.target)||0!==t.has(e.target).length||"select2-drop-mask"!=e.target.id&&$("#select2-drop").select2("close"))}),_siteBuilderDetail.SelectGiftcertificate=function(e){$(_siteBuilderDetail.ulGcImagesData).find(_siteBuilderDetail.gcthumb).each(function(){$(this).removeClass(_siteBuilderDetail.active)}),$(e).addClass(_siteBuilderDetail.active);var t=_siteBuilderDetail.strAddress;t.indexOf(_siteBuilderDetail.Contact)>0?$(_siteBuilderDetail.divaddress).html(t.substring(0,t.indexOf(_siteBuilderDetail.Contact))+"</br>"+t.substring(t.indexOf(_siteBuilderDetail.Contact))):$(_siteBuilderDetail.divaddress).html(""),$(_siteBuilderDetail.gcpreview).css(_siteBuilderDetail.backgroundimage,e.css(_siteBuilderDetail.backgroundimage)),$(_siteBuilderDetail.gcpreview).attr(_siteBuilderDetail.dataphotoid,e.attr(_siteBuilderDetail.dataphotoid)),$(_siteBuilderDetail.gcprintcont).css(_siteBuilderDetail.color,e.attr("data-fontcolor"))},_siteBuilderDetail.fnCheckUserEmail=function(e){try{var t=$("#txtGCEmail").val();void 0!==t&&""!==t.trim()&&$("#divRNameOptional").css("display","none"),void 0!==t&&""==t.trim()&&$("#divRNameOptional").css("display","inline-block")}catch(e){$("#divRNameOptional").css("display","inline-block")}GatherClickElement(e);var i=$(_siteBuilderDetail.txtfullname).val().trim(),a=$(_siteBuilderDetail.txtGCEmail).val().trim();""!=a&&"false"==EnableHiipaCompliant.toString().toLowerCase()&&(Data={},Data.UserEmail=a,Data.businessID=_siteBuilderDetail.businessID,Data.loginUserID=UserID,Data.groupId=_siteBuilderDetail.SQLGroupID,vagaro.ajaxCall(ApiURLEnumGC.getcustomernamebyemailid,Data,function(e){null!==e&&null!==e.FirstName&&""!==e.FirstName&&null!==e.LastName&&""!==e.LastName&&i.toLowerCase()!==e.FirstName.toLowerCase()+" "+e.LastName.toLowerCase()&&(""===i?($(_siteBuilderDetail.txtfullname).val(e.FirstName+" "+e.LastName),$(_siteBuilderDetail.txtfullname).trigger("keyup")):vagaro.alert("Our records indicate that the entered email address belongs to "+e.FirstName+" "+e.LastName.substring(0,1)+"... if this email was typed in incorrectly please change your entry to avoid assigning the gift card to the wrong person."))},_siteBuilderDetail.CommonError,!1,!0))},_siteBuilderDetail.OnFullNameChangeInGC=function(e){var t="To: ";t=""===$("#"+e[0].id).val()?"":"To: ",$(_siteBuilderDetail.divfullname).text(t+$("#"+e[0].id).val())},_siteBuilderDetail.OnMessageChangeInGC=function(e){$(_siteBuilderDetail.divmessage).text($("#"+e[0].id).val())},_siteBuilderDetail.OnAmountChangeForGC=function(e){$(_siteBuilderDetail.div_amount).html(("undefined"!=typeof currencySymbol&&null!=currencySymbol?currencySymbol:"")+$("#"+e[0].id).val()),_siteBuilderDetail.GCVPLText($("#"+e[0].id).val(),3)},_siteBuilderDetail.serviceQtyUp=function(e){var t=$(e),i=t.closest(_siteBuilderDetail.upDownArow).find(_siteBuilderDetail.txtMaxQuantity).val();if(i<99){var a=parseInt(i)+1;t.closest(_siteBuilderDetail.upDownArow).find(_siteBuilderDetail.txtMaxQuantity).val(a),_siteBuilderDetail.PriceUpdateGC()}},_siteBuilderDetail.serviceQtyDown=function(e){var t=$(e),i=t.closest(_siteBuilderDetail.upDownArow).find(_siteBuilderDetail.txtMaxQuantity).val();if(i>=2){var a=parseInt(i)-1;t.closest(_siteBuilderDetail.upDownArow).find(_siteBuilderDetail.txtMaxQuantity).val(a),_siteBuilderDetail.PriceUpdateGC()}},_siteBuilderDetail.PriceUpdateGC=function(){var e=$find(_siteBuilderDetail.txtMaxQuantity),t=e.val();if((""===t.trim()||"0"===t||isNaN(t))&&($("#txtAddtocartQuantity").val("1"),e.val("1"),t=1),t>1?$(_siteBuilderDetail.spcount).show().html(" ( "+t+" visits )"):$(_siteBuilderDetail.spcount).show().html(" ( "+t+" visit )"),""!==$(_siteBuilderDetail.hdnServiceSessionDetailForGC).val()){var i=parseFloat(_vgClassSessionSelection.CalcSessionPrice($(_siteBuilderDetail.hdnServiceSessionDetailForGC).val(),t,1,!0));i=parseFloat(i).toFixed(2),_shopdetail.setServicePrice(i)}else{var a=$(_siteBuilderDetail.hdnServicePriceForGC).val();if((""===t||"0"===t||isNaN(t))&&(e.val("1"),t=1),void 0!==a&&void 0!==t){var r=parseFloat(a)*parseFloat(t);r=parseFloat(r).toFixed(2),_shopdetail.setServicePrice(r)}}},_siteBuilderDetail.paytypeshow=function(e){$("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),$(_siteBuilderDetail.hdnServiceIDForGC).val(""),$(_siteBuilderDetail.hdnServiceSessionDetailForGC).val(""),$(".amountService").hide(),$(_siteBuilderDetail.spcount).hide(),$(_siteBuilderDetail.ddQuantity).hide(),e.indexOf("amount")>0?($(_siteBuilderDetail.tab_amount).addClass(_siteBuilderDetail.wcurrent),$(_siteBuilderDetail.tab_service).removeClass(_siteBuilderDetail.wcurrent),$(_siteBuilderDetail.tabscontent2).find("["+_siteBuilderDetail.datawtab+"='"+_siteBuilderDetail.tab1+"']").addClass(_siteBuilderDetail.wtabactive),$(_siteBuilderDetail.tabscontent2).find("["+_siteBuilderDetail.datawtab+"='"+_siteBuilderDetail.tab2+"']").removeClass(_siteBuilderDetail.wtabactive),activetabtype=1,$("#div_"+e.split("_")[1]).html("").show(),$(_siteBuilderDetail.txtSalonServicesForGCerrortext).hide(),$(_siteBuilderDetail.txtSalonServicesForGC).removeClass("errorInput"),$(_siteBuilderDetail.txtAmounterror).hide(),$(_siteBuilderDetail.txtAmount).val("").trigger(_siteBuilderDetail.click),$(_siteBuilderDetail.lblAmount).html(""),$(_siteBuilderDetail.txtAmount).attr(_siteBuilderDetail.disabled,!1),$("#txtGCPromoAmount").select2("data",{id:"",text:""}),$(_siteBuilderDetail.tab_amount).attr("aria-selected","true"),$(_siteBuilderDetail.tab_service).attr("aria-selected","false"),$("#txtAmount").attr("tabindex",-1).focus(),$("#dvVPLGc").css("display","none"),$("#VPLImageBfr1").css("display","none"),$("#VPLImageaftr1").css("display","none"),$("#dvservicemsg").css("display","none"),$("#VPLImageBfr").css("display","none"),$("#VPLImageaftr").css("display","none")):($("#dvVPLGc").css("display","none"),$("#VPLImageBfr1").css("display","none"),$("#VPLImageaftr1").css("display","none"),$("#dvservicemsg").css("display","none"),$("#VPLImageaftr").css("display","none"),$(_siteBuilderDetail.tab_service).addClass(_siteBuilderDetail.wcurrent),$(_siteBuilderDetail.tab_amount).removeClass(_siteBuilderDetail.wcurrent),$(_siteBuilderDetail.tabscontent2).find("["+_siteBuilderDetail.datawtab+"='"+_siteBuilderDetail.tab1+"']").removeClass(_siteBuilderDetail.wtabactive),$(_siteBuilderDetail.tabscontent2).find("["+_siteBuilderDetail.datawtab+"='"+_siteBuilderDetail.tab2+"']").addClass(_siteBuilderDetail.wtabactive),activetabtype=2,$("#div_"+e.split("_")[1]).show(),$(_siteBuilderDetail.spservice).html(""),$(_siteBuilderDetail.txtSalonServicesForGC).select2(_siteBuilderDetail.data,{id:"",text:""}),$(_siteBuilderDetail.txtAmounterror).hide(),$(_siteBuilderDetail.txtAmount).attr(_siteBuilderDetail.disabled,!0),$(_siteBuilderDetail.txtAmount).removeClass(_siteBuilderDetail.errorInput),$(_siteBuilderDetail.txtAmount).removeClass(_siteBuilderDetail.errorInput),$(_siteBuilderDetail.txtMaxQuantity).val(1),$(".txtAmounterrortext").hide(),$("#txtGCPromoAmount").removeClass("errorInput"),$(_siteBuilderDetail.tab_service).attr("aria-selected","true"),$(_siteBuilderDetail.tab_amount).attr("aria-selected","false"),$("#tab_serviceDropDown").attr("tabindex",-1).focus(),$("#dvservicemsg").hide(),$("#VPLImageaftr").css("display","none"),$("#VPLImageBfr").css("display","none"))},_siteBuilderDetail.txtAmountOnblur=function(e){return""===$(e).val()?($("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),!1):0==isNaN($(e).val())&&parseFloat($(e).val())>999999?($(e).val(""),$("#div_amount").html(""),$("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),!1):!1===isNaN($(e).val())&&$(e).val().indexOf(".")>0&&($(e).val(parseFloat($(e).val()).toFixed(2)),$("#div_amount").html(("undefined"!=typeof currencySymbol&&null!=currencySymbol?currencySymbol:"")+$(e).val()),$("#dvVPLGc").hide(),$("#VPLImageaftr1").css("display","none"),$("#VPLImageBfr1").css("display","none"),!0)},_siteBuilderDetail.dvMembershipContainer="#dvMembershipContainer",_siteBuilderDetail.dvPackageContainer="#dvPackageContainer",_siteBuilderDetail.PackageTemplateName="#dvPackageTemplate",_siteBuilderDetail.MembershipTemplateName="#dvMembershipTemplate",2==_siteBuilderDetail.vgAppicationType&&(_siteBuilderDetail.MembershipTemplateName="#dvMemebershipsTemplateCheckIn");var ApiURLEnumMsPkg={getmembershipandpackagebybusinessid:ApiPath+"getmembershipandpackagebybusinessid"};_siteBuilderDetail.GetBusinessMembershipComponent=function(e){if("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("memberships"),!IsNewCustomWebsite||_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData(e,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,"memberships")){if(2==MembershipPackageType)return $(e).html(""),void $(_siteBuilderDetail.componentInfo[11]).hide();if(null!=_siteBuilderDetail.ComponentResponse.lstMembership)_siteBuilderDetail.GetBusinessMembershipSuccess(_siteBuilderDetail.ComponentResponse.lstMembership,e);else if("undefined"!=typeof isBotCrawler&&0==isBotCrawler){var t={businessID:_shopdetail.businessID,loginUserID:UserID,pageIndex:1,pageSize:null,type:1},i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumMsPkg.getmembershipandpackagebybusinessid,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){var i=getCookie("Referral");$.each(t,function(e,a){void 0!==i&&""!=i&&null!=i||1==t[e].IsDailyDealApply&&(t[e].promotionDetail="",t[e].PromotionTitle="")}),_siteBuilderDetail.GetBusinessMembershipSuccess(t,e)},i.datamodel.data=t,i.datamodel.Error=CallFail_LoadUserControlWithProxy,i.Post()}}},_siteBuilderDetail.GetBusinessMembershipSuccess=function(e,t){e=_siteBuilderDetail.SetDataForMaxDiscount(e),_siteBuilderDetail.ComponentResponse.lstMembership=e,DisplayFullView(!1),$(t).html($("#dvMembershiphtmlTemplate").html()),0!=$(_siteBuilderDetail.dvMembershipContainer).length?0==e.length?void 0!==_siteBuilderDetail.isRequestFromVagaro&&"true"!=_siteBuilderDetail.isRequestFromVagaro?$(res.componentnode).html("<div class='not-access-modual'><h1> You do not have access to this module.</h1></div>"):$(_siteBuilderDetail.componentInfo[11]).hide():$(_siteBuilderDetail.MembershipTemplateName).tmpl(e).appendTo(_siteBuilderDetail.dvMembershipContainer):$(_siteBuilderDetail.MembershipTemplateName).tmpl(e).appendTo($("#iframe1").contents().find("body").find(_siteBuilderDetail.dvMembershipContainer)),_siteBuilderDetail.RemoveSpace()},_siteBuilderDetail.convertdecimalclientside=function(e){var t=parseFloat(e);return t%1==0?t.toFixed(0):t.toFixed(2)},_siteBuilderDetail.GetBusinessPackageComponent=function(e){if(!IsNewCustomWebsite||_siteBuilderDetail.CheckCartRquiredForLoadMenuClickData(e,_siteBuilderDetail.UserLocationInfo.objDynamicMenuData,"memberships")){if(1==MembershipPackageType)return $(e).html(""),void $(_siteBuilderDetail.componentInfo[12]).hide();if(null!=_siteBuilderDetail.ComponentResponse.lstPackage)_siteBuilderDetail.GetBusinessPackageSuccess(_siteBuilderDetail.ComponentResponse.lstPackage,e);else if("undefined"!=typeof isBotCrawler&&0==isBotCrawler){var t={businessID:_shopdetail.businessID,loginUserID:UserID,pageIndex:1,pageSize:null,type:2},i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumMsPkg.getmembershipandpackagebybusinessid,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){var i=getCookie("Referral");$.each(t,function(e,a){void 0!==i&&""!=i&&null!=i||1==t[e].IsDailyDealApply&&(t[e].promotionDetail="",t[e].PromotionTitle="")}),_siteBuilderDetail.GetBusinessPackageSuccess(t,e)},i.datamodel.data=t,i.datamodel.Error=CallFail_LoadUserControlWithProxy,i.Post()}}},_siteBuilderDetail.GetBusinessPackageSuccess=function(e,t){DisplayFullView(!1),e=_siteBuilderDetail.SetDataForMaxDiscount(e),_siteBuilderDetail.ComponentResponse.lstPackage=e,$(t).html($("#dvPackagehtmlTemplate").html()),0!=$(_siteBuilderDetail.dvPackageContainer).length?0==e.length?void 0!==_siteBuilderDetail.isRequestFromVagaro&&"true"!=_siteBuilderDetail.isRequestFromVagaro?$(res.componentnode).html("<div class='not-access-modual'><h1> You do not have access to this module.</h1></div>"):$(_siteBuilderDetail.componentInfo[12]).hide():$(_siteBuilderDetail.PackageTemplateName).tmpl(e).appendTo(_siteBuilderDetail.dvPackageContainer):$(_siteBuilderDetail.PackageTemplateName).tmpl(e).appendTo($("#iframe1").contents().find("body").find(_siteBuilderDetail.dvPackageContainer)),_siteBuilderDetail.RemoveSpace()},_siteBuilderDetail.SetDataForMaxDiscount=function(e){return jQuery.each(e,function(t,i){var a=!1;""!=i.promotionDetail&&(a=i.promotionDetail.split("-")[5]>0);if(""!=i.promotionDetail&&(1==i.IsInitialDiscount||1==a)){var r,o=i.BillingCycle;r=i.Charge.includes?i.Charge.split("/")[0]:i.Charge;var n=i.InitialDiscount,s=i.IsAmount,l=[],d=[];l.push({BillingCycle:o,Charge:r,InitialDiscount:n,IsAmount:s});var c=i.promotionDetail.split("-");d.push({BillingCycle:c[5],Charge:r,InitialDiscount:c[2],IsAmount:c[1]});var u=_siteBuilderDetail.GetDiscountAmount(d),p=_siteBuilderDetail.GetDiscountAmount(l);parseFloat(p)<parseFloat(u)?(i.PromotionTitle="",i.promotionDetail=""):(i.BillingCycle=c[5],i.IsInitialDiscount=!1,i.IsAmount=!1,i.InitialDiscount=0)}e[t]=i}),e},_siteBuilderDetail.LoadComponentDetails_deals=function(){window.location.pathname.replace(/^\//,"").split("/");if(!0===_siteBuilderDetail.isFirstTimeLoad){var e=$("body").find(".pagebodycontainer").find("vg-custom-component");_siteBuilderDetail.loadFrameComponent(e);var t=TitleTimesTamp.split("-"),i=t[t.length-1];_siteBuilderDetail.DailyDealsDetail(i)}},_siteBuilderDetail.DailyDealsDetail=function(e,t,i){(_common.ScrollToToZero(),null!=i)&&(_common.AddState(t+"dealsindividual"+e+"&&"+parseInt(_siteBuilderDetail.businessID))&&i.preventDefault());ShowLoader(!0),$("#mobile-check").is(":visible")&&$("#divBookNowMasterPage").length&&$("#divBookNowMasterPage").is(":visible")&&$("#divBookNowMasterPage").hide(),$("#dvDailyDealsDetail").html(""),""!=$("#dvDailyDealsDetail").html()&&null!=$("#dvDailyDealsDetail").html()||($("#hdnPromotionId").val(e),$("#dvDailyDealsDetail").show(),$("#dvDailyDealsDetail").html(""),_siteBuilderDetail.LoadDailyDealControl(e))},_siteBuilderDetail.LoadDailyDealControl=function(e){Data={},Data.UserControlPath="~/UserControls/ucDailyDealsDetail.ascx",Data.PageNamePath="~/Home.aspx",Data.isRemoveFormTag=!1,Data.Parameters={PromotionID:e,BusinessId:_siteBuilderDetail.businessID,IsCustomWebsite:void 0!==_siteBuilderDetail.IsCustomWebsite&&null!=_siteBuilderDetail.IsCustomWebsite?_siteBuilderDetail.IsCustomWebsite:"false",PromotionCodeId:"undefined"!=typeof promotionCodeId&&null!=promotionCodeId?promotionCodeId:""},void 0!==_siteBuilderDetail.UserLocationInfo.IsLoadDailyDealPage&&null!=_siteBuilderDetail.UserLocationInfo.IsLoadDailyDealPage&&1==_siteBuilderDetail.UserLocationInfo.IsLoadDailyDealPage&&(Data.Parameters.titletimestamp=TitleTimesTamp,Data.Parameters.vagaroURL=vagaroUrl,void 0!==_siteBuilderDetail.UserLocationInfo.DealTimeStamp&&null!=_siteBuilderDetail.UserLocationInfo.DealTimeStamp&&""!=_siteBuilderDetail.UserLocationInfo.DealTimeStamp&&(Data.Parameters.dealtimestamp=_siteBuilderDetail.UserLocationInfo.DealTimeStamp)),vagaro.ajaxCall(ApiURLEnumCommon.loadusercontrol,Data,_siteBuilderDetail.LoadDailyDealControl_Success,_siteBuilderDetail.LoadDailyDealControl_Error,!1,!0)},_siteBuilderDetail.LoadDailyDealControl_Success=function(e){var t=$("#dvDailyDealsDetail");t.html(""),t.append(e),lazyloadDeal(),$(".component-pagesection").hide(),$(".pagebodycontainer").hide(),setTimeout(function(){$(".lazy").lazyload({threshold:200,effect:"fadeIn",failure_limit:50,event:"lazyload"}).trigger("lazyload")},500),_siteBuilderDetail.LoadSocialMediaIcon(_siteBuilderDetail.UserLocationInfo.Model,!0)},_siteBuilderDetail.LoadDailyDealControl_Error=function(e){ShowLoader(!1);try{var t=JSON.parse(e.userControlContent);vagaro.alert(t.Message)}catch(e){vagaro.alert("Something went wrong, Try Again.")}},_siteBuilderDetail.GetDiscountAmount=function(e){return"0"!=e[0].IsAmount?_siteBuilderDetail.convertdecimalclientside(parseFloat(parseFloat(e[0].Charge)-parseFloat(e[0].InitialDiscount)).toFixed(2)):_siteBuilderDetail.convertdecimalclientside(parseFloat(parseFloat(e[0].Charge)-parseFloat(e[0].Charge)*parseFloat(e[0].InitialDiscount)/100).toFixed(2))},_siteBuilderDetail.replaceFrequency=function(e){var t="",i="",a="";switch(e.trim().split("/").length>1&&(a=e.trim().split("/")[1]),a){case"Weekly":t="Weekly",i="/Week";break;case"Monthly":t="Monthly",i="/Month";break;case"Quarterly":t="Quarterly",i="/Quarter";break;case"Yearly":t="Yearly",i="/Year";break;case"":a="";break;default:a="/"+a}return""!=a?_siteBuilderDetail.getReplaceString(a,t,i):""},_siteBuilderDetail.getReplaceString=function(e,t,i){return t.length>0?e.replace(t,i):e},_siteBuilderDetail.convertdecimalclientsidestring=function(e){return _siteBuilderDetail.convertdecimalclientside(e).toString()},_siteBuilderDetail.RemoveSpace=function(){$(".clsremovspace").each(function(e){var t=$(this).html().trim(),i=t.split("/"),a=(i.length>1?i[0].trim()+"/"+i[1].trim():t).replace('<div aria-hidden="true">',"").replace("<","").replace("/div>","");$(this).attr("aria-label",a.replace("/"," per ")).attr("role","banner"),$(this).html('<div aria-hidden="true">'+a+"</div>")})},CommonFromPageForShopDetail="ShopDetail",DefaultBanner="https://vagaro.azureedge.net/static-content/Images/detail-banner-default-img.jpg",SalonsAvailableDates="";var ZenSwipeCardDetails,newserviceproviderforwidget,tipOnItems,dayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayFullNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"],monthShortNames=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],PromotionDetails=[],MembershipPackageDetails=null,FamilyFriendsMembershipPackage=null,onlineShoppingCartmainPrepay=[],isCCChanged=!1,IsPaid="False",gNeedAcceptance=!1,OnlindBookingResponse=null,OnlindBookingResponseForClass=null,ClassTabName="classes",BookTabName="book-now",liveServiceTime=[],isClassCalledFromStaff=!1,ClassKeyWord="Class",ClassKeyWordPlural="Classes",IsFormApplicableUserArr=[],IsDateAdded=!1,IsBundle=null,glbBundleId=0,stateList={},selectedCountryId=0,selectedAddressData={},FinalCCAmount=0,SaveCheckoutVPL={},isCheckoutServiceVPLChanged=!1,intentId="",PromocodeApply="",AddOnServiceDetail=[],IsAddOnCount=0,SelectedAddonService=[],IsBackAddOnCount=0,AddonServiceBundleDetail=[],AddonServiceBundleDetailBookNow=[],ServiceDataList=[],OldccAmt=0,ShoppingCartMembershipsList=[],SBCancellationPolicy="",ReschedualAddonService=[],DepositPaidTotalForUpshell=0,IsFromServiceBookNow=!1,CustomerOldAddress="",IsOnboardingAppCount=0,IsnotfullyPrePay=!1,IsPartialPointAllowed=!1,IsNewAddressHtml=!1,paymentCardOnFile=!1,isWidgetLoaded=!1,isrebookfunctionchange=!1,isDepositOff=!1,totalDailyDealFeeOfAllCart_ABS=0,ischkFirstTimeCustomer=null,FMBPercentage=0,LastMinuteBookedMap={},onlineAppointmentBookingReq="",LastMinuteBookingDays=function(){try{var e=document.getElementById("hdnLastMinuteBookingWindowHours"),t=e?parseInt(e.value,10):NaN;return t>0?t:3}catch(e){return 3}}(),countryEnum=(tipType="percentage",ApiPath="websiteapi/homepage/",{US:1,UK:2,CA:3,AU:4}),V2APIURLEnumNew={availabledates:"availabledates"},PaymentMethod={GooglePay:1,ApplePay:2},timeZoneOffSetArrayBooking=[{Id:-12,AbbrivationName:"AoE",DayLightAbbrivationName:"AoE",TimeZoneId:"Dateline Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-11,AbbrivationName:"SST",DayLightAbbrivationName:"SST",TimeZoneId:"UTC-11",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-10,AbbrivationName:"HST",DayLightAbbrivationName:"HDT",TimeZoneId:"Hawaiian Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-9,AbbrivationName:"ADT",DayLightAbbrivationName:"AKDT",TimeZoneId:"Alaskan Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-8,AbbrivationName:"PST",DayLightAbbrivationName:"PDT",TimeZoneId:"Pacific Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-7,AbbrivationName:"MST",DayLightAbbrivationName:"MDT",TimeZoneId:"US Mountain Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-7,AbbrivationName:"MST",DayLightAbbrivationName:"MDT",TimeZoneId:"Mountain Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!0},{Id:-6,AbbrivationName:"CST",DayLightAbbrivationName:"CDT",TimeZoneId:"Central Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-5,AbbrivationName:"EST",DayLightAbbrivationName:"EDT",TimeZoneId:"Eastern Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-4,AbbrivationName:"AST",DayLightAbbrivationName:"ADT",TimeZoneId:"Atlantic Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-3.5,AbbrivationName:"NST",DayLightAbbrivationName:"NDT",TimeZoneId:"Newfoundland Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:10,AbbrivationName:"ChST",DayLightAbbrivationName:"ChST",TimeZoneId:"West Pacific Standard Time",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:12,AbbrivationName:"WAKT",DayLightAbbrivationName:"WAKT",TimeZoneId:"UTC+12",CountryId:countryEnum.CA,IsSupportDayLight:!1},{Id:-12,AbbrivationName:"AoE",DayLightAbbrivationName:"AoE",TimeZoneId:"Dateline Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-11,AbbrivationName:"SST",DayLightAbbrivationName:"SST",TimeZoneId:"UTC-11",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-10,AbbrivationName:"HST",DayLightAbbrivationName:"HDT",TimeZoneId:"Hawaiian Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-9,AbbrivationName:"ADT",DayLightAbbrivationName:"AKDT",TimeZoneId:"Alaskan Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-8,AbbrivationName:"PST",DayLightAbbrivationName:"PDT",TimeZoneId:"Pacific Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-7,AbbrivationName:"MST",DayLightAbbrivationName:"MDT",TimeZoneId:"US Mountain Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-7,AbbrivationName:"MST",DayLightAbbrivationName:"MDT",TimeZoneId:"Mountain Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!0},{Id:-6,AbbrivationName:"CST",DayLightAbbrivationName:"CDT",TimeZoneId:"Central Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-5,AbbrivationName:"EST",DayLightAbbrivationName:"EDT",TimeZoneId:"Eastern Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-4,AbbrivationName:"AST",DayLightAbbrivationName:"ADT",TimeZoneId:"Atlantic Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:10,AbbrivationName:"ChST",DayLightAbbrivationName:"ChST",TimeZoneId:"West Pacific Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:12,AbbrivationName:"WAKT",DayLightAbbrivationName:"WAKT",TimeZoneId:"UTC+12",CountryId:countryEnum.US,IsSupportDayLight:!1},{Id:-8,AbbrivationName:"PST",DayLightAbbrivationName:"PST",TimeZoneId:"UTC-08",CountryId:countryEnum.UK,IsSupportDayLight:!1},{Id:-3,AbbrivationName:"FKST",DayLightAbbrivationName:"FKST",TimeZoneId:"E. South America Standard Time",CountryId:countryEnum.UK,IsSupportDayLight:!1},{Id:-2,AbbrivationName:"GST",DayLightAbbrivationName:"GST",TimeZoneId:"UTC-02",CountryId:countryEnum.UK,IsSupportDayLight:!1},{Id:0,AbbrivationName:"GMT",DayLightAbbrivationName:"BST",TimeZoneId:"GMT Standard Time",CountryId:countryEnum.UK,IsSupportDayLight:!1},{Id:2,AbbrivationName:"CEST",DayLightAbbrivationName:"CEDT",TimeZoneId:"South Africa Standard Time",CountryId:countryEnum.UK,IsSupportDayLight:!1},{Id:6,AbbrivationName:"IOT",DayLightAbbrivationName:"IOT",TimeZoneId:"Central Asia Standard Time",CountryId:countryEnum.UK,IsSupportDayLight:!1},{Id:6.5,AbbrivationName:"CCT",DayLightAbbrivationName:"CCT",TimeZoneId:"Myanmar Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:7,AbbrivationName:"CXT",DayLightAbbrivationName:"CXT",TimeZoneId:"SE Asia Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:8,AbbrivationName:"AWST",DayLightAbbrivationName:"AWST",TimeZoneId:"W. Australia Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:8.75,AbbrivationName:"ACWST",DayLightAbbrivationName:"ACWST",TimeZoneId:"Aus Central W. Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:9.5,AbbrivationName:"ACST",DayLightAbbrivationName:"ACDT",TimeZoneId:"Cen. Australia Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:10,AbbrivationName:"AEST",DayLightAbbrivationName:"AEDT",TimeZoneId:"E. Australia Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:10.5,AbbrivationName:"LHST",DayLightAbbrivationName:"LHDT",TimeZoneId:"Lord Howe Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:11,AbbrivationName:"NFT",DayLightAbbrivationName:"NFT",TimeZoneId:"Norfolk Standard Time",CountryId:countryEnum.AU,IsSupportDayLight:!1},{Id:5.5,AbbrivationName:"IST",DayLightAbbrivationName:"Asia/Kolkata",TimeZoneId:"India Standard Time",CountryId:countryEnum.US,IsSupportDayLight:!1}],istipchanges=!1,nothanksselected=!0,promocodenewmessage_ticket=!1,ApiURLEnumBooking={getonlinebookingtabdetail:ApiPath+"getonlinebookingtabdetail",LoadUserControl:ApiPath+"loadusercontrol",getavailabledatesforevents:ApiPath+"getavailabledatesforevents",getavailablemultievents:ApiPath+"getavailablemultievents",getavailabledates:"getavailabledates",getstatesbycountryid:"getstatesbycountryid",getuserccdetailsbyonlyuserid:"getuserccdetailsbyonlyuserid",validatepromocodeandgetdetails:"validatepromocodeandgetdetails",getvalidatepromotionsdetails:"getvalidatepromotionsdetails",getbookrequestbuttontext:ApiPath+"getbookrequestbuttontext",getallpromotiondetailsbybusinessid:"promotion/getallpromotiondetailsbybusinessid",checkuserexistsbyuserid:ApiPath+"checkuserexistsbyuserid",getformsbyids:ApiPath+"getformsbyids",getservicepricebyserviceid:ApiPath+"getservicepricebyserviceid",updateformresponse:ApiPath+"updateformresponse",geteventcustomertimezonedate:ApiPath+"geteventcustomertimezonedate",saveuserccdetails:ApiPath+"saveuserccdetails",getState:"myaccount/getstatesbymultiplecountryid",getStateCode:"myaccount/GetCityByZipCodeWithStatecode",getuservplaccountdetail:"VagaroPayLater/getuservplaccountdetail",GetAddOnService:"addonservice/getaddonservice",GetMembershipList:"AddOnService/getmembershiplist",GetAllAddOnServiceByBusinessNew:"addonservice/getalladdonservicebybusinessnew",gcpromocodelimt:"myaccount/gcpromocodelimt",getgcpromocodelimt:"myaccount/getgcpromocodelimt",GetMembershipOrPackageRequiredToBook:"limitonlinebooking/getmembershiporpackagerequiredtobook",GetMembershipOrPackageRequiredToBookFamilyFriends:"limitonlinebooking/getmembershiporpackagerequiredtobookfamilyfriends",GetEmployeesNotAcceptingNewClients:"limitonlinebooking/getemployeesnotacceptingnewclients",GetUserAndFnFNewOrExistingForBusinessEmployees:"limitonlinebooking/getuserandfnfneworexistingforbusinessemployees",GetPhotoGalleryService:"AddOnService/getphotogelleryservice",GetMultiHouseCall:"appointment/getmultihousecallservice",GetPreAndPostOutForHousecall:"appointment/getpreandpostoutforhousecall",GetWidgetuserdetails:"widget/formsuser"},isReviewLoadFirstTime=0,BusinessBookingDetail="";"undefined"==typeof _IsPrepay&&(_IsPrepay=!1),"undefined"==typeof _CCDetailCardOnFile&&(_CCDetailCardOnFile={});var SelectedBank,arrEventType={ServiceBundle:5,Service:1,Class:2},arrPaymentTitleType={Default:"Payment Information",HoldOnCard:"Credit Card Required to Secure Your Reservation",Deposits:"This Business Requires a Deposit:"},arrpaidType={UnPaid:0,Paid:1,Deposits:2,PartiallyPaid:3},ApplyDiscoutTypePrepay={NoDiscount:0,Package:1,GC:2,Points:4,Membership:3,OnePerDealDiscount:5,OutsideBiling:6,ServcieMembershipAddon:7,ServciePackageAddon:8,PointsAddon:9},CheckoutBarcodeCodePrepay={srvc:"srvc",GC:"GC",Pkg:"Pkg",IOU:"IOU",MS:"MS",CLS:"CLS",srvcGC:"SrvcGC",Fee:"Fee",addon:"addon",Point:"point",dailyDealFee:"dailyDealFee"},PaymentOptionText={TextPkg:"Use Package Visit - ",TextMS:"Use Membership Visit - ",TextGC:"Use Gift Card - ",TextPoint:"Points Balance - "},CheckoutTypePrepay={Service:1,Product:2,GiftCertificate:3,IOU:4,Membership:7,Class:8,IOUCleared:9,Package:15,Fee:18,ServiceAddons:19,VCFee:21,DailyDealFee:28},ApplyVCFFeeSource={OnLoad:1,ApplyTip:2,RemoveDiscount:3,ApplyGC:4,ApplyPromoCode:5,ChangeFamily:6,PackageUpSell:7,MembershipUpSell:8,CCChange:9},istabnavDivShow=(JSAdjustEventToken={app_launch_eventtoken:"2id34i",live_stream_class_joined_eventtoken:"kc0pbs",book_service_completed_eventtoken:"x169tw",request_service_completed_eventtoken:"tkefoi",marketplace_login_completed_eventtoken:"ml21u5",marketplace_signup_completed_eventtoken:"66jk7q",class_booking_completed_eventtoken:"qrwhm8",add_to_cart_eventtoken:"kgy2fi",product_purchased_completed_eventtoken:"t0i4z2",class_booking_requested_eventtoken:"1ect6c",gift_card_purchase_completed_eventtoken:"i4dswc",membership_purchase_completed_eventtoken:"hn11mn",package_purchase_completed_eventtoken:"etim0e"},JSAdjustEventName={app_launch:"app_launch",live_stream_class_joined:"live_stream_class_joined",book_service_completed:"book_service_completed",request_service_completed:"request_service_completed",marketplace_login_completed:"marketplace_login_completed",marketplace_signup_completed:"marketplace_signup_completed",class_booking_completed:"class_booking_completed",add_to_cart:"add_to_cart",product_purchased_completed:"product_purchase_completed",class_booking_requested:"class_booking_requested",gift_card_purchase_completed:"gift_card_purchase_completed",membership_purchase_completed:"membership_purchase_complete",package_purchase_completed:"package_purchase_completed"},ShowVPLNoOfPayment={Hide:0,Show:1},!1),istopBannerSectionDivShow=!1,isdivSearchDivShow=!1,isdivClassAppResultDivShow=!1,isdivCustomMessageDivShow=!1,isfooterdivDivShow=!1,ispushdivDivShow=!1,ReviewPhotoArray=[],BusSavedCard={},ObjBankDetail={},VPLCheckoutData={},VplSelectedBank={};WaitlistDate=null;var UnderMaintanance={UnderMaintananceInProgress:"-9",UnderMaintananceComplete:"-10"},UnderMaintananceMessage="Business is Under Maintenance. This won't take long",isClassSelected="False";"undefined"==typeof $find&&($find=function(e){return $(e)});var filpkglist={},objVPLData=null,isCustomerCityExists=!1,isCcCaptureRequired=!1,isChangeServiceClicked=!1,isFinalBookClicked=!1,bkEventTimeZone=function(){var e={};return{buildKey:function(e){return JSON.stringify(e)},getResponseFromCache:function(t){return t&&e[t]?e[t]:null},addResponseToCache:function(t,i){t&&(e[t]=i)},clearCache:function(){e={}}}}();function LoadFamilyFriendDDLEvents(){$(".familycktfrndlist").on("click",".init",function(){$(this).closest(".familycktfrndlist").children(".familycktfrndlistblok:not(.init)").toggle()}),$(".familycktfrndlist").on("click",".familycktfrndlistblok:not(.init)",function(){$("#aCheckoutTip").hide(),$("#divfinalCheckoutTipAmount").hide(),$("#txtOnlineCustomerTipCurrencySymbol").text(_shopdetail.BookingDetail.CurrencySymbol),$("#txtOnlineCustomerTip").val("0.00"),$("#divfinalCheckoutTipAmount").html(_shopdetail.BookingDetail.CurrencySymbol+"0.00"),$("#divTipSelectionList .tip-tab").removeClass("active"),_shopdetail.BookingDetail.TipAmount=0,_shopdetail.BookingDetail.TipPercent=0;var e=$(".familycktfrndlist").children(".familycktfrndlistblok:not(.init)");if(null!=$(this).attr("id")&&"addffuserlink"==$(this).attr("id"))void 0!==$("ul#FFlistingOnlineAppBook li.familycktfrndlistblok:eq(1)").data("value")&&null!=$("ul#FFlistingOnlineAppBook li.familycktfrndlistblok:eq(1)").data("value")?AppBookLoggedInUserId=$("ul#FFlistingOnlineAppBook li.familycktfrndlistblok:eq(1)").data("value"):AppBookLoggedInUserId=0,_sharing.BusinessID=AppBookBusinessID,_sharing.isLoadCustFromDB=AppBookisLoadCustFromDB,_sharing.syncDuration=AppBooksyncDuration,_sharing.IsDisableAutoFillFromInputBox=AppBookIsDisableAutoFillFromInputBox,_sharing.defaultYear=AppBookdefaultYear,_sharing.parentPage="OnlineAppointment",_sharing.FFMasterUserId=AppBookLoggedInUserId,_sharing.FFMasterUserFullName=FullUserName,_sharing.LoggedInUserId=AppBookLoggedInUserId,_sharing.VagaroYearsTaken=AppBookVagaroYearsTaken,_sharing.CountryId=AppBookCountryId,$("#addnewffpopup").show(),_sharing.AddErrorHideClassforFFSharing(!0),$(".span-masteruser-fullname").html(FullUserName),_sharing.BindYearandWeight(),e.toggle();else{$("#addnewffpopup").hide(),e.removeClass("selected").attr("aria-selected",!1),$(this).addClass("selected").attr("aria-selected",!0),$(".familycktfrndlist").children(".init").html($(this).html()),$(".familycktfrndlist").children(".init").find(".fficons").css("display","block"),e.toggle(),$("#lblSPWaitlist1").attr("tabindex",-1).attr("role","contentinfo").focus();var t=$(".familycktfrnd ul li.selected").data("value"),i=$(".familycktfrnd ul li.selected").data("encryptuserid"),a=$("<XMLDocument/>");a.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",1)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(var r=0;r<_shopdetail.BookingDetail.serviceid.split(",").length;r++){var o=_vgClassSessionSelection.createXmlElement("n",_shopdetail.BookingDetail.serviceid.split(",")[r]);a.find("ns").append(o)}for(var n=0;n<SelectedAddonService.length;n++)for(var s=0;s<_shopdetail.BookingDetail.serviceid.split(",").length;s++)if(SelectedAddonService[n].MainServiceID==_shopdetail.BookingDetail.serviceid.split(",")[s])for(var l=0;l<SelectedAddonService[n].lstAddonService.length;l++){var d=_vgClassSessionSelection.createXmlElement("n",SelectedAddonService[n].lstAddonService[l].ServiceId);a.find("ns").append(d)}var c=0;if("undefined"!=typeof isWaitingtoreal&&"undefined"!=typeof waitlistID&&0!=isWaitingtoreal&&0!=waitlistID&&(c=waitlistID),void 0!==t&&t>0){var u={};u.lBusinessID=$("#hdnBusinessID").val(),u.isOutcall=_shopdetail.BookingDetail.isoutcall,u.lUserID=t,u.EncryptUserId=i,u.ServiceId=_shopdetail.BookingDetail.serviceid,u.IsPaid=IsPaid,u.ServiceList=a.html(),u.WaitlistID=c,u.ServiceDate=_shopdetail.BookingDetail.date;var p=new vagaro.ajax;p.datamodel.Token="GetDiscountDetailofUserToBookApp",p.datamodel.data=[u],p.datamodel.callback=function(e){_shopdetail.GetDiscountDetailofUserToBookAppResponse(e,0)},p.datamodel.Error=function(e){_shopdetail.HideShowLoader(!1)},p.Post(),_shopdetail.ValidateAndGetFormDetailsforFFSharing()}}})}function ShoppingCartIconClick(e){if(_siteBuilderDetail.IsShowNewadd=!0,null!=typeof getQueryStringData){String.isNullOrUndefineOrBlank($("#hdnLoginQueryString").val())||(QueryStringValue=$("#hdnLoginQueryString").val()),String.isNullOrUndefineOrBlank(QueryStringValue)&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL);var t=getQueryStringData("Type"),i=getQueryStringData("wgVal");"Builder"==t&&null!=i&&""!=i&&(widgetcookievalue=i)}var a=!!$("#mobileBack").is(":visible");if(_shopdetail.VisibleControlLength("#mobile-check")>0&&"undefined"!=typeof _vgWaitlist&&$("#"+_vgWaitlist.model.divWaitlistpopup).length>0&&1==$("#"+_vgWaitlist.model.divWaitlistpopup).is(":visible")&&_vgWaitlist.ShowHideWaitlistPopup(!1),UserID<=0&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&$("#mobileBack").data("backtabnamelogin",void 0!==_shopdetail.activeTabName?_shopdetail.activeTabName:""),UserID<=0&&IsNewCustomWebsite)return showCommonLoginPopup(),!1;"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&"classes"==_shopdetail.activeTabName&&$("#ancShoppingCartIcon").attr("data-redirectto",_shopdetail.activeTabName),_shopdetail.setSelected(e,"shopping-bag"),_siteBuilderDetail.ProductTabHeader(!1);var r=$(e).attr("data-isbypass");if("0"!==$(e).find(".cart-number").first().html()||"shopping-bag"===tabSegment.toLowerCase()||"true"==r){_common.showHideCart(!1),$(e).removeAttr("data-isbypass"),ShowLoader(!0),$("#page-wrapper").scrollTop(0),$(".scrollme").removeClass("scrollme"),"false"!=$(e).attr("data-addstate")&&_common.AddState("shopping-bag","shopping-bag"),$(e).removeAttr("data-addstate");var o=!1,n=!1,s=null,l=$(e).data("classreshedule");if(void 0!==l&&""!=l){try{var d=JSON.parse(l);void 0!==d&&null!=d&&(o=d.isPaid,n=!0,s=d.EventDetail)}catch(e){o=!1,n=!1,s=null}$(e).removeData("classreshedule")}var c="";$("#hdnRescheduleDetail").length>0&&(c=$("#hdnRescheduleDetail").val());var u={UserControlPath:"~/UserControls/ShopDetail/ucShoppingCartCheckoutNew.ascx",PageNamePath:"~/detail.aspx",isRemoveFormTag:!0},p={};(p=1==n&&null!=s?{BusinessId:_shopdetail.businessID,VagaroURL:_shopdetail.vagaroUrl,GroupID:groupID,IsCustomWebsite:isCustomWebsite,IsPromotionUI:isPromotionUI,IsWidget:isWidget,IsFacebook:isFacebook,IsNewReDesignWidget:IsNewReDesignWidget,IsPaid:o,IsClassReschedule:n}:{BusinessId:_shopdetail.businessID,VagaroURL:_shopdetail.vagaroUrl,GroupID:groupID,IsCustomWebsite:isCustomWebsite,IsPromotionUI:isPromotionUI,IsWidget:isWidget,IsFacebook:isFacebook,IsNewReDesignWidget:IsNewReDesignWidget}).IsNewCustomWebsite=IsNewCustomWebsite,u.Parameters=p;var h=new vagaro.ajax;h.datamodel.Token=ApiURLEnumBooking.LoadUserControl,h.datamodel.IsNewVagaroAPI=!0,h.datamodel.callback=function(e){$(".pagebodycontainer").html($("#dvCart").html());var t=$("#dvShoppingCart");t.html(""),t.append(e),t.show(),DisplayFullView(!0),""!=c&&$("#hdnRescheduleDetail").length>0&&$("#hdnRescheduleDetail").val(c),$(".cancel-select-service:visible").length>0&&($(".cancel-select-service:visible").trigger("touchstart"),_common.closeServiceSelection()),_shopdetail.VisibleControlLength("#mobile-check")>0&&$(".pagebodycontainer").show().removeClass("pagesectionFlex"),$("#dvOnlineAppoinmentBooked").hide(),$("#divWriteReview").hide(),$("body").addClass("product-book-checkout"),ShowLoader(!1),1==n&&null!=s&&(onlineShoppingCartmain.Events=s,onlineShoppingCart.Events=s),_onlineCheckout.loadPage(),_onlineCheckout.IsClassBookingOnly(!1)},h.datamodel.data=u,h.datamodel.Error=CallFail_LoadUserControlWithProxy,h.Post()}else{if((bappIsUndefine(IsBrandedApp)||1!=IsBrandedApp||bappIsUndefine(IsSingleBusinessBrandedApp)||1!=IsSingleBusinessBrandedApp)&&1!=_siteBuilderDetail.isFromAppClip||($("#mobileBack").hide(),$("#custmobileBack").hide()),UserID<=0)return objShoppingCartIconClick=e,showCommonLoginPopup("ShoppingCartIconClick"),bappIsUndefine(IsBrandedApp)||1!=IsBrandedApp||CallbackforMobileApp(0,0,"","",0,37),!1;var m=!!$("body").hasClass("busAbouttab");vagaro.alertsmall("No item in cart."),setTimeout(function(){m&&($("body").addClass("busAbouttab"),Webflow.require("lightbox").ready(),$("#divbusinessatab").css("cursor","pointer")),a&&$("#mobileBack").show()},500)}return!1}function GetCityStateValueFromLiveStream(){var e=cookieManager.getCookie("proximitystate_v3");if(null!=e)return String.isNullOrUndefineOrBlank(e.city)?htmlEncode(e.stateName):htmlEncode(e.city)+", "+htmlEncode(e.state)}function DisableFinalSubmitButtonOnlinebooking(e){return 1==e?($("#btnAppointmentWithCC").css("pointer-events","auto").removeClass("checkoutdisable"),!0):"none"!==$("#btnAppointmentWithCC").css("pointer-events")&&($("#btnAppointmentWithCC").css("pointer-events","none").addClass("checkoutdisable"),!0)}function GetCCRequiredToSecureAppointmentDescription(e){const t="A payment card is required to hold your appointment. You will not be charged right now.";var i="",a="Adding a card holds your spot without charging you now. You can cancel or reschedule your appointment anytime up to {0} before your reservation.",r="Adding a card holds your spot without charging you now. You can cancel or reschedule your appointment anytime before your reservation.";try{var o=_siteBuilderDetail.ComponentResponse.lstBusinessDetail;if(!o||"object"!=typeof o)return t;if(o.CutOffHours>0&&"services"===e){var n="<span class='txtsemibold'>"+o.CutOffHours+(1===o.CutOffHours?" hour":" hours")+"</span>";i=a.replace("{0}",n)}else if(o.ClassCustOffHours>0&&"classes"===e){var s="<span class='txtsemibold'>"+o.ClassCustOffHours+(1===o.ClassCustOffHours?" hour":" hours")+"</span>";i=a.replace("{0}",s)}else if(o.AllowCustRecurrenceApp&&o.RecurrenceHours>0){var l="<span class='txtsemibold'>"+o.RecurrenceHours+(1===o.RecurrenceHours?" hour":" hours")+"</span>";i=a.replace("{0}",l)}else(!o.AllowCustRecurrenceApp||null!=o.RecurrenceHours&&0!==o.RecurrenceHours)&&o.AllowCustRecurrenceApp||(i=r);return i||t}catch(e){return i||t}}!function(e){(_shopdetail={}).localData={},_shopdetail.lastAppBookingDate="",_shopdetail.numberofDays="",_shopdetail.lastClassBookingDate="",_shopdetail.lastClassBookingLimit="",_shopdetail.lastClassBookingDateConfigured=!1,_shopdetail.ddlFilterTypes="#ddlFilterTypes",_shopdetail.dvStreamType="#dvStreamType",_shopdetail.isResetTip=!0,_shopdetail.StreamingStatusEnum={InHouse:0,LiveStream:1},_shopdetail.Controls={AddOnList:"#AddOnList",tmplAddOnCategory:"#tmplAddOnCategory",tmplAddOnService:"#tmplAddOnService",ParentService:"#ParentService",SuggestUpsell:"#SuggestUpsell",tmplSuggestUpsellDetail:"#tmplSuggestUpsellDetail",TmplBookingPaymentOption:"#BookingPaymentOption",DivPaymentOption:"#divPaymentOption",PaymentOptionMsPkgPoint:".payment-option-mspkgpoint",tabGooglePay:"#tabGooglePay",tabApplePay:"#tabApplePay",keyGooglePay:"tabGooglePay",keyApplePay:"tabApplePay"},_shopdetail.CssClass={ActiveTab:"w--current"},_shopdetail.BookingDateFormatLabel="dddd, MMMM dd, yyyy",_shopdetail.MembershipPackageUpSell={},_shopdetail.WidgetServicesDetail="",_shopdetail.clsTimeZoneData=null,_shopdetail.timeZone="",_shopdetail.divAddGiftCards="#divAddGiftCards",_shopdetail.tabAddGiftCards="#tabAddGiftCards",_shopdetail.EmployeeNotAcceptingNewClientsDetails=[],_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees=[],_shopdetail._addonMembershipGroupUsage={},_shopdetail.HideShowDisableBookMessageForClass=function(t){t?(e("#divBlockBookMessageForClass").show(),e("#divClassAppResultForClass").hide(),e("#divEmptystate").hide()):(e("#divBlockBookMessageForClass").hide(),e("#divClassAppResultForClass").show())},_shopdetail.LoadClassSliderDatePickerForClass=function(t){e("#divmainEventdetailForClass").data("availabedates",JSON.stringify(t)),e("#divClassAppResultForClass").show();var i=e("#slider-class-dataForClass");i.html(""),i.unslick();var a="",r=_shopdetail.getSunday(new Date),o=new Date(_shopdetail.lastClassBookingDate);o.setDate(o.getDate()-1),o=_shopdetail.getSunday(o),o=new Date(o.setDate(o.getDate()+6));var n=Math.floor((o.getTime()-r.getTime())/864e5);n<50&&o.setDate(o.getDate()+(42-n));var s=e("#DateTemplatesForClass").html();AvailableMinDateForClass=t.length>0?new Date(t[0]):new Date,AvailableMaxDateForClass=new Date(t[t.length-1]);var l=new Date(t[0]).format("MMM dd,yyyy");new Date(l)<AvailableMinDateForClass&&(l=new Date(AvailableMinDateForClass)),new Date(l)>AvailableMaxDateForClass&&(l=new Date(AvailableMaxDateForClass));for(;r<=o;){var d=new Date(r);d=new Date(d.setDate(r.getDate()+6));var c=s;c=(c=(c=(c=(c=(c=c.replace("{{availableStartDate}}",r.format("MMM dd,yyyy"))).replace("{{availableEndDate}}",d.format("MMM dd,yyyy"))).replace("{{startDate}}",r.format("yyyy-MM-dd"))).replace("{{WeekNo}}",monthShortNames[new Date(r).getMonth()])).replace("{{WeekStart}}",new Date(r).getDate())).replace("{{WeekEnd}}",new Date(d).getDate());for(var u=0,p=0,h=r;h<=d;h.setDate(h.getDate()+1))e.inArray(h.format("MMM dd,yyyy"),t)<0&&(u+=1),p+=1;a+=c=u!=p?(c=c.replace("{{selectedClass}}","enabled")).replace("{{onclickcall}}","_shopdetail.SetClassStartDateForClass(this);"):(c=c.replace("{{selectedClass}}","inactive")).replace("{{onclickcall}}","return false;")}e("#slider-class-dataForClass").append(a);var m=new Date(AvailableMinDateForClass);e("#slider-class-dataForClass").slick({infinite:!1,slidesToShow:7,speed:800,prevArrow:'<div data-role="none" class="owl-prev font-awesome-light" onclick="_shopdetail.bounceClassDateControl(this,0);">&#xF104;</div>',nextArrow:'<div data-role="none" class="owl-next font-awesome-light" onclick="_shopdetail.bounceClassDateControl(this,1);">&#xF105;</div>',onAfterChange:function(e,t){"Next"!=e.CurrentSlideDirection&&"Prev"!=e.CurrentSlideDirection||_shopdetail.ChangeClassWeekForClass(e,t)},slidesToScroll:7,responsive:[{breakpoint:768,settings:{arrows:!1}}]});var f=_shopdetail.getSunday(m),g=new Date(f);g=new Date(g.setDate(f.getDate()+6)),_shopdetail.setClassSliderDateForClass(f,g)},_shopdetail.SetClassStartDateForClass=function(t){e("#hdnStartDateForClass").val(_shopdetail.StringToDate(e(t).data().startdate,"-")),e("#hdnMonthNameForClass").html(_shopdetail.weeks_between(_shopdetail.StringToDate(e(t).data().startdate,"-"),!0)),_shopdetail.LoadClassDataOnline()},_shopdetail.setClassSliderDateForClass=function(t,i){var a=t.format("MMM DD,YYYY"),r=i.format("MMM DD,YYYY"),o=e("#date-class-slider-containerForClass").find("[data-availdatestart='"+a+"'][data-availdateend='"+r+"']").closest("div").attr("index");if(null!=o&&void 0!==o){Number(o)%7&&(o-=Number(o)%7),e("#slider-class-dataForClass").slickGoTo(o);var n=e("#date-class-slider-containerForClass").find("[index='"+o+"']");if(n.length>0){var s=e("#date-class-slider-containerForClass div.slick-active.selected:first");if(s.length>0){var l=_shopdetail.StringToDate(s.data().startdate,"-");e("#hdnMonthNameForClass").html(_shopdetail.weeks_between(l,!0))}else{var d=_shopdetail.StringToDate(n.eq(0).data().startdate,"-");e("#hdnMonthNameForClass").html(_shopdetail.weeks_between(d,!0))}}}},_shopdetail.ChangeClassWeekForClass=function(t,i){for(var a,r,o=e("#date-class-slider-containerForClass .slick-active"),n=0;n<=o.length-1;n++){var s=e(o[n]),l=s.attr("index");if(null!=l&&void 0!==l&&Number(l)%7==0){a=new Date(s.eq(0).data().availdatestart),r=new Date(s.eq(0).data().availdateend);break}}_shopdetail.setClassSliderDateForClass(a,r)},_shopdetail.LoadClassDataForClassTab=function(){var t=null,i=null,a=new Date(e("#hdnStartDateForClass").val()),r=new Date(e("#hdnEndDateForClass").val());t=null!=a?a.format("ddd MMM-dd-yyyy"):(new Date).format("ddd MMM-dd-yyyy"),i=null!=r?r.format("ddd MMM-dd-yyyy"):(new Date).format("ddd MMM-dd-yyyy"),e("#spnSearchTypeForClass").html("Classes"),e("#divDateForClass").html(t+" to "+i),e("#AppProgressModalForClass").modal("show");var o,n=0,s=0,l=_vgClassSessionSelection.StreamingFilterType.InHouseAndLiveStream;if(bkEvent.model.searchFromDate=t,bkEvent.model.searchToDate=i,null!=(o=bkEvent.getResponseFromCache()))_vgClassSessionSelection.LoadEventsDataCallbackForClassTab(o);else{n=bkEvent.model.csvServiceID,s=bkEvent.model.csvSPID,l=bkEvent.model.csvFilterType,""==n&&""!=e("#hdnClassIDForClass").val()&&(n=e("#hdnClassIDForClass").val()),"0"==s&&""!=e("#hdnInstructorIDForClass").val()&&(s=e("#hdnInstructorIDForClass").val());var d=e("<XMLDocument/>");if(d.append(_vgClassSessionSelection.createXmlElement("searchDetails")),0!=n||0!=s){var c=_vgClassSessionSelection.createXmlElement("searchDetail");c.append(_vgClassSessionSelection.createXmlElement("serviceId",n)),c.append(_vgClassSessionSelection.createXmlElement("spId",s)),c.append(_vgClassSessionSelection.createXmlElement("streamingstatus",l)),d.find("searchDetails").append(c)}var u=_vgClassSessionSelection.createXmlElement("searchDetail");u.append(_vgClassSessionSelection.createXmlElement("serviceId",-2)),u.append(_vgClassSessionSelection.createXmlElement("spId",-2)),u.append(_vgClassSessionSelection.createXmlElement("streamingstatus",l)),d.find("searchDetails").append(u);var p=0;void 0!==getCookie("PromotionID")&&(p=getCookie("PromotionID"),setCookie("PromotionID",0));var h=new vagaro.ajax;h.datamodel.Token=ApiURLEnumBooking.getavailablemultievents,h.datamodel.IsNewVagaroAPI=!0;var m={};m.businessID=businessID,m.sSatrtDate=t,m.sEndDate=i,m.searchdetails=d.html(),m.userID=parseInt(_shopdetail.GetRescheduleUserID()),m.promotionID=p,h.datamodel.data=m,h.datamodel.callback=_vgClassSessionSelection.LoadEventsDataCallbackForClassTab,h.datamodel.Error=_vgClassSessionSelection.LoadEventsDataFailCallback,h.Post()}},_shopdetail.FillClassDatesForClass=function(){var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);e("#lblEventCart").html(t.length);var i;if(bkClassAvailableDates.model.csvServiceID=e("#hdnInstructorIDForClass").val(),bkClassAvailableDates.model.csvSPID=e("#hdnClassIDForClass").val(),null!=(i=bkClassAvailableDates.getResponseFromCache()))_shopdetail.FillClassDatesCallbackForClass(i);else{var a=bkClassAvailableDates.model.csvServiceID,r=bkClassAvailableDates.model.csvSPID;void 0!==_shopdetail.lastClassBookingDateConfigured&&(_shopdetail.lastClassBookingDateConfigured=!1);var o=new vagaro.ajax;o.datamodel.Token=ApiURLEnumBooking.getavailabledatesforevents,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.Error=_common.CallFailed;var n={};n.businessID=businessID,n.sPIDs=a,n.eventIds=r,n.widgetServiceId=parseInt(_siteBuilderDetail.UserLocationInfo.objUserCustomData.WidgetServiceId),n.IsNewWebsiteBuilder=!1,n.IncludededClassId="",n.ExcludededClassId="",n.IsAllowAllLocation=!1,o.datamodel.data=n,ShowLoader(!0),o.datamodel.callback=_shopdetail.FillClassDatesCallbackForClass,o.Post()}},_shopdetail.FillClassDatesCallbackForClass=function(t){if(t.length>0&&void 0!==_shopdetail.lastClassBookingDateConfigured&&0==_shopdetail.lastClassBookingDateConfigured){_shopdetail.lastClassBookingLimit=t[t.length-1];var i=new Date;i.setDate(i.getDate()+(Number(_shopdetail.lastClassBookingLimit)-1)),_shopdetail.lastClassBookingDate=i,t.pop(),_shopdetail.lastClassBookingDateConfigured=!0}if(bkClassAvailableDates.addResponseToCache(t),t.length<=0&&isClassCalledFromStaff){if(_shopdetail.VisibleControlLength("#divmainEventdetailForClass")<=0){e("#divmainEventdetailForClass").show();try{_shopdetail.LoadClassSliderDatePickerForClass(new Date)}catch(e){}}_shopdetail.ClearBook24()}else _shopdetail.LoadClassSliderDatePickerForClass(t);if(isClassCalledFromStaff=!1,ShowLoader(!1),void 0===t!=null&&t.length>0){if(""!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime){var a=new Date(moment(new Date(_shopdetail.bookingDateTime.replace(new RegExp(",","g")," "))).format("MMM DD,YYYY")),r=new Date(moment(new Date(t[0].replace(new RegExp(",","g")," "))).format("MMM DD,YYYY"));a<r&&(a=r),e("#hdnStartDateForClass").val(a)}else e("#hdnStartDateForClass").val(t[0]);_shopdetail.LoadClassDataOnline(t),_shopdetail.ClearBook24()}else{if(_shopdetail.VisibleControlLength("#divmainEventdetailForClass")<=0){e("#divmainEventdetailForClass").show();try{_shopdetail.LoadClassSliderDatePickerForClass(new Date)}catch(e){}}e("#date-class-slider-containerForClass .selected").removeClass("selected"),e("#date-class-slider-containerForClass div.enabled").removeClass("enabled").addClass("inactive"),vagaro.alertsmall("No date found for selected class and instructor."),e("#divEventDetailForClass").hide(),e("#tblEventDetailForClass").html("")}},_shopdetail.SetClassBookDataForClass=function(t){_shopdetail.VisibleControlLength("#divEmptystate")<=0&&null!=t&&""!=t&&parseInt(t)>0&&(_shopdetail.providerID=t),e(".vg-dropdown-parent").is(":visible")&&(e(".vg-dropdown-parent").hide(),e(".vg-dropdown-parent").parent().removeClass("active-vg-dropdown"),e(".vg-dropdown-parent").children("a").attr("aria-expanded",!1),e(".vg-dropdown-parent").removeClass("active-drop-vg")),isClassCalledFromStaff=!0,_common.LoadBookNowMenu(LoadMenuTypeEnum.classes,!1)},bkClassAvailableDates={timeSlotsCache:{},model:{},init:function(){this.model.cacheLen=3,this.model.cacheDuration=5},getCacheKey:function(){return this.model.csvServiceID.toString()+"-"+this.model.csvSPID.toString()+"-"+this.model.csvFilterType.toString()},addResponseToCache:function(e){if(void 0===this.timeSlotsCache[this.getCacheKey()]||null===this.timeSlotsCache[this.getCacheKey()]){this.timeSlotsCache[this.getCacheKey()]={timestamp:new Date,resp:e},Object.keys||(Object.keys=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i);return t});var t=Object.keys(this.timeSlotsCache);t.length>this.model.cacheLen&&delete this.timeSlotsCache[t[0]]}},getResponseFromCache:function(){if(void 0!==this.timeSlotsCache[this.getCacheKey()]&&null!==this.timeSlotsCache[this.getCacheKey()]){var e=this.timeSlotsCache[this.getCacheKey()].timestamp,t=new Date;if(t.setMinutes(t.getMinutes()-this.model.cacheDuration),e>t)return this.timeSlotsCache[this.getCacheKey()].resp;this.removeCacheByCurKey()}return null},removeCacheByCurKey:function(){delete this.timeSlotsCache[this.getCacheKey()]}},_shopdetail.setBookTextOnLoginlogout=function(t){if(t){_shopdetail.LoadMembershipPackageData(),void 0!==_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees&&1==_shopdetail.IsLimitOnlineBooking&&_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees();var i={BusinessID:_shopdetail.businessID,includeClasses:!0},a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumBooking.getbookrequestbuttontext,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.data=i,a.datamodel.ErrorMessage="",a.datamodel.callback=function(t){IsBlockBook=t.IsBlockBook.toString(),e("#hdBookText").val(t.AppointmentBookText),e("#hdnClassBookText").val(t.ClassBookText),e("a.btnBook","#dvServiceContainer").text(e("#hdBookText").val()),e("a.divStaffBookNowLabel","#stafffreewall").text(e("#hdBookText").val()).append('<span class="font-awesome-light bookdropicon">&#xf107;</span>'),e(":button#btnBook.CLS","#dvServiceContainer").val(e("#hdnClassBookText").val()),e("a#abookApp","#stafffreewall").html(e("#hdBookText").val()),e(":button#btnAboutPromoBook","#detailPromotion").html(e("#hdBookText").val()),"true"==IsBlockBook.toLowerCase()&&(_shopdetail.HideShowDisableBookMessageForApps(!0),_shopdetail.HideShowDisableBookMessageForClass(!0))},a.Post()}else _shopdetail.UserAndFnFNewOrExistingForBusinessEmployees=[],IsBlockBook="false",_shopdetail.activeTabName==ClassTabName&&(_common.LoadBookNowMenu(LoadMenuTypeEnum.classes,!1),_shopdetail.HideShowDisableBookMessageForClass(!1)),_shopdetail.activeTabName==BookTabName&&(_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1),_shopdetail.HideShowDisableBookMessageForApps(!1)),e("#hdBookText").val("Book"),e("#hdnClassBookText").val("Book"),e("a.divStaffBookNowLabel","#stafffreewall").text(e("#hdBookText").val()).append('<span class="font-awesome-light bookdropicon">&#xf107;</span>'),e("a.btnBook","#dvServiceContainer").text(e("#hdBookText").val()),e("a#abookApp","#stafffreewall").html(e("#hdBookText").val()),e(":button#btnAboutPromoBook","#detailPromotion").html(e("#hdBookText").val());void 0!==_shopdetail.reSetUserAndFnFNewOrExistingForBusinessEmployeesForClass&&1==_shopdetail.IsLimitOnlineBooking&&_shopdetail.reSetUserAndFnFNewOrExistingForBusinessEmployeesForClass()},_shopdetail.GetPromotionsByBusinessID=function(){var e=new vagaro.ajax,t="undefined"!=typeof businessID&&null!=businessID&&(195939==parseInt(businessID)||282254==parseInt(businessID)||307082==parseInt(businessID)),i="undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()&&"undefined"!=typeof businessID&&null!=businessID&&(156973===parseInt(businessID)||383713===parseInt(businessID)||377983===parseInt(businessID)||430616===parseInt(businessID)||400713===parseInt(businessID));e.datamodel.async=!(!t&&!i),e.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.getallpromotiondetailsbybusinessid,groupID),e.datamodel.IsNewVagaroAPI=!0,e.datamodel.data={businessID:parseInt(_shopdetail.businessID)},e.datamodel.callback=_shopdetail.OnSuccessGetPromotionsByBusinessID,e.datamodel.Error=function(e){},e.Post()},_shopdetail.OnSuccessGetPromotionsByBusinessID=function(e){PromotionDetails=e.Data},bk={timeSlotsCache:{},model:{},init:function(e,t){this.model.businessID=e,this.model.currencySymbol=t,this.model.csvServiceID=0,this.model.cacheLen=15,this.model.cacheDuration=5},getCacheKey:function(){return this.model.csvServiceID.toString()+"-"+this.model.csvSPID+"-"+this.model.sAppDate+"-"+this.model.isOutcall+"-"+this.model.PromotionID+"-"+this.model.StyleID+"-"+this.model.BusinessPackageID+"-"+this.model.UserID},addResponseToCache:function(e){if(void 0===this.timeSlotsCache[this.getCacheKey()]||null===this.timeSlotsCache[this.getCacheKey()]){this.timeSlotsCache[this.getCacheKey()]={timestamp:new Date,resp:e},Object.keys||(Object.keys=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i);return t});var t=Object.keys(this.timeSlotsCache);t.length>this.model.cacheLen&&delete this.timeSlotsCache[t[0]]}},getResponseFromCache:function(){if(void 0!==this.timeSlotsCache[this.getCacheKey()]&&null!==this.timeSlotsCache[this.getCacheKey()]){var e=this.timeSlotsCache[this.getCacheKey()].timestamp,t=new Date;if(t.setMinutes(t.getMinutes()-this.model.cacheDuration),e>t)return this.timeSlotsCache[this.getCacheKey()].resp;this.removeCacheByCurKey()}return null},removeCacheByCurKey:function(){delete this.timeSlotsCache[this.getCacheKey()]},removeAllCache:function(){this.timeSlotsCache=new Array}},_shopdetail.ClearClassControls=function(t){_shopdetail.VisibleControlLength("#divCustomMessage")<=0&&"false"==isClassSelected.toLowerCase()&&"false"==isFromReschedual.toLowerCase()&&(0==t?(null!=_shopdetail.GetRescheduleDetail()&&(_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage)),e("#Book24Container").html(""),e("#divEventDetail").hide(),e("#tblEventDetail").html("")):(e(".dvRescheduleRS").hide(),e(".dvRescheduleSNP").show(),e(".dvRescheduleRSFull").hide(),e(".dvRescheduleFull").show()),e("#txtService1").select2("enable"),e("#hdnRescheduleDetail").val(""),e("#divEventbasket").show(),e(".divcreditCardWrapper").length>0&&"true"==e(".divcreditCardWrapper").data("isccdetailhide").toLowerCase()&&e(".divcreditCardWrapper").data("isccdetailhide",""))},_shopdetail.IsCCDetailEnable=function(){try{return e(".divcreditCardWrapper").length>0&&""==e(".divcreditCardWrapper").data("isccdetailhide")}catch(e){return!1}},_shopdetail.GetEventTimeZoneReschedule=function(t,i,a){var r={};r.ShoppingCartEvent=t,r.BusinessID=parseInt(_shopdetail.businessID),r.UserID=parseInt(_shopdetail.GetRescheduleUserID()),r.IsLiveStream=i;var o=new vagaro.ajax;o.datamodel.IsNewVagaroAPI=!0,o.datamodel.Token=ApiURLEnumBooking.geteventcustomertimezonedate,o.datamodel.data=r,o.datamodel.callback=function(i){if(null!=i&&null!=i.ShoppingCartEvent&&i.ShoppingCartEvent.length>0){e.grep(t,function(t){e.grep(t.eventEnrollment,function(a){e.grep(i.ShoppingCartEvent,function(i){e.grep(i.eventEnrollment,function(e){i.eventID==t.eventID&&e.autoID==a.autoID&&(a.CustomerStartTime=e.CustomerStartTime,a.CustomerEndTime=e.CustomerEndTime,a.CustomerTimeZone=e.CustomerTimeZone,a.UtcStartTime=new Date(_shopdetail.getDateFormat(e.UtcStartTime)),a.DurationValue=e.DurationValue)})})})});var r={};r.isPaid=1==a,r.EventDetail=t,e("#ancShoppingCartIcon").data("classreshedule",JSON.stringify(r)),e("#ancShoppingCartIcon").attr("data-isbypass","true"),e("#ancShoppingCartIcon").click()}ShowLoader(!1)},o.datamodel.Error=function(e){ShowLoader(!1)},o.Post()},_shopdetail.getDateFormat=function(e){const t=/-?\d+/.exec(e);return parseInt(t[0],10)},_shopdetail.GetRescheduleUserID=function(){return"undefined"!=typeof lAppUserID&&null!=lAppUserID&&lAppUserID>0?lAppUserID:UserID},_shopdetail.GetRescheduleUserName=function(e){return"undefined"!=typeof lAppUserFullName&&null!=lAppUserFullName&&""!=lAppUserFullName?0==e?lAppUserFullName.split(" ")[0]:void 0!==lAppUserFullName.split(" ")[1]?lAppUserFullName.split(" ")[1]:"":0==e?FullUserName.split(" ")[0]:void 0!==FullUserName.split(" ")[1]?FullUserName.split(" ")[1]:""},_shopdetail.GetRescheduleUserEmailId=function(){return"undefined"!=typeof lAppUserEmailId&&null!=lAppUserEmailId?lAppUserEmailId:UserEmail},_shopdetail.GetRescheduleCellNo=function(){return"undefined"!=typeof lAppUserCellNo&&null!=lAppUserCellNo?lAppUserCellNo:null!=UserCellNo?UserCellNo:""},_shopdetail.GetRescheduleDetail=function(){var t=e("#hdnRescheduleDetail");if(""==t.val())return null;try{return JSON.parse(t.val())}catch(e){return null}},_shopdetail.SetClassBookData=function(t,i,a,r){var o=!1;void 0!==r&&null!=r&&1==r&&(o=r),_shopdetail.VisibleControlLength("#divCustomMessage")<=0&&(_IsClassSelectedLast=!0,_shopdetail.ClearClassControls(!1),null!=i&&""!=i&&parseInt(i)>0&&(_shopdetail.providerID=i,0==t&&i>0&&(_shopdetail.isClassCalenderFilled=!1)),null!=t&&""!=t&&parseInt(t)>0&&(e("#ucServiceCombo_hidEventType").val("2"),_shopdetail.serviceID=t,_shopdetail.isClassCalenderFilled=!1,isClassDetailLoad=!0)),0==a&&(_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1,o),e("#divEventCartDetail").hide(),e("#divAvailableGCPackageDetail").hide(),_shopdetail.VisibleControlLength("#divCustomMessage")<=0&&e("#divSearch").show())},bkEvent={timeSlotsCache:{},model:{},init:function(){this.model.cacheLen=3,this.model.cacheDuration=5},getCacheKey:function(){return this.model.searchFromDate.toString()+"-"+this.model.searchToDate.toString()+"-"+this.model.csvServiceID.toString()+"-"+this.model.csvSPID.toString()+"-"+this.model.csvFilterType.toString()},addResponseToCache:function(e){if(void 0===this.timeSlotsCache[this.getCacheKey()]||null===this.timeSlotsCache[this.getCacheKey()]){this.timeSlotsCache[this.getCacheKey()]={timestamp:new Date,resp:e},Object.keys||(Object.keys=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(i);return t});var t=Object.keys(this.timeSlotsCache);t.length>this.model.cacheLen&&delete this.timeSlotsCache[t[0]]}},getResponseFromCache:function(){if(void 0!==this.timeSlotsCache[this.getCacheKey()]&&null!==this.timeSlotsCache[this.getCacheKey()]){var e=this.timeSlotsCache[this.getCacheKey()].timestamp,t=new Date;if(t.setMinutes(t.getMinutes()-this.model.cacheDuration),e>t)return this.timeSlotsCache[this.getCacheKey()].resp;this.removeCacheByCurKey()}return null},removeCacheByCurKey:function(){delete this.timeSlotsCache[this.getCacheKey()]}},_shopdetail.setClassSliderDate=function(t,i){var a=t.format("MMM DD,YYYY"),r=i.format("MMM DD,YYYY"),o=e("#date-class-slider-container").find("[data-availdatestart='"+a+"'][data-availdateend='"+r+"']").closest("div").attr("index");if(null!=o&&void 0!==o){Number(o)%7&&(o-=Number(o)%7),e("#slider-class-data").slickGoTo(o);var n=e("#date-class-slider-container").find("[index='"+o+"']");if(n.length>0){var s=e("#date-class-slider-container div.slick-active.selected:first");if(s.length>0){var l=_shopdetail.StringToDate(s.data().startdate,"-");e("#hdnMonthName").html(_shopdetail.weeks_between(l,!0))}else{var d=_shopdetail.StringToDate(n.eq(0).data().startdate,"-");e("#hdnMonthName").html(_shopdetail.weeks_between(d,!0))}}}},_shopdetail.ChangeClassWeek=function(t,i){for(var a,r,o=e("#date-class-slider-container .slick-active"),n=0;n<=o.length-1;n++){var s=e(o[n]),l=s.attr("index");if(null!=l&&void 0!==l&&Number(l)%7==0){a=new Date(s.eq(0).data().availdatestart),r=new Date(s.eq(0).data().availdateend);break}}_shopdetail.setClassSliderDate(a,r)},_shopdetail.bounceClassDateControl=function(t,i){1==e(t).hasClass("slick-disabled")&&(0==i?e("#slider-class-data").animate({left:"+=50px"},400,"easeOutSine",function(){e("#slider-class-data").animate({left:0},600,"easeOutBounce")}):e("#slider-class-data").animate({right:"+=50px"},400,"easeOutSine",function(){e("#slider-class-data").animate({right:0},600,"easeOutBounce")}))},_shopdetail.dateChanged=function(e){var t=_shopdetail.getSunday(e),i=new Date(t);i=new Date(i.setDate(t.getDate()+6)),_shopdetail.setClassSliderDate(t,i)},_shopdetail.LoadClassSliderDatePicker=function(t){if(e("#divmainEventdetail").data("availabedates",JSON.stringify(t)),!(_shopdetail.VisibleControlLength("#divmainEventdetail")<=0)){e("#divClassAppResult").show();var i=e("#slider-class-data");i.html(""),i.unslick();var a=getdatepickervalue("#txtdivSearchDate",null,!0,!0),r="",o=_shopdetail.getSunday(new Date),n=new Date;n.setMonth(n.getMonth()+12),n=_shopdetail.getSunday(n),n=new Date(n.setDate(n.getDate()+6));var s=Math.floor((n.getTime()-o.getTime())/864e5);s<50&&n.setDate(n.getDate()+(42-s));var l=e("#DateTemplatesForClass").html();AvailableMinDateForClass=t.length>0?new Date(t[0]):new Date,AvailableMaxDateForClass=new Date(t[t.length-1]);var d=null==a?new Date(t[0]).format("MMM dd,yyyy"):a.format("MMM dd,yyyy");new Date(d)<AvailableMinDateForClass&&(d=new Date(AvailableMinDateForClass)),new Date(d)>AvailableMaxDateForClass&&(d=new Date(AvailableMaxDateForClass));for(;o<=n;){var c=new Date(o);c=new Date(c.setDate(o.getDate()+6));var u=l;u=(u=(u=(u=(u=(u=u.replace("{{availableStartDate}}",o.format("MMM dd,yyyy"))).replace("{{availableEndDate}}",c.format("MMM dd,yyyy"))).replace("{{startDate}}",o.format("yyyy-MM-dd"))).replace("{{WeekNo}}",monthShortNames[new Date(o).getMonth()])).replace("{{WeekStart}}",new Date(o).getDate())).replace("{{WeekEnd}}",new Date(c).getDate());for(var p=0,h=0,m=o;m<=c;m.setDate(m.getDate()+1))e.inArray(m.format("MMM dd,yyyy"),t)<0&&(p+=1),h+=1;r+=u=p!=h?(u=u.replace("{{selectedClass}}","enabled")).replace("{{onclickcall}}","_shopdetail.SetClassStartDate(this);"):(u=u.replace("{{selectedClass}}","inactive")).replace("{{onclickcall}}","return false;")}e("#slider-class-data").append(r);var f=new Date(AvailableMinDateForClass);f=null!=a&&void 0!==a?a:new Date(d),e("#slider-class-data").slick({infinite:!1,slidesToShow:7,speed:800,prevArrow:'<div data-role="none" class="owl-prev font-awesome-light" onclick="_shopdetail.bounceClassDateControl(this,0);">&#xF104;</div>',nextArrow:'<div data-role="none" class="owl-next font-awesome-light" onclick="_shopdetail.bounceClassDateControl(this,1);">&#xF105;</div>',onAfterChange:function(e,t){"Next"!=e.CurrentSlideDirection&&"Prev"!=e.CurrentSlideDirection||_shopdetail.ChangeClassWeek(e,t)},slidesToScroll:7,responsive:[{breakpoint:768,settings:{arrows:!1}}]});var g=_shopdetail.getSunday(f),v=new Date(g);v=new Date(v.setDate(g.getDate()+6)),_shopdetail.setClassSliderDate(g,v)}},_shopdetail.FillClassDatesCallback=function(t){if(ShowLoader(!1),destroydatepicker({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:t,callBackOnChange:dateChanged,contentWindow:datePicker_contentWindow,isApplyInWidget:!0,scrollMonth:!1}),_shopdetail.isClassCalenderFilled=!0,_shopdetail.LoadClassSliderDatePicker(t),void 0===t!=null&&t.length>0){if(""!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime){var i=new Date(moment(new Date(_shopdetail.bookingDateTime.replace(new RegExp(",","g")," "))).format("MMM DD,YYYY")),a=new Date(moment(new Date(t[0].replace(new RegExp(",","g")," "))).format("MMM DD,YYYY"));i<a&&(i=a),setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(moment(i)))}e("div#divMsg","div#Book24Container").remove(),1==isClassDetailLoad&&(LoadData(),_shopdetail.ClearBook24(),isClassDetailLoad=!1)}else e("#date-class-slider-container .selected").removeClass("selected"),e("#date-class-slider-container div.enabled").removeClass("enabled").addClass("inactive"),vagaro.alertsmall("No "+classWSKeyWordPlural.toLowerCase()+" available."),e("#divEventDetail").hide(),e("#tblEventDetail").html("")},_shopdetail.IsClassSelected=function(){return e("#ucServiceCombo_hidEventType").length>0&&"2"==e("#ucServiceCombo_hidEventType").val()},_shopdetail.IsBusinessHaveOnlyClass=function(){return void 0!==OnlindBookingResponse&&null!=OnlindBookingResponse&&1==OnlindBookingResponse.IsClassExists&&0==OnlindBookingResponse.IsServiceExists&&0==OnlindBookingResponse.IsServiceBundleExists&&("undefined"==typeof isFromReschedual||"true"!=isFromReschedual.toLowerCase()||void 0===getCookie("AppointmentID")||""==getCookie("AppointmentID"))},_shopdetail.SetClassStartDate=function(t){setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(moment(e(t).data().availdatestart)._d));var i=getdatepickervalue("#txtdivSearchDate",null,!0,!0),a=getMinDateValue({textid:"#txtdivSearchDate"});null!=i&&i<a&&setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},a),e("#hdnMonthName").html(_shopdetail.weeks_between(_shopdetail.StringToDate(e(t).data().startdate,"-"),!0)),LoadData()},_shopdetail.CloseClassSearchProgress=function(){setTimeout(function(){e("#AppProgressModal").modal("hide"),e("#apgSearchProgress").hide()},500)},_shopdetail.BookingSearchBack=function(){_shopdetail.VisibleControlLength("#mobile-check")>0&&"undefined"!=typeof _vgWaitlist&&e("#"+_vgWaitlist.model.divWaitlistpopup).length>0&&1==e("#"+_vgWaitlist.model.divWaitlistpopup).is(":visible")?_vgWaitlist.ShowHideWaitlistPopup(!1):(e("#no-appointment-found").hide(),e("#mobileBack").data("serviceidfromcustomerapp")>0&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp&&(e("#mobileBack").hide(),e("#custmobileBack").show()),e(".book-wrapper").removeClass("searched-appointment"),e("body").removeClass("searched-appointment-body"),e("html, body").removeClass("checkinapp-dang"),e("#divmainEventdetail").hide(),e("#dvDateSlider").hide(),e("#divClassAppResult").hide(),e("#select2-drop-mask").click(),_common.closeServiceSelection())},_shopdetail.BookingSearchBackForClass=function(){e("body").removeClass("searched-appointment-body"),e("#select2-drop-mask").click(),_common.closeServiceSelection()},_shopdetail.ShowSessionDetail=function(t,i){var a=e("#signup-price-list"+t);if(e(".signup-price-list").not(a).hide(),1==a.is(":hidden")){var r=a.show().height(),o=a.offset().top;a.hide(),document.body.scrollHeight-(o+r)<=50&&a.css("margin-top","-"+(r+25)+"px")}a.slideToggle(0),i.stopPropagation()},_shopdetail.EventFullMessage=function(e){var t="";2==e?t=classWSKeyWordSmall.toLowerCase():3==e&&(t="workshop"),vagaro.alertsmall("A "+t+" can't take any new enrollment as it is full.")},_shopdetail.StringToDate=function(e,t){var i=e.split(t);return new Date(parseInt(i[0],10),parseInt(i[1],10)-1,parseInt(i[2],10))},_shopdetail.eventimageErrorHandal=function(e){e.src=eventNoImageAvailable},e("#txtQuantity, #txtNoofAttendees").blur(function(){_vgClassSessionSelection.CalculateSessionPrice(),_vgClassSessionSelection.ShowDiscountOnEvent()}),e("#txtQuantity, #txtNoofAttendees").change(function(){_vgClassSessionSelection.CalculateSessionPrice(),_vgClassSessionSelection.ShowDiscountOnEvent()}),_shopdetail.RecalculatePrice=function(){"1"==e("#txtNoofAttendees").val()?e("#txtNoofAttendees").val(0==_vgClassSessionSelection.Getgrouparray().length?1:_vgClassSessionSelection.Getgrouparray().length):e("#txtNoofAttendees").val(_vgClassSessionSelection.Getgrouparray().length+1),_vgClassSessionSelection.CalculateSessionPrice(),_vgClassSessionSelection.ShowDiscountOnEvent();var t,i=e(".staticData #txtFirstName1"),a=e(".staticData #txtLastName1"),r=e(".staticData #txtEmailId1"),o=e(".staticData #txtCellNo1");0==i.prop("disabled")&&0==a.prop("disabled")&&0==r.prop("disabled")&&0==o.prop("disabled")?((t=e("#otherUserPreviousDetail")).data("fname",i.val()),t.data("lname",a.val()),t.data("email",r.val()),t.data("cell",o.val())):((t=e("#otherUserPreviousDetail")).data("fname",null),t.data("lname",null),t.data("email",null),t.data("cell",null))},_shopdetail.ShowHideClassPopup=function(t){1==t?e("#divClassDetailpopup").modal("show"):(_shopdetail.CloseDateControl(),e("#divClassDetailpopup").modal("hide"))},_shopdetail.ShowHideValidationClassPopup=function(t){1==t?e("#divClassValidationpopup").modal("show"):e("#divClassValidationpopup").modal("hide")},_shopdetail.ShowHideClassPaymentPopup=function(t){if(1==t)e("#divPartialPaymentValidationpopup").modal("show");else{var i=e("#btnPaymentFailClse").data("failtype");void 0!==i&&""!=i&&"1"==i&&_shopdetail.ShowHideCart(!0,!0),e("#divPartialPaymentValidationpopup").modal("hide")}},_shopdetail.ResetClassDataAfterPayment=function(){if(bkEvent.timeSlotsCache={},e("#lblEventCart").html("0"),e("#cboSalonServices").val("-1"),e("#ucServiceCombo_hidEventType").val(""),null!=_shopdetail.GetRescheduleDetail()&&_shopdetail.ClearClassControls(!1),e("#date-class-slider-container .selected").removeClass("selected"),_shopdetail.ShowHideCart(!1),1==_shopdetail.IsBusinessHaveOnlyClass()){var t="<%= Vagaro.Web.Business.Declaration.ClassKeyWord.ToLower() %>";e("#ancaddService").attr("title","Add Another "+t),e("#ancaddService").html("Add Another "+t),e("#lblService").html("<%= Vagaro.Web.Business.Declaration.ClassKeyWordPlural %>(required)")}else e("#ancaddService").attr("title","Add Service"),e("#ancaddService").html("Add Service"),e("#lblService").html("Service(required)"),HideShowClassServiceAndClearControl(!1);_shopdetail.CallBookData()},_shopdetail.ShowEventCart=function(){_vgClassSessionSelection.ManageEventTempAndRealData(!1,!1),_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage).length<=0?(e("#lblEventCart").html("0"),vagaro.alertsmall("No item in cart.")):_shopdetail.ShowHideCart(!0)},_shopdetail.ShowHideCart=function(t,i){if(1==t)if(ShowLoader(!0),1==_shopdetail.IsCCDetailEnable()){e(".divcreditCardWrapper").show(),e("#btneventCCDetail").val("Place Order");var a=_vgClassSessionSelection.GetGCorPackage(),r=_vgClassSessionSelection.ManageEventTempAndRealData(!0,!0);if(a.length>0&&r<=0)_shopdetail.BindGCOrPackageSummary();else if(r.length>0){var o=e("<XMLDocument/>");o.append(_vgClassSessionSelection.createXmlElement("UsersDetail"));for(var n=0;n<=r.length-1;n++){var s=_vgClassSessionSelection.createXmlElement("User");s.append(_vgClassSessionSelection.createXmlElement("userid",parseInt(r[n].customerID))),s.append(_vgClassSessionSelection.createXmlElement("email",r[n].cUserEmail)),o.find("UsersDetail").append(s)}var l=new vagaro.ajax;l.datamodel.Token="GetGiftCertificateForClass",l.datamodel.data=[o.html(),parseInt(_shopdetail.businessID)],l.datamodel.callback=1==i?_shopdetail.GiftCertificateClassCallback:_shopdetail.GiftCertificateForClassCallback,l.datamodel.Error=_common.CallFailed,l.Post()}else _vgClassSessionSelection.commonProperty.gCOrPackageDetail="",_vgClassSessionSelection.commonProperty.cartUserList="",_shopdetail.BindEventCart()}else e(".divcreditCardWrapper").hide(),e("#liGCDetail").hide(),e("#liGCRedeem").hide(),e("#liPackageDetail").hide(),e("#liPackageRedeem").hide(),e("#btneventCCDetail").val(e("#hdnClassBookText").val()+" Order"),_vgClassSessionSelection.ManageEventTempAndRealData(!1,!0),_vgClassSessionSelection.commonProperty.gCOrPackageDetail="",_vgClassSessionSelection.commonProperty.cartUserList="",_shopdetail.BindEventCart();else _shopdetail.ClearEventCCDetail(),e("#divmainEventdetail").removeAttr("style").hide(),e("#divEventCartDetail").hide(),e("#divAvailableGCPackageDetail").hide(),e("#divSearch").show(),e("#divmainEventdetail").show(),ShowLoader(!1)},_shopdetail.BindGCOrPackageSummary=function(){var t=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),i=_vgClassSessionSelection.GetGCorPackage(),a=[],r=!1,o=!1;if(t.length>0&&i.length>0){t=_shopdetail.CalculatePriceAndTaxOnCart(t,null,null,!0);for(var n=0;n<=t.length-1;n++)if(null!=t[n].eventEnrollment&&t[n].eventEnrollment.length>0){var s=t[n].eventEnrollment.uniqueObjects(["customerID","cUserEmail"]);e.grep(s,function(s){var l=0,d=0,c=0,u=0,p=[],h=0,m=e.grep(t[n].eventEnrollment,function(t){if(0!=s.customerID&&s.customerID==t.customerID||0==s.customerID&&s.cUserEmail==t.cUserEmail){if(1==t.isDecisionTaken){1==t.isPackage?(c+=1,u+=t.price):0==t.isPackage&&(l+=1,d+=t.price);var i=e.grep(p,function(e){return e.gcId==t.gcId});if(i.length>0)i[0].redeemAmt+=t.price,i[0].noofService+=1;else{var a={};a.gcId=t.gcId,a.redeemAmt=t.price,a.noofService=1,p.push(a)}}h+=parseFloat(t.price)}return(0!=s.customerID&&s.customerID==t.customerID||0==s.customerID&&s.cUserEmail==t.cUserEmail)&&1!=t.isDecisionTaken}),f=0,g=0,v=0,A=0,C=[];if(m.length>0&&h>0&&(C=e.grep(i,function(i){if(i.serviceID!=t[n].eventID&&i.serviceName.toLowerCase()!=t[n].eventName.toLowerCase()||!(0!=s.customerID&&s.customerID==i.assignTo||0==s.customerID&&s.cUserEmail==i.emailId)||(1==i.isPackage?(v+=i.quantity,A+=i.currentBalance):0==i.isPackage&&(f+=i.quantity,g+=i.currentBalance)),p.length>0){var a=e.grep(p,function(e){return e.gcId==i.giftCertificateID&&(i.quantity-=e.noofService,i.currentBalance=parseFloat((i.currentBalance-e.redeemAmt).toFixed(2))),e.gcId==i.giftCertificateID});return null!=a&&a.length>0?i.quantity>0&&i.currentBalance>0&&((i.serviceID==t[n].eventID||i.serviceName.toLowerCase()==t[n].eventName.toLowerCase())&&(0!=s.customerID&&s.customerID==i.assignTo||0==s.customerID&&s.cUserEmail==i.emailId)):(i.serviceID==t[n].eventID||i.serviceName.toLowerCase()==t[n].eventName.toLowerCase())&&(0!=s.customerID&&s.customerID==i.assignTo||0==s.customerID&&s.cUserEmail==i.emailId)}return(i.serviceID==t[n].eventID||i.serviceName.toLowerCase()==t[n].eventName.toLowerCase())&&(0!=s.customerID&&s.customerID==i.assignTo||0==s.customerID&&s.cUserEmail==i.emailId)})),null!=C&&C.length>0){C.keySort({isPackage:"asc",expiresOn:"asc",quantity:"asc"})}objGCorPackageDetail={},objGCorPackageDetail.gCCount=0,objGCorPackageDetail.gCAmount=0,objGCorPackageDetail.packageCount=0,objGCorPackageDetail.packageAmount=0,f-l>0&&g-d>0&&(objGCorPackageDetail.gCCount=f-l,objGCorPackageDetail.gCAmount=parseFloat((g-d).toFixed(2)),0==o&&(o=!0)),v-c>0&&A-u>0&&(objGCorPackageDetail.packageCount=v-c,objGCorPackageDetail.packageAmount=parseFloat((A-u).toFixed(2)),0==r&&(r=!0)),(objGCorPackageDetail.gCCount>0&&objGCorPackageDetail.gCAmount>0||objGCorPackageDetail.packageCount>0&&objGCorPackageDetail.packageAmount>0)&&(objGCorPackageDetail.gCAmount=objGCorPackageDetail.gCAmount.toFixed(2),objGCorPackageDetail.packageAmount=objGCorPackageDetail.packageAmount.toFixed(2),objGCorPackageDetail.eventID=t[n].eventID,objGCorPackageDetail.eventName=t[n].eventName,objGCorPackageDetail.customerID=s.customerID,objGCorPackageDetail.cUserEmail=s.cUserEmail,objGCorPackageDetail.availableGCAndPackages=C,objGCorPackageDetail.attendeeName=_vgClassSessionSelection.GetUserShortDetail(s.cFirstName,s.cLastName),a.push(objGCorPackageDetail))})}}a.length>0?(e("#GCPackageSummaryDectail").html(""),e("#GCPackageDetail").tmpl(a).appendTo("#GCPackageSummaryDectail"),e("#btnClassGCApply").data("gcpackagedetail",JSON.stringify(a)),e("#divAvailableGCPackageDetail").show(),e("#divSearch").hide(),e("#divmainEventdetail").hide(),e("#divEventCartDetail").hide(),1==o&&1==r?e("#btnClassGCApply").val("Use gift card & package"):1==o&&0==r?e("#btnClassGCApply").val("Use gift card"):0==o&&1==r&&e("#btnClassGCApply").val("Use package"),ShowLoader(!1)):_shopdetail.BindEventCart()},_shopdetail.ApplyGCAndPackage=function(t){e("#divAvailableGCPackageDetail").hide(),e("#divEventCartDetail").show();try{var i=JSON.parse(e("#btnClassGCApply").data("gcpackagedetail"));_shopdetail.BindEventCart(t,i)}catch(e){_shopdetail.BindEventCart()}},_shopdetail.BindEventCart=function(t,i){var a=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(a.length>0){e(".divNoitem").hide(),e(".divcartitem").show(),e("#cartSummaryDectail").html(""),e("#EvenetCartDetail").tmpl(_shopdetail.CalculatePriceAndTaxOnCart(a,t,i)).appendTo("#cartSummaryDectail");for(var r=0;r<=a.length-1;r++)1==a[r].eventEnrollment.length&&e("#deleteitem-"+a[r].eventID).hide();if(1==_shopdetail.IsCCDetailEnable()){e("#txtEventFName").val(FullUserName.split(" ")[0]);var o=e("#txtEventLName");void 0!==FullUserName.split(" ")[1]?o.val(FullUserName.split(" ")[1]):o.val("")}1==_shopdetail.IsCCDetailEnable()&&parseFloat(e("#lbltotalorderamt").text())>0?_shopdetail.CheckUserhasCreditcardOrNot("onlineclass"):_shopdetail.SetEventUserCCDetail()}else e("#divEventCartDetail").removeAttr("style").hide(),e("#divSearch").hide(),e("#divmainEventdetail").hide(),e("#divEventCartDetail").show(),e(".divNoitem").show(),e(".divcartitem").hide(),ShowLoader(!1);e("#lblEventCart").html(a.length)},_shopdetail.GiftCertificateForClassCallback=function(e){if(null!=e){if(null!=e.objClassCartUserList&&e.objClassCartUserList.length>0){var t=_vgClassSessionSelection.GetCartUserDetail();t=t.concat(e.objClassCartUserList),_vgClassSessionSelection.commonProperty.cartUserList=JSON.stringify(t)}if(null!=e.objGcAndPackagesForClass&&e.objGcAndPackagesForClass.length>0){var i=_vgClassSessionSelection.GetGCorPackage();i=i.concat(e.objGcAndPackagesForClass),_vgClassSessionSelection.commonProperty.gCOrPackageDetail=JSON.stringify(i)}}_shopdetail.BindGCOrPackageSummary()},_shopdetail.GiftCertificateClassCallback=function(e){if(null!=e){if(null!=e.objClassCartUserList&&e.objClassCartUserList.length>0){var t=_vgClassSessionSelection.GetCartUserDetail();t=t.concat(e.objClassCartUserList),_vgClassSessionSelection.commonProperty.cartUserList=JSON.stringify(t)}if(null!=e.objGcAndPackagesForClass&&e.objGcAndPackagesForClass.length>0){var i=_vgClassSessionSelection.GetGCorPackage();i=i.concat(e.objGcAndPackagesForClass),_vgClassSessionSelection.commonProperty.gCOrPackageDetail=JSON.stringify(i)}}ShowLoader(!1)},_shopdetail.CalculatePriceAndTaxOnCart=function(t,i,a,r){for(var o=_shopdetail.IsCCDetailEnable(),n=0;n<=t.length-1;n++){var s=t[n].eventEnrollment,l=t[n].sessiondetail,d=s.uniqueObjects(["customerID","cUserEmail"]);if(d.length>0){for(var c=0;c<=d.length-1;c++){var u=[];if((1==i||0==i)&&null!=a&&a.length>0){var p=e.grep(a,function(e){return(d[c].customerID>0&&e.customerID==d[c].customerID||d[c].customerID<=0&&e.cUserEmail==d[c].cUserEmail)&&(e.eventID==t[n].eventID||e.eventName.toLowerCase()==t[n].eventName.toLowerCase())});null!=p&&p.length>0&&(u=p[0].availableGCAndPackages)}if(1==r){var h=_vgClassSessionSelection.GetGCorPackage();if(null!=h&&h.length>0){(u=e.grep(h,function(e){return(e.serviceID==t[n].eventID||e.serviceName.toLowerCase()==t[n].eventName.toLowerCase())&&(0!=d[c].customerID&&d[c].customerID==e.assignTo||0==d[c].customerID&&d[c].cUserEmail==e.emailId)})).keySort({isPackage:"asc",expiresOn:"asc",quantity:"asc"})}}var m=e.grep(t[n].eventEnrollment,function(e){return d[c].customerID>0&&e.customerID==d[c].customerID||d[c].customerID<=0&&e.cUserEmail==d[c].cUserEmail}),f=0;f=null!=_shopdetail.GetRescheduleDetail()?m[0].oldPrice:_vgClassSessionSelection.CalcSessionPrice(l,m.length,1,!1);var g=_vgClassSessionSelection.ConvertTodecimal(f/m.length,2,!0),v=f/m.length,A=0,C=0,y=0;if(1==o&&(y=_vgClassSessionSelection.ConvertTodecimal(f*t[n].tax/100,2,!0),A=_vgClassSessionSelection.ConvertTodecimal(y/m.length,2,!0),C=f*t[n].tax/100/m.length),null!=m&&m.length>0){var b=0,S=0,k=0,D=0,_=0,I=0,w=0,P=0;e.each(m,function(a,s){var l=a==m.length-1?_vgClassSessionSelection.ConvertTodecimal(_vgClassSessionSelection.ConvertTodecimal(f,2,!0)-b,2,!0):g;b=_vgClassSessionSelection.ConvertTodecimal(b+l,2,!0);var d=0;d=1==o?a==m.length-1?_vgClassSessionSelection.ConvertTodecimal(_vgClassSessionSelection.ConvertTodecimal(y,2,!0)-S,2,!0):A:0,S=_vgClassSessionSelection.ConvertTodecimal(S+d,2,!0);var c={};if(1==s.isPackage&&(l>0?(c.price=s.price,c.actualPrice=s.actualPrice,c.actualTaxprice=s.actualTaxprice,c.taxprice=s.taxprice):s.gcId=0),s.price=l,s.actualPrice=v,s.actualTaxprice=C,s.taxprice=d,(1!=s.isDecisionTaken&&(1==i||0==i)||1==r&&1==s.isDecisionTaken&&(1==s.isPackage||0==s.isPackage))&&u.length>0&&l>0)if(1==i||1==r){var p=e.grep(u,function(e){return e.quantity>0&&e.currentBalance>0});if(p.length>0){var h=p[0];if(0==h.isPackage)s.redeemAmt=s.price,h.quantity-=1,h.currentBalance-=s.redeemAmt;else{var T=Math.floor(parseFloat((h.currentBalance/h.quantity*100).toFixed(2)))/100;s.redeemAmt=T,s.price=T,s.actualPrice=T,s.actualTaxprice=0,s.taxprice=0,h.quantity-=1,h.currentBalance-=T}s.gcId=h.giftCertificateID,s.isPackage=h.isPackage,s.isDecisionTaken=!0}else s.gcId=0,s.isPackage=null}else 0==i&&(s.isPackage=null,s.isDecisionTaken=!0);else 1==s.isPackage&&1==c.hasOwnProperty("price")&&(s.price=c.price,s.actualPrice=c.actualPrice,s.actualTaxprice=c.actualTaxprice,s.taxprice=c.taxprice);if(1==o&&(1!=s.isPackage?(_=_vgClassSessionSelection.ConvertTodecimal(_+s.price,2,!0),I=_vgClassSessionSelection.ConvertTodecimal(I+s.actualPrice,10,!0),P+=1):1==s.isPackage&&(w+=1),k=_vgClassSessionSelection.ConvertTodecimal(k+s.taxprice,2,!0),D=_vgClassSessionSelection.ConvertTodecimal(D+s.actualTaxprice,10,!0),w>0&&P>0&&a==m.length-1))for(var B=_vgClassSessionSelection.ConvertTodecimal(_*t[n].tax/100,2,!0),x=parseFloat((B-k).toFixed(2)),F=_vgClassSessionSelection.ConvertTodecimal(I*t[n].tax/100,2,!0),O=parseFloat((F-D).toFixed(2)),M=m.length-1;M>=0;M--)if(1!=m[M].isPackage){m[M].actualTaxprice=_vgClassSessionSelection.ConvertTodecimal(m[M].actualTaxprice+O,10,!0),m[M].taxprice=_vgClassSessionSelection.ConvertTodecimal(m[M].taxprice+x,2,!0);break}})}if(c==d.length-1){var T,B=0,x=0,F=0,O=0;if(e.grep(t[n].eventEnrollment,function(e){B=_vgClassSessionSelection.ConvertTodecimal(B+e.price,2,!0),x=_vgClassSessionSelection.ConvertTodecimal(x+e.taxprice,2,!0),F=_vgClassSessionSelection.ConvertTodecimal(F+e.actualPrice,10,!0),O=_vgClassSessionSelection.ConvertTodecimal(O+e.actualTaxprice,10,!0)}),d.length>1)if(B!=F||1==o&&x!=O){for(var M=t[n].eventEnrollment.length-1;M>=0&&1==(T=t[n].eventEnrollment[M]).isPackage;M--);if(B!=F){var E=0;E=parseFloat((F-B).toFixed(2)),T.price=_vgClassSessionSelection.ConvertTodecimal(T.price+E,2,!0),B=_vgClassSessionSelection.ConvertTodecimal(B+E,2,!0)}if(1==o&&x!=O){var $=0;$=parseFloat((O-x).toFixed(2)),T.taxprice=_vgClassSessionSelection.ConvertTodecimal(T.taxprice+$,2,!0),x=_vgClassSessionSelection.ConvertTodecimal(x+$,2,!0)}}t[n].actualPrice=F,t[n].roundedPrice=B,t[n].actualTaxprice=O,t[n].roundedTaxprice=x}}1==d.length&&d[0].customerID==parseInt(UserID)&&e.each(t[n].eventEnrollment,function(){this.IsshowUserName=!1})}if(n==t.length-1){var N=0,L=0,U=0,R=0;if(e.grep(t,function(e){N=_vgClassSessionSelection.ConvertTodecimal(N+e.roundedPrice,2,!0),L=_vgClassSessionSelection.ConvertTodecimal(L+e.roundedTaxprice,2,!0),U+=e.actualPrice,R+=e.actualTaxprice}),U=_vgClassSessionSelection.ConvertTodecimal(U,2,!0),R=_vgClassSessionSelection.ConvertTodecimal(R,2,!0),t.length>1&&(U!=N||1==o&&L!=R)){var G,W;e:for(var V=t.length-1;V>=0;V--)for(var j=t[V].eventEnrollment.length-1;j>=0;j--)if(G=t[V].eventEnrollment[j],W=t[V],1!=G.isPackage)break e;if(U!=N){E=0;E=parseFloat((U-N).toFixed(2)),G.price=_vgClassSessionSelection.ConvertTodecimal(G.price+E,2,!0),W.roundedPrice=_vgClassSessionSelection.ConvertTodecimal(W.roundedPrice+E,2,!0),N=_vgClassSessionSelection.ConvertTodecimal(N+E,2,!0)}if(1==o&&L!=R){$=0;$=parseFloat((R-L).toFixed(2)),G.taxprice=_vgClassSessionSelection.ConvertTodecimal(G.taxprice+$,2,!0),W.roundedTaxprice=_vgClassSessionSelection.ConvertTodecimal(W.roundedTaxprice+$,2,!0),L=_vgClassSessionSelection.ConvertTodecimal(L+$,2,!0)}}var H=0,Y=0;e.grep(t,function(t){var i=0,a=0;e.grep(t.eventEnrollment,function(e){1==e.isPackage?(Y=_vgClassSessionSelection.ConvertTodecimal(Y+e.price,2,!0),a=_vgClassSessionSelection.ConvertTodecimal(a+e.price,2,!0)):0==e.isPackage&&(H=_vgClassSessionSelection.ConvertTodecimal(H+e.price,2,!0),i=_vgClassSessionSelection.ConvertTodecimal(i+e.price,2,!0))}),t.roundedPrice=parseFloat((t.roundedPrice-(i+a)).toFixed(2)),e("#spn-"+t.eventID).html(_shopdetail.currencySymbol+t.roundedPrice.toFixed(2)),t.actualPrice=t.roundedPrice}),e("#lblsubtotal").text(parseFloat((N+L).toFixed(2)).format("#.##")),L>0?e("#liAmountDue").text("Total Amount Due (Tax: "+_shopdetail.currencySymbol+L.format("#.##")+"):"):e("#liAmountDue").text("Total Amount Due:"),e("#lblGCDetail").text(H.format("#.##")),e("#lblPackageDetail").text(Y.format("#.##"));var Z=parseFloat((N+L-(H+Y)).toFixed(2));e("#lbltotalorderamt").text(Z.format("#.##")),1==o&&Z<=0?e(".divcreditCardWrapper").hide():1==o&&Z>0&&e(".divcreditCardWrapper").show(),1==o&&H<=0?(e("#liGCDetail").hide(),e("#liGCRedeem").hide()):1==o&&H>0&&(e("#liGCDetail").show(),e("#liGCRedeem").show()),1==o&&Y<=0?(e("#liPackageDetail").hide(),e("#liPackageRedeem").hide()):1==o&&Y>0&&(e("#liPackageDetail").show(),e("#liPackageRedeem").show()),_vgClassSessionSelection.SetIntoSessionStorage(_vgClassSessionSelection.model.EventStorage,t)}}return t},_shopdetail.CloseDateControl=function(){HideShowdatepicker(!1,{divid:"#divEventFromDate",textid:"#txtEventFromDate"})},_shopdetail.FormatDate=function(e){return new Date(e).format("MMM-dd-yyyy")},_shopdetail.ConfirmException=function(){var t=parseInt(e("#hdneventId").val()),i=[],a=[];if(void 0!==localStorage.Event)try{i=JSON.parse(localStorage.Event)}catch(e){i=[]}if(void 0!==localStorage.Exception)try{a=JSON.parse(localStorage.Exception)}catch(e){a=[]}if(i.length>0&&a.length>0){var r=e.grep(a,function(e){return 0==e.isClassFull});if(r.length>0){var o={};if(o.eventID=t,o.eventEnrollment=[],i.length>0){var n=e.grep(i,function(e){return e.eventID==o.eventID});n.length>0&&(o.eventEnrollment=n[0].eventEnrollment)}for(var s=0;s<=r.length-1;s++){var l={};if(0==o.eventEnrollment.length?l.autoID=1:l.autoID=Math.max.apply(Math,o.eventEnrollment.map(function(e){return e.autoID}))+1,l.eventID=t,l.customerID=UserID,l.eventDate=r[s].eventDate,0==r[s].isMultipleSP){var d=r[s].SPAvalibility[0];l.serviceProviderID=r[s].SPID,l.appointmentID=parseInt(d.appointmentID),l.startTime=d.strStartTime,l.endTime=d.strEndTime,l.duration=d.eventDuration}else{var c=e("#ddlSPDetail-"+r[s].autoId);(d=e.grep(r[s].SPAvalibility,function(e){return e.serviceProviderID==parseInt(c.val())})).length>0&&(l.serviceProviderID=parseInt(c.val()),l.appointmentID=parseInt(d.appointmentID),l.startTime=d.strStartTime,l.endTime=d.strEndTime,l.duration=d.eventDuration)}o.eventEnrollment.push(l)}if(i.length>0)i=e.grep(i,function(e){return e.eventID!=o.eventID});i.push(o)}}else _common.CallFailed,_shopdetail.ShowHideClassPopup(!1)},_shopdetail.DeleteEventDetail=function(t,i){"undefined"!=typeof bootbox&&bootbox.confirm({title:"Confirm",message:"Are you sure you want to delete this item?",callback:function(a){if(a){ShowLoader(!0);var r=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage);if(r.length>0)for(var o=0;o<=r.length-1;o++)if(r[o].eventID==t)if(t>0&&i>0){var n=e.grep(r[o].eventEnrollment,function(e){return e.autoID!=i});n.length>0?(r[o].eventEnrollment=n,e("#p-cart-"+t+"-"+i).remove(),1==r[o].eventEnrollment.length&&e("#deleteitem-"+t).hide()):(r.splice(o,1),e("#div-cart-"+t).remove())}else t>0&&(r.splice(o,1),e("#div-cart-"+t).remove());r.length>0?(e(".divNoitem").hide(),e(".divcartitem").show(),_vgClassSessionSelection.SetIntoSessionStorage(_vgClassSessionSelection.model.EventStorage,r),_shopdetail.CalculatePriceAndTaxOnCart(r,null,null,!0)):(e(".divNoitem").show(),e(".divcartitem").hide(),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),e("#lblsubtotal").text(0),e("#lbltotalorderamt").text(0)),e("#lblEventCart").html(r.length),ShowLoader(!1)}}})},e.createElement=function(t,i){var a=e("<"+t+" />");return null==i?a:a.text(i)},_shopdetail.validateClassData=function(){var e="Online";return null!=_shopdetail.isFacebook&&"true"==_shopdetail.isFacebook?e="Facebook":null!=_shopdetail.isWidget&&"true"==_shopdetail.isWidget&&(e="Widget"),_vgClassSessionSelection.validateClassDataOnAddAttendee(UserID,1==_shopdetail.IsCCDetailEnable()?1:2,e),!1},_shopdetail.findXmlNodeByVal=function(t,i,a){var r=null;return e.each(t.find(i),function(t,i){e(i).html()!=a.toString()||(r=e(i))}),r},_shopdetail.findClassNameByAppId=function(t){var i=_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage),a="";return e.each(i,function(i,r){e.each(r.eventEnrollment,function(e,i){i.appointmentID!=t||(a=r.eventName)})}),a},_shopdetail.bindTemplate=function(t,i,a,r){e("#tBodyClassValidationTemp").html(""),e("#classValidationCheckout").tmpl(r).appendTo("#tBodyClassValidationTemp")},_shopdetail.ConfirmEventcancel=function(){"undefined"!=typeof bootbox&&bootbox.confirm({title:"Confirm",message:"Are you sure you want to cancel this order?",callback:function(t){t&&(_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.EventStorage),_vgClassSessionSelection.ClearSessionStorage(_vgClassSessionSelection.model.ExceptionStorage),e("#lblEventCart").html("0"),_shopdetail.ShowHideCart(!1))}})},_shopdetail.resetCartQty=function(){_vgClassSessionSelection.GetSessionStorage(_vgClassSessionSelection.model.EventStorage).length<=0&&e("#lblEventCart").html("0")},_shopdetail.ClearEventCCDetail=function(){1==_shopdetail.IsCCDetailEnable()&&(e("#btnEventChangePaymentMethod").hide(),e("#ulStoredEventCCInfo").hide(),e("#chkmoneyback").prop("checked",!1))},_shopdetail.GetIframeforClass=function(){isCCChanged=!0,e("#eventCCFrame").html(""),LoadCCFrame("eventCCFrame")},_shopdetail.DisabledEventCCDetail=function(t){e("#cboEventCardType").prop("disabled",t),e("#txEventCCNo").prop("disabled",t),e("#txtEventSecurityCode").prop("disabled",t),e("#txtEventFName").prop("disabled",t),e("#txtEventMName").prop("disabled",t),e("#txtEventLName").prop("disabled",t),e("#txtCCMonthYear").prop("disabled",!0),1==t?e(".eventcreditCardInfo .dropdowndiv").addClass("disabled"):e(".eventcreditCardInfo .dropdowndiv").removeClass("disabled")},_shopdetail.SetEventUserCCDetail=function(){e("#hdnIsFromPage").val("onlineclass"),1==_shopdetail.IsCCDetailEnable()?_shopdetail.SetEventUserCCDetailCallSuccess(gblEventCCRes):(e("#divEventCartDetail").removeAttr("style").hide(),e("#divSearch").hide(),e("#divmainEventdetail").hide(),e("#divEventCartDetail").show(),gblEventCCRes=null,_shopdetail.DisabledEventCCDetail(!1),ShowLoader(!1))},_shopdetail.SetEventUserCCDetailCallSuccess=function(t){if(gblEventCCRes=t,null!=t&&null!=t.CreditCardNumber)if("False"===AcceptAmex&&"AmericanExpress"==t.CreditCardType)_shopdetail.ClearEventCCDetail(),_shopdetail.DisabledEventCCDetail(!1),_shopdetail.GetIframeforClass();else{e("#btnEventChangePaymentMethod").show();var i=t.CreditCardNumber;i=i.length>0?String.format("xxxxxxxxxxxx-{0}",i):"",e("#txEventCCNo").val(i),e("#cboEventCardType").val(t.CreditCardType),e("#ulStoredEventCCInfo #cardimage1").removeAttr("class"),e("#ulStoredEventCCInfo #cardimage1").addClass("input-cardtype "+glbRes.CreditCardType.toLowerCase()),e("#txtEventSecurityCode").val(t.SecurityCode),e("#cboEventMonth").val(t.ExpMonth);var a=e("#cboEventYear"),r=null;null!=t.ExpYear?(r=2==(r=""+t.ExpYear).length?"20"+r:r,a.val(r)):a.val(e(a).attr("year")),e("#txtEventFName").val(t.CCFirstName),e("#txtEventMName").val(t.CCMiddleName),e("#txtEventLName").val(t.CCLastName),e("#ulStoredEventCCInfo").show(),e("#eventCCFrame").hide(),e("#eventCCFrame").html(""),e("#hdnCCTokenID").val(t.CardTokenId),_shopdetail.DisabledEventCCDetail(!0),ShowLoader(!1)}else _shopdetail.GetIframeforClass(),_shopdetail.ClearEventCCDetail(),_shopdetail.DisabledEventCCDetail(!1);e("#divEventCartDetail").removeAttr("style").hide(),e("#divSearch").hide(),e("#divmainEventdetail").hide(),e("#divEventCartDetail").show()};var t,a="",r=null;_shopdetail.CheckUserhasCreditcardOrNot=function(e){ShowLoader(!0),r=null,a=e;var t={lUserID:UserID,lBusinessID:_shopdetail.businessID,isAmaxSupport:"False"!==AcceptAmex,EncryptUserId:glbEncryptUserId};vagaro.ajaxCall(ApiPath+ApiURLEnumBooking.getuserccdetailsbyonlyuserid,t,_shopdetail.CallSuccess_UserCCData,function(e){_shopdetail.CallPageBasedOnValue()},!1,!0)},_shopdetail.CallSuccess_UserCCData=function(t){var i;ShowLoader(!1),void 0!==t&&null!=t&&(i=e.grep(t,function(e){return 1==e.isselfcard})),i=void 0===i||0==i.length?null:i[0],null==(r=i)?_shopdetail.CallPageBasedOnValue():_shopdetail.businessID==r.BusinessID?(glbRes=r,gblEventCCRes=r,_shopdetail.CallPageBasedOnValue()):(void 0!==ShowLoader&&e.isFunction(ShowLoader)&&ShowLoader(!1),e("#spnLastDigits").text(r.CreditCardNumber+" "),e("#divUserCCConfirmtion").modal("show"))},_shopdetail.CallPageBasedOnValue=function(){"onlineappointment"==a?_shopdetail.ShowCCDetailPopup("shopdetail"):"onlineclass"==a?_shopdetail.SetEventUserCCDetail():"onlinegc"==a?_shopdetail.ShowCCDetailPopup("onlinegc"):"onlineshoppingcart"==a&&_shopdetail.ShowCCDetailPopup("onlineshoppingcart")},_shopdetail.AddSaveCard=function(){glbRes=r,gblEventCCRes=r;var e=new vagaro.ajax;e.datamodel.Token="SaveUserCCDetails",e.datamodel.callback=_shopdetail.CloseSaveCard,e.datamodel.data=[_shopdetail.businessID,UserID,r.CreditCardNumber,r.CreditCardType,r.SecurityCode,0,r.CardTokenId,r.CCFirstName,r.CCMiddleName,r.CCLastName,!0],e.datamodel.Error=function(e){_shopdetail.CallPageBasedOnValue()},e.Post()},_shopdetail.CloseSaveCard=function(){e("#divUserCCConfirmtion").modal("hide"),_shopdetail.CallPageBasedOnValue()},_shopdetail.setCustomWebBanner=function(){null!=_shopdetail.isFacebook&&"false"==_shopdetail.isFacebook&&null!=_shopdetail.isWidget&&"true"==_shopdetail.isWidget||(null!=_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite.toString()||null!=_shopdetail.isFacebook&&"true"==_shopdetail.isFacebook||null!=_shopdetail.isWidget&&"true"==_shopdetail.isWidget)&&("undefined"!=typeof BasePage&&"DETAIL"==BasePage.toUpperCase()?""!=BackgroundImageForDetailPage&&e("#bodybackground").attr("data-original",WallpaperContainerURL+"/BackPattern/Original/"+BackgroundImageForDetailPage).lazyload():"undefined"!=typeof BasePage&&"SHOPPINGCARTCHECKOUT"==BasePage.toUpperCase()&&setCustomBanner())},_shopdetail.BookingDetail={},gbltotPrice=0,_shopdetail.HideShowLoader=function(e){void 0!==ShowLoader&&ShowLoader(1==e)},_shopdetail.SetBookingDetail=function(t){SBCancellationPolicy=e("#dvOnlineBookingCancellationPolicy").html(),_shopdetail.HideShowLoader(!0),BusinessBookingDetail=t,e("#dvBookingPaymentMethod").hide(),e("#divCheckoutBookingPromoCodeService").hide(),e("#txtPromoCodeService").val(""),e("#ddOutcall").hide(),e("#ddPhone").hide(),e("#hBusinessName").html(businessName),e("#hBusinessNameForForms").html(businessName),e("#divPhone").removeClass("inputError"),e("#divCell").removeClass("inputError"),null!=lAppID&&0!=lAppID||(e("#txtComment").val(""),e("#txtCell").val(""),e("#txtPhone").val(""),e("#cboGenderInfo").val("0")),""!=CustomerAddress&&null!=CustomerAddress||SetCustomerAddress(),"0"==e("#hdnOutcallType").val()&&(1==serviceType?e("#OutCallTab3").click():2==serviceType?(e("#OutCallTab3").hide(),e("#OutCallTab1").click()):3==serviceType&&e("#OutCallTab2").click()),e("#hdnOutcallType").val(),_shopdetail.EnableDisableButton(!0);var i="",a=0,r=!1;t.AppSrNo="";for(var o=0;o<t.serviceid.split(",").length;o++){a+=parseFloat(t.price.split(",")[o]);var n="";"false"==t.IsShowPriceOnline.split(",")[o].toLowerCase()&&0==r&&(r=!0);for(var s=o+1,l=_shopdetail.SelectedAddonCount("",t.serviceid.split(",")[o],s),d=0;d<SelectedAddonService.length;d++)if(SelectedAddonService[d].MainServiceID==t.serviceid.split(",")[o]&&SelectedAddonService[d].SrNo==s&&0!=SelectedAddonService[d].ServiceProviderId)for(var c=0;c<SelectedAddonService[d].lstAddonService.length;c++){a+=parseFloat(SelectedAddonService[d].lstAddonService[c].Price),_shopdetail.BookingDetail.AddonServiceAmt+=parseFloat(SelectedAddonService[d].lstAddonService[c].Price);var u=!0;void 0!==SelectedAddonService[d].lstAddonService[c].IsShowPriceOnline&&0==SelectedAddonService[d].lstAddonService[c].IsShowPriceOnline&&(u=!1),n+='<div class="chk-addon-row1"><div> <div class="web-body-font addonwid85 web-builder-font-color"><span class="font-awesome-normal-pro plus-icon-addon"></span>'+SelectedAddonService[d].lstAddonService[c].ServiceTitle+'</div><div id="divAddPD_'+SelectedAddonService[d].lstAddonService[c].ServiceId+"_"+SelectedAddonService[d].SrNo+'" class="web-body-font web-builder-font-color"></div></div><div id="divPricePoint_'+SelectedAddonService[d].lstAddonService[c].ServiceId+"_"+SelectedAddonService[d].SrNo+'" class="web-body-font  web-builder-font-color '+(1==u?"":"displaynone")+' ">'+_shopdetail.DisplayAmountOnCart(t.CurrencySymbol,SelectedAddonService[d].lstAddonService[c].Price)+'</div></div><div class="brand-name-checkout thm-textColor discount" id="divAddonPoint_'+SelectedAddonService[d].lstAddonService[c].ServiceId+"_"+SelectedAddonService[d].SrNo+'" style="display:none;"></div><div class="brand-name-checkout thm-textColor discount" id="divAddonPack_'+SelectedAddonService[d].lstAddonService[c].ServiceId+"_"+SelectedAddonService[d].SrNo+'" style="display:none;"></div><div class="brand-name-checkout thm-textColor discount" id="divAddonMem_'+SelectedAddonService[d].lstAddonService[c].ServiceId+"_"+SelectedAddonService[d].SrNo+'" style="display:none;"></div><div class="brand-name-checkout thm-textColor discount" id="divAddonPD_'+SelectedAddonService[d].lstAddonService[c].ServiceId+"_"+SelectedAddonService[d].SrNo+'" style="display:none;"></div>'}if(i+='<div id="div'+o+"_"+t.serviceid.split(",")[o]+'" class="service-div-checkout">',"undefined"!==t.IsServicePerformAtSameTime.split(",")[0]&&"true"==t.IsServicePerformAtSameTime.split(",")[0].toLowerCase()?0==o&&(i+='<div class="service-time web-display-medium-default web-builder-font-color"><div>'+countryDateFormat(new Date(t.date.split(",")[0]),VagaroCountryDateFormat.LargeDate)+"</div><div>"+t.starttime.split(",")[o].replace(/^0+/,"")+"</div></div>"):i+='<div class="service-time web-display-medium-default web-builder-font-color"><div>'+countryDateFormat(new Date(t.date.split(",")[0]),VagaroCountryDateFormat.LargeDate)+"</div><div>"+t.starttime.split(",")[o].replace(/^0+/,"")+"</div></div>","undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee){var p=t.ServiceProviderPhoto.split("~")[o];void 0!==p&&""!=p&&null!=p&&-1==p.indexOf("user-male-img_155_new.png")&&-1==p.indexOf("user-female-img_155.jpg")?i+='<div class="overall-service-div web-builder-font-color"><div class="service-provider-div"><div class="div-block-38"><div class="w-clearfix"><div class="confirm nav-profile-photo serviceProviderImage serviceProviderImageSqqure lazy vagaro-avatar-md" data-original="'+t.ServiceProviderPhoto.split("~")[o]+'"> </div><div class="div-block-37"><div class="product-name web-body-font hold-text web-builder-font-color">'+(t.servicename.split("||~||")[o].length>=28?t.servicename.split("||~||")[o].substring(0,25)+"..":t.servicename.split("||~||")[o])+l+'</div></div></div></div><div class="service-price">':i+='<div class="overall-service-div web-builder-font-color"><div class="service-provider-div"><div class="div-block-38"><div class="w-clearfix"><div class="div-block-37"><div class="product-name web-body-font hold-text web-builder-font-color">'+(t.servicename.split("||~||")[o].length>=28?t.servicename.split("||~||")[o].substring(0,25)+"..":t.servicename.split("||~||")[o])+l+'</div></div></div></div><div class="service-price">'}else i+='<div class="overall-service-div web-builder-font-color"><div class="service-provider-div"><div class="div-block-38"><div class="w-clearfix"><div class="confirm nav-profile-photo serviceProviderImage lazy vagaro-avatar-md" data-original="'+t.ServiceProviderPhoto.split("~")[o]+'"><div class="avatar-inital intialsname bordered-avatar vg-avatar-inital"><div class="avatar-inital-inner vg-avatar-inital-inner"><div class="avatar-inital-inner-text loginUserIntials vg-avatar-inital-inner-text web-builder-font-color">'+FindInitials(t.spname.split(",")[o].length>2?t.spname.split(",")[o]:"","SP")+'</div></div></div></div><div class="div-block-37"><div class="product-name web-body-font hold-text online-product-text-bold web-builder-font-color" style="font-weight:bold !important">'+(t.spname.split(",")[o].length>=22?t.spname.split(",")[o].substring(0,19)+"..":t.spname.split(",")[o])+'</div><div class="product-name web-body-font hold-text web-builder-font-color">'+(t.servicename.split("||~||")[o].length>=28?t.servicename.split("||~||")[o].substring(0,25)+"..":t.servicename.split("||~||")[o])+l+'</div></div></div></div><div class="service-price">';"false"==t.IsShowPriceOnline.split(",")[o].toLowerCase()?i+='<div class="product-name thm-textColor divPrepayPricedisplay web-body-font web-builder-font-color" id="divPricePoint_'+(o+1)+'" style="display:none;">':i+='<div class="product-name web-body-font hold-text web-builder-font-color web-builder-font-color">'+("true"==t.IsShowPriceAsStartingPoint.split(",")[o].toLowerCase()?"starting at &nbsp":"")+'</div><div class="product-name thm-textColor divPrepayPricedisplay web-body-font web-builder-font-color" id="divPricePoint_'+(o+1)+'">',i+=_shopdetail.DisplayAmountOnCart(t.CurrencySymbol,t.price.split(",")[o])+(t.pointredeem.split(",")[o]>0?" or "+t.pointredeem.split(",")[o]+" Points":"")+'</div></div></div><div class="brand-name-checkout thm-textColor discount web-builder-font-color" id="div_'+(o+1)+'" style="display:none;"></div><div class="brand-name-checkout thm-textColor discount web-builder-font-color" id="divMem_'+(o+1)+'" style="display:none;"></div><div class="brand-name-checkout thm-textColor discount web-builder-font-color" id="divPD_'+(o+1)+'" style="display:none;"></div>'+n+"</div></div > "}i+='<div class="chk-addon-row1 chk-addon-left0 package-mem-checkout-design web-builder-font-color" id="divMemUpsell" style="display:none;">1</div><div class="applied-green-part thm-textColor badge-button-positive web-builder-font-color" id="divMemUpsellPrice_Preset" style="display:none;"></div><div class="applied-green-part thm-textColor badge-button-positive web-builder-font-color" id="divMemUpsellPrice_Deals" style="display:none;"></div><div id="scffsharingMS" class="scffsharing web-builder-font-color" style="display:none;"> </div>',i+='<div class="chk-addon-row1 chk-addon-left0 package-mem-checkout-design web-builder-font-color" id="divPackageUpsell" style="display:none;"></div><div class="applied-green-part thm-textColor badge-button-positive web-builder-font-color" id="divPackageUpsellPrice_Preset" style="display:none;"></div><div class="applied-green-part thm-textColor badge-button-positive web-builder-font-color" id="divPackageUpsellPrice_Deals" style="display:none;"></div><div id="scffsharingPkg" class="scffsharing web-builder-font-color" style="display:none;"> </div>',gbltotPrice=a,e("#divServicesTotalPrepay").hide(),1==r?(e("#divServicesTotal").hide(),e("#divServicesTotalPrice_mobile").hide()):(e("#divServicesTotal").show(),e("#divServicesTotalPrice_mobile").show());var h=_shopdetail.DisplayAmountOnCart(t.CurrencySymbol,a);e("#divServicesTotalPrice").html(h),_shopdetail.vplamt=a,_shopdetail.VPLMessage(_shopdetail.vplamt),e("#divServicesTotalPrice_mobile").html(h),e("#divServicesTotalduePrice").length>0&&e("#divServicesTotalduePrice").html(h),e("#divServices").html(i),e(".serviceProviderImage").lazyload({event:"lazyload",effect:"fadeIn",isShowIntials:!0,intial_selecter:".intialsname"}).trigger("lazyload"),void 0!==t.style&&(""!=t.style?(e("#ddStyle").show(),e("#lblStyle").html(t.style.split(":")[1])):e("#ddStyle").hide());var m=!1;"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&""!=e("#hdnAllowCCCapturedAbove").val()&&a>=parseFloat(e("#hdnAllowCCCapturedAbove").val())&&(m=!0),1==m&&void 0!==IsPaid&&""!=IsPaid&&"true"==IsPaid.toString().toLowerCase()&&(m=!1);var f=e("<XMLDocument/>");f.append(_vgClassSessionSelection.createXmlElement("itms").append(_vgClassSessionSelection.createXmlElement("itm").append(_vgClassSessionSelection.createXmlElement("ity",1)).append(_vgClassSessionSelection.createXmlElement("ns"))));for(o=0;o<t.serviceid.split(",").length;o++){var g=_vgClassSessionSelection.createXmlElement("n",t.serviceid.split(",")[o]);f.find("ns").append(g)}for(d=0;d<SelectedAddonService.length;d++)for(var v=0;v<t.serviceid.split(",").length;v++)if(SelectedAddonService[d].MainServiceID==t.serviceid.split(",")[v])for(c=0;c<SelectedAddonService[d].lstAddonService.length;c++){var A=_vgClassSessionSelection.createXmlElement("n",SelectedAddonService[d].lstAddonService[c].ServiceId);f.find("ns").append(A)}var C=0;"undefined"!=typeof isWaitingtoreal&&"undefined"!=typeof waitlistID&&0!=isWaitingtoreal&&0!=waitlistID&&(C=waitlistID),"undefined"!=typeof BookNowjsVersion&&""==BookNowjsVersion?bookNowjsVersion="1":"undefined"!=typeof BookNowjsVersion&&""!=BookNowjsVersion&&(bookNowjsVersion=BookNowjsVersion),"undefined"!=typeof IsRescheduleAppointment&&null!=IsRescheduleAppointment&&"true"==IsRescheduleAppointment.toLocaleLowerCase()&&"undefined"!=typeof lAppUserID&&null!=lAppUserID&&""!=lAppUserID?LAppUserID=lAppUserID:LAppUserID=UserID;var y={};y.lBusinessID=e("#hdnBusinessID").val(),y.isOutcall=t.isoutcall,y.isAmaxSupport="False"!==AcceptAmex,y.isRequireCCCapture=m,y.ServiceId=_shopdetail.BookingDetail.serviceid,y.IsPaid=IsPaid,y.ServiceList=f.html(),y.WaitlistID=C,y.BookNowjsVersion=bookNowjsVersion,y.lAppUserID=LAppUserID,y.ServiceDate=_shopdetail.BookingDetail.date,""!=lAppID&&!String.isNullOrUndefineOrBlank(HouseCallGroupID)&&lAppID.split(",").length>1?y.AppointmentID=parseInt(lAppID.split(",")[0]):y.AppointmentID=""==lAppID?0:lAppID,y.ServiceProviderID=y.AppointmentID>0?_shopdetail.BookingDetail.spid:0,y.ServiceProviderIDs=_shopdetail.BookingDetail.spid,!String.isNullOrUndefineOrBlank(HouseCallGroupID)&&_shopdetail.BookingDetail.spid.split(",").length>1&&(y.ServiceProviderIDs=_shopdetail.BookingDetail.spid,y.ServiceProviderID=0),void 0!==_siteBuilderDetail.ComponentResponse.lstUserInfo&&null!=_siteBuilderDetail.ComponentResponse.lstUserInfo?y.LoginUserGroup=_siteBuilderDetail.ComponentResponse.lstUserInfo.GroupID:y.LoginUserGroup="",(1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()||_shopdetail.EnableFMBFee()&&void 0!==_shopdetail.BookingDetail.PromotionId&&null!=_shopdetail.BookingDetail.PromotionId&&_shopdetail.BookingDetail.PromotionId.toString().split(",").some(function(e){return parseInt(e||0)>0}))&&(y.RequiredCheckoutData=!0),"OnBoarding"==getQueryStringData("Type")&&(e("html").removeClass("bookingappointment1"),e("html").removeClass("bookingappointment3"),e("html").addClass("bookingappointment2"));var b={objRequest:y},S=new vagaro.ajax;S.datamodel.Token="GetUserDetailToBookApp_New",S.datamodel.data=b,S.datamodel.callback=_shopdetail.CallSuccess_SetBookData,S.datamodel.Error=function(e){_shopdetail.HideShowLoader(!1)};try{if(0!=IsMobileServiceMandatoryInBusiness&&1==t.isoutcall&&(""==e("#txtAddressUser").val()||null==e("#txtAddressUser").val()||void 0===e("#txtAddressUser").val())&&0==e("#dvAtBusiness:visible").length&&0==e("#dvOutCallSection").is(":visible"))return _shopdetail.HideShowLoader(!1),void OpenIsOutCallModal();S.Post()}catch{S.Post()}InPageWidget_Ios&&e("body").css("height","auto"),e("#dvOnlineBooking").show(),_common.nestedHiddenElement("#tabnav")>0&&(istabnavDivShow=!0,e("#tabnav").hide()),_common.nestedHiddenElement("#topBannerSection")>0&&(istopBannerSectionDivShow=!0,e("#topBannerSection").hide()),_common.nestedHiddenElement("#divSearch")>0&&(isdivSearchDivShow=!0,e("#divSearch").hide()),_common.nestedHiddenElement("#divClassAppResult")>0&&(isdivClassAppResultDivShow=!0,e("#divClassAppResult").hide()),_common.nestedHiddenElement("#divCustomMessage")>0&&(isdivCustomMessageDivShow=!0,e("#divCustomMessage").hide()),_common.nestedHiddenElement("#footerdiv")>0&&(isfooterdivDivShow=!0,e("#footerdiv").hide()),_common.nestedHiddenElement("#pushdiv")>0&&(ispushdivDivShow=!0,e("#pushdiv").hide()),""==SBCancellationPolicy?e("#chktextmarketingTextPreview").hide():e("#chktextmarketingTextPreview").show(),e("body").addClass("book-checkout"),e("html, body").scrollTop(0),InPageWidget_Ios&&e("body").css("height","")},_shopdetail.SetActiveServiceLocationTab=function(){e("#OutCallTab1").removeClass("w--current"),e("#OutCallTab2").removeClass("w--current"),e("#OutCallTab3").removeClass("w--current"),1==e("#hdnOutcallType").val()?e("#OutCallTab3").addClass("w--current"):2==e("#hdnOutcallType").val()?e("#OutCallTab1").addClass("w--current"):3==e("#hdnOutcallType").val()&&e("#OutCallTab2").addClass("w--current")},_shopdetail.CallSuccess_SetBookData=function(t){if("undefined"!=typeof Isformsloding&&1==Isformsloding?_shopdetail.HideShowLoader(!0):_shopdetail.HideShowLoader(!1),e("#ddOutcall").hide(),0!=IsMobileServiceMandatoryInBusiness&&IsOutCallServiceSelected&&e("#ddOutcall").show(),""!=CustomerAddress&&null!=CustomerAddress||setTimeout(function(){SetCustomerAddress()},500),1==IsMobileServiceMandatoryInBusiness&&(e("#OutCallTab3").hide(),e(".cust-location-housecall").show(),e("#custAddBook").text(CustomerAddress)),0==IsMobileServiceMandatoryInBusiness&&e("#bussinessEdit").hide(),2==IsMobileServiceMandatoryInBusiness&&0!=UserID&&1==e("#hdnOutcallType").val()&&e("#bussinessEdit").show(),2!=IsMobileServiceMandatoryInBusiness&&1!=IsMobileServiceMandatoryInBusiness||(""==CustomerAddress||null==CustomerAddress?e("#OutCallTab1").hide():e("#OutCallTab1").show()),_shopdetail.SetActiveServiceLocationTab(),0!=IsMobileServiceMandatoryInBusiness&&IsOutCallServiceSelected&&3==e("#hdnOutcallType").val()&&e("#OutCallTab2").click(),_shopdetail.HideShowLoader(!1),null==t||void 0===t.bookNowJsVersionMismatch||1!=t.bookNowJsVersionMismatch){if(0==t.userID||void 0===t.lstfriendsandfamily||null==t.lstfriendsandfamily)return _shopdetail.HidePopup(),showCommonLoginPopup("BookAppointment"),!1;e(".familycktbook").show(),"undefined"!=typeof lAppID&&null!=lAppID&&0!=lAppID&&e(".familycktbook").hide(),"undefined"!=typeof isAllowFriendsandFamilyBooking&&0===isAllowFriendsandFamilyBooking?e(".familycktbook").hide():e(".familycktbook").show(),e("#addnewffpopup").hide(),_shopdetail.BindFamilyandFriendDetails(t.lstfriendsandfamily),e("#txtComment").val(t.objGcPackagePointAndUserTaxDetail.WaitlistDetailBooking.Comment),e("#hdnLoggedInUserid").val(t.userID),e("#hdnIsFromPage").val(""),null!=lAppID&&0!=lAppID||void 0===r||null!=r||2!=objVPLData.VPLStatus||0==t.depositsPer||1!=t.isPrePay?e("#dvBookingPaymentMethod").hide():(e("#dvBookingPaymentMethod").show(),e("#dvBookingTabs").show()),e("#divVplTracking").hide(),gbooktext=t.bookText,gNeedAcceptance=!0===t.NeedAcceptance,e("#btnAppointment").show(),e("#btnAppointmentWithCC").hide(),"46994"==_shopdetail.businessID||"351429"==_shopdetail.businessID||"332940"==_shopdetail.businessID?(e("#btnAppointment").text("Book"),e("#btnAppointmentWithCC").text("Book")):(e("#btnAppointment").text(gbooktext),e("#btnAppointmentWithCC").text(gbooktext)),e("#bookoutcalladdresslink").show(),_IsPaymentOption=!1,_IsMemPkgUpSell=!1,_IsPrepay=t.isPrePay,IsFMBEnableForBusiness=t.IsFMBEnableForBusiness,_shopdetail.BookingDetail.IsEnableVCFFee=t.IsEnableVCFFee,_shopdetail.BookingDetail.UserResponse=e.extend(!0,[],t),_shopdetail.BookingDetail.DepositsPer=t.depositsPer,_shopdetail.BookingDetail.DepositsLimit=t.depositsLimit,_shopdetail.BookingDetail.DepositAmtType=t.IsDepositAmtType,_shopdetail.BookingDetail.DailyDealVagaroFee=t.DailyDealVagaroFee,_shopdetail.BookingDetail.DailyDealVagaroFee_ExistingUser=t.DailyDealVagaroFee_ExistingUser,_shopdetail.BookingDetail.DailyDealVagaroFeeType=t.IsDailyDealVagaroFeeType,_shopdetail.BookingDetail.IsForVeraNewCustomer=t.IsForVeraNewCustomer,_shopdetail.BookingDetail.IsSameDayCustomer=!0===t.IsSameDayCustomer,LastMinuteBookingDays=void 0!==t.LastMinuteBookingWindowHours&&null!=t.LastMinuteBookingWindowHours&&t.LastMinuteBookingWindowHours>0?t.LastMinuteBookingWindowHours:LastMinuteBookingDays,_shopdetail.checkDepositOffOrNot()&&(isDepositOff=!0),_shopdetail.SetDailyDealsFeeInfo(),void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOption&&(_shopdetail.BookingDetail.TipOption=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOption,_shopdetail.BookingDetail.TipType=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipType,void 0!==t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOnItems&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOnItems&&""!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOnItems.toString().trim()&&(tipOnItems=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOnItems)),e("#hdnIsCCCapturedAllowed").val(t.IsCCCapturedAllowed),null!=t.AllowCCCapturedAbove&&""!=t.AllowCCCapturedAbove?e("#hdnAllowCCCapturedAbove").val(t.AllowCCCapturedAbove):e("#hdnAllowCCCapturedAbove").val(""),null!=t.AllowCCCapturedAbove&&""!=t.AllowCCCapturedAbove&&1==t.AllowCCCapturedAbove&&1==t.IsCCCapturedAllowed&&(isCcCaptureRequired=!0),"book"==gbooktext.toLowerCase()?(e("#ddRequest").hide(),e("#lblCancellationPolicy").text("By clicking Book, you agree to the Cancellation Policy and conditions of this business.")):(e("#ddRequest").show(),e("#lblCancellationPolicy").text("By clicking Request, you agree to the Cancellation Policy and conditions of this business."));var i=!1;if(e("#ulFinePrintChild li").each(function(){if(_shopdetail.VisibleControlLength(this)>0)return i=!0,!1}),0==i&&e("#lblLine").hide(),_IsPrepay&&1==t.IsPromotionEnable&&(e("#divCheckoutBookingPromoCodeService").show(),e("#divApplyPromocodeService").empty(),e("#txtPromoCodeService").val("")),IsOutCallServiceSelected)if("3"==e("#hdnOutcallType").val())if(null!=(a=houseCallAddress.getAddressData())&&null!=a.address){serviceType=3;var a,o=(a=houseCallAddress.getAddressData()).address,n=a.address2,s=a.city,l=a.state,d=a.zip,c=(a.country,"");c=(c=(c=(c=(c=o)+(""!=c&&""!=n?", ":"")+n)+(""!=c?", ":"")+s)+(""!=c?", ":"")+l)+(""!=c?", ":"")+d,1==e("#hdnCheckBoxSaveAddress").val()?e("#chksaveaddressinfo").prop("checked",!0):e("#chksaveaddressinfo").prop("checked",!1),e("#"+e("input",e("#s2id_txtAddress")[0].childNodes[0].lastChild)[0].id).val(c),e("#txtStreet2").val(n),houseCallAddress.setAddressData(houseCallAddress.getAddressData()),e("#ctl00_ucAppBookOnline_dvOutCallAddress").html(CustomerAddress),e("#ctl00_ucAppBookOnline_dvOutCallAddress").text(CustomerAddress)}else e("#ctl00_ucAppBookOnline_dvOutCallAddress").html(CustomerAddress),e("#ctl00_ucAppBookOnline_dvOutCallAddress").text(CustomerAddress);else e("#ctl00_ucAppBookOnline_dvOutCallAddress").html(CustomerAddress),e("#ctl00_ucAppBookOnline_dvOutCallAddress").text(CustomerAddress);if(0==t.isCellExist&&(e("#ddPhone").show(),e("#txtCell").val(""),e("#txtPhone").val(""),e("#cboContact").val("1"),_shopdetail.ChangeContactType(1)),void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.IsZoomIntegrated){if(e("#dvStreamApt").show(),e(_shopdetail.divServiceLiveStreamAddressControl).show(),_shopdetail.InitLiveStreamAddressControl(),void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&void 0!==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew&&null!=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew)if(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew.length>1)for(var u=0;u<t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew.length;u++)0==u?_shopdetail.BookingDetail.UtcStartTime=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].UtcStartTime:_shopdetail.BookingDetail.UtcStartTime+=","+t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].UtcStartTime;else void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&void 0!==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout&&null!=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout&&t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout.length>0?_shopdetail.BookingDetail.UtcStartTime=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout[0].UtcStartTime:_shopdetail.BookingDetail.UtcStartTime=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[0].UtcStartTime}else e("#dvStreamApt").hide(),_shopdetail.BookingDetail.UtcStartTime=null,e(_shopdetail.divServiceLiveStreamAddressControl).hide();"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&""!=e("#hdnAllowCCCapturedAbove").val()&&gbltotPrice>=parseFloat(e("#hdnAllowCCCapturedAbove").val())&&(void 0===IsPaid||""==IsPaid||"true"!=IsPaid.toString().toLowerCase())||_IsPrepay||1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()?("False"==AcceptAmex&&null!=t.objUserCCDetails&&"AmericanExpress"==t.objUserCCDetails.CreditCardType&&_shopdetail.businessID!=t.objUserCCDetails.BusinessID&&(t.objUserCCDetails=null),e("#btnAppointment").hide(),e("#btnAppointmentWithCC").show(),_shopdetail.LoadCCSectionForBooking(t.objUserCCDetails,t.lstfriendandfamilycc),_shopdetail.startCreditCardCaptureInterval()):(e("#dvdueblock").hide(),e("#dvCCDescription").hide()),_shopdetail.VPLCalculation(),totalTax=0,_shopdetail.BookingDetail.AppointmentDetail=[];for(u=0;u<_shopdetail.BookingDetail.serviceid.split(",").length;u++){if(objAppointmentDetail={},objAppointmentDetail.AppSrNo=u+1,objAppointmentDetail.servicename=_shopdetail.BookingDetail.servicename.split("||~||")[u],objAppointmentDetail.appBookingDate=new Date(moment(_shopdetail.BookingDetail.date.split(",")[u]).format("YYYY/MM/DD")),objAppointmentDetail.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,objAppointmentDetail.serviceid=parseInt(_shopdetail.BookingDetail.serviceid.split(",")[u]),objAppointmentDetail.price=parseFloat(_shopdetail.BookingDetail.price.split(",")[u]),objAppointmentDetail.pointgiven=parseInt(_shopdetail.BookingDetail.pointgiven.split(",")[u]),objAppointmentDetail.pointredeem=parseInt(_shopdetail.BookingDetail.pointredeem.split(",")[u]),objAppointmentDetail.PromotionId=""==_shopdetail.BookingDetail.PromotionId.split(",")[u]?0:parseInt(_shopdetail.BookingDetail.PromotionId.split(",")[u]),objAppointmentDetail.IsMembershipApply=!1,objAppointmentDetail.ServiceOrginalPrice=parseFloat(_shopdetail.BookingDetail.ServiceOrginalPrice.split(",")[u]),objAppointmentDetail.ServiceOldOrginalPrice=parseFloat(_shopdetail.BookingDetail.ServiceOrginalPrice.split(",")[u]),objAppointmentDetail.pointgivenOriginal=objAppointmentDetail.pointgiven,objAppointmentDetail.pointredeemOriginal=objAppointmentDetail.pointredeem,objAppointmentDetail.priceOriginal=objAppointmentDetail.price,objAppointmentDetail.Tax=0,objAppointmentDetail.redeemAmount=0,objAppointmentDetail.redeemTax=0,objAppointmentDetail.Discount=0,objAppointmentDetail.GCDetail=[],objAppointmentDetail.GCDetailPriceBase=[],objAppointmentDetail.IsServiceBaseGC=!1,objAppointmentDetail.paidType=arrpaidType.UnPaid,objAppointmentDetail.DiscountID=0,objAppointmentDetail.depositsPaid=0,objAppointmentDetail.depositsPercentage=0,objAppointmentDetail.spID=parseInt(_shopdetail.BookingDetail.spid.split(",")[u]),objAppointmentDetail.IsPartialPoint=!1,objAppointmentDetail.PartialPrice=0,objAppointmentDetail.PointPrice=0,objAppointmentDetail.IsDepositsOver=!1,objAppointmentDetail.IsAmountPaid=!1,objAppointmentDetail.TotalApplyPoint=0,void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&void 0!==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew&&null!=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew)for(var p=0;p<t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew.length;p++)t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[p].StreamingStatus&&objAppointmentDetail.serviceid==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[p].ServiceID&&objAppointmentDetail.spID==_shopdetail.BookingDetail.spid.split(",")[u]&&(objAppointmentDetail.CustomerStartTime=moment(_shopdetail.BookingDetail.date).format("yyyy/MM/DD")+" "+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)?_shopdetail.BookingDetail.starttime:_shopdetail.BookingDetail.browserCustomerTime),void 0!==_shopdetail.BookingDetail.browserCustomerTimezone&&(objAppointmentDetail.CustomerTimeZone=_shopdetail.BookingDetail.browserCustomerTimezone)),objAppointmentDetail.serviceid==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[p].ServiceID&&objAppointmentDetail.spID==_shopdetail.BookingDetail.spid.split(",")[u]&&(objAppointmentDetail.taxes=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[p].Taxes);if(void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&void 0!==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout&&null!=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout)for(p=0;p<t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout.length;p++)objAppointmentDetail.serviceid==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout[p].ServiceID&&objAppointmentDetail.spID==_shopdetail.BookingDetail.spid.split(",")[u]&&(objAppointmentDetail.taxes=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout[p].Taxes);for(var h=0;h<_shopdetail.BookingDetail.lstAddonService.length;h++)_shopdetail.BookingDetail.lstAddonService[h].MainServiceID==objAppointmentDetail.serviceid&&_shopdetail.BookingDetail.lstAddonService[h].ServiceProviderId==objAppointmentDetail.spID&&_shopdetail.BookingDetail.lstAddonService[h].SrNo==objAppointmentDetail.AppSrNo&&(objAppointmentDetail.lstAddonService=_shopdetail.BookingDetail.lstAddonService[h].lstAddonService);_shopdetail.BookingDetail.AppointmentDetail.push(objAppointmentDetail)}if(_IsPrepay?_shopdetail.RecalculateHouseCallPriceInside(!1):_shopdetail.RecalculateHouseCallPriceInside(!0),_shopdetail.BookingDetail.TipAmount=0,_shopdetail.BookingDetail.totalFeeAmount=0,_shopdetail.BookingDetail.totalFeeTax=0,void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.BusinessFee?(_shopdetail.BookingDetail.FeeDetails=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.BusinessFee,e.each(_shopdetail.BookingDetail.FeeDetails,function(e,t){t.redeemAmount=0,t.redeemTax=0,t.GCDetail=[],t.GCDetailPriceBase=[],t.ApplyDiscoutType=0})):_shopdetail.BookingDetail.FeeDetails=[],_shopdetail.IsFinalGCCalculation=!0,e("#dvdepositsdescription").hide(),e("#dvdepositsblock").hide(),_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail=e.extend(!0,[],t.objGcPackagePointAndUserTaxDetail),_IsPrepay?(e("#divServicesTotal").show(),e("#divServicesTotalPrice_mobile").show(),e(".divPrepayPricedisplay").show(),_shopdetail.BindPaymentOption(t),_shopdetail.FireBookingCheckoutPageVisited(),_shopdetail.ApplyDiscounts(t.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],t.objGcPackagePointAndUserTaxDetail.lstCheckoutMembershipDetail,t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout),_shopdetail.CalculateTaxForPenny(),_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.ShowTipOptionsButton()):(null!=t&&null!=t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout&&void 0!==t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.IsIncludeTaxInOnlinePricing&&1==t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.IsIncludeTaxInOnlinePricing&&_shopdetail.DisplayTaxForUK(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout),_shopdetail.ValidateOnePerUserDeal(!1),_shopdetail.ValidateAddOnPerUserDeal(!1),_shopdetail.BindFirstTimeCustomerCheckbox()),e("#dvBookingPaymentMethod").is(":visible")?e("#lblCancellationPolicy").css("display","block"):e("#lblCancellationPolicy").css("display","none"),DisplayFullView(!0),void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&void 0!==t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew&&null!=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew)for(u=0;u<t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew.length;u++)if(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].StreamingStatus&&t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].UtcStartTime==_shopdetail.BookingDetail.UtcStartTime.split(",")[u]){if(e("#div"+u+"_"+t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].ServiceID+" .div-block-37").append("<div class='vg-live-stream web-builder-font-color'><em>&#xf03d;</em ><span>Live Stream</span></div >"),IsNewAddressHtml){String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)&&(_shopdetail.BookingDetail.browserCustomerTime=_shopdetail.BookingDetail.starttime);var m=moment(_shopdetail.BookingDetail.date).format("yyyy/MM/DD")+" "+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)?_shopdetail.BookingDetail.starttime:_shopdetail.BookingDetail.browserCustomerTime),f="<div  class='brand-name-checkout thm-textColor timeZone web-builder-font-color'>"+_shopdetail.SetEventDateFormat(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].Custo,m,_shopdetail.BookingDetail.browserCustomerTimezone,!1,t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].ServiceStartTime)+"</div>"}else if(String.isNullOrUndefineOrBlank(e(_shopdetail.txtLiveStreamAddress).val())&&String.isNullOrUndefineOrBlank(e("#hdnServiceLiveStreamSelectedVal").data("actualvalue"))){String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)&&(_shopdetail.BookingDetail.browserCustomerTime=_shopdetail.BookingDetail.starttime);m=moment(_shopdetail.BookingDetail.date).format("yyyy/MM/DD")+" "+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)?_shopdetail.BookingDetail.starttime:_shopdetail.BookingDetail.browserCustomerTime),f="<div  class='brand-name-checkout thm-textColor timeZone web-builder-font-color'>"+_shopdetail.SetEventDateFormat(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].Custo,m,_shopdetail.BookingDetail.browserCustomerTimezone,!1,t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].ServiceStartTime)+"</div>"}else var f="<div  class='brand-name-checkout thm-textColor timeZone web-builder-font-color'>"+_shopdetail.SetEventDateFormat(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].Custo,t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].CustomerStartTime,t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].CustomerTimeZone,!1,t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].ServiceStartTime)+"</div>";e("#div"+u+"_"+t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].ServiceID+" .div-block-37").append(f),e(".service-time").hide(),null!=t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].CustomerStartTime&&liveServiceTime.push(t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].CustomerStartTime+","+t.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew[u].CustomerTimeZone)}else e("#divServices .timeZone").remove(),e(".service-time").show();else e(".service-time").show();isDepositOff?_IsMemPkgUpSell=!1:0==t.isPrePay&&1==t.IsMemPackageUpSell?(_IsMemPkgUpSell=!0,_IsPrepay=!0,_shopdetail.BookingDetail.Prepay={},_shopdetail.BookingDetail.Prepay.lstGCpkgList=[],_shopdetail.BookingDetail.Prepay.lstServiceDetails=[],_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout=[],_shopdetail.BookingDetail.objUserCCDetails=t.objUserCCDetails,_shopdetail.BookingDetail.lstfriendandfamilycc=t.lstfriendandfamilycc,_IsCCDetailsShow=!0):_IsMemPkgUpSell=!1,1!=_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()||"undefined"!=typeof _IsCCDetailsShow&&0!=_IsCCDetailsShow||(_IsCCDetailsShow=!0),null!=t&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout&&void 0!==t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.IsReschedule&&0==t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.IsReschedule&&(vagaro.alert({message:"Rescheduling cannot be done. Please call "+businessName+" at "+_vgClassSessionSelection.FormatPhone(_shopdetail.Telephone)+" to reschedule.",title:"Reschedule Service"}),_shopdetail.BackToAppBook()),(_IsPrepay||1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp())&&_shopdetail.GetMembershipList(_shopdetail.GetAddonsServiceId(),t.userID,!1,""),_shopdetail.IsVCFEnable()&&_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.OnLoad),_shopdetail.PaymentOptionSelectDeselect()}else location.reload(!0)},_shopdetail.startCreditCardCaptureInterval=function(){try{(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase())&&(null!=_onlineCheckout.isFormResponseSubmittedCalled&&_onlineCheckout.isFormResponseSubmittedCalled&&1==_onlineCheckout.formsResponse.length||void 0===_onlineCheckout.formsResponse||_onlineCheckout.formsResponse.length<=0)&&setTimeout(function(){var e={eventName:"CreditCardCaptureViewed",timestamp:(new Date).getTime(),data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:""}};"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(e)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(e),_onlineCheckout.isFormResponseSubmittedCalled=!1},1e3)}catch(e){}},_shopdetail.DisplayTaxForUK=function(t){var i=0,a=0;e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e,r){_shopdetail.CalculateTax(e,t);for(var o=0;o<SelectedAddonService.length;o++)if(_shopdetail.AssignUniqueIdtoAddons(),SelectedAddonService[o].MainServiceID==e.serviceid&&SelectedAddonService[o].SrNo==e.AppSrNo)for(var n=0;n<SelectedAddonService[o].lstAddonService.length;n++){var s=SelectedAddonService[o].lstAddonService[n];_shopdetail.CalculateTaxForAddon(s),i=_shopdetail.parseTodecimal(i+s.Price+_shopdetail.parseTodecimal(s.Tax)),a=_shopdetail.parseTodecimal(a+s.Price)}i=_shopdetail.parseTodecimal(i+e.price+_shopdetail.parseTodecimal(e.Tax)),a=_shopdetail.parseTodecimal(a+e.price)}),_shopdetail.DisplayBusinessTaxes(),(1==e("#divServicesTotal").is(":visible")||_shopdetail.VisibleControlLength("#mobile-check")>0)&&(e("#divServicesSubTotal").html(_shopdetail.BookingDetail.CurrencySymbol+(a>0?_shopdetail.decimalFormate(a):"0.00")),e("#divServicesTotalPrepay").show(),e("#divServicesTotalPrepay").addClass("subtotal-master"),e("#divServicesSubTotalLabel").show(),e("#divServicesTotalPrice").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(i)),e("#divServicesTotalPrice_mobile").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(i)),e("#divServicesTotalduePrice").length>0&&e("#divServicesTotalduePrice").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(i)))},_shopdetail.SetBookButtonTextForForm=function(){var t=0;if("undefined"!=typeof UserID){var i=e(".familycktfrnd ul li.selected").data("value");t=void 0!==i&&UserID!=i?i:UserID}if("undefined"!=typeof lAppUserID&&null!=lAppUserID&&""!=lAppUserID?LAppUserID=lAppUserID:LAppUserID=UserID,"True"==e("#hdnIsFormsEnable").val()&&"false"==IsRescheduleAppointment.toLocaleLowerCase()){ShowLoader(!0);for(var a=!1,r=!1,o=0;o<IsFormApplicableUserArr.length;o++)IsFormApplicableUserArr[o][0]==t&&(a=!0,1==IsFormApplicableUserArr[o][1]&&(r=!0));if(a)r?(e("#btnAppointment").text("Next"),e("#btnAppointmentWithCC").text("Next"),e("#lblCancellationPolicy").text("By clicking Next, you agree to the Cancellation Policy and conditions of this business.")):(e("#btnAppointment").text(gbooktext),e("#btnAppointmentWithCC").text(gbooktext),e("#lblCancellationPolicy").text("By clicking "+gbooktext+", you agree to the Cancellation Policy and conditions of this business.")),ShowLoader(!1);else{var n={serviceIds:hdnCommandArgArray.serviceid,UserIds:t,businessID:getBusinessID(),loginUserID:LAppUserID,callFrom:e("body").hasClass("checkinappbody")?3:1},s=new vagaro.ajax;0==t&&0==LAppUserID&&window.location.reload(),s.datamodel.Token=ApiURLEnumBooking.getformsbyids,s.datamodel.IsNewVagaroAPI=!0,s.datamodel.callback=function(i){ShowLoader(!1),null!=i&&i.length>0?(IsFormApplicableUserArr.push([t,!0]),e("#btnAppointment").text("Next"),e("#btnAppointmentWithCC").text("Next"),e("#lblCancellationPolicy").text("By clicking Next, you agree to the Cancellation Policy and conditions of this business.")):(IsFormApplicableUserArr.push([t,!1]),e("#btnAppointment").text(gbooktext),e("#btnAppointmentWithCC").text(gbooktext),e("#lblCancellationPolicy").text("By clicking "+gbooktext+", you agree to the Cancellation Policy and conditions of this business."))},s.datamodel.data=n,s.datamodel.Error=function(e){ShowLoader(!1)},s.Post()}}else IsFormApplicableUserArr.push([t,!1])},_shopdetail.GetTotalAmountforDeposits=function(){var t=0;return e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){t=i.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?_shopdetail.parseTodecimal(t+i.priceOriginal):_shopdetail.parseTodecimal(t+i.price),null!=i.lstAddonService&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e){t=e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?_shopdetail.parseTodecimal(t+e.priceOriginal):_shopdetail.parseTodecimal(t+e.Price)})}),t},_shopdetail.CheckForDeposits=function(){e("#divBookingSelectPaymentMethodTitle").html(arrPaymentTitleType.Default),e("#dvdepositsblock").show(),e("#dvdueblock").hide(),e("#dvdepositsdescription").hide(),e("#dvdepositsdueblock_mobile").hide(),e("#dvCCDescription").hide(),e("#dvdepositsper").hide();var t=0,i=0,a=0;if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(r){r.paidType==arrpaidType.Deposits?(t+=1,r.IsAmountPaid&&r.IsPartialPoint&&!r.IsDepositsOver?a=a+r.depositsPaid+r.PointPrice:a+=r.depositsPaid,DepositPaidTotalForUpshell=a+r.depositsPaid):r.paidType==arrpaidType.PartiallyPaid?1:r.paidType==arrpaidType.Paid&&(i+=1),null!=r.lstAddonService&&r.lstAddonService.length>0&&e.grep(r.lstAddonService,function(e){e.paidType==arrpaidType.Deposits&&(t+=1,e.IsDepositsAmountPaid&&e.IsPartialPoint&&!e.IsDepositsOver||e.IsPartialPoint?a=a+e.depositsPaid+e.AddonPointPrice:a+=e.depositsPaid,DepositPaidTotalForUpshell=a+e.depositsPaid)})}),i>0&&_shopdetail.BookingDetail.AppointmentDetail.length==i&&0==t)e("#dvdepositsblock").hide();else{if(t>0)IsnotfullyPrePay=!0,e("#dvdepositsper").show(),e("#dvdepositsper").html(_shopdetail.BookingDetail.CurrencySymbol+a.format("#.##")+" Deposit"),e("#divBookingSelectPaymentMethodTitle").html(arrPaymentTitleType.Deposits),e("#dvdepositsdescription").show(),e("#dvdepositsdueblock_mobile").show();else if(0==_shopdetail.BookingDetail.Prepay.depositsAmount&&"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&""!=e("#hdnAllowCCCapturedAbove").val()&&gbltotPrice>=parseFloat(e("#hdnAllowCCCapturedAbove").val())&&(void 0===IsPaid||""==IsPaid||"true"!=IsPaid.toString().toLowerCase()))e("#divBookingSelectPaymentMethodTitle").html(arrPaymentTitleType.HoldOnCard),e("#dvCCDescription").show(),void 0!==GetCCRequiredToSecureAppointmentDescription&&e("#dvCCDescription").html(GetCCRequiredToSecureAppointmentDescription("services")),e("#dvdepositsper").show(),e("#dvdepositsper").html("Hold with Card"),e("#dvdepositsdueblock_mobile").show();else if(1==isDepositOff&&_shopdetail.EnableFMBFee()&&!_shopdetail.IsDailyDealsAppliedInItem()&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()&&_shopdetail.BookingDetail.Prepay.ccAmt<=0&&_shopdetail.parseTodecimal(_shopdetail.BookingDetail.TipAmount||0)<=0)return e("#dvdepositsblock").hide(),void e("#dvdepositsdueblock_mobile").hide();if(e("#dvservicesdepositprice").html(_shopdetail.BookingDetail.CurrencySymbol+(_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount).format("#.##")),e("#dvdepositsdueblock_mobile").html(_shopdetail.BookingDetail.CurrencySymbol+(_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount).format("#.##")+" due now"),e("#dvservicestotalduepriceatbusiness").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.BookingDetail.Prepay.depositsRemaining.format("#.##")),0==t&&_shopdetail.BookingDetail.Prepay.ccAmt<=0&&_shopdetail.BookingDetail.Prepay.depositsRemaining<=0)return void e("#dvdepositsblock").hide();_shopdetail.vplamt=_shopdetail.BookingDetail.Prepay.depositsRemaining,_shopdetail.VPLMessage(_shopdetail.vplamt)}},_shopdetail.VPLMessage=function(t){if(_siteBuilderDetail.isAffirmEnable&&"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&(e("#dvVPLdeposit").removeClass("affirm-as-low-as"),affirm.ui.refresh()),"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&_siteBuilderDetail.isAffirmEnable)return e("#dvVPLdeposit").hide(),e("#VPLImageaftr1").css("display","none"),void e("#VPLImageBfr1").css("display","none");var i=t;if(_siteBuilderDetail.isAffirmEnable){const t="https://vagaro.azureedge.net/static/assets/new_affirm_logo2.png";e("#VPLImageaftr1 img, #VPLImageBfr1 img").attr("src",t).addClass("AffirmImageLogo").addClass("AffirmImageLogo")}if(1==_onlineCheckout.IsVplChanged&&(e("#dvVPLdeposit").hide(),e("#VPLImageaftr1").css("display","none"),e("#VPLImageBfr1").css("display","none")),2==objVPLData.VPLStatus&&"false"==IsRescheduleAppointment.toLocaleLowerCase()){if(1==merchantAccount||1==IsRescheduleAppointment)e("#dvVPLdeposit").hide(),e("#VPLImageaftr1").css("display","none"),e("#VPLImageBfr1").css("display","none");else if("Free"==i||0==i||i<objVPLData.MInVPLAmout)e("#dvVPLdeposit").css("display","block"),e("#dvVPLdeposit")[0].innerText="Pay over time for orders of $"+objVPLData.MInVPLAmout.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",e("#VPLImageaftr1").css("display","block"),e("#VPLImageBfr1").css("display","none"),e("#VPLImageaftr1").attr("aria-label"," Pay over time for orders of $"+objVPLData.MInVPLAmout.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ");else if(i>objVPLData.MaxVPLAmout)e("#VPLImageaftr1").css("display","none"),e("#VPLImageBfr1").css("display","block"),e("#dvVPLdeposit").css("display","block"),e("#dvVPLdeposit")[0].innerText=" is only available for order under $"+objVPLData.MaxVPLAmout.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".",e("#VPLImageBfr1").attr("aria-label"," is only available for order under $"+objVPLData.MaxVPLAmout.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+".");else if(0!=i&&0==_onlineCheckout.isCheckoutVPLChanged){var a=parseFloat(i/4);a=a.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,"),null!=_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay.depositsAmount&&null!=_shopdetail.BookingDetail.Prepay.depositsAmount&&0!=_shopdetail.BookingDetail.Prepay.depositsAmount&&(e("#dvVPLdeposit").css("display","inline"),e("#dvVPLdeposit")[0].innerText=" or 4 payments of "+_shopdetail.currencySymbol+a+" with ",e("#VPLImageaftr1").css("display","inline"),_siteBuilderDetail.isAffirmEnable&&(e("#dvVPLdeposit")[0].innerText="Pay over time for orders of $"+objVPLData.MInVPLAmout.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",e("#dvVPLdeposit").addClass("affirm-as-low-as"),e("#dvVPLdeposit").attr("data-page-type","product"),e("#dvVPLdeposit").attr("data-amount",Math.round(100*i)),e("#VPLImageaftr1").css("display","none"),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?affirm.ui.refresh():e("#VPLImageaftr1").css("display","block"))),e("#VPLImageBfr1").css("display","none"),e("#VPLImageaftr1").attr("aria-label"," or 4 payments of "+_shopdetail.currencySymbol+a+" with vagaro pay later"),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&i<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&(e("#dvVPLdeposit").css("display","none"),e("#VPLImageaftr1").css("display","none"))}}else 1==objVPLData.VPLStatus&&(e("#VPLImageBfr1").css("display","none"),e("#dvVPLdeposit").css("display","none"),e("#dvVPLdeposit")[0].innerText="is not available for this service Provider.")},_shopdetail.SetDailyDealsFeeInfo=function(){0==_IsPrepay&&isDepositOff&&(_IsPrepay=!0,IsForNewCustomer||_shopdetail.BookingDetail.IsForVeraNewCustomer||_shopdetail.BookingDetail.IsSameDayCustomer?_shopdetail.BookingDetail.DepositsPer=_shopdetail.BookingDetail.DailyDealVagaroFee||0:_shopdetail.BookingDetail.DepositsPer=_shopdetail.BookingDetail.DailyDealVagaroFee_ExistingUser||0,_shopdetail.BookingDetail.DepositsLimit=1,_shopdetail.BookingDetail.DepositAmtType=!1)},_shopdetail.checkDepositOffOrNot=function(){try{if(!_shopdetail.EnableFMBFee())return!1;var e=_shopdetail.BookingDetail||{},t=parseFloat(e.DepositsPer||0),i=(e.PromotionId||"").toString().split(",").some(function(e){return parseInt(e||0)>0});return 0==i&&_shopdetail.IsUKBusiness()&&_shopdetail.IsEligibleFMBForUK()&&(i=!0),0==t&&0==_IsPrepay&&1==i||1==i&&("undefined"!=typeof isShoppingTabCartOptionEnable&&!1===isShoppingTabCartOptionEnable||"undefined"!=typeof merchantAccount&&1===merchantAccount)}catch(e){return!1}},_shopdetail.IsDailyDealsAppliedInItem=function(){if(!_shopdetail.EnableFMBFee())return!1;if(_shopdetail.IsUKBusiness()){var e=!1;return!!_shopdetail.IsEligibleFMBForUK()&&(e=!0,(void 0===ischkFirstTimeCustomer||!1!==ischkFirstTimeCustomer||1!=e||0!=_shopdetail.isDailyDealExistsInItems())&&e)}return _shopdetail.isDailyDealExistsInItems()},_shopdetail.isDailyDealExistsInItems=function(){return(_shopdetail&&_shopdetail.BookingDetail&&Array.isArray(_shopdetail.BookingDetail.AppointmentDetail)?_shopdetail.BookingDetail.AppointmentDetail:[]).some(function(e){if(!e)return!1;var t=Number(e.PromotionId||0)>0&&Number(e.price||e.priceOriginal||e.ServiceOrginalPrice||0)>0,i=Array.isArray(e.lstAddonService)&&e.lstAddonService.some(function(e){return e&&Number(e.PromotionID||0)>0&&Number(e.Price||e.NewPrice||e.priceOriginal||0)>0});return t||i})},_shopdetail.GetFMBFeeType=function(){var e=void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness,t=!1;try{t="function"==typeof _shopdetail.isDailyDealExistsInItems&&!0===_shopdetail.isDailyDealExistsInItems()}catch(e){t=!1}return e&&!t?1:!e&&t?2:e&&t?3:0},_shopdetail.EnableFMBFee=function(){return"undefined"!=typeof FMBFeeEnable&&!0===FMBFeeEnable},_shopdetail.IsIncludedInVagaroListing=function(){var e="undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail&&_siteBuilderDetail.AllDetailCommon&&_siteBuilderDetail.AllDetailCommon.BusinessDetail?_siteBuilderDetail.AllDetailCommon.BusinessDetail.IncludedinVagaroListing:void 0;return!0===e||"true"===e||1===e||"1"===e},_shopdetail.IsEligibleFMBForUK=function(){var e=getQueryStringData("Type"),t=getCookie("yelp_attribution"),i=staticEncryptBusinessID;return!baIsUndefine(IsBrandedApp)&&1==IsBrandedApp||"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()||void 0!==e&&""!=e&&"Builder"==e?void 0!==IsFMBEnableForBusiness&&1==IsFMBEnableForBusiness:"undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions||void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()||1==_siteBuilderDetail.isFromAppleClip||1==_siteBuilderDetail.isFromAppClip||!String.isNullOrUndefineOrBlank(i)&&t&&t.businessId&&t.token&&t.businessId===i||"true"==isGoogle&&1!=_siteBuilderDetail.isFromAppleClip&&1!=_siteBuilderDetail.isFromAppClip?_shopdetail.IsIncludedInVagaroListing():void 0!==IsFMBEnableForBusiness&&1==IsFMBEnableForBusiness||_shopdetail.IsIncludedInVagaroListing()},_shopdetail.IsUKBusiness=function(){var t="undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail&&_siteBuilderDetail.AllDetailCommon&&_siteBuilderDetail.AllDetailCommon.BusinessDetail?_siteBuilderDetail.AllDetailCommon.BusinessDetail.CountryID:void 0;return null!=t&&""!==t||(t=e("#hdnBusinessContryId").val()),"2"===String(t)&&!0===("undefined"!=typeof IsForNewCustomer&&null!=IsForNewCustomer&&IsForNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsForVeraNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsSameDayCustomer)},_shopdetail.IsNewCustomerFeesUK=function(){return void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()&&!(void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness)},_shopdetail.IsMarketplaceDevice=function(e){return"string"==typeof e&&e.toLowerCase().indexOf("marketplace")>-1},_shopdetail.GetGCPackageListForDailyDeal=function(e){return _shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem()?Array.isArray(e)?e.filter(function(e){return e&&1==e.isPackage}):[]:e},_shopdetail.ApplyDailyDealFeeToItems=function(){if(_shopdetail.EnableFMBFee()){var e,t=_shopdetail?.BookingDetail?.AppointmentDetail||[];if(Array.isArray(t)){e=void 0===ischkFirstTimeCustomer||null==ischkFirstTimeCustomer||1!=ischkFirstTimeCustomer&&0!=ischkFirstTimeCustomer?"undefined"!=typeof IsForNewCustomer&&null!=IsForNewCustomer&&IsForNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsForVeraNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsSameDayCustomer:ischkFirstTimeCustomer,totalDailyDealFeeOfAllCart_ABS=0;var i=!0===_shopdetail.IsDailyDealsAppliedInItem(),a=!_shopdetail.IsUKBusiness(),r=function(t,r){if(t=Number(t)||0,!(i||a&&Number(r||0)>0)||t<=0)return 0;if(e){var o=Number(_shopdetail.BookingDetail.DailyDealVagaroFee||0);if(o>0)return FMBPercentage=o,_shopdetail.parseTodecimal(t*o/100)}else{var n=Number(_shopdetail.BookingDetail.DailyDealVagaroFee_ExistingUser||0);if(n>0)return FMBPercentage=n,_shopdetail.parseTodecimal(t*n/100)}return 0},o=function(e){return e&&(e.ApplyDiscoutType===ApplyDiscoutTypePrepay.Package||!0===e.IsPackageApplied)},n=function(e,t){return Number(null!=e&&""!==e?e:t)||0};t.forEach(function(e){if(e){var t=o(e)?0:n(e.price,e.priceOriginal);e.DailyDealFee=r(t,e.PromotionId),totalDailyDealFeeOfAllCart_ABS+=Number(e.DailyDealFee)||0,(Array.isArray(e.lstAddonService)?e.lstAddonService:[]).forEach(function(e){if(e){var t=o(e)?0:n(e.Price,e.NewPrice);e.DailyDealFee=r(t,e.PromotionID),totalDailyDealFeeOfAllCart_ABS+=Number(e.DailyDealFee)||0}})}})}}},_shopdetail.ApplyDailyDealFeeToUpsellItems=function(){if(_shopdetail.EnableFMBFee()){var e=_shopdetail.BookingDetail;if(!String.isNullOrUndefineOrBlank(e)){var t=Array.isArray(e.MembershipUpSellData)?e.MembershipUpSellData:[],i=Array.isArray(e.PackageUpSellData)?e.PackageUpSellData:[];if(0!==t.length||0!==i.length){var a;a=void 0===ischkFirstTimeCustomer||null==ischkFirstTimeCustomer||1!=ischkFirstTimeCustomer&&0!=ischkFirstTimeCustomer?"undefined"!=typeof IsForNewCustomer&&null!=IsForNewCustomer&&IsForNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsForVeraNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsSameDayCustomer:ischkFirstTimeCustomer;var r=Number(a?_shopdetail.BookingDetail.DailyDealVagaroFee||0:_shopdetail.BookingDetail.DailyDealVagaroFee_ExistingUser||0),o=function(e){return null!=e&&Number(e.PromotionID||0)>0},n=!_shopdetail.IsUKBusiness(),s=!0===_shopdetail.IsDailyDealsAppliedInItem()||n&&(t.some(o)||i.some(o)),l=function(e,t){if(t=Math.max(0,Number(t)||0),!(s||n&&o(e))||t<=0||r<=0)return e.dailydealFee=0,void(e.FMBPercentage=0);e.dailydealFee=_shopdetail.parseTodecimal(t*r/100),e.FMBPercentage=r,Number(e.dailydealFee)>0&&(FMBPercentage=r)};t.forEach(function(e){e&&l(e,(Number(e.Price)||0)-(Number(e.productDisc)||0))}),i.forEach(function(e){e&&l(e,(Number(e.TotalPrice)||0)-(Number(e.discount)||0))})}}}},_shopdetail.BindFirstTimeCustomerCheckbox=function(){var t=getQueryStringData("Type");"OnBoarding"!=t&&"ImportOnBoarding"!=t&&_shopdetail.EnableFMBFee()?(IsForNewCustomer||_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsForVeraNewCustomer)&&(_shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsSameDayCustomer?e("#dvFirstTimeCustomer").hide():(e("#dvFirstTimeCustomer").show(),ischkFirstTimeCustomer=null,e("#tabFirstTimeYes, #tabFirstTimeNo").removeClass("w--current").attr("aria-checked","false"),e("#dvFirstTimeCustomerError").hide())):e("#dvFirstTimeCustomer").hide()},_shopdetail.SelectFirstTimeCustomer=function(t){var i=_shopdetail.IsDailyDealsAppliedInItem();if(ischkFirstTimeCustomer=!0===t,e("#tabFirstTimeYes").toggleClass("w--current",!0===ischkFirstTimeCustomer).attr("aria-checked",!0===ischkFirstTimeCustomer?"true":"false"),e("#tabFirstTimeNo").toggleClass("w--current",!1===ischkFirstTimeCustomer).attr("aria-checked",!1===ischkFirstTimeCustomer?"true":"false"),e("#dvFirstTimeCustomerError").hide(),i||_shopdetail.IsDailyDealsAppliedInItem()){if(_shopdetail.ApplyDailyDealFeeToItems(),_shopdetail.ApplyDailyDealFeeToUpsellItems(),1==isDepositOff){var a=0;_shopdetail.IsDailyDealsAppliedInItem()?ischkFirstTimeCustomer?(a=Number(_shopdetail.BookingDetail.DailyDealVagaroFee||0),_shopdetail.BookingDetail.DepositsPer=a):(a=Number(_shopdetail.BookingDetail.DailyDealVagaroFee_ExistingUser||0),_shopdetail.BookingDetail.DepositsPer=a):_shopdetail.BookingDetail.DepositsPer=0}var r=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.TipAmount||0),o=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.TipPercent||0);if(_shopdetail.ReApplyDiscounts(),r>0){var n=o>0?e("#divTipSelectionList .tip-tab").filter(function(){var t=e(this).attr("tip-percentage");return null!=t&&"0"!=t&&parseFloat(t)==o}).first():e();n.length>0?_shopdetail.CalculateTipAmount(n[0]):(_shopdetail.CustomTipsClick(),e("#txtOnlineCustomerTip").val(r.toFixed(2)),_shopdetail.onBlurValidateCustomTip_new())}}},_shopdetail.GetFirstVisitFlag=function(){return _shopdetail.BookingDetail&&!0===_shopdetail.BookingDetail.IsSameDayCustomer?1:e("#dvFirstTimeCustomer").is(":visible")?!0===ischkFirstTimeCustomer?1:!1===ischkFirstTimeCustomer?2:0:0},_shopdetail.ValidateFirstTimeCustomerSelection=function(){if(e("#dvFirstTimeCustomer").is(":visible")&&(void 0===ischkFirstTimeCustomer||null==ischkFirstTimeCustomer)){e("#dvFirstTimeCustomerError").show();try{e("html, body").animate({scrollTop:e("#dvFirstTimeCustomer").offset().top-120},300),e("#tabFirstTimeYes").focus()}catch(e){}return swal({title:"",text:"Is this your first visit at this business?",showCancelButton:!0,confirmButtonText:"Yes, this is my first visit.",cancelButtonText:"No, I've visited before.",customClass:"sweet-alert-model sweetalert-width"},function(t){t?e("#tabFirstTimeYes").click():e("#tabFirstTimeNo").click()}),e(".gencustom-close").attr("style","display:none !important"),!1}return!0},_shopdetail.GetBookingPrimaryValue=function(e,t){try{if(null==e)return"";var i=String(e);return t&&i.indexOf(t)>-1?i.split(t)[0]:i.indexOf(",")>-1?i.split(",")[0]:i}catch(e){return""}},_shopdetail.GetBookingAllValues=function(e,t){try{if(null==e)return"";var i=String(e);return""===i?"":(t?i.split(t):i.split(",")).join("|~|")}catch(e){return""}},_shopdetail.FormatItemDealFee=function(e){try{var t=Number(e);return isNaN(t)||t<=0?"$0.00":"$"+t.toFixed(2)}catch(e){return"$0.00"}},_shopdetail.FormatFmbAmount=function(e,t){try{if(null==e||""===String(e))return"";var i=_shopdetail.BookingDetail&&_shopdetail.BookingDetail.CurrencySymbol?_shopdetail.BookingDetail.CurrencySymbol:"$";return!0===t||1===Number(t)?i+e:e+"%"}catch(e){return""}},_shopdetail.BuildBookingAmplitudeData=function(t){var i={};try{var a=null!=_shopdetail.BookingDetail?_shopdetail.BookingDetail:{},r=a.AppointmentDetail&&a.AppointmentDetail.length>0?a.AppointmentDetail[0]:{};i.Step=t,i.PageURL=window.location.href,i.UserAgent=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i.AmplitudeDeviceId="undefined"!=typeof _onlineCheckout&&_onlineCheckout&&"function"==typeof _onlineCheckout.GetAmplitudeDeviceId?_onlineCheckout.GetAmplitudeDeviceId():"",i.BusinessID=e("#hdnBusinessID").val()?e("#hdnBusinessID").val():0,i.UserID=e("#hdnLoggedInUserid").val()&&"0"!=e("#hdnLoggedInUserid").val()?e("#hdnLoggedInUserid").val():"undefined"!=typeof UserID?UserID:0,i.BusinessName=_shopdetail&&_shopdetail.businessName?_shopdetail.businessName:"",i.Email="undefined"!=typeof UserEmail?UserEmail:"";for(var o=null!=a.servicename&&""!==String(a.servicename)?String(a.servicename).split("||~||"):[],n=null!=a.spname&&""!==String(a.spname)?String(a.spname).split(","):[],s=null!=a.spid&&""!==String(a.spid)?String(a.spid).split(","):[],l=null!=a.date&&""!==String(a.date)?String(a.date).split(","):[],d=null!=a.starttime&&""!==String(a.starttime)?String(a.starttime).split(","):[],c=a.AppointmentDetail&&a.AppointmentDetail.length?a.AppointmentDetail:[],u=r.CustomerStartTime||r.startTime||r.time||"",p=[],h=[],m=[],f=[],g=[],v=[],A=[],C=!1,y=function(e){return e&&(e.ServiceTitle||e.ServiceName||e.servicename)||""},b=function(e){null!=e&&(C=!0);var t=null!=e?Number(e):0;A.push(_shopdetail.FormatItemDealFee(isNaN(t)?0:t))},S=0;S<o.length;S++){var k=n[S]||"",D=s[S]||"",_=l[S]||"",I=d[S]||u||"",w=c[S];p.push(o[S]||""),h.push("Service"),m.push(_),f.push(I),g.push(k),v.push(D),b(w&&null!=w.DailyDealFee?w.DailyDealFee:null);for(var P=w&&Array.isArray(w.lstAddonService)?w.lstAddonService:[],T=0;T<P.length;T++){var B=P[T];p.push(y(B)),h.push("Add-on"),m.push(_),f.push(I),g.push(k),v.push(D),b(B&&null!=B.DailyDealFee?B.DailyDealFee:null)}}if(i.ServiceName=p.join("|~|"),i.ServiceType=h.length?h.join("|~|"):"Service",i.ServiceDate=m.join("|~|"),i.ServiceTime=f.length?f.join("|~|"):u||"",i.ServiceProviderName=g.join("|~|"),i.ServiceProviderId=v.join("|~|"),"undefined"!=typeof _onlineCheckout&&_onlineCheckout&&_onlineCheckout.AmplitudeStep&&t===_onlineCheckout.AmplitudeStep.OnlineCheckoutPageVisited){var x;x=void 0===ischkFirstTimeCustomer||null==ischkFirstTimeCustomer||!0!==ischkFirstTimeCustomer&&!1!==ischkFirstTimeCustomer?"undefined"!=typeof IsForNewCustomer&&null!=IsForNewCustomer&&IsForNewCustomer||!0===a.IsForVeraNewCustomer||!0===a.IsSameDayCustomer:ischkFirstTimeCustomer;var F=Number(x?a.DailyDealVagaroFee||0:a.DailyDealVagaroFee_ExistingUser||0),O="function"==typeof _shopdetail.IsDailyDealsAppliedInItem&&!!_shopdetail.IsDailyDealsAppliedInItem();i.DealAmount=O&&F>0?F+"%":""}else i.DealAmount=A.length&&C?A.join("|~|"):_shopdetail.FormatFmbAmount(a.DailyDealVagaroFee,a.DailyDealVagaroFeeType);i.DepositAmount=_shopdetail.FormatFmbAmount(a.DepositsPer,a.DepositAmtType),i.IsDepositRequired=Number(a.DepositsPer)>0;var M=void 0!==IsFMBEnableForBusiness&&IsFMBEnableForBusiness;i.IsFillMyBooksEnabled=M,i.IsDailyDealEnabled="function"==typeof _shopdetail.IsDailyDealsAppliedInItem&&!!_shopdetail.IsDailyDealsAppliedInItem(),i.Is_Forms_Enabled="True"==e("#hdnIsFormsEnable").val(),i.IsCreditCardRequired="undefined"!=typeof IsRequireCCCapture&&(!0===IsRequireCCCapture||"true"==String(IsRequireCCCapture).toLowerCase()),i.IsFirstBusinessVisit="function"==typeof _shopdetail.GetFirstVisitFlag&&1===_shopdetail.GetFirstVisitFlag();var E="";try{E="function"==typeof getCookie&&getCookie("VeraSourceType")||""}catch(e){E=""}if(E=E.toString().toLowerCase(),i.IsFromPush="vera-push"==E,i.IsFromEmail="vera-email"==E,i.VagaroProVersion="undefined"!=typeof _onlineCheckout&&_onlineCheckout&&"function"==typeof _onlineCheckout.GetVagaroProVersion?_onlineCheckout.GetVagaroProVersion():"Desktop Web Browser",i.DeviceModel=i.UserAgent,"undefined"!=typeof _onlineCheckout&&_onlineCheckout&&t===_onlineCheckout.AmplitudeStep.OnlineCheckoutCompleted){var $=_onlineCheckout._checkoutAuthResult||{};i.AuthStatus=$.AuthStatus||"",i.TransactionId=$.TransactionId||"",i.AuthFailCode=$.AuthFailCode||"",i.AuthFailReason=$.AuthFailReason||""}}catch(e){}return i},_shopdetail.FireBookingCheckoutPageVisited=function(){try{if(!0===_shopdetail._bookingCheckoutPageVisitedLogged)return;_shopdetail._bookingCheckoutPageVisitedLogged=!0,"undefined"!=typeof _onlineCheckout&&_onlineCheckout&&(_onlineCheckout._checkoutAuthResult=null),_onlineCheckout.FireOnlineCheckoutAmplitude(_onlineCheckout.AmplitudeStep.OnlineCheckoutPageVisited,_shopdetail.BuildBookingAmplitudeData(_onlineCheckout.AmplitudeStep.OnlineCheckoutPageVisited))}catch(e){}},_shopdetail.FireBookNowPageVisited=function(){try{if(!0===_shopdetail._bookNowPageVisitedLogged)return;var t="";try{t="function"==typeof getCookie&&getCookie("VeraSourceType")||""}catch(e){t=""}if("vera-email"!=(t=t.toString().toLowerCase())&&"vera-push"!=t)return;_shopdetail._bookNowPageVisitedLogged=!0;var i="";try{i="function"==typeof getCookie&&getCookie("VeraDealType")||""}catch(e){i=""}var a="";try{a="function"==typeof getCookie&&getCookie("VeraUserIdEnc")||""}catch(e){a=""}var r=_shopdetail.bookingDateTime?_shopdetail.bookingDateTime.toString():"",o="";try{var n=_shopdetail.serviceID;if(null!=n&&""!=n&&void 0!==OnlindBookingResponse&&OnlindBookingResponse&&OnlindBookingResponse.lstOnlineServiceParent&&"function"==typeof _shopdetail.GetSelectedServiceDetail){var s=_shopdetail.GetSelectedServiceDetail(e.extend(!0,[],OnlindBookingResponse.lstOnlineServiceParent),n);s&&s.text&&(o=s.text)}}catch(e){o=""}var l=navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",d={Step:142,PageURL:window.location.href,UserAgent:l,AmplitudeDeviceId:"undefined"!=typeof _onlineCheckout&&_onlineCheckout&&"function"==typeof _onlineCheckout.GetAmplitudeDeviceId?_onlineCheckout.GetAmplitudeDeviceId():"",BusinessID:e("#hdnBusinessID").val()?e("#hdnBusinessID").val():0,UserID:e("#hdnLoggedInUserid").val()&&"0"!=e("#hdnLoggedInUserid").val()?e("#hdnLoggedInUserid").val():"undefined"!=typeof UserID?UserID:0,UserIDEnc:a?a.toString():"",BusinessName:_shopdetail&&_shopdetail.businessName?_shopdetail.businessName:"",ServiceName:o,ServiceDate:r?r.toString():"",IsDailyDealEnabled:void 0!==PromotionDetails&&PromotionDetails&&PromotionDetails.length>0,IsFillMyBooksEnabled:void 0!==IsFMBEnableForBusiness&&IsFMBEnableForBusiness,IsFromEmail:"vera-email"==t,IsFromPush:"vera-push"==t,DeviceModel:l,DealType:i?i.toString():""};_shopdetail.AjaxOld("AddLogInAmplitudeCoreV2",{AddLogInAmplitude:d},function(){},function(){})}catch(e){}},_shopdetail.FireBookingCheckoutCompleted=function(){try{_onlineCheckout.FireOnlineCheckoutAmplitude(_onlineCheckout.AmplitudeStep.OnlineCheckoutCompleted,_shopdetail.BuildBookingAmplitudeData(_onlineCheckout.AmplitudeStep.OnlineCheckoutCompleted))}catch(e){}},_shopdetail.calculatedDepositsAmount=function(e){return 1==_shopdetail.BookingDetail.DepositAmtType?_shopdetail.ConvertTodecimal(100*_shopdetail.BookingDetail.DepositsPer/e,3):_shopdetail.ConvertTodecimalUsingSubString(e*_shopdetail.BookingDetail.DepositsPer/100,3)},_shopdetail.calculatedDepositsPercent=function(e,t){return 100*t/e.price},_shopdetail.GetDepositsAmount=function(e,t){return e*t/100},_shopdetail.calculateDepositsPrepay=function(e){if((e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points||e.IsPartialPoint)&&e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&1!=e.IsServiceBaseGC)if(null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(e.appBookingDate))e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.UnPaid;else if("undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell)e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.UnPaid;else if(1==_shopdetail.BookingDetail.DepositAmtType)_shopdetail.BookingDetail.DepositsPer>=e.price?(e.depositsPaid=e.price,e.depositsPercentage=100,e.paidType=arrpaidType.Paid):e.IsPartialPoint?(e.depositsPaid=e.depositsPaid,e.depositsPercentage=e.depositsPercentage,e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits):(e.depositsPaid=_shopdetail.BookingDetail.DepositsPer,e.depositsPercentage=_shopdetail.calculatedDepositsAmount(e.price,_shopdetail.BookingDetail.DepositAmtType),e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits);else if(100!=_shopdetail.BookingDetail.DepositsPer&&e.price>0)if(1==isDepositOff&&_shopdetail.IsDailyDealsAppliedInItem()){var t=e.price,i=e.price,a=null!=t&&""!==t&&t>0?t:null!=i&&""!==i&&i>0?i:e.price;e.depositsPaid=_shopdetail.calculatedDepositsAmount(a),e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,e.paidType=arrpaidType.Deposits}else if(1==isDepositOff)e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.UnPaid;else if(e.IsPartialPoint)e.depositsPaid=e.depositsPaid,e.depositsPercentage=e.depositsPercentage,e.paidType=arrpaidType.Deposits;else{if(null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()){var r=0;if(_shopdetail.CalculateTax(e,_shopdetail.BookingDetail.Prepay.lstServiceDetails),null!=e.BusinessTax&&e.BusinessTax.length>0&&(r=e.BusinessTax.reduce((e,t)=>e+t.Tax,0)),r>0){var o=e.price+_shopdetail.parseTodecimal(e.price*r/100);e.depositsPaid=_shopdetail.calculatedDepositsAmount(o)}else e.depositsPaid=_shopdetail.calculatedDepositsAmount(e.price)}else e.depositsPaid=_shopdetail.calculatedDepositsAmount(e.price);e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,e.paidType=arrpaidType.Deposits}else e.paidType=arrpaidType.Paid,e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,0==e.price&&0==e.IsMembershipApply&&0==e.Discount&&(e.paidType=arrpaidType.UnPaid)},_shopdetail.calculatAddonDepositsPercent=function(e,t){return 100*t/e.OriginalPrice},_shopdetail.calculateDepositsPrepayforAddons=function(e,t){if((e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points||e.IsPartialPoint)&&e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&1!=e.IsServiceBaseGC){if(null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))>=(String.isNullOrUndefineOrBlank(t)?new Date(e.appBookingDate):new Date(t.appBookingDate)))e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.UnPaid;else if("undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell)e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.UnPaid;else if(1==_shopdetail.BookingDetail.DepositAmtType)_shopdetail.BookingDetail.DepositsPer>=e.Price?(e.depositsPaid=e.Price,e.depositsPercentage=100,e.paidType=arrpaidType.Paid):e.IsPartialPoint?(e.depositsPaid=e.depositsPaid,e.depositsPercentage=e.depositsPercentage,e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits):(e.depositsPaid=_shopdetail.BookingDetail.DepositsPer,e.depositsPercentage=_shopdetail.calculatedDepositsAmount(e.Price,_shopdetail.BookingDetail.DepositAmtType),e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits);else if(100!=_shopdetail.BookingDetail.DepositsPer&&e.Price>0)if(e.IsPartialPoint)e.depositsPaid=e.depositsPaid,e.depositsPercentage=e.depositsPercentage,e.paidType=arrpaidType.Deposits;else if(1==isDepositOff&&(_shopdetail.IsUKBusiness()?_shopdetail.IsDailyDealsAppliedInItem():parseInt(t.PromotionId||0)>0)){var i=e.Price,a=e.Price,r=null!=i&&""!==i&&i>0?i:null!=a&&""!==a&&a>0?a:e.price;e.depositsPaid=_shopdetail.calculatedDepositsAmount(r),e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,e.paidType=arrpaidType.Deposits}else if(1==isDepositOff)e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.UnPaid;else{if(null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()){var o=JSON.parse(e.TaxesValues);if(null!=o&&""!=o&&null!=o.Taxes&&""!=o.Taxes){var n=o.Taxes.reduce((e,t)=>e+t.Tax,0),s=e.Price+_shopdetail.parseTodecimal(e.Price*n/100);e.depositsPaid=_shopdetail.calculatedDepositsAmount(s)}else e.depositsPaid=_shopdetail.calculatedDepositsAmount(e.Price)}else e.depositsPaid=_shopdetail.calculatedDepositsAmount(e.Price);e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,e.paidType=arrpaidType.Deposits}else e.paidType=arrpaidType.Paid,e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,0==e.Price&&0==e.IsMembershipApply&&0==e.Discount&&(e.paidType=arrpaidType.UnPaid);e.paidType==arrpaidType.Deposits&&(e.payableAmount=e.Price)}},_shopdetail.BindFamilyandFriendDetails=function(t){var i=1;e.each(t,function(e,t){t.Index=i,t.Tag="",t.IsMemPkgReqToBook=_shopdetail.IsMemPkgReqToBook,t.IsLimitOnlineBooking=_shopdetail.IsLimitOnlineBooking,i++});var a=t;if(1==_shopdetail.IsLimitOnlineBooking){var r=[];""!=hdnCommandArgArray.spid&&(r=hdnCommandArgArray.spid.split(","));var o=_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>r.includes(e.ServiceProviderID.toString()));a=t.map(e=>{var t=o.find(t=>t.UserID===e.UserID);return t?{...e,Existing:t.Existing}:e}),e.each(a,function(e,t){0==t.Existing?t.Tag="NOT ACCEPTING NEW CLIENTS":t.Tag=""})}else a=t;if(1==_shopdetail.IsMemPkgReqToBook){var n=!1;if(void 0!==MembershipPackageDetails&&void 0!==MembershipPackageDetails.Data&&void 0!==MembershipPackageDetails.Data.UserMemberShipAndPackageInformation&&null!=MembershipPackageDetails&&null!=MembershipPackageDetails.Data&&null!=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation&&!String.isNullOrUndefineOrBlank(MembershipPackageDetails.Data.UserMemberShipAndPackageInformation.RequiredServices)){var s=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation.RequiredServices.split(","),l=hdnCommandArgArray.serviceid.split(",");if(void 0!==l&&null!=l&&l>0){var d=s.some(e=>l.includes(e));n=null!=d&&1==d}}n&&e.each(a,function(e,t){if(""==t.Tag){var i=FamilyFriendsMembershipPackage.Data.FamilyFriendsMembershipPackage.filter(e=>e.UserID==t.UserID);i.length>0&&(0!=i[0].ItemId?t.Tag=i[0].Tag:t.UserID!=UserID||void 0!==_shopdetail.BookingDetail.fnfUserId?t.Tag="Membership/Package Required To Book":t.Tag="")}})}if(e(".familycktfrnd ul").empty(),e("#appbookfamilyfrndlistTemplate").tmpl(a).appendTo(".familycktfrndlist"),1==_shopdetail.IsLimitOnlineBooking&&""!=e("#hdnSelSPID").val()){var c=e("#hdnSelSPID").val();_shopdetail.FnfUserSelectionForCheckout(e(".clsuid"+c))}else if(1==_shopdetail.IsMemPkgReqToBook&&void 0!==_shopdetail.BookingDetail.fnfUserId&&null!=_shopdetail.BookingDetail.fnfUserId){_shopdetail.FnfUserSelectionForCheckout(e(".clsuid"+_shopdetail.BookingDetail.fnfUserId)),e(".familycktfrndlist").children(".familycktfrndlistblok:not(.init)").toggle(),e(".familycktfrndlistblok.selected:not(.init)","#dvOnlineBooking").trigger("click")}else 1!=_shopdetail.IsLimitOnlineBooking&&1!=_shopdetail.IsMemPkgReqToBook&&e("#appbookAddnewFamilyFriendTemplate").tmpl().appendTo(".familycktfrndlist")},_shopdetail.FnfUserSelectionForCheckout=function(t){e(".familycktfrndlist").children(".familycktfrndlistblok:not(.init)").removeClass("selected").attr("aria-selected",!1),e(t).addClass("selected").attr("aria-selected",!0),e(".familycktfrndlist").children(".init").html(e(t).html()),e(".familycktfrndlist").children(".init").find(".fficons").css("display","block")},_shopdetail.FnfUserSelectionForClass=function(e){},_shopdetail.IsBaseTipAllowedByConfig=function(){if(void 0===tipOnItems||null==tipOnItems||""==tipOnItems.toString().trim())return!0;for(var e=tipOnItems.toString().split(","),t=0;t<e.length;t++){var i=parseInt(e[t],10);if(1===i||8===i)return!0}return!1},_shopdetail.ShowTipOptionsButton=function(){_shopdetail.IsFinalGCCalculation=!1;var t=_shopdetail.VisibleControlLength("#mobile-check")>0,i=0;if(null!=typeof _IsPrepay&&1==_IsPrepay&&(i=_shopdetail.GetTotalAmountForTip()),e("#divTip").hide(),t?e("#divTipSelectionMobile").html("").hide():e("#divTipSelection").html("").hide(),e("#aCheckoutTip").hide(),e("#divfinalCheckoutTipAmount").hide(),e("#txtOnlineCustomerTipCurrencySymbol").text(_shopdetail.BookingDetail.CurrencySymbol),e("#txtOnlineCustomerTip").val("0.00"),e("#divfinalCheckoutTipAmount").html(_shopdetail.BookingDetail.CurrencySymbol+"0.00"),_shopdetail.BookingDetail.TipAmount=0,_shopdetail.BookingDetail.TipPercent=0,_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.BookingDetail.TotalPaidCount>0&&_shopdetail.IsBaseTipAllowedByConfig()&&null!=IsnotfullyPrePay&&1!=IsnotfullyPrePay){var a=_shopdetail.BookingDetail.TipOption;if(null!=typeof a&&null!=a&&""!=a&&"0"!=a){e("#divTip").show(),t?e("#divTipSelectionMobile").append('<div class="checkout-title">Tip</div><div class="tip-tablist vagaro-segment vagaro-segment-mobile-full" id="divTipSelectionList"></div>'):e("#divTipSelection").append('<div class="tip-tablist vagaro-segment vagaro-segment-mobile-full" id="divTipSelectionList"></div>');var r=a.split(","),o="";void 0!==_shopdetail.BookingDetail.TipType&&null!=_shopdetail.BookingDetail.TipType&&""!=_shopdetail.BookingDetail.TipType&&(tipType=_shopdetail.BookingDetail.TipType.toLowerCase());for(var n=0;n<r.length;n++){var s,l,d;"dollar"===tipType?(s=parseFloat(r[n]),l=_shopdetail.BookingDetail.CurrencySymbol+s,d="0"):(s=i*parseFloat(r[n])/100,l=r[n]+"%",d=r[n]);var c="dollar"===tipType?"":"<div class='text-blockNew text-secondary'>("+_shopdetail.BookingDetail.CurrencySymbol+s.toFixed(2)+")</div>";o="<a href='javascript:void(0);' class='tip-tab vg-filter-mobile-tab' tip-amount='"+s.toFixed(2)+"' tip-percentage='"+d+"' onClick='_shopdetail.CalculateTipAmount(this)'><div class='web-body-font'>"+l+"</div>"+c+"</a>",n==r.length-1&&(o+="<a href='javascript:void(0);' class='tip-tab vg-filter-mobile-tab custom-tab' tip-amount='0' tip-percentage='0' onClick='_shopdetail.CustomTipsClick()'><div class='text-primary'>Custom</div></a>"),e("#divTipSelectionList").append(o)}e("#divServicesSubTotalLabel").show(),e("#divServicesTotalPrepay").show().addClass("subtotal-master"),t?e("#divTipSelectionMobile").append('<div class="tipBlock" id="divTipCustom" style="display:none;"><div class="tipInputHolder vagaro-input-prefix-text"><div class="customtipdoller doller-icon" id="txtOnlineCustomerTipCurrencySymbol">'+_shopdetail.BookingDetail.CurrencySymbol+'</div><input type="text" class="tipInputField vagaro-input tip-currency" id="txtOnlineCustomerTip" title="Custom Tip" maxlength="6" onkeypress="return _shopdetail.validateCustomTipKeyPress(this, event);" onblur="validateDecimal(this,1,2);_shopdetail.onBlurValidateCustomTip_new(this);" onkeyup="pasteHandlerKeyup(this,event,1);_shopdetail.enforceCustomTipMinimum(this);" onfocus="_shopdetail.setFocusinCustomTip();" placeholder="Custom" value="0.00" /></div></div>').show():e("#divTipSelection").append('<div class="tipBlock" id="divTipCustom" style="display:none;"><div class="tipInputHolder vagaro-input-prefix-text"><div class="customtipdoller doller-icon" id="txtOnlineCustomerTipCurrencySymbol">'+_shopdetail.BookingDetail.CurrencySymbol+'</div><input type="text" class="tipInputField vagaro-input tip-currency" id="txtOnlineCustomerTip" title="Custom Tip" maxlength="6" onkeypress="return _shopdetail.validateCustomTipKeyPress(this, event);" onblur="validateDecimal(this,1,2);_shopdetail.onBlurValidateCustomTip_new(this);" onkeyup="pasteHandlerKeyup(this,event,1);_shopdetail.enforceCustomTipMinimum(this);" onfocus="_shopdetail.setFocusinCustomTip();" placeholder="Custom" value="0.00" /></div></div>').show(),e("#divfinalCheckoutTipAmount").show(),e("#divTipSelectionList .tip-tab").removeClass("active")}}else IsnotfullyPrePay=!1},_shopdetail.setFocusinCustomTip=function(){(String.isNullOrUndefineOrBlank(e("#txtOnlineCustomerTip").val())||!String.isNullOrUndefineOrBlank(e("#txtOnlineCustomerTip").val())&&e("#txtOnlineCustomerTip").val()<=0)&&e("#txtOnlineCustomerTip").val("0.00"),e("#txtOnlineCustomerTip").select()},_shopdetail.validateCustomTipKeyPress=function(e,t){var i=void 0!==t.charCode&&null!=t.charCode?t.charCode:t.keyCode;if(46==i||i>=48&&i<=57){var a=e.value||"",r="number"==typeof e.selectionStart?e.selectionStart:a.length,o="number"==typeof e.selectionEnd?e.selectionEnd:a.length,n=(a.substring(0,r)+String.fromCharCode(i)+a.substring(o)).replace(/^[^0-9.]*/,"");if(46==i&&!/[1-9]/.test(n.split(".")[0]))return!1}return pasteHandler(e,t,1)},_shopdetail.enforceCustomTipMinimum=function(e){var t=e.value||"",i=t.replace(/^[^0-9.]*/,""),a=i.replace(/^0+(?=\d)/,""),r=parseFloat(a);r>0&&r<1&&(a="0.00"),a!==i&&(e.value=t.substring(0,t.length-i.length)+a)},_shopdetail.CustomTipsClick=function(){e("#divTipSelectionList .tip-tab").removeClass("active"),e("#divTipSelectionList .custom-tab").addClass("active"),e("#txtOnlineCustomerTip").val("0.00"),_shopdetail.BookingDetail.TipAmount=0,_shopdetail.DisplayDiscountOnAppointment(),e("#divServicesSubTotalLabel").show(),e("#divServicesTotalPrepay").show(),e("#divServicesTotalPrepay").addClass("subtotal-master"),_shopdetail.BookingDetail.TipPercent=0,1==_shopdetail.BookingDetail.IsEnableVCFFee&&_shopdetail.BookingDetail.Prepay.ccAmt>0&&1==_shopdetail.IsValidatePrepayFee()&&(_shopdetail.RemoveVCFFee(),_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.ApplyTip)),0==_shopdetail.BookingDetail.TipAmount&&e("#divTip").is(":hidden")&&_shopdetail.ShowTipOptionsButton(),e("#divTipCustom").show()},_shopdetail.CalculateTipAmount=function(t){e("#divTipSelectionList .tip-tab").removeClass("active"),e(t).addClass("active");var i=t.attributes.getNamedItem("tip-percentage").value,a=t.attributes.getNamedItem("tip-amount").value;e("#divTipCustom").hide(),_shopdetail.BookingDetail.TipAmount=_shopdetail.parseTodecimal(a),_shopdetail.BookingDetail.TipPercent=_shopdetail.parseTodecimal(i),_shopdetail.DisplayDiscountOnAppointment(),e("#divServicesSubTotalLabel").show(),e("#divServicesTotalPrepay").show(),e("#divServicesTotalPrepay").addClass("subtotal-master"),_shopdetail.VPLCalculation(),1==e("#tabVagaroPayLater").hasClass("w--current")?_shopdetail.RemoveVCFFee():1==_shopdetail.IsVCFEnable()&&(_shopdetail.RemoveVCFFee(),_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.ApplyTip)),_shopdetail.DisplayTotalDueWithTip(a)},_shopdetail.onBlurValidateCustomTip_new=function(t){var i=e("#txtOnlineCustomerTip").val().replace(_shopdetail.BookingDetail.CurrencySymbol,"");_shopdetail.BookingDetail.TipAmount=_shopdetail.parseTodecimal(i),_shopdetail.BookingDetail.TipPercent=0,_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.ValidateVPl(!0),_shopdetail.VPLCalculation(),1==_shopdetail.IsVCFEnable()&&(_shopdetail.RemoveVCFFee(),_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.ApplyTip)),0==_shopdetail.BookingDetail.TipAmount&&e("#divTip").is(":hidden")&&(_shopdetail.ShowTipOptionsButton(),_shopdetail.CustomTipsClick()),_shopdetail.DisplayTotalDueWithTip(i)},_shopdetail.makeCurrencySymbolInTextbox=function(e,t){e.value.indexOf("$")>=0||(e.value.indexOf("£")>=0||(e.value.indexOf("%")>=0||(e.value="$"+e.value.replace("$",""))))},_shopdetail.pasteHandlerKeyup=function(e,t,i){if("Microsoft Internet Explorer"==navigator.appName){if(IsSelected){nDotCount=0;var a=checkMaxLength(stripChars(e.value,i),e.maxLength);e.value=a,IsSelected=!1}8!=t.keyCode&&46!=t.keyCode||identifyDot(e.value)||(nDotCount=0),""==e.value&&(nDotCount=0)}else{if("keyup"==t.type&&IsPaste){nDotCount=0;a=checkMaxLength(stripChars(e.value,i),e.maxLength);e.value=a,IsPaste=!1}8!=t.which&&46!=t.which||identifyDot(e.value)||(nDotCount=0),""==e.value&&(nDotCount=0)}},_shopdetail.CalculateTaxForPenny=function(){var e=_shopdetail.BookingDetail.Prepay.ccAmt,t=_shopdetail.BookingDetail.Prepay.amtPaid;if(_shopdetail.BookingDetail.Prepay.tax>0){var i=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.Rtax);if((r=_shopdetail.BookingDetail.Prepay.tax)!=i){var a=_shopdetail.parseTodecimal(r-i);_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax-a),_shopdetail.BookingDetail.Prepay.ccAmt>0&&_shopdetail.BookingDetail.Prepay.ccAmt>a?_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt-a):_shopdetail.BookingDetail.Prepay.gcAmt>0&&_shopdetail.BookingDetail.Prepay.gcAmt>a&&(_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt-a))}}if(_shopdetail.BookingDetail.Prepay.displayTax>0){var r;i=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax);if((r=_shopdetail.BookingDetail.Prepay.displayTax)!=i){a=_shopdetail.parseTodecimal(r-i);_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax-a),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid-a)}}_shopdetail.BookingDetail.Prepay.ccAmt>e&&(_shopdetail.BookingDetail.Prepay.ccAmt=e),_shopdetail.BookingDetail.Prepay.amtPaid>t&&(_shopdetail.BookingDetail.Prepay.amtPaid=t)},_shopdetail.DisplayDiscountOnAppointment=function(){_shopdetail.BindDiscountOnItemsStrike(),_shopdetail.CheckForDeposits();var t=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid-_shopdetail.BookingDetail.Prepay.displayTax-_shopdetail.BookingDetail.totalFeeAmount);e("#divServicesSubTotal").html(_shopdetail.BookingDetail.CurrencySymbol+(t>0?_shopdetail.decimalFormate(t):"0.00"));var i=_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid-_shopdetail.BookingDetail.Prepay.gcAmt)-_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.PackageAmt)+_shopdetail.parseTodecimal(_shopdetail.BookingDetail.TipAmount)),a=_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,i);if(e("#divServicesTotalPrice").html(a),_shopdetail.vplamt=e("#dvservicesdepositprice").text().replace("$",""),_shopdetail.VPLMessage(_shopdetail.vplamt),e("#divServicesTotalPrice_mobile").html(a),0==_shopdetail.BookingDetail.Prepay.ccAmt&&0==_shopdetail.parseTodecimal(_shopdetail.BookingDetail.TipAmount)&&"false"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&"undefined"!=typeof _IsMemPkgUpSell&&0==_IsMemPkgUpSell)e("#divBookingSelectPaymentMethodTitle").html()!=arrPaymentTitleType.HoldOnCard&&e("#dvBookingPaymentMethod").hide();else{if(void 0!==DepositPaidTotalForUpshell&&0==DepositPaidTotalForUpshell&&1==_IsMemPkgUpSell){e("#dvBookingPaymentMethod").hide(),e("#dvdepositsblock").hide();var r=_shopdetail&&_shopdetail.BookingDetail&&_shopdetail.BookingDetail.Prepay,o=r&&!isNaN(r.ccAmt)?Number(r.ccAmt):0,n=r&&!isNaN(r.amtPaid)?Number(r.amtPaid):0;(o>0||n>0)&&e("#dvBookingPaymentMethod").show(),"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&1==istipchanges&&(e("#dvdueblock").show(),e("#divBookingSelectPaymentMethodTitle").html(arrPaymentTitleType.HoldOnCard),e("#dvdepositsdescription").hide(),e("#dvCCDescription").show(),void 0!==GetCCRequiredToSecureAppointmentDescription&&e("#dvCCDescription").html(GetCCRequiredToSecureAppointmentDescription("services")))}(_IsCCDetailsShow&&"undefined"!=typeof _IsMemPkgUpSell&&0==_IsMemPkgUpSell||_IsCCDetailsShow&&1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp())&&(e("#dvBookingPaymentMethod").show(),_shopdetail.ValidateVPl(!1))}("undefined"!=_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0||"undefined"!=_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0)&&(e("#dvdepositsblock").show(),(_shopdetail.BookingDetail.Prepay.ccAmt<=0||_shopdetail.BookingDetail.Prepay.depositsRemaining<=0)&&e("#dvdepositsblock").hide());var s=!1;if(_shopdetail.BookingDetail.Prepay.displayTax>0?(e("#divServicesTotalTax").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(_shopdetail.BookingDetail.Prepay.displayTax)),e("#divServicesTotalTaxLabel").hide(),s=!0):e("#divServicesTotalTaxLabel").hide(),_shopdetail.BookingDetail.totalFeeAmount>0&&(s=!0),_shopdetail.DisplayMembershipUpSellItem(3),_shopdetail.BookingDetail.Prepay.displayTax==ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.RdisplayTax,!0,2)&&_shopdetail.DisplayBusinessTaxes(),_shopdetail.DisplayBusinessFees(),_shopdetail.BookingDetail.Prepay.PackageAmt>0?(e("#divServicesTotalPackage").html("("+_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(_shopdetail.BookingDetail.Prepay.PackageAmt)+")"),e("#divServicesPackageLabel").show(),s=!0):e("#divServicesPackageLabel").hide(),e("#divfinalCheckoutTipAmount").html(_shopdetail.BookingDetail.CurrencySymbol+"0.00"),1==_IsPrepay&&null!=typeof _shopdetail.BookingDetail.TipAmount&&_shopdetail.BookingDetail.TipAmount>0&&(s=!0,e("#divfinalCheckoutTipAmount").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(_shopdetail.BookingDetail.TipAmount)),e("#aCheckoutTip").show()),e("#divServicesGCLabelNew").hide(),e("#dvdepositsduelabelwithGC").hide(),e("#dvdepositsperlabel").html("Total Due Now"),e(_shopdetail.tabAddGiftCards).removeClass("w--current"),e(_shopdetail.divAddGiftCards).attr("style","display: none"),e("#txtGCRedeemGCNo").val(_shopdetail.Empty),e("#divApplyGCcode").empty(),_shopdetail.BookingDetail.Prepay.gcAmt>0){var l=_shopdetail.createGiftCertificatessubTotal();if("none"==e("#dvdepositsblock").css("display")){e("#divServicesGCLabelNew").show(),e("#divPrepayGClist").html(""),e("#tmplgclstSubtotal").tmpl(l).appendTo("#divPrepayGClist");var d=e("#Nothanks").attr("class");null!=typeof d&&null!=d&&"w--current vg-filter-mobile-tab vg-switch-tab-first"!=d&&0==istipchanges&&_shopdetail.BookingDetail.Prepay.ccAmt>0&&(istipchanges=!0);var c=_shopdetail.BookingDetail.Prepay.ccAmt,u=_shopdetail.BookingDetail.TipAmount;_shopdetail.DisplayTotalDueWithTip(u)}else{e("#dvdepositsperlabel").html(""),""==e("#dvdepositsperlabel").val()&&0==e("#dvdepositsper").is(":visible")&&e("#dvdepositsduelabel").hide(),e("#dvdepositsduelabelwithGC").show(),e("#divServicesGCLabelNewDeposits").html(""),e("#tmplgclstSubtotal").tmpl(l).appendTo("#divServicesGCLabelNewDeposits"),e("#dvservicesdepositprice").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+_shopdetail.BookingDetail.Prepay.ccAmt).format("#.##"));c=_shopdetail.BookingDetail.Prepay.ccAmt;e("#dvservicesdepositpricewithoutGC").html(_shopdetail.BookingDetail.CurrencySymbol+c.format("#.##"))}i=_shopdetail.parseTodecimal(i+_shopdetail.BookingDetail.Prepay.gcAmt),e("#divServicesTotalPrice").html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(i))}e("#divServicesSubTotalLabel").show(),s||_shopdetail.IsVCFEnable()?(e("#divServicesTotalPrepay").show(),e("#divServicesTotalPrepay").addClass("subtotal-master")):e("#divServicesTotalPrepay").hide(),_shopdetail.VPLCalculation(),e("#dvCCSection").show(),1==_IsPaymentOption&&(e("#dvBookingTabs").show(),e("#dvBookingPaymentMethod").show(),1==_IsPrepay&&_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount<=0&&(e("#dvBookingTabs").hide(),e("#dvCCSection").hide()),_shopdetail.PaymentOptionSelectDeselect());var p,h=0,m=0;if(null!=_shopdetail.BookingDetail.Prepay.RedeemedByGC&&_shopdetail.BookingDetail.Prepay.RedeemedByGC.length>0&&(p=_shopdetail.BookingDetail.Prepay.RedeemedByGC.filter(e=>0!=e.serviceId)),_shopdetail.IsFinalGCCalculation&&null!=_shopdetail.BookingDetail.Prepay.lstGCpkgList&&null!=_shopdetail.BookingDetail.Prepay.lstGCpkgList&&_shopdetail.BookingDetail.Prepay.lstGCpkgList.length>0&&_shopdetail.BookingDetail.Prepay.gcAmt>0&&null!=p&&null!=p&&p.length>0){var f=_shopdetail.BookingDetail.Prepay.RedeemedByGC.filter(e=>"GC"==e.Type),g=_shopdetail.BookingDetail.Prepay.lstServiceDetails.filter(e=>f.some(t=>e.ServiceID===t.serviceId&&null!=t.Taxes&&null!=t.Taxes));if(f.length!=g.length)for(var v=0;v<f.length;v++){var A=g.filter(e=>e.ServiceID==f[v].serviceId);if(f[v].quantity<A.length){g=g.filter(e=>A.some(t=>t.ServiceID!=e.ServiceID)),A.splice(0,A.length-f[v].quantity),g=[...g,...A];break}}if(null!=g&&null!=g&&g.length>0){for(var C=0;C<g.length;C++)for(v=0;v<g[C].BusinessTax.length;v++)if(e("#divServiceMultipleTaxes").find("#divServiceTaxValue_"+g[C].BusinessTax[v].BusinessTaxID).length>0){var y=e("#divServiceMultipleTaxes").find("#divServiceTaxValue_"+g[C].BusinessTax[v].BusinessTaxID)[0].innerHTML;if(y=ConvertTodecimalMorePrecious(parseFloat(y.replace(/\$/g,"").replace(/£/g,"")),!0,2),0!=parseFloat(y)){y=ConvertTodecimalMorePrecious(y-g[C].BusinessTax[v].CalculatedTax,!0,2),e("#divServiceMultipleTaxes").find("#divServiceTaxValue_"+g[C].BusinessTax[v].BusinessTaxID)[0].innerHTML=_shopdetail.BookingDetail.CurrencySymbol+y;const t=document.querySelectorAll(".div-block-26 .web-body-font");let i=0;t.forEach(e=>{const t=parseFloat(e.textContent.replace("$","").replace("£",""));i+=isNaN(t)?0:t}),e("#divServicesTotalPrice")[0].innerText=_shopdetail.BookingDetail.CurrencySymbol+ConvertTodecimalMorePrecious(parseFloat(e("#divServicesSubTotal")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))+i,!0,2),h+=g[C].BusinessTax[v].CalculatedTax,"none"!=e("#dvdepositsblock").css("display")&&(e("#dvservicesdepositpricewithoutGC")[0].innerText=_shopdetail.BookingDetail.CurrencySymbol+ConvertTodecimalMorePrecious(parseFloat(e("#dvservicesdepositpricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))-ConvertTodecimalMorePrecious(h,!0,2),!0,2))}}e("#dvservicesPrepaypricewithoutGC")[0].innerText=_shopdetail.BookingDetail.CurrencySymbol+ConvertTodecimalMorePrecious(parseFloat(e("#divServicesTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))-ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.RedeemedByGC.reduce((e,t)=>e+t.redeemAmt,0),!0,2),!0,2),"none"==e("#dvdepositsblock").css("display")?(_shopdetail.BookingDetail.Prepay.ccAmt=parseFloat(ConvertTodecimalMorePrecious(parseFloat(e("#divServicesTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))-ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.RedeemedByGC.reduce((e,t)=>e+t.redeemAmt,0),!0,2),!0,2)),_shopdetail.BookingDetail.Prepay.tax=parseFloat(ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.tax-ConvertTodecimalMorePrecious(h,!0,2),!0,2)),_shopdetail.BookingDetail.Prepay.displayTax=parseFloat(ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.displayTax-ConvertTodecimalMorePrecious(h,!0,2),!0,2)),_shopdetail.BookingDetail.Prepay.amtPaid=parseFloat(ConvertTodecimalMorePrecious(parseFloat(e("#divServicesTotalPrice")[0].innerText.replace(/\$/g,"").replace(/£/g,"")),!0,2))):(_shopdetail.BookingDetail.Prepay.ccAmt=parseFloat(_shopdetail.BookingDetail.Prepay.ccAmt-ConvertTodecimalMorePrecious(h,!0,2)),_shopdetail.BookingDetail.Prepay.tax=parseFloat(_shopdetail.BookingDetail.Prepay.tax-ConvertTodecimalMorePrecious(h,!0,2)),_shopdetail.BookingDetail.Prepay.displayTax=parseFloat(_shopdetail.BookingDetail.Prepay.displayTax-ConvertTodecimalMorePrecious(h,!0,2)),_shopdetail.BookingDetail.Prepay.amtPaid=parseFloat(_shopdetail.BookingDetail.Prepay.amtPaid-ConvertTodecimalMorePrecious(h,!0,2)))}if(null!=SelectedAddonService&&SelectedAddonService.length>0){for(var b=0;b<SelectedAddonService.length;b++)for(C=0;C<SelectedAddonService[b].lstAddonService.length;C++){var S=SelectedAddonService[b].lstAddonService[C].BusinessTax;if(null!=S&&S.length>0)for(v=0;v<S.length;v++)if(null!=SelectedAddonService[b].lstAddonService[C].GCDetail&&SelectedAddonService[b].lstAddonService[C].GCDetail.length>0&&null!=SelectedAddonService[b].lstAddonService[C].GCDetail[0].Taxes&&e("#divServiceMultipleTaxes").find("#divServiceTaxValue_"+S[v].BusinessTaxID).length>0){y=e("#divServiceMultipleTaxes").find("#divServiceTaxValue_"+S[v].BusinessTaxID)[0].innerHTML;if(0!=parseFloat(y)){y=ConvertTodecimalMorePrecious(parseFloat(y.replace(/\$/g,"").replace(/£/g,"")),!0,2),y=ConvertTodecimalMorePrecious(y-S[v].CalculatedTax,!0,2),e("#divServiceMultipleTaxes").find("#divServiceTaxValue_"+S[v].BusinessTaxID)[0].innerHTML=_shopdetail.BookingDetail.CurrencySymbol+y;const t=document.querySelectorAll(".div-block-26 .web-body-font");let i=0;t.forEach(e=>{const t=parseFloat(e.textContent.replace("$","").replace("£",""));i+=isNaN(t)?0:t}),e("#divServicesTotalPrice")[0].innerText=_shopdetail.BookingDetail.CurrencySymbol+ConvertTodecimalMorePrecious(parseFloat(e("#divServicesSubTotal")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))+i,!0,2),m+=S[v].CalculatedTax,"none"!=e("#dvdepositsblock").css("display")&&(e("#dvservicesdepositpricewithoutGC")[0].innerText=_shopdetail.BookingDetail.CurrencySymbol+ConvertTodecimalMorePrecious(parseFloat(e("#dvservicesdepositpricewithoutGC")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))-ConvertTodecimalMorePrecious(m,!0,2),!0,2))}}}e("#dvservicesPrepaypricewithoutGC")[0].innerText=_shopdetail.BookingDetail.CurrencySymbol+ConvertTodecimalMorePrecious(parseFloat(e("#divServicesTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))-ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.RedeemedByGC.reduce((e,t)=>e+t.redeemAmt,0),!0,2),!0,2),"none"==e("#dvdepositsblock").css("display")?(_shopdetail.BookingDetail.Prepay.ccAmt=parseFloat(ConvertTodecimalMorePrecious(parseFloat(e("#divServicesTotalPrice")[0].innerHTML.replace(/\$/g,"").replace(/£/g,""))-ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.RedeemedByGC.reduce((e,t)=>e+t.redeemAmt,0),!0,2),!0,2)),_shopdetail.BookingDetail.Prepay.tax=parseFloat(ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.tax-ConvertTodecimalMorePrecious(m,!0,2),!0,2)),_shopdetail.BookingDetail.Prepay.displayTax=parseFloat(ConvertTodecimalMorePrecious(_shopdetail.BookingDetail.Prepay.displayTax-ConvertTodecimalMorePrecious(m,!0,2),!0,2)),_shopdetail.BookingDetail.Prepay.amtPaid=parseFloat(ConvertTodecimalMorePrecious(parseFloat(e("#divServicesTotalPrice")[0].innerText.replace(/\$/g,"").replace(/£/g,"")),!0,2))):(_shopdetail.BookingDetail.Prepay.ccAmt=parseFloat(_shopdetail.BookingDetail.Prepay.ccAmt-ConvertTodecimalMorePrecious(m,!0,2)),_shopdetail.BookingDetail.Prepay.tax=parseFloat(_shopdetail.BookingDetail.Prepay.tax-ConvertTodecimalMorePrecious(m,!0,2)),_shopdetail.BookingDetail.Prepay.displayTax=parseFloat(_shopdetail.BookingDetail.Prepay.displayTax-ConvertTodecimalMorePrecious(m,!0,2)),_shopdetail.BookingDetail.Prepay.amtPaid=parseFloat(_shopdetail.BookingDetail.Prepay.amtPaid-ConvertTodecimalMorePrecious(m,!0,2)))}}},_shopdetail.VagaroPayLaterPaymentMethod=function(){var t=e(".familycktfrnd ul li.selected").data("value");_shopdetail.DisplayVPLCetegeyOrAffirm(1),UserID!=t?(e("#tabBooking1").addClass("w--current"),e("#tabVagaroPayLater").removeClass("w--current"),e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide(),_onlineCheckout.IsVplChanged=!1):(e("#tabVagaroPayLater").show(),_shopdetail.VPLMessage(_shopdetail.vplamt))},_shopdetail.BindDiscountOnItemsStrike=function(){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){var i=t.AppSrNo;if(_shopdetail.BindDiscountOnItemsStrikeAddons(t.lstAddonService,t.serviceid,t.AppSrNo),t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&(t.Discount>0||t.ServiceOrginalPrice-t.priceOriginal>0&&t.ServiceOrginalPrice!=t.price||t.ServiceOrginalPrice!=t.price))e("#divPricePoint_"+i).html('<div class="thm-textColor"> <span class="item-price-line-through web-builder-font-color">'+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.ServiceOrginalPrice)+"</span> "+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.price)+"</div>");else if(t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&void 0!==t.IsPartialPoint&&0==t.IsPartialPoint){if(e("#divPricePoint_"+i).html(_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.price)),null!=t.lstAddonService&&t.lstAddonService.length>0)for(var a=0;a<t.lstAddonService.length;a++)0==t.lstAddonService[a].isPresetApply&&(e("#divPricePoint_"+t.serviceid+"_"+a).html(_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.lstAddonService[a].OriginalPrice)),e("#divPricePoint_"+t.lstAddonService[a].ServiceId+"_"+t.lstAddonService[a].AppSrNo).html(_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.lstAddonService[a].OriginalPrice))),1==t.lstAddonService[a].isPresetApply&&e("#divPricePoint_"+t.serviceid+"_"+a).html('<div class="thm-textColor"> <span class="item-price-line-through web-builder-font-color">'+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.lstAddonService[a].OriginalPrice)+"</span> "+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.lstAddonService[a].Price)+"</div>");t.IsMembershipApply&&e("#divPricePoint_"+i).html('<div class="thm-textColor"> <span class="item-price-line-through web-builder-font-color">'+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.ServiceOrginalPrice)+"</span> "+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t.price)+"</div>")}else _shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,0)})},_shopdetail.BindDiscountOnItemsStrikeAddons=function(t,i,a){if(null!=t&&t.length>0)for(var r=0;r<t.length;r++)(1==t[r].IsMembershipApply||1==t[r].isPresetApply||t[r].PromotionID>0)&&e("#divPricePoint_"+t[r].ServiceId+"_"+a).html('<div class="thm-textColor"> <span class="item-price-line-through web-builder-font-color">'+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t[r].priceOriginal)+"</span> "+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,t[r].Price)+"</div>")},_shopdetail.ChangeContactType=function(t){"1"==t?(e("#divCell").show(),e("#divPhone").hide(),e("#txtCell").val(""),e("#divPhone").removeClass("inputError")):(e("#divPhone").show(),e("#divCell").hide(),e("#divCell").removeClass("inputError"),e("#txtPhone").val(""))},_shopdetail.GetIsFromWidget=function(){return e("#hdnIsFromWidgetPage").val()},_shopdetail.ValiDateCell=function(){var t=!0;if(_shopdetail.VisibleControlLength("#divCell")>0){e("#dvValidationCell").html("");var i=e("#txtCell");""==i.val().trim()?(t=!1,e("#dvValidationCell").html("Please enter Cell.")):(i.val().trim().length<10||i.val().trim().length>10&&0!=i.val().trim().substring(0,1))&&(t=!1,e("#dvValidationCell").html("Cell should be of 10 digits."))}return 1==t?e("#divCell").removeClass("inputError"):e("#divCell").addClass("inputError"),t},_shopdetail.ValiDatePhone=function(){var t=!0;_shopdetail.VisibleControlLength("#divPhone")>0&&(e("#dvValidationPhone").html(""),""==e("#txtPhone").val().trim()&&(t=!1,e("#dvValidationPhone").html("Please enter Day/Night Phone.")));return 1==t?e("#divPhone").removeClass("inputError"):e("#divPhone").addClass("inputError"),t},_shopdetail.ValidateDistance=function(){var t=e("#"+e("input",e("#s2id_txtAddress")[0].childNodes[0].lastChild)[0].id).val().split(","),i=[],a={};a.BusinessID=parseInt(getBusinessID()),a.City=t[1].trim(),a.StateID=t.stateId,a.CutomerId=parseInt(UserID),i.push(a);var r=new vagaro.ajax;r.datamodel.Token="GetCityBusiness",r.datamodel.data=i,r.datamodel.callback=function(t){return t?(ShowLoader(!1),!0):(e("#location-out").modal("show"),ShowLoader(!1),!1)},r.datamodel.Error=function(e){return ShowLoader(!1),!1},r.Post()},_shopdetail.ValidateControls=function(t){if(SBCancellationPolicy=e("#dvOnlineBookingCancellationPolicy").html(),_shopdetail.VisibleControlLength("#ddOutcall")>0)if(e("#OutCallTab2").hasClass("w--current")){if(!houseCallAddress.validateAddressData())return!1}else if(e("#OutCallTab1").hasClass("w--current")&&""==e("#hdnOutcallAddress").val()){if(_shopdetail.SetOutCallType(2),!houseCallAddress.validateAddressData())return!1}if(!_shopdetail.validatePhoneNumber())return e("html, body").animate({scrollTop:e("#ddPhone").offset().top},300),!1;if(""!=SBCancellationPolicy&&_shopdetail.VisibleControlLength("#lblCancellationPolicy")>0){if(0==e("#chkIsMailSendTextPreview").prop("checked"))return _shopdetail.CancelPolicyPopup(),!1;e("#lblCancellationPolicy").removeClass("label-error").css("color","")}return!0},_shopdetail.CancelPolicyPopup=function(){swal({title:"",text:"By selecting “Agree & Continue,” you acknowledge and accept the Cancellation Policy and Terms & Conditions of this business.",html:!0,showCancelButton:!0,confirmButtonText:"Agree & Proceed",cancelButtonText:"Disagree",customClass:"sweet-alert-model"},function(t){t?(e("#chkIsMailSendTextPreview").prop("checked",!0),e("#lblCancellationPolicy").removeClass("label-error").css("color",""),e("#btnAppointment").is(":visible")?e("#btnAppointment").click():e("#btnAppointmentWithCC").is(":visible")&&e("#btnAppointmentWithCC").click()):(e("#lblCancellationPolicy").addClass("label-error").css("color","#FF0000"),e("#chkIsMailSendTextPreview").focus(),swal.close())})},_shopdetail.VPLFinalSubmit=function(t){if(ShowLoader(!0),1==t){if(0==_shopdetail.AffirmVPLCapture(!0))return ShowLoader(!1),!1;e("#finalCheckout").val(1),_shopdetail.SaveOnlineBooking("","",null)}else e("#finalCheckout").val(1),_shopdetail.SaveOnlineBooking("","",null)},_shopdetail.AffirmVPLCapture=function(t){var i=JSON.parse(e("#hdnUserDetails").val());if(1==t&&String.isNullOrUndefineOrBlank(i.EmailId)&&String.isNullOrUndefineOrBlank(e("#txtAffirmEmailId").data("EmailId")))return _onlineCheckout.DisplayAffirmEmailValidation(),!1;var a="";return a=2==i.CountryID?"UK":3==i.CountryID?"CA":4==i.CountryID?"AU":"US",{ShopperName:{FirstName:i.FirstName,LastName:i.LastName},ShopperAddress:{City:String.isNullOrUndefineOrBlank(i.City)?"":i.City,Country:a,HouseNumberOrName:String.isNullOrUndefineOrBlank(i.StreetNo)?"":i.StreetNo,PostalCode:String.isNullOrUndefineOrBlank(i.Zip)?"":i.Zip,StateOrProvince:String.isNullOrUndefineOrBlank(i.StateCode)?"":i.StateCode,Street:String.isNullOrUndefineOrBlank(i.Street)?"":i.Street},ShopperEmail:String.isNullOrUndefineOrBlank(i.EmailId)?e("#txtAffirmEmailId").data("EmailId"):i.EmailId,ShopperPhoneNumber:String.isNullOrUndefineOrBlank(i.Cell)?"":i.Cell}},_shopdetail.DisplayVPLCetegeyOrAffirm=function(t){1==_siteBuilderDetail.isAffirmEnable?1==t&&(e("#tabVagaroPayLaterCertegy").hide(),e("#tabVagaroPayLaterAffirm").show()):1==t&&(e("#tabVagaroPayLaterCertegy").show(),e("#tabVagaroPayLaterAffirm").hide())},_shopdetail.validatePhoneNumber=function(){var t=!0;if(_shopdetail.VisibleControlLength("#ddPhone")>0){var i={},a={};_shopdetail.VisibleControlLength("#divPhone")>0?(t=onlinecustdayPhone.validatePhoneNumber(!0),i=onlinecustdayPhone.getValidateMessage(),0==t&&(a="#dvValidationPhone")):(t=onlinecustcellPhone.validatePhoneNumber(!0),i=onlinecustcellPhone.getValidateMessage(),0==t&&(a="#dvValidationCell")),t?e(a).hide():1==i.WarningType?(e(a).html("Please enter Cell."),e(a).show()):2==i.WarningType?(e(a).html(i.WarningMessage),e(a).show()):3==i.WarningType&&(e(a).html("Cell should be of 10 digits."),e(a).show())}return t},_shopdetail.ProceedforBooking=function(t){if(!_shopdetail.ValidateFirstTimeCustomerSelection())return!1;try{var i="",a=e("#btnAppointment").text(),r=0;e("#mobile-check").is(":visible")&&(isFinalBookClicked=!0),e.grep(BusinessBookingDetail.AppointmentDetail,function(t){i="Request"!=a;var o=BusinessBookingDetail.spname.split(","),n=BusinessBookingDetail.starttime.split(","),s=BusinessBookingDetail.date.split(","),l={};l.PageName=0==i?"Request":"Book",l.Category="Book",l.Action=l.PageName+" Service",l.BusinessName=_shopdetail.businessName;var d=0;null!=e("#hdnSiteBuilderBusinessID")&&null!=e("#hdnSiteBuilderBusinessID").val()&&(d=parseInt(e("#hdnSiteBuilderBusinessID").val())),l.BusinessID=d,l.ServicePrice=currencySymbol+t.price.format("#.##"),l.ServiceName=t.servicename,l.EmpName=o[r],l.ServiceTime=n[r],l.isAppointmentBooked=i;var c=new Date(s[r]);l.ServiceDate=c.toISOString().split("T")[0],r++,_vgLogEvent.LogData(l)})}catch(e){}if(BusinessBookingDetail="",_onlineCheckout.isCheckoutVPLChanged&&(t="BookWithVPL"),(null!=e("#divServicesTotalPrice")[0].innerHTML&&null!=e("#divServicesTotalPrice")[0].innerHTML||null!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&null!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML)&&("Free"!=e("#divServicesTotalPrice")[0].innerHTML&&"Free"!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML||"bookwithvpl"!=t.toLowerCase()&&(_onlineCheckout.isCheckoutVPLChanged=!1)),e("#addnewffpopup").is(":visible")){if(!_sharing.CheckAnyTabSelected())return void e("html,body").animate({scrollTop:e("#divAddNewFamilyFriendTabLink").offset().top-130},"medium","linear");_sharing.SourceButtonName=t,_sharing.AddEditUserFamilyFriend()}else if("bookwithcc"==t.toLowerCase()||1==_shopdetail.IsUpSellDataExistswithCCOff()){_shopdetail.ValidateBookingDataWithCC();try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){var o={eventName:"BookingCompleted",timestamp:(new Date).getTime(),data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:"",paymentCardOnFile:paymentCardOnFile}};"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(o)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(o)}}catch(e){}_onlineCheckout.isFormsbookwithcc=!0}else if("bookwithoutcc"==t.toLowerCase()){if(0==_shopdetail.ValidateControls())return!1;if(0==_shopdetail.GetValidatePromotionsDetails())return!1;_shopdetail.VPLFinalSubmit(),_onlineCheckout.isFormsbookwithoutcc=!0;try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||1==("undefined"!=typeof isWidget&&null!=$Interframe&&"true"==isWidget.toLowerCase())){o={eventName:"BookingCompleted",timestamp:(new Date).getTime(),data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:"",paymentCardOnFile:paymentCardOnFile}};"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(o)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(o)}}catch(e){}}else if("bookwithvpl"==t.toLowerCase()){if(!_onlineCheckout.UpdateAffirmUserData())return!1;_shopdetail.ValidateBookingDataWithoutCC(),_onlineCheckout.isFormsbookwithoutcc=!0;try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){o={eventName:"BookingCompleted",timestamp:(new Date).getTime(),data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:"",paymentCardOnFile:paymentCardOnFile}};"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(o)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(o)}}catch(e){}}setTimeout(function(){e("#divDatemonth").focus()},500)},_shopdetail.AddEventLogInFirebase=function(){try{var t="",i=e("#btnAppointment").text(),a=0;e.grep(BusinessBookingDetail.AppointmentDetail,function(r){t="Request"!=i;var o=BusinessBookingDetail.spname.split(","),n=BusinessBookingDetail.starttime.split(","),s=BusinessBookingDetail.date.split(","),l="";l=0==t?"Request":"Book";var d={};d.Category="Request"==l?"Book_Service_Request":"Book_Service_Confirmation_Page",d.Action=l+" Service",d.PageName=l;var c=0;c=null!=e("#hdnSiteBuilderBusinessID")&&null!=e("#hdnSiteBuilderBusinessID").val()?parseInt(e("#hdnSiteBuilderBusinessID").val()):businessID,d.BusinessID=c,d.BusinessName=_shopdetail.businessName,d.EmpName=o[a];var u=new Date(s[a]);d.ServiceDate=u.toISOString().split("T")[0],d.ServiceTime=n[a],d.ServiceName=r.servicename,d.ServicePrice=currencySymbol+r.price.format("#.##"),d.isAppointmentBooked=t,a++,_vgLogEvent.LogEventData(d)}),String.isNullOrUndefineOrBlank(e(_shopdetail.txtLiveStreamAddress).val())&&String.isNullOrUndefineOrBlank(e("#hdnServiceLiveStreamSelectedVal").data("actualvalue"))?_siteBuilderDetail.IsShowNewadd?_shopdetail.BookingDetail.AppointmentDetail[0].Isaddresschecked=!0:_shopdetail.BookingDetail.AppointmentDetail[0].Isaddresschecked=!1:_shopdetail.BookingDetail.AppointmentDetail[0].Isaddresschecked=!0,_siteBuilderDetail.IsShowNewadd=!1}catch(e){}},_shopdetail.ValidateAndGetFormDetails=function(t){var i=0;if("undefined"!=typeof UserID){var a=e(".familycktfrnd ul li.selected").data("value");i=void 0!==a&&UserID!=a?a:UserID}for(var r=!1,o=!1,n=0;n<IsFormApplicableUserArr.length;n++)IsFormApplicableUserArr[n][0]==i&&(r=!0,1==IsFormApplicableUserArr[n][1]&&(o=!0));if("bookwithcc"==t.toLowerCase()){if(0==_shopdetail.ValidateControls())return!1;var s=!0;if(1==_IsPrepay&&_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount<=0&&(s=!1),(null==ZenSwipeCardDetails||null==ZenSwipeCardDetails.card_token)&&1==isCCChanged&&1==s)return ShowLoader(!0),vui.frame.zenswipe.submit(),!1;if(0==_shopdetail.GetValidatePromotionsDetails())return!1;_shopdetail.EnableDisableButton(!1),!r||o?(_onlineCheckout.isFormsbookwithcc=!0,GetFormsDetails(hdnCommandArgArray.serviceid)):(_shopdetail.ValidateBookingDataWithCC(),_onlineCheckout.IsShowForms(!1))}else if("bookwithoutcc"==t.toLowerCase()){if(0==_shopdetail.ValidateControls())return!1;if(0==_shopdetail.GetValidatePromotionsDetails())return!1;_shopdetail.EnableDisableButton(!1),!r||o?(_onlineCheckout.isFormsbookwithoutcc=!0,GetFormsDetails(hdnCommandArgArray.serviceid)):(_shopdetail.VPLFinalSubmit(),_onlineCheckout.IsShowForms(!1))}},_shopdetail.ValidateAndGetFormDetailsforFFSharing=function(){var t=0;if("undefined"!=typeof UserID){var i=e(".familycktfrnd ul li.selected").data("value");t=void 0!==i&&UserID!=i?i:UserID}for(var a=!1,r=!1,o=0;o<IsFormApplicableUserArr.length;o++)IsFormApplicableUserArr[o][0]==t&&(a=!0,1==IsFormApplicableUserArr[o][1]&&(r=!0));!a||r?GetFormsDetails(hdnCommandArgArray.serviceid):_onlineCheckout.IsShowForms(!1)},_shopdetail.ValidatePaymentMethodInfo=function(){if(1==e("#tabVagaroPayLater").hasClass("w--current")||1==e(_shopdetail.Controls.tabGooglePay).hasClass("w--current")||1==e(_shopdetail.Controls.tabApplePay).hasClass("w--current"))return!0;var t=0;null!=_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay.ccAmt&&null!=_shopdetail.BookingDetail.Prepay.ccAmt&&null!=_shopdetail.BookingDetail.TipAmount&&null!=_shopdetail.BookingDetail.TipAmount&&(t=_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount);var i=t>0&&_shopdetail.BookingDetail.DepositsLimit>0&&_shopdetail.BookingDetail.DepositsPer>0,a="true"===e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&!String.isNullOrUndefineOrBlank(gbltotPrice)&&""!=e("#hdnAllowCCCapturedAbove").val()&&gbltotPrice>=parseFloat(e("#hdnAllowCCCapturedAbove").val()),r=!String.isNullOrUndefineOrBlank(ZenSwipeCardDetails)&&!String.isNullOrUndefineOrBlank(ZenSwipeCardDetails.card_token),o=!String.isNullOrUndefineOrBlank(_CCDetailCardOnFile)&&!String.isNullOrUndefineOrBlank(_CCDetailCardOnFile.CardTokenId);return!((a||i)&&!r&&!o)},_shopdetail.ValidateBookingDataWithCC=function(){if(0==_shopdetail.ValidateControls())return!1;var t,i=e("#dvBookingTabs").find(".w--current").attr("id");t=void 0===i||""==i||"tabBooking1"!=i&&"tabBooking2"!=i&&i!=_shopdetail.Controls.keyApplePay&&i!=_shopdetail.Controls.keyGooglePay&&1!=e("#"+i).data("isothercard"),ccDetails={};var a="",r=!0,o=void 0!==_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay?_shopdetail.BookingDetail.Prepay.ccAmt:0;if(1==_IsPrepay&&o+_shopdetail.BookingDetail.TipAmount<=0&&"false"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&(r=!1),(null==ZenSwipeCardDetails||null==ZenSwipeCardDetails.card_token)&&1==isCCChanged&&1==r)return ShowLoader(!0),vui.frame.zenswipe.submit(),e("html, body").animate({scrollTop:e("#dvCCSection").offset().top},300),!1;if((e(_shopdetail.Controls.tabGooglePay).is(":visible")||e(_shopdetail.Controls.tabApplePay).is(":visible"))&&!String.isNullOrUndefineOrBlank(i)&&(i.toLowerCase()==_shopdetail.Controls.keyGooglePay.toLowerCase()||i.toLowerCase()==_shopdetail.Controls.keyApplePay.toLowerCase()))if(String.isNullOrUndefineOrBlank(_CCDetailCardOnFile.CardTokenId)||void 0===_CCDetailCardOnFile.IsTokenGenerated||null==_CCDetailCardOnFile.IsTokenGenerated||""==typeof _CCDetailCardOnFile.IsTokenGenerated||1!=_CCDetailCardOnFile.IsTokenGenerated){if(!String.isNullOrUndefineOrBlank(_CCDetailCardOnFile.CardTokenId)&&void 0!==_CCDetailCardOnFile.IsTokenGenerated&&null!=_CCDetailCardOnFile.IsTokenGenerated&&""!=typeof _CCDetailCardOnFile.IsTokenGenerated)return vagaro.alert("Please select "+e(_shopdetail.Controls.tabGooglePay).hasClass("w--current")==1?"google":"apple pay payment method"),!1;if(1!=_CCDetailCardOnFile.IsTokenGenerated){if(ShowLoader(!0),e(_shopdetail.Controls.tabGooglePay).is(":visible")&&i.toLowerCase()==_shopdetail.Controls.keyGooglePay.toLowerCase()){var n=0;n="true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&""!=e("#hdnAllowCCCapturedAbove").val()&&gbltotPrice>=parseFloat(e("#hdnAllowCCCapturedAbove").val())?0:_shopdetail.parseTodecimal(o+_shopdetail.BookingDetail.TipAmount),_shopdetail.OpenGoogleApplePaymentInfoPopup(1==e(_shopdetail.Controls.tabGooglePay).hasClass("w--current")?PaymentMethod.GooglePay:PaymentMethod.ApplePay,!1,n)}else e(_shopdetail.Controls.tabApplePay).is(":visible")&&i.toLowerCase()==_shopdetail.Controls.keyApplePay.toLowerCase()&&startApplePaySession();return!1}}else;if(0==_shopdetail.GetValidatePromotionsDetails())return!1;var s={};if(1==e("#dvBookingTabs").find(".w--current").data("isothercard")||1==r&&1==isCCChanged&&void 0!==ZenSwipeCardDetails&&null!=ZenSwipeCardDetails.card_token?(void 0!==BusSavedCard&null!=BusSavedCard&&(s.CreditCardType=BusSavedCard.CreditCardType,s.CreditCardNumber=BusSavedCard.CreditCardNumber,s.SecurityCode=BusSavedCard.SecurityCode,s.ExpMonth=BusSavedCard.ExpMonth,s.ExpYear=BusSavedCard.ExpYear,s.CCFirstName=BusSavedCard.CCFirstName,s.CCMiddleName=BusSavedCard.CCMiddleName,s.CCLastName=BusSavedCard.CCLastName,s.CardTokenId=BusSavedCard.CardTokenId,s.BusinessID=BusSavedCard.BusinessID,s.businessCount=BusSavedCard.businessCount),1==e("#dvBookingTabs").find(".w--current").data("isothercard")?(s.isMongo=e("#dvBookingTabs").find(".w--current").data("ismongo"),s.UsedCardTokenId=_CCDetailCardOnFile.CardTokenId,_CCDetailCardOnFile.isSaveCard=!0):(s.isMongo=!1,s.UsedCardTokenId=ZenSwipeCardDetails.card_token)):s=null,1==r&&1==isCCChanged&&void 0!==ZenSwipeCardDetails&&null!=ZenSwipeCardDetails.card_token){1!=_IsPrepay&&1!=_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()||1!=r||(ccDetails.ccNo=ZenSwipeCardDetails.cc_no.escapeHtml(),ccDetails.ccSecurityCode=ZenSwipeCardDetails.cvv.escapeHtml(),ccDetails.ccFirstName=ZenSwipeCardDetails.first_name.escapeHtml(),ccDetails.ccMiddleName=null!=typeof ZenSwipeCardDetails.middle_name&&null!=ZenSwipeCardDetails.middle_name?ZenSwipeCardDetails.middle_name.escapeHtml():" ",ccDetails.ccLastName=ZenSwipeCardDetails.last_name.escapeHtml(),ccDetails.ccType=ZenSwipeCardDetails.cc_type,ccDetails.cardTokenId=ZenSwipeCardDetails.card_token);var l=null!=typeof ZenSwipeCardDetails.middle_name&&null!=ZenSwipeCardDetails.middle_name?ZenSwipeCardDetails.middle_name.escapeHtml():" ";a="<root>";a+="<UserCCDetail><UCCType>"+ZenSwipeCardDetails.cc_type+"</UCCType>",a+="<UCCNo>"+ZenSwipeCardDetails.cc_no.escapeHtml()+"</UCCNo>",a+="<UCCSecurityCode>"+ZenSwipeCardDetails.cvv.escapeHtml()+"</UCCSecurityCode>",a+="<UCCFirstName>"+ZenSwipeCardDetails.first_name.escapeHtml()+"</UCCFirstName>",a+="<UCCMiddleName>"+l+"</UCCMiddleName>",a+="<UCCLastName>"+ZenSwipeCardDetails.last_name.escapeHtml()+"</UCCLastName>",a+="<UCCTokenID>"+ZenSwipeCardDetails.card_token+"</UCCTokenID>",a+="<UCCExpMonth>"+(void 0!==ZenSwipeCardDetails.expire_month&&null!=ZenSwipeCardDetails.expire_month?ZenSwipeCardDetails.expire_month:0)+"</UCCExpMonth>",a+="<UCCExpYear>"+(void 0!==ZenSwipeCardDetails.expire_year&&null!=ZenSwipeCardDetails.expire_year?ZenSwipeCardDetails.expire_year:0)+"</UCCExpYear>",a+="</UserCCDetail></root>"}else if(1==_IsPrepay&&1==r){if(ccDetails.ccNo=_CCDetailCardOnFile.CreditCardNumber,ccDetails.ccSecurityCode=_CCDetailCardOnFile.SecurityCode,ccDetails.ccFirstName=_CCDetailCardOnFile.CCFirstName,ccDetails.ccMiddleName=_CCDetailCardOnFile.CCMiddleName,ccDetails.ccLastName=_CCDetailCardOnFile.CCLastName,ccDetails.ccType=_CCDetailCardOnFile.CreditCardType,ccDetails.cardTokenId=_CCDetailCardOnFile.CardTokenId,"undefined"!=typeof _CCDetailCardOnFile&&null!=_CCDetailCardOnFile&&void 0!==_CCDetailCardOnFile.isSaveCard&&null!=_CCDetailCardOnFile.isSaveCard&&1==_CCDetailCardOnFile.isSaveCard){a="<root>";a+="<UserCCDetail><UCCType>"+_CCDetailCardOnFile.CreditCardType+"</UCCType>",a+="<UCCNo>"+_CCDetailCardOnFile.CreditCardNumber+"</UCCNo>",a+="<UCCSecurityCode>"+_CCDetailCardOnFile.SecurityCode+"</UCCSecurityCode>",a+="<UCCFirstName>"+_CCDetailCardOnFile.CCFirstName+"</UCCFirstName>",a+="<UCCMiddleName>"+_CCDetailCardOnFile.CCMiddleName+"</UCCMiddleName>",a+="<UCCLastName>"+_CCDetailCardOnFile.CCLastName+"</UCCLastName>",a+="<UCCTokenID>"+_CCDetailCardOnFile.CardTokenId+"</UCCTokenID>",a+="<UCCExpMonth>"+(void 0!==_CCDetailCardOnFile.ExpMonth&&null!=_CCDetailCardOnFile.ExpMonth?_CCDetailCardOnFile.ExpMonth:0)+"</UCCExpMonth>",a+="<UCCExpYear>"+(void 0!==_CCDetailCardOnFile.ExpYear&&null!=_CCDetailCardOnFile.ExpYear?_CCDetailCardOnFile.ExpYear:0)+"</UCCExpYear>",a+="</UserCCDetail></root>"}}else if(1==r&&0==_IsPrepay&&1==t){a="<root>";a+="<UserCCDetail><UCCType>"+_CCDetailCardOnFile.CreditCardType+"</UCCType>",a+="<UCCNo>"+_CCDetailCardOnFile.CreditCardNumber+"</UCCNo>",a+="<UCCSecurityCode>"+_CCDetailCardOnFile.SecurityCode+"</UCCSecurityCode>",a+="<UCCFirstName>"+_CCDetailCardOnFile.CCFirstName+"</UCCFirstName>",a+="<UCCMiddleName>"+_CCDetailCardOnFile.CCMiddleName+"</UCCMiddleName>",a+="<UCCLastName>"+_CCDetailCardOnFile.CCLastName+"</UCCLastName>",a+="<UCCTokenID>"+_CCDetailCardOnFile.CardTokenId+"</UCCTokenID>",a+="<UCCExpMonth>"+_CCDetailCardOnFile.ExpMonth+"</UCCExpMonth>",a+="<UCCExpYear>"+_CCDetailCardOnFile.ExpYear+"</UCCExpYear>",a+="<isSharedCCdetail>1</isSharedCCdetail>",a+="</UserCCDetail></root>"}else if(0==_IsPrepay&&1==r&&(ccDetails.ccNo=_CCDetailCardOnFile.CreditCardNumber,ccDetails.ccSecurityCode=_CCDetailCardOnFile.SecurityCode,ccDetails.ccFirstName=_CCDetailCardOnFile.CCFirstName,ccDetails.ccMiddleName=_CCDetailCardOnFile.CCMiddleName,ccDetails.ccLastName=_CCDetailCardOnFile.CCLastName,ccDetails.ccType=_CCDetailCardOnFile.CreditCardType,ccDetails.cardTokenId=_CCDetailCardOnFile.CardTokenId,"undefined"!=typeof _CCDetailCardOnFile&&null!=_CCDetailCardOnFile&&void 0!==_CCDetailCardOnFile.isSaveCard&&null!=_CCDetailCardOnFile.isSaveCard&&1==_CCDetailCardOnFile.isSaveCard)){a="<root>";a+="<UserCCDetail><UCCType>"+_CCDetailCardOnFile.CreditCardType+"</UCCType>",a+="<UCCNo>"+_CCDetailCardOnFile.CreditCardNumber+"</UCCNo>",a+="<UCCSecurityCode>"+_CCDetailCardOnFile.SecurityCode+"</UCCSecurityCode>",a+="<UCCFirstName>"+_CCDetailCardOnFile.CCFirstName+"</UCCFirstName>",a+="<UCCMiddleName>"+_CCDetailCardOnFile.CCMiddleName+"</UCCMiddleName>",a+="<UCCLastName>"+_CCDetailCardOnFile.CCLastName+"</UCCLastName>",a+="<UCCTokenID>"+_CCDetailCardOnFile.CardTokenId+"</UCCTokenID>",a+="<UCCExpMonth>"+(void 0!==_CCDetailCardOnFile.ExpMonth&&null!=_CCDetailCardOnFile.ExpMonth?_CCDetailCardOnFile.ExpMonth:0)+"</UCCExpMonth>",a+="<UCCExpYear>"+(void 0!==_CCDetailCardOnFile.ExpYear&&null!=_CCDetailCardOnFile.ExpYear?_CCDetailCardOnFile.ExpYear:0)+"</UCCExpYear>",a+="</UserCCDetail></root>"}_shopdetail.EnableDisableButton(!1),_shopdetail.SaveOnlineBooking(a,ccDetails,s)},_shopdetail.ValidateBookingDataWithoutCC=function(){if(0==_shopdetail.ValidateControls())return!1;if(0==_shopdetail.GetValidatePromotionsDetails())return!1;if(_shopdetail.EnableDisableButton(!1),1==_onlineCheckout.isCheckoutVPLChanged){if(null==typeof MerchantTokenID&&String.isNullOrUndefineOrBlank(MerchantTokenID))return vagaro.alert("Some error occured. Please try again."),!1;if(VplSelectedBank={},1==_siteBuilderDetail.isAffirmEnable);else{if(null==typeof ObjBankDetail&&null==ObjBankDetail.length)return void vagaro.alert("Add bank for vagaro pay later.");if(null==typeof e('input[type="radio"][name="vpl-bank"]:checked').val()||null==e('input[type="radio"][name="vpl-bank"]:checked').val())return vagaro.alert("Please add bank account to pay with Vagaro Pay Later."),void ShowLoader(!1);SelectedBank=e.grep(ObjBankDetail,function(t){return t.Id==e('input[type="radio"][name="vpl-bank"]:checked').val()}),VplSelectedBank=SelectedBank}e("#VplAmount").length>0&&(FinalCCAmount=e("#VplAmount").data("vplAmt")),1==_siteBuilderDetail.isAffirmEnable?_shopdetail.VPLFinalSubmit(!0):(e("#divVplCheckoutScreen").show(),e(".mulvplbook").hide()),e("#divVplTracking").hide(),e("#subtotalCheckoutScreen").text("Subtotal: "+_shopdetail.currencySymbol+FinalCCAmount)}},_shopdetail.CheckBusinessCCDetails=function(){ShowLoader(!0);var e=new vagaro.ajax;e.datamodel.async=!1,e.datamodel.Token="GetBusinessCCDetailsByBusinessID",e.datamodel.data=[_shopdetail.businessID],e.datamodel.callback=_shopdetail.CallSuccess_CheckBusinessCCDetails,e.datamodel.Error=function(e){},e.Post()},_shopdetail.CallSuccess_CheckBusinessCCDetails=function(t){ShowLoader(!1),gbltotPrice<=t.AllowCCCapturedAbove&&(t.IsCCCapturedAllowed=!1),!1!==t.IsCCCapturedAllowed?e("#dvBookAppCCFoundConfirmtion").modal("show"):_shopdetail.SaveOnlineBooking("","",null)},_shopdetail.RediretoBookTabForCCCapture=function(){_shopdetail.CallBookData(),e("#dvBookAppCCFoundConfirmtion").modal("hide")},_shopdetail.SaveOnlineBooking=function(t,i,a){if(0==_shopdetail.ValidatePaymentMethodInfo())return _shopdetail.HideShowLoader(!1),vagaro.alert("Please select payment method"),!1;if("true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&e("#dvBookingPaymentMethod").is(":visible")&&e("#dvBookingTabs").is(":visible")&&(0==isCCChanged&&void 0!==_CCDetailCardOnFile.CardTokenId&&null!=_CCDetailCardOnFile.CardTokenId&&""!=_CCDetailCardOnFile.CardTokenId||1==isCCChanged&&void 0!==i&&void 0!==i.cardTokenId&&null!=i.cardTokenId&&""!=i.cardTokenId||"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&1==isCCChanged&&void 0!==ZenSwipeCardDetails&&null!=ZenSwipeCardDetails&&void 0!==ZenSwipeCardDetails.card_token&&null!=ZenSwipeCardDetails.card_token&&""!=ZenSwipeCardDetails.card_token)&&void 0!==_shopdetail.BookingDetail&&null!=_shopdetail.BookingDetail){_shopdetail.HideShowLoader(!0);var r=0;if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){e.paidType==arrpaidType.Paid&&(r+=1)}),r>0&&_shopdetail.BookingDetail.AppointmentDetail.length==r)_shopdetail.FinalSaveOnlineBooking(t,i,a);else{for(var o=[],n=_shopdetail.BookingDetail.date.split(","),s=0;s<n.length;s++)o.push(new Date(moment(n[s])));var l=new Date(Math.max.apply(null,o)),d={};d.businessId=_shopdetail.businessID,d.loginUserID=UserID,1==isCCChanged?"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&void 0!==ZenSwipeCardDetails&&null!=ZenSwipeCardDetails&&void 0!==ZenSwipeCardDetails.card_token&&null!=ZenSwipeCardDetails.card_token&&""!=ZenSwipeCardDetails.card_token?d.CardTokenId=ZenSwipeCardDetails.card_token:d.CardTokenId=i.cardTokenId:d.CardTokenId=_CCDetailCardOnFile.CardTokenId,d.app_Date=moment(l).format("YYYY/MM/DD hh:mm A");var c=new vagaro.ajax;c.datamodel.async=!1,c.datamodel.Token="GetValidateCardExpiry",c.datamodel.data=[d],c.datamodel.callback=function(r){if(null!=r&&null!=r.data&&1e3==r.custom_code)return 1==r.data.isExpiredCard?("True"==e("#hdnIsFormsEnable").val()&&(_onlineCheckout.isFormsbookwithcc=!1),_shopdetail.HideShowLoader(!1),swal({title:"",text:"This credit card will expire before the appointment date. Please update your credit card to finish booking the appointment.",showCancelButton:!1,html:!0,customClass:"sweet-alert-model text-justify-align"},function(t){e("#tabBooking2").click()}),setTimeout(function(){e(".gencutom-title").html("Credit Card Will Expire Before Appointment")},100),1==isCCChanged&&(ZenSwipeCardDetails={}),!1):(_shopdetail.FinalSaveOnlineBooking(t,i,a),!1);_shopdetail.HideShowLoader(!1),_common.PassiveAlertFailed("Some error occured. Please try again.")},c.datamodel.Error=function(e){_shopdetail.HideShowLoader(!1),_common.PassiveAlertFailed("Some error occured. Please try again.")},c.Post()}}else _shopdetail.FinalSaveOnlineBooking(t,i,a)},_shopdetail.SaveServiceBookVPL=function(e){VPLCheckoutData.ccAmt=0,VPLCheckoutData.vplAmt=_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!1,2),VPLCheckoutData.businessID=businessID,VPLCheckoutData.loggedInUserId=VplSelectedBank[0].UserID,VPLCheckoutData.BankAccountId=VplSelectedBank[0].BankId,VPLCheckoutData.AccountNumber=VplSelectedBank[0].AccountNumber,VPLCheckoutData.VplBankMasterId=VplSelectedBank[0].Id,VPLCheckoutData.ConsumerId=VplSelectedBank[0].CertegyConsumerTokenID,VPLCheckoutData.TransactionIntentId=e.intentId,intentId=e.intentId,_shopdetail.SaveOnlineBooking("","",null)},_shopdetail.GetVplMerchantID=function(){var e={};e.BusinessID=parseInt(_siteBuilderDetail.businessID),e.UserID=0==_shopdetail.BookingDetail.spid?0:parseInt(_shopdetail.BookingDetail.spid);var t=new vagaro.ajax;t.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken("vagaropaylater/getvplmerchanttokenid",groupID),t.datamodel.IsNewVagaroAPI=!0,t.datamodel.data=e,t.datamodel.callback=function(e){1e3==e.ResponseCode&&null!=e.Data&&(MerchantTokenID=e.Data.MerchantTokenID)},t.datamodel.Error=function(e){},t.Post()},_shopdetail.FinalSaveOnlineBooking=function(i,a,r){for(var o=_shopdetail.BookingDetail,n=o.serviceid.split(",").length,s=(o.AppointmentIds.split(","),new Array(n)),l=lAppID.replace(/,\s*$/,"").split(","),d=0;d<n;d++){var c={AppointmentID:0};if(t=0,clearCookie("IsPaid"),IsPaid=!1,null!=lAppID&&0!=lAppID&&(null!=l&&l.length>0&&!String.isNullOrUndefineOrBlank(HouseCallGroupID)?(c.AppointmentID=parseInt(l[d]),t=parseInt(l[d])):(c.AppointmentID=lAppID,t=lAppID)),"0"==e("#hdnLoggedInUserid").val())return _shopdetail.HidePopup(),showCommonLoginPopup("BookAppointment"),!1;if(!e(".familycktfrnd ul li.selected").data("value"))return _shopdetail.HidePopup(),showCommonLoginPopup("BookAppointment"),!1;if(parseInt(t)>0&&0==d&&null!=lAppUserID&&0!=lAppUserID?c.UserID=parseInt(lAppUserID):c.UserID=e(".familycktfrnd ul li.selected").data("value"),c.BusinessID=e("#hdnBusinessID").val(),c.CalendarID=o.calendarid.split(",")[d],c.ServiceProviderID=o.spid.split(",")[d],c.ServiceProviderName=o.spname.split(",")[d],c.ServiceID=o.serviceid.split(",")[d],c.lstAddonService=o.AppointmentDetail[d].lstAddonService,c.ServiceName=o.servicename.split("||~||")[d],c.isFromTextMarketing=isFromTextMarketing,null!=o.AppointmentDetail[d].isPresetApply&&1==o.AppointmentDetail[d].isPresetApply?c.PromotionID="0":c.PromotionID=o.AppointmentDetail[d].PromotionId,c.isNewCustomer="undefined"!=typeof IsForNewCustomer&&IsForNewCustomer,c.HasFmbFee=_shopdetail.GetFirstVisitFlag(),c.IsFMBEnableForBusiness=void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness,c.isPointApply=!1,"undefined"!=typeof isWaitingtoreal&&"undefined"!=typeof waitlistID&&0!=isWaitingtoreal&&0!=waitlistID?(c.isWaitingtoreal=isWaitingtoreal,c.waitlistID=waitlistID):(c.isWaitingtoreal=!1,c.waitlistID=0),void 0!==o.style&&""!=o.style&&(c.StyleName=o.style.split(":")[1]),0!=IsMobileServiceMandatoryInBusiness&&1==IsOutCallServiceSelected){if(e("#OutCallTab2").hasClass("w--current")){if(0==_shopdetail.ValidateControls())return ShowLoader(!1),!1;if("block"==e("#diffLocation").css("display")&&(""==e("#txtAddress").val()||null==e("#txtAddress").val()||void 0===e("#txtAddress").val()))return e("#txtAddress").addClass("errorInput"),ShowLoader(!1),!1;if(""==e("#"+e("input",e("#s2id_txtAddress")[0].childNodes[0].lastChild)[0].id).val())return e("#txtAddress").addClass("errorInput"),ShowLoader(!1),!1;serviceType=2}else e("#OutCallTab1").hasClass("w--current")?serviceType=1:serviceType=0;if(0!=serviceType&&(c.OutcallAddress=e("#hdnOutcallAddress").val()),!e("#OutCallTab3").hasClass("w--current")){c.OutcallType=serviceType,c.OutCallTime=parseInt(e("#hdnOutCallTime").val());var u="";e("#OutCallTab1").hasClass("w--current")&&(u=e("#hdnOutcallAddress").val()),e("#OutCallTab2").hasClass("w--current")&&(String.isNullOrUndefineOrBlank(e("#txtAddress").val())||(u=e("#txtAddress").val())),""!=u&&(c.OutcallAddress=u)}c.PreOutCallTime=parseInt(o.PreOutCallTime.split(",")[d]),c.PostOutCallTime=parseInt(o.PostOutCallTime.split(",")[d]),0!=IsMobileServiceMandatoryInBusiness&&0!=serviceType?c.Duration=parseInt(o.duration.split(",")[d])+c.PreOutCallTime+c.PostOutCallTime:c.Duration=parseInt(o.duration.split(",")[d]),c.OriginalDuration=o.duration.split(",")[d],c.PointRedeem=parseInt(o.pointredeem.split(",")[d]),c.Amount=o.price.split(",")[d],c.OriginalPrice=parseFloat(o.price.split(",")[d])-parseFloat(e("#hdnOutCallPrice").val()),parseInt(o.pointredeem.split(",")[d])>0?c.OriginalPointRedeem=parseInt(o.pointredeem.split(",")[d])-parseInt(e("#hdnOutcallPointRedeem").val()):c.OriginalPointRedeem=0}else c.OutcallType=0,c.OutCallTime=0,c.Duration=o.duration.split(",")[d],c.Amount=o.price.split(",")[d],("0"==c.PromotionID&&void 0!==_shopdetail.BookingDetail.AppointmentDetail[d].isPresetApply&&1==_shopdetail.BookingDetail.AppointmentDetail[d].isPresetApply||0==c.PromotionID)&&(c.Amount=_shopdetail.BookingDetail.AppointmentDetail[d].price+_shopdetail.BookingDetail.AppointmentDetail[d].Discount),c.PointRedeem=o.pointredeem.split(",")[d],c.OriginalDuration=0,c.OriginalPrice=0,c.OriginalPointRedeem=0;"undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell&&(c.Amount=o.price.split(",")[d]),c.CustomerStartTime=o.AppointmentDetail[d].CustomerStartTime,c.CustomerTimeZone=o.AppointmentDetail[d].CustomerTimeZone,c.StartTime=o.date.split(",")[d],c.PointGiven=o.pointgiven.split(",")[d],c.ServiceStartTime=o.starttime.split(",")[d],c.CleanupTime=o.CleanupTime.split(",")[d],""==c.PointGiven&&(c.PointGiven=0),1==_IsPrepay&&o.AppointmentDetail[d].ApplyDiscoutType==ApplyDiscoutTypePrepay.Package&&(c.PointGiven=0);try{1==_IsPrepay&&o.AppointmentDetail[d].ServiceOrginalPrice==o.AppointmentDetail[d].membershipDiscount&&(c.PointGiven=0)}catch(e){}0==d&&void 0!==o.style&&(c.StyleID=o.style.split(":")[0]);var p=e("#txtComment").val().trim();if(""!=p&&(c.Comment=p),_shopdetail.VisibleControlLength("#ddPhone")>0){var h={};_shopdetail.VisibleControlLength("#divPhone")>0?h=onlinecustdayPhone.getPhoneData():(h=onlinecustcellPhone.getPhoneData()).phoneNo.trim().length>10?h.phoneNo=h.phoneNo.trim().substring(1):h.phoneNo=h.phoneNo.trim();var m=e("#cboContact").val();c.PhoneType=m,c.PhoneNo=h.phoneNo,c.CellCountryId=h.countryId,c.DialingCode=h.dialingCode}if("book"==e("#btnAppointment").text().toLowerCase()?"46994"==c.BusinessID||"351429"==c.BusinessID||"332940"==c.BusinessID?"book"==gbooktext.toLowerCase()?c.Status=AcceptedStatus:c.Status=gNeedAcceptance?NeedAcceptanceStatus:AcceptedStatus:c.Status=AcceptedStatus:c.Status=gNeedAcceptance?NeedAcceptanceStatus:AcceptedStatus,c.GenderInformation=e("#cboGenderInfo").val(),c.Device="Website",_onlineCheckout.IsVagaroMarketplace()&&"true"!=isGoogle&&(c.Device="Website Marketplace"),"undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions?c.Device="Insta":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()?c.Device="Facebook":void 0!==_shopdetail.IsBookFromFacebookoAuth&&"true"==_shopdetail.IsBookFromFacebookoAuth.toLowerCase()&&(c.Device="FacebookoAuth"),"undefined"!=typeof isWindowsApp&&1==isWindowsApp)c.Device="Windows";else if("undefined"!=typeof vgAppicationType&&1==vgAppicationType){c.Device="CustomerApp",(v=null!=navigator.userAgent?navigator.userAgent:"").toLowerCase().indexOf("customerios")>-1?c.Device="iOS":v.toLowerCase().indexOf("customerandroid amazon")>-1?c.Device="Amazon":v.toLowerCase().indexOf("customerandroid")>-1&&(c.Device="Android"),baIsUndefine(IsBrandedApp)||1!=IsBrandedApp?"true"==isGoogle||"true"==isFacebook||IsFromCreateLink||(c.Device=c.Device+" Marketplace"):c.Device=c.Device+" Branded"}else if(vgAppicationType==objApplicationType.CheckinApp)c.Device="CheckIn";else if(_shopdetail.VisibleControlLength("#mobile-check")>0){c.Device="MobileWeb",_onlineCheckout.IsVagaroMarketplace()&&"true"!=isGoogle&&(c.Device="MobileWeb Marketplace"),"undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions?c.Device="Insta":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebook.toLowerCase()?c.Device="Facebook":void 0!==_shopdetail.IsBookFromFacebook&&"true"==_shopdetail.IsBookFromFacebookoAuth.toLowerCase()&&(c.Device="FacebookoAuth");var f=navigator.userAgent;OpenedFrom={iphone:f.match(/(iPhone|iPod)/),blackberry:f.match(/BlackBerry/),kindle:f.match(/Silk/),android:f.match(/Android/),windows:f.match(/Windows/),ipad:f.match(/iPad/)},OpenedFrom.windows?c.Device=c.Device+" Windows Phone":OpenedFrom.iphone?c.Device=c.Device+" iPhone":OpenedFrom.android?c.Device=c.Device+" Android":OpenedFrom.blackberry?c.Device=c.Device+" Blackberry":OpenedFrom.ipad?c.Device=c.Device+" iPad":OpenedFrom.kindle&&(c.Device=c.Device+" kindle")}1!=_siteBuilderDetail.isFromAppleClip&&1!=_siteBuilderDetail.isFromAppClip||(c.Device="Apple Maps");var g=!1;if(_shopdetail.HasVeraFee(o.AppointmentDetail[d])&&(g="function"==typeof _shopdetail.isDailyDealExistsInItems&&!0===_shopdetail.isDailyDealExistsInItems()),String.isNullOrUndefineOrBlank(c.PromotionID)&&String.isNullOrUndefineOrBlank(PromotionID)||!_onlineCheckout.CheckPromotionDetail(c.ServiceID,c.PromotionID)||0!=isFromTextMarketing||!String.isNullOrUndefineOrBlank(PromotionAppointmentID))g&&(c.Device="Vera");else{var v=null!=navigator.userAgent?navigator.userAgent:"",A=g?"Vera":"DailyDeal";1==vgAppicationType&&v.toLowerCase().indexOf("customerios")>-1?c.Device="IOS "+A:1==vgAppicationType&&v.toLowerCase().indexOf("customerandroid")>-1?c.Device="Android "+A:c.Device="Website "+A}String.isNullOrUndefineOrBlank(PromotionAppointmentID)||(c.Device="Website Marketing Campaign"),!String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&isFromTextMarketing&&(c.Device="Website Text Marketing Campaign");var C=getQueryStringData("Type");if(void 0!==C&&""!=C&&"Builder"==C&&(c.Device=c.Device+" MySite"),String.isNullOrUndefineOrBlank(getCookie("loginTypeValue"))||8!=getCookie("loginTypeValue")||(c.Device="Alexa"),!String.isNullOrUndefineOrBlank(getCookie("yelp_attribution")))try{var y=getCookie("yelp_attribution"),b=staticEncryptBusinessID;!String.isNullOrUndefineOrBlank(b)&&y&&y.businessId&&y.token&&y.businessId===b&&(c.Device=g?"Vera":"Yelp",c.YelpTokenId=y.token)}catch(e){console.error("Error parsing yelp_attribution cookie:",e)}void 0!==getCookie("connectroute")&&null!=getCookie("connectroute")&&getCookie("connectroute")?c.Device=c.Device+" Connect":(void 0!==getCookie("connectairoute")&&null!=getCookie("connectairoute")&&getCookie("connectairoute")||void 0!==window._aiBooking&&null!=window._aiBooking&&window._aiBooking.active)&&(c.Device=c.Device+" Connect AI"),c.SiteLink="",c.LoggedInUserID=e("#hdnLoggedInUserid").val(),c.AppSrNo=d+1,c.BusinessPackageID=0==o.SelectedBusinessPackageID?null:o.SelectedBusinessPackageID,c.IsServicePerformAtSameTime=o.IsServicePerformAtSameTime.split(",")[0],c.paidType=o.AppointmentDetail[d].paidType,o.AppointmentDetail[d].paidType==arrpaidType.Deposits||o.AppointmentDetail[d].paidType==arrpaidType.PartiallyPaid?(c.payableAmount=o.AppointmentDetail[d].IsPartialPoint?o.AppointmentDetail[d].PartialPrice:o.AppointmentDetail[d].price,c.depositsPercentage=o.AppointmentDetail[d].depositsPercentage,o.AppointmentDetail[d].IsAmountPaid&&o.AppointmentDetail[d].IsPartialPoint&&0==o.AppointmentDetail[d].IsDepositsOver?c.depositsPaid=o.AppointmentDetail[d].depositsPaid+o.AppointmentDetail[d].PointPrice:c.depositsPaid=o.AppointmentDetail[d].depositsPaid,c.IsAmountPaid=o.AppointmentDetail[d].IsAmountPaid,c.IsDepositsOver=o.AppointmentDetail[d].IsDepositsOver,c.IsPartialPoint=o.AppointmentDetail[d].IsPartialPoint):o.AppointmentDetail[d].paidType==arrpaidType.Paid&&(c.payableAmount=o.AppointmentDetail[d].IsPartialPoint?o.AppointmentDetail[d].PartialPrice:o.AppointmentDetail[d].price,c.depositsPercentage=o.AppointmentDetail[d].depositsPercentage),c.DiscountID=o.AppointmentDetail[d].DiscountID,s[d]=c,0==d&&(c.ServiceProviderID,c.StartTime),s[d].IsPaid=!1;for(var S=0;S<_shopdetail.BookingDetail.lstAddonService.length;S++){var k=d+1;_shopdetail.BookingDetail.lstAddonService[S].MainServiceID==c.ServiceID&&_shopdetail.BookingDetail.lstAddonService[S].SrNo==k&&(s[d].lstAddonService=_shopdetail.BookingDetail.lstAddonService[S].lstAddonService,String.isNullOrUndefineOrBlank(s[d].lstAddonService)||e.each(s[d].lstAddonService,function(e,t){t.paidType!=arrpaidType.Deposits&&t.paidType!=arrpaidType.PartiallyPaid&&t.paidType!=arrpaidType.Paid||(t.payableAmount=t.Price,t.CalculatedTaxTypeWise=JSON.stringify(t.BusinessTax))}))}}var D=o.serviceid+",",_=o.spid+",",I=e("#hdnBusinessID").val(),w=o.date.split(",")[0],P=new Date;String.isNullOrUndefineOrBlank(_common.GetGoogleToken(businessID))&&(isGoogle="false"),"true"==isFacebook?isCalledfrom="FacebookWidget":"true"==isFacebookoAuth?isCalledfrom="FacebookoAuth":"true"==isWidget?isCalledfrom="Widget":"true"==isGoogle&&1!=_siteBuilderDetail.isFromAppleClip&&1!=_siteBuilderDetail.isFromAppClip?_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem()&&IsForNewCustomer?isCalledfrom="Shopdetail":isCalledfrom="Google":isCalledfrom="Shopdetail",null==PromotionAppointmentID||""==PromotionAppointmentID||""!=c.PromotionID&&null!=c.PromotionID&&null!=c.PromotionID||(c.PromotionID=PromotionAppointmentID);var T={useragent:navigator.userAgent,BusinessID:I,browsertime:P,calledfrom:isCalledfrom};if(void 0!==ShowLoader&&ShowLoader(!0),void 0!==i&&null!=i||(i=""),0==_onlineCheckout.isCheckoutVPLChanged&&(checkoutRequest=null),(_IsPrepay||1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp())&&_shopdetail.CheckOutRequest(s),s[0].objCardDetails=r,!(1!=isCcCaptureRequired||void 0!==i&&null!=i&&""!=i||void 0!==a&&null!=a||void 0!==r&&null!=r))try{try{var B={};B.BusinessID=null!=e("#hdnBusinessID").val()&&e("#hdnBusinessID").val()?e("#hdnBusinessID").val():"0",B.UserID=c.UserID&&null!=c.UserID?c.UserID:0,B.Step=140,B.PageURL=window.location.href,B.AppointmentDetail=JSON.stringify(c),B.UserAgent=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"",(F=[]).push(B);var x=new vagaro.ajax;x.datamodel.Token="CCCaptureLogError",x.datamodel.data=F,x.datamodel.callback=function(){},x.datamodel.Error=function(e){},x.Post()}catch(e){}return void _shopdetail.HidePopup()}catch(e){}if(1==IsOutCallServiceSelected&&e("#OutCallTab1").hasClass("w--current")){ShowLoader(!0);var F=[],O={},M=null;O.BusinessID=parseInt(getBusinessID()),O.CutomerId=parseInt(UserID),O.CustomerAddress=e("#HomeLocation").text(),F.push(O);var E=new vagaro.ajax;E.datamodel.Token="GetCityBusiness",E.datamodel.data=F,E.datamodel.callback=function(a){if(null!=a){if(a)if(parseInt(t)>0)_vgAddEditApp.AddEditApp.init(s),_vgAddEditApp.AddEditApp.RescheduleAppointmentOffline(isCalledfrom,i,checkoutRequest);else if(0==parseInt(t)&&0==s[0].AppointmentID){if(_vgAddEditApp.AddEditApp.init(s),0==DisableFinalSubmitButtonOnlinebooking(!1))return ShowLoader(!0),!1;_vgAddEditApp.AddEditApp.AddOnlineAppointment(isCalledfrom,i,checkoutRequest)}else{if(0==DisableFinalSubmitButtonOnlinebooking(!1))return ShowLoader(!0),!1;var r='"objApps" :'+JSON.stringify(s);r+=', "strUserCCXML" : '+JSON.stringify(i),r+=', "BusinessID" : '+(""==I?null:I),r+=', "dtFromDateTime" : "'+w+'"',r+=', "strCSVServiceID" : "'+D+'"',r+=', "strCSVSPID" : "'+_+'"',r+=', "lAppointmentID" : "'+(""==lAppID?0:lAppID)+'"',r+=', "strDuration" : "'+o.duration+'"',CallWebServicehed("MySampleService.asmx/SaveMultiAppointments",r+=', "objbrowserdetail" : '+JSON.stringify(T),_shopdetail.CallSuccess_SaveOnlineBooking,_shopdetail.CallFailed_SaveOnlineBooking)}else e("#location-out").modal("show"),isCustomerCityExists=!1;ShowLoader(!1)}},E.datamodel.Error=function(e){ShowLoader(!1)},E.Post()}else if(1==IsOutCallServiceSelected&&e("#OutCallTab2").hasClass("w--current")){ShowLoader(!0);M=houseCallAddress.getAddressData();var $,N=String.isNullOrUndefineOrBlank(M.address)?"":M.address+", ",L=String.isNullOrUndefineOrBlank(M.address2)?"":M.address2+", ",U=String.isNullOrUndefineOrBlank(M.city)?"":M.city+", ",R=String.isNullOrUndefineOrBlank(M.statecode)?"":M.statecode+", ",G=String.isNullOrUndefineOrBlank(M.zip)?"":M.zip;$=N.concat(L,U,R,G);F=[];var W={};W.BusinessID=parseInt(getBusinessID()),W.City=M.city,W.StateID=M.stateId,W.CutomerId=parseInt(UserID),W.CustomerAddress=$,F.push(W);var V=new vagaro.ajax;V.datamodel.Token="GetCityBusiness",V.datamodel.data=F,V.datamodel.callback=function(a){if(!a)return e("#location-out").modal("show"),ShowLoader(!1),!1;if(ShowLoader(!1),1==e("#save-cusAddress").prop("checked")){var r=houseCallAddress.getAddressData(),n={};n.Customer_id=parseInt(UserID),n.Street=r.address,n.StreetNo=e("#txtAddressUser2").val(),n.City=r.city,n.StateID=r.stateId,n.Zip=r.zip,n.CountryID=r.country;var l={BusinessID:parseInt(businessID),UserID:parseInt(UserID),Street:r.address,StreetNo:e("#txtAddressUser2").val(),City:r.city,StateID:r.stateId,Zip:r.zip,StateName:r.state,IsReturnCountryID:r.IsReturnCountryID,CountryID:r.country},d='"objUserJson" :'+JSON.stringify(l);CallWebServicehed("MySampleService.asmx/SaveAddressData",d+=', "iCustomerID" : "'+parseInt(UserID)+'"')}else document.cookie=JSON.stringify(userAddress.getAddressData());var u=houseCallAddress.getAddressData(),p=u.address,h=String.isNullOrUndefine(e("#txtStreet2").val())?"":e("#txtStreet2").val(),m="";if(m=(m=(m=(m=(m=p)+(""!=m?", ":"")+u.city)+(""!=m?", ":"")+u.state)+(""!=m?", ":"")+u.zip)+"|~|"+u.country,""!=h&&(m=m+"|~|"+h),c.OutcallAddress=m,parseInt(t)>0)_vgAddEditApp.AddEditApp.init(s),_vgAddEditApp.AddEditApp.RescheduleAppointmentOffline(isCalledfrom,i,checkoutRequest);else if(0==parseInt(t)&&0==s[0].AppointmentID){if(_vgAddEditApp.AddEditApp.init(s),0==DisableFinalSubmitButtonOnlinebooking(!1))return ShowLoader(!0),!1;_vgAddEditApp.AddEditApp.AddOnlineAppointment(isCalledfrom,i,checkoutRequest)}else{if(0==DisableFinalSubmitButtonOnlinebooking(!1))return ShowLoader(!0),!1;d='"objApps" :'+JSON.stringify(s);d+=', "strUserCCXML" : '+JSON.stringify(i),d+=', "BusinessID" : '+(""==I?null:I),d+=', "dtFromDateTime" : "'+w+'"',d+=', "strCSVServiceID" : "'+D+'"',d+=', "strCSVSPID" : "'+_+'"',d+=', "lAppointmentID" : "'+(""==lAppID?0:lAppID)+'"',d+=', "strDuration" : "'+o.duration+'"',CallWebServicehed("MySampleService.asmx/SaveMultiAppointments",d+=', "objbrowserdetail" : '+JSON.stringify(T),_shopdetail.CallSuccess_SaveOnlineBooking,_shopdetail.CallFailed_SaveOnlineBooking)}},V.datamodel.Error=function(e){return ShowLoader(!1),!1},V.Post()}else if(parseInt(t)>0)_vgAddEditApp.AddEditApp.init(s),_vgAddEditApp.AddEditApp.RescheduleAppointmentOffline(isCalledfrom,i,checkoutRequest);else if(0==parseInt(t)&&0==s[0].AppointmentID){if(_vgAddEditApp.AddEditApp.init(s),0==DisableFinalSubmitButtonOnlinebooking(!1))return ShowLoader(!0),!1;_vgAddEditApp.AddEditApp.AddOnlineAppointment(isCalledfrom,i,checkoutRequest)}else{if(0==DisableFinalSubmitButtonOnlinebooking(!1))return ShowLoader(!0),!1;var j='"objApps" :'+JSON.stringify(s);j+=', "strUserCCXML" : '+JSON.stringify(i),j+=', "BusinessID" : '+(""==I?null:I),j+=', "dtFromDateTime" : "'+w+'"',j+=', "strCSVServiceID" : "'+D+'"',j+=', "strCSVSPID" : "'+_+'"',j+=', "lAppointmentID" : "'+(""==lAppID?0:lAppID)+'"',j+=', "strDuration" : "'+o.duration+'"',CallWebServicehed("MySampleService.asmx/SaveMultiAppointments",j+=', "objbrowserdetail" : '+JSON.stringify(T),_shopdetail.CallSuccess_SaveOnlineBooking,_shopdetail.CallFailed_SaveOnlineBooking)}},_shopdetail.HasVeraFee=function(t){return!!t&&(t.DailyDealFee>0||e.isArray(t.lstAddonService)&&e.grep(t.lstAddonService,function(e){return e&&e.DailyDealFee>0}).length>0)},_shopdetail.GetBookingFailReason=function(e){switch(String(e)){case"1":case"2":return"Selected time slot no longer available";case"-5":return"Appointment already checked out";case"-6":return"Multiple browser tabs/windows open for same session";case"-7":return"Cannot book more than one appointment at the same time";case"-8":return"Payment declined";case"-14":return"Online booking is blocked for this customer";case"-15":return"Card on file error";case"-18":case"-21":return"Card on file issue";case"-19":return"Booking not allowed";case"-20":return"Business is pending release to public";default:return"Appointment booking failed"}},_shopdetail.CallSuccess_SaveOnlineBooking=function(i,a){DisableFinalSubmitButtonOnlinebooking(!0);try{if("undefined"!=typeof _onlineCheckout&&_onlineCheckout&&"function"==typeof _onlineCheckout.SetCheckoutAuthResult){var r,o=i&&null!=i.d?i.d:i,n=void 0!==a&&a?a.gatewayResponse:null;if("0"===String(o)){if(null==_onlineCheckout._checkoutAuthResult||"fail"!==_onlineCheckout._checkoutAuthResult.AuthStatus){var s="function"==typeof _onlineCheckout.ExtractTransactionId?_onlineCheckout.ExtractTransactionId(n):"";!s&&a&&a.EventTransactionId&&(s=a.EventTransactionId),!s&&_onlineCheckout._checkoutAuthResult&&_onlineCheckout._checkoutAuthResult.TransactionId&&(s=_onlineCheckout._checkoutAuthResult.TransactionId),_onlineCheckout.SetCheckoutAuthResult("success",s,null,"","")}}else r=a&&a.errMsg?a.errMsg:n&&n.Message?n.Message:_shopdetail.GetBookingFailReason(o)+" (code "+String(o)+")",_onlineCheckout.SetCheckoutAuthResult("fail","",n?n.paymentGateway:null,n?n.subResponseCode:"",r)}}catch(e){}if(_shopdetail.FireBookingCheckoutCompleted(),i=null==i.d?i:i.d,bk.removeAllCache(),ZenSwipeCardDetails={},isCCChanged=!1,"undefined"!=typeof IsRescheduleAppointment&&null!=IsRescheduleAppointment&&"true"==IsRescheduleAppointment.toLocaleLowerCase()&&"undefined"!=typeof lAppUserID&&null!=lAppUserID&&""!=lAppUserID?LAppUserID=lAppUserID:LAppUserID=UserID,"0"==i){if("undefined"!=typeof InvoiceNum&&null!=InvoiceNum&&(InvoiceNum=null),e("#OutCallTab2").hasClass("w--current")&&1==e("#chksaveaddressinfo").prop("checked")){var l=houseCallAddress.getAddressData();if(""!=l.address&&""!=l.zip&&""!=l.state&&""!=l.city){var d={BusinessID:e("#hdnBusinessID").val(),UserID:e("#hdnLoggedInUserid").val(),Street:l.address,StreetNo:l.address2,City:l.city,StateID:l.stateId,Zip:l.zip,StateName:l.state,CountryID:l.country},c='"objUserJson" :'+JSON.stringify(d);"undefined"!=typeof IsRescheduleAppointment&&null!=IsRescheduleAppointment&&"true"==IsRescheduleAppointment.toLocaleLowerCase()?c+=', "iCustomerID" : "'+LAppUserID+'"':c+=', "iCustomerID" : "'+e(".familycktfrnd ul li.selected").data("value")+'"',CallWebServicehed("MySampleService.asmx/SaveAddressData",c)}}if(_shopdetail.HidePopup(),void 0!==_shopdetail&&(_shopdetail.HideCCDetailPopup(),IsForNewCustomer=!1,e("#hdnIsForNewCustomer").val("false")),_common.GooglePostCall(e("#hdnBusinessID").val()),isGoogle="false",_shopdetail.RemoveAllControls(!0,!0),_shopdetail.SetControls(null),void 0!==ShowLoader&&ShowLoader(!1),_shopdetail.VisibleControlLength("#mobile-check")>0&&_shopdetail.backpage(),0==(null!=t&&0!=t&&("undefined"==typeof vgAppicationType||1!=vgAppicationType&&0!=vgAppicationType))){_shopdetail.AppointmentSuccessfullBooked(a);try{if(("undefined"!=typeof vagaroFBExtensions&&void 0!==vagaroFBExtensions.isFBExtensions&&1==vagaroFBExtensions.isFBExtensions||void 0!==_shopdetail.isFBExtensions&&"true"==_shopdetail.isFBExtensions.toLowerCase())&&"undefined"!=typeof fbq)for(var u=0;u<a.lstAppResult.length;u++){var p=a.lstAppResult[u];fbq("track","Reservation",{reservation_id:p.AppointmentId.toString(),reservation_time:moment(p.StartTime).format().toString(),reservation_size:"1"})}if("undefined"!=typeof fbq&&""!=fbEncryptedBusiness)for(u=0;u<a.lstAppResult.length;u++){p=a.lstAppResult[u];void 0!==_shopdetail.IsBookFromFacebookoAuth&&"true"==_shopdetail.IsBookFromFacebookoAuth.toLowerCase()?fbq("trackCustom","Purchase",{business_id:fbEncryptedBusiness,reservation_id:p.AppointmentId.toString(),reservation_time:moment(p.StartTime).format().toString(),reservation_size:"1",facebook_cta:1}):fbq("trackCustom","Purchase",{business_id:fbEncryptedBusiness,reservation_id:p.AppointmentId.toString(),reservation_time:moment(p.StartTime).format().toString(),reservation_size:"1",facebook_cta:0})}}catch(e){}}if("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&void 0!==_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&null!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&""!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&"undefined"!=typeof $Interframe&&void 0!==$Interframe.redirectparent)if(-1==_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking.search("http")&&(_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking="https://"+_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking),void 0!==a&&null!=typeof a&&null!=typeof a.lstAppResult&&void 0!==a.lstAppResult&&null!=a.lstAppResult[0]&&a.lstAppResult.length>0&&null!=a.lstAppResult[0].EncyAppointmentId&&"undefined"!=a.lstAppResult[0].EncyAppointmentId){var h=a.lstAppResult.map(e=>e.EncyAppointmentId.toString()).join(","),m=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking,f=m.includes("?")?"&":"?",g=`${m}${f}appointmentId=${h}`;if((e("body,html").hasClass("Embedded_Widget")||e("body,html").hasClass("Popup_Widget"))&&null!=m&&void 0!==m&&"undefined"!=m)try{var v=!1;try{v=window.parent&&window.parent!==window&&window.parent.location}catch(e){v=!1}v?window.parent.location.href=g:window.open(g,"_blank","noopener,noreferrer")}catch(e){try{window.top.location.href=g}catch(e){window.open(g,"_blank","noopener,noreferrer")}}else $Interframe.redirectparent(g)}else $Interframe.redirectparent(_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking)}else if("1"==i||"2"==i)_shopdetail.EnableDisableButton(!0),"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee?(vagaro.alert("Some error occured. Please try again."),_shopdetail.HidePopup(),CheckDailyDealsOffer("rebind")):(void 0!==ShowLoader&&ShowLoader(!1),"2"!=i||2!=a.errorType||String.isNullOrUndefineOrBlank(a.errMsg)?vagaro.popup({title:"Booking Slot Not Available",message:"The selected appointment was just booked and no longer available. Please try and find another time.",buttons:{ok:{label:"OK"}}}):vagaro.alert(a.errMsg));else{if(void 0!==ShowLoader&&ShowLoader(!1),"-5"==i)vagaro.alert("Appointment is already checkedout. You cannot book it.");else if("-6"==i)vagaro.alert("You are running Vagaro on more than one tab or window using the same browser. Please close all other tabs and refresh page.");else if("-7"==i)vagaro.alert("You can't book more than 1 appointment at same time. Please do search and try again.");else if("-8"==i)vagaro.alert(a.errMsg),1==_siteBuilderDetail.isFromAppClip&&window.history.back();else{if("-14"==i)return _shopdetail.SetBookControls(),void(null==t||0==t||"undefined"!=typeof vgAppicationType&&1==vgAppicationType?_shopdetail.HideShowDisableBookMessageForApps(!0):location.reload());if("-15"==i)vagaro.alert(a.errMsg);else if("-19"==i)vagaro.alert(a.errMsg),CallbackforMobileApp(0,0,"","",0,"36|~|"+businessID);else{if("-20"==i){var A;return A=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/ReleaseToPublicPending.aspx",void(location.href=A)}"-21"==i||"-18"==i?vagaro.alert(a.errMsg):vagaro.alert("Appointment booking failed. Please do search and try again.")}}_shopdetail.SetBookControls()}null!=t&&0!=t&&("undefined"==typeof vgAppicationType||1!=vgAppicationType&&0!=vgAppicationType)&&setTimeout("location.reload(true);",2e3),null!=a.lstAppResult&&a.lstAppResult[0].CreatedBy!=a.lstAppResult[0].UserID&&_shopdetail.UpdateFormResponseDetail(a.lstAppResult[0].UserID)},_shopdetail.UpdateFormResponseDetail=function(t){var i=e(".familycktfrnd ul li.selected .avtar-name").html().replace(" (Me)","");if(void 0!==_onlineCheckout.FormsResponseID&&null!=_onlineCheckout.FormsResponseID&&""!=_onlineCheckout.FormsResponseID){var a={FormsResponseID:_onlineCheckout.FormsResponseID,UserId:t,ResponseUserName:i},r=new vagaro.ajax;r.datamodel.Token=ApiURLEnumBooking.updateformresponse,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.data=a,r.datamodel.callback=function(e){},r.Post(),_onlineCheckout.FormsResponseID=null}},_shopdetail.SetBookControls=function(){_shopdetail.EnableDisableButton(!0),_shopdetail.HidePopup(),void 0!==_shopdetail&&_shopdetail.HideCCDetailPopup(),HideShowWaitlistButton(!1),_shopdetail.RemoveAllControls(!0,!0),_shopdetail.SetControls(null)},_shopdetail.AppointmentSuccessfullBooked=function(t){if(void 0!==window._aiBooking&&null!=window._aiBooking&&window._aiBooking.active&&window._aiBooking.sendBookingCompleted(t,_shopdetail.BookingDetail),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&(CallbackforMobileApp(0,0,"","",0,"22|~|1"),CallbackforMobileApp(0,0,"","",0,29)),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&void 0!==_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&null!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking&&""!=_siteBuilderDetail.UserLocationInfo.RedirectAfterBooking);else if(void 0!==_shopdetail.BookingDetail&&null!=_shopdetail.BookingDetail){ShowLoader(!0);var i={UserControlPath:"~/UserControls/ShopDetail/ucAppoinmentBooked.ascx",PageNamePath:"~/detail.aspx",isRemoveFormTag:!0,Parameters:{}},a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumBooking.LoadUserControl,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.callback=function(i){e(".pagebodycontainer").html(e("#bookingthankyouDiv").html()),_common.ScrollToToZero();var a=e("#dvOnlineAppoinmentBooked");a.html(""),a.append(i),a.show(),a.find("#divThankyouAppointment").show(),a.find("#divThankyouWaitlistdetail").hide(),DisplayFullView(!0),e("#pageSection").hide().removeClass("pagesectionFlex"),e("html, body").removeClass("overflowHidden"),e("html, body").removeClass("modal-open"),("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()||"undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp)&&e("#btnAddWaitlist1").hide();var r=getQueryStringData("Type");"OnBoarding"!=r&&"ImportOnBoarding"!=r||(e("#btnAddWaitlist1").hide(),e("#dvOnlineAppoinmentBooked").find("#appt-location-map").hide());ShowLoader(!1),_shopdetail.BindAppointmentSuccessfullBookedData(t)},a.datamodel.data=i,a.datamodel.Error=CallFail_LoadUserControlWithProxy,a.Post()}},_shopdetail.BindAppointmentSuccessfullBookedData=function(t){if(void 0!==_shopdetail.BookingDetail&&null!=_shopdetail.BookingDetail){"OnBoarding"==(v=getQueryStringData("Type"))&&(e("html").removeClass("bookingappointment1"),e("html").addClass("bookingappointment2"),e("html").addClass("bookingappointment3"));var i=moment(_shopdetail.BookingDetail.date.split(",")[0]),a=e("#dvOnlineAppoinmentBooked");a.find(".booked-month").html(i.format("MMM").toUpperCase()).attr("aria-hidden",!0),a.find("#divDatemonth").attr("aria-label",i.format("MMMM")+","+i.format("D")).attr("role","banner"),a.find(".booked-date").html(i.format("D")).attr("aria-hidden",!0);var r=_shopdetail.BookingDetail.serviceid.split(",").length;if("book"==gbooktext.toLowerCase())a.find("#divstatusicon").attr("class","green-circle-div").attr("aria-hidden",!0).html("&#xf00c;"),r>=2?a.find("#divappttitletext").html("Your appointments are booked."):a.find("#divappttitletext").html("Your appointment is booked."),a.find("#divapptparagraphtext").html("You’re all set with "+_shopdetail.businessName+".");else{a.find("#divstatusicon").attr("class","green-circle-div blue").attr("aria-hidden",!0).html("&#xf141;"),r>=2?a.find("#divappttitletext").html("Your appointments are requested."):a.find("#divappttitletext").html("Your appointment is requested.");var o="";o="undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee?e.unique(_shopdetail.businessName.split(",")).join(", "):e.unique(_shopdetail.BookingDetail.spname.split(",")).join(", ");var n="||~||";n=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a.find("#divapptparagraphtext").html("Great work. Now we're just waiting for "+o+" to accept your "+_shopdetail.BookingDetail.servicename.replace(new RegExp(n,"g"),", ")+". Keep an eye out for an email, text or phone call with a confirmation. You will also receive a notification in the app.")}a.find(".appt-location-map").attr("style","background-image: url("+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.CDNUrl+_siteBuilderDetail.BusinessLocationImage+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.BusinessLocationImage+")"),1==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.IsMobileServiceMandatory&&e(".appt-location-map").removeClass("map-marker-div");for(var s=[],l=0,d=0;d<_shopdetail.BookingDetail.serviceid.split(",").length;d++){_shopdetail.BookingDetail;var c={};c.image=_shopdetail.BookingDetail.ServiceProviderPhoto.split("~")[d],c.servicename=_shopdetail.BookingDetail.servicename.split("||~||")[d],c.spname=_shopdetail.BookingDetail.spname.split(",")[d],c.spinit=FindInitials(_shopdetail.BookingDetail.spname.split(",")[d].length>2?_shopdetail.BookingDetail.spname.split(",")[d]:"","SP"),c.displaySameTime=!1,void 0!==t&&null!=t&&void 0!==t.lstAppResult&&null!=t.lstAppResult?(c.AppointmentId=t.lstAppResult.length>d?t.lstAppResult[d].AppointmentId:0,c.StreamingStatus=t.lstAppResult.length>d?t.lstAppResult[d].StreamingStatus:_shopdetail.StreamingStatusEnum.InHouse):c.StreamingStatus=_shopdetail.StreamingStatusEnum.InHouse,c.StreamingStatus==_shopdetail.StreamingStatusEnum.LiveStream&&0==d&&(a.find("#appt-location-map").hide(),a.find("#dvStreamAptBooked").show()),c.StreamingStatus!=_shopdetail.StreamingStatusEnum.LiveStream||String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail[d].CustomerStartTime)?c.StreamingStatus==_shopdetail.StreamingStatusEnum.LiveStream&&liveServiceTime.length>0?(c.date=new Date(liveServiceTime[d].split(",")[0]).format(BookingDateFormat),c.dateLable=new Date(liveServiceTime[d].split(",")[0]).format(_shopdetail.BookingDateFormatLabel),c.time=moment(liveServiceTime[d].split(",")[0]).format("h:mm A")+" ("+liveServiceTime[d].split(",")[1]+")"):c.StreamingStatus==_shopdetail.StreamingStatusEnum.LiveStream?(c.date=new Date(_shopdetail.BookingDetail.date.split(",")[0]).format(BookingDateFormat),c.dateLable=new Date(_shopdetail.BookingDetail.date.split(",")[0]).format(_shopdetail.BookingDateFormatLabel),String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)?c.time=_shopdetail.BookingDetail.starttime.split(",")[d].replace(/^0+/,""):c.time=_shopdetail.BookingDetail.browserCustomerTime+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTimezone)?"":" ("+_shopdetail.BookingDetail.browserCustomerTimezone+")")):(c.date=new Date(_shopdetail.BookingDetail.date.split(",")[0]).format(BookingDateFormat),c.dateLable=new Date(_shopdetail.BookingDetail.date.split(",")[0]).format(_shopdetail.BookingDateFormatLabel),c.time=_shopdetail.BookingDetail.starttime.split(",")[d].replace(/^0+/,"")):(c.date=new Date(_shopdetail.BookingDetail.AppointmentDetail[d].CustomerStartTime.split(",")[0]).format(BookingDateFormat),c.dateLable=new Date(_shopdetail.BookingDetail.AppointmentDetail[d].CustomerStartTime.split(",")[0]).format(_shopdetail.BookingDateFormatLabel),0==_shopdetail.BookingDetail.AppointmentDetail[d].Isaddresschecked&&c.StreamingStatus==_shopdetail.StreamingStatusEnum.LiveStream?c.time=_shopdetail.BookingDetail.browserCustomerTime+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTimezone)?"":" ("+_shopdetail.BookingDetail.browserCustomerTimezone+")"):c.time=moment(_shopdetail.BookingDetail.AppointmentDetail[d].CustomerStartTime).format("h:mm A")+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail[d].CustomerTimeZone)?"":" ("+_shopdetail.BookingDetail.AppointmentDetail[d].CustomerTimeZone+")")),void 0!==_shopdetail.BookingDetail.SelectedBusinessPackageID&&null!=_shopdetail.BookingDetail.SelectedBusinessPackageID&&_shopdetail.BookingDetail.SelectedBusinessPackageID>0&&("true"==_shopdetail.BookingDetail.IsServicePerformAtSameTime.toLowerCase()&&0==d?c.displaySameTime=!1:"true"==_shopdetail.BookingDetail.IsServicePerformAtSameTime.toLowerCase()?c.displaySameTime=!0:c.displaySameTime=!1);var u=_shopdetail.BookingDetail.serviceid.split(",")[d];if(c.lstAddonService=[],l+=_onlineCheckout.parseTodecimal(_shopdetail.BookingDetail.AppointmentDetail[d].price,2),null!=_shopdetail.BookingDetail&&null!=_shopdetail.BookingDetail.lstAddonService)for(var p=0;p<_shopdetail.BookingDetail.lstAddonService.length;p++){var h=d+1;if(_shopdetail.BookingDetail.lstAddonService[p].MainServiceID==u&&_shopdetail.BookingDetail.lstAddonService[p].SrNo==h&&_shopdetail.BookingDetail.lstAddonService[p].lstAddonService.length>0)for(var m=0;m<_shopdetail.BookingDetail.lstAddonService[p].lstAddonService.length;m++)l+=_onlineCheckout.parseTodecimal(_shopdetail.BookingDetail.lstAddonService[p].lstAddonService[m].Price,2),c.lstAddonService.push({AddonName:_shopdetail.BookingDetail.lstAddonService[p].lstAddonService[m].ServiceTitle})}s.push(c)}if(e("#divtempappbooking").tmpl(s).appendTo("#divappbokingdtl"),"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee&&e("#divappbokingdtl").addClass("noServiceProviderBooked "),a.find(".apptproviderimg").lazyload({effect:"fadeIn",failure_limit:50,event:"lazyload",data_error:"",isShowIntials:!0,intial_selecter:".avatar-inital"}).trigger("lazyload"),SelectedAddonService=[],_shopdetail.localData.SelectedAddonsList="",Webflow.destroy(),Webflow.ready(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==t&&null!=t&&void 0!==t.lstAppResult&&null!=t.lstAppResult)for(d=0;d<t.lstAppResult.length;d++)if(void 0!==t.lstAppResult[d].AppointmentId&&t.lstAppResult[d].AppointmentId>0){var f,g=t.lstAppResult[d].AppointmentId;f="undefined"!=typeof groupID&&null!=groupID&&""!=groupID?"javascript:CallbackforMobileApp(0, 0, '', '', '0', '11|~|{\\\"appointmentid\\\":\\\""+g+'\\", \\"businessId\\":\\"'+t.lstAppResult[d].BusinessID+'\\", \\"sGroup\\":\\"'+groupID+'\\", \\"eventType\\":\\"'+t.lstAppResult[d].EventType+"\\\"}');":"javascript:CallbackforMobileApp(0, 0, '', '', '0', '11|~|{\\\"appointmentid\\\":\\\""+g+'\\", \\"businessId\\":\\"'+t.lstAppResult[d].BusinessID+'\\", \\"eventType\\":\\"'+t.lstAppResult[d].EventType+"\\\"}');",0==_siteBuilderDetail.isFromAppClip?(e("#btnAddToCalendar_"+g).show(),e("#btnAddToCalendar_"+g).attr("onclick",f+"return false;")):a.find("#appt-location-map").hide()}_shopdetail.SetGoogleMapDirection(),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&("book"==gbooktext.toLowerCase()?_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.book_service_completed,JSAdjustEventToken.book_service_completed_eventtoken,l):_shopdetail.SendAdjustDataMobileApp(JSAdjustEventName.request_service_completed,JSAdjustEventToken.request_service_completed_eventtoken,l))}var v;if("OnBoarding"==(v=getQueryStringData("Type"))||"ImportOnBoarding"==v){"OnBoarding"==v&&(e("#dvOnlineAppoinmentBooked").append(_siteBuilderDetail.OnboardBookNowFooter[0]),e("#Onboard-BookNow-Footer").show(),e("#Onboard-BookNow-next").show(),e("#Onboard-BookNow-back").hide()),"ImportOnBoarding"==v&&(e("#dvOnlineAppoinmentBooked").append(_siteBuilderDetail.OnboardBookNowFooter[0]),e("#Onboard-BookNow-Footer").show(),e("#Onboard-BookNow-next").text("Done"),e("#Onboard-BookNow-next").show(),e("#Onboard-BookNow-next").addClass("btn-done"),e("#Onboard-BookNow-back").hide());var A={};A.BusinessID="OnBoarding"==v?parseFloat(_siteBuilderDetail.UserLocationInfo.OnBordingFlowCurrentBusinessID):parseFloat(_siteBuilderDetail.UserLocationInfo.objUserInfo.BusinessID),A.UserID=UserID,A.Step=47,A.PageURL=window.location.href,A.ServiceName=_shopdetail.BookingDetail.AppointmentDetail[0].servicename,A.UserAgent=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"","undefined"!=typeof amplitude?A.AmplitudeDeviceId=amplitude.getInstance().getDeviceId():A.AmplitudeDeviceId="",A.Booking_Source="OnBoarding"==v?"Onboarding Wizard":"ImportOnBoarding"==v&&"false"==getQueryStringData("IsDeeplink")?"Import Management":"Deep Link";var C={};C.AddLogInAmplitude=A,_shopdetail.AjaxOld("AddLogInAmplitudeV2",C,_shopdetail.AddLogInAmplitudeSuccess,_shopdetail.AddLogInAmplitudeSuccessFail),"OnBoarding"==v&&e("#Onboard-BookNow-next").on("click",function(e){"1"==getQueryStringData("IsFromNotification")?window.location.href="/businesssignup/merchants/thankyou?IsFromNotification=1":window.location.href="/businesssignup/merchants/thankyou"}),"ImportOnBoarding"==v&&(localStorage.removeItem("ImportOtherSoftwareId"),e("#Onboard-BookNow-next").on("click",function(e){if(1==iosDevices||1==iPadAndroid||1==isAndroidMobile||1==isWindowsPhone||1==iPadAndroidNew){var t='{"navType": 1,"screenType": 0,"screenTitle" : "​​​","message": "","messageType": 0,"action" : "0"}',i="5006||~||"+t;navigator.userAgent.toLowerCase().indexOf("safari")<0&&(navigator.userAgent.toLowerCase().indexOf("iphone")>-1||navigator.userAgent.toLowerCase().indexOf("ipad")>-1)?(_siteBuilderDetail.CallBackForHideShowFooter(!1),window.location="js-call:myObjectiveCFunction:"+i):window.JSInterface.CallWSMethod(t)}else window.parent.location.href="/merchants/calendar"}))}"undefined"!=typeof _common&&_common&&"function"==typeof _common.IsVagaroAppOrEmbeddedContext&&!_common.IsVagaroAppOrEmbeddedContext()&&("function"==typeof _common.InitAppPromoAndBanner?_common.InitAppPromoAndBanner(!1):(_common.InitAppPromo(),_common.InitAppDownloadBanner()))},_shopdetail.SendAdjustDataMobileApp=function(e,t,i){CallbackforMobileApp(0,0,"","","0","47|~|"+('{\\"eventName\\":\\"'+e+'\\",\\"eventToken\\":\\"'+t+'\\",\\"price\\":\\"'+i+'\\",\\"currency\\":\\"'+_shopdetail.currencySymbol+'\\",\\"businessid\\":\\"'+_shopdetail.businessID+'\\"}'))},_shopdetail.CallFailed_SaveOnlineBooking=function(t){DisableFinalSubmitButtonOnlinebooking(!0);try{if("undefined"!=typeof _onlineCheckout&&_ovnlineCheckout&&"function"==typeof _onlineCheckout.SetCheckoutAuthResult){var i="Booking request failed";if(t&&t.d)i=t.d;else if(t&&null!=t.status){var a=t.statusText||"";i="HTTP "+t.status+(a?" "+a:"")}_onlineCheckout.SetCheckoutAuthResult("fail","",null,"",i)}}catch(e){}try{var r=null!=e("#hdnBusinessID").val()&&e("#hdnBusinessID").val()?e("#hdnBusinessID").val():"0";if(255888==r||381941==r||5165790==r||5138819==r){var o={};o.BusinessID=null!=e("#hdnBusinessID").val()&&e("#hdnBusinessID").val()?e("#hdnBusinessID").val():"0",o.UserID=String.isNullOrUndefineOrBlank(onlineAppointmentBookingReq.appAddData[0].iLoggedInUserID)?0:onlineAppointmentBookingReq.appAddData[0].iLoggedInUserID,o.Method="AddSingleAppointmentForPrePay",o.Platform="WebOnline",o.Subject="OnlineBooking";var n=/(cc|card|cvv|cvc|token|payment|auth|swipe|bank|routing|acct|account|password|pwd|email|phone|cell|mobile|address|zip|postal|ssn|firstname|lastname|customername)/i,s=function(e){if(null!=e&&"object"==typeof e)if("[object Array]"!==Object.prototype.toString.call(e))for(var t in e)e.hasOwnProperty(t)&&(n.test(t)?e[t]="[REDACTED]":s(e[t]));else for(var i=0;i<e.length;i++)s(e[i])};if(o.Payload="",void 0!==onlineAppointmentBookingReq&&null!=onlineAppointmentBookingReq&&null!=onlineAppointmentBookingReq.appAddData){var l=JSON.parse(JSON.stringify(onlineAppointmentBookingReq.appAddData));s(l),o.Payload=JSON.stringify(l)}if(o.Extras="",null!=t){var d=JSON.parse(JSON.stringify(t));s(d),o.Extras=JSON.stringify(d)}var c=new vagaro.ajax;c.datamodel.Token="SaveLogInMongo",c.datamodel.data=[o],c.datamodel.callback=function(e){},c.datamodel.Error=function(e){},c.Post()}}catch(e){}_shopdetail.FireBookingCheckoutCompleted(),t=null==t.d?t:t.d,ShowLoader(!1),_shopdetail.EnableDisableButton(!0),null!=t.d?vagaro.alert(t.d):vagaro.alert(t.get_message())},_shopdetail.SetOutCallType=function(t){if(0==t&&(t=1==e("#chksaveaddressinfo").prop("checked")?1:2),1==t);else if(3!=serviceType){e("#txtStreet2").val(""),e("#"+e("input",e("#s2id_txtAddress")[0].childNodes[0].lastChild)[0].id).val(""),DifferentAddress1="",DifferentAddress2="";houseCallAddress.setAddressData({})}},_shopdetail.UncheckAddressInfo=function(){e("#chksaveaddressinfo").prop("checked",!1)},_shopdetail.LoadState=function(){var t={};t.CountryID=countryIdBusDetail,vagaro.ajaxCall("websiteapi/myaccount/"+ApiURLEnumBooking.getstatesbycountryid,t,function(t){var i=e("#cboRState");t.length>0?(i.children("option:not(:first)").remove(),e(t).each(function(){e("<option />",{val:this.StateID,text:this.StateName}).appendTo(i)}),1==t.length&&i.val(t[0].ServiceID)):i.val("0")},function(e){},!1,!0)},_shopdetail.LoadCCSectionForBooking=function(t,i){e("#dvBookUserCCConfirmtion").modal("hide");var a=e.grep(t,function(e,t){return 1==e.isselfcard}),o=e.grep(t,function(e,t){return 0==e.isselfcard});void 0!==a&&null!=a&a.length>0?(r=a[0],a=a[0],BusSavedCard=e.extend(!0,{},a)):a=null,_onlineCheckout.ValidateVPl(),_shopdetail.ValidateVPl(!1),e("#hdnIsFromPage").val("shopdetail"),_IsCCDetailsShow=!0,e("#dvBookingPaymentMethod").show(),null==a||a.leng,_shopdetail.BindCCDetailForBooking(a,i,o)},_shopdetail.BindCCDetailForBooking=function(t,i,a){if(e("#tabBooking1").siblings(".w-tab-link").removeClass("w--current"),e("#divBookingSelectPaymentMethodTitle").html("Select Payment Method"),null!=t&&null!=t.CreditCardNumber&&("AmericanExpress"!=t.CreditCardType||"False"!=AcceptAmex&&"AmericanExpress"==t.CreditCardType)){e("#dvBookingTabs").show(),isCCChanged=!1,_CCDetailCardOnFile=t;var r=t.CreditCardNumber;r.length>0||(r=""),e("#dvCustomerCCDetail").html(t.CreditCardType+" ending in "+r),e("#tabBooking1").attr({"data-ccfirstname":t.CCFirstName,"data-cclastname":t.CCLastName,"data-ccmiddlename":t.CCMiddleName,"data-cardtokenid":t.CardTokenId,"data-creditcardnumber":t.CreditCardNumber,"data-creditcardtype":t.CreditCardType,"data-expmonth":t.ExpMonth,"data-expyear":t.ExpYear,"data-fullname":t.FullName,"data-securitycode":t.SecurityCode}),e("#tabBooking1").show(),e("#tabBooking1").click(),e("#hdnCCTokenID").val(t.CardTokenId)}else e("#tabBooking1").hide(),null!=i&&void 0!==i&&0!=i.length||null!=a&&void 0!==a&&0!=a.length||(e("#tabBooking2").click(),e("#dvBookingTabs").hide(),e("#divBookingSelectPaymentMethodTitle").html(arrPaymentTitleType.Default));var o=0;e(".ffccdetail").remove(),null!=i&&void 0!==i&&i.length>0&&(e("#familyfriendsCCdetailTemplate").tmpl(i).insertAfter("#tabBooking1"),o=i.length,null!=t&&void 0!==t||void 0!==a&&null!=a&&0!=a.length||(e("#tabBooking3").addClass("first-tab segment-tab-middle"),e("#tabBooking3").removeClass("mid-tab"),e("#tabBooking3").click())),null!=a&&void 0!==a&&a.length>0&&(e.each(a,function(e,t){t.index=o,o++}),e("#familyfriendsCCdetailTemplate").tmpl(a).insertAfter("#tabBooking1"),void 0!==t&&null!=t||void 0!==i&&null!=i&&0!=i.length||(e("#tabBooking3").addClass("first-tab segment-tab-middle"),e("#tabBooking3").removeClass("mid-tab"),e("#tabBooking3").click())),e(_shopdetail.Controls.tabGooglePay).hide();try{paymentCheckAvailability("gpay",function(t){1==_shopdetail.IsGooglepayPayment(!1,t)&&(0==e("#dvBookingTabs").is(":visible")&&void 0!==e("#divServicesTotalPrice")[0].innerHTML&&e("#divServicesTotalPrice")[0].innerHTML.replace("$","")>0&&e("#dvBookingTabs").show(),e(_shopdetail.Controls.tabGooglePay).show())})}catch(t){e(_shopdetail.Controls.tabGooglePay).hide()}e(_shopdetail.Controls.tabApplePay).hide();try{paymentCheckAvailability("applepay",function(t){1==_shopdetail.IsApplepayPayment(!1,t)&&(0==e("#dvBookingTabs").is(":visible")&&void 0!==e("#divServicesTotalPrice")[0].innerHTML&&e("#divServicesTotalPrice")[0].innerHTML.replace("$","")>0&&e("#dvBookingTabs").show(),e(_shopdetail.Controls.tabApplePay).show())})}catch(t){e(_shopdetail.Controls.tabApplePay).hide()}0==_IsPrepay&&"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()?(e("#divBookingSelectPaymentMethodTitle").html(arrPaymentTitleType.HoldOnCard),e("#dvCCDescription").show(),void 0!==GetCCRequiredToSecureAppointmentDescription&&e("#dvCCDescription").html(GetCCRequiredToSecureAppointmentDescription("services")),"none"==e("#divServicesTotal").css("display")?(e("#dvdueblock").hide(),e("#dvdueblock_Mobile").hide()):(e("#dvHoldWithCard").text(_shopdetail.BookingDetail.CurrencySymbol+"0.00"),e("#dvdueblock").show()),e("#tabVagaroPayLater").hide()):(_shopdetail.DisplayVPLCetegeyOrAffirm(1),e("#dvdueblock").hide(),e("#dvCCDescription").hide(),e("#tabVagaroPayLater").show())},_shopdetail.LoadBalnkCCFrame=function(){LoadCCFrame("Book247CCDetails"),isCCChanged=!0},_shopdetail.BackToAppBook=function(){_shopdetail.HidePopup()},_shopdetail.SaveCardForAppBooking=function(){if(_shopdetail.HideShowLoader(!0),UserID>0){var e=null,t=null;void 0!==r.ExpMonth&&null!=r.ExpMonth&&""!=r.ExpMonth&&(e=r.ExpMonth),void 0!==r.ExpYear&&null!=r.ExpYear&&""!=r.ExpYear&&(t=r.ExpYear);var i={businessID:_shopdetail.businessID,loginUserID:UserID,CCNo:r.CreditCardNumber,CardType:r.CreditCardType,CCCode:r.SecurityCode,LoggedInID:0,CardTokenID:r.CardTokenId,UCCFirstName:r.CCFirstName,UCCMiddleName:r.CCMiddleName,UCCLastName:r.CCLastName,ExpMonth:e,ExpYear:t,IsCheckUserExists:!0,IsSaveCard:!1},a=new vagaro.ajax;a.datamodel.IsNewVagaroAPI=!0,a.datamodel.Token=ApiURLEnumBooking.saveuserccdetails,a.datamodel.callback=function(e){_shopdetail.HideShowLoader(!1),null!=e&&(r.BusinessID=_shopdetail.businessID),r.isSaveCard=!0,_shopdetail.LoadCCSectionForBooking(r)},a.datamodel.data=i,a.datamodel.Error=function(e){_shopdetail.HideShowLoader(!1),_shopdetail.LoadCCSectionForBooking(r)},a.Post()}else _shopdetail.HideShowLoader(!1),vagaro.alert("Some error occured. Please try again."),location.reload(!0)},_shopdetail.BookTabClick=function(t){paymentCardOnFile=!0,e("#hdnCheckCCAdressISExist").val("true"),e("#Book247CCAddress").html("");var i="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:"1";if(_onlineCheckout.isCheckoutVPLChanged=!1,_onlineCheckout.IsVplChanged=!1,6==t||7==t)paymentCardOnFile=!1,_shopdetail.SetGoogleApplePayCardInfo(null,!1);else if(2==t)paymentCardOnFile=!1,_shopdetail.LoadBalnkCCFrame(),_shopdetail.VPLMessage(_shopdetail.vplamt);else if(2==t||"undefined"==typeof _CCDetailCardOnFile||null==_CCDetailCardOnFile||String.isNullOrUndefineOrBlank(_CCDetailCardOnFile.CardTokenId)||"2"==i)isCCChanged=!1,_shopdetail.VPLMessage(_shopdetail.vplamt);else{isCCChanged=!1,_shopdetail.HideShowLoader(!0);var a={CardTokenId:_CCDetailCardOnFile.CardTokenId};a.UserID=UserID;var r=new vagaro.ajax;r.datamodel.Token="CheckCCAdressISExist",r.datamodel.data=a,r.datamodel.Error=function(e){_shopdetail.HideShowLoader(!1)},r.datamodel.callback=function(t){_shopdetail.HideShowLoader(!1),null!=t&&1e3==t.ResponseCode&&0==t.data&&(e("#hdnCheckCCAdressISExist").val(t.data),_shopdetail.LoadBalnkCCFrame())},r.Post()}},_shopdetail.VisibleControlLength=function(t){return e(t).filter(function(){return"none"!==e(this).css("display")}).length},_shopdetail.renderbookdropdown=function(){IsServiceTab&&IsClassTab&&e(".noarrow").removeClass("noarrow")},_shopdetail.backToShopDetail=function(t){"detail"!=BasePage.toLowerCase()?location.href=t:(e("#select2-drop-mask").click(),e("#dvDailyDealsDetail").hide(),e("#divWriteReview").hide(),e("#pageSection").show().addClass("pagesectionFlex"),_common.closeServiceSelection(),_common.ToggelmobileMenu(),_shopdetail.loadbyMenuClick(DefaultTabPage))},_shopdetail.ApplyServiceBaseGCOnAppointment=function(t,i){t.price>0&&t.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&null!=i&&i.length>0&&e.grep(i,function(e){t.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&e.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&e.quantity>0&&t.ServiceOrginalPrice>0&&(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.serviceId=t.serviceid,objGC.redeemAmt=t.price,objGC.uniqID=t.AppSrNo,objGC.AppointmentID=0,objGC.Type=CheckoutBarcodeCodePrepay.GC,objGC.GCredeemAmtForDisc=t.price,objGC.gcAfterbalance=e.quantity-1,objGC.GcPkgType=1,objGC.Taxes=e.Taxes,objGC.quantity=e.quantity,_shopdetail.BookingDetail.Prepay.RedeemedByGC.push(objGC),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-t.price),e.quantity=e.quantity-1,t.ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,t.redeemAmount=t.price,t.GCDetail.push(objGC),t.IsServiceBaseGC=!0,t.depositsPaid=0,t.depositsPercentage=0,t.paidType=arrpaidType.Paid,_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+t.price))})},_shopdetail.ApplyServiceBaseGCOnAddon=function(t,i){t.Price>0&&t.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&null!=i&&i.length>0&&e.grep(i,function(e){t.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&e.serviceName.toLowerCase().trim()==t.ServiceTitle.toLowerCase().trim()&&e.quantity>0&&t.priceOriginal>0&&(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.serviceId=t.ServiceId,objGC.redeemAmt=t.Price,objGC.uniqID=t.SerialNo,objGC.AppointmentID=0,objGC.Type=CheckoutBarcodeCodePrepay.GC,objGC.GCredeemAmtForDisc=t.Price,objGC.gcAfterbalance=e.quantity-1,objGC.GcPkgType=1,objGC.Taxes=e.Taxes,_shopdetail.BookingDetail.Prepay.RedeemedByGC.push(objGC),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-t.Price),e.quantity=e.quantity-1,t.ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,t.redeemAmount=t.Price,t.GCDetail.push(objGC),t.IsServiceBaseGC=!0,t.depositsPaid=0,t.depositsPercentage=0,t.paidType=arrpaidType.Paid,_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+t.Price))})},_shopdetail.AssignUniqueIdtoAddons=function(){var t=4;e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(null!=e.lstAddonService&&e.lstAddonService.length>0)for(var i=0;i<e.lstAddonService.length;i++)e.lstAddonService[i].SerialNo=t,t+=1})},_shopdetail.ApplyPriceBaseGCOnAppointment=function(t,i,a){var r=_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem();if((t.paidType==arrpaidType.Deposits||t.paidType==arrpaidType.Paid)&&null!=i&&i.length>0&&(t.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount||t.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC)&&!r){var o=t.Tax,n=0;n=void 0!==t.IsPartialPoint&&1==t.paidType&&1==t.IsPartialPoint&&t.PartialPrice>0?parseFloat(t.PartialPrice):parseFloat(t.price),null!=t.GCDetail&&t.GCDetail.length>0&&(1==a?null!=t.GCDetail.find(e=>e.serviceId==t.ServiceId).Taxes&&(o=0):null!=t.GCDetail.find(e=>e.serviceId==t.serviceid).Taxes&&(o=0),n=0),1==a&&(n=parseFloat(t.Price)),t.paidType==arrpaidType.Deposits&&(n=parseFloat(t.depositsPaid),o=0),e.grep(i,function(e){0==t.IsServiceBaseGC&&n>0&&e.currentBalance>0&&(e.currentBalance>=n?(t.ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=n,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t.GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t.redeemAmount=_shopdetail.parseTodecimal(t.redeemAmount+n),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-n),n=0,IsLowAmountGC=!1):n>e.currentBalance&&e.currentBalance>0&&(t.ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=e.currentBalance,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t.GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t.redeemAmount=_shopdetail.parseTodecimal(t.redeemAmount+e.currentBalance),n=_shopdetail.parseTodecimal(n-e.currentBalance),e.currentBalance=0,IsLowAmountGC=!0)),o>0&&e.currentBalance>0&&(o=_shopdetail.parseTodecimal(o),e.currentBalance>=o?(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=o,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t.GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t.redeemTax=_shopdetail.parseTodecimal(t.redeemTax+o),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-o),o=0):o>e.currentBalance&&e.currentBalance>0&&(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=e.currentBalance,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t.GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t.redeemTax=_shopdetail.parseTodecimal(t.redeemTax+e.currentBalance),o=_shopdetail.parseTodecimal(o-e.currentBalance),e.currentBalance=0,IsLowAmountGC=!0))}),0==t.IsServiceBaseGC?_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+t.redeemAmount+t.redeemTax):_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+t.redeemTax)}},_shopdetail.ApplyPriceBaseGCOnFees=function(t,i){for(var a=0;a<t.length;a++)if(null!=i&&i.length>0&&1!=t[a].FeeType&&(t[a].ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount||t[a].ApplyDiscoutType==ApplyDiscoutTypePrepay.GC)&&t[a].paidType==arrpaidType.Paid){var r=0,o=0;o=t[a].CalculatedFees,r=GetCalculateTaxValue(t[a].BusinessTax),e.grep(i,function(e){o>0&&e.currentBalance>0&&(e.currentBalance>=o?(t[a].ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=o,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemAmount=_shopdetail.parseTodecimal(t[a].redeemAmount+o),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-o),o=0):o>e.currentBalance&&e.currentBalance>0&&(t[a].ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=e.currentBalance,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemAmount=_shopdetail.parseTodecimal(t[a].redeemAmount+e.currentBalance),o=_shopdetail.parseTodecimal(o-e.currentBalance),e.currentBalance=0)),r>0&&e.currentBalance>0&&(r=_shopdetail.parseTodecimal(r),e.currentBalance>=r?(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=r,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemTax=_shopdetail.parseTodecimal(t[a].redeemTax+r),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-r),r=0):r>e.currentBalance&&e.currentBalance>0&&(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=e.currentBalance,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemTax=_shopdetail.parseTodecimal(t[a].redeemTax+e.currentBalance),r=_shopdetail.parseTodecimal(r-e.currentBalance),e.currentBalance=0))}),_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+t[a].redeemAmount+t[a].redeemTax)}},_shopdetail.ApplyPriceBaseGCOnMembershipUpSell=function(t,i){if(void 0!==t&&null!=t)for(var a=0;a<t.length;a++)if(null!=i&&i.length>0&&(t[a].ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount||t[a].ApplyDiscoutType==ApplyDiscoutTypePrepay.GC)){var r=0,o=0;o=t[a].ActualPrice,r=GetCalculateTaxValue(t[a].BusinessTax),e.grep(i,function(e){o>0&&e.currentBalance>0&&(e.currentBalance>=o?(t[a].ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=o,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemAmount=_shopdetail.parseTodecimal(t[a].redeemAmount+o),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-o),o=0):o>e.currentBalance&&e.currentBalance>0&&(t[a].ApplyDiscoutType=ApplyDiscoutTypePrepay.GC,objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=e.currentBalance,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemAmount=_shopdetail.parseTodecimal(t[a].redeemAmount+e.currentBalance),o=_shopdetail.parseTodecimal(o-e.currentBalance),e.currentBalance=0)),r>0&&e.currentBalance>0&&(r=_shopdetail.parseTodecimal(r),e.currentBalance>=r?(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=r,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemTax=_shopdetail.parseTodecimal(t[a].redeemTax+r),e.currentBalance=_shopdetail.parseTodecimal(e.currentBalance-r),r=0):r>e.currentBalance&&e.currentBalance>0&&(objGC={},objGC.giftcertificateId=e.giftCertificateID,objGC.giftCertificateNo=e.giftCertificateNo,objGC.redeemAmt=e.currentBalance,objGC.gcAfterbalance=e.currentBalance,objGC.GcPkgType=2,t[a].GCDetailPriceBase.push(objGC),_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.push(objGC),t[a].redeemTax=_shopdetail.parseTodecimal(t[a].redeemTax+e.currentBalance),r=_shopdetail.parseTodecimal(r-e.currentBalance),e.currentBalance=0))}),_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+t[a].redeemAmount+t[a].redeemTax)}},_shopdetail.BindDiscountOnItems=function(t,i,a,r,o,n,s,l,d,c=!1,u,p,h,m){var f="",g="0.00",v="0";if(void 0!==d&&null!=d&&""!=d.trim()&&(f=d),m=void 0===m||null==m||""==m?"0.00":_vgClassSessionSelection.ConvertTodecimal(m,2),void 0!==p&&null!=p&&""!=p&&(g=_vgClassSessionSelection.ConvertTodecimal(p,2)),void 0!==h&&null!=h&&(v=h),t)e("#div_"+i).html("<div class=\"applied-green-part thm-textColor badge-button-positive\"><div class=\"sign-icon\">&#xf058;</div><span class=\"green-text\"> Gift Card Applied</span></div><a href='javascript:void(0)' class='return-policy' title='Remove GC'  onclick='_shopdetail.RemoveDiscount("+ApplyDiscoutTypePrepay.GC+", "+i+")'><span>Remove</span></a>"),e("#div_"+i).show();else if(a&&void 0===u)IsPartialPointAllowed?(e("#div_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Points Applied  ('+v+" pts) </span></div> <a href='javascript:void(0)' class='return-policy' title='Remove Points'  onclick='_shopdetail.RemoveDiscount("+ApplyDiscoutTypePrepay.Points+", "+i+")'><span>Remove</span></a>"),e("#divPricePoint_"+i).html('<div class="thm-textColor"> <span class="item-price-line-through">'+_shopdetail.BookingDetail.CurrencySymbol+g+"</span></div>"+_shopdetail.BookingDetail.CurrencySymbol+m)):(e("#div_"+i).html("<div class=\"applied-green-part thm-textColor badge-button-positive\"><div class=\"sign-icon\">&#xf058;</div><span class=\"green-text\"> Points Applied</span></div> <a href='javascript:void(0)' class='return-policy' title='Remove Points'  onclick='_shopdetail.RemoveDiscount("+ApplyDiscoutTypePrepay.Points+", "+i+")'><span>Remove</span></a>"),e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+"0.00")),e("#div_"+i).show();else if(r&&void 0===u){var A=f.length>0?"("+f+")":"";1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()?e("#div_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Package Applied '+A+"</span></div>"):e("#div_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Package Applied '+A+"</span></div> <a href='javascript:void(0)' class='return-policy' title='Remove Package'  onclick='_shopdetail.RemoveDiscount("+ApplyDiscoutTypePrepay.Package+", "+i+")'><span>Remove</span></a>"),e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(o)),e("#div_"+i).show()}else if(n&&void 0===u)1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()?e("#divMem_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Membership Applied ('+f+")</span></div>"):e("#divMem_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Membership Applied ('+f+")</span></div><a href='javascript:void(0)' class='return-policy' title='Remove Membership'  onclick='_shopdetail.RemoveDiscount(3, "+i+")'><span>Remove</span></a>"),e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(s)),e("#divMem_"+i).show();else if(void 0!==l&&l&&void 0===u)e("#divPD_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Promo Code Applied</span></div>'),e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(s)),e("#divPD_"+i).show();else if(c&&void 0===u)""!=f?e("#divMem_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text">Deposit is Waived   ('+f+")</span></div><a href='javascript:void(0)' class='return-policy' title='Remove Deposit Fee Waived'  onclick='_shopdetail.RemoveDiscount(6, "+i+")'><span>Remove</span></a>"):e("#divMem_"+i).html("<div class=\"applied-green-part thm-textColor badge-button-positive\"><div class=\"sign-icon\">&#xf058;</div><span class=\"green-text\">Deposit is Waived </span></div><a href='javascript:void(0)' class='return-policy' title='Remove Deposit Fee Waived'  onclick='_shopdetail.RemoveDiscount(6, "+i+")'><span>Remove</span></a>"),e("#divMem_"+i).show();else if(n&&void 0!==u){e("#divAddonMem_"+(C=u+"_"+i)).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Membership Applied ('+f+")</span></div><a href='javascript:void(0)' class='return-policy' title='Remove Membership'  onclick='_shopdetail.RemoveDiscount(7, "+i+","+u+")'><span>Remove</span></a>"),e("#divPricePoint_"+u+"_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(s)),e("#divAddonMem_"+C).show()}else if(c&&void 0!==u){var C=u+"_"+i;if(""!=f){var y=e("<div>").text(f).html();e("#divAddonMem_"+C).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Deposit is Waived ('+y+")</span></div><a href='javascript:void(0)' class='return-policy' title='Remove Membership' onclick='_shopdetail.RemoveDiscount(7, "+i+","+u+")'><span>Remove</span></a>")}else e("#divAddonMem_"+C).html("<div class=\"applied-green-part thm-textColor badge-button-positive\"><div class=\"sign-icon\">&#xf058;</div><span class=\"green-text\"> Deposit is Waived </span></div><a href='javascript:void(0)' class='return-policy' title='Remove Membership' onclick='_shopdetail.RemoveDiscount(7, "+i+","+u+")'><span>Remove</span></a>");e("#divAddonMem_"+C).show()}else if(r&&void 0!==u){C=u+"_"+i,A=f.length>0?"("+f+")":"";e("#divAddonPack_"+C).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Package Applied '+A+"</span></div> <a href='javascript:void(0)' class='return-policy' title='Remove Package'  onclick='_shopdetail.RemoveDiscount(8, "+i+","+u+")'><span>Remove</span></a>"),e("#divPricePoint_"+u+"_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(o)),e("#divAddonPack_"+C).show()}else if(a&&void 0!==u){C=u+"_"+i;IsPartialPointAllowed?(e("#divAddonPoint_"+C).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Points Applied  ('+v+" pts) </span></div> <a href='javascript:void(0)' class='return-policy' title='Remove Points'  onclick='_shopdetail.RemoveDiscount("+ApplyDiscoutTypePrepay.PointsAddon+", "+i+","+u+")'><span>Remove</span></a>"),e("#divPricePoint_"+u+"_"+i).html('<div class="thm-textColor"> <span class="item-price-line-through">'+_shopdetail.BookingDetail.CurrencySymbol+g+"</span></div>"+_shopdetail.BookingDetail.CurrencySymbol+m)):(e("#divAddonPoint_"+C).html("<div class=\"applied-green-part thm-textColor badge-button-positive\"><div class=\"sign-icon\">&#xf058;</div><span class=\"green-text\"> Points Applied</span></div> <a href='javascript:void(0)' class='return-policy' title='Remove Points'  onclick='_shopdetail.RemoveDiscount("+ApplyDiscoutTypePrepay.PointsAddon+", "+i+","+u+")'><span>Remove</span></a>"),e("#divPricePoint_"+u+"_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+"0.00")),"undefined"!=_shopdetail.PromotionID&&_shopdetail.PromotionID>0&&e("#divAddonPD_"+u+"_"+i).html("").hide(),e("#divAddonPoint_"+C).show()}else if(void 0!==l&&l&&void 0!==u){C=i+1;e("#divAddPD_"+u+"_"+i).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Promo Code Applied</span></div>'),e("#divPricePoint_"+u+"_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(s)),e("#divAddPD_"+u+"_"+i).show()}},_shopdetail.CalculateServicePrice=function(e,t){var i=e.pointredeemOriginal,a=e.ServiceOrginalPrice;return _vgClassSessionSelection.ConvertTodecimal(a*t/i,2,!1)},_shopdetail.CalculatePointGiven=function(e,t){var i=e.ServiceOrginalPrice,a=e.pointgivenOriginal;return Math.round(t*a/i)},_shopdetail.ApplyPointsOnAppointment=function(e,t){if(void 0!==t&&t.pointsBalance>0){var i=_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem();if(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&e.ServiceOrginalPrice>0&&!i){var a=e.pointredeem;if(a>0&&t.pointsBalance>=a&&t.pointsBalance>0){t.pointsBalance=parseInt(t.pointsBalance-a),e.pointredeem=a,e.pointgiven=0,e.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,e.depositsPaid=0,e.depositsPercentage=0,e.paidType=arrpaidType.Paid,e.TotalApplyPoint=e.pointredeem;var r=e.priceOriginal;_shopdetail.BindDiscountOnItems(!1,e.AppSrNo,!0,!1,0,!1,0,void 0,void 0,!1,void 0,r,a,void 0)}else if(1==IsPartialPointAllowed&&a>0&&t.pointsBalance>0){var o="0.00",n=parseInt(a-t.pointsBalance);e.pointredeem=parseInt(t.pointsBalance);r="0.00";if(r=e.priceOriginal,1==_shopdetail.BookingDetail.DepositAmtType)if(e.depositsPercentage=_shopdetail.calculatedDepositsAmount(e.priceOriginal),(g=Math.ceil(e.pointredeemOriginal*_shopdetail.BookingDetail.DepositsPer/parseFloat(e.priceOriginal)))>t.pointsBalance){e.pointredeem=t.pointsBalance;var s=parseFloat(_onlineCheckout.CalculateApplyPointsClassPrice(e.priceOriginal,e.pointredeem,e.pointredeemOriginal));e.PartialPrice=_shopdetail.parseTodecimal(e.priceOriginal-s);var l=_shopdetail.parseTodecimal(e.priceOriginal-e.PartialPrice),d=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.DepositsPer-s);e.depositsPaid=d,e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,e.IsDepositsOver=!1,e.IsAmountPaid=!0,e.PointPrice=_shopdetail.parseTodecimal(l),r=_shopdetail.parseTodecimal(e.priceOriginal-e.PartialPrice)}else{e.depositsPaid=_shopdetail.BookingDetail.DepositsPer,e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,e.IsDepositsOver=!0,e.IsAmountPaid=!0,e.PartialPrice=_shopdetail.parseTodecimal(e.price-e.depositsPaid);l=_shopdetail.parseTodecimal(e.price-e.PartialPrice);e.PointPrice=_shopdetail.parseTodecimal(l),e.pointredeem=g,r=_shopdetail.parseTodecimal(e.priceOriginal-e.PartialPrice)}else if(0==_shopdetail.BookingDetail.DepositAmtType&&100!=_shopdetail.BookingDetail.DepositsPer&&e.price>0){var c=e.taxes,u=0,p=0;if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&""!=c&&null!=c&&"0"!=c){let t=c.split(",");var h=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(null!=t&&t.length>0)for(var m=0;m<t.length;m++)h.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(e=>e.BusinessTaxID==t[m]).Tax);h.length>0&&(p=h.reduce((e,t)=>e+t,0),u=CalAccPriceWithTax(e.priceOriginal,p))}}else u=e.priceOriginal;var f=_shopdetail.calculatedDepositsAmount(u),g=Math.ceil(e.pointredeemOriginal*f/parseFloat(e.priceOriginal));if(e.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,g>t.pointsBalance){e.pointredeem=t.pointsBalance;s=parseFloat(_onlineCheckout.CalculateApplyPointsClassPrice(e.priceOriginal,e.pointredeem,e.pointredeemOriginal));e.PartialPrice=_shopdetail.parseTodecimal(e.priceOriginal-s);l=_shopdetail.parseTodecimal(e.priceOriginal-e.PartialPrice),d=_shopdetail.parseTodecimal(f-s);e.depositsPaid=d,e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,e.IsDepositsOver=!1,e.IsAmountPaid=!0,e.PointPrice=_shopdetail.parseTodecimal(l),r=_shopdetail.parseTodecimal(e.priceOriginal-e.PartialPrice)}else{e.depositsPaid=f,e.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,e.IsDepositsOver=!0,e.IsAmountPaid=!0,e.PartialPrice=_shopdetail.parseTodecimal(e.price-e.depositsPaid);l=_shopdetail.parseTodecimal(e.price-e.PartialPrice);e.PointPrice=_shopdetail.parseTodecimal(l),e.pointredeem=g,r=_shopdetail.parseTodecimal(e.priceOriginal-e.PartialPrice)}}else o=_shopdetail.CalculateServicePrice(e,n),e.PartialPrice=_shopdetail.parseTodecimal(o),e.paidType=arrpaidType.Paid;t.pointsBalance=parseInt(t.pointsBalance-e.pointredeem),e.TotalApplyPoint=e.pointredeem,e.IsPartialPoint=!0,e.pointgiven=0,e.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,100!=_shopdetail.BookingDetail.DepositsPer&&e.price>0?(o=_shopdetail.parseTodecimal(e.price),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(o)):(_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(o),o=r,r=_shopdetail.CalculateServicePrice(e,n)),_shopdetail.BindDiscountOnItems(!1,e.AppSrNo,!0,!1,0,!1,0,void 0,void 0,!1,void 0,o,e.pointredeem,r)}}}},_shopdetail.ApplyDiscounts=function(t,i,a,r,o){_shopdetail._addonMembershipGroupUsage={},null==t&&(t=[]),t=_shopdetail.GetGCPackageListForDailyDeal(t),_shopdetail.BookingDetail.Prepay={},_shopdetail.BookingDetail.Prepay.ccAmt=0,_shopdetail.BookingDetail.Prepay.amtPaid=0,_shopdetail.BookingDetail.Prepay.tax=0,_shopdetail.BookingDetail.Prepay.Rtax=0,_shopdetail.BookingDetail.Prepay.taxdifference=0,_shopdetail.BookingDetail.Prepay.gcAmt=0,_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=[],_shopdetail.BookingDetail.Prepay.RedeemedByGC=[],_shopdetail.BookingDetail.Prepay.PackageAmt=0,_shopdetail.BookingDetail.Prepay.TotalDiscount=0,_shopdetail.BookingDetail.Prepay.lstMembership=a,_shopdetail.BookingDetail.Prepay.VisitRemaining=0,_shopdetail.BookingDetail.Prepay.Visit=0,_shopdetail.BookingDetail.Prepay.lstServiceDetails=r,_shopdetail.BookingDetail.Prepay.lstGCpkgList=JSON.parse(JSON.stringify(t)),!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.Prepay.lstGCpkgList)&&_shopdetail.BookingDetail.Prepay.lstGCpkgList.length>0&&e.each(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e,t){t.ResetcurrentBalance=t.currentBalance}),_shopdetail.BookingDetail.Prepay.depositsAmount=0,_shopdetail.BookingDetail.Prepay.depositsRemaining=0,_shopdetail.BookingDetail.Prepay.displayTax=0,_shopdetail.BookingDetail.Prepay.RdisplayTax=0;var n=!1,s=e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e,t){return 1==e.isPackage&&(0==e.isCustomPackage||1==e.isCustomPackage&&null==e.serviceID)&&(1==e.isCustomPackage&&null==e.serviceID&&0==n&&(n=!0),!0)});if(null!=s&&s.length>0){var l={expiresOn:"asc",quantity:"asc"};s.keySort(l);var d=[];1==n&&(e.grep(s,function(t){d.push(t);var i=e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e){return 1==e.isPackage&&1==e.isCustomPackage&&t.giftCertificateID==e.giftCertificateID&&null!=e.serviceID});i.length>0&&(d=d.concat(i))}),s=d)}var c=null!=o&&void 0!==o?o.giftCertificateNo:"",u=e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e,t){return!e.isPackage&&null!=e.serviceID&&(""==c||c!=e.giftCertificateNo)});if(null!=u&&u.length>0){l={serviceID:"desc",GiftCertificateAmt:"asc"};u.keySort(l),null!=o&&void 0!==o&&null!=o.serviceID&&u.splice(0,0,o)}else null!=o&&void 0!==o&&null!=o.serviceID&&u.splice(0,0,o);var p=e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e,t){return!e.isPackage&&null==e.serviceID&&(""==c||c!=e.giftCertificateNo)});if(null!=p&&p.length>0){l={serviceID:"desc",GiftCertificateAmt:"asc"};p.keySort(l),null!=o&&void 0!==o&&null==o.serviceID&&p.splice(0,0,o)}else null!=o&&void 0!==o&&null==o.serviceID&&p.push(o);isDepositOff&&(u=[],p=[]),_shopdetail.createGiftCertificates(u,p);var h=0;_shopdetail.ValidateOnePerUserDeal(!0),_shopdetail.ValidateAddOnPerUserDeal(!0),filpkglist=JSON.parse(JSON.stringify(s)),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e,t){var n=_shopdetail.BookingDetail.DepositsLimit<=_shopdetail.GetTotalAmountforDeposits();if(0==e.price&&0==e.Discount&&(e.paidType=arrpaidType.UnPaid),"undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell?e.paidType=arrpaidType.UnPaid:e.paidType=arrpaidType.Paid,_IsPrepay){if(null!=o&&void 0!==o||(_shopdetail.ApplyPackageOnAppointment(e,s),n&&"undefined"!=e.PromotionId&&e.PromotionId<=0&&_shopdetail.ApplyPointsOnAppointment(e,i)),_shopdetail.ApplyMembershipOnAppointment(e,a),_shopdetail.CalculateTax(e,r),_shopdetail.CheckPriceWithTaxSwitch()&&"431131"==_shopdetail.businessID&&e.BusinessTax?.length){var l=_shopdetail.parseTodecimal(e.price),d=function(e){if(!e?.length)return 0;var t=e.reduce((e,t)=>e+(t.CalculatedTax||0),0),i=_shopdetail.parseTodecimal(t),a=_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(l+t)-l),r=_shopdetail.parseTodecimal(i-a);if(r>=.009&&r<=.011){var o=e[e.length-1];return o&&(o.CalculatedTax=_shopdetail.parseTodecimal(o.CalculatedTax-.01)),a}return i},c=e.BusinessTax.reduce((e,t)=>e+t.Tax,0);if(CalAccPriceWithTax(e.price,c,_shopdetail.businessID)!=_shopdetail.parseTodecimal(e.price+e.Tax)){e.Tax=d(e.BusinessTax);var p=r?.find(t=>t.ServiceID==e.serviceid);p?.BusinessTax?.length&&d(p.BusinessTax)}}1==e.IsServiceBaseGC&&_shopdetail.ApplyServiceBaseGCOnAppointment(e,u);for(var m=0;m<SelectedAddonService.length;m++)if(_shopdetail.AssignUniqueIdtoAddons(),SelectedAddonService[m].MainServiceID==e.serviceid&&SelectedAddonService[m].SrNo==e.AppSrNo)for(var f=0;f<SelectedAddonService[m].lstAddonService.length;f++){var g=SelectedAddonService[m].lstAddonService[f];g.paidType=arrpaidType.Paid,null!=o&&void 0!==o||(_shopdetail.ApplyPackageOnAddon(e,s,g,SelectedAddonService[m].SrNo),n&&"undefined"!=e.PromotionId&&e.PromotionId<=0&&_shopdetail.ApplyPointsOnAddon(e,i,g,SelectedAddonService[m].SrNo)),_shopdetail.ApplyMembershipOnAddon(e,a,g),_shopdetail.CalculateTaxForAddon(g),_shopdetail.ApplyServiceBaseGCOnAddon(g,u)}}h=_shopdetail.GetTotalAmountforDeposits()});var m=_shopdetail.IsDailyDealsAppliedInItem();e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&!e.IsPartialPoint||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||1==e.IsServiceBaseGC||(h>=_shopdetail.BookingDetail.DepositsLimit||m?(_shopdetail.calculateDepositsPrepay(e),null!=e.strAdvanceLimitDate&&""!=e.strAdvanceLimitDate&&new Date(moment(e.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(e.appBookingDate)&&e.paidType==arrpaidType.UnPaid&&_shopdetail.BindDiscountOnItems(!1,e.AppSrNo,!1,!1,0,!1,0,!1,e.AppliedName,!0)):0==e.price&&e.priceOriginal==e.Discount&&(1==e.IsMembershipApply||e.Discount>0)?e.paidType=arrpaidType.Paid:1==e.IsMembershipApply?e.paidType=arrpaidType.PartiallyPaid:0==e.Discount&&(e.paidType=arrpaidType.UnPaid)),0==e.IsServiceBaseGC&&_shopdetail.BookingDetail.Prepay.PackageAmt<=0&&(e.GCDetailPriceBase=[],e.redeemAmount=0),_shopdetail.ApplyPriceBaseGCOnAppointment(e,p,!1),e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){if(_shopdetail.CheckPriceWithTaxSwitch()&&null!=e.BusinessTax&&e.BusinessTax.length>0&&"431131"==_shopdetail.businessID){var t=e.BusinessTax.reduce((e,t)=>e+t.Tax,0);let i=CalAccPriceWithTax(e.price,t,_shopdetail.businessID);_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+i)}else _shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+e.price+_shopdetail.parseTodecimal(e.Tax));_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+e.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+e.Tax,3),e.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+e.depositsPaid),_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(e.price-_shopdetail.parseTodecimal(e.depositsPaid))+_shopdetail.parseTodecimal(e.Tax)),_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.parseTodecimal(e.depositsPaid)-e.redeemAmount),e.Tax=0):e.paidType==arrpaidType.UnPaid||e.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(e.price-_shopdetail.parseTodecimal(e.depositsPaid))+_shopdetail.parseTodecimal(e.Tax)),e.Tax=0):e.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(e.price+_shopdetail.parseTodecimal(e.Tax))-(e.redeemAmount+e.redeemTax))),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+e.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+e.Tax,3),_shopdetail.BookingDetail.Prepay.TotalDiscount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.TotalDiscount+e.Discount),_shopdetail.BookingDetail.Prepay.VisitRemaining=e.VisitRemaining,_shopdetail.BookingDetail.Prepay.Visit=e.Visit}e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&(_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+_shopdetail.parseTodecimal(e.Tax)),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+e.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+e.Tax,3),e.IsPartialPoint&&(e.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+e.depositsPaid),e.IsDepositsOver?_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(e.price-e.depositsPaid)+_shopdetail.parseTodecimal(e.Tax)):_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(e.price-e.depositsPaid)+_shopdetail.parseTodecimal(e.Tax)-e.PointPrice),e.IsAmountPaid&&e.IsDepositsOver?_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+0):_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+e.depositsPaid-e.redeemAmount),e.Tax=0):e.paidType==arrpaidType.UnPaid||e.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(e.price-e.depositsPaid)+_shopdetail.parseTodecimal(e.Tax)),e.Tax=0):e.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(e.PartialPrice+_shopdetail.parseTodecimal(e.Tax))-(e.redeemAmount+e.redeemTax))),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+e.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+e.Tax,3)))}),_shopdetail.CalculateApptAddons(!1,p),String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.FeeDetails)&&(_shopdetail.BookingDetail.FeeDetails=[]),_shopdetail.ApplyServiceFee(0,"1"),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&_shopdetail.ApplyServiceFee(0,"7"),null!=_shopdetail.BookingDetail.FeeDetails&&"undefined"!=_shopdetail.BookingDetail.FeeDetails&&null!=_shopdetail.BookingDetail.FeeDetails&&(e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){0!=e.redeemAmount&&(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||(e.redeemAmount=0,e.redeemTax=0,e.GCDetail=[],e.GCDetailPriceBase=[],e.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount))}),_shopdetail.ApplyPriceBaseGCOnFees(_shopdetail.BookingDetail.FeeDetails,p)),_shopdetail.ApplyFeesValue(!1),_shopdetail.ApplyMembershipUpSell(p,!0),_shopdetail.ApplyPackageUpSell(p,!0),_shopdetail.ValidateOnePerUserDeal(!1),_shopdetail.ValidateAddOnPerUserDeal(!1),_shopdetail.CalculatePriceBaseGC(),ischkFirstTimeCustomer=null,e("#dvFirstTimeCustomer").hide(),e("#tabFirstTimeYes, #tabFirstTimeNo").removeClass("w--current").attr("aria-checked","false"),e("#dvFirstTimeCustomerError").hide(),_shopdetail.ApplyDailyDealFeeToItems(),_shopdetail.BindFirstTimeCustomerCheckbox();try{m&&"function"==typeof _shopdetail.isDailyDealExistsInItems&&_shopdetail.isDailyDealExistsInItems()&&(e("#divGiftCertificate").hide(),e("#divCheckoutBookingPromoCodeService").hide())}catch(e){}if(m){var f=_shopdetail?.BookingDetail?.AppointmentDetail||[];if(!_shopdetail?.BookingDetail?.Prepay||!Array.isArray(f))return;var g=0;if(f.forEach(function(e){if(e){var t=Number(e.DailyDealFee||0);!isNaN(t)&&t>0&&(g+=t),(Array.isArray(e.lstAddonService)?e.lstAddonService:[]).forEach(function(e){if(e){var t=Number(e.DailyDealFee||0);!isNaN(t)&&t>0&&(g+=t)}})}}),(g=_shopdetail.parseTodecimal(g||0))>0&&_shopdetail.BookingDetail.Prepay.ccAmt<g){_shopdetail.BookingDetail.Prepay.ccAmt=g,_shopdetail.BookingDetail.Prepay.depositsAmount=g;var v=Number(_shopdetail.BookingDetail.Prepay.amtPaid||0);isNaN(v)&&(v=0),v=_shopdetail.parseTodecimal(v),_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(Math.max(v-g,0)),f.forEach(function(e){e&&(e.depositsPaid=Number(e.DailyDealFee||0),(Array.isArray(e.lstAddonService)?e.lstAddonService:[]).forEach(function(e){e&&(e.depositsPaid=Number(e.DailyDealFee||0))}))})}}},_shopdetail.CalculateTaxForAddon=function(e){if(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&!e.IsPartialPoint)e.Tax=0;else{_shopdetail.ApplyMultipleTax(e.Price,e);var t=0;null!=e.BusinessTax&&e.BusinessTax.forEach(e=>{null!=e.Tax&&(t+=e.Tax)}),e.Tax=_vgClassSessionSelection.ConvertTodecimal(e.Price*t/100,3,!0),e.BusinessTax=e.BusinessTax}},_shopdetail.CalculateApptAddons=function(t,i){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(a){for(var r=_shopdetail.GetTotalAmountforDeposits(),o=_shopdetail.IsDailyDealsAppliedInItem(),n=0;n<SelectedAddonService.length;n++)if(SelectedAddonService[n].MainServiceID==a.serviceid&&SelectedAddonService[n].SrNo==a.AppSrNo)for(var s=0;s<SelectedAddonService[n].lstAddonService.length;s++){var l=SelectedAddonService[n].lstAddonService[s];l.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&!l.IsPartialPoint||l.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||1==l.IsServiceBaseGC||(r>=_shopdetail.BookingDetail.DepositsLimit||o?(_shopdetail.calculateDepositsPrepayforAddons(l,a),null!=l.strAdvanceLimitDate&&""!=l.strAdvanceLimitDate&&new Date(moment(l.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(a.appBookingDate)&&l.paidType==arrpaidType.UnPaid&&_shopdetail.BindDiscountOnItems(!1,SelectedAddonService[n].SrNo,!1,!1,0,!1,0,!1,l.AppliedName,!0,l.ServiceId)):(0==l.Price&&l.priceOriginal==l.Discount&&(1==l.IsMembershipApply||l.Discount>0)?l.paidType=arrpaidType.Paid:1==l.IsMembershipApply?l.paidType=arrpaidType.PartiallyPaid:0==l.Discount&&(l.paidType=arrpaidType.UnPaid),1==t&&(l.depositsPaid=0,l.depositsPercentage=0,l.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC&&1!=l.IsServiceBaseGC&&(e("#div_"+l.AppSrNo).html(""),l.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,l.redeemAmount=0,l.redeemTax=0,l.GCDetail=[],l.GCDetailPriceBase=[],l.IsServiceBaseGC=!1)))),1==t?_shopdetail.CalculateTaxForAddon(l):("undefined"!=typeof _IsMemPkgUpSell&&0==_IsMemPkgUpSell&&1!=l.IsServiceBaseGC&&_shopdetail.BookingDetail.Prepay.PackageAmt<=0&&(l.redeemAmount=0,l.GCDetailPriceBase=[]),_shopdetail.ApplyPriceBaseGCOnAppointment(l,i,!0)),(String.isNullOrUndefineOrBlank(l.Tax)||0==l.Tax)&&(l.BusinessTax=[]),l.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&(1==t&&(null!=l.GCDetail&&l.GCDetail.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGC=_shopdetail.BookingDetail.Prepay.RedeemedByGC.concat(l.GCDetail)),null!=l.GCDetailPriceBase&&l.GCDetailPriceBase.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.concat(l.GCDetailPriceBase))),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+l.Price+_shopdetail.parseTodecimal(l.Tax)),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+l.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+l.Tax,3),l.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+l.depositsPaid),_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(l.Price-l.depositsPaid)+_shopdetail.parseTodecimal(l.Tax)),_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+l.depositsPaid-l.redeemAmount),l.Tax=0):l.paidType==arrpaidType.UnPaid||l.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(l.Price-l.depositsPaid)+_shopdetail.parseTodecimal(l.Tax)),l.Tax=0):l.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(l.Price+_shopdetail.parseTodecimal(l.Tax))-(l.redeemAmount+l.redeemTax))),1==t&&(l.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?_shopdetail.BookingDetail.Prepay.PackageAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.PackageAmt+l.redeemAmount):_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+l.redeemAmount+l.redeemTax)),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+l.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+l.Tax,3),_shopdetail.BookingDetail.Prepay.TotalDiscount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.TotalDiscount+l.Discount),_shopdetail.BookingDetail.Prepay.VisitRemaining=l.VisitRemaining,_shopdetail.BookingDetail.Prepay.Visit=l.Visit),l.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&(l.IsPartialPoint?(l.paidType==arrpaidType.Deposits?l.IsDepositsAmountPaid&&l.IsDepositsOver?_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+l.Price+_shopdetail.parseTodecimal(l.Tax)):_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+l.OriginalPrice):_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+l.Price+_shopdetail.parseTodecimal(l.Tax)),l.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+l.depositsPaid),l.IsDepositsAmountPaid&&l.IsDepositsOver?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(l.OriginalPrice-l.depositsPaid-l.AddonPointPrice)+_shopdetail.parseTodecimal(l.Tax)),_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+0)):(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(l.Price-l.depositsPaid-l.AddonPointPrice)+_shopdetail.parseTodecimal(l.Tax)),_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+l.depositsPaid-l.redeemAmount))):l.paidType==arrpaidType.UnPaid||l.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(l.Price-l.depositsPaid)+_shopdetail.parseTodecimal(l.Tax)),l.Tax=0):l.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(l.Price+_shopdetail.parseTodecimal(l.Tax))-(l.redeemAmount+l.redeemTax))),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+l.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+l.Tax,3),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+l.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+l.Tax,3)):_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+_shopdetail.parseTodecimal(l.Tax)))}})},_shopdetail.ApplyMembershipUpSell=function(t,i){"undefined"!=_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&(1==i&&_shopdetail.ResetMembershipUpsell(1),_shopdetail.ApplyDailyDealONMemberships(),1==i?_shopdetail.ApplyPriceBaseGCOnMembershipUpSell(_shopdetail.BookingDetail.MembershipUpSellData,t):_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){null!=e.GCDetailPriceBase&&e.GCDetailPriceBase.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.concat(e.GCDetailPriceBase)),_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+e.redeemAmount+e.redeemTax)}),_shopdetail.ApplyMembershipUpSellCalculation())},_shopdetail.ApplyPackageUpSell=function(t,i){"undefined"!=_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&(1==i&&_shopdetail.ResetMembershipUpsell(2),_shopdetail.ApplyDailyDealONPackages(),1==i?_shopdetail.ApplyPriceBaseGCOnMembershipUpSell(_shopdetail.BookingDetail.PackageUpSellData,t):_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){null!=e.GCDetailPriceBase&&e.GCDetailPriceBase.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.concat(e.GCDetailPriceBase)),_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+e.redeemAmount+e.redeemTax)}),_shopdetail.ApplyPackageUpSellCalculation())},_shopdetail.ResetMembershipUpsell=function(t){1!=t&&3!=t||"undefined"==_shopdetail.BookingDetail.MembershipUpSellData||null==_shopdetail.BookingDetail.MembershipUpSellData||null==_shopdetail.BookingDetail.MembershipUpSellData||e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){0!=e.redeemAmount&&(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||(e.redeemAmount=0,e.redeemTax=0,e.GCDetail=[],e.GCDetailPriceBase=[],e.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount))}),2!=t&&3!=t||"undefined"==_shopdetail.BookingDetail.PackageUpSellData||null==_shopdetail.BookingDetail.PackageUpSellData||null==_shopdetail.BookingDetail.PackageUpSellData||e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){0!=e.redeemAmount&&(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||(e.redeemAmount=0,e.redeemTax=0,e.GCDetail=[],e.GCDetailPriceBase=[],e.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount))})},_shopdetail.ApplyMembershipUpSellCalculation=function(){var t=_shopdetail.BookingDetail.MembershipUpSellData,i=0,a=0,r=0,o=0,n=0;null!=t&&null!=t&&""!=t&&e.grep(t,function(t){a+=t.ActualPrice,r+=t.redeemAmount,o+=t.redeemTax,n=0,null!=t.BusinessTax&&t.BusinessTax.length>0&&e.grep(t.BusinessTax,function(e){i+=e.CalculatedTax,n+=e.CalculatedTax});var s=_shopdetail.parseTodecimal(t.ActualPrice+n);_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+s-(r+o)),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+s),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+n),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+n),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+n),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+n)}),_shopdetail.BookingDetail.totalMembershipUpSellAmount=_shopdetail.parseTodecimal(a,3),_shopdetail.BookingDetail.totalMembershipUpSellTax=_shopdetail.parseTodecimal(i,3)},_shopdetail.ApplyPackageUpSellCalculation=function(){var t=_shopdetail.BookingDetail.PackageUpSellData,i=0,a=0;null!=t&&null!=t&&""!=t&&e.grep(t,function(t){var r=0,o=0,n=0;a+=t.ActualPrice,r+=t.redeemAmount,o+=t.redeemTax,n=0,null!=t.BusinessTax&&t.BusinessTax.length>0&&e.grep(t.BusinessTax,function(e){i+=e.CalculatedTax,n+=e.CalculatedTax});var s=_shopdetail.parseTodecimal(t.ActualPrice+n);_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+s-(r+o)),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+s),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+n),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+n),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+n),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+n)}),_shopdetail.BookingDetail.totalpackageUpSellAmount=_shopdetail.parseTodecimal(a,3),_shopdetail.BookingDetail.totalpackageUpSellTax=_shopdetail.parseTodecimal(i,3)},_shopdetail.RemoveMembershipUpSellDiscount=function(t){1!=_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()&&(1!=t&&3!=t||(e('div[id^="divMem_"]').html(""),e('a[id^="M_"]').removeClass("w--current"),e("#divMemUpsell").html("1"),e("#divMemUpsell").hide(),e("#divMemUpsellPrice_Deals").html(""),e("#divMemUpsellPrice_Preset").html(""),e("#divMemUpsellPrice_Deals").hide(),e("#divMemUpsellPrice_Preset").hide(),e("#Nothanks").addClass("w--current"),e("#scffsharingMS").html(""),e("#scffsharingMS").hide(),_shopdetail.BookingDetail.MembershipUpSellData=[]),2!=t&&3!=t||(e('div[id^="div_"]').html(""),e('a[id^="P_"]').removeClass("w--current"),e("#divPackageUpsell").html("1"),e("#divPackageUpsell").hide(),e("#divPackageUpsellPrice_Deals").html(""),e("#divPackageUpsellPrice_Preset").html(""),e("#divPackageUpsellPrice_Deals").hide(),e("#divPackageUpsellPrice_Preset").hide(),e("#Nothanks").addClass("w--current"),e("#scffsharingPkg").html(""),e("#scffsharingPkg").hide(),_shopdetail.BookingDetail.PackageUpSellData=[]))},_shopdetail.GetAddonsServiceId=function(){var t=[];return e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){void 0!==i.lstAddonService&&null!=i.lstAddonService&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e,i){t.push(e.ServiceId)})}),t.length>0?_shopdetail.BookingDetail.serviceid+","+t.join(","):_shopdetail.BookingDetail.serviceid},_shopdetail.CalculatePriceBaseGC=function(){if(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.length>0){var t=_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.uniqueObjects(["giftcertificateId"]);e.grep(t,function(t){objGC={},objGC.giftcertificateId=t.giftcertificateId,objGC.giftCertificateNo=t.giftCertificateNo,objGC.serviceId=0,objGC.uniqID=0,objGC.AppointmentID=0,objGC.Type=CheckoutBarcodeCodePrepay.GC,objGC.redeemAmt=0,objGC.GcPkgType=t.GcPkgType,e.grep(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp,function(e){t.giftcertificateId==e.giftcertificateId&&(objGC.redeemAmt=_shopdetail.parseTodecimal(objGC.redeemAmt+e.redeemAmt),objGC.GCredeemAmtForDisc=objGC.redeemAmt)}),objGC.gcAfterbalance=t.gcAfterbalance-objGC.redeemAmt,_shopdetail.BookingDetail.Prepay.RedeemedByGC.push(objGC)})}},_shopdetail.RecalculateHouseCallPrice=function(t){null==_shopdetail.BookingDetail.AppointmentDetail||void 0===IsBundle||0!=IsBundle&&null!=IsBundle||0==IsMobileServiceMandatoryInBusiness||"undefined"==typeof IsOutCallServiceSelected||1!=IsOutCallServiceSelected||(e("#hdnOutcallType").val(t),_shopdetail.SetActiveServiceLocationTab(),_shopdetail.RecalculateHouseCallPriceInside(!0))},_shopdetail.RecalculateHouseCallPriceInside=function(t){var i="",a=_shopdetail.parseTodecimal(e("#hdnOutCallPrice").val()),r=e("#hdnOutcallType").val();if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){var o=getdatepickervalue("#txtdivSearchDate",null,!0,!0);if(2==r||3==r){if(t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package)if(t.ServiceOrginalPrice=RemoveHouseCallCharges(t.spID,t.ServiceOldOrginalPrice,!0,r,t.serviceid),t.PromotionId>0){var n=GetServiceDataWithPromotion(t.serviceid,t.PromotionId,t.ServiceOrginalPrice,t.spID,!0,o);t.price=_shopdetail.parseTodecimal(n.Price)}else t.price=_shopdetail.parseTodecimal(t.ServiceOrginalPrice)}else if(t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package)if(t.ServiceOrginalPrice=RemoveHouseCallCharges(t.spID,t.ServiceOldOrginalPrice,!0,r,t.serviceid),t.PromotionId>0){n=GetServiceDataWithPromotion(t.serviceid,t.PromotionId,t.ServiceOrginalPrice,t.spID,!0,o);t.price=_shopdetail.parseTodecimal(n.Price)}else _shopdetail.parseTodecimal(t.ServiceOldOrginalPrice)==_shopdetail.parseTodecimal(t.ServiceOrginalPrice)?t.price=_shopdetail.parseTodecimal(t.ServiceOrginalPrice):t.price=_shopdetail.parseTodecimal(t.ServiceOldOrginalPrice-a);t.price,i=i+t.ServiceOrginalPrice.format("#.##")+",",e("#divPricePoint_"+t.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(t.price)),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&t.lstAddonService.reduce((e,t)=>e+t.Price,0)}),t){1==_IsPrepay&&(_shopdetail.RecalculateGCAfterPreset(!0),_shopdetail.ReApplyDiscounts());i="";e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){e.price,i=i+e.price.format("#.##")+","}),_shopdetail.BookingDetail.price=i.substring(0,i.length-1)}ShowLoader(!0);var o={};o.ServiceID=_shopdetail.BookingDetail.serviceid,o.SPID=_shopdetail.BookingDetail.spid,o.BusinessID=businessID;var n=new vagaro.ajax;n.datamodel.async=!0,n.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetPreAndPostOutForHousecall,groupID),n.datamodel.IsNewVagaroAPI=!0,n.datamodel.data=o,n.datamodel.callback=function(e){if(null!=e&&null!=e.Data&&e.Data.length>0){_shopdetail.BookingDetail.PreOutCallTime="",_shopdetail.BookingDetail.PostOutCallTime="";for(var t=0;t<e.Data.length;t++)_shopdetail.BookingDetail.PreOutCallTime+=e.Data[t].PreOutCallTime+",",_shopdetail.BookingDetail.PostOutCallTime+=e.Data[t].PostOutCallTime+",";ShowLoader(!1)}ShowLoader(!1)},n.datamodel.Error=function(e){},n.Post(),_shopdetail.BindDiscountOnItemsStrike()},_shopdetail.RemoveDealOnItem=function(t){if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(i.AppSrNo==t){i.price=i.ServiceOrginalPrice,i.priceOriginal=i.ServiceOrginalPrice,i.PromotionId=0;var a=0;if(1==i.IsMembershipApply){var r=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==i.MembershipID&&1==e.ItemType&&e.MembershipItemId==i.MembershipItemId});a=_shopdetail.parseTodecimal(i.ServiceOrginalPrice*r[0].Discount/100)}i.Discount=a,i.price=_shopdetail.parseTodecimal(i.ServiceOrginalPrice-i.Discount),e("#divPricePoint_"+i.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(i.priceOriginal)),e("#divPD_"+i.AppSrNo).html("").hide()}}),1==_IsPrepay)_shopdetail.RecalculateGCAfterPreset(!1),_shopdetail.ReApplyDiscounts();else{var i=0,a="";e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){i+=e.price,a=a+e.price.format("#.##")+","}),_shopdetail.BookingDetail.price=a.substring(0,a.length-1);var r=_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,i);e("#divServicesTotalPrice").html(r),e("#divServicesTotalPrice_mobile").html(r),e("#divServicesTotalduePrice").length>0&&e("#divServicesTotalduePrice").html(r)}},_shopdetail.RemoveAddonDealOnItem=function(t,i){if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(a){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var r=0;r<SelectedAddonService.length;r++)if(SelectedAddonService[r].MainServiceID==a.serviceid&&SelectedAddonService[r].SrNo==a.AppSrNo)for(var o=0;o<SelectedAddonService[r].lstAddonService.length;o++){var n=SelectedAddonService[r].lstAddonService[o];if(n.ServiceId==i&&a.AppSrNo==t){n.OriginalPrice=void 0!==n.priceOriginal?n.priceOriginal:n.OriginalPrice,n.Price=n.OriginalPrice,n.priceOriginal=n.OriginalPrice,n.PromotionID=0,a.lstAddonService[o].PromotionID=0,a.lstAddonService[o].Price=n.OriginalPrice;var s=0;if(1==n.IsMembershipApply){var l=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==n.MembershipID&&1==e.ItemType&&e.MembershipItemId==n.MembershipItemId});s=_shopdetail.parseTodecimal(n.OriginalPrice*l[0].Discount/100)}n.Discount=s,n.Price=_shopdetail.parseTodecimal(n.OriginalPrice-n.Discount),e("#divPricePoint_"+n.ServiceId+"_"+n.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(n.priceOriginal)),e("#divAddonPD_"+n.ServiceId+"_"+SelectedAddonService[r].SrNo).html("").hide()}}}),1==_IsPrepay)_shopdetail.RecalculateGCAfterPreset(!1),_shopdetail.ReApplyDiscounts();else{var a=0,r="",o=0;e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){a+=e.price,r=r+e.price.format("#.##")+",",!String.isNullOrUndefineOrBlank(e.lstAddonService)&&e.lstAddonService.length>0&&(o+=e.lstAddonService.reduce((e,t)=>e+t.Price,0))}),_shopdetail.BookingDetail.price=r.substring(0,r.length-1);var n=_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,a+o);e("#divServicesTotalPrice").html(n),e("#divServicesTotalPrice_mobile").html(n),e("#divServicesTotalduePrice").length>0&&e("#divServicesTotalduePrice").html(n)}},_shopdetail.RemoveDiscount=function(t,i,a){if(t==ApplyDiscoutTypePrepay.Points&&(_shopdetail.BookingDetail.TipAmount=0,e("#div_"+i).html(""),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){t.AppSrNo==i&&(t.price=t.priceOriginal,t.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,t.pointredeem=t.pointredeemOriginal,t.pointgiven=t.pointgivenOriginal,t.IsPartialPoint?(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0].pointsBalance+=t.TotalApplyPoint,t.TotalApplyPoint-=t.TotalApplyPoint,t.TotalApplyPoint=0,t.IsPartialPoint=!1):_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0].pointsBalance+=t.pointredeemOriginal,e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(t.priceOriginal)))})),t==ApplyDiscoutTypePrepay.PointsAddon&&(_shopdetail.BookingDetail.TipAmount=0,e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){null!=t.lstAddonService&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(r,o){t.AppSrNo==i&&r.ServiceId==a&&(e("#divAddonPoint_"+r.ServiceId+"_"+t.AppSrNo).html(""),r.IsPointsApply=!1,r.IsMembershipApply=!1,r.Price=r.OriginalPrice,r.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,r.pointredeem=r.pointredeemOriginal,r.pointgiven=r.pointgivenOriginal,r.IsPartialPoint?(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0].pointsBalance+=r.PointRedeem,r.IsPartialPoint=!1,r.AddonPointPrice=0):_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0].pointsBalance+=r.pointredeemOriginal,r.PointRedeem=r.pointredeemOriginal,r.PointGiven=r.pointgivenOriginal,void 0!==r.OriginalPrice&&(r.Price=r.OriginalPrice,e("#divPricePoint_"+r.ServiceId+"_"+t.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(r.OriginalPrice))))})})),t==ApplyDiscoutTypePrepay.GC&&(e("#div_"+i).html(""),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){e.AppSrNo==i&&(e.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,e.redeemAmount=0,e.redeemTax=0,e.GCDetail=[],e.GCDetailPriceBase=[],e.IsServiceBaseGC=!1)})),t==ApplyDiscoutTypePrepay.Package){var r=!1,o=!1;e("#div_"+i).html(""),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){if(t.AppSrNo==i){if(!String.isNullOrUndefineOrBlank(t.GCDetail)){t.GCDetail[0].giftcertificateId<0&&(o=!0);var a=_shopdetail.BookingDetail.Prepay.lstGCpkgList.filter(e=>e.giftCertificateID==t.GCDetail[0].giftcertificateId&&e.serviceID==t.serviceid);if(0==o&&!String.isNullOrUndefineOrBlank(a)&&-1!=a[0].quantity){if(a[0].quantity+=1,Array.isArray(filpkglist)){var n=filpkglist.filter(e=>e.giftCertificateID==t.GCDetail[0].giftcertificateId&&e.serviceName===t.servicename);String.isNullOrUndefineOrBlank(n)||-1==n[0].quantity||(n[0].quantity+=1)}var s=_shopdetail.BookingDetail.Prepay.lstGCpkgList.filter(e=>e.giftCertificateID==t.GCDetail[0].giftcertificateId&&null==e.serviceID);if(!String.isNullOrUndefineOrBlank(s)&&(s[0].quantity+=1,s[0].currentBalance+=t.GCDetail[0].redeemAmt,Array.isArray(filpkglist))){var l=filpkglist.filter(e=>e.giftCertificateID==t.GCDetail[0].giftcertificateId&&null==e.serviceID);String.isNullOrUndefineOrBlank(l)||(l[0].quantity+=1)}}}t.price=t.priceOriginal,t.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,t.redeemAmount=0,t.redeemTax=0,t.GCDetail=[],t.GCDetailPriceBase=[],t.redeemID=0,t.pointredeem=t.pointredeemOriginal,t.pointgiven=t.pointgivenOriginal,t.strAdvanceLimitDate="",t.AppliedName="",e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(t.priceOriginal))}else t.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package&&(r=!0)}),0==r&&1==o&&_shopdetail.RemoveMembershipUpSellDiscount(2)}if(3==t){e("#divMem_"+i).html("");var n=!1;e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){if(t.AppSrNo==i){if(null!=t.GCDetailPriceBase&&t.GCDetailPriceBase.length>0&&e.grep(t.GCDetailPriceBase,function(e){if(e.GcPkgType=2){var t=_shopdetail.BookingDetail.Prepay.lstGCpkgList.filter(t=>t.giftCertificateID==e.giftcertificateId&&null==t.serviceID&&t.giftCertificateNo==e.giftCertificateNo);String.isNullOrUndefineOrBlank(t)||(t[0].quantity+=1,t[0].currentBalance+=e.redeemAmt)}}),1==t.IsMembershipApply&&!String.isNullOrUndefineOrBlank(t.MembershipID)&&t.MembershipID>0){var a=_shopdetail.BookingDetail.Prepay.lstMembership.filter(e=>e.MembershipID==t.MembershipID&&e.MembershipItemId==t.MembershipItemId);String.isNullOrUndefineOrBlank(a)||-1==a[0].VisitRemaining||(a[0].VisitRemaining+=1,_shopdetail.SyncMembershipVisitRemaining(_shopdetail.BookingDetail.Prepay.lstMembership,a[0]))}if(t.price=t.priceOriginal,t.IsMembershipApply=!1,t.membershipDiscount=0,t.membershipDiscount=0,t.GCDetailPriceBase=[],t.pointredeem=t.pointredeemOriginal,t.pointgiven=t.pointgivenOriginal,t.Discount=0,t.strAdvanceLimitDate="",t.AppliedName="",null!=t.isPresetApply&&1==t.isPresetApply){var r=0;0==t.IsAmount?(pdisc=_onlineCheckout.parseTodecimal(t.ServiceOrginalPrice*t.AmountValue/100,2),r=_onlineCheckout.parseTodecimal(r+_onlineCheckout.parseTodecimal(t.ServiceOrginalPrice*t.AmountValue/100,2),2)):(pdisc=t.ServiceOrginalPrice,r=t.ServiceOrginalPrice<r+t.AmountValue?t.ServiceOrginalPrice:_onlineCheckout.parseTodecimal(r+t.AmountValue,2)),t.ServiceOrginalPrice<r&&(pdisc=t.ServiceOrginalPrice,r=t.ServiceOrginalPrice),t.Discount=r,t.price=_shopdetail.parseTodecimal(t.ServiceOrginalPrice-t.Discount)}t.Visit=0,t.VisitRemaining=void 0,e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(t.priceOriginal)),t.paidType==arrpaidType.Deposits&&_shopdetail.calculateDepositsPrepay(t),_shopdetail.RecalculateGCAfterPreset(!1)}else 1==t.IsMembershipApply&&(n=!0)}),0==n&&Array.isArray(_shopdetail.BookingDetail.AppointmentDetail)&&(n=_shopdetail.BookingDetail.AppointmentDetail.some(function(e){return!!e&&(1==e.IsMembershipApply||Array.isArray(e.lstAddonService)&&e.lstAddonService.some(function(e){return e&&1==e.IsMembershipApply}))})),0==n&&_shopdetail.RemoveMembershipUpSellDiscount(1)}if(t==ApplyDiscoutTypePrepay.OutsideBiling&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){t.AppSrNo==i&&(t.strAdvanceLimitDate="",1==t.IsPackageApplied&&null!=_shopdetail.BookingDetail.Prepay.lstMembership&&_shopdetail.BookingDetail.Prepay.lstMembership.length>0&&e.each(_shopdetail.BookingDetail.Prepay.lstMembership,function(e,i){i.ServiceProductName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&new Date(moment(i.strValidUpto).format("YYYY/MM/DD"))<new Date(t.appBookingDate)&&null!=i.strAdvanceLimitDate&&""!=i.strAdvanceLimitDate&&new Date(moment(i.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(t.appBookingDate)&&null!=i.strAdvanceLimitDate&&""!=i.strAdvanceLimitDate&&(t.strAdvanceLimitDate=i.strAdvanceLimitDate,t.IsPackageApplied=!1,t.AppliedName=i.MembershipName)}),e("#divMem_"+i).html(""),t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&1!=t.IsServiceBaseGC&&(t.price>=_shopdetail.BookingDetail.DepositsLimit?(_shopdetail.calculateDepositsPrepay(t),null!=t.strAdvanceLimitDate&&""!=t.strAdvanceLimitDate&&new Date(moment(t.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(t.appBookingDate)&&t.paidType==arrpaidType.UnPaid&&_shopdetail.BindDiscountOnItems(!1,t.AppSrNo,!1,!1,0,!1,0,!1,t.AppliedName,!0)):0==t.price&&(1==t.IsMembershipApply||t.Discount>0)?t.paidType=arrpaidType.Paid:1==t.IsMembershipApply?t.paidType=arrpaidType.PartiallyPaid:0==t.Discount&&(t.paidType=arrpaidType.UnPaid)),t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&(_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+t.price+_shopdetail.parseTodecimal(t.Tax)),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+t.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+t.Tax,3),t.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+t.depositsPaid),_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(t.price-t.depositsPaid)+_shopdetail.parseTodecimal(t.Tax)),_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+t.depositsPaid-t.redeemAmount),t.Tax=0):t.paidType==arrpaidType.UnPaid||t.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(t.price-t.depositsPaid)+_shopdetail.parseTodecimal(t.Tax)),t.Tax=0):t.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(t.price+_shopdetail.parseTodecimal(t.Tax))-(t.redeemAmount+t.redeemTax))),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+t.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+t.Tax,3),_shopdetail.BookingDetail.Prepay.TotalDiscount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.TotalDiscount+t.Discount),_shopdetail.BookingDetail.Prepay.VisitRemaining=t.VisitRemaining,_shopdetail.BookingDetail.Prepay.Visit=t.Visit))}),t==ApplyDiscoutTypePrepay.ServcieMembershipAddon){n=!1;e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){t.AppSrNo==i?null!=t.lstAddonService&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(r,o){if(r.ServiceId==a&&i==t.AppSrNo){if(1==r.IsMembershipApply&&!String.isNullOrUndefineOrBlank(r.MembershipID)&&r.MembershipID>0){var n=_shopdetail.BookingDetail.Prepay.lstMembership.filter(e=>e.MembershipID==r.MembershipID&&e.MembershipItemId==r.MembershipItemId);String.isNullOrUndefineOrBlank(n)||-1==n[0].VisitRemaining||(n[0].VisitRemaining+=1,_shopdetail.SyncMembershipVisitRemaining(_shopdetail.BookingDetail.Prepay.lstMembership,n[0]))}e("#divAddonMem_"+r.ServiceId+"_"+t.AppSrNo).html(""),r.IsMembershipApply=!1,r.pointredeem=r.pointredeemOriginal,r.pointgiven=r.pointgivenOriginal,r.Discount=0,r.membershipDiscount=0,r.strAdvanceLimitDate="",r.AppliedName="",r.Visit=0,r.VisitRemaining=0,_shopdetail.RecalculateGCAfterPreset(!1),void 0!==r.priceOriginal&&(void 0!==r.PromotionID&&null!=r.PromotionID&&r.PromotionID>0&&void 0!==r.NewPrice&&r.NewPrice>0?r.Price=r.NewPrice:r.Price=r.priceOriginal,e("#divPricePoint_"+r.ServiceId+"_"+t.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(r.priceOriginal))),r.paidType==arrpaidType.Deposits&&_shopdetail.calculateDepositsPrepayforAddons(r)}}):1==t.IsMembershipApply&&(n=!0)})}t==ApplyDiscoutTypePrepay.ServciePackageAddon&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){t.AppSrNo==i&&null!=t.lstAddonService&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(r,o){if(r.ServiceId==a&&i==t.AppSrNo&&(r.IsMembershipApply=!1,void 0!==r.priceOriginal)){if(!String.isNullOrUndefineOrBlank(r.GCDetail)){var n=_shopdetail.BookingDetail.Prepay.lstGCpkgList.filter(e=>e.giftCertificateID==r.GCDetail[0].giftcertificateId&&e.serviceID==a);String.isNullOrUndefineOrBlank(n)||-1==n[0].quantity||(n[0].quantity+=1)}e("#divAddonPack_"+r.ServiceId+"_"+t.AppSrNo).html(""),void 0!==r.PromotionID&&null!=r.PromotionID&&r.PromotionID>0&&void 0!==r.NewPrice&&r.NewPrice>0?r.Price=r.price=r.NewPrice:r.Price=r.price=r.priceOriginal,r.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,r.redeemAmount=0,r.redeemTax=0,r.GCDetail=[],r.GCDetailPriceBase=[],r.redeemID=0,r.pointredeem=t.pointredeemOriginal,r.pointgiven=t.pointgivenOriginal,r.strAdvanceLimitDate="",r.AppliedName="",e("#divPricePoint_"+r.ServiceId+"_"+t.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(r.priceOriginal))}})}),_shopdetail.IsVCFFeeApplied()&&_shopdetail.RemoveVCFFee(),_shopdetail.ReApplyDiscounts(),_shopdetail.ShowTipOptionsButton(),_shopdetail.ValidateOnePerUserDeal(!1),_shopdetail.ValidateAddOnPerUserDeal(!1),_shopdetail.ValidateVPl(!0),_shopdetail.IsVCFEnable()&&_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.RemoveDiscount),null!=_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay&&0!=_shopdetail.BookingDetail.Prepay.depositsAmount?(totalDueAmt=e("#divServicesTotalPrice")[0].innerHTML.replace("$","")-_shopdetail.BookingDetail.Prepay.depositsAmount,FinalCCAmount=totalDueAmt,e("#VplAmount")[0].innerHTML=_shopdetail.currencySymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)):null!=_shopdetail.BookingDetail.Prepay.gcAmt&&null!=_shopdetail.BookingDetail.Prepay.gcAmt&&0!=_shopdetail.BookingDetail.Prepay.gcAmt?(totalDueAmt=e("#divServicesTotalPrice")[0].innerHTML.replace("$","")-_shopdetail.BookingDetail.Prepay.gcAmt,FinalCCAmount=totalDueAmt,e("#VplAmount")[0].innerHTML=_shopdetail.currencySymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)):(FinalCCAmount=e("#VplAmount")[0].innerHTML.replace(_shopdetail.BookingDetail.CurrencySymbol,""),e("#VplAmount")[0].innerHTML=e("#divServicesTotalPrice")[0].innerHTML),FinalCCAmount<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount&&FinalCCAmount>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&"Free"==e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&e("#divVplTracking").hide(),e("#VplAmount").length>0&&(e("#VplAmount")[0].innerHTML=_shopdetail.currencySymbol+_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!0,2)),1==e("#tabVagaroPayLater").hasClass("w--current")&&FinalCCAmount>0&&_vgVPLOnline.PaymentSchedule(FinalCCAmount,_shopdetail.PaymentSchduleSuccess,_shopdetail.PaymentSchdulefail),_shopdetail.vplamt=FinalCCAmount,_shopdetail.VPLMessage(_shopdetail.vplamt)},_shopdetail.OpenGoogleApplePaymentInfoPopup=function(e,t,i){paymentOpenPopup(e==PaymentMethod.GooglePay?"gpay":"applepay",i,1==t?_onlineCheckout.GPayApplePaySuccessResponse:_shopdetail.GPayApplePaySuccessResponse,_siteBuilderDetail.PaymentErrorHandler)},_shopdetail.GPayApplePaySuccessResponse=function(t){console.log(t);var i={},a={};a.PaymentToken=1==e(_shopdetail.Controls.tabGooglePay).hasClass("w--current")?""+t:btoa(JSON.stringify(t.token.paymentData)),a.PaymentMethodType=1==e(_shopdetail.Controls.tabGooglePay).hasClass("w--current")?PaymentMethod.GooglePay:PaymentMethod.ApplePay,a.LoginUserId=UserID.toString(),a.MerchantToken=_shopdetail.MerchantTokenID,a.SaveCard=!0,a.Device="Online Checkout",i.paymentInfo=[a],i.successCallback=_shopdetail.SuccessGoogleAppleTokenInfo,i.FailCallback=_shopdetail.FailGoogleAppleTokenInfo,_shopdetail.SaveGoogleAppleToken(i)},_shopdetail.SuccessGoogleAppleTokenInfo=function(e){null!=e?(console.log(e),1!=e.IsSuccess||String.isNullOrUndefineOrBlank(e.card_token)?_shopdetail.FailGoogleAppleTokenInfo(e):(_shopdetail.SetGoogleApplePayCardInfo(e,!0),_shopdetail.ProceedforBooking("bookwithcc"))):_shopdetail.FailGoogleAppleTokenInfo()},_shopdetail.FailGoogleAppleTokenInfo=function(e){let t="Payment could not be completed.";if(e)if(5006===e.custom_code)t="The card entered is invalid or got declined, Please contact business or try another card.";else if(6001===e.custom_code)t=e.subResponseCode+" - "+e.subResponseMessage;else if(e.message&&""!==e.message.trim()){let i="";e.subResponseCode&&""!==e.subResponseCode.trim()&&(i="<br/>Error Code: "+e.paymentGateway+"-"+e.subResponseCode),t=e.message+i}else e.subResponseCode&&""!==e.subResponseCode.trim()&&(errorCode="<br/>Error Code: "+e.paymentGateway+"-"+e.subResponseCode);else t="Some error occured, Please try again!. ErrorCode: 1008";_siteBuilderDetail.PaymentErrorHandler(t)},_shopdetail.SaveGoogleAppleToken=function(e){ShowLoader(!0);var t=new vagaro.ajax;t.datamodel.Token="AddGoogleApplePayCardToken",t.datamodel.callback=e.successCallback,t.datamodel.data=e.paymentInfo,t.datamodel.async=!1,t.datamodel.Error=e.FailCallback,t.Post()},_shopdetail.ResetVPLPaymentMethod=function(t,i){1==e("#tabVagaroPayLater").is(":visible")&&(1==i&&(1==t?e("#tabCheckoutBooking2").click():e("#tabBooking2").click()),e("#tabVagaroPayLater").hide(),e("#tabVagaroPayLater").removeClass("w--current")),_onlineCheckout.isCheckoutVPLChanged=!1,_onlineCheckout.IsVplChanged=!1},_shopdetail.ResetDiscount=function(){e("#divServices").find("div.service-div-checkout").each(function(){var t=e(this).find("div.discount").eq(0).attr("id");e(t).html("");var i="",a=t.split("_");i=void 0!==a&&a.length>2?a[2]:a[1],e("#div_"+i).html(""),e("#divMem_"+i).html(""),e("#divPD_"+i).html(""),e('div[id^="divAddonMem_"]').html(""),e('div[id^="divAddonPack_"]').html(""),e('div[id^="divAddonPoint_"]').html(""),_shopdetail.RemoveMembershipUpSellDiscount(3),1!=_IsPrepay||void 0!==_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay||(_shopdetail.BookingDetail.Prepay={},_shopdetail.BookingDetail.Prepay.lstGCpkgList=[],_shopdetail.BookingDetail.Prepay.lstServiceDetails=[]),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){t.AppSrNo==i&&(t.price=t.priceOriginal,t.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,t.pointredeem=t.pointredeemOriginal,t.pointgiven=t.pointgivenOriginal,t.redeemAmount=0,t.redeemTax=0,t.GCDetail=[],t.GCDetailPriceBase=[],t.IsServiceBaseGC=!1,t.redeemID=0,t.Tax=0,t.IsMembershipApply=!1,t.Discount=0,t.Visit=0,t.VisitRemaining=void 0,t.paidType=arrpaidType.UnPaid,t.DiscountID=0,t.depositsPaid=0,t.depositsPercentage=0,t.IsPartialPoint=!1,_shopdetail.ResetAddonsItemsDiscounts(t),_shopdetail.RecalculateGCAfterPreset(),e("#divPricePoint_"+i).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(t.priceOriginal)))})}),_shopdetail.ReApplyDiscounts()},_shopdetail.ResetAddonsItemsDiscounts=function(t){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var i=0;i<SelectedAddonService.length;i++)if(SelectedAddonService[i].MainServiceID==t.serviceid&&SelectedAddonService[i].SrNo==t.AppSrNo)for(var a=0;a<SelectedAddonService[i].lstAddonService.length;a++){var r=SelectedAddonService[i].lstAddonService[a];void 0!==r.PromotionID&&null!=r.PromotionID&&r.PromotionID>0&&void 0!==r.NewPrice&&r.NewPrice>0?r.price=r.Price=r.NewPrice:r.price=r.Price=r.priceOriginal,r.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,r.pointredeem=r.pointredeemOriginal,r.pointgiven=r.pointgivenOriginal,r.redeemAmount=0,r.redeemTax=0,r.GCDetail=[],r.GCDetailPriceBase=[],r.IsServiceBaseGC=!1,r.redeemID=0,r.Tax=0,r.IsMembershipApply=!1,r.Discount=0,r.Visit=0,r.VisitRemaining=void 0,r.paidType=arrpaidType.UnPaid,r.DiscountID=0,r.depositsPaid=0,r.depositsPercentage=0,r.IsPartialPoint=!1,r.membershipDiscount=0,e("#divPricePoint_"+r.ServiceId+"_"+t.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(r.priceOriginal))}},_shopdetail.ReApplyDiscounts=function(){_shopdetail.IsFinalGCCalculation=!0,_shopdetail.BookingDetail.Prepay.ccAmt=0,_shopdetail.BookingDetail.Prepay.amtPaid=0,_shopdetail.BookingDetail.Prepay.tax=0,_shopdetail.BookingDetail.Prepay.Rtax=0,_shopdetail.BookingDetail.Prepay.taxdifference=0,_shopdetail.BookingDetail.Prepay.gcAmt=0,_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=[],_shopdetail.BookingDetail.Prepay.RedeemedByGC=[],_shopdetail.BookingDetail.Prepay.PackageAmt=0,_shopdetail.BookingDetail.Prepay.TotalDiscount=0,_shopdetail.BookingDetail.Prepay.VisitRemaining=0,_shopdetail.BookingDetail.Prepay.Visit=0,_shopdetail.BookingDetail.Prepay.depositsAmount=0,_shopdetail.BookingDetail.Prepay.depositsRemaining=0,_shopdetail.BookingDetail.Prepay.displayTax=0,_shopdetail.BookingDetail.Prepay.RdisplayTax=0;var t=_shopdetail.GetTotalAmountforDeposits(),i=_shopdetail.IsDailyDealsAppliedInItem();e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(a){if(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&!a.IsPartialPoint||a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||1==a.IsServiceBaseGC||(t>=_shopdetail.BookingDetail.DepositsLimit||i?(0==_shopdetail.BookingDetail.DepositAmtType&&100!=_shopdetail.BookingDetail.DepositsPer||1==_shopdetail.BookingDetail.DepositAmtType&&_shopdetail.BookingDetail.DepositsPer<a.price)&&a.price>0?(_shopdetail.calculateDepositsPrepay(a),null!=a.strAdvanceLimitDate&&""!=a.strAdvanceLimitDate&&new Date(moment(a.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(a.appBookingDate)&&a.paidType==arrpaidType.UnPaid&&_shopdetail.BindDiscountOnItems(!1,a.AppSrNo,!1,!1,0,!1,0,!1,a.AppliedName,!0)):0==a.price&&0==a.Discount?a.paidType=arrpaidType.UnPaid:a.paidType=arrpaidType.Paid:(0==a.price&&(1==a.IsMembershipApply||a.Discount>0)?a.paidType=arrpaidType.Paid:1==a.IsMembershipApply?a.paidType=arrpaidType.PartiallyPaid:0==a.Discount&&(a.paidType=arrpaidType.UnPaid),a.depositsPaid=0,a.depositsPercentage=0,a.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC&&1!=a.IsServiceBaseGC&&(e("#div_"+a.AppSrNo).html(""),a.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,a.redeemAmount=0,a.redeemTax=0,a.GCDetail=[],a.GCDetailPriceBase=[],a.IsServiceBaseGC=!1))),_shopdetail.CalculateTax(a,_shopdetail.BookingDetail.Prepay.lstServiceDetails),(String.isNullOrUndefineOrBlank(a.Tax)||0==a.Tax)&&(a.BusinessTax=[]),a.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){if(null!=a.GCDetail&&a.GCDetail.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGC=_shopdetail.BookingDetail.Prepay.RedeemedByGC.concat(a.GCDetail)),null!=a.GCDetailPriceBase&&a.GCDetailPriceBase.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.concat(a.GCDetailPriceBase)),_shopdetail.CheckPriceWithTaxSwitch()&&null!=a.BusinessTax&&a.BusinessTax.length>0&&"431131"==_shopdetail.businessID){var r=a.BusinessTax.reduce((e,t)=>e+t.Tax,0);let e=CalAccPriceWithTax(a.price,r,_shopdetail.businessID);_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+e)}else _shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+a.price+_shopdetail.parseTodecimal(a.Tax));_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+a.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+a.Tax,3),a.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+a.depositsPaid),_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(a.price-_shopdetail.parseTodecimal(a.depositsPaid))+_shopdetail.parseTodecimal(a.Tax)),_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.parseTodecimal(a.depositsPaid)-a.redeemAmount),a.Tax=0):a.paidType==arrpaidType.UnPaid||a.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(a.price-_shopdetail.parseTodecimal(a.depositsPaid))+_shopdetail.parseTodecimal(a.Tax)),a.Tax=0):a.paidType==arrpaidType.Paid&&(void 0!==a.IsPartialPoint&&1==a.IsPartialPoint?_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(a.PartialPrice+_shopdetail.parseTodecimal(a.Tax))-(a.redeemAmount+a.redeemTax)):_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(a.price+_shopdetail.parseTodecimal(a.Tax))-(a.redeemAmount+a.redeemTax))),a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?_shopdetail.BookingDetail.Prepay.PackageAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.PackageAmt+a.redeemAmount):_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+a.redeemAmount+a.redeemTax),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+a.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+a.Tax,3),_shopdetail.BookingDetail.Prepay.TotalDiscount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.TotalDiscount+a.Discount)}a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&a.IsPartialPoint&&(_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+a.Tax),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+a.Tax,3),a.paidType==arrpaidType.Paid?_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+a.PartialPrice+_shopdetail.parseTodecimal(a.Tax)):_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+a.price+_shopdetail.parseTodecimal(a.Tax)),a.paidType==arrpaidType.Deposits?(_shopdetail.BookingDetail.Prepay.depositsAmount=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsAmount+a.depositsPaid),a.IsDepositsOver?_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(a.price-a.depositsPaid)+_shopdetail.parseTodecimal(a.Tax)):_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(a.price-a.depositsPaid)+_shopdetail.parseTodecimal(a.Tax)-a.PointPrice),a.IsAmountPaid&&a.IsDepositsOver?_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+0):_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+a.depositsPaid-a.redeemAmount),a.Tax=0):a.paidType==arrpaidType.UnPaid||a.paidType==arrpaidType.PartiallyPaid?(_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+(a.price-a.depositsPaid)+_shopdetail.parseTodecimal(a.Tax)),a.Tax=0):a.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+(a.PartialPrice+_shopdetail.parseTodecimal(a.Tax))-(a.redeemAmount+a.redeemTax))),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+a.Tax),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.ConvertTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+a.Tax,3))}),_shopdetail.CalculateApptAddons(!0,null),_shopdetail.ApplyServiceFee(0,"1"),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&_shopdetail.ApplyServiceFee(0,"7"),_shopdetail.ApplyFeesValue(!1),String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.FeeDetails)&&(_shopdetail.BookingDetail.FeeDetails=[]),e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){null!=e.GCDetailPriceBase&&e.GCDetailPriceBase.length>0&&(_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp.concat(e.GCDetailPriceBase)),_shopdetail.BookingDetail.Prepay.gcAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.gcAmt+e.redeemAmount+e.redeemTax)}),_shopdetail.ApplyMembershipUpSell(null,!1),_shopdetail.ApplyPackageUpSell(null,!1),_shopdetail.CalculatePriceBaseGC(),_shopdetail.CalculateTaxForPenny(),_shopdetail.ApplyDailyDealFeeToItems();try{i&&"function"==typeof _shopdetail.isDailyDealExistsInItems&&_shopdetail.isDailyDealExistsInItems()&&(e("#divGiftCertificate").hide(),e("#divCheckoutBookingPromoCodeService").hide())}catch(e){}if(i){var a=_shopdetail?.BookingDetail?.AppointmentDetail||[];if(!_shopdetail?.BookingDetail?.Prepay||!Array.isArray(a))return;var r=0;if(a.forEach(function(e){if(e){var t=Number(e.DailyDealFee||0);!isNaN(t)&&t>0&&(r+=t),(Array.isArray(e.lstAddonService)?e.lstAddonService:[]).forEach(function(e){if(e){var t=Number(e.DailyDealFee||0);!isNaN(t)&&t>0&&(r+=t)}})}}),(r=_shopdetail.parseTodecimal(r||0))>0&&_shopdetail.BookingDetail.Prepay.ccAmt<r){_shopdetail.BookingDetail.Prepay.ccAmt=r,_shopdetail.BookingDetail.Prepay.depositsAmount=r;var o=Number(_shopdetail.BookingDetail.Prepay.amtPaid||0);isNaN(o)&&(o=0),o=_shopdetail.parseTodecimal(o),_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(Math.max(o-r,0)),a.forEach(function(e){e&&(e.depositsPaid=Number(e.DailyDealFee||0),(Array.isArray(e.lstAddonService)?e.lstAddonService:[]).forEach(function(e){e&&(e.depositsPaid=Number(e.DailyDealFee||0))}))})}}_shopdetail.DisplayDiscountOnAppointment(),1==_shopdetail.isResetTip&&(_shopdetail.ShowTipOptionsButton(),null!=IsnotfullyPrePay&&1==IsnotfullyPrePay&&_shopdetail.ShowTipOptionsButton())},_shopdetail.ApplyPackageOnAppointment=function(t,i,a){null!=i&&i.length>0&&e.grep(i,function(r){String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout)&&0==_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.isPrePay&&!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew)&&(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout=_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew);var o=_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout.find(e=>e.ServiceID==t.serviceid);if(r.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&r.ParentCategoryName.toLowerCase().trim()==o.ParentServiceTitle.toLowerCase().trim()&&new Date(moment(r.strValidUpto).format("YYYY/MM/DD"))<new Date(t.appBookingDate)&&null!=r.strAdvanceLimitDate&&""!=r.strAdvanceLimitDate&&new Date(moment(r.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(t.appBookingDate)&&(t.strAdvanceLimitDate=r.strAdvanceLimitDate,t.IsPackageApplied=!0,t.AppliedName=r.pkgName),r.serviceName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&r.ParentCategoryName.toLowerCase().trim()==o.ParentServiceTitle.toLowerCase().trim()&&(r.quantity>0||1==r.isCustomPackage&&-1==r.quantity)&&t.ServiceOrginalPrice>0&&(null==r.strValidUpto||""==r.strValidUpto||null!=r.strValidUpto&&""!=r.strValidUpto&&new Date(moment(r.strValidUpto).format("YYYY/MM/DD"))>=new Date(t.appBookingDate))){var n,s=0,l=[];if(t.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount)1==r.isCustomPackage?l=e.grep(i,function(e){if(1==e.isCustomPackage&&null==e.serviceID&&e.giftCertificateID==r.giftCertificateID)return s=0==e.quantity?0:Math.floor(_shopdetail.parseTodecimal(e.currentBalance/e.quantity*100))/100,!0}):s=Math.floor(_shopdetail.parseTodecimal(r.currentBalance/r.quantity*100))/100,-1==r.quantity&&(s=0),objGC={},objGC.giftcertificateId=r.giftCertificateID,objGC.giftCertificateNo=r.giftCertificateNo,objGC.serviceId=t.serviceid,objGC.uniqID=t.AppSrNo,objGC.AppointmentID=0,objGC.Type=CheckoutBarcodeCodePrepay.Pkg,objGC.GCredeemAmtForDisc=0,objGC.redeemAmt=s,e.each(filpkglist,function(i,a){a.giftCertificateID==r.giftCertificateID&&a.serviceName===t.servicename&&(n=a.quantity,e.each(filpkglist,function(e,i){1==i.isCustomPackage?i.giftCertificateID==r.giftCertificateID&&""===i.serviceName&&(i.quantity=-1==i.quantity?-1:-1==n?i.quantity:i.quantity-1,n=i.quantity-i.TotalPKGUnlimitedCount):i.giftCertificateID==r.giftCertificateID&&i.serviceName===t.servicename&&(i.quantity=-1==i.quantity?-1:i.quantity-1,n=i.quantity)}))}),objGC.GcPkgType=3,objGC.gcAfterbalance=n,1==r.isCustomPackage&&void 0!==r.serviceID&&r.serviceID>0&&(objGC.RedeemServiceId=r.serviceID),_shopdetail.BookingDetail.Prepay.RedeemedByGC.push(objGC),1==r.isCustomPackage?(null!=r.groupID&&0!=r.groupID&&-1!=r.quantity?e.grep(i,function(e){e.giftCertificateID==r.giftCertificateID&&e.groupID==r.groupID&&(e.quantity=e.quantity-1)}):null==r.groupID&&-1!=r.quantity&&(r.quantity=r.quantity-1),l.length>0&&-1!=r.quantity&&(l[0].currentBalance=_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(l[0].currentBalance)-s),l[0].quantity=l[0].quantity-1)):(r.currentBalance=_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(r.currentBalance)-s),r.quantity=r.quantity-1),_shopdetail.BindDiscountOnItems(!1,t.AppSrNo,!1,!0,s,!1,0,!1,r.pkgName),t.redeemID=r.giftCertificateID,t.ApplyDiscoutType=ApplyDiscoutTypePrepay.Package,t.pointgiven=0,t.pointredeem=0,t.price=s,t.GCDetail.push(objGC),t.redeemAmount=s,_shopdetail.BookingDetail.Prepay.PackageAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.PackageAmt+s),String.isNullOrUndefineOrBlank(a)||1!=a||(t.depositsPaid=0,t.depositsPercentage=0,t.paidType=arrpaidType.Paid,_shopdetail.ReApplyDiscounts())}})},_shopdetail.GetMembershipDiscountAmount=function(e,t){var i=0;return 1==t.isAmountValue||1==t.IsAmountValue?(i=_shopdetail.parseTodecimal(t.Discount))>_shopdetail.parseTodecimal(e)&&(i=_shopdetail.parseTodecimal(e)):i=_shopdetail.parseTodecimal(e*t.Discount/100),i},_shopdetail.GetMembershipParentGroupId=function(e){var t=null!=e.parentGroupId?e.parentGroupId:e.ParentGroupId;return String.isNullOrUndefineOrBlank(t)?0:Number(t)},_shopdetail.SyncMembershipVisitRemaining=function(t,i){var a=_shopdetail.GetMembershipParentGroupId(i),r=e.grep(t,function(e){return e!==i&&i.BusinessID==e.BusinessID&&(a>0?i.MembershipID==e.MembershipID&&a==_shopdetail.GetMembershipParentGroupId(e):0!=i.GroupId&&i.GroupId==e.GroupId&&i.ServiceProductName.toLowerCase().trim()!=e.ServiceProductName.toLowerCase().trim())});e.each(r,function(e,t){t.VisitRemaining=i.VisitRemaining})},_shopdetail.ApplyMembershipOnAppointment=function(t,i){null!=i&&i.length>0&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&e.each(i,function(e,i){String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout)&&0==_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.isPrePay&&!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew)&&(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout=_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckoutNew);var a=_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout.find(e=>e.ServiceID==t.serviceid);if(i.ServiceProductName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&i.ParentCategoryName.toLowerCase().trim()==a.ParentServiceTitle.toLowerCase().trim()&&new Date(moment(i.strValidUpto).format("YYYY/MM/DD"))<new Date(t.appBookingDate)&&null!=i.strAdvanceLimitDate&&""!=i.strAdvanceLimitDate&&new Date(moment(i.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(t.appBookingDate)&&(null==i.strAdvanceLimitDate||""==i.strAdvanceLimitDate||void 0!==t.AppliedName&&""!=t.AppliedName||1==t.IsPackageApplied||(t.strAdvanceLimitDate=i.strAdvanceLimitDate,t.IsPackageApplied=!1,t.AppliedName=i.MembershipName)),(i.VisitRemaining>0||-1==i.VisitRemaining)&&i.ServiceProductName.toLowerCase().trim()==t.servicename.toLowerCase().trim()&&i.ParentCategoryName.toLowerCase().trim()==a.ParentServiceTitle.toLowerCase().trim()&&t.ServiceOrginalPrice>0&&(0==t.PromotionId||1==i.isPromotionalDiscount&&0!=t.PromotionId)&&(null==i.strValidUpto||""==i.strValidUpto||null!=i.strValidUpto&&""!=i.strValidUpto&&new Date(moment(i.strValidUpto).format("YYYY/MM/DD"))>=new Date(t.appBookingDate))){var r=_shopdetail.GetMembershipDiscountAmount(t.ServiceOrginalPrice,i);t.price<r&&(r=t.price),t.Discount=r,t.membershipDiscount=r,t.price=_shopdetail.parseTodecimal(t.price-t.Discount),i.VisitRemaining=-1==i.VisitRemaining?i.VisitRemaining:i.VisitRemaining-1,t.VisitRemaining=i.VisitRemaining,t.Visit=i.Visit,t.IsMembershipApply=!0,t.RedeemBusinessId=i.BusinessID,t.MembershipID=i.MembershipID,t.UserID=i.UserID,t.MembershipItemId=i.MembershipItemId,t.GroupId=i.GroupId,t.IsAllowPreSetDiscount=i.IsAllowPreSetDiscount,_shopdetail.SyncMembershipVisitRemaining(_shopdetail.BookingDetail.Prepay.lstMembership,i),_shopdetail.BindDiscountOnItems(!1,t.AppSrNo,!1,!1,0,!0,t.priceOriginal,!1,i.MembershipName);try{t.priceOriginal==t.membershipDiscount&&(t.pointgiven=0)}catch(e){}return!1}})},_shopdetail.parseTodecimal=function(e){return _vgClassSessionSelection.ConvertTodecimal(e,2,!0)},_shopdetail.ConvertTodecimalUsingSubString=function(e,t){isNaN(parseFloat(e))&&(e=0);return",249272,265329,288943,278656,292923,".indexOf(","+_shopdetail.businessID+",")>-1?parseFloat(e.toString().substr(0,e.toString().indexOf(".")+3)):_vgClassSessionSelection.ConvertTodecimal(e,t,!0)},_shopdetail.ConvertTodecimal=function(e,t){return _vgClassSessionSelection.ConvertTodecimal(e,t,!0)},_shopdetail.CalculateTax=function(t,i){if(null==i&&(i=[]),t.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||t.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&!t.IsPartialPoint)t.Tax=0;else{var a=e.grep(i,function(e,i){return e.ServiceID==t.serviceid});if(a.length>0){if(a.length>1)for(var r=0;r<a.length;r++){_shopdetail.ApplyMultipleTax(1==t.IsPartialPoint?t.PartialPrice:t.price,a[r]);var o=0;null!=a[r].BusinessTax&&a[r].BusinessTax.forEach(e=>{null!=e.Tax&&(o+=e.Tax)}),t.Tax=_vgClassSessionSelection.ConvertTodecimal(1==t.IsPartialPoint?t.PartialPrice:t.price*o/100,3,!0),t.BusinessTax=a[r].BusinessTax}else _shopdetail.ApplyMultipleTax(t.price,a[0]);o=0;if(null!=a[0].BusinessTax&&a[0].BusinessTax.forEach(e=>{null!=e.Tax&&(o+=e.Tax)}),t.IsPartialPoint)t.Tax=_vgClassSessionSelection.ConvertTodecimal(t.PartialPrice*o/100,3,!0),t.BusinessTax=a[0].BusinessTax,t.BusinessTax=_shopdetail.ApplyMultipleTax(t.PartialPrice,t);else{if(_shopdetail.CheckPriceWithTaxSwitch()&&"431131"==_shopdetail.businessID){var n=t.price*o/100;t.Tax=_shopdetail.parseTodecimal(n)}else t.Tax=_vgClassSessionSelection.ConvertTodecimal(t.price*o/100,2,!0);t.BusinessTax=a[0].BusinessTax}}}},_shopdetail.decimalFormate=function(e){return parseFloat(Math.round(100*e)/100).toFixed(2)},_shopdetail.DisplayAmountOnCart=function(e,t){var i=parseFloat(Math.round(100*parseFloat(t))/100);return i>0?e+i.toFixed(2):"Free"},_shopdetail.findUnique=function(e,t){var i={};return e.forEach(e=>{i[t(e)]=e}),Object.keys(i).map(e=>i[e])},_shopdetail.CheckOutRequest=function(t){checkoutRequest={},checkoutRequest.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax),checkoutRequest.payeeId=t[0].UserID,checkoutRequest.gcAmt=_shopdetail.BookingDetail.Prepay.gcAmt,checkoutRequest.ccAmt=_shopdetail.BookingDetail.Prepay.ccAmt,checkoutRequest.discount=_shopdetail.BookingDetail.Prepay.TotalDiscount,checkoutRequest.amtPaid=_shopdetail.BookingDetail.Prepay.amtPaid,checkoutRequest.businessID=t[0].BusinessID,checkoutRequest.loginUserID=t[0].LoggedInUserID,checkoutRequest.isSaveCard=!1,checkoutRequest.isUserCardonFile=!1,checkoutRequest.tip=_shopdetail.BookingDetail.TipAmount,checkoutRequest.CurrencyCode=currencyCode,checkoutRequest.TotalFeeAmount=_shopdetail.BookingDetail.totalFeeAmount,checkoutRequest.TotalFeeTax=_shopdetail.BookingDetail.totalFeeTax,"undefined"==typeof hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||null==hdnPriceWithTaxSwitch||""==hdnPriceWithTaxSwitch||String.isNullOrUndefineOrBlank(hdnPriceWithTaxSwitch.value)||(checkoutRequest.IsIncludeTaxInOnlinePricing="1"==hdnPriceWithTaxSwitch.value),"undefined"==typeof vui||String.isNullOrUndefineOrBlank(vui.stripeRadarSession)||(checkoutRequest.StripeRadarSession=vui.stripeRadarSession),(checkoutRequest.isSaveCard||checkoutRequest.isUserCardonFile)&&(checkoutRequest.isUserCardonFile=!0);var i=[];_shopdetail.BookingDetail.TipAmount>0&&(checkoutRequest.ccAmt=checkoutRequest.ccAmt+parseFloat(checkoutRequest.tip)),0==_IsMemPkgUpSell?(_IsPrepay&&_shopdetail.setOnlineAppointmentCheckoutData(t,i),_shopdetail.setOnlineFeesCheckoutData(_shopdetail.BookingDetail.FeeDetails,i),_IsPrepay&&_shopdetail.setOnlineAddonCheckoutData(t,i)):_shopdetail.BookingDetail.Prepay.RedeemedByGC=[],_shopdetail.ApplyDailyDealFeeToUpsellItems(),String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.MembershipUpSellData)||_onlineCheckout.setMembershipCheckoutData(_shopdetail.BookingDetail.MembershipUpSellData,i,null,1),!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.PackageUpSellData)&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&_onlineCheckout.setPackageCheckoutData(_shopdetail.BookingDetail.PackageUpSellData,i,null,1),"undefined"==typeof ccDetails||jQuery.isEmptyObject(ccDetails)?checkoutRequest.ccDetails={}:(ccDetails.isCcSwipe=!1,checkoutRequest.ccDetails=ccDetails),checkoutRequest.RedeemedByGC=_shopdetail.BookingDetail.Prepay.RedeemedByGC,Array.isArray(i)&&i.length>0&&i.some(function(e){return e&&Number(e.FmbFee||0)>0})&&_shopdetail.setOnlineDailyDealFeesCheckoutData(i),checkoutRequest.checkoutGridrow=i,checkoutRequest.HasFMBFee=_shopdetail.GetFirstVisitFlag(),checkoutRequest.IsFMBEnableForBusiness=void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness,checkoutRequest.IsNewCustomerFees=void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.IsUKBusiness&&_shopdetail.IsUKBusiness()&&!(void 0!==IsFMBEnableForBusiness&&!0===IsFMBEnableForBusiness),checkoutRequest.FMBFeeType=void 0!==_shopdetail&&_shopdetail&&"function"==typeof _shopdetail.GetFMBFeeType?_shopdetail.GetFMBFeeType():0,checkoutRequest.VPLGatewayType=0,0==i.length&&(checkoutRequest=null);var a=JSON.parse(e("#hdnUserDetails").val());1==_onlineCheckout.isCheckoutVPLChanged&&(checkoutRequest.ccAmt=0,checkoutRequest.IsVPLPayment=_onlineCheckout.isCheckoutVPLChanged,checkoutRequest.vplAmt=_onlineCheckout.ConvertDecimalWithFixed(FinalCCAmount,!1,2),checkoutRequest.vplDetails={},checkoutRequest.vplDetails.VplBankMasterId=1==_siteBuilderDetail.isAffirmEnable?"":SelectedBank[0].Id,checkoutRequest.vplDetails.BankAccountId=1==_siteBuilderDetail.isAffirmEnable?"":void 0===SelectedBank[0].bank_id?SelectedBank[0].BankId:SelectedBank[0].bank_id,checkoutRequest.vplDetails.AccountNumber=1==_siteBuilderDetail.isAffirmEnable?"":SelectedBank[0].AccountNumber,checkoutRequest.vplDetails.ConsumerId=1==_siteBuilderDetail.isAffirmEnable?"":void 0===SelectedBank[0].CertegyTokenID?SelectedBank[0].CertegyConsumerTokenID:SelectedBank[0].CertegyTokenID,checkoutRequest.vplDetails.BillingAddress={city_locality:a.City,postal_code:a.Zip,line_1:a.Street,line_2:a.StreetNo,country_code:a.CountryName,state_province:a.StateCode},checkoutRequest.IsVPLDistributionRequired=!0,checkoutRequest.VPLGatewayType=1==_siteBuilderDetail.isAffirmEnable?_vgVPLOnline.VPLGatewayType.Affirm:_vgVPLOnline.VPLGatewayType.Certegy,checkoutRequest.PayLaterInfo=_shopdetail.AffirmVPLCapture(!1)),null!=checkoutRequest&&(checkoutRequest.TrackingId=AppointmentCyberTrackingID)},_shopdetail.IsTipTaxInclusive=function(){if(void 0===tipOnItems||null==tipOnItems||""==tipOnItems.toString().trim())return!1;for(var e=tipOnItems.toString().split(","),t=0;t<e.length;t++)if(29===parseInt(e[t],10))return!0;return!1},_shopdetail.GetItemTipTax=function(e){if(!_shopdetail.IsTipTaxInclusive())return 0;var t=parseFloat(e);return isNaN(t)?0:_onlineCheckout.parseTodecimal(t,2)},_shopdetail.IsTipOnItemConfigured=function(e){if(void 0===tipOnItems||null==tipOnItems||""==tipOnItems.toString().trim())return!1;for(var t=tipOnItems.toString().split(","),i=0;i<t.length;i++)if(parseInt(t[i],10)===e)return!0;return!1},_shopdetail.GetFeeTipBaseAmount=function(t){if(null==t||1==t.FeeType)return 0;var i=parseFloat(t.CalculatedFees);return isNaN(i)||i<=0?0:(_shopdetail.IsTipTaxInclusive()&&null!=t.BusinessTax&&t.BusinessTax.length>0&&e.grep(t.BusinessTax,function(e){var t=parseFloat(e.CalculatedTax);isNaN(t)||(i+=t)}),_onlineCheckout.parseTodecimal(i,2))},_shopdetail.GetTotalFeeTipForTip=function(){if(!(_shopdetail.IsTipOnItemConfigured(18)&&null!=_shopdetail.BookingDetail.FeeDetails&&parseFloat(_shopdetail.BookingDetail.TipPercent)>0))return 0;var t=0;return e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){if(null!=e&&e.paidType==arrpaidType.Paid){var i=_shopdetail.GetFeeTipBaseAmount(e);i>0&&(t+=_onlineCheckout.parseTodecimal(i*_shopdetail.BookingDetail.TipPercent/100,2))}}),_onlineCheckout.parseTodecimal(t,2)},_shopdetail.GetTotalAmountForTip=function(){var t=0;return _shopdetail.BookingDetail.TotalPaidCount=0,e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){i.paidType==arrpaidType.Paid&&(_shopdetail.BookingDetail.TotalPaidCount=++_shopdetail.BookingDetail.TotalPaidCount,i.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||i.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||1==i.IsMembershipApply||1==i.isPresetApply?t+=i.priceOriginal:t+=i.price,t+=_shopdetail.GetItemTipTax(i.Tax)),!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e){e.paidType==arrpaidType.Paid&&(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||1==e.IsMembershipApply?t+=e.priceOriginal:t+=e.Price,t+=_shopdetail.GetItemTipTax(e.Tax))})}),_shopdetail.IsTipOnItemConfigured(18)&&null!=_shopdetail.BookingDetail.FeeDetails&&e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){t+=_shopdetail.GetFeeTipBaseAmount(e)}),t},_shopdetail.setOnlineAppointmentCheckoutData=function(t,i){var a=_shopdetail.BookingDetail.Prepay.lstMembership,r=_shopdetail.BookingDetail.Prepay.lstMembership;if(_shopdetail.BookingDetail.TipAmount>0&&0==_shopdetail.BookingDetail.TipPercent){var o=_shopdetail.GetTotalAmountForTip();o>0&&(_shopdetail.BookingDetail.TipPercent=_onlineCheckout.parseTodecimal(100*_shopdetail.BookingDetail.TipAmount/o,2))}var n=0,s=0;n=_shopdetail.GetTotalAddonTipofAppointment(t),n+=_shopdetail.GetTotalFeeTipForTip();for(var l=0;l<t.length;l++)if(t[l].paidType!=arrpaidType.UnPaid){checkoutGridrow={},t[l].IsPaid=!0,t[l].isPointApply=_shopdetail.BookingDetail.AppointmentDetail[l].ApplyDiscoutType==ApplyDiscoutTypePrepay.Points,checkoutGridrow.recordType=CheckoutTypePrepay.Service,checkoutGridrow.serviceProviderID=t[l].ServiceProviderID,checkoutGridrow.userID=t[l].UserID,checkoutGridrow.appointmentID=0,checkoutGridrow.itemID=t[l].ServiceID,checkoutGridrow.itemName=t[l].ServiceName,checkoutGridrow.barcodeID=CheckoutBarcodeCodePrepay.srvc,checkoutGridrow.redeemID=void 0===_shopdetail.BookingDetail.AppointmentDetail[l].redeemID||""==_shopdetail.BookingDetail.AppointmentDetail[l].redeemID?0:_shopdetail.BookingDetail.AppointmentDetail[l].redeemID,checkoutGridrow.price=(Number(_shopdetail.BookingDetail.AppointmentDetail[l].price)||0)+(Number(_shopdetail.BookingDetail.AppointmentDetail[l].Discount)||0)-(Number(_shopdetail.BookingDetail.AppointmentDetail[l].DailyDealFee)||0),checkoutGridrow.pointsRedeem=_shopdetail.BookingDetail.AppointmentDetail[l].pointredeem,checkoutGridrow.pointsGained=t[l].paidType==arrpaidType.Paid?_shopdetail.BookingDetail.AppointmentDetail[l].pointgiven:0,checkoutGridrow.packageAssignStatus=_shopdetail.BookingDetail.AppointmentDetail[l].ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?1:0,checkoutGridrow.originalServicePriceForPackage=_shopdetail.BookingDetail.AppointmentDetail[l].priceOriginal,checkoutGridrow.calculatedTax=_shopdetail.BookingDetail.AppointmentDetail[l].Tax,checkoutGridrow.discount=_shopdetail.BookingDetail.AppointmentDetail[l].Discount,checkoutGridrow.discountedPrice=(Number(_shopdetail.BookingDetail.AppointmentDetail[l].price)||0)-(Number(_shopdetail.BookingDetail.AppointmentDetail[l].DailyDealFee)||0),checkoutGridrow.pointAssignStatus=_shopdetail.BookingDetail.AppointmentDetail[l].ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||void 0!==_shopdetail.BookingDetail.AppointmentDetail[l].IsPartialPoint&&1==_shopdetail.BookingDetail.AppointmentDetail[l].IsPartialPoint?1:0,checkoutGridrow.quantity=1,checkoutGridrow.uniqID=t[l].AppSrNo,checkoutGridrow.ParentAppSrNo=(0==l?t[l].AppSrNo:void 0!==t[l].ParentAppSrNo?t[l].ParentAppSrNo:0).toString();try{var d=t[l].StartTime,c=moment(d).format("MM/DD/YYYY HH:mm:ss");if(void 0!==c&&null!=c&&"invalid date"==c.toLowerCase()){var u=moment(t[l].StartTime,"YYYY-MM-DD H:mm").format("MM/DD/YYYY HH:mm:ss");void 0!==u&&null!=u&&"invalid date"!=u.toLowerCase()&&(d=u)}checkoutGridrow.startTime=d}catch(e){checkoutGridrow.startTime=t[l].StartTime}if(null!=_shopdetail.BookingDetail.AppointmentDetail[l].GCDetail&&_shopdetail.BookingDetail.AppointmentDetail[l].GCDetail.length>0&&null!=_shopdetail.BookingDetail.AppointmentDetail[l].GCDetail[0].Taxes?(checkoutGridrow.taxes="0",checkoutGridrow.calculatedTax=0):checkoutGridrow.taxes=_shopdetail.BookingDetail.AppointmentDetail[l].taxes,checkoutGridrow.calculatedTaxTypeWise="[]",null!=_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax&&null!=_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax&&""!=_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax){if(null!=_shopdetail.BookingDetail.AppointmentDetail[l].GCDetail&&_shopdetail.BookingDetail.AppointmentDetail[l].GCDetail.length>0&&null!=_shopdetail.BookingDetail.AppointmentDetail[l].GCDetail[0].Taxes){for(var p=JSON.parse(JSON.stringify(_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax)),h=0;h<p.length;h++)p[h].CalculatedTax=0;_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax=p}checkoutGridrow.calculatedTaxTypeWise=JSON.stringify(_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax)}if(_shopdetail.BookingDetail.AppointmentDetail[l].IsMembershipApply){var m,f={};f.BusinessID=t[l].BusinessID,f.RedeemBusinessId=_shopdetail.BookingDetail.AppointmentDetail[l].RedeemBusinessId,f.UserID=_shopdetail.BookingDetail.AppointmentDetail[l].UserID,f.RedeemUserID=checkoutGridrow.userID,f.MembershipID=_shopdetail.BookingDetail.AppointmentDetail[l].MembershipID,f.MembershipItemId=_shopdetail.BookingDetail.AppointmentDetail[l].MembershipItemId,f.ItemType="1",f.VisitUsed=1,f.Type=2,f.GroupId=_shopdetail.BookingDetail.AppointmentDetail[l].GroupId,f.IsUnlimitedVisit=-1==_shopdetail.BookingDetail.AppointmentDetail[l].Visit,f.ServiceProductName=checkoutGridrow.itemName,e.each(r,function(t,i){checkoutGridrow.userID==i.UserID&&i.ServiceProductName==checkoutGridrow.itemName&&_shopdetail.BookingDetail.AppointmentDetail[l].MembershipID==i.MembershipID&&(m=i.VisitRemaining,e.each(a,function(e,t){if(checkoutGridrow.userID==t.UserID&&_shopdetail.BookingDetail.AppointmentDetail[l].MembershipID==t.MembershipID)return t.TotalMSVisitRemaining=-1==t.TotalMSVisitRemaining?-1:-1==m?t.TotalMSVisitRemaining:t.TotalMSVisitRemaining-1,m=t.TotalMSVisitRemaining-t.TotalMSUnlimitedCount,!1}))}),f.AfterVisitBalance=m,checkoutGridrow.MembershipRedeemedDetails=f,checkoutGridrow.membershipDiscount=_shopdetail.BookingDetail.AppointmentDetail[l].membershipDiscount}if(checkoutGridrow.PromotionID=_shopdetail.BookingDetail.AppointmentDetail[l].PromotionId,1!=t[l].isPointApply&&1!=checkoutGridrow.packageAssignStatus||(checkoutGridrow.PromotionID=0,t[l].PromotionID=0,1==checkoutGridrow.packageAssignStatus?t[l].Amount=checkoutGridrow.price:1==t[l].isPointApply&&(t[l].Amount=checkoutGridrow.price=checkoutGridrow.discountedPrice=_shopdetail.BookingDetail.AppointmentDetail[l].ServiceOrginalPrice)),null!=_shopdetail.BookingDetail.AppointmentDetail[l].isPresetApply&&1==_shopdetail.BookingDetail.AppointmentDetail[l].isPresetApply&&(checkoutGridrow.DiscountID=_shopdetail.BookingDetail.AppointmentDetail[l].DiscountID),checkoutGridrow.DiscountType=1==_shopdetail.BookingDetail.AppointmentDetail[l].IsAmount?2:1,checkoutGridrow.AmountValue=_shopdetail.BookingDetail.AppointmentDetail[l].AmountValue,checkoutGridrow.PromotionID>0){var g=_shopdetail.BookingDetail.AppointmentDetail[l].ServiceOrginalPrice-_shopdetail.BookingDetail.AppointmentDetail[l].priceOriginal;checkoutGridrow.discount=_onlineCheckout.parseTodecimal(checkoutGridrow.discount+g,2),checkoutGridrow.price=_onlineCheckout.parseTodecimal(checkoutGridrow.price+g,2)}if(checkoutGridrow.isNewCustomer=t[l].isNewCustomer,checkoutGridrow.paidType=t[l].paidType,t[l].paidType==arrpaidType.Deposits||t[l].paidType==arrpaidType.PartiallyPaid){if(checkoutGridrow.DepositsPaid=t[l].depositsPaid,t[l].IsPartialPoint?checkoutGridrow.DepositsRemaining=_shopdetail.parseTodecimal(t[l].Amount-t[l].depositsPaid):checkoutGridrow.DepositsRemaining=_shopdetail.parseTodecimal(t[l].payableAmount-t[l].depositsPaid),_shopdetail.CheckPriceWithTaxSwitch()&&t[l].depositsPercentage<100){var v=parseFloat(_onlineCheckout.ConvertDecimalWithFixed(100*parseFloat(t[l].depositsPaid)/_shopdetail.BookingDetail.AppointmentDetail[l].price,!0,2));checkoutGridrow.depositsPercentage=v,_shopdetail.BookingDetail.AppointmentDetail[l].depositsPercentage=v,t[l].depositsPercentage=v}else checkoutGridrow.depositsPercentage=t[l].depositsPercentage;checkoutGridrow.payableAmount=t[l].payableAmount}else t[l].paidType==arrpaidType.Paid&&(checkoutGridrow.depositsPercentage=t[l].depositsPercentage,checkoutGridrow.payableAmount=t[l].payableAmount);if(_shopdetail.BookingDetail.TipPercent>0&&t[l].paidType==arrpaidType.Paid){if((s=++s)==_shopdetail.BookingDetail.TotalPaidCount)checkoutGridrow.calculatedTip=_onlineCheckout.parseTodecimal(_shopdetail.BookingDetail.TipAmount-n,2);else{var A=_shopdetail.BookingDetail.AppointmentDetail[l].price;1!=_shopdetail.BookingDetail.AppointmentDetail[l].isPointApply&&_shopdetail.BookingDetail.AppointmentDetail[l].ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&1!=_shopdetail.BookingDetail.AppointmentDetail[l].IsMembershipApply&&1!=_shopdetail.BookingDetail.AppointmentDetail[l].isPresetApply||(A=_shopdetail.BookingDetail.AppointmentDetail[l].priceOriginal),A=_onlineCheckout.parseTodecimal(A+_shopdetail.GetItemTipTax(_shopdetail.BookingDetail.AppointmentDetail[l].Tax),2),checkoutGridrow.calculatedTip=_onlineCheckout.parseTodecimal(A*_shopdetail.BookingDetail.TipPercent/100,2)}n+=checkoutGridrow.calculatedTip}checkoutGridrow.BusinessTax=_shopdetail.BookingDetail.AppointmentDetail[l].BusinessTax,checkoutGridrow.AddonServiceDetials=t[l].lstAddonService,checkoutGridrow.ServiceStartTime=t[l].ServiceStartTime,checkoutGridrow.CleanupTime=t[l].CleanupTime,_shopdetail.BookingDetail.AppointmentDetail[l].IsAmountPaid&&_shopdetail.BookingDetail.AppointmentDetail[l].IsPartialPoint&&(checkoutGridrow.discountedPrice=0),"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&(checkoutGridrow.RevenueIsFromTextMarketing=isFromTextMarketing),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&(checkoutGridrow.RevenuePromotionID=parseInt(PromotionAppointmentID));var C=Number(_shopdetail.BookingDetail.AppointmentDetail[l].DailyDealFee)||0,y=Number(FMBPercentage)||0;checkoutGridrow.FmbFee=C,checkoutGridrow.FmbPercentage=y,checkoutGridrow.DealBookingType=_shopdetail.GetDealBookingType(C,y),i.push(checkoutGridrow)}},_shopdetail.setOnlineFeesCheckoutData=function(e,t){var i;if(void 0!==e&&null!=e&""!=e)for(var a=0;a<e.length;a++)if((e[a].paidType==arrpaidType.Paid||1==e[a].FeeType)&&e[a].CalculatedFees>0){if(checkoutGridrow={},checkoutGridrow.uniqID=_shopdetail.BookingDetail.serviceid.split(",").length+1,1==e[a].FeeType?checkoutGridrow.recordType=CheckoutTypePrepay.VCFee:checkoutGridrow.recordType=CheckoutTypePrepay.Fee,checkoutGridrow.price=e[a].CalculatedFees,checkoutGridrow.BusinessTax=e[a].BusinessTax,checkoutGridrow.AmountType=e[a].AmountType,checkoutGridrow.ApplyType=e[a].ApplyType,checkoutGridrow.TransactionType=e[a].TransactionType,checkoutGridrow.itemID=e[a].BusinessFeeID,checkoutGridrow.itemName=e[a].FeeName,checkoutGridrow.quantity=1,checkoutGridrow.AutoApplyFees=e[a].AutoApplyFees,checkoutGridrow.taxes=e[a].BusinessTaxIDs,checkoutGridrow.calculatedTaxTypeWise="[]",void 0!==e[a].BusinessTax&&null!=e[a].BusinessTax&&""!=e[a].BusinessTax&&(checkoutGridrow.calculatedTaxTypeWise=JSON.stringify(e[a].BusinessTax)),null!=typeof e[a].BusinessTax&&""!=e[a].BusinessTax&&"undefined"!=e[a].BusinessTax&&(i=GetCalculateTaxValue(e[a].BusinessTax)),checkoutGridrow.calculatedTax=i,checkoutGridrow.serviceProviderID=e[a].ShopOwnerId,checkoutGridrow.userID=UserID,checkoutGridrow.barcodeID=CheckoutBarcodeCodePrepay.Fee,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=0,checkoutGridrow.pointsGained=0,checkoutGridrow.packageAssignStatus=0,checkoutGridrow.originalServicePriceForPackage=e[a].CalculatedFees,checkoutGridrow.discount=0,checkoutGridrow.discountedPrice=e[a].CalculatedFees,checkoutGridrow.pointAssignStatus=0,checkoutGridrow.appointmentID=e[a].appointmentID,checkoutGridrow.FeeAccountType=1,_shopdetail.IsTipOnItemConfigured(18)&&parseFloat(_shopdetail.BookingDetail.TipPercent)>0){var r=_shopdetail.GetFeeTipBaseAmount(e[a]);r>0&&(checkoutGridrow.calculatedTip=_onlineCheckout.parseTodecimal(r*_shopdetail.BookingDetail.TipPercent/100,2))}t.push(checkoutGridrow)}},_shopdetail.GetDealBookingType=function(e,t){try{if(Number(t||0)>0&&Number(e||0)>0){var i="";try{i="function"==typeof getCookie&&getCookie("VeraSourceType")||""}catch(e){i=""}if("vera-push"==(i=i.toString().toLowerCase()))return 2;if("vera-email"==i)return 1}}catch(e){}return 0},_shopdetail.setOnlineDailyDealFeesCheckoutData=function(t){if(_shopdetail.BookingDetail&&t&&0!==t.length){var i=t.filter(function(e){return e&&Number(e.FmbFee||0)>0});e.each(i,function(e,i){var a=i.FmbFee,r={};r.uniqID=t.length+1,r.recordType=CheckoutTypePrepay.DailyDealFee,r.price=Number(a),r.BusinessTax=[],r.AmountType=i.AmountType||0,r.ApplyType=i.ApplyType||0,r.TransactionType=i.TransactionType||0,r.itemID=i.itemID||0,r.itemName="Daily Deal Fee",r.quantity=1,r.AutoApplyFees=1,r.taxes="",r.calculatedTaxTypeWise="[]",r.calculatedTax=0,r.serviceProviderID=i.serviceProviderID,r.userID=i.userID||UserID,r.barcodeID=CheckoutBarcodeCodePrepay.dailyDealFee,r.redeemID=0,r.pointsRedeem=0,r.pointsGained=0,r.packageAssignStatus=0,r.originalServicePriceForPackage=Number(a),r.discount=0,r.discountedPrice=Number(a),r.pointAssignStatus=0,r.appointmentID=i.appointmentID||0,r.FeeAccountType=1,t.push(r)})}},_shopdetail.setOnlineAddonCheckoutData=function(t,i){var a=_shopdetail.BookingDetail.Prepay.lstMembership,r=_shopdetail.BookingDetail.Prepay.lstMembership;if(void 0!==t&&null!=t&""!=t)for(var o=0;o<t.length;o++){t[o].Duration;if(null!=t[o].lstAddonService&&t[o].lstAddonService.length>0)for(var n="",s=0;s<t[o].lstAddonService.length;s++){var l=_onlineCheckout.GetServcieDuration(t[o].lstAddonService,t[o]),d=t[o].lstAddonService;if(checkoutGridrow={},checkoutGridrow.ServiceStartTime=0==s?moment(t[o].ServiceStartTime,"hh:mm A").add(l,"minutes").format("hh:mm A"):moment(n,"hh:mm A").add(d[s-1].Duration,"minutes").format("hh:mm A"),n=checkoutGridrow.ServiceStartTime,d[s].paidType!=arrpaidType.UnPaid){if(d[s].IsPaid=!0,d[s].isPointApply=d[s].ApplyDiscoutType==ApplyDiscoutTypePrepay.Points,checkoutGridrow.startTime=new Date(new Date(t[o].StartTime).format("MM/dd/yyyy").toString()+" "+("Invalid date"!=checkoutGridrow.ServiceStartTime?checkoutGridrow.ServiceStartTime:"")).format("dd MMM yyyy hh:nn a/p").toString(),d[s].ApplyDiscoutType==ApplyDiscoutTypePrepay.Package&&(d[s].Price=d[s].price),n=checkoutGridrow.ServiceStartTime,checkoutGridrow.ConstantOriginalServicePrice=d[s].Price,checkoutGridrow.uniqID=d[s].SerialNo,checkoutGridrow.recordType=CheckoutTypePrepay.ServiceAddons,checkoutGridrow.price=(Number(d[s].Price)||0)+(Number(d[s].Discount)||0)-(isNaN(Number(d[s].DailyDealFee))?0:Number(d[s].DailyDealFee)),checkoutGridrow.AmountType=0,checkoutGridrow.itemID=d[s].ServiceId,checkoutGridrow.itemName=d[s].ServiceTitle,checkoutGridrow.quantity=1,checkoutGridrow.serviceProviderID=t[o].ServiceProviderID,checkoutGridrow.userID=t[o].UserID,checkoutGridrow.barcodeID=CheckoutBarcodeCodePrepay.addon,checkoutGridrow.redeemID=0,checkoutGridrow.pointsRedeem=d[s].PointRedeem,checkoutGridrow.pointsGained=d[s].paidType==arrpaidType.Paid?d[s].PointGiven:0,checkoutGridrow.packageAssignStatus=d[s].ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?1:0,checkoutGridrow.originalServicePriceForPackage=d[s].Price,checkoutGridrow.discount=d[s].Discount,checkoutGridrow.discountedPrice=(Number(d[s].Price)||0)-(Number(d[s].DailyDealFee)||0),checkoutGridrow.pointAssignStatus=void 0!==d[s].IsPointsApply&&d[s].IsPointsApply?1:0,checkoutGridrow.appointmentID=0,null!=d[s].GCDetail&&d[s].GCDetail.length>0&&null!=d[s].GCDetail[0].Taxes?(checkoutGridrow.calculatedTax=0,checkoutGridrow.taxes="0"):(checkoutGridrow.calculatedTax=d[s].Tax,checkoutGridrow.taxes=d[s].taxes),checkoutGridrow.calculatedTaxTypeWise="[]",null!=d[s].BusinessTax&&null!=d[s].BusinessTax&&""!=d[s].BusinessTax&&(null!=d[s].GCDetail&&d[s].GCDetail.length>0&&null!=d[s].GCDetail[0].Taxes&&e.grep(d[s].BusinessTax,function(e){e.CalculatedTax=0}),checkoutGridrow.calculatedTaxTypeWise=JSON.stringify(d[s].BusinessTax)),checkoutGridrow.PromotionID=void 0!==d[s].PromotionID?d[s].PromotionID:0,d[s].IsMembershipApply){var c,u={};u.BusinessID=t[o].BusinessID,u.RedeemBusinessId=d[s].RedeemBusinessId,u.UserID=d[s].UserID,u.RedeemUserID=checkoutGridrow.userID,u.MembershipID=d[s].MembershipID,u.MembershipItemId=d[s].MembershipItemId,u.ItemType="1",u.VisitUsed=1,u.Type=2,u.GroupId=d[s].GroupId,u.IsUnlimitedVisit=-1==d[s].Visit,u.ServiceProductName=checkoutGridrow.itemName,e.each(r,function(t,i){checkoutGridrow.userID==i.UserID&&i.ServiceProductName==checkoutGridrow.itemName&&d[s].MembershipID==i.MembershipID&&(c=i.VisitRemaining,e.each(a,function(e,t){if(checkoutGridrow.userID==t.UserID&&d[s].MembershipID==t.MembershipID)return t.TotalMSVisitRemaining=-1==t.TotalMSVisitRemaining?-1:-1==c?t.TotalMSVisitRemaining:t.TotalMSVisitRemaining-1,c=t.TotalMSVisitRemaining-t.TotalMSUnlimitedCount,!1}))}),u.AfterVisitBalance=c,checkoutGridrow.MembershipRedeemedDetails=u,checkoutGridrow.membershipDiscount=void 0!==d[s].membershipDiscount?d[s].membershipDiscount:0}if(1!=d[s].isPointApply&&1!=checkoutGridrow.packageAssignStatus||(checkoutGridrow.PromotionID=0,d[s].PromotionID=0,1==checkoutGridrow.packageAssignStatus?d[s].Amount=checkoutGridrow.price:1==d[s].isPointApply&&(d[s].Amount=checkoutGridrow.price=checkoutGridrow.discountedPrice=d[s].OriginalPrice)),null!=d[s].isPresetApply&&1==d[s].isPresetApply&&(checkoutGridrow.DiscountID=d[s].DiscountID,d[s].payableAmount=d[s].Price),checkoutGridrow.DiscountType=1==d[s].IsAmount?2:1,checkoutGridrow.AmountValue=void 0!==d[s].AmountValue?d[s].AmountValue:0,checkoutGridrow.PromotionID>0){var p=parseFloat(d[s].OriginalPrice-d[s].Price);checkoutGridrow.discount=_onlineCheckout.parseTodecimal(p,2),checkoutGridrow.price=_onlineCheckout.parseTodecimal(checkoutGridrow.price+p,2)}if(checkoutGridrow.isNewCustomer=t[o].isNewCustomer,checkoutGridrow.paidType=d[s].paidType,d[s].paidType==arrpaidType.Deposits||d[s].paidType==arrpaidType.PartiallyPaid)if(d[s].IsPartialPoint?(checkoutGridrow.DepositsRemaining=_shopdetail.parseTodecimal(d[s].Price-d[s].depositsPaid-d[s].AddonPointPrice),checkoutGridrow.DepositsPaid=d[s].depositsPaid+d[s].AddonPointPrice,checkoutGridrow.payableAmount=d[s].Price-d[s].AddonPointPrice):(checkoutGridrow.DepositsRemaining=_shopdetail.parseTodecimal(d[s].Price-d[s].depositsPaid),checkoutGridrow.DepositsPaid=d[s].depositsPaid,checkoutGridrow.payableAmount=d[s].Price),_shopdetail.CheckPriceWithTaxSwitch()&&d[s].depositsPercentage<100){var h=parseFloat(_onlineCheckout.ConvertDecimalWithFixed(100*parseFloat(d[s].depositsPaid)/d[s].Price,!0,2));checkoutGridrow.depositsPercentage=h,d[s].depositsPercentage=h}else checkoutGridrow.depositsPercentage=d[s].depositsPercentage;else d[s].paidType==arrpaidType.Paid&&(checkoutGridrow.depositsPercentage=d[s].depositsPercentage,checkoutGridrow.payableAmount=d[s].Price);if(_shopdetail.BookingDetail.TipPercent>0&&d[s].paidType==arrpaidType.Paid){var m=d[s].Price;1!=d[s].isPointApply&&d[s].ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&1!=d[s].IsMembershipApply&&1!=d[s].isPresetApply||(m=d[s].priceOriginal),m=_onlineCheckout.parseTodecimal(m+_shopdetail.GetItemTipTax(d[s].Tax),2),checkoutGridrow.calculatedTip=_onlineCheckout.parseTodecimal(m*_shopdetail.BookingDetail.TipPercent/100,2)}checkoutGridrow.BusinessTax=d[s].BusinessTax,"undefined"!=typeof isFromTextMarketing&&0==String.isNullOrUndefineOrBlank(isFromTextMarketing)&&(checkoutGridrow.RevenueIsFromTextMarketing=isFromTextMarketing),"undefined"!=typeof PromotionAppointmentID&&0==String.isNullOrUndefineOrBlank(PromotionAppointmentID)&&(checkoutGridrow.RevenuePromotionID=parseInt(PromotionAppointmentID));var f=Number(d[s].DailyDealFee)||0;checkoutGridrow.FmbFee=f;var g=Number(FMBPercentage)||0;checkoutGridrow.FmbPercentage=g,checkoutGridrow.DealBookingType=_shopdetail.GetDealBookingType(f,g),i.push(checkoutGridrow)}else d[s].depositsPercentage<=0&&t[o].depositsPercentage>0&&(d[s].payableAmount=d[s].Price,d[s].paidType=2)}}},_shopdetail.shareBusiness=function(t){switch(t.toLowerCase()){case"facebook":var i={BusinessName:htmlDecode(businessName),vagaroUrl:vagaroUrl,imageUrl:e("#dvBusinessImage").attr("data-original")};_siteBuilderSocialMedia.PostonFacebook(null,"BusinessDetail",i);break;case"twitter":var a=location.protocol+"//"+location.host+(IsVagaroDomain()?"/"+vagaroUrl:""),r=escape(a+"&text=Check out this business on Vagaro: "+htmlDecode(businessName)+"&related=vagaro");_siteBuilderSocialMedia.PostOnTwitter(r);break;case"pinterest":a=location.protocol+"//"+location.host+"/"+vagaroUrl;var o=e("#dvBusinessImage").attr("data-original"),n="";1==e("#pbusinessDescription").length&&(n=e("#pbusinessDescription").text());r=escape(a+"&text="+htmlDecode(businessName)+"&media="+o+"&description="+escape(htmlDecode(n)).substr(0,500));_siteBuilderSocialMedia.PostOnPint(r);break;case"email":_siteBuilderSocialMedia.MailClick(null,null,"BusinessDetail")}_siteBuilderSocialMedia.showHideSharingOptions()},e("#btnShareBusiness").click(function(){_siteBuilderSocialMedia.showHideSharingOptions(this)}),e("#btnCloseSharingBusiness").click(function(){event.stopPropagation(),event.preventDefault(),_siteBuilderSocialMedia.showHideSharingOptions(this)}),_shopdetail.txtPromoCodeServiceClick=function(){e(".divSPromoCode_0").hide()},_shopdetail.txtPromoCodeServiceKeypress=function(t){13==t.which?(t.preventDefault(),_shopdetail.ValidatePromoCodeService()):e("#txtPromoCodeService").removeClass("errorInput")},_shopdetail.ValidatePromoCodeService=function(){void 0!==_shopdetail.BookingDetail&&null!=_shopdetail.BookingDetail&&(void 0!==_shopdetail.BookingDetail.lstPromotionData&&null!=_shopdetail.BookingDetail.lstPromotionData||(_shopdetail.BookingDetail.lstPromotionData=[]));var t=e("#txtPromoCodeService").val();if(""==t.trim())return e("#txtPromoCodeService").val(""),void e("#txtPromoCodeService").addClass("errorInput");_shopdetail.PromocodeApply=t,ShowLoader(!0);var i=0;for(h=0;h<_shopdetail.BookingDetail.serviceid.split(",").length;h++)i+=parseFloat(_shopdetail.BookingDetail.ServiceOrginalPrice.split(",")[h]),void 0!==_shopdetail.BookingDetail.AddonServiceAmt&&null!=_shopdetail.BookingDetail.AddonServiceAmt&&_shopdetail.BookingDetail.AddonServiceAmt>0&&(i+=parseFloat(String(_shopdetail.BookingDetail.AddonServiceAmt).split(",")[h]));var a=!1;a="undefined"==typeof IsForNewCustomer?void 0!==e("#hdnIsForNewCustomer").val()&&"true"==e("#hdnIsForNewCustomer").val().toLowerCase():IsForNewCustomer;var r=_shopdetail.BookingDetail.serviceid;null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){r+=","+e.MembershipId,i+=parseFloat(e.Price)}),null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){r+=","+e.ServiceId,i+=parseFloat(e.Price)});var o={};o.PromotionCode=t,o.businessID=businessID,o.loginUserID=UserID,o.CartAmount=i,o.IsNewCustomer=a,o.ServiceIDs=r,vagaro.ajaxCall(ApiPath+ApiURLEnumBooking.validatepromocodeandgetdetails,o,function(i){if(ShowLoader(!1),void 0!==i&&null!=i){if(200==i.ResponseID)if(null!=i.PromotionDataList&&i.PromotionDataList.length>0){if(e.grep(_shopdetail.BookingDetail.lstPromotionData,function(e){return e.PromotionID==i.PromotionDataList[0].PromotionID}).length>0)return _shopdetail.CreatePromoCodeDiv(t.toUpperCase(),t.toUpperCase(),"This discount has already been applied.",!1),void e("#txtPromoCodeService").val("");_shopdetail.ApplyPromoCodeService(i.PromotionDataList,t,i.PromotionDesc,i.PerTransactionOne)}else _shopdetail.CreatePromoCodeDiv(t.toUpperCase(),t.toUpperCase(),"Discount cannot be used for any items in this cart.",!1);else{var a=UserType;_shopdetail.GCPromoCodeLimt(parseInt(UserID),a,t.toUpperCase(),"CheckPromoNumber")}e("#txtPromoCodeService").val(""),_shopdetail.VPLCalculation()}},function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},!1,!0)},_shopdetail.GetApplicableApptForOnePerUser=function(t){var i,a=0,r=0;return e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(o){var n=e.grep(t,function(e){return e.ServiceID==o.serviceid&&(1==e.ItemTypeID||19==e.ItemTypeID)});if(null!=n&&n.length>0){n=n[0];var s=_shopdetail.ValidatePromoAndService(o,n);o.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||o.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||0==s||(r=0==n.IsAmount?_onlineCheckout.parseTodecimal(o.ServiceOrginalPrice*n.DiscountValue/100,2):n.DiscountValue,o.ServiceOrginalPrice<r&&(r=o.ServiceOrginalPrice),r>a&&(a=r,i=o))}}),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(a){var o=e.grep(t,function(e){return e.ServiceID==a.MembershipId&&7==e.ItemTypeID}),n=e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){return e.autoId==a.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;s<(l=0==o.IsAmount?_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(s*o.DiscountValue/100,2),2):_shopdetail.parseTodecimal(o.DiscountValue,2))&&(l=s),l>r&&(r=l,i=a)}}),null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(a){var o=e.grep(t,function(e){return e.ServiceID==a.ServiceId&&3==e.ItemTypeID&&4==a.eventType||e.ServiceID==a.ServiceId&&1==e.ItemTypeID&&1==a.eventType}),n=e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){return e.autoId==a.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;s<(l=0==o.IsAmount?_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(s*o.DiscountValue/100,2),2):_shopdetail.parseTodecimal(o.DiscountValue,2))&&(l=s),l>r&&(r=l,i=a)}}),_shopdetail.VPLCalculation(),i},_shopdetail.IsGooglepayPayment=function(e,t){try{if(!_siteBuilderDetail.isAPayGPayEnable)return!1;if("undefined"!=typeof IsBrandedApp&&!0===IsBrandedApp){if(!navigator.userAgent)return!1;if(-1===(s=navigator.userAgent.toLowerCase()).indexOf("com.vagaro.customerandroid-brandedapp"))return!1;var i=_siteBuilderDetail.GPayAndroidBrandedAppAllowBusinessIds,a=s.match(/\(brandedapp\s+(\d+)\)/),r=a?a[1]:null;if(!r||!i)return!1;if(-1===i.split(",").indexOf(r))return!1;var o=parseInt(_common.GetAppVersion()||"0",10);if(Math.floor(o/10)<_siteBuilderDetail.GPayAndroidBrandedAppSupportedVersion)return!1}if("undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CheckinApp)return!1;var n="undefined"!=typeof vgAppicationType&&1==vgAppicationType?_common.GetAppVersion():null;if(null!=n&&null!=navigator.userAgent){var s=navigator.userAgent.toLowerCase();if("undefined"==typeof IsBrandedApp||!IsBrandedApp){if(s.indexOf("com.vagaro.customerios")>-1&&n<_siteBuilderDetail.APayIOSSupportedVersion)return!1;if(s.indexOf("com.vagaro.customerandroid")>-1&&n<_siteBuilderDetail.GPayAndroidSupportedVersion)return!1}}var l=void 0!==_shopdetail.PCPaymentGateWayType&&null!=_shopdetail.PCPaymentGateWayType?_shopdetail.PCPaymentGateWayType:0;return(1!=e||0!=_onlineCheckout.IsDisplayGoogleAppleMethod())&&(1==t&&6==l)}catch(e){return!1}},_shopdetail.IsApplepayPayment=function(e,t){try{if(!_siteBuilderDetail.isAPayGPayEnable)return!1;if("undefined"!=typeof vgAppicationType&&vgAppicationType===objApplicationType.CheckinApp)return!1;var i="undefined"!=typeof vgAppicationType&&1==vgAppicationType?_common.GetAppVersion():null;if(null!=i&&null!=navigator.userAgent){var a=navigator.userAgent.toLowerCase();if("undefined"==typeof IsBrandedApp||!IsBrandedApp){if(a.indexOf("com.vagaro.customerios")>-1&&i<_siteBuilderDetail.APayIOSSupportedVersion)return!1;if(a.indexOf("com.vagaro.customerandroid")>-1&&i<_siteBuilderDetail.GPayAndroidSupportedVersion)return!1}}var r=void 0!==_shopdetail.PCPaymentGateWayType&&null!=_shopdetail.PCPaymentGateWayType?_shopdetail.PCPaymentGateWayType:0;return(1!=e||0!=_onlineCheckout.IsDisplayGoogleAppleMethod())&&(1==t&&6==r)}catch(e){return!1}},_shopdetail.SetGoogleApplePayCardInfo=function(t,i){"undefined"!=typeof _CCDetailCardOnFile&&null!=_CCDetailCardOnFile||(_CCDetailCardOnFile={}),t&&"string"!=typeof t||(t={});var a=_shopdetail.getFirstMiddleLastName(t);_CCDetailCardOnFile.CCFirstName=a.first_name,_CCDetailCardOnFile.CCLastName=a.last_name,_CCDetailCardOnFile.CCMiddleName=a.middle_name,_CCDetailCardOnFile.CardTokenId=_shopdetail.safeValue(t.card_token),_CCDetailCardOnFile.CreditCardNumber=_shopdetail.safeValue(t.cc_no),_CCDetailCardOnFile.CreditCardType=_shopdetail.safeValue(t.cc_type),_CCDetailCardOnFile.ExpMonth=_shopdetail.safeValue(t.expire_month),_CCDetailCardOnFile.ExpYear=_shopdetail.safeValue(t.expire_year),_CCDetailCardOnFile.FullName=a.full_name,_CCDetailCardOnFile.SecurityCode="",_CCDetailCardOnFile.isSaveCard=!0,_CCDetailCardOnFile.IsTokenGenerated=i,isCCChanged=!1,e("#hdnCCTokenID").val(_CCDetailCardOnFile.CardTokenId)},_shopdetail.safeValue=function(e){return null==e||"string"==typeof e&&""===e.trim()?"":e},_shopdetail.VPLCalculation=function(){if(0==e("#tabVagaroPayLater").hasClass("w--current"))return _onlineCheckout.isCheckoutVPLChanged=!1,!1;var t=0;null!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&null!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&null!=e("#divServicesTotalPrice")[0].innerHTML&&null!=e("#divServicesTotalPrice")[0].innerHTML&&(t=(null!=_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay.gcAmt&&null!=_shopdetail.BookingDetail.Prepay.gcAmt&&_shopdetail.BookingDetail.Prepay.gcAmt,_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount)))<=0&&(t=e("#divServicesTotalPrice").text().replace("$","")),_shopdetail.ValidateVPl(!0),t>_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount||t<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount||void 0!==e("#hdnAllowCCCapturedAbove").val()&&""!=e("#hdnAllowCCCapturedAbove").val()&&"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()||"Free"==t?(e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide()):e("#tabVagaroPayLater").show(),t>0&&(e("#VplAmount").data("vplAmt",t),_vgVPLOnline.PaymentSchedule(t,_shopdetail.PaymentSchduleSuccess,_shopdetail.PaymentSchdulefail))},_shopdetail.ValidatePromoAndService=function(e,t){var a=t.ServiceProviderIDs,r=_shopdetail.BookingDetail.spid.split(",")[e.AppSrNo-1],o=!1;for(i=0;i<a.split(",").length;i++)r==a.split(",")[i]&&(o=!0);var n=moment(_shopdetail.BookingDetail.date.split(",")[e.AppSrNo-1]),s=moment(t.StartDate.replace("A"," A").replace("P"," P")),l=moment(t.EndDate.replace("A"," A").replace("P"," P"));return s.diff(n,"min")>0&&(o=!1),""!=t.EndDate&&l.diff(n,"min")<0&&(o=!1),new Date(n._i)>new Date(l._i)&&(promocodenewmessage_ticket=!0,o=!1),o},_shopdetail.ApplyPromoCodeService=function(t,i,a,r){var o,n=!1;if(1==r&&(o=_shopdetail.GetApplicableApptForOnePerUser(t)),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(a){if(1==r&&void 0!==o&&a.AppSrNo==o.AppSrNo||0==r){var s=e.grep(t,function(e){return e.ServiceID==a.serviceid&&(1==e.ItemTypeID||19==e.ItemTypeID)});if(null!=s&&s.length>0){s=s[0];var l=_shopdetail.ValidatePromoAndService(a,s);if(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||0==l)1==promocodenewmessage_ticket&&0==l&&_shopdetail.CreatePromoCodeDiv(i.toUpperCase(),i.toUpperCase(),"The promo code you entered is incorrect.",!1);else if(0==a.price&&a.PromotionId>0||a.price>0){0!=a.PromotionId&&(a.price=a.ServiceOrginalPrice,a.priceOriginal=a.ServiceOrginalPrice,a.PromotionId=0);var d=0;if(1==a.IsMembershipApply){var c=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==a.MembershipID&&1==e.ItemType&&e.MembershipItemId==a.MembershipItemId});1==c[0].IsAllowPreSetDiscount?d=_shopdetail.parseTodecimal(a.ServiceOrginalPrice*c[0].Discount/100):_shopdetail.RemoveDiscount(3,a.AppSrNo)}if(0==s.IsAmount)_onlineCheckout.parseTodecimal(a.ServiceOrginalPrice*s.DiscountValue/100,2),d=_onlineCheckout.parseTodecimal(d+_onlineCheckout.parseTodecimal(a.ServiceOrginalPrice*s.DiscountValue/100,2),2);else if(s.DiscountValue,d=a.ServiceOrginalPrice<d+s.DiscountValue?a.ServiceOrginalPrice:_onlineCheckout.parseTodecimal(d+s.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()){var u=0;null!=a.BusinessTax&&a.BusinessTax.length>0&&(u=a.BusinessTax.reduce((e,t)=>e+t.Tax,0)),d=parseFloat(ConvertTodecimalMorePrecious(parseFloat(d)/(1+u/100),!0,4))}a.ServiceOrginalPrice<d&&(a.ServiceOrginalPrice,d=a.ServiceOrginalPrice),a.Discount=d,a.price=_shopdetail.parseTodecimal(a.ServiceOrginalPrice-a.Discount),a.isPresetApply=!0,a.DiscountID=s.PromotionID,a.IsAmount=s.IsAmount,a.AmountValue=s.DiscountValue,n=!0,"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&PromotionAppointmentID>0&&a.DiscountID>0&&(PromotionAppointmentID=""),null!=a.GCDetailPriceBase&&a.GCDetailPriceBase.length>0&&0==a.price&&_shopdetail.RemoveDiscount(2,a.AppSrNo),a.paidType==arrpaidType.Deposits&&_shopdetail.calculateDepositsPrepay(a),_shopdetail.BindDiscountOnItems(!1,a.AppSrNo,!1,!1,0,!1,a.priceOriginal,!0,i.toUpperCase())}}}}),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0){var s=e.grep(t,function(e){return 7==e.ItemTypeID});s.length>0&&(PromoAppliedMemberships=_shopdetail.ApplyPresetDiscountOnMemberships(_shopdetail.BookingDetail.MembershipUpSellData,s,o),1==PromoAppliedMemberships&&(n=!0))}if(null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0){var l=e.grep(t,function(e){return 3==e.ItemTypeID});l.length>0&&(PromoAppliedPackages=_shopdetail.ApplyPresetDiscountOnPackages(_shopdetail.BookingDetail.PackageUpSellData,l,o),1==PromoAppliedPackages&&(n=!0))}1==_shopdetail.ApplyAddOnPromoCodeService(t,i,a,r,n)&&(n=!0),1==n&&(_shopdetail.BookingDetail.lstPromotionData=_shopdetail.BookingDetail.lstPromotionData.concat(t),_shopdetail.CreatePromoCodeDiv(t[0].PromotionID,i.toUpperCase(),a,!0),_shopdetail.RemoveUnusedPromocode(t[0].PromotionID),_shopdetail.RemoveVCFFee(),_shopdetail.RecalculateGCAfterPreset(!1),_shopdetail.ReApplyDiscounts(),_shopdetail.IsVCFEnable()&&_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.ApplyPromoCode))},_shopdetail.ApplyPresetDiscountOnPackages=function(t,i,a){var r=!1;return e.grep(t,function(t){if(null!=a&&t.autoId+"0"==a.autoId.toString()+a.EnrollAutoID.toString()||null==a){var o=e.grep(i,function(e){return e.ServiceID==t.ServiceId&&3==e.ItemTypeID&&4==t.eventType||e.ServiceID==t.ServiceId&&1==e.ItemTypeID&&1==t.eventType}),n=e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){return e.autoId==t.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;0!=t.PromotionID&&(t.PromotionID=0,s=n[0].TotalPrice),0==o.IsAmount?l=_shopdetail.parseTodecimal(l+s*o.DiscountValue/100,2):(l=_shopdetail.parseTodecimal(l+o.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(l=parseFloat(ConvertTodecimalMorePrecious(parseFloat(l)/(1+t.Tax/100),!0,4))));var d=t.NoOfVisit;t.SellPackageServiceID>0&&(d=1),s-l<0&&(l=s),t.discount=null!=a?l:l*d,t.Price=_shopdetail.parseTodecimal(s*d-t.discount,2),t.ActualPrice=t.Price,t.calculatedTax=_shopdetail.parseTodecimal(t.Price*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_shopdetail.ApplyMultipleTax(t.Price,t),t.isPresetApply=!0,t.DiscountID=o.PromotionID,t.IsAmount=o.IsAmount,t.AmountValue=o.DiscountValue,1==t.IsRecurring&&(t.BillingCycle=o.BillingCycle,t.IsInitialDiscount=!1,t.InitialDiscount=0,t.IsAmountForInitialDiscount=!1),r=!0}}}),r},_shopdetail.ApplyPresetDiscountOnMemberships=function(t,i,a){var r=!1;return e.grep(t,function(t){if(null!=a&&t.autoId+"0"==a.autoId.toString()||null==a){var o=e.grep(i,function(e){return e.ServiceID==t.MembershipId&&7==e.ItemTypeID}),n=e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){return e.autoId==t.autoId});if(null!=o&&o.length>0){o=o[0];var s=n[0].Price,l=0;0!=t.PromotionID&&(t.PromotionID=0),0==o.IsAmount?l=_shopdetail.parseTodecimal(l+_shopdetail.parseTodecimal(s*o.DiscountValue/100,2),2):(l=_shopdetail.parseTodecimal(l+o.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&(l=parseFloat(ConvertTodecimalMorePrecious(parseFloat(l)/(1+t.Tax/100),!0,4)))),s<l&&(l=s),t.productDisc=l,t.Price=s,t.ActualPrice=_shopdetail.parseTodecimal(s-t.productDisc,2),t.calculatedTax=_shopdetail.parseTodecimal(t.ActualPrice*t.Tax/100,3),t.ActualTax=t.calculatedTax,t.BusinessTax=_shopdetail.ApplyMultipleTax(t.ActualPrice,t),t.isPresetApply=!0,t.DiscountID=o.PromotionID,t.IsAmount=o.IsAmount,t.AmountValue=o.DiscountValue,r=!0,1==t.IsRecurring&&(t.BillingCycle=o.BillingCycle,t.IsInitialDiscount=!1,t.InitialDiscount=0,t.IsAmountForInitialDiscount=!1),1==t.isGCApply&&0==t.Price&&_shopdetail.RemoveDiscount(CheckoutType.Membership,t.autoId)}}}),r},_shopdetail.RemovePromoCodeForMembership=function(t){void 0!==_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(i){var a=e.grep(_shopdetail.BookingDetail.lstPromotionData,function(e){return e.ServiceID==i.MembershipId&&7==e.ItemTypeID}),r=e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){return e.autoId==i.autoId});if(null!=a&&a.length>0){a=a[0];var o=r[0].Price;void 0!==i.isPresetApply&&1==i.isPresetApply&&i.DiscountID==t&&(i.productDisc=0,i.ActualPrice=_onlineCheckout.parseTodecimal(o,2),i.calculatedTax=_onlineCheckout.parseTodecimal(i.ActualPrice*i.Tax/100,3),i.ActualTax=i.calculatedTax,i.BusinessTax=_onlineCheckout.ApplyMultipleTax(i.ActualPrice,i),i.isPresetApply=!1,i.DiscountID=0,i.IsAmount=!1,i.AmountValue=0,i.BillingCycle=0)}}),void 0!==_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(i){var a=e.grep(_shopdetail.BookingDetail.lstPromotionData,function(e){return e.ServiceID==i.ServiceId&&3==e.ItemTypeID&&4==i.eventType||e.ServiceID==i.ServiceId&&1==e.ItemTypeID&&1==i.eventType}),r=e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){return e.autoId==i.autoId});if(null!=a&&a.length>0){a=a[0];var o=r[0].TotalPrice;void 0!==i.isPresetApply&&1==i.isPresetApply&&i.DiscountID==t&&(i.productDisc=0,i.ActualPrice=_shopdetail.parseTodecimal(o,2),i.Price=_shopdetail.parseTodecimal(o,2),i.calculatedTax=_shopdetail.parseTodecimal(i.ActualPrice*i.Tax/100,3),i.ActualTax=i.calculatedTax,i.BusinessTax=_shopdetail.ApplyMultipleTax(i.ActualPrice,i),i.isPresetApply=!1,i.DiscountID=0,i.IsAmount=!1,i.AmountValue=0,i.BillingCycle=0)}})},_shopdetail.RemovePromoCodeServiceError=function(t){e(t).parent().parent().hide()},_shopdetail.RemovePromoCodeService=function(t){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){var a=e.grep(_shopdetail.BookingDetail.lstPromotionData,function(e){return e.ServiceID==i.serviceid&&e.PromotionID==t&&1==e.ItemTypeID});if(null!=a&&a.length>0&&(a=a[0],void 0!==i.isPresetApply&&1==i.isPresetApply&&i.DiscountID==t)){e("#divPD_"+i.AppSrNo).html("");var r=0;if(1==i.IsMembershipApply){var o=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==i.MembershipID&&1==e.ItemType&&e.MembershipItemId==i.MembershipItemId});r=_shopdetail.parseTodecimal(i.ServiceOrginalPrice*o[0].Discount/100)}i.Discount=r,i.price=_shopdetail.parseTodecimal(i.ServiceOrginalPrice-r),i.isPresetApply=!1,i.DiscountID=0,i.IsAmount=!1,i.AmountValue=0,i.paidType==arrpaidType.Deposits&&_shopdetail.calculateDepositsPrepay(i),_shopdetail.BindDiscountOnItems(!1,i.AppSrNo,!1,!1,0,!1,i.priceOriginal,!1),_shopdetail.ValidateVPl(!0)}}),_shopdetail.RemovePromoCodeForMembership(t),_shopdetail.RemovePromoCodeAddonService(t),_shopdetail.RecalculateGCAfterPreset(!1),_shopdetail.ReApplyDiscounts(),_shopdetail.VPLCalculation();var i=e.grep(_shopdetail.BookingDetail.lstPromotionData,function(e){return e.PromotionID!=t});_shopdetail.BookingDetail.lstPromotionData=i,_shopdetail.RemovePromoCodeDiv(t)},_shopdetail.CreatePromoCodeDiv=function(t,i,a,r){1==r?e("#divApplyPromocodeService").prepend("<div id='divSPromoCode_"+t+"' class='promo-summercode'> <div class='promo-summercode-bg'><a class='font-awesome-light grid-close-icon promo-close-icon ' onclick ='_shopdetail.RemovePromoCodeService("+t+");'>&#xf00d;</a><span class='font-awesome-normal vg-green-text sign-icon'>&#xf058;</span> <span class='vg-green-text'>"+i+"</span><p class='text web-body-font web-builder-font-color'>"+a+"</p></div></div>"):e("#divApplyPromocodeService").prepend("<div id='divSPromoCode_0' class='promo-summercode divSPromoCode_0'> <div class='promo-summercode-error-bg'><a class='font-awesome-light grid-close-icon promo-close-icon ' onclick ='_shopdetail.RemovePromoCodeServiceError(this);'>&#xf00d;</a><span class='font-awesome-normal vg-red-text sign-icon'>&#xf057;</span> <span class='vg-red-text'>"+i+"</span><p class='text web-body-font web-builder-font-color'>"+a+"</p></div></div>")},_shopdetail.RemovePromoCodeDiv=function(t){e(e("#divSPromoCode_"+t)[0].firstElementChild.firstElementChild).empty(),e("#divSPromoCode_"+t).hide(),e("#divSPromoCode_"+t).attr("id","0")},_shopdetail.RemoveUnusedPromocode=function(t){var i=_shopdetail.BookingDetail.lstPromotionData.uniqueObjects(["PromotionID"]);e.grep(i,function(t){var i=!1;null!=_shopdetail.BookingDetail.AppointmentDetail&&_shopdetail.BookingDetail.AppointmentDetail.length>0&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)}),null!=_shopdetail.BookingDetail.AppointmentDetail&&_shopdetail.BookingDetail.AppointmentDetail.length>0&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(null!=SelectedAddonService&&SelectedAddonService.length>0&&null!=e.lstAddonService&&e.lstAddonService.length>0)for(var a=0;a<SelectedAddonService.length;a++)if(SelectedAddonService[a].MainServiceID==e.serviceid&&SelectedAddonService[a].SrNo==e.AppSrNo)for(var r=0;r<SelectedAddonService[a].lstAddonService.length;r++)void 0!==SelectedAddonService[a].lstAddonService[r].isPresetApply&&1==SelectedAddonService[a].lstAddonService[r].isPresetApply&&SelectedAddonService[a].lstAddonService[r].DiscountID==t.PromotionID&&(i=!0)}),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)}),null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){void 0!==e.isPresetApply&&1==e.isPresetApply&&e.DiscountID==t.PromotionID&&(i=!0)}),0==i&&_shopdetail.RemovePromoCodeService(t.PromotionID)})},_shopdetail.RecalculateGCAfterPreset=function(t){_shopdetail.BookingDetail.Prepay.gcAmt=0,_shopdetail.BookingDetail.Prepay.RedeemedByGCtemp=[],_shopdetail.BookingDetail.Prepay.RedeemedByGC=[];var i=JSON.parse(JSON.stringify(_shopdetail.BookingDetail.Prepay.lstGCpkgList)),a=e.grep(i,function(e,t){return!e.isPackage&&null!=e.serviceID&&1==e.assignStatus});if(null!=a&&a.length>0){var r={serviceID:"desc",GiftCertificateAmt:"asc"};a.keySort(r)}var o=e.grep(i,function(e,t){return!e.isPackage&&null==e.serviceID&&1==e.assignStatus});if(null!=o&&o.length>0){r={serviceID:"desc",GiftCertificateAmt:"asc"};o.keySort(r)}e("#divGiftCertificatelist > a").removeClass("w--current"),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){0==e.redeemAmount&&1!=t||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&0==e.IsPartialPoint||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||(e.redeemAmount=0,e.redeemTax=0,e.GCDetail=[],e.IsServiceBaseGC=!1,e.GCDetailPriceBase=[],e.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,_shopdetail.CalculateTax(e,_shopdetail.BookingDetail.Prepay.lstServiceDetails),_shopdetail.ApplyServiceBaseGCOnAppointment(e,a),_shopdetail.ApplyPriceBaseGCOnAppointment(e,o,!1))}),_shopdetail.ResetGCFromAddonsItems(o,t,a),null!=_shopdetail.BookingDetail.FeeDetails&&_shopdetail.BookingDetail.FeeDetails.length>0&&(e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){0==e.redeemAmount&&1!=t||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||(e.redeemAmount=0,e.redeemTax=0,e.GCDetail=[],e.GCDetailPriceBase=[],e.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount)}),_shopdetail.ApplyPriceBaseGCOnFees(_shopdetail.BookingDetail.FeeDetails,o)),_shopdetail.ResetMembershipUpsell(3),_shopdetail.ApplyPriceBaseGCOnMembershipUpSell(_shopdetail.BookingDetail.MembershipUpSellData,o),_shopdetail.ApplyPriceBaseGCOnMembershipUpSell(_shopdetail.BookingDetail.PackageUpSellData,o)},_shopdetail.ResetGCFromAddonsItems=function(t,i,a){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var r=0;r<SelectedAddonService.length;r++)if(SelectedAddonService[r].MainServiceID==e.serviceid&&SelectedAddonService[r].SrNo==e.AppSrNo)for(var o=0;o<SelectedAddonService[r].lstAddonService.length;o++){var n=SelectedAddonService[r].lstAddonService[o];0==n.redeemAmount&&1!=i||n.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&0==n.IsPartialPoint||n.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||(n.redeemAmount=0,n.redeemTax=0,n.GCDetail=[],n.IsServiceBaseGC=!1,n.GCDetailPriceBase=[],n.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,_shopdetail.CalculateTaxForAddon(n),_shopdetail.ApplyServiceBaseGCOnAddon(n,a),_shopdetail.ApplyPriceBaseGCOnAppointment(n,t,!0))}})},_shopdetail.RemoveDailyDealService=function(t){var i=0,a="";if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(r){if(r.PromotionId==t&&(void 0===r.isPresetApply||void 0!==r.isPresetApply&&1==r.isPresetApply)){r.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&(r.price=r.ServiceOrginalPrice,r.priceOriginal=r.ServiceOrginalPrice),r.PromotionId=0;var o=0;if(1==r.IsMembershipApply){var n=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==r.MembershipID&&1==e.ItemType&&e.MembershipItemId==r.MembershipItemId});o=_shopdetail.parseTodecimal(r.ServiceOrginalPrice*n[0].Discount/100)}r.Discount=o,r.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&(r.price=_shopdetail.parseTodecimal(r.ServiceOrginalPrice-r.Discount)),r.isPresetApply=!1,r.DiscountID=0,r.IsAmount=0,r.AmountValue=0,e("#divPricePoint_"+r.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(r.price)),e("#divPD_"+r.AppSrNo).html("").hide()}!String.isNullOrUndefineOrBlank(r.lstAddonService)&&r.lstAddonService.length>0&&e.grep(r.lstAddonService,function(o){if(o.PromotionID==t&&(void 0===o.isPresetApply||void 0!==o.isPresetApply&&1==o.isPresetApply)){o.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&(o.Price=o.OriginalPrice,o.priceOriginal=o.OriginalPrice),o.PromotionID=0;var n=0;if(1==o.IsMembershipApply){var s=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==o.MembershipID&&1==e.ItemType&&e.MembershipItemId==o.MembershipItemId});n=_shopdetail.parseTodecimal(o.OriginalPrice*s[0].Discount/100)}o.Discount=n,o.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&(o.Price=_shopdetail.parseTodecimal(o.OriginalPrice-o.Discount)),o.isPresetApply=!1,o.DiscountID=0,o.IsAmount=0,o.AmountValue=0,e("#divPricePoint_"+o.ServiceId+"_"+r.AppSrNo).html(_shopdetail.BookingDetail.CurrencySymbol+_shopdetail.decimalFormate(o.Price)),e("#divAddonPD_"+o.ServiceId+"_"+r.AppSrNo).html("").hide()}i+=o.Price,a=a+o.Price.format("#.##")+","}),i+=r.price,a=a+r.price.format("#.##")+","}),void 0!==_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){e.PromotionID==t&&(e.PromotionID=0,e.discount=0,e.isPresetApply=!1,e.DiscountID=0,e.IsAmount=0,e.AmountValue=0,e.ActualPrice=e.Price,e.calculatedTax=_shopdetail.parseTodecimal(e.ActualPrice*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_shopdetail.ApplyMultipleTax(e.ActualPrice,e),_shopdetail.DisplayMembershipUpSellItem(1))}),void 0!==_shopdetail.BookingDetail.PackageSellData&&null!=_shopdetail.BookingDetail.PackageSellData&&_shopdetail.BookingDetail.PackageSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageSellData,function(e){e.PromotionID==t&&(e.PromotionID=0,e.discount=0,e.isPresetApply=!1,e.DiscountID=0,e.IsAmount=0,e.AmountValue=0,e.ActualPrice=e.Price,e.calculatedTax=_shopdetail.parseTodecimal(e.ActualPrice*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_shopdetail.ApplyMultipleTax(e.ActualPrice,e),_shopdetail.DisplayMembershipUpSellItem(2))}),1==_IsPrepay||void 0!==_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0||void 0!==_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0)_shopdetail.RecalculateGCAfterPreset(!1),_shopdetail.isResetTip=!1,_shopdetail.ReApplyDiscounts();else{_shopdetail.BookingDetail.price=a.substring(0,a.length-1);var r=_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,i);e("#divServicesSubTotal").html(r),e("#divServicesTotalPrice").html(r),e("#divServicesTotalPrice_mobile").html(r),_shopdetail.DisplayMembershipUpSellItem(3)}},_shopdetail.isAdvancedUpload=function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&"FormData"in window},_shopdetail.bindAdvanceUpload=function(){if(iosDevices||iPadAndroid||isAndroidMobile||isWindowsPhone?(e(".notification-text-other").hide(),e(".or-reg").hide()):(e(".notification-text-other").show(),e(".or-reg").show()),_shopdetail.callJsForPhotoDesign(),_shopdetail.isAdvancedUpload()){var t=e("div.reviewProfile-bg div.reviewProfile");t.off(),t.on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}).on("dragover dragenter",function(){t.addClass("drag-drop-active")}).on("dragleave dragend drop",function(){t.removeClass("drag-drop-active")}).on("drop",function(i){ShowLoader(!0),glbdroppedFile=i.originalEvent.dataTransfer.files;var a=!0,r=glbdroppedFile[0];if("undefined"!=r&&null!=r){isValidFile(/(png|jpg|jpeg|PNG|JPG|JPEG|gif|bmp)$/i,r.name)||(e(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),_common.PassiveAlertWarning("Please select correct photo file.","#btnMyAccountReviwSend"),a=!1,ShowLoader(!1));try{if(a){var o=4194587;if(r.size>o){var n=parseFloat(4.0962763671875).toFixed(0);_common.PassiveAlertWarning("File size limit exceeds "+n+" MB.","#btnMyAccountReviwSend"),e(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),a=!1,ShowLoader(!1)}0==r.size&&(_common.PassiveAlertWarning("File size can not be 0","#btnMyAccountReviwSend"),e(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),a=!1,ShowLoader(!1))}}catch(i){a=!0}if(a){if(t.addClass("drag-drop-active").removeClass("drag-drop-error"),e(this).parent().find(".fileuplink").text("Choose File"),r){ShowLoader(!0);if(regex=new RegExp("[^.]+$"),"heic"==r.name.match(regex)[0].toLowerCase())return void _shopdetail.convertHEICToJPEG(r.name,r);var s=new FileReader;s.onload=function(e){_shopdetail.parseOrientation(_shopdetail.getOrientation(e.target.result),r,e.target.result)},s.readAsArrayBuffer(r)}t.removeClass("drag-drop-active"),e(".filetypeinput").val("")}}else ShowLoader(!1)}),e("#imageUpload,#imageuploadmobile").off(),e("#imageUpload,#imageuploadmobile").on("change",function(i){ShowLoader(!0),glbdroppedFile=!1;var a=!0,r=i.target.files[0];if("undefined"!=r&&null!=r){isValidFile(/(png|jpg|jpeg|PNG|JPG|JPEG|gif|bmp)$/i,r.name)||(e(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),_common.PassiveAlertWarning("Please select correct photo file.","#btnMyAccountReviwSend"),a=!1,ShowLoader(!1));try{if(a){var o=4194587;if(r.size>o){var n=parseFloat(4.0962763671875).toFixed(0);_common.PassiveAlertWarning("File size limit exceeds "+n+" MB.","#btnMyAccountReviwSend"),e(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),a=!1,ShowLoader(!1)}0==r.size&&(_common.PassiveAlertWarning("File size can not be 0","#btnMyAccountReviwSend"),e(this).closest(".reviewProfile").addClass("drag-drop-error").removeClass("drag-drop-active"),a=!1,ShowLoader(!1))}}catch(i){a=!0}if(a){if(e(this).parent().find(".fileuplink").text("Choose File"),t.addClass("drag-drop-active").removeClass("drag-drop-error"),r){ShowLoader(!0);if(regex=new RegExp("[^.]+$"),"heic"==r.name.match(regex)[0].toLowerCase())return void _shopdetail.convertHEICToJPEG(r.name,r);var s=new FileReader;s.onload=function(e){_shopdetail.parseOrientation(_shopdetail.getOrientation(e.target.result),r,e.target.result)},s.readAsArrayBuffer(this.files[0])}t.removeClass("drag-drop-active"),e(".filetypeinput").val(""),e(".filetypeinputformobile").val("")}}else ShowLoader(!1)}),e(".reviewProfile").click(function(){document.getElementById("imageUpload").click()}),e(".add-reviewbtn-bg").off(),e(".add-reviewbtn-bg").click(function(){document.getElementById("imageuploadmobile").click()})}},_shopdetail.SetAddImage=function(t,i,a,r){var o,n,s={};s.ImageInputStream=t,s.ImageName=i,s.ActionName="Add",s.temp_delete=!1,s.Image_Type=a,s.file=r,n=ReviewPhotoArray.push(s)-1;var l=e.grep(ReviewPhotoArray,function(e){return"Add"==e.ActionName||"Edit"==e.ActionName});l.length>0&&(o=l.length);var d=null!=navigator.userAgent.match(/iPad/i);o<3?!d&&iosDevices||isAndroidMobile||isWindowsPhone?e(".add-reviewbtn-bg").show():e("div.reviewProfile").css("display","flex"):!d&&iosDevices||isAndroidMobile||isWindowsPhone?e(".add-reviewbtn-bg").hide():e("div.reviewProfile").hide(),_shopdetail.setPhotoToViewer(t,i,null,o,n)},_shopdetail.setPhotoToViewer=function(t,i,a,r,o){for(var n=null,s=document.getElementsByClassName("review-gallery-image"),l=0;l<s.length;l++)if("none"===e(s[l]).css("background-image")){n=l;break}if(null!=n){e(s[n]).css("background-image","url("+t+")"),e(s[n]).attr("img_name",i),e(s[n]).attr("img_upload_name",a),e(s[n]).attr("position",o);var d=e(s[n]).closest(".review-editpic");e(d).show()}ShowLoader(!1)},e(".delete").click(function(t){var i=t.target,a=e(i).closest(".review-editpic"),r=e(i).closest(".review-gallery-image"),o=e(r).attr("img_name"),n=e(r).attr("img_upload_name"),s=e(r).attr("position");e(r).css("background-image","none"),e(i).closest(".review-editpic").hide(),null!=o&&null==n||null!=o&&null==n?(ReviewPhotoArray[s].ActionName="Delete",ReviewPhotoArray[s].temp_delete=!0):_shopdetail.deleteImage(n,s),!(null!=navigator.userAgent.match(/iPad/i))&&iosDevices||isAndroidMobile||isWindowsPhone?e(".add-reviewbtn-bg").show():e("div.reviewProfile").css("display","flex"),e(".reviewProfile-bg").append(e(a))}),_shopdetail.deleteImage=function(e,t){ReviewPhotoArray[t].ImageName=e,ReviewPhotoArray[t].ActionName="Delete",ReviewPhotoArray[t].temp_delete=!1},_shopdetail.resetImageControl=function(){ReviewPhotoArray=[],ReviewPhotoArrayFinal=[],e(".img1").css("background-image","none"),e(".img2").css("background-image","none"),e(".img3").css("background-image","none"),e(".review-gallery-image").removeAttr("img_name"),e(".eview-gallery-image").removeAttr("img_upload_name"),e(".review-editpic").hide(),!(null!=navigator.userAgent.match(/iPad/i))&&iosDevices||isAndroidMobile||isWindowsPhone?(e(".add-reviewbtn-bg").show(),e("div.reviewProfile").hide()):(e("div.reviewProfile").css("display","flex"),e(".add-reviewbtn-bg").hide()),e(".reviewProfile").removeClass("drag-drop-error"),e(".fileuplink").text("Choose File"),e(".filetypeinput").val(""),e(".reviewProfile-bg").append(e(".review_img1")),e(".reviewProfile-bg").append(e(".review_img2")),e(".reviewProfile-bg").append(e(".review_img3"))},_shopdetail.SetEditImage=function(t,i){var a=[];if(String.isNullOrUndefineOrBlank(t)||(a=t.split(",")),a.length>0)for(var r=0;r<a.length;r++){var o,n,s={};a[r]=a[r].replace(" ","");var l=i+"ReviewPhoto/Original/"+a[r];s.ImageInputStream=null,s.ImageName=a[r],s.ActionName="Edit",s.temp_delete=!1,s.Image_Type=null,n=ReviewPhotoArray.push(s)-1;var d=e.grep(ReviewPhotoArray,function(e){return"Edit"==e.ActionName});d.length>0&&(o=d.length);var c=null!=navigator.userAgent.match(/iPad/i);o<3?!c&&iosDevices||isAndroidMobile||isWindowsPhone?e(".add-reviewbtn-bg").show():e("div.reviewProfile").css("display","flex"):!c&&iosDevices||isAndroidMobile||isWindowsPhone?e(".add-reviewbtn-bg").hide():e("div.reviewProfile").hide(),_shopdetail.setPhotoToViewer(l,null,a[r],o,n)}},_shopdetail.callJsForPhotoDesign=function(){e("._3-dots-link-block").off("click"),e("._3-dots-link-block").click(function(){e(this).hasClass("active")?(e(this).removeClass("active"),e(this).next(".review-gallery-edit-dropdown").removeClass("show")):(e(this).addClass("active"),e(this).next(".review-gallery-edit-dropdown").addClass("show"))}),e(".review-gallery-image").off("hover"),e(".review-gallery-image").hover(function(){},function(){e(this).find("._3-dots-link-block").removeClass("active"),e(this).find(".review-gallery-edit-dropdown").removeClass("show")}),iPadAndroid?e("body").addClass("touchDevice"):e("body").addClass("desktop"),iPadAndroid&&(e("#gallery-sortable").removeClass("gallerySortable"),e("#gallery-sortable").addClass("gallerySortableipad"),e("body").off("on"),e("body").on("touchstart",".addphoto-reviewProfile .review-gallery-image",function(){e(this).hasClass("hover")||(e(".addphoto-reviewProfile .review-gallery-image").removeClass("hover"),e(".review-gallery-edit-dropdown").removeClass("show"),e(this).addClass("hover"))})),jQuery("#vg-wrapper").off("click"),jQuery("#vg-wrapper").on("click",function(t){1!=!e(t.target).closest(".review-gallery-image").length||e(t.target).hasClass("hover")||e(".addphoto-reviewProfile .review-gallery-image").removeClass("hover")})},_shopdetail.saveImagesOnAkamai=function(t,i,a,r,o,n){var s,l=t.split(","),d=0;s=e.grep(ReviewPhotoArray,function(e){return"Add"==e.ActionName});for(var c=0;c<s.length;c++)null!=l[c]&&"undefined"!=l[c]&&(formdata=new FormData,formdata.append("ImageName",l[c]),formdata.append("file",s[c].file),_shopdetail.upload("/AjaxFileHandler.ashx?type=saveReviewImage&businessId="+i+"&groupId="+a+"&userid="+n,formdata,function(e){++d==s.length&&(o?_siteBuilderDetail.CloseReviewPopup(!0):_shopdetail.CloseReviewPopup(!0),_common.PassiveAlertSuccess("Your review has been posted.","#btnAboutAddReview"),ShowLoader(!1))},function(e){}))},_shopdetail.addToFavorite=function(){var e=new vagaro.ajax;e.datamodel.Token="websiteapi/myaccount/addtofavorite";var t="add",i=groupID;if(void 0===i&&(i=""),_shopdetail.isFavorite)t="remove";data={},data.iBusinessID=_siteBuilderDetail.businessID,data.operation=t,data.sGroup=groupID,data.userId=UserID,e.datamodel.IsNewVagaroAPI=!0,e.datamodel.data=data,e.datamodel.callback=successBookmark,e.datamodel.Error=function(e){},e.Post()},_shopdetail.showFavorites=function(){var e=new vagaro.ajax;Data={},Data.businessID=_siteBuilderDetail.businessID,Data.loginUserID=UserID,e.datamodel.Token="websiteapi/homepage/showfavorites",e.datamodel.IsNewVagaroAPI=!0,e.datamodel.data=Data,e.datamodel.callback=OnSuccess_Favorite,e.datamodel.Error=function(e){},e.Post()},_shopdetail.setLoginControl=function(){null!=_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite||null!=_shopdetail.isFacebook&&"true"==_shopdetail.isFacebook||null!=_shopdetail.isWidget&&"true"==_shopdetail.isWidget?(e("#divCustomLogin").css("display",""),"true"==_shopdetail.isWidget&&"true"==_shopdetail.IsPopup&&e("#divCustomLogin").css("display","none"),null!=UserID&&null!=UserID&&""!=UserID?(e("#userloginLinks","#divLogin").css("display",""),e("#ulLogin","#divLogin").css("display","none"),e("#dvUsernameCustom","#divLogin").html("Welcome, "+FullUserName),e("#lnkCalenderCustom","#divLogin").length>0?e("#divCalendarLink","#divLogin").css("display",e("#lnkCalenderCustom","#divLogin").css("display")):e("#divCalendarLink","#divLogin").css("display","none")):(e("#dvUsernameCustom","#divLogin").html(""),e("#userloginLinks","#divLogin").css("display","none"),e("#ulLogin","#divLogin").css("display",""))):e("#divCustomLogin").css("display","none"),glbRes=null,gblEventCCRes=null,isCCRequest=!1},_shopdetail.upload=function(t,i,a,r){t=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/"+t,e.ajax({type:"POST",contentType:!1,processData:!1,dataType:"json",url:t,data:i,complete:a,error:r})};var o=String.fromCharCode,n=/\.\d*(?:0|9){12}\d*$/i;_shopdetail.normalizeDecimalNumber=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return n.test(e)?Math.round(e*t)/t:e},_shopdetail.arrayBufferToDataURL=function(e,t){var i=new Uint8Array(e),a="";if("function"==typeof i.forEach)i.forEach(function(e){a+=o(e)});else for(var r=i.length,n=0;n<r;n+=1)a+=o(i[n]);return"data:"+t+";base64,"+btoa(a)},_shopdetail.getStringFromCharCode=function(e,t,i){var a="",r=void 0;for(i+=t,r=t;r<i;r+=1)a+=o(e.getUint8(r));return a},_shopdetail.getOrientation=function(e){var t=new DataView(e),i=void 0,a=void 0,r=void 0,o=void 0;if(255===t.getUint8(0)&&216===t.getUint8(1))for(var n=t.byteLength,s=2;s<n;){if(255===t.getUint8(s)&&225===t.getUint8(s+1)){r=s;break}s+=1}if(r){var l=r+4,d=r+10;if("Exif"===_shopdetail.getStringFromCharCode(t,l,4)){var c=t.getUint16(d);if(((a=18761===c)||19789===c)&&42===t.getUint16(d+2,a)){var u=t.getUint32(d+4,a);u>=8&&(o=d+u)}}}if(o){var p=t.getUint16(o,a),h=void 0,m=void 0;for(m=0;m<p;m+=1)if(h=o+12*m+2,274===t.getUint16(h,a)){h+=8,i=t.getUint16(h,a),t.setUint16(h,1,a);break}}return i},_shopdetail.parseOrientation=function(e,t,i){var a=0,r=1,o=1;switch(e){case 2:r=-1;break;case 3:a=-180;break;case 4:o=-1;break;case 5:a=90,o=-1;break;case 6:a=90;break;case 7:a=90,r=-1;break;case 8:a=-90;break;default:return _shopdetail.SetAddImage(_shopdetail.arrayBufferToDataURL(i,"image/jpeg"),t.name,t.type,t)}var n={};n.rotate=a,n.scaleX=r,n.scaleY=o;var s=_shopdetail.arrayBufferToDataURL(i,"image/jpeg");return n.url=s,_shopdetail.createImage(n,t)},_shopdetail.createImage=function(e,t){var i=new Image;i.onload=function(){e.naturalWidth=i.naturalWidth,e.naturalHeight=i.naturalHeight;var a=e.naturalWidth,r=e.naturalHeight,o=e.rotate,n=void 0===o?0:o,s=e.scaleX,l=void 0===s?1:s,d=e.scaleY,c=void 0===d?1:d,u=document.createElement("canvas"),p=u.getContext("2d"),h=a,m=r,f=-h/2,g=-m/2,v=h,A=m;u.width=_shopdetail.normalizeDecimalNumber(h),u.height=_shopdetail.normalizeDecimalNumber(m);return p.fillStyle="transparent",p.fillRect(0,0,h,m),p.save(),p.translate(h/2,m/2),p.rotate(n*Math.PI/180),p.scale(l,c),p.drawImage(i,Math.floor(_shopdetail.normalizeDecimalNumber(f)),Math.floor(_shopdetail.normalizeDecimalNumber(g)),Math.floor(_shopdetail.normalizeDecimalNumber(v)),Math.floor(_shopdetail.normalizeDecimalNumber(A))),_shopdetail.SetAddImage(u.toDataURL(),t.name,t.type,t)},i.alt=t.name,i.src=e.url},_shopdetail.createGiftCertificatessubTotal=function(){_shopdetail.SetGCStatus(null,s.Default);var t=_shopdetail.BookingDetail.Prepay.RedeemedByGC.uniqueObjects(["giftcertificateId"]),i=[];return e.grep(t,function(t){var a=0;if(t.Type==CheckoutBarcodeCodePrepay.GC){var r={};r.giftCertificateNoLast=t.giftCertificateNo.substr(t.giftCertificateNo.length-4),r.CurrencySymbol=_shopdetail.currencySymbol,e.grep(_shopdetail.BookingDetail.Prepay.RedeemedByGC,function(e){t.giftcertificateId==e.giftcertificateId&&(a=_shopdetail.parseTodecimal(a+e.redeemAmt))});r.redeemAmt=a,i.push(r),e('[id="gcNo_'+t.giftCertificateNo+'"]').addClass("w--current"),_shopdetail.SetGCStatus(t.giftcertificateId,s.Add)}}),i},_shopdetail.createGiftCertificates=function(t,i){var a=_shopdetail.BookingDetail.servicename.toLowerCase().trim().split("||~||");e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){null!=t.lstAddonService&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){a.push(e.ServiceTitle.toLowerCase().trim())})}),e("#divGiftCertificate").show();var r=[];null!=t&&t.length>0&&e.grep(t,function(e,t){if(1==e.eventType||7==e.eventType){var i={};i.giftCertificateNo=e.giftCertificateNo,i.giftCertificateID=e.giftCertificateID,i.giftCertificateNoLast=e.giftCertificateNo.substr(e.giftCertificateNo.length-4),i.currentBalance=e.currentBalance,i.CurrencySymbol=_shopdetail.currencySymbol,i.AvailabeVisit="("+e.quantity+" "+(e.quantity>1?"visits":"visit")+")",i.isservicebase=!0,r.push(i)}}),null!=i&&i.length>0&&e.grep(i,function(e,t){var i={},a=e.giftCertificateNo;i.giftCertificateNo=a||"",i.giftCertificateID=e.giftCertificateID||0,i.giftCertificateNoLast="string"==typeof a&&a.length>=4?a.slice(-4):"",i.currentBalance=e.currentBalance,i.CurrencySymbol=_shopdetail.currencySymbol,i.AvailabeVisit="",i.isservicebase=!1,r.push(i)}),e("#divGiftCertificatelist").html(""),r.length>0?(e("#divGiftCertificate").show(),e("#divGiftCertificatelist").html(""),e("#tmplGiftCertificatelist").tmpl(r).appendTo("#divGiftCertificatelist"),1==r.length?e('[id="gcNo_'+r[0].giftCertificateNo+'"]').addClass("only-one"):e('[id="gcNo_'+r[0].giftCertificateNo+'"]').removeClass("only-one"),e(_shopdetail.tabAddGiftCards).removeClass("giftcard-shipping-method")):e(_shopdetail.tabAddGiftCards).addClass("giftcard-shipping-method")},_shopdetail.SetGCStatus=function(t,i){e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e){(e.giftCertificateID==t||null==t&&i==s.Default)&&(e.assignStatus=i)})};var s={Default:0,Add:1,Remove:2};function l(t){var i,a,r=t.data;if(void 0!==t&&null!=t&&(_shopdetail.numberofDays=t.data.length),_shopdetail.lastAppBookingDate=r[r.length-1],null!=r&&r.length>0&&""==r[0]&&(r[0]=(new Date).format("MMM dd,yyyy"),IsDateAdded=!0),null!=r&&r.length>0&&(new Date(moment(r[0])._d),(i=new Date(moment(r[r.length-1])._d)).setDate(i.getDate()+1),a=new Date(i),a=_shopdetail.getSunday(a),a=new Date(a.setDate(a.getDate()+6)),0==IsDateAdded))for(var o=i;o<=a;o.setDate(o.getDate()+1))r.push(o.format("MMM dd,yyyy"));destroydatepicker({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:r,callBackOnChange:dateChanged,contentWindow:datePicker_contentWindow,isApplyInWidget:!0,scrollMonth:!1}),applydatepicker({divid:"#divSearchDate",textid:"#txtdivSearchDate",parentID:"#divSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:r,callBackOnChange:dateChanged,contentWindow:datePicker_contentWindow,isApplyInWidget:!0,scrollMonth:!1}),null!=r&&r.length>0&&(SalonsAvailableDates=r,e("#hdnFirstAvailDate").val(r[0]),""!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime&&null!=_shopdetail.bookingDateTime&&setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(moment(_shopdetail.bookingDateTime)._d))),_shopdetail.isCalenderFilled=!0,_shopdetail.LoadSliderDatePicker(r),SetData(_shopdetail.serviceID,_shopdetail.providerID,_shopdetail.styleID,_shopdetail.styleName,_shopdetail.bookingDateTime,_shopdetail.PromotionID,_shopdetail.EventType,_shopdetail.PromotionProviderID,_shopdetail.bookingDateTime),_shopdetail.ClearBook24()}_shopdetail.ManageGC=function(t){if(null!=t){var i=e('[id="'+t.id+'"]').data("gcid"),a=e('[id="'+t.id+'"]').data("isservicebase"),r=_shopdetail.GetTotalAmountforDeposits(),o=!1,n=_shopdetail.IsDailyDealsAppliedInItem();e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(l){l.giftCertificateID==i&&(e('[id="'+t.id+'"]').hasClass("w--current")?(o=!0,a=!1,l.assignStatus=s.Remove,l.currentBalance=String.isNullOrUndefineOrBlank(l.ResetcurrentBalance)?l.currentBalance:l.ResetcurrentBalance,e('[id="'+t.id+'"]').removeClass("w--current"),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){if(l.serviceID>0&&t.GCDetail.length>0&&t.GCDetail[0].giftcertificateId==i?(t.IsServiceBaseGC=!1,t.GCDetail=[],r>=_shopdetail.BookingDetail.DepositsLimit||n?0==_shopdetail.BookingDetail.DepositAmtType&&100!=_shopdetail.BookingDetail.DepositsPer&&t.price>0||1==_shopdetail.BookingDetail.DepositAmtType&&_shopdetail.BookingDetail.DepositsPer<t.price?_shopdetail.calculateDepositsPrepay(t):t.paidType=arrpaidType.Paid:1==t.IsMembershipApply?t.paidType=arrpaidType.PartiallyPaid:0==t.Discount&&(t.paidType=arrpaidType.UnPaid)):t.GCDetailPriceBase.length>0&&(t.GCDetailPriceBase=e.grep(t.GCDetailPriceBase,function(e){return e.giftcertificateId!=i})),null!=SelectedAddonService&&SelectedAddonService.length>0)for(var a=0;a<SelectedAddonService.length;a++)if(SelectedAddonService[a].MainServiceID==t.serviceid&&SelectedAddonService[a].SrNo==t.AppSrNo)for(var o=0;o<SelectedAddonService[a].lstAddonService.length;o++){var s=SelectedAddonService[a].lstAddonService[o];s.GCDetailPriceBase.length>0&&(s.GCDetailPriceBase=e.grep(s.GCDetailPriceBase,function(e){return e.giftcertificateId!=i}))}}),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(t){t.GCDetailPriceBase.length>0&&(t.GCDetailPriceBase=e.grep(t.GCDetailPriceBase,function(e){return e.giftcertificateId!=i}))}),null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(t){t.GCDetailPriceBase.length>0&&(t.GCDetailPriceBase=e.grep(t.GCDetailPriceBase,function(e){return e.giftcertificateId!=i}))})):_shopdetail.BookingDetail.Prepay.ccAmt>0||l.serviceID>0?(o=!0,l.assignStatus=s.Add):_shopdetail.BookingDetail.TipAmount>0?_common.PassiveAlertfail("Amount Due could not be Paid with this gift card.",t):_common.PassiveAlertfail("Unable to add another gift card because the amount due is zero."))}),1==o&&(_shopdetail.RemoveVCFFee(),_shopdetail.RecalculateGCAfterPreset(!0),_shopdetail.ReApplyDiscounts(),1==a&&0==e('[id="'+t.id+'"]').hasClass("w--current")&&_common.PassiveAlertfail("Amount Due could not be Paid with this gift card.",t)),_shopdetail.VPLCalculation(),_shopdetail.IsVCFEnable()&&(_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.ApplyGC),setTimeout(function(){var e=_shopdetail.BookingDetail.TipAmount;_shopdetail.DisplayTotalDueWithTip(e)},1e3))}},_shopdetail.DisplayTotalDueWithTip=function(t){var i=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML.replace("$","");e("#dvservicesPrepaypricewithoutGC")[0].innerHTML="Free"==i?_shopdetail.currencySymbol+_onlineCheckout.ConvertDecimalWithFixed(_shopdetail.parseTodecimal(t),!0,2):_shopdetail.currencySymbol+_onlineCheckout.ConvertDecimalWithFixed(_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt)+_shopdetail.parseTodecimal(t),!0,2)},_shopdetail.BindGCpromoPrice=function(t,i){var a=t.data("GCPromoList"),r=e.grep(a,function(e){return parseFloat(i)==parseFloat(e.Price)});r.length>0?(i=r[0].Price,t.select2("data",{id:r[0].id,text:r[0].text+" ("+r[0].promotext+")"}),e("#div_amount").html("$"+i.toFixed(2).replace(".00",""))):1==e.isNumeric(i)&&parseFloat(i)>0?parseFloat(i)>999999?(t.select2("data",{id:"",text:""}),e("#div_amount").html(""),e("#dvVPLGc").hide(),e("#VPLImageaftr1").css("display","none"),e("#VPLImageBfr1").css("display","none"),e("#VPLImageBfr").css("display","none"),e("#dvservicemsg").css("display","none"),e("#VPLImageaftr").css("display","none")):(i.indexOf(".")>0&&(i=parseFloat(i).toFixed(2)),e("#div_amount").html("$"+i.replace(".00","")),t.select2("data",{id:i,text:i})):(t.select2("data",{id:"",text:""}),e("#div_amount").html(""))},_shopdetail.ValidateOnePerUserDeal=function(t){if(void 0!==PromotionDetails&&!String.isNullOrUndefineOrBlank(PromotionDetails))var i=e.grep(PromotionDetails,function(e,t){return e.PerTransactionOne});if(void 0!==i&&null!=i){if(1==t){t=!1;var a=[];if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(e.PromotionId>0&&0===e.price){var i=(a[e.PromotionId]||0)+1;a[e.PromotionId]=i,2===i&&(t=!0)}}),0==t)return}var r=e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){return(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC)&&e.PromotionId>0});if(null!=r&&r.length>1&&i.length>0){var o=[];if(e.grep(i,function(t){var i=e.grep(r,function(e){return e.PromotionId==t.PromotionID});i.length>1&&(o=e.extend(!0,[],i))}),o.length>0){var n,s=0;e.grep(o,function(e){e.ServiceOrginalPrice-e.priceOriginal>s&&(s=e.ServiceOrginalPrice-e.priceOriginal,n=e)}),e.grep(o,function(e){e.AppSrNo!=n.AppSrNo&&_shopdetail.RemoveDealOnItem(e.AppSrNo)})}}e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(i.PromotionId>0&&i.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&i.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){1==t&&0==i.price&&(i.ApplyDiscoutType=ApplyDiscoutTypePrepay.OnePerDealDiscount);var a=e.grep(PromotionDetails,function(e){return i.PromotionId==e.PromotionID});e("#divPD_"+i.AppSrNo).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Daily Deal Applied ('+a[0].PromotionTitle+")</span></div>").show()}!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(t){if(t.PromotionID>0&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){var a=e.grep(PromotionDetails,function(e){return t.PromotionID==e.PromotionID});e("#divAddonPD_"+t.ServiceId+"_"+i.AppSrNo).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Daily Deal Applied ('+a[0].PromotionTitle+")</span></div>").show()}})})}e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(i.PromotionId>0&&i.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&i.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){1==t&&0==i.price&&(i.ApplyDiscoutType=ApplyDiscoutTypePrepay.OnePerDealDiscount);var a=e.grep(PromotionDetails,function(e){return i.PromotionId==e.PromotionID});e("#divPD_"+i.AppSrNo).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Daily Deal Applied ('+a[0].PromotionTitle+")</span></div>").show()}!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(t){if(t.PromotionID>0&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){var a=e.grep(PromotionDetails,function(e){return t.PromotionID==e.PromotionID});e("#divAddonPD_"+t.ServiceId+"_"+i.AppSrNo).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Daily Deal Applied ('+a[0].PromotionTitle+")</span></div>").show()}})})},_shopdetail.ValidateAddOnPerUserDeal=function(t){if(void 0!==PromotionDetails&&!String.isNullOrUndefineOrBlank(PromotionDetails))var i=e.grep(PromotionDetails,function(e,t){return e.PerTransactionOne});if(void 0!==i&&null!=i){if(1==t){t=!1;var a=[];if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var i=0;i<SelectedAddonService.length;i++)if(SelectedAddonService[i].MainServiceID==e.serviceid&&SelectedAddonService[i].SrNo==e.AppSrNo)for(var r=0;r<SelectedAddonService[i].lstAddonService.length;r++){var o=SelectedAddonService[i].lstAddonService[r];if(o.PromotionId>0&&0===o.Price){var n=(a[o.PromotionId]||0)+1;a[o.PromotionId]=n,2===n&&(t=!0)}}}),0==t)return}var r=[];e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var t=0;t<SelectedAddonService.length;t++)if(SelectedAddonService[t].MainServiceID==e.serviceid&&SelectedAddonService[t].SrNo==e.AppSrNo)for(var i=0;i<SelectedAddonService[t].lstAddonService.length;i++){var a=SelectedAddonService[t].lstAddonService[i];a.AppSrNo=SelectedAddonService[t].SrNo,(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount||a.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC)&&a.PromotionID>0&&(r.push(a),a.IsPromotionInService=e.PromotionId==parseInt(a.PromotionID))}});if(null!=r&&r.length>0&&i.length>0){var o=[];if(e.grep(i,function(t){var i=e.grep(r,function(e){return parseInt(e.PromotionID)==t.PromotionID});(i.length>1||1==i.length&&1==i[0].IsPromotionInService)&&(0==o.length?o=e.extend(!0,[],i):e.merge(o,i))}),o.length>0)for(var n=[],s=o.filter(function(e){return!n.includes(parseInt(e.PromotionID))&&(n.push(parseInt(e.PromotionID)),!0)}),l=0;l<s.length;l++){var d=o.filter(e=>parseInt(e.PromotionID)==parseInt(s[l].PromotionID));if(!String.isNullOrUndefineOrBlank(d)){var c,u=0;e.grep(d,function(e){e.OriginalPrice-e.Price>u&&(u=e.OriginalPrice-e.Price,c=e)}),e.grep(d,function(e){var t=_shopdetail.BookingDetail.AppointmentDetail.filter(t=>t.PromotionId==parseInt(e.PromotionID));(e.ServiceId!=c.ServiceId||e.AppSrNo!=c.AppSrNo||!String.isNullOrUndefineOrBlank(t)&&t.length>0)&&_shopdetail.RemoveAddonDealOnItem(e.AppSrNo,e.ServiceId)})}}}e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var a=0;a<SelectedAddonService.length;a++)if(SelectedAddonService[a].MainServiceID==i.serviceid&&SelectedAddonService[a].SrNo==i.AppSrNo)for(var r=0;r<SelectedAddonService[a].lstAddonService.length;r++){var o=SelectedAddonService[a].lstAddonService[r];if(o.PromotionId>0&&o.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&o.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){1==t&&0==o.Price&&(o.ApplyDiscoutType=ApplyDiscoutTypePrepay.OnePerDealDiscount);var n=e.grep(PromotionDetails,function(e){return o.PromotionId==e.PromotionID});e("#divAddonPD_"+o.ServiceId+"_"+SelectedAddonService[a].SrNo).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Daily Deal Applied ('+n[0].PromotionTitle+")</span></div>").show()}}})}e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(null!=SelectedAddonService&&SelectedAddonService.length>0)for(var a=0;a<SelectedAddonService.length;a++)if(SelectedAddonService[a].MainServiceID==i.serviceid&&SelectedAddonService[a].SrNo==i.AppSrNo)for(var r=0;r<SelectedAddonService[a].lstAddonService.length;r++){var o=SelectedAddonService[a].lstAddonService[r];if(o.PromotionId>0&&o.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&o.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points){1==t&&0==o.Price&&(o.ApplyDiscoutType=ApplyDiscoutTypePrepay.OnePerDealDiscount);var n=e.grep(PromotionDetails,function(e){return o.PromotionId==e.PromotionID});e("#divAddonPD_"+o.ServiceId+"_"+SelectedAddonService[a].SrNo).html('<div class="applied-green-part thm-textColor badge-button-positive"><div class="sign-icon">&#xf058;</div><span class="green-text"> Daily Deal Applied ('+n[0].PromotionTitle+")</span></div>").show()}}})},_shopdetail.HideCCDetailPopup=function(){e("#divCCDetail").modal("hide"),glbRes=null},_shopdetail.EnableDisableButton=function(t){1==t?(e("#btnAppointment").prop("disabled",!1),e("#btnAppointmentWithCC").prop("disabled",!1)):(e("#btnAppointment").prop("disabled",!0),e("#btnAppointmentWithCC").prop("disabled",!1))},_shopdetail.setSelected=function(t,i){_shopdetail.activeTabName=i,(_shopdetail.VisibleControlLength("#mobile-check")>0||void 0!==iPadAndroid&&iPadAndroid)&&e("html, body").scrollTop(0),"undefined"!=typeof vgAppicationType&&1==vgAppicationType?0==("undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp)?flagBackButton&&i.toLowerCase()!=DefaultTabPage?(e("#mobileBack").show(),e("#custmobileBack").hide()):(e("#mobileBack").hide(),e("#custmobileBack").show(),(1==IsBrandedApp&&1==IsSingleBusinessBrandedApp||1==_siteBuilderDetail.isFromAppClip)&&(e("#mobileBack").hide(),e("#custmobileBack").hide())):i.toLowerCase()!=DefaultTabPage?(e("#mobileBack").show(),e("#custmobileBack").hide()):(e("#mobileBack").hide(),e("#custmobileBack").show(),(1==IsBrandedApp&&1==IsSingleBusinessBrandedApp||1==_siteBuilderDetail.isFromAppClip)&&(e("#mobileBack").hide(),e("#custmobileBack").hide())):e("#mobile-check").is(":visible")&&flagBackButton&&(i.toLowerCase()!=DefaultTabPage||0==(void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite)?(e("#mobileBack").show(),e("#custmobileBack").hide()):(e("#mobileBack").hide(),e("#custmobileBack").hide())),"book-now"!=i.toLowerCase()&&e("#mobileBack").data("backtabname",""),flagBackButton=!0,addPageHistoryWinApp(BasePage,i,vagaroUrl),setTimeout(function(){/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||("undefined"!=e(_vagaroConnect.controls.chatFrame)&&"undefined"!=e("#chatFrame")&&e(_vagaroConnect.controls.chatFrame).is(":visible")&&e("#chatFrame").hasClass("vc-iframeCustomer")&&!e("#chatFrame").hasClass("vc-iframeCustomer_minimize")&&e("#chatWindow").height()/e("#chatWindow").parent().height()*100+"%"!="100%"?e("#chatWindow").css("height","100%"):"undefined"!=e(_vagaroConnect.controls.chatFrame)&&"undefined"!=e("#chatFrame")&&e(_vagaroConnect.controls.chatFrame).is(":visible")&&e("#chatFrame").hasClass("vc-iframeCustomer")&&e("#chatFrame").hasClass("vc-iframeCustomer_minimize")&&e("#chatWindow").height()/e("#chatWindow").parent().height()*100+"%"!="98%"&&e("#chatWindow").css("height","98%")),"about"==i?(e("body").addClass("busAbouttab"),Webflow.require("lightbox").ready(),e("#divbusinessatab").css("cursor","pointer")):(e("body").removeClass("busAbouttab"),e(".w-lightbox").off(".w-lightbox"),e("#divbusinessatab").css("cursor",""))},500)},_shopdetail.onSPchange=function(){"0"==e("select#ddlSP option:selected").val()?e("#ddSPReview").css("display","none"):(e("#ddSPReview").css("display",""),e(".field-label.spname").text("Leave a review for "+e("#ddlSP option:selected").text()+" (optional):"),e("#txtSPComments").attr("placeholder",e("#ddlSP option:selected").text()+" appreciates your feedback."))},_shopdetail.HideShowDisableBookMessageForApps=function(t){t?(e("#divBlockBookMessageForApps").show(),e("#divSearch").hide(),e("#divClassAppResult").hide(),e("#divCustomMessage").hide()):(e("#divBlockBookMessageForApps").hide(),void 0!==e("#divCustomMessage").data("IsBookingDisabled")&&1==e("#divCustomMessage").data("IsBookingDisabled")?(e("#divCustomMessage").show(),e("#divSearch").hide()):e("#divSearch").show())},_shopdetail.getSunday=function(e){var t=(e=new Date(e)).getDay(),i=e.getDate()-t;return new Date(e.setDate(i))};var d=null;_shopdetail.LoadSliderDatePicker=function(t){if(e("#dvDateSlider").data("availabedates",JSON.stringify(t)),!(_shopdetail.VisibleControlLength("#dvDateSlider")<=0)){e("#divClassAppResult").show(),e("#slider-data").html(""),e("#slider-data").unslick(),Days="";var i=null==getdatepickervalue("#txtdivSearchDate",null,!0,!0)?(new Date).format("MMM dd,yyyy"):getdatepickervalue("#txtdivSearchDate",null,!0,!0).format("MMM dd,yyyy"),a=_shopdetail.getSunday((new Date).toDateString()),r=new Date(t[t.length-1]);r=_shopdetail.getSunday(r),r=new Date(r.setDate(r.getDate()+6));var o=e("#DateTemplates").html();AvailableMinDate=t.length>0?new Date(t[0]):new Date,AvailableMaxDate=new Date(r);var n=new Date(t[t.length-1]);n.setDate(n.getDate()+1);for(var s=n;s<=r;s.setDate(s.getDate()+1))t.push(s.format("MMM dd,yyyy"));i=null==getdatepickervalue("#txtdivSearchDate",null,!0,!0)?new Date(t[0]).format("MMM dd,yyyy"):getdatepickervalue("#txtdivSearchDate",null,!0,!0).format("MMM dd,yyyy");new Date(i)<AvailableMinDate&&(i=new Date(AvailableMinDate),setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(moment(i)._d))),new Date(i)>AvailableMaxDate&&(i=new Date(AvailableMaxDate),setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},new Date(moment(i)._d)));for(var l=a;l<=r;l.setDate(l.getDate()+1)){var d=l,c=(new Date(d).format("MMM dd,yyyy"),o),u=new Date(d).getDay(),p=new Date(d).getDate();c=e.inArray(d.format("MMM dd,yyyy"),t)>=0&&0==IsDateAdded?(c=c.replace("{{selectedClass}}","enabled")).replace("{{onclickcall}}","SetSelectedDate(this);"):(c=c.replace("{{selectedClass}}","inactive")).replace("{{onclickcall}}","return false;");var h=dayNames[u],m=dayFullNames[u];c=(c=(c=(c=c.replace("{{availableDate}}",d.format("MMM dd,yyyy"))).replace("{{Weekday}}",h)).replace("{{WeekdayFull}}",m)).replace("{{day}}",p),Days+=c}e("#slider-data").append(Days),e("#slider-data .inactive").attr("aria-hidden",!0);var f=new Date(AvailableMinDate);f=null!=getdatepickervalue("#txtdivSearchDate",null,!0,!0)?getdatepickervalue("#txtdivSearchDate",null,!0,!0):new Date(i),e("#slider-data").slick({infinite:!1,slidesToShow:7,speed:800,prevArrow:'<div tabindex="0" data-role="none" class="owl-prev font-awesome-light" onclick="_shopdetail.bounceDateControl(this,0);" role="link" aria-label="previous">&#xF104;</div>',nextArrow:'<div tabindex="0" data-role="none" class="owl-next font-awesome-light" onclick="_shopdetail.bounceDateControl(this,1);" role="link" aria-label="next">&#xF105;</div>',onAfterChange:function(e,t){"Next"!=e.CurrentSlideDirection&&"Prev"!=e.CurrentSlideDirection||_shopdetail.ChangeWeek(e,t)},slidesToScroll:7,responsive:[{settings:{arrows:!1}}]}),e("#hdmnthname").html(monthNames[(new Date).getMonth()]),SetSliderDate(f,!0)}},_shopdetail.bounceDateControl=function(t,i){1==e(t).hasClass("slick-disabled")&&(0==i?e("#slider-data").animate({left:"+=50px"},400,"easeOutSine",function(){e("#slider-data").animate({left:0},600,"easeOutBounce")}):e("#slider-data").animate({right:"+=50px"},400,"easeOutSine",function(){e("#slider-data").animate({right:0},600,"easeOutBounce")}))},_shopdetail.ChangeWeek=function(t,i){var a=new Date,r=getdatepickervalue("#txtdivSearchDate",null,!0,!0);if(null!=r&&(a=r)<AvailableMinDate&&(a=new Date(AvailableMinDate)),"Next"==t.CurrentSlideDirection){a=new Date(a.setDate(a.getDate()+7));AvailableMaxDate<a&&(a=new Date(AvailableMaxDate))}else if("Prev"==t.CurrentSlideDirection){a=new Date(a.setDate(a.getDate()-7));AvailableMinDate>a&&(a=new Date(AvailableMinDate))}var o=a,n=e("#date-slider-container .slick-active");0==n.hasClass("selected")&&(o=new Date(n.eq(0).data().availdate)),o<d&&(o=d),SetSliderDate(o,!1)},_shopdetail.SetBookData=function(t,i,a,r,o,n,s,l,d){var c=!1;if(void 0!==l&&null!=l&&1==l&&(c=l),void 0!==getCookie("IsPaid")&&""!=getCookie("IsPaid")&&"True"==getCookie("IsPaid")){"undefined"!=typeof IsRescheduleAppointment&&"True"==IsRescheduleAppointment||clearCookie("IsPaid"),"undefined"!=typeof IsRescheduleAppointment&&"True"!=IsRescheduleAppointment&&(IsRescheduleAppointment="False"),"undefined"!=typeof lAppID&&(lAppID=""),void 0!==IsPaid&&(IsPaid="False");try{e("#txtSP1").length>0&&e("#txtSP1").select2("enable"),e("#txtService1").length>0&&e("#txtService1").select2("enable")}catch(e){}}_shopdetail.serviceID=t,_shopdetail.providerID=i,_shopdetail.styleID=a,_shopdetail.styleName=r,_shopdetail.bookingDateTime=o,_shopdetail.PromotionID=n,_shopdetail.EventType=s,_shopdetail.PromotionProviderID=d,IsBundle="5"==s,glbBundleId="5"==s?t:0,e("#ucServiceCombo_hidEventType").val("1"),e("#divEventCartDetail").hide(),e("#divAvailableGCPackageDetail").hide(),_shopdetail.VisibleControlLength("#divCustomMessage")<=0&&e("#divSearch").show(),e(".vg-dropdown-parent").is(":visible")&&(e(".vg-dropdown-parent").hide(),e(".vg-dropdown-parent").parent().removeClass("active-vg-dropdown"),e(".vg-dropdown-parent").attr("aria-expanded",!1),e(".vg-dropdown-parent").removeClass("active-drop-vg")),(null==t||""==t||0==parseInt(t))&&null!=i&&""!=i&&i>0&&(_shopdetail.isClassCalenderFilled=!1),_common.LoadBookNowMenu(LoadMenuTypeEnum.booknow,!1,c)},e(document).on("click","#divSearch .dropdowndiv",function(){"Detail"==BasePage&&null!=navigator.userAgent&&navigator.userAgent.match(/iPad/i)&&e("html,body").scrollTop(0)}),e(document).on("click","#divcreditCardWrapper .dropdowndiv, #bodyExceptionDetail1 .dropdowndiv ",function(){"Detail"==BasePage&&null!=navigator.userAgent&&navigator.userAgent.match(/iPad/i)&&e("html,body").addClass("scrollhidden")}),_shopdetail.ApplySelect2Controls=function(t,i){void 0!==i.placeholder&&""!=i||((i={}).dropdownCssClass="",i.isSearchRequire=!1,i.selectOnClick=!0,i.placeholder="",i.maxInputLen=100),void 0===i.maxInputLen&&(i.maxInputLen=100),"2"==t.data("type")&&void 0!==i.data&&_shopdetail.bindMobileOptions(i.data,t.attr("id"),""),t.select2("destroy"),t.off("selected"),t.off("select2-close"),t.select2({searchInputPlaceholder:void 0!==i.placeholder&&""!=i.placeholder?i.placeholder:"",combobox:i.isSearchRequire,collapasable:_shopdetail.VisibleControlLength("#mobile-check")>0&&i.collapasable,selectOnClick:!0,minimumInputLength:0,maximumInputLength:100,dropdownCssClass:i.dropdownCssClass,formContainer:"#page-wrapper",data:function(){if(void 0!==i.data){if("GCPromo"==t.data("type")){var a=getCookie("Referral");void 0!==a&&""!=a&&null!=a&&null!=a||(i.data=i.data.filter(e=>0==e.IsDailyDealApply))}var r=e.extend(!0,[],i.data),o=e.extend(!0,[],i.data);if("GCPromo"==t.data("type")&&t.data("GCPromoList",o),"2"==t.data("type")){var n=e("#txtService"+t.data("section")).data("choice");if(""!=n)try{var s=JSON.parse(n);s.hasOwnProperty("id")&&""!=s.id&&(r=_shopdetail.FilterSP(o,s))}catch(e){}var l={id:"-1"};_shopdetail.activeTabName==ClassTabName?l.text="Select Any Instructor":l.text="Select Any Provider",l.cssClass="currentlocation-icon",l.type="Any",r.splice(0,0,l)}else if("1"==t.data("type")){var d=e("#txtSP"+t.data("section")).data("choice");if(""!=d)try{var c=JSON.parse(d);if(c.hasOwnProperty("id")&&""!=c.id&&(r=_shopdetail.FilterService(o,c)),_shopdetail.activeTabName==ClassTabName){l={id:"-1",text:"Select Any Class",cssClass:"currentlocation-icon",type:"Any"};r.splice(0,0,l)}}catch(e){}}return{results:r}}return null},initSelection:function(e,t){},formatResult:function(e){var i=_shopdetail.ServicePromotionforNewCustomer(e),a=getCookie("Referral");return(void 0===a||""==a||null==a||null==a)&&e.IsDailyDealApply?1==e.hasOwnProperty("eventType")&&void 0!==e.IsZoomIntegrated&&1==e.IsZoomIntegrated?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+e.text+'</div> <div class="w-inline-block font-awesome solid sm-booknow-video">&#xf03d;<div></div>':1==e.hasOwnProperty("eventType")&&void 0!==e.isOutCallService&&1==e.isOutCallService?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+e.text+'</div> <div class="w-inline-block font-awesome solid sm-car-icon">&#xf1b9;<div></div>':markup=e.text:"GCPromo"==t.data("type")&&void 0!==e.promotext&&""!=e.promotext?markup='<div class="promodigittextrow"> <div class="w-inline-block">'+e.text+' <span class="promo-bold">('+(1==e.isCurrencySymbol?currencySymbol+e.promotext:e.promotext)+")</span></div></div>":1==e.hasOwnProperty("eventType")&&void 0!==e.promotext&&""!=e.promotext&&1==i?void 0!==e.IsZoomIntegrated&&1==e.IsZoomIntegrated?markup='<div class="promodigittextrow deal-booking-dropdown dd-booking-dropdown srv-drp-bedge"> <div class="service-namepromo w-inline-block">'+e.text+'</div><div><div class="promo-digit percent-off-text w-inline-block badge-button-positive srv-drp-bedge"> <div class="vg-service-video"><em>&#xf02b</em>'+(1==e.isCurrencySymbol?currencySymbol+e.promotext:e.promotext)+'</div></div></div><div class="w-inline-block font-awesome solid sm-booknow-video dd-font-awesome-icon">&#xf03d;<div></div></div></div>':1==e.hasOwnProperty("eventType")&&void 0!==e.isOutCallService&&1==e.isOutCallService?markup='<div class="promodigittextrow deal-booking-dropdown dd-booking-dropdown srv-drp-bedge"> <div class="service-namepromo w-inline-block">'+e.text+'</div><div><div class="promo-digit percent-off-text w-inline-block badge-button-positive srv-drp-bedge"> <div class="vg-service-video"><em>&#xf02b</em>'+(1==e.isCurrencySymbol?currencySymbol+e.promotext:e.promotext)+'</div></div></div><div class="w-inline-block font-awesome solid sm-car-icon dd-font-awesome-icon">&#xf1b9;<div></div></div></div>':markup='<div class="promodigittextrow deal-booking-dropdown dd-booking-dropdown srv-drp-bedge"> <div class="service-namepromo w-inline-block">'+e.text+'</div><div><div class="promo-digit percent-off-text w-inline-block badge-button-positive srv-drp-bedge"> <div class="vg-service-video"><em>&#xf02b</em>'+(1==e.isCurrencySymbol?currencySymbol+e.promotext:e.promotext)+"</div></div> </div></div></div>":1==e.hasOwnProperty("eventType")&&void 0!==e.IsZoomIntegrated&&1==e.IsZoomIntegrated?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+e.text+'</div> <div class="w-inline-block font-awesome solid sm-booknow-video">&#xf03d;<div></div>':1==e.hasOwnProperty("eventType")&&void 0!==e.isOutCallService&&1==e.isOutCallService?markup='<div class="promodigittextrow"><div class="service-namepromo w-inline-block">'+e.text+'</div> <div class="w-inline-block font-awesome solid sm-car-icon">&#xf1b9;<div></div>':markup=e.text,markup},matcher:function(i,a,r){var o=/\s\s+/g,n=/[^0-9a-zA-Z\" \"]+/gi,s=/[^0-9a-zA-Z\"\. \"]+/gi;if("1"==t.data("type")){var l=i.lastIndexOf("(");-1!=l&&(i=i.substring(0,l-1))}else if("2"==t.data("type")&&("Select Any Provider"==a||"Select Any Instructor"==a))return!0;for(var d=i.replace(o," "),c=(d="GCPromo"==t.data("type")?d.toLowerCase().replace(s,""):d.toLowerCase().replace(n,"")).split(" "),u="",p=c.length,h=0,m=0;m<=c.length-1;m++){var f=a.replace(o," ");if(((f="GCPromo"==t.data("type")?f.toLowerCase().replace(s,""):f.toLowerCase().replace(n,"")).match("^"+c[m])||-1!=f.indexOf(" "+c[m]))&&((""==u||c[m].indexOf(u)<0)&&(h+=1),u=" "+f,h>=p))break}return h>=p&&("#txtGCPromoAmount"==t.selector&&e("#select2-drop").show(),r.isShow=!0,!0)},formatNoMatches:function(){if("#txtGCPromoAmount"!=t.selector)return e(".select2-results .select2-no-results").remove(),"No matches found";e("#select2-drop").hide()}}).on("selected",function(i){if(glbBundleId=0,_common.closeServiceSelection(),"book-now"!=_shopdetail.activeTabName&&("txtService5"==i.currentTarget.id||"txtSP5"==i.currentTarget.id))return"txtService5"==i.currentTarget.id?-1==i.choice.id?e("#hdnClassIDForClass").val(""):e("#hdnClassIDForClass").val(i.choice.id):"txtSP5"==i.currentTarget.id&&(-1==i.choice.id?e("#hdnInstructorIDForClass").val(""):e("#hdnInstructorIDForClass").val(i.choice.id)),_shopdetail.FillClassDatesForClass(),_shopdetail.bindMobilefilterdata(t,i.choice),e(i.target).data("selecteddetail",JSON.stringify(i.choice)),void(void 0!==t.data("choice")&&_common.SetChoiceForSeleect2(t,i.choice));if("GCPromo"==t.data("type")&&(_shopdetail.bindMobilefilterdata(t,i.choice),e(i.target).data("selecteddetail",JSON.stringify(i.choice)),void 0!==t.data("choice")&&_common.SetChoiceForSeleect2(t,i.choice)),"1"==t.data("type")){e("#hdnStyleID").val(""),_shopdetail.PromotionID="",clearCookie("PromotionID"),e("#hdnPromotionID").val("");var a=!1;if(void 0!==t.data("isstatic")){var r=null,o=e("#txtService1").data("selecteddetail");if(""!=o)try{r=JSON.parse(o).eventType}catch(i){r=null}(null!=r&&i.choice.eventType!=r||i.choice.eventType==arrEventType.ServiceBundle)&&(_shopdetail.RemoveAllControls(),i.choice.eventType,arrEventType.Service,1==_shopdetail.isClassCalenderFilled&&i.choice.eventType==arrEventType.Class&&(a=!0)),null==r||(r!=arrEventType.ServiceBundle&&r!=arrEventType.Service||i.choice.eventType!=arrEventType.Class)&&(r!=arrEventType.Class||i.choice.eventType!=arrEventType.ServiceBundle&&i.choice.eventType!=arrEventType.Service)||i.choice.eventType!=arrEventType.ServiceBundle&&i.choice.eventType!=arrEventType.Service||HideShowClassServiceAndClearControl(!1)}if(_shopdetail.SetControls(i.choice.eventType),HideShowWaitlistButton(!1),i.choice.eventType==arrEventType.ServiceBundle?(e(".bookservicecontainer").addClass("vagaro-service-mobile-search-icon"),glbBundleId=i.choice.id,e("#divSearch").addClass("no-serviceselection"),e("#mobile-appointments").prop("checked",!1),e("#dvOutCallSection").hide(),e("#Book24Container").hide(),e("#ucServiceCombo_hidEventType").val(""),_shopdetail.SetServiceBundle(i.choice.id),_shopdetail.GetAvailibilityForService(!0,!1),_shopdetail.CheckServiceIsAddonsBundle(i.choice.id,i.choice.text,i.choice.photo,i.choice.serviceDesc,i.choice.isShowPriceOnline)):(e(".bookservicecontainer").removeClass("vagaro-service-mobile-search-icon"),_shopdetail.bindMobilefilterdata(t,i.choice),e("#divSearch").removeClass("no-serviceselection"),e("#ucServiceCombo_hidEventType").val(i.choice.eventType.toString()),_shopdetail.AddServiceButtonDisplay(),e("#Book24Container").hide(),e("#dvtimezone").hide()),i.choice.eventType==arrEventType.Service){if(1==_shopdetail.OutCallCalculation(t.data("section"),i.choice)&&(_common.SetAddonForSeleect2(t,[]),e(i.target).data("selecteddetail",JSON.stringify(i.choice)),void 0!==t.data("choice"))){if(_common.SetChoiceForSeleect2(t,i.choice),e("#txtSP"+t.data("section")).select2("enable"),1==OnlindBookingResponse.lstOnlineServiceProviderDetail.length){e("#txtSP"+t.data("section")).select2("disable"),e("#txtSP"+t.data("section")).select2("data",{id:OnlindBookingResponse.lstOnlineServiceProviderDetail[0].id,text:OnlindBookingResponse.lstOnlineServiceProviderDetail[0].text});var n=OnlindBookingResponse.lstOnlineServiceProviderDetail[0].id;_shopdetail.GetAddOnServiceDetail("cboServiceProviderWaitlist_Search"+t.data("section"),n)}else{var s="#cboServiceProviderWaitlist_Search"+t.data("section"),l=e(s+" > option").length+1!=e(s+" :selected").length&&0!=e(s+" :selected").length?e(s).val().join(","):"";n=0;n=l=l.split(","),_shopdetail.GetAddOnServiceDetail("cboServiceProviderWaitlist_Search"+t.data("section"),n),BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search"+t.data("section"),l)}_shopdetail.GetAvailibilityForService(!1,!1)}}else e(i.target).data("selecteddetail",JSON.stringify(i.choice)),void 0!==t.data("choice")&&_common.SetChoiceForSeleect2(t,i.choice);i.choice.eventType==arrEventType.Class&&(e("#dvOutCallSection").hide(),HideShowClassServiceAndClearControl(!0),1==a?_shopdetail.FillClassDates(!1):(_shopdetail.isClassCalenderFilled=!1,_shopdetail.FillClassDates(!0)))}else"2"==t.data("type")&&"-1"!=i.val&&_shopdetail.onProviderSelect(e(i.target),i.choice)}).on("select2-opening",function(i){t.select2("data",{id:"",text:""}),"txtGCPromoAmount"==i.currentTarget.id&&e("#"+i.currentTarget.id).data("selecteddetail","")}).on("select2-open",function(a){var r=_common.GetChoiceForSeleect2(t);void 0!==r.id&&"txtGCPromoAmount"!=a.currentTarget.id&&t.select2("data",{id:r.id,text:r.text}),(void 0===i.selectAllText||i.selectAllText)&&setTimeout(function(){e(a.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100),(e(a.target).attr("id").indexOf("txtService")>=0||"GCPromo"==t.data("type"))&&("GCPromo"==t.data("type")&&(e("#dvInnerGCContainer").length&&e("#dvInnerGCContainer").addClass("gc-transformnone"),e(a.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common")),e(a.target).closest(".service-book-what").addClass("book-service-open"),setTimeout(function(){e("html, body").addClass("moboverflow-hide")},200),e("#select2-drop-mask").addClass("hidemask"),(void 0===i.scrollTop||i.scrollTop)&&setTimeout(function(){e("html, body").scrollTop(0)},50),(void 0===i.selectAllText||i.selectAllText)&&setTimeout(function(){e(a.target).parent("div").find(".select2-input").get(0).setSelectionRange(0,9999)},100))}).on("change",function(e){if(void 0!==t.data("choice")&&"2"==t.data("type")&&!t.data("select2").opened()){var i=t.data("select2").getVal().toString(),a=_common.GetChoiceForSeleect2(t);""!=i&&void 0!==a.id&&""!=a.id||"txtSP5"!=e.currentTarget.id&&(_shopdetail.GetAvailibilityForService(!1,!0),_siteBuilderDetail.GCVPLText(a.PriceAfterDiscount,3))}}).on("select2-close",function(i){if(_common.closeServiceSelection(),e("#select2-drop-mask").removeClass("hidemask"),setTimeout(function(){e("#select2-drop-mask").off("touchstart.custom")},500),void 0!==t.data("choice")){var a=t.data("select2").getVal().toString(),r=_common.GetChoiceForSeleect2(t);if(""!=a&&"Select Any Provider"!=a&&"Select Any Instructor"!=a&&"Select Any Class"!=a&&void 0!==r.id){var o=getCookie("Referral");if(void 0===o||""==o||null==o||null==o)if(r.IsDailyDealApply)if("1"==t.data("type")&&1==r.hasOwnProperty("eventType")){s=t.selector;e(s).hide()}else"GCPromo"==t.data("type")?(e(".txtAmounterrortext").hide(),e("#txtGCPromoAmount").removeClass("errorInput"),a==r.text?(t.select2("data",{id:r.id,text:r.text+" ("+r.promotext+")"}),"txtGCPromoAmount"==i.currentTarget.id&&(e("#div_amount").html("$"+r.Price.toFixed(2).replace(".00","")),_siteBuilderDetail.GCVPLText(r.PriceAfterDiscount,3))):(_siteBuilderDetail.GCVPLText(a,3),_shopdetail.BindGCpromoPrice(t,a))):t.select2("data",{id:r.id,text:r.text});else{var n=!0;try{"1"==t.data("type")&&1==r.hasOwnProperty("eventType")&&void 0!==r.promotext&&""!=r.promotext&&1==r.hasOwnProperty("promotionID")&&(n=_shopdetail.ServicePromotionforNewCustomer(r))}catch(i){}if("1"==t.data("type")&&1==r.hasOwnProperty("eventType")&&void 0!==r.promotext&&""!=r.promotext&&1==n)t.select2("data",{id:r.id,text:r.text+" ("+(1==r.isCurrencySymbol?currencySymbol+r.promotext:r.promotext)+")"}),s=(s=t.selector).replace("txtService","divdd-select-search"),e(".service-namepromo",s).html(r.text),e(".promo-digit",s).html('<div class="vg-service-video"><em></em>'+(1==r.isCurrencySymbol?currencySymbol+r.promotext:r.promotext)+"</div>"),e(s).show(),_shopdetail.SyncDealBadgeWithLastMinute(r.id);else if("1"==t.data("type")&&1==r.hasOwnProperty("eventType")){var s=t.selector;e(s).hide()}else"GCPromo"==t.data("type")?(e(".txtAmounterrortext").hide(),e("#txtGCPromoAmount").removeClass("errorInput"),a==r.text?(t.select2("data",{id:r.id,text:r.text+" ("+r.promotext+")"}),"txtGCPromoAmount"==i.currentTarget.id&&(e("#div_amount").html("$"+r.Price.toFixed(2).replace(".00","")),_siteBuilderDetail.GCVPLText(r.PriceAfterDiscount,3))):(_siteBuilderDetail.GCVPLText(a,3),_shopdetail.BindGCpromoPrice(t,a))):t.select2("data",{id:r.id,text:r.text})}else{n=!0;try{"1"==t.data("type")&&1==r.hasOwnProperty("eventType")&&void 0!==r.promotext&&""!=r.promotext&&1==r.hasOwnProperty("promotionID")&&(n=_shopdetail.ServicePromotionforNewCustomer(r))}catch(i){}if("1"==t.data("type")&&1==r.hasOwnProperty("eventType")&&void 0!==r.promotext&&""!=r.promotext&&1==n)t.select2("data",{id:r.id,text:r.text+" ("+(1==r.isCurrencySymbol?currencySymbol+r.promotext:r.promotext)+")"}),s=(s=t.selector).replace("txtService","divdd-select-search"),e(".service-namepromo",s).html(r.text),e(".promo-digit",s).html('<div class="vg-service-video"><em></em>'+(1==r.isCurrencySymbol?currencySymbol+r.promotext:r.promotext)+"</div>"),e(s).show(),_shopdetail.SyncDealBadgeWithLastMinute(r.id);else if("1"==t.data("type")&&1==r.hasOwnProperty("eventType")){s=t.selector;e(s).hide()}else"GCPromo"==t.data("type")?(e(".txtAmounterrortext").hide(),e("#txtGCPromoAmount").removeClass("errorInput"),a==r.text?(t.select2("data",{id:r.id,text:r.text+" ("+r.promotext+")"}),"txtGCPromoAmount"==i.currentTarget.id&&(e("#div_amount").html("$"+r.Price.toFixed(2).replace(".00","")),_siteBuilderDetail.GCVPLText(r.PriceAfterDiscount,3))):(_siteBuilderDetail.GCVPLText(a,3),_shopdetail.BindGCpromoPrice(t,a))):t.select2("data",{id:r.id,text:r.text})}""==r.id&&_shopdetail.bindMobilefilterdata(e("#txtSP"+t.data("section")),null)}else"GCPromo"==t.data("type")?(_shopdetail.BindGCpromoPrice(t,a),_siteBuilderDetail.GCVPLText(a,3)):t.select2("data",{id:"",text:""}),_shopdetail.bindMobilefilterdata(e("#txtSP"+t.data("section")),null),_common.SetDefaultForSeleect2(t)}(iPadAndroid||isWindowsPhone)&&(1==("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase())?document.activeElement.blur():e("#ancSearchbook:visible").focus())}),(t.attr("id").indexOf("txtService")>=0||"GCPromo"==t.data("type"))&&t.on("select2-focus",function(a){setTimeout(function(){"GCPromo"==t.data("type")&&(e("#dvInnerGCContainer").length&&e("#dvInnerGCContainer").addClass("gc-transformnone"),e(a.target).closest("div:not(.service-mob-commoninput)").addClass("book-service-open-common")),e(a.target).closest(".service-book-what").addClass("book-service-open"),e("#select2-drop-mask").addClass("hidemask"),e("html, body").addClass("moboverflow-hide"),(void 0===i.scrollTop||i.scrollTop)&&e("html, body").scrollTop(0)},200)}),applyJqueryScroll(".select2-results")},_shopdetail.HidePopup=function(){_shopdetail._bookingCheckoutPageVisitedLogged=!1,IsNewAddressHtml=!1,_siteBuilderDetail.IsShowNewadd=!1;var t=getQueryStringData("IsFromNotification");void 0!==t&&null!=t&&""!=t||(t="0");var i=getQueryStringData("Type");if("OnBoarding"==i&&"0"==t)e("#Onboard-BookNow-back").show();else{var a=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();"OnBoarding"==i&&"1"==t&&null!=a&&/com.vagaro.iospro/i.test(a)||/com.vagaro.androidpro/i.test(a)?e("#Onboard-BookNow-back").show():e("#Onboard-BookNow-back").hide()}void 0!==ShowLoader&&ShowLoader(!1),e(".familycktfrnd ul").empty(),e(".familycktfrndlistPopup").off("click"),e("#hdnSelSPID").val(""),_shopdetail.EnableDisableButton(!0),e("#dvOnlineBooking").hide(),e("#chkIsMailSendTextPreview").prop("checked",!1),e("#lblCancellationPolicy").removeClass("label-error").css("color",""),e("#divForms").hide(),e("#divCheckoutScreen").show(),istabnavDivShow&&(e("#tabnav").show(),istabnavDivShow=!1),istopBannerSectionDivShow&&(e("#topBannerSection").show(),istopBannerSectionDivShow=!1),isdivSearchDivShow&&(e("#divSearch").show(),isdivSearchDivShow=!1),isdivClassAppResultDivShow&&(e("html").addClass("bookingappointment1"),e("html").removeClass("bookingappointment3"),e("#divClassAppResult").show(),isdivClassAppResultDivShow=!1),isdivCustomMessageDivShow&&(e("#divCustomMessage").show(),isdivCustomMessageDivShow=!1),isfooterdivDivShow&&(e("#footerdiv").show(),isfooterdivDivShow=!1),ispushdivDivShow&&(e("#pushdiv").show(),ispushdivDivShow=!1),DisplayFullView(!1),e("body").removeClass("book-checkout"),e("html, body").scrollTop(0),document.referrer.toLowerCase().indexOf("customerapprule.html")>-1&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&_common.AddState("","customerapprule"),_onlineCheckout.isCheckoutVPLChanged=!1,_shopdetail.SyncDealBadgeWithLastMinute()},_shopdetail.SyncDealBadgeWithLastMinute=function(t){if("function"==typeof updateDealDiscountBadge&&void 0!==PromotionDetails&&null!=PromotionDetails&&""!=PromotionDetails)try{e("input[id^='txtService']").each(function(){var i=e(this).data("selecteddetail");if(i&&""!==i&&"{}"!==i){var a="string"==typeof i?JSON.parse(i):i;if(a&&a.id&&(void 0===t||null==t||""==t||a.id==t)){var r;for(var o in LastMinuteBookedMap)if(0===o.indexOf(a.id+"_")){r=LastMinuteBookedMap[o];break}void 0!==r&&updateDealDiscountBadge(a.id,PromotionDetails,r)}}})}catch(e){}},_shopdetail.ClearBook24=function(){_shopdetail.serviceID="",_shopdetail.providerID="",_shopdetail.styleID="",_shopdetail.styleName="",_shopdetail.bookingDateTime="",_shopdetail.EventType=null,clearCookie("ProviderID"),clearCookie("StyleID"),clearCookie("StyleName"),clearCookie("BookingDate"),clearCookie("BookingTime"),clearCookie("BusinessPackageID"),clearCookie("AppointmentID"),clearCookie("IsFromReschedual"),clearCookie("IsClassSelected"),IsFromCreateLink||(clearCookie("ServiceID"),clearCookie("AddonServicIds"),clearCookie("AddonAppointmentIds"),clearCookie("MultiProviderID"),clearCookie("UniqueCreateLink"),clearCookie("EventType"),clearCookie("IsReBookAppointment")),void 0!==isClassSelected&&(isClassSelected="false"),"undefined"!=typeof isFromReschedual&&(isFromReschedual="false"),clearCookie("EventSessionAttendeesId"),clearCookie("PromotionPIds"),ShowLoader(!1)},_shopdetail.CheckCustomerExists=function(){var e=new vagaro.ajax;e.datamodel.async=!1,e.datamodel.Token=ApiURLEnumBooking.checkuserexistsbyuserid,e.datamodel.IsNewVagaroAPI=!0,e.datamodel.data={loginUserID:UserID,businessID:_shopdetail.businessID},e.datamodel.callback=function(e){IsForNewCustomer=1!=e},e.datamodel.Error=function(e){},e.Post()},_shopdetail.LoadClassDataOnline=function(t){var i=new Date;if(void 0!==e("#hdnStartDateForClass")&&""!=e("#hdnStartDateForClass").val()&&(i=new Date(e("#hdnStartDateForClass").val())),document.getElementById("apgSearchProgressForClass").style.display="",void 0!==t&&null!=t&&_shopdetail.VisibleControlLength("#divmainEventdetailForClass")<=0){e("#divmainEventdetailForClass").show();try{_shopdetail.LoadClassSliderDatePickerForClass(t)}catch(e){}}bkEvent.model.csvServiceID=e("#hdnClassIDForClass").val(),bkEvent.model.csvSPID=e("#hdnInstructorIDForClass").val(),bkEvent.model.csvSPID=""==bkEvent.model.csvSPID?"0":bkEvent.model.csvSPID,bkEvent.model.csvFilterType=e(_shopdetail.ddlFilterTypes).val();var a=_shopdetail.getSunday(new Date(i));i.format("MMM dd,yyyy")!=a.format("MMM dd,yyyy")&&(i=new Date(a));var r=new Date(i),o=new Date(_shopdetail.lastClassBookingDate);r.setDate(i.getDate()+6),r>o&&(r=o);var n=e("#date-class-slider-containerForClass").find("[data-availdatestart='"+i.format("MMM dd,yyyy")+"'],[data-availdateend='"+r.format("MMM dd,yyyy")+"']");n.length>0&&(e("#date-class-slider-containerForClass .selected").removeClass("selected"),e(n).addClass("selected"),e("#hdnStartDateForClass").val(new Date(i)),e("#hdnEndDateForClass").val(new Date(r)),_shopdetail.LoadClassDataForClassTab())},_shopdetail.weeks_between=function(e,t){var i=_shopdetail.getSunday(new Date);i=new Date(i.setDate(i.getDate()-1));var a=e.getTime(),r=i.getTime(),o=Math.abs(a-r),n=Math.floor(o/6048e5);return 1==n?"Next Week":n>1?"In "+n+" Weeks":"This Week"},_shopdetail.ChangeWeek=function(t,i){var a=new Date,r=getdatepickervalue("#txtdivSearchDate",null,!0,!0);if(null!=r&&(a=r)<AvailableMinDate&&(a=new Date(AvailableMinDate)),"Next"==t.CurrentSlideDirection){a=new Date(a.setDate(a.getDate()+7));AvailableMaxDate<a&&(a=new Date(AvailableMaxDate))}else if("Prev"==t.CurrentSlideDirection){a=new Date(a.setDate(a.getDate()-7));AvailableMinDate>a&&(a=new Date(AvailableMinDate))}var o=a,n=e("#date-slider-container .slick-active");0==n.hasClass("selected")&&(o=new Date(n.eq(0).data().availdate)),o<d&&(o=d),SetSliderDate(o,!1)},_shopdetail.bindMobilefilterdata=function(t,i){if(_shopdetail.VisibleControlLength("#mobile-check")>0){var a="";null!=OnlindBookingResponseForClass&&_shopdetail.activeTabName==ClassTabName?a=e.extend(!0,[],OnlindBookingResponseForClass.lstOnlineServiceProviderDetail):null!=OnlindBookingResponse&&(a=e.extend(!0,[],OnlindBookingResponse.lstOnlineServiceProviderDetail));var r=null;r=null==i?a:_shopdetail.FilterSP(a,i);var o=e("#txtSP"+t.data("section")+"Mobile").val();_shopdetail.bindMobileOptions(r,"txtSP"+t.data("section"),o)}},_shopdetail.GetSelectedCGDetail=function(t,i){var a=e.grep(t,function(e){return e.id==i});return a.length>0?a[0]:null},_shopdetail.onMobileProviderchange=function(t){var i=e(t).attr("id"),a=e("#"+i+" option:selected").text(),r=e("#"+i+" option:selected").val(),o={};o.id=r,o.text=a;var n=e("#"+i.replace("Mobile",""));""==o.id&&(o.text=""),n.select2("data",o),_common.SetChoiceForSeleect2(n,o),_shopdetail.activeTabName==ClassTabName&&"txtSP5Mobile"==i?(e("#hdnInstructorIDForClass").val(o.id),_shopdetail.FillClassDatesForClass()):_shopdetail.onProviderSelect(n,o)},_shopdetail.onProviderSelect=function(e,t){e.data("selecteddetail",JSON.stringify(t)),void 0!==e.data("choice")&&_common.SetChoiceForSeleect2(e,t),_shopdetail.isExistsServiceProviderForSameTime(e),_shopdetail.GetAvailibilityForService(!1,!0)},_shopdetail.bindMobileOptions=function(t,i,a){for(var r="",o=0;o<t.length;o++)r+="<option selected value="+t[o].id+">"+t[o].text+"</option>";_shopdetail.activeTabName==ClassTabName?r="<option selected value='' selected='selected'>Any Instructor</option>"+r:t.length>1&&(r="<option selected value='' selected='selected'>Any Professional</option>"+r),_shopdetail.activeTabName!=ClassTabName&&1==t.length?(e("#"+i+"Mobile").empty().append(r),e("#"+i+"Mobile").prop("disabled",!0)):(e("#"+i+"Mobile").empty().append(r).val(a),e("#"+i+"Mobile").prop("disabled",!1))},_shopdetail.isExistsServiceProviderForSameTime=function(t){var i=e("#txtService1").data("choice"),a=!1;if(""!=i){try{var r=[],o=JSON.parse(i);if(o.hasOwnProperty("id")&&""!=o.id&&o.eventType==arrEventType.ServiceBundle){if(null!=o.lstServiceBundleDetail&&o.lstServiceBundleDetail.length>0&&(a=2==o.lstServiceBundleDetail[0].isServicePerformAtSameTime),1==a)for(var n=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,s=2;s<=n;s++){var l=e("#txtSP"+s).data("choice");if(""!=l)try{var d=JSON.parse(l);d.hasOwnProperty("id")&&""!=d.id&&r.push(d.id)}catch(e){}}}if(1==a)for(s=0;s<=r.length;++s)for(var c=s+1;c<=r.length;++c)if(""!=r[c]&&""!=r[s]&&r[s]==r[c])return vagaro.alert("Services in this service bundle could not be booked with same provider.Please select different Provider for All Services."),t.select2("data",{id:"",text:""}),e(t.selector+"Mobile").val(""),_common.SetDefaultForSeleect2(t),!1}catch(e){return!0}return!0}},_shopdetail.FilterService=function(t,i){return null!=OnlindBookingResponseForClass&&_shopdetail.activeTabName==ClassTabName?e.grep(t,function(t){if(-1==i.id)return!0;var a=e.grep(OnlindBookingResponseForClass.lstOnlineServiceAndProviderMapping,function(e){return e.serviceProviderID==i.id&&e.serviceID==t.id});return null!=a&&a.length>0}):e.grep(t,function(t){if(t.eventType!=arrEventType.ServiceBundle){var a=e.grep(t.children,function(t){var a=e.grep(OnlindBookingResponse.lstOnlineServiceAndProviderMapping,function(e){return e.serviceProviderID==i.id&&e.serviceID==t.id});return null!=a&&a.length>0});return null!=a&&a.length>0&&(t.children=a,!0)}return!0})},_shopdetail.FilterSP=function(t,i){return e.grep(t,function(t){var a=null;if(null!=OnlindBookingResponseForClass&&_shopdetail.activeTabName==ClassTabName){if(-1==i.id)return!0;a=e.grep(OnlindBookingResponseForClass.lstOnlineServiceAndProviderMapping,function(e){return e.serviceProviderID==t.id&&e.serviceID==i.id})}else null!=OnlindBookingResponse&&(a=e.grep(OnlindBookingResponse.lstOnlineServiceAndProviderMapping,function(e){return e.serviceProviderID==t.id&&e.serviceID==i.id}));return null!=a&&a.length>0})},_shopdetail.FilterSPMulti=function(t,i,a){return e.grep(t,function(t){var r=null;if(null!=OnlindBookingResponseForClass&&_shopdetail.activeTabName==ClassTabName){if(-1==(void 0===i.id?i.serviceId:i.id))return t.isServiceProvide=!0,!0;r=e.grep(OnlindBookingResponseForClass.lstOnlineServiceAndProviderMapping,function(e){return e.serviceProviderID==(void 0===t.id?t.ServiceProviderID:t.id)&&e.serviceID==(void 0===i.id?i.serviceId:i.id)})}else if(null!=OnlindBookingResponse&&null!=(r=e.grep(OnlindBookingResponse.lstOnlineServiceAndProviderMapping,function(e){return e.serviceProviderID==(void 0===t.id?t.ServiceProviderID:t.id)&&e.serviceID==(void 0===i.id?i.serviceId:i.id)}))&&r.length>0&&null!=a&&null!=a&&a.length>0&&null!=OnlindBookingResponse.lstAddonService&&null!=OnlindBookingResponse.lstAddonService&&OnlindBookingResponse.lstAddonService.length>0){var o=void 0===i.id?i.serviceId:i.id,n=void 0===t.id?t.ServiceProviderID:t.id,s=!1;e.grep(a,function(e){var t=_shopdetail.GetAddonsServiceDetailbyId(o,e.ServiceId,n);!s&&t.length>0&&(s=!0)}),0==s&&(r=[])}return null!=r&&r.length>0?(t.isServiceProvide=!0,!0):(t.isServiceProvide=!1,!0)})},_shopdetail.GetSelectedServiceDetail=function(t,i){var a=e.grep(t,function(t){var a=e.grep(t.children,function(e){return e.id==i});return null!=a&&a.length>0&&(t.children=a,!0)});return a.length>0&&a[0].children.length>0?a[0].children[0]:null},_shopdetail.SetControls=function(t){null==t?(_shopdetail.IsBusinessHaveOnlyClass()||_shopdetail.IsClassSelected()?(e("#dvServiceClassText").text(ClassKeyWordPlural+" (required)"),e("#spnAddService, #spnAddServiceMobile").text("Add "+ClassKeyWord)):(e("#dvServiceClassText").text("Service (required)"),e("#spnAddService, #spnAddServiceMobile").text("Add Service")),e("#dvAddService, #dvAddServiceMobile").hide()):0==t?e("#dvServiceClassText").text(BusinessPackageKeyWord+" (required)"):1==t?(e("#dvServiceClassText").text("Service (required)"),e("#spnAddService, #spnAddServiceMobile").text("Add Service")):2==t&&(e("#dvServiceClassText").text(ClassKeyWordPlural+" (required)"),e("#spnAddService, #spnAddServiceMobile").text("Add "+ClassKeyWord)),null!=t&&e("#dvAddService, #dvAddServiceMobile").show()},_shopdetail.GetSelectedSPDetail=function(t,i){var a=e.grep(t,function(e){return e.id==i});return a.length>0?a[0]:null},_shopdetail.OutCallCalculation=function(t,i){if(IsOutCallService=i.isOutCallService,e("#mobile-appointments").prop("checked",!1),0!=IsMobileServiceMandatoryInBusiness){var a=!1,r=void 0!==e("#hdnServiceLimit").val()&&""!=e("#hdnServiceLimit").val()&&null!=e("#hdnServiceLimit").val()?e("#hdnServiceLimit").val():3;if(_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")>0){for(var o=1;o<=r;o++)if(o!=t){var n=e("#txtService"+o).data("selecteddetail");if(""!=n)try{1==JSON.parse(n).isOutCallService&&(a=!0)}catch(e){}}if(1==a&&0==i.isOutCallService||0==a&&1==i.isOutCallService)return bootbox.dialog({title:"Alert",className:"bootstrap-modal-center vagaro-midium-popup refund-alert-modal",message:"You cannot combine Mobile Services with non-Mobile Services.",buttons:{success:{label:"OK"}},callback:function(){}}),e("#txtService"+t).select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e("#txtService"+t)),e("#txtService"+t).data("selecteddetail",""),!1}1==i.isOutCallService?(e("#hrfChangeBusinessCall").hide(),e("#hrfChangeHouseCall").hide(),void 0!==e("#dvAtbusiness")&&null!=e("#dvAtbusiness")?e("#dvAtbusiness").is(":visible")&&e("#mobile-appointments").prop("checked",!1):void 0!==e("#dvAtHouse")&&null!=e("#dvAtHouse")&&e("#dvAtHouse").is(":visible")&&e("#mobile-appointments").prop("checked",!0)):e("#dvOutCallSection").hide()}else _shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")>0||0==i.isOutCallService?e("#dvOutCallSection").hide():1==i.isOutCallService&&(void 0!==i.directFromService&&""!=i.directFromService&&1==i.directFromService&&(e("#dvHouseCall").removeClass("active"),e("#dvBussiness").addClass("active")),e("#hrfChangeBusinessCall").show(),e("#hrfChangeHouseCall").show(),e("#dvAtHouse").hide());return!0},_shopdetail.AddServiceButtonDisplay=function(){var t=void 0!==e("#hdnServiceLimit").val()&&""!=e("#hdnServiceLimit").val()&&null!=e("#hdnServiceLimit").val()?e("#hdnServiceLimit").val():3;_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")>=t-1||"true"==IsRescheduleAppointment.toLowerCase()&&""!=lAppID||_shopdetail.IsClassSelected()&&null!=_shopdetail.GetRescheduleDetail()?e("#dvAddService, #dvAddServiceMobile").hide():e("#dvAddService, #dvAddServiceMobile").show()},_shopdetail.SetServiceBundle=function(t){if(null!=OnlindBookingResponse.lstOnlineServiceBundleDetail){var i=e.grep(OnlindBookingResponse.lstOnlineServiceBundleDetail,function(e){return e.businessPackageID==t});if(IsBundle=null!=i&&i.length>0,null!=i&&i.length>0){for(var a=0;a<=i.length-1;a++){var r=a+2;e("#dvSection"+r).show(),_shopdetail.BindDropDown(r);var o={id:i[a].serviceId,text:i[a].serviceTitle};e("#txtService"+r).select2("data",o),e("#txtService"+r).select2("disable"),e("#txtService"+r).data("selecteddetail",o),void 0!==e("#txtService"+r).data("choice")&&_common.SetChoiceForSeleect2(e("#txtService"+r),o);var n={};n.id=o.id,n.text=o.text,_shopdetail.bindMobilefilterdata(e("#txtSP"+r),n)}e("#dvAddService, #dvAddServiceMobile").hide()}}},_shopdetail.RemoveDynamicSections=function(t){var i=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,a=!1;if(1<parseInt(t)&&parseInt(t)<i&&(a=!0),a){for(var r=t;r<i;r++){e("#divdd-select-search"+r).hide();var o=e("#txtService"+r).data("selecteddetail");if(""!=o){var n=JSON.parse(o).id;_shopdetail.RemoveSelectedAddon(n,r)}var s=e("#txtService"+(r+1)).data("selecteddetail"),l="",d="";if(""!=s)try{var c=JSON.parse(s);e("#txtService"+r).data("selecteddetail",s),void 0!==e("#txtService"+r).data("choice")&&(_common.SetChoiceForSeleect2(e("#txtService"+r),JSON.parse(e("#txtService"+(r+1)).data("choice"))),e("#txtService"+r).data("selecteddetail",e("#txtService"+(r+1)).data("choice"))),l=c.id;var u=_shopdetail.SelectedAddonCount(c.text,c.id,r);if(e("#txtService"+r).select2("data",{id:c.id,text:u}),d=c.PromotionProviders,void 0!==c.promotext&&""!=c.promotext){var p=c.promotext;c.promotext.toLowerCase().includes(" promo")&&(p=currencySymbol+p);var h=e("#divdd-select-search"+r);e(".service-namepromo",h).html(c.text),e(".promo-digit",h).html('<div class="vg-service-video"><em></em>'+p+"</div>"),e(h).show()}}catch(t){e("#txtService"+r).select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e("#txtService"+r)),e("#txtService"+r).data("selecteddetail","")}else e("#txtService"+r).select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e("#txtService"+r));e("#txtService"+r).select2("enable");var m=e("#cboServiceProviderWaitlist_Search"+(r+1)).data("selecteddetail");if(""!=m)try{var f=JSON.parse(m);if(e("#cboServiceProviderWaitlist_Search"+r).data("selecteddetail",m),void 0!==e("#cboServiceProviderWaitlist_Search"+r).data("choice")&&(_common.SetChoiceForSeleect2(e("#cboServiceProviderWaitlist_Search"+r),JSON.parse(e("#cboServiceProviderWaitlist_Search"+(r+1)).data("choice"))),e("#cboServiceProviderWaitlist_Search"+r).data("selecteddetail",e("#cboServiceProviderWaitlist_Search"+(r+1)).data("choice"))),e("#cboServiceProviderWaitlist_Search"+r).select2("data",{id:f.id,text:f.text}),_shopdetail.VisibleControlLength("#mobile-check")>0)(g={}).id=l,g.text="",_shopdetail.bindMobilefilterdata(e("#txtSP"+r),g),e("#txtSP"+r+"Mobile").val(f.id)}catch(t){if(e("#cboServiceProviderWaitlist_Search"+r).select2("data",{id:"",text:""}),_shopdetail.VisibleControlLength("#mobile-check")>0)(g={}).id=l,g.text="",_shopdetail.bindMobilefilterdata(e("#txtSP"+r),g),e("#txtSP"+r+"Mobile").val("");_common.SetDefaultForSeleect2(e("#cboServiceProviderWaitlist_Search"+r)),e("#cboServiceProviderWaitlist_Search"+r).data("selecteddetail","")}else{var g;if(e("#cboServiceProviderWaitlist_Search"+r).select2("data",{id:"",text:""}),_shopdetail.VisibleControlLength("#mobile-check")>0)(g={}).id=l,g.text="",_shopdetail.bindMobilefilterdata(e("#cboServiceProviderWaitlist_Search"+r),g),e("#txtSP"+r+"Mobile").val("");_common.SetDefaultForSeleect2(e("#cboServiceProviderWaitlist_Search"+r))}e("#cboServiceProviderWaitlist_Search"+r).data("PromotionProviderID",d)}if(e("#dvSection"+(t=i)).hide(),e("#divdd-select-search"+t).hide(),e("#txtService"+t).select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e("#txtService"+t)),e("#txtService"+t).data("selecteddetail",""),e("#txtService"+t).select2("enable"),e("#cboServiceProviderWaitlist_Search"+t).select2("data",{id:"",text:""}),_shopdetail.VisibleControlLength("#mobile-check")>0&&e("#txtSP"+t+"Mobile").val(""),_common.SetDefaultForSeleect2(e("#cboServiceProviderWaitlist_Search"+t)),e("#cboServiceProviderWaitlist_Search"+t).data("selecteddetail",""),_shopdetail.AddServiceButtonDisplay(),_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")<=0)if(""!=(v=e("#txtService1").data("selecteddetail")))try{1==JSON.parse(v).isOutCallService&&(e("#dvOutCallSection").show(),0!=IsMobileServiceMandatoryInBusiness?(e("#hrfChangeHouseCall").hide(),e("#hrfChangeBusinessCall").hide()):(e("#hrfChangeHouseCall").show(),e("#hrfChangeBusinessCall").show()))}catch(e){}e("#cboServiceProviderWaitlist_Search"+t).val(null).trigger("change"),e("#dvAddService, #dvAddServiceMobile").attr("tabindex","0"),e("#dvAddService:visible, #dvAddServiceMobile:visible").focus(),_shopdetail.GetAvailibilityForService(!1,!1)}else{var v;if(e("#dvSection"+t).hide(),e("#divdd-select-search"+t).hide(),e("#txtService"+t).select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e("#txtService"+t)),e("#txtService"+t).data("selecteddetail",""),e("#txtService"+t).select2("enable"),e("#cboServiceProviderWaitlist_Search"+t).select2("data",{id:"",text:""}),_shopdetail.VisibleControlLength("#mobile-check")>0&&e("#txtSP"+t+"Mobile").val(""),_common.SetDefaultForSeleect2(e("#cboServiceProviderWaitlist_Search"+t)),e("#cboServiceProviderWaitlist_Search"+t).data("selecteddetail",""),_shopdetail.AddServiceButtonDisplay(),_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")<=0)if(""!=(v=e("#txtService1").data("selecteddetail")))try{1==JSON.parse(v).isOutCallService&&(e("#dvOutCallSection").show(),0!=IsMobileServiceMandatoryInBusiness?(e("#hrfChangeHouseCall").hide(),e("#hrfChangeBusinessCall").hide()):(e("#hrfChangeHouseCall").show(),e("#hrfChangeBusinessCall").show()))}catch(e){}e("#cboServiceProviderWaitlist_Search"+t).val(null).trigger("change"),e("#dvAddService, #dvAddServiceMobile").attr("tabindex","0"),e("#dvAddService:visible, #dvAddServiceMobile:visible").focus(),_shopdetail.GetAvailibilityForService(!1,!1)}},_shopdetail.RemoveAllControls=function(t,i){e(".dvSectionDynamic").hide();for(var a=1;a<=4;a++)1==a&&1!=t||(e("#txtService"+a).select2("data",{id:"",text:""}),_common.SetDefaultForSeleect2(e("#txtService"+a)),e("#txtService"+a).select2("enable"),1==t&&(e("#divSearch").removeClass("no-serviceselection"),e("#mobile-appointments").prop("checked",!1),e("#dvOutCallSection").hide(),0==_shopdetail.IsClassSelected()&&e("#ucServiceCombo_hidEventType").val(""))),e("#txtSP"+a).select2("data",{id:"",text:""}),_shopdetail.VisibleControlLength("#mobile-check")>0&&e("#txtSP"+a+"Mobile").val(""),_common.SetDefaultForSeleect2(e("#txtSP"+a));if(1==i){var r=null;if("undefined"!=typeof txtdateId&&(r=$find(txtdateId)),"undefined"==typeof isClearDate&&(isClearDate=!0),null!=r&&1==isClearDate&&e("#date-slider-container div.enabled:first").length>0){var o=new Date(e("#date-slider-container div.enabled:first").data().availdate),n=void 0!==e("#date-slider-container div.selected:first").data()&&null!=e("#date-slider-container div.selected:first").data()?new Date(e("#date-slider-container div.selected:first").data().availdate):new Date;setdatepickervalue({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),isApplyInWidget:!0},o<n?o:n)}isClearDate=!0,e("#Book24Container").html(""),e("#hdnPromotionID").val(""),e("#hdnStyleID").val("")}},_shopdetail.SetGoogleMapDirection=function(){var t=_siteBuilderDetail.UserLocationInfo.Model;if("undefined"!=typeof vgAppicationType&&1==vgAppicationType&&void 0!==t.BusinessDetail.LATITUDE&&void 0!==t.BusinessDetail.LONGITUDE){var i="javascript:CallbackforMobileApp(0, 0, '', '', '0', '8|~|{\\\"url\\\": \\\""+(n="https://maps.google.com/maps?key="+googleKeyFormap+"&daddr="+t.BusinessDetail.LATITUDE+","+t.BusinessDetail.LONGITUDE+"&hl=en")+"\\\"}');";0==("undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp)&&(i="javascript:CallbackforMobileApp(0, 0, '', '', '0', '8|~|{\\\"latitude\\\": \\\""+t.BusinessDetail.LATITUDE+'\\", \\"longitude\\": \\"'+t.BusinessDetail.LONGITUDE+"\\\"}');"),e("#appt-location-map").attr("onclick",i),e("#appt-location-map").attr("href","javascript:void(0);"),e("#appt-location-map").removeAttr("target")}else{var a="Detail"===BasePage?e("#hdShopAddress").val():"",r="Detail"===BasePage?e("#hdUserAddress").val():"";if(null==a||0===a.trim().length)return;if(void 0===e("#hdUserAddress").attr("data-isfatch")&&vgAppicationType==objApplicationType.CheckinApp&&e("#hdUserAddress").attr("data-isfatch","false"),UserID>0&&(null==r||0===r.trim().length)&&"true"!=e("#hdUserAddress").attr("data-isfatch")){var o=new vagaro.ajax;o.datamodel.Token="GetUser",o.datamodel.data=[_shopdetail.businessID],o.datamodel.ErrorMessage="",o.datamodel.callback=function(t){if(null===t.Street||0===t.Street.length||null===t.City||0===t.City.length||null==t.StateName||0===t.StateName.length||null==t.Zip||0===t.Zip.length?r="":(r=t.Street.replace("#"," No ")+", "+t.City+", "+t.StateName+" "+t.Zip,r=encodeURI(r)),"undefined"==typeof vgAppicationType||1!=vgAppicationType){var i="https://maps.google.com/maps?key="+googleKeyFormap+"&saddr="+r+"&daddr="+a+"&hl=en";e("#btnDirections").removeAttr("href"),e("#btnDirections").attr("href",i),e("#map_businessMap1").length>0&&e("#map_businessMap1").attr("href",i),e("#map_dailydealsdetail1").length>0&&e("#map_dailydealsdetail1").attr("href",i)}e("#hdUserAddress").val(r),e("#hdUserAddress").attr("data-isfatch","true"),e("#appt-location-map").length>0&&e("#appt-location-map").attr("href",i)},o.datamodel.Error=function(e){},o.Post()}else{if((null==r||UserID<=0)&&(r="",e("#hdUserAddress").val(r),e("#hdUserAddress").attr("data-isfatch","false")),"undefined"==typeof vgAppicationType||1!=vgAppicationType){var n="https://maps.google.com/maps?key="+googleKeyFormap+"&saddr="+r+"&daddr="+a+"&hl=en";e("#btnDirections").attr("href",n),e("#map_businessMap1").length>0&&e("#map_businessMap1").attr("href",n),e("#map_dailydealsdetail1").length>0&&e("#map_dailydealsdetail1").attr("href",n)}e("#appt-location-map").length>0&&e("#appt-location-map").attr("href",n),1!=t.BusinessDetail.IsMobileServiceMandatory?e("#appt-location-map").show():e("#appt-location-map").hide(),(1==t.BusinessDetail.IsMobileServiceMandatory||2==t.BusinessDetail.IsMobileServiceMandatory)&&_siteBuilderDetail.GetCitiesPopUpDetail.selectedCount>0&&e(".appt-location-map").css("background-size","contain")}}},_shopdetail.LoadUserControlFailed=function(){ShowLoader(!1),vagaro.alert({message:"An Error Has Occurred",title:"Oops!"})},_shopdetail.AddMoreServices=function(t){e("#mobile-appointments").prop("checked",!1);var i=e("#txtService1").data("selecteddetail");if(1!=JSON.parse(e("#txtService1").data("selecteddetail")).isOutCallService&&e("#dvOutCallSection").hide(),""!=i)try{t=JSON.parse(i).eventType}catch(e){}for(var a=void 0!==e("#hdnServiceLimit").val()&&""!=e("#hdnServiceLimit").val()&&null!=e("#hdnServiceLimit").val()?e("#hdnServiceLimit").val():3,r=2;r<=a;r++)if("none"==e("#dvSection"+r).css("display")){e("#dvSection"+r).show(),_shopdetail.BindDropDown(r,t);break}e("#dvAddService, #dvAddServiceMobile").hide(),e("#btnRemoveServices2").focus(),e("#btnRemoveServices3").focus()},_shopdetail.BindDropDown=function(t,i){var a={dropdownCssClass:"service-what-dropdown service-commondrop service-book-drop",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Select Service"};if(a.collapasable=_shopdetail.VisibleControlLength("#mobile-check")>0,a.selectAllText=e("#mobile-check").is(":visible"),a.scrollTop=e("#mobile-check").is(":visible"),"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&void 0!==getCookie("AppointmentID")&&""!=getCookie("AppointmentID")&&(i=arrEventType.Service),1!=t){i==arrEventType.Class&&(a.placeholder="Select "+ClassKeyWord);var r=e.extend(!0,[],OnlindBookingResponse.lstOnlineServiceParent);r=e.grep(r,function(t){return t.eventType==i&&(t.children=e.grep(t.children,function(e){return e.eventType==i})),t.eventType==i}),a.data=r}else _shopdetail.IsBusinessHaveOnlyClass()&&(a.placeholder="Select "+ClassKeyWord),void 0!==_shopdetail.serviceID&&""==_shopdetail.serviceID&&"2"==e("#ucServiceCombo_hidEventType").val()&&e("#ucServiceCombo_hidEventType").val(""),a.data=OnlindBookingResponse.lstOnlineServiceParent.filter(function(e){return 1===e.eventType});if(window.location.href.toLowerCase().indexOf("businesswidget.aspx")>0&&1===a.data.length){var o=a.data[0];if(void 0!==o&&null!=o&&void 0!==o.children&&null!=o.children&&1===o.children.length){var n=o.children[0];if(a.placeholder=n.text,_shopdetail.serviceID=n.id,e(".service-namepromo","#divdd-select-search1").html(n.text),n.promotext&&""!==n.promotext){var s=n.isCurrencySymbol?currencySymbol+n.promotext:n.promotext;e(".promo-digit","#divdd-select-search1").html('<div class="vg-service-video"><em></em>'+s+"</div>"),e("#divdd-select-search1").show()}}}e("#txtService"+t).length>0&&(1!=OnlindBookingResponse.lstOnlineServiceProviderDetail.length||null!=_shopdetail.serviceID&&""!=_shopdetail.serviceID||_shopdetail.onProviderSelect(e("#txtSP"+t),{id:OnlindBookingResponse.lstOnlineServiceProviderDetail[0].id,text:OnlindBookingResponse.lstOnlineServiceProviderDetail[0].text}),new _shopdetail.ApplySelect2Controls(e("#txtService"+t),a),window.location.href.toLowerCase().indexOf("businesswidget.aspx")>0&&null!=a&&"undefined"!=a&&null!=a.data&&"undefined"!==a.data&&1===a.data.length&&e("#txtService"+t).val(a.data[0].id));var l={dropdownCssClass:"service-providerdrop",isInitSelection:!1,isSearchRequire:!0,selectOnClick:!0,placeholder:"Any Professional"};if(l.data=OnlindBookingResponse.lstOnlineServiceProviderDetail,l.collapasable=!1,e("#cboServiceProviderWaitlist_Search"+t).length>0){new _shopdetail.ApplySelect2Controls(e("#txtSP"+t),l),e("#cboServiceProviderWaitlist_Search"+t).select2("enable"),OnlindBookingResponse.lstOnlineServiceProviderDetail.length;var d="#cboServiceProviderWaitlist_Search"+t,c=e(d+" > option").length+1!=e(d+" :selected").length&&0!=e(d+" :selected").length?e(d).val().join(","):"-1";c=c.split(","),IsFromCreateLink?(c=String.isNullOrUndefineOrBlank(_shopdetail.providerID)||null==_shopdetail.providerID||0==_shopdetail.providerID||Array.isArray(_shopdetail.providerID)?_shopdetail.providerID=_common.isCreateLinkPreserve(!1):_shopdetail.providerID.split(","),String.isNullOrUndefineOrBlank(_shopdetail.serviceID)&&null!=_shopdetail.serviceID&&0==_shopdetail.serviceID&&(_shopdetail.serviceID=getCookie("ServiceID"))):"undefined"!=typeof _common&&void 0!==_common.IsWidgetForServiceProvider&&1==_common.IsWidgetForServiceProvider(!0)&&(c=_shopdetail.providerID=_common.IsWidgetForServiceProvider(!1)),BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search"+t,c),BindServiceProvideReInit("cboServiceProviderWaitlist_Search"+t-1);var u="undefined"!=typeof _common?_common.isCreateLinkPreserve(!1):"";!IsFromCreateLink||Array.isArray(u)&&"-1"==u.join(",")||e("#cboServiceProviderWaitlist_Search"+t).attr("disabled","disabled")}},_shopdetail.GetAvailibilityForService=function(t,i){var a=1;if((1==(IsBundle=t)&&(a=2),1==i)&&""!=(u=e("#txtService1").data("choice")))try{var r=JSON.parse(u);r.hasOwnProperty("id")&&""!=r.id&&r.eventType==arrEventType.ServiceBundle&&(a=2,IsBundle=!0)}catch(e){}0==IsBundle&&e(".search-div-38.pos-relative.service-what-div.serviceProviderDrop").removeClass("disabled-select");for(var o=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,n="",s=a;s<=o;s++){var l=e("#cboServiceProviderWaitlist_Search"+s).val();if(""!=l&&null!=l&&l.length>0){try{n+=l.join("-")}catch(e){}n+=","}else n+=","}var d={MerchantId:""};"undefined"!=typeof staticEncryptBusinessID&&null!=staticEncryptBusinessID&&(d.MerchantId=staticEncryptBusinessID);o=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1;var c="";for(s=1;s<=o;s++){0===Object.keys(e("#txtService"+s).data("choice")).length&&e("#txtService"+s).data("choice",'{"id":"","text":""}');var u=e("#txtService"+s).data("choice");c=c+JSON.parse(u).id+(s<o?",":"")}var p=V2APIURLEnumNew.availabledates;Data={},Data.businessID=businessID,Data.spID=n.substring(0,n.length-1),Data.csvServices=c,vagaro.ajaxCallV2(p,Data,null,{},CheckDates_CallSuccess,_common.CallFailed,!1,!1,d,!0)},_shopdetail.ShowSlider=function(t){var i;if(1==t){if(_shopdetail.VisibleControlLength("#divmainEventdetail")<=0&&(e("#divmainEventdetail").show(),void 0!==(i=e("#divmainEventdetail").data("availabedates"))&&null!=i))try{_shopdetail.LoadClassSliderDatePicker(JSON.parse(e("#divmainEventdetail").data("availabedates")))}catch(e){}}else if(_shopdetail.VisibleControlLength("#dvDateSlider")<=0&&(e("#dvDateSlider").show(),void 0!==(i=e("#dvDateSlider").data("availabedates"))&&null!=i))try{_shopdetail.LoadSliderDatePicker(JSON.parse(e("#dvDateSlider").data("availabedates")))}catch(e){}},_shopdetail.CallBookData=function(t){"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee&&(e(".serviceProviderDrop").hide(),e(".bookappointmentsearch").addClass("noServiceProviderDropdown"),e("#divClassAppResult").addClass("noServiceProviderSearchResult"),e(".book-confirmpage").addClass("noServiceProviderConfirm")),"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&_shopdetail.WidgetMenuRedirect("book-now"),_shopdetail.ShowTabsAfterbook();var i="undefined"!=typeof ServiceIdFromCustomerApp?ServiceIdFromCustomerApp:0;if(i>0&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof isOldVersionCustomerApp&&isOldVersionCustomerApp&&(e("#mobileBack").data("serviceidfromcustomerapp",i),e("#mobileBack").hide(),e("#custmobileBack").show()),"undefined"!=typeof IsRescheduleAppointment&&null!=IsRescheduleAppointment&&"true"!=IsRescheduleAppointment.toLowerCase()&&void 0!==getCookie("IsPaid")&&""!=getCookie("IsPaid")&&"True"==getCookie("IsPaid")&&clearCookie("IsPaid"),_common.setServiceCancelButtonMobile("dvBookNowPageSearch"),_shopdetail.HidePopup(),_common.backtoTopHide(),setTimeout(function(){_common.ScrollToToZero()},300),_shopdetail.BookingSearchBack(),e(".scrollme").removeClass("scrollme"),e("#dvOnlineAppoinmentBooked").hide(),e('#tabs a[href="#book-now"]').removeAttr("data-addstate"),"undefined"!=typeof _siteBuilderDetail&&_siteBuilderDetail.IsCustomerAppORMobileViewWithoutWidget()&&e("#covidbadgeblock").is(":visible")&&(e("#covidbadgeblock").data("ismanuallyhide",!0),e("#covidbadgeblock").hide()),"true"!=IsBlockBook.toLowerCase()){if(null!=OnlindBookingResponse)(OnlindBookingResponse.lstOnlineServiceProviderDetail.length<=0||1==_common.IsInActiveOnlineBooking(OnlindBookingResponse.lstOnlineServiceProviderDetail))&&e("#divCustomMessage").data("IsBookingDisabled",!0),_shopdetail.HideShowDisableBookMessageForApps(!1),OnlindBookingResponse.isAppReschedule=!1,_shopdetail.RemoveAllControls(!0,!0),_shopdetail.SetControls(null),_shopdetail.BindDropDown(1),void 0===e("#txtdivSearchDate").data("xdsoft_datetimepicker")&&(destroydatepicker({divid:"#divSearchDate",textid:"#txtdivSearchDate",flagVgMultiMonthDatePicker:!0,dateTimeFormat:DatePickerFormat(VagaroCountryDateFormat.SmallDate),preset:"date",unavailableShowDate:!0,arrValidDates:SalonsAvailableDates,callBackOnChange:dateChanged,contentWindow:datePicker_contentWindow,isApplyInWidget:!0,scrollMonth:!1}),_shopdetail.LoadSliderDatePicker(SalonsAvailableDates)),_shopdetail.SetOnlIneBookingDetail(),"undefined"!=_shopdetail.clsTimeZoneData&&null!=_shopdetail.clsTimeZoneData&&_shopdetail.BusinessStartTime(_shopdetail.clsTimeZoneData.TIME_ZONE,_shopdetail.clsTimeZoneData.CountryID,_shopdetail.clsTimeZoneData.CUSTOM_DAY_LIGHT_SAVING),_shopdetail.customerBrowserdeails(OnlindBookingResponse);else{var a=new vagaro.ajax;a.datamodel.Token=ApiURLEnumBooking.getonlinebookingtabdetail,a.datamodel.IsNewVagaroAPI=!0,a.datamodel.Error=_common.CallFailed,BookReqData={},BookReqData.businessID=businessID,BookReqData.shouldIncludePakcage=isincludepackage;var r=getQueryStringData("Type");"OnBoarding"==r&&(wbc._postMessage('{"eventType": "AddDarkTheme" }'),e("html").addClass("bookingappointment1"),e("html").removeClass("bookingappointment2"),e("html").removeClass("bookingappointment3")),BookReqData.IsRequestFromOnBoarding=void 0!==r&&null!=r&&("OnBoarding"==r||"ImportOnBoarding"==r),"undefined"!=typeof _common&&(_common.isCreateLinkPreserve(!0,!0)||_common.IsWidgetForServiceProvider(!0))&&(BookReqData.ServiceID=e.isNumeric(_shopdetail.serviceID)?_shopdetail.serviceID:"",BookReqData.ServiceProviderID=1==_common.IsWidgetForServiceProvider(!0)?_common.IsWidgetForServiceProvider(!1):1==_common.isCreateLinkPreserve(!0,!0)&&"-1"!=_common.isCreateLinkPreserve(!1).join(",")?_common.isCreateLinkPreserve(!1).join(","):""),BookReqData.loadClasses_Service_Both=!1,BookReqData.IsNewWebsiteBuilder=!1,BookReqData.IncludededClassId="",BookReqData.ExcludededClassId="",BookReqData.IsAllowAllLocation=!1,BookReqData.Referral=!!getCookie("Referral"),a.datamodel.data=BookReqData,a.datamodel.callback=function(t){if(null!=t){if("undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase()&&(_shopdetail.GetWidgetServicesDetail(),!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail)&&!String.isNullOrUndefineOrBlank(_shopdetail.WidgetServicesDetail.ServiceIds))){var i=_shopdetail.WidgetServicesDetail.ServiceIds.split("|");if(i.length>0&&!String.isNullOrUndefineOrBlank(i[0])){if(null!=t.lstOnlineServiceDetail&&t.lstOnlineServiceDetail.length>0){var a=0,r=e.extend(!0,[],t.lstOnlineServiceDetail);t.lstOnlineServiceDetail=e.map(t.lstOnlineServiceDetail,function(e){if(1==_onlineCheckout.CheckFileType(e.serviceID.toString(),i[0]))return a=1,e}),0==a&&0==IsFromMultiLocation&&(t.lstOnlineServiceDetail=r)}if(null!=t.lstOnlineServiceParent&&t.lstOnlineServiceParent.length>0){a=0;var o=e.extend(!0,[],t.lstOnlineServiceParent);t.lstOnlineServiceParent=e.map(t.lstOnlineServiceParent,function(t){if(1==_onlineCheckout.CheckFileType(t.id.toString(),i[0])&&(t.children=e.map(t.children,function(e){if(1==_onlineCheckout.CheckFileType(e.id.toString(),i[0]))return a=1,e}),t.children.length>0))return t}),0==a&&0==IsFromMultiLocation&&(t.lstOnlineServiceParent=o)}}}if(t.lstOnlineServiceProviderDetail.length<=0||"undefined"!=typeof _common&&1==_common.IsInActiveOnlineBooking(t.lstOnlineServiceProviderDetail)?(e("#divCustomMessage").show(),e("#divCustomMessage").data("IsBookingDisabled",!0),e("#dvDateSlider").hide(),e("#divSearch").hide()):(e("#divCustomMessage").hide(),e("#divCustomMessage").data("IsBookingDisabled",!1),e("#dvDateSlider").hide(),e("#divSearch").show()),objVPLData=t.lstOnlineServiceDetail[0],_shopdetail.RemoveAllControls(!0,!0),OnlindBookingResponse=t,void 0!==t.IsFMBEnableForBusiness&&(IsFMBEnableForBusiness=t.IsFMBEnableForBusiness),_shopdetail.BindAddonDataByBusinessId(),OnlindBookingResponse.isAppReschedule=!1,"undefined"!=typeof isFromReschedual&&"true"==isFromReschedual.toLowerCase()&&void 0!==getCookie("AppointmentID")&&""!=getCookie("AppointmentID")&&(OnlindBookingResponse.isAppReschedule=!0),_shopdetail.customerBrowserdeails(OnlindBookingResponse),_shopdetail.SetControls(null),IsRescheduleAppointment&&ServiceID>0)OnlindBookingResponse.lstOnlineServiceParent=e.grep(OnlindBookingResponse.lstOnlineServiceParent,function(t){return 1==t.eventType&&(t.children=e.grep(t.children,function(e){return e.id==parseFloat(ServiceID)&&0==e.isOnlineService?e.isFromReschedule=!0:e.isFromReschedule=!1,e})),t}),OnlindBookingResponse.lstOnlineServiceParent=e.grep(OnlindBookingResponse.lstOnlineServiceParent,function(t){return 1==t.eventType&&(t.children=e.grep(t.children,function(e){return 1==e.isOnlineService||1==e.isFromReschedule})),t});else if("undefined"==typeof Waitlistdata||String.isNullOrUndefineOrBlank(Waitlistdata))OnlindBookingResponse.lstOnlineServiceParent=e.grep(OnlindBookingResponse.lstOnlineServiceParent,function(t){return 1==t.eventType&&(t.children=e.grep(t.children,function(e){return 1==e.isOnlineService})),t});else{var n=JSON.parse(Waitlistdata);"undefined"!=n.lstServiceSPForRealAppointment&&n.lstServiceSPForRealAppointment.length>0&&(OnlindBookingResponse.lstOnlineServiceParent=e.grep(OnlindBookingResponse.lstOnlineServiceParent,function(t){return 1==t.eventType&&(t.children=e.grep(t.children,function(e){return e.isWaitliService=!1,n.lstServiceSPForRealAppointment.filter(t=>t.ServiceID==e.id).length>0&&(e.isWaitliService=!0),e})),t})),OnlindBookingResponse.lstOnlineServiceParent=e.grep(OnlindBookingResponse.lstOnlineServiceParent,function(t){return 1==t.eventType&&(t.children=e.grep(t.children,function(e){return 1==e.isOnlineService||void 0!==e.isWaitliService&&1==e.isWaitliService})),t})}_shopdetail.BindDropDown(1),ShowLoader(!1),_shopdetail.SetOnlIneBookingDetail(),_shopdetail.BusinessStartTime(t.clsTimeZone.TIME_ZONE,t.clsTimeZone.CountryID,t.clsTimeZone.CUSTOM_DAY_LIGHT_SAVING);try{_shopdetail.LoadState()}catch(e){}if(void 0!==setBookingDataFromWebsiteBuilder)var s=setInterval(function(){_shopdetail.isCalenderFilled&&(clearInterval(s),setBookingDataFromWebsiteBuilder())},200)}},a.Post()}redirecttodevicetabname="book-now"}else _shopdetail.HideShowDisableBookMessageForApps(!0)},_shopdetail.CheckPriceWithTaxSwitch=function(){return null!=typeof hdnPriceWithTaxSwitch&&"1"==hdnPriceWithTaxSwitch.value},_shopdetail.customerBrowserdeails=function(e){_shopdetail.customerBrowserdetails=[],_shopdetail.customerBrowserdetails.TIME_ZONE=e.clsTimeZone.TIME_ZONE,_shopdetail.customerBrowserdetails.CUSTOM_DAY_LIGHT_SAVING=e.clsTimeZone.CUSTOM_DAY_LIGHT_SAVING,_shopdetail.customerBrowserdetails.DAY_LIGHT_SAVING=e.clsTimeZone.DAY_LIGHT_SAVING,_shopdetail.customerBrowserdetails.CountryID=e.clsTimeZone.CountryID,_shopdetail.setLocationCookieData()},_shopdetail.setLocationCookieData=function(){var e=getCookie("proximitystate_v3");"undefined"!=e&&null!=e&&(_shopdetail.customerBrowserdetails.CustomerTimezone=e.timeZoneOffSet,_shopdetail.customerBrowserdetails.Customerzoneid="",_shopdetail.customerBrowserdetails.CustomerCulture=e.countryid,_shopdetail.customerBrowserdetails.CustIsDayLightSaving=e.isSupportDayLight)},_shopdetail.WidgetMenuRedirect=function(t){var i=e("#"+t);_common.CloseToggelmobileMenu(),e("#navbar #tabs li.nav-item.active a").attr("aria-expanded","false").removeClass("active"),e("#navbar #tabs li.nav-item.active").removeClass("active"),i.addClass("active"),i.attr("aria-expanded","true"),i.parent().addClass("active")},_shopdetail.SetOnlIneBookingDetail=function(){if(isGoogle&&(microServiceID=_shopdetail.serviceID),("true"==isClassSelected.toLowerCase()&&"true"==isFromReschedual.toLowerCase()||"true"==isClassSelected.toLowerCase()&&"false"==isFromReschedual.toLowerCase())&&(_shopdetail.SetClassBookData(_shopdetail.serviceID,_shopdetail.providerID,!0),"true"==isClassSelected.toLowerCase()&&"true"==isFromReschedual.toLowerCase())){e("#txtService1").select2("disable");var t={};t.EventSessionAttendeesId=parseInt(EventSessionAttendeesId),t.serviceID=parseInt(_shopdetail.serviceID),t.providerID=parseInt(_shopdetail.providerID),e("#hdnRescheduleDetail").val(JSON.stringify(t))}if(1==_shopdetail.IsClassSelected()&&""==_shopdetail.serviceID&&""==_shopdetail.providerID||1==_shopdetail.isClassCalenderFilled&&1==_shopdetail.IsBusinessHaveOnlyClass())return _shopdetail.ClearClassControls(!1),void ShowLoader(!1);BusinessPackageID=0,ShowLoader(!0),0==_shopdetail.isCalenderFilled?(bk.init(),function(){var e={MerchantId:""};"undefined"!=typeof staticEncryptBusinessID&&null!=staticEncryptBusinessID&&(e.MerchantId=staticEncryptBusinessID);var t=V2APIURLEnumNew.availabledates;Data={},Data.businessID=businessID,Data.spID="",Data.csvServices="",vagaro.ajaxCallV2(t,Data,null,{},l,_common.CallFailed,!1,!1,e,!0)}()):(SetData(_shopdetail.serviceID,_shopdetail.providerID,_shopdetail.styleID,_shopdetail.styleName,_shopdetail.bookingDateTime,_shopdetail.PromotionID,_shopdetail.EventType,_shopdetail.PromotionProviderID,_shopdetail.bookingDateTime),_shopdetail.ClearBook24());try{"function"==typeof _shopdetail.FireBookNowPageVisited&&_shopdetail.FireBookNowPageVisited()}catch(e){}},_shopdetail.SetClassData=function(t,i){if(null!=i&&""!=i&&i>0){var a=e.extend(!0,[],OnlindBookingResponse.lstOnlineServiceProviderDetail);if(null!=(o=_shopdetail.GetSelectedSPDetail(a,i))){var r=e("#txtSP1");r.data("selecteddetail",JSON.stringify(o)),void 0!==r.data("choice")&&_common.SetChoiceForSeleect2(r,o),r.select2("data",{id:o.id,text:o.text})}}if(null!=t&&""!=t&&parseInt(t)>0){var o;a=e.extend(!0,[],OnlindBookingResponse.lstOnlineServiceParent);if(null!=(o=_shopdetail.GetSelectedServiceDetail(a,t))){var n=e("#txtService1");_shopdetail.SetControls(o.eventType),BusinessPackageID=0,e("#divSearch").removeClass("no-serviceselection"),e("#ucServiceCombo_hidEventType").val(o.eventType.toString()),_shopdetail.AddServiceButtonDisplay(),n.data("selecteddetail",JSON.stringify(o)),void 0!==n.data("choice")&&_common.SetChoiceForSeleect2(n,o),n.select2("data",{id:o.id,text:o.text})}}},_shopdetail.ShowTabsAfterbook=function(){e("#dvOnlineAppoinmentBooked").is(":visible")&&e("#dvOnlineAppoinmentBooked").hide(),e("#pageSection").is(":visible")||e("#pageSection").show().removeClass("pagesectionFlex")},_shopdetail.LoadMembershipPackageData=function(){if(null!=UserID&&"0"!=UserID&&""!=UserID&&null!=businessID&&""!=businessID&&1==_shopdetail.IsMemPkgReqToBook){var e={UserId:parseInt(UserID),BusinessId:parseInt(businessID)},t=new vagaro.ajax;t.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetMembershipOrPackageRequiredToBook,groupID),t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.async=!1,t.datamodel.callback=function(t){if(null!=t&&1e3==t.ResponseCode&&t.Data&&t.Data.MembershipOrPackageRequiredToBookResponse){for(var i=t.Data.MembershipOrPackageRequiredToBookResponse,a=parseInt(businessID),r={},o=0;o<i.length;o++){var n=i[o];r[n.Name]||(r[n.Name]=[]),r[n.Name].push(n)}var s=[];for(var l in r)if(r.hasOwnProperty(l)){for(var d=r[l],c=null,u=0;u<d.length;u++)if(d[u].BusinessId==a){c=d[u];break}null!=c?s.push(c):s.push(d[0])}if(t.Data.MembershipOrPackageRequiredToBookResponse=s,t.Data.UserMemberShipAndPackageInformation){for(var p=[],h=0;h<s.length;h++){for(var m=s[h].Name,f=!1,g=0;g<p.length;g++)if(p[g]==m){f=!0;break}f||p.push(m)}t.Data.UserMemberShipAndPackageInformation.RequiredMemberships=p.join(", ")}}if(MembershipPackageDetails=t,_shopdetail.MembershipPackageDetails=t,null!=MembershipPackageDetails&&1e3==MembershipPackageDetails.ResponseCode){var v=new vagaro.ajax;v.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetMembershipOrPackageRequiredToBookFamilyFriends,groupID),v.datamodel.data=e,v.datamodel.IsNewVagaroAPI=!0,v.datamodel.async=!1,v.datamodel.callback=function(e){FamilyFriendsMembershipPackage=e,_vgClassSessionSelection.FamilyFriendsMembershipPackage=e},v.datamodel.Error=_common.CallFailed,v.Post()}},t.datamodel.Error=_common.CallFailed,t.Post()}},_shopdetail.LoadEmpNotAcceptingNewClients=function(){if(null!=businessID&&""!=businessID&&(null==_shopdetail.EmployeeNotAcceptingNewClientsDetails||0==_shopdetail.EmployeeNotAcceptingNewClientsDetails.length)&&1==_shopdetail.IsLimitOnlineBooking){var e={BusinessId:parseInt(businessID)},t=new vagaro.ajax;t.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetEmployeesNotAcceptingNewClients,groupID),t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.async=!1,t.datamodel.callback=function(e){_shopdetail.EmployeeNotAcceptingNewClientsDetails=e.Data},t.datamodel.Error=_common.CallFailed,t.Post()}},_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees=function(){if(null!=UserID&&"0"!=UserID&&null!=businessID&&""!=businessID&&(null==_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees||0==_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.length)&&1==_shopdetail.IsLimitOnlineBooking){var e={BusinessId:parseInt(businessID),UserId:parseInt(UserID)},t=new vagaro.ajax;t.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetUserAndFnFNewOrExistingForBusinessEmployees,groupID),t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.async=!1,t.datamodel.callback=function(e){1e3==e.ResponseCode&&null!=e.Data&&null!=e.Data.UserAndFnFNewOrExistingForBusinessEmployees&&(_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees=e.Data.UserAndFnFNewOrExistingForBusinessEmployees)},t.datamodel.Error=_common.CallFailed,t.Post()}},_shopdetail.reSetUserAndFnFNewOrExistingForBusinessEmployeesForClass=function(){1==_shopdetail.IsLimitOnlineBooking&&(0==_vgClassSessionSelection.model.IsOnline||1==_vgClassSessionSelection.model.IsOnline&&void 0!==_shopdetail&&void 0!==ClassTabName&&_shopdetail.activeTabName==ClassTabName)&&(bkClassAvailableDates.removeCacheByCurKey(),bkClassAvailableDates.timeSlotsCache={},bkClassAvailableDates.model={},void 0!==bkEvent.model.searchFromDate&&(bkEvent.removeCacheByCurKey(),bkEvent.timeSlotsCache={},bkEvent.model={}),_vgClassSessionSelection.FillClassDatesForClass())},_shopdetail.DisplayEmpNotAccptNewClientsBadge=function(e){if(0==_shopdetail.IsLimitOnlineBooking)return"";if(null==UserID||"0"==UserID||""==UserID){var t=_shopdetail.EmployeeNotAcceptingNewClientsDetails.find(t=>t.ServiceProviderID==e);return!String.isNullOrUndefineOrBlank(t)}{let t;return t=e.toString().includes(",")?e.split(",").map(e=>{const t=parseInt(e.trim());return isNaN(t)?null:t}).filter(e=>null!==e):e.toString(),!(_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>e.UserID==UserID&&t.includes(e.ServiceProviderID)&&1==e.Existing).length>0)}},_shopdetail.DisplayEmpNotAccptNewClientsBadgeFnFPopUp=function(e,t){return 0==_shopdetail.IsLimitOnlineBooking?"":!(_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(i=>i.UserID==t&&i.ServiceProviderID==e&&1==i.Existing).length>0)},_shopdetail.getFilteredServiceProviderId=function(t){if(0==_shopdetail.IsLimitOnlineBooking)return t;var i=_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>e.UserID==UserID&&0==e.Existing).map(function(e){return e.ServiceProviderID}),a=[];i.forEach(function(e){0==_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(t=>t.UserID!=UserID&&t.ServiceProviderID==e&&t.Existing>0).length&&a.push(e)});var r=[];return""!=t&&t.split(",").forEach(function(e){-1!=jQuery.inArray(parseInt(e),a)||r.push(e)}),t=r.join(","),"1"==e("#hdnSearchAvailabilityBtn").val()&&(t=_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>e.UserID==UserID&&1==e.Existing).map(function(e){return e.ServiceProviderID}).join(",")),t},_shopdetail.getFilteredServiceProviderIdForServiceTab=function(e){if(0==_shopdetail.IsLimitOnlineBooking)return e;var t=_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>e.UserID==UserID&&0==e.Existing).map(function(e){return e.ServiceProviderID}),i=[];t.forEach(function(e){0==_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(t=>t.UserID!=UserID&&t.ServiceProviderID==e&&t.Existing>0).length&&i.push(e)});var a=[];return""!=e&&e.split(",").forEach(function(e){-1!=jQuery.inArray(parseInt(e),i)||a.push(e)}),e=a.join(",")},_shopdetail.LoadBookNowUserControl=function(t){if(ShowLoader(!0),e(t).html(e("#dvBookingTemplate").html()),null!=_siteBuilderDetail.ComponentResponse.lstBookNow)_shopdetail.CallSuccess_LoadBookNowUserControl(_siteBuilderDetail.ComponentResponse.lstBookNow);else if("undefined"!=typeof isBotCrawler&&0==isBotCrawler){e("#dvBookingTemplate-stencil").length>0&&e("#dvBookNowPageSearch").html(e("#dvBookingTemplate-stencil").html());var i={UserControlPath:"~/UserControls/ShopDetail/ucMultiAppointmentOnline.ascx",PageNamePath:"~/detail.aspx",isRemoveFormTag:!0};i.Parameters={},i.Parameters.BusinessID=businessID,i.Parameters.BusinessName=businessName,i.Parameters.City=City,i.Parameters.StateCode=_shopdetail.StateCode,i.Parameters.IsOnlineCustomerWaitlist=IsOnlineCustomerWaitlist,i.Parameters.IsDisplayPhoneNumber=_siteBuilderDetail.ComponentResponse.lstBusinessDetail.IsDisplayPhoneNumber,i.Parameters.IsWidget="undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase();try{if("function"==typeof getQueryStringData){QueryStringValue=void 0!==window.QueryStringValue&&""!==window.QueryStringValue?window.QueryStringValue:window.document.URL;var a=getQueryStringData("Type"),r=getQueryStringData("appID"),o=getQueryStringData("reschedule");if("Builder"===a&&r&&o&&"true"===o.toLowerCase()){i.Parameters.appID=r,i.Parameters.reschedule="true",i.Parameters.Type=a;var n=getQueryStringData("device");n&&(i.Parameters.device=n)}}}catch(e){}var s=new vagaro.ajax;s.datamodel.Token=ApiURLEnumBooking.LoadUserControl,s.datamodel.data=i,s.datamodel.IsNewVagaroAPI=!0,s.datamodel.callback=_shopdetail.CallSuccess_LoadBookNowUserControl,s.datamodel.Error=_shopdetail.LoadUserControlFailed,s.Post(),_shopdetail.GetPromotionsByBusinessID(),_shopdetail.LoadMembershipPackageData(),void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsLimitOnlineBooking&&(void 0!==_shopdetail.LoadEmpNotAcceptingNewClients&&_shopdetail.LoadEmpNotAcceptingNewClients(),null!=UserID&&"0"!=UserID&&void 0!==_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees&&_shopdetail.LoadUserAndFnFNewOrExistingForBusinessEmployees())}},_shopdetail.CallSuccess_LoadBookNowUserControl=function(t){ShowLoader(!1);var i=e("#dvBookNowPageSearch");i.html(""),!1===_siteBuilderDetail.isCallFromPublicSide()&&_common.DisableComponent(14,i),i.append(t),_siteBuilderDetail.ComponentResponse.lstBookNow=t,i.show(),Webflow.destroy(),Webflow.ready(),_vgWaitlist.LoadWaitListEvents(),_shopdetail.CallBookData(),LoadFamilyFriendDDLEvents(),e("#mobile-check").is(":visible")&&lazyloadImages(),resetSignupOnboardHeight()},_shopdetail.GetValidatePromotionsDetails=function(){if("0"==e("#hdnLoggedInUserid").val())return _shopdetail.HidePopup(),showCommonLoginPopup("BookAppointment"),!1;var t=!0,i=!1,a=0;"undefined"!=typeof PromotionAppointmentID&&null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&(a=PromotionAppointmentID);for(var r=0,o=_shopdetail.BookingDetail,n=o.serviceid.split(",").length,s=0;s<n;s++)if(void 0!==o.AppointmentDetail[s].isPresetApply&&1==o.AppointmentDetail[s].isPresetApply?r=o.AppointmentDetail[s].DiscountID:o.AppointmentDetail[s].PromotionId>0&&(r=o.AppointmentDetail[s].PromotionId),0==r&&!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService)&&_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService.length>0)for(var l=0;l<_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService.length;l++){var d=_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService[l];void 0!==d.isPresetApply&&1==d.isPresetApply?r=d.DiscountID:d.PromotionID>0&&(r=d.PromotionID)}if(a>0||r>0){var c={businessID:_shopdetail.businessID,loginUserID:e("#hdnLoggedInUserid").val(),EmailPromotionID:a},u=new vagaro.ajax;u.datamodel.async=!1,u.datamodel.IsNewVagaroAPI=!0,u.datamodel.Token=ApiPath+ApiURLEnumBooking.getvalidatepromotionsdetails,u.datamodel.data=c,u.datamodel.callback=function(e){o.AppointmentIds.split(","),new Array(n);var a=0,r=0;null!=PromotionAppointmentID&&""!=PromotionAppointmentID&&null!=e&&e.length>0&&(PromotionAppointmentID=e[0].EmailPromotionID);for(var s=0;s<n;s++){void 0!==o.AppointmentDetail[s].isPresetApply&&1==o.AppointmentDetail[s].isPresetApply?r=o.AppointmentDetail[s].DiscountID:a=o.AppointmentDetail[s].PromotionId;var l=moment(o.date.split(",")[s]);if(""!=(u=_shopdetail.ValidatePromoCodeForUpSellItem(e,a,r,l,o.AppointmentDetail[s].ApplyDiscoutType))){if("IsClearDealDiscount"!=u){vagaro.alert(u),t=!1;break}if("IsClearDealDiscount"==u){t=!1,i=!0;break}}}if(1==t)for(s=0;s<n;s++)if(!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService)&&_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService.length>0)for(var d=0;d<_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService.length;d++){var c=_shopdetail.BookingDetail.AppointmentDetail[s].lstAddonService[d];void 0!==c.isPresetApply&&1==c.isPresetApply?r=c.DiscountID:a=c.PromotionID;l=moment(o.date.split(",")[s]);if(""!=(u=_shopdetail.ValidatePromoCodeForUpSellItem(e,a,r,l,c.ApplyDiscoutType))){if("IsClearDealDiscount"!=u){vagaro.alert(u),t=!1;break}if("IsClearDealDiscount"==u){t=!1,i=!0;break}}}if(1==t&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0)for(s=0;s<_shopdetail.BookingDetail.MembershipUpSellData.length;s++){if(void 0!==_shopdetail.BookingDetail.MembershipUpSellData[s].isPresetApply&&1==_shopdetail.BookingDetail.MembershipUpSellData[s].isPresetApply?r=_shopdetail.BookingDetail.MembershipUpSellData[s].DiscountID:a=_shopdetail.BookingDetail.MembershipUpSellData[s].PromotionID,""!=(u=_shopdetail.ValidatePromoCodeForUpSellItem(e,a,r,moment(new Date),_shopdetail.BookingDetail.MembershipUpSellData[s].ApplyDiscoutType))){if("IsClearDealDiscount"!=u){vagaro.alert(u),t=!1;break}if("IsClearDealDiscount"==u){i=!0;break}}}if(1==t&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0)for(s=0;s<_shopdetail.BookingDetail.PackageUpSellData.length;s++){var u;if(void 0!==_shopdetail.BookingDetail.PackageUpSellData[s].isPresetApply&&1==_shopdetail.BookingDetail.PackageUpSellData[s].isPresetApply?r=_shopdetail.BookingDetail.PackageUpSellData[s].DiscountID:a=_shopdetail.BookingDetail.PackageUpSellData[s].PromotionID,""!=(u=_shopdetail.ValidatePromoCodeForUpSellItem(e,a,r,moment(new Date),_shopdetail.BookingDetail.PackageUpSellData[s].ApplyDiscoutType))){if("IsClearDealDiscount"!=u){vagaro.alert(u),t=!1;break}if("IsClearDealDiscount"==u){i=!0;break}}}(0==t||i)&&(a>0&&_shopdetail.RemoveDailyDealService(a),r>0&&_shopdetail.RemovePromoCodeService(r))},u.datamodel.Error=function(e){},u.Post()}return t},_shopdetail.ValidatePromoCodeForUpSellItem=function(t,i,a,r,o){"undefined"==typeof IsForNewCustomer?void 0!==e("#hdnIsForNewCustomer").val()&&e("#hdnIsForNewCustomer").val().toLowerCase():IsForNewCustomer;if(0!=i){if(!(null!=(l=e.grep(t,function(e){return 2==e.DiscountType&&e.PromotionID==i}))&&l.length>0))return"This discount is expired. You can proceed with checkout without discount.";l=l[0];var n=moment(l.strStartDate.replace("A"," A").replace("P"," P")),s=moment(l.strEndDate.replace("A"," A").replace("P"," P"));if(n.diff(r,"min")>0)return"This discount is expired. You can proceed with checkout without discount.";if(""!=l.strEndDate&&s.diff(r,"min")<0)return"This discount is expired. You can proceed with checkout without discount.";if(1==l.PerUserOne&&1==l.UsedbyUser&&("undefined"==typeof IsRescheduleAppointment||null==IsRescheduleAppointment||"undefined"!=typeof IsRescheduleAppointment&&null!=IsRescheduleAppointment&&"false"==IsRescheduleAppointment.toLocaleLowerCase()))return o!=ApplyDiscoutTypePrepay.Package&&o!=ApplyDiscoutTypePrepay.Points?"This daily deal can only be used one time per customer. You have already used this daily deal.":"IsClearDealDiscount";if(void 0!==l.CustomerFilters&&""!=l.CustomerFilters&&null!=l.CustomerFilters){if(1==l.NewUser&&l.CustomerFilters.indexOf("2")<=-1&&l.CustomerFilters.indexOf("3")<=-1)return"This deal is only eligible for existing customers.";if(0==l.NewUser&&l.CustomerFilters.indexOf("1")<=-1&&l.CustomerFilters.indexOf("3")<=-1)return"This deal is only eligible for new customers.";if(1==l.NewUser||l.NewUser,0==l.NewUser&&2==l.CustomerFilters.split(",").length&&l.CustomerFilters.indexOf("2")>-1&&l.CustomerFilters.indexOf("3")>-1&&l.CustomerFilters.indexOf("1")<=-1)return"This deal is only eligible for new customers and employee.";if(1==l.NewUser&&2==l.CustomerFilters.split(",").length&&l.CustomerFilters.indexOf("1")>-1&&l.CustomerFilters.indexOf("3")>-1&&l.CustomerFilters.indexOf("2")<=-1)return"This deal is only eligible for existing customers and employee."}if(l.TotalUsage>0&&l.TotalUsed>=l.TotalUsage)return"This daily deal cannot be applied because it has reached the total amount of uses."}if(0!=a){var l;if(!(null!=(l=e.grep(t,function(e){return 1==e.DiscountType&&e.PromotionID==a}))&&l.length>0))return"This discount is expired. You can proceed with checkout without discount.";l=l[0];n=moment(l.strStartDate.replace("A"," A").replace("P"," P")),s=moment(l.strEndDate.replace("A"," A").replace("P"," P"));if(n.diff(r,"min")>0)return"This discount is expired. You can proceed with checkout without discount.";if(""!=l.strEndDate&&s.diff(r,"min")<0)return"This discount is expired. You can proceed with checkout without discount.";if(1==l.PerTransactionOne&&1==l.UsedbyUser)return"This discount can only be used one time per customer. You have already used this discount.";if(void 0!==l.CustomerFilters&&""!=l.CustomerFilters&&null!=l.CustomerFilters){if(1==l.NewUser&&l.CustomerFilters.indexOf("2")<=-1&&l.CustomerFilters.indexOf("3")<=-1)return"This discount is only eligible for existing customers.";if(0==l.NewUser&&l.CustomerFilters.indexOf("1")<=-1&&l.CustomerFilters.indexOf("3")<=-1)return"This discount is only eligible for new customers.";if(1==l.NewUser||l.NewUser,0==l.NewUser&&2==l.CustomerFilters.split(",").length&&l.CustomerFilters.indexOf("2")>-1&&l.CustomerFilters.indexOf("3")>-1&&l.CustomerFilters.indexOf("1")<=-1)return"This discount is only eligible for new customers and employee.";if(1==l.NewUser&&2==l.CustomerFilters.split(",").length&&l.CustomerFilters.indexOf("1")>-1&&l.CustomerFilters.indexOf("3")>-1&&l.CustomerFilters.indexOf("2")<=-1)return"This discount is only eligible for existing customers and employee."}if(l.TotalUsage>0&&l.TotalUsed>=l.TotalUsage)return"This discount cannot be applied because it has reached the total amount of uses"}return""},e(document).on("pointerdown","#dvchangeService, #dvAddServiceMobile",function(){isChangeServiceClicked=!0}),_shopdetail.backpage=function(){if(_shopdetail.VisibleControlLength("#mobile-check")>0||"undefined"!=typeof vgAppicationType&&1==vgAppicationType)if(_shopdetail.VisibleControlLength("#divClassAppResultForClass")>0&&e("#divClassAppResultForClass:visible").length>0&&_shopdetail.BookingSearchBackForClass(),e(".btnappointmentcancel:visible").length>0)e(".btnappointmentcancel:visible").click();else if(e(".btncontshoppingtopcls:visible").length>0)"Detail"==BasePage?e(".btncontshoppingtopcls:visible").click():location.href="./";else if(e("#btnBuyNowBack:visible").length>0)"Detail"==BasePage?e("#btnBuyNowBack:visible").click():location.href="./";else if(e(".btnContShopping:visible").length>0)"Detail"==BasePage?e(".btnContShopping:visible").click():location.href="./";else if(_shopdetail.VisibleControlLength("#divClassAppResult")>0&&e("#divClassAppResult:visible").length>0)try{var t=new URLSearchParams(window.location.search),i="true"===(t.get("rebook")||"").toLowerCase(),a="true"===(t.get("reschedule")||"").toLowerCase();if(!e("#mobile-check").is(":visible")||isChangeServiceClicked||i||a)setTimeout(function(){isChangeServiceClicked=!1},0),_shopdetail.BookingSearchBack();else{var r=e("#mobileBack").data("backtabname");"dealsindividual"==_shopdetail.activeTabName.toLowerCase()||void 0!==r&&"dealsindividual"==r.toLowerCase()?_shopdetail.backToShopDetail(null,"dealsindividual"):void 0!==r&&"styles"==r.toLowerCase()?_shopdetail.GalleryloadLoadMore():""!=_shopdetail.activeTabName&&"about"!=_shopdetail.activeTabName?isFinalBookClicked?(_shopdetail.BookingSearchBack(),isFinalBookClicked=!1):(e("#select2-drop-mask").click(),_common.closeServiceSelection(),void 0!==r&&""!=r?_shopdetail.loadbyMenuClick(r):(e("#mobile-check").is(":visible")?e("#mobiletabmenu #ancAbout").attr("data-addstate","false"):e("#tabnav #ancAbout").attr("data-addstate","false"),_shopdetail.loadbyMenuClick(DefaultTabPage),void 0!==iosDevices&&iosDevices&&setTimeout(function(){e(window).scrollTop(.5)},100))):window.history.back()}}catch(e){setTimeout(function(){isChangeServiceClicked=!1},0),_shopdetail.BookingSearchBack()}else if(e("#divWriteReview:visible").length>0)_siteBuilderDetail.CloseReviewPopup(!1);else if(e("#dvOnlineAppoinmentBooked").is(":visible"))e("#dvOnlineAppoinmentBooked").hide(),e("#pageSection").show().addClass("pagesectionFlex"),_common.AddState("book-now","book-now");else if(e("#dvCheckoutSuccess").is(":visible")&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType)e("#ancCheckoutSuccess").click();else if(""!=BasePage){r=e("#mobileBack").data("backtabname");"dealsindividual"==_shopdetail.activeTabName.toLowerCase()||void 0!==r&&"dealsindividual"==r.toLowerCase()?_shopdetail.backToShopDetail(null,"dealsindividual"):void 0!==r&&"styles"==r.toLowerCase()?_shopdetail.GalleryloadLoadMore():""!=_shopdetail.activeTabName&&"about"!=_shopdetail.activeTabName?(e("#select2-drop-mask").click(),_common.closeServiceSelection(),void 0!==r&&""!=r?_shopdetail.loadbyMenuClick(r):(e("#mobile-check").is(":visible")?e("#mobiletabmenu #ancAbout").attr("data-addstate","false"):e("#tabnav #ancAbout").attr("data-addstate","false"),_shopdetail.loadbyMenuClick(DefaultTabPage),void 0!==iosDevices&&iosDevices&&setTimeout(function(){e(window).scrollTop(.5)},100))):window.history.back()}else location.href="/";else{e("#tabnav li").removeClass("active"),e(".tab-pane").removeClass("active");var o=e("#tabnav li").first().find("a").attr("aria-controls");e("#tabnav li").first().addClass("active"),e("#"+o).addClass("active"),e("#tabnav li").first().find("a").tab("show").click()}},_shopdetail.loadbyMenuClick=function(e){if(_shopdetail.VisibleControlLength("#mobile-check")>0){var t=GetSelectedMenuObject(e);void 0!==IsGallerywithsp&&IsGallerywithsp&&(t.length=0),t.length>0&&(t.click(),void 0!==IsGallerySp&&IsGallerySp&&(IsGallerywithsp=!0))}else{t=GetSelectedMenuObject(e);void 0!==IsGallerywithsp&&IsGallerywithsp&&(t.length=0),t.length>0&&(t.click(),void 0!==IsGallerySp&&IsGallerySp&&(IsGallerywithsp=!0))}},_shopdetail.loadCustomBanner=function(){if("true"!=_shopdetail.isWidget&&"true"!=_shopdetail.isFacebook){var t=e("#divCustombanner");t.css("display","block"),t.attr("aria-labelledby","spnCustomBanner").attr("role","heading").attr("aria-live","polite"),e("#tdBannerContainer").attr("aria-hidden",!0),$imgCustomBanner=e("#imgCustomBanner"),""===t.data().bannerimage&&($imgCustomBanner.css("display","none"),e("#spnCustomBanner").css("display","block"),e("#imgloader").css("display","none")),$imgCustomBanner.load(function(){var t=$imgCustomBanner.height();0==t&&(t=135),e("#spnCustomBanner").css("height",t+"px"),e("#spnCustomBanner").css("display",""),e("#imgloader").css("display","none"),e("#imgCustomBanner").css("display",""),_shopdetail.StickHeader()}),String.isNullOrUndefineOrBlank(t.data().bannerimage)?_siteBuilderDetail.imageErrorStyle($imgCustomBanner[0]):$imgCustomBanner.attr("src",t.data().bannerimage),e(window).on("resize",function(){e("#spnCustomBanner").css("height",e("#imgCustomBanner").height())})}else _shopdetail.StickHeader()},_shopdetail.StickHeader=function(){if(IsPartialPointAllowed="undefined"!=typeof _IsPartialPointAllowed&&_IsPartialPointAllowed,e(_siteBuilderDetail.componentInfo[2]).length){var t=e(_siteBuilderDetail.componentInfo[2]).offset().top-50;(void 0!==_shopdetail.isCustomWebsite&&"true"==_shopdetail.isCustomWebsite||"undefined"!=typeof isWidget&&"true"==isWidget.toLowerCase())&&(t=e(_siteBuilderDetail.componentInfo[2]).offset().top),ScrollTarget.scroll(function(){if(e(_siteBuilderDetail.componentInfo[2]).is(":visible")){var i=_common.getscrollTop(this);if(i>=60){var a=i>t,r=a?"tab-fixednav":"";"relative"==(a?"fixed":"relative")?_common.HeaderTopfixed():(1!=IsNewCustomWebsite&&e(_siteBuilderDetail.componentInfo[2]).addClass(r),e(".pagebodycontainer").addClass("giveNavspace"),e("body").addClass("detailnavfixed"),footerBottomfixed())}else _common.HeaderTopfixed()}else _common.HeaderTopfixed()})}},String.isNullOrUndefineOrBlank=function(e){return void 0===e||null==e||""==e||null==e},_shopdetail.openCloseAddresspopup=function(t){return 1==t?(e("#txtState").attr("disabled",!0),e("html, body").addClass("hide-bgscrollappoint"),e("#divAddressDetails").modal("show"),e("#txtStreet").focus(),!1):(e("#divAddressDetails").modal("hide"),e("html, body").removeClass("hide-bgscrollappoint"),InPageWidget_Ios?e("#txtAddress").focus():_common.nestedHiddenElement("#mobile-check")>0?e("html, body").scrollTop(e("#txtAddress").offset().top):e("html, body").scrollTop(e("#txtAddress").offset().top-100),!1)},e(".close-modal").click(function(){e("#divAddressDetails").modal("hide")}),_shopdetail.ClearAddressValue=function(t){e("#txtStreet").val(""),e("#txtCity").val(""),e("#txtState").val(""),e("#txtZip").val("")},_shopdetail.UpdateCCSelection=function(t){e(t).siblings(".w-tab-link").removeClass("w--current"),e(t).addClass("w--current"),"tabBooking2"!=t.id&&t.id!=_shopdetail.Controls.keyApplePay&&t.id!=_shopdetail.Controls.keyGooglePay&&void 0!==t.dataset&&null!=t.dataset&&(_CCDetailCardOnFile.CCFirstName=t.dataset.ccfirstname,_CCDetailCardOnFile.CCLastName=t.dataset.cclastname,_CCDetailCardOnFile.CCMiddleName=t.dataset.ccmiddlename,_CCDetailCardOnFile.CardTokenId=t.dataset.cardtokenid,_CCDetailCardOnFile.CreditCardNumber=t.dataset.creditcardnumber,_CCDetailCardOnFile.CreditCardType=t.dataset.creditcardtype,_CCDetailCardOnFile.ExpMonth=t.dataset.expmonth,_CCDetailCardOnFile.ExpYear=t.dataset.expyear,_CCDetailCardOnFile.FullName=t.dataset.fullname,_CCDetailCardOnFile.SecurityCode=t.dataset.securitycode,e("#hdnCCTokenID").val(t.dataset.cardtokenid)),e("#divVplAddBankDetails").hide(),e("#divVplCheckoutScreen").hide(),e("#divVplTracking").hide(),e(".mulvplbook").show(),!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.Prepay)&&_shopdetail.IsVCFEnable()&&(_onlineCheckout.isCheckoutVPLChanged=!1,_shopdetail.RemoveVCFFee(),_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.RemoveDiscount))},_shopdetail.OnSelectionChangeServices=function(){e("#txtMaxQuantity","#div_gcContainer").val(1);var t=JSON.parse(e("#txtSalonServicesForGC").data("choice"));if(e("#hdnServiceIDForGC").val(t.id),e("#hdnServiceTitleForGC").val(t.text),"-1"==e("#hdnServiceIDForGC").val()||""==e("#hdnServiceIDForGC").val()||"0"==e("#hdnServiceIDForGC").val())e("#ddQuantity").hide(),e("#txtMaxQuantity").val(1),e("#txtAmount").attr("disabled",!1),e("#ddAmount").hide(),e("#spservice,#spcount").hide(),e("#ddAmount").removeClass("margintop35"),e("#spcount").hide(),e("#spcount,#lblAmount").html(""),e(".txtSalonServicesForGCerrortext").show(),e("#txtSalonServicesForGC").addClass("errorInput");else{e("#cpvAmount").hide(),e("#ddQuantity").show(),e("#txtAmount").removeClass("errorInput"),e("#txtAmount").attr("disabled",!0),e("#ddAmount").addClass("margintop35"),e("#ddAmount").removeClass("errorInput"),e("#ddAmount").show(),e("#spservice,#spcount").show(),e("#spservice").html(t.text),e(".txtSalonServicesForGCerrortext").hide(),e("#txtSalonServicesForGC").removeClass("errorInput"),e("#spcount").show().html(" ( "+e("#txtMaxQuantity").val()+" visit )");var i=new vagaro.ajax;parseInt(e("#hdnServiceIDForGC").val()),Data={},Data.businessID=_siteBuilderDetail.businessID,Data.ServiceId=parseInt(e(_siteBuilderDetail.hdnServiceIDForGC).val()),Data.groupId=_siteBuilderDetail.SQLGroupID,i.datamodel.Token=ApiURLEnumBooking.getservicepricebyserviceid,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=_shopdetail.OnGetServicePrice,i.datamodel.data=Data,i.datamodel.Error=function(e){},i.Post()}},_shopdetail.OnGetServicePrice=function(t){if(_shopdetail.IsIncludeTaxInOnlinePricing&&""!=t.Taxes&&null!=t.Taxes&&"0"!=t.Taxes){let o=t.Taxes.split(",");var i=[],a=0;if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(o.length>0)for(var r=0;r<o.length;r++)i.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(e=>e.BusinessTaxID==o[r]).Tax);a=i.reduce((e,t)=>e+t,0),ServicePrice=CalAccPriceWithTax(t.Price,a)}if(e("#hdnServicePriceForGC").val(ServicePrice),""!=t.sessionDetails){let e=t.sessionDetails.split(","),i=[];for(let t=0;t<e.length;t++){let r=e[t].split("-"),o=parseFloat(r[2]),n=parseFloat(r[3]),s=CalAccPriceWithTax(o.toString(),a),l=CalAccPriceWithTax(n.toString(),a);i.push(r.concat(s,l).join("-"))}t.sessionDetails=i.join(",")}e("#hdnServiceSessionDetailForGC").val(t.sessionDetails)}else e("#hdnServicePriceForGC").val(t.Price),e("#hdnServiceSessionDetailForGC").val(t.sessionDetails);t.Price;e("#txtAmount").val(t.Price),1==t.IsWorkShop?($find("#tab_serviceDropDown #txtMaxQuantity").val(parseInt(t.sessionDetails.split("-")[1])),$find("#tab_serviceDropDown #txtMaxQuantity").attr("disabled","disabled"),$find("#tab_serviceDropDown .arrow-up-down").hide()):($find("#tab_serviceDropDown #txtMaxQuantity").removeAttr("disabled"),$find("#tab_serviceDropDown .arrow-up-down").show()),_shopdetail.CalculateGCServiceAmount()},_shopdetail.CalculateGCServiceAmount=function(t,i){var a=e("#txtMaxQuantity").val();if(null!=e("#hdnServiceSessionDetailForGC").val()&&""!=e("#hdnServiceSessionDetailForGC").val()){var r=parseFloat(_vgClassSessionSelection.CalcSessionPrice(e("#hdnServiceSessionDetailForGC").val(),a,1,!0));_shopdetail.setServicePrice(r),r<=0?_shopdetail.HideShowGCCCDetail(!1):_shopdetail.HideShowGCCCDetail(!0)}else""!=e("#hdnServicePriceForGC").val()&&0!=parseFloat(e("#hdnServicePriceForGC").val())&&(_shopdetail.HideShowGCCCDetail(!0),_shopdetail.setServicePrice(a*parseFloat(e("#hdnServicePriceForGC").val())))},_shopdetail.ShowBankAndEmi=function(t){if(FinalCCAmount=e("#dvservicesdepositprice")[0].innerHTML.replace("$",""),e(t).siblings(".w-tab-link").removeClass("w--current"),e(t).addClass("w--current"),e(".vpl-add-bank").html(""),0==_siteBuilderDetail.isAffirmEnable&&void 0!==ObjBankDetail&&null!=ObjBankDetail&&ObjBankDetail.length>0){var i=ObjBankDetail[0].Id;e("#tmplUserBankListtmplUserBankList").tmpl(ObjBankDetail).appendTo(".vpl-add-bank"),e("#addBankList #rb_"+i).attr("checked","checked"),e("#addBankList").length>0&&e("#dvVPLSubPart").hide()}_shopdetail.IsVCFEnable()&&(_shopdetail.RemoveVCFFee(),_shopdetail.ReApplyDiscounts()),_shopdetail.VPLCalculation(),1==_siteBuilderDetail.isAffirmEnable?(e("#divVplTracking").hide(),_onlineCheckout.addbankclick()):e("#divVplTracking").show(),e("#VplAmountInterestFreeTxt").text("vagaro pay later. "+e("#VplAmountInterestFree").text())},_shopdetail.GetBankDetails=function(){if(ShowLoader(!0),"undefined"!=typeof UserID&&null!==UserID&&""!==UserID&&"0"!=UserID||"undefined"!=typeof glbEncryptUserId&&null!==glbEncryptUserId&&""!==glbEncryptUserId){var e={};"undefined"!=typeof UserID&&null!==UserID&&""!==UserID&&(e.UserID=parseInt(UserID)),isNaN(e.UserID)&&(e.UserID=0),e.EncryptUserID=glbEncryptUserId;var t=new vagaro.ajax;t.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.getuservplaccountdetail,groupID),t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(e){ShowLoader(!1),null!=e&&null!=e&&null!=e.Data.vplUserAccounts&&e.Data.vplUserAccounts.length>0&&(ObjBankDetail=e.Data.vplUserAccounts),_shopdetail.ValidateVPl(!1)},t.datamodel.data=e,t.datamodel.Error=CallFailed,t.Post()}else ShowLoader(!1)},_shopdetail.IsValidateMembershipPackageRecurring=function(){var t=!1;if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&(t=!0),null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0){var i=e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(e){return 1==e.IsRecurring});null!=i&&i.length>0&&(t=!0)}if(null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0){var a=e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(e){return 1==e.IsRecurring});null!=a&&a.length>0&&(t=!0)}return t},_shopdetail.validateTotalAmount=function(e){if(null==typeof e||null==e||""==e)return 0;var t=e.toString().replace(/,/g,"").trim(),i=parseInt(t);return isNaN(i)?0:i},_shopdetail.ValidateVPl=function(t){if(void 0!==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail&&null!=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail&&2==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.VPLStatus&&(void 0!==e("#divServicesTotalPrice")[0].innerHTML&&e("#divServicesTotalPrice")[0].innerHTML.replace("$","")>0||void 0!==e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&e("#dvservicesPrepaypricewithoutGC")[0].innerHTML.replace("$","")>0)&&0==_shopdetail.IsValidateMembershipPackageRecurring()){_shopdetail.DisplayVPLCetegeyOrAffirm(1);var i=e("#divServicesTotalPrice")[0].innerHTML.replace("$","");1==_onlineCheckout.isCheckoutVPLPromocode&&null!=_onlineCheckout.totalfinalAmount&&(i=_onlineCheckout.totalfinalAmount),null!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&null!=e("#dvservicesPrepaypricewithoutGC")[0].innerHTML&&null!=e("#divServicesTotalPrice")[0].innerHTML&&null!=e("#divServicesTotalPrice")[0].innerHTML&&((i=null!=_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay.ccAmt&&null!=_shopdetail.BookingDetail.Prepay.ccAmt&&0!=_shopdetail.BookingDetail.Prepay.ccAmt?_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+_shopdetail.BookingDetail.TipAmount):e("#dvservicesdepositprice").text().replace("$",""))<=0&&(i=e("#divServicesTotalPrice").text().replace("$","")),e("#tabVagaroPayLater").hide(),e("#dvVPLdeposit").hide(),e("#VPLImageaftr1").css("display","none")),void 0!==r&&null==r&&e("#dvBookingTabs").show(),i=_shopdetail.validateTotalAmount(i),t?i>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&i<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount?(_onlineCheckout.IsVplChanged=!0,e("#tabVagaroPayLater").show(),_shopdetail.VPLMessage(_shopdetail.vplamt)):(e("#tabBooking1").siblings(".w-tab-link").removeClass("w--current"),_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide(),e("#tabBooking1").addClass("w--current"),e("#tabVagaroPayLater").removeClass("w--current")):i<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount&&i>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount?1==_onlineCheckout.IsRecurringMembership||1==_onlineCheckout.IsRecurringPkg?(_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide()):(_onlineCheckout.IsVplChanged=!0,void 0!==r&&null!=r&&(e("#tabVagaroPayLater").removeClass("first-tab"),e("#tabVagaroPayLater").addClass("mid-tab")),e("#tabVagaroPayLater").show(),_shopdetail.VPLMessage(_shopdetail.vplamt)):(_onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide()),_shopdetail.VPLMessage(i)}else _onlineCheckout.IsVplChanged=!1,e("#tabVagaroPayLater").hide()},_shopdetail.Addnewbank=function(){_onlineCheckout.VPLBankDetailsBind;var t=JSON.parse(e("#hdnUserDetails").val());null==t.CountryName&&(t.CountryName=""),null==t.StateCode&&(t.StateCode=""),_onlineCheckout.customerEnroll.submerchant_id=128789,_onlineCheckout.customerEnroll.UserID=t.UserID,_onlineCheckout.customerEnroll.billing_address={city_locality:t.City,postal_code:t.Zip,line_1:t.Street,line_2:t.StreetNo,country_code:t.CountryName,state_province:t.StateCode},_onlineCheckout.customerEnroll.company_name="",null!=t.BirthDate&&""!=t.BirthDate?(_onlineCheckout.customerEnroll.date_of_birth=moment(t.BirthDate)._d.format("yyyy-mm-dd"),"1-01-01"==_onlineCheckout.customerEnroll.date_of_birth&&(_onlineCheckout.customerEnroll.date_of_birth="1900-01-01")):_onlineCheckout.customerEnroll.date_of_birth="1900-01-01",_onlineCheckout.customerEnroll.email_address=t.EmailId,_onlineCheckout.customerEnroll.email_address_is_verified=!0,_onlineCheckout.customerEnroll.external_customer_id="101",_onlineCheckout.customerEnroll.first_name=t.FirstName,_onlineCheckout.customerEnroll.last_name=t.LastName,_onlineCheckout.customerEnroll.phone_number=t.Cell,_onlineCheckout.customerEnroll.phone_number_is_verified=!0,_onlineCheckout.customerEnroll.merchant_token_id=_shopdetail.MerchantTokenID,_vgVPLOnline.EnrollNewUser(_onlineCheckout.customerEnroll)},_shopdetail.PaymentSchedule=function(){_vgVPLOnline.PaymentSchedule(onlineShoppingCart.FinalCCAmount,_shopdetail.PaymentSchduleSuccess,_shopdetail.PaymentSchdulefail)},_shopdetail.PaymentSchduleSuccess=function(t){if(0==t.IsSucess)return ShowLoader(!1),void _common.PassiveAlertFailed("Certegy under maintance.");if(void 0!==t&&null!=t){var i=[],a=0;e.grep(t.InstallmentDetails,function(t){var r={};r.Index=a,r.Amount="$"+_onlineCheckout.ConvertDecimalWithFixed(t.amount,!0,2),r.Date=moment(t.date).format("MMM D, YYYY"),i.push(r),0==a&&(e("#VplAmount")[0].innerHTML=r.Amount,e(".duetodayCheckoutScreen").text("Due Today: "+r.Amount)),a++}),e(".timeline-text-div").html(""),e("#tmplPaymentScheduleList").tmpl(i).appendTo(".timeline-text-div"),_shopdetail.GetVplMerchantID()}"0"==e("#finalCheckout").val()?ShowLoader(!1):e("#finalCheckout").val("0")},_shopdetail.PaymentSchdulefail=function(e){ShowLoader(!1),_common.PassiveAlertFailed("Some error occured. Please try again.")},_shopdetail.setServicePrice=function(t){if("undefined"!=typeof vgAppicationType&&vgAppicationType==objApplicationType.CheckinApp&&_siteBuilderDetail.isAffirmEnable)return e("#dvservicemsg").hide(),e("#VPLImageaftr").css("display","none"),void e("#VPLImageBfr").css("display","none");if(e("#txtAmount").val(t),_siteBuilderDetail.isAffirmEnable){const t="https://vagaro.azureedge.net/static/assets/new_affirm_logo2.png";e("#VPLImageaftr img, #VPLImageBfr img").attr("src",t).addClass("AffirmImageLogo")}if(2==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.VPLStatus||1==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.VPLStatus)if(0==t)e("#dvservicemsg").hide(),e("#VPLImageaftr").css("display","none"),e("#VPLImageBfr").css("display","none");else{var i=t/4;i=i.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,"),t<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount?(e("#dvservicemsg").css("display","block"),e("#dvservicemsg")[0].innerText=" or 4 payments of "+_shopdetail.currencySymbol+i+" with ",e("#VPLImageaftr").css("display","block"),_siteBuilderDetail.isAffirmEnable&&(e("#dvservicemsg")[0].innerText="Pay over time for orders of $"+_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"+ with ",e("#dvservicemsg").addClass("affirm-as-low-as"),e("#dvservicemsg").attr("data-page-type","product"),e("#dvservicemsg").attr("data-amount",Math.round(100*t)),e("#VPLImageaftr").css("display","none"),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh?affirm.ui.refresh():e("#VPLImageaftr").css("display","block")),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&t<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e("#dvservicemsg").css("display","none")):(e("#dvservicemsg").hide(),e("#VPLImageaftr").css("display","none")),e("#VPLImageBfr").css("display","none"),e("#dvVPLGc").hide(),e("#VPLImageaftr1").css("display","none"),e("#VPLImageBfr1").css("display","none"),e("#VPLImageaftr").attr("aria-label"," or  4 payments of "+_shopdetail.currencySymbol+i+" with vagaro pay later"),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&t<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e("#VPLImageaftr").css("display","none")}else e("#dvservicemsg").hide(),e("#VPLImageaftr").css("display","none"),e("#VPLImageBfr").css("display","none");e("#lblAmount").html(("undefined"!=typeof currencySymbol&&null!=currencySymbol?currencySymbol:"")+" "+t)},_shopdetail.setAffirmServicePrice=function(t){e("#txtAmount").val(t),2==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.VPLStatus||1==_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.VPLStatus?0==t?(e("#dvservicemsg").hide(),e("#AffirmImageaftr").css("display","none"),e("#AffirmImageBfr").css("display","none")):(t<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount?(e("#AffirmImageaftr").css("display","block"),e("#AffirmImageaftr").attr("data-amount",Math.round(100*t)),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&t<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e("#dvservicemsg").css("display","none")):(e("#dvservicemsg").hide(),e("#AffirmImageaftr").css("display","none")),e("#AffirmImageBfr").css("display","none"),e("#dvAffirmGc").hide(),e("#AffirmImageaftr1").css("display","none"),e("#AffirmImageBfr1").css("display","none"),e("#AffirmImageaftr1").attr("data-amount",Math.round(100*t)),"undefined"!=typeof affirm&&affirm.ui&&"function"==typeof affirm.ui.refresh&&affirm.ui.refresh(),_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.ShowNoOfPayment==ShowVPLNoOfPayment.Hide&&t<_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e("#AffirmImageaftr").css("display","none")):(e("#dvservicemsg").hide(),e("#AffirmImageaftr").css("display","none"),e("#AffirmImageBfr").css("display","none")),e("#lblAmount").html(("undefined"!=typeof currencySymbol&&null!=currencySymbol?currencySymbol:"")+" "+t)},_shopdetail.HideShowGCCCDetail=function(t){1==t?(e("#hdnIsCCDisplay").val("1"),e("#GCCCDetails").show(),e("#dvGCPrintEmail").css("margin-top","")):(e("#hdnIsCCDisplay").val("0"),e("#GCCCDetails").hide(),e("#dvGCPrintEmail").css("margin-top","0"))},_shopdetail.backClickGCGenerete=function(){e(_siteBuilderDetail.divGiftCardContainer).removeClass("inactive-gcflex"),e("#div_gcContainer").removeClass("gc-transitionNone");var t=Webflow.require("ix"),i=e(_siteBuilderDetail.divInnerGCContainer),a={type:"click",selector:_siteBuilderDetail.divInnerGCContainer,preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",x:"101%",y:"0px",z:"0px"}],stepsB:[]};t.run(a,i);var r=Webflow.require("ix"),o=e(_siteBuilderDetail.divGiftCardContainer);o={type:"click",selector:_siteBuilderDetail.divGiftCardContainer,preserve3d:!0,stepsA:[{transition:"transform 300ms ease 0",x:"0%",y:"0px",z:"0px"}],stepsB:[]};r.run(o,o),e(_siteBuilderDetail.divGiftCardContainer).show(),e(_siteBuilderDetail.divInnerGCContainer).hide(),e("#gt_title").attr("role","heading").attr("tabindex",-1).focus()},_shopdetail.convertHEICToJPEG=function(e,t){e=e.toLowerCase().replace(/\.heic/,".jpeg"),isWebBrowserSupportHEIC()?getJPEGFileFromHEICWeb(t,e,function(e){var t=new FileReader;t.onload=function(t){_shopdetail.parseOrientation(_shopdetail.getOrientation(t.target.result),e,t.target.result),ShowLoader(!1)},t.readAsArrayBuffer(e)}):HEICReadFile(t,function(t){var i=[];i.push({imageName:e,base64:t.target.result});var a={fromPage:"customerappreview",images:i},r={navType:0,screenType:0,screenTitle:"",message:"",messageType:0,action:"104|~|"+JSON.stringify(a)};HEICtoJPGPostMessage("5008||~||"+JSON.stringify(r))})};var c={1:"us-f",2:"uk-f",3:"canada-f",4:"aus-f"};function u(t,i){var a="";if(1==_shopdetail.IsMemPkgReqToBook&&null!=MembershipPackageDetails&&1e3==MembershipPackageDetails.ResponseCode&&null!=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation&&null!=MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse&&MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse.length>0){var r=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation;if(r.IsMemPkgReqToBook&&null!=r.RequiredServices&&""!=r.RequiredServices){var o=r.RequiredServices.split(","),n=t.split(","),s=i.split("||~||"),l=[],d=!1;e.each(n,function(e,t){-1!=jQuery.inArray(t,o)&&(d=!0,l.push(s[e]))}),d&&(a=l.join(", "))}}return{ReqServicesNames:a}}_shopdetail.txtLiveStreamAddress="#txtServiceLiveStreamAddress",_shopdetail.clscountryselectmyacprofile=".countryselectmyacprofile",_shopdetail.hdnServiceLiveStreamCountryId="#hdnServiceLiveStreamCountryId",_shopdetail.selectCountryDiv="#selectedCountrudiv",_shopdetail.divServiceLiveStreamAddressControl="#divServiceLiveStreamAddressControl",_shopdetail.SelectLiveStreamCountry=function(t){e(_shopdetail.txtLiveStreamAddress).select2("val"," "),e(_shopdetail.selectCountryDiv).removeClass().addClass("selectedcountry "+c[t]),e(_shopdetail.hdnServiceLiveStreamCountryId).val(t),e(".countryselectoption").hide(),e(_shopdetail.txtLiveStreamAddress).select2("focus")},_shopdetail.ShowLiveStreamCountry=function(){return e(_shopdetail.clscountryselectmyacprofile).is(":visible")?void e(_shopdetail.clscountryselectmyacprofile).hide():void e(_shopdetail.clscountryselectmyacprofile).show()},_shopdetail.SetLiveStreamAddressControl=function(){var t=e(_shopdetail.txtLiveStreamAddress).select2({searchInputPlaceholder:"City or Zip Code",minimumInputLength:1,combobox:!0,dropdownCssClass:"select-location-icons select2-drop-active select-customdropdown",selectOnClick:!0,multiple:!1,closeOnSelect:!0,allowClear:!0,ajax:{type:"POST",contentType:"application/json; charset=utf-8",url:"/WebServices/CommonWebService.asmx/GetLocationOrPlaceDetail",dataType:"json",quietMillis:250,transport:function(t){return t.beforeSend=function(t){try{"function"==typeof EncH&&t.setRequestHeader("H",EncH())}catch(e){}t.setRequestHeader("K",getek()),t.setRequestHeader("I",getei()),t.setRequestHeader("Val",EncIV()),"undefined"!=typeof keepAlive&&t.setRequestHeader("keepAlive",keepAlive),1==e("#hdnToken1").length&&void 0!==e("#hdnToken1").val()&&t.setRequestHeader("token1",e("#hdnToken1").val()),1==e("#hdnToken2").length&&void 0!==e("#hdnToken2").val()&&t.setRequestHeader("token2",e("#hdnToken2").val()),1==e("#hdnToken0").length&&void 0!==e("#hdnToken0").val()&&t.setRequestHeader("token0",e("#hdnToken0").val())},e.ajax(t)},data:function(){return{searchText:e(_shopdetail.txtLiveStreamAddress).val(),countryFilter:countryMapping[e(_shopdetail.hdnServiceLiveStreamCountryId).val()],Location:(""!=lattitude?parseFloat(lattitude):0)+","+(""!=longitude?parseFloat(longitude):0)}},results:function(e,t){return{results:e}},params:{error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}}},cache:!1},formatNoMatches:function(){return e("#select2-drop").css("display","block"),"No matches found"},formatSearching:function(){return e("#select2-drop").css("display","block"),"Searching"},formatInputTooShort:function(t,i){return e("#select2-drop").css("display","none"),""},initSelection:function(t,i){i({id:e(_shopdetail.txtLiveStreamAddress).val(),text:e(_shopdetail.txtLiveStreamAddress).val()})},formatResult:function(t){return e("#select2-drop").css("display","block"),'<div data-placeid="'+t.place_id+'"><span class="fullocation">'+t.FormattedAddress+"</span></div>"}});t.on("select2-loaded",function(t){e(".select2-result-unselectable").addClass("select2-result-selectable").removeClass("select2-result-unselectable")}),t.on("select2-blur",function(e){e.preventDefault()}),t.on("selected",function(t){ShowLoader(!0),e(t.currentTarget).select2("val",t.choice.CityState),e(t.currentTarget).attr("data-isselected","true"),e(t.currentTarget).attr("data-preval",t.choice.CityState),e(t.currentTarget).data("selectedid",t.choice.CityState);var i=new vagaro.ajax;i.datamodel.Token=ApiURLEnumOnlineCommon.getlocationsearchbyplaceid,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data={placeID:t.choice.place_id},i.datamodel.callback=function(t){if(ShowLoader(!1),null!=t&&"null"!=t){var i=null!=t&&null==t.city?"":t.city.split(",")[0],a=null==t.state?"":t.state;a=a.trim();var r={};r.street=t.Address,r.city=i,r.state=a,r.zip=t.zipCode,r.countryId=t.countryID,r.countrytext=countryMapping[t.countryID],r.statecode=t.stateCode,r.rowOffSet=t.utcOffset,r.timeZoneOffSet=t.timeZoneOffSet,r.isSupportDayLight=t.IsSupportDayLight,e("#hdnServiceLiveStreamSelectedVal").val(JSON.stringify(r)),_shopdetail.ChangeCustomerStartTime(t.timeZoneOffSet,t.countryID,t.IsSupportDayLight)}},i.datamodel.Error=function(e){ShowLoader(!1),console.log(e)},i.Post()}),t.on("select2-close",function(t){e(t.currentTarget).removeAttr("data-isselected")})},_shopdetail.InitLiveStreamAddressControl=function(){e(_shopdetail.txtLiveStreamAddress).val(e("#hdnServiceLiveStreamSelectedVal").data("actualvalue")),e(_shopdetail.hdnServiceLiveStreamCountryId).val(e(_shopdetail.hdnServiceLiveStreamCountryId).data("actualvalue")),e(_shopdetail.selectCountryDiv).removeClass().addClass("selectedcountry "+c[e(_shopdetail.hdnServiceLiveStreamCountryId).val()]);var t={};t.country=e(_shopdetail.hdnServiceLiveStreamCountryId).data("actualvalue"),liveStreamAddress=e(_shopdetail.txtLiveStreamAddress).GoogleAddressPlugin({AddressFor:2,IsLiveStreamAddress:!0,CurrentLocationCountryID:"undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail?countryIdBusDetail:1,AddressData:t}),_shopdetail.NewAddressHtml()},_shopdetail.NewAddressHtml=function(){try{var t=getQueryStringData("Type");IsNewAddressHtml=!0;var i=e("#txtLocationSearch").val(),a=getCookie("proximitystate_v3");0!=_siteBuilderDetail.IsShowNewadd||"OnBoarding"!=t&&"ImportOnBoarding"!=t||void 0===_siteBuilderDetail.OnBoardingLocationAddress||null==_siteBuilderDetail.OnBoardingLocationAddress||""==_siteBuilderDetail.OnBoardingLocationAddress?(void 0===i||null==i||""==i||_siteBuilderDetail.IsShowNewadd)&&"undefined"!=a&&null!=a&&(i=void 0!==a.city&&null!=a.city&&""!=a.city?_common.SetCityState(htmlEncode(a.city),htmlEncode(a.state),a.countryid):GetCityStateValueFromLiveStream()):i=_siteBuilderDetail.OnBoardingLocationAddress;var r='<span class="web-builder-font-color">Location: </span><a id="aCityState" class="text-link-primary" href="javascript:void(0);" style="text-decoration: underline;" class="location-link ghost-button" onclick="_shopdetail.OpenSearchLocationDiv();">'+i+"</a>";e("#newtimezone").html(r)}catch(e){}},_shopdetail.SetEventDateFormat=function(e,t,i,a,r){return String.isNullOrUndefineOrBlank(t)||String.isNullOrUndefineOrBlank(i)?String.isNullOrUndefineOrBlank(t)?String.isNullOrUndefineOrBlank(r)?void 0:countryDateFormat(moment(r),VagaroCountryDateFormat.SmallDate):countryDateFormat(moment(t),VagaroCountryDateFormat.LargeDateWithTime):1==a?countryDateFormat(moment(t),VagaroCountryDateFormat.LargeDate):countryDateFormat(moment(t),VagaroCountryDateFormat.LargeDateWithTime)+" ("+i+")"},_shopdetail.ChangeCustomerStartTime=function(e,t,i){ShowLoader(!0);for(var a=[],r=0;r<_shopdetail.BookingDetail.serviceid.split(",").length;r++){var o={};o.ServiceID=_shopdetail.BookingDetail.serviceid.split(",")[r],o.ServiceStartTime=_shopdetail.BookingDetail.starttime.split(",")[r],o.UTCStartTime=_shopdetail.BookingDetail.UtcStartTime.split(",")[r],o.ServiceDuration=_shopdetail.BookingDetail.duration.split(",")[r],o.ServiceProviderID=_shopdetail.BookingDetail.spid.split(",")[r],a.push(o)}var n={ShoppingCartEvent:null,AppointmentCartDetail:a,TimeZoneOffSet:e,CountryId:t,IsSupportDayLight:i,BusinessID:_shopdetail.businessID},s=new vagaro.ajax;s.datamodel.Token=ApiURLEnumOnlineCheckout.geteventtimezonedate,s.datamodel.IsNewVagaroAPI=!0,s.datamodel.data={objRequest:n},s.datamodel.callback=function(e){ShowLoader(!1),null!=e&&null!=e.AppointmentCartDetail&&e.AppointmentCartDetail.length>0&&_shopdetail.SetCustomerStartTimeValue(e.AppointmentCartDetail)},s.datamodel.Error=function(e){ShowLoader(!1)},s.Post()},_shopdetail.SetCustomerStartTimeValue=function(t){null!=t&&t.length>0&&e.grep(t,function(t){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(i.serviceid==t.ServiceID&&i.spID==t.ServiceProviderID&&null!=t.CustomerTimeZone&&null!=t.CustomerStartTime){i.CustomerStartTime=t.CustomerStartTime,i.CustomerEndTime=t.CustomerEndTime,i.CustomerTimeZone=t.CustomerTimeZone,e("#div"+parseInt(i.AppSrNo-1)+"_"+t.ServiceID+" .timeZone").remove();var a="<div  class='brand-name-checkout thm-textColor timeZone'>"+_shopdetail.SetEventDateFormat(t.appBookingDate,t.CustomerStartTime,t.CustomerTimeZone,!1)+"</div>";e("#div"+parseInt(i.AppSrNo-1)+"_"+t.ServiceID+" .div-block-37").append(a)}else{String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)&&(_shopdetail.BookingDetail.browserCustomerTime=_shopdetail.BookingDetail.starttime);var r=moment(_shopdetail.BookingDetail.date).format("yyyy/MM/DD")+" "+(String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.browserCustomerTime)?_shopdetail.BookingDetail.starttime:_shopdetail.BookingDetail.browserCustomerTime);e("#div"+parseInt(i.AppSrNo-1)+"_"+t.ServiceID+" .timeZone").remove();a="<div  class='brand-name-checkout thm-textColor timeZone'>"+_shopdetail.SetEventDateFormat(t.appBookingDate,r,_shopdetail.BookingDetail.browserCustomerTimezone,!1,t.ServiceStartTime)+"</div>";e("#div"+parseInt(i.AppSrNo-1)+"_"+t.ServiceID+" .div-block-37").append(a)}})})},_shopdetail.BusinessStartTime=function(e,t,i,a){try{ShowLoader(!0);var r={ShoppingCartEvent:null,BusinessCartDetail:[{UTCStartTime:""}],TimeZoneOffSet:e,CountryId:t,IsSupportDayLight:i,BusinessID:_shopdetail.businessID},o=bkEventTimeZone.buildKey(r),n=null;try{n=bkEventTimeZone.getResponseFromCache(o)}catch(e){}if(n&&n.BusinessCartDetail&&Array.isArray(n.BusinessCartDetail))return _shopdetail.SetBusinessStartTime(n.BusinessCartDetail,a),void ShowLoader(!1);var s=new vagaro.ajax;s.datamodel.IsNewVagaroAPI=!0,s.datamodel.Token=ApiURLEnumOnlineCheckout.geteventtimezonedate,s.datamodel.data={objRequest:r},s.datamodel.callback=function(e){try{if(e&&e.BusinessCartDetail){try{bkEventTimeZone.addResponseToCache(o,e)}catch(e){console.warn("Cache write failed:",e)}_shopdetail.SetBusinessStartTime(e.BusinessCartDetail,a)}}catch(e){}finally{ShowLoader(!1)}},s.datamodel.Error=function(e){ShowLoader(!1)},s.Post()}catch(e){console.error("Unexpected error in BusinessStartTime:",e),ShowLoader(!1)}},_shopdetail.SetBusinessStartTime=function(t,i){null!=t&&t.length>0&&e.grep(t,function(e){var t=e.CustomerTimeZone;_shopdetail.SetBusinessStartTimeLabel(t,i)})},_shopdetail.SetTimeHtml=function(){var t=e("#txtLocationSearch").val(),i=getCookie("proximitystate_v3");"undefined"!=i&&null!=i&&(t=void 0!==i.city&&null!=i.city&&""!=i.city?_common.SetCityState(htmlEncode(i.city),htmlEncode(i.state),i.countryid):GetCityStateValueFromLiveStream());var a='<span class="web-builder-font-color">Time Based On: </span><a id="aCityState" class="text-link-primary" href="javascript:void(0);" style="text-decoration: underline;" class="location-link ghost-button" onclick="_shopdetail.OpenSearchLocationDiv();">'+t+"</a>";e("#timezone").html(a);var r=getQueryStringData("Type");"OnBoarding"!=r&&"ImportOnBoarding"!=r||(_siteBuilderDetail.OnBoardingLocationAddress=t)},_shopdetail.SetBusinessStartTimeLabel=function(t,i){"undefined"!=t&&null!=t&&(t=t.replace("{{timezone}}"),_shopdetail.timeZone=t,null!=e("#timezone").text()&&""!=e("#timezone").text()||_shopdetail.SetTimeHtml());var a=!1;try{for(var r=_shopdetail.VisibleControlLength("#dvSections .dvSectionDynamic")+1,o=1;o<=r;o++){if(null!=(s=e("#txtService"+o).data("choice"))&&""!=s)if(1==JSON.parse(s).IsZoomIntegrated){a=!0;break}}}catch{}try{var n=i;if("undefined"!=n&&null!=n)for(o=0;o<=n.length-1;o++){var s;if(""!=(s=n[o])&&1==s.IsZoomIntegrated&&s.StreamingEventCapacity>0){a=!0;break}}}catch{}a=void 0!==a&&a,"undefined"!=_shopdetail.timeZone&&null!=_shopdetail.timeZone&&a&&void 0!==getCookie("proximitystate_v3")?e("#dvtimezone").show():"undefined"==_shopdetail.timeZone||!e("#dvStreamType").is(":visible")||"1"!=bkClassAvailableDates.model.csvFilterType&&"3"!=bkClassAvailableDates.model.csvFilterType||1!=n[0].IsLivestreamAvl||void 0===getCookie("proximitystate_v3")?e("#dvtimezone").hide():e("#dvtimezone").show()},_shopdetail.OpenSearchLocationDiv=function(){e("#divLiveStreamLocationSearchPopUp").modal("show"),e("#txtLiveStreamLocationSearch").select2("destroy"),e("#txtLiveStreamLocationSearch").off("selected"),e("#txtLiveStreamLocationSearch").off("select2-close");new ProximitySearch(e("#txtLiveStreamLocationSearch"),e("#hdngblCountryId"),e("#navCountryList")).init("service-where-dropdown mobcommon-dropdown liveStreamSearchClass",!1);e("#txtLiveStreamLocationSearch").parent().find(".select2-input").val(""),e(".liveStreamSearchClass").css("z-index","99999"),e("#txtLiveStreamLocationSearch").parent().find(".select2-input").attr("placeholder","Search for a Location"),e("input.select2-input").attr("autocomplete","off"),setTimeout(function(){null!=e("#divLiveStreamLocationSearchPopUp").css("display")&&"none"!=e("#divLiveStreamLocationSearchPopUp").css("display")&&e("#txtLiveStreamLocationSearch").parent().find(".select2-input").click()},500)},_shopdetail.RebindAfterLocationChange=function(){var t=getCookie("proximitystate_v3");if("undefined"!=t&&null!=t){var i=["United States","United States","United Kingdom","Canada","Australia"];e("#txtLocationSearch").val(GetCityStateValueFromLiveStream()+", "+i[t.countryid])}_shopdetail.SetTimeHtml(),"classes"==tabSegment?(e("#hdnSearchClass").val("SearchClass"),_vgClassSessionSelection.LoadClassDataForClassTab()):(_shopdetail.setLocationCookieData(),e("#hdnIsSearchAvailability").val("Search Availability"),CheckDailyDealsOffer("rebind"));var a=getQueryStringData("Type");"OnBoarding"!=a&&"ImportOnBoarding"!=a||(_siteBuilderDetail.OnBoardingLocationAddress=GetCityStateValueFromLiveStream()+", "+i[t.countryid]),e("html, body").removeClass("moboverflow-hide")},_shopdetail.GetCoreAPIURLWithToken=function(e,t){try{var i="",a=VagaroCorePublicAPIURLV2.split("/");if(void 0!==t&&null!=t&&""!=t)a[3]=t,i=a.join("/")+e;else if("undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID){var r=myAccountUserGroupID.split(",");r.length>0&&(a[3]=r[0],i=a.join("/")+e)}return""==i&&(i=VagaroCorePublicAPIURLV2+e),i}catch(t){return VagaroCorePublicAPIURLV2+e}},_shopdetail.flagChange=function(){var t=e("#mycountrypopup");if(t!==event.target&&!t.has(event.target).length){if("mycountrypopup"==event.target.id)return e(".selectoptionpopup").hasClass("active")?(e(".selectoptionpopup").css("display","none"),e(".selectoptionpopup").removeClass("active"),!1):(e(".selectoptionpopup").css("display","block"),e(".selectoptionpopup").addClass("active"),!1);e(".selectoptionpopup").css("display","none"),e(".selectoptionpopup").removeClass("active")}},_shopdetail.ApplyMultipleTax=function(t,i){var a=i.BusinessTax;return void 0!==a&&null!=a&&""!=a&&e.grep(a,function(e){_shopdetail.CheckPriceWithTaxSwitch()&&"431131"==_shopdetail.businessID?e.CalculatedTax=t*e.Tax/100:e.CalculatedTax=_shopdetail.parseTodecimal(t*e.Tax/100,3)}),a},_shopdetail.ApplyServiceFee=function(t,i){t=0;var a,r=0;if("7"==i){var o=_shopdetail.BookingDetail.MembershipUpSellData;null!=o&&o.length>0&&e.each(o,function(e,i){t+=parseFloat(i.ActualPrice||0),r+=1})}else e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){null!=e.GCDetail&&e.GCDetail.length>0&&e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(t+=parseFloat(e.GCDetail[0].redeemAmt),r+=1):0!=e.PromotionId?(t+=parseFloat(e.priceOriginal),r+=1):e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points?(t+=parseFloat(e.PartialPrice),r+=1):(t+=parseFloat(e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||e.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||e.PromotionId>0?e.ServiceOrginalPrice-e.Discount:e.priceOriginal-e.Discount),r+=1)});void 0!==(a="99"==i?e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){return 1==e.FeeType}):e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){return 0==e.FeeType}))&&null!=a&&""!=a&&1==_IsPrepay&&e.grep(a,function(a){a.CalculatedFees=0;var o=a.ApplyType.split(",");1==a.AutoApplyFees&&o.indexOf(i)>-1&&(0==a.TransactionType?(a.Qty=r,1==a.AmountType?a.CalculatedFees+=_shopdetail.parseTodecimal(a.FeeAmount*r,3):a.CalculatedFees+=_shopdetail.parseTodecimal(t*a.FeeAmount/100,3)):(a.Qty=1,1==a.AmountType?a.CalculatedFees=a.FeeAmount:a.CalculatedFees=_shopdetail.parseTodecimal(t*a.FeeAmount/100,3))),null!=a.BusinessTax&&a.BusinessTax.length>0&&e.grep(a.BusinessTax,function(e){e.CalculatedTax=_shopdetail.parseTodecimal(e.Tax*a.CalculatedFees/100,3)}),a.paidType=1==_shopdetail.IsPrepayBusinessFee()?arrpaidType.Paid:arrpaidType.Deposits})},_shopdetail.IsPrepayBusinessFee=function(){var t=!0;return e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){e.paidType!=arrpaidType.Paid&&e.paidType!=arrpaidType.PartiallyPaid&&(t=!1)}),t},_shopdetail.ApplyFeesValue=function(t){fees=t?e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){return 1==e.FeeType}):_shopdetail.BookingDetail.FeeDetails;var i=0,a=0,r=0,o=0,n=0;1==_IsPrepay&&null!=fees&&null!=fees&&""!=fees&&e.grep(fees,function(t){a+=t.CalculatedFees,r=t.redeemAmount,o=t.redeemTax,n=0,null!=t.BusinessTax&&t.BusinessTax.length>0&&e.grep(t.BusinessTax,function(e){i+=e.CalculatedTax,n+=e.CalculatedTax});var s=_shopdetail.parseTodecimal(t.CalculatedFees+n);t.paidType==arrpaidType.Paid||1==t.FeeType?_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt+s-(r+o)):_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining+s),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid+s),_shopdetail.BookingDetail.Prepay.tax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.tax+n),_shopdetail.BookingDetail.Prepay.Rtax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.Rtax+n),_shopdetail.BookingDetail.Prepay.RdisplayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.RdisplayTax+n),_shopdetail.BookingDetail.Prepay.displayTax=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.displayTax+n)}),_shopdetail.BookingDetail.totalFeeAmount=_shopdetail.parseTodecimal(a,3),_shopdetail.BookingDetail.totalFeeTax=_shopdetail.parseTodecimal(i,3)},_shopdetail.DisplayBusinessTaxes=function(){e("#divServiceMultipleTaxes").hide(),e("#divServiceMultipleTaxes").html("");var t=[];null!=_shopdetail.BookingDetail.AppointmentDetail&&_shopdetail.BookingDetail.AppointmentDetail.length>0&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){i.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&!i.IsPartialPoint||i.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||null!=(o=i.BusinessTax)&&""!=o&&e.each(o,function(e,i){t.push(i)});for(var a=0;a<SelectedAddonService.length;a++)if(SelectedAddonService[a].MainServiceID==i.serviceid&&SelectedAddonService[a].SrNo==i.AppSrNo)for(var r=0;r<SelectedAddonService[a].lstAddonService.length;r++){var o,n=SelectedAddonService[a].lstAddonService[r];if((n.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points||n.IsPartialPoint)&&n.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package)null!=(o=n.BusinessTax)&&""!=o&&e.each(o,function(e,i){t.push(i)})}}),null!=_shopdetail.BookingDetail.FeeDetails&&_shopdetail.BookingDetail.FeeDetails.length>0&&e.grep(_shopdetail.BookingDetail.FeeDetails,function(i){var a=i.BusinessTax;null!=a&&""!=a&&e.each(a,function(e,i){t.push(i)})}),null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.MembershipUpSellData,function(i){var a=i.BusinessTax;null!=a&&""!=a&&e.each(a,function(e,i){t.push(i)})}),null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0&&e.grep(_shopdetail.BookingDetail.PackageUpSellData,function(i){var a=i.BusinessTax;null!=a&&""!=a&&e.each(a,function(e,i){t.push(i)})});var i=[];if(t.reduce(function(e,t){return e[t.TaxName]||(e[t.TaxName]={TaxName:t.TaxName,Tax:0,CalculatedTax:0,BusinessTaxID:t.BusinessTaxID},i.push(e[t.TaxName])),e[t.TaxName].Tax+=t.Tax,e[t.TaxName].CalculatedTax+=parseFloat(t.CalculatedTax),e},{}),null!=i&&i.length>0){e("#divServiceMultipleTaxes").html("");for(var a="",r=0;r<i.length;r++){var o=i[r].CalculatedTax;String.isNullOrUndefineOrBlank(o)||0==o||(a+='<div class="div-block-26" role="contentinfo" aria-labelledby="divServiceMultipleTaxes"><div id="divServiceTaxTitle_'+i[r].BusinessTaxID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+i[r].TaxName+'</div><div id="divServiceTaxValue_'+i[r].BusinessTaxID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+_shopdetail.BookingDetail.CurrencySymbol+o.format("#.##")+"</div></div>")}e("#divServiceMultipleTaxes").html(a),e("#divServiceMultipleTaxes").show()}},_shopdetail.DisplayBusinessFees=function(){if(e("#divServiceMultipleFees").hide(),e("#divServiceMultipleFees").html(""),null!=_shopdetail.BookingDetail.FeeDetails&&_shopdetail.BookingDetail.FeeDetails.length>0){var t="";e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){if(0==e.FeeType){var i=e.CalculatedFees;String.isNullOrUndefineOrBlank(i)||0==i||(t+='<div class="div-block-26" role="contentinfo" aria-labelledby="divFeesTitle divServiceMultipleFees"><div id="divServiceFeesTitle_'+e.BusinessFeeID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+e.FeeName+'</div><div id="divServiceFeesValue_'+e.BusinessFeeID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+_shopdetail.BookingDetail.CurrencySymbol+i.format("#.##")+"</div></div>")}});var i=e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){return 1==e.FeeType});if(void 0!==i&&null!=i&&i.length>0){itemFees=i[0];var a=itemFees.CalculatedFees*i.length;String.isNullOrUndefineOrBlank(a)||0==a||(i.length>1?t+='<div class="div-block-26" role="contentinfo" aria-labelledby="divFeesTitle divServiceMultipleFees"><div id="divServiceFeesTitle_'+itemFees.BusinessFeeID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+itemFees.FeeName+" ( "+_shopdetail.BookingDetail.CurrencySymbol+itemFees.CalculatedFees.format("#.##")+') </div><div id="divServiceFeesValue_'+itemFees.BusinessFeeID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+_shopdetail.BookingDetail.CurrencySymbol+a.format("#.##")+"</div></div>":t+='<div class="div-block-26" role="contentinfo" aria-labelledby="divFeesTitle divServiceMultipleFees"><div id="divServiceFeesTitle_'+itemFees.BusinessFeeID+'" aria-hidden="true" class="web-body-font web-builder-font-color">'+itemFees.FeeName+'</div><div id="divServiceFeesValue_'+itemFees.BusinessFeeID+'" class="web-body-font web-builder-font-color" aria-hidden="true">'+_shopdetail.BookingDetail.CurrencySymbol+a.format("#.##")+"</div></div>")}e("#divServiceMultipleFees").html(t),e("#divServiceMultipleFees").show()}},_shopdetail.ShowAddOnService=function(){var t=_shopdetail.VisibleControlLength("#mobile-check")>0;"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()&&1!=t&&("undefined"==typeof businessID||null==typeof businessID||278968!=parseInt(businessID)&&82132!=parseInt(businessID)?$Interframe.centerPopup(e("#servicenamepopup"),500):$Interframe.scrollFunction()),"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()&&void 0!==t&&1==t&&1==iosDevices&&$Interframe.adjustIframeHeight(),"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()&&void 0!==t&&1==t&&$Interframe.scrollFunction(),e("#servicenamepopup").modal("show"),"undefined"!=typeof vgAppicationType&&vgAppicationType!=objApplicationType.CustomerApp&&e("#servicenamepopup").addClass("view-height"),"undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toLowerCase()&&document.getElementById("servicenamepopup").scrollIntoView()},_shopdetail.HideAddOnService=function(){e("#servicenamepopup").modal("hide"),e("#servicenamepopup").removeClass("view-height"),$Interframe.resetIframeHeight()},_shopdetail.OpenNotAcceptingNewClientsFnFPopup=function(t,i){var a=1,r=[],o=[];""!=t&&(r=t.trim().replace(/\s*,\s*/g,",").split(","),r=e.unique(r.filter(e=>e.endsWith("~true")).map(e=>e.replace("~true","")))),""!=i&&(o=i.split(",")),e("#employeefnfpopup").modal("show"),e("#btnfnfBook").show(),e(".familycktfrndlistPopup").show(),e(".familycktbook").show(),e("#btnfnfNotAcceptClose").html("Close").removeClass("green-primary-button").addClass("btn btn-default secondary-button back-btn-hide"),e("#employeefnfHeader").html('<div class="web-display-small membership-modal-heading">'+r.join(" , ")+' Not Accepting New Clients</div> <div class="web-body-font web-builder-font-color">'+r.join(" , ")+" is currently not accepting clients at this time. Please try your search again.</div>");var n=_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>o.includes(e.ServiceProviderID.toString()));if(o.length>1){for(var s=[],l=[],d=0;d<n.length;d++){var c=n[d].UserID,u=n.filter(e=>e.UserID==c),p=u.some(e=>0==e.Existing),h=u.every(e=>0==e.Existing),m=u.every(e=>1==e.Existing);if(!l.includes(c)){if(1==h||1==m)s.push(u[0]);else if(1==p&&0==h){var f=u.find(e=>0==e.Existing);s.push(f)}l.push(c)}}n=s}e.each(n,function(e,t){t.Index=a,0==t.Existing?t.Tag="NOT ACCEPTING NEW CLIENTS":t.Tag="",a++}),e(".familycktfrndPopup ul").empty(),e("#employeefnflistTemplate").tmpl(n).appendTo(".familycktfrndlistPopup"),e(".familycktfrndlistPopup").on("click",".init",function(){e(this).closest(".familycktfrndlistPopup").children(".familycktfrndlistblokPopup:not(.init)").toggle()});var g=e(".familycktfrndPopup ul li.selected").data("tag"),v=e(".familycktfrndPopup ul li.selected").data("tagid"),A=e(".familycktfrndPopup ul li.selected").data("value");""==g?(e("#btnfnfBook").html("Book"),e("#btnfnfBook").attr("onclick","_shopdetail.EmployeeFnfBook('"+g+"','"+v+"','"+A+"');")):(e("#btnfnfBook").html("Search Availability"),e("#btnfnfBook").attr("onclick","_shopdetail.EmployeeFnfSearchAvailability();"))},_shopdetail.OpenNotAcceptingNewClientsFnFPopupForClass=function(t,i,a,r,o,n,s,l,d,c,u){var p={};p.appointmentID=i,p.session=a,p.amount=r,p.eventId=o,p.serviceProviderID=n,p.strStartTime=s,p.isWorkShop=l,p.IsWaitlist=d,p.isMembershipCart=c,p.className=u,_vgClassSessionSelection.commonProperty.ClassPropertyData=p,e("#employeefnfpopup").modal("show"),e("#btnfnfBook").show(),e(".familycktfrndlistPopup").show(),e(".familycktbook").show(),e("#btnfnfNotAcceptClose").html("Close").removeClass("green-primary-button").addClass("btn btn-default secondary-button back-btn-hide"),e("#employeefnfHeader").html('<div class="web-display-small membership-modal-heading">'+t+' Not Accepting New Clients</div> <div class="web-body-font web-builder-font-color">'+t+" is currently not accepting clients at this time. Please try your search again.</div>");var h=1,m=[];m.push(n);var f=_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>m.includes(e.ServiceProviderID));e.each(f,function(e,t){t.Index=h,0==t.Existing?t.Tag="NOT ACCEPTING NEW CLIENTS":t.Tag="",h++}),e(".familycktfrndPopup ul").empty(),e("#employeefnflistTemplate").tmpl(f).appendTo(".familycktfrndlistPopup"),e(".familycktfrndlistPopup").on("click",".init",function(){e(this).closest(".familycktfrndlistPopup").children(".familycktfrndlistblokPopup:not(.init)").toggle()});var g=e(".familycktfrndPopup ul li.selected").data("tag"),v=(e(".familycktfrndPopup ul li.selected").data("tagid"),e(".familycktfrndPopup ul li.selected").data("value"));""==g?(e("#btnfnfBook").html("Book"),e("#btnfnfBook").attr("onclick","_shopdetail.SetDataForClass('"+JSON.stringify(_vgClassSessionSelection.commonProperty.ClassPropertyData)+"','"+v+"')")):(e("#btnfnfBook").html("Search Class"),e("#btnfnfBook").attr("onclick","_vgClassSessionSelection.SearchAvailabilityClick();")),bkEvent.IsSelectedFromPopUp=!0,bkEvent.SelectedPackages=[],bkEvent.SelectedMembership=null},_shopdetail.SetDataForClass=function(t,i){var a=JSON.parse(t);if(1==_shopdetail.IsMemPkgReqToBook){var r=u(a.eventId.toString(),a.className);if(""!=r.ReqServicesNames)if(1==_vgClassSessionSelection.FamilyFriendsMembershipPackage.Data.FamilyFriendsMembershipPackage.filter(e=>e.UserID==Number(i)&&0==e.ItemId).length>0){var o=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation;return null!=o.RequiredMemberships&&null!=o.RequiredPackages?e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div> <div class="web-body-font web-builder-font-color">You cannot book <b>'+r.ReqServicesNames+"</b>  without being a member of <b>"+o.RequiredMemberships+"</b> or <b>"+o.RequiredPackages+"</b>. Purchase a qualifying membership or package to continue booking.</div>"):null!=o.RequiredMemberships?e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font web-builder-font-color">You cannot book <b>'+r.ReqServicesNames+"</b>  without being a member of <b>"+o.RequiredMemberships+"</b>. Purchase a qualifying membership to continue booking.</div>"):null!=o.RequiredPackages&&e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div> <div class="web-body-font web-builder-font-color">You cannot book <b>'+r.ReqServicesNames+"</b>  without being a member of <b>"+o.RequiredPackages+"</b>. Purchase a qualifying package to continue booking.</div>"),e("#membershipMaincontent").html(""),e("#btnAddtoCartAndBook").hide(),e("#btnCloseMemPkg").html("Close"),void e("#membershippopup").modal("show")}}var n=document.querySelectorAll(".familycktfrndlistblokpopup.selected")[0].getAttribute("data-value");e("#hdnSelSPID").val(n),_vgClassSessionSelection.ShowEventDetailPopup(a.appointmentID,a.session,a.amount,a.eventId,a.serviceProviderID,a.strStartTime,a.isWorkShop,a.IsWaitlist,a.isMembershipCart)},e(document).on("click",".modal-backdrop",function(t){t.target===this&&e(".modalclosecommonandroid").modal("hide")}),_shopdetail.OpenFnfUserSelectionLimitBooking=function(t){var i=e(".familycktfrndlistPopup").children(".familycktfrndlistblokPopup:not(.init)");i.removeClass("selected").attr("aria-selected",!1),e(t).addClass("selected").attr("aria-selected",!0),e(".familycktfrndlistPopup").children(".init").html(e(t).html()),e(".familycktfrndlistPopup").children(".init").find(".fficons").css("display","block"),i.toggle();var a=e(".familycktfrndPopup ul li.selected").data("tag"),r=e(".familycktfrndPopup ul li.selected").data("tagid"),o=e(".familycktfrndPopup ul li.selected").data("value");null!=a&&null!=r&&null!=o&&(_vgClassSessionSelection.commonProperty.IsFromClass?""==a?(e("#btnfnfBook").html("Book"),e("#btnfnfBook").attr("onclick"," _shopdetail.SetDataForClass('"+JSON.stringify(_vgClassSessionSelection.commonProperty.ClassPropertyData)+"','"+o+"')")):(e("#btnfnfBook").html("Search Class"),e("#btnfnfBook").attr("onclick","_vgClassSessionSelection.SearchAvailabilityClick()")):""==a?(e("#btnfnfBook").html("Book"),e("#btnfnfBook").attr("onclick","_shopdetail.EmployeeFnfBook('"+a+"','"+r+"','"+o+"');")):(e("#btnfnfBook").html("Search Availability"),e("#btnfnfBook").attr("onclick","_shopdetail.EmployeeFnfSearchAvailability();")),bkEvent.IsSelectedFromPopUp=!0)},_shopdetail.EmployeeFnfBook=function(t,i,a){if(_vgClassSessionSelection.commonProperty.IsFromClass=!1,1==_shopdetail.IsMemPkgReqToBook){var r=u(hdnCommandArgArray.serviceid,hdnCommandArgArray.servicename);if(""!=r.ReqServicesNames)if(1==FamilyFriendsMembershipPackage.Data.FamilyFriendsMembershipPackage.filter(e=>e.UserID==a&&0==e.ItemId).length>0){var o=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation;return null!=o.RequiredMemberships&&null!=o.RequiredPackages?e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div> <div class="web-body-font">You cannot book <b>'+r.ReqServicesNames+"</b>  without being a member of <b>"+o.RequiredMemberships+"</b> or <b>"+o.RequiredPackages+"</b>. Purchase a qualifying membership or package to continue booking.</div>"):null!=o.RequiredMemberships?e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font">You cannot book <b>'+r.ReqServicesNames+"</b>  without being a member of <b>"+o.RequiredMemberships+"</b>. Purchase a qualifying membership to continue booking.</div>"):null!=o.RequiredPackages&&e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div> <div class="web-body-font">You cannot book <b>'+r.ReqServicesNames+"</b>  without being a member of <b>"+o.RequiredPackages+"</b>. Purchase a qualifying package to continue booking.</div>"),e("#membershipMaincontent").html(""),e("#btnAddtoCartAndBook").hide(),e("#btnCloseMemPkg").html("Close"),e("#membershippopup").modal("show"),e("#membershippopup #btnCloseMemPkg").show(),void e("#membershippopup #btnBackMemPkg").hide()}}hdnCommandArgArray.fnfTag=t,hdnCommandArgArray.fnfTagId=i,hdnCommandArgArray.fnfUserId=a,hdnCommandArgArray.IsSelectedFromEmpPopUp=!0;var n=document.querySelectorAll(".familycktfrndlistblokpopup.selected")[0].getAttribute("data-value");e("#hdnSelSPID").val(n),e("#employeefnfpopup").modal("hide"),BookAppointment()},_shopdetail.EmployeeFnfSearchAvailability=function(){e("#employeefnfpopup").modal("hide"),e("#hdnIsSearchAvailability").val("Search Availability"),LoadData()},e(document).on("hide.bs.modal","#employeefnfpopup",function(){e(".familycktfrndlistPopup").off("click"),bkEvent.IsSelectedFromPopUp=!1,_vgClassSessionSelection.commonProperty.ClassPropertyData=null}),_shopdetail.OpenMembershipPopup=function(t){if(_vgClassSessionSelection.commonProperty.ClassPropertyData=null,1e3==MembershipPackageDetails.ResponseCode&&null!=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation&&null!=MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse&&MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse.length>0){var i=MembershipPackageDetails.Data.UserMemberShipAndPackageInformation;if(i.IsMemPkgReqToBook&&!i.IsUserHasRequiredMembership&&!i.IsUserHasRequiredPackage){var a=MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse;if(!i.IsUserHasRequiredMembership&&i.UserExistingMembershipCount>0&&0==a.filter(e=>2==e.Type).length)e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font web-builder-font-color">You cannot book <b>'+t+"</b>  without being a member of <b>"+i.RequiredMemberships+"</b>. Purchase a qualifying membership to continue booking.</div>"),e("#membershipMaincontent").html(""),e("#btnAddtoCartAndBook").hide(),e("#btnCloseMemPkg").html("Close"),e("#membershippopup").modal("show"),"undefined"!=typeof vgAppicationType&&vgAppicationType!=objApplicationType.CustomerApp&&e("#membershippopup").addClass("view-height");else if(!i.IsUserHasRequiredMembership&&i.UserExistingMembershipCount>0&&a.filter(e=>2==e.Type).length>0){var r=a.filter(e=>2==e.Type).filter(e=>e.IsOnline);if(e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div><div class="web-body-font web-builder-font-color">You cannot book <b>'+t+"</b> without being a package holder. Purchase a qualifying package to continue booking.</div>"),r.length>0){var o="";o+='<div class="web-display-small membership-heading">Packages</div>',e.each(r,function(e,t){o+='<div class="d-flex membership-modal-options align-items-center"><div class="vagaro-checkbox s-vagaro-checkbox"><input type="checkbox" data-PkgData=\''+JSON.stringify(t)+"' id=\""+t.ItemId+'" name="checkboxMembership" value="'+t.ItemId+'"><label for="'+t.ItemId+'"></label></div><div class="Membership-details"><div class="web-subheading-font">'+t.Name+'</div><div class="web-body-font web-builder-font-color"><p class="mb-0">'+t.Description+'</p></div></div><div class="membership-modal-price web-subheading-font">'+_shopdetail.currencySymbol+t.MemPkgPriceWithTax.toFixed(2)+"</div></div>"});var n="";n="Select a package to continue booking.",e("#btnAddtoCartAndBook").show(),e("#btnAddtoCartAndBook").attr("onclick","_shopdetail.MembershipOrPackageAddtoCartAndBook('"+n+"');"),e("#membershipMaincontent").html(o)}else e("#btnAddtoCartAndBook").hide(),e("#btnCloseMemPkg").html("Close"),e("#membershipMaincontent").html("");e("#divErrorMsgmem").text(""),e("#membershippopup").modal("show"),"undefined"!=typeof vgAppicationType&&vgAppicationType!=objApplicationType.CustomerApp&&e("#membershippopup").addClass("view-height")}else{var s=a.filter(e=>1==e.Type),l=(r=a.filter(e=>2==e.Type),s.filter(e=>e.IsOnline)),d=r.filter(e=>e.IsOnline);n="";l.length>0&&d.length>0?(e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div>\n                                    <div class="web-body-font web-builder-font-color"> <p>You cannot book <b>'+t+"</b> without being a member or package holder. Purchase a qualifying membership or package to continue booking.</p></div>"),n="Select a membership or package to continue booking."):l.length>0?(e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font web-builder-font-color"><p>You cannot book <b>'+t+"</b>  without being a member. Purchase a qualifying membership to continue booking.</p></div>"),n="Select a membership to continue booking."):d.length>0?(e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div><div class="web-body-font web-builder-font-color"><p>You cannot book <b>'+t+"</b> without being a package holder. Purchase a qualifying package to continue booking.</p></div>"),n="Select a package to continue booking."):s.length>0&&r.length>0?e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div> <div class="web-body-font web-builder-font-color"> <p>You cannot book <b>'+t+"</b> without being a member or package holder. Purchase a qualifying membership or package to continue booking.</div></p>"):s.length>0?e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font web-builder-font-color"><p>You cannot book <b>'+t+"</b> without being a member. Purchase a qualifying membership to continue booking.</div></p>"):r.length>0&&e("#membershipHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div> <div class="web-body-font web-builder-font-color"> <p>You cannot book <b>'+t+"</b> without being a package holder. Purchase a qualifying package to continue booking.</div></p>");o="";l.length>0&&(o+='<div class="web-display-small membership-heading">Memberships</div>',e.each(l,function(e,t){o+='<div class="d-flex membership-modal-options align-items-center"><div class="customredio-box-singal"><input type="radio"  data-MemData=\''+JSON.stringify(t).escapeHtml()+"'  id=\""+t.ItemId+'" name="radioMembership" value="'+t.ItemId+'"><label for="'+t.ItemId+'"></label></div><div class="Membership-details"><div class="web-subheading-font">'+t.Name+'</div><div class="web-body-font web-builder-font-color"><p class="mb-0">'+t.Description+'</p></div></div><div class="membership-modal-price web-subheading-font">'+_shopdetail.currencySymbol+t.MemPkgPriceWithTax.toFixed(2)+"</div></div>"})),d.length>0&&(o+='<div class="web-display-small membership-heading">Packages</div>',e.each(d,function(e,t){o+='<div class="d-flex membership-modal-options align-items-center"><div class="vagaro-checkbox s-vagaro-checkbox"><input type="checkbox" data-PkgData=\''+JSON.stringify(t).escapeHtml()+"' id=\""+t.ItemId+'" name="checkboxMembership" value="'+t.ItemId+'"><label for="'+t.ItemId+'"></label></div><div class="Membership-details"><div class="web-subheading-font">'+t.Name+'</div><div class="web-body-font web-builder-font-color"><p class="mb-0">'+t.Description+'</p></div></div><div class="membership-modal-price web-subheading-font">'+_shopdetail.currencySymbol+t.MemPkgPriceWithTax.toFixed(2)+"</div></div>"})),""!=o?(e("#btnAddtoCartAndBook").show(),e("#btnAddtoCartAndBook").attr("onclick","_shopdetail.MembershipOrPackageAddtoCartAndBook('"+n+"');"),e("#membershipMaincontent").html(o),e(document).off("click.membershipRow").on("click.membershipRow",".membership-modal-options",function(t){if(!e(t.target).is("input, label")){var i=e(this).find('input[type="radio"]'),a=e(this).find('input[type="checkbox"]');i.length&&i.prop("checked",!0).trigger("change"),a.length&&a.prop("checked",!a.prop("checked")).trigger("change")}}),e("#membershippopup #btnCloseMemPkg").text("Cancel"),1==p&&(e("#membershippopup #btnCloseMemPkg").hide(),e("#membershippopup #btnBackMemPkg").show(),e("#membershippopup #btnBackMemPkg").attr("onclick",'_shopdetail.BackToFnfPopUp("'+t+'");'))):(e("#btnAddtoCartAndBook").hide(),e("#membershipMaincontent").html(""),e("#membershippopup #btnCloseMemPkg").text("Close")),e("#divErrorMsgmem").text(""),e("#membershippopup").modal("show"),"undefined"!=typeof vgAppicationType&&vgAppicationType!=objApplicationType.CustomerApp&&e("#membershippopup").addClass("view-height")}}const c=document.querySelector("#membershippopup .modal-body");if(c)if("function"==typeof c.scrollTo)try{c.scrollTo({top:0,behavior:"smooth"})}catch(e){c.scrollTop=0}else c.scrollTop=0}},_shopdetail.BackToFnfPopUp=function(t){e("#membershippopup").modal("hide"),_shopdetail.OpenMembershipfnfPopup(FamilyFriendsMembershipPackage,t)},_shopdetail.MembershipOrPackageAddtoCartAndBook=function(t){if(null!=vuiForms.frame&&(vuiForms.frame.destroy(),DisplayFormsIFrameForApp(_onlineCheckout.formsResponse[0])),0==e("input[name=radioMembership]").is(":checked")&&0==e("input[name=checkboxMembership]").is(":checked")){const i=document.querySelector("#membershippopup .modal-body");if(i)if("function"==typeof i.scrollTo)try{i.scrollTo({top:0,behavior:"smooth"})}catch(e){i.scrollTop=0}else i.scrollTop=0;return e("#divErrorMsgmem").text(t),e("#divErrorMsgmem").focus(),e(".membership-modal-error-text").show(),!1}if(e("#divErrorMsgmem").text(""),_vgClassSessionSelection.commonProperty.IsFromClass){bkEvent.SelectedMembership=null,bkEvent.SelectedPackages=[],1==e("input[name=radioMembership]").is(":checked")&&(bkEvent.SelectedMembership=JSON.parse(e("input[name=radioMembership]:checked").attr("data-MemData")),bkEvent.SelectedMembershipForCheckOutPage=JSON.parse(e("input[name=radioMembership]:checked").attr("data-MemData")));var i=[];e("input[name=checkboxMembership]:checked").each(function(){i.push(JSON.parse(e(this).attr("data-PkgData")))}),bkEvent.SelectedPackages=i,bkEvent.IsSelectedFromPopUp=!0,e("#membershippopup").modal("hide"),_vgClassSessionSelection.ShowEventDetailPopup(bkEvent.AppointmentID,bkEvent.Session,bkEvent.Amount,bkEvent.EventId,bkEvent.ServiceProviderID,bkEvent.StrStartTime,bkEvent.IsWorkShop,bkEvent.IsWaitlist)}else{1==e("input[name=radioMembership]").is(":checked")&&(hdnCommandArgArray.SelectedMembership=e("input[name=radioMembership]:checked").val());i=[];e("input[name=checkboxMembership]:checked").each(function(){i.push(e(this).val())}),hdnCommandArgArray.SelectedPackages=i,hdnCommandArgArray.IsSelectedFromPopUp=!0,e("#membershippopup").modal("hide"),BookAppointment();try{void 0!==_shopdetail&&null!=_shopdetail&&1==_shopdetail.IsMemPkgReqToBook&&void 0!==hdnCommandArgArray.SelectedMembership&&null!=hdnCommandArgArray.SelectedMembership&&"undefined"!=typeof UserID&&null!=UserID&&setTimeout(function(){_onlineCheckout.GetFormsByIdsForMS(hdnCommandArgArray.SelectedMembership,UserID)},2e3)}catch(e){}}},e(document).on("hide.bs.modal","#membershipfnfpopup",function(){e(".familycktfrndlistPopup").off("click"),_vgClassSessionSelection.ClearEventCartObj()}),e(document).on("hide.bs.modal","#membershippopup",function(){p=!1,e("#divErrorMsgmem").hide()}),_shopdetail.OpenMembershipfnfPopup=function(t,i){p=!1,_vgClassSessionSelection.commonProperty.IsFromClass=!1,e("#membershipfnfpopup").modal("show");var a=MembershipPackageDetails.Data.MembershipOrPackageRequiredToBookResponse,r=a.filter(e=>1==e.Type),o=a.filter(e=>2==e.Type),n=r.filter(e=>e.IsOnline),s=o.filter(e=>e.IsOnline);n.length>0&&s.length>0?(e("#membershipfnfHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div>\n                                    <div class="web-body-font web-builder-font-color"> <p>You cannot book <b>'+i+"</b> without being a member or package holder. Purchase a qualifying membership or package to continue booking.</p></div>"),e("#btnfnfAddtoCartAndBook").html("View Memberships & Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):n.length>0?(e("#membershipfnfHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font web-builder-font-color"><p>You cannot book <b>'+i+"</b>  without being a member. Purchase a qualifying membership to continue booking.</p></div>"),e("#btnfnfAddtoCartAndBook").html("View Memberships"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):s.length>0?(e("#membershipfnfHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div><div class="web-body-font web-builder-font-color"><p>You cannot book <b>'+i+"</b> without being a package holder. Purchase a qualifying package to continue booking.</p></div>"),e("#btnfnfAddtoCartAndBook").html("View Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):r.length>0&&o.length>0?(e("#membershipfnfHeader").html('<div class="web-display-small membership-modal-heading">Membership or Package Required to Book</div> <div class="web-body-font web-builder-font-color"> <p>You cannot book <b>'+i+"</b> without being a member or package holder. Purchase a qualifying membership or package to continue booking.</div></p>"),e("#btnfnfAddtoCartAndBook").html("View Memberships & Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):r.length>0?(e("#membershipfnfHeader").html('<div class="web-display-small membership-modal-heading">Membership Required to Book</div> <div class="web-body-font web-builder-font-color"><p>You cannot book <b>'+i+"</b> without being a member. Purchase a qualifying membership to continue booking.</div></p>"),e("#btnfnfAddtoCartAndBook").html("View Memberships"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):o.length>0&&(e("#membershipfnfHeader").html('<div class="web-display-small membership-modal-heading">Package Required to Book</div> <div class="web-body-font web-builder-font-color"> <p>You cannot book <b>'+i+"</b> without being a package holder. Purchase a qualifying package to continue booking.</div></p>"),e("#btnfnfAddtoCartAndBook").html("View Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");'));var l=1,d=e.extend(!0,new Array,t.Data.FamilyFriendsMembershipPackage);e.each(d,function(e,t){t.IsDisabled=0;var i=hdnCommandArgArray.spid.split(",");_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>e.UserID==t.UserID&&-1!=jQuery.inArray(e.ServiceProviderID.toString(),i)&&0==e.Existing).length>0&&(t.Tag="NOT ACCEPTING NEW CLIENTS",t.IsDisabled=1),""==t.Tag&&(t.Tag="Membership/Package Required To Book",t.IsDisabled=1),t.Index=l,l++}),e(".familycktfrndPopup ul").empty(),e("#membershipfnflistTemplate").tmpl(d).appendTo(".familycktfrndlistPopup"),e(".familycktfrndlistPopup").on("click",".init",function(){e(this).closest(".familycktfrndlistPopup").children(".familycktfrndlistblokPopup:not(.init)").toggle()}),_shopdetail.OpenFnfUserSelection=function(t){var a=e(".familycktfrndlistPopup").children(".familycktfrndlistblokPopup:not(.init)");a.removeClass("selected").attr("aria-selected",!1),e(t).addClass("selected").attr("aria-selected",!0),e(".familycktfrndlistPopup").children(".init").html(e(t).html()),e(".familycktfrndlistPopup").children(".init").find(".fficons").css("display","block"),a.toggle();var l=e(".familycktfrndPopup ul li.selected").data("tag"),d=e(".familycktfrndPopup ul li.selected").data("tagid"),c=e(".familycktfrndPopup ul li.selected").data("value");null!=l&&null!=d&&null!=c&&("0"!=d?(e("#btnfnfAddtoCartAndBook").html("Book"),e("#btnfnfAddtoCartAndBook").attr("onclick","_shopdetail.MembershipOrPackageFnfBook('"+l+"','"+d+"','"+c+"');")):n.length>0&&s.length>0?(e("#btnfnfAddtoCartAndBook").html("View Memberships & Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):n.length>0?(e("#btnfnfAddtoCartAndBook").html("View Memberships"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):s.length>0?(e("#btnfnfAddtoCartAndBook").html("View Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):r.length>0&&o.length>0?(e("#btnfnfAddtoCartAndBook").html("View Memberships & Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):r.length>0?(e("#btnfnfAddtoCartAndBook").html("View Memberships"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')):o.length>0&&(e("#btnfnfAddtoCartAndBook").html("View Packages"),e("#btnfnfAddtoCartAndBook").attr("onclick",'_shopdetail.btnfnfToOpenMembershipPopup("'+i+'");')))}};var p=!1;_shopdetail.btnfnfToOpenMembershipPopup=function(t){p=!0,e("#membershipfnfpopup").modal("hide"),_shopdetail.OpenMembershipPopup(t)},_shopdetail.MembershipOrPackageFnfBook=function(t,i,a){if(1==_shopdetail.IsLimitOnlineBooking){var r=hdnCommandArgArray.spid.split(",");if(_shopdetail.UserAndFnFNewOrExistingForBusinessEmployees.filter(e=>e.UserID==a&&-1!=jQuery.inArray(e.ServiceProviderID.toString(),r)&&0==e.Existing).length>0)return void vagaro.alert("Selected friends/family doesnot exisitng user")}hdnCommandArgArray.fnfTag=t,hdnCommandArgArray.fnfTagId=i,hdnCommandArgArray.fnfUserId=a,hdnCommandArgArray.IsSelectedFromPopUp=!0,e("#membershipfnfpopup").modal("hide"),BookAppointment()},CalAccPriceWithTax=function(e,t){return(parseFloat(ConvertTodecimalMorePrecious(t/100*parseFloat(e),!0,2))+parseFloat(e)).toFixed(2)},ConvertTodecimalMorePrecious=function(e,t,i){return isNaN(parseFloat(e))&&(e=0),t?Number(Math.round(e+"e"+i)+"e-"+i).toFixed(i):parseFloat(Number(Math.round(e+"e"+i)+"e-"+i).toFixed(i))},_shopdetail.OpenAddOnServicePopupForBookNow=function(t,i,a,r,o,n,s,l,d,c,u,p,h,m,f,g,v,A,C,y){var b=_shopdetail.GetSlotLastMinuteFlag(t,i);try{if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=r&&""!==r&&null!=isWidget&&"true"===isWidget.toLowerCase()){var S={eventName:"BookNowClicked",timestamp:(new Date).getTime(),data:{serviceName:r}};UserID&&parseInt(UserID)>0&&(S.data.customerId="undefined"!=typeof staticEncryptUserID&&null!==staticEncryptUserID?staticEncryptUserID:""),"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(S)+"}"):"undefined"!=typeof $Interframe&&($Interframe.setWidgetAddonpopupScroll(),$Interframe.sendEventMessage(S))}}catch(e){}o=unescape(o);var k=1!=a||1!=y&&"true"!=y&&1!=y&&"1"!=y?"":"Starting at ";if(HouseCallGroupID=null,IsFromServiceBookNow=!0,ShowLoader(!0),p>0&&null!=A&&""!=A){e("#divOldServicePrice").css("display","block"),e("#divOldServicePrice").text(_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##")),n=u;try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&(e("#divOldServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(g.replace(_shopdetail.currencySymbol,""),2).format("#.##")),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues)){if(""!=v&&null!=v&&"0"!=v){let e=v.split(",");var D=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(e.length>0)for(var _=0;_<e.length;_++)D.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[_]).Tax);var I=D.reduce((e,t)=>e+t,0);if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&"true"==C)try{var w=A.split("-")[2];n=g-w}catch(e){n=u}else n=CalAccPriceWithTax(u,I)}}}}catch(e){}}else null==A||""==A?void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing?e("#divOldServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(g.replace(_shopdetail.currencySymbol,""),2).format("#.##")):e("#divOldServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##")):(h="",e("#divOldServicePrice").css("display","none"));n=n.toString().replace("Starting at ","");var P=0;5==a&&(P=1),i=""==i||null==i||isNaN(i)?0:i,n=""==n||null==n?"0.00":n;var T={ServiceId:parseInt(t),BusinessID:parseInt(businessID),ServiceProviderID:"undefined"!=typeof isWidget&&"undefined"!=typeof WidgetSpId&&null!=WidgetSpId&&isWidget&&WidgetSpId>0?WidgetSpId:parseInt(i),IsBundle:P,IsOnline:"undefined"!=typeof isWidget&&"true"==isWidget&&"undefined"!=typeof WidgetSpId&&null!=WidgetSpId&&WidgetSpId>0?1:0,LastMinDealHours:LastMinuteBookingDays},B=new vagaro.ajax;B.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAddOnService,groupID),B.datamodel.data=T,B.datamodel.IsNewVagaroAPI=!0,B.datamodel.callback=function(u){if(1e3==u.ResponseCode)if(ShowLoader(!1),u.Data.length>0&&null!=u.Data[0]){if(_shopdetail.ShowAddOnService(),5==a){SelectedAddonService=[],AddonServiceBundleDetailBookNow=u.Data,u.Data=_shopdetail.GetListAddonService(u.Data,1),u.Data.length<=0&&(u.Data=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,2)),u.Data<=0&&(u.Data=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,3)),u.Data<=0&&(u.Data=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,4)),u.Data<=0&&(u.Data=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,5)),u.Data<=0&&(u.Data=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,6));var v=u.Data[0].SerialNo,C=_shopdetail.GetServiceBundleDetailbyId(u.Data[0].EventServiceID,t);if(null!=C&&""!=C&&C.length>0){n=_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(C[0].ServicePrice,2);try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){var y=C[0].Taxes;if(""!=y&&null!=y&&"0"!=y){let e=y.split(",");var S=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(e.length>0)for(var D=0;D<e.length;D++)S.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[D]).Tax);var _=S.reduce((e,t)=>e+t,0);g=CalAccPriceWithTax(C[0].ServicePrice,_)}}}}catch(e){}e("#divSuggestedAddon").text("Service 1 Suggested Add-Ons : "+C[0].serviceTitle),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&""!=C[0].Taxes&&null!=C[0].Taxes&&"0"!=C[0].Taxes&&(n=g)}}else e("#divSuggestedAddon").text("Suggested Add-Ons Available");if(SelectedAddonService=[],_shopdetail.localData.AddonsList=u.Data,e(_shopdetail.Controls.AddOnList).empty(),e(_shopdetail.Controls.ParentService).empty(),null==s||"null"==s||""==s?(e("#divServiceImage").css("display","none"),e(".addon-service-description").addClass("no-image-data")):(e("#divServiceImage").css("display","block"),e(".addon-service-description").removeClass("no-image-data"),e("#divServiceImage").css("background-image","url("+s+")")),e("#divServiceName").text(r),e("#divServiceDes").text(o),void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&p<=0&&5!=a&&(n=g),void 0!==n&&null!=n&&"string"!=typeof n&&(n=n.toString()),"$0.00"==n||"0.00"==n||"0"==n?"true"==c?(e("#divFreeServicePrice").css("display","block"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):"true"==c?(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","block"),null==A||""==A?(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&p<=0?5==a?e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##")):e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(g.replace(_shopdetail.currencySymbol,""),2).format("#.##")):e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##")),e("#divOldServicePrice").html("")):e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(n.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(0,2).format("#.##"))),k&&"none"!=e("#divServicePrice").css("display")){var I=e("#divServicePrice").text();I&&0!==I.indexOf(k)&&e("#divServicePrice").text(k+I)}e("#hdnServiceId").val(t),e("#hdnEventType").val(a);var w=e.grep(u.Data,function(e){return 0==e.ServiceLevel});if(e.each(w,function(t){var a=e.grep(u.Data,function(e){return e.Price=_onlineCheckout.parseTodecimal(e.Price,2),e.ParentServiceID==w[t].ServiceId});w[t].MinItem=w[t].MinItem>a.length?a.length:w[t].MinItem,w[t].MaxItem=w[t].MaxItem>a.length?a.length:w[t].MaxItem,a=a.map(function(e){if(e.IsRequired=w[t].IsRequired,e.MinItem=w[t].MinItem,e.MaxItem=w[t].MaxItem,e.Photo=e.Photo.indexOf("no-shop-image-big.")>0?"":e.Photo,e.CurrencySymbol=_shopdetail.currencySymbol,e.OnlinePrice=1==e.IsShowPriceOnline?e.Price:"0.00",e.OnlinePricewithtax=1==e.IsShowPriceOnline?e.Price:"0.00",e.IsIncludeTaxInOnlinePricing=!1,e.NewPricewithTax=e.Price,null!=e.PromotionDetail&&""!=e.PromotionDetail){var a=_shopdetail.GetAddonDailyDealData(e.PromotionDetail,e.OnlinePrice,e.ServiceId,i,!0,e.BusinessTax,b);a.PromotionID>0?(e.IsDealApplied=!0,e.PromotionID=a.PromotionID,e.NewPrice=a.NewPrice,e.NewPricewithTax=e.NewPrice):(e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0)}else e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0;try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&(e.IsIncludeTaxInOnlinePricing=!0,void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues&&""!=e.BusinessTax&&null!=e.BusinessTax&&null!=e.BusinessTax&&""!=e.BusinessTax)){if(null!=e.PromotionDetail&&""!=e.PromotionDetail){var r,o=parseFloat(e.NewPricewithTax)*parseFloat(e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0)/100);r=parseFloat(e.NewPricewithTax)+o,e.NewPricewithTax=r}var n=e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0);e.OnlinePricewithtax=CalAccPriceWithTax(e.OnlinePrice,n)}}catch(e){}return e}),_shopdetail.CreateNoneOTAboveObject(a),e(_shopdetail.Controls.tmplAddOnCategory).tmpl(w[t]).appendTo(_shopdetail.Controls.AddOnList),e(_shopdetail.Controls.tmplAddOnService).tmpl(a).appendTo("#Service_"+a[0].ParentServiceID),e(".modal:visible").each(function(e,t){centerModal(t)})}),_shopdetail.BindSelectedAddon(t,1,i),_shopdetail.CheckboxAddOnService(),5==a){var P=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,v+1);e("#btnClose").css("display","none"),e("#btnback").css("display","block"),e(".classfooter-btn-row").removeClass("backremove"),e("#servicenamepopup").addClass("single-button"),e("#btnback").attr("onclick","_shopdetail.BackAddonBundleService(0,"+l+","+c+",'"+s+"','"+ReplaceSpecialCharacters(o)+"');"),P.length>0?(e("#btnContinue").css("display","none"),e("#btnNext").css("display","block"),e("#btnNext").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNowBundle("+u.Data[0].EventServiceID+", 0, 0, '', '', '', "+a+", false,"+l+",'"+s+"','"+ReplaceSpecialCharacters(o)+"',"+v+","+c+");")):(e("#btnNext").css("display","none"),e("#btnContinue").css("display","block"),e("#btnContinue").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNowBundle("+u.Data[0].EventServiceID+", 0, 0, '', '', '', "+a+", false,"+l+",'"+s+"','"+ReplaceSpecialCharacters(o)+"',"+v+","+c+");"))}else e("#btnClose").css("display","none"),e(".classfooter-btn-row").addClass("backremove"),e("#servicenamepopup").removeClass("single-button"),e("#btnback").css("display","none"),e("#btnNext").css("display","none"),e("#btnContinue").css("display","block"),e("#btnContinue").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNow("+t+", 0, 0, '', '', '', "+a+", false,"+l+",'"+s+"','"+ReplaceSpecialCharacters(o)+"','"+h+"', '"+m+"','"+f+"');");2==u.Data.length?e(".addon-group-row1").css("border-bottom","none"):e(".addon-group-row1").css("border-bottom","solid #E7E7E7 1px")}else if(e(_vgClassSessionSelection.Controls.AddOnList).empty(),_shopdetail.HideAddOnService(),1==l)_onlineCheckout.ServiceAddToCart(d);else{var T=!1,B=getCookie("Referral");if(null!=ServiceDataList&&""!=ServiceDataList&&ServiceDataList.length>0&&(T=ServiceDataList.some(e=>Number(e.ServiceID)===Number(t)&&e.IsDailyDealApply)),void 0===h||null==h||""==h||void 0===f||null==f||"false"!=f||void 0===B&&""==B&&null==B&&null==B||1==T){var x=1!=T&&void 0!==h&&null!=h&&""!=h?h:null;_shopdetail.SetBookData(t,0,0,"","","",a,!1,x)}else if(e("#mobile-check").is(":visible")&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof IsSupportNewDialogApp&&IsSupportNewDialogApp){var F={};F.ServiceID=t,F.EventType=a,F.PromotionProviderIds=h,F.CallFrom=2,CallbackforMobileApp(0,0,"","","0","49|~|"+('{\\"sTitle\\": \\"Daily Deals Available\\",\\"sDescritpion\\": \\"View the booking availability of employees who offer this daily deal to claim your discount. Viewing all employees may limit your access to claim this deal.\\",\\"sOffer\\": \\"'+m+'\\", \\"returnObject\\": {\\"ServiceID\\": \\"'+t+'\\",\\"EventType\\": \\"'+a+'\\",\\"PromotionProviderIds\\": \\"'+h+'\\",\\"CallFrom\\": \\"2\\"} ,\\"BtnNames\\": [{\\"buttonID\\": \\"BTN0\\",\\"btnName\\": \\"View All\\"},{\\"buttonID\\": \\"BTN1\\",\\"btnName\\": \\"View Daily Deal\\"}]}'))}else{var O=bootbox.confirm({className:"dd-view-deals-modal deal-view-deals-modal",title:"Daily Deals Available",message:'<div class="promo-digit percent-off-text w-inline-block badge-button-positive srv-drp-bedge mb-2"><div class="vg-service-video"><em>&#xf02b</em><span>'+m+"</span></div></div><div>View the booking availability of employees who offer this daily deal to claim your discount. Viewing all employees may limit your access to claim this deal.</div>",buttons:{cancel:{label:"View All"},confirm:{label:"View Daily Deal"}},callback:function(e){e?"undefined"!=typeof isWidget&&isWidget&&void 0!==newserviceproviderforwidget&&null!=newserviceproviderforwidget&&""!=newserviceproviderforwidget?_shopdetail.SetBookData(t,0,0,"","","",a,!1,null):_shopdetail.SetBookData(t,0,0,"","","",a,!1,h):_shopdetail.SetBookData(t,0,0,"","","",a,!1,null)}});O.on("shown.bs.modal",function(){_shopdetail.VisibleControlLength("#mobile-check")>0&&e(".modal-backdrop").on("click",function(e){e.target==this&&(O.modal("hide"),_shopdetail.SetBookData(t,0,0,"","","",a,!1,null))})})}}},B.datamodel.Error=_common.CallFailed,B.Post()},_shopdetail.AddAddOnServiceDetailForBookNow=function(t,i,a,r,o,n,s,l,d,c,u,p,h,m){if(0!=_shopdetail.AddonValidate()){e("#addonspopupclose.close").css({visibility:"visible"});var f,g={};if(_shopdetail.RemoveSelectedAddon(t,1),g.MainServiceID=e("#hdnServiceId").val(),g.SrNo=1,g.ServiceProviderId=i,g.ServicePhotoURL=c,g.ServiceDesc=u,(f=_shopdetail.CreateAddonCollection()).length>0&&(i>0||IsGallerySp)&&(IsGallerySp=!1,IsGallerywithsp=!1,m="false"),g.lstAddonService=f,SelectedAddonService.push(g),_shopdetail.HideAddOnService(),1==d)e("#btnAddToCart_"+t).click();else{var v=!1,A=getCookie("Referral");if(null!=ServiceDataList&&""!=ServiceDataList&&ServiceDataList.length>0&&(v=ServiceDataList.some(e=>Number(e.ServiceID)===Number(t)&&e.IsDailyDealApply)),void 0===A&&""==A&&null==A&&null==A||1==v)_shopdetail.SetBookData(t,i,a,r,o,n,s,l,null);else if(void 0!==p&&null!=p&&""!=p&&void 0!==m&&null!=m&&"false"==m)if(e("#mobile-check").is(":visible")&&"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&"undefined"!=typeof IsSupportNewDialogApp&&IsSupportNewDialogApp)CallbackforMobileApp(0,0,"","","0","49|~|"+('{\\"sTitle\\": \\"Daily Deals Available\\",\\"sDescritpion\\": \\"View the booking availability of employees who offer this daily deal to claim your discount. Viewing all employees may limit your access to claim this deal.\\",\\"sOffer\\": \\"'+h+'\\", \\"returnObject\\": [{\\"ServiceID\\": \\"'+t+'\\",\\"providerID\\": \\"'+i+'\\",\\"styleID\\": \\"'+a+'\\",\\"styleName\\": \\"'+r+'\\",\\"bookingDateTime\\": \\"'+o+'\\",\\"PromotionID\\": \\"'+n+'\\",\\"EventType\\": \\"'+s+'\\",\\"isdeeplinkentry\\": \\"'+l+'\\",\\"PromotionProviderIds\\": \\"'+p+'\\",\\"CallFrom\\": \\"1\\"}] ,\\"BtnNames\\": [{\\"buttonID\\": \\"BTN0\\",\\"btnName\\": \\"View All\\"},{\\"buttonID\\": \\"BTN1\\",\\"btnName\\": \\"View Daily Deal\\"}]}'));else setTimeout(function(){var d=bootbox.confirm({className:"dd-view-deals-modal deal-view-deals-modal",title:"Daily Deals Available",message:'<div class="promo-digit percent-off-text w-inline-block badge-button-positive srv-drp-bedge mb-2"><div class="vg-service-video"><em>&#xf02b</em><span>'+h+"</span></div></div><div>View the booking availability of employees who offer this daily deal to claim your discount. Viewing all employees may limit your access to claim this deal.</div>",buttons:{cancel:{label:"View All"},confirm:{label:"View Daily Deal"}},callback:function(e){e?"undefined"!=typeof isWidget&&isWidget&&void 0!==newserviceproviderforwidget&&null!=newserviceproviderforwidget&&""!=newserviceproviderforwidget?_shopdetail.SetBookData(t,i,a,r,o,n,s,l):_shopdetail.SetBookData(t,i,a,r,o,n,s,l,p):_shopdetail.SetBookData(t,i,a,r,o,n,s,l)}});d.on("shown.bs.modal",function(){_shopdetail.VisibleControlLength("#mobile-check")>0&&e(".modal-backdrop").on("click",function(e){e.target==this&&(d.modal("hide"),_shopdetail.SetBookData(t,i,a,r,o,n,s,l))})})},500);else _shopdetail.SetBookData(t,i,a,r,o,n,s,l,p)}IsGallerySp=!1,IsGallerywithsp=!1}},_shopdetail.CheckboxAddOnService=function(t){if(null!=t){var i=parseInt(e(t).attr("data-parentserviceid"));if(0==_shopdetail.OnEventAddonValidate(i))return e(t).prop("checked",!1),!1}var a=parseFloat(e("#divServicePrice").text().replace(currencySymbol,"").replace(/,/g,""));a=isNaN(a)?0:a,e.each(e("#divAddonPopupSection input[type='checkbox']:checked"),function(t,i){if("false"==e(i).attr("data-IsShowPriceOnline"))a+=parseFloat("0.00");else{var r=parseFloat(e(i).attr("data-newprice")),o=parseFloat(e(i).attr("data-promotionid")),n=0;r>0||o>0?(n=r,a=_shopdetail.parseTodecimal(a)+n):(n=parseFloat(e(i).attr("data-price")),_shopdetail.IsIncludeTaxInOnlinePricing||(a+=parseFloat(e(i).attr("data-price"))));try{if(0!=n&&void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing){var s=e(i).attr("data-taxes");if(""!=s&&null!=s&&"0"!=s){let e=s.split(",");var l=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(e.length>0)for(var d=0;d<e.length;d++)l.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[d]).Tax);var c=l.reduce((e,t)=>e+t,0);if(0==r&&0==o){var u=CalAccPriceWithTax(n,c);a+=parseFloat(u)}else{var p=parseFloat(c/100*parseFloat(n));a+=_shopdetail.parseTodecimal(p),a=ConvertTodecimalMorePrecious(a,!0,2)}}}else if(0==r&&0==o){u=CalAccPriceWithTax(n,c);a+=parseFloat(u)}}}catch(e){}}}),e.each(e("#divAddonPopupSection input[type='radio']:checked"),function(t,i){if("false"==e(i).attr("data-IsShowPriceOnline"))a+=parseFloat("0.00");else{var r=parseFloat(e(i).attr("data-newprice")),o=parseFloat(e(i).attr("data-promotionid")),n=0;r>0||o>0?(n=r,a+=r):(n=parseFloat(e(i).attr("data-price")),_shopdetail.IsIncludeTaxInOnlinePricing||(a+=parseFloat(e(i).attr("data-price"))));try{if(0!=n&&void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing){var s=e(i).attr("data-taxes");if(""!=s&&null!=s&&"0"!=s){let e=s.split(",");var l=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(e.length>0)for(var d=0;d<e.length;d++)l.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[d]).Tax);var c=l.reduce((e,t)=>e+t,0);if(0==r&&0==o){var u=CalAccPriceWithTax(n,c);a+=parseFloat(u)}else{var p=parseFloat(c/100*parseFloat(n));a+=_shopdetail.parseTodecimal(p),a=ConvertTodecimalMorePrecious(a,!0,2)}}}else if(0==r&&0==o){u=CalAccPriceWithTax(n,c);a+=parseFloat(u)}}}catch(e){}}}),a=_onlineCheckout.parseTodecimal(a,2).format("#.##"),e(".TotalServicePrice").text(currencySymbol+a),"$0.00"==a||"0.00"==a||"0"==a||isNaN(a)?(e(".TotalServicePrice").css("display","none"),e("#servicenamepopup .footer-price-row-p .web-body-font").css("display","none")):(e(".TotalServicePrice").css("display","block"),e("#servicenamepopup .footer-price-row-p .web-body-font").css("display","block"))},_shopdetail.CreateAddonCollection=function(){var t=[];return e.each(e("#divAddonPopupSection input[type='checkbox']:checked"),function(i,a){var r={};r.ServiceTitle=e(a).attr("data-serviceTitle"),r.ServiceId=e(a).attr("data-serviceid"),r.ParentServiceID=e(a).attr("data-parentserviceId"),r.ServiceDesc=e(a).attr("data-serviceDisc"),r.Duration=e(a).attr("data-Duration"),r.PointGiven=e(a).attr("data-PointGiven"),r.PointRedeem=e(a).attr("data-PointRedeem"),r.IsShowPriceOnline=e(a).attr("data-isshowpriceonline"),r.Originalprice=_shopdetail.parseTodecimal(e(a).attr("data-price"),2);var o=e.grep(_shopdetail.localData.AddonsList,function(e){return 1==e.ServiceLevel&&e.ServiceId==r.ServiceId});if(o.length>0){if(r.BusinessTax=o[0].BusinessTax,r.TaxesValues=o[0].TaxesValues,r.Taxes=o[0].TaxesValues,r.Tax=0,null!=o[0].BusinessTax&&o[0].BusinessTax.length>0)for(var n=0;n<o[0].BusinessTax.length;n++)r.Tax=r.Tax+o[0].BusinessTax[n].Tax,r.TaxesValues=o[0].BusinessTax[n].BusinessTaxID,_onlineCheckout.ApplyMultipleTax(r.Originalprice,o[0]);r.taxprice=_onlineCheckout.parseTodecimal(r.Originalprice*r.Tax/100,3),r.actualTaxprice=r.taxprice,r.ResOccurs=String.isNullOrUndefineOrBlank(o[0].ResOccurs)?0:o[0].ResOccurs}r.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,r.redeemAmount=0,r.redeemTax=0,r.Discount=0,r.VisitRemaining=0,r.Visit=0,r.priceOriginal=_shopdetail.parseTodecimal(e(a).attr("data-price"),2),r.GCDetail=[],r.GCDetailPriceBase=[],r.IsServiceBaseGC=!1,r.paidType=arrpaidType.UnPaid,r.DiscountID=0,r.depositsPaid=0,r.depositsPercentage=0,r.payableAmount=r.priceOriginal,r.pointgivenOriginal=r.PointGiven,r.pointredeemOriginal=r.PointRedeem,r.PromotionId=e(a).attr("data-promotionid"),r.PromotionId>0?r.Price=_shopdetail.parseTodecimal(e(a).attr("data-newprice"),2):r.Price=_shopdetail.parseTodecimal(e(a).attr("data-price"),2),t.push(r)}),e.each(e("#divAddonPopupSection input[type='radio']:checked"),function(i,a){if("true"!=e(a).attr("data-IsNOTA")){var r={};r.ServiceTitle=e(a).attr("data-serviceTitle"),r.ServiceId=e(a).attr("data-serviceid"),r.ParentServiceID=e(a).attr("data-parentserviceId"),r.ServiceDesc=e(a).attr("data-serviceDisc"),r.Duration=e(a).attr("data-Duration"),r.PointGiven=e(a).attr("data-PointGiven"),r.PointRedeem=e(a).attr("data-PointRedeem"),r.IsShowPriceOnline=e(a).attr("data-isshowpriceonline"),r.Originalprice=_shopdetail.parseTodecimal(e(a).attr("data-price"),2);var o=e.grep(_shopdetail.localData.AddonsList,function(e){return 1==e.ServiceLevel&&e.ServiceId==r.ServiceId});if(o.length>0){if(r.BusinessTax=o[0].BusinessTax,r.TaxesValues=o[0].TaxesValues,r.Taxes=o[0].TaxesValues,r.Tax=0,null!=o[0].BusinessTax&&o[0].BusinessTax.length>0)for(var n=0;n<o[0].BusinessTax.length;n++)r.Tax=r.Tax+o[0].BusinessTax[n].Tax,r.TaxesValues=o[0].BusinessTax[n].BusinessTaxID,_onlineCheckout.ApplyMultipleTax(r.Originalprice,o[0]);r.taxprice=_onlineCheckout.parseTodecimal(r.Originalprice*r.Tax/100,3),r.actualTaxprice=r.taxprice,r.ResOccurs=String.isNullOrUndefineOrBlank(o[0].ResOccurs)?0:o[0].ResOccurs}r.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,r.redeemAmount=0,r.redeemTax=0,r.Discount=0,r.VisitRemaining=0,r.Visit=0,r.priceOriginal=_shopdetail.parseTodecimal(e(a).attr("data-price"),2),r.GCDetail=[],r.GCDetailPriceBase=[],r.IsServiceBaseGC=!1,r.paidType=arrpaidType.UnPaid,r.DiscountID=0,r.depositsPaid=0,r.depositsPercentage=0,r.payableAmount=r.priceOriginal,r.pointgivenOriginal=r.PointGiven,r.pointredeemOriginal=r.PointRedeem,r.PromotionId=e(a).attr("data-promotionid"),r.PromotionId>0?r.Price=_shopdetail.parseTodecimal(e(a).attr("data-newprice"),2):r.Price=_shopdetail.parseTodecimal(e(a).attr("data-price"),2),t.push(r)}}),t},_shopdetail.AddonValidate=function(){var t=_shopdetail.localData.AddonsList;if(null==t||null==t||0==t.length)return!0;var i=e.grep(t,function(e){return 0==e.ServiceLevel}),a=0;return e.each(i,function(r){var o=e.grep(t,function(e){return e.ParentServiceID==i[r].ServiceId&&1==e.IsOnlineService}),n=_shopdetail.ValidateAddonService(o,i[r].MinItem,i[r].MaxItem,i[r].IsRequired,!1);e("#errMsg_"+i[r].ServiceId).text(n),e("#divErrorAddon_"+i[r].ServiceId).hide(),""!=n&&(e("#divErrorAddon_"+i[r].ServiceId).show(),a++)}),0==a},_shopdetail.OnEventAddonValidate=function(t){var i=_shopdetail.localData.AddonsList;if(null==i||null==i||0==i.length)return!0;var a=e.grep(i,function(e){return 0==e.ServiceLevel&&e.ServiceId==t}),r=0;return e.each(a,function(t){var o=e.grep(i,function(e){return e.ParentServiceID==a[t].ServiceId&&1==e.IsOnlineService}),n=_shopdetail.ValidateAddonService(o,a[t].MinItem,a[t].MaxItem,a[t].IsRequired,!0);e("#errMsg_"+a[t].ServiceId).text(n),e("#divErrorAddon_"+a[t].ServiceId).hide(),""!=n&&r++}),0==r},_shopdetail.ValidateAddonService=function(t,i,a,r,o){var n="",s=0;if(0!=i||1==r||0!=a){if(e.each(t,function(r){1==i&&1==a?e("#rdo_"+t[r].ServiceId).prop("checked")&&s++:e("#check_"+t[r].ServiceId).prop("checked")&&s++}),1==r&&i>0){if(i>s&&!o){var l=i>1?" add-ons.":" add-on.";n="Please select at least "+_vgClassSessionSelection.NumberToWord(i)+l}else if(0!=a&&s>a){l=a>1?" add-ons.":" add-on.";n="Please select total "+_vgClassSessionSelection.NumberToWord(a)+l}}else if(0!=a&&s>a){l=a>1?" add-ons.":" add-on.";n="Please select total "+_vgClassSessionSelection.NumberToWord(a)+l}return n}return n},_shopdetail.BindSelectedAddon=function(t,i,a){var r=e.grep(SelectedAddonService,function(e){return e.MainServiceID==t&&e.SrNo==i});r.length>0&&e.each(r[0].lstAddonService,function(t){e("#check_"+r[0].lstAddonService[t].ServiceId).prop("checked",!0),e("#rdo_"+r[0].lstAddonService[t].ServiceId).prop("checked",!0)}),_shopdetail.CheckboxAddOnService()},_shopdetail.RemoveSelectedAddon=function(e,t){var i=SelectedAddonService.findIndex(function(i){if(i.MainServiceID==e.toString()&&i.SrNo==t.toString())return!0});i>=0&&SelectedAddonService.splice(i,1)},_shopdetail.SelectedAddonCount=function(t,i,a){var r=0,o=e.grep(SelectedAddonService,function(e){return e.MainServiceID==i&&e.SrNo==a});if(o.length>0)r=o[0].lstAddonService.length;else{var n="",s="";if(String.isNullOrUndefineOrBlank(HouseCallGroupID))n=getCookie("AddonServicIds"),s=getCookie("AddonAppointmentIds");else if(null!=getCookie("AddonServicIds")&&void 0!==getCookie("AddonServicIds")&&null!=getCookie("AddonServicIds")&&null!=getCookie("AddonAppointmentIds")&&void 0!==getCookie("AddonAppointmentIds")&&null!=getCookie("AddonAppointmentIds")){for(var l=getCookie("AddonServicIds").split(","),d=getCookie("AddonAppointmentIds").split(","),c=0;c<l.length;c++)l[c].toString().split("_")[0]==i&&(n+=l[c].toString().split("_")[1]+"-");for(c=0;c<d.length;c++)d[c].toString().split("_")[0]==i&&(s+=d[c].toString().split("_")[1]+"-");n=n.slice(0,-1),s=s.slice(0,-1)}var u=getCookie("IsFromReschedual"),p=getCookie("IsReBookAppointment"),h=getQueryStringData("Type");if(("true"==isWidget||void 0!==h&&""!=h&&"Builder"==h)&&void 0===p){var m=new URLSearchParams(window.location.search).get("rebook");null!==m&&"undefined"!==m&&void 0!==m&&(p=m)}if(void 0!==u&&"true"==u.toLowerCase()&&void 0!==n&&null!=n&&void 0!==s&&null!=s){var f=n.split("-"),g=s.split(","),v=e((y="#cboServiceProviderWaitlist_Search"+a)+" > option").length+1!=e(y+" :selected").length&&0!=e(y+" :selected").length?e(y).val().join("-"):"",A=[];for(c=0;c<f.length;c++){var C={};null!=(C=_shopdetail.GetAddonsServiceDetailbyId(i,f[c],v))&&""!=C&&C.length>0&&(C[0].AppointmentID=1*g[c],C[0].Status=12,A.push(C[0]))}ReschedualAddonService=e.extend(!0,[],A),_shopdetail.AddAddOnServiceDetailForReschedule(i,0,"","",a,A),""!=f[0]&&f.length>0&&(r=f.length)}else if(void 0!==p&&"true"==p.toLowerCase()&&void 0!==n&&!String.isNullOrUndefineOrBlank(n)){var y;for(f=n.split("-"),v=e((y="#cboServiceProviderWaitlist_Search"+a)+" > option").length+1!=e(y+" :selected").length&&0!=e(y+" :selected").length?e(y).val().join("-"):"",A=[],c=0;c<f.length;c++){C={};C=_shopdetail.GetAddonsServiceDetailbyId(i,f[c],v),!String.isNullOrUndefineOrBlank(C)&&C.length>0&&A.push(C[0])}A.length>0&&(_shopdetail.AddAddOnServiceDetailForReschedule(i,0,"","",a,A),""!=f[0]&&f.length>0&&(r=A.length))}try{if(void 0!==p&&"true"==p.toLowerCase()&&null!=providerID&&""!=providerID&&parseInt(providerID)>0){var b={ServiceId:parseInt(i),BusinessID:parseInt(businessID),ServiceProviderID:parseInt(providerID),LastMinDealHours:LastMinuteBookingDays};isrebookfunctionchange=!0;var S=new vagaro.ajax;S.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAddOnService,groupID),S.datamodel.data=b,S.datamodel.IsNewVagaroAPI=!0,S.datamodel.callback=function(r){if(1e3==r.ResponseCode&&(ShowLoader(!1),r.Data.length>0&&null!=r.Data[0]&&(_shopdetail.localData.AddonsList=r.Data,_shopdetail.localData.SelectedAddonsList=r.Data,r.Data.some(e=>1===e.IsRequired)&&void 0!==_shopdetail.localData.SelectedAddonsList&&_shopdetail.localData.SelectedAddonsList.length>0&&null!=_shopdetail.localData.SelectedAddonsList[0]))){var o=e.grep(_shopdetail.localData.SelectedAddonsList,function(e){return e.ServiceProviderID==parseInt(providerID)&&e.MainServiceId==parseInt(i)}),n={ServiceId:parseInt(i),BusinessID:parseInt(businessID)},s=new vagaro.ajax;s.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetPhotoGalleryService,groupID),s.datamodel.data=n,s.datamodel.IsNewVagaroAPI=!0,s.datamodel.callback=function(e){if(e.Data.length>0&&null!=e.Data[0]&&null!=o&&void 0!==o&&o.length>0){e.Data[0].DiscountValue>0?IsTimeSlot=1:IsTimeSlot=0;var r=void 0!==ServiceDataList&&null!=ServiceDataList&&ServiceDataList.length>0&&ServiceDataList.some(function(e){return Number(e.ServiceID)===Number(i)&&e.IsShowPriceAsStartingPoint});_shopdetail.SetAddOnPopup(o,i,providerID,e.Data[0].EventType,t,e.Data[0].ServiceDesc,e.Data[0].Price,e.Data[0].Photo,a,IsTimeSlot,event,e.Data[0].IsShowPriceOnline,e.Data[0].Taxes,r)}},s.datamodel.Error=_common.CallFailed,s.Post()}},S.datamodel.Error=_common.CallFailed,S.Post()}}catch{}}return t=0==r?t:t+" & "+r+(1==r?" add-on":" add-ons")},_shopdetail.SelectedAddonImage=function(t,i){var a=e.grep(SelectedAddonService,function(e){return e.MainServiceID==t&&e.SrNo==i});return a},_shopdetail.GetAddOnServiceDetail=function(t,i){var a="",r="#"+t.replace("cboServiceProviderWaitlist_Search","txtService"),o=e(r).data("choice");if(""!=o)try{var n=JSON.parse(o);if(n.hasOwnProperty("id")&&""!=n.id){a=n,SerialNo=r.replace("#txtService","");var s=""==i[0]?0:i,l=n.isShowPriceOnline,d=null!=ServiceDataList&&""!=ServiceDataList&&ServiceDataList.length>0&&ServiceDataList.some(function(e){return Number(e.ServiceID)===Number(a.id)&&e.IsShowPriceAsStartingPoint}),c=a.price;try{var u=0;if(Array.isArray(s)?1===s.length&&(u=s[0]):s&&(u=s),u&&Number(u)>0&&null!=OnlindBookingResponse&&null!=OnlindBookingResponse.lstOnlineServiceAndProviderMapping){var p=e.grep(OnlindBookingResponse.lstOnlineServiceAndProviderMapping,function(e){return Number(e.serviceProviderID)===Number(u)&&Number(e.serviceID)===Number(a.id)});p.length>0&&null!=p[0].Price&&""!==p[0].Price&&(c=p[0].Price)}}catch(e){}_shopdetail.OpenAddOnServicePopup(a.id,s,a.eventType,a.text,ReplaceSpecialCharacters(a.serviceDesc),c,a.photo,SerialNo,0,event,l,a.Taxes,d)}}catch(e){}},_shopdetail.OpenAddOnServicePopup=function(t,i,a,r,o,n,s,l,d,c,u,p,h){var m=i;i=""==i||null==i||isNaN(i)?0:i,void 0!==_shopdetail.localData.SelectedAddonsList&&0!=_shopdetail.localData.SelectedAddonsList.length||(m=0);var f={ServiceId:parseInt(t),BusinessID:parseInt(businessID),ServiceProviderID:parseInt(m),IsOnline:1,LastMinDealHours:LastMinuteBookingDays};void 0!==getCookie("PromotionID")&&parseInt(getCookie("PromotionID"))>0?d=1:void 0!==c&&c.stopPropagation();var g="";if(void 0!==_shopdetail.localData.SelectedAddonsList&&_shopdetail.localData.SelectedAddonsList.length>0&&null!=_shopdetail.localData.SelectedAddonsList[0]&&(g=e.grep(_shopdetail.localData.SelectedAddonsList,function(e){return e.ServiceProviderID==parseInt(i)&&e.MainServiceId==parseInt(t)})),null!=g&&void 0!==g&&g.length>0)_shopdetail.SetAddOnPopup(g,t,i,a,r,o,n,s,l,d,c,u,p,h);else{var v=new vagaro.ajax;v.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAddOnService,groupID),v.datamodel.data=f,v.datamodel.IsNewVagaroAPI=!0,v.datamodel.callback=function(m){1e3==m.ResponseCode&&m.Data.length>0&&null!=m.Data[0]&&(void 0===_shopdetail.localData.SelectedAddonsList||0==_shopdetail.localData.SelectedAddonsList.length?_shopdetail.localData.SelectedAddonsList=m.Data:(_shopdetail.localData.SelectedAddonsList=_shopdetail.localData.SelectedAddonsList.filter(function(e){return e.MainServiceId!=parseInt(t)}),Array.prototype.push.apply(_shopdetail.localData.SelectedAddonsList,m.Data)),m.Data=e.grep(m.Data,function(e){return e.ServiceProviderID==i}),null!=m.Data&&void 0!==m.Data&&m.Data.length>0&&_shopdetail.SetAddOnPopup(m.Data,t,i,a,r,o,n,s,l,d,c,u,p,h))},v.datamodel.Error=_common.CallFailed,v.Post()}},_shopdetail.AddAddOnServiceDetail=function(t,i,a,r,o,n,s){if(!0===isrebookfunctionchange)return _shopdetail.AddAddOnServiceDetailForBookNow(t,a,0,"","","","1",!1,"0",r,ReplaceSpecialCharacters(o),"","","false"),void(isrebookfunctionchange=!1);var l=_shopdetail.AddonValidate();if(n=unescape(n),o=unescape(o),0!=l){var d,c={};if(_shopdetail.RemoveSelectedAddon(t,i),c.MainServiceID=t,c.SrNo=i,c.ServiceProviderId=a,c.ServicePhotoURL=r,c.ServiceDesc=o,""==(d=_shopdetail.CreateAddonCollection())&&0==d.length)return _shopdetail.HideAddOnService(),void(s&&LoadData());c.lstAddonService=d,SelectedAddonService.push(c);var u=_shopdetail.SelectedAddonCount(n,t,i);e("#txtService"+i).select2("data",{id:t,text:u});var p,h=e("#txtService"+i),m=JSON.parse(e("#txtService"+i).data("choice")),f=_shopdetail.ServicePromotionforNewCustomer(m);if("1"==h.data("type")&&1==m.hasOwnProperty("eventType")&&void 0!==m.promotext&&""!=m.promotext&&1==f)e(".service-namepromo",p="#divdd-select-search"+i).html(u),e(".promo-digit",p).html('<div class="vg-service-video"><em></em>'+(1==m.isCurrencySymbol?currencySymbol+m.promotext:m.promotext)+"</div>"),e(p).show();else e(p="divdd-select-search"+i).hide();_shopdetail.BindSPAfterAddonSelect(i,d),_shopdetail.HideAddOnService(),s&&(_shopdetail.HideAddOnService(),LoadData()),"undefined"!=typeof IsFromCreateLink&&null!=IsFromCreateLink&&IsFromCreateLink&&"rebind"!=e("#hdnIsRebind").val()&&LoadData(),!String.isNullOrUndefineOrBlank(ReschedualAddonService)&&ReschedualAddonService.length>0&&LoadData()}},_shopdetail.CheckServiceIsAddonsBundle=function(t,i,a,r,o,n){if(null!=OnlindBookingResponse.lstOnlineServiceBundleDetail){null!=a&&(a=a.replace("Service/148x148","BusinessPackage/Original"));var s=e.grep(OnlindBookingResponse.lstOnlineServiceBundleDetail,function(e){return e.businessPackageID==t});IsBundle=null!=s&&s.length>0,null!=s&&s.length>0&&(SelectedAddonService=[],AddonServiceBundleDetail=s,e("#hdnServicebundleName").val(i),CheckAddOnService(s[0].serviceId,0,s[0].Eventtype,s[0].serviceTitle,r.replace("'"," "),s[0].ServicePrice,a,IsAddOnCount,1,o,s[0].Taxes))}},_shopdetail.GetListAddonService=function(t,i){if(null!=t&&""!=t&&t.length>0)return e.grep(t,function(e){return e.SerialNo==i})},_shopdetail.AddAddOnServiceDetailForBookNowBundle=function(t,i,a,r,o,n,s,l,d,c,u,p,h){if(u=unescape(u),0==_shopdetail.AddonValidate())return;var m,f={};f.MainServiceID=t,f.SrNo=p,f.ServiceProviderId=i,f.ServicePhotoURL=c,f.ServiceDesc=u,m=_shopdetail.CreateAddonCollection(),f.lstAddonService=m;const g=SelectedAddonService.some(e=>e.MainServiceID===f.MainServiceID&&e.SrNo===f.SrNo);g?SelectedAddonService.find(e=>e.MainServiceID===f.MainServiceID&&e.SrNo===f.SrNo).lstAddonService=_shopdetail.CreateAddonCollection():SelectedAddonService.push(f);var v=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,p+1);v.length>0?_shopdetail.OpenPopupBundleService(v,p+1,d,h,c,u):(_shopdetail.HideAddOnService(),1==d?e("#btnAddToCart_"+t).click():(t=e("#hdnServiceId").val(),_shopdetail.SetBookData(t,i,a,r,o,n,s,l))),e(".modal:visible").each(function(e,t){centerModal(t)})},_shopdetail.OpenPopupBundleService=function(t,i,a,r,o,n){if(t.length>0&&null!=t){var s="",l="",d="",c="",u="";_shopdetail.ShowAddOnService(),_shopdetail.localData.AddonsList=t,e(_shopdetail.Controls.AddOnList).empty(),e(_shopdetail.Controls.ParentService).empty(),null!=e("#hdnServiceId").val()&&""!=e("#hdnServiceId").val()&&""!=e("#hdnServiceId").val()&&(u=e("#hdnServiceId").val());var p=_shopdetail.GetServiceBundleDetailbyId(t[0].EventServiceID,u);if(null!=p&&""!=p&&p.length>0){c=p[0].serviceId,l=n,s=o,d=parseFloat(p[0].ServicePrice);try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){var h=p[0].Taxes;if(""!=h&&null!=h&&"0"!=h){let e=h.split(",");var m=[];if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(e.length>0)for(var f=0;f<e.length;f++)m.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[f]).Tax);var g=m.reduce((e,t)=>e+t,0);d=CalAccPriceWithTax(p[0].ServicePrice,g)}}}}catch(e){}d=_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(d,2).format("#.##"),e("#divSuggestedAddon").text("Service "+i+" Suggested Add-Ons : "+p[0].serviceTitle)}null==s||"null"==s||""==s?(e("#divServiceImage").css("display","none"),e(".addon-service-description").addClass("no-image-data")):(e("#divServiceImage").css("display","block"),e("#divServiceImage").css("background-image","url("+s+")"),e(".addon-service-description").removeClass("no-image-data")),e("#divServiceDes").text(l),"$0.00"==d||"0.00"==d||"0"==d?1==r?(e("#divFreeServicePrice").css("display","block"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(d,2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(d,2).format("#.##"))):1==r?(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(d.replace(_shopdetail.currencySymbol,""),2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(0,2).format("#.##"))),e(".modal-body.grayscrollbar").scrollTop(0);var v=e.grep(t,function(e){return 0==e.ServiceLevel});e.each(v,function(i){var a=e.grep(t,function(e){return e.Price=_onlineCheckout.parseTodecimal(e.Price,2),e.ParentServiceID==v[i].ServiceId});v[i].MinItem=v[i].MinItem>a.length?a.length:v[i].MinItem,v[i].MaxItem=v[i].MaxItem>a.length?a.length:v[i].MaxItem;var r=_shopdetail.GetSlotLastMinuteFlag(v[i].ServiceId,0);a=a.map(function(e){if(e.IsRequired=v[i].IsRequired,e.MinItem=v[i].MinItem,e.MaxItem=v[i].MaxItem,e.Photo=e.Photo.indexOf("no-shop-image-big.")>0?"":e.Photo,e.CurrencySymbol=_shopdetail.currencySymbol,e.OnlinePrice=1==e.IsShowPriceOnline?e.Price:"0.00",e.IsIncludeTaxInOnlinePricing=!1,e.OnlinePricewithtax=1==e.IsShowPriceOnline?e.Price:"0.00",e.NewPricewithTax=e.Price,null!=e.PromotionDetail&&""!=e.PromotionDetail){var t=_shopdetail.GetAddonDailyDealData(e.PromotionDetail,e.OnlinePrice,e.ServiceId,0,!1,e.BusinessTax,r);t.PromotionID>0?(e.IsDealApplied=!0,e.PromotionID=t.PromotionID,e.NewPrice=t.NewPrice,e.NewPricewithTax=e.NewPrice):(e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0)}else e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0;try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&(e.IsIncludeTaxInOnlinePricing=!0,void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues&&""!=e.BusinessTax&&null!=e.BusinessTax&&null!=e.BusinessTax&&""!=e.BusinessTax)){if(null!=e.PromotionDetail&&""!=e.PromotionDetail){var a,o=parseFloat(e.NewPricewithTax)*parseFloat(e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0)/100);a=parseFloat(e.NewPricewithTax)+o,e.NewPricewithTax=a}var n=e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0);e.OnlinePricewithtax=CalAccPriceWithTax(e.OnlinePrice,n)}}catch(e){}return e}),_shopdetail.CreateNoneOTAboveObject(a),e(_shopdetail.Controls.tmplAddOnCategory).tmpl(v[i]).appendTo(_shopdetail.Controls.AddOnList),e(_shopdetail.Controls.tmplAddOnService).tmpl(a).appendTo("#Service_"+a[0].ParentServiceID)}),_shopdetail.BindSelectedAddon(c,i,0),_shopdetail.CheckboxAddOnService();t=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,i+1);l=ReplaceSpecialCharacters(l),t.length>0?(e("#btnClose").css("display","none"),e("#btnback").css("display","block"),e("#btnback").attr("onclick","_shopdetail.BackAddonBundleService("+(i-1)+","+a+","+r+",'"+s+"','"+l+"');"),e("#btnContinue").css("display","none"),e("#btnNext").css("display","block"),e("#btnNext").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNowBundle("+c+", 0, 0, '', '', '', 5 , false,"+a+",'"+s+"','"+l.replace(/'/g,"\\'")+"',"+i+","+r+");")):(e("#btnClose").css("display","none"),e("#btnback").css("display","block"),e("#btnback").attr("onclick","_shopdetail.BackAddonBundleService("+(i-1)+","+a+","+r+",'"+s+"','"+l+"');"),e("#btnNext").css("display","none"),e("#btnContinue").css("display","block"),e("#btnContinue").attr("onclick","_shopdetail.AddAddOnServiceDetailForBookNowBundle("+c+", 0, 0, '', '', '', 5 , false,"+a+",'"+s+"','"+l.replace(/'/g,"\\'")+"',"+i+","+r+");"))}},_shopdetail.BackAddonBundleService=function(t,i,a,r,o){if(o=unescape(o),0==t)_shopdetail.HideAddOnService();else if(1==t){(n=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,t)).length>0?_shopdetail.OpenPopupBundleService(n,t,i,a,r,o):_shopdetail.HideAddOnService()}else if(2==t||3==t||4==t||5==t){var n;(n=_shopdetail.GetListAddonService(AddonServiceBundleDetailBookNow,t)).length>0&&_shopdetail.OpenPopupBundleService(n,t,i,a,r,o)}e(".modal:visible").each(function(e,t){centerModal(t)})},_shopdetail.GetServiceDetailbyId=function(t){if(null!=ServiceDataList&&""!=ServiceDataList&&ServiceDataList.length>0)return e.grep(ServiceDataList,function(e){return e.ServiceID==t})},_shopdetail.GetServiceBundleDetailbyId=function(t,i){if(null!=lstOnlineServiceBundleDetail&&""!=lstOnlineServiceBundleDetail&&lstOnlineServiceBundleDetail.length>0)return e.grep(lstOnlineServiceBundleDetail,function(e){return e.serviceId==t&&e.businessPackageID==i})},_shopdetail.GetAddonsServiceDetailbyId=function(t,i,a){var r=[];if(null!=OnlindBookingResponse.lstAddonService&&""!=OnlindBookingResponse.lstAddonService&&OnlindBookingResponse.lstAddonService.length>0){var o=e.extend(!0,[],OnlindBookingResponse.lstAddonService),n=e.grep(o,function(e){return"undefined"!=typeof IsAutoAssignEmployee&&1==IsAutoAssignEmployee?e.EventServiceID.split(",").includes(t.toString())&&e.ServiceId==i:e.EventServiceID.split(",").includes(t.toString())&&e.ServiceId==i&&e.ServiceProviderID==a});n.length>0&&(r=n.map(function(e){return e.EventServiceID=t,e}))}return r},_shopdetail.AddAddOnServiceDetailForReschedule=function(t,i,a,r,o,n){var s,l={};l.MainServiceID=t,l.SrNo=o,l.ServiceProviderId=i,l.ServicePhotoURL=a,l.ServiceDesc=r;var d=[];e.each(e(n),function(e,t){var i={};i.ServiceTitle=t.ServiceTitle,i.Price=_shopdetail.parseTodecimal(t.Price,2),i.ServiceId=t.ServiceId,i.ParentServiceID=t.ParentServiceID,i.ServiceDesc=t.ServiceDesc,i.Duration=t.Duration,i.AppointmentID=t.AppointmentID,d.push(i)}),s=d,l.lstAddonService=s,SelectedAddonService.push(l)},_shopdetail.GetTotalAddonsServicePrice=function(t){var i=0;return null!=t&&""!=t&&t.length>0&&e.grep(t,function(e){i=_shopdetail.parseTodecimal(i)+_shopdetail.parseTodecimal(e.Price)}),i},_shopdetail.GetMembershipList=function(t,i,a,r){ShowLoader(!0);var o=_shopdetail.AtleastOneMemOrPackSelectedFromPopUp(),n=o;1==a&&(o=_shopdetail.IsMemPkgReqToBook,n=!1);var s={BusinessID:parseInt(businessID),LoginUserID:parseInt(i),ServiceIds:t,InventoryIds:r,IsFromCart:a,IsMemPkgReq:n};e(_shopdetail.Controls.SuggestUpsell).empty(),_shopdetail.MembershipPackageUpSell={};var l=new vagaro.ajax;l.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetMembershipList,groupID),l.datamodel.data=s,l.datamodel.IsNewVagaroAPI=!0,l.datamodel.callback=function(t){1e3==t.ResponseCode&&(null!=t.Data&&void 0!==t.Data.MembershipListForBind&&null!=t.Data.MembershipListForBind&&t.Data.MembershipListForBind.length>0?(e("#divSuggestUpsell").find(".vg-switch-tab-first").addClass("w--current"),e("#divSuggestUpsell").css("display","block"),t.Data.MembershipListForBind=t.Data.MembershipListForBind.map(function(e){return e.CurrencySymbol=_shopdetail.currencySymbol,e.NewMembershipName=e.MembershipName.replace(/'/g,"\\'"),e}),_shopdetail.MembershipPackageUpSell.MembershipUpSellData=t.Data.MembershipDetailsForCheckout,_shopdetail.MembershipPackageUpSell.PackageUpSellData=t.Data.PackageDetailsForCheckout,_shopdetail.MembershipPackageUpSell.MembershipPkgBindData=t.Data.MembershipListForBind,e(_shopdetail.Controls.SuggestUpsell).empty(),e(_shopdetail.Controls.tmplSuggestUpsellDetail).tmpl(t.Data.MembershipListForBind).appendTo(_shopdetail.Controls.SuggestUpsell),e("#upgradedetaillink").css("display","block"),1==a&&(_onlineCheckout.CheckCartItems(),_onlineCheckout.IsClassBookingOnly(!1)),o&&0==a&&(e("#divSuggestUpsell").css("display","none"),void 0===_shopdetail.BookingDetail.SelectedMembership||null==_shopdetail.BookingDetail.SelectedMembership||void 0!==_shopdetail.BookingDetail.SelectedPackages&&null!=_shopdetail.BookingDetail.SelectedPackages&&0!=_shopdetail.BookingDetail.SelectedPackages.length?void 0!==_shopdetail.BookingDetail.SelectedPackages&&null!=_shopdetail.BookingDetail.SelectedPackages&&_shopdetail.BookingDetail.SelectedPackages.length>0&&(void 0===_shopdetail.BookingDetail.SelectedMembership||null==_shopdetail.BookingDetail.SelectedMembership)?_shopdetail.SuggestUpsellClick(0,!1,!0,"",""):_shopdetail.SuggestUpsellClick(0,!0,!0,"",""):_shopdetail.SuggestUpsellClick(0,!0,!1,"",""))):e("#divSuggestUpsell").css("display","none")),"undefined"!=typeof Isformsloding&&1==Isformsloding?ShowLoader(!0):ShowLoader(!1)},l.datamodel.Error=_common.CallFailed,l.Post()},_shopdetail.AtleastOneMemOrPackSelectedFromPopUp=function(){if(1==_shopdetail.IsMemPkgReqToBook&&1==_shopdetail.BookingDetail.IsSelectedFromPopUp&&(void 0!==_shopdetail.BookingDetail.SelectedMembership&&null!=_shopdetail.BookingDetail.SelectedMembership||void 0!==_shopdetail.BookingDetail.SelectedPackages&&null!=_shopdetail.BookingDetail.SelectedPackages&&_shopdetail.BookingDetail.SelectedPackages.length>0)){var t=e(".familycktfrnd ul li.selected").data("value");return void 0===t||t.toString()==UserID}return!1},_shopdetail.IsMemPkgReqToBookUserOrFnF=function(){return 1==_shopdetail.IsMemPkgReqToBook&&1==_shopdetail.BookingDetail.IsSelectedFromPopUp},_shopdetail.SuggestUpsellClick=function(t,i,a,r,o){if(ShowLoader(!0),nothanksselected=!1,istipchanges=!1,1==a&&_shopdetail.SuccessPackageUpsellClick(t),1==i&&0!=t){var n=!1;if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&e.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&(n=!0)}),1!=n)return ShowLoader(!1),void vagaro.alert("you can not purchase membership because you already have other discount applied in items.");if(1!=e("#divMemUpsell").html())return message="A membership already exists in your cart, would you like to replace it?",swal({html:!0,title:message,text:"",type:"",showCancelButton:!0,confirmButtonText:"Replace Membership",cancelButtonText:"No",closeOnCancel:!0},function(e){e&&_shopdetail.SuccessMembershipUpsellClick(t),ShowLoader(!1)}),void setTimeout(function(){e(".gencutom-title").html("Multiple Memberships in Cart")},100);_shopdetail.SuccessMembershipUpsellClick(t)}else 1==i&&0==t&&_shopdetail.SuccessMembershipUpsellClick(t);1!=a&&1!=i||1!=_IsMemPkgUpSell||"false"!=e("#hdnIsCCCapturedAllowed").val().toLowerCase()||(e("#hdnIsFromPage").val("shopdetail"),_shopdetail.LoadCCSectionForBooking(_shopdetail.BookingDetail.objUserCCDetails,_shopdetail.BookingDetail.lstfriendandfamilycc))},_shopdetail.SuccessMembershipUpsellClick=function(t){var i=e.extend(!0,[],_shopdetail.MembershipPackageUpSell.MembershipUpSellData),a=e.grep(i,function(e){return e.MembershipID==t});i&&i.length>0&&i[0].userID&&t&&(_onlineCheckout.FormCallSource=!0,_onlineCheckout.GetFormsByIdsForMS(t,i[0].userID)),0==t&&1==_shopdetail.IsMemPkgReqToBook&&1==_shopdetail.BookingDetail.IsSelectedFromPopUp?void 0!==_shopdetail.BookingDetail.SelectedMembership&&null!=_shopdetail.BookingDetail.SelectedMembership&&(a=e.grep(i,function(e){return e.MembershipID==_shopdetail.BookingDetail.SelectedMembership})):_shopdetail.ResetDiscount(),void 0!==a&&null!=a&&a.length>0&&void 0!==a[0].IsRecurring&&null!=a[0].IsRecurring&&1==a[0].IsRecurring&&(e("#tabVagaroPayLater").data("IsFromUpsell",!0),_shopdetail.ResetVPLPaymentMethod(!1,!0)),_shopdetail.BookingDetail.MembershipUpSellData=[],_onlineCheckout.setSuggestUpsellMembershipsData(a,_shopdetail.BookingDetail.MembershipUpSellData,1),lstCheckoutMembershipDetail=[],_IsPrepay&&e.extend(lstCheckoutMembershipDetail,a),_shopdetail.ApplyDiscounts(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],lstCheckoutMembershipDetail,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout),_shopdetail.CalculateTaxForPenny(),_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.IsVCFEnable()&&_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.MembershipUpSell),ShowLoader(!1),e("#tabVagaroPayLater").hide(),e("#divVplTracking").hide()},_shopdetail.createHTMLofMembershipUpsell=function(e,t,i){return'<div class="scfftext"><div class="brand-name-checkout sent-casing thm-textColor" aria-labelledby="spnRelationshipsAndAgeMS lblRelationshipsAndAgeMS" role="contentinfo"><span id="spnRelationshipsAndAge'+t+'" class="web-caption-text" aria-hidden="true">This membership can be used by up to '+e+' Family & Friends with the following relationship types:</span><label id="lblRelationshipsAndAge'+t+'" aria-hidden="true" class="thm-textColor web-caption-text"></label></div></div><div class="customcheck-box-singal singal-center onlinecheckboxff thm-textColor vagaro-checkbox"><input id="FFFriends" type="checkbox" value="Friend" clientidmode="Static" class="chkRelation" checked="true" onclick="_onlineCheckout.EnableDisableSharing(0, 0,'+i+')" /><label for="FFFriends" class="thm-textColor" aria-label="Share with Family & Friends" role="checkbox" aria-checked="true">Share with Family & Friends</label></div><div id="divshared'+t+'withFF" class="select-ffs hide"><div class="div-block-545"><div class="text-block-373 thm-textColor web-body-font web-builder-font-color">Select up to '+e+' Family & Friends to share this membership with:</div><div id="divMemberChipsFor'+t+'" class="div-block-544 thm-textColor"></div></div><div class="ffpopup-parent"><div class="create-new-ff-link thm-textColor ghost-button" onclick="_shareListing.SetClassBookingParentPage(this,\'booknowupsell\');" role="link">Add Family &amp; Friends</div></div></div>'},_shopdetail.SuccessPackageUpsellClick=function(t){_IsPrepay&&_shopdetail.ResetDiscount();var i=e.extend(!0,[],_shopdetail.MembershipPackageUpSell.PackageUpSellData),a=e.grep(i,function(e){return e.ServiceId==t});0==t&&1==_shopdetail.IsMemPkgReqToBook&&1==_shopdetail.BookingDetail.IsSelectedFromPopUp&&void 0!==_shopdetail.BookingDetail.SelectedPackages&&null!=_shopdetail.BookingDetail.SelectedPackages&&_shopdetail.BookingDetail.SelectedPackages.length>0&&(a=[],i.forEach(function(e){-1!=jQuery.inArray(e.ServiceId.toString(),_shopdetail.BookingDetail.SelectedPackages)&&a.push(e)})),void 0!==a&&null!=a&&a.length>0&&void 0!==a[0].IsRecurring&&null!=a[0].IsRecurring&&1==a[0].IsRecurring&&(e("#tabVagaroPayLater").data("IsFromUpsell",!0),_shopdetail.ResetVPLPaymentMethod(!1,!0)),_shopdetail.BookingDetail.PackageUpSellData=[],_onlineCheckout.setSuggestUpsellPackageData(a,_shopdetail.BookingDetail.PackageUpSellData,1);var r=e.extend(!0,[],_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout);_IsPrepay&&(lstCheckoutPackageDetail=_shopdetail.createGCPackageForPackageUpSellItem(1),r.push.apply(r,lstCheckoutPackageDetail)),_shopdetail.ApplyDiscounts(r,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstCheckoutMembershipDetail,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.lstServiceDetailsForCheckout),_shopdetail.CalculateTaxForPenny(),_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.IsVCFEnable()&&_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.PackageUpSell),ShowLoader(!1)},_shopdetail.createGCPackageForPackageUpSellItem=function(t){if(1==t){for(var i=[],a=0;a<_shopdetail.BookingDetail.PackageUpSellData.length;a++)for(var r=0;r<_shopdetail.BookingDetail.PackageUpSellData[a].lstPackageForCheckout.length;r++)i.push(_shopdetail.BookingDetail.PackageUpSellData[a].lstPackageForCheckout[r]);return i}if(2==t){var o=[];e.grep(onlineShoppingCartmain.Packages,function(t){4==t.eventType&&null!=t.lstPackageForCheckout&&t.lstPackageForCheckout.length>0&&(o=e.extend(!0,o,t.lstPackageForCheckout))});return o}},_shopdetail.DisplayMembershipUpSellItem=function(t){if((1==t||3==t)&&"undefined"!=_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0){var i=_shopdetail.BookingDetail.MembershipUpSellData[0];if(e("#Nothanks").removeClass("w--current"),i.ActualPrice==i.Price?e("#divMemUpsell").html('<div class="onlinemember-row"><div class="web-body-font web-builder-font-color">'+i.MembershipName+'</div><div id="divMemUpsellPrice" class="web-body-font web-builder-font-color">'+_shopdetail.currencySymbol+_shopdetail.parseTodecimal(i.Price,2).format("#.##")+"</div></div>"):e("#divMemUpsell").html('<div class="onlinemember-row"><div class="web-body-font web-builder-font-color">'+i.MembershipName+'</div><div id="divMemUpsellPrice" class="web-body-font web-builder-font-color"><div class="thm-textColor"> <span class="item-price-line-through">'+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,i.Price)+"</span> "+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,i.ActualPrice)+"</div></div></div>"),e("#divMemUpsell").show(),void 0!==i.isPresetApply&&i.PromotionID>0){var a="";void 0!==i.PromotionTitle&&null!=i.PromotionTitle&&(a=i.PromotionTitle.length>0?"("+i.PromotionTitle+")":""),e("#divMemUpsellPrice_Deals").html('<div class="sign-icon">&#xf058;</div><span class="green-text">Daily Deal Applied '+a+"</span></div>"),e("#divMemUpsellPrice_Deals").show()}else e("#divMemUpsellPrice_Deals").html(""),e("#divMemUpsellPrice_Deals").hide();void 0!==i.isPresetApply&&1==i.isPresetApply?(e("#divMemUpsellPrice_Preset").html('<div class="sign-icon">&#xf058;</div><span class="green-text">Promo Code Applied</span></div>'),e("#divMemUpsellPrice_Preset").show()):(e("#divMemUpsellPrice_Preset").html(""),e("#divMemUpsellPrice_Preset").hide()),e("#divSuggestUpsell").find(".membership").removeClass("w--current"),e("#M_"+i.MembershipId).addClass("w--current")}if((2==t||3==t)&&"undefined"!=_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0){for(var r="",o=0;o<_shopdetail.BookingDetail.PackageUpSellData.length;o++){var n=_shopdetail.BookingDetail.PackageUpSellData[o];n.ActualPrice==n.TotalPrice?r+='<div class="onlinepackage-row"><div class="web-body-font web-builder-font-color">'+n.ServiceTitle+'</div><div id="divPackageUpsellPrice" class="web-body-font web-builder-font-color">'+_shopdetail.currencySymbol+_shopdetail.parseTodecimal(n.Price,2).format("#.##")+"</div></div>":r+='<div class="onlinepackage-row"><div class="web-body-font web-builder-font-color">'+n.ServiceTitle+'</div><div id="divPackageUpsellPrice" class="web-body-font web-builder-font-color"><div class="thm-textColor"> <span class="item-price-line-through">'+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,n.TotalPrice)+"</span> "+_shopdetail.DisplayAmountOnCart(_shopdetail.BookingDetail.CurrencySymbol,n.ActualPrice)+"</div></div></div>"}var s=_shopdetail.BookingDetail.PackageUpSellData[0];if(e("#Nothanks").removeClass("w--current"),e("#divPackageUpsell").html(r),e("#divPackageUpsell").show(),void 0!==s.isPresetApply&&s.PromotionID>0){a="";void 0!==s.PromotionTitle&&null!=s.PromotionTitle&&(a=s.PromotionTitle.length>0?"("+s.PromotionTitle+")":""),e("#divPackageUpsellPrice_Deals").html('<div class="sign-icon">&#xf058;</div><span class="green-text">Daily Deal Applied '+a+"</span></div>"),e("#divPackageUpsellPrice_Deals").show()}else e("#divPackageUpsellPrice_Deals").html(""),e("#divPackageUpsellPrice_Deals").hide();void 0!==s.isPresetApply&&1==s.isPresetApply?(e("#divPackageUpsellPrice_Preset").html('<div class="sign-icon">&#xf058;</div><span class="green-text">Promo Code Applied</span></div>'),e("#divPackageUpsellPrice_Preset").show()):(e("#divPackageUpsellPrice_Preset").html(""),e("#divPackageUpsellPrice_Preset").hide()),e("#divSuggestUpsell").find(".package").removeClass("w--current"),e("#P_"+s.ServiceId).addClass("w--current")}},_shopdetail.PromotionAppliedOnPKGMS=function(t,i){var a=!0;if(void 0!==t.PerUserOne&&"1"==t.PerUserOne&&void 0!==t.PerTransactionOne&&"1"==t.PerTransactionOne){a=!1;var r={TotalPrice:"desc"},o=[];if(null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0){var n=e.extend(!0,[],_shopdetail.BookingDetail.PackageUpSellData);o=e.grep(n,function(e){return t.PromotionID==e.PromotionID}).keySort(r)}r={Price:"desc"};var s=[];if(null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0){var l=e.extend(!0,[],_shopdetail.BookingDetail.MembershipUpSellData);s=e.grep(l,function(e){return t.PromotionID==e.PromotionID}).keySort(r)}i==CheckoutBarcodeCodePrepay.Pkg&&o.length>0&&o[0].autoId===t.autoId?(s.length>0&&o[0].TotalPrice>s[0].Price||0==s.length)&&(a=!0):i==CheckoutBarcodeCodePrepay.MS&&s.length>0&&s[0].autoId===t.autoId&&(o.length>0&&o[0].TotalPrice<s[0].Price||0==o.length)&&(a=!0)}return a},_shopdetail.ApplyDailyDealONPackages=function(){if(null!=_shopdetail.BookingDetail.PackageUpSellData&&_shopdetail.BookingDetail.PackageUpSellData.length>0){var t=_shopdetail.BookingDetail.PackageUpSellData;e.grep(t,function(e){if(0!=e.PromotionID){if(_shopdetail.PromotionAppliedOnPKGMS(e,CheckoutBarcodeCodePrepay.Pkg)){var t=e.NoOfVisit;e.Price!=e.TotalPrice&&(e.Price=e.TotalPrice),e.SellPackageServiceID>0&&(t=1),e.TotalPrice=e.Price*t;var i=0;i=1==e.IsAmount?e.AmountValue*t:_shopdetail.parseTodecimal(e.TotalPrice*e.AmountValue/100,2),void 0!==e.PerUserOne&&"1"==e.PerUserOne&&(i/=t),e.TotalPrice-i<0&&(i=e.TotalPrice),e.discount=i,e.Price=_shopdetail.parseTodecimal(e.TotalPrice-i,2),e.ActualPrice=e.Price,e.calculatedTax=_shopdetail.parseTodecimal(e.Price*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_shopdetail.ApplyMultipleTax(e.Price,e),e.discount=_shopdetail.parseTodecimal(e.discount,2)}else e.PromotionID=0;0===e.Price&&0!=e.isGCApply&&(e.isGCApply=!1)}else if(e.IsInitialDiscount){t=e.NoOfVisit;e.SellPackageServiceID>0&&(t=1),e.Price!=e.TotalPrice&&(e.Price=e.TotalPrice),e.TotalPrice=e.Price*t;var a=0;a=1==e.IsAmountForInitialDiscount?e.InitialDiscount*t:_shopdetail.parseTodecimal(e.TotalPrice*e.InitialDiscount/100,2),e.TotalPrice-a<0&&(a=e.TotalPrice),e.discount=a,e.Price=_shopdetail.parseTodecimal(e.TotalPrice-a,2),e.ActualPrice=e.Price,e.calculatedTax=_shopdetail.parseTodecimal(e.Price*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_shopdetail.ApplyMultipleTax(e.Price,e),e.discount=_shopdetail.parseTodecimal(e.discount,2)}})}},_shopdetail.ApplyDailyDealONMemberships=function(){if(null!=_shopdetail.BookingDetail.MembershipUpSellData&&_shopdetail.BookingDetail.MembershipUpSellData.length>0){var t=_shopdetail.BookingDetail.MembershipUpSellData;e.grep(t,function(e){if(0!=e.PromotionID){if(_shopdetail.PromotionAppliedOnPKGMS(e,CheckoutBarcodeCodePrepay.MS)){var t=0;t=1==e.IsAmount?e.AmountValue:_shopdetail.parseTodecimal(e.Price*e.AmountValue/100,2),e.productDisc=t,e.Price=e.Price,t>e.Price?e.ActualPrice=0:e.ActualPrice=_shopdetail.parseTodecimal(e.Price-t,2),e.calculatedTax=_shopdetail.parseTodecimal(e.ActualPrice*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_shopdetail.ApplyMultipleTax(e.ActualPrice,e),e.discount=_shopdetail.parseTodecimal(e.discount+e.productDisc,2)}else e.PromotionID=0;0===e.ActualPrice&&0!=e.isGCApply&&(e.isGCApply=!1)}else if(1==e.IsInitialDiscount){var i=0;i=1==e.IsAmountForInitialDiscount?e.InitialDiscount:_shopdetail.parseTodecimal(e.Price*e.InitialDiscount/100,2),e.productDisc=i,e.Price=e.Price,i>e.Price?e.ActualPrice=0:e.ActualPrice=_shopdetail.parseTodecimal(e.Price-i,2),e.calculatedTax=_shopdetail.parseTodecimal(e.ActualPrice*e.Tax/100,3),e.ActualTax=e.calculatedTax,e.BusinessTax=_shopdetail.ApplyMultipleTax(e.ActualPrice,e),e.discount=_shopdetail.parseTodecimal(e.discount+e.productDisc,2)}})}},_shopdetail.SuggestUpsellNoThankClick=function(){istipchanges=!0,nothanksselected||(nothanksselected=!0,e("#divSuggestUpsell").find(".vg-filter-mobile-tab").removeClass("w--current"),e("#divSuggestUpsell").find(".vg-switch-tab-first").addClass("w--current"),_shopdetail.RemoveMembershipUpSellDiscount(3),e('div[id^="divAddonMem_"]').html(""),e('div[id^="divAddonPack_"]').html(""),e('div[id^="divAddonPoint_"]').html(""),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){_shopdetail.ResetAddonsItemsDiscounts(e)}),_shopdetail.CallSuccess_SetBookData(_shopdetail.BookingDetail.UserResponse),"undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell&&_shopdetail.ReApplyDiscounts())},_shopdetail.GetAddOnDetailByProvider=function(t,i,a,r){var o=i,n=1;i=""==i||null==i||isNaN(i)?0:i,void 0===_shopdetail.localData.SelectedAddonsList||0==_shopdetail.localData.SelectedAddonsList.length?o=0:n=0;var s={ServiceId:parseInt(t),BusinessID:parseInt(businessID),ServiceProviderID:parseInt(o),IsOnline:n,LastMinDealHours:LastMinuteBookingDays},l=new vagaro.ajax;l.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAddOnService,groupID),l.datamodel.data=s,l.datamodel.IsNewVagaroAPI=!0,l.datamodel.async=!1,l.datamodel.callback=function(r){if(1e3==r.ResponseCode&&r.Data.length>0&&null!=r.Data[0]&&(_shopdetail.localData.AddonsList=r.Data,_shopdetail.localData.SelectedAddonsList=r.Data,void 0!==_shopdetail.localData.SelectedAddonsList&&_shopdetail.localData.SelectedAddonsList.length>0&&null!=_shopdetail.localData.SelectedAddonsList[0])){var o=e.grep(_shopdetail.localData.SelectedAddonsList,function(e){return e.ServiceProviderID==parseInt(i)&&e.MainServiceId==parseInt(t)});_shopdetail.SetAddondata(a,o)}},l.datamodel.Error=_common.CallFailed,l.Post()},_shopdetail.SetAddondata=function(t,i){var a=e.extend(!0,[],t.lstAddonService);t.lstAddonService=[],e.each(a,function(a,r){var o=e.grep(i,function(e){return e.ServiceId==r.ServiceId});r={};if(null!=o.length&&o.length>0){r.ServiceTitle=o[0].ServiceTitle,r.ServiceId=o[0].ServiceId,r.ParentServiceID=o[0].ParentServiceID,r.ServiceDesc=o[0].ServiceDesc,r.Duration=o[0].Duration,r.PointGiven=o[0].PointGiven,r.PointRedeem=o[0].PointRedeem,r.Taxes=o[0].Taxes,r.TaxesValues=o[0].TaxesValues,"undefiend"!=typeof o[0].IsShowPriceOnline&&(r.IsShowPriceOnline=o[0].IsShowPriceOnline);var n=e.grep(_shopdetail.localData.AddonsList,function(e){return 1==e.ServiceLevel&&e.ServiceId==o[0].ServiceId});if(n.length>0&&(r.BusinessTax=n[0].BusinessTax),r.ApplyDiscoutType=ApplyDiscoutTypePrepay.NoDiscount,r.redeemAmount=0,r.redeemTax=0,r.Discount=0,r.VisitRemaining=0,r.Visit=0,r.priceOriginal=_shopdetail.parseTodecimal(o[0].Price,2),r.GCDetail=[],r.GCDetailPriceBase=[],r.IsServiceBaseGC=!1,r.paidType=arrpaidType.UnPaid,r.DiscountID=0,r.depositsPaid=0,r.depositsPercentage=0,r.payableAmount=r.Price,r.pointgivenOriginal=r.PointGiven,r.pointredeemOriginal=r.PointRedeem,r.IsPartialPoint=!1,r.IsDepositsOver=!1,r.AddonPointPrice=0,r.IsDepositsAmountPaid=!1,r.ResOccurs=String.isNullOrUndefineOrBlank(o[0].ResOccurs)?0:o[0].ResOccurs,null!=o[0].PromotionDetail&&""!=o[0].PromotionDetail){var s=_shopdetail.GetSlotLastMinuteFlag(o[0].MainServiceId,o[0].ServiceProviderID),l=_shopdetail.GetAddonDailyDealData(o[0].PromotionDetail,o[0].Price,o[0].ServiceId,o[0].ServiceProviderID,!1,r.BusinessTax,s);l.PromotionID>0?(r.IsDealApplied=!0,r.PromotionID=l.PromotionID,r.NewPrice=l.NewPrice,r.Price=_shopdetail.parseTodecimal(r.NewPrice,2),r.OriginalPrice=_shopdetail.parseTodecimal(o[0].Price,2)):(r.IsDealApplied=!1,r.PromotionID=0,r.NewPrice=0,r.Price=_shopdetail.parseTodecimal(o[0].Price,2))}else r.IsDealApplied=!1,r.PromotionID=0,r.NewPrice=0,r.Price=_shopdetail.parseTodecimal(o[0].Price,2)}t.lstAddonService.push(r)})},_shopdetail.SetAddOnPopup=function(t,i,a,r,o,n,s,l,d,c,u,p,h,m){n=unescape(unescape(n));var f=1!=r||1!=m&&1!=m&&"true"!=m?"":"Starting at ",g=_shopdetail.GetSlotLastMinuteFlag(i,a);_shopdetail.ShowAddOnService(),_shopdetail.localData.AddonsList=t,e(_shopdetail.Controls.AddOnList).empty(),e(_shopdetail.Controls.ParentService).empty(),null==l||"null"==l||""==l?(e("#divServiceImage").css("display","none"),e(".addon-service-description").addClass("no-image-data")):(e("#divServiceImage").css("display","block"),e("#divServiceImage").css("background-image","url("+l+")"),e(".addon-service-description").removeClass("no-image-data")),e("#divServiceName").text(o),e("#divServiceDes").text(n);var v=_shopdetail.GetServiceDealDetailForAddons(i,s,null,h,g),A=!1,C=0;if(void 0!==v&&null!=v&&void 0!==v.Price&&(A=!0,C=v.Price),"$0.00"==s||"0.00"==s||"0"==s)1==p?(e("#divFreeServicePrice").css("display","block"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(s,2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(0,2).format("#.##")));else if(1==p){if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing==1&&void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(""!=h&&null!=h&&"0"!=h){let e=h.split(",");var y=[];if(e.length>0)for(var b=0;b<e.length;b++)y.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[b]).Tax);if(A){var S=parseFloat(C)*parseFloat(y.reduce((e,t)=>e+t,0)/100);C=_shopdetail.ConvertDecimalCustomRound(parseFloat(C)+S,!0,2)}var k=y.reduce((e,t)=>e+t,0);s=CalAccPriceWithTax(s,k)}}A?(e("#divFreeServicePrice").css("display","none"),e("#divOldServicePrice").css("display","block"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(f+_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(C,2).format("#.##")),e("#divOldServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(s,2).format("#.##"))):(e("#divFreeServicePrice").css("display","none"),e("#divOldServicePrice").css("display","none"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(f+_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(s,2).format("#.##")))}else e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(0,2).format("#.##"));e("#hdnServiceId").val(i),e("#hdnEventType").val(r),e("#hdnSrNo").val(d),e("#divSuggestedAddon").text("Suggested Add-Ons Available"),e("#hdnServicebundleName").val("");var D=e.grep(_shopdetail.localData.AddonsList,function(e){return 0==e.ServiceLevel});e.each(D,function(t){var i=e.grep(_shopdetail.localData.AddonsList,function(e){return e.Price=_onlineCheckout.parseTodecimal(e.Price,2),e.ParentServiceID==D[t].ServiceId});D[t].MinItem=D[t].MinItem>i.length?i.length:D[t].MinItem,D[t].MaxItem=D[t].MaxItem>i.length?i.length:D[t].MaxItem,i=i.map(function(e){if(e.IsRequired=D[t].IsRequired,e.MinItem=D[t].MinItem,e.MaxItem=D[t].MaxItem,e.Photo=e.Photo.indexOf("no-shop-image-big.")>0?"":e.Photo,e.CurrencySymbol=_shopdetail.currencySymbol,e.OnlinePrice=1==e.IsShowPriceOnline?e.Price:"0.00",e.OnlinePricewithtax=1==e.IsShowPriceOnline?e.Price:"0.00",e.IsIncludeTaxInOnlinePricing=!1,e.NewPricewithTax=e.Price,null!=e.PromotionDetail&&""!=e.PromotionDetail){var i=_shopdetail.GetAddonDailyDealData(e.PromotionDetail,e.OnlinePrice,e.ServiceId,a,!1,e.BusinessTax,g);i.PromotionID>0?(e.IsDealApplied=!0,e.PromotionID=i.PromotionID,e.NewPrice=i.NewPrice,e.NewPricewithTax=e.NewPrice):(e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0)}else e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0;try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&(e.IsIncludeTaxInOnlinePricing=!0,void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues&&null!=e.BusinessTax&&""!=e.BusinessTax)){if(null!=e.PromotionDetail&&""!=e.PromotionDetail){var r,o=parseFloat(e.NewPricewithTax)*parseFloat(e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0)/100);r=_shopdetail.ConvertDecimalCustomRound(parseFloat(e.NewPricewithTax)+o,!0,2),e.NewPricewithTax=r}var n=e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0);e.OnlinePricewithtax=CalAccPriceWithTax(e.Price,n)}}catch(e){}return e}),_shopdetail.CreateNoneOTAboveObject(i),e(_shopdetail.Controls.tmplAddOnCategory).tmpl(D[t]).appendTo(_shopdetail.Controls.AddOnList),e(_shopdetail.Controls.tmplAddOnService).tmpl(i).appendTo("#Service_"+i[0].ParentServiceID),e(".modal:visible").each(function(e,t){centerModal(t)})}),_shopdetail.BindSelectedAddon(i,d,a),_shopdetail.CheckboxAddOnService(),2==t.length?e(".addon-group-row1").css("border-bottom","none"):e(".addon-group-row1").css("border-bottom","solid #E7E7E7 1px"),e("#btnClose").css("display","none"),e("#btnback").css("display","none"),e(".classfooter-btn-row").addClass("backremove"),e("#btnNext").css("display","none"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&_shopdetail.VisibleControlLength("#mobile-check")>0==1&&"Back"==e("#btnback").html()&&"Next"==e("#btnNext").html()&&e("#servicenamepopup").removeClass("single-button"),e("#btnContinue").css("display","block");var _=ReplaceSpecialCharacters(n);e("#btnContinue").attr("onclick","_shopdetail.AddAddOnServiceDetail("+i+","+d+","+a+",'"+l+"','"+_+"','"+ReplaceSpecialCharacters(o)+"',"+c+");");var I=e.grep(t,function(e){return 1==e.IsRequired});void 0!==I&&null!=I&&I.length>0?e("#addonspopupclose").attr("style","display: none !important"):e("#addonspopupclose").show(),1==c&&e("#addonspopupclose").show()},_shopdetail.GetSlotLastMinuteFlag=function(e,t){if(void 0!==LastMinuteBookedMap&&null!=LastMinuteBookedMap&&null!=e&&""!==e){var i=e+"_"+t;if(void 0!==LastMinuteBookedMap[i])return LastMinuteBookedMap[i];var a=e+"_";for(var r in LastMinuteBookedMap)if(0===r.indexOf(a))return LastMinuteBookedMap[r]}},_shopdetail.GetAddonDealFromPromotionList=function(t,i,a,r,o){var n={PromotionID:0,NewPrice:0};if(void 0===PromotionDetails||null==PromotionDetails||""==PromotionDetails)return n;var s=null!=t?t.toString():"",l=null==a||""===a||","===a||",,"===a?null:a.toString(),d=e("#txtdivSearchDate").length>0?getdatepickervalue("#txtdivSearchDate",null,!0,!0):null;d=null==d?new Date:d;var c=getCookie("Referral"),u=void 0!==c&&""!=c&&null!=c&&null!=c,p=jQuery.grep(PromotionDetails,function(e){if(null==e.ServiceIDs||e.ServiceIDs.split(",").indexOf(s)<0)return!1;var t=0==IsForNewCustomer&&(0==UserID||""==UserID)||""==e.CustomerFilters||e.CustomerFilters.indexOf(1)>=0&&0==IsForNewCustomer||e.CustomerFilters.indexOf(2)>=0&&1==IsForNewCustomer,i=null==e.ServiceProviderIDs||null==l||"0"==l||e.ServiceProviderIDs.split(",").indexOf(l)>=0,a=new Date(d.getFullYear(),d.getMonth(),d.getDate())>=new Date(e.strStartDate)&&(""==e.strEndDate||new Date(d.getFullYear(),d.getMonth(),d.getDate())<=new Date(e.strEndDate)),r=!!u||!e.IsDailyDealApply;return t&&i&&a&&r});if(0==r&&(p=jQuery.grep(p,function(e){return e.IsLastMinuteBooked==r})),0==p.length)return n;for(var h=parseFloat(i),m=-1,f=-1,g=null,v=0,A=0;A<p.length;A++){var C=null,y=0;if(null!=p[A].PromotionServiceInfo)for(var b=p[A].PromotionServiceInfo.split(","),S=0;S<b.length;S++)if(s==b[S].split("-")[0]){C=b[S].split("-")[1],y=Number(b[S].split("-")[2]);break}if(0==y&&null!=p[A].PromotionDiscount&&(y=Number(p[A].PromotionDiscount)),y>0){var k="function"==typeof getDealSavings?getDealSavings(C,y,h):y;k>f&&(f=k,m=A,g=C,v=y)}}if(m<0)return n;null==g&&(g=2==p[m].DealDiscountAmtType?"0":"1");var D=h,_="0";if("0"==g)D=h-h*v/100;else{var I=v;if("2"==g&&(I=h-v)<0&&(I=0),I<0&&(I=h),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&null!=o&&""!=o){var w=o.map(function(e){return e.Tax}).reduce(function(e,t){return e+t},0);I=Math.floor(parseFloat(I)/(1+w/100)*100)/100}D=h-I,_="1"}return D<0&&(D=0),D=Math.floor(100*D)/100,n.PromotionID=p[m].PromotionID,n.NewPrice=D,n.Discount=v,n.IsAmount=_,n},_shopdetail.GetAddonDailyDealData=function(t,i,a,r,o,n,s){if(void 0!==s&&null!=s)return _shopdetail.GetAddonDealFromPromotionList(a,i,r,s,n);var l,d={},c=getCookie("Referral");if(void 0!==c&&""!=c?lstDetail=jQuery.grep(PromotionDetails,function(e){return e.ServiceIDs.indexOf(a)>=0&&(null==e.ServiceProviderIDs||0==r||e.ServiceProviderIDs.indexOf(r))>=0}):(lstDetail=jQuery.grep(PromotionDetails,function(e){return e.ServiceIDs.split(",").indexOf(a.toString())>=0&&(null==e.ServiceProviderIDs||"0"==r||e.ServiceProviderIDs.split(",").indexOf(r.toString())>=0)&&!e.IsDailyDealApply}),lstDetail=lstDetail.filter(e=>1!=e.IsDailyDealApply)),null!=lstDetail&&lstDetail.length>0||1==o){if(null!=(l=null!=lstDetail&&lstDetail.length>0?t.split("|~~|"):null)&&l.length>0){SearchDate=e("#txtdivSearchDate").length>0?getdatepickervalue("#txtdivSearchDate",null,!0,!0):null,SearchDate=null==SearchDate?new Date:SearchDate;var u=l[0].split("-"),p=new Date(l[2]),h=""!=l[3]?new Date(l[3]):"";if(new Date(SearchDate.getFullYear(),SearchDate.getMonth(),SearchDate.getDate())>=new Date(p.getFullYear(),p.getMonth(),p.getDate())&&(""==h||new Date(SearchDate.getFullYear(),SearchDate.getMonth(),SearchDate.getDate())<=new Date(h.getFullYear(),h.getMonth(),h.getDate()))&&null!=u&&u.length>0)if(d.PromotionID=u[0],d.IsAmount=u[1],d.Discount=u[2],d.PerUserOne=u[3],d.PerTransactionOne=u[4],"1"==d.IsAmount){if(void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()&&null!=n&&""!=n){var m=1+n.map(e=>e.Tax).reduce((e,t)=>e+t,0)/100,f=parseFloat(d.Discount)/m;f=Math.floor(100*f)/100,d.Discount=f}d.NewPrice=parseFloat(i)-parseFloat(d.Discount),d.NewPrice=Math.floor(100*d.NewPrice)/100}else{var g=parseFloat(i)*parseFloat(d.Discount)/100;d.NewPrice=parseFloat(i)-g,d.NewPrice=Math.floor(100*d.NewPrice)/100}}}else d.PromotionID=0,d.NewPrice=0;return d},_shopdetail.GetServiceDealDetailForAddons=function(t,i,a,r,o){var n=[];if(a=null==a||""==a||","==a||",,"==a?null:a,void 0!==PromotionDetails&&null!=PromotionDetails&&""!=PromotionDetails){var s=getCookie("Referral");n=void 0!==s&&""!=s?jQuery.grep(PromotionDetails,function(e){return e.ServiceIDs.indexOf(t)>=0}):jQuery.grep(PromotionDetails,function(e){return e.ServiceIDs.indexOf(t)>=0&&!e.IsDailyDealApply})}if(void 0!==o&&null!=o&&n.length>0){var l=e("#txtdivSearchDate").length>0?getdatepickervalue("#txtdivSearchDate",null,!0,!0):null;if(l=null==l?new Date:l,(n=jQuery.grep(n,function(e){var t=new Date(l.getFullYear(),l.getMonth(),l.getDate())>=new Date(e.strStartDate)&&(""==e.strEndDate||new Date(l.getFullYear(),l.getMonth(),l.getDate())<=new Date(e.strEndDate)),i=0!=o||e.IsLastMinuteBooked==o;return t&&i})).length>1){for(var d=0,c=-1,u=0;u<n.length;u++){var p=null,h=0;if(null!=n[u].PromotionServiceInfo)for(var m=n[u].PromotionServiceInfo.split(","),f=0;f<m.length;f++)if(t==m[f].split("-")[0]){p=m[f].split("-")[1],h=Number(m[f].split("-")[2]);break}0==h&&null!=n[u].PromotionDiscount&&(h=Number(n[u].PromotionDiscount));var g="function"==typeof getDealSavings?getDealSavings(p,h,i):h;g>c&&(c=g,d=u)}if(d>0){var v=n[0];n[0]=n[d],n[d]=v}}}if(n.length>0){if(obj=jQuery.extend(!0,{},n[0]),SearchDate=e("#txtdivSearchDate").length>0?getdatepickervalue("#txtdivSearchDate",null,!0,!0):null,SearchDate=null==SearchDate?new Date:SearchDate,new Date(SearchDate.getFullYear(),SearchDate.getMonth(),SearchDate.getDate())>=new Date(obj.strStartDate)&&(""==obj.strEndDate||new Date(SearchDate.getFullYear(),SearchDate.getMonth(),SearchDate.getDate())<=new Date(obj.strEndDate))){if(null!=obj.PromotionID&&(null!=obj.PromotionDiscount||null!=obj.ServiceOldPrice)&&i>0){var A=[];A=obj.PromotionServiceInfo.split(",");for(var C={},y=0;y<A.length;y++)if(t==A[y].split("-")[0]){C.oldprice=A[y].split("-")[1],C.promodiscount=A[y].split("-")[2];break}var b=Number(C.promodiscount);if("0"==C.oldprice)obj.Price=(i-i*b/100).toFixed(2);else{if("2"==C.oldprice&&(b=i-obj.PromotionDiscount)<0&&(b=0,obj.PromotionID=0),b<0&&(b=i),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()){if(""!=r&&null!=r&&"0"!=r){let e=r.split(",");var S=[];if(e.length>0)for(y=0;y<e.length;y++)S.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[y]).Tax);var k=S.reduce((e,t)=>e+t,0);b=parseFloat(ConvertTodecimalMorePrecious(parseFloat(b)/(1+k/100),!0,4))}}obj.Price=Number(i-b).toFixed(2)}obj.Price<0&&(obj.Price=0)}else obj.Price=Number(i).toFixed(2),obj.PromotionID=0;return obj}return null}return n},_shopdetail.SetBundleAddOnPopup=function(t,i,a,r,o,n,s,l,d,c,u,p){_shopdetail.ShowAddOnService();var h=_shopdetail.GetSlotLastMinuteFlag(i,a);_shopdetail.localData.AddonsList=t,e(_shopdetail.Controls.AddOnList).empty(),e(_shopdetail.Controls.ParentService).empty(),null==l||"null"==l||""==l?(e("#divServiceImage").css("display","none"),e(".addon-service-description").addClass("no-image-data")):(e("#divServiceImage").css("display","block"),e("#divServiceImage").css("background-image","url("+l+")"),e(".addon-service-description").removeClass("no-image-data")),e("#divServiceName").text(e("#hdnServicebundleName").val()),e("#divServiceDes").text(n),e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(s,2).format("#.##")),e("#hdnServiceId").val(i),e("#hdnEventType").val(r),e("#hdnSrNo").val(c),e("#divSuggestedAddon").text("Service "+c+" Suggested Add-Ons : "+o),e(".modal-body.grayscrollbar").scrollTop(0);var m=_shopdetail.GetServiceDealDetailForAddons(i,s,null,p,h),f=!1,g=0;if(void 0!==m&&null!=m&&void 0!==m.Price&&(f=!0,g=m.Price),"$0.00"==s||"0.00"==s||"0"==s)1==u?(e("#divFreeServicePrice").css("display","block"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(s,2).format("#.##")),e("#divOldServicePrice").css("display","none")):(e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divOldServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(s,2).format("#.##")));else if(1==u){if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues){if(""!=p&&null!=p&&"0"!=p){let e=p.split(",");var v=[];if(e.length>0)for(var A=0;A<e.length;A++)v.push(JSON.parse(_shopdetail.TaxesValues).Taxes.find(t=>t.BusinessTaxID==e[A]).Tax);var C=parseFloat(s)*parseFloat(v.reduce((e,t)=>e+t,0)/100);if(s=parseFloat(s)+C,f){var y=v.reduce((e,t)=>e+t,0);g=CalAccPriceWithTax(g,y)}}}f?(e("#divFreeServicePrice").css("display","none"),e("#divOldServicePrice").css("display","block"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(g,2).format("#.##")),e("#divOldServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(s,2).format("#.##")),s=g):(e("#divFreeServicePrice").css("display","none"),e("#divOldServicePrice").css("display","none"),e("#divServicePrice").css("display","block"),e("#divServicePrice").text(_shopdetail.currencySymbol+_onlineCheckout.parseTodecimal(s,2).format("#.##")))}else e("#divFreeServicePrice").css("display","none"),e("#divServicePrice").css("display","none"),e("#divServicePrice").text(_onlineCheckout.parseTodecimal(0,2).format("#.##"));var b=e.grep(_shopdetail.localData.AddonsList,function(e){return 0==e.ServiceLevel});e.each(b,function(t){var i=e.grep(_shopdetail.localData.AddonsList,function(e){return e.Price=_onlineCheckout.parseTodecimal(e.Price,2),e.ParentServiceID==b[t].ServiceId});b[t].MinItem=b[t].MinItem>i.length?i.length:b[t].MinItem,b[t].MaxItem=b[t].MaxItem>i.length?i.length:b[t].MaxItem,i=i.map(function(e){if(e.IsRequired=b[t].IsRequired,e.MinItem=b[t].MinItem,e.MaxItem=b[t].MaxItem,e.Photo=e.Photo.indexOf("no-shop-image-big.")>0?"":e.Photo,e.CurrencySymbol=_shopdetail.currencySymbol,e.OnlinePrice=1==e.IsShowPriceOnline?e.Price:"0.00",e.OnlinePricewithtax=1==e.IsShowPriceOnline?e.Price:"0.00",e.IsIncludeTaxInOnlinePricing=!1,e.NewPricewithTax=e.Price,null!=e.PromotionDetail&&""!=e.PromotionDetail){var i=_shopdetail.GetAddonDailyDealData(e.PromotionDetail,e.OnlinePrice,e.ServiceId,a,!1,e.BusinessTax,h);i.PromotionID>0?(e.IsDealApplied=!0,e.PromotionID=i.PromotionID,e.NewPrice=i.NewPrice,e.NewPricewithTax=e.NewPrice):(e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0)}else e.IsDealApplied=!1,e.PromotionID=0,e.NewPrice=0;try{if(void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.IsIncludeTaxInOnlinePricing&&null!=_shopdetail.IsIncludeTaxInOnlinePricing&&1==_shopdetail.IsIncludeTaxInOnlinePricing&&(e.IsIncludeTaxInOnlinePricing=!0,void 0!==_shopdetail&&null!=_shopdetail&&void 0!==_shopdetail.TaxesValues&&""!=_shopdetail.TaxesValues&&null!=_shopdetail.TaxesValues&&""!=e.BusinessTax&&null!=e.BusinessTax&&null!=e.BusinessTax&&""!=e.BusinessTax)){if(null!=e.PromotionDetail&&""!=e.PromotionDetail){var r,o=parseFloat(e.NewPricewithTax)*parseFloat(e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0)/100);r=parseFloat(e.NewPricewithTax)+o,e.NewPricewithTax=r}var n=e.BusinessTax.map(e=>e.Tax).reduce((e,t)=>e+t,0);e.OnlinePricewithtax=CalAccPriceWithTax(e.Price,n)}}catch(e){}return e}),_shopdetail.CreateNoneOTAboveObject(i),e(_shopdetail.Controls.tmplAddOnCategory).tmpl(b[t]).appendTo(_shopdetail.Controls.AddOnList),e(_shopdetail.Controls.tmplAddOnService).tmpl(i).appendTo("#Service_"+i[0].ParentServiceID),e(".modal:visible").each(function(e,t){centerModal(t)})}),_shopdetail.BindSelectedAddon(i,c),_shopdetail.CheckboxAddOnService(),e("#btnClose").css("display","None"),e("#btnback").css("display","block"),"undefined"!=typeof vgAppicationType&&1==vgAppicationType&&_shopdetail.VisibleControlLength("#mobile-check")>0==1&&"Back"==e("#btnback").html()&&"Next"==e("#btnNext").html()&&e("#servicenamepopup").addClass("single-button"),e(".classfooter-btn-row").removeClass("backremove"),e("#btnback").attr("onclick","CheckBackService("+IsBackAddOnCount+",'"+l+"','"+ReplaceSpecialCharacters(n)+"',"+u+");"),d+=1,e("#btnContinue").css("display","None"),e("#btnNext").css("display","block"),null!=AddonServiceBundleDetail&&""!=AddonServiceBundleDetail&&AddonServiceBundleDetail.length>0&&(n=ReplaceSpecialCharacters(n),1==d?e("#btnNext").attr("onclick","CheckNextService("+d+","+AddonServiceBundleDetail[0].serviceId+",1,"+a+",'"+l+"','"+n+"',"+u+", '"+AddonServiceBundleDetail[0].Taxes+"');"):2==d?e("#btnNext").attr("onclick","CheckNextService("+d+","+AddonServiceBundleDetail[1].serviceId+",2,"+a+",'"+l+"','"+n+"',"+u+", '"+AddonServiceBundleDetail[1].Taxes+"');"):3==d?e("#btnNext").attr("onclick","CheckNextService("+d+","+AddonServiceBundleDetail[2].serviceId+",3,"+a+",'"+l+"','"+n+"',"+u+", '"+AddonServiceBundleDetail[2].Taxes+"');"):4==d?e("#btnNext").attr("onclick","CheckNextService("+d+","+AddonServiceBundleDetail[3].serviceId+",4,"+a+",'"+l+"','"+n+"',"+u+", '"+AddonServiceBundleDetail[3].Taxes+"');"):5==d?e("#btnNext").attr("onclick","CheckNextService("+d+","+AddonServiceBundleDetail[4].serviceId+",5,"+a+",'"+l+"','"+n+"',"+u+", '"+AddonServiceBundleDetail[4].Taxes+"');"):6==d&&e("#btnNext").attr("onclick","CheckNextService("+d+","+AddonServiceBundleDetail[5].serviceId+",6,"+a+",'"+l+"','"+n+"',"+u+", '"+AddonServiceBundleDetail[5].Taxes+"');"))},_shopdetail.ApplyMembershipOnAddon=function(t,i,a){null!=i&&i.length>0&&a.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&a.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&e.each(i,function(e,i){if(i.ServiceProductName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&new Date(moment(i.strValidUpto).format("YYYY/MM/DD"))<new Date(t.appBookingDate)&&null!=i.strAdvanceLimitDate&&""!=i.strAdvanceLimitDate&&new Date(moment(i.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(t.appBookingDate)&&(null==i.strAdvanceLimitDate||""==i.strAdvanceLimitDate||void 0!==a.AppliedName&&""!=a.AppliedName||1==a.IsPackageApplied||(a.strAdvanceLimitDate=i.strAdvanceLimitDate,a.IsPackageApplied=!1,a.AppliedName=i.MembershipName)),(i.VisitRemaining>0||-1==i.VisitRemaining)&&i.ServiceProductName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&a.priceOriginal>0&&(0==a.PromotionID||1==i.isPromotionalDiscount&&0!=a.PromotionID)&&(null==i.strValidUpto||""==i.strValidUpto||null!=i.strValidUpto&&""!=i.strValidUpto&&new Date(moment(i.strValidUpto).format("YYYY/MM/DD"))>=new Date(t.appBookingDate))){var r=_shopdetail.GetMembershipParentGroupId(i),o=i.BusinessID+"_"+(r>0?"PG"+r:i.GroupId>0?i.GroupId:i.MembershipItemId);if(void 0===_shopdetail._addonMembershipGroupUsage[o]&&(_shopdetail._addonMembershipGroupUsage[o]=i.VisitRemaining),0===_shopdetail._addonMembershipGroupUsage[o])return;var n=_shopdetail.GetMembershipDiscountAmount(a.priceOriginal,i);return a.Price<n&&(n=a.Price),a.Discount=n,a.membershipDiscount=n,a.Price=_shopdetail.parseTodecimal(a.Price-a.Discount),i.VisitRemaining=-1==i.VisitRemaining?i.VisitRemaining:i.VisitRemaining-1,a.VisitRemaining=i.VisitRemaining,a.Visit=i.Visit,a.IsMembershipApply=!0,a.RedeemBusinessId=i.BusinessID,a.MembershipID=i.MembershipID,a.UserID=i.UserID,a.MembershipItemId=i.MembershipItemId,a.GroupId=i.GroupId,a.IsAllowPreSetDiscount=i.IsAllowPreSetDiscount,_shopdetail.SyncMembershipVisitRemaining(_shopdetail.BookingDetail.Prepay.lstMembership,i),-1!==_shopdetail._addonMembershipGroupUsage[o]&&_shopdetail._addonMembershipGroupUsage[o]--,_shopdetail.BindDiscountOnItems(!1,t.AppSrNo,!1,!1,0,!0,a.Price,!1,i.MembershipName,!1,a.ServiceId),!1}})},_shopdetail.ApplyPackageOnAddon=function(t,i,a,r){null!=i&&i.length>0&&e.grep(i,function(o,n){if(o.serviceName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&new Date(moment(o.strValidUpto).format("YYYY/MM/DD"))<new Date(t.appBookingDate)&&null!=o.strAdvanceLimitDate&&""!=o.strAdvanceLimitDate&&new Date(moment(o.strAdvanceLimitDate).format("YYYY/MM/DD"))>=new Date(t.appBookingDate)&&(t.strAdvanceLimitDate=o.strAdvanceLimitDate,t.IsPackageApplied=!0,t.AppliedName=o.pkgName),o.serviceName.toLowerCase().trim()==a.ServiceTitle.toLowerCase().trim()&&(o.quantity>0||1==o.isCustomPackage&&-1==o.quantity)&&a.Price>0&&(null==o.strValidUpto||""==o.strValidUpto||null!=o.strValidUpto&&""!=o.strValidUpto&&new Date(moment(o.strValidUpto).format("YYYY/MM/DD"))>=new Date(t.appBookingDate))){var s,l=0,d=[];if(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount)1==o.isCustomPackage?d=e.grep(i,function(e){if(1==e.isCustomPackage&&null==e.serviceID&&e.giftCertificateID==o.giftCertificateID)return l=0==e.quantity?0:Math.floor(_shopdetail.parseTodecimal(e.currentBalance/e.quantity*100))/100,!0}):l=Math.floor(_shopdetail.parseTodecimal(o.currentBalance/o.quantity*100))/100,-1==o.quantity&&(l=0),objGC={},objGC.giftcertificateId=o.giftCertificateID,objGC.giftCertificateNo=o.giftCertificateNo,objGC.serviceId=a.ServiceId,objGC.uniqID=a.SerialNo,objGC.AppointmentID=0,objGC.Type=CheckoutBarcodeCodePrepay.Pkg,objGC.GCredeemAmtForDisc=0,objGC.redeemAmt=l,e.each(filpkglist,function(t,i){i.giftCertificateID==o.giftCertificateID&&i.serviceName===a.ServiceTitle&&(s=i.quantity,e.each(filpkglist,function(e,t){1==t.isCustomPackage?t.giftCertificateID==o.giftCertificateID&&""===t.serviceName&&(t.quantity=-1==t.quantity?-1:-1==s?t.quantity:t.quantity-1,s=t.quantity-t.TotalPKGUnlimitedCount):t.giftCertificateID==o.giftCertificateID&&t.serviceName===a.ServiceTitle&&(t.quantity=-1==t.quantity?-1:t.quantity-1,s=t.quantity)}))}),objGC.GcPkgType=3,objGC.gcAfterbalance=s,1==o.isCustomPackage&&void 0!==o.serviceID&&o.serviceID>0&&(objGC.RedeemServiceId=o.serviceID),_shopdetail.BookingDetail.Prepay.RedeemedByGC.push(objGC),1==o.isCustomPackage?(null!=o.groupID&&0!=o.groupID&&-1!=o.quantity?e.grep(i,function(e){e.giftCertificateID==o.giftCertificateID&&e.groupID==o.groupID&&(e.quantity=e.quantity-1)}):null==o.groupID&&-1!=o.quantity&&(o.quantity=o.quantity-1),d.length>0&&-1!=o.quantity&&(d[0].currentBalance=_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(d[0].currentBalance)-l),d[0].quantity=d[0].quantity-1)):(o.currentBalance=_shopdetail.parseTodecimal(_shopdetail.parseTodecimal(o.currentBalance)-l),o.quantity=o.quantity-1),_shopdetail.BindDiscountOnItems(!1,r,!1,!0,l,!1,0,!1,o.pkgName,!1,a.ServiceId),a.redeemID=o.giftCertificateID,a.ApplyDiscoutType=ApplyDiscoutTypePrepay.Package,a.pointgiven=0,a.pointredeem=0,a.price=a.Price=l,a.GCDetail.push(objGC),a.redeemAmount=l,_shopdetail.BookingDetail.Prepay.PackageAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.PackageAmt+l)}})},_shopdetail.CalculateAddonServicePrice=function(e,t){var i=e.pointredeemOriginal,a=e.priceOriginal*t/i;return _vgClassSessionSelection.ConvertTodecimal(a,2)},_shopdetail.CalculateAddonPointGiven=function(e,t){var i=e.priceOriginal,a=e.pointgivenOriginal;return Math.round(t*a/i)},_shopdetail.ApplyPointsOnAddon=function(e,t,i,a){if(t.pointsBalance>0){var r=_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem();if(i.Price>0&&!r){var o=i.PointRedeem;if(i.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&o>0&&t.pointsBalance>=o&&t.pointsBalance>0){t.pointsBalance=parseInt(t.pointsBalance-o),i.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,i.OriginalPrice=i.Price,i.IsPointsApply=!0,i.Price=0,i.depositsPaid=0,i.depositsPercentage=0,i.paidType=arrpaidType.Paid;var n=i.OriginalPrice;_shopdetail.BindDiscountOnItems(!1,a,!0,!1,0,!1,0,!1,"",!1,i.ServiceId,n,o,void 0)}else if(IsPartialPointAllowed&&i.ApplyDiscoutType==ApplyDiscoutTypePrepay.NoDiscount&&o>0&&t.pointsBalance>0){var s="0.00";o==t.pointsBalance&&(o=i.pointredeemOriginal);var l=parseInt(o-t.pointsBalance);i.PointRedeem=parseInt(t.pointsBalance),i.OriginalPrice=i.Price;n="0.00";if(n=i.OriginalPrice,1==_shopdetail.BookingDetail.DepositAmtType){var d=_shopdetail.calculatedDepositsAmount(i.OriginalPrice);i.depositsPercentage=d;var c=_shopdetail.GetDepositsAmount(i.OriginalPrice,d);if((m=Math.ceil(i.pointredeemOriginal*c/parseFloat(i.OriginalPrice)))>t.pointsBalance){i.PointRedeem=t.pointsBalance;var u=parseFloat(_onlineCheckout.CalculateApplyPointsClassPrice(i.OriginalPrice,i.PointRedeem,i.pointredeemOriginal)),p=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.DepositsPer-u);i.depositsPaid=p,i.paidType=100==i.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,i.IsDepositsOver=!1,i.IsDepositsAmountPaid=!0,i.AddonPointPrice=u,i.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,n=_shopdetail.parseTodecimal(i.OriginalPrice-i.AddonPointPrice)}else i.PointRedeem=m,i.depositsPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.DepositsPer-c),i.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,i.IsDepositsOver=!0,i.IsDepositsAmountPaid=!0,i.AddonPointPrice=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.DepositsPer),i.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,n=_shopdetail.parseTodecimal(i.OriginalPrice-i.AddonPointPrice)}else if(0==_shopdetail.BookingDetail.DepositAmtType&&100!=_shopdetail.BookingDetail.DepositsPer&&i.OriginalPrice>0){var h=_shopdetail.calculatedDepositsAmount(i.OriginalPrice),m=Math.ceil(i.pointredeemOriginal*h/parseFloat(i.OriginalPrice));if(i.depositsPercentage=_shopdetail.BookingDetail.DepositsPer,m>t.pointsBalance){i.PointRedeem=t.pointsBalance;u=parseFloat(_onlineCheckout.CalculateApplyPointsClassPrice(i.OriginalPrice,i.PointRedeem,i.pointredeemOriginal)),p=_shopdetail.parseTodecimal(h-u);i.depositsPaid=p,i.paidType=100==i.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,i.IsDepositsOver=!1,i.IsDepositsAmountPaid=!0,i.AddonPointPrice=u,i.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,n=_shopdetail.parseTodecimal(i.OriginalPrice-i.AddonPointPrice)}else i.PointRedeem=m,i.depositsPaid=0,i.paidType=100==e.depositsPercentage?arrpaidType.Paid:arrpaidType.Deposits,i.IsDepositsOver=!0,i.IsDepositsAmountPaid=!0,i.AddonPointPrice=_shopdetail.parseTodecimal(h),i.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,n=_shopdetail.parseTodecimal(i.OriginalPrice-i.AddonPointPrice)}else s=_shopdetail.CalculateAddonServicePrice(i,l),i.Price=_shopdetail.parseTodecimal(s),i.ApplyDiscoutType=ApplyDiscoutTypePrepay.Points,i.paidType=arrpaidType.Paid;t.pointsBalance=parseInt(t.pointsBalance-i.PointRedeem),i.IsPointsApply=!0,i.PointGiven=0,i.IsPartialPoint=!0,100!=_shopdetail.BookingDetail.DepositsPer&&i.OriginalPrice>0?s=_shopdetail.parseTodecimal(i.OriginalPrice):(s=n,n=_shopdetail.CalculateAddonServicePrice(i,l)),_shopdetail.BindDiscountOnItems(!1,a,!0,!1,0,!1,0,!1,"",!1,i.ServiceId,s,i.PointRedeem,n)}}}},_shopdetail.ApplyAddOnPromoCodeService=function(t,i,a,r,o){var n,s=!1;return 1==r&&(n=_shopdetail.GetApplicableApptForOnePerUserForAddon(t)),e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(a){if((1==r&&void 0!==n&&a.AppSrNo==n.AppSrNo&&0==o||0==r)&&null!=SelectedAddonService&&SelectedAddonService.length>0&&null!=a.lstAddonService&&a.lstAddonService.length>0)for(var l=0;l<SelectedAddonService.length;l++)if(SelectedAddonService[l].MainServiceID==a.serviceid&&SelectedAddonService[l].SrNo==a.AppSrNo)for(var d=0;d<SelectedAddonService[l].lstAddonService.length;d++){var c=SelectedAddonService[l].lstAddonService[d];if(1!=r||null==n||null==c||null===c.ServiceId||void 0===c.ServiceId||null===n.ServiceId||void 0===n.ServiceId||c.ServiceId==n.ServiceId){var u=e.grep(t,function(e){return e.ServiceID==c.ServiceId&&19==e.ItemTypeID});if(null!=u&&u.length>0){u=u[0];var p=_shopdetail.ValidatePromoAndService(a,u);if(c.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||c.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||0==p);else if(0==c.Price&&c.PromotionId>0||c.Price>0){0!=c.PromotionId&&(c.price=c.priceOriginal,c.priceOriginal=c.priceOriginal,c.OriginalPrice=c.Price,c.PromotionId=0);var h=0;if(1==c.IsMembershipApply){var m=e.grep(_shopdetail.BookingDetail.Prepay.lstMembership,function(e){return e.MembershipID==c.MembershipID&&19==e.ItemType&&e.MembershipItemId==c.MembershipItemId});1==m[0].IsAllowPreSetDiscount?h=_shopdetail.parseTodecimal(c.priceOriginal*m[0].Discount/100):_shopdetail.RemoveDiscount(3,c.AppSrNo)}if(0==u.IsAmount)_onlineCheckout.parseTodecimal(c.priceOriginal*u.DiscountValue/100,2),h=_onlineCheckout.parseTodecimal(h+_onlineCheckout.parseTodecimal(c.priceOriginal*u.DiscountValue/100,2),2);else if(u.DiscountValue,h=c.priceOriginal<h+u.DiscountValue?c.priceOriginal:_onlineCheckout.parseTodecimal(h+u.DiscountValue,2),void 0!==_shopdetail&&null!=_shopdetail&&_shopdetail.CheckPriceWithTaxSwitch()){var f=0;null!=c.BusinessTax&&c.BusinessTax.length>0&&(f=c.BusinessTax.reduce((e,t)=>e+t.Tax,0)),h=parseFloat(ConvertTodecimalMorePrecious(parseFloat(h)/(1+f/100),!0,4))}c.priceOriginal<h&&(c.Price,h=c.Price),c.OriginalPrice=c.priceOriginal,c.Discount=h,c.Price=_shopdetail.parseTodecimal(c.priceOriginal-h),c.isPresetApply=!0,c.DiscountID=u.PromotionID,c.IsAmount=u.IsAmount,c.AmountValue=u.DiscountValue,s=!0,null!=c.GCDetailPriceBase&&c.GCDetailPriceBase.length>0&&0==c.Price&&_shopdetail.RemoveDiscount(2,c.AppSrNo),c.paidType==arrpaidType.Deposits&&_shopdetail.calculateDepositsPrepayforAddons(c),_shopdetail.BindDiscountOnItems(!1,a.AppSrNo,!1,!1,0,!1,c.Price,!0,i.toUpperCase(),!1,c.ServiceId)}}}}}),s},_shopdetail.GetApplicableApptForOnePerUserForAddon=function(t){var i,a=0,r=0;return e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(o){if(null!=SelectedAddonService&&SelectedAddonService.length>0&&null!=o.lstAddonService&&o.lstAddonService.length>0)for(var n=0;n<SelectedAddonService.length;n++)if(SelectedAddonService[n].MainServiceID==o.serviceid&&SelectedAddonService[n].SrNo==o.AppSrNo)for(var s=0;s<SelectedAddonService[n].lstAddonService.length;s++){var l=SelectedAddonService[n].lstAddonService[s],d=e.grep(t,function(e){return e.ServiceID==l.ServiceId&&(1==e.ItemTypeID||19==e.ItemTypeID)});if(null!=d&&d.length>0){d=d[0],void 0===l.AppSrNo&&(l.AppSrNo=o.AppSrNo);var c=_shopdetail.ValidatePromoAndService(l,d);l.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||l.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package||0==c||(r=0==d.IsAmount?_onlineCheckout.parseTodecimal(l.priceOriginal*d.DiscountValue/100,2):d.DiscountValue,l.priceOriginal<r&&(r=l.priceOriginal),r>a&&(a=r,i=l))}}}),_shopdetail.VPLCalculation(),i},_shopdetail.RemovePromoCodeAddonService=function(t){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){if(null!=SelectedAddonService&&SelectedAddonService.length>0&&null!=i.lstAddonService&&i.lstAddonService.length>0)for(var a=0;a<SelectedAddonService.length;a++)if(SelectedAddonService[a].MainServiceID==i.serviceid&&SelectedAddonService[a].SrNo==i.AppSrNo)for(var r=0;r<SelectedAddonService[a].lstAddonService.length;r++){var o=SelectedAddonService[a].lstAddonService[r],n=e.grep(_shopdetail.BookingDetail.lstPromotionData,function(e){return e.ServiceID==o.ServiceId&&e.PromotionID==t&&19==e.ItemTypeID});if(null!=n&&n.length>0&&(n=n[0],void 0!==o.isPresetApply&&1==o.isPresetApply&&o.DiscountID==t)){i.AppSrNo;e("#divAddPD_"+o.ServiceId+"_"+i.AppSrNo).html("");o.Price=o.OriginalPrice,o.isPresetApply=!1,o.isPresetApply=!1,o.DiscountID=0,o.Discount=0,o.AmountValue=0,o.IsAmount=!1,o.paidType==arrpaidType.Deposits&&_shopdetail.calculateDepositsPrepayforAddons(i),_shopdetail.BindDiscountOnItems(!1,i.AppSrNo,!1,!1,0,!1,o.Price,!1,"",!1,o.ServiceId),_shopdetail.ValidateVPl(!0)}}})},_shopdetail.BindSPAfterAddonSelect=function(t,i){_common.SetAddonForSeleect2(e("#txtService"+t),i);var a="#cboServiceProviderWaitlist_Search"+t,r=e(a+" > option").length+1!=e(a+" :selected").length&&0!=e(a+" :selected").length?e(a).val().join(","):"";r=r.split(","),BindServiceProviderWaitlist_Serachpopup("cboServiceProviderWaitlist_Search"+t,r)},_shopdetail.GetSelectedAddonsByService=function(t,i){var a=[];if(null!=SelectedAddonService&&null!=SelectedAddonService&&SelectedAddonService.length>0){var r=e.grep(SelectedAddonService,function(e){return e.MainServiceID==t&&e.SrNo==i});r.length>0&&(a=r[0].lstAddonService)}return a},_shopdetail.GetTotalAddonTipofAppointment=function(t){for(var i=0,a=0;a<t.length;a++)!String.isNullOrUndefineOrBlank(t[a].lstAddonService)&&t[a].lstAddonService.length&&e.each(t[a].lstAddonService,function(e,t){if(t.paidType==arrpaidType.Paid){var a=t.Price;1!=t.isPointApply&&t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Package&&1!=t.IsMembershipApply&&1!=t.isPresetApply||(a=t.priceOriginal),a=_onlineCheckout.parseTodecimal(a+_shopdetail.GetItemTipTax(t.Tax),2),i+=_onlineCheckout.parseTodecimal(a*_shopdetail.BookingDetail.TipPercent/100,2)}});return i},_shopdetail.IsUpSellDataExistswithCCOff=function(){return"undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell&&"false"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()},_shopdetail.BindAddonDataByBusinessId=function(){if(null==OnlindBookingResponse.lstAddonService){ShowLoader(!0);var e={BusinessID:1*businessID,LoginUserID:0,Device:"website(online)"},t=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetAllAddOnServiceByBusinessNew,groupID);_shopdetail.ajaxSync(t,e,function(e){String.isNullOrUndefineOrBlank(e)||e.ResponseCode!=vagaro.VagaroCoreApiResponseCode.Success||(OnlindBookingResponse.lstAddonService=e.Data)},function(){},!1,void 0,!0)}},_shopdetail.ajaxSync=function(e,t,i,a,r,o,n){var s=new vagaro.ajax;s.datamodel.Token=e,s.datamodel.data=t,s.datamodel.callback=i,s.datamodel.Error=a;var l="undefined"!=typeof businessID&&null!=businessID&&(195939==parseInt(businessID)||282254==parseInt(businessID)||307082==parseInt(businessID)),d="undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()&&"undefined"!=typeof businessID&&null!=businessID&&(156973===parseInt(businessID)||383713===parseInt(businessID)||377983===parseInt(businessID)||430616===parseInt(businessID)||400713===parseInt(businessID));s.datamodel.async=!(!l&&!d),void 0!==n&&null!=n&&1==n&&(s.datamodel.IsNewVagaroAPI=!0),void 0!==o&&1==o&&(s.datamodel.ErrorMessage=_checkout.Empty),r?s.PostQue():s.Post()},_shopdetail.CreateNoneOTAboveObject=function(e){if(0==e[0].IsRequired&&(1==e[0].MinItem&&1==e[0].MaxItem||0==e[0].MinItem&&1==e[0].MaxItem)){var t={};t.MinItem=e[0].MinItem,t.MaxItem=e[0].MaxItem,t.ServiceId=e[0].ServiceId+e[0].ParentServiceID,t.ParentServiceID=e[0].ParentServiceID,t.ServiceTitle="None of the above",t.ServiceDesc="",t.IsShowPriceOnline=!1,t.Photo="",t.Price=0,t.NewPrice=0,t.PromotionDetail="",t.IsNOTA=!0,e.push(t)}},_shopdetail.GetWidgetServicesDetail=function(e){var t={};if(1==("undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase())&&!isWidgetLoaded){var i={eventName:"WidgetLoaded",timestamp:(new Date).getTime(),data:null};"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(i),isWidgetLoaded=!0}t.WidgetServiceId=parseInt(_siteBuilderDetail.UserLocationInfo.objUserCustomData.WidgetServiceId);var a=new vagaro.ajax,r="undefined"!=typeof businessID&&null!=businessID&&(195939==parseInt(businessID)||282254==parseInt(businessID)||307082==parseInt(businessID)),o="undefined"!=typeof isWidget&&null!=isWidget&&"true"===isWidget.toString().toLowerCase()&&"undefined"!=typeof businessID&&null!=businessID&&(156973===parseInt(businessID)||383713===parseInt(businessID)||377983===parseInt(businessID)||430616===parseInt(businessID)||400713===parseInt(businessID));a.datamodel.async=!(!r&&!o),a.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken("widget/getwidgetservices",groupID),a.datamodel.IsNewVagaroAPI=!0,a.datamodel.data=t,a.datamodel.callback=function(t){null!=t.Data&&(_shopdetail.WidgetServicesDetail=t.Data),"function"==typeof e&&e()},a.datamodel.Error=function(t){"function"==typeof e&&e()},a.Post()},_shopdetail.ServicePromotionforNewCustomer=function(t){var i=!0;try{if(1==t.hasOwnProperty("promotionID")){var a=t.promotionID;if(void 0!==a&&null!=a&&void 0!==PromotionDetails&&null!=PromotionDetails){var r=getCookie("Referral");if(void 0===r||""==r||null==r||null==r){var o=e.grep(PromotionDetails,function(e){return e.PromotionID==a&&!e.IsDailyDealApply});null!=o&&o.length>0&&"2"==o[0].CustomerFilters&&0==IsForNewCustomer&&"0"!=UserID&&(i=!1),null!=o&&o.length>0&&"1"==o[0].CustomerFilters&&1==IsForNewCustomer&&"0"!=UserID&&(i=!1),(null==o||o.length<=0)&&(i=!1)}else{o=e.grep(PromotionDetails,function(e){return e.PromotionID==a});null!=o&&o.length>0&&"2"==o[0].CustomerFilters&&0==IsForNewCustomer&&"0"!=UserID&&(i=!1),null!=o&&o.length>0&&"1"==o[0].CustomerFilters&&1==IsForNewCustomer&&"0"!=UserID&&(i=!1)}}}}catch(e){}return i},_shopdetail.IsValidatePrepayFee=function(){return null!=typeof _IsPrepay&&1==_IsPrepay&&1==_shopdetail.IsPrepayBusinessFee()},_shopdetail.IsVCFEnable=function(){return 1==_shopdetail.IsValidatePrepayFee()&&(1==_shopdetail.BookingDetail.IsEnableVCFFee&&!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.Prepay)&&(_shopdetail.BookingDetail.Prepay.ccAmt>0||_shopdetail.BookingDetail.TipAmount>0))},_shopdetail.VCFAmountDistribution=function(i){for(var a=_shopdetail.BookingDetail,r=a.serviceid.split(",").length,o=new Array(r),n=0;n<r;n++){var s={AppointmentID:0};0==n&&null!=lAppID&&0!=lAppID&&(s.AppointmentID=lAppID),parseInt(t)>0&&0==n&&null!=lAppUserID&&0!=lAppUserID?s.UserID=parseInt(lAppUserID):s.UserID=e(".familycktfrnd ul li.selected").data("value"),s.BusinessID=e("#hdnBusinessID").val(),s.CalendarID=a.calendarid.split(",")[n],s.ServiceProviderID=a.spid.split(",")[n],s.ServiceProviderName=a.spname.split(",")[n],s.ServiceID=a.serviceid.split(",")[n],s.lstAddonService=a.AppointmentDetail[n].lstAddonService,s.ServiceName=a.servicename.split("||~||")[n],null!=a.AppointmentDetail[n].isPresetApply&&1==a.AppointmentDetail[n].isPresetApply?s.PromotionID="0":s.PromotionID=a.AppointmentDetail[n].PromotionId,s.isNewCustomer="undefined"!=typeof IsForNewCustomer&&IsForNewCustomer,s.isPointApply=!1,IsOutCallServiceSelected?(0!=IsMobileServiceMandatoryInBusiness&&1!=serviceType?s.Duration=parseInt(a.duration.split(",")[n])+2*parseInt(e("#hdnOutCallTime").val()):s.Duration=parseInt(a.duration.split(",")[n]),s.PointRedeem=parseInt(a.pointredeem.split(",")[n]),s.Amount=a.price.split(",")[n],s.OriginalDuration=a.duration.split(",")[n],s.OriginalPrice=parseFloat(a.price.split(",")[n])-parseFloat(e("#hdnOutCallPrice").val()),parseInt(a.pointredeem.split(",")[n])>0?s.OriginalPointRedeem=parseInt(a.pointredeem.split(",")[n])-parseInt(e("#hdnOutcallPointRedeem").val()):s.OriginalPointRedeem=0):(s.OutcallType=0,s.OutCallTime=0,s.Duration=a.duration.split(",")[n],s.Amount=a.price.split(",")[n],("0"==s.PromotionID&&void 0!==_shopdetail.BookingDetail.AppointmentDetail[n].isPresetApply&&1==_shopdetail.BookingDetail.AppointmentDetail[n].isPresetApply||0==s.PromotionID)&&(s.Amount=_shopdetail.BookingDetail.AppointmentDetail[n].price+_shopdetail.BookingDetail.AppointmentDetail[n].Discount),s.PointRedeem=a.pointredeem.split(",")[n],s.OriginalDuration=0,s.OriginalPrice=0,s.OriginalPointRedeem=0),"undefined"!=typeof _IsMemPkgUpSell&&1==_IsMemPkgUpSell&&(s.Amount=a.price.split(",")[n]),s.StartTime=a.date.split(",")[n],s.PointGiven=a.pointgiven.split(",")[n],s.ServiceStartTime=a.starttime.split(",")[n],s.CleanupTime=a.CleanupTime.split(",")[n],""==s.PointGiven&&(s.PointGiven=0),s.LoggedInUserID=e("#hdnLoggedInUserid").val(),s.AppSrNo=n+1,s.BusinessPackageID=0==a.SelectedBusinessPackageID?null:a.SelectedBusinessPackageID,s.IsServicePerformAtSameTime=a.IsServicePerformAtSameTime.split(",")[0],s.paidType=a.AppointmentDetail[n].paidType,a.AppointmentDetail[n].paidType==arrpaidType.Deposits||a.AppointmentDetail[n].paidType==arrpaidType.PartiallyPaid?(s.payableAmount=a.AppointmentDetail[n].price,s.depositsPercentage=a.AppointmentDetail[n].depositsPercentage,s.depositsPaid=a.AppointmentDetail[n].depositsPaid):a.AppointmentDetail[n].paidType==arrpaidType.Paid&&(s.payableAmount=a.AppointmentDetail[n].price,s.depositsPercentage=a.AppointmentDetail[n].depositsPercentage),s.DiscountID=a.AppointmentDetail[n].DiscountID,o[n]=s,0==n&&(s.ServiceProviderID,s.StartTime),o[n].IsPaid=!1;for(var l=0;l<_shopdetail.BookingDetail.lstAddonService.length;l++){var d=n+1;_shopdetail.BookingDetail.lstAddonService[l].MainServiceID==s.ServiceID&&_shopdetail.BookingDetail.lstAddonService[l].SrNo==d&&(o[n].lstAddonService=_shopdetail.BookingDetail.lstAddonService[l].lstAddonService,String.isNullOrUndefineOrBlank(o[n].lstAddonService)||e.each(o[n].lstAddonService,function(e,t){t.paidType!=arrpaidType.Deposits&&t.paidType!=arrpaidType.PartiallyPaid&&t.paidType!=arrpaidType.Paid||(t.payableAmount=t.Price)}))}}0==_onlineCheckout.isCheckoutVPLChanged&&(checkoutRequest=null);var c,u=_shopdetail.GetBusinessFeeList();void 0!==u&&null!=u&&u.length>0&&new Set(_shopdetail.BookingDetail.spid.split(",")).size>0&&(_shopdetail.BookingDetail.spid.includes(u[0].ShopOwnerId)||(c=!0));if(u=null,new Set(_shopdetail.BookingDetail.spid.split(",")).size>1||c){_shopdetail.CheckOutRequest(o);if(checkoutRequest.distributionRequestType=0,checkoutRequest,checkoutRequest.ccAmt>0){var p=new vagaro.ajax;p.datamodel.Token="SaveCheckoutCCDistribution",p.datamodel.callback=function(t){if(null!=t&&null!=t.ccDistribution&&t.ccDistribution.length>0){if(t.ccDistribution.length>1){t.ccDistribution=e.grep(t.ccDistribution,function(e){return 1==e.IsConsiderMerchant}),_shopdetail.RemoveDuplicateVCFFee();var a=_shopdetail.GetVCFFeeList();if(void 0!==a&&null!=a)for(var r=0;r<t.ccDistribution.length-1;r++)_shopdetail.BookingDetail.FeeDetails=e.merge(_shopdetail.BookingDetail.FeeDetails,a)}_shopdetail.SetProviderInVCFFee(t.ccDistribution),_shopdetail.VCFRecalculateAllDiscount(i)}},p.datamodel.data=[checkoutRequest],p.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},p.Post()}else _shopdetail.SetProviderInVCFFee(null),_shopdetail.VCFRecalculateAllDiscount(i)}else _shopdetail.SetProviderInVCFFee(null),_shopdetail.VCFRecalculateAllDiscount(i)},_shopdetail.VCFRecalculateAllDiscount=function(t){t!=ApplyVCFFeeSource.ApplyTip?(_shopdetail.ApplyServiceFee(0,"99"),_shopdetail.ApplyFeesValue(!0),_shopdetail.ReApplyDiscounts(),_shopdetail.ValidateOnePerUserDeal(!1),_shopdetail.ValidateAddOnPerUserDeal(!1),_shopdetail.ValidateVPl(!0),_shopdetail.CalculateTaxForPenny(),_shopdetail.DisplayDiscountOnAppointment(),0==_shopdetail.BookingDetail.TipAmount&&e("#divTip").is(":hidden")&&_shopdetail.ShowTipOptionsButton()):(_shopdetail.IsVCFFeeApplied()&&_shopdetail.RemoveVCFFee(),_shopdetail.BookingDetail.Prepay.ccAmt>0||_shopdetail.BookingDetail.TipAmount>0?(_shopdetail.ApplyServiceFee(0,"99"),_shopdetail.ApplyFeesValue(!0),_shopdetail.DisplayDiscountOnAppointment()):_shopdetail.DisplayDiscountOnAppointment())},_shopdetail.GetVCFFeeList=function(){var t=e.extend(!0,[],_shopdetail.BookingDetail.FeeDetails);return e.grep(t,function(e){return 1==e.FeeType})},_shopdetail.GetBusinessFeeList=function(){var t=e.extend(!0,[],_shopdetail.BookingDetail.FeeDetails);return e.grep(t,function(e){return 0==e.FeeType})},_shopdetail.SetProviderInVCFFee=function(t){if(null!=t&&t.length>0){var i=0;e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){1==e.FeeType&&(e.ShopOwnerId=t[i].serviceproviderId,i++)})}else e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){1==e.FeeType&&(e.ShopOwnerId=_shopdetail.BookingDetail.spid.split(",")[0],i++)})},_shopdetail.RemoveVCFFee=function(){var t=0,i=0;null!=_shopdetail.BookingDetail.FeeDetails&&(e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){1==e.FeeType&&(itemFees.CalculatedFees,t=itemFees.redeemAmount,i=itemFees.redeemTax,itemFees.paidType==arrpaidType.Paid||1==itemFees.FeeType?_shopdetail.BookingDetail.Prepay.ccAmt=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt-itemFees.CalculatedFees-(t+i)):_shopdetail.BookingDetail.Prepay.depositsRemaining=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.depositsRemaining-itemFees.CalculatedFees),_shopdetail.BookingDetail.Prepay.amtPaid=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid-itemFees.CalculatedFees))}),e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){1==e.FeeType&&(e.CalculatedFees=0)}))},_shopdetail.GetTotalVCFFee=function(){var t=0;return e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){1==e.FeeType&&(t+=e.CalculatedFees)}),t},_shopdetail.IsVCFFeeApplied=function(){var t=e.grep(_shopdetail.BookingDetail.FeeDetails,function(e){return 1==e.FeeType&&e.CalculatedFees>0});return void 0!==t&&null!=t&&t.length>0},_shopdetail.RemoveDuplicateVCFFee=function(){try{var t=Array.from(new Set(_shopdetail.BookingDetail.FeeDetails.map(e=>e.BusinessFeeID))).map(e=>_shopdetail.BookingDetail.FeeDetails.find(t=>t.BusinessFeeID===e));_shopdetail.BookingDetail.FeeDetails=e.extend(!0,[],t)}catch(e){}},_shopdetail.ClickGiftCardsTab=function(){var t=-1;void 0!==_shopdetail.BookingDetail&&void 0!==_shopdetail.BookingDetail.Prepay&&(t=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.amtPaid-_shopdetail.BookingDetail.Prepay.gcAmt-_shopdetail.BookingDetail.Prepay.PackageAmt)),(void 0===_shopdetail.BookingDetail||void 0===_shopdetail.BookingDetail.Prepay||0!=t&&0!=_shopdetail.BookingDetail.Prepay.ccAmt)&&("undefined"==typeof onlineShoppingCart||void 0===onlineShoppingCart.FinalCCAmount||0!=onlineShoppingCart.FinalCCAmount)?0==e(_shopdetail.divAddGiftCards).is(":visible")?(e(_shopdetail.tabAddGiftCards).addClass("w--current"),e(_shopdetail.divAddGiftCards).attr("style","display: block"),e("#txtGCRedeemGCNo").focus()):(e(_shopdetail.tabAddGiftCards).removeClass("w--current"),e(_shopdetail.divAddGiftCards).attr("style","display: none")):_common.PassiveAlertfail("Unable to add another gift card because the amount due is zero.")},_shopdetail.CheckGCPromoCodeLimt=function(t){if(void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication||"undefined"!=typeof isWidget&&null!=isWidget&&"true"==isWidget.toLowerCase()){var i=(new Date).getTime();if(1===t)var a=e("#txtGCRedeemGCNo").val(),r={timestamp:i,eventName:"GiftCardApplied",data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:encrypt(UserID),giftCardNumber:a}};else{var o=e("#txtPromoCodeService").val();r={timestamp:i,eventName:"PromoCodeApplied",data:{customerId:"undefined"!=typeof staticEncryptUserID&&null!=staticEncryptUserID?staticEncryptUserID:encrypt(UserID),promoCode:o}}}"undefined"!=typeof wbc&&void 0!==IsWebsiteBuilderCommunication&&null!=IsWebsiteBuilderCommunication&&1==IsWebsiteBuilderCommunication?wbc._postMessage('{"eventType": "MysiteSendEventMessage","message": '+JSON.stringify(r)+"}"):"undefined"!=typeof $Interframe&&$Interframe.sendEventMessage(r)}if(ShowLoader(!0),_shopdetail.BookingDetail.TipAmount=0,t==_onlineCheckout.PromoCodeType.GCCode){if(null==(a=e("#txtGCRedeemGCNo").val())||String.isNullOrUndefineOrBlank(a.trim()))return e("#txtGCRedeemGCNo").val(""),e("#txtGCRedeemGCNo").addClass("errorInput"),e("#txtGCRedeemGCNo").focus(),void ShowLoader(!1);var n=parseInt(UserID),s=UserType,l="CheckGCNumber";_shopdetail.GetGCPromoCodeLimt(n,s,l),ShowLoader(!1)}else if(2==t){if(null==(o=e("#txtPromoCodeService").val())||String.isNullOrUndefineOrBlank(o.trim()))return e("#txtPromoCodeService").val(""),e("#txtPromoCodeService").addClass("errorInput"),e("#txtPromoCodeService").focus(),void ShowLoader(!1);n=parseInt(UserID),s=UserType,l="CheckPromoNumber";_shopdetail.GetGCPromoCodeLimt(n,s,l),ShowLoader(!1)}},_shopdetail.GetGCPromoCodeLimt=function(e,t,i){var a={};a.UserID=parseInt(e),a.UserType=null==t||""==t||void 0===t||0==t?parseInt(1):parseInt(t),a.MethodName=i;var r=new vagaro.ajax;r.datamodel.async=!1,r.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.getgcpromocodelimt,groupID),r.datamodel.data=a,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.callback=_shopdetail.GetGCPromoCodeLimtSuccess,r.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},r.Post()},_shopdetail.GetGCPromoCodeLimtSuccess=function(t){if(1e3==t.ResponseCode&&null!=t.Data){var i=t.Data.split("|");if(i.length<=2&&i[1]==_onlineCheckout.CodeType.GCCode){var a=e("#txtGCRedeemGCNo").val();if("True"!=i[0])return _onlineCheckout.CreateGCCodeDiv(a.trim().toUpperCase(),a.trim().toUpperCase(),"You have exceeded the number of attempts.",!1),e("#txtGCRedeemGCNo").val(""),void ShowLoader(!1);_shopdetail.CheckValidGCNoInGCRedeem()}else if(i.length<=2&&i[1]==_onlineCheckout.CodeType.PromoCode){var r=e("#txtPromoCodeService").val();if("True"!=i[0])return _shopdetail.CreatePromoCodeDiv(r.toUpperCase(),r.toUpperCase(),"You have exceeded the number of attempts.",!1),e("#txtPromoCodeService").val(""),void ShowLoader(!1);_shopdetail.ValidatePromoCodeService()}}},_shopdetail.GCPromoCodeLimt=function(e,t,i,a){var r={};r.UserID=parseInt(e),r.UserType=null==t||""==t||void 0===t||0==t?parseInt(1):parseInt(t),r.GCPromoCodeNo=i,r.MethodName=a;var o=new vagaro.ajax;o.datamodel.async=!1,o.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.gcpromocodelimt,groupID),o.datamodel.data=r,o.datamodel.IsNewVagaroAPI=!0,o.datamodel.callback=_shopdetail.GCPromoCodeLimtSuccess,o.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},o.Post()},_shopdetail.GCPromoCodeLimtSuccess=function(t){if(1e3==t.ResponseCode&&null!=t.Data)if(null!=t.Data.RateLimitMethods&&t.Data.RateLimitMethods.MethodName==_onlineCheckout.CodeType.GCCode){var i=e("#txtGCRedeemGCNo").val();if(null!=t.Data.RateLimitMethodDetails)return _onlineCheckout.CreateGCCodeDiv(i.trim().toUpperCase(),i.trim().toUpperCase(),"The gift card number you entered is incorrect.",!1),void e("#txtGCRedeemGCNo").val("")}else if(null!=t.Data.RateLimitMethods&&t.Data.RateLimitMethods.MethodName==_onlineCheckout.CodeType.PromoCode){var a=e("#txtPromoCodeService").val();if(null!=t.Data.RateLimitMethodDetails)return _shopdetail.CreatePromoCodeDiv(a.toUpperCase(),a.toUpperCase(),"The promo code you entered is incorrect.",!1),void e("#txtPromoCodeService").val("")}};var m=!1;_shopdetail.CheckValidGCNoInGCRedeem=function(){e("#divApplyGCcode").empty();var t,i=e("#txtGCRedeemGCNo").val();if(null==i||String.isNullOrUndefineOrBlank(i.trim()))e("#txtGCRedeemGCNo").val(""),e("#txtGCRedeemGCNo").addClass("errorInput"),e("#txtGCRedeemGCNo").focus();else{if(0!==(t=e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(e){return!String.isNullOrUndefineOrBlank(e.giftCertificateNo)&&e.giftCertificateNo.toLowerCase()==i.toLowerCase().trim()||!String.isNullOrUndefineOrBlank(e.giftCertificateNo)&&e.giftCertificateNo.toLowerCase().substr(0,e.giftCertificateNo.lastIndexOf("-")).trim()==i.toLowerCase().trim()})).length)return _onlineCheckout.CreateGCCodeDiv(i.trim().toUpperCase(),i.trim().toUpperCase(),"This Gift Card already exist.",!1),e("#txtGCRedeemGCNo").val(""),void ShowLoader(!1);if(m=!0,0===t.length){var a={};a.businessID=_shopdetail.businessID,a.userID=UserID,a.gCNo=e("#txtGCRedeemGCNo").val().trim(),a.isConsiderOwnBusiness="1"===e("#hdnIsFromSwipe").val(),a.lLoggedInID=UserID;var r=new vagaro.ajax;r.datamodel.Token="CheckGCNo",r.datamodel.data=a,r.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert("Some error occured. Please try again.")},r.datamodel.callback=_shopdetail.CheckValidGCNoInGCRedeem_Success,r.Post()}}},_shopdetail.DateDifference=function(e,t){var i=t.getTime()-e.getTime();return Math.ceil(i/1e3/60/60/24)},_shopdetail.GetTerikSupportedDate=function(e){return new Date(e.replace(/-/g,","))},_shopdetail.SetGCPackageList=function(e){var t={AdvanceLimitDate:null};return t.SharedUserIDs=UserID.toString(),t.TotalPKGUnlimitedCount=e.TotalPKGUnlimitedCount,t.ValidUpto=e.ValidUpto,t.assignTo=e.AssignTo,t.assignedToName=e.AssignedToName,t.businessID=e.BusinessID,t.businessName=e.BusinessName,t.currentBalance=e.CurrentBalance,t.emailId="",t.eventType=e.EventType,t.expiresOn=e.ExpiresOn,t.giftCertificateAmt=e.GiftCertificateAmt,t.giftCertificateID=e.GiftCertificateID,t.giftCertificateNo=e.GiftCertificateNo,t.groupID=e.GroupId,t.initialQuantity=e.InitialQuantity,t.isCustomPackage=e.IsCustomPackage,t.isPackage=e.IsPackage,t.pkgName="",t.quantity=e.Quantity,t.senderName=e.SenderName,t.serviceID=0==e.ServiceID?null:e.ServiceID,t.serviceName=e.ServiceName,t.strAdvanceLimitDate=e.AdvanceLimitDate,t.strValidUpto=e.strValidUpto,t.voidDate=e.VoidDate,t.voidReason=e.VoidReason,_shopdetail.BookingDetail.Prepay.lstGCpkgList.push(t),t},_shopdetail.CheckValidGCNoInGCRedeem_Success=function(t){ShowLoader(!1),"undefined"!=typeof BusinessDate&&null!=BusinessDate||(BusinessDate=new Date(_siteBuilderDetail.ComponentResponse.lstBusinessDetail.businessDateTime).format("MM/dd/yyyy HH:mm"));var i=e("#txtGCRedeemGCNo").val();if(null!==t&&t.length>0){var a=_onlineCheckout.Empty,r=e.grep(t,function(e){return String.isNullOrUndefineOrBlank(e.VoidDate)&&(String.isNullOrUndefineOrBlank(e.strExpiresOn)||!String.isNullOrUndefineOrBlank(e.strExpiresOn)&&_shopdetail.DateDifference(_shopdetail.GetTerikSupportedDate(BusinessDate),new Date(e.strExpiresOn))>0)&&(null===e.ServiceID||null!==e.ServiceID&&e.Quantity>0)&&null!==e.CurrentBalance&&e.CurrentBalance>0});if(r.length>0&&(t[0]=r[0]),String.isNullOrUndefineOrBlank(t[0].VoidDate)?!String.isNullOrUndefineOrBlank(t[0].strExpiresOn)&&_shopdetail.DateDifference(_shopdetail.GetTerikSupportedDate(BusinessDate),new Date(t[0].strExpiresOn))<0?a=_onlineCheckout.GCExpMsg:null!==t[0].CurrentBalance&&t[0].CurrentBalance<=0?a=_onlineCheckout.GCBalMsg:null!==t[0].ServiceID&&t[0].Quantity<=0&&(a=_onlineCheckout.GCQuantityMsg):a=_onlineCheckout.GCVoidMsg,!String.isNullOrUndefineOrBlank(a))return _onlineCheckout.CreateGCCodeDiv(i.trim().toUpperCase(),i.trim().toUpperCase(),a,!1),e("#txtGCRedeemGCNo").val(""),!1;if(0==r.length&&1==m){var o=UserType,n="CheckGCNumber";return _shopdetail.GCPromoCodeLimt(parseInt(UserID),o,i.trim().toUpperCase(),n),!1}e("#divApplyGCcode").empty();var s=!1;if(e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){0==s&&(s=!t[0].IsPackage&&t[0].ServiceID>0&&t[0].ServiceName.toLowerCase().trim()==e.servicename.toLowerCase().trim())}),!s&&t[0].ServiceID>0)return void _common.PassiveAlertfail(_onlineCheckout.GCOtherMsg);var l=_shopdetail.SetGCPackageList(t[0]);e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){e.IsServiceBaseGC=!1,1==e.IsMembershipApply&&_shopdetail.RemoveDiscount(3,e.AppSrNo),e.redeemID>0&&_shopdetail.RemoveDiscount(1,1)}),_shopdetail.ApplyDiscounts(_shopdetail.BookingDetail.Prepay.lstGCpkgList,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],_shopdetail.BookingDetail.Prepay.lstMembership,_shopdetail.BookingDetail.Prepay.lstServiceDetails,l),_shopdetail.CalculateTaxForPenny(),_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.ShowTipOptionsButton(),e("#txtGCRedeemGCNo").val(_shopdetail.Empty)}else{o=UserType,n="CheckGCNumber";_shopdetail.GCPromoCodeLimt(parseInt(UserID),o,i.trim().toUpperCase(),n)}},_shopdetail.AjaxOld=function(e,t,i,a){var r=new vagaro.ajax;r.datamodel.Token=e,r.datamodel.data=t,r.datamodel.callback=i,r.datamodel.Error=a,r.Post()},_shopdetail.AddLogInAmplitudeSuccess=function(e){console.log("success")},_shopdetail.AddLogInAmplitudeSuccessFail=function(e){console.log("error")},_shopdetail.BindPaymentOption=function(t){var i=[],a=1,r=function(e){return(!_shopdetail.EnableFMBFee()||!_shopdetail.IsDailyDealsAppliedInItem())&&(null!=e&&(void 0!==e.PromotionId&&null!=e.PromotionId&&e.PromotionId>0||void 0!==e.PromotionID&&null!=e.PromotionID&&e.PromotionID>0))};if(null!=t.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout&&t.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout.length>0){var o=[];e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(n){e.grep(t.objGcPackagePointAndUserTaxDetail.lstGcAndPackagesForCheckout,function(t,s){if(-1==jQuery.inArray(t.giftCertificateID,o)&&1==t.isPackage){var l={};l.Type=ApplyDiscoutTypePrepay.Package,1==t.isCustomPackage?t.serviceName.toLowerCase()==n.servicename.toLowerCase()&&0!=t.quantity&&n.ServiceOrginalPrice>0&&!r(n)&&(l.DIVId="div_"+CheckoutBarcodeCodePrepay.Pkg+"_"+t.giftCertificateID,l.Id=t.giftCertificateID,l.Name=PaymentOptionText.TextPkg+t.pkgName,l.Index=a,l.RequestParam=JSON.stringify(l),i.push(l),o.push(t.giftCertificateID),a+=1):t.serviceName.toLowerCase()==n.servicename.toLowerCase()&&0!=t.quantity&&n.ServiceOrginalPrice>0&&!r(n)&&(l.DIVId="div_"+CheckoutBarcodeCodePrepay.Pkg+"_"+t.giftCertificateID,l.Id=t.giftCertificateID,l.Name=PaymentOptionText.TextPkg+t.serviceName,l.Index=a,l.RequestParam=JSON.stringify(l),i.push(l),o.push(t.giftCertificateID),a+=1),!String.isNullOrUndefineOrBlank(n.lstAddonService)&&n.lstAddonService.length>0&&e.grep(n.lstAddonService,function(e){1==t.isCustomPackage?t.serviceName.toLowerCase()==e.ServiceTitle.toLowerCase()&&0!=t.quantity&&e.priceOriginal>0&&!r(e)&&(l.DIVId="div_"+CheckoutBarcodeCodePrepay.Pkg+"_"+t.giftCertificateID,l.Id=t.giftCertificateID,l.Name=PaymentOptionText.TextPkg+t.pkgName,l.Index=a,l.RequestParam=JSON.stringify(l),i.push(l),o.push(t.giftCertificateID),a+=1):t.serviceName.toLowerCase()==e.ServiceTitle.toLowerCase()&&0!=t.quantity&&e.priceOriginal>0&&!r(e)&&(l.DIVId="div_"+CheckoutBarcodeCodePrepay.Pkg+"_"+t.giftCertificateID,l.Id=t.giftCertificateID,l.Name=PaymentOptionText.TextPkg+t.serviceName,l.Index=a,l.RequestParam=JSON.stringify(l),i.push(l),o.push(t.giftCertificateID),a+=1)})}})})}if(null!=t.objGcPackagePointAndUserTaxDetail.UserListForCheckout&&t.objGcPackagePointAndUserTaxDetail.UserListForCheckout.length>0){var n=0,s=0,l=_shopdetail.BookingDetail.DepositsLimit<=_shopdetail.GetTotalAmountforDeposits();if(e.grep(t.objGcPackagePointAndUserTaxDetail.UserListForCheckout,function(t){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){i.ServiceOrginalPrice>0&&t.pointsBalance>0&&(t.pointsBalance>=_onlineCheckout.ConvertDecimalWithFixed(i.pointredeem,!1,2)||IsPartialPointAllowed)&&_onlineCheckout.ConvertDecimalWithFixed(i.pointredeem,!1,2)>0&&1==l&&(n+=1),!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(e){i.priceOriginal>0&&t.pointsBalance>0&&(t.pointsBalance>=_onlineCheckout.ConvertDecimalWithFixed(e.PointRedeem,!1,2)||IsPartialPointAllowed)&&_onlineCheckout.ConvertDecimalWithFixed(e.PointRedeem,!1,2)>0&&1==l&&(n+=1)})}),s+=t.pointsBalance}),n>0&&(!_shopdetail.EnableFMBFee()||!_shopdetail.IsDailyDealsAppliedInItem())){var d={};d.DIVId="div_"+CheckoutBarcodeCodePrepay.Point+"_"+ApplyDiscoutTypePrepay.Points,d.Id=t.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0].userId,d.Name=PaymentOptionText.TextPoint+s,d.Type=ApplyDiscoutTypePrepay.Points,d.Index=a,d.RequestParam=JSON.stringify(d),i.push(d),a+=1}}if(null!=t.objGcPackagePointAndUserTaxDetail.lstCheckoutMembershipDetail&&t.objGcPackagePointAndUserTaxDetail.lstCheckoutMembershipDetail.length>0){Membership=t.objGcPackagePointAndUserTaxDetail.lstCheckoutMembershipDetail;var c=!0,u=!0;if(Membership.length>0)for(var p=0;p<Membership.length;p++)if(null!=Membership[p].strValidUpto&&""!=Membership[p].strValidUpto&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){new Date(moment(Membership[p].strValidUpto).format("YYYY/MM/DD"))<new Date(t.appBookingDate)&&(c=!1),1==c&&t.PromotionId<=0&&(u=!1),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(e){e.PromotionID<=0&&(u=!1)})}),1==c&&(0==u||_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem())){var h={};h.DIVId="div_"+CheckoutBarcodeCodePrepay.MS+"_"+Membership[p].MembershipID,h.Id=Membership[p].MembershipID,h.Name=PaymentOptionText.TextMS+Membership[p].MembershipName,h.Type=ApplyDiscoutTypePrepay.Membership,h.Index=a,h.RequestParam=JSON.stringify(h);for(var m=!1,f=0;f<i.length;f++)if(i[f].Id===h.Id){m=!0;break}m||(i.push(h),a+=1)}}_IsPaymentOption=!1,e(_shopdetail.Controls.DivPaymentOption).html(""),i.length>0&&(e(_shopdetail.Controls.TmplBookingPaymentOption).tmpl(i).appendTo(_shopdetail.Controls.DivPaymentOption),_IsPaymentOption=!0,e("#dvBookingTabs").addClass("margin-top0"),0==_onlineCheckout.IsVplChanged&&e("#tabVagaroPayLater").hide())},_shopdetail.PaymentOptionSelectDeselect=function(){e(_shopdetail.Controls.PaymentOptionMsPkgPoint).removeClass(_shopdetail.CssClass.ActiveTab),1==_IsPaymentOption&&e("#divBookingSelectPaymentMethodTitle").html("Select Payment Method"),!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail)&&_shopdetail.BookingDetail.AppointmentDetail.length>0&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){!String.isNullOrUndefineOrBlank(t.GCDetail)&&t.GCDetail.length>0&&e.grep(t.GCDetail,function(e){_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.Pkg+"_"+e.giftcertificateId,!0)}),String.isNullOrUndefineOrBlank(t.IsMembershipApply)||1!=t.IsMembershipApply||_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.MS+"_"+t.MembershipID,!0),(t.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||void 0!==t.IsPartialPoint&&1==t.IsPartialPoint)&&(_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.Point+"_"+t.ApplyDiscoutType,!0),t.ApplyDiscoutType!=ApplyDiscoutTypePrepay.Points&&void 0!==t.IsPartialPoint&&1==t.IsPartialPoint&&_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.Point+"_4",!0)),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(t){!String.isNullOrUndefineOrBlank(t.GCDetail)&&t.GCDetail.length>0&&e.grep(t.GCDetail,function(e){_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.Pkg+"_"+e.giftcertificateId,!0)}),String.isNullOrUndefineOrBlank(t.IsMembershipApply)||1!=t.IsMembershipApply||_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.MS+"_"+t.MembershipID,!0),t.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&_shopdetail.SelectDeselect(CheckoutBarcodeCodePrepay.Point+"_"+t.ApplyDiscoutType,!0)})})},_shopdetail.SelectDeselect=function(t,i){1==i?e("#div_"+t).addClass(_shopdetail.CssClass.ActiveTab):e("#div_"+t).removeClass(_shopdetail.CssClass.ActiveTab)},_shopdetail.PaymentTabClick=function(t,i){_shopdetail.BookingDetail.TipAmount=0,1==e(t).hasClass(_shopdetail.CssClass.ActiveTab)?_shopdetail.RemoveDicountByType(i):_shopdetail.ApplyDicountByType(i)},_shopdetail.ApplyDicountByType=function(t){_shopdetail._addonMembershipGroupUsage={},!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail)&&_shopdetail.BookingDetail.AppointmentDetail.length>0&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(e){if(_shopdetail.RemoveExistingGC(),t.Type==ApplyDiscoutTypePrepay.Points)1==IsPartialPointAllowed&&void 0!==e.DiscountID&&!String.isNullOrUndefineOrBlank(e.DiscountID)&&e.DiscountID>0&&_shopdetail.RemovePromoCodeService(e.DiscountID),_shopdetail.RemoveExistingDicount(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],t,e),_shopdetail.ApplyPointsOnAppointment(e,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0]);else if(t.Type==ApplyDiscoutTypePrepay.Package){var i=_shopdetail.BookingDetail.Prepay.lstGCpkgList.filter(e=>e.giftCertificateID==t.Id);_shopdetail.RemoveExistingDicount(i,t,e),_shopdetail.ApplyPackageOnAppointment(e,i,!0)}else if(t.Type==ApplyDiscoutTypePrepay.Membership){var a=_shopdetail.BookingDetail.Prepay.lstMembership.filter(e=>e.MembershipID==t.Id);_shopdetail.RemoveExistingDicount(a,t,e),_shopdetail.ApplyMembershipOnAppointment(e,a)}for(var r=0;r<SelectedAddonService.length;r++)if(SelectedAddonService[r].MainServiceID==e.serviceid&&SelectedAddonService[r].SrNo==e.AppSrNo)for(var o=0;o<SelectedAddonService[r].lstAddonService.length;o++){var n=SelectedAddonService[r].lstAddonService[o];if(n.paidType=arrpaidType.Paid,n.SrNo=r+1,t.Type==ApplyDiscoutTypePrepay.Points)_shopdetail.RemoveExistingDicount(_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],t,e,n),_shopdetail.ApplyPointsOnAddon(e,_shopdetail.BookingDetail.objGcPackagePointAndUserTaxDetail.UserListForCheckout[0],n,SelectedAddonService[r].SrNo);else if(t.Type==ApplyDiscoutTypePrepay.Package){i=_shopdetail.BookingDetail.Prepay.lstGCpkgList.filter(e=>e.giftCertificateID==t.Id);_shopdetail.RemoveExistingDicount(i,t,e,n),_shopdetail.ApplyPackageOnAddon(e,i,n,n.SrNo)}else if(t.Type==ApplyDiscoutTypePrepay.Membership){a=_shopdetail.BookingDetail.Prepay.lstMembership.filter(e=>e.MembershipID==t.Id);_shopdetail.RemoveExistingDicount(a,t,e,n),_shopdetail.ApplyMembershipOnAddon(e,a,n)}}}),_shopdetail.ReApplyDiscounts()},_shopdetail.RemoveDicountByType=function(t){!String.isNullOrUndefineOrBlank(_shopdetail.BookingDetail.AppointmentDetail)&&_shopdetail.BookingDetail.AppointmentDetail.length>0&&e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(i){t.Type==ApplyDiscoutTypePrepay.Points?i.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points&&_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Points,i.AppSrNo):t.Type==ApplyDiscoutTypePrepay.Package?!String.isNullOrUndefineOrBlank(i.GCDetail)&&i.GCDetail.length>0&&e.grep(i.GCDetail,function(e){e.giftcertificateId==t.Id&&_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Package,i.AppSrNo)}):t.Type==ApplyDiscoutTypePrepay.Membership&&(String.isNullOrUndefineOrBlank(i.IsMembershipApply)||1!=i.IsMembershipApply||i.MembershipID==t.Id&&_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Membership,i.AppSrNo))}),!String.isNullOrUndefineOrBlank(SelectedAddonService)&&SelectedAddonService.length>0&&e.grep(SelectedAddonService,function(i){!String.isNullOrUndefineOrBlank(i.lstAddonService)&&i.lstAddonService.length>0&&e.grep(i.lstAddonService,function(a){t.Type==ApplyDiscoutTypePrepay.Points?(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||a.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC&&1==a.IsPartialPoint)&&_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.PointsAddon,i.SrNo,a.ServiceId):t.Type==ApplyDiscoutTypePrepay.Package?!String.isNullOrUndefineOrBlank(a.GCDetail)&&a.GCDetail.length>0&&e.grep(a.GCDetail,function(e){e.giftcertificateId==t.Id&&_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServciePackageAddon,i.SrNo,a.ServiceId)}):t.Type==ApplyDiscoutTypePrepay.Membership&&(String.isNullOrUndefineOrBlank(a.IsMembershipApply)||1!=a.IsMembershipApply||a.MembershipID==t.Id&&_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServcieMembershipAddon,i.SrNo,a.ServiceId))})})},_shopdetail.RemoveExistingDicount=function(t,i,a,r){var o=function(e){_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem()||_shopdetail.RemoveDealOnItem(e)},n=function(e,t){_shopdetail.EnableFMBFee()&&_shopdetail.IsDailyDealsAppliedInItem()||_shopdetail.RemoveAddonDealOnItem(e,t)};if(i.Type==ApplyDiscoutTypePrepay.Points){if(String.isNullOrUndefineOrBlank(r))(s=a.pointredeemOriginal)>0&&(t.pointsBalance>=s||IsPartialPointAllowed)&&t.pointsBalance>0&&(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(a.PromotionId>0&&_shopdetail.RemoveDealOnItem(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Package,a.AppSrNo)):String.isNullOrUndefineOrBlank(a.IsMembershipApply)||1!=a.IsMembershipApply?a.PromotionId>0&&_shopdetail.RemoveDealOnItem(a.AppSrNo):(a.PromotionId>0&&_shopdetail.RemoveDealOnItem(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Membership,a.AppSrNo)));else if(!String.isNullOrUndefineOrBlank(r)){var s;(s=r.PointRedeem)>0&&t.pointsBalance>=s&&t.pointsBalance>0&&(r.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&_shopdetail.RemoveAddonDealOnItem(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServciePackageAddon,r.SrNo,r.ServiceId)):String.isNullOrUndefineOrBlank(r.IsMembershipApply)||1!=r.IsMembershipApply?!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&_shopdetail.RemoveAddonDealOnItem(r.SrNo,r.ServiceId):(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&_shopdetail.RemoveAddonDealOnItem(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServcieMembershipAddon,r.SrNo,r.ServiceId)))}}else i.Type==ApplyDiscoutTypePrepay.Package?null!=t&&t.length>0&&e.grep(t,function(e){String.isNullOrUndefineOrBlank(r)?e.serviceName.toLowerCase().trim()==a.servicename.toLowerCase().trim()&&(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&a.ServiceOrginalPrice>0&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))>=new Date(a.appBookingDate))&&(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Package,a.AppSrNo)):String.isNullOrUndefineOrBlank(a.IsMembershipApply)||1!=a.IsMembershipApply?a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||a.TotalApplyPoint>0?(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Points,a.AppSrNo)):a.PromotionId>0&&o(a.AppSrNo):(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Membership,a.AppSrNo))):String.isNullOrUndefineOrBlank(r)||e.serviceName.toLowerCase().trim()==r.ServiceTitle.toLowerCase().trim()&&(e.quantity>0||1==e.isCustomPackage&&-1==e.quantity)&&(r.Price>0||r.priceOriginal>0)&&(null==e.strValidUpto||""==e.strValidUpto||null!=e.strValidUpto&&""!=e.strValidUpto&&new Date(moment(e.strValidUpto).format("YYYY/MM/DD"))>=new Date(a.appBookingDate))&&(r.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServciePackageAddon,r.SrNo,r.ServiceId)):String.isNullOrUndefineOrBlank(r.IsMembershipApply)||1!=r.IsMembershipApply?r.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points?(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.PointsAddon,r.SrNo,r.ServiceId)):!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId):(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServcieMembershipAddon,r.SrNo,r.ServiceId)))}):i.Type==ApplyDiscoutTypePrepay.Membership&&e.each(t,function(e,t){String.isNullOrUndefineOrBlank(r)?(t.VisitRemaining>0||-1==t.VisitRemaining)&&t.ServiceProductName.toLowerCase().trim()==a.servicename.toLowerCase().trim()&&a.ServiceOrginalPrice>0&&(0==a.PromotionId||1==t.isPromotionalDiscount&&0!=a.PromotionId)&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))>=new Date(a.appBookingDate))&&(a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Package,a.AppSrNo)):String.isNullOrUndefineOrBlank(a.IsMembershipApply)||1!=a.IsMembershipApply?a.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points||a.TotalApplyPoint>0?(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Points,a.AppSrNo)):a.PromotionId>0?o(a.AppSrNo):a.ApplyDiscoutType==ApplyDiscoutTypePrepay.GC&&(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.GC,a.AppSrNo)):(a.PromotionId>0&&o(a.AppSrNo),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.Membership,a.AppSrNo))):String.isNullOrUndefineOrBlank(r)||(t.VisitRemaining>0||-1==t.VisitRemaining)&&t.ServiceProductName.toLowerCase().trim()==r.ServiceTitle.toLowerCase().trim()&&r.priceOriginal>0&&(0==r.PromotionID||1==t.isPromotionalDiscount&&0!=r.PromotionID)&&(null==t.strValidUpto||""==t.strValidUpto||null!=t.strValidUpto&&""!=t.strValidUpto&&new Date(moment(t.strValidUpto).format("YYYY/MM/DD"))>=new Date(a.appBookingDate))&&(r.ApplyDiscoutType==ApplyDiscoutTypePrepay.Package?(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServciePackageAddon,r.SrNo,r.ServiceId)):String.isNullOrUndefineOrBlank(r.IsMembershipApply)||1!=r.IsMembershipApply?r.ApplyDiscoutType==ApplyDiscoutTypePrepay.Points?(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.PointsAddon,r.SrNo,r.ServiceId)):!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId):(!String.isNullOrUndefineOrBlank(r.PromotionID)&&r.PromotionID>0&&n(r.SrNo,r.ServiceId),_shopdetail.RemoveDiscount(ApplyDiscoutTypePrepay.ServcieMembershipAddon,r.SrNo,r.ServiceId)))})},_shopdetail.GetDiscountDetailofUserToBookAppResponse=function(t,i){void 0===t||(1!=_IsPrepay&&1!=_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()||0!=_IsMemPkgUpSell)&&1!=_shopdetail.IsMemPkgReqToBookUserOrFnF()||(void 0!==CheckoutBarcodeCodePrepay&&(AppBookLoggedInUserId!=UserID?e("#div_"+CheckoutBarcodeCodePrepay.Point+"_4").hide():e("#div_"+CheckoutBarcodeCodePrepay.Point+"_4").show()),_shopdetail.ResetDiscount(),_shopdetail.ApplyDiscounts(t.lstGcAndPackagesForCheckout,t.UserListForCheckout[0],t.lstCheckoutMembershipDetail,t.lstServiceDetailsForCheckout),_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.VagaroPayLaterPaymentMethod()),void 0!==t&&("2"!=e("#hdnOriginalOutcallType").val()&&(null==t.sCustomerAddress||null==t.sCustomerAddress||""==t.sCustomerAddress||""==t.sCustomerAddress?(e("#OutCallTab2").click(),e("#bookoutcalladdresslink").hide()):(String.isNullOrUndefineOrBlank(customCustomerAddress)?(e("#dvOutCallAddress").html(t.sCustomerAddress.Address),e("#hdnOutcallAddress").val(t.sCustomerAddress.Address)):(e("#dvOutCallAddress").text(customCustomerAddress),e("#hdnOutcallAddress").val(customCustomerAddress)),e("#bookoutcalladdresslink").show())),e("#hdnIsFromPage").val(""),e("#dvBookingPaymentMethod").hide(),e("#btnAppointment").show(),e("#btnAppointmentWithCC").hide(),e("#bookoutcalladdresslink").show(),_IsPrepay=t.isPrePay,_shopdetail.BookingDetail.DepositsPer=t.depositsPer,_shopdetail.BookingDetail.DepositsLimit=t.depositsLimit,_shopdetail.BookingDetail.DepositAmtType=t.IsDepositAmtType,_shopdetail.BookingDetail.DailyDealVagaroFee=t.DailyDealVagaroFee,_shopdetail.BookingDetail.DailyDealVagaroFee_ExistingUser=t.DailyDealVagaroFee_ExistingUser,_shopdetail.BookingDetail.DailyDealVagaroFeeType=t.IsDailyDealVagaroFeeType,_shopdetail.BookingDetail.IsForVeraNewCustomer=t.IsForVeraNewCustomer,_shopdetail.BookingDetail.IsSameDayCustomer=!0===t.IsSameDayCustomer,void 0!==t.IsFMBEnableForBusiness&&null!=t.IsFMBEnableForBusiness&&(IsFMBEnableForBusiness=t.IsFMBEnableForBusiness),_shopdetail.checkDepositOffOrNot()&&(isDepositOff=!0),_shopdetail.SetDailyDealsFeeInfo(),void 0!==t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout&&null!=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOption&&(_shopdetail.BookingDetail.TipOption=t.objGcPackagePointAndUserTaxDetail.CalendarConfirmationModeForCheckout.TipOption),e("#hdnIsCCCapturedAllowed").val(t.IsCCCapturedAllowed),null!=t.AllowCCCapturedAbove&&""!=t.AllowCCCapturedAbove?e("#hdnAllowCCCapturedAbove").val(t.AllowCCCapturedAbove):e("#hdnAllowCCCapturedAbove").val(""),"true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&""!=e("#hdnAllowCCCapturedAbove").val()&&gbltotPrice>=parseFloat(e("#hdnAllowCCCapturedAbove").val())&&(void 0===IsPaid||""==IsPaid||"true"!=IsPaid.toString().toLowerCase())||_IsPrepay||1==_shopdetail.AtleastOneMemOrPackSelectedFromPopUp()?("False"==AcceptAmex&&null!=t.objUserCCDetails&&"AmericanExpress"==t.objUserCCDetails.CreditCardType&&_shopdetail.businessID!=t.objUserCCDetails.BusinessID&&(t.objUserCCDetails=null),e("#btnAppointment").hide(),e("#btnAppointmentWithCC").show(),_shopdetail.LoadCCSectionForBooking(t.objUserCCDetails,t.lstfriendandfamilycc)):(e("#dvdueblock").hide(),e("#dvCCDescription").hide()),_shopdetail.IsVCFEnable()&&_shopdetail.VCFAmountDistribution(ApplyVCFFeeSource.ChangeFamily)),1==i&&("bookwithcc"==_sharing.SourceButtonName.toLowerCase()?_shopdetail.ValidateBookingDataWithCC():"bookwithoutcc"==_sharing.SourceButtonName.toLowerCase()&&_shopdetail.ValidateBookingDataWithoutCC(),_sharing.SourceButtonName=""),void 0!==t&&1==_IsPrepay&&(null!=AppBookLoggedInUserId&&void 0!==AppBookLoggedInUserId&&AppBookLoggedInUserId!==UserID&&_shopdetail.ResetDiscount(),_shopdetail.ApplyDiscounts(t.lstGcAndPackagesForCheckout,t.UserListForCheckout[0],t.lstCheckoutMembershipDetail,t.lstServiceDetailsForCheckout),_shopdetail.DisplayDiscountOnAppointment(),_shopdetail.GetMembershipList(_shopdetail.GetAddonsServiceId(),UserID,!1,""))},_shopdetail.RemoveExistingGC=function(){e.grep(_shopdetail.BookingDetail.AppointmentDetail,function(t){e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(i,a){t.GCDetailPriceBase.length>0&&e.grep(t.GCDetailPriceBase,function(a){i.giftCertificateID==a.giftcertificateId&&(i.assignStatus=s.Remove,t.GCDetailPriceBase=e.grep(t.GCDetailPriceBase,function(e){return e.giftcertificateId!=i.giftCertificateID}))}),t.GCDetail.length>0&&1==t.IsServiceBaseGC&&i.serviceID==t.serviceid&&(t.IsServiceBaseGC=!1,i.assignStatus=s.Remove,t.GCDetail=e.grep(t.GCDetail,function(e){return!(e.giftcertificateId==i.giftCertificateID&&e.serviceId==i.serviceID)}))}),!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(t){e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(i,a){t.GCDetailPriceBase.length>0&&e.grep(t.GCDetailPriceBase,function(a){i.giftCertificateID==a.giftcertificateId&&(i.assignStatus=s.Remove,t.GCDetailPriceBase=e.grep(t.GCDetailPriceBase,function(e){return e.giftcertificateId!=i.giftCertificateID}))}),t.GCDetail.length>0&&1==t.IsServiceBaseGC&&i.serviceID==t.ServiceId&&(t.IsServiceBaseGC=!1,i.assignStatus=s.Remove,t.GCDetail=[])})})}),!String.isNullOrUndefineOrBlank(SelectedAddonService)&&SelectedAddonService.length>0&&e.grep(SelectedAddonService,function(t){!String.isNullOrUndefineOrBlank(t.lstAddonService)&&t.lstAddonService.length>0&&e.grep(t.lstAddonService,function(t){e.grep(_shopdetail.BookingDetail.Prepay.lstGCpkgList,function(i,a){t.GCDetailPriceBase.length>0&&e.grep(t.GCDetailPriceBase,function(a){i.giftCertificateID==a.giftcertificateId&&(i.assignStatus=s.Remove,t.GCDetailPriceBase=e.grep(t.GCDetailPriceBase,function(e){return e.giftcertificateId!=i.giftCertificateID}))}),t.GCDetail.length>0&&1==t.IsServiceBaseGC&&i.serviceID==t.ServiceId&&(t.IsServiceBaseGC=!1,i.assignStatus=s.Remove,t.GCDetail=[])})})}),_shopdetail.RecalculateGCAfterPreset(!0)},_shopdetail.ConvertDecimalCustomRound=function(e,t,i){isNaN(parseFloat(e))&&(e=0);let a=e-Math.floor(e);if(a>=.48&&a<=.52)return t?parseFloat((Math.floor(e)+.5).toFixed(i)):parseFloat(parseFloat(Math.floor(e)+.5).toFixed(i));if(a>=.98||a<=.02){if(t){var r=Math.round(e);return parseFloat(r).toFixed(i)}return parseFloat(parseFloat(Math.round(e)).toFixed(i))}return Math.abs(a-.33)<.01?t?parseFloat((Math.floor(e)+.34).toFixed(i)):parseFloat(parseFloat(Math.floor(e)+.34).toFixed(i)):Math.abs(a-.47)<.01?t?parseFloat(e).toFixed(i):parseFloat(parseFloat(e).toFixed(i)):Math.abs(a-.83631)<.01||Math.abs(a-.63)<.01?parseFloat(Math.floor(100*e)/100):parseFloat(parseFloat(e).toFixed(i))},_shopdetail.StartApplePaySession=function(){try{if(e(_shopdetail.Controls.tabApplePay).length>0&&e(_shopdetail.Controls.tabApplePay).is(":visible")&&e(_shopdetail.Controls.tabApplePay).hasClass("w--current")){var t=_shopdetail.GetApplePayAmount();paymentOpenPopup("applepay",t,_shopdetail.GPayApplePaySuccessResponse,_siteBuilderDetail.CommonError)}}catch(e){console.error("Apple Pay session init failed:",e)}return!0},_shopdetail.GetApplePayAmount=function(){try{if("true"==e("#hdnIsCCCapturedAllowed").val().toLowerCase()&&""!=e("#hdnAllowCCCapturedAbove").val()&&gbltotPrice>=parseFloat(e("#hdnAllowCCCapturedAbove").val()))return 0;{if(_shopdetail.BookingDetail&&_shopdetail.BookingDetail.Prepay&&null!=_shopdetail.BookingDetail.Prepay.ccAmt&&null!=_shopdetail.BookingDetail.TipAmount){let e=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.Prepay.ccAmt),t=_shopdetail.parseTodecimal(_shopdetail.BookingDetail.TipAmount);if(!isNaN(e)&&!isNaN(t))return e+t}let t="",i=e("#dvservicesdepositprice").text().trim(),a=i.replace(/[^0-9.]/g,""),r=parseFloat(a);if(i&&!isNaN(r)&&r>0)t=i;else{let i=e("#dvservicesPrepaypricewithoutGC").text().trim(),a=i.replace(/[^0-9.]/g,""),r=parseFloat(a);t=i&&!isNaN(r)&&r>0?i:e("#divServicesTotalPrice").text().trim()}if(!t||""===t)throw new Error("Price text is empty");let o=t.replace(/[^0-9.]/g,"");if(!o||isNaN(o))throw new Error("Invalid price format: "+t);let n=parseFloat(o);if(isNaN(n))throw new Error("Price is not a number after parsing");return n}}catch(e){return console.error("Error while getting Apple Pay Amount:",e.message),null}},_shopdetail.getFirstMiddleLastName=function(e){var t="",i="",a="",r="";try{if(t=e?.first_name||"",i=e?.middle_name||"",a=e?.last_name||"",r=_siteBuilderDetail?.UserLocationInfo?.objUserInfo?.FullName||"",!t&&""!==r.trim()){var o=r.trim().split(/\s+/);1===o.length?t=o[0]:2===o.length?(t=o[0],a=o[1]):(t=o[0],a=o[o.length-1],i=o.slice(1,-1).join(" "))}}catch(e){console.error("Error parsing name info:",e),t=t||"",i=i||"",a=a||"",r=r||""}return{first_name:t,middle_name:i,last_name:a,full_name:r}}}(jQuery,window,document),Date.prototype.addMinutes=function(e){return this.setMinutes(this.getMinutes()+e),this},function(){"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),"function"!=typeof String.prototype.replacequotes&&(String.prototype.replacequotes=function(){return this.replace(/[\\"']/g,"\\$&")});var e=new Array("January","February","March","April","May","June","July","August","September","October","November","December"),t=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");String.prototype.times=function(e){for(var t="",i=0;i<e;i++)t+=this;return t},String.prototype.zp=function(e){return"0".times(e-this.length)+this},Number.prototype.zp=function(e){return this.toString().zp(e)},Date.prototype.newformat=function(i){if(!this.valueOf())return"&nbsp;";var a=this;return i.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|ms|a\/p)/gi,function(i){switch(i.toLowerCase()){case"yyyy":return a.getFullYear();case"mmmm":return e[a.getMonth()];case"mmm":return e[a.getMonth()].substr(0,3);case"mm":return(a.getMonth()+1).zp(2);case"dddd":return t[a.getDay()];case"ddd":return t[a.getDay()].substr(0,3);case"dd":return a.getDate().zp(2);case"hh":return((h=a.getHours()%12)?h:12).zp(2);case"nn":return a.getMinutes().zp(2);case"ss":return a.getSeconds().zp(2);case"ms":return a.getMilliseconds().zp(2);case"a/p":return a.getHours()<12?"AM":"PM"}})}}(),function(e){function t(t,i,a){var r=e(t).eq(0),o=e(i).eq(0),n={pixels_per_second:1e3,initial_css:{background:"#fff",opacity:.8,position:"absolute",top:r.offset().top,left:r.offset().left,height:r.height(),width:r.width(),"z-index":1e5,image:""},square:"",callback:function(){}};a&&a.initial_css&&(a.initial_css=e.extend({},n.initial_css,a.initial_css)),a=e.extend({},n,a);var s=o.innerHeight(),l=o.innerWidth();"height"==a.square.toLowerCase()?l=s:"width"==a.square.toLowerCase()&&(s=l);var d="";""!=a.initial_css.image&&(d="<img src='"+a.initial_css.image+"' style='width: 100%; height: 100%' />");var c=o.offset().top,u=o.offset().left,p=r.offset().top+r.width()/2-o.offset().top,h=r.offset().left+r.height()/2-o.offset().left,m=Math.floor(Math.sqrt(Math.pow(h,2)+Math.pow(p,2)))/a.pixels_per_second*1e3,f=e("<div>"+d+"</div>").css(a.initial_css).appendTo("body").animate({top:c,left:u,height:s,width:l},{duration:m}).animate({opacity:0},{duration:100,complete:function(){return f.remove(),a.callback()}})}e.fn.animate_from_to=function(e,i){return this.each(function(){t(this,e,i)})},e.extend({animate_from_to:t})}(jQuery);ajaxQueue=$({}),currentRequest=null;var vagaroSiteBuilder=function(e){var t={messages:{AjaxError:"An Error Has Occurred"},BaseURLOfWebSiteBuilderAPI:"",BaseURLOfVagaroAPI:"",init:function(e,i){t.BaseURLOfWebSiteBuilderAPI=e,t.BaseURLOfVagaroAPI=i},showhideloader:function(t){t?e("#apgLoading").css("display",""):e("#apgLoading").css("display","none")},ajax:function(){this.datamodel={},this.datamodel.url="",this.datamodel.data="",this.datamodel.callback="",this.datamodel.Token="",this.datamodel.Error,this.datamodel.async=!0,this.datamodel.IsVagaroURL=!0,this.datamodel.IsContentTypeJson=!0,this.datamodel.ErrorMessage="An Error Has Occurred",this.datamodel.GroupToken="",this.Post=function(){t.showhideloader(!0);var i=this.datamodel,a="application/json; charset=utf-8",r=JSON.stringify(i.data);0==this.datamodel.IsContentTypeJson&&(a=!1,r=i.data);this.datamodel.GroupToken;e.ajax({url:this.seturl(1,this.datamodel.Token),type:"POST",contentType:a,processData:!1,beforeSend:function(e){"undefined"!=typeof groupID&&e.setRequestHeader("grouptoken",groupID)},async:i.async,data:r,dataType:"json"}).done(function(e){t.showhideloader(!1),i.callback(e)}).fail(function(e){t.showhideloader(!1);try{if(403===e.status)return void location.reload(!0)}catch(e){}if(""!=i.ErrorMessage){try{ShowLoader(!1)}catch(e){}t.alert({message:i.ErrorMessage,title:"Oops!"})}void 0!==i.Error&&i.Error(e)})},this.PostQue=function(){if("undefined"==typeof keepAlive&&e("#IsWaitforKeepALive").length>0&&void 0!==e("#IsWaitforKeepALive").val()&&"true"===e("#IsWaitforKeepALive").val().toLowerCase()){var i=e(this),a=this.datamodel.url,r=this.datamodel.data,o=this.datamodel.callback,n=this.datamodel.Token,s=this.datamodel.Error,l=this.datamodel.async,d=this.datamodel.ErrorMessage;setTimeout(function(){i[0].datamodel.url=a,i[0].datamodel.data=r,i[0].datamodel.callback=o,i[0].datamodel.Token=n,i[0].datamodel.Error=s,i[0].datamodel.async=l,i[0].datamodel.ErrorMessage=d,i[0].PostQue()},500)}else{var c=this.datamodel,u={};u.Data=""+JSON.stringify(c.data),u.Token=c.Token,this.que({url:this.seturl(1,this.datamodel.Token),type:"POST",contentType:"application/json; charset=utf-8",beforeSend:function(e){},data:JSON.stringify(u),dataType:"json",success:function(e){c.callback(e.d)},error:function(e){try{if(403===e.status)return void location.reload(!0)}catch(e){}if("abort"!=e.statusText){if(""!=c.ErrorMessage){try{ShowLoader(!1)}catch(e){}t.alert({message:c.ErrorMessage,title:"Oops!"})}void 0!==c.Error&&c.Error(e)}}})}},this.que=function(t){var i=t.complete;ajaxQueue.clearQueue(),currentRequest&&currentRequest.abort(),ajaxQueue.queue(function(a){t.complete=function(){i&&i.apply(this,arguments),a()},currentRequest=e.ajax(t)})},this.Get=function(){e.ajax({url:this.seturl(this.datamodel.url,this.datamodel.Token),type:"GET",data:JSON.stringify(this.datamodel.data),dataType:"json"}).done(function(e){this.datamodel.callback(e)}).fail(function(e){this.datamodel.ErrorMessage.length>0&&(ShowLoader(!1),t.alert({message:Model.ErrorMessage,title:"Oops!"})),"undefined"!=this.datamodel.Error&&this.datamodel.Error(e)})},this.seturl=function(e,i){var a=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";return a=1==this.datamodel.IsVagaroURL?t.BaseURLOfVagaroAPI:t.BaseURLOfWebSiteBuilderAPI,1==e&&(a+=i),a}},alert:function(e,t){if("undefined"!=typeof bootbox){if(0==vagaroSiteBuilder.isNullUndefined(e)){var i={message:e,callback:0==vagaroSiteBuilder.isNullUndefined(t)?t:null};bootbox.alert(i)}}else ShowPopupAlert(e,1,null)},alertWithTitle:function(e,t,i){if("undefined"!=typeof bootbox){if(0==vagaroSiteBuilder.isNullUndefined(e)){var a={message:e,title:0==vagaroSiteBuilder.isNullUndefined(t)?t:null,callback:0==vagaroSiteBuilder.isNullUndefined(i)?i:null};bootbox.alert(a)}}else ShowPopupAlert(e,1,null)},alertsmall:function(e,t,i){if("undefined"!=typeof bootbox){if(0==vagaroSiteBuilder.isNullUndefined(e)){var a={message:e,title:0==vagaroSiteBuilder.isNullUndefined(t)?t:null,callback:0==vagaroSiteBuilder.isNullUndefined(i)?i:null};bootbox.alertsmall(a)}}else ShowPopupAlert(e,1,null)},alertmidium:function(e,t){if("undefined"!=typeof bootbox){if(0==vagaroSiteBuilder.isNullUndefined(e)){var i={message:e,className:"vagaro-midium-popup",callback:0==vagaroSiteBuilder.isNullUndefined(t)?t:null};bootbox.alert(i)}}else ShowPopupAlert(e,1,null)},confirm:function(e,t,i){if("undefined"!=typeof bootbox&&0==vagaroSiteBuilder.isNullUndefined(e)){vagaroSiteBuilder.isNullUndefined(i)&&(i="Confirm");var a={title:i,message:e,buttons:{cancel:{label:"No"},confirm:{label:"Yes"}},callback:t};bootbox.confirm(a)}},confirmLarge:function(e,t,i,a){if("undefined"!=typeof bootbox&&0==vagaroSiteBuilder.isNullUndefined(e)){vagaroSiteBuilder.isNullUndefined(i)&&(i="Confirm"),vagaroSiteBuilder.isNullUndefined(a)&&(a="");var r={className:a,size:"large",title:i,message:e,buttons:{cancel:{label:"No"},confirm:{label:"Yes"}},callback:t};bootbox.confirm(r)}},confirmsmall:function(e,t){if("undefined"!=typeof bootbox&&0==vagaroSiteBuilder.isNullUndefined(e)){var i={message:e,callback:0==vagaroSiteBuilder.isNullUndefined(t)?t:null,size:"small"};bootbox.confirm(i)}},prompt:function(e,t){if("undefined"!=typeof bootbox&&0==vagaroSiteBuilder.isNullUndefined(e)){var i={title:e,callback:0==vagaroSiteBuilder.isNullUndefined(t)?t:null,size:"small"};bootbox.prompt(i)}},ajaxCall:function(e,i,a,r,o,n,s,l){var d=new t.ajax;d.datamodel.Token=e,d.datamodel.data=i,d.datamodel.callback=a,d.datamodel.Error=r,void 0!==n&&0==n&&(d.datamodel.IsVagaroURL=n),void 0!==s&&0==s&&(d.datamodel.IsContentTypeJson=s),void 0!==l&&1==l&&(d.datamodel.ErrorMessage=_checkout.Empty),o?d.PostQue():d.Post()},getQuerystring:function(t){for(var i=window.location.search.substring(1).split("&"),a="",r=0;r<i.length;r++){var o=i[r].split("=");o[0].toLowerCase()==t.toLowerCase()&&(a=o[1])}if(""==a&&i.length<=1)switch(t.toLowerCase()){case"templateid":a=e("#hdnTemplateID").val();break;case"businessid":a=e("#hdnSBusinessID").val();break;case"userid":a=e("#hdnSUserID").val();break;case"iscustomsite":a=e("#hdnSIsCustomSite").val();break;case"issuperadmin":a=e("#hdnSIsSuperAdmin").val();break;case"groupid":a=e("#hdnSGroupId").val();break;case"usertype":a=e("#hdnSUserType").val()}return a},getVgAppicationType:function(){var e=0,t=null!=navigator.userAgent?navigator.userAgent:"";return t.toLowerCase().indexOf("com.vagaro.customer")>-1&&(e=1),(t.toLowerCase().indexOf("com.vagaro.androidcheckin")>-1||t.toLowerCase().indexOf("com.vagaro.ioscheckin")>-1)&&(e=2),e},checkIsBrandedApp:function(){var e=!1;return(null!=navigator.userAgent?navigator.userAgent:"").toLowerCase().indexOf("brandedapp")>-1&&(e=!0),e},isNullUndefined:function(e){return void 0===e||null==e||""==e},isNullUndefinedZero:function(e){return!(!vagaroSiteBuilder.isNullUndefined(e)&&0!=e)},openWindow:function(e,t){return window.open(e,t)},showAjaxErrorAlert:function(e){t.isNullUndefined(e)&&(e=t.messages.AjaxError),t.alertsmall(e,"Oops!")},getIsNewCustomTemplate:function(){return void 0===e("#hdnIsNewCustomTemplate").val()||""===e("#hdnIsNewCustomTemplate").val()?"false":e("#hdnIsNewCustomTemplate").val().toLowerCase()},IsChromeBrowser:function(){return!vagaroSiteBuilder.isNullUndefined(/ Edge\/(\d+)/.exec(navigator.userAgent))}};return t}(jQuery);function ShowPopupAlert(e,t,i){alert(e)}var _carouselWebsiteBuilder=function(e){var t={elm:null,iframeContentsBody:null,init:function(i,a){t.elm=i.attr("id");try{t.iframeContentsBody=_websiteDesigner.getIframeContent().find(".pagebodycontainer")}catch(i){t.iframeContentsBody=e(".pagebodycontainer")}t.isNullUndefined(a.duration)?a.duration=4e3:a.duration=1e3*parseFloat(a.duration.replace("sec","")),t.iframeContentsBody.find("#"+t.elm).carousel({interval:a.duration}),!0===a.start?t.startShow():!1===a.start&&t.stopShow()},startShow:function(){t.iframeContentsBody.find("#"+t.elm).carousel("cycle")},stopShow:function(){t.iframeContentsBody.find("#"+t.elm).carousel("pause")},prevArrowclick:function(i){t.elm=e(i).closest(_siteBuilderDetail.VgCustomComponent).find(".carousel").attr("id"),config=JSON.parse(e(i).closest(_siteBuilderDetail.VgCustomComponent).attr("data-config")),e("#"+t.elm).carousel("prev"),config.start?e("#"+t.elm).carousel("cycle"):e("#"+t.elm).carousel("pause")},nextArrowclick:function(i){t.elm=e(i).closest(_siteBuilderDetail.VgCustomComponent).find(".carousel").attr("id"),config=JSON.parse(e(i).closest(_siteBuilderDetail.VgCustomComponent).attr("data-config")),e("#"+t.elm).carousel("next"),config.start?e("#"+t.elm).carousel("cycle"):e("#"+t.elm).carousel("pause")},updateDuration:function(i,a){t.elm=i.attr("id");try{t.iframeContentsBody=_websiteDesigner.getIframeContent().find(".pagebodycontainer")}catch(i){t.iframeContentsBody=e(".pagebodycontainer")}t.isNullUndefined(a.duration)?a.duration=4e3:a.duration=1e3*parseFloat(a.duration.replace("sec","")),t.iframeContentsBody.find("#"+t.elm).carousel({interval:a.duration})},changeNavigation:function(i,a){try{t.iframeContentsBody=_websiteDesigner.getIframeContent().find(".pagebodycontainer")}catch(i){t.iframeContentsBody=e(".pagebodycontainer")}t.iframeContentsBody.find(i).carousel(a)},isNullUndefined:function(e){return null==e||""===e}};return t}(jQuery),_componentContainer=function(e){var t={init:function(t,i,a){var r=e("#hdnSiteBuilderBusinessID").val();vagaroSiteBuilder.isNullUndefined(r)?alert("Invalid Request !!"):(window.location.href.toLowerCase().indexOf("http://")>=0&&(t=t.replace("https","http")),e.get(t,function(t){e(t).appendTo("#dvStyleComponentScripts"),_siteBuilderDetail.PageLoadComponent();var i=new URL(window.location.href);i.searchParams.has("isfromApp")&&(_siteBuilderDetail.connectcurrentUrl=!0,i.searchParams.delete("isfromApp"),window.history.replaceState({},document.title,i.toString()),_siteBuilderDetail.isVConnectBetaRelease=JSON.parse(e("#hdnVConnectBetaRelease").val().toLowerCase()),setTimeout(function(){_siteBuilderDetail.sendMessagetoprovider()},2e3))}))},getBusinessID:function(){return e("#hdnSiteBuilderBusinessID").val()},getUserID:function(){return e("#hdnUserId").val()},isNewCustomWebsite:function(){return e("#hdnSiteBuilderIsNewCustomTemplate").val()}};return t}(jQuery);function successHEICtoJPG(e,t){isIOSCallback()&&(e=unescape(e));var i,a=JSON.parse(e);i=isIOSCallback()?a.images:JSON.parse(a.images);try{var r,o=dataURLtoFile(i[0].base64,i[0].imageName),n=new FileReader,s=new FormData;switch(a.fromPage){case"userprofilefromemployee":case"servicemenu":case"manageinventory":uploadFile(null,!0,o);break;case"zenswipe":_vagroNotification.uploadFileMobile(a.uploadfrom,!0,o);break;case"servicebundle":t?uploadFile(null,!0,o):$("#iFrame_divpackagesBundle").length>0&&document.getElementById("iFrame_divpackagesBundle").contentWindow.uploadFile(null,!0,o);break;case"businessphotogallery":case"brandedappbusinessphoto":uploadFile(a.parent,!0,o);break;case"checkinappbusinessphoto":_CheckInSettings.uploadFile(a.parent,!0,o);break;case"addemployeefromservice":t?uploadFile(null,!0,o):$("#iFrame_divAddUserPopup").length>0&&document.getElementById("iFrame_divAddUserPopup").contentWindow.uploadFile(null,!0,o);break;case"designgiftcertificate":n.readAsDataURL(o),n.onload=function(e){_designGC.setUploadedImage(e.target.result,o,parent)};break;case"userprofilefromcustomerapp":s.append("file",o),uploadWebHook(r="/AjaxFileHandler.ashx?PageType=2&OldtempImagename="+a.oldFile+"&UserID="+a.userID,s,function(e){uploadCustomerAppProfileFileSuccess(e.responseJSON)},function(e){uploadCustomerAppProfileFileFailure(e)});break;case"customerappreview":n.readAsArrayBuffer(o),n.onload=function(e){_shopdetail.parseOrientation(_shopdetail.getOrientation(e.target.result),o,e.target.result)};break;case"imagegallery":if(null!=a.businessId&&null!=a.businessId&&parseInt(a.businessId)>0&&"function"==typeof AddImageToAzure){var l={BusinessID:a.businessId,FileContent:i[0].base64.includes("base64,")?i[0].base64.split("base64,")[1]:i[0].base64,FileName:i[0].imageName};AddImageToAzure(l,!1)}break;case"imagegalleryMultiple":if(null!=a.businessId&&null!=a.businessId&&parseInt(a.businessId)>0&&"function"==typeof AddImageToAzure){l={BusinessID:a.businessId,FileContent:i[0].base64.includes("base64,")?i[0].base64.split("base64,")[1]:i[0].base64,FileName:i[0].imageName};AddImageToAzure(l,!0)}break;case"customerappreviewfrombusiness":n.readAsArrayBuffer(o),n.onload=function(e){_siteBuilderDetail.parseOrientation(_siteBuilderDetail.getOrientation(e.target.result),o,e.target.result)};break;case"uploadcontroltoAjax":s.append("file",o);location.protocol,location.hostname,location.port&&location.port;r="/AjaxFileHandler.ashx?type="+a.type+"&PageType="+a.pageType+"&OldtempImagename="+a.oldtempImagename+"&UserID="+a.userID+"&LoginUserID="+a.loginUserID+"&IsDBEntryPending="+a.isDBEntryPending+"&IsPhotoEditor="+a.isPhotoEditor+"&DummyType="+a.dummyType+"&IsAdmin="+a.isAdmin,"servicemanagement"==a.type&&(r="/AjaxFileHandler.ashx?type=servicemenu&IsPhotoEditor=False&DummyType="+a.dummyType+"&IsAdmin="+a.isAdmin+"&BID="+a.businessID),uploadWebHook(r,s,function(e){if(t)uploadControlImageFileSuccess(e,a.isPhotoEditor,a.type);else{var i=$("#iFrame_divpackagesBundle").contents(),r=$("#iFrame_divAddUserPopup").contents(),o=$("iframe[name=RadWindow1],iframe[name=rwUpload],iframe[id=iFrame_divpackagesBundle]");o.length>0&&void 0!==o[0].contentWindow.uploadControlImageFileSuccess&&$("iframe[name=RadWindow1],iframe[name=rwUpload],iframe[id=iFrame_divpackagesBundle]")[0].contentWindow.uploadControlImageFileSuccess(e,a.isPhotoEditor,a.type),i.find("iframe[name=rwUpload]").length>0&&void 0!==i.find("iframe[name=rwUpload]")[0].contentWindow.uploadControlImageFileSuccess&&i.find("iframe[name=rwUpload]")[0].contentWindow.uploadControlImageFileSuccess(e,a.isPhotoEditor,a.type),r.find("iframe[name=rwUpload]").length>0&&void 0!==r.find("iframe[name=rwUpload]")[0].contentWindow.uploadControlImageFileSuccess&&r.find("iframe[name=rwUpload]")[0].contentWindow.uploadControlImageFileSuccess(e,a.isPhotoEditor,a.type)}},function(e){ShowMessageOnError("Something went wrong, please try again.")});break;case"formsaveresponse":a.eventType="heicSucessResponseFromVagaro",vuiForms.frame.forms.heicSucessResponseFromVagaro(a)}}catch(e){ShowMessageOnError("Something went wrong, please try again.")}}function HEICReadFile(e,t){var i=new FileReader;i.onload=t,i.readAsDataURL(e)}function dataURLtoFile(e,t){for(var i=e.split(","),a=i[0].match(/:(.*?);/)[1],r=atob(i[1]),o=r.length,n=new Uint8Array(o);o--;)n[o]=r.charCodeAt(o);return new File([n],t,{type:a})}function HEICtoJPGPostMessage(e,t){if(navigator.userAgent.toLowerCase().indexOf("safari")<0&&(navigator.userAgent.toLowerCase().indexOf("iphone")>-1||navigator.userAgent.toLowerCase().indexOf("ipad")>-1)){var i=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"";t&&(i.indexOf("com.vagaro.customerios")>-1||i.indexOf("com.vagaro.customerios-brandedapp")>-1)?window.location="js-call:myObjectiveCFunction:"+e:null!=window.JSInterface?window.JSInterface.CallWSMethod(e):window.location="js-call:myObjectiveCFunction:"+e}else navigator.userAgent.toLowerCase().indexOf("android")>-1&&null!=window.JSInterface&&window.JSInterface.CallWSMethod(e)}function uploadWebHook(e,t,i,a){$.ajax({type:"POST",contentType:!1,processData:!1,dataType:"json",url:e,data:t,complete:i,error:a})}function getMobileAppType(){var e=0,t=null!=navigator.userAgent?navigator.userAgent:"";return(t.toLowerCase().indexOf("com.vagaro.customerandroid")>-1||t.toLowerCase().indexOf("com.vagaro.customerios")>-1)&&(e=1),(t.toLowerCase().indexOf("com.vagaro.androidcheckin")>-1||t.toLowerCase().indexOf("com.vagaro.ioscheckin")>-1)&&(e=2),(t.toLowerCase().indexOf("com.vagaro.androidpro")>-1||t.toLowerCase().indexOf("com.vagaro.iospro")>-1)&&(e=3),e}function isValidMobileAppVersion(){var e,t=0,i=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"";if(i.indexOf("com.vagaro.customerandroid-brandedapp")>-1||i.indexOf("com.vagaro.customerios-brandedapp")>-1?t=4:i.indexOf("com.vagaro.androidcheckin")>-1||i.indexOf("com.vagaro.ioscheckin")>-1?t=2:i.indexOf("com.vagaro.androidpro")>-1||i.indexOf("com.vagaro.iospro")>-1?t=3:(i.indexOf("com.vagaro.customerandroid")>-1||i.indexOf("com.vagaro.customerios")>-1)&&(t=1),t<=0)return!1;var a="";if(1==t||4==t)a=i.split("(vagaroapp")[1].trim().split(")")[0];else if(2==t){var r=i.indexOf("com.vagaro.ioscheckin")>-1?"com.vagaro.ioscheckin":"com.vagaro.androidcheckin";a=i.split(r)[0].trim().split(" ").pop()}else 3==t&&(i.indexOf("com.vagaro.iospro")>-1?a=i.split("(vagaropro")[1].trim().split(")")[0]:"undefined"!=typeof _versionPro&&(a=_versionPro));return(a=a.toString().replace(".","")).length<3&&(a+="0"),e=parseInt(a.toString().replace(/\./g,"")),i.indexOf("com.vagaro.customerandroid-brandedapp")>-1&&e>=160||(i.indexOf("com.vagaro.customerandroid")>-1&&e>=471||(i.indexOf("com.vagaro.androidcheckin")>-1&&e>=120||(i.indexOf("com.vagaro.androidpro")>-1&&e>=459||(i.indexOf("com.vagaro.customerios-brandedapp")>-1&&e>=160||(i.indexOf("com.vagaro.customerios")>-1&&e>=361||(i.indexOf("com.vagaro.ioscheckin")>-1&&e>=112||i.indexOf("com.vagaro.iospro")>-1&&e>=435))))))}function ShowMessageOnError(e){swal({title:e,text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn"},function(e){swal.close()})}function isIOSCallback(){return navigator.userAgent.toLowerCase().indexOf("safari")<0&&(navigator.userAgent.toLowerCase().indexOf("iphone")>-1||navigator.userAgent.toLowerCase().indexOf("ipad")>-1)}function isValidFile(e,t){return null!=(t=t.toLowerCase()).match(e)||!(null==t.match(/(HEIC|heic)$/i)||!isValidMobileAppVersion()&&!isWebBrowserSupportHEIC())}function isValidFileWeb(e,t){return null!=(t=t.toLowerCase()).match(e)||!(null==t.match(/(HEIC|heic)$/i)||!isWebBrowserSupportHEIC())}function isWebBrowserSupportHEIC(){var e=detect.parse(navigator.userAgent),t=e.browser.family.toLowerCase(),i=parseInt(e.browser.version),a=!!document.documentMode,r=!a&&!!window.StyleMedia;return!a&&!r&&(t.indexOf("chrome")>-1&&i>67||t.indexOf("firefox")>-1&&i>61||t.indexOf("safari")>-1&&i>11.1)}function saveJPEGFromHEICWeb(e,t){heic2any({blob:e,toType:"image/jpeg"}).then(function(e){new ImageCompressor(e,{quality:.6,mimeType:"image/jpeg",convertSize:5e6,success:function(e){HEICReadFile(e,function(e){var i=JSON.parse(t);i.images[0].base64=e.target.result,i.images=JSON.stringify(i.images),successHEICtoJPG(JSON.stringify(i),!0)})},error:function(e){console.log(e.message),ShowMessageOnError("Something went wrong, please try again.")}})}).catch(function(e){console.log(e.message),ShowMessageOnError("Something went wrong, please try again.")})}function getJPEGFileFromHEICWeb(e,t,i){heic2any({blob:e,toType:"image/jpeg"}).then(function(e){if(e.size>1048576)new ImageCompressor(e,{quality:.6,mimeType:"image/jpeg",convertSize:5e6,success:function(e){var a=new File([e],t,{type:"image/jpeg"});i(a)},error:function(e){console.log(e.message),ShowMessageOnError("Something went wrong, please try again.")}});else{var a=new File([e],t,{type:"image/jpeg"});i(a)}}).catch(function(e){console.log(e.message),ShowMessageOnError("Something went wrong, please try again.")})}function saveJPEGFileFromHEICWeb(e,t){HEICReadFile(e,function(e){t.images[0].base64=e.target.result,t.images=JSON.stringify(t.images),successHEICtoJPG(JSON.stringify(t),!0)})}!function(e,t,i,a){"use strict";function r(){return v.isValid()}function o(){function e(e,t,i,a,r){var o,l,d,c,u,p,h;for((d=t-e)<-1&&(d=-1),s<(c=t+e)&&(c=s),o=t+1,l=t-1,p=1;o<c||d<l;){if(u=b[p++],o<c){h=n[o++];try{h[0]-=u*(h[0]-i)/v|0,h[1]-=u*(h[1]-a)/v|0,h[2]-=u*(h[2]-r)/v|0}catch(e){}}if(d<l){h=n[l--];try{h[0]-=u*(h[0]-i)/v|0,h[1]-=u*(h[1]-a)/v|0,h[2]-=u*(h[2]-r)/v|0}catch(e){}}}}function t(e,t,i){var a,r,o,l,u,g,v,A,b,S;for(b=A=~(1<<31),v=g=-1,a=0;a<s;a++)(r=(S=n[a])[0]-e)<0&&(r=-r),(o=S[1]-t)<0&&(o=-o),r+=o,(o=S[2]-i)<0&&(o=-o),(r+=o)<A&&(A=r,g=a),(l=r-(C[a]>>c-d))<b&&(b=l,v=a),u=y[a]>>h,y[a]-=u,C[a]+=u<<p;return y[g]+=m,C[g]-=f,v}var i,a,r,o,n,s=256,l=s-1,d=4,c=16,u=1<<c,p=10,h=10,m=u>>h,f=u<<p-h,g=64*(s>>3),v=1<<18,A=[],C=[],y=[],b=[];(function(e,t,i){var l,c;for(a=e,r=t,o=i,n=new Array(s),l=0;l<s;l++)n[l]=new Array(4),(c=n[l])[0]=c[1]=c[2]=(l<<d+8)/s|0,y[l]=u/s|0,C[l]=0}).apply(this,arguments);var S={map:function(e,t,i){var a,r,o,l,d,c,u;for(d=1e3,u=-1,r=(a=A[t])-1;a<s||0<=r;)a<s&&(d<=(o=(c=n[a])[1]-t)?a=s:(a++,o<0&&(o=-o),(l=c[0]-e)<0&&(l=-l),(o+=l)<d&&((l=c[2]-i)<0&&(l=-l),(o+=l)<d&&(d=o,u=c[3])))),0<=r&&(d<=(o=t-(c=n[r])[1])?r=-1:(r--,o<0&&(o=-o),(l=c[0]-e)<0&&(l=-l),(o+=l)<d&&((l=c[2]-i)<0&&(l=-l),(o+=l)<d&&(d=o,u=c[3]))));return u},process:function(){return function(){var s,l,c,u,p,h,m,f,v,A,C,y,S,k,D,_,I,w,P;for(r<1509&&(o=1),i=30+(o-1)/3,y=a,A=(C=(k=r)/(3*o))/100|(S=0),f=1024,(m=(h=g)>>6)<=1&&(m=0),s=0;s<m;s++)b[s]=f*(256*(m*m-s*s)/(m*m));for(v=r<1509?3:r%499!=0?1497:r%491!=0?1473:r%487!=0?1461:1509,s=0;s<C;)if(l=t(c=(255&y[S+0])<<d,u=(255&y[S+1])<<d,p=(255&y[S+2])<<d),D=c,_=u,I=p,w=void 0,P=f/1024,(w=n[l])[0]-=P*(w[0]-D)|0,w[1]-=P*(w[1]-_)|0,w[2]-=P*(w[2]-I)|0,0!==m&&e(m,l,c,u,p),k<=(S+=v)&&(S-=r),0===A&&(A=1),++s%A==0)for(f-=f/i,(m=(h-=h/30)>>6)<=1&&(m=0),l=0;l<m;l++)b[l]=f*(256*(m*m-l*l)/(m*m))}(),function(){var e;for(e=0;e<s;e++)n[e][0]>>=d,n[e][1]>>=d,n[e][2]>>=d,n[e][3]=e}(),function(){var e,t,i,a,r,o,d,c;for(e=c=d=0;e<s;e++){for(a=(r=n[i=e])[1],t=e+1;t<s;t++)(o=n[t])[1]<a&&(i=t,a=o[1]);if(o=n[i],e!=i&&(t=o[0],o[0]=r[0],r[0]=t,t=o[1],o[1]=r[1],r[1]=t,t=o[2],o[2]=r[2],r[2]=t,t=o[3],o[3]=r[3],r[3]=t),a!=d){for(A[d]=c+e>>1,t=d+1;t<a;t++)A[t]=e;d=a,c=e}}for(A[d]=c+l>>1,t=d+1;t<256;t++)A[t]=l}(),function(){for(var e=[],t=new Array(s),i=0;i<s;i++)t[n[i][3]]=i;for(var a=0,r=0;r<s;r++){var o=t[r];e[a++]=n[o][0],e[a++]=n[o][1],e[a++]=n[o][2]}return e}()}};return S}function n(){try{this.onmessage=function(t){var i,a=t.data||{};a.gifshot&&(i=e.run(a),postMessage(i))}}catch(e){}var e={dataToRGB:function(e,t,i){for(var a=t*i*4,r=0,o=[];r<a;)o.push(e[r++]),o.push(e[r++]),o.push(e[r++]),r++;return o},componentizedPaletteToArray:function(e){e=e||[];for(var t=[],i=0;i<e.length;i+=3){var a=e[i],r=e[i+1],o=e[i+2];t.push(a<<16|r<<8|o)}return t},processFrameWithQuantizer:function(e,t,i,a){for(var r=this.dataToRGB(e,t,i),n=new o(r,r.length,a),s=n.process(),l=new Uint32Array(this.componentizedPaletteToArray(s)),d=t*i,c=new Uint8Array(d),u=0,p=0;p<d;p++){var h=r[u++],m=r[u++],f=r[u++];c[p]=n.map(h,m,f)}return{pixels:c,palette:l}},run:function(e){var t=(e=e||{}).height,i=(e.palette,e.sampleInterval),a=e.width,r=e.data;return this.processFrameWithQuantizer(r,a,t,i)}};return e}function s(e,t,i,r){var o=0,n=(r=r===a?{}:r).loop===a?null:r.loop,s=r.palette===a?null:r.palette;if(t<=0||i<=0||65535<t||65535<i)throw"Width/Height invalid.";if(e[o++]=71,e[o++]=73,e[o++]=70,e[o++]=56,e[o++]=57,e[o++]=97,e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=0|(null!==s?128:0),e[o++]=0,e[o++]=0,null!==n){if(n<0||65535<n)throw"Loop count invalid.";e[o++]=33,e[o++]=255,e[o++]=11,e[o++]=78,e[o++]=69,e[o++]=84,e[o++]=83,e[o++]=67,e[o++]=65,e[o++]=80,e[o++]=69,e[o++]=50,e[o++]=46,e[o++]=48,e[o++]=3,e[o++]=1,e[o++]=255&n,e[o++]=n>>8&255,e[o++]=0}var l=!1;this.addFrame=function(t,i,r,n,d,c){if(!0===l&&(--o,l=!1),c=c===a?{}:c,t<0||i<0||65535<t||65535<i)throw"x/y invalid.";if(r<=0||n<=0||65535<r||65535<n)throw"Width/Height invalid.";if(d.length<r*n)throw"Not enough pixels for the frame size.";var u=!0,p=c.palette;if(p!==a&&null!==p||(u=!1,p=s),p===a||null===p)throw"Must supply either a local or global palette.";for(var h=function(e){var t=e.length;if(t<2||256<t||t&t-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return t}(p),m=0;h>>=1;)++m;h=1<<m;var f=c.delay===a?0:c.delay,g=c.disposal===a?0:c.disposal;if(g<0||3<g)throw"Disposal out of range.";var v=!1,A=0;if(c.transparent!==a&&null!==c.transparent&&(v=!0,(A=c.transparent)<0||h<=A))throw"Transparent color index.";if(0===g&&!v&&0===f||(e[o++]=33,e[o++]=249,e[o++]=4,e[o++]=g<<2|(!0===v?1:0),e[o++]=255&f,e[o++]=f>>8&255,e[o++]=A,e[o++]=0),e[o++]=44,e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=255&n,e[o++]=n>>8&255,e[o++]=!0===u?128|m-1:0,!0===u)for(var C=0,y=p.length;C<y;++C){var b=p[C];e[o++]=b>>16&255,e[o++]=b>>8&255,e[o++]=255&b}o=function(e,t,i,r){function o(i){for(;i<=h;)e[t++]=255&m,m>>=8,h-=8,t===s+256&&(e[s]=255,s=t++)}function n(e){m|=e<<h,h+=p,o(8)}e[t++]=i;var s=t++,l=1<<i,d=l-1,c=1+l,u=1+c,p=i+1,h=0,m=0,f=r[0]&d,g={};n(l);for(var v=1,A=r.length;v<A;++v){var C=r[v]&d,y=f<<8|C,b=g[y];if(b===a){for(m|=f<<h,h+=p;8<=h;)e[t++]=255&m,m>>=8,h-=8,t===s+256&&(e[s]=255,s=t++);4096===u?(n(l),u=1+c,p=i+1,g={}):(1<<p<=u&&++p,g[y]=u++),f=C}else f=b}return n(f),n(c),o(1),s+1===t?e[s]=0:(e[s]=t-s-1,e[t++]=0),t}(e,o,m<2?2:m,d)},this.end=function(){return!1===l&&(e[o++]=59,l=!0),o}}function l(e){e=f.isObject(e)?e:{},D.stopVideoStreaming(e)}function d(e,i){var a=e.options||{},r=a.images,o=a.video,n=Number(a.gifWidth),s=Number(a.gifHeight),d=(Number(a.numFrames),e.cameraStream),c=e.videoElement,u=e.videoWidth,p=e.videoHeight,h=k.getCropDimensions({videoWidth:u,videoHeight:p,gifHeight:s,gifWidth:n}),m=i;a.crop=h,a.videoElement=c,a.videoWidth=u,a.videoHeight=p,a.cameraStream=d,f.isElement(c)&&(c.width=n+h.width,c.height=s+h.height,a.webcamVideoElement||(f.setCSSAttr(c,{position:"fixed",opacity:"0"}),t.body.appendChild(c)),c.play(),k.getGIF(a,function(e){r&&r.length||o&&o.length||l(e),m(e)}))}function c(e,i){if(i=f.isFunction(e)?e:i,e=f.isObject(e)?e:{},f.isFunction(i)){var o=f.mergeOptions(C,e)||{},n=e.cameraStream,s=o.images,l=s?s.length:0,c=o.video,u=o.webcamVideoElement;o=f.mergeOptions(o,{gifWidth:Math.floor(o.gifWidth),gifHeight:Math.floor(o.gifHeight)}),l?function(e){function i(){var e;f.each(c,function(e,t){t&&(t.text?h.addFrame(t.img,s,t.text):h.addFrame(t,s))}),e=o,h.getBase64GIF(function(t){e({error:!1,errorCode:"",errorMsg:"",image:t})})}var r=0<arguments.length&&e!==a?e:{},o=r.callback,n=r.images,s=r.options,l=r.imagesLength,d=v.validate({getUserMedia:!0,"window.URL":!0}),c=[],u=0,p=void 0,h=void 0;d.error?o(d):(h=new b(s),f.each(n,function(e,a){var r,n=a;a.src&&(n=n.src),f.isElement(n)?(s.crossOrigin&&(n.crossOrigin=s.crossOrigin),c[e]=n,(u+=1)===l&&i()):f.isString(n)&&(p=new Image,s.crossOrigin&&(p.crossOrigin=s.crossOrigin),r=p,a.text&&(r.text=a.text),r.onerror=function(){var e=void 0;return 0===--l?((e={}).error="None of the requested images was capable of being retrieved",o(e)):void 0},r.onload=function(){c[e]=a.text?{img:r,text:r.text}:r,(u+=1)===l&&i(),f.removeElement(r)},r.src=n,f.setCSSAttr(p,{position:"fixed",opacity:"0"}),t.body.appendChild(p))}))}({images:s,imagesLength:l,callback:i,options:o}):c?function(e){var t=0<arguments.length&&e!==a?e:{},i=t.callback,r=t.existingVideo,o=t.options,n=v.validate({getUserMedia:!0,"window.URL":!0}),s=void 0,l=void 0;if(n.error)return i(n);if(f.isElement(r)&&r.src){if(l=r.src,s=f.getExtension(l),!f.isSupported.videoCodecs[s])return i(v.messages.videoCodecs)}else f.isArray(r)&&f.each(r,function(e,t){return s=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),f.isSupported.videoCodecs[s]?(r=t,!1):void 0});D.startStreaming({completed:function(e){e.options=o||{},d(e,i)},existingVideo:r,crossOrigin:o.crossOrigin,options:o})}({existingVideo:c,callback:i,options:o}):function(e){var t=0<arguments.length&&e!==a?e:{},i=t.callback,o=t.lastCameraStream,n=t.options,s=t.webcamVideoElement;r()?n.savedRenderingContexts.length?k.getGIF(n,function(e){i(e)}):D.startVideoStreaming(function(){var e=0<arguments.length&&arguments[0]!==a?arguments[0]:{};e.options=n||{},d(e,i)},{lastCameraStream:o,callback:i,webcamVideoElement:s,crossOrigin:n.crossOrigin}):i(v.validate())}({lastCameraStream:n,callback:i,webcamVideoElement:u,options:o})}}function u(){}function p(){}var h,m,f={URL:e.URL||e.webkitURL||e.mozURL||e.msURL,getUserMedia:(m=i.getUserMedia||i.webkitGetUserMedia||i.mozGetUserMedia||i.msGetUserMedia)?m.bind(i):m,requestAnimFrame:e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame,requestTimeout:function(e,t){if(e=e||f.noop,t=t||0,!f.requestAnimFrame)return setTimeout(e,t);var i=(new Date).getTime(),a=new Object,r=f.requestAnimFrame;return a.value=r(function o(){var n=(new Date).getTime();t<=n-i?e.call():a.value=r(o)}),a},Blob:e.Blob||e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,btoa:(h=e.btoa||function(e){for(var t="",i=0,a=e.length,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,n=void 0,s=void 0,l=void 0,d=void 0,c=void 0,u=void 0;i<a;)l=(o=e.charCodeAt(i++))>>2,d=(3&o)<<4|(n=e.charCodeAt(i++))>>4,c=(15&n)<<2|(s=e.charCodeAt(i++))>>6,u=63&s,isNaN(n)?c=u=64:isNaN(s)&&(u=64),t=t+r.charAt(l)+r.charAt(d)+r.charAt(c)+r.charAt(u);return t})?h.bind(e):f.noop,isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return f.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=t.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return e.Worker},blob:function(){return f.Blob},Uint8Array:function(){return e.Uint8Array},Uint32Array:function(){return e.Uint32Array},videoCodecs:function(){var e=t.createElement("video"),i={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(i.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),i.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),i.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),i.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),i.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return i}()},noop:function(){},each:function(e,t){var i=void 0,a=void 0;if(f.isArray(e))for(i=-1,a=e.length;++i<a&&!1!==t(i,e[i]););else if(f.isObject(e))for(i in e)if(e.hasOwnProperty(i)&&!1===t(i,e[i]))break},mergeOptions:function(e,t){if(f.isObject(e)&&f.isObject(t)&&Object.keys){var i={};return f.each(e,function(t){i[t]=e[t]}),f.each(t,function(a){var r=t[a];i[a]=f.isObject(r)&&e[a]?f.mergeOptions(e[a],r):r}),i}},setCSSAttr:function(e,t,i){f.isElement(e)&&(f.isString(t)&&f.isString(i)?e.style[t]=i:f.isObject(t)&&f.each(t,function(t,i){e.style[t]=i}))},removeElement:function(e){f.isElement(e)&&e.parentNode&&e.parentNode.removeChild(e)},createWebWorker:function(e){if(!f.isString(e))return{};try{var t=new f.Blob([e],{type:"text/javascript"}),i=f.URL.createObjectURL(t);return{objectUrl:i,worker:new Worker(i)}}catch(e){return""+e}},getExtension:function(e){return e.substr(e.lastIndexOf(".")+1,e.length)},getFontSize:function(){var e=0<arguments.length&&arguments[0]!==a?arguments[0]:{};if(!t.body||!1===e.resizeFont)return e.fontSize;var i=e.text,r=e.gifWidth,o=parseInt(e.fontSize,10),n=parseInt(e.minFontSize,10),s=t.createElement("div"),l=t.createElement("span");for(s.setAttribute("width",r),s.appendChild(l),l.innerHTML=i,l.style.fontSize=o+"px",l.style.textIndent="-9999px",l.style.visibility="hidden",t.body.appendChild(l);l.offsetWidth>r&&n<=o;)l.style.fontSize=--o+"px";return t.body.removeChild(l),o+"px"},webWorkerError:!1},g=Object.freeze({default:f}),v={validate:function(e){e=f.isObject(e)?e:{};var t={};return f.each(v.validators,function(i,a){var r=a.errorCode;return e[r]||a.condition?void 0:!((t=a).error=!0)}),delete t.condition,t},isValid:function(e){return!0!==v.validate(e).error},validators:[{condition:f.isFunction(f.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:f.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:f.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:f.isFunction(f.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:f.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:f.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:f.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},A=Object.freeze({default:v}),C={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:u,completeCallback:u,saveRenderingContexts:!1,savedRenderingContexts:[],showFrameText:!0,crossOrigin:"Anonymous",waterMark:null,waterMarkHeight:null,waterMarkWidth:null,waterMarkXCoordinate:1,waterMarkYCoordinate:1},y=Object.freeze({default:C}),b=function(e){this.canvas=null,this.ctx=null,this.repeat=0,this.frames=[],this.numRenderedFrames=0,this.onRenderCompleteCallback=p,this.onRenderProgressCallback=p,this.workers=[],this.availableWorkers=[],this.generatingGIF=!1,this.options=e,this.initializeWebWorkers(e)};function S(){}b.prototype={workerMethods:n(),initializeWebWorkers:function(e){var i,a=o.toString()+"("+n.toString()+"());",r=void 0,s=void 0,l=void 0,d=-1,c="";for(i=e.numWorkers;++d<i;)r=f.createWebWorker(a),f.isObject(r)?(s=r.objectUrl,l=r.worker,this.workers.push({worker:l,objectUrl:s}),this.availableWorkers.push(l)):(c=r,f.webWorkerError=!!r);this.workerError=c,this.canvas=t.createElement("canvas"),this.canvas.width=e.gifWidth,this.canvas.height=e.gifHeight,this.ctx=this.canvas.getContext("2d"),this.frames=[]},getWorker:function(){return this.availableWorkers.pop()},freeWorker:function(e){this.availableWorkers.push(e)},byteMap:function(){for(var e=[],t=0;t<256;t++)e[t]=String.fromCharCode(t);return e}(),bufferToString:function(e){for(var t=e.length,i="",a=-1;++a<t;)i+=this.byteMap[e[a]];return i},onFrameFinished:function(e){var t=this,i=t.frames,a=!!(t.options.images||[]).length,r=i.every(function(e){return!e.beingProcessed&&e.done});t.numRenderedFrames++,a&&e(t.numRenderedFrames/i.length),t.onRenderProgressCallback(.75*t.numRenderedFrames/i.length),r?t.generatingGIF||t.generateGIF(i,t.onRenderCompleteCallback):f.requestTimeout(function(){t.processNextFrame()},1)},processFrame:function(e){function t(){var e=(0<arguments.length&&arguments[0]!==a?arguments[0]:{}).data;delete l.data,l.pixels=Array.prototype.slice.call(e.pixels),l.palette=Array.prototype.slice.call(e.palette),l.done=!0,l.beingProcessed=!1,i.freeWorker(d),i.onFrameFinished(o)}var i=this,r=(this.options,this.options),o=r.progressCallback,n=r.sampleInterval,s=this.frames,l=void 0,d=void 0;return(l=s[e]).beingProcessed||l.done?void this.onFrameFinished():(l.sampleInterval=n,l.beingProcessed=!0,l.gifshot=!0,void((d=this.getWorker())?(d.onmessage=t,d.postMessage(l)):t({data:i.workerMethods.run(l)})))},startRendering:function(e){this.onRenderCompleteCallback=e;for(var t=0;t<this.options.numWorkers&&t<this.frames.length;t++)this.processFrame(t)},processNextFrame:function(){for(var e=-1,t=0;t<this.frames.length;t++){var i=this.frames[t];if(!i.done&&!i.beingProcessed){e=t;break}}0<=e&&this.processFrame(e)},generateGIF:function(e,t){var i=[],a={loop:this.repeat},r=this.options,o=r.interval,n=r.frameDuration,l=!!r.images.length,d=r.gifHeight,c=r.gifWidth,u=new s(i,c,d,a),p=this.onRenderProgressCallback,h=l?100*o:0,m=void 0;this.generatingGIF=!0,f.each(e,function(t,i){var a=i.palette;p(.75+.25*i.position*1/e.length);for(var r=0;r<n;r++)u.addFrame(0,0,c,d,i.pixels,{palette:a,delay:h})}),u.end(),p(1),this.frames=[],this.generatingGIF=!1,f.isFunction(t)&&(m=this.bufferToString(i),t("data:image/gif;base64,"+f.btoa(m)))},setRepeat:function(e){this.repeat=e},addFrame:function(e,t,i){t=f.isObject(t)?t:{};var a=this.ctx,r=this.options,o=r.gifWidth,n=r.gifHeight,s=f.getFontSize(t),l=t.filter,d=t.fontColor,c=t.fontFamily,u=t.fontWeight,p=(t.gifHeight,t.gifWidth,t.text),h=t.textAlign,m=t.textBaseline,g=t.waterMark,v=t.waterMarkHeight,A=t.waterMarkWidth,C=t.waterMarkXCoordinate,y=t.waterMarkYCoordinate,b=t.textXCoordinate?t.textXCoordinate:"left"===h?1:"right"===h?o:o/2,S=t.textYCoordinate?t.textYCoordinate:"top"===m?1:"center"===m?n/2:n,k=u+" "+s+" "+c,D=i&&t.showFrameText?i:p,_=void 0;try{a.filter=l,a.drawImage(e,0,0,o,n),D&&(a.font=k,a.fillStyle=d,a.textAlign=h,a.textBaseline=m,a.fillText(D,b,S)),g&&a.drawImage(g,C,y,A,v),_=a.getImageData(0,0,o,n),this.addFrameImageData(_)}catch(e){return""+e}},addFrameImageData:function(){var e=0<arguments.length&&arguments[0]!==a?arguments[0]:{},t=this.frames,i=e.data;this.frames.push({data:i,width:e.width,height:e.height,palette:null,dithering:null,done:!1,beingProcessed:!1,position:t.length})},onRenderProgress:function(e){this.onRenderProgressCallback=e},isRendering:function(){return this.generatingGIF},getBase64GIF:function(e){var t=this;t.startRendering(function(i){t.destroyWorkers(),f.requestTimeout(function(){e(i)},0)})},destroyWorkers:function(){if(!this.workerError){var e=this.workers;f.each(e,function(e,t){var i=t.worker,a=t.objectUrl;i.terminate(),f.URL.revokeObjectURL(a)})}}};var k={getGIF:function(){var e=0<arguments.length&&arguments[0]!==a?arguments[0]:{},i=arguments[1];i=f.isFunction(i)?i:S;var r=t.createElement("canvas"),o=void 0,n=!!e.images.length,s=e.cameraStream,l=e.crop,d=e.filter,c=e.fontColor,u=e.fontFamily,p=e.fontWeight,h=e.keepCameraOn,m=(e.numWorkers,e.progressCallback),g=e.saveRenderingContexts,v=e.savedRenderingContexts,A=e.text,C=e.textAlign,y=e.textBaseline,k=e.videoElement,D=e.videoHeight,_=e.videoWidth,I=e.webcamVideoElement,w=e.waterMark,P=e.waterMarkHeight,T=e.waterMarkWidth,B=e.waterMarkXCoordinate,x=e.waterMarkYCoordinate,F=Number(e.gifWidth),O=Number(e.gifHeight),M=Number(e.interval),E=(Number(e.sampleInterval),n?0:1e3*M),$=[],N=v.length?v.length:e.numFrames,L=N,U=new b(e),R=f.getFontSize(e),G=e.textXCoordinate?e.textXCoordinate:"left"===C?1:"right"===C?F:F/2,W=e.textYCoordinate?e.textYCoordinate:"top"===y?1:"center"===y?O/2:O,V=p+" "+R+" "+u,j=l?Math.floor(l.scaledWidth/2):0,H=l?_-l.scaledWidth:0,Y=l?Math.floor(l.scaledHeight/2):0,Z=l?D-l.scaledHeight:0;N=N!==a?N:10,M=M!==a?M:.1,r.width=F,r.height=O,o=r.getContext("2d"),function e(){return v.length||0!==k.currentTime?void function e(){function t(){var t;g&&$.push(o.getImageData(0,0,F,O)),w&&o.drawImage(w,B,x,T,P),A&&(o.font=V,o.fillStyle=c,o.textAlign=C,o.textBaseline=y,o.fillText(A,G,W)),t=o.getImageData(0,0,F,O),U.addFrameImageData(t),m((N-(L=a))/N),0<a&&f.requestTimeout(e,E),L||U.getBase64GIF(function(e){i({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:s,videoElement:k,webcamVideoElement:I,savedRenderingContexts:$,keepCameraOn:h})})}var a=L-1;v.length?(o.putImageData(v[N-L],0,0),t()):function e(){try{_<H&&(H=_),D<Z&&(Z=D),j<0&&(j=0),Y<0&&(Y=0),o.filter=d,o.drawImage(k,j,Y,H,Z,0,0,F,O),t()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;f.requestTimeout(e,100)}}()}():void f.requestTimeout(e,100)}()},getCropDimensions:function(){var e=0<arguments.length&&arguments[0]!==a?arguments[0]:{},t=e.videoWidth,i=e.videoHeight,r=e.gifWidth,o=e.gifHeight,n={width:0,height:0,scaledWidth:0,scaledHeight:0};return i<t?(n.width=Math.round(t*(o/i))-r,n.scaledWidth=Math.round(n.width*(i/o))):(n.height=Math.round(i*(r/t))-o,n.scaledHeight=Math.round(n.height*(t/r))),n}},D={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var i=t.cameraStream,a=t.completedCallback,r=t.videoElement;r&&(0<r.videoWidth&&0<r.videoHeight?(r.removeEventListener("loadeddata",D.findVideoSize),a({videoElement:r,cameraStream:i,videoWidth:r.videoWidth,videoHeight:r.videoHeight})):e.attempts<10?(e.attempts+=1,f.requestTimeout(function(){D.findVideoSize(t)},400)):a({videoElement:r,cameraStream:i,videoWidth:D.defaultVideoDimensions.width,videoHeight:D.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){f.isFunction(e)&&e({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - Timed out while trying to start streaming",image:null,cameraStream:{}})},stream:function(e){var t=f.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,i=e.cameraStream,a=e.completedCallback,r=e.streamedCallback,o=e.videoElement;if(f.isFunction(r)&&r(),t){if(f.isString(t))o.src=t,o.innerHTML='<source src="'+t+'" type="video/'+f.getExtension(t)+'" />';else if(t instanceof Blob){try{o.src=f.URL.createObjectURL(t)}catch(e){}o.innerHTML='<source src="'+t+'" type="'+t.type+'" />'}}else if(o.mozSrcObject)o.mozSrcObject=i;else if(f.URL)try{o.srcObject=i,o.src=f.URL.createObjectURL(i)}catch(e){o.srcObject=i}o.play(),f.requestTimeout(function e(){e.count=e.count||0,!0===D.loadedData?(D.findVideoSize({videoElement:o,cameraStream:i,completedCallback:a}),D.loadedData=!1):10<(e.count+=1)?D.findVideoSize({videoElement:o,cameraStream:i,completedCallback:a}):e()},0)},startStreaming:function(e){var i=f.isFunction(e.error)?e.error:f.noop,a=f.isFunction(e.streamed)?e.streamed:f.noop,r=f.isFunction(e.completed)?e.completed:f.noop,o=e.crossOrigin,n=e.existingVideo,s=e.lastCameraStream,l=e.options,d=e.webcamVideoElement,c=f.isElement(n)?n:d||t.createElement("video");o&&(c.crossOrigin=l.crossOrigin),c.autoplay=!0,c.loop=!0,c.muted=!0,c.addEventListener("loadeddata",function(){D.loadedData=!0,l.offset&&(c.currentTime=l.offset)}),n?D.stream({videoElement:c,existingVideo:n,completedCallback:r}):s?D.stream({videoElement:c,cameraStream:s,streamedCallback:a,completedCallback:r}):f.getUserMedia({video:!0},function(e){D.stream({videoElement:c,cameraStream:e,streamedCallback:a,completedCallback:r})},i)},startVideoStreaming:function(e){var t=1<arguments.length&&arguments[1]!==a?arguments[1]:{},i=t.timeout!==a?t.timeout:0,r=t.callback,o=t.webcamVideoElement,n=void 0;0<i&&(n=f.requestTimeout(function(){D.onStreamingTimeout(r)},1e4)),D.startStreaming({error:function(){r({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(n)},completed:function(){var t=0<arguments.length&&arguments[0]!==a?arguments[0]:{},i=t.cameraStream,r=t.videoElement,o=t.videoHeight,n=t.videoWidth;e({cameraStream:i,videoElement:r,videoHeight:o,videoWidth:n})},lastCameraStream:t.lastCameraStream,webcamVideoElement:o,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=(e=f.isObject(e)?e:{}).keepCameraOn,i=e.videoElement,a=e.webcamVideoElement,r=e.cameraStream||{},o=r.getTracks&&r.getTracks()||[],n=o[0];!t&&o.length&&f.isFunction(n.stop)&&n.stop(),f.isElement(i)&&!a&&(i.pause(),f.isFunction(f.URL.revokeObjectURL)&&!f.webWorkerError&&i.src&&f.URL.revokeObjectURL(i.src),f.removeElement(i))}},_={utils:g,error:A,defaultOptions:y,createGIF:c,takeSnapShot:function(e,t){if(t=f.isFunction(e)?e:t,e=f.isObject(e)?e:{},f.isFunction(t)){var i=f.mergeOptions(C,e);c(f.mergeOptions(i,{interval:.1,numFrames:1,gifWidth:Math.floor(i.gifWidth),gifHeight:Math.floor(i.gifHeight)}),t)}},stopVideoStreaming:l,isSupported:function(){return v.isValid()},isWebCamGIFSupported:r,isExistingVideoGIFSupported:function(e){var t=!1;if(f.isArray(e)&&e.length){if(f.each(e,function(e,i){f.isSupported.videoCodecs[i]&&(t=!0)}),!t)return!1}else if(f.isString(e)&&e.length&&!f.isSupported.videoCodecs[e])return!1;return v.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return v.isValid({getUserMedia:!0})},VERSION:"0.4.5"};"function"==typeof define&&define.amd?define([],function(){return _}):"undefined"!=typeof exports?module.exports=_:e.gifshot=_}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?(module.exports=t(),module.exports.default=t()):"function"==typeof define&&define.amd?define(t):(e=e||self).heic2any=t()}(this,function(){"use strict";var e=new Blob(['\nvar Module=void 0!==Module?Module:{};(function(){var d={print:function(A){A=Array.prototype.slice.call(arguments).join(" "),console.log(A)},printErr:function(A){A=Array.prototype.slice.call(arguments).join(" "),console.error(A)},canvas:{},noInitialRun:!0},A={};for(Or in d)d.hasOwnProperty(Or)&&(A[Or]=d[Or]);var i,f,e=!1,l=!1,o=!1,r=!1;if(d.ENVIRONMENT)if("WEB"===d.ENVIRONMENT)e=!0;else if("WORKER"===d.ENVIRONMENT)l=!0;else if("NODE"===d.ENVIRONMENT)o=!0;else{if("SHELL"!==d.ENVIRONMENT)throw new Error("The provided Module[\'ENVIRONMENT\'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");r=!0}else e="object"==typeof window,l="function"==typeof importScripts,o="object"==typeof process&&"function"==typeof require&&!e&&!l,r=!e&&!o&&!l;if(o)d.print||(d.print=console.log),d.printErr||(d.printErr=console.warn),d.read=function(A,e){var r;return(r=mr(A))||(i=i||void 0,A=(f=f||void 0).normalize(A),r=i.readFileSync(A)),e?r:r.toString()},d.readBinary=function(A){var e=d.read(A,!0);return e.buffer||(e=new Uint8Array(e)),h(e.buffer),e},d.thisProgram||(1<process.argv.length?d.thisProgram=process.argv[1].replace(/\\\\/g,"/"):d.thisProgram="unknown-program"),d.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=d),process.on("uncaughtException",function(A){if(!(A instanceof Jr))throw A}),process.on("unhandledRejection",function(A,e){process.exit(1)}),d.inspect=function(){return"[Emscripten Module object]"};else if(r)d.print||(d.print=print),"undefined"!=typeof printErr&&(d.printErr=printErr),"undefined"!=typeof read?d.read=function(A){var e=mr(A);return e?wr(e):read(A)}:d.read=function(){throw"no read() available"},d.readBinary=function(A){var e;return(e=mr(A))?e:"function"==typeof readbuffer?new Uint8Array(readbuffer(A)):(h("object"==typeof(e=read(A,"binary"))),e)},"undefined"!=typeof scriptArgs?d.arguments=scriptArgs:void 0!==arguments&&(d.arguments=arguments),"function"==typeof quit&&(d.quit=function(A,e){quit(A)});else{if(!e&&!l)throw new Error("Unknown runtime environment. Where are we?");if(d.read=function(e){try{var A=new XMLHttpRequest;return A.open("GET",e,!1),A.send(null),A.responseText}catch(A){var r=mr(e);if(r)return wr(r);throw A}},l&&(d.readBinary=function(e){try{var A=new XMLHttpRequest;return A.open("GET",e,!1),A.responseType="arraybuffer",A.send(null),new Uint8Array(A.response)}catch(A){var r=mr(e);if(r)return r;throw A}}),d.readAsync=function(e,r,i){var f=new XMLHttpRequest;f.open("GET",e,!0),f.responseType="arraybuffer",f.onload=function(){if(200==f.status||0==f.status&&f.response)r(f.response);else{var A=mr(e);A?r(A.buffer):i()}},f.onerror=i,f.send(null)},void 0!==arguments&&(d.arguments=arguments),"undefined"!=typeof console)d.print||(d.print=function(A){console.log(A)}),d.printErr||(d.printErr=function(A){console.warn(A)});else{d.print||(d.print=function(A){})}void 0===d.setWindowTitle&&(d.setWindowTitle=function(A){document.title=A})}for(Or in d.print||(d.print=function(){}),d.printErr||(d.printErr=d.print),d.arguments||(d.arguments=[]),d.thisProgram||(d.thisProgram="./this.program"),d.quit||(d.quit=function(A,e){throw e}),d.print=d.print,d.printErr=d.printErr,d.preRun=[],d.postRun=[],A)A.hasOwnProperty(Or)&&(d[Or]=A[Or]);A=void 0;var k={setTempRet0:function(A){return tempRet0=A},getTempRet0:function(){return tempRet0},stackSave:function(){return R},stackRestore:function(A){R=A},getNativeTypeSize:function(A){switch(A){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===A[A.length-1])return k.QUANTUM_SIZE;if("i"!==A[0])return 0;var e=parseInt(A.substr(1));return h(e%8==0),e/8}},getNativeFieldSize:function(A){return Math.max(k.getNativeTypeSize(A),k.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(A,e){return"double"===e||"i64"===e?7&A&&(h(4==(7&A)),A+=4):h(0==(3&A)),A},getAlignSize:function(A,e,r){return r||"i64"!=A&&"double"!=A?A?Math.min(e||(A?k.getNativeFieldSize(A):0),k.QUANTUM_SIZE):Math.min(e,8):8},dynCall:function(A,e,r){return r&&r.length?d["dynCall_"+A].apply(null,[e].concat(r)):d["dynCall_"+A].call(null,e)},functionPointers:[],addFunction:function(A){for(var e=0;e<k.functionPointers.length;e++)if(!k.functionPointers[e])return k.functionPointers[e]=A,2*(1+e);throw"Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS."},removeFunction:function(A){k.functionPointers[(A-2)/2]=null},warnOnce:function(A){k.warnOnce.shown||(k.warnOnce.shown={}),k.warnOnce.shown[A]||(k.warnOnce.shown[A]=1,d.printErr(A))},funcWrappers:{},getFuncWrapper:function(e,r){if(e){h(r),k.funcWrappers[r]||(k.funcWrappers[r]={});var A=k.funcWrappers[r];return A[e]||(1===r.length?A[e]=function(){return k.dynCall(r,e)}:2===r.length?A[e]=function(A){return k.dynCall(r,e,[A])}:A[e]=function(){return k.dynCall(r,e,Array.prototype.slice.call(arguments))}),A[e]}},getCompilerSetting:function(A){throw"You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work"},stackAlloc:function(A){var e=R;return R=(R=R+A|0)+15&-16,e},staticAlloc:function(A){var e=F;return F=(F=F+A|0)+15&-16,e},dynamicAlloc:function(A){var e=E[D>>2],r=-16&(e+A+15|0);if((E[D>>2]=r,j<=r)&&!H())return E[D>>2]=e,0;return e},alignMemory:function(A,e){return A=Math.ceil(A/(e||16))*(e||16)},makeBigInt:function(A,e,r){return r?+(A>>>0)+4294967296*(e>>>0):+(A>>>0)+4294967296*(0|e)},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};d.Runtime=k;var n=0;function h(A,e){A||Mr("Assertion failed: "+e)}function w(A,e,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":C[A>>0]=e;break;case"i16":I[A>>1]=e;break;case"i32":E[A>>2]=e;break;case"i64":tempI64=[e>>>0,(tempDouble=e,1<=+iA(tempDouble)?0<tempDouble?(0|tA(+nA(tempDouble/4294967296),4294967295))>>>0:~~+fA((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],E[A>>2]=tempI64[0],E[A+4>>2]=tempI64[1];break;case"float":V[A>>2]=e;break;case"double":X[A>>3]=e;break;default:Mr("invalid type for setValue: "+r)}}var t=0,v=2,g=4;function a(A,e,r,i){var f,n;n="number"==typeof A?(f=!0,A):(f=!1,A.length);var t,o="string"==typeof e?e:null;if(t=r==g?i:["function"==typeof Xr?Xr:k.staticAlloc,k.stackAlloc,k.staticAlloc,k.dynamicAlloc][void 0===r?v:r](Math.max(n,o?1:e.length)),f){var a;for(h(0==(3&(i=t))),a=t+(-4&n);i<a;i+=4)E[i>>2]=0;for(a=t+n;i<a;)C[i++>>0]=0;return t}if("i8"===o)return A.subarray||A.slice?W.set(A,t):W.set(new Uint8Array(A),t),t;for(var c,l,u,s=0;s<n;){var b=A[s];"function"==typeof b&&(b=k.getFunctionIndex(b)),0!==(c=o||e[s])?("i64"==c&&(c="i32"),w(t+s,b,c),u!==c&&(l=k.getNativeTypeSize(c),u=c),s+=l):s++}return t}function m(A,e){if(0===e||!A)return"";for(var r,i=0,f=0;i|=r=W[A+f>>0],(0!=r||e)&&(f++,!e||f!=e););e=e||f;var n="";if(i<128){for(var t;0<e;)t=String.fromCharCode.apply(String,W.subarray(A,A+Math.min(e,1024))),n=n?n+t:t,A+=1024,e-=1024;return n}return c(W,A)}d.ALLOC_NORMAL=t,d.ALLOC_STACK=1,d.ALLOC_STATIC=v,d.ALLOC_DYNAMIC=3,d.ALLOC_NONE=g,d.getMemory=function(A){return N?AA?Xr(A):k.dynamicAlloc(A):k.staticAlloc(A)};var u="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function c(A,e){for(var r=e;A[r];)++r;if(16<r-e&&A.subarray&&u)return u.decode(A.subarray(e,r));for(var i,f,n,t,o,a="";;){if(!(i=A[e++]))return a;if(128&i)if(f=63&A[e++],192!=(224&i))if(n=63&A[e++],(i=224==(240&i)?(15&i)<<12|f<<6|n:(t=63&A[e++],240==(248&i)?(7&i)<<18|f<<12|n<<6|t:(o=63&A[e++],248==(252&i)?(3&i)<<24|f<<18|n<<12|t<<6|o:(1&i)<<30|f<<24|n<<18|t<<12|o<<6|63&A[e++])))<65536)a+=String.fromCharCode(i);else{var c=i-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}else a+=String.fromCharCode((31&i)<<6|f);else a+=String.fromCharCode(i)}}function s(A,e,r,i){if(!(0<i))return 0;for(var f=r,n=r+i-1,t=0;t<A.length;++t){var o=A.charCodeAt(t);if(55296<=o&&o<=57343&&(o=65536+((1023&o)<<10)|1023&A.charCodeAt(++t)),o<=127){if(n<=r)break;e[r++]=o}else if(o<=2047){if(n<=r+1)break;e[r++]=192|o>>6,e[r++]=128|63&o}else if(o<=65535){if(n<=r+2)break;e[r++]=224|o>>12,e[r++]=128|o>>6&63,e[r++]=128|63&o}else if(o<=2097151){if(n<=r+3)break;e[r++]=240|o>>18,e[r++]=128|o>>12&63,e[r++]=128|o>>6&63,e[r++]=128|63&o}else if(o<=67108863){if(n<=r+4)break;e[r++]=248|o>>24,e[r++]=128|o>>18&63,e[r++]=128|o>>12&63,e[r++]=128|o>>6&63,e[r++]=128|63&o}else{if(n<=r+5)break;e[r++]=252|o>>30,e[r++]=128|o>>24&63,e[r++]=128|o>>18&63,e[r++]=128|o>>12&63,e[r++]=128|o>>6&63,e[r++]=128|63&o}}return e[r]=0,r-f}function b(A,e,r){return s(A,W,e,r)}function p(A){for(var e=0,r=0;r<A.length;++r){var i=A.charCodeAt(r);55296<=i&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++r)),i<=127?++e:e+=i<=2047?2:i<=65535?3:i<=2097151?4:i<=67108863?5:6}return e}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");function y(){var A=function(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(A){e=A}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}();return d.extraStackTrace&&(A+="\\n"+d.extraStackTrace()),A.replace(/__Z[\\w\\d_]+/g,function(A){var e=A;return A===e?A:A+" ["+e+"]"})}var Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T=65536,M=16777216,S=16777216;function U(A,e){return 0<A%e&&(A+=e-A%e),A}function O(){d.HEAP8=C=new Int8Array(Z),d.HEAP16=I=new Int16Array(Z),d.HEAP32=E=new Int32Array(Z),d.HEAPU8=W=new Uint8Array(Z),d.HEAPU16=B=new Uint16Array(Z),d.HEAPU32=G=new Uint32Array(Z),d.HEAPF32=V=new Float32Array(Z),d.HEAPF64=X=new Float64Array(Z)}function H(){var A=d.usingWasm?T:M,e=2147483648-A;if(E[D>>2]>e)return!1;var r=j;for(j=Math.max(j,S);j<E[D>>2];)j=j<=536870912?U(2*j,A):Math.min(U((3*j+2147483648)/4,A),e);var i,f=d.reallocBuffer(j);return f&&f.byteLength==j?(i=f,d.buffer=Z=i,O(),!0):(j=r,!1)}F=R=D=0,N=!1,d.reallocBuffer||(d.reallocBuffer=function(A){var e;try{if(ArrayBuffer.transfer)e=ArrayBuffer.transfer(Z,A);else{var r=C;e=new ArrayBuffer(A),new Int8Array(e).set(r)}}catch(A){return!1}return!!Gr(e)&&e});try{(Q=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get))(new ArrayBuffer(4))}catch(Hr){Q=function(A){return A.byteLength}}var x=d.TOTAL_STACK||5242880,j=d.TOTAL_MEMORY||16777216;if(j<x&&d.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+j+"! (TOTAL_STACK="+x+")"),Z=d.buffer?d.buffer:new ArrayBuffer(j),O(),E[0]=1668509029,I[1]=25459,115!==W[2]||99!==W[3])throw"Runtime error: expected the system to be little-endian!";function z(A){for(;0<A.length;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?d.dynCall_v(r):d.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}d.HEAP=void 0,d.buffer=Z,d.HEAP8=C,d.HEAP16=I,d.HEAP32=E,d.HEAPU8=W,d.HEAPU16=B,d.HEAPU32=G,d.HEAPF32=V,d.HEAPF64=X;var P=[],L=[],K=[],q=[],$=[],AA=!1;function eA(A,e){C.set(A,e)}function rA(A,e,r){for(var i=0;i<A.length;++i)C[e++>>0]=A.charCodeAt(i);r||(C[e>>0]=0)}Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(A,e){var r=65535&A,i=65535&e;return r*i+((A>>>16)*i+r*(e>>>16)<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(A){A>>>=0;for(var e=0;e<32;e++)if(A&1<<31-e)return e;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(A){return A<0?Math.ceil(A):Math.floor(A)}),Math.trunc=Math.trunc;var iA=Math.abs,fA=(Math.cos,Math.sin,Math.tan,Math.acos,Math.asin,Math.atan,Math.atan2,Math.exp,Math.log,Math.sqrt,Math.ceil),nA=Math.floor,tA=(Math.pow,Math.imul,Math.fround,Math.round,Math.min),oA=(Math.clz32,Math.trunc,0),aA=null,cA=null;function lA(A){oA++,d.monitorRunDependencies&&d.monitorRunDependencies(oA)}function uA(A){if(oA--,d.monitorRunDependencies&&d.monitorRunDependencies(oA),0==oA&&(null!==aA&&(clearInterval(aA),aA=null),cA)){var e=cA;cA=null,e()}}d.addRunDependency=lA,d.removeRunDependency=uA,d.preloadedImages={},d.preloadedAudios={};var sA=null;_=k.GLOBAL_BASE,F=_+72976,L.push({func:function(){Zr()}},{func:function(){Wr()}},{func:function(){Ir()}},{func:function(){Cr()}},{func:function(){Br()}});var bA=F;function dA(){return!!dA.uncaught_exception}F+=16;var kA={last:0,caught:[],infos:{},deAdjust:function(A){if(!A||kA.infos[A])return A;for(var e in kA.infos){if(kA.infos[e].adjusted===A)return e}return A},addRef:function(A){A&&kA.infos[A].refcount++},decRef:function(A){if(A){var e=kA.infos[A];h(0<e.refcount),e.refcount--,0!==e.refcount||e.rethrown||(e.destructor&&d.dynCall_vi(e.destructor,A),delete kA.infos[A],___cxa_free_exception(A))}},clearRef:function(A){A&&(kA.infos[A].refcount=0)}};var hA={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function wA(A){return d.___errno_location&&(E[d.___errno_location()>>2]=A),A}var vA={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can   access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can\'t send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"},gA={splitPath:function(A){return/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(A).slice(1)},normalizeArray:function(A,e){for(var r=0,i=A.length-1;0<=i;i--){var f=A[i];"."===f?A.splice(i,1):".."===f?(A.splice(i,1),r++):r&&(A.splice(i,1),r--)}if(e)for(;r;r--)A.unshift("..");return A},normalize:function(A){var e="/"===A.charAt(0),r="/"===A.substr(-1);return(A=gA.normalizeArray(A.split("/").filter(function(A){return!!A}),!e).join("/"))||e||(A="."),A&&r&&(A+="/"),(e?"/":"")+A},dirname:function(A){var e=gA.splitPath(A),r=e[0],i=e[1];return r||i?r+(i=i&&i.substr(0,i.length-1)):"."},basename:function(A){if("/"===A)return"/";var e=A.lastIndexOf("/");return-1===e?A:A.substr(e+1)},extname:function(A){return gA.splitPath(A)[3]},join:function(){var A=Array.prototype.slice.call(arguments,0);return gA.normalize(A.join("/"))},join2:function(A,e){return gA.normalize(A+"/"+e)},resolve:function(){for(var A="",e=!1,r=arguments.length-1;-1<=r&&!e;r--){var i=0<=r?arguments[r]:WA.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";A=i+"/"+A,e="/"===i.charAt(0)}return(e?"/":"")+(A=gA.normalizeArray(A.split("/").filter(function(A){return!!A}),!e).join("/"))||"."},relative:function(A,e){function r(A){for(var e=0;e<A.length&&""===A[e];e++);for(var r=A.length-1;0<=r&&""===A[r];r--);return r<e?[]:A.slice(e,r-e+1)}A=gA.resolve(A).substr(1),e=gA.resolve(e).substr(1);for(var i=r(A.split("/")),f=r(e.split("/")),n=Math.min(i.length,f.length),t=n,o=0;o<n;o++)if(i[o]!==f[o]){t=o;break}var a=[];for(o=t;o<i.length;o++)a.push("..");return(a=a.concat(f.slice(t))).join("/")}},mA={ttys:[],init:function(){},shutdown:function(){},register:function(A,e){mA.ttys[A]={input:[],output:[],ops:e},WA.registerDevice(A,mA.stream_ops)},stream_ops:{open:function(A){var e=mA.ttys[A.node.rdev];if(!e)throw new WA.ErrnoError(hA.ENODEV);A.tty=e,A.seekable=!1},close:function(A){A.tty.ops.flush(A.tty)},flush:function(A){A.tty.ops.flush(A.tty)},read:function(A,e,r,i,f){if(!A.tty||!A.tty.ops.get_char)throw new WA.ErrnoError(hA.ENXIO);for(var n=0,t=0;t<i;t++){var o;try{o=A.tty.ops.get_char(A.tty)}catch(A){throw new WA.ErrnoError(hA.EIO)}if(void 0===o&&0===n)throw new WA.ErrnoError(hA.EAGAIN);if(null==o)break;n++,e[r+t]=o}return n&&(A.node.timestamp=Date.now()),n},write:function(A,e,r,i,f){if(!A.tty||!A.tty.ops.put_char)throw new WA.ErrnoError(hA.ENXIO);for(var n=0;n<i;n++)try{A.tty.ops.put_char(A.tty,e[r+n])}catch(A){throw new WA.ErrnoError(hA.EIO)}return i&&(A.node.timestamp=Date.now()),n}},default_tty_ops:{get_char:function(A){if(!A.input.length){var e=null;if(o){var r=new Buffer(256),i=0,f="win32"!=process.platform,n=process.stdin.fd;if(f){var t=!1;try{n=br.openSync("/dev/stdin","r"),t=!0}catch(A){}}try{i=br.readSync(n,r,0,256,null)}catch(A){if(-1==A.toString().indexOf("EOF"))throw A;i=0}t&&br.closeSync(n),e=0<i?r.slice(0,i).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\\n");if(!e)return null;A.input=hr(e,!0)}return A.input.shift()},put_char:function(A,e){null===e||10===e?(d.print(c(A.output,0)),A.output=[]):0!=e&&A.output.push(e)},flush:function(A){A.output&&0<A.output.length&&(d.print(c(A.output,0)),A.output=[])}},default_tty1_ops:{put_char:function(A,e){null===e||10===e?(d.printErr(c(A.output,0)),A.output=[]):0!=e&&A.output.push(e)},flush:function(A){A.output&&0<A.output.length&&(d.printErr(c(A.output,0)),A.output=[])}}},pA={ops_table:null,mount:function(A){return pA.createNode(null,"/",16895,0)},createNode:function(A,e,r,i){if(WA.isBlkdev(r)||WA.isFIFO(r))throw new WA.ErrnoError(hA.EPERM);pA.ops_table||(pA.ops_table={dir:{node:{getattr:pA.node_ops.getattr,setattr:pA.node_ops.setattr,lookup:pA.node_ops.lookup,mknod:pA.node_ops.mknod,rename:pA.node_ops.rename,unlink:pA.node_ops.unlink,rmdir:pA.node_ops.rmdir,readdir:pA.node_ops.readdir,symlink:pA.node_ops.symlink},stream:{llseek:pA.stream_ops.llseek}},file:{node:{getattr:pA.node_ops.getattr,setattr:pA.node_ops.setattr},stream:{llseek:pA.stream_ops.llseek,read:pA.stream_ops.read,write:pA.stream_ops.write,allocate:pA.stream_ops.allocate,mmap:pA.stream_ops.mmap,msync:pA.stream_ops.msync}},link:{node:{getattr:pA.node_ops.getattr,setattr:pA.node_ops.setattr,readlink:pA.node_ops.readlink},stream:{}},chrdev:{node:{getattr:pA.node_ops.getattr,setattr:pA.node_ops.setattr},stream:WA.chrdev_stream_ops}});var f=WA.createNode(A,e,r,i);return WA.isDir(f.mode)?(f.node_ops=pA.ops_table.dir.node,f.stream_ops=pA.ops_table.dir.stream,f.contents={}):WA.isFile(f.mode)?(f.node_ops=pA.ops_table.file.node,f.stream_ops=pA.ops_table.file.stream,f.usedBytes=0,f.contents=null):WA.isLink(f.mode)?(f.node_ops=pA.ops_table.link.node,f.stream_ops=pA.ops_table.link.stream):WA.isChrdev(f.mode)&&(f.node_ops=pA.ops_table.chrdev.node,f.stream_ops=pA.ops_table.chrdev.stream),f.timestamp=Date.now(),A&&(A.contents[e]=f),f},getFileDataAsRegularArray:function(A){if(A.contents&&A.contents.subarray){for(var e=[],r=0;r<A.usedBytes;++r)e.push(A.contents[r]);return e}return A.contents},getFileDataAsTypedArray:function(A){return A.contents?A.contents.subarray?A.contents.subarray(0,A.usedBytes):new Uint8Array(A.contents):new Uint8Array},expandFileStorage:function(A,e){if(A.contents&&A.contents.subarray&&e>A.contents.length&&(A.contents=pA.getFileDataAsRegularArray(A),A.usedBytes=A.contents.length),!A.contents||A.contents.subarray){var r=A.contents?A.contents.length:0;if(e<=r)return;e=Math.max(e,r*(r<1048576?2:1.125)|0),0!=r&&(e=Math.max(e,256));var i=A.contents;return A.contents=new Uint8Array(e),void(0<A.usedBytes&&A.contents.set(i.subarray(0,A.usedBytes),0))}for(!A.contents&&0<e&&(A.contents=[]);A.contents.length<e;)A.contents.push(0)},resizeFileStorage:function(A,e){if(A.usedBytes!=e){if(0==e)return A.contents=null,void(A.usedBytes=0);if(!A.contents||A.contents.subarray){var r=A.contents;return A.contents=new Uint8Array(new ArrayBuffer(e)),r&&A.contents.set(r.subarray(0,Math.min(e,A.usedBytes))),void(A.usedBytes=e)}if(A.contents||(A.contents=[]),A.contents.length>e)A.contents.length=e;else for(;A.contents.length<e;)A.contents.push(0);A.usedBytes=e}},node_ops:{getattr:function(A){var e={};return e.dev=WA.isChrdev(A.mode)?A.id:1,e.ino=A.id,e.mode=A.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=A.rdev,WA.isDir(A.mode)?e.size=4096:WA.isFile(A.mode)?e.size=A.usedBytes:WA.isLink(A.mode)?e.size=A.link.length:e.size=0,e.atime=new Date(A.timestamp),e.mtime=new Date(A.timestamp),e.ctime=new Date(A.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(A,e){void 0!==e.mode&&(A.mode=e.mode),void 0!==e.timestamp&&(A.timestamp=e.timestamp),void 0!==e.size&&pA.resizeFileStorage(A,e.size)},lookup:function(A,e){throw WA.genericErrors[hA.ENOENT]},mknod:function(A,e,r,i){return pA.createNode(A,e,r,i)},rename:function(A,e,r){if(WA.isDir(A.mode)){var i;try{i=WA.lookupNode(e,r)}catch(A){}if(i)for(var f in i.contents)throw new WA.ErrnoError(hA.ENOTEMPTY)}delete A.parent.contents[A.name],A.name=r,(e.contents[r]=A).parent=e},unlink:function(A,e){delete A.contents[e]},rmdir:function(A,e){var r=WA.lookupNode(A,e);for(var i in r.contents)throw new WA.ErrnoError(hA.ENOTEMPTY);delete A.contents[e]},readdir:function(A){var e=[".",".."];for(var r in A.contents)A.contents.hasOwnProperty(r)&&e.push(r);return e},symlink:function(A,e,r){var i=pA.createNode(A,e,41471,0);return i.link=r,i},readlink:function(A){if(!WA.isLink(A.mode))throw new WA.ErrnoError(hA.EINVAL);return A.link}},stream_ops:{read:function(A,e,r,i,f){var n=A.node.contents;if(f>=A.node.usedBytes)return 0;var t=Math.min(A.node.usedBytes-f,i);if(h(0<=t),8<t&&n.subarray)e.set(n.subarray(f,f+t),r);else for(var o=0;o<t;o++)e[r+o]=n[f+o];return t},write:function(A,e,r,i,f,n){if(!i)return 0;var t=A.node;if(t.timestamp=Date.now(),e.subarray&&(!t.contents||t.contents.subarray)){if(n)return t.contents=e.subarray(r,r+i),t.usedBytes=i;if(0===t.usedBytes&&0===f)return t.contents=new Uint8Array(e.subarray(r,r+i)),t.usedBytes=i;if(f+i<=t.usedBytes)return t.contents.set(e.subarray(r,r+i),f),i}if(pA.expandFileStorage(t,f+i),t.contents.subarray&&e.subarray)t.contents.set(e.subarray(r,r+i),f);else for(var o=0;o<i;o++)t.contents[f+o]=e[r+o];return t.usedBytes=Math.max(t.usedBytes,f+i),i},llseek:function(A,e,r){var i=e;if(1===r?i+=A.position:2===r&&WA.isFile(A.node.mode)&&(i+=A.node.usedBytes),i<0)throw new WA.ErrnoError(hA.EINVAL);return i},allocate:function(A,e,r){pA.expandFileStorage(A.node,e+r),A.node.usedBytes=Math.max(A.node.usedBytes,e+r)},mmap:function(A,e,r,i,f,n,t){if(!WA.isFile(A.node.mode))throw new WA.ErrnoError(hA.ENODEV);var o,a,c=A.node.contents;if(2&t||c.buffer!==e&&c.buffer!==e.buffer){if((0<f||f+i<A.node.usedBytes)&&(c=c.subarray?c.subarray(f,f+i):Array.prototype.slice.call(c,f,f+i)),a=!0,!(o=Xr(i)))throw new WA.ErrnoError(hA.ENOMEM);e.set(c,o)}else a=!1,o=c.byteOffset;return{ptr:o,allocated:a}},msync:function(A,e,r,i,f){if(!WA.isFile(A.node.mode))throw new WA.ErrnoError(hA.ENODEV);if(2&f)return 0;pA.stream_ops.write(A,e,0,i,r,!1);return 0}}},yA={dbs:{},indexedDB:function(){if("undefined"!=typeof indexedDB)return indexedDB;var A=null;return"object"==typeof window&&(A=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),h(A,"IDBFS used, but indexedDB not supported"),A},DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function(A){return pA.mount.apply(null,arguments)},syncfs:function(e,n,t){yA.getLocalSet(e,function(A,f){if(A)return t(A);yA.getRemoteSet(e,function(A,e){if(A)return t(A);var r=n?e:f,i=n?f:e;yA.reconcile(r,i,t)})})},getDB:function(A,e){var r,i=yA.dbs[A];if(i)return e(null,i);try{r=yA.indexedDB().open(A,yA.DB_VERSION)}catch(A){return e(A)}if(!r)return e("Unable to connect to IndexedDB");r.onupgradeneeded=function(A){var e,r=A.target.result,i=A.target.transaction;(e=r.objectStoreNames.contains(yA.DB_STORE_NAME)?i.objectStore(yA.DB_STORE_NAME):r.createObjectStore(yA.DB_STORE_NAME)).indexNames.contains("timestamp")||e.createIndex("timestamp","timestamp",{unique:!1})},r.onsuccess=function(){i=r.result,yA.dbs[A]=i,e(null,i)},r.onerror=function(A){e(this.error),A.preventDefault()}},getLocalSet:function(A,e){var r={};function i(A){return"."!==A&&".."!==A}function f(e){return function(A){return gA.join2(e,A)}}for(var n=WA.readdir(A.mountpoint).filter(i).map(f(A.mountpoint));n.length;){var t,o=n.pop();try{t=WA.stat(o)}catch(A){return e(A)}WA.isDir(t.mode)&&n.push.apply(n,WA.readdir(o).filter(i).map(f(o))),r[o]={timestamp:t.mtime}}return e(null,{type:"local",entries:r})},getRemoteSet:function(A,i){var f={};yA.getDB(A.mountpoint,function(A,r){if(A)return i(A);try{var e=r.transaction([yA.DB_STORE_NAME],"readonly");e.onerror=function(A){i(this.error),A.preventDefault()},e.objectStore(yA.DB_STORE_NAME).index("timestamp").openKeyCursor().onsuccess=function(A){var e=A.target.result;if(!e)return i(null,{type:"remote",db:r,entries:f});f[e.primaryKey]={timestamp:e.key},e.continue()}}catch(A){return i(A)}})},loadLocalEntry:function(A,e){var r,i;try{i=WA.lookupPath(A).node,r=WA.stat(A)}catch(A){return e(A)}return WA.isDir(r.mode)?e(null,{timestamp:r.mtime,mode:r.mode}):WA.isFile(r.mode)?(i.contents=pA.getFileDataAsTypedArray(i),e(null,{timestamp:r.mtime,mode:r.mode,contents:i.contents})):e(new Error("node type not supported"))},storeLocalEntry:function(A,e,r){try{if(WA.isDir(e.mode))WA.mkdir(A,e.mode);else{if(!WA.isFile(e.mode))return r(new Error("node type not supported"));WA.writeFile(A,e.contents,{encoding:"binary",canOwn:!0})}WA.chmod(A,e.mode),WA.utime(A,e.timestamp,e.timestamp)}catch(A){return r(A)}r(null)},removeLocalEntry:function(A,e){try{WA.lookupPath(A);var r=WA.stat(A);WA.isDir(r.mode)?WA.rmdir(A):WA.isFile(r.mode)&&WA.unlink(A)}catch(A){return e(A)}e(null)},loadRemoteEntry:function(A,e,r){var i=A.get(e);i.onsuccess=function(A){r(null,A.target.result)},i.onerror=function(A){r(this.error),A.preventDefault()}},storeRemoteEntry:function(A,e,r,i){var f=A.put(r,e);f.onsuccess=function(){i(null)},f.onerror=function(A){i(this.error),A.preventDefault()}},removeRemoteEntry:function(A,e,r){var i=A.delete(e);i.onsuccess=function(){r(null)},i.onerror=function(A){r(this.error),A.preventDefault()}},reconcile:function(i,f,e){var n=0,t=[];Object.keys(i.entries).forEach(function(A){var e=i.entries[A],r=f.entries[A];(!r||e.timestamp>r.timestamp)&&(t.push(A),n++)});var r=[];if(Object.keys(f.entries).forEach(function(A){f.entries[A];i.entries[A]||(r.push(A),n++)}),!n)return e(null);var o=0,A=("remote"===i.type?i.db:f.db).transaction([yA.DB_STORE_NAME],"readwrite"),a=A.objectStore(yA.DB_STORE_NAME);function c(A){return A?c.errored?void 0:(c.errored=!0,e(A)):++o>=n?e(null):void 0}A.onerror=function(A){c(this.error),A.preventDefault()},t.sort().forEach(function(r){"local"===f.type?yA.loadRemoteEntry(a,r,function(A,e){if(A)return c(A);yA.storeLocalEntry(r,e,c)}):yA.loadLocalEntry(r,function(A,e){if(A)return c(A);yA.storeRemoteEntry(a,r,e,c)})}),r.sort().reverse().forEach(function(A){"local"===f.type?yA.removeLocalEntry(A,c):yA.removeRemoteEntry(a,A,c)})}},ZA={isWindows:!(sA="data:application/octet-stream;base64,AAAAAAAAAAAEAAAAAAAAAIgIAAAcAAAAHQAAAPz////8////iAgAAB4AAAAfAAAAAAAAAAAAAAAgPgAAG0MAAEg+AACTQgAASAgAAAAAAABIPgAA1UIAAIgIAAAAAAAASD4AAC1DAABAAAAAAAAAAEg+AACSQwAAaAAAAAAAAABIPgAALlAAAGgAAAAAAAAAQAAAAAAAAABYCAAAEgAAABMAAADA////wP///1gIAAAUAAAAFQAAAEAAAAAAAAAAuAgAABYAAAAXAAAAOAAAAPj///+4CAAAGAAAABkAAADA////wP///7gIAAAaAAAAGwAAAAAAAAA4AAAAAAAAAIgIAAAcAAAAHQAAAMj////I////iAgAAB4AAAAfAAAASD4AAM1DAAC4CAAAAAAAAEg+AABIRAAAqA0AAAAAAABIPgAAkkQAAGgAAAAAAAAASD4AAKJEAACoDQAAAAAAAEg+AADlRAAAaAAAAAAAAABIPgAA9kQAAKgNAAAAAAAASD4AADpFAABoAAAAAAAAAEg+AABLRQAAqA0AAAAAAABIPgAAukUAAGgAAAAAAAAASD4AAMtFAACoDQAAAAAAAEg+AAAmRgAAaAAAAAAAAABIPgAAN0YAAKgNAAAAAAAASD4AAChIAABoAAAAAAAAAEg+AAA5SAAAqA0AAAAAAABIPgAAqkgAAGgAAAAAAAAASD4AALtIAACoDQAAAAAAAEg+AAAjSQAAaAAAAAAAAABIPgAANEkAAKgNAAAAAAAASD4AAJxJAABoAAAAAAAAAEg+AACtSQAAqA0AAAAAAABIPgAADEoAAGgAAAAAAAAASD4AAB1KAACoDQAAAAAAAEg+AAB7SgAAaAAAAAAAAABIPgAAjEoAAKgNAAAAAAAASD4AAO1KAABoAAAAAAAAAEg+AAD+SgAAqA0AAAAAAABIPgAAfEsAAGgAAAAAAAAASD4AAI1LAACoDQAAAAAAAEg+AADRSwAAaAAAAAAAAABIPgAA4ksAAKgNAAAAAAAASD4AACZMAABoAAAAAAAAAEg+AAA3TAAAqA0AAAAAAABIPgAA9UwAAGgAAAAAAAAASD4AAAZNAACoDQAAAAAAAEg+AABKTQAAaAAAAAAAAABIPgAAW00AAKgNAAAAAAAASD4AAINOAABoAAAAAAAAAEg+AACUTgAAqA0AAAAAAABIPgAA2E4AAGgAAAAAAAAASD4AAOlOAACoDQAAAAAAAEg+AABRTwAAaAAAAAAAAABIPgAAYk8AAKgNAAAAAAAASD4AAKZPAACoDQAAAAAAAEg+AADqTwAAqA0AAAAAAAA8AAAAAAAAAFgIAAASAAAAEwAAAMT////E////WAgAABQAAAAVAAAASD4AAO5VAABYCAAAAAAAAEg+AACBVgAAqA0AAAAAAAAgPgAAn2YAALQ+AACQZgAAAAAAADAEAAC0PgAAgGYAAAEAAAAwBAAA0D4AAG5mAADQPgAAWWYAACA+AABBZgAAtD4AAChmAAAAAAAAaAQAALQ+AAAOZgAAAQAAAGgEAABIPgAA7GUAAGgEAAAAAAAAtD4AAMllAAAAAAAAkAQAALQ+AAClZQAAAQAAAJAEAAAgPgAAlmUAALQ+AACGZQAAAAAAAMAEAAC0PgAAdWUAAAEAAADABAAAtD4AAGJlAAAAAAAAQAAAALQ+AABOZQAAAQAAAEAAAAC0PgAAQWUAAAAAAABoAAAAtD4AADNlAAABAAAAaAAAACA+AAA+ZAAAID4AAC1kAAC0PgAAG2QAAAAAAAAwBQAAtD4AAAhkAAABAAAAMAUAANA+AADkYwAA0D4AANZjAADQPgAAxGMAANA+AAC1YwAAID4AAOtgAAC0PgAA22AAAAAAAAB4BQAAtD4AAMpgAAABAAAAeAUAACA+AAC2YAAAtD4AAKFgAAAAAAAAoAUAALQ+AACLYAAAAQAAAKAFAAAgPgAAfmAAALQ+AABwYAAAAAAAAMgFAAC0PgAAYWAAAAEAAADIBQAAID4AAFRgAADsPgAAeGEAAAAAAAABAAAAOAYAAAAAAAC0PgAAU2EAAAAAAAD4BQAAtD4AAC1hAAABAAAA+AUAACA+AAAaYQAA7D4AAJxhAAAAAAAAAQAAAFAGAAAAAAAAID4AAMhhAADsPgAAAWMAAAAAAAABAAAAsAYAAAAAAAC0PgAAqmIAAAAAAABYBgAAtD4AAFJiAAABAAAAWAYAAOw+AADtYQAAAAAAAAEAAACoBgAAAAAAACA+AAAsYgAA7D4AAFdjAAAAAAAAAQAAAFAGAAAAAAAASD4AALBkAACoDQAAAAAAAEg+AAB5ZwAAqA0AAAAAAABIPgAAHWoAAKgNAAAAAAAASD4AAGdqAACoDQAAAAAAAEg+AAC1agAAqA0AAAAAAABIPgAANW0AACgHAAAAAAAA7D4AAEdtAAAAAAAAAQAAAEAHAAACBAAAID4AAFZtAABIPgAAen4AAFgHAAAAAAAAID4AAIx+AABIPgAAw4AAAFgHAAAAAAAASD4AAOqAAABYBwAAAAAAAEg+AAByogAAWAcAAAAAAADsPgAAyakAAAAAAAABAAAAqAYAAAAAAADsPgAAiqkAAAAAAAABAAAAqAYAAAAAAAAgPgAAa6kAACA+AABMqQAAID4AAC2pAAAgPgAADqkAACA+AADvqAAAID4AANCoAAAgPgAAsagAACA+AACSqAAAID4AAHOoAAAgPgAAVKgAACA+AAA1qAAAID4AABaoAABIPgAAFrUAADAIAAAAAAAAID4AAAS1AABIPgAAQLUAADAIAAAAAAAAID4AAGq1AAAgPgAAm7UAAOw+AADMtQAAAAAAAAEAAAAgCAAAA/T//+w+AAD7tQAAAAAAAAEAAAA4CAAAA/T//+w+AAAqtgAAAAAAAAEAAAAgCAAAA/T//+w+AABZtgAAAAAAAAEAAAA4CAAAA/T//+w+AACItgAAAwAAAAIAAABYCAAAAgAAAIgIAAACCAAADAAAAAAAAABYCAAAEgAAABMAAAD0////9P///1gIAAAUAAAAFQAAAEg+AAC4tgAAUAgAAAAAAABIPgAA0bYAAEgIAAAAAAAASD4AABC3AABQCAAAAAAAAEg+AAAotwAASAgAAAAAAABIPgAAQLcAAFAJAAAAAAAASD4AAFS3AACgDQAAAAAAAEg+AABqtwAAUAkAAAAAAADsPgAApLcAAAAAAAACAAAAUAkAAAIAAACQCQAAAAAAAOw+AADotwAAAAAAAAEAAACoCQAAAAAAACA+AAD+twAA7D4AABe4AAAAAAAAAgAAAFAJAAACAAAA0AkAAAAAAADsPgAAW7gAAAAAAAABAAAAqAkAAAAAAADsPgAAhLgAAAAAAAACAAAAUAkAAAIAAAAICgAAAAAAAOw+AADIuAAAAAAAAAEAAAAgCgAAAAAAACA+AADeuAAA7D4AAPe4AAAAAAAAAgAAAFAJAAACAAAASAoAAAAAAADsPgAAO7kAAAAAAAABAAAAIAoAAAAAAADsPgAAkboAAAAAAAADAAAAUAkAAAIAAACICgAAAgAAAJAKAAAACAAAID4AAPi6AAAgPgAA1roAAOw+AAALuwAAAAAAAAMAAABQCQAAAgAAAIgKAAACAAAAwAoAAAAIAAAgPgAAULsAAOw+AAByuwAAAAAAAAIAAABQCQAAAgAAAOgKAAAACAAAID4AALe7AADsPgAAzLsAAAAAAAACAAAAUAkAAAIAAADoCgAAAAgAAOw+AAARvAAAAAAAAAIAAABQCQAAAgAAADALAAACAAAAID4AAC28AADsPgAAQrwAAAAAAAACAAAAUAkAAAIAAAAwCwAAAgAAAOw+AABevAAAAAAAAAIAAABQCQAAAgAAADALAAACAAAA7D4AAHq8AAAAAAAAAgAAAFAJAAACAAAAMAsAAAIAAADsPgAApbwAAAAAAAACAAAAUAkAAAIAAAC4CwAAAAAAACA+AADrvAAA7D4AAA+9AAAAAAAAAgAAAFAJAAACAAAA4AsAAAAAAAAgPgAAVb0AAOw+AAB0vQAAAAAAAAIAAABQCQAAAgAAAAgMAAAAAAAAID4AALq9AADsPgAA070AAAAAAAACAAAAUAkAAAIAAAAwDAAAAAAAACA+AAAZvgAA7D4AADK+AAAAAAAAAgAAAFAJAAACAAAAWAwAAAIAAAAgPgAAR74AAOw+AADevgAAAAAAAAIAAABQCQAAAgAAAFgMAAACAAAASD4AAF++AACQDAAAAAAAAOw+AACCvgAAAAAAAAIAAABQCQAAAgAAALAMAAACAAAAID4AAKW+AABIPgAAvL4AAJAMAAAAAAAA7D4AAPO+AAAAAAAAAgAAAFAJAAACAAAAsAwAAAIAAADsPgAAFb8AAAAAAAACAAAAUAkAAAIAAACwDAAAAgAAAOw+AAA3vwAAAAAAAAIAAABQCQAAAgAAALAMAAACAAAASD4AAFq/AABQCQAAAAAAAOw+AABwvwAAAAAAAAIAAABQCQAAAgAAAFgNAAACAAAAID4AAIK/AADsPgAAl78AAAAAAAACAAAAUAkAAAIAAABYDQAAAgAAAEg+AAC0vwAAUAkAAAAAAABIPgAAyb8AAFAJAAAAAAAAID4AAN6/AADsPgAA978AAAAAAAABAAAAoA0AAAAAAABIPgAAIsAAANANAAAAAAAAID4AAMrAAABIPgAAKsEAAOgNAAAAAAAASD4AANfAAAD4DQAAAAAAACA+AAD4wAAASD4AAAXBAADYDQAAAAAAAEg+AAAMwgAA0A0AAAAAAABIPgAAHMIAABAOAAAAAAAASD4AAFHCAADoDQAAAAAAAEg+AAAtwgAAMA4AAAAAAABIPgAAc8IAAOgNAAAAAAAAmD4AAJvCAACYPgAAncIAAJg+AACgwgAAmD4AAKLCAACYPgAApMIAAJg+AACmwgAAmD4AAKjCAACYPgAAqsIAAJg+AACswgAAmD4AAK7CAACYPgAAgrgAAJg+AACwwgAAmD4AALLCAACYPgAAtMIAAJg+AAC2wgAASD4AALjCAADoDQAAAAAAAEg+AADZwgAA2A0AAAAAAAAAAAAAQAAAAAEAAAAgDwAADAEAACABAAA0DwAAOAAAAAAAAABYAAAAAQAAAAIAAADI////yP///1gAAAADAAAABAAAAAAAAABIAAAABQAAAAYAAAABAAAAAQAAAAEAAAABAAAAAQAAAAIAAAACAAAAAwAAAAQAAAABAAAAAwAAAAIAAAAAAAAAaAAAAAIAAAAHAAAACAAAAAMAAAAEAAAAAAAAAHgAAAAFAAAACQAAAAoAAAADAAAABgAAAAAAAACIAAAABwAAAAcAAAALAAAAAwAAAAgAAABAAAAAAAAAACgBAAAMAAAADQAAADgAAAD4////KAEAAA4AAAAPAAAAwP///8D///8oAQAAEAAAABEAAADcDwAAzAAAAKQAAAC4AAAADAEAACABAAD0AAAA4AAAAAQQAADwDwAAAAAAANgDAAAgAAAAIQAAACIAAAADAAAAIwAAAAAAAADIAwAAJAAAACUAAAAmAAAAAwAAACcAAAAAAAAAuAMAACgAAAApAAAAKgAAAAMAAAArAAAAAAAAAKgDAAAJAAAALAAAAC0AAAADAAAACgAAAAAAAACYAwAALgAAAC8AAAAwAAAAAwAAADEAAAAAAAAAiAMAAAsAAAAHAAAAMgAAAAMAAAAMAAAAAAAAAHgDAAAzAAAANAAAADUAAAADAAAANgAAAAAAAABoAwAADQAAADcAAAA4AAAAAwAAAA4AAAAAAAAAWAMAADkAAAA6AAAAOwAAAAMAAAA8AAAAAAAAAEgDAAAPAAAABwAAAD0AAAADAAAAEAAAAAAAAAA4AwAAPgAAAD8AAABAAAAAAwAAAEEAAAAAAAAAKAMAABEAAABCAAAAQwAAAAMAAAASAAAAAAAAABgDAABEAAAARQAAAEYAAAADAAAARwAAAAAAAAAIAwAAEwAAAAcAAABIAAAAAwAAABQAAAAAAAAA+AIAAEkAAABKAAAASwAAAAMAAABMAAAAAAAAAOgCAAAVAAAABwAAAE0AAAADAAAAFgAAAAAAAADYAgAATgAAAE8AAABQAAAAAwAAAFEAAAAAAAAAyAIAABcAAABSAAAAUwAAAAMAAAAYAAAAAAAAALgCAABUAAAAVQAAAFYAAAADAAAAVwAAAAAAAACoAgAAGQAAAAcAAABYAAAAAwAAABoAAAAAAAAAmAIAAFkAAABaAAAAWwAAAAMAAABcAAAAAAAAAIgCAAAbAAAAXQAAAF4AAAADAAAAHAAAAAAAAAB4AgAAXwAAAGAAAABhAAAAAwAAAGIAAAAAAAAAaAIAAB0AAAAHAAAAYwAAAAMAAAAeAAAAAAAAAFgCAABkAAAAZQAAAGYAAAADAAAAZwAAAAAAAABIAgAAHwAAAAcAAABoAAAAAwAAACAAAAAAAAAAOAIAAGkAAABqAAAAawAAAAMAAABsAAAAAAAAACgCAAAhAAAABwAAAG0AAAADAAAAIgAAAAAAAAAYAgAAbgAAAG8AAABwAAAAAwAAAHEAAAAAAAAACAIAACMAAAByAAAAcwAAAAMAAAAkAAAAAAAAAPgBAAB0AAAAdQAAAHYAAAADAAAAdwAAAAAAAADYAQAAeAAAAHkAAAB6AAAAAwAAAHsAAAAAAAAAyAEAACUAAAAHAAAAfAAAAAMAAAAmAAAAAAAAALgBAAB9AAAAfgAAAH8AAAADAAAAgAAAAAAAAACoAQAAJwAAAIEAAACCAAAAAwAAACgAAAAAAAAAmAEAAIMAAACEAAAAhQAAAAMAAACGAAAAAAAAAIgBAAApAAAABwAAAIcAAAADAAAAKgAAAAAAAAB4AQAAiAAAAIkAAACKAAAAAwAAAIsAAAAAAAAAaAEAACsAAAAHAAAAjAAAAAMAAAAsAAAAAAAAAFgBAACNAAAAjgAAAI8AAAADAAAAkAAAAAAAAABIAQAALQAAAJEAAACSAAAAAwAAAC4AAAAAAAAAOAEAAJMAAACUAAAAlQAAAAMAAACWAAAAAAAAAOgBAAAvAAAAlwAAAJgAAAADAAAAMAAAAMZRAAAIFQAA9AMAAAgEAAAcFQAAPAAAAAAAAAAQBAAAmQAAAJoAAADE////xP///xAEAACbAAAAnAAAAAAAAAAgBAAAnQAAAJ4AAACfAAAAAwAAAKAAAAADAAAABAAAAAUAAAAGAAAAkAYAAKgOAACABQAAYA4AAIAFAADwBQAAgAUAAJAGAACgDgAAgAUAADAGAACABQAAoA4AADAGAACoBQAAaAUAAGAFAABgDgAAuAUAADgEAACgBAAAkAYAAHAOAACwBAAAyAQAAKAOAADYBAAAwA4AAPgEAACoDgAA+AQAAJAGAAD4BAAAkAYAAOgEAAAoBQAAaAQAACgFAAAYBQAAqA4AAJAGAAAIBQAAOAUAADAEAAA4BQAAkAYAAKAOAABIBQAAqA4AAEgFAAD4BQAASAUAADAGAAA4BQAAmA4AAJAGAAAQBgAAYA4AABAGAACoDgAAYA4AABAGAACoDgAAqA4AAKgOAAAgBgAAMAYAAPgFAACoDgAAcA4AAPgFAACoDgAAqA4AAHAGAABgDgAAcAYAAJAGAABgDgAAcAYAAKgOAACQBgAAqA4AAIAGAAAwBgAAWAYAAKgOAABwDgAAWAYAAKgOAACQBgAAAAAAAMgGAAChAAAAogAAAKMAAAAEAAAApAAAAAAAAADYBgAApQAAAKYAAACnAAAAAwAAAKgAAAAAAAAAAAAAAJxoAAAAAAAACAcAAKkAAACqAAAAqwAAAAMAAACsAAAAAAAAAPgGAACtAAAArgAAAK8AAAADAAAAsAAAAAAAAADoBgAAsQAAALIAAACzAAAAAwAAALQAAAAAAAAAAQAAAAIAAAAAAAAAAAAAANRsAAAHAAAAZAAAAAIdAQABAAAAAQAAAAUAAAACAAAAtQAAAAIAAAAxAAAAAAAAABgHAAC2AAAAtwAAAAUAAAAGAAAAAAAAACgHAAC4AAAAuQAAAAEAAAABAAAAAQAAADIAAAAAAAAASAcAALoAAAC7AAAAvAAAAAMAAAAQ1QAAYuoAAGrqAACK6gAACusAAArtAAAAAAAAENUAALrfAADC3wAA4t8AAGLgAABi4gAAAAAAABDVAAAS1QAAGtUAADrVAAC61QAAutcAAAAAAAAAAAAAAAAAAAr1AAAq9QAAqvUAAKr3AAAAAAAAAAAAAKr/AADK/wAASgABAEoCAQAAAAAAAAAAAEoKAQBqCgEA6goBAOoMAQAAAAAAYAcAALoAAAC9AAAAvgAAAAQAAAAAAAAAGgAAAAoAAAABAAAAAAAAAHAHAAC6AAAAvwAAAMAAAAAFAAAA/////wIAAAACAAAAAQAAAP////8CAAAAAQAAAAEAAAAdAAAAHgAAAB8AAAAgAAAAIQAAACEAAAAiAAAAIgAAACMAAAAjAAAAJAAAACQAAAAlAAAAKAAAAC0AAAAzAAAAOQAAAEAAAABIAAAAxQAAALkAAADJAAAAxQAAALkAAADJAAAAbgAAAJoAAAB6AAAAiQAAAIsAAACNAAAAnQAAAGsAAACLAAAAfgAAAGsAAACLAAAAfgAAAD8AAACYAAAAmAAAAG8AAACNAAAAmQAAAG8AAABbAAAAqwAAAIYAAACNAAAAeQAAAIwAAAA9AAAAmgAAAHkAAACMAAAAPQAAAJoAAABvAAAAbwAAAH0AAABuAAAAbgAAAF4AAAB8AAAAbAAAAHwAAABrAAAAfQAAAI0AAACzAAAAmQAAAH0AAABrAAAAfQAAAI0AAACzAAAAmQAAAH0AAABrAAAAfQAAAI0AAACzAAAAmQAAAH0AAACMAAAAiwAAALYAAAC2AAAAmAAAAIgAAACYAAAAiAAAAJkAAACIAAAAiwAAAG8AAACIAAAAiwAAAG8AAACbAAAAmgAAAIsAAACZAAAAiwAAAHsAAAB7AAAAPwAAAJkAAACmAAAAtwAAAIwAAACIAAAAmQAAAJoAAACmAAAAtwAAAIwAAACIAAAAmQAAAJoAAACmAAAAtwAAAIwAAACIAAAAmQAAAJoAAACqAAAAmQAAAHsAAAB7AAAAawAAAHkAAABrAAAAeQAAAKcAAACXAAAAtwAAAIwAAACXAAAAtwAAAIwAAACqAAAAmgAAAIsAAACZAAAAiwAAAHsAAAB7AAAAPwAAAHwAAACmAAAAtwAAAIwAAACIAAAAmQAAAJoAAACmAAAAtwAAAIwAAACIAAAAmQAAAJoAAACmAAAAtwAAAIwAAACIAAAAmQAAAJoAAACqAAAAmQAAAIoAAACKAAAAegAAAHkAAAB6AAAAeQAAAKcAAACXAAAAtwAAAIwAAACXAAAAtwAAAIwAAACNAAAAbwAAAIwAAACMAAAAjAAAAIwAAACKAAAAmQAAAIgAAACnAAAAmAAAAJgAAABrAAAApwAAAFsAAAB6AAAAawAAAKcAAABrAAAApwAAAFsAAABrAAAAawAAAKcAAACZAAAAmQAAAJkAAADIAAAAuQAAAKAAAACaAAAAmgAAAJoAAACMAAAAXAAAAIkAAACKAAAAjAAAAJgAAACKAAAAiwAAAJkAAABKAAAAlQAAAFwAAACLAAAAawAAAHoAAACYAAAAjAAAALMAAACmAAAAtgAAAIwAAADjAAAAegAAAMUAAACaAAAAxAAAAMQAAACnAAAAmgAAAJgAAACnAAAAtgAAALYAAACGAAAAlQAAAIgAAACZAAAAeQAAAIgAAACJAAAAqQAAAMIAAACmAAAApwAAAJoAAACnAAAAiQAAALYAAACaAAAAxAAAAKcAAACnAAAAmgAAAJgAAACnAAAAtgAAALYAAACGAAAAlQAAAIgAAACZAAAAeQAAAIgAAAB6AAAAqQAAANAAAACmAAAApwAAAJoAAACYAAAApwAAALYAAABuAAAAbgAAAHwAAAB9AAAAjAAAAJkAAAB9AAAAfwAAAIwAAABtAAAAbwAAAI8AAAB/AAAAbwAAAE8AAABsAAAAewAAAD8AAAB9AAAAbgAAAF4AAABuAAAAXwAAAE8AAAB9AAAAbwAAAG4AAABOAAAAbgAAAG8AAABvAAAAXwAAAF4AAABsAAAAewAAAGwAAAB9AAAAbgAAAHwAAABuAAAAXwAAAF4AAAB9AAAAbwAAAG8AAABPAAAAfQAAAH4AAABvAAAAbwAAAE8AAABsAAAAewAAAF0AAACZAAAAigAAAIoAAAB8AAAAigAAAF4AAADgAAAApwAAAHoAAABeAAAAigAAALYAAACaAAAAlQAAAGsAAACnAAAAmgAAAJUAAABcAAAApwAAAJoAAAC4AAAAmgAAALcAAAC4AAAAmgAAAIsAAACaAAAAmgAAAJoAAACLAAAAmgAAAJoAAACMAAAAxgAAAKkAAADGAAAAlQAAAIYAAAAAAAAAgAcAALoAAADBAAAAwgAAAAYAAAAAAAAAAAAAACAAAAAaAAAAFQAAABEAAAANAAAACQAAAAUAAAACAAAAAAAAAP7////7////9/////P////v////6////+b////g////5v///+v////v////8/////f////7/////v///wAAAAACAAAABQAAAAkAAAANAAAAEQAAABUAAAAaAAAAIAAAAADw//+a+f//cvz//4r9//8e/v//ev7//8X+//8A////xf7//3r+//8e/v//iv3//3L8//+a+f//APD//wAAAAADAAAAAwAAAAIAAAAAAAAAAwAAAAQAAAAEAAAAAAAAAAEAAAAAAAAAAgAAAAEAAAACAAAAAAAAAAMAAAABAAAAAwAAAAIAAAADAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAwAAAAAAAAADAAAAAQAAAAMAAAACAAAAAgAAwAMAAMAEAADABQAAwAYAAMAHAADACAAAwAkAAMAKAADACwAAwAwAAMANAADADgAAwA8AAMAQAADAEQAAwBIAAMATAADAFAAAwBUAAMAWAADAFwAAwBgAAMAZAADAGgAAwBsAAMAcAADAHQAAwB4AAMAfAADAAAAAswEAAMMCAADDAwAAwwQAAMMFAADDBgAAwwcAAMMIAADDCQAAwwoAAMMLAADDDAAAww0AANMOAADDDwAAwwAADLsBAAzDAgAMwwMADMMEAAzTGCEAABQAAABDLlVURi04AAAAAAAAAAAAAAAAAN4SBJUAAAAA/////////////////CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASCEAAAUAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAA8hQBAAAEAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAr/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANDIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASCEAAMAiAAAJAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABQAAAPoYAQAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCMAAAUAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAFAAAAAh0BAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAP//////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVEAAAEAmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACQAAAAlAAAAJgAAACcAAAAoAAAAKQAAACoAAAArAAAALAAAAC0AAAAuAAAALwAAADAAAAAxAAAAMgAAADMAAAA0AAAANQAAADYAAAA3AAAAOAAAADkAAAA6AAAAOwAAADwAAAA9AAAAPgAAAD8AAABAAAAAQQAAAEIAAABDAAAARAAAAEUAAABGAAAARwAAAEgAAABJAAAASgAAAEsAAABMAAAATQAAAE4AAABPAAAAUAAAAFEAAABSAAAAUwAAAFQAAABVAAAAVgAAAFcAAABYAAAAWQAAAFoAAABbAAAAXAAAAF0AAABeAAAAXwAAAGAAAABBAAAAQgAAAEMAAABEAAAARQAAAEYAAABHAAAASAAAAEkAAABKAAAASwAAAEwAAABNAAAATgAAAE8AAABQAAAAUQAAAFIAAABTAAAAVAAAAFUAAABWAAAAVwAAAFgAAABZAAAAWgAAAHsAAAB8AAAAfQAAAH4AAAB/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABELAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAACAAAAAhAAAAIgAAACMAAAAkAAAAJQAAACYAAAAnAAAAKAAAACkAAAAqAAAAKwAAACwAAAAtAAAALgAAAC8AAAAwAAAAMQAAADIAAAAzAAAANAAAADUAAAA2AAAANwAAADgAAAA5AAAAOgAAADsAAAA8AAAAPQAAAD4AAAA/AAAAQAAAAGEAAABiAAAAYwAAAGQAAABlAAAAZgAAAGcAAABoAAAAaQAAAGoAAABrAAAAbAAAAG0AAABuAAAAbwAAAHAAAABxAAAAcgAAAHMAAAB0AAAAdQAAAHYAAAB3AAAAeAAAAHkAAAB6AAAAWwAAAFwAAABdAAAAXgAAAF8AAABgAAAAYQAAAGIAAABjAAAAZAAAAGUAAABmAAAAZwAAAGgAAABpAAAAagAAAGsAAABsAAAAbQAAAG4AAABvAAAAcAAAAHEAAAByAAAAcwAAAHQAAAB1AAAAdgAAAHcAAAB4AAAAeQAAAHoAAAB7AAAAfAAAAH0AAAB+AAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAGQAAADoAwAAECcAAKCGAQBAQg8AgJaYAADh9QVfcIkA/wkvDwAAAAAwCAAAwwAAAMQAAAAAAAAASAgAAMUAAADGAAAAAQAAAAEAAAACAAAAAwAAAAEAAAACAAAAAgAAAAcAAAAEAAAABwAAAAMAAAAIAAAAAAAAAFAIAADHAAAAyAAAAAcAAAAJAAAAAwAAAAQAAAAIAAAACQAAAAoAAAAKAAAACwAAAAkAAAALAAAACgAAAAgAAAAAAAAAWAgAABIAAAATAAAA+P////j///9YCAAAFAAAABUAAAAIMQAAHDEAAAgAAAAAAAAAcAgAAMkAAADKAAAA+P////j///9wCAAAywAAAMwAAAA4MQAATDEAABwAAAAwAAAABAAAAAAAAACgCAAAzQAAAM4AAAD8/////P///6AIAADPAAAA0AAAAHAxAACEMQAADAAAAAAAAAC4CAAAFgAAABcAAAAEAAAA+P///7gIAAAYAAAAGQAAAPT////0////uAgAABoAAAAbAAAAoDEAAOQIAAD4CAAAHAAAADAAAADIMQAAtDEAAAAAAAAACQAA0QAAANIAAAAIAAAACQAAAAMAAAAEAAAADAAAAAkAAAAKAAAACgAAAAsAAAAJAAAADAAAAAsAAAAAAAAAEAkAANMAAADUAAAACQAAAAEAAAACAAAAAwAAAA0AAAACAAAAAgAAAAcAAAAEAAAABwAAAA0AAAAMAAAAAAAAACAJAADVAAAA1gAAAAoAAAAJAAAAAwAAAAQAAAAIAAAACQAAAAoAAAAOAAAADwAAAA0AAAALAAAACgAAAAAAAAAwCQAA1wAAANgAAAALAAAAAQAAAAIAAAADAAAAAQAAAAIAAAACAAAAEAAAABEAAAAOAAAAAwAAAAgAAAAAAAAAQAkAANkAAADaAAAA2wAAAAEAAAAFAAAADgAAAAAAAABgCQAA3AAAAN0AAADbAAAAAgAAAAYAAAAPAAAAAAAAAHAJAADeAAAA3wAAANsAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAAAAACwCQAA4AAAAOEAAADbAAAADAAAAA0AAAAOAAAADwAAABAAAAARAAAAEgAAABMAAAAUAAAAFQAAABYAAAAAAAAA6AkAAOIAAADjAAAA2wAAAAMAAAAEAAAAFwAAAAUAAAAYAAAAAQAAAAIAAAAGAAAAAAAAACgKAADkAAAA5QAAANsAAAAHAAAACAAAABkAAAAJAAAAGgAAAAMAAAAEAAAACgAAAAAAAABgCgAA5gAAAOcAAADbAAAAEgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAAQAAAPj///9gCgAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAAAAAAACYCgAA6AAAAOkAAADbAAAAGgAAACAAAAAhAAAAIgAAACMAAAAkAAAAAgAAAPj///+YCgAAGwAAABwAAAAdAAAAHgAAAB8AAAAgAAAAIQAAACUAAABIAAAAOgAAACUAAABNAAAAOgAAACUAAABTAAAAAAAAACUAAABtAAAALwAAACUAAABkAAAALwAAACUAAAB5AAAAAAAAACUAAABJAAAAOgAAACUAAABNAAAAOgAAACUAAABTAAAAIAAAACUAAABwAAAAAAAAACUAAABhAAAAIAAAACUAAABiAAAAIAAAACUAAABkAAAAIAAAACUAAABIAAAAOgAAACUAAABNAAAAOgAAACUAAABTAAAAIAAAACUAAABZAAAAAAAAAEEAAABNAAAAAAAAAFAAAABNAAAAAAAAAEoAAABhAAAAbgAAAHUAAABhAAAAcgAAAHkAAAAAAAAARgAAAGUAAABiAAAAcgAAAHUAAABhAAAAcgAAAHkAAAAAAAAATQAAAGEAAAByAAAAYwAAAGgAAAAAAAAAQQAAAHAAAAByAAAAaQAAAGwAAAAAAAAATQAAAGEAAAB5AAAAAAAAAEoAAAB1AAAAbgAAAGUAAAAAAAAASgAAAHUAAABsAAAAeQAAAAAAAABBAAAAdQAAAGcAAAB1AAAAcwAAAHQAAAAAAAAAUwAAAGUAAABwAAAAdAAAAGUAAABtAAAAYgAAAGUAAAByAAAAAAAAAE8AAABjAAAAdAAAAG8AAABiAAAAZQAAAHIAAAAAAAAATgAAAG8AAAB2AAAAZQAAAG0AAABiAAAAZQAAAHIAAAAAAAAARAAAAGUAAABjAAAAZQAAAG0AAABiAAAAZQAAAHIAAAAAAAAASgAAAGEAAABuAAAAAAAAAEYAAABlAAAAYgAAAAAAAABNAAAAYQAAAHIAAAAAAAAAQQAAAHAAAAByAAAAAAAAAEoAAAB1AAAAbgAAAAAAAABKAAAAdQAAAGwAAAAAAAAAQQAAAHUAAABnAAAAAAAAAFMAAABlAAAAcAAAAAAAAABPAAAAYwAAAHQAAAAAAAAATgAAAG8AAAB2AAAAAAAAAEQAAABlAAAAYwAAAAAAAABTAAAAdQAAAG4AAABkAAAAYQAAAHkAAAAAAAAATQAAAG8AAABuAAAAZAAAAGEAAAB5AAAAAAAAAFQAAAB1AAAAZQAAAHMAAABkAAAAYQAAAHkAAAAAAAAAVwAAAGUAAABkAAAAbgAAAGUAAABzAAAAZAAAAGEAAAB5AAAAAAAAAFQAAABoAAAAdQAAAHIAAABzAAAAZAAAAGEAAAB5AAAAAAAAAEYAAAByAAAAaQAAAGQAAABhAAAAeQAAAAAAAABTAAAAYQAAAHQAAAB1AAAAcgAAAGQAAABhAAAAeQAAAAAAAABTAAAAdQAAAG4AAAAAAAAATQAAAG8AAABuAAAAAAAAAFQAAAB1AAAAZQAAAAAAAABXAAAAZQAAAGQAAAAAAAAAVAAAAGgAAAB1AAAAAAAAAEYAAAByAAAAaQAAAAAAAABTAAAAYQAAAHQAAAAAAAAAJQAAAG0AAAAvAAAAJQAAAGQAAAAvAAAAJQAAAHkAAAAlAAAAWQAAAC0AAAAlAAAAbQAAAC0AAAAlAAAAZAAAACUAAABJAAAAOgAAACUAAABNAAAAOgAAACUAAABTAAAAIAAAACUAAABwAAAAJQAAAEgAAAA6AAAAJQAAAE0AAAAlAAAASAAAADoAAAAlAAAATQAAADoAAAAlAAAAUwAAACUAAABIAAAAOgAAACUAAABNAAAAOgAAACUAAABTAAAAAAAAAMgKAADqAAAA6wAAANsAAAABAAAAAAAAAPAKAADsAAAA7QAAANsAAAACAAAAAAAAABALAADuAAAA7wAAANsAAAAiAAAAIwAAAAwAAAANAAAADgAAAA8AAAAkAAAAEAAAABEAAAAAAAAAOAsAAPAAAADxAAAA2wAAACUAAAAmAAAAEgAAABMAAAAUAAAAFQAAACcAAAAWAAAAFwAAAAAAAABYCwAA8gAAAPMAAADbAAAAKAAAACkAAAAYAAAAGQAAABoAAAAbAAAAKgAAABwAAAAdAAAAAAAAAHgLAAD0AAAA9QAAANsAAAArAAAALAAAAB4AAAAfAAAAIAAAACEAAAAtAAAAIgAAACMAAAAAAAAAmAsAAPYAAAD3AAAA2wAAAAMAAAAEAAAAAAAAAMALAAD4AAAA+QAAANsAAAAFAAAABgAAAAAAAADoCwAA+gAAAPsAAADbAAAAAQAAACUAAAAAAAAAEAwAAPwAAAD9AAAA2wAAAAIAAAAmAAAAAAAAADgMAAD+AAAA/wAAANsAAAAQAAAABAAAACQAAAAAAAAAYAwAAAABAAABAQAA2wAAABEAAAAFAAAAJQAAAAAAAAC4DAAAAgEAAAMBAADbAAAAAwAAAAQAAAALAAAALgAAAC8AAAAMAAAAMAAAAAAAAACADAAAAgEAAAQBAADbAAAAAwAAAAQAAAALAAAALgAAAC8AAAAMAAAAMAAAAAAAAADoDAAABQEAAAYBAADbAAAABQAAAAYAAAANAAAAMQAAADIAAAAOAAAAMwAAAAAAAAAoDQAABwEAAAgBAADbAAAAAAAAADgNAAAJAQAACgEAANsAAAAPAAAAEgAAABAAAAATAAAAEQAAAAIAAAAUAAAADwAAAAAAAACADQAACwEAAAwBAADbAAAANAAAADUAAAAmAAAAJwAAACgAAAAAAAAAkA0AAA0BAAAOAQAA2wAAADYAAAA3AAAAKQAAACoAAAArAAAAZgAAAGEAAABsAAAAcwAAAGUAAAAAAAAAdAAAAHIAAAB1AAAAZQAAAAAAAAAAAAAAUAkAAAIBAAAPAQAA2wAAAAAAAABgDQAAAgEAABABAADbAAAAFQAAAAMAAAAEAAAABQAAABIAAAAWAAAAEwAAABcAAAAUAAAABgAAABgAAAAQAAAAAAAAAMgMAAACAQAAEQEAANsAAAAHAAAACAAAABEAAAA4AAAAOQAAABIAAAA6AAAAAAAAAAgNAAACAQAAEgEAANsAAAAJAAAACgAAABMAAAA7AAAAPAAAABQAAAA9AAAAAAAAAJAMAAACAQAAEwEAANsAAAADAAAABAAAAAsAAAAuAAAALwAAAAwAAAAwAAAAAAAAAJAKAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAAAAAAMAKAAAbAAAAHAAAAB0AAAAeAAAAHwAAACAAAAAhAAAAAAAAAMANAAAUAQAAFQEAAD4AAAACAAAAAAAAANgNAAAWAQAAFwEAABgBAAAZAQAAGQAAAAYAAAABAAAABwAAAAAAAAAADgAAFgEAABoBAAAYAQAAGQEAABkAAAAHAAAAAgAAAAgAAAAAAAAAEA4AABsBAAAcAQAAPwAAAAAAAAAgDgAAGwEAAB0BAAA/AAAAAAAAAFAOAAAWAQAAHgEAABgBAAAZAQAAGgAAAAAAAABADgAAFgEAAB8BAAAYAQAAGQEAABsAAAAAAAAA2A4AABYBAAAgAQAAGAEAABkBAAAcAAAAAAAAAOgOAAAWAQAAIQEAABgBAAAZAQAAGQAAAAgAAAADAAAACQAAAAAAAAABAAEADAALAAoACwAQAAsAKAAhABgACwAUAAsAIAALAFAAIQASAAsADwALAEAAIQCgAGMABAADAAMAAgACAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAIAAgACAAIAAgACAAIAAgADIAIgAiACIAIgAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAWAEwATABMAEwATABMAEwATABMAEwATABMAEwATABMAI2AjYCNgI2AjYCNgI2AjYCNgI2ATABMAEwATABMAEwATACNUI1QjVCNUI1QjVCMUIxQjFCMUIxQjFCMUIxQjFCMUIxQjFCMUIxQjFCMUIxQjFCMUIxQTABMAEwATABMAEwAjWCNYI1gjWCNYI1gjGCMYIxgjGCMYIxgjGCMYIxgjGCMYIxgjGCMYIxgjGCMYIxgjGCMYEwATABMAEwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwgAEJveDogACAtLS0tLQoAc2l6ZTogACAgIChoZWFkZXIgc2l6ZTogACkKAHZlcnNpb246IABmbGFnczogAE5TdDNfXzIxNWJhc2ljX3N0cmluZ2J1ZkljTlNfMTFjaGFyX3RyYWl0c0ljRUVOU185YWxsb2NhdG9ySWNFRUVFAE5TdDNfXzIxOWJhc2ljX29zdHJpbmdzdHJlYW1JY05TXzExY2hhcl90cmFpdHNJY0VFTlNfOWFsbG9jYXRvckljRUVFRQBONGhlaWY5Qm94SGVhZGVyRQBONGhlaWYzQm94RQBmdHlwIGJveCB0b28gc21hbGwgKGxlc3MgdGhhbiA4IGJ5dGVzKQBtYWpvciBicmFuZDogAG1pbm9yIHZlcnNpb246IABjb21wYXRpYmxlIGJyYW5kczogAE40aGVpZjhCb3hfZnR5cEUATWF4aW11bSBudW1iZXIgb2YgY2hpbGQgYm94ZXMgACBleGNlZWRlZC4ATlN0M19fMjE4YmFzaWNfc3RyaW5nc3RyZWFtSWNOU18xMWNoYXJfdHJhaXRzSWNFRU5TXzlhbGxvY2F0b3JJY0VFRUUAQm94IHNpemUgKAAgYnl0ZXMpIHNtYWxsZXIgdGhhbiBoZWFkZXIgc2l6ZSAoACBieXRlcykATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmM0JveEVOU185YWxsb2NhdG9ySVMyX0VFRUUAbG9jYXRpb246IABONGhlaWY3Qm94X3VybEUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmN0JveF91cmxFTlNfOWFsbG9jYXRvcklTMl9FRUVFAE40aGVpZjhCb3hfZHJlZkUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9kcmVmRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBONGhlaWY4Qm94X2RpbmZFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjhCb3hfZGluZkVOU185YWxsb2NhdG9ySVMyX0VFRUUAZ3JvdXAgdHlwZTogAHwgZ3JvdXAgaWQ6IAB8IGVudGl0eSBJRHM6IAAgAE40aGVpZjhCb3hfZ3JwbEUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9ncnBsRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBudW1iZXIgb2YgZGF0YSBieXRlczogAE40aGVpZjhCb3hfaWRhdEUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9pZGF0RU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBjb25maWd1cmF0aW9uX3ZlcnNpb246IABnZW5lcmFsX3Byb2ZpbGVfc3BhY2U6IABnZW5lcmFsX3RpZXJfZmxhZzogAGdlbmVyYWxfcHJvZmlsZV9pZGM6IABnZW5lcmFsX3Byb2ZpbGVfY29tcGF0aWJpbGl0eV9mbGFnczogAGdlbmVyYWxfY29uc3RyYWludF9pbmRpY2F0b3JfZmxhZ3M6IABnZW5lcmFsX2xldmVsX2lkYzogAG1pbl9zcGF0aWFsX3NlZ21lbnRhdGlvbl9pZGM6IABwYXJhbGxlbGlzbV90eXBlOiAAY2hyb21hX2Zvcm1hdDogAGJpdF9kZXB0aF9sdW1hOiAAYml0X2RlcHRoX2Nocm9tYTogAGF2Z19mcmFtZV9yYXRlOiAAY29uc3RhbnRfZnJhbWVfcmF0ZTogAG51bV90ZW1wb3JhbF9sYXllcnM6IAB0ZW1wb3JhbF9pZF9uZXN0ZWQ6IABsZW5ndGhfc2l6ZTogADxhcnJheT4KAGFycmF5X2NvbXBsZXRlbmVzczogAE5BTF91bml0X3R5cGU6IABONGhlaWY4Qm94X2h2Y0NFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjhCb3hfaHZjQ0VOU185YWxsb2NhdG9ySVMyX0VFRUUAcmVmZXJlbmNlIHdpdGggdHlwZSAnACcAIGZyb20gSUQ6IAAgdG8gSURzOiAATjRoZWlmOEJveF9pcmVmRQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2lyZWZFTlNfOWFsbG9jYXRvcklTMl9FRUVFAGNsZWFuX2FwZXJ0dXJlOiAALwAgeCAAb2Zmc2V0OiAAIDsgAE40aGVpZjhCb3hfY2xhcEUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9jbGFwRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBtaXJyb3IgYXhpczogAHZlcnRpY2FsCgBob3Jpem9udGFsCgBONGhlaWY4Qm94X2ltaXJFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjhCb3hfaW1pckVOU185YWxsb2NhdG9ySVMyX0VFRUUAcm90YXRpb246IAAgZGVncmVlcyAoQ0NXKQoATjRoZWlmOEJveF9pcm90RQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2lyb3RFTlNfOWFsbG9jYXRvcklTMl9FRUVFAGF1eCB0eXBlOiAAYXV4IHN1YnR5cGVzOiAATjRoZWlmOEJveF9hdXhDRQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2F1eENFTlNfOWFsbG9jYXRvcklTMl9FRUVFAGltYWdlIHdpZHRoOiAAaW1hZ2UgaGVpZ2h0OiAATjRoZWlmOEJveF9pc3BlRQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2lzcGVFTlNfOWFsbG9jYXRvcklTMl9FRUVFAGFzc29jaWF0aW9ucyBmb3IgaXRlbSBJRDogAHByb3BlcnR5IGluZGV4OiAAIChlc3NlbnRpYWw6IABONGhlaWY4Qm94X2lwbWFFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjhCb3hfaXBtYUVOU185YWxsb2NhdG9ySVMyX0VFRUUATjRoZWlmOEJveF9pcGNvRQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2lwY29FTlNfOWFsbG9jYXRvcklTMl9FRUVFAE40aGVpZjhCb3hfaXBycEUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9pcHJwRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBpdGVtX0lEOiAAaXRlbV9wcm90ZWN0aW9uX2luZGV4OiAAaXRlbV90eXBlOiAAaXRlbV9uYW1lOiAAY29udGVudF90eXBlOiAAY29udGVudF9lbmNvZGluZzogAGl0ZW0gdXJpIHR5cGU6IABoaWRkZW4gaXRlbTogAE40aGVpZjhCb3hfaW5mZUUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9pbmZlRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBONGhlaWY4Qm94X2lpbmZFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjhCb3hfaWluZkVOU185YWxsb2NhdG9ySVMyX0VFRUUAaWxvYyBib3ggY29udGFpbnMgACBpdGVtcywgd2hpY2ggZXhjZWVkcyB0aGUgc2VjdXJpdHkgbGltaXQgb2YgACBpdGVtcy4ATnVtYmVyIG9mIGV4dGVudHMgaW4gaWxvYyBib3ggKAApIGV4Y2VlZHMgc2VjdXJpdHkgbGltaXQgKABpdGVtIElEOiAAICBjb25zdHJ1Y3Rpb24gbWV0aG9kOiAAICBkYXRhX3JlZmVyZW5jZV9pbmRleDogACAgYmFzZV9vZmZzZXQ6IAAgIGV4dGVudHM6IAAsADtpbmRleD0ATjRoZWlmOEJveF9pbG9jRQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2lsb2NFTlNfOWFsbG9jYXRvcklTMl9FRUVFAE40aGVpZjhCb3hfcGl0bUUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9waXRtRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBwcmVfZGVmaW5lZDogAGhhbmRsZXJfdHlwZTogAG5hbWU6IABONGhlaWY4Qm94X2hkbHJFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjhCb3hfaGRsckVOU185YWxsb2NhdG9ySVMyX0VFRUUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEJveF9tZXRhRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBOU3QzX18yMjBfX3NoYXJlZF9wdHJfZW1wbGFjZUlONGhlaWY4Qm94X2Z0eXBFTlNfOWFsbG9jYXRvcklTMl9FRUVFAE40aGVpZjhCb3hfbWV0YUUARXh0ZW50IGluIGlsb2MgYm94IHJlZmVyZW5jZXMgZGF0YSBvdXRzaWRlIG9mIGZpbGUgYm91bmRzIAAocG9pbnRzIHRvIGZpbGUgcG9zaXRpb24gAGlsb2MgYm94IGNvbnRhaW5lZCAAIGJ5dGVzLCB0b3RhbCBtZW1vcnkgc2l6ZSB3b3VsZCBiZSAAIGJ5dGVzLCBleGNlZWRpbmcgdGhlIHNlY3VyaXR5IGxpbWl0IG9mIAAgYnl0ZXMAaWRhdCBib3ggcmVmZXJlbmNlZCBpbiBpcmVmIGJveCBpcyBub3QgcHJlc2VudCBpbiBmaWxlAGlkYXQgYm94IGNvbnRhaW5lZCAASXRlbSAoSUQ9ACkgaGFzIG5vIHByb3BlcnRpZXMgYXNzaWduZWQgdG8gaXQgaW4gaXBtYSBib3gATm9uZXhpc3RpbmcgcHJvcGVydHkgKGluZGV4PQApIGZvciBpdGVtIAAgSUQ9ACByZWZlcmVuY2VkIGluIGlwbWEgYm94AFVua25vd24gZXJyb3IAZXJyb3IuY2MAZ2V0X2Vycm9yX3N0cmluZwBEZWNvZGVyIHBsdWdpbiBnZW5lcmF0ZWQgYW4gZXJyb3IATWVtb3J5IGFsbG9jYXRpb24gZXJyb3IAVXNhZ2UgZXJyb3IAVW5zdXBwb3J0ZWQgZmVhdHVyZQBVbnN1cHBvcnRlZCBmaWxlLXR5cGUASW52YWxpZCBpbnB1dABJbnB1dCBmaWxlIGRvZXMgbm90IGV4aXN0AFVuc3VwcG9ydGVkIGNvbG9yIGNvbnZlcnNpb24AVW5zdXBwb3J0ZWQgZGF0YSB2ZXJzaW9uAFVuc3VwcG9ydGVkIGltYWdlIHR5cGUAVW5zdXBwb3J0ZWQgY29kZWMASW5kZXggb3V0IG9mIHJhbmdlAFRoZSB2ZXJzaW9uIG9mIHRoZSBwYXNzZWQgcGx1Z2luIGlzIG5vdCBzdXBwb3J0ZWQATm9uLWV4aXN0aW5nIGltYWdlIGNoYW5uZWwgcmVmZXJlbmNlZABOVUxMIGFyZ3VtZW50IHJlY2VpdmVkAE5vbi1leGlzdGluZyBpbWFnZSBJRCByZWZlcmVuY2VkAFNlY3VyaXR5IGxpbWl0IGV4Y2VlZGVkAE5vIG9yIGludmFsaWQgcHJpbWFyeSBpbWFnZQBUeXBlIG9mIGF1eGlsaWFyeSBpbWFnZSB1bnNwZWNpZmllZABPdmVybGF5IGltYWdlIG91dHNpZGUgb2YgY2FudmFzIGFyZWEASW52YWxpZCBvdmVybGF5IGRhdGEASW52YWxpZCBjbGVhbi1hcGVydHVyZSBzcGVjaWZpY2F0aW9uAEl0ZW0gaGFzIG5vIGRhdGEATm8gcHJvcGVydGllcyBhc3NpZ25lZCB0byBpdGVtACdpcG1hJyBib3ggcmVmZXJlbmNlcyBhIG5vbi1leGlzdGluZyBwcm9wZXJ0eQBOb3QgYSAncGljdCcgaGFuZGxlcgBObyAnaW5mZScgYm94AE5vICdpcmVmJyBib3gATm8gJ2lwcnAnIGJveABObyAnaWluZicgYm94AE5vICdpbG9jJyBib3gATm8gJ2lwbWEnIGJveABObyAnaXBjbycgYm94AE5vICdwaXRtJyBib3gATm8gJ2h2Y0MnIGJveABObyAnaGRscicgYm94AE5vICdtZXRhJyBib3gATm8gJ2lkYXQnIGJveABObyAnZnR5cCcgYm94AE1pc3NpbmcgZ3JpZCBpbWFnZXMASW52YWxpZCBncmlkIGRhdGEASW52YWxpZCBib3ggc2l6ZQBVbmV4cGVjdGVkIGVuZCBvZiBmaWxlAFVuc3BlY2lmaWVkADogAEZpbGUgZG9lcyBub3Qgc3VwcG9ydCB0aGUgJ2hlaWMnIGJyYW5kLgoATlN0M19fMjE5YmFzaWNfaXN0cmluZ3N0cmVhbUljTlNfMTFjaGFyX3RyYWl0c0ljRUVOU185YWxsb2NhdG9ySWNFRUVFAEl0ZW0gd2l0aCBJRCAAIGhhcyBubyBjb21wcmVzc2VkIGRhdGEAYml0X2RlcHRoID49IDEAaGVpZl9pbWFnZS5jYwBhZGRfcGxhbmUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmMTRIZWlmUGl4ZWxJbWFnZUVOU185YWxsb2NhdG9ySVMyX0VFRUUAQ2FuIGN1cnJlbnRseSBvbmx5IHJvdGF0ZSBpbWFnZXMgd2l0aCA4IGJpdHMgcGVyIHBpeGVsAENhbiBjdXJyZW50bHkgb25seSBmaWxsIGltYWdlcyB3aXRoIDggYml0cyBwZXIgcGl4ZWwAZmlsbF9SR0JfMTZiaXQAaW5fdyA+PSAwAG92ZXJsYXkAaW5faCA+PSAwAG91dF93ID49IDAAb3V0X2ggPj0gMABPdmVybGF5IGltYWdlIG91dHNpZGUgb2YgcmlnaHQgb3IgYm90dG9tIGNhbnZhcyBib3JkZXIAT3ZlcmxheSBpbWFnZSBvdXRzaWRlIG9mIGxlZnQgb3IgdG9wIGNhbnZhcyBib3JkZXIAaGVpZl9nZXRfdmVyc2lvbgBpaQBoZWlmX2dldF92ZXJzaW9uX251bWJlcgBoZWlmX2NvbnRleHRfYWxsb2MAaGVpZl9jb250ZXh0X2ZyZWUAdmlpAGhlaWZfY29udGV4dF9yZWFkX2Zyb21fbWVtb3J5AGlpaWkAaGVpZl9jb250ZXh0X2dldF9udW1iZXJfb2ZfdG9wX2xldmVsX2ltYWdlcwBpaWkAaGVpZl9qc19jb250ZXh0X2dldF9pbWFnZV9oYW5kbGUAaGVpZl9qc19kZWNvZGVfaW1hZ2UAaWlpaWkAaGVpZl9pbWFnZV9oYW5kbGVfcmVsZWFzZQBFcnJvcgB2AHZpAE9rAGVycm9yX2NvZGUAdmlpaQBzdWJfZXJyb3JfY29kZQBCaXRzdHJlYW1SYW5nZUJhc2UAQml0c3RyZWFtUmFuZ2UAZXJyb3IASW5kZW50AGdldF9pbmRlbnQAQm94SGVhZGVyAGdldF9ib3hfc2l6ZQBnZXRfaGVhZGVyX3NpemUAZ2V0X3Nob3J0X3R5cGUAZ2V0X3R5cGVfc3RyaW5nAGR1bXAAQm94AGdldF9jaGlsZF9ib3gAaQBIZWlmRmlsZQByZWFkX2Zyb21fbWVtb3J5AGdldF9udW1faW1hZ2VzAGdldF9wcmltYXJ5X2ltYWdlX0lEAGdldF9pdGVtX0lEcwBnZXRfY29tcHJlc3NlZF9pbWFnZV9kYXRhAGhlaWZfZXJyb3JfY29kZQBoZWlmX2Vycm9yX09rAGhlaWZfZXJyb3JfSW5wdXRfZG9lc19ub3RfZXhpc3QAaGVpZl9lcnJvcl9JbnZhbGlkX2lucHV0AGhlaWZfZXJyb3JfVW5zdXBwb3J0ZWRfZmlsZXR5cGUAaGVpZl9lcnJvcl9VbnN1cHBvcnRlZF9mZWF0dXJlAGhlaWZfZXJyb3JfVXNhZ2VfZXJyb3IAaGVpZl9lcnJvcl9NZW1vcnlfYWxsb2NhdGlvbl9lcnJvcgBoZWlmX3N1YmVycm9yX2NvZGUAaGVpZl9zdWJlcnJvcl9VbnNwZWNpZmllZABoZWlmX3N1YmVycm9yX0VuZF9vZl9kYXRhAGhlaWZfc3ViZXJyb3JfSW52YWxpZF9ib3hfc2l6ZQBoZWlmX3N1YmVycm9yX05vX2Z0eXBfYm94AGhlaWZfc3ViZXJyb3JfTm9faWRhdF9ib3gAaGVpZl9zdWJlcnJvcl9Ob19tZXRhX2JveABoZWlmX3N1YmVycm9yX05vX2hkbHJfYm94AGhlaWZfc3ViZXJyb3JfTm9fcGl0bV9ib3gAaGVpZl9zdWJlcnJvcl9Ob19pcGNvX2JveABoZWlmX3N1YmVycm9yX05vX2lwbWFfYm94AGhlaWZfc3ViZXJyb3JfTm9faWxvY19ib3gAaGVpZl9zdWJlcnJvcl9Ob19paW5mX2JveABoZWlmX3N1YmVycm9yX05vX2lwcnBfYm94AGhlaWZfc3ViZXJyb3JfTm9faXJlZl9ib3gAaGVpZl9zdWJlcnJvcl9Ob19waWN0X2hhbmRsZXIAaGVpZl9zdWJlcnJvcl9JcG1hX2JveF9yZWZlcmVuY2VzX25vbmV4aXN0aW5nX3Byb3BlcnR5AGhlaWZfc3ViZXJyb3JfTm9fcHJvcGVydGllc19hc3NpZ25lZF90b19pdGVtAGhlaWZfc3ViZXJyb3JfTm9faXRlbV9kYXRhAGhlaWZfc3ViZXJyb3JfSW52YWxpZF9ncmlkX2RhdGEAaGVpZl9zdWJlcnJvcl9NaXNzaW5nX2dyaWRfaW1hZ2VzAGhlaWZfc3ViZXJyb3JfU2VjdXJpdHlfbGltaXRfZXhjZWVkZWQAaGVpZl9zdWJlcnJvcl9Ob25leGlzdGluZ19pbWFnZV9yZWZlcmVuY2VkAGhlaWZfc3ViZXJyb3JfTnVsbF9wb2ludGVyX2FyZ3VtZW50AGhlaWZfc3ViZXJyb3JfVW5zdXBwb3J0ZWRfY29kZWMAaGVpZl9zdWJlcnJvcl9VbnN1cHBvcnRlZF9pbWFnZV90eXBlAGhlaWZfY29tcHJlc3Npb25fZm9ybWF0AGhlaWZfY29tcHJlc3Npb25fdW5kZWZpbmVkAGhlaWZfY29tcHJlc3Npb25fSEVWQwBoZWlmX2NvbXByZXNzaW9uX0FWQwBoZWlmX2NvbXByZXNzaW9uX0pQRUcAaGVpZl9jaHJvbWEAaGVpZl9jaHJvbWFfdW5kZWZpbmVkAGhlaWZfY2hyb21hX21vbm9jaHJvbWUAaGVpZl9jaHJvbWFfNDIwAGhlaWZfY2hyb21hXzQyMgBoZWlmX2Nocm9tYV80NDQAaGVpZl9jaHJvbWFfaW50ZXJsZWF2ZWRfMjRiaXQAaGVpZl9jb2xvcnNwYWNlAGhlaWZfY29sb3JzcGFjZV91bmRlZmluZWQAaGVpZl9jb2xvcnNwYWNlX1lDYkNyAGhlaWZfY29sb3JzcGFjZV9SR0IAaGVpZl9jb2xvcnNwYWNlX21vbm9jaHJvbWUAaGVpZl9jaGFubmVsAGhlaWZfY2hhbm5lbF9ZAGhlaWZfY2hhbm5lbF9DcgBoZWlmX2NoYW5uZWxfQ2IAaGVpZl9jaGFubmVsX1IAaGVpZl9jaGFubmVsX0cAaGVpZl9jaGFubmVsX0IAaGVpZl9jaGFubmVsX0FscGhhAGhlaWZfY2hhbm5lbF9pbnRlcmxlYXZlZABTdHJpbmdWZWN0b3IAVUludDMyVmVjdG9yAGhlaWZfY29udGV4dABoZWlmX2ltYWdlX2hhbmRsZQBoZWlmX2ltYWdlAGhlaWZfZXJyb3IAY29kZQBzdWJjb2RlADEwaGVpZl9lcnJvcgBQSzEwaGVpZl9pbWFnZQBQMTBoZWlmX2ltYWdlADEwaGVpZl9pbWFnZQBQSzE3aGVpZl9pbWFnZV9oYW5kbGUAUDE3aGVpZl9pbWFnZV9oYW5kbGUAMTdoZWlmX2ltYWdlX2hhbmRsZQBQSzEyaGVpZl9jb250ZXh0AFAxMmhlaWZfY29udGV4dAAxMmhlaWZfY29udGV4dABwdXNoX2JhY2sAcmVzaXplAHZpaWlpAHNpemUAc2V0AE4xMGVtc2NyaXB0ZW4zdmFsRQBQS05TdDNfXzI2dmVjdG9ySWpOU185YWxsb2NhdG9ySWpFRUVFAFBOU3QzX18yNnZlY3RvcklqTlNfOWFsbG9jYXRvcklqRUVFRQBOU3QzX18yNnZlY3RvcklqTlNfOWFsbG9jYXRvcklqRUVFRQBOU3QzX18yMTNfX3ZlY3Rvcl9iYXNlSWpOU185YWxsb2NhdG9ySWpFRUVFAE5TdDNfXzIyMF9fdmVjdG9yX2Jhc2VfY29tbW9uSUxiMUVFRQBOU3QzX18yMTJiYXNpY19zdHJpbmdJY05TXzExY2hhcl90cmFpdHNJY0VFTlNfOWFsbG9jYXRvckljRUVFRQBOU3QzX18yMjFfX2Jhc2ljX3N0cmluZ19jb21tb25JTGIxRUVFAFBLTlN0M19fMjZ2ZWN0b3JJTlNfMTJiYXNpY19zdHJpbmdJY05TXzExY2hhcl90cmFpdHNJY0VFTlNfOWFsbG9jYXRvckljRUVFRU5TNF9JUzZfRUVFRQBQTlN0M19fMjZ2ZWN0b3JJTlNfMTJiYXNpY19zdHJpbmdJY05TXzExY2hhcl90cmFpdHNJY0VFTlNfOWFsbG9jYXRvckljRUVFRU5TNF9JUzZfRUVFRQBOU3QzX18yNnZlY3RvcklOU18xMmJhc2ljX3N0cmluZ0ljTlNfMTFjaGFyX3RyYWl0c0ljRUVOU185YWxsb2NhdG9ySWNFRUVFTlM0X0lTNl9FRUVFAE5TdDNfXzIxM19fdmVjdG9yX2Jhc2VJTlNfMTJiYXNpY19zdHJpbmdJY05TXzExY2hhcl90cmFpdHNJY0VFTlNfOWFsbG9jYXRvckljRUVFRU5TNF9JUzZfRUVFRQAxMmhlaWZfY2hhbm5lbAAxNWhlaWZfY29sb3JzcGFjZQAxMWhlaWZfY2hyb21hADIzaGVpZl9jb21wcmVzc2lvbl9mb3JtYXQAdHlwZQBkYXRhAFBLTjRoZWlmOEhlaWZGaWxlRQBQTjRoZWlmOEhlaWZGaWxlRQBONGhlaWY4SGVpZkZpbGVFAE5TdDNfXzIxMHNoYXJlZF9wdHJJTjRoZWlmM0JveEVFRQBOMTBlbXNjcmlwdGVuMTVzbWFydF9wdHJfdHJhaXRJTlN0M19fMjEwc2hhcmVkX3B0cklONGhlaWYzQm94RUVFRTExdmFsX2RlbGV0ZXJFAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9wb2ludGVySVBONGhlaWYzQm94RU4xMGVtc2NyaXB0ZW4xNXNtYXJ0X3B0cl90cmFpdElOU18xMHNoYXJlZF9wdHJJUzJfRUVFMTF2YWxfZGVsZXRlckVOU185YWxsb2NhdG9ySVMyX0VFRUUAUEtONGhlaWYzQm94RQBQTjRoZWlmM0JveEUAUEtONGhlaWY5Qm94SGVhZGVyRQBQTjRoZWlmOUJveEhlYWRlckUAUEtONGhlaWY2SW5kZW50RQBQTjRoZWlmNkluZGVudEUATjRoZWlmNkluZGVudEUAUEtONGhlaWYyNEVtc2NyaXB0ZW5CaXRzdHJlYW1SYW5nZUUAUE40aGVpZjI0RW1zY3JpcHRlbkJpdHN0cmVhbVJhbmdlRQBONGhlaWYyNEVtc2NyaXB0ZW5CaXRzdHJlYW1SYW5nZUUAUEtONGhlaWYxNEJpdHN0cmVhbVJhbmdlRQBQTjRoZWlmMTRCaXRzdHJlYW1SYW5nZUUATjRoZWlmMTRCaXRzdHJlYW1SYW5nZUUAMThoZWlmX3N1YmVycm9yX2NvZGUAMTVoZWlmX2Vycm9yX2NvZGUAUEtONGhlaWY1RXJyb3JFAFBONGhlaWY1RXJyb3JFAE40aGVpZjVFcnJvckUAaXNfcHJpbWFyeQB0aHVtYm5haWxzAHdpZHRoAGhlaWdodABjaHJvbWEAY29sb3JzcGFjZQBoZWlmX2ltYWdlX2dldF9jaHJvbWFfZm9ybWF0KGltYWdlKSA9PSBoZWlmX2Nocm9tYV9pbnRlcmxlYXZlZF8yNGJpdAAuL2hlaWYtZW1zY3JpcHRlbi5oAGhlaWZfaW1hZ2VfZ2V0X2Nocm9tYV9mb3JtYXQoaW1hZ2UpID09IGhlaWZfY2hyb21hX21vbm9jaHJvbWUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmMTFIZWlmQ29udGV4dEVOU185YWxsb2NhdG9ySVMyX0VFRUUAMC4wLjEATGVzcyB0aGFuIDggYnl0ZXMgb2YgZGF0YQBHcmlkIGltYWdlIGRhdGEgaW5jb21wbGV0ZQAKAE92ZXJsYXkgaW1hZ2UgZGF0YSBpbmNvbXBsZXRlAE92ZXJsYXkgaW1hZ2UgZGF0YSB2ZXJzaW9uIAAgaXMgbm90IGltcGxlbWVudGVkIHlldAB4AGltYWdlX2luZGV4Pj0wICYmIGltYWdlX2luZGV4PG1fb2Zmc2V0cy5zaXplKCkAaGVpZl9jb250ZXh0LmNjAGdldF9vZmZzZXQAU3VjY2VzcwAncGl0bScgYm94IHJlZmVyZW5jZXMgYSBub24tZXhpc3RpbmcgaW1hZ2UAVG9vIG1hbnkgdGh1bWJuYWlsIHJlZmVyZW5jZXMAVGh1bWJuYWlsIHJlZmVyZW5jZXMgYSBub24tZXhpc3RpbmcgaW1hZ2UAVGh1bWJuYWlsIHJlZmVyZW5jZXMgYW5vdGhlciB0aHVtYm5haWwATm8gYXV4QyBwcm9wZXJ0eSBmb3IgaW1hZ2UgAFRvbyBtYW55IGF1eGlsaWFyeSBpbWFnZSByZWZlcmVuY2VzAHVybjptcGVnOmF2YzoyMDE1OmF1eGlkOjEASW1hZ2Ugc2l6ZSAAIGV4Y2VlZHMgdGhlIG1heGltdW0gaW1hZ2Ugc2l6ZSAARXhpZgBFeGlmIGRhdGEgbm90IGNvcnJlY3RseSBhc3NpZ25lZCB0byBpbWFnZQBFeGlmIGRhdGEgYXNzaWduZWQgdG8gbm9uLWV4aXN0aW5nIGltYWdlAE5TdDNfXzIyMF9fc2hhcmVkX3B0cl9lbXBsYWNlSU40aGVpZjEzSW1hZ2VNZXRhZGF0YUVOU185YWxsb2NhdG9ySVMyX0VFRUUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmMTFIZWlmQ29udGV4dDVJbWFnZUVOU185YWxsb2NhdG9ySVMzX0VFRUUATlN0M19fMjIwX19zaGFyZWRfcHRyX2VtcGxhY2VJTjRoZWlmOEhlaWZGaWxlRU5TXzlhbGxvY2F0b3JJUzJfRUVFRQBodmMxAGdyaWQAaWRlbgBpb3ZsAGltZ193aWR0aCA+PSAwAGRlY29kZV9pbWFnZQBpbWdfaGVpZ2h0ID49IDAATm8gaXJlZiBib3ggYXZhaWxhYmxlLCBidXQgbmVlZGVkIGZvciBpb3ZsIGltYWdlAE51bWJlciBvZiBpbWFnZSBvZmZzZXRzIGRvZXMgbm90IG1hdGNoIHRoZSBudW1iZXIgb2YgaW1hZ2UgcmVmZXJlbmNlcwBObyBpcmVmIGJveCBhdmFpbGFibGUsIGJ1dCBuZWVkZWQgZm9yIGlkZW4gaW1hZ2UAJ2lkZW4nIGltYWdlIHdpdGggbW9yZSB0aGFuIG9uZSByZWZlcmVuY2UgaW1hZ2UATm8gaXJlZiBib3ggYXZhaWxhYmxlLCBidXQgbmVlZGVkIGZvciBncmlkIGltYWdlAFRpbGVkIGltYWdlIHdpdGggAD0AIHRpbGVzLCBidXQgb25seSAAIHRpbGUgaW1hZ2VzIGluIGZpbGUAc3JjX3dpZHRoID49IDAAZGVjb2RlX2Z1bGxfZ3JpZF9pbWFnZQBzcmNfaGVpZ2h0ID49IDAAbGliZGUyNjUgSEVWQyBkZWNvZGVyACwgdmVyc2lvbiAAU3VjY2VzcwAxLjAuMgBkZTI2NS5jYwBkZTI2NV9zZXRfcGFyYW1ldGVyX2Jvb2wAY2hhbm5lbD49MCAmJiBjaGFubmVsIDw9IDIAZGUyNjVfZ2V0X2ltYWdlX3BsYW5lADE1ZGVjb2Rlcl9jb250ZXh0ADEyYmFzZV9jb250ZXh0ADExZXJyb3JfcXVldWUAdGhyZWFkX2NvbnRleHRzPT1OVUxMAGRlY2N0eC5jYwBhbGxvY2F0ZV90aHJlYWRfY29udGV4dHMAZGVjb2RlX3NsaWNlX3VuaXRfcGFyYWxsZWwAaW1nLT5udW1fdGhyZWFkc19hY3RpdmUoKSA9PSAwAGRlY29kZV9zbGljZV91bml0X3RpbGVzAG4gPCBuVGhyZWFkQ29udGV4dHMALi9kZWNjdHguaABnZXRfdGhyZWFkX2NvbnRleHQAZGVjb2RlX3NsaWNlX3VuaXRfV1BQAFBQUyAlZCBoYXMgbm90IGJlZW4gcmVhZAoAcHJvY2Vzc19zbGljZV9zZWdtZW50X2hlYWRlcgBoZHItPm51bV9yZWZfaWR4X2wwX2FjdGl2ZSA8PSAxNgBjb25zdHJ1Y3RfcmVmZXJlbmNlX3BpY3R1cmVfbGlzdHMAaGRyLT5udW1fcmVmX2lkeF9sMV9hY3RpdmUgPD0gMTYAY3R4LT5kcGIuaGFzX2ZyZWVfZHBiX3BpY3R1cmUodHJ1ZSkAZ2VuZXJhdGVfdW5hdmFpbGFibGVfcmVmZXJlbmNlX3BpY3R1cmUAaWR4Pj0wAG5hbABkZWNvZGUAZmFsbGJhY2stZGN0LmNjAHRyYW5zZm9ybV9za2lwXzhfZmFsbGJhY2sAdHJhbnNmb3JtX3NraXBfMTZfZmFsbGJhY2sAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBaWlhVUk5JQz02LiYfFg0E/PPq4drSysO9t7Kuq6implpXUEY5KxkJ9+fVx7qwqaamqbC6x9Xn9wkZKzlGUFdaWlJDLhb84cq3q6aossPa8w0mPU5YWlVJNh8E6tK9rqZZSzIS7s61p6e1zu4SMktZWUsyEu7Otaentc7uEjJLWVhDH/PKrqay0vwmSVpVPRbqw6umt9oELk5aUjYN4b2oVzkJ1bCmuucZRlpQK/fHqanH9ytQWkYZ57qmsNUJOVdVLvO9prfqJlJYNvzDprLhH05aPQTKqK7aFklaQw3Sq1Mk3K2t3CRTUyTcra3cJFNTJNytrdwkU1Mk3K2t3CRTUhbKpsMNTlUf0qa9BElYJtqot/xDWi7hq7LzPVo26q5QCbqp5zlaK9WmxxlXRvewsPdGVxnHptUrWjnnqboJUE78rrcNVUPqqMMfWjbaptIuWibKpuE9WBa9q/NJUgSyS+6nzjJZErW1ElkyzqfuS0vup84yWRK1tRJZMs6n7ktJ4abqTkPapvNSPdKo/FU2yqsEWC7Drg1aJr2yFloft0bVqQlaGbDHOVDnpvdXK7q6K1f3pudQOcewGVoJqdVGQ8qyJlXqpgRaDajhUi63wz1J0q4fWPOm/FoWq9pONr1AwMBAQMDAQEDAwEBAwMBAQMDAQEDAwEBAwMBAQMDAQD230lIfqPNa/KYWVdqyNkO9yk4mq+paBKYNWOGuLknDObDnWvepK0a61VcJphlQx8dQGaYJV9W6Riup91rnsDk2q/xY0sNSDaYmQ7LqWuG3SR+mFk692lrzrj0uqARVyjKnEku17lnOzlnutUsSpzIypxJLte5Zzs5Z7rVLEqcyLqYmNqYfPagWQ6sNSa4ETrL8UrfzVb3qWMPhWsraWtIrpjkZqUYJsFD3ulfnx1rV1VrH51e691CwCUapGTmmKyaoSfy9WtLhVbINPaY2Fq5S6spaw/NOqx8upkMEt1jaJK1T3NxTrSQkrVPc3FOtJCStU9zcU60kJK1T3NxTrSQfslrDBDaoUtrqSaZD89JVqy4NvVq3FiauWMr8PaZO4Rm6WrArCcdXqTn31VCmRufnRqZQ1fc5qVfHCSuwWroZFsNVpkna/C6yWq428+FDqFi9Hw3KUqZO0gQmt1qrPeoSzkunWbUy7u4ytVmnS84SEs5Lp1m1Mu7uMrVZp0vOEg3aPbJYplW3NuEEFtJDrlqmUr0u6vwfykmrWqhOwybzCecrx0awV6ZaqVC6OdUZ9/cZ1Tm6UKlaplewRscr5wkE8xbhJtI2w0O3Tq5VqFqmWqZYq1KySb09yi7aH+oN/Ch3aWR0aCYxKT09MABmYWxsYmFjay1tb3Rpb24uY2MAcHV0X3Vud2VpZ2h0ZWRfcHJlZF84X2ZhbGxiYWNrAGxvZzJXRD49MQBwdXRfd2VpZ2h0ZWRfcHJlZF84X2ZhbGxiYWNrAHB1dF93ZWlnaHRlZF9iaXByZWRfOF9mYWxsYmFjawBwdXRfd2VpZ2h0ZWRfcHJlZF9hdmdfOF9mYWxsYmFjawBwdXRfdW53ZWlnaHRlZF9wcmVkXzE2X2ZhbGxiYWNrAHB1dF93ZWlnaHRlZF9wcmVkXzE2X2ZhbGxiYWNrAHB1dF93ZWlnaHRlZF9iaXByZWRfMTZfZmFsbGJhY2sAcHV0X3dlaWdodGVkX3ByZWRfYXZnXzE2X2ZhbGxiYWNrACFyZW9yZGVyX291dHB1dF9xdWV1ZS5lbXB0eSgpAGRwYi5jYwBvdXRwdXRfbmV4dF9waWN0dXJlX2luX3Jlb3JkZXJfYnVmZmVyAG5ld19pbWFnZQBpbWctPnNwcy5CaXREZXB0aF9ZID49IDggJiYgaW1nLT5zcHMuQml0RGVwdGhfWSA8PSAxNgBpbWFnZS5jYwBkZTI2NV9pbWFnZV9nZXRfYnVmZmVyAGltZy0+c3BzLkJpdERlcHRoX0MgPj0gOCAmJiBpbWctPnNwcy5CaXREZXB0aF9DIDw9IDE2AHNwcwBhbGxvY19pbWFnZQBmaXJzdCAlIDIgPT0gMABjb3B5X2xpbmVzX2Zyb20AZW5kICUgMiA9PSAwAG5UaHJlYWRzUnVubmluZyA+PSAwAHRocmVhZF9maW5pc2hlcwAuL2ltYWdlLmgAcGVuZGluZ19pbnB1dF9OQUwgPT0gTlVMTABuYWwtcGFyc2VyLmNjAHB1c2hfTkFMAC0tLS0tLS0tLS0gUFBTIHJhbmdlLWV4dGVuc2lvbiAtLS0tLS0tLS0tCgBsb2cyX21heF90cmFuc2Zvcm1fc2tpcF9ibG9ja19zaXplICAgICAgOiAlZAoAY3Jvc3NfY29tcG9uZW50X3ByZWRpY3Rpb25fZW5hYmxlZF9mbGFnIDogJWQKAGNocm9tYV9xcF9vZmZzZXRfbGlzdF9lbmFibGVkX2ZsYWcgICAgICA6ICVkCgBkaWZmX2N1X2Nocm9tYV9xcF9vZmZzZXRfZGVwdGggICAgICAgICAgOiAlZAoAY2hyb21hX3FwX29mZnNldF9saXN0X2xlbiAgICAgICAgICAgICAgIDogJWQKAGNiX3FwX29mZnNldF9saXN0WyVkXSAgICAgICAgICAgICAgICAgICAgOiAlZAoAY3JfcXBfb2Zmc2V0X2xpc3RbJWRdICAgICAgICAgICAgICAgICAgICA6ICVkCgBsb2cyX3Nhb19vZmZzZXRfc2NhbGVfbHVtYSAgICAgICAgICAgICAgOiAlZAoAbG9nMl9zYW9fb2Zmc2V0X3NjYWxlX2Nocm9tYSAgICAgICAgICAgIDogJWQKAHRpbGVYPj0wICYmIHRpbGVZPj0wAHBwcy5jYwBzZXRfZGVyaXZlZF92YWx1ZXMALS0tLS0tLS0tLS0tLS0tLS0gUFBTIC0tLS0tLS0tLS0tLS0tLS0tCgBwaWNfcGFyYW1ldGVyX3NldF9pZCAgICAgICA6ICVkCgBzZXFfcGFyYW1ldGVyX3NldF9pZCAgICAgICA6ICVkCgBkZXBlbmRlbnRfc2xpY2Vfc2VnbWVudHNfZW5hYmxlZF9mbGFnIDogJWQKAHNpZ25fZGF0YV9oaWRpbmdfZmxhZyAgICAgIDogJWQKAGNhYmFjX2luaXRfcHJlc2VudF9mbGFnICAgIDogJWQKAG51bV9yZWZfaWR4X2wwX2RlZmF1bHRfYWN0aXZlIDogJWQKAG51bV9yZWZfaWR4X2wxX2RlZmF1bHRfYWN0aXZlIDogJWQKAHBpY19pbml0X3FwICAgICAgICAgICAgICAgIDogJWQKAGNvbnN0cmFpbmVkX2ludHJhX3ByZWRfZmxhZzogJWQKAHRyYW5zZm9ybV9za2lwX2VuYWJsZWRfZmxhZzogJWQKAGN1X3FwX2RlbHRhX2VuYWJsZWRfZmxhZyAgIDogJWQKAGRpZmZfY3VfcXBfZGVsdGFfZGVwdGggICAgIDogJWQKAHBpY19jYl9xcF9vZmZzZXQgICAgICAgICAgICAgOiAlZAoAcGljX2NyX3FwX29mZnNldCAgICAgICAgICAgICA6ICVkCgBwcHNfc2xpY2VfY2hyb21hX3FwX29mZnNldHNfcHJlc2VudF9mbGFnIDogJWQKAHdlaWdodGVkX3ByZWRfZmxhZyAgICAgICAgICAgOiAlZAoAd2VpZ2h0ZWRfYmlwcmVkX2ZsYWcgICAgICAgICA6ICVkCgBvdXRwdXRfZmxhZ19wcmVzZW50X2ZsYWcgICAgIDogJWQKAHRyYW5zcXVhbnRfYnlwYXNzX2VuYWJsZV9mbGFnOiAlZAoAdGlsZXNfZW5hYmxlZF9mbGFnICAgICAgICAgICA6ICVkCgBlbnRyb3B5X2NvZGluZ19zeW5jX2VuYWJsZWRfZmxhZzogJWQKAG51bV90aWxlX2NvbHVtbnMgICAgOiAlZAoAbnVtX3RpbGVfcm93cyAgICAgICA6ICVkCgB1bmlmb3JtX3NwYWNpbmdfZmxhZzogJWQKAHRpbGUgY29sdW1uIGJvdW5kYXJpZXM6IAB0aWxlIHJvdyBib3VuZGFyaWVzOiAAKiVkIABsb29wX2ZpbHRlcl9hY3Jvc3NfdGlsZXNfZW5hYmxlZF9mbGFnIDogJWQKAHBwc19sb29wX2ZpbHRlcl9hY3Jvc3Nfc2xpY2VzX2VuYWJsZWRfZmxhZzogJWQKAGRlYmxvY2tpbmdfZmlsdGVyX2NvbnRyb2xfcHJlc2VudF9mbGFnOiAlZAoAZGVibG9ja2luZ19maWx0ZXJfb3ZlcnJpZGVfZW5hYmxlZF9mbGFnOiAlZAoAcGljX2Rpc2FibGVfZGVibG9ja2luZ19maWx0ZXJfZmxhZzogJWQKAGJldGFfb2Zmc2V0OiAgJWQKAHRjX29mZnNldDogICAgJWQKAHBpY19zY2FsaW5nX2xpc3RfZGF0YV9wcmVzZW50X2ZsYWc6ICVkCgBsaXN0c19tb2RpZmljYXRpb25fcHJlc2VudF9mbGFnOiAlZAoAbG9nMl9wYXJhbGxlbF9tZXJnZV9sZXZlbCAgICAgIDogJWQKAG51bV9leHRyYV9zbGljZV9oZWFkZXJfYml0cyAgICA6ICVkCgBzbGljZV9zZWdtZW50X2hlYWRlcl9leHRlbnNpb25fcHJlc2VudF9mbGFnIDogJWQKAHBwc19leHRlbnNpb25fZmxhZyAgICAgICAgICAgIDogJWQKAHBwc19yYW5nZV9leHRlbnNpb25fZmxhZyAgICAgIDogJWQKAHBwc19tdWx0aWxheWVyX2V4dGVuc2lvbl9mbGFnIDogJWQKAHBwc19leHRlbnNpb25fNmJpdHMgICAgICAgICAgIDogJWQKAExvZzJNaW5DdVFwRGVsdGFTaXplICAgICAgICAgIDogJWQKAExvZzJNaW5DdUNocm9tYVFwT2Zmc2V0U2l6ZSAoUkV4dCkgOiAlZAoATG9nMk1heFRyYW5zZm9ybVNraXBTaXplICAgIChSRXh0KSA6ICVkCgBzYW8tJWQAMTV0aHJlYWRfdGFza19zYW8AMTF0aHJlYWRfdGFzawBTRUkgZGVjb2RlZCBwaWN0dXJlIE1ENSBtaXNtYXRjaCAoUE9DPSVkKQoAU0VJIGRlY29kZWQgcGljdHVyZSBoYXNoOiAlMDR4LCBkZWNvZGVkIHBpY3R1cmU6ICUwNHggKFBPQz0lZCkKAHNsaWNlLXNlZ21lbnQtJWQ7JWQAaW5pdFR5cGUgPj0gMCAmJiBpbml0VHlwZSA8PSAyAHNsaWNlLmNjAGluaXRpYWxpemVfQ0FCQUNfbW9kZWxzAGRlY29kZV9wYXJ0X21vZGUAAAECAgICAwUHCAoMDQ8REhMUFRYXFxgYGRkaGxscHB0dHh9yZWFkX2NvZGluZ191bml0AFByZWRNb2RlID09IGN1UHJlZE1vZGUAcmVhZF90cmFuc2Zvcm1fdHJlZQBjb250ZXh0ID49IDAgJiYgY29udGV4dCA8PSAyAGRlY29kZV9zcGxpdF90cmFuc2Zvcm1fZmxhZwAhKHRyYWZvRGVwdGg9PTAgJiYgbG9nMlRyYWZvU2l6ZT09MikAY2JmX2NiICE9IC0xAHJlYWRfdHJhbnNmb3JtX3VuaXQAY2JmX2NyICE9IC0xAGNiZl9sdW1hICE9IC0xAHg8c3BzLlBpY1dpZHRoSW5NaW5QVXMAc2V0X0ludHJhUHJlZE1vZGVDAHk8c3BzLlBpY0hlaWdodEluTWluUFVzAGlkeDxpbnRyYVByZWRNb2RlQy5kYXRhX3NpemUAMjV0aHJlYWRfdGFza19zbGljZV9zZWdtZW50AGN0Yi1yb3ctJWQAMTl0aHJlYWRfdGFza19jdGJfcm93AHBwcy0+cHBzX3JlYWQAZHVtcF9zbGljZV9zZWdtZW50X2hlYWRlcgBzcHMtPnNwc19yZWFkAC0tLS0tLS0tLS0tLS0tLS0tIFNMSUNFIC0tLS0tLS0tLS0tLS0tLS0tCgBmaXJzdF9zbGljZV9zZWdtZW50X2luX3BpY19mbGFnICAgICAgOiAlZAoAbm9fb3V0cHV0X29mX3ByaW9yX3BpY3NfZmxhZyAgICAgICAgIDogJWQKAHNsaWNlX3BpY19wYXJhbWV0ZXJfc2V0X2lkICAgICAgICAgICA6ICVkCgBkZXBlbmRlbnRfc2xpY2Vfc2VnbWVudF9mbGFnICAgICAgICAgOiAlZAoAc2xpY2Vfc2VnbWVudF9hZGRyZXNzICAgICAgICAgICAgICAgIDogJWQKAHNsaWNlX3R5cGUgICAgICAgICAgICAgICAgICAgICAgICAgICA6ICVjCgBwaWNfb3V0cHV0X2ZsYWcgICAgICAgICAgICAgICAgICAgICAgOiAlZAoAY29sb3VyX3BsYW5lX2lkICAgICAgICAgICAgICAgICAgICAgIDogJWQKAHNsaWNlX3BpY19vcmRlcl9jbnRfbHNiICAgICAgICAgICAgICA6ICVkCgBzaG9ydF90ZXJtX3JlZl9waWNfc2V0X3Nwc19mbGFnICAgICAgOiAlZAoAc2hvcnRfdGVybV9yZWZfcGljX3NldF9pZHggICAgICAgICAgIDogJWQKAG51bV9sb25nX3Rlcm1fc3BzICAgICAgICAgICAgICAgICAgICAgICAgOiAlZAoAbnVtX2xvbmdfdGVybV9waWNzICAgICAgICAgICAgICAgICAgICAgICA6ICVkCgBzbGljZV90ZW1wb3JhbF9tdnBfZW5hYmxlZF9mbGFnIDogJWQKAHNsaWNlX3Nhb19sdW1hX2ZsYWcgICAgICAgICAgICAgOiAlZAoAc2xpY2Vfc2FvX2Nocm9tYV9mbGFnICAgICAgICAgICA6ICVkCgBudW1fcmVmX2lkeF9hY3RpdmVfb3ZlcnJpZGVfZmxhZyA6ICVkCgAoZnJvbSBQUFMpAG51bV9yZWZfaWR4X2wwX2FjdGl2ZSAgICAgICAgICA6ICVkICVzCgBudW1fcmVmX2lkeF9sMV9hY3RpdmUgICAgICAgICAgOiAlZCAlcwoAcmVmX3BpY19saXN0X21vZGlmaWNhdGlvbl9mbGFnX2wwIDogJWQKACAgJWQ6ICVkCgByZWZfcGljX2xpc3RfbW9kaWZpY2F0aW9uX2ZsYWdfbDEgOiAlZAoAbXZkX2wxX3plcm9fZmxhZyAgICAgICAgICAgICAgIDogJWQKAGNhYmFjX2luaXRfZmxhZyAgICAgICAgICAgICAgICA6ICVkCgBjb2xsb2NhdGVkX2Zyb21fbDBfZmxhZyAgICAgICAgOiAlZAoAY29sbG9jYXRlZF9yZWZfaWR4ICAgICAgICAgICAgIDogJWQKAGx1bWFfbG9nMl93ZWlnaHRfZGVub20gICAgICAgICA6ICVkCgBDaHJvbWFMb2cyV2VpZ2h0RGVub20gICAgICAgICAgOiAlZAoATHVtYVdlaWdodF9MJWRbJWRdICAgICAgICAgICAgIDogJWQKAGx1bWFfb2Zmc2V0X2wlZFslZF0gICAgICAgICAgICA6ICVkCgBDaHJvbWFXZWlnaHRfTCVkWyVkXVslZF0gICAgICAgIDogJWQKAENocm9tYU9mZnNldF9MJWRbJWRdWyVkXSAgICAgICAgOiAlZAoAZml2ZV9taW51c19tYXhfbnVtX21lcmdlX2NhbmQgIDogJWQKAHNsaWNlX3FwX2RlbHRhICAgICAgICAgOiAlZAoAc2xpY2VfY2JfcXBfb2Zmc2V0ICAgICA6ICVkCgBzbGljZV9jcl9xcF9vZmZzZXQgICAgIDogJWQKAGRlYmxvY2tpbmdfZmlsdGVyX292ZXJyaWRlX2ZsYWcgOiAlZAoAKG92ZXJyaWRlKQAoZnJvbSBwcHMpAHNsaWNlX2RlYmxvY2tpbmdfZmlsdGVyX2Rpc2FibGVkX2ZsYWcgOiAlZCAlcwoAc2xpY2VfYmV0YV9vZmZzZXQgIDogJWQKAHNsaWNlX3RjX29mZnNldCAgICA6ICVkCgBzbGljZV9sb29wX2ZpbHRlcl9hY3Jvc3Nfc2xpY2VzX2VuYWJsZWRfZmxhZyA6ICVkCgBudW1fZW50cnlfcG9pbnRfb2Zmc2V0cyAgICA6ICVkCgBvZmZzZXRfbGVuICAgICAgICAgICAgICAgICA6ICVkCgBlbnRyeSBwb2ludCBbJWldIDogJWQKAAABBAUCAwQFBgYICAcHCGNjdHhJZHhMb29rdXBbbG9nMnctMl1bY0lkeF1bc2NhbklkeF1bcHJldkNzYmZdW3hDKyh5Qzw8bG9nMncpXSA9PSBjdHhJZHhJbmMAYWxsb2NfYW5kX2luaXRfc2lnbmlmaWNhbnRfY29lZmZfY3R4SWR4X2xvb2t1cFRhYmxlAHJlZjw3AHNwcy5jYwAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBEQERAREhESEhESFRMUFRQTFRgWFhgYFhYYGRkbHhsZGR0fIyMfHSQpLCkkLzY2L0FGQVhYcxAQEBAQEBAQEBARERERERISEhISEhQUFBQUFBQYGBgYGBgYGBkZGRkZGRkcHBwcHBwhISEhISkpKSk2NjZHR1tmaWxsX3NjYWxpbmdfZmFjdG9yAHNjYWxpbmdfbGlzdF9wcmVkX21hdHJpeF9pZF9kZWx0YT09MQByZWFkX3NjYWxpbmdfbGlzdAAtLS0tLS0tLS0tLS0tLS0tLSBTUFMgLS0tLS0tLS0tLS0tLS0tLS0KAHZpZGVvX3BhcmFtZXRlcl9zZXRfaWQgIDogJWQKAHNwc19tYXhfc3ViX2xheWVycyAgICAgIDogJWQKAHNwc190ZW1wb3JhbF9pZF9uZXN0aW5nX2ZsYWcgOiAlZAoAc2VxX3BhcmFtZXRlcl9zZXRfaWQgICAgOiAlZAoANDo0OjQAdW5rbm93bgBtb25vY2hyb21lADQ6MjowADQ6MjoyAGNocm9tYV9mb3JtYXRfaWRjICAgICAgIDogJWQgKCVzKQoAc2VwYXJhdGVfY29sb3VyX3BsYW5lX2ZsYWcgOiAlZAoAcGljX3dpZHRoX2luX2x1bWFfc2FtcGxlcyAgOiAlZAoAcGljX2hlaWdodF9pbl9sdW1hX3NhbXBsZXMgOiAlZAoAY29uZm9ybWFuY2Vfd2luZG93X2ZsYWcgICAgOiAlZAoAY29uZl93aW5fbGVmdF9vZmZzZXQgIDogJWQKAGNvbmZfd2luX3JpZ2h0X29mZnNldCA6ICVkCgBjb25mX3dpbl90b3Bfb2Zmc2V0ICAgOiAlZAoAY29uZl93aW5fYm90dG9tX29mZnNldDogJWQKAGJpdF9kZXB0aF9sdW1hICAgOiAlZAoAYml0X2RlcHRoX2Nocm9tYSA6ICVkCgBsb2cyX21heF9waWNfb3JkZXJfY250X2xzYiA6ICVkCgBzcHNfc3ViX2xheWVyX29yZGVyaW5nX2luZm9fcHJlc2VudF9mbGFnIDogJWQKAGxvZzJfbWluX2x1bWFfY29kaW5nX2Jsb2NrX3NpemUgOiAlZAoAbG9nMl9kaWZmX21heF9taW5fbHVtYV9jb2RpbmdfYmxvY2tfc2l6ZSA6ICVkCgBsb2cyX21pbl90cmFuc2Zvcm1fYmxvY2tfc2l6ZSAgIDogJWQKAGxvZzJfZGlmZl9tYXhfbWluX3RyYW5zZm9ybV9ibG9ja19zaXplIDogJWQKAG1heF90cmFuc2Zvcm1faGllcmFyY2h5X2RlcHRoX2ludGVyIDogJWQKAG1heF90cmFuc2Zvcm1faGllcmFyY2h5X2RlcHRoX2ludHJhIDogJWQKAHNjYWxpbmdfbGlzdF9lbmFibGVfZmxhZyA6ICVkCgBMYXllciAlZAoAICBzcHNfbWF4X2RlY19waWNfYnVmZmVyaW5nICAgICAgOiAlZAoAICBzcHNfbWF4X251bV9yZW9yZGVyX3BpY3MgICAgICAgOiAlZAoAICBzcHNfbWF4X2xhdGVuY3lfaW5jcmVhc2VfcGx1czEgOiAlZAoAc3BzX3NjYWxpbmdfbGlzdF9kYXRhX3ByZXNlbnRfZmxhZyA6ICVkCgBzY2FsaW5nIGxpc3QgbG9nZ2luZyBvdXRwdXQgbm90IGltcGxlbWVudGVkAGFtcF9lbmFibGVkX2ZsYWcgICAgICAgICAgICAgICAgICAgIDogJWQKAHNhbXBsZV9hZGFwdGl2ZV9vZmZzZXRfZW5hYmxlZF9mbGFnIDogJWQKAHBjbV9lbmFibGVkX2ZsYWcgICAgICAgICAgICAgICAgICAgIDogJWQKAHBjbV9zYW1wbGVfYml0X2RlcHRoX2x1bWEgICAgIDogJWQKAHBjbV9zYW1wbGVfYml0X2RlcHRoX2Nocm9tYSAgIDogJWQKAGxvZzJfbWluX3BjbV9sdW1hX2NvZGluZ19ibG9ja19zaXplIDogJWQKAGxvZzJfZGlmZl9tYXhfbWluX3BjbV9sdW1hX2NvZGluZ19ibG9ja19zaXplIDogJWQKAHBjbV9sb29wX2ZpbHRlcl9kaXNhYmxlX2ZsYWcgIDogJWQKAG51bV9zaG9ydF90ZXJtX3JlZl9waWNfc2V0cyA6ICVkCgBsb25nX3Rlcm1fcmVmX3BpY3NfcHJlc2VudF9mbGFnIDogJWQKAHJlZl9waWNfc2V0WyAlMmQgXTogAG51bV9sb25nX3Rlcm1fcmVmX3BpY3Nfc3BzIDogJWQKAGx0X3JlZl9waWNfcG9jX2xzYl9zcHNbJWRdIDogJWQgICAodXNlZF9ieV9jdXJyX3BpY19sdF9zcHNfZmxhZz0lZCkKAHNwc190ZW1wb3JhbF9tdnBfZW5hYmxlZF9mbGFnICAgICAgOiAlZAoAc3Ryb25nX2ludHJhX3Ntb290aGluZ19lbmFibGVfZmxhZyA6ICVkCgB2dWlfcGFyYW1ldGVyc19wcmVzZW50X2ZsYWcgICAgICAgIDogJWQKAHNwc19leHRlbnNpb25fcHJlc2VudF9mbGFnICAgIDogJWQKAHNwc19yYW5nZV9leHRlbnNpb25fZmxhZyAgICAgIDogJWQKAHNwc19tdWx0aWxheWVyX2V4dGVuc2lvbl9mbGFnIDogJWQKAHNwc19leHRlbnNpb25fNmJpdHMgICAgICAgICAgIDogJWQKAEN0YlNpemVZICAgICA6ICVkCgBNaW5DYlNpemVZICAgOiAlZAoATWF4Q2JTaXplWSAgIDogJWQKAE1pblRCU2l6ZVkgICA6ICVkCgBNYXhUQlNpemVZICAgOiAlZAoAUGljV2lkdGhJbkN0YnNZICAgICAgICAgOiAlZAoAUGljSGVpZ2h0SW5DdGJzWSAgICAgICAgOiAlZAoAU3ViV2lkdGhDICAgICAgICAgICAgICAgOiAlZAoAU3ViSGVpZ2h0QyAgICAgICAgICAgICAgOiAlZAoALS0tLS0tLS0tLS0tLS0tLS0gU1BTLXJhbmdlLWV4dGVuc2lvbiAtLS0tLS0tLS0tLS0tLS0tLQoAdHJhbnNmb3JtX3NraXBfcm90YXRpb25fZW5hYmxlZF9mbGFnICAgIDogJWQKAHRyYW5zZm9ybV9za2lwX2NvbnRleHRfZW5hYmxlZF9mbGFnICAgICA6ICVkCgBpbXBsaWNpdF9yZHBjbV9lbmFibGVkX2ZsYWcgICAgICAgICAgICAgOiAlZAoAZXhwbGljaXRfcmRwY21fZW5hYmxlZF9mbGFnICAgICAgICAgICAgIDogJWQKAGV4dGVuZGVkX3ByZWNpc2lvbl9wcm9jZXNzaW5nX2ZsYWcgICAgICA6ICVkCgBpbnRyYV9zbW9vdGhpbmdfZGlzYWJsZWRfZmxhZyAgICAgICAgICAgOiAlZAoAaGlnaF9wcmVjaXNpb25fb2Zmc2V0c19lbmFibGVkX2ZsYWcgICAgIDogJWQKAHBlcnNpc3RlbnRfcmljZV9hZGFwdGF0aW9uX2VuYWJsZWRfZmxhZyA6ICVkCgBjYWJhY19ieXBhc3NfYWxpZ25tZW50X2VuYWJsZWRfZmxhZyAgICAgOiAlZAoAdHJhbnNmb3JtLmNjADAAc2NhbGVfY29lZmZpY2llbnRzX2ludGVybmFsAHJkcGNtTW9kZT09MABFUlI6IABJTkZPOiAAdnBzLmNjAGFsbG9jYXRvcjxUPjo6YWxsb2NhdGUoc2l6ZV90IG4pICduJyBleGNlZWRzIG1heGltdW0gc3VwcG9ydGVkIHNpemUAZmlyc3RMYXllclJlYWQgPCBNQVhfVEVNUE9SQUxfU1VCTEFZRVJTAHJlYWQALS0tLS0tLS0tLS0tLS0tLS0gVlBTIC0tLS0tLS0tLS0tLS0tLS0tCgB2aWRlb19wYXJhbWV0ZXJfc2V0X2lkICAgICAgICAgICAgICAgIDogJWQKAHZwc19tYXhfbGF5ZXJzICAgICAgICAgICAgICAgICAgICAgICAgOiAlZAoAdnBzX21heF9zdWJfbGF5ZXJzICAgICAgICAgICAgICAgICAgICA6ICVkCgB2cHNfdGVtcG9yYWxfaWRfbmVzdGluZ19mbGFnICAgICAgICAgIDogJWQKACAgUHJvZmlsZS9UaWVyL0xldmVsIFtMYXllciAlZF0KAHZwc19zdWJfbGF5ZXJfb3JkZXJpbmdfaW5mb19wcmVzZW50X2ZsYWcgOiAlZAoAbGF5ZXIgJWQ6IHZwc19tYXhfZGVjX3BpY19idWZmZXJpbmcgPSAlZAoAICAgICAgICAgdnBzX21heF9udW1fcmVvcmRlcl9waWNzICA9ICVkCgAgICAgICAgICB2cHNfbWF4X2xhdGVuY3lfaW5jcmVhc2UgID0gJWQKAGxheWVyIChhbGwpOiB2cHNfbWF4X2RlY19waWNfYnVmZmVyaW5nID0gJWQKACAgICAgICAgICAgICB2cHNfbWF4X251bV9yZW9yZGVyX3BpY3MgID0gJWQKACAgICAgICAgICAgICB2cHNfbWF4X2xhdGVuY3lfaW5jcmVhc2UgID0gJWQKAHZwc19tYXhfbGF5ZXJfaWQgICA9ICVkCgB2cHNfbnVtX2xheWVyX3NldHMgPSAlZAoAdnBzX3RpbWluZ19pbmZvX3ByZXNlbnRfZmxhZyA9ICVkCgBsYXllcl9pZF9pbmNsdWRlZF9mbGFnWyVkXVslZF0gPSAlZAoAdnBzX251bV91bml0c19pbl90aWNrID0gJWQKAHZwc190aW1lX3NjYWxlICAgICAgICA9ICVkCgB2cHNfcG9jX3Byb3BvcnRpb25hbF90b190aW1pbmdfZmxhZyA9ICVkCgB2cHNfbnVtX3RpY2tzX3BvY19kaWZmX29uZSA9ICVkCgB2cHNfbnVtX2hyZF9wYXJhbWV0ZXJzICAgICA9ICVkCgBocmRfbGF5ZXJfc2V0X2lkeFslZF0gPSAlZAoAdnBzX2V4dGVuc2lvbl9mbGFnID0gJWQKAGdlbmVyYWwAc3ViX2xheWVyACAgJXNfcHJvZmlsZV9zcGFjZSAgICAgOiAlZAoAICAlc190aWVyX2ZsYWcgICAgICAgICA6ICVkCgAodW5rbm93bikARm9ybWF0UmFuZ2VFeHRlbnNpb25zAE1haW5TdGlsbFBpY3R1cmUATWFpbjEwAE1haW4AICAlc19wcm9maWxlX2lkYyAgICAgICA6ICVzCgAgICVzX3Byb2ZpbGVfY29tcGF0aWJpbGl0eV9mbGFnczogACoKACAgICAlc19wcm9ncmVzc2l2ZV9zb3VyY2VfZmxhZyA6ICVkCgAgICAgJXNfaW50ZXJsYWNlZF9zb3VyY2VfZmxhZyA6ICVkCgAgICAgJXNfbm9uX3BhY2tlZF9jb25zdHJhaW50X2ZsYWcgOiAlZAoAICAgICVzX2ZyYW1lX29ubHlfY29uc3RyYWludF9mbGFnIDogJWQKACosAColZAAgICVzX2xldmVsX2lkYyAgICAgICAgIDogJWQgKCU0LjJmKQoAdW5zcGVjaWZpZWQATUFDAFNFQ0FNAE5UU0MAUEFMAGNvbXBvbmVudAAtLS0tLS0tLS0tLS0tLS0tLSBWVUkgLS0tLS0tLS0tLS0tLS0tLS0KAHNhbXBsZSBhc3BlY3QgcmF0aW8gICAgICAgIDogJWQ6JWQKAG92ZXJzY2FuX2luZm9fcHJlc2VudF9mbGFnIDogJWQKAG92ZXJzY2FuX2FwcHJvcHJpYXRlX2ZsYWcgIDogJWQKAHZpZGVvX3NpZ25hbF90eXBlX3ByZXNlbnRfZmxhZzogJWQKACAgdmlkZW9fZm9ybWF0ICAgICAgICAgICAgICAgIDogJXMKACAgdmlkZW9fZnVsbF9yYW5nZV9mbGFnICAgICAgIDogJWQKACAgY29sb3VyX2Rlc2NyaXB0aW9uX3ByZXNlbnRfZmxhZyA6ICVkCgAgIGNvbG91cl9wcmltYXJpZXMgICAgICAgICAgICA6ICVkCgAgIHRyYW5zZmVyX2NoYXJhY3RlcmlzdGljcyAgICA6ICVkCgAgIG1hdHJpeF9jb2VmZnMgICAgICAgICAgICAgICA6ICVkCgBjaHJvbWFfbG9jX2luZm9fcHJlc2VudF9mbGFnOiAlZAoAICBjaHJvbWFfc2FtcGxlX2xvY190eXBlX3RvcF9maWVsZCAgIDogJWQKACAgY2hyb21hX3NhbXBsZV9sb2NfdHlwZV9ib3R0b21fZmllbGQ6ICVkCgBuZXV0cmFsX2Nocm9tYV9pbmRpY2F0aW9uX2ZsYWc6ICVkCgBmaWVsZF9zZXFfZmxhZyAgICAgICAgICAgICAgICA6ICVkCgBmcmFtZV9maWVsZF9pbmZvX3ByZXNlbnRfZmxhZyA6ICVkCgBkZWZhdWx0X2Rpc3BsYXlfd2luZG93X2ZsYWcgICA6ICVkCgAgIGRlZl9kaXNwX3dpbl9sZWZ0X29mZnNldCAgICA6ICVkCgAgIGRlZl9kaXNwX3dpbl9yaWdodF9vZmZzZXQgICA6ICVkCgAgIGRlZl9kaXNwX3dpbl90b3Bfb2Zmc2V0ICAgICA6ICVkCgAgIGRlZl9kaXNwX3dpbl9ib3R0b21fb2Zmc2V0ICA6ICVkCgB2dWlfdGltaW5nX2luZm9fcHJlc2VudF9mbGFnICA6ICVkCgAgIHZ1aV9udW1fdW5pdHNfaW5fdGljayAgICAgICA6ICVkCgAgIHZ1aV90aW1lX3NjYWxlICAgICAgICAgICAgICA6ICVkCgB2dWlfcG9jX3Byb3BvcnRpb25hbF90b190aW1pbmdfZmxhZyA6ICVkCgB2dWlfbnVtX3RpY2tzX3BvY19kaWZmX29uZSAgICAgICAgICA6ICVkCgB2dWlfaHJkX3BhcmFtZXRlcnNfcHJlc2VudF9mbGFnIDogJWQKAGJpdHN0cmVhbV9yZXN0cmljdGlvbl9mbGFnICAgICAgICAgOiAlZAoAICB0aWxlc19maXhlZF9zdHJ1Y3R1cmVfZmxhZyAgICAgICA6ICVkCgAgIG1vdGlvbl92ZWN0b3JzX292ZXJfcGljX2JvdW5kYXJpZXNfZmxhZyA6ICVkCgAgIHJlc3RyaWN0ZWRfcmVmX3BpY19saXN0c19mbGFnICAgIDogJWQKACAgbWluX3NwYXRpYWxfc2VnbWVudGF0aW9uX2lkYyAgICAgOiAlZAoAICBtYXhfYnl0ZXNfcGVyX3BpY19kZW5vbSAgICAgICAgICA6ICVkCgAgIG1heF9iaXRzX3Blcl9taW5fY3VfZGVub20gICAgICAgIDogJWQKACAgbG9nMl9tYXhfbXZfbGVuZ3RoX2hvcml6b250YWwgICAgOiAlZAoAICBsb2cyX21heF9tdl9sZW5ndGhfdmVydGljYWwgICAgICA6ICVkCgBiaXRzdHJlYW0uY2MAdmFsdWU+MABnZXRfdXZsYwCAsNDwgKfF44Ceu9h7lrLNdI6pw2+HoLlpgJivZHqQpl90iZ5aboKWVWh7jlFjdYdNXm+ASVlpekVVZHRCUF9uPkxaaDtIVmM4RVFeNUFNWTM+SVUwO0VQLjhCTCs1P0gpMjtFJzA4QSUtNj4jKzM7ISkwOCAnLjUeJSsyHSMpMBshJy0aHyUrGB4jKRccIScWGyAlFRoeIxQYHSETFxsfEhYaHhEVGRwQFBcbDxMWGQ4SFRgOERQXDRATFgwPEhUMDhEUCw4QEwsNDxIKDA8RCgwOEAkLDQ8JCwwOCAoMDggJCw0HCQsMBwkKDAcICgsGCAkLBgcJCgYHCAkCAgICBgUEBAMDAwMCAgICAgICAgEBAQEBAQEBAQEBAQEBAQEAAAECAgQEBQYHCAkJCwsMDQ0PDxAQEhITExUVFhYXGBgZGhobGxwdHR4eHh8gICEhISIiIyMjJCQkJSUlJiY/AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4+P2NhYmFjLmNjAGxlbmd0aCA+PSAwAGluaXRfQ0FCQUNfZGVjb2RlcgAlcCBjJ3RvciA9ICVwCgAlcCBkZXN0cnVjdG9yCgBtZnJlZSAlcAoAJXAgaW5pdAoAKnJlZmNudD4xAGNvbnRleHRtb2RlbC5jYwBkZWNvdXBsZV9vcl9hbGxvY193aXRoX2VtcHR5X2RhdGEAJXAgKGFsbG9jKQoAbW9kZWxbaV0uc3RhdGUgPD0gNjIAc2V0X2luaXRWYWx1ZQAlcCByZWxlYXNlICVwCgAlcCBkZWNvdXBsZSAoJXApCgByZWZjbnQAZGVjb3VwbGUAJXAgYXNzaWduID0gJXAKAGRlYmxvY2stJWQAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBAQEBAgICAgMDAwMEBAQFBQYGBwgJCgsNDhASFBYYAAAAAAAAAAAAAAAAAAAAAAYHCAkKCwwNDg8QERIUFhgaHB4gIiQmKCosLjAyNDY4Ojw+QHJlZlBpY1EwPT1yZWZQaWNRMQBkZWJsb2NrLmNjAGRlcml2ZV9ib3VuZGFyeVN0cmVuZ3RoADI2dGhyZWFkX3Rhc2tfZGVibG9ja19DVEJSb3cAaW50cmFwcmVkLmNjAGludHJhUHJlZE1vZGU8MzUAaW50cmFfcHJlZGljdGlvbl9hbmd1bGFyAGludHJhUHJlZE1vZGU+PTIAaW50cmFfcHJlZGljdGlvbl9zYW1wbGVfZmlsdGVyaW5nAHNoZHItPnNsaWNlX3R5cGUgPT0gU0xJQ0VfVFlQRV9CAG1vdGlvbi5jYwBnZW5lcmF0ZV9pbnRlcl9wcmVkaWN0aW9uX3NhbXBsZXMAbWNfY2hyb21hAHVuaXRYID49IDAgJiYgdW5pdFggPCB3aWR0aF9pbl91bml0cwAuLi9saWJkZTI2NS9pbWFnZS5oAGdldAB1bml0WSA+PSAwICYmIHVuaXRZIDwgaGVpZ2h0X2luX3VuaXRzAGN0eC0+aGFzX2ltYWdlKGNvbFBpYykAZGVyaXZlX2NvbGxvY2F0ZWRfbW90aW9uX3ZlY3RvcnMAZGVyaXZlX2NvbWJpbmVkX2JpcHJlZGljdGl2ZV9tZXJnaW5nX2NhbmRpZGF0ZXMAcmVmUGljTGlzdD49MABkZXJpdmVfc3BhdGlhbF9sdW1hX3ZlY3Rvcl9wcmVkaWN0aW9uAG51bU1WUENhbmRMWD09MgBmaWxsX2x1bWFfbW90aW9uX3ZlY3Rvcl9wcmVkaWN0b3JzAFJJZHg+PTAAcmVmcGljLmNjAHJlYWRfc2hvcnRfdGVybV9yZWZfcGljX3NldABSSWR4ID49IDAgJiYgUklkeCA8IHNldHMuc2l6ZSgpAGo+PTAgJiYgaiA8IE1BWF9OVU1fUkVGX1BJQ1MAKiVkJWMgAColcwoAdm9pZABib29sAGNoYXIAc2lnbmVkIGNoYXIAdW5zaWduZWQgY2hhcgBzaG9ydAB1bnNpZ25lZCBzaG9ydABpbnQAdW5zaWduZWQgaW50AGxvbmcAdW5zaWduZWQgbG9uZwBmbG9hdABkb3VibGUAc3RkOjpzdHJpbmcAc3RkOjpiYXNpY19zdHJpbmc8dW5zaWduZWQgY2hhcj4Ac3RkOjp3c3RyaW5nAGVtc2NyaXB0ZW46OnZhbABlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxjaGFyPgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxzaWduZWQgY2hhcj4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dW5zaWduZWQgY2hhcj4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8c2hvcnQ+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVuc2lnbmVkIHNob3J0PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQ+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVuc2lnbmVkIGludD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8bG9uZz4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dW5zaWduZWQgbG9uZz4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50OF90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50OF90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQxNl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50MTZfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50MzJfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dWludDMyX3Q+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGZsb2F0PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxkb3VibGU+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGxvbmcgZG91YmxlPgBOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0llRUUATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJZEVFAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SWZFRQBOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0ltRUUATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJbEVFAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SWpFRQBOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0lpRUUATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJdEVFAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SXNFRQBOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0loRUUATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJYUVFAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SWNFRQBOU3QzX18yMTJiYXNpY19zdHJpbmdJd05TXzExY2hhcl90cmFpdHNJd0VFTlNfOWFsbG9jYXRvckl3RUVFRQBOU3QzX18yMTJiYXNpY19zdHJpbmdJaE5TXzExY2hhcl90cmFpdHNJaEVFTlNfOWFsbG9jYXRvckloRUVFRQARAAoAERERAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABEADwoREREDCgcAARMJCwsAAAkGCwAACwAGEQAAABEREQAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAARAAoKERERAAoAAAIACQsAAAAJAAsAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA0AAAAEDQAAAAAJDgAAAAAADgAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAPAAAAAA8AAAAACRAAAAAAABAAABAAABIAAAASEhIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAABISEgAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAoAAAAACgAAAAAJCwAAAAAACwAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAwAAAAACQwAAAAAAAwAAAwAAC0rICAgMFgweAAobnVsbCkALTBYKzBYIDBYLTB4KzB4IDB4AGluZgBJTkYATkFOADAxMjM0NTY3ODlBQkNERUYuAFQhIhkNAQIDEUscDBAECx0SHidobm9wcWIgBQYPExQVGggWBygkFxgJCg4bHyUjg4J9JiorPD0+P0NHSk1YWVpbXF1eX2BhY2RlZmdpamtscnN0eXp7fABJbGxlZ2FsIGJ5dGUgc2VxdWVuY2UARG9tYWluIGVycm9yAFJlc3VsdCBub3QgcmVwcmVzZW50YWJsZQBOb3QgYSB0dHkAUGVybWlzc2lvbiBkZW5pZWQAT3BlcmF0aW9uIG5vdCBwZXJtaXR0ZWQATm8gc3VjaCBmaWxlIG9yIGRpcmVjdG9yeQBObyBzdWNoIHByb2Nlc3MARmlsZSBleGlzdHMAVmFsdWUgdG9vIGxhcmdlIGZvciBkYXRhIHR5cGUATm8gc3BhY2UgbGVmdCBvbiBkZXZpY2UAT3V0IG9mIG1lbW9yeQBSZXNvdXJjZSBidXN5AEludGVycnVwdGVkIHN5c3RlbSBjYWxsAFJlc291cmNlIHRlbXBvcmFyaWx5IHVuYXZhaWxhYmxlAEludmFsaWQgc2VlawBDcm9zcy1kZXZpY2UgbGluawBSZWFkLW9ubHkgZmlsZSBzeXN0ZW0ARGlyZWN0b3J5IG5vdCBlbXB0eQBDb25uZWN0aW9uIHJlc2V0IGJ5IHBlZXIAT3BlcmF0aW9uIHRpbWVkIG91dABDb25uZWN0aW9uIHJlZnVzZWQASG9zdCBpcyBkb3duAEhvc3QgaXMgdW5yZWFjaGFibGUAQWRkcmVzcyBpbiB1c2UAQnJva2VuIHBpcGUASS9PIGVycm9yAE5vIHN1Y2ggZGV2aWNlIG9yIGFkZHJlc3MAQmxvY2sgZGV2aWNlIHJlcXVpcmVkAE5vIHN1Y2ggZGV2aWNlAE5vdCBhIGRpcmVjdG9yeQBJcyBhIGRpcmVjdG9yeQBUZXh0IGZpbGUgYnVzeQBFeGVjIGZvcm1hdCBlcnJvcgBJbnZhbGlkIGFyZ3VtZW50AEFyZ3VtZW50IGxpc3QgdG9vIGxvbmcAU3ltYm9saWMgbGluayBsb29wAEZpbGVuYW1lIHRvbyBsb25nAFRvbyBtYW55IG9wZW4gZmlsZXMgaW4gc3lzdGVtAE5vIGZpbGUgZGVzY3JpcHRvcnMgYXZhaWxhYmxlAEJhZCBmaWxlIGRlc2NyaXB0b3IATm8gY2hpbGQgcHJvY2VzcwBCYWQgYWRkcmVzcwBGaWxlIHRvbyBsYXJnZQBUb28gbWFueSBsaW5rcwBObyBsb2NrcyBhdmFpbGFibGUAUmVzb3VyY2UgZGVhZGxvY2sgd291bGQgb2NjdXIAU3RhdGUgbm90IHJlY292ZXJhYmxlAFByZXZpb3VzIG93bmVyIGRpZWQAT3BlcmF0aW9uIGNhbmNlbGVkAEZ1bmN0aW9uIG5vdCBpbXBsZW1lbnRlZABObyBtZXNzYWdlIG9mIGRlc2lyZWQgdHlwZQBJZGVudGlmaWVyIHJlbW92ZWQARGV2aWNlIG5vdCBhIHN0cmVhbQBObyBkYXRhIGF2YWlsYWJsZQBEZXZpY2UgdGltZW91dABPdXQgb2Ygc3RyZWFtcyByZXNvdXJjZXMATGluayBoYXMgYmVlbiBzZXZlcmVkAFByb3RvY29sIGVycm9yAEJhZCBtZXNzYWdlAEZpbGUgZGVzY3JpcHRvciBpbiBiYWQgc3RhdGUATm90IGEgc29ja2V0AERlc3RpbmF0aW9uIGFkZHJlc3MgcmVxdWlyZWQATWVzc2FnZSB0b28gbGFyZ2UAUHJvdG9jb2wgd3JvbmcgdHlwZSBmb3Igc29ja2V0AFByb3RvY29sIG5vdCBhdmFpbGFibGUAUHJvdG9jb2wgbm90IHN1cHBvcnRlZABTb2NrZXQgdHlwZSBub3Qgc3VwcG9ydGVkAE5vdCBzdXBwb3J0ZWQAUHJvdG9jb2wgZmFtaWx5IG5vdCBzdXBwb3J0ZWQAQWRkcmVzcyBmYW1pbHkgbm90IHN1cHBvcnRlZCBieSBwcm90b2NvbABBZGRyZXNzIG5vdCBhdmFpbGFibGUATmV0d29yayBpcyBkb3duAE5ldHdvcmsgdW5yZWFjaGFibGUAQ29ubmVjdGlvbiByZXNldCBieSBuZXR3b3JrAENvbm5lY3Rpb24gYWJvcnRlZABObyBidWZmZXIgc3BhY2UgYXZhaWxhYmxlAFNvY2tldCBpcyBjb25uZWN0ZWQAU29ja2V0IG5vdCBjb25uZWN0ZWQAQ2Fubm90IHNlbmQgYWZ0ZXIgc29ja2V0IHNodXRkb3duAE9wZXJhdGlvbiBhbHJlYWR5IGluIHByb2dyZXNzAE9wZXJhdGlvbiBpbiBwcm9ncmVzcwBTdGFsZSBmaWxlIGhhbmRsZQBSZW1vdGUgSS9PIGVycm9yAFF1b3RhIGV4Y2VlZGVkAE5vIG1lZGl1bSBmb3VuZABXcm9uZyBtZWRpdW0gdHlwZQBObyBlcnJvciBpbmZvcm1hdGlvbgAA/////////////////////////////////////////////////////////////////wABAgMEBQYHCAn/////////CgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiP///////8KCwwNDg8QERITFBUWFxgZGhscHR4fICEiI/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAQIEBwMGBQBpbmZpbml0eQBuYW4ATENfQUxMAExDX0NUWVBFAAAAAExDX05VTUVSSUMAAExDX1RJTUUAAAAAAExDX0NPTExBVEUAAExDX01PTkVUQVJZAExDX01FU1NBR0VTAExBTkcAQy5VVEYtOABQT1NJWABNVVNMX0xPQ1BBVEgATlN0M19fMjhpb3NfYmFzZUUATlN0M19fMjliYXNpY19pb3NJY05TXzExY2hhcl90cmFpdHNJY0VFRUUATlN0M19fMjliYXNpY19pb3NJd05TXzExY2hhcl90cmFpdHNJd0VFRUUATlN0M19fMjE1YmFzaWNfc3RyZWFtYnVmSWNOU18xMWNoYXJfdHJhaXRzSWNFRUVFAE5TdDNfXzIxNWJhc2ljX3N0cmVhbWJ1Zkl3TlNfMTFjaGFyX3RyYWl0c0l3RUVFRQBOU3QzX18yMTNiYXNpY19pc3RyZWFtSWNOU18xMWNoYXJfdHJhaXRzSWNFRUVFAE5TdDNfXzIxM2Jhc2ljX2lzdHJlYW1Jd05TXzExY2hhcl90cmFpdHNJd0VFRUUATlN0M19fMjEzYmFzaWNfb3N0cmVhbUljTlNfMTFjaGFyX3RyYWl0c0ljRUVFRQBOU3QzX18yMTNiYXNpY19vc3RyZWFtSXdOU18xMWNoYXJfdHJhaXRzSXdFRUVFAE5TdDNfXzIxNGJhc2ljX2lvc3RyZWFtSWNOU18xMWNoYXJfdHJhaXRzSWNFRUVFAE5TdDNfXzIxMV9fc3Rkb3V0YnVmSXdFRQBOU3QzX18yMTFfX3N0ZG91dGJ1ZkljRUUAdW5zdXBwb3J0ZWQgbG9jYWxlIGZvciBzdGFuZGFyZCBpbnB1dABOU3QzX18yMTBfX3N0ZGluYnVmSXdFRQBOU3QzX18yMTBfX3N0ZGluYnVmSWNFRQBOU3QzX18yN2NvbGxhdGVJY0VFAE5TdDNfXzI2bG9jYWxlNWZhY2V0RQBOU3QzX18yN2NvbGxhdGVJd0VFADAxMjM0NTY3ODlhYmNkZWZBQkNERUZ4WCstcFBpSW5OACVwAEMATlN0M19fMjdudW1fZ2V0SWNOU18xOWlzdHJlYW1idWZfaXRlcmF0b3JJY05TXzExY2hhcl90cmFpdHNJY0VFRUVFRQBOU3QzX18yOV9fbnVtX2dldEljRUUATlN0M19fMjE0X19udW1fZ2V0X2Jhc2VFAE5TdDNfXzI3bnVtX2dldEl3TlNfMTlpc3RyZWFtYnVmX2l0ZXJhdG9ySXdOU18xMWNoYXJfdHJhaXRzSXdFRUVFRUUATlN0M19fMjlfX251bV9nZXRJd0VFACVwAAAAAEwAbGwAJQAAAAAAbABOU3QzX18yN251bV9wdXRJY05TXzE5b3N0cmVhbWJ1Zl9pdGVyYXRvckljTlNfMTFjaGFyX3RyYWl0c0ljRUVFRUVFAE5TdDNfXzI5X19udW1fcHV0SWNFRQBOU3QzX18yMTRfX251bV9wdXRfYmFzZUUATlN0M19fMjdudW1fcHV0SXdOU18xOW9zdHJlYW1idWZfaXRlcmF0b3JJd05TXzExY2hhcl90cmFpdHNJd0VFRUVFRQBOU3QzX18yOV9fbnVtX3B1dEl3RUUAJUg6JU06JVMAJW0vJWQvJXkAJUk6JU06JVMgJXAAJWEgJWIgJWQgJUg6JU06JVMgJVkAQU0AUE0ASmFudWFyeQBGZWJydWFyeQBNYXJjaABBcHJpbABNYXkASnVuZQBKdWx5AEF1Z3VzdABTZXB0ZW1iZXIAT2N0b2JlcgBOb3ZlbWJlcgBEZWNlbWJlcgBKYW4ARmViAE1hcgBBcHIASnVuAEp1bABBdWcAU2VwAE9jdABOb3YARGVjAFN1bmRheQBNb25kYXkAVHVlc2RheQBXZWRuZXNkYXkAVGh1cnNkYXkARnJpZGF5AFNhdHVyZGF5AFN1bgBNb24AVHVlAFdlZABUaHUARnJpAFNhdAAlbS8lZC8leSVZLSVtLSVkJUk6JU06JVMgJXAlSDolTSVIOiVNOiVTJUg6JU06JVNOU3QzX18yOHRpbWVfZ2V0SWNOU18xOWlzdHJlYW1idWZfaXRlcmF0b3JJY05TXzExY2hhcl90cmFpdHNJY0VFRUVFRQBOU3QzX18yMjBfX3RpbWVfZ2V0X2Nfc3RvcmFnZUljRUUATlN0M19fMjl0aW1lX2Jhc2VFAE5TdDNfXzI4dGltZV9nZXRJd05TXzE5aXN0cmVhbWJ1Zl9pdGVyYXRvckl3TlNfMTFjaGFyX3RyYWl0c0l3RUVFRUVFAE5TdDNfXzIyMF9fdGltZV9nZXRfY19zdG9yYWdlSXdFRQBOU3QzX18yOHRpbWVfcHV0SWNOU18xOW9zdHJlYW1idWZfaXRlcmF0b3JJY05TXzExY2hhcl90cmFpdHNJY0VFRUVFRQBOU3QzX18yMTBfX3RpbWVfcHV0RQBOU3QzX18yOHRpbWVfcHV0SXdOU18xOW9zdHJlYW1idWZfaXRlcmF0b3JJd05TXzExY2hhcl90cmFpdHNJd0VFRUVFRQBOU3QzX18yMTBtb25leXB1bmN0SWNMYjBFRUUATlN0M19fMjEwbW9uZXlfYmFzZUUATlN0M19fMjEwbW9uZXlwdW5jdEljTGIxRUVFAE5TdDNfXzIxMG1vbmV5cHVuY3RJd0xiMEVFRQBOU3QzX18yMTBtb25leXB1bmN0SXdMYjFFRUUAMDEyMzQ1Njc4OQAlTGYATlN0M19fMjltb25leV9nZXRJY05TXzE5aXN0cmVhbWJ1Zl9pdGVyYXRvckljTlNfMTFjaGFyX3RyYWl0c0ljRUVFRUVFAE5TdDNfXzIxMV9fbW9uZXlfZ2V0SWNFRQAwMTIzNDU2Nzg5AE5TdDNfXzI5bW9uZXlfZ2V0SXdOU18xOWlzdHJlYW1idWZfaXRlcmF0b3JJd05TXzExY2hhcl90cmFpdHNJd0VFRUVFRQBOU3QzX18yMTFfX21vbmV5X2dldEl3RUUAJS4wTGYATlN0M19fMjltb25leV9wdXRJY05TXzE5b3N0cmVhbWJ1Zl9pdGVyYXRvckljTlNfMTFjaGFyX3RyYWl0c0ljRUVFRUVFAE5TdDNfXzIxMV9fbW9uZXlfcHV0SWNFRQBOU3QzX18yOW1vbmV5X3B1dEl3TlNfMTlvc3RyZWFtYnVmX2l0ZXJhdG9ySXdOU18xMWNoYXJfdHJhaXRzSXdFRUVFRUUATlN0M19fMjExX19tb25leV9wdXRJd0VFAE5TdDNfXzI4bWVzc2FnZXNJY0VFAE5TdDNfXzIxM21lc3NhZ2VzX2Jhc2VFAE5TdDNfXzIxN19fd2lkZW5fZnJvbV91dGY4SUxqMzJFRUUATlN0M19fMjdjb2RlY3Z0SURpYzExX19tYnN0YXRlX3RFRQBOU3QzX18yMTJjb2RlY3Z0X2Jhc2VFAE5TdDNfXzIxNl9fbmFycm93X3RvX3V0ZjhJTGozMkVFRQBOU3QzX18yOG1lc3NhZ2VzSXdFRQBOU3QzX18yN2NvZGVjdnRJY2MxMV9fbWJzdGF0ZV90RUUATlN0M19fMjdjb2RlY3Z0SXdjMTFfX21ic3RhdGVfdEVFAE5TdDNfXzI3Y29kZWN2dElEc2MxMV9fbWJzdGF0ZV90RUUATlN0M19fMjZsb2NhbGU1X19pbXBFAE5TdDNfXzI1Y3R5cGVJY0VFAE5TdDNfXzIxMGN0eXBlX2Jhc2VFAE5TdDNfXzI1Y3R5cGVJd0VFAGZhbHNlAHRydWUATlN0M19fMjhudW1wdW5jdEljRUUATlN0M19fMjhudW1wdW5jdEl3RUUATlN0M19fMjE0X19zaGFyZWRfY291bnRFAE5TdDNfXzIxOV9fc2hhcmVkX3dlYWtfY291bnRFAGJhZF93ZWFrX3B0cgBOU3QzX18yMTJiYWRfd2Vha19wdHJFAHRlcm1pbmF0aW5nIHdpdGggJXMgZXhjZXB0aW9uIG9mIHR5cGUgJXM6ICVzAHRlcm1pbmF0aW5nIHdpdGggJXMgZXhjZXB0aW9uIG9mIHR5cGUgJXMAdGVybWluYXRpbmcgd2l0aCAlcyBmb3JlaWduIGV4Y2VwdGlvbgB0ZXJtaW5hdGluZwB1bmNhdWdodABTdDlleGNlcHRpb24ATjEwX19jeHhhYml2MTE2X19zaGltX3R5cGVfaW5mb0UAU3Q5dHlwZV9pbmZvAE4xMF9fY3h4YWJpdjEyMF9fc2lfY2xhc3NfdHlwZV9pbmZvRQBOMTBfX2N4eGFiaXYxMTdfX2NsYXNzX3R5cGVfaW5mb0UAcHRocmVhZF9vbmNlIGZhaWx1cmUgaW4gX19jeGFfZ2V0X2dsb2JhbHNfZmFzdCgpAGNhbm5vdCBjcmVhdGUgcHRocmVhZCBrZXkgZm9yIF9fY3hhX2dldF9nbG9iYWxzKCkAY2Fubm90IHplcm8gb3V0IHRocmVhZCB2YWx1ZSBmb3IgX19jeGFfZ2V0X2dsb2JhbHMoKQB0ZXJtaW5hdGVfaGFuZGxlciB1bmV4cGVjdGVkbHkgcmV0dXJuZWQAU3QxMWxvZ2ljX2Vycm9yAFN0MTJsZW5ndGhfZXJyb3IATjEwX19jeHhhYml2MTE5X19wb2ludGVyX3R5cGVfaW5mb0UATjEwX19jeHhhYml2MTE3X19wYmFzZV90eXBlX2luZm9FAE4xMF9fY3h4YWJpdjEyM19fZnVuZGFtZW50YWxfdHlwZV9pbmZvRQB2AERuAGIAYwBoAGEAcwB0AGkAagBtAHkAZgBkAE4xMF9fY3h4YWJpdjExNl9fZW51bV90eXBlX2luZm9FAE4xMF9fY3h4YWJpdjEyMV9fdm1pX2NsYXNzX3R5cGVfaW5mb0U="),staticInit:function(){ZA.isWindows=!!process.platform.match(/^win/)},mount:function(A){return h(o),ZA.createNode(null,"/",ZA.getMode(A.opts.root),0)},createNode:function(A,e,r,i){if(!WA.isDir(r)&&!WA.isFile(r)&&!WA.isLink(r))throw new WA.ErrnoError(hA.EINVAL);var f=WA.createNode(A,e,r);return f.node_ops=ZA.node_ops,f.stream_ops=ZA.stream_ops,f},getMode:function(A){var e;try{e=br.lstatSync(A),ZA.isWindows&&(e.mode=e.mode|(146&e.mode)>>1)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}return e.mode},realPath:function(A){for(var e=[];A.parent!==A;)e.push(A.name),A=A.parent;return e.push(A.mount.opts.root),e.reverse(),gA.join.apply(null,e)},flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function(A){if(A&=-2097153,A&=-2049,A&=-32769,(A&=-524289)in ZA.flagsToPermissionStringMap)return ZA.flagsToPermissionStringMap[A];throw new WA.ErrnoError(hA.EINVAL)},node_ops:{getattr:function(A){var e,r=ZA.realPath(A);try{e=br.lstatSync(r)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}return ZA.isWindows&&!e.blksize&&(e.blksize=4096),ZA.isWindows&&!e.blocks&&(e.blocks=(e.size+e.blksize-1)/e.blksize|0),{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},setattr:function(A,e){var r=ZA.realPath(A);try{if(void 0!==e.mode&&(br.chmodSync(r,e.mode),A.mode=e.mode),void 0!==e.timestamp){var i=new Date(e.timestamp);br.utimesSync(r,i,i)}void 0!==e.size&&br.truncateSync(r,e.size)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},lookup:function(A,e){var r=gA.join2(ZA.realPath(A),e),i=ZA.getMode(r);return ZA.createNode(A,e,i)},mknod:function(A,e,r,i){var f=ZA.createNode(A,e,r,i),n=ZA.realPath(f);try{WA.isDir(f.mode)?br.mkdirSync(n,f.mode):br.writeFileSync(n,"",{mode:f.mode})}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}return f},rename:function(A,e,r){var i=ZA.realPath(A),f=gA.join2(ZA.realPath(e),r);try{br.renameSync(i,f)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},unlink:function(A,e){var r=gA.join2(ZA.realPath(A),e);try{br.unlinkSync(r)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},rmdir:function(A,e){var r=gA.join2(ZA.realPath(A),e);try{br.rmdirSync(r)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},readdir:function(A){var e=ZA.realPath(A);try{return br.readdirSync(e)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},symlink:function(A,e,r){var i=gA.join2(ZA.realPath(A),e);try{br.symlinkSync(r,i)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},readlink:function(A){var e=ZA.realPath(A);try{return e=br.readlinkSync(e),e=dr.relative(dr.resolve(A.mount.opts.root),e)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}}},stream_ops:{open:function(A){var e=ZA.realPath(A.node);try{WA.isFile(A.node.mode)&&(A.nfd=br.openSync(e,ZA.flagsToPermissionString(A.flags)))}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},close:function(A){try{WA.isFile(A.node.mode)&&A.nfd&&br.closeSync(A.nfd)}catch(A){if(!A.code)throw A;throw new WA.ErrnoError(hA[A.code])}},read:function(A,e,r,i,f){if(0===i)return 0;var n,t=new Buffer(i);try{n=br.readSync(A.nfd,t,0,i,f)}catch(A){throw new WA.ErrnoError(hA[A.code])}if(0<n)for(var o=0;o<n;o++)e[r+o]=t[o];return n},write:function(A,e,r,i,f){var n,t=new Buffer(e.subarray(r,r+i));try{n=br.writeSync(A.nfd,t,0,i,f)}catch(A){throw new WA.ErrnoError(hA[A.code])}return n},llseek:function(A,e,r){var i=e;if(1===r)i+=A.position;else if(2===r&&WA.isFile(A.node.mode))try{i+=br.fstatSync(A.nfd).size}catch(A){throw new WA.ErrnoError(hA[A.code])}if(i<0)throw new WA.ErrnoError(hA.EINVAL);return i}}},CA={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(A){h(l),CA.reader||(CA.reader=new FileReaderSync);var n=CA.createNode(null,"/",CA.DIR_MODE,0),t={};function i(A){for(var e=A.split("/"),r=n,i=0;i<e.length-1;i++){var f=e.slice(0,i+1).join("/");t[f]||(t[f]=CA.createNode(r,e[i],CA.DIR_MODE,0)),r=t[f]}return r}function f(A){var e=A.split("/");return e[e.length-1]}return Array.prototype.forEach.call(A.opts.files||[],function(A){CA.createNode(i(A.name),f(A.name),CA.FILE_MODE,0,A,A.lastModifiedDate)}),(A.opts.blobs||[]).forEach(function(A){CA.createNode(i(A.name),f(A.name),CA.FILE_MODE,0,A.data)}),(A.opts.packages||[]).forEach(function(r){r.metadata.files.forEach(function(A){var e=A.filename.substr(1);CA.createNode(i(e),f(e),CA.FILE_MODE,0,r.blob.slice(A.start,A.end))})}),n},createNode:function(A,e,r,i,f,n){var t=WA.createNode(A,e,r);return t.mode=r,t.node_ops=CA.node_ops,t.stream_ops=CA.stream_ops,t.timestamp=(n||new Date).getTime(),h(CA.FILE_MODE!==CA.DIR_MODE),r===CA.FILE_MODE?(t.size=f.size,t.contents=f):(t.size=4096,t.contents={}),A&&(A.contents[e]=t),t},node_ops:{getattr:function(A){return{dev:1,ino:void 0,mode:A.mode,nlink:1,uid:0,gid:0,rdev:void 0,size:A.size,atime:new Date(A.timestamp),mtime:new Date(A.timestamp),ctime:new Date(A.timestamp),blksize:4096,blocks:Math.ceil(A.size/4096)}},setattr:function(A,e){void 0!==e.mode&&(A.mode=e.mode),void 0!==e.timestamp&&(A.timestamp=e.timestamp)},lookup:function(A,e){throw new WA.ErrnoError(hA.ENOENT)},mknod:function(A,e,r,i){throw new WA.ErrnoError(hA.EPERM)},rename:function(A,e,r){throw new WA.ErrnoError(hA.EPERM)},unlink:function(A,e){throw new WA.ErrnoError(hA.EPERM)},rmdir:function(A,e){throw new WA.ErrnoError(hA.EPERM)},readdir:function(A){var e=[".",".."];for(var r in A.contents)A.contents.hasOwnProperty(r)&&e.push(r);return e},symlink:function(A,e,r){throw new WA.ErrnoError(hA.EPERM)},readlink:function(A){throw new WA.ErrnoError(hA.EPERM)}},stream_ops:{read:function(A,e,r,i,f){if(f>=A.node.size)return 0;var n=A.node.contents.slice(f,f+i),t=CA.reader.readAsArrayBuffer(n);return e.set(new Uint8Array(t),r),n.size},write:function(A,e,r,i,f){throw new WA.ErrnoError(hA.EIO)},llseek:function(A,e,r){var i=e;if(1===r?i+=A.position:2===r&&WA.isFile(A.node.mode)&&(i+=A.node.size),i<0)throw new WA.ErrnoError(hA.EINVAL);return i}}};F+=16,F+=16,F+=16;var WA={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(A){if(!(A instanceof WA.ErrnoError))throw A+" : "+y();return wA(A.errno)},lookupPath:function(A,e){if(e=e||{},!(A=gA.resolve(WA.cwd(),A)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var i in r)void 0===e[i]&&(e[i]=r[i]);if(8<e.recurse_count)throw new WA.ErrnoError(hA.ELOOP);for(var f=gA.normalizeArray(A.split("/").filter(function(A){return!!A}),!1),n=WA.root,t="/",o=0;o<f.length;o++){var a=o===f.length-1;if(a&&e.parent)break;if(n=WA.lookupNode(n,f[o]),t=gA.join2(t,f[o]),WA.isMountpoint(n)&&(!a||a&&e.follow_mount)&&(n=n.mounted.root),!a||e.follow)for(var c=0;WA.isLink(n.mode);){var l=WA.readlink(t);if(t=gA.resolve(gA.dirname(t),l),n=WA.lookupPath(t,{recurse_count:e.recurse_count}).node,40<c++)throw new WA.ErrnoError(hA.ELOOP)}}return{path:t,node:n}},getPath:function(A){for(var e;;){if(WA.isRoot(A)){var r=A.mount.mountpoint;return e?"/"!==r[r.length-1]?r+"/"+e:r+e:r}e=e?A.name+"/"+e:A.name,A=A.parent}},hashName:function(A,e){for(var r=0,i=0;i<e.length;i++)r=(r<<5)-r+e.charCodeAt(i)|0;return(A+r>>>0)%WA.nameTable.length},hashAddNode:function(A){var e=WA.hashName(A.parent.id,A.name);A.name_next=WA.nameTable[e],WA.nameTable[e]=A},hashRemoveNode:function(A){var e=WA.hashName(A.parent.id,A.name);if(WA.nameTable[e]===A)WA.nameTable[e]=A.name_next;else for(var r=WA.nameTable[e];r;){if(r.name_next===A){r.name_next=A.name_next;break}r=r.name_next}},lookupNode:function(A,e){var r=WA.mayLookup(A);if(r)throw new WA.ErrnoError(r,A);for(var i=WA.hashName(A.id,e),f=WA.nameTable[i];f;f=f.name_next){var n=f.name;if(f.parent.id===A.id&&n===e)return f}return WA.lookup(A,e)},createNode:function(A,e,r,i){if(!WA.FSNode){WA.FSNode=function(A,e,r,i){A=A||this,this.parent=A,this.mount=A.mount,this.mounted=null,this.id=WA.nextInode++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},WA.FSNode.prototype={};Object.defineProperties(WA.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(A){A?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(A){A?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return WA.isDir(this.mode)}},isDevice:{get:function(){return WA.isChrdev(this.mode)}}})}var f=new WA.FSNode(A,e,r,i);return WA.hashAddNode(f),f},destroyNode:function(A){WA.hashRemoveNode(A)},isRoot:function(A){return A===A.parent},isMountpoint:function(A){return!!A.mounted},isFile:function(A){return 32768==(61440&A)},isDir:function(A){return 16384==(61440&A)},isLink:function(A){return 40960==(61440&A)},isChrdev:function(A){return 8192==(61440&A)},isBlkdev:function(A){return 24576==(61440&A)},isFIFO:function(A){return 4096==(61440&A)},isSocket:function(A){return 49152==(49152&A)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(A){var e=WA.flagModes[A];if(void 0===e)throw new Error("Unknown file open mode: "+A);return e},flagsToPermissionString:function(A){var e=["r","w","rw"][3&A];return 512&A&&(e+="w"),e},nodePermissions:function(A,e){return WA.ignorePermissions||(-1===e.indexOf("r")||292&A.mode)&&(-1===e.indexOf("w")||146&A.mode)&&(-1===e.indexOf("x")||73&A.mode)?0:hA.EACCES},mayLookup:function(A){var e=WA.nodePermissions(A,"x");return e||(A.node_ops.lookup?0:hA.EACCES)},mayCreate:function(A,e){try{WA.lookupNode(A,e);return hA.EEXIST}catch(A){}return WA.nodePermissions(A,"wx")},mayDelete:function(A,e,r){var i;try{i=WA.lookupNode(A,e)}catch(A){return A.errno}var f=WA.nodePermissions(A,"wx");if(f)return f;if(r){if(!WA.isDir(i.mode))return hA.ENOTDIR;if(WA.isRoot(i)||WA.getPath(i)===WA.cwd())return hA.EBUSY}else if(WA.isDir(i.mode))return hA.EISDIR;return 0},mayOpen:function(A,e){return A?WA.isLink(A.mode)?hA.ELOOP:WA.isDir(A.mode)&&("r"!==WA.flagsToPermissionString(e)||512&e)?hA.EISDIR:WA.nodePermissions(A,WA.flagsToPermissionString(e)):hA.ENOENT},MAX_OPEN_FDS:4096,nextfd:function(A,e){A=A||0,e=e||WA.MAX_OPEN_FDS;for(var r=A;r<=e;r++)if(!WA.streams[r])return r;throw new WA.ErrnoError(hA.EMFILE)},getStream:function(A){return WA.streams[A]},createStream:function(A,e,r){WA.FSStream||(WA.FSStream=function(){},WA.FSStream.prototype={},Object.defineProperties(WA.FSStream.prototype,{object:{get:function(){return this.node},set:function(A){this.node=A}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var i=new WA.FSStream;for(var f in A)i[f]=A[f];A=i;var n=WA.nextfd(e,r);return A.fd=n,WA.streams[n]=A},closeStream:function(A){WA.streams[A]=null},chrdev_stream_ops:{open:function(A){var e=WA.getDevice(A.node.rdev);A.stream_ops=e.stream_ops,A.stream_ops.open&&A.stream_ops.open(A)},llseek:function(){throw new WA.ErrnoError(hA.ESPIPE)}},major:function(A){return A>>8},minor:function(A){return 255&A},makedev:function(A,e){return A<<8|e},registerDevice:function(A,e){WA.devices[A]={stream_ops:e}},getDevice:function(A){return WA.devices[A]},getMounts:function(A){for(var e=[],r=[A];r.length;){var i=r.pop();e.push(i),r.push.apply(r,i.mounts)}return e},syncfs:function(e,r){"function"==typeof e&&(r=e,e=!1),WA.syncFSRequests++,1<WA.syncFSRequests&&console.log("warning: "+WA.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var i=WA.getMounts(WA.root.mount),f=0;function n(A){return h(0<WA.syncFSRequests),WA.syncFSRequests--,r(A)}function t(A){if(A)return t.errored?void 0:(t.errored=!0,n(A));++f>=i.length&&n(null)}i.forEach(function(A){if(!A.type.syncfs)return t(null);A.type.syncfs(A,e,t)})},mount:function(A,e,r){var i,f="/"===r,n=!r;if(f&&WA.root)throw new WA.ErrnoError(hA.EBUSY);if(!f&&!n){var t=WA.lookupPath(r,{follow_mount:!1});if(r=t.path,i=t.node,WA.isMountpoint(i))throw new WA.ErrnoError(hA.EBUSY);if(!WA.isDir(i.mode))throw new WA.ErrnoError(hA.ENOTDIR)}var o={type:A,opts:e,mountpoint:r,mounts:[]},a=A.mount(o);return(a.mount=o).root=a,f?WA.root=a:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),a},unmount:function(A){var e=WA.lookupPath(A,{follow_mount:!1});if(!WA.isMountpoint(e.node))throw new WA.ErrnoError(hA.EINVAL);var r=e.node,i=r.mounted,f=WA.getMounts(i);Object.keys(WA.nameTable).forEach(function(A){for(var e=WA.nameTable[A];e;){var r=e.name_next;-1!==f.indexOf(e.mount)&&WA.destroyNode(e),e=r}}),r.mounted=null;var n=r.mount.mounts.indexOf(i);h(-1!==n),r.mount.mounts.splice(n,1)},lookup:function(A,e){return A.node_ops.lookup(A,e)},mknod:function(A,e,r){var i=WA.lookupPath(A,{parent:!0}).node,f=gA.basename(A);if(!f||"."===f||".."===f)throw new WA.ErrnoError(hA.EINVAL);var n=WA.mayCreate(i,f);if(n)throw new WA.ErrnoError(n);if(!i.node_ops.mknod)throw new WA.ErrnoError(hA.EPERM);return i.node_ops.mknod(i,f,e,r)},create:function(A,e){return e=void 0!==e?e:438,e&=4095,e|=32768,WA.mknod(A,e,0)},mkdir:function(A,e){return e=void 0!==e?e:511,e&=1023,e|=16384,WA.mknod(A,e,0)},mkdirTree:function(A,e){for(var r=A.split("/"),i="",f=0;f<r.length;++f)if(r[f]){i+="/"+r[f];try{WA.mkdir(i,e)}catch(A){if(A.errno!=hA.EEXIST)throw A}}},mkdev:function(A,e,r){return void 0===r&&(r=e,e=438),e|=8192,WA.mknod(A,e,r)},symlink:function(A,e){if(!gA.resolve(A))throw new WA.ErrnoError(hA.ENOENT);var r=WA.lookupPath(e,{parent:!0}).node;if(!r)throw new WA.ErrnoError(hA.ENOENT);var i=gA.basename(e),f=WA.mayCreate(r,i);if(f)throw new WA.ErrnoError(f);if(!r.node_ops.symlink)throw new WA.ErrnoError(hA.EPERM);return r.node_ops.symlink(r,i,A)},rename:function(e,r){var A,i,f=gA.dirname(e),n=gA.dirname(r),t=gA.basename(e),o=gA.basename(r);try{A=WA.lookupPath(e,{parent:!0}).node,i=WA.lookupPath(r,{parent:!0}).node}catch(A){throw new WA.ErrnoError(hA.EBUSY)}if(!A||!i)throw new WA.ErrnoError(hA.ENOENT);if(A.mount!==i.mount)throw new WA.ErrnoError(hA.EXDEV);var a,c=WA.lookupNode(A,t),l=gA.relative(e,n);if("."!==l.charAt(0))throw new WA.ErrnoError(hA.EINVAL);if("."!==(l=gA.relative(r,f)).charAt(0))throw new WA.ErrnoError(hA.ENOTEMPTY);try{a=WA.lookupNode(i,o)}catch(A){}if(c!==a){var u=WA.isDir(c.mode),s=WA.mayDelete(A,t,u);if(s)throw new WA.ErrnoError(s);if(s=a?WA.mayDelete(i,o,u):WA.mayCreate(i,o))throw new WA.ErrnoError(s);if(!A.node_ops.rename)throw new WA.ErrnoError(hA.EPERM);if(WA.isMountpoint(c)||a&&WA.isMountpoint(a))throw new WA.ErrnoError(hA.EBUSY);if(i!==A&&(s=WA.nodePermissions(A,"w")))throw new WA.ErrnoError(s);try{WA.trackingDelegate.willMovePath&&WA.trackingDelegate.willMovePath(e,r)}catch(A){console.log("FS.trackingDelegate[\'willMovePath\'](\'"+e+"\', \'"+r+"\') threw an exception: "+A.message)}WA.hashRemoveNode(c);try{A.node_ops.rename(c,i,o)}catch(A){throw A}finally{WA.hashAddNode(c)}try{WA.trackingDelegate.onMovePath&&WA.trackingDelegate.onMovePath(e,r)}catch(A){console.log("FS.trackingDelegate[\'onMovePath\'](\'"+e+"\', \'"+r+"\') threw an exception: "+A.message)}}},rmdir:function(e){var A=WA.lookupPath(e,{parent:!0}).node,r=gA.basename(e),i=WA.lookupNode(A,r),f=WA.mayDelete(A,r,!0);if(f)throw new WA.ErrnoError(f);if(!A.node_ops.rmdir)throw new WA.ErrnoError(hA.EPERM);if(WA.isMountpoint(i))throw new WA.ErrnoError(hA.EBUSY);try{WA.trackingDelegate.willDeletePath&&WA.trackingDelegate.willDeletePath(e)}catch(A){console.log("FS.trackingDelegate[\'willDeletePath\'](\'"+e+"\') threw an exception: "+A.message)}A.node_ops.rmdir(A,r),WA.destroyNode(i);try{WA.trackingDelegate.onDeletePath&&WA.trackingDelegate.onDeletePath(e)}catch(A){console.log("FS.trackingDelegate[\'onDeletePath\'](\'"+e+"\') threw an exception: "+A.message)}},readdir:function(A){var e=WA.lookupPath(A,{follow:!0}).node;if(!e.node_ops.readdir)throw new WA.ErrnoError(hA.ENOTDIR);return e.node_ops.readdir(e)},unlink:function(e){var A=WA.lookupPath(e,{parent:!0}).node,r=gA.basename(e),i=WA.lookupNode(A,r),f=WA.mayDelete(A,r,!1);if(f)throw new WA.ErrnoError(f);if(!A.node_ops.unlink)throw new WA.ErrnoError(hA.EPERM);if(WA.isMountpoint(i))throw new WA.ErrnoError(hA.EBUSY);try{WA.trackingDelegate.willDeletePath&&WA.trackingDelegate.willDeletePath(e)}catch(A){console.log("FS.trackingDelegate[\'willDeletePath\'](\'"+e+"\') threw an exception: "+A.message)}A.node_ops.unlink(A,r),WA.destroyNode(i);try{WA.trackingDelegate.onDeletePath&&WA.trackingDelegate.onDeletePath(e)}catch(A){console.log("FS.trackingDelegate[\'onDeletePath\'](\'"+e+"\') threw an exception: "+A.message)}},readlink:function(A){var e=WA.lookupPath(A).node;if(!e)throw new WA.ErrnoError(hA.ENOENT);if(!e.node_ops.readlink)throw new WA.ErrnoError(hA.EINVAL);return gA.resolve(WA.getPath(e.parent),e.node_ops.readlink(e))},stat:function(A,e){var r=WA.lookupPath(A,{follow:!e}).node;if(!r)throw new WA.ErrnoError(hA.ENOENT);if(!r.node_ops.getattr)throw new WA.ErrnoError(hA.EPERM);return r.node_ops.getattr(r)},lstat:function(A){return WA.stat(A,!0)},chmod:function(A,e,r){var i;"string"==typeof A?i=WA.lookupPath(A,{follow:!r}).node:i=A;if(!i.node_ops.setattr)throw new WA.ErrnoError(hA.EPERM);i.node_ops.setattr(i,{mode:4095&e|-4096&i.mode,timestamp:Date.now()})},lchmod:function(A,e){WA.chmod(A,e,!0)},fchmod:function(A,e){var r=WA.getStream(A);if(!r)throw new WA.ErrnoError(hA.EBADF);WA.chmod(r.node,e)},chown:function(A,e,r,i){var f;"string"==typeof A?f=WA.lookupPath(A,{follow:!i}).node:f=A;if(!f.node_ops.setattr)throw new WA.ErrnoError(hA.EPERM);f.node_ops.setattr(f,{timestamp:Date.now()})},lchown:function(A,e,r){WA.chown(A,e,r,!0)},fchown:function(A,e,r){var i=WA.getStream(A);if(!i)throw new WA.ErrnoError(hA.EBADF);WA.chown(i.node,e,r)},truncate:function(A,e){if(e<0)throw new WA.ErrnoError(hA.EINVAL);var r;"string"==typeof A?r=WA.lookupPath(A,{follow:!0}).node:r=A;if(!r.node_ops.setattr)throw new WA.ErrnoError(hA.EPERM);if(WA.isDir(r.mode))throw new WA.ErrnoError(hA.EISDIR);if(!WA.isFile(r.mode))throw new WA.ErrnoError(hA.EINVAL);var i=WA.nodePermissions(r,"w");if(i)throw new WA.ErrnoError(i);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate:function(A,e){var r=WA.getStream(A);if(!r)throw new WA.ErrnoError(hA.EBADF);if(0==(2097155&r.flags))throw new WA.ErrnoError(hA.EINVAL);WA.truncate(r.node,e)},utime:function(A,e,r){var i=WA.lookupPath(A,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(e,r)})},open:function(e,A,r,i,f){if(""===e)throw new WA.ErrnoError(hA.ENOENT);var n;if(r=void 0===r?438:r,r=64&(A="string"==typeof A?WA.modeStringToFlags(A):A)?4095&r|32768:0,"object"==typeof e)n=e;else{e=gA.normalize(e);try{n=WA.lookupPath(e,{follow:!(131072&A)}).node}catch(A){}}var t=!1;if(64&A)if(n){if(128&A)throw new WA.ErrnoError(hA.EEXIST)}else n=WA.mknod(e,r,0),t=!0;if(!n)throw new WA.ErrnoError(hA.ENOENT);if(WA.isChrdev(n.mode)&&(A&=-513),65536&A&&!WA.isDir(n.mode))throw new WA.ErrnoError(hA.ENOTDIR);if(!t){var o=WA.mayOpen(n,A);if(o)throw new WA.ErrnoError(o)}512&A&&WA.truncate(n,0),A&=-641;var a=WA.createStream({node:n,path:WA.getPath(n),flags:A,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1},i,f);a.stream_ops.open&&a.stream_ops.open(a),!d.logReadFiles||1&A||(WA.readFiles||(WA.readFiles={}),e in WA.readFiles||(WA.readFiles[e]=1,d.printErr("read file: "+e)));try{if(WA.trackingDelegate.onOpenFile){var c=0;1!=(2097155&A)&&(c|=WA.tracking.openFlags.READ),0!=(2097155&A)&&(c|=WA.tracking.openFlags.WRITE),WA.trackingDelegate.onOpenFile(e,c)}}catch(A){console.log("FS.trackingDelegate[\'onOpenFile\'](\'"+e+"\', flags) threw an exception: "+A.message)}return a},close:function(A){A.getdents&&(A.getdents=null);try{A.stream_ops.close&&A.stream_ops.close(A)}catch(A){throw A}finally{WA.closeStream(A.fd)}},llseek:function(A,e,r){if(!A.seekable||!A.stream_ops.llseek)throw new WA.ErrnoError(hA.ESPIPE);return A.position=A.stream_ops.llseek(A,e,r),A.ungotten=[],A.position},read:function(A,e,r,i,f){if(i<0||f<0)throw new WA.ErrnoError(hA.EINVAL);if(1==(2097155&A.flags))throw new WA.ErrnoError(hA.EBADF);if(WA.isDir(A.node.mode))throw new WA.ErrnoError(hA.EISDIR);if(!A.stream_ops.read)throw new WA.ErrnoError(hA.EINVAL);var n=!0;if(void 0===f)f=A.position,n=!1;else if(!A.seekable)throw new WA.ErrnoError(hA.ESPIPE);var t=A.stream_ops.read(A,e,r,i,f);return n||(A.position+=t),t},write:function(A,e,r,i,f,n){if(i<0||f<0)throw new WA.ErrnoError(hA.EINVAL);if(0==(2097155&A.flags))throw new WA.ErrnoError(hA.EBADF);if(WA.isDir(A.node.mode))throw new WA.ErrnoError(hA.EISDIR);if(!A.stream_ops.write)throw new WA.ErrnoError(hA.EINVAL);1024&A.flags&&WA.llseek(A,0,2);var t=!0;if(void 0===f)f=A.position,t=!1;else if(!A.seekable)throw new WA.ErrnoError(hA.ESPIPE);var o=A.stream_ops.write(A,e,r,i,f,n);t||(A.position+=o);try{A.path&&WA.trackingDelegate.onWriteToFile&&WA.trackingDelegate.onWriteToFile(A.path)}catch(A){console.log("FS.trackingDelegate[\'onWriteToFile\'](\'"+path+"\') threw an exception: "+A.message)}return o},allocate:function(A,e,r){if(e<0||r<=0)throw new WA.ErrnoError(hA.EINVAL);if(0==(2097155&A.flags))throw new WA.ErrnoError(hA.EBADF);if(!WA.isFile(A.node.mode)&&!WA.isDir(A.node.mode))throw new WA.ErrnoError(hA.ENODEV);if(!A.stream_ops.allocate)throw new WA.ErrnoError(hA.EOPNOTSUPP);A.stream_ops.allocate(A,e,r)},mmap:function(A,e,r,i,f,n,t){if(1==(2097155&A.flags))throw new WA.ErrnoError(hA.EACCES);if(!A.stream_ops.mmap)throw new WA.ErrnoError(hA.ENODEV);return A.stream_ops.mmap(A,e,r,i,f,n,t)},msync:function(A,e,r,i,f){return A&&A.stream_ops.msync?A.stream_ops.msync(A,e,r,i,f):0},munmap:function(A){return 0},ioctl:function(A,e,r){if(!A.stream_ops.ioctl)throw new WA.ErrnoError(hA.ENOTTY);return A.stream_ops.ioctl(A,e,r)},readFile:function(A,e){if((e=e||{}).flags=e.flags||"r",e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(\'Invalid encoding type "\'+e.encoding+\'"\');var r,i=WA.open(A,e.flags),f=WA.stat(A).size,n=new Uint8Array(f);return WA.read(i,n,0,f,0),"utf8"===e.encoding?r=c(n,0):"binary"===e.encoding&&(r=n),WA.close(i),r},writeFile:function(A,e,r){if((r=r||{}).flags=r.flags||"w",r.encoding=r.encoding||"utf8","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error(\'Invalid encoding type "\'+r.encoding+\'"\');var i=WA.open(A,r.flags,r.mode);if("utf8"===r.encoding){var f=new Uint8Array(p(e)+1),n=s(e,f,0,f.length);WA.write(i,f,0,n,0,r.canOwn)}else"binary"===r.encoding&&WA.write(i,e,0,e.length,0,r.canOwn);WA.close(i)},cwd:function(){return WA.currentPath},chdir:function(A){var e=WA.lookupPath(A,{follow:!0});if(null===e.node)throw new WA.ErrnoError(hA.ENOENT);if(!WA.isDir(e.node.mode))throw new WA.ErrnoError(hA.ENOTDIR);var r=WA.nodePermissions(e.node,"x");if(r)throw new WA.ErrnoError(r);WA.currentPath=e.path},createDefaultDirectories:function(){WA.mkdir("/tmp"),WA.mkdir("/home"),WA.mkdir("/home/web_user")},createDefaultDevices:function(){var A;if(WA.mkdir("/dev"),WA.registerDevice(WA.makedev(1,3),{read:function(){return 0},write:function(A,e,r,i,f){return i}}),WA.mkdev("/dev/null",WA.makedev(1,3)),mA.register(WA.makedev(5,0),mA.default_tty_ops),mA.register(WA.makedev(6,0),mA.default_tty1_ops),WA.mkdev("/dev/tty",WA.makedev(5,0)),WA.mkdev("/dev/tty1",WA.makedev(6,0)),"undefined"!=typeof crypto){var e=new Uint8Array(1);A=function(){return crypto.getRandomValues(e),e[0]}}else A=o?function(){}:function(){return 256*Math.random()|0};WA.createDevice("/dev","random",A),WA.createDevice("/dev","urandom",A),WA.mkdir("/dev/shm"),WA.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){WA.mkdir("/proc"),WA.mkdir("/proc/self"),WA.mkdir("/proc/self/fd"),WA.mount({mount:function(){var A=WA.createNode("/proc/self","fd",16895,73);return A.node_ops={lookup:function(A,e){var r=+e,i=WA.getStream(r);if(!i)throw new WA.ErrnoError(hA.EBADF);var f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return i.path}}};return f.parent=f}},A}},{},"/proc/self/fd")},createStandardStreams:function(){d.stdin?WA.createDevice("/dev","stdin",d.stdin):WA.symlink("/dev/tty","/dev/stdin"),d.stdout?WA.createDevice("/dev","stdout",null,d.stdout):WA.symlink("/dev/tty","/dev/stdout"),d.stderr?WA.createDevice("/dev","stderr",null,d.stderr):WA.symlink("/dev/tty1","/dev/stderr");var A=WA.open("/dev/stdin","r");h(0===A.fd,"invalid handle for stdin ("+A.fd+")");var e=WA.open("/dev/stdout","w");h(1===e.fd,"invalid handle for stdout ("+e.fd+")");var r=WA.open("/dev/stderr","w");h(2===r.fd,"invalid handle for stderr ("+r.fd+")")},ensureErrnoError:function(){WA.ErrnoError||(WA.ErrnoError=function(A,e){this.node=e,this.setErrno=function(A){for(var e in this.errno=A,hA)if(hA[e]===A){this.code=e;break}},this.setErrno(A),this.message=vA[A],this.stack&&Object.defineProperty(this,"stack",{value:(new Error).stack})},WA.ErrnoError.prototype=new Error,WA.ErrnoError.prototype.constructor=WA.ErrnoError,[hA.ENOENT].forEach(function(A){WA.genericErrors[A]=new WA.ErrnoError(A)}))},staticInit:function(){WA.ensureErrnoError(),WA.nameTable=new Array(4096),WA.mount(pA,{},"/"),WA.createDefaultDirectories(),WA.createDefaultDevices(),WA.createSpecialDirectories(),WA.filesystems={MEMFS:pA,IDBFS:yA,NODEFS:ZA,WORKERFS:CA}},init:function(A,e,r){h(!WA.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),WA.init.initialized=!0,WA.ensureErrnoError(),d.stdin=A||d.stdin,d.stdout=e||d.stdout,d.stderr=r||d.stderr,WA.createStandardStreams()},quit:function(){WA.init.initialized=!1;var A=d._fflush;A&&A(0);for(var e=0;e<WA.streams.length;e++){var r=WA.streams[e];r&&WA.close(r)}},getMode:function(A,e){var r=0;return A&&(r|=365),e&&(r|=146),r},joinPath:function(A,e){var r=gA.join.apply(null,A);return e&&"/"==r[0]&&(r=r.substr(1)),r},absolutePath:function(A,e){return gA.resolve(e,A)},standardizePath:function(A){return gA.normalize(A)},findObject:function(A,e){var r=WA.analyzePath(A,e);return r.exists?r.object:(wA(r.error),null)},analyzePath:function(A,e){try{A=(i=WA.lookupPath(A,{follow:!e})).path}catch(A){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=WA.lookupPath(A,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=gA.basename(A),i=WA.lookupPath(A,{follow:!e}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(A){r.error=A.errno}return r},createFolder:function(A,e,r,i){var f=gA.join2("string"==typeof A?A:WA.getPath(A),e),n=WA.getMode(r,i);return WA.mkdir(f,n)},createPath:function(A,e,r,i){A="string"==typeof A?A:WA.getPath(A);for(var f=e.split("/").reverse();f.length;){var n=f.pop();if(n){var t=gA.join2(A,n);try{WA.mkdir(t)}catch(A){}A=t}}return t},createFile:function(A,e,r,i,f){var n=gA.join2("string"==typeof A?A:WA.getPath(A),e),t=WA.getMode(i,f);return WA.create(n,t)},createDataFile:function(A,e,r,i,f,n){var t=e?gA.join2("string"==typeof A?A:WA.getPath(A),e):A,o=WA.getMode(i,f),a=WA.create(t,o);if(r){if("string"==typeof r){for(var c=new Array(r.length),l=0,u=r.length;l<u;++l)c[l]=r.charCodeAt(l);r=c}WA.chmod(a,146|o);var s=WA.open(a,"w");WA.write(s,r,0,r.length,0,n),WA.close(s),WA.chmod(a,o)}return a},createDevice:function(A,e,a,t){var r=gA.join2("string"==typeof A?A:WA.getPath(A),e),i=WA.getMode(!!a,!!t);WA.createDevice.major||(WA.createDevice.major=64);var f=WA.makedev(WA.createDevice.major++,0);return WA.registerDevice(f,{open:function(A){A.seekable=!1},close:function(A){t&&t.buffer&&t.buffer.length&&t(10)},read:function(A,e,r,i,f){for(var n=0,t=0;t<i;t++){var o;try{o=a()}catch(A){throw new WA.ErrnoError(hA.EIO)}if(void 0===o&&0===n)throw new WA.ErrnoError(hA.EAGAIN);if(null==o)break;n++,e[r+t]=o}return n&&(A.node.timestamp=Date.now()),n},write:function(A,e,r,i,f){for(var n=0;n<i;n++)try{t(e[r+n])}catch(A){throw new WA.ErrnoError(hA.EIO)}return i&&(A.node.timestamp=Date.now()),n}}),WA.mkdev(r,i,f)},createLink:function(A,e,r,i,f){var n=gA.join2("string"==typeof A?A:WA.getPath(A),e);return WA.symlink(r,n)},forceLoadFile:function(A){if(A.isDevice||A.isFolder||A.link||A.contents)return!0;var e=!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!d.read)throw new Error("Cannot load without read() or XMLHttpRequest.");try{A.contents=hr(d.read(A.url),!0),A.usedBytes=A.contents.length}catch(A){e=!1}return e||wA(hA.EIO),e},createLazyFile:function(A,e,o,r,i){function f(){this.lengthKnown=!1,this.chunks=[]}if(f.prototype.get=function(A){if(!(A>this.length-1||A<0)){var e=A%this.chunkSize,r=A/this.chunkSize|0;return this.getter(r)[e]}},f.prototype.setDataGetter=function(A){this.getter=A},f.prototype.cacheLength=function(){var A=new XMLHttpRequest;if(A.open("HEAD",o,!1),A.send(null),!(200<=A.status&&A.status<300||304===A.status))throw new Error("Couldn\'t load "+o+". Status: "+A.status);var e,i=Number(A.getResponseHeader("Content-length")),r=(e=A.getResponseHeader("Accept-Ranges"))&&"bytes"===e,f=(e=A.getResponseHeader("Content-Encoding"))&&"gzip"===e,n=1048576;r||(n=i);var t=this;t.setDataGetter(function(A){var e=A*n,r=(A+1)*n-1;if(r=Math.min(r,i-1),void 0===t.chunks[A]&&(t.chunks[A]=function(A,e){if(e<A)throw new Error("invalid range ("+A+", "+e+") or no bytes requested!");if(i-1<e)throw new Error("only "+i+" bytes available! programmer error!");var r=new XMLHttpRequest;if(r.open("GET",o,!1),i!==n&&r.setRequestHeader("Range","bytes="+A+"-"+e),"undefined"!=typeof Uint8Array&&(r.responseType="arraybuffer"),r.overrideMimeType&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.send(null),!(200<=r.status&&r.status<300||304===r.status))throw new Error("Couldn\'t load "+o+". Status: "+r.status);return void 0!==r.response?new Uint8Array(r.response||[]):hr(r.responseText||"",!0)}(e,r)),void 0===t.chunks[A])throw new Error("doXHR failed!");return t.chunks[A]}),!f&&i||(n=i=1,i=this.getter(0).length,n=i,console.log("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=n,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!l)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var n=new f;Object.defineProperties(n,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var t={isDevice:!1,contents:n}}else t={isDevice:!1,url:o};var a=WA.createFile(A,e,t,r,i);t.contents?a.contents=t.contents:t.url&&(a.contents=null,a.url=t.url),Object.defineProperties(a,{usedBytes:{get:function(){return this.contents.length}}});var c={};return Object.keys(a.stream_ops).forEach(function(A){var e=a.stream_ops[A];c[A]=function(){if(!WA.forceLoadFile(a))throw new WA.ErrnoError(hA.EIO);return e.apply(null,arguments)}}),c.read=function(A,e,r,i,f){if(!WA.forceLoadFile(a))throw new WA.ErrnoError(hA.EIO);var n=A.node.contents;if(f>=n.length)return 0;var t=Math.min(n.length-f,i);if(h(0<=t),n.slice)for(var o=0;o<t;o++)e[r+o]=n[f+o];else for(o=0;o<t;o++)e[r+o]=n.get(f+o);return t},a.stream_ops=c,a},createPreloadedFile:function(f,n,A,t,o,a,c,l,u,s){Browser.init();var b=n?gA.resolve(gA.join2(f,n)):f;function e(e){function r(A){s&&s(),l||WA.createDataFile(f,n,A,t,o,u),a&&a(),uA()}var i=!1;d.preloadPlugins.forEach(function(A){i||A.canHandle(b)&&(A.handle(e,b,r,function(){c&&c(),uA()}),i=!0)}),i||r(e)}lA(),"string"==typeof A?Browser.asyncLoad(A,function(A){e(A)},c):e(A)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,o,a){o=o||function(){},a=a||function(){};var A=WA.indexedDB();try{var c=A.open(WA.DB_NAME(),WA.DB_VERSION)}catch(A){return a(A)}c.onupgradeneeded=function(){console.log("creating db"),c.result.createObjectStore(WA.DB_STORE_NAME)},c.onsuccess=function(){var A=c.result.transaction([WA.DB_STORE_NAME],"readwrite"),r=A.objectStore(WA.DB_STORE_NAME),i=0,f=0,n=e.length;function t(){(0==f?o:a)()}e.forEach(function(A){var e=r.put(WA.analyzePath(A).object.contents,A);e.onsuccess=function(){++i+f==n&&t()},e.onerror=function(){i+ ++f==n&&t()}}),A.onerror=a},c.onerror=a},loadFilesFromDB:function(o,a,c){a=a||function(){},c=c||function(){};var A=WA.indexedDB();try{var l=A.open(WA.DB_NAME(),WA.DB_VERSION)}catch(A){return c(A)}l.onupgradeneeded=c,l.onsuccess=function(){var A=l.result;try{var e=A.transaction([WA.DB_STORE_NAME],"readonly")}catch(A){return void c(A)}var r=e.objectStore(WA.DB_STORE_NAME),i=0,f=0,n=o.length;function t(){(0==f?a:c)()}o.forEach(function(A){var e=r.get(A);e.onsuccess=function(){WA.analyzePath(A).exists&&WA.unlink(A),WA.createDataFile(gA.dirname(A),gA.basename(A),e.result,!0,!0,!0),++i+f==n&&t()},e.onerror=function(){i+ ++f==n&&t()}}),e.onerror=c},l.onerror=c}},IA={DEFAULT_POLLMASK:5,mappings:{},umask:511,calculateAt:function(A,e){if("/"!==e[0]){var r;if(-100===A)r=WA.cwd();else{var i=WA.getStream(A);if(!i)throw new WA.ErrnoError(hA.EBADF);r=i.path}e=gA.join2(r,e)}return e},doStat:function(A,e,r){try{var i=A(e)}catch(A){if(A&&A.node&&gA.normalize(e)!==gA.normalize(WA.getPath(A.node)))return-hA.ENOTDIR;throw A}return E[r>>2]=i.dev,E[r+4>>2]=0,E[r+8>>2]=i.ino,E[r+12>>2]=i.mode,E[r+16>>2]=i.nlink,E[r+20>>2]=i.uid,E[r+24>>2]=i.gid,E[r+28>>2]=i.rdev,E[r+32>>2]=0,E[r+36>>2]=i.size,E[r+40>>2]=4096,E[r+44>>2]=i.blocks,E[r+48>>2]=i.atime.getTime()/1e3|0,E[r+52>>2]=0,E[r+56>>2]=i.mtime.getTime()/1e3|0,E[r+60>>2]=0,E[r+64>>2]=i.ctime.getTime()/1e3|0,E[r+68>>2]=0,E[r+72>>2]=i.ino,0},doMsync:function(A,e,r,i){var f=new Uint8Array(W.subarray(A,A+r));WA.msync(e,f,0,r,i)},doMkdir:function(A,e){return"/"===(A=gA.normalize(A))[A.length-1]&&(A=A.substr(0,A.length-1)),WA.mkdir(A,e,0),0},doMknod:function(A,e,r){switch(61440&e){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-hA.EINVAL}return WA.mknod(A,e,r),0},doReadlink:function(A,e,r){if(r<=0)return-hA.EINVAL;var i=WA.readlink(A),f=Math.min(r,p(i)),n=C[e+f];return b(i,e,r+1),C[e+f]=n,f},doAccess:function(A,e){if(-8&e)return-hA.EINVAL;var r;r=WA.lookupPath(A,{follow:!0}).node;var i="";return 4&e&&(i+="r"),2&e&&(i+="w"),1&e&&(i+="x"),i&&WA.nodePermissions(r,i)?-hA.EACCES:0},doDup:function(A,e,r){var i=WA.getStream(r);return i&&WA.close(i),WA.open(A,e,0,r,r).fd},doReadv:function(A,e,r,i){for(var f=0,n=0;n<r;n++){var t=E[e+8*n>>2],o=E[e+(8*n+4)>>2],a=WA.read(A,C,t,o,i);if(a<0)return-1;if(f+=a,a<o)break}return f},doWritev:function(A,e,r,i){for(var f=0,n=0;n<r;n++){var t=E[e+8*n>>2],o=E[e+(8*n+4)>>2],a=WA.write(A,C,t,o,i);if(a<0)return-1;f+=a}return f},varargs:0,get:function(A){return IA.varargs+=4,E[IA.varargs-4>>2]},getStr:function(){return m(IA.get())},getStreamFromFD:function(){var A=WA.getStream(IA.get());if(!A)throw new WA.ErrnoError(hA.EBADF);return A},getSocketFromFD:function(){var A=SOCKFS.getSocket(IA.get());if(!A)throw new WA.ErrnoError(hA.EBADF);return A},getSocketAddress:function(A){var e=IA.get(),r=IA.get();if(A&&0===e)return null;var i=__read_sockaddr(e,r);if(i.errno)throw new WA.ErrnoError(i.errno);return i.addr=DNS.lookup_addr(i.addr)||i.addr,i},get64:function(){var A=IA.get(),e=IA.get();return h(0<=A?0===e:-1===e),A},getZero:function(){h(0===IA.get())}};var BA=a([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",v);var EA={};function GA(A){for(;A.length;){var e=A.pop();A.pop()(e)}}function VA(A){return this.fromWireType(G[A>>2])}var XA={},_A={},FA={},NA=48,RA=57;function YA(A){if(void 0===A)return"_unknown";var e=(A=A.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return NA<=e&&e<=RA?"_"+A:A}function JA(A,e){return A=YA(A),new Function("body","return function "+A+\'() {\\n    "use strict";    return body.apply(this, arguments);\\n};\\n\')(e)}function DA(A,r){var e=JA(r,function(A){this.name=r,this.message=A;var e=new Error(A).stack;void 0!==e&&(this.stack=this.toString()+"\\n"+e.replace(/^Error(:[^\\n]*)?\\n/,""))});return e.prototype=Object.create(A.prototype),(e.prototype.constructor=e).prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},e}var QA=void 0;function TA(A){throw new QA(A)}function MA(i,e,f){function r(A){var e=f(A);e.length!==i.length&&TA("Mismatched type converter count");for(var r=0;r<i.length;++r)zA(i[r],e[r])}i.forEach(function(A){FA[A]=e});var n=new Array(e.length),t=[],o=0;e.forEach(function(A,e){_A.hasOwnProperty(A)?n[e]=_A[A]:(t.push(A),XA.hasOwnProperty(A)||(XA[A]=[]),XA[A].push(function(){n[e]=_A[A],++o===t.length&&r(n)}))}),0===t.length&&r(n)}function SA(A){switch(A){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+A)}}function UA(){for(var A=new Array(256),e=0;e<256;++e)A[e]=String.fromCharCode(e);OA=A}var OA=void 0;function HA(A){for(var e="",r=A;W[r];)e+=OA[W[r++]];return e}var xA=void 0;function jA(A){throw new xA(A)}function zA(A,e,r){if(r=r||{},!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=e.name;if(A||jA(\'type "\'+i+\'" must have a positive integer typeid pointer\'),_A.hasOwnProperty(A)){if(r.ignoreDuplicateRegistrations)return;jA("Cannot register type \'"+i+"\' twice")}if(_A[A]=e,delete FA[A],XA.hasOwnProperty(A)){var f=XA[A];delete XA[A],f.forEach(function(A){A()})}}function PA(A){if(!(this instanceof oe))return!1;if(!(A instanceof oe))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,i=A.$$.ptrType.registeredClass,f=A.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;i.baseClass;)f=i.upcast(f),i=i.baseClass;return e===i&&r===f}function LA(A){return{count:A.count,deleteScheduled:A.deleteScheduled,preservePointerOnDelete:A.preservePointerOnDelete,ptr:A.ptr,ptrType:A.ptrType,smartPtr:A.smartPtr,smartPtrType:A.smartPtrType}}function KA(A){jA(A.$$.ptrType.registeredClass.name+" instance already deleted")}function qA(){if(this.$$.ptr||KA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var A=Object.create(Object.getPrototypeOf(this),{$$:{value:LA(this.$$)}});return A.$$.count.value+=1,A.$$.deleteScheduled=!1,A}function $A(A){var e=A.$$;e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Ae(){this.$$.ptr||KA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&jA("Object already scheduled for deletion"),--this.$$.count.value,0===this.$$.count.value&&$A(this),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ee(){return!this.$$.ptr}var re=void 0,ie=[];function fe(){for(;ie.length;){var A=ie.pop();A.$$.deleteScheduled=!1,A.delete()}}function ne(){return this.$$.ptr||KA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&jA("Object already scheduled for deletion"),ie.push(this),1===ie.length&&re&&re(fe),this.$$.deleteScheduled=!0,this}function te(){oe.prototype.isAliasOf=PA,oe.prototype.clone=qA,oe.prototype.delete=Ae,oe.prototype.isDeleted=ee,oe.prototype.deleteLater=ne}function oe(){}var ae={};function ce(A,e,r){if(void 0===A[e].overloadTable){var i=A[e];A[e]=function(){return A[e].overloadTable.hasOwnProperty(arguments.length)||jA("Function \'"+r+"\' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+A[e].overloadTable+")!"),A[e].overloadTable[arguments.length].apply(this,arguments)},A[e].overloadTable=[],A[e].overloadTable[i.argCount]=i}}function le(A,e,r){d.hasOwnProperty(A)?((void 0===r||void 0!==d[A].overloadTable&&void 0!==d[A].overloadTable[r])&&jA("Cannot register public name \'"+A+"\' twice"),ce(d,A,A),d.hasOwnProperty(r)&&jA("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),d[A].overloadTable[r]=e):(d[A]=e,void 0!==r&&(d[A].numArguments=r))}function ue(A,e,r,i,f,n,t,o){this.name=A,this.constructor=e,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=f,this.getActualType=n,this.upcast=t,this.downcast=o,this.pureVirtualFunctions=[]}function se(A,e,r){for(;e!==r;)e.upcast||jA("Expected null or instance of "+r.name+", got an instance of "+e.name),A=e.upcast(A),e=e.baseClass;return A}function be(A,e){if(null===e)return this.isReference&&jA("null is not a valid "+this.name),0;e.$$||jA(\'Cannot pass "\'+Pe(e)+\'" as a \'+this.name),e.$$.ptr||jA("Cannot pass deleted object as a pointer of type "+this.name);var r=e.$$.ptrType.registeredClass;return se(e.$$.ptr,r,this.registeredClass)}function de(A,e){var r;if(null===e)return this.isReference&&jA("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==A&&A.push(this.rawDestructor,r),r):0;e.$$||jA(\'Cannot pass "\'+Pe(e)+\'" as a \'+this.name),e.$$.ptr||jA("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&e.$$.ptrType.isConst&&jA("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);var i=e.$$.ptrType.registeredClass;if(r=se(e.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&jA("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:jA("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var f=e.clone();r=this.rawShare(r,xe(function(){f.delete()})),null!==A&&A.push(this.rawDestructor,r)}break;default:jA("Unsupporting sharing policy")}return r}function ke(A,e){if(null===e)return this.isReference&&jA("null is not a valid "+this.name),0;e.$$||jA(\'Cannot pass "\'+Pe(e)+\'" as a \'+this.name),e.$$.ptr||jA("Cannot pass deleted object as a pointer of type "+this.name),e.$$.ptrType.isConst&&jA("Cannot convert argument of type "+e.$$.ptrType.name+" to parameter type "+this.name);var r=e.$$.ptrType.registeredClass;return se(e.$$.ptr,r,this.registeredClass)}function he(A){return this.rawGetPointee&&(A=this.rawGetPointee(A)),A}function we(A){this.rawDestructor&&this.rawDestructor(A)}function ve(A){null!==A&&A.delete()}function ge(A,e,r){if(e===r)return A;if(void 0===r.baseClass)return null;var i=ge(A,e,r.baseClass);return null===i?null:r.downcast(i)}function me(){return Object.keys(Ce).length}function pe(){var A=[];for(var e in Ce)Ce.hasOwnProperty(e)&&A.push(Ce[e]);return A}function ye(A){re=A,ie.length&&re&&re(fe)}function Ze(){d.getInheritedInstanceCount=me,d.getLiveInheritedInstances=pe,d.flushPendingDeletes=fe,d.setDelayFunction=ye}var Ce={};function We(A,e){for(void 0===e&&jA("ptr should not be undefined");A.baseClass;)e=A.upcast(e),A=A.baseClass;return e}function Ie(A,e){return e=We(A,e),Ce[e]}function Be(A,e){return e.ptrType&&e.ptr||TA("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&TA("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Object.create(A,{$$:{value:e}})}function Ee(A){var e=this.getPointee(A);if(!e)return this.destructor(A),null;var r=Ie(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=A,r.clone();var i=r.clone();return this.destructor(A),i}function f(){return this.isSmartPointer?Be(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:A}):Be(this.registeredClass.instancePrototype,{ptrType:this,ptr:A})}var n,t=this.registeredClass.getActualType(e),o=ae[t];if(!o)return f.call(this);n=this.isConst?o.constPointerType:o.pointerType;var a=ge(e,this.registeredClass,n.registeredClass);return null===a?f.call(this):this.isSmartPointer?Be(n.registeredClass.instancePrototype,{ptrType:n,ptr:a,smartPtrType:this,smartPtr:A}):Be(n.registeredClass.instancePrototype,{ptrType:n,ptr:a})}function Ge(){Ve.prototype.getPointee=he,Ve.prototype.destructor=we,Ve.prototype.argPackAdvance=8,Ve.prototype.readValueFromPointer=VA,Ve.prototype.deleteObject=ve,Ve.prototype.fromWireType=Ee}function Ve(A,e,r,i,f,n,t,o,a,c,l){this.name=A,this.registeredClass=e,this.isReference=r,this.isConst=i,this.isSmartPointer=f,this.pointeeType=n,this.sharingPolicy=t,this.rawGetPointee=o,this.rawConstructor=a,this.rawShare=c,this.rawDestructor=l,f||void 0!==e.baseClass?this.toWireType=de:(this.toWireType=i?be:ke,this.destructorFunction=null)}function Xe(A,e,r){d.hasOwnProperty(A)||TA("Replacing nonexistant public symbol"),void 0!==d[A].overloadTable&&void 0!==r?d[A].overloadTable[r]=e:(d[A]=e,d[A].argCount=r)}function _e(f,n){var A;if(f=HA(f),void 0!==d["FUNCTION_TABLE_"+f])A=d["FUNCTION_TABLE_"+f][n];else if("undefined"!=typeof FUNCTION_TABLE)A=FUNCTION_TABLE[n];else{var e=d.asm["dynCall_"+f];void 0===e&&void 0===(e=d.asm["dynCall_"+f.replace(/f/g,"d")])&&jA("No dynCall invoker for signature: "+f),A=function(A){for(var e=[],r=1;r<f.length;++r)e.push("a"+r);var i="return function "+("dynCall_"+f+"_"+n)+"("+e.join(", ")+") {\\n";return i+="    return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\\n",i+="};\\n",new Function("dynCall","rawFunction",i)(A,n)}(e)}return"function"!=typeof A&&jA("unknown function pointer with signature "+f+": "+n),A}var Fe=void 0;function Ne(A){var e=Er(A),r=HA(e);return Vr(e),r}function Re(A,e){var r=[],i={};throw e.forEach(function A(e){i[e]||_A[e]||(FA[e]?FA[e].forEach(A):(r.push(e),i[e]=!0))}),new Fe(A+": "+r.map(Ne).join([", "]))}function Ye(A,e){if(!(A instanceof Function))throw new TypeError("new_ called with constructor type "+typeof A+" which is not a function");var r=JA(A.name||"unknownFunctionName",function(){});r.prototype=A.prototype;var i=new r,f=A.apply(i,e);return f instanceof Object?f:i}function Je(A,e,r,i,f){var n=e.length;n<2&&jA("argTypes array size mismatch! Must at least get return value and \'this\' types!");for(var t=null!==e[1]&&null!==r,o=!1,a=1;a<e.length;++a)if(null!==e[a]&&void 0===e[a].destructorFunction){o=!0;break}var c="void"!==e[0].name,l="",u="";for(a=0;a<n-2;++a)l+=(0!==a?", ":"")+"arg"+a,u+=(0!==a?", ":"")+"arg"+a+"Wired";var s="return function "+YA(A)+"("+l+") {\\nif (arguments.length !== "+(n-2)+") {\\nthrowBindingError(\'function "+A+" called with \' + arguments.length + \' arguments, expected "+(n-2)+" args!\');\\n}\\n";o&&(s+="var destructors = [];\\n");var b=o?"destructors":"null",d=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],k=[jA,i,f,GA,e[0],e[1]];t&&(s+="var thisWired = classParam.toWireType("+b+", this);\\n");for(a=0;a<n-2;++a)s+="var arg"+a+"Wired = argType"+a+".toWireType("+b+", arg"+a+"); // "+e[a+2].name+"\\n",d.push("argType"+a),k.push(e[a+2]);if(t&&(u="thisWired"+(0<u.length?", ":"")+u),s+=(c?"var rv = ":"")+"invoker(fn"+(0<u.length?", ":"")+u+");\\n",o)s+="runDestructors(destructors);\\n";else for(a=t?1:2;a<e.length;++a){var h=1===a?"thisWired":"arg"+(a-2)+"Wired";null!==e[a].destructorFunction&&(s+=h+"_dtor("+h+"); // "+e[a].name+"\\n",d.push(h+"_dtor"),k.push(e[a].destructorFunction))}return c&&(s+="var ret = retType.fromWireType(rv);\\nreturn ret;\\n"),s+="}\\n",d.push(s),Ye(Function,d).apply(null,k)}function De(A,e){for(var r=[],i=0;i<A;i++)r.push(E[(e>>2)+i]);return r}function Qe(A,e,r){return A instanceof Object||jA(r+\' with invalid "this": \'+A),A instanceof e.registeredClass.constructor||jA(r+\' incompatible with "this" of type \'+A.constructor.name),A.$$.ptr||jA("cannot call emscripten binding method "+r+" on deleted object"),se(A.$$.ptr,A.$$.ptrType.registeredClass,e.registeredClass)}var Te=[],Me=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Se(A){4<A&&0==--Me[A].refcount&&(Me[A]=void 0,Te.push(A))}function Ue(){for(var A=0,e=5;e<Me.length;++e)void 0!==Me[e]&&++A;return A}function Oe(){for(var A=5;A<Me.length;++A)if(void 0!==Me[A])return Me[A];return null}function He(){d.count_emval_handles=Ue,d.get_first_emval=Oe}function xe(A){switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Te.length?Te.pop():Me.length;return Me[e]={refcount:1,value:A},e}}function je(A,e,r){switch(e){case 0:return function(A){var e=r?C:W;return this.fromWireType(e[A])};case 1:return function(A){var e=r?I:B;return this.fromWireType(e[A>>1])};case 2:return function(A){var e=r?E:G;return this.fromWireType(e[A>>2])};default:throw new TypeError("Unknown integer type: "+A)}}function ze(A,e){var r=_A[A];return void 0===r&&jA(e+" has unknown type "+Ne(A)),r}function Pe(A){if(null===A)return"null";var e=typeof A;return"object"==e||"array"==e||"function"==e?A.toString():""+A}function Le(A,e){switch(e){case 2:return function(A){return this.fromWireType(V[A>>2])};case 3:return function(A){return this.fromWireType(X[A>>3])};default:throw new TypeError("Unknown float type: "+A)}}function Ke(A,e,r){switch(e){case 0:return r?function(A){return C[A]}:function(A){return W[A]};case 1:return r?function(A){return I[A>>1]}:function(A){return B[A>>1]};case 2:return r?function(A){return E[A>>2]}:function(A){return G[A>>2]};default:throw new TypeError("Unknown integer type: "+A)}}function qe(A,e,r){for(var i=new Array(A),f=0;f<A;++f)i[f]=ze(E[(e>>2)+f],"parameter "+f);return i}function $e(A){return A||jA("Cannot use deleted val. handle = "+A),Me[A].value}var Ar={};function er(A){var e=Ar[A];return void 0===e?HA(A):e}var rr=F;function ir(A){var e,r;ir.called?(r=E[rr>>2],e=E[r>>2]):(ir.called=!0,fr.USER=fr.LOGNAME="web_user",fr.PATH="/",fr.PWD="/",fr.HOME="/home/web_user",fr.LANG="C.UTF-8",fr._=d.thisProgram,e=a(1024,"i8",v),r=a(256,"i8*",v),E[r>>2]=e,E[rr>>2]=r);var i=[],f=0;for(var n in A)if("string"==typeof A[n]){var t=n+"="+A[n];i.push(t),f+=t.length}if(1024<f)throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");for(var o=0;o<i.length;o++){rA(t=i[o],e),E[r+4*o>>2]=e,e+=t.length+1}E[r+4*i.length>>2]=0}F+=16;var fr={};var nr={};var tr=1;function or(A){return A%4==0&&(A%100!=0||A%400==0)}function ar(A,e){for(var r=0,i=0;i<=e;r+=A[i++]);return r}var cr=[31,29,31,30,31,30,31,31,30,31,30,31],lr=[31,28,31,30,31,30,31,31,30,31,30,31];function ur(A,e){for(var r=new Date(A.getTime());0<e;){var i=or(r.getFullYear()),f=r.getMonth(),n=(i?cr:lr)[f];if(!(e>n-r.getDate()))return r.setDate(r.getDate()+e),r;e-=n-r.getDate()+1,r.setDate(1),f<11?r.setMonth(f+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}function sr(A,e,r,i){var f=E[i+40>>2],n={tm_sec:E[i>>2],tm_min:E[i+4>>2],tm_hour:E[i+8>>2],tm_mday:E[i+12>>2],tm_mon:E[i+16>>2],tm_year:E[i+20>>2],tm_wday:E[i+24>>2],tm_yday:E[i+28>>2],tm_isdst:E[i+32>>2],tm_gmtoff:E[i+36>>2],tm_zone:f?m(f):""},t=m(r),o={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var a in o)t=t.replace(new RegExp(a,"g"),o[a]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function u(A,e,r){for(var i="number"==typeof A?A.toString():A||"";i.length<e;)i=r[0]+i;return i}function s(A,e){return u(A,e,"0")}function b(A,e){function r(A){return A<0?-1:0<A?1:0}var i;return 0===(i=r(A.getFullYear()-e.getFullYear()))&&0===(i=r(A.getMonth()-e.getMonth()))&&(i=r(A.getDate()-e.getDate())),i}function d(A){switch(A.getDay()){case 0:return new Date(A.getFullYear()-1,11,29);case 1:return A;case 2:return new Date(A.getFullYear(),0,3);case 3:return new Date(A.getFullYear(),0,2);case 4:return new Date(A.getFullYear(),0,1);case 5:return new Date(A.getFullYear()-1,11,31);case 6:return new Date(A.getFullYear()-1,11,30)}}function k(A){var e=ur(new Date(A.tm_year+1900,0,1),A.tm_yday),r=new Date(e.getFullYear(),0,4),i=new Date(e.getFullYear()+1,0,4),f=d(r),n=d(i);return b(f,e)<=0?b(n,e)<=0?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var h={"%a":function(A){return c[A.tm_wday].substring(0,3)},"%A":function(A){return c[A.tm_wday]},"%b":function(A){return l[A.tm_mon].substring(0,3)},"%B":function(A){return l[A.tm_mon]},"%C":function(A){return s((A.tm_year+1900)/100|0,2)},"%d":function(A){return s(A.tm_mday,2)},"%e":function(A){return u(A.tm_mday,2," ")},"%g":function(A){return k(A).toString().substring(2)},"%G":function(A){return k(A)},"%H":function(A){return s(A.tm_hour,2)},"%I":function(A){var e=A.tm_hour;return 0==e?e=12:12<e&&(e-=12),s(e,2)},"%j":function(A){return s(A.tm_mday+ar(or(A.tm_year+1900)?cr:lr,A.tm_mon-1),3)},"%m":function(A){return s(A.tm_mon+1,2)},"%M":function(A){return s(A.tm_min,2)},"%n":function(){return"\\n"},"%p":function(A){return 0<=A.tm_hour&&A.tm_hour<12?"AM":"PM"},"%S":function(A){return s(A.tm_sec,2)},"%t":function(){return"\\t"},"%u":function(A){return new Date(A.tm_year+1900,A.tm_mon+1,A.tm_mday,0,0,0,0).getDay()||7},"%U":function(A){var e=new Date(A.tm_year+1900,0,1),r=0===e.getDay()?e:ur(e,7-e.getDay()),i=new Date(A.tm_year+1900,A.tm_mon,A.tm_mday);if(b(r,i)<0){var f=ar(or(i.getFullYear())?cr:lr,i.getMonth()-1)-31,n=31-r.getDate()+f+i.getDate();return s(Math.ceil(n/7),2)}return 0===b(r,e)?"01":"00"},"%V":function(A){var e,r=new Date(A.tm_year+1900,0,4),i=new Date(A.tm_year+1901,0,4),f=d(r),n=d(i),t=ur(new Date(A.tm_year+1900,0,1),A.tm_yday);return b(t,f)<0?"53":b(n,t)<=0?"01":(e=f.getFullYear()<A.tm_year+1900?A.tm_yday+32-f.getDate():A.tm_yday+1-f.getDate(),s(Math.ceil(e/7),2))},"%w":function(A){return new Date(A.tm_year+1900,A.tm_mon+1,A.tm_mday,0,0,0,0).getDay()},"%W":function(A){var e=new Date(A.tm_year,0,1),r=1===e.getDay()?e:ur(e,0===e.getDay()?1:7-e.getDay()+1),i=new Date(A.tm_year+1900,A.tm_mon,A.tm_mday);if(b(r,i)<0){var f=ar(or(i.getFullYear())?cr:lr,i.getMonth()-1)-31,n=31-r.getDate()+f+i.getDate();return s(Math.ceil(n/7),2)}return 0===b(r,e)?"01":"00"},"%y":function(A){return(A.tm_year+1900).toString().substring(2)},"%Y":function(A){return A.tm_year+1900},"%z":function(A){var e=A.tm_gmtoff,r=0<=e;return e=(e=Math.abs(e)/60)/60*100+e%60,(r?"+":"-")+String("0000"+e).slice(-4)},"%Z":function(A){return A.tm_zone},"%%":function(){return"%"}};for(var a in h)0<=t.indexOf(a)&&(t=t.replace(new RegExp(a,"g"),h[a](n)));var w=hr(t,!1);return w.length>e?0:(eA(w,A),w.length-1)}if(WA.staticInit(),L.unshift(function(){d.noFSInit||WA.init.initialized||WA.init()}),K.push(function(){WA.ignorePermissions=!1}),q.push(function(){WA.quit()}),d.FS_createFolder=WA.createFolder,d.FS_createPath=WA.createPath,d.FS_createDataFile=WA.createDataFile,d.FS_createPreloadedFile=WA.createPreloadedFile,d.FS_createLazyFile=WA.createLazyFile,d.FS_createLink=WA.createLink,d.FS_createDevice=WA.createDevice,d.FS_unlink=WA.unlink,L.unshift(function(){mA.init()}),q.push(function(){mA.shutdown()}),o){var br=void 0,dr=void 0;ZA.staticInit()}QA=d.InternalError=DA(Error,"InternalError"),UA(),xA=d.BindingError=DA(Error,"BindingError"),te(),Ge(),Ze(),Fe=d.UnboundTypeError=DA(Error,"UnboundTypeError"),He(),ir(fr),D=k.staticAlloc(4),Y=(R=k.alignMemory(F))+x,J=k.alignMemory(Y),E[D>>2]=J;var kr=!(N=!0);function hr(A,e,r){var i=0<r?r:p(A)+1,f=new Array(i),n=s(A,f,0,f.length);return e&&(f.length=n),f}function wr(A){for(var e=[],r=0;r<A.length;r++){var i=A[r];255<i&&(kr&&h(!1,"Character code "+i+" ("+String.fromCharCode(i)+")  at offset "+r+" not in 0x00-0xFF."),i&=255),e.push(String.fromCharCode(i))}return e.join("")}var vr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",gr="function"==typeof atob?atob:function(A){var e,r,i,f,n,t,o="",a=0;for(A=A.replace(/[^A-Za-z0-9\\+\\/\\=]/g,"");e=vr.indexOf(A.charAt(a++))<<2|(f=vr.indexOf(A.charAt(a++)))>>4,r=(15&f)<<4|(n=vr.indexOf(A.charAt(a++)))>>2,i=(3&n)<<6|(t=vr.indexOf(A.charAt(a++))),o+=String.fromCharCode(e),64!==n&&(o+=String.fromCharCode(r)),64!==t&&(o+=String.fromCharCode(i)),a<A.length;);return o};function mr(A){var e="data:application/octet-stream;base64,";if(String.prototype.startsWith?A.startsWith(e):0===A.indexOf(e))return function(e){if("boolean"==typeof o&&o){var r;try{r=Buffer.from(e,"base64")}catch(A){r=new Buffer(e,"base64")}return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}try{for(var A=gr(e),i=new Uint8Array(A.length),f=0;f<A.length;++f)i[f]=A.charCodeAt(f);return i}catch(A){throw new Error("Converting base64 string to bytes failed.")}}(A.slice(e.length))}d.asmGlobalArg={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0,byteLength:Q},d.asmLibraryArg={abort:Mr,assert:h,enlargeMemory:H,getTotalMemory:function(){return j},abortOnCannotGrowMemory:function(){Mr("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value "+j+", (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ")},invoke_i:function(A){try{return d.dynCall_i(A)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_ii:function(A,e){try{return d.dynCall_ii(A,e)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iii:function(A,e,r){try{return d.dynCall_iii(A,e,r)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiii:function(A,e,r,i){try{return d.dynCall_iiii(A,e,r,i)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiii:function(A,e,r,i,f){try{return d.dynCall_iiiii(A,e,r,i,f)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiiid:function(A,e,r,i,f,n){try{return d.dynCall_iiiiid(A,e,r,i,f,n)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiiii:function(A,e,r,i,f,n){try{return d.dynCall_iiiiii(A,e,r,i,f,n)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiiiid:function(A,e,r,i,f,n,t){try{return d.dynCall_iiiiiid(A,e,r,i,f,n,t)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiiiii:function(A,e,r,i,f,n,t){try{return d.dynCall_iiiiiii(A,e,r,i,f,n,t)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiiiiii:function(A,e,r,i,f,n,t,o){try{return d.dynCall_iiiiiiii(A,e,r,i,f,n,t,o)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_iiiiiiiii:function(A,e,r,i,f,n,t,o,a){try{return d.dynCall_iiiiiiiii(A,e,r,i,f,n,t,o,a)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_v:function(A){try{d.dynCall_v(A)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_vi:function(A,e){try{d.dynCall_vi(A,e)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_vii:function(A,e,r){try{d.dynCall_vii(A,e,r)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viii:function(A,e,r,i){try{d.dynCall_viii(A,e,r,i)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiii:function(A,e,r,i,f){try{d.dynCall_viiii(A,e,r,i,f)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiii:function(A,e,r,i,f,n){try{d.dynCall_viiiii(A,e,r,i,f,n)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiii:function(A,e,r,i,f,n,t){try{d.dynCall_viiiiii(A,e,r,i,f,n,t)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiiii:function(A,e,r,i,f,n,t,o){try{d.dynCall_viiiiiii(A,e,r,i,f,n,t,o)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiiiii:function(A,e,r,i,f,n,t,o,a){try{d.dynCall_viiiiiiii(A,e,r,i,f,n,t,o,a)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiiiiii:function(A,e,r,i,f,n,t,o,a,c){try{d.dynCall_viiiiiiiii(A,e,r,i,f,n,t,o,a,c)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiiiiiii:function(A,e,r,i,f,n,t,o,a,c,l){try{d.dynCall_viiiiiiiiii(A,e,r,i,f,n,t,o,a,c,l)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiiiiiiiii:function(A,e,r,i,f,n,t,o,a,c,l,u,s){try{d.dynCall_viiiiiiiiiiii(A,e,r,i,f,n,t,o,a,c,l,u,s)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},invoke_viiiiiiiiiiiii:function(A,e,r,i,f,n,t,o,a,c,l,u,s,b){try{d.dynCall_viiiiiiiiiiiii(A,e,r,i,f,n,t,o,a,c,l,u,s,b)}catch(A){if("number"!=typeof A&&"longjmp"!==A)throw A;d.setThrew(1,0)}},ClassHandle:oe,ClassHandle_clone:qA,ClassHandle_delete:Ae,ClassHandle_deleteLater:ne,ClassHandle_isAliasOf:PA,ClassHandle_isDeleted:ee,RegisteredClass:ue,RegisteredPointer:Ve,RegisteredPointer_deleteObject:ve,RegisteredPointer_destructor:we,RegisteredPointer_fromWireType:Ee,RegisteredPointer_getPointee:he,__ZSt18uncaught_exceptionv:dA,___assert_fail:function(A,e,r,i){throw n=!0,"Assertion failed: "+m(A)+", at: "+[e?m(e):"unknown filename",r,i?m(i):"unknown function"]+" at "+y()},___buildEnvironment:ir,___cxa_allocate_exception:function(A){return Xr(A)},___cxa_begin_catch:function(A){var e=kA.infos[A];return e&&!e.caught&&(e.caught=!0,dA.uncaught_exception--),e&&(e.rethrown=!1),kA.caught.push(A),kA.addRef(kA.deAdjust(A)),A},___cxa_find_matching_catch:function A(){var e=kA.last;if(!e)return 0|(k.setTempRet0(0),0);var r=kA.infos[e],i=r.type;if(!i)return 0|(k.setTempRet0(0),e);var f=Array.prototype.slice.call(arguments);d.___cxa_is_pointer_type(i);A.buffer||(A.buffer=Xr(4)),E[A.buffer>>2]=e,e=A.buffer;for(var n=0;n<f.length;n++)if(f[n]&&d.___cxa_can_catch(f[n],i,e))return e=E[e>>2],r.adjusted=e,0|(k.setTempRet0(f[n]),e);return e=E[e>>2],0|(k.setTempRet0(i),e)},___cxa_pure_virtual:function(){throw n=!0,"Pure virtual function called!"},___cxa_throw:function(A,e,r){throw kA.infos[A]={ptr:A,adjusted:A,type:e,destructor:r,refcount:0,caught:!1,rethrown:!1},kA.last=A,"uncaught_exception"in dA?dA.uncaught_exception++:dA.uncaught_exception=1,A+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."},___gxx_personality_v0:function(){},___lock:function(){},___map_file:function(A,e){return wA(hA.EPERM),-1},___resumeException:function(A){throw kA.last||(kA.last=A),A+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."},___setErrNo:wA,___syscall140:function(A,e){IA.varargs=e;try{var r=IA.getStreamFromFD(),i=(IA.get(),IA.get()),f=IA.get(),n=IA.get(),t=i;return WA.llseek(r,t,n),E[f>>2]=r.position,r.getdents&&0===t&&0===n&&(r.getdents=null),0}catch(A){return void 0!==WA&&A instanceof WA.ErrnoError||Mr(A),-A.errno}},___syscall145:function(A,e){IA.varargs=e;try{var r=IA.getStreamFromFD(),i=IA.get(),f=IA.get();return IA.doReadv(r,i,f)}catch(A){return void 0!==WA&&A instanceof WA.ErrnoError||Mr(A),-A.errno}},___syscall146:function(A,e){IA.varargs=e;try{var r=IA.getStreamFromFD(),i=IA.get(),f=IA.get();return IA.doWritev(r,i,f)}catch(A){return void 0!==WA&&A instanceof WA.ErrnoError||Mr(A),-A.errno}},___syscall54:function(A,e){IA.varargs=e;try{var r=IA.getStreamFromFD(),i=IA.get();switch(i){case 21505:case 21506:return r.tty?0:-hA.ENOTTY;case 21519:if(!r.tty)return-hA.ENOTTY;var f=IA.get();return E[f>>2]=0;case 21520:return r.tty?-hA.EINVAL:-hA.ENOTTY;case 21531:f=IA.get();return WA.ioctl(r,i,f);case 21523:return r.tty?0:-hA.ENOTTY;default:Mr("bad ioctl syscall "+i)}}catch(A){return void 0!==WA&&A instanceof WA.ErrnoError||Mr(A),-A.errno}},___syscall6:function(A,e){IA.varargs=e;try{var r=IA.getStreamFromFD();return WA.close(r),0}catch(A){return void 0!==WA&&A instanceof WA.ErrnoError||Mr(A),-A.errno}},___syscall91:function(A,e){IA.varargs=e;try{var r=IA.get(),i=IA.get(),f=IA.mappings[r];if(!f)return 0;if(i===f.len){var n=WA.getStream(f.fd);IA.doMsync(r,n,i,f.flags),WA.munmap(n),IA.mappings[r]=null,f.allocated&&Vr(f.malloc)}return 0}catch(A){return void 0!==WA&&A instanceof WA.ErrnoError||Mr(A),-A.errno}},___unlock:function(){},__addDays:ur,__arraySum:ar,__embind_finalize_value_object:function(A){var e=EA[A];delete EA[A];var f=e.rawConstructor,n=e.rawDestructor,u=e.fields;MA([A],u.map(function(A){return A.getterReturnType}).concat(u.map(function(A){return A.setterArgumentType})),function(c){var l={};return u.forEach(function(A,e){var r=A.fieldName,i=c[e],f=A.getter,n=A.getterContext,t=c[e+u.length],o=A.setter,a=A.setterContext;l[r]={read:function(A){return i.fromWireType(f(n,A))},write:function(A,e){var r=[];o(a,A,t.toWireType(r,e)),GA(r)}}}),[{name:e.name,fromWireType:function(A){var e={};for(var r in l)e[r]=l[r].read(A);return n(A),e},toWireType:function(A,e){for(var r in l)if(!(r in e))throw new TypeError("Missing field");var i=f();for(r in l)l[r].write(i,e[r]);return null!==A&&A.push(n,i),i},argPackAdvance:8,readValueFromPointer:VA,destructorFunction:n}]})},__embind_register_bool:function(A,r,i,f,n){var t=SA(i);zA(A,{name:r=HA(r),fromWireType:function(A){return!!A},toWireType:function(A,e){return e?f:n},argPackAdvance:8,readValueFromPointer:function(A){var e;if(1===i)e=C;else if(2===i)e=I;else{if(4!==i)throw new TypeError("Unknown boolean type size: "+r);e=E}return this.fromWireType(e[A>>t])},destructorFunction:null})},__embind_register_class:function(c,A,e,l,r,u,i,s,f,b,d,n,k){d=HA(d),u=_e(r,u),s=s&&_e(i,s),b=b&&_e(f,b),k=_e(n,k);var h=YA(d);le(h,function(){Re("Cannot construct "+d+" due to unbound types",[l])}),MA([c,A,e],l?[l]:[],function(A){var e,r;A=A[0],r=l?(e=A.registeredClass).instancePrototype:oe.prototype;var i=JA(h,function(){if(Object.getPrototypeOf(this)!==f)throw new xA("Use \'new\' to construct "+d);if(void 0===n.constructor_body)throw new xA(d+" has no accessible constructor");var A=n.constructor_body[arguments.length];if(void 0===A)throw new xA("Tried to invoke ctor of "+d+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(n.constructor_body).toString()+") parameters instead!");return A.apply(this,arguments)}),f=Object.create(r,{constructor:{value:i}});i.prototype=f;var n=new ue(d,i,f,k,e,u,s,b),t=new Ve(d,n,!0,!1,!1),o=new Ve(d+"*",n,!1,!1,!1),a=new Ve(d+" const*",n,!1,!0,!1);return ae[c]={pointerType:o,constPointerType:a},Xe(h,i),[t,o,a]})},__embind_register_class_class_function:function(A,n,t,e,r,o,a){var c=De(t,e);n=HA(n),o=_e(r,o),MA([],[A],function(A){var i=(A=A[0]).name+"."+n;function e(){Re("Cannot call "+i+" due to unbound types",c)}var f=A.registeredClass.constructor;return void 0===f[n]?(e.argCount=t-1,f[n]=e):(ce(f,n,i),f[n].overloadTable[t-1]=e),MA([],c,function(A){var e=[A[0],null].concat(A.slice(1)),r=Je(i,e,null,o,a);return void 0===f[n].overloadTable?f[n]=r:f[n].overloadTable[t-1]=r,[]}),[]})},__embind_register_class_class_property:function(A,i,f,n,e,t,o,a){i=HA(i),t=_e(e,t),MA([],[A],function(e){var r=(e=e[0]).name+"."+i,A={get:function(){Re("Cannot access "+r+" due to unbound types",[f])},enumerable:!0,configurable:!0};return A.set=a?function(){Re("Cannot access "+r+" due to unbound types",[f])}:function(A){jA(r+" is a read-only property")},Object.defineProperty(e.registeredClass.constructor,i,A),MA([],[f],function(r){r=r[0];var A={get:function(){return r.fromWireType(t(n))},enumerable:!0};return a&&(a=_e(o,a),A.set=function(A){var e=[];a(n,r.toWireType(e,A)),GA(e)}),Object.defineProperty(e.registeredClass.constructor,i,A),[]}),[]})},__embind_register_class_constructor:function(A,t,e,r,o,a){var i=De(t,e);o=_e(r,o),MA([],[A],function(A){var n="constructor "+(A=A[0]).name;if(void 0===A.registeredClass.constructor_body&&(A.registeredClass.constructor_body=[]),void 0!==A.registeredClass.constructor_body[t-1])throw new xA("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class \'"+A.name+"\'! Overload resolution is currently only performed using the parameter count, not actual type info!");return A.registeredClass.constructor_body[t-1]=function(){Re("Cannot construct "+A.name+" due to unbound types",i)},MA([],i,function(f){return A.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&jA(n+" called with "+arguments.length+" arguments, expected "+(t-1));var A=[],e=new Array(t);e[0]=a;for(var r=1;r<t;++r)e[r]=f[r].toWireType(A,arguments[r-1]);var i=o.apply(null,e);return GA(A),f[0].fromWireType(i)},[]}),[]})},__embind_register_class_function:function(A,n,t,e,r,o,a,c){var l=De(t,e);n=HA(n),o=_e(r,o),MA([],[A],function(r){var i=(r=r[0]).name+"."+n;function A(){Re("Cannot call "+i+" due to unbound types",l)}c&&r.registeredClass.pureVirtualFunctions.push(n);var f=r.registeredClass.instancePrototype,e=f[n];return void 0===e||void 0===e.overloadTable&&e.className!==r.name&&e.argCount===t-2?(A.argCount=t-2,A.className=r.name,f[n]=A):(ce(f,n,i),f[n].overloadTable[t-2]=A),MA([],l,function(A){var e=Je(i,A,r,o,a);return void 0===f[n].overloadTable?(e.argCount=t-2,f[n]=e):f[n].overloadTable[t-2]=e,[]}),[]})},__embind_register_class_property:function(A,t,e,r,o,a,i,c,l,u){t=HA(t),o=_e(r,o),MA([],[A],function(f){var n=(f=f[0]).name+"."+t,A={get:function(){Re("Cannot access "+n+" due to unbound types",[e,i])},enumerable:!0,configurable:!0};return A.set=l?function(){Re("Cannot access "+n+" due to unbound types",[e,i])}:function(A){jA(n+" is a read-only property")},Object.defineProperty(f.registeredClass.instancePrototype,t,A),MA([],l?[e,i]:[e],function(A){var e=A[0],r={get:function(){var A=Qe(this,f,n+" getter");return e.fromWireType(o(a,A))},enumerable:!0};if(l){l=_e(c,l);var i=A[1];r.set=function(A){var e=Qe(this,f,n+" setter"),r=[];l(u,e,i.toWireType(r,A)),GA(r)}}return Object.defineProperty(f.registeredClass.instancePrototype,t,r),[]}),[]})},__embind_register_emval:function(A,e){zA(A,{name:e=HA(e),fromWireType:function(A){var e=Me[A].value;return Se(A),e},toWireType:function(A,e){return xe(e)},argPackAdvance:8,readValueFromPointer:VA,destructorFunction:null})},__embind_register_enum:function(A,e,r,i){var f=SA(r);function n(){}e=HA(e),n.values={},zA(A,{name:e,constructor:n,fromWireType:function(A){return this.constructor.values[A]},toWireType:function(A,e){return e.value},argPackAdvance:8,readValueFromPointer:je(e,f,i),destructorFunction:null}),le(e,n)},__embind_register_enum_value:function(A,e,r){var i=ze(A,"enum");e=HA(e);var f=i.constructor,n=Object.create(i.constructor.prototype,{value:{value:r},constructor:{value:JA(i.name+"_"+e,function(){})}});f.values[r]=n,f[e]=n},__embind_register_float:function(A,e,r){var i=SA(r);zA(A,{name:e=HA(e),fromWireType:function(A){return A},toWireType:function(A,e){if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError(\'Cannot convert "\'+Pe(e)+\'" to \'+this.name);return e},argPackAdvance:8,readValueFromPointer:Le(e,i),destructorFunction:null})},__embind_register_function:function(r,i,A,e,f,n){var t=De(i,A);r=HA(r),f=_e(e,f),le(r,function(){Re("Cannot call "+r+" due to unbound types",t)},i-1),MA([],t,function(A){var e=[A[0],null].concat(A.slice(1));return Xe(r,Je(r,e,null,f,n),i-1),[]})},__embind_register_integer:function(A,r,e,i,f){r=HA(r),-1===f&&(f=4294967295);var n=SA(e),t=function(A){return A};if(0===i){var o=32-8*e;t=function(A){return A<<o>>>o}}var a=-1!=r.indexOf("unsigned");zA(A,{name:r,fromWireType:t,toWireType:function(A,e){if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError(\'Cannot convert "\'+Pe(e)+\'" to \'+this.name);if(e<i||f<e)throw new TypeError(\'Passing a number "\'+Pe(e)+\'" from JS side to C/C++ side to an argument of type "\'+r+\'", which is outside the valid range [\'+i+", "+f+"]!");return a?e>>>0:0|e},argPackAdvance:8,readValueFromPointer:Ke(r,n,0!==i),destructorFunction:null})},__embind_register_memory_view:function(A,e,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function f(A){var e=G[A>>=2],r=G[A+1];return new i(G.buffer,r,e)}zA(A,{name:r=HA(r),fromWireType:f,argPackAdvance:8,readValueFromPointer:f},{ignoreDuplicateRegistrations:!0})},__embind_register_smart_ptr:function(A,e,r,i,f,n,t,o,a,c,l,u){r=HA(r),n=_e(f,n),o=_e(t,o),c=_e(a,c),u=_e(l,u),MA([A],[e],function(A){return A=A[0],[new Ve(r,A.registeredClass,!1,!1,!0,A,i,n,o,c,u)]})},__embind_register_std_string:function(A,e){zA(A,{name:e=HA(e),fromWireType:function(A){for(var e=G[A>>2],r=new Array(e),i=0;i<e;++i)r[i]=String.fromCharCode(W[A+4+i]);return Vr(A),r.join("")},toWireType:function(A,e){function r(A,e){return A[e]}var i;e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array?i=r:"string"==typeof e?i=function(A,e){return A.charCodeAt(e)}:jA("Cannot pass non-string to std::string");var f=e.length,n=Xr(4+f);G[n>>2]=f;for(var t=0;t<f;++t){var o=i(e,t);255<o&&(Vr(n),jA("String has UTF-16 code units that do not fit in 8 bits")),W[n+4+t]=o}return null!==A&&A.push(Vr,n),n},argPackAdvance:8,readValueFromPointer:VA,destructorFunction:function(A){Vr(A)}})},__embind_register_std_wstring:function(A,o,e){var a,c;e=HA(e),2===o?(a=function(){return B},c=1):4===o&&(a=function(){return G},c=2),zA(A,{name:e,fromWireType:function(A){for(var e=a(),r=G[A>>2],i=new Array(r),f=A+4>>c,n=0;n<r;++n)i[n]=String.fromCharCode(e[f+n]);return Vr(A),i.join("")},toWireType:function(A,e){var r=a(),i=e.length,f=Xr(4+i*o);G[f>>2]=i;for(var n=f+4>>c,t=0;t<i;++t)r[n+t]=e.charCodeAt(t);return null!==A&&A.push(Vr,f),f},argPackAdvance:8,readValueFromPointer:VA,destructorFunction:function(A){Vr(A)}})},__embind_register_value_object:function(A,e,r,i,f,n){EA[A]={name:HA(e),rawConstructor:_e(r,i),rawDestructor:_e(f,n),fields:[]}},__embind_register_value_object_field:function(A,e,r,i,f,n,t,o,a,c){EA[A].fields.push({fieldName:HA(e),getterReturnType:r,getter:_e(i,f),getterContext:n,setterArgumentType:t,setter:_e(o,a),setterContext:c})},__embind_register_void:function(A,e){zA(A,{isVoid:!0,name:e=HA(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(A,e){}})},__emval_call:function(A,e,r,i){A=$e(A);for(var f=qe(e,r),n=new Array(e),t=0;t<e;++t){var o=f[t];n[t]=o.readValueFromPointer(i),i+=o.argPackAdvance}return xe(A.apply(void 0,n))},__emval_decref:Se,__emval_incref:function(A){4<A&&(Me[A].refcount+=1)},__emval_lookupTypes:qe,__emval_new_cstring:function(A){return xe(er(A))},__emval_new_object:function(){return xe({})},__emval_register:xe,__emval_set_property:function(A,e,r){A=$e(A),e=$e(e),r=$e(r),A[e]=r},__emval_take_value:function(A,e){return xe((A=ze(A,"_emval_take_value")).readValueFromPointer(e))},__isLeapYear:or,_abort:function(){d.abort()},_embind_repr:Pe,_emscripten_memcpy_big:function(A,e,r){return W.set(W.subarray(e,e+r),A),A},_getenv:function A(e){return 0===e?0:(e=m(e),fr.hasOwnProperty(e)?(A.ret&&Vr(A.ret),A.ret=a(hr(fr[e]),"i8",t)):0)},_pthread_cond_destroy:function(){return 0},_pthread_cond_init:function(){return 0},_pthread_cond_signal:function(){return 0},_pthread_cond_wait:function(){return 0},_pthread_getspecific:function(A){return nr[A]||0},_pthread_join:function(){},_pthread_key_create:function(A,e){return 0==A?hA.EINVAL:(E[A>>2]=tr,nr[tr]=0,tr++,0)},_pthread_mutex_destroy:function(){},_pthread_mutex_init:function(){},_pthread_once:function A(e,r){A.seen||(A.seen={}),e in A.seen||(d.dynCall_v(r),A.seen[e]=1)},_pthread_setspecific:function(A,e){return A in nr?(nr[A]=e,0):hA.EINVAL},_strftime:sr,_strftime_l:function(A,e,r,i){return sr(A,e,r,i)},constNoSmartPtrRawPointerToWireType:be,count_emval_handles:Ue,craftInvokerFunction:Je,createNamedFunction:JA,downcastPointer:ge,embind_init_charCodes:UA,ensureOverloadTable:ce,enumReadValueFromPointer:je,exposePublicSymbol:le,extendError:DA,floatReadValueFromPointer:Le,flushPendingDeletes:fe,genericPointerToWireType:de,getBasestPointer:We,getInheritedInstance:Ie,getInheritedInstanceCount:me,getLiveInheritedInstances:pe,getShiftFromSize:SA,getStringOrSymbol:er,getTypeName:Ne,get_first_emval:Oe,heap32VectorToArray:De,init_ClassHandle:te,init_RegisteredPointer:Ge,init_embind:Ze,init_emval:He,integerReadValueFromPointer:Ke,makeClassHandle:Be,makeLegalFunctionName:YA,new_:Ye,nonConstNoSmartPtrRawPointerToWireType:ke,readLatin1String:HA,registerType:zA,replacePublicSymbol:Xe,requireFunction:_e,requireHandle:$e,requireRegisteredType:ze,runDestructor:$A,runDestructors:GA,setDelayFunction:ye,shallowCopyInternalPointer:LA,simpleReadValueFromPointer:VA,throwBindingError:jA,throwInstanceAlreadyDeleted:KA,throwInternalError:TA,throwUnboundTypeError:Re,upcastPointer:se,validateThis:Qe,whenDependentTypesAreResolved:MA,DYNAMICTOP_PTR:D,tempDoublePtr:bA,ABORT:n,STACKTOP:R,STACK_MAX:Y,cttz_i8:BA};var pr,yr=function(A,e,r){var i=A.Int8Array,tr=new i(r),f=A.Int16Array,or=new f(r),n=A.Int32Array,ar=new n(r),t=A.Uint8Array,cr=new t(r),o=A.Uint16Array,lr=new o(r),a=A.Uint32Array,c=(new a(r),A.Float32Array),Y=new c(r),l=A.Float64Array,J=new l(r),u=A.byteLength,s=0|e.DYNAMICTOP_PTR,d=0|e.tempDoublePtr,ur=(e.ABORT,0|e.STACKTOP),b=(e.STACK_MAX,0|e.cttz_i8),k=0,h=A.NaN,w=A.Infinity,D=0,X=(A.Math.floor,A.Math.abs),sr=(A.Math.sqrt,A.Math.pow,A.Math.cos,A.Math.sin,A.Math.tan,A.Math.acos,A.Math.asin,A.Math.atan,A.Math.atan2,A.Math.exp,A.Math.log,A.Math.ceil,A.Math.imul),v=(A.Math.min,A.Math.max,A.Math.clz32),g=e.abort,m=(e.assert,e.enlargeMemory),p=e.getTotalMemory,y=e.abortOnCannotGrowMemory,Z=(e.invoke_i,e.invoke_ii,e.invoke_iii,e.invoke_iiii,e.invoke_iiiii,e.invoke_iiiiid,e.invoke_iiiiii,e.invoke_iiiiiid,e.invoke_iiiiiii,e.invoke_iiiiiiii,e.invoke_iiiiiiiii,e.invoke_v,e.invoke_vi,e.invoke_vii,e.invoke_viii,e.invoke_viiii,e.invoke_viiiii,e.invoke_viiiiii,e.invoke_viiiiiii,e.invoke_viiiiiiii,e.invoke_viiiiiiiii,e.invoke_viiiiiiiiii,e.invoke_viiiiiiiiiiii,e.invoke_viiiiiiiiiiiii,e.ClassHandle,e.ClassHandle_clone,e.ClassHandle_delete,e.ClassHandle_deleteLater,e.ClassHandle_isAliasOf,e.ClassHandle_isDeleted,e.RegisteredClass,e.RegisteredPointer,e.RegisteredPointer_deleteObject,e.RegisteredPointer_destructor,e.RegisteredPointer_fromWireType,e.RegisteredPointer_getPointee,e.__ZSt18uncaught_exceptionv),br=e.___assert_fail,C=(e.___buildEnvironment,e.___cxa_allocate_exception),W=(e.___cxa_begin_catch,e.___cxa_find_matching_catch,e.___cxa_pure_virtual),I=e.___cxa_throw,B=(e.___gxx_personality_v0,e.___lock),E=e.___map_file,G=(e.___resumeException,e.___setErrNo),V=e.___syscall140,_=e.___syscall145,F=e.___syscall146,N=e.___syscall54,R=e.___syscall6,Q=e.___syscall91,T=e.___unlock,M=(e.__addDays,e.__arraySum,e.__embind_finalize_value_object),S=e.__embind_register_bool,U=e.__embind_register_class,O=e.__embind_register_class_class_function,H=e.__embind_register_class_class_property,x=e.__embind_register_class_constructor,j=e.__embind_register_class_function,z=e.__embind_register_class_property,P=e.__embind_register_emval,L=e.__embind_register_enum,K=e.__embind_register_enum_value,q=e.__embind_register_float,$=e.__embind_register_function,AA=e.__embind_register_integer,eA=e.__embind_register_memory_view,rA=e.__embind_register_smart_ptr,iA=e.__embind_register_std_string,fA=e.__embind_register_std_wstring,nA=e.__embind_register_value_object,tA=e.__embind_register_value_object_field,oA=e.__embind_register_void,aA=e.__emval_call,cA=e.__emval_decref,lA=e.__emval_incref,uA=(e.__emval_lookupTypes,e.__emval_new_cstring),sA=e.__emval_new_object,bA=(e.__emval_register,e.__emval_set_property),dA=e.__emval_take_value,kA=(e.__isLeapYear,e._abort),hA=(e._embind_repr,e._emscripten_memcpy_big),wA=e._getenv,vA=e._pthread_cond_destroy,gA=e._pthread_cond_init,mA=e._pthread_cond_signal,pA=e._pthread_cond_wait,yA=e._pthread_getspecific,ZA=e._pthread_join,CA=e._pthread_key_create,WA=e._pthread_mutex_destroy,IA=e._pthread_mutex_init,BA=e._pthread_once,EA=e._pthread_setspecific,GA=(e._strftime,e._strftime_l);e.constNoSmartPtrRawPointerToWireType,e.count_emval_handles,e.craftInvokerFunction,e.createNamedFunction,e.downcastPointer,e.embind_init_charCodes,e.ensureOverloadTable,e.enumReadValueFromPointer,e.exposePublicSymbol,e.extendError,e.floatReadValueFromPointer,e.flushPendingDeletes,e.genericPointerToWireType,e.getBasestPointer,e.getInheritedInstance,e.getInheritedInstanceCount,e.getLiveInheritedInstances,e.getShiftFromSize,e.getStringOrSymbol,e.getTypeName,e.get_first_emval,e.heap32VectorToArray,e.init_ClassHandle,e.init_RegisteredPointer,e.init_embind,e.init_emval,e.integerReadValueFromPointer,e.makeClassHandle,e.makeLegalFunctionName,e.new_,e.nonConstNoSmartPtrRawPointerToWireType,e.readLatin1String,e.registerType,e.replacePublicSymbol,e.requireFunction,e.requireHandle,e.requireRegisteredType,e.runDestructor,e.runDestructors,e.setDelayFunction,e.shallowCopyInternalPointer,e.simpleReadValueFromPointer,e.throwBindingError,e.throwInstanceAlreadyDeleted,e.throwInternalError,e.throwUnboundTypeError,e.upcastPointer,e.validateThis,e.whenDependentTypesAreResolved;function VA(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;switch(l=ur=(s=ur)+31&-32,ur=ur+16|0,u=0|bf(t|=0,52536),c=0|bf(t,52552),ks[63&ar[20+(0|ar[c>>2])>>2]](l,c),ar[n>>2]=i,(t=0|tr[A>>0])<<24>>24){case 43:case 45:v=0|fs[63&ar[28+(0|ar[u>>2])>>2]](u,t),b=0|ar[n>>2],ar[n>>2]=b+1,tr[b>>0]=v,b=A+1|0;break;default:b=A}v=r;A:do{if(1<(v-b|0)&&48==(0|tr[b>>0])){switch(0|tr[(t=b+1|0)>>0]){case 88:case 120:break;default:t=b,g=10;break A}for(h=0|fs[63&ar[28+(0|ar[u>>2])>>2]](u,48),w=0|ar[n>>2],ar[n>>2]=w+1,tr[w>>0]=h,b=b+2|0,w=0|fs[63&ar[28+(0|ar[u>>2])>>2]](u,0|tr[t>>0]),t=0|ar[n>>2],ar[n>>2]=t+1,tr[t>>0]=w,t=b;;){if(r>>>0<=t>>>0)break A;if(!(0|oi(w=0|tr[t>>0],hf())))break A;t=t+1|0}}else t=b,g=10}while(0);A:do{if(10==(0|g))for(;;){if(r>>>(g=0)<=t>>>0)break A;if(!(0|ni(w=0|tr[t>>0],hf())))break A;t=t+1|0,g=10}}while(0);k=0|tr[(o=11+l|0)>>0],a=4+l|0,h=b,w=A;A:do{if(0|(k<<24>>24<0?0|ar[a>>2]:255&k)){e:do{if((0|b)!=(0|t))for(A=t,d=b;;){if((A=A+-1|0)>>>0<=d>>>0)break e;k=0|tr[d>>0],tr[d>>0]=0|tr[A>>0],tr[A>>0]=k,d=d+1|0}}while(0);for(k=0|is[127&ar[16+(0|ar[c>>2])>>2]](c),A=d=0;!(t>>>0<=b>>>0);)0<(m=0|tr[((0|tr[o>>0])<0?0|ar[l>>2]:l)+A>>0])<<24>>24&(0|d)==(m<<24>>24|0)&&(d=0|ar[n>>2],ar[n>>2]=d+1,tr[d>>0]=k,A=(A>>>0<(((d=0|tr[o>>0])<<24>>24<0?0|ar[a>>2]:255&d)-1|0)>>>0&1)+A|0,d=0),p=0|fs[63&ar[28+(0|ar[u>>2])>>2]](u,0|tr[b>>0]),m=0|ar[n>>2],ar[n>>2]=m+1,tr[m>>0]=p,b=b+1|0,d=d+1|0;if((0|(A=i+(h-w)|0))==(0|(b=0|ar[n>>2])))A=u;else for(;;){if((b=b+-1|0)>>>0<=A>>>0){A=u;break A}p=0|tr[A>>0],tr[A>>0]=0|tr[b>>0],tr[b>>0]=p,A=A+1|0}}else ts[15&ar[32+(0|ar[u>>2])>>2]](u,b,t,0|ar[n>>2]),ar[n>>2]=(0|ar[n>>2])+(t-h),A=u}while(0);for(;!(r>>>0<=t>>>0);){if(b=0|tr[t>>0],t=t+1|0,b<<24>>24==46){g=29;break}m=0|fs[63&ar[28+(0|ar[A>>2])>>2]](u,b),p=0|ar[n>>2],ar[n>>2]=p+1,tr[p>>0]=m}29==(0|g)&&(m=0|is[127&ar[12+(0|ar[c>>2])>>2]](c),p=0|ar[n>>2],ar[n>>2]=p+1,tr[p>>0]=m),ts[15&ar[32+(0|ar[u>>2])>>2]](u,t,r,0|ar[n>>2]),p=(0|ar[n>>2])+(v-t)|0,ar[n>>2]=p,ar[f>>2]=(0|e)==(0|r)?p:i+(e-w)|0,Yl(l),ur=s}function XA(A,e,r,i){A|=0,e|=0,r|=0;var f=0;for(2048&(i|=0)&&(tr[A>>0]=43,A=A+1|0),f=512&i?(tr[A>>0]=35,A+1|0):A;(A=0|tr[e>>0])<<24>>24;)tr[f>>0]=A,e=e+1|0,f=f+1|0;switch(74&i){case 64:A=111;break;case 8:A=16384&i|0?88:120;break;default:A=r?100:117}tr[f>>0]=A}function _A(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0;if(u=ur=(s=ur)+31&-32,ur=ur+16|0,c=0|bf(t|=0,52536),d=0|bf(t,52552),ks[63&ar[20+(0|ar[d>>2])>>2]](u,d),a=4+u|0,l=A,b=r,0|((k=0|tr[(o=11+u|0)>>0])<<24>>24<0?0|ar[a>>2]:255&k)){switch(ar[n>>2]=i,(t=0|tr[A>>0])<<24>>24){case 43:case 45:t=0|fs[63&ar[28+(0|ar[c>>2])>>2]](c,t),k=0|ar[n>>2],ar[n>>2]=k+1,tr[k>>0]=t,A=A+1|0}A:do{if(1<(b-A|0)&&48==(0|tr[A>>0])){switch(0|tr[(t=A+1|0)>>0]){case 88:case 120:break;default:break A}k=0|fs[63&ar[28+(0|ar[c>>2])>>2]](c,48),b=0|ar[n>>2],ar[n>>2]=b+1,tr[b>>0]=k,b=0|fs[63&ar[28+(0|ar[c>>2])>>2]](c,0|tr[t>>0]),k=0|ar[n>>2],ar[n>>2]=k+1,tr[k>>0]=b,A=A+2|0}}while(0);A:do{if((0|A)!=(0|r))for(t=r,b=A;;){if((t=t+-1|0)>>>0<=b>>>0)break A;k=0|tr[b>>0],tr[b>>0]=0|tr[t>>0],tr[t>>0]=k,b=b+1|0}}while(0);for(k=0|is[127&ar[16+(0|ar[d>>2])>>2]](d),d=A,b=t=0;!(r>>>0<=d>>>0);)(h=0|tr[((0|tr[o>>0])<0?0|ar[u>>2]:u)+t>>0])<<24>>24!=0&(0|b)==(h<<24>>24|0)&&(b=0|ar[n>>2],ar[n>>2]=b+1,tr[b>>0]=k,t=(t>>>0<(((b=0|tr[o>>0])<<24>>24<0?0|ar[a>>2]:255&b)-1|0)>>>0&1)+t|0,b=0),w=0|fs[63&ar[28+(0|ar[c>>2])>>2]](c,0|tr[d>>0]),h=0|ar[n>>2],ar[n>>2]=h+1,tr[h>>0]=w,d=d+1|0,b=b+1|0;if((0|(t=i+(A-l)|0))!=(0|(A=0|ar[n>>2]))){for(;!((A=A+-1|0)>>>0<=t>>>0);)w=0|tr[t>>0],tr[t>>0]=0|tr[A>>0],tr[A>>0]=w,t=t+1|0;t=0|ar[n>>2]}}else ts[15&ar[32+(0|ar[c>>2])>>2]](c,A,r,i),t=i+(b-l)|0,ar[n>>2]=t;ar[f>>2]=(0|e)==(0|r)?t:i+(e-l)|0,Yl(u),ur=s}function FA(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0;o=ur=(a=ur)+31&-32,ur=ur+16|0,t=12+o|0,c=0|ar[(A|=0)>>2];A:do{if(c){if(l=(0|(l=i-(h=e)>>2))<(0|(u=0|ar[(s=f+12|0)>>2]))?u-l|0:0,f=(h=(u=r)-h|0)>>2,0<(0|h)&&(0|ns[63&ar[48+(0|ar[c>>2])>>2]](c,e,f))!=(0|f)){c=ar[A>>2]=0;break}do{if(0<(0|l)){ar[o>>2]=0,ar[4+o>>2]=0,1073741807<l>>>(ar[8+o>>2]=0)&&Nl();do{if(2<=l>>>0){if(!(1073741823<(f=l+4&2147483644)>>>0)){b=0|El(f<<2),ar[o>>2]=b,ar[(d=8+o|0)>>2]=-2147483648|f,ar[4+o>>2]=l,d=d+3|0,k=o;break}kA()}else tr[(d=8+o+3|0)>>0]=l,k=b=o}while(0);if(NA(b,l,n),sf(b+(l<<2)|(ar[t>>2]=0),t),(0|ns[63&ar[48+(0|ar[c>>2])>>2]](c,(0|tr[d>>0])<0?0|ar[o>>2]:k,l))==(0|l)){Pl(o);break}ar[A>>2]=0,Pl(o),c=0;break A}}while(0);if(i=(h=i-u|0)>>2,0<(0|h)&&(0|ns[63&ar[48+(0|ar[c>>2])>>2]](c,r,i))!=(0|i)){c=ar[A>>2]=0;break}ar[s>>2]=0}else c=0}while(0);return ur=a,0|c}function NA(A,e,r){return A|=0,r|=0,(e|=0)&&function(A,e,r){A|=0,e|=0;var i=0;if(0|(r|=0))for(i=A;r=r+-1|0,ar[i>>2]=e,r;)i=i+4|0}(A,r,e),0|A}function RA(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0;switch(l=ur=(s=ur)+31&-32,ur=ur+16|0,u=0|bf(t|=0,52568),c=0|bf(t,52576),ks[63&ar[20+(0|ar[c>>2])>>2]](l,c),ar[n>>2]=i,(t=0|tr[A>>0])<<24>>24){case 43:case 45:m=0|fs[63&ar[44+(0|ar[u>>2])>>2]](u,t),t=0|ar[n>>2],ar[n>>2]=t+4,ar[t>>2]=m,t=A+1|0;break;default:t=A}m=r;A:do{if(1<(m-t|0)&&48==(0|tr[t>>0])){switch(0|tr[(b=t+1|0)>>0]){case 88:case 120:break;default:b=t,p=10;break A}for(v=0|fs[63&ar[44+(0|ar[u>>2])>>2]](u,48),g=0|ar[n>>2],ar[n>>2]=g+4,ar[g>>2]=v,t=t+2|0,g=0|fs[63&ar[44+(0|ar[u>>2])>>2]](u,0|tr[b>>0]),b=0|ar[n>>2],ar[n>>2]=b+4,ar[b>>2]=g,b=t;;){if(r>>>0<=b>>>0)break A;if(!(0|oi(g=0|tr[b>>0],hf())))break A;b=b+1|0}}else b=t,p=10}while(0);A:do{if(10==(0|p))for(;;){if(r>>>(p=0)<=b>>>0)break A;if(!(0|ni(g=0|tr[b>>0],hf())))break A;b=b+1|0,p=10}}while(0);w=0|tr[(o=11+l|0)>>0],a=4+l|0,v=t,g=A;A:do{if(0|(w<<24>>24<0?0|ar[a>>2]:255&w)){e:do{if((0|t)!=(0|b))for(A=b,d=t;;){if((A=A+-1|0)>>>0<=d>>>0)break e;w=0|tr[d>>0],tr[d>>0]=0|tr[A>>0],tr[A>>0]=w,d=d+1|0}}while(0);for(w=0|is[127&ar[16+(0|ar[c>>2])>>2]](c),d=A=0;!(b>>>0<=t>>>0);)k=0|tr[o>>0],0<(y=0|tr[((h=k<<24>>24<0)?0|ar[l>>2]:l)+A>>0])<<24>>24&(0|d)==(y<<24>>24|0)&&(d=0|ar[n>>2],ar[n>>2]=d+4,ar[d>>2]=w,A=(A>>>0<((h?0|ar[a>>2]:255&k)-1|0)>>>0&1)+A|0,d=0),h=0|fs[63&ar[44+(0|ar[u>>2])>>2]](u,0|tr[t>>0]),y=0|ar[n>>2],ar[n>>2]=y+4,ar[y>>2]=h,t=t+1|0,d=d+1|0;if((0|(t=i+(v-g<<2)|0))==(0|(d=0|ar[n>>2])))A=u;else for(A=d;;){if((A=A+-4|0)>>>0<=t>>>0){A=u,t=d;break A}y=0|ar[t>>2],ar[t>>2]=ar[A>>2],ar[A>>2]=y,t=t+4|0}}else ts[15&ar[48+(0|ar[u>>2])>>2]](u,t,b,0|ar[n>>2]),t=(0|ar[n>>2])+(b-v<<2)|0,ar[n>>2]=t,A=u}while(0);for(;!(r>>>0<=b>>>0);){if(t=0|tr[b>>0],b=b+1|0,t<<24>>24==46){p=29;break}v=0|fs[63&ar[44+(0|ar[A>>2])>>2]](u,t),t=(y=0|ar[n>>2])+4|0,ar[n>>2]=t,ar[y>>2]=v}29==(0|p)&&(p=0|is[127&ar[12+(0|ar[c>>2])>>2]](c),t=(y=0|ar[n>>2])+4|0,ar[n>>2]=t,ar[y>>2]=p),ts[15&ar[48+(0|ar[u>>2])>>2]](u,b,r,t),y=(0|ar[n>>2])+(m-b<<2)|0,ar[n>>2]=y,ar[f>>2]=(0|e)==(0|r)?y:i+(e-g<<2)|0,Yl(l),ur=s}function YA(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0,v=0;if(u=ur=(s=ur)+31&-32,ur=ur+16|0,c=0|bf(t|=0,52568),d=0|bf(t,52576),ks[63&ar[20+(0|ar[d>>2])>>2]](u,d),a=4+u|0,l=A,b=r,0|((w=0|tr[(o=11+u|0)>>0])<<24>>24<0?0|ar[a>>2]:255&w)){switch(ar[n>>2]=i,(t=0|tr[A>>0])<<24>>24){case 43:case 45:h=0|fs[63&ar[44+(0|ar[c>>2])>>2]](c,t),w=0|ar[n>>2],ar[n>>2]=w+4,ar[w>>2]=h,A=A+1|0}A:do{if(1<(b-A|0)&&48==(0|tr[A>>0])){switch(0|tr[(t=A+1|0)>>0]){case 88:case 120:break;default:break A}w=0|fs[63&ar[44+(0|ar[c>>2])>>2]](c,48),h=0|ar[n>>2],ar[n>>2]=h+4,ar[h>>2]=w,h=0|fs[63&ar[44+(0|ar[c>>2])>>2]](c,0|tr[t>>0]),w=0|ar[n>>2],ar[n>>2]=w+4,ar[w>>2]=h,A=A+2|0}}while(0);A:do{if((0|A)!=(0|r))for(t=r,b=A;;){if((t=t+-1|0)>>>0<=b>>>0)break A;w=0|tr[b>>0],tr[b>>0]=0|tr[t>>0],tr[t>>0]=w,b=b+1|0}}while(0);for(w=0|is[127&ar[16+(0|ar[d>>2])>>2]](d),h=A,b=t=0;!(r>>>0<=h>>>0);)d=0|tr[o>>0],(v=0|tr[((k=d<<24>>24<0)?0|ar[u>>2]:u)+t>>0])<<24>>24!=0&(0|b)==(v<<24>>24|0)&&(b=0|ar[n>>2],ar[n>>2]=b+4,ar[b>>2]=w,t=(t>>>0<((k?0|ar[a>>2]:255&d)-1|0)>>>0&1)+t|0,b=0),k=0|fs[63&ar[44+(0|ar[c>>2])>>2]](c,0|tr[h>>0]),v=0|ar[n>>2],ar[n>>2]=v+4,ar[v>>2]=k,h=h+1|0,b=b+1|0;if((0|(t=i+(A-l<<2)|0))!=(0|(A=0|ar[n>>2]))){for(;!((A=A+-4|0)>>>0<=t>>>0);)v=0|ar[t>>2],ar[t>>2]=ar[A>>2],ar[A>>2]=v,t=t+4|0;t=0|ar[n>>2]}}else ts[15&ar[48+(0|ar[c>>2])>>2]](c,A,r,i),t=i+(b-l<<2)|0,ar[n>>2]=t;ar[f>>2]=(0|e)==(0|r)?t:i+(e-l<<2)|0,Yl(u),ur=s}function JA(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a;a=ur=(t=ur)+31&-32,ur=ur+16|0,o=4+a|0,A=0|is[127&ar[ar[(A=(A|=0)+8|0)>>2]>>2]](A),ar[a>>2]=ar[i>>2],ar[o>>2]=ar[a>>2],(0|(A=(0|Ff(r,o,A,A+168|0,n,f,0))-A|0))<168&&(ar[e>>2]=((0|A)/12|0)%7|0),ur=t}function DA(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a;a=ur=(t=ur)+31&-32,ur=ur+16|0,o=4+a|0,A=0|is[127&ar[4+(0|ar[(A=(A|=0)+8|0)>>2])>>2]](A),ar[a>>2]=ar[i>>2],ar[o>>2]=ar[a>>2],(0|(A=(0|Ff(r,o,A,A+288|0,n,f,0))-A|0))<288&&(ar[e>>2]=((0|A)/12|0)%12|0),ur=t}function QA(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;b=ur=(d=ur)+31&-32,ur=ur+16|0,a=8+b|0,s=4+b|0,Di(c=12+b|0,i|=0),l=0|bf(c,52536),df(c),u=8+l|(ar[f>>2]=0),k=0;A:for(;;){for(p=(0|t)!=(0|o),h=k;;){if(k=0|ar[e>>2],!(p&0==(0|h)))break A;m=(w=k)?0|Ji(h=(0|(h=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[h>>0]),-1)?(g=1,k=ar[e>>2]=0):(g=0,w):(k=0,g=1,w),h=v=0|ar[r>>2];do{if(v){if(0|Ji(w=(0|(w=0|ar[v+12>>2]))==(0|ar[v+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](v):0|bi(0|tr[w>>0]),-1)){h=ar[r>>2]=0,Z=16;break}if(g)break;Z=61;break A}Z=16}while(0);if(16==(0|Z)){if(Z=0,g){Z=61;break A}v=0}if((0|ns[63&ar[36+(0|ar[l>>2])>>2]](l,0|tr[t>>0],0))<<24>>24==37){Z=19;break}if(-1<(h=0|tr[t>>0])<<24>>24&&(y=0|ar[u>>2],8192&or[y+(h<<24>>24<<1)>>1])){Z=27;break}if(h=(0|(h=0|ar[(w=k+12|0)>>2]))==(0|ar[(v=k+16|0)>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[h>>0]),(m=0|fs[63&ar[12+(0|ar[l>>2])>>2]](l,255&h))<<24>>24==(0|fs[63&ar[12+(0|ar[l>>2])>>2]](l,0|tr[t>>0]))<<24>>24){Z=57;break}h=ar[f>>2]=4}e:do{if(19==(0|Z)){if(((Z=0)|(g=t+1|0))==(0|o)){Z=61;break A}switch((w=0|ns[63&ar[36+(0|ar[l>>2])>>2]](l,0|tr[g>>0],0))<<24>>24){case 48:case 69:if((0|(t=t+2|0))==(0|o)){Z=61;break A}v=w,k=0|ns[63&ar[36+(0|ar[l>>2])>>2]](l,0|tr[t>>0],0),t=g;break;default:v=0,k=w}p=0|ar[36+(0|ar[A>>2])>>2],ar[s>>2]=m,ar[b>>2]=h,ar[a>>2]=ar[s>>2],ar[c>>2]=ar[b>>2],p=0|ss[15&p](A,a,c,i,f,n,k,v),ar[e>>2]=p,t=t+2|0}else if(27==(0|Z)){for(;;){if(((Z=0)|(t=t+1|0))==(0|o)){t=o;break}if((h=0|tr[t>>0])<<24>>24<=-1)break;if(!(8192&or[y+(h<<24>>24<<1)>>1]))break;Z=27}for(h=v;;){k?0|Ji(w=(0|(w=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[w>>0]),-1)?(g=1,k=ar[e>>2]=0):g=0:(g=1,k=0);do{if(v){if(0|Ji(w=(0|(w=0|ar[v+12>>2]))==(0|ar[v+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](v):0|bi(0|tr[w>>0]),-1)){h=ar[r>>2]=0,Z=43;break}if(g^0==(0|h)){v=m=h;break}break e}Z=43}while(0);if(43==(0|Z)){if(Z=0,g)break e;m=h,v=0}if((255&(h=(0|(h=0|ar[(w=k+12|0)>>2]))==(0|ar[(g=k+16|0)>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[h>>0])))<<24>>24<=-1)break e;if(!(8192&or[(0|ar[u>>2])+(h<<24>>24<<1)>>1]))break e;(0|(h=0|ar[w>>2]))!=(0|ar[g>>2])?(ar[w>>2]=h+1,bi(0|tr[h>>0]),h=m):(is[127&ar[40+(0|ar[k>>2])>>2]](k),h=m)}}else if(57==(0|Z)){if(t=t+1|(Z=0),(0|(h=0|ar[w>>2]))==(0|ar[v>>2])){is[127&ar[40+(0|ar[k>>2])>>2]](k);break}ar[w>>2]=h+1,bi(0|tr[h>>0]);break}}while(0);k=0|ar[f>>2]}61==(0|Z)&&(ar[f>>2]=4),w=k?0|Ji(t=(0|(t=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[t>>0]),-1)?(k=ar[e>>2]=0,1):0:(k=0,1),t=0|ar[r>>2];do{if(t){if(0|Ji(t=(0|(h=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|bi(0|tr[h>>0]),-1)){ar[r>>2]=0,Z=74;break}if(w)break;Z=76;break}Z=74}while(0);return 74==(0|Z)&&w&&(Z=76),76==(0|Z)&&(ar[f>>2]=2|ar[f>>2]),ur=d,0|k}function TA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],((A=0|$A(r,A,f,n,2))+-1|0)>>>0<31&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function MA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|$A(r,A,f,n,2)))<24&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function SA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],((A=0|$A(r,A,f,n,2))+-1|0)>>>0<12&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function UA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|$A(r,A,f,n,3)))<366&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function OA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|$A(r,A,f,n,2)))<13&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A+-1:ar[f>>2]=4|r,ur=t}function HA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|$A(r,A,f,n,2)))<60&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function xA(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0;var n,t=0,o=0;n=(f|=0)+8|0;A:for(;;){A=0|ar[e>>2];do{if(A){if(0|Ji(A=(0|(f=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[f>>0]),-1)){ar[e>>2]=0,t=1;break}t=0==(0|ar[e>>2]);break}t=1}while(0);f=0|ar[r>>2];do{if(f){if(0|Ji(A=(0|(A=0|ar[f+12>>2]))==(0|ar[f+16>>2])?0|is[127&ar[36+(0|ar[f>>2])>>2]](f):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,o=15;break}if(t){t=f;break}t=f;break A}o=15}while(0);if(15==(0|o)){if(o=0,t){t=0;break}t=0}if(A=0|ar[e>>2],(255&(A=(0|(f=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[f>>0])))<<24>>24<=-1)break;if(!(8192&or[(0|ar[n>>2])+(A<<24>>24<<1)>>1]))break;A=0|ar[e>>2],(0|(t=0|ar[(f=A+12|0)>>2]))!=(0|ar[A+16>>2])?(ar[f>>2]=t+1,bi(0|tr[t>>0])):is[127&ar[40+(0|ar[A>>2])>>2]](A)}A=0|ar[e>>2];do{if(A){if(0|Ji(A=(0|(f=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[f>>0]),-1)){ar[e>>2]=0,f=1;break}f=0==(0|ar[e>>2]);break}f=1}while(0);do{if(t){if(0|Ji(A=(0|(A=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,o=38;break}if(f)break;o=40;break}o=38}while(0);38==(0|o)&&f&&(o=40),40==(0|o)&&(ar[i>>2]=2|ar[i>>2])}function jA(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c=0,l=0;o=ur=(a=ur)+31&-32,ur=ur+16|0,t=4+o|0,l=0|is[127&ar[8+(0|ar[(l=(A|=0)+8|0)>>2])>>2]](l),c=(A=0|tr[l+11>>0])<<24>>24<0?0|ar[l+4>>2]:255&A,(A=0|tr[l+12+11>>0])<<24>>24<0?A=0|ar[l+16>>2]:A&=255;do{if((0|c)!=(0-A|0)){if(ar[o>>2]=ar[i>>2],ar[t>>2]=ar[o>>2],A=(0|Ff(r,t,l,l+24|0,n,f,0))-l|0,12==(0|(c=0|ar[e>>2]))&0==(0|A)){ar[e>>2]=0;break}(0|c)<12&12==(0|A)&&(ar[e>>2]=c+12)}else ar[f>>2]=4|ar[f>>2]}while(0);ur=a}function zA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|$A(r,A,f,n,2)))<61&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function PA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|$A(r,A,f,n,1)))<7&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function LA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],A=0|$A(r,A,f,n,4),4&ar[f>>2]||(A=(0|A)<69?A+2e3|0:(0|A)<100?A+1900|0:A,ar[e>>2]=A+-1900),ur=t}function KA(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],A=0|$A(r,A,f,n,4),4&ar[f>>2]||(ar[e>>2]=A+-1900),ur=t}function qA(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0;A=0|ar[(e|=0)>>2];do{if(A){if(0|Ji(A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[n>>0]),-1)){ar[e>>2]=0,t=1;break}t=0==(0|ar[e>>2]);break}t=1}while(0);n=0|ar[r>>2];do{if(n){if(0|Ji(A=(0|(A=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,a=14;break}if(t){o=n,a=16;break}A=6,a=38;break}a=14}while(0);14==(0|a)&&(a=t?(A=6,38):(o=0,16));A:do{if(16==(0|a))if(A=0|ar[e>>2],A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[n>>0]),(0|ns[63&ar[36+(0|ar[f>>2])>>2]](f,255&A,0))<<24>>24==37){A=0|ar[e>>2],(0|(t=0|ar[(n=A+12|0)>>2]))==(0|ar[A+16>>2])?is[127&ar[40+(0|ar[A>>2])>>2]](A):(ar[n>>2]=t+1,bi(0|tr[t>>0])),A=0|ar[e>>2];do{if(A){if(0|Ji(A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[n>>0]),-1)){ar[e>>2]=0,n=1;break}n=0==(0|ar[e>>2]);break}n=1}while(0);do{if(0|o){if(0|Ji(A=(0|(A=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0;break}if(n)break A;A=2,a=38;break A}}while(0);n&&(A=2,a=38)}else A=4,a=38}while(0);38==(0|a)&&(ar[i>>2]=ar[i>>2]|A)}function $A(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;n=0|ar[(A|=0)>>2];do{if(n){if(0|Ji(n=(0|(t=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|bi(0|tr[t>>0]),-1)){ar[A>>2]=0,o=1;break}o=0==(0|ar[A>>2]);break}o=1}while(0);t=0|ar[e>>2];do{if(t){if(0|Ji(n=(0|(n=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|bi(0|tr[n>>0]),-1)){ar[e>>2]=0,k=14;break}if(o){k=17;break}k=16;break}k=14}while(0);14==(0|k)&&(k=o?16:(t=0,17));A:do{if(16==(0|k))ar[r>>2]=6|ar[r>>2],n=0;else if(17==(0|k)){if(n=0|ar[A>>2],-1<(o=255&(n=(0|(o=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|bi(0|tr[o>>0])))<<24>>24&&2048&or[(0|ar[(d=i+8|0)>>2])+(n<<24>>24<<1)>>1]){for(n=(0|ns[63&ar[36+(0|ar[i>>2])>>2]](i,o,0))<<24>>24,o=0|ar[A>>2],a=l=((0|(c=0|ar[(a=o+12|0)>>2]))==(0|ar[o+16>>2])?is[127&ar[40+(0|ar[o>>2])>>2]](o):(ar[a>>2]=c+1,bi(0|tr[c>>0])),t);;){n=n+-48|0,b=f+-1|0,t=0|ar[A>>2];do{if(t){if(0|Ji(t=(0|(o=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|bi(0|tr[o>>0]),-1)){ar[A>>2]=0,c=1;break}c=0==(0|ar[A>>2]);break}c=1}while(0);do{if(a){if(0|Ji(t=(0|(t=0|ar[a+12>>2]))==(0|ar[a+16>>2])?0|is[127&ar[36+(0|ar[a>>2])>>2]](a):0|bi(0|tr[t>>0]),-1)){t=1,u=s=ar[e>>2]=0;break}t=0==(0|(s=l)),u=l;break}s=l,t=1,u=0}while(0);if(o=0|ar[A>>2],!(1<(0|f)&(c^t)))break;if((o=255&(t=(0|(t=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[t>>0])))<<24>>24<=-1)break A;if(!(2048&or[(0|ar[d>>2])+(t<<24>>24<<1)>>1]))break A;n=((0|ns[63&ar[36+(0|ar[i>>2])>>2]](i,o,0))<<24>>24)+(10*n|0)|0,t=0|ar[A>>2],(0|(a=0|ar[(o=t+12|0)>>2]))!=(0|ar[t+16>>2])?(ar[o>>2]=a+1,bi(0|tr[a>>0]),f=b,l=s,a=u):(is[127&ar[40+(0|ar[t>>2])>>2]](t),f=b,l=s,a=u)}do{if(o){if(0|Ji(t=(0|(t=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[t>>0]),-1)){ar[A>>2]=0,o=1;break}o=0==(0|ar[A>>2]);break}o=1}while(0);do{if(s){if(0|Ji(t=(0|(t=0|ar[s+12>>2]))==(0|ar[s+16>>2])?0|is[127&ar[36+(0|ar[s>>2])>>2]](s):0|bi(0|tr[t>>0]),-1)){ar[e>>2]=0,k=62;break}if(o)break A;break}k=62}while(0);if(62==(0|k)&&!o)break;ar[r>>2]=2|ar[r>>2];break}ar[r>>2]=4|ar[r>>2],n=0}}while(0);return 0|n}function Ae(A){return 0|function(A){var e=0;e=A|=0;for(;0|ar[e>>2];)e=e+4|0;return e-A>>2|0}(A|=0)}function ee(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a;a=ur=(t=ur)+31&-32,ur=ur+16|0,o=4+a|0,A=0|is[127&ar[ar[(A=(A|=0)+8|0)>>2]>>2]](A),ar[a>>2]=ar[i>>2],ar[o>>2]=ar[a>>2],(0|(A=(0|Df(r,o,A,A+168|0,n,f,0))-A|0))<168&&(ar[e>>2]=((0|A)/12|0)%7|0),ur=t}function re(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a;a=ur=(t=ur)+31&-32,ur=ur+16|0,o=4+a|0,A=0|is[127&ar[4+(0|ar[(A=(A|=0)+8|0)>>2])>>2]](A),ar[a>>2]=ar[i>>2],ar[o>>2]=ar[a>>2],(0|(A=(0|Df(r,o,A,A+288|0,n,f,0))-A|0))<288&&(ar[e>>2]=((0|A)/12|0)%12|0),ur=t}function ie(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l,u,s,b,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;s=ur=(b=ur)+31&-32,ur=ur+16|0,a=8+s|0,u=4+s|0,Di(c=12+s|0,i|=0),l=0|bf(c,52568),df(c),d=ar[f>>2]=0;A:for(;;){for(m=(0|t)!=(0|o),k=d;;){if(d=0|ar[e>>2],!(m&0==(0|k)))break A;g=(h=d)?0|Qi(k=(0|(k=0|ar[d+12>>2]))==(0|ar[d+16>>2])?0|is[127&ar[36+(0|ar[d>>2])>>2]](d):0|wi(0|ar[k>>2]),-1)?(v=1,d=ar[e>>2]=0):(v=0,h):(d=0,v=1,h),k=w=0|ar[r>>2];do{if(w){if(0|Qi(h=(0|(h=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[h>>2]),-1)){k=ar[r>>2]=0,p=16;break}if(v)break;p=58;break A}p=16}while(0);if(16==(0|p)){if(p=0,v){p=58;break A}w=0}if((0|ns[63&ar[52+(0|ar[l>>2])>>2]](l,0|ar[t>>2],0))<<24>>24==37){p=19;break}if(0|ns[63&ar[12+(0|ar[l>>2])>>2]](l,8192,0|ar[t>>2])){p=26;break}if(k=(0|(k=0|ar[(h=d+12|0)>>2]))==(0|ar[(w=d+16|0)>>2])?0|is[127&ar[36+(0|ar[d>>2])>>2]](d):0|wi(0|ar[k>>2]),(0|(g=0|fs[63&ar[28+(0|ar[l>>2])>>2]](l,k)))==(0|fs[63&ar[28+(0|ar[l>>2])>>2]](l,0|ar[t>>2]))){p=54;break}k=ar[f>>2]=4}e:do{if(19==(0|p)){if(((p=0)|(v=t+4|0))==(0|o)){p=58;break A}switch((h=0|ns[63&ar[52+(0|ar[l>>2])>>2]](l,0|ar[v>>2],0))<<24>>24){case 48:case 69:if((0|(t=t+8|0))==(0|o)){p=58;break A}w=h,d=0|ns[63&ar[52+(0|ar[l>>2])>>2]](l,0|ar[t>>2],0),t=v;break;default:w=0,d=h}m=0|ar[36+(0|ar[A>>2])>>2],ar[u>>2]=g,ar[s>>2]=k,ar[a>>2]=ar[u>>2],ar[c>>2]=ar[s>>2],m=0|ss[15&m](A,a,c,i,f,n,d,w),ar[e>>2]=m,t=t+8|0}else if(26==(0|p)){for(;;){if(((p=0)|(t=t+4|0))==(0|o)){t=o;break}if(!(0|ns[63&ar[12+(0|ar[l>>2])>>2]](l,8192,0|ar[t>>2])))break;p=26}for(k=w;;){d?0|Qi(h=(0|(h=0|ar[d+12>>2]))==(0|ar[d+16>>2])?0|is[127&ar[36+(0|ar[d>>2])>>2]](d):0|wi(0|ar[h>>2]),-1)?(v=1,d=ar[e>>2]=0):v=0:(v=1,d=0);do{if(w){if(0|Qi(h=(0|(h=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[h>>2]),-1)){k=ar[r>>2]=0,p=41;break}if(v^0==(0|k)){w=g=k;break}break e}p=41}while(0);if(41==(0|p)){if(p=0,v)break e;g=k,w=0}if(k=(0|(k=0|ar[(h=d+12|0)>>2]))==(0|ar[(v=d+16|0)>>2])?0|is[127&ar[36+(0|ar[d>>2])>>2]](d):0|wi(0|ar[k>>2]),!(0|ns[63&ar[12+(0|ar[l>>2])>>2]](l,8192,k)))break e;(0|(k=0|ar[h>>2]))!=(0|ar[v>>2])?(ar[h>>2]=k+4,wi(0|ar[k>>2]),k=g):(is[127&ar[40+(0|ar[d>>2])>>2]](d),k=g)}}else if(54==(0|p)){if(t=t+4|(p=0),(0|(k=0|ar[h>>2]))==(0|ar[w>>2])){is[127&ar[40+(0|ar[d>>2])>>2]](d);break}ar[h>>2]=k+4,wi(0|ar[k>>2]);break}}while(0);d=0|ar[f>>2]}58==(0|p)&&(ar[f>>2]=4),h=d?0|Qi(t=(0|(t=0|ar[d+12>>2]))==(0|ar[d+16>>2])?0|is[127&ar[36+(0|ar[d>>2])>>2]](d):0|wi(0|ar[t>>2]),-1)?(d=ar[e>>2]=0,1):0:(d=0,1),t=0|ar[r>>2];do{if(t){if(0|Qi(t=(0|(k=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|wi(0|ar[k>>2]),-1)){ar[r>>2]=0,p=71;break}if(h)break;p=73;break}p=71}while(0);return 71==(0|p)&&h&&(p=73),73==(0|p)&&(ar[f>>2]=2|ar[f>>2]),ur=b,0|d}function fe(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],((A=0|we(r,A,f,n,2))+-1|0)>>>0<31&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function ne(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|we(r,A,f,n,2)))<24&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function te(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],((A=0|we(r,A,f,n,2))+-1|0)>>>0<12&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function oe(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|we(r,A,f,n,3)))<366&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function ae(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|we(r,A,f,n,2)))<13&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A+-1:ar[f>>2]=4|r,ur=t}function ce(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|we(r,A,f,n,2)))<60&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function le(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0;A:for(;;){A=0|ar[e>>2];do{if(A){if(0|Qi(A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[n>>2]),-1)){ar[e>>2]=0,t=1;break}t=0==(0|ar[e>>2]);break}t=1}while(0);n=0|ar[r>>2];do{if(n){if(0|Qi(A=(0|(A=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,o=15;break}if(t){t=n;break}t=n;break A}o=15}while(0);if(15==(0|o)){if(o=0,t){t=0;break}t=0}if(A=0|ar[e>>2],A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[n>>2]),!(0|ns[63&ar[12+(0|ar[f>>2])>>2]](f,8192,A)))break;A=0|ar[e>>2],(0|(t=0|ar[(n=A+12|0)>>2]))!=(0|ar[A+16>>2])?(ar[n>>2]=t+4,wi(0|ar[t>>2])):is[127&ar[40+(0|ar[A>>2])>>2]](A)}A=0|ar[e>>2];do{if(A){if(0|Qi(A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[n>>2]),-1)){ar[e>>2]=0,n=1;break}n=0==(0|ar[e>>2]);break}n=1}while(0);do{if(t){if(0|Qi(A=(0|(A=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,o=37;break}if(n)break;o=39;break}o=37}while(0);37==(0|o)&&n&&(o=39),39==(0|o)&&(ar[i>>2]=2|ar[i>>2])}function ue(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c=0,l=0;o=ur=(a=ur)+31&-32,ur=ur+16|0,t=4+o|0,l=0|is[127&ar[8+(0|ar[(l=(A|=0)+8|0)>>2])>>2]](l),c=(A=0|tr[l+8+3>>0])<<24>>24<0?0|ar[l+4>>2]:255&A,(A=0|tr[l+20+3>>0])<<24>>24<0?A=0|ar[l+16>>2]:A&=255;do{if((0|c)!=(0-A|0)){if(ar[o>>2]=ar[i>>2],ar[t>>2]=ar[o>>2],A=(0|Df(r,t,l,l+24|0,n,f,0))-l|0,12==(0|(c=0|ar[e>>2]))&0==(0|A)){ar[e>>2]=0;break}(0|c)<12&12==(0|A)&&(ar[e>>2]=c+12)}else ar[f>>2]=4|ar[f>>2]}while(0);ur=a}function se(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|we(r,A,f,n,2)))<61&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function be(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],(0|(A=0|we(r,A,f,n,1)))<7&0==(4&(r=0|ar[f>>2])|0)?ar[e>>2]=A:ar[f>>2]=4|r,ur=t}function de(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],A=0|we(r,A,f,n,4),4&ar[f>>2]||(A=(0|A)<69?A+2e3|0:(0|A)<100?A+1900|0:A,ar[e>>2]=A+-1900),ur=t}function ke(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o;o=ur=(t=ur)+31&-32,ur=ur+16|0,A=4+o|0,ar[o>>2]=ar[i>>2],ar[A>>2]=ar[o>>2],A=0|we(r,A,f,n,4),4&ar[f>>2]||(ar[e>>2]=A+-1900),ur=t}function he(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0;A=0|ar[(e|=0)>>2];do{if(A){if(0|Qi(A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[n>>2]),-1)){ar[e>>2]=0,t=1;break}t=0==(0|ar[e>>2]);break}t=1}while(0);n=0|ar[r>>2];do{if(n){if(0|Qi(A=(0|(A=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,a=14;break}if(t){o=n,a=16;break}A=6,a=38;break}a=14}while(0);14==(0|a)&&(a=t?(A=6,38):(o=0,16));A:do{if(16==(0|a))if(A=0|ar[e>>2],A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[n>>2]),(0|ns[63&ar[52+(0|ar[f>>2])>>2]](f,A,0))<<24>>24==37){A=0|ar[e>>2],(0|(t=0|ar[(n=A+12|0)>>2]))==(0|ar[A+16>>2])?is[127&ar[40+(0|ar[A>>2])>>2]](A):(ar[n>>2]=t+4,wi(0|ar[t>>2])),A=0|ar[e>>2];do{if(A){if(0|Qi(A=(0|(n=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[n>>2]),-1)){ar[e>>2]=0,n=1;break}n=0==(0|ar[e>>2]);break}n=1}while(0);do{if(0|o){if(0|Qi(A=(0|(A=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0;break}if(n)break A;A=2,a=38;break A}}while(0);n&&(A=2,a=38)}else A=4,a=38}while(0);38==(0|a)&&(ar[i>>2]=ar[i>>2]|A)}function we(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;n=0|ar[(A|=0)>>2];do{if(n){if(0|Qi(n=(0|(t=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|wi(0|ar[t>>2]),-1)){ar[A>>2]=0,o=1;break}o=0==(0|ar[A>>2]);break}o=1}while(0);t=0|ar[e>>2];do{if(t){if(0|Qi(n=(0|(n=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|wi(0|ar[n>>2]),-1)){ar[e>>2]=0,d=14;break}if(o){d=17;break}d=16;break}d=14}while(0);14==(0|d)&&(d=o?16:(t=0,17));A:do{if(16==(0|d))ar[r>>2]=6|ar[r>>2],n=0;else if(17==(0|d)){if(n=0|ar[A>>2],n=(0|(o=0|ar[n+12>>2]))==(0|ar[n+16>>2])?0|is[127&ar[36+(0|ar[n>>2])>>2]](n):0|wi(0|ar[o>>2]),!(0|ns[63&ar[12+(0|ar[i>>2])>>2]](i,2048,n))){ar[r>>2]=4|ar[r>>2],n=0;break}for(n=(0|ns[63&ar[52+(0|ar[i>>2])>>2]](i,n,0))<<24>>24,o=0|ar[A>>2],a=l=((0|(c=0|ar[(a=o+12|0)>>2]))==(0|ar[o+16>>2])?is[127&ar[40+(0|ar[o>>2])>>2]](o):(ar[a>>2]=c+4,wi(0|ar[c>>2])),t);;){n=n+-48|0,b=f+-1|0,t=0|ar[A>>2];do{if(t){if(0|Qi(t=(0|(o=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[t>>2])>>2]](t):0|wi(0|ar[o>>2]),-1)){ar[A>>2]=0,c=1;break}c=0==(0|ar[A>>2]);break}c=1}while(0);do{if(a){if(0|Qi(t=(0|(t=0|ar[a+12>>2]))==(0|ar[a+16>>2])?0|is[127&ar[36+(0|ar[a>>2])>>2]](a):0|wi(0|ar[t>>2]),-1)){t=1,u=s=ar[e>>2]=0;break}t=0==(0|(s=l)),u=l;break}s=l,t=1,u=0}while(0);if(o=0|ar[A>>2],!(1<(0|f)&(c^t)))break;if(t=(0|(t=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|wi(0|ar[t>>2]),!(0|ns[63&ar[12+(0|ar[i>>2])>>2]](i,2048,t)))break A;n=((0|ns[63&ar[52+(0|ar[i>>2])>>2]](i,t,0))<<24>>24)+(10*n|0)|0,t=0|ar[A>>2],(0|(a=0|ar[(o=t+12|0)>>2]))!=(0|ar[t+16>>2])?(ar[o>>2]=a+4,wi(0|ar[a>>2]),f=b,l=s,a=u):(is[127&ar[40+(0|ar[t>>2])>>2]](t),f=b,l=s,a=u)}do{if(o){if(0|Qi(t=(0|(t=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|wi(0|ar[t>>2]),-1)){ar[A>>2]=0,o=1;break}o=0==(0|ar[A>>2]);break}o=1}while(0);do{if(s){if(0|Qi(t=(0|(t=0|ar[s+12>>2]))==(0|ar[s+16>>2])?0|is[127&ar[36+(0|ar[s>>2])>>2]](s):0|wi(0|ar[t>>2]),-1)){ar[e>>2]=0,d=60;break}if(o)break A;break}d=60}while(0);if(60==(0|d)&&!o)break;ar[r>>2]=2|ar[r>>2]}}while(0);return 0|n}function ve(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u=0;t=ur=(a=ur)+31&-32,ur=ur+16|0,tr[t>>0]=37,tr[(o=1+t|0)>>0]=f,tr[(u=2+t|0)>>0]=n,tr[3+t>>0]=0,n<<24>>24&&(tr[o>>0]=n,tr[u>>0]=f),u=0|(c=e,l=0|ar[r>>2],(l|=0)-(c|=0)|0),u=e+(0|GA(0|e,0|u,0|t,0|i,0|ar[A>>2]))|0,ar[r>>2]=u,ur=a}function ge(A){(0|(0|ar[(A|=0)>>2]))!=(0|hf())&&fi(0|ar[A>>2])}function me(){kA()}function pe(A,e,r){return A|=0,r|=0,0|(e|=0)&&Vu(0|A,255&(0|bi(r))|0,0|e),0|A}function ye(A,e,r,i,f,n,t,o,a,c,l){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0;var u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0;for(X=ur=(Q=ur)+31&-32,ur=ur+512|0,x=96+X|0,D=80+X|0,V=72+X|0,W=68+X|0,I=500+X|0,B=497+X|0,E=496+X|0,_=56+X|0,F=44+X|0,N=32+X|0,R=20+X|0,Y=8+X|0,G=4+X|0,ar[(C=88+X|0)>>2]=l,ar[D>>2]=x,ar[(J=4+D|0)>>2]=309,ar[V>>2]=x,ar[W>>2]=x+400,ar[_>>2]=0,ar[4+_>>2]=0,l=ar[8+_>>2]=0;3!=(0|l);)l=l+1|(ar[_+(l<<2)>>2]=0);for(ar[F>>2]=0,ar[4+F>>2]=0,l=ar[8+F>>2]=0;3!=(0|l);)l=l+1|(ar[F+(l<<2)>>2]=0);for(ar[N>>2]=0,ar[4+N>>2]=0,l=ar[8+N>>2]=0;3!=(0|l);)l=l+1|(ar[N+(l<<2)>>2]=0);for(ar[R>>2]=0,ar[4+R>>2]=0,l=ar[8+R>>2]=0;3!=(0|l);)l=l+1|(ar[R+(l<<2)>>2]=0);for(ar[Y>>2]=0,ar[4+Y>>2]=0,l=ar[8+Y>>2]=0;3!=(0|l);)l=l+1|(ar[Y+(l<<2)>>2]=0);!function(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s;if(u=ur=(s=ur)+31&-32,ur=ur+16|0,l=12+u|0,A|=0){for(e=0|bf(e,54256),ks[63&ar[44+(0|ar[e>>2])>>2]](l,e),A=0|ar[l>>2],tr[r>>0]=A,tr[r+1>>0]=A>>8,tr[r+2>>0]=A>>16,tr[r+3>>0]=A>>24,ks[63&ar[32+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=a+11|0)>>0])<0?(A=0|ar[a>>2],tr[l>>0]=0,Ni(A,l),ar[a+4>>2]=0):(tr[l>>0]=0,Ni(a,l),tr[A>>0]=0),a),Ml(a,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),ks[63&ar[28+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=o+11|0)>>0])<0?(A=0|ar[o>>2],tr[l>>0]=0,Ni(A,l),ar[o+4>>2]=0):(tr[l>>0]=0,Ni(o,l),tr[A>>0]=0),o),Ml(o,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),A=0|is[127&ar[12+(0|ar[e>>2])>>2]](e),tr[i>>0]=A,A=0|is[127&ar[16+(0|ar[e>>2])>>2]](e),tr[f>>0]=A,ks[63&ar[20+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=n+11|0)>>0])<0?(A=0|ar[n>>2],tr[l>>0]=0,Ni(A,l),ar[n+4>>2]=0):(tr[l>>0]=0,Ni(n,l),tr[A>>0]=0),n),Ml(n,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),ks[63&ar[24+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=t+11|0)>>0])<0?(A=0|ar[t>>2],tr[l>>0]=0,Ni(A,l),ar[t+4>>2]=0):(tr[l>>0]=0,Ni(t,l),tr[A>>0]=0),t),Ml(t,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;Yl(u),A=0|is[127&ar[36+(0|ar[e>>2])>>2]](e)}else{for(e=0|bf(e,54248),ks[63&ar[44+(0|ar[e>>2])>>2]](l,e),A=0|ar[l>>2],tr[r>>0]=A,tr[r+1>>0]=A>>8,tr[r+2>>0]=A>>16,tr[r+3>>0]=A>>24,ks[63&ar[32+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=a+11|0)>>0])<0?(A=0|ar[a>>2],tr[l>>0]=0,Ni(A,l),ar[a+4>>2]=0):(tr[l>>0]=0,Ni(a,l),tr[A>>0]=0),a),Ml(a,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),ks[63&ar[28+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=o+11|0)>>0])<0?(A=0|ar[o>>2],tr[l>>0]=0,Ni(A,l),ar[o+4>>2]=0):(tr[l>>0]=0,Ni(o,l),tr[A>>0]=0),o),Ml(o,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),A=0|is[127&ar[12+(0|ar[e>>2])>>2]](e),tr[i>>0]=A,A=0|is[127&ar[16+(0|ar[e>>2])>>2]](e),tr[f>>0]=A,ks[63&ar[20+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=n+11|0)>>0])<0?(A=0|ar[n>>2],tr[l>>0]=0,Ni(A,l),ar[n+4>>2]=0):(tr[l>>0]=0,Ni(n,l),tr[A>>0]=0),n),Ml(n,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),ks[63&ar[24+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=t+11|0)>>0])<0?(A=0|ar[t>>2],tr[l>>0]=0,Ni(A,l),ar[t+4>>2]=0):(tr[l>>0]=0,Ni(t,l),tr[A>>0]=0),t),Ml(t,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;Yl(u),A=0|is[127&ar[36+(0|ar[e>>2])>>2]](e)}ar[c>>2]=A,ur=s}(r,i,I,B,E,_,F,N,R,G),ar[c>>2]=ar[a>>2],g=o+8|0,m=11+N|0,p=4+N|0,y=11+R|0,Z=4+R|0,u=0!=(512&f|0),s=11+F|0,b=4+F|0,d=11+Y|0,k=4+Y|0,h=3+I|0,w=11+_|0,v=4+_|0,H=x=0;A:for(;;){if(o=0!=(0|x),4<=H>>>0){j=234;break}l=0|ar[A>>2];do{if(l){if(0|Ji(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);r=0|ar[e>>2];do{if(r){if(0|Ji(l=(0|(l=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|bi(0|tr[l>>0]),-1)){ar[e>>2]=0,j=31;break}if(i){O=r;break}j=234;break A}j=31}while(0);if(31==(0|j)){if(j=0,i){j=234;break}O=0}l=3!=(0|H);e:do{switch(0|tr[I+H>>0]){case 1:if(l){if(l=0|ar[A>>2],(255&(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0])))<<24>>24<=-1){j=44;break A}if(!(8192&or[(0|ar[g>>2])+(l<<24>>24<<1)>>1])){j=44;break A}l=0|ar[A>>2],jl(Y,255&(l=(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?0|is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+1,0|bi(0|tr[i>>0])))),o=l=O,j=46}else l=x;break;case 0:l?(o=l=O,j=46):l=x;break;case 3:if((0|(l=(l=0|tr[m>>0])<<24>>24<0?0|ar[p>>2]:255&l))==(0-(o=(o=0|tr[y>>0])<<24>>24<0?0|ar[Z>>2]:255&o)|0))l=x;else{if(f=0==(0|l),l=0|ar[A>>2],i=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2]),f|0==(0|o)){if(l=i?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),l&=255,f){if(l<<24>>24!=(0|tr[((0|tr[y>>0])<0?0|ar[R>>2]:R)>>0])){l=x;break e}l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+1,bi(0|tr[i>>0])),l=(tr[t>>0]=1)<((l=0|tr[y>>0])<<24>>24<0?0|ar[Z>>2]:255&l)>>>0?R:x;break e}if(l<<24>>24!=(0|tr[((0|tr[m>>0])<0?0|ar[N>>2]:N)>>0])){tr[t>>0]=1,l=x;break e}l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+1,bi(0|tr[i>>0])),l=1<((l=0|tr[m>>0])<<24>>24<0?0|ar[p>>2]:255&l)>>>0?N:x;break e}if(l=i?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),r=0|ar[A>>2],f=(0|(o=0|ar[(i=r+12|0)>>2]))==(0|ar[r+16>>2]),(255&l)<<24>>24==(0|tr[((0|tr[m>>0])<0?0|ar[N>>2]:N)>>0])){f?is[127&ar[40+(0|ar[r>>2])>>2]](r):(ar[i>>2]=o+1,bi(0|tr[o>>0])),l=1<((l=0|tr[m>>0])<<24>>24<0?0|ar[p>>2]:255&l)>>>0?N:x;break e}if((255&(l=f?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|bi(0|tr[o>>0])))<<24>>24!=(0|tr[((0|tr[y>>0])<0?0|ar[R>>2]:R)>>0])){j=103;break A}l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+1,bi(0|tr[i>>0])),l=(tr[t>>0]=1)<((l=0|tr[y>>0])<<24>>24<0?0|ar[Z>>2]:255&l)>>>0?R:x}break;case 2:if(!(H>>>0<2|o)&&!(u|2==(0|H)&0!=(0|tr[h>>0]))){l=0;break e}l=(r=0|tr[s>>0])<<24>>24<0,S=0|ar[F>>2],M=i=l?S:F;r:do{if(0!=(0|H)&&(0|cr[I+(H+-1)>>0])<2){for(l=i+(l?0|ar[b>>2]:255&r)|0,T=M;(0|(o=T))!=(0|l)&&!((f=0|tr[o>>0])<<24>>24<=-1)&&8192&or[(0|ar[g>>2])+(f<<24>>24<<1)>>1];)T=o+1|0;if((f=T-M|0)>>>0<=(o=(l=(o=0|tr[d>>0])<<24>>24<0)?0|ar[k>>2]:255&o)>>>0)for(l=(o=(l?0|ar[Y>>2]:Y)+o|0)+(0-f)|0;;){if((0|l)==(0|o)){i=T,l=S,o=U=O;break r}if((0|tr[l>>0])!=(0|tr[i>>0])){i=M,l=S,o=U=O;break r}i=i+1|0,l=l+1|0}else i=M,l=S,o=U=O}else i=M,l=S,o=U=O}while(0);r:for(;l=((T=r<<24>>24<0)?l:F)+(T?0|ar[b>>2]:255&r)|0,(0|(T=i))!=(0|l);){l=0|ar[A>>2];do{if(l){if(0|Ji(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),-1)){ar[A>>2]=0,r=1;break}r=0==(0|ar[A>>2]);break}r=1}while(0);do{if(o){if(0|Ji(l=(0|(l=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[l>>0]),-1)){l=ar[e>>2]=0,j=132;break}if(r^0==(0|U)){f=l=U;break}l=T;break r}l=U,j=132}while(0);if(132==(0|j)){if(j=0,r){l=T;break}f=0}if(r=0|ar[A>>2],(255&(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|bi(0|tr[i>>0])))<<24>>24!=(0|tr[T>>0])){l=T;break}r=0|ar[A>>2],(0|(o=0|ar[(i=r+12|0)>>2]))==(0|ar[r+16>>2])?is[127&ar[40+(0|ar[r>>2])>>2]](r):(ar[i>>2]=o+1,bi(0|tr[o>>0])),U=l,i=T+1|0,r=0|tr[s>>0],l=0|ar[F>>2],o=f}if(u&&(0|l)!=(((U=(O=0|tr[s>>0])<<24>>24<0)?0|ar[F>>2]:F)+(U?0|ar[b>>2]:255&O)|0)){j=144;break A}l=x;break;case 4:M=0,o=l=O;r:for(;;){r=0|ar[A>>2];do{if(r){if(0|Ji(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|bi(0|tr[i>>0]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);do{if(o){if(0|Ji(r=(0|(r=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[r>>0]),-1)){l=ar[e>>2]=0,j=158;break}if(i^0==(0|l)){T=f=l;break}o=l;break r}j=158}while(0);if(158==(0|j)){if(j=0,i){o=l;break}f=l,T=0}if(l=0|ar[A>>2],-1<(r=255&(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0])))<<24>>24&&0!=(2048&or[(0|ar[g>>2])+(l<<24>>24<<1)>>1]))(0|(l=0|ar[c>>2]))==(0|ar[C>>2])&&(Ce(a,c,C),l=0|ar[c>>2]),ar[c>>2]=l+1,tr[l>>0]=r,l=M+1|0;else{if(O=0|tr[w>>0],!(r<<24>>24==(0|tr[E>>0])&(0|M?0!=(0|(O<<24>>24<0?0|ar[v>>2]:255&O)):0))){o=f;break}(0|(l=0|ar[V>>2]))==(0|ar[W>>2])&&(We(D,V,W),l=0|ar[V>>2]),ar[V>>2]=l+4,ar[l>>2]=M,l=0}r=0|ar[A>>2],(0|(o=0|ar[(i=r+12|0)>>2]))!=(0|ar[r+16>>2])?(ar[i>>2]=o+1,bi(0|tr[o>>0]),M=l,l=f,o=T):(is[127&ar[40+(0|ar[r>>2])>>2]](r),M=l,l=f,o=T)}l=0|ar[V>>2],0|M&&(0|ar[D>>2])!=(0|l)&&((0|l)==(0|ar[W>>2])&&(We(D,V,W),l=0|ar[V>>2]),ar[V>>2]=l+4,ar[l>>2]=M);r:do{if(0<(0|ar[G>>2])){l=0|ar[A>>2];do{if(l){if(0|Ji(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),-1)){ar[A>>2]=0,r=1;break}r=0==(0|ar[A>>2]);break}r=1}while(0);do{if(o){if(0|Ji(l=(0|(l=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[l>>0]),-1)){ar[e>>2]=0,j=193;break}if(r)break;j=232;break A}j=193}while(0);if(193==(0|j)){if(j=0,r){j=232;break A}o=0}if(l=0|ar[A>>2],(255&(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0])))<<24>>24!=(0|tr[B>>0])){j=232;break A}for(l=0|ar[A>>2],l=((0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+1,bi(0|tr[i>>0])),o);;){if((0|ar[G>>2])<=0)break r;r=0|ar[A>>2];do{if(r){if(0|Ji(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|bi(0|tr[i>>0]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);do{if(o){if(0|Ji(r=(0|(r=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[r>>0]),-1)){l=ar[e>>2]=0,j=216;break}if(i^0==(0|l)){o=f=l;break}j=232;break A}j=216}while(0);if(216==(0|j)){if(j=0,i){j=232;break A}f=l,o=0}if(l=0|ar[A>>2],(255&(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0])))<<24>>24<=-1){j=232;break A}if(!(2048&or[(0|ar[g>>2])+(l<<24>>24<<1)>>1])){j=232;break A}(0|ar[c>>2])==(0|ar[C>>2])&&Ce(a,c,C),l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),r=0|ar[c>>2],ar[c>>2]=r+1,tr[r>>0]=l,ar[G>>2]=(0|ar[G>>2])-1,l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))!=(0|ar[l+16>>2])?(ar[r>>2]=i+1,bi(0|tr[i>>0]),l=f):(is[127&ar[40+(0|ar[l>>2])>>2]](l),l=f)}}}while(0);if((0|ar[c>>2])==(0|ar[a>>2])){j=232;break A}l=x;break;default:l=x}}while(0);e:do{if(46==(0|j))for(;;){r=(j=0)|ar[A>>2];do{if(r){if(0|Ji(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|bi(0|tr[i>>0]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);do{if(o){if(0|Ji(r=(0|(r=0|ar[o+12>>2]))==(0|ar[o+16>>2])?0|is[127&ar[36+(0|ar[o>>2])>>2]](o):0|bi(0|tr[r>>0]),-1)){l=ar[e>>2]=0,j=59;break}if(i^0==(0|l)){o=f=l;break}l=x;break e}j=59}while(0);if(59==(0|j)){if(j=0,i){l=x;break e}f=l,o=0}if(l=0|ar[A>>2],(255&(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0])))<<24>>24<=-1){l=x;break e}if(!(8192&or[(0|ar[g>>2])+(l<<24>>24<<1)>>1])){l=x;break e}l=0|ar[A>>2],jl(Y,255&(l=(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?0|is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+1,0|bi(0|tr[i>>0])))),l=f,j=46}}while(0);x=l,H=H+1|0}A:do{if(44==(0|j))ar[n>>2]=4|ar[n>>2],r=0;else if(103==(0|j))ar[n>>2]=4|ar[n>>2],r=0;else if(144==(0|j))ar[n>>2]=4|ar[n>>2],r=0;else if(232==(0|j))ar[n>>2]=4|ar[n>>2],r=0;else if(234==(0|j)){e:do{if(o){f=x+11|0,T=x+4|0,o=1;r:for(;;){if((l=0|tr[f>>0])<<24>>24<0?l=0|ar[T>>2]:l&=255,l>>>0<=o>>>0)break e;l=0|ar[A>>2];do{if(l){if(0|Ji(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);l=0|ar[e>>2];do{if(l){if(0|Ji(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),-1)){ar[e>>2]=0,j=253;break}if(i)break;break r}j=253}while(0);if(253==(0|j)&&(j=0,i))break;if(l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|bi(0|tr[r>>0]),r=(0|tr[f>>0])<0?0|ar[x>>2]:x,(255&l)<<24>>24!=(0|tr[r+o>>0]))break;l=o+1|0,r=0|ar[A>>2],(0|(o=0|ar[(i=r+12|0)>>2]))!=(0|ar[r+16>>2])?(ar[i>>2]=o+1,bi(0|tr[o>>0]),o=l):(is[127&ar[40+(0|ar[r>>2])>>2]](r),o=l)}ar[n>>2]=4|ar[n>>2],r=0;break A}}while(0);if((0|(r=0|ar[D>>2]))!=(0|(l=0|ar[V>>2]))){if(ar[X>>2]=0,yf(_,r,l,X),0|ar[X>>2]){ar[n>>2]=4|ar[n>>2],r=0;break}r=1;break}r=1}}while(0);return Yl(Y),Yl(R),Yl(N),Yl(F),Yl(_),l=0|ar[D>>2],(ar[D>>2]=0)|l&&ds[511&ar[J>>2]](l),ur=Q,0|r}function Ze(A,e,r){return(e|=0)>>>0<=(A|=0)>>>0&A>>>0<(r|=0)>>>0|0}function Ce(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0;t=309!=(0|ar[(f=(A|=0)+4|0)>>2]),n=0|ar[A>>2],o=0==(0|(o=(o=(0|ar[r>>2])-n|0)>>>0<2147483647?o<<1:-1))?1:o,i=(0|ar[e>>2])-n|0,(n=0|Aa(t?n:0,o))||_l(),t?ar[A>>2]=n:(t=0|ar[A>>2],ar[A>>2]=n,t&&(ds[511&ar[f>>2]](t),n=0|ar[A>>2])),ar[f>>2]=310,ar[e>>2]=n+i,ar[r>>2]=(0|ar[A>>2])+o}function We(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0;t=309!=(0|ar[(f=(A|=0)+4|0)>>2]),n=0|ar[A>>2],o=0==(0|(o=(o=(0|ar[r>>2])-n|0)>>>0<2147483647?o<<1:-1))?4:o,i=(0|ar[e>>2])-n>>2,(n=0|Aa(t?n:0,o))||_l(),t?ar[A>>2]=n:(t=0|ar[A>>2],ar[A>>2]=n,t&&(ds[511&ar[f>>2]](t),n=0|ar[A>>2])),ar[f>>2]=310,ar[e>>2]=n+(i<<2),ar[r>>2]=(0|ar[A>>2])+(o>>>2<<2)}function Ie(A,e,r,i,f,n,t,o,a,c,l){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0;var u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0;for(V=ur=(D=ur)+31&-32,ur=ur+512|0,H=104+V|0,J=88+V|0,G=80+V|0,C=76+V|0,W=504+V|0,I=72+V|0,B=68+V|0,X=56+V|0,_=44+V|0,F=32+V|0,N=20+V|0,R=8+V|0,E=4+V|0,ar[(Z=96+V|0)>>2]=l,ar[J>>2]=H,ar[(Y=4+J|0)>>2]=309,ar[G>>2]=H,ar[C>>2]=H+400,ar[X>>2]=0,ar[4+X>>2]=0,l=ar[8+X>>2]=0;3!=(0|l);)l=l+1|(ar[X+(l<<2)>>2]=0);for(ar[_>>2]=0,ar[4+_>>2]=0,l=ar[8+_>>2]=0;3!=(0|l);)l=l+1|(ar[_+(l<<2)>>2]=0);for(ar[F>>2]=0,ar[4+F>>2]=0,l=ar[8+F>>2]=0;3!=(0|l);)l=l+1|(ar[F+(l<<2)>>2]=0);for(ar[N>>2]=0,ar[4+N>>2]=0,l=ar[8+N>>2]=0;3!=(0|l);)l=l+1|(ar[N+(l<<2)>>2]=0);for(ar[R>>2]=0,ar[4+R>>2]=0,l=ar[8+R>>2]=0;3!=(0|l);)l=l+1|(ar[R+(l<<2)>>2]=0);!function(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s;if(u=ur=(s=ur)+31&-32,ur=ur+16|0,l=12+u|0,A|=0){for(e=0|bf(e,54272),ks[63&ar[44+(0|ar[e>>2])>>2]](l,e),A=0|ar[l>>2],tr[r>>0]=A,tr[r+1>>0]=A>>8,tr[r+2>>0]=A>>16,tr[r+3>>0]=A>>24,ks[63&ar[32+(0|ar[e>>2])>>2]](u,e),(0|tr[(A=a+8+3|0)>>0])<0?(r=0|ar[a>>2],ar[l>>2]=0,sf(r,l),ar[a+4>>2]=0):(ar[l>>2]=0,sf(a,l),tr[A>>0]=0),ql(a,0),ar[a>>2]=ar[u>>2],ar[a+4>>2]=ar[4+u>>2],ar[a+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Pl(u),ks[63&ar[28+(0|ar[e>>2])>>2]](u,e),(0|tr[(A=o+8+3|0)>>0])<0?(a=0|ar[o>>2],ar[l>>2]=0,sf(a,l),ar[o+4>>2]=0):(ar[l>>2]=0,sf(o,l),tr[A>>0]=0),ql(o,0),ar[o>>2]=ar[u>>2],ar[o+4>>2]=ar[4+u>>2],ar[o+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Pl(u),A=0|is[127&ar[12+(0|ar[e>>2])>>2]](e),ar[i>>2]=A,A=0|is[127&ar[16+(0|ar[e>>2])>>2]](e),ar[f>>2]=A,ks[63&ar[20+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=n+11|0)>>0])<0?(A=0|ar[n>>2],tr[l>>0]=0,Ni(A,l),ar[n+4>>2]=0):(tr[l>>0]=0,Ni(n,l),tr[A>>0]=0),n),Ml(n,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),ks[63&ar[24+(0|ar[e>>2])>>2]](u,e),(0|tr[(A=t+8+3|0)>>0])<0?(n=0|ar[t>>2],ar[l>>2]=0,sf(n,l),ar[t+4>>2]=0):(ar[l>>2]=0,sf(t,l),tr[A>>0]=0),ql(t,0),ar[t>>2]=ar[u>>2],ar[t+4>>2]=ar[4+u>>2],ar[t+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;Pl(u),A=0|is[127&ar[36+(0|ar[e>>2])>>2]](e)}else{for(e=0|bf(e,54264),ks[63&ar[44+(0|ar[e>>2])>>2]](l,e),A=0|ar[l>>2],tr[r>>0]=A,tr[r+1>>0]=A>>8,tr[r+2>>0]=A>>16,tr[r+3>>0]=A>>24,ks[63&ar[32+(0|ar[e>>2])>>2]](u,e),(0|tr[(A=a+8+3|0)>>0])<0?(r=0|ar[a>>2],ar[l>>2]=0,sf(r,l),ar[a+4>>2]=0):(ar[l>>2]=0,sf(a,l),tr[A>>0]=0),ql(a,0),ar[a>>2]=ar[u>>2],ar[a+4>>2]=ar[4+u>>2],ar[a+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Pl(u),ks[63&ar[28+(0|ar[e>>2])>>2]](u,e),(0|tr[(A=o+8+3|0)>>0])<0?(a=0|ar[o>>2],ar[l>>2]=0,sf(a,l),ar[o+4>>2]=0):(ar[l>>2]=0,sf(o,l),tr[A>>0]=0),ql(o,0),ar[o>>2]=ar[u>>2],ar[o+4>>2]=ar[4+u>>2],ar[o+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Pl(u),A=0|is[127&ar[12+(0|ar[e>>2])>>2]](e),ar[i>>2]=A,A=0|is[127&ar[16+(0|ar[e>>2])>>2]](e),ar[f>>2]=A,ks[63&ar[20+(0|ar[e>>2])>>2]](u,e),A=((0|tr[(A=n+11|0)>>0])<0?(A=0|ar[n>>2],tr[l>>0]=0,Ni(A,l),ar[n+4>>2]=0):(tr[l>>0]=0,Ni(n,l),tr[A>>0]=0),n),Ml(n,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;for(Yl(u),ks[63&ar[24+(0|ar[e>>2])>>2]](u,e),(0|tr[(A=t+8+3|0)>>0])<0?(n=0|ar[t>>2],ar[l>>2]=0,sf(n,l),ar[t+4>>2]=0):(ar[l>>2]=0,sf(t,l),tr[A>>0]=0),ql(t,0),ar[t>>2]=ar[u>>2],ar[t+4>>2]=ar[4+u>>2],ar[t+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)ar[u+(A<<2)>>2]=0,A=A+1|0;Pl(u),A=0|is[127&ar[36+(0|ar[e>>2])>>2]](e)}ar[c>>2]=A,ur=s}(r,i,W,I,B,X,_,F,N,E),ar[c>>2]=ar[a>>2],g=8+F+3|0,m=4+F|0,p=8+N+3|0,y=4+N|0,u=0!=(512&f|0),s=8+_+3|0,b=4+_|0,d=8+R+3|0,k=4+R|0,h=3+W|0,w=11+X|0,v=4+X|0,O=H=0;A:for(;;){if(f=0!=(0|H),4<=O>>>0){x=229;break}l=0|ar[A>>2];do{if(l){if(0|Qi(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);r=0|ar[e>>2];do{if(r){if(0|Qi(l=(0|(l=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|wi(0|ar[l>>2]),-1)){ar[e>>2]=0,x=31;break}if(i){U=r;break}x=229;break A}x=31}while(0);if(31==(0|x)){if(x=0,i){x=229;break}U=0}l=3!=(0|O);e:do{switch(0|tr[W+O>>0]){case 1:if(l){if(l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),!(0|ns[63&ar[12+(0|ar[o>>2])>>2]](o,8192,l))){x=43;break A}l=0|ar[A>>2],ru(R,l=(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?0|is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+4,0|wi(0|ar[i>>2]))),f=l=U,x=45}else l=H;break;case 0:l?(f=l=U,x=45):l=H;break;case 3:if((0|(l=(l=0|tr[g>>0])<<24>>24<0?0|ar[m>>2]:255&l))==(0-(f=(f=0|tr[p>>0])<<24>>24<0?0|ar[y>>2]:255&f)|0))l=H;else{if(Q=0==(0|l),l=0|ar[A>>2],i=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2]),Q|0==(0|f)){if(l=i?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),Q){if((0|l)!=(0|ar[((0|tr[p>>0])<0?0|ar[N>>2]:N)>>2])){l=H;break e}l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+4,wi(0|ar[i>>2])),l=(tr[t>>0]=1)<((l=0|tr[p>>0])<<24>>24<0?0|ar[y>>2]:255&l)>>>0?N:H;break e}if((0|l)!=(0|ar[((0|tr[g>>0])<0?0|ar[F>>2]:F)>>2])){tr[t>>0]=1,l=H;break e}l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+4,wi(0|ar[i>>2])),l=1<((l=0|tr[g>>0])<<24>>24<0?0|ar[m>>2]:255&l)>>>0?F:H;break e}if(l=i?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),r=0|ar[A>>2],Q=(0|(f=0|ar[(i=r+12|0)>>2]))==(0|ar[r+16>>2]),(0|l)==(0|ar[((0|tr[g>>0])<0?0|ar[F>>2]:F)>>2])){Q?is[127&ar[40+(0|ar[r>>2])>>2]](r):(ar[i>>2]=f+4,wi(0|ar[f>>2])),l=1<((l=0|tr[g>>0])<<24>>24<0?0|ar[m>>2]:255&l)>>>0?F:H;break e}if((0|(l=Q?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|wi(0|ar[f>>2])))!=(0|ar[((0|tr[p>>0])<0?0|ar[N>>2]:N)>>2])){x=101;break A}l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+4,wi(0|ar[i>>2])),l=(tr[t>>0]=1)<((l=0|tr[p>>0])<<24>>24<0?0|ar[y>>2]:255&l)>>>0?N:H}break;case 2:if(!(O>>>0<2|f)&&!(u|2==(0|O)&0!=(0|tr[h>>0]))){l=0;break e}i=0|tr[s>>0],f=0|ar[_>>2],l=i<<24>>24<0?f:_;r:do{if(0!=(0|O)&&(0|cr[W+(O+-1)>>0])<2){for(;(0|(r=l))!=(((S=i<<24>>24<0)?f:_)+((S?0|ar[b>>2]:255&i)<<2)|0);){if(!(0|ns[63&ar[12+(0|ar[o>>2])>>2]](o,8192,0|ar[r>>2]))){x=108;break}l=r+4|0,i=0|tr[s>>0],f=0|ar[_>>2]}if(108==(0|x)&&(i=(x=0)|tr[s>>0],f=0|ar[_>>2]),M=l-(S=Q=i<<24>>24<0?f:_)>>2,(T=(r=(T=0|tr[d>>0])<<24>>24<0)?0|ar[k>>2]:255&T)>>>0<M>>>0)r=S,Q=M=U;else for(r=(T=(r?0|ar[R>>2]:R)+(T<<2)|0)+(0-M<<2)|0;;){if((0|r)==(0|T)){r=l,Q=M=U;break r}if((0|ar[r>>2])!=(0|ar[Q>>2])){r=S,Q=M=U;break r}Q=Q+4|0,r=r+4|0}}else r=l,Q=M=U}while(0);r:for(;(0|(T=r))!=(0|(l=((l=i<<24>>24<0)?f:_)+((l?0|ar[b>>2]:255&i)<<2)|0));){l=0|ar[A>>2];do{if(l){if(0|Qi(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),-1)){ar[A>>2]=0,r=1;break}r=0==(0|ar[A>>2]);break}r=1}while(0);do{if(Q){if(0|Qi(l=(0|(l=0|ar[Q+12>>2]))==(0|ar[Q+16>>2])?0|is[127&ar[36+(0|ar[Q>>2])>>2]](Q):0|wi(0|ar[l>>2]),-1)){l=ar[e>>2]=0,x=129;break}if(r^0==(0|M)){Q=l=M;break}l=T;break r}l=M,x=129}while(0);if(129==(0|x)){if(x=0,r){l=T;break}Q=0}if(r=0|ar[A>>2],(0|(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|wi(0|ar[i>>2])))!=(0|ar[T>>2])){l=T;break}r=0|ar[A>>2],(0|(f=0|ar[(i=r+12|0)>>2]))==(0|ar[r+16>>2])?is[127&ar[40+(0|ar[r>>2])>>2]](r):(ar[i>>2]=f+4,wi(0|ar[f>>2])),M=l,r=T+4|0,i=0|tr[s>>0],f=0|ar[_>>2]}if(u&&(0|l)!=(((S=(U=0|tr[s>>0])<<24>>24<0)?0|ar[_>>2]:_)+((S?0|ar[b>>2]:255&U)<<2)|0)){x=141;break A}l=H;break;case 4:M=0,f=l=U;r:for(;;){r=0|ar[A>>2];do{if(r){if(0|Qi(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|wi(0|ar[i>>2]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);do{if(f){if(0|Qi(r=(0|(r=0|ar[f+12>>2]))==(0|ar[f+16>>2])?0|is[127&ar[36+(0|ar[f>>2])>>2]](f):0|wi(0|ar[r>>2]),-1)){l=ar[e>>2]=0,x=155;break}if(i^0==(0|l)){T=Q=l;break}f=l;break r}x=155}while(0);if(155==(0|x)){if(x=0,i){f=l;break}Q=l,T=0}if(l=0|ar[A>>2],r=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),0|ns[63&ar[12+(0|ar[o>>2])>>2]](o,2048,r))(0|(l=0|ar[c>>2]))==(0|ar[Z>>2])&&(Ee(a,c,Z),l=0|ar[c>>2]),ar[c>>2]=l+4,ar[l>>2]=r,l=M+1|0;else{if(U=0|tr[w>>0],!((0|r)==(0|ar[B>>2])&(0|M?0!=(0|(U<<24>>24<0?0|ar[v>>2]:255&U)):0))){f=Q;break}(0|(l=0|ar[G>>2]))==(0|ar[C>>2])&&(We(J,G,C),l=0|ar[G>>2]),ar[G>>2]=l+4,ar[l>>2]=M,l=0}r=0|ar[A>>2],(0|(f=0|ar[(i=r+12|0)>>2]))!=(0|ar[r+16>>2])?(ar[i>>2]=f+4,wi(0|ar[f>>2]),M=l,l=Q,f=T):(is[127&ar[40+(0|ar[r>>2])>>2]](r),M=l,l=Q,f=T)}l=0|ar[G>>2],0|M&&(0|ar[J>>2])!=(0|l)&&((0|l)==(0|ar[C>>2])&&(We(J,G,C),l=0|ar[G>>2]),ar[G>>2]=l+4,ar[l>>2]=M);r:do{if(0<(0|ar[E>>2])){l=0|ar[A>>2];do{if(l){if(0|Qi(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),-1)){ar[A>>2]=0,r=1;break}r=0==(0|ar[A>>2]);break}r=1}while(0);do{if(f){if(0|Qi(l=(0|(l=0|ar[f+12>>2]))==(0|ar[f+16>>2])?0|is[127&ar[36+(0|ar[f>>2])>>2]](f):0|wi(0|ar[l>>2]),-1)){ar[e>>2]=0,x=189;break}if(r)break;x=227;break A}x=189}while(0);if(189==(0|x)){if(x=0,r){x=227;break A}f=0}if(l=0|ar[A>>2],(0|(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2])))!=(0|ar[I>>2])){x=227;break A}for(l=0|ar[A>>2],l=((0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+4,wi(0|ar[i>>2])),f);;){if((0|ar[E>>2])<=0)break r;r=0|ar[A>>2];do{if(r){if(0|Qi(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|wi(0|ar[i>>2]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);do{if(f){if(0|Qi(r=(0|(r=0|ar[f+12>>2]))==(0|ar[f+16>>2])?0|is[127&ar[36+(0|ar[f>>2])>>2]](f):0|wi(0|ar[r>>2]),-1)){l=ar[e>>2]=0,x=212;break}if(i^0==(0|l)){f=Q=l;break}x=227;break A}x=212}while(0);if(212==(0|x)){if(x=0,i){x=227;break A}Q=l,f=0}if(l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),!(0|ns[63&ar[12+(0|ar[o>>2])>>2]](o,2048,l))){x=227;break A}(0|ar[c>>2])==(0|ar[Z>>2])&&Ee(a,c,Z),l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),r=0|ar[c>>2],ar[c>>2]=r+4,ar[r>>2]=l,ar[E>>2]=(0|ar[E>>2])-1,l=0|ar[A>>2],(0|(i=0|ar[(r=l+12|0)>>2]))!=(0|ar[l+16>>2])?(ar[r>>2]=i+4,wi(0|ar[i>>2]),l=Q):(is[127&ar[40+(0|ar[l>>2])>>2]](l),l=Q)}}}while(0);if((0|ar[c>>2])==(0|ar[a>>2])){x=227;break A}l=H;break;default:l=H}}while(0);e:do{if(45==(0|x))for(;;){r=(x=0)|ar[A>>2];do{if(r){if(0|Qi(r=(0|(i=0|ar[r+12>>2]))==(0|ar[r+16>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](r):0|wi(0|ar[i>>2]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);do{if(f){if(0|Qi(r=(0|(r=0|ar[f+12>>2]))==(0|ar[f+16>>2])?0|is[127&ar[36+(0|ar[f>>2])>>2]](f):0|wi(0|ar[r>>2]),-1)){l=ar[e>>2]=0,x=58;break}if(i^0==(0|l)){f=Q=l;break}l=H;break e}x=58}while(0);if(58==(0|x)){if(x=0,i){l=H;break e}Q=l,f=0}if(l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),!(0|ns[63&ar[12+(0|ar[o>>2])>>2]](o,8192,l))){l=H;break e}l=0|ar[A>>2],ru(R,l=(0|(i=0|ar[(r=l+12|0)>>2]))==(0|ar[l+16>>2])?0|is[127&ar[40+(0|ar[l>>2])>>2]](l):(ar[r>>2]=i+4,0|wi(0|ar[i>>2]))),l=Q,x=45}}while(0);H=l,O=O+1|0}A:do{if(43==(0|x))ar[n>>2]=4|ar[n>>2],r=0;else if(101==(0|x))ar[n>>2]=4|ar[n>>2],r=0;else if(141==(0|x))ar[n>>2]=4|ar[n>>2],r=0;else if(227==(0|x))ar[n>>2]=4|ar[n>>2],r=0;else if(229==(0|x)){e:do{if(f){Q=H+8+3|0,T=H+4|0,f=1;r:for(;;){if((l=0|tr[Q>>0])<<24>>24<0?l=0|ar[T>>2]:l&=255,l>>>0<=f>>>0)break e;l=0|ar[A>>2];do{if(l){if(0|Qi(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),-1)){ar[A>>2]=0,i=1;break}i=0==(0|ar[A>>2]);break}i=1}while(0);l=0|ar[e>>2];do{if(l){if(0|Qi(l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),-1)){ar[e>>2]=0,x=248;break}if(i)break;break r}x=248}while(0);if(248==(0|x)&&(x=0,i))break;if(l=0|ar[A>>2],l=(0|(r=0|ar[l+12>>2]))==(0|ar[l+16>>2])?0|is[127&ar[36+(0|ar[l>>2])>>2]](l):0|wi(0|ar[r>>2]),r=(0|tr[Q>>0])<0?0|ar[H>>2]:H,(0|l)!=(0|ar[r+(f<<2)>>2]))break;l=f+1|0,r=0|ar[A>>2],(0|(f=0|ar[(i=r+12|0)>>2]))!=(0|ar[r+16>>2])?(ar[i>>2]=f+4,wi(0|ar[f>>2]),f=l):(is[127&ar[40+(0|ar[r>>2])>>2]](r),f=l)}ar[n>>2]=4|ar[n>>2],r=0;break A}}while(0);if((0|(r=0|ar[J>>2]))!=(0|(l=0|ar[G>>2]))){if(ar[V>>2]=0,yf(X,r,l,V),0|ar[V>>2]){ar[n>>2]=4|ar[n>>2],r=0;break}r=1;break}r=1}}while(0);return Pl(R),Pl(N),Pl(F),Pl(_),Yl(X),l=0|ar[J>>2],(ar[J>>2]=0)|l&&ds[511&ar[Y>>2]](l),ur=D,0|r}function Be(A,e,r){return(e|=0)>>>0<=(A|=0)>>>0&A>>>0<(r|=0)>>>0|0}function Ee(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0;t=309!=(0|ar[(f=(A|=0)+4|0)>>2]),n=0|ar[A>>2],o=0==(0|(o=(o=(0|ar[r>>2])-n|0)>>>0<2147483647?o<<1:-1))?4:o,i=(0|ar[e>>2])-n>>2,(n=0|Aa(t?n:0,o))||_l(),t?ar[A>>2]=n:(t=0|ar[A>>2],ar[A>>2]=n,t&&(ds[511&ar[f>>2]](t),n=0|ar[A>>2])),ar[f>>2]=310,ar[e>>2]=n+(i<<2),ar[r>>2]=(0|ar[A>>2])+(o>>>2<<2)}function Ge(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s,b=0;if(u=ur=(s=ur)+31&-32,ur=ur+16|0,l=12+u|0,A|=0){if(b=0|bf(r,54256),e){for(ks[63&ar[44+(0|ar[b>>2])>>2]](l,b),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[32+(0|ar[b>>2])>>2]](u,b),A=((0|tr[(A=a+11|0)>>0])<0?(A=0|ar[a>>2],tr[l>>0]=0,Ni(A,l),ar[a+4>>2]=0):(tr[l>>0]=0,Ni(a,l),tr[A>>0]=0),a),Ml(a,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Yl(u),r=b}else{for(ks[63&ar[40+(0|ar[b>>2])>>2]](l,b),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[28+(0|ar[b>>2])>>2]](u,b),A=((0|tr[(A=a+11|0)>>0])<0?(A=0|ar[a>>2],tr[l>>0]=0,Ni(A,l),ar[a+4>>2]=0):(tr[l>>0]=0,Ni(a,l),tr[A>>0]=0),a),Ml(a,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Yl(u),r=b}for(A=0|is[127&ar[12+(0|ar[b>>2])>>2]](b),tr[f>>0]=A,A=0|is[127&ar[16+(0|ar[b>>2])>>2]](b),tr[n>>0]=A,ks[63&ar[20+(0|ar[r>>2])>>2]](u,b),A=((0|tr[(A=t+11|0)>>0])<0?(A=0|ar[t>>2],tr[l>>0]=0,Ni(A,l),ar[t+4>>2]=0):(tr[l>>0]=0,Ni(t,l),tr[A>>0]=0),t),Ml(t,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);for(Yl(u),ks[63&ar[24+(0|ar[r>>2])>>2]](u,b),A=((0|tr[(A=o+11|0)>>0])<0?(A=0|ar[o>>2],tr[l>>0]=0,Ni(A,l),ar[o+4>>2]=0):(tr[l>>0]=0,Ni(o,l),tr[A>>0]=0),o),Ml(o,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Yl(u),A=0|is[127&ar[36+(0|ar[b>>2])>>2]](b)}else{if(b=0|bf(r,54248),e){for(ks[63&ar[44+(0|ar[b>>2])>>2]](l,b),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[32+(0|ar[b>>2])>>2]](u,b),A=((0|tr[(A=a+11|0)>>0])<0?(A=0|ar[a>>2],tr[l>>0]=0,Ni(A,l),ar[a+4>>2]=0):(tr[l>>0]=0,Ni(a,l),tr[A>>0]=0),a),Ml(a,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Yl(u),r=b}else{for(ks[63&ar[40+(0|ar[b>>2])>>2]](l,b),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[28+(0|ar[b>>2])>>2]](u,b),A=((0|tr[(A=a+11|0)>>0])<0?(A=0|ar[a>>2],tr[l>>0]=0,Ni(A,l),ar[a+4>>2]=0):(tr[l>>0]=0,Ni(a,l),tr[A>>0]=0),a),Ml(a,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Yl(u),r=b}for(A=0|is[127&ar[12+(0|ar[b>>2])>>2]](b),tr[f>>0]=A,A=0|is[127&ar[16+(0|ar[b>>2])>>2]](b),tr[n>>0]=A,ks[63&ar[20+(0|ar[r>>2])>>2]](u,b),A=((0|tr[(A=t+11|0)>>0])<0?(A=0|ar[t>>2],tr[l>>0]=0,Ni(A,l),ar[t+4>>2]=0):(tr[l>>0]=0,Ni(t,l),tr[A>>0]=0),t),Ml(t,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);for(Yl(u),ks[63&ar[24+(0|ar[r>>2])>>2]](u,b),A=((0|tr[(A=o+11|0)>>0])<0?(A=0|ar[o>>2],tr[l>>0]=0,Ni(A,l),ar[o+4>>2]=0):(tr[l>>0]=0,Ni(o,l),tr[A>>0]=0),o),Ml(o,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Yl(u),A=0|is[127&ar[36+(0|ar[b>>2])>>2]](b)}ar[c>>2]=A,ur=s}function Ve(A,e,r,i,f,n,t,o,a,c,l,u,s,b,d){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0,b|=0,d|=0;var k,h,w,v,g,m,p,y,Z,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0;for(ar[(r|=0)>>2]=A,k=b+11|0,Z=b+4|0,h=s+11|0,w=s+4|0,v=0==(512&i|0),g=t+8|0,m=0<(0|d),p=u+11|0,y=u+4|0,V=0;4!=(0|V);){A:do{switch(0|tr[a+V>>0]){case 0:ar[e>>2]=ar[r>>2];break;case 1:ar[e>>2]=ar[r>>2],E=0|fs[63&ar[28+(0|ar[t>>2])>>2]](t,32),G=0|ar[r>>2],ar[r>>2]=G+1,tr[G>>0]=E;break;case 3:0|((C=(G=0|tr[k>>0])<<24>>24<0)?0|ar[Z>>2]:255&G)&&(E=0|tr[(C?0|ar[b>>2]:b)>>0],G=0|ar[r>>2],ar[r>>2]=G+1,tr[G>>0]=E);break;case 2:if(!(v|0==(0|(W=(C=(W=0|tr[h>>0])<<24>>24<0)?0|ar[w>>2]:255&W)))){for(I=(G=C?0|ar[s>>2]:s)+W|0,C=0|ar[r>>2],W=G;(0|W)!=(0|I);)tr[C>>0]=0|tr[W>>0],C=C+1|0,W=W+1|0;ar[r>>2]=C}break;case 4:for(W=0|ar[r>>2],I=f=o?f+1|0:f;!(n>>>0<=I>>>0)&&!((C=0|tr[I>>0])<<24>>24<=-1)&&2048&or[(0|ar[g>>2])+(C<<24>>24<<1)>>1];)I=I+1|0;if(m){for(B=d;f>>>0<I>>>0&(C=0<(0|B));)C=0|tr[(G=I+-1|0)>>0],E=0|ar[r>>2],ar[r>>2]=E+1,tr[E>>0]=C,B=B+-1|0,I=G;for(E=C?0|fs[63&ar[28+(0|ar[t>>2])>>2]](t,48):0,C=B;B=0|ar[r>>2],ar[r>>2]=B+1,!((0|C)<=0);)tr[B>>0]=E,C=C+-1|0;tr[B>>0]=c}e:do{if((0|I)==(0|f))E=0|fs[63&ar[28+(0|ar[t>>2])>>2]](t,48),G=0|ar[r>>2],ar[r>>2]=G+1,tr[G>>0]=E;else for(G=B=(E=0|((C=(G=0|tr[p>>0])<<24>>24<0)?0|ar[y>>2]:255&G)?0|tr[(C?0|ar[u>>2]:u)>>0]:-1,0);;){if((0|I)==(0|f))break e;C=(0|G)==(0|E)?(E=0|ar[r>>2],ar[r>>2]=E+1,tr[E>>0]=l,E=(B=B+1|0)>>>0<((C=(E=0|tr[p>>0])<<24>>24<0)?0|ar[y>>2]:255&E)>>>0?(E=0|tr[(C?0|ar[u>>2]:u)+B>>0])<<24>>24==127?-1:E<<24>>24:G,0):G,_=0|tr[(X=I+-1|0)>>0],G=0|ar[r>>2],ar[r>>2]=G+1,tr[G>>0]=_,G=C+1|0,I=X}}while(0);if((0|W)!=(0|(C=0|ar[r>>2])))for(;;){if((C=C+-1|0)>>>0<=W>>>0)break A;_=0|tr[W>>0],tr[W>>0]=0|tr[C>>0],tr[C>>0]=_,W=W+1|0}}}while(0);V=V+1|0}if(1<(f=(C=(f=0|tr[k>>0])<<24>>24<0)?0|ar[Z>>2]:255&f)>>>0){for(W=(_=C?0|ar[b>>2]:b)+f|0,C=0|ar[r>>2],f=_;(0|(f=f+1|0))!=(0|W);)tr[C>>0]=0|tr[f>>0],C=C+1|0;ar[r>>2]=C}switch((176&i)<<24>>24){case 32:ar[e>>2]=ar[r>>2];break;case 16:break;default:ar[e>>2]=A}}function Xe(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s;if(u=ur=(s=ur)+31&-32,ur=ur+16|0,l=12+u|0,A|=0){if(r=0|bf(r,54272),e){for(ks[63&ar[44+(0|ar[r>>2])>>2]](l,r),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[32+(0|ar[r>>2])>>2]](u,r),(0|tr[(A=a+8+3|0)>>0])<0?(i=0|ar[a>>2],ar[l>>2]=0,sf(i,l),ar[a+4>>2]=0):(ar[l>>2]=0,sf(a,l),tr[A>>0]=0),ql(a,0),ar[a>>2]=ar[u>>2],ar[a+4>>2]=ar[4+u>>2],ar[a+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Pl(u)}else{for(ks[63&ar[40+(0|ar[r>>2])>>2]](l,r),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[28+(0|ar[r>>2])>>2]](u,r),(0|tr[(A=a+8+3|0)>>0])<0?(i=0|ar[a>>2],ar[l>>2]=0,sf(i,l),ar[a+4>>2]=0):(ar[l>>2]=0,sf(a,l),tr[A>>0]=0),ql(a,0),ar[a>>2]=ar[u>>2],ar[a+4>>2]=ar[4+u>>2],ar[a+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Pl(u)}for(A=0|is[127&ar[12+(0|ar[r>>2])>>2]](r),ar[f>>2]=A,A=0|is[127&ar[16+(0|ar[r>>2])>>2]](r),ar[n>>2]=A,ks[63&ar[20+(0|ar[r>>2])>>2]](u,r),A=((0|tr[(A=t+11|0)>>0])<0?(A=0|ar[t>>2],tr[l>>0]=0,Ni(A,l),ar[t+4>>2]=0):(tr[l>>0]=0,Ni(t,l),tr[A>>0]=0),t),Ml(t,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);for(Yl(u),ks[63&ar[24+(0|ar[r>>2])>>2]](u,r),(0|tr[(A=o+8+3|0)>>0])<0?(t=0|ar[o>>2],ar[l>>2]=0,sf(t,l),ar[o+4>>2]=0):(ar[l>>2]=0,sf(o,l),tr[A>>0]=0),ql(o,0),ar[o>>2]=ar[u>>2],ar[o+4>>2]=ar[4+u>>2],ar[o+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Pl(u),A=0|is[127&ar[36+(0|ar[r>>2])>>2]](r)}else{if(r=0|bf(r,54264),e){for(ks[63&ar[44+(0|ar[r>>2])>>2]](l,r),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[32+(0|ar[r>>2])>>2]](u,r),(0|tr[(A=a+8+3|0)>>0])<0?(i=0|ar[a>>2],ar[l>>2]=0,sf(i,l),ar[a+4>>2]=0):(ar[l>>2]=0,sf(a,l),tr[A>>0]=0),ql(a,0),ar[a>>2]=ar[u>>2],ar[a+4>>2]=ar[4+u>>2],ar[a+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Pl(u)}else{for(ks[63&ar[40+(0|ar[r>>2])>>2]](l,r),A=0|ar[l>>2],tr[i>>0]=A,tr[i+1>>0]=A>>8,tr[i+2>>0]=A>>16,tr[i+3>>0]=A>>24,ks[63&ar[28+(0|ar[r>>2])>>2]](u,r),(0|tr[(A=a+8+3|0)>>0])<0?(i=0|ar[a>>2],ar[l>>2]=0,sf(i,l),ar[a+4>>2]=0):(ar[l>>2]=0,sf(a,l),tr[A>>0]=0),ql(a,0),ar[a>>2]=ar[u>>2],ar[a+4>>2]=ar[4+u>>2],ar[a+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Pl(u)}for(A=0|is[127&ar[12+(0|ar[r>>2])>>2]](r),ar[f>>2]=A,A=0|is[127&ar[16+(0|ar[r>>2])>>2]](r),ar[n>>2]=A,ks[63&ar[20+(0|ar[r>>2])>>2]](u,r),A=((0|tr[(A=t+11|0)>>0])<0?(A=0|ar[t>>2],tr[l>>0]=0,Ni(A,l),ar[t+4>>2]=0):(tr[l>>0]=0,Ni(t,l),tr[A>>0]=0),t),Ml(t,0),ar[A>>2]=ar[u>>2],ar[A+4>>2]=ar[4+u>>2],ar[A+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);for(Yl(u),ks[63&ar[24+(0|ar[r>>2])>>2]](u,r),(0|tr[(A=o+8+3|0)>>0])<0?(t=0|ar[o>>2],ar[l>>2]=0,sf(t,l),ar[o+4>>2]=0):(ar[l>>2]=0,sf(o,l),tr[A>>0]=0),ql(o,0),ar[o>>2]=ar[u>>2],ar[o+4>>2]=ar[4+u>>2],ar[o+8>>2]=ar[8+u>>2],A=0;3!=(0|A);)A=A+1|(ar[u+(A<<2)>>2]=0);Pl(u),A=0|is[127&ar[36+(0|ar[r>>2])>>2]](r)}ar[c>>2]=A,ur=s}function _e(A,e,r,i,f,n,t,o,a,c,l,u,s,b,d){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0,b|=0,d|=0;var k,h,w,v,g,m,p,y,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0;for(ar[(r|=0)>>2]=A,k=b+8+3|0,y=b+4|0,h=s+8+3|0,w=s+4|0,v=0==(512&i|0),g=0<(0|d),m=u+11|0,p=u+4|0,_=0;4!=(0|_);){A:do{switch(0|tr[a+_>>0]){case 0:ar[e>>2]=ar[r>>2];break;case 1:ar[e>>2]=ar[r>>2],V=0|fs[63&ar[44+(0|ar[t>>2])>>2]](t,32),X=0|ar[r>>2],ar[r>>2]=X+4,ar[X>>2]=V;break;case 3:0|((Z=(X=0|tr[k>>0])<<24>>24<0)?0|ar[y>>2]:255&X)&&(V=0|ar[(Z?0|ar[b>>2]:b)>>2],X=0|ar[r>>2],ar[r>>2]=X+4,ar[X>>2]=V);break;case 2:if(!(v|0==(0|(B=(Z=(B=0|tr[h>>0])<<24>>24<0)?0|ar[w>>2]:255&B)))){for(C=(I=Z?0|ar[s>>2]:s)+(B<<2)|0,Z=W=0|ar[r>>2];(0|I)!=(0|C);)ar[Z>>2]=ar[I>>2],Z=Z+4|0,I=I+4|0;ar[r>>2]=W+(B<<2)}break;case 4:for(C=0|ar[r>>2],Z=f=o?f+4|0:f;!(n>>>0<=Z>>>0)&&0|ns[63&ar[12+(0|ar[t>>2])>>2]](t,2048,0|ar[Z>>2]);)Z=Z+4|0;if(g){for(I=d;f>>>0<Z>>>0&(W=0<(0|I));)G=0|ar[(X=Z+-4|0)>>2],V=0|ar[r>>2],ar[r>>2]=V+4,ar[V>>2]=G,I=I+-1|0,Z=X;for(E=W?0|fs[63&ar[44+(0|ar[t>>2])>>2]](t,48):0,B=0|ar[r>>2];W=B+4|0,!((0|I)<=0);)ar[B>>2]=E,I=I+-1|0,B=W;ar[r>>2]=W,ar[B>>2]=c}if((0|Z)==(0|f))V=0|fs[63&ar[44+(0|ar[t>>2])>>2]](t,48),Z=(X=0|ar[r>>2])+4|0,ar[r>>2]=Z,ar[X>>2]=V;else{for(V=(X=0|tr[m>>0])<<24>>24<0,X&=255,E=W=(B=0|(V?0|ar[p>>2]:X)?0|tr[(V?0|ar[u>>2]:u)>>0]:-1,0);(0|Z)!=(0|f);)I=0|ar[r>>2],(0|E)==(0|B)&&(G=I+4|0,ar[r>>2]=G,ar[I>>2]=l,I=(E=(B=(W=W+1|0)>>>0<(V?0|ar[p>>2]:X)>>>0?(B=0|tr[(V?0|ar[u>>2]:u)+W>>0])<<24>>24==127?-1:B<<24>>24:E,0),G)),F=0|ar[(G=Z+-4|0)>>2],ar[r>>2]=I+4,ar[I>>2]=F,E=E+1|0,Z=G;Z=0|ar[r>>2]}if((0|C)!=(0|Z))for(;;){if((Z=Z+-4|0)>>>0<=C>>>0)break A;F=0|ar[C>>2],ar[C>>2]=ar[Z>>2],ar[Z>>2]=F,C=C+4|0}}}while(0);_=_+1|0}if(1<(f=(Z=(f=0|tr[k>>0])<<24>>24<0)?0|ar[y>>2]:255&f)>>>0){for(I=(Z=Z?0|ar[b>>2]:b)+4|0,W=(Z=Z+(f<<2)|0)-I|0,f=C=0|ar[r>>2];(0|I)!=(0|Z);)ar[f>>2]=ar[I>>2],f=f+4|0,I=I+4|0;ar[r>>2]=C+(W>>>2<<2)}switch((176&i)<<24>>24){case 32:ar[e>>2]=ar[r>>2];break;case 16:break;default:ar[e>>2]=A}}function Fe(A,e,r){e|=0,r|=0;var i,f,n,t,o=0;ur=(i=ur)+16|0,f=i,A=0|ar[(A|=0)>>2],e=0|uA(0|e),n=0|qo((o=(t=(o=0|tr[r+11>>0])<<24>>24<0)?0|ar[r+4>>2]:255&o)+4|0),ar[n>>2]=o,Eu(4+n|0,0|(t?0|ar[r>>2]:r),0|o),ar[f>>2]=n,r=0|dA(1680,0|f),bA(0|A,0|e,0|r),cA(0|r),cA(0|e),ur=i}function Ne(A,e,r){e|=0,r|=0;var i,f;ur=(i=ur)+16|0,f=i,A=0|ar[(A|=0)>>2],e=0|uA(0|e),ar[f>>2]=ar[r>>2],r=0|dA(3744,0|f),bA(0|A,0|e,0|r),cA(0|r),cA(0|e),ur=i}function Re(A,e){e|=0;var r,i,f,n=0,t=0;if(ar[(A|=0)>>2]=0,ar[(f=A+4|0)>>2]=0,(r=(n=((ar[A+8>>2]=0)|ar[(i=e+4|0)>>2])-(0|ar[e>>2])|0)>>3)&&(536870911<r>>>0&&il(),t=0|El(n),ar[f>>2]=t,ar[A>>2]=t,ar[A+8>>2]=t+(r<<3),(0|(n=0|ar[e>>2]))!=(0|(e=0|ar[i>>2]))))for(;ar[t>>2]=ar[n>>2],A=0|ar[n+4>>2],0|(ar[t+4>>2]=A)&&Cl(A),n=n+8|0,t=8+(0|ar[f>>2])|0,ar[f>>2]=t,(0|n)!=(0|e););}function Ye(A){A|=0;var e,r,i,f,n;i=0|El(64),ar[4+i>>2]=0,ar[8+i>>2]=0,ar[i>>2]=5420,n=f=12+i|0,ar[(n|=0)>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,ar[n+12>>2]=0,ar[n+16>>2]=0,ar[n+20>>2]=26780,ar[n+24>>2]=0,ar[n+28>>2]=0,ar[n+32>>2]=99,ar[n+36>>2]=99,ar[n+44>>2]=0,ar[n+48>>2]=0,ar[n+40>>2]=n+44,ar[A>>2]=f,r=ar[A+4>>2]=i,0|(A=0|ar[(e=16+i|0)>>2])&&-1!=(0|ar[A+4>>2])||(Cl(i),Wl(i),A=0|ar[e>>2],ar[f>>2]=f,ar[e>>2]=r,0|A&&Bl(A),Il(i))}function Je(A,e,r){e|=0,r|=0;var i=0;return 0|(A|=0)&&0|(i=0|ar[A>>2])?0|(i=0|Qc(i,e,r)):(i=ar[r>>2]=0)|i}function De(A,e){var r=0,i=0,f=0,n=0,t=0,o=0,a=0;if((e|=0)>>>0<=(f=0|ar[(o=(A|=0)+8|0)>>2])-(r=0|ar[(a=A+4|0)>>2])>>3>>>0)for(;ar[(o=r)>>2]=0,r=8+((ar[o+4>>2]=0)|ar[a>>2])|0,ar[a>>2]=r,0!=(0|(e=e+-1|0)););else{536870911<(r=(n=r-(i=0|ar[A>>2])>>3)+e|0)>>>0&&il(),t=(f=f-i|0)>>2,r=f>>3>>>0<268435455?t>>>0<r>>>0?r:t:536870911;do{if(r){if(!(536870911<r>>>0)){i=0|El(r<<3);break}Fl(a=0|C(8),37845),ar[a>>2]=16004,I(0|a,3616,283)}else i=0}while(0);for(t=i+(n<<3)|0,n=i+(r<<3)|0,f=r=t;ar[(i=r)>>2]=0,f=r=f+8|(ar[i+4>>2]=0),0!=(0|(e=e+-1|0)););e=0|ar[A>>2],r=t+(0-((i=(0|ar[a>>2])-e|0)>>3)<<3)|0,0<(0|i)&&Eu(0|r,0|e,0|i),ar[A>>2]=r,ar[a>>2]=f,ar[o>>2]=n,e&&Vl(e)}}function Qe(A,e){A|=0,(e|=0)&&(Qe(A,0|ar[e>>2]),Qe(A,0|ar[e+4>>2]),0|(A=0|ar[e+24>>2])&&Il(A),Vl(e))}function Te(A){var e,r=0,i=0,f=0,n=0;if(0|(r=0|ar[(A|=0)+64>>2])&&Il(r),0|(r=0|ar[A+56>>2])&&Il(r),0|(r=0|ar[(e=A+40|0)>>2])){if((0|(i=0|ar[(n=A+44|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}Qe(A+28|0,0|ar[A+32>>2]),function A(e,r){return e|=0,(r|=0)&&(A(e,0|ar[r>>2]),A(e,0|ar[r+4>>2]),void Vl(r))}(A+16|0,0|ar[A+20>>2]),0<=(0|tr[A+11>>0])||Vl(0|ar[A>>2])}function Me(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;f=0|ar[(u=(A|=0)+4|0)>>2],c=n=0|ar[A>>2],536870911<(t=1+(r=f-n>>3)|0)>>>0&&il(),o=(l=(0|ar[(i=A+8|0)>>2])-n|0)>>2,o=l>>3>>>0<268435455?o>>>0<t>>>0?t:o:536870911;do{if(o){if(!(536870911<o>>>0)){a=0|El(o<<3);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else a=0}while(0);if(l=a+(o<<3)|0,ar[(t=n=a+(r<<3)|0)>>2]=ar[e>>2],o=0|ar[e+4>>2],o=(ar[a+(r<<3)+4>>2]=o)?(Cl(o),f=0|ar[u>>2],0|ar[A>>2]):c,a=n+8|0,(0|f)!=(0|o)){for(;f=(c=f)+-8|0,ar[n+-8>>2]=ar[f>>2],c=c+-4|0,ar[n+-4>>2]=ar[c>>2],ar[f>>2]=0,t=n=t+-8|(ar[c>>2]=0),(0|f)!=(0|o););o=0|ar[A>>2],f=0|ar[u>>2]}if(ar[A>>2]=t,ar[u>>2]=a,ar[i>>2]=l,(0|f)!=(0|(t=o)))for(;n=0|ar[f+-4>>2],f=f+-8|0,0|n&&Il(n),(0|f)!=(0|t););o&&Vl(o)}function Se(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;f=0|ar[(u=(A|=0)+4|0)>>2],c=n=0|ar[A>>2],536870911<(t=1+(r=f-n>>3)|0)>>>0&&il(),o=(l=(0|ar[(i=A+8|0)>>2])-n|0)>>2,o=l>>3>>>0<268435455?o>>>0<t>>>0?t:o:536870911;do{if(o){if(!(536870911<o>>>0)){a=0|El(o<<3);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else a=0}while(0);if(l=a+(o<<3)|0,ar[(t=n=a+(r<<3)|0)>>2]=ar[e>>2],o=0|ar[e+4>>2],o=(ar[a+(r<<3)+4>>2]=o)?(Cl(o),f=0|ar[u>>2],0|ar[A>>2]):c,a=n+8|0,(0|f)!=(0|o)){for(;f=(c=f)+-8|0,ar[n+-8>>2]=ar[f>>2],c=c+-4|0,ar[n+-4>>2]=ar[c>>2],ar[f>>2]=0,t=n=t+-8|(ar[c>>2]=0),(0|f)!=(0|o););o=0|ar[A>>2],f=0|ar[u>>2]}if(ar[A>>2]=t,ar[u>>2]=a,ar[i>>2]=l,(0|f)!=(0|(t=o)))for(;n=0|ar[f+-4>>2],f=f+-8|0,0|n&&Il(n),(0|f)!=(0|t););o&&Vl(o)}function Ue(A){var e=0,r=0,i=0,f=0,n=0;if(0|(e=0|ar[(f=(A|=0)+68|0)>>2])){if((0|(r=0|ar[(n=A+72|0)>>2]))!=(0|e)){for(i=r;r=i+-8|0,ar[n>>2]=r,(i=0|ar[i+-4>>2])&&(Il(i),r=0|ar[n>>2]),(0|r)!=(0|e);)i=r;e=0|ar[f>>2]}Vl(e)}if(0|(e=0|ar[A+64>>2])&&Il(e),0|(e=0|ar[(f=A+40|0)>>2])){if((0|(r=0|ar[(n=A+44|0)>>2]))!=(0|e)){for(;i=r+-8|0,ar[n>>2]=i,(0|(r=(r=0|ar[r+-4>>2])?(Il(r),0|ar[n>>2]):i))!=(0|e););e=0|ar[f>>2]}Vl(e)}0<=(0|tr[A+11>>0])||Vl(0|ar[A>>2])}function Oe(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o,a=0,c=0,l=0;if(ur=(o=ur)+32|0,t=o,l=0|El(112),ar[l+4>>2]=0,ar[l+8>>2]=0,ar[l>>2]=5892,Ic(a=l+12|0),ar[(f=e+60|0)>>2]=a,n=0|ar[(c=e+64|0)>>2],ar[c>>2]=l,n&&(Il(n),a=0|ar[f>>2]),Xc(t,a,r,i),0|ar[t>>2])return l=0|ar[(i=t)+4>>2],ar[(c=A)>>2]=ar[i>>2],ar[c+4>>2]=l,l=t+8|0,ar[(c=A+8|0)>>2]=ar[l>>2],ar[c+4>>2]=ar[l+4>>2],ar[c+8>>2]=ar[l+8>>2],ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,void(ur=o);!function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0,fA=0,nA=0,tA=0,oA=0,aA=0,cA=0,lA=0,uA=0,sA=0,bA=0,dA=0,kA=0,hA=0,wA=0,vA=0,gA=0;if(ur=(w=ur)+352|0,vA=w+332|0,h=w+308|0,N=w+320|0,o=w+296|0,a=w+284|0,aA=w+272|0,cA=w+264|0,gA=w+24|0,c=(s=w)+120|0,r=w+104|0,i=w+92|0,dA=w+80|0,b=w+68|0,d=w+56|0,k=w+48|0,Qe(f=(e|=0)+28|0,0|ar[(wA=e+32|0)>>2]),ar[(F=e+36|0)>>2]=0,ar[f>>2]=wA,m=(ar[wA>>2]=0)|ar[(n=e+40|0)>>2],(0|(v=0|ar[(t=e+44|0)>>2]))!=(0|m))for(;g=v+-8|0,ar[t>>2]=g,(0|(v=(v=0|ar[v+-4>>2])?(Il(v),0|ar[t>>2]):g))!=(0|m););if(v=(ar[(X=e+52|0)>>2]=0)|ar[(_=e+56|0)>>2],(ar[_>>2]=0)|v&&Il(v),Ec(h,0|ar[(l=e+60|0)>>2]),(0|(v=0|ar[h>>2]))!=(0|(I=0|ar[(u=4+h|0)>>2]))){E=vA+4|0,G=(B=e)+32|0,V=e+48|0;do{W=0|ar[v>>2],y=76+(0|ar[l>>2])|0,m=0|ar[y>>2];do{if(0|m){g=y;A:for(;;){for(p=m;!((0|ar[p+16>>2])>>>0>=W>>>0);){if(!(m=0|ar[p+4>>2]))break A;p=m}if(!(m=0|ar[p>>2])){g=p;break}g=p}if((0|g)!=(0|y)&&(0|ar[g+16>>2])>>>0<=W>>>0){if(m=0|ar[g+20>>2],C=(g=0|ar[g+24>>2])?(Cl(g),g):0,!m){if(!C)break;Il(C);break}if(!(0|tr[m+124>>0])){g=0|El(92),ar[g+4>>2]=0,ar[g+8>>2]=0,ar[g>>2]=5920,ar[(m=g+12|0)>>2]=0,ar[m+4>>2]=0,ar[m+8>>2]=0,ar[g+24>>2]=26780,ar[g+28>>2]=B,ar[g+32>>2]=W,bA=g+52|0,p=g+72|0,ar[(sA=g+36|0)>>2]=0,ar[sA+4>>2]=0,or[sA+8>>1]=0,ar[bA>>2]=0,ar[bA+4>>2]=0,ar[bA+8>>2]=0,tr[bA+12>>0]=0,ar[p>>2]=0,ar[p+4>>2]=0,ar[p+8>>2]=0,ar[p+12>>2]=0,ar[p+16>>2]=0,ar[vA>>2]=m,p=ar[E>>2]=g,(0|W)==(0|ar[96+(0|ar[l>>2])>>2])?(tr[g+44>>0]=1,Cl(g),ar[X>>2]=m,g=0|ar[_>>2],ar[_>>2]=p,0|g&&Il(g),g=0|ar[E>>2],m=0|ar[vA>>2],(p=g)?hA=25:Z=m):hA=25,25==(0|hA)&&(hA=0,Cl(g),Z=m),g=0|ar[wA>>2];do{if(g){for(y=G;;)if(W>>>0<(m=0|ar[g+16>>2])>>>0){if(!(m=0|ar[g>>2])){hA=30;break}y=g,g=m}else{if(W>>>0<=m>>>0){hA=34;break}if(!(m=0|ar[(y=g+4|0)>>2])){hA=33;break}g=m}if(30==(0|hA)){hA=0,y=m=g;break}if(33==(0|hA)){hA=0,m=g;break}if(34==(0|hA)){hA=0,m=g;break}}else y=m=wA}while(0);0|ar[y>>2]?0|p&&Il(p):(g=0|El(28),ar[g+16>>2]=W,ar[g+20>>2]=Z,ar[g+24>>2]=p,ar[g>>2]=0,ar[g+4>>2]=0,ar[g+8>>2]=m,ar[y>>2]=g,(m=0|ar[ar[f>>2]>>2])&&(ar[f>>2]=m,g=0|ar[y>>2]),Vc(0|ar[G>>2],g),ar[F>>2]=1+(0|ar[F>>2])),(0|(g=0|ar[t>>2]))==(0|ar[V>>2])?Me(n,vA):(ar[g>>2]=ar[vA>>2],m=0|ar[E>>2],(ar[g+4>>2]=m)&&(Cl(m),g=0|ar[t>>2]),ar[t>>2]=g+8),0|(g=0|ar[E>>2])&&Il(g)}0|C&&Il(C)}}}while(0);v=v+4|0}while((0|v)!=(0|I))}if(0|ar[X>>2]){sA=0|ar[l>>2],lA=0|ar[sA+64>>2],(bA=0==(0|(sA=0|ar[sA+68>>2])))||Cl(sA),uA=0!=(0|lA);A:do{if(uA){if(m=0|ar[n>>2],(0|(v=0|ar[t>>2]))!=(0|m))for(;g=v+-8|0,ar[t>>2]=g,(0|(v=(v=0|ar[v+-4>>2])?(Il(v),0|ar[t>>2]):g))!=(0|m););if((0|(v=0|ar[f>>2]))!=(0|wA))for(B=e+48|0,G=8+a|0,V=4+a|0,X=11+a|0,_=cA+4|0,F=aA+8|0,N=aA+4|0,e=aA+11|0,R=8+o|0,Y=4+o|0,J=11+o|0,D=gA+4|0,Q=gA+8|0,S=12+c|0,O=T=64+c|0,H=136+c|0,x=140+c|0,z=60+c|0,P=vA+11|0,L=M=8+c|0,K=11+r|0,q=(j=44+c|0)+11|0,$=E=vA+4|0,AA=11+c|0,eA=U=4+c|0,rA=8+i|0,iA=4+i|0,fA=11+i|0,tA=(nA=s+8|0)+11|0,oA=A+8|0,I=v;;){v=0|gc(lA,0|ar[20+(0|ar[(W=I+20|0)>>2])>>2]);e:do{if((0|v)<1953000802){switch(0|v){case 1635088492:break;default:hA=159;break e}if(ar[gA>>2]=0,ar[D>>2]=0,Fc(s,(ar[Q>>2]=0)|ar[l>>2],0|ar[20+(0|ar[W>>2])>>2],gA),0|ar[s>>2])W=0|ar[(C=s)+4>>2],ar[(p=A)>>2]=ar[C>>2],ar[p+4>>2]=W,ar[oA>>2]=ar[nA>>2],ar[oA+4>>2]=ar[nA+4>>2],ar[oA+8>>2]=ar[nA+8>>2],ar[nA>>2]=0,ar[nA+4>>2]=0,ar[nA+8>>2]=0,p=1;else{if((0|(v=0|ar[gA>>2]))!=(0|(C=0|ar[D>>2]))){Z=v,v=m=0;do{g=0|ar[Z+4>>2];do{if(g){if(!(y=0|lu(g,104,648,0)))break;g=y,(p=0|ar[Z+8>>2])?Cl(p):p=0;do{if(y){if(0|(m=p)&&Cl(p),!v){v=m;break}Il(v),v=m}else g=m}while(0);if(!p){m=g;break}Il(p),m=g}}while(0);Z=Z+12|0}while((0|Z)!=(0|C));if(g=m){mc(vA,lA,0|ar[20+(0|ar[W>>2])>>2]);do{if(4==((0|ar[$>>2])-(0|ar[vA>>2])|0)){if(Rl(c,g+56|0),25==(0|((g=0|tr[AA>>0])<<24>>24<0?0|ar[eA>>2]:255&g))?(m=0==(0|zl(c,0,-1,27006,25)),g=0|tr[AA>>0]):m=0,g<<24>>24<0&&Vl(0|ar[c>>2]),!m){g=0;break}Z=0|ar[W>>2],g=0|ar[vA>>2],p=0|ar[g>>2],tr[Z+52>>0]=1,ar[Z+56>>2]=p,p=0|ar[wA>>2];do{if(p){y=0|ar[g>>2],g=wA;r:for(;;){for(m=p;!((0|ar[m+16>>2])>>>0>=y>>>0);)if(!(m=0|ar[m+4>>2]))break r;if(!(p=0|ar[m>>2])){g=m;break}g=m}if((0|g)==(0|wA)){hA=135;break}y>>>0<(0|ar[g+16>>2])>>>0&&(hA=135)}else hA=135}while(0);if(135==(0|hA)&&(hA=0,g=wA),g=0|ar[g+20>>2],(p=0==(0|(m=0|ar[I+24>>2])))||(Cl(m),Cl(m)),ar[g+60>>2]=Z,g=0|ar[(W=g+64|0)>>2],ar[W>>2]=m,0|g&&Il(g),p){g=0;break}Il(m),g=0}else{for(ar[i>>2]=0,ar[4+i>>2]=0,g=(ar[8+i>>2]=0)|El(48),ar[i>>2]=g,ar[rA>>2]=-2147483600,y=26970,Z=(p=g)+(ar[iA>>2]=35)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););if(Cc(A,2,tr[g+35>>0]=0,i),0<=(0|tr[fA>>0])){g=1;break}Vl(0|ar[i>>2]),g=1}}while(0);0|(m=0|ar[vA>>2])&&((0|(p=0|ar[$>>2]))!=(0|m)&&(ar[$>>2]=p+(~((p+-4-m|0)>>>2)<<2)),Vl(m))}else hA=112}else v=0,hA=112;112==(0|hA)&&(hA=0,ar[M>>2]=4080,ar[c>>2]=164,ar[T>>2]=184,ar[U>>2]=0,Yi(O,S),ar[H>>2]=0,ar[x>>2]=-1,ar[c>>2]=4060,ar[T>>2]=4100,ar[M>>2]=4080,Ti(S),ar[S>>2]=3908,ar[j>>2]=0,ar[j+4>>2]=0,ar[j+8>>2]=0,ar[j+12>>2]=0,ar[z>>2]=24,ar[vA>>2]=0,ar[vA+4>>2]=0,ar[vA+8>>2]=0,Of(S,vA),(0|tr[P>>0])<0&&Vl(0|ar[vA>>2]),qi(C=0|Hf(L,26942,27),0|ar[20+(0|ar[W>>2])>>2]),jf(r,S),Cc(A,2,123,r),(0|tr[K>>0])<0&&Vl(0|ar[r>>2]),ar[c>>2]=4060,ar[T>>2]=4100,ar[L>>2]=4080,ar[S>>2]=3908,(0|tr[q>>0])<0&&Vl(0|ar[j>>2]),si(S),_i(),ci(T),g=1),p=(v&&Il(v),g)}if((0|tr[tA>>0])<0&&Vl(0|ar[nA>>2]),0|(v=0|ar[gA>>2])){if((0|(g=0|ar[D>>2]))!=(0|v)){for(;m=g+-12|0,ar[D>>2]=m,(0|(g=(g=0|ar[g+-4>>2])?(Il(g),0|ar[D>>2]):m))!=(0|v););v=0|ar[gA>>2]}Vl(v)}if(0|p)break A}else{switch(0|v){case 1953000802:break;default:hA=159;break e}mc(vA,lA,0|ar[20+(0|ar[W>>2])>>2]),v=C=0|ar[vA>>2];do{if(4==((0|ar[E>>2])-C|0)){if(y=0|ar[W>>2],m=0|ar[v>>2],tr[y+33>>0]=1,ar[y+36>>2]=m,0|(m=0|ar[wA>>2])){p=0|ar[v>>2],v=wA;r:for(;;){for(g=m;!((0|ar[g+16>>2])>>>0>=p>>>0);)if(!(g=0|ar[g+4>>2]))break r;if(!(m=0|ar[g>>2])){v=g;break}v=g}if((0|v)!=(0|wA)&&p>>>0>=(0|ar[v+16>>2])>>>0){if(g=0|ar[v+20>>2],0|tr[g+33>>0]){for(ar[aA>>2]=0,ar[aA+4>>2]=0,v=(ar[aA+8>>2]=0)|El(48),ar[aA>>2]=v,ar[F>>2]=-2147483600,y=26903,Z=(p=v)+(ar[N>>2]=38)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););if(tr[v+38>>0]=0,Cc(A,2,2e3,aA),0<=(0|tr[e>>0])){v=1;break}Vl(0|ar[aA>>2]),v=1;break}if(ar[cA>>2]=y,v=0|ar[I+24>>2],0|(ar[_>>2]=v)&&Cl(v),(0|(v=0|ar[(m=g+44|0)>>2]))==(0|ar[g+48>>2])?Me(g+40|0,cA):(ar[v>>2]=ar[cA>>2],g=0|ar[_>>2],(ar[v+4>>2]=g)&&(Cl(g),v=0|ar[m>>2]),ar[m>>2]=v+8),!(v=0|ar[_>>2])){v=0;break}Il(v),v=0;break}}for(ar[a>>2]=0,ar[4+a>>2]=0,v=(ar[8+a>>2]=0)|El(48),ar[a>>2]=v,ar[G>>2]=-2147483600,y=26861,Z=(p=v)+(ar[V>>2]=41)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););tr[v+41>>0]=0,Cc(A,2,2e3,a),v=((0|tr[X>>0])<0&&Vl(0|ar[a>>2]),1)}else{for(ar[o>>2]=0,ar[4+o>>2]=0,v=(ar[8+o>>2]=0)|El(32),ar[o>>2]=v,ar[R>>2]=-2147483616,y=26831,Z=(p=v)+(ar[Y>>2]=29)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););Cc(A,2,tr[v+29>>0]=0,o),v=((0|tr[J>>0])<0&&Vl(0|ar[o>>2]),1)}}while(0);if(0|(g=0|ar[vA>>2])&&((0|(m=0|ar[E>>2]))!=(0|g)&&(ar[E>>2]=m+(~((m+-4-g|0)>>>2)<<2)),Vl(g)),0|v)break A}}while(0);do{if(159==(0|hA)){if(((hA=0)|(v=0|ar[t>>2]))==(0|ar[B>>2])){Me(n,W);break}ar[v>>2]=ar[W>>2],g=0|ar[I+24>>2],(ar[v+4>>2]=g)&&(Cl(g),v=0|ar[t>>2]),ar[t>>2]=v+8}}while(0);if(v=0|ar[I+4>>2])for(;g=0|ar[v>>2];)v=g;else if(v=0|ar[(g=I+8|0)>>2],(0|ar[v>>2])!=(0|I))for(;I=0|ar[g>>2],v=0|ar[(g=I+8|0)>>2],(0|ar[v>>2])!=(0|I););if((0|v)==(0|wA)){hA=170;break}I=v}else hA=170}else hA=170}while(0);A:do{if(170==(0|hA)){v=0|ar[f>>2];e:do{if((0|v)!=(0|wA))for(B=gA+4|0,E=gA+8|0,X=12+c|0,_=4+c|0,F=G=64+c|0,N=136+c|0,e=140+c|0,Y=60+c|0,J=vA+11|0,D=V=8+c|0,Q=dA+11|0,T=(R=44+c|0)+11|0,S=(M=s+8|0)+11|0,U=A+8|0,I=v;;){if(C=I+20|0,ar[gA>>2]=0,ar[B>>2]=0,Fc(s,(ar[E>>2]=0)|ar[l>>2],0|ar[I+16>>2],gA),0|ar[s>>2])cA=0|ar[(aA=s)+4>>2],ar[(v=A)>>2]=ar[aA>>2],ar[v+4>>2]=cA,ar[U>>2]=ar[M>>2],ar[U+4>>2]=ar[M+4>>2],ar[U+8>>2]=ar[M+8>>2],ar[M>>2]=0,ar[M+4>>2]=0,ar[M+8>>2]=0,v=1;else{g=0|ar[gA>>2],W=0|ar[B>>2];r:do{if((0|g)==(0|W))v=10;else for(v=0;;){m=0|ar[(Z=g+4|0)>>2];do{if(0!=(0|m)&&0!=(0|(kA=0|lu(m,104,680,0)))){if((m=0|ar[g+8>>2])?Cl(m):m=0,(p=0|ar[kA+56>>2])>>>0<2147483647&(y=0|ar[kA+60>>2])>>>0<2147483647){hA=0|ar[C>>2],ar[hA+24>>2]=p,ar[hA+28>>2]=y,hA=190;break}ar[V>>2]=4080,ar[c>>2]=164,ar[G>>2]=184,ar[_>>2]=0,Yi(F,X),ar[N>>2]=0,ar[e>>2]=-1,ar[c>>2]=4060,ar[G>>2]=4100,ar[V>>2]=4080,Ti(X),ar[X>>2]=3908,ar[R>>2]=0,ar[R+4>>2]=0,ar[R+8>>2]=0,ar[R+12>>2]=0,ar[Y>>2]=24,ar[vA>>2]=0,ar[vA+4>>2]=0,ar[vA+8>>2]=0,Of(X,vA),(0|tr[J>>0])<0&&Vl(0|ar[vA>>2]),Hf(0|Ki(0|Hf(0|Ki(0|Hf(0|qi(0|Hf(0|qi(0|Hf(D,27032,11),p),26704,1),y),27044,32),2147483647),26704,1),2147483647),26620,1),jf(dA,X),Cc(A,6,1e3,dA),(0|tr[Q>>0])<0&&Vl(0|ar[dA>>2]),ar[c>>2]=4060,ar[G>>2]=4100,ar[D>>2]=4080,ar[X>>2]=3908,(0|tr[T>>0])<0&&Vl(0|ar[R>>2]),si(X),_i(),ci(G),p=1,hA=205}else hA=180}while(0);180==(0|hA)&&(hA=0,v?(m=0,hA=190):v=0);do{if(190==(0|hA))if(v=0|ar[Z>>2]){y=(p=0|lu(v,104,552,0))?((v=0|ar[g+8>>2])?Cl(v):v=0,y=0|ar[C>>2],cA=0|wc(p),hA=0|vc(p),ar[y+24>>2]=cA,ar[y+28>>2]=hA,v):0,v=0|ar[Z>>2];do{if(0|v){if(!(p=0|lu(v,104,616,0)))break;switch((v=0|ar[g+8>>2])?Cl(v):v=0,0|ar[p+56>>2]){case 270:case 90:hA=(aA=0|ar[C>>2])+28|0,cA=0|ar[(aA=aA+24|0)>>2],ar[aA>>2]=ar[hA>>2],ar[hA>>2]=cA}if(!v)break;Il(v)}}while(0);if(!y){p=0,v=1,hA=205;break}Il(y),p=0,v=1,hA=205}else p=0,v=1,hA=205}while(0);if(205==(0|hA)&&((hA=0)|m&&Il(m),p)){v=1;break r}if((0|(g=g+12|0))==(0|W)){v=10;break}}}while(0);v=10==(0|v)?0:v,(0|tr[S>>0])<0&&Vl(0|ar[M>>2])}if(0|(g=0|ar[gA>>2])){if((0|(m=0|ar[B>>2]))!=(0|g)){for(;p=m+-12|0,ar[B>>2]=p,(0|(m=(m=0|ar[m+-4>>2])?(Il(m),0|ar[B>>2]):p))!=(0|g););g=0|ar[gA>>2]}Vl(g)}switch(0|v){case 8:break e;case 0:break;default:break A}if(v=0|ar[I+4>>2])for(;g=0|ar[v>>2];)v=g;else if(v=0|ar[(g=I+8|0)>>2],(0|ar[v>>2])!=(0|I))for(;cA=0|ar[g>>2],v=0|ar[(g=cA+8|0)>>2],(0|ar[v>>2])!=(0|cA););if((0|v)==(0|wA))break e;I=v}}while(0);if((0|(g=0|ar[h>>2]))==(0|(I=0|ar[u>>2])))v=A+8|0;else{B=vA+11|0,E=vA+4|0,G=s+4|0,V=8+d|0,X=4+d|0,_=11+d|0,F=4+k|0,N=8+b|0,e=4+b|0,R=11+b|0,J=(Y=gA+8|0)+11|0,v=A+8|0;do{if(m=0|ar[g>>2],_c(vA,0|ar[l>>2],m),4==(0|((kA=0|tr[B>>0])<<24>>24<0?0|ar[E>>2]:255&kA))&&0==(0|zl(vA,0,-1,27077,4))){W=0|El(36),ar[W+4>>2]=0,ar[W+8>>2]=0,ar[W>>2]=5948,ar[(kA=W+12|0)>>2]=0,ar[kA+4>>2]=0,ar[kA+8>>2]=0,ar[kA+12>>2]=0,ar[kA+16>>2]=0,ar[kA+20>>2]=0,Jl(C=kA,vA),Nc(gA,0|ar[l>>2],m,W+24|0);do{if(0|ar[gA>>2])kA=0|ar[(dA=gA)+4>>2],ar[(m=A)>>2]=ar[dA>>2],ar[m+4>>2]=kA,ar[v>>2]=ar[Y>>2],ar[v+4>>2]=ar[Y+4>>2],ar[v+8>>2]=ar[Y+8>>2],ar[Y>>2]=0,ar[Y+4>>2]=0,ar[Y+8>>2]=0,m=1;else if(uA){if(1667527523==(0|gc(lA,m))){mc(s,lA,m),m=0|ar[s>>2];e:do{if(4==((0|ar[G>>2])-m|0)){Z=0|ar[m>>2],p=0|ar[wA>>2];do{if(0|p){m=wA;r:for(;;){for(y=p;!((0|ar[y+16>>2])>>>0>=Z>>>0);){if(!(p=0|ar[y+4>>2]))break r;y=p}if(!(p=0|ar[y>>2])){m=y;break}m=y}if((0|m)==(0|wA))break;if(Z>>>0<(0|ar[m+16>>2])>>>0)break;if(p=0|ar[m+20>>2],ar[k>>2]=C,Cl(ar[F>>2]=W),(0|(m=0|ar[(y=p+72|0)>>2]))==(0|ar[p+76>>2])?Se(p+68|0,k):(ar[m>>2]=ar[k>>2],p=0|ar[F>>2],(ar[m+4>>2]=p)&&(Cl(p),m=0|ar[y>>2]),ar[y>>2]=m+8),!(m=0|ar[F>>2])){m=0;break e}Il(m),m=0;break e}}while(0);for(ar[d>>2]=0,ar[4+d>>2]=0,m=(ar[8+d>>2]=0)|El(48),ar[d>>2]=m,ar[V>>2]=-2147483600,y=27124,Z=(p=m)+(ar[X>>2]=40)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););if(tr[m+40>>0]=0,Cc(A,2,2e3,d),0<=(0|tr[_>>0])){m=1;break}Vl(0|ar[d>>2]),m=1}else{for(ar[b>>2]=0,ar[4+b>>2]=0,m=(ar[8+b>>2]=0)|El(48),ar[b>>2]=m,ar[N>>2]=-2147483600,y=27082,Z=(p=m)+(ar[e>>2]=41)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););if(Cc(A,2,tr[m+41>>0]=0,b),0<=(0|tr[R>>0])){m=1;break}Vl(0|ar[b>>2]),m=1}}while(0);if(0|(p=0|ar[s>>2])&&((0|(y=0|ar[G>>2]))!=(0|p)&&(ar[G>>2]=y+(~((y+-4-p|0)>>>2)<<2)),Vl(p)),0|m){m=1;break}}m=0}else m=0}while(0);(0|tr[J>>0])<0&&Vl(0|ar[Y>>2]),Il(W),m?m=1:hA=263}else hA=263;if(263==(0|hA)&&(m=hA=0),(0|tr[B>>0])<0&&Vl(0|ar[vA>>2]),g=g+4|0,0|m)break A}while((0|g)!=(0|I))}vA=0|ar[(wA=49920)+4>>2],ar[(gA=A)>>2]=ar[wA>>2],ar[gA+4>>2]=vA,Rl(v,49928)}}while(0);bA||Il(sA)}else{for(ar[N>>2]=0,ar[N+4>>2]=0,v=(ar[N+8>>2]=0)|El(48),ar[N>>2]=v,ar[N+8>>2]=-2147483600,y=26788,Z=(p=v)+(ar[N+4>>2]=42)|0;tr[p>>0]=0|tr[y>>0],y=y+1|0,(0|(p=p+1|0))<(0|Z););tr[v+42>>0]=0,Cc(A,2,2e3,N),(0|tr[N+11>>0])<0&&Vl(0|ar[N>>2])}ur=((A=0|ar[h>>2])&&((0|(v=0|ar[u>>2]))!=(0|A)&&(ar[u>>2]=v+(~((v+-4-A|0)>>>2)<<2)),Vl(A)),w)}(A,e),ur=(0<=(0|tr[t+8+11>>0])||Vl(0|ar[t+8>>2]),o)}function He(A,e,r,i,f,n){A|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c=0,l=0,u=0;ur=(a=ur)+48|0,t=(o=a)+32|0,l=a+20|0,xe(o,0|ar[(e|=0)+16>>2],0|ar[e+20>>2],r,n);do{if(0|ar[o>>2])u=0|ar[(r=o)+4>>2],ar[(l=A)>>2]=ar[r>>2],ar[l+4>>2]=u,u=o+8|0,ar[(l=A+8|0)>>2]=ar[u>>2],ar[l+4>>2]=ar[u+4>>2],ar[l+8>>2]=ar[u+8>>2],ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0;else{if(99==(0|f)&&(f=0|ar[36+(0|ar[r>>2])>>2]),n=0|ar[r>>2],u=0|ar[n+32>>2],!((0|(e=99==(0|i)?u:i))==(0|u)&&(0|f)==(0|ar[n+36>>2])||(Mc(t,n,e,f),u=0|ar[t>>2],i=0|ar[(n=4+t|0)>>2],ar[t>>2]=0,ar[n>>2]=0,ar[r>>2]=u,e=0|ar[(u=r+4|0)>>2],ar[u>>2]=i,0|e&&(Il(e),0|(c=0|ar[n>>2]))&&Il(c),0|ar[r>>2]))){if(ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,Cc(A,4,3003,l),0<=(0|tr[l+11>>0]))break;Vl(0|ar[l>>2]);break}u=0|ar[(r=o)+4>>2],ar[(l=A)>>2]=ar[r>>2],ar[l+4>>2]=u,u=o+8|0,ar[(l=A+8|0)>>2]=ar[u>>2],ar[l+4>>2]=ar[u+4>>2],ar[l+8>>2]=ar[u+8>>2],ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0}}while(0);ur=(0<=(0|tr[(e=o+8|0)+11>>0])||Vl(0|ar[e>>2]),a)}function xe(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u,s,b,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0;ur=(u=ur)+240|0,a=u+96|0,g=u+208|0,D=u+72|0,E=u+48|0,n=u+24|0,Z=u+196|0,C=(t=u)+172|0,p=u+184|0,W=u+160|0,y=u+148|0,w=u+136|0,I=u+128|0,o=u+116|0,_c(l=u+220|0,0|ar[(B=(e|=0)+60|0)>>2],r),Zc(a),k=0|tr[(c=11+l|0)>>0],d=0|ar[(h=4+l|0)>>2];do{if(4==(0|(k<<24>>24<0?d:255&k))){if(0|zl(l,0,-1,27385,4)){k=0|tr[c>>0],d=0|ar[h>>2],Y=59;break}if((0|(d=0|ar[e+16>>2]))!=(0|(v=e+20|0))){for(w=m=0,h=d;;){if(N=0|ar[h+16>>2],m=(R=(0|w)<(0|(d=0|is[127&ar[N+8>>2]](1))))?N:m,w=R?d:w,d=0|ar[h+4>>2])for(;k=0|ar[d>>2];)d=k;else if(d=0|ar[(k=h+8|0)>>2],(0|ar[d>>2])!=(0|h))for(;R=0|ar[k>>2],d=0|ar[(k=R+8|0)>>2],(0|ar[d>>2])!=(0|R););if((0|d)==(0|v))break;h=d}if(0|m){if(ar[D>>2]=0,ar[(g=D+4|0)>>2]=0,Nc(E,(ar[D+8>>2]=0)|ar[B>>2],r,D),k=0|ar[(h=E)+4>>2],ar[(d=a)>>2]=ar[h>>2],ar[d+4>>2]=k,k=E+8|0,(0|tr[(h=(d=8+a|0)+11|0)>>0])<0?(tr[ar[d>>2]>>0]=0,ar[12+a>>2]=0):(tr[d>>0]=0,tr[h>>0]=0),Ml(d,0),ar[d>>2]=ar[k>>2],ar[d+4>>2]=ar[k+4>>2],ar[d+8>>2]=ar[k+8>>2],0|ar[a>>2])N=0|ar[(F=a)+4>>2],ar[(R=A)>>2]=ar[F>>2],ar[R+4>>2]=N,ar[(R=A+8|0)>>2]=ar[d>>2],ar[R+4>>2]=ar[d+4>>2],ar[R+8>>2]=ar[d+8>>2],ar[d>>2]=0,ar[d+4>>2]=0,ar[d+8>>2]=0,d=1;else{ks[63&ar[m+12>>2]](n,E),v=0|ar[n>>2];do{if(v)h=0|ar[4+n>>2],k=0|ar[8+n>>2],ar[Z>>2]=0,ar[Z+4>>2]=0,4294967279<(w=(ar[Z+8>>2]=0)|ta(k))>>>0&&Nl(),w>>>0<11?(tr[Z+11>>0]=w)?(d=Z,Y=25):d=Z:(d=0|El(Y=w+16&-16),ar[Z>>2]=d,ar[Z+8>>2]=-2147483648|Y,ar[Z+4>>2]=w,Y=25),25==(0|Y)&&Eu(0|d,0|k,0|w),tr[d+w>>0]=0,Cc(A,v,h,Z),d=((0|tr[Z+11>>0])<0&&Vl(0|ar[Z>>2]),1);else{if(R=0|ar[D>>2],ws[31&ar[m+20>>2]](t,0|ar[E>>2],R,(0|ar[g>>2])-R|0),ar[n>>2]=ar[t>>2],ar[4+n>>2]=ar[t+4>>2],ar[8+n>>2]=ar[t+8>>2],0|ar[n>>2]){if(ds[511&ar[m+16>>2]](0|ar[E>>2]),h=0|ar[n>>2],w=0|ar[4+n>>2],k=0|ar[8+n>>2],ar[C>>2]=0,ar[C+4>>2]=0,4294967279<(v=(ar[C+8>>2]=0)|ta(k))>>>0&&Nl(),v>>>0<11?(tr[C+11>>0]=v)?(d=C,Y=34):d=C:(d=0|El(Y=v+16&-16),ar[C>>2]=d,ar[C+8>>2]=-2147483648|Y,ar[C+4>>2]=v,Y=34),34==(0|Y)&&Eu(0|d,0|k,0|v),tr[d+v>>0]=0,Cc(A,h,w,C),0<=(0|tr[C+11>>0])){d=1;break}Vl(0|ar[C>>2]),d=1;break}ar[t>>2]=0,hs[127&ar[m+24>>2]](p,0|ar[E>>2],t),ar[n>>2]=ar[p>>2],ar[4+n>>2]=ar[p+4>>2],ar[8+n>>2]=ar[p+8>>2];do{if(0|ar[n>>2])ds[511&ar[m+16>>2]](0|ar[E>>2]),h=0|ar[n>>2],w=0|ar[4+n>>2],k=0|ar[8+n>>2],ar[W>>2]=0,ar[W+4>>2]=0,4294967279<(v=(ar[W+8>>2]=0)|ta(k))>>>0&&Nl(),v>>>0<11?(tr[W+11>>0]=v)?(d=W,Y=43):d=W:(d=0|El(Y=v+16&-16),ar[W>>2]=d,ar[W+8>>2]=-2147483648|Y,ar[W+4>>2]=v,Y=43),43==(0|Y)&&Eu(0|d,0|k,0|v),tr[d+v>>0]=0,Cc(A,h,w,W),d=((0|tr[W+11>>0])<0&&Vl(0|ar[W>>2]),1);else{if(!(d=0|ar[t>>2])){if(ds[511&ar[m+16>>2]](0|ar[E>>2]),ar[y>>2]=0,ar[y+4>>2]=0,Cc(A,7,ar[y+8>>2]=0,y),0<=(0|tr[y+11>>0])){d=1;break}Vl(0|ar[y>>2]),d=1;break}R=0|ar[d>>2],N=0|ar[(F=d+4|0)>>2],ar[d>>2]=0,ar[F>>2]=0,ar[i>>2]=R,d=0|ar[(R=i+4|0)>>2],ar[R>>2]=N,0|d&&Il(d),s=0|ar[t>>2],(s|=0)&&(0|(b=0|ar[s+4>>2])&&Il(b),Vl(s)),ds[511&ar[m+16>>2]](0|ar[E>>2]),d=0}}while(0)}}while(0)}if(0|(k=0|ar[D>>2])&&((0|ar[g>>2])!=(0|k)&&(ar[g>>2]=k),Vl(k)),d)break;Y=120;break}}ar[g>>2]=0,ar[g+4>>2]=0,ar[g+8>>2]=0,Cc(A,4,3e3,g),(0|tr[g+11>>0])<0&&Vl(0|ar[g>>2])}else Y=59}while(0);A:do{if(59==(0|Y)){do{if(4==(0|(k<<24>>24<0?d:255&k))){if(0|zl(l,0,-1,27390,4)){k=0|tr[c>>0],d=0|ar[h>>2];break}if(ar[D>>2]=0,ar[(w=D+4|0)>>2]=0,Nc(E,(ar[D+8>>2]=0)|ar[B>>2],r,D),d=0|ar[(h=E)+4>>2],ar[(k=a)>>2]=ar[h>>2],ar[k+4>>2]=d,d=E+8|0,(0|tr[(h=(k=8+a|0)+11|0)>>0])<0?(tr[ar[k>>2]>>0]=0,ar[12+a>>2]=0):(tr[k>>0]=0,tr[h>>0]=0),Ml(k,0),ar[k>>2]=ar[d>>2],ar[k+4>>2]=ar[d+4>>2],ar[k+8>>2]=ar[d+8>>2],0|ar[a>>2]){Q=0|ar[(J=a)+4>>2],ar[(d=A)>>2]=ar[J>>2],ar[d+4>>2]=Q,ar[(d=A+8|0)>>2]=ar[k>>2],ar[d+4>>2]=ar[k+4>>2],ar[d+8>>2]=ar[k+8>>2],ar[k>>2]=0,ar[k+4>>2]=0,(ar[k+8>>2]=0)|(d=0|ar[D>>2])&&((0|ar[w>>2])!=(0|d)&&(ar[w>>2]=d),Vl(d));break A}if(je(E,e,r,i,D),R=0|ar[(N=E)+4>>2],ar[(d=a)>>2]=ar[N>>2],ar[d+4>>2]=R,d=E+8|0,(0|tr[h>>0])<0?(tr[ar[k>>2]>>0]=0,ar[12+a>>2]=0):(tr[k>>0]=0,tr[h>>0]=0),Ml(k,0),ar[k>>2]=ar[d>>2],ar[k+4>>2]=ar[d+4>>2],ar[k+8>>2]=ar[d+8>>2],0|ar[a>>2]){Q=0|ar[(J=a)+4>>2],ar[(d=A)>>2]=ar[J>>2],ar[d+4>>2]=Q,ar[(d=A+8|0)>>2]=ar[k>>2],ar[d+4>>2]=ar[k+4>>2],ar[d+8>>2]=ar[k+8>>2],ar[k>>2]=0,ar[k+4>>2]=0,(ar[k+8>>2]=0)|(d=0|ar[D>>2])&&((0|ar[w>>2])!=(0|d)&&(ar[w>>2]=d),Vl(d));break A}0|(d=0|ar[D>>2])&&((0|ar[w>>2])!=(0|d)&&(ar[w>>2]=d),Vl(d)),Y=120;break A}}while(0);do{if(4==(0|(k<<24>>24<0?d:255&k))){if(0|zl(l,0,-1,27395,4)){k=0|tr[c>>0],d=0|ar[h>>2];break}if(ze(D,e,r,i),k=0|ar[(h=D)+4>>2],ar[(d=a)>>2]=ar[h>>2],ar[d+4>>2]=k,k=D+8|0,(0|tr[(h=(d=8+a|0)+11|0)>>0])<0?(tr[ar[d>>2]>>0]=0,ar[12+a>>2]=0):(tr[d>>0]=0,tr[h>>0]=0),Ml(d,0),ar[d>>2]=ar[k>>2],ar[d+4>>2]=ar[k+4>>2],ar[d+8>>2]=ar[k+8>>2],!(0|ar[a>>2])){Y=120;break A}D=0|ar[(J=a)+4>>2],ar[(Q=A)>>2]=ar[J>>2],ar[Q+4>>2]=D,ar[(A=A+8|0)>>2]=ar[d>>2],ar[A+4>>2]=ar[d+4>>2],ar[A+8>>2]=ar[d+8>>2],ar[d>>2]=0,ar[d+4>>2]=0,ar[d+8>>2]=0;break A}}while(0);if(4==(0|(k<<24>>24<0?d:255&k))&&0==(0|zl(l,0,-1,27400,4))){if(ar[D>>2]=0,ar[(w=D+4|0)>>2]=0,Nc(E,(ar[D+8>>2]=0)|ar[B>>2],r,D),d=0|ar[(h=E)+4>>2],ar[(k=a)>>2]=ar[h>>2],ar[k+4>>2]=d,d=E+8|0,(0|tr[(h=(k=8+a|0)+11|0)>>0])<0?(tr[ar[k>>2]>>0]=0,ar[12+a>>2]=0):(tr[k>>0]=0,tr[h>>0]=0),Ml(k,0),ar[k>>2]=ar[d>>2],ar[k+4>>2]=ar[d+4>>2],ar[k+8>>2]=ar[d+8>>2],0|ar[a>>2]){Q=0|ar[(J=a)+4>>2],ar[(d=A)>>2]=ar[J>>2],ar[d+4>>2]=Q,ar[(d=A+8|0)>>2]=ar[k>>2],ar[d+4>>2]=ar[k+4>>2],ar[d+8>>2]=ar[k+8>>2],ar[k>>2]=0,ar[k+4>>2]=0,(ar[k+8>>2]=0)|(d=0|ar[D>>2])&&((0|ar[w>>2])!=(0|d)&&(ar[w>>2]=d),Vl(d));break}if(Pe(E,e,r,i,D),R=0|ar[(N=E)+4>>2],ar[(d=a)>>2]=ar[N>>2],ar[d+4>>2]=R,d=E+8|0,(0|tr[h>>0])<0?(tr[ar[k>>2]>>0]=0,ar[12+a>>2]=0):(tr[k>>0]=0,tr[h>>0]=0),Ml(k,0),ar[k>>2]=ar[d>>2],ar[k+4>>2]=ar[d+4>>2],ar[k+8>>2]=ar[d+8>>2],0|ar[a>>2]){Q=0|ar[(J=a)+4>>2],ar[(d=A)>>2]=ar[J>>2],ar[d+4>>2]=Q,ar[(d=A+8|0)>>2]=ar[k>>2],ar[d+4>>2]=ar[k+4>>2],ar[d+8>>2]=ar[k+8>>2],ar[k>>2]=0,ar[k+4>>2]=0,(ar[k+8>>2]=0)|(d=0|ar[D>>2])&&((0|ar[w>>2])!=(0|d)&&(ar[w>>2]=d),Vl(d));break}0|(d=0|ar[D>>2])&&((0|ar[w>>2])!=(0|d)&&(ar[w>>2]=d),Vl(d)),Y=120;break}ar[w>>2]=0,ar[w+4>>2]=0,ar[w+8>>2]=0,Cc(A,4,3001,w),(0|tr[w+11>>0])<0&&Vl(0|ar[w>>2])}}while(0);do{if(120==(0|Y)){if(0|(h=0|ar[(v=e+32|0)>>2])){d=v,w=h;A:for(;;){for(k=w;!((0|ar[k+16>>2])>>>0>=r>>>0);)if(!(k=0|ar[k+4>>2]))break A;if(!(w=0|ar[k>>2])){d=k;break}d=k}if((0|d)!=(0|v)&&(0|ar[d+16>>2])>>>0<=r>>>0){d=v;A:for(;;){for(k=h;!((0|ar[k+16>>2])>>>0>=r>>>0);)if(!(k=0|ar[k+4>>2]))break A;if(!(h=0|ar[k>>2])){d=k;break}d=k}if((0|d)!=(0|v)&&(0|ar[d+16>>2])>>>0<=r>>>0||(d=v),k=0|ar[d+20>>2],(p=0==(0|(m=0|ar[d+24>>2])))||Cl(m),d=0|ar[k+60>>2],(g=0==(0|(v=0|ar[k+64>>2])))||Cl(v),d?(ar[D>>2]=0,He(A,d,D,99,99,ar[(w=D+4|0)>>2]=0),k=0|ar[A>>2]?1:(d=0|ar[i>>2],ar[I>>2]=ar[D>>2],k=I+4|0,h=0|ar[w>>2],0|(ar[k>>2]=h)&&Cl(h),Tc(d,I,0,6),0|(d=0|ar[k>>2])&&Il(d),(0|tr[(d=A+8|0)+11>>0])<0&&Vl(0|ar[d>>2]),0),0|(d=0|ar[w>>2])&&Il(d),k?d=1:Y=149):Y=149,149==(0|Y)&&(d=0),g||Il(v),p||Il(m),0|d)break}}if(0==(0|f)||0==(0|tr[f>>0])){ar[D>>2]=0,ar[(R=D+4|0)>>2]=0,d=(ar[D+8>>2]=0)|ar[B>>2],k=0|ar[d+32>>2],(N=0==(0|(F=0|ar[d+36>>2])))||(Cl(F),d=0|ar[B>>2]),ar[E>>2]=ar[d+40>>2],_=E+4|0,d=0|ar[d+44>>2],0|(ar[_>>2]=d)&&Cl(d),lc(n,k,r,E,D),d=0|ar[(X=n)+4>>2],ar[(V=a)>>2]=ar[X>>2],ar[V+4>>2]=d,d=8+n|0,(0|tr[(X=(V=8+a|0)+11|0)>>0])<0?(tr[ar[V>>2]>>0]=0,ar[12+a>>2]=0):(tr[V>>0]=0,tr[X>>0]=0),Ml(V,0),ar[V>>2]=ar[d>>2],ar[V+4>>2]=ar[d+4>>2],ar[V+8>>2]=ar[d+8>>2],d=0|ar[D>>2],Z=0|ar[R>>2];A:do{if((0|d)!=(0|Z)){e=12+a|0,I=i+4|0,f=A+8|0,B=11+o|0,r=8+n|0,E=C=4+n|0,G=W=t+8|0;e:for(;;){k=0|ar[(v=d+4|0)>>2];do{if(k){if(h=0|lu(k,104,616,0)){(k=0|ar[d+8>>2])?Cl(k):k=0,ar[n>>2]=0,Hc(t,(ar[E>>2]=0)|ar[i>>2],0|ar[h+56>>2],n),p=0|ar[(m=t)+4>>2],ar[(y=a)>>2]=ar[m>>2],ar[y+4>>2]=p,(0|tr[X>>0])<0?(tr[ar[V>>2]>>0]=0,ar[e>>2]=0):(tr[V>>0]=0,tr[X>>0]=0),Ml(V,0),ar[V>>2]=ar[G>>2],ar[V+4>>2]=ar[G+4>>2],ar[V+8>>2]=ar[G+8>>2];do{if(0|ar[a>>2])y=0|ar[(p=a)+4>>2],ar[(h=A)>>2]=ar[p>>2],ar[h+4>>2]=y,ar[f>>2]=ar[V>>2],ar[f+4>>2]=ar[V+4>>2],ar[f+8>>2]=ar[V+8>>2],ar[V>>2]=0,ar[V+4>>2]=0,ar[V+8>>2]=0,h=1;else{if(h=0|ar[n>>2],0|(w=0|ar[E>>2])&&Cl(w),ar[i>>2]=h,h=0|ar[I>>2],ar[I>>2]=w,!h){h=0;break}Il(h),h=0}}while(0);if(0|(w=0|ar[E>>2])&&Il(w),h){h=1;break}y=k}else y=0;if(k=0|ar[v>>2]){if(h=0|lu(k,104,584,0)){if((k=0|ar[d+8>>2])?Cl(k):k=0,xc(n,0|ar[i>>2],1==(0|tr[h+56>>0])),p=0|ar[(m=n)+4>>2],ar[(Y=a)>>2]=ar[m>>2],ar[Y+4>>2]=p,(0|tr[X>>0])<0?(tr[ar[V>>2]>>0]=0,ar[e>>2]=0):(tr[V>>0]=0,tr[X>>0]=0),Ml(V,0),ar[V>>2]=ar[r>>2],ar[V+4>>2]=ar[r+4>>2],ar[V+8>>2]=ar[r+8>>2],0|ar[a>>2]){w=0|ar[(Y=a)+4>>2],ar[(h=A)>>2]=ar[Y>>2],ar[h+4>>2]=w,ar[f>>2]=ar[V>>2],ar[f+4>>2]=ar[V+4>>2],ar[f+8>>2]=ar[V+8>>2],ar[V>>2]=0,ar[V+4>>2]=0,ar[V+8>>2]=0,h=1,w=k,k=y,Y=218;break}p=k}else p=0;if(0!=(0|(k=0|ar[v>>2]))&&0!=(0|(J=0|lu(k,104,552,0)))){if((k=0|ar[d+8>>2])?Cl(k):k=0,v=0|ar[i>>2],h=0|ar[v+24>>2],v=0|ar[v+28>>2],(0|h)<=-1){Y=197;break e}if((0|v)<=-1){Y=199;break e}if(!((0|(g=0<(0|(g=0|bc(J,h)))?g:0))<(0|(w=(0|(w=0|dc(J,h)))<(0|h)?w:h+-1|0))&(0|(m=0<(0|(m=0|kc(J,v)))?m:0))<(0|(h=(0|(Y=0|hc(J,v)))<(0|v)?Y:v+-1|0)))){if(ar[o>>2]=0,ar[4+o>>2]=0,ar[8+o>>2]=0,Cc(A,2,120,o),0<=(0|tr[B>>0])){h=1,v=k,w=p,k=y,Y=216;break}Vl(0|ar[o>>2]),h=1,v=k,w=p,k=y,Y=216;break}ar[n>>2]=0,jc(t,(ar[C>>2]=0)|ar[i>>2],g,w,m,h,n),m=0|ar[(g=t)+4>>2],ar[(Y=a)>>2]=ar[g>>2],ar[Y+4>>2]=m,(0|tr[X>>0])<0?(tr[ar[V>>2]>>0]=0,ar[e>>2]=0):(tr[V>>0]=0,tr[X>>0]=0),Ml(V,0),ar[V>>2]=ar[W>>2],ar[V+4>>2]=ar[W+4>>2],ar[V+8>>2]=ar[W+8>>2];do{if(0|ar[a>>2])Y=0|ar[(m=a)+4>>2],ar[(h=A)>>2]=ar[m>>2],ar[h+4>>2]=Y,ar[f>>2]=ar[V>>2],ar[f+4>>2]=ar[V+4>>2],ar[f+8>>2]=ar[V+8>>2],ar[V>>2]=0,ar[V+4>>2]=0,ar[V+8>>2]=0,h=1;else{if(h=0|ar[n>>2],0|(w=0|ar[C>>2])&&Cl(w),ar[i>>2]=h,h=0|ar[I>>2],ar[I>>2]=w,!h){h=0;break}Il(h),h=0}}while(0);0|(w=0|ar[C>>2])&&Il(w),Y=h?(h=1,v=k,w=p,k=y,216):(v=k,w=p,k=y,215)}else v=0,w=p,k=y,Y=215}else w=v=0,k=y,Y=215}else k=w=v=0,Y=215}while(0);if(215==(0|Y)&&(h=0,Y=216),216==(0|Y)&&(Y=(v&&Il(v),218)),218==(0|Y)&&(Y=0,w&&Il(w)),0|k&&Il(k),d=d+12|0,0|h){Q=h;break A}if((0|d)==(0|Z)){Q=2;break A}}197==(0|Y)?br(27405,26753,776,27420):199==(0|Y)&&br(27433,26753,777,27420)}else Q=2}while(0);if(0|(d=0|ar[_>>2])&&Il(d),N||Il(F),0|(d=0|ar[D>>2])){if((0|(k=0|ar[R>>2]))!=(0|d)){for(;h=k+-12|0,ar[R>>2]=h,(0|(k=(k=0|ar[k+-4>>2])?(Il(k),0|ar[R>>2]):h))!=(0|d););d=0|ar[D>>2]}Vl(d)}if(2!=(2|Q))break}D=0|ar[(J=49920)+4>>2],ar[(Q=A)>>2]=ar[J>>2],ar[Q+4>>2]=D,Rl(A+8|0,49928)}}while(0);(0|tr[(d=8+a|0)+11>>0])<0&&Vl(0|ar[d>>2]),ur=(0<=(0|tr[c>>0])||Vl(0|ar[l>>2]),u)}function je(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0;var n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0;if(ur=(o=ur)+240|0,N=o+220|0,l=o+16|0,t=o+196|0,R=o+32|0,b=o+4|0,function(A,e,r){A|=0,e|=0;var i,f=0,n=0,t=0,o=0;if(ur=(i=ur)+32|0,t=i+12|0,o=i,n=0|ar[(r|=0)>>2],(r=(0|ar[r+4>>2])-n|0)>>>0<8){for(r=0|El(32),ar[t>>2]=r,ar[t+8>>2]=-2147483616,n=26567,e=(f=r)+(ar[t+4>>2]=25)|0;tr[f>>0]=0|tr[n>>0],n=n+1|0,(0|(f=f+1|0))<(0|e););return(tr[r+25>>0]=0,Cc(A,2,118,t),0<=(0|tr[t+11>>0]))?ur=i:(Vl(0|ar[t>>2]),ur=i)}t=0==(1&tr[n+1>>0]),or[e>>1]=1+(0|cr[n+2>>0]),or[e+2>>1]=1+(0|cr[n+3>>0]);do{if(!t){if(12<=r>>>0){ar[e+4>>2]=cr[n+5>>0]<<16|cr[n+4>>0]<<24|cr[n+6>>0]<<8|cr[n+7>>0],r=11,f=cr[n+9>>0]<<16|cr[n+8>>0]<<24|cr[n+10>>0]<<8;break}for(r=0|El(32),ar[o>>2]=r,ar[o+8>>2]=-2147483616,n=26593,e=(f=r)+(ar[o+4>>2]=26)|0;tr[f>>0]=0|tr[n>>0],n=n+1|0,(0|(f=f+1|0))<(0|e););return(tr[r+26>>0]=0,Cc(A,2,118,o),0<=(0|tr[o+11>>0]))?ur=i:(Vl(0|ar[o>>2]),ur=i)}ar[e+4>>2]=cr[n+4>>0]<<8|cr[n+5>>0],r=7,f=cr[n+6>>0]<<8}while(0);ar[e+8>>2]=cr[n+r>>0]|f,t=0|ar[(e=49920)+4>>2],ar[(o=A)>>2]=ar[e>>2],ar[o+4>>2]=t,Rl(A+8|0,49928),ur=i}(J=(n=o)+176|0,a=o+208|0,f|=0),(0|tr[(f=J+8|0)+11>>0])<0&&Vl(0|ar[f>>2]),Y=0|ar[e+60>>2],f=0|ar[Y+64>>2],(J=0==(0|(Y=0|ar[Y+68>>2])))||Cl(Y),f){mc(t,f,r),F=4+t|0,V=65535&(u=0|or[a>>1]),s=0|or[a+2>>1],l=0|sr(X=65535&s,V);A:do{if(((0|ar[F>>2])-(0|ar[t>>2])>>2|0)==(0|l)){G=0|ar[a+4>>2],E=0|ar[a+8>>2],Ye(N),B=0|ar[N>>2],I=0|ar[(f=N+4|0)>>2],ar[N>>2]=0,ar[f>>2]=0,ar[i>>2]=B,r=0|ar[(B=i+4|0)>>2],ar[B>>2]=I,0|r&&(Il(r),0|(c=0|ar[f>>2]))&&Il(c),Yc(0|ar[i>>2],G,E,0,1),Jc(0|ar[i>>2],0,G,E,8),I=(0|G)/2|0,B=(0|E)/2|0,Jc(0|ar[i>>2],1,I,B,8),Jc(0|ar[i>>2],2,I,B,8);e:do{if(u<<16>>16){I=s<<16>>16==0,B=N+4|0,W=(C=A+8|0)+11|0,Z=f=y=0;r:for(;;){if(I)r=0;else{m=E-y|0,p=(0|y)/2|0,c=r=g=0;do{ar[N>>2]=0,xe(A,e,(ar[B>>2]=0)|ar[(0|ar[t>>2])+(f<<2)>>2],N,0);do{if((0|ar[A>>2])==(0|ar[12480])){if(d=0|ar[N>>2],h=0|ar[d+24>>2],r=0|ar[d+28>>2],(0|h)<=-1){f=28;break r}if((0|r)<=-1){f=31;break r}if(w=(0|(u=(0|(u=G-c|0))<(0|h)?u:h))/2|0,v=(0|(b=(0|m)<(0|r)?m:r))/2|0,k=(0|c)/2|0,s=0|Qc(d,0,R),a=0|Qc(0|ar[i>>2],0,n),0<(0|b))for(l=a+c|0,a=0;Eu(0|(D=l+(0|sr(0|ar[n>>2],a+y|0))|0),s+(0|sr(0|ar[R>>2],a))|0,0|u),(0|(a=a+1|0))!=(0|b););if(u=0|Qc(d,1,R),a=0|Qc(0|ar[i>>2],1,n),s=1<(0|b))for(l=a+k|0,a=0;Eu(0|(D=l+(0|sr(0|ar[n>>2],a+p|0))|0),u+(0|sr(0|ar[R>>2],a))|0,0|w),(0|(a=a+1|0))!=(0|v););if(u=0|Qc(d,2,R),a=0|Qc(0|ar[i>>2],2,n),s)for(l=a+k|0,a=0;Eu(0|(D=l+(0|sr(0|ar[n>>2],a+p|0))|0),u+(0|sr(0|ar[R>>2],a))|0,0|w),(0|(a=a+1|0))!=(0|v););if(a=h+c|0,f=f+1|0,0<=(0|tr[W>>0])){l=0,c=a;break}Vl(0|ar[C>>2]),l=0,c=a}else l=1}while(0);if(0|(a=0|ar[B>>2])&&Il(a),g=g+1|0,0|l)break A}while((0|g)<(0|X))}if((0|V)<=(0|(Z=Z+1|0))){_=C;break e}y=r+y|0}28==(0|f)?br(27773,26753,879,27788):31==(0|f)&&br(27811,26753,880,27788)}else _=A+8|0}while(0);R=0|ar[(N=49920)+4>>2],ar[(D=A)>>2]=ar[N>>2],ar[D+4>>2]=R,Rl(_,49928)}else r=R+64|0,ar[(c=R+8|0)>>2]=4080,a=R+12|0,ar[R>>2]=164,ar[r>>2]=184,Yi(R+64|(ar[R+4>>2]=0),a),ar[R+136>>2]=0,ar[R+140>>2]=-1,ar[R>>2]=4060,ar[r>>2]=4100,ar[c>>2]=4080,Ti(a),ar[a>>2]=3908,ar[(c=R+44|0)>>2]=0,ar[c+4>>2]=0,ar[c+8>>2]=0,ar[c+12>>2]=0,ar[R+60>>2]=24,ar[N>>2]=0,ar[N+4>>2]=0,ar[N+8>>2]=0,Of(a,N),(0|tr[N+11>>0])<0&&Vl(0|ar[N>>2]),D=0|Hf(0|Ki(0|Hf(0|Li(0|Hf(0|Li(0|Hf(f=R+8|0,27714,17),u),26704,1),s),27732,1),l),27734,17),Hf(0|qi(D,(0|ar[F>>2])-(0|ar[t>>2])>>2),27752,20),jf(b,a),Cc(A,2,119,b),(0|tr[b+11>>0])<0&&Vl(0|ar[b>>2]),ar[R>>2]=4060,ar[r>>2]=4100,ar[f>>2]=4080,ar[a>>2]=3908,(0|tr[c+11>>0])<0&&Vl(0|ar[c>>2]),si(a),_i(),ci(r)}while(0);0|(f=0|ar[t>>2])&&((0|(r=0|ar[F>>2]))!=(0|f)&&(ar[F>>2]=r+(~((r+-4-f|0)>>>2)<<2)),Vl(f))}else{for(ar[l>>2]=0,ar[l+4>>2]=0,f=(ar[l+8>>2]=0)|El(64),ar[l>>2]=f,ar[l+8>>2]=-2147483584,a=27665,c=(r=f)+(ar[l+4>>2]=48)|0;tr[r>>0]=0|tr[a>>0],a=a+1|0,(0|(r=r+1|0))<(0|c););tr[f+48>>0]=0,Cc(A,2,113,l),(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2])}ur=(J||Il(Y),o)}function ze(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t,o,a=0,c=0,l=0,u=0;if(ur=(o=ur)+64|0,c=o+32|0,n=o+44|0,l=o+20|0,f=o,u=0|ar[(e|=0)+60>>2],a=0|ar[u+64>>2],(t=0==(0|(u=0|ar[u+68>>2])))||Cl(u),a){if(mc(n,a,r),c=4+n|0,a=0|ar[n>>2],4!=((0|ar[c>>2])-a|0)){for(ar[l>>2]=0,ar[l+4>>2]=0,a=(ar[l+8>>2]=0)|El(48),ar[l>>2]=a,ar[l+8>>2]=-2147483600,e=27617,i=(r=a)+(ar[l+4>>2]=47)|0;tr[r>>0]=0|tr[e>>0],e=e+1|0,(0|(r=r+1|0))<(0|i););tr[a+47>>0]=0,Cc(A,2,119,l),(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2])}else xe(f,e,0|ar[a>>2],i,0),i=0|ar[(e=f)+4>>2],ar[(l=A)>>2]=ar[e>>2],ar[l+4>>2]=i,l=f+8|0,ar[(A=A+8|0)>>2]=ar[l>>2],ar[A+4>>2]=ar[l+4>>2],ar[A+8>>2]=ar[l+8>>2];0|(a=0|ar[n>>2])&&((0|(r=0|ar[c>>2]))!=(0|a)&&(ar[c>>2]=r+(~((r+-4-a|0)>>>2)<<2)),Vl(a))}else{for(ar[c>>2]=0,ar[c+4>>2]=0,a=(ar[c+8>>2]=0)|El(64),ar[c>>2]=a,ar[c+8>>2]=-2147483584,e=27568,i=(r=a)+(ar[c+4>>2]=48)|0;tr[r>>0]=0|tr[e>>0],e=e+1|0,(0|(r=r+1|0))<(0|i););tr[a+48>>0]=0,Cc(A,2,113,c),(0|tr[c+11>>0])<0&&Vl(0|ar[c>>2])}ur=(t||Il(u),o)}function Pe(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0;if(ur=(l=ur)+160|0,b=l+136|0,a=l+148|0,k=l+104|0,s=l+80|0,h=l+56|0,W=l+24|0,n=l+72|0,o=(t=l)+44|0,G=0|ar[(e|=0)+60>>2],u=0|ar[G+64>>2],(c=0==(0|(G=0|ar[G+68>>2])))||Cl(G),u){if(mc(a,u,r),ar[(I=k+20|0)>>2]=0,ar[(B=k+24|0)>>2]=0,function(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;for(ur=(n=ur)+208|0,u=n+188|0,t=(f=n)+176|0,s=n+32|0,b=n+20|0,o=0|El(32),ar[t>>2]=o,ar[t+8>>2]=-2147483616,c=26622,l=(a=o)+(ar[t+4>>2]=29)|0;tr[a>>0]=0|tr[c>>0],c=c+1|0,(0|(a=a+1|0))<(0|l););tr[o+29>>0]=0,Cc(f,2,118,t),(0|tr[t+11>>0])<0&&Vl(0|ar[t>>2]),l=0|ar[i>>2],o=(0|ar[i+4>>2])-l|0;do{if(o>>>0<10)w=0|ar[(i=f)+4>>2],ar[(r=A)>>2]=ar[i>>2],ar[r+4>>2]=w,r=A+8|0,A=f+8|0,ar[r>>2]=ar[A>>2],ar[r+4>>2]=ar[A+4>>2],ar[r+8>>2]=ar[A+8>>2],ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0;else{if(w=0|tr[l>>0],tr[e>>0]=w,t=0|tr[l+1>>0],tr[e+1>>0]=t,w<<24>>24){t=s+64|0,ar[(a=s+8|0)>>2]=4080,o=s+12|0,ar[s>>2]=164,ar[t>>2]=184,Yi(s+64|(ar[s+4>>2]=0),o),ar[s+136>>2]=0,ar[s+140>>2]=-1,ar[s>>2]=4060,ar[t>>2]=4100,ar[a>>2]=4080,Ti(o),ar[o>>2]=3908,ar[(a=s+44|0)>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[s+60>>2]=24,ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,Of(o,u),(0|tr[u+11>>0])<0&&Vl(0|ar[u>>2]),r=0|Hf(c=s+8|0,26652,27),tr[u>>0]=0|tr[e>>0],Hf(0|Hf(r,u,1),26680,23),jf(b,o),Cc(A,4,3002,b),(0|tr[b+11>>0])<0&&Vl(0|ar[b>>2]),ar[s>>2]=4060,ar[t>>2]=4100,ar[c>>2]=4080,ar[o>>2]=3908,(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),si(o),_i(),ci(t);break}if(((10+((u=(s=t<<1&2)+2<<24>>24)<<1&255)&255)+(0|sr(r<<1,w=255&u))|0)>>>0>o>>>0){w=0|ar[(i=f)+4>>2],ar[(r=A)>>2]=ar[i>>2],ar[r+4>>2]=w,r=A+8|0,A=f+8|0,ar[r>>2]=ar[A>>2],ar[r+4>>2]=ar[A+4>>2],ar[r+8>>2]=ar[A+8>>2],ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0;break}for(or[e+2>>1]=cr[l+3>>0]|cr[l+2>>0]<<8,or[e+4>>1]=cr[l+5>>0]|cr[l+4>>0]<<8,or[e+6>>1]=cr[l+7>>0]|cr[l+6>>0]<<8,or[e+8>>1]=cr[l+9>>0]|cr[l+8>>0]<<8,a=255&s,t=0,o=w,c=10;o=o+-1|0,t=cr[l+c>>0]|t<<8,o;)c=c+1|0;for(k=12|a,ar[e+12>>2]=t,o=k+a|0,c=0,t=w,a=k;t=t+-1|0,c=cr[l+a>>0]|c<<8,t;)a=a+1|0;if(l=o+2|0,ar[e+16>>2]=c,k=e+20|0,r>>>0<=(o=(c=0|ar[(t=e+24|0)>>2])-(a=0|ar[k>>2])>>3)>>>0?(r>>>0<o>>>0&&(0|c)!=(0|(d=a+(r<<3)|0))&&(ar[t>>2]=c+(~((c+-8-d|0)>>>3)<<3)),0|r&&(h=25)):(De(k,r-o|0),h=25),25==(0|h))for(d=~(e=128<<(u<<3&255)-8),b=4+(s<<1&255)&255,s=0|ar[i>>2],u=0;;){for(a=0,t=w,o=l;t=t+-1|0,a=cr[s+o>>0]|a<<8,t;)o=o+1|0;for(c=0|ar[k>>2],ar[c+(u<<3)>>2]=(a&d)-(0==(a&e|0)?0:e),a=(o=w)+l|(t=0);o=o+-1|0,t=cr[s+a>>0]|t<<8,o;)a=a+1|0;if(ar[c+(u<<3)+4>>2]=(t&d)-(0==(t&e|0)?0:e),(0|(u=u+1|0))==(0|r))break;l=b+l|0}w=0|ar[(i=49920)+4>>2],ar[(r=A)>>2]=ar[i>>2],ar[r+4>>2]=w,Rl(A+8|0,49928)}}while(0);ur=(0<=(0|tr[(t=f+8|0)+11>>0])||Vl(0|ar[t>>2]),n)}(s,k,((ar[k+28>>2]=0)|ar[(E=4+a|0)>>2])-(0|ar[a>>2])>>2,f),(0|tr[(u=s+8|0)+11>>0])<0&&Vl(0|ar[u>>2]),y=k+20|0,((0|ar[E>>2])-(0|ar[a>>2])>>2|0)!=((0|ar[B>>2])-(0|ar[y>>2])>>3|0)){for(ar[h>>2]=0,ar[h+4>>2]=0,u=(ar[h+8>>2]=0)|El(80),ar[h>>2]=u,ar[h+8>>2]=-2147483568,f=27498,s=(r=u)+(ar[h+4>>2]=69)|0;tr[r>>0]=0|tr[f>>0],f=f+1|0,(0|(r=r+1|0))<(0|s););tr[u+69>>0]=0,Cc(A,2,121,h),(0|tr[h+11>>0])<0&&Vl(0|ar[h>>2])}else{u=0|ar[k+12>>2],r=0|ar[k+16>>2],Ye(W),p=0|ar[W>>2],m=0|ar[(f=W+4|0)>>2],ar[W>>2]=0,ar[f>>2]=0,ar[i>>2]=p,s=0|ar[(p=i+4|0)>>2],ar[p>>2]=m,0|s&&(Il(s),0|(d=0|ar[f>>2]))&&Il(d),Yc(0|ar[i>>2],u,r,1,3),Jc(0|ar[i>>2],3,u,r,8),Jc(0|ar[i>>2],4,u,r,8),Jc(0|ar[i>>2],5,u,r,8),function(A,e,r,i,f,n){A|=0;var t,o,a,c,l,u,s=0,b=0,d=0,k=0;ur=(u=ur)+32|0,b=u+12|0,k=u,l=44+(e|=0)|0,c=(65535&(i|=0))>>>8&255,a=(65535&(r|=0))>>>8&255,o=(65535&(f|=0))>>>8&255,t=(65535&(n|=0))>>>8&255,n=5440;A:for(;;){if(e=0|ar[l>>2],s=0|ar[n>>2],e){r=l,i=e;e:for(;;){for(e=i;!((0|ar[e+16>>2])>=(0|s));)if(!(e=0|ar[e+4>>2])){e=r;break e}if(!(i=0|ar[e>>2]))break;r=e}if((0|e)!=(0|l)&&(0|s)>=(0|ar[e+16>>2])){if(8!=(0|ar[e+28>>2])){d=13;break}switch(r=0|ar[e+24>>2],f=0|ar[e+44>>2],i=0|ar[e+32>>2],0|s){case 3:e=a;break;case 4:e=c;break;case 5:e=o;break;case 6:e=t;break;default:d=19;break A}Vu(0|i,0|e,0|sr(f,r))}else d=9}else d=9;if(9==(0|d)&&6!=((d=0)|s)){d=10;break}if(5456==(0|(n=n+4|0))){d=22;break}}{if(10==(0|d))return ar[b>>2]=0,ar[b+4>>2]=0,ar[b+8>>2]=0,Cc(A,5,2002,b),0<=(0|tr[b+11>>0])||Vl(0|ar[b>>2]),ur=u;if(13==(0|d)){for(e=0|El(64),ar[k>>2]=e,ar[k+8>>2]=-2147483584,ar[k+4>>2]=52,r=22275,f=(i=e)+52|0;tr[i>>0]=0|tr[r>>0],r=r+1|0,(0|(i=i+1|0))<(0|f););return(tr[e+52>>0]=0,Cc(A,4,0,k),0<=(0|tr[k+11>>0]))?ur=u:(Vl(0|ar[k>>2]),ur=u)}if(19==(0|d))br(49065,22121,610,22328);else if(22==(0|d))d=0|ar[(b=49920)+4>>2],ar[(k=A)>>2]=ar[b>>2],ar[k+4>>2]=d,Rl(A+8|0,49928),ur=u}}(W,0|ar[i>>2],0|or[k+2>>1],0|or[k+4>>1],0|or[k+6>>1],0|or[k+8>>1]);A:do{if(0|ar[W>>2])C=0|ar[(i=W)+4>>2],ar[(V=A)>>2]=ar[i>>2],ar[V+4>>2]=C,V=W+8|0,ar[(A=A+8|0)>>2]=ar[V>>2],ar[A+4>>2]=ar[V+4>>2],ar[A+8>>2]=ar[V+8>>2],ar[V>>2]=0,ar[V+4>>2]=0,ar[V+8>>2]=0;else{f=0|ar[a>>2];e:do{if((0|ar[E>>2])!=(0|f)){d=4+n|0,h=(u=W+8|0)+11|0,w=W+12|0,v=t+4|0,g=11+o|0,m=k=t+8|0,r=A+8|0,p=W+4|0,b=0;r:for(;;){ar[n>>2]=0,xe(t,e,(ar[d>>2]=0)|ar[f+(b<<2)>>2],n,0),f=0|ar[(V=t)+4>>2],ar[(s=W)>>2]=ar[V>>2],ar[s+4>>2]=f,(0|tr[h>>0])<0?(tr[ar[u>>2]>>0]=0,ar[w>>2]=0):(tr[u>>0]=0,tr[h>>0]=0),Ml(u,0),ar[u>>2]=ar[k>>2],ar[u+4>>2]=ar[k+4>>2],ar[u+8>>2]=ar[k+8>>2];i:do{if((0|ar[W>>2])==(0|ar[12480])){if(Mc(t,0|ar[n>>2],1,3),f=0|ar[t>>2],V=0|ar[v>>2],ar[t>>2]=0,ar[v>>2]=0,ar[n>>2]=f,f=0|ar[d>>2],ar[d>>2]=V,0|f&&(Il(f),0|(Z=0|ar[v>>2]))&&Il(Z),!(0|ar[n>>2])){if(ar[o>>2]=0,ar[4+o>>2]=0,ar[8+o>>2]=0,Cc(A,4,3003,o),0<=(0|tr[g>>0])){f=1;break}Vl(0|ar[o>>2]),f=1;break}if(f=V=0|ar[y>>2],(0|ar[B>>2])-V>>3>>>0<=b>>>0){C=32;break r}zc(t,0|ar[i>>2],n,0|ar[f+(b<<3)>>2],0|ar[f+(b<<3)+4>>2]),s=0|ar[(f=t)+4>>2],ar[(V=W)>>2]=ar[f>>2],ar[V+4>>2]=s,(0|tr[h>>0])<0?(tr[ar[u>>2]>>0]=0,ar[w>>2]=0):(tr[u>>0]=0,tr[h>>0]=0),Ml(u,0),ar[u>>2]=ar[m>>2],ar[u+4>>2]=ar[m+4>>2],ar[u+8>>2]=ar[m+8>>2];f:do{switch(0|ar[W>>2]){case 0:f=0;break i;case 2:if(122!=(0|ar[p>>2]))break f;V=0|ar[(s=49920)+4>>2],ar[(f=W)>>2]=ar[s>>2],ar[f+4>>2]=V,Jl(u,49928),f=0;break i}}while(0);V=0|ar[(s=W)+4>>2],ar[(f=A)>>2]=ar[s>>2],ar[f+4>>2]=V,ar[r>>2]=ar[u>>2],ar[r+4>>2]=ar[u+4>>2],ar[r+8>>2]=ar[u+8>>2],ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,f=1}else V=0|ar[(s=W)+4>>2],ar[(f=A)>>2]=ar[s>>2],ar[f+4>>2]=V,ar[r>>2]=ar[u>>2],ar[r+4>>2]=ar[u+4>>2],ar[r+8>>2]=ar[u+8>>2],ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,f=1}while(0);if(0|(s=0|ar[d>>2])&&Il(s),b=b+1|0,0|f)break;if(f=0|ar[a>>2],b>>>0>=(0|ar[E>>2])-f>>2>>>0){f=W,s=A;break e}}if(32==(0|C)&&br(26706,26753,271,26769),0<=(0|tr[h>>0]))break A;Vl(0|ar[u>>2]);break A}r=(s=A)+8|0,u=(f=W)+8|0}while(0);A=0|ar[(W=f)+4>>2],ar[(V=s)>>2]=ar[W>>2],ar[V+4>>2]=A,ar[r>>2]=ar[u>>2],ar[r+4>>2]=ar[u+4>>2],ar[r+8>>2]=ar[u+8>>2],ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0}}while(0)}0|(u=0|ar[I>>2])&&((0|(r=0|ar[B>>2]))!=(0|u)&&(ar[B>>2]=r+(~((r+-8-u|0)>>>3)<<3)),Vl(u)),0|(u=0|ar[a>>2])&&((0|(r=0|ar[E>>2]))!=(0|u)&&(ar[E>>2]=r+(~((r+-4-u|0)>>>2)<<2)),Vl(u))}else{for(ar[b>>2]=0,ar[b+4>>2]=0,u=(ar[b+8>>2]=0)|El(64),ar[b>>2]=u,ar[b+8>>2]=-2147483584,f=27449,s=(r=u)+(ar[b+4>>2]=48)|0;tr[r>>0]=0|tr[f>>0],f=f+1|0,(0|(r=r+1|0))<(0|s););tr[u+48>>0]=0,Cc(A,2,113,b),(0|tr[b+11>>0])<0&&Vl(0|ar[b>>2])}ur=(c||Il(G),l)}function Le(A,e,r,i){e|=0,i|=0;var f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0;if(ur=(o=ur)+32|0,t=o+16|0,f=o+12|0,n=o,function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l=0;ur=(t=ur)+16|0,l=t,o=0|El(8),ar[o>>2]=0,ar[(c=4+o|0)>>2]=0,Ye(l),a=0|ar[l>>2],l=0|ar[l+4>>2],ar[o>>2]=a,ar[c>>2]=l,Yc(a,e,r,i,f),ar[n>>2]=o,ar[A>>2]=ar[1468],ar[A+4>>2]=ar[1469],ar[A+8>>2]=ar[1470],ur=t}(A|=0,b=0|rr(r|=0,0),d=0|ir(r,0),0,0|(a=r,0|ar[20+(a|=0)>>2]),t),0|ar[A>>2])ur=o;else{for(s=0;;){if(c=0|fr(r,s),b=0|nr(r,s,f),l=0|rr(r,s),d=0|ir(r,s),e=0|ar[5968+(s<<2)>>2],k=n,h=0|ar[t>>2],w=e,v=l,g=d,m=c,k|=0,w|=0,v|=0,g|=0,m|=0,Jc(0|ar[(h|=0)>>2],w,v,g,m),ar[k>>2]=ar[1468],ar[k+4>>2]=ar[1469],ar[k+8>>2]=ar[1470],ar[A>>2]=ar[n>>2],ar[A+4>>2]=ar[n+4>>2],ar[A+8>>2]=ar[n+8>>2],0|ar[A>>2]){e=8;break}if(u=0|Je(0|ar[t>>2],e,n),0<(0|d))for(c=0|sr(l,(c+7|0)/8|0),e=0;Eu(0|(l=u+(0|sr(0|ar[n>>2],e))|0),b+(0|sr(0|ar[f>>2],e))|0,0|c),(0|(e=e+1|0))!=(0|d););if(3<=(0|(s=s+1|0))){e=9;break}}var k,h,w,v,g,m;if(8!=(0|e))return 9==(0|e)&&(ar[i>>2]=ar[t>>2],void(ur=o));ur=o}}function Ke(A,e){return 0|function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0;ur=(t=ur)+16|0,n=t,a=548+(A|=0)|0,i=0==(0|ar[(r=A+580|0)>>2]),f=0|tr[a>>0];do{if(i){if(f<<24>>24==0&&0==(0|tr[A+549>>0])){c=8;break}if((0|ar[A+377216>>2])==(0|ar[A+377220>>2]))return no(A+376148|0),ur=(e&&(ar[e>>2]=ar[A+376200>>2]),t),(c=0)|c;c=7}else c=7}while(0);7==(0|c)&&f<<24>>24==0&&(c=8);if(8==(0|c)&&!(0!=(0|tr[A+549>>0])|1^i))return ur=(e&&(ar[e>>2]=1),t),0|(c=13);if(!(0|$t(A+376148|0,0)))return ur=(e&&(ar[e>>2]=1),t),0|(c=9);tr[n>>0]=0;do{if(0|ar[r>>2]){if(a=0|Bo(a)){o=0|Ot(A,a),tr[n>>0]=1,c=23;break}br(28452,28026,1314,28456)}else{if(0|tr[A+549>>0]&&(0|ar[A+377216>>2])==(0|ar[A+377220>>2])){if(!e){o=13;break}ar[e>>2]=1,o=13;break}o=0|Xr(A,n),c=23}}while(0);23==(0|c)&&e&&(ar[e>>2]=0==(0|o)&0!=(1&tr[n>>0])&1);return ur=t,0|(c=o)}(A|=0,e|=0)}function qe(A,e,r,i,f,n){return 0|function(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;ur=(t=ur)+16|0,d=t,0|ar[8+(A|=0)>>2]&&br(30182,30208,375,30222);tr[A+1>>0]=0,k=0|function(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(ur=(n=ur)+16|0,i=n,f=40+(A|=0)|0,(0|(t=0|ar[(b=A+44|0)>>2]))==(0|ar[f>>2])){for(t=0|El(48),tr[t>>0]=0,tr[t+1>>0]=0,tr[t+2>>0]=0,ar[(a=t+32|0)>>2]=0,ar[(o=t+36|0)>>2]=0,ar[(l=t+40|0)>>2]=0,c=0|El(64),ar[a>>2]=c,a=c+64|0,ar[l>>2]=a,l=c+64|0;((ar[c>>2]=0)|(c=c+4|0))<(0|l););ar[o>>2]=a,ar[(s=t+8|0)>>2]=0,ar[s+4>>2]=0,ar[s+8>>2]=0,ar[s+12>>2]=0,ar[s+16>>2]=0,ar[s+20>>2]=0,s=t}else s=0|ar[(u=t+-4|0)>>2],ar[b>>2]=u;tr[s>>0]=0,tr[s+1>>0]=0,tr[s+2>>0]=0,ar[(l=s+8|0)>>2]=0,ar[l+4>>2]=0,ar[s+16>>2]=0,ar[(l=s+24|0)>>2]=0,t=0|ar[(r=s+32|0)>>2],(0|(o=0|ar[(u=s+36|0)>>2]))!=(0|t)&&(ar[u>>2]=o+(~((o+-4-t|0)>>>2)<<2));if((0|ar[(a=s+28|0)>>2])>=(0|e))return ur=n,0|(b=s);if(0|(c=0|qo(e)))return 0|(o=0|ar[(t=s+20|0)>>2])&&(Eu(0|c,0|o,0|ar[l>>2]),$o(o)),ar[t>>2]=c,ar[a>>2]=e,ur=n,0|(b=s);ar[i>>2]=s,t=s,o=0|ar[b>>2];do{if(o-(0|ar[f>>2])>>2>>>0<16){if((0|o)==(0|ar[A+48>>2])){Io(f,i);break}ar[o>>2]=t,ar[b>>2]=4+(0|ar[b>>2]);break}$o(0|ar[s+20>>2]),0|(t=0|ar[r>>2])&&((0|(o=0|ar[u>>2]))!=(0|t)&&(ar[u>>2]=o+(~((o+-4-t|0)>>>2)<<2)),Vl(t)),Vl(s)}while(0);return ur=n,(b=0)|b}(A,r);A:do{if(k){a=k+28|0;do{if((0|ar[a>>2])<(0|r)){if(0|(o=0|qo(r))){0|(l=0|ar[(c=k+20|0)>>2])&&(Eu(0|o,0|l,0|ar[k+24>>2]),$o(l)),ar[c>>2]=o,ar[a>>2]=r;break}if(ar[d>>2]=k,o=k,a=A+40|0,(l=0|ar[(c=A+44|0)>>2])-(0|ar[a>>2])>>2>>>0<16){if((0|l)==(0|ar[A+48>>2])){Io(a,d);break A}ar[l>>2]=o,ar[c>>2]=4+(0|ar[c>>2]);break A}$o(0|ar[k+20>>2]),0|(o=0|ar[k+32>>2])&&((0|(c=0|ar[(a=k+36|0)>>2]))!=(0|o)&&(ar[a>>2]=c+(~((c+-4-o|0)>>>2)<<2)),Vl(o)),Vl(k);break A}o=0|ar[k+20>>2]}while(0);Eu(0|o,0|e,0|r),ar[(b=k+24|0)>>2]=r,ar[(u=k+8|0)>>2]=i,ar[u+4>>2]=f,ar[k+16>>2]=n;e:do{if(2<(0|r))for(f=k+32|0,n=k+36|0,u=k+40|0,o=0|ar[k+20>>2],i=0,l=r;;){switch((a=0|tr[(e=o+2|0)>>0])<<24>>24){case 0:case 3:0==(0|tr[o>>0])&&a<<24>>24==3&0==(0|tr[(s=o+1|0)>>0])?(c=0|ar[n>>2],a=i+2+(c-(0|ar[f>>2])>>2)|0,ar[d>>2]=a,(0|c)==(0|ar[u>>2])?Co(f,d):(ar[c>>2]=a,ar[n>>2]=c+4),Gu(0|e,o+3|0,-3-i+(0|ar[b>>2])|0),a=(0|ar[b>>2])-1|0,ar[b>>2]=a,c=i+1|0,o=s):(c=i,a=l);break;default:c=i+2|0,o=e,a=l}if((a+-2|0)<=(0|(i=c+1|0)))break e;o=o+1|0,l=a}}while(0);return o=0|ar[(e=A+16|0)>>2],d=(0|ar[A+20>>2])-o|0,c=0|ar[(a=A+28|0)>>2],l=0|ar[(i=A+32|0)>>2],(0|(0==(0|d)?0:(d<<8)-1|0))==(l+c|0)?(Go(A+12|0),c=0|ar[a>>2],a=0|ar[i>>2],o=0|ar[e>>2]):a=l,ar[(0|ar[o+((d=a+c|0)>>>10<<2)>>2])+((1023&d)<<2)>>2]=k,ar[i>>2]=a+1,ar[(k=A+36|0)>>2]=(0|ar[k>>2])+(0|ar[b>>2]),ur=t,(k=0)|k}ar[d>>2]=0}while(0);return ur=t,0|(k=7)}((A|=0)+548|0,e|=0,r|=0,i|=0,f|=0,n|=0)}function $e(A){var e=0;return(0|ar[(A|=0)+376200>>2])<=0?(e=0)|e:(e=0|ar[A+376196>>2],(e=0|ar[(0|ar[(0|ar[A+376184>>2])+(e>>>10<<2)>>2])+((1023&e)<<2)>>2])?(oo(A+376148|(tr[e+100>>0]=0)),0|e):(e=0)|e)}function Ar(A){var e;0|ar[(A|=0)+376200>>2]&&(e=0|ar[A+376196>>2],oo(A+376148|(tr[100+(0|ar[(0|ar[(0|ar[A+376184>>2])+(e>>>10<<2)>>2])+((1023&e)<<2)>>2])>>0]=0)))}function er(A,e,r){switch(A|=0,r|=0,0|(e|=0)){case 0:return void(tr[A+512>>0]=0!=(0|r)&1);case 6:return void(tr[A+514>>0]=0!=(0|r)&1);case 7:return void(tr[A+532>>0]=0!=(0|r)&1);case 8:return void(tr[A+533>>0]=0!=(0|r)&1);default:br(49065,27874,503,27883)}}function rr(A,e){switch(A|=0,0|(e|=0)){case 0:A=A+72|0;break;case 2:case 1:A=A+80|0;break;default:return(e=0)|e}return 0|(e=0|ar[A>>2])}function ir(A,e){switch(A|=0,0|(e|=0)){case 0:A=A+76|0;break;case 2:case 1:A=A+84|0;break;default:return(e=0)|e}return 0|(e=0|ar[A>>2])}function fr(A,e){switch(A|=0,0|(e|=0)){case 0:A=A+5760|0;break;case 2:case 1:A=A+5768|0;break;default:return(e=0)|e}return 0|(e=0|ar[A>>2])}function nr(A,e,r){A|=0,r|=0;var i,f,n=0;if(3<=(e|=0)>>>0&&br(27908,27874,639,27935),f=0|ar[A+60+(e<<2)>>2],!r)return 0|f;switch(i=0|ar[(0==(0|e)?A+40|0:A+44|0)>>2],0|e){case 0:A=A+5760|0,n=7;break;case 2:case 1:A=A+5768|0,n=7;break;default:A=0}return 7==(0|n)&&(A=(7+(0|ar[A>>2])|0)/8|0),n=0|sr(A,i),ar[r>>2]=n,0|f}function dr(A){var e,r=0,i=0,f=0,n=0,t=0,o=0;if(ar[(A|=0)>>2]=6040,(0|(r=0|ar[(n=A+377216|0)>>2]))!=(0|(i=0|ar[(t=A+377220|0)>>2])))for(;(f=0|ar[i+-4>>2])&&(kr(f),Vl(f),i=0|ar[t>>2],r=0|ar[n>>2]),i=i+-4|0,(0|r)!=(0|(ar[t>>2]=i)););0|r&&Vl(r),function(A){var e,r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(n=8+(A|=0)|0,a=0|ar[(t=A+12|0)>>2],o=0|ar[n>>2],(0|a)!=(0|o))for(l=0;(c=0|ar[o+(l<<2)>>2])&&(uo(c),Vl(c),o=0|ar[n>>2],a=0|ar[t>>2]),(l=l+1|0)>>>0<a-o>>2>>>0;);a=0|ar[(i=A+36|0)>>2],o=0|ar[(r=A+48|0)>>2],c=a+(o>>>10<<2)|0,s=0|ar[(f=A+40|0)>>2],o=(0|(l=s))==(0|(e=a))?(s=A+52|(u=0),0):(u=(0|ar[(s=A+52|0)>>2])+o|0,u=(0|ar[a+(u>>>10<<2)>>2])+((1023&u)<<2)|0,(0|ar[c>>2])+((1023&o)<<2)|0);A:for(;;){do{if((0|o)==(0|u))break A;o=o+4|0}while(4096!=(o-(0|ar[c>>2])|0));o=0|ar[(c=o=c+4|0)>>2]}if(ar[s>>2]=0,2<(o=l-e>>2)>>>0)for(;Vl(0|ar[a>>2]),a=4+(0|ar[i>>2])|0,ar[i>>2]=a,o=(0|ar[f>>2])-a>>2,2<o>>>0;);switch(0|o){case 1:o=512,b=14;break;case 2:o=1024,b=14}14==(0|b)&&(ar[r>>2]=o);if(o=0|ar[i>>2],a=0|ar[f>>2],(0|o)!=(0|a)){for(;Vl(0|ar[o>>2]),(0|(o=o+4|0))!=(0|a););o=0|ar[i>>2],(0|(a=0|ar[f>>2]))!=(0|o)&&(ar[f>>2]=a+(~((a+-4-o|0)>>>2)<<2))}0|(o=0|ar[A+32>>2])&&Vl(o);0|(c=0|ar[A+20>>2])&&((0|(a=0|ar[(o=A+24|0)>>2]))!=(0|c)&&(ar[o>>2]=a+(~((a+-4-c|0)>>>2)<<2)),Vl(c));if(!(o=0|ar[n>>2]))return;(0|(a=0|ar[t>>2]))!=(0|o)&&(ar[t>>2]=a+(~((a+-4-o|0)>>>2)<<2));Vl(o)}(A+376148|0),function(A){var e,r,i,f,n,t=0,o=0,a=0,c=0,l=0,u=0;o=0|ar[(f=8+(A|=0)|0)>>2],t=0|ar[(i=A+20|0)>>2],a=o+(t>>>10<<2)|0,l=0|ar[(n=A+12|0)>>2],t=(0|(e=l))==(0|(r=o))?(l=A+24|(c=0),0):(c=(0|ar[(l=A+24|0)>>2])+t|0,c=(0|ar[o+(c>>>10<<2)>>2])+((1023&c)<<2)|0,(0|ar[a>>2])+((1023&t)<<2)|0);A:for(;;){do{if((0|t)==(0|c))break A;t=t+4|0}while(4096!=(t-(0|ar[a>>2])|0));t=0|ar[(a=t=a+4|0)>>2]}if(ar[l>>2]=0,2<(t=e-r>>2)>>>0)for(;Vl(0|ar[o>>2]),o=4+(0|ar[f>>2])|0,ar[f>>2]=o,t=(0|ar[n>>2])-o>>2,2<t>>>0;);switch(0|t){case 1:t=512,u=13;break;case 2:t=1024,u=13}13==(0|u)&&(ar[i>>2]=t);if(t=0|ar[f>>2],o=0|ar[n>>2],(0|t)!=(0|o)){for(;Vl(0|ar[t>>2]),(0|(t=t+4|0))!=(0|o););t=0|ar[f>>2],(0|(o=0|ar[n>>2]))!=(0|t)&&(ar[n>>2]=o+(~((o+-4-t|0)>>>2)<<2))}if(!(t=0|ar[A+4>>2]))return;Vl(t)}(A+375396|0),No(A+370984|0),No(A+366584|0),No(A+362184|0),No(A+357784|0),No(A+353384|0),No(A+348984|0),No(A+344584|0),No(A+340184|0),No(A+335784|0),No(A+331384|0),No(A+326984|0),No(A+322584|0),No(A+318184|0),No(A+313784|0),No(A+309384|0),No(A+304984|0),No(A+300584|0),No(A+296184|0),No(A+291784|0),No(A+287384|0),No(A+282984|0),No(A+278584|0),No(A+274184|0),No(A+269784|0),No(A+265384|0),No(A+260984|0),No(A+256584|0),No(A+252184|0),No(A+247784|0),No(A+243384|0),No(A+238984|0),No(A+234584|0),No(A+230184|0),No(A+225784|0),No(A+221384|0),No(A+216984|0),No(A+212584|0),No(A+208184|0),No(A+203784|0),No(A+199384|0),No(A+194984|0),No(A+190584|0),No(A+186184|0),No(A+181784|0),No(A+177384|0),No(A+172984|0),No(A+168584|0),No(A+164184|0),No(A+159784|0),No(A+155384|0),No(A+150984|0),No(A+146584|0),No(A+142184|0),No(A+137784|0),No(A+133384|0),No(A+128984|0),No(A+124584|0),No(A+120184|0),No(A+115784|0),No(A+111384|0),No(A+106984|0),No(A+102584|0),No(A+98184|0),No(A+93784|0),Tn(A+88616|0),Tn(A+83448|0),Tn(A+78280|0),Tn(A+73112|0),Tn(A+67944|0),Tn(A+62776|0),Tn(A+57608|0),Tn(A+52440|0),Tn(A+47272|0),Tn(A+42104|0),Tn(A+36936|0),Tn(A+31768|0),Tn(A+26600|0),Tn(A+21432|0),Tn(A+16264|0),Tn(A+11096|0),e=A+600|0,o=A+11096|0;do{if(0|(r=0|ar[o+-16>>2])&&((0|ar[(i=o+-12|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),0|(r=0|ar[o+-28>>2])&&((0|(f=0|ar[(i=o+-24|0)>>2]))!=(0|r)&&(ar[i>>2]=f+(~((f+-2-r|0)>>>1)<<1)),Vl(r)),0|(r=0|ar[(n=o+-64|0)>>2])){if((0|(i=0|ar[(t=o+-60|0)>>2]))!=(0|r)){for(;i=i+-12|0,ar[t>>2]=i,(f=0|ar[i>>2])&&(Vl(f),i=0|ar[t>>2]),(0|i)!=(0|r););r=0|ar[n>>2]}Vl(r)}o=o+-656|0}while((0|o)!=(0|e));!function(A){var e,r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;ur=(i=ur)+16|0,e=i,f=0|ar[(r=32+(A|=0)|0)>>2];A:do{if(0|f){c=A+16|0,l=A+28|0,u=A+36|0,s=A+40|0,b=A+44|0,a=A+48|0;do{if(n=0|ar[c>>2],t=0|ar[l>>2],o=0|ar[(0|ar[n+(t>>>10<<2)>>2])+((1023&t)<<2)>>2],ar[r>>2]=f+-1,t=t+1|0,2047<(ar[l>>2]=t)>>>0&&(Vl(0|ar[n>>2]),ar[c>>2]=4+(0|ar[c>>2]),ar[l>>2]=(0|ar[l>>2])-1024),ar[u>>2]=(0|ar[u>>2])-(0|ar[o+24>>2]),!o)break A;ar[e>>2]=o,f=o,n=0|ar[b>>2];do{if(n-(0|ar[s>>2])>>2>>>0<16){if((0|n)==(0|ar[a>>2])){Io(s,e);break}ar[n>>2]=f,ar[b>>2]=4+(0|ar[b>>2]);break}$o(0|ar[o+20>>2]),0|(f=0|ar[o+32>>2])&&((0|(t=0|ar[(n=o+36|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),Vl(o)}while(0);f=0|ar[r>>2]}while(0!=(0|f))}}while(0);if(o=0|ar[A+8>>2]){ar[e>>2]=o,f=o,c=A+40|0,n=0|ar[(a=A+44|0)>>2];do{if(n-(0|ar[c>>2])>>2>>>0<16){if((0|n)==(0|ar[A+48>>2])){Io(c,e);break}ar[n>>2]=f,ar[a>>2]=4+(0|ar[a>>2]);break}$o(0|ar[o+20>>2]),0|(f=0|ar[o+32>>2])&&((0|(t=0|ar[(n=o+36|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),Vl(o)}while(0);u=s=a}else s=u=A+44|0,c=A+40|0;if(t=0|ar[u>>2],o=0|ar[c>>2],(0|(f=t))!=(0|(n=o)))for(l=0;(a=0|ar[n+(l<<2)>>2])&&($o(0|ar[a+20>>2]),0|(f=0|ar[a+32>>2])&&((0|(t=0|ar[(n=a+36|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),Vl(a),f=0|ar[u>>2],o=0|ar[c>>2],t=f),(l=l+1|0)>>>0<t-(n=o)>>2>>>0;);0|n&&((0|f)!=(0|n)&&(ar[s>>2]=f+(~((f+-4-n|0)>>>2)<<2)),Vl(n));f=0|ar[(s=A+16|0)>>2],n=0|ar[(u=A+28|0)>>2],o=f+(n>>>10<<2)|0,t=0|ar[(b=A+20|0)>>2],n=(0|(a=t))==(0|(c=f))?l=0:(l=(0|ar[r>>2])+n|0,l=(0|ar[f+(l>>>10<<2)>>2])+((1023&l)<<2)|0,(0|ar[o>>2])+((1023&n)<<2)|0);A:for(;;){do{if((0|n)==(0|l))break A;n=n+4|0}while(4096!=(n-(0|ar[o>>2])|0));n=0|ar[(o=n=o+4|0)>>2]}if(ar[r>>2]=0,2<(n=a-c>>2)>>>0)for(;Vl(0|ar[f>>2]),f=4+(0|ar[s>>2])|0,ar[s>>2]=f,t=0|ar[b>>2],n=t-f>>2,2<n>>>0;);switch(0|n){case 1:n=512,d=45;break;case 2:n=1024,d=45}45==(0|d)&&(ar[u>>2]=n);if((0|f)!=(0|t)){for(;Vl(0|ar[f>>2]),(0|(f=f+4|0))!=(0|t););f=0|ar[s>>2],(0|(n=0|ar[b>>2]))!=(0|f)&&(ar[b>>2]=n+(~((n+-4-f|0)>>>2)<<2))}(f=0|ar[A+12>>2])&&Vl(f),ur=i}(A+548|0)}function kr(A){var e,r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if(i=(A|=0)+10632|0,(0|(n=0|ar[(l=A+10636|0)>>2]))!=(0|(f=0|ar[i>>2]))){a=0;do{if(o=0|ar[f+(a<<2)>>2]){if(Eo(548+(0|ar[o+144>>2])|0,0|ar[o>>2]),0|(n=0|ar[o+136>>2])){if(0|(f=0|ar[(t=n+-16|0)+12>>2]))for(f=n+(18624*f|0)|0;Zt(f+-44|0),(0|(f=f+-18624|0))!=(0|n););Xl(t)}zn(o+44|0),Vl(o),f=0|ar[i>>2],n=0|ar[l>>2]}a=a+1|0}while(a>>>0<n-f>>2>>>0)}if(e=A+10664|0,(0|(f=0|ar[(r=A+10668|0)>>2]))!=(0|(n=t=0|ar[e>>2])))for(c=0,a=n,o=t;(t=0|ar[a+(c<<2)>>2])?(ds[511&ar[4+(0|ar[t>>2])>>2]](t),n=t=0|ar[e>>2],f=0|ar[r>>2]):t=o,!(f-t>>2>>>0<=(c=c+1|0)>>>0);)o=a=t;if(f=0|ar[(o=A+10676|0)>>2]){if((0|(n=0|ar[(t=A+10680|0)>>2]))!=(0|f)){for(;c=n+-8|0,Zt(ar[t>>2]=c),(0|(n=0|ar[t>>2]))!=(0|f););f=0|ar[o>>2]}Vl(f),f=0|ar[e>>2]}else f=n;0|f&&((0|(n=0|ar[r>>2]))!=(0|f)&&(ar[r>>2]=n+(~((n+-4-f|0)>>>2)<<2)),Vl(f)),0|(f=0|ar[A+10644>>2])&&((0|(t=0|ar[(n=A+10648|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(80*~(((t+-80-f|0)>>>0)/80|0)|0)),Vl(f)),(f=0|ar[i>>2])&&((0|(n=0|ar[l>>2]))!=(0|f)&&(ar[l>>2]=n+(~((n+-4-f|0)>>>2)<<2)),Vl(f)),uo(l=A+8|0)}function hr(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0;if(0|ar[(i=(A|=0)+136|0)>>2]&&br(28004,28026,169,28036),n=0|Gl(230614<e>>>0|4294967279<(n=18624*e|0)>>>0?-1:n+16|0),ar[n+12>>2]=e,n=n+16|0,!e)return ar[i>>2]=n,void(ar[(n=A+140|0)>>2]=e);for(r=n+(18624*e|0)|0,f=n;pt(f+18580|0),o=f+18592|0,t=0==(0|(t=15&(c=f+48|0)))?c:c+(16-t)|0,ar[(a=f+18508|0)>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[a+16>>2]=0,ar[o>>2]=0,ar[o+4>>2]=0,ar[o+8>>2]=0,ar[o+12>>2]=0,Vu((ar[o+16>>2]=0)|(ar[f+2112>>2]=t),0,2048),(0|(f=f+18624|0))!=(0|r););ar[i>>2]=n,ar[(c=A+140|0)>>2]=e}function wr(A,e){A|=0;var r,i=0,f=0,n=0,t=0;Vu((e|=0)+48|0,0,2064),ar[e+18532>>2]=-1,ar[e+18536>>2]=-1,r=0|ar[e+18596>>2],(0|(A=0|ar[16+(0|ar[e+18600>>2])>>2]))<=0||(A=(1+((0|(n=0|ar[(0|ar[10284+r>>2])+((0|ar[(0|ar[10272+r>>2])+(A<<2)>>2])-1<<2)>>2]))%(0|(t=0|ar[5820+r>>2]))|0)<<(f=0|ar[5804+r>>2]))-1|0,f=(1+((0|n)/(0|t)|0)<<f)-1|0,t=(0|ar[1248+r>>2])-1|0,n=(0|ar[1252+r>>2])-1|0,A=((0|t)<(0|A)?t:A)>>(i=0|ar[10368+r>>2]),i=((0|n)<(0|f)?n:f)>>i,(0|A)<=-1&&br(41808,41845,118,41865),(0|(f=0|ar[10372+r>>2]))<=(0|A)&&br(41808,41845,118,41865),(0|i)<=-1&&br(41869,41845,119,41865),(0|i)>=(0|ar[10376+r>>2])&&br(41869,41845,119,41865),t=(0|ar[10360+r>>2])+(3*((0|sr(f,i))+A|0)|0)+2|0,ar[e+18528>>2]=tr[t>>0])}function vr(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=(A|=0)+4|0,n=0|ar[A>>2],1073741823<(o=1+(i=(t=(0|ar[f>>2])-n|0)>>2)|0)>>>0&&il(),a=(c=(0|ar[(l=A+8|0)>>2])-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t),ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),n&&Vl(n)}function gr(A,e){A|=0,e|=0;var r,i,f,n=0,t=0,o=0;if(ur=(f=ur)+656|0,ar[(n=(r=f)+592|0)>>2]=0,ar[(i=r+596|0)>>2]=0,ar[r+600>>2]=0,ar[(t=r+628|0)>>2]=0,ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t+12>>2]=0,ar[t+16>>2]=0,o=(e=(ar[t+20>>2]=0)|function(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(l=0|at(r|=0,4),15<(0|(ar[A>>2]=l)))return 0|(r=8);if(ct(r,2),l=0|at(r,6),ar[A+4>>2]=l+1,62<(0|l))return 0|(r=8);if(l=0|at(r,3),ar[(t=A+8|0)>>2]=l+1,6<(0|l))return 0|(r=8);l=0|at(r,1),ar[A+12>>2]=l,ct(r,16),nt(A+16|0,r,0|ar[t>>2]),l=0|at(r,1),ar[(o=A+484|0)>>2]=l,i=0|ar[t>>2],l?0<(0|i)&&(a=0,f=7):(a=i+-1|0,f=7);do{if(7==(0|f)){for(i=a;;){if(n=0|ut(r),ar[(l=A+488+(12*i|0)|0)>>2]=n,n=0|ut(r),ar[(f=A+488+(12*i|0)+4|0)>>2]=n,n=0|ut(r),ar[A+488+(12*i|0)+8>>2]=n,-99999==(0|ar[l>>2])){i=8,f=48;break}if(i=i+1|0,-99999==(0|n)|-99999==(0|ar[f>>2])){i=8,f=48;break}if((0|i)>=(0|ar[t>>2])){f=11;break}}if(11==(0|f)){if(0|ar[o>>2])break;if(8<=(0|a)&&br(37913,37838,144,37953),(0|a)<=0)break;for(f=A+488+(12*a|0)|0,n=A+488+(12*a|0)+4|0,t=A+488+(12*a|0)+8|0,i=0;ar[A+488+(12*i|0)>>2]=ar[f>>2],ar[A+488+(12*i|0)+4>>2]=ar[n>>2],ar[A+488+(12*i|0)+8>>2]=ar[t>>2],(0|(i=i+1|0))!=(0|a););}else if(48==(0|f))return 0|i}}while(0);if(a=255&(0|at(r,6)),tr[(c=A+584|0)>>0]=a,a=0|ut(r),-99999==(0|(ar[(l=A+588|0)>>2]=a))|1023<(t=a+1|0)>>>0)return Gr(e,8,0),0|(r=8);if(ar[l>>2]=t,a=A+592|0,i=0|ar[(o=A+596|0)>>2],n=0|ar[a>>2],t>>>0<=(f=(i-n|0)/12|0)>>>0){if(t>>>0<f>>>0&&(0|i)!=(0|(u=n+(12*t|0)|0)))for(;i=i+-12|0,ar[o>>2]=i,(f=0|ar[i>>2])&&(Vl(f),i=0|ar[o>>2]),(0|i)!=(0|u););}else!function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if(t=0|ar[(i=8+(A|=0)|0)>>2],n=0|ar[(u=A+4|0)>>2],((t-(f=n)|0)/12|0)>>>0>=e>>>0)return Vu(0|n,0,12*e|0),ar[u>>2]=f+(12*e|0);l=0|ar[A>>2],357913941<(n=(a=(n-(r=l)|0)/12|0)+e|0)>>>0&&il();o=(c=(t-l|0)/12|0)<<1,o=c>>>0<178956970?o>>>0<n>>>0?n:o:357913941;do{if(o){if(!(357913941<o>>>0)){c=0|El(12*o|0);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else c=0}while(0);if(n=c+(12*a|0)|0,c=c+(12*o|0)|0,Vu(0|(t=n),0,12*e|0),a=n+(12*e|0)|0,(0|f)==(0|r))o=l;else{for(;f=(l=f)+-12|0,ar[n+-12>>2]=ar[f>>2],e=l+-8|0,ar[n+-8>>2]=ar[e>>2],l=l+-4|0,ar[n+-4>>2]=ar[l>>2],ar[f>>2]=0,ar[e>>2]=0,ar[l>>2]=0,t=n=t+-12|0,(0|f)!=(0|r););o=0|ar[A>>2],f=0|ar[u>>2]}if(ar[A>>2]=t,ar[u>>2]=a,ar[i>>2]=c,(0|f)!=(0|(t=o)))for(;0|(n=0|ar[(f=f+-12|0)>>2])&&Vl(n),(0|f)!=(0|t););if(!o)return;Vl(o)}(a,t-f|0);if(1<(0|ar[l>>2]))for(f=1,n=0|ar[a>>2],i=0|tr[c>>0];;){for(un(n+(12*f|0)|0,1+(255&i)|0,0),n=0;o=0!=(0|at(r,1)),t=0|ar[a>>2],i=(0|ar[t+(12*f|0)>>2])+(n>>>5<<2)|0,u=1<<(31&n),e=0|ar[i>>2],ar[i>>2]=o?e|u:e&~u,i=0|tr[c>>0],(0|n)<(255&i|0);)n=n+1|0;if(!((0|(f=f+1|0))<(0|ar[l>>2])))break;n=t}if(u=255&(0|at(r,1)),(tr[A+604>>0]=u)<<24>>24&&(u=0|at(r,32),ar[A+608>>2]=u,u=0|at(r,32),ar[A+612>>2]=u,u=255&(0|at(r,1)),(tr[A+616>>0]=u)<<24>>24)&&(i=1+(0|ut(r))|0,ar[A+620>>2]=i,i=0|ut(r),1023<(0|(ar[(e=A+624|0)>>2]=i))&&br(49065,37838,189,37953),c=A+628|0,o=0|ar[(f=A+632|0)>>2],t=0|ar[c>>2],i>>>0<=(n=o-t>>1)>>>0?i>>>0<n>>>0&&(0|o)!=(0|(s=t+(i<<1)|0))&&(ar[f>>2]=o+(~((o+-2-s|0)>>>1)<<1)):(function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;if(a=0|ar[(t=8+(A|=0)|0)>>2],o=0|ar[(l=A+4|0)>>2],e>>>0<=a-o>>1>>>0)return Vu(0|o,0,e<<1|0),ar[l>>2]=o+(e<<1);n=0|ar[A>>2],(0|(o=(i=(f=o-n|0)>>1)+e|0))<0&&il();a=(a=a-n|0)>>1>>>0<1073741823?a>>>0<o>>>0?o:a:2147483647;do{if(a){if(!((0|a)<0)){c=0|El(a<<1);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);Vu(0|(r=c+(i<<1)|0),0,e<<1|0),o=r+(0-i<<1)|0,0<(0|f)&&Eu(0|o,0|n,0|f);if(ar[A>>2]=o,ar[l>>2]=r+(e<<1),ar[t>>2]=c+(a<<1),!n)return;Vl(n)}(c,i-n|0),i=0|ar[e>>2]),f=A+640|0,a=0|ar[(n=A+644|0)>>2],o=0|ar[f>>2],i>>>0<=(t=a-o|0)>>>0?i>>>0<t>>>0&&(0|a)!=(0|(b=o+i|0))&&(ar[n>>2]=b):(function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0;if(t=0|ar[(r=8+(A|=0)|0)>>2],f=0|ar[(i=A+4|0)>>2],e>>>0<=(t-f|0)>>>0){for(;tr[f>>0]=0,f=1+(0|ar[i>>2])|0,ar[i>>2]=f,0!=(0|(e=e+-1|0)););return}n=0|ar[A>>2],(0|(f=(o=f-n|0)+e|0))<0&&il();a=(t=t-n|0)<<1,n=(f=t>>>0<1073741823?a>>>0<f>>>0?f:a:2147483647)?0|El(f):0;a=n+o|0,o=n+f|0,f=t=a;for(;tr[f>>0]=0,t=f=t+1|0,e=e+-1|0,0!=(0|e););e=0|ar[A>>2],n=(0|ar[i>>2])-e|0,f=a+(0-n)|0,0<(0|n)&&Eu(0|f,0|e,0|n);if(ar[A>>2]=f,ar[i>>2]=t,ar[r>>2]=o,!e)return;Vl(e)}(f,i-t|0),i=0|ar[e>>2]),0<(0|i)))return r=65535&(0|ut(r)),or[ar[c>>2]>>1]=r,(r=0)|r;return r=255&(0|at(r,1)),tr[A+652>>0]=r,(r=0)|r}(r,A+4|0,e))||(-1<(0|(e=0|ar[A+520>>2]))&&function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;switch(ur=(h=ur)+208|0,E=h+192|0,k=h+184|0,d=h+176|0,B=h+168|0,b=h+160|0,I=h+152|0,s=h+144|0,W=h+128|0,u=h+120|0,C=h+112|0,a=h+104|0,Z=h+96|0,f=h+88|0,i=h+80|0,o=h+72|0,t=h+64|0,n=h+56|0,r=h+48|0,y=h+40|0,p=h+32|0,m=h+24|0,g=h+16|0,v=h+8|0,l=(w=h)+200|0,0|(e|=0)){case 1:e=8516;break;case 2:e=9020;break;default:return ur=h}if(ft(c=0|ar[e>>2],37958,w),ar[v>>2]=ar[A>>2],ft(c,37999,v),ar[g>>2]=ar[A+4>>2],ft(c,38043,g),v=A+8|0,ar[m>>2]=ar[v>>2],ft(c,38087,m),ar[p>>2]=ar[A+12>>2],ft(c,38131,p),p=0|ar[v>>2],ot(A+16|0,1,c),w=p+-1|0,1<(0|p))for(e=0;ar[y>>2]=e,ft(c,38175,y),ot(A+68+(52*e|0)|0,0,c),(0|(e=e+1|0))!=(0|w););if(y=A+484|0,ar[r>>2]=ar[y>>2],ft(c,38208,r),0|ar[y>>2]){if(0<(0|ar[v>>2]))for(e=0;Z=0|ar[A+488+(12*e|0)>>2],ar[n>>2]=e,ar[4+n>>2]=Z,ft(c,38255,n),ar[t>>2]=ar[A+488+(12*e|0)+4>>2],ft(c,38297,t),ar[o>>2]=ar[A+488+(12*e|0)+8>>2],ft(c,38338,o),(0|(e=e+1|0))<(0|ar[v>>2]););}else ar[i>>2]=ar[A+488>>2],ft(c,38379,i),ar[f>>2]=ar[A+492>>2],ft(c,38424,f),ar[Z>>2]=ar[A+496>>2],ft(c,38469,Z);if(p=A+584|0,ar[a>>2]=cr[p>>0],ft(c,38514,a),m=A+588|0,ar[C>>2]=ar[m>>2],ft(c,38539,C),1<(0|ar[m>>2])){v=A+592|0,g=4+l|0,w=1;do{for(e=0;ar[l>>2]=(0|ar[(0|ar[v>>2])+(12*w|0)>>2])+(e>>>5<<2),ar[g>>2]=1<<(31&e),ar[W>>2]=w,ar[W+4>>2]=e,tr[(C=W+8|0)>>0]=0|tr[l>>0],tr[C+1>>0]=0|tr[1+l>>0],tr[C+2>>0]=0|tr[2+l>>0],tr[C+3>>0]=0|tr[3+l>>0],tr[C+4>>0]=0|tr[4+l>>0],tr[C+5>>0]=0|tr[5+l>>0],tr[C+6>>0]=0|tr[6+l>>0],tr[C+7>>0]=0|tr[7+l>>0],ft(c,38599,W),(0|e)<(0|cr[p>>0]);)e=e+1|0;w=w+1|0}while((0|w)<(0|ar[m>>2]))}if(W=A+604|0,ar[u>>2]=tr[W>>0],ft(c,38564,u),0|tr[W>>0]&&(ar[s>>2]=ar[A+608>>2],ft(c,38636,s),ar[I>>2]=ar[A+612>>2],ft(c,38664,I),I=A+616|0,ar[b>>2]=tr[I>>0],ft(c,38692,b),0|tr[I>>0])&&(ar[B>>2]=ar[A+620>>2],ft(c,38734,B),B=A+624|0,ar[d>>2]=ar[B>>2],ft(c,38767,d),0<(0|ar[B>>2])))return E=0|lr[ar[A+628>>2]>>1],ar[k>>2]=0,ar[4+k>>2]=E,ft(c,38800,k),ur=h;ar[E>>2]=tr[A+652>>0],ft(c,38828,E),ur=h}(r,e),Eu(0|(o=A+600+(656*(e=0|ar[r>>2])|0)|0),0|r,592),(0|o)==(0|r)?(n=r+604|0,ar[(o=A+600+(656*e|0)+604|0)>>2]=ar[n>>2],ar[o+4>>2]=ar[n+4>>2],ar[o+8>>2]=ar[n+8>>2],ar[o+12>>2]=ar[n+12>>2],ar[o+16>>2]=ar[n+16>>2],ar[o+20>>2]=ar[n+20>>2]):(mr(A+600+(656*e|0)+592|0,0|ar[n>>2],0|ar[i>>2]),n=r+604|0,ar[(o=A+600+(656*e|0)+604|0)>>2]=ar[n>>2],ar[o+4>>2]=ar[n+4>>2],ar[o+8>>2]=ar[n+8>>2],ar[o+12>>2]=ar[n+12>>2],ar[o+16>>2]=ar[n+16>>2],ar[o+20>>2]=ar[n+20>>2],pr(A+600+(656*e|0)+628|0,0|ar[t>>2],0|ar[r+632>>2]),yr(A+600+(656*e|0)+640|0,0|ar[r+640>>2],0|ar[r+644>>2])),tr[A+600+(656*e|0)+652>>0]=0|tr[r+652>>0],0),0|(e=0|ar[r+640>>2])&&((0|ar[(A=r+644|0)>>2])!=(0|e)&&(ar[A>>2]=e),Vl(e)),0|(e=0|ar[t>>2])&&((0|(n=0|ar[(A=r+632|0)>>2]))!=(0|e)&&(ar[A>>2]=n+(~((n+-2-e|0)>>>1)<<1)),Vl(e)),!(e=0|ar[(t=r+592|0)>>2]))return ur=f,0|o;if((0|(A=0|ar[i>>2]))!=(0|e)){for(;A=A+-12|0,ar[i>>2]=A,(n=0|ar[A>>2])&&(Vl(n),A=0|ar[i>>2]),(0|A)!=(0|e););e=0|ar[t>>2]}return Vl(e),ur=f,0|o}function mr(A,e,r){var i,f,n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;if(ur=(c=ur)+32|0,t=c+24|0,n=c+16|0,o=c+8|0,a=c,f=((r|=0)-(e|=0)|0)/12|0,(((u=0|ar[(d=(A|=0)+8|0)>>2])-(l=i=0|ar[A>>2])|0)/12|0)>>>0<f>>>0){if(i){if((0|(u=0|ar[(b=A+4|0)>>2]))==(0|l))u=i;else{for(;u=u+-12|0,ar[b>>2]=u,(s=0|ar[u>>2])&&(Vl(s),u=0|ar[b>>2]),(0|u)!=(0|l););u=0|ar[A>>2]}Vl(u),ar[d>>2]=0,ar[b>>2]=0,u=ar[A>>2]=0}if(357913941<f>>>0&&il(),u=(g=(0|u)/12|0)<<1,357913941<(u=g>>>0<178956970?u>>>0<f>>>0?f:u:357913941)>>>0&&il(),s=0|El(12*u|0),ar[(g=A+4|0)>>2]=s,ar[A>>2]=s,ar[d>>2]=s+(12*u|0),(0|e)==(0|r))return void(ur=c);for(w=4+o|0,v=a+4|0,h=e;;){if(ar[s>>2]=0,ar[(u=s+4|0)>>2]=0,(ar[(b=s+8|0)>>2]=0)|(k=0|ar[(d=h+4|0)>>2])){if((0|k)<0){u=42;break}p=0|El((k=1+((k+-1|0)>>>5)|0)<<2),ar[s>>2]=p,ar[u>>2]=0,ar[b>>2]=k,b=0|ar[h>>2],ar[o>>2]=b,k=(ar[w>>2]=0)|ar[d>>2],ar[a>>2]=b+(k>>>5<<2),ar[v>>2]=31&k,ar[n>>2]=ar[o>>2],ar[4+n>>2]=ar[4+o>>2],ar[t>>2]=ar[a>>2],ar[4+t>>2]=ar[a+4>>2],Zr(s,n,t)}if(h=h+12|0,u=12+(0|ar[g>>2])|0,ar[g>>2]=u,(0|h)==(0|r)){u=45;break}s=u}if(42==(0|u))il();else if(45==(0|u))return void(ur=c)}w=(d=((0|ar[(v=A+4|0)>>2])-i|0)/12|0)>>>0<f>>>0,d=e+(12*d|0)|0,h=w?d:r;A:do{if((0|h)==(0|e))m=l;else{for(;;){if((0|l)!=(0|e)){if(u=0|ar[(k=e+4|0)>>2]){if(u>>>0>ar[(b=l+8|0)>>2]<<5>>>0){if((s=0|ar[l>>2])&&(Vl(s),ar[l>>2]=0,ar[b>>2]=0,u=(ar[l+4>>2]=0)|ar[k>>2]),(0|u)<0)break;s=0|El((u=1+((u+-1|0)>>>5)|0)<<2),ar[l>>2]=s,ar[l+4>>2]=0,ar[b>>2]=u,u=0|ar[k>>2]}else s=0|ar[l>>2];Gu(0|s,0|ar[e>>2],4+((u+-1|0)>>>5<<2)|0),u=0|ar[k>>2]}else u=0;ar[l+4>>2]=u}if(l=l+12|0,(0|(e=e+12|0))==(0|h)){m=l;break A}}il()}}while(0);if(w)if((0|h)!=(0|r)){for(k=4+o|0,e=a+4|0,h=0|ar[v>>2];;){if(ar[h>>2]=0,ar[(l=h+4|0)>>2]=0,(ar[(u=h+8|0)>>2]=0)|(b=0|ar[(s=d+4|0)>>2])){if((0|b)<0){u=20;break}p=0|El((m=1+((b+-1|0)>>>5)|0)<<2),ar[h>>2]=p,ar[l>>2]=0,ar[u>>2]=m,m=0|ar[d>>2],ar[o>>2]=m,p=(ar[k>>2]=0)|ar[s>>2],ar[a>>2]=m+(p>>>5<<2),ar[e>>2]=31&p,ar[n>>2]=ar[o>>2],ar[4+n>>2]=ar[4+o>>2],ar[t>>2]=ar[a>>2],ar[4+t>>2]=ar[a+4>>2],Zr(h,n,t)}if(d=d+12|0,l=12+(0|ar[v>>2])|0,ar[v>>2]=l,(0|d)==(0|r)){u=45;break}h=l}if(20==(0|u))il();else if(45==(0|u))return void(ur=c)}else ur=c;else{if((0|(l=0|ar[v>>2]))==(0|m))return void(ur=c);for(;l=l+-12|0,ar[v>>2]=l,(u=0|ar[l>>2])&&(Vl(u),l=0|ar[v>>2]),(0|l)!=(0|m););ur=c}}function pr(A,e,r){var i,f,n,t,o=0,a=0,c=0,l=0;if((c=(l=(i=r|=0)-(e|=0)|0)>>1)>>>0<=(o=0|ar[(f=(A|=0)+8|0)>>2])-(n=t=0|ar[A>>2])>>1>>>0)return 0|(r=(o=(a=c=(A=(a=(0|ar[(l=A+4|0)>>2])-t>>1)>>>0<c>>>0)?e+(a<<1)|0:r)-e|0)>>1)&&Gu(0|t,0|e,0|o),r=n+(r<<1)|0,A?!((0|(o=i-a|0))<=0)&&(Eu(0|ar[l>>2],0|c,0|o),void(ar[l>>2]=(0|ar[l>>2])+(o>>>1<<1))):(0|(o=0|ar[l>>2]))!=(0|r)&&void(ar[l>>2]=o+(~((o+-2-r|0)>>>1)<<1));(a=t)&&((0|(r=0|ar[(o=A+4|0)>>2]))!=(0|n)&&(ar[o>>2]=r+(~((r+-2-t|0)>>>1)<<1)),Vl(a),ar[f>>2]=0,ar[o>>2]=0,o=ar[A>>2]=0),(0|l)<0&&il(),(0|(o=o>>1>>>0<1073741823?o>>>0<c>>>0?c:o:2147483647))<0&&il(),r=0|El(o<<1),ar[(a=A+4|0)>>2]=r,ar[A>>2]=r,ar[f>>2]=r+(o<<1),(0|l)<=0||(Eu(0|r,0|e,0|l),ar[a>>2]=r+(l>>>1<<1))}function yr(A,e,r){var i,f,n=0,t=0,o=0,a=0,c=0;return f=(c=r|=0)-(i=e|=0)|0,((n=0|ar[(o=(A|=0)+8|0)>>2])-(a=t=0|ar[A>>2])|0)>>>0<f>>>0?(t&&((0|ar[(n=A+4|0)>>2])!=(0|a)&&(ar[n>>2]=a),Vl(a),ar[o>>2]=0,ar[n>>2]=0,n=ar[A>>2]=0),(0|f)<0&&il(),c=n<<1,(0|(n=n>>>0<1073741823?c>>>0<f>>>0?f:c:2147483647))<0&&il(),a=0|El(n),ar[(c=A+4|0)>>2]=a,ar[A>>2]=a,ar[o>>2]=a+n,Eu(0|a,0|e,0|f),void(ar[c>>2]=a+f)):(0|(n=(t=r=(A=(t=(0|ar[(o=A+4|0)>>2])-t|0)>>>0<f>>>0)?e+t|0:r)-i|0)&&Gu(0|a,0|e,0|n),n=a+n|0,A?!((0|(n=c-t|0))<=0)&&(Eu(0|ar[o>>2],0|r,0|n),void(ar[o>>2]=(0|ar[o>>2])+n)):(0|ar[o>>2])!=(0|n)&&void(ar[o>>2]=n))}function Zr(A,e,r){e|=0,r|=0;var i,f,n,t,o,a,c,l,u,s=0,b=0,d=0,k=0,h=0;if(ur=(u=ur)+48|0,a=u+40|0,o=u+32|0,f=u+8|0,t=(n=u)+24|0,l=u+16|0,h=0|ar[(d=(A|=0)+4|0)>>2],c=0|ar[(s=e)>>2],s=0|ar[s+4>>2],b=0|ar[(k=r)>>2],k=0|ar[k+4>>2],i=b-c<<3,ar[d>>2]=h-s+k+i,e=d=(0|ar[A>>2])+(h>>>5<<2)|0,(0|s)!=(0|(r=31&h)))return ar[(h=f)>>2]=c,ar[h+4>>2]=s,ar[(h=n)>>2]=b,ar[h+4>>2]=k,ar[t>>2]=e,ar[4+t>>2]=r,ar[o>>2]=ar[f>>2],ar[4+o>>2]=ar[4+f>>2],ar[a>>2]=ar[n>>2],ar[4+a>>2]=ar[n+4>>2],function(A,e,r,i){A|=0,r|=0,i|=0;var f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0;if(d=0|ar[(e|=0)>>2],u=0|ar[e+4>>2],o=((0|ar[r>>2])-d<<3)+(0|ar[r+4>>2])-u|0,r=d,(0|o)<=0)return e=i+4|0,i=0|ar[i>>2],ar[A>>2]=i,i=A+4|0,A=0|ar[e>>2],ar[i>>2]=A;u?(t=-1>>>((t=32-u|0)-(l=(0|o)<(0|t)?o:t)|0)&-1<<u&ar[r>>2],f=0|ar[(s=i+4|0)>>2],n=(c=32-f|0)>>>0<l>>>0?c:l,a=0|ar[i>>2],f=ar[a>>2]&~(-1>>>(c-n|0)&-1<<f),ar[a>>2]=f,c=0|ar[s>>2],ar[a>>2]=(u>>>0<c>>>0?t<<c-u:t>>>(u-c|0))|f,f=(0|ar[s>>2])+n|0,a=a+(f>>>5<<2)|0,ar[i>>2]=a,f&=31,ar[s>>2]=f,0<(0|(c=l-n|0))&&(ar[a>>2]=t>>>(u+n|0)|ar[a>>2]&~(-1>>>(32-c|0)),ar[s>>2]=c,f=c),r=r+4|0,ar[e>>2]=r,o=o-l|0):f=0|ar[(s=f=i+4|0)>>2];if(d=32-f|0,c=-1<<f,31<(0|o)){for(l=~c,a=0|ar[i>>2],u=(b=(f=o+-32|0)>>>5)+1|0,b=f-(b<<5)|0,f=r,n=0|ar[a>>2],t=a;k=0|ar[f>>2],h=n&l,ar[t>>2]=h,ar[t>>2]=k<<ar[s>>2]|h,n=ar[(t=t+4|0)>>2]&c|k>>>d,ar[t>>2]=n,!((0|(o=o+-32|0))<=31);)f=f+4|0;r=r+(u<<2)|0,ar[e>>2]=r,ar[i>>2]=a+(u<<2),o=b}if((0|o)<=0)return k=s,h=0|ar[i>>2],ar[A>>2]=h,h=A+4|0,k=0|ar[k>>2],ar[h>>2]=k;if(t=ar[r>>2]&-1>>>(32-o|0),n=(0|d)<(0|o)?d:o,f=0|ar[i>>2],r=ar[f>>2]&~(-1<<ar[s>>2]&-1>>>(d-n|0)),ar[f>>2]=r,ar[f>>2]=r|t<<ar[s>>2],r=(0|ar[s>>2])+n|0,f=f+(r>>>5<<2)|0,ar[i>>2]=f,ar[s>>2]=31&r,(0|(r=o-n|0))<=0)return k=s,h=0|ar[i>>2],ar[A>>2]=h,h=A+4|0,k=0|ar[k>>2],ar[h>>2]=k;ar[f>>2]=ar[f>>2]&~(-1>>>(32-r|0))|t>>>n,ar[s>>2]=r,k=s,h=0|ar[i>>2],ar[A>>2]=h,h=A+4|0,k=0|ar[k>>2],ar[h>>2]=k}(l,o,a,t),void(ur=u);r=k-s+i|0,k=c,0<(0|r)&&(e=s?(e=-1>>>((e=32-s|0)-(h=(0|r)<(0|e)?r:e)|0)&-1<<s,ar[d>>2]=ar[d>>2]&~e|ar[k>>2]&e,r=r-h|0,s=31&(e=h+s|0),d=d+(e>>>5<<2)|0,k=k+4|0):(s=0,c),Gu(0|d,0|e,(b=(0|r)/32|0)<<2|0),A=r-(b<<5)|0,e=r=d+(b<<2)|0,0<(0|A)&&(s=-1>>>(32-A|0),ar[r>>2]=ar[r>>2]&~s|ar[k+(b<<2)>>2]&s,s=A)),ar[l>>2]=e,ar[4+l>>2]=s,ur=u}function Cr(A,e){A|=0,e|=0;var r,i,f=0;return ur=(i=ur)+5168|0,Qn(r=i),0|(e=0|function(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if(c=255&(0|at(r|=0,4)),tr[A+1>>0]=c,c=1+(0|at(r,3))|0,117440512<((tr[(o=A+2|0)>>0]=c)<<24|0))return 0|(A=8);if(i=255&(0|at(r,1)),tr[A+3>>0]=i,nt(A+4|0,r,0|tr[o>>0]),-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(15<(0|(ar[A+472>>2]=i)))return 0|(A=8);if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);3==(0|(ar[(f=A+476|0)>>2]=i))?(n=255&(0|at(r,1)),i=0|ar[f>>2]):n=0;if(tr[A+480>>0]=n,ar[A+5012>>2]=n<<24>>24==0?i:0,3<i>>>0)return Gr(e,1019,0),0|(A=8);if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[(f=A+484|0)>>2]=i,-99999==(0|(n=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+488>>2]=n,i=0|ar[f>>2],0==(0|n)|0==(0|i))return 0|(A=8);if(7e4<(0|n)|7e4<(0|i))return 0|(A=8);if(c=255&(0|at(r,1)),(tr[A+492>>0]=c)<<24>>24){if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+496>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+500>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+504>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8)}else ar[A+496>>2]=0,ar[A+500>>2]=0,ar[A+504>>2]=0,i=0;if(ar[A+508>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+512>>2]=i+8,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+516>>2]=i+8,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);a=i+4|0,ar[(c=A+520|0)>>2]=a,ar[A+5032>>2]=1<<a,a=255&(0|at(r,1)),(tr[(t=A+524|0)>>0]=a)<<24>>24?(i=0,l=35):(n=0|tr[o>>0],i=(n<<24>>24)-1|0);for(;;){if(35==(0|l)&&(n=0|tr[o>>0]),(0|(f=n<<24>>24))<=(0|i)){l=44;break}if(-99999==(0|(f=0|ut(r)))|15<(0|f)){l=38;break}if(ar[A+528+(i<<2)>>2]=f+1,-99999==(0|(f=0|ut(r)))){l=40;break}if(ar[(n=A+556+(i<<2)|0)>>2]=f,-99999==(0|(f=0|ut(r)))){l=42;break}ar[A+584+(i<<2)>>2]=f,ar[A+5128+(i<<2)>>2]=f+-1+(0|ar[n>>2]),i=i+1|0,l=35}{if(38==(0|l))return Gr(e,8,0),0|(A=8);if(40==(0|l))return Gr(e,8,0),0|(A=8);if(42==(0|l))return Gr(e,8,0),0|(A=8);if(44==(0|l)){if(0|tr[t>>0]&&(i=f+-1|0,8<=n<<24>>24&&br(34959,34965,317,37953),1<n<<24>>24))for(n=A+528+(i<<2)|0,t=A+556+(i<<2)|0,f=A+584+(i<<2)|0,i=0;ar[A+528+(i<<2)>>2]=ar[n>>2],ar[A+556+(i<<2)>>2]=ar[t>>2],ar[A+584+(i<<2)>>2]=ar[f>>2],(0|(i=i+1|0))<((0|tr[o>>0])-1|0););if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[(t=A+612|0)>>2]=i+3,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[(o=A+616|0)>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[(f=A+620|0)>>2]=i+2,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[(n=A+624|0)>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+628>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+632>>2]=i,6<(0|(i=0|ar[t>>2])))return 0|(A=8);if(6<((0|ar[o>>2])+i|0))return 0|(A=8);if(5<(0|(i=0|ar[f>>2])))return 0|(A=8);if(5<((0|ar[n>>2])+i|0))return 0|(A=8);a=255&(0|at(r,1)),tr[A+636>>0]=a;do{if(a<<24>>24){if(a=255&(0|at(r,1)),tr[A+637>>0]=a,i=A+638|0,!(a<<24>>24)){Sn(i);break}if(!(i=0|Mn(r,0,i,0)))break;return 0|i}}while(0);a=255&(0|at(r,1)),tr[A+4702>>0]=a,a=255&(0|at(r,1)),tr[A+4703>>0]=a,a=255&(0|at(r,1)),tr[A+4704>>0]=a;do{if(a<<24>>24){if(i=1+(0|at(r,4))&255,tr[A+4705>>0]=i,i=1+(0|at(r,4))&255,tr[A+4706>>0]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(ar[A+4708>>2]=i+3,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);ar[A+4712>>2]=i,i=255&(0|at(r,1));break}tr[A+4705>>0]=0,tr[A+4706>>0]=0,ar[A+4708>>2]=0,ar[A+4712>>2]=0,i=0}while(0);if(tr[A+4716>>0]=i,-99999==(0|(o=0|ut(r))))return Gr(e,8,0),0|(A=8);if(64<o>>>0)return Gr(e,1014,0),0|(A=8);if(a=A+4720|0,t=0|ar[(n=A+4724|0)>>2],f=0|ar[a>>2],o>>>0<=(i=(t-f|0)/100|0)>>>0){do{if(o>>>0<i>>>0){if((0|t)==(0|(i=f+(100*o|0)|0)))break;ar[n>>2]=t+(100*~(((t+-100-i|0)>>>0)/100|0)|0)}}while(0);0<(0|o)&&(l=87)}else!function(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0;if(n=0|ar[(r=8+(A|=0)|0)>>2],i=0|ar[(a=A+4|0)>>2],e>>>0<=((n-i|0)/100|0)>>>0){do{for(f=i+100|0;((or[i>>1]=0)|(i=i+2|0))<(0|f););i=100+(0|ar[a>>2])|0,ar[a>>2]=i,e=e+-1|0}while(0!=(0|e));return}f=0|ar[A>>2],42949672<(i=(t=(i-f|0)/100|0)+e|0)>>>0&&il();o=(n=(n-f|0)/100|0)<<1,i=n>>>0<21474836?o>>>0<i>>>0?i:o:42949672;do{if(i){if(!(42949672<i>>>0)){f=0|El(100*i|0);break}Fl(a=0|C(8),37845),ar[a>>2]=16004,I(0|a,3616,283)}else f=0}while(0);o=f+(100*t|0)|0,t=f+(100*i|0)|0,n=i=o;do{for(f=i+100|0;((or[i>>1]=0)|(i=i+2|0))<(0|f););n=i=n+100|0,e=e+-1|0}while(0!=(0|e));e=0|ar[A>>2],f=(0|ar[a>>2])-e|0,i=o+(100*((0|f)/-100|0)|0)|0,0<(0|f)&&Eu(0|i,0|e,0|f);if(ar[A>>2]=i,ar[a>>2]=n,ar[r>>2]=t,!e)return;Vl(e)}(a,o-i|0),l=87;A:do{if(87==(0|l)){for(i=0;;){if(!(0|Lo(e,A,r,(0|ar[a>>2])+(100*i|0)|0,i,a,0))){i=1005;break}if((0|o)<=(0|(i=i+1|0)))break A}return 0|i}}while(0);l=255&(0|at(r,1)),tr[A+4732>>0]=l;do{if(l<<24>>24){if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),0|(A=8);if(32<(0|(ar[(f=A+4736|0)>>2]=i)))return 0|(A=8);if(!(0<(0|i)))break;for(i=0;l=0|at(r,0|ar[c>>2]),ar[A+4740+(i<<2)>>2]=l,l=255&(0|at(r,1)),tr[A+4868+i>>0]=l,(0|(i=i+1|0))<(0|ar[f>>2]););}else ar[A+4736>>2]=0}while(0);l=255&(0|at(r,1)),tr[A+4900>>0]=l,l=255&(0|at(r,1)),tr[A+4901>>0]=l,l=255&(0|at(r,1)),(tr[A+4902>>0]=l)<<24>>24&&function(A,e,r,i){A|=0,e|=0,i|=0;var f,n,t=0,o=0,a=0,c=0;o=0!=(0|at(r|=0,1)),tr[A>>0]=1&o;do{if(o){if((0|(i=0|at(r,8)))<18){or[A+2>>1]=0|or[16140+(i<<2)>>1],i=0|or[16140+(i<<2)+2>>1];break}if(255==(0|i)){i=65535&(0|at(r,16)),or[A+2>>1]=i,i=65535&(0|at(r,16));break}or[A+2>>1]=0,i=0;break}or[A+2>>1]=0,i=0}while(0);or[A+4>>1]=i,o=0!=(0|at(r,1)),tr[A+6>>0]=1&o,o&&(o=0!=(0|at(r,1))&1,tr[A+7>>0]=o);if(ar[(i=A+12|0)>>2]=5,tr[(t=A+16|0)>>0]=0,tr[(f=A+18|0)>>0]=2,tr[(n=A+19|0)>>0]=2,tr[(o=A+20|0)>>0]=2,c=0!=(0|at(r,1)),tr[A+8>>0]=1&c,c&&(c=0|at(r,3),ar[i>>2]=(0|c)<5?c:5,c=0!=(0|at(r,1))&1,tr[t>>0]=c,c=0!=(0|at(r,1)),tr[A+17>>0]=1&c,c)){switch(i=0|at(r,8),c=255&i,(tr[f>>0]=c)<<24>>24){case 3:case 0:a=14;break;default:10<(255&i)>>>0&&(a=14)}switch(14==(0|a)&&(tr[f>>0]=2),i=0|at(r,8),c=255&i,(tr[n>>0]=c)<<24>>24){case 3:case 0:a=17;break;default:17<(254&i)>>>0&&(a=17)}17==(0|a)&&(tr[n>>0]=2),c=0|at(r,8),tr[o>>0]=9<((255&c)-1|0)>>>0?2:255&c}c=0!=(0|at(r,1)),tr[A+21>>0]=1&c;do{if(c){if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(tr[A+22>>0]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;i&=255;break}tr[A+22>>0]=0,i=0}while(0);if(tr[A+23>>0]=i,c=0!=(0|at(r,1))&1,tr[A+24>>0]=c,c=0!=(0|at(r,1))&1,tr[A+25>>0]=c,c=0!=(0|at(r,1))&1,tr[A+26>>0]=c,c=0!=(0|at(r,1)),tr[A+27>>0]=1&c,c){if(-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(ar[A+28>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(ar[A+32>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(ar[A+36>>2]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8}else ar[A+28>>2]=0,ar[A+32>>2]=0,ar[A+36>>2]=0,i=0;ar[A+40>>2]=i,c=0!=(0|at(r,1)),tr[A+44>>0]=1&c,c&&(c=0|at(r,32),ar[A+48>>2]=c,c=0|at(r,32),ar[A+52>>2]=c);if(i=0!=(0|at(r,1))&1,tr[A+56>>0]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(ar[A+60>>2]=i+1,c=0!=(0|at(r,1)),tr[A+64>>0]=1&c,c)return c=502;c=0!=(0|at(r,1)),tr[A+65>>0]=1&c;do{if(c){if(i=0!=(0|at(r,1))&1,tr[A+66>>0]=i,i=0!=(0|at(r,1))&1,tr[A+67>>0]=i,i=0!=(0|at(r,1))&1,tr[A+68>>0]=i,-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(4095<(61440&(or[(t=A+70|0)>>1]=i))>>>0&&(Gr(e,8,0),or[t>>1]=0),-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(16<(255&(tr[(t=A+72|0)>>0]=i))>>>0&&(Gr(e,8,0),tr[t>>0]=2),-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(16<(255&(tr[(t=A+73|0)>>0]=i))>>>0&&(Gr(e,8,0),tr[t>>0]=1),-99999==(0|(i=0|ut(r))))return Gr(e,8,0),c=8;if(15<(240&(tr[(t=A+74|0)>>0]=i))>>>0&&(Gr(e,8,0),tr[t>>0]=15),-99999==(0|(t=0|ut(r))))return Gr(e,8,0),c=8;if(15<(240&(tr[(i=A+75|0)>>0]=t))>>>0){Gr(e,8,0);break}return c=0}tr[A+66>>0]=0,tr[A+67>>0]=1,tr[A+68>>0]=0,or[A+70>>1]=0,tr[A+72>>0]=2,tr[A+73>>0]=1,tr[A+74>>0]=15,i=A+75|0}while(0);tr[i>>0]=15,c=0}(A+4904|0,e,r,A),e=255&(0|at(r,1)),tr[A+4980>>0]=e;do{if(e<<24>>24){if(l=255&(0|at(r,1)),tr[(e=A+4981|0)>>0]=l,l=255&(0|at(r,1)),tr[A+4982>>0]=l,l=255&(0|at(r,6)),tr[A+4983>>0]=l,!(0|tr[e>>0]))break;Un(A+4984|0,0,r)}else tr[A+4981>>0]=0}while(0);return 0|(i=0|function(A){var e,r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;b=0|ar[476+(A|=0)>>2],a=0|ar[6332+(b<<2)>>2],ar[A+5016>>2]=a,c=0|ar[6348+(b<<2)>>2],ar[A+5020>>2]=c,d=0==(0|ar[A+5012>>2]),ar[A+5024>>2]=d?1:a,ar[A+5028>>2]=d?1:c,d=0|ar[A+512>>2],ar[A+4996>>2]=d,ar[A+5e3>>2]=(6*d|0)-48,e=0|ar[A+516>>2],ar[A+5004>>2]=e,ar[A+5008>>2]=(6*e|0)-48,r=0|ar[A+612>>2],ar[A+5036>>2]=r,i=(0|ar[A+616>>2])+r|0,ar[A+5040>>2]=i,f=1<<r,ar[A+5044>>2]=f,o=1<<i,ar[A+5048>>2]=o,n=0|ar[A+484>>2],s=(f-1+n|0)/(0|f)|0,ar[A+5052>>2]=s,l=(n-1+o|0)/(0|o)|0,ar[A+5056>>2]=l,t=0|ar[A+488>>2],k=((u=t-1|0)+f|0)/(0|f)|0,ar[A+5060>>2]=k,u=(u+o|0)/(0|o)|0,ar[A+5064>>2]=u,s=0|sr(k,s),ar[A+5068>>2]=s,s=0|sr(u,l),ar[A+5072>>2]=s,s=0|sr(t,n),ar[A+5076>>2]=s,o=0!=(0|b)&&0==(0|tr[A+480>>0])?(ar[A+5080>>2]=(0|o)/(0|a)|0,(0|o)/(0|c)|0):(ar[A+5080>>2]=0,0);if(ar[A+5084>>2]=o,s=0|ar[A+620>>2],ar[A+5100>>2]=s,b=(0|ar[A+624>>2])+s|0,ar[A+5104>>2]=b,o=i-s|0,(0|ar[A+628>>2])>(0|o))return 0|(k=8);if((0|ar[A+632>>2])>(0|o))return 0|(k=8);k=r-1|0,ar[A+5108>>2]=k,k=i-k|0,ar[A+5112>>2]=l<<k,ar[A+5116>>2]=u<<k,k=0|ar[A+4708>>2],ar[A+5120>>2]=k,ar[A+5124>>2]=(0|ar[A+4712>>2])+k,k=l<<o,ar[A+5088>>2]=k,u<<=o,ar[A+5092>>2]=u,k=0|sr(u,k),ar[A+5096>>2]=k,l=0|tr[A+4990>>0]?(a=o=0,c=1<<e-1,1<<d+-1):(o=248+e&255,a=d+248&255,c=128);if(tr[A+5156>>0]=a,tr[A+5157>>0]=o,ar[A+5160>>2]=l,ar[A+5164>>2]=c,(0|n)%(0|f)|0)return 0|(k=8);if(0!=((0|t)%(0|f)|0)|(0|r)<(0|s))return 0|(k=8);if((0|((0|i)<5?i:5))<(0|b)|8<(d+-8|0)>>>0|8<(e-8|0)>>>0)return 0|(k=8);return tr[A>>0]=1,(k=0)|k}(A))?0|(A=i):(tr[A>>0]=1,(A=0)|A)}}return 0}(r,A+4|0,e))?(A=e,Tn(r),ur=i,0|A):(-1<(0|(e=0|ar[A+516>>2]))&&function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P,L,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0,fA=0,nA=0,tA=0,oA=0,aA=0,cA=0,lA=0,uA=0,sA=0;switch(ur=(L=ur)+496|0,P=L+480|0,z=L+472|0,j=L+464|0,x=L+456|0,H=L+448|0,O=L+440|0,U=L+432|0,S=L+424|0,M=L+416|0,T=L+408|0,Q=L+400|0,D=L+392|0,sA=L+384|0,J=L+376|0,Y=L+368|0,R=L+360|0,N=L+344|0,lA=L+336|0,cA=L+328|0,_=L+320|0,X=L+312|0,Z=L+304|0,y=L+296|0,p=L+288|0,m=L+280|0,V=L+272|0,G=L+264|0,aA=L+256|0,E=L+248|0,B=L+240|0,I=L+232|0,h=L+224|0,k=L+216|0,d=L+208|0,b=L+200|0,oA=L+192|0,tA=L+184|0,W=L+176|0,C=L+168|0,g=L+160|0,v=L+152|0,w=L+144|0,nA=L+136|0,s=L+128|0,u=L+120|0,l=L+112|0,c=L+104|0,a=L+96|0,o=L+88|0,t=L+80|0,n=L+72|0,fA=L+64|0,f=L+56|0,i=L+48|0,r=L+40|0,rA=L+32|0,eA=L+24|0,AA=L+16|0,$=L+8|0,q=L,0|(e|=0)){case 1:K=8516;break;case 2:K=9020;break;default:return ur=L}switch(ft(F=0|ar[K>>2],35191,q),ar[$>>2]=tr[A+1>>0],ft(F,35232,$),iA=A+2|0,ar[AA>>2]=tr[iA>>0],ft(F,35262,AA),ar[eA>>2]=tr[A+3>>0],ft(F,35292,eA),function(A,e,r){e|=0;var i,f,n;{if(ur=(n=ur)+16|0,f=n,ot(A|=0,1,r|=0),i=e+-1|0,!(1<(0|e)))return ur=n;e=0}for(;ar[f>>2]=e,ft(r,38175,f),ot(A+52+(52*e|0)|0,0,r),e=e+1|0,(0|e)!=(0|i););ur=n}(A+4|0,0|tr[iA>>0],F),ar[rA>>2]=ar[A+472>>2],ft(F,35327,rA),0|(q=0|ar[(K=A+476|0)>>2])){case 0:$=35371;break;case 1:$=35382;break;case 2:$=35388;break;default:$=3==(0|q)?35357:35363}ar[r>>2]=q,ar[4+r>>2]=$,ft(F,35394,r),3==(0|ar[K>>2])&&(ar[i>>2]=tr[A+480>>0],ft(F,35429,i));ar[f>>2]=ar[A+484>>2],ft(F,35462,f),ar[fA>>2]=ar[A+488>>2],ft(F,35495,fA),fA=A+492|0,ar[n>>2]=tr[fA>>0],ft(F,35528,n),0|tr[fA>>0]&&(ar[t>>2]=ar[A+496>>2],ft(F,35561,t),ar[o>>2]=ar[A+500>>2],ft(F,35589,o),ar[a>>2]=ar[A+504>>2],ft(F,35617,a),ar[c>>2]=ar[A+508>>2],ft(F,35645,c));if(ar[l>>2]=ar[A+512>>2],ft(F,35673,l),ar[u>>2]=ar[A+516>>2],ft(F,35696,u),ar[s>>2]=ar[A+520>>2],ft(F,35719,s),K=A+524|0,ar[nA>>2]=tr[K>>0],ft(F,35752,nA),nA=0|tr[iA>>0],(0|(K=0==(0|tr[K>>0])?(nA<<24>>24)-1|0:0))<(nA<<24>>24|0))for(;ar[b>>2]=K,ft(F,36082,b),ar[d>>2]=ar[A+528+(K<<2)>>2],ft(F,36092,d),ar[k>>2]=ar[A+556+(K<<2)>>2],ft(F,36131,k),ar[h>>2]=ar[A+584+(K<<2)>>2],ft(F,36170,h),K=K+1|0,(0|K)<(0|tr[iA>>0]););iA=A+612|0,ar[w>>2]=ar[iA>>2],ft(F,35799,w),rA=A+616|0,ar[v>>2]=ar[rA>>2],ft(F,35837,v),eA=A+620|0,ar[g>>2]=ar[eA>>2],ft(F,35884,g),AA=A+624|0,ar[C>>2]=ar[AA>>2],ft(F,35922,C),ar[W>>2]=ar[A+628>>2],ft(F,35967,W),ar[tA>>2]=ar[A+632>>2],ft(F,36009,tA),tA=A+636|0,ar[oA>>2]=tr[tA>>0],ft(F,36051,oA),0|tr[tA>>0]&&(oA=A+637|0,ar[I>>2]=tr[oA>>0],ft(F,36209,I),0|tr[oA>>0])&&ft(F,36250,B);ar[E>>2]=tr[A+4702>>0],ft(F,36294,E),ar[aA>>2]=tr[A+4703>>0],ft(F,36336,aA),aA=A+4704|0,ar[G>>2]=tr[aA>>0],ft(F,36378,G),0|tr[aA>>0]&&(ar[V>>2]=tr[A+4705>>0],ft(F,36420,V),ar[m>>2]=tr[A+4706>>0],ft(F,36456,m),ar[p>>2]=ar[A+4708>>2],ft(F,36492,p),ar[y>>2]=ar[A+4712>>2],ft(F,36534,y),ar[Z>>2]=tr[A+4716>>0],ft(F,36585,Z));if(q=A+4720|0,$=A+4724|0,ar[X>>2]=((0|ar[$>>2])-(0|ar[q>>2])|0)/100|0,ft(F,36621,X),(0|ar[$>>2])!=(0|ar[q>>2]))for(K=0;ar[cA>>2]=K,ft(F,36693,cA),Ko((0|ar[q>>2])+(100*K|0)|0,16,F),(K=K+1|0)>>>0<(((0|ar[$>>2])-(0|ar[q>>2])|0)/100|0)>>>0;);if(cA=A+4732|0,ar[_>>2]=tr[cA>>0],ft(F,36655,_),0|tr[cA>>0]&&(uA=A+4736|0,ar[lA>>2]=ar[uA>>2],ft(F,36714,lA),0<(0|ar[uA>>2])))for(K=0;cA=0|ar[A+4740+(K<<2)>>2],lA=0|tr[A+4868+K>>0],ar[N>>2]=K,ar[4+N>>2]=cA,ar[8+N>>2]=lA,ft(F,36747,N),(0|(K=K+1|0))<(0|ar[uA>>2]););ar[R>>2]=tr[A+4900>>0],ft(F,36816,R),ar[Y>>2]=tr[A+4901>>0],ft(F,36857,Y),K=A+4902|0,ar[J>>2]=tr[K>>0],ft(F,36898,J),ar[sA>>2]=tr[A+4980>>0],ft(F,36939,sA),sA=A+4981|0,ar[D>>2]=tr[sA>>0],ft(F,36975,D),ar[Q>>2]=tr[A+4982>>0],ft(F,37011,Q),ar[T>>2]=tr[A+4983>>0],ft(F,37047,T),ar[M>>2]=ar[A+5048>>2],ft(F,37083,M),ar[S>>2]=ar[A+5044>>2],ft(F,37102,S),ar[U>>2]=1<<(0|ar[rA>>2])+(0|ar[iA>>2]),ft(F,37121,U),ar[O>>2]=1<<ar[eA>>2],ft(F,37140,O),ar[H>>2]=1<<(0|ar[AA>>2])+(0|ar[eA>>2]),ft(F,37159,H),ar[x>>2]=ar[A+5056>>2],ft(F,37178,x),ar[j>>2]=ar[A+5064>>2],ft(F,37208,j),ar[z>>2]=ar[A+5016>>2],ft(F,37238,z),ar[P>>2]=ar[A+5020>>2],ft(F,37268,P),0|tr[sA>>0]&&function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s;switch(ur=(s=ur)+80|0,a=s+72|0,o=s+64|0,t=s+56|0,n=s+48|0,f=s+40|0,u=s+32|0,l=s+24|0,c=s+16|0,i=s+8|0,r=s,0|(e|=0)){case 1:e=8516;break;case 2:e=9020;break;default:return ur=s}ft(e=0|ar[e>>2],37298,r),ar[i>>2]=cr[A>>0],ft(e,37355,i),ar[c>>2]=cr[A+1>>0],ft(e,37401,c),ar[l>>2]=cr[A+2>>0],ft(e,37447,l),ar[u>>2]=cr[A+3>>0],ft(e,37493,u),ar[f>>2]=cr[A+4>>0],ft(e,37539,f),ar[n>>2]=cr[A+5>>0],ft(e,37585,n),ar[t>>2]=cr[A+6>>0],ft(e,37631,t),ar[o>>2]=cr[A+7>>0],ft(e,37677,o),ar[a>>2]=cr[A+8>>0],ft(e,37723,a),ur=s}(A+4984|0,e);0|tr[K>>0]&&function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y=0,J=0,D=0,Q=0,T=0;switch(ur=(R=ur)+304|0,a=R+288|0,o=R+280|0,t=R+272|0,N=R+264|0,F=R+256|0,_=R+248|0,X=R+240|0,V=R+232|0,G=R+224|0,T=R+216|0,E=R+208|0,B=R+200|0,I=R+192|0,W=R+184|0,C=R+176|0,Q=R+168|0,Z=R+160|0,y=R+152|0,p=R+144|0,m=R+136|0,g=R+128|0,v=R+120|0,w=R+112|0,h=R+104|0,k=R+96|0,d=R+88|0,D=R+80|0,b=R+72|0,s=R+64|0,u=R+56|0,l=R+48|0,c=R+40|0,f=R+32|0,J=R+24|0,n=R+16|0,i=R+8|0,Y=R,0|(e|=0)){case 1:e=8516;break;case 2:e=9020;break;default:return ur=R}if(ft(r=0|ar[e>>2],39295,Y),Y=0|lr[A+4>>1],ar[i>>2]=lr[A+2>>1],ar[4+i>>2]=Y,ft(r,39336,i),ar[n>>2]=cr[A+6>>0],ft(r,39372,n),ar[J>>2]=cr[A+7>>0],ft(r,39405,J),J=A+8|0,ar[f>>2]=cr[J>>0],ft(r,39438,f),0|tr[J>>0]){switch(0|ar[A+12>>2]){case 0:e=39285;break;case 1:e=39281;break;case 2:e=39276;break;case 3:e=39270;break;case 4:e=39266;break;default:e=39254}ar[c>>2]=e,ft(r,39474,c),ar[l>>2]=cr[A+16>>0],ft(r,39510,l),ar[u>>2]=cr[A+17>>0],ft(r,39546,u),ar[s>>2]=cr[A+18>>0],ft(r,39586,s),ar[b>>2]=cr[A+19>>0],ft(r,39622,b),ar[D>>2]=cr[A+20>>0],ft(r,39658,D)}D=A+21|0,ar[d>>2]=cr[D>>0],ft(r,39694,d),0|tr[D>>0]&&(ar[k>>2]=cr[A+22>>0],ft(r,39728,k),ar[h>>2]=cr[A+23>>0],ft(r,39771,h));ar[w>>2]=cr[A+24>>0],ft(r,39814,w),ar[v>>2]=cr[A+25>>0],ft(r,39850,v),ar[g>>2]=cr[A+26>>0],ft(r,39886,g),ar[m>>2]=cr[A+27>>0],ft(r,39922,m),ar[p>>2]=ar[A+28>>2],ft(r,39958,p),ar[y>>2]=ar[A+32>>2],ft(r,39994,y),ar[Z>>2]=ar[A+36>>2],ft(r,40030,Z),ar[Q>>2]=ar[A+40>>2],ft(r,40066,Q),Q=A+44|0,ar[C>>2]=cr[Q>>0],ft(r,40102,C),0|tr[Q>>0]&&(ar[W>>2]=ar[A+48>>2],ft(r,40138,W),ar[I>>2]=ar[A+52>>2],ft(r,40174,I));ar[B>>2]=cr[A+56>>0],ft(r,40210,B),ar[E>>2]=ar[A+60>>2],ft(r,40252,E),ar[T>>2]=cr[A+64>>0],ft(r,40294,T),T=A+65|0,ar[G>>2]=cr[T>>0],ft(r,40332,G),0|tr[T>>0]&&(ar[V>>2]=cr[A+66>>0],ft(r,40373,V),ar[X>>2]=cr[A+67>>0],ft(r,40414,X),ar[_>>2]=cr[A+68>>0],ft(r,40462,_),ar[F>>2]=lr[A+70>>1],ft(r,40503,F),ar[N>>2]=cr[A+72>>0],ft(r,40544,N),ar[t>>2]=cr[A+73>>0],ft(r,40585,t),ar[o>>2]=cr[A+74>>0],ft(r,40626,o),ar[a>>2]=cr[A+75>>0],ft(r,40667,a)),ur=R}(A+4904|0,e),ur=L}(r,e),Eu(0|(f=A+11096+(5168*(e=0|ar[r+472>>2])|0)|0),0|r,4717),(0|f)!=(0|r)&&Wr(A+11096+(5168*e|0)+4720|0,0|ar[r+4720>>2],0|ar[r+4724>>2]),Eu(A+11096+(5168*e|0)+4732|0,r+4732|0,436),f=0,Tn(r),ur=i,0|f)}function Wr(A,e,r){var i,f,n,t=0,o=0,a=0,c=0,l=0;if((a=(0|(c=(i=r|=0)-(e|=0)|0))/100|0)>>>0<=(((t=0|ar[(f=(A|=0)+8|0)>>2])-(n=l=0|ar[A>>2])|0)/100|0)>>>0)return 0|(t=(o=a=(A=(o=((0|ar[(c=A+4|0)>>2])-l|0)/100|0)>>>0<a>>>0)?e+(100*o|0)|0:r)-e|0)&&Gu(0|l,0|e,0|t),r=n+(100*((0|t)/100|0)|0)|0,A?!((0|(t=i-o|0))<=0)&&(Eu(0|ar[c>>2],0|a,0|t),void(ar[c>>2]=(0|ar[c>>2])+(100*((t>>>0)/100|0)|0))):(0|(t=0|ar[c>>2]))!=(0|r)&&void(ar[c>>2]=t+(100*~(((t+-100-r|0)>>>0)/100|0)|0));(o=l)&&((0|(r=0|ar[(t=A+4|0)>>2]))!=(0|n)&&(ar[t>>2]=r+(100*~(((r+-100-l|0)>>>0)/100|0)|0)),Vl(o),ar[f>>2]=0,ar[t>>2]=0,t=ar[A>>2]=0),42949672<a>>>0&&il(),t=(l=(0|t)/100|0)<<1,42949672<(t=l>>>0<21474836?t>>>0<a>>>0?a:t:42949672)>>>0&&il(),r=0|El(100*t|0),ar[(o=A+4|0)>>2]=r,ar[A>>2]=r,ar[f>>2]=r+(100*t|0),(0|c)<=0||(Eu(0|r,0|e,0|c),ar[o>>2]=r+(100*((c>>>0)/100|0)|0))}function Ir(A,e){A|=0,e|=0;var r,i,f,n=0;return ur=(f=ur)+4400|0,_o(i=f),r=0|function(A,e,r){e|=0,r|=0;var i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if(Fo(A|=0,0),u=0|ut(e),63<(0|(tr[A+1>>0]=u))|-99999==(0|u))return Gr(r+4|0,1009,0),(r=0)|r;if(u=0|ut(e),63<(0|(tr[(n=A+2|0)>>0]=u))|-99999==(0|u))return Gr(r+4|0,1010,0),(r=0)|r;if(u=255&(0|at(e,1)),tr[A+3>>0]=u,u=255&(0|at(e,1)),tr[A+31>>0]=u,u=255&(0|at(e,3)),tr[A+4132>>0]=u,u=255&(0|at(e,1)),tr[A+4>>0]=u,u=255&(0|at(e,1)),tr[A+5>>0]=u,u=0|ut(e),i=255&u,tr[(f=A+6|0)>>0]=i,-99999==(0|u))return Gr(r+4|0,1006,0),(r=0)|r;if(tr[f>>0]=i+1<<24>>24,u=0|ut(e),i=255&u,tr[(f=A+7|0)>>0]=i,-99999==(0|u))return Gr(r+4|0,1006,0),(r=0)|r;if(tr[f>>0]=i+1<<24>>24,l=0|tr[n>>0],!(0|tr[(u=r+11096+(5168*l|0)|0)>>0]))return Gr(r+4|0,1010,0),(r=0)|r;if(i=0|st(e),-99999==(0|(ar[(f=A+8|0)>>2]=i)))return Gr(r+4|0,1006,0),(r=0)|r;if(ar[f>>2]=i+26,c=255&(0|at(e,1)),tr[A+12>>0]=c,c=255&(0|at(e,1)),tr[A+13>>0]=c,c=255&(0|at(e,1)),(tr[A+14>>0]=c)<<24>>24){if(c=0|ut(e),-99999==(0|(ar[A+16>>2]=c)))return Gr(r+4|0,1006,0),(r=0)|r}else ar[A+16>>2]=0;if(c=0|st(e),-99999==(0|(ar[A+20>>2]=c)))return Gr(r+4|0,1006,0),(r=0)|r;if(c=0|st(e),-99999==(0|(ar[A+24>>2]=c)))return Gr(r+4|0,1006,0),(r=0)|r;if(a=255&(0|at(e,1)),tr[A+28>>0]=a,a=255&(0|at(e,1)),tr[A+29>>0]=a,a=255&(0|at(e,1)),tr[A+30>>0]=a,a=255&(0|at(e,1)),tr[A+32>>0]=a,a=255&(0|at(e,1)),tr[(c=A+34|0)>>0]=a,a=255&(0|at(e,1)),tr[A+33>>0]=a,0|tr[c>>0]){if(i=0|ut(e),-99999==(0|(ar[(a=A+36|0)>>2]=i))|9<(0|i))return Gr(r+4|0,1006,0),(r=0)|r;if(ar[a>>2]=i+1,i=0|ut(e),-99999==(0|(ar[(c=A+40|0)>>2]=i))|9<(0|i))return Gr(r+4|0,1006,0),(r=0)|r;ar[c>>2]=i+1,o=0|at(e,1),tr[A+44>>0]=o;do{if(!(255&o)){n=0|ar[r+11096+(5168*l|0)+5056>>2],f=0|ar[r+11096+(5168*l|0)+5064>>2],o=0|ar[a>>2],i=o+-1|0;A:do{if(1<(0|o)){for(o=0;i=0|ut(e),-99999!=(0|(ar[(t=A+4172+(o<<2)|0)>>2]=i));)if(i=i+1|0,ar[t>>2]=i,n=n-i|0,o=o+1|0,(0|(i=(0|ar[a>>2])-1|0))<=(0|o))break A;return Gr(r+4|0,1006,0),(r=0)|r}}while(0);if((0|n)<1)return(r=0)|r;ar[A+4172+(i<<2)>>2]=n,a=0|ar[c>>2],i=a+-1|0;A:do{if(1<(0|a)){for(t=0;i=0|ut(e),-99999!=(0|(ar[(n=A+4212+(t<<2)|0)>>2]=i));)if(i=i+1|0,ar[n>>2]=i,f=f-i|0,t=t+1|0,(0|(i=(0|ar[c>>2])-1|0))<=(0|t))break A;return Gr(r+4|0,1006,0),(r=0)|r}}while(0);if((0|f)<1)return(r=0)|r;ar[A+4212+(i<<2)>>2]=f;break}}while(0);i=255&(0|at(e,1))}else ar[A+36>>2]=1,ar[A+40>>2]=1,tr[A+44>>0]=1,i=0;tr[A+45>>0]=i,ar[(i=A+52|0)>>2]=0,ar[(n=A+56|0)>>2]=0,c=255&(0|at(e,1)),tr[A+46>>0]=c,c=255&(0|at(e,1)),tr[A+47>>0]=c;do{if(c<<24>>24){if(c=255&(0|at(e,1)),tr[A+48>>0]=c,c=255&(0|at(e,1)),!((tr[A+49>>0]=c)<<24>>24)){if(f=0|st(e),-99999==(0|(ar[i>>2]=f)))return Gr(r+4|0,1006,0),(r=0)|r;if(ar[i>>2]=f<<1,i=0|st(e),-99999==(0|(ar[n>>2]=i)))return Gr(r+4|0,1006,0),(r=0)|r;ar[n>>2]=i<<1;break}}else tr[A+48>>0]=0,tr[A+49>>0]=0}while(0);if(c=0|at(e,1),i=255&c,tr[A+60>>0]=i,0!=(255&c|0)&&0==(0|tr[r+11096+(5168*l|0)+636>>0]))return Gr(r+4|0,1006,0),(r=0)|r;if(i<<24>>24){if(0|(i=0|Mn(e,u,A+61|0,1)))return Gr(r+4|0,i,0),(r=0)|r}else Eu(A+61|0,r+11096+(5168*l|0)+638|0,4064);if(i=255&(0|at(e,1)),tr[A+4125>>0]=i,i=0|ut(e),-99999==(0|(ar[(f=A+4128|0)>>2]=i)))return Gr(r+4|0,1006,0),(r=0)|r;if(ar[f>>2]=i+2,(0|i)>((0|ar[r+11096+(5168*l|0)+612>>2])-2+(0|ar[r+11096+(5168*l|0)+616>>2])|0))return(r=0)|r;return l=255&(0|at(e,1)),tr[A+4133>>0]=l,l=255&(0|at(e,1)),!((tr[A+4134>>0]=l)<<24>>24&&(c=255&(0|at(e,1)),tr[(l=A+4135|0)>>0]=c,c=255&(0|at(e,1)),tr[A+4136>>0]=c,c=255&(0|at(e,6)),tr[A+4137>>0]=c,0|tr[l>>0]))||0|function(A,e,r,i){A|=0,e|=0,r|=0;var f,n=0,t=0,o=0;f=0|tr[2+(i|=0)>>0],0|tr[i+13>>0]&&(t=2+(0|ut(e))&255,tr[A>>0]=t);t=0!=(0|at(e,1)),tr[A+1>>0]=1&t,3==(0|ar[(n=r+11096+(5168*f|0)+5012|0)>>2])|1^t||Gr(r+4|0,1006,0);o=0!=(0|at(e,1)),i=1&o,tr[(t=A+2|0)>>0]=i,0!=(0|ar[n>>2])|1^o||(Gr(r+4|0,1006,0),i=0|tr[t>>0]);A:do{if(i<<24>>24){if(-99999!=(0|(i=0|ut(e)))&&(0|i)<=(0|ar[r+11096+(5168*f|0)+616>>2])){if(tr[A+3>>0]=i,-99999==(0|(i=0|ut(e)))|5<(0|i))return Gr(r+4|0,1006,0),(o=0)|o;if(o=i+1|0,!(255&(tr[(t=A+4|0)>>0]=o)))break;for(n=0;;){if(24<((i=0|st(e))+12|0)>>>0){i=15;break}if(tr[A+5+n>>0]=i,24<((i=0|st(e))+12|0)>>>0){i=17;break}if(tr[A+11+n>>0]=i,(0|(n=n+1|0))>=(0|cr[t>>0]))break A}if(15==(0|i))return Gr(r+4|0,1006,0),(o=0)|o;if(17==(0|i))return Gr(r+4|0,1006,0),(o=0)|o}return Gr(r+4|0,1006,0),(o=0)|o}}while(0);if(-99999!=(0|(i=0|ut(e)))&&(o=0|ar[r+11096+(5168*f|0)+4996>>2],(0|i)<=(0|((0|o)<10?0:o+-10|0))))return tr[A+17>>0]=i,-99999!=(0|(i=0|ut(e)))&&(o=0|ar[r+11096+(5168*f|0)+5004>>2],(0|i)<=(0|((0|o)<10?0:o+-10|0)))?(tr[A+18>>0]=i,0|(o=1)):(Gr(r+4|0,1006,0),(o=0)|o);return Gr(r+4|0,1006,0),(o=0)|o}(A+4138|0,e,r,A)?(function(A,e){A|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0;if(t=ur,Z=0|ar[(n=5040+(e|=0)|0)>>2],ar[A+4160>>2]=Z-(0|ar[A+16>>2]),ar[A+4164>>2]=Z-(0|cr[A+4141>>0]),ar[A+4168>>2]=cr[A+4138>>0],Z=A+36|0,0|tr[A+44>>0]){if(a=0|ar[Z>>2],ur=(l=ur)+(15+(4+(a<<2)|0)&-16)|0,0<=(0|a)){for(c=0|ar[e+5056>>2],o=0;C=(0|sr(c,o))/(0|a)|0,ar[l+(o<<2)>>2]=C,(0|o)!=(0|a);)o=o+1|0;if(0<(0|a))for(a=(o=0)|ar[l>>2];y=a,a=0|ar[l+((o=(C=o)+1|0)<<2)>>2],ar[A+4172+(C<<2)>>2]=a-y,(0|o)<(0|ar[Z>>2]););}if(a=0|ar[(l=A+40|0)>>2],ur=(u=ur)+(15+(4+(a<<2)|0)&-16)|0,0<=(0|a)){for(c=0|ar[e+5064>>2],o=0;C=(0|sr(c,o))/(0|a)|0,ar[u+(o<<2)>>2]=C,(0|o)!=(0|a);)o=o+1|0;if(0<(0|a))for(a=(o=0)|ar[u>>2];y=a,a=0|ar[u+((o=(C=o)+1|0)<<2)>>2],ar[A+4212+(C<<2)>>2]=a-y,(0|o)<(0|ar[l>>2]););}}if(ar[A+4252>>2]=0,0<(0|ar[Z>>2]))for(a=o=0;a=(0|ar[A+4172+(o<<2)>>2])+a|0,ar[A+4252+((o=o+1|0)<<2)>>2]=a,(0|o)<(0|ar[Z>>2]););if(ar[A+4296>>2]=0,0<(0|ar[(y=A+40|0)>>2]))for(a=o=0;o=(0|ar[A+4212+(a<<2)>>2])+o|0,ar[A+4296+((a=a+1|0)<<2)>>2]=o,(0|a)<(0|ar[y>>2]););C=A+4340|0,a=0|ar[(v=e+5072|0)>>2],u=0|ar[(o=A+4344|0)>>2],l=0|ar[C>>2],a>>>0<=(c=u-l>>2)>>>0?a>>>0<c>>>0&&(0|u)!=(0|(s=l+(a<<2)|0))&&(ar[o>>2]=u+(~((u+-4-s|0)>>>2)<<2)):(Ro(C,a-c|0),a=0|ar[v>>2]);w=A+4352|0,l=0|ar[(u=A+4356|0)>>2],c=0|ar[w>>2],a>>>0<=(o=l-c>>2)>>>0?a>>>0<o>>>0&&(0|l)!=(0|(b=c+(a<<2)|0))&&(ar[u>>2]=l+(~((l+-4-b|0)>>>2)<<2)):(Ro(w,a-o|0),a=0|ar[v>>2]);i=A+4364|0,u=0|ar[(o=A+4368|0)>>2],l=0|ar[i>>2],a>>>0<=(c=u-l>>2)>>>0?a>>>0<c>>>0&&(0|u)!=(0|(d=l+(a<<2)|0))&&(ar[o>>2]=u+(~((u+-4-d|0)>>>2)<<2)):(Ro(i,a-c|0),a=0|ar[v>>2]);r=A+4376|0,u=0|ar[(o=A+4380|0)>>2],l=0|ar[r>>2],a>>>0<=(c=u-l>>2)>>>0?a>>>0<c>>>0&&(0|u)!=(0|(k=l+(a<<2)|0))&&(ar[o>>2]=u+(~((u+-4-k|0)>>>2)<<2)):Ro(r,a-c|0);f=A+4388|0,o=0|ar[e+5096>>2],u=0|ar[(a=A+4392|0)>>2],l=0|ar[f>>2],o>>>0<=(c=u-l>>2)>>>0?o>>>0<c>>>0&&(0|u)!=(0|(h=l+(o<<2)|0))&&(ar[a>>2]=u+(~((u+-4-h|0)>>>2)<<2)):Ro(f,o-c|0);A:do{if(0<(0|ar[v>>2])){for(d=e+5056|0,b=0;;){if(h=0|ar[d>>2],k=(0|b)%(0|h)|0,h=(0|b)/(0|h)|0,0<(0|(c=0|ar[Z>>2])))for(a=0,o=-1;o=(0|k)<(0|ar[A+4252+(a<<2)>>2])?o:a,(0|(a=a+1|0))<(0|c););else o=-1;if(0<(0|(l=0|ar[y>>2])))for(c=0,a=-1;a=(0|h)<(0|ar[A+4296+(c<<2)>>2])?a:c,(0|(c=c+1|0))<(0|l););else a=-1;if(s=(0|ar[C>>2])+(b<<2)|0,(ar[s>>2]=0)<(0|o))for(u=A+4212+(a<<2)|0,c=l=0;c=c+(0|sr(0|ar[A+4172+(l<<2)>>2],0|ar[u>>2]))|0,ar[s>>2]=c,(0|(l=l+1|0))!=(0|o););else c=0;if(0<(0|a))for(l=0;c=c+(0|sr(0|ar[A+4212+(l<<2)>>2],0|ar[d>>2]))|0,ar[s>>2]=c,(0|(l=l+1|0))!=(0|a););if((a|o|0)<=-1)break;if(p=c+(0|sr(h-(0|ar[A+4296+(a<<2)>>2])|0,0|ar[A+4172+(o<<2)>>2]))|0,ar[s>>2]=p,p=k-(0|ar[A+4252+(o<<2)>>2])+p|0,ar[s>>2]=p,(0|(b=(ar[(0|ar[w>>2])+(p<<2)>>2]=b)+1|0))>=(0|ar[v>>2]))break A}br(30690,30711,618,30718)}}while(0);if(0<(0|(o=0|ar[y>>2]))){p=e+5056|0,a=(c=l=0)|ar[Z>>2];do{if(0<(0|a)){m=A+4296+(c<<2)|0,w=l,o=(v=0)|ar[(g=A+4296+((c=c+1|0)<<2)|0)>>2];do{if(u=0|ar[m>>2],v=(l=v)+1|0,(0|u)<(0|o)){k=A+4252+(l<<2)|0,a=0|ar[(h=A+4252+(v<<2)|0)>>2];do{if((0|(d=0|ar[k>>2]))<(0|a)){for(l=0|ar[C>>2],s=0|ar[i>>2],b=0|ar[r>>2],o=d;a=l+((0|sr(0|ar[p>>2],u))+o<<2)|0,ar[s+(ar[a>>2]<<2)>>2]=w,a=b+((0|sr(0|ar[p>>2],u))+o<<2)|0,ar[a>>2]=w,o=o+1|0,a=0|ar[h>>2],(0|o)<(0|a););o=0|ar[g>>2]}u=u+1|0}while((0|u)<(0|o));a=0|ar[Z>>2]}w=w+1|0}while((0|v)<(0|a));l=w,o=0|ar[y>>2]}else c=c+1|0}while((0|c)<(0|o))}if((0|(o=0|ar[(k=e+5092|0)>>2]))<=0)return ur=t;w=e+5100|0,d=e+5056|0,a=0|ar[(h=e+5088|(b=0))>>2];do{if(0<(0|a)){u=0|ar[C>>2],s=0|ar[f>>2],l=0;do{if(e=0|ar[w>>2],A=0|ar[n>>2],Z=u+((0|sr(0|ar[d>>2],b<<e>>A))+(l<<e>>A)<<2)|0,o=s+((0|sr(a,b))+l<<2)|0,ar[o>>2]=ar[Z>>2]<<(A-e<<1),o=0|ar[n>>2],(0|(a=0|ar[w>>2]))<(0|o))for(c=o-a|0,o=a=0;o=(0==((e=1<<a)&b|0)?0:e<<1<<a)+o+(0==(e&l|0)?0:e<<a)|0,(0|(a=a+1|0))<(0|c););else o=0;a=s+((0|sr(0|ar[h>>2],b))+l<<2)|0,ar[a>>2]=(0|ar[a>>2])+o,l=l+1|0,a=0|ar[h>>2]}while((0|l)<(0|a));o=0|ar[k>>2]}b=b+1|0}while((0|b)<(0|o));ur=t}(A,u),tr[A>>0]=1,0|(r=1)):(r=0)|r}(i,e,A),-1<(0|(e=0|ar[A+524>>2]))&&function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P=0,L=0,K=0,q=0,$=0,AA=0;switch(ur=(z=ur)+400|0,S=z+392|0,M=z+384|0,T=z+376|0,Q=z+368|0,D=z+360|0,J=z+352|0,Y=z+344|0,R=z+336|0,N=z+328|0,F=z+320|0,_=z+312|0,X=z+304|0,V=z+296|0,G=z+288|0,AA=z+280|0,j=z+272|0,x=z+264|0,$=z+256|0,H=z+248|0,O=z+240|0,U=z+232|0,E=z+224|0,B=z+216|0,I=z+208|0,C=z+200|0,Z=z+192|0,y=z+184|0,p=z+176|0,m=z+168|0,v=z+160|0,w=z+152|0,h=z+144|0,k=z+136|0,d=z+128|0,b=z+120|0,s=z+112|0,u=z+104|0,l=z+96|0,c=z+88|0,o=z+80|0,t=z+72|0,n=z+64|0,f=z+56|0,i=z+48|0,r=z+40|0,q=z+32|0,g=z+24|0,a=z+16|0,K=z+8|0,L=z,0|(e|=0)){case 1:P=8516;break;case 2:P=9020;break;default:return ur=z}ft(W=0|ar[P>>2],30737,L),ar[K>>2]=tr[A+1>>0],ft(W,30778,K),ar[a>>2]=tr[A+2>>0],ft(W,30811,a),ar[g>>2]=tr[A+3>>0],ft(W,30844,g),ar[q>>2]=tr[A+4>>0],ft(W,30888,q),ar[r>>2]=tr[A+5>>0],ft(W,30921,r),ar[i>>2]=tr[A+6>>0],ft(W,30954,i),ar[f>>2]=tr[A+7>>0],ft(W,30990,f),ar[n>>2]=ar[A+8>>2],ft(W,31026,n),ar[t>>2]=tr[A+12>>0],ft(W,31059,t),ar[o>>2]=tr[A+13>>0],ft(W,31092,o),q=A+14|0,ar[c>>2]=tr[q>>0],ft(W,31125,c),0|tr[q>>0]&&(ar[l>>2]=ar[A+16>>2],ft(W,31158,l));if(ar[u>>2]=ar[A+20>>2],ft(W,31191,u),ar[s>>2]=ar[A+24>>2],ft(W,31226,s),ar[b>>2]=tr[A+28>>0],ft(W,31261,b),ar[d>>2]=tr[A+29>>0],ft(W,31308,d),ar[k>>2]=tr[A+30>>0],ft(W,31343,k),ar[h>>2]=tr[A+31>>0],ft(W,31378,h),ar[w>>2]=tr[A+32>>0],ft(W,31413,w),q=A+34|0,ar[v>>2]=tr[q>>0],ft(W,31448,v),ar[m>>2]=tr[A+33>>0],ft(W,31483,m),0|tr[q>>0]){if(L=A+36|0,ar[p>>2]=ar[L>>2],ft(W,31521,p),K=A+40|0,ar[y>>2]=ar[K>>2],ft(W,31547,y),ar[Z>>2]=tr[A+44>>0],ft(W,31573,Z),ft(W,31599,C),0<=(0|ar[L>>2]))for(P=0;ar[E>>2]=ar[A+4252+(P<<2)>>2],ft(W,31646,E),(0|P)<(0|ar[L>>2]);)P=P+1|0;if(ft(W,39054,I),ft(W,31624,B),0<=(0|ar[K>>2]))for(P=0;ar[H>>2]=ar[A+4296+(P<<2)>>2],ft(W,31646,H),(0|P)<(0|ar[K>>2]);)P=P+1|0;ft(W,39054,U),ar[O>>2]=tr[A+45>>0],ft(W,31651,O)}ar[$>>2]=tr[A+46>>0],ft(W,31695,$),$=A+47|0,ar[x>>2]=tr[$>>0],ft(W,31743,x),0|tr[$>>0]&&(ar[j>>2]=tr[A+48>>0],ft(W,31787,j),ar[AA>>2]=tr[A+49>>0],ft(W,31832,AA),ar[G>>2]=ar[A+52>>2],ft(W,31872,G),ar[V>>2]=ar[A+56>>2],ft(W,31890,V));ar[X>>2]=tr[A+60>>0],ft(W,31908,X),ar[_>>2]=tr[A+4125>>0],ft(W,31948,_),ar[F>>2]=ar[A+4128>>2],ft(W,31985,F),ar[N>>2]=tr[A+4132>>0],ft(W,32022,N),ar[R>>2]=tr[A+4133>>0],ft(W,32059,R),ar[Y>>2]=tr[A+4134>>0],ft(W,32109,Y),AA=A+4135|0,ar[J>>2]=tr[AA>>0],ft(W,32145,J),ar[D>>2]=tr[A+4136>>0],ft(W,32181,D),ar[Q>>2]=tr[A+4137>>0],ft(W,32217,Q),ar[T>>2]=ar[A+4160>>2],ft(W,32253,T),ar[M>>2]=ar[A+4164>>2],ft(W,32289,M),ar[S>>2]=ar[A+4168>>2],ft(W,32330,S),0|tr[AA>>0]&&function(A,e){A|=0;var r,i,f,n,t,o,a,c,l,u,s=0,b=0,d=0;switch(ur=(u=ur)+80|0,l=u+72|0,c=u+64|0,a=u+56|0,o=u+48|0,n=u+40|0,b=u+32|0,t=u+24|0,s=u+16|0,f=u+8|0,i=u,0|(e|=0)){case 1:e=8516;break;case 2:e=9020;break;default:return ur=u}if(ft(r=0|ar[e>>2],30231,i),ar[f>>2]=cr[A>>0],ft(r,30274,f),ar[s>>2]=cr[A+1>>0],ft(r,30320,s),s=A+2|0,ar[t>>2]=cr[s>>0],ft(r,30366,t),0|tr[s>>0]&&(ar[b>>2]=cr[A+3>>0],ft(r,30412,b),d=A+4|0,ar[n>>2]=cr[d>>0],ft(r,30458,n),0|tr[d>>0]))for(e=0;b=0|tr[A+5+e>>0],ar[o>>2]=e,ar[4+o>>2]=b,ft(r,30504,o),b=0|tr[A+11+e>>0],ar[a>>2]=e,ar[4+a>>2]=b,ft(r,30551,a),(0|(e=e+1|0))<(0|cr[d>>0]););ar[c>>2]=cr[A+17>>0],ft(r,30598,c),ar[l>>2]=cr[A+18>>0],ft(r,30644,l),ur=u}(A+4138|0,e),ur=z}(i,e),r?(Eu(0|(n=A+93784+(4400*(e=0|tr[i+1>>0])|0)|0),0|i,4340),ur=(n=((0|n)==(0|i)||(Br(A+93784+(4400*e|0)+4340|0,0|ar[i+4340>>2],0|ar[i+4344>>2]),Br(A+93784+(4400*e|0)+4352|0,0|ar[i+4352>>2],0|ar[i+4356>>2]),Br(A+93784+(4400*e|0)+4364|0,0|ar[i+4364>>2],0|ar[i+4368>>2]),Br(A+93784+(4400*e|0)+4376|0,0|ar[i+4376>>2],0|ar[i+4380>>2]),Br(A+93784+(4400*e|0)+4388|0,0|ar[i+4388>>2],0|ar[i+4392>>2])),r?0:1006),No(i),f),0|n):(A=r?0:1006,No(i),ur=f,0|A)}function Br(A,e,r){var i,f,n,t=0,o=0,a=0,c=0,l=0;if((a=(c=(i=r|=0)-(e|=0)|0)>>2)>>>0<=(t=0|ar[(f=(A|=0)+8|0)>>2])-(n=l=0|ar[A>>2])>>2>>>0)return 0|(r=(t=(o=a=(A=(o=(0|ar[(c=A+4|0)>>2])-l>>2)>>>0<a>>>0)?e+(o<<2)|0:r)-e|0)>>2)&&Gu(0|l,0|e,0|t),r=n+(r<<2)|0,A?!((0|(t=i-o|0))<=0)&&(Eu(0|ar[c>>2],0|a,0|t),void(ar[c>>2]=(0|ar[c>>2])+(t>>>2<<2))):(0|(t=0|ar[c>>2]))!=(0|r)&&void(ar[c>>2]=t+(~((t+-4-r|0)>>>2)<<2));(o=l)&&((0|(r=0|ar[(t=A+4|0)>>2]))!=(0|n)&&(ar[t>>2]=r+(~((r+-4-l|0)>>>2)<<2)),Vl(o),ar[f>>2]=0,ar[t>>2]=0,t=ar[A>>2]=0),1073741823<a>>>0&&il(),l=t>>1,1073741823<(t=t>>2>>>0<536870911?l>>>0<a>>>0?a:l:1073741823)>>>0&&il(),r=0|El(t<<2),ar[(o=A+4|0)>>2]=r,ar[A>>2]=r,ar[f>>2]=r+(t<<2),(0|c)<=0||(Eu(0|r,0|e,0|c),ar[o>>2]=r+(c>>>2<<2))}function Er(A,e){e|=0;var r,i,f,n=0,t=0,o=0,a=0,c=0,l=0;r=(A|=0)+4|0,i=0|ar[A>>2],53687091<(n=(o=(0|(f=(0|ar[r>>2])-i|0))/80|0)+1|0)>>>0&&il(),c=(a=((0|ar[(l=A+8|0)>>2])-i|0)/80|0)<<1,n=a>>>0<26843545?c>>>0<n>>>0?n:c:53687091;do{if(n){if(!(53687091<n>>>0)){t=0|El(80*n|0);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else t=0}while(0);for(a=t+(80*n|0)|0,n=e,t=(o=c=t+(80*o|0)|0)+80|0;ar[o>>2]=ar[n>>2],n=n+4|0,(0|(o=o+4|0))<(0|t););n=c+(80*((0|f)/-80|0)|0)|0,0<(0|f)&&Eu(0|n,0|i,0|f),ar[A>>2]=n,ar[r>>2]=c+80,ar[l>>2]=a,i&&Vl(i)}function Gr(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0;A:do{if(r){f=0|ar[(i=A+164|0)>>2];do{if(0<(0|f)){for(r=0;;){if((0|ar[A+84+(r<<2)>>2])==(0|e)){r=10;break}if((0|f)<=(0|(r=r+1|0))){r=5;break}}if(5==(0|r)){if((0|f)<20)break;break A}if(10==(0|r))return}}while(0);ar[i>>2]=f+1,ar[A+84+(f<<2)>>2]=e}}while(0);20==(0|(r=0|ar[(i=A+80|0)>>2]))?(e=1001,r=19):ar[i>>2]=r+1,ar[A+(r<<2)>>2]=e}function Vr(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;if(ur=(t=ur)+16|0,f=t+4|0,s=t+8|0,n=t,b=0|El(1356),o=b,ar[776+(o|=0)>>2]=0,ar[o+780>>2]=0,ar[o+784>>2]=0,pt(o+1332|0),ar[o+1344>>2]=0,ar[o+1348>>2]=0,ar[o+1352>>2]=0,Dn(o),l=0|function(A,e,r,i){A|=0,e|=0,r|=0;var f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0;tr[(i|=0)>>0]=0,Dn(A),tr[(l=A+12|0)>>0]=0,w=255&(0|at(e,1)),tr[(c=A+4|0)>>0]=w,0|tr[r+377214>>0]&&(w=255&(0|at(e,1)),tr[A+5>>0]=w);if(w=0|ut(e),64<(0|(ar[A+8>>2]=w))|-99999==(0|w))return Gr(r+4|0,1009,0),(i=0)|i;if(!(0|tr[r+93784+(4400*w|0)>>0]))return Gr(r+4|0,1009,0),(i=0)|i;if(n=0|tr[r+93784+(4400*w|0)+2>>0],!(0|tr[(u=r+11096+(5168*n|0)|0)>>0]))return Gr(r+4|0,1010,0),tr[i>>0]=0,(i=0)|i;if(0|tr[c>>0])o=t=0,h=23;else{for(t=0|tr[r+93784+(4400*w|0)+3>>0]?255&(0|at(e,1)):0,tr[l>>0]=t,o=0|ar[r+11096+(5168*n|0)+5072>>2],t=0;(1<<t|0)<(0|o);)t=t+1|0;if(t=0|at(e,t),0|tr[l>>0]){if(!t)return tr[i>>0]=0,Gr(r+4|0,1021,0),(i=0)|i;if(!(o=0|ar[r+376228>>2]))return 0|(i=16);Eu(0|A,0|o,776),(a=(0|o)==(0|A))||Br(A+776|0,0|ar[o+776>>2],0|ar[o+780>>2]),Eu(A+788|0,o+788|0,544),Et(A+1332|0,o+1332|0),tr[A+1340>>0]=0|tr[o+1340>>0],a||Br(A+1344|0,0|ar[o+1344>>2],0|ar[o+1348>>2]),tr[c>>0]=0,o=1,h=23}else o=0}23==(0|h)&&(tr[l>>0]=o);if(0<=(0|(ar[(f=A+16|0)>>2]=t))&&(0|t)<(0|ar[r+11096+(5168*n|0)+5072>>2])){if(!(o<<24>>24)){if(0<(0|tr[(o=r+93784+(4400*w|0)+4132|0)>>0]))for(t=0;ct(e,1),(0|(t=t+1|0))<(0|tr[o>>0]););if(b=0|ut(e),2<(0|(ar[(d=A+20|0)>>2]=b))|-99999==(0|b))return Gr(r+4|0,1007,0),tr[i>>0]=0,(i=0)|i;if(t=0|tr[r+93784+(4400*w|0)+31>>0]?255&(0|at(e,1)):1,tr[A+24>>0]=t,1==(0|tr[r+11096+(5168*n|0)+480>>0])&&(b=255&(0|at(e,2)),tr[A+25>>0]=b),ar[(t=A+28|0)>>2]=0,(((tr[(o=A+32|0)>>0]=0)|tr[r+377212>>0])-19&255)<2)ar[t>>2]=0,ar[A+140>>2]=0,ar[A+144>>2]=0,t=0;else{s=0|at(e,0|ar[(b=r+11096+(5168*n|0)+520|0)>>2]),ar[t>>2]=s,s=255&(0|at(e,1)),tr[o>>0]=s;do{if(s<<24>>24){for(a=r+11096+(5168*n|0)+4720|0,t=0|ar[(u=r+11096+(5168*n|0)+4724|0)>>2],c=0|ar[a>>2],l=(t-c|0)/100|0,o=0;(1<<o|0)<(0|l);)o=o+1|0;if(0<(0|o)?(c=0|at(e,o),o=0|ar[a>>2],t=0|ar[u>>2]):(o=c,c=0),(0|(ar[A+136>>2]=c))<((t-o|0)/100|0)){for(ar[A+808>>2]=c,t=o+(100*c|0)|0,o=(a=A+812|0)+100|0;or[a>>1]=0|or[t>>1],t=t+2|0,(0|(a=a+2|0))<(0|o););break}return Gr(r+4|0,1015,0),0|(i=8)}for(a=r+11096+(5168*n|0)+4720|0,Lo(r+4|0,u,e,t=A+34|0,((0|ar[(o=r+11096+(5168*n|0)+4724|0)>>2])-(0|ar[a>>2])|0)/100|0,a,1),ar[A+808>>2]=((0|ar[o>>2])-(0|ar[a>>2])|0)/100|0,o=(a=A+812|0)+100|0;or[a>>1]=0|or[t>>1],t=t+2|0,(0|(a=a+2|0))<(0|o););}while(0);A:do{if(0|tr[r+11096+(5168*n|0)+4732>>0]){l=r+11096+(5168*n|0)+4736|0;do{if(0<(0|ar[l>>2])){if(s=0|ut(e),-99999!=(0|(ar[A+140>>2]=s)))break;return 0|(t=8)}ar[A+140>>2]=0}while(0);if(t=0|ut(e),-99999==(0|(ar[(u=A+144|0)>>2]=t)))return 0|(i=8);if(o=0|ar[(s=A+140|0)>>2],((t=o+t|0)+(0|cr[A+908>>0])+(0|cr[A+909>>0])|0)>(0|ar[r+11096+(5168*n|0)+528+((0|tr[r+11096+(5168*n|0)+2>>0])-1<<2)>>2]))return Gr(r+4|0,1018,0),tr[i>>0]=0,(i=0)|i;if(!(0<(0|t))){t=0;break}for(c=t=0;;){if((0|c)<(0|o)){for(a=0|ar[l>>2],o=0;(1<<o|0)<(0|a);)o=o+1|0;if(a=0|at(e,o),tr[(o=A+148+c|0)>>0]=a,(0|(a&=255))>=(0|ar[l>>2]))break;ar[r+376232+(c<<2)>>2]=ar[r+11096+(5168*n|0)+4740+(a<<2)>>2],o=(0|cr[o>>0])+(r+11096+(5168*n|0)+4868)|0}else v=0|at(e,0|ar[b>>2]),ar[(a=A+164+(c<<2)|0)>>2]=v,v=255&(0|at(e,1)),tr[(o=A+228+c|0)>>0]=v,ar[r+376232+(c<<2)>>2]=ar[a>>2];if(v=0|tr[o>>0],ar[r+376296+(c<<2)>>2]=v<<24>>24,t=(v<<24>>24!=0&1)+t|0,v=255&(0|at(e,1)),(tr[A+244+c>>0]=v)<<24>>24){if(o=0|ut(e),-99999==(0|(ar[A+260+(c<<2)>>2]=o))){t=8,h=189;break}}else ar[A+260+(c<<2)>>2]=0,o=0;do{if(c){if((0|c)==(0|ar[s>>2]))break;o=(0|ar[r+376360+(c+-1<<2)>>2])+o|0}}while(0);if(ar[r+376360+(c<<2)>>2]=o,c=c+1|0,o=0|ar[s>>2],(0|c)>=((0|ar[u>>2])+o|0))break A}return 189==(0|h)?0|t:(Gr(r+4|0,1023,0),tr[i>>0]=0,(v=0)|v)}ar[A+140>>2]=0,ar[A+144>>2]=0,t=0}while(0);o=0|tr[r+11096+(5168*n|0)+4900>>0]?255&(0|at(e,1)):0,tr[A+324>>0]=o}o=0|tr[r+11096+(5168*n|0)+4703>>0]?(v=255&(0|at(e,1)),tr[A+325>>0]=v,0|ar[r+11096+(5168*n|0)+5012>>2]?255&(0|at(e,1)):0):tr[A+325>>0]=0,tr[(u=A+326|0)>>0]=o,ar[(c=A+328|0)>>2]=0,ar[(l=A+332|0)>>2]=0;do{if((0|ar[d>>2])>>>0<2){v=255&(0|at(e,1)),tr[A+327>>0]=v;do{if(v<<24>>24){if(o=0|ut(e),-99999==(0|(ar[c>>2]=o)))return Gr(r+4|0,1007,0),0|(v=8);if(o=o+1|0,ar[c>>2]=o,0|ar[d>>2])break;if(a=0|ut(e),-99999==(0|(ar[l>>2]=a)))return Gr(r+4|0,1007,0),0|(v=8);o=0|ar[c>>2],a=a+1|0,h=86;break}o=0|tr[r+93784+(4400*w|0)+6>>0],ar[c>>2]=o,a=0|tr[r+93784+(4400*w|0)+7>>0],h=86}while(0);if(86==(0|h)&&(ar[l>>2]=a),16<(0|o))return 0|(v=8);if(16<(0|ar[l>>2]))return 0|(v=8);t=(0|cr[A+911>>0])+t|0,ar[A+912>>2]=t;do{if(1<(0|t)&&0!=(0|tr[r+93784+(4400*w|0)+4125>>0])){for(o=0;(1<<o|0)<(0|t);)o=o+1|0;v=255&(0|at(e,1)),tr[A+336>>0]=v;do{if(v<<24>>24){if(!(0<(0|ar[c>>2])))break;for(t=0;v=255&(0|at(e,o)),tr[A+338+t>>0]=v,(0|(t=t+1|0))<(0|ar[c>>2]););}}while(0);if(0|ar[d>>2]){tr[A+337>>0]=0;break}if(v=255&(0|at(e,1)),!((tr[A+337>>0]=v)<<24>>24))break;if(!(0<(0|ar[l>>2])))break;for(t=0;v=255&(0|at(e,o)),tr[A+354+t>>0]=v,(0|(t=t+1|0))<(0|ar[l>>2]););}else tr[A+336>>0]=0,tr[A+337>>0]=0}while(0);0|ar[d>>2]||(v=255&(0|at(e,1)),tr[A+370>>0]=v),t=0|tr[r+93784+(4400*w|0)+5>>0]?255&(0|at(e,1)):0,tr[A+371>>0]=t;do{if(0|tr[A+324>>0]){do{if(0|ar[d>>2])tr[(o=A+372|0)>>0]=1,t=1,h=108;else{if(t=255&(0|at(e,1)),(tr[(o=A+372|0)>>0]=t)<<24>>24){h=108;break}h=1<(0|ar[l>>2])?110:(t=0,113)}}while(0);108==(0|h)&&(h=1<(0|ar[c>>2])?110:113);do{if(110==(0|h)){if(a=0|ut(e),-99999==(0|(ar[A+376>>2]=a)))return Gr(r+4|0,1007,0),0|(v=8);t=0|tr[o>>0];break}113==(0|h)&&(ar[A+376>>2]=0,a=0)}while(0);if(t<<24>>24){if((0|a)<(0|ar[c>>2]))break}else if((0|a)<(0|ar[l>>2]))break;return Gr(r+4|0,8,0),0|(v=8)}}while(0);h=0!=(0|tr[r+93784+(4400*w|0)+29>>0])&&1==(0|ar[d>>2])?122:120;do{if(120==(0|h)){if(!(0|tr[r+93784+(4400*w|0)+30>>0]))break;0|ar[d>>2]||(h=122)}}while(0);do{if(122==(0|h)){if(0|Jn(e,A,r))break;return Gr(r+4|0,8,0),0|(v=8)}}while(0);if(t=0|ut(e),-99999==(0|(ar[A+736>>2]=t)))return Gr(r+4|0,1007,0),0|(v=8);ar[A+804>>2]=5-t;break}}while(0);if(v=0|st(e),-99999==(0|(ar[A+740>>2]=v)))return Gr(r+4|0,1007,0),0|(v=8);do{if(0|tr[r+93784+(4400*w|0)+28>>0]){if(v=0|st(e),-99999==(0|(ar[A+744>>2]=v)))return Gr(r+4|0,1007,0),0|(v=8);if(v=0|st(e),-99999!=(0|(ar[A+748>>2]=v)))break;return Gr(r+4|0,1007,0),0|(v=8)}ar[A+744>>2]=0,ar[A+748>>2]=0}while(0);0|tr[r+93784+(4400*w|0)+4140>>0]&&(v=255&(0|at(e,1)),tr[A+752>>0]=v),t=0|tr[r+93784+(4400*w|0)+48>>0]?255&(0|at(e,1)):0,tr[A+753>>0]=t,ar[(o=A+756|0)>>2]=ar[r+93784+(4400*w|0)+52>>2],ar[(a=A+760|0)>>2]=ar[r+93784+(4400*w|0)+56>>2];do{if(t<<24>>24){if(v=255&(0|at(e,1)),(tr[A+754>>0]=v)<<24>>24)break;if(t=0|st(e),-99999==(0|(ar[o>>2]=t)))return Gr(r+4|0,1007,0),0|(v=8);if(ar[o>>2]=t<<1,t=0|st(e),-99999==(0|(ar[a>>2]=t)))return Gr(r+4|0,1007,0),0|(v=8);ar[a>>2]=t<<1;break}tr[A+754>>0]=0|tr[r+93784+(4400*w|0)+49>>0]}while(0);t=0|tr[r+93784+(4400*w|0)+46>>0];A:do{if(t<<24>>24){do{if(!(0|tr[A+325>>0])){if(0|tr[u>>0])break;if(0|tr[A+754>>0])break A}}while(0);t=255&(0|at(e,1))}else t=0}while(0);tr[A+764>>0]=t}0==(0|tr[(o=r+93784+(4400*w|0)+34|0)>>0])&&0==(0|tr[r+93784+(4400*w|0)+33>>0])?ar[A+768>>2]=0:h=155;A:do{if(155==(0|h)){if(t=0|ut(e),-99999==(0|(ar[(s=A+768|0)>>2]=t)))return Gr(r+4|0,1007,0),0|(v=8);if(0|tr[r+93784+(4400*w|0)+33>>0]&&(((0|ar[f>>2])/(0|ar[r+11096+(5168*n|0)+5056>>2])|0)+t|0)>=(0|ar[r+11096+(5168*n|0)+5064>>2]))return Gr(r+4|0,1007,0),0|(v=8);if(0|tr[o>>0]&&(0|t)>(0|sr(0|ar[r+93784+(4400*w|0)+40>>2],0|ar[r+93784+(4400*w|0)+36>>2])))return Gr(r+4|0,1007,0),0|(v=8);if(u=A+776|0,l=0|ar[(o=A+780|0)>>2],c=0|ar[u>>2],t>>>0<=(a=l-c>>2)>>>0?t>>>0<a>>>0&&(0|l)!=(0|(k=c+(t<<2)|0))&&(ar[o>>2]=l+(~((l+-4-k|0)>>>2)<<2)):(Ro(u,t-a|0),t=0|ar[s>>2]),0<(0|t)){if(t=0|ut(e),-99999==(0|(ar[(l=A+772|0)>>2]=t)))return Gr(r+4|0,1007,0),0|(v=8);if(o=t+1|0,ar[l>>2]=o,31<(0|t))return 0|(v=8);if(0<(0|ar[s>>2]))for(t=0;;){if(o=1+(0|at(e,o))|0,a=0|ar[u>>2],ar[(c=a+(t<<2)|0)>>2]=o,0<(0|t)&&(ar[c>>2]=o+(0|ar[a+(t+-1<<2)>>2])),(0|(t=t+1|0))>=(0|ar[s>>2]))break A;o=0|ar[l>>2]}}}}while(0);do{if(0|tr[r+93784+(4400*w|0)+4133>>0]){if(t=0|ut(e),-99999==(0|(ar[(o=A+788|0)>>2]=t))|1e3<(0|t))return Gr(r+4|0,1007,0),0|(v=8);if(!(0<(0|t)))break;for(t=0;at(e,8),(0|(t=t+1|0))<(0|ar[o>>2]););}}while(0);switch(ar[A+792>>2]=(0|ar[A+740>>2])+(0|ar[r+93784+(4400*w|0)+8>>2]),0|ar[A+20>>2]){case 2:t=0,h=187;break;case 1:t=1+(0|tr[A+371>>0])|0,h=187;break;case 0:t=2-(0|tr[A+371>>0])|0,h=187}return 187==(0|h)&&(ar[A+796>>2]=t),ar[A+804>>2]=5-(0|ar[A+736>>2]),tr[i>>0]=1,(v=0)|v}return Gr(r+4|0,1020,0),0|(v=8)}(b,e,A,s),ar[n>>2]=l,!(0|tr[s>>0]))return 0|(a=0|ar[A+376224>>2])&&(tr[a+10516>>0]=2),Eo(A+548|0,r),0|(a=0|ar[b+1344>>2])&&((0|(c=0|ar[(i=b+1348|0)>>2]))!=(0|a)&&(ar[i>>2]=c+(~((c+-4-a|0)>>>2)<<2)),Vl(a)),Zt(b+1332|0),0|(a=0|ar[b+776>>2])&&((0|(c=0|ar[(i=b+780|0)>>2]))!=(0|a)&&(ar[i>>2]=c+(~((c+-4-a|0)>>>2)<<2)),Vl(a)),Vl(b),ur=t,0|(b=l);if(-1<(0|(a=0|ar[A+528>>2]))&&function(A,e,r){A|=0,e|=0;var i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0;switch(ur=(D=ur)+448|0,J=D+432|0,iA=D+424|0,Y=D+416|0,N=D+408|0,F=D+400|0,_=D+392|0,X=D+384|0,rA=D+376|0,E=D+368|0,B=D+360|0,I=D+352|0,W=D+344|0,C=D+328|0,Z=D+312|0,y=D+296|0,p=D+280|0,V=D+264|0,G=D+248|0,eA=D+240|0,g=D+232|0,v=D+224|0,w=D+216|0,h=D+208|0,k=D+200|0,d=D+192|0,$=D+184|0,q=D+176|0,K=D+168|0,L=D+160|0,P=D+152|0,z=D+144|0,s=D+136|0,u=D+128|0,l=D+120|0,c=D+112|0,a=D+104|0,o=D+96|0,j=D+88|0,t=D+80|0,x=D+72|0,n=D+64|0,f=D+56|0,i=D+48|0,S=D+40|0,H=D+32|0,O=D+24|0,U=D+16|0,M=D+8|0,Q=D,0|(r|=0)){case 1:r=8516;break;case 2:r=9020;break;default:return ur=D}R=0|ar[r>>2],m=0|ar[(T=A+8|0)>>2],0|tr[e+93784+(4400*m|0)>>0]||br(33024,32568,1278,33038);b=0|tr[e+93784+(4400*m|0)+2>>0],0|tr[e+11096+(5168*b|0)>>0]||br(33064,32568,1281,33038);ft(R,33078,Q),r=A+4|0,ar[M>>2]=tr[r>>0],ft(R,33121,M),(-8&tr[(Q=e+377212|0)>>0])<<24>>24==16&&(ar[U>>2]=tr[A+5>>0],ft(R,33164,U));ar[O>>2]=ar[T>>2],ft(R,33207,O),0|tr[r>>0]||(ar[H>>2]=tr[A+12>>0],ft(R,33250,H),ar[S>>2]=ar[A+16>>2],ft(R,33293,S));H=0|ar[(O=A+20|0)>>2],ar[i>>2]=0==(0|H)?66:1==(0|H)?80:73,ft(R,33336,i),0|tr[e+93784+(4400*m|0)+31>>0]&&(ar[f>>2]=tr[A+24>>0],ft(R,33379,f));1==(0|tr[e+11096+(5168*b|0)+480>>0])&&(ar[n>>2]=tr[A+25>>0],ft(R,33422,n));ar[x>>2]=ar[A+28>>2],ft(R,33465,x),2<=((0|tr[Q>>0])-19&255)&&(x=A+32|0,ar[t>>2]=tr[x>>0],ft(R,33508,t),r=e+11096+(5168*b|0)+4720|0,Q=(0|ar[e+11096+(5168*b|0)+4724>>2])-(0|ar[r>>2])|0,0|tr[x>>0]?100<(0|Q)&&(j=A+136|0,ar[o>>2]=ar[j>>2],ft(R,33551,o),Ko((0|ar[r>>2])+(100*(0|ar[j>>2])|0)|0,16,R)):(ar[j>>2]=(0|Q)/100|0,ft(R,36693,j),Ko(A+34|0,16,R)),0|tr[e+11096+(5168*b|0)+4732>>0]&&(0<(0|ar[e+11096+(5168*b|0)+4736>>2])&&(ar[a>>2]=ar[A+140>>2],ft(R,33594,a)),ar[c>>2]=ar[A+144>>2],ft(R,33641,c)),0|tr[e+11096+(5168*b|0)+4900>>0]&&(ar[l>>2]=tr[A+324>>0],ft(R,33688,l)));0|tr[e+11096+(5168*b|0)+4703>>0]&&(ar[u>>2]=tr[A+325>>0],ft(R,33726,u),ar[s>>2]=tr[A+326>>0],ft(R,33764,s));if((0|ar[O>>2])>>>0<2){if(r=A+327|0,ar[z>>2]=tr[r>>0],ft(R,33802,z),U=A+328|0,z=0|tr[r>>0]?72962:33841,ar[P>>2]=ar[U>>2],ar[P+4>>2]=z,ft(R,33852,P),0|ar[O>>2]||(P=0|tr[r>>0]?72962:33841,ar[L>>2]=ar[A+332>>2],ar[L+4>>2]=P,ft(R,33892,L)),0|tr[e+93784+(4400*m|0)+4125>>0]&&1<(0|ar[A+912>>2])){if(L=A+336|0,ar[K>>2]=tr[L>>0],ft(R,33932,K),0|tr[L>>0]&&0<(0|ar[U>>2]))for(r=0;K=0|cr[A+338+r>>0],ar[q>>2]=r,ar[q+4>>2]=K,ft(R,33972,q),(0|(r=r+1|0))<(0|ar[U>>2]););if(q=A+337|0,ar[$>>2]=tr[q>>0],ft(R,33982,$),0|tr[q>>0]&&0<(0|ar[(AA=A+332|0)>>2]))for(r=0;$=0|cr[A+354+r>>0],ar[d>>2]=r,ar[4+d>>2]=$,ft(R,33972,d),(0|(r=r+1|0))<(0|ar[AA>>2]););}0|ar[O>>2]||(ar[k>>2]=tr[A+370>>0],ft(R,34022,k)),ar[h>>2]=tr[A+371>>0],ft(R,34059,h),0|tr[A+324>>0]&&(ar[w>>2]=tr[A+372>>0],ft(R,34096,w),ar[v>>2]=ar[A+376>>2],ft(R,34133,v)),45==(0|(S=0!=(0|tr[e+93784+(4400*m|0)+29>>0])&&1==(0|ar[O>>2])?47:45))&&0|tr[e+93784+(4400*m|0)+30>>0]&&0==(0|ar[O>>2])&&(S=47);A:do{if(47==(0|S)){ar[g>>2]=cr[A+380>>0],ft(R,34170,g),0|ar[e+11096+(5168*b|0)+476>>2]&&(ar[eA>>2]=cr[A+381>>0],ft(R,34207,eA)),M=A+332|0,T=0;do{r=0==(0|T);do{if(r)S=53;else{if(1!=(0|T))break;if(0|ar[O>>2])break A;S=53}}while(0);do{if(53==(0|S)){if(!((S=0)<(0|(Q=0|ar[(r?U:M)>>2]))))break;for(r=0;eA=0|or[A+446+(T<<5)+(r<<1)>>1],ar[G>>2]=T,ar[4+G>>2]=r,ar[8+G>>2]=eA,ft(R,34244,G),eA=0|tr[A+510+(T<<4)+r>>0],ar[V>>2]=T,ar[4+V>>2]=r,ar[8+V>>2]=eA,ft(R,34281,V),eA=0|or[A+542+(T<<6)+(r<<2)>>1],ar[p>>2]=T,ar[4+p>>2]=r,ar[8+p>>2]=0,ar[12+p>>2]=eA,ft(R,34318,p),eA=0|tr[A+670+(T<<5)+(r<<1)>>0],ar[y>>2]=T,ar[4+y>>2]=r,ar[8+y>>2]=0,ar[12+y>>2]=eA,ft(R,34356,y),eA=0|or[A+542+(T<<6)+(r<<2)+2>>1],ar[Z>>2]=T,ar[4+Z>>2]=r,ar[8+Z>>2]=1,ar[12+Z>>2]=eA,ft(R,34318,Z),eA=0|tr[A+670+(T<<5)+(r<<1)+1>>0],ar[C>>2]=T,ar[4+C>>2]=r,ar[8+C>>2]=1,ar[12+C>>2]=eA,ft(R,34356,C),(0|(r=r+1|0))!=(0|Q););}}while(0);T=T+1|0}while(2!=(0|T))}}while(0);ar[W>>2]=ar[A+736>>2],ft(R,34394,W)}ar[I>>2]=ar[A+740>>2],ft(R,34431,I),0|tr[e+93784+(4400*m|0)+28>>0]&&(ar[B>>2]=ar[A+744>>2],ft(R,34460,B),ar[E>>2]=ar[A+748>>2],ft(R,34489,E));Q=A+753|0,0|tr[e+93784+(4400*m|0)+48>>0]&&(ar[rA>>2]=tr[Q>>0],ft(R,34518,rA));r=A+754|0,rA=0|tr[Q>>0]?34556:34567,ar[X>>2]=tr[r>>0],ar[4+X>>2]=rA,ft(R,34578,X),0|tr[Q>>0]&&0==(0|tr[r>>0])&&(ar[_>>2]=ar[A+756>>2],ft(R,34625,_),ar[F>>2]=ar[A+760>>2],ft(R,34650,F));do{if(0|tr[e+93784+(4400*m|0)+46>>0]){if(0==(0|tr[A+325>>0])&&0==(0|tr[A+326>>0])&&0|tr[r>>0])break;ar[N>>2]=tr[A+764>>0],ft(R,34675,N)}}while(0);if(0==(0|tr[e+93784+(4400*m|0)+34>>0])&&0==(0|tr[e+93784+(4400*m|0)+33>>0]))return ur=D;if(T=A+768|0,ar[Y>>2]=ar[T>>2],ft(R,34726,Y),(0|ar[T>>2])<=0)return ur=D;if(ar[iA>>2]=ar[A+772>>2],ft(R,34759,iA),(0|ar[T>>2])<=0)return ur=D;Q=A+776|0,r=0;for(;iA=0|ar[(0|ar[Q>>2])+(r<<2)>>2],ar[J>>2]=r,ar[4+J>>2]=iA,ft(R,34792,J),r=r+1|0,(0|r)<(0|ar[T>>2]););ur=D}(b,A,a),u=0|function(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l=0,u=0,s=0,b=0,d=0;ur=(c=ur)+16|0,l=c,ar[(i|=0)>>2]=0,tr[A+377228>>0]=0,u=0|ar[r+8>>2],0|tr[(s=e+93784+(4400*u|0)|0)>>0]||(ar[l>>2]=u,function(A,e,r){A|=0,e|=0,r|=0;var i,f,n;if(ur=(n=ur)+16|0,i=n,!(-9999<=(0|ar[12717])&!0))return ur=n;f=42==(0|tr[e>>0]),A=0|ar[2129],f||Sr(37825,5,1,A);ar[i>>2]=r,sa(A,e+(1&f)|0,i),Or(A),ur=n}(1,28215,l),br(49065,28026,1987,28241));if(ar[(b=e+375392|0)>>2]=s,d=0|tr[e+93784+(4400*u|0)+2>>0],ar[(l=e+375388|0)>>2]=e+11096+(5168*d|0),ar[(a=e+375384|0)>>2]=e+600+(656*(0|tr[e+11096+(5168*d|0)+1>>0])|0),function(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0;r=0|ar[375388+(A|=0)>>2],e=(i=0==(0|r))?(e=0|ar[A+375384>>2])?(0|ar[e+8>>2])-1|0:6:(0|tr[r+2>>0])-1|0;do{if((0|tr[A+376116>>0])!=(0|e)){if(i?(e=0|ar[A+375384>>2])?(e=0|ar[e+8>>2],f=10):e=6:(e=0|tr[r+2>>0],f=10),10==(0|f)){if(!(0<(0|e)))break;e=e+-1|0}for(t=e+1|0,o=A+375896|0;;){if((0|(i=(0|(n=100*e|0))/(0|t)|0))<=(0|(n=(n+100|0)/(0|t)|0)))for(f=n-i|0,r=i;c=0|ar[o>>2],e=(a=(0|c)<(0|e))?c:e,tr[A+375916+(r<<1)>>0]=e,tr[A+375916+(r<<1)+1>>0]=a?100:255&((100*(r-i|0)|0)/(0|f)|0),(0|r)<(0|n);)r=r+1|0;if(ar[A+376120+(e<<2)>>2]=n,!(0<(0|e)))break;e=e+-1|0}}}while(0);a=0|ar[A+375900>>2],c=0|tr[A+375916+(a<<1)>>0],ar[A+375904>>2]=c,ar[A+375908>>2]=tr[A+375916+(a<<1)+1>>0],ar[A+375912>>2]=c}(A),0|tr[(d=r+4|0)>>0]){if(ar[e+376204>>2]=ar[r+28>>2],l=0|ar[l>>2],u=0|tr[l+4703>>0]?0!=(0|tr[e+533>>0]):1,-1==(0|(u=0|to(e+376148|0,l,A,f,n,o,u))))return ar[i>>2]=9,ur=c,(r=0)|r;l=0|ar[e+376156>>2],u=(0|ar[e+376160>>2])-l>>2>>>0>u>>>0?0|ar[l+(u<<2)>>2]:0,tr[(s=u+10518|0)>>0]=0|tr[t>>0],tr[s+1>>0]=0|tr[t+1>>0],tr[s+2>>0]=0|tr[t+2>>0],ar[(s=e+376224|0)>>2]=u,l=0|ar[a>>2],Eu(0|(t=u+108|0),0|l,592),(0|t)==(0|l)?(i=l+604|0,ar[(t=u+712|0)>>2]=ar[i>>2],ar[t+4>>2]=ar[i+4>>2],ar[t+8>>2]=ar[i+8>>2],ar[t+12>>2]=ar[i+12>>2],ar[t+16>>2]=ar[i+16>>2],ar[t+20>>2]=ar[i+20>>2]):(mr(u+700|0,0|ar[l+592>>2],0|ar[l+596>>2]),i=l+604|0,ar[(t=u+712|0)>>2]=ar[i>>2],ar[t+4>>2]=ar[i+4>>2],ar[t+8>>2]=ar[i+8>>2],ar[t+12>>2]=ar[i+12>>2],ar[t+16>>2]=ar[i+16>>2],ar[t+20>>2]=ar[i+20>>2],pr(u+736|0,0|ar[l+628>>2],0|ar[l+632>>2]),yr(u+748|0,0|ar[l+640>>2],0|ar[l+644>>2])),tr[u+760>>0]=0|tr[l+652>>0],l=0|ar[b>>2],Eu(0|(b=u+5932|0),0|l,4340),(0|b)!=(0|l)&&(Br(u+10272|0,0|ar[l+4340>>2],0|ar[l+4344>>2]),Br(u+10284|0,0|ar[l+4352>>2],0|ar[l+4356>>2]),Br(u+10296|0,0|ar[l+4364>>2],0|ar[l+4368>>2]),Br(u+10308|0,0|ar[l+4376>>2],0|ar[l+4380>>2]),Br(u+10320|0,0|ar[l+4388>>2],0|ar[l+4392>>2])),ar[u+10332>>2]=e,function(A){var e,r=0;0|(r=0|ar[10360+(A|=0)>>2])&&Vu(0|r,0,3*(0|ar[A+10364>>2])|0);0|(r=0|ar[A+10340>>2])&&Vu(0|r,0,24*(0|ar[A+10344>>2])|0);0|(r=0|ar[A+10460>>2])&&Vu(0|r,0,0|ar[A+10464>>2]);if((0|(e=0|ar[A+10344>>2]))<=0)return;A=0|ar[A+10524>>2],r=0;for(;ar[A+(80*r|0)>>2]=0,r=r+1|0,(0|r)<(0|e););}(u),l=e+377212|0;do{if(0|Zo(0|tr[l>>0])){if(!(0|mo(0|tr[l>>0])||0|po(0|tr[l>>0])||0!=(0|tr[e+376208>>0]))&&0==(0|tr[e+376211>>0])){tr[e+376209>>0]=0,tr[e+376210>>0]=0;break}tr[e+376209>>0]=1,tr[e+376211>>0]=0}}while(0);0|yo(0|tr[l>>0])&&0!=(0|tr[e+376209>>0])?tr[100+(0|ar[s>>2])>>0]=0:tr[100+(0|ar[s>>2])>>0]=0!=(0|tr[r+24>>0])&1,function(A,e,r){A|=0,r|=0;var i,f=0,n=0,t=0;0|Zo(0|tr[(i=377212+(e|=0)|0)>>0])&&0!=(0|tr[e+376209>>0])?(ar[(n=e+376212|0)>>2]=0,tr[A+377228>>0]=1,A=r+28|0,A=(r=0)|ar[(f=A)>>2]):(n=0|ar[5032+(0|ar[e+375388>>2])>>2],A=0|ar[(t=r+28|0)>>2],f=0|ar[e+376216>>2],r=0|ar[e+376220>>2],(0|A)<(0|f)&&((0|n)/2|0)<=(f-A|0)?r=r+n|0:(0|f)<(0|A)&&(r=r-(((0|n)/2|0)<(A-f|0)?n:0)|0),ar[(n=e+376212|0)>>2]=r,f=t);if(t=0|ar[e+376224>>2],ar[t+92>>2]=A+r,ar[t+88>>2]=A,0|tr[t+10520>>0])return;if(0|function(A){return(255&(A|=0))<15?0==(1&A)|0:0}(0|tr[i>>0]))return;if(0|yo(0|tr[i>>0]))return;if(0|function(A){return(1|(A|=0))<<24>>24==7|0}(0|tr[i>>0]))return;ar[e+376216>>2]=ar[f>>2],ar[e+376220>>2]=ar[n>>2]}(A,e,r),l=u+96|0,0|tr[d>>0]&&(ar[l>>2]=1,function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0;if(ur=(c=ur)+32|0,t=c+4|0,ar[(o=(f=c)+16|0)>>2]=0,ar[(a=4+o|0)>>2]=0,ar[8+o>>2]=0,i=0|ar[ar[(n=e+376224|0)>>2]>>2],0|Zo(0|tr[(h=e+377212|0)>>0])&&0|tr[e+376209>>0]&&(u=0|ar[n>>2],w=0|ar[u+92>>2],v=A+376156|0,s=0|ar[(g=A+376160|0)>>2],l=0|ar[v>>2],0<(s-l|0)))for(m=e+376156|0,p=e+376160|0,y=8+o|0,k=0,d=s;s=0|ar[m>>2],s=(0|ar[p>>2])-s>>2>>>0>k>>>0?0|ar[s+(k<<2)>>2]:0,0!=(0|ar[s+96>>2])&&(0|ar[s+92>>2])<(0|w)&&(0|ar[(Z=s+104|0)>>2])>>>0>(0|ar[u>>2])>>>0?(s=0|ar[s>>2],ar[t>>2]=s,(b=0|ar[a>>2])>>>0<(0|ar[y>>2])>>>0?(ar[b>>2]=s,ar[a>>2]=b+4,s=d):(St(o,t),s=0|ar[g>>2],l=0|ar[v>>2],u=0|ar[n>>2]),ar[Z>>2]=ar[u>>2]):s=d,!((s-l>>2|0)<=(0|(k=k+1|0)));)d=s;if(0|mo(0|tr[h>>0]))ar[e+376552>>2]=0,ar[e+376556>>2]=0,ar[e+376560>>2]=0,u=l=0;else{if((l=0|tr[r+908>>0])<<24>>24)for(k=255&l,d=b=s=0;Z=0==(0|tr[r+876+s>>0]),l=(1&Z)+d|0,u=(1&(1^Z))+b|0,ar[(Z?e+376700+(d<<2)|0:e+376572+(b<<2)|0)>>2]=(0|or[r+812+(s<<1)>>1])+(0|ar[92+(0|ar[n>>2])>>2]),!((0|k)<=(0|(s=s+1|0)));)b=u,d=l;else l=u=0;if(ar[e+376552>>2]=u,(u=0|tr[r+909>>0])<<24>>24)for(k=255&u,b=s=0;;){if(Z=0==(0|tr[r+892+s>>0]),d=(1&Z)+l|0,u=(1&(1^Z))+b|0,ar[(Z?e+376700+(l<<2)|0:e+376636+(b<<2)|0)>>2]=(0|or[r+844+(s<<1)>>1])+(0|ar[92+(0|ar[n>>2])>>2]),(0|k)<=(0|(s=s+1|0))){l=d;break}b=u,l=d}else u=0;if(ar[e+376556>>2]=u,ar[e+376560>>2]=l,k=r+140|0,0<((0|ar[(h=r+144|0)>>2])+(0|ar[k>>2])|0))for(w=r+28|0,v=e+375388|0,u=l=d=0;s=0|ar[e+376232+(d<<2)>>2],0|tr[(b=r+244+d|0)>>0]&&(s=(0|ar[92+(0|ar[n>>2])>>2])+s-(0|ar[w>>2])-(0|sr(0|ar[5032+(0|ar[v>>2])>>2],0|ar[e+376360+(d<<2)>>2]))|0),0|ar[e+376296+(d<<2)>>2]?(ar[e+376764+(l<<2)>>2]=s,ar[e+376424+(l<<2)>>2]=tr[b>>0],l=l+1|0):(ar[e+376828+(u<<2)>>2]=s,ar[e+376488+(u<<2)>>2]=tr[b>>0],u=u+1|0),(0|(d=d+1|0))<((0|ar[h>>2])+(0|ar[k>>2])|0););else u=l=0}ar[(v=e+376564|0)>>2]=l,ar[(w=e+376568|0)>>2]=u,d=A+376148|0,g=A+376156|0,l=(0|ar[(m=A+376160|0)>>2])-(0|ar[g>>2])|0,u=l>>2,ar[t>>2]=0,ar[(s=4+t|0)>>2]=0,ar[(b=8+t|0)>>2]=0,0|u&&((0|l)<0&&il(),y=0|El((Z=1+((u+-1|0)>>>5)|0)<<2),ar[t>>2]=y,ar[b>>2]=Z,ar[s>>2]=u,Vu(0|y,0,(Z=u>>>5)<<2|0),l=u-(Z<<5)|0,u=y+(Z<<2)|0,0|l&&(ar[u>>2]=ar[u>>2]&~(-1>>>(32-l|0))));if(qt(),0<(0|(l=0|ar[v>>2])))for(d=e+376148|0,k=e+376156|0,h=e+375388|0,b=0;l=0|ar[(s=e+376764+(b<<2)|0)>>2],l=0|ar[e+376424+(b<<2)>>2]?0|Ao(d,l,i,1):0|eo(d,l,i,1),(0|(ar[(u=e+377084+(b<<2)|0)>>2]=l))<=-1&&(l=0|Ut(A,e,0|ar[h>>2],0|ar[s>>2],1),ar[u>>2]=l),Z=(0|ar[t>>2])+(l>>>5<<2)|0,ar[Z>>2]=ar[Z>>2]|1<<(31&l),0|tr[10516+(0|ar[(0|ar[k>>2])+(l<<2)>>2])>>0]&&(tr[10516+(0|ar[n>>2])>>0]=4),b=b+1|0,l=0|ar[v>>2],(0|b)<(0|l););if(0<(0|(u=0|ar[w>>2]))){for(k=e+376148|0,h=e+375388|0,d=0;l=0|ar[(s=e+376828+(d<<2)|0)>>2],l=0|ar[e+376488+(d<<2)>>2]?0|Ao(k,l,i,1):0|eo(k,l,i,1),(0|(ar[(u=e+377148+(d<<2)|0)>>2]=l))<=-1&&(l=0|Ut(A,e,0|ar[h>>2],0|ar[s>>2],1),ar[u>>2]=l),b=(0|ar[t>>2])+(l>>>5<<2)|0,ar[b>>2]=ar[b>>2]|1<<(31&l),d=d+1|0,b=0|ar[w>>2],(0|d)<(0|b););l=0|ar[v>>2]}else b=u;if(0<(0|l))for(s=0|ar[e+376156>>2],u=0;ar[96+(0|ar[s+(ar[e+377084+(u<<2)>>2]<<2)>>2])>>2]=2,(0|(u=u+1|0))<(0|l););if(0<(0|b))for(u=0|ar[e+376156>>2],l=0;ar[96+(0|ar[u+(ar[e+377148+(l<<2)>>2]<<2)>>2])>>2]=2,(0|(l=l+1|0))<(0|b););if(0<(0|ar[(d=e+376552|0)>>2]))for(k=e+376148|0,h=e+376156|0,w=e+375388|0,b=0;l=0|Ao(k,0|ar[(u=e+376572+(b<<2)|0)>>2],i,0),(0|(ar[(s=e+376892+(b<<2)|0)>>2]=l))<=-1&&(l=0|Ut(A,e,0|ar[w>>2],0|ar[u>>2],0),ar[s>>2]=l),Z=(0|ar[t>>2])+(l>>>5<<2)|0,ar[Z>>2]=ar[Z>>2]|1<<(31&l),0|tr[10516+(0|ar[(0|ar[h>>2])+(l<<2)>>2])>>0]&&(tr[10516+(0|ar[n>>2])>>0]=4),(0|(b=b+1|0))<(0|ar[d>>2]););if(0<(0|ar[(d=e+376556|0)>>2]))for(k=e+376148|0,h=e+376156|0,w=e+375388|0,b=0;l=0|Ao(k,0|ar[(u=e+376636+(b<<2)|0)>>2],i,0),(0|(ar[(s=e+376956+(b<<2)|0)>>2]=l))<=-1&&(l=0|Ut(A,e,0|ar[w>>2],0|ar[u>>2],0),ar[s>>2]=l),Z=(0|ar[t>>2])+(l>>>5<<2)|0,ar[Z>>2]=ar[Z>>2]|1<<(31&l),0|tr[10516+(0|ar[(0|ar[h>>2])+(l<<2)>>2])>>0]&&(tr[10516+(0|ar[n>>2])>>0]=4),(0|(b=b+1|0))<(0|ar[d>>2]););if(0<(0|ar[(u=e+376560|0)>>2]))for(s=e+376148|0,l=0;b=0|Ao(s,0|ar[e+376700+(l<<2)>>2],i,0),-1<(0|(ar[e+377020+(l<<2)>>2]=b))&&(A=(0|ar[t>>2])+(b>>>5<<2)|0,ar[A>>2]=ar[A>>2]|1<<(31&b)),(0|(l=l+1|0))<(0|ar[u>>2]););if(u=0|ar[m>>2],l=0|ar[g>>2],0<(u-l|0))for(v=e+376156|0,h=e+376160|0,w=8+o|0,k=0,d=u;!(((u=ar[(0|ar[t>>2])+(k>>>5<<2)>>2]&1<<(31&k)?d:(u=0|ar[v>>2],s=(0|ar[h>>2])-u>>2>>>0>k>>>0?0|ar[u+(k<<2)>>2]:0,u=0|ar[n>>2],(0|s)!=(0|u)&&(0|ar[(C=s+104|0)>>2])>>>0>(0|ar[u>>2])>>>0&&0!=(0|ar[s+96>>2])?(s=0|ar[s>>2],ar[f>>2]=s,(b=0|ar[a>>2])>>>0<(0|ar[w>>2])>>>0?(ar[b>>2]=s,ar[a>>2]=b+4,s=d):(St(o,f),s=0|ar[m>>2],l=0|ar[g>>2],u=0|ar[n>>2]),ar[C>>2]=ar[u>>2],s):d))-l>>2|0)<=(0|(k=k+1|0)));)d=u;(0|(l=r+1344|0))!=(0|o)&&Br(l,0|ar[o>>2],0|ar[a>>2]);0|(l=0|ar[t>>2])&&Vl(l);if(!(l=0|ar[o>>2]))return ur=c;(0|(u=0|ar[a>>2]))!=(0|l)&&(ar[a>>2]=u+(~((u+-4-l|0)>>>2)<<2));Vl(l),ur=c}(A,e,r)),ar[l>>2]=1,function(A){A|=0,ar[12717]=A}(0|ar[92+(0|ar[s>>2])>>2]),tr[A+376208>>0]=0}else if(!(0|ar[e+376224>>2]))return ur=c,(r=0)|r;if((0|ar[r+20>>2])>>>0<2&&!(0|function(A,e,r){A|=0,e|=0;var i,f,n,t,o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;ur=(s=ur)+480|0,v=s+192|0,u=(l=s)+384|0,g=0|ar[912+(r|=0)>>2],h=0|ar[(i=r+328|0)>>2],k=(0|g)<(0|h)?h:g,b=96+(A=u)|0;for(;tr[A>>0]=0,A=A+1|0,(0|A)<(0|b););f=e+376552|0,n=e+376556|0,t=e+376564|0,o=e+376892|0,a=e+376956|0,c=e+377084|0,A=0;for(;!((0|k)<=(0|A));){if(0<(0|(d=0|ar[f>>2])))for(Eu(v+(A<<2)|0,0|o,0|sr((b=A-k|0)>>>0<(w=0-d|0)>>>0?w:b,-4)),b=0;(0|(A=A+1|0))<(0|k)&(0|(b=b+1|0))<(0|d););if(d=0|ar[n>>2],(0|A)<(0|k)&0<(0|d))for(Eu(v+(A<<2)|0,0|a,0|sr((b=A-k|0)>>>0<(w=0-(1<(0|d)?d:1)|0)>>>0?w:b,-4)),b=0;(0|(A=A+1|0))<(0|k)&(0|(b=b+1|0))<(0|d););if(d=0|ar[t>>2],(0|A)<(0|k)&0<(0|d))for(Vu(u+A|0,1,0-(b=(b=A-k|0)>>>0<(w=0-(1<(0|d)?d:1)|0)>>>0?w:b)|0),Eu(v+(A<<2)|0,0|c,0|sr(b,-4)),b=0;(0|(A=A+1|0))<(0|k)&(0|(b=b+1|0))<(0|d););if(!A){p=13;break}}if(13==(0|p))return 20==(0|(A=0|ar[(b=e+84|0)>>2]))?(b=1001,A=19):(ar[b>>2]=A+1,b=1016),ar[e+4+(A<<2)>>2]=b,ur=s,(e=0)|e;17<=(0|h)&&br(28270,28026,1781,28303);A:do{if(0<(0|h)){for(k=r+336|0,h=e+376156|0,w=e+376160|0,d=0;;){if(A=0|tr[k>>0]?0|cr[r+338+d>>0]:d,ar[(b=r+916+(d<<2)|0)>>2]=ar[v+(A<<2)>>2],tr[r+1300+d>>0]=0|tr[u+A>>0],A=0|ar[b>>2],b=0|ar[h>>2],(0|ar[w>>2])-b>>2>>>0<=A>>>0){A=0,p=54;break}if(!(A=0|ar[b+(A<<2)>>2])){A=0,p=54;break}if(ar[r+1044+(d<<2)>>2]=ar[A+92>>2],ar[r+1172+(d<<2)>>2]=ar[A+96>>2],d=d+1|0,(0|(A=0|ar[i>>2]))<=(0|d)){m=A;break A}}if(54==(0|p))return ur=s,0|A}else m=h}while(0);if(0|ar[r+20>>2])return ur=s,0|(e=1);h=0|ar[(v=r+332|0)>>2],k=(0|g)<(0|h)?h:g,A=0;for(;!((0|k)<=(0|A));){if(0<(0|(d=0|ar[n>>2])))for(Eu(l+(A<<2)|0,0|a,0|sr((b=A-k|0)>>>0<(g=0-d|0)>>>0?g:b,-4)),b=0;(0|(A=A+1|0))<(0|k)&(0|(b=b+1|0))<(0|d););if(d=0|ar[f>>2],(0|A)<(0|k)&0<(0|d))for(Eu(l+(A<<2)|0,0|o,0|sr((b=A-k|0)>>>0<(g=0-(1<(0|d)?d:1)|0)>>>0?g:b,-4)),b=0;(0|(A=A+1|0))<(0|k)&(0|(b=b+1|0))<(0|d););if(d=0|ar[t>>2],(0|A)<(0|k)&0<(0|d))for(Vu(48+u+A|0,1,0-(b=(b=A-k|0)>>>0<(g=0-(1<(0|d)?d:1)|0)>>>0?g:b)|0),Eu(l+(A<<2)|0,0|c,0|sr(b,-4)),b=0;(0|(A=A+1|0))<(0|k)&(0|(b=b+1|0))<(0|d););if(!A){p=38;break}}if(38==(0|p))return 20==(0|(A=0|ar[(b=e+84|0)>>2]))?(b=1001,A=19):(ar[b>>2]=A+1,b=1016),ar[e+4+(A<<2)>>2]=b,ur=s,(e=0)|e;if(16<(0|m))return 20==(0|(A=0|ar[(b=e+84|0)>>2]))?(b=1001,A=19):(ar[b>>2]=A+1,b=1012),ar[e+4+(A<<2)>>2]=b,ur=s,(e=0)|e;17<=(0|h)&&br(28337,28026,1834,28303);if((0|h)<=0)return ur=s,0|(e=1);h=r+337|0,w=e+376156|0,k=e+376160|0,d=0;for(;;){if(A=0|tr[h>>0]?0|cr[r+354+d>>0]:d,ar[(b=r+980+(d<<2)|0)>>2]=ar[l+(A<<2)>>2],tr[r+1316+d>>0]=0|tr[48+u+A>>0],A=0|ar[b>>2],b=0|ar[w>>2],(0|ar[k>>2])-b>>2>>>0<=A>>>0){A=0,p=54;break}if(!(A=0|ar[b+(A<<2)>>2])){A=0,p=54;break}if(ar[r+1108+(d<<2)>>2]=ar[A+92>>2],ar[r+1236+(d<<2)>>2]=ar[A+96>>2],(0|(d=d+1|0))>=(0|ar[v>>2])){A=1,p=54;break}}return 54!=(0|p)?0:(ur=s,0|A)}(0,e,r)))return ur=c,(r=0)|r;qt(),u=0|tr[r+12>>0]?800+(0|ar[(l=u=e+376228|0)>>2])|0:(l=e+376228|0,r+16|0);return ar[r+800>>2]=ar[u>>2],ar[l>>2]=r,ur=c,0|(r=1)}(A,A,b,n,0|ar[(u=r+8|0)>>2],0|ar[u+4>>2],i,0|ar[r+16>>2]),a=0|ar[(s=A+376224|0)>>2],!u)return 0|a&&(tr[a+10516>>0]=2),Eo(A+548|0,r),0|(a=0|ar[b+1344>>2])&&((0|(c=0|ar[(i=b+1348|0)>>2]))!=(0|a)&&(ar[i>>2]=c+(~((c+-4-a|0)>>>2)<<2)),Vl(a)),Zt(b+1332|0),0|(a=0|ar[b+776>>2])&&((0|(c=0|ar[(i=b+780|0)>>2]))!=(0|a)&&(ar[i>>2]=c+(~((c+-4-a|0)>>>2)<<2)),Vl(a)),Vl(b),b=0|ar[n>>2],ur=t,0|b;if(ar[f>>2]=b,i=a+48|0,l=0|ar[(c=a+52|0)>>2],ar[b>>2]=l-(0|ar[i>>2])>>2,(0|l)==(0|ar[a+56>>2])?function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=4+(A|=0)|0,n=0|ar[A>>2],t=(0|ar[f>>2])-n|0,1073741823<(o=1+(i=t>>2)|0)>>>0&&il();c=(0|ar[(l=A+8|0)>>2])-n|0,a=c>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t);if(ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),!n)return;Vl(n)}(i,f):(ar[l>>2]=b,ar[c>>2]=4+(0|ar[c>>2])),ct(e,1),lt(e),l=(0|ar[e>>2])-(0|ar[r+20>>2])|0,0<(0|ar[(u=b+768|0)>>2]))for(c=(a=0)|ar[(i=b+776|0)>>2];k=0|Wo(r,0|ar[c+(a<<2)>>2],l),c=0|ar[i>>2],ar[(d=c+(a<<2)|0)>>2]=(0|ar[d>>2])-k,(0|(a=a+1|0))<(0|ar[u>>2]););if(0|tr[b+4>>0]){for(ao((c=0|El(10688))+8|0),i=(a=c+10632|0)+56|0;(0|(a=a+4|(ar[a>>2]=0)))<(0|i););ar[f>>2]=c,ar[c>>2]=ar[s>>2],(0|(i=0|ar[(a=A+377220|0)>>2]))==(0|ar[A+377224>>2])?function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=4+(A|=0)|0,n=0|ar[A>>2],t=(0|ar[f>>2])-n|0,1073741823<(o=1+(i=t>>2)|0)>>>0&&il();c=(0|ar[(l=A+8|0)>>2])-n|0,a=c>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t);if(ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),!n)return;Vl(n)}(A+377216|0,f):(ar[i>>2]=c,ar[a>>2]=4+(0|ar[a>>2]))}else a=A+377220|0;return(0|ar[A+377216>>2])!=(0|ar[a>>2])&&(l=0|El(152),ar[l>>2]=0,ar[(i=l+4|0)>>2]=0,ar[l+32>>2]=0,jn(l+44|(tr[l+36>>0]=0)),ar[l+124>>2]=0,ar[l+128>>2]=-1,ar[l+132>>2]=-1,ar[l+136>>2]=0,ar[l+144>>2]=A,ar[l+40>>2]=0,ar[l+140>>2]=0,ar[f>>2]=l,ar[l>>2]=r,ar[i>>2]=b,ar[(i=l+8|0)>>2]=ar[e>>2],ar[i+4>>2]=ar[e+4>>2],ar[i+8>>2]=ar[e+8>>2],ar[i+12>>2]=ar[e+12>>2],ar[i+16>>2]=ar[e+16>>2],ar[i+20>>2]=ar[e+20>>2],tr[l+36>>0]=0|tr[A+377228>>0],a=0|ar[(0|ar[a>>2])-4>>2],(0|(c=0|ar[(i=a+10636|0)>>2]))==(0|ar[a+10640>>2])?function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=4+(A|=0)|0,n=0|ar[A>>2],t=(0|ar[f>>2])-n|0,1073741823<(o=1+(i=t>>2)|0)>>>0&&il();c=(0|ar[(l=A+8|0)>>2])-n|0,a=c>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t);if(ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),!n)return;Vl(n)}(a+10632|0,f):(ar[c>>2]=l,ar[i>>2]=4+(0|ar[i>>2]))),k=0|Xr(A,f),ar[n>>2]=k,ur=t,(k=0)|k}function Xr(A,e){A|=0;var r,i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;if(ur=(f=ur)+16|0,r=f,((tr[(e|=0)>>0]=0)|(t=n=0|ar[(i=A+377216|0)>>2]))==(0|(o=s=0|ar[(d=A+377220|0)>>2])))return ur=f,(d=0)|d;u=0|ar[n>>2],a=0|ar[u+10636>>2],s=c=0|ar[u+10632>>2];A:do{if((0|a)!=(0|c)){for(c=a-c>>2,a=0;l=0|ar[s+(a<<2)>>2],a=a+1|0,0|ar[l+40>>2];)if(c>>>0<=a>>>0)break A;if(l){if(0|tr[l+36>>0]&&no(A+376148|0),tr[e>>0]=1,n=0|_r(A,u,l))return ur=f,0|(d=n);t=n=0|ar[i>>2],o=0|ar[d>>2];break}}}while(0);if(1<o-t>>2>>>0?(u=0|ar[n>>2],(0|(s=0|ar[u+10636>>2]))!=(0|ar[u+10632>>2])&&0==(0|ar[40+(0|ar[s+-4>>2])>>2])&&(b=14)):b=14,14==(0|b)){if((0|o)==(0|(n=b=0|ar[i>>2])))return ur=f,(d=0)|d;if(s=0|ar[n>>2],(0|(b=0|ar[s+10636>>2]))!=(0|ar[s+10632>>2])&&0==(0|ar[40+(0|ar[b+-4>>2])>>2]))return ur=f,(d=0)|d;if((0!=(0|ar[A+556>>2])|0)!=(0-(0|ar[A+580>>2])|0))return ur=f,(d=0)|d;if(0==(0|tr[A+548>>0])&&0==(0|tr[A+549>>0]))return ur=f,(d=0)|d}if(c=0|ar[n>>2],tr[e>>0]=1,n=0|ar[c>>2],0<(0|ar[(o=n+10344|0)>>2])){for(t=n+10524|0,n=0;Ln((0|ar[t>>2])+(80*n|0)|0,1),(0|(n=n+1|0))<(0|ar[o>>2]););a=0|ar[c>>2]}else a=n;n=0|ar[(o=a+10332|0)>>2],t=0==(0|tr[n+532>>0]),0|ar[375892+(0|ar[10332+(0|ar[A+376224>>2])>>2])>>2]?(t?(function(A){var e,r,i,f,n,t,o,a=0,c=0,l=0;{if(ur=(o=ur)+16|0,r=o,i=0|ar[(A|=0)>>2],l=0|ar[10332+i>>2],so(i,ar[(f=5828+i|0)>>2]<<1),n=A+10668|0,t=A+10672|0,l=l+375396|0,e=A+10664|0,!(0<(0|ar[f>>2])))return ur=o;c=0}for(;A=0|El(20),ar[A+4>>2]=0,ar[A>>2]=7896,ar[A+8>>2]=i,ar[A+12>>2]=c,tr[A+16>>0]=1,ar[r>>2]=A,(a=0|ar[n>>2])>>>0<(0|ar[t>>2])>>>0?(ar[a>>2]=A,ar[n>>2]=4+(0|ar[n>>2])):vr(e,r),qn(l,A),c=c+1|0,A=0|ar[f>>2],(0|c)<(0|A););{if(!(0<(0|A)))return ur=o;A=0}for(;a=0|El(20),ar[a+4>>2]=0,ar[a>>2]=7896,ar[a+8>>2]=i,ar[a+12>>2]=A,tr[a+16>>0]=0,ar[r>>2]=a,(c=0|ar[n>>2])>>>0<(0|ar[t>>2])>>>0?(ar[c>>2]=a,ar[n>>2]=4+(0|ar[n>>2])):vr(e,r),qn(l,a),A=A+1|0,(0|A)<(0|ar[f>>2]););ur=o}(c),t=3,n=0|ar[o>>2]):t=1,0|tr[n+533>>0]||function(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0;if(ur=(n=ur)+16|0,f=n,s=0|ar[(A|=0)>>2],!(0|tr[s+5467>>0]))return ur=n,s=0;if(o=0|ar[(t=s+10332|0)>>2],u=s+10480|0,0|co(i=A+8|0,0|ar[s+24>>2],0|ar[s+28>>2],0|ar[s+20>>2],s+764|0,0,o,0|ar[s+10336>>2],0|ar[u>>2],0|ar[u+4>>2],0|ar[s+10488>>2],1))return Gr(4+(0|ar[t>>2])|0,1024,0),ur=n,s=0;if(r=0|ar[s+5828>>2],so(s,r),0<(0|r))for(l=A+10668|0,u=A+10672|0,c=o+375396|0,o=A+10664|0,t=0;A=0|El(28),ar[A+4>>2]=0,ar[A>>2]=6096,ar[A+16>>2]=s,ar[A+20>>2]=i,ar[A+12>>2]=s,ar[A+8>>2]=t,ar[A+24>>2]=e,ar[f>>2]=A,(a=0|ar[l>>2])>>>0<(0|ar[u>>2])>>>0?(ar[a>>2]=A,ar[l>>2]=4+(0|ar[l>>2])):vr(o,f),qn(c,A),(0|(t=t+1|0))!=(0|r););wo(s),function(A,e){var r,i=0,f=0,n=0;n=(e=e|0)+4|0,f=0|ar[(i=(A=A|0)+4|0)>>2],ar[i>>2]=ar[n>>2],ar[n>>2]=f,f=e+60|0,i=0|ar[(n=A+60|0)>>2],ar[n>>2]=ar[f>>2],ar[f>>2]=i,i=e+10492|0,n=0|ar[(f=A+10492|0)>>2],ar[f>>2]=ar[i>>2],ar[i>>2]=n,n=e+8|0,f=0|ar[(i=A+8|0)>>2],ar[i>>2]=ar[n>>2],ar[n>>2]=f,f=e+64|0,i=0|ar[(n=A+64|0)>>2],ar[n>>2]=ar[f>>2],ar[f>>2]=i,i=e+10496|0,n=0|ar[(f=A+10496|0)>>2],ar[f>>2]=ar[i>>2],ar[i>>2]=n,n=e+12|0,f=0|ar[(i=A+12|0)>>2],ar[i>>2]=ar[n>>2],ar[n>>2]=f,f=e+68|0,i=0|ar[(n=A+68|0)>>2],ar[n>>2]=ar[f>>2],ar[f>>2]=i,i=e+10500|0,n=0|ar[(f=A+10500|0)>>2],ar[f>>2]=ar[i>>2],ar[i>>2]=n,n=e+40|0,f=0|ar[(i=A+40|0)>>2],ar[i>>2]=ar[n>>2],ar[n>>2]=f,f=e+44|0,i=0|ar[(n=A+44|0)>>2],ar[n>>2]=ar[f>>2],ar[f>>2]=i,e=e+10504|0,i=0|ar[(A=f=A+10504|0)>>2],A=0|ar[A+4>>2],r=0|ar[(n=e)+4>>2],ar[f>>2]=ar[n>>2],ar[f+4>>2]=r,ar[e>>2]=i,ar[e+4>>2]=A}(s,i),ur=n,s=1}(c,t),wo(a)):(t&&(function(A){var e,r,i,f=0,n=0,t=0;{if(!(0<(0|ar[(t=5828+(A|=0)|0)>>2])))return;n=f=0}for(;f=0|f|Gt(A,n),n=n+1|0,(0|n)<(0|ar[t>>2]););if(!f)return;i=A+10472|0,Vt(A,1,0,0|ar[(r=A+10476|0)>>2],0,0|ar[i>>2]),f=0|ar[r>>2],n=0|ar[i>>2],(8<(0|ar[(e=A+5760|0)>>2])?Xt:_t)(A,1,0,f,0,n);t=A+5776|0;do{if(0|ar[t>>2]){if(f=0|ar[r>>2],n=0|ar[i>>2],8<(0|ar[A+5768>>2])){Ft(A,1,0,f,0,n);break}Nt(A,1,0,f,0,n);break}}while(0);Vt(A,0,0,0|ar[r>>2],0,0|ar[i>>2]),f=0|ar[r>>2],n=0|ar[i>>2],(8<(0|ar[e>>2])?Xt:_t)(A,0,0,f,0,n);if(!(0|ar[t>>2]))return;n=0|ar[r>>2],f=0|ar[i>>2],8<(0|ar[A+5768>>2])?Ft(A,0,0,n,0,f):Nt(A,0,0,n,0,f)}(a),n=0|ar[o>>2]),0|tr[n+533>>0]||function(A){var e,r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0;if(!(0|tr[5467+(A|=0)>>0]))return;d=A+40|0,G=0|sr(0|ar[(k=A+28|0)>>2],0|ar[d>>2]),G=0|sr(G,(7+(0|ar[(h=A+5760|0)>>2])|0)/8|0),e=A+44|0,X=0|sr(0|ar[(r=A+36|0)>>2],0|ar[e>>2]),X=0|sr(X,(7+(0|ar[(i=A+5768|0)>>2])|0)/8|0),X=0|Gl(-1<(0|(X=(0|X)<(0|G)?G:X))?X:-1),G=0==(0|ar[A+5776>>2])?1:3,n=A+5820|0,t=A+10352|0,o=A+10340|0,a=A+48|0,c=A+52|0,l=A+5804|0,u=A+4|0,s=A+5780|0,b=A+5784|0,w=0|ar[(f=A+5828|(V=0))>>2];A:for(;;){if(C=0|ar[(I=(B=0==(0|V))?d:e)>>2],E=A+4+(V<<2)|0,Z=0|sr(0|ar[(B?k:r)>>2],C),W=B?h:i,Eu(0|X,0|ar[E>>2],0|sr(Z,(7+(0|ar[W>>2])|0)/8|0)),0<(0|w))for(w=(Z=0)|ar[n>>2];;){if(0<(0|w))for(y=0;;){if(w=(0|sr(0|ar[t>>2],Z))+y|0,w=0|lr[(0|ar[o>>2])+(24*w|0)+2>>1],v=0|ar[a>>2],w>>>0>=(0|ar[c>>2])-v>>2>>>0){w=21;break A}if(!(p=0|ar[v+(w<<2)>>2])){w=21;break A}do{if(B){if(0|tr[p+325>>0]){if(v=1<<ar[l>>2],g=0|ar[u>>2],w=0|ar[d>>2],8<(0|ar[h>>2])){Jo(A,y,Z,p,0,v,v,X,C,g,w);break}Zn(A,y,Z,p,0,v,v,X,C,g,w);break}}else if(0|tr[p+326>>0]){if(g=1<<ar[l>>2],v=(0|g)/(0|ar[s>>2])|0,g=(0|g)/(0|ar[b>>2])|0,m=0|ar[E>>2],w=0|ar[I>>2],8<(0|ar[W>>2])){Jo(A,y,Z,p,V,v,g,X,C,m,w);break}Zn(A,y,Z,p,V,v,g,X,C,m,w);break}}while(0);if(y=y+1|0,(0|(w=0|ar[n>>2]))<=(0|y)){v=w;break}}else v=w;if(Z=Z+1|0,(0|(w=0|ar[f>>2]))<=(0|Z))break;w=v}if((0|G)<=(0|(V=V+1|0))){w=20;break}}{if(20==(0|w))return Xl(X);if(21==(0|w));}}(a)),a=c+10648|0,n=0|ar[(o=c+10644|0)>>2];A:do{if((0|ar[a>>2])==(0|n))a=0;else for(t=0;;){if(n=0|Wn(n+(80*t|0)|0,0|ar[c>>2]),t=t+1|0,0|n){a=n;break A}if(n=0|ar[o>>2],t>>>0>=(((0|ar[a>>2])-n|0)/80|0)>>>0){a=0;break}}}while(0);if(0|(o=0|ar[c>>2])){do{if(0|tr[o+100>>0]){if(0|tr[o+10516>>0]&&0|tr[A+514>>0])break;ar[r>>2]=o,(0|(t=0|ar[(n=A+376172|0)>>2]))==(0|ar[A+376176>>2])?Fr(A+376168|0,r):(ar[t>>2]=o,ar[n>>2]=4+(0|ar[n>>2]))}}while(0);n=A+376148|0,((0|ar[A+376172>>2])-(0|ar[A+376168>>2])>>2|0)>(0|ar[o+596+(12*((0|ar[o+116>>2])-1|0)|0)+4>>2])&&io(n)}if(kr(c),Vl(c),1<(n=0|ar[d>>2])-(t=0|ar[i>>2])>>2>>>0)for(o=1;ar[(n=t)+(o+-1<<2)>>2]=ar[n+(o<<2)>>2],(o=o+1|0)>>>0<(n=0|ar[d>>2])-(t=0|ar[i>>2])>>2>>>0;);return ar[d>>2]=n+-4,ur=f,0|(d=a)}function _r(A,e,r){A|=0,e|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0;if(l=(u=0|ar[(f=(r|=0)+4|0)>>2])+1344|0,u=u+1348|0,t=0|ar[l>>2],(0|ar[u>>2])!=(0|t))for(a=A+376148|0,c=A+376156|0,o=0;-1<(0|(t=0|ro(a,0|ar[t+(o<<2)>>2])))&&(ar[96+(0|ar[(0|ar[c>>2])+(t<<2)>>2])>>2]=0),o=o+1|0,t=0|ar[l>>2],o>>>0<(0|ar[u>>2])-t>>2>>>0;);u=0|ar[e>>2],ar[(i=r+40|0)>>2]=1,c=0|ar[u+10332>>2];A:do{if(0<(0|ar[c+375892>>2]))if(l=(k=0|tr[u+5965>>0])<<24>>24!=0,t=(h=0|tr[u+5966>>0])<<24>>24!=0,(k|h)<<24>>24)d=t;else{if(0<(0|(a=0|ar[(o=c+168|0)>>2]))){t=0;do{if(1e3==(0|ar[c+88+(t<<2)>>2])){d=0;break A}t=t+1|0}while((0|t)<(0|a));(0|a)<20&&(v=12)}else v=12;12==(0|v)&&(ar[o>>2]=a+1,ar[c+88+(a<<2)>>2]=1e3),20==(0|(t=0|ar[(o=c+84|0)>>2]))?(o=1001,t=19):(ar[o>>2]=t+1,o=1e3),ar[c+4+(t<<2)>>2]=o,d=0}else l=d=0}while(0);if(k=e+10632|0,(0|(t=0|ar[(h=e+10636|0)>>2]))!=(0|(o=0|ar[k>>2]))){if((0|ar[o>>2])==(0|r)&&0<(0|(s=0|ar[16+(0|ar[f>>2])>>2]))){for(o=u+10524|0,t=0;Ln((0|ar[o>>2])+(80*t|0)|0,1),(0|(t=t+1|0))!=(0|s););o=0|ar[k>>2],t=0|ar[h>>2]}}else o=t;a=t-o>>2;A:do{if(1<a>>>0){for(t=1;(0|ar[o+(t<<2)>>2])!=(0|r);)if(a>>>0<=(t=t+1|0)>>>0)break A;if(0|(c=0|ar[o+(t+-1<<2)>>2])&&2==(0|ar[c+40>>2])){a=a+-1|0,t=0;do{if(a>>>0<=t>>>0)break A;t=(s=t)+1|0}while((0|ar[o+(s<<2)>>2])!=(0|c));if(0|(t=0|ar[o+(t<<2)>>2])&&(0|(n=0|ar[16+(0|ar[c+4>>2])>>2]))<(0|ar[16+(0|ar[(b=t+4|0)>>2])>>2]))do{if(t=0|ar[e>>2],(0|n)>=(0|ar[t+10344>>2]))break A;Ln((0|ar[t+10524>>2])+(80*n|0)|0,1),n=n+1|0}while((0|n)<(0|ar[16+(0|ar[b>>2])>>2]))}}}while(0);if(!(l|d)){a=0|function(A,e,r){A|=0,e|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(ur=(n=ur)+18624|0,f=n,t=0|ar[(i=4+(r|=0)|0)>>2],s=t+1348|0,o=0|ar[(u=t+1344|0)>>2],(0|ar[s>>2])!=(0|o)){for(c=A+376148|0,l=A+376156|0,a=0,t=o;-1<(0|(t=0|ro(c,0|ar[t+(a<<2)>>2])))&&(ar[96+(0|ar[(0|ar[l>>2])+(t<<2)>>2])>>2]=0),a=a+1|0,t=0|ar[u>>2],a>>>0<(0|ar[s>>2])-t>>2>>>0;);t=0|ar[i>>2]}if(s=0|ar[e>>2],(0|ar[t+16>>2])>>>0>=(0|ar[s+10276>>2])-(0|ar[s+10272>>2])>>2>>>0)return ur=n,0|(b=6);if(pt(s=f+18580|0),t=f+48|0,ar[(u=f+18508|0)>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,ar[u+12>>2]=0,ar[u+16>>2]=0,Vu(0|(ar[f+2112>>2]=t),0,2048),t=0|ar[i>>2],ar[f+18600>>2]=t,u=0|ar[e>>2],ar[f+18596>>2]=u,ar[f+18592>>2]=A,ar[f+18604>>2]=e,ar[f+18608>>2]=r,ar[f+4>>2]=ar[(0|ar[u+10272>>2])+(ar[t+16>>2]<<2)>>2],wr(ar[f+18612>>2]=0,f),(0|(t=0|ar[r+12>>2]))<1)t=17;else{bt(f+18556|0,0|ar[r+8>>2],t);do{if(0|tr[A+93817>>0]&&0|tr[4+(0|ar[i>>2])>>0]){if(u=e+10676|0,c=(0|ar[5828+(0|ar[A+376224>>2])>>2])-1|0,t=0|ar[(l=e+10680|0)>>2],o=0|ar[u>>2],(a=t-o>>3)>>>0<c>>>0){Nr(u,c-a|0);break}if(c>>>0<a>>>0&&(0|t)!=(0|(b=o+(c<<3)|0)))for(;e=t+-8|0,Zt(ar[l>>2]=e),(0|(t=0|ar[l>>2]))!=(0|b););}}while(0);ar[r+124>>2]=1,t=0|function(A){var e,r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0;l=0|ar[18596+(A|=0)>>2],a=0|ar[A+4>>2],o=0|ar[l+5836>>2],c=0|ar[l+5820>>2],(0|a)<(0|o)&&(o=0|ar[(0|ar[l+10284>>2])+(a<<2)>>2]);if(ar[A>>2]=o,ar[A+8>>2]=(0|o)%(0|c)|0,ar[A+12>>2]=(0|o)/(0|c)|0,a=0|ar[(i=A+18600|0)>>2],!(0|In(A)))return 0|(A=18);dt(f=A+18556|0),n=A+18560|0,t=A+18592|0,l=l+5966|0,e=A+18580|0,r=A+18588|0,a=0==(0|tr[a+12>>(o=0)]);for(;;){do{if(0<(0|o)){if(c=o+-1|0,s=0|ar[i>>2],u=0|ar[s+776>>2],c>>>0<(0|ar[s+780>>2])-u>>2>>>0&&((0|ar[n>>2])-2-(0|ar[f>>2])|0)==(0|ar[u+(c<<2)>>2]))break;Gr(4+(0|ar[t>>2])|0,1003,1)}}while(0);if(o=o+1|0,2==(2|Bn(A,0,a))){o=0,a=14;break}if(0|tr[l>>0]){if(a=0|ar[i>>2],3<=(c=0|ar[a+796>>2])>>>0){a=12;break}Ct(e,c,0|ar[a+792>>2]),tr[r>>0]=0,tr[1+r>>0]=0,tr[2+r>>0]=0,tr[3+r>>0]=0,a=0}else a=0}if(12==(0|a))br(32537,32568,1508,32577);else if(14==(0|a))return 0|o;return 0}(f),Ln(r+44|0,1)}return Zt(s),ur=n,0|(b=t)}(A,e,r),ar[i>>2]=2,o=0|ar[k>>2],t=((0|ar[h>>2])-o>>2)-1|0,n=0;do{if(t>>>0<=n>>>0){w=a,v=60;break}n=(b=n)+1|0}while((0|ar[o+(b<<2)>>2])!=(0|r));if(60==(0|v))return 0|w;if(!(n=0|ar[o+(n<<2)>>2]))return 0|(e=a);if(!((0|(t=0|ar[16+(0|ar[f>>2])>>2]))<(0|ar[16+(0|ar[(o=n+4|0)>>2])>>2])))return 0|(e=a);for(n=t;;){if(t=0|ar[e>>2],(0|n)>=(0|ar[t+10344>>2])){w=a,v=60;break}if(Ln((0|ar[t+10524>>2])+(80*n|0)|0,1),(0|(n=n+1|0))>=(0|ar[16+(0|ar[o>>2])>>2])){w=a,v=60;break}}if(60==(0|v))return 0|w}if(l&d)return 0|(e=1006);if(l){!function(A,e,r){A|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0;ur=(a=ur)+16|0,t=a,o=0|ar[(e|=0)>>2],n=0|ar[r+4>>2],f=0|ar[768+n>>2],h=1+f|0,i=0|ar[5820+o>>2],(0|ar[10536+o>>2])!=(0-(0|ar[10532+o>>2])|0)&&br(28088,28026,989,28193);do{if(0|tr[4+n>>0]){if(l=e+10676|0,u=(0|ar[5828+o>>2])-1|0,c=0|ar[(d=e+10680|0)>>2],s=0|ar[l>>2],(b=c-s>>3)>>>0<u>>>0){Nr(l,u-b|0);break}if(u>>>0<b>>>0&&(0|c)!=(0|(k=s+(u<<3)|0)))for(;I=c+-8|0,Zt(ar[d>>2]=I),(0|(c=0|ar[d>>2]))!=(0|k););}}while(0);hr(r,h),c=0|ar[16+n>>2],b=(0|c)/(0|i)|0;A:do{if(0<=(0|f)){if(g=r+140|0,m=r+136|0,p=10332+o|0,y=10272+o|0,Z=r+12|0,C=r+8|0,W=r+124|0,I=A+375396|0,v=776+n|0,!f){if((0|ar[g>>2])<=0&&br(28143,28163,170,28174),u=0|ar[m>>2],ar[u+18600>>2]=n,ar[u+18592>>2]=ar[p>>2],ar[u+18596>>2]=o,ar[(l=u+18604|0)>>2]=e,ar[u+18608>>2]=r,ar[u+4>>2]=ar[(0|ar[y>>2])+(c<<2)>>2],wr(0,u),(0|(c=0|ar[Z>>2]))<=0)break;bt(u+18556|0,0|ar[C>>2],c),so(o,1),ar[W>>2]=1+(0|ar[W>>2]),s=0|El(20),ar[s+4>>2]=0,ar[s>>2]=6316,tr[s+8>>0]=1,ar[s+16>>2]=u,ar[s+12>>2]=b,ar[u+18612>>2]=s,qn(I,s),c=0|ar[l>>2],ar[t>>2]=s,(u=0|ar[(l=c+10668|0)>>2])>>>0<(0|ar[c+10672>>2])>>>0?(ar[u>>2]=s,ar[l>>2]=4+(0|ar[l>>2])):vr(c+10664|0,t);break}for(l=b,w=0;;){if((0|w)<=0){if((0|c)%(0|i)|0)break A}else c=0|sr(l=c=l+1|0,i);if((0|ar[g>>2])<=(0|w))break;if(b=0|ar[m>>2],d=b+(18624*w|0)|0,ar[b+(18624*w|0)+18600>>2]=n,ar[b+(18624*w|0)+18592>>2]=ar[p>>2],ar[b+(18624*w|0)+18596>>2]=o,ar[(k=b+(18624*w|0)+18604|0)>>2]=e,ar[b+(18624*w|0)+18608>>2]=r,ar[b+(18624*w|0)+4>>2]=ar[(0|ar[y>>2])+(c<<2)>>2],wr(0,d),s=(h=0==(0|w))?0:0|ar[(0|ar[v>>2])+(w+-1<<2)>>2],u=(0|w)==(0|f)?Z:(0|ar[v>>2])+(w<<2)|0,u=0|ar[u>>2],(0|s)<0)break A;if(!((0|s)<(0|u)&&(0|u)<=(0|ar[Z>>2])))break A;if(bt(b+(18624*w|0)+18556|0,(0|ar[C>>2])+s|0,u-s|0),so(o,1),ar[W>>2]=1+(0|ar[W>>2]),A=0|El(20),ar[A+4>>2]=0,ar[A>>2]=6316,tr[A+8>>0]=1&h,ar[A+16>>2]=d,ar[A+12>>2]=l,ar[b+(18624*w|0)+18612>>2]=A,qn(I,A),b=0|ar[k>>2],ar[t>>2]=A,(s=0|ar[(u=b+10668|0)>>2])>>>0<(0|ar[b+10672>>2])>>>0?(ar[s>>2]=A,ar[u>>2]=4+(0|ar[u>>2])):vr(b+10664|0,t),!((0|w)<(0|f)))break A;w=w+1|0}br(28143,28163,170,28174)}}while(0);if(wo(o),d=e+10664|0,l=0|ar[(k=e+10668|0)>>2],s=0|ar[d>>2],(0|(c=l))!=(0|(u=s))){for(b=0;(u=0|ar[u+(b<<2)>>2])&&(ds[511&ar[4+(0|ar[u>>2])>>2]](u),c=0|ar[k>>2],s=0|ar[d>>2],l=c),(b=b+1|0)>>>0<l-(u=s)>>2>>>0;);l=s}ur=((0|c)!=(0|u)&&(ar[k>>2]=c+(~((c+-4-l|0)>>>2)<<2)),a)}(A,e,r),ar[i>>2]=2,o=0|ar[k>>2],t=((0|ar[h>>2])-o>>2)-1|0,n=0;do{if(t>>>0<=n>>>0){w=0,v=60;break}n=(b=n)+1|0}while((0|ar[o+(b<<2)>>2])!=(0|r));if(60==(0|v))return 0|w;if(!(n=0|ar[o+(n<<2)>>2]))return(e=0)|e;if(!((0|(t=0|ar[16+(0|ar[f>>2])>>2]))<(0|ar[16+(0|ar[(o=n+4|0)>>2])>>2])))return(e=0)|e;for(n=t;;){if(t=0|ar[e>>2],(0|n)>=(0|ar[t+10344>>2])){w=0,v=60;break}if(Ln((0|ar[t+10524>>2])+(80*n|0)|0,1),(0|(n=n+1|0))>=(0|ar[16+(0|ar[o>>2])>>2])){w=0,v=60;break}}if(60==(0|v))return 0|w}d||br(49065,28026,971,28061),a=0|function(A,e,r){A|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0;ur=(a=ur)+16|0,f=a,n=0|ar[(e|=0)>>2],t=0|ar[r+4>>2],o=0|ar[768+t>>2],i=0|ar[5820+n>>2],(0|ar[10536+n>>2])!=(0-(0|ar[10532+n>>2])|0)&&br(28088,28026,1103,28119);hr(r,1+o|0),c=0|ar[16+t>>2];A:do{if((0|o)<0)G=0;else{for(m=5968+n|0,p=5972+n|0,y=r+140|0,Z=r+136|0,C=10332+n|0,W=10272+n|0,I=r+12|0,B=r+8|0,E=r+124|0,v=A+375396|0,g=776+t|0,l=c,A=0|ar[(0|ar[10308+n>>2])+(c<<2)>>2],w=0;;){if(0<(0|w)){if(c=A+1|0,A=0|ar[m>>2],(0|c)>=(0|sr(0|ar[p>>2],A))){G=1007;break A}l=(0|sr(0|ar[10228+n+(((0|c)/(0|A)|0)<<2)>>2],i))+(0|ar[10184+n+(((0|c)%(0|A)|0)<<2)>>2])|0,A=c}if((0|ar[y>>2])<=(0|w))break;if(s=0|ar[Z>>2],b=s+(18624*w|0)|0,ar[s+(18624*w|0)+18600>>2]=t,ar[s+(18624*w|0)+18592>>2]=ar[C>>2],ar[s+(18624*w|0)+18596>>2]=n,ar[(d=s+(18624*w|0)+18604|0)>>2]=e,ar[s+(18624*w|0)+18608>>2]=r,ar[s+(18624*w|0)+4>>2]=ar[(0|ar[W>>2])+(l<<2)>>2],wr(0,b),u=(k=0==(0|w))?0:0|ar[(0|ar[g>>2])+(w+-1<<2)>>2],c=(0|w)==(0|o)?I:(0|ar[g>>2])+(w<<2)|0,c=0|ar[c>>2],(0|u)<0){G=17;break A}if(!((0|u)<(0|c)&&(0|c)<=(0|ar[I>>2]))){G=17;break A}if(bt(s+(18624*w|0)+18556|0,(0|ar[B>>2])+u|0,c-u|0),so(n,1),ar[E>>2]=1+(0|ar[E>>2]),h=0|El(24),ar[h+4>>2]=0,ar[h>>2]=6276,tr[h+8>>0]=1&k,ar[h+20>>2]=b,ar[h+12>>2]=(0|l)%(0|i)|0,ar[h+16>>2]=(0|l)/(0|i)|0,ar[s+(18624*w|0)+18612>>2]=h,qn(v,h),c=0|ar[d>>2],ar[f>>2]=h,(s=0|ar[(u=c+10668|0)>>2])>>>0<(0|ar[c+10672>>2])>>>0?(ar[s>>2]=h,ar[u>>2]=4+(0|ar[u>>2])):vr(c+10664|0,f),!((0|w)<(0|o))){G=0;break A}w=w+1|0}br(28143,28163,170,28174)}}while(0);if(wo(n),b=e+10664|0,c=0|ar[(d=e+10668|0)>>2],u=0|ar[b>>2],(0|(A=c))!=(0|(l=u))){for(s=0;(l=0|ar[l+(s<<2)>>2])&&(ds[511&ar[4+(0|ar[l>>2])>>2]](l),A=0|ar[d>>2],u=0|ar[b>>2],c=A),(s=s+1|0)>>>0<c-(l=u)>>2>>>0;);c=u}return ur=((0|A)!=(0|l)&&(ar[d>>2]=A+(~((A+-4-c|0)>>>2)<<2)),a),0|G}(A,e,r),ar[i>>2]=2,o=0|ar[k>>2],t=((0|ar[h>>2])-o>>2)-1|0,n=0;do{if(t>>>0<=n>>>0){w=a,v=60;break}n=(A=n)+1|0}while((0|ar[o+(A<<2)>>2])!=(0|r));if(60==(0|v))return 0|w;if(!(t=0|ar[o+(n<<2)>>2]))return 0|(e=a);if((0|(n=0|ar[16+(0|ar[f>>2])>>2]))>=(0|ar[16+(0|ar[(o=t+4|0)>>2])>>2]))return 0|(e=a);for(;;){if(t=0|ar[e>>2],(0|n)>=(0|ar[t+10344>>2])){w=a,v=60;break}if(Ln((0|ar[t+10524>>2])+(80*n|0)|0,1),(0|(n=n+1|0))>=(0|ar[16+(0|ar[o>>2])>>2])){w=a,v=60;break}}return 60==(0|v)?0|w:0}function Fr(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=(A|=0)+4|0,n=0|ar[A>>2],1073741823<(o=1+(i=(t=(0|ar[f>>2])-n|0)>>2)|0)>>>0&&il(),a=(c=(0|ar[(l=A+8|0)>>2])-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t),ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),n&&Vl(n)}function Nr(A,e){var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if((e|=0)>>>0<=(t=0|ar[(i=(A|=0)+8|0)>>2])-(f=0|ar[(l=A+4|0)>>2])>>3>>>0)for(;pt(f),f=8+(0|ar[l>>2])|0,ar[l>>2]=f,0!=(0|(e=e+-1|0)););else{536870911<(f=(o=f-(n=0|ar[A>>2])>>3)+e|0)>>>0&&il(),c=(a=t-n|0)>>2,f=a>>3>>>0<268435455?c>>>0<f>>>0?f:c:536870911;do{if(f){if(!(536870911<f>>>0)){n=0|El(f<<3);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else n=0}while(0);for(c=n+(f<<3)|0,a=o=r=n+(o<<3)|0,f=r;pt(f),a=f=a+8|0,0!=(0|(e=e+-1|0)););if(t=0|ar[A>>2],(0|(f=0|ar[l>>2]))==(0|t))e=o,f=n=t;else{for(n=o,e=r;yt(e+-8|0,f=f+-8|0),n=e=n+-8|0,(0|f)!=(0|t););e=n,n=0|ar[A>>2],f=0|ar[l>>2]}if(ar[A>>2]=e,ar[l>>2]=a,ar[i>>2]=c,(0|f)!=(0|(e=n)))for(;Zt(f=f+-8|0),(0|f)!=(0|e););n&&Vl(n)}}function Rr(A,e,r,i,f,n){e|=0,f|=0,n|=0;var t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0;t=ur=(o=ur)+31&-32,ur=ur+512|0,V=0-(G=(i|=0)+(r|=0)|0)|0,I=(A|=0)+4|0,B=A+100|0,l=0;A:for(;;){switch(0|e){case 46:C=6;break A;case 48:break;default:d=l,b=k=m=0;break A}(e=0|ar[I>>2])>>>0<(0|ar[B>>2])>>>0?(ar[I>>2]=e+1,e=0|cr[e>>0],l=1):(e=0|Ya(A),l=1)}if(6==(0|C))if(48==(0|(e=(e=0|ar[I>>2])>>>0<(0|ar[B>>2])>>>0?(ar[I>>2]=e+1,0|cr[e>>0]):0|Ya(A))))for(e=l=0;;){if(l=0|vu(0|l,0|e,-1,-1),b=D,48!=(0|(e=(e=0|ar[I>>2])>>>0<(0|ar[B>>2])>>>0?(ar[I>>2]=e+1,0|cr[e>>0]):0|Ya(A)))){d=m=1,k=l;break}e=b}else m=1,d=l,b=k=0;s=e+-48|(ar[t>>2]=0),u=46==(0|e);A:do{if(u|s>>>0<10){W=496+t|0,y=m,Z=d,C=s,s=d=g=l=p=0;e:for(;;){do{if(u){if(y)break e;y=1,k=d,b=s}else{if(d=0|vu(0|d,0|s,1,0),s=D,m=48!=(0|e),125<=(0|l)){if(!m)break;ar[W>>2]=1|ar[W>>2];break}u=t+(l<<2)|0,e=p?e+-48+(10*(0|ar[u>>2])|0)|0:C,ar[u>>2]=e,p=(Z=9==(0|(p=p+1|0)))?0:p,l=(1&Z)+l|0,g=m?d:g,Z=1}}while(0);if(!((u=46==(0|(e=(e=0|ar[I>>2])>>>0<(0|ar[B>>2])>>>0?(ar[I>>2]=e+1,0|cr[e>>0]):0|Ya(A))))|(C=e+-48|0)>>>0<10)){m=y,u=Z,C=29;break A}}e=p,u=0!=(0|Z),C=37}else u=d,s=d=g=l=p=0,C=29}while(0);do{if(29==(0|C)){if(k=(W=0==(0|m))?d:k,b=W?s:b,!((u=0!=(0|u))&101==(32|e))){if(-1<(0|e)){e=p,C=37;break}e=p,C=39;break}if(0==(0|(u=0|Yr(A,n)))&-2147483648==(0|(e=D))){if(!n){Na(A,0),a=0;break}e=u=(0|ar[B>>2]&&(ar[I>>2]=(0|ar[I>>2])-1),0)}Z=0|vu(0|u,0|e,0|k,0|b),e=p,b=D,C=41}}while(0);37==(0|C)&&(C=0|ar[B>>2]?(ar[I>>2]=(0|ar[I>>2])-1,u?(Z=k,41):40):39),39==(0|C)&&(C=u?(Z=k,41):40);do{if(40==(0|C))ar[(V=8708)>>2]=22,Na(A,0),a=0;else if(41==(0|C)){if(!(u=0|ar[t>>2])){a=0*(0|f);break}if((0|Z)==(0|d)&(0|b)==(0|s)&((0|s)<0|0==(0|s)&d>>>0<10)&&30<(0|r)|0==(u>>>r|0)){a=(0|f)*(u>>>0);break}if((0|(B=((0|(A=(0|i)/-2|0))<0)<<31>>31))<(0|b)|(0|b)==(0|B)&A>>>0<Z>>>0){ar[(V=8708)>>2]=34,a=17976931348623157e292*(0|f)*17976931348623157e292;break}if((0|b)<(0|(B=((0|(A=i+-106|0))<0)<<31>>31))|(0|b)==(0|B)&Z>>>0<A>>>0){ar[(V=8708)>>2]=34,a=22250738585072014e-324*(0|f)*22250738585072014e-324;break}if(e){if((0|e)<9){for(u=0|ar[(s=t+(l<<2)|0)>>2];u=10*u|0,9!=(0|(e=e+1|0)););ar[s>>2]=u}l=l+1|0}if((0|g)<9&&(0|g)<=(0|Z)&(0|Z)<18){if(e=0|ar[t>>2],9==(0|Z)){a=(0|f)*(e>>>0);break}if((0|Z)<9){a=(0|f)*(e>>>0)/(0|ar[12356+(8-Z<<2)>>2]);break}if(30<(0|(A=r+27+(0|sr(Z,-3))|0))|0==(e>>>A|0)){a=(0|f)*(e>>>0)*(0|ar[12356+(Z+-10<<2)>>2]);break}}if(e=(0|Z)%9|0){if(d=0|ar[12356+(8-(g=-1<(0|Z)?e:e+9|0)<<2)>>2],l){for(k=1e9/(0|d)|0,u=Z,e=b=s=0;A=(((B=0|ar[(I=t+(e<<2)|0)>>2])>>>0)/(d>>>0)|0)+s|0,ar[I>>2]=A,s=0|sr(k,(B>>>0)%(d>>>0)|0),u=(A=(0|e)==(0|b)&0==(0|A))?u+-9|0:u,b=A?b+1&127:b,(0|(e=e+1|0))!=(0|l););s?(ar[t+(l<<2)>>2]=s,s=b,l=l+1|0):s=b}else l=s=0,u=Z;Z=9-g+u|(e=0)}else s=e=0;A:for(;;){for(g=(0|Z)<18,m=18==(0|Z),p=t+(s<<2)|0;;){if(!g){if(!m){u=Z;break A}if(9007199<=(0|ar[p>>2])>>>0){u=18;break A}}for(l=(y=l)+127|(u=0);l=0|vu(0|(l=0|Iu(0|ar[(d=t+((b=127&l)<<2)|0)>>2],0,29)),0|D,0|u,0),0<(u=D)>>>0|0==(0|u)&1e9<l>>>0?(k=0|yu(0|l,0|u,1e9,0),l=0|Zu(0|l,0|u,1e9,0)):k=0,y=0==(0|(ar[d>>2]=l))&(1^((0|b)!=(y+127&127|0)|(A=(0|b)==(0|s))))?b:y,!A;)u=k,l=b+-1|0;if(e=e+-29|0,0|k)break;l=y}l=y+127&127,u=t+((y+126&127)<<2)|0,(0|(s=s+127&127))==(0|y)?ar[u>>2]=ar[u>>2]|ar[t+(l<<2)>>2]:l=y,ar[t+(s<<2)>>2]=k,Z=Z+9|0}A:for(;;){for(p=l+1&127,y=t+((l+127&127)<<2)|0;;){for(k=18==(0|u),m=27<(0|u)?9:1,Z=s;;){for(s=0;;){if((0|(b=s+Z&127))==(0|l)){E=2,C=88;break}if((b=0|ar[t+(b<<2)>>2])>>>0<(d=0|ar[12388+(s<<2)>>2])>>>0){E=2,C=88;break}if(d>>>0<b>>>0)break;if(2<=(0|(s=s+1|0))){E=s,C=88;break}}if(88==(0|C)&&k&2==((C=0)|E)){b=a=0;break A}if(e=m+e|0,(0|Z)!=(0|l))break;Z=l}for(k=(1<<m)-1|0,g=1e9>>>m,d=0,b=s=Z;A=((B=0|ar[(I=t+(b<<2)|0)>>2])>>>m)+d|0,ar[I>>2]=A,d=0|sr(B&k,g),u=(A=(0|b)==(0|s)&0==(0|A))?u+-9|0:u,s=A?s+1&127:s,(0|(b=b+1&127))!=(0|l););if(d){if((0|p)!=(0|s))break;ar[y>>2]=1|ar[y>>2]}}ar[t+(l<<2)>>2]=d,l=p}for(;u=l+1&127,(0|(s=b+Z&127))==(0|l)&&(ar[t+(u+-1<<2)>>2]=0,l=u),a=1e9*a+ +((0|ar[t+(s<<2)>>2])>>>0),2!=(0|(b=b+1|0)););if(c=(v=+(0|f))*a,h=(0|(s=(k=(0|(d=(b=e+53|0)-i|0))<(0|r))?0<(0|d)?d:0:r))<53?(w=+Dr(+Jr(1,105-s|0),c))+(c-(a=h=+Qr(c,+Jr(1,53-s|0)))):(a=w=0,c),(0|(u=Z+2&127))!=(0|l)){u=0|ar[t+(u<<2)>>2];do{if(5e8<=u>>>0){if(5e8!=(0|u)){a=.75*v+a;break}if((Z+3&127|0)==(0|l)){a=.5*v+a;break}a=.75*v+a;break}if(0==(0|u)&&(Z+3&127|0)==(0|l))break;a=.25*v+a}while(0);c=1<(53-s|0)&&0==+Qr(a,1)?a+1:a}else c=a;a=h+c-w;do{if((-2-G|0)<(2147483647&b|0)){if(a=(G=!(9007199254740992<=+X(+a)))?a:.5*a,((e=(1&(1^G))+e|0)+50|0)<=(0|V)&&!(0!=c&k&((0|s)!=(0|d)|G)))break;ar[(V=8708)>>2]=34}}while(0);a=+Tr(a,e)}}while(0);return ur=o,+a}function Yr(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0;switch(0|(i=(i=0|ar[(a=(A|=0)+4|0)>>2])>>>0<(0|ar[(r=A+100|0)>>2])>>>0?(ar[a>>2]=i+1,0|cr[i>>0]):0|Ya(A))){case 43:case 45:f=45==(0|i)&1,0!=(0|e)&9<((i=(i=0|ar[a>>2])>>>0<(0|ar[r>>2])>>>0?(ar[a>>2]=i+1,0|cr[i>>0]):0|Ya(A))+-48|0)>>>0&&0!=(0|ar[r>>2])&&(ar[a>>2]=(0|ar[a>>2])-1);break;default:f=0}if(9<(i+-48|0)>>>0)i=(f=(0|ar[r>>2]&&(ar[a>>2]=(0|ar[a>>2])-1),-2147483648),0);else{for(n=0;n=i+-48+(10*n|0)|0,((i=(i=0|ar[a>>2])>>>0<(0|ar[r>>2])>>>0?(ar[a>>2]=i+1,0|cr[i>>0]):0|Ya(A))+-48|0)>>>0<10&(0|n)<214748364;);if(e=((0|n)<0)<<31>>31,(i+-48|0)>>>0<10){for(;e=0|wu(0|n,0|e,10,0),n=D,i=0|vu(0|i,((0|i)<0)<<31>>31|0,-48,-1),n=0|vu(0|i,0|D,0|e,0|n),e=D,((i=(i=0|ar[a>>2])>>>0<(0|ar[r>>2])>>>0?(ar[a>>2]=i+1,0|cr[i>>0]):0|Ya(A))+-48|0)>>>0<10&((0|e)<21474836|21474836==(0|e)&n>>>0<2061584302););t=i,o=n}else t=i,o=n;if(i=0|ar[r>>2],(t+-48|0)>>>0<10)for(;(n=0|ar[a>>2])>>>0<i>>>0?(ar[a>>2]=n+1,n=0|cr[n>>0]):(n=0|Ya(A),i=0|ar[r>>2]),(n+-48|0)>>>0<10;);0|i&&(ar[a>>2]=(0|ar[a>>2])-1),i=0|gu(0,0,0|o,0|e),f=(a=0!=(0|f))?D:e,i=a?i:o}return D=f,0|i}function Jr(A,e){A=+A;var r=0,i=0;return(0|(e|=0))<=1023?(0|e)<-1022&&(A*=22250738585072014e-324,r=e+1022|0,e=e+2044|0,A=(i=(0|r)<-1022)?22250738585072014e-324*A:A,e=i?-1022<(0|e)?e:-1022:r):(A*=898846567431158e293,i=e+-1023|0,e=e+-2046|0,A=(r=1023<(0|i))?898846567431158e293*A:A,e=r?(0|e)<1023?e:1023:i),r=0|Iu(e+1023|0,0,52),i=D,ar[d>>2]=r,ar[d+4>>2]=i,+(A*J[d>>3])}function Dr(A,e){return+ +function(A,e){A=+A,e=+e;var r,i=0;return J[d>>3]=A,r=0|ar[d>>2],i=0|ar[d+4>>2],J[d>>3]=e,i=-2147483648&ar[d+4>>2]|2147483647&i,ar[d>>2]=r,ar[d+4>>2]=i,+ +J[d>>3]}(A=+A,e=+e)}function Qr(A,e){return+ +function(A,e){A=+A,e=+e;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;J[d>>3]=A,o=0|ar[d>>2],c=0|ar[d+4>>2],J[d>>3]=e,u=0|ar[d>>2],s=0|ar[d+4>>2],f=2047&(f=0|Wu(0|o,0|c,52)),l=2047&(l=0|Wu(0|u,0|s,52)),r=-2147483648&c,t=0|Iu(0|u,0|s,1),a=D;A:do{if(0==(0|t)&0==(0|a)||(n=0|Mr(e),i=2147483647&D,2047==(0|f)|2146435072<i>>>0|2146435072==(0|i)&0<n>>>0))b=3;else{if(i=0|Iu(0|o,0|c,1),!(a>>>0<(n=D)>>>0|(0|n)==(0|a)&t>>>0<i>>>0))return+((0|i)==(0|t)&(0|n)==(0|a)?0*A:A);if(f)t=1048575&c|1048576;else{if(i=0|Iu(0|o,0|c,12),-1<(0|(n=D))|-1==(0|n)&4294967295<i>>>0)for(f=0;f=f+-1|0,i=0|Iu(0|i,0|n,1),-1<(0|(n=D))|-1==(0|n)&4294967295<i>>>0;);else f=0;o=0|Iu(0|o,0|c,1-f|0),t=D}if(l)c=1048575&s|1048576;else{if(n=0|Iu(0|u,0|s,12),-1<(0|(a=D))|-1==(0|a)&4294967295<n>>>0)for(i=0;i=i+-1|0,n=0|Iu(0|n,0|a,1),-1<(0|(a=D))|-1==(0|a)&4294967295<n>>>0;);else i=0;u=0|Iu(0|u,0|s,1-i|0),l=i,c=D}n=0|gu(0|o,0|t,0|u,0|c),a=-1<(0|(i=D))|-1==(0|i)&4294967295<n>>>0;e:do{if((0|l)<(0|f)){for(;;){if(a){if(0==(0|n)&0==(0|i))break}else n=o,i=t;if(o=0|Iu(0|n,0|i,1),n=0|gu(0|o,0|(t=D),0|u,0|c),a=-1<(0|(i=D))|-1==(0|i)&4294967295<n>>>0,(0|(f=f+-1|0))<=(0|l))break e}e=0*A;break A}}while(0);if(a){if(0==(0|n)&0==(0|i)){e=0*A;break}}else i=t,n=o;if(i>>>0<1048576|1048576==(0|i)&n>>>0<0)for(;n=0|Iu(0|n,0|i,1),f=f+-1|0,(i=D)>>>0<1048576|1048576==(0|i)&n>>>0<0;);0<(0|f)?(s=0|vu(0|n,0|i,0,-1048576),i=D,f=0|Iu(0|f,0,52),i|=D,f|=s):(f=0|Wu(0|n,0|i,1-f|0),i=D),ar[d>>2]=f,ar[d+4>>2]=i|r,e=+J[d>>3]}}while(0);3==(0|b)&&(e*=A,e/=e);return+e}(A=+A,e=+e)}function Tr(A,e){return+ +Jr(A=+A,e|=0)}function Mr(A){A=+A;var e;return J[d>>3]=A,e=0|ar[d>>2],D=0|ar[d+4>>2],0|e}function Sr(A,e,r,i){A|=0,i|=0;var f,n=0;return f=0|sr(r|=0,e|=0),r=0==(0|e)?0:r,-1<(0|ar[i+76>>2])?(n=0==(0|da()),A=0|Va(A,f,i),n||ka()):A=0|Va(A,f,i),(0|A)!=(0|f)&&(r=(A>>>0)/(e>>>0)|0),0|r}function Ur(A,e){A|=0;var r,i,f,n=0,t=0,o=0,a=0;r=ur=(f=ur)+31&-32,ur=ur+16|0,i=255&(e|=0),tr[r>>0]=i,(o=0|ar[(t=A+16|0)>>2])?a=4:0|Xa(A)?n=-1:(o=0|ar[t>>2],a=4);do{if(4==(0|a)){if((t=0|ar[(a=A+20|0)>>2])>>>0<o>>>0&&(0|(n=255&e))!=(0|tr[A+75>>0])){ar[a>>2]=t+1,tr[t>>0]=i;break}n=1==(0|ns[63&ar[A+36>>2]](A,r,1))?0|cr[r>>0]:-1}}while(0);return ur=f,0|n}function Or(A){A|=0;var e=0,r=0;do{if(A){if((0|ar[A+76>>2])<=-1){e=0|Hr(A);break}r=0==(0|da()),e=0|Hr(A),r||ka()}else{if(e=0|ar[2222]?0|Or(0|ar[2222]):0,A=0|(B(51464),51472),A=0|ar[A>>2])for(;r=-1<(0|ar[A+76>>2])?0|da():0,(0|ar[A+20>>2])>>>0>(0|ar[A+28>>2])>>>0&&(e=0|Hr(A)|e),0|r&&ka(),0!=(0|(A=0|ar[A+56>>2])););T(51464)}}while(0);return 0|e}function Hr(A){var e,r,i=0,f=0,n=0,t=0;return r=(A|=0)+28|0,0|(A=(0|ar[(e=A+20|0)>>2])>>>0>(0|ar[r>>2])>>>0&&(ns[63&ar[A+36>>2]](A,0,0),0==(0|ar[e>>2]))?-1:((f=0|ar[(i=A+4|0)>>2])>>>0<(t=0|ar[(n=A+8|0)>>2])>>>0&&ns[63&ar[A+40>>2]](A,f-t|0,1),ar[A+16>>2]=0,ar[r>>2]=0,ar[e>>2]=0,ar[n>>2]=0,ar[i>>2]=0))}function xr(A,e,r){A|=0,e|=0,r|=0;var i,f;return f=ur=(i=ur)+31&-32,ur=ur+16|0,ar[f>>2]=r,r=0|jr(A,e,f),ur=i,0|r}function jr(A,e,r){A|=0,e|=0,r|=0;var i,f,n=0,t=0;for(i=ur=(f=ur)+31&-32,ur=ur+128|0,t=(n=i)+124|0;(0|(n=n+4|(ar[n>>2]=0)))<(0|t););return ar[32+i>>2]=37,ar[44+i>>2]=A,ar[76+i>>2]=-1,ar[84+i>>2]=A,t=0|function(A,e,r){e|=0,r|=0;var i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0;F=ur=(t=ur)+31&-32,ur=ur+288|0,i=F+8|0,f=F+17|0,F=(n=F)+16|0,R=-1<(0|ar[76+(A|=0)>>2])?0|da():0;o=0|tr[e>>0];A:do{if(o<<24>>24){Z=A+4|0,C=A+100|0,W=A+108|0,I=A+8|0,B=10+f|0,E=33+f|0,y=4+i|0,G=46+f|0,V=94+f|0,_=X=1+f|0,l=e,a=c=e=v=0;e:for(;;){r:do{if(0|Ja(255&o)){for(;0|Ja(0|cr[(o=l+1|0)>>0]);)l=o;for(Na(A,0);0!=(0|Ja(o=(o=0|ar[Z>>2])>>>0<(0|ar[C>>2])>>>0?(ar[Z>>2]=o+1,0|cr[o>>0]):0|Ya(A))););0|ar[C>>2]?(o=(0|ar[Z>>2])-1|0,ar[Z>>2]=o):o=0|ar[Z>>2],u=(0|ar[W>>2])+v+o-(0|ar[I>>2])|0}else{o=o<<24>>24==37;i:do{if(o){u=0|tr[(b=l+1|0)>>0];f:do{switch(u<<24>>24){case 37:break i;case 42:l=l+2|(p=0);break;default:if((o=(255&u)-48|0)>>>0<10&&36==(0|tr[l+2>>0])){p=0|zr(r,o),l=l+3|0;break f}l=3+(0|ar[r>>2])&-4,p=0|ar[l>>2],ar[r>>2]=l+4,l=b}}while(0);if(o=0|tr[l>>0],((u=255&o)+-48|0)>>>0<10)for(b=0;b=(10*b|0)-48+u|0,o=0|tr[(l=l+1|0)>>0],((u=255&o)+-48|0)>>>0<10;);else b=0;switch(c=(o=o<<24>>24==109)?0:c,a=o?0:a,l=o?l+1|0:l,o&=m=0!=(0|p),u=l+1|0,0|tr[l>>0]){case 104:g=104==(0|tr[u>>0]),d=g?-2:-1,l=g?l+2|0:u;break;case 108:g=108==(0|tr[u>>0]),d=g?3:1,l=g?l+2|0:u;break;case 106:d=3,l=u;break;case 116:case 122:d=1,l=u;break;case 76:d=2,l=u;break;case 110:case 112:case 67:case 83:case 91:case 99:case 115:case 88:case 71:case 70:case 69:case 65:case 103:case 102:case 101:case 97:case 120:case 117:case 111:case 105:case 100:d=0;break;default:N=137;break e}switch(h=0|cr[l>>0],h=(w=3==(47&h|0))?32|h:h,w=w?1:d,(k=255&h)<<24>>24){case 99:b=1<(0|b)?b:1;break;case 91:break;case 110:Pr(p,w,v,((0|v)<0)<<31>>31),u=v;break r;default:for(Na(A,0);0!=(0|Ja(u=(u=0|ar[Z>>2])>>>0<(0|ar[C>>2])>>>0?(ar[Z>>2]=u+1,0|cr[u>>0]):0|Ya(A))););0|ar[C>>2]?(u=(0|ar[Z>>2])-1|0,ar[Z>>2]=u):u=0|ar[Z>>2],v=(0|ar[W>>2])+v+u-(0|ar[I>>2])|0}if(Na(A,b),u=0|ar[Z>>2],d=0|ar[C>>2],u>>>0<d>>>0)ar[Z>>2]=u+1;else{if((0|Ya(A))<0){N=137;break e}d=0|ar[C>>2]}0|d&&(ar[Z>>2]=(0|ar[Z>>2])-1);f:do{switch(k<<24>>24){case 91:case 99:case 115:g=99==(0|h);n:do{if(115==(16|h))Vu(0|X,-1,256),115==((tr[f>>0]=0)|h)&&(tr[E>>0]=0,tr[B>>0]=0,tr[B+1>>0]=0,tr[B+2>>0]=0,tr[B+3>>0]=0,tr[B+4>>0]=0);else{switch(h=94==(0|tr[(u=l+1|0)>>0]),l=h?l+2|0:u,Vu(0|_,(k=1&h)|0,256),(tr[f>>0]=0)|tr[l>>0]){case 45:u=G,N=64;break;case 93:u=V,N=64;break;default:h=255&(1^k)}for(64==(0|N)&&(h=255&(1^k),tr[u>>(N=0)]=h,l=l+1|0);;){u=0|tr[l>>0];t:do{switch(u<<24>>24){case 0:N=137;break e;case 93:break n;case 45:switch((u=0|tr[(k=l+1|0)>>0])<<24>>24){case 93:case 0:u=45;break t}if((255&(l=0|tr[l+-1>>0]))<(255&u)){for(l&=255;tr[f+(l=l+1|0)>>0]=h,u=0|tr[k>>0],(0|l)<(255&u|0););l=k}else l=k}}while(0);tr[1+(255&u)+f>>0]=h,l=l+1|0}}}while(0);u=g?b+1|0:31,h=1==(0|w);n:do{if(h){if(o){if(!(a=0|qo(u<<2))){a=c=0,o=1,N=137;break e}}else a=p;ar[i>>2]=0,ar[y>>2]=0,k=u,c=0;t:for(;;){d=0==(0|a);do{o:for(;;){if(u=(u=0|ar[Z>>2])>>>0<(0|ar[C>>2])>>>0?(ar[Z>>2]=u+1,0|cr[u>>0]):0|Ya(A),!(0|tr[f+(u+1)>>0]))break t;switch(tr[F>>0]=u,0|za(n,F,1,i)){case-1:c=0,N=137;break e;case-2:break;default:break o}}d||(ar[a+(c<<2)>>2]=ar[n>>2],c=c+1|0)}while(!(o&(0|c)==(0|k)));if(!(u=0|Aa(a,(c=k<<1|1)<<2))){c=0,o=1,N=137;break e}w=k,k=c,a=u,c=w}if(!(0|La(i))){c=0,N=137;break e}u=c,c=0,k=a}else{if(o){if(!(c=0|qo(u))){a=c=0,o=1,N=137;break e}for(d=u,a=0;;){do{if(u=(u=0|ar[Z>>2])>>>0<(0|ar[C>>2])>>>0?(ar[Z>>2]=u+1,0|cr[u>>0]):0|Ya(A),!(0|tr[f+(u+1)>>0])){u=a,a=k=0;break n}tr[c+a>>0]=u,a=a+1|0}while((0|a)!=(0|d));if(!(u=0|Aa(c,a=d<<1|1))){a=0,o=1,N=137;break e}w=d,d=a,c=u,a=w}}if(p)for(u=0,c=d;;){if(a=(a=0|ar[Z>>2])>>>0<c>>>0?(ar[Z>>2]=a+1,0|cr[a>>0]):0|Ya(A),!(0|tr[f+(a+1)>>0])){c=p,a=k=0;break n}tr[p+u>>0]=a,u=u+1|0,c=0|ar[C>>2]}else for(c=d;;){if(a=(a=0|ar[Z>>2])>>>0<c>>>0?(ar[Z>>2]=a+1,0|cr[a>>0]):0|Ya(A),!(0|tr[f+(a+1)>>0])){a=k=c=u=0;break n}c=0|ar[C>>2]}}}while(0);if(0|ar[C>>2]?(d=(0|ar[Z>>2])-1|0,ar[Z>>2]=d):d=0|ar[Z>>2],!(d=d-(0|ar[I>>2])+(0|ar[W>>2])|0)){N=139;break e}if(!((0|d)==(0|b)|1^g)){N=139;break e}do{if(o){if(h){ar[p>>2]=k;break}ar[p>>2]=c;break}}while(0);if(!g){if(0|k&&(ar[k+(u<<2)>>2]=0),!c){c=0;break f}tr[c+u>>0]=0}break;case 120:case 88:case 112:u=16,N=125;break;case 111:u=8,N=125;break;case 117:case 100:u=10,N=125;break;case 105:u=0,N=125;break;case 71:case 103:case 70:case 102:case 69:case 101:case 65:case 97:if(s=+qa(A,w,0),(0|ar[W>>2])==((0|ar[I>>2])-(0|ar[Z>>2])|0)){N=139;break e}if(p)switch(0|w){case 0:Y[p>>2]=s;break f;case 1:case 2:J[p>>3]=s;break f;default:break f}}}while(0);do{if(125==(0|N)){if(u=(N=0)|Ra(A,u,0,-1,-1),(0|ar[W>>2])==((0|ar[I>>2])-(0|ar[Z>>2])|0)){N=139;break e}if(m&112==(0|h)){ar[p>>2]=u;break}Pr(p,w,u,D);break}}while(0);e=(1&m)+e|0,u=(0|ar[W>>2])+v+(0|ar[Z>>2])-(0|ar[I>>2])|0;break r}}while(0);if(l=l+(1&o)|0,Na(A,0),(0|(o=(o=0|ar[Z>>2])>>>0<(0|ar[C>>2])>>>0?(ar[Z>>2]=o+1,0|cr[o>>0]):0|Ya(A)))!=(0|cr[l>>0])){N=22;break e}u=v+1|0}}while(0);if(!((o=0|tr[(l=l+1|0)>>0])<<24>>24))break A;v=u}if(22==(0|N)){if(0|ar[C>>2]&&(ar[Z>>2]=(0|ar[Z>>2])-1),0!=(0|e)|-1<(0|o))break;o=0,N=138}else 137==(0|N)?(o&=1,e||(N=138)):139==(0|N)&&(o&=1);138==(0|N)&&(e=-1),o&&($o(c),$o(a))}else e=0}while(0);0|R&&ka();return ur=t,0|e}(i,e,r),ur=f,0|t}function zr(A,e){A|=0,e|=0;var r,i,f=0;for(r=ur=(i=ur)+31&-32,ur=ur+16|0,ar[r>>2]=ar[A>>2];f=3+(0|ar[r>>2])&-4,A=0|ar[f>>2],ar[r>>2]=f+4,1<e>>>0;)e=e+-1|0;return ur=i,0|A}function Pr(A,e,r,i){A|=0,e|=0,r|=0,i|=0;A:do{if(0|A)switch(0|e){case-2:tr[A>>0]=r;break A;case-1:or[A>>1]=r;break A;case 0:case 1:ar[A>>2]=r;break A;case 3:ar[(e=A)>>2]=r,ar[e+4>>2]=i;break A;default:break A}}while(0)}function Lr(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t=0,o=0;for(f=ur=(n=ur)+31&-32,ur=ur+128|0,o=(t=f)+124|0;(0|(t=t+4|(ar[t>>2]=0)))<(0|o););return ar[(t=4+f|0)>>2]=A,ar[(o=8+f|0)>>2]=-1,ar[44+f>>2]=A,ar[76+f>>2]=-1,Na(f,0),i=+qa(f,r,1),r=(0|ar[t>>2])-(0|ar[o>>2])+(0|ar[108+f>>2])|0,0|e&&(ar[e>>2]=0|r?A+r|0:A),ur=n,+i}function Kr(A,e){return r=A|=0,i=e|=0,+ + + +Lr(r|=0,i|=0,0);var r,i}function qr(A,e){return r=A|=0,i=e|=0,+ + + +Lr(r|=0,i|=0,1);var r,i}function $r(A,e){return r=A|=0,i=e|=0,+ + + +Lr(r|=0,i|=0,2);var r,i}function Ai(A){A|=0;var e;return e=0|ar[2208],0|A&&(ar[2208]=-1==(0|A)?51408:A),0|(51408==(0|e)?-1:e)}function ei(A,e){A|=0,e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;s=ur=(i=ur)+31&-32,ur=ur+272|0,r=s+8|0;do{if(!(0|tr[e>>0])){if(0|(e=0|wA(46229))&&0|tr[e>>0])break;if(0|(e=0|wA(46236+(12*A|0)|0))&&0|tr[e>>0])break;if(0|(e=0|wA(46308))&&0|tr[e>>0])break;e=46313}}while(0);f=0;A:do{switch(0|tr[e+f>>0]){case 47:case 0:break A}f=f+1|0}while(f>>>0<15);15==(0|(u=(n=0|tr[e>>0])<<24>>24!=46&&0==(0|tr[e+f>>0])?n<<24>>24==67?15:(l=e,16):(e=46313,15)))&&(u=0|tr[e+1>>0]?(l=e,16):18);A:do{if(16==(0|u))if(0!=(0|oa(l,46313))&&0!=(0|oa(l,46321))){if(0|(e=0|ar[12869]))do{if(!(0|oa(l,e+8|0)))break A;e=0|ar[e+24>>2]}while(0!=(0|e));B(51480),e=0|ar[12869];e:do{if(0|e){for(;0|oa(l,e+8|0);)if(!(e=0|ar[e+24>>2]))break e;T(51480);break A}}while(0);e:do{if(0==(0|ar[12844])&&0!=(0|(t=0|wA(46327)))&&0!=(0|tr[t>>0])){for(a=254-f|0,c=f+1|0,n=t;;){if((t=(o=0|ca(n,58))-n+(((e=0|tr[o>>0])<<24>>24!=0)<<31>>31)|0)>>>0<a>>>0){if(Eu(0|r,0|n,0|t),tr[(n=r+t|0)>>0]=47,Eu(n+1|0,0|l,0|f),(tr[r+(c+t)>>0]=0)|(t=0|E(0|r,0|s)))break;e=0|tr[o>>0]}if(!(0|tr[(n=o+(e<<24>>24!=0&1)|0)>>0])){u=41;break e}}if(e=0|qo(28),n=0|ar[s>>2],e){ar[e>>2]=t,ar[e+4>>2]=n,Eu(0|(s=e+8|0),0|l,0|f),tr[s+f>>0]=0,ar[e+24>>2]=ar[12869],ar[12869]=e;break}Ua(t,n),u=41;break}u=41}while(0);41==(0|u)&&(e=0|qo(28))&&(ar[e>>2]=ar[2111],ar[e+4>>2]=ar[2112],Eu(0|(s=e+8|0),0|l,0|f),tr[s+f>>0]=0,ar[e+24>>2]=ar[12869],ar[12869]=e),T(51480),e=0==(0|A)&0==(0|e)?8444:e}else e=l,u=18}while(0);do{if(18==(0|u)){if(0==(0|A)&&46==(0|tr[e+1>>0])){e=8444;break}e=0}}while(0);return ur=i,0|e}function ri(A){return 8492!=(0|(A|=0))&0!=(0|A)&51432!=(0|A)&1|0}function ii(A,e,r,i){return 0|(i|=0)}function fi(A){0|ri(A|=0)&&$o(A)}function ni(A){return((A|=0)+-48|0)>>>0<10|0}function ti(){return-1}function oi(A){return 0|(e=A|=0,1&(((e|=0)-48|0)>>>0<10|((32|e)-97|0)>>>0<6)|0);var e}function ai(A,e){A|=0,e|=0;var r=0,i=0,f=0,n=0,t=0;do{if(-1!=(0|A)){if(f=-1<(0|ar[e+76>>2])?0|da():0,(r=0|ar[(n=e+4|0)>>2])?(i=r,r=0!=(0|f),t=7):(Qa(e),r=0!=(0|f),(i=0|ar[n>>2])?t=7:A=r),7==(0|t)){if(i>>>0>((0|ar[e+44>>2])-8|0)>>>0){if(t=i+-1|0,ar[n>>2]=t,tr[t>>0]=A,ar[e>>2]=-17&ar[e>>2],!r)break;ka();break}A=r}A=(A&&ka(),-1)}else A=-1}while(0);return 0|A}function ci(A){li(A|=0)}function li(A){ar[(A|=0)>>2]=12404,function(A,e){e|=0;var r,i,f=0,n=0;r=32+(A|=0)|0,i=A+36|0,f=0|ar[A+40>>2];for(;f;)n=f+-1|0,hs[127&ar[(0|ar[r>>2])+(n<<2)>>2]](e,A,0|ar[(0|ar[i>>2])+(n<<2)>>2]),f=n}(A,0),df(A+28|0),$o(0|ar[A+32>>2]),$o(0|ar[A+36>>2]),$o(0|ar[A+48>>2]),$o(0|ar[A+60>>2])}function ui(A){li(A|=0)}function si(A){ar[(A|=0)>>2]=12420,df(A+4|0)}function bi(A){return 255&(A|=0)|0}function di(A,e,r){return A|=0,e|=0,0|(r|=0)&&Eu(0|A,0|e,0|r),0|A}function ki(A){return 255&(A|=0)|0}function hi(A){ar[(A|=0)>>2]=12484,df(A+4|0)}function wi(A){return 0|(A|=0)}function vi(A,e,r){return A|=0,e|=0,(r|=0)&&function(A,e,r){A|=0,e|=0;var i=0;if(0|(r|=0))for(i=A;r=r+-1|0,ar[i>>2]=ar[e>>2],r;)e=e+4|0,i=i+4|0}(A,e,r),0|A}function gi(A){return 0|(A|=0)}function mi(A){yi(A|=0),ci(A+8|0)}function pi(A){mi(A|=0),Vl(A)}function yi(){}function Zi(A){ui((A|=0)+8|0)}function Ci(A){Zi(A|=0),Vl(A)}function Wi(A){Bi(A|=0),ci(A+4|0)}function Ii(A){Wi(A|=0),Vl(A)}function Bi(){}function Ei(A){ui((A|=0)+4|0)}function Gi(A){Ei(A|=0),Vl(A)}function Vi(A){_i(A|=0),ci(A+12|0)}function Xi(A){Vi(A|=0),Vl(A)}function _i(){}function Fi(A){return 0|ta(A|=0)}function Ni(A,e){e|=0,tr[(A|=0)>>0]=0|tr[e>>0]}function Ri(A,e){e|=0,ar[(A|=0)+16>>2]=0==(0|ar[A+24>>2])|e}function Yi(A,e){e|=0;var r;for(ar[(A|=0)+24>>2]=e,ar[A+16>>2]=0==(0|e)&1,ar[A+20>>2]=0,ar[A+4>>2]=4098,ar[A+12>>2]=0,ar[A+8>>2]=6,r=A+28|0,A=(e=A+32|0)+40|0;(0|(e=e+4|(ar[e>>2]=0)))<(0|A););hl(r)}function Ji(A,e){return(0|(A|=0))==(0|(e|=0))|0}function Di(A,e){dl(A|=0,(e|=0)+28|0)}function Qi(A,e){return(0|(A|=0))==(0|(e|=0))|0}function Ti(A){ar[(A|=0)>>2]=12420,hl(A+4|0),ar[(A=A+8|0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,ar[A+12>>2]=0,ar[A+16>>2]=0,ar[A+20>>2]=0}function Mi(A){ar[(A|=0)>>2]=12484,hl(A+4|0),ar[(A=A+8|0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,ar[A+12>>2]=0,ar[A+16>>2]=0,ar[A+20>>2]=0}function Si(A,e,r){r|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;if(o=ur=(i=ur)+31&-32,ur=ur+16|0,f=(e|=0)+((tr[(A|=0)>>0]=0)|ar[(0|ar[e>>2])-12>>2])|0,n=0|ar[f+16>>2])Ri(f,4|n);else{0|(f=0|ar[f+72>>2])&&Ui(f);do{if(!r&&(t=e+(0|ar[(0|ar[e>>2])-12>>2])|0,4096&ar[t+4>>2]|0)){for(Di(o,t),c=0|bf(o,52536),df(o),c=c+8|0,u=0==(0|(l=f=0|ar[e+(0|ar[(0|ar[e>>2])-12>>2])+24>>2])),s=l+12|0,b=l+16|0,d=f;;){if(u){f=t=0;break}if(r=(a=0|Ji(n=(0|(n=0|ar[s>>2]))==(0|ar[b>>2])?0|is[127&ar[36+(0|ar[d>>2])>>2]](l):0|bi(0|tr[n>>0]),-1))?0:f,a){f=t=0;break}if((255&(n=(0|(n=0|ar[(o=(t=r)+12|0)>>2]))==(0|ar[(a=t+16|0)>>2])?0|is[127&ar[36+(0|ar[r>>2])>>2]](t):0|bi(0|tr[n>>0])))<<24>>24<=-1)break;if(!(8192&or[(0|ar[c>>2])+(n<<24>>24<<1)>>1]))break;(0|(n=0|ar[o>>2]))!=(0|ar[a>>2])?(ar[o>>2]=n+1,bi(0|tr[n>>0])):is[127&ar[40+(0|ar[r>>2])>>2]](t)}if(0|f&&!(0|Ji(f=(0|(n=0|ar[t+12>>2]))==(0|ar[t+16>>2])?0|is[127&ar[36+(0|ar[f>>2])>>2]](t):0|bi(0|tr[n>>0]),-1)))break;Ri(d=e+(0|ar[(0|ar[e>>2])-12>>2])|0,6|ar[d+16>>2])}}while(0);tr[A>>0]=0==(0|ar[e+(0|ar[(0|ar[e>>2])-12>>2])+16>>2])&1}ur=i}function Ui(A){var e,r,i=0;return e=ur=(r=ur)+31&-32,ur=ur+16|0,0|ar[(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])+24>>2]&&(Oi(e,A),0|tr[e>>0]&&(i=0|ar[A+(0|ar[(0|ar[A>>2])-12>>2])+24>>2],-1==(0|is[127&ar[24+(0|ar[i>>2])>>2]](i)))&&Ri(i=A+(0|ar[(0|ar[A>>2])-12>>2])|0,1|ar[i+16>>2]),Hi(e)),ur=r,0|A}function Oi(A,e){e|=0,tr[(A|=0)>>0]=0,e=(ar[A+4>>2]=e)+(0|ar[(0|ar[e>>2])-12>>2])|0,0|ar[e+16>>2]||(0|(e=0|ar[e+72>>2])&&Ui(e),tr[A>>0]=1)}function Hi(A){var e=0;e=(e=0|ar[(A=(A|=0)+4|0)>>2])+(0|ar[(0|ar[e>>2])-12>>2])|0,0|ar[e+24>>2]&&0==(0|ar[e+16>>2])&&8192&ar[e+4>>2]|0&&!(0|Z())&&(e=0|ar[A>>2],e=0|ar[e+(0|ar[(0|ar[e>>2])-12>>2])+24>>2],-1==(0|is[127&ar[24+(0|ar[e>>2])>>2]](e)))&&Ri(e=(e=0|ar[A>>2])+(0|ar[(0|ar[e>>2])-12>>2])|0,1|ar[e+16>>2])}function xi(A){var e,r=0,i=0,f=0,n=0;f=ur=(e=ur)+31&-32,ur=ur+16|0,ar[(n=(A|=0)+4|0)>>2]=0,r=-1,Si(f,A,1);do{if(0|tr[f>>0]){if(r=0|ar[A+(0|ar[(0|ar[A>>2])-12>>2])+24>>2],0|Ji(r=(0|(f=0|ar[(i=r+12|0)>>2]))==(0|ar[r+16>>2])?0|is[127&ar[40+(0|ar[r>>2])>>2]](r):(ar[i>>2]=f+1,0|bi(0|tr[f>>0])),-1)){Ri(n=A+(0|ar[(0|ar[A>>2])-12>>2])|0,6|ar[n+16>>2]);break}ar[n>>2]=1;break}}while(0);return ur=e,0|r}function ji(A,e,r){e|=0,r|=0;var i,f,n,t=0;return t=ur=(n=ur)+31&-32,ur=ur+16|0,ar[(f=(A|=0)+4|0)>>2]=0,Si(t,A,1),i=A+(0|ar[(0|ar[A>>2])-12>>2])|0,0|tr[t>>0]?(t=0|ar[24+i>>2],t=0|ns[63&ar[32+(0|ar[t>>2])>>2]](t,e,r),(0|(ar[f>>2]=t))!=(0|r)&&Ri(t=A+(0|ar[(0|ar[A>>2])-12>>2])|0,6|ar[t+16>>2])):Ri(i,4|ar[16+i>>2]),ur=n,0|A}function zi(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o=0;return f=ur=(n=ur)+31&-32,ur=ur+32|0,t=16+f|0,Ri(o=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,-3&ar[o+16>>2]),Si(t,A,1),0|tr[t>>0]&&(o=0|ar[A+(0|ar[(0|ar[A>>2])-12>>2])+24>>2],gs[15&ar[16+(0|ar[o>>2])>>2]](f,o,e,r,i,8),-1==(0|ar[(o=8+f|0)>>2])&&-1==(0|ar[o+4>>2]))&&Ri(o=A+(0|ar[(0|ar[A>>2])-12>>2])|0,4|ar[o+16>>2]),ur=n,0|A}function Pi(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0;return f=ur=(n=ur)+31&-32,ur=ur+16|0,r=12+f|0,i=8+f|0,Oi(f,A|=0),0|tr[f>>0]&&(Di(r,A+(0|ar[(0|ar[A>>2])-12>>2])|0),o=0|bf(r,52592),df(r),a=A+(0|ar[(0|ar[A>>2])-12>>2])|0,c=0|ar[a+24>>2],t=0|Ji(l=-1,0|ar[(t=a+76|0)>>2])?(Di(r,a),l=0|bf(r,52536),l=0|fs[63&ar[28+(0|ar[l>>2])>>2]](l,32),df(r),l=l<<24>>24,ar[t>>2]=l):0|ar[t>>2],l=0|ar[12+(0|ar[o>>2])>>2],ar[i>>2]=c,ar[r>>2]=ar[i>>2],0|as[31&l](o,r,a,255&t,e)||Ri(l=A+(0|ar[(0|ar[A>>2])-12>>2])|0,5|ar[l+16>>2])),Hi(f),ur=n,0|A}function Li(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0;return f=ur=(n=ur)+31&-32,ur=ur+16|0,r=12+f|0,i=8+f|0,Oi(f,A|=0),0|tr[f>>0]&&(Di(r,A+(0|ar[(0|ar[A>>2])-12>>2])|0),o=0|bf(r,52592),df(r),a=A+(0|ar[(0|ar[A>>2])-12>>2])|0,c=0|ar[a+24>>2],t=0|Ji(l=-1,0|ar[(t=a+76|0)>>2])?(Di(r,a),l=0|bf(r,52536),l=0|fs[63&ar[28+(0|ar[l>>2])>>2]](l,32),df(r),l=l<<24>>24,ar[t>>2]=l):0|ar[t>>2],l=0|ar[24+(0|ar[o>>2])>>2],ar[i>>2]=c,ar[r>>2]=ar[i>>2],0|as[31&l](o,r,a,255&t,65535&e)||Ri(l=A+(0|ar[(0|ar[A>>2])-12>>2])|0,5|ar[l+16>>2])),Hi(f),ur=n,0|A}function Ki(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0;return f=ur=(n=ur)+31&-32,ur=ur+16|0,r=12+f|0,i=8+f|0,Oi(f,A|=0),0|tr[f>>0]&&(Di(r,A+(0|ar[(0|ar[A>>2])-12>>2])|0),o=0|bf(r,52592),df(r),a=A+(0|ar[(0|ar[A>>2])-12>>2])|0,c=0|ar[a+24>>2],t=0|Ji(l=-1,0|ar[(t=a+76|0)>>2])?(Di(r,a),l=0|bf(r,52536),l=0|fs[63&ar[28+(0|ar[l>>2])>>2]](l,32),df(r),l=l<<24>>24,ar[t>>2]=l):0|ar[t>>2],l=0|ar[16+(0|ar[o>>2])>>2],ar[i>>2]=c,ar[r>>2]=ar[i>>2],0|as[31&l](o,r,a,255&t,e)||Ri(l=A+(0|ar[(0|ar[A>>2])-12>>2])|0,5|ar[l+16>>2])),Hi(f),ur=n,0|A}function qi(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0;return f=ur=(n=ur)+31&-32,ur=ur+16|0,r=12+f|0,i=8+f|0,Oi(f,A|=0),0|tr[f>>0]&&(Di(r,A+(0|ar[(0|ar[A>>2])-12>>2])|0),o=0|bf(r,52592),df(r),a=A+(0|ar[(0|ar[A>>2])-12>>2])|0,c=0|ar[a+24>>2],t=0|Ji(l=-1,0|ar[(t=a+76|0)>>2])?(Di(r,a),l=0|bf(r,52536),l=0|fs[63&ar[28+(0|ar[l>>2])>>2]](l,32),df(r),l=l<<24>>24,ar[t>>2]=l):0|ar[t>>2],l=0|ar[24+(0|ar[o>>2])>>2],ar[i>>2]=c,ar[r>>2]=ar[i>>2],0|as[31&l](o,r,a,255&t,e)||Ri(l=A+(0|ar[(0|ar[A>>2])-12>>2])|0,5|ar[l+16>>2])),Hi(f),ur=n,0|A}function $i(A,e,r){e|=0,r|=0;var i,f,n,t,o=0,a=0,c=0,l=0,u=0;return n=ur=(t=ur)+31&-32,ur=ur+16|0,i=12+n|0,f=8+n|0,Oi(n,A|=0),0|tr[n>>0]&&(Di(i,A+(0|ar[(0|ar[A>>2])-12>>2])|0),a=0|bf(i,52592),df(i),c=A+(0|ar[(0|ar[A>>2])-12>>2])|0,l=0|ar[c+24>>2],o=0|Ji(u=-1,0|ar[(o=c+76|0)>>2])?(Di(i,c),u=0|bf(i,52536),u=0|fs[63&ar[28+(0|ar[u>>2])>>2]](u,32),df(i),u=u<<24>>24,ar[o>>2]=u):0|ar[o>>2],u=0|ar[28+(0|ar[a>>2])>>2],ar[f>>2]=l,ar[i>>2]=ar[f>>2],0|ls[63&u](a,i,c,255&o,e,r)||Ri(u=A+(0|ar[(0|ar[A>>2])-12>>2])|0,5|ar[u+16>>2])),Hi(n),ur=t,0|A}function Af(A,e,r){e|=0,r|=0;var i,f;f=ur=(i=ur)+31&-32,ur=ur+16|0,Ti(A|=0),ar[A>>2]=12852,ar[A+32>>2]=e,dl(f,A+4|0),e=0|bf(f,54328),df(f),ar[A+36>>2]=e,ar[A+40>>2]=r,r=1&(0|is[127&ar[28+(0|ar[e>>2])>>2]](e)),tr[A+44>>0]=r,ur=i}function ef(A,e,r){e|=0,r|=0;var i,f;f=ur=(i=ur)+31&-32,ur=ur+16|0,Mi(A|=0),ar[A>>2]=12788,ar[A+32>>2]=e,dl(f,A+4|0),e=0|bf(f,54336),df(f),ar[A+36>>2]=e,ar[A+40>>2]=r,r=1&(0|is[127&ar[28+(0|ar[e>>2])>>2]](e)),tr[A+44>>0]=r,ur=i}function rf(A){hi(A|=0)}function ff(A){si(A|=0)}function nf(A){hi(A|=0)}function tf(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(i=ur=(t=ur)+31&-32,ur=ur+32|0,f=16+i|0,k=8+i|0,r=4+i|0,n=(A|=0)+48|0,0|tr[(a=A+52|0)>>0])o=0|ar[n>>2],e&&(k=-1,ar[n>>2]=k,tr[a>>0]=0);else{for(o=1<(0|(o=0|ar[A+44>>2]))?o:1,d=A+32|0,a=0;;){if((0|o)<=(0|a)){b=9;break}if(-1==(0|(c=0|Ha(0|ar[d>>2])))){b=8;break}tr[f+a>>0]=c,a=a+1|0}if(8==(0|b))o=-1;else if(9==(0|b)){do{if(0|tr[A+53>>0])ar[k>>2]=tr[f>>0],b=19;else{s=A+40|0,l=A+36|0,u=k+4|0;A:for(;;){switch(h=0|ar[s>>2],a=0|ar[(c=h)>>2],c=0|ar[c+4>>2],w=0|ar[l>>2],A=f+o|0,0|ss[15&ar[16+(0|ar[w>>2])>>2]](w,h,f,A,r,k,u,i)){case 3:b=16;break A;case 2:b=18;break A;case 1:break;default:break A}if(w=0|ar[s>>2],ar[w>>2]=a,ar[w+4>>2]=c,8==(0|o)){b=18;break}if(-1==(0|(a=0|Ha(0|ar[d>>2])))){b=18;break}tr[A>>0]=a,o=o+1|0}if(16==(0|b))ar[k>>2]=tr[f>>0];else if(18==(0|b)){o=-1;break}b=19}}while(0);A:do{if(19==(0|b)){e:do{if(!e){do{if((0|o)<=0)break e;w=0|wi(0|tr[f+(o=o+-1|0)>>0])}while(-1!=(0|ai(w,0|ar[d>>2])));o=-1;break A}w=0|wi(0|ar[k>>2]),ar[n>>2]=w}while(0);o=0|wi(0|ar[k>>2])}}while(0)}}return ur=t,0|o}function of(A){si(A|=0)}function af(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(i=ur=(t=ur)+31&-32,ur=ur+32|0,f=16+i|0,k=8+i|0,r=4+i|0,n=(A|=0)+48|0,0|tr[(a=A+52|0)>>0])o=0|ar[n>>2],e&&(k=-1,ar[n>>2]=k,tr[a>>0]=0);else{for(o=1<(0|(o=0|ar[A+44>>2]))?o:1,d=A+32|0,a=0;;){if((0|o)<=(0|a)){b=9;break}if(-1==(0|(c=0|Ha(0|ar[d>>2])))){b=8;break}tr[f+a>>0]=c,a=a+1|0}if(8==(0|b))o=-1;else if(9==(0|b)){do{if(0|tr[A+53>>0])tr[k>>0]=0|tr[f>>0],b=19;else{s=A+40|0,l=A+36|0,u=k+1|0;A:for(;;){switch(h=0|ar[s>>2],a=0|ar[(c=h)>>2],c=0|ar[c+4>>2],w=0|ar[l>>2],A=f+o|0,0|ss[15&ar[16+(0|ar[w>>2])>>2]](w,h,f,A,r,k,u,i)){case 3:b=16;break A;case 2:b=18;break A;case 1:break;default:break A}if(w=0|ar[s>>2],ar[w>>2]=a,ar[w+4>>2]=c,8==(0|o)){b=18;break}if(-1==(0|(a=0|Ha(0|ar[d>>2])))){b=18;break}tr[A>>0]=a,o=o+1|0}if(16==(0|b))tr[k>>0]=0|tr[f>>0];else if(18==(0|b)){o=-1;break}b=19}}while(0);A:do{if(19==(0|b)){e:do{if(!e){do{if((0|o)<=0)break e;w=0|bi(0|tr[f+(o=o+-1|0)>>0])}while(-1!=(0|ai(w,0|ar[d>>2])));o=-1;break A}w=0|bi(0|tr[k>>0]),ar[n>>2]=w}while(0);o=0|bi(0|tr[k>>0])}}while(0)}}return ur=t,0|o}function cf(A){lf(A|=0)}function lf(A){0}function uf(A){lf()}function sf(A,e){e|=0,ar[(A|=0)>>2]=ar[e>>2]}function bf(A,e){return e|=0,A=0|ar[(A|=0)>>2],0|(r=A,i=0|vf(e),i|=0,0|ar[(0|ar[8+(r|=0)>>2])+(i<<2)>>2]);var r,i}function df(A){yl(0|ar[(A|=0)>>2])}function kf(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s=0,b=0;u=(0|(l=0|ar[(i|=0)>>2]))==(0|r);do{if(u){if(!(s=(0|tr[c+24>>0])==A<<24>>24)&&(0|tr[c+25>>0])!=A<<24>>24){b=5;break}ar[i>>2]=r+1,tr[r>>0]=s?43:45,s=ar[f>>2]=0}else b=5}while(0);A:do{if(5==(0|b)){if(b=0|tr[t+11>>0],A<<24>>24==n<<24>>24&&0!=(0|(b<<24>>24<0?0|ar[t+4>>2]:255&b))){if(160<=((s=0|ar[a>>2])-o|0)){s=0;break}i=0|ar[f>>2],ar[a>>2]=s+4,ar[s>>2]=i,s=ar[f>>2]=0;break}for(t=c+26|0,n=0;;){if(s=c+n|0,26==(0|n)){s=t;break}if((0|tr[s>>0])==A<<24>>24)break;n=n+1|0}if(23<(0|(s=s-c|0)))s=-1;else{switch(n=46974+s|0,0|e){case 10:case 8:if((0|e)<=(0|s)){s=-1;break A}break;case 16:if(22<=(0|s)){if(u){s=-1;break A}if(3<=(l-r|0)){s=-1;break A}if(48!=(0|tr[l-1>>0])){s=-1;break A}s=(ar[f>>2]=0)|tr[n>>0],ar[i>>2]=1+l,tr[l>>0]=s,s=0;break A}}s=0|tr[n>>0],ar[i>>2]=1+l,tr[l>>0]=s,ar[f>>2]=1+(0|ar[f>>2]),s=0}}}while(0);return 0|s}function hf(){var A=0;return 0==(0|tr[49952])&&0|ku(49952)&&(A=0|function(A,e,r){A|=0,e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0;i=ur=(f=ur)+31&-32,ur=ur+32|0;A:do{if(0|ri(r))for(n=0;1<<n&A|0&&(a=0|ei(n,e),ar[r+(n<<2)>>2]=a),6!=(0|(n=n+1|0)););else{for(a=0==(0|r),o=t=0;t=(0!=(0|(n=a|(n=0!=(1<<o&A|0))?0|ei(o,n?e:72962):0|ar[r+(o<<2)>>2]))&1)+t|0,ar[i+(o<<2)>>2]=n,6!=(0|(o=o+1|0)););switch(0|t){case 0:r=51432;break A;case 1:if(8444!=(0|ar[i>>2]))break;r=8492;break A}}}while(0);return ur=f,0|r}(2147483647,47010,0),ar[13136]=A),0|ar[13136]}function wf(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n;return n=ur=(f=ur)+31&-32,ur=ur+16|0,ar[n>>2]=i,i=0|Ai(e),e=0|jr(A,r,n),0|i&&Ai(i),ur=f,0|e}function vf(A){A|=0;var e,r,i,f,n=0;return n=ur=(f=ur)+31&-32,ur=ur+48|0,e=n+32|0,r=n+24|0,ar[(n=(i=n)+16|0)>>2]=307,ar[n+4>>2]=0,ar[e>>2]=ar[n>>2],ar[4+e>>2]=ar[n+4>>2],function(A,e,r){A|=0,r|=0;var i;i=0|ar[(e=e|0)>>2],e=0|ar[e+4>>2],ar[A>>2]=r,ar[A+4>>2]=i,ar[A+8>>2]=e}(i,e,A),-1!=(0|ar[A>>2])&&(ar[e>>2]=i,ar[r>>2]=e,function(A,e,r){A|=0,e|=0,r|=0,_u();for(;1==(0|ar[A>>2]);)pA(54404,54376);0|ar[A>>2]?Fu():(ar[A>>2]=1,Fu(),ds[511&r](e),_u(),ar[A>>2]=-1,Fu(),Xu())}(A,r,308)),ur=f,(0|ar[A+4>>2])-1|0}function gf(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t;t=ur=(n=ur)+31&-32,ur=ur+16|0,Di(t,e|=0),e=0|bf(t,52536),ts[15&ar[32+(0|ar[e>>2])>>2]](e,46974,47006,r),r=0|bf(t,52552),e=0|is[127&ar[12+(0|ar[r>>2])>>2]](r),tr[i>>0]=e,i=0|is[127&ar[16+(0|ar[r>>2])>>2]](r),tr[f>>0]=i,ks[63&ar[20+(0|ar[r>>2])>>2]](A,r),df(t),ur=n}function mf(A,e,r,i,f,n,t,o,a,c,l,u){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,c|=0,l|=0,u|=0;var s,b=0,d=0;s=a|=0;A:do{if(A<<24>>24==n<<24>>24)a=0|tr[e>>0]?(r=(tr[e>>0]=0)|ar[f>>2],ar[f>>2]=r+1,tr[r>>0]=46,0!=(0|((f=0|tr[o+11>>0])<<24>>24<0?0|ar[o+4>>2]:255&f))&&((b=0|ar[c>>2])-s|0)<160&&(a=0|ar[l>>2],ar[c>>2]=b+4,ar[b>>2]=a),0):-1;else{if(A<<24>>24==t<<24>>24&&0|((t=0|tr[o+11>>0])<<24>>24<0?0|ar[o+4>>2]:255&t)){if(!(0|tr[e>>0])){a=-1;break}if(160<=((a=0|ar[c>>2])-s|0)){a=0;break}f=0|ar[l>>2],ar[c>>2]=a+4,ar[a>>2]=f,a=ar[l>>2]=0;break}for(n=u+32|0,b=0;;){if(a=u+b|0,32==(0|b)){a=n;break}if((0|tr[a>>0])==A<<24>>24)break;b=b+1|0}if(31<(0|(b=a-u|0)))a=-1;else switch(n=0|tr[46974+b>>0],0|b){case 24:case 25:if((0|(a=0|ar[f>>2]))!=(0|i)&&(95&tr[a+-1>>0])!=(127&tr[r>>0])){a=-1;break A}ar[f>>2]=a+1,tr[a>>0]=n,a=0;break A;case 23:case 22:tr[r>>0]=80,a=0|ar[f>>2],ar[f>>2]=a+1,tr[a>>0]=n,a=0;break A;default:if((0|(a=95&n))==(0|tr[r>>0])&&(tr[r>>0]=128|a,0|tr[e>>0])&&(tr[e>>0]=0)|((r=0|tr[o+11>>0])<<24>>24<0?0|ar[o+4>>2]:255&r)&&((d=0|ar[c>>2])-s|0)<160&&(r=0|ar[l>>2],ar[c>>2]=d+4,ar[d>>2]=r),c=0|ar[f>>2],ar[f>>2]=c+1,tr[c>>0]=n,21<(0|b)){a=0;break A}ar[l>>2]=1+(0|ar[l>>2]),a=0;break A}}}while(0);return 0|a}function pf(A,e,r){r|=0;var i,f,n=0,t=0,o=0;return i=ur=(f=ur)+31&-32,ur=ur+16|0,(0|(A|=0))==(0|(e|=0))?(ar[r>>2]=4,n=0):(t=0|ar[(t=8708)>>2],ar[8708>>2]=0,n=+$r(A,i,hf()),(A=0|ar[(A=8708)>>2])||(ar[8708>>2]=t),(0|ar[i>>2])==(0|e)?34==(0|A)&&(o=6):(n=0,o=6),6==(0|o)&&(ar[r>>2]=4)),ur=f,+n}function yf(A,e,r,i){e|=0,r|=0,i|=0;var f,n=0,t=0,o=0,a=0,c=0,l=0;f=(a=0|tr[(A|=0)+11>>0])<<24>>24<0,n=0|ar[(o=A+4|0)>>2],a&=255;do{if(0|(f?n:a)){if((0|e)!=(0|r)){for(n=r,t=e;!((n=n+-4|0)>>>0<=t>>>0);)l=0|ar[t>>2],ar[t>>2]=ar[n>>2],ar[n>>2]=l,t=t+4|0;n=0|ar[o>>2]}for(r=r+-4|0,A=(l=f?0|ar[A>>2]:A)+(f?n:a)|0,n=l;o=0<(t=0|tr[n>>0])<<24>>24&t<<24>>24!=127,!(r>>>0<=e>>>0);){if(o&&(t<<24>>24|0)!=(0|ar[e>>2])){c=10;break}e=e+4|0,n=1<(A-n|0)?n+1|0:n}if(10==(0|c)){ar[i>>2]=4;break}o&&((0|ar[r>>2])-1|0)>>>0>=t<<24>>24>>>0&&(ar[i>>2]=4)}}while(0)}function Zf(A,e,r){r|=0;var i,f,n=0,t=0,o=0;return i=ur=(f=ur)+31&-32,ur=ur+16|0,(0|(A|=0))==(0|(e|=0))?(ar[r>>2]=4,n=0):(t=0|ar[(t=8708)>>2],ar[8708>>2]=0,n=+qr(A,i,hf()),(A=0|ar[(A=8708)>>2])||(ar[8708>>2]=t),(0|ar[i>>2])==(0|e)?34==(0|A)&&(o=6):(n=0,o=6),6==(0|o)&&(ar[r>>2]=4)),ur=f,+n}function Cf(A,e,r){r|=0;var i,f,n=0,t=0,o=0;return i=ur=(f=ur)+31&-32,ur=ur+16|0,(0|(A|=0))==(0|(e|=0))?(ar[r>>2]=4,n=0):(t=0|ar[(t=8708)>>2],ar[8708>>2]=0,n=+Kr(A,i,hf()),(A=0|ar[(A=8708)>>2])||(ar[8708>>2]=t),(0|ar[i>>2])==(0|e)?34==(0|A)&&(o=6):(n=0,o=6),6==(0|o)&&(ar[r>>2]=4)),ur=f,+n}function Wf(A){switch(74&ar[(A|=0)+4>>2]){case 64:A=8;break;case 8:A=16;break;case 0:A=0;break;default:A=10}return 0|A}function If(A,e,r,i){A|=0,r|=0,i|=0;var f,n;n=ur=(f=ur)+31&-32,ur=ur+16|0,Di(n,e|=0),e=0|bf(n,52536),ts[15&ar[32+(0|ar[e>>2])>>2]](e,46974,47e3,r),r=0|bf(n,52552),e=0|is[127&ar[16+(0|ar[r>>2])>>2]](r),tr[i>>0]=e,ks[63&ar[20+(0|ar[r>>2])>>2]](A,r),df(n),ur=f}function Bf(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0,a=0;f=ur=(n=ur)+31&-32,ur=ur+16|0;do{if((0|A)==(0|e))ar[r>>2]=4,A=i=0;else{if(45==(0|tr[A>>0])){ar[r>>2]=4,A=i=0;break}o=0|ar[(o=8708)>>2],A=(ar[(t=8708)>>2]=0)|_a(A,f,i,hf()),i=D,(t=0|ar[(t=8708)>>2])||(ar[8708>>2]=o),(0|ar[f>>2])==(0|e)?34==(0|t)&&(i=A=-1,a=8):(i=A=0,a=8),8==(0|a)&&(ar[r>>2]=4)}}while(0);return D=i,ur=n,0|A}function Ef(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0;f=ur=(n=ur)+31&-32,ur=ur+16|0;do{if((0|A)==(0|e))ar[r>>2]=4,A=0;else{if(45==(0|tr[A>>0])){ar[r>>2]=4,A=0;break}o=0|ar[(o=8708)>>2],A=(ar[(t=8708)>>2]=0)|_a(A,f,i,hf()),i=D,(t=0|ar[(t=8708)>>2])||(ar[8708>>2]=o);do{if((0|ar[f>>2])==(0|e)){if(0<i>>>0|0==(0|i)&4294967295<A>>>0|34==(0|t)){ar[r>>2]=4,A=-1;break}break}ar[r>>2]=4,A=0}while(0)}}while(0);return ur=n,0|A}function Gf(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0;f=ur=(n=ur)+31&-32,ur=ur+16|0;do{if((0|A)==(0|e))ar[r>>2]=4,A=0;else{if(45==(0|tr[A>>0])){ar[r>>2]=4,A=0;break}o=0|ar[(o=8708)>>2],A=(ar[(t=8708)>>2]=0)|_a(A,f,i,hf()),i=D,(t=0|ar[(t=8708)>>2])||(ar[8708>>2]=o);do{if((0|ar[f>>2])==(0|e)){if(0<i>>>0|0==(0|i)&4294967295<A>>>0|34==(0|t)){ar[r>>2]=4,A=-1;break}break}ar[r>>2]=4,A=0}while(0)}}while(0);return ur=n,0|A}function Vf(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0;f=ur=(n=ur)+31&-32,ur=ur+16|0;do{if((0|A)==(0|e))ar[r>>2]=4,A=0;else{if(45==(0|tr[A>>0])){ar[r>>2]=4,A=0;break}o=0|ar[(o=8708)>>2],A=(ar[(t=8708)>>2]=0)|_a(A,f,i,hf()),i=D,(t=0|ar[(t=8708)>>2])||(ar[8708>>2]=o);do{if((0|ar[f>>2])==(0|e)){if(0<i>>>0|0==(0|i)&65535<A>>>0|34==(0|t)){ar[r>>2]=4,A=-1;break}A&=65535;break}ar[r>>2]=4,A=0}while(0)}}while(0);return ur=n,0|A}function Xf(A,e,r,i){r|=0,i|=0;var f,n,t=0,o=0;return f=ur=(n=ur)+31&-32,ur=ur+16|0,(0|(A|=0))==(0|(e|=0))?(ar[r>>2]=4,A=i=0):(o=0|ar[(o=8708)>>2],A=(ar[(t=8708)>>2]=0)|Ta(A,f,i,hf()),i=D,(t=0|ar[(t=8708)>>2])||(ar[8708>>2]=o),(0|ar[f>>2])==(0|e)?34==(0|t)&&(ar[r>>2]=4,A=(i=0<(0|i)|0==(0|i)&0<A>>>0)?-1:0,i=i?2147483647:-2147483648):(ar[r>>2]=4,i=A=0)),D=i,ur=n,0|A}function _f(A,e,r,i){r|=0,i|=0;var f,n,t=0,o=0;if(f=ur=(n=ur)+31&-32,ur=ur+16|0,(0|(A|=0))==(0|(e|=0)))ar[r>>2]=4,A=0;else{o=0|ar[(o=8708)>>2],A=(ar[(t=8708)>>2]=0)|Ta(A,f,i,hf()),i=D,(t=0|ar[(t=8708)>>2])||(ar[8708>>2]=o);A:do{if((0|ar[f>>2])==(0|e)){do{if(34!=(0|t)){if((0|i)<-1|-1==(0|i)&A>>>0<2147483648){ar[r>>2]=4;break}if(0<(0|i)|0==(0|i)&2147483647<A>>>0){ar[r>>2]=4,A=2147483647;break A}break A}if(ar[r>>2]=4,0<(0|i)|0==(0|i)&0<A>>>0){A=2147483647;break A}}while(0);A=-2147483648}else ar[r>>2]=4,A=0}while(0)}return ur=n,0|A}function Ff(A,e,r,i,f,n,t){A|=0,e|=0,f|=0,n|=0,t|=0;var o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;for(c=ur=(o=ur)+31&-32,ur=ur+112|0,100<(l=((i|=0)-(r|=0)|0)/12|0)>>>0?(c=0|qo(l))?m=a=c:_l():(a=c,m=0),s=r,b=a,c=0;(0|s)!=(0|i);)(u=0|tr[s+11>>0])<<24>>24<0?u=0|ar[s+4>>2]:u&=255,u?tr[b>>0]=1:(tr[b>>0]=2,l=l+-1|0,c=c+1|0),s=s+12|0,b=b+1|0;g=0,w=c;A:for(;;){c=0|ar[A>>2];do{if(c){if(0|Ji(c=(0|(u=0|ar[c+12>>2]))==(0|ar[c+16>>2])?0|is[127&ar[36+(0|ar[c>>2])>>2]](c):0|bi(0|tr[u>>0]),-1)){ar[A>>2]=0,b=1;break}b=0==(0|ar[A>>2]);break}b=1}while(0);if(c=(u=0|ar[e>>2])?0|Ji(c=(0|(c=0|ar[u+12>>2]))==(0|ar[u+16>>2])?0|is[127&ar[36+(0|ar[u>>2])>>2]](u):0|bi(0|tr[c>>0]),-1)?(u=ar[e>>2]=0,1):0:(u=0,1),s=0|ar[A>>2],!(0!=(0|l)&(b^c)))break;for(c=(0|(c=0|ar[s+12>>2]))==(0|ar[s+16>>2])?0|is[127&ar[36+(0|ar[s>>2])>>2]](s):0|bi(0|tr[c>>0]),c&=255,t||(c=0|fs[63&ar[12+(0|ar[f>>2])>>2]](f,c)),v=g+1|0,k=r,d=0,h=a;(0|k)!=(0|i);){do{if(1==(0|tr[h>>0])){if(u=(0|tr[(s=k+11|0)>>0])<0?0|ar[k>>2]:k,u=0|tr[u+g>>0],t||(u=0|fs[63&ar[12+(0|ar[f>>2])>>2]](f,u)),b=l+-1|0,c<<24>>24!=u<<24>>24){tr[h>>0]=0,u=d,s=w,l=b;break}(u=0|tr[s>>0])<<24>>24<0?u=0|ar[k+4>>2]:u&=255,(0|u)==(0|v)?(tr[h>>0]=2,s=w+(u=1)|0,l=b):(u=1,s=w)}else u=d,s=w}while(0);k=k+12|0,d=u,h=h+1|0,w=s}if(d)if(c=0|ar[A>>2],(0|(s=0|ar[(u=c+12|0)>>2]))==(0|ar[c+16>>2])?is[127&ar[40+(0|ar[c>>2])>>2]](c):(ar[u>>2]=s+1,bi(0|tr[s>>0])),1<(w+l|0)>>>0)for(s=r,b=a,c=w;;){if((0|s)==(0|i)){g=v,w=c;continue A}2==(0|tr[b>>0])&&((u=0|tr[s+11>>0])<<24>>24<0?u=0|ar[s+4>>2]:u&=255,(0|u)!=(0|v)&&(c=c+-1|(tr[b>>0]=0))),s=s+12|0,b=b+1|0}else g=v;else g=v}do{if(s){if(0|Ji(c=(0|(c=0|ar[s+12>>2]))==(0|ar[s+16>>2])?0|is[127&ar[36+(0|ar[s>>2])>>2]](s):0|bi(0|tr[c>>0]),-1)){ar[A>>2]=0,l=1;break}l=0==(0|ar[A>>2]);break}l=1}while(0);do{if(u){if(0|Ji(c=(0|(c=0|ar[u+12>>2]))==(0|ar[u+16>>2])?0|is[127&ar[36+(0|ar[u>>2])>>2]](u):0|bi(0|tr[c>>0]),-1)){ar[e>>2]=0,p=41;break}if(l)break;p=77;break}p=41}while(0);for(41==(0|p)&&l&&(p=77),77==(0|p)&&(ar[n>>2]=2|ar[n>>2]);;){if((0|r)==(0|i)){p=81;break}if(2==(0|tr[a>>0]))break;r=r+12|0,a=a+1|0}return 81==(0|p)&&(ar[n>>2]=4|ar[n>>2],r=i),$o(m),ur=o,0|r}function Nf(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s=0,b=0;u=(0|(l=0|ar[(i|=0)>>2]))==(0|r);do{if(u){if(!(s=(0|ar[c+96>>2])==(0|A))&&(0|ar[c+100>>2])!=(0|A)){b=5;break}ar[i>>2]=r+1,tr[r>>0]=s?43:45,s=ar[f>>2]=0}else b=5}while(0);A:do{if(5==(0|b)){if(b=0|tr[t+11>>0],(0|A)==(0|n)&&0!=(0|(b<<24>>24<0?0|ar[t+4>>2]:255&b))){if(160<=((s=0|ar[a>>2])-o|0)){s=0;break}i=0|ar[f>>2],ar[a>>2]=s+4,ar[s>>2]=i,s=ar[f>>2]=0;break}for(t=c+104|0,n=0;;){if(s=c+(n<<2)|0,26==(0|n)){s=t;break}if((0|ar[s>>2])==(0|A))break;n=n+1|0}if(n=(s=s-c|0)>>2,92<(0|s))s=-1;else{switch(t=46974+n|0,0|e){case 10:case 8:if((0|e)<=(0|n)){s=-1;break A}break;case 16:if(88<=(0|s)){if(u){s=-1;break A}if(3<=(l-r|0)){s=-1;break A}if(48!=(0|tr[l-1>>0])){s=-1;break A}s=(ar[f>>2]=0)|tr[t>>0],ar[i>>2]=1+l,tr[l>>0]=s,s=0;break A}}s=0|tr[t>>0],ar[i>>2]=1+l,tr[l>>0]=s,ar[f>>2]=1+(0|ar[f>>2]),s=0}}}while(0);return 0|s}function Rf(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t;t=ur=(n=ur)+31&-32,ur=ur+16|0,Di(t,e|=0),e=0|bf(t,52568),ts[15&ar[48+(0|ar[e>>2])>>2]](e,46974,47006,r),r=0|bf(t,52576),e=0|is[127&ar[12+(0|ar[r>>2])>>2]](r),ar[i>>2]=e,i=0|is[127&ar[16+(0|ar[r>>2])>>2]](r),ar[f>>2]=i,ks[63&ar[20+(0|ar[r>>2])>>2]](A,r),df(t),ur=n}function Yf(A,e,r,i,f,n,t,o,a,c,l,u){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,c|=0,l|=0,u|=0;var s,b=0,d=0;s=a|=0;A:do{if((0|A)==(0|n))a=0|tr[e>>0]?(r=(tr[e>>0]=0)|ar[f>>2],ar[f>>2]=r+1,tr[r>>0]=46,0!=(0|((f=0|tr[o+11>>0])<<24>>24<0?0|ar[o+4>>2]:255&f))&&((b=0|ar[c>>2])-s|0)<160&&(a=0|ar[l>>2],ar[c>>2]=b+4,ar[b>>2]=a),0):-1;else{if((0|A)==(0|t)&&0|((t=0|tr[o+11>>0])<<24>>24<0?0|ar[o+4>>2]:255&t)){if(!(0|tr[e>>0])){a=-1;break}if(160<=((a=0|ar[c>>2])-s|0)){a=0;break}f=0|ar[l>>2],ar[c>>2]=a+4,ar[a>>2]=f,a=ar[l>>2]=0;break}for(n=u+128|0,b=0;;){if(a=u+(b<<2)|0,32==(0|b)){a=n;break}if((0|ar[a>>2])==(0|A))break;b=b+1|0}if(a=(b=a-u|0)>>2,(0|b)<=124){switch(n=0|tr[46974+a>>0],0|a){case 24:case 25:if((0|(a=0|ar[f>>2]))!=(0|i)&&(95&tr[a+-1>>0])!=(127&tr[r>>0])){a=-1;break A}ar[f>>2]=a+1,tr[a>>0]=n,a=0;break A;case 23:case 22:tr[r>>0]=80;break;default:(0|(a=95&n))==(0|tr[r>>0])&&(tr[r>>0]=128|a,0|tr[e>>0])&&(tr[e>>0]=0)|((r=0|tr[o+11>>0])<<24>>24<0?0|ar[o+4>>2]:255&r)&&((d=0|ar[c>>2])-s|0)<160&&(r=0|ar[l>>2],ar[c>>2]=d+4,ar[d>>2]=r)}c=0|ar[f>>2],ar[f>>2]=c+1,tr[c>>0]=n,a=(84<(0|b)||(ar[l>>2]=1+(0|ar[l>>2])),0)}else a=-1}}while(0);return 0|a}function Jf(A,e,r,i){A|=0,r|=0,i|=0;var f,n;n=ur=(f=ur)+31&-32,ur=ur+16|0,Di(n,e|=0),e=0|bf(n,52568),ts[15&ar[48+(0|ar[e>>2])>>2]](e,46974,47e3,r),r=0|bf(n,52576),e=0|is[127&ar[16+(0|ar[r>>2])>>2]](r),ar[i>>2]=e,ks[63&ar[20+(0|ar[r>>2])>>2]](A,r),df(n),ur=f}function Df(A,e,r,i,f,n,t){A|=0,e|=0,f|=0,n|=0,t|=0;var o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;for(c=ur=(o=ur)+31&-32,ur=ur+112|0,100<(l=((i|=0)-(r|=0)|0)/12|0)>>>0?(c=0|qo(l))?m=a=c:_l():(a=c,m=0),c=0,s=r,b=a;(0|s)!=(0|i);)(u=0|tr[s+8+3>>0])<<24>>24<0?u=0|ar[s+4>>2]:u&=255,u?tr[b>>0]=1:(tr[b>>0]=2,c=c+1|0,l=l+-1|0),s=s+12|0,b=b+1|0;g=0,w=c;A:for(;;){c=0|ar[A>>2];do{if(c){if(0|Qi(c=(0|(u=0|ar[c+12>>2]))==(0|ar[c+16>>2])?0|is[127&ar[36+(0|ar[c>>2])>>2]](c):0|wi(0|ar[u>>2]),-1)){ar[A>>2]=0,b=1;break}b=0==(0|ar[A>>2]);break}b=1}while(0);if(c=(u=0|ar[e>>2])?0|Qi(c=(0|(c=0|ar[u+12>>2]))==(0|ar[u+16>>2])?0|is[127&ar[36+(0|ar[u>>2])>>2]](u):0|wi(0|ar[c>>2]),-1)?(u=ar[e>>2]=0,1):0:(u=0,1),s=0|ar[A>>2],!(0!=(0|l)&(b^c)))break;for(c=(0|(c=0|ar[s+12>>2]))==(0|ar[s+16>>2])?0|is[127&ar[36+(0|ar[s>>2])>>2]](s):0|wi(0|ar[c>>2]),t||(c=0|fs[63&ar[28+(0|ar[f>>2])>>2]](f,c)),v=g+1|0,k=r,d=0,h=a;(0|k)!=(0|i);){do{if(1==(0|tr[h>>0])){if(u=(0|tr[(s=k+8+3|0)>>0])<0?0|ar[k>>2]:k,u=0|ar[u+(g<<2)>>2],t||(u=0|fs[63&ar[28+(0|ar[f>>2])>>2]](f,u)),b=l+-1|0,(0|c)!=(0|u)){tr[h>>0]=0,u=d,s=w,l=b;break}(u=0|tr[s>>0])<<24>>24<0?u=0|ar[k+4>>2]:u&=255,(0|u)==(0|v)?(tr[h>>0]=2,s=w+(u=1)|0,l=b):(u=1,s=w)}else u=d,s=w}while(0);k=k+12|0,d=u,h=h+1|0,w=s}if(d)if(c=0|ar[A>>2],(0|(s=0|ar[(u=c+12|0)>>2]))==(0|ar[c+16>>2])?is[127&ar[40+(0|ar[c>>2])>>2]](c):(ar[u>>2]=s+4,wi(0|ar[s>>2])),1<(w+l|0)>>>0)for(s=r,b=a,c=w;;){if((0|s)==(0|i)){g=v,w=c;continue A}2==(0|tr[b>>0])&&((u=0|tr[s+8+3>>0])<<24>>24<0?u=0|ar[s+4>>2]:u&=255,(0|u)!=(0|v)&&(c=c+-1|(tr[b>>0]=0))),s=s+12|0,b=b+1|0}else g=v;else g=v}do{if(s){if(0|Qi(c=(0|(c=0|ar[s+12>>2]))==(0|ar[s+16>>2])?0|is[127&ar[36+(0|ar[s>>2])>>2]](s):0|wi(0|ar[c>>2]),-1)){ar[A>>2]=0,l=1;break}l=0==(0|ar[A>>2]);break}l=1}while(0);do{if(u){if(0|Qi(c=(0|(c=0|ar[u+12>>2]))==(0|ar[u+16>>2])?0|is[127&ar[36+(0|ar[u>>2])>>2]](u):0|wi(0|ar[c>>2]),-1)){ar[e>>2]=0,p=41;break}if(l)break;p=77;break}p=41}while(0);for(41==(0|p)&&l&&(p=77),77==(0|p)&&(ar[n>>2]=2|ar[n>>2]);;){if((0|r)==(0|i)){p=81;break}if(2==(0|tr[a>>0]))break;r=r+12|0,a=a+1|0}return 81==(0|p)&&(ar[n>>2]=4|ar[n>>2],r=i),$o(m),ur=o,0|r}function Qf(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t;return t=ur=(n=ur)+31&-32,ur=ur+16|0,ar[t>>2]=f,f=0|Ai(r),r=0|ua(A,e,i,t),0|f&&Ai(f),ur=n,0|r}function Tf(A,e,r){A|=0,e|=0,r|=0;var i=0;A:do{switch((176&ar[r+4>>2])<<24>>24){case 16:switch(i=A+1|0,(r=0|tr[A>>0])<<24>>24){case 43:case 45:A=i;break A}if(1<(e-A|0)&r<<24>>24==48){switch(0|tr[i>>0]){case 88:case 120:break;default:0;break A}A=A+2|0}else 0;break;case 32:A=e;break;default:0}}while(0);return 0|A}function Mf(A,e,r){A|=0,e|=0;var i,f,n,t=0;for(2048&(r|=0)&&(tr[A>>0]=43,A=A+1|0),1024&r&&(tr[A>>0]=35,A=A+1|0),i=0!=(16384&r|0),(f=260==(0|(n=260&r)))?t=0:(tr[A>>0]=46,tr[A+1>>0]=42,t=1,A=A+2|0);(r=0|tr[e>>0])<<24>>24;)tr[A>>0]=r,e=e+1|0,A=A+1|0;A:do{switch(511&n){case 4:r=i?70:102;break;case 256:r=i?69:101;break;default:if(f){r=i?65:97;break A}r=i?71:103;break A}}while(0);return tr[A>>0]=r,0|t}function Sf(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n;return n=ur=(f=ur)+31&-32,ur=ur+16|0,ar[n>>2]=i,i=0|Ai(e),e=0|function(A,e,r){A|=0,e|=0,r|=0;var i,f=0,n=0,t=0;return f=ur=(i=ur)+31&-32,ur=ur+16|0,ar[f>>2]=ar[r>>2],A=0<=(0|(f=0|ua(0,0,e,f)))&&(t=0|qo(n=f+1|0),0!=(0|(ar[A>>2]=t)))?0|ua(t,n,e,r):-1,ur=i,0|A}(A,r,n),0|i&&Ai(i),ur=f,0|e}function Uf(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0;if(ur=(o=ur)+160|0,l=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,Of(t,l),(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2]),0<(0|ar[r>>2]))for(c=0;Hf(f,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(s=0|Hf(f,16983,5),xf(l,e),Hf(0|Hf(s,(u=(a=0|tr[(c=l+11|0)>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[l+4>>2]:255&a),16989,7),(0|tr[c>>0])<0&&Vl(0|ar[l>>2]),0<(0|ar[r>>2]))for(c=0;Hf(f,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(u=0|Hf(f,16997,6),s=0|Hf(0|$i(u,0|ar[(s=e+8|0)>>2],0|ar[s+4>>2]),17004,17),Hf(0|qi(s,0|ar[e+16>>2]),17022,2),0|tr[e+36>>0]){if(0<(0|ar[r>>2]))for(c=0;Hf(f,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(l=0|Hf(f,17025,9),l=0|Hf(0|Ki(l,0|cr[e+37>>0]),26620,1),0<(0|ar[r>>2]))for(c=0;Hf(l,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););u=(s=0|Hf(l,17035,7))+(0|ar[(0|ar[s>>2])-12>>2])+4|0,ar[u>>2]=-75&ar[u>>2]|8,Hf(0|qi(s,0|ar[e+40>>2]),26620,1)}if(jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o}function Of(A,e){var r,i,f=0,n=0,t=0,o=0;Jl(r=(A|=0)+32|0,e|=0),8&(t=(ar[(o=A+44|0)>>2]=0)|ar[(i=A+48|0)>>2])|0&&(e=(e=0|tr[11+r>>0])<<24>>24<0?(n=f=e=0|ar[r>>2])+(0|ar[A+36>>2])|0:(n=f=r)+(255&e)|0,ar[o>>2]=e,ar[A+8>>2]=f,ar[A+12>>2]=n,ar[A+16>>2]=e),16&t&&(o=(e=(e=0|tr[(f=11+r|0)>>0])<<24>>24<0?(t=0|ar[A+36>>2],ar[o>>2]=(0|ar[r>>2])+t,(2147483647&ar[A+40>>2])-1|0):(t=255&e,ar[o>>2]=r+t,10),t),Ul(r,e,0),(e=0|tr[f>>0])<<24>>24<0?(t=f=0|ar[r>>2],n=0|ar[A+36>>2]):(n=255&e,f=t=r),ar[(e=A+24|0)>>2]=f,ar[A+20>>2]=f,ar[A+28>>2]=t+n,3&ar[i>>2]&&(ar[e>>2]=f+o))}function Hf(A,e,r){e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0;return ur=(a=ur)+16|0,n=a+12|0,l=(o=a)+8|0,Oi(o,A|=0),0|tr[o>>0]?(c=(0|ar[A>>2])-12|0,ar[l>>2]=ar[A+(0|ar[c>>2])+24>>2],c=A+(0|ar[c>>2])|0,t=0|ar[c+4>>2],f=e+r|0,-1==(0|(r=0|ar[(i=c+76|0)>>2]))&&(Di(n,c),r=0|bf(n,52536),r=0|fs[63&ar[28+(0|ar[r>>2])>>2]](r,32),df(n),r=r<<24>>24,ar[i>>2]=r),ar[n>>2]=ar[l>>2],ur=(0|zf(n,e,32==(176&t|0)?f:e,f,c,255&r)||Ri(l=A+(0|ar[(0|ar[A>>2])-12>>2])|0,5|ar[l+16>>2]),Hi(o),a),0|A):(Hi(o),ur=a,0|A)}function xf(A,e){A|=0;var r,i,f,n,t,o,a=0;if(ur=(o=ur)+160|0,n=o+136|0,t=o,1970628964!=(0|(a=0|ar[(e|=0)+20>>2])))return ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,tr[A+11>>0]=4,tr[A+4>>0]=0,tr[A>>0]=a>>>24,tr[A+1>>0]=a>>>16,tr[A+2>>0]=a>>>8,tr[A+3>>0]=a,void(ur=o);for(i=t+56|0,f=t+4|0,ar[t>>2]=268,ar[i>>2]=288,Yi(t+56|0,f),ar[t+128>>2]=0,ar[t+132>>2]=-1,ar[t>>2]=3872,ar[i>>2]=3892,Ti(f),ar[f>>2]=3908,ar[(r=t+36|0)>>2]=0,ar[4+r>>2]=0,ar[8+r>>2]=0,ar[12+r>>2]=0,ar[t+52>>2]=16,ar[n>>2]=0,ar[4+n>>2]=0,ar[8+n>>2]=0,Of(f,n),(0|tr[11+n>>0])<0&&Vl(0|ar[n>>2]),a=t+(0|ar[(0|ar[t>>2])-12>>2])+4|0,ar[a>>2]=-75&ar[a>>2]|8,ar[t+(0|ar[(0|ar[t>>2])-12>>2])+76>>2]=48,ar[t+(0|ar[(0|ar[t>>2])-12>>2])+12>>2]=2,e=e+24|0,a=0;12==(4|a)&&(tr[n>>0]=45,Hf(t,n,1)),Ki(t,0|cr[(0|ar[e>>2])+a>>0]),(0|(a=a+1|0))<16;);jf(A,f),ar[t>>2]=3872,ar[i>>2]=3892,ar[f>>2]=3908,(0|tr[11+r>>0])<0&&Vl(0|ar[r>>2]),si(f),ci(i),ur=o}function jf(A,e){A|=0;var r=0,i=0,f=0,n=0;if(16&(r=0|ar[(e|=0)+48>>2])|0){if((i=0|ar[(r=e+44|0)>>2])>>>0<(f=0|ar[e+24>>2])>>>0&&(i=ar[r>>2]=f),r=0|ar[e+20>>2],ar[A>>2]=0,ar[A+4>>2]=0,4294967279<(e=i-r|(ar[A+8>>2]=0))>>>0&&Nl(),e>>>0<11?tr[A+11>>0]=e:(f=0|El(n=e+16&-16),ar[A>>2]=f,ar[A+8>>2]=-2147483648|n,ar[A+4>>2]=e,A=f),(0|r)!=(0|i)){for(f=A;tr[f>>0]=0|tr[r>>0],(0|(r=r+1|0))!=(0|i);)f=f+1|0;A=A+e|0}tr[A>>0]=0}else{if(!(8&r))return ar[A>>2]=0,ar[A+4>>2]=0,void(ar[A+8>>2]=0);if(r=0|ar[e+8>>2],f=0|ar[e+16>>2],ar[A>>2]=0,ar[A+4>>2]=0,4294967279<(e=f-r|(ar[A+8>>2]=0))>>>0&&Nl(),e>>>0<11?tr[A+11>>0]=e:(n=0|El(i=e+16&-16),ar[A>>2]=n,ar[A+8>>2]=-2147483648|i,ar[A+4>>2]=e,A=n),(0|r)!=(0|f)){for(i=A;tr[i>>0]=0|tr[r>>0],(0|(r=r+1|0))!=(0|f);)i=i+1|0;A=A+e|0}tr[A>>0]=0}}function zf(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c=0,l=0,u=0,s=0;if(ur=(a=ur)+16|0,o=a,!(s=0|ar[(A|=0)>>2]))return ur=a,(s=0)|s;if(l=(0|(l=i-(c=e)|0))<(0|(u=0|ar[(t=f+12|0)>>2]))?u-l|0:0,0<(0|(f=(u=r)-c|0))&&(0|ns[63&ar[48+(0|ar[s>>2])>>2]](s,e,f))!=(0|f))return ar[A>>2]=0,ur=a,(s=0)|s;do{if(0<(0|l)){if(ar[o>>2]=0,ar[o+4>>2]=0,c=l>>>(ar[o+8>>2]=0)<11?(tr[(e=o+11|0)>>0]=l,f=o):(f=0|El(e=l+16&-16),ar[o>>2]=f,ar[o+8>>2]=-2147483648|e,ar[o+4>>2]=l,e=o+11|0,o),Vu(0|f,0|n,0|l),((tr[f+l>>0]=0)|ns[63&ar[48+(0|ar[s>>2])>>2]](s,(0|tr[e>>0])<0?0|ar[c>>2]:o,l))!=(0|l))return((ar[A>>2]=0)|tr[e>>0])<0&&Vl(0|ar[c>>2]),ur=a,(s=0)|s;(0|tr[e>>0])<0&&Vl(0|ar[c>>2]);break}}while(0);return 0<(0|(i=i-u|0))&&(0|ns[63&ar[48+(0|ar[s>>2])>>2]](s,r,i))!=(0|i)?(ar[A>>2]=0,ur=a,(s=0)|s):(ar[t>>2]=0,ur=a,0|s)}function Pf(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Uf(f,e,r),Hf(n,(c=(e=0|tr[(r=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&e),(0|tr[r>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a}function Lf(A,e,r){e|=0,r|=0;var i,f=0,n=0,t=0;return i=0|ar[(f=t=(A|=0)+8|0)>>2],(f=0|ar[f+4>>2])>>>0<r>>>0|(0|f)==(0|r)&i>>>0<e>>>0?(0==(0|i)&0==(0|f)||((n=0|ar[A+4>>2])?(Lf(n,i,f),n=0|ar[(f=t)>>2],f=0|ar[f+4>>2]):n=i,zi(0|ar[A>>2],n,f,1),ar[t>>2]=0,ar[t+4>>2]=0,tr[A+16>>0]=1),tr[A+17>>0]=1,(t=0)|t):((n=0|ar[A+4>>2])?(Lf(n,e,r),n=0|ar[(f=t)>>2],f=0|ar[f+4>>2]):n=i,e=0|gu(0|n,0|f,0|e,0|r),r=D,ar[t>>2]=e,ar[t+4>>2]=r,tr[A+16>>0]=0==(0|e)&0==(0|r)&1,0|(t=1))}function Kf(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=(A|=0)+4|0,n=0|ar[A>>2],1073741823<(o=1+(i=(t=(0|ar[f>>2])-n|0)>>2)|0)>>>0&&il(),a=(c=(0|ar[(l=A+8|0)>>2])-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t),ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),n&&Vl(n)}function qf(A,e,r){A|=0,e|=0;var i,f=0,n=0,t=0;if(ur=(i=ur)+16|0,n=i,0|Lf(r|=0,4,0))if(ji(f=0|ar[r>>2],n,4),5&ar[f+(0|ar[(0|ar[f>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(tr[e+37>>0]=f>>>24,ar[e+40>>2]=16777215&f,tr[e+36>>0]=1,ar[(t=e+16|0)>>2]=4+(0|ar[t>>2]),!(0|tr[r+17>>0]))return n=0|ar[(r=49920)+4>>2],ar[(t=A)>>2]=ar[r>>2],ar[t+4>>2]=n,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)}function $f(A,e,r,i){var f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X=0,_=0,F=0,N=0,R=0,Y=0;ur=(V=ur)+208|0,N=(r|=0)+16|0,a=r+17|0,c=4+(I=V+184|0)|0,l=(e|=0)+44|0,u=e+48|0,d=12+(E=(B=V)+24|0)|0,k=4+E|0,h=s=64+E|0,w=136+E|0,v=140+E|0,m=60+E|0,p=(R=V+192|0)+11|0,y=b=8+E|0,Z=11+(G=V+168|0)|0,C=11+(g=44+E|0)|0,f=e+52|0,n=-1!=(0|(i|=0)),o=11+(t=B+8|0)|0,W=(A|=0)+8|0,F=0;A:for(;e=0|tr[a>>0],!((tr[N>>0]|e)<<24>>24);){ar[I>>2]=0,ar[c>>2]=0,An(B,r,I);do{if((0|ar[B>>2])==(0|ar[12480])){if((X=e=0|ar[u>>2])-(0|ar[l>>2])>>3>>>0<=1024){X>>>0<(0|ar[f>>2])>>>0?(ar[e>>2]=ar[I>>2],ar[X+4>>2]=ar[c>>2],ar[I>>2]=0,ar[c>>2]=0,ar[u>>2]=X+8):en(l,I),_=(n&(0|(e=F+1|0))==(0|i))<<31>>31;break}ar[b>>2]=4080,ar[E>>2]=164,ar[s>>2]=184,ar[k>>2]=0,Yi(h,d),ar[w>>2]=0,ar[v>>2]=-1,ar[E>>2]=4060,ar[s>>2]=4100,ar[b>>2]=4080,Ti(d),ar[d>>2]=3908,ar[g>>2]=0,ar[4+g>>2]=0,ar[8+g>>2]=0,ar[12+g>>2]=0,ar[m>>2]=24,ar[R>>2]=0,ar[R+4>>2]=0,ar[R+8>>2]=0,Of(d,R),(0|tr[p>>0])<0&&Vl(0|ar[R>>2]),Hf(0|qi(0|Hf(y,17315,30),1024),17346,10),jf(G,d),Cc(A,6,1e3,G),(0|tr[Z>>0])<0&&Vl(0|ar[G>>2]),ar[E>>2]=4060,ar[s>>2]=4100,ar[y>>2]=4080,ar[d>>2]=3908,(0|tr[C>>0])<0&&Vl(0|ar[g>>2]),si(d),ci(s),_=1,e=F}else e=0|ar[(X=B)+4>>2],ar[(_=A)>>2]=ar[X>>2],ar[_+4>>2]=e,ar[W>>2]=ar[t>>2],ar[4+W>>2]=ar[4+t>>2],ar[8+W>>2]=ar[8+t>>2],ar[t>>2]=0,ar[4+t>>2]=0,ar[8+t>>2]=0,_=1,e=F}while(0);switch((0|tr[o>>0])<0&&Vl(0|ar[t>>2]),0|(X=0|ar[c>>2])&&Il(X),3&_){case 0:F=e;break;case 3:Y=22;break A;default:Y=28;break A}}if(22==(0|Y))e=0|tr[a>>0];else if(28==(0|Y))return void(ur=V);e<<24>>24?(ar[R>>2]=0,ar[R+4>>2]=0,ar[R+8>>2]=0,Cc(A,2,100,R),(0|tr[R+11>>0])<0&&Vl(0|ar[R>>2])):(R=0|ar[(N=49920)+4>>2],ar[(Y=A)>>2]=ar[N>>2],ar[Y+4>>2]=R,Rl(W,49928)),ur=V}function An(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0;ur=(n=ur)+256|0,h=n+192|0,t=n+228|0,d=(i=n)+216|0,ar[(f=n+144|0)>>2]=3840,k=8+f|0,ar[40+f>>2]=0,ar[k>>2]=0,ar[k+4>>2]=0,ar[k+8>>2]=0,ar[k+12>>2]=0,ar[k+16>>2]=0,ar[k+20>>2]=0,ar[k+24>>2]=0,or[k+28>>1]=0,rn(t,f,e),(0|tr[(t=t+8|0)+11>>0])<0&&Vl(0|ar[t>>2]);do{if(0|tr[e+17>>0])ar[h>>2]=0,ar[h+4>>2]=0,ar[h+8>>2]=0,Cc(A,2,100,h),(0|tr[h+11>>0])<0&&Vl(0|ar[h>>2]);else{t=0|ar[20+f>>2];A:do{if((0|t)<1768778098){if((0|t)<1735553132){if((0|t)<1684631142){if((0|t)<1668047216){switch(0|t){case 1635088451:break;default:b=114;break A}t=0|El(96),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4716,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,o=(ar[o>>2]=w)+l|0,ar[c>>2]=o,Eu(0|w,0|u,0|l),ar[a>>2]=o;break}il()}}while(0);u=0|ar[(l=36+f|0)+4>>2],ar[(w=t+52|0)>>2]=ar[l>>2],ar[w+4>>2]=u,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4744,ar[(w=t+72|0)>>2]=0,ar[w+4>>2]=0,ar[w+8>>2]=0,ar[w+12>>2]=0,ar[w+16>>2]=0,ar[w+20>>2]=0;break}switch(0|t){case 1668047216:break;default:b=114;break A}t=0|El(104),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4884,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){v=0|El(l),ar[a>>2]=v,w=(ar[o>>2]=v)+l|0,ar[c>>2]=w,Eu(0|v,0|u,0|l),ar[a>>2]=w;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4912;break}if((0|t)<1685218662){switch(0|t){case 1684631142:break;default:b=114;break A}t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=5136,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=5164;break}if((0|t)<1718909296){switch(0|t){case 1685218662:break;default:b=114;break A}t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=5192,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=5220;break}switch(0|t){case 1718909296:break;default:b=114;break A}t=0|El(96),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4156,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4e3,ar[t+80>>2]=0,ar[t+84>>2]=0,ar[t+88>>2]=0;break}if((0|t)<1768186228){if((0|t)<1751411826){switch(0|t){case 1735553132:break;default:b=114;break A}t=0|El(88),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=5080,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=5108,ar[t+72>>2]=0,ar[t+76>>2]=0,ar[t+80>>2]=0;break}if(1752589123<=(0|t)){switch(0|t){case 1752589123:break;default:b=114;break A}t=0|El(120),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4996,fn(s=t+16|0,f);break}switch(0|t){case 1751411826:break;default:b=114;break A}t=0|El(104),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4212,ar[(s=t+16|0)>>2]=3840,ar[(u=t+24|0)>>2]=ar[k>>2],ar[u+4>>2]=ar[k+4>>2],ar[u+8>>2]=ar[k+8>>2],ar[u+12>>2]=ar[k+12>>2],ar[(u=t+40|0)>>2]=0,ar[(o=t+44|0)>>2]=0,l=(ar[(a=t+48|0)>>2]=0)|ar[24+f>>2],c=(0|ar[28+f>>2])-l|0;do{if(0|c){if(!((0|c)<0)){w=0|El(c),ar[o>>2]=w,v=(ar[u>>2]=w)+c|0,ar[a>>2]=v,Eu(0|w,0|l,0|c),ar[o>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4240,ar[(v=t+92|0)>>2]=0,ar[v+4>>2]=0,ar[v+8>>2]=0;break}if((0|t)<1768517222){switch(0|t){case 1768186228:break;default:b=114;break A}t=0|El(88),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=5024,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=5052,ar[(v=t+72|0)>>2]=0,ar[v+4>>2]=0,ar[v+8>>2]=0,ar[v+12>>2]=0;break}if((0|t)<1768714083){switch(0|t){case 1768517222:break;default:b=114;break A}t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4380,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4408;break}switch(0|t){case 1768714083:break;default:b=114;break A}t=0|El(88),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4324,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4352,ar[t+72>>2]=0,ar[t+76>>2]=0,ar[t+80>>2]=0;break}if((0|t)<1769104742){if((0|t)<1768973167){if((0|t)<1768842853){switch(0|t){case 1768778098:break;default:b=114;break A}t=0|El(80),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4828,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4856;break}switch(0|t){case 1768842853:break;default:b=114;break A}t=0|El(144),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4436,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);for(a=0|ar[(c=36+f|0)+4>>2],ar[(o=t+52|0)>>2]=ar[c>>2],ar[o+4>>2]=a,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4464,c=(a=o=t+80|0)+60|0;(0|(a=a+4|(ar[a>>2]=0)))<(0|c););tr[o+60>>0]=0;break}if((0|t)<1768975713){switch(0|t){case 1768973167:break;default:b=114;break A}t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4548,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4576;break}switch(0|t){case 1768977008:t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4492,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4520;break A;case 1768975713:t=0|El(88),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4604,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4632,ar[t+72>>2]=0,ar[t+76>>2]=0,ar[t+80>>2]=0;break A;default:b=114;break A}}if((0|t)<1835365473){if((0|t)<1769107316){switch(0|t){case 1769104742:break;default:b=114;break A}t=0|El(88),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4940,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4968,ar[t+72>>2]=0,ar[t+76>>2]=0,ar[t+80>>2]=0;break}if((0|t)<1769173093){switch(0|t){case 1769107316:break;default:b=114;break A}t=0|El(80),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4772,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4800;break}switch(0|t){case 1769173093:break;default:b=114;break A}t=0|El(80),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4660,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4688;break}if((0|t)<1885959277){switch(0|t){case 1835365473:break;default:b=114;break A}t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4184,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4028;break}if((0|t)<1970433056){switch(0|t){case 1885959277:break;default:b=114;break A}t=0|El(80),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=4268,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=4296;break}switch(0|t){case 1970433056:break;default:b=114;break A}t=0|El(88),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=5248,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(u=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[u>>2],ar[v+4>>2]=w,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0,ar[s>>2]=5276,ar[(v=t+72|0)>>2]=0,ar[v+4>>2]=0,ar[v+8>>2]=0;break}while(0);if(114==(0|b)){t=0|El(72),ar[t+4>>2]=0,ar[t+8>>2]=0,ar[t>>2]=5304,ar[(s=t+16|0)>>2]=3840,ar[(o=t+24|0)>>2]=ar[k>>2],ar[o+4>>2]=ar[k+4>>2],ar[o+8>>2]=ar[k+8>>2],ar[o+12>>2]=ar[k+12>>2],ar[(o=t+40|0)>>2]=0,ar[(a=t+44|0)>>2]=0,u=(ar[(c=t+48|0)>>2]=0)|ar[24+f>>2],l=(0|ar[28+f>>2])-u|0;do{if(0|l){if(!((0|l)<0)){w=0|El(l),ar[a>>2]=w,v=(ar[o>>2]=w)+l|0,ar[c>>2]=v,Eu(0|w,0|u,0|l),ar[a>>2]=v;break}il()}}while(0);w=0|ar[(b=36+f|0)+4>>2],ar[(v=t+52|0)>>2]=ar[b>>2],ar[v+4>>2]=w,ar[s>>2]=3972,ar[t+60>>2]=0,ar[t+64>>2]=0,ar[t+68>>2]=0}if(l=s,o=0|ar[(a=k)>>2],(a=0|ar[a+4>>2])>>>0<0|0==(0|a)&o>>>0<(c=0|ar[(u=16+f|0)>>2])>>>0)a=i+64|0,ar[(l=i+8|0)>>2]=4080,c=i+12|0,ar[i>>2]=164,ar[a>>2]=184,Yi(i+64|(ar[i+4>>2]=0),c),ar[i+136>>2]=0,ar[i+140>>2]=-1,ar[i>>2]=4060,ar[a>>2]=4100,ar[l>>2]=4080,Ti(c),ar[c>>2]=3908,ar[(l=i+44|0)>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,ar[l+12>>2]=0,ar[i+60>>2]=24,ar[h>>2]=0,ar[h+4>>2]=0,ar[h+8>>2]=0,Of(c,h),(0|tr[h+11>>0])<0&&Vl(0|ar[h>>2]),w=0|Hf(o=i+8|0,17426,10),v=0|Hf(0|$i(w,0|ar[(v=k)>>2],0|ar[v+4>>2]),17437,34),Hf(0|qi(v,0|ar[u>>2]),17472,7),jf(d,c),Cc(A,2,101,d),(0|tr[d+11>>0])<0&&Vl(0|ar[d>>2]),ar[i>>2]=4060,ar[a>>2]=4100,ar[o>>2]=4080,ar[c>>2]=3908,(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2]),si(c),ci(a);else if(v=0|ar[e>>2],k=0|gu(0|o,0|a,0|c,0),w=D,a=h+4|0,tr[h+17>>0]=0,ar[(d=u=h+8|0)>>2]=k,ar[d+4>>2]=w,tr[h+16>>0]=0==(0|k)&0==(0|w)&1,ar[h>>2]=v,ar[a>>2]=e,hs[127&ar[16+(0|ar[s>>2])>>2]](i,s,h),(0|ar[i>>2])==(0|ar[12480])&&(ar[r>>2]=l,o=0|ar[(v=r+4|0)>>2],ar[v>>2]=t,t=(o&&Il(o),0)),0==(0|(c=0|ar[(o=u)>>2]))&0==(0|(o=0|ar[o+4>>2]))||((a=0|ar[a>>2])?(Lf(a,c,o),a=0|ar[(o=u)>>2],o=0|ar[o+4>>2]):a=c,zi(0|ar[h>>2],a,o,1),ar[(v=u)>>2]=0,ar[v+4>>2]=0),w=0|ar[(h=i)+4>>2],ar[(v=A)>>2]=ar[h>>2],ar[v+4>>2]=w,w=i+8|0,ar[(v=A+8|0)>>2]=ar[w>>2],ar[v+4>>2]=ar[w+4>>2],ar[v+8>>2]=ar[w+8>>2],!t)break;Il(t)}}while(0);ar[f>>2]=3840,ur=((o=0|ar[24+f>>2])&&((0|ar[(t=28+f|0)>>2])!=(0|o)&&(ar[t>>2]=o),Vl(o)),n)}function en(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;t=0|ar[(s=(A|=0)+4|0)>>2],r=o=0|ar[A>>2],536870911<(f=(l=t-o>>3)+1|0)>>>0&&il(),a=(u=(0|ar[(i=A+8|0)>>2])-o|0)>>2,a=u>>3>>>0<268435455?a>>>0<f>>>0?f:a:536870911;do{if(a){if(!(536870911<a>>>0)){c=0|El(a<<3);break}Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)}else c=0}while(0);if(u=c+(a<<3)|0,ar[(f=n=c+(l<<3)|0)>>2]=ar[e>>2],a=e+4|0,ar[c+(l<<3)+4>>2]=ar[a>>2],ar[e>>2]=0,a=n+8|(ar[a>>2]=0),(0|t)!=(0|r)){for(;t=(l=t)+-8|0,ar[n+-8>>2]=ar[t>>2],l=l+-4|0,ar[n+-4>>2]=ar[l>>2],ar[t>>2]=0,f=n=f+-8|(ar[l>>2]=0),(0|t)!=(0|r););o=0|ar[A>>2]}if(ar[A>>2]=f,f=0|ar[s>>2],ar[s>>2]=a,ar[i>>2]=u,(0|f)!=(0|(t=o)))for(;n=0|ar[f+-4>>2],f=f+-8|0,0|n&&Il(n),(0|f)!=(0|t););o&&Vl(o)}function rn(A,e,r){A|=0,e|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if(ur=(i=ur)+16|0,u=i,0|Lf(r|=0,4,0))if(ji(c=0|ar[r>>2],u,4),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(f=r;ar[(c=f+8|0)>>2]=0,ar[c+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[u+1>>0]<<16|cr[u>>0]<<24|cr[u+2>>0]<<8|cr[u+3>>0];else f=0;if(ar[(c=o=e+8|0)>>2]=f,(ar[c+4>>2]=0)|Lf(r,4,0))if(ji(c=0|ar[r>>2],u,4),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(f=r;ar[(c=f+8|0)>>2]=0,ar[c+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[u+1>>0]<<16|cr[u>>0]<<24|cr[u+2>>0]<<8|cr[u+3>>0];else f=0;if(ar[(t=e+20|0)>>2]=f,ar[(c=e+16|0)>>2]=8,1==(0|ar[(a=o)>>2])&0==(0|ar[a+4>>2])){if(0|Lf(r,4,0))if(ji(a=0|ar[r>>2],u,4),5&ar[a+(0|ar[(0|ar[a>>2])-12>>2])+16>>2]){for(f=r;ar[(a=f+8|0)>>2]=0,ar[a+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[u+1>>0]<<16|cr[u>>0]<<24|cr[u+2>>0]<<8|cr[u+3>>0];else f=0;if(0|Lf(r,4,0))if(ji(a=0|ar[r>>2],u,4),5&ar[a+(0|ar[(0|ar[a>>2])-12>>2])+16>>2]){for(n=r;ar[(a=n+8|0)>>2]=0,ar[a+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[u+1>>0]<<16|cr[u>>0]<<24|cr[u+2>>0]<<8|cr[u+3>>0];else n=0;ar[(a=o)>>2]=n,ar[a+4>>2]=f,ar[c>>2]=8+(0|ar[c>>2]),f=0|ar[t>>2]}if(1970628964==(0|f)&&(0|Lf(r,16,0)&&(a=e+24|0,16<=(t=(o=0|ar[(n=e+28|0)>>2])-(f=0|ar[a>>2])|0)>>>0?16!=(0|t)&&(0|o)!=(0|(l=f+16|0))&&(ar[n>>2]=l):(dn(a,16-t|0),f=0|ar[a>>2]),ji(0|ar[r>>2],f,16)),ar[c>>2]=16+(0|ar[c>>2])),!(0|tr[r+17>>0]))return r=0|ar[(l=49920)+4>>2],ar[(u=A)>>2]=ar[l>>2],ar[u+4>>2]=r,Rl(A+8|0,49928),void(ur=i);ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,Cc(A,2,100,u),ur=(0<=(0|tr[u+11>>0])||Vl(0|ar[u>>2]),i)}function fn(A,e){(function(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0;ar[(A|=0)>>2]=3840,n=e+8|0,ar[(f=A+8|0)>>2]=ar[n>>2],ar[f+4>>2]=ar[n+4>>2],ar[f+8>>2]=ar[n+8>>2],ar[f+12>>2]=ar[n+12>>2],n=e+24|0,ar[(f=A+24|0)>>2]=0,ar[(o=A+28|0)>>2]=0,ar[A+32>>2]=0,0|(i=(0|ar[(r=e+28|0)>>2])-(0|ar[n>>2])|0)&&((0|i)<0&&il(),t=0|El(i),ar[o>>2]=t,ar[f>>2]=t,ar[A+32>>2]=t+i,f=0|ar[n>>2],0<(0|(i=(0|ar[r>>2])-f|0))&&(Eu(0|t,0|f,0|i),ar[o>>2]=t+i));t=0|ar[(e=e+36|0)+4>>2],ar[(o=A+36|0)>>2]=ar[e>>2],ar[o+4>>2]=t,ar[A>>2]=3972,ar[A+44>>2]=0,ar[A+48>>2]=0,ar[A+52>>2]=0})(A|=0,e|=0),ar[A>>2]=5332,ar[(e=A+64|0)>>2]=0,ar[A+68>>2]=0,ar[A+72>>2]=0,ar[A+92>>2]=0,ar[A+96>>2]=0,un(e,48,ar[A+100>>2]=0)}function nn(A,e){A|=0,e|=0;var r,i,f=0,n=0;ur=(i=ur)+16|0,ar[(r=i)>>2]=0,ar[r+4>>2]=0,ar[r+8>>2]=0;do{if(0|tr[e+16>>0])for(e=A+12|0;(0|(A=A+1|(tr[A>>0]=0)))<(0|e););else{for(;;){if(!(0|Lf(e,1,0))){f=5;break}if(f=0|xi(n=0|ar[e>>2]),5&ar[n+(0|ar[(0|ar[n>>2])-12>>2])+16>>2]|0){f=7;break}if(!f){f=11;break}jl(r,255&f)}if(5==(0|f)){ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0;break}if(7==(0|f)){for(;ar[(n=e+8|0)>>2]=0,ar[n+4>>2]=0,tr[e+16>>0]=1,e=0|ar[e+4>>2];)f=7;ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0;break}if(11==(0|f)){ar[A>>2]=ar[r>>2],ar[A+4>>2]=ar[r+4>>2],ar[A+8>>2]=ar[r+8>>2],ar[r>>2]=0,ar[r+4>>2]=0,ar[r+8>>2]=0;break}}}while(0);ur=(0<=(0|tr[r+11>>0])||Vl(0|ar[r>>2]),i)}function tn(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0,s=0,b=0;if(ur=(c=ur)+160|0,f=c+136|0,o=(t=c)+56|0,a=t+4|0,ar[t>>2]=268,ar[o>>2]=288,Yi(t+56|0,a),ar[t+128>>2]=0,ar[t+132>>2]=-1,ar[t>>2]=3872,ar[o>>2]=3892,Ti(a),ar[a>>2]=3908,ar[(n=t+36|0)>>2]=0,ar[4+n>>2]=0,ar[8+n>>2]=0,ar[12+n>>2]=0,ar[t+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(a,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),l=1+(0|ar[r>>2])|0,ar[r>>2]=l,(0|(u=0|ar[e+44>>2]))!=(0|(i=0|ar[e+48>>2]))){for(s=11+f|0,b=4+f|0,l=1,e=u;;){if(!l){if(0<(0|ar[r>>2]))for(l=0;Hf(t,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););Hf(t,26620,1)}if(u=0|ar[e>>2],hs[127&ar[ar[u>>2]>>2]](f,u,r),Hf(t,(l=(u=0|tr[s>>0])<<24>>24<0)?0|ar[f>>2]:f,l?0|ar[b>>2]:255&u),(0|tr[s>>0])<0&&Vl(0|ar[f>>2]),(0|(e=e+8|0))==(0|i))break;l=0}l=0|ar[r>>2]}if(ar[r>>2]=(0|l)<1?0:l+-1|0,jf(A,a),ar[t>>2]=3872,ar[o>>2]=3892,ar[a>>2]=3908,0<=(0|tr[11+n>>0]))return si(a),ci(o),void(ur=c);Vl(0|ar[n>>2]),si(a),ci(o),ur=c}function on(A){var e,r=0,i=0,f=0,n=0,t=0,o=0,a=0;if(ar[(A|=0)>>2]=5108,0|(r=0|ar[(e=A+56|0)>>2])){if((0|(i=0|ar[(a=A+60|0)>>2]))!=(0|r)){for(;o=i+-64|0,ar[a>>2]=o,0|(f=0|ar[i+-12>>2])&&((0|(t=0|ar[(n=i+-8|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),ar[o>>2]=3840,0|(f=0|ar[i+-40>>2])&&((0|ar[(i=i+-36|0)>>2])!=(0|f)&&(ar[i>>2]=f),Vl(f)),(0|(i=0|ar[a>>2]))!=(0|r););r=0|ar[e>>2]}Vl(r)}if(ar[A>>2]=3972,0|(r=0|ar[(n=A+44|0)>>2])){if((0|(i=0|ar[(t=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[t>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[t>>2]):f))!=(0|r););r=0|ar[n>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))}function an(A,e){e|=0;var r=0,i=0,f=0,n=0,t=0,o=0;ar[(A|=0)>>2]=3840,f=e+8|0,ar[(i=A+8|0)>>2]=ar[f>>2],ar[i+4>>2]=ar[f+4>>2],ar[i+8>>2]=ar[f+8>>2],ar[i+12>>2]=ar[f+12>>2],f=e+24|0,ar[(i=A+24|0)>>2]=0,ar[(o=A+28|0)>>2]=0,(ar[A+32>>2]=0)|(r=(0|ar[(n=e+28|0)>>2])-(0|ar[f>>2])|0)&&((0|r)<0&&il(),t=0|El(r),ar[o>>2]=t,ar[i>>2]=t,ar[A+32>>2]=t+r,i=0|ar[f>>2],0<(0|(r=(0|ar[n>>2])-i|0))&&(Eu(0|t,0|i,0|r),ar[o>>2]=t+r)),t=0|ar[(n=e+36|0)+4>>2],ar[(o=A+36|0)>>2]=ar[n>>2],ar[o+4>>2]=t,ar[A+48>>2]=ar[e+48>>2],ln(A+52|0,e+52|0)}function cn(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;i=(A|=0)+4|0,f=0|ar[A>>2],67108863<(n=(t=(0|ar[i>>2])-f>>6)+1|0)>>>0&&il(),f=(c=(0|ar[(l=A+8|0)>>2])-f|0)>>5,f=c>>6>>>0<33554431?f>>>0<n>>>0?n:f:67108863;do{if(f){if(!(67108863<f>>>0)){n=0|El(f<<6);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else n=0}while(0);if(r=n+(f<<6)|0,an(t=o=n+(t<<6)|0,e),a=o+64|0,e=0|ar[A>>2],(0|(f=0|ar[i>>2]))==(0|e))f=t,n=c=e;else{for(n=o;an(n+-64|0,f=f+-64|0),t=n=t+-64|0,(0|f)!=(0|e););f=t,c=0|ar[A>>2],n=0|ar[i>>2]}if(ar[A>>2]=f,ar[i>>2]=a,ar[l>>2]=r,(0|n)!=(0|(a=c)))for(o=n;o=(e=o)+-64|0,0|(f=0|ar[e+-12>>2])&&((0|(t=0|ar[(n=e+-8|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),ar[o>>2]=3840,0|(n=0|ar[e+-40>>2])&&((0|ar[(f=e+-36|0)>>2])!=(0|n)&&(ar[f>>2]=n),Vl(n)),(0|o)!=(0|a););c&&Vl(c)}function ln(A,e){e|=0;var r,i,f,n,t=0;ar[(A|=0)>>2]=0,ar[(n=A+4|0)>>2]=0,(r=(t=((ar[A+8>>2]=0)|ar[(f=e+4|0)>>2])-(0|ar[e>>2])|0)>>2)&&(1073741823<r>>>0&&il(),i=0|El(t),ar[n>>2]=i,ar[A>>2]=i,ar[A+8>>2]=i+(r<<2),A=0|ar[e>>2],(0|(t=(0|ar[f>>2])-A|0))<=0||(Eu(0|i,0|A,0|t),ar[n>>2]=i+(t>>>2<<2)))}function un(A,e,r){r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;return ur=(o=ur)+32|0,f=o+8|0,i=o,(e|=0)>>>0<=(c=0|ar[(n=(A|=0)+4|0)>>2])>>>0?(ar[n>>2]=e,void(ur=o)):((l=(u=0|ar[(t=A+8|0)>>2])<<5)>>>0<(a=e-c|0)>>>0|(l-a|0)>>>0<c>>>0?(ar[f>>2]=0,ar[(b=4+f|0)>>2]=0,((ar[(d=8+f|0)>>2]=0)|e)<0&&il(),c=u<<6,u=e+31&-32,function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;if(ur=(t=ur)+32|0,o=t+16|0,r=t+8|0,i=t,ar[(n=8+(A|=0)|0)>>2]<<5>>>0>=e>>>0)return ur=t;ar[o>>2]=0,ar[(a=o+4|0)>>2]=0,ar[(f=o+8|0)>>2]=0,(0|e)<0&&il();c=0|El((l=1+((e+-1|0)>>>5)|0)<<2),ar[o>>2]=c,ar[a>>2]=0,ar[f>>2]=l,l=0|ar[A>>2],ar[r>>2]=l,ar[4+r>>2]=0,e=0|ar[(c=A+4|0)>>2],ar[i>>2]=l+(e>>>5<<2),ar[i+4>>2]=31&e,function(A,e,r){e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0,s=0,b=0,d=0;if(ur=(c=ur)+32|0,f=c+24|0,n=c+16|0,t=c+8|0,a=c,d=0|ar[(u=4+(A|=0)|0)>>2],o=0|ar[e>>2],l=0|ar[e+4>>2],i=0|ar[r>>2],s=0|ar[r+4>>2],b=i-o<<3,ar[u>>2]=d-l+s+b,u=(0|ar[A>>2])+(d>>>5<<2)|0,e=u,(0|l)!=(0|(r=31&d)))return ar[f>>2]=o,ar[4+f>>2]=l,ar[n>>2]=i,ar[4+n>>2]=s,ar[t>>2]=e,ar[4+t>>2]=r,function(A,e,r,i){A|=0,r|=0,i|=0;var f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;if(l=0|ar[(e|=0)>>2],f=0|ar[(u=e+4|0)>>2],o=((0|ar[r>>2])-l<<3)+(0|ar[r+4>>2])-f|0,r=l,(0|o)<=0)return e=i+4|0,i=0|ar[i>>2],ar[A>>2]=i,i=A+4|0,A=0|ar[e>>2],ar[i>>2]=A;f?(n=-1>>>((n=32-f|0)-(l=(0|o)<(0|n)?o:n)|0)&-1<<f&ar[r>>2],f=0|ar[(c=i+4|0)>>2],r=(a=32-f|0)>>>0<l>>>0?a:l,t=0|ar[i>>2],f=ar[t>>2]&~(-1>>>(a-r|0)&-1<<f),ar[t>>2]=f,a=0|ar[c>>2],s=0|ar[u>>2],ar[t>>2]=(s>>>0<a>>>0?n<<a-s:n>>>(s-a|0))|f,f=(0|ar[c>>2])+r|0,t=t+(f>>>5<<2)|0,ar[i>>2]=t,f&=31,ar[c>>2]=f,0<(0|(a=l-r|0))&&(f=ar[t>>2]&~(-1>>>(32-a|0)),ar[t>>2]=f,ar[t>>2]=n>>>((0|ar[u>>2])+r|0)|f,ar[c>>2]=a,f=a),r=4+(0|ar[e>>2])|0,ar[e>>2]=r,o=o-l|0):f=0|ar[(c=f=i+4|0)>>2];if(a=32-f|0,n=-1<<f,31<(0|o)){for(t=~n,f=o;u=0|ar[r>>2],s=0|ar[i>>2],l=ar[s>>2]&t,ar[s>>2]=l,ar[s>>2]=u<<ar[c>>2]|l,s=s+4|0,ar[i>>2]=s,ar[s>>2]=ar[s>>2]&n|u>>>a,f=f+-32|0,r=4+(0|ar[e>>2])|0,ar[e>>2]=r,31<(0|f););o&=31}if((0|o)<=0)return e=c,s=0|ar[i>>2],ar[A>>2]=s,s=A+4|0,i=0|ar[e>>2],ar[s>>2]=i;if(t=ar[r>>2]&-1>>>(32-o|0),n=(0|a)<(0|o)?a:o,f=0|ar[i>>2],r=ar[f>>2]&~(-1<<ar[c>>2]&-1>>>(a-n|0)),ar[f>>2]=r,ar[f>>2]=r|t<<ar[c>>2],r=(0|ar[c>>2])+n|0,f=f+(r>>>5<<2)|0,ar[i>>2]=f,ar[c>>2]=31&r,(0|(r=o-n|0))<=0)return e=c,s=0|ar[i>>2],ar[A>>2]=s,s=A+4|0,i=0|ar[e>>2],ar[s>>2]=i;ar[f>>2]=ar[f>>2]&~(-1>>>(32-r|0))|t>>>n,ar[c>>2]=r,e=c,s=0|ar[i>>2],ar[A>>2]=s,s=A+4|0,i=0|ar[e>>2],ar[s>>2]=i}(a,f,n,t),ur=c;r=s-l+b|0,b=o,0<(0|r)&&(e=l?(d=-1>>>((d=32-l|0)-(e=(0|r)<(0|d)?r:d)|0)&-1<<l,ar[u>>2]=ar[u>>2]&~d|ar[b>>2]&d,r=r-e|0,u=u+((l=e+l|0)>>>5<<2)|0,l&=31,b=b+4|0):(l=0,o),Gu(0|u,0|e,(s=(0|r)/32|0)<<2|0),A=r-(s<<5)|0,e=r=u+(s<<2)|0,0<(0|A)&&(l=-1>>>(32-A|0),ar[r>>2]=ar[r>>2]&~l|ar[b+(s<<2)>>2]&l,l=A));ar[a>>2]=e,ar[a+4>>2]=l,ur=c}(o,r,i),e=0|ar[A>>2],ar[A>>2]=ar[o>>2],ar[o>>2]=e,o=0|ar[c>>2],ar[c>>2]=ar[a>>2],ar[a>>2]=o,a=0|ar[n>>2],ar[n>>2]=ar[f>>2],ar[f>>2]=a,0|e&&Vl(e);ur=t}(f,l>>>0<1073741823?c>>>0<u>>>0?u:c:2147483647),l=0|ar[n>>2],ar[b>>2]=l+a,u=c=0|ar[A>>2],e=0|ar[f>>2],0<(0|(l=(u+(l>>>5<<2)-c<<3)+(31&l)|0))?(Gu(0|e,0|c,(s=l>>>5)<<2|0),c=l-(s<<5)|0,e=l=e+(s<<2)|0,0<(0|c)?(k=-1>>>(32-c|0),ar[l>>2]=ar[l>>2]&~k|ar[u+(s<<2)>>2]&k):c=0):c=0,ar[i>>2]=e,ar[i+4>>2]=c,e=0|ar[(l=i)>>2],l=0|ar[l+4>>2],c=0|ar[A>>2],ar[A>>2]=ar[f>>2],ar[f>>2]=c,k=0|ar[n>>2],ar[n>>2]=ar[b>>2],ar[b>>2]=k,k=0|ar[t>>2],ar[t>>2]=ar[d>>2],ar[d>>2]=k,0|c&&Vl(c)):(l=(0|ar[A>>2])+(c>>>5<<2)|0,ar[n>>2]=e,e=l,l=31&c),a?(u=0==(0|l),c=e,r?(u||(e=a>>>0<(k=32-l|0)>>>0?a:k,ar[c>>2]=ar[c>>2]|-1>>>(k-e|0)&-1<<l,a=a-e|0,e=c=c+4|0),Vu(0|e,-1,(k=a>>>5)<<2|0),(a=a-(k<<5)|0)&&(ar[(e=c+(k<<2)|0)>>2]=ar[e>>2]|-1>>>(32-a|0)),void(ur=o)):(u||(e=a>>>0<(k=32-l|0)>>>0?a:k,ar[c>>2]=ar[c>>2]&~(-1>>>(k-e|0)&-1<<l),a=a-e|0,e=c=c+4|0),Vu(0|e,0,(k=a>>>5)<<2|0),(a=a-(k<<5)|0)&&(ar[(e=c+(k<<2)|0)>>2]=ar[e>>2]&~(-1>>>(32-a|0))),void(ur=o))):void(ur=o))}function sn(A){var e,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0;if(ar[(A|=0)>>2]=5332,0|(r=0|ar[(e=A+92|0)>>2])){if((0|(i=0|ar[(c=A+96|0)>>2]))!=(0|r)){for(f=i;;){if(i=f+-16|0,ar[c>>2]=i,o=0|ar[(a=f+-12|0)>>2]){if((0|(i=0|ar[(t=f+-8|0)>>2]))==(0|o))i=o;else{for(;f=i+-12|0,ar[t>>2]=f,(0|(i=(n=0|ar[f>>2])?((0|ar[(i=i+-8|0)>>2])!=(0|n)&&(ar[i>>2]=n),Vl(n),0|ar[t>>2]):f))!=(0|o););i=0|ar[a>>2]}Vl(i),i=0|ar[c>>2]}if((0|i)==(0|r))break;f=i}r=0|ar[e>>2]}Vl(r)}if(0|(r=0|ar[A+64>>2])&&Vl(r),ar[A>>2]=3972,0|(r=0|ar[(n=A+44|0)>>2])){if((0|(i=0|ar[(t=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[t>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[t>>2]):f))!=(0|r););r=0|ar[n>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))}function bn(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=(A|=0)+4|0,i=0|ar[A>>2],268435455<(f=(o=(0|ar[r>>2])-i>>4)+1|0)>>>0&&il(),i=(c=(0|ar[(l=A+8|0)>>2])-i|0)>>3,i=c>>4>>>0<134217727?i>>>0<f>>>0?f:i:268435455;do{if(i){if(!(268435455<i>>>0)){t=0|El(i<<4);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else t=0}while(0);if(a=t+(i<<4)|0,or[(n=f=t+(o<<4)|0)>>1]=0|or[e>>1],i=e+4|0,ar[t+(o<<4)+12>>2]=0,ar[t+(o<<4)+4>>2]=ar[i>>2],c=e+8|0,ar[t+(o<<4)+8>>2]=ar[c>>2],e=e+12|0,ar[t+(o<<4)+12>>2]=ar[e>>2],ar[e>>2]=0,ar[c>>2]=0,e=f+16|(ar[i>>2]=0),t=0|ar[A>>2],(0|(i=0|ar[r>>2]))==(0|t))i=n,f=c=t;else{for(;i=(u=i)+-16|0,or[f+-16>>1]=0|or[i>>1],c=u+-12|0,ar[(o=f+-12|0)>>2]=0,ar[(s=f+-8|0)>>2]=0,ar[f+-4>>2]=0,ar[o>>2]=ar[c>>2],o=u+-8|0,ar[s>>2]=ar[o>>2],u=u+-4|0,ar[f+-4>>2]=ar[u>>2],ar[u>>2]=0,ar[o>>2]=0,n=f=n+-16|(ar[c>>2]=0),(0|i)!=(0|t););i=n,c=0|ar[A>>2],f=0|ar[r>>2]}if(ar[A>>2]=i,ar[r>>2]=e,ar[l>>2]=a,(0|f)!=(0|(A=c))){a=f;do{if(0|(i=0|ar[(e=a+-12|0)>>2])){if((0|(f=0|ar[(o=a+-8|0)>>2]))!=(0|i)){for(;n=f+-12|0,ar[o>>2]=n,(0|(f=(t=0|ar[n>>2])?((0|ar[(f=f+-8|0)>>2])!=(0|t)&&(ar[f>>2]=t),Vl(t),0|ar[o>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}a=a+-16|0}while((0|a)!=(0|A))}c&&Vl(A)}function dn(A,e){var r,i,f=0,n=0,t=0,o=0,a=0;if((e|=0)>>>0<=((t=0|ar[(r=(A|=0)+8|0)>>2])-(f=0|ar[(i=A+4|0)>>2])|0)>>>0)for(;f=1+((tr[f>>0]=0)|ar[i>>2])|0,ar[i>>2]=f,0!=(0|(e=e+-1|0)););else{for((0|(f=(o=f-(n=0|ar[A>>2])|0)+e|0))<0&&il(),a=(t=t-n|0)<<1,a=(n=(f=t>>>0<1073741823?a>>>0<f>>>0?f:a:2147483647)?0|El(f):0)+o|0,o=n+f|0,f=t=a;t=f=t+1|(tr[f>>0]=0),0!=(0|(e=e+-1|0)););e=0|ar[A>>2],f=a+(0-(n=(0|ar[i>>2])-e|0))|0,0<(0|n)&&Eu(0|f,0|e,0|n),ar[A>>2]=f,ar[i>>2]=t,ar[r>>2]=o,e&&Vl(e)}}function kn(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;r=(A|=0)+4|0,i=0|ar[A>>2],357913941<(f=(o=((0|ar[r>>2])-i|0)/12|0)+1|0)>>>0&&il(),i=(a=((0|ar[(c=A+8|0)>>2])-i|0)/12|0)<<1,i=a>>>0<178956970?i>>>0<f>>>0?f:i:357913941;do{if(i){if(!(357913941<i>>>0)){t=0|El(12*i|0);break}Fl(c=0|C(8),37845),ar[c>>2]=16004,I(0|c,3616,283)}else t=0}while(0);if(n=f=t+(12*o|0)|0,a=t+(12*i|0)|0,ar[t+(12*o|0)+8>>2]=0,ar[f>>2]=ar[e>>2],i=e+4|0,ar[t+(12*o|0)+4>>2]=ar[i>>2],l=e+8|0,ar[t+(12*o|0)+8>>2]=ar[l>>2],ar[l>>2]=0,ar[i>>2]=0,o=f+12|(ar[e>>2]=0),t=0|ar[A>>2],(0|(i=0|ar[r>>2]))==(0|t))i=n,f=e=t;else{for(;i=(e=i)+-12|0,ar[(l=f+-12|0)>>2]=0,ar[(u=f+-8|0)>>2]=0,ar[f+-4>>2]=0,ar[l>>2]=ar[i>>2],l=e+-8|0,ar[u>>2]=ar[l>>2],e=e+-4|0,ar[f+-4>>2]=ar[e>>2],ar[e>>2]=0,ar[l>>2]=0,n=f=n+-12|(ar[i>>2]=0),(0|i)!=(0|t););i=n,e=0|ar[A>>2],f=0|ar[r>>2]}if(ar[A>>2]=i,ar[r>>2]=o,ar[c>>2]=a,(0|f)!=(0|(t=e)))for(;0|(n=0|ar[(f=(i=f)+-12|0)>>2])&&((0|ar[(i=i+-8|0)>>2])!=(0|n)&&(ar[i>>2]=n),Vl(n)),(0|f)!=(0|t););e&&Vl(e)}function hn(A){var e,r=0,i=0,f=0,n=0,t=0,o=0,a=0;if(ar[(A|=0)>>2]=4968,0|(r=0|ar[(e=A+56|0)>>2])){if((0|(i=0|ar[(a=A+60|0)>>2]))!=(0|r)){for(;o=i+-64|0,ar[a>>2]=o,0|(f=0|ar[i+-12>>2])&&((0|(t=0|ar[(n=i+-8|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),ar[o>>2]=3840,0|(f=0|ar[i+-40>>2])&&((0|ar[(i=i+-36|0)>>2])!=(0|f)&&(ar[i>>2]=f),Vl(f)),(0|(i=0|ar[a>>2]))!=(0|r););r=0|ar[e>>2]}Vl(r)}if(ar[A>>2]=3972,0|(r=0|ar[(n=A+44|0)>>2])){if((0|(i=0|ar[(t=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[t>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[t>>2]):f))!=(0|r););r=0|ar[n>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))}function wn(A,e){e|=0;var r=0,i=0,f=0,n=0,t=0,o=0;ar[(A|=0)>>2]=3840,f=e+8|0,ar[(i=A+8|0)>>2]=ar[f>>2],ar[i+4>>2]=ar[f+4>>2],ar[i+8>>2]=ar[f+8>>2],ar[i+12>>2]=ar[f+12>>2],f=e+24|0,ar[(i=A+24|0)>>2]=0,ar[(o=A+28|0)>>2]=0,(ar[A+32>>2]=0)|(r=(0|ar[(n=e+28|0)>>2])-(0|ar[f>>2])|0)&&((0|r)<0&&il(),t=0|El(r),ar[o>>2]=t,ar[i>>2]=t,ar[A+32>>2]=t+r,i=0|ar[f>>2],0<(0|(r=(0|ar[n>>2])-i|0))&&(Eu(0|t,0|i,0|r),ar[o>>2]=t+r)),t=0|ar[(n=e+36|0)+4>>2],ar[(o=A+36|0)>>2]=ar[n>>2],ar[o+4>>2]=t,ar[A+48>>2]=ar[e+48>>2],ln(A+52|0,e+52|0)}function vn(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;i=(A|=0)+4|0,f=0|ar[A>>2],67108863<(n=(t=(0|ar[i>>2])-f>>6)+1|0)>>>0&&il(),f=(c=(0|ar[(l=A+8|0)>>2])-f|0)>>5,f=c>>6>>>0<33554431?f>>>0<n>>>0?n:f:67108863;do{if(f){if(!(67108863<f>>>0)){n=0|El(f<<6);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else n=0}while(0);if(r=n+(f<<6)|0,wn(t=o=n+(t<<6)|0,e),a=o+64|0,e=0|ar[A>>2],(0|(f=0|ar[i>>2]))==(0|e))f=t,n=c=e;else{for(n=o;wn(n+-64|0,f=f+-64|0),t=n=t+-64|0,(0|f)!=(0|e););f=t,c=0|ar[A>>2],n=0|ar[i>>2]}if(ar[A>>2]=f,ar[i>>2]=a,ar[l>>2]=r,(0|n)!=(0|(a=c)))for(o=n;o=(e=o)+-64|0,0|(f=0|ar[e+-12>>2])&&((0|(t=0|ar[(n=e+-8|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),ar[o>>2]=3840,0|(n=0|ar[e+-40>>2])&&((0|ar[(f=e+-36|0)>>2])!=(0|n)&&(ar[f>>2]=n),Vl(n)),(0|o)!=(0|a););c&&Vl(c)}function gn(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4716,ar[(r=A+16|0)>>2]=4744,0|(i=0|ar[A+84>>2])&&((0|ar[(f=A+88|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),(0|tr[(i=A+72|0)+11>>0])<0&&Vl(0|ar[i>>2]),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()}function mn(A){var e=0,r=0,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4632,0|(e=0|ar[(n=A+56|0)>>2])){if((0|(r=0|ar[(t=A+60|0)>>2]))!=(0|e)){for(i=r;r=i+-16|0,ar[t>>2]=r,(f=0|ar[i+-12>>2])&&((0|(i=0|ar[(r=i+-8|0)>>2]))!=(0|f)&&(ar[r>>2]=i+(~((i+-4-f|0)>>>2)<<2)),Vl(f),r=0|ar[t>>2]),(0|r)!=(0|e);)i=r;e=0|ar[n>>2]}Vl(e)}if(ar[A>>2]=3972,0|(e=0|ar[(f=A+44|0)>>2])){if((0|(r=0|ar[(n=A+48|0)>>2]))!=(0|e)){for(;i=r+-8|0,ar[n>>2]=i,(0|(r=(r=0|ar[r+-4>>2])?(Il(r),0|ar[n>>2]):i))!=(0|e););e=0|ar[f>>2]}Vl(e)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(e=A+28|0)>>2])!=(0|r)&&(ar[e>>2]=r),Vl(r))}function pn(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=(A|=0)+4|0,i=0|ar[A>>2],268435455<(f=(o=(0|ar[r>>2])-i>>4)+1|0)>>>0&&il(),i=(a=(0|ar[(c=A+8|0)>>2])-i|0)>>3,i=a>>4>>>0<134217727?i>>>0<f>>>0?f:i:268435455;do{if(i){if(!(268435455<i>>>0)){t=0|El(i<<4);break}Fl(c=0|C(8),37845),ar[c>>2]=16004,I(0|c,3616,283)}else t=0}while(0);if(a=t+(i<<4)|0,ar[(n=f=t+(o<<4)|0)>>2]=ar[e>>2],function(A,e){e|=0;var r,i,f,n,t=0;if(ar[(A|=0)>>2]=0,ar[(n=A+4|0)>>2]=0,ar[A+8>>2]=0,t=(0|ar[(f=e+4|0)>>2])-(0|ar[e>>2])|0,!(r=t>>2))return;1073741823<r>>>0&&il();if(i=0|El(t),ar[n>>2]=i,ar[A>>2]=i,ar[A+8>>2]=i+(r<<2),A=0|ar[e>>2],(0|(t=(0|ar[f>>2])-A|0))<=0)return;Eu(0|i,0|A,0|t),ar[n>>2]=i+(t>>>2<<2)}(t+(o<<4)+4|0,e+4|0),e=f+16|0,t=0|ar[A>>2],(0|(i=0|ar[r>>2]))==(0|t))f=n,i=o=t;else{for(;i=(u=i)+-16|0,ar[f+-16>>2]=ar[i>>2],o=u+-12|0,ar[(l=f+-12|0)>>2]=0,ar[(s=f+-8|0)>>2]=0,ar[f+-4>>2]=0,ar[l>>2]=ar[o>>2],l=u+-8|0,ar[s>>2]=ar[l>>2],u=u+-4|0,ar[f+-4>>2]=ar[u>>2],ar[u>>2]=0,ar[l>>2]=0,n=f=n+-16|(ar[o>>2]=0),(0|i)!=(0|t););f=n,o=0|ar[A>>2],i=0|ar[r>>2]}if(ar[A>>2]=f,ar[r>>2]=e,ar[c>>2]=a,(0|i)!=(0|(e=o)))for(;0|(f=0|ar[i+-12>>2])&&((0|(t=0|ar[(n=i+-8|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-4-f|0)>>>2)<<2)),Vl(f)),(0|(i=i+-16|0))!=(0|e););o&&Vl(o)}function yn(A,e){e|=0;var r,i,f,n,t,o,a=0,c=0,l=0,u=0;n=(A|=0)+4|0,u=t=0|ar[A>>2],1073741823<(a=1+(i=(o=(0|ar[n>>2])-t|0)>>2)|0)>>>0&&il(),c=(l=(0|ar[(f=A+8|0)>>2])-t|0)>>1,c=l>>2>>>0<536870911?c>>>0<a>>>0?a:c:1073741823;do{if(c){if(!(1073741823<c>>>0)){l=0|El(c<<2);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else l=0}while(0);r=l+(i<<2)|0,a=lr[e>>1]|lr[e+2>>1]<<16,or[r>>1]=a,or[2+r>>1]=a>>>16,a=r+(0-i<<2)|0,0<(0|o)&&Eu(0|a,0|u,0|o),ar[A>>2]=a,ar[n>>2]=4+r,ar[f>>2]=l+(c<<2),t&&Vl(u)}function Zn(A,e,r,i,f,n,t,o,a,c,l){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0;var u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0,fA=0,nA=0,tA=0,oA=0,aA=0,cA=0,lA=0,uA=0,sA=0;if(ur=(S=ur)+144|0,Q=S+8|0,_=(X=S)+136|0,U=0|ar[(F=(A|=0)+10352|0)>>2],iA=(0|sr(U,r))+e|0,fA=0|ar[(N=A+10340|0)>>2],H=f<<1,x=(0|cr[fA+(24*iA|0)+4>>0])>>>H&3)if(M=(T=1<<(P=0|ar[((O=0==(0|f))?A+5760|0:A+5768|0)>>2]))-1|0,D=0|sr(n,e),J=0|sr(t,r),B=0|ar[(O?A+24|0:A+32|0)>>2],E=0|ar[(O?A+28|0:A+36|0)>>2],i=D>>(e=0|ar[(G=A+10348|0)>>2]),e=J>>e,-1<(0|i)&(0|i)<(0|U)||br(41808,41845,118,41865),(0|e)<=-1&&br(41869,41845,119,41865),(0|e)>=(0|ar[(V=A+10356|0)>>2])&&br(41869,41845,119,41865),oA=fA+(24*((0|sr(e,U))+i|0)|0)+2|0,C=A+52|0,oA=0|ar[800+(0|ar[(0|ar[(Z=A+48|0)>>2])+(lr[oA>>1]<<2)>>2])>>2],W=0|ar[A+5820>>2],uA=O?lA=0:(lA=(0|ar[A+5780>>2])-1|0,(0|ar[A+5784>>2])-1|0),y=(tA=0|ar[A+5804>>2])-lA|0,tA=tA-uA|0,Y=(0|B)<(D+n|0)?B-D|0:n,R=(0|E)<(J+t|0)?E-J|0:t,I=0!=(0|tr[fA+(24*iA|0)+22>>0]),2==(0|x)){switch((0|cr[fA+(24*iA|0)+5>>0])>>>H&3){case 0:j=z=0,aA=-1,cA=1;break;case 1:j=-(z=1),cA=aA=0;break;case 2:aA=j=-(z=1),cA=1;break;case 3:j=-(z=1),cA=-(aA=1)}if(ar[Q>>2]=aA,ar[4+Q>>2]=cA,ar[X>>2]=j,ar[X+4>>2]=z,p=0|sr(j,a),m=0-z&a,tr[_>>0]=0|tr[fA+(24*iA|0)+9+(f<<2)>>0],tr[1+_>>0]=0|tr[fA+(24*iA|0)+9+(f<<2)+1>>0],tr[2+_>>0]=0,tr[3+_>>0]=0|tr[fA+(24*iA|0)+9+(f<<2)+2>>0],tr[4+_>>0]=0|tr[fA+(24*iA|0)+9+(f<<2)+3>>0],(0|R)<=0)ur=S;else{u=0<(0|Y),s=A+5480|0,b=A+10368|0,d=A+10372|0,k=A+10376|0,h=A+10360|0,w=Y+-1|0,v=R+-1|0,g=A+5977|0,$=A+10308|0,AA=(0|sr(J>>tA,W))+(D>>y)|0,K=0;A:for(;;){if(rA=o+((0|sr(eA=K+J|0,a))+D)|0,iA=c+((0|sr(eA,l))+D)|0,u){fA=eA<<uA,f=0==(0|K),nA=(0|K)==(0|v),q=0;do{if(I&&0!=(0|tr[s>>0])){if(i=q+D<<lA>>(e=0|ar[b>>2]),e=fA>>e,(0|i)<=-1){sA=23;break A}if((0|(r=0|ar[d>>2]))<=(0|i)){sA=23;break A}if((0|e)<=-1){sA=26;break A}if((0|e)>=(0|ar[k>>2])){sA=26;break A}A=(0|ar[h>>2])+(3*((0|sr(r,e))+i|0)|0)|0,1024&(cr[A>>0]|cr[A+1>>0]<<8)||(sA=28)}else sA=28;e:do{if(28==(0|sA)){if(i=(A=(L=q+D|(sA=0))<<lA)>>(e=0|ar[b>>2]),e=fA>>e,(0|i)<=-1){sA=30;break A}if((0|(r=0|ar[d>>2]))<=(0|i)){sA=30;break A}if((0|e)<=-1){sA=33;break A}if((0|e)>=(0|ar[k>>2])){sA=33;break A}if(P=(0|ar[h>>2])+(3*((0|sr(r,e))+i|0)|0)|0,!(2048&(cr[P>>0]|cr[P+1>>0]<<8))){if(nA|(0|q)==(0|w)|f|0==(0|q)){t=0;do{if(H=(0|ar[Q+(t<<2)>>2])+L|0,!((0|(x=(0|ar[X+(t<<2)>>2])+eA|0))<(0|E)&(0|H)<(0|B)&-1<(x|H|0)))break e;if(e=x<<uA>>(n=0|ar[G>>2]),(0|(i=H<<lA>>n))<=-1){sA=39;break A}if((0|(j=0|ar[F>>2]))<=(0|i)){sA=39;break A}if((0|e)<=-1){sA=42;break A}if((0|(z=0|ar[V>>2]))<=(0|e)){sA=42;break A}if(i=(P=0|ar[N>>2])+(24*((0|sr(j,e))+i|0)|0)+2|0,i=0|lr[i>>1],O=U=0|ar[Z>>2],i>>>0>=(0|ar[C>>2])-U>>2>>>0){sA=59;break A}if(!(e=0|ar[O+(i<<2)>>2])){sA=59;break A}if((0|(r=0|ar[e+800>>2]))<(0|oA)){if(i=fA>>n,!(-1<(0|(U=A>>n))&(0|U)<(0|j))){sA=47;break A}if(!(-1<(0|i)&(0|i)<(0|z))){sA=49;break A}if(P=P+(24*((0|sr(j,i))+U|0)|0)+2|0,!(0|tr[764+(0|ar[O+(lr[P>>1]<<2)>>2])>>0]))break e}if((0|oA)<(0|r)&&0==(0|tr[e+764>>0]))break e;if(0==(0|tr[g>>0])&&(z=(0|sr(x>>tA,W))+(H>>y)|0,P=0|ar[$>>2],(0|ar[P+(z<<2)>>2])!=(0|ar[P+(AA<<2)>>2])))break e;t=t+1|0}while((0|t)<2)}P=(A=0|cr[rA+q>>0])-(0|cr[rA+(q+p+aA)>>0])|0,L=A-(0|cr[rA+(q+m+cA)>>0])|0,A=(0|tr[((0|P)<0?1:0|P?3:2)+((0|L)<0?-1:0!=(0|L)&1)+_>>0])+A|0,tr[iA+q>>0]=(0|A)<0?0:255&((0|A)<(0|T)?A:M)}}}while(0);q=q+1|0}while((0|q)<(0|Y))}if((0|R)<=(0|(K=K+1|0))){sA=59;break}}if(23==(0|sA))br(41808,41845,118,41865);else if(26==(0|sA))br(41869,41845,119,41865);else if(30==(0|sA))br(41808,41845,118,41865);else if(33==(0|sA))br(41869,41845,119,41865);else if(39==(0|sA))br(41808,41845,118,41865);else if(42==(0|sA))br(41869,41845,119,41865);else if(47==(0|sA))br(41808,41845,118,41865);else if(49==(0|sA))br(41869,41845,119,41865);else if(59==(0|sA))return void(ur=S)}}else{for(i=0|cr[fA+(24*iA|0)+6+f>>0],r=(e=Q)+128|0;(0|(e=e+4|(ar[e>>2]=0)))<(0|r););ar[Q+((31&i)<<2)>>2]=1,ar[Q+((i+1&31)<<2)>>2]=2,ar[Q+((i+2&31)<<2)>>2]=3,ar[Q+((i+3&31)<<2)>>2]=4,rA=P+-5|0,i=0<(0|R);A:do{if(I){if(i){K=0<(0|Y),q=A+5480|0,$=A+10368|0,AA=A+10372|0,eA=A+10376|0,L=A+10360|0,A=7<(0|rA),P=0;e:for(;;){r:do{if(K){if(z=(H=P+J|0)<<uA,t=0|sr(H,a),H=0|sr(H,l),A)for(H=0==(0|tr[q>>0]),j=-1<(0|(x=z>>(t=0|ar[$>>2]))),n=-1<(0|(O=z>>t)),U=0;;){if(i=U+D<<lA,H)sA=79;else{if((0|(e=i>>t))<=-1){sA=88;break e}if((0|(r=0|ar[AA>>2]))<=(0|e)){sA=88;break e}if(!n){sA=91;break e}if((0|O)>=(0|ar[eA>>2])){sA=91;break e}cA=(0|ar[L>>2])+(3*((0|sr(r,O))+e|0)|0)|0,1024&(cr[cA>>0]|cr[cA+1>>0]<<8)||(sA=79)}if(79==(0|sA)){if(((sA=0)|(i>>=t))<=-1){sA=95;break e}if((0|i)>=(0|ar[AA>>2])){sA=95;break e}if(!j){sA=98;break e}if((0|x)>=(0|ar[eA>>2])){sA=98;break e}}if((0|Y)<=(0|(U=U+1|0)))break r}else n=0;do{if(i=(x=n+D|0)<<lA,O=0|ar[$>>2],0|tr[q>>0]){if(r=z>>O,(0|(e=i>>O))<=-1){sA=88;break e}if((0|(U=0|ar[AA>>2]))<=(0|e)){sA=88;break e}if((0|r)<=-1){sA=91;break e}if((0|r)>=(0|ar[eA>>2])){sA=91;break e}cA=(0|ar[L>>2])+(3*((0|sr(U,r))+e|0)|0)|0,1024&(cr[cA>>0]|cr[cA+1>>0]<<8)||(sA=93)}else sA=93;do{if(93==(0|sA)){if(r=i>>O,i=z>>O,((sA=0)|r)<=-1){sA=95;break e}if((0|(e=0|ar[AA>>2]))<=(0|r)){sA=95;break e}if((0|i)<=-1){sA=98;break e}if((0|i)>=(0|ar[eA>>2])){sA=98;break e}if(cA=(0|ar[L>>2])+(3*((0|sr(e,i))+r|0)|0)|0,2048&(cr[cA>>0]|cr[cA+1>>0]<<8))break;if(i=0|cr[o+(x+t)>>0],(0|(e=0|ar[Q+(i>>>rA<<2)>>2]))<=0)break;cA=(0|tr[e+-1+(fA+(24*iA|0)+9+(f<<2))>>0])+i|0,tr[c+(x+H)>>0]=(0|cA)<0?0:255&((0|cA)<(0|T)?cA:M)}}while(0);n=n+1|0}while((0|n)<(0|Y))}}while(0);if((0|R)<=(0|(P=P+1|0)))break A}88==(0|sA)?br(41808,41845,118,41865):91==(0|sA)?br(41869,41845,119,41865):95==(0|sA)?br(41808,41845,118,41865):98==(0|sA)&&br(41869,41845,119,41865)}}else if(i&&(L=7<(0|rA),0<(0|Y))){e=0;do{if(r=0|sr(U=e+J|0,a),U=0|sr(U,l),!L)for(i=0;n=0|cr[o+((O=i+D|0)+r)>>0],0<(0|(t=0|ar[Q+(n>>>rA<<2)>>2]))&&(sA=(0|tr[t+-1+(fA+(24*iA|0)+9+(f<<2))>>0])+n|0,tr[c+(O+U)>>0]=(0|sA)<0?0:255&((0|sA)<(0|T)?sA:M)),(0|(i=i+1|0))<(0|Y););e=e+1|0}while((0|e)<(0|R))}}while(0);ur=S}else ur=S}function Cn(A,e){A|=0;var r=0;switch(0|(e|=0)){case 0:e=6140,r=4;break;case 1:e=6168,r=4;break;case 2:e=6112,r=4;break;default:e=0}return 4==(0|r)&&(e=0|ar[e+(A<<2)>>2]),0|e}function Wn(A,e){e|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0;if(ur=(X=ur)+208|0,j=X+24|0,V=X+8|0,t=(G=X)+40|0,w=X+192|0,132!=(0|ar[(A|=0)>>2]))return ur=X,(j=0)|j;if(!(0|tr[512+(0|ar[e+10332>>2])>>0]))return ur=X,(j=0)|j;if(!(0|tr[e+100>>0]))return ur=X,(j=0)|j;r=0==(0|ar[e+1240>>2])?1:3,i=e+32|0,f=e+24|0,n=e+36|0,o=e+28|0,a=e+40|0,c=e+44|0,l=A+8|0,u=e+5760|0,s=e+5768|0,b=1+w|0,d=2+w|0,k=3+w|0,h=4+w|0,v=5+w|0,g=6+w|0,m=7+w|0,p=8+w|0,y=9+w|0,Z=10+w|0,C=11+w|0,W=12+w|0,I=13+w|0,B=14+w|0,E=15+w|0,x=0;A:for(;;){switch(S=0|ar[((F=0==(0|x))?f:i)>>2],O=0|ar[(F?o:n)>>2],U=0|ar[e+4+(x<<2)>>2],M=0|ar[(F?a:c)>>2],0|ar[l>>2]){case 0:_=0|ar[(F?u:s)>>2],Tt(t);e:do{if(0<(0|O)){if(D=S<<1,Q=(0|S)<0?-1:D,(0|_)<=8)for(_=0;;)if(Mt(t,U+(0|sr(_,M))|0,S),(0|O)<=(0|(_=_+1|0))){_=0;break e}if(0<(0|S))_=J=0;else for(_=F=0;;)if(Mt(t,N=_||(_=0|Gl(Q)),D),(0|O)<=(0|(F=F+1|0)))break e;do{for(N=_||(_=0|Gl(Q)),R=0|sr(J,M),Y=_,F=0;z=U+(F+R<<1)|0,tr[N+(T=F<<1)>>0]=or[z>>1],tr[Y+(1|T)>>0]=(0|lr[z>>1])>>>8,(0|(F=F+1|0))!=(0|S);)N=Y;Mt(t,Y,D),J=J+1|0}while((0|J)<(0|O))}else _=0}while(0);if(Qo(w,t),0|_&&Xl(_),(0|tr[w>>0])!=(0|tr[A+12+(x<<4)>>0])){H=22;break A}if((0|tr[b>>0])!=(0|tr[A+12+(x<<4)+1>>0])){H=22;break A}if((0|tr[d>>0])!=(0|tr[A+12+(x<<4)+2>>0])){H=22;break A}if((0|tr[k>>0])!=(0|tr[A+12+(x<<4)+3>>0])){H=22;break A}if((0|tr[h>>0])!=(0|tr[A+12+(x<<4)+4>>0])){H=22;break A}if((0|tr[v>>0])!=(0|tr[A+12+(x<<4)+5>>0])){H=22;break A}if((0|tr[g>>0])!=(0|tr[A+12+(x<<4)+6>>0])){H=22;break A}if((0|tr[m>>0])!=(0|tr[A+12+(x<<4)+7>>0])){H=22;break A}if((0|tr[p>>0])!=(0|tr[A+12+(x<<4)+8>>0])){H=22;break A}if((0|tr[y>>0])!=(0|tr[A+12+(x<<4)+9>>0])){H=22;break A}if((0|tr[Z>>0])!=(0|tr[A+12+(x<<4)+10>>0])){H=22;break A}if((0|tr[C>>0])!=(0|tr[A+12+(x<<4)+11>>0])){H=22;break A}if((0|tr[W>>0])!=(0|tr[A+12+(x<<4)+12>>0])){H=22;break A}if((0|tr[I>>0])!=(0|tr[A+12+(x<<4)+13>>0])){H=22;break A}if((0|tr[B>>0])!=(0|tr[A+12+(x<<4)+14>>0])){H=22;break A}if((0|tr[E>>0])==(0|tr[A+12+(x<<4)+15>>0]))break;H=22;break A;case 1:e:do{if(0<(0|O)){if(Q=S<<1,T=(0|S)<0?-1:Q,_=0<(0|S),(0|ar[(F?u:s)>>2])<=8){if(!_){_=7439,H=39;break}for(F=0,_=7439;;){for(R=U+(0|sr(F,M))|0,N=0;H=65535&_,z=cr[R+N>>0]^H>>>8,_=((z^=z>>>4)|H<<8)^z<<5^z<<12,(0|(N=N+1|0))!=(0|S););if((0|(F=F+1|0))==(0|O)){H=39;break e}}}if(_){_=7439,F=D=0;do{for(R=F||(F=0|Gl(T)),Y=0|sr(D,M),J=F,N=0;;){if(P=U+(N+Y<<1)|0,tr[R+(z=N<<1)>>0]=or[P>>1],tr[J+(1|z)>>0]=(0|lr[P>>1])>>>8,(0|(N=N+1|0))==(0|S)){N=0;break}R=J}for(;z=65535&_,P=cr[J+N>>0]^z>>>8,_=((P^=P>>>4)|z<<8)^P<<5^P<<12,(0|(N=N+1|0))<(0|Q););D=D+1|0}while((0|D)!=(0|O))}else{for(F=_=0;F=F||0|Gl(T),(0|(_=_+1|0))!=(0|O););_=7439}_&=65535,F&&Xl(F)}else _=7439,H=39}while(0);if(39==(0|H)&&(H=0,_&=65535),(0|_)==(0|(F=0|lr[A+60+(x<<1)>>1])))break;H=43;break A;case 2:if(_=0<(0|S)&0<(0|O),(0|ar[(F?u:s)>>2])<9)if(_){_=F=0;do{for(R=F>>>8^F,Y=0|sr(F,M),N=0;_=(255&(R^N^N>>>8)^cr[U+(N+Y)>>0])+_|0,(0|(N=N+1|0))!=(0|S););F=F+1|0}while((0|F)!=(0|O))}else _=0;else if(_){_=N=0;do{for(R=N>>>8^N,Y=0|sr(N,M),F=0;_=(P=255&(R^F^F>>>8))+_+(P^cr[U+(F+Y)>>0])|0,(0|(F=F+1|0))!=(0|S););N=N+1|0}while((0|N)!=(0|O))}else _=0;if((0|_)==(0|(F=0|ar[A+68+(x<<2)>>2])))break;H=54;break A}if((0|r)<=(0|(x=x+1|0))){_=0,H=71;break}}return 22==(0|H)?(P=0|ar[2255],ar[G>>2]=ar[e+92>>2],xa(P,32410,G),ur=X,0|(P=5)):43==(0|H)?(P=0|ar[2255],z=0|ar[e+92>>2],ar[V>>2]=F,ar[4+V>>2]=_,ar[8+V>>2]=z,xa(P,32453,V),ur=X,0|(P=5)):54==(0|H)?(P=0|ar[2255],z=0|ar[e+92>>2],ar[j>>2]=F,ar[j+4>>2]=_,ar[j+8>>2]=z,xa(P,32453,j),ur=X,0|(P=5)):71==(0|H)?(ur=X,0|_):0}function In(A){var e,r,i,f=0,n=0,t=0,o=0,a=0;if(e=(o=0|ar[(A|=0)+18596>>2])+5932|0,n=0|ar[(r=A+18600|0)>>2],!(0|tr[n+12>>0]))return 3<=(f=0|ar[n+796>>2])>>>0&&br(32537,32568,1508,32577),Ct(A+18580|0,f,0|ar[n+792>>2]),tr[(A=A+18588|0)>>0]=0,tr[A+1>>0]=0,tr[A+2>>0]=0,(tr[A+3>>0]=0)|(A=1);if(t=0|ar[n+16>>2],f=0|lr[(0|ar[o+10340>>2])+(24*(0|ar[(0|ar[o+10284>>2])+((0|ar[(0|ar[o+10272>>2])+(t<<2)>>2])-1<<2)>>2])|0)+2>>1],n=0|ar[o+48>>2],f>>>0>=(0|ar[o+52>>2])-n>>2>>>0)return(A=0)|A;if(i=0|ar[n+(f<<2)>>2],0|Yo(e,(0|t)%(0|(o=0|ar[o+5820>>2]))|0,(0|t)/(0|o)|0))return f=0|ar[r>>2],3<=(n=0|ar[f+796>>2])>>>0&&br(32537,32568,1508,32577),Ct(A+18580|0,n,0|ar[f+792>>2]),tr[(A=A+18588|0)>>0]=0,tr[A+1>>0]=0,tr[A+2>>0]=0,(tr[A+3>>0]=0)|(A=1);if(t=0|ar[A+18604>>2],n=0|ar[A+18608>>2],o=0|ar[t+10632>>2],!(1<(t=(0|ar[t+10636>>2])-o>>2)>>>0))return(A=0)|A;for(f=1;(0|ar[o+(f<<2)>>2])!=(0|n);)if(t>>>0<=(f=f+1|0)>>>0){f=0,a=16;break}return 16==(0|a)?0|f:(f=0|ar[o+(f+-1<<2)>>2])?(Pn(f+44|0,0|ar[f+124>>2]),0|tr[1340+i>>0]?(Et(A+18580|0,a=1332+i|0),It(a),0|(A=1)):(A=0)|A):(A=0)|A}function Bn(A,e,r){e|=0,r|=0;var i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0;g=0|ar[(G=(A|=0)+18596|0)>>2],h=0|ar[g+5820>>2],v=0|ar[(w=A+12|0)>>2],k=g+5965|0;do{if(!r&&0<(0|v)&0!=(0|tr[k>>0])&&0==(0|ar[A+8>>2])){if(r=v+-1|0,1<(0|h)){if(E=0|ar[(v=A+18604|0)>>2],r>>>0<(0|ar[E+10680>>2])-(0|ar[E+10676>>2])>>3>>>0){ho(g,0|ar[A+18612>>2],1,r,1),Et(A+18580|0,(0|ar[10676+(0|ar[v>>2])>>2])+((0|ar[w>>2])-1<<3)|0),It((0|ar[10676+(0|ar[v>>2])>>2])+((0|ar[w>>2])-1<<3)|0);break}return 0|(G=2)}if(ho(g,0|ar[A+18612>>2],0,r,1),r=0|ar[A+18600>>2],(v=0|ar[r+796>>2])>>>0<3){Ct(A+18580|0,v,0|ar[r+792>>2]),tr[(E=A+18588|0)>>0]=0,tr[E+1>>0]=0,tr[E+2>>0]=0,tr[E+3>>0]=0;break}br(32537,32568,1508,32577)}}while(0);for(f=A+8|0,n=h-1|0,t=A+18612|0,o=A+18580|0,a=A+18584|0,c=g+5828|0,l=A+18604|0,E=A+18556|0,u=g+5935|0,s=A+18600|0,b=A+4|0,d=g+5966|0,i=g+10296|0,I=0|ar[w>>2],y=0|ar[f>>2],B=0|ar[G>>2];;){if((v=(0|sr(I,h))+y|0)>>>0>=(0|ar[B+10276>>2])-(0|ar[B+10272>>2])>>2>>>0){r=2,v=35;break}if((0|y)>=(0|ar[B+5820>>2])){r=2,v=35;break}if((0|I)>=(0|ar[B+5828>>2])){r=2,v=35;break}if((0|y)<(0|n)&0<(0|I)&e&&ho(B,0|ar[t>>2],y+1|0,I+-1|0,1),!(0|ar[a>>2])){r=2,v=35;break}if(En(A),1==(0|y)&0!=(0|tr[k>>0])&&(0|I)<((0|ar[c>>2])-1|0)){if(B=0|ar[l>>2],r=0|ar[B+10676>>2],(0|ar[B+10680>>2])-r>>3>>>0<=I>>>0){r=2,v=35;break}Et(r+(I<<3)|0,o),Bt((0|ar[10676+(0|ar[l>>2])>>2])+(I<<3)|0)}if((C=0!=(0|(Z=0|ht(E))))&&0|tr[u>>0]&&(Et(1332+(0|ar[s>>2])|0,o),Bt(1332+(0|ar[s>>2])|0),tr[1340+(0|ar[s>>2])>>0]=1),Ln((0|ar[10524+(0|ar[G>>2])>>2])+(80*v|0)|0,1),W=0|ar[w>>2],p=(m=0|ar[b>>2])+1|0,ar[b>>2]=p,B=0|ar[G>>2],r=0|ar[B+5836>>2],v=0|ar[B+5820>>2],(0|p)<(0|r)?r=(g=0)|ar[(0|ar[B+10284>>2])+(p<<2)>>2]:g=1,I=(0|r)/(0|v)|0,y=(0|r)%(0|v)|0,ar[A>>2]=r,ar[f>>2]=y,ar[w>>2]=I,0==(0|Z)&g){v=27;break}if(C){r=0,v=35;break}if((r=0|tr[d>>0]?(r=0|ar[i>>2],(0|ar[r+(p<<2)>>2])!=(0|ar[r+(m<<2)>>2])):0)|(0|W)!=(0|I)&0!=(0|tr[k>>0])){v=32;break}}return 27==(0|v)?(Gr(4+(0|ar[A+18592>>2])|0,1004,0),tr[10516+(0|ar[G>>2])>>0]=3,0|(G=2)):32==(0|v)?0|ht(E)?(dt(E),0|(G=1)):(Gr(4+(0|ar[A+18592>>2])|0,1017,0),tr[10516+(0|ar[G>>2])>>0]=3,0|(G=2)):35==(0|v)?0|r:0}function En(A){var e,r,i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0;n=0|ar[(A|=0)+18600>>2],s=0|ar[A+18596>>2],a=(0|(c=0|ar[A>>2]))%(0|(b=0|ar[s+5820>>2]))|0,b=(0|c)/(0|b)|0,r=a<<(e=0|ar[(c=s+5804|0)>>2]),i=b<<e,f=0|ar[s+10352>>2],l=(0|sr(f,b))+a|0,t=0|ar[s+10340>>2],or[t+(24*l|0)>>1]=ar[800+n>>2],l=65535&ar[n>>2],o=r>>(u=0|ar[s+10348>>2]),u=i>>u,-1<(0|o)&(0|o)<(0|f)||br(41808,41845,128,41865),(0|u)<=-1&&br(41869,41845,129,41865),(0|u)>=(0|ar[s+10356>>2])&&br(41869,41845,129,41865),s=t+(24*((0|sr(f,u))+o|0)|0)+2|0,or[s>>1]=l,0!=(0|tr[325+n>>0])||0!=(0|tr[326+n>>0])?(function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0;ur=(n=ur)+32|0,i=n,a=0|ar[18600+(A|=0)>>2],f=0|ar[A+18596>>2],o=(t=i)+17|0;for(;tr[t>>0]=0,t=t+1|0,(0|t)<(0|o););t=0<(0|e)&&(G=0|sr(0|ar[5820+f>>2],r),E=0|ar[10308+f>>2],(0|ar[A>>2])>(0|ar[a+800>>2])&&(0|ar[E+(G+e<<2)>>2])==(0|ar[E+(e+-1+G<<2)>>2]))?255&(0|kt(A+18556|0,0|ar[A+18580>>2])):0;o=0<(0|r)&(E=t<<24>>24==0)&&(W=0|ar[5820+f>>2],B=(0|sr(W,r))+e|0,I=0|ar[10308+f>>2],G=I+((0|sr(W,r+-1|0))+e<<2)|0,((0|ar[A>>2])-W|0)>=(0|ar[a+800>>2])&&(0|ar[I+(B<<2)>>2])==(0|ar[G>>2]))?255&(0|kt(A+18556|0,0|ar[A+18580>>2])):0;if(G=o<<24>>24==0,!((o|t)<<24>>24)){W=0==(0|ar[5776+f>>2])?1:3,I=a+325|0,B=A+18556|0,g=A+18580|0,m=5760+f|0,p=5768+f|0,y=10087+f|0,Z=10088+f|0,C=i+1|0,v=a+326|0,t=o=w=0;do{if((s=0==(0|w))&0!=(0|tr[I>>0])||0<(0|w)&0!=(0|tr[v>>0])){do{if(s)o=0|kt(B,1+(0|ar[g>>2])|0)?(o=0==(0|wt(B)))?1:2:0,a=o,o&=255;else{if(1!=(0|w)){a=(255&o)>>>(w<<1)&3;break}A=0|kt(B,1+(0|ar[g>>2])|0)?(A=0==(0|wt(B)))?1:2:0,o=255&((a=A)<<4|A<<2|255&o)}}while(0);if(A=255&a){a=0|ar[(u=s?m:p)>>2],a=255&(0|vt(B,(1<<((0|a)<10?a:10)+-5)-1|0)),tr[(b=i+5+(w<<2)|0)>>0]=a,c=0|ar[u>>2],c=255&(0|vt(B,(1<<((0|c)<10?c:10)+-5)-1|0)),tr[(d=i+5+(w<<2)+1|0)>>0]=c,l=0|ar[u>>2],l=255&(0|vt(B,(1<<((0|l)<10?l:10)+-5)-1|0)),tr[(k=i+5+(w<<2)+2|0)>>0]=l,u=0|ar[u>>2],u=255&(0|vt(B,(1<<((0|u)<10?u:10)+-5)-1|0)),tr[(h=i+5+(w<<2)+3|0)>>0]=u;do{if(1==(0|A))A=a<<24>>24?(A=0!=(0|wt(B)))?-1:1:0,c=c<<24>>24?(c=0!=(0|wt(B)))?-1:1:0,l=l<<24>>24?(l=0!=(0|wt(B)))?-1:1:0,a=u<<24>>24?(a=0!=(0|wt(B)))?-1:1:0,u=255&(0|gt(B,5)),tr[i+2+w>>0]=u,s?u=y:V=30;else{if(s){u=y,a=l=-(c=A=1),t=255&(0|gt(B,2));break}V=(1==(0|w)?(V=255&(0|gt(B,2)),l=a=-1,A=c=1,t=255&(255&t|V<<2|V<<4)):(l=a=-1,A=c=1),30)}}while(0);30==(0|V)&&(V=0,u=Z),s=0|cr[u>>0],u=255&(0|sr(tr[b>>0]<<s,A)),tr[b>>0]=u,b=255&(0|sr(tr[d>>0]<<s,c)),tr[d>>0]=b,d=255&(0|sr(tr[k>>0]<<s,l)),tr[k>>0]=d,k=255&(0|sr(tr[h>>0]<<s,a)),tr[h>>0]=k}}w=w+1|0}while((0|w)<(0|W));for(tr[i>>0]=o,tr[C>>0]=t,t=(0|sr(0|ar[10352+f>>2],r))+e|0,t=(0|ar[10340+f>>2])+(24*t|0)+4|0,o=t+17|0;tr[t>>0]=0|tr[i>>0],i=i+1|0,(0|(t=t+1|0))<(0|o););}if(!E)for(i=0|sr(0|ar[10352+f>>2],r),o=0|ar[10340+f>>2],t=o+(24*(i+e|0)|0)+4|0,i=o+(24*(e+-1+i|0)|0)+4|0,o=t+17|0;tr[t>>0]=0|tr[i>>0],i=i+1|0,(0|(t=t+1|0))<(0|o););if(G)return ur=n;t=0|ar[10352+f>>2],i=(0|sr(t,r+-1|0))+e|0,o=0|ar[10340+f>>2],t=o+(24*((0|sr(t,r))+e|0)|0)+4|0,i=o+(24*i|0)+4|0,o=t+17|0;for(;tr[t>>0]=0|tr[i>>0],t=t+1|0,i=i+1|0,(0|t)<(0|o););ur=n}(A,a,b,0),Gn(A,r,i,b=0|ar[c>>2],0)):Gn(A,r,i,b=e,0)}function Gn(A,e,r,i,f){var n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0;for(t=(A|=0)+18596|0,o=A+18600|0,a=A+18516|0,c=A+18508|0,g=A+18512|0,b=A+18556|0,n=A+18580|0,C=e|=0,Z=r|=0,p=i|=0,y=f|=0;;){if(m=0|ar[t>>2],((e=1<<p)+C|0)<=(0|(r=0|ar[(s=m+1248|0)>>2]))&&(e+Z|0)<=(0|(d=0|ar[m+1252>>2]))&&(0|ar[m+5800>>2])<(0|p)){if(e=-1<((i=C+-1|0)|Z|0)&(0|C)<=(0|r)&(0|Z)<(0|d)&&(h=0|ar[m+5804>>2],k=(u=0|sr(Z>>h,0|ar[m+5820>>2]))+(C>>h)|0,h=u+(i>>h)|0,u=0|ar[m+10340>>2],(0|or[u+(24*k|0)>>1])==(0|or[u+(24*h|0)>>1]))?(e=0|ar[m+10308>>2],(0|ar[e+(k<<2)>>2])==(0|ar[e+(h<<2)>>2])&1):0,l=(0|r)<=(0|C)|((u=Z+-1|0)|C|0)<0|(0|d)<(0|Z)||(f=0|ar[m+5804>>2],l=0|ar[m+5820>>2],v=C>>f,w=(0|sr(Z>>f,l))+v|0,v=(0|sr(u>>f,l))+v|0,l=0|ar[m+10340>>2],(0|or[l+(24*w|0)>>1])!=(0|or[l+(24*v|0)>>1]))?0:(l=0|ar[m+10308>>2],(0|ar[l+(w<<2)>>2])==(0|ar[l+(v<<2)>>2])&1),e){if(e=i>>(r=0|ar[m+10368>>2]),r=Z>>r,(0|e)<=-1){e=14;break}if((0|(i=0|ar[m+10372>>2]))<=(0|e)){e=14;break}if((0|r)<=-1){e=17;break}if((0|r)>=(0|ar[m+10376>>2])){e=17;break}f=(0|ar[m+10360>>2])+(3*((0|sr(i,r))+e|0)|0)|0,f=((65535&(cr[f>>0]|cr[f+1>>0]<<8))>>>6&3|0)>(0|y)?3:2}else f=2;if(l){if(i=C>>(r=0|ar[m+10368>>2]),r=u>>r,(0|i)<=-1){e=22;break}if((0|(e=0|ar[m+10372>>2]))<=(0|i)){e=22;break}if((0|r)<=-1){e=25;break}if((0|r)>=(0|ar[m+10376>>2])){e=25;break}e=(0|ar[m+10360>>2])+(3*((0|sr(e,r))+i|0)|0)|0,e=((65535&(cr[e>>0]|cr[e+1>>0]<<8))>>>6&3|0)>(0|y)&1}else e=0;e=0|kt(b,(0|ar[n>>2])+(e+f)|0)}else e=(0|ar[m+5800>>2])<(0|p)&1;if(0|tr[m+5946>>0]&&(0|ar[m+10092>>2])<=(0|p)&&(ar[c>>2]=0,ar[g>>2]=0),0|tr[752+(0|ar[o>>2])>>0]&&(0|ar[m+10096>>2])<=(0|p)&&(ar[a>>2]=0),!e){e=42;break}if(i=(f=1<<(r=p+-1|0))+C|0,f=f+Z|0,Gn(A,C,Z,r,l=y+1|0),(0|i)<(0|ar[s>>2])&&Gn(A,i,Z,r,l),(0|f)<(0|ar[(e=m+1252|0)>>2])&&Gn(A,C,f,r,l),(0|i)>=(0|ar[s>>2])){e=48;break}if(!((0|f)<(0|ar[e>>2]))){e=48;break}C=i,Z=f,p=r,y=l}if(14==(0|e))br(41808,41845,118,41865);else if(17==(0|e))br(41869,41845,119,41865);else if(22==(0|e))br(41808,41845,118,41865);else if(25==(0|e))br(41869,41845,119,41865);else{if(42==(0|e)){if(s=C>>(g=0|ar[m+10368>>2]),r=Z>>g,b=(e=1<<(g=p-g|0))+r|0,31!=(0|g)){l=e+s|0,u=m+10372|0,i=m+10360|0,f=(65535&y)<<6&192,e=r;do{for(r=s;m=(0|sr(0|ar[u>>2],e))+r|0,m=(0|ar[i>>2])+(3*m|0)|0,g=-193&(cr[m>>0]|cr[m+1>>0]<<8)|f,tr[m>>0]=g,tr[m+1>>0]=g>>8,(0|(r=r+1|0))<(0|l););e=e+1|0}while((0|e)<(0|b))}return void function(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0;if(ur=(c=ur)+80|0,n=(D=c)+56|0,t=c+40|0,o=c+24|0,a=0|ar[(G=18596+(A|=0)|0)>>2],v=0|ar[(W=A+18600|0)>>2],function(A,e,r,i,f){e|=0,r|=0,i|=0;var n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(n=10368+(A|=0)|0,(f|=0)&&(c=0|ar[n>>2],s=e>>c,l=r>>c,u=(t=1<<(c=i-c|0))+l|0,31!=(0|c))){o=t+s|0,a=A+10372|0,c=A+10360|0,t=l;do{for(f=s;l=(0|sr(0|ar[a>>2],t))+f|0,l=(0|ar[c>>2])+(3*l|0)|0,b=-8&(cr[l>>0]|cr[l+1>>0]<<8),tr[l>>0]=b,tr[l+1>>0]=b>>8,(0|(f=f+1|0))<(0|o););t=t+1|0}while((0|t)<(0|u))}t=0|ar[n>>2],o=e>>t,t=r>>t,(0|o)<=-1&&br(41808,41845,128,41865);f=0|ar[A+10372>>2],(0|f)<=(0|o)&&br(41808,41845,128,41865);(0|t)<=-1&&br(41869,41845,129,41865);{if((0|t)<(0|ar[A+10376>>2]))return b=(0|ar[A+10360>>2])+(3*((0|sr(f,t))+o|0)|0)|0,i=-8&(cr[b>>0]|cr[b+1>>0]<<8)|7&i,tr[b>>0]=i,tr[b+1>>0]=i>>8;br(41869,41845,129,41865)}}(a,e,r,i,1),Q=0|ar[10448+a>>2],h=e>>Q,u=r>>Q,w=(l=1<<(Q=i-Q|0))+u|0,31!=(0|Q)){s=l+h|0,d=10452+a|0,k=10440+a|0,l=u;do{for(u=h;Q=(0|sr(0|ar[d>>2],l))+u|0,((tr[(0|ar[k>>2])+Q>>0]=0)|(u=u+1|0))<(0|s););l=l+1|0}while((0|l)<(0|w))}Q=1<<i,At(A,e,r,e,r),0|tr[5964+a>>0]?(J=0|kt(A+18556|0,161+(0|ar[A+18580>>2])|0),0|(tr[A+32>>0]=J)&&function(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t,o=0,a=0,c=0,l=0,u=0,s=0;if(l=0|ar[10368+(A|=0)>>2],t=e>>l,u=r>>l,n=(i=1<<(l=i-l|0))+u|0,31!=(0|l)){a=i+t|0,c=A+10372|0,l=A+10360|0,o=(1&f)<<11&65535,i=u;do{for(f=t;u=(0|sr(0|ar[c>>2],i))+f|0,u=(0|ar[l>>2])+(3*u|0)|0,s=-2049&(cr[u>>0]|cr[u+1>>0]<<8)|o,tr[u>>0]=s,tr[u+1>>0]=s>>8,(0|(f=f+1|0))<(0|a););i=i+1|0}while((0|i)<(0|n))}i=0|ar[A+10348>>2],o=e>>i,i=r>>i,(0|o)<=-1&&br(41808,41845,128,41865);f=0|ar[A+10352>>2],(0|f)<=(0|o)&&br(41808,41845,128,41865);(0|i)<=-1&&br(41869,41845,129,41865);{if((0|i)<(0|ar[A+10356>>2]))return s=(0|ar[A+10340>>2])+(24*((0|sr(f,i))+o|0)|0)+22|0,tr[s>>0]=1;br(41869,41845,129,41865)}}(a,e,r,i,1)):tr[A+32>>0]=0;w=v+20|0;do{if(2!=(0|ar[w>>2])){h=0|ar[G>>2],l=0<=((u=e+-1|0)|r|0)&&(0|ar[h+1248>>2])>=(0|e)&&(0|ar[h+1252>>2])>(0|r)&&(m=0|ar[h+5804>>2],J=0|sr(r>>m,0|ar[h+5820>>2]),g=J+(e>>m)|0,m=J+(u>>m)|0,J=0|ar[h+10340>>2],(0|or[J+(24*g|0)>>1])==(0|or[J+(24*m|0)>>1]))?(l=0|ar[h+10308>>2],(0|ar[l+(g<<2)>>2])==(0|ar[l+(m<<2)>>2])&1):0,d=0<=((k=r+-1|0)|e|0)&&(0|ar[h+1248>>2])>(0|e)&&(0|ar[h+1252>>2])>=(0|r)&&(Y=0|ar[h+5804>>2],J=0|ar[h+5820>>2],y=e>>Y,p=(0|sr(r>>Y,J))+y|0,y=(0|sr(k>>Y,J))+y|0,J=0|ar[h+10340>>2],(0|or[J+(24*p|0)>>1])==(0|or[J+(24*y|0)>>1]))?(d=0|ar[h+10308>>2],(0|ar[d+(p<<2)>>2])==(0|ar[d+(y<<2)>>2])&1):0;do{if(l){if(J=0|ar[h+10368>>2],l=u>>J,u=r>>J,(0|l)<=-1&&br(41808,41845,118,41865),(0|(s=0|ar[h+10372>>2]))<=(0|l)&&br(41808,41845,118,41865),(0|u)<=-1&&br(41869,41845,119,41865),(0|u)<(0|ar[h+10376>>2])){Z=(0|ar[h+10360>>2])+(3*((0|sr(s,u))+l|0)|0)|0,Z=512==(768&(cr[Z>>0]|cr[Z+1>>0]<<8))?6:5;break}br(41869,41845,119,41865)}else Z=5}while(0);do{if(d){if(l=0|ar[h+10368>>2],s=e>>l,l=k>>l,(0|s)<=-1&&br(41808,41845,118,41865),(0|(u=0|ar[h+10372>>2]))<=(0|s)&&br(41808,41845,118,41865),(0|l)<=-1&&br(41869,41845,119,41865),(0|l)<(0|ar[h+10376>>2])){C=(0|ar[h+10360>>2])+(3*((0|sr(u,l))+s|0)|0)|0,C=512==(768&(cr[C>>0]|cr[C+1>>0]<<8))&1;break}br(41869,41845,119,41865)}else C=0}while(0);if(!((255&(0|kt(u=A+18556|0,(0|ar[(l=A+18580|0)>>2])+(C+Z)|0)))<<24>>24)){if(2==(0|ar[w>>2])){J=0;break}J=0==(0|kt(u,149+(0|ar[l>>2])|0))&1;break}A:do{if(2<=(0|ar[804+(0|ar[W>>2])>>2])&&0!=(0|kt(u,148+(0|ar[l>>2])|0)))if(1<((0|ar[804+(0|ar[W>>2])>>2])-1|0)){l=1;do{if(!(0|wt(u)))break A;l=l+1|0}while((0|l)<((0|ar[804+(0|ar[W>>2])>>2])-1|0))}else l=1;else l=0}while(0);if(tr[(s=A+26|0)>>0]=15&tr[s>>0]|(255&l)<<5&255|16,s=0|ar[(l=10368+a|0)>>2],u=e>>s,s=r>>s,(0|u)<=-1&&br(41808,41845,128,41865),(0|(b=0|ar[(h=10372+a|0)>>2]))<=(0|u)&&br(41808,41845,128,41865),(0|s)<=-1&&br(41869,41845,129,41865),(0|s)>=(0|ar[10376+a>>2])&&br(41869,41845,129,41865),D=(0|ar[(k=10360+a|0)>>2])+(3*((0|sr(b,s))+u|0)|0)|0,d=-57&(cr[D>>0]|cr[D+1>>0]<<8),tr[D>>0]=d,tr[D+1>>0]=d>>8,D=0|ar[l>>2],d=e>>D,u=r>>D,b=(l=1<<(D=i-D|0))+u|0,31!=(0|D)){s=l+d|0,l=u;do{for(u=d;D=(0|sr(0|ar[h>>2],l))+u|0,D=(0|ar[k>>2])+(3*D|0)|0,i=-769&(cr[D>>0]|cr[D+1>>0]<<8)|512,tr[D>>0]=i,tr[D+1>>0]=i>>8,(0|(u=u+1|0))<(0|s););l=l+1|0}while((0|l)<(0|b))}return zo(0|ar[A+18592>>2],0|ar[W>>2],0|ar[G>>2],A+16|0,e,r,0,0,Q,Q,Q,0),ur=c}J=0}while(0);if(Y=0|ar[(g=10368+a|0)>>2],w=e>>Y,u=r>>Y,v=(l=1<<(Y=i-Y|0))+u|0,31!=(0|Y)){s=l+w|0,d=10372+a|0,k=10360+a|0,h=(65535&J)<<8&65535,l=u;do{for(u=w;Y=(0|sr(0|ar[d>>2],l))+u|0,Y=(0|ar[k>>2])+(3*Y|0)|0,R=-769&(cr[Y>>0]|cr[Y+1>>0]<<8)|h,tr[Y>>0]=R,tr[Y+1>>0]=R>>8,(0|(u=u+1|0))<(0|s););l=l+1|0}while((0|l)<(0|v))}if((Y=0!=(0|J))||(0|ar[5800+a>>2])==(0|i)){u=0|ar[G>>2],h=0==(0|J),l=0|kt(s=A+18556|0,8+(0|ar[(d=A+18580|0)>>2])|0);do{if(h)b=0|l?0:3;else if(l)b=0;else{if(k=0|kt(s,9+(0|ar[d>>2])|0),(0|ar[u+5800>>2])>=(0|i)){if(0|k){b=1;break}if(3==(0|i)){b=2;break}b=3-(0|kt(s,10+(0|ar[d>>2])|0))|0;break}if(!(0|tr[u+5466>>0])){b=0|k?1:2;break}if(0|kt(s,11+(0|ar[d>>2])|0)){b=0|k?1:2;break}l=0|wt(s),0!=(0|k)&(u=0!=(0|l))?b=5:(s=0==(0|k))|u?l|k?s&u?b=7:br(49065,32568,1760,32601):b=6:b=4}}while(0);R=h&3==(0|b)&1}else b=R=0;u=0|ar[g>>2],l=e>>u,u=r>>u,(0|l)<=-1&&br(41808,41845,128,41865);s=0|ar[10372+a>>2],(0|s)<=(0|l)&&br(41808,41845,128,41865);(0|u)<=-1&&br(41869,41845,129,41865);(0|u)>=(0|ar[10376+a>>2])&&br(41869,41845,129,41865);F=(0|ar[10360+a>>2])+(3*((0|sr(s,u))+l|0)|0)|0,N=-57&(cr[F>>0]|cr[F+1>>0]<<8)|(65535&b)<<3&56,tr[F>>0]=N,tr[F+1>>0]=N>>8,F=0==(0|J),N=0==(0|b);A:do{if(F){if(N&&0|tr[5468+a>>0]&&(0|ar[5884+a>>2])<=(0|i)&&(0|ar[5888+a>>2])>=(0|i)&&0|ht(V=A+18556|0)){if(Vn(a,e,r,i,1),l=0|ar[(p=A+18560|0)>>2],ar[D>>2]=l,ar[D+4>>2]=(0|ar[A+18564>>2])-l,ar[(l=D+8|0)>>2]=0,ar[l+4>>2]=0,ar[D+16>>2]=0,l=0|ar[G>>2],s=0|ar[l+5760>>2],h=0|tr[l+5469>>0],k=0|ar[l+40>>2],l=0|ar[l+4>>2],u=(0|sr(k,r))+e|0,8<(0|s)){if(d=l+(u<<1)|0,b=s-h|0,31!=(0|i)){u=0;do{for(s=0|sr(u,k),l=0;i=(0|at(D,h))<<b&65535,or[d+(l+s<<1)>>1]=i,(0|(l=l+1|0))!=(0|Q););u=u+1|0}while((0|u)!=(0|Q))}}else if(d=l+u|0,b=s-h|0,31!=(0|i)){u=0;do{for(s=0|sr(u,k),l=0;i=(0|at(D,h))<<b&255,tr[d+(l+s)>>0]=i,(0|(l=l+1|0))!=(0|Q););u=u+1|0}while((0|u)!=(0|Q))}u=0|ar[G>>2];do{if(0|ar[u+5776>>2])if(w=0|ar[u+5768>>2],k=0|ar[u+5780>>2],h=(0|Q)/(0|k)|0,s=0|ar[u+5784>>2],v=(0|Q)/(0|s)|0,l=0|tr[u+5470>>0],m=l<<24>>24,g=0|ar[u+44>>2],b=0|ar[u+8>>2],d=(0|sr(g,(0|r)/(0|s)|0))+((0|e)/(0|k)|0)|0,8<(0|w)){if(b=b+(d<<1)|0,d=w-m|0,0<(0|h)&0<(0|v)){u=0;do{for(s=0|sr(u,g),l=0;i=(0|at(D,m))<<d&65535,or[b+(l+s<<1)>>1]=i,(0|(l=l+1|0))!=(0|h););u=u+1|0}while((0|u)!=(0|v));u=0|ar[G>>2],g=0|ar[u+44>>2],w=0|ar[u+5768>>2],b=0|ar[u+5780>>2],s=0|ar[u+5784>>2],l=0|tr[u+5470>>0]}else b=k;if(v=(0|Q)/(0|b)|0,h=(0|Q)/(0|s)|0,k=l<<24>>24,d=(0|ar[u+12>>2])+((0|sr((0|r)/(0|s)|0,g))+((0|e)/(0|b)|0)<<1)|0,s=w-k|0,!(0<(0|v)&0<(0|h)))break;u=0;do{for(b=0|sr(u,g),l=0;r=(0|at(D,k))<<s&65535,or[d+(l+b<<1)>>1]=r,(0|(l=l+1|0))!=(0|v););u=u+1|0}while((0|u)!=(0|h))}else{if(b=b+d|0,d=w-m|0,0<(0|h)&0<(0|v)){u=0;do{for(s=0|sr(u,g),l=0;i=(0|at(D,m))<<d&255,tr[b+(l+s)>>0]=i,(0|(l=l+1|0))!=(0|h););u=u+1|0}while((0|u)!=(0|v));u=0|ar[G>>2],g=0|ar[u+44>>2],w=0|ar[u+5768>>2],b=0|ar[u+5780>>2],s=0|ar[u+5784>>2],l=0|tr[u+5470>>0]}else b=k;if(v=(0|Q)/(0|b)|0,h=(0|Q)/(0|s)|0,k=l<<24>>24,d=(0|ar[u+12>>2])+((0|sr((0|r)/(0|s)|0,g))+((0|e)/(0|b)|0))|0,s=w-k|0,!(0<(0|v)&0<(0|h)))break;u=0;do{for(b=0|sr(u,g),l=0;r=(0|at(D,k))<<s&255,tr[d+(l+b)>>0]=r,(0|(l=l+1|0))!=(0|v););u=u+1|0}while((0|u)!=(0|h))}}while(0);return lt(D),ar[p>>2]=ar[D>>2],dt(V),ur=c}if(V=(X=3==(0|b))?(0|Q)/2|0:Q,X=(X<<31>>31)+i|0,!(G=31==(0|i))){b=A+18556|0,d=A+18580|0,u=l=0;do{for(s=0;W=0|kt(b,12+(0|ar[d>>2])|0),l=(f=l)+1|0,ar[D+(f<<2)>>2]=W,(0|(s=s+V|0))<(0|Q););u=u+V|0}while((0|u)<(0|Q))}if(u=0<=((l=e+-1|0)|r|0)&&(0|ar[1248+a>>2])>=(0|e)&&(0|ar[1252+a>>2])>(0|r)&&(B=0|ar[5804+a>>2],f=0|sr(r>>B,0|ar[5820+a>>2]),I=f+(e>>B)|0,B=f+(l>>B)|0,f=0|ar[10340+a>>2],(0|or[f+(24*I|0)>>1])==(0|or[f+(24*B|0)>>1]))?(u=0|ar[10308+a>>2],(0|ar[u+(I<<2)>>2])==(0|ar[u+(B<<2)>>2])&1):0,l=0<=((l=r+-1|0)|e|0)&&(0|ar[1248+a>>2])>(0|e)&&(0|ar[1252+a>>2])>=(0|r)&&(I=0|ar[5804+a>>2],B=0|ar[5820+a>>2],_=e>>I,E=(0|sr(r>>I,B))+_|0,_=(0|sr(l>>I,B))+_|0,B=0|ar[10340+a>>2],(0|or[B+(24*E|0)>>1])==(0|or[B+(24*_|0)>>1]))?(l=0|ar[10308+a>>2],(0|ar[l+(E<<2)>>2])==(0|ar[l+(_<<2)>>2])&1):0,!G){E=A+18556|0,B=0!=(0|u),v=0!=(0|l),g=5872+a|0,m=5876+a|0,p=10408+a|0,y=10412+a|0,Z=10400+a|0,C=4+o|0,W=8+o|0,l=h=0;do{f=h+r|0,I=v|0<(0|h),w=0;do{if(b=0|ar[D+(l<<2)>>2],s=b?(u=n,0|vt(E,2)):(u=t,0|gt(E,5)),ar[u+(l<<2)>>2]=s,_=w+e|0,k=0|ar[g>>2],k=(0|sr(f>>k,0|ar[m>>2]))+(_>>k)|0,Jt(o,_,f,k,B|0<(0|w),I,a),u=1==(0|b)?0|ar[o+(ar[n+(l<<2)>>2]<<2)>>2]:(u=0|ar[o>>2],(0|(s=0|ar[C>>2]))<(0|u)?(ar[o>>2]=s,ar[C>>2]=u,b=s):(b=u,u=s),(0|(s=0|ar[W>>2]))<(0|b)?(ar[o>>2]=s,ar[W>>2]=b,d=b):(d=s,s=b),(0|d)<(0|u)?(ar[C>>2]=d,ar[W>>2]=u,b=d):(b=u,u=d),_=0|ar[t+(l<<2)>>2],((0|u)<=(0|(_=((0|b)<=(0|(_=((0|s)<=(0|_)&1)+_|0))&1)+_|0))&1)+_|0),_=X-(0|ar[p>>2])|0,d=1<<_,31!=(0|_)){b=255&u,u=0;do{for(s=0;_=s+k+(0|sr(0|ar[y>>2],u))|0,tr[(0|ar[Z>>2])+_>>0]=b,(0|(s=s+1|0))<(0|d););u=u+1|0}while((0|u)<(0|d))}l=l+1|0,w=w+V|0}while((0|w)<(0|Q));h=h+V|0}while((0|h)<(0|Q))}d=5776+a|0;e:do{switch(0|ar[d>>2]){case 3:if(!G){h=A+18556|0,w=A+18580|0,v=10408+a|0,g=10412+a|0,m=10416+a|0,p=10400+a|0,k=0;r:for(;;){y=k+r|0,d=0;do{if(Z=d+e|0,b=0|kt(h,13+(0|ar[w>>2])|0)?0|gt(h,2):4,u=0|ar[v>>2],l=Z>>u,u=y>>u,(0|l)<=-1){l=174;break r}if((0|(s=0|ar[g>>2]))<=(0|l)){l=174;break r}if((0|u)<=-1){l=175;break r}if((0|u)>=(0|ar[m>>2])){l=175;break r}l=(0|ar[p>>2])+((0|sr(s,u))+l)|0,l=0|cr[l>>0],(u=4==(0|b))||(D=0|ar[6292+(b<<2)>>2],l=(0|D)==(0|l)?34:D),Xn(a,Z,y,X,l,u),d=d+V|0}while((0|d)<(0|Q));if((0|Q)<=(0|(k=k+V|0)))break e}174==(0|l)?br(41808,41845,118,41865):175==(0|l)&&br(41869,41845,119,41865)}break;case 0:break;default:b=0|kt(l=A+18556|0,13+(0|ar[A+18580>>2])|0)?0|gt(l,2):4,u=0|ar[10408+a>>2],l=e>>u,u=r>>u,(0|l)<=-1&&br(41808,41845,118,41865),(0|(s=0|ar[10412+a>>2]))<=(0|l)&&br(41808,41845,118,41865),(0|u)<=-1&&br(41869,41845,119,41865),(0|u)>=(0|ar[10416+a>>2])&&br(41869,41845,119,41865),l=(0|ar[10400+a>>2])+((0|sr(s,u))+l)|0,l=0|cr[l>>0],(u=4==(0|b))||(Q=0|ar[6292+(b<<2)>>2],l=(0|Q)==(0|l)?34:Q),2==(0|ar[d>>2])&&(l=0|cr[32618+l>>0]),Xn(a,e,r,i,l,u)}}while(0)}else{if(N){_n(A,e,r,0,0,Q,Q,f,Q,0);break}switch(0|b){case 1:_n(A,e,r,0,0,Q,D=(0|Q)/2|0,f,Q,0),_n(A,e,r,0,D,Q,D,f,Q,1);break A;case 2:_n(A,e,r,0,0,D=(0|Q)/2|0,Q,f,Q,0),_n(A,e,r,D,0,D,Q,f,Q,1);break A;case 4:_n(A,e,r,0,0,Q,D=(0|Q)/4|0,f,Q,0),_n(A,e,r,0,D,Q,(3<<i|0)/4|0,f,Q,1);break A;case 5:_n(A,e,r,0,0,Q,D=(3<<i|0)/4|0,f,Q,0),_n(A,e,r,0,D,Q,(0|Q)/4|0,f,Q,1);break A;case 6:_n(A,e,r,0,0,D=(0|Q)/4|0,Q,f,Q,0),_n(A,e,r,D,0,(3<<i|0)/4|0,Q,f,Q,1);break A;case 7:_n(A,e,r,0,0,D=(3<<i|0)/4|0,Q,f,Q,0),_n(A,e,r,D,0,(0|Q)/4|0,Q,f,Q,1);break A;case 3:_n(A,e,r,0,0,D=(0|Q)/2|0,D,f,Q,0),_n(A,e,r,D,0,D,D,f,Q,1),_n(A,e,r,0,D,D,D,f,Q,2),_n(A,e,r,D,D,D,D,f,Q,3);break A;default:br(37782,32568,4511,32653)}}}while(0);if(Y&&!(N&0!=(16&tr[A+26>>0]))&&0==(0|kt(A+18556|0,153+(0|ar[A+18580>>2])|0)))return ur=c;l=F?(0|ar[1396+a>>2])+R|0:0|ar[1392+a>>2];Q=0!=(0|ar[5776+a>>2])&1,function A(e,r,i,f,n,t,o,a,c,l,u,s,b,d,k){e|=0;r|=0;i|=0;f|=0;n|=0;t|=0;o|=0;a|=0;c|=0;l|=0;u|=0;s|=0;b|=0;d|=0;k|=0;var h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0;I=e+18596|0;w=0|ar[I>>2];h=0|ar[w+10368>>2];v=r>>h;(0|v)<=-1&&br(41808,41845,118,41865);B=1==(0|s);E=e+18556|0;G=e+18580|0;V=0!=(0|s);W=i;Z=f;y=n;C=a;p=l;m=w;g=v;f=i>>h;for(;;){if((0|(l=0|ar[m+10372>>2]))<=(0|g)){X=4;break}if((0|f)<=-1){X=7;break}if((0|(w=0|ar[m+10376>>2]))<=(0|f)){X=7;break}if(v=0|ar[m+10360>>2],i=v+(3*((0|sr(l,f))+g|0)|0)|0,(65535&(i=(65535&(cr[i>>0]|cr[i+1>>0]<<8))>>>8&3)|0)!=(0|b)){X=9;break}if((n=(0|ar[m+5868>>2])<(0|C))||((0|u)<=(0|c)?1:(0|ar[m+5864>>2])>=(0|C))|V&0==(0|c)){if(f=W>>h,!(-1<(0|(a=r>>h))&(0|a)<(0|l))){X=16;break}if(!(-1<(0|f)&(0|f)<(0|w))){X=18;break}l=v+(3*((0|sr(l,f))+a|0)|0)|0,l=1&(B&0==(0|c)|n|0!=(56&(cr[l>>0]|cr[l+1>>0]<<8))&(i<<16>>16==1?0==(ar[m+1392>>2]|c|0):0))}else{if(3<=(f=5-C|0)>>>0){X=13;break}l=0|kt(E,(0|ar[G>>2])+(f+20)|0)}if(w=0!=(0|l)){if(n=0|ar[m+10448>>2],f=r>>n,n=W>>n,(0|f)<=-1){X=23;break}if((0|(h=0|ar[m+10452>>2]))<=(0|f)){X=23;break}if((0|n)<=-1){X=26;break}if((0|n)>=(0|ar[m+10456>>2])){X=26;break}g=(0|ar[m+10440>>2])+((0|sr(h,n))+f)|0,tr[g>>0]=0|cr[g>>0]|1<<c}if(3==(0|(m=0|ar[(a=m+5776|0)>>2]))|2<(0|C)&0!=(0|m)?(d<<24>>24?(f=c+16|0,n=0|kt(E,(0|ar[G>>2])+f|0),2==(0|ar[a>>2])&&3==(0|C)|0==(0|l)&&(n=(0|kt(E,(0|ar[G>>2])+f|0))<<1|n)):n=-1,k<<24>>24?(h=c+16|0,f=0|kt(E,(0|ar[G>>2])+h|0),2==(0|ar[a>>2])&&3==(0|C)|0==(0|l)&&(f=(0|kt(E,(0|ar[G>>2])+h|0))<<1|f)):f=-1,(0|n)<0?X=38:l=n):(f=-1,X=38),38==(0|X)){if((n=2==((X=0)|C))&0==(0|c)){X=39;break}l=n&0<(0|c)?255&d:0}if(h=(0|f)<0?2==(0|C)&0<(0|c)?255&k:0:f,!w){X=43;break}if(n=(a=1<<(f=C+-1|0))+r|0,a=a+W|0,A(e,r,W,r,W,t,o,f,c=c+1|0,0,u,s,b,d=255&l,k=255&h),A(e,n,W,r,W,t,o,f,c,1,u,s,b,d,k),A(e,r,a,r,W,t,o,f,c,2,u,s,b,d,k),m=0|ar[I>>2],h=0|ar[m+10368>>2],(0|(g=n>>h))<=-1){X=4;break}y=W,Z=r,r=n,C=f,p=3,f=(W=a)>>h}switch(0|X){case 4:br(41808,41845,118,41865);break;case 7:br(41869,41845,119,41865);break;case 9:br(32670,32568,3827,32693);break;case 13:br(32713,32568,1820,32742);break;case 16:br(41808,41845,118,41865);break;case 18:br(41869,41845,119,41865);break;case 23:br(41808,41845,128,41865);break;case 26:br(41869,41845,129,41865);break;case 39:br(32770,32568,3894,32693);break;case 43:return i<<16>>16==0|0!=(l|c|h|0)?(X=0|kt(E,(0|ar[G>>2])+(0==(0|c)?15:14)|0),void Fn(e,r,W,Z,y,t,o,C,0,p,X,l,h)):void Fn(e,r,W,Z,y,t,o,C,0,p,X=1,l,h)}}(A,e,r,e,r,e,r,i,0,0,l,R,J,Q,Q),ur=c}(A,C,Z,p,y)}if(48==(0|e))return}}function Vn(A,e,r,i,f){r|=0,i|=0,f|=0;var n,t,o=0,a=0,c=0,l=0,u=0,s=0;if(t=(e|=0)>>(l=0|ar[(A|=0)+10368>>2]),u=r>>l,n=(i=1<<(l=i-l|0))+u|0,31!=(0|l)){a=i+t|0,c=A+10372|0,l=A+10360|0,o=(1&f)<<10&65535,i=u;do{for(f=t;u=(0|sr(0|ar[c>>2],i))+f|0,u=(0|ar[l>>2])+(3*u|0)|0,s=-1025&(cr[u>>0]|cr[u+1>>0]<<8)|o,tr[u>>0]=s,tr[u+1>>0]=s>>8,(0|(f=f+1|0))<(0|a););i=i+1|0}while((0|i)<(0|n))}if(o=e>>(i=0|ar[A+10348>>2]),i=r>>i,(0|o)<=-1&&br(41808,41845,128,41865),(0|(f=0|ar[A+10352>>2]))<=(0|o)&&br(41808,41845,128,41865),(0|i)<=-1&&br(41869,41845,129,41865),(0|i)<(0|ar[A+10356>>2]))return s=(0|ar[A+10340>>2])+(24*((0|sr(f,i))+o|0)|0)+22|0,void(tr[s>>0]=1);br(41869,41845,129,41865)}function Xn(A,e,r,i,f,n){e|=0,r|=0,f|=0;var t,o,a,c,l=0,u=0;if(c=255&((n|=0)?128|f:f),o=1<<(u=(i|=0)-(0|ar[(A|=0)+10408>>2])|0),l=0|ar[A+5872>>2],r=(0|sr(r>>l,0|ar[(a=A+5876|0)>>2]))+(e>>l)|0,31!=(0|u)){t=A+5880|0,l=A+10432|0,u=A+10424|0,i=A+10420|0,n=0;A:for(;;){f=0;do{if((0|f)>=(0|ar[a>>2])){f=10;break A}if((0|n)>=(0|ar[t>>2])){f=11;break A}if((0|(e=r+f+(0|sr(0|ar[l>>2],n))|0))>=(0|ar[u>>2])){f=12;break A}tr[(0|ar[i>>2])+e>>0]=c,f=f+1|0}while((0|f)<(0|o));if((0|o)<=(0|(n=n+1|0))){f=9;break}}9!=(0|f)&&(10==(0|f)?br(32868,41845,659,32891):11==(0|f)?br(32910,41845,660,32891):12==(0|f)&&br(32934,41845,663,32891))}}function _n(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s,b=0,d=0,k=0,h=0,w=0,v=0;if(l=0|ar[(w=(A|=0)+18600|0)>>2],k=0|kt(h=A+18556|0,147+(0|ar[(u=A+18580|0)>>2])|0),s=A+16|0,tr[(v=A+26|0)>>0]=(255&k)<<4&16|-17&tr[v>>0],k){A:do{if(2<=(0|ar[804+(0|ar[w>>2])>>2])&&0!=(0|kt(h,148+(0|ar[u>>2])|0)))if(1<((0|ar[804+(0|ar[w>>2])>>2])-1|0)){b=1;do{if(!(0|wt(h)))break A;b=b+1|0}while((0|b)<((0|ar[804+(0|ar[w>>2])>>2])-1|0))}else b=1;else b=0}while(0);o=31&tr[v>>0],b=(255&b)<<5&255}else{do{if(0|ar[20+l>>2])k=1;else{if(b=0|ar[u>>2],12!=(t+n|0)&&0|kt(h,b+156+o|0)){k=3;break}k=1+(0|kt(h,b+160|0))|0}}while(0);if(tr[v>>0]=-4&tr[v>>0]|3&k,2!=(0|k)){b=(0|ar[328+l>>2])-1|0;A:do{if(0!=(0|b)&&0!=(0|kt(h,154+(0|ar[u>>2])|0)))for(o=0;;){if((0|(d=o+1|0))==(0|b))break A;if(!(o=o?0|wt(h):0|kt(h,155+(0|ar[u>>2])|0))){b=d;break}o=d}else b=0}while(0);if(tr[s>>0]=b,Yn(A,0,0,0),d=255&(0|kt(h,152+(0|ar[u>>2])|0)),tr[v>>0]=d<<2&4|-5&tr[v>>0],1==(0|k))return void zo(h=0|ar[(h=A+18592|0)>>2],w=0|ar[w>>2],v=0|ar[(v=A+18596|0)>>2],s,e,r,i,f,a,n,t,c)}d=(0|ar[332+l>>2])-1|0;A:do{if(0!=(0|d)&&0!=(0|kt(h,154+(0|ar[u>>2])|0)))for(o=0;;){if((0|(b=o+1|0))==(0|d)){b=d;break A}if(!(o=o?0|wt(h):0|kt(h,155+(0|ar[u>>2])|0)))break;o=b}else b=0}while(0);tr[A+17>>0]=b,3==(0|k)&0!=(0|tr[370+l>>0])?(or[A+22>>1]=0,or[A+24>>1]=0):Yn(A,0,0,1),b=255&(0|kt(h,152+(0|ar[u>>2])|0)),o=-9&tr[v>>0],b=b<<3&8}tr[v>>0]=o|b,zo(h=0|ar[(h=A+18592|0)>>2],w=0|ar[w>>2],v=0|ar[(v=A+18596|0)>>2],s,e,r,i,f,a,n,t,c)}function Fn(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,s|=0;var b,d,k,h,w,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0;-1==(0|(u|=0))&&br(32807,32568,3547,32820),-1==(0|s)&&br(32840,32568,3548,32820),-1==(0|l)&&br(32853,32568,3549,32820),m=0|ar[(w=A+18596|0)>>2],I=2<(0|(I=((1^(d=3==(0|(k=0|ar[m+5776>>2]))))<<31>>31)+o|0))?I:2,p=s|u,tr[(v=A+33|0)>>0]=0,tr[v+1>>0]=0,tr[v+2>>0]=0,a=e>>(v=(tr[v+3>>0]=0)|ar[m+10368>>2]),v=r>>v,(0|a)<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[m+10372>>2]))<=(0|a)&&br(41808,41845,118,41865),(0|v)<=-1&&br(41869,41845,119,41865),(0|v)>=(0|ar[m+10376>>2])&&br(41869,41845,119,41865),W=(0|ar[m+10360>>2])+(3*((0|sr(g,v))+a|0)|0)|0,h=65535&(W=(65535&(cr[W>>0]|cr[W+1>>0]<<8))>>>8&3),b=0!=(0|l),g=0!=(0|p);do{if(p|l|0){if(0!=(0|tr[m+5946>>0])&&0==(0|ar[(y=A+18508|0)>>2])){v=A+18556|0,a=A+18580|0;do{if(0|kt(v,139+(0|ar[a>>2])|0)){if(0|kt(v,140+(0|ar[a>>2])|0))if(0|kt(v,140+(0|ar[a>>2])|0))if(0|kt(v,140+(0|ar[a>>2])|0))if(0|kt(v,140+(0|ar[a>>2])|0)){if(!(a=5+(0|mt(v,0))|0)){a=v=0;break}}else a=4;else a=3;else a=2;else a=1;v=0|wt(v)}else a=v=0}while(0);ar[y>>2]=1,m=0|sr(1-(v<<1)|0,a),ar[A+18512>>2]=m,m=1}else m=0;if(g&0!=(0|tr[752+(0|ar[A+18600>>2])>>0])&&0==(0|tr[A+32>>0])&&0==(0|ar[(Z=A+18516|0)>>2])?(y=0|kt(v=A+18556|0,23+(0|ar[(a=A+18580|0)>>2])|0),g=0|ar[w>>2],a=y?(a=1<(0|cr[g+10074>>0])?0|kt(v,24+(0|ar[a>>2])|0):0,ar[Z>>2]=1,ar[A+18520>>2]=tr[g+10075+a>>0],0|tr[g+10081+a>>0]):(ar[Z>>2]=1,ar[A+18520>>2]=0),ar[A+18524>>2]=a):C=33,33==(0|C)&&!m)break;At(A,e,r,n,t)}}while(0);if(g=1<<o,y=1<<I,C=0|ar[w>>2],Z=0|ar[C+5780>>2],C=0|ar[C+5784>>2],ar[(l=A+28|0)>>2]=0,b&&Nn(A,e,r,o,0),Rn(A,e,r,n,t,g,0,h,b),!(2<(0|o)|d))return 3!=(0|c)?0:((a=0!=(1&u|0))&&Nn(A,i,f,o,1),0|ar[5776+(0|ar[w>>2])>>2]&&Rn(A,(0|i)/(0|Z)|0,(0|f)/(0|C)|0,(0|n)/(0|Z)|0,(0|t)/(0|C)|0,g,1,h,a),(a=0!=(2&u|0))&&Nn(A,i,g+f|0,o,1),(v=2==(0|k))&&Rn(A,(0|i)/(0|Z)|0,((0|f)/(0|C)|0)+g|0,(0|n)/(0|Z)|0,(0|t)/(0|C)|0,g,1,h,a),(a=0!=(1&s|0))&&Nn(A,i,f,o,2),0|ar[5776+(0|ar[w>>2])>>2]&&Rn(A,(0|i)/(0|Z)|0,(0|f)/(0|C)|0,(0|n)/(0|Z)|0,(0|t)/(0|C)|0,g,2,h,a),(a=0!=(2&s|0))&&Nn(A,i,y+f|0,o,2),v&&Rn(A,(0|i)/(0|Z)|0,((0|f)/(0|C)|0)+g|0,(0|n)/(0|Z)|0,(0|t)/(0|C)|0,g,2,h,a),0);m=0|ar[w>>2];A:do{if(b&0!=(0|tr[m+10071>>0])){do{if(W<<16>>16!=1){if(a=e>>(v=0|ar[m+10428>>2]),v=r>>v,(0|a)<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[m+10432>>2]))<=(0|a)&&br(41808,41845,118,41865),(0|v)<=-1&&br(41869,41845,119,41865),(0|v)<(0|ar[m+10436>>2])){if(o=(0|ar[m+10420>>2])+((0|sr(g,v))+a)|0,(0|tr[o>>0])<0)break;v=a=0;break A}br(41869,41845,119,41865)}}while(0);for(g=A+18556|0,m=A+18580|0,v=a=0;v=(1&(o=0!=(0|kt(g,(0|ar[m>>2])+(a+162)|0))))+v|0,(0|(a=a+1|0))<4&o;);v=(a=v?1-((0|kt(g,170+(0|ar[m>>2])|0))<<1)<<v+-1:0,1)}else v=a=0}while(0);if(ar[l>>2]=a,(a=0!=(1&u|0))&&Nn(A,e,r,I,1),0|ar[5776+(0|ar[w>>2])>>2]&&Rn(A,(0|e)/(0|Z)|0,(0|r)/(0|C)|0,(0|n)/(0|Z)|0,(0|t)/(0|C)|0,y,1,h,a),(p=2==(0|k))&&((a=0!=(2&u|0))&&Nn(A,e,(C<<I)+r|0,I,1),Rn(A,(0|e)/(0|Z)|0,((0|r)/(0|C)|0)+y|0,(0|n)/(0|Z)|0,((0|t)/(0|C)|0)+y|0,y,1,h,a)),v){for(g=A+18556|0,m=A+18580|0,v=a=0;v=(1&(u=0!=(0|kt(g,(0|ar[m>>2])+(a+166)|0))))+v|0,(0|(a=a+1|0))<4&u;);a=v?1-((0|kt(g,171+(0|ar[m>>2])|0))<<1)<<v+-1:0}else a=0;return ar[l>>2]=a,(a=0!=(1&s|0))&&Nn(A,e,r,I,2),0|ar[5776+(0|ar[w>>2])>>2]&&Rn(A,(0|e)/(0|Z)|0,(0|r)/(0|C)|0,(0|n)/(0|Z)|0,(0|t)/(0|C)|0,y,2,h,a),p&&((a=0!=(2&s|0))&&Nn(A,e,(C<<I)+r|0,I,2),Rn(A,(0|e)/(0|Z)|0,((0|r)/(0|C)|0)+y|0,(0|n)/(0|Z)|0,((0|t)/(0|C)|0)+y|0,y,2,h,a)),0}function Nn(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0,fA=0,nA=0,tA=0,oA=0,aA=0,cA=0,lA=0,uA=0,sA=0;if(ur=(Q=ur)+160|0,iA=Q+144|0,R=Q+80|0,J=(Y=Q)+64|0,D=Q+48|0,N=Q+32|0,rA=(fA=0|ar[(A|=0)+18596>>2])+764|0,H=e>>(x=0|ar[fA+10368>>2]),x=r>>x,(0|H)<=-1&&br(41808,41845,118,41865),(0|(j=0|ar[fA+10372>>2]))<=(0|H)&&br(41808,41845,118,41865),(0|x)<=-1&&br(41869,41845,119,41865),(0|x)>=(0|ar[fA+10376>>2])&&br(41869,41845,119,41865),AA=(0|ar[fA+10360>>2])+(3*((0|sr(j,x))+H|0)|0)|0,AA=(65535&(cr[AA>>0]|cr[AA+1>>0]<<8))>>>8&3,(F=0==(0|f))&&(K=e>>(uA=0|ar[fA+10448>>2]),L=r>>uA,q=(z=1<<(uA=i-uA|0))+L|0,31!=(0|uA))){j=z+K|0,z=fA+10452|0,P=fA+10440|0,H=L;do{for(x=K;uA=(0|sr(0|ar[z>>2],H))+x|0,uA=(0|ar[P>>2])+uA|0,tr[uA>>0]=-128|tr[uA>>0],(0|(x=x+1|0))<(0|j););H=H+1|0}while((0|H)<(0|q))}H=0!=(0|tr[fA+5945>>0])&&0==(0|tr[A+32>>0])&&(0|ar[fA+10100>>2])>=(0|i)?255&(0|kt(A+18556|0,(0|ar[A+18580>>2])+(0|f?142:141)|0)):0,tr[(uA=A+33+f|0)>>0]=H,tr[(_=A+36|0)>>0]=0;do{if(AA<<16>>16==1&&0!=(0|tr[fA+5751>>0])){if(0==(0|tr[uA>>0])&&0==(0|tr[A+32>>0])){sA=23;break}j=0!=(0|f)&1,lA=255&(0|kt(x=A+18556|0,143+(0|ar[(H=A+18580|0)>>2])+j|0)),(tr[_>>0]=lA)<<24>>24&&(lA=255&(0|kt(x,145+(0|ar[H>>2])+j|0)),tr[A+37>>0]=lA)}else sA=23}while(0);if(23==(0|sA)&&(tr[_>>0]=0),H=F?2:0,0==(0|tr[uA>>0])&&0==(0|tr[A+32>>0])||(H|=1),z=25+(0|ar[(X=A+18580|0)>>2])|0,$=(cA=i<<1)+-1|0,lA=i+-2|0,L=F?i+1>>2:lA,K=F?(3*lA|0)+(i+-1>>2)|0:15,1<(0|cA)){for(q=A+18556|0,x=$,j=0;x=(cA=0==(0|kt(q,z+((j>>L)+K)|0)))?j:x,(0|(j=j+1|0))<(0|$)&(1^cA););for(P=43+(0|ar[X>>2])|0,z=$,j=0;z=(cA=0==(0|kt(q,P+((j>>L)+K)|0)))?j:z,(0|(j=j+1|0))<(0|$)&(1^cA););}else x=z=$;if(j=(x>>1)-1|0,3<(0|x)&&(x=(0|gt(A+18556|0,j))+((1&x|2)<<j)|0),j=(z>>1)-1|0,L=3<(0|z)?(0|gt(A+18556|0,j))+((1&z|2)<<j)|0:z,cA=AA<<16>>16==0){do{if(F){if(j=e>>(z=0|ar[fA+10408>>2]),z=r>>z,(0|j)<=-1&&br(41808,41845,118,41865),(0|(P=0|ar[fA+10412>>2]))<=(0|j)&&br(41808,41845,118,41865),(0|z)<=-1&&br(41869,41845,119,41865),(0|z)<(0|ar[fA+10416>>2])){eA=(0|ar[fA+10400>>2])+((0|sr(P,z))+j)|0,eA=0|tr[eA>>0];break}br(41869,41845,119,41865)}else{if(j=e>>(z=0|ar[fA+10428>>2]),z=r>>z,(0|j)<=-1&&br(41808,41845,118,41865),(0|(P=0|ar[fA+10432>>2]))<=(0|j)&&br(41808,41845,118,41865),(0|z)<=-1&&br(41869,41845,119,41865),(0|z)<(0|ar[fA+10436>>2])){eA=(0|ar[fA+10420>>2])+((0|sr(P,z))+j)|0,eA=63&tr[eA>>0];break}br(41869,41845,119,41865)}}while(0);j=(aA=2==(0|(z=0|function(A,e,r,i){e|=0,r|=0,i|=0;var f=0;switch(0|(A|=0)){case 2:break;case 3:f=2;break;default:return 0}return 2==(0|f)&&0|r&&3!=(0|ar[i+5012>>2])?0:0|((e+-6|0)>>>0<9?2:(e+-22|0)>>>0<9&1)}(i,255&eA,f,rA))))?x:L,x=aA?L:x}else z=0,j=L;V=0|Cn(lA,z),aA=0|Cn(2,z),T=iA,M=x,S=j,U=z,O=i,T|=0,M|=0,S|=0,O=(0|ar[6196+(24*(U|=0)|0)+((O|=0)<<2)>>2])+((S<<O)+M<<1)|0,O=cr[O>>0]|cr[O+1>>0]<<8,tr[T>>0]=O,tr[T+1>>0]=O>>8,G=0|tr[iA+1>>0],W=0|cr[iA>>0],Vu(0|R,0,1<<lA<<lA|0),B=A+18556|(or[(I=A+14404+(f<<1)|0)>>1]=0),E=0!=(0|f)&1,u=0!=(0|z)&1,s=(255&G)-1|0,b=fA+5749|0,d=A+32|0,k=F?42:43,h=G<<24>>24!=0,w=0<(0|f),v=fA+10408|0,g=fA+10412|0,m=fA+10416|0,p=fA+10400|0,y=fA+5750|0,Z=fA+5936|0,C=fA+5755|0,o=A+18588+H|0,a=fA+10428|0,c=fA+10432|0,l=fA+10436|0,n=fA+10420|0,t=1<(255&G),H=1,oA=W,x=AA=0;A:for(;;){K=0|tr[V+(oA<<1)>>0],q=0|tr[V+(oA<<1)+1>>0],(0|oA)<(0|W)&0!=(0|oA)?(tA=1&(tA=0|cr[R+((z=(j=255&q)<<lA)+(P=255&K))>>0])|tA>>>1,0|kt(B,(0|ar[X>>2])+((F?tA:tA+2|0)+61)|0)?(L=1,sA=59):(z=1,j=0)):0==(0|oA)|(0|oA)==(0|W)?(L=0,j=z=255&q,z<<=lA,P=255&K,sA=59):j=z=0,59==(0|sA)&&(z=R+(P+-1+z)|(sA=0),K<<24>>24&&(tr[z>>0]=1|tr[z>>0]),j=R+((j+-1<<lA)+P)|0,j=(z=(q<<24>>24&&(tr[j>>0]=2|tr[j>>0]),L),1));do{if(j){if(tA=($=255&K)<<2,nA=(q&=255)<<2,q=0|ar[50612+(lA<<6)+(E<<5)+(u<<4)+(cr[R+((q<<lA)+$)>>0]<<2)>>2],($=(0|oA)==(0|W))?(or[Y>>1]=1,tr[N>>0]=1,tr[J>>0]=G,t?(K=s,j=z,z=1,sA=67):(j=z,z=1)):(K=15,j=z,z=0,sA=67),67==(0|sA))for(;;){P=((sA=0)|cr[aA+(K<<1)>>0])+tA|0,L=(0|cr[aA+(K<<1)+1>>0])+nA|0;do{if(0|tr[b>>0]){if(0|tr[d>>0]){P=k;break}0|tr[uA>>0]?P=k:sA=70}else sA=70}while(0);if(70==(0|sA)&&(P=(sA=0)|cr[q+(P+(L<<i))>>0]),0|kt(B,(0|ar[X>>2])+(P+65)|0)&&(or[Y+(z<<1)>>1]=1,tr[N+z>>0]=1,tr[J+z>>0]=K,z=z+1|(j=0)),!(1<(0|K)))break;K=K+-1|0,sA=67}do{if(h|1^$){if(0|j){or[Y+(z<<1)>>1]=1,fA=z+(tr[N+z>>0]=1)|(tr[J+z>>0]=0);break}do{if(0|tr[b>>0]){if(0|tr[d>>0]){j=k;break}0|tr[uA>>0]?j=k:sA=78}else sA=78}while(0);if(78==(0|sA)&&(j=(sA=0)|cr[q+((nA<<i)+tA)>>0]),!(0|kt(B,(0|ar[X>>2])+(j+65)|0))){fA=z;break}or[Y+(z<<1)>>1]=1,fA=z+(tr[N+z>>0]=1)|(tr[J+z>>0]=0)}else fA=z}while(0);if(fA){q=0==(0|H)|(w|0==(0|oA)?0:2),L=(0|fA)<8?fA:8,$=0<(0|fA);do{if($){if(K=q<<2,w)for(P=0,z=-1,H=1,j=AA;x=P?0<(0|x)?1==(0|j)?0:x+1|0:x:1,H=(j=0|kt(B,(0|ar[X>>2])+(((0|x)<3?x:3)+K+125)|0))?(or[(H=Y+(P<<1)|0)>>1]=1+(0|or[H>>1])<<16>>16,z=-1==(0|z)?P:z,0):((H+-1|(tr[N+P>>0]=0))>>>0<2&1)+H|0,(0|(P=P+1|0))<(0|L););else for(P=0,z=-1,H=1,j=AA;x=P?0<(0|x)?1==(0|j)?0:x+1|0:x:1,H=(j=0|kt(B,(0|ar[X>>2])+(((0|x)<3?x:3)+K+109)|0))?(or[(H=Y+(P<<1)|0)>>1]=1+(0|or[H>>1])<<16>>16,z=-1==(0|z)?P:z,0):((H+-1|(tr[N+P>>0]=0))>>>0<2&1)+H|0,(0|(P=P+1|0))<(0|L););if(-1==(0|z))break;iA=0|kt(B,(0|ar[X>>2])+((w?4|q:q)+133)|0),or[(rA=Y+(z<<1)|0)>>1]=(0|lr[rA>>1])+iA,tr[N+z>>0]=iA}else H=1,j=AA}while(0);if(F){if(z=e>>(P=0|ar[v>>2]),P=r>>P,(0|z)<=-1){sA=102;break A}if((0|(L=0|ar[g>>2]))<=(0|z)){sA=102;break A}if((0|P)<=-1){sA=105;break A}if((0|P)>=(0|ar[m>>2])){sA=105;break A}z=(0|ar[p>>2])+((0|sr(L,P))+z)|0,z=0|tr[z>>0]}else{if(z=e>>(P=0|ar[a>>2]),P=r>>P,(0|z)<=-1){sA=109;break A}if((0|(L=0|ar[c>>2]))<=(0|z)){sA=109;break A}if((0|P)<=-1){sA=112;break A}if((0|P)>=(0|ar[l>>2])){sA=112;break A}z=(0|ar[n>>2])+((0|sr(L,P))+z)|0,z=63&tr[z>>0]}e:do{if(0|tr[d>>0])P=0;else{do{if(cA){if(!(0|tr[y>>0]))break;if((16|z)<<24>>24==26&0!=(0|tr[uA>>0])){P=0;break e}}}while(0);if(0|tr[_>>0]){P=0;break}P=3<((0|tr[J>>0])-(0|tr[J+(fA+-1)>>0])|0)&1}}while(0);if(iA=fA+-1|0,1<(0|fA))for(z=0;rA=255&(0|wt(B)),tr[D+z>>0]=rA,(0|(z=z+1|0))!=(0|iA););if(z=(rA=0!=(0|P))&0!=(0|tr[Z>>0])?0:255&(0|wt(B)),tr[D+iA>>0]=z,z=0|tr[C>>0]?(0|cr[o>>0])>>>2&255:0,!$)break;$=1,P=eA=0;do{AA=0|or[Y+(eA<<1)>>1];do{if(0|tr[N+eA>>0]){for(K=-1;;){if(L=K+1|0,q=0|wt(B),63<(0|K)){q=0;break}if(!q){sA=130;break}K=L}if(130==(0|sA)&&(((sA=0)|L)<4?K=0|gt(B,z):(K=0|gt(B,(L=K+-2|0)+z|0),L=2+(1<<L)|0),q=(L<<z)+K|0),K=0==(0|tr[C>>0]),L=z+1|0,z=(3<<z|0)<(q+AA|0)?!K||(0|L)<4?L:4:z,K|1^$){$=0;break}if((3<<(K=(255&(L=0|tr[o>>0]))>>>2&255)|0)<=(0|q)){tr[o>>0]=L+1<<24>>24,$=0;break}if(L<<24>>24==0|(1<<K|0)<=(q<<1|0)){$=0;break}tr[o>>0]=L+-1<<24>>24,$=0}else q=0}while(0);K=q+AA|0,L=65535&(q=0==(0|tr[D+eA>>0])?K:0-(65535&K)|0);do{if(rA&0!=(0|tr[Z>>0])){if((0|eA)!=(0|iA)|0==(1&(P=K+P|0)|0))break;L=0-q&65535}}while(0);AA=0|tr[J+eA>>0],q=(0|cr[aA+(AA<<1)>>0])+tA|0,AA=(0|cr[aA+(AA<<1)+1>>0])+nA|0,or[A+2116+(f<<11)+(or[I>>1]<<1)>>1]=L,or[A+8260+(f<<11)+(or[I>>1]<<1)>>1]=q+(AA<<i),or[I>>1]=1+(0|or[I>>1])<<16>>16,eA=eA+1|0}while((0|eA)!=(0|fA))}else j=AA}else j=AA}while(0);if(!(0<(0|oA))){sA=54;break}oA=oA+-1|0,AA=j}return 54==(0|sA)?ur=Q:102==(0|sA)?br(41808,41845,118,41865):105==(0|sA)?br(41869,41845,119,41865):109==(0|sA)?br(41808,41845,118,41865):112==(0|sA)&&br(41869,41845,119,41865),0}function Rn(A,e,r,i,f,n,t,o,a){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0;var c,l,u,s,b,d,k,h,w,v=0,g=0,m=0;if(c=0|ar[(l=(A|=0)+18596|0)>>2],u=0==(0|o)){do{if(t){if(o=0|sr(0|ar[5780+c>>2],e),g=0|sr(0|ar[5784+c>>2],r),o>>=v=0|ar[10428+c>>2],v=g>>v,(0|o)<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[10432+c>>2]))<=(0|o)&&br(41808,41845,118,41865),(0|v)<=-1&&br(41869,41845,119,41865),(0|v)<(0|ar[10436+c>>2])){m=(0|ar[10420+c>>2])+((0|sr(g,v))+o)|0,m=63&tr[m>>0];break}br(41869,41845,119,41865)}else{if(o=e>>(v=0|ar[10408+c>>2]),v=r>>v,(0|o)<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[10412+c>>2]))<=(0|o)&&br(41808,41845,118,41865),(0|v)<=-1&&br(41869,41845,119,41865),(0|v)<(0|ar[10416+c>>2])){m=(0|ar[10400+c>>2])+((0|sr(g,v))+o)|0,m=0|tr[m>>0];break}br(41869,41845,119,41865)}}while(0);s=c,b=e,d=r,k=v=34<(255&m)?1:255&m,h=n,w=t,s|=0,b|=0,d|=0,k|=0,h|=0,(8<(0|ar[(0==(0|(w|=0))?s+5760|0:s+5768|0)>>2])?function(A,e,r,i,f,n){i|=0;var t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;ur=(o=ur)+272|0,function(A,e,r,i,f,n){e|=0,r|=0,i|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0;ur=(g=ur)+144|0,v=(h=g)+64|0,w=0|ar[4+(A|=0)+((f|=0)<<2)>>2],c=0|ar[((f=0==(0|f))?A+40|0:A+44|0)>>2],L=f?q=1:(q=0|ar[A+5780>>2],0|ar[A+5784>>2]),k=0|ar[(f?A+5760|0:A+5768|0)>>2],J=0|sr(q,e),Y=0|sr(L,r),G=0|ar[A+5804>>2],B=0|ar[A+5820>>2],_=(T=0!=(0|J))&(X=1^(Z=0==(0|Y))),E=J+(0|sr(q,i))|0,D=0|ar[A+1248>>2],N=(0|E)<(0|D)&X,C=J>>G,y=Y>>G,W=J+-1>>G,E>>=G,G=Y+-1>>G,m=0|ar[A+10352>>2],f=0|sr(m,y),p=0|ar[A+10340>>2],o=0|lr[p+(24*(f+C|0)|0)>>1],Q=T?0|lr[p+(24*(f+W|0)|0)>>1]:-1,V=Z?-1:(V=p+(24*((0|sr(m,G))+C|0)|0)|0,0|lr[V>>1]),F=N?(F=p+(24*((0|sr(m,G))+E|0)|0)|0,0|lr[F>>1]):-1,I=_?(I=p+(24*((0|sr(m,G))+W|0)|0)|0,0|lr[I>>1]):-1,f=0|sr(y,B),y=0|ar[A+10308>>2],t=0|ar[y+(f+C<<2)>>2],R=T?0|ar[y+(f+W<<2)>>2]:-1,m=Z?-1:(m=y+((0|sr(G,B))+C<<2)|0,0|ar[m>>2]),p=_?(p=y+((0|sr(G,B))+W<<2)|0,0|ar[p>>2]):-1,f=N?(f=y+((0|sr(G,B))+E<<2)|0,0|ar[f>>2]):-1,d=(0|V)==(0|o)&(0|m)==(0|t)&X,_=_&(0|I)==(0|o)&(0|p)==(0|t),l=N&(0|F)==(0|o)&(0|f)==(0|t),u=0|ar[A+5864>>2],a=0|ar[A+5852>>2],K=(0|sr(Y>>u,a))+(J>>u)|0,s=0|ar[A+10320>>2],K=0|ar[s+(K<<2)>>2],f=(L+-1-Y+(0|ar[A+1252>>2])|0)/(0|L)|0,Y=(0|f)>(0|(b=i<<1))?b:f,J=(0|(J=(q+-1-J+D|0)/(0|q)|0))>(0|b)?b:J,Vu(0-b+v|0,0,0|(D=i<<2|1)),m=Y+-1|0;A:do{if(0<(0|Y)&&(M=e+-1|0,S=0|sr(q,M),U=A+10368|0,O=A+10372|0,H=A+10376|0,x=A+10360|0,T&(0|Q)==(0|o)&(0|R)==(0|t))){for(G=64-((0|f)<(0|b)?f:b)|0,V=S>>u,X=0==(0|tr[A+5944>>0]),B=m,E=m=f=0;;){if(I=h+(G+(E<<2))|0,p=0|sr(W=B+r|0,L),Z=s+((0|sr(p>>u,a))+V<<2)|0,Z=(0|ar[Z>>2])<=(0|K),X)Z&&(j=29);else{if(T=0|ar[U>>2],p>>=T,(0|(C=S>>T))<=-1){j=34;break}if((0|(y=0|ar[O>>2]))<=(0|C)){j=34;break}if((0|p)<=-1){j=35;break}if((0|p)>=(0|ar[H>>2])){j=35;break}T=(0|ar[x>>2])+(3*((0|sr(y,p))+C|0)|0)|0,Z&0==(768&(cr[T>>0]|cr[T+1>>0]<<8))&&(j=29)}if(29==(0|j)&&(p=w+(((j=0)|sr(W,c))+M<<1)|0,m||(f=0|or[p>>1]),tr[I>>0]=1,tr[I+1>>0]=1,tr[I+2>>0]=1,tr[I+3>>0]=1,or[n+(~B<<1)>>1]=0|or[p>>1],T=w+((0|sr(W+-1|0,c))+M<<1)|0,or[n+(1-B-1<<1)>>1]=0|or[T>>1],T=w+((0|sr(W+-2|0,c))+M<<1)|0,or[n+(2-B-1<<1)>>1]=0|or[T>>1],T=w+((0|sr(W+-3|0,c))+M<<1)|0,or[n+(3-B-1<<1)>>1]=0|or[T>>1],m=m+4|0),(0|(B=B+-4|0))<=-1){z=f,P=m;break A}E=E+1|0}34==(0|j)?br(41808,41845,118,41865):35==(0|j)&&br(41869,41845,119,41865)}else P=z=0}while(0);A:do{if(_){f=0|sr(q,y=e+-1|0),m=0|sr(L,Z=r+-1|0),C=s+((0|sr(m>>u,a))+(f>>u)<<2)|0,C=(0|ar[C>>2])<=(0|K);do{if(0|tr[A+5944>>0]){if(j=0|ar[A+10368>>2],p=f>>j,f=m>>j,(0|p)<=-1&&br(41808,41845,118,41865),(0|(m=0|ar[A+10372>>2]))<=(0|p)&&br(41808,41845,118,41865),(0|f)<=-1&&br(41869,41845,119,41865),(0|f)<(0|ar[A+10376>>2])){if(j=(0|ar[A+10360>>2])+(3*((0|sr(m,f))+p|0)|0)|0,C&0==(768&(cr[j>>0]|cr[j+1>>0]<<8)))break;m=P,f=z;break A}br(41869,41845,119,41865)}else if(!C){m=P,f=z;break A}}while(0);m=w+((0|sr(c,Z))+y<<1)|0,f=P?z:0|or[m>>1],or[n>>1]=0|or[m>>1],tr[v>>0]=1,m=P+1|0}else m=P,f=z}while(0);A:do{if(0<(0|J)){R=0|sr(L,X=r+-1|0),Y=A+5944|0,X=0|sr(c,X),_=A+10368|0,F=A+10372|0,N=A+10376|0,V=A+10360|0,G=0|sr(R>>u,a),B=E=0;e:for(;;){I=h+(65+(B<<2))|0;do{if((0|E)<(0|i)?d:l){if(p=0|sr(C=E+e|0,q),W=(0|ar[s+(G+(p>>u)<<2)>>2])<=(0|K),0|tr[Y>>0]){if(y=0|ar[_>>2],p>>=y,y=R>>y,(0|p)<=-1){j=55;break e}if((0|(Z=0|ar[F>>2]))<=(0|p)){j=55;break e}if((0|y)<=-1){j=58;break e}if((0|y)>=(0|ar[N>>2])){j=58;break e}if(A=(0|ar[V>>2])+(3*((0|sr(Z,y))+p|0)|0)|0,!(W&0==(768&(cr[A>>0]|cr[A+1>>0]<<8))))break}else if(!W)break;y=w+((p=C+X|0)<<1)|0,m||(f=0|or[y>>1]),A=1|E,tr[I>>0]=1,tr[I+1>>0]=1,tr[I+2>>0]=1,tr[I+3>>0]=1,or[n+(A<<1)>>1]=0|or[y>>1],or[n+(A+1<<1)>>1]=0|or[w+(p+1<<1)>>1],or[n+((3|E)<<1)>>1]=0|or[w+(p+2<<1)>>1],or[n+(A+3<<1)>>1]=0|or[w+(p+3<<1)>>1],m=m+4|0}}while(0);if((0|J)<=(0|(E=E+4|0))){$=m,AA=f;break A}B=B+1|0}55==(0|j)?br(41808,41845,118,41865):58==(0|j)&&br(41869,41845,119,41865)}else $=m,AA=f}while(0);if((0|$)==(0|D))return ur=g;if(f=0|sr(i,-2),!$){if((0|b)<(0|f))return ur=g;for(m=1<<k-1&65535;or[n+(f<<1)>>1]=m,(0|f)<(0|b);)f=f+1|0;return ur=g}if(0|tr[v+f>>0]||(or[n+(f<<1)>>1]=AA),(0|(f|=1))>(0|b))return ur=g;for(;0|tr[v+f>>0]||(or[n+(f<<1)>>1]=0|or[n+(f+-1<<1)>>1]),(0|f)<(0|b);)f=f+1|0;ur=g}(A|=0,e|=0,r|=0,f|=0,n|=0,t=o+128|0);do{if(!(0|tr[A+5753>>0])){if(0|n&&3!=(0|ar[A+5776>>2]))break;Qt(A,t,f,n,i)}}while(0);switch(0|i){case 0:if(b=0|ar[(0==(0|n)?A+40|0:A+44|0)>>2],s=(0|ar[A+4+(n<<2)>>2])+((0|sr(b,r))+e<<1)|0,1<(0|f)){for(i=f,A=0;3<i>>>0;)i>>>=1,A=A+1|0;i=A+2|0}else i=1;if((0|f)<=0)return ur=o;r=f+-1|0,n=t+(f+1<<1)|0,a=t+(~f<<1)|0,e=0;do{for(c=t+(~e<<1)|0,l=r-e|0,u=0|sr(e,b),e=e+1|0,A=0;w=0|sr(0|lr[c>>1],r-A|0),A=(d=A)+1|0,h=0|sr(0|lr[n>>1],A),k=0|sr(0|lr[t+(A<<1)>>1],l),k=w+f+h+k+(0|sr(0|lr[a>>1],e))>>i&65535,or[s+(d+u<<1)>>1]=k,(0|A)!=(0|f););}while((0|e)!=(0|f));return ur=o;case 1:return function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,n|=0;var t,o,a,c,l=0;if(c=0|ar[((o=0==(0|(f|=0)))?A+40|0:A+44|0)>>2],a=(0|ar[A+4+(f<<2)>>2])+((0|sr(c,r))+e<<1)|0,t=1<(0|i)){for(A=i,e=0;3<A>>>0;)A>>>=1,e=e+1|0;r=e+2|0}else r=1;if(f=0<(0|i))for(A=e=0;A=(0|lr[n+((e=(l=e)+1|0)<<1)>>1])+A+(0|lr[n+(~l<<1)>>1])|0,(0|e)!=(0|i););else A=0;if(r=A+i>>r,(0|i)<32&o){if(or[a>>1]=(2+(r<<1)+(0|lr[n+-2>>1])+(0|lr[n+2>>1])|0)>>>2,t){for(e=2+(3*r|0)|0,A=1;A=(l=A)+1|0,or[a+(l<<1)>>1]=(e+(0|lr[n+(A<<1)>>1])|0)>>>2,(0|A)!=(0|i););if(t){for(e=2+(3*r|0)|0,A=1;l=a+((0|sr(A,c))<<1)|0,or[l>>1]=(e+(0|lr[n+(~A<<1)>>1])|0)>>>2,(0|(A=A+1|0))!=(0|i););if(t){r&=65535,A=1;do{for(f=0|sr(A,c),e=1;or[a+(e+f<<1)>>1]=r,(0|(e=e+1|0))!=(0|i););A=A+1|0}while((0|A)!=(0|i))}}}}else{if(!f)return;r&=65535,e=0;do{for(f=0|sr(e,c),A=0;or[a+(A+f<<1)>>1]=r,(0|(A=A+1|0))!=(0|i););e=e+1|0}while((0|e)!=(0|i))}}(A,e,r,f,n,t),ur=o;default:(function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,t|=0;var o,a,c,l,u,s,b,d,k,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0;ur=(k=ur)+272|0,l=(w=k)+128|0,b=0|ar[((u=0==(0|(n|=0)))?A+40|0:A+44|0)>>2],o=0|ar[A+4+(n<<2)>>2],a=(0|sr(b,r))+e<<1,d=o+a|0,s=0|ar[(u?A+5760|0:A+5768|0)>>2],35<=(0|i)&&br(41628,41615,596,41645),(0|i)<=1&&br(41670,41615,597,41645),c=0|ar[7912+(i<<2)>>2];do{if(0|tr[A+5750>>0]){if(n=0|ar[A+10368>>2],h=e>>n,n=r>>n,(0|h)<=-1&&br(41808,41845,118,41865),(0|(e=0|ar[A+10372>>2]))<=(0|h)&&br(41808,41845,118,41865),(0|n)<=-1&&br(41869,41845,119,41865),(0|n)<(0|ar[A+10376>>2])){y=(0|ar[A+10360>>2])+(3*((0|sr(e,n))+h|0)|0)|0,y=0==(2048&(cr[y>>0]|cr[y+1>>0]<<8));break}br(41869,41845,119,41865)}else y=1}while(0);if(n=(0|f)<0,17<(0|i)){if(n||Eu(0|l,0|t,2+(f<<1)|0),(n=i+-11|0)>>>0<15){if(e=0|ar[8052+(n<<2)>>2],(0|(n=(0|sr(c,f))>>5))<-1)for(;p=t+(0-(128+(0|sr(n,e))>>8)<<1)|0,or[l+(n<<1)>>1]=0|or[p>>1],(0|n)<-1;)n=n+1|0}else(0|f)<(0|(n=f<<1))&&Eu(w+(f+65<<1)|0,t+(f+1<<1)|0,0|n);if(!(m=0<(0|f)))return ur=k;p=b<<1,g=w+130|0,r=f<<1,e=0;do{if(A=0|sr(e=(n=e)+1|0,c),h=A>>5,A&=31,w=0|sr(n,b),v=32-A|0,A)for(n=0;Z=(16+(C=0|sr(0|lr[l+(1+(Z=n+h|0)<<1)>>1],v))+(0|sr(0|lr[l+(Z+2<<1)>>1],A))|0)>>>5&65535,or[d+(n+w<<1)>>1]=Z,(0|(n=n+1|0))!=(0|f););else Eu(o+(a+(0|sr(p,n)))|0,g+(h<<1)|0,0|r)}while((0|e)!=(0|f));if(!((0|f)<32&26==(0|i)&u&y&m))return ur=k;for(h=t+2|0,r=65535+(e=1<<s)|0,n=0;Z=((0|lr[t+(~n<<1)>>1])-(0|lr[t>>1])>>1)+(0|lr[h>>1])|0,C=d+((0|sr(n,b))<<1)|0,or[C>>1]=(0|Z)<0?0:65535&((0|Z)<(0|e)?Z:r),(0|(n=n+1|0))!=(0|f););return ur=k}if(!n)for(n=0;or[l+(n<<1)>>1]=0|or[t+(0-n<<1)>>1],(0|n)!=(0|f);)n=n+1|0;if((n=i+-11|0)>>>0<15){if(e=0|ar[8052+(n<<2)>>2],(0|(n=(0|sr(c,f))>>5))<-1)for(;C=t+(128+(0|sr(n,e))>>8<<1)|0,or[l+(n<<1)>>1]=0|or[C>>1],(0|n)<-1;)n=n+1|0}else if((0|f)<(0|(e=f<<1)))for(n=f;or[l+((n=(C=n)+1|0)<<1)>>1]=0|or[t+(~C<<1)>>1],(0|n)!=(0|e););if(!(v=0<(0|f)))return ur=k;w=0;do{for(g=0|sr(w,b),h=0;r=0|sr(h=(A=h)+1|0,c),e=31&r,n=0|or[l+(1+(r=(r>>5)+w|0)<<1)>>1],e&&(n=(16+(n=0|sr(65535&n,32-e|0))+(0|sr(0|lr[l+(r+2<<1)>>1],e))|0)>>>5&65535),or[d+(A+g<<1)>>1]=n,(0|h)!=(0|f););w=w+1|0}while((0|w)!=(0|f));if(!((0|f)<32&10==(0|i)&u&y&v))return ur=k;for(h=t+-2|0,r=65535+(e=1<<s)|0,n=0;Z=((0|lr[t+((n=(C=n)+1|0)<<1)>>1])-(0|lr[t>>1])>>1)+(0|lr[h>>1])|0,or[d+(C<<1)>>1]=(0|Z)<0?0:65535&((0|Z)<(0|e)?Z:r),(0|n)!=(0|f););ur=k})(A,e,r,i,f,n,t),ur=o}}:function(A,e,r,i,f,n){i|=0;var t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;ur=(o=ur)+144|0,function(A,e,r,i,f,n){e|=0,r|=0,i|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0;ur=(m=ur)+144|0,g=(w=m)+64|0,v=0|ar[4+(A|=0)+((f|=0)<<2)>>2],b=0|ar[((f=0==(0|f))?A+40|0:A+44|0)>>2],q=f?AA=1:(AA=0|ar[A+5780>>2],0|ar[A+5784>>2]),h=0|ar[(f?A+5760|0:A+5768|0)>>2],D=0|sr(AA,e),Y=0|sr(q,r),V=0|ar[A+5804>>2],E=0|ar[A+5820>>2],F=(M=0!=(0|D))&(_=1^(C=0==(0|Y))),G=D+(0|sr(AA,i))|0,Q=0|ar[A+1248>>2],R=(0|G)<(0|Q)&_,W=D>>V,Z=Y>>V,I=D+-1>>V,G>>=V,V=Y+-1>>V,p=0|ar[A+10352>>2],f=0|sr(p,Z),y=0|ar[A+10340>>2],o=0|lr[y+(24*(f+W|0)|0)>>1],T=M?0|lr[y+(24*(f+I|0)|0)>>1]:-1,X=C?-1:(X=y+(24*((0|sr(p,V))+W|0)|0)|0,0|lr[X>>1]),N=R?(N=y+(24*((0|sr(p,V))+G|0)|0)|0,0|lr[N>>1]):-1,B=F?(B=y+(24*((0|sr(p,V))+I|0)|0)|0,0|lr[B>>1]):-1,f=0|sr(Z,E),Z=0|ar[A+10308>>2],t=0|ar[Z+(f+W<<2)>>2],J=M?0|ar[Z+(f+I<<2)>>2]:-1,p=C?-1:(p=Z+((0|sr(V,E))+W<<2)|0,0|ar[p>>2]),y=F?(y=Z+((0|sr(V,E))+I<<2)|0,0|ar[y>>2]):-1,f=R?(f=Z+((0|sr(V,E))+G<<2)|0,0|ar[f>>2]):-1,k=(0|X)==(0|o)&(0|p)==(0|t)&_,_=F&(0|B)==(0|o)&(0|y)==(0|t),c=R&(0|N)==(0|o)&(0|f)==(0|t),W=0|ar[(l=A+5864|0)>>2],C=0|ar[(u=A+5852|0)>>2],$=(0|sr(Y>>W,C))+(D>>W)|0,Z=0|ar[(s=A+10320|0)>>2],$=0|ar[Z+($<<2)>>2],p=(q+-1-Y+(0|ar[A+1252>>2])|0)/(0|q)|0,Y=(0|p)>(0|(d=i<<1))?d:p,D=(0|(D=(AA+-1-D+Q|0)/(0|AA)|0))>(0|d)?d:D,Vu(g+(Q=0-d|0)|0,0,0|(a=i<<2|1)),f=Y+-1|0;A:do{if(0<(0|Y)&&(S=e+-1|0,U=0|sr(AA,S),O=A+5944|0,H=A+10368|0,x=A+10372|0,j=A+10376|0,z=A+10360|0,M&(0|T)==(0|o)&(0|J)==(0|t))){for(X=64-((0|p)<(0|d)?p:d)|0,V=y=p=0;;){if(G=w+(X+(V<<2))|0,B=0|sr(E=f+r|0,q),W=Z+((0|sr(B>>W,C))+(U>>W)<<2)|0,W=(0|ar[W>>2])<=(0|$),0|tr[O>>0]){if(Z=0|ar[H>>2],I=U>>Z,Z=B>>Z,(0|I)<=-1){P=35;break}if((0|(C=0|ar[x>>2]))<=(0|I)){P=35;break}if((0|Z)<=-1){P=36;break}if((0|Z)>=(0|ar[j>>2])){P=36;break}M=(0|ar[z>>2])+(3*((0|sr(C,Z))+I|0)|0)|0,W&0==(768&(cr[M>>0]|cr[M+1>>0]<<8))&&(P=29)}else W&&(P=29);if(29==(0|P)&&(Z=v+(((P=0)|sr(E,b))+S)|0,y||(p=0|tr[Z>>0]),tr[G>>0]=1,tr[G+1>>0]=1,tr[G+2>>0]=1,tr[G+3>>0]=1,tr[n+~f>>0]=0|tr[Z>>0],M=v+((0|sr(E+-1|0,b))+S)|0,tr[n+(1-f-1)>>0]=0|tr[M>>0],M=v+((0|sr(E+-2|0,b))+S)|0,tr[n+(2-f-1)>>0]=0|tr[M>>0],M=v+((0|sr(E+-3|0,b))+S)|0,tr[n+(3-f-1)>>0]=0|tr[M>>0],y=y+4|0),(0|(f=f+-4|0))<=-1){L=p,K=y;break A}W=0|ar[l>>2],C=0|ar[u>>2],Z=0|ar[s>>2],V=V+1|0}35==(0|P)?br(41808,41845,118,41865):36==(0|P)&&br(41869,41845,119,41865)}else K=L=0}while(0);A:do{if(_){f=0|sr(AA,Z=e+-1|0),W=0|ar[l>>2],p=0|sr(q,C=r+-1|0),W=(0|sr(p>>W,0|ar[u>>2]))+(f>>W)|0,W=(0|ar[(0|ar[s>>2])+(W<<2)>>2])<=(0|$);do{if(0|tr[A+5944>>0]){if(P=0|ar[A+10368>>2],y=f>>P,f=p>>P,(0|y)<=-1&&br(41808,41845,118,41865),(0|(p=0|ar[A+10372>>2]))<=(0|y)&&br(41808,41845,118,41865),(0|f)<=-1&&br(41869,41845,119,41865),(0|f)<(0|ar[A+10376>>2])){if(P=(0|ar[A+10360>>2])+(3*((0|sr(p,f))+y|0)|0)|0,W&0==(768&(cr[P>>0]|cr[P+1>>0]<<8)))break;p=K,f=L;break A}br(41869,41845,119,41865)}else if(!W){p=K,f=L;break A}}while(0);p=v+((0|sr(b,C))+Z)|0,f=K?L:0|tr[p>>0],tr[n>>0]=0|tr[p>>0],tr[g>>0]=1,p=K+1|0}else p=K,f=L}while(0);A:do{if(0<(0|D)){R=0|sr(q,X=r+-1|0),Y=A+5944|0,X=0|sr(b,X),_=A+10368|0,F=A+10372|0,N=A+10376|0,V=A+10360|0,E=G=0;e:for(;;){B=w+(65+(E<<2))|0;do{if((0|G)<(0|i)?k:c){if(y=0|sr(W=G+e|0,AA),I=0|ar[l>>2],I=(0|sr(R>>I,0|ar[u>>2]))+(y>>I)|0,I=(0|ar[(0|ar[s>>2])+(I<<2)>>2])<=(0|$),0|tr[Y>>0]){if(Z=0|ar[_>>2],y>>=Z,Z=R>>Z,(0|y)<=-1){P=56;break e}if((0|(C=0|ar[F>>2]))<=(0|y)){P=56;break e}if((0|Z)<=-1){P=59;break e}if((0|Z)>=(0|ar[N>>2])){P=59;break e}if(A=(0|ar[V>>2])+(3*((0|sr(C,Z))+y|0)|0)|0,!(I&0==(768&(cr[A>>0]|cr[A+1>>0]<<8))))break}else if(!I)break;Z=v+(y=W+X|0)|0,p||(f=0|tr[Z>>0]),A=1|G,tr[B>>0]=1,tr[B+1>>0]=1,tr[B+2>>0]=1,tr[B+3>>0]=1,tr[n+A>>0]=0|tr[Z>>0],tr[n+(A+1)>>0]=0|tr[v+(y+1)>>0],tr[n+(3|G)>>0]=0|tr[v+(y+2)>>0],tr[n+(A+3)>>0]=0|tr[v+(y+3)>>0],p=p+4|0}}while(0);if((0|D)<=(0|(G=G+4|0))){eA=p,rA=f;break A}E=E+1|0}56==(0|P)?br(41808,41845,118,41865):59==(0|P)&&br(41869,41845,119,41865)}else eA=p,rA=f}while(0);if((0|eA)==(0|a))return ur=m;if(!eA)return Vu(n+Q|0,1<<h-1&255|0,0|a),ur=m;if(f=0|sr(i,-2),0|tr[g+f>>0]||(tr[n+f>>0]=rA),(0|(f|=1))>(0|d))return ur=m;for(;0|tr[g+f>>0]||(tr[n+f>>0]=0|tr[n+(f+-1)>>0]),(0|f)<(0|d);)f=f+1|0;ur=m}(A|=0,e|=0,r|=0,f|=0,n|=0,t=o+64|0);do{if(!(0|tr[A+5753>>0])){if(0|n&&3!=(0|ar[A+5776>>2]))break;Dt(A,t,f,n,i)}}while(0);switch(0|i){case 0:if(b=0|ar[(0==(0|n)?A+40|0:A+44|0)>>2],s=(0|ar[A+4+(n<<2)>>2])+((0|sr(b,r))+e)|0,1<(0|f)){for(i=f,A=0;3<i>>>0;)i>>>=1,A=A+1|0;i=A+2|0}else i=1;if((0|f)<=0)return ur=o;r=f+-1|0,n=t+(f+1)|0,a=t+~f|0,e=0;do{for(c=t+~e|0,l=r-e|0,u=0|sr(e,b),e=e+1|0,A=0;w=0|sr(0|cr[c>>0],r-A|0),A=(d=A)+1|0,h=0|sr(0|cr[n>>0],A),k=0|sr(0|cr[t+A>>0],l),k=w+f+h+k+(0|sr(0|cr[a>>0],e))>>i&255,tr[s+(d+u)>>0]=k,(0|A)!=(0|f););}while((0|e)!=(0|f));return ur=o;case 1:return function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,n|=0;var t,o,a,c,l,u,s=0,b=0,d=0;if(u=0|ar[((o=0==(0|(f|=0)))?A+40|0:A+44|0)>>2],l=0|ar[A+4+(f<<2)>>2],t=(0|sr(u,r))+e|0,a=l+t|0,c=1<(0|i)){for(A=i,f=0;3<A>>>0;)A>>>=1,f=f+1|0;s=f+2|0}else s=1;if(b=0<(0|i))for(A=f=0;A=(0|cr[n+(f=(d=f)+1|0)>>0])+A+(0|cr[n+~d>>0])|0,(0|f)!=(0|i););else A=0;if(s=A+i>>s,(0|i)<32&o){if(tr[a>>0]=(2+(s<<1)+(0|cr[n+-1>>0])+(0|cr[n+1>>0])|0)>>>2,c){for(f=2+(3*s|0)|0,A=1;A=(d=A)+1|0,tr[a+d>>0]=(f+(0|cr[n+A>>0])|0)>>>2,(0|A)!=(0|i););if(c){for(f=2+(3*s|0)|0,A=1;d=a+(0|sr(A,u))|0,tr[d>>0]=(f+(0|cr[n+~A>>0])|0)>>>2,(0|(A=A+1|0))!=(0|i););if(c)for(b=255&s,s=(0|sr(u,r+1|0))+e+1|0,A=i+-1|0,f=0;Vu(l+(s+(0|sr(u,f)))|0,0|b,0|A),(0|(f=f+1|0))!=(0|A););}}}else{if(!b)return;for(f=255&s,A=0;Vu(l+(t+(0|sr(u,A)))|0,0|f,0|i),(0|(A=A+1|0))!=(0|i););}}(A,e,r,f,n,t),ur=o;default:(function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,t|=0;var o,a,c,l,u,s,b,d,k,h=0,w=0,v=0,g=0,m=0,p=0,y=0;ur=(k=ur)+144|0,l=(w=k)+64|0,b=0|ar[((u=0==(0|(n|=0)))?A+40|0:A+44|0)>>2],o=0|ar[A+4+(n<<2)>>2],a=(0|sr(b,r))+e|0,d=o+a|0,s=0|ar[(u?A+5760|0:A+5768|0)>>2],35<=(0|i)&&br(41628,41615,596,41645),(0|i)<=1&&br(41670,41615,597,41645),c=0|ar[7912+(i<<2)>>2];do{if(0|tr[A+5750>>0]){if(n=0|ar[A+10368>>2],h=e>>n,n=r>>n,(0|h)<=-1&&br(41808,41845,118,41865),(0|(e=0|ar[A+10372>>2]))<=(0|h)&&br(41808,41845,118,41865),(0|n)<=-1&&br(41869,41845,119,41865),(0|n)<(0|ar[A+10376>>2])){m=(0|ar[A+10360>>2])+(3*((0|sr(e,n))+h|0)|0)|0,m=0==(2048&(cr[m>>0]|cr[m+1>>0]<<8));break}br(41869,41845,119,41865)}else m=1}while(0);if(n=(0|f)<0,17<(0|i)){if(n||Eu(0|l,0|t,f+1|0),(n=i+-11|0)>>>0<15){if(e=0|ar[8052+(n<<2)>>2],(0|(n=(0|sr(c,f))>>5))<-1)for(;g=t+(0-(128+(0|sr(n,e))>>8))|0,tr[l+n>>0]=0|tr[g>>0],(0|n)<-1;)n=n+1|0}else(0|f)<(f<<1|0)&&Eu(w+(f+65)|0,t+(f+1)|0,0|f);if(!(g=0<(0|f)))return ur=k;v=w+65|0,n=0;do{if(r=0|sr(b,n),A=0|sr(n=n+1|0,c),h=A>>5,w=32-(A&=31)|0,A)for(e=0;p=(16+(y=0|sr(0|cr[l+(1+(p=e+h|0))>>0],w))+(0|sr(0|cr[l+(p+2)>>0],A))|0)>>>5&255,tr[d+(e+r)>>0]=p,(0|(e=e+1|0))!=(0|f););else Eu(o+(a+r)|0,v+h|0,0|f)}while((0|n)!=(0|f));if(!((0|f)<32&26==(0|i)&u&m&g))return ur=k;for(h=t+1|0,e=255+(r=1<<s)|0,n=0;p=((0|cr[t+~n>>0])-(0|cr[t>>0])>>1)+(0|cr[h>>0])|0,y=d+(0|sr(n,b))|0,tr[y>>0]=(0|p)<0?0:255&((0|p)<(0|r)?p:e),(0|(n=n+1|0))!=(0|f););return ur=k}if(!n)for(n=0;tr[l+n>>0]=0|tr[t+(0-n)>>0],(0|n)!=(0|f);)n=n+1|0;if((n=i+-11|0)>>>0<15){if(e=0|ar[8052+(n<<2)>>2],(0|(n=(0|sr(c,f))>>5))<-1)for(;y=t+(128+(0|sr(n,e))>>8)|0,tr[l+n>>0]=0|tr[y>>0],(0|n)<-1;)n=n+1|0}else if((0|f)<(0|(e=f<<1)))for(n=f;tr[l+(n=(y=n)+1|0)>>0]=0|tr[t+~y>>0],(0|n)!=(0|e););if(!(v=0<(0|f)))return ur=k;w=0;do{for(g=0|sr(w,b),h=0;r=0|sr(h=(A=h)+1|0,c),e=31&r,n=0|tr[l+(1+(r=(r>>5)+w|0))>>0],e&&(n=(16+(n=0|sr(255&n,32-e|0))+(0|sr(0|cr[l+(r+2)>>0],e))|0)>>>5&255),tr[d+(A+g)>>0]=n,(0|h)!=(0|f););w=w+1|0}while((0|w)!=(0|f));if(!((0|f)<32&10==(0|i)&u&m&v))return ur=k;for(h=t+-1|0,r=255+(e=1<<s)|0,n=0;p=((0|cr[t+(n=(y=n)+1|0)>>0])-(0|cr[t>>0])>>1)+(0|cr[h>>0])|0,tr[d+y>>0]=(0|p)<0?0:255&((0|p)<(0|e)?p:r),(0|n)!=(0|f););ur=k})(A,e,r,i,f,n,t),ur=o}})(s,b,d,k,h,w);do{if(0|tr[5750+(0|ar[l>>2])>>0]){if(0==(0|tr[A+32>>0])&&0==(0|tr[A+33+t>>0])){o=0;break}o=26==(16|v)}else o=0}while(0);o=26==(0|v)&o?2:1&o}else o=0|tr[A+36>>0]?0|tr[A+37>>0]?2:1:0;a?et(A,e,r,i,f,n,t,0!=(0|tr[A+33+t>>0]),u,o):t&&0|ar[A+28>>2]&&et(A,e,r,i,f,n,t,(or[A+14404+(t<<1)>>1]=0)!=(0|tr[A+33+t>>0]),u,0)}function Yn(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t=0,o=0,a=0,c=0,l=0,u=0;ur=(n=ur)+16|0,l=n,t=0|kt(c=(A|=0)+18556|0,150+(0|ar[(r=A+18580|0)>>2])|0),e=0|kt(c,150+(0|ar[r>>2])|0),o=(t=0==(0|t))?0:0|kt(c,151+(0|ar[r>>2])|0),a=(f=0==(0|e))?0:0|kt(c,151+(0|ar[r>>2])|0),t?(r=l,e=0,u=11):(t=o?0|mt(c,1):-1,o=0|wt(c),e=t+2|0,ar[l>>2]=e,o?(r=l,e=-2-t|0,u=11):o=e),11==(0|u)&&(o=ar[r>>2]=e);do{if(!f){if(t=a?0|mt(c,1):-1,u=0|wt(c),e=t+2|0,ar[(r=l+4|0)>>2]=e,u){e=-2-t|0;break}return u=e,c=65535&o,or[(l=A+18+(i<<2)|0)>>1]=c,u&=65535,or[(i=A+18+(i<<2)+2|0)>>1]=u,void(ur=n)}r=l+4|0,e=0}while(0);u=ar[r>>2]=e,c=65535&o,or[(l=A+18+(i<<2)|0)>>1]=c,u&=65535,or[(i=A+18+(i<<2)+2|0)>>1]=u,ur=n}function Jn(A,e,r){A|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(l=0|tr[(r|=0)+93784+(4400*(0|ar[(e|=0)+8>>2])|0)+2>>0],d=0|ut(A),7<(tr[(a=e+380|0)>>0]=d)>>>0)return(w=0)|w;d=r+11096+(5168*l|0)+476|0;do{if(0|ar[d>>2]){if(c=0|st(A),7<(c=(0|cr[a>>0])+c|0)>>>0)return(w=0)|w;tr[(b=e+381|0)>>0]=c;break}b=e+381|0}while(0);n=e+332|0,t=e+328|0,o=r+11096+(5168*l|0)+5164|0,i=r+11096+(5168*l|0)+5160|0,f=e+20|0,s=0;A:for(;;){if(c=0==(0|s))w=10;else if(1==(0|s)){if(0|ar[f>>2]){c=1,w=27;break}w=10}if(10==(0|w)&&(h=(w=0)<(0|(k=0|ar[(c?t:n)>>2])))){for(c=0;u=255&(0|at(A,1)),tr[e+382+(s<<4)+c>>0]=u,(0|(c=c+1|0))!=(0|k););if(0!=(0|ar[d>>2])&h)for(c=0;u=255&(0|at(A,1)),tr[e+414+(s<<4)+c>>0]=u,(0|(c=c+1|0))!=(0|k););if(h){u=0;do{if(0|tr[e+382+(s<<4)+u>>0]){if(255<((c=0|st(A))+128|0)>>>0){c=0,w=27;break A}if(or[e+446+(s<<5)+(u<<1)>>1]=(1<<cr[a>>0])+c,c=0|st(A),!((0-(l=0|ar[i>>2])|0)<=(0|c)&(0|c)<(0|l))){c=0,w=27;break A}c&=255}else or[e+446+(s<<5)+(u<<1)>>1]=1<<cr[a>>0],c=0;if(tr[e+510+(s<<4)+u>>0]=c,0|tr[e+414+(s<<4)+u>>0]){if(255<((c=0|st(A))+128|0)>>>0){c=0,w=27;break A}if(or[(l=e+542+(s<<6)+(u<<2)|0)>>1]=(1<<cr[b>>0])+c,c=0|st(A),r=0|ar[o>>2],!((0|c)>=(0|sr(r,-4))&(0|c)<(r<<2|0))){c=0,w=27;break A}if(c=r+c-((l=0|sr(0|or[l>>1],r))>>cr[b>>0])|0,l=0-r|0,tr[e+670+(s<<5)+(u<<1)>>0]=(0|c)<(0|l)?l:(0|c)<(0|r)?c:r+255|0,255<((c=0|st(A))+128|0)>>>0){c=0,w=27;break A}if(or[(l=e+542+(s<<6)+(u<<2)+2|0)>>1]=(1<<cr[b>>0])+c,c=0|st(A),r=0|ar[o>>2],!((0|c)>=(0|sr(r,-4))&(0|c)<(r<<2|0))){c=0,w=27;break A}c=255&((0|(c=r+c-((l=0|sr(0|or[l>>1],r))>>cr[b>>0])|0))<(0|(l=0-r|0))?l:(0|c)<(0|r)?c:r+255|0)}else c=1<<cr[b>>0]&65535,or[e+542+(s<<6)+(u<<2)>>1]=c,tr[e+670+(s<<5)+(u<<1)>>0]=0,or[e+542+(s<<6)+(u<<2)+2>>1]=c,c=0;tr[e+670+(s<<5)+(u<<1)+1>>0]=c,u=u+1|0}while((0|u)<(0|k))}}if(2<=(0|(s=s+1|0))){c=1,w=27;break}}return 27==(0|w)?0|c:0}function Dn(A){var e=0,r=0,i=0;for(ar[(A|=0)>>2]=0,tr[A+4>>0]=0,tr[A+5>>0]=0,ar[A+8>>2]=0,e=A+16|(tr[A+12>>0]=0),ar[A+28>>2]=0,tr[A+32>>0]=0,ar[e>>2]=0,ar[e+4>>2]=0,Po(A+34|(or[e+8>>1]=0)),ar[A+136>>2]=0,ar[A+140>>2]=0,e=ar[A+144>>2]=0;tr[A+148+e>>0]=0,ar[A+164+(e<<2)>>2]=0,tr[A+228+e>>0]=0,16!=((tr[A+244+e>>0]=0)|(e=e+1|(ar[A+260+(e<<2)>>2]=0))););for(e=A+324|0,ar[A+376>>2]=0,tr[A+380>>0]=0,i=(r=e)+48|(tr[A+381>>0]=0);(0|(r=r+4|(ar[r>>2]=0)))<(0|i););for(e=tr[e+48>>0]=0;tr[A+382+e>>0]=0,tr[A+414+e>>0]=0,or[A+446+(e<<1)>>1]=0,tr[A+510+e>>0]=0,or[A+542+(e<<2)+2>>1]=0,or[A+542+(e<<2)>>1]=0,16!=((tr[A+670+(e<<1)+1>>0]=0)|(e=e+1|(tr[A+670+(e<<1)>>0]=0))););for(e=0;tr[A+398+e>>0]=0,tr[A+430+e>>0]=0,or[A+478+(e<<1)>>1]=0,tr[A+526+e>>0]=0,or[A+606+(e<<2)+2>>1]=0,or[A+606+(e<<2)>>1]=0,16!=((tr[A+702+(e<<1)+1>>0]=0)|(e=e+1|(tr[A+702+(e<<1)>>0]=0))););for(r=A+736|0,ar[A+756>>2]=0,ar[A+760>>2]=0,tr[A+764>>0]=0,ar[A+768>>2]=0,ar[A+772>>2]=0,ar[r>>2]=0,ar[r+4>>2]=0,ar[r+8>>2]=0,ar[r+12>>2]=0,or[r+16>>1]=0,r=(tr[r+18>>0]=0)|ar[A+776>>2],(0|(e=0|ar[(i=A+780|0)>>2]))!=(0|r)&&(ar[i>>2]=e+(~((e+-4-r|0)>>>2)<<2)),ar[(e=A+788|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,Po(A+812|(ar[e+20>>2]=0)),e=ar[A+912>>2]=0;ar[A+916+(e<<6)>>2]=0,ar[A+1044+(e<<6)>>2]=0,ar[A+1172+(e<<6)>>2]=0,tr[A+1300+(e<<4)>>0]=0,ar[A+916+(e<<6)+4>>2]=0,ar[A+1044+(e<<6)+4>>2]=0,ar[A+1172+(e<<6)+4>>2]=0,tr[A+1300+(e<<4)+1>>0]=0,ar[A+916+(e<<6)+8>>2]=0,ar[A+1044+(e<<6)+8>>2]=0,ar[A+1172+(e<<6)+8>>2]=0,tr[A+1300+(e<<4)+2>>0]=0,ar[A+916+(e<<6)+12>>2]=0,ar[A+1044+(e<<6)+12>>2]=0,ar[A+1172+(e<<6)+12>>2]=0,tr[A+1300+(e<<4)+3>>0]=0,ar[A+916+(e<<6)+16>>2]=0,ar[A+1044+(e<<6)+16>>2]=0,ar[A+1172+(e<<6)+16>>2]=0,tr[A+1300+(e<<4)+4>>0]=0,ar[A+916+(e<<6)+20>>2]=0,ar[A+1044+(e<<6)+20>>2]=0,ar[A+1172+(e<<6)+20>>2]=0,tr[A+1300+(e<<4)+5>>0]=0,ar[A+916+(e<<6)+24>>2]=0,ar[A+1044+(e<<6)+24>>2]=0,ar[A+1172+(e<<6)+24>>2]=0,tr[A+1300+(e<<4)+6>>0]=0,ar[A+916+(e<<6)+28>>2]=0,ar[A+1044+(e<<6)+28>>2]=0,ar[A+1172+(e<<6)+28>>2]=0,tr[A+1300+(e<<4)+7>>0]=0,ar[A+916+(e<<6)+32>>2]=0,ar[A+1044+(e<<6)+32>>2]=0,ar[A+1172+(e<<6)+32>>2]=0,tr[A+1300+(e<<4)+8>>0]=0,ar[A+916+(e<<6)+36>>2]=0,ar[A+1044+(e<<6)+36>>2]=0,ar[A+1172+(e<<6)+36>>2]=0,tr[A+1300+(e<<4)+9>>0]=0,ar[A+916+(e<<6)+40>>2]=0,ar[A+1044+(e<<6)+40>>2]=0,ar[A+1172+(e<<6)+40>>2]=0,tr[A+1300+(e<<4)+10>>0]=0,ar[A+916+(e<<6)+44>>2]=0,ar[A+1044+(e<<6)+44>>2]=0,ar[A+1172+(e<<6)+44>>2]=0,tr[A+1300+(e<<4)+11>>0]=0,ar[A+916+(e<<6)+48>>2]=0,ar[A+1044+(e<<6)+48>>2]=0,ar[A+1172+(e<<6)+48>>2]=0,tr[A+1300+(e<<4)+12>>0]=0,ar[A+916+(e<<6)+52>>2]=0,ar[A+1044+(e<<6)+52>>2]=0,ar[A+1172+(e<<6)+52>>2]=0,tr[A+1300+(e<<4)+13>>0]=0,ar[A+916+(e<<6)+56>>2]=0,ar[A+1044+(e<<6)+56>>2]=0,ar[A+1172+(e<<6)+56>>2]=0,tr[A+1300+(e<<4)+14>>0]=0,ar[A+916+(e<<6)+60>>2]=0,ar[A+1044+(e<<6)+60>>2]=0,2!=((ar[A+1172+(e<<6)+60>>2]=0)|(e=e+1|(tr[A+1300+(e<<4)+15>>0]=0))););e=0|ar[A+1344>>2],(0|(i=0|ar[(r=A+1348|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),tr[(A=A+1340|0)>>0]=0}function Qn(A){var e,r=0;for(ar[(A|=0)+4720>>2]=0,ar[A+4724>>2]=0,function(A){var e,r=0,i=0;tr[(A|=0)>>0]=0,or[(r=A+2|0)>>1]=0,or[r+2>>1]=0,or[r+4>>1]=0,tr[r+6>>0]=0,ar[A+12>>2]=5,tr[A+16>>0]=0,tr[A+17>>0]=0,tr[A+18>>0]=2,tr[A+19>>0]=2,tr[A+20>>0]=2,ar[A+48>>2]=0,ar[A+52>>2]=0,tr[A+56>>0]=0,r=A+60|0,e=24+(i=A+21|0)|0;for(;tr[i>>0]=0,i=i+1|0,(0|i)<(0|e););ar[r>>2]=1,tr[A+64>>0]=0,tr[A+65>>0]=0,tr[A+66>>0]=0,tr[A+67>>0]=1,tr[A+68>>0]=0,or[A+70>>1]=0,tr[A+72>>0]=2,tr[A+73>>0]=1,tr[A+74>>0]=15,tr[A+75>>0]=15}(A+4904|(ar[A+4728>>2]=0)),e=(r=A+4984|0)+9|0;(0|(r=r+1|(tr[r>>0]=0)))<(0|e););tr[A>>0]=0}function Tn(A){var e,r;(r=0|ar[(A|=0)+4720>>2])&&((0|(e=0|ar[(A=A+4724|0)>>2]))!=(0|r)&&(ar[A>>2]=e+(100*~(((e-100-r|0)>>>0)/100|0)|0)),Vl(r))}function Mn(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0;ur=(t=ur)+6240|0,n=(f=t)+96|0,l=0;A:for(;;){k=(d=3==(0|l))?2:6,w=3!=(0|l),s=(h=0==(0|l))?16:64,b=1<(0|l),u=0;do{c=n+(u<<10)|0,o=d&1==(0|u);do{if(!((255&(0|at(A,1)))<<24>>24)){if(-99999==(0|(e=0|ut(A)))|(0|u)<(0|e)){a=31;break A}if(ar[(i=f+(24*l|0)+(u<<2)|0)>>2]=16,0|e){if(!(w|1==(0|e))){a=13;break A}Eu(0|c,n+((o=u-e|0)<<10)|0,0|s),o=0|ar[f+(24*l|0)+(o<<2)>>2],ar[i>>2]=o,a=21;break}if(h){for(i=34972,o=(e=c)+16|0;tr[e>>0]=0|tr[i>>0],i=i+1|0,(0|(e=e+1|0))<(0|o););a=22;break}if((0|u)<3&(1^o)){for(i=34988,o=(e=c)+64|0;tr[e>>0]=0|tr[i>>0],i=i+1|0,(0|(e=e+1|0))<(0|o););o=16,a=21;break}for(i=35052,o=(e=c)+64|0;tr[e>>0]=0|tr[i>>0],i=i+1|0,(0|(e=e+1|0))<(0|o););o=16,a=21;break}if(b){if(254<((e=0|st(A))+7|0)>>>0){a=31;break A}o=e+8|0,e=ar[f+(24*l|0)+(u<<2)>>2]=o}else e=8,o=16;for(a=0;;){if(255<((i=0|st(A))+128|0)>>>0){a=31;break A}if(e=(e+256+i|0)%256|0,tr[n+(u<<10)+a>>0]=e,(0|s)<=(0|(a=a+1|0))){a=21;break}}}while(0);e:do{if(21==(0|a))switch((a=0)|l){case 0:a=22;break e;case 1:for(i=0|Cn(3,0),e=0;tr[((0|cr[i+(e<<1)+1>>0])<<3)+(0|cr[i+(e<<1)>>0])+(r+96+(u<<6))>>0]=0|tr[n+(u<<10)+e>>0],64!=(0|(e=e+1|0)););break;case 2:for(i=0|Cn(3,0),e=0;c=i+(e<<1)|0,v=i+(e<<1)+1|0,g=0|tr[n+(u<<10)+e>>0],tr[((0|cr[v>>0])<<5)+((0|cr[c>>0])<<1)+(r+480+(u<<8))>>0]=g,tr[((0|cr[c>>0])<<1|1)+((0|cr[v>>0])<<5)+(r+480+(u<<8))>>0]=g,tr[((0|cr[v>>0])<<5|16)+((0|cr[c>>0])<<1)+(r+480+(u<<8))>>0]=g,tr[((0|cr[v>>0])<<5|16)+((0|cr[c>>0])<<1|1)+(r+480+(u<<8))>>0]=g,64!=(0|(e=e+1|0)););tr[r+480+(u<<8)>>0]=o;break e;case 3:On(g=r+2016+(u<<10)|0,c,3),tr[g>>0]=o;break e;default:break e}}while(0);if(22==(0|a))for(i=0|Cn(2,0),e=0;tr[((0|cr[i+(e<<1)+1>>0])<<2)+(0|cr[i+(e<<1)>>0])+(r+(u<<4))>>0]=0|tr[n+(u<<10)+e>>0],16!=(0|(e=e+1|0)););u=u+1|0}while((0|u)<(0|k));if(4<=(0|(l=l+1|0))){e=0,a=32;break}}if(13==(0|a))br(35136,34965,873,35173);else{if(31==(0|a))return ur=t,0|(g=8);if(32==(0|a))return ur=t,0|e}return 0}function Sn(A){A|=0;var e=0,r=0,i=0,f=0,n=0,t=0,o=0;for(r=0|Cn(2,0),e=0;tr[A+(((0|cr[r+(e<<1)+1>>0])<<2)+(0|cr[r+(e<<1)>>0]))>>0]=0|tr[34972+e>>0],16!=(0|(e=e+1|0)););for(r=0|Cn(2,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<2)+(0|cr[r+(e<<1)>>0])+(A+16)>>0]=0|tr[34972+e>>0],16!=(0|(e=e+1|0)););for(r=0|Cn(2,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<2)+(0|cr[r+(e<<1)>>0])+(A+32)>>0]=0|tr[34972+e>>0],16!=(0|(e=e+1|0)););for(r=0|Cn(2,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<2)+(0|cr[r+(e<<1)>>0])+(A+48)>>0]=0|tr[34972+e>>0],16!=(0|(e=e+1|0)););for(r=0|Cn(2,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<2)+(0|cr[r+(e<<1)>>0])+(A+64)>>0]=0|tr[34972+e>>0],16!=(0|(e=e+1|0)););for(r=0|Cn(2,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<2)+(0|cr[r+(e<<1)>>0])+(A+80)>>0]=0|tr[34972+e>>0],16!=(0|(e=e+1|0)););for(r=0|Cn(3,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<3)+(0|cr[r+(e<<1)>>0])+(A+96)>>0]=0|tr[34988+e>>0],64!=(0|(e=e+1|0)););for(r=0|Cn(3,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<3)+(0|cr[r+(e<<1)>>0])+(A+288)>>0]=0|tr[35052+e>>0],64!=(0|(e=e+1|0)););for(r=0|Cn(3,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<3)+(0|cr[r+(e<<1)>>0])+(A+160)>>0]=0|tr[34988+e>>0],64!=(0|(e=e+1|0)););for(r=0|Cn(3,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<3)+(0|cr[r+(e<<1)>>0])+(A+352)>>0]=0|tr[35052+e>>0],64!=(0|(e=e+1|0)););for(r=0|Cn(3,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<3)+(0|cr[r+(e<<1)>>0])+(A+224)>>0]=0|tr[34988+e>>0],64!=(0|(e=e+1|0)););for(r=0|Cn(3,0),e=0;tr[((0|cr[r+(e<<1)+1>>0])<<3)+(0|cr[r+(e<<1)>>0])+(A+416)>>0]=0|tr[35052+e>>0],64!=(0|(e=e+1|0)););f=0;do{for(r=0|Cn(3,0),e=0;i=r+(e<<1)|0,t=34988+e|0,tr[((0|cr[(n=r+(e<<1)+1|0)>>0])<<5)+((0|cr[i>>0])<<1)+(A+480+(f<<8))>>0]=0|tr[t>>0],tr[((0|cr[i>>0])<<1|1)+((0|cr[n>>0])<<5)+(A+480+(f<<8))>>0]=0|tr[t>>0],tr[((0|cr[n>>0])<<5|16)+((0|cr[i>>0])<<1)+(A+480+(f<<8))>>0]=0|tr[t>>0],tr[((0|cr[n>>0])<<5|16)+((0|cr[i>>0])<<1|1)+(A+480+(f<<8))>>0]=0|tr[t>>0],64!=(0|(e=e+1|0)););for(r=f+3|0,i=0|Cn(3,0),e=0;t=i+(e<<1)|0,o=35052+e|0,tr[((0|cr[(n=i+(e<<1)+1|0)>>0])<<5)+((0|cr[t>>0])<<1)+(A+480+(r<<8))>>0]=0|tr[o>>0],tr[((0|cr[t>>0])<<1|1)+((0|cr[n>>0])<<5)+(A+480+(r<<8))>>0]=0|tr[o>>0],tr[((0|cr[n>>0])<<5|16)+((0|cr[t>>0])<<1)+(A+480+(r<<8))>>0]=0|tr[o>>0],tr[((0|cr[n>>0])<<5|16)+((0|cr[t>>0])<<1|1)+(A+480+(r<<8))>>0]=0|tr[o>>0],64!=(0|(e=e+1|0)););f=f+1|0}while(3!=(0|f));On(A+2016|0,34988,3),On(A+3040|0,35052,3)}function Un(A,e,r){return A|=0,e|=0,e=255&(0|at(r|=0,1)),tr[A>>0]=e,e=255&(0|at(r,1)),tr[A+1>>0]=e,e=255&(0|at(r,1)),tr[A+2>>0]=e,e=255&(0|at(r,1)),tr[A+3>>0]=e,e=255&(0|at(r,1)),tr[A+4>>0]=e,e=255&(0|at(r,1)),tr[A+5>>0]=e,e=255&(0|at(r,1)),tr[A+6>>0]=e,e=255&(0|at(r,1)),tr[A+7>>0]=e,r=255&(0|at(r,1)),tr[A+8>>0]=r,0}function On(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0,o=0;switch(0|(r|=0)){case 0:for(i=0|Cn(2,0),r=0;tr[A+(((0|cr[i+(r<<1)+1>>0])<<2)+(0|cr[i+(r<<1)>>0]))>>0]=0|tr[e+r>>0],16!=(0|(r=r+1|0)););return;case 1:for(i=0|Cn(3,0),r=0;tr[A+(((0|cr[i+(r<<1)+1>>0])<<3)+(0|cr[i+(r<<1)>>0]))>>0]=0|tr[e+r>>0],64!=(0|(r=r+1|0)););return;case 2:for(i=0|Cn(3,0),r=0;o=i+(r<<1)+1|0,n=e+r|0,tr[A+(((0|cr[(t=i+(r<<1)|0)>>0])<<1)+((0|cr[o>>0])<<5))>>0]=0|tr[n>>0],tr[A+(((0|cr[t>>0])<<1|1)+((0|cr[o>>0])<<5))>>0]=0|tr[n>>0],tr[A+(((0|cr[t>>0])<<1)+((0|cr[o>>0])<<5|16))>>0]=0|tr[n>>0],tr[A+(((0|cr[t>>0])<<1|1)+((0|cr[o>>0])<<5|16))>>0]=0|tr[n>>0],64!=(0|(r=r+1|0)););return;case 3:f=0|Cn(3,0),i=0;do{for(n=f+(i<<1)|0,t=f+(i<<1)+1|0,o=e+i|0,r=0;tr[A+(((0|cr[n>>0])<<2)+(((0|cr[t>>0])<<2)+r<<5))>>0]=0|tr[o>>0],tr[A+(((0|cr[n>>0])<<2|1)+(((0|cr[t>>0])<<2)+r<<5))>>0]=0|tr[o>>0],tr[A+(((0|cr[n>>0])<<2|2)+(((0|cr[t>>0])<<2)+r<<5))>>0]=0|tr[o>>0],tr[A+(((0|cr[n>>0])<<2|3)+(((0|cr[t>>0])<<2)+r<<5))>>0]=0|tr[o>>0],4!=(0|(r=r+1|0)););i=i+1|0}while(64!=(0|i));return;default:br(37782,34965,810,35116)}}function Hn(A){_u(A|=0)}function xn(A){Fu(A|=0)}function jn(A){ar[(A|=0)>>2]=0,IA(A+4|0,0),gA(A+32|0,0)}function zn(A){WA((A|=0)+4|0),vA(A+32|0)}function Pn(A,e){e|=0;var r,i=0;if(!((0|ar[(A|=0)>>2])>=(0|e))){if(_u(r=A+4|0),(0|ar[A>>2])<(0|e))for(i=A+32|0;pA(0|i,0|r),(0|ar[A>>2])<(0|e););Fu()}}function Ln(A,e){e|=0;var r;_u(r=(A|=0)+4|0),(0|ar[A>>2])>=(0|e)||(ar[A>>2]=e,Xu()),Fu()}function Kn(A,e){e|=0;var r;_u(r=(A|=0)+4|0),ar[A>>2]=(0|ar[A>>2])+e,Xu(),Fu()}function qn(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0;_u(n=(A|=0)+420|0),0|tr[A>>0]||(t=0|ar[(i=A+8|0)>>2],c=(0|ar[A+12>>2])-t|0,a=0|ar[(o=A+20|0)>>2],(0|(0==(0|c)?0:(c<<8)-1|0))==((r=0|ar[(f=A+24|0)>>2])+a|0)?(function(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(ur=(b=ur)+32|0,c=b+4|0,a=b,1023<(r=0|ar[(e=16+(A|=0)|0)>>2])>>>0){ar[e>>2]=r+-1024,c=0|ar[(l=A+4|0)>>2],s=0|ar[c>>2],c=c+4|0,ar[l>>2]=c,o=0|ar[(u=A+8|0)>>2],t=0|ar[(a=A+12|0)>>2],e=t,n=o;do{if((0|o)==(0|t)){if(r=0|ar[A>>2],(i=r)>>>0<c>>>0){f=(e=c)+((i=(1+(e-i>>2)|0)/-2|0)<<2)|0,e=(r=(e=n-e|0)>>2)?(Gu(0|f,0|c,0|e),0|ar[l>>2]):c,A=f+(r<<2)|0,ar[u>>2]=A,ar[l>>2]=e+(i<<2),e=A;break}if(1073741823<(e=0==(0|(e=e-i>>1))?1:e)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),f=0|El(e<<2),t=i=(n=f)+(e>>>2<<2)|0,f=f+(e<<2)|0,(0|c)==(0|o))e=t;else{for(e=t,r=c;ar[i>>2]=ar[r>>2],e=i=e+4|0,(0|(r=r+4|0))!=(0|o););r=0|ar[A>>2]}ar[A>>2]=n,ar[l>>2]=t,ar[u>>2]=e,ar[a>>2]=f,r&&(Vl(r),e=0|ar[u>>2])}else e=o}while(0);return ar[e>>2]=s,ar[u>>2]=4+(0|ar[u>>2]),ur=b}if(e=0|ar[(s=A+8|0)>>2],f=e-(0|ar[(u=A+4|0)>>2])|0,r=0|ar[(l=A+12|0)>>2],i=r-(0|ar[A>>2])|0,i>>>0<=f>>>0){for(e=0==(0|(e=i>>1))?1:e,ar[c+12>>2]=0,ar[c+16>>2]=A+12,1073741823<e>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),i=0|El(e<<2),ar[c>>2]=i,t=i+(f>>2<<2)|0,ar[(o=c+8|0)>>2]=t,ar[(n=c+4|0)>>2]=t,ar[(t=c+12|0)>>2]=i+(e<<2),f=0|El(4096),ar[a>>2]=f,function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=0|ar[(s=8+(A|=0)|0)>>2],u=0|ar[(i=A+12|0)>>2],t=u,a=r;do{if((0|r)==(0|u)){if(l=0|ar[(u=A+4|0)>>2],n=0|ar[A>>2],(f=n)>>>0<l>>>0){o=(n=l)+((t=(1+(n-f>>2)|0)/-2|0)<<2)|0,f=(n=(f=a-n|0)>>2)?(Gu(0|o,0|l,0|f),0|ar[u>>2]):l,l=o+(n<<2)|0,ar[s>>2]=l,ar[u>>2]=f+(t<<2),f=l;break}if(1073741823<(f=0==(0|(f=t-f>>1))?1:f)>>>0&&(Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)),o=0|El(f<<2),c=t=(a=o)+(f>>>2<<2)|0,o=o+(f<<2)|0,(0|l)==(0|r))f=c;else{for(f=c,n=l;ar[t>>2]=ar[n>>2],f=t=f+4|0,(0|(n=n+4|0))!=(0|r););n=0|ar[A>>2]}ar[A>>2]=a,ar[u>>2]=c,ar[s>>2]=f,ar[i>>2]=o,n&&(Vl(n),f=0|ar[s>>2])}else f=r}while(0);ar[f>>2]=ar[e>>2],ar[s>>2]=4+(0|ar[s>>2])}(c,a),f=0|ar[s>>2];e=0|ar[u>>2],(0|f)!=(0|e);)$n(c,a=f+-4|0),f=a;return r=e,i=0|ar[A>>2],ar[A>>2]=ar[c>>2],ar[c>>2]=i,ar[u>>2]=ar[n>>2],ar[n>>2]=r,e=0|ar[s>>2],ar[s>>2]=ar[o>>2],ar[o>>2]=e,A=0|ar[l>>2],ar[l>>2]=ar[t>>2],ar[t>>2]=A,(0|e)!=(0|f)&&(ar[o>>2]=e+(~((e+-4-r|0)>>>2)<<2)),0|i&&Vl(i),ur=b}if((0|r)!=(0|e))return s=0|El(4096),ar[c>>2]=s,function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=0|ar[(s=8+(A|=0)|0)>>2],u=0|ar[(i=A+12|0)>>2],t=u,a=r;do{if((0|r)==(0|u)){if(l=0|ar[(u=A+4|0)>>2],n=0|ar[A>>2],(f=n)>>>0<l>>>0){o=(n=l)+((t=(1+(n-f>>2)|0)/-2|0)<<2)|0,f=(n=(f=a-n|0)>>2)?(Gu(0|o,0|l,0|f),0|ar[u>>2]):l,l=o+(n<<2)|0,ar[s>>2]=l,ar[u>>2]=f+(t<<2),f=l;break}if(1073741823<(f=0==(0|(f=t-f>>1))?1:f)>>>0&&(Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)),o=0|El(f<<2),c=t=(a=o)+(f>>>2<<2)|0,o=o+(f<<2)|0,(0|l)==(0|r))f=c;else{for(f=c,n=l;ar[t>>2]=ar[n>>2],f=t=f+4|0,(0|(n=n+4|0))!=(0|r););n=0|ar[A>>2]}ar[A>>2]=a,ar[u>>2]=c,ar[s>>2]=f,ar[i>>2]=o,n&&(Vl(n),f=0|ar[s>>2])}else f=r}while(0);ar[f>>2]=ar[e>>2],ar[s>>2]=4+(0|ar[s>>2])}(A,c),ur=b;a=0|El(4096),ar[c>>2]=a,function(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;r=0|ar[(b=4+(A|=0)|0)>>2],s=0|ar[A>>2],n=s;do{if((0|r)==(0|s)){if(f=0|ar[(s=A+8|0)>>2],l=0|ar[(u=A+12|0)>>2],f>>>0<(i=l)>>>0){t=(i=(n=f)+((o=(1+(i-n>>2)|0)/2|0)<<2)|0)+(0-(u=(n=n-r|0)>>2)<<2)|0,u&&(Gu(0|t,0|r,0|n),i=t,f=0|ar[s>>2]),ar[b>>2]=i,ar[s>>2]=f+(o<<2);break}if(1073741823<(n=0==(0|(n=i-n>>1))?1:n)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),a=0|El(n<<2),l=i=(c=a)+((n+3|0)>>>2<<2)|0,a=a+(n<<2)|0,(0|r)==(0|f))n=l,f=r;else{for(o=i,n=l,t=r;ar[o>>2]=ar[t>>2],n=o=n+4|0,(0|(t=t+4|0))!=(0|f););f=0|ar[A>>2]}ar[A>>2]=c,ar[b>>2]=l,ar[s>>2]=n,ar[u>>2]=a,f&&(Vl(f),i=0|ar[b>>2])}else i=r}while(0);ar[i+-4>>2]=ar[e>>2],ar[b>>2]=(0|ar[b>>2])-4}(A,c),a=0|ar[u>>2],c=0|ar[a>>2],a=a+4|0,ar[u>>2]=a,o=0|ar[s>>2],t=0|ar[l>>2],e=t,n=o;do{if((0|o)==(0|t)){if(r=0|ar[A>>2],(i=r)>>>0<a>>>0){f=(e=a)+((i=(1+(e-i>>2)|0)/-2|0)<<2)|0,e=(r=(e=n-e|0)>>2)?(Gu(0|f,0|a,0|e),0|ar[u>>2]):a,A=f+(r<<2)|0,ar[s>>2]=A,ar[u>>2]=e+(i<<2),e=A;break}if(1073741823<(e=0==(0|(e=e-i>>1))?1:e)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),f=0|El(e<<2),t=i=(n=f)+(e>>>2<<2)|0,f=f+(e<<2)|0,(0|a)==(0|o))e=t;else{for(e=t,r=a;ar[i>>2]=ar[r>>2],e=i=e+4|0,(0|(r=r+4|0))!=(0|o););r=0|ar[A>>2]}ar[A>>2]=n,ar[u>>2]=t,ar[s>>2]=e,ar[l>>2]=f,r&&(Vl(r),e=0|ar[s>>2])}else e=o}while(0);ar[e>>2]=c,ar[s>>2]=4+(0|ar[s>>2]),ur=b}(A+4|0),a=0|ar[o>>2],o=0|ar[f>>2],t=0|ar[i>>2]):o=r,ar[(0|ar[t+((c=o+a|0)>>>10<<2)>>2])+((1023&c)<<2)>>2]=e,ar[f>>2]=o+1,mA(A+448|0)),Fu()}function $n(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;r=0|ar[(b=(A|=0)+4|0)>>2],n=s=0|ar[A>>2];do{if((0|r)==(0|s)){if((f=0|ar[(s=A+8|0)>>2])>>>0<(i=l=0|ar[(u=A+12|0)>>2])>>>0){t=(i=(n=f)+((o=(1+(i-n>>2)|0)/2|0)<<2)|0)+(0-(u=(n=n-r|0)>>2)<<2)|0,u&&(Gu(0|t,0|r,0|n),i=t,f=0|ar[s>>2]),ar[b>>2]=i,ar[s>>2]=f+(o<<2);break}if(1073741823<(n=0==(0|(n=i-n>>1))?1:n)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),l=i=(c=a=0|El(n<<2))+((n+3|0)>>>2<<2)|0,a=a+(n<<2)|0,(0|r)==(0|f))n=l,f=r;else{for(o=i,n=l,t=r;ar[o>>2]=ar[t>>2],n=o=n+4|0,(0|(t=t+4|0))!=(0|f););f=0|ar[A>>2]}ar[A>>2]=c,ar[b>>2]=l,ar[s>>2]=n,ar[u>>2]=a,f&&(Vl(f),i=0|ar[b>>2])}else i=r}while(0);ar[i+-4>>2]=ar[e>>2],ar[b>>2]=(0|ar[b>>2])-4}function At(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0;u=5932+(o=0|ar[(a=(A|=0)+18596|0)>>2])|0,t=0|ar[(s=A+18600|0)>>2],n=(h=-1<<ar[10092+o>>2])&i,h&=f,r=A+18536|0,(0|n)==(0|ar[(e=A+18532|0)>>2])&&(0|h)==(0|ar[r>>2])||(ar[A+18540>>2]=ar[A+18528>>2],ar[e>>2]=n,ar[r>>2]=h),k=5804+o|0,l=n?0:0==((1<<ar[k>>2])-1&h|0),e=0|ar[800+t>>2],r=0|ar[5820+o>>2],c=0|ar[5812+o>>2],r=(0|sr(c,(0|e)%(0|r)|0))==(0|n)?(0|sr((0|e)/(0|r)|0,c))==(0|h):0,e=0!=(0|tr[5966+o>>0])&&0==((1<<(b=0|ar[k>>2]))-1&(n|h)|0)?0|Yo(u,n>>b,h>>b):0;do{if(r|e)d=14;else{if(l&&0|tr[5965+o>>0]){d=14;break}e=A+18540|0}}while(0);14==(0|d)&&(e=792+(0|ar[s>>2])|0),u=0|ar[e>>2],e=n-1|0;do{if(0|vo(0|ar[a>>2],n,h,e,h)&&(d=0|ar[5864+o>>2],b=(0|sr(h>>d,0|ar[5852+o>>2]))+(e>>d)|0,(ar[(0|ar[10320+o>>2])+(b<<2)>>2]>>((0|ar[k>>2])-d<<1)|0)==(0|ar[A+4>>2]))){if(l=0|ar[a>>2],e>>=r=0|ar[l+10368>>2],r=h>>r,(0|e)<=-1&&br(41808,41845,118,41865),(0|(c=0|ar[l+10372>>2]))<=(0|e)&&br(41808,41845,118,41865),(0|r)<=-1&&br(41869,41845,119,41865),(0|r)<(0|ar[l+10376>>2])){w=(0|ar[l+10360>>2])+(3*((0|sr(c,r))+e|0)|0)+2|0,w=0|tr[w>>0];break}br(41869,41845,119,41865)}else w=u}while(0);e=h+-1|0;do{if(0|vo(0|ar[a>>2],n,h,n,e)&&(h=0|ar[5864+o>>2],d=(0|sr(e>>h,0|ar[5852+o>>2]))+(n>>h)|0,(ar[(0|ar[10320+o>>2])+(d<<2)>>2]>>((0|ar[k>>2])-h<<1)|0)==(0|ar[A+4>>2]))){if(l=0|ar[a>>2],e>>=h=0|ar[l+10368>>2],(0|(c=n>>h))<=-1&&br(41808,41845,118,41865),(0|(r=0|ar[l+10372>>2]))<=(0|c)&&br(41808,41845,118,41865),(0|e)<=-1&&br(41869,41845,119,41865),(0|e)<(0|ar[l+10376>>2])){v=(0|ar[l+10360>>2])+(3*((0|sr(r,e))+c|0)|0)+2|0,v=0|tr[v>>0];break}br(41869,41845,119,41865)}else v=u}while(0);h=0|ar[5764+o>>2],h=(e=(52+(0|ar[A+18512>>2])+(w+1+v>>1)+(h<<1)|0)%(h+52|0)|0)-h|0,ar[A+18544>>2]=e,e=(0|(e=(0|ar[5952+o>>2])+h+(0|ar[744+t>>2])+(0|ar[A+18520>>2])|0))<(0|(v=0-(c=0|ar[5772+o>>2])|0))?v:(0|e)<57?e:57,r=(0|(r=(0|ar[5956+o>>2])+h+(0|ar[748+t>>2])+(0|ar[A+18524>>2])|0))<(0|v)?v:(0|r)<57?r:57;do{if(1==(0|ar[5776+o>>2])){do{if(30<=(0|e)){if(42<(0|e)){e=e+-6|0;break}e=0|ar[6364+(e+-30<<2)>>2];break}}while(0);if(30<=(0|r)){if(42<(0|r)){r=r+-6|0;break}r=0|ar[6364+(r+-30<<2)>>2];break}}}while(0);if(ar[A+18548>>2]=c+e,ar[A+18552>>2]=c+r,e=0|ar[a>>2],c=f>>(r=0|ar[e+10368>>2]),(0|(k=i>>r))<=-1&&br(41808,41845,118,41865),(0|(d=0|ar[e+10372>>2]))<=(0|k)&&br(41808,41845,118,41865),(0|c)<=-1&&br(41869,41845,119,41865),(0|c)>=(0|ar[e+10376>>2])&&br(41869,41845,119,41865),f=(b=0|ar[e+10360>>2])+(3*((0|sr(d,c))+k|0)|0)|0,s=(e=1<<(f=(3<(f=7&(cr[f>>0]|cr[f+1>>0]<<8))>>>0?f:3)-r|0))+c|0,31!=(0|f)){l=e+k|0,u=255&h,e=c;do{for(c=0|sr(e,d),r=k;tr[b+(3*(r+c|0)|0)+2>>0]=u,(0|(r=r+1|0))<(0|l););e=e+1|0}while((0|e)<(0|s));ar[(A=A+18528|0)>>2]=h}else ar[(A=A+18528|0)>>2]=h}function et(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l;return l=0|ar[(A|=0)+18596>>2],8<(0|ar[(0==(0|t)?5760+l|0:5768+l|0)>>2])?void function(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s,b,d,k,h,w,v,g,m,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0;switch(ur=(m=ur)+4096|0,b=m,s=0|ar[(k=18596+(A|=0)|0)>>2],0|t){case 0:p=A+18544|0;break;case 1:p=A+18548|0;break;case 2:p=A+18552|0;break;default:br(37782,37769,367,37784)}I=0|ar[p>>2],i=0|ar[(g=A+2112|0)>>2],h=0|ar[((d=0==(0|t))?40+s|0:44+s|0)>>2],v=(0|ar[4+s+(t<<2)>>2])+((0|sr(h,r))+e<<1)|0,w=0|ar[(d?5760+s|0:5768+s|0)>>2],f=0|ar[10368+s>>2],e>>=f,f=r>>f,(0|e)<=-1&&br(41808,41845,118,41865);p=0|ar[10372+s>>2],(0|p)<=(0|e)&&br(41808,41845,118,41865);(0|f)<=-1&&br(41869,41845,119,41865);(0|f)>=(0|ar[10376+s>>2])&&br(41869,41845,119,41865);E=(0|ar[10360+s>>2])+(3*((0|sr(p,f))+e|0)|0)|0,E=(65535&(cr[E>>0]|cr[E+1>>0]<<8))>>>8&3,l=65535&E,E=(u=4==(0|n))&0!=(0|tr[5748+s>>0])&E<<16>>16==0;A:do{if(0|tr[A+32>>0]){if(r=d?A+14412|0:b,0<(0|or[(p=A+14404+(t<<1)|0)>>1]))for(f=0;or[i+(or[A+8260+(t<<11)+(f<<1)>>1]<<1)>>1]=0|or[A+2116+(t<<11)+(f<<1)>>1],(0|(f=f+1|0))<(0|or[p>>1]););E&&ks[63&ar[432+(0|ar[A+18592>>2])>>2]](i,4);do{if(c){if(f=0|ar[A+18592>>2],2==(0|c)){hs[127&ar[f+368>>2]](r,i,n);break}hs[127&ar[f+372>>2]](r,i,n);break}hs[127&ar[364+(0|ar[A+18592>>2])>>2]](r,i,n)}while(0);if(!d&&0|ar[(y=A+28|0)>>2]&&(C=0|ar[k>>2],Z=0|ar[C+5768>>2],C=0|ar[C+5760>>2],0<(0|n))){f=0;do{for(e=0|sr(f,n),p=0;F=(0|sr(ar[A+14412+((N=p+e|0)<<2)>>2]<<Z>>C,0|ar[y>>2]))>>3,ar[(N=r+(N<<2)|0)>>2]=F+(0|ar[N>>2]),(0|(p=p+1|0))!=(0|n););f=f+1|0}while((0|f)!=(0|n))}if(vs[15&ar[460+(0|ar[A+18592>>2])>>2]](v,h,r,n,w),E)for(f=i+32|0;((or[i>>1]=0)|(i=i+2|0))<(0|f););}else{if(W=1<(0|n))for(p=n,f=0;f=f+1|0,3<p>>>0;)p>>>=1;else f=0;if(C=(f=f+w|0)+-5|0,0|tr[1400+s>>0]){Z=1<<f+-6;do{if(!a){if((0|n)<32){f=t+3|0;break}f=t+1|0;break}f=t}while(0);switch((a=n+-4|0)>>>2|a<<30|0){case 0:B=5993+s+(f<<4)|0;break;case 1:B=6089+s+(f<<6)|0;break;case 3:B=6473+s+(f<<8)|0;break;case 7:B=8009+s+(f<<10)|0;break;default:br(37782,37769,492,37784)}if(0<(0|or[(r=A+14404+(t<<1)|0)>>1]))for(y=0|ar[6416+(((0|I)%6|0)<<2)>>2],p=(0|I)/6|0,e=((0|Z)<0)<<31>>31,f=0;I=0|or[A+8260+(t<<11)+(f<<1)>>1],F=(0|sr(0|cr[B+I>>0],y))<<p,a=0|or[A+2116+(t<<11)+(f<<1)>>1],a=0|Cu(0|(a=0|vu(0|(a=0|wu(0|F,((0|F)<0)<<31>>31|0,0|a,((0|a)<0)<<31>>31|0)),0|D,0|Z,0|e)),0|D,0|C),_=(0|(F=D))<-1|-1==(0|F)&a>>>0<4294934528,a=(N=(0|F)<0|0==(0|F)&a>>>0<32767)?a:32767,or[i+(I<<1)>>1]=_?-32768:65535&a,(0|(f=f+1|0))<(0|or[r>>1]););}else if(y=f+-9|0,r=1<<f+-10,p=ar[6416+(((0|I)%6|0)<<2)>>2]<<((0|I)/6|0),0<(0|or[(e=A+14404+(t<<1)|0)>>1]))for(f=0;B=(0|sr(0|or[A+2116+(t<<11)+(f<<1)>>1],p))+r>>y,or[i+(or[A+8260+(t<<11)+(f<<1)>>1]<<1)>>1]=(0|B)<-32768?-32768:65535&((0|B)<32767?B:32767),(0|(f=f+1|0))<(0|or[e>>1]););if(y=0<(0|n),!o){if(p=u&0==(l|t|0),0|c&&br(37812,37769,591,37784),0|tr[10071+s>>0]){it(A,i,n,n,1&p,v,h,w,t);break}if(f=0|ar[A+18592>>2],p){ws[31&ar[f+412>>2]](v,i,h,w);break}switch(0|n){case 4:ws[31&ar[f+416>>2]](v,i,h,w);break A;case 8:ws[31&ar[f+420>>2]](v,i,h,w);break A;case 16:ws[31&ar[f+424>>2]](v,i,h,w);break A;default:ws[31&ar[f+428>>2]](v,i,h,w);break A}}if(W){for(f=n,p=0;3<f>>>0;)f>>>=1,p=p+1|0;p=p+6|0}else p=5;e=0<(0|(e=20-w|0))?e:0,E&&ks[63&ar[432+(0|ar[A+18592>>2])>>2]](i,4),r=d?A+14412|0:b;do{if(c){if(f=0|ar[A+18592>>2],2==(0|c)){vs[15&ar[f+464>>2]](r,i,n,p,e);break}vs[15&ar[f+468>>2]](r,i,n,p,e);break}vs[15&ar[472+(0|ar[A+18592>>2])>>2]](r,i,n,p,e)}while(0);if(!d&&0|ar[(G=A+28|0)>>2]&&(X=0|ar[k>>2],V=0|ar[X+5768>>2],X=0|ar[X+5760>>2],y)){f=0;do{for(e=0|sr(f,n),p=0;F=(0|sr(ar[A+14412+((N=p+e|0)<<2)>>2]<<V>>X,0|ar[G>>2]))>>3,ar[(N=r+(N<<2)|0)>>2]=F+(0|ar[N>>2]),(0|(p=p+1|0))!=(0|n););f=f+1|0}while((0|f)!=(0|n))}if(vs[15&ar[460+(0|ar[A+18592>>2])>>2]](v,h,r,n,w),E)for(f=i+32|0;((or[i>>1]=0)|(i=i+2|0))<(0|f););}}while(0);if((0|or[(p=A+14404+(t<<1)|0)>>1])<=0)return ur=m;f=0|ar[g>>2],i=0;for(;or[f+(or[A+8260+(t<<11)+(i<<1)>>1]<<1)>>1]=0,i=i+1|0,(0|i)<(0|or[p>>1]););ur=m}(A,e,r,i,f,n,t,o,a,c):void function(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0;var l,u,s,b,d,k,h,w,v,g,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0;switch(ur=(g=ur)+4096|0,b=g,s=0|ar[(k=18596+(A|=0)|0)>>2],0|t){case 0:m=A+18544|0;break;case 1:m=A+18548|0;break;case 2:m=A+18552|0;break;default:br(37782,37769,367,37784)}W=0|ar[m>>2],i=0|ar[(v=A+2112|0)>>2],h=0|ar[((d=0==(0|t))?40+s|0:44+s|0)>>2],w=(0|ar[4+s+(t<<2)>>2])+((0|sr(h,r))+e)|0,f=0|ar[10368+s>>2],e>>=f,f=r>>f,(0|e)<=-1&&br(41808,41845,118,41865);m=0|ar[10372+s>>2],(0|m)<=(0|e)&&br(41808,41845,118,41865);(0|f)<=-1&&br(41869,41845,119,41865);(0|f)>=(0|ar[10376+s>>2])&&br(41869,41845,119,41865);B=(0|ar[10360+s>>2])+(3*((0|sr(m,f))+e|0)|0)|0,B=(65535&(cr[B>>0]|cr[B+1>>0]<<8))>>>8&3,l=65535&B,B=(u=4==(0|n))&0!=(0|tr[5748+s>>0])&B<<16>>16==0;A:do{if(0|tr[A+32>>0]){if(r=d?A+14412|0:b,0<(0|or[(m=A+14404+(t<<1)|0)>>1]))for(f=0;or[i+(or[A+8260+(t<<11)+(f<<1)>>1]<<1)>>1]=0|or[A+2116+(t<<11)+(f<<1)>>1],(0|(f=f+1|0))<(0|or[m>>1]););B&&ks[63&ar[432+(0|ar[A+18592>>2])>>2]](i,4);do{if(c){if(f=0|ar[A+18592>>2],2==(0|c)){hs[127&ar[f+368>>2]](r,i,n);break}hs[127&ar[f+372>>2]](r,i,n);break}hs[127&ar[364+(0|ar[A+18592>>2])>>2]](r,i,n)}while(0);if(!d&&0|ar[(p=A+28|0)>>2]&&(Z=0|ar[k>>2],y=0|ar[Z+5768>>2],Z=0|ar[Z+5760>>2],0<(0|n))){f=0;do{for(e=0|sr(f,n),m=0;_=(0|sr(ar[A+14412+((F=m+e|0)<<2)>>2]<<y>>Z,0|ar[p>>2]))>>3,ar[(F=r+(F<<2)|0)>>2]=_+(0|ar[F>>2]),(0|(m=m+1|0))!=(0|n););f=f+1|0}while((0|f)!=(0|n))}if(vs[15&ar[456+(0|ar[A+18592>>2])>>2]](w,h,r,n,8),B)for(f=i+32|0;((or[i>>1]=0)|(i=i+2|0))<(0|f););}else{if(e=0|ar[(d?5760+s|0:5768+s|0)>>2],C=1<(0|n))for(m=n,f=0;f=f+1|0,3<m>>>0;)m>>>=1;else f=0;if(Z=(f=f+e|0)+-5|0,0|tr[1400+s>>0]){y=1<<f+-6;do{if(!a){if((0|n)<32){f=t+3|0;break}f=t+1|0;break}f=t}while(0);switch((a=n+-4|0)>>>2|a<<30|0){case 0:I=5993+s+(f<<4)|0;break;case 1:I=6089+s+(f<<6)|0;break;case 3:I=6473+s+(f<<8)|0;break;case 7:I=8009+s+(f<<10)|0;break;default:br(37782,37769,492,37784)}if(0<(0|or[(r=A+14404+(t<<1)|0)>>1]))for(p=0|ar[6416+(((0|W)%6|0)<<2)>>2],m=(0|W)/6|0,e=((0|y)<0)<<31>>31,f=0;W=0|or[A+8260+(t<<11)+(f<<1)>>1],_=(0|sr(0|cr[I+W>>0],p))<<m,a=0|or[A+2116+(t<<11)+(f<<1)>>1],a=0|Cu(0|(a=0|vu(0|(a=0|wu(0|_,((0|_)<0)<<31>>31|0,0|a,((0|a)<0)<<31>>31|0)),0|D,0|y,0|e)),0|D,0|Z),X=(0|(_=D))<-1|-1==(0|_)&a>>>0<4294934528,a=(F=(0|_)<0|0==(0|_)&a>>>0<32767)?a:32767,or[i+(W<<1)>>1]=X?-32768:65535&a,(0|(f=f+1|0))<(0|or[r>>1]););}else if(p=f+-9|0,r=1<<f+-10,m=ar[6416+(((0|W)%6|0)<<2)>>2]<<((0|W)/6|0),0<(0|or[(e=A+14404+(t<<1)|0)>>1]))for(f=0;I=(0|sr(0|or[A+2116+(t<<11)+(f<<1)>>1],m))+r>>p,or[i+(or[A+8260+(t<<11)+(f<<1)>>1]<<1)>>1]=(0|I)<-32768?-32768:65535&((0|I)<32767?I:32767),(0|(f=f+1|0))<(0|or[e>>1]););if(e=0<(0|n),!o){if(m=u&0==(l|t|0),0|c&&br(37812,37769,591,37784),0|tr[10071+s>>0]){rt(A,i,n,n,1&m,w,h,8,t);break}if(f=0|ar[A+18592>>2],m){hs[127&ar[f+388>>2]](w,i,h);break}switch(0|n){case 4:hs[127&ar[f+392>>2]](w,i,h);break A;case 8:hs[127&ar[f+396>>2]](w,i,h);break A;case 16:hs[127&ar[f+400>>2]](w,i,h);break A;default:hs[127&ar[f+404>>2]](w,i,h);break A}}if(C){for(f=n,m=0;3<f>>>0;)f>>>=1,m=m+1|0;m=m+6|0}else m=5;B&&ks[63&ar[432+(0|ar[A+18592>>2])>>2]](i,4),r=d?A+14412|0:b;do{if(c){if(f=0|ar[A+18592>>2],2==(0|c)){vs[15&ar[f+464>>2]](r,i,n,m,12);break}vs[15&ar[f+468>>2]](r,i,n,m,12);break}vs[15&ar[472+(0|ar[A+18592>>2])>>2]](r,i,n,m,12)}while(0);if(!d&&0|ar[(E=A+28|0)>>2]&&(V=0|ar[k>>2],G=0|ar[V+5768>>2],V=0|ar[V+5760>>2],e)){f=0;do{for(e=0|sr(f,n),m=0;_=(0|sr(ar[A+14412+((F=m+e|0)<<2)>>2]<<G>>V,0|ar[E>>2]))>>3,ar[(F=r+(F<<2)|0)>>2]=_+(0|ar[F>>2]),(0|(m=m+1|0))!=(0|n););f=f+1|0}while((0|f)!=(0|n))}if(vs[15&ar[456+(0|ar[A+18592>>2])>>2]](w,h,r,n,8),B)for(f=i+32|0;((or[i>>1]=0)|(i=i+2|0))<(0|f););}}while(0);if((0|or[(m=A+14404+(t<<1)|0)>>1])<=0)return ur=g;f=0|ar[v>>2],i=0;for(;or[f+(or[A+8260+(t<<11)+(i<<1)>>1]<<1)>>1]=0,i=i+1|0,(0|i)<(0|or[m>>1]););ur=g}(A,e,r,i,f,n,t,o,a,c)}function rt(A,e,r,i,f,n,t,o,a){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0;var c,l,u,s=0,b=0,d=0,k=0;ur=(u=ur)+4096|0,l=0|ar[(A|=0)+18592>>2],c=(r=0==(0|a))?A+14412|0:u,a=20-o|0;A:do{if(1==(0|f))ws[31&ar[436+l>>2]](c,e,a,15);else switch(0|i){case 4:ws[31&ar[440+l>>2]](c,e,a,15);break A;case 8:ws[31&ar[444+l>>2]](c,e,a,15);break A;case 16:ws[31&ar[448+l>>2]](c,e,a,15);break A;default:ws[31&ar[452+l>>2]](c,e,a,15);break A}}while(0);if(!r&&0|ar[(s=A+28|0)>>2]&&(d=0|ar[A+18596>>2],b=0|ar[d+5768>>2],d=0|ar[d+5760>>2],0<(0|i))){r=0;do{for(e=0|sr(r,i),a=0;k=(0|sr(ar[A+14412+((f=a+e|0)<<2)>>2]<<b>>d,0|ar[s>>2]))>>3,ar[(f=c+(f<<2)|0)>>2]=k+(0|ar[f>>2]),(0|(a=a+1|0))!=(0|i););r=r+1|0}while((0|r)!=(0|i))}vs[15&ar[456+l>>2]](n,t,c,i,o),ur=u}function it(A,e,r,i,f,n,t,o,a){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0;var c,l,u,s=0,b=0,d=0,k=0;ur=(u=ur)+4096|0,l=0|ar[(A|=0)+18592>>2],c=(r=0==(0|a))?A+14412|0:u,a=20-o|0;A:do{if(1==(0|f))ws[31&ar[436+l>>2]](c,e,a,15);else switch(0|i){case 4:ws[31&ar[440+l>>2]](c,e,a,15);break A;case 8:ws[31&ar[444+l>>2]](c,e,a,15);break A;case 16:ws[31&ar[448+l>>2]](c,e,a,15);break A;default:ws[31&ar[452+l>>2]](c,e,a,15);break A}}while(0);if(!r&&0|ar[(s=A+28|0)>>2]&&(d=0|ar[A+18596>>2],b=0|ar[d+5768>>2],d=0|ar[d+5760>>2],0<(0|i))){r=0;do{for(e=0|sr(r,i),a=0;k=(0|sr(ar[A+14412+((f=a+e|0)<<2)>>2]<<b>>d,0|ar[s>>2]))>>3,ar[(f=c+(f<<2)|0)>>2]=k+(0|ar[f>>2]),(0|(a=a+1|0))!=(0|i););r=r+1|0}while((0|r)!=(0|i))}vs[15&ar[460+l>>2]](n,t,c,i,o),ur=u}function ft(A,e,r){A|=0,r|=0;var i,f,n,t;ur=(t=ur)+16|0,f=t,n=42==(0|tr[(e|=0)>>0]),i=0|ar[2129],n||Sr(37831,6,1,i),ar[f>>2]=r,sa(A,e+(1&n)|0,f),Or(i),ur=t}function nt(A,e,r){e|=0,r|=0;var i,f,n=0,t=0;if(tr[(A|=0)>>0]=1,tr[A+44>>0]=1,tt(A,e),f=r+-1|0,i=1<(0|r))for(n=0;t=255&(0|at(e,1)),tr[A+52+(52*n|0)>>0]=t,t=255&(0|at(e,1)),tr[A+52+(52*n|0)+44>>0]=t,(0|(n=n+1|0))!=(0|f););if((r+-2|0)>>>0<7)for(n=f;ct(e,2),(0|(n=n+1|0))<8;);if(i)for(n=0;tt(A+52+(52*n|0)|0,e),(0|(n=n+1|0))!=(0|f););}function tt(A,e){e|=0;var r=0,i=0;if(0|tr[(A|=0)>>0]){for(r=255&(0|at(e,2)),tr[A+1>>0]=r,r=255&(0|at(e,1)),tr[A+2>>0]=r,r=0|at(e,5),ar[A+4>>2]=r,i=255&((r=0)|at(e,1));tr[A+8+r>>0]=i,r=r+1|0,i=255&(0|at(e,1)),32!=(0|r););tr[A+40>>0]=i,i=255&(0|at(e,1)),tr[A+41>>0]=i,i=255&(0|at(e,1)),tr[A+42>>0]=i,i=255&(0|at(e,1)),tr[A+43>>0]=i,ct(e,44)}0|tr[A+44>>0]&&(i=0|at(e,8),ar[A+48>>2]=i)}function ot(A,e,r){r|=0;var i,f,n,t,o,a,c,l,u,s,b,d,k=0,h=0;if(ur=(d=ur)+112|0,b=d+88|0,h=d+80|0,s=d+72|0,u=d+64|0,l=d+56|0,c=d+48|0,a=d+40|0,o=d+32|0,n=d+24|0,t=d+16|0,i=d+8|0,k=d,f=(e|=0)?38853:38861,0|tr[(A|=0)>>0]){switch(e=0|tr[A+1>>0],ar[k>>2]=f,ar[k+4>>2]=e,ft(r,38871,k),k=0|tr[A+2>>0],ar[i>>2]=f,ar[4+i>>2]=k,ft(r,38900,i),0|ar[A+4>>2]){case 1:e=38985;break;case 2:e=38978;break;case 3:e=38961;break;case 4:e=38939;break;default:e=38929}for(ar[t>>2]=f,ar[4+t>>2]=e,ft(r,38990,t),ar[n>>2]=f,ft(r,39019,n),e=0;0|e&&ft(r,39210,s),ar[h>>2]=tr[A+8+e>>0],ft(r,39213,h),32!=(0|(e=e+1|0)););ft(r,39054,o),h=0|tr[A+40>>0],ar[a>>2]=f,ar[4+a>>2]=h,ft(r,39057,a),h=0|tr[A+41>>0],ar[c>>2]=f,ar[4+c>>2]=h,ft(r,39094,c),h=0|tr[A+42>>0],ar[l>>2]=f,ar[4+l>>2]=h,ft(r,39130,l),h=0|tr[A+43>>0],ar[u>>2]=f,ar[4+u>>2]=h,ft(r,39170,u)}ur=(0|tr[A+44>>0]&&(h=0|ar[A+48>>2],ar[b>>2]=f,ar[4+b>>2]=h,J[8+b>>3]=(0|h)/30,ft(r,39217,b)),d)}function at(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if((0|(i=0|ar[(r=(A|=0)+16|0)>>2]))<(0|e)){i=64-i|0,n=A+4|0;A:do{if(7<(0|i)){t=A+8|0,f=0|ar[n>>2];do{if(!f)break A;c=0|ar[A>>2],ar[A>>2]=c+1,c=0|cr[c>>0],f=f+-1|0,ar[n>>2]=f,c=0|Iu(0|c,0,0|(i=i+-8|0)),a=ar[(l=t)+4>>2]|D,ar[(o=t)>>2]=ar[l>>2]|c,ar[o+4>>2]=a}while(7<(0|i))}}while(0);i=64-i|0,ar[r>>2]=i}return l=0|Wu(0|(o=0|ar[(a=c=A+8|0)>>2]),0|(a=0|ar[a+4>>2]),64-e|0),a=0|Iu(0|o,0|a,0|e),ar[c>>2]=a,ar[c+4>>2]=D,ar[r>>2]=i-e,0|l}function ct(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if((0|(i=0|ar[(r=(A|=0)+16|0)>>2]))<(0|e)){i=64-i|0,n=A+4|0;A:do{if(7<(0|i)){t=A+8|0,f=0|ar[n>>2];do{if(!f)break A;c=0|ar[A>>2],ar[A>>2]=c+1,c=0|cr[c>>0],f=f+-1|0,ar[n>>2]=f,c=0|Iu(0|c,0,0|(i=i+-8|0)),a=ar[(l=t)+4>>2]|D,ar[(o=t)>>2]=ar[l>>2]|c,ar[o+4>>2]=a}while(7<(0|i))}}while(0);i=64-i|0,ar[r>>2]=i}c=0|Iu(0|ar[(c=l=A+8|0)>>2],0|ar[c+4>>2],0|e),ar[l>>2]=c,ar[l+4>>2]=D,ar[r>>2]=i-e}function lt(A){var e,r,i;i=(-8&ar[(e=(A|=0)+16|0)>>2]|0)/8|0,ar[A>>2]=(0|ar[A>>2])+(0-i),ar[(r=A+4|0)>>2]=(0|ar[r>>2])+i,ar[(A=A+8|0)>>2]=0,ar[A+4>>2]=0,ar[e>>2]=0}function ut(A){var e,r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;for(a=(A|=0)+4|0,r=A+8|0,i=(c=0)|ar[(e=A+16|0)>>2];;){if((0|i)<1){i=64-i|0;A:do{if(7<(0|i)){f=0|ar[a>>2];do{if(!f)break A;l=0|ar[A>>2],ar[A>>2]=l+1,l=0|cr[l>>0],f=f+-1|0,ar[a>>2]=f,l=0|Iu(0|l,0,0|(i=i+-8|0)),n=ar[(u=r)+4>>2]|D,ar[(t=r)>>2]=ar[u>>2]|l,ar[t+4>>2]=n}while(7<(0|i))}}while(0);t=64-i|0,ar[e>>2]=t}else t=i;if(n=0|Iu(0|(u=0|ar[(l=r)>>2]),0|(l=0|ar[l+4>>2]),1),f=D,ar[(i=r)>>2]=n,ar[i+4>>2]=f,i=t+-1|0,ar[e>>2]=i,!(-1<(0|l)|-1==(0|l)&4294967295<u>>>0))break;if(19<(0|c)){i=-99999,o=20;break}c=c+1|0}if(20==(0|o))return 0|i;if(!c)return(u=0)|u;if((0|t)<=(0|c)){i=65-t|0;A:do{if(7<(0|i)){t=0|ar[a>>2];do{if(!t)break A;u=0|ar[A>>2],ar[A>>2]=u+1,u=0|cr[u>>0],t=t+-1|0,ar[a>>2]=t,n|=u=0|Iu(0|u,0,0|(i=i+-8|0)),f|=D,ar[(u=r)>>2]=n,ar[u+4>>2]=f}while(7<(0|i))}}while(0);i=64-i|0,ar[e>>2]=i}return u=0|Wu(0|n,0|f,64-c|0),a=0|Iu(0|n,0|f,0|c),ar[(l=r)>>2]=a,ar[l+4>>2]=D,ar[e>>2]=i-c,(0|(i=u+(1<<c)|0))<=1&&br(40721,40708,146,40729),0|(u=i+-1|0)}function st(A){A=0|ut(A|=0);A:do{if((0|A)<0){switch(0|A){case-99999:break;default:break A}return 0|(A=-99999)}switch(0|A){case 0:A=0;break;default:break A}return 0|A}while(0);return 0|(A=(0|(0==(1&A|0)?0-A|0:A+1|0))/2|0)}function bt(A,e,r){if(A|=0,e|=0,-1<(0|(r|=0)))return ar[A>>2]=e,ar[A+4>>2]=e,void(ar[A+8>>2]=e+r);br(41163,41154,138,41175)}function dt(A){var e,r,i,f,n,t;f=0|ar[(i=(A|=0)+4|0)>>2],n=(0|ar[A+8>>2])-f|0,ar[A+12>>2]=510,or[(t=A+20|0)>>1]=8,((ar[(r=A+16|0)>>2]=0)|n)<=0||(A=1+f|0,ar[i>>2]=A,e=(0|cr[f>>0])<<8,ar[r>>2]=e,1!=((or[t>>1]=0)|n)&&(ar[i>>2]=2+f,ar[r>>2]=0|e|cr[A>>0],or[t>>1]=-8))}function kt(A,e){e|=0;var r=0,i=0,f=0,n=0,t=0,o=0,a=0;return i=(i=0|ar[(t=(A|=0)+12|0)>>2])-(r=0|cr[(i>>>6)-4+(40738+(((0|cr[e>>0])>>>1&255)<<2))>>0])|0,n=(ar[t>>2]=i)<<7,(f=0|ar[(a=A+16|0)>>2])>>>0<n>>>0?(o=255&(f=1&(r=0|tr[e>>0])),tr[e>>0]=tr[41090+((255&r)>>>1&255)>>0]<<1&255|f,32768<=n>>>0?0|(a=o):(ar[t>>2]=i<<1&67108862,f=ar[a>>2]<<1,ar[a>>2]=f,e=1+(0|or[(r=A+20|0)>>1])<<16>>16,(or[r>>1]=e)<<16>>16?0|(a=o):(or[r>>1]=-8,(i=0|ar[(r=A+4|0)>>2])>>>0>=(0|ar[A+8>>2])>>>0||(ar[r>>2]=i+1,ar[a>>2]=0|f|cr[i>>0]),0|(a=o)))):(o=0|cr[40994+(r>>>3)>>0],ar[a>>2]=f-n<<o,ar[t>>2]=r<<o,t=255&(i=1&(r=0|tr[e>>0])^1),(255&r)<2&&(r=i|-2&r,tr[e>>0]=r),tr[e>>0]=tr[41026+((255&r)>>>1&255)>>0]<<1&255|1&r,r=(0|lr[(n=A+20|0)>>1])+o|0,32768&(or[n>>1]=r)|0||(r=r<<16>>16,(f=0|ar[(i=A+4|0)>>2])>>>0<(0|ar[A+8>>2])>>>0&&(ar[i>>2]=f+1,ar[a>>2]=(0|cr[f>>0])<<r|ar[a>>2]),or[n>>1]=r+65528),0|(a=t))}function ht(A){var e=0,r=0,i=0,f=0,n=0;return r=(0|ar[(e=(A|=0)+12|0)>>2])-2|0,(i=(ar[e>>2]=r)<<7)>>>0<=(f=0|ar[(n=A+16|0)>>2])>>>0?0|(n=1):32768<=i>>>0?(n=0)|n:(ar[e>>2]=r<<1&67108862,i=f<<1,ar[n>>2]=i,f=1+(0|or[(e=A+20|0)>>1])<<16>>16,(or[e>>1]=f)<<16>>16?(n=0)|n:(or[e>>1]=-8,(r=0|ar[(e=A+4|0)>>2])>>>0>=(0|ar[A+8>>2])>>>0||(ar[e>>2]=r+1,ar[n>>2]=i+(0|cr[r>>0])),(n=0)|n))}function wt(A){var e,r,i=0,f=0,n=0,t=0;return f=ar[(r=(A|=0)+16|0)>>2]<<1,ar[r>>2]=f,t=1+(0|or[(e=A+20|0)>>1])<<16>>16,-1<(or[e>>1]=t)<<16>>16&&(n=0|ar[(i=A+4|0)>>2],(0|ar[A+8>>2])>>>0>n>>>0)&&(or[e>>1]=-8,ar[i>>2]=n+1,f=0|f|cr[n>>0],ar[r>>2]=f),f>>>0<(i=ar[A+12>>2]<<7)>>>0?(t=0)|t:(ar[r>>2]=f-i,0|(t=1))}function vt(A,e){var r,i,f,n,t=0,o=0,a=0,c=0,l=0;if((0|(e|=0))<=0)return 0|(l=e);for(i=(A|=0)+16|0,f=A+20|0,n=A+8|0,l=A+4|0,r=A+12|0,t=(A=0)|or[f>>1],o=0|ar[i>>2];;){if(o<<=1,ar[i>>2]=o,t=t+1<<16>>16,-1<(or[f>>1]=t)<<16>>16&&(c=0|ar[l>>2],(0|ar[n>>2])>>>0>c>>>0)?(or[f>>1]=-8,ar[l>>2]=c+1,a=0|cr[c>>0]|o,ar[i>>2]=a,t=-8):a=o,a>>>0<(o=ar[r>>2]<<7)>>>0){t=8;break}if(o=a-o|0,ar[i>>2]=o,(0|e)<=(0|(A=A+1|0))){A=e,t=8;break}}return 8==(0|t)?0|A:0}function gt(A,e){A|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;if((0|(e|=0))<9)return e?(i=ar[(t=A+16|0)>>2]<<e,ar[t>>2]=i,f=(0|lr[(n=A+20|0)>>1])+e|0,0==(32768&(or[n>>1]=f)|0)&&(a=0|ar[(o=A+4|0)>>2],(0|ar[A+8>>2])>>>0>a>>>0)&&(ar[o>>2]=a+1,u=f<<16>>16,s=(0|cr[a>>0])<<u,or[n>>1]=u+65528,i|=s,ar[t>>2]=i),u=ar[A+12>>2]<<7,u=i-(0|sr(s=(0|(l=(i>>>0)/(u>>>0)|0))<(0|(s=1<<e))?l:s+-1|0,u))|0,ar[t>>2]=u,0|s):(s=0)|s;if(i=ar[(l=A+16|0)>>2]<<8,ar[l>>2]=i,n=65535&(f=8+(0|lr[(u=A+20|0)>>1])|0),or[u>>1]=n,0==(32768&f|0)&&(c=0|ar[(t=A+4|0)>>2],(0|ar[A+8>>2])>>>0>c>>>0)?(ar[t>>2]=c+1,n=f<<16>>16,f=(0|cr[c>>0])<<n,n=n+65528&65535,or[u>>1]=n,f|=i,ar[l>>2]=f):f=i,r=ar[A+12>>2]<<7,t=f-(0|sr(i=(0|(i=(f>>>0)/(r>>>0)|0))<255?i:255,r))|0,ar[l>>2]=t,!(f=e+-8|0))return 0|(s=i);for(e=A+8|0,c=A+4|0;f=f+-1|0,a=i<<1,i=t<<1,ar[l>>2]=i,n=n+1<<16>>16,-1<(or[u>>1]=n)<<16>>16&&(s=0|ar[c>>2],(0|ar[e>>2])>>>0>s>>>0)&&(or[u>>1]=-8,ar[c>>2]=s+1,i=0|cr[s>>0]|i,ar[l>>2]=i,n=-8),i>>>0<r>>>0?(t=0,o=i):(o=i-r|0,ar[l>>2]=o,t=1),i=t|a,f;)t=o;return 0|i}function mt(A,e){var r,i,f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0;for(r=(A|=0)+16|0,f=A+8|0,n=A+4|0,t=A+12|0,o=(e|=0)+31|0,a=(u=0)|or[(i=A+20|0)>>1],c=0|ar[r>>2];c<<=1,ar[r>>2]=c,a=a+1<<16>>16,-1<(or[i>>1]=a)<<16>>16&&(s=0|ar[n>>2],(0|ar[f>>2])>>>0>s>>>0)?(or[i>>1]=-8,ar[n>>2]=s+1,l=0|cr[s>>0]|c,ar[r>>2]=l,a=-8):l=c,!(l>>>0<(c=ar[t>>2]<<7)>>>0);){if(c=l-c|0,ar[r>>2]=c,(0|e)==(0|o)){e=0,b=8;break}u=u+(1<<e)|0,e=e+1|0}return 8==(0|b)?0|e:0|(b=(0|gt(A,e))+u|0)}function pt(A){ar[(A|=0)>>2]=0,ar[A+4>>2]=0}function yt(A,e){A|=0;var r,i=0;ur=(r=ur)+16|0,i=r,0|(i=0|ar[(e|=0)+4>>2])&&(ar[i>>2]=1+(0|ar[i>>2])),ar[A+4>>2]=i,ar[A>>2]=ar[e>>2],ur=r}function Zt(A){var e,r,i,f=0;ur=(r=ur)+16|0,f=r,ur=((f=0|ar[(e=(A|=0)+4|0)>>2])&&(i=(0|ar[f>>2])-1|0,ar[f>>2]=i,0|i||(0|(f=0|ar[A>>2])&&Xl(f),(f=0|ar[e>>2])&&Vl(f))),r)}function Ct(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0;ur=(f=ur)+16|0,o=f+8|0,n=f,i=0|ar[(n=(A|=0)+4|0)>>2];do{if(0|i){if(1==(0|(t=0|ar[i>>2])))return Wt(o=0|ar[A>>2],e,r),void(ur=f);if(1<(0|t)){ar[i>>2]=t+-1;break}br(41243,41253,177,41269)}}while(0);o=0|Gl(172),ar[A>>2]=o,A=0|El(4),ar[n>>2]=A,ar[A>>2]=1,Wt(o,e,r),ur=f}function Wt(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0;do{if(0<(0|e)){if(o=(0|r)<0?0:(0|r)<51?r:51,i=A+5|0,f=(255&(a=(f=63<(0|(a=(0|(a=((a=0|ar[6440+(12*(n=e+-1|0)|0)>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(t=f,tr[(a=i)>>0]=t,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+6|0,f=(255&(a=(f=63<(0|(a=(0|(a=((a=0|ar[6440+(12*n|0)+4>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(t=f,tr[(a=i)>>0]=t,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+7|0,f=(255&(a=(f=63<(0|(a=(0|(a=((a=0|ar[6440+(12*n|0)+8>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(t=f,tr[(a=i)>>0]=t,br(41315,41253,210,41336)),Vu(0|i,0|f,1),f=A+149|0,i=(255&(a=(i=63<(0|(a=(0|(a=((a=0|ar[7880+(n<<2)>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&i,63<=(127&a)>>>0&&(tr[f>>0]=i,br(41315,41253,210,41336)),Vu(0|f,0|i,1),i=A+147|0,f=(255&(a=(f=63<(0|(a=(0|(a=((a=0|ar[6464+(n<<2)>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(tr[i>>0]=f,br(41315,41253,210,41336)),Vu(0|i,0|f,1),f=A+148|0,i=(255&(a=(i=63<(0|(a=(0|(a=((a=0|ar[6472+(n<<2)>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&i,63<=(127&a)>>>0&&(tr[f>>0]=i,br(41315,41253,210,41336)),Vu(0|f,0|i,1),i=A+156|0,f=(255&(a=(f=63<(0|(a=(0|(a=104+((0|sr(o,-20))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(t=f,tr[(a=i)>>0]=t,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+157|0,t=(255&(a=(t=63<(0|(a=(0|(a=104+((0|sr(o,-25))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&t,63<=(127&a)>>>0&&(n=t,tr[(a=i)>>0]=n,br(41315,41253,210,41336)),Vu(0|i,0|t,1),i=A+158|0,f=(255&(a=(f=63<(0|(a=(0|(a=104+((0|sr(o,-30))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(n=f,tr[(a=i)>>0]=n,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+159|0,f=(255&(a=(f=63<(0|(a=(0|(a=104+((0|sr(o,-40))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(n=f,tr[(a=i)>>0]=n,br(41315,41253,210,41336)),Vu(0|i,0|f,1),Vu(A+160|0,0|f,1),tr[A+154>>0]=14,tr[A+155>>0]=14,i=A+150|0,f=(255&(a=(f=63<(0|(a=(0|(a=((a=0|ar[(n=7864+((1==(0|e)?0:2)<<2)|0)>>2])<<3&120)-16+((0|sr((5*(a>>4)|0)-45|0,o))>>4)|0))<1?1:(0|a)<126?a:126)))?a+64|0:63-a|0))<<1&255|1&f,63<=(127&a)>>>0&&(l=f,tr[(a=i)>>0]=l,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+151|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,o))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(a=f,tr[(l=i)>>0]=a,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=(255&(l=(i=63<(0|(l=(0|(l=48+(5*o>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&i,f=A+152|0,63<=(127&l)>>>0&&(tr[f>>0]=i,br(41315,41253,210,41336)),Vu(0|f,0|i,1),Vu(A+153|0,0|t,1),f=A+143|0,i=(255&(l=(i=63<(0|(l=(0|(l=72+((0|sr(o,-5))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&i,(127&l)>>>0<63){Vu(0|f,0|i,4);break}tr[f>>0]=i,br(41315,41253,210,41336)}}while(0);a=(0|r)<0?0:(0|r)<51?r:51,i=A+2|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[6480+(12*e|0)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+3|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[6480+(12*e|0)+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+4|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[6480+(12*e|0)+8>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+8|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[(n=7828+((2!=(0|e)?e:5)<<2)|0)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+9|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+10|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+8>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+11|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+12>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),f=A+12|0,i=(255&(l=(i=63<(0|(l=(0|(l=((l=0|ar[7816+(e<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&i,63<=(127&l)>>>0&&(tr[f>>0]=i,br(41315,41253,210,41336)),Vu(0|f,0|i,1),i=A+13|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[6516+(e<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(tr[i>>0]=f,br(41315,41253,210,41336)),Vu(0|i,0|f,1),f=A+14|0,n=(255&(l=(n=63<(0|(l=(0|(l=((l=0|ar[(i=6528+((0==(0|e)?0:2)<<2)|0)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&n,63<=(127&l)>>>0&&(r=n,tr[(l=f)>>0]=r,br(41315,41253,210,41336)),Vu(0|f,0|n,1),l=0|ar[i+4>>2],i=A+15|0,f=(255&(l=(f=63<(0|(l=(0|(l=(l<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+16|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[(n=7768+((r=e<<2)<<2)|0)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+17|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+18|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+8>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+19|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+12>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+20|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[(n=7732+(3*e<<2)|0)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+21|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+22|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+8>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(o=f,tr[(l=i)>>0]=o,br(41315,41253,210,41336)),Vu(0|i,0|f,1),n=A+25|0,o=7516+(18*e<<2)|0,i=0;do{if(f=n+i|0,t=(255&(l=(t=63<(0|(l=(0|(l=((l=0|ar[o+(i<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&t,63<=(127&l)>>>0){c=35;break}Vu(0|f,0|t,1),i=i+1|0}while((0|i)<18);35==(0|c)&&(tr[f>>0]=t,br(41315,41253,210,41336)),f=A+43|0,i=0;do{if(n=f+i|0,t=(255&(l=(t=63<(0|(l=(0|(l=((l=0|ar[o+(i<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&t,63<=(127&l)>>>0){c=39;break}Vu(0|n,0|t,1),i=i+1|0}while((0|i)<18);39==(0|c)&&(tr[n>>0]=t,br(41315,41253,210,41336)),i=A+61|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[(n=6544+(r<<2)|0)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+62|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+63|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+8>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+64|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[n+12>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),n=A+65|0,i=0;do{if(f=n+i|0,t=(255&(l=(t=63<(0|(l=(0|(l=((l=0|ar[6592+(168*e|0)+(i<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&t,63<=(127&l)>>>0){c=45;break}Vu(0|f,0|t,1),i=i+1|0}while((0|i)<42);45==(0|c)&&(tr[f>>0]=t,br(41315,41253,210,41336)),i=A+107|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[7096+(e<<3)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),i=A+108|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[7096+(e<<3)+4>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(r=f,tr[(l=i)>>0]=r,br(41315,41253,210,41336)),Vu(0|i,0|f,1),t=A+109|0,f=7228+(24*e<<2)|0,i=0;do{if(n=t+i|0,o=(255&(l=(o=63<(0|(l=(0|(l=((l=0|ar[f+(i<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&o,63<=(127&l)>>>0){c=51;break}Vu(0|n,0|o,1),i=i+1|0}while((0|i)<24);51==(0|c)&&(tr[n>>0]=o,br(41315,41253,210,41336)),f=A+133|0,n=7120+(6*e<<2)|0,i=0;do{if(t=f+i|0,o=(255&(l=(o=63<(0|(l=(0|(l=((l=0|ar[n+(i<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&o,63<=(127&l)>>>0){c=55;break}Vu(0|t,0|o,1),i=i+1|0}while((0|i)<6);if(55==(0|c)&&(tr[t>>0]=o,br(41315,41253,210,41336)),i=(255&(l=(i=63<(0|(l=(0|(l=((l=0|ar[7192+(e<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&i,63<=(127&l)>>>0&&(tr[A>>0]=i,br(41315,41253,210,41336)),Vu(0|A,0|i,1),i=A+1|0,f=(255&(l=(f=63<(0|(l=(0|(l=((l=0|ar[7204+(e<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&f,63<=(127&l)>>>0&&(tr[i>>0]=f,br(41315,41253,210,41336)),Vu(0|i,0|f,1),tr[A+139>>0]=1,tr[A+140>>0]=1,f=A+141|0,i=(255&(l=(i=63<(0|(l=(0|(l=72+((0|sr(a,-5))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&i,63<=(127&l)>>>0&&(tr[f>>0]=i,br(41315,41253,210,41336)),Vu(0|f,0|i,1),Vu(A+142|0,0|i,1),f=A+161|0,i=(255&(l=(i=63<(0|(l=(0|(l=((l=0|ar[7216+(e<<2)>>2])<<3&120)-16+((0|sr((5*(l>>4)|0)-45|0,a))>>4)|0))<1?1:(0|l)<126?l:126)))?l+64|0:63-l|0))<<1&255|1&i,(127&l)>>>0<63)return Vu(0|f,0|i,1),tr[(e=l=A+162|0)>>0]=1,tr[e+1>>0]=1,tr[e+2>>0]=1,tr[e+3>>0]=1,tr[(l=l+4|0)>>0]=1,tr[l+1>>0]=1,tr[l+2>>0]=1,tr[l+3>>0]=1,tr[(l=A+170|0)>>0]=1,tr[l+1>>0]=1,tr[A+23>>0]=1,void(tr[A+24>>0]=1);tr[f>>0]=i,br(41315,41253,210,41336)}function It(A){var e,r,i=0;ur=(r=ur)+16|0,i=r,ur=((i=0|ar[(e=(A|=0)+4|0)>>2])&&(ar[i>>2]=(0|ar[i>>2])-1,ar[A>>2]=0,ar[e>>2]=0),r)}function Bt(A){var e,r,i=0,f=0;ur=(r=ur)+16|0,i=r,(i=0|ar[(e=(A|=0)+4|0)>>2])||br(41383,41253,95,41390),ur=((0|(f=0|ar[i>>2]))<=1||(ar[i>>2]=f+-1,f=0|ar[A>>2],i=0|Gl(172),ar[A>>2]=i,A=0|El(4),ar[e>>2]=A,ar[A>>2]=1,Eu(0|i,0|f,172)),r)}function Et(A,e){A|=0;var r,i,f=0,n=0;return ur=(i=ur)+32|0,f=i,f=0|ar[(r=(e|=0)+4|0)>>2],ur=(f?(ar[f>>2]=1+(0|ar[f>>2]),0|(f=0|ar[(n=A+4|0)>>2])&&(ar[f>>2]=(0|ar[f>>2])-1,ar[A>>2]=0,ar[n>>2]=0),ar[A>>2]=ar[e>>2],ar[n>>2]=ar[r>>2]):(f=0|ar[(n=A+4|0)>>2])&&(ar[f>>2]=(0|ar[f>>2])-1,ar[A>>2]=0,ar[n>>2]=0),i),0|A}function Gt(A,e){e|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0;if(s=0|ar[(A|=0)+5808>>2],Q=(1<<(b=0|ar[A+5804>>2]))-1|0,T=0|ar[A+5820>>2],d=e<<b>>(J=0|ar[A+5800>>2]),J=e+1<<b>>J,(0|(J=(0|(D=0|ar[A+5824>>2]))<(0|J)?D:J))<=(0|d))return(T=0)|(T&=Q=1);i=A+10372|0,f=A+10360|0,n=A+10348|0,t=A+10352|0,o=A+10356|0,a=A+10340|0,c=A+48|0,l=A+52|0,u=A+5977|0,D=A+10308|0,k=(e=0)|ar[(r=A+5816|0)>>2];A:for(;;){if(0<(0|k)){V=0==(0|(_=0|sr(d,s)))?0:32,F=0|sr(_>>b,T),Y=0!=(0|_)&0==(_&Q|0),R=0|sr((N=_+-1|0)>>b,T),X=0;do{if(G=(0|sr(0|ar[i>>2],d))+X|0,G=(0|ar[f>>2])+(3*G|0)|0,E=65535&(G=7&(cr[G>>0]|cr[G+1>>0]<<8)),G<<16>>16){if(Z=(G=0|sr(X,s))>>b,h=_>>(p=0|ar[n>>2]),(0|(C=G>>p))<=-1){d=8;break A}if((0|(W=0|ar[t>>2]))<=(0|C)){d=8;break A}if((0|h)<=-1){d=11;break A}if((0|(I=0|ar[o>>2]))<=(0|h)){d=11;break A}if(B=0|ar[a>>2],v=0|sr(W,h),w=0|lr[B+(24*(v+C|0)|0)+2>>1],h=0|ar[c>>2],(y=(0|ar[l>>2])-h>>2)>>>0<=w>>>0){k=0,d=33;break A}m=0|ar[(g=h)+(w<<2)>>2],h=0==(0|G)?0:16;do{if(0!=(0|G)&0==(G&Q|0)){if(!(0|tr[m+764>>0])){if(!(-1<(0|(w=G+-1>>p))&(0|w)<(0|W))){d=16;break A}if((v=0|lr[B+(24*(v+w|0)|0)+2>>1])>>>0<y>>>0&&(0|ar[m+800>>2])!=(0|ar[800+(0|ar[g+(v<<2)>>2])>>2])){w=0;break}}w=0|tr[u>>0]?h:(w=0|ar[D>>2],(0|ar[w+(Z+F<<2)>>2])==(0|ar[w+((G+-1>>b)+F<<2)>>2])?h:0)}else w=h}while(0);do{if(Y){if(!(0|tr[m+764>>0])){if(!(-1<(0|(h=N>>p))&(0|h)<(0|I))){d=24;break A}if(B=B+(24*((0|sr(W,h))+C|0)|0)+2|0,(B=0|lr[B>>1])>>>0<y>>>0&&(0|ar[m+800>>2])!=(0|ar[800+(0|ar[g+(B<<2)>>2])>>2])){h=0;break}}h=0|tr[u>>0]?V:(h=0|ar[D>>2],(0|ar[h+(Z+F<<2)>>2])==(0|ar[h+(Z+R<<2)>>2])?V:0)}else h=V}while(0);0|tr[m+754>>0]||(Rt(A,G,_,E,0,255&w,255&h),Yt(A,G,_,E,0,0),e=1,k=0|ar[r>>2])}X=X+1|0}while((0|X)<(0|k))}if((0|J)<=(0|(d=d+1|0))){k=1,d=33;break}}if(8==(0|d))br(41808,41845,118,41865);else if(11==(0|d))br(41869,41845,119,41865);else if(16==(0|d))br(41808,41845,118,41865);else if(24==(0|d))br(41869,41845,119,41865);else if(33==(0|d))return 0|(T=k&e);return 0}function Vt(A,e,r,i,f,n){r|=0,i|=0,f|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0,fA=0,nA=0;if(X=(e|=0)?2:1,_=e?1:2,F=1&e,N=1&(1^e),V=e?80:160,E=e?16:32,nA=(0|(n|=0))<(0|(nA=0|ar[(G=(A|=0)+10472|0)>>2]))?n:nA,!((0|(fA=(0|i)<(0|(fA=0|ar[A+10476>>2]))?i:fA))<=(0|r))){o=(0|f)<(0|nA),a=A+10460|0,c=A+10368|0,l=A+10372|0,u=A+10376|0,s=A+10360|0,b=A+10388|0,d=A+10392|0,k=A+10396|0,h=A+10380|0,w=A+10348|0,v=A+10352|0,g=A+10356|0,m=A+10340|0,p=A+48|0,y=A+52|0,Z=A+10332|0,C=A+10516|0,W=A+10448|0,I=A+10452|0,B=A+10456|0,t=A+10440|0;A:for(;;){if(o){eA=(0|(AA=r<<2))/4|0,rA=AA-N|0,$=f;do{if(iA=(0|(T=$<<2))/4|0,e=(0|sr(0|ar[G>>2],eA))+iA|0,e=(0|ar[a>>2])+e|0,(D=255&(n=0|tr[e>>0]))&V){if(Q=T-F|0,n=rA>>(A=0|ar[c>>2]),(0|(e=Q>>A))<=-1){e=10;break A}if((0|(R=0|ar[l>>2]))<=(0|e)){e=10;break A}if((0|n)<=-1){e=13;break A}if((0|(Y=0|ar[u>>2]))<=(0|n)){e=13;break A}if(n=(J=0|ar[s>>2])+(3*((0|sr(R,n))+e|0)|0)|0,e=AA>>A,!(-1<(0|(i=T>>A))&(0|i)<(0|R))){e=15;break A}if(!(-1<(0|e)&(0|e)<(0|Y))){e=17;break A}q=J+(3*((0|sr(R,e))+i|0)|0)|0;e:do{if(0!=(768&(cr[n>>0]|cr[n+1>>0]<<8))&&0!=(768&(cr[q>>0]|cr[q+1>>0]<<8))){if(D&E|0){if(n=AA>>(i=0|ar[W>>2]),(0|(e=T>>i))<=-1){e=22;break A}if((0|(A=0|ar[I>>2]))<=(0|e)){e=22;break A}if((0|n)<=-1){e=25;break A}if((0|(R=0|ar[B>>2]))<=(0|n)){e=25;break A}if(q=(Y=0|ar[t>>2])+((0|sr(A,n))+e)|0,(0|tr[q>>0])<=-1){e=1;break}if(e=rA>>i,!(-1<(0|(n=Q>>i))&(0|n)<(0|A))){e=28;break A}if(!(-1<(0|e)&(0|e)<(0|R))){e=30;break A}if(q=Y+((0|sr(A,e))+n)|0,(0|tr[q>>0])<=-1){e=1;break}}if(n=rA>>(i=0|ar[b>>2]),(0|(e=Q>>i))<=-1){e=34;break A}if((0|(A=0|ar[d>>2]))<=(0|e)){e=34;break A}if((0|n)<=-1){e=37;break A}if((0|(R=0|ar[k>>2]))<=(0|n)){e=37;break A}if(q=0|ar[h>>2],K=(0|sr(A,n))+e|0,e=AA>>i,!(-1<(0|(n=T>>i))&(0|n)<(0|A))){e=39;break A}if(!(-1<(0|e)&(0|e)<(0|R))){e=41;break A}if(L=(0|sr(A,e))+n|0,n=rA>>(R=0|ar[w>>2]),(0|(e=Q>>R))<=-1){e=44;break A}if((0|(Y=0|ar[v>>2]))<=(0|e)){e=44;break A}if((0|n)<=-1){e=47;break A}if((0|(J=0|ar[g>>2]))<=(0|n)){e=47;break A}if(e=(D=0|ar[m>>2])+(24*((0|sr(Y,n))+e|0)|0)+2|0,e=0|lr[e>>1],i=0|ar[p>>2],Q=e>>>0<(A=(0|ar[y>>2])-i>>2)>>>0?0|ar[i+(e<<2)>>2]:0,e=AA>>R,!(-1<(0|(n=T>>R))&(0|n)<(0|Y))){e=51;break A}if(!(-1<(0|e)&(0|e)<(0|J))){e=53;break A}if(e=D+(24*((0|sr(Y,e))+n|0)|0)+2|0,e=(e=0|lr[e>>1])>>>0<A>>>0?0|ar[i+(e<<2)>>2]:0,z=(n=(x=0|tr[q+(12*K|0)>>0])<<24>>24==0)?-1:0|ar[Q+916+(tr[q+(12*K|0)+2>>0]<<2)>>2],O=(i=(j=0|tr[q+(12*K|0)+1>>0])<<24>>24==0)?-1:0|ar[Q+980+(tr[q+(12*K|0)+3>>0]<<2)>>2],!((S=(0|z)==(0|(U=(A=(T=0|tr[q+(12*L|0)>>0])<<24>>24==0)?-1:0|ar[e+916+(tr[q+(12*L|0)+2>>0]<<2)>>2])))&(0|O)==(0|(Q=(D=(M=0|tr[q+(12*L|0)+1>>0])<<24>>24==0)?-1:0|ar[e+980+(tr[q+(12*L|0)+3>>0]<<2)>>2])))&&!((0|O)==(0|U)&(0|z)==(0|Q))){e=1;break}if(P=n?0:0|or[q+(12*K|0)+6>>1],e=n?0:0|or[q+(12*K|0)+4>>1],H=i?0:0|or[q+(12*K|0)+10>>1],J=i?0:0|or[q+(12*K|0)+8>>1],Y=A?0:0|or[q+(12*L|0)+6>>1],A=A?0:0|or[q+(12*L|0)+4>>1],R=D?0:0|or[q+(12*L|0)+10>>1],i=D?0:0|or[q+(12*L|0)+8>>1],((255&j)+(255&x)|0)!=((255&M)+(255&T)|0)&&(Gr(4+(0|ar[Z>>2])|0,1013,0),tr[C>>0]=3),(0|z)==(0|O)){if((0|U)!=(0|Q)){e=81;break A}q=(n=e<<16>>16)-(e=A<<16>>16)|0;do{if((0|((0|q)<0?0-q|0:q))<=3){if(3<(0|((0|(q=(P<<16>>16)-(Y<<16>>16)|0))<0?0-q|0:q)))break;if(3<(0|((0|(q=(J<<16>>16)-(i<<16>>16)|0))<0?0-q|0:q)))break;if((0|((0|(q=(H<<16>>16)-(R<<16>>16)|0))<0?0-q|0:q))<=3){e=0;break e}}}while(0);q=n-(i<<16>>16)|0;do{if((0|((0|q)<0?0-q|0:q))<=3){if(3<(0|((0|(q=(P<<16>>16)-(R<<16>>16)|0))<0?0-q|0:q)))break;if(3<(0|((0|(q=(J<<16>>16)-e|0))<0?0-q|0:q)))break;if((0|((0|(q=(H<<16>>16)-(Y<<16>>16)|0))<0?0-q|0:q))<=3){e=0;break e}}}while(0);e=1;break}if(e=e<<16>>16,S){q=e-(A<<16>>16)|0;do{if((0|((0|q)<0?0-q|0:q))<=3){if(3<(0|((0|(q=(P<<16>>16)-(Y<<16>>16)|0))<0?0-q|0:q)))break;if(3<(0|((0|(q=(J<<16>>16)-(i<<16>>16)|0))<0?0-q|0:q)))break;if((0|((0|(q=(H<<16>>16)-(R<<16>>16)|0))<0?0-q|0:q))<=3){e=0;break e}}}while(0);e=1;break}q=e-(i<<16>>16)|0;do{if((0|((0|q)<0?0-q|0:q))<=3){if(3<(0|((0|(q=(P<<16>>16)-(R<<16>>16)|0))<0?0-q|0:q)))break;if(3<(0|((0|(q=(J<<16>>16)-(A<<16>>16)|0))<0?0-q|0:q)))break;if((0|((0|(q=(H<<16>>16)-(Y<<16>>16)|0))<0?0-q|0:q))<=3){e=0;break e}}}while(0);e=1;break}e=2}while(0);iA=(0|sr(0|ar[G>>2],eA))+iA|0,iA=(0|ar[a>>2])+iA|0,tr[iA>>0]=-4&tr[iA>>0]|e}else tr[e>>0]=-4&n;$=$+X|0}while((0|$)<(0|nA))}if((0|fA)<=(0|(r=r+_|0))){e=5;break}}switch(0|e){case 5:return;case 10:br(41808,41845,118,41865);break;case 13:br(41869,41845,119,41865);break;case 15:br(41808,41845,118,41865);break;case 17:br(41869,41845,119,41865);break;case 22:br(41808,41845,118,41865);break;case 25:br(41869,41845,119,41865);break;case 28:br(41808,41845,118,41865);break;case 30:br(41869,41845,119,41865);break;case 34:br(41808,41845,118,41865);break;case 37:br(41869,41845,119,41865);break;case 39:br(41808,41845,118,41865);break;case 41:br(41869,41845,119,41865);break;case 44:br(41808,41845,118,41865);break;case 47:br(41869,41845,119,41865);break;case 51:br(41808,41845,118,41865);break;case 53:br(41869,41845,119,41865);break;case 81:br(41532,41551,343,41562)}}}function Xt(A,e,r,i,f,n){r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P,L,K,q,$,AA,eA,rA,iA,fA,nA,tA,oA,aA,cA,lA,uA,sA,bA,dA,kA,hA,wA,vA,gA,mA,pA,yA,ZA,CA,WA,IA,BA,EA,GA,VA,XA,_A,FA,NA,RA,YA,JA,DA,QA,TA,MA,SA,UA,OA,HA,xA,jA,zA,PA,LA,KA,qA,$A,Ae,ee,re,ie,fe,ne,te,oe,ae,ce,le,ue,se,be,de,ke,he,we,ve,ge,me,pe,ye,Ze=0,Ce=0,We=0,Ie=0,Be=0,Ee=0,Ge=0,Ve=0,Xe=0,_e=0,Fe=0,Ne=0,Re=0,Ye=0,Je=0,De=0,Qe=0,Te=0,Me=0,Se=0,Ue=0,Oe=0,He=0,xe=0,je=0,ze=0,Pe=0,Le=0,Ke=0,qe=0,$e=0,Ar=0,er=0,rr=0,ir=0,fr=0,nr=0;if(ur=(ye=ur)+80|0,ge=(ve=ye)+40|0,me=ye+32|0,pe=(e|=0)?2:1,ke=e?1:2,de=0|ar[(he=(A|=0)+40|0)>>2],Ze=0|ar[A+5760>>2],nr=(0|n)<(0|(nr=0|ar[(we=A+10472|0)>>2]))?n:nr,(0|(fr=(0|i)<(0|(fr=0|ar[A+10476>>2]))?i:fr))<=(0|r))ur=ye;else{MA=(0|f)<(0|nr),SA=A+10460|0,UA=A+4|0,OA=A+10368|0,HA=A+10372|0,xA=A+10376|0,jA=A+10360|0,zA=A+10348|0,PA=A+10352|0,LA=A+10356|0,KA=A+10340|0,qA=A+48|0,$A=Ze+-8|0,Ae=4+ge|0,ee=2+ge|0,re=28+ge|0,ie=26+ge|0,fe=24+ge|0,ne=ve+4|0,te=ve+2|0,oe=ve+28|0,ae=ve+26|0,ce=ve+24|0,le=6+ge|0,ue=ve+6|0,se=30+ge|0,be=ve+30|0,DA=A+5480|0,QA=2+me|0,TA=4+me|0,z=65535+(j=1<<Ze)|0,YA=ve+8|0,L=de-1|0,Z=8+ge|0,K=de-2|0,p=10+ge|0,q=de-3|0,C=12+ge|0,$=de-4|0,B=14+ge|0,JA=ve+16|0,AA=de<<2,eA=(rr=P=de<<1)+-1|0,I=16+ge|0,rA=rr+-2|0,y=18+ge|0,iA=rr+-3|0,W=20+ge|0,rr=rr+-4|0,E=22+ge|0,fA=6*de|0,nA=(ir=3*de|0)+-1|0,tA=ir+-2|0,oA=ir+-3|0,ir=ir+-4|0,aA=de<<1,cA=0|sr(de,-3),lA=de<<1,uA=0|sr(de,-3),kA=0-de|0,hA=ve+2|0,wA=0-(bA=sA=de<<1)|0,t=2+ge|0,vA=ve+4|0,gA=0-(dA=3*de|0)|0,u=4+ge|0,mA=ve+6|0,pA=0-(er=de<<2)|0,h=6+ge|0,yA=ve+8|0,ZA=1-de|0,l=8+ge|0,CA=1+de|0,WA=ve+10|0,IA=1-bA|0,o=10+ge|0,BA=1|bA,EA=ve+12|0,GA=1-dA|0,s=12+ge|0,VA=1+dA|0,XA=ve+14|0,_A=1-er|0,w=14+ge|0,FA=ve+16|0,NA=2-de|0,k=16+ge|0,RA=2+de|0,G=ve+18|0,V=2-bA|0,a=18+ge|0,X=2+bA|0,_=ve+20|0,F=2-dA|0,b=20+ge|0,N=2+dA|0,R=ve+22|0,Y=2-er|0,v=22+ge|0,J=ve+24|0,D=3-de|0,m=24+ge|0,Q=3+de|0,T=ve+26|0,M=3-bA|0,c=26+ge|0,S=3+bA|0,U=ve+28|0,O=3-dA|0,d=28+ge|0,H=3+dA|0,x=ve+30|0,er=3-er|0,g=30+ge|0;A:for(;;){if(MA){Le=(0|(Pe=r<<2))/4|0,Ke=Pe+-1|0,ze=e?Pe:Ke,je=f;do{if(Ie=je<<2,Be=(0|sr(0|ar[we>>2],Le))+((0|Ie)/4|0)|0,(Be=3&tr[(0|ar[SA>>2])+Be>>0])<<24>>24){if(Ar=(qe=0|ar[UA>>2])+($e=(0|sr(0|ar[he>>2],Pe))+Ie<<1)|0,We=e?(i=lr[(i=(A=i=Ar)+4|0)>>1]|lr[i+2>>1]<<16,ar[(n=ve)>>2]=lr[A>>1]|lr[A+2>>1]<<16,ar[n+4>>2]=i,or[ge>>1]=0|or[Ar+-2>>1],or[ee>>1]=0|or[Ar+-4>>1],or[Ae>>1]=0|or[Ar+-6>>1],or[le>>1]=0|or[Ar+-8>>1],n=lr[(n=(i=n=qe+($e+P)|0)+4|0)>>1]|lr[n+2>>1]<<16,ar[(A=YA)>>2]=lr[i>>1]|lr[i+2>>1]<<16,ar[A+4>>2]=n,or[Z>>1]=0|or[Ar+(L<<1)>>1],or[p>>1]=0|or[Ar+(K<<1)>>1],or[C>>1]=0|or[Ar+(q<<1)>>1],or[B>>1]=0|or[Ar+($<<1)>>1],A=lr[(A=(n=A=qe+($e+AA)|0)+4|0)>>1]|lr[A+2>>1]<<16,ar[(i=JA)>>2]=lr[n>>1]|lr[n+2>>1]<<16,ar[i+4>>2]=A,or[I>>1]=0|or[Ar+(eA<<1)>>1],or[y>>1]=0|or[Ar+(rA<<1)>>1],or[W>>1]=0|or[Ar+(iA<<1)>>1],or[E>>1]=0|or[Ar+(rr<<1)>>1],i=lr[(i=(A=i=qe+($e+fA)|0)+4|0)>>1]|lr[i+2>>1]<<16,ar[(n=ce)>>2]=lr[A>>1]|lr[A+2>>1]<<16,ar[n+4>>2]=i,or[fe>>1]=0|or[Ar+(nA<<1)>>1],n=ie,i=se,A=tA,Ze=ir,Ce=re,oA):(or[ve>>1]=0|or[Ar>>1],or[ge>>1]=0|or[Ar+(kA<<1)>>1],or[hA>>1]=0|or[Ar+(de<<1)>>1],or[t>>1]=0|or[Ar+(wA<<1)>>1],or[vA>>1]=0|or[Ar+(bA<<1)>>1],or[u>>1]=0|or[Ar+(gA<<1)>>1],or[mA>>1]=0|or[Ar+(dA<<1)>>1],or[h>>1]=0|or[Ar+(pA<<1)>>1],or[yA>>1]=0|or[Ar+2>>1],or[l>>1]=0|or[Ar+(ZA<<1)>>1],or[WA>>1]=0|or[Ar+(CA<<1)>>1],or[o>>1]=0|or[Ar+(IA<<1)>>1],or[EA>>1]=0|or[Ar+(BA<<1)>>1],or[s>>1]=0|or[Ar+(GA<<1)>>1],or[XA>>1]=0|or[Ar+(VA<<1)>>1],or[w>>1]=0|or[Ar+(_A<<1)>>1],or[FA>>1]=0|or[Ar+4>>1],or[k>>1]=0|or[Ar+(NA<<1)>>1],or[G>>1]=0|or[Ar+(RA<<1)>>1],or[a>>1]=0|or[Ar+(V<<1)>>1],or[_>>1]=0|or[Ar+(X<<1)>>1],or[b>>1]=0|or[Ar+(F<<1)>>1],or[R>>1]=0|or[Ar+(N<<1)>>1],or[v>>1]=0|or[Ar+(Y<<1)>>1],or[J>>1]=0|or[Ar+6>>1],or[m>>1]=0|or[Ar+(D<<1)>>1],or[T>>1]=0|or[Ar+(Q<<1)>>1],or[c>>1]=0|or[Ar+(M<<1)>>1],or[U>>1]=0|or[Ar+(S<<1)>>1],n=d,i=g,A=O,Ze=er,Ce=x,H),or[n>>1]=0|or[Ar+(A<<1)>>1],or[Ce>>1]=0|or[Ar+(We<<1)>>1],or[i>>1]=0|or[Ar+(Ze<<1)>>1],n=Pe>>(Xe=0|ar[OA>>2]),(0|(Fe=Ie>>Xe))<=-1){n=13;break A}if((0|(Re=0|ar[HA>>2]))<=(0|Fe)){n=13;break A}if((0|n)<=-1){n=16;break A}if((0|(Ne=0|ar[xA>>2]))<=(0|n)){n=16;break A}if(Je=0|ar[jA>>2],Ye=(_e=0|sr(Re,n))+Fe|0,Ve=Ie+-1|0,i=ze>>Xe,!(-1<(0|(n=(e?Ve:Ie)>>Xe))&(0|n)<(0|Re))){n=18;break A}if(!(-1<(0|i)&(0|i)<(0|Ne))){n=20;break A}if(Ze=Je+(3*((0|sr(Re,i))+n|0)|0)+2|0,Ze=1+(0|tr[Je+(3*Ye|0)+2>>0])+(0|tr[Ze>>0])>>1,n=Ie>>(i=0|ar[zA>>2]),i=Pe>>i,(0|n)<=-1){n=23;break A}if((0|(A=0|ar[PA>>2]))<=(0|n)){n=23;break A}if((0|i)<=-1){n=26;break A}if((0|i)>=(0|ar[LA>>2])){n=26;break A}xe=(0|ar[KA>>2])+(24*((0|sr(A,i))+n|0)|0)+2|0,xe=0|ar[(0|ar[qA>>2])+(lr[xe>>1]<<2)>>2],Ge=(0|ar[xe+756>>2])+Ze|0,Ge=cr[41480+((0|Ge)<0?0:(0|Ge)<51?Ge:51)>>0]<<$A,xe=(Be<<1&255)-2+Ze+(0|ar[xe+760>>2])|0,xe=cr[41426+((0|xe)<0?0:(0|xe)<53?xe:53)>>0]<<$A,Qe=(0|(Qe=(65535&(Me=0|or[Ae>>1]))-((65535&(Se=0|or[ee>>1]))<<1)+(n=65535&(Ze=0|or[ge>>1]))|0))<0?0-Qe|0:Qe,Ce=0|lr[fe>>1],De=(0|(De=(0|lr[re>>1])-(lr[ie>>1]<<1)+Ce|0))<0?0-De|0:De,Te=(0|(Te=(65535&(Ee=0|or[ne>>1]))-((65535&(Oe=0|or[te>>1]))<<1)+(i=65535&(Ue=0|or[ve>>1]))|0))<0?0-Te|0:Te,We=0|lr[ce>>1],A=Te+Qe|0,Ie=(He=(0|(He=(0|lr[oe>>1])-(lr[ae>>1]<<1)+We|0))<0?0-He|0:He)+De|0,Qe=De+Qe|0,Te=He+Te|0;e:do{if((Ie+A|0)<(0|Ge)){Be=Ge>>2;do{if((A<<1|0)<(0|Be)){if(He=(0|lr[le>>1])-n|0,(Ge>>3|0)<=(((0|(De=i-(0|lr[ue>>1])|0))<0?0-De|0:De)+((0|He)<0?0-He|0:He)|0)){i=0;break}i=(0|((0|(i=n-i|0))<0?0-i|0:i))<(1+(5*xe|0)>>1|0)}else i=0}while(0);do{if((Ie<<1|0)<(0|Be)){if(He=(0|lr[se>>1])-Ce|0,(Ge>>3|0)<=(((0|(De=We-(0|lr[be>>1])|0))<0?0-De|0:De)+((0|He)<0?0-He|0:He)|0)){n=0;break}n=(0|((0|(n=Ce-We|0))<0?0-n|0:n))<(1+(5*xe|0)>>1|0)}else n=0}while(0);if(He=i&n,We=(Ge>>1)+Ge>>3,A=(Ce=0|tr[DA>>0])<<24>>24!=0,e){if(n=-1<(0|(i=Ve>>Xe)),A){if(!(n&(0|i)<(0|Re))){n=37;break A}A=(65535&(cr[(A=Je+(3*(_e+i|0)|0)|0)>>0]|cr[A+1>>0]<<8))>>>10&1^1}else{if(!n){n=41;break A}A=1}if((0|Re)<=(0|i)){n=41;break A}i=Je+(3*(_e+i|0)|0)|0,De=(n=Ce<<24>>24?0==(1024&(cr[(n=Je+(3*Ye|0)|0)>>0]|cr[n+1>>0]<<8)):1)&0==(2048&(cr[(De=Je+(3*Ye|0)|0)>>0]|cr[De+1>>0]<<8)),Ne=A<<24>>24?0==(2048&(cr[i>>0]|cr[i+1>>0]<<8)):0}else{if(n=-1<(0|(i=Ke>>Xe)),A){if(!(n&(0|i)<(0|Ne))){n=47;break A}A=Je+(3*((0|sr(Re,i))+Fe|0)|0)|0,A=0==(1024&(cr[A>>0]|cr[A+1>>0]<<8))}else{if(!n){n=51;break A}A=1}if((0|Ne)<=(0|i)){n=51;break A}i=Je+(3*((0|sr(Re,i))+Fe|0)|0)|0,De=(n=Ce<<24>>24?0==(1024&(cr[(n=Je+(3*Ye|0)|0)>>0]|cr[n+1>>0]<<8)):1)&0==(2048&(cr[(De=Je+(3*Ye|0)|0)>>0]|cr[De+1>>0]<<8)),Ne=A&0==(2048&(cr[i>>0]|cr[i+1>>0]<<8))}for(Re=xe<<1,Ye=10*xe|0,Je=0-xe|0,Fe=(0|We)<=(0|Qe)|1^Ne,_e=(0|We)<=(0|Te)|1^De,Xe=0-(Ve=xe>>1)|0,Ge=0,Ie=Me,We=Se,i=Ue,A=Oe;;){Be=qe+($e+(0|sr(P,Ge)))|0;do{if(He){Ue=0|or[ve+(Ge<<3)+6>>1],Te=65535&We,Se=65535&A,We=(Me=65535&Ze)+Re|0,Ce=65535&((0|(Ce=(A=4+(Me<<1)|0)+(Te<<1)+(Oe=65535&Ie)+(n=(i&=65535)<<1)+Se>>3))<(0|(Qe=Me-Re|0))?Qe:(0|We)<(0|Ce)?We:Ce),Ie=Te+Re|0,We=65535&((0|(We=(Me+2+Te+Oe+i|0)>>>2))<(0|(Qe=Te-Re|0))?Qe:(0|Ie)<(0|We)?Ie:We),Ie=(Me+4+Te+(3*Oe|0)+i+(lr[ge+(Ge<<3)+6>>1]<<1)|0)>>>3,Qe=Oe-Re|0,Oe=Oe+Re|0,Ie=65535&((0|Ie)<(0|Qe)?Qe:(0|Oe)<(0|Ie)?Oe:Ie),n=A+Te+n+(Se<<1)+(Oe=65535&Ee)>>3,A=i+Re|0,n=65535&((0|n)<(0|(Te=i-Re|0))?Te:(0|A)<(0|n)?A:n),or[me>>1]=n,A=i+Me+Se|0,Me=Se-Re|0,Se=Se+Re|0,i=65535&((0|(i=(Oe+2+A|0)>>>2))<(0|Me)?Me:(0|Se)<(0|i)?Se:i),or[QA>>1]=i,A=(A+4+(3*Oe|0)+((65535&Ue)<<1)|0)>>>3,Ue=Oe-Re|0,Oe=Oe+Re|0,A=65535&((0|A)<(0|Ue)?Ue:(0|Oe)<(0|A)?Oe:A),or[TA>>1]=A;do{if(e){if(Ze=0|sr(Ge,de),!Ne){if(!De)break;or[Be>>1]=0|or[me>>1],or[Be+2>>1]=0|or[2+me>>1],or[Be+4>>1]=0|or[4+me>>1];break}if(or[Ar+(Ze+-1<<1)>>1]=Ce,De){or[Ar+(Ze<<1)>>1]=n,or[Ar+(Ze+-2<<1)>>1]=We,or[Ar+(Ze+1<<1)>>1]=i,or[Ar+(Ze+-3<<1)>>1]=Ie,or[Ar+(Ze+2<<1)>>1]=A;break}or[Ar+(Ze+-2<<1)>>1]=We,or[Ar+(Ze+-3<<1)>>1]=Ie;break}if(!Ne){if(!De)break;or[Ar+(Ge<<1)>>1]=n,or[Ar+(de+Ge<<1)>>1]=i,or[Ar+(sA+Ge<<1)>>1]=A;break}if(or[Ar+(Ge-de<<1)>>1]=Ce,De){or[Ar+(Ge<<1)>>1]=n,or[Ar+(Ge-aA<<1)>>1]=We,or[Ar+(de+Ge<<1)>>1]=i,or[Ar+(Ge+cA<<1)>>1]=Ie,or[Ar+(aA+Ge<<1)>>1]=A;break}or[Ar+(Ge-lA<<1)>>1]=We,or[Ar+(Ge+uA<<1)>>1]=Ie;break}while(0)}else{if((0|Ye)<=(0|((0|(n=8+(9*((Ce=65535&i)-(Ze&=65535)|0)|0)+(0|sr((A&=65535)-(i=65535&We)|0,-3))>>4))<0?0-n|0:n)))break;n=(0|n)<(0|Je)?Je:(0|xe)<(0|n)?xe:n;do{if(e){if(Ne&&(Ue=n+Ze|0,Oe=Ar+((0|sr(Ge,de))-1<<1)|0,or[Oe>>1]=(0|Ue)<0?0:65535&((0|Ue)<(0|j)?Ue:z)),!De)break;Ue=Ce-n|0,Oe=Ar+((0|sr(Ge,de))<<1)|0,or[Oe>>1]=(0|Ue)<0?0:65535&((0|Ue)<(0|j)?Ue:z)}else{if(Ne&&(Oe=n+Ze|0,or[Ar+(Ge-de<<1)>>1]=(0|Oe)<0?0:65535&((0|Oe)<(0|j)?Oe:z)),!De)break;Oe=Ce-n|0,or[Ar+(Ge<<1)>>1]=(0|Oe)<0?0:65535&((0|Oe)<(0|j)?Oe:z)}}while(0);if(Fe||(Ue=((0|(Oe=(Ue=n+(((Ze+1+(65535&Ie)|0)>>>1)-i)|0)>>1))<(0|Xe)?Xe:((0|Ve)<(0|Oe)?xe:Ue)>>1)+i|0,Oe=(0|sr(Ge,de))-2|0,or[Ar+((e?Oe:Ge-P|0)<<1)>>1]=(0|Ue)<0?0:65535&((0|Ue)<(0|j)?Ue:z)),_e)break;Ue=((0|(Oe=(Ue=((Ce+1+(65535&Ee)|0)>>>1)-A-n|0)>>1))<(0|Xe)?Xe:((0|Ve)<(0|Oe)?xe:Ue)>>1)+A|0,Oe=0|sr(e?Ge:1,de),or[Ar+(Oe+(e?1:Ge)<<1)>>1]=(0|Ue)<0?0:65535&((0|Ue)<(0|j)?Ue:z)}}while(0);if(4==(0|(n=Ge+1|0)))break e;Ie=0|or[ge+((Ge=n)<<3)+4>>1],We=0|or[ge+(n<<3)+2>>1],Ze=0|or[ge+(n<<3)>>1],i=0|or[ve+(n<<3)>>1],A=0|or[ve+(n<<3)+2>>1],Ee=0|or[ve+(n<<3)+4>>1]}}}while(0)}je=je+pe|0}while((0|je)<(0|nr))}if((0|fr)<=(0|(r=r+ke|0))){n=5;break}}switch(0|n){case 5:return void(ur=ye);case 13:br(41808,41845,118,41865);break;case 16:br(41869,41845,119,41865);break;case 18:br(41808,41845,118,41865);break;case 20:br(41869,41845,119,41865);break;case 23:br(41808,41845,118,41865);break;case 26:br(41869,41845,119,41865);break;case 37:case 41:br(41808,41845,118,41865);break;case 47:case 51:br(41869,41845,119,41865)}}}function _t(A,e,r,i,f,n){r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P,L,K,q,$,AA,eA,rA,iA,fA,nA,tA,oA,aA,cA,lA,uA,sA,bA,dA,kA,hA,wA,vA,gA,mA,pA,yA,ZA,CA,WA,IA,BA,EA,GA,VA,XA,_A,FA,NA,RA,YA,JA,DA,QA,TA,MA,SA=0,UA=0,OA=0,HA=0,xA=0,jA=0,zA=0,PA=0,LA=0,KA=0,qA=0,$A=0,Ae=0,ee=0,re=0,ie=0,fe=0,ne=0,te=0,oe=0,ae=0,ce=0,le=0,ue=0,se=0,be=0,de=0,ke=0,he=0,we=0,ve=0,ge=0,me=0,pe=0,ye=0,Ze=0,Ce=0,We=0,Ie=0,Be=0,Ee=0;if(ur=(MA=ur)+48|0,JA=MA+24|0,DA=MA+8|0,QA=MA,TA=(e|=0)?2:1,NA=e?1:2,FA=0|ar[(RA=(A|=0)+40|0)>>2],SA=0|ar[A+5760>>2],Ee=(0|n)<(0|(Ee=0|ar[(YA=A+10472|0)>>2]))?n:Ee,(0|(Be=(0|i)<(0|(Be=0|ar[A+10476>>2]))?i:Be))<=(0|r))ur=MA;else{tA=(0|f)<(0|Ee),oA=A+10460|0,aA=A+4|0,cA=A+10368|0,lA=A+10372|0,uA=A+10376|0,sA=A+10360|0,bA=A+10348|0,dA=A+10352|0,kA=A+10356|0,hA=A+10340|0,wA=A+48|0,vA=SA+-8|0,gA=2+DA|0,mA=1+DA|0,pA=14+DA|0,yA=13+DA|0,ZA=12+DA|0,CA=2+JA|0,WA=1+JA|0,IA=14+JA|0,BA=13+JA|0,EA=12+JA|0,GA=3+DA|0,VA=3+JA|0,XA=15+DA|0,_A=15+JA|0,iA=A+5480|0,fA=QA+1|0,nA=QA+2|0,L=255+(P=1<<SA)|0,ye=3*FA|0,q=Ze=K=FA<<1,$=0|sr(FA,-3),AA=FA<<1,eA=0|sr(FA,-3),Ce=rA=FA<<1,We=3*FA|0,Ie=FA<<2,a=e?-1:0-FA|0,t=e?1:FA,c=e?-2:0-Ce|0,l=e?2:Ce,u=e?-3:0-We|0,s=e?3:We,b=e?-4:0-Ie|0,o=e?FA:1,d=4+JA|0,k=e?FA-1|0:1-FA|0,U=4+DA|0,h=1+FA|0,w=5+JA|0,v=e?FA-2|0:1-Ce|0,M=5+DA|0,g=e?2+FA|0:1|Ce,m=6+JA|0,p=e?FA-3|0:1-We|0,O=6+DA|0,y=e?3+FA|0:We+1|0,Z=7+JA|0,C=e?FA-4|0:1-Ie|0,j=7+DA|0,W=e?Ze:2,I=8+JA|0,B=e?Ze+-1|0:2-FA|0,x=8+DA|0,E=e?1|Ze:2+FA|0,G=9+JA|0,V=e?Ze+-2|0:2-Ce|0,S=9+DA|0,X=(e?Ze:Ce)+2|0,_=10+JA|0,F=e?Ze+-3|0:2-We|0,H=10+DA|0,N=e?Ze+3|0:We+2|0,R=11+JA|0,Ze=e?Ze+-4|0:2-Ie|0,z=11+DA|0,Y=e?ye:3,J=e?ye+-1|0:3-FA|0,D=e?ye+1|0:3+FA|0,Q=e?ye+-2|0:3-Ce|0,Ce=e?ye+2|0:Ce+3|0,T=e?ye+-3|0:3-We|0,We=(e?ye:We)+3|0,Ie=e?ye+-4|0:3-Ie|0;A:for(;;){if(tA){ve=(0|(we=r<<2))/4|0,ge=we+-1|0,he=e?we:ge,ke=f;do{if(A=ke<<2,UA=(0|sr(0|ar[YA>>2],ve))+((0|A)/4|0)|0,(UA=3&tr[(0|ar[oA>>2])+UA>>0])<<24>>24){if(ye=(me=0|ar[aA>>2])+(pe=(0|sr(0|ar[RA>>2],we))+A|0)|0,tr[JA>>0]=0|tr[ye>>0],tr[DA>>0]=0|tr[ye+a>>0],tr[WA>>0]=0|tr[ye+t>>0],tr[mA>>0]=0|tr[ye+c>>0],tr[CA>>0]=0|tr[ye+l>>0],tr[gA>>0]=0|tr[ye+u>>0],tr[VA>>0]=0|tr[ye+s>>0],tr[GA>>0]=0|tr[ye+b>>0],tr[d>>0]=0|tr[ye+o>>0],tr[U>>0]=0|tr[ye+k>>0],tr[w>>0]=0|tr[ye+h>>0],tr[M>>0]=0|tr[ye+v>>0],tr[m>>0]=0|tr[ye+g>>0],tr[O>>0]=0|tr[ye+p>>0],tr[Z>>0]=0|tr[ye+y>>0],tr[j>>0]=0|tr[ye+C>>0],tr[I>>0]=0|tr[ye+W>>0],tr[x>>0]=0|tr[ye+B>>0],tr[G>>0]=0|tr[ye+E>>0],tr[S>>0]=0|tr[ye+V>>0],tr[_>>0]=0|tr[ye+X>>0],tr[H>>0]=0|tr[ye+F>>0],tr[R>>0]=0|tr[ye+N>>0],tr[z>>0]=0|tr[ye+Ze>>0],KA=0|tr[ye+Y>>0],tr[EA>>0]=KA,HA=0|tr[ye+J>>0],tr[ZA>>0]=HA,qA=0|tr[ye+D>>0],tr[BA>>0]=qA,xA=0|tr[ye+Q>>0],tr[yA>>0]=xA,$A=0|tr[ye+Ce>>0],tr[IA>>0]=$A,jA=0|tr[ye+T>>0],tr[pA>>0]=jA,re=0|tr[ye+We>>0],tr[_A>>0]=re,ee=0|tr[ye+Ie>>0],tr[XA>>0]=ee,n=we>>(fe=0|ar[cA>>2]),(0|(te=A>>fe))<=-1){n=10;break A}if((0|(ae=0|ar[lA>>2]))<=(0|te)){n=10;break A}if((0|n)<=-1){n=13;break A}if((0|(oe=0|ar[uA>>2]))<=(0|n)){n=13;break A}if(le=0|ar[sA>>2],ce=(ne=0|sr(ae,n))+te|0,ie=A+-1|0,i=he>>fe,!(-1<(0|(n=(e?ie:A)>>fe))&(0|n)<(0|ae))){n=15;break A}if(!(-1<(0|i)&(0|i)<(0|oe))){n=17;break A}if(SA=le+(3*((0|sr(ae,i))+n|0)|0)+2|0,SA=1+(0|tr[le+(3*ce|0)+2>>0])+(0|tr[SA>>0])>>1,n=A>>(i=0|ar[bA>>2]),i=we>>i,(0|n)<=-1){n=20;break A}if((0|(A=0|ar[dA>>2]))<=(0|n)){n=20;break A}if((0|i)<=-1){n=23;break A}if((0|i)>=(0|ar[kA>>2])){n=23;break A}de=(0|ar[hA>>2])+(24*((0|sr(A,i))+n|0)|0)+2|0,de=0|ar[(0|ar[wA>>2])+(lr[de>>1]<<2)>>2],Ae=(0|ar[de+756>>2])+SA|0,Ae=cr[41480+((0|Ae)<0?0:(0|Ae)<51?Ae:51)>>0]<<vA,de=(UA<<1&255)-2+SA+(0|ar[de+760>>2])|0,de=cr[41426+((0|de)<0?0:(0|de)<53?de:53)>>0]<<vA,UA=(0|(UA=(255&(zA=0|tr[gA>>0]))-((255&(OA=0|tr[mA>>0]))<<1)+(PA=255&(SA=0|tr[DA>>0]))|0))<0?0-UA|0:UA,jA=(0|(jA=(255&jA)-((255&xA)<<1)+(LA=255&HA)|0))<0?0-jA|0:jA,n=(be=(0|(be=(255&(xA=0|tr[CA>>0]))-((255&(se=0|tr[WA>>0]))<<1)+(i=255&(ue=0|tr[JA>>0]))|0))<0?0-be|0:be)+UA|0,A=(KA=(0|(KA=(255&$A)-((255&qA)<<1)+(HA=255&KA)|0))<0?0-KA|0:KA)+jA|0,jA=jA+UA|0,KA=KA+be|0;e:do{if((A+n|0)<(0|Ae)){UA=Ae>>2;do{if((n<<1|0)<(0|UA)){if(be=(0|cr[GA>>0])-PA|0,(Ae>>3|0)<=(((0|($A=i-(0|cr[VA>>0])|0))<0?0-$A|0:$A)+((0|be)<0?0-be|0:be)|0)){i=0;break}i=(0|((0|(i=PA-i|0))<0?0-i|0:i))<(1+(5*de|0)>>1|0)}else i=0}while(0);do{if((A<<1|0)<(0|UA)){if((Ae>>3|0)<=(((0|(re=HA-(255&re)|0))<0?0-re|0:re)+((0|(be=(255&ee)-LA|0))<0?0-be|0:be)|0)){n=0;break}n=(0|((0|(n=LA-HA|0))<0?0-n|0:n))<(1+(5*de|0)>>1|0)}else n=0}while(0);if(be=i&n,HA=(Ae>>1)+Ae>>3,A=(UA=0|tr[iA>>0])<<24>>24!=0,e){if(n=-1<(0|(i=ie>>fe)),A){if(!(n&(0|i)<(0|ae))){n=34;break A}A=(65535&(cr[(A=le+(3*(ne+i|0)|0)|0)>>0]|cr[A+1>>0]<<8))>>>10&1^1}else{if(!n){n=38;break A}A=1}if((0|ae)<=(0|i)){n=38;break A}i=le+(3*(ne+i|0)|0)|0,fe=(n=UA<<24>>24?0==(1024&(cr[(n=le+(3*ce|0)|0)>>0]|cr[n+1>>0]<<8)):1)&0==(2048&(cr[(fe=le+(3*ce|0)|0)>>0]|cr[fe+1>>0]<<8)),Ae=A<<24>>24?0==(2048&(cr[i>>0]|cr[i+1>>0]<<8)):0}else{if(n=-1<(0|(i=ge>>fe)),A){if(!(n&(0|i)<(0|oe))){n=44;break A}A=le+(3*((0|sr(ae,i))+te|0)|0)|0,A=0==(1024&(cr[A>>0]|cr[A+1>>0]<<8))}else{if(!n){n=48;break A}A=1}if((0|oe)<=(0|i)){n=48;break A}i=le+(3*((0|sr(ae,i))+te|0)|0)|0,fe=(n=UA<<24>>24?0==(1024&(cr[(n=le+(3*ce|0)|0)>>0]|cr[n+1>>0]<<8)):1)&0==(2048&(cr[(fe=le+(3*ce|0)|0)>>0]|cr[fe+1>>0]<<8)),Ae=A&0==(2048&(cr[i>>0]|cr[i+1>>0]<<8))}for(ee=de<<1,re=10*de|0,ie=0-de|0,$A=(0|HA)<=(0|jA)|1^Ae,qA=(0|HA)<=(0|KA)|1^fe,KA=0-(LA=de>>1)|0,PA=0,i=ue,A=se;;){HA=me+(pe+(jA=0|sr(FA,PA)))|0;do{if(be){ue=0|tr[JA+(PA<<2)+3>>0],le=255&A,UA=(ce=255&SA)+ee|0,SA=255&((0|(SA=(A=4+(ce<<1)|0)+((ae=255&OA)<<1)+(se=255&zA)+(n=(i&=255)<<1)+le>>3))<(0|(oe=ce-ee|0))?oe:(0|UA)<(0|SA)?UA:SA),OA=ae+ee|0,UA=255&((0|(UA=(ce+2+ae+se+i|0)>>>2))<(0|(oe=ae-ee|0))?oe:(0|OA)<(0|UA)?OA:UA),OA=(ce+4+ae+(3*se|0)+i+(cr[DA+(PA<<2)+3>>0]<<1)|0)>>>3,oe=se-ee|0,se=se+ee|0,OA=255&((0|OA)<(0|oe)?oe:(0|se)<(0|OA)?se:OA),n=A+ae+n+(le<<1)+(se=255&xA)>>3,A=i+ee|0,n=255&((0|n)<(0|(ae=i-ee|0))?ae:(0|A)<(0|n)?A:n),tr[QA>>0]=n,A=i+ce+le|0,ce=le-ee|0,le=le+ee|0,i=255&((0|(i=(se+2+A|0)>>>2))<(0|ce)?ce:(0|le)<(0|i)?le:i),tr[fA>>0]=i,A=(A+4+(3*se|0)+((255&ue)<<1)|0)>>>3,ue=se-ee|0,se=se+ee|0,A=255&((0|A)<(0|ue)?ue:(0|se)<(0|A)?se:A),tr[nA>>0]=A;do{if(e){if(!Ae){if(!fe)break;tr[HA>>0]=0|tr[QA>>0],tr[HA+1>>0]=0|tr[QA+1>>0],tr[HA+2>>0]=0|tr[QA+2>>0];break}if(tr[ye+(jA+-1)>>0]=SA,fe){tr[ye+jA>>0]=n,tr[ye+(jA+-2)>>0]=UA,tr[ye+(jA+1)>>0]=i,tr[ye+(jA+-3)>>0]=OA,tr[ye+(jA+2)>>0]=A;break}tr[ye+(jA+-2)>>0]=UA,tr[ye+(jA+-3)>>0]=OA;break}if(!Ae){if(!fe)break;tr[ye+PA>>0]=n,tr[ye+(FA+PA)>>0]=i,tr[ye+(rA+PA)>>0]=A;break}if(tr[ye+(PA-FA)>>0]=SA,fe){tr[ye+PA>>0]=n,tr[ye+(PA-q)>>0]=UA,tr[ye+(FA+PA)>>0]=i,tr[ye+(PA+$)>>0]=OA,tr[ye+(q+PA)>>0]=A;break}tr[ye+(PA-AA)>>0]=UA,tr[ye+(PA+eA)>>0]=OA;break}while(0)}else{if((0|re)<=(0|((0|(n=8+(9*((UA=255&i)-(SA&=255)|0)|0)+(0|sr((A&=255)-(i=255&OA)|0,-3))>>4))<0?0-n|0:n)))break;n=(0|n)<(0|ie)?ie:(0|de)<(0|n)?de:n;do{if(e){if(Ae&&(se=n+SA|0,tr[ye+(jA+-1)>>0]=(0|se)<0?0:255&((0|se)<(0|P)?se:L)),!fe)break;se=UA-n|0,tr[ye+jA>>0]=(0|se)<0?0:255&((0|se)<(0|P)?se:L)}else{if(Ae&&(se=n+SA|0,tr[ye+(PA-FA)>>0]=(0|se)<0?0:255&((0|se)<(0|P)?se:L)),!fe)break;se=UA-n|0,tr[ye+PA>>0]=(0|se)<0?0:255&((0|se)<(0|P)?se:L)}}while(0);if($A||(se=((0|(ue=(se=n+(((SA+1+(255&zA)|0)>>>1)-i)|0)>>1))<(0|KA)?KA:((0|LA)<(0|ue)?de:se)>>1)+i|0,tr[ye+(e?jA+-2|0:PA-K|0)>>0]=(0|se)<0?0:255&((0|se)<(0|P)?se:L)),qA)break;ue=((0|(se=(ue=((UA+1+(255&xA)|0)>>>1)-A-n|0)>>1))<(0|KA)?KA:((0|LA)<(0|se)?de:ue)>>1)+A|0,se=0|sr(e?PA:1,FA),tr[ye+(se+(e?1:PA))>>0]=(0|ue)<0?0:255&((0|ue)<(0|P)?ue:L)}}while(0);if(4==(0|(n=PA+1|0)))break e;zA=0|tr[DA+((PA=n)<<2)+2>>0],OA=0|tr[DA+(n<<2)+1>>0],SA=0|tr[DA+(n<<2)>>0],i=0|tr[JA+(n<<2)>>0],A=0|tr[JA+(n<<2)+1>>0],xA=0|tr[JA+(n<<2)+2>>0]}}}while(0)}ke=ke+TA|0}while((0|ke)<(0|Ee))}if((0|Be)<=(0|(r=r+NA|0))){n=5;break}}switch(0|n){case 5:return void(ur=MA);case 10:br(41808,41845,118,41865);break;case 13:br(41869,41845,119,41865);break;case 15:br(41808,41845,118,41865);break;case 17:br(41869,41845,119,41865);break;case 20:br(41808,41845,118,41865);break;case 23:br(41869,41845,119,41865);break;case 34:case 38:br(41808,41845,118,41865);break;case 44:case 48:br(41869,41845,119,41865)}}}function Ft(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P,L,K,q,$,AA,eA,rA,iA,fA,nA,tA,oA,aA,cA,lA,uA,sA,bA,dA,kA,hA,wA,vA,gA,mA,pA,yA,ZA,CA,WA,IA,BA,EA,GA,VA,XA,_A,FA,NA,RA,YA,JA,DA,QA,TA,MA=0,SA=0,UA=0,OA=0,HA=0,xA=0,jA=0,zA=0,PA=0,LA=0,KA=0,qA=0,$A=0,Ae=0,ee=0,re=0,ie=0,fe=0,ne=0,te=0,oe=0,ae=0,ce=0,le=0,ue=0;if(ur=(TA=ur)+32|0,JA=TA+16|0,DA=TA,QA=0|ar[(A|=0)+5780>>2],_A=0|ar[A+5784>>2],FA=0|sr(QA,e?2:1),NA=0|sr(_A,e?1:2),XA=0|ar[(RA=A+44|0)>>2],ue=(0|n)<(0|(ue=0|ar[(YA=A+10472|0)>>2]))?n:ue,b=A+5768|0,(0|(le=(0|i)<(0|(le=0|ar[A+10476>>2]))?i:le))<=(0|r))ur=TA;else{d=(0|f)<(0|ue),k=3-QA|0,h=3-_A|0,w=A+10460|0,v=A+5956|0,g=A+5952|0,m=A+10368|0,p=A+10372|0,y=A+10376|0,Z=A+10360|0,C=A+5776|0,W=A+10348|0,I=A+10352|0,B=A+10356|0,E=A+10340|0,G=A+48|0,V=A+5480|0,_=65535+(X=1<<ar[b>>2])|0,F=XA<<1,N=0|sr(XA,-2),Y=XA-1|0,Q=(J=XA<<1)-1|0,S=(T=3*XA|0)-1|0,O=1+XA|0,x=XA-2|0,j=1|J,P=J-2|0,L=1+T|0,q=T-2|0,cA=XA<<1,dA=3*XA|0,wA=eA=R=DA+2|0,vA=rA=t=2+JA|0,gA=iA=o=10+JA|0,mA=fA=H=DA+10|0,pA=nA=D=DA+4|0,yA=tA=c=4+JA|0,ZA=oA=l=12+JA|0,CA=aA=z=DA+12|0,WA=lA=M=DA+6|0,IA=uA=u=6+JA|0,BA=sA=s=14+JA|0,EA=bA=K=DA+14|0,VA=kA=$=a=8+JA|0,GA=hA=AA=U=DA+8|0;A:for(;;){if(d){ae=(0|(oe=0|sr(te=r<<h,_A)))/4|0,ce=oe+-1|0,re=e?oe:ce,Ae=f;do{if(fe=0|sr(ie=Ae<<k,QA),n=(0|sr(0|ar[YA>>2],ae))+((0|fe)/4|0)|0,1<(255&(n=3&tr[(0|ar[w>>2])+n>>0]))){ne=fe+-1|0,ee=e?ne:fe,qA=(n<<1&255)-2|0,KA=0;do{if(MA=0|ar[(0==(0|KA)?g:v)>>2],$A=(n=0|ar[A+4+((KA=KA+1|0)<<2)>>2])+(i=(0|sr(0|ar[RA>>2],te))+ie<<1)|0,e?(or[DA>>1]=0|or[$A>>1],or[JA>>1]=0|or[$A+-2>>1],or[R>>1]=0|or[$A+(XA<<1)>>1],or[t>>1]=0|or[$A+(Y<<1)>>1],or[D>>1]=0|or[$A+(J<<1)>>1],or[c>>1]=0|or[$A+(Q<<1)>>1],or[M>>1]=0|or[$A+(T<<1)>>1],or[u>>1]=0|or[$A+(S<<1)>>1],or[U>>1]=0|or[$A+2>>1],or[a>>1]=0|or[$A+-4>>1],or[H>>1]=0|or[$A+(O<<1)>>1],or[o>>1]=0|or[$A+(x<<1)>>1],or[z>>1]=0|or[$A+(j<<1)>>1],or[l>>1]=0|or[$A+(P<<1)>>1],or[K>>1]=0|or[$A+(L<<1)>>1],or[s>>1]=0|or[$A+(q<<1)>>1]):(PA=N+i|0,zA=lr[(zA=(LA=zA=$A)+4|0)>>1]|lr[zA+2>>1]<<16,ar[(jA=DA)>>2]=lr[LA>>1]|lr[LA+2>>1]<<16,ar[jA+4>>2]=zA,jA=lr[(jA=(zA=jA=n+PA|0)+4|0)>>1]|lr[jA+2>>1]<<16,ar[(LA=JA)>>2]=lr[zA>>1]|lr[zA+2>>1]<<16,ar[LA+4>>2]=jA,LA=lr[(LA=(jA=LA=n+(i+F)|0)+4|0)>>1]|lr[LA+2>>1]<<16,ar[(zA=GA)>>2]=lr[jA>>1]|lr[jA+2>>1]<<16,ar[zA+4>>2]=LA,PA=lr[(PA=(zA=PA=n+(PA+N)|0)+4|0)>>1]|lr[PA+2>>1]<<16,ar[(LA=VA)>>2]=lr[zA>>1]|lr[zA+2>>1]<<16,ar[LA+4>>2]=PA),n=oe>>(UA=0|ar[m>>2]),(0|(HA=fe>>UA))<=-1){n=14;break A}if((0|(jA=0|ar[p>>2]))<=(0|HA)){n=14;break A}if((0|n)<=-1){n=17;break A}if((0|(xA=0|ar[y>>2]))<=(0|n)){n=17;break A}if(PA=0|ar[Z>>2],zA=(OA=0|sr(jA,n))+HA|0,i=re>>UA,!(-1<(0|(n=ee>>UA))&(0|n)<(0|jA))){n=19;break A}if(!(-1<(0|i)&(0|i)<(0|xA))){n=21;break A}n=PA+(3*((0|sr(jA,i))+n|0)|0)+2|0,n=(1+(0|tr[PA+(3*zA|0)+2>>0])+(0|tr[n>>0])>>1)+MA|0;do{if(1==(0|ar[C>>2])){if(30<=(0|n)){if(42<(0|n)){n=n+-6|0;break}n=0|ar[6364+(n+-30<<2)>>2];break}}else n=(0|n)<51?n:51}while(0);if(i=fe>>(MA=0|ar[W>>2]),MA=oe>>MA,(0|i)<=-1){n=30;break A}if((0|(SA=0|ar[I>>2]))<=(0|i)){n=30;break A}if((0|MA)<=-1){n=33;break A}if((0|MA)>=(0|ar[B>>2])){n=33;break A}LA=(0|ar[E>>2])+(24*((0|sr(SA,MA))+i|0)|0)+2|0,LA=qA+n+(0|ar[760+(0|ar[(0|ar[G>>2])+(lr[LA>>1]<<2)>>2])>>2])|0,LA=cr[41426+((0|LA)<0?0:(0|LA)<53?LA:53)>>0]<<(0|ar[b>>2])-8,SA=0==(0|tr[V>>0]);e:do{if(e){if(n=-1<(0|(i=ne>>UA)),SA){if(!n){n=41;break A}MA=1}else{if(!(n&(0|i)<(0|jA))){n=37;break A}MA=0==(1024&(cr[(MA=PA+(3*(OA+i|0)|0)|0)>>0]|cr[MA+1>>0]<<8))}if((0|jA)<=(0|i)){n=41;break A}if(i=PA+(3*(OA+i|0)|0)|0,UA=(n=SA?1:0==(1024&(cr[(n=PA+(3*zA|0)|0)>>0]|cr[n+1>>0]<<8)))&0==(2048&(cr[(UA=PA+(3*zA|0)|0)>>0]|cr[UA+1>>0]<<8)),OA=0-LA|0,MA&0==(2048&(cr[i>>0]|cr[i+1>>0]<<8)))for(n=0;;)if(i=DA+(n<<1)|0,PA=0|lr[JA+(n<<1)>>1],PA=(MA=(0|(MA=4+(0|lr[8+JA+(n<<1)>>1])+((0|lr[i>>1])-PA<<2)-(0|lr[DA+8+(n<<1)>>1])>>3))<(0|OA)?OA:(0|LA)<(0|MA)?LA:MA)+PA|0,SA=0|sr(n,XA),or[$A+(SA+-1<<1)>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_),UA&&(PA=(0|lr[i>>1])-MA|0,or[$A+(SA<<1)>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_)),4==(0|(n=n+1|0)))break e;if(n=0|lr[DA>>1],i=4+(0|lr[$>>1])+(n-(0|lr[JA>>1])<<2)-(0|lr[AA>>1])>>3,UA&&(PA=n-((0|i)<(0|OA)?OA:(0|LA)<(0|i)?LA:i)|0,or[$A>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_)),n=0|lr[eA>>1],i=4+(0|lr[iA>>1])+(n-(0|lr[rA>>1])<<2)-(0|lr[fA>>1])>>3,UA&&(PA=n-((0|i)<(0|OA)?OA:(0|LA)<(0|i)?LA:i)|0,or[$A+(XA<<1)>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_)),n=0|lr[nA>>1],i=4+(0|lr[oA>>1])+(n-(0|lr[tA>>1])<<2)-(0|lr[aA>>1])>>3,UA&&(PA=n-((0|i)<(0|OA)?OA:(0|LA)<(0|i)?LA:i)|0,or[$A+(cA<<1)>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_)),n=0|lr[lA>>1],i=4+(0|lr[sA>>1])+(n-(0|lr[uA>>1])<<2)-(0|lr[bA>>1])>>3,!UA)break;LA=n-((0|i)<(0|OA)?OA:(0|LA)<(0|i)?LA:i)|0,or[$A+(dA<<1)>>1]=(0|LA)<0?0:65535&((0|LA)<(0|X)?LA:_)}else{if(n=-1<(0|(i=ce>>UA)),SA){if(!n){n=57;break A}MA=1}else{if(!(n&(0|i)<(0|xA))){n=53;break A}MA=PA+(3*((0|sr(jA,i))+HA|0)|0)|0,MA=0==(1024&(cr[MA>>0]|cr[MA+1>>0]<<8))}if((0|xA)<=(0|i)){n=57;break A}if(i=PA+(3*((0|sr(jA,i))+HA|0)|0)|0,SA=(n=SA?1:0==(1024&(cr[(n=PA+(3*zA|0)|0)>>0]|cr[n+1>>0]<<8)))&0==(2048&(cr[(SA=PA+(3*zA|0)|0)>>0]|cr[SA+1>>0]<<8)),UA=0-LA|0,!(MA&0==(2048&(cr[i>>0]|cr[i+1>>0]<<8)))){if(!SA)break;zA=(PA=0|lr[DA>>1])-((0|(zA=4+(0|lr[kA>>1])+(PA-(0|lr[JA>>1])<<2)-(0|lr[hA>>1])>>3))<(0|UA)?UA:(0|LA)<(0|zA)?LA:zA)|0,or[$A>>1]=(0|zA)<0?0:65535&((0|zA)<(0|X)?zA:_),PA=(zA=0|lr[wA>>1])-((0|(PA=4+(0|lr[gA>>1])+(zA-(0|lr[vA>>1])<<2)-(0|lr[mA>>1])>>3))<(0|UA)?UA:(0|LA)<(0|PA)?LA:PA)|0,or[$A+2>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_),zA=(PA=0|lr[pA>>1])-((0|(zA=4+(0|lr[ZA>>1])+(PA-(0|lr[yA>>1])<<2)-(0|lr[CA>>1])>>3))<(0|UA)?UA:(0|LA)<(0|zA)?LA:zA)|0,or[$A+4>>1]=(0|zA)<0?0:65535&((0|zA)<(0|X)?zA:_),LA=(zA=0|lr[WA>>1])-((0|(PA=4+(0|lr[BA>>1])+(zA-(0|lr[IA>>1])<<2)-(0|lr[EA>>1])>>3))<(0|UA)?UA:(0|LA)<(0|PA)?LA:PA)|0,or[$A+6>>1]=(0|LA)<0?0:65535&((0|LA)<(0|X)?LA:_);break}for(n=0;i=DA+(n<<1)|0,PA=0|lr[JA+(n<<1)>>1],PA=(MA=(0|(MA=4+(0|lr[8+JA+(n<<1)>>1])+((0|lr[i>>1])-PA<<2)-(0|lr[DA+8+(n<<1)>>1])>>3))<(0|UA)?UA:(0|LA)<(0|MA)?LA:MA)+PA|0,or[$A+(n-XA<<1)>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_),SA&&(PA=(0|lr[i>>1])-MA|0,or[$A+(n<<1)>>1]=(0|PA)<0?0:65535&((0|PA)<(0|X)?PA:_)),4!=(0|(n=n+1|0)););}}while(0)}while((0|KA)<2)}Ae=Ae+FA|0}while((0|Ae)<(0|ue))}if((0|le)<=(0|(r=r+NA|0))){n=5;break}}switch(0|n){case 5:return void(ur=TA);case 14:br(41808,41845,118,41865);break;case 17:br(41869,41845,119,41865);break;case 19:br(41808,41845,118,41865);break;case 21:br(41869,41845,119,41865);break;case 30:br(41808,41845,118,41865);break;case 33:br(41869,41845,119,41865);break;case 37:case 41:br(41808,41845,118,41865);break;case 53:case 57:br(41869,41845,119,41865)}}}function Nt(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P,L,K,q,$,AA,eA,rA,iA,fA,nA,tA,oA,aA,cA,lA,uA,sA,bA,dA,kA,hA,wA,vA,gA,mA,pA,yA,ZA,CA,WA,IA,BA,EA,GA,VA,XA,_A,FA,NA,RA,YA,JA,DA,QA,TA,MA,SA,UA,OA,HA,xA,jA,zA,PA,LA,KA,qA,$A,Ae,ee,re,ie,fe,ne,te,oe,ae,ce,le,ue,se,be,de,ke,he,we,ve,ge,me,pe,ye=0,Ze=0,Ce=0,We=0,Ie=0,Be=0,Ee=0,Ge=0,Ve=0,Xe=0,_e=0,Fe=0,Ne=0,Re=0,Ye=0,Je=0,De=0,Qe=0,Te=0,Me=0,Se=0,Ue=0,Oe=0,He=0,xe=0,je=0;if(ur=(pe=ur)+16|0,ve=pe+8|0,ge=pe,me=0|ar[(A|=0)+5780>>2],be=0|ar[A+5784>>2],de=0|sr(me,e?2:1),ke=0|sr(be,e?1:2),se=0|ar[(he=A+44|0)>>2],je=(0|n)<(0|(je=0|ar[(we=A+10472|0)>>2]))?n:je,O=A+5768|0,(0|(xe=(0|i)<(0|(xe=0|ar[A+10476>>2]))?i:xe))<=(0|r))ur=pe;else{H=(0|f)<(0|je),x=3-me|0,j=3-be|0,z=A+10460|0,P=A+5956|0,L=A+5952|0,K=A+10368|0,q=A+10372|0,$=A+10376|0,AA=A+10360|0,eA=A+5776|0,rA=A+10348|0,iA=A+10352|0,fA=A+10356|0,nA=A+10340|0,tA=A+48|0,oA=A+5480|0,cA=255+(aA=1<<ar[O>>2])|0,lA=0-se|0,kA=(bA=se<<1)-1|0,vA=(hA=3*se|0)-1|0,mA=1+se|0,yA=se-2|0,ZA=1|bA,WA=bA-2|0,IA=1+hA|0,EA=hA-2|0,RA=sA=se-1|0,MA=(TA=se<<1)-1|0,jA=(xA=3*se|0)-1|0,fe=se<<1,ce=3*se|0,g=1-se|0,C=2-se|0,G=3-se|0,_=k=LA=XA=uA=ge+1|0,F=h=KA=_A=t=1+ve|0,N=w=qA=FA=o=5+ve|0,R=v=$A=NA=pA=ge+5|0,Y=m=Ae=YA=dA=ge+2|0,J=p=ee=JA=c=2+ve|0,D=y=re=DA=l=6+ve|0,Q=Z=ie=QA=CA=ge+6|0,T=W=ne=SA=wA=ge+3|0,M=I=te=UA=u=3+ve|0,S=B=oe=OA=s=7+ve|0,U=E=ae=HA=BA=ge+7|0,ue=V=b=zA=GA=a=4+ve|0,le=X=d=PA=VA=gA=ge+4|0;A:for(;;){if(H){Me=(0|(Te=0|sr(Qe=r<<j,be)))/4|0,Se=Te+-1|0,De=e?Te:Se,Ye=f;do{if(Oe=0|sr(Ue=Ye<<x,me),n=(0|sr(0|ar[we>>2],Me))+((0|Oe)/4|0)|0,1<(255&(n=3&tr[(0|ar[z>>2])+n>>0]))){He=Oe+-1|0,Je=e?He:Oe,Fe=(n<<1&255)-2|0,Ne=Ue-se|0,_e=0;do{if(Ze=0|ar[(0==(0|_e)?L:P)>>2],Re=(n=0|ar[A+4+((_e=_e+1|0)<<2)>>2])+(ye=(i=0|sr(0|ar[he>>2],Qe))+Ue|0)|0,e?(tr[ge>>0]=0|tr[Re>>0],tr[ve>>0]=0|tr[Re+-1>>0],tr[uA>>0]=0|tr[Re+se>>0],tr[t>>0]=0|tr[Re+sA>>0],tr[dA>>0]=0|tr[Re+bA>>0],tr[c>>0]=0|tr[Re+kA>>0],tr[wA>>0]=0|tr[Re+hA>>0],tr[u>>0]=0|tr[Re+vA>>0],tr[gA>>0]=0|tr[Re+1>>0],tr[a>>0]=0|tr[Re+-2>>0],tr[pA>>0]=0|tr[Re+mA>>0],tr[o>>0]=0|tr[Re+yA>>0],tr[CA>>0]=0|tr[Re+ZA>>0],tr[l>>0]=0|tr[Re+WA>>0],tr[BA>>0]=0|tr[Re+IA>>0],tr[s>>0]=0|tr[Re+EA>>0]):(Ve=n+(Xe=Ne+i|0)|0,ar[ge>>2]=cr[Re>>0]|cr[Re+1>>0]<<8|cr[Re+2>>0]<<16|cr[Re+3>>0]<<24,ar[ve>>2]=cr[Ve>>0]|cr[Ve+1>>0]<<8|cr[Ve+2>>0]<<16|cr[Ve+3>>0]<<24,Xe=n+(Xe-se)|0,Ve=n+(ye+se)|0,ar[le>>2]=cr[Ve>>0]|cr[Ve+1>>0]<<8|cr[Ve+2>>0]<<16|cr[Ve+3>>0]<<24,ar[ue>>2]=cr[Xe>>0]|cr[Xe+1>>0]<<8|cr[Xe+2>>0]<<16|cr[Xe+3>>0]<<24),n=Te>>(Ce=0|ar[K>>2]),(0|(Ie=Oe>>Ce))<=-1){n=14;break A}if((0|(Ee=0|ar[q>>2]))<=(0|Ie)){n=14;break A}if((0|n)<=-1){n=17;break A}if((0|(Be=0|ar[$>>2]))<=(0|n)){n=17;break A}if(Ve=0|ar[AA>>2],Ge=(We=0|sr(Ee,n))+Ie|0,i=De>>Ce,!(-1<(0|(n=Je>>Ce))&(0|n)<(0|Ee))){n=19;break A}if(!(-1<(0|i)&(0|i)<(0|Be))){n=21;break A}n=Ve+(3*((0|sr(Ee,i))+n|0)|0)+2|0,n=(1+(0|tr[Ve+(3*Ge|0)+2>>0])+(0|tr[n>>0])>>1)+Ze|0;do{if(1==(0|ar[eA>>2])){if(30<=(0|n)){if(42<(0|n)){n=n+-6|0;break}n=0|ar[6364+(n+-30<<2)>>2];break}}else n=(0|n)<51?n:51}while(0);if(i=Oe>>(ye=0|ar[rA>>2]),ye=Te>>ye,(0|i)<=-1){n=30;break A}if((0|(Ze=0|ar[iA>>2]))<=(0|i)){n=30;break A}if((0|ye)<=-1){n=33;break A}if((0|ye)>=(0|ar[fA>>2])){n=33;break A}Xe=(0|ar[nA>>2])+(24*((0|sr(Ze,ye))+i|0)|0)+2|0,Xe=Fe+n+(0|ar[760+(0|ar[(0|ar[tA>>2])+(lr[Xe>>1]<<2)>>2])>>2])|0,Xe=cr[41426+((0|Xe)<0?0:(0|Xe)<53?Xe:53)>>0]<<(0|ar[O>>2])-8,ye=0==(0|tr[oA>>0]);do{if(e){if(n=-1<(0|(i=He>>Ce)),ye){if(!n){n=41;break A}Ce=1}else{if(!(n&(0|i)<(0|Ee))){n=37;break A}Ce=0==(1024&(cr[(Ce=Ve+(3*(We+i|0)|0)|0)>>0]|cr[Ce+1>>0]<<8))}if((0|Ee)<=(0|i)){n=41;break A}if(Ze=Ve+(3*(We+i|0)|0)|0,ye=(n=ye?1:0==(1024&(cr[(n=Ve+(3*Ge|0)|0)>>0]|cr[n+1>>0]<<8)))&0==(2048&(cr[(ye=Ve+(3*Ge|0)|0)>>0]|cr[ye+1>>0]<<8)),i=0-Xe|0,!(Ce&0==(2048&(cr[Ze>>0]|cr[Ze+1>>0]<<8)))){if(!ye)break;Ge=(Ve=0|cr[ge>>0])-((0|(Ge=4+(0|cr[zA>>0])+(Ve-(0|cr[ve>>0])<<2)-(0|cr[PA>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ge)?Xe:Ge)|0,tr[Re>>0]=(0|Ge)<0?0:255&((0|Ge)<(0|aA)?Ge:cA),Ve=(Ge=0|cr[LA>>0])-((0|(Ve=4+(0|cr[qA>>0])+(Ge-(0|cr[KA>>0])<<2)-(0|cr[$A>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ve)?Xe:Ve)|0,tr[Re+se>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),Ge=(Ve=0|cr[Ae>>0])-((0|(Ge=4+(0|cr[re>>0])+(Ve-(0|cr[ee>>0])<<2)-(0|cr[ie>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ge)?Xe:Ge)|0,tr[Re+fe>>0]=(0|Ge)<0?0:255&((0|Ge)<(0|aA)?Ge:cA),Xe=(Ge=0|cr[ne>>0])-((0|(Ve=4+(0|cr[oe>>0])+(Ge-(0|cr[te>>0])<<2)-(0|cr[ae>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ve)?Xe:Ve)|0,tr[Re+ce>>0]=(0|Xe)<0?0:255&((0|Xe)<(0|aA)?Xe:cA);break}if(Ve=0|cr[ve>>0],Ve=(n=(0|(n=4+(0|cr[GA>>0])+((0|cr[ge>>0])-Ve<<2)-(0|cr[VA>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+-1>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),ye&&(Ve=(0|cr[ge>>0])-n|0,tr[Re>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA)),Ve=0|cr[_A>>0],Ve=(n=(0|(n=4+(0|cr[FA>>0])+((0|cr[XA>>0])-Ve<<2)-(0|cr[NA>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+RA>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),ye&&(Ve=(0|cr[XA>>0])-n|0,tr[Re+se>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA)),Ve=0|cr[JA>>0],Ve=(n=(0|(n=4+(0|cr[DA>>0])+((0|cr[YA>>0])-Ve<<2)-(0|cr[QA>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+MA>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),ye&&(Ve=(0|cr[YA>>0])-n|0,tr[Re+TA>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA)),Ve=0|cr[UA>>0],Xe=(n=(0|(n=4+(0|cr[OA>>0])+((0|cr[SA>>0])-Ve<<2)-(0|cr[HA>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+jA>>0]=(0|Xe)<0?0:255&((0|Xe)<(0|aA)?Xe:cA),!ye)break;Xe=(0|cr[SA>>0])-n|0,tr[Re+xA>>0]=(0|Xe)<0?0:255&((0|Xe)<(0|aA)?Xe:cA)}else{if(n=-1<(0|(i=Se>>Ce)),ye){if(!n){n=56;break A}Ce=1}else{if(!(n&(0|i)<(0|Be))){n=52;break A}Ce=Ve+(3*((0|sr(Ee,i))+Ie|0)|0)|0,Ce=0==(1024&(cr[Ce>>0]|cr[Ce+1>>0]<<8))}if((0|Be)<=(0|i)){n=56;break A}if(Ze=Ve+(3*((0|sr(Ee,i))+Ie|0)|0)|0,ye=(n=ye?1:0==(1024&(cr[(n=Ve+(3*Ge|0)|0)>>0]|cr[n+1>>0]<<8)))&0==(2048&(cr[(ye=Ve+(3*Ge|0)|0)>>0]|cr[ye+1>>0]<<8)),i=0-Xe|0,!(Ce&0==(2048&(cr[Ze>>0]|cr[Ze+1>>0]<<8)))){if(!ye)break;Ge=(Ve=0|cr[ge>>0])-((0|(Ge=4+(0|cr[V>>0])+(Ve-(0|cr[ve>>0])<<2)-(0|cr[X>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ge)?Xe:Ge)|0,tr[Re>>0]=(0|Ge)<0?0:255&((0|Ge)<(0|aA)?Ge:cA),Ve=(Ge=0|cr[_>>0])-((0|(Ve=4+(0|cr[N>>0])+(Ge-(0|cr[F>>0])<<2)-(0|cr[R>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ve)?Xe:Ve)|0,tr[Re+1>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),Ge=(Ve=0|cr[Y>>0])-((0|(Ge=4+(0|cr[D>>0])+(Ve-(0|cr[J>>0])<<2)-(0|cr[Q>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ge)?Xe:Ge)|0,tr[Re+2>>0]=(0|Ge)<0?0:255&((0|Ge)<(0|aA)?Ge:cA),Xe=(Ge=0|cr[T>>0])-((0|(Ve=4+(0|cr[S>>0])+(Ge-(0|cr[M>>0])<<2)-(0|cr[U>>0])>>3))<(0|i)?i:(0|Xe)<(0|Ve)?Xe:Ve)|0,tr[Re+3>>0]=(0|Xe)<0?0:255&((0|Xe)<(0|aA)?Xe:cA);break}if(Ve=0|cr[ve>>0],Ve=(n=(0|(n=4+(0|cr[b>>0])+((0|cr[ge>>0])-Ve<<2)-(0|cr[d>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+lA>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),ye&&(Ve=(0|cr[ge>>0])-n|0,tr[Re>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA)),Ve=0|cr[h>>0],Ve=(n=(0|(n=4+(0|cr[w>>0])+((0|cr[k>>0])-Ve<<2)-(0|cr[v>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+g>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),ye&&(Ve=(0|cr[k>>0])-n|0,tr[Re+1>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA)),Ve=0|cr[p>>0],Ve=(n=(0|(n=4+(0|cr[y>>0])+((0|cr[m>>0])-Ve<<2)-(0|cr[Z>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+C>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA),ye&&(Ve=(0|cr[m>>0])-n|0,tr[Re+2>>0]=(0|Ve)<0?0:255&((0|Ve)<(0|aA)?Ve:cA)),Ve=0|cr[I>>0],Xe=(n=(0|(n=4+(0|cr[B>>0])+((0|cr[W>>0])-Ve<<2)-(0|cr[E>>0])>>3))<(0|i)?i:(0|Xe)<(0|n)?Xe:n)+Ve|0,tr[Re+G>>0]=(0|Xe)<0?0:255&((0|Xe)<(0|aA)?Xe:cA),!ye)break;Xe=(0|cr[W>>0])-n|0,tr[Re+3>>0]=(0|Xe)<0?0:255&((0|Xe)<(0|aA)?Xe:cA)}}while(0)}while((0|_e)<2)}Ye=Ye+de|0}while((0|Ye)<(0|je))}if((0|xe)<=(0|(r=r+ke|0))){n=5;break}}switch(0|n){case 5:return void(ur=pe);case 14:br(41808,41845,118,41865);break;case 17:br(41869,41845,119,41865);break;case 19:br(41808,41845,118,41865);break;case 21:br(41869,41845,119,41865);break;case 30:br(41808,41845,118,41865);break;case 33:br(41869,41845,119,41865);break;case 37:case 41:br(41808,41845,118,41865);break;case 52:case 56:br(41869,41845,119,41865)}}}function Rt(A,e,r,i,f,n,t){r|=0,i|=0,f|=0,n|=0,t|=0;var o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0;for((0|(l=(e|=0)>>(u=0|ar[(d=(A|=0)+10448|0)>>2])))<=-1&&br(41808,41845,118,41865),o=A+10452|0,a=A+10456|0,c=A+10440|0,v=e,s=i,b=n,h=t,i=(w=r)>>u;;){if((0|(e=0|ar[o>>2]))<=(0|l)){e=4;break}if((0|i)<=-1){e=7;break}if((0|i)>=(0|ar[a>>2])){e=7;break}if(u=(0|ar[c>>2])+((0|sr(e,i))+l)|0,k=1<<s,!((0|cr[u>>0])&1<<f)){e=9;break}if(i=(n=k>>1)+v|0,n=n+w|0,Rt(A,v,w,e=s+-1|0,f=f+1|0,b,h),Rt(A,i,w,e,f,16,h),Rt(A,v,n,e,f,b,32),(0|(l=i>>(t=0|ar[d>>2])))<=-1){e=4;break}v=i,s=e,b=16,h=32,i=(w=n)>>t}if(4==(0|e))br(41808,41845,118,41865);else if(7==(0|e))br(41869,41845,119,41865);else if(9==(0|e)){if(s=31==(0|s))return;for(i=255&b,f=(0|v)/4|0,n=A+10472|0,t=A+10476|0,l=A+10460|0,e=0;r=(e+w|0)/4|0,(0|f)<(0|(u=0|ar[n>>2]))&&(0|r)<(0|ar[t>>2])&&(d=(0|sr(u,r))+f|0,d=(0|ar[l>>2])+d|0,tr[d>>0]=tr[d>>0]|i),(0|(e=e+4|0))<(0|k););if(s)return;for(u=255&h,t=(0|w)/4|0,l=A+10472|0,r=A+10476|0,i=A+10460|0,e=0;(0|(f=(e+v|0)/4|0))<(0|(n=0|ar[l>>2]))&&(0|t)<(0|ar[r>>2])&&(A=(0|sr(n,t))+f|0,A=(0|ar[i>>2])+A|0,tr[A>>0]=tr[A>>0]|u),(0|(e=e+4|0))<(0|k););return}}function Yt(A,e,r,i,f,n){r|=0,i|=0,f|=0,n|=0;var t,o=0,a=0,c=0,l=0,u=0;switch(n=(e|=0)>>(o=0|ar[(A|=0)+10368>>2]),o=r>>o,(0|n)<=-1&&br(41808,41845,118,41865),(0|(f=0|ar[A+10372>>2]))<=(0|n)&&br(41808,41845,118,41865),(0|o)<=-1&&br(41869,41845,119,41865),(0|o)>=(0|ar[A+10376>>2])&&br(41869,41845,119,41865),u=(0|ar[A+10360>>2])+(3*((0|sr(f,o))+n|0)|0)|0,t=1<<i,n=1<<i+-1,f=1<<i+-2,(65535&(cr[u>>0]|cr[u+1>>0]<<8))>>>3&7){case 3:if(31==(0|i))return;for(c=(n+e|0)/4|0,l=A+10472|0,u=A+10476|0,a=A+10460|0,i=(n+r|0)/4|0,o=0;f=(o+r|0)/4|0,(0|c)<(0|(n=0|ar[l>>2]))&&(0|f)<(0|ar[u>>2])&&(n=(0|sr(n,f))+c|0,n=(0|ar[a>>2])+n|0,tr[n>>0]=64|tr[n>>0],n=0|ar[l>>2]),(0|(f=(o+e|0)/4|0))<(0|n)&&(0|i)<(0|ar[u>>2])&&(A=(0|sr(n,i))+f|0,A=(0|ar[a>>2])+A|0,tr[A>>0]=-128|tr[A>>0]),(0|(o=o+1|0))<(0|t););return;case 2:if(31==(0|i))return;for(a=(n+e|0)/4|0,c=A+10472|0,l=A+10476|0,i=A+10460|0,f=0;n=(f+r|0)/4|0,(0|a)<(0|(o=0|ar[c>>2]))&&(0|n)<(0|ar[l>>2])&&(e=(0|sr(o,n))+a|0,e=(0|ar[i>>2])+e|0,tr[e>>0]=64|tr[e>>0]),(0|(f=f+1|0))<(0|t););return;case 1:if(31==(0|i))return;for(a=(n+r|0)/4|0,c=A+10472|0,l=A+10476|0,i=A+10460|0,f=0;(0|(n=(f+e|0)/4|0))<(0|(o=0|ar[c>>2]))&&(0|a)<(0|ar[l>>2])&&(r=(0|sr(o,a))+n|0,r=(0|ar[i>>2])+r|0,tr[r>>0]=-128|tr[r>>0]),(0|(f=f+1|0))<(0|t););return;case 6:if(31==(0|i))return;for(a=(f+e|0)/4|0,c=A+10472|0,l=A+10476|0,i=A+10460|0,f=0;n=(f+r|0)/4|0,(0|a)<(0|(o=0|ar[c>>2]))&&(0|n)<(0|ar[l>>2])&&(e=(0|sr(o,n))+a|0,e=(0|ar[i>>2])+e|0,tr[e>>0]=64|tr[e>>0]),(0|(f=f+1|0))<(0|t););return;case 7:if(31==(0|i))return;for(a=(n+e+f|0)/4|0,c=A+10472|0,l=A+10476|0,i=A+10460|0,f=0;n=(f+r|0)/4|0,(0|a)<(0|(o=0|ar[c>>2]))&&(0|n)<(0|ar[l>>2])&&(e=(0|sr(o,n))+a|0,e=(0|ar[i>>2])+e|0,tr[e>>0]=64|tr[e>>0]),(0|(f=f+1|0))<(0|t););return;case 4:if(31==(0|i))return;for(a=(f+r|0)/4|0,c=A+10472|0,l=A+10476|0,i=A+10460|0,f=0;(0|(n=(f+e|0)/4|0))<(0|(o=0|ar[c>>2]))&&(0|a)<(0|ar[l>>2])&&(r=(0|sr(o,a))+n|0,r=(0|ar[i>>2])+r|0,tr[r>>0]=-128|tr[r>>0]),(0|(f=f+1|0))<(0|t););return;case 5:if(31==(0|i))return;for(a=(n+r+f|0)/4|0,c=A+10472|0,l=A+10476|0,i=A+10460|0,f=0;(0|(n=(f+e|0)/4|0))<(0|(o=0|ar[c>>2]))&&(0|a)<(0|ar[l>>2])&&(r=(0|sr(o,a))+n|0,r=(0|ar[i>>2])+r|0,tr[r>>0]=-128|tr[r>>0]),(0|(f=f+1|0))<(0|t););return;default:return}}function Jt(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,n|=0,t|=0;var o=0,a=0,c=0;return t=(0|(c=(f|=0)?(f=e+-1>>(o=0|ar[t+10368>>2]),o=r>>o,(0|f)<=-1&&br(41808,41845,118,41865),(0|(a=0|ar[t+10372>>2]))<=(0|f)&&br(41808,41845,118,41865),(0|o)<=-1&&br(41869,41845,119,41865),(0|o)>=(0|ar[t+10376>>2])&&br(41869,41845,119,41865),c=(0|ar[t+10360>>2])+(3*((0|sr(a,o))+f|0)|0)|0,1792&(cr[c>>0]|cr[c+1>>0]<<8)?1:0|cr[(0|ar[t+10400>>2])+(i+-1)>>0]):1))!=(0|(f=n?(f=e>>(o=0|ar[t+10368>>2]),o=r+-1>>o,(0|f)<=-1&&br(41808,41845,118,41865),(0|(a=0|ar[t+10372>>2]))<=(0|f)&&br(41808,41845,118,41865),(0|o)<=-1&&br(41869,41845,119,41865),(0|o)>=(0|ar[t+10376>>2])&&br(41869,41845,119,41865),n=(0|ar[t+10360>>2])+(3*((0|sr(a,o))+f|0)|0)|0,0==(1792&(cr[n>>0]|cr[n+1>>0]<<8))&&(r>>(n=0|ar[t+5804>>2])<<n|0)<(0|r)?0|cr[(0|ar[t+10400>>2])+(i-(0|ar[t+5876>>2]))>>0]:1):1))?0!=(0|(ar[A>>2]=c))&0!=(0|(ar[A+4>>2]=f))?0:1!=(0|c)&1!=(0|f)?1:26:c>>>0<2?(ar[A>>2]=0,ar[A+4>>2]=1,26):(ar[A>>2]=c,ar[A+4>>2]=2+(c+29&31),2+((c+-1|0)%32|0)|0),void(ar[(A=A+8|0)>>2]=t)}function Dt(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t=0,o=0,a=0,c=0,l=0;if(ur=(n=ur)+144|0,c=n,4==(0|(r|=0))|1==(0|(f|=0)))ur=n;else{switch(f=(0|(l=(0|f)<26?26-f|0:f+-26|0))<(0|(f=(0|f)<10?10-f|0:f+-10|0))?l:f,0|r){case 8:t=7;break;case 16:t=1;break;case 32:t=0;break;default:br(49065,41615,518,41687)}if((0|f)<=(0|t))ur=n;else{if(f=32==(0|r)&(0==(0|i)&0!=(0|tr[A+5665>>0]))&&(o=0|cr[e>>0],(0|((0|(l=(0|cr[e+64>>0])+o-(cr[e+32>>0]<<1)|0))<0?0-l|0:l))<(0|(a=1<<(0|ar[A+1276>>2])-5)))?(0|((0|(f=(0|cr[e+-64>>0])+o-(cr[e+-32>>0]<<1)|0))<0?0-f|0:f))<(0|a):0,i=c+64|0,a=0|sr(r,-2),tr[i+a>>0]=0|tr[e+a>>0],tr[i+(a=r<<1)>>0]=0|tr[e+a>>0],f)for(t=0|tr[e>>0],tr[i>>0]=t,t&=255,A=(0|cr[e+-64>>0])-t|0,o=(0|cr[e+64>>0])-t|0,f=1;l=((32+(0|sr(A,f))|0)>>>6)+t&255,tr[i+(0-f)>>0]=l,l=((32+(0|sr(o,f))|0)>>>6)+t&255,tr[i+f>>0]=l,64!=(0|(f=f+1|0)););else if((0|(f=1-a|0))<(0|a))for(f=0|tr[e+(t=f)>>0];c=f,f=0|tr[e+(t=(l=t)+1|0)>>0],tr[i+l>>0]=(2+(255&f)+((255&c)<<1)+(0|cr[e+(l+-1)>>0])|0)>>>2,(0|t)!=(0|a););Eu(e+(l=0-a|0)|0,i+l|0,r<<2|1),ur=n}}}function Qt(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t=0,o=0,a=0,c=0,l=0;if(ur=(n=ur)+272|0,c=n,4==(0|(r|=0))|1==(0|(f|=0)))ur=n;else{switch(f=(0|(l=(0|f)<26?26-f|0:f+-26|0))<(0|(f=(0|f)<10?10-f|0:f+-10|0))?l:f,0|r){case 8:t=7;break;case 16:t=1;break;case 32:t=0;break;default:br(49065,41615,518,41687)}if((0|f)<=(0|t))ur=n;else{if(f=32==(0|r)&(0==(0|i)&0!=(0|tr[A+5665>>0]))&&(o=0|lr[e>>1],(0|((0|(l=(0|lr[e+128>>1])+o-(lr[e+64>>1]<<1)|0))<0?0-l|0:l))<(0|(a=1<<(0|ar[A+1276>>2])-5)))?(0|((0|(f=(0|lr[e+-128>>1])+o-(lr[e+-64>>1]<<1)|0))<0?0-f|0:f))<(0|a):0,i=c+128|0,a=0|sr(r,-2),or[i+(a<<1)>>1]=0|or[e+(a<<1)>>1],or[i+((a=r<<1)<<1)>>1]=0|or[e+(a<<1)>>1],f)for(t=0|or[e>>1],or[i>>1]=t,t&=65535,A=(0|lr[e+-128>>1])-t|0,o=(0|lr[e+128>>1])-t|0,f=1;l=((32+(0|sr(A,f))|0)>>>6)+t&65535,or[i+(0-f<<1)>>1]=l,l=((32+(0|sr(o,f))|0)>>>6)+t&65535,or[i+(f<<1)>>1]=l,64!=(0|(f=f+1|0)););else if((0|(f=1-a|0))<(0|a))for(f=0|or[e+((t=f)<<1)>>1];c=f,f=0|or[e+((t=(l=t)+1|0)<<1)>>1],or[i+(l<<1)>>1]=(2+(65535&f)+((65535&c)<<1)+(0|lr[e+(l+-1<<1)>>1])|0)>>>2,(0|t)!=(0|a););Eu(e+((l=0-a|0)<<1)|0,i+(l<<1)|0,r<<3|2),ur=n}}}function Tt(A){ar[(A|=0)+8>>2]=1732584193,ar[A+12>>2]=-271733879,ar[A+16>>2]=-1732584194,ar[A+20>>2]=271733878,ar[A>>2]=0,ar[A+4>>2]=0}function Mt(A,e,r){e|=0,r|=0;var i,f,n=0,t=0;f=(t=0|ar[(A|=0)>>2])+r&536870911,ar[A>>2]=f,n=0|ar[(i=A+4|0)>>2],f>>>0<t>>>0&&(n=n+1|0,ar[i>>2]=n),ar[i>>2]=n+(r>>>29),n=63&t;do{if(n){if(t=64-n|0,n=A+24+n|0,t>>>0<=r>>>0){Eu(0|n,0|e,0|t),Do(A,A+24|0,64),e=e+t|0,r=r-t|0;break}return void Eu(0|n,0|e,0|r)}}while(0);63<r>>>0&&(e=0|Do(A,e,-64&r),r&=63),Eu(A+24|0,0|e,0|r)}function St(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=(A|=0)+4|0,n=0|ar[A>>2],1073741823<(o=1+(i=(t=(0|ar[f>>2])-n|0)>>2)|0)>>>0&&il(),a=(c=(0|ar[(l=A+8|0)>>2])-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t),ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),n&&Vl(n)}function Ut(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t=0,o=0,a=0,c=0;if(0|$t(t=(e|=0)+376148|0,1)||br(28370,28026,1433,28406),(0|(n=0|to(t,0|ar[e+375388>>2],A,0,0,0,0)))<=-1&&br(28445,28026,1436,28406),A=0|ar[e+376156>>2],A=(0|ar[e+376160>>2])-A>>2>>>0>n>>>0?0|ar[A+(n<<2)>>2]:0,e=1<<(0|ar[r+5004>>2])-1,function(A,e,r,i){A|=0,r|=0,i|=0,-1<(0|(e|=0))&&Vu(0|ar[A+4>>2],255&e|0,0|sr(0|ar[A+28>>2],0|ar[A+40>>2]));-1<(0|r)&&Vu(0|ar[A+8>>2],255&r|0,0|sr(0|ar[A+36>>2],0|ar[A+44>>2]));if((0|i)<=-1)return;Vu(0|ar[A+12>>2],255&i|0,0|sr(0|ar[A+36>>2],0|ar[A+44>>2]))}(A,1<<(0|ar[r+4996>>2])-1,e,e),0<(0|ar[(e=A+10364|0)>>2]))for(o=A+10360|0,t=0;a=(0|ar[o>>2])+(3*t|0)|0,c=-769&(cr[a>>0]|cr[a+1>>0]<<8),tr[a>>0]=c,tr[a+1>>0]=c>>8,(0|(t=t+1|0))<(0|ar[e>>2]););return ar[A+92>>2]=i,ar[A+88>>2]=(0|ar[r+5032>>2])-1&i,tr[A+100>>0]=0,ar[A+96>>2]=f?2:1,tr[A+10516>>0]=1,0|n}function Ot(A,e){A|=0;var r,i,f=0,n=0,t=0,o=0,a=0;if(ur=(i=ur)+112|0,r=i+24|0,t=(o=i)+104|0,function(A,e,r){e|=0,r|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;ar[(A|=0)>>2]=e,ar[(i=A+4|0)>>2]=r,ar[(c=a=A+8|0)>>2]=0,ar[c+4>>2]=0,ar[(c=A+16|0)>>2]=0,r?(f=e+1|0,ar[A>>2]=f,n=0|cr[e>>0],o=r+-1|0,ar[i>>2]=o,n=0|Iu(0|n,0,56),t=D,ar[(l=a)>>2]=n,ar[l+4>>2]=t,o?(o=e+2|0,ar[A>>2]=o,f=0|cr[f>>0],l=r+-2|0,ar[i>>2]=l,f=0|Iu(0|f,0,48),f|=n,n=t|D,ar[(t=a)>>2]=f,ar[t+4>>2]=n,l?(t=e+3|0,ar[A>>2]=t,o=0|cr[o>>0],l=r+-3|0,ar[i>>2]=l,o=0|Iu(0|o,0,40),o|=f,f=n|D,ar[(n=a)>>2]=o,ar[n+4>>2]=f,l?(n=e+4|0,ar[A>>2]=n,t=0|cr[t>>0],l=r+-4|0,ar[i>>2]=l,f|=t,ar[(t=a)>>2]=o,ar[t+4>>2]=f,l?(t=e+5|0,ar[A>>2]=t,n=0|cr[n>>0],l=r+-5|0,ar[i>>2]=l,n=0|Iu(0|n,0,24),n|=o,f|=D,ar[(o=a)>>2]=n,ar[o+4>>2]=f,l?(o=e+6|0,ar[A>>2]=o,t=0|cr[t>>0],l=r+-6|0,ar[i>>2]=l,n|=t=0|Iu(0|t,0,16),f|=D,ar[(t=a)>>2]=n,ar[t+4>>2]=f,l?(t=e+7|0,ar[A>>2]=t,o=0|cr[o>>0],l=r+-7|0,ar[i>>2]=l,n|=o=0|Iu(0|o,0,8),f|=D,ar[(o=a)>>2]=n,ar[o+4>>2]=f,l=l?(ar[A>>2]=e+8,e=0|cr[t>>0],ar[i>>2]=r+-8,ar[(l=a)>>2]=n|e,ar[l+4>>2]=f,64-(l=0)|0):64-(l=8)|0,ar[c>>2]=l):(l=64-(l=16)|0,ar[c>>2]=l)):(l=64-(l=24)|0,ar[c>>2]=l)):(l=64-(l=32)|0,ar[c>>2]=l)):(l=64-(l=40)|0,ar[c>>2]=l)):(l=64-(l=48)|0,ar[c>>2]=l)):(l=64-(l=56)|0,ar[c>>2]=l)):(a=(a=64)-a|0,ar[c>>2]=a)}(o,0|ar[(e|=0)+20>>2],0|ar[e+24>>2]),tr[t>>0]=0,tr[(a=t+1|0)>>0]=0,tr[(f=t+2|0)>>0]=0,function(A,e){A|=0;var r=0;ct(e=e|0,1),r=255&(0|at(e,6)),tr[A>>0]=r,r=255&(0|at(e,6)),tr[A+1>>0]=r,e=255+(0|at(e,3))&255,tr[A+2>>0]=e}(t,o),n=0|tr[t>>0],tr[A+377212>>0]=n,tr[A+377213>>0]=(n+-19&255)<2&1,tr[A+377214>>0]=(-8&n)<<24>>24==16&1,0|tr[a>>0])return Eo(A+548|0,e),ur=i,(e=0)|e;if((0|cr[f>>0])>(0|ar[A+375912>>2]))return Eo(A+548|0,e),ur=i,(e=0)|e;if((255&n)<32)return e=0|Vr(A,o,e,t),ur=i,0|e;switch(n<<24>>24){case 32:return a=0|gr(A,o),Eo(A+548|0,e),ur=i,0|(e=a);case 33:return a=0|Cr(A,o),Eo(A+548|0,e),ur=i,0|(e=a);case 34:return a=0|Ir(A,o),Eo(A+548|0,e),ur=i,0|(e=a);case 40:case 39:a=0|function(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f=0,n=0;for(r=0;r=(n=0|at(A,8))+r|0,255==(0|n););for(f=0;f=(n=0|at(A,8))+f|0,255==(0|n););if(ar[e>>2]=r,ar[e+4>>2]=f,132!=(0|r))return(e=0)|e;if(f=0|at(A,8),ar[(n=e+8|0)>>2]=f,!i)return 0|(e=1025);for(i=0==(0|ar[i+476>>2])?1:3,r=0;;){switch(0|f){case 0:f=255&(0|at(A,8)),tr[e+12+(r<<4)>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+1>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+2>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+3>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+4>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+5>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+6>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+7>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+8>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+9>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+10>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+11>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+12>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+13>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+14>>0]=f,f=255&(0|at(A,8)),tr[e+12+(r<<4)+15>>0]=f;break;case 1:f=65535&(0|at(A,16)),or[e+60+(r<<1)>>1]=f;break;case 2:f=0|at(A,32),ar[e+68+(r<<2)>>2]=f}if((0|i)<=(0|(r=r+1|0))){r=0;break}f=0|ar[n>>2]}return 0|r}(o,r,n=n<<24>>24==40,0|ar[A+375388>>2]);do{if(a)20==(0|(f=0|ar[(n=A+84|0)>>2]))?(n=1001,f=19):(ar[n>>2]=f+1,n=a),ar[A+4+(f<<2)>>2]=n;else if(f=0|ar[A+377220>>2],!((0|ar[A+377216>>2])==(0|f)|1^n)){if(f=0|ar[f+-4>>2],(0|(n=0|ar[(o=f+10648|0)>>2]))==(0|ar[f+10652>>2])){Er(f+10644|0,r);break}for(f=r,t=n+80|0;ar[n>>2]=ar[f>>2],f=f+4|0,(0|(n=n+4|0))<(0|t););ar[o>>2]=80+(0|ar[o>>2]);break}}while(0);return Eo(A+548|0,e),ur=i,0|(e=a);case 36:return tr[A+376211>>0]=1,Eo(A+548|0,e),ur=i,(e=0)|e;default:return Eo(A+548|0,e),ur=i,(e=0)|e}return 0}function Ht(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u,s=0,b=0,d=0,k=0,h=0,w=0,v=0;if(ur=(u=ur)+2048|0,l=u,1<(0|(e|=0)))for(b=e,s=0;s=s+1|0,3<b>>>0;)b>>>=1;else s=0;if(a=5-s|0,c=1<<i+-1,n=(w=1<<f)+65535|0,t=0-w|0,o=0<(0|e)){h=65535&(31==(0|f)?t:31!=(0|f)?0:n),k=0;do{for(d=e;;){if(s=d+-1|0,(0|d)<=0){s=0,b=8;break}if(f=r+((0|sr(s,e))+k<<1)|0,0|or[f>>1]){f=0,b=10;break}d=s}if(8==(0|b))for(;d=l+((0|sr(s,e))+k<<1)|0,or[d>>1]=h,(0|(s=s+1|0))!=(0|e);)b=8;else if(10==(0|b))for(;;){for(b=s=0;v=r+((0|sr(s,e))+k<<1)|0,b=(0|sr(0|or[v>>1],0|tr[28532+(s<<a<<5)+f>>0]))+b|0,(0|(s=s+1|0))!=(0|d););if(b=b+64>>7,v=l+((0|sr(f,e))+k<<1)|0,or[v>>1]=(0|b)<(0|t)?t:(0|b)<(0|w)?b:n,(0|(f=f+1|0))==(0|e))break;b=10}k=k+1|0}while((0|k)!=(0|e));if(o){h=c>>i,k=0;do{for(w=0|sr(k,e),d=e;;){if(s=d+-1|0,(0|d)<=0){s=0,b=18;break}if(0|or[l+(s+w<<1)>>1]){f=0,b=20;break}d=s}if(18==(0|b))for(;ar[A+(s+w<<2)>>2]=h,(0|(s=s+1|0))!=(0|e);)b=18;else if(20==(0|b))for(;;){for(b=s=0;b=(0|sr(0|or[l+(s+w<<1)>>1],0|tr[28532+(s<<a<<5)+f>>0]))+b|0,(0|(s=s+1|0))!=(0|d););if(ar[A+(f+w<<2)>>2]=b+c>>i,(0|(f=f+1|0))==(0|e))break;b=20}k=k+1|0}while((0|k)!=(0|e));ur=u}else ur=u}else ur=u}function xt(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(ur=(c=ur)+2048|0,t=c,a=1<<(o=20-(f|=0)|0)-1,1<(0|(r|=0)))for(u=r,l=0;l=l+1|0,3<u>>>0;)u>>>=1;else l=0;if(n=5-l|0,k=0<(0|r)){d=0;do{for(b=r;;){if(l=b+-1|0,(0|b)<=0){l=0,u=7;break}if(w=i+((0|sr(l,r))+d<<1)|0,0|or[w>>1]){s=0,u=9;break}b=l}if(7==(0|u))for(;w=t+((0|sr(l,r))+d<<1)|0,((or[w>>1]=0)|(l=l+1|0))!=(0|r);)u=7;else if(9==(0|u))for(;;){for(u=l=0;w=i+((0|sr(l,r))+d<<1)|0,u=(0|sr(0|or[w>>1],0|tr[28532+(l<<n<<5)+s>>0]))+u|0,(0|(l=l+1|0))!=(0|b););if(h=u+64>>7,w=t+((0|sr(s,r))+d<<1)|0,or[w>>1]=(0|h)<-32768?-32768:65535&((0|h)<32767?h:32767),(0|(s=s+1|0))==(0|r))break;u=9}d=d+1|0}while((0|d)!=(0|r));if(k){h=(f=1<<f)+255|0,w=a>>o,i=0;do{for(k=0|sr(i,r),d=r;;){if(l=d+-1|0,(0|d)<=0){u=18;break}if(0|or[t+(l+k<<1)>>1]){u=19;break}d=l}if(18==(0|u))for(u=0|sr(i,e),l=0;d=(0|cr[(k=A+(l+u)|0)>>0])+w|0,tr[k>>0]=(0|d)<0?0:255&((0|d)<(0|f)?d:h),(0|(l=l+1|0))!=(0|r););else if(19==(0|u)){b=0|sr(i,e),s=0;do{for(u=l=0;u=(0|sr(0|or[t+(l+k<<1)>>1],0|tr[28532+(l<<n<<5)+s>>0]))+u|0,(0|(l=l+1|0))!=(0|d););u=(0|cr[(l=A+(s+b)|0)>>0])+(u+a>>o)|0,tr[l>>0]=(0|u)<0?0:255&((0|u)<(0|f)?u:h),s=s+1|0}while((0|s)!=(0|r))}i=i+1|0}while((0|i)!=(0|r));ur=c}else ur=c}else ur=c}function jt(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(ur=(c=ur)+2048|0,t=c,a=1<<(o=20-(f|=0)|0)-1,1<(0|(r|=0)))for(u=r,l=0;l=l+1|0,3<u>>>0;)u>>>=1;else l=0;if(n=5-l|0,k=0<(0|r)){d=0;do{for(b=r;;){if(l=b+-1|0,(0|b)<=0){l=0,u=7;break}if(w=i+((0|sr(l,r))+d<<1)|0,0|or[w>>1]){s=0,u=9;break}b=l}if(7==(0|u))for(;w=t+((0|sr(l,r))+d<<1)|0,((or[w>>1]=0)|(l=l+1|0))!=(0|r);)u=7;else if(9==(0|u))for(;;){for(u=l=0;w=i+((0|sr(l,r))+d<<1)|0,u=(0|sr(0|or[w>>1],0|tr[28532+(l<<n<<5)+s>>0]))+u|0,(0|(l=l+1|0))!=(0|b););if(h=u+64>>7,w=t+((0|sr(s,r))+d<<1)|0,or[w>>1]=(0|h)<-32768?-32768:65535&((0|h)<32767?h:32767),(0|(s=s+1|0))==(0|r))break;u=9}d=d+1|0}while((0|d)!=(0|r));if(k){h=(f=1<<f)+65535|0,w=a>>o,i=0;do{for(k=0|sr(i,r),d=r;;){if(l=d+-1|0,(0|d)<=0){u=18;break}if(0|or[t+(l+k<<1)>>1]){u=19;break}d=l}if(18==(0|u))for(u=0|sr(i,e),l=0;d=(0|lr[(k=A+(l+u<<1)|0)>>1])+w|0,or[k>>1]=(0|d)<0?0:65535&((0|d)<(0|f)?d:h),(0|(l=l+1|0))!=(0|r););else if(19==(0|u)){b=0|sr(i,e),s=0;do{for(u=l=0;u=(0|sr(0|or[t+(l+k<<1)>>1],0|tr[28532+(l<<n<<5)+s>>0]))+u|0,(0|(l=l+1|0))!=(0|d););u=(0|lr[(l=A+(s+b<<1)|0)>>1])+(u+a>>o)|0,or[l>>1]=(0|u)<0?0:65535&((0|u)<(0|f)?u:h),s=s+1|0}while((0|s)!=(0|r))}i=i+1|0}while((0|i)!=(0|r));ur=c}else ur=c}else ur=c}function zt(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(ur=(t=ur)+2048|0,n=t,1<(0|(e|=0))){for(o=e,u=0;;){if(!(3<o>>>0)){o=e,a=0;break}o>>>=1,u=u+1|0}for(;3<o>>>0;)o>>>=1,a=a+1|0;for(s=a+7|0,c=1<<u+-1,l=1<<a+6,a=e,o=0;;){if(o=o+1|0,!(3<a>>>0)){d=u,h=l,k=s;break}a>>>=1}}else c=o=0,d=-1,h=32,k=6;if(f=5-o|0,s=0<(0|e)){o=0;do{u=0;do{for(b=u<<f,l=a=0;w=r+((0|sr(a,i))+o<<1)|0,l=(0|sr(0|or[w>>1],0|tr[28532+(b<<5)+a>>0]))+l|0,(0|(a=a+1|0))!=(0|e););w=n+((0|sr(u,e))+o<<1)|0,or[w>>1]=l+c>>d,u=u+1|0}while((0|u)!=(0|e));o=o+1|0}while((0|o)!=(0|e));if(s){l=0;do{u=0|sr(l,e),c=0;do{for(s=c<<f,a=o=0;a=(0|sr(0|or[n+(o+u<<1)>>1],0|tr[28532+(s<<5)+o>>0]))+a|0,(0|(o=o+1|0))!=(0|e););or[A+(c+u<<1)>>1]=a+h>>k,c=c+1|0}while((0|c)!=(0|e));l=l+1|0}while((0|l)!=(0|e));ur=t}else ur=t}else ur=t}function Pt(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;if(ur=(t=ur)+2176|0,n=t+128|0,f=0<(0|(e|=0))){for(w=0==(0|(h=e>>>1)),v=e>>>2,g=7<e>>>0,s=(l=t)+64|(k=0);;){if(a=0|sr(k,i),!w)for(c=s,o=0;u=r+(o+a<<1)|0,b=r+((d=o+h|0)+a<<1)|0,or[c+(o<<1)>>1]=(0|lr[b>>1])+(0|lr[u>>1]),or[c+(d<<1)>>1]=(0|lr[u>>1])-(0|lr[b>>1]),(0|(o=o+1|0))!=(0|h););if(g)for(b=v,d=h,u=l,l=s;;){c=l,s=u,a=0;do{for(o=0;y=c+((Z=o+a|0)<<1)|0,p=c+((m=Z+b|0)<<1)|0,or[s+(Z<<1)>>1]=(0|lr[p>>1])+(0|lr[y>>1]),or[s+(m<<1)>>1]=(0|lr[y>>1])-(0|lr[p>>1]),(0|(o=o+1|0))!=(0|b););a=a+d|0}while((0|a)<(0|e));if((0|(b>>=1))<=1)break;Z=l,d>>=1,l=u,u=Z}else u=s;for(a=u,c=0|sr(k,e),o=0;p=0|or[a+(o<<1)>>1],y=0|or[a+((Z=1|o)<<1)>>1],or[n+(o+c<<1)>>1]=y+p,or[n+(Z+c<<1)>>1]=p-y,(0|(o=o+2|0))<(0|e););if((0|(k=k+1|0))==(0|e))break;s=u}if(f){for(w=0==(0|(h=e>>>1)),v=e>>>2,g=7<e>>>0,k=0;;){if(!w)for(a=u,o=0;p=n+((0|sr(o,e))+k<<1)|0,p=0|or[p>>1],y=n+((0|sr(Z=o+h|0,e))+k<<1)|0,y=0|or[y>>1],or[a+(o<<1)>>1]=y+p,or[a+(Z<<1)>>1]=p-y,(0|(o=o+1|0))!=(0|h););if(g)for(b=v,d=h,c=l,l=u;;){u=l,s=c,a=0;do{for(o=0;p=u+((m=o+a|0)<<1)|0,y=u+((Z=m+b|0)<<1)|0,or[s+(m<<1)>>1]=(0|lr[y>>1])+(0|lr[p>>1]),or[s+(Z<<1)>>1]=(0|lr[p>>1])-(0|lr[y>>1]),(0|(o=o+1|0))!=(0|b););a=a+d|0}while((0|a)<(0|e));if((0|(b>>=1))<=1)break;Z=l,d>>=1,l=c,c=Z}else c=u;for(a=c,o=0;p=a+(o<<1)|0,y=a+((Z=1|o)<<1)|0,m=A+((0|sr(o,e))+k<<1)|0,or[m>>1]=(0|lr[y>>1])+(0|lr[p>>1]),Z=A+((0|sr(Z,e))+k<<1)|0,or[Z>>1]=(0|lr[p>>1])-(0|lr[y>>1]),(0|(o=o+2|0))<(0|e););if((0|(k=k+1|0))==(0|e))break;u=c}ur=t}else ur=t}else ur=t}function Lt(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,a|=0,c|=0;var l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0;switch(d=0|ar[8112+((o|=0)<<2)>>2],s=(u=0|ar[8112+(a<<2)>>2])+n+(b=0|ar[8128+(a<<2)>>2])|0,l=c+-8|0,0|o){case 0:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(v=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+(0|sr(c,i))+v|0;or[d>>1]=0|cr[k>>0],(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0,k=k+1|0;c=c+1|0}while((0|c)!=(0|h));break;case 1:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(g=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+(0|sr(c,i))+g|0;v=(v=(cr[(k=(m=k)+1|0)>>0]<<2)-(0|cr[m>>0])+(0|sr(0|cr[m+2>>0],-10))|0)+(58*(0|cr[m+3>>0])|0)+(17*(0|cr[m+4>>0])|0)+(0|sr(0|cr[m+5>>0],-5))|0,or[d>>1]=v+(0|cr[m+6>>0])>>l,(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0;c=c+1|0}while((0|c)!=(0|h));break;case 2:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(m=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+(0|sr(c,i))+m|0;g=(cr[(k=(g=k)+1|0)>>0]<<2)-(0|cr[g>>0])+(40*((0|cr[g+4>>0])+(0|cr[g+3>>0])|0)|0)+(cr[g+6>>0]<<2)-(0|cr[g+7>>0])+(0|sr((0|cr[g+5>>0])+(0|cr[g+2>>0])|0,-11))>>l&65535,or[d>>1]=g,(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0;c=c+1|0}while((0|c)!=(0|h));break;case 3:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(w=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+(0|sr(c,i))+w|0;g=(g=(0|sr(0|cr[(k=(m=k)+1|0)>>0],-5))+(0|cr[m>>0])|0)+(17*(0|cr[m+2>>0])|0)+(58*(0|cr[m+3>>0])|0)+(0|sr(0|cr[m+4>>0],-10))|0,or[d>>1]=g+(cr[m+5>>0]<<2)-(0|cr[m+6>>0])>>l,(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0;c=c+1|0}while((0|c)!=(0|h))}switch(h=0==(0|o)?l:6,0|a){case 0:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;or[b>>1]=0|or[d>>1],(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0,d=d+2|0;k=k+1|0}while((0|k)!=(0|f));return;case 1:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;o=(o=(or[(d=(a=d)+2|0)>>1]<<2)-(0|or[a>>1])+(0|sr(0|or[a+4>>1],-10))|0)+(58*(0|or[a+6>>1])|0)+(17*(0|or[a+8>>1])|0)+(0|sr(0|or[a+10>>1],-5))|0,or[b>>1]=o+(0|or[a+12>>1])>>h,(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0;k=k+1|0}while((0|k)!=(0|f));return;case 2:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;a=(or[(d=(a=d)+2|0)>>1]<<2)-(0|or[a>>1])+(40*((0|or[a+8>>1])+(0|or[a+6>>1])|0)|0)+(or[a+12>>1]<<2)-(0|or[a+14>>1])+(0|sr((0|or[a+10>>1])+(0|or[a+4>>1])|0,-11))>>h&65535,or[b>>1]=a,(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0;k=k+1|0}while((0|k)!=(0|f));return;case 3:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;o=(o=(0|sr(0|or[(d=(a=d)+2|0)>>1],-5))+(0|or[a>>1])|0)+(17*(0|or[a+4>>1])|0)+(58*(0|or[a+6>>1])|0)+(0|sr(0|or[a+8>>1],-10))|0,or[b>>1]=o+(or[a+10>>1]<<2)-(0|or[a+12>>1])>>h,(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0;k=k+1|0}while((0|k)!=(0|f));return;default:return}}function Kt(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,a|=0,c|=0;var l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0;switch(d=0|ar[8112+((o|=0)<<2)>>2],s=(u=0|ar[8112+(a<<2)>>2])+n+(b=0|ar[8128+(a<<2)>>2])|0,l=c+-8|0,0|o){case 0:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(v=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+((0|sr(c,i))<<1)+(v<<1)|0;or[d>>1]=0|or[k>>1],(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0,k=k+2|0;c=c+1|0}while((0|c)!=(0|h));break;case 1:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(g=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+((0|sr(c,i))<<1)+(g<<1)|0;v=(v=(lr[(k=(m=k)+2|0)>>1]<<2)-(0|lr[m>>1])+(0|sr(0|lr[m+4>>1],-10))|0)+(58*(0|lr[m+6>>1])|0)+(17*(0|lr[m+8>>1])|0)+(0|sr(0|lr[m+10>>1],-5))|0,or[d>>1]=v+(0|lr[m+12>>1])>>l,(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0;c=c+1|0}while((0|c)!=(0|h));break;case 2:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(m=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+((0|sr(c,i))<<1)+(m<<1)|0;g=(lr[(k=(g=k)+2|0)>>1]<<2)-(0|lr[g>>1])+(40*((0|lr[g+8>>1])+(0|lr[g+6>>1])|0)|0)+(lr[g+12>>1]<<2)-(0|lr[g+14>>1])+(0|sr((0|lr[g+10>>1])+(0|lr[g+4>>1])|0,-11))>>l&65535,or[d>>1]=g,(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0;c=c+1|0}while((0|c)!=(0|h));break;case 3:if((0|(c=0-u|0))<(0|(h=b+n|0))&&(w=0-d|0,0<(0|f)))do{for(d=t+(c+u<<1)|(b=0),k=r+((0|sr(c,i))<<1)+(w<<1)|0;g=(g=(0|sr(0|lr[(k=(m=k)+2|0)>>1],-5))+(0|lr[m>>1])|0)+(17*(0|lr[m+4>>1])|0)+(58*(0|lr[m+6>>1])|0)+(0|sr(0|lr[m+8>>1],-10))|0,or[d>>1]=g+(lr[m+10>>1]<<2)-(0|lr[m+12>>1])>>l,(0|(b=b+1|0))!=(0|f);)d=d+(s<<1)|0;c=c+1|0}while((0|c)!=(0|h))}switch(h=0==(0|o)?l:6,0|a){case 0:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;or[b>>1]=0|or[d>>1],(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0,d=d+2|0;k=k+1|0}while((0|k)!=(0|f));return;case 1:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;o=(o=(or[(d=(a=d)+2|0)>>1]<<2)-(0|or[a>>1])+(0|sr(0|or[a+4>>1],-10))|0)+(58*(0|or[a+6>>1])|0)+(17*(0|or[a+8>>1])|0)+(0|sr(0|or[a+10>>1],-5))|0,or[b>>1]=o+(0|or[a+12>>1])>>h,(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0;k=k+1|0}while((0|k)!=(0|f));return;case 2:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;a=(or[(d=(a=d)+2|0)>>1]<<2)-(0|or[a>>1])+(40*((0|or[a+8>>1])+(0|or[a+6>>1])|0)|0)+(or[a+12>>1]<<2)-(0|or[a+14>>1])+(0|sr((0|or[a+10>>1])+(0|or[a+4>>1])|0,-11))>>h&65535,or[b>>1]=a,(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0;k=k+1|0}while((0|k)!=(0|f));return;case 3:if(!(0<(0|f)&0<(0|n)))return;k=0;do{for(b=A+(k<<1)|(c=0),d=t+((0|sr(k,s))<<1)|0;o=(o=(0|sr(0|or[(d=(a=d)+2|0)>>1],-5))+(0|or[a>>1])|0)+(17*(0|or[a+4>>1])|0)+(58*(0|or[a+6>>1])|0)+(0|sr(0|or[a+8>>1],-10))|0,or[b>>1]=o+(or[a+10>>1]<<2)-(0|or[a+12>>1])>>h,(0|(c=c+1|0))!=(0|n);)b=b+(e<<1)|0;k=k+1|0}while((0|k)!=(0|f));return;default:return}}function qt(){0}function $t(A,e){var r,i=0,f=0;if(e|=0)return 0|(f=1);if(e=0|ar[(A|=0)+12>>2],r=i=0|ar[A+8>>2],(f=e-i>>2)>>>0<(0|ar[A>>2])>>>0)return 0|(f=1);if((0|e)==(0|i))return(f=0)|f;for(e=0;;){if(A=0|ar[r+(e<<2)>>2],0==(0|tr[A+100>>0])&&0==(0|ar[A+96>>2])){e=1,i=7;break}if(f>>>0<=(e=e+1|0)>>>0){e=0,i=7;break}}return 7==(0|i)?0|e:0}function Ao(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f=0,n=0,t=0,o=0,a=0;A:do{if(i){if(n=A+8|0,(0|(t=0|ar[A+12>>2]))==(0|(A=o=0|ar[n>>2])))return 0|(r=-1);for(f=t-o>>2,i=0;a=0|ar[A+(i<<2)>>2],!((0|ar[a+92>>2])==(0|e)&&(0|ar[a+104>>2])>(0|r)&&2==(0|ar[a+96>>2]));)if(f>>>0<=(i=i+1|0)>>>0){f=t,i=o;break A}return 0|i}a=0|ar[(n=A+8|0)>>2],f=0|ar[A+12>>2],A=i=a}while(0);if((0|f)==(0|i))return 0|(a=-1);for(i=0;;){if(a=0|ar[A+(i<<2)>>2],(0|ar[a+92>>2])==(0|e)&&(0|ar[a+104>>2])>(0|r)&&0|ar[a+96>>2]){A=14;break}if((i=i+1|0)>>>0>=f-(0|ar[n>>2])>>2>>>0){i=-1,A=14;break}}return 14==(0|A)?0|i:0}function eo(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f=0,n=0,t=0,o=0,a=0;A:do{if(i){if(n=A+8|0,(0|(t=0|ar[A+12>>2]))==(0|(A=o=0|ar[n>>2])))return 0|(r=-1);for(f=t-o>>2,i=0;a=0|ar[A+(i<<2)>>2],!((0|ar[a+88>>2])==(0|e)&&(0|ar[a+104>>2])>(0|r)&&2==(0|ar[a+96>>2]));)if(f>>>0<=(i=i+1|0)>>>0){f=t,i=o;break A}return 0|i}a=0|ar[(n=A+8|0)>>2],f=0|ar[A+12>>2],A=i=a}while(0);if((0|f)==(0|i))return 0|(a=-1);for(i=0;;){if(a=0|ar[A+(i<<2)>>2],(0|ar[a+88>>2])==(0|e)&&(0|ar[a+104>>2])>(0|r)&&0|ar[a+96>>2]){A=14;break}if((i=i+1|0)>>>0>=f-(0|ar[n>>2])>>2>>>0){i=-1,A=14;break}}return 14==(0|A)?0|i:0}function ro(A,e){e|=0;var r,i=0;if((0|(i=0|ar[(A|=0)+12>>2]))==(0|(r=A=0|ar[A+8>>2])))return 0|(e=-1);for(i=i-A>>2,A=0;;){if((0|ar[ar[r+(A<<2)>>2]>>2])==(0|e)){i=5;break}if(i>>>0<=(A=A+1|0)>>>0){A=-1,i=5;break}}return 5==(0|i)?0|A:0}function io(A){var e,r,i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if((0|(i=0|ar[(r=(A|=0)+20|0)>>2]))==(0|(n=0|ar[(f=A+24|0)>>2]))&&br(29850,29880,147,29887),1<(l=n-i>>2)>>>0)for(t=(n=0)|ar[92+(0|ar[i>>2])>>2],o=1;;){if(n=(c=(0|(a=0|ar[92+(0|ar[i+(o<<2)>>2])>>2]))<(0|t))?o:n,l>>>0<=(o=o+1|0)>>>0){l=n;break}t=c?a:t}else l=0;n=0|ar[(c=A+36|0)>>2],u=(0|ar[A+40>>2])-n|0,a=0|ar[(o=A+48|0)>>2],(0|(0==(0|u)?0:(u<<8)-1|0))==((t=0|ar[(e=A+52|0)>>2])+a|0)&&(function(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(ur=(b=ur)+32|0,c=b+4|0,a=b,1023<(r=0|ar[(e=16+(A|=0)|0)>>2])>>>0){ar[e>>2]=r+-1024,c=0|ar[(l=A+4|0)>>2],s=0|ar[c>>2],c=c+4|0,ar[l>>2]=c,o=0|ar[(u=A+8|0)>>2],t=0|ar[(a=A+12|0)>>2],e=t,n=o;do{if((0|o)==(0|t)){if(r=0|ar[A>>2],(i=r)>>>0<c>>>0){f=(e=c)+((i=(1+(e-i>>2)|0)/-2|0)<<2)|0,e=(r=(e=n-e|0)>>2)?(Gu(0|f,0|c,0|e),0|ar[l>>2]):c,A=f+(r<<2)|0,ar[u>>2]=A,ar[l>>2]=e+(i<<2),e=A;break}if(1073741823<(e=0==(0|(e=e-i>>1))?1:e)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),f=0|El(e<<2),t=i=(n=f)+(e>>>2<<2)|0,f=f+(e<<2)|0,(0|c)==(0|o))e=t;else{for(e=t,r=c;ar[i>>2]=ar[r>>2],e=i=e+4|0,(0|(r=r+4|0))!=(0|o););r=0|ar[A>>2]}ar[A>>2]=n,ar[l>>2]=t,ar[u>>2]=e,ar[a>>2]=f,r&&(Vl(r),e=0|ar[u>>2])}else e=o}while(0);return ar[e>>2]=s,ar[u>>2]=4+(0|ar[u>>2]),ur=b}if(e=0|ar[(s=A+8|0)>>2],f=e-(0|ar[(u=A+4|0)>>2])|0,r=0|ar[(l=A+12|0)>>2],i=r-(0|ar[A>>2])|0,i>>>0<=f>>>0){for(e=0==(0|(e=i>>1))?1:e,ar[c+12>>2]=0,ar[c+16>>2]=A+12,1073741823<e>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),i=0|El(e<<2),ar[c>>2]=i,t=i+(f>>2<<2)|0,ar[(o=c+8|0)>>2]=t,ar[(n=c+4|0)>>2]=t,ar[(t=c+12|0)>>2]=i+(e<<2),f=0|El(4096),ar[a>>2]=f,function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=0|ar[(s=8+(A|=0)|0)>>2],u=0|ar[(i=A+12|0)>>2],t=u,a=r;do{if((0|r)==(0|u)){if(l=0|ar[(u=A+4|0)>>2],n=0|ar[A>>2],(f=n)>>>0<l>>>0){o=(n=l)+((t=(1+(n-f>>2)|0)/-2|0)<<2)|0,f=(n=(f=a-n|0)>>2)?(Gu(0|o,0|l,0|f),0|ar[u>>2]):l,l=o+(n<<2)|0,ar[s>>2]=l,ar[u>>2]=f+(t<<2),f=l;break}if(1073741823<(f=0==(0|(f=t-f>>1))?1:f)>>>0&&(Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)),o=0|El(f<<2),c=t=(a=o)+(f>>>2<<2)|0,o=o+(f<<2)|0,(0|l)==(0|r))f=c;else{for(f=c,n=l;ar[t>>2]=ar[n>>2],f=t=f+4|0,(0|(n=n+4|0))!=(0|r););n=0|ar[A>>2]}ar[A>>2]=a,ar[u>>2]=c,ar[s>>2]=f,ar[i>>2]=o,n&&(Vl(n),f=0|ar[s>>2])}else f=r}while(0);ar[f>>2]=ar[e>>2],ar[s>>2]=4+(0|ar[s>>2])}(c,a),f=0|ar[s>>2];e=0|ar[u>>2],(0|f)!=(0|e);)fo(c,a=f+-4|0),f=a;return r=e,i=0|ar[A>>2],ar[A>>2]=ar[c>>2],ar[c>>2]=i,ar[u>>2]=ar[n>>2],ar[n>>2]=r,e=0|ar[s>>2],ar[s>>2]=ar[o>>2],ar[o>>2]=e,A=0|ar[l>>2],ar[l>>2]=ar[t>>2],ar[t>>2]=A,(0|e)!=(0|f)&&(ar[o>>2]=e+(~((e+-4-r|0)>>>2)<<2)),0|i&&Vl(i),ur=b}if((0|r)!=(0|e))return s=0|El(4096),ar[c>>2]=s,function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=0|ar[(s=8+(A|=0)|0)>>2],u=0|ar[(i=A+12|0)>>2],t=u,a=r;do{if((0|r)==(0|u)){if(l=0|ar[(u=A+4|0)>>2],n=0|ar[A>>2],(f=n)>>>0<l>>>0){o=(n=l)+((t=(1+(n-f>>2)|0)/-2|0)<<2)|0,f=(n=(f=a-n|0)>>2)?(Gu(0|o,0|l,0|f),0|ar[u>>2]):l,l=o+(n<<2)|0,ar[s>>2]=l,ar[u>>2]=f+(t<<2),f=l;break}if(1073741823<(f=0==(0|(f=t-f>>1))?1:f)>>>0&&(Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)),o=0|El(f<<2),c=t=(a=o)+(f>>>2<<2)|0,o=o+(f<<2)|0,(0|l)==(0|r))f=c;else{for(f=c,n=l;ar[t>>2]=ar[n>>2],f=t=f+4|0,(0|(n=n+4|0))!=(0|r););n=0|ar[A>>2]}ar[A>>2]=a,ar[u>>2]=c,ar[s>>2]=f,ar[i>>2]=o,n&&(Vl(n),f=0|ar[s>>2])}else f=r}while(0);ar[f>>2]=ar[e>>2],ar[s>>2]=4+(0|ar[s>>2])}(A,c),ur=b;a=0|El(4096),ar[c>>2]=a,function(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;r=0|ar[(b=4+(A|=0)|0)>>2],s=0|ar[A>>2],n=s;do{if((0|r)==(0|s)){if(f=0|ar[(s=A+8|0)>>2],l=0|ar[(u=A+12|0)>>2],f>>>0<(i=l)>>>0){t=(i=(n=f)+((o=(1+(i-n>>2)|0)/2|0)<<2)|0)+(0-(u=(n=n-r|0)>>2)<<2)|0,u&&(Gu(0|t,0|r,0|n),i=t,f=0|ar[s>>2]),ar[b>>2]=i,ar[s>>2]=f+(o<<2);break}if(1073741823<(n=0==(0|(n=i-n>>1))?1:n)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),a=0|El(n<<2),l=i=(c=a)+((n+3|0)>>>2<<2)|0,a=a+(n<<2)|0,(0|r)==(0|f))n=l,f=r;else{for(o=i,n=l,t=r;ar[o>>2]=ar[t>>2],n=o=n+4|0,(0|(t=t+4|0))!=(0|f););f=0|ar[A>>2]}ar[A>>2]=c,ar[b>>2]=l,ar[s>>2]=n,ar[u>>2]=a,f&&(Vl(f),i=0|ar[b>>2])}else i=r}while(0);ar[i+-4>>2]=ar[e>>2],ar[b>>2]=(0|ar[b>>2])-4}(A,c),a=0|ar[u>>2],c=0|ar[a>>2],a=a+4|0,ar[u>>2]=a,o=0|ar[s>>2],t=0|ar[l>>2],e=t,n=o;do{if((0|o)==(0|t)){if(r=0|ar[A>>2],(i=r)>>>0<a>>>0){f=(e=a)+((i=(1+(e-i>>2)|0)/-2|0)<<2)|0,e=(r=(e=n-e|0)>>2)?(Gu(0|f,0|a,0|e),0|ar[u>>2]):a,A=f+(r<<2)|0,ar[s>>2]=A,ar[u>>2]=e+(i<<2),e=A;break}if(1073741823<(e=0==(0|(e=e-i>>1))?1:e)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),f=0|El(e<<2),t=i=(n=f)+(e>>>2<<2)|0,f=f+(e<<2)|0,(0|a)==(0|o))e=t;else{for(e=t,r=a;ar[i>>2]=ar[r>>2],e=i=e+4|0,(0|(r=r+4|0))!=(0|o););r=0|ar[A>>2]}ar[A>>2]=n,ar[u>>2]=t,ar[s>>2]=e,ar[l>>2]=f,r&&(Vl(r),e=0|ar[s>>2])}else e=o}while(0);ar[e>>2]=c,ar[s>>2]=4+(0|ar[s>>2]),ur=b}(A+32|0),a=0|ar[o>>2],t=0|ar[e>>2],n=0|ar[c>>2]),ar[(0|ar[n+((u=t+a|0)>>>10<<2)>>2])+((1023&u)<<2)>>2]=ar[i+(l<<2)>>2],ar[e>>2]=t+1,ar[(0|ar[r>>2])+(l<<2)>>2]=ar[(0|ar[f>>2])-4>>2],ar[f>>2]=(0|ar[f>>2])-4}function fo(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;r=0|ar[(b=(A|=0)+4|0)>>2],n=s=0|ar[A>>2];do{if((0|r)==(0|s)){if((f=0|ar[(s=A+8|0)>>2])>>>0<(i=l=0|ar[(u=A+12|0)>>2])>>>0){t=(i=(n=f)+((o=(1+(i-n>>2)|0)/2|0)<<2)|0)+(0-(u=(n=n-r|0)>>2)<<2)|0,u&&(Gu(0|t,0|r,0|n),i=t,f=0|ar[s>>2]),ar[b>>2]=i,ar[s>>2]=f+(o<<2);break}if(1073741823<(n=0==(0|(n=i-n>>1))?1:n)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),l=i=(c=a=0|El(n<<2))+((n+3|0)>>>2<<2)|0,a=a+(n<<2)|0,(0|r)==(0|f))n=l,f=r;else{for(o=i,n=l,t=r;ar[o>>2]=ar[t>>2],n=o=n+4|0,(0|(t=t+4|0))!=(0|f););f=0|ar[A>>2]}ar[A>>2]=c,ar[b>>2]=l,ar[s>>2]=n,ar[u>>2]=a,f&&(Vl(f),i=0|ar[b>>2])}else i=r}while(0);ar[i+-4>>2]=ar[e>>2],ar[b>>2]=(0|ar[b>>2])-4}function no(A){var e,r=0;if(r=(A|=0)+24|0,(0|ar[(e=A+20|0)>>2])==(0|ar[r>>2]))return(r=0)|r;for(;io(A),(0|ar[e>>2])!=(0|ar[r>>2]););return 0|(A=1)}function to(A,e,r,i,f,n,t){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0;var o,a,c,l,u,s=0,b=0,d=0,k=0,h=0,w=0,v=0;ur=(u=ur)+16|0,a=u,l=(A|=0)+8|0,b=0|ar[(c=A+12|0)>>2],o=k=0|ar[l>>2],s=b;A:do{if((0|b)==(0|k))d=-1,k=b;else{for(w=b-k>>2,d=0;h=0|ar[o+(d<<2)>>2],0!=(0|tr[h+100>>0])||0!=(0|ar[h+96>>2]);)if(w>>>0<=(d=d+1|0)>>>0){d=-1;break A}lo(h),s=0|ar[c>>2],k=0|ar[l>>2],b=s}}while(0);return(0|d)==((w=b-k>>2)+-1|0)||w>>>0<=(0|ar[A+4>>2])>>>0||(v=0|ar[s+-4>>2],0!=(0|tr[v+100>>0]))||0!=(0|ar[v+96>>2])?s=b:((b=0|ar[s+-4>>2])&&(uo(b),Vl(b),s=0|ar[c>>2]),s=s+-4|0,ar[c>>2]=s),-1==(0|d)&&(d=s-(0|ar[l>>2])>>2,ao(s=0|El(10624)),ar[a>>2]=s,(b=0|ar[c>>2])>>>0<(0|ar[A+16>>2])>>>0?(ar[b>>2]=s,ar[c>>2]=4+(0|ar[c>>2])):function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=4+(A|=0)|0,n=0|ar[A>>2],t=(0|ar[f>>2])-n|0,1073741823<(o=1+(i=t>>2)|0)>>>0&&il();c=(0|ar[(l=A+8|0)>>2])-n|0,a=c>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t);if(ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),!n)return;Vl(n)}(l,a)),s=0|ar[(0|ar[l>>2])+(d<<2)>>2],(b=0|ar[e+476>>2])>>>0<4?(co(s,0|ar[e+484>>2],0|ar[e+488>>2],b,e,1,r,0,i,f,n,t),tr[s+10516>>0]=0,ur=u,0|d):(br(37782,29880,259,29925),0)}function oo(A){var e,r;e=(A|=0)+36|0,r=A+48|0,ar[(A=A+52|0)>>2]=(0|ar[A>>2])-1,A=1+(0|ar[r>>2])|0,(ar[r>>2]=A)>>>0<=2047||(Vl(0|ar[ar[e>>2]>>2]),ar[e>>2]=4+(0|ar[e>>2]),ar[r>>2]=(0|ar[r>>2])-1024)}function ao(A){var e,r,i=0;ar[(A|=0)+48>>2]=0,ar[A+52>>2]=0,ar[A+56>>2]=0,ar[A+700>>2]=0,ar[A+704>>2]=0,ar[A+708>>2]=0,ar[(i=A+736|0)>>2]=0,ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i+12>>2]=0,ar[i+16>>2]=0,Qn(A+764|(ar[i+20>>2]=0)),_o(A+5932|0),tr[A+10518>>0]=0,tr[A+10519>>0]=0,Vu(A+10340|(tr[A+10520>>0]=0),0,140),ar[A>>2]=-1,ar[A+104>>2]=0,ar[A+10332>>2]=0,ar[A+10336>>2]=0,ar[A+10512>>2]=0,ar[A+4>>2]=0,ar[A+60>>2]=0,ar[A+8>>2]=0,ar[A+64>>2]=0,ar[A+12>>2]=0,ar[A+68>>2]=0,ar[A+28>>2]=0,i=A+10480|(ar[A+24>>2]=0),ar[A+10524>>2]=0,ar[i>>2]=0,ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i+12>>2]=0,ar[i+16>>2]=0,ar[i+20>>2]=0,tr[A+10516>>0]=2,ar[A+88>>2]=-1,ar[A+92>>2]=-1,ar[A+96>>2]=0,tr[A+100>>0]=0,ar[(i=A+10528|0)>>2]=0,ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i+12>>2]=0,ar[i+16>>2]=0,e=A+10548|0,IA(0|(e|=0),0),r=A+10576|0,gA(0|(r|=0),0)}function co(A,e,r,i,f,n,t,o,a,c,l,u){A|=0,e|=0,r|=0,i|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0;var s,b,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;switch(ur=(b=ur)+48|0,s=b,(f|=0)||br(30075,29989,240,30079),Eu(0|(h=A+764|0),0|f,4717),(0|h)!=(0|f)&&Wr(A+5484|0,0|ar[f+4720>>2],0|ar[f+4724>>2]),Eu(A+5496|0,f+4732|0,436),lo(A),k=0|ar[12652],ar[12652]=k+1,ar[A>>2]=k,ar[A+104>>2]=2147483647,ar[A+10332>>2]=t,ar[A+10336>>2]=o,ar[A+20>>2]=i,ar[A+24>>2]=e,ar[A+28>>2]=r,ar[(k=A+32|0)>>2]=e,ar[(h=A+36|0)>>2]=r,ar[A+10488>>2]=l,ar[(l=A+10480|0)>>2]=a,ar[l+4>>2]=c,0|i){case 3:case 0:d=g=1;break;case 1:d=2,y=8;break;case 2:d=1,y=8;break;default:br(37782,29989,276,30079)}switch(8==(0|y)&&(g=2),0|i){case 1:w=(e+1|0)/(ar[s>>2]=2)|0,ar[k>>2]=w,v=(r+1|0)/2|0,ar[h>>2]=v;break;case 2:ar[s>>2]=3,w=(e+1|0)/2|0,ar[k>>2]=w,v=r;break;case 3:ar[s>>2]=4,w=e,v=r;break;case 0:ar[s>>2]=1,ar[k>>2]=0,v=w=ar[h>>2]=0;break;default:br(49065,29989,302,30079)}ar[s+4>>2]=e,ar[s+8>>2]=r,ar[s+12>>2]=16,i=0|ar[f+496>>2],a=0|ar[f+500>>2],k=0|ar[f+504>>2],h=0|ar[f+508>>2],e=e-(0|sr(Z=a+i|0,g))|0,ar[A+72>>2]=e,l=r-(0|sr(c=h+k|0,d))|0,ar[A+76>>2]=l,ar[A+80>>2]=w-Z,ar[A+84>>2]=v-c,c=0|sr(i,g),ar[s+16>>2]=c,a=0|sr(a,g),ar[s+20>>2]=a,a=0|sr(k,d),ar[s+24>>2]=a,g=0|sr(h,d),ar[s+28>>2]=g,ar[s+32>>2]=e,ar[s+36>>2]=l,tr[A+16>>0]=8<(0|ar[f+4996>>2])&1,l=8<(0|ar[f+5004>>2])&1,tr[A+17>>0]=l,tr[A+18>>0]=l,d=(l=0==(0|t))?0:0|ar[t+544>>2];do{if(o){if(d=0|ar[o+3060>>2],u){if(Z=0|ar[o+3064>>2],l=A+10504|0,ar[A+10512>>2]=Z){ar[l>>2]=0,ar[A+10508>>2]=0;break}p=0|ar[(y=6080)>>2],y=0|ar[y+4>>2],ar[(m=l)>>2]=p,ar[m+4>>2]=y,m=d,y=25;break}y=24}else y=l|1^u?24:(p=0|ar[(y=t+536|0)>>2],y=0|ar[y+4>>2],ar[(m=A+10504|0)>>2]=p,ar[m+4>>2]=y,m=d,25)}while(0);if(24==(0|y)&&(p=0|ar[(Z=6080)>>2],Z=0|ar[Z+4>>2],ar[(m=A+10504|0)>>2]=p,ar[m+4>>2]=Z,m=d,y=25),25==(0|y)&&0|p&&(Z=0==(0|ts[15&p](t,s,A,m)),t=(0|ar[A+4>>2])+c+(0|sr(0|ar[A+40>>2],a))|0,ar[A+60>>2]=t,t=0|sr(0|ar[A+44>>2],k),ar[A+64>>2]=(0|ar[A+8>>2])+i+t,ar[A+68>>2]=(0|ar[A+12>>2])+i+t,Z))return ur=b,0|(Z=7);do{if(n){i=0|ar[(e=f+5112|0)>>2],k=0|ar[(w=f+5116|0)>>2],h=0|ar[(v=f+5108|0)>>2],a=0|sr(k,i),c=A+10404|0,d=0|ar[(l=A+10400|0)>>2];do{if((0|a)!=(0|ar[c>>2])){if($o(d),d=0|qo(a),ar[l>>2]=d){ar[c>>2]=a,y=32;break}r=ar[c>>2]=0;break}y=32}while(0);32==(0|y)&&(ar[A+10412>>2]=i,ar[A+10416>>2]=k,ar[A+10408>>2]=h,r=0!=(0|d)),h=0|ar[e>>2],k=0|ar[w>>2],i=0|ar[v>>2],a=0|sr(k,h),c=A+10424|0,d=0|ar[(l=A+10420|0)>>2];do{if((0|a)!=(0|ar[c>>2])){if($o(d),d=0|qo(a),ar[l>>2]=d){ar[c>>2]=a,y=37;break}d=ar[c>>2]=0;break}y=37}while(0);37==(0|y)&&(ar[A+10432>>2]=h,ar[A+10436>>2]=k,ar[A+10428>>2]=i,d=0!=(0|d)),e=r&d,l=A+10360|0,i=0|ar[(r=f+5052|0)>>2],k=0|ar[(v=f+5060|0)>>2],h=0|ar[(w=f+5036|0)>>2],a=0|sr(k,i),c=A+10364|0;do{if((0|a)!=(0|ar[c>>2])){if($o(0|ar[l>>2]),d=0|qo(3*a|0),ar[l>>2]=d){ar[c>>2]=a,y=43;break}d=ar[c>>2]=0;break}d=0|ar[l>>2],y=43}while(0);43==(0|y)&&(ar[A+10372>>2]=i,ar[A+10376>>2]=k,ar[A+10368>>2]=h,d=0!=(0|d)),h=e&d,i=(0|ar[w>>2])-2|0,k=ar[r>>2]<<i,i=ar[v>>2]<<i,l=A+10380|0,a=0|sr(i,k),c=A+10384|0;do{if((0|a)!=(0|ar[c>>2])){if($o(0|ar[l>>2]),d=0|qo(12*a|0),ar[l>>2]=d){ar[c>>2]=a,y=49;break}d=ar[c>>2]=0;break}d=0|ar[l>>2],y=49}while(0);49==(0|y)&&(ar[A+10392>>2]=k,ar[A+10396>>2]=i,ar[A+10388>>2]=2,d=0!=(0|d)),e=h&d,i=0|ar[f+5088>>2],k=0|ar[f+5092>>2],h=0|ar[f+5100>>2],a=0|sr(k,i),c=A+10444|0,d=0|ar[(l=A+10440|0)>>2];do{if((0|a)!=(0|ar[c>>2])){if($o(d),d=0|qo(a),ar[l>>2]=d){ar[c>>2]=a,y=54;break}d=ar[c>>2]=0;break}y=54}while(0);54==(0|y)&&(ar[A+10452>>2]=i,ar[A+10456>>2]=k,ar[A+10448>>2]=h,d=0!=(0|d)),h=e&d,i=(3+(0|ar[f+484>>2])|0)/4|0,k=(3+(0|ar[f+488>>2])|0)/4|0,a=0|sr(k,i),c=A+10464|0,d=0|ar[(l=A+10460|0)>>2];do{if((0|a)!=(0|ar[c>>2])){if($o(d),d=0|qo(a),ar[l>>2]=d){ar[c>>2]=a,y=59;break}d=ar[c>>2]=0;break}y=59}while(0);if(59==(0|y)&&(ar[A+10472>>2]=i,ar[A+10476>>2]=k,ar[A+10468>>2]=2,d=0!=(0|d)),r=h&d,h=A+10340|0,(0|(d=0|ar[(e=A+10344|0)>>2]))==(0|ar[f+5072>>2])){if(r)break;return ur=b,0|(d=7)}if(a=0|ar[(w=A+10524|0)>>2]){if(0|(d=0|ar[(l=a+-4|0)>>2]))for(d=a+(80*d|0)|0;zn(d=d+-80|0),(0|d)!=(0|a););Xl(l),d=0|ar[e>>2]}i=0|ar[f+5056>>2],k=0|ar[f+5064>>2],c=0|ar[f+5040>>2],l=0|sr(k,i);do{if((0|l)!=(0|d)){if($o(0|ar[h>>2]),d=0|qo(24*l|0),ar[h>>2]=d){ar[e>>2]=l,a=d,y=71;break}l=d=ar[e>>2]=0;break}a=0|ar[h>>2],l=d,y=71}while(0);if(71==(0|y)&&(ar[A+10352>>2]=i,ar[A+10356>>2]=k,ar[A+10348>>2]=c,d=0!=(0|a)),a=r&d,c=0|Gl(53687091<l>>>0|4294967291<(c=80*l|0)>>>0?-1:c+4|0),ar[c>>2]=l,c=c+4|0,0|l)for(d=c+(80*l|0)|0,l=c;jn(l),(0|(l=l+80|0))!=(0|d););if(ar[w>>2]=c,!a)return ur=b,0|(Z=7)}}while(0);return ur=b,(Z=0)|Z}function lo(A){var e,r=0,i=0,f=0,n=0,t=0,o=0;if(0|ar[(f=(A|=0)+4|0)>>2]&&((r=0|ar[A+10512>>2])?(o=0|ar[A+10336>>2],hs[127&r](o,A,0|ar[o+3060>>2])):(i=(r=0|ar[A+10332>>2])?0|ar[r+544>>2]:0,hs[127&ar[A+10508>>2]](r,A,i)),ar[f>>2]=0,ar[A+60>>2]=0,ar[A+8>>2]=0,ar[A+64>>2]=0,ar[A+12>>2]=0,ar[A+68>>2]=0),e=A+48|0,(0|(r=i=0|ar[(o=A+52|0)>>2]))!=(0|(f=A=0|ar[e>>2]))){for(t=0;(n=0|ar[f+(t<<2)>>2])&&(0|(r=0|ar[n+1344>>2])&&((0|(f=0|ar[(i=n+1348|0)>>2]))!=(0|r)&&(ar[i>>2]=f+(~((f+-4-r|0)>>>2)<<2)),Vl(r)),Zt(n+1332|0),0|(r=0|ar[n+776>>2])&&((0|(f=0|ar[(i=n+780|0)>>2]))!=(0|r)&&(ar[i>>2]=f+(~((f+-4-r|0)>>>2)<<2)),Vl(r)),Vl(n),r=0|ar[o>>2],A=0|ar[e>>2],i=r),(t=t+1|0)>>>0<i-(f=A)>>2>>>0;);i=A}(0|r)!=(0|f)&&(ar[o>>2]=r+(~((r+-4-i|0)>>>2)<<2))}function uo(A){var e,r,i,f=0,n=0,t=0,o=0;if(lo(A|=0),0|(n=0|ar[A+10524>>2])){if(0|(f=0|ar[(t=n+-4|0)>>2]))for(f=n+(80*f|0)|0;zn(f=f+-80|0),(0|f)!=(0|n););Xl(t)}if(r=A+10576|0,vA(0|(r|=0)),i=A+10548|0,WA(0|(i|=0)),$o(0|ar[A+10460>>2]),$o(0|ar[A+10440>>2]),$o(0|ar[A+10420>>2]),$o(0|ar[A+10400>>2]),$o(0|ar[A+10380>>2]),$o(0|ar[A+10360>>2]),$o(0|ar[A+10340>>2]),No(A+5932|0),Tn(A+764|0),0|(f=0|ar[A+748>>2])&&((0|ar[(n=A+752|0)>>2])!=(0|f)&&(ar[n>>2]=f),Vl(f)),0|(f=0|ar[A+736>>2])&&((0|(t=0|ar[(n=A+740|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(~((t+-2-f|0)>>>1)<<1)),Vl(f)),0|(f=0|ar[(e=A+700|0)>>2])){if((0|(n=0|ar[(o=A+704|0)>>2]))!=(0|f)){for(;n=n+-12|0,ar[o>>2]=n,(t=0|ar[n>>2])&&(Vl(t),n=0|ar[o>>2]),(0|n)!=(0|f););f=0|ar[e>>2]}Vl(f)}(t=0|ar[A+48>>2])&&((0|(n=0|ar[(f=A+52|0)>>2]))!=(0|t)&&(ar[f>>2]=n+(~((n+-4-t|0)>>>2)<<2)),Vl(t))}function so(A,e){e|=0;var r,i;Hn(r=(A|=0)+10548|0),ar[(i=A+10528|0)>>2]=(0|ar[i>>2])+e,ar[(A=A+10544|0)>>2]=(0|ar[A>>2])+e,xn(r)}function bo(A,e){e|=0;var r;Hn(e=(A|=0)+10548|0),ar[(r=A+10528|0)>>2]=(0|ar[r>>2])-1,ar[(A=A+10532|0)>>2]=1+(0|ar[A>>2]),xn(e)}function ko(A,e){e|=0;var r,i,f,n=0;(Hn(e=(A|=0)+10548|0),i=0|ar[(n=A+10532|0)>>2],ar[n>>2]=i-1,r=1+(0|ar[(n=A+10540|0)>>2])|0,ar[n>>2]=r,(0|i)<=0&&br(30135,29989,642,30156),(0|r)==(0|ar[A+10544>>2]))?(f=A+10576|0,Xu(f|=0),xn(e)):xn(e)}function ho(A,e,r,i,f){r|=0,i|=0,f|=0,function(A,e,r,i){A|=0,r|=0,i|=0;var f,n;if(!(e|=0))return;if((0|function(A){return 0|ar[(A|=0)>>2]}(r=(0|ar[A+10524>>2])+(80*r|0)|0))>=(0|i))return;Hn(f=A+10548|0),ar[(n=A+10532|0)>>2]=(0|ar[n>>2])-1,ar[(A=A+10536|0)>>2]=1+(0|ar[A>>2]),xn(f),ar[(e=e+4|0)>>2]=2,Pn(r,i),ar[e>>2]=1,Hn(f),ar[A>>2]=(0|ar[A>>2])-1,ar[n>>2]=1+(0|ar[n>>2]),xn(f)}(A|=0,e|=0,(0|sr(0|ar[A+5820>>2],i))+r|0,f)}function wo(A){var e,r,i;if(Hn(e=(A|=0)+10548|0),i=A+10544|0,(0|ar[(r=A+10540|0)>>2])!=(0|ar[i>>2])){for(A=A+10576|0;f=A,n=e,pA(0|(f|=0),0|(n|=0)),(0|ar[r>>2])!=(0|ar[i>>2]););var f,n;xn(e)}else xn(e)}function vo(A,e,r,i,f){A|=0,e|=0,r|=0;var n=0,t=0,o=0,a=0;return((f|=0)|(i|=0)|0)<0||(0|ar[A+1248>>2])<=(0|i)||(0|ar[A+1252>>2])<=(0|f)?(A=0)|A:(t=0|ar[A+5864>>2],a=0|ar[A+5852>>2],n=(0|sr(f>>t,a))+(i>>t)|0,t=(o=0|ar[A+10320>>2])+((0|sr(r>>t,a))+(e>>t)<<2)|0,(0|ar[o+(n<<2)>>2])>(0|ar[t>>2])?(a=0)|a:(t=e>>(a=0|ar[A+5804>>2]),n=r>>a,r=i>>a,e=f>>a,a=0|ar[A+10352>>2],o=(0|sr(a,n))+t|0,a=(f=0|ar[A+10340>>2])+(24*((0|sr(a,e))+r|0)|0)|0,(0|or[f+(24*o|0)>>1])!=(0|or[a>>1])?(a=0)|a:(a=0|ar[A+5820>>2],o=(0|sr(a,n))+t|0,a=(A=0|ar[A+10308>>2])+((0|sr(a,e))+r<<2)|0,0|(a=(0|ar[A+(o<<2)>>2])==(0|ar[a>>2])))))}function go(A,e,r,i,f,n,t,o,a,c,l){if(A|=0,f|=0,n|=0,t|=0,o|=0,a|=0,(0|(l|=0))<((i|=0)+(r|=0)|0)&(1^((i+(e|=0)|0)<=(0|(c|=0))|(0|c)<(0|e)|(0|l)<(0|r)))){if((t<<1|0)==(0|i)&&!((t+e|0)<=(0|c)|1!=(0|a)|(o<<1|0)!=(0|i)|(0|l)<(o+r|0)))return 0}else{if((l|c|0)<0)return 0;if((0|ar[A+1248>>2])<=(0|c))return 0;if((0|ar[A+1252>>2])<=(0|l))return 0;if(a=0|ar[A+5864>>2],i=0|ar[A+5852>>2],o=(0|sr(l>>a,i))+(c>>a)|0,a=(t=0|ar[A+10320>>2])+((0|sr(n>>a,i))+(f>>a)<<2)|0,(0|ar[t+(o<<2)>>2])>(0|ar[a>>2]))return 0;if(f>>=i=0|ar[A+5804>>2],e=n>>i,r=c>>i,i=l>>i,n=0|ar[A+10352>>2],a=(0|sr(n,e))+f|0,n=(o=0|ar[A+10340>>2])+(24*((0|sr(n,i))+r|0)|0)|0,(0|or[o+(24*a|0)>>1])!=(0|or[n>>1]))return 0;if(n=0|ar[A+5820>>2],a=(0|sr(n,e))+f|0,n=(o=0|ar[A+10308>>2])+((0|sr(n,i))+r<<2)|0,(0|ar[o+(a<<2)>>2])!=(0|ar[n>>2]))return 0}return i=c>>(e=0|ar[A+10368>>2]),e=l>>e,(0|i)<=-1&&br(41808,30172,118,41865),(0|(r=0|ar[A+10372>>2]))<=(0|i)&&br(41808,30172,118,41865),(0|e)<=-1&&br(41869,30172,119,41865),(0|e)<(0|ar[A+10376>>2])?(A=(0|ar[A+10360>>2])+(3*((0|sr(r,e))+i|0)|0)|0,0!=(768&(cr[A>>0]|cr[A+1>>0]<<8))|0):(br(41869,30172,119,41865),0)}function mo(A){return((A|=0)+-19&255)<2|0}function po(A){return((A|=0)+-16&255)<3|0}function yo(A){return(1|(A|=0))<<24>>24==9|0}function Zo(A){return(-8&(A|=0))<<24>>24==16|0}function Co(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=(A|=0)+4|0,n=0|ar[A>>2],1073741823<(o=1+(i=(t=(0|ar[f>>2])-n|0)>>2)|0)>>>0&&il(),a=(c=(0|ar[(l=A+8|0)>>2])-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t),ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),n&&Vl(n)}function Wo(A,e,r){e|=0,r|=0;var i,f=0;for(i=f=0|ar[(A|=0)+32>>2],A=(0|ar[A+36>>2])-f>>2;;){if(f=A+-1|0,(0|A)<=0){A=0,f=4;break}if(!(((0|ar[i+(f<<2)>>2])-r|0)>(0|e))){f=4;break}A=f}return 4==(0|f)?0|A:0}function Io(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=(A|=0)+4|0,n=0|ar[A>>2],1073741823<(o=1+(i=(t=(0|ar[f>>2])-n|0)>>2)|0)>>>0&&il(),a=(c=(0|ar[(l=A+8|0)>>2])-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t),ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),n&&Vl(n)}function Bo(A){var e,r,i,f,n=0,t=0,o=0;return(n=0|ar[(e=(A|=0)+32|0)>>2])?(f=0|ar[(i=A+16|0)>>2],o=0|ar[(t=A+28|0)>>2],r=0|ar[(0|ar[f+(o>>>10<<2)>>2])+((1023&o)<<2)>>2],ar[e>>2]=n+-1,n=o+1|0,2047<(ar[t>>2]=n)>>>0&&(Vl(0|ar[f>>2]),ar[i>>2]=4+(0|ar[i>>2]),ar[t>>2]=(0|ar[t>>2])-1024),ar[(o=A+36|0)>>2]=(0|ar[o>>2])-(0|ar[24+r>>2]),0|(o=r)):(t=0)|t}function Eo(A,e){A|=0,e|=0;var r,i,f,n,t=0,o=0;if(ur=(n=ur)+16|0,o=ar[(t=n)>>2]=e){if(r=A+40|0,(f=0|ar[(i=A+44|0)>>2])-(0|ar[r>>2])>>2>>>0<16)return(0|f)==(0|ar[A+48>>2])?Io(r,t):(ar[f>>2]=o,ar[i>>2]=4+(0|ar[i>>2])),void(ur=n);$o(0|ar[e+20>>2]),0|(A=0|ar[e+32>>2])&&((0|(o=0|ar[(t=e+36|0)>>2]))!=(0|A)&&(ar[t>>2]=o+(~((o+-4-A|0)>>>2)<<2)),Vl(A)),Vl(e),ur=n}else ur=n}function Go(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(ur=(b=ur)+32|0,c=b+4|0,a=b,1023<(r=0|ar[(e=(A|=0)+16|0)>>2])>>>0){ar[e>>2]=r+-1024,c=0|ar[(l=A+4|0)>>2],s=0|ar[c>>2],c=c+4|0,ar[l>>2]=c,o=0|ar[(u=A+8|0)>>2],e=t=0|ar[(a=A+12|0)>>2],n=o;do{if((0|o)==(0|t)){if((i=r=0|ar[A>>2])>>>0<c>>>0){f=(e=c)+((i=(1+(e-i>>2)|0)/-2|0)<<2)|0,e=(r=(e=n-e|0)>>2)?(Gu(0|f,0|c,0|e),0|ar[l>>2]):c,A=f+(r<<2)|0,ar[u>>2]=A,ar[l>>2]=e+(i<<2),e=A;break}if(1073741823<(e=0==(0|(e=e-i>>1))?1:e)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),t=i=(n=f=0|El(e<<2))+(e>>>2<<2)|0,f=f+(e<<2)|0,(0|c)==(0|o))e=t;else{for(e=t,r=c;ar[i>>2]=ar[r>>2],e=i=e+4|0,(0|(r=r+4|0))!=(0|o););r=0|ar[A>>2]}ar[A>>2]=n,ar[l>>2]=t,ar[u>>2]=e,ar[a>>2]=f,r&&(Vl(r),e=0|ar[u>>2])}else e=o}while(0);return ar[e>>2]=s,ar[u>>2]=4+(0|ar[u>>2]),void(ur=b)}if(f=(e=0|ar[(s=A+8|0)>>2])-(0|ar[(u=A+4|0)>>2])|0,(i=(r=0|ar[(l=A+12|0)>>2])-(0|ar[A>>2])|0)>>>0<=f>>>0){for(e=0==(0|(e=i>>1))?1:e,ar[c+12>>2]=0,ar[c+16>>2]=A+12,1073741823<e>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),i=0|El(e<<2),t=(ar[c>>2]=i)+(f>>2<<2)|0,ar[(o=c+8|0)>>2]=t,ar[(n=c+4|0)>>2]=t,ar[(t=c+12|0)>>2]=i+(e<<2),f=0|El(4096),ar[a>>2]=f,function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=0|ar[(s=8+(A|=0)|0)>>2],u=0|ar[(i=A+12|0)>>2],t=u,a=r;do{if((0|r)==(0|u)){if(l=0|ar[(u=A+4|0)>>2],n=0|ar[A>>2],(f=n)>>>0<l>>>0){o=(n=l)+((t=(1+(n-f>>2)|0)/-2|0)<<2)|0,f=(n=(f=a-n|0)>>2)?(Gu(0|o,0|l,0|f),0|ar[u>>2]):l,l=o+(n<<2)|0,ar[s>>2]=l,ar[u>>2]=f+(t<<2),f=l;break}if(1073741823<(f=0==(0|(f=t-f>>1))?1:f)>>>0&&(Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)),o=0|El(f<<2),c=t=(a=o)+(f>>>2<<2)|0,o=o+(f<<2)|0,(0|l)==(0|r))f=c;else{for(f=c,n=l;ar[t>>2]=ar[n>>2],f=t=f+4|0,(0|(n=n+4|0))!=(0|r););n=0|ar[A>>2]}ar[A>>2]=a,ar[u>>2]=c,ar[s>>2]=f,ar[i>>2]=o,n&&(Vl(n),f=0|ar[s>>2])}else f=r}while(0);ar[f>>2]=ar[e>>2],ar[s>>2]=4+(0|ar[s>>2])}(c,a),f=0|ar[s>>2];(0|f)!=(0|(e=0|ar[u>>2]));)Vo(c,a=f+-4|0),f=a;return r=e,i=0|ar[A>>2],ar[A>>2]=ar[c>>2],ar[c>>2]=i,ar[u>>2]=ar[n>>2],ar[n>>2]=r,e=0|ar[s>>2],ar[s>>2]=ar[o>>2],ar[o>>2]=e,A=0|ar[l>>2],ar[l>>2]=ar[t>>2],ar[t>>2]=A,(0|e)!=(0|f)&&(ar[o>>2]=e+(~((e+-4-r|0)>>>2)<<2)),0|i&&Vl(i),void(ur=b)}if((0|r)!=(0|e))return s=0|El(4096),ar[c>>2]=s,function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=0|ar[(s=8+(A|=0)|0)>>2],u=0|ar[(i=A+12|0)>>2],t=u,a=r;do{if((0|r)==(0|u)){if(l=0|ar[(u=A+4|0)>>2],n=0|ar[A>>2],(f=n)>>>0<l>>>0){o=(n=l)+((t=(1+(n-f>>2)|0)/-2|0)<<2)|0,f=(n=(f=a-n|0)>>2)?(Gu(0|o,0|l,0|f),0|ar[u>>2]):l,l=o+(n<<2)|0,ar[s>>2]=l,ar[u>>2]=f+(t<<2),f=l;break}if(1073741823<(f=0==(0|(f=t-f>>1))?1:f)>>>0&&(Fl(s=0|C(8),37845),ar[s>>2]=16004,I(0|s,3616,283)),o=0|El(f<<2),c=t=(a=o)+(f>>>2<<2)|0,o=o+(f<<2)|0,(0|l)==(0|r))f=c;else{for(f=c,n=l;ar[t>>2]=ar[n>>2],f=t=f+4|0,(0|(n=n+4|0))!=(0|r););n=0|ar[A>>2]}ar[A>>2]=a,ar[u>>2]=c,ar[s>>2]=f,ar[i>>2]=o,n&&(Vl(n),f=0|ar[s>>2])}else f=r}while(0);ar[f>>2]=ar[e>>2],ar[s>>2]=4+(0|ar[s>>2])}(A,c),void(ur=b);a=0|El(4096),ar[c>>2]=a,function(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;r=0|ar[(b=4+(A|=0)|0)>>2],s=0|ar[A>>2],n=s;do{if((0|r)==(0|s)){if(f=0|ar[(s=A+8|0)>>2],l=0|ar[(u=A+12|0)>>2],f>>>0<(i=l)>>>0){t=(i=(n=f)+((o=(1+(i-n>>2)|0)/2|0)<<2)|0)+(0-(u=(n=n-r|0)>>2)<<2)|0,u&&(Gu(0|t,0|r,0|n),i=t,f=0|ar[s>>2]),ar[b>>2]=i,ar[s>>2]=f+(o<<2);break}if(1073741823<(n=0==(0|(n=i-n>>1))?1:n)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),a=0|El(n<<2),l=i=(c=a)+((n+3|0)>>>2<<2)|0,a=a+(n<<2)|0,(0|r)==(0|f))n=l,f=r;else{for(o=i,n=l,t=r;ar[o>>2]=ar[t>>2],n=o=n+4|0,(0|(t=t+4|0))!=(0|f););f=0|ar[A>>2]}ar[A>>2]=c,ar[b>>2]=l,ar[s>>2]=n,ar[u>>2]=a,f&&(Vl(f),i=0|ar[b>>2])}else i=r}while(0);ar[i+-4>>2]=ar[e>>2],ar[b>>2]=(0|ar[b>>2])-4}(A,c),a=0|ar[u>>2],c=0|ar[a>>2],a=a+4|0,ar[u>>2]=a,o=0|ar[s>>2],e=t=0|ar[l>>2],n=o;do{if((0|o)==(0|t)){if((i=r=0|ar[A>>2])>>>0<a>>>0){f=(e=a)+((i=(1+(e-i>>2)|0)/-2|0)<<2)|0,e=(r=(e=n-e|0)>>2)?(Gu(0|f,0|a,0|e),0|ar[u>>2]):a,A=f+(r<<2)|0,ar[s>>2]=A,ar[u>>2]=e+(i<<2),e=A;break}if(1073741823<(e=0==(0|(e=e-i>>1))?1:e)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),t=i=(n=f=0|El(e<<2))+(e>>>2<<2)|0,f=f+(e<<2)|0,(0|a)==(0|o))e=t;else{for(e=t,r=a;ar[i>>2]=ar[r>>2],e=i=e+4|0,(0|(r=r+4|0))!=(0|o););r=0|ar[A>>2]}ar[A>>2]=n,ar[u>>2]=t,ar[s>>2]=e,ar[l>>2]=f,r&&(Vl(r),e=0|ar[s>>2])}else e=o}while(0);ar[e>>2]=c,ar[s>>2]=4+(0|ar[s>>2]),ur=b}function Vo(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;r=0|ar[(b=(A|=0)+4|0)>>2],n=s=0|ar[A>>2];do{if((0|r)==(0|s)){if((f=0|ar[(s=A+8|0)>>2])>>>0<(i=l=0|ar[(u=A+12|0)>>2])>>>0){t=(i=(n=f)+((o=(1+(i-n>>2)|0)/2|0)<<2)|0)+(0-(u=(n=n-r|0)>>2)<<2)|0,u&&(Gu(0|t,0|r,0|n),i=t,f=0|ar[s>>2]),ar[b>>2]=i,ar[s>>2]=f+(o<<2);break}if(1073741823<(n=0==(0|(n=i-n>>1))?1:n)>>>0&&(Fl(b=0|C(8),37845),ar[b>>2]=16004,I(0|b,3616,283)),l=i=(c=a=0|El(n<<2))+((n+3|0)>>>2<<2)|0,a=a+(n<<2)|0,(0|r)==(0|f))n=l,f=r;else{for(o=i,n=l,t=r;ar[o>>2]=ar[t>>2],n=o=n+4|0,(0|(t=t+4|0))!=(0|f););f=0|ar[A>>2]}ar[A>>2]=c,ar[b>>2]=l,ar[s>>2]=n,ar[u>>2]=a,f&&(Vl(f),i=0|ar[b>>2])}else i=r}while(0);ar[i+-4>>2]=ar[e>>2],ar[b>>2]=(0|ar[b>>2])-4}function Xo(A){var e,r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if(!(r=0|ar[(e=(A|=0)+8|0)>>2]))return(l=0)|l;if(6==(0|(i=0|ar[(l=A+4|0)>>2]))){if(a=(i=0|ar[(c=24+r|0)>>2])+1|0,(0|ar[(t=28+r|0)>>2])>(0|i))f=0|ar[20+r>>2];else{if(!(f=0|qo(a)))return 0|(l=7);(n=0|ar[(o=20+r|0)>>2])&&(Eu(0|f,0|n,0|i),$o(n),i=0|ar[c>>2]),ar[o>>2]=f,ar[t>>2]=a}tr[f+i>>0]=0,ar[c>>2]=1+(0|ar[c>>2]),i=0|ar[l>>2]}if(7==(0|i)){if(t=(i=0|ar[(c=24+r|0)>>2])+2|0,(0|ar[(o=28+r|0)>>2])<(0|t)){if(!(f=0|qo(t)))return 0|(l=7);(n=0|ar[(a=20+r|0)>>2])&&(Eu(0|f,0|n,0|i),$o(n),i=0|ar[c>>2]),ar[a>>2]=f,ar[o>>2]=t}else f=0|ar[20+r>>2];tr[(i=f+i|0)>>0]=0,tr[i+1>>0]=0,ar[c>>2]=2+(0|ar[c>>2]),i=0|ar[l>>2]}return 4<(0|i)&&(i=0|ar[(o=A+16|0)>>2],c=(0|ar[A+20>>2])-i|0,n=0|ar[(f=A+28|0)>>2],(0|(0==(0|c)?0:(c<<8)-1|0))==((t=0|ar[(a=A+32|0)>>2])+n|0)?(Go(A+12|0),n=0|ar[f>>2],f=0|ar[a>>2],i=0|ar[o>>2]):f=t,ar[(0|ar[i+((c=f+n|0)>>>10<<2)>>2])+((1023&c)<<2)>>2]=r,ar[a>>2]=f+1,ar[(A=A+36|0)>>2]=(0|ar[A>>2])+(0|ar[24+r>>2]),ar[e>>2]=0),(l=ar[l>>2]=0)|l}function _o(A){var e,r=0;for(tr[(A|=0)+4138>>0]=2,r=A+4139|0,tr[A+4155>>0]=0,tr[A+4156>>0]=0,tr[r>>0]=0,tr[r+1>>0]=0,tr[r+2>>0]=0,e=(r=A+4340|(tr[r+3>>0]=0))+60|0;(0|(r=r+4|(ar[r>>2]=0)))<(0|e););Fo(A,0)}function Fo(A,e){e|=0;var r=0,i=0;if(ar[(A|=0)>>2]=0,or[A+4>>1]=0,tr[A+6>>0]=1,tr[A+7>>0]=1,ar[A+8>>2]=27,tr[A+12>>0]=0,tr[A+13>>0]=0,tr[A+14>>0]=0,ar[(e=A+16|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,or[e+16>>1]=0,tr[e+18>>0]=0,ar[A+36>>2]=1,ar[A+40>>2]=1,tr[A+44>>0]=1,tr[A+45>>0]=1,tr[A+46>>0]=1,Vu(A+4172|0,0,168),e=0|ar[A+4340>>2],(0|(i=0|ar[(r=A+4344|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),e=0|ar[A+4352>>2],(0|(i=0|ar[(r=A+4356|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),e=0|ar[A+4364>>2],(0|(i=0|ar[(r=A+4368|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),e=0|ar[A+4376>>2],(0|(i=0|ar[(r=A+4380|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),e=0|ar[A+4388>>2],(0|(i=0|ar[(r=A+4392|0)>>2]))==(0|e))return ar[(i=A+4160|0)>>2]=0,tr[(i=A+47|0)>>0]=0,tr[(i=A+48|0)>>0]=0,tr[(i=A+49|0)>>0]=0,ar[(i=A+52|0)>>2]=0,ar[(i=A+56|0)>>2]=0,tr[(i=A+60|0)>>0]=0,tr[(i=A+4125|0)>>0]=0,ar[(i=A+4128|0)>>2]=2,ar[(A=A+4132|0)>>2]=0,void(or[A+4>>1]=0);ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2),ar[(i=A+4160|0)>>2]=0,tr[(i=A+47|0)>>0]=0,tr[(i=A+48|0)>>0]=0,tr[(i=A+49|0)>>0]=0,ar[(i=A+52|0)>>2]=0,ar[(i=A+56|0)>>2]=0,tr[(i=A+60|0)>>0]=0,tr[(i=A+4125|0)>>0]=0,ar[(i=A+4128|0)>>2]=2,ar[(A=A+4132|0)>>2]=0,or[A+4>>1]=0}function No(A){var e=0,r=0,i=0;0|(e=0|ar[(A|=0)+4388>>2])&&((0|(i=0|ar[(r=A+4392|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),Vl(e)),0|(e=0|ar[A+4376>>2])&&((0|(i=0|ar[(r=A+4380|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),Vl(e)),0|(e=0|ar[A+4364>>2])&&((0|(i=0|ar[(r=A+4368|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),Vl(e)),0|(e=0|ar[A+4352>>2])&&((0|(i=0|ar[(r=A+4356|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),Vl(e)),(i=0|ar[A+4340>>2])&&((0|(r=0|ar[(e=A+4344|0)>>2]))!=(0|i)&&(ar[e>>2]=r+(~((r+-4-i|0)>>>2)<<2)),Vl(i))}function Ro(A,e){var r,i,f,n,t,o=0,a=0,c=0,l=0;if((e|=0)>>>0<=(a=0|ar[(t=(A|=0)+8|0)>>2])-(o=0|ar[(l=A+4|0)>>2])>>2>>>0)return Vu(0|o,0,e<<2|0),void(ar[l>>2]=o+(e<<2));1073741823<(o=(i=(f=o-(n=0|ar[A>>2])|0)>>2)+e|0)>>>0&&il(),a=(c=a-n|0)>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);Vu(0|(r=c+(i<<2)|0),0,e<<2|0),o=r+(0-i<<2)|0,0<(0|f)&&Eu(0|o,0|n,0|f),ar[A>>2]=o,ar[l>>2]=r+(e<<2),ar[t>>2]=c+(a<<2),n&&Vl(n)}function Yo(A,e,r){e|=0,r|=0;var i,f=0;if(!(0|tr[(A|=0)+34>>0]))return 0==(r|e|0)|0;i=0|ar[A+36>>2];A:do{if(0<(0|i)){for(f=0;(0|ar[A+4252+(f<<2)>>2])!=(0|e);)if((0|i)<=(0|(f=f+1|0))){e=f=0;break A}if(0<(0|(e=0|ar[A+40>>2])))for(f=0;;){if((0|ar[A+4296+(f<<2)>>2])==(0|r)){e=f=1;break A}if((0|e)<=(0|(f=f+1|0))){f=1,e=0;break}}else f=1,e=0}else e=f=0}while(0);return e&f|0}function Jo(A,e,r,i,f,n,t,o,a,c,l){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0;var u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0,$=0,AA=0,eA=0,rA=0,iA=0,fA=0,nA=0,tA=0,oA=0,aA=0,cA=0,lA=0;if(ur=(S=ur)+144|0,D=S+8|0,_=(X=S)+136|0,U=0|ar[(F=(A|=0)+10352|0)>>2],iA=(0|sr(U,r))+e|0,Q=0|ar[A+10340>>2],H=f<<1,x=(0|cr[Q+(24*iA|0)+4>>0])>>>H&3)if(M=(T=1<<(P=0|ar[((O=0==(0|f))?A+5760|0:A+5768|0)>>2]))-1|0,J=0|sr(n,e),Y=0|sr(t,r),B=0|ar[(O?A+24|0:A+32|0)>>2],E=0|ar[(O?A+28|0:A+36|0)>>2],e=Y>>(G=0|ar[A+10348>>2]),-1<(0|(i=J>>G))&(0|i)<(0|U)||br(41808,41845,118,41865),(0|e)<=-1&&br(41869,41845,119,41865),(0|(V=0|ar[A+10356>>2]))<=(0|e)&&br(41869,41845,119,41865),nA=Q+(24*((0|sr(e,U))+i|0)|0)+2|0,y=A+52|0,Z=0|ar[A+48>>2],nA=0|ar[800+(0|ar[Z+(lr[nA>>1]<<2)>>2])>>2],C=0|ar[A+5820>>2],W=Z,cA=O?aA=0:(aA=(0|ar[A+5780>>2])-1|0,(0|ar[A+5784>>2])-1|0),p=(fA=0|ar[A+5804>>2])-aA|0,fA=fA-cA|0,R=(0|B)<(J+n|0)?B-J|0:n,N=(0|E)<(Y+t|0)?E-Y|0:t,I=0!=(0|tr[Q+(24*iA|0)+22>>0]),2==(0|x)){switch((0|cr[Q+(24*iA|0)+5>>0])>>>H&3){case 0:j=z=0,tA=-1,oA=1;break;case 1:j=-(z=1),oA=tA=0;break;case 2:tA=j=-(z=1),oA=1;break;case 3:j=-(z=1),oA=-(tA=1)}if(ar[D>>2]=tA,ar[4+D>>2]=oA,ar[X>>2]=j,ar[X+4>>2]=z,m=0|sr(j,a),g=0-z&a,tr[_>>0]=0|tr[Q+(24*iA|0)+9+(f<<2)>>0],tr[1+_>>0]=0|tr[Q+(24*iA|0)+9+(f<<2)+1>>0],tr[2+_>>0]=0,tr[3+_>>0]=0|tr[Q+(24*iA|0)+9+(f<<2)+2>>0],tr[4+_>>0]=0|tr[Q+(24*iA|0)+9+(f<<2)+3>>0],(0|N)<=0)ur=S;else{f=0<(0|R),u=A+5480|0,s=A+10368|0,b=A+10372|0,d=A+10376|0,k=A+10360|0,h=R+-1|0,w=N+-1|0,v=A+5977|0,P=A+10308|0,L=(0|sr(Y>>fA,C))+(J>>p)|0,j=0;A:for(;;){if(K=o+((0|sr(A=j+Y|0,a))+J<<1)|0,q=c+((0|sr(A,l))+J<<1)|0,f){AA=0==(0|j),eA=(0|j)==(0|w),iA=(0|(rA=($=A<<cA)>>G))<0|(0|V)<=(0|rA),z=0;do{if(I&&0!=(0|tr[u>>0])){if(i=z+J<<aA>>(e=0|ar[s>>2]),e=$>>e,(0|i)<=-1){lA=23;break A}if((0|(r=0|ar[b>>2]))<=(0|i)){lA=23;break A}if((0|e)<=-1){lA=26;break A}if((0|e)>=(0|ar[d>>2])){lA=26;break A}x=(0|ar[k>>2])+(3*((0|sr(r,e))+i|0)|0)|0,1024&(cr[x>>0]|cr[x+1>>0]<<8)||(lA=28)}else lA=28;e:do{if(28==(0|lA)){if(e=(i=(x=z+J|(lA=0))<<aA)>>(r=0|ar[s>>2]),r=$>>r,(0|e)<=-1){lA=30;break A}if((0|(U=0|ar[b>>2]))<=(0|e)){lA=30;break A}if((0|r)<=-1){lA=33;break A}if((0|r)>=(0|ar[d>>2])){lA=33;break A}if(H=(0|ar[k>>2])+(3*((0|sr(U,r))+e|0)|0)|0,!(2048&(cr[H>>0]|cr[H+1>>0]<<8))){if(eA|(0|z)==(0|h)|AA|0==(0|z)){O=-1<(0|(U=i>>G)),r=0;do{if(n=(0|ar[D+(r<<2)>>2])+x|0,!((0|(t=(0|ar[X+(r<<2)>>2])+A|0))<(0|E)&(0|n)<(0|B)&-1<(t|n|0)))break e;if(e=t<<cA>>G,(0|(i=n<<aA>>G))<=-1){lA=40;break A}if((0|(H=0|ar[F>>2]))<=(0|i)){lA=40;break A}if(!(-1<(0|e)&(0|e)<(0|V))){lA=42;break A}if(e=Q+(24*((0|sr(H,e))+i|0)|0)+2|0,(e=0|lr[e>>1])>>>0>=(0|ar[y>>2])-W>>2>>>0){lA=59;break A}if(!(i=0|ar[Z+(e<<2)>>2])){lA=59;break A}if((0|(i=0|ar[i+800>>2]))<(0|nA)){if(!(O&(0|U)<(0|H))){lA=47;break A}if(iA){lA=49;break A}if(H=Q+(24*((0|sr(H,rA))+U|0)|0)+2|0,!(0|tr[764+(0|ar[Z+(lr[H>>1]<<2)>>2])>>0]))break e}if((0|nA)<(0|i)&&0==(0|tr[764+(0|ar[Z+(e<<2)>>2])>>0]))break e;if(0==(0|tr[v>>0])&&(t=(0|sr(t>>fA,C))+(n>>p)|0,H=0|ar[P>>2],(0|ar[H+(t<<2)>>2])!=(0|ar[H+(L<<2)>>2])))break e;r=r+1|0}while((0|r)<2)}t=(x=0|lr[K+(z<<1)>>1])-(0|lr[K+(z+m+tA<<1)>>1])|0,H=x-(0|lr[K+(z+g+oA<<1)>>1])|0,x=(0|tr[((0|t)<0?1:0|t?3:2)+((0|H)<0?-1:0!=(0|H)&1)+_>>0])+x|0,or[q+(z<<1)>>1]=(0|x)<0?0:65535&((0|x)<(0|T)?x:M)}}}while(0);z=z+1|0}while((0|z)<(0|R))}if((0|N)<=(0|(j=j+1|0))){lA=59;break}}if(23==(0|lA))br(41808,41845,118,41865);else if(26==(0|lA))br(41869,41845,119,41865);else if(30==(0|lA))br(41808,41845,118,41865);else if(33==(0|lA))br(41869,41845,119,41865);else if(40==(0|lA))br(41808,41845,118,41865);else if(42==(0|lA))br(41869,41845,119,41865);else if(47==(0|lA))br(41808,41845,118,41865);else if(49==(0|lA))br(41869,41845,119,41865);else if(59==(0|lA))return void(ur=S)}}else{for(i=0|cr[Q+(24*iA|0)+6+f>>0],r=(e=D)+128|0;(0|(e=e+4|(ar[e>>2]=0)))<(0|r););ar[D+((31&i)<<2)>>2]=1,ar[D+((i+1&31)<<2)>>2]=2,ar[D+((i+2&31)<<2)>>2]=3,ar[D+((i+3&31)<<2)>>2]=4,rA=P+-5|0,i=0<(0|N);A:do{if(I){if(i){K=0<(0|R),q=A+5480|0,$=A+10368|0,AA=A+10372|0,eA=A+10376|0,P=A+10360|0,L=7<(0|rA),z=0;e:for(;;){r:do{if(K){if(j=(H=z+Y|0)<<cA,t=0|sr(H,a),H=0|sr(H,l),A=0==(0|tr[q>>0]),L)for(x=-1<(0|(H=j>>(t=0|ar[$>>2]))),n=-1<(0|(O=j>>t)),U=0;;){if(i=U+J<<aA,A)lA=79;else{if((0|(e=i>>t))<=-1){lA=88;break e}if((0|(r=0|ar[AA>>2]))<=(0|e)){lA=88;break e}if(!n){lA=91;break e}if((0|O)>=(0|ar[eA>>2])){lA=91;break e}oA=(0|ar[P>>2])+(3*((0|sr(r,O))+e|0)|0)|0,1024&(cr[oA>>0]|cr[oA+1>>0]<<8)||(lA=79)}if(79==(0|lA)){if(((lA=0)|(i>>=t))<=-1){lA=95;break e}if((0|i)>=(0|ar[AA>>2])){lA=95;break e}if(!x){lA=98;break e}if((0|H)>=(0|ar[eA>>2])){lA=98;break e}}if((0|R)<=(0|(U=U+1|0)))break r}else n=0;do{if(i=(x=n+J|0)<<aA,O=0|ar[$>>2],A)lA=93;else{if(r=j>>O,(0|(e=i>>O))<=-1){lA=88;break e}if((0|(U=0|ar[AA>>2]))<=(0|e)){lA=88;break e}if((0|r)<=-1){lA=91;break e}if((0|r)>=(0|ar[eA>>2])){lA=91;break e}oA=(0|ar[P>>2])+(3*((0|sr(U,r))+e|0)|0)|0,1024&(cr[oA>>0]|cr[oA+1>>0]<<8)||(lA=93)}do{if(93==(0|lA)){if(r=i>>O,i=j>>O,((lA=0)|r)<=-1){lA=95;break e}if((0|(e=0|ar[AA>>2]))<=(0|r)){lA=95;break e}if((0|i)<=-1){lA=98;break e}if((0|i)>=(0|ar[eA>>2])){lA=98;break e}if(oA=(0|ar[P>>2])+(3*((0|sr(e,i))+r|0)|0)|0,2048&(cr[oA>>0]|cr[oA+1>>0]<<8))break;if(i=0|lr[o+(x+t<<1)>>1],(0|(e=0|ar[D+(i>>>rA<<2)>>2]))<=0)break;oA=(0|tr[e+-1+(Q+(24*iA|0)+9+(f<<2))>>0])+i|0,or[c+(x+H<<1)>>1]=(0|oA)<0?0:65535&((0|oA)<(0|T)?oA:M)}}while(0);n=n+1|0}while((0|n)<(0|R))}}while(0);if((0|N)<=(0|(z=z+1|0)))break A}88==(0|lA)?br(41808,41845,118,41865):91==(0|lA)?br(41869,41845,119,41865):95==(0|lA)?br(41808,41845,118,41865):98==(0|lA)&&br(41869,41845,119,41865)}}else if(i&&(L=7<(0|rA),0<(0|R))){e=0;do{if(r=0|sr(U=e+Y|0,a),U=0|sr(U,l),!L)for(i=0;n=0|lr[o+((O=i+J|0)+r<<1)>>1],0<(0|(t=0|ar[D+(n>>>rA<<2)>>2]))&&(lA=(0|tr[t+-1+(Q+(24*iA|0)+9+(f<<2))>>0])+n|0,or[c+(O+U<<1)>>1]=(0|lA)<0?0:65535&((0|lA)<(0|T)?lA:M)),(0|(i=i+1|0))<(0|R););e=e+1|0}while((0|e)<(0|N))}}while(0);ur=S}else ur=S}function Do(A,e,r){e|=0,r|=0;var i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0;for(m=(A|=0)+12|0,p=A+16|0,y=A+20|0,f=A+88|0,n=A+92|0,t=A+96|0,o=A+100|0,a=A+104|0,c=A+108|0,l=A+112|0,u=A+116|0,s=A+120|0,b=A+124|0,d=A+128|0,k=A+132|0,h=A+136|0,w=A+140|0,v=A+144|0,i=A+148|0,A=0|ar[(g=A+8|0)>>2],Z=0|ar[m>>2],C=0|ar[y>>2],W=0|ar[p>>2];I=(0|cr[e+1>>0])<<8|0|cr[e>>0]|(0|cr[e+2>>0])<<16|(0|cr[e+3>>0])<<24,I=((I=A+-680876936+(Z&(C^W)^C)+(ar[f>>2]=I)|0)<<7|I>>>25)+Z|0,B=(0|cr[e+5>>0])<<8|0|cr[e+4>>0]|(0|cr[e+6>>0])<<16|(0|cr[e+7>>0])<<24,B=((B=C+-389564586+(ar[n>>2]=B)+(I&(Z^W)^W)|0)<<12|B>>>20)+I|0,E=(0|cr[e+9>>0])<<8|0|cr[e+8>>0]|(0|cr[e+10>>0])<<16|(0|cr[e+11>>0])<<24,E=((E=W+606105819+(ar[t>>2]=E)+(B&(I^Z)^Z)|0)<<17|E>>>15)+B|0,x=(0|cr[e+13>>0])<<8|0|cr[e+12>>0]|(0|cr[e+14>>0])<<16|(0|cr[e+15>>0])<<24,x=((x=Z+-1044525330+(ar[o>>2]=x)+(E&(B^I)^I)|0)<<22|x>>>10)+E|0,Y=(0|cr[e+17>>0])<<8|0|cr[e+16>>0]|(0|cr[e+18>>0])<<16|(0|cr[e+19>>0])<<24,Y=((Y=I+-176418897+(ar[a>>2]=Y)+(x&(E^B)^B)|0)<<7|Y>>>25)+x|0,I=(0|cr[e+21>>0])<<8|0|cr[e+20>>0]|(0|cr[e+22>>0])<<16|(0|cr[e+23>>0])<<24,I=((I=B+1200080426+(ar[c>>2]=I)+(Y&(x^E)^E)|0)<<12|I>>>20)+Y|0,B=(0|cr[e+25>>0])<<8|0|cr[e+24>>0]|(0|cr[e+26>>0])<<16|(0|cr[e+27>>0])<<24,B=((B=E+-1473231341+(ar[l>>2]=B)+(I&(Y^x)^x)|0)<<17|B>>>15)+I|0,E=(0|cr[e+29>>0])<<8|0|cr[e+28>>0]|(0|cr[e+30>>0])<<16|(0|cr[e+31>>0])<<24,E=((E=x+-45705983+(ar[u>>2]=E)+(B&(I^Y)^Y)|0)<<22|E>>>10)+B|0,x=(0|cr[e+33>>0])<<8|0|cr[e+32>>0]|(0|cr[e+34>>0])<<16|(0|cr[e+35>>0])<<24,x=((x=Y+1770035416+(ar[s>>2]=x)+(E&(B^I)^I)|0)<<7|x>>>25)+E|0,Y=(0|cr[e+37>>0])<<8|0|cr[e+36>>0]|(0|cr[e+38>>0])<<16|(0|cr[e+39>>0])<<24,I=((I=(ar[b>>2]=Y)+-1958414417+I+(x&(E^B)^B)|0)<<12|I>>>20)+x|0,Y=(0|cr[e+41>>0])<<8|0|cr[e+40>>0]|(0|cr[e+42>>0])<<16|(0|cr[e+43>>0])<<24,B=((B=(ar[d>>2]=Y)+-42063+B+(I&(x^E)^E)|0)<<17|B>>>15)+I|0,Y=(0|cr[e+45>>0])<<8|0|cr[e+44>>0]|(0|cr[e+46>>0])<<16|(0|cr[e+47>>0])<<24,E=((E=(ar[k>>2]=Y)+-1990404162+E+(B&(I^x)^x)|0)<<22|E>>>10)+B|0,Y=(0|cr[e+49>>0])<<8|0|cr[e+48>>0]|(0|cr[e+50>>0])<<16|(0|cr[e+51>>0])<<24,x=((x=(ar[h>>2]=Y)+1804603682+x+(E&(B^I)^I)|0)<<7|x>>>25)+E|0,Y=(0|cr[e+53>>0])<<8|0|cr[e+52>>0]|(0|cr[e+54>>0])<<16|(0|cr[e+55>>0])<<24,I=((I=(ar[w>>2]=Y)+-40341101+I+(x&(E^B)^B)|0)<<12|I>>>20)+x|0,Y=(0|cr[e+57>>0])<<8|0|cr[e+56>>0]|(0|cr[e+58>>0])<<16|(0|cr[e+59>>0])<<24,B=((B=(ar[v>>2]=Y)+-1502002290+B+(I&(x^E)^E)|0)<<17|B>>>15)+I|0,Y=(0|cr[e+61>>0])<<8|0|cr[e+60>>0]|(0|cr[e+62>>0])<<16|(0|cr[e+63>>0])<<24,E=((E=(ar[i>>2]=Y)+1236535329+E+(B&(I^x)^x)|0)<<22|E>>>10)+B|0,x=((x=(D=0|ar[n>>2])+-165796510+x+((E^B)&I^B)|0)<<5|x>>>27)+E|0,I=((I=(R=0|ar[l>>2])+-1069501632+I+((x^E)&B^E)|0)<<9|I>>>23)+x|0,B=((B=(_=0|ar[k>>2])+643717713+B+((I^x)&E^x)|0)<<14|B>>>18)+I|0,E=((E=(H=0|ar[f>>2])+-373897302+E+((B^I)&x^I)|0)<<20|E>>>12)+B|0,x=((x=(S=0|ar[c>>2])+-701558691+x+((E^B)&I^B)|0)<<5|x>>>27)+E|0,B=((B=Y+-660478335+B+(((I=((I=(Q=0|ar[d>>2])+38016083+I+((x^E)&B^E)|0)<<9|I>>>23)+x|0)^x)&E^x)|0)<<14|B>>>18)+I|0,E=((E=(F=0|ar[a>>2])+-405537848+E+((B^I)&x^I)|0)<<20|E>>>12)+B|0,x=((x=(V=0|ar[b>>2])+568446438+x+((E^B)&I^B)|0)<<5|x>>>27)+E|0,I=((I=(U=0|ar[v>>2])+-1019803690+I+((x^E)&B^E)|0)<<9|I>>>23)+x|0,B=((B=(T=0|ar[o>>2])+-187363961+B+((I^x)&E^x)|0)<<14|B>>>18)+I|0,E=((E=(J=0|ar[s>>2])+1163531501+E+((B^I)&x^I)|0)<<20|E>>>12)+B|0,x=((x=(N=0|ar[w>>2])+-1444681467+x+((E^B)&I^B)|0)<<5|x>>>27)+E|0,I=((I=(X=0|ar[t>>2])+-51403784+I+((x^E)&B^E)|0)<<9|I>>>23)+x|0,G=(B=((B=(O=0|ar[u>>2])+1735328473+B+((I^x)&E^x)|0)<<14|B>>>18)+I|0)^I,A=(G=((G=F+-145523070+(G=((G=J+1873313359+(G=((G=(M=0|ar[h>>2])+1700485571+(G=((G=H+-198630844+(G=((G=V+-640364487+(G=((G=N+681279174+(G=((G=D+-1530992060+(G=((G=S+-378558+x+(G^(E=((E=M+-1926607734+E+(G&x^I)|0)<<20|E>>>12)+B|0))|0)<<4|G>>>28)+E|0)+((B=((B=_+1839030562+B+(G^E^(I=((I=J+-2022574463+I+(E^B^G)|0)<<11|I>>>21)+G|0))|0)<<16|B>>>16)+I|0)^I^(E=((E=U+-35309556+E+(I^G^B)|0)<<23|E>>>9)+B|0))|0)<<4|G>>>28)+E|0)+((B=((B=O+-155497632+B+(G^E^(I=((I=F+1272893353+I+(E^B^G)|0)<<11|I>>>21)+G|0))|0)<<16|B>>>16)+I|0)^I^(E=((E=Q+-1094730640+E+(I^G^B)|0)<<23|E>>>9)+B|0))|0)<<4|G>>>28)+E|0)+((B=((B=T+-722521979+B+(G^E^(I=((I=H+-358537222+I+(E^B^G)|0)<<11|I>>>21)+G|0))|0)<<16|B>>>16)+I|0)^I^(E=((E=R+76029189+E+(I^G^B)|0)<<23|E>>>9)+B|0))|0)<<4|G>>>28)+E|0)+(((E=((E=X+-995338651+E+((I=((I=M+-421815835+I+(E^B^G)|0)<<11|I>>>21)+G|0)^G^(B=((B=Y+530742520+B+(G^E^I)|0)<<16|B>>>16)+I|0))|0)<<23|E>>>9)+B|0)|~I)^B)|0)<<6|G>>>26)+E|0)+(((E=((E=S+-57434055+E+(((B=((B=U+-1416354905+B+(((I=((I=O+1126891415+I+((G|~B)^E)|0)<<10|I>>>22)+G|0)|~E)^G)|0)<<15|B>>>17)+I|0)|~G)^I)|0)<<21|E>>>11)+B|0)|~I)^B)|0)<<6|G>>>26)+E|0)+(((E=((E=D+-2054922799+E+(((B=((B=Q+-1051523+B+(((I=((I=T+-1894986606+I+((G|~B)^E)|0)<<10|I>>>22)+G|0)|~E)^G)|0)<<15|B>>>17)+I|0)|~G)^I)|0)<<21|E>>>11)+B|0)|~I)^B)|0)<<6|G>>>26)+E|0)+(((E=((E=N+1309151649+E+(((B=((B=R+-1560198380+B+(((I=((I=Y+-30611744+I+((G|~B)^E)|0)<<10|I>>>22)+G|0)|~E)^G)|0)<<15|B>>>17)+I|0)|~G)^I)|0)<<21|E>>>11)+B|0)|~I)^B)|0)<<6|G>>>26)+E|0)+A|0,Z=(B=((B=X+718787259+B+(((I=((I=_+-1120210379+I+((G|~B)^E)|0)<<10|I>>>22)+G|0)|~E)^G)|0)<<15|B>>>17)+I|0)+Z+((E=V+-343485551+E+((B|~G)^I)|0)<<21|E>>>11)|0,W=B+W|0,C=I+C|0,e=e+64|0,0!=(0|(r=r+-64|0)););return ar[g>>2]=A,ar[m>>2]=Z,ar[p>>2]=W,ar[y>>2]=C,0|e}function Qo(A,e){A|=0;var r=0,i=0,f=0;r=(i=63&ar[(e|=0)>>2])+1|0,tr[e+24+i>>0]=-128,f=e+24|0,(i^=63)>>>0<8?(Vu(e+24+r|0,0,0|i),Do(e,f,64),i=56,r=0):i=i+-8|0,Vu(e+24+r|0,0,0|i),r=(i=0|ar[e>>2])<<3,ar[e>>2]=r,tr[e+80>>0]=r,tr[e+81>>0]=i>>>5,tr[e+82>>0]=i>>>13,tr[e+83>>0]=i>>>21,i=0|ar[e+4>>2],tr[e+84>>0]=i,tr[e+85>>0]=i>>>8,tr[e+86>>0]=i>>>16,tr[e+87>>0]=i>>>24,Do(e,f,64),f=e+8|0,tr[A>>0]=ar[f>>2],tr[A+1>>0]=(0|ar[f>>2])>>>8,tr[A+2>>0]=(0|ar[f>>2])>>>16,tr[A+3>>0]=(0|ar[f>>2])>>>24,f=e+12|0,tr[A+4>>0]=ar[f>>2],tr[A+5>>0]=(0|ar[f>>2])>>>8,tr[A+6>>0]=(0|ar[f>>2])>>>16,tr[A+7>>0]=(0|ar[f>>2])>>>24,f=e+16|0,tr[A+8>>0]=ar[f>>2],tr[A+9>>0]=(0|ar[f>>2])>>>8,tr[A+10>>0]=(0|ar[f>>2])>>>16,tr[A+11>>0]=(0|ar[f>>2])>>>24,f=e+20|0,tr[A+12>>0]=ar[f>>2],tr[A+13>>0]=(0|ar[f>>2])>>>8,tr[A+14>>0]=(0|ar[f>>2])>>>16,tr[A+15>>0]=(0|ar[f>>2])>>>24,Vu(0|e,0,152)}function To(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0;var b,d,k,h,w,v,g,m,p,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;if(ur=(p=ur)+20448|0,d=(B=p)+9088|0,k=3&(r|=0),h=3&(i|=0),m=(r>>2)+(f|=0)|0,g=(i>>2)+(n|=0)|0,Z=14-(0|ar[(e|=0)+4996>>2])|0,v=0|ar[e+484>>2],w=0|ar[e+488>>2],3&(i|r)){if(Z=0|ar[8112+(k<<2)>>2],n=0|ar[8128+(k<<2)>>2],b=0|ar[8112+(h<<2)>>2],f=0|ar[8128+(h<<2)>>2],y=0-Z|0,-1<(g-b|m-Z|0)&&(m+l+n|0)<(0|v)&&(g+u+f|0)<(0|w))f=a+((0|sr(g,n=c))+m<<1)|0;else{if((0|(e=0-b|0))<(0|(i=f+u|0))&&(W=v-1|0,I=w-1|0,(0|y)<(0|(C=n+l|0))))do{for(n=0|sr((0|(n=e+g|0))<0?0:(0|n)<(0|w)?n:I,c),r=(80*(e+b|0)|0)+Z|0,f=y;E=f+m|0,or[d+(r+f<<1)>>1]=0|or[a+(((0|E)<0?0:(0|E)<(0|v)?E:W)+n<<1)>>1],(0|(f=f+1|0))!=(0|C););e=e+1|0}while((0|e)!=(0|i));f=d+(((n=80)*b|0)+Z<<1)|0}(0|s)<9?ms[31&ar[A+220+(k<<4)+(h<<2)>>2]](t,o,f,n,l,u,B):ps[31&ar[A+300+(k<<4)+(h<<2)>>2]](t,o,f,n,l,u,B,s),ur=p}else{if(!((g|m|0)<0|(0|v)<(m+l|0)|(0|w)<(g+u|0)))return f=a+((0|sr(g,c))+m<<1)|0,(0|s)<9?ms[31&ar[A+220>>2]](t,o,f,c,l,u,B):ps[31&ar[A+300>>2]](t,o,f,c,l,u,B,s),void(ur=p);if((0|u)<=0)return void(ur=p);if(e=v-1|0,r=w-1|0,!(0<(0|l)))return void(ur=p);f=0;do{for(i=0|sr((0|(i=f+g|0))<0?0:(0|i)<(0|w)?i:r,c),y=0|sr(f,o),n=0;B=n+m|0,or[t+(n+y<<1)>>1]=(0|lr[a+(((0|B)<0?0:(0|B)<(0|v)?B:e)+i<<1)>>1])<<Z,(0|(n=n+1|0))!=(0|l););f=f+1|0}while((0|f)!=(0|u));ur=p}}function Mo(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0;var b,d,k,h,w,v,g,m,p,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;if(ur=(p=ur)+14768|0,d=(B=p)+9088|0,k=3&(r|=0),h=3&(i|=0),m=(r>>2)+(f|=0)|0,g=(i>>2)+(n|=0)|0,Z=14-(0|ar[(e|=0)+4996>>2])|0,v=0|ar[e+484>>2],w=0|ar[e+488>>2],3&(i|r)){if(Z=0|ar[8112+(k<<2)>>2],n=0|ar[8128+(k<<2)>>2],b=0|ar[8112+(h<<2)>>2],f=0|ar[8128+(h<<2)>>2],y=0-Z|0,-1<(g-b|m-Z|0)&&(m+l+n|0)<(0|v)&&(g+u+f|0)<(0|w))f=a+((0|sr(g,n=c))+m)|0;else{if((0|(e=0-b|0))<(0|(i=f+u|0))&&(W=v-1|0,I=w-1|0,(0|y)<(0|(C=n+l|0))))do{for(n=0|sr((0|(n=e+g|0))<0?0:(0|n)<(0|w)?n:I,c),r=(80*(e+b|0)|0)+Z|0,f=y;E=f+m|0,tr[d+(r+f)>>0]=0|tr[a+(((0|E)<0?0:(0|E)<(0|v)?E:W)+n)>>0],(0|(f=f+1|0))!=(0|C););e=e+1|0}while((0|e)!=(0|i));f=d+(((n=80)*b|0)+Z)|0}(0|s)<9?ms[31&ar[A+220+(k<<4)+(h<<2)>>2]](t,o,f,n,l,u,B):ps[31&ar[A+300+(k<<4)+(h<<2)>>2]](t,o,f,n,l,u,B,s),ur=p}else{if(!((g|m|0)<0|(0|v)<(m+l|0)|(0|w)<(g+u|0)))return f=a+((0|sr(g,c))+m)|0,(0|s)<9?ms[31&ar[A+220>>2]](t,o,f,c,l,u,B):ps[31&ar[A+300>>2]](t,o,f,c,l,u,B,s),void(ur=p);if((0|u)<=0)return void(ur=p);if(e=v-1|0,r=w-1|0,!(0<(0|l)))return void(ur=p);f=0;do{for(i=0|sr((0|(i=f+g|0))<0?0:(0|i)<(0|w)?i:r,c),y=0|sr(f,o),n=0;B=n+m|0,or[t+(n+y<<1)>>1]=(0|cr[a+(((0|B)<0?0:(0|B)<(0|v)?B:e)+i)>>0])<<Z,(0|(n=n+1|0))!=(0|l););f=f+1|0}while((0|f)!=(0|u));ur=p}}function So(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0;var b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;if(g=ur=(v=ur)+31&-32,ur=ur+19808|0,g=(k=g)+9088|0,Z=14-(0|ar[(e|=0)+5004>>2])|0,W=0|ar[e+5016>>2],w=(0|ar[e+484>>2])/(0|W)|0,C=0|ar[e+5020>>2],h=(0|ar[e+488>>2])/(0|C)|0,b=7&(r=0|sr(2/(0|W)|0,r)),d=7&(i=0|sr(2/(0|C)|0,i)),W=((0|f)/(0|W)|0)+(r>>3)|0,C=((0|n)/(0|C)|0)+(i>>3)|0,7&(i|r)){if(0<(0|W)&&(W+l|0)<=(w-2|0)&0<(0|C)&&(C+u|0)<=(h-2|0))f=a+((0|sr(C,c))+W<<1)|0,e=c;else{if(-1<(0|(i=u+2|0))&&(p=w-1|0,y=h-1|0,-1<(0|(m=l+2|0)))){r=-1;do{for(f=0|sr((0|(f=r+C|0))<0?0:(0|f)<(0|h)?f:y,c),n=80+(80*r|0)|0,e=-1;Z=e+W|0,or[g+(n+(e=e+1|0)<<1)>>1]=0|or[a+(((0|Z)<0?0:(0|Z)<(0|w)?Z:p)+f<<1)>>1],(0|e)!=(0|m););r=r+1|0}while((0|r)!=(0|i))}f=g+162|0,e=80}r=0!=(0|b),i=0!=(0|d);do{if(r&i){if((0|s)<9){Zs[7&ar[A+216>>2]](t,o,f,e,l,u,b,d,k,s);break}Zs[7&ar[A+296>>2]](t,o,f,e,l,u,b,d,k,s);break}if(r){if((0|s)<9){Zs[7&ar[A+208>>2]](t,o,f,e,l,u,b,d,k,s);break}Zs[7&ar[A+288>>2]](t,o,f,e,l,u,b,d,k,s);break}if(i||br(49065,41754,268,41798),(0|s)<9){Zs[7&ar[A+212>>2]](t,o,f,e,l,u,0,d,k,s);break}Zs[7&ar[A+292>>2]](t,o,f,e,l,u,0,d,k,s);break}while(0);ur=v}else{if(-1<(0|W)&&!((0|C)<0|(0|w)<(W+l|0)|(0|h)<(C+u|0)))return e=a+((0|sr(C,c))+W<<1)|0,(0|s)<9?ys[3&ar[A+204>>2]](t,o,e,c,l,u,0,0,0):Zs[7&ar[A+284>>2]](t,o,e,c,l,u,0,0,0,s),void(ur=v);if((0|u)<=0)return void(ur=v);if(i=w-1|0,f=h-1|0,!(0<(0|l)))return void(ur=v);r=0;do{for(n=0|sr((0|(n=r+C|0))<0?0:(0|n)<(0|h)?n:f,c),g=0|sr(r,o),e=0;s=e+W|0,or[t+(e+g<<1)>>1]=(0|lr[a+(((0|s)<0?0:(0|s)<(0|w)?s:i)+n<<1)>>1])<<Z,(0|(e=e+1|0))!=(0|l););r=r+1|0}while((0|r)!=(0|u));ur=v}}function Uo(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0;var b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;if(g=ur=(v=ur)+31&-32,ur=ur+14448|0,g=(k=g)+9088|0,Z=14-(0|ar[(e|=0)+5004>>2])|0,W=0|ar[e+5016>>2],w=(0|ar[e+484>>2])/(0|W)|0,C=0|ar[e+5020>>2],h=(0|ar[e+488>>2])/(0|C)|0,b=7&(r=0|sr(2/(0|W)|0,r)),d=7&(i=0|sr(2/(0|C)|0,i)),W=((0|f)/(0|W)|0)+(r>>3)|0,C=((0|n)/(0|C)|0)+(i>>3)|0,7&(i|r)){if(0<(0|W)&&(W+l|0)<=(w-2|0)&0<(0|C)&&(C+u|0)<=(h-2|0))f=a+((0|sr(C,c))+W)|0,e=c;else{if(-1<(0|(i=u+2|0))&&(p=w-1|0,y=h-1|0,-1<(0|(m=l+2|0)))){r=-1;do{for(f=0|sr((0|(f=r+C|0))<0?0:(0|f)<(0|h)?f:y,c),n=80+(80*r|0)|0,e=-1;Z=e+W|0,tr[g+(n+(e=e+1|0))>>0]=0|tr[a+(((0|Z)<0?0:(0|Z)<(0|w)?Z:p)+f)>>0],(0|e)!=(0|m););r=r+1|0}while((0|r)!=(0|i))}f=g+81|0,e=80}r=0!=(0|b),i=0!=(0|d);do{if(r&i){if((0|s)<9){Zs[7&ar[A+216>>2]](t,o,f,e,l,u,b,d,k,s);break}Zs[7&ar[A+296>>2]](t,o,f,e,l,u,b,d,k,s);break}if(r){if((0|s)<9){Zs[7&ar[A+208>>2]](t,o,f,e,l,u,b,d,k,s);break}Zs[7&ar[A+288>>2]](t,o,f,e,l,u,b,d,k,s);break}if(i||br(49065,41754,268,41798),(0|s)<9){Zs[7&ar[A+212>>2]](t,o,f,e,l,u,0,d,k,s);break}Zs[7&ar[A+292>>2]](t,o,f,e,l,u,0,d,k,s);break}while(0);ur=v}else{if(-1<(0|W)&&!((0|C)<0|(0|w)<(W+l|0)|(0|h)<(C+u|0)))return e=a+((0|sr(C,c))+W)|0,(0|s)<9?ys[3&ar[A+204>>2]](t,o,e,c,l,u,0,0,0):Zs[7&ar[A+284>>2]](t,o,e,c,l,u,0,0,0,s),void(ur=v);if((0|u)<=0)return void(ur=v);if(i=w-1|0,f=h-1|0,!(0<(0|l)))return void(ur=v);r=0;do{for(n=0|sr((0|(n=r+C|0))<0?0:(0|n)<(0|h)?n:f,c),g=0|sr(r,o),e=0;s=e+W|0,or[t+(e+g<<1)>>1]=(0|cr[a+(((0|s)<0?0:(0|s)<(0|w)?s:i)+n)>>0])<<Z,(0|(e=e+1|0))!=(0|l););r=r+1|0}while((0|r)!=(0|u));ur=v}}function Oo(A,e,r,i,f,n,t,o,a,c,l,u){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0;var s,b=0,d=0,k=0,h=0,w=0;if(0|fs[63&ar[12+(0|ar[(A|=0)>>2])>>2]](A,n)||br(41907,41754,1074,41930),s=0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,n),(0|ar[24+s>>2])>(0|t)&&(0|ar[28+s>>2])>(0|o)){if(i=t>>(f=0|ar[10368+s>>2]),f=o>>f,(0|i)<=-1&&br(41808,41845,118,41865),(0|(n=0|ar[10372+s>>2]))<=(0|i)&&br(41808,41845,118,41865),(0|f)<=-1&&br(41869,41845,119,41865),(0|f)>=(0|ar[10376+s>>2])&&br(41869,41845,119,41865),w=(0|ar[10360+s>>2])+(3*((0|sr(n,f))+i|0)|0)|0,!(768&(cr[w>>0]|cr[w+1>>0]<<8)))return or[l>>1]=0,or[l+2>>1]=0,void(tr[u>>0]=0);if(1==(0|tr[10516+s>>0]))return or[l>>1]=0,or[l+2>>1]=0,void(tr[u>>0]=0);if(i=t>>(f=0|ar[10388+s>>2]),f=o>>f,(0|i)<=-1&&br(41808,41845,118,41865),(0|(n=0|ar[10392+s>>2]))<=(0|i)&&br(41808,41845,118,41865),(0|f)<=-1&&br(41869,41845,119,41865),(0|f)>=(0|ar[10396+s>>2])&&br(41869,41845,119,41865),w=0|ar[10380+s>>2],h=(0|sr(n,f))+i|0,0|tr[w+(12*h|0)>>0])if(0|tr[w+(12*h|0)+1>>0]){if(b=0|ar[e+92>>2],0<(0|ar[(n=r+332|0)>>2]))for(f=0;i=92+(0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+980+(f<<2)>>2]))|0,(i=(0|ar[i>>2])<=(0|b))&(0|(f=f+1|0))<(0|ar[n>>2]););else i=1;if(i&0<(0|ar[(n=r+328|0)>>2]))for(f=0;i=92+(0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(f<<2)>>2]))|0,(i=(0|ar[i>>2])<=(0|b))&(0|(f=f+1|0))<(0|ar[n>>2]););d=i?c:0|tr[r+372>>0]}else d=0;else d=1;return(k=lr[(k=w+(12*h|0)+4+(d<<2)|0)>>1]|lr[k+2>>1]<<16,b=0|tr[w+(12*h|0)+2+d>>0],n=t>>(i=0|ar[10348+s>>2]),i=o>>i,(0|n)<=-1&&br(41808,41845,118,41865),(0|(f=0|ar[10352+s>>2]))<=(0|n)&&br(41808,41845,118,41865),(0|i)<=-1&&br(41869,41845,119,41865),(0|i)>=(0|ar[10356+s>>2])&&br(41869,41845,119,41865),i=(0|ar[10340+s>>2])+(24*((0|sr(f,i))+n|0)|0)+2|0,i=0|ar[(0|ar[48+s>>2])+(lr[i>>1]<<2)>>2],(0|tr[(n=r+1300+(c<<4)+a|0)>>0])!=(0|tr[i+1300+(d<<4)+b>>0]))?(tr[u>>0]=0,or[l>>1]=0,void(or[l+2>>1]=0)):(tr[u>>0]=1,i=(0|ar[92+s>>2])-(0|ar[i+1044+(d<<6)+(b<<2)>>2])|0,f=(0|ar[e+92>>2])-(0|ar[r+1044+(c<<6)+(a<<2)>>2])|0,0!=(0|tr[n>>0])|(0|i)==(0|f)?(or[l>>1]=k,void(or[l+2>>1]=k>>>16)):(i=(0|i)<-128?-128:(0|i)<127?i:127)?(e=32+(0|sr((16384+(((0|i)<0?0-i|0:i)>>1)|0)/(0|i)|0,(0|f)<-128?-128:(0|f)<127?f:127))>>6,A=0|sr(e=(0|e)<-4096?-4096:(0|e)<4095?e:4095,k<<16>>16),A=0|sr(((c=(0|A)<0)?0-A|0:A)+127>>8,c?-1:0!=(0|A)&1),or[l>>1]=(0|A)<-32768?-32768:65535&((0|A)<32767?A:32767),e=0|sr(e,k>>16),e=0|sr(((A=(0|e)<0)?0-e|0:e)+127>>8,A?-1:0!=(0|e)&1),void(or[l+2>>1]=(0|e)<-32768?-32768:65535&((0|e)<32767?e:32767))):(or[l>>1]=k,or[l+2>>1]=k>>>16,Gr(A+4|0,1008,0),void(tr[e+10516>>0]=3)))}Gr(A+4|0,1026,0),tr[u>>0]=0}function Ho(A,e,r,i,f,n,t,o,a,c,l){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0;var u,s,b,d=0;if(!(0|tr[(r|=0)+324>>0]))return or[c>>1]=0,or[c+2>>1]=0,void(tr[l>>0]=0);if(b=0|ar[e+5804>>2],d=0|ar[r+20>>2]?0:0==(0|tr[r+372>>0])&1,d=0|ar[r+916+(d<<6)+(ar[r+376>>2]<<2)>>2],!(0|fs[63&ar[12+(0|ar[A>>2])>>2]](A,d)))return or[c>>1]=0,or[c+2>>1]=0,void Gr(A+4|(tr[l>>0]=0),1012,0);if(s=n+i|0,(f>>b|0)==((u=t+f|0)>>b|0)&&(0|s)<(0|ar[e+1248>>2])&&(0|u)<(0|ar[e+1252>>2])){if(Oo(A,e,r,0,0,d,-16&s,-16&u,o,a,c,l),0|tr[l>>0])return}else or[c>>1]=0,or[c+2>>1]=0,tr[l>>0]=0;Oo(A,e,r,0,0,d,(n>>1)+i&-16,(t>>1)+f&-16,o,a,c,l)}function xo(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,e|=0,n|=0,t|=0,a|=0,c|=0,l|=0,u|=0,s|=0;var b,d,k,h,w,v,g=0,m=0,p=0;if(m=ur=(v=ur)+31&-32,ur=ur+16|0,w=m+8|0,m=(g=m)+12|0,t=0|function(A,e,r,i,f,n,t,o,a,c,l,u){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0;var s,b,d,k,h,w,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;w=0|ar[(A|=0)+10060>>2],t=e>>(g=0|ar[A+10368>>2]),g=r>>g,(0|t)<=-1&&br(41808,41845,118,41865),(0|(m=0|ar[A+10372>>2]))<=(0|t)&&br(41808,41845,118,41865),(0|g)<=-1&&br(41869,41845,119,41865),(0|g)>=(0|ar[A+10376>>2])&&br(41869,41845,119,41865),p=(0|ar[A+10360>>2])+(3*((0|sr(m,g))+t|0)|0)|0,p=(65535&(cr[p>>0]|cr[p+1>>0]<<8))>>>3,t=(d=a+n|0)-1|0,(h=(0|(b=f>>w))==((k=f+-1|0)>>w|0))&&(n>>w|0)==(t>>w|0)?v=E=0:W=9;A:do{if(9==(0|W)){if(1==(0|c))switch(7&p){case 2:case 6:case 7:v=E=0;break A}if(0|go(A,e,r,i,f,n,o,a,c,k,t)){if(t>>=I=0|ar[A+10388>>2],(0|(m=k>>I))<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[A+10392>>2]))<=(0|m)&&br(41808,41845,118,41865),(0|t)<=-1&&br(41869,41845,119,41865),(0|t)<(0|ar[A+10396>>2])){E=(0|ar[A+10380>>2])+(12*((0|sr(g,t))+m|0)|0)|0,or[l>>1]=0|or[E>>1],or[l+2>>1]=0|or[E+2>>1],or[l+4>>1]=0|or[E+4>>1],or[l+6>>1]=0|or[E+6>>1],or[l+8>>1]=0|or[E+8>>1],or[l+10>>1]=0|or[E+10>>1],v=E=1;break}br(41869,41845,119,41865)}else v=E=0}}while(0);if((0|u)<=(0|v))return 0|(l=v);I=n+-1|0,(0|b)==((t=(s=o+f|0)-1|0)>>w|0)&&(n>>w|0)==(I>>w|0)?C=y=0:W=22;A:do{if(22==(0|W)){if(1==(0|c))switch(7&p){case 1:case 4:case 5:C=y=0;break A}if(0|go(A,e,r,i,f,n,o,a,c,t,I)){t>>=g=0|ar[A+10388>>2],g=I>>g,(0|t)<=-1&&br(41808,41845,118,41865),(0|(m=0|ar[A+10392>>2]))<=(0|t)&&br(41808,41845,118,41865),(0|g)<=-1&&br(41869,41845,119,41865),(0|g)>=(0|ar[A+10396>>2])&&br(41869,41845,119,41865),t=(p=0|ar[A+10380>>2])+(12*(m=(0|sr(m,g))+t|0)|0)|0;do{if(E&&(y=0|tr[l>>0])<<24>>24==(0|tr[t>>0])){if(y<<24>>24){if((0|or[l+4>>1])!=(0|or[p+(12*m|0)+4>>1]))break;if((0|or[l+6>>1])!=(0|or[p+(12*m|0)+6>>1]))break;if((0|tr[l+2>>0])!=(0|tr[p+(12*m|0)+2>>0]))break}if((g=0|tr[l+1>>0])<<24>>24==(0|tr[p+(12*m|0)+1>>0])){if(!(g<<24>>24)){y=1,C=0;break A}if((0|or[l+8>>1])!=(0|or[p+(12*m|0)+8>>1]))break;if((0|or[l+10>>1])!=(0|or[p+(12*m|0)+10>>1]))break;if((0|tr[l+3>>0])==(0|tr[p+(12*m|0)+3>>0])){y=1,C=0;break A}}}}while(0);or[(y=l+(12*v|0)|0)>>1]=0|or[t>>1],or[y+2>>1]=0|or[t+2>>1],or[y+4>>1]=0|or[t+4>>1],or[y+6>>1]=0|or[t+6>>1],or[y+8>>1]=0|or[t+8>>1],or[y+10>>1]=0|or[t+10>>1],v=(C=v)+(y=1)|0}else C=y=0}}while(0);if((0|u)<=(0|v))return 0|(l=v);(0|b)==(s>>w|0)&&(n>>w|0)==(I>>w|0)||(W=47);A:do{if(47==(0|W)&&0|go(A,e,r,i,f,n,o,a,c,s,I)){t=s>>(g=0|ar[A+10388>>2]),g=I>>g,(0|t)<=-1&&br(41808,41845,118,41865),(0|(m=0|ar[A+10392>>2]))<=(0|t)&&br(41808,41845,118,41865),(0|g)<=-1&&br(41869,41845,119,41865),(0|g)>=(0|ar[A+10396>>2])&&br(41869,41845,119,41865),t=(p=0|ar[A+10380>>2])+(12*(m=(0|sr(m,g))+t|0)|0)|0;do{if(y&&(Z=0|tr[l+(12*C|0)>>0])<<24>>24==(0|tr[t>>0])){if(Z<<24>>24){if((0|or[l+(12*C|0)+4>>1])!=(0|or[p+(12*m|0)+4>>1]))break;if((0|or[l+(12*C|0)+6>>1])!=(0|or[p+(12*m|0)+6>>1]))break;if((0|tr[l+(12*C|0)+2>>0])!=(0|tr[p+(12*m|0)+2>>0]))break}if((g=0|tr[l+(12*C|0)+1>>0])<<24>>24==(0|tr[p+(12*m|0)+1>>0])){if(!(g<<24>>24))break A;if((0|or[l+(12*C|0)+8>>1])!=(0|or[p+(12*m|0)+8>>1]))break;if((0|or[l+(12*C|0)+10>>1])!=(0|or[p+(12*m|0)+10>>1]))break;if((0|tr[l+(12*C|0)+3>>0])==(0|tr[p+(12*m|0)+3>>0]))break A}}}while(0);or[(Z=l+(12*v|0)|0)>>1]=0|or[t>>1],or[Z+2>>1]=0|or[t+2>>1],or[Z+4>>1]=0|or[t+4>>1],or[Z+6>>1]=0|or[t+6>>1],or[Z+8>>1]=0|or[t+8>>1],or[Z+10>>1]=0|or[t+10>>1],v=v+1|0}}while(0);if((0|u)<=(0|v))return 0|(l=v);h&&(n>>w|0)==(d>>w|0)||(W=70);A:do{if(70==(0|W)&&0|go(A,e,r,i,f,n,o,a,c,k,d)){m=k>>(t=0|ar[A+10388>>2]),t=d>>t,(0|m)<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[A+10392>>2]))<=(0|m)&&br(41808,41845,118,41865),(0|t)<=-1&&br(41869,41845,119,41865),(0|t)>=(0|ar[A+10396>>2])&&br(41869,41845,119,41865),t=(p=0|ar[A+10380>>2])+(12*(m=(0|sr(g,t))+m|0)|0)|0;do{if(E&&(B=0|tr[l>>0])<<24>>24==(0|tr[t>>0])){if(B<<24>>24){if((0|or[l+4>>1])!=(0|or[p+(12*m|0)+4>>1]))break;if((0|or[l+6>>1])!=(0|or[p+(12*m|0)+6>>1]))break;if((0|tr[l+2>>0])!=(0|tr[p+(12*m|0)+2>>0]))break}if((g=0|tr[l+1>>0])<<24>>24!=(0|tr[p+(12*m|0)+1>>0]))break;if(!(g<<24>>24))break A;if((0|or[l+8>>1])!=(0|or[p+(12*m|0)+8>>1]))break;if((0|or[l+10>>1])!=(0|or[p+(12*m|0)+10>>1]))break;if((0|tr[l+3>>0])==(0|tr[p+(12*m|0)+3>>0]))break A}}while(0);or[(B=l+(12*v|0)|0)>>1]=0|or[t>>1],or[B+2>>1]=0|or[t+2>>1],or[B+4>>1]=0|or[t+4>>1],or[B+6>>1]=0|or[t+6>>1],or[B+8>>1]=0|or[t+8>>1],or[B+10>>1]=0|or[t+10>>1],v=v+1|0}}while(0);if((0|u)<=(0|v)|4==(0|v))return 0|(l=v);if(h&&(n>>w|0)==(I>>w|0))return 0|(l=v);if(!(0|go(A,e,r,i,f,n,o,a,c,k,I)))return 0|(l=v);m=k>>(t=0|ar[A+10388>>2]),t=I>>t,(0|m)<=-1&&br(41808,41845,118,41865),(0|(g=0|ar[A+10392>>2]))<=(0|m)&&br(41808,41845,118,41865),(0|t)<=-1&&br(41869,41845,119,41865),(0|t)>=(0|ar[A+10396>>2])&&br(41869,41845,119,41865),t=(p=0|ar[A+10380>>2])+(12*(m=(0|sr(g,t))+m|0)|0)|0;do{if(y){if((g=0|tr[l+(12*C|0)>>0])<<24>>24!=(0|tr[t>>0]))break;if(g<<24>>24){if((0|or[l+(12*C|0)+4>>1])!=(0|or[p+(12*m|0)+4>>1]))break;if((0|or[l+(12*C|0)+6>>1])!=(0|or[p+(12*m|0)+6>>1]))break;if((0|tr[l+(12*C|0)+2>>0])!=(0|tr[p+(12*m|0)+2>>0]))break}if((g=0|tr[l+(12*C|0)+1>>0])<<24>>24!=(0|tr[p+(12*m|0)+1>>0]))break;if(!(g<<24>>24))return 0|(l=v);if((0|or[l+(12*C|0)+8>>1])!=(0|or[p+(12*m|0)+8>>1]))break;if((0|or[l+(12*C|0)+10>>1])!=(0|or[p+(12*m|0)+10>>1]))break;if((0|tr[l+(12*C|0)+3>>0])!=(0|tr[p+(12*m|0)+3>>0]))break;return 0|v}}while(0);do{if(E){if((g=0|tr[l>>0])<<24>>24!=(0|tr[t>>0]))break;if(g<<24>>24){if((0|or[l+4>>1])!=(0|or[p+(12*m|0)+4>>1]))break;if((0|or[l+6>>1])!=(0|or[p+(12*m|0)+6>>1]))break;if((0|tr[l+2>>0])!=(0|tr[p+(12*m|0)+2>>0]))break}if((g=0|tr[l+1>>0])<<24>>24!=(0|tr[p+(12*m|0)+1>>0]))break;if(!(g<<24>>24))return 0|(l=v);if((0|or[l+8>>1])!=(0|or[p+(12*m|0)+8>>1]))break;if((0|or[l+10>>1])!=(0|or[p+(12*m|0)+10>>1]))break;if((0|tr[l+3>>0])!=(0|tr[p+(12*m|0)+3>>0]))break;return 0|v}}while(0);return or[(l=l+(12*v|0)|0)>>1]=0|or[t>>1],or[l+2>>1]=0|or[t+2>>1],or[l+4>>1]=0|or[t+4>>1],or[l+6>>1]=0|or[t+6>>1],or[l+8>>1]=0|or[t+8>>1],or[l+10>>1]=0|or[t+10>>1],0|(l=v+1|0)}(r|=0,i|=0,f|=0,o|=0,n=(p=8==(0|o)?2<(0|ar[r+10060>>2]):0)?i:n,b=p?f:t,0,d=p?o:a,k=p?o:c,p?0:l,s,h=u+1|0),(0|u)<(0|(ar[w>>2]=t))?i=e+20|0:(Ho(A,r,e,n,b,d,k,0,0,g,m),c=0|tr[m>>0],(tr[(a=m+1|0)>>0]=0)|ar[(i=e+20|0)>>2]?a=0:(Ho(A,r,e,n,b,d,k,0,1,g+4|0,a),c|=a=0|tr[a>>0]),c<<24>>24&&(ar[w>>2]=t+1,p=s+(12*t|0)+4|0,r=0|ar[g>>2],or[p>>1]=r,or[p+2>>1]=r>>>16,p=s+(12*t|0)+8|0,g=0|ar[g+4>>2],or[p>>1]=g,or[p+2>>1]=g>>>16,tr[s+(12*t|0)>>0]=0|tr[m>>0],tr[s+(12*t|0)+1>>0]=a,tr[s+(12*t|0)+2>>0]=0,tr[s+(12*t|0)+3>>0]=0)),(c=0|ar[i>>2])||(function(A,e,r,i,f){A|=0,e|=0,r|=0,f|=0;var n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;if(1<(0|(n=0|ar[(i|=0)>>2]))&(0|n)<(0|f)){for(t=0|sr(n-1|0,n),u=0;;){if(!((0|(s=0|ar[8144+(u<<2)>>2]))<(0|n)&(0|(b=0|ar[8192+(u<<2)>>2]))<(0|n))){o=4;break}if(d=0|tr[(o=r+(12*s|0)|0)>>0]?0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[e+916+(tr[r+(12*s|0)+2>>0]<<2)>>2]):0,k=0|tr[(a=r+(12*b|0)+1|0)>>0]?0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[e+980+(tr[r+(12*b|0)+3>>0]<<2)>>2]):0,!(0!=(0|d)|(l=(c=0|tr[o>>0])<<24>>24==0))){o=18;break}if(!(0!=(0|k)|(a=(o=0|tr[a>>0])<<24>>24==0))){o=18;break}do{if(!(l|a)){if((0|ar[d+92>>2])==(0|ar[k+92>>2])&&(0|or[r+(12*s|0)+4>>1])==(0|or[r+(12*b|0)+8>>1])&&(0|or[r+(12*s|0)+6>>1])==(0|or[r+(12*b|0)+10>>1]))break;k=0|ar[i>>2],tr[r+(12*k|0)+2>>0]=0|tr[r+(12*s|0)+2>>0],tr[r+(12*k|0)+3>>0]=0|tr[r+(12*b|0)+3>>0],tr[r+(12*k|0)>>0]=c,tr[r+(12*k|0)+1>>0]=o,d=r+(12*k|0)+4|0,s=lr[(s=r+(12*s|0)+4|0)>>1]|lr[s+2>>1]<<16,or[d>>1]=s,or[d+2>>1]=s>>>16,k=r+(12*k|0)+8|0,d=lr[(d=r+(12*b|0)+8|0)>>1]|lr[d+2>>1]<<16,or[k>>1]=d,or[k+2>>1]=d>>>16,ar[i>>2]=1+(0|ar[i>>2])}}while(0);if((0|(u=u+1|0))==(0|t)){o=18;break}if((0|ar[i>>2])==(0|f)){o=18;break}}if(4==(0|o))br(49065,41754,1360,41963);else if(18==(0|o));}}(A,e,s,w,h),c=0|ar[i>>2]),t=0|ar[(a=e+328|0)>>2],1!=(0|c)&&(t=0|ar[((0|t)<(0|ar[(p=e+332|0)>>2])?a:p)>>2]),(0|u)<(0|(a=0|ar[w>>2])))ur=v;else{for(l=0;n=1==(0|c),p=(0|l)<(0|t)?255&l:0,tr[s+(12*a|0)+2>>0]=p,tr[s+(12*a|0)+3>>0]=n?-1:p,tr[s+(12*a|0)>>0]=1,tr[s+(12*a|0)+1>>0]=1&(1^n),or[(p=n=s+(12*a|0)+4|0)>>1]=0,or[p+2>>1]=0,or[(n=n+4|0)>>1]=0,n=a+1|(or[n+2>>1]=0),!((0|u)<=(0|a));)l=l+1|0,c=0|ar[i>>2],a=n;ar[w>>2]=n,ur=v}}function jo(A,e,r,i,f,n,t,o,a,c,l,u,s,b){b|=0;var d,k=0,h=0,w=0,v=0,g=0;if(g=ur=(d=ur)+31&-32,ur=ur+32|0,v=g+16|0,function(A,e,r,i,f,n,t,o,a,c,l,u,s,b,d){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0,d|=0;var k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0;if(P=ur=(X=ur)+31&-32,ur=ur+48|0,v=P+32|0,g=P+24|0,m=P+44|0,E=P+12|0,P=(G=P)+40|0,p=(t|=0)+-1|(tr[(V=(b|=0)+1|0)>>0]=0),ar[v>>2]=p,z=c+o|0,ar[g>>2]=z,ar[4+v>>2]=p,L=z+-1|0,ar[4+g>>2]=L,tr[b>>0]=0,or[d>>1]=0,F=1&(z=(or[(U=d+2|0)>>1]=0)|go(e,i,f,n,t,o,a,c,s,p,z)),tr[m>>0]=F,L=0|go(e,i,f,n,t,o,a,c,s,p,L),tr[1+m>>0]=1&L,z|=L,L=r+916+(l<<6)+(u<<2)|0,_=0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[L>>2])){y=0|ar[_+92>>2],T=e+10368|0,k=e+10372|0,h=e+10376|0,w=e+10360|0,Z=1-l|0,C=e+10388|0,W=e+10392|0,I=e+10396|0,B=e+10380|0,D=-1,Q=0,_=F;A:for(;;){do{if(_<<24>>24!=0&&0==(0|tr[b>>0])){if(_=0|ar[v+(Q<<2)>>2],Y=0|ar[g+(Q<<2)>>2],F=_>>(N=0|ar[T>>2]),N=Y>>N,(0|F)<=-1){_=8;break A}if((0|(R=0|ar[k>>2]))<=(0|F)){_=8;break A}if((0|N)<=-1){_=11;break A}if((0|N)>=(0|ar[h>>2])){_=11;break A}if(j=(0|ar[w>>2])+(3*((0|sr(R,N))+F|0)|0)|0,768&(cr[j>>0]|cr[j+1>>0]<<8)){if(N=_>>(j=0|ar[C>>2]),_=Y>>j,(0|N)<=-1){_=15;break A}if((0|(F=0|ar[W>>2]))<=(0|N)){_=15;break A}if((0|_)<=-1){_=18;break A}if((0|_)>=(0|ar[I>>2])){_=18;break A}if(J=0|ar[B>>2],R=(0|sr(F,_))+N|0,_=0|tr[(Y=J+(12*R|0)+l|0)>>0]?0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(l<<6)+(tr[J+(12*R|0)+2+l>>0]<<2)>>2]):0,F=0|tr[(N=J+(12*R|0)+Z|0)>>0]?0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(Z<<6)+(tr[J+(12*R|0)+2+Z>>0]<<2)>>2]):0,0!=(0|_)&0!=(0|tr[Y>>0])&&(0|ar[_+92>>2])==(0|y)){tr[b>>0]=1,F=lr[(F=J+(12*R|0)+4+(l<<2)|0)>>1]|lr[F+2>>1]<<16,or[d>>1]=F,or[d+2>>1]=F>>>16,F=0|tr[J+(12*R|0)+2+l>>0];break}F=0!=(0|F)&0!=(0|tr[N>>0])&&(0|ar[F+92>>2])==(0|y)?(tr[b>>0]=1,F=lr[(F=J+(12*R|0)+4+(Z<<2)|0)>>1]|lr[F+2>>1]<<16,or[d>>1]=F,or[d+2>>1]=F>>>16,0|tr[J+(12*R|0)+2+Z>>0]):D}else F=D}else F=D}while(0);if(2<=(0|(_=Q+1|0))){_=3;break}D=F,_=0|tr[m+(Q=_)>>0]}if(3==(0|_)){O=r+1300+(l<<4)+u|0,H=e+92|0,x=A+4|0,j=e+10516|0,D=0,R=F;A:for(;;){if(0|tr[b>>0]){_=62;break}do{if(0|tr[m+D>>0]){if(_=0|ar[v+(D<<2)>>2],J=0|ar[g+(D<<2)>>2],F=_>>(N=0|ar[T>>2]),N=J>>N,(0|F)<=-1){_=35;break A}if((0|(Y=0|ar[k>>2]))<=(0|F)){_=35;break A}if((0|N)<=-1){_=38;break A}if((0|N)>=(0|ar[h>>2])){_=38;break A}if(u=(0|ar[w>>2])+(3*((0|sr(Y,N))+F|0)|0)|0,768&(cr[u>>0]|cr[u+1>>0]<<8)){if(N=_>>(u=0|ar[C>>2]),_=J>>u,(0|N)<=-1){_=42;break A}if((0|(F=0|ar[W>>2]))<=(0|N)){_=42;break A}if((0|_)<=-1){_=45;break A}if((0|_)>=(0|ar[I>>2])){_=45;break A}if(Y=0|ar[B>>2],_=(0|sr(F,_))+N|0,1==(0|tr[Y+(12*_|0)+l>>0])&&(M=Y+(12*_|0)+2+l|0,(0|tr[O>>0])==(0|tr[(0|tr[M>>0])+(r+1300+(l<<4))>>0]))){tr[b>>0]=1,F=lr[(F=Y+(12*_|0)+4+(l<<2)|0)>>1]|lr[F+2>>1]<<16,or[d>>1]=F,or[d+2>>1]=F>>>16,F=l,R=0|tr[M>>0];break}1==(0|tr[Y+(12*_|0)+Z>>0])&&(S=Y+(12*_|0)+2+Z|0,(0|tr[O>>0])==(0|tr[(0|tr[S>>0])+(r+1300+(Z<<4))>>0]))?(tr[b>>0]=1,F=lr[(F=Y+(12*_|0)+4+(Z<<2)|0)>>1]|lr[F+2>>1]<<16,or[d>>1]=F,or[d+2>>1]=F>>>16,F=Z,R=0|tr[S>>0]):F=-1}else F=-1}else F=-1}while(0);do{if(1==(0|tr[b>>0])){if((0|R)<0){_=61;break A}if((0|F)<=-1){_=55;break A}if(_=0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(F<<6)+(R<<2)>>2]),fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[L>>2]),!((tr[O>>0]|tr[r+1300+(F<<4)+R>>0])<<24>>24)){if(N=(F=0|ar[H>>2])-(0|ar[_+92>>2])|0,_=F-y|0,F=lr[d>>1]|lr[d+2>>1]<<16,N=(0|N)<-128?-128:(0|N)<127?N:127){u=32+(0|sr((16384+(((0|N)<0?0-N|0:N)>>1)|0)/(0|N)|0,(0|_)<-128?-128:(0|_)<127?_:127))>>6,Q=0|sr(u=(0|u)<-4096?-4096:(0|u)<4095?u:4095,F<<16>>16),Q=0|sr(((J=(0|Q)<0)?0-Q|0:Q)+127>>8,J?-1:0!=(0|Q)&1),or[d>>1]=(0|Q)<-32768?-32768:65535&((0|Q)<32767?Q:32767),u=0|sr(u,F>>16),u=0|sr(((Q=(0|u)<0)?0-u|0:u)+127>>8,Q?-1:0!=(0|u)&1),or[U>>1]=(0|u)<-32768?-32768:65535&((0|u)<32767?u:32767);break}Gr(x,1008,0),tr[j>>0]=3;break}}}while(0);if(2<=(0|(D=D+1|0))){_=62;break}}if(35==(0|_))br(41808,41845,118,41865);else if(38==(0|_))br(41869,41845,119,41865);else if(42==(0|_))br(41808,41845,118,41865);else if(45==(0|_))br(41869,41845,119,41865);else if(55==(0|_))br(42011,41754,1698,42025);else{if(61==(0|_))return tr[V>>0]=0,tr[b>>0]=0,ur=X;if(62==(0|_)){_=a+t|0,ar[E>>2]=_,F=o+-1|0,ar[G>>2]=F,ar[4+E>>2]=_+-1,ar[G+4>>2]=F,ar[8+E>>2]=p,ar[G+8>>2]=F,tr[V>>0]=0,or[(u=d+4|0)>>1]=0,Y=-1,Q=or[(T=d+6|0)>>1]=0;A:for(;;){U=0|go(e,i,f,n,t,o,a,c,s,_,F),tr[P+Q>>0]=1&U;do{if(U&&0==(0|tr[V>>0])){if(N=_>>(U=0|ar[C>>2]),_=F>>U,(0|N)<=-1){_=68;break A}if((0|(F=0|ar[W>>2]))<=(0|N)){_=68;break A}if((0|_)<=-1){_=71;break A}if((0|_)>=(0|ar[I>>2])){_=71;break A}if(D=0|ar[B>>2],N=(0|sr(F,_))+N|0,F=0|tr[(R=D+(12*N|0)+l|0)>>0]?0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(l<<6)+(tr[D+(12*N|0)+2+l>>0]<<2)>>2]):0,_=0|tr[(J=D+(12*N|0)+Z|0)>>0]?0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(Z<<6)+(tr[D+(12*N|0)+2+Z>>0]<<2)>>2]):0,0!=(0|F)&0!=(0|tr[R>>0])&&(0|ar[F+92>>2])==(0|y)){tr[V>>0]=1,Y=lr[(Y=D+(12*N|0)+4+(l<<2)|0)>>1]|lr[Y+2>>1]<<16,or[u>>1]=Y,or[u+2>>1]=Y>>>16,Y=0|tr[D+(12*N|0)+2+l>>0];break}0!=(0|_)&0!=(0|tr[J>>0])&&(0|ar[_+92>>2])==(0|y)&&(tr[V>>0]=1,Y=lr[(Y=D+(12*N|0)+4+(Z<<2)|0)>>1]|lr[Y+2>>1]<<16,or[u>>1]=Y,or[u+2>>1]=Y>>>16,Y=0|tr[D+(12*N|0)+2+Z>>0])}}while(0);if(3<=(0|(F=Q+1|0))){_=63;break}_=0|ar[E+((Q=F)<<2)>>2],F=0|ar[G+(F<<2)>>2]}if(63==(0|_)){A:do{if(!z){0|tr[V>>0]&&(tr[b>>0]=1,z=lr[u>>1]|lr[u+2>>1]<<16,or[d>>1]=z,or[d+2>>1]=z>>>16),D=e+10332|(tr[V>>0]=0),J=0;e:for(;;){do{if(0|tr[P+J>>0]){if(F=0|ar[C>>2],_=ar[E+(J<<2)>>2]>>F,F=ar[G+(J<<2)>>2]>>F,(0|_)<=-1){_=90;break e}if((0|(N=0|ar[W>>2]))<=(0|_)){_=90;break e}if((0|F)<=-1){_=93;break e}if((0|F)>=(0|ar[I>>2])){_=93;break e}if(R=0|ar[B>>2],_=(0|sr(N,F))+_|0,1==(0|tr[R+(12*_|0)+l>>0])&&(K=R+(12*_|0)+2+l|0,(0|tr[O>>0])==(0|tr[(0|tr[K>>0])+(r+1300+(l<<4))>>0]))){tr[V>>0]=1,N=lr[(N=R+(12*_|0)+4+(l<<2)|0)>>1]|lr[N+2>>1]<<16,or[u>>1]=N,or[u+2>>1]=N>>>16,N=l,Y=0|tr[K>>0];break}1==(0|tr[R+(12*_|0)+Z>>0])&&(q=R+(12*_|0)+2+Z|0,(0|tr[O>>0])==(0|tr[(0|tr[q>>0])+(r+1300+(Z<<4))>>0]))?(tr[V>>0]=1,N=lr[(N=R+(12*_|0)+4+(Z<<2)|0)>>1]|lr[N+2>>1]<<16,or[u>>1]=N,or[u+2>>1]=N>>>16,N=Z,Y=0|tr[q>>0]):N=-1}else N=-1}while(0);do{if(1==(0|tr[V>>0])){if((0|Y)<0){_=110;break e}if((0|N)<=-1){_=103;break e}if(0==(0|(_=0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[r+916+(N<<6)+(Y<<2)>>2])))|0==(0|(F=0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[L>>2])))){Gr(4+(0|ar[D>>2])|0,1012,0),tr[j>>0]=3;break}if((0|(_=0|ar[_+92>>2]))!=(0|ar[F+92>>2])&&(tr[r+1300+(N<<4)+Y>>0]|tr[O>>0])<<24>>24==0){if(N=(F=0|ar[H>>2])-_|0,_=F-y|0,F=lr[u>>1]|lr[u+2>>1]<<16,N=(0|N)<-128?-128:(0|N)<127?N:127){z=32+(0|sr((16384+(((0|N)<0?0-N|0:N)>>1)|0)/(0|N)|0,(0|_)<-128?-128:(0|_)<127?_:127))>>6,c=0|sr(z=(0|z)<-4096?-4096:(0|z)<4095?z:4095,F<<16>>16),c=0|sr(((a=(0|c)<0)?0-c|0:c)+127>>8,a?-1:0!=(0|c)&1),or[u>>1]=(0|c)<-32768?-32768:65535&((0|c)<32767?c:32767),z=0|sr(z,F>>16),z=0|sr(((c=(0|z)<0)?0-z|0:z)+127>>8,c?-1:0!=(0|z)&1),or[T>>1]=(0|z)<-32768?-32768:65535&((0|z)<32767?z:32767);break}Gr(x,1008,0),tr[j>>0]=3;break}}}while(0);if(3<=(0|(J=J+1|0)))break A;if(0|tr[V>>0])break A}if(90==(0|_))br(41808,41845,118,41865);else if(93==(0|_))br(41869,41845,119,41865);else if(103==(0|_))br(42011,41754,1839,42025);else if(110==(0|_)){tr[V>>0]=0,tr[b>>0]=0;break}}}while(0);return ur=X}68==(0|_)?br(41808,41845,118,41865):71==(0|_)&&br(41869,41845,119,41865)}}}else 8==(0|_)?br(41808,41845,118,41865):11==(0|_)?br(41869,41845,119,41865):15==(0|_)?br(41808,41845,118,41865):18==(0|_)&&br(41869,41845,119,41865)}else ur=X}(A|=0,r|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0,h=g+18|0,w=g+8|0),0|tr[h>>0]){do{if(0|tr[h+1>>0]){if((0|or[w>>1])==(0|or[w+4>>1])&&(0|or[w+2>>1])==(0|or[w+6>>1])){k=6;break}tr[v>>0]=0}else k=6}while(0);6==(0|k)&&Ho(A,r,e,t,o,a,c,u,l,g,v),A=0|ar[w>>2],or[b>>1]=A,or[b+2>>1]=A>>>16,e=A=1}else Ho(A,r,e,t,o,a,c,u,l,g,v),e=A=0;do{if(0|tr[h+1>>0]){if(e&&(0|or[w>>1])==(0|or[w+4>>1])&&(0|or[w+2>>1])==(0|or[w+6>>1]))break;h=b+(A<<2)|0,w=0|ar[w+4>>2],or[h>>1]=w,or[h+2>>1]=w>>>16,A=A+1|0}}while(0);if(0|tr[v>>0]&&(v=b+(A<<2)|0,g=0|ar[g>>2],or[v>>1]=g,or[v+2>>1]=g>>>16,A=A+1|0),(0|A)<2)return Vu(b+(A<<2)|0,0,8-(A<<2)|0),void(ur=d);2!=(0|A)?br(42063,41754,1943,42079):ur=d}function zo(A,e,r,i,f,n,t,o,a,c,l,u){var s,b;b=ur=(s=ur)+31&-32,ur=ur+16|0,function(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,e|=0,i|=0,a|=0,c|=0,l|=0,u|=0,s|=0;var b,d,k,h,w,v=0,g=0,m=0;switch(d=ur=(w=ur)+31&-32,ur=ur+80|0,h=8+d|0,k=(t|=0)+(f|=0)|0,b=(o|=0)+(n|=0)|0,t=f>>(o=0|ar[(r|=0)+10368>>2]),o=n>>o,(0|t)<=-1&&br(41808,41845,118,41865),(0|(v=0|ar[r+10372>>2]))<=(0|t)&&br(41808,41845,118,41865),(0|o)<=-1&&br(41869,41845,119,41865),(0|o)>=(0|ar[r+10376>>2])&&br(41869,41845,119,41865),v=(0|ar[r+10360>>2])+(3*((0|sr(v,o))+t|0)|0)|0,(65535&(cr[v>>0]|cr[v+1>>0]<<8))>>>8&3){case 2:t=0|tr[i+10>>0],m=11;break;case 1:16&(t=0|tr[(o=i+10|0)>>0])?m=11:t=o;break;default:t=i+10|0}if(11==(0|m))return xo(A,e,r,f,n,k,b,a,c,l,u,m=(255&t)>>>5&255,h),m=h+(12*m|0)|0,or[s>>1]=0|or[m>>1],or[s+2>>1]=0|or[m+2>>1],or[s+4>>1]=0|or[m+4>>1],or[s+6>>1]=0|or[m+6>>1],or[s+8>>1]=0|or[m+8>>1],or[s+10>>1]=0|or[m+10>>1],0|tr[s>>0]&&12==(l+c|0)&0!=(0|tr[(g=s+1|0)>>0])&&(tr[s+3>>0]=-1,tr[g>>0]=0),ur=w;switch(3&tr[t>>0]){case 1:case 3:v=0|tr[i>>0],tr[s+2>>0]=v,tr[s>>0]=1,m=0|lr[i+4>>1],g=0|lr[i+2>>1],jo(A,e,r,f,n,a,k,b,c,l,0,v<<24>>24,u,h),v=h+(((0|cr[t>>0])>>>2&1)<<2)|0,v=lr[v>>1]|lr[v+2>>1]<<16,ar[d>>2]=v,m=(0|lr[2+d>>1])+m|0,or[s+4>>1]=v+g,or[s+6>>1]=m;break;default:tr[s+2>>0]=-1,tr[s>>0]=0}((3&tr[t>>0])-2&255)<2?(v=0|tr[i+1>>0],tr[s+3>>0]=v,tr[s+1>>0]=1,m=0|lr[i+8>>1],g=0|lr[i+6>>1],jo(A,e,r,f,n,a,k,b,c,l,1,v<<24>>24,u,h),c=h+(((0|cr[t>>0])>>>3&1)<<2)|0,c=lr[c>>1]|lr[c+2>>1]<<16,ar[4+d>>2]=c,m=(0|lr[6+d>>1])+m|0,or[s+8>>1]=c+g,or[s+10>>1]=m):(tr[s+3>>0]=-1,tr[s+1>>0]=0),ur=w}(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,b),function(A,e,r,i,f,n,t,o,a,c,l){A|=0,e|=0,o|=0,a|=0,c|=0,l|=0;var u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0;ur=(C=ur)+49168|0,w=C+32768|0,Y=(Z=C)+49152|0,N=(n|=0)+(i|=0)|0,X=(t|=0)+(f|=0)|0,_=(r|=0)+764|0,v=0|ar[r+5780>>2],g=0|ar[r+5784>>2],k=0|ar[r+40>>2],Q=(0|sr(k,X))+N|0,Q=(0|ar[r+4>>2])+(Q<<cr[r+16>>0])|0,m=0|ar[r+44>>2],T=(0|sr(m,(0|X)/(0|g)|0))+((0|N)/(0|v)|0)|0,p=(0|ar[r+8>>2])+(T<<cr[r+17>>0])|0,T=(0|ar[r+12>>2])+(T<<cr[r+18>>0])|0,f=255&(u=0|tr[l>>0]),ar[Y>>2]=f,i=255&(D=0|tr[l+1>>0]),ar[(n=Y+4|0)>>2]=i,h=0|ar[(F=r+5760|0)>>2],y=0|ar[(R=r+5768|0)>>2],d=u<<24>>24==0,D<<24>>24==0|0!=(0|tr[(s=r+5961|0)>>0])|d||(0|or[l+4>>1])!=(0|or[l+8>>1])||(0|or[l+6>>1])!=(0|or[l+10>>1])||(0|ar[e+916+(tr[l+2>>0]<<2)>>2])!=(0|ar[e+980+(tr[l+3>>0]<<2)>>2])||(i=ar[n>>2]=0),b=r+10516|0,D=A+4|0,V=0,n=f;A:for(;;){do{if(0|n){if(15<(n=0|tr[l+2+V>>0])<<24>>24){J=9;break A}if(G=0|fs[63&ar[8+(0|ar[A>>2])>>2]](A,0|ar[e+916+(V<<6)+(n<<24>>24<<2)>>2]),!(0|ar[G+96>>2])){tr[b>>0]=3,Gr(D,1012,0);break}if(n=0|or[(B=l+4+(V<<2)|0)>>1],f=0|or[(E=l+4+(V<<2)+2|0)>>1],t=w+(V<<13)|0,W=0|ar[G+4>>2],I=0|ar[G+40>>2],(8<(0|ar[F>>2])?To:Mo)(A,_,n,f,N,X,t,o,W,I,a,c,h),n=0|or[B>>1],f=0|or[E>>1],t=Z+(V<<13)|0,W=0|ar[G+8>>2],8<(0|ar[F>>2])){M=(0|a)/(0|v)|0,I=(0|c)/(0|g)|0,So(A,_,n,f,N,X,t,o,W,0|ar[(S=G+44|0)>>2],M,I,y),So(A,_,0|or[B>>1],0|or[E>>1],N,X,Z+16384+(V<<13)|0,o,0|ar[G+12>>2],0|ar[S>>2],M,I,y);break}M=(0|a)/(0|v)|0,S=(0|c)/(0|g)|0,Uo(A,_,n,f,N,X,t,o,W,0|ar[(I=G+44|0)>>2],M,S,y),Uo(A,_,0|or[B>>1],0|or[E>>1],N,X,Z+16384+(V<<13)|0,o,0|ar[G+12>>2],0|ar[I>>2],M,S,y);break}}while(0);if(2<=(0|(n=V+1|0)))break;n=0|ar[Y+((V=n)<<2)>>2]}if(9==(0|J))return tr[b>>0]=3,Gr(D,1012,0),ur=C;switch(f=2<(0|(f=14-(0|ar[F>>2])|0))?f:2,X=0|cr[r+5920>>0],B=2<(0|(B=14-(0|ar[R>>2])|0))?B:2,Y=0|cr[r+5921>>0],0|ar[e+20>>2]){case 1:return i=u<<24>>24==1&0==(0|i),0|tr[s>>0]?i?(S=0|tr[l+2>>0],t=(0|cr[e+380>>0])+f|0,E=(0|cr[e+381>>0])+B|0,n=0|or[e+446+(S<<1)>>1],i=tr[e+510+S>>0]<<X,W=0|or[e+542+(S<<2)>>1],I=tr[e+670+(S<<1)>>0]<<Y,B=0|or[e+542+(S<<2)+2>>1],f=tr[e+670+(S<<1)+1>>0]<<Y,(0|h)<9?ys[3&ar[A+180>>2]](Q,k,w,o,a,c,n,i,t):Zs[7&ar[A+196>>2]](Q,k,w,o,a,c,n,i,t,h),n=(0|a)/(0|v)|0,i=(0|c)/(0|g)|0,(0|y)<9?(ys[3&ar[(S=A+180|0)>>2]](p,m,Z,o,n,i,W,I,E),ys[3&ar[S>>2]](T,m,Z+16384|0,o,n,i,B,f,E)):(Zs[7&ar[(S=A+196|0)>>2]](p,m,Z,o,n,i,W,I,E,y),Zs[7&ar[S>>2]](T,m,Z+16384|0,o,n,i,B,f,E,y))):(Gr(D,1011,0),tr[b>>0]=3):i?((0|h)<9?gs[15&ar[A+176>>2]](Q,k,w,o,a,c):ms[31&ar[A+192>>2]](Q,k,w,o,a,c,h),n=(0|a)/(0|v)|0,i=(0|c)/(0|g)|0,(0|y)<9?(gs[15&ar[(S=A+176|0)>>2]](p,m,Z,o,n,i),gs[15&ar[S>>2]](T,m,Z+16384|0,o,n,i)):(ms[31&ar[(S=A+192|0)>>2]](p,m,Z,o,n,i,y),ms[31&ar[S>>2]](T,m,Z+16384|0,o,n,i,y))):(Gr(D,1011,0),tr[b>>0]=3),ur=C;case 0:return(n=u<<24>>24==1)&(i=1==(0|i))?0|tr[r+5962>>0]?(_=0|tr[l+2>>0],i=0|tr[l+3>>0],I=(0|cr[e+380>>0])+f|0,R=(0|cr[e+381>>0])+B|0,f=0|or[e+446+(_<<1)>>1],t=tr[e+510+_>>0]<<X,W=0|or[e+478+(i<<1)>>1],n=tr[e+526+i>>0]<<X,E=0|or[e+542+(_<<2)>>1],G=tr[e+670+(_<<1)>>0]<<Y,V=0|or[e+542+(_<<2)+2>>1],X=tr[e+670+(_<<1)+1>>0]<<Y,_=0|or[e+606+(i<<2)>>1],F=tr[e+702+(i<<1)>>0]<<Y,N=0|or[e+606+(i<<2)+2>>1],B=tr[e+702+(i<<1)+1>>0]<<Y,i=8192+w|0,(0|h)<9?Cs[1&ar[A+184>>2]](Q,k,w,i,o,a,c,f,t,W,n,I):Ws[1&ar[A+200>>2]](Q,k,w,i,o,a,c,f,t,W,n,I,h),f=Z+8192|0,t=Z+16384|0,W=Z+24576|0,n=(0|a)/(0|v)|0,i=(0|c)/(0|g)|0,(0|y)<9?(Cs[1&ar[(S=A+184|0)>>2]](p,m,Z,f,o,n,i,E,G,_,F,R),Cs[1&ar[S>>2]](T,m,t,W,o,n,i,V,X,N,B,R)):(Ws[1&ar[(S=A+200|0)>>2]](p,m,Z,f,o,n,i,E,G,_,F,R,y),Ws[1&ar[S>>2]](T,m,t,W,o,n,i,V,X,N,B,R,y))):(i=8192+w|0,I=A+172|0,(0|h)<9?ms[31&ar[I>>2]](Q,k,w,i,o,a,c):ps[31&ar[A+188>>2]](Q,k,w,i,o,a,c,h),f=Z+8192|0,t=Z+16384|0,W=Z+24576|0,n=(0|a)/(0|v)|0,i=(0|c)/(0|g)|0,(0|y)<9?(ms[31&ar[I>>2]](p,m,Z,f,o,n,i),ms[31&ar[I>>2]](T,m,t,W,o,n,i)):(ps[31&ar[(S=A+188|0)>>2]](p,m,Z,f,o,n,i,y),ps[31&ar[S>>2]](T,m,t,W,o,n,i,y))):n|i?(V=1&d,0|tr[r+5962>>0]?(t=0|tr[l+2+V>>0],W=(0|cr[e+380>>0])+f|0,G=(0|cr[e+381>>0])+B|0,f=0|or[e+446+(V<<5)+(t<<1)>>1],n=tr[e+510+(V<<4)+t>>0]<<X,I=0|or[e+542+(V<<6)+(t<<2)>>1],B=tr[e+670+(V<<5)+(t<<1)>>0]<<Y,E=0|or[e+542+(V<<6)+(t<<2)+2>>1],t=tr[e+670+(V<<5)+(t<<1)+1>>0]<<Y,i=w+(V<<13)|0,(0|h)<9?ys[3&ar[A+180>>2]](Q,k,i,o,a,c,f,n,W):Zs[7&ar[A+196>>2]](Q,k,i,o,a,c,f,n,W,h),f=Z+(V<<13)|0,n=(0|a)/(0|v)|0,i=(0|c)/(0|g)|0,(0|y)<9?(ys[3&ar[(S=A+180|0)>>2]](p,m,f,o,n,i,I,B,G),ys[3&ar[S>>2]](T,m,Z+16384+(V<<13)|0,o,n,i,E,t,G)):(Zs[7&ar[(S=A+196|0)>>2]](p,m,f,o,n,i,I,B,G,y),Zs[7&ar[S>>2]](T,m,Z+16384+(V<<13)|0,o,n,i,E,t,G,y))):(i=w+(V<<13)|0,(0|h)<9?gs[15&ar[A+176>>2]](Q,k,i,o,a,c):ms[31&ar[A+192>>2]](Q,k,i,o,a,c,h),f=Z+(V<<13)|0,n=(0|a)/(0|v)|0,i=(0|c)/(0|g)|0,(0|y)<9?(gs[15&ar[(S=A+176|0)>>2]](p,m,f,o,n,i),gs[15&ar[S>>2]](T,m,Z+16384+(V<<13)|0,o,n,i)):(ms[31&ar[(S=A+192|0)>>2]](p,m,f,o,n,i,y),ms[31&ar[S>>2]](T,m,Z+16384+(V<<13)|0,o,n,i,y)))):(Gr(D,1011,0),tr[b>>0]=3),ur=C;default:br(41721,41754,489,41764)}}(A,e,r,f,n,t,o,a,c,l,b),function(A,e,r,i,f,n){var t,o,a,c,l;if(n|=0,l=(e|=0)>>2,c=(r|=0)>>2,a=(i|=0)>>2,o=(f|=0)>>2,t=0|ar[(A|=0)+10392>>2],!((0|o)<=0)&&(i=A+10380|0,0<(0|a))){e=0;do{for(f=(0|sr(e+c|0,t))+l|0,r=0;A=(0|ar[i>>2])+(12*(f+r|0)|0)|0,or[A>>1]=0|or[n>>1],or[A+2>>1]=0|or[n+2>>1],or[A+4>>1]=0|or[n+4>>1],or[A+6>>1]=0|or[n+6>>1],or[A+8>>1]=0|or[n+8>>1],or[A+10>>1]=0|or[n+10>>1],(0|(r=r+1|0))!=(0|a););e=e+1|0}while((0|e)!=(0|o))}}(r,t+f|0,o+n|0,c,l,b),ur=s}function Po(A){var e;for(e=(A|=0)+100|0;(0|(A=A+2|(or[A>>1]=0)))<(0|e););}function Lo(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,n|=0,t|=0;var o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;if(o=ur,0!=(0|(f|=0))&&(255&(0|at(r,1)))<<24>>24!=0){do{if(t){if(-99999!=(0|(t=0|ut(r)))&(0|t)<(0|f)){t=t+1|0;break}return ur=o,(i=0)|i}t=1}while(0);if((0|(I=f-t|0))<=-1&&br(42114,42122,129,42132),l=0|at(r,1),-99999==(0|(t=0|ut(r))))return ur=o,(i=0)|i;for(u=t+1|0,a=~t,Z=0|cr[(0|ar[n>>2])+(100*I|0)+98>>0],ur=(W=ur=(C=ur)+(15+(0|+(c=Z+1|0))&-16)|0)+(15+(0|+c)&-16)|0,t=0;y=255&(0|at(r,1)),f=(tr[C+t>>0]=y)<<24>>24?1:255&(0|at(r,1)),tr[W+t>>0]=f,(0|(t=t+1|0))!=(0|c););m=0|l?a:u,t=0|ar[n>>2],p=255&(u=0|tr[t+(100*I|0)+96>>0]),y=255&(w=0|tr[t+(100*I|0)+97>>0]),w=w<<24>>24==0;A:do{if(w)d=0;else{I>>>0<(((0|ar[(l=n+4|0)>>2])-t|0)/100|0)>>>0?(s=y,k=0,b=t):br(42160,42122,174,42132);e:for(;;){for(t=s;;){if(a=t+-1|0,17<=(0|t)){E=18;break e}if((0|(f=(0|or[b+(100*I|0)+32+(a<<1)>>1])+m|0))<0&&0|tr[W+(h=a+p|0)>>0])break;if(!(1<(0|t))){d=k;break A}t=a}if(15<(0|k)){v=0,E=74;break}if(c=k+1|0,or[i+(k<<1)>>1]=f,tr[i+64+k>>0]=0|tr[C+h>>0],(0|t)<=1){d=c;break A}if(t=0|ar[n>>2],!(I>>>0<(((0|ar[l>>2])-t|0)/100|0)>>>0)){E=17;break}s=a,k=c,b=t}if(17==(0|E))br(42160,42122,174,42132);else if(18==(0|E))br(42192,42122,175,42132);else if(74==(0|E))return ur=o,0|v}}while(0);do{if((0|m)<0&&0!=(0|tr[W+Z>>0])){if(15<(0|d))return ur=o,(i=0)|i;or[i+(d<<1)>>1]=m,tr[i+64+d>>0]=0|tr[C+Z>>0],t=d+1|0;break}t=d}while(0);c=u<<24>>24==0;A:do{if(c)tr[(u=i+96|0)>>0]=t,t=0;else{for(a=0;;){if((0|(f=(0|or[(0|ar[n>>2])+(100*I|0)+(a<<1)>>1])+m|0))<0&&0!=(0|tr[W+a>>0])){if(15<(0|t)){v=0,E=74;break}or[i+(t<<1)>>1]=f,tr[i+64+t>>0]=0|tr[C+a>>0],g=t+1|0}else g=t;if((0|p)<=(0|(a=a+1|0)))break;t=g}if(74==(0|E))return ur=o,0|v;if(tr[(u=i+96|0)>>0]=g,!c){for(f=p,t=0;;){for(c=0|ar[n>>2],a=f;!(0<(0|(l=(0|or[c+(100*I|0)+((f=a+-1|0)<<1)>>1])+m|0))&&0|tr[W+f>>0]);){if(!(1<(0|a)))break A;a=f}if(15<(0|t)){v=0;break}if(c=t+1|0,or[i+32+(t<<1)>>1]=l,tr[i+80+t>>0]=0|tr[C+f>>0],!(1<(0|a))){t=c;break A}t=c}return ur=o,0|v}t=0}}while(0);do{if(0<(0|m)&&0!=(0|tr[W+Z>>0])){if(15<(0|t))return ur=o,(i=0)|i;or[i+32+(t<<1)>>1]=m,tr[i+80+t>>0]=0|tr[C+Z>>0],t=t+1|0;break}}while(0);A:do{if(!w){for(a=0;;){if(0<(0|(f=(0|or[(0|ar[n>>2])+(100*I|0)+32+(a<<1)>>1])+m|0))&&0!=(0|tr[W+(B=a+p|0)>>0])){if(15<(0|t)){v=0;break}or[i+32+(t<<1)>>1]=f,tr[i+80+t>>0]=0|tr[C+B>>0],t=t+1|0}if((0|y)<=(0|(a=a+1|0)))break A}return ur=o,0|v}}while(0);tr[i+97>>0]=t}else E=54;A:do{if(54==(0|E)){if(l=0|ut(r),((s=0|ut(r))+l|0)>(0|ar[e+528+((0|tr[e+2>>0])-1<<2)>>2]))return or[(i=i+96|0)>>1]=0,Gr(A,1018,or[i+2>>1]=0),ur=o,(i=0)|i;if(16<(0|l)|16<(0|s))return Gr(A,1018,0),ur=o,(i=0)|i;tr[(u=i+96|0)>>0]=l,tr[i+97>>0]=s;e:do{if(0<(0|l)){for(f=t=0;;){if(-99999==(0|(a=0|ut(r)))){v=0;break}if(e=255&(0|at(r,1)),or[(c=i+(t<<1)|0)>>1]=f+65535-a,tr[i+64+t>>0]=e,(0|l)<=(0|(t=t+1|0)))break e;f=0|or[c>>1]}return ur=o,0|v}}while(0);if(0<(0|s)){for(f=t=0;;){if(-99999==(0|(a=0|ut(r)))){v=0;break}if(e=255&(0|at(r,1)),or[(c=i+32+(t<<1)|0)>>1]=f+1+a,tr[i+80+t>>0]=e,(0|s)<=(0|(t=t+1|0)))break A;f=0|or[c>>1]}return ur=o,0|v}}}while(0);if((l=(tr[(s=i+99|0)>>0]=0)|tr[u>>0])<<24>>24)for(c=255&l,f=a=0;t=f+1<<24>>24,0|tr[i+64+a>>0]?tr[s>>0]=t:t=f,(0|(a=a+1|0))!=(0|c);)f=t;else t=0;if(c=255&(r=0|tr[i+97>>0]),r<<24>>24)for(a=0;f=t+1<<24>>24,0|tr[i+80+a>>0]&&(t=tr[s>>0]=f),(0|(a=a+1|0))!=(0|c););return tr[i+98>>0]=c+(255&l),ur=o,0|(i=1)}function Ko(A,e,r){A|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0;if(t=16+(i=ur=(o=ur)+31&-32)|0,n=8+i|0,ur=(f=ur=ur+32|0)+(15+((a=(e|=0)<<1)+2|0)&-16)|0,(tr[f+(a|=1)>>0]=0)<(0|a)&&Vu(0|f,46,0|a),tr[f+e>>0]=124,(a=0|tr[A+96>>0])<<24>>24)for(s=0-e|0,a&=255;u=0|or[A+((a=(c=a)+-1|0)<<1)>>1],l=0|tr[A+64+a>>0]?88:111,(0|u)<(0|s)?(ar[i>>2]=u,ar[4+i>>2]=255&l,ft(r,42221,i)):tr[f+(u+e)>>0]=l,1<(0|c););if(!((a=0|tr[A+97>>0])<<24>>24))return ar[n>>2]=f,ft(r,42228,n),void(ur=o);for(a&=255;u=0|or[A+32+((a=(c=a)+-1|0)<<1)>>1],l=0|tr[A+80+a>>0]?88:111,(0|e)<(0|u)?(ar[t>>2]=u,ar[4+t>>2]=255&l,ft(r,42221,t)):tr[f+(u+e)>>0]=l,1<(0|c););ar[n>>2]=f,ft(r,42228,n),ur=o}function qo(A){A|=0;var e,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;b=ur=(e=ur)+31&-32,ur=ur+16|0;do{if(A>>>0<245){if(A=(l=A>>>0<11?16:A+11&-8)>>>3,3&(i=(s=0|ar[12718])>>>A)|0)return f=0|ar[(i=(A=50912+((r=(1&i^1)+A|0)<<1<<2)|0)+8|0)>>2],(0|A)==(0|(t=0|ar[(n=f+8|0)>>2]))?ar[12718]=s&~(1<<r):(ar[t+12>>2]=A,ar[i>>2]=t),p=r<<3,ar[f+4>>2]=3|p,ar[(p=f+p+4|0)>>2]=1|ar[p>>2],ur=e,0|(p=n);if((u=0|ar[12720])>>>0<l>>>0){if(0|i)return r=((r=i<<A&((r=2<<A)|0-r))&0-r)-1|0,n=0|ar[(A=(r=50912+((f=((i=(r>>>=o=r>>>12&16)>>>5&8)|o|(n=(r>>>=i)>>>2&4)|(A=(r>>>=n)>>>1&2)|(f=(r>>>=A)>>>1&1))+(r>>>f)|0)<<1<<2)|0)+8|0)>>2],(0|r)==(0|(i=0|ar[(o=n+8|0)>>2]))?(A=s&~(1<<f),ar[12718]=A):(ar[i+12>>2]=r,ar[A>>2]=i,A=s),t=(f<<3)-l|0,ar[n+4>>2]=3|l,ar[(f=n+l|0)+4>>2]=1|t,ar[f+t>>2]=t,0|u&&(n=0|ar[12723],i=50912+((r=u>>>3)<<1<<2)|0,A&(r=1<<r)?r=0|ar[(A=i+8|0)>>2]:(ar[12718]=A|r,A=(r=i)+8|0),ar[A>>2]=n,ar[r+12>>2]=n,ar[n+8>>2]=r,ar[n+12>>2]=i),ar[12720]=t,ar[12723]=f,ur=e,0|(p=o);if(a=0|ar[12719]){if(i=(a&0-a)-1|0,A=0|ar[51176+(((t=(i>>>=o=i>>>12&16)>>>5&8)|o|(c=(i>>>=t)>>>2&4)|(f=(i>>>=c)>>>1&2)|(A=(i>>>=f)>>>1&1))+(i>>>A)<<2)>>2],i=(-8&ar[A+4>>2])-l|0,f=0|ar[A+16+((0==(0|ar[A+16>>2])&1)<<2)>>2]){for(;i=(c=(o=(-8&ar[f+4>>2])-l|0)>>>0<i>>>0)?o:i,A=c?f:A,0!=(0|(f=0|ar[f+16+((0==(0|ar[f+16>>2])&1)<<2)>>2])););c=A,t=i}else c=A,t=i;if(c>>>0<(o=c+l|0)>>>0){n=0|ar[c+24>>2],r=0|ar[c+12>>2];do{if((0|r)==(0|c)){if(!(r=0|ar[(A=c+20|0)>>2])&&!(r=0|ar[(A=c+16|0)>>2])){i=0;break}for(;;)if(0|(f=0|ar[(i=r+20|0)>>2]))r=f,A=i;else{if(!(f=0|ar[(i=r+16|0)>>2]))break;r=f,A=i}ar[A>>2]=0,i=r}else i=0|ar[c+8>>2],ar[i+12>>2]=r,ar[r+8>>2]=i,i=r}while(0);do{if(0|n){if(r=0|ar[c+28>>2],(0|c)==(0|ar[(A=51176+(r<<2)|0)>>2])){if(!(ar[A>>2]=i)){ar[12719]=a&~(1<<r);break}}else if(!(ar[n+16+(((0|ar[n+16>>2])!=(0|c)&1)<<2)>>2]=i))break;ar[i+24>>2]=n,0|(r=0|ar[c+16>>2])&&(ar[i+16>>2]=r,ar[r+24>>2]=i),0|(r=0|ar[c+20>>2])&&(ar[i+20>>2]=r,ar[r+24>>2]=i)}}while(0);return t>>>0<16?(p=t+l|0,ar[c+4>>2]=3|p,ar[(p=c+p+4|0)>>2]=1|ar[p>>2]):(ar[c+4>>2]=3|l,ar[o+4>>2]=1|t,ar[o+t>>2]=t,0|u&&(f=0|ar[12723],i=50912+((r=u>>>3)<<1<<2)|0,s&(r=1<<r)?r=0|ar[(A=i+8|0)>>2]:(ar[12718]=s|r,A=(r=i)+8|0),ar[A>>2]=f,ar[r+12>>2]=f,ar[f+8>>2]=r,ar[f+12>>2]=i),ar[12720]=t,ar[12723]=o),ur=e,0|(p=c+8|0)}s=l}else s=l}else s=l}else if(A>>>0<=4294967231)if(l=-8&(A=A+11|0),c=0|ar[12719]){f=0-l|0,a=(A>>>=8)?16777215<l>>>0?31:l>>>((a=14-((u=((m=A<<(s=(A+1048320|0)>>>16&8))+520192|0)>>>16&4)|s|(a=((m<<=u)+245760|0)>>>16&2))+(m<<a>>>15)|0)+7|0)&1|a<<1:0,i=0|ar[51176+(a<<2)>>2];A:do{if(i)for(o=l<<(31==((A=0)|a)?0:25-(a>>>1)|0),t=0;;){if((n=(-8&ar[i+4>>2])-l|0)>>>0<f>>>0){if(!n){f=0,n=A=i,m=61;break A}A=i,f=n}if(t=0==(0|(n=0|ar[i+20>>2]))|(0|n)==(0|(i=0|ar[i+16+(o>>>31<<2)>>2]))?t:n,n=0==(0|i)){i=t,m=57;break}o<<=1&(1^n)}else A=i=0,m=57}while(0);if(57==(0|m)){if(0==(0|i)&0==(0|A)){if(!(A=c&((A=2<<a)|0-A))){s=l;break}s=(A&0-A)-1|0,i=(A=0)|ar[51176+(((t=(s>>>=o=s>>>12&16)>>>5&8)|o|(a=(s>>>=t)>>>2&4)|(u=(s>>>=a)>>>1&2)|(i=(s>>>=u)>>>1&1))+(s>>>i)<<2)>>2]}i?(n=i,m=61):(a=A,o=f)}if(61==(0|m))for(;;){if(m=0,i=(s=(i=(-8&ar[n+4>>2])-l|0)>>>0<f>>>0)?i:f,A=s?n:A,!(n=0|ar[n+16+((0==(0|ar[n+16>>2])&1)<<2)>>2])){a=A,o=i;break}f=i,m=61}if(0!=(0|a)&&o>>>0<((0|ar[12720])-l|0)>>>0){if((t=a+l|0)>>>0<=a>>>0)return ur=e,(p=0)|p;n=0|ar[a+24>>2],r=0|ar[a+12>>2];do{if((0|r)==(0|a)){if(!(r=0|ar[(A=a+20|0)>>2])&&!(r=0|ar[(A=a+16|0)>>2])){r=0;break}for(;;)if(0|(f=0|ar[(i=r+20|0)>>2]))r=f,A=i;else{if(!(f=0|ar[(i=r+16|0)>>2]))break;r=f,A=i}ar[A>>2]=0}else p=0|ar[a+8>>2],ar[p+12>>2]=r,ar[r+8>>2]=p}while(0);do{if(n){if(A=0|ar[a+28>>2],(0|a)==(0|ar[(i=51176+(A<<2)|0)>>2])){if(!(ar[i>>2]=r)){f=c&~(1<<A),ar[12719]=f;break}}else if(!(ar[n+16+(((0|ar[n+16>>2])!=(0|a)&1)<<2)>>2]=r)){f=c;break}ar[r+24>>2]=n,0|(A=0|ar[a+16>>2])&&(ar[r+16>>2]=A,ar[A+24>>2]=r),f=((A=0|ar[a+20>>2])&&(ar[r+20>>2]=A,ar[A+24>>2]=r),c)}else f=c}while(0);do{if(16<=o>>>0){if(ar[a+4>>2]=3|l,ar[t+4>>2]=1|o,r=(ar[t+o>>2]=o)>>>3,o>>>0<256){i=50912+(r<<1<<2)|0,(A=0|ar[12718])&(r=1<<r)?r=0|ar[(A=i+8|0)>>2]:(ar[12718]=A|r,A=(r=i)+8|0),ar[A>>2]=t,ar[r+12>>2]=t,ar[t+8>>2]=r,ar[t+12>>2]=i;break}if(i=51176+((r=(r=o>>>8)?16777215<o>>>0?31:o>>>((r=14-((g=((p=r<<(m=(r+1048320|0)>>>16&8))+520192|0)>>>16&4)|m|(r=((p<<=g)+245760|0)>>>16&2))+(p<<r>>>15)|0)+7|0)&1|r<<1:0)<<2)|0,ar[t+28>>2]=r,ar[(A=t+16|0)+4>>2]=0,ar[A>>2]=0,!(f&(A=1<<r))){ar[12719]=f|A,ar[i>>2]=t,ar[t+24>>2]=i,ar[t+12>>2]=t,ar[t+8>>2]=t;break}for(A=o<<(31==(0|r)?0:25-(r>>>1)|0),i=0|ar[i>>2];;){if((-8&ar[i+4>>2]|0)==(0|o)){m=97;break}if(!(r=0|ar[(f=i+16+(A>>>31<<2)|0)>>2])){m=96;break}A<<=1,i=r}if(96==(0|m)){ar[f>>2]=t,ar[t+24>>2]=i,ar[t+12>>2]=t,ar[t+8>>2]=t;break}if(97==(0|m)){p=0|ar[(m=i+8|0)>>2],ar[p+12>>2]=t,ar[m>>2]=t,ar[t+8>>2]=p,ar[t+12>>2]=i,ar[t+24>>2]=0;break}}else p=o+l|0,ar[a+4>>2]=3|p,ar[(p=a+p+4|0)>>2]=1|ar[p>>2]}while(0);return ur=e,0|(p=a+8|0)}s=l}else s=l;else s=-1}while(0);if(s>>>0<=(i=0|ar[12720])>>>0)return r=i-s|0,A=0|ar[12723],15<r>>>0?(p=A+s|0,ar[12723]=p,ar[12720]=r,ar[p+4>>2]=1|r,ar[p+r>>2]=r,ar[A+4>>2]=3|s):(ar[12720]=0,ar[12723]=0,ar[A+4>>2]=3|i,ar[(p=A+i+4|0)>>2]=1|ar[p>>2]),ur=e,0|(p=A+8|0);if(s>>>0<(o=0|ar[12721])>>>0)return g=o-s|0,ar[12721]=g,m=(p=0|ar[12724])+s|0,ar[12724]=m,ar[m+4>>2]=1|g,ar[p+4>>2]=3|s,ur=e,0|(p=p+8|0);if(a=s+48|0,(l=(t=(A=0|ar[12836]?0|ar[12838]:(ar[12838]=4096,ar[12837]=4096,ar[12839]=-1,ar[12840]=-1,ar[12841]=0,ar[12829]=0,A=-16&b^1431655768,ar[b>>2]=A,ar[12836]=A,4096))+(c=s+47|0)|0)&(n=0-A|0))>>>0<=s>>>0)return ur=e,(p=0)|p;if(0|(A=0|ar[12828])&&(b=(u=0|ar[12826])+l|0)>>>0<=u>>>0|A>>>0<b>>>0)return ur=e,(p=0)|p;A:do{if(4&ar[12829])r=0,m=133;else{i=0|ar[12724];e:do{if(i){for(f=51320;!((A=0|ar[f>>2])>>>0<=i>>>0&&(A+(0|ar[(h=f+4|0)>>2])|0)>>>0>i>>>0);){if(!(A=0|ar[f+8>>2])){m=118;break e}f=A}if((r=t-o&n)>>>0<2147483647)if((0|(A=0|Nu(0|r)))==((0|ar[f>>2])+(0|ar[h>>2])|0)){if(-1!=(0|A)){o=r,t=A,m=135;break A}}else f=A,m=126;else r=0}else m=118}while(0);do{if(118==(0|m))if(-1!=(0|(i=0|Nu(0)))&&(r=i,k=(r=(0==((k=(d=0|ar[12837])+-1|0)&r|0)?0:(k+r&0-d)-r|0)+l|0)+(d=0|ar[12826])|0,s>>>0<r>>>0&r>>>0<2147483647)){if(0|(h=0|ar[12828])&&k>>>0<=d>>>0|h>>>0<k>>>0){r=0;break}if((0|(A=0|Nu(0|r)))==(0|i)){o=r,t=i,m=135;break A}f=A,m=126}else r=0}while(0);do{if(126==(0|m)){if(i=0-r|0,!(r>>>0<a>>>0&r>>>0<2147483647&-1!=(0|f))){if(-1==(0|f)){r=0;break}o=r,t=f,m=135;break A}if(2147483647<=(A=c-r+(A=0|ar[12838])&0-A)>>>0){o=r,t=f,m=135;break A}if(-1==(0|Nu(0|A))){Nu(0|i),r=0;break}o=A+r|0,t=f,m=135;break A}}while(0);ar[12829]=4|ar[12829],m=133}}while(0);if(133==(0|m)&&l>>>0<2147483647&&!(-1==(0|(g=0|Nu(0|l)))|1^(v=(s+40|0)>>>0<(w=(h=0|Nu(0))-g|0)>>>0)|g>>>0<h>>>0&-1!=(0|g)&-1!=(0|h)^1)&&(o=v?w:r,t=g,m=135),135==(0|m)){r=(0|ar[12826])+o|0,(ar[12826]=r)>>>0>(0|ar[12827])>>>0&&(ar[12827]=r),c=0|ar[12724];do{if(c){for(r=51320;;){if((0|t)==((A=0|ar[r>>2])+(f=0|ar[(i=r+4|0)>>2])|0)){m=145;break}if(!(n=0|ar[r+8>>2]))break;r=n}if(145==(0|m)&&0==(8&ar[r+12>>2]|0)&&c>>>0<t>>>0&A>>>0<=c>>>0){ar[i>>2]=f+o,m=c+(p=0==(7&(p=c+8|0)|0)?0:0-p&7)|0,p=(0|ar[12721])+(o-p)|0,ar[12724]=m,ar[12721]=p,ar[m+4>>2]=1|p,ar[m+p+4>>2]=40,ar[12725]=ar[12840];break}for(t>>>0<(0|ar[12722])>>>0&&(ar[12722]=t),i=t+o|0,r=51320;;){if((0|ar[r>>2])==(0|i)){m=153;break}if(!(A=0|ar[r+8>>2]))break;r=A}if(153==(0|m)&&0==(8&ar[r+12>>2]|0)){ar[r>>2]=t,ar[(u=r+4|0)>>2]=(0|ar[u>>2])+o,l=(u=t+(0==(7&(u=t+8|0)|0)?0:0-u&7)|0)+s|0,a=(r=i+(0==(7&(r=i+8|0)|0)?0:0-r&7)|0)-u-s|0,ar[u+4>>2]=3|s;do{if((0|r)!=(0|c)){if((0|r)==(0|ar[12723])){p=(0|ar[12720])+a|0,ar[12720]=p,ar[12723]=l,ar[l+4>>2]=1|p,ar[l+p>>2]=p;break}if(1==(3&(A=0|ar[r+4>>2])|0)){o=-8&A,f=A>>>3;A:do{if(A>>>0<256){if(A=0|ar[r+8>>2],(0|(i=0|ar[r+12>>2]))==(0|A)){ar[12718]=ar[12718]&~(1<<f);break}ar[A+12>>2]=i,ar[i+8>>2]=A;break}t=0|ar[r+24>>2],A=0|ar[r+12>>2];do{if((0|A)==(0|r)){if(!(A=0|ar[(i=(f=r+16|0)+4|0)>>2])){if(!(A=0|ar[f>>2])){A=0;break}i=f}for(;;)if(0|(n=0|ar[(f=A+20|0)>>2]))A=n,i=f;else{if(!(n=0|ar[(f=A+16|0)>>2]))break;A=n,i=f}ar[i>>2]=0}else p=0|ar[r+8>>2],ar[p+12>>2]=A,ar[A+8>>2]=p}while(0);if(!t)break;f=51176+((i=0|ar[r+28>>2])<<2)|0;do{if((0|r)==(0|ar[f>>2])){if(0|(ar[f>>2]=A))break;ar[12719]=ar[12719]&~(1<<i);break A}if(!(ar[t+16+(((0|ar[t+16>>2])!=(0|r)&1)<<2)>>2]=A))break A}while(0);if(ar[A+24>>2]=t,0|(f=0|ar[(i=r+16|0)>>2])&&(ar[A+16>>2]=f,ar[f+24>>2]=A),!(i=0|ar[i+4>>2]))break;ar[A+20>>2]=i,ar[i+24>>2]=A}while(0);r=r+o|0,n=o+a|0}else n=a;if(ar[(r=r+4|0)>>2]=-2&ar[r>>2],ar[l+4>>2]=1|n,r=(ar[l+n>>2]=n)>>>3,n>>>0<256){i=50912+(r<<1<<2)|0,(A=0|ar[12718])&(r=1<<r)?r=0|ar[(A=i+8|0)>>2]:(ar[12718]=A|r,A=(r=i)+8|0),ar[A>>2]=l,ar[r+12>>2]=l,ar[l+8>>2]=r,ar[l+12>>2]=i;break}r=n>>>8;do{if(r){if(16777215<n>>>0){r=31;break}r=n>>>((r=14-((g=((p=r<<(m=(r+1048320|0)>>>16&8))+520192|0)>>>16&4)|m|(r=((p<<=g)+245760|0)>>>16&2))+(p<<r>>>15)|0)+7|0)&1|r<<1}else r=0}while(0);if(f=51176+(r<<2)|0,ar[l+28>>2]=r,ar[(A=l+16|0)+4>>2]=0,!((A=(ar[A>>2]=0)|ar[12719])&(i=1<<r))){ar[12719]=A|i,ar[f>>2]=l,ar[l+24>>2]=f,ar[l+12>>2]=l,ar[l+8>>2]=l;break}for(A=n<<(31==(0|r)?0:25-(r>>>1)|0),i=0|ar[f>>2];;){if((-8&ar[i+4>>2]|0)==(0|n)){m=194;break}if(!(r=0|ar[(f=i+16+(A>>>31<<2)|0)>>2])){m=193;break}A<<=1,i=r}if(193==(0|m)){ar[f>>2]=l,ar[l+24>>2]=i,ar[l+12>>2]=l,ar[l+8>>2]=l;break}if(194==(0|m)){p=0|ar[(m=i+8|0)>>2],ar[p+12>>2]=l,ar[m>>2]=l,ar[l+8>>2]=p,ar[l+12>>2]=i,ar[l+24>>2]=0;break}}else p=(0|ar[12721])+a|0,ar[12721]=p,ar[12724]=l,ar[l+4>>2]=1|p}while(0);return ur=e,0|(p=u+8|0)}for(r=51320;!((A=0|ar[r>>2])>>>0<=c>>>0&&c>>>0<(p=A+(0|ar[r+4>>2])|0)>>>0);)r=0|ar[r+8>>2];for(r=(A=(A=(n=p+-47|0)+(0==(7&(A=n+8|0)|0)?0:0-A&7)|0)>>>0<(n=c+16|0)>>>0?c:A)+8|0,m=t+(i=0==(7&(i=t+8|0)|0)?0:0-i&7)|0,i=o+-40-i|0,ar[12724]=m,ar[12721]=i,ar[m+4>>2]=1|i,ar[m+i+4>>2]=40,ar[12725]=ar[12840],ar[(i=A+4|0)>>2]=27,ar[r>>2]=ar[12830],ar[r+4>>2]=ar[12831],ar[r+8>>2]=ar[12832],ar[r+12>>2]=ar[12833],ar[12830]=t,ar[12831]=o,ar[12833]=0,ar[12832]=r,r=A+24|0;ar[(r=(m=r)+4|0)>>2]=7,(m+8|0)>>>0<p>>>0;);if((0|A)!=(0|c)){if(t=A-c|0,ar[i>>2]=-2&ar[i>>2],ar[c+4>>2]=1|t,r=(ar[A>>2]=t)>>>3,t>>>0<256){i=50912+(r<<1<<2)|0,(A=0|ar[12718])&(r=1<<r)?r=0|ar[(A=i+8|0)>>2]:(ar[12718]=A|r,A=(r=i)+8|0),ar[A>>2]=c,ar[r+12>>2]=c,ar[c+8>>2]=r,ar[c+12>>2]=i;break}if(f=51176+((i=(r=t>>>8)?16777215<t>>>0?31:t>>>((i=14-((g=((p=r<<(m=(r+1048320|0)>>>16&8))+520192|0)>>>16&4)|m|(i=((p<<=g)+245760|0)>>>16&2))+(p<<i>>>15)|0)+7|0)&1|i<<1:0)<<2)|0,ar[c+28>>2]=i,ar[c+20>>2]=0,!((r=(ar[n>>2]=0)|ar[12719])&(A=1<<i))){ar[12719]=r|A,ar[f>>2]=c,ar[c+24>>2]=f,ar[c+12>>2]=c,ar[c+8>>2]=c;break}for(A=t<<(31==(0|i)?0:25-(i>>>1)|0),i=0|ar[f>>2];;){if((-8&ar[i+4>>2]|0)==(0|t)){m=216;break}if(!(r=0|ar[(f=i+16+(A>>>31<<2)|0)>>2])){m=215;break}A<<=1,i=r}if(215==(0|m)){ar[f>>2]=c,ar[c+24>>2]=i,ar[c+12>>2]=c,ar[c+8>>2]=c;break}if(216==(0|m)){p=0|ar[(m=i+8|0)>>2],ar[p+12>>2]=c,ar[m>>2]=c,ar[c+8>>2]=p,ar[c+12>>2]=i,ar[c+24>>2]=0;break}}}else{for(0==(0|(p=0|ar[12722]))|t>>>0<p>>>0&&(ar[12722]=t),ar[12830]=t,ar[12831]=o,ar[12833]=0,ar[12727]=ar[12836],ar[12726]=-1,r=0;ar[(p=50912+(r<<1<<2)|0)+12>>2]=p,ar[p+8>>2]=p,32!=(0|(r=r+1|0)););m=t+(p=0==(7&(p=t+8|0)|0)?0:0-p&7)|0,p=o+-40-p|0,ar[12724]=m,ar[12721]=p,ar[m+4>>2]=1|p,ar[m+p+4>>2]=40,ar[12725]=ar[12840]}}while(0);if(s>>>0<(r=0|ar[12721])>>>0)return g=r-s|0,ar[12721]=g,m=(p=0|ar[12724])+s|0,ar[12724]=m,ar[m+4>>2]=1|g,ar[p+4>>2]=3|s,ur=e,0|(p=p+8|0)}return ar[(p=8708)>>2]=12,ur=e,(p=0)|p}function $o(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0;if(A|=0){r=A+-8|0,f=0|ar[12722],a=r+(e=-8&(A=0|ar[A+-4>>2]))|0;do{if(1&A)t=o=r;else{if(i=0|ar[r>>2],!(3&A))return;if(n=i+e|0,(t=r+(0-i)|0)>>>0<f>>>0)return;if((0|t)==(0|ar[12723])){if(3==(3&(e=0|ar[(A=a+4|0)>>2])|0))return ar[12720]=n,ar[A>>2]=-2&e,ar[t+4>>2]=1|n,void(ar[t+n>>2]=n);o=t,e=n;break}if(r=i>>>3,i>>>0<256){if(A=0|ar[t+8>>2],(0|(e=0|ar[t+12>>2]))==(0|A)){ar[12718]=ar[12718]&~(1<<r),o=t,e=n;break}ar[A+12>>2]=e,ar[e+8>>2]=A,o=t,e=n;break}f=0|ar[t+24>>2],A=0|ar[t+12>>2];do{if((0|A)==(0|t)){if(!(A=0|ar[(e=(r=t+16|0)+4|0)>>2])){if(!(A=0|ar[r>>2])){A=0;break}e=r}for(;;)if(0|(i=0|ar[(r=A+20|0)>>2]))A=i,e=r;else{if(!(i=0|ar[(r=A+16|0)>>2]))break;A=i,e=r}ar[e>>2]=0}else o=0|ar[t+8>>2],ar[o+12>>2]=A,ar[A+8>>2]=o}while(0);if(f){if(e=0|ar[t+28>>2],(0|t)==(0|ar[(r=51176+(e<<2)|0)>>2])){if(!(ar[r>>2]=A)){ar[12719]=ar[12719]&~(1<<e),o=t,e=n;break}}else if(!(ar[f+16+(((0|ar[f+16>>2])!=(0|t)&1)<<2)>>2]=A)){o=t,e=n;break}ar[A+24>>2]=f,0|(r=0|ar[(e=t+16|0)>>2])&&(ar[A+16>>2]=r,ar[r+24>>2]=A),e=(o=((e=0|ar[e+4>>2])&&(ar[A+20>>2]=e,ar[e+24>>2]=A),t),n)}else o=t,e=n}}while(0);if(!(a>>>0<=t>>>0)&&1&(i=0|ar[(A=a+4|0)>>2])){if(2&i)ar[A>>2]=-2&i,ar[o+4>>2]=1|e,f=ar[t+e>>2]=e;else{if(A=0|ar[12723],(0|a)==(0|ar[12724])){if(a=(0|ar[12721])+e|0,ar[12721]=a,ar[12724]=o,ar[o+4>>2]=1|a,(0|o)!=(0|A))return;return ar[12723]=0,void(ar[12720]=0)}if((0|a)==(0|A))return a=(0|ar[12720])+e|0,ar[12720]=a,ar[12723]=t,ar[o+4>>2]=1|a,void(ar[t+a>>2]=a);f=(-8&i)+e|0,r=i>>>3;do{if(i>>>0<256){if(e=0|ar[a+8>>2],(0|(A=0|ar[a+12>>2]))==(0|e)){ar[12718]=ar[12718]&~(1<<r);break}ar[e+12>>2]=A,ar[A+8>>2]=e;break}n=0|ar[a+24>>2],A=0|ar[a+12>>2];do{if((0|A)==(0|a)){if(!(A=0|ar[(e=(r=a+16|0)+4|0)>>2])){if(!(A=0|ar[r>>2])){r=0;break}e=r}for(;;)if(0|(i=0|ar[(r=A+20|0)>>2]))A=i,e=r;else{if(!(i=0|ar[(r=A+16|0)>>2]))break;A=i,e=r}ar[e>>2]=0,r=A}else r=0|ar[a+8>>2],ar[r+12>>2]=A,ar[A+8>>2]=r,r=A}while(0);if(0|n){if(A=0|ar[a+28>>2],(0|a)==(0|ar[(e=51176+(A<<2)|0)>>2])){if(!(ar[e>>2]=r)){ar[12719]=ar[12719]&~(1<<A);break}}else if(!(ar[n+16+(((0|ar[n+16>>2])!=(0|a)&1)<<2)>>2]=r))break;ar[r+24>>2]=n,0|(e=0|ar[(A=a+16|0)>>2])&&(ar[r+16>>2]=e,ar[e+24>>2]=r),0|(A=0|ar[A+4>>2])&&(ar[r+20>>2]=A,ar[A+24>>2]=r)}}while(0);if(ar[o+4>>2]=1|f,ar[t+f>>2]=f,(0|o)==(0|ar[12723]))return void(ar[12720]=f)}if(A=f>>>3,f>>>0<256)return r=50912+(A<<1<<2)|0,(e=0|ar[12718])&(A=1<<A)?A=0|ar[(e=r+8|0)>>2]:(ar[12718]=e|A,e=(A=r)+8|0),ar[e>>2]=o,ar[A+12>>2]=o,ar[o+8>>2]=A,void(ar[o+12>>2]=r);i=51176+((A=(A=f>>>8)?16777215<f>>>0?31:f>>>((A=14-((n=((a=A<<(t=(A+1048320|0)>>>16&8))+520192|0)>>>16&4)|t|(A=((a<<=n)+245760|0)>>>16&2))+(a<<A>>>15)|0)+7|0)&1|A<<1:0)<<2)|0,ar[o+28>>2]=A,ar[o+20>>2]=0,e=(ar[o+16>>2]=0)|ar[12719],r=1<<A;do{if(e&r){for(e=f<<(31==(0|A)?0:25-(A>>>1)|0),r=0|ar[i>>2];;){if((-8&ar[r+4>>2]|0)==(0|f)){A=73;break}if(!(A=0|ar[(i=r+16+(e>>>31<<2)|0)>>2])){A=72;break}e<<=1,r=A}if(72==(0|A)){ar[i>>2]=o,ar[o+24>>2]=r,ar[o+12>>2]=o,ar[o+8>>2]=o;break}if(73==(0|A)){a=0|ar[(t=r+8|0)>>2],ar[a+12>>2]=o,ar[t>>2]=o,ar[o+8>>2]=a,ar[o+12>>2]=r,ar[o+24>>2]=0;break}}else ar[12719]=e|r,ar[i>>2]=o,ar[o+24>>2]=i,ar[o+12>>2]=o,ar[o+8>>2]=o}while(0);if(a=(0|ar[12726])-1|0,!(ar[12726]=a)){for(A=51328;A=0|ar[A>>2];)A=A+8|0;ar[12726]=-1}}}}function Aa(A,e){e|=0;var r=0,i=0;return(A|=0)?4294967231<e>>>0?(ar[(e=8708)>>2]=12,(e=0)|e):0|(r=0|function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if(l=0|ar[(u=4+(A|=0)|0)>>2],r=A+(f=-8&l)|0,!(3&l))return!(e>>>0<256)&&(e+4|0)>>>0<=f>>>0&&(f-e|0)>>>0<=ar[12838]<<1>>>0?0|A:(A=0)|A;if(e>>>0<=f>>>0)return(f=f-e|0)>>>0<=15||(c=A+e|0,ar[u>>2]=1&l|e|2,ar[c+4>>2]=3|f,ar[(u=c+f+4|0)>>2]=1|ar[u>>2],ea(c,f)),0|A;if((0|r)==(0|ar[12724]))return c=(0|ar[12721])+f|0,f=c-e|0,n=A+e|0,c>>>0<=e>>>0?(A=0)|A:(ar[u>>2]=1&l|e|2,ar[n+4>>2]=1|f,ar[12724]=n,ar[12721]=f,0|A);if((0|r)==(0|ar[12723]))return(t=(0|ar[12720])+f|0)>>>0<e>>>0?(A=0)|A:(n=1&l,15<(f=t-e|0)>>>0?(c=(l=A+e|0)+f|0,ar[u>>2]=n|e|2,ar[l+4>>2]=1|f,ar[c>>2]=f,ar[(n=c+4|0)>>2]=-2&ar[n>>2],n=l):(ar[u>>2]=n|t|2,ar[(n=A+t+4|0)>>2]=1|ar[n>>2],f=n=0),ar[12720]=f,ar[12723]=n,0|A);if(2&(n=0|ar[4+r>>2])|0)return(A=0)|A;if((i=(-8&n)+f|0)>>>0<e>>>0)return(A=0)|A;c=i-e|0,t=n>>>3;do{if(n>>>0<256){if(n=0|ar[8+r>>2],(0|(f=0|ar[12+r>>2]))==(0|n)){ar[12718]=ar[12718]&~(1<<t);break}ar[n+12>>2]=f,ar[f+8>>2]=n;break}a=0|ar[24+r>>2],f=0|ar[12+r>>2];do{if((0|f)==(0|r)){if(f=0|ar[(n=(t=16+r|0)+4|0)>>2])o=n;else{if(!(f=0|ar[t>>2])){t=0;break}o=t}for(;;)if(0|(n=0|ar[(t=f+20|0)>>2]))f=n,o=t;else{if(!(t=0|ar[(n=f+16|0)>>2]))break;f=t,o=n}ar[o>>2]=0,t=f}else t=0|ar[8+r>>2],ar[t+12>>2]=f,ar[f+8>>2]=t,t=f}while(0);if(0|a){if(f=0|ar[28+r>>2],(0|r)==(0|ar[(n=51176+(f<<2)|0)>>2])){if(!(ar[n>>2]=t)){ar[12719]=ar[12719]&~(1<<f);break}}else if(!(ar[a+16+(((0|ar[a+16>>2])!=(0|r)&1)<<2)>>2]=t))break;ar[t+24>>2]=a,0|(n=0|ar[(f=16+r|0)>>2])&&(ar[t+16>>2]=n,ar[n+24>>2]=t),0|(f=0|ar[f+4>>2])&&(ar[t+20>>2]=f,ar[f+24>>2]=t)}}while(0);return f=1&l,c>>>0<16?(ar[u>>2]=i|f|2,ar[(u=A+i+4|0)>>2]=1|ar[u>>2]):(l=A+e|0,ar[u>>2]=f|e|2,ar[l+4>>2]=3|c,ar[(u=l+c+4|0)>>2]=1|ar[u>>2],ea(l,c)),0|A}(A+-8|0,e>>>0<11?16:e+11&-8))?0|(e=r+8|0):(r=0|qo(e))?(Eu(0|r,0|A,0|((i=(-8&(i=0|ar[A+-4>>2]))-(0==(3&i|0)?8:4)|0)>>>0<e>>>0?i:e)),$o(A),0|(e=r)):(e=0)|e:0|(e=0|qo(e))}function ea(A,e){var r=0,i=0,f=0,n=0,t=0,o=0,a=0;a=(A|=0)+(e|=0)|0,r=0|ar[A+4>>2];do{if(1&r)o=A,r=e;else{if(i=0|ar[A>>2],!(3&r))return;if(t=i+e|0,(0|(n=A+(0-i)|0))==(0|ar[12723])){if(3==(3&(r=0|ar[(A=a+4|0)>>2])|0))return ar[12720]=t,ar[A>>2]=-2&r,ar[n+4>>2]=1|t,void(ar[n+t>>2]=t);o=n,r=t;break}if(e=i>>>3,i>>>0<256){if(A=0|ar[n+8>>2],(0|(r=0|ar[n+12>>2]))==(0|A)){ar[12718]=ar[12718]&~(1<<e),o=n,r=t;break}ar[A+12>>2]=r,ar[r+8>>2]=A,o=n,r=t;break}f=0|ar[n+24>>2],A=0|ar[n+12>>2];do{if((0|A)==(0|n)){if(!(A=0|ar[(r=(e=n+16|0)+4|0)>>2])){if(!(A=0|ar[e>>2])){A=0;break}r=e}for(;;)if(0|(i=0|ar[(e=A+20|0)>>2]))A=i,r=e;else{if(!(i=0|ar[(e=A+16|0)>>2]))break;A=i,r=e}ar[r>>2]=0}else o=0|ar[n+8>>2],ar[o+12>>2]=A,ar[A+8>>2]=o}while(0);if(f){if(r=0|ar[n+28>>2],(0|n)==(0|ar[(e=51176+(r<<2)|0)>>2])){if(!(ar[e>>2]=A)){ar[12719]=ar[12719]&~(1<<r),o=n,r=t;break}}else if(!(ar[f+16+(((0|ar[f+16>>2])!=(0|n)&1)<<2)>>2]=A)){o=n,r=t;break}ar[A+24>>2]=f,0|(e=0|ar[(r=n+16|0)>>2])&&(ar[A+16>>2]=e,ar[e+24>>2]=A),r=(o=((r=0|ar[r+4>>2])&&(ar[A+20>>2]=r,ar[r+24>>2]=A),n),t)}else o=n,r=t}}while(0);if(2&(i=0|ar[(A=a+4|0)>>2]))ar[A>>2]=-2&i,ar[o+4>>2]=1|r,ar[o+r>>2]=r;else{if(A=0|ar[12723],(0|a)==(0|ar[12724]))return a=(0|ar[12721])+r|0,ar[12721]=a,ar[12724]=o,ar[o+4>>2]=1|a,(0|o)==(0|A)&&(ar[12723]=0,void(ar[12720]=0));if((0|a)==(0|A))return a=(0|ar[12720])+r|0,ar[12720]=a,ar[12723]=o,ar[o+4>>2]=1|a,void(ar[o+a>>2]=a);n=(-8&i)+r|0,e=i>>>3;do{if(i>>>0<256){if(r=0|ar[a+8>>2],(0|(A=0|ar[a+12>>2]))==(0|r)){ar[12718]=ar[12718]&~(1<<e);break}ar[r+12>>2]=A,ar[A+8>>2]=r;break}f=0|ar[a+24>>2],A=0|ar[a+12>>2];do{if((0|A)==(0|a)){if(!(A=0|ar[(r=(e=a+16|0)+4|0)>>2])){if(!(A=0|ar[e>>2])){e=0;break}r=e}for(;;)if(0|(i=0|ar[(e=A+20|0)>>2]))A=i,r=e;else{if(!(i=0|ar[(e=A+16|0)>>2]))break;A=i,r=e}ar[r>>2]=0,e=A}else e=0|ar[a+8>>2],ar[e+12>>2]=A,ar[A+8>>2]=e,e=A}while(0);if(0|f){if(A=0|ar[a+28>>2],(0|a)==(0|ar[(r=51176+(A<<2)|0)>>2])){if(!(ar[r>>2]=e)){ar[12719]=ar[12719]&~(1<<A);break}}else if(!(ar[f+16+(((0|ar[f+16>>2])!=(0|a)&1)<<2)>>2]=e))break;ar[e+24>>2]=f,0|(r=0|ar[(A=a+16|0)>>2])&&(ar[e+16>>2]=r,ar[r+24>>2]=e),0|(A=0|ar[A+4>>2])&&(ar[e+20>>2]=A,ar[A+24>>2]=e)}}while(0);if(ar[o+4>>2]=1|n,ar[o+n>>2]=n,(0|o)==(0|ar[12723]))return void(ar[12720]=n);r=n}if(A=r>>>3,r>>>0<256)return e=50912+(A<<1<<2)|0,(r=0|ar[12718])&(A=1<<A)?A=0|ar[(r=e+8|0)>>2]:(ar[12718]=r|A,r=(A=e)+8|0),ar[r>>2]=o,ar[A+12>>2]=o,ar[o+8>>2]=A,void(ar[o+12>>2]=e);if(f=51176+((A=(A=r>>>8)?16777215<r>>>0?31:r>>>((A=14-((n=((a=A<<(t=(A+1048320|0)>>>16&8))+520192|0)>>>16&4)|t|(A=((a<<=n)+245760|0)>>>16&2))+(a<<A>>>15)|0)+7|0)&1|A<<1:0)<<2)|0,ar[o+28>>2]=A,ar[o+20>>2]=0,!((e=(ar[o+16>>2]=0)|ar[12719])&(i=1<<A)))return ar[12719]=e|i,ar[f>>2]=o,ar[o+24>>2]=f,ar[o+12>>2]=o,void(ar[o+8>>2]=o);for(e=r<<(31==(0|A)?0:25-(A>>>1)|0),i=0|ar[f>>2];;){if((-8&ar[i+4>>2]|0)==(0|r)){A=69;break}if(!(A=0|ar[(f=i+16+(e>>>31<<2)|0)>>2])){A=68;break}e<<=1,i=A}return 68==(0|A)?(ar[f>>2]=o,ar[o+24>>2]=i,ar[o+12>>2]=o,void(ar[o+8>>2]=o)):69==(0|A)&&(a=0|ar[(t=i+8|0)>>2],ar[a+12>>2]=o,ar[t>>2]=o,ar[o+8>>2]=a,ar[o+12>>2]=i,void(ar[o+24>>2]=0))}function ra(A,e){return e|=0,(A|=0)>>>0<9?0|(e=0|qo(e)):0|(e=0|function(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0;if((A=16<(A|=0)>>>0?A:16)+-1&A)for(i=16;;){if(!(i>>>0<A>>>0)){A=i;break}i<<=1}if((-64-A|0)>>>0<=e>>>0)return ar[(t=8708)>>2]=12,(t=0)|t;if(!(i=0|qo(12+(n=e>>>0<11?16:e+11&-8)+A|0)))return(t=0)|t;r=i+-8|0;do{if(i&A+-1){if(e=(f=15<((f=(i+A+-1&0-A)-8|0)-(e=r)|0)>>>0?f:f+A|0)-e|0,o=0|ar[(A=i+-4|0)>>2],i=(-8&o)-e|0,3&o){ar[(o=f+4|0)>>2]=i|1&ar[o>>2]|2,ar[(i=f+i+4|0)>>2]=1|ar[i>>2],ar[A>>2]=e|1&ar[A>>2]|2,ar[o>>2]=1|ar[o>>2],ea(r,e),e=A=f;break}ar[f>>2]=(0|ar[r>>2])+e,ar[f+4>>2]=i,e=A=f;break}e=A=r}while(0);3&(i=0|ar[(A=A+4|0)>>2])|0&&(t=-8&i)>>>0>(n+16|0)>>>0&&(o=t-n|0,t=e+n|0,ar[A>>2]=n|1&i|2,ar[t+4>>2]=3|o,ar[(n=t+o+4|0)>>2]=1|ar[n>>2],ea(t,o));return 0|(o=e+8|0)}(A,e))}function ia(A){return 4294963200<(A|=0)>>>0&&(ar[8708>>2]=0-A,A=-1),0|A}function fa(){return 8708}function na(A,e,r){e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0;c=ur=(o=ur)+31&-32,ur=ur+48|0,t=c+16|0,c=(l=c)+32|0,a=0|ar[(f=(A|=0)+28|0)>>2],ar[c>>2]=a,a=(0|ar[(n=A+20|0)>>2])-a|0,ar[c+4>>2]=a,ar[c+8>>2]=e,a=a+(ar[c+12>>2]=r)|0,i=A+60|0,ar[l>>2]=ar[i>>2],ar[l+4>>2]=c,ar[l+8>>2]=2,l=0|ia(0|F(146,0|l));A:do{if((0|a)!=(0|l)){for(e=2;!((0|l)<0);)if(a=a-l|0,e=((s=(b=0|ar[c+4>>2])>>>0<l>>>0)<<31>>31)+e|0,b=l-(s?b:0)|0,ar[(c=s?c+8|0:c)>>2]=(0|ar[c>>2])+b,ar[(s=c+4|0)>>2]=(0|ar[s>>2])-b,ar[t>>2]=ar[i>>2],ar[4+t>>2]=c,ar[8+t>>2]=e,(0|a)==(0|(l=0|ia(0|F(146,0|t))))){u=3;break A}ar[A+16>>2]=0,ar[f>>2]=0,ar[n>>2]=0,ar[A>>2]=32|ar[A>>2],r=2==(0|e)?0:r-(0|ar[c+4>>2])|0}else u=3}while(0);return 3==(0|u)&&(b=0|ar[A+44>>2],ar[A+16>>2]=b+(0|ar[A+48>>2]),ar[f>>2]=b,ar[n>>2]=b),ur=o,0|r}function ta(A){var e,r=0,i=0;e=A|=0;A:do{if(3&e)for(r=e;;){if(!(0|tr[A>>0])){A=r;break A}if(!(3&(r=A=A+1|0))){i=4;break}}else i=4}while(0);if(4==(0|i)){for(;!((-2139062144&(r=0|ar[A>>2])^-2139062144)&r+-16843009);)A=A+4|0;if((255&r)<<24>>24)for(;0!=(0|tr[(A=A+1|0)>>0]););}return A-e|0}function oa(A,e){e|=0;var r=0,i=0;if(r=0|tr[(A|=0)>>0],i=0|tr[e>>0],r<<24>>24==0||r<<24>>24!=i<<24>>24)A=i;else{for(;e=e+1|0,r=0|tr[(A=A+1|0)>>0],i=0|tr[e>>0],r<<24>>24!=0&&r<<24>>24==i<<24>>24;);A=i}return(255&r)-(255&A)|0}function aa(A,e,r){A|=0;var i=0,f=0,n=0,t=0;n=255&(e|=0),i=0!=(0|(r|=0));A:do{if(i&0!=(3&A|0))for(f=255&e;;){if((0|tr[A>>0])==f<<24>>24){t=6;break A}if(!((i=0!=(0|(r=r+-1|0)))&0!=(3&(A=A+1|0)|0))){t=5;break}}else t=5}while(0);5==(0|t)&&(i?t=6:r=0);A:do{if(6==(0|t)&&(f=255&e,(0|tr[A>>0])!=f<<24>>24)){i=0|sr(n,16843009);e:do{if(3<r>>>0){for(;!((-2139062144&(n=ar[A>>2]^i)^-2139062144)&n+-16843009|0);)if(A=A+4|0,(r=r+-4|0)>>>0<=3){t=11;break e}}else t=11}while(0);if(11==(0|t)&&!r){r=0;break}for(;;){if((0|tr[A>>0])==f<<24>>24)break A;if(A=A+1|0,!(r=r+-1|0)){r=0;break}}}}while(0);return 0|(0|r?A:0)}function ca(A,e){A|=0;var r=0,i=0,f=0;i=255&(e|=0);A:do{if(i){if(3&A){r=255&e;do{if((f=0|tr[A>>0])<<24>>24==0||f<<24>>24==r<<24>>24)break A;A=A+1|0}while(0!=(3&A|0))}i=0|sr(i,16843009),r=0|ar[A>>2];e:do{if(!((-2139062144&r^-2139062144)&r+-16843009))do{if((-2139062144&(f=r^i)^-2139062144)&f+-16843009|0)break e;r=0|ar[(A=A+4|0)>>2]}while(!((-2139062144&r^-2139062144)&r+-16843009|0))}while(0);for(r=255&e;(f=0|tr[A>>0])<<24>>24!=0&&f<<24>>24!=r<<24>>24;)A=A+1|0}else A=A+(0|ta(A))|0}while(0);return 0|A}function la(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n;return n=ur=(f=ur)+31&-32,ur=ur+16|0,ar[n>>2]=i,i=0|ua(A,e,r,n),ur=f,0|i}function ua(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0,a=0,c=0,l=0;for(l=ur=(n=ur)+31&-32,ur=ur+128|0,t=l+124|0,a=9148,f=(o=l)+124|0;ar[o>>2]=ar[a>>2],a=a+4|0,(0|(o=o+4|0))<(0|f););return 2147483646<(e+-1|0)>>>0?e?(ar[(e=8708)>>2]=75,e=-1):(A=t,e=1,c=4):c=4,4==(0|c)&&(c=(c=-2-A|0)>>>0<e>>>0?c:e,ar[l+48>>2]=c,ar[(t=l+20|0)>>2]=A,e=(ar[l+44>>2]=A)+c|0,ar[(A=l+16|0)>>2]=e,ar[l+28>>2]=e,e=0|sa(l,r,i),c&&(l=0|ar[t>>2],tr[l+(((0|l)==(0|ar[A>>2]))<<31>>31)>>0]=0)),ur=n,0|e}function sa(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;for(k=ur=(t=ur)+31&-32,ur=ur+224|0,i=k+120|0,f=k+80|0,k=(n=k)+136|0,a=(o=f)+40|0;(0|(o=o+4|(ar[o>>2]=0)))<(0|a););return ar[i>>2]=ar[r>>2],r=(0|ba(0,e,i,n,f))<0?-1:(d=-1<(0|ar[A+76>>2])?0|da():0,b=32&(r=0|ar[A>>2]),(0|tr[A+74>>0])<1&&(ar[A>>2]=-33&r),0|ar[(o=A+48|0)>>2]?r=0|ba(A,e,i,n,f):(c=0|ar[(a=A+44|0)>>2],ar[a>>2]=k,ar[(l=A+28|0)>>2]=k,ar[(u=A+20|0)>>2]=k,ar[o>>2]=80,ar[(s=A+16|0)>>2]=k+80,r=0|ba(A,e,i,n,f),c&&(ns[63&ar[A+36>>2]](A,0,0),r=0==(0|ar[u>>2])?-1:r,ar[a>>2]=c,ar[o>>2]=0,ar[s>>2]=0,ar[l>>2]=0,ar[u>>2]=0)),o=0|ar[A>>2],ar[A>>2]=o|b,0|d&&ka(),0==(32&o|0)?r:-1),ur=t,0|r}function ba(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0;B=ur=(s=ur)+31&-32,ur=ur+64|0,c=B+16|0,I=(l=B)+24|0,u=B+8|0,B=B+20|0,ar[c>>2]=e,n=0!=(0|A),o=t=I+40|0,I=I+39|0,a=4+u|0,v=b=d=0;A:for(;;){do{if(-1<(0|b)){if((2147483647-b|0)<(0|d)){ar[(b=8708)>>2]=75,b=-1;break}b=d+b|0;break}}while(0);if(!((d=0|tr[e>>0])<<24>>24)){W=87;break}k=e;e:for(;;){switch(d<<24>>24){case 37:d=k,W=9;break e;case 0:d=k;break e}C=k+1|0,ar[c>>2]=C,d=0|tr[C>>0],k=C}e:do{if(9==(0|W))for(;;){if(37!=((W=0)|tr[k+1>>0]))break e;if(d=d+1|0,k=k+2|0,ar[c>>2]=k,37!=(0|tr[k>>0]))break;W=9}}while(0);if(d=d-e|0,n&&ha(A,e,d),0|d)e=k;else{(d=(0|tr[(h=k+1|0)>>0])-48|0)>>>0<10?(Z=(C=36==(0|tr[k+2>>0]))?d:-1,v=C?1:v,h=C?k+3|0:h):Z=-1,ar[c>>2]=h,k=((d=0|tr[h>>0])<<24>>24)-32|0;e:do{if(k>>>0<32)for(w=0,g=d;;){if(!(75913&(d=1<<k))){d=g;break e}if(w|=d,h=h+1|0,ar[c>>2]=h,32<=(k=((d=0|tr[h>>0])<<24>>24)-32|0)>>>0)break;g=d}else w=0}while(0);if(d<<24>>24==42){if((d=(0|tr[(k=h+1|0)>>0])-48|0)>>>0<10&&36==(0|tr[h+2>>0]))ar[f+(d<<2)>>2]=10,d=0|ar[i+((0|tr[k>>0])-48<<3)>>2],v=1,h=h+3|0;else{if(0|v){b=-1;break}h=(v=n?(v=3+(0|ar[r>>2])&-4,d=0|ar[v>>2],ar[r>>2]=v+4,0):d=0,k)}ar[c>>2]=h,d=(C=(0|d)<0)?0-d|0:d,w=C?8192|w:w}else{if((0|(d=0|wa(c)))<0){b=-1;break}h=0|ar[c>>2]}do{if(46==(0|tr[h>>0])){if(42!=(0|tr[h+1>>0])){ar[c>>2]=h+1,k=0|wa(c),h=0|ar[c>>2];break}if((k=(0|tr[(g=h+2|0)>>0])-48|0)>>>0<10&&36==(0|tr[h+3>>0])){ar[f+(k<<2)>>2]=10,k=0|ar[i+((0|tr[g>>0])-48<<3)>>2],h=h+4|0,ar[c>>2]=h;break}if(0|v){b=-1;break A}n?(C=3+(0|ar[r>>2])&-4,k=0|ar[C>>2],ar[r>>2]=C+4):k=0,h=ar[c>>2]=g}else k=-1}while(0);for(y=0;;){if(57<((0|tr[h>>0])-65|0)>>>0){b=-1;break A}if(C=h+1|0,ar[c>>2]=C,!(((m=255&(g=0|tr[(0|tr[h>>0])-65+(43528+(58*y|0))>>0]))+-1|0)>>>0<8))break;y=m,h=C}if(!(g<<24>>24)){b=-1;break}p=-1<(0|Z);do{if(g<<24>>24==19){if(p){b=-1;break A}W=49}else{if(p){ar[f+(Z<<2)>>2]=m,Z=0|ar[(p=i+(Z<<3)|0)+4>>2],ar[(W=l)>>2]=ar[p>>2],ar[W+4>>2]=Z,W=49;break}if(!n){b=0;break A}va(l,m,r)}}while(0);if(49!=(0|W)||(W=0,n)){h=0!=(0|y)&3==(15&(h=0|tr[h>>0])|0)?-33&h:h,p=-65537&w,Z=0==(8192&w|0)?w:p;e:do{switch(0|h){case 110:switch((255&y)<<24>>24){case 0:case 1:ar[ar[l>>2]>>2]=b,d=0,e=C;continue A;case 2:d=0|ar[l>>2],ar[d>>2]=b,ar[d+4>>2]=((0|b)<0)<<31>>31,d=0,e=C;continue A;case 3:or[ar[l>>2]>>1]=b,d=0,e=C;continue A;case 4:tr[ar[l>>2]>>0]=b,d=0,e=C;continue A;case 6:ar[ar[l>>2]>>2]=b,d=0,e=C;continue A;case 7:d=0|ar[l>>2],ar[d>>2]=b,ar[d+4>>2]=((0|b)<0)<<31>>31,d=0,e=C;continue A;default:d=0,e=C;continue A}case 112:h=120,k=8<k>>>0?k:8,e=8|Z,W=61;break;case 88:case 120:e=Z,W=61;break;case 111:g=43992,k=(w=0)==(8&Z|0)|(0|(p=o-(m=0|ma(e=0|ar[(h=l)>>2],h=0|ar[h+4>>2],t))|0))<(0|k)?k:p+1|0,p=Z,W=67;break;case 105:case 100:if(e=0|ar[(h=l)>>2],(0|(h=0|ar[h+4>>2]))<0){e=0|gu(0,0,0|e,0|h),h=D,ar[(w=l)>>2]=e,ar[w+4>>2]=h,w=1,g=43992,W=66;break e}w=0!=(2049&Z|0)&1,g=0==(2048&Z|0)?0==(1&Z|0)?43992:43994:43993,W=66;break e;case 117:g=43992,e=(w=0)|ar[(h=l)>>2],h=0|ar[h+4>>2],W=66;break;case 99:tr[I>>0]=ar[l>>2],e=I,w=0,g=43992,m=t,h=1,k=p;break;case 109:h=0|ya(0|ar[(h=8708)>>2]),W=71;break;case 115:h=0|(h=0|ar[l>>2])?h:44002,W=71;break;case 67:ar[u>>2]=ar[l>>2],ar[a>>2]=0,m=-1,h=ar[l>>2]=u,W=75;break;case 83:e=0|ar[l>>2],W=k?(m=k,h=e,75):(Za(A,32,d,0,Z),e=0,84);break;case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:d=0|Wa(A,+J[l>>3],d,k,Z,h),e=C;continue A;default:w=0,g=43992,m=t,h=k,k=Z}}while(0);e:do{if(61==(0|W))m=0|ga(y=0|ar[(Z=l)>>2],Z=0|ar[Z+4>>2],t,32&h),w=(g=0==(8&e|0)|0==(0|y)&0==(0|Z))?0:2,g=g?43992:43992+(h>>4)|0,p=e,e=y,h=Z,W=67;else if(66==(0|W))m=0|pa(e,h,t),p=Z,W=67;else if(71==(0|W))w=W=0,g=43992,m=(y=0==(0|(Z=0|aa(e=h,0,k))))?h+k|0:Z,h=y?k:Z-h|0,k=p;else if(75==(0|W)){for(g=h,k=e=W=0;(w=0|ar[g>>2])&&!((0|(k=0|Ca(B,w)))<0|(m-e|0)>>>0<k>>>0)&&(e=k+e|0)>>>0<m>>>0;)g=g+4|0;if((0|k)<0){b=-1;break A}if(Za(A,32,d,e,Z),e)for(w=0;;){if(!(k=0|ar[h>>2])){W=84;break e}if((0|e)<(0|(w=(k=0|Ca(B,k))+w|0))){W=84;break e}if(ha(A,B,k),e>>>0<=w>>>0){W=84;break}h=h+4|0}else e=0,W=84}}while(0);if(67==(0|W))Z=(W=0)!=(0|k)|(h=0!=(0|e)|0!=(0|h)),h=o-m+(1&(1^h))|0,e=Z?m:t,m=t,h=!Z||(0|h)<(0|k)?k:h,k=-1<(0|k)?-65537&p:p;else if(84==(0|W)){W=0,Za(A,32,d,e,8192^Z),d=(0|e)<(0|d)?d:e,e=C;continue}Za(A,32,d=(0|d)<(0|(Z=(p=(0|h)<(0|(y=m-e|0))?y:h)+w|0))?Z:d,Z,k),ha(A,g,w),Za(A,48,d,Z,65536^k),Za(A,48,p,y,0),ha(A,e,y),Za(A,32,d,Z,8192^k),e=C}else d=0,e=C}}A:do{if(87==(0|W)&&!A)if(v){for(b=1;e=0|ar[f+(b<<2)>>2];)if(va(i+(b<<3)|0,e,r),10<=(0|(b=b+1|0))){b=1;break A}for(;;){if(0|ar[f+(b<<2)>>2]){b=-1;break A}if(10<=(0|(b=b+1|0))){b=1;break}}}else b=0}while(0);return ur=s,0|b}function da(){return 0}function ka(){0}function ha(A,e,r){e|=0,r|=0,32&ar[(A|=0)>>2]||Va(e,r,A)}function wa(A){var e=0,r=0,i=0;if(r=0|ar[(A|=0)>>2],(i=(0|tr[r>>0])-48|0)>>>0<10)for(e=0;e=i+(10*e|0)|0,r=r+1|0,ar[A>>2]=r,(i=(0|tr[r>>0])-48|0)>>>0<10;);else e=0;return 0|e}function va(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0,n=0;A:do{if(e>>>0<=20){switch(0|e){case 9:i=3+(0|ar[r>>2])&-4,e=0|ar[i>>2],ar[r>>2]=i+4,ar[A>>2]=e;break A;case 10:i=3+(0|ar[r>>2])&-4,e=0|ar[i>>2],ar[r>>2]=i+4,ar[(i=A)>>2]=e,ar[i+4>>2]=((0|e)<0)<<31>>31;break A;case 11:i=3+(0|ar[r>>2])&-4,e=0|ar[i>>2],ar[r>>2]=i+4,ar[(i=A)>>2]=e,ar[i+4>>2]=0;break A;case 12:i=7+(0|ar[r>>2])&-8,f=0|ar[(e=i)>>2],e=0|ar[e+4>>2],ar[r>>2]=i+8,ar[(i=A)>>2]=f,ar[i+4>>2]=e;break A;case 13:f=3+(0|ar[r>>2])&-4,i=0|ar[f>>2],ar[r>>2]=f+4,i=(65535&i)<<16>>16,ar[(f=A)>>2]=i,ar[f+4>>2]=((0|i)<0)<<31>>31;break A;case 14:f=3+(0|ar[r>>2])&-4,i=0|ar[f>>2],ar[r>>2]=f+4,ar[(f=A)>>2]=65535&i,ar[f+4>>2]=0;break A;case 15:f=3+(0|ar[r>>2])&-4,i=0|ar[f>>2],ar[r>>2]=f+4,i=(255&i)<<24>>24,ar[(f=A)>>2]=i,ar[f+4>>2]=((0|i)<0)<<31>>31;break A;case 16:f=3+(0|ar[r>>2])&-4,i=0|ar[f>>2],ar[r>>2]=f+4,ar[(f=A)>>2]=255&i,ar[f+4>>2]=0;break A;case 17:case 18:f=7+(0|ar[r>>2])&-8,n=+J[f>>3],ar[r>>2]=f+8,J[A>>3]=n;break A;default:break A}}}while(0)}function ga(A,e,r,i){if(r|=0,i|=0,!(0==(0|(A|=0))&0==(0|(e|=0))))for(;tr[(r=r+-1|0)>>0]=0|cr[44040+(15&A)>>0]|i,!(0==(0|(A=0|Wu(0|A,0|e,4)))&0==(0|(e=D))););return 0|r}function ma(A,e,r){if(r|=0,!(0==(0|(A|=0))&0==(0|(e|=0))))for(;tr[(r=r+-1|0)>>0]=7&A|48,!(0==(0|(A=0|Wu(0|A,0|e,3)))&0==(0|(e=D))););return 0|r}function pa(A,e,r){r|=0;var i=0;if(0<(e|=0)>>>0|0==(0|e)&4294967295<(A|=0)>>>0){for(;i=0|Zu(0|A,0|e,10,0),tr[(r=r+-1|0)>>0]=255&i|48,A=0|yu(0|(i=A),0|e,10,0),9<e>>>0|9==(0|e)&4294967295<i>>>0;)e=D;e=A}else e=A;if(e)for(;tr[(r=r+-1|0)>>0]=(e>>>0)%10|48,!(e>>>0<10);)e=(e>>>0)/10|0;return 0|r}function ya(A){return 0|function(A,e){A|=0,e|=0;var r=0,i=0;i=0;for(;;){if((0|cr[44058+i>>0])==(0|A)){A=2;break}if(87==(0|(r=i+1|0))){r=44146,i=87,A=5;break}i=r}2==(0|A)&&(i?(r=44146,A=5):r=44146);if(5==(0|A))for(;;){for(;r=(A=r)+1|0,0!=(0|tr[A>>0]););if(!(i=i+-1|0))break;A=5}return 0|function(A,e){return 0|function(A,e){A|=0,e=(e|=0)?0|function(A,e,r){e|=0,r|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;i=1794895138+(0|ar[(A|=0)>>2])|0,t=0|Ga(0|ar[A+8>>2],i),f=0|Ga(0|ar[A+12>>2],i),n=0|Ga(0|ar[A+16>>2],i);A:do{if(t>>>0<e>>>2>>>0&&(s=e-(t<<2)|0,f>>>0<s>>>0&n>>>0<s>>>0)&&0==(3&(n|f)|0)){for(s=f>>>2,u=n>>>2,l=0;;){if(f=0|Ga(0|ar[A+((n=(o=(c=l+(a=t>>>1)|0)<<1)+s|0)<<2)>>2],i),!((n=0|Ga(0|ar[A+(n+1<<2)>>2],i))>>>0<e>>>0&f>>>0<(e-n|0)>>>0)){f=0;break A}if(0|tr[A+(n+f)>>0]){f=0;break A}if(!(f=0|oa(r,A+n|0)))break;if(f=(0|f)<0,1==(0|t)){f=0;break A}l=f?l:c,t=f?a:t-a|0}n=0|Ga(0|ar[A+((f=o+u|0)<<2)>>2],i),f=(f=0|Ga(0|ar[A+(f+1<<2)>>2],i))>>>0<e>>>0&n>>>0<(e-f|0)>>>0&&0==(0|tr[A+(f+n)>>0])?A+f|0:0}else f=0}while(0);return 0|f}(0|ar[e>>2],0|ar[e+4>>2],A):0;return 0|(0|e?e:A)}(A|=0,e|=0)}(r,0|ar[e+20>>2])}(A|=0,0|ar[2208])}function Za(A,e,r,i,f){A|=0,e|=0;var n,t;if(n=ur=(t=ur)+31&-32,ur=ur+256|0,(0|(i|=0))<(0|(r|=0))&0==(73728&(f|=0)|0)){if(Vu(0|n,0|e,0|((f=r-i|0)>>>0<256?f:256)),255<f>>>0){for(e=r-i|0;ha(A,n,256),255<(f=f+-256|0)>>>0;);f=255&e}ha(A,n,f)}ur=t}function Ca(A,e){return e|=0,0|(A=(A|=0)?0|Ea(A,e):0)}function Wa(A,e,r,i,f,n){A|=0,e=+e,r|=0,i|=0,f|=0,n|=0;var t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;l=ur=(t=ur)+31&-32,ur=ur+560|0,c=l+8|0,B=E=(w=l)+524|0,I=(l=l+512|0)+12|(ar[w>>2]=0),Ia(e),Z=(0|D)<0?(e=-e,C=1,44009):(C=0!=(2049&f|0)&1,0==(2048&f|0)?0==(1&f|0)?44010:44015:44012),Ia(e),W=2146435072&D;do{if(W>>>0<2146435072|2146435072==(0|W)&!1){if((o=0!=(d=2*Ba(e,w)))&&(ar[w>>2]=(0|ar[w>>2])-1),97==(0|(g=32|n))){b=0==(0|(k=32&n))?Z:Z+9|0,s=2|C,o=12-i|0;do{if(!(11<i>>>0|0==(0|o))){for(e=8;e*=16,0!=(0|(o=o+-1|0)););if(45==(0|tr[b>>0])){e=-(e+(-d-e));break}e=d+e-e;break}e=d}while(0);for((0|(o=0|pa(o=(0|(a=0|ar[w>>2]))<0?0-a|0:a,((0|o)<0)<<31>>31,I)))==(0|I)&&(tr[(o=l+11|0)>>0]=48),tr[o+-1>>0]=43+(a>>31&2),tr[(u=o+-2|0)>>0]=n+15,l=(0|i)<1,c=0==(8&f|0),o=E;W=~~e,a=o+1|0,tr[o>>0]=cr[44040+W>>0]|k,e=16*(e-(0|W)),o=1!=(a-B|0)||c&l&0==e?a:(tr[a>>0]=46,o+2|0),0!=e;);W=o-B|0,Za(A,32,r,o=(B=I-u|0)+s+(I=0!=(0|i)&(W+-2|0)<(0|i)?i+2|0:W)|0,f),ha(A,b,s),Za(A,48,r,o,65536^f),ha(A,E,W),Za(A,48,I-W|0,0,0),ha(A,u,B),Za(A,32,r,o,8192^f);break}for(a=(0|i)<0?6:i,o?(o=(0|ar[w>>2])-28|0,ar[w>>2]=o,e=268435456*d):(e=d,o=0|ar[w>>2]),c=W=(0|o)<0?c:c+288|0;p=~~e>>>0,ar[c>>2]=p,c=c+4|0,0!=(e=1e9*(e-(p>>>0))););if(0<(0|o))for(l=W,s=c;;){if(u=(0|o)<29?o:29,l>>>0<=(o=s+-4|0)>>>0){for(c=0;v=0|Zu(0|(m=0|vu(0|(m=0|Iu(0|ar[o>>2],0,0|u)),0|D,0|c,0)),0|(p=D),1e9,0),ar[o>>2]=v,c=0|yu(0|m,0|p,1e9,0),l>>>0<=(o=o+-4|0)>>>0;);c&&(ar[(l=l+-4|0)>>2]=c)}for(c=s;!(c>>>0<=l>>>0||0|ar[(o=c+-4|0)>>2]);)c=o;if(o=(0|ar[w>>2])-u|0,!(0<(0|(ar[w>>2]=o))))break;s=c}else l=W;if((0|o)<0){i=1+((a+25|0)/9|0)|0,h=102==(0|g);do{if(k=(0|(k=0-o|0))<9?k:9,l>>>0<c>>>0){for(u=(1<<k)-1|0,s=1e9>>>k,b=0,o=l;p=0|ar[o>>2],ar[o>>2]=(p>>>k)+b,b=0|sr(p&u,s),(o=o+4|0)>>>0<c>>>0;);o=0==(0|ar[l>>2])?l+4|0:l,o=b?(ar[c>>2]=b,l=o,c+4|0):(l=o,c)}else l=0==(0|ar[l>>2])?l+4|0:l,o=c;c=(0|i)<(o-(c=h?W:l)>>2|0)?c+(i<<2)|0:o,o=(0|ar[w>>2])+k|0,ar[w>>2]=o}while((0|o)<0);o=l,i=c}else o=l,i=c;if(p=W,o>>>0<i>>>0){if(c=9*(p-o>>2)|0,10<=(u=0|ar[o>>2])>>>0)for(l=10;c=c+1|0,(l=10*l|0)>>>0<=u>>>0;);}else c=0;if((0|(l=a-(102!=(0|g)?c:0)+(((v=0!=(0|a))&(h=103==(0|g)))<<31>>31)|0))<((9*(i-p>>2)|0)-9|0)){if(k=W+4+(((0|(l=l+9216|0))/9|0)-1024<<2)|0,(0|(l=1+((0|l)%9|0)|0))<9)for(u=10;u=10*u|0,9!=(0|(l=l+1|0)););else u=10;if((l=(k+4|0)==(0|i))&0==(0|(b=((s=0|ar[k>>2])>>>0)%(u>>>0)|0)))l=k;else if(d=0==(1&((s>>>0)/(u>>>0)|0)|0)?9007199254740992:9007199254740994,e=b>>>0<(m=(0|u)/2|0)>>>0?.5:l&(0|b)==(0|m)?1:1.5,C&&(e=(m=45==(0|tr[Z>>0]))?-e:e,d=m?-d:d),l=s-b|0,ar[k>>2]=l,d+e!=d){if(m=l+u|0,999999999<(ar[k>>2]=m)>>>0)for(c=k;(l=c+-4|0)>>>(ar[c>>2]=0)<o>>>0&&(ar[(o=o+-4|0)>>2]=0),m=1+(0|ar[l>>2])|0,999999999<(ar[l>>2]=m)>>>0;)c=l;else l=k;if(c=9*(p-o>>2)|0,10<=(s=0|ar[o>>2])>>>0)for(u=10;c=c+1|0,(u=10*u|0)>>>0<=s>>>0;);}else l=k;l=(l=l+4|0)>>>0<i>>>0?l:i,m=o}else l=i,m=o;for(g=l;;){if(g>>>0<=m>>>0){w=0;break}if(0|ar[(o=g+-4|0)>>2]){w=1;break}g=o}i=0-c|0;do{if(h){if(a=(0|c)<(0|(o=(1&(1^v))+a|0))&-5<(0|c)?(u=n+-1|0,o+-1-c|0):(u=n+-2|0,o+-1|0),!(o=8&f)){if(w&&0!=(0|(y=0|ar[g+-4>>2])))if((y>>>0)%10|0)l=0;else for(l=0,o=10;l=l+1|0,!((y>>>0)%((o=10*o|0)>>>0)|0););else l=9;if(o=(9*(g-p>>2)|0)-9|0,102==(32|u)){a=(0|a)<(0|(k=0<(0|(k=o-l|0))?k:0))?a:k,k=0;break}a=(0|a)<(0|(k=0<(0|(k=o+c-l|0))?k:0))?a:k,k=0;break}k=o}else u=n,k=8&f}while(0);if(s=0!=(0|(h=a|k))&1,b=102==(32|u))o=(v=0)<(0|c)?c:0;else{if(((l=I)-(o=0|pa(o=(0|c)<0?i:c,((0|o)<0)<<31>>31,I))|0)<2)for(;tr[(o=o+-1|0)>>0]=48,(l-o|0)<2;);tr[o+-1>>0]=43+(c>>31&2),tr[(o=o+-2|0)>>0]=u,o=l-(v=o)|0}if(Za(A,32,r,o=C+1+a+s+o|0,f),ha(A,Z,C),Za(A,48,r,o,65536^f),b){s=k=E+9|0,b=E+8|0,l=u=W>>>0<m>>>0?W:m;do{if(c=0|pa(0|ar[l>>2],0,k),(0|l)==(0|u))(0|c)==(0|k)&&(tr[b>>0]=48,c=b);else if(E>>>0<c>>>0)for(Vu(0|E,48,c-B|0);E>>>0<(c=c+-1|0)>>>0;);ha(A,c,s-c|0),l=l+4|0}while(l>>>0<=W>>>0);if(0|h&&ha(A,44056,1),l>>>0<g>>>0&0<(0|a))for(;;){if(E>>>0<(c=0|pa(0|ar[l>>2],0,k))>>>0)for(Vu(0|E,48,c-B|0);E>>>0<(c=c+-1|0)>>>0;);if(ha(A,c,(0|a)<9?a:9),c=a+-9|0,!((l=l+4|0)>>>0<g>>>0&9<(0|a))){a=c;break}a=c}Za(A,48,a+9|0,9,0)}else{if(h=w?g:m+4|0,-1<(0|a)){k=0==(0|k),i=w=E+9|0,s=0-B|0,b=E+8|0,u=m;do{(0|(c=0|pa(0|ar[u>>2],0,w)))==(0|w)&&(tr[b>>0]=48,c=b);do{if((0|u)==(0|m)){if(l=c+1|0,ha(A,c,1),k&(0|a)<1){c=l;break}ha(A,44056,1),c=l}else{if(c>>>0<=E>>>0)break;for(Vu(0|E,48,c+s|0);E>>>0<(c=c+-1|0)>>>0;);}}while(0);ha(A,c,(0|(B=i-c|0))<(0|a)?B:a),a=a-B|0,u=u+4|0}while(u>>>0<h>>>0&-1<(0|a))}Za(A,48,a+18|0,18,0),ha(A,v,I-v|0)}Za(A,32,r,o,8192^f)}else E=0!=(32&n|0),Za(A,32,r,o=C+3|0,-65537&f),ha(A,Z,C),ha(A,e!=e|!1?E?46225:44036:E?44028:44032,3),Za(A,32,r,o,8192^f)}while(0);return ur=t,0|((0|o)<(0|r)?r:o)}function Ia(A){A=+A;var e;return J[d>>3]=A,e=0|ar[d>>2],D=0|ar[d+4>>2],0|e}function Ba(A,e){return+ +function A(e,r){e=+e;r|=0;var i=0,f=0,n=0;J[d>>3]=e;i=0|ar[d>>2];f=0|ar[d+4>>2];n=0|Wu(0|i,0|f,52);switch(2047&n){case 0:i=0!=e?(e=+A(0x10000000000000000*e,r),(0|ar[r>>2])-64|0):0,ar[r>>2]=i;break;case 2047:break;default:ar[r>>2]=(2047&n)-1022,ar[d>>2]=i,ar[d+4>>2]=-2146435073&f|1071644672,e=+J[d>>3]}return+e}(A=+A,e|=0)}function Ea(A,e){A|=0,e|=0;do{if(A){if(e>>>0<128){tr[A>>0]=e,A=1;break}if(!(0|ar[ar[8832>>2]>>2])){if(57216==(-128&e|0)){tr[A>>0]=e,A=1;break}ar[(A=8708)>>2]=84,A=-1;break}if(e>>>0<2048){tr[A>>0]=e>>>6|192,tr[A+1>>0]=63&e|128,A=2;break}if(e>>>0<55296|57344==(-8192&e|0)){tr[A>>0]=e>>>12|224,tr[A+1>>0]=e>>>6&63|128,tr[A+2>>0]=63&e|128,A=3;break}if((e+-65536|0)>>>0<1048576){tr[A>>0]=e>>>18|240,tr[A+1>>0]=e>>>12&63|128,tr[A+2>>0]=e>>>6&63|128,tr[A+3>>0]=63&e|128,A=4;break}ar[(A=8708)>>2]=84,A=-1;break}A=1}while(0);return 0|A}function Ga(A,e){var r;return r=0|Bu(0|(A|=0)),0|(0==(0|(e|=0))?A:r)}function Va(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0,o=0;(f=0|ar[(i=(r|=0)+16|0)>>2])?n=5:0|Xa(r)?i=0:(f=0|ar[i>>2],n=5);A:do{if(5==(0|n)){if((f-(i=t=0|ar[(o=r+20|0)>>2])|0)>>>0<e>>>0){i=0|ns[63&ar[r+36>>2]](r,A,e);break}e:do{if(-1<(0|tr[r+75>>0])){for(t=e;;){if(!t){n=0,f=A;break e}if(10==(0|tr[A+(f=t+-1|0)>>0]))break;t=f}if((i=0|ns[63&ar[r+36>>2]](r,A,t))>>>0<t>>>0)break A;f=A+(n=t)|0,e=e-t|0,i=0|ar[o>>2]}else n=0,f=A}while(0);Eu(0|i,0|f,0|e),ar[o>>2]=(0|ar[o>>2])+e,i=n+e|0}}while(0);return 0|i}function Xa(A){var e=0,r=0;return r=0|tr[(e=(A|=0)+74|0)>>0],tr[e>>0]=r+255|r,0|(A=8&(e=0|ar[A>>2])?(ar[A>>2]=32|e,-1):(ar[A+8>>2]=0,r=(ar[A+4>>2]=0)|ar[A+44>>2],ar[A+28>>2]=r,ar[A+20>>2]=r,ar[A+16>>2]=r+(0|ar[A+48>>2]),0))}function _a(A,e,r){var i,f,n;return 0|(0|(i=A|=0,f=e|=0,n=r|=0,0|(n=0|Fa(i|=0,f|=0,n|=0,-1,-1))))}function Fa(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a;return t=ur=(a=ur)+31&-32,ur=ur+128|0,ar[t>>2]=0,ar[(o=4+t|0)>>2]=A,ar[44+t>>2]=A,ar[(n=8+t|0)>>2]=(0|A)<0?-1:A+2147483647|0,ar[76+t>>2]=-1,Na(t,0),r=0|Ra(t,r,1,i,f),0|e&&(ar[e>>2]=A+((0|ar[o>>2])+(0|ar[108+t>>2])-(0|ar[n>>2]))),ur=a,0|r}function Na(A,e){e|=0;var r,i,f;ar[(A|=0)+104>>2]=e,f=(r=0|ar[A+8>>2])-(i=0|ar[A+4>>2])|0,ar[A+108>>2]=f,ar[A+100>>2]=0!=(0|e)&(0|e)<(0|f)?i+e|0:r}function Ra(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;A:do{if(36<e>>>0)ar[(f=8708)>>2]=22,i=f=0;else{for(d=A+4|0,b=A+100|0;0!=(0|Ja(n=(n=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=n+1,0|cr[n>>0]):0|Ya(A))););e:do{switch(0|n){case 43:case 45:if(n=(45==(0|n))<<31>>31,(t=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0){ar[d>>2]=t+1,s=n,n=0|cr[t>>0];break e}s=n,n=0|Ya(A);break e;default:s=0}}while(0);t=0==(0|e);do{if(16==(16|e)&48==(0|n)){if(120!=(32|(n=(n=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=n+1,0|cr[n>>0]):0|Ya(A)))){if(t){e=8,l=46;break}l=32;break}if(n=(n=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=n+1,0|cr[n>>0]):0|Ya(A),15<(0|cr[45951+n>>0])){if((i=0!=(0|ar[b>>2]))&&(ar[d>>2]=(0|ar[d>>2])-1),!r){Na(A,0),i=f=0;break A}if(!i){i=f=0;break A}ar[d>>2]=(0|ar[d>>2])-1,i=f=0;break A}e=16,l=46}else{if(e=t?10:e,!((0|cr[45951+n>>0])>>>0<e>>>0)){0|ar[b>>2]&&(ar[d>>2]=(0|ar[d>>2])-1),Na(A,0),ar[(f=8708)>>2]=22,i=f=0;break A}l=32}}while(0);e:do{if(32==(0|l))if(10==(0|e)){if((e=n+-48|0)>>>0<10){for(n=0,t=e;n=(10*n|0)+t|0,(t=(e=(e=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=e+1,0|cr[e>>0]):0|Ya(A))+-48|0)>>>0<10&n>>>0<429496729;);r=0}else e=n,r=n=0;if((o=e+-48|0)>>>0<10){t=e;do{if(e=0|wu(0|n,0|r,10,0),(u=~(c=((0|o)<0)<<31>>31))>>>0<(a=D)>>>0|(0|a)==(0|u)&~o>>>0<e>>>0){e=10,l=72;break e}n=0|vu(0|e,0|a,0|o,0|c),r=D,o=(t=(e=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=e+1,0|cr[e>>0]):0|Ya(A))+-48|0}while(o>>>0<10&(r>>>0<429496729|429496729==(0|r)&n>>>0<2576980378));9<o>>>0?(t=s,e=r):(e=10,l=72)}else t=s,e=r}else l=46}while(0);e:do{if(46==(0|l)){if(!(e+-1&e)){if(l=0|tr[46207+((23*e|0)>>>5&7)>>0],(t=255&(r=0|tr[45951+n>>0]))>>>0<e>>>0){for(n=0,o=t;n=o|n<<l,t=(t=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=t+1,0|cr[t>>0]):0|Ya(A),n>>>0<134217728&(o=255&(r=0|tr[45951+t>>0]))>>>0<e>>>0;);o=0}else t=n,n=o=0;if(a=0|Wu(-1,-1,0|l),e>>>0<=(255&r)>>>0|(c=D)>>>0<o>>>0|(0|o)==(0|c)&a>>>0<n>>>0){r=o,l=72;break}for(t=o;;){if(n=0|Iu(0|n,0|t,0|l),o=D,n|=255&r,t=(t=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=t+1,0|cr[t>>0]):0|Ya(A),e>>>0<=(255&(r=0|tr[45951+t>>0]))>>>0|c>>>0<o>>>0|(0|o)==(0|c)&a>>>0<n>>>0){r=o,l=72;break e}t=o}}if((t=255&(r=0|tr[45951+n>>0]))>>>0<e>>>0){for(n=0,o=t;n=o+(0|sr(n,e))|0,t=(t=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=t+1,0|cr[t>>0]):0|Ya(A),n>>>0<119304647&(o=255&(r=0|tr[45951+t>>0]))>>>0<e>>>0;);o=0}else t=n,o=n=0;if((255&r)>>>0<e>>>0)for(l=0|yu(-1,-1,0|e,0),u=D,c=o;;){if(u>>>0<c>>>0|(0|c)==(0|u)&l>>>0<n>>>0){r=c,l=72;break e}if(o=0|wu(0|n,0|c,0|e,0),4294967295<(a=D)>>>0|-1==(0|a)&~(r&=255)>>>0<o>>>0){r=c,l=72;break e}if(n=0|vu(0|r,0,0|o,0|a),o=D,t=(t=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=t+1,0|cr[t>>0]):0|Ya(A),e>>>0<=(255&(r=0|tr[45951+t>>0]))>>>0){r=o,l=72;break}c=o}else r=o,l=72}}while(0);if(72==(0|l))if((0|cr[45951+t>>0])>>>0<e>>>0){for(;n=(n=0|ar[d>>2])>>>0<(0|ar[b>>2])>>>0?(ar[d>>2]=n+1,0|cr[n>>0]):0|Ya(A),(0|cr[45951+n>>0])>>>0<e>>>0;);ar[(t=8708)>>2]=34,t=0==(1&i|0)&!0?s:0,e=f,n=i}else t=s,e=r;if(0|ar[b>>2]&&(ar[d>>2]=(0|ar[d>>2])-1),!(e>>>0<f>>>0|(0|e)==(0|f)&n>>>0<i>>>0)){if(!(0!=(1&i|0)|!1|0!=(0|t))){ar[(d=8708)>>2]=34,i=0|vu(0|i,0|f,-1,-1),f=D;break}if(f>>>0<e>>>0|(0|e)==(0|f)&i>>>0<n>>>0){ar[(d=8708)>>2]=34;break}}i=0|gu(n^t|0,e^(i=((0|t)<0)<<31>>31)|0,0|t,0|i),f=D}}while(0);return D=f,0|i}function Ya(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0;return!(0!=(0|(t=0|ar[(r=(A|=0)+104|0)>>2]))&&(0|ar[A+108>>2])>=(0|t))&&0<=(0|(e=0|Da(A)))?(i=0|ar[r>>2],r=A+8|0,i?i=((t=n=0|ar[r>>2])-(r=0|ar[A+4>>2])|0)<(0|(i=i-(0|ar[(f=A+108|0)>>2])|0))?n=t:(n=r+(i+-1)|0,t):(f=A+108|0,n=i=0|ar[r>>2],r=0|ar[A+4>>2]),ar[A+100>>2]=n,0|i&&(ar[f>>2]=i+1-r+(0|ar[f>>2])),(0|cr[(r=r+-1|0)>>0])!=(0|e)&&(tr[r>>0]=e)):o=4,4==(0|o)&&(ar[A+100>>2]=0,e=-1),0|e}function Ja(A){return 1&(32==(0|(A|=0))|(A+-9|0)>>>0<5)|0}function Da(A){var e,r;return e=ur=(r=ur)+31&-32,ur=ur+16|0,A=0==(0|Qa(A|=0))&&1==(0|ns[63&ar[A+32>>2]](A,e,1))?0|cr[e>>0]:-1,ur=r,0|A}function Qa(A){var e=0,r=0;return r=0|tr[(e=(A|=0)+74|0)>>0],tr[e>>0]=r+255|r,r=A+28|0,(0|ar[(e=A+20|0)>>2])>>>0>(0|ar[r>>2])>>>0&&ns[63&ar[A+36>>2]](A,0,0),ar[A+16>>2]=0,ar[r>>2]=0,(ar[e>>2]=0)|(e=4&(e=0|ar[A>>2])?(ar[A>>2]=32|e,-1):(r=(0|ar[A+44>>2])+(0|ar[A+48>>2])|0,ar[A+8>>2]=r,ar[A+4>>2]=r,e<<27>>31))}function Ta(A,e,r){var i,f,n;return 0|(0|(i=A|=0,f=e|=0,n=r|=0,0|(n=0|Fa(i|=0,f|=0,n|=0,0,-2147483648))))}function Ma(){return 0|(0|ar[ar[2208]>>2]?4:1)}function Sa(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o;return f=ur=(i=ur)+31&-32,ur=ur+16|0,ar[f>>2]=r,r=0|(n=A,t=e,o=f,0|ua(n|=0,2147483647,t|=0,o|=0)),ur=i,0|r}function Ua(A,e){A|=0,e|=0;var r,i;return i=ur=(r=ur)+31&-32,ur=ur+16|0,ar[i>>2]=A,ar[4+i>>2]=e,e=0|ia(0|Q(91,0|i)),ur=r,0|e}function Oa(A,e,r,i){A|=0,r|=0,i|=0;var f=0,n=0,t=0,o=0,a=0;f=0|ar[(e|=0)>>2],a=0!=(0|i)&&0!=(0|(n=0|ar[i>>2]))?A?(ar[i>>2]=0,o=r,t=f,43):(t=f,i=r,25):5;A:do{if(5==(0|a)){if(i=0!=(0|A),0|ar[ar[(a=8832)>>2]>>2]){if(i){i=r,a=15;break}i=r,a=14;break}if(!i){r=0|ta(f),a=59;break}e:do{if(r){for(i=r;(n=0|tr[f>>0])<<24>>24;){if(f=f+1|0,ar[A>>2]=n<<24>>24&57343,!(i=i+-1|0))break e;A=A+4|0}ar[A>>2]=0,r=r-i|(ar[e>>2]=0),a=59;break A}}while(0);ar[e>>2]=f,a=59}}while(0);A:for(;;){e:do{if(14==(0|a)){for(;;){if(((255&(n=0|tr[f>>0]))-1|0)>>>0<127&&0==(3&f|0)&&(n=255&(a=0|ar[f>>2]),!(-2139062144&(a+-16843009|a)))){for(;i=i+-4|0,!(-2139062144&((n=0|ar[(f=f+4|0)>>2])+-16843009|n)|0););n&=255}if(127<=((n&=255)+-1|0)>>>0)break;f=f+1|0,i=i+-1|0}if(!(50<(n=n+-194|0)>>>0)){n=0|ar[8240+(n<<2)>>2],t=f+1|0,a=25;continue A}a=53}else{if(15==(0|a)){r:do{if(i){for(;;){n=0|tr[f>>0];do{if(((255&n)-1|0)>>>0<127&&4<i>>>0&0==(3&f|0)){for(;;){if(-2139062144&((n=0|ar[f>>2])+-16843009|n)|0){a=38;break}if(ar[A>>2]=255&n,ar[A+4>>2]=cr[f+1>>0],ar[A+8>>2]=cr[f+2>>0],t=f+4|0,n=A+16|0,ar[A+12>>2]=cr[f+3>>0],!(4<(i=i+-4|0)>>>0)){a=37;break}A=n,f=t}if(37==(0|a)){A=n,n=0|tr[(f=t)>>0];break}if(38==(0|a)){n&=255;break}}}while(0);if(127<=((n&=255)+-1|0)>>>0)break;if(f=f+1|0,ar[A>>2]=n,!(i=i+-1|0))break r;A=A+4|0}if(50<(n=n+-194|0)>>>0){a=53;break e}n=0|ar[8240+(n<<2)>>2],o=i,t=f+1|0,a=43;continue A}}while(0);ar[e>>2]=f,a=59;continue A}if(25==(0|a)){if(!(7<((a=(0|cr[t>>0])>>>3)+-16|a+(n>>26))>>>0)){if(f=t+1|0,33554432&n){if((-64&tr[f>>0])<<24>>24!=-128){f=t,a=52;break}if(f=t+2|0,524288&n){if((-64&tr[f>>0])<<24>>24!=-128){f=t,a=52;break}f=t+3|0}}i=i+-1|0,a=14;continue A}f=t,a=52}else if(43==(0|a)){if(!(7<((f=(i=(a=0)|cr[t>>0])>>>3)+-16|f+(n>>26))>>>0)){f=t+1|0,i=i+-128|n<<6;do{if((0|i)<0){if(63<(n=(0|cr[f>>0])-128|0)>>>0){f=t+-1|0,r=A;break e}if(f=t+2|0,(0|(i=n|i<<6))<0){if(63<(n=(0|cr[f>>0])-128|0)>>>0){f=t+-1|0,r=A;break e}f=t+3|0,i=n|i<<6;break}}}while(0);ar[A>>2]=i,A=A+4|0,i=o+-1|0,a=15;continue A}f=t,i=o,a=52}else if(59==(0|a))return 0|r}}while(0);if(52==(0|a)&&(f=f+-1|(a=0),n?r=A:a=53),53==(0|a)){if(!(0|tr[f>>0])){0|A&&(ar[A>>2]=0,ar[e>>2]=0),r=r-i|0,a=59;continue}r=A}ar[(a=8708)>>2]=84,r?(ar[e>>2]=f,r=-1,a=59):(r=-1,a=59)}return 0}function Ha(A){var e=0,r=0,i=0;ar[(A|=0)+76>>2],i=3;do{if(3==(0|i)){if((r=0|ar[(e=A+4|0)>>2])>>>0<(0|ar[A+8>>2])>>>0){ar[e>>2]=r+1,e=0|cr[r>>0];break}e=0|Da(A);break}}while(0);return 0|e}function xa(A,e,r){A|=0,e|=0,r|=0;var i,f;return f=ur=(i=ur)+31&-32,ur=ur+16|0,ar[f>>2]=r,r=0|sa(A,e,f),ur=i,0|r}function ja(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t=0,o=0;f=ur=(n=ur)+31&-32,ur=ur+16|0;A:do{if(A){e:do{if(3<r>>>0){for(i=r,t=0|ar[e>>2];;){if(126<((o=0|ar[t>>2])+-1|0)>>>0){if(!o)break;if(-1==(0|(o=0|Ea(A,o)))){r=-1;break A}A=A+o|0,i=i-o|0}else tr[A>>0]=o,A=A+1|0,i=i+-1|0,t=0|ar[e>>2];if(t=t+4|0,ar[e>>2]=t,i>>>0<=3)break e}tr[A>>0]=0,r=r-i|(ar[e>>2]=0);break A}i=r}while(0);if(i){for(t=0|ar[e>>2];;){if(126<((o=0|ar[t>>2])+-1|0)>>>0){if(!o){t=19;break}if(-1==(0|(o=0|Ea(f,o)))){r=-1;break A}if(i>>>0<o>>>0){t=22;break}Ea(A,0|ar[t>>2]),A=A+o|0,i=i-o|0}else tr[A>>0]=o,A=A+1|0,i=i+-1|0,t=0|ar[e>>2];if(t=t+4|0,ar[e>>2]=t,!i)break A}if(19==(0|t)){tr[A>>0]=0,r=r-i|(ar[e>>2]=0);break}if(22==(0|t)){r=r-i|0;break}}}else if(r=0|ar[e>>2],i=0|ar[r>>2]){A=r,r=0;do{if(127<i>>>0){if(-1==(0|(i=0|Ea(f,i)))){r=-1;break A}}else i=1;r=i+r|0,i=0|ar[(A=A+4|0)>>2]}while(0!=(0|i))}else r=0}while(0);return ur=n,0|r}function za(A,e,r,i){A|=0,e|=0,r|=0;var f,n,t=0,o=0,a=0,c=0;t=ur=(n=ur)+31&-32,ur=ur+16|0,i=0|ar[(f=0==(0|(i|=0))?51456:i)>>2];A:do{if(e)if(o=0==(0|A)?t:A,r){if(i)t=r,a=11;else{if(-1<(i=0|tr[e>>0])<<24>>24){ar[o>>2]=255&i,i=i<<24>>24!=0&1;break}if(t=8832,i=0|tr[e>>0],!(0|ar[ar[t>>2]>>2])){ar[o>>2]=i<<24>>24&57343,i=1;break}if(50<(i=(255&i)-194|0)>>>0){a=17;break}i=0|ar[8240+(i<<2)>>2],(t=r+-1|0)&&(e=e+1|0,a=11)}e:do{if(11==(0|a)){if(7<((c=(255&(A=0|tr[e>>0]))>>>3)+-16|c+(i>>26))>>>0){a=17;break A}for(;e=e+1|0,t=t+-1|0,!(0<=(0|(i=(255&A)-128|i<<6)));){if(!t)break e;if((-64&(A=0|tr[e>>0]))<<24>>24!=-128){a=17;break A}}ar[f>>2]=0,ar[o>>2]=i,i=r-t|0;break A}}while(0);ar[f>>2]=i,i=-2}else i=-2;else i?a=17:i=0}while(0);return 17==(0|a)&&(ar[f>>2]=0,ar[(i=8708)>>2]=84,i=-1),ur=n,0|i}function Pa(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t,o,a,c=0,l=0,u=0,s=0;t=ur=(a=ur)+31&-32,ur=ur+1040|0,n=8+t|0,s=0|ar[(e|=0)>>2],l=(o=0!=(0|A))?i:256,A=o?A:n,c=ar[t>>2]=s;A:do{if(0!=(0|l)&0!=(0|s)){for(i=0,s=r;;){if(!(131<s>>>0|(r=l>>>0<=(u=s>>>2)>>>0))){r=s;break A}if(r=s-(c=r?l:u)|0,-1==(0|(c=0|Oa(A,t,c,f))))break;if(A=(s=(0|A)==(0|n))?A:A+(c<<2)|0,i=c+i|0,!(0!=(0|(l=l-(s?0:c)|0))&0!=(0|(c=0|ar[t>>2]))))break A;s=r}i=-1,c=(l=0)|ar[t>>2]}else i=0}while(0);A:do{if(0!=(0|c)&&0!=(0|l)&0!=(0|r)){for(u=A;!(((A=0|za(u,c,r,f))+2|0)>>>0<3);){if(c=(0|ar[t>>2])+A|0,ar[t>>2]=c,i=i+1|0,!(0!=(0|(l=l+-1|0))&0!=(0|(r=r-A|0))))break A;u=u+4|0}switch(0|A){case-1:i=-1;break A;case 0:ar[t>>2]=0;break A;default:ar[f>>2]=0;break A}}}while(0);return o&&(ar[e>>2]=ar[t>>2]),ur=a,0|i}function La(A){return 1&(A=(A|=0)?0==(0|ar[A>>2]):1)|0}function Ka(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n,t,o,a,c=0,l=0;t=ur=(a=ur)+31&-32,ur=ur+272|0,n=8+t|0,l=0|ar[(e|=0)>>2],c=(o=0!=(0|A))?i:256,A=o?A:n,i=ar[t>>2]=l;A:do{if(0!=(0|c)&0!=(0|l)){for(f=0,l=i;;){if(!((i=c>>>0<=r>>>0)|32<r>>>0)){i=l;break A}if(r=r-(i=i?c:r)|0,-1==(0|(i=0|ja(A,t,i,0))))break;if(A=(l=(0|A)==(0|n))?A:A+i|0,f=i+f|0,!(0!=(0|(c=c-(l?0:i)|0))&0!=(0|(i=0|ar[t>>2]))))break A;l=i}f=-1,i=(c=0)|ar[t>>2]}else f=0}while(0);A:do{if(0!=(0|i)&&0!=(0|c)&0!=(0|r)){for(l=A;!(((A=0|Ea(l,0|ar[i>>2]))+1|0)>>>0<2);){if(i=4+(0|ar[t>>2])|0,ar[t>>2]=i,f=A+f|0,!(0!=(0|(c=c-A|0))&0!=(0|(r=r+-1|0))))break A;l=l+A|0}A?f=-1:ar[t>>2]=0}}while(0);return o&&(ar[e>>2]=ar[t>>2]),ur=a,0|f}function qa(A,e,r){A|=0,r|=0;var i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;switch(0|(e|=0)){case 0:a=-149,c=24,t=4;break;case 1:case 2:a=-1074,c=53,t=4;break;default:i=0}A:do{if(4==(0|t)){for(u=A+4|0,l=A+100|0;0!=(0|Ja(e=(e=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0?(ar[u>>2]=e+1,0|cr[e>>0]):0|Ya(A))););e:do{switch(0|e){case 43:case 45:if(n=1-((45==(0|e)&1)<<1)|0,(e=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0){ar[u>>2]=e+1,f=0|cr[e>>0];break e}f=0|Ya(A);break e;default:f=e,n=1}}while(0);e=0;do{if((32|f)!=(0|tr[46216+e>>0]))break;do{if(e>>>0<7){if((f=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0){ar[u>>2]=f+1,f=0|cr[f>>0];break}f=0|Ya(A);break}}while(0);e=e+1|0}while(e>>>0<8);e:do{switch(0|e){case 8:break;case 3:t=23;break;default:if((o=0!=(0|r))&3<e>>>0){if(8==(0|e))break e;t=23;break e}r:do{if(!e){e=0;do{if((32|f)!=(0|tr[46225+e>>0]))break r;do{if(e>>>0<2){if((f=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0){ar[u>>2]=f+1,f=0|cr[f>>0];break}f=0|Ya(A);break}}while(0);e=e+1|0}while(e>>>0<3)}}while(0);switch(0|e){case 3:if(40!=(0|(e=(e=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0?(ar[u>>2]=e+1,0|cr[e>>0]):0|Ya(A)))){if(!(0|ar[l>>2])){i=h;break A}ar[u>>2]=(0|ar[u>>2])-1,i=h;break A}for(e=1;((f=(f=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0?(ar[u>>2]=f+1,0|cr[f>>0]):0|Ya(A))+-48|0)>>>0<10|(f+-65|0)>>>0<26||95==(0|f)|(f+-97|0)>>>0<26;)e=e+1|0;if(41==(0|f)){i=h;break A}if((f=0==(0|ar[l>>2]))||(ar[u>>2]=(0|ar[u>>2])-1),!o){ar[(u=8708)>>2]=22,Na(A,0),i=0;break A}if(!e){i=h;break A}for(;;)if(e=e+-1|0,f||(ar[u>>2]=(0|ar[u>>2])-1),!e){i=h;break A}case 0:if(48==(0|f)){if(120==(32|(e=(e=0|ar[u>>2])>>>0<(0|ar[l>>2])>>>0?(ar[u>>2]=e+1,0|cr[e>>0]):0|Ya(A)))){i=+$a(A,c,a,n,r);break A}e=(0|ar[l>>2]&&(ar[u>>2]=(0|ar[u>>2])-1),48)}else e=f;i=+Rr(A,e,c,a,n,r);break A;default:0|ar[l>>2]&&(ar[u>>2]=(0|ar[u>>2])-1),ar[(u=8708)>>2]=22,Na(A,0),i=0;break A}}}while(0);if(23==(0|t)&&((f=0==(0|ar[l>>2]))||(ar[u>>2]=(0|ar[u>>2])-1),0!=(0|r)&3<e>>>0))for(;f||(ar[u>>2]=(0|ar[u>>2])-1),3<(e=e+-1|0)>>>0;);i=(0|n)*w}}while(0);return+i}function $a(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0;a=(o=(o=0|ar[(m=(A|=0)+4|0)>>2])>>>0<(0|ar[(n=A+100|0)>>2])>>>0?(ar[m>>2]=o+1,0|cr[o>>0]):0|Ya(A),0);A:for(;;){switch(0|o){case 46:s=8;break A;case 48:break;default:d=1,h=a,l=u=k=a=g=t=v=w=0;break A}(o=0|ar[m>>2])>>>0<(0|ar[n>>2])>>>0?(ar[m>>2]=o+1,o=0|cr[o>>0],a=1):(o=0|Ya(A),a=1)}if(8==(0|s))if(48==(0|(o=(o=0|ar[m>>2])>>>0<(0|ar[n>>2])>>>0?(ar[m>>2]=o+1,0|cr[o>>0]):0|Ya(A)))){for(a=l=0;o=(o=0|ar[m>>2])>>>0<(0|ar[n>>2])>>>0?(ar[m>>2]=o+1,0|cr[o>>0]):0|Ya(A),l=0|vu(0|l,0|a,-1,-1),a=D,48==(0|o););h=d=w=1,u=k=g=t=v=0}else d=w=1,h=a,l=u=k=a=g=t=v=0;for(;b=46==(0|o),!(10<=(s=o+-48|0)>>>0)||b|((32|o)-97|0)>>>0<6;){if(b){if(w){o=46;break}w=1,s=v,c=d,o=g,l=u,a=k}else{o=57<(0|o)?(32|o)-87|0:s;do{if(!((0|k)<0|0==(0|k)&u>>>0<8)){if((0|k)<0|0==(0|k)&u>>>0<14){s=v,t+=(c=d*=.0625)*(0|o),o=g;break}s=(o=0!=(0|v)|0==(0|o))?v:1,c=d,t=o?t:t+.5*d,o=g;break}s=v,c=d,o=o+(g<<4)|0}while(0);u=0|vu(0|u,0|k,1,0),h=1,k=D}o=(b=0|ar[m>>2])>>>0<(0|ar[n>>2])>>>0?(ar[m>>2]=b+1,v=s,d=c,g=o,0|cr[b>>0]):(v=s,d=c,g=o,0|Ya(A))}do{if(h){if(b=(s=0==(0|w))?u:l,s=s?k:a,(0|k)<0|0==(0|k)&u>>>0<8){for(a=g,l=k;a<<=4,u=0|vu(0|u,0|l,1,0),(0|(l=D))<0|0==(0|l)&u>>>0<8;);u=a}else u=g;if(112==(32|o)){if(0==(0|(a=0|Yr(A,f)))&-2147483648==(0|(o=D))){if(!f){Na(A,0),t=0;break}o=a=(0|ar[n>>2]&&(ar[m>>2]=(0|ar[m>>2])-1),0)}}else o=a=(0|ar[n>>2]&&(ar[m>>2]=(0|ar[m>>2])-1),0);if(l=0|vu(0|(l=0|Iu(0|b,0|s,2)),0|D,-32,-1),l=0|vu(0|l,0|D,0|a,0|o),o=D,!u){t=0*(0|i);break}if((0|(f=((0|(m=0-r|0))<0)<<31>>31))<(0|o)|(0|o)==(0|f)&m>>>0<l>>>0){ar[(e=8708)>>2]=34,t=17976931348623157e292*(0|i)*17976931348623157e292;break}if((0|o)<(0|(f=((0|(m=r+-106|0))<0)<<31>>31))|(0|o)==(0|f)&l>>>0<m>>>0){ar[(e=8708)>>2]=34,t=22250738585072014e-324*(0|i)*22250738585072014e-324;break}if(-1<(0|u)){for(a=u;a=a<<1|1&(1^(m=!(.5<=t))),t+=m?t:t+-1,l=0|vu(0|l,0|o,-1,-1),o=D,-1<(0|a););d=t,u=a}else d=t;o=0|vu(0|(r=0|gu(32,0,0|r,((0|r)<0)<<31>>31|0)),0|D,0|l,0|o),59==(0|(s=(0|(r=D))<(0|(m=((0|e)<0)<<31>>31))|(0|m)==(0|r)&o>>>0<e>>>0?0<(0|o)?59:(a=0,o=84,61):(o=e,59)))&&((0|o)<53?(o=84-(a=o)|0,s=61):t=+((c=0)|i)),61==(0|s)&&(t=+(0|i),c=+Dr(+Jr(1,o),t),o=a),0==(t=t*((i=0==(1&u|0)&0!=d&(0|o)<32)?0:d)+(c+t*(((1&i)+u|0)>>>0))-c)&&(ar[(i=8708)>>2]=34),t=+Tr(t,l)}else(a=0!=(0|(o=0|ar[n>>2])))&&(ar[m>>2]=(0|ar[m>>2])-1),f?(a&&(ar[m>>2]=(0|ar[m>>2])-1),0==(0|w)|0==(0|o)||(ar[m>>2]=(0|ar[m>>2])-1)):Na(A,0),t=0*(0|i)}while(0);return+t}function Ac(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4464,(0|tr[(r=A+112|0)+11>>0])<0&&Vl(0|ar[r>>2]),(0|tr[(r=A+100|0)+11>>0])<0&&Vl(0|ar[r>>2]),(0|tr[(r=A+88|0)+11>>0])<0&&Vl(0|ar[r>>2]),(0|tr[(r=A+76|0)+11>>0])<0&&Vl(0|ar[r>>2]),(0|tr[(r=A+64|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))}function ec(A){var e=0,r=0,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4352,0|(e=0|ar[(n=A+56|0)>>2])){if((0|(r=0|ar[(t=A+60|0)>>2]))!=(0|e)){for(i=r;r=i+-32|0,ar[t>>2]=r,(f=0|ar[i+-16>>2])&&((0|(i=0|ar[(r=i+-12|0)>>2]))!=(0|f)&&(ar[r>>2]=i+(24*~(((i+-24-f|0)>>>0)/24|0)|0)),Vl(f),r=0|ar[t>>2]),(0|r)!=(0|e);)i=r;e=0|ar[n>>2]}Vl(e)}if(ar[A>>2]=3972,0|(e=0|ar[(f=A+44|0)>>2])){if((0|(r=0|ar[(n=A+48|0)>>2]))!=(0|e)){for(;i=r+-8|0,ar[n>>2]=i,(0|(r=(r=0|ar[r+-4>>2])?(Il(r),0|ar[n>>2]):i))!=(0|e););e=0|ar[f>>2]}Vl(e)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(e=A+28|0)>>2])!=(0|r)&&(ar[e>>2]=r),Vl(r))}function rc(A,e){e|=0;var r,i,f,n=0,t=0,o=0,a=0,c=0;r=(A|=0)+4|0,i=0|ar[A>>2],178956970<(n=(t=(0|(f=(0|ar[r>>2])-i|0))/24|0)+1|0)>>>0&&il(),o=(a=((0|ar[(c=A+8|0)>>2])-i|0)/24|0)<<1,o=a>>>0<89478485?o>>>0<n>>>0?n:o:178956970;do{if(o){if(!(178956970<o>>>0)){a=0|El(24*o|0);break}Fl(c=0|C(8),37845),ar[c>>2]=16004,I(0|c,3616,283)}else a=0}while(0);ar[(t=a+(24*t|0)|0)>>2]=ar[e>>2],ar[t+4>>2]=ar[e+4>>2],ar[t+8>>2]=ar[e+8>>2],ar[t+12>>2]=ar[e+12>>2],ar[t+16>>2]=ar[e+16>>2],ar[t+20>>2]=ar[e+20>>2],n=t+(24*((0|f)/-24|0)|0)|0,0<(0|f)&&Eu(0|n,0|i,0|f),ar[A>>2]=n,ar[r>>2]=t+24,ar[c>>2]=a+(24*o|0),i&&Vl(i)}function ic(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0;r=(A|=0)+4|0,i=0|ar[A>>2],134217727<(f=(o=(0|ar[r>>2])-i>>5)+1|0)>>>0&&il(),i=(a=(0|ar[(c=A+8|0)>>2])-i|0)>>4,i=a>>5>>>0<67108863?i>>>0<f>>>0?f:i:134217727;do{if(i){if(!(134217727<i>>>0)){t=0|El(i<<5);break}Fl(c=0|C(8),37845),ar[c>>2]=16004,I(0|c,3616,283)}else t=0}while(0);if(a=t+(i<<5)|0,ar[(n=f=t+(o<<5)|0)>>2]=ar[e>>2],ar[f+4>>2]=ar[e+4>>2],ar[f+8>>2]=ar[e+8>>2],ar[f+12>>2]=ar[e+12>>2],fc(t+(o<<5)+16|0,e+16|0),e=f+32|0,t=0|ar[A>>2],(0|(i=0|ar[r>>2]))==(0|t))f=n,i=o=t;else{for(;i=(u=i)+-32|0,ar[(l=f+-32|0)>>2]=ar[i>>2],ar[l+4>>2]=ar[i+4>>2],ar[l+8>>2]=ar[i+8>>2],ar[l+12>>2]=ar[i+12>>2],o=u+-16|0,ar[(l=f+-16|0)>>2]=0,ar[(s=f+-12|0)>>2]=0,ar[f+-8>>2]=0,ar[l>>2]=ar[o>>2],l=u+-12|0,ar[s>>2]=ar[l>>2],u=u+-8|0,ar[f+-8>>2]=ar[u>>2],ar[u>>2]=0,ar[l>>2]=0,n=f=n+-32|(ar[o>>2]=0),(0|i)!=(0|t););f=n,o=0|ar[A>>2],i=0|ar[r>>2]}if(ar[A>>2]=f,ar[r>>2]=e,ar[c>>2]=a,(0|i)!=(0|(e=o)))for(;0|(f=0|ar[i+-16>>2])&&((0|(t=0|ar[(n=i+-12|0)>>2]))!=(0|f)&&(ar[n>>2]=t+(24*~(((t+-24-f|0)>>>0)/24|0)|0)),Vl(f)),(0|(i=i+-32|0))!=(0|e););o&&Vl(o)}function fc(A,e){e|=0;var r,i,f,n,t=0;ar[(A|=0)>>2]=0,ar[(n=A+4|0)>>2]=0,r=((ar[A+8>>2]=0)|(t=(0|ar[(f=e+4|0)>>2])-(0|ar[e>>2])|0))/24|0,t&&(178956970<r>>>0&&il(),i=0|El(t),ar[n>>2]=i,ar[A>>2]=i,ar[A+8>>2]=i+(24*r|0),A=0|ar[e>>2],(0|(t=(0|ar[f>>2])-A|0))<=0||(Eu(0|i,0|A,0|t),ar[n>>2]=i+(24*((t>>>0)/24|0)|0)))}function nc(A,e,r){A|=0,r|=0;var i,f=0;f=0|ar[(e|=0)+44>>2],i=0|ar[e+48>>2];A:do{if((0|f)!=(0|i)){for(e=f;f=0|ar[e>>2],(0|ar[f+20>>2])!=(0|r);)if((0|(e=e+8|0))==(0|i))break A;if(ar[A>>2]=f,e=0|ar[e+4>>2],!(ar[A+4>>2]=e))return;return void Cl(e)}}while(0);ar[A>>2]=0,ar[A+4>>2]=0}function tc(A,e,r){e|=0,r|=0;var i,f,n,t=0,o=0;if(ar[(A|=0)>>2]=0,ar[(n=A+4|0)>>2]=0,((ar[A+8>>2]=0)|(t=0|ar[e+44>>2]))!=(0|(f=0|ar[e+48>>2]))){i=A+8|0;do{o=e=0|ar[t>>2];do{if((0|ar[e+20>>2])==(0|r)){if((0|(e=0|ar[n>>2]))==(0|ar[i>>2])){oc(A,t);break}ar[e>>2]=o,o=0|ar[t+4>>2],(ar[e+4>>2]=o)&&(Cl(o),e=0|ar[n>>2]),ar[n>>2]=e+8}}while(0);t=t+8|0}while((0|t)!=(0|f))}}function oc(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;f=0|ar[(u=(A|=0)+4|0)>>2],c=n=0|ar[A>>2],536870911<(t=1+(r=f-n>>3)|0)>>>0&&il(),o=(l=(0|ar[(i=A+8|0)>>2])-n|0)>>2,o=l>>3>>>0<268435455?o>>>0<t>>>0?t:o:536870911;do{if(o){if(!(536870911<o>>>0)){a=0|El(o<<3);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else a=0}while(0);if(l=a+(o<<3)|0,ar[(t=n=a+(r<<3)|0)>>2]=ar[e>>2],o=0|ar[e+4>>2],o=(ar[a+(r<<3)+4>>2]=o)?(Cl(o),f=0|ar[u>>2],0|ar[A>>2]):c,a=n+8|0,(0|f)!=(0|o)){for(;f=(c=f)+-8|0,ar[n+-8>>2]=ar[f>>2],c=c+-4|0,ar[n+-4>>2]=ar[c>>2],ar[f>>2]=0,t=n=t+-8|(ar[c>>2]=0),(0|f)!=(0|o););o=0|ar[A>>2],f=0|ar[u>>2]}if(ar[A>>2]=t,ar[u>>2]=a,ar[i>>2]=l,(0|f)!=(0|(t=o)))for(;n=0|ar[f+-4>>2],f=f+-8|0,0|n&&Il(n),(0|f)!=(0|t););o&&Vl(o)}function ac(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0;ur=(l=ur)+224|0,W=l+212|0,I=l+56|0,C=l+200|0,Z=l+44|0,a=l+32|0,c=l+20|0,t=l,Ri((i|=0)+(0|ar[(0|ar[i>>2])-12>>2])|0,0),e=0|ar[r+16>>2],o=0|ar[r+20>>2];A:do{if((0|e)!=(0|o)){v=r+4|0,y=r+8|0,m=n+4|0,h=(k=t+8|0)+11|0;e:for(;;){switch(0|tr[v>>0]){case 0:if(p=b=e+8|0,zi(i,0|vu(0|ar[(w=y)>>2],0|ar[w+4>>2],0|ar[p>>2],0|ar[p+4>>2]),D,0),2&ar[i+(0|ar[(0|ar[i>>2])-12>>2])+16>>2]|0){e=5;break e}if(p=(d=0|ar[m>>2])-(r=0|ar[n>>2])|0,u=0|ar[(s=w=e+16|0)>>2],0<(s=0|ar[s+4>>2])>>>0|0==(0|s)&(52428800-p|0)>>>0<u>>>0){e=15;break e}if(b=0|vu(0|p,0,0|u,0|s),s=d,b>>>0<=p>>>0?b>>>0<p>>>0&&(0|s)!=(0|(g=r+b|0))&&(ar[m>>2]=g):(dn(n,b-p|0),u=0|ar[w>>2],r=0|ar[n>>2]),ji(i,r+p|0,u),2&ar[i+(0|ar[(0|ar[i>>2])-12>>2])+16>>2]|0){e=28;break e}break;case 1:if(!(r=0|ar[f>>2])){e=31;break e}w=e+8|0,p=e+16|0,cc(t,r,i,0|vu(0|ar[(d=y)>>2],0|ar[d+4>>2],0|ar[w>>2],0|ar[w+4>>2]),D,0|ar[p>>2],0|ar[p+4>>2],n),(0|tr[h>>0])<0&&Vl(0|ar[k>>2])}if((0|(e=e+24|0))==(0|o))break A}if(5==(0|e))return e=0|ar[n>>2],(0|ar[m>>2])!=(0|e)&&(ar[m>>2]=e),r=I+64|0,ar[(s=I+8|0)>>2]=4080,u=I+12|0,ar[I>>2]=164,ar[r>>2]=184,Yi(I+64|(ar[I+4>>2]=0),u),ar[I+136>>2]=0,ar[I+140>>2]=-1,ar[I>>2]=4060,ar[r>>2]=4100,ar[s>>2]=4080,Ti(u),ar[u>>2]=3908,ar[(s=I+44|0)>>2]=0,ar[s+4>>2]=0,ar[s+8>>2]=0,ar[s+12>>2]=0,ar[I+60>>2]=24,ar[W>>2]=0,ar[W+4>>2]=0,ar[W+8>>2]=0,Of(u,W),(0|tr[W+11>>0])<0&&Vl(0|ar[W>>2]),Z=0|Hf(0|Hf(e=I+8|0,20543,58),20602,25),W=b,Hf(0|$i(Z,W=0|vu(0|ar[y>>2],0|ar[y+4>>2],0|ar[W>>2],0|ar[W+4>>2]),D),17022,2),jf(C,u),Cc(A,2,100,C),(0|tr[C+11>>0])<0&&Vl(0|ar[C>>2]),ar[I>>2]=4060,ar[r>>2]=4100,ar[e>>2]=4080,ar[u>>2]=3908,(0|tr[s+11>>0])<0&&Vl(0|ar[s>>2]),si(u),ci(r),void(ur=l);if(15==(0|e))return r=I+64|0,ar[(s=I+8|0)>>2]=4080,u=I+12|0,ar[I>>2]=164,ar[r>>2]=184,Yi(I+64|(ar[I+4>>2]=0),u),ar[I+136>>2]=0,ar[I+140>>2]=-1,ar[I>>2]=4060,ar[r>>2]=4100,ar[s>>2]=4080,Ti(u),ar[u>>2]=3908,ar[(s=I+44|0)>>2]=0,ar[s+4>>2]=0,ar[s+8>>2]=0,ar[s+12>>2]=0,ar[I+60>>2]=24,ar[W>>2]=0,ar[W+4>>2]=0,ar[W+8>>2]=0,Of(u,W),(0|tr[W+11>>0])<0&&Vl(0|ar[W>>2]),W=0|Hf(e=I+8|0,20628,19),C=0|Hf(0|$i(W,0|ar[(C=w)>>2],0|ar[C+4>>2]),20648,35),Hf(0|Ki(0|Hf(0|$i(C,W=0|vu(0|ar[(W=w)>>2],0|ar[W+4>>2],0|p,0),D),20684,40),52428800),20725,6),jf(Z,u),Cc(A,6,1e3,Z),(0|tr[Z+11>>0])<0&&Vl(0|ar[Z>>2]),ar[I>>2]=4060,ar[r>>2]=4100,ar[e>>2]=4080,ar[u>>2]=3908,(0|tr[s+11>>0])<0&&Vl(0|ar[s>>2]),si(u),ci(r),void(ur=l);if(28==(0|e))return ar[a>>2]=0,ar[4+a>>2]=0,ar[8+a>>2]=0,Cc(A,2,100,a),0<=(0|tr[11+a>>0])||Vl(0|ar[a>>2]),void(ur=l);if(31==(0|e)){for(e=0|El(64),ar[c>>2]=e,ar[8+c>>2]=-2147483584,u=20732,s=(r=e)+(ar[4+c>>2]=54)|0;tr[r>>0]=0|tr[u>>0],u=u+1|0,(0|(r=r+1|0))<(0|s););return(tr[e+54>>0]=0,Cc(A,2,103,c),0<=(0|tr[11+c>>0]))?void(ur=l):(Vl(0|ar[c>>2]),void(ur=l))}}}while(0);W=0|ar[(C=49920)+4>>2],ar[(I=A)>>2]=ar[C>>2],ar[I+4>>2]=W,Rl(A+8|0,49928),ur=l}function cc(A,e,r,i,f,n,t,o){A|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l,u=0,s=0,b=0,d=0;if(ur=(l=ur)+176|0,b=l+160|0,d=l+16|0,a=l,zi(r|=0,u=0|vu(0|ar[(u=(e|=0)+64|0)>>2],0|ar[u+4>>2],0|i,0|f),D,0),!(0<t>>>0|0==(0|t)&(52428800-(c=(i=0|ar[(u=o+4|0)>>2])-(e=0|ar[o>>2])|0)|0)>>>0<n>>>0))return(f=0|vu(0|c,0,0|n,0|t))>>>0<=c>>>0?f>>>0<c>>>0&&(0|i)!=(0|(s=e+f|0))&&(ar[u>>2]=s):(dn(o,f-c|0),e=0|ar[o>>2]),ji(r,e+c|0,n),d=0|ar[(t=49920)+4>>2],ar[(n=A)>>2]=ar[t>>2],ar[n+4>>2]=d,Rl(A+8|0,49928),void(ur=l);i=d+64|0,ar[(u=d+8|0)>>2]=4080,f=d+12|0,ar[d>>2]=164,ar[i>>2]=184,Yi(d+64|(ar[d+4>>2]=0),f),ar[d+136>>2]=0,ar[d+140>>2]=-1,ar[d>>2]=4060,ar[i>>2]=4100,ar[u>>2]=4080,Ti(f),ar[f>>2]=3908,ar[(u=d+44|0)>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,ar[u+12>>2]=0,ar[d+60>>2]=24,ar[b>>2]=0,ar[b+4>>2]=0,ar[b+8>>2]=0,Of(f,b),(0|tr[b+11>>0])<0&&Vl(0|ar[b>>2]),b=0|Hf(0|$i(0|Hf(e=d+8|0,20787,19),n,t),20648,35),Hf(0|Ki(0|Hf(0|$i(b,n=0|vu(0|c,0,0|n,0|t),D),20684,40),52428800),20725,6),jf(a,f),Cc(A,6,1e3,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),ar[d>>2]=4060,ar[i>>2]=4100,ar[e>>2]=4080,ar[f>>2]=3908,(0|tr[u+11>>0])<0&&Vl(0|ar[u>>2]),si(f),ci(i),ur=l}function lc(A,e,r,i,f){A|=0,e|=0,r|=0,f|=0;var n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;ur=(c=ur)+336|0,o=c+316|0,a=c+160|0,s=c+304|0,t=(n=c)+144|0,u=0|ar[(i|=0)>>2],i=0|ar[u+56>>2],u=0|ar[u+60>>2];A:do{if((0|i)!=(0|u)){for(;l=i+16|0,(0|ar[i>>2])!=(0|r);){if((0|l)==(0|u))break A;i=l}uc(a,e+44|0),l=0|ar[i+4>>2],b=0|ar[i+8>>2];e:do{if((0|l)==(0|b))m=34;else{for(d=4+a|0,h=8+o|0,w=k=4+o|0,v=f+4|0,g=f+8|0;u=65535&(i=0|or[(s=l+2|0)>>1]),e=p=0|ar[a>>2],!(u>>>0>(0|ar[d>>2])-p>>3>>>0);){ar[k>>2]=0,ar[h>>2]=0,tr[o>>0]=0|tr[l>>0];do{if(i<<16>>16){if(s=0|ar[e+((i=u+-1|0)<<3)>>2],(u=i=0|ar[e+(i<<3)+4>>2])?(Cl(i),i=0|ar[h>>2],ar[w>>2]=s,ar[h>>2]=u,0|i&&Il(i)):(ar[w>>2]=s,ar[h>>2]=u),(0|(i=0|ar[v>>2]))==(0|ar[g>>2])){sc(f,o);break}tr[i>>0]=0|tr[o>>0],ar[i+4>>2]=ar[w>>2],u=0|ar[h>>2],(ar[i+8>>2]=u)&&(Cl(u),i=0|ar[v>>2]),ar[v>>2]=i+12}}while(0);if(0|(i=0|ar[h>>2])&&Il(i),(0|(l=l+4|0))==(0|b)){m=34;break e}}l=n+64|0,ar[(e=n+8|0)>>2]=4080,u=n+12|0,ar[n>>2]=164,ar[l>>2]=184,Yi(n+64|(ar[n+4>>2]=0),u),ar[n+136>>2]=0,ar[n+140>>2]=-1,ar[n>>2]=4060,ar[l>>2]=4100,ar[e>>2]=4080,Ti(u),ar[u>>2]=3908,ar[(e=n+44|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[n+60>>2]=24,ar[o>>2]=0,ar[4+o>>2]=0,ar[8+o>>2]=0,Of(u,o),(0|tr[11+o>>0])<0&&Vl(0|ar[o>>2]),p=0|Hf(i=n+8|0,20864,28),Hf(0|qi(0|Hf(0|Hf(0|Li(p,0|or[s>>1]),20893,11),20905,4),r),20910,23),jf(t,u),Cc(A,2,115,t),(0|tr[11+t>>0])<0&&Vl(0|ar[t>>2]),ar[n>>2]=4060,ar[l>>2]=4100,ar[i>>2]=4080,ar[u>>2]=3908,(0|tr[e+11>>0])<0&&Vl(0|ar[e>>2]),si(u),ci(l),i=a}}while(0);if(34==(0|m)&&(p=0|ar[(r=49920)+4>>2],ar[(i=A)>>2]=ar[r>>2],ar[i+4>>2]=p,Rl(A+8|0,49928),i=a),0|(i=0|ar[i>>2])){if((0|(l=0|ar[(e=4+a|0)>>2]))!=(0|i)){for(;u=l+-8|0,ar[e>>2]=u,(0|(l=(l=0|ar[l+-4>>2])?(Il(l),0|ar[e>>2]):u))!=(0|i););i=0|ar[a>>2]}Vl(i)}return void(ur=c)}}while(0);l=64+a|0,ar[(e=8+a|0)>>2]=4080,u=12+a|0,ar[a>>2]=164,ar[l>>2]=184,Yi(64+a|(ar[4+a>>2]=0),u),ar[136+a>>2]=0,ar[140+a>>2]=-1,ar[a>>2]=4060,ar[l>>2]=4100,ar[e>>2]=4080,Ti(u),ar[u>>2]=3908,ar[(e=44+a|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[60+a>>2]=24,ar[o>>2]=0,ar[4+o>>2]=0,ar[8+o>>2]=0,Of(u,o),(0|tr[11+o>>0])<0&&Vl(0|ar[o>>2]),Hf(0|qi(0|Hf(i=8+a|0,20807,9),r),20817,46),jf(s,u),Cc(A,2,116,s),(0|tr[s+11>>0])<0&&Vl(0|ar[s>>2]),ar[a>>2]=4060,ar[l>>2]=4100,ar[i>>2]=4080,ar[u>>2]=3908,(0|tr[e+11>>0])<0&&Vl(0|ar[e>>2]),si(u),ci(l),ur=c}function uc(A,e){e|=0;var r,i,f,n=0,t=0;if(ar[(A|=0)>>2]=0,ar[(f=A+4|0)>>2]=0,(r=(n=((ar[A+8>>2]=0)|ar[(i=e+4|0)>>2])-(0|ar[e>>2])|0)>>3)&&(536870911<r>>>0&&il(),t=0|El(n),ar[f>>2]=t,ar[A>>2]=t,ar[A+8>>2]=t+(r<<3),(0|(n=0|ar[e>>2]))!=(0|(e=0|ar[i>>2]))))for(;ar[t>>2]=ar[n>>2],A=0|ar[n+4>>2],0|(ar[t+4>>2]=A)&&Cl(A),n=n+8|0,t=8+(0|ar[f>>2])|0,ar[f>>2]=t,(0|n)!=(0|e););}function sc(A,e){e|=0;var r,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;n=0|ar[(u=(A|=0)+4|0)>>2],c=i=0|ar[A>>2],357913941<(f=(a=(n-i|0)/12|0)+1|0)>>>0&&il(),t=(l=((0|ar[(r=A+8|0)>>2])-i|0)/12|0)<<1,t=l>>>0<178956970?t>>>0<f>>>0?f:t:357913941;do{if(t){if(!(357913941<t>>>0)){o=0|El(12*t|0);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else o=0}while(0);if(l=o+(12*t|0)|0,tr[(f=i=o+(12*a|0)|0)>>0]=0|tr[e>>0],ar[o+(12*a|0)+4>>2]=ar[e+4>>2],t=0|ar[e+8>>2],t=(ar[o+(12*a|0)+8>>2]=t)?(Cl(t),n=0|ar[u>>2],0|ar[A>>2]):c,o=i+12|0,(0|n)==(0|t))i=t=n;else{for(;n=(c=n)+-12|0,tr[i+-12>>0]=0|tr[n>>0],a=c+-8|0,ar[i+-8>>2]=ar[a>>2],c=c+-4|0,ar[i+-4>>2]=ar[c>>2],ar[a>>2]=0,f=i=f+-12|(ar[c>>2]=0),(0|n)!=(0|t););t=0|ar[A>>2],i=0|ar[u>>2]}if(ar[A>>2]=f,ar[u>>2]=o,ar[r>>2]=l,(0|i)!=(0|(n=t)))for(;f=0|ar[i+-4>>2],i=i+-12|0,0|f&&Il(f),(0|i)!=(0|n););t&&Vl(n)}function bc(A,e){var r=0,i=0,f=0;return e=(e|=0)+-1|0,r=0|ar[(A|=0)+76>>2],i=0|ar[A+72>>2],i=2==(0|r)?(f=2,i+e|0):(f=r<<1,(i<<1)+(0|sr(r,e))|0),r=0|ar[A+60>>2],e=(0|ar[A+56>>2])-r|0,(0|f)==(0|(r<<=1))?(A=i-e|0,0|(f=(0|(A=(i=(0|f)/2|0)+A|0))/(0|f)|0)):(A=0|sr(r,f),f=(0|sr(r,i))-(0|sr(e,f))|0,0|(f=(0|(f=(i=(0|A)/2|0)+f|0))/(0|A)|0))}function dc(A,e){var r=0,i=0,f=0;return e=(e|=0)+-1|0,r=0|ar[(A|=0)+76>>2],i=0|ar[A+72>>2],i=2==(0|r)?(f=2,i+e|0):(f=r<<1,(i<<1)+(0|sr(r,e))|0),r=0|ar[A+60>>2],e=(0|ar[A+56>>2])-r|0,(0|f)==(0|(r<<=1))?(A=e+i|0,0|(f=(0|(A=(i=(0|f)/2|0)+A|0))/(0|f)|0)):(A=0|sr(r,f),f=(0|sr(e,f))+(0|sr(r,i))|0,0|(f=(0|(f=(i=(0|A)/2|0)+f|0))/(0|A)|0))}function kc(A,e){var r=0,i=0,f=0;return e=(e|=0)+-1|0,r=0|ar[(A|=0)+84>>2],i=0|ar[A+80>>2],i=2==(0|r)?(f=2,i+e|0):(f=r<<1,(i<<1)+(0|sr(r,e))|0),r=0|ar[A+68>>2],e=(0|ar[A+64>>2])-r|0,(0|f)==(0|(r<<=1))?(A=i-e|0,0|(f=(0|(A=(i=(0|f)/2|0)+A|0))/(0|f)|0)):(A=0|sr(r,f),f=(0|sr(r,i))-(0|sr(e,f))|0,0|(f=(0|(f=(i=(0|A)/2|0)+f|0))/(0|A)|0))}function hc(A,e){var r=0,i=0,f=0;return e=(e|=0)+-1|0,r=0|ar[(A|=0)+84>>2],i=0|ar[A+80>>2],i=2==(0|r)?(f=2,i+e|0):(f=r<<1,(i<<1)+(0|sr(r,e))|0),r=0|ar[A+68>>2],e=(0|ar[A+64>>2])-r|0,(0|f)==(0|(r<<=1))?(A=e+i|0,0|(f=(0|(A=(i=(0|f)/2|0)+A|0))/(0|f)|0)):(A=0|sr(r,f),f=(0|sr(e,f))+(0|sr(r,i))|0,0|(f=(0|(f=(i=(0|A)/2|0)+f|0))/(0|A)|0))}function wc(A){var e;return e=0|ar[(A|=0)+56>>2],1-(((A=ar[A+60>>2]<<1)-e|0)/(0|A)|0)+((0|e)/(0|A)|0)|0}function vc(A){var e;return e=0|ar[(A|=0)+64>>2],1-(((A=ar[A+68>>2]<<1)-e|0)/(0|A)|0)+((0|e)/(0|A)|0)|0}function gc(A,e){e|=0;var r=0,i=0;if((0|(r=0|ar[(A|=0)+56>>2]))==(0|(A=0|ar[A+60>>2])))return(i=0)|i;for(;(0|ar[r+48>>2])!=(0|e);)if((0|(r=r+64|0))==(0|A)){r=0,i=5;break}return 5==(0|i)?0|r:0|(i=0|ar[r+20>>2])}function mc(A,e,r){A|=0,r|=0;var i=0;i=0|ar[(e|=0)+56>>2],e=0|ar[e+60>>2];A:do{if((0|i)!=(0|e)){for(;(0|ar[i+48>>2])!=(0|r);)if((0|(i=i+64|0))==(0|e))break A;return void ln(A,i+52|0)}}while(0);ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0}function pc(A,e){e|=0;var r,i,f,n,t,o,a,c,l,u,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0;if(ur=(u=ur)+32|0,o=u+20|0,t=u+16|0,n=u+12|0,a=u+8|0,c=u+4|0,l=u,(0|(s=0|ar[(A|=0)+92>>2]))==(0|(f=0|ar[A+96>>2])))return ur=u,1;r=e+4|0,i=e+8|0;A:for(;;){if((0|(A=0|ar[s+4>>2]))!=(0|(y=0|ar[s+8>>2])))do{if(w=((0|ar[(p=A+4|0)>>2])-(0|ar[A>>2])|0)>>>24&255,b=0|ar[r>>2],(d=m=0|ar[i>>2])>>>0<=b>>>0){if(g=m=0|ar[e>>2],(0|(b=(v=b-m|0)+1|0))<0){A=9;break A}k=(h=d-m|0)<<1,h=(k=h>>>0<1073741823?k>>>0<b>>>0?b:k:2147483647)?0|El(k):0,tr[(d=h+v|0)>>0]=w,b=d+1|0,d=d+(0-v)|0,0<(0|v)&&Eu(0|d,0|g,0|v),ar[e>>2]=d,ar[r>>2]=b,ar[i>>2]=h+k,m&&(Vl(g),b=0|ar[r>>2])}else tr[b>>0]=w,b=1+(0|ar[r>>2])|0,ar[r>>2]=b;if(w=((0|ar[p>>2])-(0|ar[A>>2])|0)>>>16&255,(d=m=0|ar[i>>2])>>>0<=b>>>0){if(g=m=0|ar[e>>2],(0|(b=(v=b-m|0)+1|0))<0){A=19;break A}k=(h=d-m|0)<<1,h=(k=h>>>0<1073741823?k>>>0<b>>>0?b:k:2147483647)?0|El(k):0,tr[(d=h+v|0)>>0]=w,b=d+1|0,d=d+(0-v)|0,0<(0|v)&&Eu(0|d,0|g,0|v),ar[e>>2]=d,ar[r>>2]=b,ar[i>>2]=h+k,m&&(Vl(g),b=0|ar[r>>2])}else tr[b>>0]=w,b=1+(0|ar[r>>2])|0,ar[r>>2]=b;if(w=((0|ar[p>>2])-(0|ar[A>>2])|0)>>>8&255,(d=m=0|ar[i>>2])>>>0<=b>>>0){if(g=m=0|ar[e>>2],(0|(b=(v=b-m|0)+1|0))<0){A=29;break A}k=(h=d-m|0)<<1,h=(k=h>>>0<1073741823?k>>>0<b>>>0?b:k:2147483647)?0|El(k):0,tr[(d=h+v|0)>>0]=w,b=d+1|0,d=d+(0-v)|0,0<(0|v)&&Eu(0|d,0|g,0|v),ar[e>>2]=d,ar[r>>2]=b,ar[i>>2]=h+k,m&&(Vl(g),b=0|ar[r>>2])}else tr[b>>0]=w,b=1+(0|ar[r>>2])|0,ar[r>>2]=b;if(w=(0|ar[p>>2])-(0|ar[A>>2])&255,(d=m=0|ar[i>>2])>>>0<=b>>>0){if(g=m=0|ar[e>>2],(0|(b=(v=b-m|0)+1|0))<0){A=39;break A}k=(h=d-m|0)<<1,h=(k=h>>>0<1073741823?k>>>0<b>>>0?b:k:2147483647)?0|El(k):0,tr[(d=h+v|0)>>0]=w,b=d+1|0,d=d+(0-v)|0,0<(0|v)&&Eu(0|d,0|g,0|v),ar[e>>2]=d,ar[r>>2]=b,ar[i>>2]=h+k,m&&(Vl(g),b=0|ar[r>>2])}else tr[b>>0]=w,b=1+(0|ar[r>>2])|0,ar[r>>2]=b;ar[a>>2]=b,ar[c>>2]=ar[A>>2],ar[l>>2]=ar[p>>2],ar[n>>2]=ar[a>>2],ar[t>>2]=ar[c>>2],ar[o>>2]=ar[l>>2],yc(e,n,t,o),A=A+12|0}while((0|A)!=(0|y));if((0|(s=s+16|0))==(0|f)){A=3;break}}return 3==(0|A)?(ur=u,1):(9!=(0|A)&&19!=(0|A)&&29!=(0|A)&&39!=(0|A)||il(),0)}function yc(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0;if(e=(u=f=0|ar[(A|=0)>>2])+(s=(0|ar[e>>2])-u|0)|0,a=0|ar[r>>2],t=c=0|ar[i>>2],(0|(b=c-a|0))<=0)return 0|(d=e);if((0|b)<=((l=0|ar[(o=A+8|0)>>2])-(i=n=0|ar[(d=A+4|0)>>2])|0)){if((0|(l=i-e|0))<(0|b)){if((0|(c=i=a+l|0))==(0|t))i=n;else{for(a=n;tr[a>>0]=0|tr[i>>0],i=i+1|0,a=1+(0|ar[d>>2])|0,ar[d>>2]=a,(0|i)!=(0|t););i=a}if(!(0<(0|l)))return 0|(d=e);u=i}else u=n;if((i=e+(l=u-(e+b)|0)|0)>>>0<n>>>0)for(a=u;tr[a>>0]=0|tr[i>>0],i=i+1|0,a=1+(0|ar[d>>2])|0,ar[d>>2]=a,(0|i)!=(0|n););if(0|l&&Gu(u+(0-l)|0,0|e,0|l),(0|(i=0|ar[r>>2]))==(0|c))return 0|(d=e);for(a=e;tr[a>>0]=0|tr[i>>0],(0|(i=i+1|0))!=(0|c);)a=a+1|0;return 0|e}if((0|(i=i-u+b|0))<0&&il(),c=(u=l-u|0)<<1,c=u>>>0<1073741823?c>>>0<i>>>0?i:c:2147483647,u=e,i=b=(l=c?0|El(c):0)+s|0,s=l+c|0,(0|a)==(0|t))c=f;else{for(c=b;tr[c>>0]=0|tr[a>>0],i=c=i+1|0,(0|(a=a+1|0))!=(0|t););c=0|ar[A>>2]}return l=b+(0-(a=u-c|0))|0,0<(0|a)&&Eu(0|l,0|c,0|a),e=0<(0|(a=(0|ar[d>>2])-u|0))?(Eu(0|i,0|e,0|a),i=i+a|0,0|ar[A>>2]):c,ar[A>>2]=l,ar[d>>2]=i,ar[o>>2]=s,e&&Vl(e),0|(d=b)}function Zc(A){ar[(A|=0)>>2]=0,ar[(A=A+8|0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0}function Cc(A,e,r,i){e|=0,r|=0,i|=0,ar[(A|=0)>>2]=e,ar[A+4>>2]=r,Rl(A+8|0,i)}function Wc(A,e,r){A|=0,r|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;if(ur=(n=ur)+176|0,o=n+160|0,i=n+16|0,f=n,t=0|ar[(e|=0)>>2],!r)return ar[A>>2]=t,ar[A+4>>2]=ar[e+4>>2],e=0|ar[(e=5352)>>2],ar[(A=A+8|0)>>2]=e,void(ur=n);if(t){switch(u=64+i|0,ar[(b=8+i|0)>>2]=4080,s=12+i|0,ar[i>>2]=164,ar[u>>2]=184,Yi(64+i|(ar[4+i>>2]=0),s),ar[136+i>>2]=0,ar[140+i>>2]=-1,ar[i>>2]=4060,ar[u>>2]=4100,ar[b>>2]=4080,Ti(s),ar[s>>2]=3908,ar[(b=44+i|0)>>2]=0,ar[b+4>>2]=0,ar[b+8>>2]=0,ar[b+12>>2]=0,ar[60+i>>2]=24,ar[o>>2]=0,ar[o+4>>2]=0,ar[o+8>>2]=0,Of(s,o),(0|tr[o+11>>0])<0&&Vl(0|ar[o>>2]),l=8+i|0,0|ar[e>>2]){case 0:a=26780;break;case 1:a=21100;break;case 2:a=21086;break;case 3:a=21064;break;case 4:a=21044;break;case 5:a=21032;break;case 6:a=21008;break;case 7:a=20974;break;default:br(49065,20948,59,20957)}switch(t=0|Hf(0|Hf(l,a,0|ta(a)),21954,2),0|ar[(o=e+4|0)>>2]){case 0:c=21942;break;case 100:c=21919;break;case 101:c=21902;break;case 118:c=21884;break;case 119:c=21864;break;case 102:c=21850;break;case 103:c=21836;break;case 104:c=21822;break;case 105:c=21808;break;case 106:c=21794;break;case 107:c=21780;break;case 108:c=21766;break;case 109:c=21752;break;case 110:c=21738;break;case 111:c=21724;break;case 112:c=21710;break;case 113:c=21696;break;case 125:c=21682;break;case 114:c=21661;break;case 115:c=21615;break;case 116:c=21584;break;case 117:c=21567;break;case 120:c=21530;break;case 121:c=21509;break;case 122:c=21472;break;case 123:c=21436;break;case 124:c=21408;break;case 1e3:c=21384;break;case 2e3:c=21351;break;case 2001:c=21328;break;case 2002:c=21290;break;case 2003:c=21240;break;case 2004:c=21221;break;case 3e3:c=21203;break;case 3001:c=21180;break;case 3002:c=21155;break;case 3003:c=21126;break;default:br(49065,20948,117,20957)}Hf(t,c,0|ta(c)),(t=0|tr[(c=(a=e+8|0)+11|0)>>0])<<24>>24<0?t=0|ar[e+12>>2]:t&=255,0|t&&(d=0|Hf(l,21954,2),Hf(d,(t=(c=0|tr[c>>0])<<24>>24<0)?0|ar[a>>2]:a,t?0|ar[e+12>>2]:255&c)),jf(f,s),Jl(r,f),t=(0|tr[r+11>>0])<0?0|ar[r>>2]:r,ar[(a=r+12|0)>>2]=t,(0|tr[f+11>>0])<0&&Vl(0|ar[f>>2]),ar[i>>2]=4060,ar[u>>2]=4100,ar[l>>2]=4080,ar[s>>2]=3908,(0|tr[b+11>>0])<0&&Vl(0|ar[b>>2]),si(s),ci(u),t=0|ar[e>>2]}else ar[(a=r+12|0)>>2]=26780,o=e+4|0,t=0;ar[A>>2]=t,ar[A+4>>2]=ar[o>>2],e=0|ar[(e=a)>>2],ar[(d=A+8|0)>>2]=e,ur=n}function Ic(A){var e,r,i,f=0;for(ar[(A|=0)+76>>2]=0,e=A+76|(ar[A+80>>2]=0),r=A+72|0,i=(f=A)+72|0;(0|(f=f+4|(ar[f>>2]=0)))<(0|i););ar[r>>2]=e,ar[A+84>>2]=0,ar[A+88>>2]=0,ar[A+92>>2]=0}function Bc(A){var e,r=0,i=0,f=0,n=0;if(0|(r=0|ar[(A|=0)+84>>2])&&((0|(f=0|ar[(i=A+88|0)>>2]))!=(0|r)&&(ar[i>>2]=f+(~((f+-4-r|0)>>>2)<<2)),Vl(r)),function A(e,r){e|=0;r|=0;if(!r)return;A(e,0|ar[r>>2]);A(e,0|ar[r+4>>2]);e=0|ar[r+24>>2];0|e&&Il(e);Vl(r);return}(A+72|0,0|ar[A+76>>2]),0|(r=0|ar[A+68>>2])&&Il(r),0|(r=0|ar[A+60>>2])&&Il(r),0|(r=0|ar[A+52>>2])&&Il(r),0|(r=0|ar[A+44>>2])&&Il(r),0|(r=0|ar[A+36>>2])&&Il(r),0|(r=0|ar[A+28>>2])&&Il(r),0|(r=0|ar[A+20>>2])&&Il(r),0|(r=0|ar[(e=A+4|0)>>2])){if((0|(i=0|ar[(n=A+8|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}r=0|ar[A>>2],ar[A>>2]=0,r&&ds[511&ar[4+(0|ar[r>>2])>>2]](r)}function Ec(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0;if(ur=(t=ur)+16|0,f=t,ar[(A|=0)>>2]=0,ar[(n=A+4|0)>>2]=0,((ar[A+8>>2]=0)|(o=0|ar[e+72>>2]))!=(0|(r=e+76|0))){for(i=A+8|0,c=o,a=o=0;;){if(e=0|ar[56+(0|ar[c+20>>2])>>2],ar[f>>2]=e,o>>>0<a>>>0?(ar[o>>2]=e,ar[n>>2]=o+4):Kf(A,f),e=0|ar[c+4>>2])for(;o=0|ar[e>>2];)e=o;else if(e=0|ar[(o=c+8|0)>>2],(0|ar[e>>2])!=(0|c))for(;c=0|ar[o>>2],e=0|ar[(o=c+8|0)>>2],(0|ar[e>>2])!=(0|c););if((0|e)==(0|r))break;c=e,o=0|ar[n>>2],a=0|ar[i>>2]}ur=t}else ur=t}function Gc(A,e,r){A|=0;var i,f,n,t,o,a,c,l,u,s,b,d,k,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0;for(ur=(k=ur)+320|0,n=k+288|0,o=k+132|0,t=k+120|0,a=k+108|0,c=k+96|0,l=k+84|0,u=k+72|0,N=k+60|0,R=k+48|0,Y=k+36|0,D=k+24|0,s=k+12|0,X=4+(b=(Q=k)+300|0)|0,m=(r|=0)+17|0,p=r+16|0,y=(e|=0)+8|0,Z=e+12|0,C=e+4|0,W=e+24|0,I=e+28|0,B=e+16|0,E=e+20|0,f=11+(i=8+(d=k+144|0)|0)|0;;){if(ar[b>>2]=0,ar[X>>2]=0,An(d,r,b),(0|ar[d>>2])!=(0|ar[12480])){J=40;break}if(0|tr[m>>0]){J=35;break}if(0|tr[p>>0]){J=30;break}(0|(h=0|ar[y>>2]))==(0|ar[Z>>2])?oc(C,b):(ar[h>>2]=ar[b>>2],v=0|ar[X>>2],(ar[h+4>>2]=v)&&(Cl(v),h=0|ar[y>>2]),ar[y>>2]=h+8),v=0|ar[b>>2],1835365473==(0|(h=0|ar[v+20>>2]))&&(0!=(0|v)&&0!=(0|(G=0|lu(v,104,136,0)))?(h=G,(v=g=0|ar[X>>2])&&Cl(g)):v=h=0,ar[W>>2]=h,h=0|ar[I>>2],ar[I>>2]=v,0|h&&Il(h),v=0|ar[b>>2],h=0|ar[v+20>>2]),1718909296==(0|h)&&(0!=(0|v)&&0!=(0|(V=0|lu(v,104,120,0)))?(h=V,(v=g=0|ar[X>>2])&&Cl(g)):v=h=0,ar[B>>2]=h,h=0|ar[E>>2],ar[E>>2]=v,0|h&&Il(h)),(0|tr[f>>0])<0&&Vl(0|ar[i>>2]),0|(h=0|ar[X>>2])&&Il(h)}if(30!=(0|J)&&35!=(0|J)&&40!=(0|J)||((0|tr[f>>0])<0&&Vl(0|ar[i>>2]),0|(h=0|ar[X>>2])&&Il(h)),!(h=0|ar[e+16>>2]))return ar[n>>2]=0,ar[4+n>>2]=0,ar[8+n>>2]=0,Cc(A,2,102,n),0<=(0|tr[11+n>>0])||Vl(0|ar[n>>2]),void(ur=k);if(!(0|function(A,e){e|=0;var r=0;if((0|(r=0|ar[(A|=0)+64>>2]))==(0|(A=0|ar[A+68>>2])))return(e=0)|e;for(;;){if((0|ar[r>>2])==(0|e)){r=1,A=4;break}if((0|(r=r+4|0))==(0|A)){r=0,A=4;break}}return 4==(0|A)?0|r:0}(h,1751476579)))return g=64+d|0,ar[(v=8+d|0)>>2]=4080,w=12+d|0,ar[d>>2]=164,ar[g>>2]=184,Yi(64+d|(ar[4+d>>2]=0),w),ar[136+d>>2]=0,ar[140+d>>2]=-1,ar[d>>2]=4060,ar[g>>2]=4100,ar[v>>2]=4080,Ti(w),ar[w>>2]=3908,ar[(v=44+d|0)>>2]=0,ar[v+4>>2]=0,ar[v+8>>2]=0,ar[v+12>>2]=0,ar[60+d>>2]=24,ar[b>>2]=0,ar[4+b>>2]=0,ar[8+b>>2]=0,Of(w,b),(0|tr[11+b>>0])<0&&Vl(0|ar[b>>2]),Hf(h=8+d|0,21957,40),jf(o,w),Cc(A,3,0,o),(0|tr[11+o>>0])<0&&Vl(0|ar[o>>2]),ar[d>>2]=4060,ar[g>>2]=4100,ar[h>>2]=4080,ar[w>>2]=3908,(0|tr[v+11>>0])<0&&Vl(0|ar[v>>2]),si(w),ci(g),void(ur=k);if(!(h=0|ar[(m=e+24|0)>>2]))return ar[t>>2]=0,ar[4+t>>2]=0,ar[8+t>>2]=0,Cc(A,2,104,t),0<=(0|tr[11+t>>0])||Vl(0|ar[t>>2]),void(ur=k);nc(b,h,1751411826),X=0!=(0|(h=0|ar[b>>2]))&&0!=(0|(w=0|lu(h,104,936,0)))?(h=0|ar[4+b>>2])?(Cl(h),h):0:w=0,0|(h=0|ar[4+b>>2])&&Il(h);do{if(w){if(1885954932!=(0|ar[w+60>>2])){if(ar[c>>2]=0,ar[4+c>>2]=0,ar[8+c>>2]=0,Cc(A,2,114,c),0<=(0|tr[11+c>>0]))break;Vl(0|ar[c>>2]);break}if(nc(b,0|ar[m>>2],1885959277),V=0!=(0|(h=0|ar[b>>2]))&&0!=(0|(_=0|lu(h,104,904,0)))?(h=0|ar[4+b>>2])?(Cl(h),g=_,h):(g=_,0):g=0,0|(h=0|ar[4+b>>2])&&Il(h),g){nc(b,0|ar[m>>2],1768977008),h=0|ar[b>>2];do{if(h){if(nc(d,h,1768973167),w=0!=(0|(h=0|ar[d>>2]))&&0!=(0|(F=0|lu(h,104,744,0)))?(h=F,(v=w=0|ar[4+d>>2])&&Cl(w),v):h=0,ar[(v=e+32|0)>>2]=h,h=0|ar[(F=e+36|0)>>2],ar[F>>2]=w,0|h&&Il(h),0|(h=0|ar[4+d>>2])&&Il(h),!(0|ar[v>>2])){if(ar[N>>2]=0,ar[N+4>>2]=0,ar[N+8>>2]=0,Cc(A,2,108,N),0<=(0|tr[N+11>>0]))break;Vl(0|ar[N>>2]);break}nc(d,0|ar[b>>2],1768975713),h=0|ar[d>>2];do{if(h){if(!(h=0|lu(h,104,712,0))){w=h=0;break}if(!(v=w=0|ar[4+d>>2])){w=v;break}Cl(w),w=v}else w=h=0}while(0);if(ar[(v=e+40|0)>>2]=h,h=0|ar[(N=e+44|0)>>2],ar[N>>2]=w,0|h&&Il(h),0|(h=0|ar[4+d>>2])&&Il(h),!(0|ar[v>>2])){if(ar[R>>2]=0,ar[R+4>>2]=0,ar[R+8>>2]=0,Cc(A,2,109,R),0<=(0|tr[R+11>>0]))break;Vl(0|ar[R>>2]);break}nc(d,0|ar[m>>2],1768714083),h=0|ar[d>>2];do{if(h){if(!(h=0|lu(h,104,872,0))){w=h=0;break}if(!(v=w=0|ar[4+d>>2])){w=v;break}Cl(w),w=v}else w=h=0}while(0);if(ar[(v=e+48|0)>>2]=h,h=0|ar[(R=e+52|0)>>2],ar[R>>2]=w,0|h&&Il(h),0|(h=0|ar[4+d>>2])&&Il(h),!(0|ar[v>>2])){if(ar[Y>>2]=0,ar[Y+4>>2]=0,ar[Y+8>>2]=0,Cc(A,2,110,Y),0<=(0|tr[Y+11>>0]))break;Vl(0|ar[Y>>2]);break}nc(d,0|ar[m>>2],1768186228),h=0|ar[d>>2];do{if(h){if(!(h=0|lu(h,104,456,0))){w=h=0;break}if(!(w=v=0|ar[4+d>>2]))break;Cl(v)}else w=h=0}while(0);ar[e+56>>2]=h,h=0|ar[(Y=e+60|0)>>2],ar[Y>>2]=w,0|h&&Il(h),0|(h=0|ar[4+d>>2])&&Il(h),nc(d,0|ar[m>>2],1769104742),h=0|ar[d>>2];do{if(h){if(!(h=0|lu(h,104,520,0))){w=h=0;break}if(!(w=v=0|ar[4+d>>2]))break;Cl(v)}else w=h=0}while(0);ar[e+64>>2]=h,h=0|ar[(Y=e+68|0)>>2],ar[Y>>2]=w,0|h&&Il(h),0|(h=0|ar[4+d>>2])&&Il(h),nc(d,0|ar[m>>2],1768517222),h=0|ar[d>>2];do{if(h){ar[e+96>>2]=ar[g+56>>2],tc(s,h,1768842853),h=0|ar[s>>2],W=0|ar[(G=4+s|0)>>2];A:do{if((0|h)==(0|W))J=167;else{for(I=e+72|0,E=B=e+76|0,C=e+80|0,Z=h;;){if(!(h=0|ar[Z>>2])){h=0;break}if(!(w=0|lu(h,104,808,0))){h=0;break}if(p=w,(h=0|ar[Z+4>>2])?Cl(h):h=0,!w)break;(y=0==(0|(r=h)))?m=0|ar[w+56>>2]:(Cl(h),m=0|ar[w+56>>2],Cl(h)),w=0|ar[B>>2];do{if(w){for(g=E;;)if(m>>>0<(v=0|ar[w+16>>2])>>>0){if(!(v=0|ar[w>>2])){J=151;break}g=w,w=v}else{if(m>>>0<=v>>>0){J=155;break}if(!(v=0|ar[(g=w+4|0)>>2])){J=154;break}w=v}if(151==(0|J)){J=0,g=v=w;break}if(154==(0|J)){J=0,v=w;break}if(155==(0|J)){J=0,v=w;break}}else g=v=B}while(0);do{if(0|ar[g>>2]){if(!h)break;Il(h)}else w=0|El(28),ar[w+16>>2]=m,ar[w+20>>2]=p,ar[w+24>>2]=r,ar[w>>2]=0,ar[w+4>>2]=0,ar[w+8>>2]=v,ar[g>>2]=w,(v=0|ar[ar[I>>2]>>2])&&(ar[I>>2]=v,w=0|ar[g>>2]),Vc(0|ar[E>>2],w),ar[C>>2]=1+(0|ar[C>>2])}while(0);if(y||(Il(h),Il(h)),(0|(Z=Z+8|0))==(0|W)){J=167;break A}}if(ar[Q>>2]=0,ar[Q+4>>2]=0,ar[Q+8>>2]=0,Cc(A,2,125,Q),(0|tr[Q+11>>0])<0&&Vl(0|ar[Q>>2]),!h)break;Il(h)}}while(0);if(167==(0|J)&&(e=0|ar[(D=49920)+4>>2],ar[(Q=A)>>2]=ar[D>>2],ar[Q+4>>2]=e,Rl(A+8|0,49928)),0|(h=0|ar[s>>2])){if((0|(w=0|ar[G>>2]))!=(0|h)){for(;v=w+-8|0,ar[G>>2]=v,(0|(w=(w=0|ar[w+-4>>2])?(Il(w),0|ar[G>>2]):v))!=(0|h););h=0|ar[s>>2]}Vl(h)}}else{if(ar[D>>2]=0,ar[D+4>>2]=0,ar[D+8>>2]=0,Cc(A,2,111,D),0<=(0|tr[D+11>>0]))break;Vl(0|ar[D>>2])}}while(0);0|(h=0|ar[4+d>>2])&&Il(h)}else ar[u>>2]=0,ar[4+u>>2]=0,ar[8+u>>2]=0,Cc(A,2,112,u),(0|tr[11+u>>0])<0&&Vl(0|ar[u>>2])}while(0);0|(h=0|ar[4+b>>2])&&Il(h)}else ar[l>>2]=0,ar[4+l>>2]=0,ar[8+l>>2]=0,Cc(A,2,107,l),(0|tr[11+l>>0])<0&&Vl(0|ar[l>>2]);0|V&&Il(V)}else ar[a>>2]=0,ar[4+a>>2]=0,ar[8+a>>2]=0,Cc(A,2,105,a),(0|tr[11+a>>0])<0&&Vl(0|ar[a>>2])}while(0);ur=(X&&Il(X),k)}function Vc(A,e){var r=0,i=0,f=0,n=0,t=0;if(t=(0|(e|=0))==(0|(A|=0)),tr[e+12>>0]=1&t,!t){for(;;){if(t=0|ar[e+8>>2],0|tr[(f=t+12|0)>>0]){r=23;break}if(i=0|ar[(n=t+8|0)>>2],(0|(r=0|ar[i>>2]))==(0|t)){if(!(r=0|ar[i+4>>2])){r=7;break}if(0|tr[(r=r+12|0)>>0]){r=7;break}e=r}else{if(!r){r=16;break}if(0|tr[(r=r+12|0)>>0]){r=16;break}e=r}if(tr[f>>0]=1,t=(0|i)==(0|A),tr[i+12>>0]=1&t,tr[e>>0]=1,t){r=23;break}e=i}if(7==(0|r))return f=(0|ar[t>>2])==(0|e)?(e=t,i):(r=0|ar[(A=t+4|0)>>2],e=0|ar[r>>2],e=(ar[A>>2]=e)?(ar[e+8>>2]=t,0|ar[n>>2]):i,ar[r+8>>2]=e,e=0|ar[n>>2],ar[((0|ar[e>>2])==(0|t)?e:e+4|0)>>2]=r,ar[r>>2]=t,ar[n>>2]=r,0|ar[(e=r)+8>>2]),tr[e+12>>0]=1,e=(tr[f+12>>0]=0)|ar[f>>2],i=0|ar[(r=e+4|0)>>2],0|(ar[f>>2]=i)&&(ar[i+8>>2]=f),t=f+8|0,ar[e+8>>2]=ar[t>>2],n=0|ar[t>>2],ar[((0|ar[n>>2])==(0|f)?n:n+4|0)>>2]=e,ar[r>>2]=f,void(ar[t>>2]=e);if(16==(0|r))return(0|ar[t>>2])==(0|e)?(f=0|ar[t>>2],e=0|ar[(r=f+4|0)>>2],(ar[t>>2]=e)&&(ar[e+8>>2]=t,i=0|ar[n>>2]),ar[f+8>>2]=i,e=0|ar[n>>2],ar[((0|ar[e>>2])==(0|t)?e:e+4|0)>>2]=f,ar[r>>2]=t,ar[n>>2]=f,i=0|ar[(e=f)+8>>2]):e=t,tr[e+12>>0]=1,e=(tr[i+12>>0]=0)|ar[(t=i+4|0)>>2],r=0|ar[e>>2],0|(ar[t>>2]=r)&&(ar[r+8>>2]=i),t=i+8|0,ar[e+8>>2]=ar[t>>2],n=0|ar[t>>2],ar[((0|ar[n>>2])==(0|i)?n:n+4|0)>>2]=e,ar[e>>2]=i,void(ar[t>>2]=e)}}function Xc(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o=0,a=0;ur=(t=ur)+48|0,ar[(f=(n=t)+24|0)>>2]=0,ar[4+f>>2]=0,4294967279<i>>>(ar[8+f>>2]=0)&&Nl(),i>>>0<11?(tr[11+f>>0]=i)?(o=f,a=6):o=f:(o=0|El(a=i+16&-16),ar[f>>2]=o,ar[8+f>>2]=-2147483648|a,ar[4+f>>2]=i,a=6),6==(0|a)&&Eu(0|o,0|r,0|i),a=(o=(tr[o+i>>0]=0)|El(140))+60|0,r=o+8|0,ar[o>>2]=1012,ar[a>>2]=1032,ar[o+4>>2]=0,Yi(a,r),ar[o+132>>2]=0,ar[o+136>>2]=-1,ar[o>>2]=5384,ar[a>>2]=5404,Ti(r),ar[r>>2]=3908,ar[(a=o+40|0)>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[o+56>>2]=8,Of(r,f),r=0|ar[e>>2],ar[e>>2]=o,r&&(ds[511&ar[4+(0|ar[r>>2])>>2]](r),o=0|ar[e>>2]),tr[n+17>>0]=0,ar[(a=n+8|0)>>2]=i,ar[a+4>>2]=0,tr[n+16>>0]=0==(0|i)&1,ar[n>>2]=o,ar[n+4>>2]=0,Gc(A,e,n),ur=(0<=(0|tr[11+f>>0])||Vl(0|ar[f>>2]),t)}function _c(A,e,r){A|=0,r|=0;var i,f=0,n=0;if(0|(f=0|ar[(i=(e|=0)+76|0)>>2])){e=i,n=f;A:for(;;){for(f=n;!((0|ar[f+16>>2])>>>0>=r>>>0);)if(!(f=0|ar[f+4>>2]))break A;if(!(n=0|ar[f>>2])){e=f;break}e=f}if((0|e)!=(0|i)&&(0|ar[e+16>>2])>>>0<=r>>>0)return void Rl(A,64+(0|ar[e+20>>2])|0)}ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0}function Fc(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t,o;return ur=(o=ur)+32|0,f=o+12|0,n=o,(t=0|ar[(e|=0)+32>>2])?0|ar[(e=e+40|0)>>2]?(lc(A,t,r,e,i),void(ur=o)):(ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,109,n),void(ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),o))):(ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Cc(A,2,108,f),0<=(0|tr[11+f>>0])||Vl(0|ar[f>>2]),void(ur=o))}function Nc(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t,o,a,c,l,u,s,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;if(ur=(s=ur)+320|0,c=s+192|0,w=s+284|0,g=s+260|0,u=s+296|0,l=s+272|0,W=s+48|0,n=s+248|0,f=s+236|0,y=s+24|0,o=s+224|0,t=s+212|0,a=s,0|(k=0|ar[(v=(e|=0)+76|0)>>2])){b=v,h=k;A:for(;;){for(d=h;!((0|ar[d+16>>2])>>>0>=r>>>0);)if(!(d=0|ar[d+4>>2]))break A;if(!(h=0|ar[d>>2])){b=d;break}b=d}if((0|b)!=(0|v)&&(0|ar[b+16>>2])>>>0<=r>>>0){b=v;A:for(;;){for(d=k;!((0|ar[d+16>>2])>>>0>=r>>>0);)if(!(d=0|ar[d+4>>2]))break A;if(!(k=0|ar[d>>2])){b=d;break}b=d}if((0|b)!=(0|v)&&(0|ar[b+16>>2])>>>0<=r>>>0){if(Rl(u,64+(0|ar[b+20>>2])|0),function(A,e){e|=0;var r,i,f,n=0;if(ar[(A|=0)>>2]=0,ar[(f=A+4|0)>>2]=0,ar[A+8>>2]=0,n=(0|ar[(i=e+4|0)>>2])-(0|ar[e>>2])|0,!(r=n>>5))return;134217727<r>>>0&&il();if(n=0|El(n),ar[f>>2]=n,ar[A>>2]=n,ar[A+8>>2]=n+(r<<5),A=0|ar[e>>2],e=0|ar[i>>2],(0|A)==(0|e))return;for(;ar[n>>2]=ar[A>>2],ar[n+4>>2]=ar[A+4>>2],ar[n+8>>2]=ar[A+8>>2],ar[n+12>>2]=ar[A+12>>2],fc(n+16|0,A+16|0),A=A+32|0,n=32+(0|ar[f>>2])|0,ar[f>>2]=n,(0|A)!=(0|e););}(l,56+(0|ar[(p=e+48|0)>>2])|0),(0|(b=0|ar[l>>2]))!=(0|(d=0|ar[(C=4+l|0)>>2]))){for(m=0;m=(g=(0|ar[b>>2])==(0|r))?b:m,!(g|(0|(b=b+32|0))==(0|d)););if(m){ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Cc(c,4,3e3,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),d=0|tr[(k=11+u|0)>>0],b=0|ar[(h=4+u|0)>>2];do{if(4==(0|(d<<24>>24<0?b:255&d))){if(0|zl(u,0,-1,27385,4)){d=0|tr[k>>0],b=0|ar[h>>2],Z=66;break}if(ar[W>>2]=0,ar[(g=W+4|0)>>2]=0,lc(y,(ar[W+8>>2]=0)|ar[e+32>>2],r,e+40|0,W),0|ar[y>>2])h=0|ar[(e=y)+4>>2],ar[(i=A)>>2]=ar[e>>2],ar[i+4>>2]=h,h=y+8|0,ar[(i=A+8|0)>>2]=ar[h>>2],ar[i+4>>2]=ar[h+4>>2],ar[i+8>>2]=ar[h+8>>2],ar[h>>2]=0,ar[h+4>>2]=0,ar[h+8>>2]=0,h=1;else{b=0|ar[W>>2],v=0|ar[g>>2];A:do{if((0|b)==(0|v))b=0,Z=45;else{for(w=b,h=0;;){if(b=0|ar[w+4>>2],1752589123==(0|ar[b+20>>2])){do{if(b){if(!(b=0|lu(b,104,488,0))){b=d=0;break}if(d=b,!(b=k=0|ar[w+8>>2]))break;Cl(k)}else b=d=0}while(0);if(0|h&&Il(h),d)break}else b=h;if((0|(w=w+12|0))==(0|v)){Z=45;break A}h=b}if(!(0|pc(d,i))){if(ar[t>>2]=0,ar[4+t>>2]=0,ar[8+t>>2]=0,Cc(A,2,117,t),0<=(0|tr[11+t>>0])){d=1;break}Vl(0|ar[t>>2]),d=1;break}ac(a,0|ar[p>>2],m,0|ar[e>>2],e+56|0,i),d=0|ar[(k=a)+4>>2],ar[(h=c)>>2]=ar[k>>2],ar[h+4>>2]=d,d=a+8|0,(0|tr[(k=(h=8+c|0)+11|0)>>0])<0?(tr[ar[h>>2]>>0]=0,ar[12+c>>2]=0):(tr[h>>0]=0,tr[k>>0]=0),Ml(h,0),ar[h>>2]=ar[d>>2],ar[h+4>>2]=ar[d+4>>2],ar[h+8>>2]=ar[d+8>>2],d=0}}while(0);45==(0|Z)&&(ar[o>>2]=0,ar[4+o>>2]=0,ar[8+o>>2]=0,Cc(A,2,106,o),d=((0|tr[11+o>>0])<0&&Vl(0|ar[o>>2]),1)),h=(b&&Il(b),d)}if((0|tr[(b=y+8|0)+11>>0])<0&&Vl(0|ar[b>>2]),0|(b=0|ar[W>>2])){if((0|(d=0|ar[g>>2]))!=(0|b)){for(;k=d+-12|0,ar[g>>2]=k,(0|(d=(d=0|ar[d+-4>>2])?(Il(d),0|ar[g>>2]):k))!=(0|b););b=0|ar[W>>2]}Vl(b)}h||(Z=78)}else Z=66}while(0);A:do{if(66==(0|Z)){4==(0|(d<<24>>24<0?b:255&d))?0|zl(u,0,-1,27390,4)&&(d=0|tr[k>>0],b=0|ar[h>>2],Z=69):Z=69;do{if(69==(0|Z)){if(4==(0|(d<<24>>24<0?b:255&d))){if(!(0|zl(u,0,-1,27400,4)))break;d=0|tr[k>>0],b=0|ar[h>>2]}if(4!=(0|(d<<24>>24<0?b:255&d))){Z=78;break A}if(0|zl(u,0,-1,27077,4)){Z=78;break A}}}while(0);ac(W,0|ar[p>>2],m,0|ar[e>>2],e+56|0,i),b=0|ar[(d=W)+4>>2],ar[(k=c)>>2]=ar[d>>2],ar[k+4>>2]=b,b=W+8|0,(0|tr[(d=(k=8+c|0)+11|0)>>0])<0?(tr[ar[k>>2]>>0]=0,ar[12+c>>2]=0):(tr[k>>0]=0,tr[d>>0]=0),Ml(k,0),ar[k>>2]=ar[b>>2],ar[k+4>>2]=ar[b+4>>2],ar[k+8>>2]=ar[b+8>>2],Z=78}}while(0);do{if(78==(0|Z)){if((0|ar[c>>2])==(0|ar[12480])){y=0|ar[(i=49920)+4>>2],ar[(W=A)>>2]=ar[i>>2],ar[W+4>>2]=y,Rl(A+8|0,49928);break}y=0|ar[(i=c)+4>>2],ar[(W=A)>>2]=ar[i>>2],ar[W+4>>2]=y,W=A+8|0,A=8+c|0,ar[W>>2]=ar[A>>2],ar[W+4>>2]=ar[A+4>>2],ar[W+8>>2]=ar[A+8>>2],ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0;break}}while(0);(0|tr[(b=8+c|0)+11>>0])<0&&Vl(0|ar[b>>2])}else Z=21}else Z=21;if(21==(0|Z)&&(d=W+64|0,ar[(h=W+8|0)>>2]=4080,k=W+12|0,ar[W>>2]=164,ar[d>>2]=184,Yi(W+64|(ar[W+4>>2]=0),k),ar[W+136>>2]=0,ar[W+140>>2]=-1,ar[W>>2]=4060,ar[d>>2]=4100,ar[h>>2]=4080,Ti(k),ar[k>>2]=3908,ar[(h=W+44|0)>>2]=0,ar[h+4>>2]=0,ar[h+8>>2]=0,ar[h+12>>2]=0,ar[W+60>>2]=24,ar[c>>2]=0,ar[4+c>>2]=0,ar[8+c>>2]=0,Of(k,c),(0|tr[11+c>>0])<0&&Vl(0|ar[c>>2]),Hf(0|qi(0|Hf(b=W+8|0,22068,13),r),22082,23),jf(n,k),Cc(A,2,117,n),(0|tr[11+n>>0])<0&&Vl(0|ar[n>>2]),ar[W>>2]=4060,ar[d>>2]=4100,ar[b>>2]=4080,ar[k>>2]=3908,(0|tr[h+11>>0])<0&&Vl(0|ar[h>>2]),si(k),ci(d)),0|(b=0|ar[l>>2])){if((0|(d=0|ar[C>>2]))!=(0|b)){for(;k=d+-32|0,ar[C>>2]=k,(0|(d=(h=0|ar[d+-16>>2])?((0|(k=0|ar[(d=d+-12|0)>>2]))!=(0|h)&&(ar[d>>2]=k+(24*~(((k+-24-h|0)>>>0)/24|0)|0)),Vl(h),0|ar[C>>2]):k))!=(0|b););b=0|ar[l>>2]}Vl(b)}return(0|tr[11+u>>0])<0&&Vl(0|ar[u>>2]),void(ur=s)}return(ar[g>>2]=0,ar[g+4>>2]=0,ar[g+8>>2]=0,Cc(A,5,2e3,g),0<=(0|tr[g+11>>0]))?void(ur=s):(Vl(0|ar[g>>2]),void(ur=s))}}ar[w>>2]=0,ar[w+4>>2]=0,ar[w+8>>2]=0,Cc(A,5,2e3,w),ur=(0<=(0|tr[w+11>>0])||Vl(0|ar[w>>2]),s)}function Rc(A,e){A|=0;var r=0;(e|=0)&&(Rc(A,0|ar[e>>2]),Rc(A,0|ar[e+4>>2]),0|(A=0|ar[e+32>>2])&&((0|ar[(r=e+36|0)>>2])!=(0|A)&&(ar[r>>2]=A),Vl(A)),Vl(e))}function Yc(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0,ar[(A|=0)+24>>2]=e,ar[A+28>>2]=r,ar[A+32>>2]=i,ar[A+36>>2]=f}function Jc(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0;var n,t,o,a,c,l=0,u=0,s=0,b=0,d=0,k=0;ur=(c=ur)+48|0,n=c+12|0,t=c,(0|(f|=0))<=0&&br(22106,22121,50,22135),ar[(o=12+n|0)>>2]=0,ar[(a=16+n|0)>>2]=0,ar[20+n>>2]=0,ar[n>>2]=r,ar[4+n>>2]=i,ar[8+n>>2]=f,l=0|sr(f=(f+7|0)/8|0,r),ar[(u=24+n|0)>>2]=l,s=12+n|0,(f=0|sr(0|sr(i,r),f))?(dn(s,f),b=0|ar[s>>2],d=0|ar[a>>2],k=0|ar[20+n>>2],l=0|ar[u>>2]):k=d=b=0,ar[t>>2]=ar[n>>2],ar[t+4>>2]=ar[4+n>>2],ar[t+8>>2]=ar[8+n>>2],ar[20+n>>2]=0,ar[a>>2]=0,s=A+40|(ar[s>>2]=0),f=0|ar[(r=A+44|0)>>2];do{if(f){for(i=A+44|0;;)if((0|e)<(0|(r=0|ar[f+16>>2]))){if(!(r=0|ar[f>>2])){r=10;break}i=f,f=r}else{if((0|e)<=(0|r)){r=14;break}if(!(r=0|ar[(i=f+4|0)>>2])){r=13;break}f=r}if(10==(0|r)){i=u=f;break}if(13==(0|r)){u=f;break}if(14==(0|r)){u=f;break}}else i=u=r}while(0);0|ar[i>>2]?0|b&&Vl(b):(f=0|El(48),ar[f+16>>2]=e,ar[(r=f+20|0)>>2]=ar[t>>2],ar[r+4>>2]=ar[t+4>>2],ar[r+8>>2]=ar[t+8>>2],ar[f+32>>2]=b,ar[f+36>>2]=d,ar[f+40>>2]=k,ar[f+44>>2]=l,ar[f>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=u,ar[i>>2]=f,(r=0|ar[ar[s>>2]>>2])&&(ar[s>>2]=r,f=0|ar[i>>2]),Vc(0|ar[A+44>>2],f),ar[(A=A+48|0)>>2]=1+(0|ar[A>>2])),ur=((f=0|ar[o>>2])&&((0|ar[a>>2])!=(0|f)&&(ar[a>>2]=f),Vl(f)),c)}function Dc(A,e){return A|=0,(e|=0)&&(Dc(A,0|ar[e>>2]),Dc(A,0|ar[e+4>>2]),void Vl(e))}function Qc(A,e,r){e|=0,r|=0;var i,f=0,n=0;if(!(f=0|ar[(i=(A|=0)+44|0)>>2]))return(r=0)|r;A=i,n=f;A:for(;;){for(f=n;!((0|ar[f+16>>2])>=(0|e));)if(!(f=0|ar[f+4>>2]))break A;if(!(n=0|ar[f>>2])){A=f;break}A=f}return(0|A)==(0|i)||(0|ar[A+16>>2])>(0|e)?(r=0)|r:(0|r&&(ar[r>>2]=ar[A+44>>2]),0|(r=0|ar[A+32>>2]))}function Tc(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;ur=(o=ur)+64|0,t=o+36|0,ar[(k=(n=o)+32|0)>>2]=r,b=(d=0|ar[e>>2])+40|0,c=0|ar[(l=d+44|0)>>2];do{if(c){for(u=d+44|0;;)if((0|r)<(0|(l=0|ar[c+16>>2]))){if(!(l=0|ar[c>>2])){l=6;break}u=c,c=l}else{if((0|r)<=(0|l)){l=10;break}if(!(l=0|ar[(u=c+4|0)>>2])){l=9;break}c=l}if(6==(0|l)){u=s=c;break}if(9==(0|l)){s=c;break}if(10==(0|l)){s=c;break}}else u=s=l}while(0);(c=0|ar[u>>2])||(l=0|El(48),ar[l+16>>2]=r,ar[(c=l+20|0)>>2]=0,ar[c+4>>2]=0,ar[c+8>>2]=0,ar[c+12>>2]=0,ar[c+16>>2]=0,ar[c+20>>2]=0,ar[c+24>>2]=0,ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=s,ar[u>>2]=l,c=(c=0|ar[ar[b>>2]>>2])?(ar[b>>2]=c,0|ar[u>>2]):l,Vc(0|ar[d+44>>2],c),ar[(c=d+48|0)>>2]=1+(0|ar[c>>2]),c=l),b=c+20|0,ar[t>>2]=ar[b>>2],ar[4+t>>2]=ar[b+4>>2],ar[8+t>>2]=ar[b+8>>2],l=c+32|0,ar[(b=12+t|0)>>2]=0,ar[(f=16+t|0)>>2]=0,(ar[20+t>>2]=0)|(u=(0|ar[(s=c+36|0)>>2])-(0|ar[l>>2])|0)&&((0|u)<0&&il(),r=0|El(u),ar[f>>2]=r,ar[b>>2]=r,ar[20+t>>2]=r+u,u=0|ar[l>>2],0<(0|(l=(0|ar[s>>2])-u|0))&&(Eu(0|r,0|u,0|l),ar[f>>2]=r+l)),ar[(u=24+t|0)>>2]=ar[c+44>>2],function(A,e){e|=0;var r,i=0,f=0,n=0,t=0;if(!(t=0|ar[(n=4+(A|=0)|0)>>2]))return t=0;r=0|ar[e>>2],f=n,i=t;A:for(;;){for(e=i;!((0|ar[e+16>>2])>=(0|r));)if(!(e=0|ar[e+4>>2]))break A;if(!(i=0|ar[e>>2])){f=e;break}f=e}if((0|f)==(0|n))return t=0;if((0|r)<(0|ar[f+16>>2]))return t=0;if(e=0|ar[f+4>>2])for(;i=0|ar[e>>2];)e=i;else if(e=0|ar[(i=f+8|0)>>2],(0|ar[e>>2])!=(0|f))for(;n=0|ar[i>>2],e=0|ar[(i=n+8|0)>>2],(0|ar[e>>2])!=(0|n););(0|ar[A>>2])==(0|f)&&(ar[A>>2]=e);ar[(e=A+8|0)>>2]=(0|ar[e>>2])-1,function(A,e){A|=0;var r,i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if(t=0|ar[(e|=0)>>2])if(n=0|ar[e+4>>2])for(;;){if(!(t=0|ar[n>>2])){t=0;break}n=t}else n=e;else n=e,t=0;r=n+4|0,i=0|ar[(0|t?n:r)>>2],l=n+8|0,(f=0!=(0|i))&&(ar[8+i>>2]=ar[l>>2]);t=0|ar[l>>2],(0|ar[t>>2])==(0|n)?(ar[t>>2]=i,(0|n)==(0|A)?(A=i,c=0):(t=t+4|0,u=10)):(ar[t+4>>2]=i,u=10);10==(0|u)&&(c=0|ar[t>>2]);a=0!=(0|tr[(o=n+12|0)>>0]),(0|n)!=(0|e)&&(t=0|ar[(u=e+8|0)>>2],ar[l>>2]=t,ar[((0|ar[ar[u>>2]>>2])==(0|e)?t:t+4|0)>>2]=n,t=0|ar[e>>2],ar[n>>2]=t,ar[t+8>>2]=n,t=0|ar[e+4>>2],0|(ar[r>>2]=t)&&(ar[t+8>>2]=n),tr[o>>0]=0|tr[e+12>>0],A=(0|A)==(0|e)?n:A);if(!(a&0!=(0|A)))return;if(f)return tr[12+i>>0]=1;for(;;){if(a=0|ar[c+8>>2],t=0!=(0|tr[(n=c+12|0)>>0]),(0|ar[a>>2])==(0|c)){if(t?l=c:(tr[n>>0]=1,tr[a+12>>0]=0,n=0|ar[a>>2],o=0|ar[(t=n+4|0)>>2],0|(ar[a>>2]=o)&&(ar[o+8>>2]=a),u=a+8|0,ar[n+8>>2]=ar[u>>2],l=0|ar[u>>2],ar[((0|ar[l>>2])==(0|a)?l:l+4|0)>>2]=n,ar[t>>2]=a,ar[u>>2]=n,u=0|ar[c+4>>2],l=0|ar[u>>2],A=(0|A)==(0|u)?c:A),n=0|ar[l>>2],!(o=0==(0|n))&&0==(0|tr[n+12>>0])){A=l,u=55;break}if(0|(a=0|ar[(t=l+4|0)>>2])&&0==(0|tr[a+12>>0])){u=49;break}if(((tr[l+12>>0]=0)|(n=0|ar[l+8>>2]))==(0|A)|0==(0|tr[(t=n+12|0)>>0])){u=48;break}}else{if(t?o=c:(tr[n>>0]=1,tr[a+12>>0]=0,n=0|ar[(u=a+4|0)>>2],t=0|ar[n>>2],0|(ar[u>>2]=t)&&(ar[t+8>>2]=a),u=a+8|0,ar[n+8>>2]=ar[u>>2],o=0|ar[u>>2],ar[((0|ar[o>>2])==(0|a)?o:o+4|0)>>2]=n,ar[n>>2]=a,ar[u>>2]=n,u=0|ar[c>>2],o=0|ar[u+4>>2],A=(0|A)==(0|u)?c:A),0|(t=0|ar[o>>2])&&0==(0|tr[t+12>>0])){u=31;break}if(0|(n=0|ar[o+4>>2])&&0==(0|tr[n+12>>0])){A=n,u=32;break}if(((tr[o+12>>0]=0)|(n=0|ar[o+8>>2]))==(0|A)){u=30;break}if(!(0|tr[n+12>>0])){A=n,u=30;break}}c=0|ar[n+8>>2],c=0|ar[((0|ar[c>>2])==(0|n)?c+4|0:c)>>2]}do{if(30==(0|u))return tr[A+12>>0]=1;if(31==(0|u))A=0|ar[o+4>>2],u=A?32:33;else{if(48==(0|u))return tr[t>>0]=1;if(49==(0|u)){if(o)A=a;else{if(!(0|tr[n+12>>0])){A=l,u=55;break}A=0|ar[(t=A=l+4|0)>>2]}tr[A+12>>0]=1,tr[l+12>>0]=0,n=0|ar[A>>2],0|(ar[t>>2]=n)&&(ar[n+8>>2]=l),n=l+8|0,ar[A+8>>2]=ar[n>>2],u=0|ar[n>>2],ar[((0|ar[u>>2])==(0|l)?u:u+4|0)>>2]=A,ar[A>>2]=l,ar[n>>2]=A,n=l,u=55}}}while(0);if(32==(0|u))0|tr[A+12>>0]?u=33:n=o;else if(55==(0|u))return o=0|ar[A+8>>2],t=o+12|0,tr[A+12>>0]=0|tr[t>>0],tr[t>>0]=1,tr[n+12>>0]=1,A=0|ar[o>>2],t=0|ar[(n=A+4|0)>>2],0|(ar[o>>2]=t)&&(ar[t+8>>2]=o),u=o+8|0,ar[A+8>>2]=ar[u>>2],e=0|ar[u>>2],ar[((0|ar[e>>2])==(0|o)?e:e+4|0)>>2]=A,ar[n>>2]=o,ar[u>>2]=A;33==(0|u)&&(tr[t+12>>0]=1,tr[o+12>>0]=0,n=0|ar[(A=t+4|0)>>2],0|(ar[o>>2]=n)&&(ar[n+8>>2]=o),n=o+8|0,ar[t+8>>2]=ar[n>>2],u=0|ar[n>>2],ar[((0|ar[u>>2])==(0|o)?u:u+4|0)>>2]=t,ar[A>>2]=o,ar[n>>2]=t,n=t,A=o);t=0|ar[n+8>>2],u=t+12|0,tr[n+12>>0]=0|tr[u>>0],tr[u>>0]=1,tr[A+12>>0]=1,A=0|ar[(u=t+4|0)>>2],n=0|ar[A>>2],0|(ar[u>>2]=n)&&(ar[n+8>>2]=t);u=t+8|0,ar[A+8>>2]=ar[u>>2],e=0|ar[u>>2],ar[((0|ar[e>>2])==(0|t)?e:e+4|0)>>2]=A,ar[A>>2]=t,ar[u>>2]=A}(t,f),0|(e=0|ar[f+32>>2])&&((0|ar[(i=f+36|0)>>2])!=(0|e)&&(ar[i>>2]=e),Vl(e));Vl(f),t=1}(40+(0|ar[e>>2])|0,k),ar[n>>2]=i,ar[(d=n+4|0)>>2]=ar[t>>2],ar[d+4>>2]=ar[4+t>>2],ar[d+8>>2]=ar[8+t>>2],ar[(e=n+16|0)>>2]=0,ar[(k=n+20|0)>>2]=0,l=(ar[n+24>>2]=0)|ar[b>>2],c=(0|ar[f>>2])-l|0;do{if(c){if(!((0|c)<0)){a=0|El(c),ar[k>>2]=a,w=(ar[e>>2]=a)+c|0,ar[n+24>>2]=w,Eu(0|a,0|l,0|c),ar[k>>2]=w,h=a;break}il()}else a=w=h=0}while(0);r=0|ar[u>>2],ar[n+28>>2]=r,b=A+40|0,c=0|ar[(l=A+44|0)>>2];do{if(c){for(u=A+44|0;;)if((0|i)<(0|(l=0|ar[c+16>>2]))){if(!(l=0|ar[c>>2])){l=30;break}u=c,c=l}else{if((0|i)<=(0|l)){l=34;break}if(!(l=0|ar[(u=c+4|0)>>2])){l=33;break}c=l}if(30==(0|l)){u=s=c;break}if(33==(0|l)){s=c;break}if(34==(0|l)){s=c;break}}else u=s=l}while(0);0|ar[u>>2]||(a=0|El(48),ar[a+16>>2]=i,ar[(c=a+20|0)>>2]=ar[d>>2],ar[c+4>>2]=ar[d+4>>2],ar[c+8>>2]=ar[d+8>>2],ar[a+32>>2]=h,ar[a+36>>2]=w,ar[a+40>>2]=w,ar[n+24>>2]=0,ar[k>>2]=0,ar[e>>2]=0,ar[a+44>>2]=r,ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=s,ar[u>>2]=a,(c=0|ar[ar[b>>2]>>2])&&(ar[b>>2]=c,a=0|ar[u>>2]),Vc(0|ar[A+44>>2],a),ar[(a=A+48|0)>>2]=1+(0|ar[a>>2]),a=0|ar[n+16>>2]),0|a&&((0|ar[k>>2])!=(0|a)&&(ar[k>>2]=a),Vl(a)),ur=((a=0|ar[12+t>>2])&&((0|ar[f>>2])!=(0|a)&&(ar[f>>2]=a),Vl(a)),o)}function Mc(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o=0,a=0;ur=(t=ur)+16|0,f=t,ar[(A|=0)>>2]=0,o=(ar[(n=A+4|0)>>2]=0)|ar[(a=e+32|0)>>2];do{if((0|o)!=(0|r)&&1==(0|r)&0==(0|o)){if(3==(0|i)&1==(0|(o=0|ar[e+36>>2]))){Sc(f,e),o=0|ar[f+4>>2],ar[A>>2]=ar[f>>2],ar[n>>2]=o;break}if(10==(0|i)&1==(0|o)){Uc(f,e),o=0|ar[f+4>>2],ar[A>>2]=ar[f>>2],ar[n>>2]=o;break}11==(0|i)&1==(0|o)?(Oc(f,e),o=0|ar[f+4>>2],ar[A>>2]=ar[f>>2],ar[n>>2]=o):o=0}else o=0}while(0);ur=(1==(0|r)&&(0|ar[a>>2])==(0|r)&&10==(0|i)&&3==(0|ar[e+36>>2])&&(function(A,e){A|=0;var r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0;if(0|(f=0|ar[(c=44+(e|=0)|0)>>2])){r=c,n=f;A:for(;;){for(i=n;!(3<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|c)&&(0|ar[r+16>>2])<=3&&8==(0|ar[r+28>>2])){r=c,n=f;A:for(;;){for(i=n;!(4<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|c)&&(0|ar[r+16>>2])<=4&&8==(0|ar[r+28>>2])){r=c;A:for(;;){for(i=f;!(5<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|c)&&(0|ar[r+16>>2])<=5&&8==(0|ar[r+28>>2])){if(i=0|El(64),ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i>>2]=5420,ar[(f=i+12|0)>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,ar[f+12>>2]=0,ar[f+16>>2]=0,ar[i+32>>2]=26780,ar[(n=i+36|0)>>2]=0,ar[(t=i+40|0)>>2]=0,ar[(o=i+44|0)>>2]=99,ar[(a=i+48|0)>>2]=99,ar[(u=i+56|0)>>2]=0,ar[i+60>>2]=0,ar[i+52>>2]=u,d=f,b=(k=i)+16|0,Cl(i),Wl(i),r=0|ar[b>>2],ar[f>>2]=d,ar[b>>2]=k,0|r&&Bl(r),Il(i),i=0|ar[(b=e+24|0)>>2],l=0|ar[(s=e+28|0)>>2],ar[n>>2]=i,ar[t>>2]=l,ar[o>>2]=1,ar[a>>2]=10,Jc(f,10,i,l,24),t=0|ar[c>>2]){r=c,f=t;A:for(;;){for(i=f;!(3<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}a=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=3?(o=0|ar[r+32>>2],0|ar[r+44>>2]):o=0,r=c,f=t;A:for(;;){for(i=f;!(4<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}n=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=4?0|ar[r+32>>2]:0,r=c,f=t;A:for(;;){for(i=f;!(5<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}e=(c=(l=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=5?0|ar[r+32>>2]:0,o),a)}else e=c=n=l=0;if(i=0|ar[u>>2]){r=u;A:for(;;){for(f=i;!(10<=(0|ar[f+16>>2]));){if(!(i=0|ar[f+4>>2]))break A;f=i}if(!(i=0|ar[f>>2])){r=f;break}r=f}t=(0|r)!=(0|u)&&(0|ar[r+16>>2])<=10?(a=0|ar[r+32>>2],0|ar[r+44>>2]):a=0}else t=a=0;if(0<(0|(r=0|ar[s>>2]))){o=0;do{if(0<(0|ar[b>>2])){for(i=0|sr(o,e),f=0|sr(o,t),r=0;h=r+i|0,tr[a+(u=(3*r|0)+f|0)>>0]=0|tr[c+h>>0],tr[a+(u+1)>>0]=0|tr[n+h>>0],tr[a+(u+2)>>0]=0|tr[l+h>>0],(0|(r=r+1|0))<(0|ar[b>>2]););r=0|ar[s>>2]}o=o+1|0}while((0|o)<(0|r))}return ar[A>>2]=d,ar[A+4>>2]=k}}}}ar[A>>2]=0,ar[A+4>>2]=0}(f,e),i=0|ar[f>>2],a=0|ar[(r=f+4|0)>>2],ar[f>>2]=0,ar[r>>2]=0,ar[A>>2]=i,ar[n>>2]=a,0|o&&Il(o)),t)}function Sc(A,e){A|=0;var r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;if(0|(f=0|ar[(c=(e|=0)+44|0)>>2])){r=c,n=f;A:for(;;){for(i=n;!(0<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|c)&&(0|ar[r+16>>2])<=0&&8==(0|ar[r+28>>2])){r=c,n=f;A:for(;;){for(i=n;!(1<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|c)&&(0|ar[r+16>>2])<=1&&8==(0|ar[r+28>>2])){r=c;A:for(;;){for(i=f;!(2<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|c)&&(0|ar[r+16>>2])<=2&&8==(0|ar[r+28>>2])){if(i=0|El(64),ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i>>2]=5420,ar[(f=i+12|0)>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,ar[f+12>>2]=0,ar[f+16>>2]=0,ar[i+32>>2]=26780,ar[(n=i+36|0)>>2]=0,ar[(t=i+40|0)>>2]=0,ar[(o=i+44|0)>>2]=99,ar[(a=i+48|0)>>2]=99,ar[(u=i+56|0)>>2]=0,ar[i+60>>2]=0,ar[i+52>>2]=u,Z=f,y=(C=i)+16|0,Cl(i),Wl(i),r=0|ar[y>>2],ar[f>>2]=Z,ar[y>>2]=C,0|r&&Bl(r),Il(i),g=0|ar[(y=e+24|0)>>2],m=0|ar[(p=e+28|0)>>2],ar[n>>2]=g,ar[t>>2]=m,ar[o>>2]=1,Jc(f,ar[a>>2]=3,g,m,8),Jc(f,4,0|ar[y>>2],0|ar[p>>2],8),Jc(f,5,0|ar[y>>2],0|ar[p>>2],8),o=0|ar[c>>2]){r=c,f=o;A:for(;;){for(i=f;!(0<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}e=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=0?(a=0|ar[r+32>>2],0|ar[r+44>>2]):a=0,r=c,f=o;A:for(;;){for(i=f;!(1<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}t=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=1?(n=0|ar[r+32>>2],0|ar[r+44>>2]):n=0,f=c,i=o;A:for(;;){for(r=i;!(2<=(0|ar[r+16>>2]));)if(!(r=0|ar[r+4>>2])){r=f;break A}if(!(i=0|ar[r>>2]))break;f=r}v=(g=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=2?(m=0|ar[r+32>>2],0|ar[r+44>>2]):m=0,e)}else v=t=g=a=n=m=0;if(c=0|ar[u>>2]){r=u,f=c;A:for(;;){for(i=f;!(3<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}s=(0|r)!=(0|u)&&(0|ar[r+16>>2])<=3?(l=0|ar[r+32>>2],0|ar[r+44>>2]):l=0,r=u,f=c;A:for(;;){for(i=f;!(4<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}e=(0|r)!=(0|u)&&(0|ar[r+16>>2])<=4?(o=0|ar[r+32>>2],0|ar[r+44>>2]):o=0,f=u,i=c;A:for(;;){for(r=i;!(5<=(0|ar[r+16>>2]));)if(!(r=0|ar[r+4>>2])){r=f;break A}if(!(i=0|ar[r>>2]))break;f=r}d=(k=(0|r)!=(0|u)&&(0|ar[r+16>>2])<=5?(h=l,w=0|ar[r+32>>2],0|ar[r+44>>2]):(h=l,w=0),e)}else s=d=k=w=h=o=0;if(0<(0|(r=0|ar[p>>2]))){b=0;do{if(0<(0|ar[y>>2])){for(i=0|sr(b,v),f=0|sr(e=(0|b)/2|0,t),e=0|sr(e,g),c=0|sr(b,s),l=0|sr(b,d),u=0|sr(b,k),r=0;I=+((0|cr[n+((W=(0|r)/2|0)+f)>>0])-128|0),E=+((0|cr[m+(W+e)>>0])-128|0),W=~~((B=1.1640000343322754*((0|cr[a+(r+i)>>0])-16|0))+1.5959999561309814*E),tr[h+(r+c)>>0]=(0|W)<0?0:255<(0|W)?-1:255&W,W=~~(B-.8130000233650208*E-.39100000262260437*I),tr[o+(r+l)>>0]=(0|W)<0?0:255<(0|W)?-1:255&W,W=~~(B+2.0179998874664307*I),tr[w+(r+u)>>0]=(0|W)<0?0:255<(0|W)?-1:255&W,(0|(r=r+1|0))<(0|ar[y>>2]););r=0|ar[p>>2]}b=b+1|0}while((0|b)<(0|r))}return ar[A>>2]=Z,void(ar[A+4>>2]=C)}}}}ar[A>>2]=0,ar[A+4>>2]=0}function Uc(A,e){A|=0;var r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;if(0|(f=0|ar[(l=(e|=0)+44|0)>>2])){r=l,n=f;A:for(;;){for(i=n;!(0<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|l)&&(0|ar[r+16>>2])<=0&&8==(0|ar[r+28>>2])){r=l,n=f;A:for(;;){for(i=n;!(1<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|l)&&(0|ar[r+16>>2])<=1&&8==(0|ar[r+28>>2])){r=l;A:for(;;){for(i=f;!(2<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|l)&&(0|ar[r+16>>2])<=2&&8==(0|ar[r+28>>2])){if(i=0|El(64),ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i>>2]=5420,ar[(f=i+12|0)>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,ar[f+12>>2]=0,ar[f+16>>2]=0,ar[i+32>>2]=26780,ar[(n=i+36|0)>>2]=0,ar[(t=i+40|0)>>2]=0,ar[(o=i+44|0)>>2]=99,ar[(a=i+48|0)>>2]=99,ar[(c=i+56|0)>>2]=0,ar[i+60>>2]=0,ar[i+52>>2]=c,w=f,h=(v=i)+16|0,Cl(i),Wl(i),r=0|ar[h>>2],ar[f>>2]=w,ar[h>>2]=v,0|r&&Bl(r),Il(i),b=0|ar[(h=e+24|0)>>2],d=0|ar[(k=e+28|0)>>2],ar[n>>2]=b,ar[t>>2]=d,ar[o>>2]=1,Jc(f,ar[a>>2]=10,b,d,24),o=0|ar[l>>2]){r=l,f=o;A:for(;;){for(i=f;!(0<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}e=(0|r)!=(0|l)&&(0|ar[r+16>>2])<=0?(a=0|ar[r+32>>2],0|ar[r+44>>2]):a=0,r=l,f=o;A:for(;;){for(i=f;!(1<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}t=(0|r)!=(0|l)&&(0|ar[r+16>>2])<=1?(n=0|ar[r+32>>2],0|ar[r+44>>2]):n=0,f=l,i=o;A:for(;;){for(r=i;!(2<=(0|ar[r+16>>2]));)if(!(r=0|ar[r+4>>2])){r=f;break A}if(!(i=0|ar[r>>2]))break;f=r}l=(u=(s=(0|r)!=(0|l)&&(0|ar[r+16>>2])<=2?(b=a,d=0|ar[r+32>>2],0|ar[r+44>>2]):(b=a,d=0),t),e)}else l=u=s=d=b=n=0;if(i=0|ar[c>>2]){r=c;A:for(;;){for(f=i;!(10<=(0|ar[f+16>>2]));){if(!(i=0|ar[f+4>>2]))break A;f=i}if(!(i=0|ar[f>>2])){r=f;break}r=f}a=(0|r)!=(0|c)&&(0|ar[r+16>>2])<=10?(c=0|ar[r+32>>2],0|ar[r+44>>2]):c=0}else a=c=0;if(0<(0|(r=0|ar[k>>2]))){e=0;do{if(0<(0|ar[h>>2])){for(i=0|sr(e,l),f=0|sr(t=(0|e)/2|0,u),t=0|sr(t,s),o=0|sr(e,a),r=0;p=+((0|cr[n+((m=(0|r)/2|0)+f)>>0])-128|0),Z=+((0|cr[d+(m+t)>>0])-128|0),m=~~((y=1.1640000343322754*((0|cr[b+(r+i)>>0])-16|0))+1.5959999561309814*Z),tr[c+(g=(3*r|0)+o|0)>>0]=(0|m)<0?0:255<(0|m)?-1:255&m,m=~~(y-.8130000233650208*Z-.39100000262260437*p),tr[c+(g+1)>>0]=(0|m)<0?0:255<(0|m)?-1:255&m,m=~~(y+2.0179998874664307*p),tr[c+(g+2)>>0]=(0|m)<0?0:255<(0|m)?-1:255&m,(0|(r=r+1|0))<(0|ar[h>>2]););r=0|ar[k>>2]}e=e+1|0}while((0|e)<(0|r))}return ar[A>>2]=w,void(ar[A+4>>2]=v)}}}}ar[A>>2]=0,ar[A+4>>2]=0}function Oc(A,e){A|=0;var r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0;if(0|(f=0|ar[(s=(e|=0)+44|0)>>2])){r=s,n=f;A:for(;;){for(i=n;!(0<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|s)&&(0|ar[r+16>>2])<=0&&8==(0|ar[r+28>>2])){r=s,n=f;A:for(;;){for(i=n;!(1<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(n=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|s)&&(0|ar[r+16>>2])<=1&&8==(0|ar[r+28>>2])){r=s;A:for(;;){for(i=f;!(2<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}if((0|r)!=(0|s)&&(0|ar[r+16>>2])<=2&&8==(0|ar[r+28>>2])){if(i=0|El(64),ar[i+4>>2]=0,ar[i+8>>2]=0,ar[i>>2]=5420,ar[(f=i+12|0)>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,ar[f+12>>2]=0,ar[f+16>>2]=0,ar[i+32>>2]=26780,ar[(n=i+36|0)>>2]=0,ar[(t=i+40|0)>>2]=0,ar[(o=i+44|0)>>2]=99,ar[(a=i+48|0)>>2]=99,ar[(u=i+56|0)>>2]=0,ar[i+60>>2]=0,ar[i+52>>2]=u,p=f,m=(y=i)+16|0,Cl(i),Wl(i),r=0|ar[m>>2],ar[f>>2]=p,ar[m>>2]=y,0|r&&Bl(r),Il(i),v=0|ar[(m=e+24|0)>>2],l=0|ar[(g=e+28|0)>>2],ar[n>>2]=v,ar[t>>2]=l,ar[o>>2]=1,ar[a>>2]=11,Jc(f,10,v,l,32),e=0==(0|(l=0|ar[s>>2])))c=33;else{r=s,f=l;A:for(;;){for(i=f;!(6<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}(0|r)!=(0|s)&&(0|ar[r+16>>2])<=6||(c=33)}if(33==(0|c)&&(r=s),v=(0|r)!=(0|s),e)d=t=k=h=n=w=0;else{r=s,f=l;A:for(;;){for(i=f;!(0<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}a=(0|r)!=(0|s)&&(0|ar[r+16>>2])<=0?(o=0|ar[r+32>>2],0|ar[r+44>>2]):o=0,r=s,f=l;A:for(;;){for(i=f;!(1<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}t=(0|r)!=(0|s)&&(0|ar[r+16>>2])<=1?(n=0|ar[r+32>>2],0|ar[r+44>>2]):n=0,f=s,i=l;A:for(;;){for(r=i;!(2<=(0|ar[r+16>>2]));)if(!(r=0|ar[r+4>>2])){r=f;break A}if(!(i=0|ar[r>>2]))break;f=r}d=(k=(0|r)!=(0|s)&&(0|ar[r+16>>2])<=2?(w=0|ar[r+32>>2],h=o,0|ar[r+44>>2]):(h=o,w=0),a)}if(e|1^v)s=b=0;else{r=s,f=l;A:for(;;){for(i=f;!(6<=(0|ar[i+16>>2]));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){r=i;break}r=i}s=(0|r)!=(0|s)&&(0|ar[r+16>>2])<=6?(b=0|ar[r+32>>2],0|ar[r+44>>2]):b=0}if(i=0|ar[u>>2]){r=u;A:for(;;){for(f=i;!(10<=(0|ar[f+16>>2]));){if(!(i=0|ar[f+4>>2]))break A;f=i}if(!(i=0|ar[f>>2])){r=f;break}r=f}f=(0|r)!=(0|u)&&(0|ar[r+16>>2])<=10?(u=0|ar[r+32>>2],0|ar[r+44>>2]):u=0}else f=u=0;if(0<(0|ar[g>>2])){o=0;do{if(0<(0|ar[m>>2]))if(a=0|sr(o,d),e=0|sr(c=(0|o)/2|0,t),c=0|sr(c,k),l=0|sr(o,f),i=0|sr(o,s),v)for(r=0;W=+((0|cr[n+((C=(0|r)/2|0)+e)>>0])-128|0),B=+((0|cr[w+(C+c)>>0])-128|0),C=~~((I=1.1640000343322754*((0|cr[h+(r+a)>>0])-16|0))+1.5959999561309814*B),tr[u+(Z=(r<<2)+l|0)>>0]=(0|C)<0?0:255<(0|C)?-1:255&C,C=~~(I-.8130000233650208*B-.39100000262260437*W),tr[u+(Z+1)>>0]=(0|C)<0?0:255<(0|C)?-1:255&C,C=~~(I+2.0179998874664307*W),tr[u+(Z+2)>>0]=(0|C)<0?0:255<(0|C)?-1:255&C,tr[u+(Z+3)>>0]=0|tr[b+(r+i)>>0],(0|(r=r+1|0))<(0|ar[m>>2]););else for(r=0;B=+((0|cr[n+((Z=(0|r)/2|0)+e)>>0])-128|0),W=+((0|cr[w+(Z+c)>>0])-128|0),Z=~~((I=1.1640000343322754*((0|cr[h+(r+a)>>0])-16|0))+1.5959999561309814*W),tr[u+(C=(r<<2)+l|0)>>0]=(0|Z)<0?0:255<(0|Z)?-1:255&Z,Z=~~(I-.8130000233650208*W-.39100000262260437*B),tr[u+(C+1)>>0]=(0|Z)<0?0:255<(0|Z)?-1:255&Z,Z=~~(I+2.0179998874664307*B),tr[u+(C+2)>>0]=(0|Z)<0?0:255<(0|Z)?-1:255&Z,tr[u+(C+3)>>0]=-1,(0|(r=r+1|0))<(0|ar[m>>2]););o=o+1|0}while((0|o)<(0|ar[g>>2]))}return ar[A>>2]=p,void(ar[A+4>>2]=y)}}}}ar[A>>2]=0,ar[A+4>>2]=0}function Hc(A,e,r,i){A|=0,e|=0,i|=0;var f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0;if(ur=(p=ur)+16|0,m=p,!(r|=0))return t=0|ar[e>>2],(f=0|ar[e+4>>2])||(p=0|C(4),ar[p>>2]=15880,I(0|p,3520,276)),(n=0|function(A){var e,r=0,i=0;r=0|ar[(e=4+(A|=0)|0)>>2];for(;;){if(-1==(0|r)){A=0;break}if((0|(i=0|ar[e>>2]))==(0|r)&&(ar[e>>2]=r+1),(0|i)==(0|r))break;r=i}return 0|A}(f))||(p=0|C(4),ar[p>>2]=15880,I(0|p,3520,276)),ar[i>>2]=t,f=0|ar[(m=i+4|0)>>2],ar[m>>2]=n,0|f&&Il(f),r=0|ar[(g=49920)+4>>2],ar[(m=A)>>2]=ar[g>>2],ar[m+4>>2]=r,Rl(A+8|0,49928),void(ur=p);switch(f=0|ar[e+24>>2],n=0|ar[e+28>>2],0|r){case 90:case 270:l=f,f=n;break;default:l=n}o=0|El(64),ar[o+4>>2]=0,ar[o+8>>2]=0,ar[o>>2]=5420,ar[(n=o+12|0)>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,ar[n+12>>2]=0,ar[n+16>>2]=0,ar[o+32>>2]=26780,ar[o+36>>2]=0,ar[o+40>>2]=0,ar[o+44>>2]=99,ar[o+48>>2]=99,ar[(a=o+56|0)>>2]=0,ar[o+60>>2]=0,ar[o+52>>2]=a,a=n,k=(c=o)+16|0,Cl(o),Wl(o),t=0|ar[k>>2],ar[n>>2]=a,ar[k>>2]=c,0|t&&Bl(t),Il(o),ar[i>>2]=a,t=0|ar[(k=i+4|0)>>2],ar[k>>2]=c,t?(Il(t),n=0|ar[(k=i)>>2]):k=i,b=0|ar[e+32>>2],d=0|ar[e+36>>2],ar[n+24>>2]=f,ar[n+28>>2]=l,ar[n+32>>2]=b,ar[n+36>>2]=d,f=0|ar[e+40>>2],d=e+44|0;A:do{if((0|f)!=(0|d)){for(e=0;l=0|ar[f+16>>2],8==(0|ar[f+28>>2]);){switch(n=0|ar[(a=f+20|0)>>2],t=0|ar[(c=f+24|0)>>2],0|r){case 90:case 270:o=n,n=t;break;default:o=t}if(Jc(0|ar[k>>2],l,n,o,8),b=0|ar[a>>2],i=0|ar[c>>2],u=0|ar[f+44>>2],s=0|ar[f+32>>2],a=44+(0|ar[k>>2])|0,t=0|ar[a>>2]){n=a;e:for(;;){for(o=t;!((0|ar[o+16>>2])>=(0|l));){if(!(t=0|ar[o+4>>2]))break e;o=t}if(!(t=0|ar[o>>2])){n=o;break}n=o}(0|n)!=(0|a)&&(0|ar[n+16>>2])<=(0|l)?(c=0|ar[n+32>>2],e=0|ar[n+44>>2]):c=0}else c=0;switch(0|r){case 270:if(0<(0|i)&&(g=i+-1|0,0<(0|b))){t=0;do{for(o=0|sr(g-t|0,u),n=0;l=c+((0|sr(n,e))+t)|0,tr[l>>0]=0|tr[s+(n+o)>>0],(0|(n=n+1|0))!=(0|b););t=t+1|0}while((0|t)!=(0|i))}break;case 180:if(0<(0|i)&&(w=i+-1|0,v=b+-1|0,0<(0|b))){t=0;do{for(o=v+(0|sr(w-t|0,u))|0,a=0|sr(t,e),n=0;tr[c+(n+a)>>0]=0|tr[s+(o-n)>>0],(0|(n=n+1|0))!=(0|b););t=t+1|0}while((0|t)!=(0|i))}break;case 90:if(0<(0|i)&&(h=b+-1|0,0<(0|b))){n=0;do{for(o=h+(0|sr(n,u))|0,t=0;l=c+((0|sr(t,e))+n)|0,tr[l>>0]=0|tr[s+(o-t)>>0],(0|(t=t+1|0))!=(0|b););n=n+1|0}while((0|n)!=(0|i))}}if(n=0|ar[f+4>>2])for(f=n;n=0|ar[f>>2];)f=n;else if(t=0|ar[(n=f+8|0)>>2],(0|ar[t>>2])==(0|f))f=t;else for(;b=0|ar[n>>2],f=0|ar[(n=b+8|0)>>2],(0|ar[f>>2])!=(0|b););if((0|f)==(0|d))break A}for(f=0|El(64),ar[m>>2]=f,ar[m+8>>2]=-2147483584,t=22220,o=(n=f)+(ar[m+4>>2]=54)|0;tr[n>>0]=0|tr[t>>0],t=t+1|0,(0|(n=n+1|0))<(0|o););return(Cc(A,4,tr[f+54>>0]=0,m),0<=(0|tr[m+11>>0]))?void(ur=p):(Vl(0|ar[m>>2]),void(ur=p))}}while(0);r=0|ar[(g=49920)+4>>2],ar[(m=A)>>2]=ar[g>>2],ar[m+4>>2]=r,Rl(A+8|0,49928),ur=p}function xc(A,e,r){A|=0,r|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0;ur=(f=ur)+16|0,w=f,n=0|ar[(e|=0)+40>>2],i=e+44|0;A:do{if((0|n)!=(0|i)){for(;8==(0|ar[n+28>>2]);){if(c=0|ar[n+20>>2],l=0|ar[n+24>>2],s=0|ar[n+44>>2],b=0|ar[n+32>>2],r){if(0<(0|l)&&(k=(0|c)/2|0,h=c+-1|0,1<(0|c))){t=0;do{for(a=h+(o=0|sr(t,s))|0,e=0;u=b+(a-e)|0,c=0|tr[(v=b+(e+o)|0)>>0],tr[v>>0]=0|tr[u>>0],tr[u>>0]=c,(0|(e=e+1|0))<(0|k););t=t+1|0}while((0|t)!=(0|l))}}else if(u=(0|l)/2|0,1<(0|l)&&(d=l+-1|0,0<(0|c))){e=0;do{for(o=0|sr(e,s),a=0|sr(d-e|0,s),t=0;v=b+(t+a)|0,l=0|tr[(g=b+(t+o)|0)>>0],tr[g>>0]=0|tr[v>>0],tr[v>>0]=l,(0|(t=t+1|0))!=(0|c););e=e+1|0}while((0|e)<(0|u))}if(e=0|ar[n+4>>2])for(;n=0|ar[e>>2];)e=n;else if(e=0|ar[(t=n+8|0)>>2],(0|ar[e>>2])!=(0|n))for(n=t;g=0|ar[n>>2],e=0|ar[(n=g+8|0)>>2],(0|ar[e>>2])!=(0|g););if((0|e)==(0|i))break A;n=e}for(e=0|El(64),ar[w>>2]=e,ar[w+8>>2]=-2147483584,t=22220,o=(n=e)+(ar[w+4>>2]=54)|0;tr[n>>0]=0|tr[t>>0],t=t+1|0,(0|(n=n+1|0))<(0|o););return(Cc(A,4,tr[e+54>>0]=0,w),0<=(0|tr[w+11>>0]))?void(ur=f):(Vl(0|ar[w>>2]),void(ur=f))}}while(0);v=0|ar[(w=49920)+4>>2],ar[(g=A)>>2]=ar[w>>2],ar[g+4>>2]=v,Rl(A+8|0,49928),ur=f}function jc(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0;var o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;ur=(o=ur)+16|0,Z=o,u=0|El(64),ar[u+4>>2]=0,ar[u+8>>2]=0,ar[u>>2]=5420,ar[(a=u+12|0)>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[a+16>>2]=0,ar[u+32>>2]=26780,ar[u+36>>2]=0,ar[u+40>>2]=0,ar[u+44>>2]=99,ar[u+48>>2]=99,ar[(l=u+56|0)>>2]=0,ar[u+60>>2]=0,ar[u+52>>2]=l,l=a,y=(s=u)+16|0,Cl(u),Wl(u),c=0|ar[y>>2],ar[a>>2]=l,ar[y>>2]=s,0|c&&Bl(c),Il(u),ar[t>>2]=l,c=0|ar[(y=t+4|0)>>2],ar[y>>2]=s,c?(Il(c),a=0|ar[(y=t)>>2]):y=t,p=0|ar[e+32>>2],m=0|ar[e+36>>2],ar[a+24>>2]=1-r+i,ar[a+28>>2]=1-f+n,ar[a+32>>2]=p,ar[a+36>>2]=m,a=0|ar[e+40>>2],m=e+44|0;A:do{if((0|a)!=(0|m)){for(p=e+24|0,g=e+28|0,e=0;s=0|ar[a+16>>2],8==(0|ar[a+28>>2]);){if(d=0|ar[a+20>>2],w=0|ar[a+24>>2],b=(0|(b=0|sr(d,r)))/(0|(h=0|ar[p>>2]))|0,h=(0|sr(d,i))/(0|h)|0,d=(0|(d=0|sr(w,f)))/(0|(k=0|ar[g>>2]))|0,k=(0|sr(w,n))/(0|k)|0,h=h-b+1|0,Jc(0|ar[y>>2],s,h,1-d+k|0,8),w=0|ar[a+44>>2],v=0|ar[a+32>>2],t=44+(0|ar[y>>2])|0,l=0|ar[t>>2]){c=t;e:for(;;){for(u=l;!((0|ar[u+16>>2])>=(0|s));){if(!(l=0|ar[u+4>>2]))break e;u=l}if(!(l=0|ar[u>>2])){c=u;break}c=u}u=(0|c)!=(0|t)&&(0|ar[c+16>>2])<=(0|s)?(l=0|ar[c+32>>2],0|ar[c+44>>2]):(l=0,e)}else l=0,u=e;if((0|d)<=(0|k))for(c=d;Eu(l+(0|sr(c-d|0,u))|0,v+((0|sr(c,w))+b)|0,0|h),(0|c)<(0|k);)c=c+1|0;if(c=0|ar[a+4>>2])for(a=c;c=0|ar[a>>2];)a=c;else if(l=0|ar[(c=a+8|0)>>2],(0|ar[l>>2])==(0|a))a=l;else for(;v=0|ar[c>>2],a=0|ar[(c=v+8|0)>>2],(0|ar[a>>2])!=(0|v););if((0|a)==(0|m))break A;e=u}for(a=0|El(64),ar[Z>>2]=a,ar[Z+8>>2]=-2147483584,l=22220,u=(c=a)+(ar[Z+4>>2]=54)|0;tr[c>>0]=0|tr[l>>0],l=l+1|0,(0|(c=c+1|0))<(0|u););return(Cc(A,4,tr[a+54>>0]=0,Z),0<=(0|tr[Z+11>>0]))?void(ur=o):(Vl(0|ar[Z>>2]),void(ur=o))}}while(0);n=0|ar[(f=49920)+4>>2],ar[(Z=A)>>2]=ar[f>>2],ar[Z+4>>2]=n,Rl(A+8|0,49928),ur=o}function zc(A,e,r,i,f){A|=0,e|=0,i|=0,f|=0;var n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;ur=(t=ur)+48|0,I=t+12|0,function(A,e){e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0;if(ar[(i=(A|=0)+4|0)>>2]=0,n=A+4|(ar[(f=A+8|0)>>2]=0),ar[A>>2]=n,(0|(t=0|ar[e+40>>2]))!=(0|(r=e+44|0)))for(l=t,e=0;;){c=l+16|0;do{if(e){for(a=0|ar[c>>2],o=i;;){if((0|a)<(0|(t=0|ar[e+16>>2]))){if(!(t=0|ar[e>>2])){t=9;break}}else{if((0|a)<=(0|t)){t=13;break}if(!(t=0|ar[(o=e+4|0)>>2])){t=12;break}e=o}o=e,e=t}if(9==(0|t)){o=a=e;break}if(12==(0|t)){a=e;break}if(13==(0|t)){a=e;break}}else o=a=n}while(0);if(0|ar[o>>2]||(e=0|El(20),ar[e+16>>2]=ar[c>>2],ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=a,ar[o>>2]=e,(t=0|ar[ar[A>>2]>>2])&&(ar[A>>2]=t,e=0|ar[o>>2]),Vc(0|ar[i>>2],e),ar[f>>2]=1+(0|ar[f>>2])),e=0|ar[l+4>>2])for(;t=0|ar[e>>2];)e=t;else if(e=0|ar[(t=l+8|0)>>2],(0|ar[e>>2])!=(0|l))for(;l=0|ar[t>>2],e=0|ar[(t=l+8|0)>>2],(0|ar[e>>2])!=(0|l););if((0|e)==(0|r))break;l=e,e=0|ar[n>>2]}}(n=(B=t)+24|0,0|ar[(r|=0)>>2]),o=0|ar[n>>2],E=4+n|0;A:do{if((0|o)!=(0|E)){for(W=e+44|0,Z=(C=(0|i)<0)?0-i|0:0,C=C?0:i,y=(0|f)<0?0-f|0:0,l=u=0,e=o;;){if(g=0|ar[e+16>>2],k=44+(0|ar[r>>2])|0,s=0==(0|(d=0|ar[k>>2])))v=0,p=l;else{o=k,c=d;e:for(;;){for(a=c;!((0|ar[a+16>>2])>=(0|g));)if(!(a=0|ar[a+4>>2]))break e;if(!(c=0|ar[a>>2])){o=a;break}o=a}p=(0|o)!=(0|k)&&(0|ar[o+16>>2])<=(0|g)?(v=0|ar[o+32>>2],0|ar[o+44>>2]):(v=0,l)}if(l=0==(0|(h=0|ar[W>>2])))w=0,m=u;else{o=W,c=h;e:for(;;){for(a=c;!((0|ar[a+16>>2])>=(0|g));)if(!(a=0|ar[a+4>>2]))break e;if(!(c=0|ar[a>>2])){o=a;break}o=a}m=(0|o)!=(0|W)&&(0|ar[o+16>>2])<=(0|g)?(w=0|ar[o+32>>2],0|ar[o+44>>2]):(w=0,u)}if(s){e=36;break}o=k,c=d;e:for(;;){for(a=c;!((0|ar[a+16>>2])>=(0|g));)if(!(a=0|ar[a+4>>2]))break e;if(!(c=0|ar[a>>2])){o=a;break}o=a}if(b=(0|o)!=(0|k)&&(0|ar[o+16>>2])<=(0|g)?0|ar[o+20>>2]:-1,s)u=-1;else{o=k,c=d;e:for(;;){for(a=c;!((0|ar[a+16>>2])>=(0|g));)if(!(a=0|ar[a+4>>2]))break e;if(!(c=0|ar[a>>2])){o=a;break}o=a}u=(0|o)!=(0|k)&&(0|ar[o+16>>2])<=(0|g)?0|ar[o+24>>2]:-1}if((0|b)<=-1){e=36;break}if((0|u)<=-1){e=38;break}if(l){e=56;break}o=W,c=h;e:for(;;){for(a=c;!((0|ar[a+16>>2])>=(0|g));)if(!(a=0|ar[a+4>>2]))break e;if(!(c=0|ar[a>>2])){o=a;break}o=a}l=(0|o)!=(0|W)&&(0|ar[o+16>>2])<=(0|g)?0|ar[o+20>>2]:-1,o=W,c=h;e:for(;;){for(a=c;!((0|ar[a+16>>2])>=(0|g));)if(!(a=0|ar[a+4>>2]))break e;if(!(c=0|ar[a>>2])){o=a;break}o=a}if(o=(0|o)!=(0|W)&&(0|ar[o+16>>2])<=(0|g)?0|ar[o+24>>2]:-1,(0|l)<=-1){e=56;break}if((0|o)<=-1){e=58;break}if(((u=(0|o)<(u+f|0)?o-f|0:u)|(a=(0|l)<(b+i|0)?l-i|0:b)|0)<0){e=60;break}if(!((0|Z)<(0|a)&(0|y)<(0|u))){e=64;break}for(l=w+C|0,c=v+Z|0,a=a-Z|0,o=y;Eu(l+(0|sr(o+f|0,m))|0,c+(0|sr(o,p))|0,0|a),(0|(o=o+1|0))<(0|u););if(o=0|ar[e+4>>2])for(e=o;o=0|ar[e>>2];)e=o;else if(a=0|ar[(o=e+8|0)>>2],(0|ar[a>>2])==(0|e))e=a;else for(;g=0|ar[o>>2],e=0|ar[(o=g+8|0)>>2],(0|ar[e>>2])!=(0|g););if((0|e)==(0|E))break A;u=m,l=p}if(36==(0|e))br(22343,22121,638,22353);else if(38==(0|e))br(22361,22121,639,22353);else if(56==(0|e))br(22371,22121,643,22353);else if(58==(0|e))br(22382,22121,644,22353);else{if(60==(0|e)){for(ar[I>>2]=0,ar[I+4>>2]=0,e=(ar[I+8>>2]=0)|El(64),ar[I>>2]=e,ar[I+8>>2]=-2147483584,a=22393,c=(o=e)+(ar[I+4>>2]=54)|0;tr[o>>0]=0|tr[a>>0],a=a+1|0,(0|(o=o+1|0))<(0|c););return(tr[e+54>>0]=0,Cc(A,2,122,I),0<=(0|tr[I+11>>0]))?(Dc(n,E=0|ar[E>>2]),void(ur=t)):(Vl(0|ar[I>>2]),Dc(n,E=0|ar[E>>2]),void(ur=t))}if(64==(0|e)){for(ar[B>>2]=0,ar[B+4>>2]=0,e=(ar[B+8>>2]=0)|El(64),ar[B>>2]=e,ar[B+8>>2]=-2147483584,a=22448,c=(o=e)+(ar[B+4>>2]=50)|0;tr[o>>0]=0|tr[a>>0],a=a+1|0,(0|(o=o+1|0))<(0|c););return(tr[e+50>>0]=0,Cc(A,2,122,B),0<=(0|tr[B+11>>0]))?(Dc(n,E=0|ar[E>>2]),void(ur=t)):(Vl(0|ar[B>>2]),Dc(n,E=0|ar[E>>2]),void(ur=t))}}}}while(0);I=0|ar[(f=49920)+4>>2],ar[(B=A)>>2]=ar[f>>2],ar[B+4>>2]=I,Rl(A+8|0,49928),Dc(n,E=0|ar[E>>2]),ur=t}function Pc(A){var e;ar[(A|=0)>>2]=15332,(0|(0|ar[(e=A+8|0)>>2]))!=(0|hf())&&fi(0|ar[e>>2]),lf()}function Lc(A){var e,r,i=0,f=0;for(ar[(A|=0)>>2]=15380,e=A+8|0,r=A+12|0,f=0;i=0|ar[e>>2],!(f>>>0>=(0|ar[r>>2])-i>>2>>>0);)0|(i=0|ar[i+(f<<2)>>2])&&yl(i),f=f+1|0;Yl(A+144|0),function(A){var e,r=0,i=0,f=0;e=0|ar[(A|=0)>>2];do{if(0|e){for(i=0|ar[(r=A+4|0)>>2];(0|i)!=(0|e);)f=i+-4|0,ar[r>>2]=f,i=f;if((A+16|0)==(0|e)){tr[A+128>>0]=0;break}Vl(e);break}}while(0)}(e),lf()}function Kc(A){var e;ar[(A|=0)>>2]=15400,0|(e=0|ar[A+8>>2])&&0|tr[A+12>>0]&&Xl(e),lf()}function qc(){return 0|ar[2704]}function $c(){return 0|ar[2319]}function Al(){return 0|ar[2318]}function el(A){ar[(A|=0)>>2]=15452,Yl(A+12|0),lf()}function rl(A){ar[(A|=0)>>2]=15492,Yl(A+16|0),lf()}function il(){kA()}function fl(A,e){e|=0;var r,i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x,j,z,P,L,K,q,$,AA,eA,rA,iA,fA,nA,tA,oA,aA,cA,lA=0,uA=0,sA=0,bA=0;for(r=ur=(i=ur)+31&-32,ur=ur+16|0,ar[(A|=0)+4>>2]=e+-1,ar[A>>2]=15380,f=lA=A+8|0,n=28,n|=0,ar[(f|=0)>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,(tr[f+128>>0]=0)|n&&(function(A,e){var r=0;(0|al(A|=0))>>>0<(e|=0)>>>0&&il();r=e>>>0<29&0==(0|tr[(r=A+128|0)>>0])?(tr[r>>0]=1,A+16|0):0|El(e<<2);ar[A+4>>2]=r,ar[A>>2]=r,ar[A+8>>2]=r+(e<<2)}(f,n),ol(f,n)),ar[(e=A+144|0)>>2]=0,ar[e+4>>2]=0,4294967279<(uA=(ar[e+8>>2]=0)|Fi(47010))>>>0&&Nl(),uA>>>0<11?tr[e+11>>0]=uA:(sA=0|El(bA=uA+16&-16),ar[e>>2]=sA,ar[A+152>>2]=-2147483648|bA,ar[A+148>>2]=uA,e=sA),di(e,47010,uA),Ni(e+uA|(tr[r>>0]=0),r),e=0|ar[lA>>2],uA=0|ar[(lA=A+12|0)>>2];(0|uA)!=(0|e);)bA=uA+-4|0,uA=ar[lA>>2]=bA;ar[12531]=0,ar[12530]=13044,t=A,o=50120,nl(t|=0,o|=0,0|vf(52520)),ar[12533]=0,ar[12532]=13076,a=A,c=50128,nl(a|=0,c|=0,0|vf(52528)),function(A,e,r,i){e|=0,r|=0,i|=0,ar[4+(A|=0)>>2]=i+-1,ar[A>>2]=15400,ar[(i=A+8|0)>>2]=e,tr[A+12>>0]=1&r,e||(r=0|Al(),ar[i>>2]=r)}(50136,0,0,1),l=A,u=50136,nl(l|=0,u|=0,0|vf(52536)),ar[12539]=0,ar[12538]=15596,s=A,b=50152,nl(s|=0,b|=0,0|vf(52568)),ar[12541]=0,ar[12540]=15664,d=A,k=50160,nl(d|=0,k|=0,0|vf(54328)),function(A,e){e|=0,ar[4+(A|=0)>>2]=e+-1,ar[A>>2]=15332,e=0|hf(),ar[A+8>>2]=e}(50168,1),h=A,w=50168,nl(h|=0,w|=0,0|vf(54336)),ar[12547]=0,ar[12546]=15712,v=A,g=50184,nl(v|=0,g|=0,0|vf(54344)),ar[12549]=0,ar[12548]=15760,m=A,p=50192,nl(m|=0,p|=0,0|vf(54352)),function(A,e){for(e|=0,ar[4+(A|=0)>>2]=e+-1,ar[A>>2]=15452,tr[A+8>>0]=46,tr[A+9>>0]=44,ar[(e=A+12|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0}(50200,1),y=A,Z=50200,nl(y|=0,Z|=0,0|vf(52552)),function(A,e){for(e|=0,ar[4+(A|=0)>>2]=e+-1,ar[A>>2]=15492,ar[A+8>>2]=46,ar[A+12>>2]=44,ar[(e=A+16|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0}(50224,1),C=A,W=50224,nl(C|=0,W|=0,0|vf(52576)),ar[12565]=0,ar[12564]=13108,I=A,B=50256,nl(I|=0,B|=0,0|vf(52560)),ar[12567]=0,ar[12566]=13172,E=A,G=50264,nl(E|=0,G|=0,0|vf(52584)),ar[12569]=0,ar[12568]=13236,V=A,X=50272,nl(V|=0,X|=0,0|vf(52592)),ar[12571]=0,ar[12570]=13288,_=A,F=50280,nl(_|=0,F|=0,0|vf(52600)),ar[12573]=0,ar[12572]=14836,N=A,R=50288,nl(N|=0,R|=0,0|vf(54248)),ar[12575]=0,ar[12574]=14892,Y=A,J=50296,nl(Y|=0,J|=0,0|vf(54256)),ar[12577]=0,ar[12576]=14948,D=A,Q=50304,nl(D|=0,Q|=0,0|vf(54264)),ar[12579]=0,ar[12578]=15004,T=A,M=50312,nl(T|=0,M|=0,0|vf(54272)),ar[12581]=0,ar[12580]=15060,S=A,U=50320,nl(S|=0,U|=0,0|vf(54280)),ar[12583]=0,ar[12582]=15088,O=A,H=50328,nl(O|=0,H|=0,0|vf(54288)),ar[12585]=0,ar[12584]=15116,x=A,j=50336,nl(x|=0,j|=0,0|vf(54296)),ar[12587]=0,ar[12586]=15144,z=A,P=50344,nl(z|=0,P|=0,0|vf(54304)),ar[12589]=0,ar[12588]=15576,function(A){ar[(A|=0)>>2]=15808}(50360),ar[12588]=13340,ar[12590]=13388,L=A,K=50352,nl(L|=0,K|=0,0|vf(53412)),ar[12593]=0,ar[12592]=15576,function(A){ar[(A|=0)>>2]=15844}(50376),ar[12592]=13424,ar[12594]=13472,q=A,$=50368,nl(q|=0,$|=0,0|vf(54224)),ar[12597]=0,ar[12596]=15576,AA=0|hf(),ar[12598]=AA,ar[12596]=14788,eA=A,rA=50384,nl(eA|=0,rA|=0,0|vf(54232)),ar[12601]=0,ar[12600]=15576,iA=0|hf(),ar[12602]=iA,ar[12600]=14812,fA=A,nA=50400,nl(fA|=0,nA|=0,0|vf(54240)),ar[12605]=0,ar[12604]=15172,tA=A,oA=50416,nl(tA|=0,oA|=0,0|vf(54312)),ar[12607]=0,ar[12606]=15204,aA=A,cA=50424,nl(aA|=0,cA|=0,0|vf(54320)),ur=i}function nl(A,e,r){A|=0,r|=0;var i,f=0;ml(e|=0),f=0|ar[(i=A+8|0)>>2],(0|ar[A+12>>2])-f>>2>>>0>r>>>0?A=i:(function(A,e){e|=0;var r,i,f=0,n=0;f=0|ar[(i=4+(A|=0)|0)>>2],n=0|ar[A>>2],r=f-n>>2;A:do{if(e>>>0<=r>>>0){if(e>>>0<r>>>0)for(A=n+(e<<2)|0;;){if((0|f)==(0|A))break A;n=f+-4|0,ar[i>>2]=n,f=n}}else tl(A,e-r|0)}while(0)}(i,r+1|0),f=0|ar[(A=i)>>2]),0|(f=0|ar[f+(r<<2)>>2])&&yl(f),ar[(0|ar[A>>2])+(r<<2)>>2]=e}function tl(A,e){e|=0;var r,i,f,n=0,t=0,o=0,a=0,c=0;r=ur=(f=ur)+31&-32,ur=ur+32|0,o=(A|=0)+8|0,n=0|ar[(i=A+4|0)>>2];do{if((0|ar[o>>2])-n>>2>>>0<e>>>0){if(n=(n-(0|ar[A>>2])>>2)+e|0,!((t=0|al())>>>0<n>>>0)){a=0|ar[A>>2],o=(c=(0|ar[o>>2])-a|0)>>1,cl(r,c>>2>>>0<t>>>1>>>0?o>>>0<n>>>0?n:o:t,(0|ar[i>>2])-a>>2,A+16|0),ll(r,e),ul(A,r),sl(r);break}il()}else ol(A,e)}while(0);ur=f}function ol(A,e){var r;for(r=(A|=0)+4|0,A=e|=0,e=0|ar[r>>2];e=4+((ar[e>>2]=0)|ar[r>>2])|0,ar[r>>2]=e,0!=(0|(A=A+-1|0)););}function al(){return 1073741823}function cl(A,e,r,i){e|=0,r|=0,i|=0;var f=0;ar[(A|=0)+12>>2]=0,ar[A+16>>2]=i;do{if(e){if(e>>>0<29&0==(0|tr[(f=i+112|0)>>0])){tr[f>>0]=1;break}i=0|El(e<<2);break}i=0}while(0);r=(ar[A>>2]=i)+(r<<2)|0,ar[A+8>>2]=r,ar[A+4>>2]=r,ar[A+12>>2]=i+(e<<2)}function ll(A,e){var r;for(r=(A|=0)+8|0,A=e|=0,e=0|ar[r>>2];e=4+((ar[e>>2]=0)|ar[r>>2])|0,ar[r>>2]=e,0!=(0|(A=A+-1|0)););}function ul(A,e){e|=0;var r=0,i=0,f=0,n=0,t=0;i=0|ar[(A|=0)>>2],n=e+4|0,f=(0|ar[(t=A+4|0)>>2])-i|0,r=(0|ar[n>>2])+(0-(f>>2)<<2)|0,ar[n>>2]=r,0<(0|f)?(Eu(0|r,0|i,0|f),r=0|ar[(i=n)>>2]):i=n,n=0|ar[A>>2],ar[A>>2]=r,ar[i>>2]=n,n=e+8|0,f=0|ar[t>>2],ar[t>>2]=ar[n>>2],ar[n>>2]=f,t=e+12|0,A=0|ar[(n=A+8|0)>>2],ar[n>>2]=ar[t>>2],ar[t>>2]=A,ar[e>>2]=ar[i>>2]}function sl(A){var e=0,r=0,i=0,f=0;for(e=0|ar[(A|=0)+4>>2],i=0|ar[(r=A+8|0)>>2];(0|i)!=(0|e);)f=i+-4|0,i=ar[r>>2]=f;r=0|ar[A>>2];do{if(0|r){if((0|(e=0|ar[A+16>>2]))==(0|r)){tr[e+112>>0]=0;break}Vl(r);break}}while(0)}function bl(){return 0==(0|tr[50432])&&0|ku(50432)&&(fl(50440,1),ar[13590]=50440,ar[13591]=54360),0|ar[13591]}function dl(A,e){A|=0,e=0|ar[(e|=0)>>2],ml(ar[A>>2]=e)}function kl(){return 0==(0|tr[50600])&&0|ku(50600)&&(dl(54368,0|bl()),ar[13593]=54368),0|ar[13593]}function hl(A){A|=0;var e=0;e=0|kl(),e=0|ar[e>>2],ml(ar[A>>2]=e)}function wl(A,e,r){return A|=0,e|=0,0|(A=(r|=0)?0|function(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0;A:do{if(r){for(;(i=0|tr[A>>0])<<24>>24==(f=0|tr[e>>0])<<24>>24;){if(!(r=r+-1|0)){A=0;break A}A=A+1|0,e=e+1|0}A=(255&i)-(255&f)|0}else A=0}while(0);return 0|A}(A,e,r):0)}function vl(){0}function gl(A){0}function ml(A){pl((A|=0)+4|0)}function pl(A){ar[(A|=0)>>2]=1+(0|ar[A>>2])}function yl(A){return 0|(A=-1==(0|Zl((A|=0)+4|0))?(ds[511&ar[8+(0|ar[A>>2])>>2]](A),1):0)}function Zl(A){var e;return e=0|ar[(A|=0)>>2],ar[A>>2]=e-1,e-1|0}function Cl(A){ml(A|=0)}function Wl(A){pl((A|=0)+8|0)}function Il(A){0|yl(A|=0)&&Bl(A)}function Bl(A){var e;0!=(0|ar[(e=(A|=0)+8|0)>>2])&&-1!=(0|Zl(e))||ds[511&ar[16+(0|ar[A>>2])>>2]](A)}function El(A){var e;for(e=0==(0|(A|=0))?1:A;!(0|(A=0|qo(e)));){if(!(A=0|hu())){A=0;break}bs[3&A]()}return 0|A}function Gl(A){return 0|El(A|=0)}function Vl(A){$o(A|=0)}function Xl(A){Vl(A|=0)}function _l(){kA()}function Fl(A,e){e|=0,ar[(A|=0)>>2]=15984,function(A,e){A|=0;var r,i,f=0;f=0|El(13+(r=0|ta(e|=0))|0),ar[f>>2]=r,ar[f+4>>2]=r,Eu((ar[f+8>>2]=0)|(f=0|(i=f,12+(i|=0)|0)),0|e,1+r|0),ar[A>>2]=f}(A+4|0,e)}function Nl(){kA()}function Rl(A,e){e|=0;var r,i,f=0,n=0,t=0;r=ur=(i=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,((ar[A+8>>2]=0)|tr[e+11>>0])<0?(f=0|ar[e>>2],4294967279<(e=0|ar[e+4>>2])>>>0&&Nl(),e>>>0<11?tr[A+11>>0]=e:(n=0|El(t=e+16&-16),ar[A>>2]=n,ar[A+8>>2]=-2147483648|t,ar[A+4>>2]=e,A=n),di(A,f,e),Ni(A+e|(tr[r>>0]=0),r)):(ar[A>>2]=ar[e>>2],ar[A+4>>2]=ar[e+4>>2],ar[A+8>>2]=ar[e+8>>2]),ur=i}function Yl(A){(0|tr[(A|=0)+11>>0])<0&&Vl(0|ar[A>>2])}function Jl(A,e){var r=0,i=0;return(0|(A|=0))!=(0|(e|=0))&&Dl(A,(i=(r=0|tr[e+11>>0])<<24>>24<0)?0|ar[e>>2]:e,i?0|ar[e+4>>2]:255&r),0|A}function Dl(A,e,r){e|=0,r|=0;var i,f,n,t,o=0,a=0;f=ur=(t=ur)+31&-32,ur=ur+16|0,a=(i=(o=0|tr[(n=(A|=0)+11|0)>>0])<<24>>24<0)?(2147483647&ar[A+8>>2])-1|0:10;do{if(r>>>0<=a>>>0){if(Ql(o=i?0|ar[A>>2]:A,e,r),Ni(o+r|(tr[f>>0]=0),f),(0|tr[n>>0])<0){ar[A+4>>2]=r;break}tr[n>>0]=r;break}i?o=0|ar[A+4>>2]:o&=255,Tl(A,a,r-a|0,o,0,o,r,e)}while(0);return ur=t,0|A}function Ql(A,e,r){return A|=0,e|=0,0|(r|=0)&&Gu(0|A,0|e,0|r),0|A}function Tl(A,e,r,i,f,n,t,o){A|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l=0,u=0,s=0;a=ur=(c=ur)+31&-32,ur=ur+16|0,(-18-(e|=0)|0)>>>0<(r|=0)>>>0&&Nl(),s=(0|tr[A+11>>0])<0?0|ar[A>>2]:A,u=0|El(l=e>>>0<2147483623?(l=(l=r+e|0)>>>0<(u=e<<1)>>>0?u:l)>>>0<11?11:l+16&-16:-17),0|f&&di(u,s,f),0|t&&di(u+f|0,o,t),0|(i=(r=i-n|0)-f|0)&&di(u+f+t|0,s+f+n|0,i),10!=(0|e)&&Vl(s),ar[A>>2]=u,ar[A+8>>2]=-2147483648|l,t=r+t|0,Ni(u+(ar[A+4>>2]=t)|(tr[a>>0]=0),a),ur=c}function Ml(A,e){A|=0;var r,i=0,f=0,n=0,t=0,o=0;4294967279<(e|=0)>>>0&&Nl(),i=(n=(f=0|tr[(r=A+11|0)>>0])<<24>>24<0)?(o=0|ar[A+4>>2],(2147483647&ar[A+8>>2])-1|0):(o=255&f,10),t=(e=(t=e>>>0<o>>>0?o:e)>>>0<11)?10:(t+16&-16)-1|0;do{if((0|t)!=(0|i)){do{if(!e){if(e=0|El(t+1|0),n){n=1,i=0|ar[A>>2],f=13;break}di(e,A,1+(255&f)|0),f=14;break}e=0|ar[A>>2],f=n?(n=0,i=e,e=A,13):(di(A,e,1+(255&f)|0),Vl(e),15)}while(0);if(13==(0|f)&&(di(e,i,1+(0|ar[A+4>>2])|0),Vl(i),f=n?14:15),14==(0|f)){ar[A+8>>2]=t+1|-2147483648,ar[A+4>>2]=o,ar[A>>2]=e;break}if(15==(0|f)){tr[r>>0]=o;break}}}while(0)}function Sl(A,e){return 0|Dl(A|=0,e|=0,0|Fi(e))}function Ul(A,e,r){e|=0,r|=0;var i,f,n,t=0,o=0;i=ur=(n=ur)+31&-32,ur=ur+16|0,(o=(t=0|tr[(f=(A|=0)+11|0)>>0])<<24>>24<0)?t=0|ar[A+4>>2]:t&=255;do{if(e>>>0<=t>>>0){if(o){o=(0|ar[A>>2])+e|0,tr[i>>0]=0,Ni(o,i),ar[A+4>>2]=e;break}Ni(A+e|(tr[i>>0]=0),i),tr[f>>0]=e;break}Ol(A,e-t|0,r)}while(0);ur=n}function Ol(A,e,r){A|=0,r|=0;var i,f,n=0,t=0,o=0,a=0,c=0;return i=ur=(f=ur)+31&-32,ur=ur+16|0,0|(e|=0)&&(t=(n=0|tr[(c=A+11|0)>>0])<<24>>24<0?(o=0|ar[A+4>>2],(2147483647&ar[A+8>>2])-1|0):(o=255&n,10),a=o+e|0,(t-o|0)>>>0<e>>>0&&(Hl(A,t,a-t|0,o,o,0,0),n=0|tr[c>>0]),pe((n=n<<24>>24<0?0|ar[A>>2]:A)+o|0,e,r),(0|tr[c>>0])<0?ar[A+4>>2]=a:tr[c>>0]=a,Ni(n+a|(tr[i>>0]=0),i)),ur=f,0|A}function Hl(A,e,r,i,f,n,t){A|=0,i|=0,f|=0,n|=0,t|=0;var o=0,a=0,c=0;(-17-(e|=0)|0)>>>0<(r|=0)>>>0&&Nl(),c=(0|tr[A+11>>0])<0?0|ar[A>>2]:A,a=0|El(o=e>>>0<2147483623?(o=(o=r+e|0)>>>0<(a=e<<1)>>>0?a:o)>>>0<11?11:o+16&-16:-17),0|f&&di(a,c,f),0|(r=i-n-f|0)&&di(a+f+t|0,c+f+n|0,r),10!=(0|e)&&Vl(c),ar[A>>2]=a,ar[A+8>>2]=-2147483648|o}function xl(A,e,r){e|=0,r|=0;var i,f,n,t,o,a=0,c=0;return n=ur=(o=ur)+31&-32,ur=ur+16|0,a=(f=(a=0|tr[(t=(A|=0)+11|0)>>0])<<24>>24<0)?(c=0|ar[A+4>>2],(2147483647&ar[A+8>>2])-1|0):(c=255&a,10),i=c+r|0,r>>>0<=(a-c|0)>>>0?0|r&&(di((a=f?0|ar[A>>2]:A)+c|0,e,r),(0|tr[t>>0])<0?ar[A+4>>2]=i:tr[t>>0]=i,Ni(a+i|(tr[n>>0]=0),n)):Tl(A,a,i-a|0,c,c,0,r,e),ur=o,0|A}function jl(A,e){A|=0,e|=0;var r,i,f=0,n=0,t=0,o=0;o=ur=(i=ur)+31&-32,ur=ur+16|0,o=(r=o)+1|0,tr[r>>0]=e,e=(f=(e=0|tr[(n=A+11|0)>>0])<<24>>24<0)?(t=0|ar[A+4>>2],(2147483647&ar[A+8>>2])-1|0):(t=255&e,10),7==(0|(f=(0|t)==(0|e)?(Hl(A,e,1,e,e,0,0),e=e+1|0,(0|tr[n>>0])<0?8:7):(e=t+1|0,f?8:7)))?(tr[n>>0]=e,e=A):8==(0|f)&&(n=0|ar[A>>2],ar[A+4>>2]=e,e=n),Ni(A=e+t|0,r),Ni(A+1|(tr[o>>0]=0),o),ur=i}function zl(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t=0;return(n=(t=0|tr[(A|=0)+11>>0])<<24>>24<0)?t=0|ar[A+4>>2]:t&=255,-1==(0|f)|t>>>0<e>>>0&&kA(),r=(t=t-e|0)>>>0<r>>>0?t:r,n&&(A=0|ar[A>>2]),(A=0|wl(A+e|0,i,(t=f>>>0<r>>>0)?f:r))?0|A:0|(r>>>0<f>>>0?-1:1&t)}function Pl(A){(0|tr[(A|=0)+8+3>>0])<0&&Vl(0|ar[A>>2])}function Ll(A,e,r){return A|=0,e|=0,(r|=0)&&function(A,e,r){var i=0;if((r|=0)>>>0<=(A|=0)-(e|=0)>>2>>>0){if(0|r)for(i=A;r=r+-1|0,ar[i>>2]=ar[e>>2],r;)e=e+4|0,i=i+4|0}else for(;ar[A+((r=r+-1|0)<<2)>>2]=ar[e+(r<<2)>>2],0!=(0|r););}(A,e,r),0|A}function Kl(A,e,r,i,f,n,t,o){A|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l,u=0,s=0,b=0;c=ur=(l=ur)+31&-32,ur=ur+16|0,(1073741806-(e|=0)|0)>>>0<(r|=0)>>>0&&Nl(),b=(0|tr[3+(a=A+8|0)>>0])<0?0|ar[A>>2]:A,e>>>0<536870887?1073741823<(r=(r=(r=r+e|0)>>>0<(u=e<<1)>>>0?u:r)>>>0<2?2:r+4&-4)>>>0?kA():s=r:s=1073741807,u=0|El(s<<2),0|f&&vi(u,b,f),0|t&&vi(u+(f<<2)|0,o,t),0|(i=(r=i-n|0)-f|0)&&vi(u+(f<<2)+(t<<2)|0,b+(f<<2)+(n<<2)|0,i),1!=(0|e)&&Vl(b),ar[A>>2]=u,ar[a>>2]=-2147483648|s,t=r+t|0,sf(u+((ar[A+4>>2]=t)<<2)|(ar[c>>2]=0),c),ur=l}function ql(A,e){A|=0;var r,i,f=0,n=0,t=0,o=0,a=0;1073741807<(e|=0)>>>0&&Nl(),f=(t=(n=0|tr[(r=3+(i=A+8|0)|0)>>0])<<24>>24<0)?(a=0|ar[A+4>>2],(2147483647&ar[i>>2])-1|0):(a=255&n,1),o=(e=(o=e>>>0<a>>>0?a:e)>>>0<2)?1:(o+4&-4)-1|0;do{if((0|o)!=(0|f)){do{if(!e){if(1073741823<(e=o+1|0)>>>0&&kA(),e=0|El(e<<2),t){t=1,f=0|ar[A>>2],n=15;break}vi(e,A,1+(255&n)|0),n=16;break}e=0|ar[A>>2],n=t?(t=0,f=e,e=A,15):(vi(A,e,1+(255&n)|0),Vl(e),17)}while(0);if(15==(0|n)&&(vi(e,f,1+(0|ar[A+4>>2])|0),Vl(f),n=t?16:17),16==(0|n)){ar[i>>2]=o+1|-2147483648,ar[A+4>>2]=a,ar[A>>2]=e;break}if(17==(0|n)){tr[r>>0]=a;break}}}while(0)}function $l(A,e){return 0|function(A,e,r){e|=0,r|=0;var i,f,n,t,o,a=0,c=0;n=ur=(o=ur)+31&-32,ur=ur+16|0,c=(f=(i=0|tr[(t=(a=(A|=0)+8|0)+3|0)>>0])<<24>>24<0)?(2147483647&ar[a>>2])-1|0:1;do{if(r>>>0<=c>>>0){if(Ll(a=f?0|ar[A>>2]:A,e,r),sf(a+(r<<2)|(ar[n>>2]=0),n),(0|tr[t>>0])<0){ar[A+4>>2]=r;break}tr[t>>0]=r;break}Kl(A,c,r-c|0,a=f?0|ar[A+4>>2]:255&i,0,a,r,e)}while(0);return ur=o,0|A}(A|=0,e|=0,0|Ae(e))}function Au(A,e,r,i,f,n,t){A|=0,i|=0,f|=0,n|=0,t|=0;var o,a=0,c=0,l=0;(1073741807-(e|=0)|0)>>>0<(r|=0)>>>0&&Nl(),l=(0|tr[3+(o=A+8|0)>>0])<0?0|ar[A>>2]:A,e>>>0<536870887?1073741823<(r=(r=(r=r+e|0)>>>0<(a=e<<1)>>>0?a:r)>>>0<2?2:r+4&-4)>>>0?kA():c=r:c=1073741807,a=0|El(c<<2),0|f&&vi(a,l,f),0|(r=i-n-f|0)&&vi(a+(f<<2)+(t<<2)|0,l+(f<<2)+(n<<2)|0,r),1!=(0|e)&&Vl(l),ar[A>>2]=a,ar[o>>2]=-2147483648|c}function eu(A,e,r){e|=0,r|=0;var i,f,n,t,o=0,a=0,c=0;return f=ur=(t=ur)+31&-32,ur=ur+16|0,o=(i=(o=0|tr[(n=(a=(A|=0)+8|0)+3|0)>>0])<<24>>24<0)?(c=0|ar[A+4>>2],(2147483647&ar[a>>2])-1|0):(c=255&o,1),a=c+r|0,r>>>0<=(o-c|0)>>>0?0|r&&(vi((o=i?0|ar[A>>2]:A)+(c<<2)|0,e,r),(0|tr[n>>0])<0?ar[A+4>>2]=a:tr[n>>0]=a,sf(o+(a<<2)|(ar[f>>2]=0),f)):Kl(A,o,a-o|0,c,c,0,r,e),ur=t,0|A}function ru(A,e){A|=0,e|=0;var r,i,f,n=0,t=0,o=0,a=0;a=ur=(f=ur)+31&-32,ur=ur+16|0,a=(i=a)+4|0,ar[i>>2]=e,e=(r=(e=0|tr[(t=(n=A+8|0)+3|0)>>0])<<24>>24<0)?(o=0|ar[A+4>>2],(2147483647&ar[n>>2])-1|0):(o=255&e,1),7==(0|(n=(0|o)==(0|e)?(Au(A,e,1,e,e,0,0),e=e+1|0,(0|tr[t>>0])<0?8:7):(e=o+1|0,r?8:7)))?(tr[t>>0]=e,e=A):8==(0|n)&&(t=0|ar[A>>2],ar[A+4>>2]=e,e=t),sf(A=e+(o<<2)|0,i),sf(A+4|(ar[a>>2]=0),a),ur=f}function iu(){var A,e=0;return e=ur=(A=ur)+31&-32,ur=ur+16|0,0|BA(54452,3)?(fu(49484,e),0):(e=0|yA(0|ar[13614]),ur=A,0|e)}function fu(A,e){A|=0,e|=0;var r;r=ur=ur+31&-32,ur=ur+16|0,ar[r>>2]=e,sa(e=0|ar[2255],A,r),function(A,e){var r,i=0,f=0,n=0,t=0,o=0,a=0;i=r=255&(A|=0),0<=(0|ar[(e|=0)+76>>2])&&0!=(0|da())?((0|i)!=(0|tr[e+75>>0])&&(o=0|ar[(t=e+20|0)>>2])>>>0<(0|ar[e+16>>2])>>>0?(ar[t>>2]=o+1,tr[o>>0]=r):i=0|Ur(e,A),ka()):a=3;do{if(3==(0|a)){if((0|i)!=(0|tr[e+75>>0])&&(n=0|ar[(f=e+20|0)>>2])>>>0<(0|ar[e+16>>2])>>>0){ar[f>>2]=n+1,tr[n>>0]=r;break}i=0|Ur(e,A)}}while(0)}(10,e),kA()}function nu(A){0}function tu(A,e){return(0|(A|=0))==(0|(e|=0))|0}function ou(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t;f=0|ar[(A=(e|=0)+16|0)>>2],n=e+36|0,t=e+24|0;do{if(f){if((0|f)!=(0|r)){ar[n>>2]=1+(0|ar[n>>2]),ar[t>>2]=2,tr[e+54>>0]=1;break}2==(0|ar[t>>2])&&(ar[t>>2]=i)}else ar[A>>2]=r,ar[t>>2]=i,ar[n>>2]=1}while(0)}function au(A,e,r,i){r|=0,i|=0;var f=0;(0|ar[(e|=0)+4>>2])==(0|r)&&1!=(0|ar[(f=e+28|0)>>2])&&(ar[f>>2]=i)}function cu(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0;tr[(e|=0)+53>>0]=1;do{if((0|ar[e+4>>2])==(0|i)){if(tr[e+52>>0]=1,o=e+54|0,a=e+48|0,t=e+24|0,A=e+36|0,!(n=0|ar[(i=e+16|0)>>2])){if(ar[i>>2]=r,ar[t>>2]=f,!((ar[A>>2]=1)==(0|ar[a>>2])&1==(0|f)))break;tr[o>>0]=1;break}if((0|n)!=(0|r)){ar[A>>2]=1+(0|ar[A>>2]),tr[o>>0]=1;break}2==(0|(A=0|ar[t>>2]))&&(A=ar[t>>2]=f),1==(0|ar[a>>2])&1==(0|A)&&(tr[o>>0]=1)}}while(0)}function lu(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o,a,c,l,u=0,s=0;for(a=ur=(l=ur)+31&-32,ur=ur+64|0,s=0|ar[(A|=0)>>2],c=A+(0|ar[s+-8>>2])|0,s=0|ar[s+-4>>2],ar[a>>2]=r,ar[4+a>>2]=A,ar[8+a>>2]=e,ar[12+a>>2]=i,e=20+a|0,i=24+a|0,f=28+a|0,n=32+a|0,t=40+a|0,o=(u=A=16+a|0)+36|0;(0|(u=u+4|(ar[u>>2]=0)))<(0|o););or[A+36>>1]=0,tr[A+38>>0]=0;A:do{if(0|tu(s,r))ar[48+a>>2]=1,gs[15&ar[20+(0|ar[s>>2])>>2]](s,a,c,c,1,0),A=1==(0|ar[i>>2])?c:0;else{switch(vs[15&ar[24+(0|ar[s>>2])>>2]](s,a,c,1,0),0|ar[36+a>>2]){case 0:A=1==(0|ar[t>>2])&1==(0|ar[f>>2])&1==(0|ar[n>>2])?0|ar[e>>2]:0;break A;case 1:break;default:A=0;break A}if(1!=(0|ar[i>>2])&&!(0==(0|ar[t>>2])&1==(0|ar[f>>2])&1==(0|ar[n>>2]))){A=0;break}A=0|ar[A>>2]}}while(0);return ur=l,0|A}function uu(A){var e,r,i;ar[(A|=0)>>2]=15984,e=A+4|0,(i=r=0)|(e|=0,1)&&(r=0|function(A){return(A|=0)+-12|0}(0|ar[e>>2]),e=0|ar[(i=r+8|0)>>2],ar[i>>2]=e+-1,(e+-1|0)<0)&&Vl(r)}function su(A,e,r,i){e|=0,r|=0,i|=0;var f,n=0;n=(f=0|ar[(A|=0)+4>>2])>>8,1&f&&(n=0|ar[(0|ar[r>>2])+n>>2]),A=0|ar[A>>2],ws[31&ar[28+(0|ar[A>>2])>>2]](A,e,r+n|0,2&f|0?i:2)}function bu(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o=0;o=(t=0|ar[(A|=0)+4>>2])>>8,1&t&&(o=0|ar[(0|ar[i>>2])+o>>2]),A=0|ar[A>>2],gs[15&ar[20+(0|ar[A>>2])>>2]](A,e,r,i+o|0,2&t|0?f:2,n)}function du(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0;var n,t=0;t=(n=0|ar[(A|=0)+4>>2])>>8,1&n&&(t=0|ar[(0|ar[r>>2])+t>>2]),A=0|ar[A>>2],vs[15&ar[24+(0|ar[A>>2])>>2]](A,e,r+t|0,2&n|0?i:2,f)}function ku(A){return 0|(A=1==(0|tr[(A|=0)>>0])?0:tr[A>>0]=1)}function hu(){var A;return A=0|ar[13615],0|(ar[13615]=A)}function wu(A,e,r,i){e|=0,i|=0;var f,n,t,o,a,c,l,u;return r=0|(t=f=A|=0,o=n=r|=0,t=((a=(u=0)|sr(u=65535&(o|=0),l=65535&(t|=0)))>>>16)+(0|sr(u,c=t>>>16))|0,o=0|sr(u=o>>>16,l),0|(D=(t>>>16)+(0|sr(u,c))+(((65535&t)+o|0)>>>16)|0,t+o<<16|65535&a|0)),A=D,0|(D=(0|sr(e,n))+(0|sr(i,f))+A|0&A,0|r)}function vu(A,e,r,i){return 0|(D=(e|=0)+(i|=0)+((r=(A|=0)+(r|=0)>>>0)>>>0<A>>>0|0)>>>0,0|r)}function gu(A,e,r,i){return 0|(D=i=(e|=0)-(i|=0)-((A|=0)>>>0<(r|=0)>>>0|0)>>>0,A-r>>>0|0)}function mu(A){var e=0;return(0|(e=0|tr[b+(255&(A|=0))>>0]))<8?0|e:(0|(e=0|tr[b+(A>>8&255)>>0]))<8?e+8|0:(0|(e=0|tr[b+(A>>16&255)>>0]))<8?e+16|0:24+(0|tr[b+(A>>>24)>>0])|0}function pu(A,e,r,i,f){f|=0;var n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;if(l=A|=0,t=r|=0,o=s=i|=0,!(c=a=e|=0))return n=0!=(0|f),o?(n&&(ar[f>>2]=0|A,ar[f+4>>2]=0&e),(f=s=0)|(D=s,f)):(n&&(ar[f>>2]=(l>>>0)%(t>>>0),ar[f+4>>2]=0),(s=0)|(D=s,f=(l>>>0)/(t>>>0)>>>0));n=0==(0|o);do{if(t){if(!n){if((n=(0|v(0|o))-(0|v(0|c))|0)>>>0<=31){A=l>>>((t=u=n+1|0)>>>0)&(e=n-31>>31)|c<<(o=31-n|0),e&=c>>>(u>>>0),n=0,o=l<<o;break}return f?(ar[f>>2]=0|A,ar[f+4>>2]=a|0&e,(f=s=0)|(D=s,f)):(f=s=0)|(D=s,f)}if((n=t-1|0)&t|0){A=(u=32-(o=33+(0|v(0|t))-(0|v(0|c))|0)|0)-1>>31&c>>>((b=o-32|0)>>>0)|(c<<u|l>>>((t=o)>>>0))&(e=b>>31),e&=c>>>(o>>>0),n=l<<(d=64-o|0)&(a=u>>31),o=(c<<d|l>>>(b>>>0))&a|l<<u&o-33>>31;break}return 0|f&&(ar[f>>2]=n&l,ar[f+4>>2]=0),1==(0|t)?0|(D=b=a|0&e,d=0|A):(d=0|mu(0|t),0|(D=b=c>>>(d>>>0)|0,d=c<<32-d|l>>>(d>>>0)|0))}if(n)return 0|f&&(ar[f>>2]=(c>>>0)%(t>>>0),ar[f+4>>2]=0),(b=0)|(D=b,d=(c>>>0)/(t>>>0)>>>0);if(!l)return 0|f&&(ar[f>>2]=0,ar[f+4>>2]=(c>>>0)%(o>>>0)),(b=0)|(D=b,d=(c>>>0)/(o>>>0)>>>0);if(!((n=o-1|0)&o))return 0|f&&(ar[f>>2]=0|A,ar[f+4>>2]=n&c|0&e),d=c>>>(((b=0)|mu(0|o))>>>0),0|(D=b,d);if((n=(0|v(0|o))-(0|v(0|c))|0)>>>0<=30){A=c<<(o=31-n|0)|l>>>((t=e=n+1|0)>>>0),e=c>>>(e>>>0),n=0,o=l<<o;break}return f&&(ar[f>>2]=0|A,ar[f+4>>2]=a|0&e),(d=b=0)|(D=b,d)}while(0);if(t){for(c=0|vu(0|(u=0|r),0|(l=s|0&i),-1,-1),r=D,a=o,o=0;a=n>>>31|(i=a)<<1,n=o|n<<1,gu(0|c,0|r,0|(i=A<<1|i>>>31|0),0|(s=A>>>31|e<<1|0)),o=1&(b=(d=D)>>31|((0|d)<0?-1:0)<<1),A=0|gu(0|i,0|s,b&u|0,(((0|d)<0?-1:0)>>31|((0|d)<0?-1:0)<<1)&l|0),e=D,0!=(0|(t=t-1|0)););c=a,a=0}else c=o,o=a=0;return(t=0)|f&&(ar[f>>2]=A,ar[f+4>>2]=e),0|(D=b=(0|n)>>>31|(c|t)<<1|0&(t<<1|n>>>31)|a,d=-2&(n<<1|0)|o)}function yu(A,e,r,i){return 0|pu(A|=0,e|=0,r|=0,i|=0,0)}function Zu(A,e,r,i){var f,n;return ur=(n=ur)+16|0,pu(A|=0,e|=0,r|=0,i|=0,f=0|n),ur=n,0|(D=0|ar[4+f>>2],0|ar[f>>2])}function Cu(A,e,r){return A|=0,e|=0,(0|(r|=0))<32?(D=e>>r,A>>>r|(e&(1<<r)-1)<<32-r):(D=(0|e)<0?-1:0,e>>r-32|0)}function Wu(A,e,r){return A|=0,e|=0,(0|(r|=0))<32?(D=e>>>r,A>>>r|(e&(1<<r)-1)<<32-r):e>>>r-32|(D=0)}function Iu(A,e,r){return A|=0,e|=0,(0|(r|=0))<32?(D=e<<r|(A&(1<<r)-1<<32-r)>>>32-r,A<<r):(D=A<<r-32,0)}function Bu(A){return(255&(A|=0))<<24|(A>>8&255)<<16|(A>>16&255)<<8|A>>>24|0}function Eu(A,e,r){A|=0,e|=0;var i,f,n=0;if(8192<=(0|(r|=0)))return 0|hA(0|A,0|e,0|r);if(f=0|A,i=A+r|0,(3&A)==(3&e)){for(;3&A;){if(!r)return 0|f;tr[A>>0]=0|tr[e>>0],A=A+1|0,e=e+1|0,r=r-1|0}for(n=(r=-4&i|0)-64|0;(0|A)<=(0|n);)ar[A>>2]=ar[e>>2],ar[A+4>>2]=ar[e+4>>2],ar[A+8>>2]=ar[e+8>>2],ar[A+12>>2]=ar[e+12>>2],ar[A+16>>2]=ar[e+16>>2],ar[A+20>>2]=ar[e+20>>2],ar[A+24>>2]=ar[e+24>>2],ar[A+28>>2]=ar[e+28>>2],ar[A+32>>2]=ar[e+32>>2],ar[A+36>>2]=ar[e+36>>2],ar[A+40>>2]=ar[e+40>>2],ar[A+44>>2]=ar[e+44>>2],ar[A+48>>2]=ar[e+48>>2],ar[A+52>>2]=ar[e+52>>2],ar[A+56>>2]=ar[e+56>>2],ar[A+60>>2]=ar[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|r);)ar[A>>2]=ar[e>>2],A=A+4|0,e=e+4|0}else for(r=i-4|0;(0|A)<(0|r);)tr[A>>0]=0|tr[e>>0],tr[A+1>>0]=0|tr[e+1>>0],tr[A+2>>0]=0|tr[e+2>>0],tr[A+3>>0]=0|tr[e+3>>0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|i);)tr[A>>0]=0|tr[e>>0],A=A+1|0,e=e+1|0;return 0|f}function Gu(A,e,r){var i=0;if((0|(e|=0))<(0|(A|=0))&(0|A)<(e+(r|=0)|0)){for(e=e+r|0,A=(i=A)+r|0;0<(0|r);)e=e-1|0,r=r-1|0,tr[(A=A-1|0)>>0]=0|tr[e>>0];A=i}else Eu(A,e,r);return 0|A}function Vu(A,e,r){e|=0;var i,f=0,n=0,t=0;if(i=(A|=0)+(r|=0)|0,e&=255,67<=(0|r)){for(;3&A;)tr[A>>0]=e,A=A+1|0;for(n=(f=-4&i|0)-64|0,t=e|e<<8|e<<16|e<<24;(0|A)<=(0|n);)ar[A>>2]=t,ar[A+4>>2]=t,ar[A+8>>2]=t,ar[A+12>>2]=t,ar[A+16>>2]=t,ar[A+20>>2]=t,ar[A+24>>2]=t,ar[A+28>>2]=t,ar[A+32>>2]=t,ar[A+36>>2]=t,ar[A+40>>2]=t,ar[A+44>>2]=t,ar[A+48>>2]=t,ar[A+52>>2]=t,ar[A+56>>2]=t,ar[A+60>>2]=t,A=A+64|0;for(;(0|A)<(0|f);)ar[A>>2]=t,A=A+4|0}for(;(0|A)<(0|i);)tr[A>>0]=e,A=A+1|0;return i-r|0}function Xu(A){return 0}function _u(A){return 0}function Fu(A){return 0}function Nu(A){var e,r;return 0<(0|(r=(A|=0)+15&-16|0))&(0|(A=(e=0|ar[s>>2])+r|0))<(0|e)|(0|A)<0?(y(),G(12),-1):(0|(ar[s>>2]=A))>(0|p())&&0==(0|m())?(ar[s>>2]=e,G(12),-1):0|e}function Ru(){return g(0),0}function Yu(A){return g(1),0}function Ju(A,e){return g(2),0}function Du(A,e,r){return g(3),0}function Qu(A,e,r,i){return g(4),0}function Tu(A,e,r,i,f){return g(5),0}function Mu(A,e,r,i,f){return g(6),0}function Su(A,e,r,i,f,n){return g(7),0}function Uu(A,e,r,i,f,n){return g(8),0}function Ou(A,e,r,i,f,n,t){return g(9),0}function Hu(A,e,r,i,f,n,t,o){return g(10),0}function xu(A){g(12)}function ju(A,e){g(13)}function zu(A,e,r){g(14)}function Pu(A,e,r,i){g(15)}function Lu(A,e,r,i,f){g(16)}function Ku(A,e,r,i,f,n){g(17)}function qu(A,e,r,i,f,n,t){g(18)}function $u(A,e,r,i,f,n,t,o){g(19)}function As(A,e,r,i,f,n,t,o,a){g(20)}function es(A,e,r,i,f,n,t,o,a,c){g(21)}var rs=[Ru,function(){var A,e,r=0,i=0,f=0;for(i=27827,f=(r=54464)+22|0;tr[r>>0]=0|tr[i>>0],i=i+1|0,(0|(r=r+1|0))<(0|f););if(80<=(10+(0|ta(27868))|0)>>>0)return 54464;for(i=27849,f=(r=54464+(0|ta(54464))|0)+11|0;tr[r>>0]=0|tr[i>>0],i=i+1|0,(0|(r=r+1|0))<(0|f););return A=54464,e=27868,e|=0,function(A,e){!function(A,e){A|=0;var r=0,i=0;r=e|=0;A:do{if(3&(r^A))i=8;else{if(3&r)do{if(r=0|tr[e>>0],!((tr[A>>0]=r)<<24>>24))break A;e=e+1|0,A=A+1|0}while(0!=(3&e|0));if(!((-2139062144&(r=0|ar[e>>2])^-2139062144)&r+-16843009))for(i=A;e=e+4|0,A=i+4|0,ar[i>>2]=r,!((-2139062144&(r=0|ar[e>>2])^-2139062144)&r+-16843009|0);)i=A;i=8}}while(0);if(8==(0|i)&&(i=0|tr[e>>0],(tr[A>>0]=i)<<24>>24))for(;A=A+1|0,i=0|tr[(e=e+1|0)>>0],(tr[A>>0]=i)<<24>>24!=0;);}(A|=0,e|=0)}((A|=0)+(0|ta(A))|0,e),54464},function(){return 256},function(){var A,e,r,i;return A=0|El(8),ar[A>>2]=0,r=(ar[(e=4+A|0)>>2]=0)|El(80),ar[4+r>>2]=0,ar[8+r>>2]=0,ar[r>>2]=5852,function(A){var e,r,i,f,n=0,t=0,o=0;ar[(A|=0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,ar[A+12>>2]=26780,r=A+16|0,ar[(i=A+20|0)>>2]=0,n=A+20|(ar[(f=A+24|0)>>2]=0),ar[r>>2]=n,ar[A+32>>2]=0,ar[A+36>>2]=0,ar[A+28>>2]=A+32,ar[(o=A+40|0)>>2]=0,ar[o+4>>2]=0,ar[o+8>>2]=0,ar[o+12>>2]=0,ar[o+16>>2]=0,ar[o+20>>2]=0,ar[o+24>>2]=0,e=o=6004,A=0|ar[n>>2];do{if(A){for(t=i;;)if(o>>>0<(n=0|ar[A+16>>2])>>>0){if(!(n=0|ar[A>>2])){n=5;break}t=A,A=n}else{if(o>>>0<=n>>>0){n=9;break}if(!(n=0|ar[(t=A+4|0)>>2])){n=8;break}A=n}if(5==(0|n)){t=o=A;break}if(8==(0|n)){o=A;break}if(9==(0|n)){o=A;break}}else t=o=n}while(0);0|ar[t>>2]||(A=0|El(20),ar[A+16>>2]=e,ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=o,ar[t>>2]=A,(n=0|ar[ar[r>>2]>>2])&&(ar[r>>2]=n,A=0|ar[t>>2]),Vc(0|ar[i>>2],A),ar[f>>2]=1+(0|ar[f>>2]))}(i=12+r|0),ar[A>>2]=i,ar[e>>2]=r,0|A},function(){var A;return Zc(A=0|El(20)),0|A},function(){var A;return A=0|El(4),(ar[A>>2]=0)|A},function(){var A;return A=0|El(8),ar[A>>2]=0,(ar[4+A>>2]=0)|A},function(){var A;return Ic(A=0|El(100)),0|A},function(){var A;return A=0|El(12),ar[A>>2]=0,ar[4+A>>2]=0,(ar[8+A>>2]=0)|A},function(){var A;return A=0|El(12),ar[A>>2]=0,ar[4+A>>2]=0,(ar[8+A>>2]=0)|A},function(){var A;return A=0|El(12),ar[A>>2]=0,ar[4+A>>2]=0,(ar[8+A>>2]=0)|A},Ru,Ru,Ru,Ru,Ru],is=[Yu,function(A){return 0},function(A){return 0},function(A){var e=0,r=0,i=0;return(i=0|ar[(e=(A|=0)+44|0)>>2])>>>0<(r=0|ar[A+24>>2])>>>0&&(i=ar[e>>2]=r),8&ar[A+48>>2]?((r=0|ar[(e=A+16|0)>>2])>>>0<i>>>0&&(r=ar[e>>2]=i),r>>>0<=(e=0|ar[A+12>>2])>>>0?0|(A=-1):0|(A=0|cr[e>>0])):0|(A=-1)},function(A){var e=0;return 0|(A=-1==(0|(e=0|is[127&ar[36+(0|ar[(A|=0)>>2])>>2]](A)))?-1:(A=0|ar[(e=A+12|0)>>2],ar[e>>2]=A+1,0|bi(0|tr[A>>0])))},function(A){return 0|(1==(0|(A|=0))?100:0)},function(A){var e,r,i;return r=ur=(e=ur)+31&-32,ur=ur+16|0,A=0|(i=0|ar[(A|=0)+60>>2],0|(i|=0)),ar[r>>2]=A,A=0|ia(0|R(6,0|r)),ur=e,0|A},function(A){return-1},function(A){return 0},function(A){return 0},function(A){return-1},function(A){var e=0;return 0|(A=-1==(0|(e=0|is[127&ar[36+(0|ar[(A|=0)>>2])>>2]](A)))?-1:(A=0|ar[(e=A+12|0)>>2],ar[e>>2]=A+4,0|wi(0|ar[A>>2])))},function(A){var e,r,i,f,n,t,o,a,c=0,l=0;i=ur=(a=ur)+31&-32,ur=ur+16|0,f=(A|=0)+36|0,n=A+40|0,t=8+(r=8+i|0)|0,o=r,e=A+32|0;A:for(;;){if(A=0|ar[f>>2],A=0|as[31&ar[20+(0|ar[A>>2])>>2]](A,0|ar[n>>2],r,t,i),(0|Sr(r,1,l=(0|ar[i>>2])-o|0,0|ar[e>>2]))!=(0|l)){A=-1;break}switch(0|A){case 1:break;case 2:A=-1;break A;default:c=4;break A}}return 4==(0|c)&&(A=(0!=(0|Or(0|ar[e>>2])))<<31>>31),ur=a,0|A},function(A){var e,r,i,f,n,t,o,a,c=0,l=0;i=ur=(a=ur)+31&-32,ur=ur+16|0,f=(A|=0)+36|0,n=A+40|0,t=8+(r=8+i|0)|0,o=r,e=A+32|0;A:for(;;){if(A=0|ar[f>>2],A=0|as[31&ar[20+(0|ar[A>>2])>>2]](A,0|ar[n>>2],r,t,i),(0|Sr(r,1,l=(0|ar[i>>2])-o|0,0|ar[e>>2]))!=(0|l)){A=-1;break}switch(0|A){case 1:break;case 2:A=-1;break A;default:c=4;break A}}return 4==(0|c)&&(A=(0!=(0|Or(0|ar[e>>2])))<<31>>31),ur=a,0|A},function(A){return 0|tf(A|=0,0)},function(A){return 0|tf(A|=0,1)},function(A){return 0|af(A|=0,0)},function(A){return 0|af(A|=0,1)},function(A){return 2},function(A){return 0==(0|tr[50024])&&0|ku(50024)&&(function(){var A=0,e=0;if(0==(0|tr[50032])&&0|ku(50032)){e=53240;do{for(ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0;e=e+12|0}while(53408!=(0|e))}Sl(53240,47628),Sl(53252,47635),Sl(53264,47642),Sl(53276,47650),Sl(53288,47660),Sl(53300,47669),Sl(53312,47676),Sl(53324,47685),Sl(53336,47689),Sl(53348,47693),Sl(53360,47697),Sl(53372,47701),Sl(53384,47705),Sl(53396,47709)}(),ar[13352]=53240),0|ar[13352]},function(A){return 0==(0|tr[50008])&&0|ku(50008)&&(function(){var A=0,e=0;if(0==(0|tr[50016])&&0|ku(50016)){e=52948;do{for(ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0;e=e+12|0}while(53236!=(0|e))}Sl(52948,47498),Sl(52960,47506),Sl(52972,47515),Sl(52984,47521),Sl(52996,47527),Sl(53008,47531),Sl(53020,47536),Sl(53032,47541),Sl(53044,47548),Sl(53056,47558),Sl(53068,47566),Sl(53080,47575),Sl(53092,47584),Sl(53104,47588),Sl(53116,47592),Sl(53128,47596),Sl(53140,47527),Sl(53152,47600),Sl(53164,47604),Sl(53176,47608),Sl(53188,47612),Sl(53200,47616),Sl(53212,47620),Sl(53224,47624)}(),ar[13309]=52948),0|ar[13309]},function(A){return 0==(0|tr[49992])&&0|ku(49992)&&(function(){var A=0,e=0;if(0==(0|tr[5e4])&&0|ku(5e4)){e=52656;do{for(ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0;e=e+12|0}while(52944!=(0|e))}Sl(52656,47492),Sl(52668,47495)}(),ar[13236]=52656),0|ar[13236]},function(A){A|=0;var e,r,i=0,f=0;return e=ur=(r=ur)+31&-32,ur=ur+16|0,0==(0|tr[49984])&&0|ku(49984)&&(ar[13161]=0,ar[13162]=0,4294967279<(i=(ar[13163]=0)|Fi(47471))>>>0&&Nl(),i>>>0<11?(tr[52655]=i,A=52644):(A=0|El(f=i+16&-16),ar[13161]=A,ar[13163]=-2147483648|f,ar[13162]=i),di(A,47471,i),Ni(A+i|(tr[e>>0]=0),e)),ur=r,52644},function(A){A|=0;var e,r,i=0,f=0;return e=ur=(r=ur)+31&-32,ur=ur+16|0,0==(0|tr[49976])&&0|ku(49976)&&(ar[13158]=0,ar[13159]=0,4294967279<(i=(ar[13160]=0)|Fi(47459))>>>0&&Nl(),i>>>0<11?(tr[52643]=i,A=52632):(A=0|El(f=i+16&-16),ar[13158]=A,ar[13160]=-2147483648|f,ar[13159]=i),di(A,47459,i),Ni(A+i|(tr[e>>0]=0),e)),ur=r,52632},function(A){A|=0;var e,r,i=0,f=0;return e=ur=(r=ur)+31&-32,ur=ur+16|0,0==(0|tr[49968])&&0|ku(49968)&&(ar[13155]=0,ar[13156]=0,4294967279<(i=(ar[13157]=0)|Fi(47450))>>>0&&Nl(),i>>>0<11?(tr[52631]=i,A=52620):(A=0|El(f=i+16&-16),ar[13155]=A,ar[13157]=-2147483648|f,ar[13156]=i),di(A,47450,i),Ni(A+i|(tr[e>>0]=0),e)),ur=r,52620},function(A){A|=0;var e,r,i=0,f=0;return e=ur=(r=ur)+31&-32,ur=ur+16|0,0==(0|tr[49960])&&0|ku(49960)&&(ar[13152]=0,ar[13153]=0,4294967279<(i=(ar[13154]=0)|Fi(47441))>>>0&&Nl(),i>>>0<11?(tr[52619]=i,A=52608):(A=0|El(f=i+16&-16),ar[13152]=A,ar[13154]=-2147483648|f,ar[13153]=i),di(A,47441,i),Ni(A+i|(tr[e>>0]=0),e)),ur=r,52608},function(A){return 2},function(A){return 0==(0|tr[50104])&&0|ku(50104)&&(function(){var A=0,e=0;if(0==(0|tr[50112])&&0|ku(50112)){e=54052;do{for(ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0;e=e+12|0}while(54220!=(0|e))}$l(54052,14248),$l(54064,14276),$l(54076,14304),$l(54088,14336),$l(54100,14376),$l(54112,14412),$l(54124,14440),$l(54136,14476),$l(54148,14492),$l(54160,14508),$l(54172,14524),$l(54184,14540),$l(54196,14556),$l(54208,14572)}(),ar[13555]=54052),0|ar[13555]},function(A){return 0==(0|tr[50088])&&0|ku(50088)&&(function(){var A=0,e=0;if(0==(0|tr[50096])&&0|ku(50096)){e=53760;do{for(ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0;e=e+12|0}while(54048!=(0|e))}$l(53760,13728),$l(53772,13760),$l(53784,13796),$l(53796,13820),$l(53808,13844),$l(53820,13860),$l(53832,13880),$l(53844,13900),$l(53856,13928),$l(53868,13968),$l(53880,14e3),$l(53892,14036),$l(53904,14072),$l(53916,14088),$l(53928,14104),$l(53940,14120),$l(53952,13844),$l(53964,14136),$l(53976,14152),$l(53988,14168),$l(54e3,14184),$l(54012,14200),$l(54024,14216),$l(54036,14232)}(),ar[13512]=53760),0|ar[13512]},function(A){return 0==(0|tr[50072])&&0|ku(50072)&&(function(){var A=0,e=0;if(0==(0|tr[50080])&&0|ku(50080)){e=53468;do{for(ar[e>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,A=0;3!=(0|A);)ar[e+(A<<2)>>2]=0,A=A+1|0;e=e+12|0}while(53756!=(0|e))}$l(53468,13704),$l(53480,13716)}(),ar[13439]=53468),0|ar[13439]},function(A){A|=0;var e,r=0,i=0,f=0;if(A=ur=(e=ur)+31&-32,ur=ur+16|0,0==(0|tr[50064])&&0|ku(50064)){ar[13364]=0,ar[13365]=0,1073741807<(i=(ar[13366]=0)|Ae(13620))>>>0&&Nl();do{if(2<=i>>>0){if(!(1073741823<(r=i+4&-4)>>>0)){f=0|El(r<<2),ar[13364]=f,ar[13366]=-2147483648|r,ar[13365]=i;break}kA()}else tr[53467]=i,f=53456}while(0);vi(f,13620,i),sf(f+(i<<2)|(ar[A>>2]=0),A)}return ur=e,53456},function(A){A|=0;var e,r=0,i=0,f=0;if(A=ur=(e=ur)+31&-32,ur=ur+16|0,0==(0|tr[50056])&&0|ku(50056)){ar[13361]=0,ar[13362]=0,1073741807<(i=(ar[13363]=0)|Ae(13572))>>>0&&Nl();do{if(2<=i>>>0){if(!(1073741823<(r=i+4&-4)>>>0)){f=0|El(r<<2),ar[13361]=f,ar[13363]=-2147483648|r,ar[13362]=i;break}kA()}else tr[53455]=i,f=53444}while(0);vi(f,13572,i),sf(f+(i<<2)|(ar[A>>2]=0),A)}return ur=e,53444},function(A){A|=0;var e,r=0,i=0,f=0;if(A=ur=(e=ur)+31&-32,ur=ur+16|0,0==(0|tr[50048])&&0|ku(50048)){ar[13358]=0,ar[13359]=0,1073741807<(i=(ar[13360]=0)|Ae(13536))>>>0&&Nl();do{if(2<=i>>>0){if(!(1073741823<(r=i+4&-4)>>>0)){f=0|El(r<<2),ar[13358]=f,ar[13360]=-2147483648|r,ar[13359]=i;break}kA()}else tr[53443]=i,f=53432}while(0);vi(f,13536,i),sf(f+(i<<2)|(ar[A>>2]=0),A)}return ur=e,53432},function(A){A|=0;var e,r=0,i=0,f=0;if(A=ur=(e=ur)+31&-32,ur=ur+16|0,0==(0|tr[50040])&&0|ku(50040)){ar[13355]=0,ar[13356]=0,1073741807<(i=(ar[13357]=0)|Ae(13500))>>>0&&Nl();do{if(2<=i>>>0){if(!(1073741823<(r=i+4&-4)>>>0)){f=0|El(r<<2),ar[13355]=f,ar[13357]=-2147483648|r,ar[13356]=i;break}kA()}else tr[53431]=i,f=53420}while(0);vi(f,13500,i),sf(f+(i<<2)|(ar[A>>2]=0),A)}return ur=e,53420},function(A){return 127},function(A){return 127},function(A){return 0},function(A){return 127},function(A){return 127},function(A){return 0},function(A){return 2147483647},function(A){return 2147483647},function(A){return 0},function(A){return 2147483647},function(A){return 2147483647},function(A){return 0},function(A){return 0},function(A){return 0},function(A){return 4},function(A){var e,r=0;if(r=0|Ai(0|ar[(A=(A|=0)+8|0)>>2]),e=0|function(A,e,r){A|=0,e|=0,r|=0;var i,f=0,n=0,t=0;f=ur=(i=ur)+31&-32,ur=ur+16|0;A:do{if(e){do{if(0|r){if(t=0==(0|A)?f:A,-1<(A=0|tr[e>>0])<<24>>24){ar[t>>2]=255&A,A=A<<24>>24!=0&1;break A}if(n=8832,A=0|tr[e>>0],!(0|ar[ar[n>>2]>>2])){ar[t>>2]=A<<24>>24&57343,A=1;break A}if((A=(255&A)-194|0)>>>0<=50){if(f=e+1|0,n=0|ar[8240+(A<<2)>>2],r>>>0<4&&n&-2147483648>>>((6*r|0)-6|0)|0)break;if(((r=(A=0|cr[f>>0])>>>3)+-16|r+(n>>26))>>>0<=7){if(0<=(0|(A=A+-128|n<<6))){ar[t>>2]=A,A=2;break A}if((f=(0|cr[e+2>>0])-128|0)>>>0<=63){if(0<=(0|(f|=A<<6))){ar[t>>2]=f,A=3;break A}if((A=(0|cr[e+3>>0])-128|0)>>>0<=63){ar[t>>2]=A|f<<6,A=4;break A}}}}}}while(0);ar[(A=8708)>>2]=84,A=-1}else A=0}while(0);return ur=i,0|A}(0,0,4),0|r&&Ai(r),e)A=-1;else{if(A=0|ar[A>>2])return r=0|Ai(A),A=0|Ma(),0|r&&Ai(r),1==(0|A)|0;A=1}return 0|A},function(A){return 0},function(A){var e=0;return(A=0|ar[(A|=0)+8>>2])?(e=0|Ai(A),A=0|Ma(),e&&Ai(e)):A=1,0|A},function(A){return 0|tr[(A|=0)+8>>0]},function(A){return 0|tr[(A|=0)+9>>0]},function(A){return 0|ar[(A|=0)+8>>2]},function(A){return 0|ar[(A|=0)+12>>2]},function(A){return 1},function(A){return 1},function(A){return 1},function(A){return 0},function(A){return 0},function(A){return 4},function(A){return 49173},function(A){return 0|(e=(A|=0)+4|0,0|ar[(e|=0)>>2]);var e},function(A){var e,r,i,f,n=0;return ur=(r=ur)+16|0,f=r,ds[511&(A|=0)](f),A=0|qo((n=(i=(n=0|tr[f+11>>0])<<24>>24<0)?0|ar[f+4>>2]:255&n)+4|0),ar[A>>2]=n,e=0|ar[f>>2],Eu(A+4|0,0|(i?e:f),0|n),ur=(i&&Vl(e),r),0|A},function(A){return 0|rs[15&(A|=0)]()},function(A){return 0|rs[15&(A|=0)]()},function(A){var e,r,i,f,n,t=0;if(ur=(n=ur)+16|0,Re(i=n,40+(0|ar[(A|=0)>>2])|0),f=(t=0|ar[(r=i+4|0)>>2])-(A=0|ar[i>>2])>>3,!(e=A))return ur=n,0|f;if((0|t)!=(0|e)){for(;A=t+-8|0,ar[r>>2]=A,(t=0|ar[t+-4>>2])&&(Il(t),A=0|ar[r>>2]),(0|A)!=(0|e);)t=A;A=0|ar[i>>2]}return Vl(A),ur=n,0|f},function(A){return 1072},function(A){return 0|rs[15&(A|=0)]()},function(A){var e,r,i;return A|=0,e=0|El(20),i=0|ar[A+4>>2],ar[(r=e)>>2]=ar[A>>2],ar[4+r>>2]=i,Rl(8+e|0,A+8|0),0|e},function(A){return 1128},function(A){return 1168},function(A){return 0|(A|=0)},function(A){return 0|(A|=0)},function(A){var e;return A|=0,function(A,e){e|=0;var r,i,f,n,t,o=0,a=0;r=(A=A|0)+4|0,f=A+16|0,tr[A+17>>0]=0,ar[(o=n=A+8|0)>>2]=0,ar[o+4>>2]=0,tr[f>>0]=1,ar[A>>2]=0,ar[r>>2]=0,Rl(o=A+20|0,e),a=A+92|0,t=A+40|0,ar[(i=A+32|0)>>2]=1012,ar[a>>2]=1032,ar[A+36>>2]=0,Yi(A+92|0,t),ar[A+164>>2]=0,ar[A+168>>2]=-1,ar[i>>2]=5384,ar[a>>2]=5404,Ti(t),ar[t>>2]=3908,ar[(a=A+72|0)>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[A+88>>2]=8,Of(t,o),o=0|tr[e+11>>0],e=o<<24>>24<0?0|ar[e+4>>2]:255&o,ar[n>>2]=e,ar[4+n>>2]=0,tr[f>>0]=0==(0|e)&1,ar[A>>2]=i,ar[r>>2]=0}(e=0|El(176),A),0|e},function(A){return 0!=(0|tr[(A|=0)+17>>0])|0},function(A){return 1216},function(A){return 0|rs[15&(A|=0)]()},function(A){return 0|ar[(A|=0)>>2]},function(A){return 0|ar[(0|ar[(A|=0)>>2])-4>>2]},function(A){return D=0|ar[(A=(A|=0)+8|0)+4>>2],0|ar[A>>2]},function(A){return 0|ar[(A|=0)+16>>2]},function(A){return 0|ar[(A|=0)+20>>2]},function(A){return 0|ar[(0|ar[(A|=0)>>2])-4>>2]},function(A){return 0|(A|=0)},function(A){return 0|(A|=0)},function(A){return 0|ar[(A|=0)>>2]},function(A){return 1328},function(A){return 0|rs[15&(A|=0)]()},function(A){return 0|ar[(A|=0)+80>>2]},function(A){return 0|ar[(A|=0)+96>>2]},function(A){return 1400},function(A){return 1440},function(A){return 1480},function(A){return 1624},function(A){return 0|rs[15&(A|=0)]()},function(A){return((0|ar[(A|=0)+4>>2])-(0|ar[A>>2])|0)/12|0},function(A){return 1528},function(A){return 0|rs[15&(A|=0)]()},function(A){return(0|ar[(A|=0)+4>>2])-(0|ar[A>>2])>>2|0},Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu,Yu],fs=[Ju,function(A,e){e|=0;var r,i=0,f=0,n=0;if((i=0|ar[(f=(A|=0)+44|0)>>2])>>>0<(n=0|ar[A+24>>2])>>>0&&(i=ar[f>>2]=n),f=0|ar[(r=A+12|0)>>2],(0|ar[A+8>>2])>>>0>=f>>>0)return 0|(e=-1);if(-1==(0|e))return ar[r>>2]=f+-1,ar[A+16>>2]=i,(e=0)|e;if(16&ar[A+48>>2])n=255&e,f=f+-1|0;else if((n=255&e)<<24>>24!=(0|tr[(f=f+-1|0)>>0]))return 0|(e=-1);return ar[r>>2]=f,ar[A+16>>2]=i,tr[f>>0]=n,0|e},function(A,e){var r,i,f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(ur=(o=ur)+16|0,i=o,-1==(0|(e|=0)))return ur=o,(w=0)|w;if(n=(A|=0)+8|0,t=(0|ar[(f=A+12|0)>>2])-(0|ar[n>>2])|0,(0|(d=0|ar[(w=A+24|0)>>2]))==(0|(a=0|ar[(r=A+28|0)>>2]))){if(!(16&ar[(b=A+48|0)>>2]))return ur=o,0|(w=-1);s=0|ar[(u=A+20|0)>>2],k=(0|ar[(h=A+44|0)>>2])-s|0,jl(l=A+32|0,0),Ul(l,c=(0|tr[(a=l+11|0)>>0])<0?(2147483647&ar[A+40>>2])-1|0:10,0),(a=0|tr[a>>0])<<24>>24<0?(c=0|ar[l>>2],a=0|ar[A+36>>2]):(c=l,a&=255),a=c+a|0,ar[u>>2]=c,ar[r>>2]=a,d=c+(d-s)|0,ar[w>>2]=d,c=c+k|0,ar[h>>2]=c,l=k=h,s=a}else b=A+48|0,c=0|ar[(l=k=c=A+44|0)>>2],s=a;return u=d+1|0,ar[i>>2]=u,c=0|ar[(u>>>0<c>>>0?l:i)>>2],ar[k>>2]=c,8&ar[b>>2]|0&&((0|tr[(a=A+32|0)+11>>0])<0&&(a=0|ar[a>>2]),ar[n>>2]=a,ar[f>>2]=a+t,ar[A+16>>2]=c),(0|d)==(0|s)?(w=0|fs[63&ar[52+(0|ar[A>>2])>>2]](A,255&e),ur=o,0|w):(ar[w>>2]=u,tr[d>>0]=e,ur=o,0|(w=255&e))},function(A,e){return 0},function(A,e){return A|=0,0|(25696==(0|ar[(e|=0)+4>>2])?A+16|0:0)},function(A,e){e|=0;var r=0;return r=0|ar[(A|=0)+376156>>2],(0|ar[A+376160>>2])-r>>2>>>0<=e>>>0?(r=0)|r:0|(r=0|ar[r+(e<<2)>>2])},function(A,e){return(0|(e|=0))<=-1?(e=0)|e:0|(e=((0|ar[(A|=0)+376160>>2])-(0|ar[A+376156>>2])>>2|0)>(0|e))},function(A,e){return-1},function(A,e){return-1},function(A,e){return-1},function(A,e){return-1},function(A,e){A|=0,e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;f=ur=(n=ur)+31&-32,ur=ur+32|0,r=16+f|0,o=8+f|0,i=4+f|0;do{if(0|Qi(e,-1))t=15;else{if(b=0|gi(e),ar[o>>2]=b,b=A+32|0,0|tr[A+44>>0]){if(1==(0|Sr(o,4,1,0|ar[b>>2]))){t=15;break}A=-1;break}for(u=o+4|0,s=A+36|0,a=A+40|0,c=8+(ar[i>>2]=r)|0,l=r,A=o;;){if(t=0|ar[s>>2],o=1==(0|(t=0|ss[15&ar[12+(0|ar[t>>2])>>2]](t,0|ar[a>>2],A,u,f,r,c,i))),(0|ar[f>>2])==(0|A)){t=14;break}if(3==(0|t)){if(1!=(0|Sr(A,1,1,0|ar[b>>2]))){t=14;break}}else{if(1!=(1|t)){t=14;break}if((0|Sr(r,1,t=(0|ar[i>>2])-l|0,0|ar[b>>2]))!=(0|t)){t=14;break}A=o?0|ar[f>>2]:A}if(!o){t=13;break}}if(13==(0|t)){t=15;break}if(14==(0|t)){A=-1;break}}}while(0);return 15==(0|t)&&(A=0|function(A){0|Qi(A|=0,-1)&&(A=0);return 0|A}(e)),ur=n,0|A},function(A,e){A|=0,e|=0;var r,i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;f=ur=(n=ur)+31&-32,ur=ur+32|0,r=16+f|0,o=8+f|0,i=4+f|0;do{if(0|Ji(e,-1))t=15;else{if(b=0|ki(e),tr[o>>0]=b,b=A+32|0,0|tr[A+44>>0]){if(1==(0|Sr(o,1,1,0|ar[b>>2]))){t=15;break}A=-1;break}for(u=o+1|0,s=A+36|0,a=A+40|0,c=8+(ar[i>>2]=r)|0,l=r,A=o;;){if(t=0|ar[s>>2],o=1==(0|(t=0|ss[15&ar[12+(0|ar[t>>2])>>2]](t,0|ar[a>>2],A,u,f,r,c,i))),(0|ar[f>>2])==(0|A)){t=14;break}if(3==(0|t)){if(1!=(0|Sr(A,1,1,0|ar[b>>2]))){t=14;break}}else{if(1!=(1|t)){t=14;break}if((0|Sr(r,1,t=(0|ar[i>>2])-l|0,0|ar[b>>2]))!=(0|t)){t=14;break}A=o?0|ar[f>>2]:A}if(!o){t=13;break}}if(13==(0|t)){t=15;break}if(14==(0|t)){A=-1;break}}}while(0);return 15==(0|t)&&(A=0|function(A){0|Ji(A|=0,-1)&&(A=0);return 0|A}(e)),ur=n,0|A},function(A,e){var r,i,f,n,t,o=0,a=0,c=0,l=0;c=ur=(t=ur)+31&-32,ur=ur+32|0,r=c+16|0,i=c+8|0,a=c+4|0,l=0|Qi(e|=0,-1),o=0!=(0|tr[(n=(A|=0)+52|0)>>0]),f=A+48|0;do{if(l)o?o=e:(l=1&(1^(0|Qi(o=0|ar[f>>2],-1))),tr[n>>0]=l);else{if(o){switch(l=0|gi(0|ar[f>>2]),ar[a>>2]=l,l=0|ar[A+36>>2],0|ss[15&ar[12+(0|ar[l>>2])>>2]](l,0|ar[A+40>>2],a,a+4|0,c,r,8+r|0,i)){case 1:case 2:c=10;break;case 3:tr[r>>0]=ar[f>>2],ar[i>>2]=1+r,c=7;break;default:c=7}A:do{if(7==(0|c))for(o=A+32|0;;){if((a=0|ar[i>>2])>>>0<=r>>>0){a=1,o=0;break A}if(l=a+-1|0,ar[i>>2]=l,-1==(0|ai(0|tr[l>>0],0|ar[o>>2]))){c=10;break}}}while(0);if(10==(0|c)&&(a=0,o=-1),!a)break}ar[f>>2]=e,tr[n>>0]=1,o=e}}while(0);return ur=t,0|o},function(A,e){var r,i,f,n,t,o=0,a=0,c=0,l=0;c=ur=(t=ur)+31&-32,ur=ur+32|0,r=c+16|0,i=c+4|0,a=c+8|0,l=0|Ji(e|=0,-1),o=0!=(0|tr[(n=(A|=0)+52|0)>>0]),f=A+48|0;do{if(l)o?o=e:(l=1&(1^(0|Ji(o=0|ar[f>>2],-1))),tr[n>>0]=l);else{if(o){switch(l=0|ki(0|ar[f>>2]),tr[a>>0]=l,l=0|ar[A+36>>2],0|ss[15&ar[12+(0|ar[l>>2])>>2]](l,0|ar[A+40>>2],a,a+1|0,c,r,8+r|0,i)){case 1:case 2:c=10;break;case 3:tr[r>>0]=ar[f>>2],ar[i>>2]=1+r,c=7;break;default:c=7}A:do{if(7==(0|c))for(o=A+32|0;;){if((a=0|ar[i>>2])>>>0<=r>>>0){a=1,o=0;break A}if(l=a+-1|0,ar[i>>2]=l,-1==(0|ai(0|tr[l>>0],0|ar[o>>2]))){c=10;break}}}while(0);if(10==(0|c)&&(a=0,o=-1),!a)break}ar[f>>2]=e,tr[n>>0]=1,o=e}}while(0);return ur=t,0|o},function(A,e){return-1<(e|=0)<<24>>24&&(e=(0|$c())+((255&e)<<2)|0,e=255&ar[e>>2]),0|e},function(A,e){return-1<(e|=0)<<24>>24&&(e=(0|qc())+(e<<24>>24<<2)|0,e=255&ar[e>>2]),0|e},function(A,e){return 0|(e|=0)},function(A,e){return(e|=0)>>>0<128&&(e=(0|$c())+(e<<2)|0,e=0|ar[e>>2]),0|e},function(A,e){return(e|=0)>>>0<128&&(e=(0|qc())+(e<<2)|0,e=0|ar[e>>2]),0|e},function(A,e){return(e|=0)<<24>>24|0},function(A,e){return e|=0,0|is[127&(A|=0)](e)},function(A,e){return 0|ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]},function(A,e){return 0|ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]},function(A,e){A|=0;var r,i,f,n,t=0;return ur=(n=ur)+16|0,f=n,r=(e|=0)+4|0,i=0|ar[e>>2],ar[f>>2]=0,ar[f+4>>2]=0,4294967279<i>>>(ar[f+8>>2]=0)&&Nl(),i>>>0<11?(tr[f+11>>0]=i)?(e=f,t=6):e=f:(e=0|El(t=16+i&-16),ar[f>>2]=e,ar[f+8>>2]=-2147483648|t,ar[f+4>>2]=i,t=6),6==(0|t)&&Eu(0|e,0|r,0|i),e=(tr[e+i>>0]=0)|is[127&A](f),ur=(0<=(0|tr[f+11>>0])||Vl(0|ar[f>>2]),n),0|e},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},function(A,e){e|=0;var r=0,i=0;return r=0|ar[(A|=0)>>2],A=e+((i=0|ar[A+4>>2])>>1)|0,1&i&&(r=0|ar[(0|ar[A>>2])+r>>2]),r=0|is[127&r](A),A=D,i=0|El(8),ar[(e=i)>>2]=r,ar[e+4>>2]=A,0|i},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},function(A,e){e|=0;var r,i,f=0,n=0;return ur=(i=ur)+16|0,r=i,f=0|ar[(A|=0)>>2],A=e+((n=0|ar[A+4>>2])>>1)|0,1&n&&(f=0|ar[(0|ar[A>>2])+f>>2]),ks[63&f](r,A),f=0|qo((e=(n=(e=0|tr[r+11>>0])<<24>>24<0)?0|ar[r+4>>2]:255&e)+4|0),ar[f>>2]=e,A=0|ar[r>>2],Eu(f+4|0,0|(n?A:r),0|e),ur=(n&&Vl(A),i),0|f},function(A,e){e|=0;var r,i,f,n=0;return ur=(r=ur)+16|0,f=r,ks[63&ar[(A|=0)>>2]](f,e),A=0|qo((n=(i=(n=0|tr[f+11>>0])<<24>>24<0)?0|ar[f+4>>2]:255&n)+4|0),ar[A>>2]=n,e=0|ar[f>>2],Eu(A+4|0,0|(i?e:f),0|n),ur=(i&&Vl(e),r),0|A},function(A,e){var r,i;return e|=0,ur=(r=ur)+16|0,i=r,ks[63&(A|=0)](i,e),e=0|El(8),ar[e>>2]=ar[i>>2],ar[e+4>>2]=ar[i+4>>2],ur=r,0|e},function(A,e){e|=0;var r,i,f,n=0;return ur=(r=ur)+16|0,f=r,ks[63&ar[(A|=0)>>2]](f,e),A=0|qo((n=(i=(n=0|tr[f+11>>0])<<24>>24<0)?0|ar[f+4>>2]:255&n)+4|0),ar[A>>2]=n,e=0|ar[f>>2],Eu(A+4|0,0|(i?e:f),0|n),ur=(i&&Vl(e),r),0|A},function(A,e){var r,i,f,n,t,o,a,c,l,u;return A|=0,e|=0,ur=(i=ur)+16|0,f=(n=i)+12|0,t=i+8|0,r=0|El(8),lA(0|e),ar[n>>2]=e,o=0|dA(1584,0|n),ar[f>>2]=o,ar[t>>2]=0,ar[n>>2]=ar[t>>2],a=r,c=A,l=f,u=n,c|=0,l|=0,u|=0,ar[(a|=0)>>2]=c,u=0|El(20),l=0|ar[l>>2],lA(0|l),ar[u+4>>2]=0,ar[u+8>>2]=0,ar[u>>2]=5824,cA(0),ar[u+12>>2]=c,ar[u+16>>2]=l,cA(0),cA(0),cA(0),ar[a+4>>2]=u,cA(0),cA(0|ar[f>>2]),cA(0|e),ur=i,0|r},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},function(A,e){e|=0;var r,i,f=0,n=0;return ur=(i=ur)+16|0,r=i,f=0|ar[(A|=0)>>2],A=e+((n=0|ar[A+4>>2])>>1)|0,1&n&&(f=0|ar[(0|ar[A>>2])+f>>2]),ks[63&f](r,A),n=0|El(12),ar[n>>2]=ar[r>>2],ar[n+4>>2]=ar[r+4>>2],ar[n+8>>2]=ar[r+8>>2],ur=i,0|n},function(A,e){return 0|ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]},function(A,e){return 0|ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},function(A,e){e|=0;var r,i=0;return i=0|ar[(A|=0)>>2],A=e+((r=0|ar[A+4>>2])>>1)|0,1&r&&(i=0|ar[(0|ar[A>>2])+i>>2]),0|is[127&i](A)},Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju,Ju],ns=[Du,function(A,e,r){return 0|(A|=0)},function(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0;for(i=(A|=0)+12|0,f=A+16|0,o=0;!((0|r)<=(0|o));)if((n=0|ar[i>>2])>>>0<(t=0|ar[f>>2])>>>0)di(e,n,t=(0|(a=r-o|0))<(0|(t=t-n|0))?a:t),ar[i>>2]=(0|ar[i>>2])+t,e=e+t|0,o=t+o|0;else{if(-1==(0|(n=0|is[127&ar[40+(0|ar[A>>2])>>2]](A))))break;a=0|ki(n),tr[e>>0]=a,e=e+1|0,o=o+1|0}return 0|o},function(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0;for(i=(A|=0)+24|0,f=A+28|0,n=0;!((0|r)<=(0|n));)if((t=0|ar[i>>2])>>>0<(o=0|ar[f>>2])>>>0)di(t,e,o=(0|(a=r-n|0))<(0|(o=o-t|0))?a:o),ar[i>>2]=(0|ar[i>>2])+o,e=e+o|0,n=o+n|0;else{if(o=0|ar[52+(0|ar[A>>2])>>2],a=0|bi(0|tr[e>>0]),-1==(0|fs[63&o](A,a)))break;e=e+1|0,n=n+1|0}return 0|n},function(A,e,r){e|=0,r|=0;var i,f,n=0;return n=ur=(f=ur)+31&-32,ur=ur+32|0,i=n,ar[(A|=0)+36>>2]=7,0==(64&ar[A>>2]|0)&&(ar[i>>2]=ar[A+60>>2],ar[i+4>>2]=21523,ar[i+8>>2]=n+16,0|N(54,0|i))&&(tr[A+75>>0]=-1),n=0|na(A,e,r),ur=f,0|n},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n=0;return n=ur=(i=ur)+31&-32,ur=ur+32|0,n=(f=n)+20|0,ar[f>>2]=ar[A+60>>2],ar[f+4>>2]=0,ar[f+8>>2]=e,ar[f+12>>2]=n,ar[f+16>>2]=r,A=(0|ia(0|V(140,0|f)))<0?ar[n>>2]=-1:0|ar[n>>2],ur=i,0|A},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t=0,o=0,a=0,c=0;return c=ur=(f=ur)+31&-32,ur=ur+32|0,ar[(c=(t=c)+16|0)>>2]=e,o=c+4|0,n=0|ar[(i=A+48|0)>>2],ar[o>>2]=r-(0!=(0|n)&1),a=A+44|0,ar[c+8>>2]=ar[a>>2],ar[c+12>>2]=n,ar[t>>2]=ar[A+60>>2],ar[t+4>>2]=c,ar[t+8>>2]=2,1<=(0|(t=0|ia(0|_(145,0|t))))?(c=0|ar[o>>2])>>>0<t>>>0&&(o=0|ar[a>>2],ar[(a=A+4|0)>>2]=o,ar[A+8>>2]=o+(t-c),t=(0|ar[i>>2]&&(ar[a>>2]=o+1,tr[e+(r+-1)>>0]=0|tr[o>>0]),r)):ar[A>>2]=ar[A>>2]|48&t^16,ur=f,0|t},na,function(A,e,r){var i,f;return e|=0,r|=0,Eu(0|(f=0|ar[(i=(A|=0)+20|0)>>2]),0|e,0|(A=r>>>0<(A=(0|ar[A+16>>2])-f|0)>>>0?r:A)),ar[i>>2]=(0|ar[i>>2])+A,0|r},function(A,e,r){return 0|(A|=0)},function(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0;for(i=(A|=0)+12|0,f=A+16|0,o=0;!((0|r)<=(0|o));)if((n=0|ar[i>>2])>>>0<(t=0|ar[f>>2])>>>0)vi(e,n,t=(0|(a=r-o|0))<(0|(t=t-n>>2))?a:t),ar[i>>2]=(0|ar[i>>2])+(t<<2),e=e+(t<<2)|0,o=t+o|0;else{if(-1==(0|(n=0|is[127&ar[40+(0|ar[A>>2])>>2]](A))))break;a=0|gi(n),ar[e>>2]=a,e=e+4|0,o=o+1|0}return 0|o},function(A,e,r){e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0;for(i=(A|=0)+24|0,f=A+28|0,n=0;!((0|r)<=(0|n));)if((t=0|ar[i>>2])>>>0<(o=0|ar[f>>2])>>>0)vi(t,e,o=(0|(a=r-n|0))<(0|(o=o-t>>2))?a:o),ar[i>>2]=(0|ar[i>>2])+(o<<2),e=e+(o<<2)|0,n=o+n|0;else{if(o=0|ar[52+(0|ar[A>>2])>>2],a=0|wi(0|ar[e>>2]),-1==(0|fs[63&o](A,a)))break;e=e+4|0,n=n+1|0}return 0|n},function(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0,n=0;A:do{if(0|tr[A+44>>0])i=0|Sr(e,4,r,0|ar[A+32>>2]);else for(i=0;;){if((0|r)<=(0|i))break A;if(n=0|ar[52+(0|ar[A>>2])>>2],f=0|wi(0|ar[e>>2]),-1==(0|(f=0|fs[63&n](A,f))))break A;i=i+1|0,e=e+4|0}}while(0);return 0|i},function(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0,n=0;A:do{if(0|tr[A+44>>0])i=0|Sr(e,1,r,0|ar[A+32>>2]);else for(i=0;;){if((0|r)<=(0|i))break A;if(n=0|ar[52+(0|ar[A>>2])>>2],f=0|bi(0|tr[e>>0]),-1==(0|(f=0|fs[63&n](A,f))))break A;i=i+1|0,e=e+1|0}}while(0);return 0|i},function(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0;for(A=0;(0|e)!=(0|r);)A=((f=-268435456&(i=(0|tr[e>>0])+(A<<4)|0))>>>24|f)^i,e=e+1|0;return 0|A},function(A,e,r){A|=0,e|=0,r|=0;var i=0,f=0;for(A=0;(0|e)!=(0|r);)A=((f=-268435456&(i=(0|ar[e>>2])+(A<<4)|0))>>>24|f)^i,e=e+4|0;return 0|A},function(A,e,r){return r|=0,(r=0|ti((0|tr[(e|=0)+11>>0])<0&&ar[e>>2]))>>>(-1!=(0|r)&1)|0},function(A,e,r){return r|=0,(r=0|ti((0|tr[(e|=0)+11>>0])<0&&ar[e>>2]))>>>(-1!=(0|r)&1)|0},function(A,e,r){for(A|=0,e|=0,r|=0;(0|e)!=(0|r);)-1<(A=0|tr[e>>0])<<24>>24&&(A=0|$c(),A=255&ar[A+(tr[e>>0]<<2)>>2]),tr[e>>0]=A,e=e+1|0;return 0|r},function(A,e,r){for(A|=0,e|=0,r|=0;(0|e)!=(0|r);)-1<(A=0|tr[e>>0])<<24>>24&&(A=0|qc(),A=255&ar[A+(tr[e>>0]<<2)>>2]),tr[e>>0]=A,e=e+1|0;return 0|r},function(A,e,r){return r|=0,0|(-1<(e|=0)<<24>>24?e:r)},function(A,e,r){return A|=0,e|=0,0|(A=(r|=0)>>>0<128?(A=(0|Al())+(r<<1)|0,(or[A>>1]&e)<<16>>16!=0):0)},function(A,e,r){for(A|=0,e|=0,r|=0;(0|e)!=(0|r);)(A=0|ar[e>>2])>>>0<128&&(A=0|$c(),A=0|ar[A+(ar[e>>2]<<2)>>2]),ar[e>>2]=A,e=e+4|0;return 0|r},function(A,e,r){for(A|=0,e|=0,r|=0;(0|e)!=(0|r);)(A=0|ar[e>>2])>>>0<128&&(A=0|qc(),A=0|ar[A+(ar[e>>2]<<2)>>2]),ar[e>>2]=A,e=e+4|0;return 0|r},function(A,e,r){return r|=0,0|((e|=0)>>>0<128?255&e:r)},function(A,e,r){r|=0;var i,f,n=0,t=0;if(i=ur=(f=ur)+31&-32,ur=ur+64|0,0|tu(A|=0,e|=0))e=1;else if(0!=(0|e)&&0!=(0|(t=0|lu(e,3560,3544,0)))){for(n=(e=4+i|0)+52|0;(0|(e=e+4|(ar[e>>2]=0)))<(0|n););ar[i>>2]=t,ar[8+i>>2]=A,ar[12+i>>2]=-1,ar[48+i>>2]=1,ws[31&ar[28+(0|ar[t>>2])>>2]](t,i,0|ar[r>>2],1),e=1==(0|ar[24+i>>2])?(ar[r>>2]=ar[16+i>>2],1):0}else e=0;return ur=f,0|e},function(A,e,r){return 0|tu(A|=0,e|=0)},function(A,e,r){A|=0,e|=0;var i,f,n=0,t=0,o=0,a=0;if(i=ur=(f=ur)+31&-32,ur=ur+64|0,ar[(r|=0)>>2]=ar[ar[r>>2]>>2],0|function(A,e){A=0|tu(A|=0,e|=0)?1:0|tu(e,3688);return 0|A}(A,e))A=1;else if(0!=(0|e)&&0!=(0|(n=0|lu(e,3560,3648,0)))&&0==(ar[n+8>>2]&~ar[A+8>>2]|0))if(e=n+12|0,0|tu(0|ar[(A=A+12|0)>>2],0|ar[e>>2])||0|tu(0|ar[A>>2],3680))A=1;else if(0!=(0|(A=0|ar[A>>2]))&&0!=(0|(o=0|lu(A,3560,3544,0)))&&0!=(0|(t=0|ar[e>>2]))&&0!=(0|(a=0|lu(t,3560,3544,0)))){for(e=(A=4+i|0)+52|0;(0|(A=A+4|(ar[A>>2]=0)))<(0|e););ar[i>>2]=a,ar[8+i>>2]=o,ar[12+i>>2]=-1,ar[48+i>>2]=1,ws[31&ar[28+(0|ar[a>>2])>>2]](a,i,0|ar[r>>2],1),A=1==(0|ar[24+i>>2])?(ar[r>>2]=ar[16+i>>2],1):0}else A=0;else A=0;return ur=f,0|A},function(A,e,r){return 0|tu(A|=0,e|=0)},function(A,e,r){A|=0,e|=0;var i,f,n,t,o,a=0;return ur=(o=ur)+32|0,n=o+12|0,t=o,i=(r|=0)+4|0,f=0|ar[r>>2],ar[t>>2]=0,ar[t+4>>2]=0,4294967279<f>>>(ar[t+8>>2]=0)&&Nl(),f>>>0<11?(tr[t+11>>0]=f)?(r=t,a=6):r=t:(r=0|El(a=16+f&-16),ar[t>>2]=r,ar[t+8>>2]=-2147483648|a,ar[t+4>>2]=f,a=6),6==(0|a)&&Eu(0|r,0|i,0|f),tr[r+f>>0]=0,hs[127&A](n,e,t),r=0|El(12),ar[r>>2]=ar[n>>2],ar[r+4>>2]=ar[4+n>>2],ar[r+8>>2]=ar[8+n>>2],ur=(0<=(0|tr[t+11>>0])||Vl(0|ar[t>>2]),o),0|r},function(A,e,r){var i,f;return e|=0,r|=0,ur=(i=ur)+16|0,f=i,hs[127&(A|=0)](f,e,r),lA(0|ar[f>>2]),r=0|ar[f>>2],cA(0|r),ur=i,0|r},function(A,e,r){e|=0,r|=0;var i,f,n=0,t=0;return ur=(f=ur)+16|0,i=f,n=0|ar[(A|=0)>>2],A=e+((t=0|ar[A+4>>2])>>1)|0,1&t&&(n=0|ar[(0|ar[A>>2])+n>>2]),hs[127&n](i,A,r),t=0|El(8),ar[t>>2]=ar[i>>2],ar[t+4>>2]=ar[i+4>>2],ur=f,0|t},function(A,e,r){e|=0,r|=0;var i,f,n,t=0,o=0,a=0;return ur=(n=ur)+32|0,f=(a=n)+20|0,t=0|ar[(A|=0)>>2],i=r+4|0,r=0|ar[r>>2],ar[f>>2]=0,ar[4+f>>2]=0,4294967279<r>>>(ar[8+f>>2]=0)&&Nl(),r>>>0<11?(tr[11+f>>0]=r)?(A=f,o=6):A=f:(A=0|El(o=r+16&-16),ar[f>>2]=A,ar[8+f>>2]=-2147483648|o,ar[4+f>>2]=r,o=6),6==(0|o)&&Eu(0|A,0|i,0|r),tr[A+r>>0]=0,hs[127&t](a,e,f),A=0|El(20),e=0|ar[(t=a)+4>>2],ar[(o=A)>>2]=ar[t>>2],ar[o+4>>2]=e,a=a+8|0,ar[(o=A+8|0)>>2]=ar[a>>2],ar[o+4>>2]=ar[a+4>>2],ar[o+8>>2]=ar[a+8>>2],ar[a>>2]=0,ar[a+4>>2]=0,ur=((ar[a+8>>2]=0)<=(0|tr[11+f>>0])||Vl(0|ar[f>>2]),n),0|A},function(A,e,r){var i,f;return e|=0,r|=0,ur=(i=ur)+16|0,f=i,hs[127&ar[(A|=0)>>2]](f,e,r),lA(0|ar[f>>2]),r=0|ar[f>>2],cA(0|r),ur=i,0|r},function(A,e,r){return e|=0,r|=0,Jl((0|ar[(A|=0)>>2])+(12*e|0)|0,r),1},function(A,e,r){var i,f;return e|=0,r|=0,ur=(i=ur)+16|0,f=i,hs[127&ar[(A|=0)>>2]](f,e,r),lA(0|ar[f>>2]),r=0|ar[f>>2],cA(0|r),ur=i,0|r},function(A,e,r){return e|=0,r|=0,ar[(0|ar[(A|=0)>>2])+(e<<2)>>2]=ar[r>>2],1},function(A,e,r){return 0|function(A,e,r){e|=0,r|=0;var i,f,n,t=0;return f=0|ar[(i=(A=A|0)+84|0)>>2],t=0|aa(f,0,n=r+256|0),Eu(0|e,0|f,0|(r=(t=0==(0|t)?n:t-f|0)>>>0<r>>>0?t:r)),ar[A+4>>2]=f+r,e=f+t|0,ar[A+8>>2]=e,ar[i>>2]=e,0|r}(A|=0,e|=0,r|=0)},Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du,Du],ts=[Qu,function(A,e,r,i){A|=0,r|=0,i|=0;var f,n,t,o=0,a=0,c=0;if(A=0|ar[(e|=0)+4>>2],a=(0|(i=0|ar[e+8>>2]))/(0|ar[r+5784>>2])|0,c=(c=A+-1+(e=0|ar[e+12>>2])|0)-((0|c)%(0|e)|0)|0,e=(A=((0|A)/(0|ar[r+5780>>2])|0)-1+e|0)-((0|A)%(0|e)|0)|0,9<=((A=0|ar[r+5760>>2])+-8|0)>>>0&&br(29935,29989,115,29998),9<=((o=0|ar[r+5768>>2])+-8|0)>>>0&&br(30021,29989,116,29998),n=0==(0|(f=0|ra(16,0|sr(0|sr(c,i),(A+7|0)/8|0)))),t=f,0|ar[r+20>>2]){if(0==(0|(i=o=0|ra(16,a=0|sr(0|sr(e,a),(o+7|0)/8|0))))|0==(0|(A=a=0|ra(16,a)))|n)return n||$o(f),0|o&&$o(o),a&&$o(a),(r=0)|r}else{if(n)return(r=0)|r;A=i=e=0}return ar[r+4>>2]=t,ar[r+10492>>2]=0,ar[r+40>>2]=c,ar[r+8>>2]=i,ar[r+10496>>2]=0,ar[r+12>>2]=A,ar[r+10500>>2]=0,ar[r+44>>2]=e,0|(r=1)},function(A,e,r,i){for(e|=0,r|=0,i|=0;(0|e)!=(0|r);)tr[i>>0]=0|tr[e>>0],i=i+1|0,e=e+1|0;return 0|r},function(A,e,r,i){for(A|=0,e|=0,r|=0,i|=0;(0|e)!=(0|r);)A=(0|ar[e>>2])>>>0<128?(A=0|Al(),0|lr[A+(ar[e>>2]<<1)>>1]):0,or[i>>1]=A,i=i+2|0,e=e+4|0;return 0|r},function(A,e,r,i){for(A|=0,e|=0,r|=0,i|=0;;){if((0|r)==(0|i)){r=i;break}if((0|ar[r>>2])>>>0<128&&(A=0|Al(),(or[A+(ar[r>>2]<<1)>>1]&e)<<16>>16))break;r=r+4|0}return 0|r},function(A,e,r,i){for(A|=0,e|=0,r|=0,i|=0;;){if((0|r)==(0|i)){r=i;break}if(128<=(0|ar[r>>2])>>>0)break;if(A=0|Al(),!((or[A+(ar[r>>2]<<1)>>1]&e)<<16>>16))break;r=r+4|0}return 0|r},function(A,e,r,i){for(e|=0,r|=0,i|=0;(0|e)!=(0|r);)ar[i>>2]=tr[e>>0],i=i+4|0,e=e+1|0;return 0|r},function(A,e,r,i){var f,n;return e|=0,r|=0,i|=0,ur=(f=ur)+16|0,n=f,ws[31&(A|=0)](n,e,r,i),lA(0|ar[n>>2]),i=0|ar[n>>2],cA(0|i),ur=f,0|i},function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o,a,c=0;return ur=(a=ur)+16|0,t=a+12|0,o=a,n=0|ar[(A|=0)>>2],f=i+4|0,i=0|ar[i>>2],ar[o>>2]=0,ar[o+4>>2]=0,4294967279<i>>>(ar[o+8>>2]=0)&&Nl(),i>>>0<11?(tr[o+11>>0]=i)?(A=o,c=6):A=o:(A=0|El(c=i+16&-16),ar[o>>2]=A,ar[o+8>>2]=-2147483648|c,ar[o+4>>2]=i,c=6),6==(0|c)&&Eu(0|A,0|f,0|i),tr[A+i>>0]=0,ws[31&n](t,e,r,o),lA(0|ar[t>>2]),A=0|ar[t>>2],cA(0|A),ur=(0<=(0|tr[o+11>>0])||Vl(0|ar[o>>2]),a),0|A},function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o,a=0;return ur=(o=ur)+16|0,t=o,n=0|ar[(A|=0)>>2],f=i+4|0,i=0|ar[i>>2],ar[t>>2]=0,ar[t+4>>2]=0,4294967279<i>>>(ar[t+8>>2]=0)&&Nl(),i>>>0<11?(tr[t+11>>0]=i)?(A=t,a=6):A=t:(A=0|El(a=i+16&-16),ar[t>>2]=A,ar[t+8>>2]=-2147483648|a,ar[t+4>>2]=i,a=6),6==(0|a)&&Eu(0|A,0|f,0|i),A=(tr[A+i>>0]=0)|ns[63&n](e,r,t),ur=(0<=(0|tr[t+11>>0])||Vl(0|ar[t>>2]),o),0|A},function(A,e,r,i){var f,n;return e|=0,r|=0,i|=0,ur=(f=ur)+16|0,n=f,A=0|ar[(A|=0)>>2],ar[n>>2]=i,i=0|ns[63&A](e,r,n),ur=f,0|i},Qu,Qu,Qu,Qu,Qu],os=[Tu,function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f=+f;var n,t,o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;return g=ur=(d=ur)+31&-32,ur=ur+176|0,u=g+72|0,o=g+48|0,t=g+32|0,h=g+24|0,k=g+8|0,c=(n=g)+134|0,a=g+68|0,l=g+76|0,b=g+64|0,s=g+60|0,g=g+56|0,ar[(w=n)>>2]=37,w=(ar[w+4>>2]=0)|Mf(n+1|0,72962,0|ar[r+4>>2]),ar[a>>2]=c,A=0|hf(),29<(0|(A=w?(ar[k>>2]=ar[r+8>>2],J[k+8>>3]=f,0|Qf(c,30,A,n,k)):(J[h>>3]=f,0|Qf(c,30,A,n,h))))?(A=0|hf(),k=w?(ar[t>>2]=ar[r+8>>2],J[8+t>>3]=f,0|Sf(a,A,n,t)):(J[o>>3]=f,0|Sf(a,A,n,o)),(A=0|ar[a>>2])?(v=k,Z=y=A):_l()):(v=A,Z=(y=0)|ar[a>>2]),h=0|Tf(Z,k=Z+v|0,r),(0|Z)!=(0|c)?(A=0|qo(v<<1))?p=m=A:_l():(m=l,p=0),Di(u,r),VA(Z,h,k,m,b,s,u),df(u),ar[g>>2]=ar[e>>2],e=0|ar[b>>2],Z=0|ar[s>>2],ar[u>>2]=ar[g>>2],Z=0|zf(u,m,e,Z,r,i),$o(p),$o(y),ur=d,0|Z},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f=+f;var n,t,o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;return g=ur=(d=ur)+31&-32,ur=ur+176|0,u=g+72|0,o=g+48|0,t=g+32|0,h=g+24|0,k=g+8|0,c=(n=g)+134|0,a=g+68|0,l=g+76|0,b=g+64|0,s=g+60|0,g=g+56|0,ar[(w=n)>>2]=37,w=(ar[w+4>>2]=0)|Mf(n+1|0,47223,0|ar[r+4>>2]),ar[a>>2]=c,A=0|hf(),29<(0|(A=w?(ar[k>>2]=ar[r+8>>2],J[k+8>>3]=f,0|Qf(c,30,A,n,k)):(J[h>>3]=f,0|Qf(c,30,A,n,h))))?(A=0|hf(),k=w?(ar[t>>2]=ar[r+8>>2],J[8+t>>3]=f,0|Sf(a,A,n,t)):(J[o>>3]=f,0|Sf(a,A,n,o)),(A=0|ar[a>>2])?(v=k,Z=y=A):_l()):(v=A,Z=(y=0)|ar[a>>2]),h=0|Tf(Z,k=Z+v|0,r),(0|Z)!=(0|c)?(A=0|qo(v<<1))?p=m=A:_l():(m=l,p=0),Di(u,r),VA(Z,h,k,m,b,s,u),df(u),ar[g>>2]=ar[e>>2],e=0|ar[b>>2],Z=0|ar[s>>2],ar[u>>2]=ar[g>>2],Z=0|zf(u,m,e,Z,r,i),$o(p),$o(y),ur=d,0|Z},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f=+f;var n,t,o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0;g=ur=(d=ur)+31&-32,ur=ur+336|0,u=g+300|0,o=g+48|0,t=g+32|0,h=g+24|0,k=g+8|0,c=(n=g)+304|0,a=g+296|0,l=g+68|0,b=g+64|0,s=g+60|0,g=g+56|0,ar[(w=n)>>2]=37,w=(ar[w+4>>2]=0)|Mf(n+1|0,72962,0|ar[r+4>>2]),ar[a>>2]=c,A=0|hf(),29<(0|(A=w?(ar[k>>2]=ar[r+8>>2],J[k+8>>3]=f,0|Qf(c,30,A,n,k)):(J[h>>3]=f,0|Qf(c,30,A,n,h))))?(A=0|hf(),k=w?(ar[t>>2]=ar[r+8>>2],J[8+t>>3]=f,0|Sf(a,A,n,t)):(J[o>>3]=f,0|Sf(a,A,n,o)),(A=0|ar[a>>2])?(v=k,p=Z=A):_l()):(v=A,p=(Z=0)|ar[a>>2]),h=0|Tf(p,k=p+v|0,r);do{if((0|p)!=(0|c)){if(A=0|qo(v<<3)){y=0,C=m=A;break}_l()}else m=l,y=1,C=0}while(0);return Di(u,r),RA(p,h,k,m,b,s,u),df(u),ar[g>>2]=ar[e>>2],p=0|ar[b>>2],A=0|ar[s>>2],ar[u>>2]=ar[g>>2],A=0|FA(u,m,p,A,r,i),ar[e>>2]=A,y||$o(C),$o(Z),ur=d,0|A},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f=+f;var n,t,o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0;g=ur=(d=ur)+31&-32,ur=ur+336|0,u=g+300|0,o=g+48|0,t=g+32|0,h=g+24|0,k=g+8|0,c=(n=g)+304|0,a=g+296|0,l=g+68|0,b=g+64|0,s=g+60|0,g=g+56|0,ar[(w=n)>>2]=37,w=(ar[w+4>>2]=0)|Mf(n+1|0,47223,0|ar[r+4>>2]),ar[a>>2]=c,A=0|hf(),29<(0|(A=w?(ar[k>>2]=ar[r+8>>2],J[k+8>>3]=f,0|Qf(c,30,A,n,k)):(J[h>>3]=f,0|Qf(c,30,A,n,h))))?(A=0|hf(),k=w?(ar[t>>2]=ar[r+8>>2],J[8+t>>3]=f,0|Sf(a,A,n,t)):(J[o>>3]=f,0|Sf(a,A,n,o)),(A=0|ar[a>>2])?(v=k,p=Z=A):_l()):(v=A,p=(Z=0)|ar[a>>2]),h=0|Tf(p,k=p+v|0,r);do{if((0|p)!=(0|c)){if(A=0|qo(v<<3)){y=0,C=m=A;break}_l()}else m=l,y=1,C=0}while(0);return Di(u,r),RA(p,h,k,m,b,s,u),df(u),ar[g>>2]=ar[e>>2],p=0|ar[b>>2],A=0|ar[s>>2],ar[u>>2]=ar[g>>2],A=0|FA(u,m,p,A,r,i),ar[e>>2]=A,y||$o(C),$o(Z),ur=d,0|A},Tu,Tu,Tu],as=[Mu,function(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n=0,t=0;for(A=e|=0;;){if((0|i)==(0|f)){t=7;break}if((0|A)==(0|r)){A=-1;break}if((e=0|tr[A>>0])<<24>>24<(n=0|tr[i>>0])<<24>>24){A=-1;break}if(n<<24>>24<e<<24>>24){A=1;break}i=i+1|0,A=A+1|0}return 7==(0|t)&&(A=(0|A)!=(0|r)&1),0|A},function(A,e,r,i,f){A|=0,r|=0,i|=0,f|=0;var n=0,t=0;for(A=e|=0;;){if((0|i)==(0|f)){t=7;break}if((0|A)==(0|r)){A=-1;break}if((0|(e=0|ar[A>>2]))<(0|(n=0|ar[i>>2]))){A=-1;break}if((0|n)<(0|e)){A=1;break}i=i+4|0,A=A+4|0}return 7==(0|t)&&(A=(0|A)!=(0|r)&1),0|A},function(A,e,r,i,f){A|=0,e|=0,i|=0,f|=0;var n,t,o=0,a=0,c=0;if(o=ur=(t=ur)+31&-32,ur=ur+16|0,n=o+4|0,1&ar[(r|=0)+4>>2]){for(Di(n,r),A=0|bf(n,52552),df(n),r=0|ar[A>>2],f?ks[63&ar[r+24>>2]](n,A):ks[63&ar[r+28>>2]](n,A),(A=0|tr[(a=11+n|0)>>0])<<24>>24<0?(r=A,A=0|ar[n>>2],c=8):f=n;8==(0|c)&&(f=A,A=r),(0|f)!=(((c=A<<24>>24<0)?0|ar[n>>2]:n)+(c?0|ar[4+n>>2]:255&A)|0);)A=0|tr[f>>0],0|(r=0|ar[e>>2])&&0|Ji(A=(0|(o=0|ar[(i=r+24|0)>>2]))==(0|ar[r+28>>2])?(c=0|ar[52+(0|ar[r>>2])>>2],A=0|bi(A),0|fs[63&c](r,A)):(ar[i>>2]=o+1,0|bi(tr[o>>0]=A)),-1)&&(ar[e>>2]=0),r=0|tr[a>>0],A=f+1|0,c=8;A=0|ar[e>>2],Yl(n)}else c=0|ar[24+(0|ar[A>>2])>>2],ar[o>>2]=ar[e>>2],ar[n>>2]=ar[o>>2],A=0|as[31&c](A,n,r,i,1&f);return ur=t,0|A},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u=0,s=0;return u=ur=(A=ur)+31&-32,ur=ur+64|0,s=(t=u)+52|0,c=u+39|0,n=u+16|0,a=u+12|0,o=u+4|0,u=u+8|0,tr[s>>0]=0|tr[47228],tr[s+1>>0]=0|tr[47229],tr[s+2>>0]=0|tr[47230],tr[s+3>>0]=0|tr[47231],tr[s+4>>0]=0|tr[47232],tr[s+5>>0]=0|tr[47233],XA(s+1|0,47234,1,0|ar[r+4>>2]),l=0|hf(),ar[t>>2]=f,s=0|Tf(c,f=c+(0|Qf(c,13,l,s,t))|0,r),Di(t,r),_A(c,s,f,n,a,o,t),df(t),ar[u>>2]=ar[e>>2],e=0|ar[a>>2],f=0|ar[o>>2],ar[t>>2]=ar[u>>2],f=0|zf(t,n,e,f,r,i),ur=A,0|f},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u=0,s=0;return u=ur=(A=ur)+31&-32,ur=ur+64|0,s=(t=u)+52|0,c=u+40|0,n=u+16|0,a=u+12|0,o=u+4|0,u=u+8|0,tr[s>>0]=0|tr[47228],tr[s+1>>0]=0|tr[47229],tr[s+2>>0]=0|tr[47230],tr[s+3>>0]=0|tr[47231],tr[s+4>>0]=0|tr[47232],tr[s+5>>0]=0|tr[47233],XA(s+1|0,47234,0,0|ar[r+4>>2]),l=0|hf(),ar[t>>2]=f,s=0|Tf(c,f=c+(0|Qf(c,12,l,s,t))|0,r),Di(t,r),_A(c,s,f,n,a,o,t),df(t),ar[u>>2]=ar[e>>2],e=0|ar[a>>2],f=0|ar[o>>2],ar[t>>2]=ar[u>>2],f=0|zf(t,n,e,f,r,i),ur=A,0|f},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c=0,l=0,u=0;return u=ur=(A=ur)+31&-32,ur=ur+80|0,l=(o=u)+68|0,n=u+48|0,t=u+8|0,u=u+4|0,tr[l>>0]=0|tr[47217],tr[l+1>>0]=0|tr[47218],tr[l+2>>0]=0|tr[47219],tr[l+3>>0]=0|tr[47220],tr[l+4>>0]=0|tr[47221],tr[l+5>>0]=0|tr[47222],c=0|hf(),ar[o>>2]=f,c=0|Tf(n,l=n+(f=0|Qf(n,20,c,l,o))|0,r),Di(o,r),a=0|bf(o,52536),df(o),ts[15&ar[32+(0|ar[a>>2])>>2]](a,n,l,t),f=t+f|0,ar[u>>2]=ar[e>>2],ar[o>>2]=ar[u>>2],f=0|zf(o,t,(0|c)==(0|l)?f:c-n+t|0,f,r,i),ur=A,0|f},function(A,e,r,i,f){A|=0,e|=0,i|=0,f|=0;var n,t,o=0,a=0,c=0;if(o=ur=(t=ur)+31&-32,ur=ur+16|0,n=o+4|0,1&ar[(r|=0)+4>>2]){for(Di(n,r),A=0|bf(n,52576),df(n),r=0|ar[A>>2],f?ks[63&ar[r+24>>2]](n,A):ks[63&ar[r+28>>2]](n,A),A=0|tr[(a=8+n+3|0)>>0],r=0|ar[n>>2],c=4+n|0,f=A<<24>>24<0?r:n;(0|f)!=(((o=A<<24>>24<0)?r:n)+((o?0|ar[c>>2]:255&A)<<2)|0);)A=0|ar[f>>2],0|(r=0|ar[e>>2])&&0|Qi(A=(0|(o=0|ar[(i=r+24|0)>>2]))==(0|ar[r+28>>2])?(o=0|ar[52+(0|ar[r>>2])>>2],A=0|wi(A),0|fs[63&o](r,A)):(ar[i>>2]=o+4,0|wi(ar[o>>2]=A)),-1)&&(ar[e>>2]=0),f=f+4|0,A=0|tr[a>>0],r=0|ar[n>>2];A=0|ar[e>>2],Pl(n)}else c=0|ar[24+(0|ar[A>>2])>>2],ar[o>>2]=ar[e>>2],ar[n>>2]=ar[o>>2],A=0|as[31&c](A,n,r,i,1&f);return ur=t,0|A},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u=0,s=0;return u=ur=(A=ur)+31&-32,ur=ur+128|0,s=(t=u)+122|0,c=u+108|0,n=u+16|0,a=u+12|0,o=u+4|0,u=u+8|0,tr[s>>0]=0|tr[47228],tr[s+1>>0]=0|tr[47229],tr[s+2>>0]=0|tr[47230],tr[s+3>>0]=0|tr[47231],tr[s+4>>0]=0|tr[47232],tr[s+5>>0]=0|tr[47233],XA(s+1|0,47234,1,0|ar[r+4>>2]),l=0|hf(),ar[t>>2]=f,s=0|Tf(c,f=c+(0|Qf(c,13,l,s,t))|0,r),Di(t,r),YA(c,s,f,n,a,o,t),df(t),ar[u>>2]=ar[e>>2],e=0|ar[a>>2],f=0|ar[o>>2],ar[t>>2]=ar[u>>2],f=0|FA(t,n,e,f,r,i),ur=A,0|f},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c,l,u=0,s=0;return u=ur=(A=ur)+31&-32,ur=ur+128|0,s=(t=u)+112|0,c=u+100|0,n=u+16|0,a=u+12|0,o=u+4|0,u=u+8|0,tr[s>>0]=0|tr[47228],tr[s+1>>0]=0|tr[47229],tr[s+2>>0]=0|tr[47230],tr[s+3>>0]=0|tr[47231],tr[s+4>>0]=0|tr[47232],tr[s+5>>0]=0|tr[47233],XA(s+1|0,47234,0,0|ar[r+4>>2]),l=0|hf(),ar[t>>2]=f,s=0|Tf(c,f=c+(0|Qf(c,12,l,s,t))|0,r),Di(t,r),YA(c,s,f,n,a,o,t),df(t),ar[u>>2]=ar[e>>2],e=0|ar[a>>2],f=0|ar[o>>2],ar[t>>2]=ar[u>>2],f=0|FA(t,n,e,f,r,i),ur=A,0|f},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n,t,o,a,c=0,l=0,u=0;return u=ur=(A=ur)+31&-32,ur=ur+192|0,l=(o=u)+176|0,n=u+156|0,t=u+4|0,u=u+152|0,tr[l>>0]=0|tr[47217],tr[l+1>>0]=0|tr[47218],tr[l+2>>0]=0|tr[47219],tr[l+3>>0]=0|tr[47220],tr[l+4>>0]=0|tr[47221],tr[l+5>>0]=0|tr[47222],c=0|hf(),ar[o>>2]=f,c=0|Tf(n,l=n+(f=0|Qf(n,20,c,l,o))|0,r),Di(o,r),a=0|bf(o,52568),df(o),ts[15&ar[48+(0|ar[a>>2])>>2]](a,n,l,t),f=t+(f<<2)|0,ar[u>>2]=ar[e>>2],ar[o>>2]=ar[u>>2],f=0|FA(o,t,(0|c)==(0|l)?f:t+(c-n<<2)|0,f,r,i),ur=A,0|f},function(A,e,r,i,f){return r|=0,ar[(f|=0)>>2]=r,3},function(A,e,r,i,f){return 0|function(A,e,r,i,f){r|=0,i|=0;var n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0;2<((n=e|=0)-(t=A|=0)|0)&0!=(4&(f|=0)|0)&&-17==(0|tr[A>>0])&&-69==(0|tr[A+1>>0])?A=-65==((b=0)|tr[A+2>>0])?A+3|0:A:b=0;A:for(;;){if(!(b>>>0<r>>>0&A>>>0<e>>>0)){0;break}l=0|tr[A>>0],s=255&l,o=A+1|0;do{if(-1<l<<24>>24){if(i>>>0<s>>>0){0;break A}A=o}else{if((255&l)<194){0;break A}if(a=A+2|0,f=n-(u=A)|0,(255&l)<224){if((0|f)<2){0;break A}if(128!=(192&(f=0|cr[o>>0])|0)){0;break A}if(i>>>0<(63&f|s<<6&1984)>>>0){0;break A}A=a;break}if(c=A+3|0,(255&l)<240){if((0|f)<3){0;break A}switch(a=0|tr[a>>0],o=0|cr[o>>0],f=224&o,l<<24>>24){case-32:if(160==(0|f))break;A=u;break A;case-19:if(128==(0|f))break;A=u;break A;default:if(128!=(192&o|0)){A=u;break A}}if(128!=(192&(f=255&a)|0)){0;break A}if(i>>>0<(o<<6&4032|s<<12&61440|63&f)>>>0){0;break A}A=c;break}if((0|f)<4|244<(255&l)){0;break A}switch(o=0|tr[o>>0],f=0|tr[a>>0],a=0|tr[c>>0],c=255&o,l<<24>>24){case-16:if(48<=(o+112&255)){A=u;break A}break;case-12:if(128==(240&c|0))break;A=u;break A;default:if(128!=(192&c|0)){A=u;break A}}if(128!=(192&(o=255&f)|0)){0;break A}if(128!=(192&(f=255&a)|0)){0;break A}if(i>>>0<(c<<12&258048|s<<18&1835008|o<<6&4032|63&f)>>>0){0;break A}A=A+4|0}}while(0);b=b+1|0}return A-t|0}(r|=0,i|=0,f|=0,1114111,0)},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0;var n,t=0;t=ur=(n=ur)+31&-32,ur=ur+16|0,ar[(f|=0)>>2]=r,r=0|Ai(0|ar[A+8>>2]),A=0|Ea(t,0),0|r&&Ai(r);A:do{switch(0|A){case 0:case-1:A=2;break;default:if((A=A+-1|0)>>>0>(i-(0|ar[f>>2])|0)>>>0)A=1;else for(;;){if(!A){A=0;break A}e=0|tr[t>>0],i=0|ar[f>>2],ar[f>>2]=i+1,tr[i>>0]=e,t=t+1|0,A=A+-1|0}}}while(0);return ur=n,0|A},function(A,e,r,i,f){e|=0,r|=0,f|=0;var n,t,o,a,c,l=0,u=0,s=0;t=i|=0,n=(A|=0)+8|0,s=u=0;A:for(;!((0|r)==(0|i)|f>>>0<=u>>>0);){switch(l=0|Ai(0|ar[n>>2]),A=0|(a=t-(o=r)|0,c=e,0|za(0,o|=0,a|=0,0|(c|=0)?c:51460)),0|l&&Ai(l),0|A){case-2:case-1:break A;case 0:A=1}u=u+1|0,s=A+s|0,r=r+A|0}return 0|s},function(A,e,r,i,f){for(A|=0,e|=0,r|=0,i|=0,f|=0;(0|e)!=(0|r);)A=0|tr[e>>0],tr[f>>0]=-1<A<<24>>24?A:i,f=f+1|0,e=e+1|0;return 0|r},function(A,e,r,i,f){A|=0,i|=0;var n,t=0;for(n=((r|=0)-(e|=0)|0)>>>2,A=f|=0,f=e;(0|f)!=(0|r);)t=0|ar[f>>2],tr[A>>0]=t>>>0<128?255&t:i,A=A+1|0,f=f+4|0;return e+(n<<2)|0},function(A,e,r,i,f){return r|=0,ar[(f|=0)>>2]=r,3},function(A,e,r,i,f){return 0|((i=(i|=0)-(r|=0)|0)>>>0<(f|=0)>>>0?i:f)},function(A,e,r,i,f){return r|=0,ar[(f|=0)>>2]=r,3},function(A,e,r,i,f){return 0|function(A,e,r,i,f){r|=0,i|=0;var n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;2<((n=e|=0)-(t=A|=0)|0)&0!=(4&(f|=0)|0)&&-17==(0|tr[A>>0])&&-69==(0|tr[A+1>>0])?A=-65==((d=0)|tr[A+2>>0])?A+3|0:A:d=0;A:for(;;){if(!(d>>>0<r>>>0&A>>>0<e>>>0)){0;break}if(l=0|tr[A>>0],i>>>0<(b=255&l)>>>0){0;break}a=A+1|0;do{if(l<<24>>24<=-1){if((255&l)<194){0;break A}if(c=A+2|0,f=n-(u=A)|0,(255&l)<224){if((0|f)<2){0;break A}if(128!=(192&(f=0|cr[a>>0])|0)){0;break A}if(i>>>0<(63&f|b<<6&1984)>>>0){0;break A}f=d,A=c;break}if(s=A+3|0,(255&l)<240){if((0|f)<3){0;break A}switch(o=0|tr[c>>0],a=0|cr[a>>0],f=224&a,l<<24>>24){case-32:if(160==(0|f))break;A=u;break A;case-19:if(128==(0|f))break;A=u;break A;default:if(128!=(192&a|0)){A=u;break A}}if(128!=(192&(f=255&o)|0)){0;break A}if(i>>>0<(a<<6&4032|b<<12&61440|63&f)>>>0){0;break A}f=d,A=s;break}if(245<=(255&l)){0;break A}if((r-d|0)>>>0<2|(0|f)<4){0;break A}switch(o=0|tr[a>>0],f=0|tr[c>>0],a=0|tr[s>>0],c=255&o,l<<24>>24){case-16:if(48<=(o+112&255)){A=u;break A}break;case-12:if(128==(240&c|0))break;A=u;break A;default:if(128!=(192&c|0)){A=u;break A}}if(128!=(192&(o=255&f)|0)){0;break A}if(128!=(192&(f=255&a)|0)){0;break A}if(i>>>0<(c<<12&258048|b<<18&1835008|o<<6&4032|63&f)>>>0){0;break A}f=d+1|0,A=A+4|0}else f=d,A=a}while(0);d=f+1|0}return A-t|0}(r|=0,i|=0,f|=0,1114111,0)},Mu,Mu,Mu,Mu,Mu,Mu,Mu,Mu,Mu,Mu,Mu],cs=[Su,function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n=+n;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0;for(C=ur=(g=ur)+31&-32,ur=ur+384|0,c=C+8|0,A=(p=C)+284|0,y=C+72|0,m=C+184|0,v=C+68|0,l=C+180|0,u=C+177|0,s=C+176|0,k=C+56|0,h=C+44|0,w=C+32|0,o=C+28|0,a=C+76|0,b=C+24|0,d=C+16|0,C=C+20|0,ar[y>>2]=A,J[c>>3]=n,99<(A=0|la(A,100,48494,c))>>>0?(A=0|hf(),J[p>>3]=n,A=0|Sf(y,A,48494,p),(m=0|ar[y>>2])||_l(),(p=0|qo(A))?(B=A,G=W=p,V=m):_l()):(W=m,B=A,V=G=0),Di(v,i),t=0|bf(v,52536),Z=0|ar[y>>2],ts[15&ar[32+(0|ar[t>>2])>>2]](t,Z,Z+B|0,W),Z=B?45==(0|tr[ar[y>>2]>>0]):0,ar[k>>2]=0,ar[4+k>>2]=0,A=ar[8+k>>2]=0;3!=(0|A);)A=A+1|(ar[k+(A<<2)>>2]=0);for(ar[h>>2]=0,ar[4+h>>2]=0,A=ar[8+h>>2]=0;3!=(0|A);)A=A+1|(ar[h+(A<<2)>>2]=0);for(ar[w>>2]=0,ar[4+w>>2]=0,A=ar[8+w>>2]=0;3!=(0|A);)A=A+1|(ar[w+(A<<2)>>2]=0);return Ge(r,Z,v,l,u,s,k,h,w,o),100<(A=(p=(0|(y=0|ar[o>>2]))<(0|B)?(m=0|tr[11+w>>0],p=0|tr[11+h>>0],A=1,m=(m<<24>>24<0?0|ar[4+w>>2]:255&m)+(B-y<<1)|0,p<<24>>24<0?0|ar[4+h>>2]:255&p):(p=0|tr[11+w>>0],A=2,m=(m=0|tr[11+h>>0])<<24>>24<0?0|ar[4+h>>2]:255&m,p<<24>>24<0?0|ar[4+w>>2]:255&p))+y+m+A|0)>>>0?(A=0|qo(A))?E=I=A:_l():(I=a,E=0),Ve(I,b,d,0|ar[i+4>>2],W,W+B|0,t,Z,l,0|tr[u>>0],0|tr[s>>0],k,h,w,y),ar[C>>2]=ar[e>>2],e=0|ar[b>>2],A=0|ar[d>>2],ar[c>>2]=ar[C>>2],A=0|zf(c,I,e,A,i,f),0|E&&$o(E),Yl(w),Yl(h),Yl(k),df(v),0|G&&$o(G),0|V&&$o(V),ur=g,0|A},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n=+n;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0;for(C=ur=(g=ur)+31&-32,ur=ur+1008|0,c=C+8|0,A=(p=C)+896|0,y=C+888|0,m=C+488|0,v=C+480|0,l=C+892|0,u=C+476|0,s=C+472|0,k=C+460|0,h=C+448|0,w=C+436|0,o=C+432|0,a=C+32|0,b=C+24|0,d=C+16|0,C=C+20|0,ar[y>>2]=A,J[c>>3]=n,99<(A=0|la(A,100,48494,c))>>>0?(A=0|hf(),J[p>>3]=n,A=0|Sf(y,A,48494,p),(m=0|ar[y>>2])||_l(),(p=0|qo(A<<2))?(B=A,G=W=p,V=m):_l()):(W=m,B=A,V=G=0),Di(v,i),t=0|bf(v,52568),Z=0|ar[y>>2],ts[15&ar[48+(0|ar[t>>2])>>2]](t,Z,Z+B|0,W),Z=B?45==(0|tr[ar[y>>2]>>0]):0,ar[k>>2]=0,ar[4+k>>2]=0,A=ar[8+k>>2]=0;3!=(0|A);)A=A+1|(ar[k+(A<<2)>>2]=0);for(ar[h>>2]=0,ar[4+h>>2]=0,A=ar[8+h>>2]=0;3!=(0|A);)A=A+1|(ar[h+(A<<2)>>2]=0);for(ar[w>>2]=0,ar[4+w>>2]=0,A=ar[8+w>>2]=0;3!=(0|A);)A=A+1|(ar[w+(A<<2)>>2]=0);return Xe(r,Z,v,l,u,s,k,h,w,o),100<(A=(p=(0|(y=0|ar[o>>2]))<(0|B)?(m=0|tr[8+w+3>>0],p=0|tr[8+h+3>>0],A=1,m=(m<<24>>24<0?0|ar[4+w>>2]:255&m)+(B-y<<1)|0,p<<24>>24<0?0|ar[4+h>>2]:255&p):(p=0|tr[8+w+3>>0],A=2,m=(m=0|tr[8+h+3>>0])<<24>>24<0?0|ar[4+h>>2]:255&m,p<<24>>24<0?0|ar[4+w>>2]:255&p))+y+m+A|0)>>>0?(A=0|qo(A<<2))?E=I=A:_l():(I=a,E=0),_e(I,b,d,0|ar[i+4>>2],W,W+(B<<2)|0,t,Z,l,0|ar[u>>2],0|ar[s>>2],k,h,w,y),ar[C>>2]=ar[e>>2],e=0|ar[b>>2],A=0|ar[d>>2],ar[c>>2]=ar[C>>2],A=0|FA(c,I,e,A,i,f),0|E&&$o(E),Pl(w),Pl(h),Yl(k),df(v),0|G&&$o(G),0|V&&$o(V),ur=g,0|A},Su],ls=[Uu,function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c=0,l=0,u=0,s=0;if(u=ur=(a=ur)+31&-32,ur=ur+48|0,c=u+40|0,s=u+16|0,t=u+8|0,o=u+12|0,l=u+4|0,1&ar[(i|=0)+4>>2])for(Di(c,i),l=0|bf(c,52536),df(c),Di(c,i),A=0|bf(c,52552),df(c),ks[63&ar[24+(0|ar[A>>2])>>2]](s,A),ks[63&ar[28+(0|ar[A>>2])>>2]](s+12|0,A),ar[u>>2]=ar[r>>2],A=s+24|0,ar[c>>2]=ar[u>>2],c=(0|Ff(e,c,s,A,l,f,1))==(0|s)&1,tr[n>>0]=c,c=0|ar[e>>2];Yl(A=A+-12|0),(0|A)!=(0|s););else{switch(ar[t>>2]=-1,u=0|ar[16+(0|ar[A>>2])>>2],ar[o>>2]=ar[e>>2],ar[l>>2]=ar[r>>2],ar[s>>2]=ar[o>>2],ar[c>>2]=ar[l>>2],s=0|ls[63&u](A,s,c,i,f,t),ar[e>>2]=s,0|ar[t>>2]){case 0:tr[n>>0]=0;break;case 1:tr[n>>0]=1;break;default:tr[n>>0]=1,ar[f>>2]=4}c=0|ar[e>>2]}return ur=a,0|c},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+224|0,c=Z+198|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),If(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|bi(0|tr[i>>0])),b,A,l,Z,0|tr[y>>0],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+1,bi(0|tr[i>>0]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|_f(A,0|ar[l>>2],f,b),ar[n>>2]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Ji(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+224|0,c=Z+198|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),If(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|bi(0|tr[i>>0])),b,A,l,Z,0|tr[y>>0],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+1,bi(0|tr[i>>0]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Xf(A,0|ar[l>>2],f,b),ar[n>>2]=C,ar[n+4>>2]=D,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Ji(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+224|0,c=Z+198|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),If(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|bi(0|tr[i>>0])),b,A,l,Z,0|tr[y>>0],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+1,bi(0|tr[i>>0]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Vf(A,0|ar[l>>2],f,b),or[n>>1]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Ji(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+224|0,c=Z+198|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),If(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|bi(0|tr[i>>0])),b,A,l,Z,0|tr[y>>0],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+1,bi(0|tr[i>>0]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Gf(A,0|ar[l>>2],f,b),ar[n>>2]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Ji(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+224|0,c=Z+198|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),If(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|bi(0|tr[i>>0])),b,A,l,Z,0|tr[y>>0],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+1,bi(0|tr[i>>0]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Ef(A,0|ar[l>>2],f,b),ar[n>>2]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Ji(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+224|0,c=Z+198|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),If(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Ji(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|bi(0|tr[i>>0])),b,A,l,Z,0|tr[y>>0],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+1,bi(0|tr[i>>0]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Bf(A,0|ar[l>>2],f,b),ar[n>>2]=C,ar[n+4>>2]=D,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Ji(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;C=ur=(w=ur)+31&-32,ur=ur+240|0,c=C+200|0,l=C+199|0,W=C+198|0,h=C+184|0,k=C+172|0,u=C+168|0,s=C+8|0,b=C+4|0,I=(d=C)+197|0,C=C+196|0,gf(h,i|=0,c,l,W),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A,ar[b>>2]=s,ar[d>>2]=0,tr[I>>0]=1,tr[C>>0]=69,t=4+k|0,m=0|ar[e>>2],g=m;A:for(;;){p=g?0|Ji(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,m=Z=0,1):(Z=g,0):(m=Z=0,1),g=0|ar[r>>2];do{if(g){if(0|Ji(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,E=19;break}if(p)break;break A}E=19}while(0);if(19==(0|E)){if(E=0,p){g=0;break}g=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[u>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A+i),0|mf(255&(i=(0|(i=0|ar[(p=Z+12|0)>>2]))==(0|ar[(y=Z+16|0)>>2])?0|is[127&ar[36+(0|ar[Z>>2])>>2]](Z):0|bi(0|tr[i>>0])),I,C,A,u,0|tr[l>>0],0|tr[W>>0],h,s,b,d,c))break;(0|(i=0|ar[p>>2]))!=(0|ar[y>>2])?(ar[p>>2]=i+1,bi(0|tr[i>>0]),g=Z):(is[127&ar[40+(0|ar[Z>>2])>>2]](Z),g=Z)}W=0|tr[11+h>>0],0!=(0|tr[I>>0])&&0!=(0|(W<<24>>24<0?0|ar[4+h>>2]:255&W))&&((B=0|ar[b>>2])-s|0)<160&&(I=0|ar[d>>2],ar[b>>2]=B+4,ar[B>>2]=I);v=+Cf(A,0|ar[u>>2],f),Y[n>>2]=v,yf(h,s,0|ar[b>>2],f),i=Z?(A=(0|(A=0|ar[Z+12>>2]))==(0|ar[Z+16>>2])?0|is[127&ar[36+(0|ar[m>>2])>>2]](Z):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(g){if(0|Ji(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,E=47;break}if(i)break;E=49;break}E=47}while(0);47==(0|E)&&i&&(E=49);49==(0|E)&&(ar[f>>2]=2|ar[f>>2]);return E=0|ar[e>>2],Yl(k),Yl(h),ur=w,0|E}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;C=ur=(w=ur)+31&-32,ur=ur+240|0,c=C+200|0,l=C+199|0,W=C+198|0,h=C+184|0,k=C+172|0,u=C+168|0,s=C+8|0,b=C+4|0,I=(d=C)+197|0,C=C+196|0,gf(h,i|=0,c,l,W),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A,ar[b>>2]=s,ar[d>>2]=0,tr[I>>0]=1,tr[C>>0]=69,t=4+k|0,m=0|ar[e>>2],g=m;A:for(;;){p=g?0|Ji(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,m=Z=0,1):(Z=g,0):(m=Z=0,1),g=0|ar[r>>2];do{if(g){if(0|Ji(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,E=19;break}if(p)break;break A}E=19}while(0);if(19==(0|E)){if(E=0,p){g=0;break}g=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[u>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A+i),0|mf(255&(i=(0|(i=0|ar[(p=Z+12|0)>>2]))==(0|ar[(y=Z+16|0)>>2])?0|is[127&ar[36+(0|ar[Z>>2])>>2]](Z):0|bi(0|tr[i>>0])),I,C,A,u,0|tr[l>>0],0|tr[W>>0],h,s,b,d,c))break;(0|(i=0|ar[p>>2]))!=(0|ar[y>>2])?(ar[p>>2]=i+1,bi(0|tr[i>>0]),g=Z):(is[127&ar[40+(0|ar[Z>>2])>>2]](Z),g=Z)}W=0|tr[11+h>>0],0!=(0|tr[I>>0])&&0!=(0|(W<<24>>24<0?0|ar[4+h>>2]:255&W))&&((B=0|ar[b>>2])-s|0)<160&&(I=0|ar[d>>2],ar[b>>2]=B+4,ar[B>>2]=I);v=+Zf(A,0|ar[u>>2],f),J[n>>3]=v,yf(h,s,0|ar[b>>2],f),i=Z?(A=(0|(A=0|ar[Z+12>>2]))==(0|ar[Z+16>>2])?0|is[127&ar[36+(0|ar[m>>2])>>2]](Z):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(g){if(0|Ji(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,E=47;break}if(i)break;E=49;break}E=47}while(0);47==(0|E)&&i&&(E=49);49==(0|E)&&(ar[f>>2]=2|ar[f>>2]);return E=0|ar[e>>2],Yl(k),Yl(h),ur=w,0|E}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;C=ur=(w=ur)+31&-32,ur=ur+240|0,c=C+200|0,l=C+199|0,W=C+198|0,h=C+184|0,k=C+172|0,u=C+168|0,s=C+8|0,b=C+4|0,I=(d=C)+197|0,C=C+196|0,gf(h,i|=0,c,l,W),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A,ar[b>>2]=s,ar[d>>2]=0,tr[I>>0]=1,tr[C>>0]=69,t=4+k|0,m=0|ar[e>>2],g=m;A:for(;;){p=g?0|Ji(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0]),-1)?(ar[e>>2]=0,m=Z=0,1):(Z=g,0):(m=Z=0,1),g=0|ar[r>>2];do{if(g){if(0|Ji(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,E=19;break}if(p)break;break A}E=19}while(0);if(19==(0|E)){if(E=0,p){g=0;break}g=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[u>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A+i),0|mf(255&(i=(0|(i=0|ar[(p=Z+12|0)>>2]))==(0|ar[(y=Z+16|0)>>2])?0|is[127&ar[36+(0|ar[Z>>2])>>2]](Z):0|bi(0|tr[i>>0])),I,C,A,u,0|tr[l>>0],0|tr[W>>0],h,s,b,d,c))break;(0|(i=0|ar[p>>2]))!=(0|ar[y>>2])?(ar[p>>2]=i+1,bi(0|tr[i>>0]),g=Z):(is[127&ar[40+(0|ar[Z>>2])>>2]](Z),g=Z)}W=0|tr[11+h>>0],0!=(0|tr[I>>0])&&0!=(0|(W<<24>>24<0?0|ar[4+h>>2]:255&W))&&((B=0|ar[b>>2])-s|0)<160&&(I=0|ar[d>>2],ar[b>>2]=B+4,ar[B>>2]=I);v=+pf(A,0|ar[u>>2],f),J[n>>3]=v,yf(h,s,0|ar[b>>2],f),i=Z?(A=(0|(A=0|ar[Z+12>>2]))==(0|ar[Z+16>>2])?0|is[127&ar[36+(0|ar[m>>2])>>2]](Z):0|bi(0|tr[A>>0]),0|Ji(A,-1)?(ar[e>>2]=0,1):0):1;do{if(g){if(0|Ji(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,E=47;break}if(i)break;E=49;break}E=47}while(0);47==(0|E)&&i&&(E=49);49==(0|E)&&(ar[f>>2]=2|ar[f>>2]);return E=0|ar[e>>2],Yl(k),Yl(h),ur=w,0|E}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;for(m=ur=(d=ur)+31&-32,ur=ur+240|0,p=(u=m)+204|0,s=m+192|0,b=m+180|0,y=m+176|0,c=m+16|0,l=m+8|0,m=m+4|0,ar[s>>2]=0,ar[4+s>>2]=0,A=ar[8+s>>2]=0;3!=(0|A);)A=A+1|(ar[s+(A<<2)>>2]=0);for(Di(b,i),A=0|bf(b,52536),ts[15&ar[32+(0|ar[A>>2])>>2]](A,46974,47e3,p),df(b),ar[b>>2]=0,ar[4+b>>2]=0,A=ar[8+b>>2]=0;3!=(0|A);)A=A+1|(ar[b+(A<<2)>>2]=0);o=8+b|0,Ul(b,A=(0|tr[(a=11+b|0)>>0])<0?(2147483647&ar[o>>2])-1|0:10,0),A=(0|tr[a>>0])<0?0|ar[b>>2]:b,ar[y>>2]=A,ar[l>>2]=c,t=4+b|(ar[m>>2]=0),k=h=0|ar[e>>2];A:for(;;){w=k?0|Ji(i=(0|(i=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[i>>0]),-1)?(h=g=ar[e>>2]=0,1):(g=k,0):(h=g=0,1),k=0|ar[r>>2];do{if(k){if(0|Ji(i=(0|(i=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,Z=22;break}if(w)break;break A}Z=22}while(0);if(22==(0|Z)){if(Z=0,w){k=0;break}k=0}if(i=(i=0|tr[a>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[y>>2])==(A+i|0)&&(Ul(b,i<<1,0),Ul(b,A=(0|tr[a>>0])<0?(2147483647&ar[o>>2])-1|0:10,0),A=(0|tr[a>>0])<0?0|ar[b>>2]:b,ar[y>>2]=A+i),0|kf(255&(i=(0|(i=0|ar[(w=g+12|0)>>2]))==(0|ar[(v=g+16|0)>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|bi(0|tr[i>>0])),16,A,y,m,0,s,c,l,p))break;(0|(i=0|ar[w>>2]))!=(0|ar[v>>2])?(ar[w>>2]=i+1,bi(0|tr[i>>0]),k=g):(is[127&ar[40+(0|ar[g>>2])>>2]](g),k=g)}Ul(b,(0|ar[y>>2])-A|0,0),p=(0|tr[a>>0])<0?0|ar[b>>2]:b,y=0|hf(),ar[u>>2]=n,1!=(0|wf(p,y,47007,u))&&(ar[f>>2]=4),i=g?0|Ji(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[h>>2])>>2]](g):0|bi(0|tr[A>>0]),-1)?(ar[e>>2]=0,1):0:1;do{if(k){if(0|Ji(A=(0|(A=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,Z=49;break}if(i)break;Z=51;break}Z=49}while(0);return 49==(0|Z)&&i&&(Z=51),51==(0|Z)&&(ar[f>>2]=2|ar[f>>2]),Z=0|ar[e>>2],Yl(b),Yl(s),ur=d,0|Z},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c=0,l=0,u=0,s=0;if(u=ur=(a=ur)+31&-32,ur=ur+48|0,c=u+40|0,s=u+16|0,t=u+8|0,o=u+12|0,l=u+4|0,1&ar[(i|=0)+4>>2])for(Di(c,i),l=0|bf(c,52568),df(c),Di(c,i),A=0|bf(c,52576),df(c),ks[63&ar[24+(0|ar[A>>2])>>2]](s,A),ks[63&ar[28+(0|ar[A>>2])>>2]](s+12|0,A),ar[u>>2]=ar[r>>2],A=s+24|0,ar[c>>2]=ar[u>>2],c=(0|Df(e,c,s,A,l,f,1))==(0|s)&1,tr[n>>0]=c,c=0|ar[e>>2];Pl(A=A+-12|0),(0|A)!=(0|s););else{switch(ar[t>>2]=-1,u=0|ar[16+(0|ar[A>>2])>>2],ar[o>>2]=ar[e>>2],ar[l>>2]=ar[r>>2],ar[s>>2]=ar[o>>2],ar[c>>2]=ar[l>>2],s=0|ls[63&u](A,s,c,i,f,t),ar[e>>2]=s,0|ar[t>>2]){case 0:tr[n>>0]=0;break;case 1:tr[n>>0]=1;break;default:tr[n>>0]=1,ar[f>>2]=4}c=0|ar[e>>2]}return ur=a,0|c},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+304|0,c=Z+200|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),Jf(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|Nf(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|wi(0|ar[i>>2]),b,A,l,Z,0|ar[y>>2],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+4,wi(0|ar[i>>2]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|_f(A,0|ar[l>>2],f,b),ar[n>>2]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Qi(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+304|0,c=Z+200|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),Jf(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|Nf(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|wi(0|ar[i>>2]),b,A,l,Z,0|ar[y>>2],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+4,wi(0|ar[i>>2]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Xf(A,0|ar[l>>2],f,b),ar[n>>2]=C,ar[n+4>>2]=D,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Qi(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+304|0,c=Z+200|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),Jf(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|Nf(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|wi(0|ar[i>>2]),b,A,l,Z,0|ar[y>>2],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+4,wi(0|ar[i>>2]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Vf(A,0|ar[l>>2],f,b),or[n>>1]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Qi(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+304|0,c=Z+200|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),Jf(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|Nf(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|wi(0|ar[i>>2]),b,A,l,Z,0|ar[y>>2],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+4,wi(0|ar[i>>2]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Gf(A,0|ar[l>>2],f,b),ar[n>>2]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Qi(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+304|0,c=Z+200|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),Jf(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|Nf(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|wi(0|ar[i>>2]),b,A,l,Z,0|ar[y>>2],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+4,wi(0|ar[i>>2]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Ef(A,0|ar[l>>2],f,b),ar[n>>2]=C,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Qi(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0;Z=ur=(h=ur)+31&-32,ur=ur+304|0,c=Z+200|0,y=Z+196|0,d=Z+184|0,k=Z+172|0,l=Z+168|0,u=Z+8|0,s=Z+4|0,b=0|Wf(i|=0),Jf(d,i,c,y),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A,ar[s>>2]=u,ar[Z>>2]=0,t=4+k|0,v=0|ar[e>>2],w=v;A:for(;;){g=w?0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,v=p=0,1):(p=w,0):(v=p=0,1),w=0|ar[r>>2];do{if(w){if(0|Qi(i=(0|(i=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,W=19;break}if(g)break;break A}W=19}while(0);if(19==(0|W)){if(W=0,g){w=0;break}w=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[l>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[l>>2]=A+i),0|Nf(i=(0|(i=0|ar[(g=p+12|0)>>2]))==(0|ar[(m=p+16|0)>>2])?0|is[127&ar[36+(0|ar[p>>2])>>2]](p):0|wi(0|ar[i>>2]),b,A,l,Z,0|ar[y>>2],d,u,s,c))break;(0|(i=0|ar[g>>2]))!=(0|ar[m>>2])?(ar[g>>2]=i+4,wi(0|ar[i>>2]),w=p):(is[127&ar[40+(0|ar[p>>2])>>2]](p),w=p)}0|((y=0|tr[11+d>>0])<<24>>24<0?0|ar[4+d>>2]:255&y)&&((C=0|ar[s>>2])-u|0)<160&&(Z=0|ar[Z>>2],ar[s>>2]=C+4,ar[C>>2]=Z);C=0|Bf(A,0|ar[l>>2],f,b),ar[n>>2]=C,ar[n+4>>2]=D,yf(d,u,0|ar[s>>2],f),i=p?(A=(0|(A=0|ar[p+12>>2]))==(0|ar[p+16>>2])?0|is[127&ar[36+(0|ar[v>>2])>>2]](p):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(w){if(0|Qi(A=(0|(A=0|ar[w+12>>2]))==(0|ar[w+16>>2])?0|is[127&ar[36+(0|ar[w>>2])>>2]](w):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,W=47;break}if(i)break;W=49;break}W=47}while(0);47==(0|W)&&i&&(W=49);49==(0|W)&&(ar[f>>2]=2|ar[f>>2]);return W=0|ar[e>>2],Yl(k),Yl(d),ur=h,0|W}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;C=ur=(w=ur)+31&-32,ur=ur+352|0,c=C+208|0,l=C+200|0,W=C+196|0,h=C+184|0,k=C+172|0,u=C+168|0,s=C+8|0,b=C+4|0,I=(d=C)+337|0,C=C+336|0,Rf(h,i|=0,c,l,W),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A,ar[b>>2]=s,ar[d>>2]=0,tr[I>>0]=1,tr[C>>0]=69,t=4+k|0,m=0|ar[e>>2],g=m;A:for(;;){p=g?0|Qi(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,m=Z=0,1):(Z=g,0):(m=Z=0,1),g=0|ar[r>>2];do{if(g){if(0|Qi(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,E=19;break}if(p)break;break A}E=19}while(0);if(19==(0|E)){if(E=0,p){g=0;break}g=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[u>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A+i),0|Yf(i=(0|(i=0|ar[(p=Z+12|0)>>2]))==(0|ar[(y=Z+16|0)>>2])?0|is[127&ar[36+(0|ar[Z>>2])>>2]](Z):0|wi(0|ar[i>>2]),I,C,A,u,0|ar[l>>2],0|ar[W>>2],h,s,b,d,c))break;(0|(i=0|ar[p>>2]))!=(0|ar[y>>2])?(ar[p>>2]=i+4,wi(0|ar[i>>2]),g=Z):(is[127&ar[40+(0|ar[Z>>2])>>2]](Z),g=Z)}W=0|tr[11+h>>0],0!=(0|tr[I>>0])&&0!=(0|(W<<24>>24<0?0|ar[4+h>>2]:255&W))&&((B=0|ar[b>>2])-s|0)<160&&(I=0|ar[d>>2],ar[b>>2]=B+4,ar[B>>2]=I);v=+Cf(A,0|ar[u>>2],f),Y[n>>2]=v,yf(h,s,0|ar[b>>2],f),i=Z?(A=(0|(A=0|ar[Z+12>>2]))==(0|ar[Z+16>>2])?0|is[127&ar[36+(0|ar[m>>2])>>2]](Z):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(g){if(0|Qi(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,E=47;break}if(i)break;E=49;break}E=47}while(0);47==(0|E)&&i&&(E=49);49==(0|E)&&(ar[f>>2]=2|ar[f>>2]);return E=0|ar[e>>2],Yl(k),Yl(h),ur=w,0|E}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;C=ur=(w=ur)+31&-32,ur=ur+352|0,c=C+208|0,l=C+200|0,W=C+196|0,h=C+184|0,k=C+172|0,u=C+168|0,s=C+8|0,b=C+4|0,I=(d=C)+337|0,C=C+336|0,Rf(h,i|=0,c,l,W),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A,ar[b>>2]=s,ar[d>>2]=0,tr[I>>0]=1,tr[C>>0]=69,t=4+k|0,m=0|ar[e>>2],g=m;A:for(;;){p=g?0|Qi(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,m=Z=0,1):(Z=g,0):(m=Z=0,1),g=0|ar[r>>2];do{if(g){if(0|Qi(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,E=19;break}if(p)break;break A}E=19}while(0);if(19==(0|E)){if(E=0,p){g=0;break}g=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[u>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A+i),0|Yf(i=(0|(i=0|ar[(p=Z+12|0)>>2]))==(0|ar[(y=Z+16|0)>>2])?0|is[127&ar[36+(0|ar[Z>>2])>>2]](Z):0|wi(0|ar[i>>2]),I,C,A,u,0|ar[l>>2],0|ar[W>>2],h,s,b,d,c))break;(0|(i=0|ar[p>>2]))!=(0|ar[y>>2])?(ar[p>>2]=i+4,wi(0|ar[i>>2]),g=Z):(is[127&ar[40+(0|ar[Z>>2])>>2]](Z),g=Z)}W=0|tr[11+h>>0],0!=(0|tr[I>>0])&&0!=(0|(W<<24>>24<0?0|ar[4+h>>2]:255&W))&&((B=0|ar[b>>2])-s|0)<160&&(I=0|ar[d>>2],ar[b>>2]=B+4,ar[B>>2]=I);v=+Zf(A,0|ar[u>>2],f),J[n>>3]=v,yf(h,s,0|ar[b>>2],f),i=Z?(A=(0|(A=0|ar[Z+12>>2]))==(0|ar[Z+16>>2])?0|is[127&ar[36+(0|ar[m>>2])>>2]](Z):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(g){if(0|Qi(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,E=47;break}if(i)break;E=49;break}E=47}while(0);47==(0|E)&&i&&(E=49);49==(0|E)&&(ar[f>>2]=2|ar[f>>2]);return E=0|ar[e>>2],Yl(k),Yl(h),ur=w,0|E}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0;C=ur=(w=ur)+31&-32,ur=ur+352|0,c=C+208|0,l=C+200|0,W=C+196|0,h=C+184|0,k=C+172|0,u=C+168|0,s=C+8|0,b=C+4|0,I=(d=C)+337|0,C=C+336|0,Rf(h,i|=0,c,l,W),ar[k>>2]=0,ar[4+k>>2]=0,ar[8+k>>2]=0,A=0;for(;3!=(0|A);)ar[k+(A<<2)>>2]=0,A=A+1|0;a=8+k|0,A=(0|tr[(o=11+k|0)>>0])<0?(2147483647&ar[a>>2])-1|0:10;Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A,ar[b>>2]=s,ar[d>>2]=0,tr[I>>0]=1,tr[C>>0]=69,t=4+k|0,m=0|ar[e>>2],g=m;A:for(;;){p=g?0|Qi(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),-1)?(ar[e>>2]=0,m=Z=0,1):(Z=g,0):(m=Z=0,1),g=0|ar[r>>2];do{if(g){if(0|Qi(i=(0|(i=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,E=19;break}if(p)break;break A}E=19}while(0);if(19==(0|E)){if(E=0,p){g=0;break}g=0}if(i=(i=0|tr[o>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[u>>2])==(A+i|0)&&(Ul(k,i<<1,0),A=(0|tr[o>>0])<0?(2147483647&ar[a>>2])-1|0:10,Ul(k,A,0),A=(0|tr[o>>0])<0?0|ar[k>>2]:k,ar[u>>2]=A+i),0|Yf(i=(0|(i=0|ar[(p=Z+12|0)>>2]))==(0|ar[(y=Z+16|0)>>2])?0|is[127&ar[36+(0|ar[Z>>2])>>2]](Z):0|wi(0|ar[i>>2]),I,C,A,u,0|ar[l>>2],0|ar[W>>2],h,s,b,d,c))break;(0|(i=0|ar[p>>2]))!=(0|ar[y>>2])?(ar[p>>2]=i+4,wi(0|ar[i>>2]),g=Z):(is[127&ar[40+(0|ar[Z>>2])>>2]](Z),g=Z)}W=0|tr[11+h>>0],0!=(0|tr[I>>0])&&0!=(0|(W<<24>>24<0?0|ar[4+h>>2]:255&W))&&((B=0|ar[b>>2])-s|0)<160&&(I=0|ar[d>>2],ar[b>>2]=B+4,ar[B>>2]=I);v=+pf(A,0|ar[u>>2],f),J[n>>3]=v,yf(h,s,0|ar[b>>2],f),i=Z?(A=(0|(A=0|ar[Z+12>>2]))==(0|ar[Z+16>>2])?0|is[127&ar[36+(0|ar[m>>2])>>2]](Z):0|wi(0|ar[A>>2]),0|Qi(A,-1)?(ar[e>>2]=0,1):0):1;do{if(g){if(0|Qi(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,E=47;break}if(i)break;E=49;break}E=47}while(0);47==(0|E)&&i&&(E=49);49==(0|E)&&(ar[f>>2]=2|ar[f>>2]);return E=0|ar[e>>2],Yl(k),Yl(h),ur=w,0|E}(A,a,o,i,f,n),ur=t,0|n},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0;for(m=ur=(d=ur)+31&-32,ur=ur+320|0,p=(u=m)+208|0,s=m+192|0,b=m+180|0,y=m+176|0,c=m+16|0,l=m+8|0,m=m+4|0,ar[s>>2]=0,ar[4+s>>2]=0,A=ar[8+s>>2]=0;3!=(0|A);)A=A+1|(ar[s+(A<<2)>>2]=0);for(Di(b,i),A=0|bf(b,52568),ts[15&ar[48+(0|ar[A>>2])>>2]](A,46974,47e3,p),df(b),ar[b>>2]=0,ar[4+b>>2]=0,A=ar[8+b>>2]=0;3!=(0|A);)A=A+1|(ar[b+(A<<2)>>2]=0);o=8+b|0,Ul(b,A=(0|tr[(a=11+b|0)>>0])<0?(2147483647&ar[o>>2])-1|0:10,0),A=(0|tr[a>>0])<0?0|ar[b>>2]:b,ar[y>>2]=A,ar[l>>2]=c,t=4+b|(ar[m>>2]=0),k=h=0|ar[e>>2];A:for(;;){w=k?0|Qi(i=(0|(i=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|wi(0|ar[i>>2]),-1)?(h=g=ar[e>>2]=0,1):(g=k,0):(h=g=0,1),k=0|ar[r>>2];do{if(k){if(0|Qi(i=(0|(i=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,Z=22;break}if(w)break;break A}Z=22}while(0);if(22==(0|Z)){if(Z=0,w){k=0;break}k=0}if(i=(i=0|tr[a>>0])<<24>>24<0?0|ar[t>>2]:255&i,(0|ar[y>>2])==(A+i|0)&&(Ul(b,i<<1,0),Ul(b,A=(0|tr[a>>0])<0?(2147483647&ar[o>>2])-1|0:10,0),A=(0|tr[a>>0])<0?0|ar[b>>2]:b,ar[y>>2]=A+i),0|Nf(i=(0|(i=0|ar[(w=g+12|0)>>2]))==(0|ar[(v=g+16|0)>>2])?0|is[127&ar[36+(0|ar[g>>2])>>2]](g):0|wi(0|ar[i>>2]),16,A,y,m,0,s,c,l,p))break;(0|(i=0|ar[w>>2]))!=(0|ar[v>>2])?(ar[w>>2]=i+4,wi(0|ar[i>>2]),k=g):(is[127&ar[40+(0|ar[g>>2])>>2]](g),k=g)}Ul(b,(0|ar[y>>2])-A|0,0),p=(0|tr[a>>0])<0?0|ar[b>>2]:b,y=0|hf(),ar[u>>2]=n,1!=(0|wf(p,y,47007,u))&&(ar[f>>2]=4),i=g?0|Qi(A=(0|(A=0|ar[g+12>>2]))==(0|ar[g+16>>2])?0|is[127&ar[36+(0|ar[h>>2])>>2]](g):0|wi(0|ar[A>>2]),-1)?(ar[e>>2]=0,1):0:1;do{if(k){if(0|Qi(A=(0|(A=0|ar[k+12>>2]))==(0|ar[k+16>>2])?0|is[127&ar[36+(0|ar[k>>2])>>2]](k):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,Z=49;break}if(i)break;Z=51;break}Z=49}while(0);return 49==(0|Z)&&i&&(Z=51),51==(0|Z)&&(ar[f>>2]=2|ar[f>>2]),Z=0|ar[e>>2],Yl(b),Yl(s),ur=d,0|Z},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b=0,d=0;return b=ur=(A=ur)+31&-32,ur=ur+96|0,o=b+8|0,l=(u=b)+71|0,t=b+28|0,c=b+24|0,a=b+16|0,b=b+20|0,ar[(d=u)>>2]=37,XA(u+1|(ar[d+4>>2]=0),47225,1,0|ar[r+4>>2]),d=0|hf(),ar[(s=o)>>2]=f,ar[4+s>>2]=n,n=0|Tf(l,f=l+(0|Qf(l,23,d,u,o))|0,r),Di(o,r),_A(l,n,f,t,c,a,o),df(o),ar[b>>2]=ar[e>>2],f=0|ar[c>>2],n=0|ar[a>>2],ar[o>>2]=ar[b>>2],n=0|zf(o,t,f,n,r,i),ur=A,0|n},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b=0,d=0;return b=ur=(A=ur)+31&-32,ur=ur+96|0,o=b+8|0,l=(u=b)+71|0,t=b+28|0,c=b+24|0,a=b+16|0,b=b+20|0,ar[(d=u)>>2]=37,XA(u+1|(ar[d+4>>2]=0),47225,0,0|ar[r+4>>2]),d=0|hf(),ar[(s=o)>>2]=f,ar[4+s>>2]=n,n=0|Tf(l,f=l+(0|Qf(l,23,d,u,o))|0,r),Di(o,r),_A(l,n,f,t,c,a,o),df(o),ar[b>>2]=ar[e>>2],f=0|ar[c>>2],n=0|ar[a>>2],ar[o>>2]=ar[b>>2],n=0|zf(o,t,f,n,r,i),ur=A,0|n},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b=0,d=0;return b=ur=(A=ur)+31&-32,ur=ur+224|0,o=b+8|0,l=(u=b)+200|0,t=b+28|0,c=b+24|0,a=b+16|0,b=b+20|0,ar[(d=u)>>2]=37,XA(u+1|(ar[d+4>>2]=0),47225,1,0|ar[r+4>>2]),d=0|hf(),ar[(s=o)>>2]=f,ar[4+s>>2]=n,n=0|Tf(l,f=l+(0|Qf(l,23,d,u,o))|0,r),Di(o,r),YA(l,n,f,t,c,a,o),df(o),ar[b>>2]=ar[e>>2],f=0|ar[c>>2],n=0|ar[a>>2],ar[o>>2]=ar[b>>2],n=0|FA(o,t,f,n,r,i),ur=A,0|n},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b=0,d=0;return b=ur=(A=ur)+31&-32,ur=ur+224|0,o=b+8|0,l=(u=b)+200|0,t=b+28|0,c=b+24|0,a=b+16|0,b=b+20|0,ar[(d=u)>>2]=37,XA(u+1|(ar[d+4>>2]=0),47225,0,0|ar[r+4>>2]),d=0|hf(),ar[(s=o)>>2]=f,ar[4+s>>2]=n,n=0|Tf(l,f=l+(0|Qf(l,23,d,u,o))|0,r),Di(o,r),YA(l,n,f,t,c,a,o),df(o),ar[b>>2]=ar[e>>2],f=0|ar[c>>2],n=0|ar[a>>2],ar[o>>2]=ar[b>>2],n=0|FA(o,t,f,n,r,i),ur=A,0|n},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|QA(A,a,o,i,f,n,47753,47761),ur=t,0|n},function(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s=0;return c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,l=4+c|0,s=0|is[127&ar[20+(0|ar[(s=(A|=0)+8|0)>>2])>>2]](s),ar[l>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],r=(e=(u=(r=0|tr[s+11>>0])<<24>>24<0)?0|ar[s>>2]:s)+(u?0|ar[s+4>>2]:255&r)|0,ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|QA(A,a,o,i,f,n,e,r),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a;return A|=0,e|=0,r|=0,f|=0,n|=0,a=ur=(t=ur)+31&-32,ur=ur+16|0,Di(o=4+a|0,i|=0),i=0|bf(o,52536),df(o),ar[a>>2]=ar[r>>2],ar[o>>2]=ar[a>>2],JA(A,n+24|0,e,o,f,i),ur=t,0|ar[e>>2]},function(A,e,r,i,f,n){var t,o,a;return A|=0,e|=0,r|=0,f|=0,n|=0,a=ur=(t=ur)+31&-32,ur=ur+16|0,Di(o=4+a|0,i|=0),i=0|bf(o,52536),df(o),ar[a>>2]=ar[r>>2],ar[o>>2]=ar[a>>2],DA(A,n+16|0,e,o,f,i),ur=t,0|ar[e>>2]},function(A,e,r,i,f,n){var t,o,a;return A|=0,e|=0,r|=0,f|=0,n|=0,a=ur=(t=ur)+31&-32,ur=ur+16|0,Di(o=4+a|0,i|=0),i=0|bf(o,52536),df(o),ar[a>>2]=ar[r>>2],ar[o>>2]=ar[a>>2],LA(A,n+20|0,e,o,f,i),ur=t,0|ar[e>>2]},function(A,e,r,i,f,n){var t,o,a,c,l;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,ar[(l=4+c|0)>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|ie(A,a,o,i,f,n,14748,14780),ur=t,0|n},function(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s=0;return c=ur=(t=ur)+31&-32,ur=ur+16|0,o=12+c|0,a=8+c|0,l=4+c|0,s=0|is[127&ar[20+(0|ar[(s=(A|=0)+8|0)>>2])>>2]](s),ar[l>>2]=ar[e>>2],ar[c>>2]=ar[r>>2],r=(e=(u=(r=0|tr[s+8+3>>0])<<24>>24<0)?0|ar[s>>2]:s)+((u?0|ar[s+4>>2]:255&r)<<2)|0,ar[a>>2]=ar[l>>2],ar[o>>2]=ar[c>>2],n=0|ie(A,a,o,i,f,n,e,r),ur=t,0|n},function(A,e,r,i,f,n){var t,o,a;return A|=0,e|=0,r|=0,f|=0,n|=0,a=ur=(t=ur)+31&-32,ur=ur+16|0,Di(o=4+a|0,i|=0),i=0|bf(o,52568),df(o),ar[a>>2]=ar[r>>2],ar[o>>2]=ar[a>>2],ee(A,n+24|0,e,o,f,i),ur=t,0|ar[e>>2]},function(A,e,r,i,f,n){var t,o,a;return A|=0,e|=0,r|=0,f|=0,n|=0,a=ur=(t=ur)+31&-32,ur=ur+16|0,Di(o=4+a|0,i|=0),i=0|bf(o,52568),df(o),ar[a>>2]=ar[r>>2],ar[o>>2]=ar[a>>2],re(A,n+16|0,e,o,f,i),ur=t,0|ar[e>>2]},function(A,e,r,i,f,n){var t,o,a;return A|=0,e|=0,r|=0,f|=0,n|=0,a=ur=(t=ur)+31&-32,ur=ur+16|0,Di(o=4+a|0,i|=0),i=0|bf(o,52568),df(o),ar[a>>2]=ar[r>>2],ar[o>>2]=ar[a>>2],de(A,n+20|0,e,o,f,i),ur=t,0|ar[e>>2]},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y=0,Z=0,C=0,W=0,I=0,B=0;for(s=ur=(p=ur)+31&-32,ur=ur+176|0,c=56+s|0,d=164+s|0,k=161+s|0,h=160+s|0,w=40+s|0,v=28+s|0,g=16+s|0,t=12+s|0,a=60+s|0,l=8+s|0,u=4+s|0,Di(m=52+s|0,i|=0),b=0|bf(m,52536),Z=n+4|0,W=0|((A=(W=0|tr[(y=n+11|0)>>0])<<24>>24<0)?0|ar[Z>>2]:255&W)?(W=0|tr[(A?0|ar[n>>2]:n)>>0])<<24>>24==(0|fs[63&ar[28+(0|ar[b>>2])>>2]](b,45))<<24>>24:0,ar[w>>2]=0,ar[4+w>>2]=0,A=ar[8+w>>2]=0;3!=(0|A);)A=A+1|(ar[w+(A<<2)>>2]=0);for(ar[v>>2]=0,ar[4+v>>2]=0,A=ar[8+v>>2]=0;3!=(0|A);)A=A+1|(ar[v+(A<<2)>>2]=0);for(ar[g>>2]=0,ar[4+g>>2]=0,A=ar[8+g>>2]=0;3!=(0|A);)A=A+1|(ar[g+(A<<2)>>2]=0);return Ge(r,W,m,d,k,h,w,v,g,t),C=(o=(C=0|tr[y>>0])<<24>>24<0)?0|ar[Z>>2]:255&C,100<(A=(r=(0|(Z=0|ar[t>>2]))<(0|C)?(y=0|tr[11+g>>0],r=0|tr[11+v>>0],A=1,y=(y<<24>>24<0?0|ar[4+g>>2]:255&y)+(C-Z<<1)|0,r<<24>>24<0?0|ar[4+v>>2]:255&r):(r=0|tr[11+g>>0],A=2,y=(y=0|tr[11+v>>0])<<24>>24<0?0|ar[4+v>>2]:255&y,r<<24>>24<0?0|ar[4+g>>2]:255&r))+Z+y+A|0)>>>0?(A=0|qo(A))?B=I=A:_l():(I=a,B=0),n=o?0|ar[n>>2]:n,Ve(I,l,u,0|ar[i+4>>2],n,n+C|0,b,W,d,0|tr[k>>0],0|tr[h>>0],w,v,g,Z),ar[s>>2]=ar[e>>2],n=0|ar[l>>2],A=0|ar[u>>2],ar[c>>2]=ar[s>>2],A=0|zf(c,I,n,A,i,f),0|B&&$o(B),Yl(g),Yl(v),Yl(w),df(m),ur=p,0|A},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,f|=0,n|=0;var t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y=0,Z=0,C=0,W=0,I=0,B=0;for(s=ur=(p=ur)+31&-32,ur=ur+480|0,c=468+s|0,d=472+s|0,k=460+s|0,h=456+s|0,w=444+s|0,v=432+s|0,g=420+s|0,t=416+s|0,a=16+s|0,l=8+s|0,u=4+s|0,Di(m=464+s|0,i|=0),b=0|bf(m,52568),Z=n+4|0,W=0|((A=(W=0|tr[(y=n+8+3|0)>>0])<<24>>24<0)?0|ar[Z>>2]:255&W)?(0|(W=0|ar[(A?0|ar[n>>2]:n)>>2]))==(0|fs[63&ar[44+(0|ar[b>>2])>>2]](b,45)):0,ar[w>>2]=0,ar[4+w>>2]=0,A=ar[8+w>>2]=0;3!=(0|A);)A=A+1|(ar[w+(A<<2)>>2]=0);for(ar[v>>2]=0,ar[4+v>>2]=0,A=ar[8+v>>2]=0;3!=(0|A);)A=A+1|(ar[v+(A<<2)>>2]=0);for(ar[g>>2]=0,ar[4+g>>2]=0,A=ar[8+g>>2]=0;3!=(0|A);)A=A+1|(ar[g+(A<<2)>>2]=0);return Xe(r,W,m,d,k,h,w,v,g,t),C=(o=(C=0|tr[y>>0])<<24>>24<0)?0|ar[Z>>2]:255&C,100<(A=(r=(0|(Z=0|ar[t>>2]))<(0|C)?(y=0|tr[8+g+3>>0],r=0|tr[8+v+3>>0],A=1,y=(y<<24>>24<0?0|ar[4+g>>2]:255&y)+(C-Z<<1)|0,r<<24>>24<0?0|ar[4+v>>2]:255&r):(r=0|tr[8+g+3>>0],A=2,y=(y=0|tr[8+v+3>>0])<<24>>24<0?0|ar[4+v>>2]:255&y,r<<24>>24<0?0|ar[4+g>>2]:255&r))+Z+y+A|0)>>>0?(A=0|qo(A<<2))?B=I=A:_l():(I=a,B=0),n=o?0|ar[n>>2]:n,_e(I,l,u,0|ar[i+4>>2],n,n+(C<<2)|0,b,W,d,0|ar[k>>2],0|ar[h>>2],w,v,g,Z),ar[s>>2]=ar[e>>2],n=0|ar[l>>2],A=0|ar[u>>2],ar[c>>2]=ar[s>>2],A=0|FA(c,I,n,A,i,f),0|B&&$o(B),Pl(g),Pl(v),Yl(w),df(m),ur=p,0|A},Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu,Uu],us=[Ou,function(A,e,r,i,f,n,t){var o;for(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,i=ur=(o=ur)+31&-32,ur=ur+112|0,r=i+4|0,ar[i>>2]=r+100,ve(A+8|0,r,i,f,n,t),t=0|ar[i>>2],n=r,r=0|ar[e>>2];(0|n)!=(0|t);)i=0|tr[n>>0],r=!r||(e=0|Ji(i=(0|(f=0|ar[(A=r+24|0)>>2]))==(0|ar[r+28>>2])?(e=0|ar[52+(0|ar[r>>2])>>2],i=0|bi(i),0|fs[63&e](r,i)):(ar[A>>2]=f+1,0|bi(tr[f>>0]=i)),-1))?0:r,n=n+1|0;return ur=o,0|r},function(A,e,r,i,f,n,t){var o;for(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,i=ur=(o=ur)+31&-32,ur=ur+416|0,r=i+8|0,ar[i>>2]=r+400,function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l=0;l=ur=(t=ur)+31&-32,ur=ur+128|0,a=l+16|0,c=l+12|0,l=(o=l)+8|0,ar[c>>2]=100+a,ve(A,a,c,i,f,n),ar[(i=o)>>2]=0,ar[i+4>>2]=0,ar[l>>2]=a,i=0|function(A,e){return(e|=0)-(A|=0)>>2|0}(e,0|ar[r>>2]),A=0|Ai(0|ar[A>>2]),i=0|Oa(e,l,i,o),0|A&&Ai(A);{if(-1!=(0|i))return ar[r>>2]=e+(i<<2),ur=t;me()}}(A+8|0,r,i,f,n,t),t=0|ar[i>>2],n=r,r=0|ar[e>>2];(0|n)!=(0|t);)i=0|ar[n>>2],r=!r||(e=0|Qi(i=(0|(f=0|ar[(A=r+24|0)>>2]))==(0|ar[r+28>>2])?(e=0|ar[52+(0|ar[r>>2])>>2],i=0|wi(i),0|fs[63&e](r,i)):(ar[A>>2]=f+4,0|wi(ar[f>>2]=i)),-1))?0:r,n=n+4|0;return ur=o,0|r},function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0;var o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0;if(g=ur=(b=ur)+31&-32,ur=ur+240|0,o=g+24|0,v=(c=g)+140|0,s=g+16|0,a=g+12|0,l=g+8|0,k=g+136|0,d=g+4|0,g=g+36|0,ar[s>>2]=v,ar[(u=4+s|0)>>2]=309,Di(l,f),A=0|bf(l,52536),tr[k>>0]=0,ar[d>>2]=ar[r>>2],w=0|ar[f+4>>2],ar[o>>2]=ar[d>>2],0|ye(e,o,i,l,w,n,k,A,s,a,v+100|0)){for(ts[15&ar[32+(0|ar[A>>2])>>2]](A,48278,48288,o),98<(0|(A=(w=0|ar[a>>2])-(i=0|ar[s>>2])|0))?(A=0|qo(A+2|0))?m=h=A:_l():(h=g,m=0),A=0|tr[k>>0]?(tr[h>>0]=45,h+1|0):h,h=10+o|0,v=o,k=i,f=A,A=w;!(A>>>0<=k>>>0);){for(i=0|tr[k>>0],A=o;;){if((0|A)==(0|h)){A=h;break}if((0|tr[A>>0])==i<<24>>24)break;A=A+1|0}tr[f>>0]=0|tr[A-v+48278>>0],k=k+1|0,f=f+1|0,A=0|ar[a>>2]}tr[f>>0]=0,ar[c>>2]=t,1!=(0|xr(g,48289,c))&&me(),0|m&&$o(m)}A=0|ar[e>>2];do{if(A){if(0|Ji(A=(0|(i=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[i>>0]),-1)){ar[e>>2]=0,f=1;break}f=0==(0|ar[e>>2]);break}f=1}while(0);A=0|ar[r>>2];do{if(A){if(0|Ji(A=(0|(i=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[i>>0]),-1)){ar[r>>2]=0,p=32;break}if(f)break;p=34;break}p=32}while(0);return 32==(0|p)&&f&&(p=34),34==(0|p)&&(ar[n>>2]=2|ar[n>>2]),i=0|ar[e>>2],df(l),A=0|ar[s>>2],(ar[s>>2]=0)|A&&ds[511&ar[u>>2]](A),ur=b,0|i},function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0;var o,a,c,l,u,s,b,d=0,k=0,h=0,w=0;if(h=ur=(b=ur)+31&-32,ur=ur+144|0,d=h+24|0,A=h+32|0,s=h+16|0,a=h+8|0,k=(l=h)+28|0,h=h+4|0,ar[s>>2]=A,ar[(u=4+s|0)>>2]=309,Di(l,f),o=0|bf(l,52536),c=(tr[k>>0]=0)|ar[r>>2],ar[h>>2]=c,f=0|ar[f+4>>2],ar[d>>2]=ar[h>>2],h=c,0|ye(e,d,i,l,f,n,k,o,s,a,A+100|0)){for((0|tr[(A=t+11|0)>>0])<0?(i=0|ar[t>>2],tr[d>>0]=0,Ni(i,d),ar[t+4>>2]=0):(tr[d>>0]=0,Ni(t,d),tr[A>>0]=0),0|tr[k>>0]&&jl(t,0|fs[63&ar[28+(0|ar[o>>2])>>2]](o,45)),k=0|fs[63&ar[28+(0|ar[o>>2])>>2]](o,48),d=(f=0|ar[a>>2])+-1|0,A=0|ar[s>>2];!(d>>>0<=A>>>0)&&(0|tr[A>>0])==k<<24>>24;)A=A+1|0;!function(A,e,r){r|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;c=ur=(n=ur)+31&-32,ur=ur+16|0,i=e|=0,b=c+12|0,o=0|tr[(s=11+(A|=0)|0)>>0],l=(t=o<<24>>24<0)?(u=0|ar[A+4>>2],(2147483647&ar[A+8>>2])-1|0):(u=255&o,10);f=r-i|0;do{if(0|f){if(t?(o=0|ar[A>>2],a=o,t=0|ar[A+4>>2]):(t=255&o,o=a=A),0|Ze(e,o,a+t|0)){for(ar[c>>2]=0,ar[c+4>>2]=0,ar[c+8>>2]=0,4294967279<f>>>0&&Nl(),f>>>0<11?(tr[c+11>>0]=f,o=c):(o=0|El(s=16+f&-16),ar[c>>2]=o,ar[c+8>>2]=-2147483648|s,ar[c+4>>2]=f),t=o;(0|e)!=(0|r);)Ni(t,e),e=e+1|0,t=t+1|0;tr[b>>0]=0,Ni(o+f|0,b),b=0|tr[c+11>>0],xl(A,(r=b<<24>>24<0)?0|ar[c>>2]:c,r?0|ar[c+4>>2]:255&b),Yl(c);break}for(c=u+f|0,(l-u|0)>>>0<f>>>0&&Hl(A,l,c-l|0,u,u,0,0),a=(0|tr[s>>0])<0?0|ar[A>>2]:A,o=r+(u-i)|0,t=a+u|0;(0|e)!=(0|r);)Ni(t,e),t=t+1|0,e=e+1|0;if(tr[b>>0]=0,Ni(a+o|0,b),(0|tr[s>>0])<0){ar[A+4>>2]=c;break}tr[s>>0]=c;break}}while(0);ur=n}(t,A,f)}A=0|ar[e>>2];do{if(A){if(0|Ji(A=(0|(f=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|bi(0|tr[f>>0]),-1)){ar[e>>2]=0,f=1;break}f=0==(0|ar[e>>2]);break}f=1}while(0);do{if(c){if(0|Ji(A=(0|(A=0|ar[h+12>>2]))==(0|ar[h+16>>2])?0|is[127&ar[36+(0|ar[c>>2])>>2]](h):0|bi(0|tr[A>>0]),-1)){ar[r>>2]=0,w=25;break}if(f)break;w=27;break}w=25}while(0);return 25==(0|w)&&f&&(w=27),27==(0|w)&&(ar[n>>2]=2|ar[n>>2]),f=0|ar[e>>2],df(l),A=0|ar[s>>2],(ar[s>>2]=0)|A&&ds[511&ar[u>>2]](A),ur=b,0|f},function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0;var o,a,c,l,u,s,b,d,k=0,h=0,w=0,v=0,g=0,m=0,p=0;if(g=ur=(b=ur)+31&-32,ur=ur+576|0,o=g+424|0,v=(c=g)+24|0,s=g+16|0,a=g+12|0,l=g+8|0,k=g+564|0,d=g+4|0,g=g+464|0,ar[s>>2]=v,ar[(u=4+s|0)>>2]=309,Di(l,f),A=0|bf(l,52568),tr[k>>0]=0,ar[d>>2]=ar[r>>2],w=0|ar[f+4>>2],ar[o>>2]=ar[d>>2],0|Ie(e,o,i,l,w,n,k,A,s,a,v+400|0)){for(ts[15&ar[48+(0|ar[A>>2])>>2]](A,48388,48398,o),392<(0|(A=(w=0|ar[a>>2])-(i=0|ar[s>>2])|0))?(A=0|qo(2+(A>>>2)|0))?m=h=A:_l():(h=g,m=0),A=0|tr[k>>0]?(tr[h>>0]=45,h+1|0):h,h=40+o|0,v=o,k=i,f=A,A=w;!(A>>>0<=k>>>0);){for(i=0|ar[k>>2],A=o;;){if((0|A)==(0|h)){A=h;break}if((0|ar[A>>2])==(0|i))break;A=A+4|0}tr[f>>0]=0|tr[48388+(A-v>>2)>>0],k=k+4|0,f=f+1|0,A=0|ar[a>>2]}tr[f>>0]=0,ar[c>>2]=t,1!=(0|xr(g,48289,c))&&me(),0|m&&$o(m)}A=0|ar[e>>2];do{if(A){if(0|Qi(A=(0|(i=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[i>>2]),-1)){ar[e>>2]=0,f=1;break}f=0==(0|ar[e>>2]);break}f=1}while(0);A=0|ar[r>>2];do{if(A){if(0|Qi(A=(0|(i=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[i>>2]),-1)){ar[r>>2]=0,p=32;break}if(f)break;p=34;break}p=32}while(0);return 32==(0|p)&&f&&(p=34),34==(0|p)&&(ar[n>>2]=2|ar[n>>2]),i=0|ar[e>>2],df(l),A=0|ar[s>>2],(ar[s>>2]=0)|A&&ds[511&ar[u>>2]](A),ur=b,0|i},function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0;var o,a,c,l,u,s,b,d=0,k=0,h=0,w=0;if(h=ur=(b=ur)+31&-32,ur=ur+432|0,d=h+424|0,A=h+24|0,s=h+16|0,a=h+8|0,k=(l=h)+428|0,h=h+4|0,ar[s>>2]=A,ar[(u=4+s|0)>>2]=309,Di(l,f),o=0|bf(l,52568),c=(tr[k>>0]=0)|ar[r>>2],ar[h>>2]=c,f=0|ar[f+4>>2],ar[d>>2]=ar[h>>2],h=c,0|Ie(e,d,i,l,f,n,k,o,s,a,A+400|0)){for((0|tr[(A=t+8+3|0)>>0])<0?(i=0|ar[t>>2],ar[d>>2]=0,sf(i,d),ar[t+4>>2]=0):(ar[d>>2]=0,sf(t,d),tr[A>>0]=0),0|tr[k>>0]&&ru(t,0|fs[63&ar[44+(0|ar[o>>2])>>2]](o,45)),k=0|fs[63&ar[44+(0|ar[o>>2])>>2]](o,48),d=(f=0|ar[a>>2])+-4|0,A=0|ar[s>>2];!(d>>>0<=A>>>0)&&(0|ar[A>>2])==(0|k);)A=A+4|0;!function(A,e,r){e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;n=ur=(o=ur)+31&-32,ur=ur+16|0,k=12+n|0,i=0|tr[(t=3+(a=8+(A|=0)|0)|0)>>0],u=(c=i<<24>>24<0)?(d=0|ar[A+4>>2],(2147483647&ar[a>>2])-1|0):(d=255&i,1);f=r-e>>2;do{if(0|f){if(c?(c=0|ar[A>>2],l=c,a=0|ar[A+4>>2]):(a=255&i,c=l=A),0|Be(e,c,l+(a<<2)|0)){ar[n>>2]=0,ar[4+n>>2]=0,ar[8+n>>2]=0,1073741807<f>>>0&&Nl();do{if(2<=f>>>0){if(!(1073741823<(a=4+f&-4)>>>0)){b=0|El(a<<2),ar[n>>2]=b,ar[8+n>>2]=-2147483648|a,ar[4+n>>2]=f,s=e;break}kA()}else tr[8+n+3>>0]=f,s=e,b=n}while(0);for(;(0|s)!=(0|r);)sf(b,s),s=s+4|0,b=b+4|0;ar[k>>2]=0,sf(b,k),k=0|tr[8+n+3>>0],eu(A,(r=k<<24>>24<0)?0|ar[n>>2]:n,r?0|ar[4+n>>2]:255&k),Pl(n);break}for(c=d+f|0,(u-d|0)>>>0<f>>>0&&Au(A,u,c-u|0,d,d,0,0),a=(a=(0|tr[t>>0])<0?0|ar[A>>2]:A)+(d<<2)|0;(0|e)!=(0|r);)sf(a,e),a=a+4|0,e=e+4|0;if(ar[k>>2]=0,sf(a,k),(0|tr[t>>0])<0){ar[A+4>>2]=c;break}tr[t>>0]=c;break}}while(0);ur=o}(t,A,f)}A=0|ar[e>>2];do{if(A){if(0|Qi(A=(0|(f=0|ar[A+12>>2]))==(0|ar[A+16>>2])?0|is[127&ar[36+(0|ar[A>>2])>>2]](A):0|wi(0|ar[f>>2]),-1)){ar[e>>2]=0,f=1;break}f=0==(0|ar[e>>2]);break}f=1}while(0);do{if(c){if(0|Qi(A=(0|(A=0|ar[h+12>>2]))==(0|ar[h+16>>2])?0|is[127&ar[36+(0|ar[c>>2])>>2]](h):0|wi(0|ar[A>>2]),-1)){ar[r>>2]=0,w=25;break}if(f)break;w=27;break}w=25}while(0);return 25==(0|w)&&f&&(w=27),27==(0|w)&&(ar[n>>2]=2|ar[n>>2]),f=0|ar[e>>2],df(l),A=0|ar[s>>2],(ar[s>>2]=0)|A&&ds[511&ar[u>>2]](A),ur=b,0|f},Ou],ss=[Hu,function(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,i|=0,n|=0,t|=0,o|=0;var a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x=0,j=0;switch(J=ur=(H=ur)+31&-32,ur=ur+144|0,a=128+J|0,o=112+J|0,O=124+J|0,x=120+J|0,c=116+J|0,l=108+J|0,u=104+J|0,s=100+J|0,b=96+J|0,d=92+J|0,k=88+J|0,h=84+J|0,w=80+J|0,v=76+J|0,g=72+J|0,m=68+J|0,p=64+J|0,y=60+J|0,Z=56+J|0,C=52+J|0,W=48+J|0,I=44+J|0,B=40+J|0,E=36+J|0,G=32+J|0,V=28+J|0,X=24+J|0,_=20+J|0,F=16+J|0,N=12+J|0,R=8+J|0,Y=4+J|0,ar[(f|=0)>>2]=0,Di(a,i),D=0|bf(a,52536),df(a),Q=n+8|0,T=n+20|0,M=n+16|0,S=n+24|0,U=A+8|0,t<<24>>24|0){case 65:case 97:ar[O>>2]=ar[r>>2],ar[a>>2]=ar[O>>2],JA(A,S,e,a,f,D),j=26;break;case 104:case 66:case 98:ar[x>>2]=ar[r>>2],ar[a>>2]=ar[x>>2],DA(A,M,e,a,f,D),j=26;break;case 99:x=0|is[127&ar[12+(0|ar[U>>2])>>2]](U),ar[c>>2]=ar[e>>2],ar[l>>2]=ar[r>>2],j=(t=(r=(j=0|tr[x+11>>0])<<24>>24<0)?0|ar[x>>2]:x)+(r?0|ar[x+4>>2]:255&j)|0,ar[o>>2]=ar[c>>2],ar[a>>2]=ar[l>>2],j=0|QA(A,o,a,i,f,n,t,j),ar[e>>2]=j,j=26;break;case 101:case 100:ar[u>>2]=ar[r>>2],ar[a>>2]=ar[u>>2],TA(A,n+12|0,e,a,f,D),j=26;break;case 68:ar[s>>2]=ar[e>>2],ar[b>>2]=ar[r>>2],ar[o>>2]=ar[s>>2],ar[a>>2]=ar[b>>2],j=0|QA(A,o,a,i,f,n,47713,47721),ar[e>>2]=j,j=26;break;case 70:ar[d>>2]=ar[e>>2],ar[k>>2]=ar[r>>2],ar[o>>2]=ar[d>>2],ar[a>>2]=ar[k>>2],j=0|QA(A,o,a,i,f,n,47721,47729),ar[e>>2]=j,j=26;break;case 72:ar[h>>2]=ar[r>>2],ar[a>>2]=ar[h>>2],MA(A,Q,e,a,f,D),j=26;break;case 73:ar[w>>2]=ar[r>>2],ar[a>>2]=ar[w>>2],SA(A,Q,e,a,f,D),j=26;break;case 106:ar[v>>2]=ar[r>>2],ar[a>>2]=ar[v>>2],UA(A,n+28|0,e,a,f,D),j=26;break;case 109:ar[g>>2]=ar[r>>2],ar[a>>2]=ar[g>>2],OA(A,M,e,a,f,D),j=26;break;case 77:ar[m>>2]=ar[r>>2],ar[a>>2]=ar[m>>2],HA(A,n+4|0,e,a,f,D),j=26;break;case 116:case 110:ar[p>>2]=ar[r>>2],ar[a>>2]=ar[p>>2],xA(A,e,a,f,D),j=26;break;case 112:ar[y>>2]=ar[r>>2],ar[a>>2]=ar[y>>2],jA(A,Q,e,a,f,D),j=26;break;case 114:ar[Z>>2]=ar[e>>2],ar[C>>2]=ar[r>>2],ar[o>>2]=ar[Z>>2],ar[a>>2]=ar[C>>2],j=0|QA(A,o,a,i,f,n,47729,47740),ar[e>>2]=j,j=26;break;case 82:ar[W>>2]=ar[e>>2],ar[I>>2]=ar[r>>2],ar[o>>2]=ar[W>>2],ar[a>>2]=ar[I>>2],j=0|QA(A,o,a,i,f,n,47740,47745),ar[e>>2]=j,j=26;break;case 83:ar[B>>2]=ar[r>>2],ar[a>>2]=ar[B>>2],zA(A,n,e,a,f,D),j=26;break;case 84:ar[E>>2]=ar[e>>2],ar[G>>2]=ar[r>>2],ar[o>>2]=ar[E>>2],ar[a>>2]=ar[G>>2],j=0|QA(A,o,a,i,f,n,47745,47753),ar[e>>2]=j,j=26;break;case 119:ar[V>>2]=ar[r>>2],ar[a>>2]=ar[V>>2],PA(A,S,e,a,f,D),j=26;break;case 120:t=0|ar[20+(0|ar[A>>2])>>2],ar[X>>2]=ar[e>>2],ar[_>>2]=ar[r>>2],ar[o>>2]=ar[X>>2],ar[a>>2]=ar[_>>2],o=0|ls[63&t](A,o,a,i,f,n);break;case 88:x=0|is[127&ar[24+(0|ar[U>>2])>>2]](U),ar[F>>2]=ar[e>>2],ar[N>>2]=ar[r>>2],j=(t=(r=(j=0|tr[x+11>>0])<<24>>24<0)?0|ar[x>>2]:x)+(r?0|ar[x+4>>2]:255&j)|0,ar[o>>2]=ar[F>>2],ar[a>>2]=ar[N>>2],j=0|QA(A,o,a,i,f,n,t,j),ar[e>>2]=j,j=26;break;case 121:ar[R>>2]=ar[r>>2],ar[a>>2]=ar[R>>2],LA(A,T,e,a,f,D),j=26;break;case 89:ar[Y>>2]=ar[r>>2],ar[a>>2]=ar[Y>>2],KA(A,T,e,a,f,D),j=26;break;case 37:ar[J>>2]=ar[r>>2],ar[a>>2]=ar[J>>2],qA(A,e,a,f,D),j=26;break;default:ar[f>>2]=4|ar[f>>2],j=26}return 26==(0|j)&&(o=0|ar[e>>2]),ur=H,0|o},function(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,i|=0,n|=0,t|=0,o|=0;var a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I,B,E,G,V,X,_,F,N,R,Y,J,D,Q,T,M,S,U,O,H,x=0,j=0;switch(J=ur=(H=ur)+31&-32,ur=ur+144|0,a=128+J|0,o=112+J|0,O=124+J|0,x=120+J|0,c=116+J|0,l=108+J|0,u=104+J|0,s=100+J|0,b=96+J|0,d=92+J|0,k=88+J|0,h=84+J|0,w=80+J|0,v=76+J|0,g=72+J|0,m=68+J|0,p=64+J|0,y=60+J|0,Z=56+J|0,C=52+J|0,W=48+J|0,I=44+J|0,B=40+J|0,E=36+J|0,G=32+J|0,V=28+J|0,X=24+J|0,_=20+J|0,F=16+J|0,N=12+J|0,R=8+J|0,Y=4+J|0,ar[(f|=0)>>2]=0,Di(a,i),D=0|bf(a,52568),df(a),Q=n+8|0,T=n+20|0,M=n+16|0,S=n+24|0,U=A+8|0,t<<24>>24|0){case 65:case 97:ar[O>>2]=ar[r>>2],ar[a>>2]=ar[O>>2],ee(A,S,e,a,f,D),j=26;break;case 104:case 66:case 98:ar[x>>2]=ar[r>>2],ar[a>>2]=ar[x>>2],re(A,M,e,a,f,D),j=26;break;case 99:x=0|is[127&ar[12+(0|ar[U>>2])>>2]](U),ar[c>>2]=ar[e>>2],ar[l>>2]=ar[r>>2],j=(t=(r=(j=0|tr[x+8+3>>0])<<24>>24<0)?0|ar[x>>2]:x)+((r?0|ar[x+4>>2]:255&j)<<2)|0,ar[o>>2]=ar[c>>2],ar[a>>2]=ar[l>>2],j=0|ie(A,o,a,i,f,n,t,j),ar[e>>2]=j,j=26;break;case 101:case 100:ar[u>>2]=ar[r>>2],ar[a>>2]=ar[u>>2],fe(A,n+12|0,e,a,f,D),j=26;break;case 68:ar[s>>2]=ar[e>>2],ar[b>>2]=ar[r>>2],ar[o>>2]=ar[s>>2],ar[a>>2]=ar[b>>2],j=0|ie(A,o,a,i,f,n,14588,14620),ar[e>>2]=j,j=26;break;case 70:ar[d>>2]=ar[e>>2],ar[k>>2]=ar[r>>2],ar[o>>2]=ar[d>>2],ar[a>>2]=ar[k>>2],j=0|ie(A,o,a,i,f,n,14620,14652),ar[e>>2]=j,j=26;break;case 72:ar[h>>2]=ar[r>>2],ar[a>>2]=ar[h>>2],ne(A,Q,e,a,f,D),j=26;break;case 73:ar[w>>2]=ar[r>>2],ar[a>>2]=ar[w>>2],te(A,Q,e,a,f,D),j=26;break;case 106:ar[v>>2]=ar[r>>2],ar[a>>2]=ar[v>>2],oe(A,n+28|0,e,a,f,D),j=26;break;case 109:ar[g>>2]=ar[r>>2],ar[a>>2]=ar[g>>2],ae(A,M,e,a,f,D),j=26;break;case 77:ar[m>>2]=ar[r>>2],ar[a>>2]=ar[m>>2],ce(A,n+4|0,e,a,f,D),j=26;break;case 116:case 110:ar[p>>2]=ar[r>>2],ar[a>>2]=ar[p>>2],le(A,e,a,f,D),j=26;break;case 112:ar[y>>2]=ar[r>>2],ar[a>>2]=ar[y>>2],ue(A,Q,e,a,f,D),j=26;break;case 114:ar[Z>>2]=ar[e>>2],ar[C>>2]=ar[r>>2],ar[o>>2]=ar[Z>>2],ar[a>>2]=ar[C>>2],j=0|ie(A,o,a,i,f,n,14652,14696),ar[e>>2]=j,j=26;break;case 82:ar[W>>2]=ar[e>>2],ar[I>>2]=ar[r>>2],ar[o>>2]=ar[W>>2],ar[a>>2]=ar[I>>2],j=0|ie(A,o,a,i,f,n,14696,14716),ar[e>>2]=j,j=26;break;case 83:ar[B>>2]=ar[r>>2],ar[a>>2]=ar[B>>2],se(A,n,e,a,f,D),j=26;break;case 84:ar[E>>2]=ar[e>>2],ar[G>>2]=ar[r>>2],ar[o>>2]=ar[E>>2],ar[a>>2]=ar[G>>2],j=0|ie(A,o,a,i,f,n,14716,14748),ar[e>>2]=j,j=26;break;case 119:ar[V>>2]=ar[r>>2],ar[a>>2]=ar[V>>2],be(A,S,e,a,f,D),j=26;break;case 120:t=0|ar[20+(0|ar[A>>2])>>2],ar[X>>2]=ar[e>>2],ar[_>>2]=ar[r>>2],ar[o>>2]=ar[X>>2],ar[a>>2]=ar[_>>2],o=0|ls[63&t](A,o,a,i,f,n);break;case 88:x=0|is[127&ar[24+(0|ar[U>>2])>>2]](U),ar[F>>2]=ar[e>>2],ar[N>>2]=ar[r>>2],j=(t=(r=(j=0|tr[x+8+3>>0])<<24>>24<0)?0|ar[x>>2]:x)+((r?0|ar[x+4>>2]:255&j)<<2)|0,ar[o>>2]=ar[F>>2],ar[a>>2]=ar[N>>2],j=0|ie(A,o,a,i,f,n,t,j),ar[e>>2]=j,j=26;break;case 121:ar[R>>2]=ar[r>>2],ar[a>>2]=ar[R>>2],de(A,T,e,a,f,D),j=26;break;case 89:ar[Y>>2]=ar[r>>2],ar[a>>2]=ar[Y>>2],ke(A,T,e,a,f,D),j=26;break;case 37:ar[J>>2]=ar[r>>2],ar[a>>2]=ar[J>>2],he(A,e,a,f,D),j=26;break;default:ar[f>>2]=4|ar[f>>2],j=26}return 26==(0|j)&&(o=0|ar[e>>2]),ur=H,0|o},function(A,e,r,i,f,n,t,o){var a;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,A=ur=(e=ur)+31&-32,ur=ur+16|0,t=0|function(A,e,r,i,f,n,t,o){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a=0,c=0,l=0;ar[(r|=0)>>2]=A,ar[n>>2]=i,2&o?(f-i|0)<3?A=1:(ar[n>>2]=i+1,tr[i>>0]=-17,a=0|ar[n>>2],ar[n>>2]=a+1,tr[a>>0]=-69,a=0|ar[n>>2],ar[n>>2]=a+1,tr[a>>0]=-65,a=4):a=4;A:do{if(4==(0|a))for(A=0|ar[r>>2];;){if(e>>>0<=A>>>0){A=0;break A}if(l=0|ar[A>>2],t>>>0<l>>>0|55296==(-2048&l|0)){A=2;break A}do{if(128<=l>>>0){if(c=255&(63&l|128),l>>>0<2048){if(A=0|ar[n>>2],(f-A|0)<2){A=1;break A}ar[n>>2]=A+1,tr[A>>0]=l>>>6|192,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=c;break}if(A=0|ar[n>>2],i=f-A|0,o=A+1|0,a=255&(l>>>6&63|128),l>>>0<65536){if((0|i)<3){A=1;break A}ar[n>>2]=o,tr[A>>0]=l>>>12|224,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=a,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=c;break}if((0|i)<4){A=1;break A}ar[n>>2]=o,tr[A>>0]=l>>>18|240,o=0|ar[n>>2],ar[n>>2]=o+1,tr[o>>0]=l>>>12&63|128,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=a,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=c;break}if(A=0|ar[n>>2],(f-A|0)<1){A=1;break A}ar[n>>2]=A+1,tr[A>>0]=l}while(0);A=4+(0|ar[r>>2])|0,ar[r>>2]=A}}while(0);return 0|A}(ar[(a=A+4|0)>>2]=r,i,a,ar[A>>2]=n,t,A,1114111,0),ar[f>>2]=ar[a>>2],ar[o>>2]=ar[A>>2],ur=e,0|t},function(A,e,r,i,f,n,t,o){var a;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,A=ur=(e=ur)+31&-32,ur=ur+16|0,t=0|function(A,e,r,i,f,n,t,o){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c=0,l=0,u=0,s=0,b=0;ar[(r|=0)>>2]=A,ar[n>>2]=i,a=e,4&o|0&&(c=0|ar[r>>2],2<(a-c|0))&&-17==(0|tr[c>>0])&&-69==(0|tr[c+1>>0])&&-65==(0|tr[c+2>>0])&&(ar[r>>2]=c+3);A:for(;;){if(l=0|ar[r>>2],e>>>0<=l>>>0){A=0;break}if(b=0|ar[n>>2],f>>>0<=b>>>0){A=1;break}u=0|tr[l>>0],s=255&u,A=l+1|0;do{if(-1<u<<24>>24){if(t>>>0<s>>>0){A=2;break A}ar[b>>2]=s}else{if((255&u)<194){A=2;break A}if(c=l+2|0,i=a-l|0,(255&u)<224){if((0|i)<2){A=1;break A}if(128!=(192&(A=0|cr[A>>0])|0)){A=2;break A}if(t>>>0<(A=63&A|s<<6&1984)>>>0){A=2;break A}ar[b>>2]=A,A=c;break}if(o=l+3|0,(255&u)<240){if((0|i)<3){A=1;break A}switch(i=0|tr[c>>0],c=0|cr[A>>0],A=224&c,u<<24>>24){case-32:if(160==(0|A))break;A=2;break A;case-19:if(128==(0|A))break;A=2;break A;default:if(128!=(192&c|0)){A=2;break A}}if(128!=(192&(A=255&i)|0)){A=2;break A}if(t>>>0<(A=c<<6&4032|s<<12&61440|63&A)>>>0){A=2;break A}ar[b>>2]=A,A=o;break}if(245<=(255&u)){A=2;break A}if((0|i)<4){A=1;break A}switch(i=0|tr[A>>0],A=0|tr[c>>0],c=0|tr[o>>0],o=255&i,u<<24>>24){case-16:if(48<=(i+112&255)){A=2;break A}break;case-12:if(128==(240&o|0))break;A=2;break A;default:if(128!=(192&o|0)){A=2;break A}}if(128!=(192&(i=255&A)|0)){A=2;break A}if(128!=(192&(A=255&c)|0)){A=2;break A}if(t>>>0<(A=o<<12&258048|s<<18&1835008|i<<6&4032|63&A)>>>0){A=2;break A}ar[b>>2]=A,A=l+4|0}}while(0);ar[r>>2]=A,ar[n>>2]=4+(0|ar[n>>2])}return 0|A}(ar[(a=A+4|0)>>2]=r,i,a,ar[A>>2]=n,t,A,1114111,0),ar[f>>2]=ar[a>>2],ar[o>>2]=ar[A>>2],ur=e,0|t},function(A,e,r,i,f,n,t,o){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l,u,s=0,b=0,d=0,k=0;for(d=ur=(u=ur)+31&-32,ur=ur+16|0,d=(l=d)+8|0,s=r|=0;;){if((0|s)==(0|i)){s=i;break}if(!(0|ar[s>>2]))break;s=s+4|0}ar[o>>2]=n,ar[f>>2]=r,a=t,c=A+8|0;A:for(;;){if((0|n)==(0|t)|(0|r)==(0|i)){s=35;break}switch(b=0|ar[(k=e)+4>>2],ar[(A=l)>>2]=ar[k>>2],ar[A+4>>2]=b,A=0|Ai(0|ar[c>>2]),b=0|Ka(n,f,s-r>>2,a-n|0,e),0|A&&Ai(A),0|b){case-1:s=10;break A;case 0:r=1,s=32;break A}if(n=(0|ar[o>>2])+b|0,(0|(ar[o>>2]=n))==(0|t)){s=33;break}if((0|s)==(0|i))s=i,r=0|ar[f>>2];else{if(n=0|Ai(0|ar[c>>2]),r=0|Ea(d,0),0|n&&Ai(n),-1==(0|r)){r=2,s=31;break}if(r>>>0>(a-(0|ar[o>>2])|0)>>>0){r=1,s=31;break}for(n=d;r;)b=0|tr[n>>0],k=0|ar[o>>2],ar[o>>2]=k+1,tr[k>>0]=b,n=n+1|0,r=r+-1|0;for(r=4+(0|ar[f>>2])|0,s=ar[f>>2]=r;;){if((0|s)==(0|i)){s=i;break}if(!(0|ar[s>>2]))break;s=s+4|0}n=0|ar[o>>2]}}if(10==(0|s)){for(ar[o>>2]=n;(0|r)!=(0|ar[f>>2])&&(k=0|ar[r>>2],s=0|Ai(0|ar[c>>2]),n=0|Ea(n,k),0|s&&Ai(s),-1!=(0|n));)n=(0|ar[o>>2])+n|0,ar[o>>2]=n,r=r+4|0;ar[f>>2]=r,r=2,s=32}else 31==(0|s)?s=32:33==(0|s)&&(r=0|ar[f>>2],s=35);return 32!=(0|s)&&35==(0|s)&&(r=(0|r)!=(0|i)&1),ur=u,0|r},function(A,e,r,i,f,n,t,o){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l,u,s=0,b=0,d=0;for(l=ur=(u=ur)+31&-32,ur=ur+16|0,s=r|=0;;){if((0|s)==(0|i)){s=i;break}if(!(0|tr[s>>0]))break;s=s+1|0}for(ar[o>>2]=n,ar[f>>2]=r,a=t,c=A+8|0,A=n;;){if((0|A)==(0|t)|(0|r)==(0|i)){A=32;break}if(n=0|ar[(b=e)+4>>2],ar[(d=l)>>2]=ar[b>>2],ar[d+4>>2]=n,d=s,n=0|Ai(0|ar[c>>2]),b=0|Pa(A,f,d-r|0,a-A>>2,e),0|n&&Ai(n),-1==(0|b)){s=A,A=10;break}if(A=(0|ar[o>>2])+(b<<2)|0,(0|(ar[o>>2]=A))==(0|t)){A=29;break}if(r=0|ar[f>>2],(0|s)==(0|i))s=i;else{if(s=0|Ai(0|ar[c>>2]),r=0|za(A,r,1,e),0|s&&Ai(s),0|r){r=2,A=28;break}for(ar[o>>2]=4+(0|ar[o>>2]),r=1+(0|ar[f>>2])|0,s=ar[f>>2]=r;;){if((0|s)==(0|i)){s=i;break}if(!(0|tr[s>>0]))break;s=s+1|0}A=0|ar[o>>2]}}do{if(10==(0|A)){A:for(;;){if(ar[o>>2]=s,(0|r)==(0|ar[f>>2])){A=18;break}switch(A=0|Ai(0|ar[c>>2]),s=0|za(s,r,d-r|0,l),0|A&&Ai(A),0|s){case-1:A=15;break A;case-2:A=16;break A;case 0:s=1}r=r+s|0,s=4+(0|ar[o>>2])|0,A=10}if(15==(0|A)){ar[f>>2]=r,r=2,A=28;break}if(16==(0|A)){ar[f>>2]=r,r=1,A=28;break}if(18==(0|A)){r=(0|(ar[f>>2]=r))!=(0|i)&1,A=28;break}}else 29==(0|A)&&(r=0|ar[f>>2],A=32)}while(0);return 28!=(0|A)&&32==(0|A)&&(r=(0|r)!=(0|i)&1),ur=u,0|r},function(A,e,r,i,f,n,t,o){return r|=0,n|=0,o|=0,ar[(f|=0)>>2]=r,ar[o>>2]=n,3},function(A,e,r,i,f,n,t,o){return r|=0,n|=0,o|=0,ar[(f|=0)>>2]=r,ar[o>>2]=n,3},function(A,e,r,i,f,n,t,o){var a;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,A=ur=(e=ur)+31&-32,ur=ur+16|0,t=0|function(A,e,r,i,f,n,t,o){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a=0,c=0,l=0,u=0,s=0;ar[(r|=0)>>2]=A,ar[n>>2]=i,2&o?(f-i|0)<3?A=1:(ar[n>>2]=i+1,tr[i>>0]=-17,a=0|ar[n>>2],ar[n>>2]=a+1,tr[a>>0]=-69,a=0|ar[n>>2],ar[n>>2]=a+1,tr[a>>0]=-65,a=4):a=4;A:do{if(4==(0|a))for(s=e,A=0|ar[r>>2];;){if(e>>>0<=A>>>0){A=0;break A}if(i=0|or[A>>1],t>>>0<(u=65535&i)>>>0){A=2;break A}do{if((65535&i)<128){if(A=0|ar[n>>2],(f-A|0)<1){A=1;break A}ar[n>>2]=A+1,tr[A>>0]=i}else{if(l=255&(128|(c=63&u)),(65535&i)<2048){if(A=0|ar[n>>2],(f-A|0)<2){A=1;break A}ar[n>>2]=A+1,tr[A>>0]=u>>>6|192,u=0|ar[n>>2],ar[n>>2]=u+1,tr[u>>0]=l;break}if(o=255&(u>>>12|224),a=255&(u>>>6&63|128),(65535&i)<55296){if(A=0|ar[n>>2],(f-A|0)<3){A=1;break A}ar[n>>2]=A+1,tr[A>>0]=o,u=0|ar[n>>2],ar[n>>2]=u+1,tr[u>>0]=a,u=0|ar[n>>2],ar[n>>2]=u+1,tr[u>>0]=l;break}if(56320<=(65535&i)){if((65535&i)<57344){A=2;break A}if(A=0|ar[n>>2],(f-A|0)<3){A=1;break A}ar[n>>2]=A+1,tr[A>>0]=o,u=0|ar[n>>2],ar[n>>2]=u+1,tr[u>>0]=a,u=0|ar[n>>2],ar[n>>2]=u+1,tr[u>>0]=l;break}if((s-A|0)<4){A=1;break A}if(56320!=(64512&(i=0|lr[(A=A+2|0)>>1])|0)){A=2;break A}if((f-(0|ar[n>>2])|0)<4){A=1;break A}if(t>>>0<(65536+((o=960&u)<<10)|c<<10|1023&i)>>>0){A=2;break A}ar[r>>2]=A,c=1+(o>>>6)|0,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=c>>>2|240,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=u>>>2&15|c<<4&48|128,l=0|ar[n>>2],ar[n>>2]=l+1,tr[l>>0]=u<<4&48|i>>>6&15|128,u=0|ar[n>>2],ar[n>>2]=u+1,tr[u>>0]=63&i|128}}while(0);A=2+(0|ar[r>>2])|0,ar[r>>2]=A}}while(0);return 0|A}(ar[(a=A+4|0)>>2]=r,i,a,ar[A>>2]=n,t,A,1114111,0),ar[f>>2]=ar[a>>2],ar[o>>2]=ar[A>>2],ur=e,0|t},function(A,e,r,i,f,n,t,o){var a;return A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,A=ur=(e=ur)+31&-32,ur=ur+16|0,t=0|function(A,e,r,i,f,n,t,o){A|=0,e|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var a,c,l=0,u=0,s=0,b=0,d=0,k=0;ar[(r|=0)>>2]=A,ar[n>>2]=i,c=e,4&o|0&&(l=0|ar[r>>2],2<(c-l|0))&&-17==(0|tr[l>>0])&&-69==(0|tr[l+1>>0])&&-65==(0|tr[l+2>>0])&&(ar[r>>2]=l+3);a=f;A:for(;;){if(i=0|ar[r>>2],!(A=i>>>0<e>>>0)){k=40;break}if(d=0|ar[n>>2],f>>>0<=d>>>0){k=40;break}if(s=0|tr[i>>0],t>>>0<(b=255&s)>>>0){A=2;break}A=i+1|0;do{if(-1<s<<24>>24)or[d>>1]=255&s;else{if((255&s)<194){A=2;break A}if(l=c-i|0,o=i+2|0,(255&s)<224){if((0|l)<2){A=1;break A}if(128!=(192&(A=0|cr[A>>0])|0)){A=2;break A}if(t>>>0<(A=63&A|b<<6&1984)>>>0){A=2;break A}or[d>>1]=A,A=o;break}if(u=i+3|0,(255&s)<240){if((0|l)<3){A=1;break A}switch(i=0|tr[o>>0],l=0|cr[A>>0],A=224&l,s<<24>>24){case-32:if(160==(0|A))break;A=2;break A;case-19:if(128==(0|A))break;A=2;break A;default:if(128!=(192&l|0)){A=2;break A}}if(128!=(192&(A=255&i)|0)){A=2;break A}if(t>>>0<(65535&(A=l<<6&4032|b<<12|63&A))>>>0){A=2;break A}or[d>>1]=A,A=u;break}if(245<=(255&s)){A=2;break A}if((0|l)<4){A=1;break A}switch(l=0|tr[A>>0],A=0|tr[o>>0],i=0|tr[u>>0],u=255&l,s<<24>>24){case-16:if(48<=(l+112&255)){A=2;break A}break;case-12:if(128==(240&u|0))break;A=2;break A;default:if(128!=(192&u|0)){A=2;break A}}if(128!=(192&(o=255&A)|0)){A=2;break A}if(128!=(192&(A=255&i)|0)){A=2;break A}if((a-d|0)<4){A=1;break A}if(t>>>0<(u<<12&258048|(i=7&b)<<18|4032&(l=o<<6)|(A&=63))>>>0){A=2;break A}or[d>>1]=u<<2&60|o>>>4&3|16320+((u>>>4&3|i<<2)<<6)|55296,d=d+2|0,ar[n>>2]=d,or[d>>1]=A|960&l|56320,A=4+(0|ar[r>>2])|0}}while(0);ar[r>>2]=A,ar[n>>2]=2+(0|ar[n>>2])}40==(0|k)&&(A&=1);return 0|A}(ar[(a=A+4|0)>>2]=r,i,a,ar[A>>2]=n,t,A,1114111,0),ar[f>>2]=ar[a>>2],ar[o>>2]=ar[A>>2],ur=e,0|t},Hu,Hu,Hu,Hu,Hu],bs=[function(){g(11)},function(){W()},function(){var A,e,r,i=0,f=0,n=0,t=0,o=0;t=ur=ur+31&-32,ur=ur+48|0,r=t+32|0,A=t+24|0,o=t+16|0,t=(e=t)+36|0,0|(i=0|iu())&&0|(n=0|ar[i>>2])&&(1126902528==(-256&(f=0|ar[(i=n+48|0)>>2])|0)&1129074247==(0|(i=0|ar[i+4>>2]))||(ar[A>>2]=49345,fu(49295,A)),i=1126902529==(0|f)&1129074247==(0|i)?0|ar[n+44>>2]:n+80|0,ar[t>>2]=i,n=0|ar[n>>2],i=0|ar[n+4>>2],0|ns[63&ar[16+(0|ar[884])>>2]](3536,n,t)?(o=0|ar[t>>2],o=0|is[127&ar[8+(0|ar[o>>2])>>2]](o),ar[e>>2]=49345,ar[e+4>>2]=i,ar[e+8>>2]=o,fu(49209,e)):(ar[o>>2]=49345,ar[o+4>>2]=i,fu(49254,o))),fu(49333,r)},function(){var A,e;e=ur=(A=ur)+31&-32,ur=ur+16|0,0|CA(54456,311)?fu(49533,e):ur=A}],ds=[xu,function(A){var e,r,i;ar[(A|=0)>>2]=3872,ar[(e=A+56|0)>>2]=3892,ar[(r=A+4|0)>>2]=3908,(0|tr[11+(i=A+36|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;ar[(A|=0)>>2]=3872,ar[(e=A+56|0)>>2]=3892,ar[(r=A+4|0)>>2]=3908,(0|tr[11+(i=A+36|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},function(A){var e,r,i;A=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,ar[A>>2]=3872,ar[(e=A+56|0)>>2]=3892,ar[(r=A+4|0)>>2]=3908,(0|tr[11+(i=A+36|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;A=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,ar[A>>2]=3872,ar[(e=A+56|0)>>2]=3892,ar[(r=A+4|0)>>2]=3908,(0|tr[11+(i=A+36|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},function(A){var e;ar[(A|=0)>>2]=3908,(0|tr[11+(e=A+32|0)>>0])<0&&Vl(0|ar[e>>2]),si(A)},function(A){var e;ar[(A|=0)>>2]=3908,(0|tr[11+(e=A+32|0)>>0])<0&&Vl(0|ar[e>>2]),si(A),Vl(A)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4e3,0|(r=0|ar[A+64>>2])&&((0|(f=0|ar[(i=A+68|0)>>2]))!=(0|r)&&(ar[i>>2]=f+(~((f+-4-r|0)>>>2)<<2)),Vl(r)),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4e3,0|(r=0|ar[A+64>>2])&&((0|(f=0|ar[(i=A+68|0)>>2]))!=(0|r)&&(ar[i>>2]=f+(~((f+-4-r|0)>>>2)<<2)),Vl(r)),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i;ar[(A|=0)>>2]=4060,ar[(e=A+64|0)>>2]=4100,ar[A+8>>2]=4080,ar[(r=A+12|0)>>2]=3908,(0|tr[11+(i=A+44|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;ar[(A|=0)>>2]=4060,ar[(e=A+64|0)>>2]=4100,ar[A+8>>2]=4080,ar[(r=A+12|0)>>2]=3908,(0|tr[11+(i=A+44|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},function(A){var e,r,i;ar[(A=(A|=0)+-8|0)>>2]=4060,ar[(e=A+64|0)>>2]=4100,ar[A+8>>2]=4080,ar[(r=A+12|0)>>2]=3908,(0|tr[11+(i=A+44|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;ar[(A=(A|=0)+-8|0)>>2]=4060,ar[(e=A+64|0)>>2]=4100,ar[A+8>>2]=4080,ar[(r=A+12|0)>>2]=3908,(0|tr[11+(i=A+44|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},function(A){var e,r,i;A=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,ar[A>>2]=4060,ar[(e=A+64|0)>>2]=4100,ar[A+8>>2]=4080,ar[(r=A+12|0)>>2]=3908,(0|tr[11+(i=A+44|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;A=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,ar[A>>2]=4060,ar[(e=A+64|0)>>2]=4100,ar[A+8>>2]=4080,ar[(r=A+12|0)>>2]=3908,(0|tr[11+(i=A+44|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},mi,pi,function(A){mi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},function(A){pi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},Vi,Xi,function(A){Vi((A|=0)+-8|0)},function(A){Xi((A|=0)+-8|0)},function(A){Vi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},function(A){Xi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},Wi,Ii,function(A){Wi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},function(A){Ii((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4156,ar[(r=A+16|0)>>2]=4e3,0|(i=0|ar[A+80>>2])&&((0|(n=0|ar[(f=A+84|0)>>2]))!=(0|i)&&(ar[f>>2]=n+(~((n+-4-i|0)>>>2)<<2)),Vl(i)),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4156,ar[(r=A+16|0)>>2]=4e3,0|(i=0|ar[A+80>>2])&&((0|(n=0|ar[(f=A+84|0)>>2]))!=(0|i)&&(ar[f>>2]=n+(~((n+-4-i|0)>>>2)<<2)),Vl(i)),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4184,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4184,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4212,ar[(r=A+16|0)>>2]=4240,(0|tr[(i=A+92|0)+11>>0])<0&&Vl(0|ar[i>>2]),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4212,ar[(r=A+16|0)>>2]=4240,(0|tr[(i=A+92|0)+11>>0])<0&&Vl(0|ar[i>>2]),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4240,(0|tr[(r=A+76|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4240,(0|tr[(r=A+76|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4268,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4268,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){ar[(A|=0)>>2]=4324,ec(A+16|0),vl()},function(A){ar[(A|=0)>>2]=4324,ec(A+16|0),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},ec,function(A){ec(A|=0),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4380,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4380,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){ar[(A|=0)>>2]=4436,Ac(A+16|0),vl()},function(A){ar[(A|=0)>>2]=4436,Ac(A+16|0),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},Ac,function(A){Ac(A|=0),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4492,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4492,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4548,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4548,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){ar[(A|=0)>>2]=4604,mn(A+16|0),vl()},function(A){ar[(A|=0)>>2]=4604,mn(A+16|0),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},mn,function(A){mn(A|=0),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4660,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4660,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},gn,function(A){gn(A|=0),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4744,0|(r=0|ar[A+68>>2])&&((0|ar[(i=A+72|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),(0|tr[(r=A+56|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=4744,0|(r=0|ar[A+68>>2])&&((0|ar[(i=A+72|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),(0|tr[(r=A+56|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4772,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4772,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4828,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4828,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4884,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=4884,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){ar[(A|=0)>>2]=4940,hn(A+16|0),vl()},function(A){ar[(A|=0)>>2]=4940,hn(A+16|0),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},hn,function(A){hn(A|=0),Vl(A)},function(A){ar[(A|=0)>>2]=4996,sn(A+16|0),vl()},function(A){ar[(A|=0)>>2]=4996,sn(A+16|0),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5024,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5024,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){ar[(A|=0)>>2]=5080,on(A+16|0),vl()},function(A){ar[(A|=0)>>2]=5080,on(A+16|0),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},on,function(A){on(A|=0),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5136,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5136,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5192,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5192,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(f=i;i=f+-8|0,ar[n>>2]=i,(f=0|ar[f+-4>>2])&&(Il(f),i=0|ar[n>>2]),(0|i)!=(0|r);)f=i;r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5248,ar[(r=A+16|0)>>2]=5276,(0|tr[(i=A+72|0)+11>>0])<0&&Vl(0|ar[i>>2]),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5248,ar[(r=A+16|0)>>2]=5276,(0|tr[(i=A+72|0)+11>>0])<0&&Vl(0|ar[i>>2]),ar[r>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(;n=f+-8|0,ar[t>>2]=n,(0|(f=(f=0|ar[f+-4>>2])?(Il(f),0|ar[t>>2]):n))!=(0|i););i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=5276,(0|tr[(r=A+56|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(i=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|i)&&(ar[r>>2]=i),Vl(i))},function(A){var e,r=0,i=0,f=0,n=0;if(ar[(A|=0)>>2]=5276,(0|tr[(r=A+56|0)+11>>0])<0&&Vl(0|ar[r>>2]),ar[A>>2]=3972,0|(r=0|ar[(e=A+44|0)>>2])){if((0|(i=0|ar[(n=A+48|0)>>2]))!=(0|r)){for(;f=i+-8|0,ar[n>>2]=f,(0|(i=(i=0|ar[i+-4>>2])?(Il(i),0|ar[n>>2]):f))!=(0|r););r=0|ar[e>>2]}Vl(r)}ar[A>>2]=3840,(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),Vl(A)},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5304,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}ar[r>>2]=3840,(i=0|ar[A+40>>2])&&((0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i)),vl()},function(A){var e,r,i=0,f=0,n=0,t=0;if(ar[(A|=0)>>2]=5304,ar[(r=A+16|0)>>2]=3972,0|(i=0|ar[(e=A+60|0)>>2])){if((0|(f=0|ar[(t=A+64|0)>>2]))!=(0|i)){for(n=f;f=n+-8|0,ar[t>>2]=f,(n=0|ar[n+-4>>2])&&(Il(n),f=0|ar[t>>2]),(0|f)!=(0|i);)n=f;i=0|ar[e>>2]}Vl(i)}if(ar[r>>2]=3840,!(i=0|ar[A+40>>2]))return vl(),void Vl(A);(0|ar[(f=A+44|0)>>2])!=(0|i)&&(ar[f>>2]=i),Vl(i),vl(),Vl(A)},function(A){ds[511&ar[4+(0|ar[(A=(A|=0)+16|0)>>2])>>2]](A)},function(A){Vl(A|=0)},sn,function(A){sn(A|=0),Vl(A)},function(A){var e,r,i;ar[(A|=0)>>2]=5384,ar[(e=A+60|0)>>2]=5404,ar[(r=A+8|0)>>2]=3908,(0|tr[11+(i=A+40|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;ar[(A|=0)>>2]=5384,ar[(e=A+60|0)>>2]=5404,ar[(r=A+8|0)>>2]=3908,(0|tr[11+(i=A+40|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},function(A){var e,r,i;A=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,ar[A>>2]=5384,ar[(e=A+60|0)>>2]=5404,ar[(r=A+8|0)>>2]=3908,(0|tr[11+(i=A+40|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e)},function(A){var e,r,i;A=(A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0,ar[A>>2]=5384,ar[(e=A+60|0)>>2]=5404,ar[(r=A+8|0)>>2]=3908,(0|tr[11+(i=A+40|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),ci(e),Vl(A)},function(A){var e=0;ar[(A|=0)>>2]=5420,Rc(A+52|0,0|ar[A+56>>2]),(0|tr[(e=A+20|0)+11>>0])<0&&Vl(0|ar[e>>2]),(e=0|ar[A+16>>2])&&Bl(e),vl()},function(A){var e=0;if(ar[(A|=0)>>2]=5420,Rc(A+52|0,0|ar[A+56>>2]),(0|tr[(e=A+20|0)+11>>0])<0&&Vl(0|ar[e>>2]),!(e=0|ar[A+16>>2]))return vl(),void Vl(A);Bl(e),vl(),Vl(A)},function(A){var e;Rc((A|=0)+52|0,0|ar[A+56>>2]),(0|tr[11+(e=A+20|0)>>0])<0&&Vl(0|ar[e>>2]),(A=0|ar[A+16>>2])&&Bl(A)},function(A){Vl(A|=0)},function(A){ar[(A|=0)>>2]=5824,cA(0|ar[A+16>>2]),vl()},function(A){ar[(A|=0)>>2]=5824,cA(0|ar[A+16>>2]),vl(),Vl(A)},function(A){var e,r,i;r=e=(A|=0)+16|0,i=0|ar[A+12>>2],i|=0,ur=(i=ur)+16|0,cA(0|aA(0|ar[(r|=0)>>2],0,50608,0|i)),cA(0|ar[r>>2]),ar[r>>2]=1,cA(0),ur=i,cA(0|ar[e>>2])},function(A){Vl(A|=0)},function(A){ar[(A|=0)>>2]=5852,Te(A+12|0),vl()},function(A){ar[(A|=0)>>2]=5852,Te(A+12|0),vl(),Vl(A)},function(A){Te((A|=0)+12|0)},function(A){Vl(A|=0)},function(A){ar[(A|=0)>>2]=5892,Bc(A+12|0),vl()},function(A){ar[(A|=0)>>2]=5892,Bc(A+12|0),vl(),Vl(A)},function(A){Bc((A|=0)+12|0)},function(A){Vl(A|=0)},function(A){ar[(A|=0)>>2]=5920,Ue(A+12|0),vl()},function(A){ar[(A|=0)>>2]=5920,Ue(A+12|0),vl(),Vl(A)},function(A){Ue((A|=0)+12|0)},function(A){Vl(A|=0)},function(A){var e,r,i=0;ar[(A|=0)>>2]=5948,e=A+12|0,0|(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),0<=(0|tr[11+e>>0])||Vl(0|ar[e>>2]),vl()},function(A){var e,r,i=0;if(ar[(A|=0)>>2]=5948,e=A+12|0,0|(r=0|ar[A+24>>2])&&((0|ar[(i=A+28|0)>>2])!=(0|r)&&(ar[i>>2]=r),Vl(r)),0<=(0|tr[11+e>>0]))return vl(),void Vl(A);Vl(0|ar[e>>2]),vl(),Vl(A)},function(A){var e,r;e=(A|=0)+12|0,0|(r=0|ar[A+24>>2])&&((0|ar[(A=A+28|0)>>2])!=(0|r)&&(ar[A>>2]=r),Vl(r)),0<=(0|tr[11+e>>0])||Vl(0|ar[e>>2])},function(A){Vl(A|=0)},function(A){(function(A){(function(A){if((0|ar[375892+(A|=0)>>2])<=0)return;!function(A){var e,r,i,f=0;{if(_u(e=420+(A|=0)|0),tr[A>>0]=1,Fu(),Xu(r=A+448|0),!(0<(0|ar[(i=A+156|0)>>2])))return WA(0|e),vA(0|r);f=0}for(;ZA(0|ar[A+28+(f<<2)>>2],0),f=f+1|0,(0|f)<(0|ar[i>>2]););WA(0|e),vA(0|r)}(A+375396|0)})(A|=0),0|A&&ds[511&ar[4+(0|ar[A>>2])>>2]](A);if(A=0|ar[12486],ar[12486]=A-1,(0|(A=A+-1|0))<0)return ar[12486]=1+(0|ar[12486]),A=12;if(0|A)return A=0;(function(){$o(0|ar[12653]),ar[12653]=0})(),A=0})(0|ar[(A|=0)>>2]),A&&Vl(A)},dr,function(A){dr(A|=0),Vl(A)},function(A){0},function(A){Vl(A|=0)},function(A){0},function(A){Vl(A|=0)},function(A){var e,r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;ar[(t=(A|=0)+4|0)>>2]=1,bo(0|ar[(n=A+12|0)>>2],A),o=0|ar[n>>2],u=(w=0|ar[o+5820>>2])+-1|0,i=1<<(s=0|ar[o+5804>>2]),l=A+24|0,ho(o,A,u,0|ar[(f=A+8|0)>>2],0|ar[l>>2]),0<(0|(o=0|ar[f>>2]))&&(ho(0|ar[n>>2],A,u,o+-1|0,0|ar[l>>2]),o=0|ar[f>>2]),a=o+1|0,c=0|ar[n>>2],(0|a)<(0|ar[c+5828>>2])&&(ho(c,A,u,a,0|ar[l>>2]),o=0|ar[f>>2]),r=A+16|0,function(A,e,r,i){A|=0,r|=0,i|=0;var f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(c=(0|(c=0|ar[(e|=0)+28>>2]))<(0|i)?c:i,1&r|0&&br(30091,29989,535,30106),1&c|0&&br(30122,29989,536,30106),n=(7+(0|ar[A+5760>>2])|0)/8|0,b=(7+(0|ar[A+5768>>2])|0)/8|0,(0|(i=0|ar[(t=e+40|0)>>2]))!=(0|(f=0|ar[(o=A+40|0)>>2]))){if((0|r)<(0|c)&&(l=A+4|0,u=e+4|0,s=e+24|0,a=0|sr(n,r),Eu(0|(f=(0|ar[l>>2])+(0|sr(a,f))|0),0|(a=(0|ar[u>>2])+(0|sr(a,i))|0),0|sr(0|ar[s>>2],n)),(0|(a=r+1|0))<(0|c)))for(i=a;a=0|sr(i,n),Eu(0|(f=(0|ar[l>>2])+(0|sr(a,0|ar[o>>2]))|0),0|(a=(0|ar[u>>2])+(0|sr(a,0|ar[t>>2]))|0),0|sr(0|ar[s>>2],n)),(0|(i=i+1|0))<(0|c););}else Eu(0|(s=(0|ar[A+4>>2])+(0|sr(0|sr(n,r),i))|0),(0|ar[e+4>>2])+(0|sr(0|sr(i,r),n))|0,0|sr(0|sr(n,c-r|0),i));if(i=(0|r)/(0|(a=0|ar[e+5784>>2]))|0,a=(0|c)/(0|a)|0,0|ar[e+20>>2]){if((0|(f=0|ar[(c=e+44|0)>>2]))==(0|(n=0|ar[(r=A+44|0)>>2])))return u=0|sr(i,b),l=0|sr(u,f),s=0|sr(a-i|0,b),Eu((0|ar[A+8>>2])+l|0,(0|ar[e+8>>2])+l|0,0|sr(s,f)),b=0|ar[r>>2],u=0|sr(u,b),Eu((0|ar[A+12>>2])+u|0,(0|ar[e+12>>2])+u|0,0|sr(s,b));if(!((0|a)<=(0|i)))for(l=A+8|0,u=e+8|0,s=e+32|0,o=A+12|0,t=e+12|0;e=0|sr(i,b),Eu(0|(n=(0|ar[l>>2])+(0|sr(e,n))|0),0|(A=(0|ar[u>>2])+(0|sr(e,f))|0),0|sr(0|ar[s>>2],b)),Eu(0|(A=(0|ar[o>>2])+(0|sr(e,0|ar[r>>2]))|0),0|(e=(0|ar[t>>2])+(0|sr(e,0|ar[c>>2]))|0),0|sr(0|ar[s>>2],b)),(0|(i=i+1|0))!=(0|a);)n=0|ar[r>>2],f=0|ar[c>>2]}}(0|ar[(e=A+20|0)>>2],0|ar[r>>2],o<<s,o+1<<s),o=0|ar[n>>2];A:do{if(0<(0|ar[o+5820>>2])){h=0;do{if(s=0|ar[f>>2],a=(0|sr(0|ar[o+10352>>2],s))+h|0,a=0|lr[(0|ar[o+10340>>2])+(24*a|0)+2>>1],c=0|ar[o+48>>2],a>>>0>=(0|ar[o+52>>2])-c>>2>>>0)break A;if(!(k=0|ar[c+(a<<2)>>2]))break A;do{if(0|tr[k+325>>0]){if(a=0|ar[r>>2],l=0|ar[a+4>>2],a=0|ar[a+40>>2],c=0|ar[e>>2],u=0|ar[c+4>>2],c=0|ar[c+40>>2],8<(0|ar[o+5760>>2])){Jo(o,h,s,k,0,i,i,l,a,u,c);break}Zn(o,h,s,k,0,i,i,l,a,u,c);break}}while(0);do{if(0|tr[k+326>>0]){if(c=0|ar[n>>2],b=(0|i)/(0|ar[c+5780>>2])|0,d=(0|i)/(0|ar[c+5784>>2])|0,l=0|ar[f>>2],a=0|ar[r>>2],u=0|ar[a+8>>2],a=0|ar[a+44>>2],o=0|ar[e>>2],s=0|ar[o+8>>2],o=0|ar[o+44>>2],(8<(0|ar[c+5768>>2])?Jo:Zn)(c,h,l,k,1,b,d,u,a,s,o),u=0|ar[n>>2],s=0|ar[f>>2],a=0|ar[r>>2],c=0|ar[a+12>>2],a=0|ar[a+44>>2],o=0|ar[e>>2],l=0|ar[o+12>>2],o=0|ar[o+44>>2],8<(0|ar[u+5768>>2])){Jo(u,h,s,k,2,b,d,c,a,l,o);break}Zn(u,h,s,k,2,b,d,c,a,l,o);break}}while(0);h=h+1|0,o=0|ar[n>>2]}while((0|h)<(0|ar[o+5820>>2]))}}while(0);if(!(0<(0|w)))return w=o,ar[t>>2]=3,void ko(w,A);for(a=0;Ln((0|ar[o+10524>>2])+(80*((0|sr(0|ar[f>>2],0|ar[o+5820>>2]))+a|0)|0)|0,4),a=a+1|0,o=0|ar[n>>2],(0|a)!=(0|w););ar[t>>2]=3,ko(o,A)},function(A){Vl(A|=0)},function(A){var e,r,i,f=0,n=0,t=0,o=0;e=0|ar[(A|=0)+20>>2],r=0|ar[(n=18596+e|0)>>2],ar[(i=A+4|0)>>2]=1,bo(r,A),n=0|ar[n>>2],t=0|ar[4+e>>2],f=0|ar[n+5836>>2],o=0|ar[n+5820>>2],(0|t)<(0|f)&&(f=0|ar[(0|ar[n+10284>>2])+(t<<2)>>2]),ar[e>>2]=f,ar[8+e>>2]=(0|f)%(0|o)|0,ar[12+e>>2]=(0|f)/(0|o)|0,f=A+8|0;do{if(0|tr[f>>0]){if(!(0|In(e)))return ar[i>>2]=3,Kn(44+(0|ar[18608+e>>2])|0,1),void ko(r,A)}else{if(n=0|ar[18600+e>>2],(t=0|ar[n+796>>2])>>>0<3){Ct(18580+e|0,t,0|ar[n+792>>2]),tr[(o=18588+e|0)>>0]=0,tr[o+1>>0]=0,tr[o+2>>0]=0,tr[o+3>>0]=0;break}br(32537,32568,1508,32577)}}while(0);dt(18556+e|0),Bn(e,0,0!=(0|tr[f>>0])),ar[i>>2]=3,Kn(44+(0|ar[18608+e>>2])|0,1),ko(r,A)},function(A){Vl(A|=0)},function(A){var e,r,i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0;if(f=0|ar[(A|=0)+16>>2],n=0|ar[(l=18596+f|0)>>2],r=0|ar[(i=5820+n|0)>>2],ar[(t=A+4|0)>>2]=1,bo(n,A),l=0|ar[l>>2],c=0|ar[4+f>>2],a=0|ar[l+5836>>2],u=0|ar[l+5820>>2],(0|c)<(0|a)&&(a=0|ar[(0|ar[l+10284>>2])+(c<<2)>>2]),ar[f>>2]=a,ar[(c=8+f|0)>>2]=(0|a)%(0|u)|0,ar[(l=12+f|0)>>2]=(0|a)/(0|u)|0,e=(0|a)/(0|r)|0,0|tr[(a=A+8|0)>>0]&&!(0|In(f))){if(0<(0|r))for(c=10524+n|0,a=0|sr(e,r),o=0;Ln((0|ar[c>>2])+(80*(o+a|0)|0)|0,1),(0|(o=o+1|0))!=(0|r););return ar[t>>2]=3,Kn(44+(0|ar[18608+f>>2])|0,1),void ko(n,A)}dt(18556+f|0),Bn(f,1,a=0|tr[a>>0]?0==(0|tr[12+(0|ar[18600+f>>2])>>0]):0);A:do{if((0|ar[l>>2])==(0|e)&&(s=0|ar[i>>2],o=0|ar[c>>2],(0|o)<(0|s)))for(u=5828+n|0,c=0|sr(e,r),l=10524+n|0,a=s;;){if((0|o)<(0|a)&&(0|e)<(0|ar[u>>2])&&Ln((0|ar[l>>2])+(80*(o+c|0)|0)|0,1),(0|(o=o+1|0))==(0|s))break A;a=0|ar[i>>2]}}while(0);ar[t>>2]=3,Kn(44+(0|ar[18608+f>>2])|0,1),ko(n,A)},function(A){Vl(A|=0)},function(A){var e,r,i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0;ar[(a=(A|=0)+4|0)>>2]=1,bo(0|ar[(t=A+8|0)>>2],A),e=0|ar[t>>2],i=0|ar[10472+e>>2],d=(0|ar[5812+e>>2])/4|0,c=0|ar[(n=A+12|0)>>2],r=0|sr(c,d),d=0|sr(l=c+1|0,d),d=(0|(b=0|ar[10476+e>>2]))<(0|d)?b:d,f=(k=0!=(0|tr[(b=A+16|0)>>0]))?2:3,u=(o=0|ar[5820+e>>2])-1|0,k?ho(e,A,u,(0|(k=(0|ar[5828+e>>2])-1|0))<(0|l)?k:l,1):(0<(0|c)?(ho(e,A,u,c+-1|0,2),l=0|ar[t>>2],c=0|ar[n>>2]):l=e,ho(l,A,u,c,2),c=1+(0|ar[n>>2])|0,l=0|ar[t>>2],(0|c)<(0|ar[l+5828>>2])&&ho(l,A,u,c,2)),c=0|ar[t>>2],l=0|ar[n>>2],0|tr[b>>0]?(k=0|Gt(c,l),c=0|ar[t>>2],u=0|sr(0|ar[c+10352>>2],0|ar[n>>2]),tr[(0|ar[c+10340>>2])+(24*u|0)+21>>0]=1&k,k&&(l=0!=(0|tr[b>>0]),s=11)):(k=0|sr(0|ar[c+10352>>2],l),0|tr[(0|ar[c+10340>>2])+(24*k|0)+21>>0]&&(l=0,s=11));do{if(11==(0|s)&&(Vt(c,l,r,d,0,i),c=0|ar[t>>2],l=0!=(0|tr[b>>0]),(8<(0|ar[c+5760>>2])?Xt:_t)(c,l,r,d,0,i),l=0|ar[t>>2],0|ar[l+5776>>2])){if(c=0!=(0|tr[b>>0]),8<(0|ar[l+5768>>2])){Ft(l,c,r,d,0,i);break}Nt(l,c,r,d,0,i);break}}while(0);if(c=0|ar[t>>2],!(0<(0|o)))return k=c,ar[a>>2]=3,void ko(k,A);for(l=0;Ln((0|ar[c+10524>>2])+(80*((0|sr(0|ar[n>>2],0|ar[c+5820>>2]))+l|0)|0)|0,f),l=l+1|0,c=0|ar[t>>2],(0|l)!=(0|o););ar[a>>2]=3,ko(c,A)},li,function(A){li(A|=0),Vl(A)},si,function(A){si(A|=0),Vl(A)},hi,function(A){hi(A|=0),Vl(A)},Zi,Ci,function(A){Zi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},function(A){Ci((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},Ei,Gi,function(A){Ei((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},function(A){Gi((A|=0)+(0|ar[(0|ar[A>>2])-12>>2])|0)},rf,function(A){rf(A|=0),Vl(A)},ff,function(A){ff(A|=0),Vl(A)},nf,function(A){nf(A|=0),Vl(A)},of,function(A){of(A|=0),Vl(A)},cf,function(A){cf(A|=0),Vl(A)},function(A){0|(A|=0)&&ds[511&ar[4+(0|ar[A>>2])>>2]](A)},uf,function(A){uf(),Vl(A|=0)},function(A){lf()},function(A){lf(),Vl(A|=0)},function(A){lf()},function(A){lf(),Vl(A|=0)},function(A){lf()},function(A){lf(),Vl(A|=0)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){ge((A|=0)+8|0),lf()},function(A){ge((A|=0)+8|0),lf(),Vl(A)},function(A){ge((A|=0)+8|0),lf()},function(A){ge((A|=0)+8|0),lf(),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0)},function(A){lf(A|=0),Vl(A)},lf,function(A){lf(A|=0),Vl(A)},function(A){lf(A|=0),Vl(A)},Pc,function(A){Pc(A|=0),Vl(A)},Lc,function(A){Lc(A|=0),Vl(A)},Kc,function(A){Kc(A|=0),Vl(A)},el,function(A){el(A|=0),Vl(A)},rl,function(A){rl(A|=0),Vl(A)},function(A){lf(),Vl(A|=0)},function(A){lf(),Vl(A|=0)},function(A){lf(),Vl(A|=0)},function(A){lf(),Vl(A|=0)},function(A){lf(),Vl(A|=0)},gl,function(A){gl(),Vl(A|=0)},nu,function(A){nu(),Vl(A|=0)},function(A){0},function(A){0},function(A){nu(),Vl(A|=0)},uu,function(A){uu(A|=0),Vl(A)},function(A){uu(A|=0),Vl(A)},function(A){nu(),Vl(A|=0)},function(A){nu(),Vl(A|=0)},function(A){nu(),Vl(A|=0)},function(A){nu(),Vl(A|=0)},function(A){ar[(A|=0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,tr[A+11>>0]=5,tr[A>>0]=0|tr[26561],tr[A+1>>0]=0|tr[26562],tr[A+2>>0]=0|tr[26563],tr[A+3>>0]=0|tr[26564],tr[A+4>>0]=0|tr[26565],tr[A+5>>0]=0},function(A){var e;(A|=0)&&(0|(e=0|ar[A+4>>2])&&Il(e),Vl(A))},function(A){var e=0;(A|=0)&&(0|(e=0|ar[A+12>>2])&&Il(e),0|(e=0|ar[A+4>>2])&&Il(e),Vl(A))},function(A){var e;(A|=0)&&((0|tr[11+(e=A+8|0)>>0])<0&&Vl(0|ar[e>>2]),Vl(A))},function(A){(A|=0)&&Vl(A)},function(A){var e,r,i,f=0;(A|=0)&&(ar[(f=A+32|0)>>2]=5384,ar[(e=A+92|0)>>2]=5404,ar[(r=A+40|0)>>2]=3908,(0|tr[11+(i=A+72|0)>>0])<0&&Vl(0|ar[i>>2]),si(r),yi(),ci(e),(0|tr[(f=A+20|0)+11>>0])<0&&Vl(0|ar[f>>2]),Vl(A))},function(A){(A|=0)&&Vl(A)},function(A){var e,r=0;(A|=0)&&(ar[A>>2]=3840,0|(e=0|ar[A+24>>2])&&((0|ar[(r=A+28|0)>>2])!=(0|e)&&(ar[r>>2]=e),Vl(e)),Vl(A))},function(A){(A|=0)&&ds[511&ar[8+(0|ar[A>>2])>>2]](A)},function(A){var e;(A|=0)&&(0|(e=0|ar[A+4>>2])&&Il(e),Vl(A))},function(A){(A|=0)&&(Bc(A),Vl(A))},function(A){var e;(A|=0)&&(0|(e=0|ar[A+4>>2])&&Il(e),Vl(A))},function(A){var e=0;(A|=0)&&(0|(e=0|ar[A+12>>2])&&Il(e),0|(e=0|ar[A+4>>2])&&Il(e),Vl(A))},function(A){var e;(A|=0)&&(0|(e=0|ar[A+4>>2])&&Il(e),Vl(A))},function(A){(A|=0)&&Vl(A)},function(A){var e=0,r=0,i=0;if(A|=0){if(0|(e=0|ar[A>>2])){if((0|(r=0|ar[(i=A+4|0)>>2]))!=(0|e)){for(;r=r+-12|0,ar[i>>2]=r,(0|tr[r+11>>0])<0&&(Vl(0|ar[r>>2]),r=0|ar[i>>2]),(0|r)!=(0|e););e=0|ar[A>>2]}Vl(e)}Vl(A)}},function(A){var e,r=0,i=0;(A|=0)&&(0|(e=0|ar[A>>2])&&((0|(i=0|ar[(r=A+4|0)>>2]))!=(0|e)&&(ar[r>>2]=i+(~((i+-4-e|0)>>>2)<<2)),Vl(e)),Vl(A))},function(A){var e;A|=0,e=0|ar[13137],ar[13137]=1+e,ar[A+4>>2]=1+e},function(A){!function(A){var e,r,i;e=0|ar[4+(A|=0)>>2],i=0|ar[A+8>>2],r=(0|ar[A>>2])+(i>>1)|0,A=1&i?0|ar[(0|ar[r>>2])+e>>2]:e;ds[511&A](r)}(0|ar[ar[(A|=0)>>2]>>2])},function(A){0},$o,function(A){var e,r;r=ur=(e=ur)+31&-32,ur=ur+16|0,$o(A|=0),0|EA(0|ar[13614],0)?fu(49583,r):ur=e},xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu,xu],ks=[ju,function(A,e){},function(A,e){var r,i;A|=0,e|=0,r=0|El(4),ar[r>>2]=0,ar[A>>2]=ar[1495],ar[A+4>>2]=ar[1496],ar[A+8>>2]=ar[1497],A=0|(i=(i=0)|ar[12486],ar[12486]=i+1,!((i+1|0)<=1)||(function(){var A=0,e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;t=1;do{for(f=0|ar[6168+(t<<2)>>2],o=1<<t,e=A=0;;){for(n=255&A,r=0,i=e;tr[f+(i<<1)>>0]=r,tr[f+(i<<1)+1>>0]=n,(0|(r=r+1|0))!=(0|o);)i=i+1|0;if((0|(A=A+1|0))==(0|o))break;e=e+o|0}for(f=0|ar[6112+(t<<2)>>2],e=A=0;;){for(n=255&A,r=0,i=e;tr[f+(i<<1)>>0]=n,(0|(r=(tr[f+(i<<1)+1>>0]=r)+1|0))!=(0|o);)i=i+1|0;if((0|(A=A+1|0))==(0|o))break;e=e+o|0}f=0|ar[6140+(t<<2)>>2],n=o<<t,A=e=0;do{if(-1<(0|e))for(i=0,r=e;(0|r)<(0|o)&(0|i)<(0|o)&&(tr[f+(A<<1)>>0]=i,tr[f+(A<<1)+1>>0]=r,A=A+1|0),e=i+1|0,0<(0|r);)i=e,r=r+-1|0;else e=0}while((0|A)<(0|n));t=t+1|0}while(6!=(0|t));a=2;do{c=1<<a,l=(1<<(b=a+-2|0)<<b)-1|0,u=6112+(b<<2)|0,s=6140+(b<<2)|0,b=6168+(b<<2)|0,o=0;do{d=0|ar[6196+(24*o|0)+(a<<2)>>2],n=(h=2==(0|o))?60010:0,t=0;do{switch(k=t<<a,0|o){case 0:i=0|ar[s>>2],r=0;do{for(A=16,e=l;A=(f=0==(0|A))?15:A+-1|0,(((0|cr[i+((e=(f<<31>>31)+e|0)<<1)>>0])<<2)+(0|cr[57282+(A<<1)>>0])|0)!=(0|r)||(((0|cr[i+(e<<1)+1>>0])<<2)+(0|cr[57282+(A<<1)+1>>0])|0)!=(0|t););tr[d+((f=r+k|0)<<1)>>0]=e,tr[d+(f<<1)+1>>0]=A,r=r+1|0}while((0|r)<(0|c));break;case 1:i=0|ar[b>>2],r=0;do{for(A=16,e=l;A=(f=0==(0|A))?15:A+-1|0,(((0|cr[i+((e=(f<<31>>31)+e|0)<<1)>>0])<<2)+(0|cr[54554+(A<<1)>>0])|0)!=(0|r)||(((0|cr[i+(e<<1)+1>>0])<<2)+(0|cr[54554+(A<<1)+1>>0])|0)!=(0|t););tr[d+((f=r+k|0)<<1)>>0]=e,tr[d+(f<<1)+1>>0]=A,r=r+1|0}while((0|r)<(0|c));break;default:i=0;do{for(f=i+k|0,e=h?0|ar[u>>2]:0,A=16,r=l;A=(w=0==(0|A))?15:A+-1|0,(((0|cr[e+((r=(w<<31>>31)+r|0)<<1)>>0])<<2)+(0|cr[n+(A<<1)>>0])|0)!=(0|i)||(((0|cr[e+(r<<1)+1>>0])<<2)+(0|cr[n+(A<<1)+1>>0])|0)!=(0|t););tr[d+(f<<1)>>0]=r,tr[d+(f<<1)+1>>0]=A,i=i+1|0}while((0|i)<(0|c))}t=t+1|0}while((0|t)<(0|c));o=o+1|0}while(3!=(0|o));a=a+1|0}while(6!=(0|a))}(),0|function(){var A=0,e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0;if(!(A=0|qo(11296)))return(m=0)|m;Vu(0|A,-1,11296),ar[12653]=A,ar[12654]=A,ar[12655]=A,ar[12656]=A,ar[12657]=A,ar[12658]=A,ar[12659]=A,ar[12660]=A,s=A+16|0,ar[12661]=s,ar[12662]=s,ar[12663]=s,ar[12664]=s,ar[12665]=s,ar[12666]=s,ar[12667]=s,ar[12668]=s,ar[12669]=A+32,ar[12670]=A+96,ar[12671]=A+160,ar[12672]=A+224,ar[12673]=A+288,ar[12674]=A+352,ar[12675]=A+416,ar[12676]=A+480,ar[12677]=A+544,ar[12678]=A+608,ar[12679]=A+672,ar[12680]=A+736,ar[12681]=A+800,ar[12682]=A+864,ar[12683]=A+928,ar[12684]=A+992,s=A+1056|0,ar[12685]=s,ar[12689]=s,s=A+1312|0,ar[12686]=s,ar[12690]=s,s=A+1568|0,ar[12687]=s,ar[12691]=s,s=A+1824|0,ar[12688]=s,ar[12692]=s,s=A+2080|0,ar[12693]=s,ar[12697]=s,s=A+2336|0,ar[12694]=s,ar[12698]=s,s=A+2592|0,ar[12695]=s,ar[12699]=s,s=A+2848|0,ar[12696]=s,ar[12700]=s,s=A+3104|0,ar[12701]=s,ar[12705]=s,s=A+4128|0,ar[12702]=s,ar[12706]=s,s=A+5152|0,ar[12703]=s,ar[12707]=s,s=A+6176|0,ar[12704]=s,ar[12708]=s,s=A+7200|0,ar[12709]=s,ar[12713]=s,s=A+8224|0,ar[12710]=s,ar[12714]=s,s=A+9248|0,ar[12711]=s,ar[12715]=s,s=A+10272|0,ar[12712]=s,ar[12716]=s,s=2;A:for(;;){d=1==(0|(h=(b=1<<s)>>2)),k=s+-2|0,h=2==(0|h),u=0;do{w=0==(0|u),l=0;do{v=0==(0|l)?9:15,c=0;do{g=50612+(k<<6)+(u<<5)+(l<<4)+(c<<2)|0,a=0;do{if(i=a<<2,m=a<<s,f=0-a|0,n=a>>2,o=0==(0|(t=3&a))?2:1==(0|t)&1,d){e=0;do{if(A=0|cr[34815+(e+i)>>0],A=w?A:A+27|0,r=(0|ar[g>>2])+(e+m)|0,!((o=0|tr[r>>0])<<24>>24==-1|(255&o|0)==(0|A))){e=28;break A}tr[r>>0]=A,e=e+1|0}while((0|e)<(0|b))}else{r=0;do{do{if((0|r)!=(0|f)){switch(e=r>>2,A=3&r,0|c){case 0:A=2<(A=A+t|0)>>>0?0:0|A?1:2;break;case 1:A=o;break;case 2:A=0==(0|A)?2:1==(0|A)&1;break;default:A=2}if(w){if(A=0<(e+n|0)?A+3|0:A,h){A=A+v|0;break}A=A+21|0;break}if(h){A=A+9|0;break}A=A+12|0;break}A=0}while(0);if(A=w?A:A+27|0,e=(0|ar[g>>2])+(r+m)|0,!((i=0|tr[e>>0])<<24>>24==-1|(255&i|0)==(0|A))){e=28;break A}tr[e>>0]=A,r=r+1|0}while((0|r)<(0|b))}a=a+1|0}while((0|a)<(0|b));c=c+1|0}while((0|c)<4);l=l+1|0}while((0|l)<2);u=u+1|0}while((0|u)<2);if(6<=(0|(s=s+1|0))){A=1,e=30;break}}if(28==(0|e))br(34831,32568,2100,34907);else if(30==(0|e))return 0|A;return 0}())?(function(A){var e=0,r=0,i=0,f=0,n=0,t=0,o=0,a=0;for(ar[84+(A|=0)>>2]=0,ar[A+168>>2]=0,ar[A>>2]=6064,function(A){ar[(A|=0)>>2]=1,ar[A+4>>2]=9,ar[A+8>>2]=1,ar[A+12>>2]=1,ar[A+16>>2]=1,ar[A+20>>2]=2,ar[A+24>>2]=1,ar[A+28>>2]=1,ar[A+32>>2]=2,ar[A+36>>2]=2,ar[A+40>>2]=2,ar[A+44>>2]=2,ar[A+48>>2]=3,ar[A+52>>2]=4,ar[A+56>>2]=5,ar[A+60>>2]=6,ar[A+64>>2]=7,ar[A+68>>2]=8,ar[A+72>>2]=9,ar[A+76>>2]=10,ar[A+80>>2]=11,ar[A+84>>2]=12,ar[A+88>>2]=13,ar[A+92>>2]=14,ar[A+96>>2]=15,ar[A+100>>2]=16,ar[A+104>>2]=17,ar[A+108>>2]=18,ar[A+112>>2]=3,ar[A+116>>2]=4,ar[A+120>>2]=4,ar[A+124>>2]=4,ar[A+128>>2]=2,ar[A+132>>2]=3,ar[A+136>>2]=4,ar[A+140>>2]=5,ar[A+144>>2]=6,ar[A+148>>2]=7,ar[A+152>>2]=8,ar[A+156>>2]=9,ar[A+160>>2]=10,ar[A+164>>2]=11,ar[A+168>>2]=12,ar[A+172>>2]=13,ar[A+176>>2]=14,ar[A+180>>2]=15,ar[A+184>>2]=16,ar[A+188>>2]=17,ar[A+204>>2]=65,ar[A+212>>2]=14,ar[A+208>>2]=15,ar[A+192>>2]=66,ar[A+200>>2]=67,ar[A+196>>2]=68,ar[A+216>>2]=69,ar[A+220>>2]=70,ar[A+224>>2]=71,ar[A+228>>2]=72,ar[A+232>>2]=73,ar[A+236>>2]=16,ar[A+240>>2]=17,ar[A+244>>2]=18,ar[A+248>>2]=19,ar[A+252>>2]=20,ar[A+256>>2]=21,ar[A+260>>2]=54,ar[A+284>>2]=4,ar[A+288>>2]=5,ar[A+296>>2]=6,ar[A+292>>2]=7,ar[A+300>>2]=8,ar[A+264>>2]=22,ar[A+268>>2]=23,ar[A+272>>2]=24,ar[A+276>>2]=25,ar[A+280>>2]=26,ar[A+304>>2]=74,ar[A+308>>2]=75,ar[A+312>>2]=76,ar[A+316>>2]=77,ar[A+320>>2]=78,ar[A+324>>2]=79,ar[A+328>>2]=80,ar[A+332>>2]=81,ar[A+336>>2]=82}(A+172|0),ar[A>>2]=6040,function(A){var e;for(tr[(A|=0)>>0]=0,tr[A+1>>0]=0,e=48+(A=A+4|0)|0;((ar[A>>2]=0)|(A=A+4|0))<(0|e););}(A+548|0),ar[A+1192>>2]=0,ar[A+1196>>2]=0,ar[A+1200>>2]=0,ar[(e=A+1228|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+1848>>2]=0,ar[A+1852>>2]=0,ar[A+1856>>2]=0,ar[(e=A+1884|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+2504>>2]=0,ar[A+2508>>2]=0,ar[A+2512>>2]=0,ar[(e=A+2540|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+3160>>2]=0,ar[A+3164>>2]=0,ar[A+3168>>2]=0,ar[(e=A+3196|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+3816>>2]=0,ar[A+3820>>2]=0,ar[A+3824>>2]=0,ar[(e=A+3852|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+4472>>2]=0,ar[A+4476>>2]=0,ar[A+4480>>2]=0,ar[(e=A+4508|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+5128>>2]=0,ar[A+5132>>2]=0,ar[A+5136>>2]=0,ar[(e=A+5164|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+5784>>2]=0,ar[A+5788>>2]=0,ar[A+5792>>2]=0,ar[(e=A+5820|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+6440>>2]=0,ar[A+6444>>2]=0,ar[A+6448>>2]=0,ar[(e=A+6476|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+7096>>2]=0,ar[A+7100>>2]=0,ar[A+7104>>2]=0,ar[(e=A+7132|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+7752>>2]=0,ar[A+7756>>2]=0,ar[A+7760>>2]=0,ar[(e=A+7788|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+8408>>2]=0,ar[A+8412>>2]=0,ar[A+8416>>2]=0,ar[(e=A+8444|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+9064>>2]=0,ar[A+9068>>2]=0,ar[A+9072>>2]=0,ar[(e=A+9100|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+9720>>2]=0,ar[A+9724>>2]=0,ar[A+9728>>2]=0,ar[(e=A+9756|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+10376>>2]=0,ar[A+10380>>2]=0,ar[A+10384>>2]=0,ar[(e=A+10412|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,ar[A+11032>>2]=0,ar[A+11036>>2]=0,ar[A+11040>>2]=0,ar[(e=A+11068|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[e+16>>2]=0,ar[e+20>>2]=0,Qn(A+11096|0),Qn(A+16264|0),Qn(A+21432|0),Qn(A+26600|0),Qn(A+31768|0),Qn(A+36936|0),Qn(A+42104|0),Qn(A+47272|0),Qn(A+52440|0),Qn(A+57608|0),Qn(A+62776|0),Qn(A+67944|0),Qn(A+73112|0),Qn(A+78280|0),Qn(A+83448|0),Qn(A+88616|0),e=0;_o(A+93784+(4400*e|0)|0),64!=(0|(e=e+1|0)););for(ar[(n=A+375400|0)>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,ar[n+12>>2]=0,ar[n+16>>2]=0,ar[n+20>>2]=0,function(A){var e,r=0;for(e=48+(r=8+(A|=0)|0)|0;((ar[r>>2]=0)|(r=r+4|0))<(0|e););ar[A>>2]=30,ar[A+4>>2]=30}(A+376148|0),ar[A+377216>>2]=0,ar[A+377220>>2]=0,ar[A+377224>>2]=0,tr[A+512>>0]=0,tr[A+513>>0]=1,tr[A+514>>0]=0,tr[A+532>>0]=0,tr[A+533>>0]=0,ar[(n=A+516|0)>>2]=-1,ar[n+4>>2]=-1,ar[n+8>>2]=-1,ar[n+12>>2]=-1,e=0|ar[4+(n=6080)>>2],ar[(t=A+536|0)>>2]=ar[n>>2],ar[t+4>>2]=e,ar[A+544>>2]=0,ar[A+375384>>2]=0,ar[A+375388>>2]=0,ar[A+375392>>2]=0,ar[A+375892>>2]=0,ar[(t=A+375896|0)>>2]=6,ar[A+375900>>2]=100,ar[A+375904>>2]=6,ar[A+375912>>2]=6,ar[A+375908>>2]=100,e=6;;){if((0|(i=(0|(n=100*e|0))/7|0))<=(0|(n=(n+100|0)/7|0)))for(f=n-i|0,r=i;a=0|ar[t>>2],e=(o=(0|a)<(0|e))?a:e,tr[A+375916+(r<<1)>>0]=e,tr[A+375916+(r<<1)+1>>0]=o?100:255&((100*(r-i|0)|0)/(0|f)|0),(0|r)<(0|n);)r=r+1|0;if(ar[A+376120+(e<<2)>>2]=n,!(0<(0|e)))break;e=e+-1|0}ar[(a=A+376204|0)>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[a+16>>2]=0,ar[a+20>>2]=0,tr[A+376208>>0]=1,ar[a>>2]=-1}(i=0|El(377232)),0|i):(ar[12486]=(0|ar[12486])-1,(i=0)|i)),er(ar[r>>2]=A,7,1),er(A,8,1),ar[e>>2]=r},function(A,e){A|=0,e|=0;var r,i,f=0,n=0;if(ur=(i=ur)+112|0,r=(f=i)+4|0,ar[f>>2]=ar[e+8>>2],Sa(r,32371,f),ar[A>>2]=0,ar[A+4>>2]=0,4294967279<(e=(ar[A+8>>2]=0)|ta(r))>>>0&&Nl(),e>>>0<11){if(!(tr[A+11>>0]=e))return tr[(f=(f=A)+e|0)>>0]=0,void(ur=i)}else f=0|El(n=e+16&-16),ar[A>>2]=f,ar[A+8>>2]=-2147483648|n,ar[A+4>>2]=e,A=f;Eu(0|A,0|r,0|e),tr[(n=(n=A)+e|0)>>0]=0,ur=i},function(A,e){A|=0;var r,i,f=0,n=0;if(ur=(i=ur)+112|0,r=(f=i)+8|0,n=0|ar[(e|=0)+16>>2],ar[f>>2]=ar[e+12>>2],ar[f+4>>2]=n,Sa(r,32517,f),ar[A>>2]=0,ar[A+4>>2]=0,4294967279<(e=(ar[A+8>>2]=0)|ta(r))>>>0&&Nl(),e>>>0<11){if(!(tr[A+11>>0]=e))return tr[(n=(n=A)+e|0)>>0]=0,void(ur=i)}else n=0|El(f=e+16&-16),ar[A>>2]=n,ar[A+8>>2]=-2147483648|f,ar[A+4>>2]=e,A=n;Eu(0|A,0|r,0|e),tr[(n=(n=A)+e|0)>>0]=0,ur=i},function(A,e){A|=0,e|=0;var r,i,f=0,n=0;if(ur=(i=ur)+112|0,r=(f=i)+4|0,ar[f>>2]=ar[e+12>>2],Sa(r,32991,f),ar[A>>2]=0,ar[A+4>>2]=0,4294967279<(e=(ar[A+8>>2]=0)|ta(r))>>>0&&Nl(),e>>>0<11){if(!(tr[A+11>>0]=e))return tr[(f=(f=A)+e|0)>>0]=0,void(ur=i)}else f=0|El(n=e+16&-16),ar[A>>2]=f,ar[A+8>>2]=-2147483648|n,ar[A+4>>2]=e,A=f;Eu(0|A,0|r,0|e),tr[(n=(n=A)+e|0)>>0]=0,ur=i},function(A,e){A|=0,e|=0;var r,i,f=0,n=0;if(ur=(i=ur)+112|0,r=(f=i)+4|0,ar[f>>2]=ar[e+12>>2],Sa(r,41415,f),ar[A>>2]=0,ar[A+4>>2]=0,4294967279<(e=(ar[A+8>>2]=0)|ta(r))>>>0&&Nl(),e>>>0<11){if(!(tr[A+11>>0]=e))return tr[(f=(f=A)+e|0)>>0]=0,void(ur=i)}else f=0|El(n=e+16&-16),ar[A>>2]=f,ar[A+8>>2]=-2147483648|n,ar[A+4>>2]=e,A=f;Eu(0|A,0|r,0|e),tr[(n=(n=A)+e|0)>>0]=0,ur=i},function(A,e){},function(A,e){e|=0,is[127&ar[24+(0|ar[(A|=0)>>2])>>2]](A),e=0|bf(e,54336),ar[A+36>>2]=e,e=1&(0|is[127&ar[28+(0|ar[e>>2])>>2]](e)),tr[A+44>>0]=e},function(A,e){e|=0,is[127&ar[24+(0|ar[(A|=0)>>2])>>2]](A),e=0|bf(e,54328),ar[A+36>>2]=e,e=1&(0|is[127&ar[28+(0|ar[e>>2])>>2]](e)),tr[A+44>>0]=e},function(A,e){A|=0;var r=0,i=0;i=0|bf(e|=0,54336),ar[(r=A+36|0)>>2]=i,i=0|is[127&ar[24+(0|ar[i>>2])>>2]](i),ar[(e=A+44|0)>>2]=i,r=0|ar[r>>2],r=1&(0|is[127&ar[28+(0|ar[r>>2])>>2]](r)),tr[A+53>>0]=r,8<(0|ar[e>>2])&&me()},function(A,e){A|=0;var r=0,i=0;i=0|bf(e|=0,54328),ar[(r=A+36|0)>>2]=i,i=0|is[127&ar[24+(0|ar[i>>2])>>2]](i),ar[(e=A+44|0)>>2]=i,r=0|ar[r>>2],r=1&(0|is[127&ar[28+(0|ar[r>>2])>>2]](r)),tr[A+53>>0]=r,8<(0|ar[e>>2])&&me()},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){var r;e|=0,r=ur=(e=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,pe(A,tr[A+11>>0]=1,45),Ni(A+1|(tr[r>>0]=0),r),ur=e},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){var r;e|=0,r=ur=(e=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,pe(A,tr[A+11>>0]=1,45),Ni(A+1|(tr[r>>0]=0),r),ur=e},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){var r;e|=0,r=ur=(e=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,NA(A,tr[A+8+3>>0]=1,45),sf(A+4|(ar[r>>2]=0),r),ur=e},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){for(e|=0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0)},function(A,e){var r;e|=0,r=ur=(e=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0,NA(A,tr[A+8+3>>0]=1,45),sf(A+4|(ar[r>>2]=0),r),ur=e},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){tr[(A|=0)>>0]=2,tr[A+1>>0]=3,tr[A+2>>0]=0,tr[A+3>>0]=4},function(A,e){},function(A,e){},function(A,e){Rl(A|=0,(e|=0)+12|0)},function(A,e){e|=0;var r,i,f,n=0;r=ur=(f=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,4294967279<(i=(ar[A+8>>2]=0)|Fi(49071))>>>0&&Nl(),i>>>0<11?(tr[A+11>>0]=i,e=A):(e=0|El(n=16+i&-16),ar[A>>2]=e,ar[A+8>>2]=-2147483648|n,ar[A+4>>2]=i),di(e,49071,i),Ni(e+i|(tr[r>>0]=0),r),ur=f},function(A,e){e|=0;var r,i,f,n=0;r=ur=(f=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,4294967279<(i=(ar[A+8>>2]=0)|Fi(49065))>>>0&&Nl(),i>>>0<11?(tr[A+11>>0]=i,e=A):(e=0|El(n=16+i&-16),ar[A>>2]=e,ar[A+8>>2]=-2147483648|n,ar[A+4>>2]=i),di(e,49065,i),Ni(e+i|(tr[r>>0]=0),r),ur=f},function(A,e){Rl(A|=0,(e|=0)+16|0)},function(A,e){e|=0;var r,i,f,n=0;r=ur=(f=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,1073741807<(i=(ar[A+8>>2]=0)|Ae(15548))>>>0&&Nl();do{if(2<=i>>>0){if(!(1073741823<(e=4+i&-4)>>>0)){n=0|El(e<<2),ar[A>>2]=n,ar[A+8>>2]=-2147483648|e,ar[A+4>>2]=i;break}kA()}else tr[A+8+3>>0]=i,n=A}while(0);vi(n,15548,i),sf(n+(i<<2)|(ar[r>>2]=0),r),ur=f},function(A,e){e|=0;var r,i,f,n=0;r=ur=(f=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,1073741807<(i=(ar[A+8>>2]=0)|Ae(15524))>>>0&&Nl();do{if(2<=i>>>0){if(!(1073741823<(e=4+i&-4)>>>0)){n=0|El(e<<2),ar[A>>2]=n,ar[A+8>>2]=-2147483648|e,ar[A+4>>2]=i;break}kA()}else tr[A+8+3>>0]=i,n=A}while(0);vi(n,15524,i),sf(n+(i<<2)|(ar[r>>2]=0),r),ur=f},function(A,e){e|=0,ds[511&(A|=0)](e)},function(A,e){e|=0,ds[511&(A|=0)](e)},function(A,e){var r,i;A|=0,i=0|ar[(e|=0)+4>>2],ar[(r=A)>>2]=ar[e>>2],ar[r+4>>2]=i,Jl(A+8|0,e+8|0)},xf,function(A,e){var r,i;return A|=0,ur=(i=ur)+16|0,r=i,(e|=0)?(ar[r>>2]=0,hs[127&ar[ar[e>>2]>>2]](A,e,r)):(ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0),void(ur=i)},function(A,e){var r,i,f,n;A|=0,e|=0,ur=(n=ur)+32|0,ar[(r=(i=n)+24|0)>>2]=0,ar[(f=4+r|0)>>2]=0,An(i,e,r),A=0|ar[i>>2]?A+4|(ar[A>>2]=0):(ar[A>>2]=ar[r>>2],ar[A+4>>2]=ar[f>>2],ar[r>>2]=0,f),((ar[A>>2]=0)|tr[(A=i+8|0)+11>>0])<0&&Vl(0|ar[A>>2]),ur=((A=0|ar[f>>2])&&Il(A),n)},function(A,e){var r,i;return A|=0,ur=(i=ur)+16|0,r=i,(e|=0)?(ar[r>>2]=0,hs[127&ar[ar[e>>2]>>2]](A,e,r)):(ar[A>>2]=0,ar[A+4>>2]=0,ar[A+8>>2]=0),void(ur=i)},Ec,function(A,e){var r,i;return e|=0,(0|(i=0|ar[(r=(A|=0)+4|0)>>2]))==(0|ar[A+8>>2])?void function(A,e){e|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0;i=4+(A|=0)|0,f=0|ar[A>>2],t=((0|ar[i>>2])-f|0)/12|0,357913941<(n=t+1|0)>>>0&&il();a=((0|ar[(c=A+8|0)>>2])-f|0)/12|0,f=a<<1,f=a>>>0<178956970?f>>>0<n>>>0?n:f:357913941;do{if(f){if(!(357913941<f>>>0)){n=0|El(12*f|0);break}Fl(c=0|C(8),37845),ar[c>>2]=16004,I(0|c,3616,283)}else n=0}while(0);if(a=n+(12*f|0)|0,Rl(t=o=n+(12*t|0)|0,e),r=o+12|0,e=0|ar[A>>2],(0|(f=0|ar[i>>2]))==(0|e))n=t,f=t=e;else{for(n=o;f=f+-12|0,ar[(o=n+-12|0)>>2]=ar[f>>2],ar[o+4>>2]=ar[f+4>>2],ar[o+8>>2]=ar[f+8>>2],ar[f>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,t=n=t+-12|0,(0|f)!=(0|e););n=t,t=0|ar[A>>2],f=0|ar[i>>2]}if(ar[A>>2]=n,ar[i>>2]=r,ar[c>>2]=a,(0|f)!=(0|(n=t)))for(;(0|tr[(f=f+-12|0)+11>>0])<0&&Vl(0|ar[f>>2]),(0|f)!=(0|n););if(!t)return;Vl(t)}(A,e):(Rl(i,e),void(ar[r>>2]=12+(0|ar[r>>2])))},function(A,e){var r,i;return e|=0,(0|(i=0|ar[(r=(A|=0)+4|0)>>2]))==(0|ar[A+8>>2])?void function(A,e){e|=0;var r,i,f,n,t,o=0,a=0,c=0,l=0;f=4+(A|=0)|0,n=0|ar[A>>2],t=(0|ar[f>>2])-n|0,1073741823<(o=1+(i=t>>2)|0)>>>0&&il();c=(0|ar[(l=A+8|0)>>2])-n|0,a=c>>1,a=c>>2>>>0<536870911?a>>>0<o>>>0?o:a:1073741823;do{if(a){if(!(1073741823<a>>>0)){c=0|El(a<<2);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else c=0}while(0);ar[(r=c+(i<<2)|0)>>2]=ar[e>>2],o=r+(0-i<<2)|0,0<(0|t)&&Eu(0|o,0|n,0|t);if(ar[A>>2]=o,ar[f>>2]=4+r,ar[l>>2]=c+(a<<2),!n)return;Vl(n)}(A,e):(ar[i>>2]=ar[e>>2],void(ar[r>>2]=4+i))},function(A,e){A|=0;var r,i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if(r=(0|(e|=0))/2|0,!((0|e)<=1)){i=e+-1|0,f=0;do{for(t=0|sr(f,e),o=i+(0|sr(i-f|0,e))|0,n=0;a=A+(o-n<<1)|0,c=0|or[(l=A+(n+t<<1)|0)>>1],or[l>>1]=0|or[a>>1],or[a>>1]=c,(0|(n=n+1|0))!=(0|e););f=f+1|0}while((0|f)<(0|r))}},ju,ju,ju,ju,ju,ju,ju,ju,ju],hs=[zu,Uf,Pf,function(A,e,r){A|=0,e|=0,r|=0,e=0|ar[12481],ar[(r=A)>>2]=ar[12480],ar[r+4>>2]=e,Rl(A+8|0,49928)},function(A,e,r){A|=0,r|=0;var i,f=0,n=0,t=0,o=0;if(ur=(i=ur)+16|0,n=i,0==(0|(o=0|ar[(f=t=(e|=0)+8|0)>>2]))&0==(0|(f=0|ar[f+4>>2]))?(zi(0|ar[r>>2],0,0,2),ar[(o=r+8|0)>>2]=0,ar[o+4>>2]=0,tr[r+16>>0]=1):0|Lf(r,o=0|gu(0|o,0|f,0|ar[(e=e+16|0)>>2],0),D)&&zi(f=0|ar[r>>2],o=0|gu(0|ar[(o=t)>>2],0|ar[o+4>>2],0|ar[e>>2],0),D,1),!(0|tr[r+17>>0]))return t=0|ar[(n=49920)+4>>2],ar[(o=A)>>2]=ar[n>>2],ar[o+4>>2]=t,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0,k=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Uf(f,e,r),Hf(n,(b=(d=0|tr[(k=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,b?0|ar[4+f>>2]:255&d),(0|tr[k>>0])<0&&Vl(0|ar[f>>2]),0<(0|ar[r>>2]))for(c=0;Hf(n,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(l=0|Hf(n,17248,13),k=0|ar[e+56>>2],ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,tr[(u=11+f|0)>>0]=4,tr[4+f>>0]=0,tr[f>>0]=k>>>24,tr[1+f>>0]=k>>>16,tr[2+f>>0]=k>>>8,tr[3+f>>0]=k,l=0|Hf(0|Hf(l,f,4),26620,1),0<(0|ar[r>>2]))for(c=0;Hf(l,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(l=0|Hf(l,17262,15),l=0|Hf(0|qi(l,0|ar[e+60>>2]),26620,1),0<(0|ar[r>>2]))for(c=0;Hf(l,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(Hf(l,17278,19),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),(0|(c=0|ar[e+64>>2]))!=(0|(r=0|ar[e+68>>2])))for(e=11+f|0,s=4+f|0,b=1+f|0,d=2+f|0,k=3+f|0,u=1;l=0|ar[c>>2],u||(tr[f>>0]=44,Hf(n,f,1)),ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,tr[e>>0]=4,tr[s>>0]=0,tr[f>>0]=l>>>24,tr[b>>0]=l>>>16,tr[d>>0]=l>>>8,tr[k>>0]=l,Hf(n,f,4),(0|tr[e>>0])<0&&Vl(0|ar[f>>2]),(0|(c=c+4|0))!=(0|r);)u=0;if(Hf(n,26620,1),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){A|=0,e|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0;if(ur=(n=ur)+32|0,h=n+16|0,c=n+4|0,w=n,0|Lf(r|=0,4,0))if(ji(k=0|ar[r>>2],h,4),5&ar[k+(0|ar[(0|ar[k>>2])-12>>2])+16>>2]){for(t=r;ar[(k=t+8|0)>>2]=0,ar[k+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[h+1>>0]<<16|cr[h>>0]<<24|cr[h+2>>0]<<8|cr[h+3>>0];else t=0;if(ar[e+56>>2]=t,0|Lf(r,4,0))if(ji(k=0|ar[r>>2],h,4),5&ar[k+(0|ar[(0|ar[k>>2])-12>>2])+16>>2]){for(t=r;ar[(k=t+8|0)>>2]=0,ar[k+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[h+1>>0]<<16|cr[h>>0]<<24|cr[h+2>>0]<<8|cr[h+3>>0];else t=0;if(ar[e+60>>2]=t,t=0|ar[(o=e+8|0)>>2],!(0<(o=0|ar[o+4>>2])>>>0|0==(0|o)&((a=0|ar[e+16>>2])+8|0)>>>0<t>>>0)){for(t=0|El(48),ar[c>>2]=t,ar[c+8>>2]=-2147483600,a=17209,e=(o=t)+(ar[c+4>>2]=38)|0;tr[o>>0]=0|tr[a>>0],a=a+1|0,(0|(o=o+1|0))<(0|e););return(tr[t+38>>0]=0,Cc(A,2,101,c),0<=(0|tr[c+11>>0]))?void(ur=n):(Vl(0|ar[c>>2]),void(ur=n))}l=0|Wu(0|(l=0|gu(0|(l=0|vu(0|t,0|o,-8,-1)),0|D,0|a,0)),0|D,2),i=D,f=r+17|0;A:do{if(!(0==(0|l)&0==(0|i))){u=e+64|0,s=h+1|0,b=h+2|0,d=h+3|0,k=e+68|0,a=e+72|0,c=e=0;do{if(0|tr[f>>0])break A;if(0|Lf(r,4,0))if(ji(o=0|ar[r>>2],h,4),5&ar[o+(0|ar[(0|ar[o>>2])-12>>2])+16>>2]){for(t=r;ar[(o=t+8|0)>>2]=0,ar[o+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[s>>0]<<16|cr[h>>0]<<24|cr[b>>0]<<8|cr[d>>0];else t=0;ar[w>>2]=t,(o=0|ar[k>>2])>>>0<(0|ar[a>>2])>>>0?(ar[o>>2]=t,ar[k>>2]=o+4):Kf(u,w),e=0|vu(0|e,0|c,1,0),c=D}while(c>>>0<i>>>0|(0|c)==(0|i)&e>>>0<l>>>0)}}while(0);0|tr[f>>0]?(ar[h>>2]=0,ar[h+4>>2]=0,ar[h+8>>2]=0,Cc(A,2,100,h),(0|tr[h+11>>0])<0&&Vl(0|ar[h>>2])):(h=0|ar[(r=49920)+4>>2],ar[(w=A)>>2]=ar[r>>2],ar[w+4>>2]=h,Rl(A+8|0,49928)),ur=n},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(l=0|tr[(c=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[f>>2]),tn(f,e,r),Hf(n,(c=(l=0|tr[(u=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){A|=0;var i,f=0;ur=(i=ur)+32|0,qf(f=i,e|=0,r|=0),(0|tr[(f=f+8|0)+11>>0])<0&&Vl(0|ar[f>>2]),$f(A,e,r,-1),ur=i},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0,s=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(l=(u=0|tr[(s=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,l?0|ar[4+f>>2]:255&u),(0|tr[s>>0])<0&&Vl(0|ar[f>>2]),0<(0|ar[r>>2]))for(l=0;Hf(n,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(u=0|Hf(n,20269,13),u=0|Hf(0|qi(u,0|ar[e+56>>2]),26620,1),0<(0|ar[r>>2]))for(l=0;Hf(u,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(s=0|Hf(u,20283,14),l=0|ar[e+60>>2],ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,tr[(u=11+f|0)>>0]=4,tr[4+f>>0]=0,tr[f>>0]=l>>>24,tr[1+f>>0]=l>>>16,tr[2+f>>0]=l>>>8,tr[3+f>>0]=l,s=0|Hf(0|Hf(s,f,4),26620,1),0<(0|ar[r>>2]))for(l=0;Hf(s,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(c=0|Hf(s,20298,6),Hf(0|Hf(c,(s=(r=0|tr[(l=e+76|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,s?0|ar[e+80>>2]:255&r),26620,1),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){A|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0;if(ur=(n=ur)+32|0,c=n+20|0,qf(t=n,e|=0,r|=0),(0|tr[(t=t+8|0)+11>>0])<0&&Vl(0|ar[t>>2]),0|Lf(r,4,0))if(ji(a=0|ar[r>>2],c,4),5&ar[a+(0|ar[(0|ar[a>>2])-12>>2])+16>>2]){for(t=r;ar[(a=t+8|0)>>2]=0,ar[a+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[c+1>>0]<<16|cr[c>>0]<<24|cr[c+2>>0]<<8|cr[c+3>>0];else t=0;if(ar[e+56>>2]=t,0|Lf(r,4,0)){if(ji(a=0|ar[r>>2],c,4),5&ar[a+(0|ar[(0|ar[a>>2])-12>>2])+16>>2]){for(t=r;ar[(a=t+8|0)>>2]=0,ar[a+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[c+1>>0]<<16|cr[c>>0]<<24|cr[c+2>>0]<<8|cr[c+3>>0];a=r}else t=0,a=r;if(ar[e+60>>2]=t,o=c+1|0,i=c+2|0,f=c+3|0,0|Lf(r,4,0))if(ji(t=0|ar[a>>2],c,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(t=r;ar[(l=t+8|0)>>2]=0,ar[l+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[o>>0]<<16|cr[c>>0]<<24|cr[i>>0]<<8|cr[f>>0];else t=0;if(ar[e+64>>2]=t,0|Lf(r,4,0))if(ji(l=0|ar[a>>2],c,4),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(t=r;ar[(l=t+8|0)>>2]=0,ar[l+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[o>>0]<<16|cr[c>>0]<<24|cr[i>>0]<<8|cr[f>>0];else t=0;if(ar[e+68>>2]=t,0|Lf(r,4,0))if(ji(l=0|ar[a>>2],c,4),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(t=r;ar[(l=t+8|0)>>2]=0,ar[l+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[o>>0]<<16|cr[c>>0]<<24|cr[i>>0]<<8|cr[f>>0];else t=0;if(ar[e+72>>2]=t,nn(c,r),(0|tr[(o=(t=e+76|0)+11|0)>>0])<0?(tr[ar[t>>2]>>0]=0,ar[e+80>>2]=0):(tr[t>>0]=0,tr[o>>0]=0),Ml(t,0),ar[t>>2]=ar[c>>2],ar[t+4>>2]=ar[c+4>>2],ar[t+8>>2]=ar[c+8>>2],!(0|tr[r+17>>0]))return c=0|ar[(r=49920)+4>>2],ar[(l=A)>>2]=ar[r>>2],ar[l+4>>2]=c,Rl(A+8|0,49928),void(ur=n);ar[c>>2]=0,ar[c+4>>2]=0,ar[c+8>>2]=0,Cc(A,2,100,c),ur=(0<=(0|tr[c+11>>0])||Vl(0|ar[c>>2]),n)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0;if(ur=(o=ur)+160|0,l=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,Of(t,l),(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2]),Pf(l,e,r),Hf(f,(u=(c=0|tr[(a=l+11|0)>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[l+4>>2]:255&c),(0|tr[a>>0])<0&&Vl(0|ar[l>>2]),0<(0|ar[r>>2]))for(l=0;Hf(f,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(u=0|Hf(f,19579,9),Hf(0|qi(u,0|ar[e+56>>2]),26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f=0,n=0,t=0;if(ur=(i=ur)+32|0,n=i+20|0,qf(f=i,e|=0,r|=0),(0|tr[(f=f+8|0)+11>>0])<0&&Vl(0|ar[f>>2]),0|tr[e+37>>0])if(0|Lf(r,4,0))if(ji(f=0|ar[r>>2],n,4),5&ar[f+(0|ar[(0|ar[f>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;else{if(0|Lf(r,2,0))if(ji(t=0|ar[r>>2],n,2),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n>>0]<<8|cr[n+1>>0];else f=0;f&=65535}if(ar[e+56>>2]=f,!(0|tr[r+17>>0]))return n=0|ar[(r=49920)+4>>2],ar[(t=A)>>2]=ar[r>>2],ar[t+4>>2]=n,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0;if(ur=(o=ur)+160|0,a=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,Of(t,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),Pf(a,e,r),Hf(f,(u=(c=0|tr[(l=a+11|0)>>0])<<24>>24<0)?0|ar[a>>2]:a,u?0|ar[a+4>>2]:255&c),(0|tr[l>>0])<0&&Vl(0|ar[a>>2]),(0|(a=0|ar[e+56>>2]))!=(0|(l=0|ar[e+60>>2]))){c=a;do{if(0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(e=0|Hf(f,20002,9),e=0|Hf(0|qi(e,0|ar[c>>2]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(e,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(e=0|Hf(e,20012,23),e=0|Hf(0|Ki(e,0|cr[c+4>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(e,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(u=(e=0|Hf(e,20036,24))+(0|ar[(0|ar[e>>2])-12>>2])+4|0,ar[u>>2]=-75&ar[u>>2]|8,u=(e=0|Li(e,0|or[c+6>>1]))+(0|ar[(0|ar[e>>2])-12>>2])+4|0,ar[u>>2]=-75&ar[u>>2]|2,e=0|Hf(e,26620,1),0<(0|ar[r>>2]))for(a=0;Hf(e,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(e=0|Hf(e,20061,15),Hf(0|$i(e,0|ar[(u=c+8|0)>>2],0|ar[u+4>>2]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(Hf(f,20077,11),(0|(a=0|ar[c+16>>2]))!=(0|(e=0|ar[c+20>>2])))for(;s=0|Hf(0|$i(f,0|ar[(s=a+8|0)>>2],0|ar[s+4>>2]),20089,1),$i(s,0|ar[(u=a+16|0)>>2],0|ar[u+4>>2]),0==(0|ar[(u=a)>>2])&0==(0|ar[u+4>>2])||$i(u=0|Hf(f,20091,7),0|ar[(s=a)>>2],0|ar[s+4>>2]),Hf(f,17848,1),(0|(a=a+24|0))!=(0|e););Hf(f,26620,1),c=c+32|0}while((0|c)!=(0|l))}if(jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0,N=0,R=0,Y=0,J=0,D=0,Q=0,T=0,M=0,S=0,U=0,O=0,H=0,x=0,j=0,z=0,P=0,L=0,K=0,q=0;if(ur=(f=ur)+352|0,K=f+332|0,q=f+144|0,a=f+300|0,L=(i=f)+288|0,qf(n=f+312|0,e|=0,r|=0),(0|tr[(n=n+8|0)+11>>0])<0&&Vl(0|ar[n>>2]),0|Lf(r,2,0))if(ji(z=0|ar[r>>2],K,2),5&ar[z+(0|ar[(0|ar[z>>2])-12>>2])+16>>2]){for(n=r;ar[(z=n+8|0)>>2]=0,ar[z+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[K>>0]<<8|cr[K+1>>0];else n=0;if(c=n>>>12,l=n>>>8,t=n>>>4,o=1<(255&(j=0|tr[(z=e+37|0)>>0]))?15&n:0,2<=(255&j))if(0|Lf(r,4,0)){if(ji(j=0|ar[r>>2],K,4),5&ar[j+(0|ar[(0|ar[j>>2])-12>>2])+16>>2]){for(n=r;ar[(j=n+8|0)>>2]=0,ar[j+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[K+1>>0]<<16|cr[K>>0]<<24|cr[K+2>>0]<<8|cr[K+3>>0];j=n,u=23}else u=17;else{if(0|Lf(r,2,0))if(ji(j=0|ar[r>>2],K,2),5&ar[j+(0|ar[(0|ar[j>>2])-12>>2])+16>>2]){for(n=r;ar[(j=n+8|0)>>2]=0,ar[j+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[K>>0]<<8|cr[K+1>>0];else n=0;j=65535&n,u=23}A:do{if(23==(0|u)){if(1024<(0|j))return t=q+64|0,ar[(e=q+8|0)>>2]=4080,o=q+12|0,ar[q>>2]=164,ar[t>>2]=184,Yi(q+64|(ar[q+4>>2]=0),o),ar[q+136>>2]=0,ar[q+140>>2]=-1,ar[q>>2]=4060,ar[t>>2]=4100,ar[e>>2]=4080,Ti(o),ar[o>>2]=3908,ar[(e=q+44|0)>>2]=0,ar[e+4>>2]=0,ar[e+8>>2]=0,ar[e+12>>2]=0,ar[q+60>>2]=24,ar[K>>2]=0,ar[K+4>>2]=0,ar[K+8>>2]=0,Of(o,K),(0|tr[K+11>>0])<0&&Vl(0|ar[K>>2]),Hf(0|Ki(0|Hf(0|Ki(0|Hf(n=q+8|0,19871,18),j),19890,44),1024),19935,7),jf(a,o),Cc(A,6,1e3,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),ar[q>>2]=4060,ar[t>>2]=4100,ar[n>>2]=4080,ar[o>>2]=3908,(0|tr[e+11>>0])<0&&Vl(0|ar[e>>2]),si(o),ci(t),void(ur=f);if(0<(0|j)){U=q+4|0,O=q+8|0,x=q+6|0,S=255&t,I=i+12|0,B=i+4|0,E=C=i+64|0,G=i+136|0,V=i+140|0,_=i+60|0,F=K+11|0,R=L+11|0,Y=(X=i+44|0)+11|0,D=q+20|0,Q=r+17|0,T=e+60|0,M=e+64|0,Z=e+56|0,p=J=q+16|0,y=0!=(0|o),m=255&o,h=H=K+1|0,w=K+2|0,v=K+3|0,g=N=W=i+8|0,k=255&c,d=i+16|0,b=255&l,s=q+24|0,l=0;e:for(;;){if(tr[U>>0]=0,ar[O>>2]=0,ar[O+4>>2]=0,ar[O+8>>2]=0,ar[O+12>>2]=0,2<=((ar[O+16>>2]=0)|cr[z>>0]))if(0|Lf(r,4,0))if(ji(c=0|ar[r>>2],K,4),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;else{if(0|Lf(r,2,0))if(ji(c=0|ar[r>>2],K,2),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[K>>0]<<8|cr[H>>0];else n=0;n&=65535}if(ar[q>>2]=n,0|tr[z>>0]){if(0|Lf(r,2,0))if(ji(c=0|ar[r>>2],K,2),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[H>>0];else n=0;tr[U>>0]=15&n}if(0|Lf(r,2,0))if(ji(c=0|ar[r>>2],K,2),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=65535&(cr[K>>0]<<8|cr[H>>0]);else n=0;switch(or[x>>1]=n,ar[(c=O)>>2]=0,ar[c+4>>2]=0,15&S){case 4:if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;t=0,u=74;break;case 8:if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;if(ar[(u=O)>>2]=0,ar[u+4>>2]=n,0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;n=ar[(t=O)>>2]|n,t=0|ar[t+4>>2],u=74}74==(0|u)&&(u=0,ar[(c=O)>>2]=n,ar[c+4>>2]=t);r:do{if(0|Lf(r,2,0)){if(ji(c=0|ar[r>>2],K,2),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]|0){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););u=88;break}if(32<(65535&(e=cr[K>>0]<<8|cr[H>>0]))){ar[W>>2]=4080,ar[i>>2]=164,ar[C>>2]=184,ar[B>>2]=0,Yi(E,I),ar[G>>2]=0,ar[V>>2]=-1,ar[i>>2]=4060,ar[C>>2]=4100,ar[W>>2]=4080,Ti(I),ar[I>>2]=3908,ar[X>>2]=0,ar[X+4>>2]=0,ar[X+8>>2]=0,ar[X+12>>2]=0,ar[_>>2]=24,ar[K>>2]=0,ar[K+4>>2]=0,ar[K+8>>2]=0,Of(I,K),(0|tr[F>>0])<0&&Vl(0|ar[K>>2]),Hf(0|Ki(0|Hf(0|Ki(0|Hf(N,19943,31),e),19975,26),32),17022,2),jf(L,I),Cc(A,6,1e3,L),(0|tr[R>>0])<0&&Vl(0|ar[L>>2]),ar[i>>2]=4060,ar[C>>2]=4100,ar[N>>2]=4080,ar[I>>2]=3908,(0|tr[Y>>0])<0&&Vl(0|ar[X>>2]),si(I),ci(C),n=1;break}if(e)for(o=0;;){ar[(c=i)>>2]=0,ar[c+4>>2]=0;i:do{if(y&1<(0|cr[z>>0])){switch(15&m){case 4:if(0|Lf(r,4,0))if(ji(c=0|ar[r>>2],K,4),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;ar[(c=i)>>2]=n,ar[c+4>>2]=0;break i;case 8:break;default:break i}if(0|Lf(r,4,0))if(ji(c=0|ar[r>>2],K,4),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;if(ar[(c=i)>>2]=0,ar[c+4>>2]=n,0|Lf(r,4,0))if(ji(c=0|ar[r>>2],K,4),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;a=0|ar[(t=i)+4>>2],ar[(c=i)>>2]=ar[t>>2]|n,ar[c+4>>2]=a}}while(0);switch(ar[(c=g)>>2]=0,ar[c+4>>2]=0,15&k){case 4:if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;t=0,u=126;break;case 8:if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;if(ar[(u=g)>>2]=0,ar[u+4>>2]=n,0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;n=ar[(t=g)>>2]|n,t=0|ar[t+4>>2],u=126}switch(126==(0|u)&&(u=0,ar[(c=g)>>2]=n,ar[c+4>>2]=t),ar[(c=d)>>2]=0,ar[c+4>>2]=0,15&b){case 4:if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;t=0,u=145;break;case 8:if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;if(ar[(u=d)>>2]=0,ar[u+4>>2]=n,0|Lf(r,4,0))if(ji(u=0|ar[r>>2],K,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(n=r;ar[(u=n+8|0)>>2]=0,ar[u+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[h>>0]<<16|cr[K>>0]<<24|cr[w>>0]<<8|cr[v>>0];else n=0;n=ar[(t=d)>>2]|n,t=0|ar[t+4>>2],u=145}if(145==(0|u)&&(u=0,ar[(c=d)>>2]=n,ar[c+4>>2]=t),(0|(n=0|ar[D>>2]))==(0|ar[s>>2])?rc(p,i):(ar[n>>2]=ar[i>>2],ar[n+4>>2]=ar[i+4>>2],ar[n+8>>2]=ar[i+8>>2],ar[n+12>>2]=ar[i+12>>2],ar[n+16>>2]=ar[i+16>>2],ar[n+20>>2]=ar[i+20>>2],ar[D>>2]=24+(0|ar[D>>2])),(0|e)<=(0|(o=o+1|0))){u=88;break r}}else u=88}else u=88}while(0);do{if(88==(0|u))if((u=0)|tr[Q>>0])n=0;else{if((0|(t=0|ar[T>>2]))==(0|ar[M>>2])){ic(Z,q),n=0;break}if(ar[t>>2]=ar[q>>2],ar[t+4>>2]=ar[q+4>>2],ar[t+8>>2]=ar[q+8>>2],ar[t+12>>2]=ar[q+12>>2],ar[(o=t+16|0)>>2]=0,ar[(c=t+20|0)>>2]=0,e=((ar[t+24>>2]=0)|(n=(0|ar[D>>2])-(0|ar[p>>2])|0))/24|0,0|n){if(178956970<e>>>0){u=153;break e}a=0|El(n),ar[c>>2]=a,ar[o>>2]=a,ar[t+24>>2]=a+(24*e|0),n=0|ar[p>>2],0<(0|(t=(0|ar[D>>2])-n|0))&&(Eu(0|a,0|n,0|t),ar[c>>2]=a+(24*((t>>>0)/24|0)|0))}ar[T>>2]=32+(0|ar[T>>2]),n=0}}while(0);if(0|(t=0|ar[J>>2])&&((0|(o=0|ar[D>>2]))!=(0|t)&&(ar[D>>2]=o+(24*~(((o+-24-t|0)>>>0)/24|0)|0)),Vl(t)),l=l+1|0,0|n){u=168;break}if((0|j)<=(0|l)){P=Q;break A}}if(153==(0|u))il();else if(168==(0|u))return void(ur=f)}else u=17}}while(0);17==(0|u)&&(P=r+17|0),0|tr[P>>0]?(ar[K>>2]=0,ar[K+4>>2]=0,ar[K+8>>2]=0,Cc(A,2,100,K),(0|tr[K+11>>0])<0&&Vl(0|ar[K>>2])):(K=0|ar[(L=49920)+4>>2],ar[(q=A)>>2]=ar[L>>2],ar[q+4>>2]=K,Rl(A+8|0,49928)),ur=f},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(l=0|tr[(c=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[f>>2]),tn(f,e,r),Hf(n,(c=(l=0|tr[(u=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){A|=0;var i,f,n=0,t=0,o=0;if(ur=(f=ur)+32|0,i=f+20|0,qf(t=f,e|=0,r|=0),(0|tr[(t=t+8|0)+11>>0])<0&&Vl(0|ar[t>>2]),0|tr[e+37>>0]){if(0|Lf(r,4,0)){if(ji(o=0|ar[r>>2],i,4),5&ar[o+(0|ar[(0|ar[o>>2])-12>>2])+16>>2]){for(n=r;ar[(o=n+8|0)>>2]=0,ar[o+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[1+i>>0]<<16|cr[i>>0]<<24|cr[2+i>>0]<<8|cr[3+i>>0];o=15}}else{if(0|Lf(r,2,0))if(ji(o=0|ar[r>>2],i,2),5&ar[o+(0|ar[(0|ar[o>>2])-12>>2])+16>>2]){for(n=r;ar[(o=n+8|0)>>2]=0,ar[o+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[i>>0]<<8|cr[1+i>>0];else n=0;n&=65535,o=15}if(15==(0|o)&&0|n)return $f(A,e,r,-1),void(ur=f);e=0|ar[(o=49920)+4>>2],ar[(r=A)>>2]=ar[o>>2],ar[r+4>>2]=e,Rl(A+8|0,49928),ur=f},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0;if(ur=(o=ur)+160|0,a=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,Of(t,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),Pf(a,e,r),Hf(f,(u=(l=0|tr[(c=a+11|0)>>0])<<24>>24<0)?0|ar[a>>2]:a,u?0|ar[a+4>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[a>>2]),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(f,19579,9),c=0|Hf(0|qi(c,0|ar[e+56>>2]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,19589,23),c=0|Hf(0|Li(c,0|or[e+60>>1]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(c,19613,11),c=0|Hf(0|Hf(a,(u=(c=0|tr[(l=e+64|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[e+68>>2]:255&c),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(c,19625,11),c=0|Hf(0|Hf(a,(u=(c=0|tr[(l=e+76|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[e+80>>2]:255&c),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(c,19637,14),c=0|Hf(0|Hf(a,(u=(c=0|tr[(l=e+88|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[e+92>>2]:255&c),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(c,19652,18),c=0|Hf(0|Hf(a,(u=(c=0|tr[(l=e+100|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[e+104>>2]:255&c),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(c,19671,15),c=0|Hf(0|Hf(a,(u=(c=0|tr[(l=e+112|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[e+116>>2]:255&c),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(l=(u=0|Hf(c,19687,13))+(0|ar[(0|ar[u>>2])-12>>2])+4|0,ar[l>>2]=1|ar[l>>2],Hf(0|Pi(u,0!=(0|tr[e+124>>0])),26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0;if(ur=(i=ur)+32|0,u=i+20|0,qf(f=i,e|=0,r|=0),(0|tr[(f=f+8|0)+11>>0])<0&&Vl(0|ar[f>>2]),(255&(f=0|tr[(t=e+37|0)>>0]))<2){if(0|Lf(r,2,0))if(ji(l=0|ar[r>>2],u,2),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(f=r;ar[(l=f+8|0)>>2]=0,ar[l+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[u>>0]<<8|cr[u+1>>0];else f=0;if(ar[e+56>>2]=65535&f,0|Lf(r,2,0))if(ji(l=0|ar[r>>2],u,2),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(f=r;ar[(l=f+8|0)>>2]=0,ar[l+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=65535&(cr[u>>0]<<8|cr[u+1>>0]);else f=0;or[e+60>>1]=f,nn(u,r),(0|tr[(n=(f=e+76|0)+11|0)>>0])<0?(tr[ar[f>>2]>>0]=0,ar[e+80>>2]=0):(tr[f>>0]=0,tr[n>>0]=0),Ml(f,0),ar[f>>2]=ar[u>>2],ar[f+4>>2]=ar[u+4>>2],ar[f+8>>2]=ar[u+8>>2],nn(u,r),(0|tr[(n=(f=e+88|0)+11|0)>>0])<0?(tr[ar[f>>2]>>0]=0,ar[e+92>>2]=0):(tr[f>>0]=0,tr[n>>0]=0),Ml(f,0),ar[f>>2]=ar[u>>2],ar[f+4>>2]=ar[u+4>>2],ar[f+8>>2]=ar[u+8>>2],nn(u,r),(0|tr[(n=(f=e+100|0)+11|0)>>0])<0?(tr[ar[f>>2]>>0]=0,ar[e+104>>2]=0):(tr[f>>0]=0,tr[n>>0]=0),Ml(f,0),ar[f>>2]=ar[u>>2],ar[f+4>>2]=ar[u+4>>2],ar[f+8>>2]=ar[u+8>>2],1<(255&(f=0|tr[t>>0]))&&(o=24)}else o=24;A:do{if(24==(0|o)){if(tr[e+124>>0]=1&ar[e+40>>2],f<<24>>24!=2)if(0|Lf(r,4,0))if(ji(l=0|ar[r>>2],u,4),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(f=r;ar[(l=f+8|0)>>2]=0,ar[l+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[u+1>>0]<<16|cr[u>>0]<<24|cr[u+2>>0]<<8|cr[u+3>>0];else f=0;else{if(0|Lf(r,2,0))if(ji(l=0|ar[r>>2],u,2),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(f=r;ar[(l=f+8|0)>>2]=0,ar[l+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[u>>0]<<8|cr[u+1>>0];else f=0;f&=65535}if(ar[e+56>>2]=f,0|Lf(r,2,0))if(ji(l=0|ar[r>>2],u,2),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(f=r;ar[(l=f+8|0)>>2]=0,ar[l+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=65535&(cr[u>>0]<<8|cr[u+1>>0]);else f=0;or[e+60>>1]=f;do{if(0|Lf(r,4,0)){if(ji(l=0|ar[r>>2],u,4),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]|0){for(f=r;ar[(l=f+8|0)>>2]=0,ar[l+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0;break}n=0|cr[u>>0],(f=(t=0|cr[u+1>>0])<<16|n<<24|(o=0|cr[u+2>>0])<<8|(a=0|cr[u+3>>0]))?(tr[u>>0]=0,tr[u+1>>0]=0,tr[u+2>>0]=0,tr[u+3>>0]=0,tr[u+4>>0]=0,((tr[u+5>>0]=0)|tr[(l=(c=e+64|0)+11|0)>>0])<0?(tr[ar[c>>2]>>0]=0,ar[e+68>>2]=0):(tr[c>>0]=0,tr[l>>0]=0),Ml(c,0),ar[e+64>>2]=t<<8|n|o<<16|a<<24,tr[e+68>>0]=0,tr[(l=e+69|0)>>0]=0|tr[u>>0],tr[l+1>>0]=0|tr[u+1>>0],tr[l+2>>0]=0|tr[u+2>>0],tr[l+3>>0]=0|tr[u+3>>0],tr[l+4>>0]=0|tr[u+4>>0],tr[l+5>>0]=0|tr[u+5>>0],tr[e+75>>0]=4):f=0}else f=0}while(0);if(nn(u,r),(0|tr[(t=(n=e+76|0)+11|0)>>0])<0?(tr[ar[n>>2]>>0]=0,ar[e+80>>2]=0):(tr[n>>0]=0,tr[t>>0]=0),Ml(n,0),ar[n>>2]=ar[u>>2],ar[n+4>>2]=ar[u+4>>2],ar[n+8>>2]=ar[u+8>>2],1970432288<=(0|f)){switch(0|f){case 1970432288:break;default:break A}nn(u,r),(0|tr[(n=(f=e+112|0)+11|0)>>0])<0?(tr[ar[f>>2]>>0]=0,ar[e+116>>2]=0):(tr[f>>0]=0,tr[n>>0]=0),Ml(f,0),ar[f>>2]=ar[u>>2],ar[f+4>>2]=ar[u+4>>2],ar[f+8>>2]=ar[u+8>>2];break}switch(0|f){case 1835625829:break;default:break A}nn(u,r),(0|tr[(n=(f=e+88|0)+11|0)>>0])<0?(tr[ar[f>>2]>>0]=0,ar[e+92>>2]=0):(tr[f>>0]=0,tr[n>>0]=0),Ml(f,0),ar[f>>2]=ar[u>>2],ar[f+4>>2]=ar[u+4>>2],ar[f+8>>2]=ar[u+8>>2],nn(u,r),(0|tr[(n=(f=e+100|0)+11|0)>>0])<0?(tr[ar[f>>2]>>0]=0,ar[e+104>>2]=0):(tr[f>>0]=0,tr[n>>0]=0),Ml(f,0),ar[f>>2]=ar[u>>2],ar[f+4>>2]=ar[u+4>>2],ar[f+8>>2]=ar[u+8>>2]}}while(0);if(!(0|tr[r+17>>0]))return r=0|ar[(e=49920)+4>>2],ar[(u=A)>>2]=ar[e>>2],ar[u+4>>2]=r,Rl(A+8|0,49928),void(ur=i);ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,Cc(A,2,100,u),ur=(0<=(0|tr[u+11>>0])||Vl(0|ar[u>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(l=0|tr[(c=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[f>>2]),tn(f,e,r),Hf(n,(c=(l=0|tr[(u=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){$f(A|=0,e|=0,r|=0,-1)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(l=0|tr[(c=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[f>>2]),tn(f,e,r),Hf(n,(c=(l=0|tr[(u=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){$f(A|=0,e|=0,r|=0,-1)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0;if(ur=(o=ur)+160|0,a=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,Of(t,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),Pf(a,e,r),Hf(f,(c=(l=0|tr[(u=a+11|0)>>0])<<24>>24<0)?0|ar[a>>2]:a,c?0|ar[a+4>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[a>>2]),(0|(a=0|ar[e+56>>2]))!=(0|(u=0|ar[e+60>>2]))){l=a,a=0|ar[r>>2];do{if(0<(0|a))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(f,19266,26),Hf(0|qi(a,0|ar[l>>2]),26620,1),a=1+(0|ar[r>>2])|0,ar[r>>2]=a,(0|(e=0|ar[l+4>>2]))!=(0|(c=0|ar[l+8>>2])))do{if(0<(0|a))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););a=0|Hf(f,19293,16),s=(a=0|Hf(0|Li(a,0|or[e+2>>1]),19310,13))+(0|ar[(0|ar[a>>2])-12>>2])+4|0,ar[s>>2]=1|ar[s>>2],Hf(0|Pi(a,0!=(0|tr[e>>0])),17022,2),e=e+4|0,a=0|ar[r>>2]}while((0|e)!=(0|c));a=(0|a)<1?0:a+-1|0,ar[r>>2]=a,l=l+16|0}while((0|l)!=(0|u))}if(jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0,V=0,X=0,_=0,F=0;ur=(n=ur)+64|0,F=n+44|0,i=n+8|0,qf(t=(f=n)+24|0,e|=0,r|=0),(0|tr[(t=t+8|0)+11>>0])<0&&Vl(0|ar[t>>2]);A:do{if(0|Lf(r,4,0)){if(ji(V=0|ar[r>>2],F,4),5&ar[V+(0|ar[(0|ar[V>>2])-12>>2])+16>>2]|0){for(t=r;ar[(_=t+8|0)>>2]=0,ar[_+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););_=8;break}if(0<(0|(g=cr[F+1>>0]<<16|cr[F>>0]<<24|cr[F+2>>0]<<8|cr[F+3>>0]))){for(m=r+17|0,p=r+16|0,Z=8+i|0,W=e+37|0,B=e+60|0,E=e+64|0,G=e+56|0,V=y=4+i|0,b=e+40|0,d=f+2|0,k=C=12+i|0,h=I=F+1|0,w=F+2|0,v=F+3|0,s=0;;){if(0|tr[m>>0]){X=m;break A}if(0|tr[p>>0]){X=m;break A}if(ar[y>>2]=0,ar[Z>>2]=0,(ar[C>>2]=0)|tr[W>>0])if(0|Lf(r,4,0))if(ji(u=0|ar[r>>2],F,4),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(t=r;ar[(u=t+8|0)>>2]=0,ar[u+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[h>>0]<<16|cr[F>>0]<<24|cr[w>>0]<<8|cr[v>>0];else t=0;else{if(0|Lf(r,2,0))if(ji(u=0|ar[r>>2],F,2),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(t=r;ar[(u=t+8|0)>>2]=0,ar[u+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=cr[F>>0]<<8|cr[I>>0];else t=0;t&=65535}ar[i>>2]=t;do{if(0|Lf(r,1,0)){if(ji(u=0|ar[r>>2],F,1),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]|0){for(t=r;ar[(u=t+8|0)>>2]=0,ar[u+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););break}if(c=255&(u=0|tr[F>>0]),u<<24>>24){a=0;do{if(1&ar[b>>2]){if(0|Lf(r,2,0))if(ji(u=0|ar[r>>2],F,2),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(t=r;ar[(u=t+8|0)>>2]=0,ar[u+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=65535&(cr[F>>0]<<8|cr[I>>0]);else t=0;e=(65535&t)>>>15&255,o=32767}else{if(0|Lf(r,1,0))if(ji(u=0|ar[r>>2],F,1),5&ar[u+(0|ar[(0|ar[u>>2])-12>>2])+16>>2]){for(t=r;ar[(u=t+8|0)>>2]=0,ar[u+4>>2]=0,tr[t+16>>0]=1,0!=(0|(t=0|ar[t+4>>2])););t=0}else t=0|tr[F>>0];else t=0;e=(255&t)>>>7,o=127,t&=255}tr[f>>0]=e,or[d>>1]=65535&t&o,(0|(t=0|ar[Z>>2]))==(0|ar[k>>2])?yn(V,f):(u=0|ar[f>>2],or[t>>1]=u,or[t+2>>1]=u>>>16,ar[Z>>2]=4+(0|ar[Z>>2])),a=a+1|0}while((0|a)<(0|c))}}}while(0);if((0|(o=0|ar[B>>2]))==(0|ar[E>>2]))pn(G,i),t=0|ar[y>>2];else{if(ar[o>>2]=ar[i>>2],ar[(a=o+4|0)>>2]=0,ar[(u=o+8|0)>>2]=0,t=(ar[o+12>>2]=0)|ar[V>>2],c=(e=(0|ar[Z>>2])-t|0)>>2){if(1073741823<c>>>0)break;l=0|El(e),ar[u>>2]=l,ar[a>>2]=l,ar[o+12>>2]=l+(c<<2),t=0|ar[V>>2],0<(0|(e=(0|ar[Z>>2])-t|0))&&(Eu(0|l,0|t,0|e),ar[u>>2]=l+(e>>>2<<2))}ar[B>>2]=16+(0|ar[B>>2])}if(0|t&&((0|(e=0|ar[Z>>2]))!=(0|t)&&(ar[Z>>2]=e+(~((e+-4-t|0)>>>2)<<2)),Vl(t)),(0|g)<=(0|(s=s+1|0))){X=m;break A}}il()}else _=8}else _=8}while(0);if(8==(0|_)&&(X=r+17|0),!(0|tr[X>>0]))return r=0|ar[(_=49920)+4>>2],ar[(F=A)>>2]=ar[_>>2],ar[F+4>>2]=r,Rl(A+8|0,49928),void(ur=n);ar[F>>2]=0,ar[F+4>>2]=0,ar[F+8>>2]=0,Cc(A,2,100,F),ur=(0<=(0|tr[F+11>>0])||Vl(0|ar[F>>2]),n)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(o=ur)+160|0,c=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[c>>2]=0,ar[c+4>>2]=0,ar[c+8>>2]=0,Of(t,c),(0|tr[c+11>>0])<0&&Vl(0|ar[c>>2]),Pf(c,e,r),Hf(f,(u=(a=0|tr[(l=c+11|0)>>0])<<24>>24<0)?0|ar[c>>2]:c,u?0|ar[c+4>>2]:255&a),(0|tr[l>>0])<0&&Vl(0|ar[c>>2]),0<(0|ar[r>>2]))for(c=0;Hf(f,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(l=0|Hf(f,19152,13),l=0|Hf(0|qi(l,0|ar[e+56>>2]),26620,1),0<(0|ar[r>>2]))for(c=0;Hf(l,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(u=0|Hf(l,19166,14),Hf(0|qi(u,0|ar[e+60>>2]),26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f=0,n=0,t=0;if(ur=(i=ur)+32|0,n=i+20|0,qf(f=i,e|=0,r|=0),(0|tr[(f=f+8|0)+11>>0])<0&&Vl(0|ar[f>>2]),0|Lf(r,4,0))if(ji(f=0|ar[r>>2],n,4),5&ar[f+(0|ar[(0|ar[f>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+56>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+60>>2]=f,!(0|tr[r+17>>0]))return n=0|ar[(r=49920)+4>>2],ar[(t=A)>>2]=ar[r>>2],ar[t+4>>2]=n,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0;if(ur=(o=ur)+160|0,a=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,Of(t,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),Pf(a,e,r),Hf(f,(u=(l=0|tr[(c=a+11|0)>>0])<<24>>24<0)?0|ar[a>>2]:a,u?0|ar[a+4>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[a>>2]),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(f,19041,10),c=0|Hf(0|Hf(a,(u=(c=0|tr[(l=e+56|0)+11>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[e+60>>2]:255&c),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(Hf(c,19052,14),(0|(a=0|ar[e+68>>2]))!=(0|(c=0|ar[e+72>>2])))for(;u=0|tr[a>>0],l=f+(0|ar[(0|ar[f>>2])-12>>2])+4|0,ar[l>>2]=-75&ar[l>>2]|8,ar[f+(0|ar[(0|ar[f>>2])-12>>2])+12>>2]=2,ar[f+(0|ar[(0|ar[f>>2])-12>>2])+76>>2]=48,Hf(0|Ki(f,255&u),17848,1),(0|(a=a+1|0))!=(0|c););if(Hf(f,26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0;ur=(f=ur)+32|0,d=f+20|0,qf(n=f,e|=0,r|=0),(0|tr[(n=n+8|0)+11>>0])<0&&Vl(0|ar[n>>2]),nn(d,r),(0|tr[(t=(n=e+56|0)+11|0)>>0])<0?(tr[ar[n>>2]>>0]=0,ar[e+60>>2]=0):(tr[n>>0]=0,tr[t>>0]=0),Ml(n,0),ar[n>>2]=ar[d>>2],ar[n+4>>2]=ar[d+4>>2],ar[n+8>>2]=ar[d+8>>2],i=r+16|0;A:do{if(!(0|tr[i>>0])){for(s=e+68|0,b=e+72|0,u=e+76|0;;){if(0|Lf(r,1,0))if(ji(l=0|ar[r>>2],d,1),5&ar[l+(0|ar[(0|ar[l>>2])-12>>2])+16>>2]){for(n=r;ar[(l=n+8|0)>>2]=0,ar[l+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[d>>0];else n=0;if(t=0|ar[b>>2],(e=l=0|ar[u>>2])>>>0<=t>>>0){if(c=l=0|ar[s>>2],(0|(t=(a=t-l|0)+1|0))<0)break;o=(e=e-l|0)<<1,o=(t=e>>>0<1073741823?o>>>0<t>>>0?t:o:2147483647)?0|El(t):0,tr[(e=o+a|0)>>0]=n,n=e+(0-a)|0,0<(0|a)&&Eu(0|n,0|c,0|a),ar[s>>2]=n,ar[b>>2]=e+1,ar[u>>2]=o+t,0|l&&Vl(c)}else tr[t>>0]=n,ar[b>>2]=1+(0|ar[b>>2]);if(0|tr[i>>0])break A}il()}}while(0);if(!(0|tr[r+17>>0]))return r=0|ar[(b=49920)+4>>2],ar[(d=A)>>2]=ar[b>>2],ar[d+4>>2]=r,Rl(A+8|0,49928),void(ur=f);ar[d>>2]=0,ar[d+4>>2]=0,ar[d+8>>2]=0,Cc(A,2,100,d),ur=(0<=(0|tr[d+11>>0])||Vl(0|ar[d>>2]),f)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0;if(ur=(o=ur)+160|0,l=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,Of(t,l),(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2]),Pf(l,e,r),Hf(f,(u=(c=0|tr[(a=l+11|0)>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[l+4>>2]:255&c),(0|tr[a>>0])<0&&Vl(0|ar[l>>2]),0<(0|ar[r>>2]))for(l=0;Hf(f,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(u=0|Hf(f,18929,10),Hf(0|Ki(u,0|ar[e+56>>2]),18940,15),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0,e|=0;var i,f=0,n=0,t=0;if(ur=(i=ur)+16|0,n=i,0|Lf(r|=0,1,0))if(ji(f=0|ar[r>>2],n,1),5&ar[f+(0|ar[(0|ar[f>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=0|tr[n>>0];else f=0;if(ar[e+56>>2]=90*(3&f),!(0|tr[r+17>>0]))return n=0|ar[(r=49920)+4>>2],ar[(t=A)>>2]=ar[r>>2],ar[t+4>>2]=n,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l,u=0;if(ur=(o=ur)+160|0,u=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[u>>2]=0,ar[u+4>>2]=0,ar[u+8>>2]=0,Of(t,u),(0|tr[u+11>>0])<0&&Vl(0|ar[u>>2]),Pf(u,e,r),Hf(f,(l=(c=0|tr[(a=u+11|0)>>0])<<24>>24<0)?0|ar[u>>2]:u,l?0|ar[u+4>>2]:255&c),(0|tr[a>>0])<0&&Vl(0|ar[u>>2]),0<(0|ar[r>>2]))for(u=0;Hf(f,16980,2),(0|(u=u+1|0))<(0|ar[r>>2]););switch(Hf(f,18808,13),0|tr[e+56>>0]){case 0:Hf(f,18822,9);break;case 1:Hf(f,18832,11)}if(jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0,e|=0;var i,f=0,n=0,t=0;if(ur=(i=ur)+16|0,n=i,0|Lf(r|=0,1,0))if(ji(f=0|ar[r>>2],n,1),5&ar[f+(0|ar[(0|ar[f>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=0|tr[n>>0];else f=0;if(tr[e+56>>0]=1&f,!(0|tr[r+17>>0]))return n=0|ar[(r=49920)+4>>2],ar[(t=A)>>2]=ar[r>>2],ar[t+4>>2]=n,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c,l=0,u=0;if(ur=(o=ur)+160|0,l=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[l>>2]=0,ar[l+4>>2]=0,ar[l+8>>2]=0,Of(t,l),(0|tr[l+11>>0])<0&&Vl(0|ar[l>>2]),Pf(l,e,r),Hf(f,(u=(c=0|tr[(a=l+11|0)>>0])<<24>>24<0)?0|ar[l>>2]:l,u?0|ar[l+4>>2]:255&c),(0|tr[a>>0])<0&&Vl(0|ar[l>>2]),0<(0|ar[r>>2]))for(l=0;Hf(f,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(u=0|Hf(f,18687,16),u=0|Hf(0|Ki(u,0|ar[e+56>>2]),18704,1),u=0|Hf(0|Ki(u,0|ar[e+60>>2]),18706,3),u=0|Hf(0|Ki(u,0|ar[e+64>>2]),18704,1),Hf(0|Ki(u,0|ar[e+68>>2]),26620,1),0<(0|ar[r>>2]))for(l=0;Hf(f,16980,2),(0|(l=l+1|0))<(0|ar[r>>2]););if(u=0|Hf(f,18710,8),u=0|Hf(0|Ki(u,0|ar[e+72>>2]),18704,1),u=0|Hf(0|Ki(u,0|ar[e+76>>2]),18719,3),u=0|Hf(0|Ki(u,0|ar[e+80>>2]),18704,1),Hf(0|Ki(u,0|ar[e+84>>2]),26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0,e|=0;var i,f=0,n=0,t=0;if(ur=(i=ur)+16|0,n=i,0|Lf(r|=0,4,0))if(ji(f=0|ar[r>>2],n,4),5&ar[f+(0|ar[(0|ar[f>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+56>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+60>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+64>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+68>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+72>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+76>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+80>>2]=f,0|Lf(r,4,0))if(ji(t=0|ar[r>>2],n,4),5&ar[t+(0|ar[(0|ar[t>>2])-12>>2])+16>>2]){for(f=r;ar[(t=f+8|0)>>2]=0,ar[t+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[n+1>>0]<<16|cr[n>>0]<<24|cr[n+2>>0]<<8|cr[n+3>>0];else f=0;if(ar[e+84>>2]=f,!(0|tr[r+17>>0]))return n=0|ar[(r=49920)+4>>2],ar[(t=A)>>2]=ar[r>>2],ar[t+4>>2]=n,Rl(A+8|0,49928),void(ur=i);ar[n>>2]=0,ar[n+4>>2]=0,ar[n+8>>2]=0,Cc(A,2,100,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(s=0|tr[(b=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&s),(0|tr[b>>0])<0&&Vl(0|ar[f>>2]),(0|(c=0|ar[e+56>>2]))!=(0|(u=0|ar[e+60>>2]))){s=11+f|0,b=4+f|0;do{if(0<(0|ar[r>>2]))for(e=0;Hf(n,16980,2),(0|(e=e+1|0))<(0|ar[r>>2]););if(d=0|Hf(n,18557,21),xf(f,c),l=0|Hf(0|Hf(0|Hf(d,(e=(l=0|tr[s>>0])<<24>>24<0)?0|ar[f>>2]:f,e?0|ar[b>>2]:255&l),18579,1),18581,10),Hf(0|qi(l,0|ar[c+48>>2]),18592,9),(0|tr[s>>0])<0&&Vl(0|ar[f>>2]),(0|(e=0|ar[c+52>>2]))!=(0|(l=0|ar[c+56>>2])))for(;Hf(0|qi(n,0|ar[e>>2]),17848,1),(0|(e=e+4|0))!=(0|l););Hf(n,26620,1),c=c+64|0}while((0|c)!=(0|u))}if(jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){A|=0;var i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I=0,B=0,E=0,G=0,V=0,X=0;for(ur=(W=ur)+112|0,C=W+88|0,V=(G=W)+64|0,qf(I=W+68|0,e|=0,r|=0),(0|tr[(I=I+8|0)+11>>0])<0&&Vl(0|ar[I>>2]),u=r+16|0,s=G+8|0,b=G+40|0,k=G+56|0,w=e+37|0,g=G+48|0,m=h=G+60|0,p=d=G+52|0,y=e+60|0,Z=e+64|0,i=e+56|0,n=11+(f=A+8|0)|0,t=v=1+C|0,o=2+C|0,a=3+C|0,c=G+24|0,l=G+28|0;!(0|tr[u>>0]);){if(ar[G>>2]=3840,ar[b>>2]=0,ar[s>>2]=0,ar[4+s>>2]=0,ar[8+s>>2]=0,ar[12+s>>2]=0,ar[16+s>>2]=0,ar[20+s>>2]=0,ar[24+s>>2]=0,or[28+s>>1]=0,ar[d>>2]=0,ar[k>>2]=0,ar[h>>2]=0,rn(A,G,r),(0|ar[A>>2])==(0|ar[12480])){do{if(0|tr[w>>0]){if(0|Lf(r,4,0))if(ji(E=0|ar[r>>2],C,4),5&ar[E+(0|ar[(0|ar[E>>2])-12>>2])+16>>2]){for(I=r;ar[(E=I+8|0)>>2]=0,ar[E+4>>2]=0,tr[I+16>>0]=1,0!=(0|(I=0|ar[I+4>>2])););I=0}else I=cr[t>>0]<<16|cr[C>>0]<<24|cr[o>>0]<<8|cr[a>>0];else I=0;if(ar[g>>2]=I,0|Lf(r,2,0)){if(ji(E=0|ar[r>>2],C,2),5&ar[E+(0|ar[(0|ar[E>>2])-12>>2])+16>>2]|0){for(I=r;ar[(E=I+8|0)>>2]=0,ar[E+4>>2]=0,tr[I+16>>0]=1,0!=(0|(I=0|ar[I+4>>2])););break}if(0|(E=cr[C>>0]<<8|cr[v>>0])){B=0;do{if(0|Lf(r,4,0))if(ji(e=0|ar[r>>2],C,4),5&ar[e+(0|ar[(0|ar[e>>2])-12>>2])+16>>2]){for(I=r;ar[(e=I+8|0)>>2]=0,ar[e+4>>2]=0,tr[I+16>>0]=1,0!=(0|(I=0|ar[I+4>>2])););I=0}else I=cr[t>>0]<<16|cr[C>>0]<<24|cr[o>>0]<<8|cr[a>>0];else I=0;ar[V>>2]=I,(e=0|ar[k>>2])>>>0<(0|ar[m>>2])>>>0?(ar[e>>2]=I,ar[k>>2]=e+4):Kf(p,V),B=B+1|0}while(0==(0|tr[u>>0])&(0|B)<(0|E))}}}else{if(0|Lf(r,2,0))if(ji(E=0|ar[r>>2],C,2),5&ar[E+(0|ar[(0|ar[E>>2])-12>>2])+16>>2]){for(I=r;ar[(E=I+8|0)>>2]=0,ar[E+4>>2]=0,tr[I+16>>0]=1,0!=(0|(I=0|ar[I+4>>2])););I=0}else I=cr[C>>0]<<8|cr[v>>0];else I=0;if(ar[g>>2]=65535&I,0|Lf(r,2,0)){if(ji(E=0|ar[r>>2],C,2),5&ar[E+(0|ar[(0|ar[E>>2])-12>>2])+16>>2]|0){for(I=r;ar[(E=I+8|0)>>2]=0,ar[E+4>>2]=0,tr[I+16>>0]=1,0!=(0|(I=0|ar[I+4>>2])););break}if(0|(E=cr[C>>0]<<8|cr[v>>0])){B=0;do{if(0|Lf(r,2,0))if(ji(e=0|ar[r>>2],C,2),5&ar[e+(0|ar[(0|ar[e>>2])-12>>2])+16>>2]){for(I=r;ar[(e=I+8|0)>>2]=0,ar[e+4>>2]=0,tr[I+16>>0]=1,0!=(0|(I=0|ar[I+4>>2])););I=0}else I=cr[C>>0]<<8|cr[v>>0];else I=0;I&=65535,ar[V>>2]=I,(e=0|ar[k>>2])>>>0<(0|ar[m>>2])>>>0?(ar[e>>2]=I,ar[k>>2]=e+4):Kf(p,V),B=B+1|0}while(0==(0|tr[u>>0])&(0|B)<(0|E))}}}}while(0);(0|(I=0|ar[y>>2]))==(0|ar[Z>>2])?vn(i,G):(wn(I,G),ar[y>>2]=64+(0|ar[y>>2])),B=((0|tr[n>>0])<0&&Vl(0|ar[f>>2]),0)}else B=1;if(0|(I=0|ar[d>>2])&&((0|(e=0|ar[k>>2]))!=(0|I)&&(ar[k>>2]=e+(~((e+-4-I|0)>>>2)<<2)),Vl(I)),ar[G>>2]=3840,0|(I=0|ar[c>>2])&&((0|ar[l>>2])!=(0|I)&&(ar[l>>2]=I),Vl(I)),1==(0|B)){X=64;break}}ur=(64!=(0|X)&&(0|tr[r+17>>0]?(ar[C>>2]=0,ar[4+C>>2]=0,ar[8+C>>2]=0,Cc(A,2,100,C),(0|tr[11+C>>0])<0&&Vl(0|ar[C>>2])):(V=0|ar[(G=49920)+4>>2],ar[(X=A)>>2]=ar[G>>2],ar[X+4>>2]=V,Rl(f,49928))),W)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(o=ur)+160|0,c=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[c>>2]=0,ar[c+4>>2]=0,ar[c+8>>2]=0,Of(t,c),(0|tr[c+11>>0])<0&&Vl(0|ar[c>>2]),Pf(c,e,r),Hf(f,(u=(l=0|tr[(a=c+11|0)>>0])<<24>>24<0)?0|ar[c>>2]:c,u?0|ar[c+4>>2]:255&l),(0|tr[a>>0])<0&&Vl(0|ar[c>>2]),0<(0|ar[r>>2]))for(c=0;Hf(f,16980,2),(0|(c=c+1|0))<(0|ar[r>>2]););if(l=0|Hf(f,17935,22),Hf(0|$i(l,u=0|gu(0|ar[(u=e+8|0)>>2],0|ar[u+4>>2],0|ar[e+16>>2],0),D),26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0,e|=0;var i,f=0;if(ur=(i=ur)+16|0,function(A,e){e|=0;var r,i,f,n=0;r=ur=(i=ur)+31&-32,ur=ur+32|0,f=16+r|0,ar[(n=A|=0)>>2]=0,ar[n+4>>2]=0,ar[(n=A+8|0)>>2]=-1,ar[n+4>>2]=-1,Si(f,e,1),0|tr[f>>0]&&(n=0|ar[e+(0|ar[(0|ar[e>>2])-12>>2])+24>>2],gs[15&ar[16+(0|ar[n>>2])>>2]](r,n,0,0,1,8),ar[A>>2]=ar[r>>2],ar[A+4>>2]=ar[4+r>>2],ar[A+8>>2]=ar[8+r>>2],ar[A+12>>2]=ar[12+r>>2]),ur=i}(f=i,0|ar[(r|=0)>>2]),ar[(e=e+56|0)>>2]=ar[f>>2],ar[e+4>>2]=ar[f+4>>2],ar[e+8>>2]=ar[f+8>>2],ar[e+12>>2]=ar[f+12>>2],!(0|tr[r+17>>0]))return r=0|ar[(e=49920)+4>>2],ar[(f=A)>>2]=ar[e>>2],ar[f+4>>2]=r,Rl(A+8|0,49928),void(ur=i);ar[f>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,Cc(A,2,100,f),ur=(0<=(0|tr[f+11>>0])||Vl(0|ar[f>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0,s=0,b=0,d=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(s=0|tr[(b=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&s),(0|tr[b>>0])<0&&Vl(0|ar[f>>2]),(0|(c=0|ar[e+56>>2]))!=(0|(u=0|ar[e+60>>2]))){s=11+f|0,b=4+f|0;do{if(0<(0|ar[r>>2]))for(e=0;Hf(n,16980,2),(0|(e=e+1|0))<(0|ar[r>>2]););if(d=0|Hf(n,17807,12),xf(f,c),l=0|Hf(0|Hf(d,(e=(l=0|tr[s>>0])<<24>>24<0)?0|ar[f>>2]:f,e?0|ar[b>>2]:255&l),26620,1),0<(0|ar[r>>2]))for(e=0;Hf(l,16980,2),(0|(e=e+1|0))<(0|ar[r>>2]););if(l=0|Hf(l,17820,12),l=0|Hf(0|qi(l,0|ar[c+48>>2]),26620,1),0<(0|ar[r>>2]))for(e=0;Hf(l,16980,2),(0|(e=e+1|0))<(0|ar[r>>2]););if(Hf(l,17833,14),(0|tr[s>>0])<0&&Vl(0|ar[f>>2]),(0|(e=0|ar[c+52>>2]))!=(0|(l=0|ar[c+56>>2])))for(;Hf(0|qi(n,0|ar[e>>2]),17848,1),(0|(e=e+4|0))!=(0|l););Hf(n,26620,1),c=c+64|0}while((0|c)!=(0|u))}if(jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){var i,f,n,t,o,a,c,l,u,s,b,d,k,h,w,v,g,m,p,y,Z,C,W,I=0,B=0,E=0,G=0,V=0,X=0;for(ur=(W=ur)+96|0,y=(p=W)+84|0,Z=(r|=0)+16|0,C=p+8|0,G=p+40|0,a=p+56|0,u=8+(m=W+64|0)|0,s=11+(l=(A|=0)+8|0)|0,b=A+12|0,d=1+m|0,k=2+m|0,h=3+m|0,w=p+48|0,v=(e|=0)+60|0,g=e+64|0,i=e+56|0,f=c=p+60|0,n=V=p+52|0,t=p+24|0,o=p+28|0;!(0|tr[Z>>0]);){if(ar[p>>2]=3840,ar[G>>2]=0,ar[C>>2]=0,ar[4+C>>2]=0,ar[8+C>>2]=0,ar[12+C>>2]=0,ar[16+C>>2]=0,ar[20+C>>2]=0,ar[24+C>>2]=0,or[28+C>>1]=0,ar[V>>2]=0,ar[a>>2]=0,ar[c>>2]=0,rn(A,p,r),(0|ar[A>>2])==(0|ar[12480]))if(qf(m,p,r),B=0|ar[(I=m)+4>>2],ar[(E=A)>>2]=ar[I>>2],ar[E+4>>2]=B,(0|tr[s>>0])<0?(tr[ar[l>>2]>>0]=0,ar[b>>2]=0):(tr[l>>0]=0,tr[s>>0]=0),Ml(l,0),ar[l>>2]=ar[u>>2],ar[4+l>>2]=ar[4+u>>2],ar[8+l>>2]=ar[8+u>>2],(0|ar[A>>2])==(0|ar[12480])){if(0|Lf(r,4,0))if(ji(E=0|ar[r>>2],m,4),5&ar[E+(0|ar[(0|ar[E>>2])-12>>2])+16>>2]){for(e=r;ar[(E=e+8|0)>>2]=0,ar[E+4>>2]=0,tr[e+16>>0]=1,0!=(0|(e=0|ar[e+4>>2])););e=0}else e=cr[d>>0]<<16|cr[m>>0]<<24|cr[k>>0]<<8|cr[h>>0];else e=0;ar[w>>2]=e;A:do{if(0|Lf(r,4,0)){if(ji(E=0|ar[r>>2],m,4),5&ar[E+(0|ar[(0|ar[E>>2])-12>>2])+16>>2]|0){for(e=r;ar[(E=e+8|0)>>2]=0,ar[E+4>>2]=0,tr[e+16>>0]=1,0!=(0|(e=0|ar[e+4>>2])););break}if(0<(0|(E=cr[d>>0]<<16|cr[m>>0]<<24|cr[k>>0]<<8|cr[h>>0]))){B=0;do{if(0|tr[Z>>0])break A;if(0|Lf(r,4,0))if(ji(I=0|ar[r>>2],m,4),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(e=r;ar[(I=e+8|0)>>2]=0,ar[I+4>>2]=0,tr[e+16>>0]=1,0!=(0|(e=0|ar[e+4>>2])););e=0}else e=cr[d>>0]<<16|cr[m>>0]<<24|cr[k>>0]<<8|cr[h>>0];else e=0;ar[y>>2]=e,(I=0|ar[a>>2])>>>0<(0|ar[f>>2])>>>0?(ar[I>>2]=e,ar[a>>2]=I+4):Kf(n,y),B=B+1|0}while((0|B)<(0|E))}}}while(0);(0|(e=0|ar[v>>2]))==(0|ar[g>>2])?cn(i,p):(an(e,p),ar[v>>2]=64+(0|ar[v>>2])),B=((0|tr[s>>0])<0&&Vl(0|ar[l>>2]),0)}else B=1;else B=1;if(0|(e=0|ar[V>>2])&&((0|(I=0|ar[a>>2]))!=(0|e)&&(ar[a>>2]=I+(~((I+-4-e|0)>>>2)<<2)),Vl(e)),ar[p>>2]=3840,0|(e=0|ar[t>>2])&&((0|ar[o>>2])!=(0|e)&&(ar[o>>2]=e),Vl(e)),1==(0|B)){X=47;break}}ur=(47!=(0|X)&&(0|tr[r+17>>0]?(ar[m>>2]=0,ar[4+m>>2]=0,ar[8+m>>2]=0,Cc(A,2,100,m),(0|tr[11+m>>0])<0&&Vl(0|ar[m>>2])):(V=0|ar[(G=49920)+4>>2],ar[(X=A)>>2]=ar[G>>2],ar[X+4>>2]=V,Rl(l,49928))),W)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(l=0|tr[(c=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[f>>2]),tn(f,e,r),Hf(n,(c=(l=0|tr[(u=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){$f(A|=0,e|=0,r|=0,-1)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a,c=0,l=0,u=0;if(ur=(a=ur)+160|0,f=a+136|0,t=(n=a)+56|0,o=n+4|0,ar[n>>2]=268,ar[t>>2]=288,Yi(n+56|0,o),ar[n+128>>2]=0,ar[n+132>>2]=-1,ar[n>>2]=3872,ar[t>>2]=3892,Ti(o),ar[o>>2]=3908,ar[(i=n+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[n+52>>2]=16,ar[f>>2]=0,ar[4+f>>2]=0,ar[8+f>>2]=0,Of(o,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),Pf(f,e,r),Hf(n,(u=(l=0|tr[(c=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,u?0|ar[4+f>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[f>>2]),tn(f,e,r),Hf(n,(c=(l=0|tr[(u=11+f|0)>>0])<<24>>24<0)?0|ar[f>>2]:f,c?0|ar[4+f>>2]:255&l),(0|tr[u>>0])<0&&Vl(0|ar[f>>2]),jf(A,o),ar[n>>2]=3872,ar[t>>2]=3892,ar[o>>2]=3908,0<=(0|tr[11+i>>0]))return si(o),ci(t),void(ur=a);Vl(0|ar[i>>2]),si(o),ci(t),ur=a},function(A,e,r){A|=0;var i,f=0,n=0;if(ur=(i=ur)+32|0,f=i+20|0,qf(n=i,e|=0,r|=0),(0|tr[(n=n+8|0)+11>>0])<0&&Vl(0|ar[n>>2]),!(0|Lf(r,4,0)))return $f(A,e,r,n=0),void(ur=i);if(ji(n=0|ar[r>>2],f,4),5&ar[n+(0|ar[(0|ar[n>>2])-12>>2])+16>>2]){for(f=r;ar[(n=f+8|0)>>2]=0,ar[n+4>>2]=0,tr[f+16>>0]=1,0!=(0|(f=0|ar[f+4>>2])););f=0}else f=cr[f+1>>0]<<16|cr[f>>0]<<24|cr[f+2>>0]<<8|cr[f+3>>0];$f(A,e,r,n=f),ur=i},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0;if(ur=(o=ur)+160|0,a=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,Of(t,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),Pf(a,e,r),Hf(f,(u=(l=0|tr[(c=a+11|0)>>0])<<24>>24<0)?0|ar[a>>2]:a,u?0|ar[a+4>>2]:255&l),(0|tr[c>>0])<0&&Vl(0|ar[a>>2]),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(r=0|Hf(f,17543,10),Hf(0|Hf(r,(l=(u=0|tr[(c=e+56|0)+11>>0])<<24>>24<0)?0|ar[c>>2]:c,l?0|ar[e+60>>2]:255&u),26620,1),jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0;var i,f,n=0,t=0;if(ur=(f=ur)+32|0,t=f+20|0,qf(n=f,e|=0,r|=0),(0|tr[(n=n+8|0)+11>>0])<0&&Vl(0|ar[n>>2]),nn(t,r),(0|tr[(i=(n=e+56|0)+11|0)>>0])<0?(tr[ar[n>>2]>>0]=0,ar[e+60>>2]=0):(tr[n>>0]=0,tr[i>>0]=0),Ml(n,0),ar[n>>2]=ar[t>>2],ar[n+4>>2]=ar[t+4>>2],ar[n+8>>2]=ar[t+8>>2],!(0|tr[r+17>>0]))return r=0|ar[(e=49920)+4>>2],ar[(t=A)>>2]=ar[e>>2],ar[t+4>>2]=r,Rl(A+8|0,49928),void(ur=f);ar[t>>2]=0,ar[t+4>>2]=0,ar[t+8>>2]=0,Cc(A,2,100,t),ur=(0<=(0|tr[t+11>>0])||Vl(0|ar[t>>2]),f)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0;if(ur=(o=ur)+160|0,b=o+136|0,n=(f=o)+56|0,t=f+4|0,ar[f>>2]=268,ar[n>>2]=288,Yi(f+56|0,t),ar[f+128>>2]=0,ar[f+132>>2]=-1,ar[f>>2]=3872,ar[n>>2]=3892,Ti(t),ar[t>>2]=3908,ar[(i=f+36|0)>>2]=0,ar[4+i>>2]=0,ar[8+i>>2]=0,ar[12+i>>2]=0,ar[f+52>>2]=16,ar[b>>2]=0,ar[b+4>>2]=0,ar[b+8>>2]=0,Of(t,b),(0|tr[b+11>>0])<0&&Vl(0|ar[b>>2]),Pf(b,e,r),Hf(f,(l=(u=0|tr[(s=b+11|0)>>0])<<24>>24<0)?0|ar[b>>2]:b,l?0|ar[b+4>>2]:255&u),(0|tr[s>>0])<0&&Vl(0|ar[b>>2]),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(f,18043,23),c=0|Hf(0|Ki(c,0|cr[e+56>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18067,23),c=0|Hf(0|Ki(c,0|cr[e+57>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18091,19),c=0|Hf(0|Pi(c,0!=(0|tr[e+58>>0])),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(s=0|Hf(c,18111,21),Hf(0|Ki(s,0|cr[e+59>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););for(Hf(f,18133,37),c=e+60|0,a=0;qi(f,(0|ar[c>>2])>>>(31-a|0)&1),7!=((0|a)%8|0)?3==((0|a)%4|0)&&(tr[b>>0]=46,Hf(f,b,1)):(tr[b>>0]=32,Hf(f,b,1)),(0|(a=a+1|0))<32;);if(Hf(f,26620,1),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););Hf(f,18171,36),s=(l=0|ar[e+64>>2])+((a=(u=0|ar[e+68>>2])>>>5)<<2)|0,u&=31,c=0!=(0|a);A:do{if(a|u|0){if(!u)for(a=0;;){e:do{if(c)for(c=0;Ki(f,0!=(ar[l>>2]&1<<c|0)&1),7&(a=a+1|0)||(tr[b>>0]=32,Hf(f,b,1)),31!=(0|c);)c=c+1|0;else for(c=0;;){if(Ki(f,0!=(ar[l>>2]&1<<c|0)&1),7&(a=a+1|0)||(tr[b>>0]=32,Hf(f,b,1)),c=(u=c)+1|0,31==(0|u))break e;if(!c)break A}}while(0);if((0|(l=l+4|0))==(0|s))break A;c=1}if(c){a=0;do{for(c=0;Ki(f,0!=(ar[l>>2]&1<<c|0)&1),7&(a=a+1|0)||(tr[b>>0]=32,Hf(f,b,1)),31!=(0|c);)c=c+1|0;l=l+4|0}while((0|l)!=(0|s))}else a=0;for(c=0;Ki(f,0!=(ar[l>>2]&1<<c|0)&1),7&(a=a+1|0)||(tr[b>>0]=32,Hf(f,b,1)),(0|(c=c+1|0))!=(0|u););}}while(0);if(Hf(f,26620,1),0<(0|ar[r>>2]))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(f,18208,19),c=0|Hf(0|Ki(c,0|cr[e+76>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18228,30),c=0|Hf(0|Li(c,0|or[e+78>>1]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18259,18),c=0|Hf(0|Ki(c,0|cr[e+80>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18278,15),c=0|Hf(0|Ki(c,0|cr[e+81>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18294,16),c=0|Hf(0|Ki(c,0|cr[e+82>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18311,18),c=0|Hf(0|Ki(c,0|cr[e+83>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18330,16),c=0|Hf(0|Li(c,0|or[e+84>>1]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18347,21),c=0|Hf(0|Ki(c,0|cr[e+86>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18369,21),c=0|Hf(0|Ki(c,0|cr[e+87>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18391,20),c=0|Hf(0|Ki(c,0|cr[e+88>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(a=0|Hf(c,18412,13),Hf(0|Ki(a,0|cr[e+89>>0]),26620,1),(0|(a=0|ar[e+92>>2]))!=(0|(b=0|ar[e+96>>2]))){s=a,a=0|ar[r>>2];do{if(0<(0|a))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(Hf(f,18426,8),e=0|ar[r>>2],ar[r>>2]=e+1,-1<(0|e))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(f,18435,20),c=0|Hf(0|Ki(c,0|cr[s>>0]),26620,1),0<(0|ar[r>>2]))for(a=0;Hf(c,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if(c=0|Hf(c,18456,15),Hf(0|Ki(c,0|cr[s+1>>0]),26620,1),c=0|ar[s+4>>2],u=0|ar[s+8>>2],a=0|ar[r>>2],(0|c)!=(0|u))do{if(0<(0|a))for(a=0;Hf(f,16980,2),(0|(a=a+1|0))<(0|ar[r>>2]););if((0|(a=0|ar[c>>2]))!=(0|(l=0|ar[c+4>>2])))for(;e=0|tr[a>>0],ar[f+(0|ar[(0|ar[f>>2])-12>>2])+76>>2]=48,ar[f+(0|ar[(0|ar[f>>2])-12>>2])+12>>2]=2,d=f+(0|ar[(0|ar[f>>2])-12>>2])+4|0,ar[d>>2]=-75&ar[d>>2]|8,Hf(0|Ki(f,255&e),17848,1),(0|(a=a+1|0))!=(0|l););Hf(f,26620,1),a=f+(0|ar[(0|ar[f>>2])-12>>2])+4|0,ar[a>>2]=-75&ar[a>>2]|2,c=c+12|0,a=0|ar[r>>2]}while((0|c)!=(0|u));a=(0|a)<1?0:a+-1|0,ar[r>>2]=a,s=s+16|0}while((0|s)!=(0|b))}if(jf(A,t),ar[f>>2]=3872,ar[n>>2]=3892,ar[t>>2]=3908,0<=(0|tr[11+i>>0]))return si(t),ci(n),void(ur=o);Vl(0|ar[i>>2]),si(t),ci(n),ur=o},function(A,e,r){A|=0,e|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0,Z=0,C=0,W=0,I=0,B=0,E=0,G=0;if(ur=(f=ur)+48|0,G=f+32|0,i=f+16|0,E=f,0|Lf(r|=0,1,0))if(ji(B=0|ar[r>>2],G,1),5&ar[B+(0|ar[(0|ar[B>>2])-12>>2])+16>>2]){for(n=r;ar[(B=n+8|0)>>2]=0,ar[B+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(tr[e+56>>0]=n,0|Lf(r,1,0))if(ji(B=0|ar[r>>2],G,1),5&ar[B+(0|ar[(0|ar[B>>2])-12>>2])+16>>2]){for(n=r;ar[(B=n+8|0)>>2]=0,ar[B+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(B=255&n,tr[e+57>>0]=(255&n)>>>6,tr[e+58>>0]=B>>>5&1,tr[e+59>>0]=31&B,0|Lf(r,4,0)){if(ji(B=0|ar[r>>2],G,4),5&ar[B+(0|ar[(0|ar[B>>2])-12>>2])+16>>2]){for(n=r;ar[(B=n+8|0)>>2]=0,ar[B+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[G+1>>0]<<16|cr[G>>0]<<24|cr[G+2>>0]<<8|cr[G+3>>0];B=r}else n=0,B=r;for(ar[e+60>>2]=n,o=e+64|0,t=0;;){if(a=(0|t)<6,0|Lf(r,1,0))if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(!a)break;Z=255&n,W=t<<3,I=0|ar[o>>2],y=1<<(24&W),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=128&Z|0?p|y:p&~y,y=1<<(24&W|1),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=64&Z|0?p|y:p&~y,y=1<<(24&W|2),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=32&Z|0?p|y:p&~y,y=1<<(24&W|3),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=16&Z|0?p|y:p&~y,y=1<<(24&W|4),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=8&Z|0?p|y:p&~y,y=1<<(24&W|5),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=4&Z|0?p|y:p&~y,y=1<<(24&W|6),p=0|ar[(C=I+((t>>>2&134217727)<<2)|0)>>2],ar[C>>2]=2&Z|0?p|y:p&~y,W=1<<(24&W|7),C=0|ar[(I=I+((t>>>2&134217727)<<2)|0)>>2],ar[I>>2]=1&Z|0?C|W:C&~W,t=t+1|0}if(tr[e+76>>0]=n,0|Lf(r,2,0))if(ji(I=0|ar[B>>2],G,2),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=65535&(cr[G>>0]<<8|cr[G+1>>0]);else n=0;if(or[e+78>>1]=4095&n,0|Lf(r,1,0))if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(tr[e+80>>0]=3&n,0|Lf(r,1,0))if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(tr[e+81>>0]=3&n,0|Lf(r,1,0))if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(tr[e+82>>0]=7&n|8,0|Lf(r,1,0))if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;if(tr[e+83>>0]=7&n|8,0|Lf(r,2,0))if(ji(I=0|ar[B>>2],G,2),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=65535&(cr[G>>0]<<8|cr[G+1>>0]);else n=0;if(or[e+84>>1]=n,0|Lf(r,1,0))if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]){for(n=r;ar[(I=n+8|0)>>2]=0,ar[I+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;I=255&n,tr[e+86>>0]=(255&n)>>>6,tr[e+87>>0]=I>>>3&7,tr[e+88>>0]=I>>>2&1,tr[e+89>>0]=1+(3&I);A:do{if(0|Lf(r,1,0)){if(ji(I=0|ar[B>>2],G,1),5&ar[I+(0|ar[(0|ar[I>>2])-12>>2])+16>>2]|0){for(n=r;ar[(E=n+8|0)>>2]=0,ar[E+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););break}if(k=255&(I=0|tr[G>>0]),I<<24>>24){h=r+17|0,v=8+i|0,m=1+i|0,p=G+1|0,y=e+96|0,Z=e+100|0,W=g=12+i|0,I=C=w=4+i|0,u=e+92|0,s=E+4|0,d=b=E+8|0,l=0;do{if(0|tr[h>>0])break A;if(0|Lf(r,1,0))if(ji(c=0|ar[B>>2],G,1),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=0|tr[G>>0];else n=0;ar[w>>2]=0,ar[v>>2]=0,ar[g>>2]=0,c=255&n,tr[i>>0]=c>>>6&1,tr[m>>0]=63&c;do{if(0|Lf(r,2,0)){if(ji(c=0|ar[B>>2],G,2),5&ar[c+(0|ar[(0|ar[c>>2])-12>>2])+16>>2]){for(n=r;ar[(c=n+8|0)>>2]=0,ar[c+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););n=0}else n=cr[G>>0]<<8|cr[p>>0];if(0==(0|(c=65535&n))|0!=(0|tr[h>>0]))break;e=0;do{ar[E>>2]=0,ar[s>>2]=0,ar[b>>2]=0;do{if(0|Lf(r,2,0)){if(ji(a=0|ar[B>>2],G,2),5&ar[a+(0|ar[(0|ar[a>>2])-12>>2])+16>>2]|0){for(n=r;ar[(a=n+8|0)>>2]=0,ar[a+4>>2]=0,tr[n+16>>0]=1,0!=(0|(n=0|ar[n+4>>2])););break}if(!(a=cr[G>>0]<<8|cr[p>>0]))break;if(0|Lf(r,a,0)){t=(o=0|ar[s>>2])-(n=0|ar[E>>2])|0;do{if(t>>>0<a>>>0)dn(E,a-t|0),n=0|ar[E>>2];else{if(t>>>0<=a>>>0)break;if((0|o)==(0|(t=n+a|0)))break;ar[s>>2]=t}}while(0);ji(0|ar[B>>2],n,a)}if((n=0|ar[v>>2])>>>0<(0|ar[W>>2])>>>0){ar[n>>2]=0,ar[(a=n+4|0)>>2]=0,ar[n+8>>2]=0,ar[n>>2]=ar[E>>2],ar[a>>2]=ar[s>>2],ar[n+8>>2]=ar[d>>2],ar[d>>2]=0,ar[s>>2]=0,ar[E>>2]=0,ar[v>>2]=12+(0|ar[v>>2]);break}kn(C,E);break}}while(0);0|(n=0|ar[E>>2])&&((0|ar[s>>2])!=(0|n)&&(ar[s>>2]=n),Vl(n)),e=e+1|0}while(!((0|c)<=(0|e)|0!=(0|tr[h>>0])))}}while(0);n=0|ar[y>>2];do{if(n>>>0<(0|ar[Z>>2])>>>0)or[n>>1]=0|or[i>>1],ar[(e=n+4|0)>>2]=0,ar[(c=n+8|0)>>2]=0,ar[n+12>>2]=0,ar[e>>2]=ar[C>>2],ar[c>>2]=ar[v>>2],ar[n+12>>2]=ar[W>>2],ar[W>>2]=0,ar[v>>2]=0,ar[C>>2]=0,ar[y>>2]=16+(0|ar[y>>2]);else{if(bn(u,i),!(n=0|ar[I>>2]))break;if((0|(t=0|ar[v>>2]))!=(0|n)){for(;o=t+-12|0,ar[v>>2]=o,(0|(t=(a=0|ar[o>>2])?((0|ar[(t=t+-8|0)>>2])!=(0|a)&&(ar[t>>2]=a),Vl(a),0|ar[v>>2]):o))!=(0|n););n=0|ar[I>>2]}Vl(n)}}while(0);l=l+1|0}while((0|l)<(0|k))}}}while(0);if(0==(0|(t=0|ar[(n=a=r+8|0)>>2]))&0==(0|(n=0|ar[n+4>>2]))||((o=0|ar[r+4>>2])&&(Lf(o,t,n),t=0|ar[(n=a)>>2],n=0|ar[n+4>>2]),zi(0|ar[B>>2],t,n,1),ar[(E=a)>>2]=0,ar[E+4>>2]=0),tr[r+16>>0]=1,!(0|tr[r+17>>0]))return r=0|ar[(E=49920)+4>>2],ar[(G=A)>>2]=ar[E>>2],ar[G+4>>2]=r,Rl(A+8|0,49928),void(ur=f);ar[G>>2]=0,ar[G+4>>2]=0,ar[G+8>>2]=0,Cc(A,2,100,G),ur=(0<=(0|tr[G+11>>0])||Vl(0|ar[G>>2]),f)},function(A,e,r){e|=0,r|=0;var i,f,n,t,o=0;for(ur=(n=ur)+16|0,i=n+12|0,f=n,ar[(A|=0)>>2]=ar[1495],ar[A+4>>2]=ar[1496],ar[A+8>>2]=ar[1497],t=0|ar[e>>2],Xo(t=548+(t|=0)|0),Xo(t),tr[t>>0]=1;;){if((ar[i>>2]=0)|Ke(0|ar[e>>2],i)){A=6;break}if(0|(o=0|$e(0|ar[e>>2]))&&(Le(f,0,o,r),ar[A>>2]=ar[f>>2],ar[A+4>>2]=ar[f+4>>2],ar[A+8>>2]=ar[f+8>>2],Ar(0|ar[e>>2])),!(0|ar[i>>2])){A=6;break}}6!=(0|A)||(ur=n)},function(A,e,r){A|=0,0|(A=0|ar[(e|=0)+4>>2])&&$o(A),0|(A=0|ar[e+8>>2])&&$o(A),(A=0|ar[e+12>>2])&&$o(A)},function(A,e,r){var i,f,n,t;A|=0,e|=0,ur=(i=ur)+32|0,f=i,t=(n=0|tr[(r|=0)+11>>0])<<24>>24<0,Oe(f,0|ar[e>>2],t?0|ar[r>>2]:r,t?0|ar[r+4>>2]:255&n),Wc(A,f,0|ar[e>>2]),ur=(0<=(0|tr[(A=f+8|0)+11>>0])||Vl(0|ar[A>>2]),i)},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n=0,t=0,o=0;if(ur=(f=ur)+32|0,n=(i=f)+20|0,t=f+8|0,o=0|sA(),!e)return ar[A>>2]=o,cA((o=0)|o),void(ur=f);!function(A,e,r,i){A|=0,e|=0,r|=0;var f,n,t=0,o=0,a=0,c=0,l=0;if(ur=(n=ur)+64|0,f=n+44|0,t=n+32|0,o=n+12|0,a=n,!(i|=0))return ar[t>>2]=0,ar[t+4>>2]=0,ar[t+8>>2]=0,Cc(f,5,2001,t),(0|tr[t+11>>0])<0&&Vl(0|ar[t>>2]),Wc(A,f,0|ar[e>>2]),(0|tr[(t=8+f|0)+11>>0])<0&&Vl(0|ar[t>>2]),ur=n;if(Re(f,40+(0|ar[e>>2])|0),t=(0<=(0|r)&&(c=l=0|ar[f>>2],(0|ar[4+f>>2])-l>>3>>>0>r>>>0)?(a=0|El(16),ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,ar[a+12>>2]=0,ar[i>>2]=a,l=0|ar[c+(r<<3)>>2],(o=t=0|ar[c+(r<<3)+4>>2])?(Cl(t),t=0|ar[(c=a+4|0)>>2],ar[a>>2]=l,ar[c>>2]=o,0|t&&Il(t)):(ar[a>>2]=l,ar[a+4>>2]=o),t=0|ar[i>>2],o=0|ar[e>>2],0|(a=0|ar[e+4>>2])&&Cl(a),ar[t+8>>2]=o,t=0|ar[(i=t+12|0)>>2],ar[i>>2]=a,0|t&&Il(t),Wc(A,49920,0|ar[e>>2])):(ar[a>>2]=0,ar[a+4>>2]=0,ar[a+8>>2]=0,Cc(o,5,2e3,a),(0|tr[a+11>>0])<0&&Vl(0|ar[a>>2]),Wc(A,o,0|ar[e>>2]),(0|tr[(t=o+8|0)+11>>0])<0&&Vl(0|ar[t>>2])),f),0|(t=0|ar[t>>2])){if((0|(o=0|ar[(r=4+f|0)>>2]))!=(0|t)){for(;a=o+-8|0,ar[r>>2]=a,(0|(o=(o=0|ar[o+-4>>2])?(Il(o),0|ar[r>>2]):a))!=(0|t););t=0|ar[f>>2]}Vl(t)}ur=n}(t,e,r,n),t=0|ar[t>>2]?(n=0|El(12),ar[n>>2]=ar[t>>2],ar[n+4>>2]=ar[t+4>>2],ar[n+8>>2]=ar[t+8>>2],ar[i>>2]=n,0|dA(1520,0|i)):(ar[i>>2]=ar[n>>2],0|dA(1448,0|i)),ar[A>>2]=t,cA(0|o),ur=f},function(A,e,r){r|=0,ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]=r},function(A,e,r){r|=0,ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]=r},nc,function(A,e,r){A|=0,r|=0;var i,f=0,n=0;if(ur=(i=ur)+16|0,f=i,0|(e|=0))return Xc(A,e,(n=(f=0|tr[r+11>>0])<<24>>24<0)?0|ar[r>>2]:r,n?0|ar[r+4>>2]:255&f),void(ur=i);ar[f>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,Cc(A,5,2001,f),ur=(0<=(0|tr[f+11>>0])||Vl(0|ar[f>>2]),i)},function(A,e,r){r|=0,ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]=r},function(A,e,r){r|=0,ar[(e|=0)+(0|ar[(A|=0)>>2])>>2]=r},function(A,e,r){e|=0,r|=0;var i,f,n,t=0,o=0;ur=(n=ur)+16|0,f=n,t=0|ar[(A|=0)>>2],i=e+((A=0|ar[A+4>>2])>>1)|0,1&A&&(t=0|ar[(0|ar[i>>2])+t>>2]),e=r+4|0,r=0|ar[r>>2],ar[f>>2]=0,ar[f+4>>2]=0,4294967279<r>>>(ar[f+8>>2]=0)&&Nl(),r>>>0<11?(tr[f+11>>0]=r)?(A=f,o=9):A=f:(A=0|El(o=r+16&-16),ar[f>>2]=A,ar[f+8>>2]=-2147483648|o,ar[f+4>>2]=r,o=9),9==(0|o)&&Eu(0|A,0|e,0|r),tr[A+r>>0]=0,ks[63&t](i,f),ur=(0<=(0|tr[f+11>>0])||Vl(0|ar[f>>2]),n)},function(A,e,r){e|=0,r|=0;var i,f,n,t=0;if((f=((t=0|ar[(n=(A|=0)+4|0)>>2])-(i=0|ar[A>>2])|0)/12|0)>>>0<e>>>0)!function(A,e,r){e|=0,r|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0;if(t=0|ar[(i=8+(A|=0)|0)>>2],f=0|ar[(l=A+4|0)>>2],e>>>0<=((t-f|0)/12|0)>>>0){for(;Rl(f,r),f=12+(0|ar[l>>2])|0,ar[l>>2]=f,0!=(0|(e=e+-1|0)););return}n=0|ar[A>>2],357913941<(f=(o=(f-n|0)/12|0)+e|0)>>>0&&il();c=(a=(t-n|0)/12|0)<<1,f=a>>>0<178956970?c>>>0<f>>>0?f:c:357913941;do{if(f){if(!(357913941<f>>>0)){t=0|El(12*f|0);break}Fl(l=0|C(8),37845),ar[l>>2]=16004,I(0|l,3616,283)}else t=0}while(0);c=t+(12*f|0)|0,a=n=o=t+(12*o|0)|0,f=o;for(;Rl(f,r),a=f=a+12|0,e=e+-1|0,0!=(0|e););if(t=0|ar[A>>2],(0|(f=0|ar[l>>2]))==(0|t))e=n,f=n=t;else{for(e=o;f=f+-12|0,ar[(r=e+-12|0)>>2]=ar[f>>2],ar[r+4>>2]=ar[f+4>>2],ar[r+8>>2]=ar[f+8>>2],ar[f>>2]=0,ar[f+4>>2]=0,ar[f+8>>2]=0,n=e=n+-12|0,(0|f)!=(0|t););e=n,n=0|ar[A>>2],f=0|ar[l>>2]}if(ar[A>>2]=e,ar[l>>2]=a,ar[i>>2]=c,(0|f)!=(0|(e=n)))for(;(0|tr[(f=f+-12|0)+11>>0])<0&&Vl(0|ar[f>>2]),(0|f)!=(0|e););if(!n)return;Vl(n)}(A,e-f|0,r);else if(!(f>>>0<=e>>>0)&&(0|t)!=(0|(A=i+(12*e|0)|0)))for(;t=t+-12|0,ar[n>>2]=t,(0|tr[t+11>>0])<0&&(Vl(0|ar[t>>2]),t=0|ar[n>>2]),(0|t)!=(0|A););},function(A,e,r){A|=0,r|=0;var i,f,n,t,o=0;if(ur=(n=ur)+16|0,f=n,i=o=0|ar[(e|=0)>>2],(((0|ar[e+4>>2])-o|0)/12|0)>>>0<=r>>>0)return o=1,ar[A>>2]=o,void(ur=n);o=0|qo((r=(t=(o=0|tr[(e=i+(12*r|0)|0)+11>>0])<<24>>24<0)?0|ar[i+(12*r|0)+4>>2]:255&o)+4|0),ar[o>>2]=r,Eu(o+4|0,0|(t?0|ar[e>>2]:e),0|r),ar[f>>2]=o,o=0|dA(1680,0|f),ar[A>>2]=o,ur=n},function(A,e,r){e|=0,r|=0;var i,f,n,t=0;ur=(f=ur)+16|0,i=f,t=0|ar[(A|=0)>>2],A=e+((n=0|ar[A+4>>2])>>1)|0,1&n&&(t=0|ar[(0|ar[A>>2])+t>>2]),ar[i>>2]=r,ks[63&t](A,i),ur=f},function(A,e,r){var i,f,n,t;e|=0,r|=0,(f=(n=0|ar[(t=(A|=0)+4|0)>>2])-(i=0|ar[A>>2])>>2)>>>0<e>>>0?function(A,e,r){e|=0,r|=0;var i,f,n,t,o=0,a=0,c=0,l=0,u=0;if(a=0|ar[(t=8+(A|=0)|0)>>2],o=0|ar[(u=A+4|0)>>2],a-(c=o)>>2>>>0>=e>>>0){for(o=e,a=c;ar[a>>2]=ar[r>>2],o=o+-1|0;)a=a+4|0;return ar[u>>2]=c+(e<<2)}n=0|ar[A>>2],1073741823<(o=(i=(f=o-n|0)>>2)+e|0)>>>0&&il();l=(c=a-n|0)>>1,o=c>>2>>>0<536870911?l>>>0<o>>>0?o:l:1073741823;do{if(o){if(!(1073741823<o>>>0)){a=0|El(o<<2);break}Fl(u=0|C(8),37845),ar[u>>2]=16004,I(0|u,3616,283)}else a=0}while(0);c=a+(o<<2)|0,o=e,a=l=a+(i<<2)|0;for(;ar[a>>2]=ar[r>>2],o=o+-1|0;)a=a+4|0;o=l+(0-i<<2)|0,0<(0|f)&&Eu(0|o,0|n,0|f);if(ar[A>>2]=o,ar[u>>2]=l+(e<<2),ar[t>>2]=c,!n)return;Vl(n)}(A,e-f|0,r):f>>>0<=e>>>0||(0|n)!=(0|(A=i+(e<<2)|0))&&(ar[t>>2]=n+(~((n-4-A|0)>>>2)<<2))},function(A,e,r){A|=0,r|=0;var i,f,n=0;if(ur=(f=ur)+16|0,i=f,n=0|ar[(e|=0)>>2],(0|ar[e+4>>2])-n>>2>>>0<=r>>>0)return n=1,ar[A>>2]=n,void(ur=f);ar[i>>2]=ar[n+(r<<2)>>2],n=0|dA(3752,0|i),ar[A>>2]=n,ur=f},function(A,e,r){br(37782,28463,51,28479)},function(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0;if(0<(0|(r|=0))){f=0;do{for(n=0|sr(f,r),i=0;ar[A+((t=i+n|0)<<2)>>2]=or[e+(t<<1)>>1],(0|(i=i+1|0))!=(0|r););f=f+1|0}while((0|f)!=(0|r))}},function(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0,o=0;if(0<(0|(r|=0))){f=0;do{for(t=0|sr(f,r),n=i=0;i=(0|or[e+((o=n+t|0)<<1)>>1])+i|0,ar[A+(o<<2)>>2]=i,(0|(n=n+1|0))!=(0|r););f=f+1|0}while((0|f)!=(0|r))}},function(A,e,r){A|=0,e|=0;var i=0,f=0,n=0,t=0;if(0<(0|(r|=0))){f=0;do{for(n=i=0;t=(0|sr(n,r))+f|0,i=(0|or[e+(t<<1)>>1])+i|0,ar[A+(t<<2)>>2]=i,(0|(n=n+1|0))!=(0|r););f=f+1|0}while((0|f)!=(0|r))}},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0;for(ur=(f=ur)+32|0,i=f,n=0;t=0|or[e+(n<<1)>>1],l=(74*(o=0|or[e+(n+4<<1)>>1])|0)+(29*t|0)+(84*(a=0|or[e+(n+8<<1)>>1])|0)+(55*(c=0|or[e+(n+12<<1)>>1])|0)+64>>7,or[i+(n<<1)>>1]=(0|l)<-32768?-32768:65535&((0|l)<32767?l:32767),l=(0|sr(c,-84))+((0|sr(a,-29))+((74*o|0)+(55*t|0)))+64>>7,or[i+8+(n<<1)>>1]=(0|l)<-32768?-32768:65535&((0|l)<32767?l:32767),l=(74*c|0)+((0|sr(a,-74))+(74*t|0))+64>>7,or[i+16+(n<<1)>>1]=(0|l)<-32768?-32768:65535&((0|l)<32767?l:32767),t=(0|sr(c,-29))+((55*a|0)+((0|sr(o,-74))+(84*t|0)))+64>>7,or[i+24+(n<<1)>>1]=(0|t)<-32768?-32768:65535&((0|t)<32767?t:32767),4!=(0|(n=n+1|0)););for(n=0;l=0|sr(n,r),c=0|or[i+(n<<3)>>1],u=(74*(a=0|or[i+(n<<3)+2>>1])|0)+(29*c|0)+(84*(o=0|or[i+(n<<3)+4>>1])|0)+(55*(t=0|or[i+(n<<3)+6>>1])|0)+2048>>12,u=(0|cr[(e=A+l|0)>>0])+((0|u)<-32768?-32768:(0|u)<32767?u:32767)|0,tr[e>>0]=(0|u)<0?0:255&((0|u)<255?u:255),e=(0|sr(t,-84))+((0|sr(o,-29))+((74*a|0)+(55*c|0)))+2048>>12,e=(0|cr[(u=A+(l+1)|0)>>0])+((0|e)<-32768?-32768:(0|e)<32767?e:32767)|0,tr[u>>0]=(0|e)<0?0:255&((0|e)<255?e:255),u=(74*t|0)+((0|sr(o,-74))+(74*c|0))+2048>>12,u=(0|cr[(e=A+(l+2)|0)>>0])+((0|u)<-32768?-32768:(0|u)<32767?u:32767)|0,tr[e>>0]=(0|u)<0?0:255&((0|u)<255?u:255),c=(0|sr(t,-29))+((55*o|0)+((0|sr(a,-74))+(84*c|0)))+2048>>12,c=(0|cr[(l=A+(l+3)|0)>>0])+((0|c)<-32768?-32768:(0|c)<32767?c:32767)|0,tr[l>>0]=(0|c)<0?0:255&((0|c)<255?c:255),4!=(0|(n=n+1|0)););ur=f},function(A,e,r){xt(A|=0,r|=0,4,e|=0,8)},function(A,e,r){xt(A|=0,r|=0,8,e|=0,8)},function(A,e,r){xt(A|=0,r|=0,16,e|=0,8)},function(A,e,r){xt(A|=0,r|=0,32,e|=0,8)},function(A,e,r){A|=0,e|=0;var i,f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0;for(ur=(t=ur)+32|0,n=t,i=(r|=0)<<1,f=3*r|0,o=0;a=0|or[e+(o<<1)>>1],b=(55*(c=0|or[e+(o+r<<1)>>1])|0)+(29*a|0)+(74*(l=0|or[e+(i+o<<1)>>1])|0)+(84*(u=0|or[e+(f+o<<1)>>1])|0)+1>>1,or[n+(o<<1)>>1]=(0|b)<-32768?-32768:65535&((0|b)<32767?b:32767),s=(b=(0|sr(u,-74))+(74*(c+a|0)|0)|0)>>1,or[n+(o+4<<1)>>1]=(0|b)<-65536?-32768:65535&((0|s)<32767?s:32767),s=(55*u|0)+((0|sr(l,-74))+((0|sr(c,-29))+(84*a|0)))+1>>1,or[n+(o+8<<1)>>1]=(0|s)<-32768?-32768:65535&((0|s)<32767?s:32767),a=(0|sr(u,-29))+((74*l|0)+((0|sr(c,-84))+(55*a|0)))+1>>1,or[n+(o+12<<1)>>1]=(0|a)<-32768?-32768:65535&((0|a)<32767?a:32767),4!=(0|(o=o+1|0)););for(o=0;s=0|or[n+((b=o<<2)<<1)>>1],u=0|or[n+((1|b)<<1)>>1],l=0|or[n+((2|b)<<1)>>1],c=0|or[n+((3|b)<<1)>>1],or[A+(b<<1)>>1]=((55*u|0)+(29*s|0)+(74*l|0)+(84*c|0)+128|0)>>>8,a=((0|sr(c,-74))+(74*(u+s|0)|0)+128|0)>>>8&65535,or[A+((1|b)<<1)>>1]=a,a=((55*c|0)+((0|sr(l,-74))+((0|sr(u,-29))+(84*s|0)))+128|0)>>>8&65535,or[A+((2|b)<<1)>>1]=a,s=((0|sr(c,-29))+((74*l|0)+((0|sr(u,-84))+(55*s|0)))+128|0)>>>8&65535,or[A+((3|b)<<1)>>1]=s,4!=(0|(o=o+1|0)););ur=t},function(A,e,r){zt(A|=0,4,e|=0,r|=0)},function(A,e,r){zt(A|=0,8,e|=0,r|=0)},function(A,e,r){zt(A|=0,16,e|=0,r|=0)},function(A,e,r){zt(A|=0,32,e|=0,r|=0)},function(A,e,r){A|=0,r|=0;var i,f=0,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0;ur=(i=ur)+32|0,w=i,n=0|or[(e|=0)>>1],o=0|or[e+4>>1],c=0|or[e+2>>1],g=o+n<<16>>16,a=(f=0|or[e+6>>1])+c<<16>>16,or[w>>1]=a+g,or[(b=w+2|0)>>1]=g-a,o=n-o<<16>>16,f=c-f<<16>>16,or[(c=w+4|0)>>1]=f+o,or[(n=w+6|0)>>1]=o-f,f=0|or[e+(r<<1)>>1],o=0|or[e+(r+2<<1)>>1],a=0|or[e+(r+1<<1)>>1],t=o+f<<16>>16,m=(g=0|or[e+(r+3<<1)>>1])+a<<16>>16,or[(h=w+8|0)>>1]=m+t,or[(s=w+10|0)>>1]=t-m,o=f-o<<16>>16,g=a-g<<16>>16,or[(a=w+12|0)>>1]=g+o,or[(f=w+14|0)>>1]=o-g,o=0|or[e+((g=r<<1)<<1)>>1],m=0|or[e+(g+2<<1)>>1],t=0|or[e+((1|g)<<1)>>1],d=(l=(g=0|or[e+(g+3<<1)>>1])+t<<16>>16)+(v=m+o<<16>>16)|0,or[w+16>>1]=d,l=v-l|0,or[w+18>>1]=l,m=o-m<<16>>16,g=t-g<<16>>16,or[(t=w+20|0)>>1]=g+m,or[(o=w+22|0)>>1]=m-g,m=0|or[e+((g=3*r|0)<<1)>>1],v=0|or[e+(g+2<<1)>>1],r=0|or[e+(g+1<<1)>>1],k=(u=(g=0|or[e+(g+3<<1)>>1])+r<<16>>16)+(e=v+m<<16>>16)|0,or[w+24>>1]=k,u=e-u|0,or[w+26>>1]=u,e=(g=r-g<<16>>16)+(v=m-v<<16>>16)|0,or[w+28>>1]=e,or[(r=w+30|0)>>1]=v-g,g=(d=d<<16>>16)+(w=0|or[w>>1])<<16>>16,v=(k=k<<16>>16)+(h=0|or[h>>1])<<16>>16,or[A>>1]=v+g,or[A+8>>1]=g-v,d=w-d<<16>>16,k=h-k<<16>>16,or[A+16>>1]=k+d,or[A+24>>1]=d-k,k=(l=l<<16>>16)+(b=0|or[b>>1])<<16>>16,d=(u=u<<16>>16)+(s=0|or[s>>1])<<16>>16,or[A+2>>1]=d+k,or[A+10>>1]=k-d,l=b-l<<16>>16,u=s-u<<16>>16,or[A+18>>1]=u+l,or[A+26>>1]=l-u,c=0|or[c>>1],u=(t=0|or[t>>1])+c<<16>>16,l=(e=e<<16>>16)+(a=0|or[a>>1])<<16>>16,or[A+4>>1]=l+u,or[A+12>>1]=u-l,t=c-t<<16>>16,e=a-e<<16>>16,or[A+20>>1]=e+t,or[A+28>>1]=t-e,n=0|or[n>>1],e=0|or[o>>1],f=0|or[f>>1],o=e+n<<16>>16,t=(r=0|or[r>>1])+f<<16>>16,or[A+6>>1]=t+o,or[A+14>>1]=o-t,e=n-e<<16>>16,r=f-r<<16>>16,or[A+22>>1]=r+e,or[A+30>>1]=e-r,ur=i},function(A,e,r){A|=0,e|=0,r|=0;var i,f,n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0,w=0,v=0,g=0,m=0,p=0,y=0;for(ur=(f=ur)+128|0,i=f,n=0;o=0|sr(n,r),w=0|or[e+(o<<1)>>1],l=0|or[e+(o+4<<1)>>1],k=0|or[e+(o+1<<1)>>1],c=0|or[e+(o+5<<1)>>1],t=0|or[e+(o+2<<1)>>1],a=0|or[e+(o+6<<1)>>1],h=0|or[e+(o+3<<1)>>1],d=l+w<<16>>16,u=a+t<<16>>16,b=c+k<<16>>16,s=(o=0|or[e+(o+7<<1)>>1])+h<<16>>16,l=w-l<<16>>16,a=t-a<<16>>16,c=k-c<<16>>16,o=h-o<<16>>16,h=u+d<<16>>16,k=s+b<<16>>16,or[i+((t=n<<3)<<1)>>1]=k+h,or[i+((1|t)<<1)>>1]=h-k,u=d-u<<16>>16,s=b-s<<16>>16,or[i+((2|t)<<1)>>1]=s+u,or[i+((3|t)<<1)>>1]=u-s,s=a+l<<16>>16,u=o+c<<16>>16,or[i+((4|t)<<1)>>1]=u+s,or[i+((5|t)<<1)>>1]=s-u,a=l-a<<16>>16,o=c-o<<16>>16,or[i+((6|t)<<1)>>1]=o+a,or[i+((7|t)<<1)>>1]=a-o,8!=(0|(n=n+1|0)););for(n=0;y=0|or[i+(n<<1)>>1],s=0|or[i+((a=n+32|0)<<1)>>1],g=0|or[i+((v=n+8|0)<<1)>>1],b=0|or[i+((u=n+40|0)<<1)>>1],p=0|or[i+((t=n+16|0)<<1)>>1],k=0|or[i+((d=n+48|0)<<1)>>1],m=0|or[i+((c=n+24|0)<<1)>>1],e=s+y<<16>>16,o=k+p<<16>>16,r=b+g<<16>>16,l=(h=0|or[i+((w=n+56|0)<<1)>>1])+m<<16>>16,s=y-s<<16>>16,k=p-k<<16>>16,b=g-b<<16>>16,h=m-h<<16>>16,m=o+e<<16>>16,g=l+r<<16>>16,or[A+(n<<1)>>1]=g+m,or[A+(v<<1)>>1]=m-g,o=e-o<<16>>16,l=r-l<<16>>16,or[A+(t<<1)>>1]=l+o,or[A+(c<<1)>>1]=o-l,c=k+s<<16>>16,l=h+b<<16>>16,or[A+(a<<1)>>1]=l+c,or[A+(u<<1)>>1]=c-l,k=s-k<<16>>16,h=b-h<<16>>16,or[A+(d<<1)>>1]=h+k,or[A+(w<<1)>>1]=k-h,8!=(0|(n=n+1|0)););ur=f},function(A,e,r){Pt(A|=0,16,e|=0,r|=0)},function(A,e,r){Pt(A|=0,32,e|=0,r|=0)},zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu,zu],ws=[Pu,function(A,e,r,i){A|=0,i|=0,r=(r|=0)+8|0,gs[15&ar[16+(0|ar[(e|=0)>>2])>>2]](A,e,0|ar[r>>2],0|ar[r+4>>2],0,i)},function(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f=0,n=0,t=0;A:do{if(0|i){for(f=0;;){if(i>>>0<(t=f+4|0)>>>0){f=4;break}if(i>>>0<(f=(n=(0|cr[r+(f+1)>>0])<<16|(0|cr[r+f>>0])<<24|(0|cr[r+(f+2)>>0])<<8|0|cr[r+(f+3)>>0])+t|0)>>>0){f=7;break}if(qe(0|ar[e>>2],r+t|0,n,0,0,0),i>>>0<=f>>>0)break A}if(4==(0|f))return ar[A>>2]=ar[1498],ar[A+4>>2]=ar[1499],void(ar[A+8>>2]=ar[1500]);if(7==(0|f))return ar[A>>2]=ar[1498],ar[A+4>>2]=ar[1499],void(ar[A+8>>2]=ar[1500])}}while(0);ar[A>>2]=ar[1495],ar[A+4>>2]=ar[1496],ar[A+8>>2]=ar[1497]},function(A,e,r,i){i|=0,ar[(i=A|=0)>>2]=0,ar[i+4>>2]=0,ar[(i=A+8|0)>>2]=-1,ar[i+4>>2]=-1},function(A,e,r,i){i|=0,ar[(i=A|=0)>>2]=0,ar[i+4>>2]=0,ar[(i=A+8|0)>>2]=-1,ar[i+4>>2]=-1},function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o=0;for(f=ur=(t=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,4294967279<(n=i-r|(ar[A+8>>2]=0))>>>0&&Nl(),n>>>0<11?(tr[A+11>>0]=n,o=A):(o=0|El(e=16+n&-16),ar[A>>2]=o,ar[A+8>>2]=-2147483648|e,ar[A+4>>2]=n),e=r,A=o;(0|e)!=(0|i);)Ni(A,e),e=e+1|0,A=A+1|0;Ni(o+n|(tr[f>>0]=0),f),ur=t},function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o=0,a=0;f=ur=(t=ur)+31&-32,ur=ur+16|0,ar[(A|=0)>>2]=0,ar[A+4>>2]=0,1073741807<(n=i-r>>2)>>>(ar[A+8>>2]=0)&&Nl();do{if(2<=n>>>0){if(!(1073741823<(e=4+n&-4)>>>0)){a=0|El(e<<2),ar[A>>2]=a,ar[A+8>>2]=-2147483648|e,ar[A+4>>2]=n,o=r;break}kA()}else tr[A+8+3>>0]=n,o=r,a=A}while(0);for(;(0|o)!=(0|i);)sf(a,o),o=o+4|0,a=a+4|0;ar[f>>2]=0,sf(a,f),ur=t},function(A,e,r,i){r|=0,i|=0,0|tu(A|=0,0|ar[(e|=0)+8>>2])&&ou(0,e,r,i)},function(A,e,r,i){r|=0,i|=0,0|tu(A|=0,0|ar[(e|=0)+8>>2])?ou(0,e,r,i):(A=0|ar[A+8>>2],ws[31&ar[28+(0|ar[A>>2])>>2]](A,e,r,i))},function(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f=0,n=0;A:do{if(0|tu(A,0|ar[e+8>>2]))ou(0,e,r,i);else if(f=A+16+((n=0|ar[A+12>>2])<<3)|0,su(A+16|0,e,r,i),1<(0|n)){n=e+54|0,A=A+24|0;do{if(su(A,e,r,i),0|tr[n>>0])break A;A=A+8|0}while(A>>>0<f>>>0)}}while(0)},function(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o,a,c,l,u,s=0,b=0,d=0,k=0,h=0,w=0,v=0;if(ur=(u=ur)+64|0,l=(o=u)+56|0,c=u+52|0,b=u+40|0,a=u+36|0,v=u+24|0,f=u+20|0,n=u+16|0,t=u+12|0,s=0|sA(),ar[l>>2]=s,!e)return ar[A>>2]=s,ar[l>>2]=0,cA((v=0)|v),void(ur=u);if(!function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c;ur=(c=ur)+32|0,ar[(t=(o=c)+24|0)>>2]=0,ar[(a=4+t|0)>>2]=0,He(o,0|ar[e>>2],t,i,f,n),0|ar[o>>2]?Wc(A,o,0|ar[e>>2]):(n=0|El(8),ar[r>>2]=n,i=0|ar[t>>2],f=0|ar[a>>2],ar[t>>2]=0,ar[a>>2]=0,ar[n>>2]=i,ar[n+4>>2]=f,Wc(A,49920,0|ar[e>>2]));(0|tr[11+(A=o+8|0)>>0])<0&&Vl(0|ar[A>>2]);(A=0|ar[a>>2])&&Il(A),ur=c}(b,e,c,r,i,0),0|ar[b>>2])v=0|El(12),ar[v>>2]=ar[b>>2],ar[v+4>>2]=ar[b+4>>2],ar[v+8>>2]=ar[b+8>>2],ar[o>>2]=v,v=0|dA(1520,0|o),ar[A>>2]=v;else{if(ar[o>>2]=cr[32+(0|ar[e>>2])>>0],Ne(l,26285,o),Re(o,40+(0|ar[e>>2])|0),b=(s=0|ar[(i=o+4|0)>>2])-(e=0|ar[o>>2])>>3,0|(r=e)){if((0|s)!=(0|r)){for(;e=s+-8|0,ar[i>>2]=e,(s=0|ar[s+-4>>2])&&(Il(s),e=0|ar[i>>2]),(0|e)!=(0|r);)s=e;e=0|ar[o>>2]}Vl(e)}switch(ar[a>>2]=b,Ne(l,26296,a),s=0|ar[c>>2],e=0|function(A,e){e|=0;var r,i=0,f=0;{if(!(i=0|ar[(r=44+(A|=0)|0)>>2]))return 0|(e=-1);A=r,f=i}A:for(;;){for(i=f;!((0|ar[i+16>>2])>=(0|e));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){A=i;break}A=i}if((0|A)==(0|r))return 0|(e=-1);if((0|ar[A+16>>2])>(0|e))return 0|(e=-1);return 0|(e=0|ar[A+20>>2])}(0|ar[s>>2],0),ar[o>>2]=e,function(A,e,r){e|=0,r|=0;var i,f;ur=(i=ur)+16|0,f=i,A=0|ar[(A=A|0)>>2],e=0|uA(0|e),ar[f>>2]=ar[r>>2],r=0|dA(3744,0|f),bA(0|A,0|e,0|r),cA(0|r),cA(0|e),ur=i}(l,26307,o),e=0|function(A,e){e|=0;var r,i=0,f=0;{if(!(i=0|ar[(r=44+(A|=0)|0)>>2]))return 0|(e=-1);A=r,f=i}A:for(;;){for(i=f;!((0|ar[i+16>>2])>=(0|e));)if(!(i=0|ar[i+4>>2]))break A;if(!(f=0|ar[i>>2])){A=i;break}A=i}if((0|A)==(0|r))return 0|(e=-1);if((0|ar[A+16>>2])>(0|e))return 0|(e=-1);return 0|(e=0|ar[A+24>>2])}(0|ar[s>>2],0),ar[a>>2]=e,function(A,e,r){e|=0,r|=0;var i,f;ur=(i=ur)+16|0,f=i,A=0|ar[(A=A|0)>>2],e=0|uA(0|e),ar[f>>2]=ar[r>>2],r=0|dA(3744,0|f),bA(0|A,0|e,0|r),cA(0|r),cA(0|e),ur=i}(l,26313,a),ar[v>>2]=0,ar[v+4>>2]=0,ar[v+8>>2]=0,ar[f>>2]=ar[36+(0|ar[s>>2])>>2],function(A,e,r){e|=0,r|=0;var i,f;ur=(i=ur)+16|0,f=i,A=0|ar[(A=A|0)>>2],e=0|uA(0|e),ar[f>>2]=ar[r>>2],r=0|dA(1376,0|f),bA(0|A,0|e,0|r),cA(0|r),cA(0|e),ur=i}(l,26320,f),ar[f>>2]=ar[32+(0|ar[s>>2])>>2],function(A,e,r){e|=0,r|=0;var i,f;ur=(i=ur)+16|0,f=i,A=0|ar[(A=A|0)>>2],e=0|uA(0|e),ar[f>>2]=ar[r>>2],r=0|dA(1384,0|f),bA(0|A,0|e,0|r),cA(0|r),cA(0|e),ur=i}(l,26327,f),e=0|ar[s>>2],0|ar[e+32>>2]){case 0:if(r=e?0|Qc(e,0,f):ar[f>>2]=0,h=(e=0|ar[s>>2])?0|Qc(e,1,n):ar[n>>2]=0,e=(e=0|ar[s>>2])?0|Qc(e,2,t):ar[t>>2]=0,Ul(v,((0|(w=0|sr(0|ar[a>>2],0|ar[o>>2])))/2|0)+w|0,0),w=(0|tr[v+11>>0])<0?0|ar[v>>2]:v,d=0|ar[o>>2],k=0|ar[a>>2],(0|d)!=(0|(b=0|ar[f>>2]))){if(0<(0|k))for(i=w,s=r,r=0;Eu(0|i,0|s,0|b),(0|(r=r+1|0))!=(0|k);)i=i+d|0,s=s+b|0}else Eu(0|w,0|r,0|sr(k,d));if(d=0|ar[o>>2],s=0|ar[a>>2],i=w+(0|sr(s,d))|0,k=(0|s)/2|0,(0|(d=(0|d)/2|0))!=(0|(b=0|ar[n>>2]))){if(1<(0|s))for(s=h,r=0;Eu(0|i,0|s,0|b),(0|(r=r+1|0))!=(0|k);)i=i+d|0,s=s+b|0}else Eu(0|i,0|h,0|sr(k,d));if(b=0|ar[o>>2],s=0|ar[a>>2],r=w+(r=0|sr(s,b))+((0|r)/4|0)|0,d=(0|s)/2|0,(0|(b=(0|b)/2|0))!=(0|(i=0|ar[t>>2]))){if(1<(0|s))for(s=0;Eu(0|r,0|e,0|i),(0|(s=s+1|0))!=(0|d);)r=r+b|0,e=e+i|0}else Eu(0|r,0|e,0|sr(d,b));break;case 1:if(10!=(0|ar[e+36>>2])&&br(26338,26407,175,22700),e=0|Qc(e,10,f),Ul(v,0|sr(3*(0|ar[o>>2])|0,0|ar[a>>2]),0),r=(0|tr[v+11>>0])<0?0|ar[v>>2]:v,d=3*(0|ar[o>>2])|0,b=0|ar[a>>2],(0|d)!=(0|(i=0|ar[f>>2]))){if(0<(0|b))for(s=0;Eu(0|r,0|e,0|i),(0|(s=s+1|0))!=(0|b);)r=r+d|0,e=e+i|0}else Eu(0|r,0|e,0|sr(b,d));break;case 2:if(0|ar[e+36>>2]&&br(26427,26407,187,22700),e=0|Qc(e,0,f),Ul(v,0|sr(0|ar[a>>2],0|ar[o>>2]),0),r=(0|tr[v+11>>0])<0?0|ar[v>>2]:v,d=0|ar[o>>2],b=0|ar[a>>2],(0|d)!=(0|(i=0|ar[f>>2]))){if(0<(0|b))for(s=0;Eu(0|r,0|e,0|i),(0|(s=s+1|0))!=(0|b);)r=r+d|0,e=e+i|0}else Eu(0|r,0|e,0|sr(b,d))}Fe(l,25603,v),0|(e=0|ar[c>>2])&&(0|(s=0|ar[e+4>>2])&&Il(s),Vl(e)),ar[A>>2]=ar[l>>2],((ar[l>>2]=0)|tr[v+11>>0])<0&&Vl(0|ar[v>>2])}v=0|ar[l>>2],cA(0|v),ur=u},function(A,e,r,i){A|=0,e|=0,r|=0,i|=0;var f,n,t,o,a,c=0,l=0;if(ur=(a=ur)+64|0,f=a+24|0,l=a+48|0,t=a+36|0,o=a,i=0|sA(),ar[l>>2]=i,!e)return ar[A>>2]=i,ar[l>>2]=0,cA((l=0)|l),void(ur=a);ar[t>>2]=0,ar[(n=4+t|0)>>2]=0,ar[8+t>>2]=0,Nc(o,e,i=65535&r,t),0|ar[o>>2]?(c=0|El(20),e=0|ar[(r=o)+4>>2],ar[(i=c)>>2]=ar[r>>2],ar[i+4>>2]=e,Rl(c+8|0,i=o+8|0),ar[f>>2]=c,c=0|dA(1072,0|f),ar[A>>2]=c):(_c(f,e,i),Fe(l,25598,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),r=0|ar[t>>2],e=(0|ar[n>>2])-r|0,ar[f>>2]=0,ar[4+f>>2]=0,4294967279<e>>>(ar[8+f>>2]=0)&&Nl(),e>>>0<11?(tr[11+f>>0]=e)?(i=f,c=12):i=f:(i=0|El(c=e+16&-16),ar[f>>2]=i,ar[8+f>>2]=-2147483648|c,ar[4+f>>2]=e,c=12),12==(0|c)&&Eu(0|i,0|r,0|e),tr[i+e>>0]=0,Fe(l,25603,f),(0|tr[11+f>>0])<0&&Vl(0|ar[f>>2]),ar[A>>2]=ar[l>>2],i=o+8|(ar[l>>2]=0)),(0|tr[i+11>>0])<0&&Vl(0|ar[o+8>>2]),0|(i=0|ar[t>>2])&&((0|ar[n>>2])!=(0|i)&&(ar[n>>2]=i),Vl(i)),l=0|ar[l>>2],cA(0|l),ur=a},function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o=0,a=0;ur=(t=ur)+16|0,n=t,o=0|ar[(A|=0)>>2],f=e+((A=0|ar[A+4>>2])>>1)|0,1&A&&(o=0|ar[(0|ar[f>>2])+o>>2]),e=i+4|0,i=0|ar[i>>2],ar[n>>2]=0,ar[n+4>>2]=0,4294967279<i>>>(ar[n+8>>2]=0)&&Nl(),i>>>0<11?(tr[n+11>>0]=i)?(A=n,a=9):A=n:(A=0|El(a=i+16&-16),ar[n>>2]=A,ar[n+8>>2]=-2147483648|a,ar[n+4>>2]=i,a=9),9==(0|a)&&Eu(0|A,0|e,0|i),tr[A+i>>0]=0,hs[127&o](f,r,n),ur=(0<=(0|tr[n+11>>0])||Vl(0|ar[n>>2]),t)},function(A,e,r,i){e|=0,r|=0,i|=0;var f,n,t,o=0;ur=(n=ur)+16|0,f=n,o=0|ar[(A|=0)>>2],A=e+((t=0|ar[A+4>>2])>>1)|0,1&t&&(o=0|ar[(0|ar[A>>2])+o>>2]),ar[f>>2]=i,hs[127&o](A,r,f),ur=n},function(A,e,r,i){A|=0,e|=0,i|=0;var f,n,t=0,o=0,a=0,c=0,l=0,u=0,s=0;if(f=(r|=0)+5|0,n=1<<r,31!=(0|r)){a=0;do{for(c=a<<r,l=0|sr(a,i),o=t=0;s=(o=(2048+(or[e+(t+c<<1)>>1]<<f)>>12)+o|0)+(0|cr[(u=A+(t+l)|0)>>0])|0,tr[u>>0]=(0|s)<0?0:255&((0|s)<255?s:255),(0|(t=t+1|0))<(0|n););a=a+1|0}while((0|a)<(0|n))}},function(A,e,r,i){A|=0,e|=0,i|=0;var f,n,t=0,o=0,a=0,c=0,l=0;if(f=(r|=0)+5|0,n=1<<r,31!=(0|r)){a=0;do{for(o=t=0;o=(2048+(or[e+((t<<r)+a<<1)>>1]<<f)>>12)+o|0,c=A+((0|sr(t,i))+a)|0,l=o+(0|cr[c>>0])|0,tr[c>>0]=(0|l)<0?0:255&((0|l)<255?l:255),(0|(t=t+1|0))<(0|n););a=a+1|0}while((0|a)<(0|n))}},function(A,e,r,i){br(37782,28463,68,28505)},function(A,e,r,i){A|=0,e|=0,r|=0;var f,n,t,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0;for(ur=(t=ur)+32|0,f=t,a=(n=20-(i|=0)|0)-1|0,o=0;c=0|or[e+(o<<1)>>1],b=(74*(l=0|or[e+(o+4<<1)>>1])|0)+(29*c|0)+(84*(u=0|or[e+(o+8<<1)>>1])|0)+(55*(s=0|or[e+(o+12<<1)>>1])|0)+64>>7,or[f+(o<<1)>>1]=(0|b)<-32768?-32768:65535&((0|b)<32767?b:32767),b=(0|sr(s,-84))+((0|sr(u,-29))+((74*l|0)+(55*c|0)))+64>>7,or[f+8+(o<<1)>>1]=(0|b)<-32768?-32768:65535&((0|b)<32767?b:32767),b=(74*s|0)+((0|sr(u,-74))+(74*c|0))+64>>7,or[f+16+(o<<1)>>1]=(0|b)<-32768?-32768:65535&((0|b)<32767?b:32767),c=(0|sr(s,-29))+((55*u|0)+((0|sr(l,-74))+(84*c|0)))+64>>7,or[f+24+(o<<1)>>1]=(0|c)<-32768?-32768:65535&((0|c)<32767?c:32767),4!=(0|(o=o+1|0)););for(c=1<<a,a=(e=1<<i)+65535|0,o=0;b=0|sr(o,r),s=0|or[f+(o<<3)>>1],k=(74*(u=0|or[f+(o<<3)+2>>1])|0)+(29*s|0)+(84*(l=0|or[f+(o<<3)+4>>1])|0)+(55*(i=0|or[f+(o<<3)+6>>1])|0)+c>>n,k=(0|lr[(d=A+(b<<1)|0)>>1])+((0|k)<-32768?-32768:(0|k)<32767?k:32767)|0,or[d>>1]=(0|k)<0?0:65535&((0|k)<(0|e)?k:a),d=(0|sr(i,-84))+((0|sr(l,-29))+((74*u|0)+(55*s|0)))+c>>n,d=(0|lr[(k=A+(b+1<<1)|0)>>1])+((0|d)<-32768?-32768:(0|d)<32767?d:32767)|0,or[k>>1]=(0|d)<0?0:65535&((0|d)<(0|e)?d:a),k=(74*i|0)+((0|sr(l,-74))+(74*s|0))+c>>n,k=(0|lr[(d=A+(b+2<<1)|0)>>1])+((0|k)<-32768?-32768:(0|k)<32767?k:32767)|0,or[d>>1]=(0|k)<0?0:65535&((0|k)<(0|e)?k:a),s=(0|sr(i,-29))+((55*l|0)+((0|sr(u,-74))+(84*s|0)))+c>>n,s=(0|lr[(b=A+(b+3<<1)|0)>>1])+((0|s)<-32768?-32768:(0|s)<32767?s:32767)|0,or[b>>1]=(0|s)<0?0:65535&((0|s)<(0|e)?s:a),4!=(0|(o=o+1|0)););ur=t},function(A,e,r,i){jt(A|=0,r|=0,4,e|=0,i|=0)},function(A,e,r,i){jt(A|=0,r|=0,8,e|=0,i|=0)},function(A,e,r,i){jt(A|=0,r|=0,16,e|=0,i|=0)},function(A,e,r,i){jt(A|=0,r|=0,32,e|=0,i|=0)},function(A,e,r,i){A|=0,e|=0;var f,n,t,o,a=0,c=0,l=0,u=0,s=0,b=0,d=0;for(ur=(o=ur)+32|0,t=o,c=(r|=0)+-1|0,f=(a=1<<(i|=0))+65535|0,n=0-a|0,i=0;l=0|or[e+(i<<1)>>1],d=(74*(u=0|or[e+(i+4<<1)>>1])|0)+(29*l|0)+(84*(s=0|or[e+(i+8<<1)>>1])|0)+(55*(b=0|or[e+(i+12<<1)>>1])|0)+64>>7,or[t+(i<<1)>>1]=(0|d)<(0|n)?n:(0|d)<(0|a)?d:f,d=(0|sr(b,-84))+((0|sr(s,-29))+((74*u|0)+(55*l|0)))+64>>7,or[t+8+(i<<1)>>1]=(0|d)<(0|n)?n:(0|d)<(0|a)?d:f,d=(74*b|0)+((0|sr(s,-74))+(74*l|0))+64>>7,or[t+16+(i<<1)>>1]=(0|d)<(0|n)?n:(0|d)<(0|a)?d:f,l=(0|sr(b,-29))+((55*s|0)+((0|sr(u,-74))+(84*l|0)))+64>>7,or[t+24+(i<<1)>>1]=(0|l)<(0|n)?n:(0|l)<(0|a)?l:f,4!=(0|(i=i+1|0)););for(a=1<<c,i=0;d=i<<2,b=0|or[t+(i<<3)>>1],c=74*(s=0|or[t+(i<<3)+2>>1])|0,u=0|or[t+(i<<3)+4>>1],l=0|or[t+(i<<3)+6>>1],ar[A+(d<<2)>>2]=(55*l|0)+((84*u|0)+(c+(29*b|0)))+a>>r,c=(0|sr(l,-84))+((0|sr(u,-29))+(c+(55*b|0)))+a>>r,ar[A+((1|d)<<2)>>2]=c,c=(74*l|0)+((0|sr(u,-74))+(74*b|0))+a>>r,ar[A+((2|d)<<2)>>2]=c,b=(0|sr(l,-29))+((55*u|0)+((0|sr(s,-74))+(84*b|0)))+a>>r,ar[A+((3|d)<<2)>>2]=b,4!=(0|(i=i+1|0)););ur=o},function(A,e,r,i){Ht(A|=0,4,e|=0,r|=0,i|=0)},function(A,e,r,i){Ht(A|=0,8,e|=0,r|=0,i|=0)},function(A,e,r,i){Ht(A|=0,16,e|=0,r|=0,i|=0)},function(A,e,r,i){Ht(A|=0,32,e|=0,r|=0,i|=0)},Pu,Pu,Pu,Pu,Pu],vs=[Lu,function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n=0;do{if(0|tu(A,0|ar[e+8>>2]))au(0,e,r,i);else if(0|tu(A,0|ar[e>>2])){if(A=e+32|0,(0|ar[e+16>>2])!=(0|r)&&(0|ar[(n=e+20|0)>>2])!=(0|r)){ar[A>>2]=i,ar[n>>2]=r,ar[(i=e+40|0)>>2]=1+(0|ar[i>>2]),1==(0|ar[e+36>>2])&&2==(0|ar[e+24>>2])&&(tr[e+54>>0]=1),ar[e+44>>2]=4;break}1==(0|i)&&(ar[A>>2]=1)}}while(0)},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0;do{if(0|tu(A,0|ar[e+8>>2]))au(0,e,r,i);else{if(n=A+8|0,!(0|tu(A,0|ar[e>>2]))){o=0|ar[n>>2],vs[15&ar[24+(0|ar[o>>2])>>2]](o,e,r,i,f);break}if(A=e+32|0,(0|ar[e+16>>2])!=(0|r)&&(0|ar[(t=e+20|0)>>2])!=(0|r)){if(ar[A>>2]=i,4==(0|ar[(i=e+44|0)>>2]))break;tr[(A=e+52|0)>>0]=0,n=(tr[(a=e+53|0)>>0]=0)|ar[n>>2],gs[15&ar[20+(0|ar[n>>2])>>2]](n,e,r,r,1,f),0|tr[a>>0]?0|tr[A>>0]?A=3:(A=3,o=11):(A=4,o=11),11==(0|o)&&(ar[t>>2]=r,ar[(a=e+40|0)>>2]=1+(0|ar[a>>2]),1==(0|ar[e+36>>2])&&2==(0|ar[e+24>>2])&&(tr[e+54>>0]=1)),ar[i>>2]=A;break}1==(0|i)&&(ar[A>>2]=1)}}while(0)},function(A,e,r,i,f){A|=0,e|=0,r|=0,i|=0,f|=0;var n=0,t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0,d=0,k=0,h=0;A:do{if(0|tu(A,0|ar[e+8>>2]))au(0,e,r,i);else{if(t=A+12|0,d=e+24|0,k=e+36|0,h=e+54|0,s=A+8|0,l=A+16|0,!(0|tu(A,0|ar[e>>2]))){if(o=A+16+((b=0|ar[t>>2])<<3)|0,du(l,e,r,i,f),n=A+24|0,(0|b)<=1)break;if(0==(2&(t=0|ar[s>>2])|0)&&1!=(0|ar[k>>2])){if(!(1&t))for(;;){if(0|tr[h>>0])break A;if(1==(0|ar[k>>2]))break A;if(du(n,e,r,i,f),o>>>0<=(n=n+8|0)>>>0)break A}for(;;){if(0|tr[h>>0])break A;if(1==(0|ar[k>>2])&&1==(0|ar[d>>2]))break A;if(du(n,e,r,i,f),o>>>0<=(n=n+8|0)>>>0)break A}}for(;;){if(0|tr[h>>0])break A;if(du(n,e,r,i,f),o>>>0<=(n=n+8|0)>>>0)break A}}if(n=e+32|0,(0|ar[e+16>>2])!=(0|r)&&(0|ar[(b=e+20|0)>>2])!=(0|r)){if(ar[n>>2]=i,4==(0|ar[(u=e+44|0)>>2]))break;i=A+16+(ar[t>>2]<<3)|0,a=e+52|0,c=e+53|0,A=l,o=n=0;e:for(;;){if(i>>>0<=A>>>0){t=18;break}if(tr[a>>0]=0,tr[c>>0]=0,bu(A,e,r,r,1,f),0|tr[h>>0]){t=18;break}do{if(0|tr[c>>0]){if(!(0|tr[a>>0])){if(1&ar[s>>2]){n=1,t=o;break}n=1,t=18;break e}if(1==(0|ar[d>>2])){t=23;break e}if(!(2&ar[s>>2])){t=23;break e}t=n=1}else t=o}while(0);A=A+8|0,o=t}do{if(18==(0|t)){if(!o&&(ar[b>>2]=r,ar[(r=e+40|0)>>2]=1+(0|ar[r>>2]),1==(0|ar[k>>2]))&&2==(0|ar[d>>2])){if(tr[h>>0]=1,n){t=23;break}n=4;break}n?t=23:n=4}}while(0);23==(0|t)&&(n=3),ar[u>>2]=n;break}1==(0|i)&&(ar[n>>2]=1)}}while(0)},function(A,e,r,i,f){A|=0,e|=0,r|=0,f|=0;var n,t,o=0,a=0,c=0,l=0,u=0;if(!((0|(i|=0))<=0)){t=255+(n=1<<f)|0,f=0;do{for(a=0|sr(f,e),c=0|sr(f,i),o=0;u=(0|cr[(l=A+(o+a)|0)>>0])+(0|ar[r+(o+c<<2)>>2])|0,tr[l>>0]=(0|u)<0?0:255&((0|u)<(0|n)?u:t),(0|(o=o+1|0))!=(0|i););f=f+1|0}while((0|f)!=(0|i))}},function(A,e,r,i,f){A|=0,e|=0,r|=0,f|=0;var n,t,o=0,a=0,c=0,l=0,u=0;if(!((0|(i|=0))<=0)){t=65535+(n=1<<f)|0,f=0;do{for(a=0|sr(f,e),c=0|sr(f,i),o=0;u=(0|lr[(l=A+(o+a<<1)|0)>>1])+(0|ar[r+(o+c<<2)>>2])|0,or[l>>1]=(0|u)<0?0:65535&((0|u)<(0|n)?u:t),(0|(o=o+1|0))!=(0|i););f=f+1|0}while((0|f)!=(0|i))}},function(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t=0,o=0,a=0,c=0,l=0;if(n=1<<(f|=0)+-1,0<(0|(r|=0))){a=0;do{for(c=0|sr(a,r),o=t=0;o=((or[e+((l=t+c|0)<<1)>>1]<<i)+n>>f)+o|0,ar[A+(l<<2)>>2]=o,(0|(t=t+1|0))!=(0|r););a=a+1|0}while((0|a)!=(0|r))}},function(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t=0,o=0,a=0,c=0;if(n=1<<(f|=0)+-1,0<(0|(r|=0))){a=0;do{for(o=t=0;c=(0|sr(t,r))+a|0,o=((or[e+(c<<1)>>1]<<i)+n>>f)+o|0,ar[A+(c<<2)>>2]=o,(0|(t=t+1|0))!=(0|r););a=a+1|0}while((0|a)!=(0|r))}},function(A,e,r,i,f){A|=0,e|=0,i|=0;var n,t=0,o=0,a=0,c=0;if(n=1<<(f|=0)+-1,0<(0|(r|=0))){o=0;do{for(a=0|sr(o,r),t=0;ar[A+((c=t+a|0)<<2)>>2]=(or[e+(c<<1)>>1]<<i)+n>>f,(0|(t=t+1|0))!=(0|r););o=o+1|0}while((0|o)!=(0|r))}},Lu,Lu,Lu,Lu,Lu,Lu,Lu],gs=[Ku,function(A,e,r,i,f,n){A|=0,r|=0,i|=0,f|=0,n|=0;var t,o=0,a=0,c=0,l=0,u=0;l=(a=0|ar[(o=(e|=0)+44|0)>>2])>>>0<(c=u=0|ar[(t=e+24|0)>>2])>>>0?(ar[o>>2]=u,c):a,a=24&n;A:do{if(0==(0|a)||1==(0|f)&24==(0|a))o=a=-1;else{e:do{switch(0|f){case 0:a=o=0;break;case 1:if(8&n){a=((0|(o=a=(0|ar[e+12>>2])-(0|ar[e+8>>2])|0))<0)<<31>>31;break e}a=((0|(o=a=c-(0|ar[e+20>>2])|0))<0)<<31>>31;break e;case 2:(0|tr[(o=e+32|0)+11>>0])<0&&(o=0|ar[o>>2]),a=((0|(o=a=l-o|0))<0)<<31>>31;break;default:o=a=-1;break A}}while(0);if(a=0|vu(0|o,0|a,0|r,0|i),0<=(0|(o=D)))if((0|tr[(c=e+32|0)+11>>0])<0&&(c=0|ar[c>>2]),(0|(r=((0|(i=l-c|0))<0)<<31>>31))<(0|o)|(0|r)==(0|o)&i>>>0<a>>>0)o=a=-1;else{if(c=8&n,!(0==(0|a)&0==(0|o))){if(0|c&&0==(0|ar[e+12>>2])){o=a=-1;break}if(0!=(16&n|0)&0==(0|u)){o=a=-1;break}}0|c&&(ar[e+12>>2]=(0|ar[e+8>>2])+a,ar[e+16>>2]=l),16&n&&(ar[t>>2]=(0|ar[e+20>>2])+a)}else o=a=-1}}while(0);ar[(u=A)>>2]=0,ar[u+4>>2]=0,ar[(A=A+8|0)>>2]=a,ar[A+4>>2]=o},function(A,e,r,i,f,n){n|=0,ar[(n=A|=0)>>2]=0,ar[n+4>>2]=0,ar[(n=A+8|0)>>2]=-1,ar[n+4>>2]=-1},function(A,e,r,i,f,n){n|=0,ar[(n=A|=0)>>2]=0,ar[n+4>>2]=0,ar[(n=A+8|0)>>2]=-1,ar[n+4>>2]=-1},function(A,e,r,i,f,n){var t,o,a,c;for(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t=ur=(o=ur)+31&-32,ur=ur+16|0,ar[t>>2]=0,ar[4+t>>2]=0,e=ar[8+t>>2]=0;3!=(0|e);)e=e+1|(ar[t+(e<<2)>>2]=0);for(n=(e=(c=(a=0|tr[n+11>>0])<<24>>24<0)?0|ar[n>>2]:n)+(c?0|ar[n+4>>2]:255&a)|0;!(n>>>0<=e>>>0);)jl(t,0|tr[e>>0]),e=e+1|0;for(r=0|ii(0,0,0,e=(0|tr[11+t>>0])<0?0|ar[t>>2]:t),ar[A>>2]=0,ar[A+4>>2]=0,n=ar[A+8>>2]=0;3!=(0|n);)n=n+1|(ar[A+(n<<2)>>2]=0);for(n=e+(0|ta(r))|0;!(n>>>0<=e>>>0);)jl(A,0|tr[e>>0]),e=e+1|0;Yl(t),ur=o},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0;var t,o,a,c,l,u,s=0,b=0,d=0,k=0,h=0,w=0;for(w=ur=(u=ur)+31&-32,ur=ur+176|0,o=w+168|0,a=w+40|0,c=w+36|0,l=w+32|0,k=(t=w)+24|0,w=w+16|0,ar[t>>2]=0,ar[t+4>>2]=0,e=ar[t+8>>2]=0;3!=(0|e);)e=e+1|(ar[t+(e<<2)>>2]=0);for(ar[k+4>>2]=0,ar[k>>2]=15236,b=(e=(d=(b=0|tr[n+8+3>>0])<<24>>24<0)?0|ar[n>>2]:n)+((d?0|ar[n+4>>2]:255&b)<<2)|0,d=32+a|0,n=e,e=0;2!=(0|e)&n>>>0<b>>>0;){if(ar[l>>2]=n,2==(0|(s=0|ss[15&ar[12+(0|ar[k>>2])>>2]](k,o,n,b,l,a,d,c)))||(0|ar[l>>2])==(0|n)){h=7;break}for(e=a;!(e>>>0>=(0|ar[c>>2])>>>0);)jl(t,0|tr[e>>0]),e=e+1|0;n=0|ar[l>>2],e=s}for(7==(0|h)&&me(),lf(),n=0|ii(0,0,0,s=(0|tr[t+11>>0])<0?0|ar[t>>2]:t),ar[A>>2]=0,ar[A+4>>2]=0,e=ar[A+8>>2]=0;3!=(0|e);)e=e+1|(ar[A+(e<<2)>>2]=0);for(ar[w+4>>2]=0,ar[w>>2]=15284,d=b=s+(0|ta(n))|0,k=128+a|0,n=s,e=0;;){if(!(2!=(0|e)&n>>>0<b>>>0)){h=21;break}if(ar[l>>2]=n,2==(0|(s=0|ss[15&ar[16+(0|ar[w>>2])>>2]](w,o,n,32<(d-n|0)?n+32|0:b,l,a,k,c)))||(0|ar[l>>2])==(0|n)){h=17;break}for(e=a;!(e>>>0>=(0|ar[c>>2])>>>0);)ru(A,0|ar[e>>2]),e=e+4|0;n=0|ar[l>>2],e=s}if(17==(0|h))me();else if(21==(0|h))return lf(),Yl(t),void(ur=u)},function(A,e,r,i,f,n){r|=0,i|=0,f|=0,n|=0,0|tu(A|=0,0|ar[(e|=0)+8>>2])&&cu(0,e,r,i,f)},function(A,e,r,i,f,n){r|=0,i|=0,f|=0,n|=0,0|tu(A|=0,0|ar[(e|=0)+8>>2])?cu(0,e,r,i,f):(A=0|ar[A+8>>2],gs[15&ar[20+(0|ar[A>>2])>>2]](A,e,r,i,f,n))},function(A,e,r,i,f,n){r|=0,i|=0,f|=0,n|=0;var t=0,o=0,a=0,c=0,l=0,u=0,s=0,b=0;if(0|tu(A|=0,0|ar[(e|=0)+8>>2]))cu(0,e,r,i,f);else{t=0|tr[(b=e+52|0)>>0],a=0|tr[(o=e+53|0)>>0],c=A+16+((s=0|ar[A+12>>2])<<3)|0,tr[b>>0]=0,bu(A+16|(tr[o>>0]=0),e,r,i,f,n);A:do{if(1<(0|s)){l=e+24|0,u=e+54|0,s=A+8|0,A=A+24|0;do{if(0|tr[u>>0])break A;if(0|tr[b>>0]){if(1==(0|ar[l>>2]))break A;if(!(2&ar[s>>2]))break A}else if(0|tr[o>>0]&&0==(1&ar[s>>2]|0))break A;tr[b>>0]=0,tr[o>>0]=0,bu(A,e,r,i,f,n),A=A+8|0}while(A>>>0<c>>>0)}}while(0);tr[b>>0]=t,tr[o>>0]=a}},function(A,e,r,i,f,n){A|=0,e|=0,r|=0,i|=0,n|=0;var t=0,o=0,a=0,c=0,l=0;if(1&(f|=0)|0&&br(29556,29569,40,29588),0<(0|n)&0<(0|f)){a=0;do{for(t=A+(0|sr(a,e))|0,o=r+((0|sr(a,i))<<1)|0,c=0;l=32+(0|or[o>>1])>>6,tr[t>>0]=(0|l)<0?0:255&((0|l)<255?l:255),l=32+(0|or[o+2>>1])>>6,tr[t+1>>0]=(0|l)<0?0:255&((0|l)<255?l:255),!((0|f)<=(0|(c=c+2|0)));)t=t+2|0,o=o+4|0;a=a+1|0}while((0|a)!=(0|n))}},Ku,Ku,Ku,Ku,Ku,Ku],ms=[qu,function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,f|=0,t|=0;var o=0,a=0,c=0,l=0,u=0,s=0;if(1&(n|=0)|0&&br(29556,29569,105,29689),0<(0|t)&0<(0|n)){l=0;do{for(c=0|sr(l,f),o=A+(0|sr(l,e))|0,a=i+(c<<1)|0,c=r+(c<<1)|0,u=0;s=64+(0|or[c>>1])+(0|or[a>>1])>>7,tr[o>>0]=(0|s)<0?0:255&((0|s)<255?s:255),s=64+(0|or[c+2>>1])+(0|or[a+2>>1])>>7,tr[o+1>>0]=(0|s)<0?0:255&((0|s)<255?s:255),!((0|n)<=(0|(u=u+2|0)));)o=o+2|0,a=a+4|0,c=c+4|0;l=l+1|0}while((0|l)!=(0|t))}},function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,n|=0;var o,a,c,l,u=0,s=0,b=0,d=0;if(c=0<(0|(l=14-(t|=0)|0))?1<<l-1:0,1&(f|=0)|0&&br(29556,29569,172,29722),!((0|n)<=0)&&(a=65535+(o=1<<t)|0,0<(0|f))){s=0;do{for(t=A+((0|sr(s,e))<<1)|0,u=r+((0|sr(s,i))<<1)|0,b=0;d=(0|or[u>>1])+c>>l,or[t>>1]=(0|d)<0?0:65535&((0|d)<(0|o)?d:a),d=(0|or[u+2>>1])+c>>l,or[t+2>>1]=(0|d)<0?0:65535&((0|d)<(0|o)?d:a),!((0|f)<=(0|(b=b+2|0)));)t=t+4|0,u=u+4|0;s=s+1|0}while((0|s)!=(0|n))}},function(A,e,r,i,f,n,t){A|=0,e|=0,r|=0,i|=0,t|=0;var o=0,a=0,c=0,l=0,u=0,s=0;if(0<(0|(n|=0))&0<(0|(f|=0))){c=0;do{for(t=r+(0|sr(c,i))|0,o=A+((0|sr(c,e))<<1)|0,a=0;s=(0|cr[t+1>>0])<<6&65535,u=(0|cr[t+2>>0])<<6&65535,l=(0|cr[t+3>>0])<<6&65535,or[o>>1]=(0|cr[t>>0])<<6,or[o+2>>1]=s,or[o+4>>1]=u,or[o+6>>1]=l,!((0|f)<=(0|(a=a+4|0)));)t=t+4|0,o=o+8|0;c=c+1|0}while((0|c)!=(0|n))}},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0,1,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0,2,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0,3,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,0,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,1,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,2,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,3,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,0,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,1,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,2,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,3,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,0,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,1,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,2,8)},function(A,e,r,i,f,n,t){Lt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,3,8)},qu,qu,qu,qu,qu,qu,qu,qu,qu,qu,qu,qu,qu],ps=[$u,function(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,i|=0,f|=0,t|=0;var a,c,l,u,s=0,b=0,d=0,k=0,h=0;if(l=1<<(u=15-(o|=0)|0)-1,1&(n|=0)|0&&br(29556,29569,238,29816),!((0|t)<=0)&&(c=65535+(a=1<<o)|0,0<(0|n))){d=0;do{for(b=0|sr(d,f),o=A+((0|sr(d,e))<<1)|0,s=i+(b<<1)|0,b=r+(b<<1)|0,k=0;h=(0|or[b>>1])+l+(0|or[s>>1])>>u,or[o>>1]=(0|h)<0?0:65535&((0|h)<(0|a)?h:c),h=(0|or[b+2>>1])+l+(0|or[s+2>>1])>>u,or[o+2>>1]=(0|h)<0?0:65535&((0|h)<(0|a)?h:c),!((0|n)<=(0|(k=k+2|0)));)o=o+4|0,s=s+4|0,b=b+4|0;d=d+1|0}while((0|d)!=(0|t))}},function(A,e,r,i,f,n,t,o){A|=0,e|=0,r|=0,i|=0,t|=0;var a,c=0,l=0;if(a=14-(o|=0)|0,0<(0|(n|=0))&0<(0|(f|=0))){c=0;do{for(t=A+((0|sr(c,e))<<1)|0,o=r+((0|sr(c,i))<<1)|0,l=0;or[t>>1]=(0|lr[o>>1])<<a,(0|(l=l+1|0))!=(0|f);)t=t+2|0,o=o+2|0;c=c+1|0}while((0|c)!=(0|n))}},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0,1,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0,2,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0,3,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,0,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,1,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,2,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,1,3,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,0,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,1,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,2,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,2,3,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,0,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,1,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,2,o|=0)},function(A,e,r,i,f,n,t,o){Kt(A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,3,3,o|=0)},$u,$u,$u,$u,$u,$u,$u,$u,$u,$u,$u,$u,$u,$u],ys=[As,function(A,e,r,i,f,n,t,o,a){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0;var c,l=0,u=0,s=0,b=0,d=0;if((0|(a|=0))<=0&&br(29619,29569,60,29629),c=1<<a+-1,0<(0|n)&0<(0|f)){s=0;do{for(l=A+(0|sr(s,e))|0,u=r+((0|sr(s,i))<<1)|0,b=0;d=((0|sr(0|or[u>>1],t))+c>>a)+o|0,tr[l>>0]=(0|d)<0?0:255&((0|d)<255?d:255),(0|(b=b+1|0))!=(0|f);)l=l+1|0,u=u+2|0;s=s+1|0}while((0|s)!=(0|n))}},function(A,e,r,i,f,n,t,o,a){A|=0,e|=0,r|=0,i|=0,t|=0,o|=0,a|=0;var c=0;if(0<(0|(n|=0))&0<(0|(f|=0))){a=0;do{for(t=r+(0|sr(a,i))|0,o=A+((0|sr(a,e))<<1)|0,c=0;or[o>>1]=(0|cr[t>>0])<<6,(0|(c=c+1|0))!=(0|f);)t=t+1|0,o=o+2|0;a=a+1|0}while((0|a)!=(0|n))}},As],Zs=[es,function(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,c|=0;var l,u,s,b=0,d=0,k=0,h=0;if((0|(a|=0))<=0&&br(29619,29569,193,29754),s=1<<a+-1,!((0|n)<=0)&&(u=65535+(l=1<<c)|0,0<(0|f))){d=0;do{for(c=A+((0|sr(d,e))<<1)|0,b=r+((0|sr(d,i))<<1)|0,k=0;h=((0|sr(0|or[b>>1],t))+s>>a)+o|0,or[c>>1]=(0|h)<0?0:65535&((0|h)<(0|l)?h:u),(0|(k=k+1|0))!=(0|f);)c=c+2|0,b=b+2|0;d=d+1|0}while((0|d)!=(0|n))}},function(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,i|=0,t|=0,o|=0,a|=0;var l,u,s,b=0,d=0,k=0,h=0,w=0,v=0;if(s=ur,k=(c|=0)+-8|0,h=0|sr((f|=0)<<1,l=(n|=0)+3|0),ur=(u=ur)+(15+(0|+h)&-16)|0,-1<(0|(h=n+2|0))){w=0<(0|f),a=-1;do{A:do{if(w)for(d=a+1|0,a=r+(((b=0)|sr(a,i))-1)|0;;){switch(0|t){case 0:c=0|cr[(a=a+1|0)>>0];break;case 1:v=a+1|0,c=(0|sr(0|cr[a>>0],-2))+(58*(0|cr[v>>0])|0)+(10*(0|cr[a+2>>0])|0)-(cr[a+3>>0]<<1)>>k&65535,a=v;break;case 2:v=a+1|0,c=(0|sr(0|cr[a>>0],-4))+(54*(0|cr[v>>0])|0)+(cr[a+2>>0]<<4)-(cr[a+3>>0]<<1)>>k&65535,a=v;break;case 3:v=a+1|0,c=(0|sr(0|cr[a>>0],-6))+(46*(0|cr[v>>0])|0)+(28*(0|cr[a+2>>0])|0)-(cr[a+3>>0]<<2)>>k&65535,a=v;break;case 4:v=a+1|0,c=(0|sr(0|cr[a>>0],-4))-(cr[a+3>>0]<<2)+(36*((0|cr[a+2>>0])+(0|cr[v>>0])|0)|0)>>k&65535,a=v;break;case 5:v=a+1|0,c=(0|sr(0|cr[a>>0],-4))+(28*(0|cr[v>>0])|0)+(46*(0|cr[a+2>>0])|0)+(0|sr(0|cr[a+3>>0],-6))>>k&65535,a=v;break;case 6:v=a+1|0,c=(0|sr(0|cr[a>>0],-2))+(cr[v>>0]<<4)+(54*(0|cr[a+2>>0])|0)-(cr[a+3>>0]<<2)>>k&65535,a=v;break;default:v=a+1|0,c=(0|sr(0|cr[a>>0],-2))+(10*(0|cr[v>>0])|0)+(58*(0|cr[a+2>>0])|0)-(cr[a+3>>0]<<1)>>k&65535,a=v}if(v=u+(d+(0|sr(b,l))<<1)|0,or[v>>1]=c,(0|(b=b+1|0))==(0|f)){a=d;break A}}else a=a+1|0}while(0)}while((0|a)!=(0|h))}if(k=0==(0|t)?k:6,(0|f)<=0)ur=s;else{h=0<(0|n),d=0;do{A:do{if(h)for(a=u+(((b=0)|sr(d,l))<<1)|0;;){switch(0|o){case 0:c=0|or[(a=a+2|0)>>1];break;case 1:v=a+2|0,c=(0|sr(0|or[a>>1],-2))+(58*(0|or[v>>1])|0)+(10*(0|or[a+4>>1])|0)-(or[a+6>>1]<<1)>>k&65535,a=v;break;case 2:v=a+2|0,c=(0|sr(0|or[a>>1],-4))+(54*(0|or[v>>1])|0)+(or[a+4>>1]<<4)-(or[a+6>>1]<<1)>>k&65535,a=v;break;case 3:v=a+2|0,c=(0|sr(0|or[a>>1],-6))+(46*(0|or[v>>1])|0)+(28*(0|or[a+4>>1])|0)-(or[a+6>>1]<<2)>>k&65535,a=v;break;case 4:v=a+2|0,c=(0|sr(0|or[a>>1],-4))-(or[a+6>>1]<<2)+(36*((0|or[a+4>>1])+(0|or[v>>1])|0)|0)>>k&65535,a=v;break;case 5:v=a+2|0,c=(0|sr(0|or[a>>1],-4))+(28*(0|or[v>>1])|0)+(46*(0|or[a+4>>1])|0)+(0|sr(0|or[a+6>>1],-6))>>k&65535,a=v;break;case 6:v=a+2|0,c=(0|sr(0|or[a>>1],-2))+(or[v>>1]<<4)+(54*(0|or[a+4>>1])|0)-(or[a+6>>1]<<2)>>k&65535,a=v;break;default:v=a+2|0,c=(0|sr(0|or[a>>1],-2))+(10*(0|or[v>>1])|0)+(58*(0|or[a+4>>1])|0)-(or[a+6>>1]<<1)>>k&65535,a=v}if(v=A+((0|sr(b,e))+d<<1)|0,or[v>>1]=c,(0|(b=b+1|0))==(0|n))break A}}while(0);d=d+1|0}while((0|d)!=(0|f));ur=s}},function(A,e,r,i,f,n,t,o,a,c){var l;if(A|=0,e|=0,r|=0,i|=0,t|=0,o|=0,a|=0,l=14-(c|=0)|0,0<(0|(n|=0))&0<(0|(f|=0))){a=0;do{for(t=r+((0|sr(a,i))<<1)|0,o=A+((0|sr(a,e))<<1)|0,c=0;or[o>>1]=(0|lr[t>>1])<<l,(0|(c=c+1|0))!=(0|f);)t=t+2|0,o=o+2|0;a=a+1|0}while((0|a)!=(0|n))}},function(A,e,r,i,f,n,t,o,a,c){A|=0,e|=0,r|=0,i|=0,t|=0,o|=0,a|=0;var l,u,s,b=0,d=0,k=0,h=0,w=0,v=0;if(s=ur,k=(c|=0)+-8|0,h=0|sr((f|=0)<<1,l=(n|=0)+3|0),ur=(u=ur)+(15+(0|+h)&-16)|0,-1<(0|(h=n+2|0))){w=0<(0|f),a=-1;do{A:do{if(w)for(d=a+1|0,a=r+(((b=0)|sr(a,i))-1<<1)|0;;){switch(0|t){case 0:c=0|or[(a=a+2|0)>>1];break;case 1:v=a+2|0,c=(0|sr(0|lr[a>>1],-2))+(58*(0|lr[v>>1])|0)+(10*(0|lr[a+4>>1])|0)-(lr[a+6>>1]<<1)>>k&65535,a=v;break;case 2:v=a+2|0,c=(0|sr(0|lr[a>>1],-4))+(54*(0|lr[v>>1])|0)+(lr[a+4>>1]<<4)-(lr[a+6>>1]<<1)>>k&65535,a=v;break;case 3:v=a+2|0,c=(0|sr(0|lr[a>>1],-6))+(46*(0|lr[v>>1])|0)+(28*(0|lr[a+4>>1])|0)-(lr[a+6>>1]<<2)>>k&65535,a=v;break;case 4:v=a+2|0,c=(0|sr(0|lr[a>>1],-4))-(lr[a+6>>1]<<2)+(36*((0|lr[a+4>>1])+(0|lr[v>>1])|0)|0)>>k&65535,a=v;break;case 5:v=a+2|0,c=(0|sr(0|lr[a>>1],-4))+(28*(0|lr[v>>1])|0)+(46*(0|lr[a+4>>1])|0)+(0|sr(0|lr[a+6>>1],-6))>>k&65535,a=v;break;case 6:v=a+2|0,c=(0|sr(0|lr[a>>1],-2))+(lr[v>>1]<<4)+(54*(0|lr[a+4>>1])|0)-(lr[a+6>>1]<<2)>>k&65535,a=v;break;default:v=a+2|0,c=(0|sr(0|lr[a>>1],-2))+(10*(0|lr[v>>1])|0)+(58*(0|lr[a+4>>1])|0)-(lr[a+6>>1]<<1)>>k&65535,a=v}if(v=u+(d+(0|sr(b,l))<<1)|0,or[v>>1]=c,(0|(b=b+1|0))==(0|f)){a=d;break A}}else a=a+1|0}while(0)}while((0|a)!=(0|h))}if(k=0==(0|t)?k:6,(0|f)<=0)ur=s;else{h=0<(0|n),d=0;do{A:do{if(h)for(a=u+(((b=0)|sr(d,l))<<1)|0;;){switch(0|o){case 0:c=0|or[(a=a+2|0)>>1];break;case 1:v=a+2|0,c=(0|sr(0|or[a>>1],-2))+(58*(0|or[v>>1])|0)+(10*(0|or[a+4>>1])|0)-(or[a+6>>1]<<1)>>k&65535,a=v;break;case 2:v=a+2|0,c=(0|sr(0|or[a>>1],-4))+(54*(0|or[v>>1])|0)+(or[a+4>>1]<<4)-(or[a+6>>1]<<1)>>k&65535,a=v;break;case 3:v=a+2|0,c=(0|sr(0|or[a>>1],-6))+(46*(0|or[v>>1])|0)+(28*(0|or[a+4>>1])|0)-(or[a+6>>1]<<2)>>k&65535,a=v;break;case 4:v=a+2|0,c=(0|sr(0|or[a>>1],-4))-(or[a+6>>1]<<2)+(36*((0|or[a+4>>1])+(0|or[v>>1])|0)|0)>>k&65535,a=v;break;case 5:v=a+2|0,c=(0|sr(0|or[a>>1],-4))+(28*(0|or[v>>1])|0)+(46*(0|or[a+4>>1])|0)+(0|sr(0|or[a+6>>1],-6))>>k&65535,a=v;break;case 6:v=a+2|0,c=(0|sr(0|or[a>>1],-2))+(or[v>>1]<<4)+(54*(0|or[a+4>>1])|0)-(or[a+6>>1]<<2)>>k&65535,a=v;break;default:v=a+2|0,c=(0|sr(0|or[a>>1],-2))+(10*(0|or[v>>1])|0)+(58*(0|or[a+4>>1])|0)-(or[a+6>>1]<<1)>>k&65535,a=v}if(v=A+((0|sr(b,e))+d<<1)|0,or[v>>1]=c,(0|(b=b+1|0))==(0|n))break A}}while(0);d=d+1|0}while((0|d)!=(0|f));ur=s}},es,es,es],Cs=[function(A,e,r,i,f,n,t,o,a,c,l,u){g(22)},function(A,e,r,i,f,n,t,o,a,c,l,u){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0;var s,b,d=0,k=0,h=0;if((0|(u|=0))<=0&&br(29619,29569,80,29658),b=a+1+l<<u,!((0|t)<=0)&&(s=u+1|0,0<(0|n))){d=0;do{for(u=0|sr(d,f),l=A+(0|sr(d,e))|0,a=i+(u<<1)|0,u=r+(u<<1)|0,k=0;h=(h=0|sr(0|or[u>>1],o))+b+(0|sr(0|or[a>>1],c))>>s,tr[l>>0]=(0|h)<0?0:255&((0|h)<255?h:255),(0|(k=k+1|0))!=(0|n);)l=l+1|0,a=a+2|0,u=u+2|0;d=d+1|0}while((0|d)!=(0|t))}}],Ws=[function(A,e,r,i,f,n,t,o,a,c,l,u,s){g(23)},function(A,e,r,i,f,n,t,o,a,c,l,u,s){A|=0,e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,s|=0;var b,d,k,h,w=0,v=0;if((0|(u|=0))<=0&&br(29619,29569,213,29784),h=a+1+l<<u,!((0|t)<=0)&&(k=u+1|0,d=65535+(b=1<<s)|0,0<(0|n))){s=0;do{for(u=0|sr(s,f),l=A+((0|sr(s,e))<<1)|0,a=i+(u<<1)|0,u=r+(u<<1)|0,w=0;v=(v=0|sr(0|or[u>>1],o))+h+(0|sr(0|or[a>>1],c))>>k,or[l>>1]=(0|v)<0?0:65535&((0|v)<(0|b)?v:d),(0|(w=w+1|0))!=(0|n);)l=l+2|0,a=a+2|0,u=u+2|0;s=s+1|0}while((0|s)!=(0|t))}}];return{__GLOBAL__I_000101:function(){!function(A){A|=0;var e=0;(function(A,e,r){var i,f;e|=0,r|=0,f=ur=(i=ur)+31&-32,ur=ur+16|0,Ti(A|=0),ar[A>>2]=12980,ar[A+32>>2]=e,ar[A+40>>2]=r,r=-1,ar[A+48>>2]=r,tr[A+52>>0]=0,r=0|ar[8+(0|ar[A>>2])>>2],dl(f,A+4|0),ks[63&r](A,f),df(f),ur=i})(52168,A=0|ar[2223],52224),ar[12872]=12552,ar[12874]=12572,ar[12873]=0,Yi(51496,52168),ar[12892]=0,e=-1,ar[12893]=e,function(A,e,r){var i,f;e|=0,r|=0,f=ur=(i=ur)+31&-32,ur=ur+16|0,Mi(A|=0),ar[A>>2]=12916,ar[A+32>>2]=e,ar[A+40>>2]=r,r=-1,ar[A+48>>2]=r,tr[A+52>>0]=0,r=0|ar[8+(0|ar[A>>2])>>2],dl(f,A+4|0),ks[63&r](A,f),df(f),ur=i}(52232,A,52288),ar[12894]=12600,ar[12896]=12620,ar[12895]=0,Yi(51584,52232),ar[12914]=0,A=-1,ar[12915]=A,Af(52296,A=0|ar[2129],52344),ar[12916]=28,ar[12917]=48,Yi(51668,52296),ar[12935]=0,e=-1,ar[12936]=e,ef(52352,A,52400),ar[12937]=12656,ar[12938]=12676,Yi(51752,52352),ar[12956]=0,A=-1,ar[12957]=A,Af(52408,A=0|ar[2255],52456),ar[12958]=28,ar[12959]=48,Yi(51836,52408),ar[12977]=0,e=-1,ar[12978]=e,e=0|ar[51832+(0|ar[(0|ar[12958])-12>>2])+24>>2],ar[13e3]=28,ar[13001]=48,Yi(52004,e),ar[13019]=0,e=-1,ar[13020]=e,ef(52464,A,52512),ar[12979]=12656,ar[12980]=12676,Yi(51920,52464),ar[12998]=0,A=-1,ar[12999]=A,A=0|ar[51916+(0|ar[(0|ar[12979])-12>>2])+24>>2],ar[13021]=12656,ar[13022]=12676,Yi(52088,A),ar[13040]=0,A=-1,ar[13041]=A,ar[51488+(0|ar[(0|ar[12872])-12>>2])+72>>2]=51664,ar[51576+(0|ar[(0|ar[12894])-12>>2])+72>>2]=51748,A=51832+(0|ar[(0|ar[12958])-12>>2])+4|0,ar[A>>2]=8192|ar[A>>2],A=51916+(0|ar[(0|ar[12979])-12>>2])+4|0,ar[A>>2]=8192|ar[A>>2],ar[51832+(0|ar[(0|ar[12958])-12>>2])+72>>2]=51664,ar[51916+(0|ar[(0|ar[12979])-12>>2])+72>>2]=51748}(0)},__GLOBAL__sub_I_bind_cpp:function(){oA(3680,42233),S(3696,42238,1,1,0),AA(3704,42243,1,-128,127),AA(3720,42248,1,-128,127),AA(3712,42260,1,0,255),AA(3728,42274,2,-32768,32767),AA(3736,42280,2,0,65535),AA(3744,42295,4,-2147483648,2147483647),AA(3752,42299,4,0,-1),AA(3760,42312,4,-2147483648,2147483647),AA(3768,42317,4,0,-1),q(3784,42331,4),q(3792,42337,8),iA(1680,42344),iA(1936,42356),fA(1960,4,42389),P(1584,42402),eA(1984,0,42418),eA(1992,0,42448),eA(2e3,1,42485),eA(2008,2,42524),eA(2016,3,42555),eA(2024,4,42595),eA(2032,5,42624),eA(2040,4,42662),eA(2048,5,42692),eA(1992,0,42731),eA(2e3,1,42763),eA(2008,2,42796),eA(2016,3,42829),eA(2024,4,42863),eA(2032,5,42896),eA(2056,6,42930),eA(2064,7,42961),eA(2072,7,42993)},__GLOBAL__sub_I_box_cc:function(){var A,e;ur=(e=ur)+16|0,ar[(A=e)>>2]=0,ar[A+4>>2]=0,Cc(49920,ar[A+8>>2]=0,0,A),ur=(0<=(0|tr[A+11>>0])||Vl(0|ar[A>>2]),e)},__GLOBAL__sub_I_heif_cc:function(){!function(A){A|=0;var e=0;$(22499,1,5456,22516,64,290),$(22519,1,5460,22516,65,2),$(22543,1,5464,22516,66,3),$(22562,2,5468,22580,44,291),$(22584,3,5476,22614,29,51),$(22619,2,5488,22663,21,67),$(22667,3,5496,22614,30,52),$(22700,4,5508,22721,7,10),$(22727,2,5524,22580,45,292),U(1072,1080,1096,0,22516,68,22759,0,22759,0,22753,22761,293),x(1072,1,5532,22516,69,4),H(1072,22764,1072,49920,22516,70,22580,46),A=0|El(4),ar[A>>2]=0,e=0|El(4),ar[e>>2]=0,z(1072,22767,1112,22663,22,0|A,1112,22778,53,0|e),e=0|El(4),ar[e>>2]=4,A=0|El(4),ar[A>>2]=4,z(1072,22783,1120,22663,23,0|e,1120,22778,54,0|A),U(1128,1136,1152,0,22516,71,22759,0,22759,0,22798,22761,294),U(1168,1184,1200,1128,22516,72,22516,73,22516,74,22817,22761,295),x(1168,2,5536,22663,24,75),A=0|El(8),ar[A>>2]=76,ar[A+4>>2]=0,j(1168,22832,2,5544,22663,25,0|A,0),U(1216,1224,1240,0,22516,77,22759,0,22759,0,22838,22761,296),x(1216,1,5552,22516,78,5),A=0|El(8),ar[A>>2]=79,ar[A+4>>2]=0,j(1216,22845,2,5556,22663,26,0|A,0),U(64,1256,1272,0,22516,80,22759,0,22759,0,22856,22761,297),A=0|El(8),ar[A>>2]=81,ar[A+4>>2]=0,j(64,22866,2,5564,22663,27,0|A,0),A=0|El(8),ar[A>>2]=82,ar[A+4>>2]=0,j(64,22879,2,5572,22663,28,0|A,0),A=0|El(8),ar[A>>2]=83,ar[A+4>>2]=0,j(64,22895,2,5572,22663,28,0|A,0),A=0|El(8),ar[A>>2]=47,ar[A+4>>2]=0,j(64,22910,2,5580,22663,29,0|A,0),A=0|El(4),ar[A>>2]=48,j(64,22926,2,5588,22663,30,0|A,0),U(104,1288,1304,64,22516,84,22516,85,22516,86,22931,22761,298),O(104,37953,2,5596,22663,31,49),A=0|El(8),ar[A>>2]=55,ar[A+4>>2]=0,j(104,22935,3,5604,22614,31,0|A,0),A=0|El(4),ar[A>>2]=50,j(104,22926,2,5616,22663,32,0|A,0),rA(1320,104,22931,2,22516,87,22949,6,22663,33,22761,299),U(1328,1336,1352,0,22516,88,22759,0,22759,0,22951,22761,300),x(1328,1,5624,22516,89,7),A=0|El(4),ar[A>>2]=56,j(1328,22960,3,5628,22614,32,0|A,0),A=0|El(8),ar[A>>2]=90,ar[A+4>>2]=0,j(1328,22977,2,5640,22663,34,0|A,0),A=0|El(8),ar[A>>2]=91,ar[A+4>>2]=0,j(1328,22992,2,5648,22663,35,0|A,0),A=0|El(8),ar[A>>2]=51,ar[A+4>>2]=0,j(1328,23013,2,5656,22663,36,0|A,0),A=0|El(4),ar[A>>2]=11,j(1328,23026,4,5664,22721,8,0|A,0),L(1112,23052,4,0),K(1112,23068,0),K(1112,23082,1),K(1112,23114,2),K(1112,23139,3),K(1112,23171,4),K(1112,23202,5),K(1112,23225,6),L(1120,23260,4,0),K(1120,23279,0),K(1120,23305,100),K(1120,23331,101),K(1120,23362,102),K(1120,23388,103),K(1120,23414,104),K(1120,23440,105),K(1120,23466,107),K(1120,23492,108),K(1120,23518,109),K(1120,23544,110),K(1120,23570,111),K(1120,23596,112),K(1120,23622,113),K(1120,23648,114),K(1120,23678,115),K(1120,23733,116),K(1120,23778,117),K(1120,23805,118),K(1120,23837,119),K(1120,23871,1e3),K(1120,23909,2e3),K(1120,23952,2001),K(1120,23988,3e3),K(1120,24020,3001),L(1368,24057,4,0),K(1368,24081,0),K(1368,24108,1),K(1368,24130,2),K(1368,24151,3),L(1376,24173,4,0),K(1376,24185,99),K(1376,24207,0),K(1376,24230,1),K(1376,24246,2),K(1376,24262,3),K(1376,24278,10),L(1384,24308,4,0),K(1384,24324,99),K(1384,24350,0),K(1384,24372,1),K(1384,24392,2),L(1392,24419,4,0),K(1392,24432,0),K(1392,24447,2),K(1392,24463,1),K(1392,24479,3),K(1392,24494,4),K(1392,24509,5),K(1392,24524,6),K(1392,24543,10),function(A){U(1624,1648,1664,0,22516,95,22759,0,22759,0,0|(A|=0),22761,305),x(1624,1,5748,22516,96,9),A=0|El(8),ar[A>>2]=52,ar[A+4>>2]=0,j(1624,24826,3,5752,22778,59,0|A,0),A=0|El(8),ar[A>>2]=60,ar[A+4>>2]=0,j(1624,24836,4,5764,24843,12,0|A,0),A=0|El(8),ar[A>>2]=97,ar[A+4>>2]=0,j(1624,24849,2,5780,22663,39,0|A,0),A=0|El(4),ar[A>>2]=61,j(1624,41865,3,5788,22614,33,0|A,0),A=0|El(4),ar[A>>2]=34,j(1624,24854,4,5800,22721,9,0|A,0)}(24568),function(A){U(1528,1552,1568,0,22516,98,22759,0,22759,0,0|(A|=0),22761,306),x(1528,1,5680,22516,99,10),A=0|El(8),ar[A>>2]=53,ar[A+4>>2]=0,j(1528,24826,3,5684,22778,62,0|A,0),A=0|El(8),ar[A>>2]=63,ar[A+4>>2]=0,j(1528,24836,4,5696,24843,13,0|A,0),A=0|El(8),ar[A>>2]=100,ar[A+4>>2]=0,j(1528,24849,2,5712,22663,40,0|A,0),A=0|El(4),ar[A>>2]=64,j(1528,41865,3,5720,22614,35,0|A,0),A=0|El(4),ar[A>>2]=36,j(1528,24854,4,5732,22721,10,0|A,0)}(24581),U(1400,1408,1424,0,22516,92,22759,0,22759,0,24594,22761,301),U(1440,1448,1464,0,22516,93,22759,0,22759,0,24607,22761,302),U(1480,1488,1504,0,22516,94,22759,0,22759,0,24625,22761,303),nA(1520,24636,22949,8,22761,304),A=0|El(4),ar[A>>2]=0,e=0|El(4),ar[e>>2]=0,tA(1520,24647,1112,22663,37,0|A,1112,22778,57,0|e),e=0|El(4),ar[e>>2]=4,A=0|El(4),ar[A>>2]=4,tA(1520,24652,1120,22663,38,0|e,1120,22778,58,0|A),M(1520)}(0)},__GLOBAL__sub_I_iostream_cpp:function(){},___cxa_can_catch:function(A,e,r){var i,f;return A|=0,e|=0,r|=0,i=ur=(f=ur)+31&-32,ur=ur+16|0,ar[i>>2]=ar[r>>2],(A=0|ns[63&ar[16+(0|ar[A>>2])>>2]](A,e,i))&&(ar[r>>2]=ar[i>>2]),ur=f,1&A|0},___cxa_is_pointer_type:function(A){return 1&(A=(A|=0)?0!=(0|lu(A,3560,3648,0)):0)|0},___errno_location:fa,___getTypeName:function(A){return 0|(e=0|ar[(A|=0)+4>>2],(i=(i=0)|qo(r=1+(0|ta(e|=0))|0))?Eu(0|i,0|e,0|r):i=0,0|i);var e,r,i},___muldi3:wu,___udivdi3:yu,___uremdi3:Zu,_bitshift64Ashr:Cu,_bitshift64Lshr:Wu,_bitshift64Shl:Iu,_emscripten_get_global_libc:function(){return 51368},_emscripten_replace_memory:function(A){return!(16777215&u(A)||u(A)<=16777215||2147483648<u(A))&&(tr=new i(A),or=new f(A),ar=new n(A),cr=new t(A),lr=new o(A),new a(A),Y=new c(A),J=new l(A),r=A,!0)},_free:$o,_i64Add:vu,_i64Subtract:gu,_llvm_bswap_i32:Bu,_malloc:qo,_memcpy:Eu,_memmove:Gu,_memset:Vu,_pthread_cond_broadcast:Xu,_pthread_mutex_lock:_u,_pthread_mutex_unlock:Fu,_sbrk:Nu,dynCall_i:function(A){return 0|rs[15&(A|=0)]()},dynCall_ii:function(A,e){return e|=0,0|is[127&(A|=0)](0|e)},dynCall_iii:function(A,e,r){return e|=0,r|=0,0|fs[63&(A|=0)](0|e,0|r)},dynCall_iiii:function(A,e,r,i){return e|=0,r|=0,i|=0,0|ns[63&(A|=0)](0|e,0|r,0|i)},dynCall_iiiii:function(A,e,r,i,f){return e|=0,r|=0,i|=0,f|=0,0|ts[15&(A|=0)](0|e,0|r,0|i,0|f)},dynCall_iiiiid:function(A,e,r,i,f,n){return e|=0,r|=0,i|=0,f|=0,n=+n,0|os[7&(A|=0)](0|e,0|r,0|i,0|f,+n)},dynCall_iiiiii:function(A,e,r,i,f,n){return e|=0,r|=0,i|=0,f|=0,n|=0,0|as[31&(A|=0)](0|e,0|r,0|i,0|f,0|n)},dynCall_iiiiiid:function(A,e,r,i,f,n,t){return e|=0,r|=0,i|=0,f|=0,n|=0,t=+t,0|cs[3&(A|=0)](0|e,0|r,0|i,0|f,0|n,+t)},dynCall_iiiiiii:function(A,e,r,i,f,n,t){return e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,0|ls[63&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t)},dynCall_iiiiiiii:function(A,e,r,i,f,n,t,o){return e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,0|us[7&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o)},dynCall_iiiiiiiii:function(A,e,r,i,f,n,t,o,a){return e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,0|ss[15&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o,0|a)},dynCall_v:function(A){bs[3&(A|=0)]()},dynCall_vi:function(A,e){e|=0,ds[511&(A|=0)](0|e)},dynCall_vii:function(A,e,r){e|=0,r|=0,ks[63&(A|=0)](0|e,0|r)},dynCall_viii:function(A,e,r,i){e|=0,r|=0,i|=0,hs[127&(A|=0)](0|e,0|r,0|i)},dynCall_viiii:function(A,e,r,i,f){e|=0,r|=0,i|=0,f|=0,ws[31&(A|=0)](0|e,0|r,0|i,0|f)},dynCall_viiiii:function(A,e,r,i,f,n){e|=0,r|=0,i|=0,f|=0,n|=0,vs[15&(A|=0)](0|e,0|r,0|i,0|f,0|n)},dynCall_viiiiii:function(A,e,r,i,f,n,t){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,gs[15&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t)},dynCall_viiiiiii:function(A,e,r,i,f,n,t,o){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,ms[31&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o)},dynCall_viiiiiiii:function(A,e,r,i,f,n,t,o,a){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,ps[31&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o,0|a)},dynCall_viiiiiiiii:function(A,e,r,i,f,n,t,o,a,c){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,ys[3&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o,0|a,0|c)},dynCall_viiiiiiiiii:function(A,e,r,i,f,n,t,o,a,c,l){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,Zs[7&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o,0|a,0|c,0|l)},dynCall_viiiiiiiiiiii:function(A,e,r,i,f,n,t,o,a,c,l,u,s){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0,Cs[1&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o,0|a,0|c,0|l,0|u,0|s)},dynCall_viiiiiiiiiiiii:function(A,e,r,i,f,n,t,o,a,c,l,u,s,b){e|=0,r|=0,i|=0,f|=0,n|=0,t|=0,o|=0,a|=0,c|=0,l|=0,u|=0,s|=0,b|=0,Ws[1&(A|=0)](0|e,0|r,0|i,0|f,0|n,0|t,0|o,0|a,0|c,0|l,0|u,0|s,0|b)},establishStackSpace:function(A,e){ur=A|=0,e|=0},getTempRet0:function(){return 0|D},runPostSets:function(){},setTempRet0:function(A){D=A|=0},setThrew:function(A,e){A|=0,e|=0,k||(k=A,0)},stackAlloc:function(A){var e;return ur=(ur=(e=ur)+(A|=0)|0)+15&-16,0|e},stackRestore:function(A){ur=A|=0},stackSave:function(){return 0|ur}}}(d.asmGlobalArg,d.asmLibraryArg,Z),Zr=d.__GLOBAL__I_000101=yr.__GLOBAL__I_000101,Cr=d.__GLOBAL__sub_I_bind_cpp=yr.__GLOBAL__sub_I_bind_cpp,Wr=d.__GLOBAL__sub_I_box_cc=yr.__GLOBAL__sub_I_box_cc,Ir=d.__GLOBAL__sub_I_heif_cc=yr.__GLOBAL__sub_I_heif_cc,Br=d.__GLOBAL__sub_I_iostream_cpp=yr.__GLOBAL__sub_I_iostream_cpp,Er=(d.___cxa_can_catch=yr.___cxa_can_catch,d.___cxa_is_pointer_type=yr.___cxa_is_pointer_type,d.___errno_location=yr.___errno_location,d.___getTypeName=yr.___getTypeName),Gr=(d.___muldi3=yr.___muldi3,d.___udivdi3=yr.___udivdi3,d.___uremdi3=yr.___uremdi3,d._bitshift64Ashr=yr._bitshift64Ashr,d._bitshift64Lshr=yr._bitshift64Lshr,d._bitshift64Shl=yr._bitshift64Shl,d._emscripten_get_global_libc=yr._emscripten_get_global_libc,d._emscripten_replace_memory=yr._emscripten_replace_memory),Vr=d._free=yr._free,Xr=(d._i64Add=yr._i64Add,d._i64Subtract=yr._i64Subtract,d._llvm_bswap_i32=yr._llvm_bswap_i32,d._malloc=yr._malloc);d._memcpy=yr._memcpy,d._memmove=yr._memmove,d._memset=yr._memset,d._pthread_cond_broadcast=yr._pthread_cond_broadcast,d._pthread_mutex_lock=yr._pthread_mutex_lock,d._pthread_mutex_unlock=yr._pthread_mutex_unlock,d._sbrk=yr._sbrk,d.establishStackSpace=yr.establishStackSpace,d.getTempRet0=yr.getTempRet0,d.runPostSets=yr.runPostSets,d.setTempRet0=yr.setTempRet0,d.setThrew=yr.setThrew,d.stackAlloc=yr.stackAlloc,d.stackRestore=yr.stackRestore,d.stackSave=yr.stackSave,d.dynCall_i=yr.dynCall_i,d.dynCall_ii=yr.dynCall_ii,d.dynCall_iii=yr.dynCall_iii,d.dynCall_iiii=yr.dynCall_iiii,d.dynCall_iiiii=yr.dynCall_iiiii,d.dynCall_iiiiid=yr.dynCall_iiiiid,d.dynCall_iiiiii=yr.dynCall_iiiiii,d.dynCall_iiiiiid=yr.dynCall_iiiiiid,d.dynCall_iiiiiii=yr.dynCall_iiiiiii,d.dynCall_iiiiiiii=yr.dynCall_iiiiiiii,d.dynCall_iiiiiiiii=yr.dynCall_iiiiiiiii,d.dynCall_v=yr.dynCall_v,d.dynCall_vi=yr.dynCall_vi,d.dynCall_vii=yr.dynCall_vii,d.dynCall_viii=yr.dynCall_viii,d.dynCall_viiii=yr.dynCall_viiii,d.dynCall_viiiii=yr.dynCall_viiiii,d.dynCall_viiiiii=yr.dynCall_viiiiii,d.dynCall_viiiiiii=yr.dynCall_viiiiiii,d.dynCall_viiiiiiii=yr.dynCall_viiiiiiii,d.dynCall_viiiiiiiii=yr.dynCall_viiiiiiiii,d.dynCall_viiiiiiiiii=yr.dynCall_viiiiiiiiii,d.dynCall_viiiiiiiiiiii=yr.dynCall_viiiiiiiiiiii,d.dynCall_viiiiiiiiiiiii=yr.dynCall_viiiiiiiiiiiii;if(k.stackAlloc=d.stackAlloc,k.stackSave=d.stackSave,k.stackRestore=d.stackRestore,k.establishStackSpace=d.establishStackSpace,k.setTempRet0=d.setTempRet0,k.getTempRet0=d.getTempRet0,d.asm=yr,sA)if("function"==typeof d.locateFile?sA=d.locateFile(sA):d.memoryInitializerPrefixURL&&(sA=d.memoryInitializerPrefixURL+sA),o||r){var _r=d.readBinary(sA);W.set(_r,k.GLOBAL_BASE)}else{lA();var Fr=function(A){A.byteLength&&(A=new Uint8Array(A)),W.set(A,k.GLOBAL_BASE),d.memoryInitializerRequest&&delete d.memoryInitializerRequest.response,uA()};function Nr(){d.readAsync(sA,Fr,function(){throw"could not load memory initializer "+sA})}var Rr=mr(sA);if(Rr)Fr(Rr.buffer);else if(d.memoryInitializerRequest){function Yr(){var A=d.memoryInitializerRequest,e=A.response;if(200!==A.status&&0!==A.status){var r=mr(d.memoryInitializerRequestURL);if(!r)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+A.status+", retrying "+sA),void Nr();e=r.buffer}Fr(e)}d.memoryInitializerRequest.response?setTimeout(Yr,0):d.memoryInitializerRequest.addEventListener("load",Yr)}else Nr()}function Jr(A){this.name="ExitStatus",this.message="Program terminated with exit("+A+")",this.status=A}(Jr.prototype=new Error).constructor=Jr;var Dr=null;function Qr(A){function e(){d.calledRun||(d.calledRun=!0,n||(AA||(AA=!0,z(L)),z(K),d.onRuntimeInitialized&&d.onRuntimeInitialized(),function(){if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;)A=d.postRun.shift(),$.unshift(A);var A;z($)}()))}A=A||d.arguments,null===Dr&&(Dr=Date.now()),0<oA||(function(){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)A=d.preRun.shift(),P.unshift(A);var A;z(P)}(),0<oA||d.calledRun||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),e()},1)):e()))}cA=function A(){d.calledRun||Qr(),d.calledRun||(cA=A)},d.run=Qr,d.exit=function(A,e){e&&d.noExitRuntime&&0===A||(d.noExitRuntime||(n=!0,R=pr,z(q),d.onExit&&d.onExit(A)),o&&process.exit(A),d.quit(A,new Jr(A)))};var Tr=[];function Mr(e){d.onAbort&&d.onAbort(e),e=void 0!==e?(d.print(e),d.printErr(e),JSON.stringify(e)):"",n=!0,0;var r="abort("+e+") at "+y()+"\\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";throw Tr&&Tr.forEach(function(A){r=A(r,e)}),r}if(d.abort=Mr,d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();d.noExitRuntime=!0,Qr();function Sr(A){this.handle=A,this.img=null}Sr.prototype.free=function(){this.handle&&(xr.heif_image_handle_release(this.handle),this.handle=null)},Sr.prototype._ensureImage=function(){if(!this.img){var A=xr.heif_js_decode_image(this.handle,xr.heif_colorspace_YCbCr,xr.heif_chroma_420);if(!A||A.code)throw this.handle,A;this.data=new Uint8Array(function(A){for(var e=new ArrayBuffer(A.length),r=new Uint8Array(e),i=0,f=A.length;i<f;i++)r[i]=A.charCodeAt(i);return e}(A.data)),delete A.data,this.img=A}},Sr.prototype.get_width=function(){return this._ensureImage(),this.img.width},Sr.prototype.get_height=function(){return this._ensureImage(),this.img.height},Sr.prototype.is_primary=function(){return this._ensureImage(),!!this.img.is_primary},Sr.prototype.display=function(m,p){var y=this.get_width(),Z=this.get_height();setTimeout(function(){if(this._ensureImage(),this.img){for(var A,e,r,i,f,n=0,t=0,o=y>>1,a=o*Z,c=0,l=0,u=0,s=this.data,b=this.data.subarray(y*Z,y*Z+y*Z/4),d=this.data.subarray(y*Z+y*Z/4,y*Z+y*Z/2),k=y,h=y/2,w=y/2,v=m.data,g=0;g<a;g++)f=g<<1,A=1.164*(s[c+(i=n<<1)]-16),e=b[l+n]-128,r=d[u+n]-128,v[f<<2]=A+1.596*r,v[1+(f<<2)]=A-.813*r-.391*e,v[2+(f<<2)]=A+2.018*e,v[3+(f<<2)]=255,A=1.164*(s[c+i+1]-16),v[1+f<<2]=A+1.596*r,v[1+(1+f<<2)]=A-.813*r-.391*e,v[2+(1+f<<2)]=A+2.018*e,v[3+(1+f<<2)]=255,++n===o&&(n=0,c+=k,l=(++t>>1)*h,u=(t>>1)*w);p(m)}else p(null)}.bind(this),0)};function Ur(){this.decoder=null}Ur.prototype.decode=function(A){if(this.decoder&&xr.heif_context_free(this.decoder),this.decoder=xr.heif_context_alloc(),!this.decoder)return console.log("Could not create HEIF context"),[];var e=xr.heif_context_read_from_memory(this.decoder,A);if(e.code!==xr.heif_error_Ok)return console.log("Could not parse HEIF file",e),[];var r=xr.heif_context_get_number_of_top_level_images(this.decoder);if(!r)return console.log("No images found"),[];for(var i=[],f=0;f<r;f++){var n=xr.heif_js_context_get_image_handle(this.decoder,f);n&&!n.code?i.push(new Sr(n)):console.log("Could not get image data for id",f,n)}return i};var Or,Hr,xr={HeifDecoder:Ur,fourcc:function(A){return A.charCodeAt(0)<<24|A.charCodeAt(1)<<16|A.charCodeAt(2)<<8|A.charCodeAt(3)},BitstreamRange:d.BitstreamRange,Box:d.Box,Error:d.Error,HeifFile:d.HeifFile},jr={heif_error_code:!0,heif_suberror_code:!0,heif_compression_format:!0,heif_chroma:!0,heif_colorspace:!0,heif_channel:!0};for(Hr in jr)if(jr.hasOwnProperty(Hr))for(Or in d[Hr])d[Hr].hasOwnProperty(Or)&&"values"!==Or&&(xr[Or]=d[Hr][Or]);for(Or in d)jr.hasOwnProperty(Or)||0!==Or.indexOf("heif_")||(xr[Or]=d[Or]);function JA(A,e){return A=YA(A=A||"function_"+new Date),new Function("body","return function "+A+\'() {\\n    "use strict";    return body.apply(this, arguments);\\n};\\n\')(e)}delete this.Module;"undefined"!=typeof window?window.libheif=xr:"undefined"!=typeof global?global.libheif=xr:self.libheif=xr,"function"==typeof define&&define.amd&&define([],function(){return xr})}).call(this);\n;\nfunction processSingleImage(image) {\n    return new Promise((resolve, reject) => {\n        const w = image.get_width();\n        const h = image.get_height();\n        const whiteImage = new ImageData(w, h);\n        for (let i = 0; i < w * h; i++) {\n            whiteImage.data[i * 4 + 3] = 255;\n        }\n        image.display(whiteImage, (imageData) => {\n            if (!imageData) {\n                return reject("ERR_LIBHEIF Error while processing single image and generating image data, could not ensure image");\n            }\n            resolve(imageData);\n        });\n    });\n}\nonmessage = (message) => {\n    const id = message.data.id;\n    try {\n        const decoder = new libheif.HeifDecoder();\n        let imagesArr = decoder.decode(message.data.buffer);\n        if (!imagesArr || !imagesArr.length) {\n            throw "ERR_LIBHEIF format not supported";\n        }\n        imagesArr = imagesArr.filter((x) => {\n            let valid = true;\n            try {\n                /*\n                sometimes the heic container is valid\n                yet the images themselves are corrupt\n                */\n                x.get_height();\n            }\n            catch (e) {\n                valid = false;\n            }\n            return valid;\n        });\n        if (!imagesArr.length) {\n            throw "ERR_LIBHEIF Heic doesn\'t contain valid images";\n        }\n        Promise.all(imagesArr.map((image) => processSingleImage(image)))\n            .then((imageDataArr) => {\n            postMessage({ id, imageDataArr, error: "" });\n        })\n            .catch((e) => {\n            postMessage({\n                id,\n                imageDataArr: [],\n                error: e && e.toString ? e.toString() : e,\n            });\n        });\n    }\n    catch (e) {\n        postMessage({\n            id,\n            imageDataArr: [],\n            error: e && e.toString ? e.toString() : e,\n        });\n    }\n};\n\n'],{type:"application/javascript"});window.__heic2any__worker=new Worker(URL.createObjectURL(e));var t=["image/png","image/jpeg","image/gif"],i=function(e){var i=e.imageData,a=e.toType;void 0===a&&(a="image/png");var r=e.quality;return void 0===r&&(r=.92),(1<r||r<0)&&(r=.92),-1===t.indexOf(a)&&(a="image/png"),new Promise(function(e,t){var o=null;try{o=document.createElement("canvas")}catch(o){}if(!o)return t("ERR_CANVAS Error on converting imagedata to blob: Could not create canvas element");o.width=i.width,o.height=i.height;var n=o.getContext("2d");if(!n)return t("ERR_CANVAS Error on converting imagedata to blob: Could not get canvas context");n.putImageData(i,0,0),o.toBlob(function(i){return i?e(i):t("ERR_CANVAS Error on converting imagedata to blob: Could not get blob from canvas")},a,r)})},a=function(e){var t=0;e?"string"!=typeof e&&(e=e.toString?e.toString():JSON.stringify(e)):e="ERR_UNKNOWN";for(var i=["ERR_USER","ERR_LIBHEIF","ERR_GIF","ERR_DOM","ERR_CANVAS"],a=0;a<i.length;a++){var r=i[a];0===e.indexOf(r)&&(t=a+1)}return{code:t,message:e}};return function(e){var t=e.blob,r=e.toType;void 0===r&&(r="image/png");var o=e.quality;void 0===o&&(o=.92);var n=e.gifInterval;void 0===n&&(n=.4);var s=e.multiple;return void 0===s&&(s=void 0),new Promise(function(e,l){t instanceof Blob||a("ERR_USER library only accepts BLOBs as input"),"boolean"!=typeof s&&a('ERR_USER "multiple" parameter should be of type "boolean"'),"number"!=typeof o&&a('ERR_USER "quality" parameter should be of type "number"'),"number"!=typeof n&&a('ERR_USER "gifInterval" parameter should be of type "number"');var d=new FileReader;d.onload=function(t){var d,c=0,u=0,p=t.target.result,h=function(e){for(var t=new Uint8Array(e).subarray(0,4),i="",a=0;a<t.length;a++)i+=t[a].toString(16);switch(i){case"89504e47":return"image/png";case"47494638":return"image/gif";case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":return"image/jpeg";default:return!1}}(p);if(h)return l(a("ERR_USER Image is already browser readable: "+h));d=p,new Promise(function(e,t){var i=(Math.random()*(new Date).getTime()).toString(),a={id:i,buffer:d};window.__heic2any__worker.postMessage(a),window.__heic2any__worker.addEventListener("message",function(a){if(a.data.id===i)return a.data.error?t(a.data.error):e(a.data.imageDataArr)})}).then(function(e){return c=e[0].width,u=e[0].height,Promise.all(e.map(function(e){return i({imageData:e,toType:r,quality:o})}))}).then(function(t){return"image/gif"===r?Promise.all(t.map(function(e){return function(e){return new Promise(function(t,i){var a=new FileReader;a.onerror=function(){i("ERR_DOM Error on converting blob to data URL")},a.onload=function(e){t(a.result)},a.readAsDataURL(e)})}(e)})):(e(s?t:t[0]),[""])}).then(function(e){return"image/gif"===r&&e?function(e){var t=e.images,i=e.interval,a=e.gifHeight,r=e.gifWidth;return new Promise(function(e,o){gifshot.createGIF({images:t,interval:i,gifHeight:a,gifWidth:r},function(t){return t.error&&o("ERR_GIF "+t.errorCode+" "+t.errorMessage),e(t.image)})})}({images:e,interval:n,gifWidth:c,gifHeight:u}):""}).then(function(t){if("image/gif"===r&&t){var i=function(e){try{for(var t=atob(e.split(",")[1]),i=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(t.length),r=new Uint8Array(a),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return new Blob([a],{type:i})}catch(e){return e.toString?e.toString():e}}(t);"string"==typeof i?l(a(i)):e(i)}}).catch(function(e){l(a(e))})},d.readAsArrayBuffer(t)})}}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ImageCompressor=t()}(this,function(){"use strict";var e,t=(function(e){var t,i,a,r,o,n,s;t=window,i=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,a=t.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),r=a&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),o=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,n=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,s=(a||o)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(e){var t,i,s,l,d,c,u,p,h;if(!(t=e.match(n)))throw new Error("invalid data URI");for(i=t[2]?t[1]:"text/plain"+(t[3]||";charset=US-ASCII"),s=!!t[4],l=e.slice(t[0].length),d=s?atob(l):decodeURIComponent(l),c=new ArrayBuffer(d.length),u=new Uint8Array(c),p=0;p<d.length;p+=1)u[p]=d.charCodeAt(p);return a?new Blob([r?u:c],{type:i}):((h=new o).append(c),h.getBlob(i))},t.HTMLCanvasElement&&!i.toBlob&&(i.mozGetAsFile?i.toBlob=function(e,t,a){var r=this;setTimeout(function(){a&&i.toDataURL&&s?e(s(r.toDataURL(t,a))):e(r.mozGetAsFile("blob",t))})}:i.toDataURL&&s&&(i.toBlob=function(e,t,i){var a=this;setTimeout(function(){e(s(a.toDataURL(t,i)))})})),e.exports?e.exports=s:t.dataURLtoBlob=s}(e={exports:{}}),e.exports),i=Object.prototype.toString,a={checkOrientation:!0,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,quality:.8,mimeType:"auto",convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},r=/^image\/.+$/;function o(e){return r.test(e)}var n=String.fromCharCode,s=window.btoa;var l=/\.\d*(?:0|9){12}\d*$/i;function d(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e11;return l.test(e)?Math.round(e*t)/t:e}var c=function(){function e(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,i,a){return i&&e(t.prototype,i),a&&e(t,a),t}}(),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},p=window,h=p.ArrayBuffer,m=p.FileReader,f=window.URL||window.webkitURL,g=/\.\w+$/;return function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.result=null,t&&this.compress(t,i)}return c(e,[{key:"compress",value:function(e,r){var l=this,c=new Image;return r=u({},a,r),h||(r.checkOrientation=!1),new Promise(function(t,a){if((l=e)instanceof Blob||"[object Blob]"===i.call(l)){var l,d=e.type;if(o(d))if(f||m){if(f&&!r.checkOrientation)t({url:f.createObjectURL(e)});else if(m){var c=new m,p=r.checkOrientation&&"image/jpeg"===d;c.onload=function(e){var i=e.target.result;t(p?u({url:function(e,t){var i=new Uint8Array(e),a="";if("function"==typeof i.forEach)i.forEach(function(e){a+=n(e)});else for(var r=i.length,o=0;o<r;o+=1)a+=n(i[o]);return"data:"+t+";base64,"+s(a)}(i,d)},function(e){var t=0,i=1,a=1;switch(e){case 2:i=-1;break;case 3:t=-180;break;case 4:a=-1;break;case 5:t=90,a=-1;break;case 6:t=90;break;case 7:t=90,i=-1;break;case 8:t=-90}return{rotate:t,scaleX:i,scaleY:a}}(function(e){var t=new DataView(e),i=void 0,a=void 0,r=void 0,o=void 0;if(255===t.getUint8(0)&&216===t.getUint8(1))for(var s=t.byteLength,l=2;l<s;){if(255===t.getUint8(l)&&225===t.getUint8(l+1)){r=l;break}l+=1}if(r){var d=r+10;if("Exif"===function(e,t,i){var a="",r=void 0;for(i+=t,r=t;r<i;r+=1)a+=n(e.getUint8(r));return a}(t,r+4,4)){var c=t.getUint16(d);if(((a=18761===c)||19789===c)&&42===t.getUint16(d+2,a)){var u=t.getUint32(d+4,a);8<=u&&(o=d+u)}}}if(o){var p=t.getUint16(o,a),h=void 0,m=void 0;for(m=0;m<p;m+=1)if(h=o+12*m+2,274===t.getUint16(h,a)){h+=8,i=t.getUint16(h,a),t.setUint16(h,1,a);break}}return i}(i))):{url:i})},c.onabort=function(){a(new Error("Aborted to load the image with FileReader."))},c.onerror=function(){a(new Error("Failed to load the image with FileReader."))},p?c.readAsArrayBuffer(e):c.readAsDataURL(e)}}else a(new Error("The current browser does not support image compression."));else a(new Error("The first argument must be an image File or Blob object."))}else a(new Error("The first argument must be a File or Blob object."))}).then(function(t){return new Promise(function(i,a){c.onload=function(){return i(u({},t,{naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight}))},c.onabort=function(){a(new Error("Aborted to load the image."))},c.onerror=function(){a(new Error("Failed to load the image."))},c.alt=e.name,c.src=t.url})}).then(function(i){var a=i.naturalWidth,n=i.naturalHeight,s=i.rotate,u=void 0===s?0:s,p=i.scaleX,h=void 0===p?1:p,m=i.scaleY,f=void 0===m?1:m;return new Promise(function(i){var s=document.createElement("canvas"),p=s.getContext("2d"),m=a/n,g=Math.max(r.maxWidth,0)||1/0,v=Math.max(r.maxHeight,0)||1/0,A=Math.max(r.minWidth,0)||0,C=Math.max(r.minHeight,0)||0,y=a,b=n;g<1/0&&v<1/0?g<v*m?v=g/m:g=v*m:g<1/0?v=g/m:v<1/0&&(g=v*m),0<A&&0<C?A<C*m?C=A/m:A=C*m:0<A?C=A/m:0<C&&(A=C*m),0<r.width?b=(y=r.width)/m:0<r.height&&(y=(b=r.height)*m);var S=-(y=Math.min(Math.max(y,A),g))/2,k=-(b=Math.min(Math.max(b,C),v))/2,D=y,_=b;if(Math.abs(u)%180==90){var I={width:b,height:y};y=I.width,b=I.height}s.width=d(y),s.height=d(b),o(r.mimeType)||(r.mimeType=e.type);var w="transparent";e.size>r.convertSize&&"image/png"===r.mimeType&&(w="#fff",r.mimeType="image/jpeg"),p.fillStyle=w,p.fillRect(0,0,y,b),p.save(),p.translate(y/2,b/2),p.rotate(u*Math.PI/180),p.scale(h,f),r.beforeDraw&&r.beforeDraw.call(l,p,s),p.drawImage(c,Math.floor(d(S)),Math.floor(d(k)),Math.floor(d(D)),Math.floor(d(_))),r.drew&&r.drew.call(l,p,s),p.restore();var P=function(e){i({naturalWidth:a,naturalHeight:n,result:e})};s.toBlob?s.toBlob(P,r.mimeType,r.quality):P(t(s.toDataURL(r.mimeType,r.quality)))})}).then(function(t){var i=t.naturalWidth,a=t.naturalHeight,n=t.result;if(f&&!r.checkOrientation&&f.revokeObjectURL(c.src),n)if(n.size>e.size&&r.mimeType===e.type&&!(r.width>i||r.height>a||r.minWidth>i||r.minHeight>a))n=e;else{var s=new Date;n.lastModified=s.getTime(),n.lastModifiedDate=s,n.name=e.name,n.name&&n.type!==e.type&&(n.name=n.name.replace(g,function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=o(e)?e.substr(6):"";return"jpeg"===i&&(i="jpg"),i&&t&&(i="."+i),i}(n.type)))}else n=e;return l.result=n,r.success&&r.success.call(l,n),Promise.resolve(n)}).catch(function(e){if(!r.error)throw e;r.error.call(l,e)})}}]),e}()}),function(e){Array.prototype.map||(Array.prototype.map=function(e,t){var i,a,r;if(null==this)throw new TypeError(" this is null or not defined");var o=Object(this),n=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(t&&(i=t),a=Array(n),r=0;n>r;){var s,l;r in o&&(s=o[r],l=e.call(i,s,r,o),a[r]=l),r++}return a});var t=e.detect=function(){var e=function(){};e.parsers=["device_parsers","browser_parsers","os_parsers","mobile_os_families","mobile_browser_families"],e.types=["browser","os","device"],e.regexes={browser_parsers:[{regex:"^(Opera)/(\\d+)\\.(\\d+) \\(Nintendo Wii",family_replacement:"Wii",manufacturer:"Nintendo"},{regex:"(SeaMonkey|Camino)/(\\d+)\\.(\\d+)\\.?([ab]?\\d+[a-z]*)",family_replacement:"Camino",other:!0},{regex:"(Pale[Mm]oon)/(\\d+)\\.(\\d+)\\.?(\\d+)?",family_replacement:"Pale Moon (Firefox Variant)",other:!0},{regex:"(Fennec)/(\\d+)\\.(\\d+)\\.?([ab]?\\d+[a-z]*)",family_replacement:"Firefox Mobile"},{regex:"(Fennec)/(\\d+)\\.(\\d+)(pre)",family_replacment:"Firefox Mobile"},{regex:"(Fennec)/(\\d+)\\.(\\d+)",family_replacement:"Firefox Mobile"},{regex:"Mobile.*(Firefox)/(\\d+)\\.(\\d+)",family_replacement:"Firefox Mobile"},{regex:"(Namoroka|Shiretoko|Minefield)/(\\d+)\\.(\\d+)\\.(\\d+(?:pre)?)",family_replacement:"Firefox ($1)"},{regex:"(Firefox)/(\\d+)\\.(\\d+)(a\\d+[a-z]*)",family_replacement:"Firefox Alpha"},{regex:"(Firefox)/(\\d+)\\.(\\d+)(b\\d+[a-z]*)",family_replacement:"Firefox Beta"},{regex:"(Firefox)-(?:\\d+\\.\\d+)?/(\\d+)\\.(\\d+)(a\\d+[a-z]*)",family_replacement:"Firefox Alpha"},{regex:"(Firefox)-(?:\\d+\\.\\d+)?/(\\d+)\\.(\\d+)(b\\d+[a-z]*)",family_replacement:"Firefox Beta"},{regex:"(Namoroka|Shiretoko|Minefield)/(\\d+)\\.(\\d+)([ab]\\d+[a-z]*)?",family_replacement:"Firefox ($1)"},{regex:"(Firefox).*Tablet browser (\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"MicroB",tablet:!0},{regex:"(MozillaDeveloperPreview)/(\\d+)\\.(\\d+)([ab]\\d+[a-z]*)?"},{regex:"(Flock)/(\\d+)\\.(\\d+)(b\\d+?)",family_replacement:"Flock",other:!0},{regex:"(RockMelt)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Rockmelt",other:!0},{regex:"(Navigator)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Netscape"},{regex:"(Navigator)/(\\d+)\\.(\\d+)([ab]\\d+)",family_replacement:"Netscape"},{regex:"(Netscape6)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Netscape"},{regex:"(MyIBrow)/(\\d+)\\.(\\d+)",family_replacement:"My Internet Browser",other:!0},{regex:"(Opera Tablet).*Version/(\\d+)\\.(\\d+)(?:\\.(\\d+))?",family_replacement:"Opera Tablet",tablet:!0},{regex:"(Opera)/.+Opera Mobi.+Version/(\\d+)\\.(\\d+)",family_replacement:"Opera Mobile"},{regex:"Opera Mobi",family_replacement:"Opera Mobile"},{regex:"(Opera Mini)/(\\d+)\\.(\\d+)",family_replacement:"Opera Mini"},{regex:"(Opera Mini)/att/(\\d+)\\.(\\d+)",family_replacement:"Opera Mini"},{regex:"(Opera)/9.80.*Version/(\\d+)\\.(\\d+)(?:\\.(\\d+))?",family_replacement:"Opera"},{regex:"(webOSBrowser)/(\\d+)\\.(\\d+)",family_replacement:"webOS"},{regex:"(webOS)/(\\d+)\\.(\\d+)",family_replacement:"webOS"},{regex:"(wOSBrowser).+TouchPad/(\\d+)\\.(\\d+)",family_replacement:"webOS TouchPad"},{regex:"(luakit)",family_replacement:"LuaKit",other:!0},{regex:"(Lightning)/(\\d+)\\.(\\d+)([ab]?\\d+[a-z]*)",family_replacement:"Lightning",other:!0},{regex:"(Firefox)/(\\d+)\\.(\\d+)\\.(\\d+(?:pre)?) \\(Swiftfox\\)",family_replacement:"Swiftfox",other:!0},{regex:"(Firefox)/(\\d+)\\.(\\d+)([ab]\\d+[a-z]*)? \\(Swiftfox\\)",family_replacement:"Swiftfox",other:!0},{regex:"rekonq",family_replacement:"Rekonq",other:!0},{regex:"(conkeror|Conkeror)/(\\d+)\\.(\\d+)\\.?(\\d+)?",family_replacement:"Conkeror",other:!0},{regex:"(konqueror)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Konqueror",other:!0},{regex:"(WeTab)-Browser",family_replacement:"WeTab",other:!0},{regex:"(Comodo_Dragon)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Comodo Dragon",other:!0},{regex:"(YottaaMonitor)",family_replacement:"Yottaa Monitor",other:!0},{regex:"(Kindle)/(\\d+)\\.(\\d+)",family_replacement:"Kindle"},{regex:"(Symphony) (\\d+).(\\d+)",family_replacement:"Symphony",other:!0},{regex:"Minimo",family_replacement:"Minimo",other:!0},{regex:"(CrMo)/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Chrome Mobile"},{regex:"(CriOS)/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Chrome Mobile iOS"},{regex:"(Chrome)/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+) Mobile",family_replacement:"Chrome Mobile"},{regex:"(chromeframe)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Chrome Frame"},{regex:"(UC Browser)(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"UC Browser",other:!0},{regex:"(SLP Browser)/(\\d+)\\.(\\d+)",family_replacement:"Tizen Browser",other:!0},{regex:"(Epiphany)/(\\d+)\\.(\\d+).(\\d+)",family_replacement:"Epiphany",other:!0},{regex:"(SE 2\\.X) MetaSr (\\d+)\\.(\\d+)",family_replacement:"Sogou Explorer",other:!0},{regex:"(Pingdom.com_bot_version_)(\\d+)\\.(\\d+)",family_replacement:"PingdomBot",other:!0},{regex:"(facebookexternalhit)/(\\d+)\\.(\\d+)",family_replacement:"FacebookBot"},{regex:"(Twitterbot)/(\\d+)\\.(\\d+)",family_replacement:"TwitterBot"},{regex:"(AdobeAIR|Chromium|FireWeb|Jasmine|ANTGalio|Midori|Fresco|Lobo|PaleMoon|Maxthon|Lynx|OmniWeb|Dillo|Camino|Demeter|Fluid|Fennec|Shiira|Sunrise|Chrome|Flock|Netscape|Lunascape|WebPilot|NetFront|Netfront|Konqueror|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|Opera Mini|iCab|NetNewsWire|ThunderBrowse|Iron|Iris|UP\\.Browser|Bunjaloo|Google Earth|Raven for Mac)/(\\d+)\\.(\\d+)\\.(\\d+)"},{regex:"(Bolt|Jasmine|IceCat|Skyfire|Midori|Maxthon|Lynx|Arora|IBrowse|Dillo|Camino|Shiira|Fennec|Phoenix|Chrome|Flock|Netscape|Lunascape|Epiphany|WebPilot|Opera Mini|Opera|NetFront|Netfront|Konqueror|Googlebot|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|iCab|NetNewsWire|Iron|Space Bison|Stainless|Orca|Dolfin|BOLT|Minimo|Tizen Browser|Polaris)/(\\d+)\\.(\\d+)"},{regex:"(iRider|Crazy Browser|SkipStone|iCab|Lunascape|Sleipnir|Maemo Browser) (\\d+)\\.(\\d+)\\.(\\d+)"},{regex:"(iCab|Lunascape|Opera|Android|Jasmine|Polaris|BREW) (\\d+)\\.(\\d+)\\.?(\\d+)?"},{regex:"(Android) Donut",v2_replacement:"2",v1_replacement:"1"},{regex:"(Android) Eclair",v2_replacement:"1",v1_replacement:"2"},{regex:"(Android) Froyo",v2_replacement:"2",v1_replacement:"2"},{regex:"(Android) Gingerbread",v2_replacement:"3",v1_replacement:"2"},{regex:"(Android) Honeycomb",v1_replacement:"3"},{regex:"(IEMobile)[ /](\\d+)\\.(\\d+)",family_replacement:"IE Mobile"},{regex:"(MSIE) (\\d+)\\.(\\d+).*XBLWP7",family_replacement:"IE Large Screen"},{regex:"(Firefox)/(\\d+)\\.(\\d+)\\.(\\d+)"},{regex:"(Firefox)/(\\d+)\\.(\\d+)(pre|[ab]\\d+[a-z]*)?"},{regex:"(Obigo)InternetBrowser",other:!0},{regex:"(Obigo)\\-Browser",other:!0},{regex:"(Obigo|OBIGO)[^\\d]*(\\d+)(?:.(\\d+))?",other:!0},{regex:"(MAXTHON|Maxthon) (\\d+)\\.(\\d+)",family_replacement:"Maxthon",other:!0},{regex:"(Maxthon|MyIE2|Uzbl|Shiira)",v1_replacement:"0",other:!0},{regex:"(PLAYSTATION) (\\d+)",family_replacement:"PlayStation",manufacturer:"Sony"},{regex:"(PlayStation Portable)[^\\d]+(\\d+).(\\d+)",manufacturer:"Sony"},{regex:"(BrowseX) \\((\\d+)\\.(\\d+)\\.(\\d+)",other:!0},{regex:"(POLARIS)/(\\d+)\\.(\\d+)",family_replacement:"Polaris",other:!0},{regex:"(Embider)/(\\d+)\\.(\\d+)",family_replacement:"Polaris",other:!0},{regex:"(BonEcho)/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Bon Echo",other:!0},{regex:"(iPod).+Version/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Mobile Safari",manufacturer:"Apple"},{regex:"(iPod).*Version/(\\d+)\\.(\\d+)",family_replacement:"Mobile Safari",manufacturer:"Apple"},{regex:"(iPod)",family_replacement:"Mobile Safari",manufacturer:"Apple"},{regex:"(iPhone).*Version/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Mobile Safari",manufacturer:"Apple"},{regex:"(iPhone).*Version/(\\d+)\\.(\\d+)",family_replacement:"Mobile Safari",manufacturer:"Apple"},{regex:"(iPhone)",family_replacement:"Mobile Safari",manufacturer:"Apple"},{regex:"(iPad).*Version/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Mobile Safari",tablet:!0,manufacturer:"Apple"},{regex:"(iPad).*Version/(\\d+)\\.(\\d+)",family_replacement:"Mobile Safari",tablet:!0,manufacturer:"Apple"},{regex:"(iPad)",family_replacement:"Mobile Safari",tablet:!0,manufacturer:"Apple"},{regex:"(AvantGo) (\\d+).(\\d+)",other:!0},{regex:"(Avant)",v1_replacement:"1",other:!0},{regex:"^(Nokia)",family_replacement:"Nokia Services (WAP) Browser",manufacturer:"Nokia"},{regex:"(NokiaBrowser)/(\\d+)\\.(\\d+).(\\d+)\\.(\\d+)",manufacturer:"Nokia"},{regex:"(NokiaBrowser)/(\\d+)\\.(\\d+).(\\d+)",manufacturer:"Nokia"},{regex:"(NokiaBrowser)/(\\d+)\\.(\\d+)",manufacturer:"Nokia"},{regex:"(BrowserNG)/(\\d+)\\.(\\d+).(\\d+)",family_replacement:"NokiaBrowser",manufacturer:"Nokia"},{regex:"(Series60)/5\\.0",v2_replacement:"0",v1_replacement:"7",family_replacement:"NokiaBrowser",manufacturer:"Nokia"},{regex:"(Series60)/(\\d+)\\.(\\d+)",family_replacement:"Nokia OSS Browser",manufacturer:"Nokia"},{regex:"(S40OviBrowser)/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Nokia Series 40 Ovi Browser",manufacturer:"Nokia"},{regex:"(Nokia)[EN]?(\\d+)",manufacturer:"Nokia"},{regex:"(PlayBook).+RIM Tablet OS (\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Blackberry WebKit",tablet:!0,manufacturer:"Nokia"},{regex:"(Black[bB]erry).+Version/(\\d+)\\.(\\d+)\\.(\\d+)",family_replacement:"Blackberry WebKit",manufacturer:"RIM"},{regex:"(Black[bB]erry)\\s?(\\d+)",family_replacement:"Blackberry",manufacturer:"RIM"},{regex:"(OmniWeb)/v(\\d+)\\.(\\d+)",other:!0},{regex:"(Blazer)/(\\d+)\\.(\\d+)",family_replacement:"Palm Blazer",manufacturer:"Palm"},{regex:"(Pre)/(\\d+)\\.(\\d+)",family_replacement:"Palm Pre",manufacturer:"Palm"},{regex:"(Links) \\((\\d+)\\.(\\d+)",other:!0},{regex:"(QtWeb) Internet Browser/(\\d+)\\.(\\d+)",other:!0},{regex:"(Silk)/(\\d+)\\.(\\d+)(?:\\.([0-9\\-]+))?",other:!0,tablet:!0},{regex:"(AppleWebKit)/(\\d+)\\.?(\\d+)?\\+ .* Version/\\d+\\.\\d+.\\d+ Safari/",family_replacement:"WebKit Nightly"},{regex:"(Version)/(\\d+)\\.(\\d+)(?:\\.(\\d+))?.*Safari/",family_replacement:"Safari"},{regex:"(Safari)/\\d+"},{regex:"(OLPC)/Update(\\d+)\\.(\\d+)",other:!0},{regex:"(OLPC)/Update()\\.(\\d+)",v1_replacement:"0",other:!0},{regex:"(SEMC\\-Browser)/(\\d+)\\.(\\d+)",other:!0},{regex:"(Teleca)",family_replacement:"Teleca Browser",other:!0},{regex:"Trident(.*)rv.(\\d+)\\.(\\d+)",family_replacement:"IE"},{regex:"(MSIE) (\\d+)\\.(\\d+)",family_replacement:"IE"}],os_parsers:[{regex:"(Android) (\\d+)\\.(\\d+)(?:[.\\-]([a-z0-9]+))?"},{regex:"(Android)\\-(\\d+)\\.(\\d+)(?:[.\\-]([a-z0-9]+))?"},{regex:"(Android) Donut",os_v2_replacement:"2",os_v1_replacement:"1"},{regex:"(Android) Eclair",os_v2_replacement:"1",os_v1_replacement:"2"},{regex:"(Android) Froyo",os_v2_replacement:"2",os_v1_replacement:"2"},{regex:"(Android) Gingerbread",os_v2_replacement:"3",os_v1_replacement:"2"},{regex:"(Android) Honeycomb",os_v1_replacement:"3"},{regex:"(Silk-Accelerated=[a-z]{4,5})",os_replacement:"Android"},{regex:"(Windows Phone 6\\.5)"},{regex:"(Windows (?:NT 5\\.2|NT 5\\.1))",os_replacement:"Windows XP"},{regex:"(XBLWP7)",os_replacement:"Windows Phone OS"},{regex:"(Windows NT 6\\.1)",os_replacement:"Windows 7"},{regex:"(Windows NT 6\\.0)",os_replacement:"Windows Vista"},{regex:"(Windows 98|Windows XP|Windows ME|Windows 95|Windows CE|Windows 7|Windows NT 4\\.0|Windows Vista|Windows 2000)"},{regex:"(Windows NT 6\\.2)",os_replacement:"Windows 8"},{regex:"(Windows Phone 8)",os_replacement:"Windows Phone 8"},{regex:"(Windows NT 5\\.0)",os_replacement:"Windows 2000"},{regex:"(Windows Phone OS) (\\d+)\\.(\\d+)"},{regex:"(Windows ?Mobile)",os_replacement:"Windows Mobile"},{regex:"(WinNT4.0)",os_replacement:"Windows NT 4.0"},{regex:"(Win98)",os_replacement:"Windows 98"},{regex:"(Tizen)/(\\d+)\\.(\\d+)",other:!0},{regex:"(Mac OS X) (\\d+)[_.](\\d+)(?:[_.](\\d+))?",manufacturer:"Apple"},{regex:"(?:PPC|Intel) (Mac OS X)",manufacturer:"Apple"},{regex:"(CPU OS|iPhone OS) (\\d+)_(\\d+)(?:_(\\d+))?",os_replacement:"iOS",manufacturer:"Apple"},{regex:"(iPhone|iPad|iPod); Opera",os_replacement:"iOS",manufacturer:"Apple"},{regex:"(iPad); Opera",tablet:!0,manufacturer:"Apple"},{regex:"(iPhone|iPad|iPod).*Mac OS X.*Version/(\\d+)\\.(\\d+)",os_replacement:"iOS",manufacturer:"Apple"},{regex:"(CrOS) [a-z0-9_]+ (\\d+)\\.(\\d+)(?:\\.(\\d+))?",os_replacement:"Chrome OS"},{regex:"(Debian)-(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?",other:!0},{regex:"(Linux Mint)(?:/(\\d+))?",other:!0},{regex:"(Mandriva)(?: Linux)?/(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?",other:!0},{regex:"(Symbian[Oo][Ss])/(\\d+)\\.(\\d+)",os_replacement:"Symbian OS"},{regex:"(Symbian/3).+NokiaBrowser/7\\.3",os_replacement:"Symbian^3 Anna"},{regex:"(Symbian/3).+NokiaBrowser/7\\.4",os_replacement:"Symbian^3 Belle"},{regex:"(Symbian/3)",os_replacement:"Symbian^3"},{regex:"(Series 60|SymbOS|S60)",os_replacement:"Symbian OS"},{regex:"(MeeGo)",other:!0},{regex:"Symbian [Oo][Ss]",os_replacement:"Symbian OS"},{regex:"(Black[Bb]erry)[0-9a-z]+/(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?",os_replacement:"BlackBerry OS",manufacturer:"RIM"},{regex:"(Black[Bb]erry).+Version/(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?",os_replacement:"BlackBerry OS",manufacturer:"RIM"},{regex:"(RIM Tablet OS) (\\d+)\\.(\\d+)\\.(\\d+)",os_replacement:"BlackBerry Tablet OS",tablet:!0,manufacturer:"RIM"},{regex:"(Play[Bb]ook)",os_replacement:"BlackBerry Tablet OS",tablet:!0,manufacturer:"RIM"},{regex:"(Black[Bb]erry)",os_replacement:"Blackberry OS",manufacturer:"RIM"},{regex:"(webOS|hpwOS)/(\\d+)\\.(\\d+)(?:\\.(\\d+))?",os_replacement:"webOS"},{regex:"(SUSE|Fedora|Red Hat|PCLinuxOS)/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)",other:!0},{regex:"(SUSE|Fedora|Red Hat|Puppy|PCLinuxOS|CentOS)/(\\d+)\\.(\\d+)\\.(\\d+)",other:!0},{regex:"(Ubuntu|Kindle|Bada|Lubuntu|BackTrack|Red Hat|Slackware)/(\\d+)\\.(\\d+)"},{regex:"(Windows|OpenBSD|FreeBSD|NetBSD|Ubuntu|Kubuntu|Android|Arch Linux|CentOS|WeTab|Slackware)"},{regex:"(Linux|BSD)",other:!0}],mobile_os_families:["Windows Phone 6.5","Windows CE","Symbian OS"],device_parsers:[{regex:"HTC ([A-Z][a-z0-9]+) Build",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"HTC ([A-Z][a-z0-9 ]+) \\d+\\.\\d+\\.\\d+\\.\\d+",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"HTC_Touch_([A-Za-z0-9]+)",device_replacement:"HTC Touch ($1)",manufacturer:"HTC"},{regex:"USCCHTC(\\d+)",device_replacement:"HTC $1 (US Cellular)",manufacturer:"HTC"},{regex:"Sprint APA(9292)",device_replacement:"HTC $1 (Sprint)",manufacturer:"HTC"},{regex:"HTC ([A-Za-z0-9]+ [A-Z])",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"HTC-([A-Za-z0-9]+)",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"HTC_([A-Za-z0-9]+)",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"HTC ([A-Za-z0-9]+)",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"(ADR[A-Za-z0-9]+)",device_replacement:"HTC $1",manufacturer:"HTC"},{regex:"(HTC)",manufacturer:"HTC"},{regex:"SonyEricsson([A-Za-z0-9]+)/",device_replacement:"Ericsson $1",other:!0,manufacturer:"Sony"},{regex:"Android[\\- ][\\d]+\\.[\\d]+\\; [A-Za-z]{2}\\-[A-Za-z]{2}\\; WOWMobile (.+) Build"},{regex:"Android[\\- ][\\d]+\\.[\\d]+\\.[\\d]+; [A-Za-z]{2}\\-[A-Za-z]{2}\\; (.+) Build"},{regex:"Android[\\- ][\\d]+\\.[\\d]+\\-update1\\; [A-Za-z]{2}\\-[A-Za-z]{2}\\; (.+) Build"},{regex:"Android[\\- ][\\d]+\\.[\\d]+\\; [A-Za-z]{2}\\-[A-Za-z]{2}\\; (.+) Build"},{regex:"Android[\\- ][\\d]+\\.[\\d]+\\.[\\d]+; (.+) Build"},{regex:"NokiaN([0-9]+)",device_replacement:"Nokia N$1",manufacturer:"Nokia"},{regex:"Nokia([A-Za-z0-9\\v-]+)",device_replacement:"Nokia $1",manufacturer:"Nokia"},{regex:"NOKIA ([A-Za-z0-9\\-]+)",device_replacement:"Nokia $1",manufacturer:"Nokia"},{regex:"Nokia ([A-Za-z0-9\\-]+)",device_replacement:"Nokia $1",manufacturer:"Nokia"},{regex:"Lumia ([A-Za-z0-9\\-]+)",device_replacement:"Lumia $1",manufacturer:"Nokia"},{regex:"Symbian",device_replacement:"Nokia",manufacturer:"Nokia"},{regex:"(PlayBook).+RIM Tablet OS",device_replacement:"Blackberry Playbook",tablet:!0,manufacturer:"RIM"},{regex:"(Black[Bb]erry [0-9]+);",manufacturer:"RIM"},{regex:"Black[Bb]erry([0-9]+)",device_replacement:"BlackBerry $1",manufacturer:"RIM"},{regex:"(Pre)/(\\d+)\\.(\\d+)",device_replacement:"Palm Pre",manufacturer:"Palm"},{regex:"(Pixi)/(\\d+)\\.(\\d+)",device_replacement:"Palm Pixi",manufacturer:"Palm"},{regex:"(Touchpad)/(\\d+)\\.(\\d+)",device_replacement:"HP Touchpad",manufacturer:"HP"},{regex:"HPiPAQ([A-Za-z0-9]+)/(\\d+).(\\d+)",device_replacement:"HP iPAQ $1",manufacturer:"HP"},{regex:"Palm([A-Za-z0-9]+)",device_replacement:"Palm $1",manufacturer:"Palm"},{regex:"Treo([A-Za-z0-9]+)",device_replacement:"Palm Treo $1",manufacturer:"Palm"},{regex:"webOS.*(P160UNA)/(\\d+).(\\d+)",device_replacement:"HP Veer",manufacturer:"HP"},{regex:"(Kindle Fire)",manufacturer:"Amazon"},{regex:"(Kindle)",manufacturer:"Amazon"},{regex:"(Silk)/(\\d+)\\.(\\d+)(?:\\.([0-9\\-]+))?",device_replacement:"Kindle Fire",tablet:!0,manufacturer:"Amazon"},{regex:"(iPad) Simulator;",manufacturer:"Apple"},{regex:"(iPad);",manufacturer:"Apple"},{regex:"(iPod);",manufacturer:"Apple"},{regex:"(iPhone) Simulator;",manufacturer:"Apple"},{regex:"(iPhone);",manufacturer:"Apple"},{regex:"Nexus\\ ([A-Za-z0-9\\-]+)",device_replacement:"Nexus $1"},{regex:"acer_([A-Za-z0-9]+)_",device_replacement:"Acer $1",manufacturer:"Acer"},{regex:"acer_([A-Za-z0-9]+)_",device_replacement:"Acer $1",manufacturer:"Acer"},{regex:"Amoi\\-([A-Za-z0-9]+)",device_replacement:"Amoi $1",other:!0,manufacturer:"Amoi"},{regex:"AMOI\\-([A-Za-z0-9]+)",device_replacement:"Amoi $1",other:!0,manufacturer:"Amoi"},{regex:"Asus\\-([A-Za-z0-9]+)",device_replacement:"Asus $1",manufacturer:"Asus"},{regex:"ASUS\\-([A-Za-z0-9]+)",device_replacement:"Asus $1",manufacturer:"Asus"},{regex:"BIRD\\-([A-Za-z0-9]+)",device_replacement:"Bird $1",other:!0},{regex:"BIRD\\.([A-Za-z0-9]+)",device_replacement:"Bird $1",other:!0},{regex:"BIRD ([A-Za-z0-9]+)",device_replacement:"Bird $1",other:!0},{regex:"Dell ([A-Za-z0-9]+)",device_replacement:"Dell $1",manufacturer:"Dell"},{regex:"DoCoMo/2\\.0 ([A-Za-z0-9]+)",device_replacement:"DoCoMo $1",other:!0},{regex:"([A-Za-z0-9]+)\\_W\\;FOMA",device_replacement:"DoCoMo $1",other:!0},{regex:"([A-Za-z0-9]+)\\;FOMA",device_replacement:"DoCoMo $1",other:!0},{regex:"vodafone([A-Za-z0-9]+)",device_replacement:"Huawei Vodafone $1",other:!0},{regex:"i\\-mate ([A-Za-z0-9]+)",device_replacement:"i-mate $1",other:!0},{regex:"Kyocera\\-([A-Za-z0-9]+)",device_replacement:"Kyocera $1",other:!0},{regex:"KWC\\-([A-Za-z0-9]+)",device_replacement:"Kyocera $1",other:!0},{regex:"Lenovo\\-([A-Za-z0-9]+)",device_replacement:"Lenovo $1",manufacturer:"Lenovo"},{regex:"Lenovo\\_([A-Za-z0-9]+)",device_replacement:"Lenovo $1",manufacturer:"Levovo"},{regex:"LG/([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LG-LG([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LGE-LG([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LGE VX([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LG ([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LGE LG\\-AX([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LG\\-([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LGE\\-([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"LG([A-Za-z0-9]+)",device_replacement:"LG $1",manufacturer:"LG"},{regex:"(KIN)\\.One (\\d+)\\.(\\d+)",device_replacement:"Microsoft $1"},{regex:"(KIN)\\.Two (\\d+)\\.(\\d+)",device_replacement:"Microsoft $1"},{regex:"(Motorola)\\-([A-Za-z0-9]+)",manufacturer:"Motorola"},{regex:"MOTO\\-([A-Za-z0-9]+)",device_replacement:"Motorola $1",manufacturer:"Motorola"},{regex:"MOT\\-([A-Za-z0-9]+)",device_replacement:"Motorola $1",manufacturer:"Motorola"},{regex:"Philips([A-Za-z0-9]+)",device_replacement:"Philips $1",manufacturer:"Philips"},{regex:"Philips ([A-Za-z0-9]+)",device_replacement:"Philips $1",manufacturer:"Philips"},{regex:"SAMSUNG-([A-Za-z0-9\\-]+)",device_replacement:"Samsung $1",manufacturer:"Samsung"},{regex:"SAMSUNG\\; ([A-Za-z0-9\\-]+)",device_replacement:"Samsung $1",manufacturer:"Samsung"},{regex:"Softbank/1\\.0/([A-Za-z0-9]+)",device_replacement:"Softbank $1",other:!0},{regex:"Softbank/2\\.0/([A-Za-z0-9]+)",device_replacement:"Softbank $1",other:!0},{regex:"(hiptop|avantgo|plucker|xiino|blazer|elaine|up.browser|up.link|mmp|smartphone|midp|wap|vodafone|o2|pocket|mobile|pda)",device_replacement:"Generic Smartphone"},{regex:"^(1207|3gso|4thp|501i|502i|503i|504i|505i|506i|6310|6590|770s|802s|a wa|acer|acs\\-|airn|alav|asus|attw|au\\-m|aur |aus |abac|acoo|aiko|alco|alca|amoi|anex|anny|anyw|aptu|arch|argo|bell|bird|bw\\-n|bw\\-u|beck|benq|bilb|blac|c55/|cdm\\-|chtm|capi|comp|cond|craw|dall|dbte|dc\\-s|dica|ds\\-d|ds12|dait|devi|dmob|doco|dopo|el49|erk0|esl8|ez40|ez60|ez70|ezos|ezze|elai|emul|eric|ezwa|fake|fly\\-|fly\\_|g\\-mo|g1 u|g560|gf\\-5|grun|gene|go.w|good|grad|hcit|hd\\-m|hd\\-p|hd\\-t|hei\\-|hp i|hpip|hs\\-c|htc |htc\\-|htca|htcg)",device_replacement:"Generic Feature Phone"},{regex:"^(htcp|htcs|htct|htc\\_|haie|hita|huaw|hutc|i\\-20|i\\-go|i\\-ma|i230|iac|iac\\-|iac/|ig01|im1k|inno|iris|jata|java|kddi|kgt|kgt/|kpt |kwc\\-|klon|lexi|lg g|lg\\-a|lg\\-b|lg\\-c|lg\\-d|lg\\-f|lg\\-g|lg\\-k|lg\\-l|lg\\-m|lg\\-o|lg\\-p|lg\\-s|lg\\-t|lg\\-u|lg\\-w|lg/k|lg/l|lg/u|lg50|lg54|lge\\-|lge/|lynx|leno|m1\\-w|m3ga|m50/|maui|mc01|mc21|mcca|medi|meri|mio8|mioa|mo01|mo02|mode|modo|mot |mot\\-|mt50|mtp1|mtv |mate|maxo|merc|mits|mobi|motv|mozz|n100|n101|n102|n202|n203|n300|n302|n500|n502|n505|n700|n701|n710|nec\\-|nem\\-|newg|neon)",device_replacement:"Generic Feature Phone"},{regex:"^(netf|noki|nzph|o2 x|o2\\-x|opwv|owg1|opti|oran|ot\\-s|p800|pand|pg\\-1|pg\\-2|pg\\-3|pg\\-6|pg\\-8|pg\\-c|pg13|phil|pn\\-2|pt\\-g|palm|pana|pire|pock|pose|psio|qa\\-a|qc\\-2|qc\\-3|qc\\-5|qc\\-7|qc07|qc12|qc21|qc32|qc60|qci\\-|qwap|qtek|r380|r600|raks|rim9|rove|s55/|sage|sams|sc01|sch\\-|scp\\-|sdk/|se47|sec\\-|sec0|sec1|semc|sgh\\-|shar|sie\\-|sk\\-0|sl45|slid|smb3|smt5|sp01|sph\\-|spv |spv\\-|sy01|samm|sany|sava|scoo|send|siem|smar|smit|soft|sony|t\\-mo|t218|t250|t600|t610|t618|tcl\\-|tdg\\-|telm|tim\\-|ts70|tsm\\-|tsm3|tsm5|tx\\-9|tagt)",device_replacement:"Generic Feature Phone"},{regex:"^(talk|teli|topl|tosh|up.b|upg1|utst|v400|v750|veri|vk\\-v|vk40|vk50|vk52|vk53|vm40|vx98|virg|vite|voda|vulc|w3c |w3c\\-|wapj|wapp|wapu|wapm|wig |wapi|wapr|wapv|wapy|wapa|waps|wapt|winc|winw|wonu|x700|xda2|xdag|yas\\-|your|zte\\-|zeto|aste|audi|avan|blaz|brew|brvw|bumb|ccwa|cell|cldc|cmd\\-|dang|eml2|fetc|hipt|http|ibro|idea|ikom|ipaq|jbro|jemu|jigs|keji|kyoc|kyok|libw|m\\-cr|midp|mmef|moto|mwbp|mywa|newt|nok6|o2im|pant|pdxg|play|pluc|port|prox|rozo|sama|seri|smal|symb|treo|upsi|vx52|vx53|vx60|vx61|vx70|vx80|vx81|vx83|vx85|wap\\-|webc|whit|wmlb|xda\\-|xda\\_)",device_replacement:"Generic Feature Phone"},{regex:"(bot|borg|google(^tv)|yahoo|slurp|msnbot|msrbot|openbot|archiver|netresearch|lycos|scooter|altavista|teoma|gigabot|baiduspider|blitzbot|oegp|charlotte|furlbot|http%20client|polybot|htdig|ichiro|mogimogi|larbin|pompos|scrubby|searchsight|seekbot|semanticdiscovery|silk|snappy|speedy|spider|voila|vortex|voyager|zao|zeal|fast\\-webcrawler|converacrawler|dataparksearch|findlinks)",device_replacement:"Spider"}],mobile_browser_families:["Firefox Mobile","Opera Mobile","Opera Mini","Mobile Safari","webOS","IE Mobile","Playstation Portable","Nokia","Blackberry","Palm","Silk","Android","Maemo","Obigo","Netfront","AvantGo","Teleca","SEMC-Browser","Bolt","Iris","UP.Browser","Symphony","Minimo","Bunjaloo","Jasmine","Dolfin","Polaris","BREW","Chrome Mobile","Chrome Mobile iOS","UC Browser","Tizen Browser"]}||function(){var t={};return e.parsers.map(function(e){t[e]=[]}),t}(),e.families=function(){var t={};return e.types.map(function(e){t[e]=[]}),t}();var t=Array.prototype,i=(Object.prototype,Function.prototype,t.forEach);t.indexOf;var a=function(e,t){for(var i={},a=0;t.length>a&&!(i=t[a](e));a++);return i},r=function(e,t){o(e,function(e){o(t,function(t){delete e[t]})})},o=forEach=function(e,t,a){if(null!=e)if(i&&e.forEach===i)e.forEach(t,a);else if(e.length===+e.length)for(var r=0,o=e.length;o>r;r++)t.call(a,e[r],r,e);else for(var n in e)_.has(e,n)&&t.call(a,e[n],n,e)},n=function(e){return!(!e||void 0===e||null==e)},s=function(e){var t="";return n(e=e||{})&&n(e.major)&&(t+=e.major,n(e.minor)&&(t+="."+e.minor,n(e.patch)&&(t+="."+e.patch))),t},l=function(e){var t=s(e=e||{});return t&&(t=" "+t),e&&n(e.family)?e.family+t:""};return e.parse=function(t){var i=function(t){return e.regexes[t+"_parsers"].map(function(e){var i=RegExp(e.regex),a=e[("browser"===t?"family":t)+"_replacement"],r=e.major_version_replacement;return function(t){var o=t.match(i);if(!o)return null;var n={};return n.family=(a?a.replace("$1",o[1]):o[1])||"other",n.major=parseInt(r||o[2])||null,n.minor=o[3]?parseInt(o[3]):null,n.patch=o[4]?parseInt(o[4]):null,n.tablet=e.tablet,n.man=e.manufacturer||null,n}})},o=i("browser"),d=i("os"),c=i("device"),u=new function(){};u.source=t,u.browser=a(t,o),n(u.browser)?(u.browser.name=l(u.browser),u.browser.version=s(u.browser)):u.browser={},u.os=a(t,d),n(u.os)?(u.os.name=l(u.os),u.os.version=s(u.os)):u.os={},u.device=a(t,c),n(u.device)?(u.device.name=l(u.device),u.device.version=s(u.device)):u.device={tablet:!1,family:"Other"};var p={};return e.regexes.mobile_browser_families.map(function(e){p[e]=!0}),e.regexes.mobile_os_families.map(function(e){p[e]=!0}),u.device.type="Spider"===u.browser.family?"Spider":u.browser.tablet||u.os.tablet||u.device.tablet?"Tablet":p.hasOwnProperty(u.browser.family)?"Mobile":"Desktop",u.device.manufacturer=u.browser.man||u.os.man||u.device.man||null,r([u.browser,u.os,u.device],["tablet","man"]),u},e}();"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports.detect=t):e.detect=t,"function"==typeof define&&define.amd&&define(function(){return t})}(window);var NoOfLoginAttempt=0,NoOfLoginAttemptemail=0,fpDeviceId="",PageType="",isWindowsPhone=navigator.userAgent.match(/windows phone/i)||!1,AndroidMobile=null!=navigator.userAgent.match(/Android/i)&&null!=navigator.userAgent.match(/Mobile/i)&&null==navigator.userAgent.match(/Windows/i),isiPhone=null!=navigator.userAgent.match(/iphone/i);_twoFactor={isMobileDevice:0==(/iPad/.test(navigator.userAgent)&&!window.MSStream)&&(isiPhone||isWindowsPhone||AndroidMobile),WillDoLater:"I’ll do this later",Model:{isFromInvalidEmailCell:!1,DialingCode:""},PageType:{BusinessSignup:"BusinessSignup",ProfilePage:"ProfilePage",CustomerSignup:"CustomerSignup",CustomerSignIn:"CustomerSignIn",MultiLocation:"MultiLocation",PaymentMethods:"PaymentMethods",CovidClean:"CovidClean",ShoppingBag:"ShoppingBag"},ApiURLEnum:{TwoFactorAuthenticationCustomer:"websiteapi/homepage/twofactorauthenticationcustomer",AddBusinessTwoFactorAuthentication:"addbusiness/twofactorauthentication",SaveFilterrequestForCardValidate:"websiteapi/homepage/savefilterrequestforcardvalidate",GetLogDataonBackClick:"addbusiness/getlogdataonbackclick"},AuthCodeReceiveMode:{Email:1,Cell:2,EmailAndCell:3},EmailAndCell2FScreen:{None:0,EmailOrPhone:1,EmailAndPhone:2,EmailOrPhoneNew:3},VarificationType:{None:0,Email:1,Cell:2,EmailAndCell:3,EmailOrPhone:4},ScreenType:{EmailInput:1,EmailVerify:2,EmailInput:3,EmailVerify:4,SuccessScreen:5},ValidationMessages:{FailedErrorMessage:"Something went wrong, please try again.",FailedUserSaveMsg:"User detail not saved",InvalidEmailIdMsg:"Email address is invalid. Please enter valid email address."},SuccessMessage:{EmailVerified:"Email verified",PhoneVerified:"Mobile number verified",ResendCode:"New verification code sent."},AmplitudeEvent:{SignupEmailVerificationTriggered:53,SignupPhoneVerificationTriggered:54,SignupStep1Completed:55,SignupVerificationTriggered:106},FailOTPMessage:function(e,t=!1){if(t)return void 0!==e&&null!=e&&""!=e?"Please contact support at "+e+" or support@vagaro.com.":"Please contact support at support@vagaro.com.";var i='<a href="mailto:support@vagaro.com" class="questions link" style="font-size:14px"> support@vagaro.com</a>';return void 0!==e&&null!=e&&""!=e?'Please contact support at <a href="tel:'+e+'" class="questions link" style="font-size:14px">'+e+"</a> or "+i+".":"Please contact support at "+i+"."},LoadTwoFactorControlForInput:function(e){PageType=currentPage;var t={UserControlPath:"~/UserControls/ucTwoFactor.ascx",PageNamePath:"~/detail1.aspx",isRemoveFormTag:!0,Parameters:{}},i=new vagaro.ajax;i.datamodel.Token="websiteapi/homepage/loadusercontrol",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){if($("#dvtwostepemailcodeinfo").html(""),$("#dvtwostepemailcodeinfo").append(t),void 0!==getCookie&&void 0!==ProximityCookieName&&null!=typeof ProximityCookieName&&""!=typeof ProximityCookieName&&(cookie=getCookie(ProximityCookieName)),twoFactorCellPhone=$("#txtCellInputCode").PhonePlugin({UserRole:"1"==e.UserType?2:1,IsPhoneNoRequire:!0,ControlText:"Mobile Phone",CountryId:parseInt(e.CountryID),CurrentLocationCountryID:"undefined"!=typeof cookie&&null!=cookie?parseInt(cookie.countryid):1}),_twoFactor.isMobileDevice?$("input[type=tel]").attr("autocomplete","one-time-code"):$("input[type=tel]").attr("autocomplete","off"),currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag)$("#divtwofactorauthentication .modal-window").addClass("myaccount-popup");else if(currentPage==_twoFactor.PageType.BusinessSignup){var i=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();(null!=i&&/com.vagaro.iospro/i.test(i)||/com.vagaro.androidpro/i.test(i))&&$(".previous-btn").hide()}else $("#divtwofactorauthentication .modal-window").removeClass("myaccount-popup");e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email||e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.EmailAndCell?_twoFactor.AppendEmailInputScreen(e):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell&&_twoFactor.AppendCellInputScreen(e)},i.datamodel.data=t,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()},SendTowFactorAuthenticationCode:function(e){PageType=currentPage;var t={UserControlPath:"~/UserControls/ucTwoFactor.ascx",PageNamePath:"~/detail1.aspx",isRemoveFormTag:!0,Parameters:{}},i=new vagaro.ajax;i.datamodel.Token="websiteapi/homepage/loadusercontrol",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(t){try{if(currentPage==_twoFactor.PageType.BusinessSignup){vm.CurrentstepsCompleted=_twoFactor.AmplitudeEvent.SignupVerificationTriggered;var i={},a=JSON.parse(localStorage.getItem("BusinessSignupStep1Data"));if(i.FirstName=a.firstName,i.LastName=a.lastName,i.UserId=a.userId,i.Email=a.email,i.Step=_twoFactor.AmplitudeEvent.SignupVerificationTriggered,i.BusinessName=a.businessname,i.UserName=localStorage.getItem("eventusername"),i.PageURL=window.location.href,i.PromoCode=a.promotioncode,i.Address1=a.businessaddress+","+a.city+","+a.statename+","+a.businesszip,i.Address2=a.suit,i.Phone=a.phone,i.BusinessPhone=a.OwnerPhone,i.SignupType=a.userType,i.HearAboutVagaro=a.aboutyou,i.Licence=localStorage.getItem("NoOfLicences"),i.City=a.city,i.State=a.statename,i.Country=a.Country,"0"==a.IsMobileServiceMandatory?i.MobileService="PhysicalLocation":"1"==a.IsMobileServiceMandatory?i.MobileService="MobileBusiness":i.MobileService="Both",i.UserAgent=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"","undefined"!=typeof amplitude)i.AmplitudeDeviceId=amplitude.getInstance().getDeviceId();else try{i.AmplitudeDeviceId=vm.GetAmplitudeDeviceId()}catch(e){i.AmplitudeDeviceId=""}var r={};r.AddLogInAmplitude=i,vm.AjaxOld("AddLogInAmplitudeV2",r,vm.AddLogInAmplitudeSuccess,vm.AddLogInAmplitudeSuccessFail)}}catch(e){console.log(e)}if($("#dvtwostepemailcodeinfo").html(""),$("#dvtwostepemailcodeinfo").append(t),void 0!==getCookie&&void 0!==ProximityCookieName&&null!=typeof ProximityCookieName&&""!=typeof ProximityCookieName&&(cookie=getCookie(ProximityCookieName)),twoFactorCellPhone=$("#txtCellInputCode").PhonePlugin({UserRole:1,IsPhoneNoRequire:!0,ControlText:"Mobile Phone",CountryId:parseInt(e.CountryID),CurrentLocationCountryID:parseInt(e.CountryID)}),_twoFactor.isMobileDevice?$("input[type=tel]").attr("autocomplete","one-time-code"):$("input[type=tel]").attr("autocomplete","off"),currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag)$("#divtwofactorauthentication").removeAttr("style");else if(currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignup){if(currentPage==_twoFactor.PageType.CustomerSignup&&$(".signup-loader-height").length>0){var o=e.authenticationMode==_twoFactor.AuthCodeReceiveMode.Cell?"phone":"email";$(".signup-loader-height").addClass(o)}currentPage==_twoFactor.PageType.CustomerSignup&&(_twoFactor.isMobileDevice&&$("#btnCreateAccount",parent.document).hide(),$("#iFrameSignUp",parent.document).parents().find("body").removeClass("signupiframe"));var n=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();(null!=n&&/customerios/i.test(n)||/customerandroid amazon/i.test(n)||/customerandroid/i.test(n)||/com.vagaro.iospro/i.test(n)||/com.vagaro.androidpro/i.test(n))&&$(".previous-btn").hide()}else $("#divtwofactorauthentication .modal-window").removeClass("myaccount-popup");_twoFactor.SendTwoFactorCode(e)},i.datamodel.data=t,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()},SendTwoFactorCode:function(e){if(e.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),currentPage==_twoFactor.PageType.BusinessSignup&&$("#AuthEmailNextbtn").length>0&&$("#AuthEmailNextbtn").addClass("flamingo-button").text("Next"),currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignIn||currentPage==_twoFactor.PageType.CustomerSignup||currentPage==_twoFactor.PageType.MultiLocation){var t=new vagaro.ajax;e.EmailCellAppSetting=$("#hdnEmailAndCell2FScreen").val(),e.IsTwoFactorSignupLoadData=currentPage==_twoFactor.PageType.BusinessSignup,currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignup||currentPage==_twoFactor.PageType.MultiLocation?t.datamodel.Token=_twoFactor.ApiURLEnum.AddBusinessTwoFactorAuthentication:(currentPage==_twoFactor.PageType.CustomerSignIn&&$("#hdnUserType").length>0&&(e.UserType=$("#hdnUserType").val()),t.datamodel.Token=_twoFactor.ApiURLEnum.TwoFactorAuthenticationCustomer),t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(t){if(void 0!==t&&null!=t)if(t.IsAlreadyVarified&&currentPage!=_twoFactor.PageType.CustomerSignup)currentPage==_twoFactor.PageType.BusinessSignup?(ShowLoader(!1),vm.SkipTwoFactorStep()):currentPage==_twoFactor.PageType.CustomerSignIn&&(ShowLoadingPanelLogin(!1),isNullOrUndefineOrBlank(SkipTwoFactoFromSignIn)||SkipTwoFactoFromSignIn());else{if(NoOfLoginAttempt=t.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=t.TwoFactorRequest,currentPage==_twoFactor.PageType.CustomerSignup?t.formattedPhone=$.trim($("#txtCell").val()):currentPage==_twoFactor.PageType.BusinessSignup?t.formattedPhone=$.trim($("#txtOwnerPhone").val()):currentPage==_twoFactor.PageType.CustomerSignIn?t.formattedPhone=$.trim($("#txtCellInputCode").val()):currentPage==_twoFactor.PageType.MultiLocation&&(t.formattedPhone=$.trim($("#txtTelephone").val())),t.IsSucess)void 0!==t.WidgetUserID&&null!=t.WidgetUserID&&""!=t.WidgetUserID&&(widgetcookievalue=t.WidgetUserID),e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(t):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell?_twoFactor.AppendCellScreen(t):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.EmailAndCell&&_twoFactor.AppendEmailScreen(t);else if(currentPage==_twoFactor.PageType.BusinessSignup)if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){var i={};isNullOrUndefineOrBlank(fpDeviceId)||(i.UserAgent=navigator.userAgent,i.VisitorID=fpDeviceId),i.UserName=$("#txtEmail").val(),i.UserEmail=$("#txtEmail").val(),i.State=vm.addressData.state,i.City=vm.addressData.city,i.Country=$("#ddlcountry").val(),i.NoofAttempt=vm.NoOfLoginAttemptemail,i.IP=$("#hdnIPAddress").val(),i.DeviceFullName=vm.deviceFrom;var a=$("#txtOwnerPhone").val().replace(/([()-\s])+/g,"");2==i.Country&&0==a[0]?i.OwnersPhone=a.substring(1):i.OwnersPhone=a,i.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),i.IsBlock=1,_twoFactor.SaveFilterRequestForCardValidate(i),_twoFactor.showErrorDiv(e.AuthenticationMode,!0),vm.resetTimer=!1}else{var r=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/signup-1";window.setTimeout(function(){window.location.href=r},4300)}else if(currentPage==_twoFactor.PageType.CustomerSignup)if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){$("#hdnIsBlocked").val(1),IsBlocked=!0,_twoFactor.showErrorDiv(twoStepEmail.AuthenticationMode),i={},isNullOrUndefineOrBlank(fpDeviceId)?isNullOrUndefineOrBlank($("#fpId").val())||(i.UserAgent=navigator.userAgent,i.VisitorID=$("#fpId").val()):(i.UserAgent=navigator.userAgent,i.VisitorID=fpDeviceId),i.UserName=$("#txtEmail").val(),i.UserEmail=$("#txtEmail").val(),i.Country=$("#divCountryCode").attr("data-countryid"),i.NoofAttempt=NoOfLoginAttemptemail,i.IP=$("#hdnIPAddress").val(),i.DeviceFullName="";var o=$("#txtCell").val().replace(/([()-\s])+/g,"");2==i.Country&&0==o[0]?i.OwnersPhone=o.substring(1):i.OwnersPhone=o,i.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),i.IsBlock=1,_twoFactor.SaveFilterRequestForCardValidate(i),isResetTimer=!1}else window.setTimeout(function(){$("#divAuth").hide(),$("#pnlSignup").show(),$("#iFrameSignUp",parent.document).parents().find("#signupheaderpart").show()},4300);else if(currentPage==_twoFactor.PageType.CustomerSignIn)if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){$("#hdnIsBlocked").val(1),IsBlocked=!0,_twoFactor.showErrorDiv(twoStepEmail.AuthenticationMode),i={},isNullOrUndefineOrBlank(fpDeviceId)?isNullOrUndefineOrBlank($("#fpId").val())||(i.UserAgent=navigator.userAgent,i.VisitorID=$("#fpId").val()):(i.UserAgent=navigator.userAgent,i.VisitorID=fpDeviceId),i.UserName=isNullOrUndefineOrBlank(userccattemptdata.EmailId)?$.trim($("#txtEmailInputCode").val()):$.trim(userccattemptdata.EmailId),i.UserEmail=isNullOrUndefineOrBlank(userccattemptdata.EmailId)?$.trim($("#txtEmailInputCode").val()):$.trim(userccattemptdata.EmailId),i.Country="5"==$("#selectedCountrydiv").attr("data-countryid")?"2":$("#selectedCountrydiv").attr("data-countryid"),i.NoofAttempt=NoOfLoginAttemptemail,i.IP=$("#hdnIPAddress").val(),i.DeviceFullName="";var n=isNullOrUndefineOrBlank(userccattemptdata.PhoneNo)?$("#txtCellInputCode").val().replace(/([()-\s])+/g,""):$.trim(userccattemptdata.PhoneNo);2==i.Country&&0==n[0]?i.OwnersPhone=n.substring(1):i.OwnersPhone=n,i.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),i.IsBlock=1,_twoFactor.SaveFilterRequestForCardValidate(i),isResetTimer=!1}else window.setTimeout(function(){},4300);currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.MultiLocation?ShowLoader(!1):ShowLoadingPanelLogin(!1)}else currentPage==_twoFactor.PageType.BusinessSignup?ShowLoader(!1):ShowLoadingPanelLogin(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},t.datamodel.data=e,t.datamodel.Error=function(){currentPage==_twoFactor.PageType.MultiLocation&&ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},t.Post()}else currentPage!=_twoFactor.PageType.ProfilePage&&currentPage!=_twoFactor.PageType.CovidClean&&currentPage!=_twoFactor.PageType.ShoppingBag||($("#hdnUserType").length>0&&(e.UserType=$("#hdnUserType").val()),e.EmailCellAppSetting=currentPage!=_twoFactor.PageType.ProfilePage||"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType?$("#hdnEmailAndCell2FScreenVPL").val():$("#hdnEmailAndCell2FScreen").val(),(t=new vagaro.ajax).datamodel.Token=currentPage==_twoFactor.PageType.ProfilePage?ApiURLEnumMyAccount.TwoFactorAuthenticationCustomer:_twoFactor.ApiURLEnum.TwoFactorAuthenticationCustomer,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=function(t){if(void 0!==t&&null!=t)if(t.IsAlreadyVarified)currentPage==_twoFactor.PageType.ProfilePage?"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?_myAccount.SaveVPLUSerDetailProfile():_myAccount.SaveProfile():currentPage==_twoFactor.PageType.CovidClean?_vgCovidCleanCheckout.SaveVPLUSerDetailProfile():currentPage==_twoFactor.PageType.ShoppingBag&&_onlineCheckout.SaveVPLUSerDetailProfile();else{if(NoOfLoginAttempt=t.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=t.TwoFactorRequest,currentPage==_twoFactor.PageType.ProfilePage?t.formattedPhone=MyAccountMobilePhone.getphoneformat(t.cellDisplay,e.CountryID):t.formattedPhone=$.trim($("#txtCell").val()),t.IsSucess)$("#divtwofactorauthentication").modal("show"),$("#divtwofactorauthentication .modal-backdrop").css("pointer-events","none"),$("#AuthCellBackbtn").text("Close"),$("#AutCellhBackbtn").text("Close"),$("#closed").show(),$("#divtwofactorauthentication").addClass("mobile-popup-myaccount"),$("#mobile-popup-myaccount-inner").addClass("mobile-popup-myaccount-inner"),$("#divModalWindow").addClass("myaccount-popup"),e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(t):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell?_twoFactor.AppendCellScreen(t):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.EmailAndCell&&_twoFactor.AppendEmailScreen(t);else{if($("#divtwofactorauthentication").modal("show"),NoOfLoginAttempt>=$("#hdnFraudNoOfAttemptCustomer").val()){var i={};isNullOrUndefineOrBlank(fpDeviceId)||(i.UserAgent=navigator.userAgent,i.VisitorID=fpDeviceId),i.UserName=$("#txtEmail").val(),i.UserEmail=$("#txtEmail").val(),i.State=$("#txtState").val(),i.City=$("#txtCity").val(),i.Country=$("#ddlcountry").val(),i.NoofAttempt=NoOfLoginAttemptemail,i.IP=$("#hdnIPAddress").val(),i.DeviceFullName="";var a=$("#txtCell").val().replace(/([()-\s])+/g,"");2==i.Country&&0==a[0]?i.OwnersPhone=a.substring(1):i.OwnersPhone=a,i.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),i.IsBlock=1,currentPage==_twoFactor.PageType.ProfilePage||(i.UserID=parseInt(UserID)),_twoFactor.SaveFilterRequestForCardValidate(i),$("#divtwofactorauthentication").modal("show"),_twoFactor.showErrorDiv(e.AuthenticationMode,!0)}$("#divtwofactorauthentication .modal-backdrop").css("pointer-events","none")}ShowLoader(!1)}else ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},t.datamodel.data=e,t.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},t.Post())},SendTwoFactorCodeForCell:function(e,t=!1){if(currentPage==_twoFactor.PageType.BusinessSignup&&$("#AuthCellNextbtn").length>0&&$("#AuthCellNextbtn").addClass("flamingo-button").text("Next"),e.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),void 0!==ShowLoader&&ShowLoader(!0),currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignup||currentPage==_twoFactor.PageType.CustomerSignIn||currentPage==_twoFactor.PageType.MultiLocation)e.EmailCellAppSetting=$("#hdnEmailAndCell2FScreen").val(),e.IsTwoFactorSignupLoadData=currentPage==_twoFactor.PageType.BusinessSignup,(i=new vagaro.ajax).datamodel.Token=currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignup||currentPage==_twoFactor.PageType.MultiLocation?_twoFactor.ApiURLEnum.AddBusinessTwoFactorAuthentication:_twoFactor.ApiURLEnum.TwoFactorAuthenticationCustomer,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(i){if(void 0!==ShowLoader&&ShowLoader(!0),void 0!==i&&null!=i)if(i.formattedPhone=e.formattedPhone,currentPage==_twoFactor.PageType.BusinessSignup)if(3==i.IsAlreadyVarified)ShowLoader(!1),vm.SkipTwoFactorStep();else{if(NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest,i.IsSucess)e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(i,currentPage):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell&&_twoFactor.AppendCellScreen(i,t);else{if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){_twoFactor.showErrorDiv(e.AuthenticationMode);var a={};isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.State=vm.addressData.state,a.City=vm.addressData.city,a.Country=$("#ddlcountry").val(),a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName=vm.deviceFrom;var r=$("#txtOwnerPhone").val().replace(/([()-\s])+/g,"");return 2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoader(!1)}if(currentPage==_twoFactor.PageType.BusinessSignup){var o=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/signup-1";window.setTimeout(function(){window.location.href=o},4300)}}ShowLoader(!1)}else if(currentPage==_twoFactor.PageType.CustomerSignup){if(NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest,i.IsSucess)void 0!==i.WidgetUserID&&null!=i.WidgetUserID&&""!=i.WidgetUserID&&(widgetcookievalue=i.WidgetUserID),e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(i,currentPage):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell&&_twoFactor.AppendCellScreen(i,t);else if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){_twoFactor.showErrorDiv(e.AuthenticationMode),a={},isNullOrUndefineOrBlank(fpDeviceId)?isNullOrUndefineOrBlank($("#fpId").val())||(a.UserAgent=navigator.userAgent,a.VisitorID=$("#fpId").val()):(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.Country=$("#divCountryCode").attr("data-countryid"),a.NoofAttempt=vm.NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="";var n=$("#txtCell").val().replace(/([()-\s])+/g,"");return 2==a.Country&&0==n[0]?a.OwnersPhone=n.substring(1):a.OwnersPhone=n,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,_twoFactor.SaveFilterRequestForCardValidate(a),isResetTimer=!1,void ShowLoadingPanelLogin(!1)}ShowLoadingPanelLogin(!1)}else if(currentPage==_twoFactor.PageType.CustomerSignIn){if(NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest,i.IsSucess)e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(i,currentPage):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell&&_twoFactor.AppendCellScreen(i,t);else if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(e.AuthenticationMode),a={},isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=isNullOrUndefineOrBlank(userccattemptdata.EmailId)?$.trim($("#txtEmailInputCode").val()):$.trim(userccattemptdata.EmailId),a.UserEmail=isNullOrUndefineOrBlank(userccattemptdata.EmailId)?$.trim($("#txtEmailInputCode").val()):$.trim(userccattemptdata.EmailId),a.Country="5"==$("#selectedCountrydiv").attr("data-countryid")?"2":$("#selectedCountrydiv").attr("data-countryid"),a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="",r=isNullOrUndefineOrBlank(userccattemptdata.EmailId)?$("#txtCellInputCode").val().replace(/([()-\s])+/g,""):$.trim(userccattemptdata.EmailId),2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoadingPanelLogin(!1);ShowLoadingPanelLogin(!1)}else currentPage==_twoFactor.PageType.MultiLocation&&(NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest,i.IsSucess&&(e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(i,currentPage):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell&&_twoFactor.AppendCellScreen(i,t)),ShowLoader(!1));else currentPage==_twoFactor.PageType.CustomerSignup||currentPage==_twoFactor.PageType.CustomerSignIn?ShowLoadingPanelLogin(!1):currentPage==_twoFactor.PageType.BusinessSignup&&ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.datamodel.data=e,i.datamodel.Error=function(){currentPage==_twoFactor.PageType.MultiLocation&&ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post();else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag){var i;e.EmailCellAppSetting=currentPage!=_twoFactor.PageType.ProfilePage||"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType?$("#hdnEmailAndCell2FScreenVPL").val():$("#hdnEmailAndCell2FScreen").val(),(i=new vagaro.ajax).datamodel.Token=currentPage==_twoFactor.PageType.ProfilePage?ApiURLEnumMyAccount.TwoFactorAuthenticationCustomer:_twoFactor.ApiURLEnum.TwoFactorAuthenticationCustomer,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(i){if(void 0!==i&&null!=i)if(currentPage==_twoFactor.PageType.ProfilePage?i.formattedPhone=MyAccountMobilePhone.getphoneformat(i.cellDisplay,twoStepEmail.CountryID):i.formattedPhone=e.formattedPhone,3==i.IsAlreadyVarified)currentPage==_twoFactor.PageType.ProfilePage?"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?_myAccount.SaveVPLUSerDetailProfile():_myAccount.SaveProfile():currentPage==_twoFactor.PageType.CovidClean?_vgCovidCleanCheckout.SaveVPLUSerDetailProfile():currentPage==_twoFactor.PageType.ShoppingBag&&_onlineCheckout.SaveVPLUSerDetailProfile();else{if(NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest,i.IsSucess)e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.AppendEmailScreen(i,currentPage):e.AuthenticationMode==_twoFactor.AuthCodeReceiveMode.Cell&&_twoFactor.AppendCellScreen(i,t);else if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){_twoFactor.showErrorDiv(e.AuthenticationMode);var a={};isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.State=vm.addressData.state,a.City=vm.addressData.city,a.Country=$("#ddlcountry").val(),a.NoofAttempt=vm.NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName=vm.deviceFrom;var r=$("#txtOwnerPhone").val().replace(/([()-\s])+/g,"");return 2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,currentPage==_twoFactor.PageType.ProfilePage||(a.UserID=parseInt(UserID)),_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoader(!1)}ShowLoader(!1)}else ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.datamodel.data=e,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()}},AppendEmailInputScreen:function(e){$(".signup-verify").hide(),currentPage==_twoFactor.PageType.CustomerSignIn&&(void 0!==e.emailid&&null!=e.emailid&&""!=e.emailid&&$("#txtEmailInputCode").val(e.emailid),$(".previous-btn").text(_twoFactor.WillDoLater),1==userccattemptdata.IsNewBusiness&&$(".previous-btn").hide(),$("#pnlLogin").hide(),$("#dvAuth").show(),$("#divtwofactorauthentication").show(),$(".signup-user-found").hasClass("w-hiddenstrict")||($(".signup-user-found").addClass(" w-hiddenstrict"),$(".sign-in-btn-divinner").removeClass(" w-hiddenstrict"),$(".sign-in-logo-div").removeClass(" w-hiddenstrict")),ShowLoadingPanelLogin(!1)),$("#dvAddEmailCode").show(),$("#txtEmailInputCode").focus()},AppendCellInputScreen:function(e,t=!1){$(".signup-verify").hide(),currentPage==_twoFactor.PageType.CustomerSignIn&&(void 0!==e.phone&&null!=e.phone&&""!=e.phone&&($("#txtCellInputCode").val(e.phone),setTimeout(function(){$("#txtCellInputCode").blur()},5e3),_twoFactor.Phone_format("#txtCellInputCode","#dvCellInputCodeError")),$(".previous-btn").text(_twoFactor.WillDoLater),1==userccattemptdata.IsNewBusiness&&$(".previous-btn").hide(),$("#pnlLogin").hide(),$("#dvAuth").show(),void 0!==e.CountryID&&""!=e.CountryID&&($("#selectedCountrydiv").attr("data-countryId",e.CountryID),_twoFactor.Phone_format("#txtCellInputCode","#dvCellInputCodeError",e.CountryID),2==e.CountryID?$("#selectedCountrydiv").removeClass().addClass("selectedcountry uk-f"):3==e.CountryID?$("#selectedCountrydiv").removeClass().addClass("selectedcountry canada-f"):4==e.CountryID&&$("#selectedCountrydiv").removeClass().addClass("selectedcountry aus-f")),$("#divtwofactorauthentication").show(),$(".signup-user-found").hasClass("w-hiddenstrict")||($(".signup-user-found").addClass(" w-hiddenstrict"),$(".sign-in-btn-divinner").removeClass(" w-hiddenstrict"),$(".sign-in-logo-div").removeClass(" w-hiddenstrict")),ShowLoadingPanelLogin(!1)),$("#dvAddPhoneCode").show(),$("#txtCellInputCode").focus(),t&&currentPage==_twoFactor.PageType.CustomerSignIn&&ShowHideDoneMessage(_twoFactor.SuccessMessage.EmailVerified,GetDisplayMessageTime(_twoFactor.SuccessMessage.EmailVerified)),$("#h2VerifyPhone").attr("tabindex",-1).focus()},SendEmailCodeFromInputScreen:function(e=!1){if(e||(e=_twoFactor.validateEmail()),e)if(currentPage==_twoFactor.PageType.CustomerSignIn?ShowLoadingPanelLogin(!0):ShowLoader(!0),isNullOrUndefineOrBlank(userccattemptdata.EmailId)||userccattemptdata.EmailId.toLowerCase()==$.trim($("#txtEmailInputCode").val()).toLowerCase())twoStepEmail={},twoStepEmail.emailid=$.trim($("#txtEmailInputCode").val()),twoStepEmail.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Email,twoStepEmail.IsFromBusinessSignup=!0,_twoFactor.SendTwoFactorCode(twoStepEmail);else{var t='"strUserName" :""';CallWebServicehed("MySampleService.asmx/CheckUserNameAvailabilityWithEmail",t+=',"strEmailID" :"'+$.trim($("#txtEmailInputCode").val())+'"',function(e){1*e.d==1?(ShowLoader(!1),$("#txtEmailInputCode").addClass("error"),$("#dvEmailInputError").html("This email is being used by an existing Vagaro account.").show()):(twoStepEmail={},twoStepEmail.emailid=$.trim($("#txtEmailInputCode").val()),twoStepEmail.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Email,twoStepEmail.IsFromBusinessSignup=!0,_twoFactor.SendTwoFactorCode(twoStepEmail))},function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)})}$("#txtEmailCode").focus()},SendPhoneCodeFromInputScreen:function(e=!1){if(e||(e=_twoFactor.validatePhone("#txtCellInputCode","#dvCellInputCodeError")),e){currentPage==_twoFactor.PageType.CustomerSignIn?ShowLoadingPanelLogin(!0):ShowLoader(!0),twoStepPhone={},twoStepPhone.emailid=$.trim($("#txtEmailInputCode").val());var t={};if(!twoFactorCellPhone.validatePhoneNumber(!0)){var i=twoFactorCellPhone.getValidateMessage();return 3==i.WarningType?($("#dvCellInputCodeError").html("Phone number should be of 10 digits."),$("#dvCellInputCodeError").show()):1==i.WarningType?($("#dvCellInputCodeError").html("Enter your mobile phone"),$("#dvCellInputCodeError").show()):($("#dvCellInputCodeError").html(i.WarningMessage),$("#dvCellInputCodeError").show()),currentPage==_twoFactor.PageType.CustomerSignIn?ShowLoadingPanelLogin(!1):ShowLoader(!1),!1}$("#dvCellInputCodeError").hide(),t=twoFactorCellPhone.getPhoneData(),twoStepPhone.phone=t.phoneNo,twoStepPhone.CountryID=t.countryId,twoStepPhone.DialingCode=t.dialingCode,twoStepPhone.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepPhone.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,twoStepPhone.IsFromBusinessSignup=!0,_twoFactor.SendTwoFactorCode(twoStepPhone)}$("#txtCellCode").focus()},AppendEmailScreen:function(e,t){if($(".signup-verify").hide(),$("#dvEmailVerify").show(),currentPage==_twoFactor.PageType.BusinessSignup)$("#spnForMerchantSignup").show(),$("#divBusinessSteps").hide(),$("#dvAuth").show(),$("#divtwofactorauthentication").show(),vm.isResetTimer=!1;else if(currentPage==_twoFactor.PageType.MultiLocation)$("#divtwofactorauthentication").css("z-index","10001"),$find("mpeNewBusiness").hide(),showLoadingPanel(0),$("#divtwofactorauthentication").show();else if(currentPage==_twoFactor.PageType.CustomerSignup){$("#spnForMerchantSignup").show(),$("#pnlSignup").hide(),$("#iFrameSignUp",parent.document).parents().find("#signupheaderpart").hide(),$("#divAuth").show(),$("#divtwofactorauthentication").show();var i=$("#iFrameSignUp",parent.document).parents().find("#dvRegHid");i.length>0&&(i.addClass("email"),i.removeClass("phone"),i.removeClass("success"))}else currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag?$("#verificationDesc").html($("#verificationDesc").html().replace("For your security, Vagaro wants to make sure it’s really you. Enter the sent a 6-digit code we sent to ","Enter the 6-digit code we sent to ")):currentPage==_twoFactor.PageType.CustomerSignIn&&($("#spnForMerchantSignup").hide(),$(".previous-btn").text(_twoFactor.WillDoLater),1==userccattemptdata.IsNewBusiness&&$(".previous-btn").hide(),$("#pnlLogin").hide(),$("#dvAuth").show(),$("#divtwofactorauthentication").show());$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||currentPage!=_twoFactor.PageType.BusinessSignup&&currentPage!=_twoFactor.PageType.CustomerSignup&&currentPage!=_twoFactor.PageType.MultiLocation?$("#lblEmail").text(e.emailDisplay+". "):($("#verificationTitle").text("Verify Your Email or Mobile Phone"),$("#verificationPara").show(),currentPage==_twoFactor.PageType.CustomerSignup?$("#lblEmailorCell").text($("#txtCell").val()+". "):$("#lblEmailorCell").text(e.formattedPhone+". "),$("#lblEmail").text(e.emailDisplay)),$("#txtEmailCode").focus(),$(".signup-loader-height").length>0&&$(".signup-loader-height").addClass("email")},AppendCellScreen:function(e,t=!1){if($(".signup-verify").hide(),$("#dvPhoneVerify").show(),(navigator.userAgent||navigator.vendor||window.opera).toLowerCase(),_twoFactor.CheckDevice(),t&&(currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignIn||currentPage==_twoFactor.PageType.MultiLocation?ShowHideDoneMessage(_twoFactor.SuccessMessage.EmailVerified,GetDisplayMessageTime(_twoFactor.SuccessMessage.EmailVerified)):currentPage!=_twoFactor.PageType.ProfilePage&&currentPage!=_twoFactor.PageType.CovidClean&&currentPage!=_twoFactor.PageType.ShoppingBag||(_twoFactor.AdaPassiveMessage(_twoFactor.SuccessMessage.EmailVerified),"undefined"!=typeof _common&&null!=_common&&void 0!==_common.PassiveAlertSuccess&&null!=_common.PassiveAlertSuccess&&_common.PassiveAlertSuccess(_twoFactor.SuccessMessage.EmailVerified),"undefined"!=typeof _vgCovidCleanCheckout&&null!=_vgCovidCleanCheckout&&void 0!==_vgCovidCleanCheckout.WarningMessage&&null!=_vgCovidCleanCheckout.WarningMessage&&_vgCovidCleanCheckout.WarningMessage(_twoFactor.SuccessMessage.EmailVerified),"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?$("#hdnEmailBeforeChange").val($("#paymentmethods #emailid").val()):$("#hdnEmailBeforeChange").val($("#txtEmail").val()))),currentPage==_twoFactor.PageType.BusinessSignup)$("#divBusinessSteps").hide(),$("#dvAuth").show(),$("#divtwofactorauthentication").show();else if(currentPage==_twoFactor.PageType.CustomerSignup){$("#pnlSignup").hide(),$("#iFrameSignUp",parent.document).parents().find("#signupheaderpart").hide(),$("#divAuth").show(),$("#divtwofactorauthentication").show();var i=$("#iFrameSignUp",parent.document).parents().find("#dvRegHid");i.length>0&&(i.addClass("phone"),i.removeClass("email"),i.removeClass("success")),t&&ShowHideDoneMessage(_twoFactor.SuccessMessage.EmailVerified,GetDisplayMessageTime(_twoFactor.SuccessMessage.EmailVerified))}else currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag?($("#verificationCell").html($("#verificationCell").html().replace("Next, Verify Your Mobile Phone","Verify Your Mobile Phone")),$("#enterCell").html($("#enterCell").html().replace("Enter the sent a 6-digit code we sent to ","Enter the 6-digit code we sent to "))):currentPage==_twoFactor.PageType.CustomerSignIn&&($(".previous-btn").text(_twoFactor.WillDoLater),1==userccattemptdata.IsNewBusiness&&$(".previous-btn").hide(),$("#pnlLogin").hide(),$("#dvAuth").show(),$("#divtwofactorauthentication").show());"5"==$("#selectedCountrydiv").attr("data-countryid")||$("#selectedCountrydiv").attr("data-countryid"),$("#lblCell").text(e.formattedPhone),$(".signup-loader-height").length>0&&$(".signup-loader-height").addClass("phone"),$("#txtCellCode").focus()},CheckDevice:function(){var e=navigator.userAgent;return null!=e.match(/(iPhone|iPod)/)||null!=e.match(/BlackBerry/)||null!=e.match(/Silk/)||null!=e.match(/Android/)||null!=e.match(/iPad/)},EmailCodeSuccess:function(e,t=!1){currentPage==_twoFactor.PageType.CustomerSignIn?_twoFactor.AppendCellInputScreen(e,t):_twoFactor.SendTwoFactorCodeForCell(e,t)},CellCodeSuccess:function(e=!1){_twoFactor.ShowFinalSuccessScreen(e)},ShowFinalSuccessScreen:function(e=!1){if($(".signup-verify").hide(),currentPage!=_twoFactor.PageType.BusinessSignup&&($("#AuthSuccessBackbtn").hide(),$("#AuthSuccessNextbtn").text("Done")),currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag)_twoFactor.BackFromAuth();else if(currentPage==_twoFactor.PageType.CustomerSignup){var t=$("#iFrameSignUp",parent.document).parents().find("#dvRegHid");t.length>0&&(t.removeClass("phone"),t.removeClass("email"),t.addClass("success")),$("#dvSuccessVerify").show()}else{currentPage!=_twoFactor.PageType.BusinessSignup&&$("#dvSuccessVerify").show();var i=null!=navigator.userAgent.toLowerCase()?navigator.userAgent.toLowerCase():"";"undefined"==typeof vgAppicationType||1!=vgAppicationType||isNullOrUndefineOrBlank(SkipTwoFactoFromSignIn)||isNullOrUndefineOrBlank(_securelogin.AfterSuccessfullLogin)||!(i.indexOf("com.vagaro.customerandroid")>-1||i.indexOf("com.vagaro.customerios")>-1)||setTimeout(function(){SkipTwoFactoFromSignIn()},700)}e?currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignup||currentPage==_twoFactor.PageType.CustomerSignIn||currentPage==_twoFactor.PageType.MultiLocation?(currentPage==_twoFactor.PageType.MultiLocation&&ShowLoader(!1),currentPage,_twoFactor.PageType.CustomerSignup,ShowHideDoneMessage(_twoFactor.SuccessMessage.EmailVerified,GetDisplayMessageTime(_twoFactor.SuccessMessage.EmailVerified))):currentPage!=_twoFactor.PageType.ProfilePage&&currentPage!=_twoFactor.PageType.CovidClean&&currentPage!=_twoFactor.PageType.ShoppingBag||("undefined"!=typeof _common&&null!=_common&&void 0!==_common.PassiveAlertSuccess&&null!=_common.PassiveAlertSuccess&&_common.PassiveAlertSuccess(_twoFactor.SuccessMessage.EmailVerified),"undefined"!=typeof _vgCovidCleanCheckout&&null!=_vgCovidCleanCheckout&&void 0!==_vgCovidCleanCheckout.WarningMessage&&null!=_vgCovidCleanCheckout.WarningMessage&&_vgCovidCleanCheckout.WarningMessage(_twoFactor.SuccessMessage.EmailVerified),currentPage==_twoFactor.PageType.ProfilePage?"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?($("#hdnEmailBeforeChange").val($("#paymentmethods #emailid").val()),_myAccount.SaveVPLUSerDetailProfile()):($("#hdnEmailBeforeChange").val($("#txtEmail").val()),_myAccount.SaveProfile()):currentPage==_twoFactor.PageType.CovidClean?_vgCovidCleanCheckout.SaveVPLUSerDetailProfile():currentPage==_twoFactor.PageType.ShoppingBag&&_onlineCheckout.SaveVPLUSerDetailProfile()):currentPage==_twoFactor.PageType.BusinessSignup||currentPage==_twoFactor.PageType.CustomerSignIn||currentPage==_twoFactor.PageType.MultiLocation?(currentPage==_twoFactor.PageType.MultiLocation&&ShowLoader(!1),currentPage==_twoFactor.PageType.BusinessSignup?(ShowLoader(!0),_twoFactor.SuccessTwoFactor()):ShowHideDoneMessage(_twoFactor.SuccessMessage.PhoneVerified)):currentPage==_twoFactor.PageType.CustomerSignup?ShowHideDoneMessage(_twoFactor.SuccessMessage.PhoneVerified):currentPage!=_twoFactor.PageType.ProfilePage&&currentPage!=_twoFactor.PageType.CovidClean&&currentPage!=_twoFactor.PageType.ShoppingBag||("undefined"!=typeof _common&&null!=_common&&void 0!==_common.PassiveAlertSuccess&&null!=_common.PassiveAlertSuccess&&_common.PassiveAlertSuccess(_twoFactor.SuccessMessage.PhoneVerified),"undefined"!=typeof _vgCovidCleanCheckout&&null!=_vgCovidCleanCheckout&&void 0!==_vgCovidCleanCheckout.WarningMessage&&null!=_vgCovidCleanCheckout.WarningMessage&&_vgCovidCleanCheckout.WarningMessage(_twoFactor.SuccessMessage.PhoneVerified),currentPage==_twoFactor.PageType.ProfilePage?"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?($("#hdnCellNoBeforeChange").val(MyAccountVPLCell.getPhoneData().phoneNo),_myAccount.SaveVPLUSerDetailProfile()):($("#hdnCellNoBeforeChange").val($("#txtCell").val().replace(/([()-\s])+/g,"")),_myAccount.SaveProfile()):currentPage==_twoFactor.PageType.CovidClean?_vgCovidCleanCheckout.SaveVPLUSerDetailProfile():currentPage==_twoFactor.PageType.ShoppingBag&&_onlineCheckout.SaveVPLUSerDetailProfile())},SuccessTwoFactor:function(){if(currentPage==_twoFactor.PageType.BusinessSignup){if(vm.buttonClicked=!0,!isNullOrUndefineOrBlank(vm)&&!isNullOrUndefineOrBlank(vm.SkipTwoFactorStep)){var e=parseInt($("#ddlcountry option:selected").val());localStorage.setItem("CountryId",e),localStorage.setItem("isFromTwoFactor",!0),localStorage.setItem("VarificationType",$("#hdnEmailAndCellAPIValidationSignup").val()),vm.SkipTwoFactorStep()}}else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag)$("#divtwofactorauthentication").modal("hide");else if(currentPage==_twoFactor.PageType.CustomerSignup){var t=$("#iFrameSignUp",parent.document).parents().find("#dvRegHid");t.length>0&&(t.removeClass("phone"),t.removeClass("email"),t.removeClass("success")),$("#hdnIsCheckCapcha").val("0"),$("#btnRegister").click(),$(t).hide(),window.parent.ShowLoadingPanelLogin(!0)}else if(currentPage==_twoFactor.PageType.CustomerSignIn)isNullOrUndefineOrBlank(SkipTwoFactoFromSignIn)||isNullOrUndefineOrBlank(_securelogin.AfterSuccessfullLogin)||SkipTwoFactoFromSignIn();else if(currentPage==_twoFactor.PageType.MultiLocation&&(showLoadingPanel(1),$("#divtwofactorauthentication").css("z-index","0"),$("#divtwofactorauthentication").hide(),$("#hdnIsFromMFA").val("true"),$("#btnAddBusinessInfoContinue").click(),null!=typeof _mlMultiLocation.controls.txtTelephone&&null!=_mlMultiLocation.controls.txtTelephone&&null!=typeof _mlMultiLocation.model.LastVerifiedCell&&null!=_mlMultiLocation.model.LastVerifiedCell)){var i=$(_mlMultiLocation.controls.txtTelephone).val().replace(/([()-\s])+/g,"");2==parseInt(e)&&0==i[0]&&(i=i.substring(1)),_mlMultiLocation.model.LastVerifiedCell=i}},resendcodestartloader:function(){var e=1*$("#hdnAuthCodeExpireTime").val()*60;$("#txtfirstcode").focus(),$("#twostepcountdown").show(),$("#divtwostepcountdown").show(),interval=setInterval(function(){--e<=35&&($("#twostepcountdown").fadeOut(500),$("#twostepcountdown").fadeIn(500),$("#twostepcountdown").css({color:"red"})),d=Number(e);var t=Math.floor(d%3600/60),i=Math.floor(d%3600%60);if(i<10&&(i="0"+i),$("#twostepcountdown").text(t+":"+i),e<=0)return $("#dvCodeError").hide(),$("#dvCodeErrorExpire").hide(),$("#dvCodeErrorTimeOut").show(),clearInterval(interval),void setTimeout(function(){$("#twostepcountdown").hide(),$("#divtwostepcountdown").hide()},500)},1e3)},AllowOnlyNumber:function(e){null!=e&&(thisnumberCtrl=$("#"+e),1==thisnumberCtrl.val().length?"txtsixcode"!=!thisnumberCtrl[0].id&&$(thisnumberCtrl).next(".inputcode").focus():"txtsixcode"==e?($("#txtfivecode").val(""),$("#txtfivecode").focus()):"txtfivecode"==e?($("#txtfourcode").val(""),$("#txtfourcode").focus()):"txtfourcode"==e?($("#txtthirdcode").val(""),$("#txtthirdcode").focus()):"txtthirdcode"==e?($("#txtsecondcode").val(""),$("#txtsecondcode").focus()):"txtsecondcode"==e&&($("#txtfirstcode").val(""),$("#txtfirstcode").focus())),$("#dvCodeError").hide(),$("#dvCodeErrorExpire").hide(),$("#dvCodeErrorTimeOut").hide()},ReSendTowFactorAuthenticationCode:function(e,t){if($(t).addClass("active"),$("#txtEmailCode").removeClass("error"),$("#txtCellCode").removeClass("error"),$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||(e=_twoFactor.AuthCodeReceiveMode.EmailAndCell),currentPage==_twoFactor.PageType.BusinessSignup){ShowLoader(!0);var i={},a={};isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.State=vm.addressData.state,a.City=vm.addressData.city,a.Country=$("#ddlcountry").val(),a.NoofAttempt=vm.NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName=vm.deviceFrom;var r=$("#txtOwnerPhone").val().replace(/([()-\s])+/g,"");if(2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,$("#dvEmailCodeError").html(""),$("#dvEmailCodeError").hide(),$("#dvCellCodeError").html(""),$("#dvCellCodeError").hide(),NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(e),_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoader(!1);_twoFactor.cleartwofactortextboxwithoutfocus(e),i.emailid=$.trim($("#txtEmail").val()),i.phone=$.trim($("#txtOwnerPhone").val().replace(/([()-\s])+/g,"")),i.fullname=$.trim($("#txtFirstName").val())+" "+$.trim($("#txtLastName").val()),i.CountryID=$("#ddlcountry option:selected").val(),i.IP=$("#hdnIPAddress").val(),i.IsEmailPhoneChanges=vm.IsEmailPhoneChanged,i.NoOfLoginAttemptemail=vm.NoOfLoginAttemptemail,i.AuthenticationMode=e,i.IsFromBusinessSignup=!0,i.IsFromCustomerSignup=!0,i.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),i.codetype="resend",i.DialingCode=vm.DialingCode,i.IsTwoFactorSignupLoadData=!0,(n=new vagaro.ajax).datamodel.Token=_twoFactor.ApiURLEnum.AddBusinessTwoFactorAuthentication,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=function(r){void 0!==r&&null!=r&&(r.IsSucess&&(_twoFactor.resendcodestartloader(),_twoFactor.AdaPassiveMessage(_twoFactor.SuccessMessage.ResendCode,e),ShowHideDoneMessage(_twoFactor.SuccessMessage.ResendCode,GetDisplayMessageTime(_twoFactor.SuccessMessage.ResendCode))),NoOfLoginAttempt=r.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=r.TwoFactorRequest,NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()&&(_twoFactor.showErrorDiv(i.AuthenticationMode),PageType==_twoFactor.PageType.BusinessSignup&&_twoFactor.SaveFilterRequestForCardValidate(a))),$(t).removeClass("active"),ShowLoader(!1)},n.datamodel.data=i,n.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage),ShowLoader(!1)},n.Post()}else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag){ShowLoader(!0),i={},a={},isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId);var o="";if(currentPage==_twoFactor.PageType.ProfilePage?"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?(a.UserName=$("#paymentmethods #emailid").val(),a.UserEmail=$("#paymentmethods #emailid").val(),o=MyAccountVPLCell.getPhoneData().phoneNo,a.Country=MyAccountVPLCell.getPhoneData().countryId):(a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),o=$("#txtCell").val().replace(/([()-\s])+/g,""),a.Country=MyAccountMobilePhone.getPhoneData().countryId):currentPage==_twoFactor.PageType.CovidClean?(a.UserName=$("#emailid").val(),a.UserEmail=$("#emailid").val(),o=MyAccountVPLCell.getPhoneData().phoneNo,a.Country=MyAccountVPLCell.getPhoneData().countryId):currentPage==_twoFactor.PageType.ShoppingBag&&(a.UserName=$("#emailid").val(),a.UserEmail=$("#emailid").val(),o=ShoppingBagVPLCell.getPhoneData().phoneNo,a.Country=ShoppingBagVPLCell.getPhoneData().countryId),2==a.Country&&0==o[0]?a.OwnersPhone=o.substring(1):a.OwnersPhone=o,a.State=$("#txtState").val(),a.City=$("#txtCity").val(),a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="",a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,currentPage==_twoFactor.PageType.ProfilePage||(a.UserID=parseInt(UserID)),$("#dvEmailCodeError").html(""),$("#dvEmailCodeError").hide(),$("#dvCellCodeError").html(""),$("#dvCellCodeError").hide(),$("#txtCellCode").removeClass("error"),$("#txtEmailCode").removeClass("error"),NoOfLoginAttempt>=$("#hdnFraudNoOfAttemptCustomer").val())return _twoFactor.showErrorDiv(e),_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoader(!1);_twoFactor.cleartwofactortextboxwithoutfocus(e),currentPage==_twoFactor.PageType.ProfilePage?("undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?(i.emailid=$("#paymentmethods #emailid").val(),i.phone=MyAccountVPLCell.getPhoneData().phoneNo,i.CountryID=MyAccountVPLCell.getPhoneData().countryId):(i.emailid=$.trim($("#txtEmail").val()),i.phone=MyAccountMobilePhone.getPhoneData().phoneNo,i.CountryID=MyAccountMobilePhone.getPhoneData().countryId),i.fullname=$.trim($("#txtFName").val())+" "+$.trim($("#txtLName").val())):currentPage==_twoFactor.PageType.CovidClean?(i.emailid=$("#emailid").val(),i.phone=MyAccountVPLCell.getPhoneData().phoneNo,i.CountryID=MyAccountVPLCell.getPhoneData().countryId,i.fullname=_vgCovidCleanCheckout.model.VplUserDetails.Fullname):currentPage==_twoFactor.PageType.ShoppingBag&&(i.emailid=$("#emailid").val(),i.phone=ShoppingBagVPLCell.getPhoneData().phoneNo,i.CountryID=ShoppingBagVPLCell.getPhoneData().countryId,i.fullname=_onlineCheckout.CustomerDetails.FirstName+" "+_onlineCheckout.CustomerDetails.LastName),i.IP=$("#hdnIPAddress").val(),i.IsEmailPhoneChanges="false",i.NoOfLoginAttemptemail=NoOfLoginAttemptemail,i.AuthenticationMode=e,i.IsFromBusinessSignup=!0,i.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),i.codetype="resend",$("#hdnUserType").length>0&&(i.UserType=$("#hdnUserType").val());var n=new vagaro.ajax;currentPage==_twoFactor.PageType.ShoppingBag?n.datamodel.Token=_twoFactor.ApiURLEnum.TwoFactorAuthenticationCustomer:n.datamodel.Token=_twoFactor.ApiURLEnum.AddBusinessTwoFactorAuthentication,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=function(a){void 0!==a&&null!=a&&(a.IsSucess&&(_twoFactor.resendcodestartloader(),_twoFactor.AdaPassiveMessage(_twoFactor.SuccessMessage.ResendCode,e),"undefined"!=typeof _common&&null!=_common&&void 0!==_common.PassiveAlertSuccess&&null!=_common.PassiveAlertSuccess&&_common.PassiveAlertSuccess(_twoFactor.SuccessMessage.ResendCode),"undefined"!=typeof _vgCovidCleanCheckout&&null!=_vgCovidCleanCheckout&&void 0!==_vgCovidCleanCheckout.WarningMessage&&null!=_vgCovidCleanCheckout.WarningMessage&&_vgCovidCleanCheckout.WarningMessage(_twoFactor.SuccessMessage.ResendCode)),NoOfLoginAttempt=a.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=a.TwoFactorRequest,NoOfLoginAttempt>=$("#hdnFraudNoOfAttemptCustomer").val()&&(_twoFactor.showErrorDiv(i.AuthenticationMode),currentPage==_twoFactor.PageType.ProfilePage?(_twoFactor.BackFromAuth(),_myAccount.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)):currentPage==_twoFactor.PageType.ShoppingBag?($("#divConfirmBox").find(".w-button-default").attr("value","Ok"),_twoFactor.BackFromAuth(),_onlineCheckout.hideConfirmbox()):currentPage==_twoFactor.PageType.CovidClean&&($("#divConfirmBox").find(".w-button-default").attr("value","Ok"),_twoFactor.BackFromAuth(),_vgCovidCleanCheckout.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)))),$(t).removeClass("active"),ShowLoader(!1)},n.datamodel.data=i,n.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage),ShowLoader(!1)},n.Post()}else if(currentPage==_twoFactor.PageType.CustomerSignIn){if(ShowLoader(!0),i={},a={},isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmailInputCode").val(),a.UserEmail=$("#txtEmailInputCode").val(),twoStepPhonedata=twoFactorCellPhone.getPhoneData(),a.CountryID=twoStepPhonedata.countryId,a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="",r=isNullOrUndefineOrBlank($("#txtCellInputCode").val())||$("#txtCellInputCode").val().replace(/([()-\s])+/g,"")==userccattemptdata.PhoneNo?userccattemptdata.PhoneNo:$("#txtCellInputCode").val().replace(/([()-\s])+/g,""),2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,$("#dvEmailCodeError").html(""),$("#dvEmailCodeError").hide(),$("#dvCellCodeError").html(""),$("#dvCellCodeError").hide(),NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(e),_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoader(!1);_twoFactor.cleartwofactortextboxwithoutfocus(e),i.emailid=$.trim($("#txtEmailInputCode").val()),i.phone=twoStepPhonedata.phoneNo,i.CountryID=twoStepPhonedata.countryId,i.DialingCode=twoStepPhonedata.dialingCode,i.fullname=userccattemptdata.FullName,i.IP=$("#hdnIPAddress").val(),i.AuthenticationMode=e,i.IsFromBusinessSignup=!0,i.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),i.codetype="resend",$("#hdnUserType").length>0&&(i.UserType=$("#hdnUserType").val()),i.EmailCellAppSetting=$("#hdnEmailAndCell2FScreen").val(),(n=new vagaro.ajax).datamodel.Token=_twoFactor.ApiURLEnum.TwoFactorAuthenticationCustomer,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=function(r){void 0!==r&&null!=r&&(r.IsSucess&&(_twoFactor.AdaPassiveMessage(_twoFactor.SuccessMessage.ResendCode,e),ShowHideDoneMessage(_twoFactor.SuccessMessage.ResendCode,GetDisplayMessageTime(_twoFactor.SuccessMessage.ResendCode))),NoOfLoginAttempt=r.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=r.TwoFactorRequest,NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()&&(_twoFactor.showErrorDiv(i.AuthenticationMode),_twoFactor.SaveFilterRequestForCardValidate(a))),$(t).removeClass("active"),ShowLoader(!1)},n.datamodel.data=i,n.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage),ShowLoader(!1)},n.Post()}else if(currentPage==_twoFactor.PageType.CustomerSignup){if(ShowLoadingPanelLogin(!0),i={},a={},isNullOrUndefineOrBlank(fpDeviceId)?isNullOrUndefineOrBlank($("#fpId").val())||(a.UserAgent=navigator.userAgent,a.VisitorID=$("#fpId").val()):(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.Country=$("#divCountryCode").attr("data-countryid"),a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="",o=$("#txtCell").val().replace(/([()-\s])+/g,""),2==a.Country&&0==o[0]?a.OwnersPhone=o.substring(1):a.OwnersPhone=o,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.IsBlock=1,$("#dvEmailCodeError").html(""),$("#dvEmailCodeError").hide(),$("#dvCellCodeError").html(""),$("#dvCellCodeError").hide(),NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(e),_twoFactor.SaveFilterRequestForCardValidate(a),void ShowLoadingPanelLogin(!1);_twoFactor.cleartwofactortextboxwithoutfocus(e),i.emailid=$.trim($("#txtEmail").val());var s=custSignupCellPhone.getPhoneData();i.phone=s.phoneNo,i.fullname=$.trim($("#txtFirstname").val())+" "+$.trim($("#txtLastname").val()),i.CountryID=s.countryId,i.IP="",i.IsEmailPhoneChanges=IsEmailPhoneChanged,i.NoOfLoginAttemptemail=NoOfLoginAttemptemail,i.AuthenticationMode=e,i.IsFromBusinessSignup=!0,i.IsFromCustomerSignup=!0,i.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),i.codetype="resend",IsEmailPhoneChanged=!1,(n=new vagaro.ajax).datamodel.Token=_twoFactor.ApiURLEnum.AddBusinessTwoFactorAuthentication,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=function(r){void 0!==r&&null!=r&&(r.IsSucess&&(void 0!==r.WidgetUserID&&null!=r.WidgetUserID&&""!=r.WidgetUserID&&(widgetcookievalue=r.WidgetUserID),_twoFactor.resendcodestartloader(),_twoFactor.AdaPassiveMessage(_twoFactor.SuccessMessage.ResendCode,e),ShowHideDoneMessage(_twoFactor.SuccessMessage.ResendCode,GetDisplayMessageTime(_twoFactor.SuccessMessage.ResendCode))),NoOfLoginAttempt=r.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=r.TwoFactorRequest,NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()&&(_twoFactor.showErrorDiv(i.AuthenticationMode),_twoFactor.SaveFilterRequestForCardValidate(a))),$(t).removeClass("active"),1==i.AuthenticationMode?$("#txtEmailCode").focus():2==i.AuthenticationMode&&$("#txtCellCode").focus(),ShowLoadingPanelLogin(!1)},n.datamodel.data=i,n.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage),ShowLoader(!1)},n.Post()}else currentPage==_twoFactor.PageType.MultiLocation&&(ShowLoader(!0),$("#dvEmailCodeError").html(""),$("#dvEmailCodeError").hide(),$("#dvCellCodeError").html(""),$("#dvCellCodeError").hide(),_twoFactor.cleartwofactortextboxwithoutfocus(e),(n=new vagaro.ajax).datamodel.Token=_twoFactor.ApiURLEnum.AddBusinessTwoFactorAuthentication,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.callback=function(i){void 0!==i&&null!=i&&(i.IsSucess&&(_twoFactor.resendcodestartloader(),_twoFactor.AdaPassiveMessage(_twoFactor.SuccessMessage.ResendCode,e),ShowHideDoneMessage(_twoFactor.SuccessMessage.ResendCode,GetDisplayMessageTime(_twoFactor.SuccessMessage.ResendCode))),NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest),$(t).removeClass("active"),ShowLoader(!1)},n.datamodel.data=twoStepEmail,n.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage),ShowLoader(!1)},n.Post())},cleartwofactortextbox:function(e){e==_twoFactor.AuthCodeReceiveMode.Email||e==_twoFactor.AuthCodeReceiveMode.EmailAndCell?$("#txtEmailCode").val("").focus():$("#txtCellCode").val("").focus()},cleartwofactortextboxwithoutfocus:function(e){e==_twoFactor.AuthCodeReceiveMode.Email||e==_twoFactor.AuthCodeReceiveMode.EmailAndCell?$("#txtEmailCode").val(""):$("#txtCellCode").val("")},disabletwofactortextbox:function(e){$(e).attr("disabled","disabled");var t=5;interval=setInterval(function(){if(--t<=0){var e=$("#spnCountryPhoneNo").text();currentPage==_twoFactor.PageType.CustomerSignup?($("#divConfirmBox").find(".w-button-default").attr("value","Cancel"),e=$("#spnCountryPhoneNo").text(),showConfirmbox(_twoFactor.FailOTPMessage(e),vm.OnBlockConfirm,"Error Code: XJ140",!1,!0)):currentPage==_twoFactor.PageType.BusinessSignup&&vm.showConfirmbox(_twoFactor.FailOTPMessage(e),vm.OnBlockConfirm,"Error Code: XJ140",!1,!0)}},3e3)},VerifyEmailCode:function(){try{void 0!==vm.SignupStepsClicklog&&"function"==typeof vm.SignupStepsClicklog&&currentPage==_twoFactor.PageType.BusinessSignup&&vm.SignupStepsClicklog(1.1)}catch(e){}if(void 0===$("#txtEmailCode").val()||""==$("#txtEmailCode").val())return $("#dvEmailCodeError").show(),$("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").text("Please enter verification code."),$("#txtEmailCode").focus(),!1;if($("#txtEmailCode").val().length<=5)return $("#dvEmailCodeError").show(),$("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").text("Invalid code, try again."),!1;if(currentPage==_twoFactor.PageType.BusinessSignup){vm.buttonClicked=!0,$("#dvEmailCodeError").hide();var e="Unknown",t={};if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){_twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Email);var i=$("#spnCountryPhoneNo").text();return void vm.showConfirmbox(_twoFactor.FailOTPMessage(i),vm.OnBlockConfirm,"Error Code: XJ140",!1,!0)}if(t.Code=$("#txtEmailCode").val(),""!=t.Code){ShowLoader(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux");var a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2);t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,parseInt($("#ddlcountry option:selected").val()),$("#hdnEmailAndCellAPIValidationSignup").val()==_twoFactor.VarificationType.Email&&$("#hdnEmailAndCell2FScreen").val(_twoFactor.EmailAndCell2FScreen.EmailOrPhone),t.AuthenticationMode=$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailOrPhone||$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew?_twoFactor.AuthCodeReceiveMode.EmailAndCell:_twoFactor.AuthCodeReceiveMode.Email,t.IsFromBusinessSignup=!0,t.IsSignupLoadData=!0,_twoFactor.verifytwostepAuthenticationCode(t,t.AuthenticationMode)}}else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag){if($("#dvEmailCodeError").hide(),e="Unknown",t={},NoOfLoginAttempt>=$("#hdnFraudNoOfAttemptCustomer").val())return _twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Email),void(currentPage==_twoFactor.PageType.ProfilePage?(_twoFactor.BackFromAuth(),_myAccount.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)):currentPage==_twoFactor.PageType.ShoppingBag?(_twoFactor.BackFromAuth(),_onlineCheckout.hideConfirmbox()):currentPage==_twoFactor.PageType.CovidClean&&(_twoFactor.BackFromAuth(),$("#divConfirmBox").find(".w-button-default").attr("value","Ok"),_vgCovidCleanCheckout.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)));if(t.Code=$("#txtEmailCode").val(),""!=t.Code){ShowLoader(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Email,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,t.AuthenticationMode)}}else if(currentPage==_twoFactor.PageType.CustomerSignup){if(buttonClicked=!0,$("#dvEmailCodeError").hide(),e="Unknown",t={},NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Email),void(PageType==_twoFactor.PageType.BusinessSignup&&(i=$("#spnCountryPhoneNo").text()));if(t.Code=$("#txtEmailCode").val(),""!=t.Code){ShowLoadingPanelLogin(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailOrPhone?_twoFactor.AuthCodeReceiveMode.EmailAndCell:_twoFactor.AuthCodeReceiveMode.Email,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,t.AuthenticationMode)}}else if(currentPage==_twoFactor.PageType.CustomerSignIn){if($("#dvEmailCodeError").hide(),e="Unknown",t={},NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Email),void bootbox.alert({className:"vagaro-midium-popup",message:_twoFactor.FailOTPMessage(),title:"Error Code: XJ140"});if(t.Code=$("#txtEmailCode").val(),""!=t.Code){ShowLoadingPanelLogin(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Email,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,t.AuthenticationMode)}}else if(currentPage==_twoFactor.PageType.MultiLocation&&($("#dvEmailCodeError").hide(),e="Unknown",(t={}).Code=$("#txtEmailCode").val(),""!=t.Code)){ShowLoader(!0);try{var r;-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailOrPhone?_twoFactor.AuthCodeReceiveMode.EmailAndCell:_twoFactor.AuthCodeReceiveMode.Email,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,t.AuthenticationMode)}},VerifyCellCode:function(){try{void 0!==vm.SignupStepsClicklog&&"function"==typeof vm.SignupStepsClicklog&&currentPage==_twoFactor.PageType.BusinessSignup&&vm.SignupStepsClicklog(1.2)}catch(e){}if(void 0===$("#txtCellCode").val()||""==$("#txtCellCode").val())return $("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Please enter verification code."),$("#dvCellCodeError").focus(),!1;if($("#txtCellCode").val().length<=5)$("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Invalid code, try again.");else if(currentPage==_twoFactor.PageType.BusinessSignup){vm.buttonClicked=!0,vm.buttonClicked=!0,$("#dvCellCodeError").hide();var e="Unknown",t={};if(NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){_twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Cell);var i=$("#spnCountryPhoneNo").text();return void vm.showConfirmbox(_twoFactor.FailOTPMessage(i),vm.OnBlockConfirm,"Error Code: XJ140",!1,!0)}if(t.Code=$("#txtCellCode").val(),""!=t.Code){ShowLoader(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux");var a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2);t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,t.IsFromBusinessSignup=!0,t.IsSignupLoadData=!0,_twoFactor.verifytwostepAuthenticationCode(t,_twoFactor.AuthCodeReceiveMode.Cell)}}else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag){if(void 0===$("#txtCellCode").val()||""==$("#txtCellCode").val()||$("#txtCellCode").val().length<=5)return $("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),"undefined"==$("#txtCellCode").val()||""==$("#txtCellCode").val()?($("#dvCellCodeError").text("Please enter verification code."),$("#txtCellCode").focus()):$("#dvCellCodeError").text("Invalid code, try again."),!1;if($("#dvCellCodeError").hide(),e="Unknown",t={},NoOfLoginAttempt>=$("#hdnFraudNoOfAttemptCustomer").val())return _twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Cell),void(currentPage==_twoFactor.PageType.ProfilePage?(_twoFactor.BackFromAuth(),_myAccount.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)):currentPage==_twoFactor.PageType.ShoppingBag?(_twoFactor.BackFromAuth(),_onlineCheckout.hideConfirmbox()):currentPage==_twoFactor.PageType.CovidClean&&(_twoFactor.BackFromAuth(),$("#divConfirmBox").find(".w-button-default").attr("value","Ok"),_vgCovidCleanCheckout.showConfirmbox(_twoFactor.FailOTPMessage(),"","Error Code: XJ140",!1,!1)));if(t.Code=$("#txtCellCode").val(),""!=t.Code){ShowLoader(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,_twoFactor.AuthCodeReceiveMode.Cell)}}else if(currentPage==_twoFactor.PageType.CustomerSignup){if(buttonClicked=!0,$("#dvCellCodeError").hide(),e="Unknown",t={},NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Cell),$("#divConfirmBox").find(".w-button-default").attr("value","Cancel"),i=$("#spnCountryPhoneNo").text(),void showConfirmbox(_twoFactor.FailOTPMessage(i),OnBlockConfirm,"Error Code: XJ140",!1,!0);if(t.Code=$("#txtCellCode").val(),""!=t.Code){ShowLoadingPanelLogin(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,_twoFactor.AuthCodeReceiveMode.Cell)}}else if(currentPage==_twoFactor.PageType.CustomerSignIn){if($("#dvCellCodeError").hide(),e="Unknown",t={},NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Cell),void vagaro.alertsmall({message:_twoFactor.FailOTPMessage(),title:"Error Code: XJ140"});if(t.Code=$("#txtCellCode").val(),""!=t.Code){ShowLoader(!0);try{-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,_twoFactor.AuthCodeReceiveMode.Cell)}}else if(currentPage==_twoFactor.PageType.MultiLocation&&($("#dvCellCodeError").hide(),e="Unknown",(t={}).Code=$("#txtCellCode").val(),""!=t.Code)){ShowLoader(!0);try{var r;-1!=navigator.appVersion.indexOf("Win")?e="Windows":-1!=navigator.appVersion.indexOf("Mac")?e="Mac/iOS":-1!=navigator.appVersion.indexOf("X11")?e="UNIX":-1!=navigator.appVersion.indexOf("Linux")&&(e="Linux"),a=(r=new Date).getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+r.getDate()).slice(-2)+" "+("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2)+":"+("0"+r.getSeconds()).slice(-2),t.OSName=e,t.clientDate=a}catch(i){t.operatingSystem=e,t.clientDate=""}t.NoOfLoginAttempt=NoOfLoginAttempt++,t.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,t.IsFromBusinessSignup=!0,_twoFactor.verifytwostepAuthenticationCode(t,_twoFactor.AuthCodeReceiveMode.Cell)}},verifytwostepAuthenticationCode:function(e,t){if(e.isFromCookieLessWidget=_twoFactor.IsFromCookieLessWidget(),currentPage==_twoFactor.PageType.BusinessSignup)(i=new vagaro.ajax).datamodel.Token="websiteapi/homepage/verifytwofactorauthentication",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=e,i.datamodel.callback=function(e){if(void 0!==e&&null!=e){var i=e;NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest;var a={};isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.State=vm.addressData.state,a.City=vm.addressData.city,a.Country=$("#ddlcountry").val(),a.NoofAttempt=vm.NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName=vm.deviceFrom;var r=$("#txtOwnerPhone").val().replace(/([()-\s])+/g,"");if(2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),ShowLoader(!1),NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(t),sessionStorage.clear(),a.IsBlock=1,void _twoFactor.SaveFilterRequestForCardValidate(a);if("Valid"==i.Verifyresponce||"EmailValid"==i.Verifyresponce||"CellValid"==i.Verifyresponce){if(currentPage==_twoFactor.PageType.BusinessSignup&&($("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Cell&&i.VarificationType==_twoFactor.VarificationType.Email?(a.IsEmailPhoneVerified=_twoFactor.VarificationType.EmailAndCell,$("#hdnTwoFactorVerified").val(_twoFactor.VarificationType.EmailAndCell)):($("#hdnTwoFactorVerified").val(i.VarificationType),a.IsEmailPhoneVerified=i.VarificationType),_twoFactor.SaveFilterRequestForCardValidate(a),$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailAndPhone?t==_twoFactor.AuthCodeReceiveMode.Email&&$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Email?(twoStepEmail={},twoStepEmail.emailid=$.trim($("#txtEmail").val()),twoStepEmail.phone=$.trim($("#txtOwnerPhone").val().replace(/([()-\s])+/g,"")),twoStepEmail.formattedPhone=$("#txtOwnerPhone").val(),twoStepEmail.fullname=$.trim($("#txtFirstName").val())+" "+$.trim($("#txtLastName").val()),twoStepEmail.CountryID=$("#ddlcountry option:selected").val(),twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.IsEmailPhoneChanges=vm.IsEmailPhoneChanged,twoStepEmail.NoOfLoginAttemptemail=vm.NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,twoStepEmail.IsFromBusinessSignup=!0,twoStepEmail.DialingCode=vm.DialingCode,_twoFactor.EmailCodeSuccess(twoStepEmail,!0)):$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess()):$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Email&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):(parseInt($("#ddlcountry option:selected").val()),_twoFactor.CellCodeSuccess(!1))),i.VarificationType==_twoFactor.VarificationType.Cell||i.VarificationType==_twoFactor.VarificationType.EmailAndCell)){var o={step:1,isNextClick:1},n=new vagaro.ajax;n.datamodel.Token=_twoFactor.ApiURLEnum.GetLogDataonBackClick,n.datamodel.IsNewVagaroAPI=!0,n.datamodel.data=o,n.datamodel.callback=function(e){},n.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},n.Post()}}else"Invalid"==i.Verifyresponce?(t==_twoFactor.AuthCodeReceiveMode.Email||t==_twoFactor.AuthCodeReceiveMode.EmailAndCell?($("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("Invalid code, try again.")):($("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Invalid code, try again.")),_twoFactor.cleartwofactortextbox(t)):"Expired"==i.Verifyresponce&&(t==_twoFactor.AuthCodeReceiveMode.Email?($("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("This code is expired, please resend code.")):($("#dvCellCodeError").show(),$("#dvCellCodeError").text("This code is expired, please resend code.")),_twoFactor.cleartwofactortextbox(t))}},i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post();else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag)(i=new vagaro.ajax).datamodel.Token="websiteapi/homepage/verifytwofactorauthentication",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=e,i.datamodel.callback=function(e){if(void 0!==e&&null!=e){var i=e;NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest;var a={};isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId);var r="";if(currentPage==_twoFactor.PageType.ProfilePage?"undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?(a.UserName=$("#paymentmethods #emailid").val(),a.UserEmail=$("#paymentmethods #emailid").val(),r=MyAccountVPLCell.getPhoneData().phoneNo,a.Country=MyAccountVPLCell.getPhoneData().countryId):(a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),r=$("#txtCell").val().replace(/([()-\s])+/g,""),a.Country=MyAccountMobilePhone.getPhoneData().countryId):currentPage==_twoFactor.PageType.CovidClean?(a.UserName=$("#emailid").val(),a.UserEmail=$("#emailid").val(),r=MyAccountVPLCell.getPhoneData().phoneNo,a.Country=MyAccountVPLCell.getPhoneData().countryId):currentPage==_twoFactor.PageType.ShoppingBag&&(a.UserName=$("#emailid").val(),a.UserEmail=$("#emailid").val(),r=ShoppingBagVPLCell.getPhoneData().phoneNo,a.Country=ShoppingBagVPLCell.getPhoneData().countryId),2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.State=$("#txtState").val(),a.City=$("#txtCity").val(),a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="",a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),currentPage==_twoFactor.PageType.ProfilePage||(a.UserID=parseInt(UserID)),ShowLoader(!1),NoOfLoginAttempt>=$("#hdnFraudNoOfAttemptCustomer").val())return _twoFactor.showErrorDiv(t),sessionStorage.clear(),a.IsBlock=1,void _twoFactor.SaveFilterRequestForCardValidate(a);"Valid"==i.Verifyresponce||"EmailValid"==i.Verifyresponce||"CellValid"==i.Verifyresponce?($("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Cell&&i.VarificationType==_twoFactor.VarificationType.Email?(a.IsEmailPhoneVerified=_twoFactor.VarificationType.EmailAndCell,$("#hdnTwoFactorVerified").val(_twoFactor.VarificationType.EmailAndCell)):($("#hdnTwoFactorVerified").val(i.VarificationType),a.IsEmailPhoneVerified=i.VarificationType),_twoFactor.SaveFilterRequestForCardValidate(a),t==_twoFactor.AuthCodeReceiveMode.Email&&$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Email&&1==IsEmailPhoneChanged?(twoStepEmail={},currentPage==_twoFactor.PageType.ProfilePage?("undefined"!=typeof TwoFactorPageType&&null!=TwoFactorPageType&&""!=TwoFactorPageType&&TwoFactorPageType==_twoFactor.PageType.PaymentMethods?(twoStepEmail.emailid=$("#paymentmethods #emailid").val(),twoStepEmail.phone=MyAccountVPLCell.getPhoneData().phoneNo,twoStepEmail.CountryID=MyAccountVPLCell.getPhoneData().countryId,twoStepEmail.formattedPhone=MyAccountVPLCell.getphoneformat(MyAccountVPLCell.getPhoneData().phoneNo,MyAccountVPLCell.getPhoneData().countryId)):(twoStepEmail.emailid=$.trim($("#txtEmail").val()),twoStepEmail.phone=MyAccountMobilePhone.getPhoneData().phoneNo,twoStepEmail.CountryID=MyAccountMobilePhone.getPhoneData().countryId,twoStepEmail.formattedPhone=MyAccountMobilePhone.getphoneformat(MyAccountMobilePhone.getPhoneData().phoneNo,MyAccountMobilePhone.getPhoneData().countryId)),twoStepEmail.fullname=$.trim($("#txtFName").val())+" "+$.trim($("#txtLName").val())):currentPage==_twoFactor.PageType.CovidClean?(twoStepEmail.emailid=$("#emailid").val(),twoStepEmail.phone=MyAccountVPLCell.getPhoneData().phoneNo,twoStepEmail.CountryID=MyAccountVPLCell.getPhoneData().countryId,twoStepEmail.fullname=_vgCovidCleanCheckout.model.VplUserDetails.Fullname,twoStepEmail.formattedPhone=MyAccountVPLCell.getphoneformat(MyAccountVPLCell.getPhoneData().phoneNo,MyAccountVPLCell.getPhoneData().countryId)):currentPage==_twoFactor.PageType.ShoppingBag&&(twoStepEmail.emailid=$("#emailid").val(),twoStepEmail.phone=ShoppingBagVPLCell.getPhoneData().phoneNo,twoStepEmail.CountryID=ShoppingBagVPLCell.getPhoneData().countryId,twoStepEmail.fullname=_onlineCheckout.CustomerDetails.FirstName+" "+_onlineCheckout.CustomerDetails.LastName,twoStepEmail.formattedPhone=ShoppingBagVPLCell.getphoneformat(ShoppingBagVPLCell.getPhoneData().phoneNo,ShoppingBagVPLCell.getPhoneData().countryId)),twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.IsEmailPhoneChanges=IsEmailPhoneChanged,twoStepEmail.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,twoStepEmail.IsFromBusinessSignup=!0,_twoFactor.EmailCodeSuccess(twoStepEmail,!0),IsEmailPhoneChanged):$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Email&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess())):"Invalid"==i.Verifyresponce?(t==_twoFactor.AuthCodeReceiveMode.Email||t==_twoFactor.AuthCodeReceiveMode.EmailAndCell?($("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("Invalid code, try again.")):($("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Invalid code, try again.")),_twoFactor.cleartwofactortextbox(t)):"Expired"==i.Verifyresponce&&(t==_twoFactor.AuthCodeReceiveMode.Email?($("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("This code is expired, please resend code.")):($("#dvCellCodeError").show(),$("#dvCellCodeError").text("This code is expired, please resend code.")),_twoFactor.cleartwofactortextbox(t))}},i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post();else if(currentPage==_twoFactor.PageType.CustomerSignup)(i=new vagaro.ajax).datamodel.Token="websiteapi/homepage/verifytwofactorauthentication",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=e,i.datamodel.callback=function(e){if(void 0!==e){var i=e;NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest;var a={};isNullOrUndefineOrBlank(fpDeviceId)?isNullOrUndefineOrBlank($("#fpId").val())||(a.UserAgent=navigator.userAgent,a.VisitorID=$("#fpId").val()):(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=$("#txtEmail").val(),a.UserEmail=$("#txtEmail").val(),a.Country=$("#divCountryCode").attr("data-countryId"),a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="",a.IsPolicyAck=_twoFactor.Model.IsPolicyAck;var r=$("#txtCell").val().replace(/([()-\s])+/g,"");if(2==a.Country&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),ShowLoadingPanelLogin(!1),NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val()){sessionStorage.clear(),a.IsBlock=1,$("#hdnIsBlocked").val(1),IsBlocked=!0,_twoFactor.showErrorDiv(_twoFactor.AuthCodeReceiveMode.Cell),_twoFactor.SaveFilterRequestForCardValidate(a),$("#divConfirmBox").find(".w-button-default").attr("value","Cancel");var o=$("#spnCountryPhoneNo").text();return void showConfirmbox(_twoFactor.FailOTPMessage(o),OnBlockConfirm,"Error Code: XJ140",!1,!0)}if("Valid"==i.Verifyresponce||"EmailValid"==i.Verifyresponce||"CellValid"==i.Verifyresponce)if($("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Cell&&i.VarificationType==_twoFactor.VarificationType.Email?(a.IsEmailPhoneVerified=_twoFactor.VarificationType.EmailAndCell,$("#hdnTwoFactorVerified").val(_twoFactor.VarificationType.EmailAndCell)):($("#hdnTwoFactorVerified").val(i.VarificationType),a.IsEmailPhoneVerified=i.VarificationType),_twoFactor.SaveFilterRequestForCardValidate(a),$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailAndPhone)if(t==_twoFactor.AuthCodeReceiveMode.Email&&$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Email){var n=custSignupCellPhone.getPhoneData();twoStepEmail={},twoStepEmail.emailid=$.trim($("#txtEmail").val()),twoStepEmail.phone=n.phoneNo,twoStepEmail.formattedPhone=$("#txtCell").val(),twoStepEmail.fullname=$.trim($("#txtFirstname").val())+" "+$.trim($("#txtLastname").val()),twoStepEmail.CountryID=n.countryId,twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.IsEmailPhoneChanges=IsEmailPhoneChanged,twoStepEmail.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,twoStepEmail.IsFromBusinessSignup=!0,twoStepEmail.IsFromCustomerSignup=!0,_twoFactor.EmailCodeSuccess(twoStepEmail,!0)}else $("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess());else $("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Email&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess());else"Invalid"==i.Verifyresponce?(t==_twoFactor.AuthCodeReceiveMode.Email||t==_twoFactor.AuthCodeReceiveMode.EmailAndCell?($("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("Invalid code, try again.")):($("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Invalid code, try again.")),_twoFactor.cleartwofactortextbox(t)):"Expired"==i.Verifyresponce&&(t==_twoFactor.AuthCodeReceiveMode.Email?($("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("This code is expired, please resend code.")):($("#dvCellCodeError").show(),$("#dvCellCodeError").text("This code is expired, please resend code.")),_twoFactor.cleartwofactortextbox(t))}ShowLoadingPanelLogin(!1)},i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post();else if(currentPage==_twoFactor.PageType.CustomerSignIn)(i=new vagaro.ajax).datamodel.Token="websiteapi/homepage/verifytwofactorauthentication",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=e,i.datamodel.callback=function(e){if(void 0!==e&&null!=e){var i=e;NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest;var a={};isNullOrUndefineOrBlank(fpDeviceId)||(a.UserAgent=navigator.userAgent,a.VisitorID=fpDeviceId),a.UserName=isNullOrUndefineOrBlank($("#txtEmailInputCode").val())||$("#txtEmailInputCode").val()==userccattemptdata.EmailId?userccattemptdata.EmailId:$("#txtEmailInputCode").val(),a.UserEmail=isNullOrUndefineOrBlank($("#txtEmailInputCode").val())||$("#txtEmailInputCode").val()==userccattemptdata.EmailId?userccattemptdata.EmailId:$("#txtEmailInputCode").val(),a.NoofAttempt=NoOfLoginAttemptemail,a.IP=$("#hdnIPAddress").val(),a.DeviceFullName="";var r=isNullOrUndefineOrBlank($("#txtCellInputCode").val())||$("#txtCellInputCode").val().replace(/([()-\s])+/g,"")==userccattemptdata.PhoneNo?userccattemptdata.PhoneNo:$("#txtCellInputCode").val().replace(/([()-\s])+/g,"");if(2==("5"==$("#selectedCountrydiv").attr("data-countryid")?"2":$("#selectedCountrydiv").attr("data-countryid"))&&0==r[0]?a.OwnersPhone=r.substring(1):a.OwnersPhone=r,a.IsEmailPhoneVerified=$("#hdnTwoFactorVerified").val(),a.UserId=userccattemptdata.UserID,NoOfLoginAttempt>=$("#hdnFraudNoOfAttempt").val())return _twoFactor.showErrorDiv(t),sessionStorage.clear(),a.IsBlock=1,void _twoFactor.SaveFilterRequestForCardValidate(a);if(ShowLoadingPanelLogin(!1),"Valid"==i.Verifyresponce){$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Cell&&i.VarificationType==_twoFactor.VarificationType.Email?(a.IsEmailPhoneVerified=_twoFactor.VarificationType.EmailAndCell,$("#hdnTwoFactorVerified").val(_twoFactor.VarificationType.EmailAndCell)):($("#hdnTwoFactorVerified").val(i.VarificationType),a.IsEmailPhoneVerified=i.VarificationType),_twoFactor.SaveFilterRequestForCardValidate(a);var o=0==isNullOrUndefineOrBlank($("#txtEmailInputCode").val())&&userccattemptdata.EmailId!=$("#txtEmailInputCode").val(),n=0==isNullOrUndefineOrBlank($("#txtCellInputCode").val().replace(/([()-\s])+/g,""))&&userccattemptdata.PhoneNo!=$("#txtCellInputCode").val().replace(/([()-\s])+/g,"");if(o||n){vgSaveUserProfiledata={},vgSaveUserProfiledata.UserID=userccattemptdata.UserID,vgSaveUserProfiledata.EmailID=o?$.trim($("#txtEmailInputCode").val()):userccattemptdata.EmailId;var s=n?$.trim($("#txtCellInputCode").val().replace(/([()-\s])+/g,"")):userccattemptdata.PhoneNo.replace(/([()-\s])+/g,"");2==("5"==$("#selectedCountrydiv").attr("data-countryid")?"2":$("#selectedCountrydiv").attr("data-countryid"))&&0==s[0]?vgSaveUserProfiledata.Cell=s.substring(1):vgSaveUserProfiledata.Cell=s;var l=new vagaro.ajax;l.datamodel.Token="websiteapi/homepage/saveuseremailphonefortwofactor",l.datamodel.data=vgSaveUserProfiledata,l.datamodel.IsNewVagaroAPI=!0,l.datamodel.callback=function(e){null!=e&&e?$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailAndPhone||!isNullOrUndefineOrBlank(userccattemptdata.IsTwoStepForSP)&&userccattemptdata.IsTwoStepForSP?t==_twoFactor.AuthCodeReceiveMode.Email&&$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Email?(twoStepEmail={},twoStepEmail.emailid=isNullOrUndefineOrBlank($("#txtEmailInputCode").val())||$("#txtEmailInputCode").val()==userccattemptdata.EmailId?userccattemptdata.EmailId:$("#txtEmailInputCode").val(),twoStepEmail.phone=isNullOrUndefineOrBlank($("#txtCellInputCode").val())||$("#txtCellInputCode").val().replace(/([()-\s])+/g,"")==userccattemptdata.PhoneNo?userccattemptdata.PhoneNo:$("#txtCellInputCode").val().replace(/([()-\s])+/g,""),twoStepEmail.formattedPhone=isNullOrUndefineOrBlank($("#txtCellInputCode").val())||$("#txtCellInputCode").val().replace(/([()-\s])+/g,"")==userccattemptdata.PhoneNo?userccattemptdata.PhoneNo:$("#txtCellInputCode").val().replace(/([()-\s])+/g,""),twoStepEmail.fullname=userccattemptdata.FullName,twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,twoStepEmail.IsFromBusinessSignup=!0,_twoFactor.EmailCodeSuccess(twoStepEmail,!0)):$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.Model.IsPolicyAck?TwoStepAuth.init("privacypolicy",void 0,void 0,void 0,void 0,void 0,void 0,void 0,_twoFactor.Model.IsPolicyAck,_twoFactor.Model.UserType,_twoFactor.Model.UserID):_twoFactor.CellCodeSuccess(!0):_twoFactor.Model.IsPolicyAck?TwoStepAuth.init("privacypolicy",void 0,void 0,void 0,void 0,void 0,void 0,void 0,_twoFactor.Model.IsPolicyAck,_twoFactor.Model.UserType,_twoFactor.Model.UserID):_twoFactor.CellCodeSuccess()):$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Email&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess()):vagaro.alert(_twoFactor.ValidationMessages.FailedUserSaveMsg)},l.datamodel.Error=function(e){ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},l.Post()}else $("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailAndPhone||!isNullOrUndefineOrBlank(userccattemptdata.IsTwoStepForSP)&&userccattemptdata.IsTwoStepForSP?t==_twoFactor.AuthCodeReceiveMode.Email&&$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Email?(twoStepEmail={},twoStepEmail.emailid=isNullOrUndefineOrBlank($("#txtEmailInputCode").val())||$("#txtEmailInputCode").val()==userccattemptdata.EmailId?userccattemptdata.EmailId:$("#txtEmailInputCode").val(),twoStepEmail.phone=isNullOrUndefineOrBlank($("#txtCellInputCode").val())||$("#txtCellInputCode").val().replace(/([()-\s])+/g,"")==userccattemptdata.PhoneNo?userccattemptdata.PhoneNo:$("#txtCellInputCode").val().replace(/([()-\s])+/g,""),twoStepEmail.formattedPhone=isNullOrUndefineOrBlank($("#txtCellInputCode").val())||$("#txtCellInputCode").val().replace(/([()-\s])+/g,"")==userccattemptdata.PhoneNo?userccattemptdata.PhoneNo:$("#txtCellInputCode").val().replace(/([()-\s])+/g,""),twoStepEmail.fullname=userccattemptdata.FullName,twoStepEmail.CountryID=userccattemptdata.CountryID,twoStepEmail.IP=$("#hdnIPAddress").val(),twoStepEmail.NoOfLoginAttemptemail=NoOfLoginAttemptemail,twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,twoStepEmail.IsFromBusinessSignup=!0,_twoFactor.EmailCodeSuccess(twoStepEmail,!0)):$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email?_twoFactor.Model.IsPolicyAck?TwoStepAuth.init("privacypolicy",void 0,void 0,void 0,void 0,void 0,void 0,void 0,_twoFactor.Model.IsPolicyAck,_twoFactor.Model.UserType,_twoFactor.Model.UserID):_twoFactor.CellCodeSuccess(!0):_twoFactor.Model.IsPolicyAck?TwoStepAuth.init("privacypolicy",void 0,void 0,void 0,void 0,void 0,void 0,void 0,_twoFactor.Model.IsPolicyAck,_twoFactor.Model.UserType,_twoFactor.Model.UserID):_twoFactor.CellCodeSuccess()):$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Email&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(_twoFactor.AuthCodeReceiveMode.Email,_twoFactor.Model.IsPolicyAck?TwoStepAuth.init("privacypolicy",void 0,void 0,void 0,void 0,void 0,void 0,void 0,_twoFactor.Model.IsPolicyAck,_twoFactor.Model.UserType,_twoFactor.Model.UserID):_twoFactor.CellCodeSuccess())}else"Invalid"!=i.Verifyresponce&&"Expired"!=i.Verifyresponce||("Invalid"==i.Verifyresponce?t==_twoFactor.AuthCodeReceiveMode.Email?($("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("Invalid code, try again.")):($("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Invalid code, try again.")):"Expired"==i.Verifyresponce&&(t==_twoFactor.AuthCodeReceiveMode.Email?($("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("This code is expired, please resend code.")):($("#dvCellCodeError").show(),$("#dvCellCodeError").text("This code is expired, please resend code."))),t==_twoFactor.AuthCodeReceiveMode.Email||t==_twoFactor.EmailAndCell2FScreen.EmailOrPhone||t==_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew?$("#txtEmailCode").focus():$("#txtCellCode").focus())}},i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post();else if(currentPage==_twoFactor.PageType.MultiLocation){var i;(i=new vagaro.ajax).datamodel.Token="websiteapi/homepage/verifytwofactorauthentication",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.data=e,i.datamodel.callback=function(e){if(void 0!==e&&null!=e){var i=e;NoOfLoginAttempt=i.TwoFactorVerifyAttempt,NoOfLoginAttemptemail=i.TwoFactorRequest,"Valid"==i.Verifyresponce||"EmailValid"==i.Verifyresponce||"CellValid"==i.Verifyresponce?($("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Cell&&i.VarificationType==_twoFactor.VarificationType.Email?$("#hdnTwoFactorVerified").val(_twoFactor.VarificationType.EmailAndCell):$("#hdnTwoFactorVerified").val(i.VarificationType),$("#hdnEmailAndCell2FScreen").val()==_twoFactor.EmailAndCell2FScreen.EmailAndPhone?t==_twoFactor.AuthCodeReceiveMode.Email&&$("#hdnTwoFactorVerified").val()==_twoFactor.VarificationType.Email?(twoStepEmail.AuthenticationMode=_twoFactor.AuthCodeReceiveMode.Cell,_twoFactor.EmailCodeSuccess(twoStepEmail,!0)):$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess()):$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhone&&$("#hdnEmailAndCell2FScreen").val()!=_twoFactor.EmailAndCell2FScreen.EmailOrPhoneNew||$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Email&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.Cell&&$("#hdnTwoFactorVerified").val()!=_twoFactor.VarificationType.EmailAndCell||(t==_twoFactor.AuthCodeReceiveMode.Email||"EmailValid"==i.Verifyresponce?_twoFactor.CellCodeSuccess(!0):_twoFactor.CellCodeSuccess())):"Invalid"==i.Verifyresponce?(t==_twoFactor.AuthCodeReceiveMode.Email||t==_twoFactor.AuthCodeReceiveMode.EmailAndCell?($("#txtEmailCode").addClass("error"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("Invalid code, try again.")):($("#txtCellCode").addClass("error"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("Invalid code, try again.")),ShowLoader(!1),_twoFactor.cleartwofactortextbox(t)):"Expired"==i.Verifyresponce&&(t==_twoFactor.AuthCodeReceiveMode.Email?($("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("This code is expired, please resend code.")):($("#dvCellCodeError").show(),$("#dvCellCodeError").text("This code is expired, please resend code.")),ShowLoader(!1),_twoFactor.cleartwofactortextbox(t))}},i.datamodel.Error=function(){ShowLoader(!1),vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()}},resetTimer:function(){var e=1*$("#hdnAuthCodeExpireTime").val()*60;if(e>0){d=Number(e);var t=Math.floor(d%3600/60),i=Math.floor(d%3600%60);i<10&&(i="0"+i),$("#twostepcountdown").text(t+":"+i)}},SaveFilterRequestForCardValidate:function(e,t=""){if(currentPage==_twoFactor.PageType.BusinessSignup)ShowLoader(!0),e.IsFromSignup=!0,(i=new vagaro.ajax).datamodel.Token="addbusiness/savefilterrequestforcardvalidate",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(i){if(null!=i&&(ShowLoader(!1),currentPage==_twoFactor.PageType.BusinessSignup)){if(i.Step=e.Step,vm.userccattemptdata=i,!isNullOrUndefineOrBlank(vm.userccattemptdata)&&(vm.userccattemptdata.IsBlock||vm.userccattemptdata.NoOfAttempt>=10)){var a=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/signup-1";window.setTimeout(function(){window.location.href=a},4300)}""!=t&&3==vm.userccattemptdata.Step&&(ShowLoader(!1),swal({title:t,text:"",type:"error",showCancelButton:!1,closeOnConfirm:!0,confirmButtonText:"OK",html:!0},function(e){"true"==$("#hdnIsShowBusinessCaptcha").val()&&0==isNullOrUndefineOrBlank(vm.userccattemptdata)&&vm.userccattemptdata.NoOfAttempt>=3?($("#zs_paymentframe").html(""),$("#zs_paymentframe").hide(),vm.ShowCustomCaptcha(),ShowLoader(!1)):vm.LoadCCFrame()}))}},i.datamodel.data=e,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post();else if(currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag){ShowLoader(!0);var i=new vagaro.ajax;currentPage==_twoFactor.PageType.ProfilePage?i.datamodel.Token=ApiURLEnumMyAccount.SaveFilterRequestForCardValidate:i.datamodel.Token=_twoFactor.ApiURLEnum.SaveFilterrequestForCardValidate,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(e){if(null!=e){ShowLoader(!1);var t=e;!isNullOrUndefineOrBlank(t)&&t.IsBlock&&(CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed),CallbackforMobileApp(0,0,"","",0,6))}},i.datamodel.data=e,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()}else currentPage==_twoFactor.PageType.CustomerSignup?(ShowLoadingPanelLogin(!0),(i=new vagaro.ajax).datamodel.Token="addbusiness/savefilterrequestforcardvalidate",i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(e){null!=e&&(ShowLoadingPanelLogin(!1),!isNullOrUndefineOrBlank(userccattemptdata=e)&&(userccattemptdata.IsBlock||userccattemptdata.NoOfAttempt>=$("#hdnFraudNoOfAttempt").val())&&window.setTimeout(function(){$("#divAuth").hide(),$("#pnlSignup").show(),$("#iFrameSignUp",parent.document).parents().find("#signupheaderpart").show(),$("#divConfirmBox").find(".w-button-default").attr("value","Cancel");var e=$("#spnCountryPhoneNo").text();showConfirmbox(_twoFactor.FailOTPMessage(e),"","Error Code: XJ140",!1,!1)},4300))},i.datamodel.data=e,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()):currentPage==_twoFactor.PageType.CustomerSignIn?(ShowLoadingPanelLogin(!0),(i=new vagaro.ajax).datamodel.Token=_twoFactor.ApiURLEnum.SaveFilterrequestForCardValidate,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(e){void 0!==e&&null!=e&&(ShowLoadingPanelLogin(!1),(e.IsBlock||e.NoOfAttempt>=3)&&window.setTimeout(function(){bootbox.alert({className:"vagaro-midium-popup",message:_twoFactor.FailOTPMessage(),title:"Error Code: XJ140",callback:function(){window.location.reload()}})},4300))},i.datamodel.data=e,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post()):currentPage==_twoFactor.PageType.ProfilePage&&(ShowLoader(!0),(i=new vagaro.ajax).datamodel.Token=ApiURLEnumMyAccount.SaveFilterRequestForCardValidate,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=function(e){if(null!=e){ShowLoader(!1);var t=e;!isNullOrUndefineOrBlank(t)&&t.IsBlock&&(CallWebServicehed("MySampleService.asmx/DoLogout","",CallSuccessLogout,CallFailed),CallbackforMobileApp(0,0,"","",0,6))}},i.datamodel.data=e,i.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},i.Post())},AllowNumberOnly:function(e){if(69==event.keyCode)return event.preventDefault(),!1;var t=$(e);t.removeClass("error"),t.next("span").hide(),13==event.keyCode&&("txtEmailCode"==$(e).attr("id")?_twoFactor.VerifyEmailCode():_twoFactor.VerifyCellCode()),/\D/g.test(t.val())&&t.val(t.val().replace(/\D/g,""));var i=t.val(),a=i.length;if(a<=0)return t.removeClass("filled"),!1;if(a>6)return t.val(i.substring(0,6)),!1;var r=/^\d+$/;if(currentPage==_twoFactor.PageType.CustomerSignup){if(!isNullOrUndefineOrBlank(i)&&!r.test(i))return event.preventDefault(),!1}else if(!isNullOrUndefineOrBlank(i)&&!r.test(i))return event.preventDefault(),!1;return"txtCellCode"!=e.id&&"txtEmailCode"!=e.id||t.addClass("filled"),!0},showErrorDiv:function(e,t=!1){var i=$("#spnCountryPhoneNo").text();e==_twoFactor.AuthCodeReceiveMode.Email?(t&&_twoFactor.AppendEmailScreen(ReturnValue,currentPage),_twoFactor.disabletwofactortextbox("#txtEmailCode"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("You have reached your limit of attempts. "+_twoFactor.FailOTPMessage(i,!0))):e==_twoFactor.AuthCodeReceiveMode.Cell?(t&&_twoFactor.AppendCellScreen(ReturnValue),_twoFactor.disabletwofactortextbox("#txtCellCode"),$("#dvCellCodeError").show(),$("#dvCellCodeError").text("You have reached your limit of attempts. "+_twoFactor.FailOTPMessage(i,!0))):e==_twoFactor.AuthCodeReceiveMode.EmailAndCell&&(_twoFactor.disabletwofactortextbox("#txtEmailCode"),$("#dvEmailCodeError").show(),$("#dvEmailCodeError").text("You have reached your limit of attempts. "+_twoFactor.FailOTPMessage(i,!0)))},validateEmail:function(){var e=$("#txtEmailInputCode").val();return""!=e?null==e.match(/^[A-Za-z0-9_\+-]+(\.[A-Za-z0-9_\+-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.([A-Za-z]{2,10})$/g)?($("#txtEmailInputCode").addClass("error").focus(),$("#dvEmailInputError").html("Invalid email address").show(),ShowLoadingPanelLogin(!1),!1):($("#txtEmailInputCode").removeClass("error"),$("#dvEmailInputError").html("").hide(),ShowLoadingPanelLogin(!1),13==event.keyCode&&_twoFactor.SendEmailCodeFromInputScreen(!0),!0):($("#txtEmailInputCode").addClass("error").focus(),$("#dvEmailInputError").html("Enter your email").show(),ShowLoadingPanelLogin(!1),!1)},BackFromAuth:function(e){if(e==_twoFactor.PageType.CustomerSignup){isResetTimer=!1;var t=$("#iFrameSignUp").contents();$("#pnlSignup",t).show(),$("#signupheaderpart").show(),$("#divAuth",t).hide(),$("#hdnIsResetCode",t).val("0"),(i=$("#dvRegHid")).length>0&&(i.removeClass("email"),i.removeClass("phone"),i.removeClass("success")),_twoFactor.isMobileDevice&&$("#btnCreateAccount",parent.document).show(),$("#iFrameSignUp",parent.document).parents().find("body").addClass("signupiframe")}else if(currentPage==_twoFactor.PageType.CustomerSignIn)ShowLoadingPanelLogin(!0),null!=typeof _twoFactor.Model.IsPolicyAck&&void 0!==_twoFactor.Model.IsPolicyAck&&_twoFactor.Model.IsPolicyAck?TwoStepAuth.init("privacypolicy",void 0,void 0,void 0,void 0,void 0,void 0,void 0,_twoFactor.Model.IsPolicyAck,_twoFactor.Model.UserType,_twoFactor.Model.UserID,!0):isNullOrUndefineOrBlank(SkipTwoFactoFromSignIn)||SkipTwoFactoFromSignIn();else if(currentPage==_twoFactor.PageType.ProfilePage||currentPage==_twoFactor.PageType.CovidClean||currentPage==_twoFactor.PageType.ShoppingBag)$("#dvPhoneVerify").hide(),$("#dvEmailVerify").hide(),$("#divtwofactorauthentication").modal("hide");else if(currentPage==_twoFactor.PageType.CustomerSignup){var i;isResetTimer=!1,$("#pnlSignup").show(),$("#iFrameSignUp",parent.document).parents().find("#signupheaderpart").show(),$("#divAuth").hide(),(i=$("#iFrameSignUp",parent.document).parents().find("#dvRegHid")).length>0&&(i.removeClass("email"),i.removeClass("phone"),i.removeClass("success")),_twoFactor.isMobileDevice&&$("#btnCreateAccount",parent.document).show(),$("#iFrameSignUp",parent.document).parents().find("body").addClass("signupiframe")}else if(currentPage==_twoFactor.PageType.BusinessSignup){1==_twoFactor.Model.isFromInvalidEmailCell&&($("#hdnEmailAndCell2FScreen").val(_twoFactor.EmailAndCell2FScreen.None),_twoFactor.Model.isFromInvalidEmailCell=!1),vm.ISfromgetmailphonevalidated=!1,vm.isResetTimer=!1,$("#dvAuth").hide(),$("#divBusinessSteps").show();var a={step:-11,isNextClick:0},r=new vagaro.ajax;r.datamodel.Token=_twoFactor.ApiURLEnum.GetLogDataonBackClick,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.data=a,r.datamodel.callback=function(e){},r.datamodel.Error=function(){vagaro.alert(_twoFactor.ValidationMessages.FailedErrorMessage)},r.Post()}else currentPage==_twoFactor.PageType.MultiLocation&&($find("mpeNewBusiness").show(),$("#divtwofactorauthentication").css("z-index","0"),$("#divtwofactorauthentication").hide())},validatePhone:function(e,t,i){if(currentPage==_twoFactor.PageType.CustomerSignIn)var a=$("#selectedCountrydiv").attr("data-countryid");else currentPage==_twoFactor.PageType.ProfilePage&&(a=$("#temphdncountryid").val());void 0!==i&&null!=i&&""!=i&&(a=i);var r=$(e),o=r.val().replace(/([()-\s])+/g,""),n=o.length;if(n<=0)return"#revtxtnightphoneCust"==t||"#revtxtdayphoneCust"==t||"#divInvalidMobileMessage"==t?$(t).hide():($(t).show(),$(t).html("Enter your mobile phone")),r.addClass("error").focus(),ShowLoadingPanelLogin(!1),!1;if(!isNullOrUndefineOrBlank(o)&&!/^\d+$/.test(o))return event.preventDefault(),ShowLoadingPanelLogin(!1),!1;if(2!=a&&11==n&&0==o[0]&&(n=(o=o.substring(1)).length),1==a||3==a){if(10!=n)return r.val(o),$(t).show(),"#revtxtnightphoneCust"==t?($("#revtxtnightphoneCust").attr("style","display:inline"),$(t).html("Night phone should be of 10 digits.")):"#revtxtdayphoneCust"==t?($("#revtxtdayphoneCust").attr("style","display:inline"),$(t).html("Day phone should be of 10 digits.")):("#divInvalidMobileMessage"==t&&$("#divInvalidMobileMessage").attr("style","display:inline"),$(t).html("Phone number should be of 10 digits")),r.addClass("error").focus(),!1}else if(2==a){if(n<10||n>11)return r.val(o),$(t).show(),"#revtxtnightphoneCust"==t?($("#revtxtnightphoneCust").attr("style","display:inline"),$(t).html("Night phone should be of 10 or 11 digits.")):"#revtxtdayphoneCust"==t?($("#revtxtdayphoneCust").attr("style","display:inline"),$(t).html("Day phone should be of 10 or 11 digits.")):("#divInvalidMobileMessage"==t&&$("#divInvalidMobileMessage").attr("style","display:inline"),$(t).html("Phone number should be of 10 or 11 digits")),r.addClass("error").focus(),!1;10==n&&0!=o[0]?n=(o=0+o).length:(n<=10||12==n)&&0==o[0]&&(n=(o=o.substring(1)).length),r.val(o.replace(/(\d{3})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3"))}else if(4==a||5==a){if(n<9||n>10)return r.val(o),$(t).show(),"#revtxtnightphoneCust"==t?($("#revtxtnightphoneCust").attr("style","display:inline"),$(t).html("Night phone should be of 9 or 10 digits.")):"#revtxtdayphoneCust"==t?($("#revtxtdayphoneCust").attr("style","display:inline"),$(t).html("Day phone should be of 9 or 10 digits.")):("#divInvalidMobileMessage"==t&&$("#divInvalidMobileMessage").attr("style","display:inline"),$(t).html("Phone number should be of 9 or 10 digits")),r.addClass("error").focus(),!1;9==n&&0!=o[0]?n=(o=0+o).length:(n<=9||n>10)&&0==o[0]&&(n=(o=o.substring(1)).length),r.val(o.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3"))}return $(t).hide(),13==event.keyCode&&_twoFactor.SendPhoneCodeFromInputScreen(!0),!0},ShowCountry:function(){return $(".countryselectoption").is(":visible")?void $(".countryselectoption").hide():void $(".countryselectoption").show()},selectCountry:function(e,t){$("#selectedCountrydiv").removeClass().addClass("selectedcountry "+t),$("#selectedCountrydiv").attr("data-countryId",e),_twoFactor.Phone_format("#txtCellInputCode","#dvCellInputCodeError",e),_twoFactor.ShowCountry(),$("#txtCellInputCode").attr("tabindex",-1).focus(),_twoFactor.Model.DialingCode=2==e||5==e?2==e?"44":"353":""},Phone_format:function(e,t,i){if(currentPage==_twoFactor.PageType.CustomerSignIn)var a=$("#selectedCountrydiv").attr("data-countryId");else currentPage==_twoFactor.PageType.ProfilePage&&(a=$("#temphdncountryid").val());null!=typeof i&&null!=i&&""!=i&&(a=i);var r=$(e);/\D/g.test(r.val())&&r.val(r.val().replace(/\D/g,"")),1==a?r.removeClass("cntry-ca cntry-ie").addClass("cntry-us"):3==a?r.removeClass("cntry-us cntry-ie").addClass("cntry-ca"):5==a?r.removeClass("cntry-ca cntry-us").addClass("cntry-ie"):r.removeClass("cntry-ca cntry-us cntry-ie");var o=r.val().replace(/([()-\s])+/g,""),n=o.length;if(!(n<=0))return r.removeClass("error"),isNullOrUndefineOrBlank(o)||/^\d+$/.test(o)?($(t).hide(),2!=a&&11==n&&0==o[0]&&(n=(o=o.substring(1)).length),1!=a&&3!=a||10!=n?2==a?(10==n&&0!=o[0]?n=(o=0+o).length:(n<=10||12==n)&&0==o[0]&&(n=(o=o.substring(1)).length),10==n||11==n?r.val(o.replace(/(\d{3})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3")):r.val(o)):4==a||5==a?(9==n&&0!=o[0]?n=(o=0+o).length:(n<=9||n>10)&&0==o[0]&&(n=(o=o.substring(1)).length),9==n||10==n?r.val(o.replace(5==a?/(\d{3})\-?(\d{3})\-?(\d{4})/:/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3")):r.val(o)):r.val(o):3==a?r.val(o.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"$1-$2-$3")):r.val(o.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1) $2-$3")),ShowLoadingPanelLogin(!1),!0):(event.preventDefault(),ShowLoadingPanelLogin(!1),!1);ShowLoadingPanelLogin(!1)},formatEmail:function(e){var t=e.split("@");return 2==t.length&&(e=_twoFactor.formatCell(t[0],!0)+"@"+t[1]),e},formatCell:function(e,t=!1,i=0){var a="",r=3;e.length<=3&&(r=1);for(var o=0;o<e.length-r;o++)a+="*";if(0==t){switch(i){case"4":phoneNumHidden="(**) **** *";break;case"3":phoneNumHidden="***-***-*";break;case"2":phoneNumHidden="*** **** *";case"1":phoneNumHidden="(***) ***-*";break;default:phoneNumHidden=a}e=phoneNumHidden+e.substring(e.length-r,e.length)}else e=a+e.substring(e.length-r,e.length);return e},AdaPassiveMessage:function(e,t){$("#spnEmailCellcode").html(e),setTimeout(function(){$("#spnEmailCellcode").html("")},5e3),void 0!==t&&null!=t&&(t==_twoFactor.AuthCodeReceiveMode.Email||t==_twoFactor.AuthCodeReceiveMode.EmailAndCell?$("#txtEmailCode").focus():$("#txtCellCode").focus())},IsFromCookieLessWidget:function(){var e=!1;if("undefined"!=typeof _common&&void 0!==_common.IsCookieLessWidget&&_common.IsCookieLessWidget())e=!("undefined"==typeof _common||void 0===_common.IsCookieLessWidget||!_common.IsCookieLessWidget());else try{void 0!==window.parent._common&&void 0!==window.parent._common.IsCookieLessWidget&&window.parent._common.IsCookieLessWidget()&&(e=!(void 0===window.parent._common||void 0===window.parent._common.IsCookieLessWidget||!window.parent._common.IsCookieLessWidget()))}catch(e){}return e},AjaxOld:function(e,t,i,a){var r=new vagaro.ajax;r.datamodel.Token=e,r.datamodel.data=t,r.datamodel.callback=i,r.datamodel.Error=a,r.Post()}};var BankPay,intRegex=/^\d+$/;function pasteValues(e){var t=e.split("");$(t).each(function(e){var i="txtfirstcode";switch(e){case 1:i="txtsecondcode";break;case 2:i="txtthirdcode";break;case 3:i="txtfourcode";break;case 4:i="txtfivecode";break;case 5:i="txtsixcode";break;default:i="txtfirstcode"}$('.inputcode[name="'+i+'"]').val(t[e]),"txtfirstcode"==i&&$("#txtsixcode").focus()})}function ShowHideDoneMessage(e,t){if(currentPage==_twoFactor.PageType.MultiLocation)$(".multilocation-Success .text-block-28").html(e),$(".multilocation-Success").addClass("showmsgTop").css("display",""),setTimeout(function(){window.scrollTo({top:0,behavior:"smooth"})},200),setTimeout(function(){$(".multilocation-Success").removeClass("showmsgTop").css("display","")},3200);else if(currentPage==_twoFactor.PageType.CustomerSignup)window.parent.$(".banner-success-master.customerSignup .text-block-28").html(e),window.parent.$(".banner-success-master.customerSignup").addClass("showmsgTop").css("display",""),setTimeout(function(){window.scrollTo({top:0,behavior:"smooth"})},200),setTimeout(function(){window.parent.$(".banner-success-master").removeClass("showmsgTop").css("display","")},3200);else{$(".banner-success-master .text-block-28").html(e);var i=$(".banner-success-master");i.addClass("showmsgTop").css("display",""),e!=_twoFactor.SuccessMessage.EmailVerified&&e!=_twoFactor.SuccessMessage.PhoneVerified||setTimeout(function(){i.removeAttr("role").attr("aria-label",e).attr("tabindex",-1).focus()},300),setTimeout(function(){window.scrollTo({top:0,behavior:"smooth"})},200),setTimeout(function(){var t=$(".banner-success-master");t.removeClass("showmsgTop").css("display",""),e!=_twoFactor.SuccessMessage.EmailVerified&&e!=_twoFactor.SuccessMessage.PhoneVerified||(t.removeAttr("aria-label").attr("role","none"),setTimeout(function(){$("#h2AccountVerified").is(":visible")?$("#h2AccountVerified").attr("tabindex",-1).focus():($("#h2VerifyPhone").is(":visible")||e==_twoFactor.SuccessMessage.PhoneVerified)&&$("#h2VerifyPhone").attr("tabindex",-1).focus()},500))},3200)}}function GetDisplayMessageTime(e){var t=2e3;return""!=e&&e.length>0&&(e.length<50?t=2e3:e.length<100?t=3e3:e.length<200?t=4e3:e.length>200&&(t=7e3)),t}function isNullOrUndefineOrBlank(e){return void 0===e||null==e||""==e||null==e}$(document).on("input.fromManual",".inputcode",function(){intRegex.test($(this).val())||$(this).val("")}),$(document).on("focus","#twostepemailcodeinfo input",function(){(isiPhone||/iPad/.test(navigator.userAgent))&&setTimeout(function(){isNullOrUndefineOrBlank(currentPage)||currentPage!=_twoFactor.PageType.CustomerSignup?$("html").scrollTop("0"):$("html",parent.document).scrollTop("0")},100)}),$(document).on("focusin","#txtEmailInputCode,#txtEmailCode,#txtCellInputCode,#txtCellCode",function(){currentPage==_twoFactor.PageType.CustomerSignup&&_twoFactor.isMobileDevice&&$("body.customer-signup-body").addClass("keyboradopen")}),$(document).on("focusout","#txtEmailInputCode,#txtEmailCode,#txtCellInputCode,#txtCellCode",function(){currentPage==_twoFactor.PageType.CustomerSignup&&_twoFactor.isMobileDevice&&$("body.customer-signup-body").removeClass("keyboradopen")}),$(document).on("paste",".inputcode",function(){var e=$(this),t=e.val();e.val(""),e.one("input.fromPaste",function(){$currentInputBox=$(this);var i=$currentInputBox.val();6==i.length&&intRegex.test(i)?pasteValues(i):e.val(t),$(".inputcode").attr("maxlength",1)}),$(".inputcode").attr("maxlength",6)}),$.fn.GoogleAddressPlugin=function(e){var t=$.extend({Control:this,ControlId:this.attr("id"),Address2Control:"",CurrentLocationCountryID:1,AddressData:{},CountryDropDownRole:2,AddressFor:1,IsLiveStreamAddress:!1,IsDisabled:!1,ScrollType:2,IsAddManualAddress:!1,IsSaveManualAddress:!1,IsAddressRequired:!1,DisabledCountry:!1,IsReturnCountryID:!1,IsDistance:!1},e),i={model:{countryFlag:{1:"us-f",2:"uk-f",3:"canada-f",4:"aus-f"},countryMapForAPI:{1:"US",2:"GB",3:"CA",4:"AU"},countryName:{1:"United States of America",2:"United Kingdom",3:"Canada",4:"Australia"},stateList:{},CountryId:void 0!==t.AddressData.country?t.AddressData.country:"undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail&&""!=countryIdBusDetail?parseInt(countryIdBusDetail,10):t.CurrentLocationCountryID,errorMessage:"Something went wrong, Try Again.",addressPlaceHolder:"Address Line 1",addressPlaceHolderUKOnly:"E.g. Post Code 'CR0 3RL' or 1st line '36 Factory Lane'",lableLanguage:[{CountryId:0,Zip:"Postal Code",City:"City",State:"State",IsStateDropDown:0,IsStateless:0,IsZipless:0},{CountryId:1,Zip:"ZIP Code",City:"City",State:"State",IsStateDropDown:1,IsStateless:0,IsZipless:0},{CountryId:2,Zip:"Postcode",City:"City",State:"County",IsStateDropDown:1,IsStateless:0,IsZipless:0},{CountryId:3,Zip:"Postal Code",City:"City",State:"Province",IsStateDropDown:1,IsStateless:0,IsZipless:0},{CountryId:4,Zip:"Postcode",City:"Suburb",State:"State/Territory",IsStateDropDown:1,IsStateless:0,IsZipless:0},{CountryId:194,Zip:"Postal Code",City:"City",State:"State",IsStateDropDown:0,IsStateless:1,IsZipless:0},{CountryId:236,Zip:"Postal Code",City:"City",State:"State",IsStateDropDown:0,IsStateless:0,IsZipless:1},{CountryId:12,Zip:"Postal Code",City:"City",State:"State",IsStateDropDown:0,IsStateless:0,IsZipless:1}],lblRow:{},IsStateless:0,IsZipless:0},ApiURLEnum:{getState:"address/getstatesbymultiplecountryid",getStateCode:"address/GetCityByZipCodeWithStatecode",getPlaceDetailByPlaceId:"address/GetPlaceDetailByPlaceId",getLocationOrPlaceDetail:"address/GetLocationOrPlaceDetail"},ControlsPrefix:{addressControl:"#"+t.ControlId,countrySelectOption:"#countryselectoption"+t.ControlId,addressPopup:"#addressPopup"+t.ControlId,AddressControllerCountry:"#AddressControllerCountry"+t.ControlId,myCountryPopup:"#mycountryPopup"+t.ControlId,countrySelectoptionPopup:"#countryselectoptionpopup"+t.ControlId,btnPopupClose:"#btnPopupClose"+t.ControlId,popUpCntryDropDownID:"#popUpCntryDropDownID"+t.ControlId,ddlState:"#ddlState"+t.ControlId,lblZipCodePopup:"#lblZipCodePopup"+t.ControlId,txtZip:"#txtZip"+t.ControlId,lblStatePopup:"#lblStatePopup"+t.ControlId,lblCityPopup:"#lblCityPopup"+t.ControlId,txtCity:"#txtCity"+t.ControlId,txtStreet:"#txtStreet"+t.ControlId,txtStreet1:"#txtStreet1"+t.ControlId,txtState:"#txtState"+t.ControlId,btnCancelGetAddress:"#btnCancelGetAddress"+t.ControlId,btnGetAddress:"#btnGetAddress"+t.ControlId,dvDdlState:"#dvDdlState"+t.ControlId,ddlMainCountry:"#ddlMainCountry"+t.ControlId,ddlPopupCountry:"#ddlPopupCountry"+t.ControlId,dvWrap:"#dvWrap"+t.ControlId}},a=()=>{searchTextBox=t.ControlId,$("#"+searchTextBox).wrap('<div id="dvWrap'+searchTextBox+'" class="select-country-mar address-phone-plugin">').parent().wrap('<div class="addresswithcountry clearfix">');var e="",a=document.getElementById(searchTextBox).tabIndex;e+=' <div class="w-custom-dropdown countrydropdown allflag-show">';i.ControlsPrefix.countrySelectOption;e+='<div id="AddressControllerCountry'+searchTextBox+'" class="selectedcountry" tabindex="-1"></div > ',e+='<select id="ddlMainCountry'+searchTextBox+'" class="form-control" tabindex="'+a+'">  </select>',e+="</div>",e+='<ul id="countryselectoption'+searchTextBox+'" class="countryselectoption" style="display: none">',e+=" </ul>",0!=t.CountryDropDownRole&&$(i.ControlsPrefix.countrySelectOption).length<=0&&(null!=$("#"+searchTextBox).parent()?$("#"+searchTextBox).parent().before(e):$("#"+searchTextBox).before(e),$(i.ControlsPrefix.AddressControllerCountry).bind("click",function(){t.IsDisabled||$(i.ControlsPrefix.countrySelectOption).is(":visible")||$(".countryselectoption").hide()}));var r='<div id="addressPopup'+searchTextBox+'" class="general-addresspopup verifyAddressPopup address-phone-plugin" style="display:none">';r+='<div class="general-addresspopup-container ">',r+='<div class="general-addresspopup-body">',r+='<div class="pop-model-body settingnew-design addresspopup-billing">',r+='<div class="loginWrap loginContentwrap-addbus">',r+="<header>",r+="<a id="+i.ControlsPrefix.btnPopupClose.replace("#","")+' class="popupCloseImg" href="javascript:void(0)" >',r+="&#xf00d;",r+="</a>",r+='<h4 id="mycountryPopupTitle'+searchTextBox+'">Verify Address</h4>',r+="</header>",r+='<div class="modal-body">',r+='<div class="popContainWrapper clearfix">',r+='<div class="loginContainer clearfix">',r+='<div class="loginContentwrap">',r+='<div class="formlayout1" id="divMain'+searchTextBox+'">',r+='<p class="discription-location" id="mycountryPopupsubTitle'+searchTextBox+'">',r+="Our system doesn’t recognize your address. Please provide the following information.",r+="</p>",r+="</div>",r+="<ul>",r+='<li class="addressDropdownBox">',r+="<label>Address Line 1</label>";var o="'"+i.ControlsPrefix.countrySelectoptionPopup+"'";r+='<div class="addresswithcountry clearfix" >',r+=' <div class="w-custom-dropdown countrydropdown allflag-show">',r+='<div id="mycountryPopup'+searchTextBox+'" class="selectedcountry us-f" '+(0==t.CountryDropDownRole?" disabled=true ":"")+' onclick="$('+o+').toggle()"></div>',r+='<select id="ddlPopupCountry'+searchTextBox+'" class="form-control" '+(0==t.CountryDropDownRole?" disabled=true ":"")+">  </select>",r+="</div>",r+='<ul id="countryselectoptionpopup'+searchTextBox+'" class="countryselectoption selectoptionpopup" style="display: none">',r+=" </ul>",r+=' <div class="select-country-mar">',r+='<input name="txtStreet" type="text" maxlength="500" id="txtStreet'+searchTextBox+'" class="inputbox-type1 validAddress'+searchTextBox+'" autocomplete="off" placeholder="Address Line 1">',r+=" </div>",r+="</div>",r+="</li>",r+="<li>",r+="<label>Address Line 2</label>",r+='<input name="txtStreet1" type="text" maxlength="100" id="txtStreet1'+searchTextBox+'" class="inputbox-type1" autocomplete="off" placeholder="Address Line 2 (Optional)">',r+="</li>",r+="</ul>",r+='<ul class="location-city-row">',r+="<li>",r+='<label id="lblCityPopup'+searchTextBox+'">City:</label>',r+='<input name="txtCity" type="text" maxlength="48" id="txtCity'+searchTextBox+'" class="inputbox-type1 validAddress'+searchTextBox+'" autocomplete="off" placeholder="City">',r+="</li>",r+="<li>",r+='<label id="lblStatePopup'+searchTextBox+'">State/Province:</label>',r+='<input name="txtState" type="text" maxlength="50" id="txtState'+searchTextBox+'" class="inputbox-type1" autocomplete="off" style="display:none" placeholder="State" />',r+='<div class="dropdowndiv" id="dvDdlState'+searchTextBox+'">',r+='<select id="ddlState'+searchTextBox+'" class="" style="width: 100%;"></select>',r+="</div>",r+="</li>",r+="<li>",r+='<label id="lblZipCodePopup'+searchTextBox+'">Zip/Postal Code:</label>',r+='<input name="txtZip" type="text" maxlength="10" placeholder="Zip" id="txtZip'+searchTextBox+'" title="Zipcode is mandatory because it will help your customer to find shop using google map." class="inputbox-type1 validAddress'+searchTextBox+'" autocomplete="off" />',r+='<div class="smallloading" id="divsmallloading'+searchTextBox+'" style="display:none;"></div>',r+="</li>",r+="</ul>",r+="</div>",r+="</div>",r+="</div>",r+="</div>",r+='<div class="popupBtnContainer clearfix modal-footer">',r+='<input type="button" name="btnCancelGetAddress" value="Cancel" id="btnCancelGetAddress'+searchTextBox+'" class="btn btn-default" tabindex="-1" />',r+='<input type="button" name="btnGetAddress" value="Save" id="btnGetAddress'+searchTextBox+'" class=" btn btn-primary" tabindex="-1" />',r+="</div>",r+="</div>",r+="</div>",r+="</div>",r+="</div>",r+="</div>",$(i.ControlsPrefix.addressPopup).length>0&&$(i.ControlsPrefix.addressPopup).remove(),$(i.ControlsPrefix.addressPopup).length<=0&&($("body").prepend(r),n(),$(i.ControlsPrefix.btnPopupClose).bind("click",function(){y()}),$(i.ControlsPrefix.btnCancelGetAddress).bind("click",function(){y()}),$(i.ControlsPrefix.btnGetAddress).bind("click",function(){return t.IsSaveManualAddress=!0,D(!0)}),$(i.ControlsPrefix.addressControl).bind("change",function(){h()})),$(".validAddress"+t.ControlId).on("blur",function(){""==$(this).val().trim()&&(!this.id.includes("txtZip")||this.id.includes("txtZip")&&0==i.model.IsZipless)?0==$(this).siblings("span").length&&($(this).addClass("errorInput"),$(this).after('<span id="rfv'+$(this).attr("id")+'" class="requiredErrorText" style="color:Red;">required</span>')):($(this).removeClass("errorInput"),$(this).next("span").remove())}),$(i.ControlsPrefix.txtState).on("blur",function(){""!=$(this).val().trim()&&($(this).removeClass("errorInput"),$(this).next("span").remove())})},r=()=>{var e=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/";if($.ajax({url:e+"WebServices/MySampleService.asmx/GetLocation",type:"POST",contentType:"application/json; charset=utf-8"}).success(function(e){ipLocation=e.lat+","+e.lon}),"undefined"==typeof keepAlive&&$("#IsWaitforKeepALive").length>0&&void 0!==$("#IsWaitforKeepALive").val()&&"true"===$("#IsWaitforKeepALive").val().toLowerCase())setTimeout(function(){r()},500);else{var a=t.Control.select2({searchInputPlaceholder:i.model.addressPlaceHolder,minimumInputLength:1,combobox:!0,dropdownCssClass:"select2DD select2borderbox",selectOnClick:!1,multiple:!1,closeOnSelect:!0,allowClear:!0,ajax:{url:m(i.ApiURLEnum.getLocationOrPlaceDetail),dataType:"json",quietMillis:250,params:{},data:function(){var e={};return e.searchText=t.Control.val(),e.countryFilter=null==i.model.countryMapForAPI[i.model.CountryId]?"":i.model.countryMapForAPI[i.model.CountryId],e.Location=ipLocation,e.IsCallNewAddressAPI=!t.IsLiveStreamAddress,e},results:function(e,t){return{results:e.Data}},cache:!1},formatNoMatches:function(){return $("#select2-drop").css("display","block"),$("#select2-drop").css("z-index","100002"),"No matches found"},formatSearching:function(){return $("#select2-drop").css("display","block"),$("#select2-drop").css("z-index","100002"),"Searching…"},formatInputTooShort:function(e,t){return $("#select2-drop").css("display","none"),$("#select2-drop").css("z-index","100002"),""},initSelection:function(e,i){var a={id:t.Control.val(),text:t.Control.val()};$("#select2-drop").css("z-index","100002"),i(a)},formatResult:function(e){$("#select2-drop").css("display","block"),$("#select2-drop").css("z-index","100002");return'<div data-placeid="'+e.place_id+'"><img  style="vertical-align:middle" src="https://vagaro.azureedge.net/static-content/Images/flamingo-map-newicon-new@2x.png" width="12" /><span class="fullocation">'+e.FormattedAddress+"</span></div>"}});a.on("select2-loaded",function(e){$(".select2-result-unselectable").addClass("select2-result-selectable").removeClass("select2-result-unselectable")}),a.on("select2-blur",function(e){e.preventDefault()}),a.on("select2-focus",function(e){$(this).find(".select2-input").select()}),a.on("selected",function(e){$(e.currentTarget).select2("val",e.choice.CityState),$(e.currentTarget).data("selectedid",e.choice.CityState);var t={};t.placeId=e.choice.place_id,t.description=e.choice.CityState,t.CountryID=parseInt(i.model.CountryId),t.IsStateless=1==i.model.IsStateless,t.CountryCode=i.model.countryMapForAPI[i.model.CountryId],t.IsCallNewAddressAPI=e.choice.IsCallNewAddressAPI,o(m(i.ApiURLEnum.getPlaceDetailByPlaceId),t,n,placeDetailFail,!1,!1,!0)});var n=function(e){if(1e3==e.ResponseCode){$(i.ControlsPrefix.addressControl).removeClass("errorInput");var a=null!=(e=e.Data)&&null==e.CityState?"":e.CityState.split(",")[0],r=null==e.State?"":e.State;r=r.trim(),addressData={},addressData.address=e.Address,addressData.address2=e.Address2,addressData.state=r,addressData.zip=e.ZipCode,addressData.country=i.model.CountryId,addressData.statecode=e.StateCode;var o=addressData.address;2==e.CountryID&&(""==e.State||""==e.StateCode?(a=e.City,i.model.IsStateless=1):i.model.IsStateless=0),addressData.city=a,t.AddressData=addressData,o=o+(""!=o?", ":"")+addressData.city,0==i.model.IsStateless&&(o=o+(""!=o&&""!=addressData.state?", ":"")+(1==i.model.CountryId?addressData.statecode:addressData.state)),o=o+(""!=o&&""!=addressData.zip?", ":"")+addressData.zip,u(o)?(t.Control.select2("data",{id:null,text:null}),swal({title:"Address is not valid.",text:"",type:"",timer:6e3,showCancelButton:!1,confirmButtonColor:"#eb6663",customClass:"sweet-alert-model auto-footer-btton "},function(e){$(i.ControlsPrefix.addressControl).focus(),$(i.ControlsPrefix.addressControl).select2("open")})):t.Control.select2("val",o),u(t.Address2Control)||$(t.Address2Control).val(t.AddressData.address2);var n=e.GetCityByZipString;if(!u(n)){var s=n.split("|")[0],l=1*n.split("|")[1],d=n.split("|")[2];u(s)||$(i.ControlsPrefix.txtCity).val(s),u(d)||(t.AddressData.state=d,t.AddressData.stateId=l,$(i.ControlsPrefix.ddlState).val(l))}t.IsLiveStreamAddress&&_shopdetail.ChangeCustomerStartTime(e.TimeZoneOffSet,e.CountryID,e.IsSupportDayLight)}};placeDetailFail=function(e){console.log(e)},T()}},o=(e,t,i,a,r,o,n)=>{var s=new vagaro.ajax;s.datamodel.Token=e,s.datamodel.data=t,s.datamodel.callback=i,s.datamodel.Error=a,void 0!==n&&null!=n&&1==n&&(s.datamodel.IsNewVagaroAPI=!0),void 0!==o&&1==o&&(s.datamodel.ErrorMessage=""),r?s.PostQue():s.Post()},n=()=>{if(P())s(_glbPluginCountryList);else{var e={},t={businessID:0,loginUserID:0};e.RegisterDeviceRequest=t,o("GetAllCountryList",e,s,d,!1,!1,!1)}},s=e=>{if(void 0!==e&&null!=e&&e.length>0){P()||(_glbPluginCountryList=e),i.model.countryMapForAPI={},i.model.countryFlag={},i.model.countryName={};var a='<optgroup label="Current Location">',r='<optgroup label="Other Locations">';e.sort((e,t)=>{var i=e.CountryName.toUpperCase(),a=t.CountryName.toUpperCase();return i<a?-1:i>a?1:0}),$.each(e,function(e,o){if(2==t.AddressFor||1==t.AddressFor&&!u(o.IsBusinessUseOnly)&&1==o.IsBusinessUseOnly){var n="liFront"+t.ControlId+e,s="<li  id='"+n+"' class="+o.CSSClass+" >"+o.CountryName+" </li>";$(i.ControlsPrefix.countrySelectOption).append(s),$("#"+n).bind("click",function(){p(o.CountryID)}),s="<li id='"+(n="liPopup"+t.ControlId+e)+"' class="+o.CSSClass+" >"+o.CountryName+" </li>",$(i.ControlsPrefix.countrySelectoptionPopup).append(s),$("#"+n).bind("click",function(){A(o.CountryID)}),i.model.countryMapForAPI[o.CountryID]=o.CountryCode,i.model.countryFlag[o.CountryID]=o.CSSClass,i.model.countryName[o.CountryID]=o.CountryName,o.CountryID==("undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail&&""!=countryIdBusDetail?parseInt(countryIdBusDetail,10):t.CurrentLocationCountryID)?a+=' <option class="'+o.CSSClass+'" value="'+o.CountryID+'">'+o.CountryName+"</option> </optgroup >":r+=' <option class="'+o.CSSClass+'" value="'+o.CountryID+'">'+o.CountryName+"</option>"}}),r+="</optgroup >",$(i.ControlsPrefix.ddlMainCountry).append(a+r),$(i.ControlsPrefix.ddlMainCountry).select2({searchInputPlaceholder:"Search for a Country",closeOnSelect:!1,formatResult:c,dropdownCssClass:"all-country-flag"}).on("select2-selected",function(e){i.model.CountryId=parseInt(e.choice.id),p(i.model.CountryId),$(i.ControlsPrefix.addressControl).select2("open")}).on("select2-opening",function(e){!1===$(e.target).is(".select2-container")&&$(".select2-dropdown-open").select2("close"),$(i.ControlsPrefix.ddlMainCountry).select2("data",{id:i.model.CountryId})}).on("select2-open",function(e){if(("undefined"==typeof IsMobileDevice||u(IsMobileDevice))&&(isiPhone=null!=navigator.userAgent.match(/iphone/i),isWindowsPhone=navigator.userAgent.match(/windows phone/i)||!1,AndroidMobile=null!=navigator.userAgent.match(/Android/i)&&null!=navigator.userAgent.match(/Mobile/i)&&null==navigator.userAgent.match(/Windows/i),IsMobileDevice=/iPad/.test(navigator.userAgent)||isiPhone||isWindowsPhone||AndroidMobile||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&($(window).width()<=850||$(window).height()<=850)),1==IsMobileDevice&&l(),this.selectedIndex>0){var i=$("#select2-drop .select2-results"),a=i.find(".select2-highlighted").position().top;1==t.ScrollType?i.scrollTop(a+i.scrollTop()):i.scrollTop(a)}}),$(i.ControlsPrefix.ddlPopupCountry).append(a+r),$(i.ControlsPrefix.ddlPopupCountry).select2({searchInputPlaceholder:"Search for a Country",closeOnSelect:!1,formatResult:c,dropdownCssClass:"all-country-flag"}).on("select2-selected",function(e){i.model.CountryId=parseInt(e.choice.id),A(i.model.CountryId),t.Control.select2("data",{id:null,text:null}),h(),setTimeout(function(){$(i.ControlsPrefix.txtStreet).focus()},100)}).on("select2-opening",function(e){$(i.ControlsPrefix.ddlPopupCountry).select2("data",{id:i.model.CountryId})}).on("select2-open",function(e){if(("undefined"==typeof IsMobileDevice||u(IsMobileDevice))&&(isiPhone=null!=navigator.userAgent.match(/iphone/i),isWindowsPhone=navigator.userAgent.match(/windows phone/i)||!1,AndroidMobile=null!=navigator.userAgent.match(/Android/i)&&null!=navigator.userAgent.match(/Mobile/i)&&null==navigator.userAgent.match(/Windows/i),IsMobileDevice=/iPad/.test(navigator.userAgent)||isiPhone||isWindowsPhone||AndroidMobile||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&($(window).width()<=850||$(window).height()<=850)),1==IsMobileDevice&&l(),this.selectedIndex>0){var i=$("#select2-drop .select2-results"),a=i.find(".select2-highlighted").position().top;1==t.ScrollType?i.scrollTop(a+i.scrollTop()):i.scrollTop(a)}}),p(i.model.CountryId,"0")}},l=()=>{$(".select2-input text-primary demo, :focus,input").prop("focus",!1).blur()},d=e=>{p(i.model.CountryId,"0"),swal({title:i.model.errorMessage,text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn"},function(e){swal.close()})},c=e=>$('<span class="'+e.css+'" >'+e.text+"</span>"),u=e=>void 0===e||null==e||""==e||null==e,p=(e,a)=>{i.model.CountryId=e,T();var r=i.model.countryFlag[e];u(r)&&(i.model.CountryId=t.CurrentLocationCountryID,r=i.model.countryFlag[i.model.CountryId],a=""),"0"!=a&&($(".select2-results").empty(),t.Control.select2("data",{id:null,text:null}),$(".select2-results").empty(),h()),$(i.ControlsPrefix.AddressControllerCountry).removeClass(),$(i.ControlsPrefix.AddressControllerCountry).addClass("selectedcountry "+r),$(i.ControlsPrefix.myCountryPopup).removeClass(),$(i.ControlsPrefix.myCountryPopup).addClass("selectedcountry "+r),$(i.ControlsPrefix.countrySelectOption).removeAttr("style").attr("style","display:none"),$(i.ControlsPrefix.countrySelectOption).removeClass("active"),$(i.ControlsPrefix.dvWrap).removeClass(),$(i.ControlsPrefix.dvWrap).addClass("select-country-mar vg-select-icon-mar add-input-focus-relative "),("undefined"==typeof lblRow||0==Object.keys(lblRow).length||"undefined"!=typeof lblRow&&Object.keys(lblRow).length>0&&lblRow.CountryId!=i.model.CountryId)&&($.grep(i.model.lableLanguage,function(e,t){e.CountryId==i.model.CountryId&&(lblRow=i.model.lableLanguage[t])}),"undefined"!=typeof lblRow&&0!=Object.keys(lblRow).length&&lblRow.CountryId==i.model.CountryId||(lblRow=i.model.lableLanguage[0])),i.model.IsStateless=lblRow.IsStateless,i.model.IsZipless=lblRow.IsZipless},h=()=>{t.AddressData={}},m=(e,t)=>{try{var i=VagaroCorePublicAPIURLV2;if(void 0===window.parent.VagaroCorePublicAPIURLV2||u(window.parent.VagaroCorePublicAPIURLV2)||(i=window.parent.VagaroCorePublicAPIURLV2),u(i))return void console.log("Core API URL not found.");var a="",r=i.split("/");if(void 0!==t&&null!=t&&""!=t)r[3]=t,a=r.join("/")+e;else if("undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID){var o=myAccountUserGroupID.split(",");o.length>0&&(r[3]=o[0],a=r.join("/")+e)}return""==a&&(a=i+e),a}catch(t){return i+e}},f=()=>{i.model.stateList.length>0&&($(i.ControlsPrefix.ddlState).html(""),$(i.ControlsPrefix.ddlState).html('<option value="0">Select</option>'),$.grep(i.model.stateList,function(e){e.CountryID==i.model.CountryId&&$(i.ControlsPrefix.ddlState).append($("<option></option>").val(e.StateID).html(e.DisplayStateCode))}),void 0===t.AddressData.statecode||u(t.AddressData.statecode)||$.grep(i.model.stateList,function(e){e.StateCode==t.AddressData.statecode&&e.CountryID==i.model.CountryId&&$(i.ControlsPrefix.ddlState).val(e.StateID)}))},g=e=>{1e3==e.ResponseCode&&(i.model.stateList=e.Data,f())},v=e=>{swal({title:i.model.errorMessage,text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn"},function(e){swal.close()})},A=e=>{var t;$(".countryflag").removeClass("active"),i.model.CountryId=e,("undefined"==typeof lblRow||0==Object.keys(lblRow).length||"undefined"!=typeof lblRow&&Object.keys(lblRow).length>0&&lblRow.CountryId!=e)&&($.grep(i.model.lableLanguage,function(t,a){t.CountryId==e&&(lblRow=i.model.lableLanguage[a])}),"undefined"!=typeof lblRow&&0!=Object.keys(lblRow).length&&lblRow.CountryId==e||(lblRow=i.model.lableLanguage[0])),$(i.ControlsPrefix.lblZipCodePopup).text(lblRow.Zip),$(i.ControlsPrefix.txtZip).attr("placeholder",lblRow.Zip),$(i.ControlsPrefix.lblStatePopup).text(lblRow.State),$(i.ControlsPrefix.lblCityPopup).text(lblRow.City),$(i.ControlsPrefix.txtCity).attr("placeholder",lblRow.City),i.model.IsStateless=lblRow.IsStateless,i.model.IsZipless=lblRow.IsZipless,0==lblRow.IsStateDropDown?($(i.ControlsPrefix.txtState).show(),$(i.ControlsPrefix.ddlState).hide(),$(i.ControlsPrefix.dvDdlState).removeClass()):($(i.ControlsPrefix.txtState).hide(),$(i.ControlsPrefix.ddlState).show(),$(i.ControlsPrefix.dvDdlState).addClass("dropdowndiv")),t=i.model.countryFlag[e],$(".flag-"+t).addClass("active"),f(),$(i.ControlsPrefix.AddressControllerCountry).removeClass().addClass("selectedcountry "+t),$(i.ControlsPrefix.myCountryPopup).removeClass(),$(i.ControlsPrefix.myCountryPopup).addClass("selectedcountry "+t),$(".selectoptionpopup").css("display","none"),$(".selectoptionpopup").removeClass("active"),$(i.ControlsPrefix.txtZip).val(""),$(i.ControlsPrefix.txtCity).val(""),$(i.ControlsPrefix.txtStreet).val(""),$(i.ControlsPrefix.txtStreet1).val(""),$(i.ControlsPrefix.txtState).val("")},C=(e,t)=>{t?($(e).fadeIn("fast"),$("html").addClass("popupscroll"),$("body").css("overflow","hidden"),$(e).addClass("in"),$("#pnlCustomer").length&&"none"!==$("#pnlCustomer").css("display")&&$("#pnlCustomer").removeAttr("tabindex"),$(i.ControlsPrefix.txtStreet).focus()):($(e).fadeOut("fast"),$(e).removeClass("in"),$("html").removeClass("popupscroll"),$("body").css("overflow","auto"),$("#pnlCustomer").length&&"none"!==$("#pnlCustomer").css("display")&&$("#pnlCustomer").attr("tabindex","-1"))},y=e=>{if(1==e){if($(i.ControlsPrefix.txtCity).removeClass("errorInput").val(t.AddressData.city),$(i.ControlsPrefix.txtZip).removeClass("errorInput").val(t.AddressData.zip),$(i.ControlsPrefix.txtStreet).attr("maxlength",500).removeClass("errorInput").val(t.AddressData.address),$(i.ControlsPrefix.txtState).val(t.AddressData.state),u(t.Address2Control)||(t.AddressData.address2=$(t.Address2Control).val()),$(i.ControlsPrefix.txtStreet1).val(t.AddressData.address2),""!=t.AddressData.zip&&t.AddressData.country>0){var a={};a.CountryID=parseInt(t.AddressData.country),a.StrZipCode=$.trim(t.AddressData.zip),a.CountryCode=i.model.countryMapForAPI[i.model.CountryId],o(m(i.ApiURLEnum.getStateCode),a,b,S,!1,!1,!0)}return void 0!==setPopupPosi&&void 0!==getQueryStringData&&"Builder"==getQueryStringData("Type")&&($(i.ControlsPrefix.addressPopup).addClass("wb-general-addresspopup"),$(i.ControlsPrefix.addressPopup).after('<div class="wbgeneraladdresspopup-backdrop"></div>'),setPopupPosi(i.ControlsPrefix.addressPopup)),C(i.ControlsPrefix.addressPopup,!0),!1}return void 0!==setPopupPosi&&void 0!==getQueryStringData&&"Builder"==getQueryStringData("Type")&&($(i.ControlsPrefix.addressPopup).css({top:"",bottom:""}),$(".wbgeneraladdresspopup-backdrop").remove(),$(i.ControlsPrefix.addressPopup).removeClass("wb-general-addresspopup")),C(i.ControlsPrefix.addressPopup,!1),"undefined"!=typeof SelectedOption&&"2"==SelectedOption&&$("#txtCalAppointmentAddress").val(""),!1},b=e=>{if(1e3==e.ResponseCode){res=e.Data;var t=res.split("|")[0],a=u(res)?0:1*res.split("|")[1],r=res.split("|")[2];$(i.ControlsPrefix.txtCity).val(t),$(i.ControlsPrefix.txtState).val(r),$(i.ControlsPrefix.ddlState).val(a)}},S=e=>{swal({title:"Failed to validate address details.",text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn"},function(e){swal.close()})},k=e=>{if(Object.keys(t.AddressData).length>0){t.AddressData.state=null==t.AddressData.state?"":t.AddressData.state,t.AddressData.zip=null==t.AddressData.zip?"":t.AddressData.zip;var a=t.AddressData.address;a=a+(""!=a?", ":"")+t.AddressData.city,2==t.AddressData.country&&(u(t.AddressData.state)?i.model.IsStateless=1:i.model.IsStateless=0),0==i.model.IsStateless&&(a=a+(""!=a&&""!=t.AddressData.state?", ":"")+t.AddressData.state),a=a+(""!=a&&""!=t.AddressData.zip?", ":"")+t.AddressData.zip,e?(t.Control.select2("val",a),$(".select2-results").empty(),void 0===t.AddressData.address2||u(t.Address2Control)||$(t.Address2Control).val(t.AddressData.address2)):t.Control.select2("val",a),1==t.IsAddManualAddress&&1==t.IsSaveManualAddress&&(t.IsAddManualAddress=!1,t.IsSaveManualAddress=!1,SaveAddressData()),1==t.IsSaveManualAddress&&(t.IsDistance=!0,t.IsSaveManualAddress=!1),1==t.IsDistance&&"undefined"!=typeof GetDistance&&(GetDistance(a),t.IsDistance=!1)}},D=e=>{if("undefined"!=typeof isFromVagaroProduct&&null!=isFromVagaroProduct&&1==isFromVagaroProduct)for(var a=$(".general-addresspopup").length,r=1;r<a;r++)null!=$(".general-addresspopup")[r]&&null!=$(".general-addresspopup")[r]&&$(".general-addresspopup")[r].remove();var o=!1;return $(".validAddress"+t.ControlId).each(function(){""==$(this).val().trim()&&(!this.id.includes("txtZip")||this.id.includes("txtZip")&&0==i.model.IsZipless)?(0==$(this).siblings("span").length&&($(this).addClass("errorInput"),$(this).after('<span id="rfv'+$(this).attr("id")+'" class="requiredErrorText" style="color:Red;">required</span>')),o=!0):0!=$(this).siblings("span").length&&($(this).next("span").remove(),$(this).removeClass("errorInput"))}),o?($(i.ControlsPrefix.addressPopup).find(".errorInput:first").focus(),!1):($(i.ControlsPrefix.txtState).is(":visible")||$(i.ControlsPrefix.txtState).val($(i.ControlsPrefix.ddlState+" option:selected").text()),0!=i.model.IsStateless||""!=$(i.ControlsPrefix.txtState).val().trim()&&"Select"!=$(i.ControlsPrefix.txtState).val().trim()?(1==i.model.IsZipless&&$(i.ControlsPrefix.txtZip).val(""),_(),!1):($(i.ControlsPrefix.txtState).next("span").remove(),$(i.ControlsPrefix.txtState).removeClass("errorInput"),0==i.model.IsZipless?($(i.ControlsPrefix.txtZip).addClass("errorInput"),swal({title:"System can't find State based on entered zipcode.Please enter valid zip.",text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn googlecontrolalert"},function(e){swal.close()})):($(i.ControlsPrefix.txtState).addClass("errorInput"),$(i.ControlsPrefix.txtState).after('<span id="rfv'+i.ControlsPrefix.txtState.replace("#","")+'" class="requiredErrorText" style="color:Red;">required</span>')),!1))},_=()=>{var e=$(i.ControlsPrefix.txtZip).val(),t=i.model.CountryId;if((""!=e||1==i.model.IsZipless)&&t>0){var a={};a.CountryID=parseInt(i.model.CountryId),a.StrZipCode=$(i.ControlsPrefix.txtZip).val().trim(),a.City=$(i.ControlsPrefix.txtCity).val().trim(),a.StateName=$(i.ControlsPrefix.txtState).val().trim(),a.Address=$(i.ControlsPrefix.txtStreet).val().trim()+" "+$(i.ControlsPrefix.txtCity).val().trim()+" "+$(i.ControlsPrefix.txtState).val().trim()+" "+$(i.ControlsPrefix.txtZip).val().trim(),a.IsStateless=1==i.model.IsStateless,a.CountryCode=i.model.countryMapForAPI[i.model.CountryId],o(m(i.ApiURLEnum.getStateCode),a,I,w,!1,!1,!0)}},I=e=>{if(1e3==e.ResponseCode){var a=e.Data;if(u(a))swal({title:"Wrong Address.",text:"",type:"",timer:6e3,showCancelButton:!1,confirmButtonColor:"#eb6663",customClass:"sweet-alert-model auto-footer-btton "});else{$(i.ControlsPrefix.ddlState).html(""),$(i.ControlsPrefix.ddlState).html('<option value="0">Select</option>'),t.AddressData={},t.AddressData.address=$(i.ControlsPrefix.txtStreet).val().trim(),t.AddressData.city=$(i.ControlsPrefix.txtCity).val().trim(),t.AddressData.state=$(i.ControlsPrefix.txtState).val().trim(),t.AddressData.zip=$(i.ControlsPrefix.txtZip).val().trim(),t.AddressData.country=i.model.CountryId,t.AddressData.address2=$(i.ControlsPrefix.txtStreet1).val().trim(),y();var r=a.split("|")[0],o=1*a.split("|")[1],n=a.split("|")[2];""!=r&&(t.AddressData.city=r,$(i.ControlsPrefix.txtCity).removeClass("errorInput").val(r),$(i.ControlsPrefix.txtCity).next("span").css("display","none")),0==u(n)&&(t.AddressData.state=n,t.AddressData.stateId=o,$(i.ControlsPrefix.ddlState).val(o),t.AddressData.statecode=a.split("|")[3]),k(!0)}}},w=e=>{swal({title:i.model.errorMessage,text:"",timer:4e3,type:"",showConfirmButton:!1,customClass:"swal-nobutton sweet-alert-model auto-footer-btton"},function(e){swal.close()})},P=()=>"undefined"!=typeof _glbPluginCountryList&&null!=_glbPluginCountryList&&0!=Object.keys(_glbPluginCountryList).length,T=()=>{2==i.model.CountryId?$(i.ControlsPrefix.dvWrap+" :input[type='text']").prop("placeholder",i.model.addressPlaceHolderUKOnly):$(i.ControlsPrefix.dvWrap+" :input[type='text']").prop("placeholder",i.model.addressPlaceHolder)};return a(),r(),{setAddressData:function(e){t.AddressData=e,(()=>{var e=t.AddressData.country,a=t.AddressData.address,r=t.AddressData.address2,o=t.AddressData.city,n=t.AddressData.state,s=t.AddressData.zip,l=!1;null!=e&&null==n&&p(e,"0"),u(n)?$(i.ControlsPrefix.txtState).val(""):($(i.ControlsPrefix.txtState).val(n),l=!0),u(a)?($(i.ControlsPrefix.txtStreet).val(""),t.AddressData.address=""):($(i.ControlsPrefix.txtStreet).val(a),l=!0),u(o)?($(i.ControlsPrefix.txtCity).val(""),t.AddressData.city=""):($(i.ControlsPrefix.txtCity).val(o),l=!0),u(s)?$(i.ControlsPrefix.txtZip).val(""):($(i.ControlsPrefix.txtZip).val(s),l=!0),u(r)?($(i.ControlsPrefix.txtStreet1).val(""),t.AddressData.address2=""):($(i.ControlsPrefix.txtStreet1).val(r),l=!0),p(e,"0"),k(),0==l&&(t.Control.select2("data",{id:null,text:null}),h())})()},getAddressData:function(){return 0==Object.keys(t.AddressData).length&&(t.AddressData.country=i.model.CountryId,t.AddressData.address="",t.AddressData.address2="",t.AddressData.city="",t.AddressData.state="",t.AddressData.zip=""),t.AddressData.IsReturnCountryID=t.IsReturnCountryID,u(t.AddressData.country)||(t.AddressData.countryName=i.model.countryName[t.AddressData.country],t.AddressData.countryCode=i.model.countryMapForAPI[t.AddressData.country]),t.AddressData},validateAddressData:function(e=!1,a=!1){if(u(a)||(t.IsDistance=a),""!=t.Control.val().trim()||1==e){if(0==Object.keys(t.AddressData).length||u(t.AddressData.city)||u(t.AddressData.state)&&0==i.model.IsStateless||u(t.AddressData.zip)&&0==i.model.IsZipless||u(t.AddressData.address)||1==e)return 1==e&&($("#mycountryPopupsubTitle"+t.ControlId).html(""),$("#mycountryPopupTitle"+t.ControlId).html("Change Address"),t.IsAddManualAddress=e),""!=t.Control.val()&&(null==typeof t.AddressData||""!=t.AddressData.address&&null!=t.AddressData.address||(t.AddressData.address=t.Control.val().trim())),o(m(i.ApiURLEnum.getState),{},g,v,!1,!1,!0),A(i.model.CountryId),y(1),!1}else{if(t.IsAddressRequired)return $(i.ControlsPrefix.addressControl).addClass("errorInput"),!1;t.AddressData={},$(i.ControlsPrefix.txtZip).val(""),$(i.ControlsPrefix.txtCity).val(""),$(i.ControlsPrefix.txtStreet).val(""),$(i.ControlsPrefix.txtStreet1).val(""),$(i.ControlsPrefix.txtState).val("")}return!0},setDisabledControl:function(e){t.IsDisabled=e,$(i.ControlsPrefix.addressControl).attr("disabled",e),$(i.ControlsPrefix.ddlMainCountry).attr("disabled",e),$(i.ControlsPrefix.ddlPopupCountry).attr("disabled",e);var a=i.model.countryFlag[i.model.CountryId];$(i.ControlsPrefix.AddressControllerCountry).removeClass(),$(i.ControlsPrefix.AddressControllerCountry).addClass("selectedcountry "+(1==e?"select2-container-disabled ":"")+a)},setDisabledCountry:function(e){t.DisabledCountry=e,t.IsReturnCountryID=e,$(i.ControlsPrefix.ddlMainCountry).attr("disabled",e),$(i.ControlsPrefix.ddlPopupCountry).attr("disabled",e);var a=i.model.countryFlag[i.model.CountryId];$(i.ControlsPrefix.AddressControllerCountry).removeClass(),$(i.ControlsPrefix.AddressControllerCountry).addClass("selectedcountry "+(1==e?"select2-container-disabled ":"")+a)},setAddressTwoData:function(e){t.AddressData.address2=e,$(i.ControlsPrefix.txtStreet1).val(t.AddressData.address2)}}},$(document).on("click",function(e){try{!1===$(e.target).is(".selectedcountry")&&$(".countryselectoption").length>0&&$(".countryselectoption").hide(),!1===$(e.target).is(".select2-container")&&$(".select2-dropdown-open").length>0&&$(".select2-dropdown-open").select2("close")}catch(e){}}),$.fn.PhonePlugin=function(e){var t=$.extend({Control:this,ControlId:this.attr("id"),CurrentLocationCountryID:1,CountryId:0,UserRole:2,ControlText:"Cell",IsPhoneNoRequire:!1,IsDisabled:!1,ScrollType:2,CellOldValue:"",ValidateReturnObject:{}},e),a={model:{countryFlag:{1:"us-f",2:"uk-f",3:"canada-f",4:"aus-f"},countryDialingCode:{1:"1",2:"44",3:"1",4:"61"},CountryId:void 0===t.CountryId||0==t.CountryId?"undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail&&""!=countryIdBusDetail?parseInt(countryIdBusDetail,10):t.CurrentLocationCountryID:t.CountryId,DialingCode:"+1",errorMessage:"Something went wrong, Try Again.",IsPaste:!1,IsSelected:!1,nDotCount:0,CountryList:{},CountryCode:"US"},ControlsPrefix:{PhoneControl:"#"+t.ControlId,PhoneControllerCountry:"#PhoneControllerCountry"+t.ControlId,countrySelectOption:"#countryselectoption"+t.ControlId,ddlMainCountry:"#ddlMainCountry"+t.ControlId,dvWrap:"#dvWrap"+t.ControlId,dvDialingCode:"#dvDialingCode"+t.ControlId},Message:{InvalidPhone:"Invalid ",InvalidLength:" should be of ",Required:" is required."},WarningType:{Required:1,InvalidPhone:2,InvalidLength:3}},r=()=>{if(I())o(_glbPluginCountryList);else{var e={},t={businessID:0,loginUserID:0};e.RegisterDeviceRequest=t,((e,t,i,a,r,o,n)=>{var s=new vagaro.ajax;s.datamodel.Token=e,s.datamodel.data=t,s.datamodel.callback=i,s.datamodel.Error=a,void 0!==n&&null!=n&&1==n&&(s.datamodel.IsNewVagaroAPI=!0),void 0!==o&&1==o&&(s.datamodel.ErrorMessage=""),r?s.PostQue():s.Post()})("GetAllCountryList",e,o,s,!1,!0)}},o=e=>{if(void 0!==e&&null!=e&&e.length>0){I()||(_glbPluginCountryList=e),a.model.countryFlag={},a.model.countryDialingCode={},a.model.CountryList=e;var i='<optgroup label="Current Location">',r='<optgroup label="Other Locations">';e.sort((e,t)=>{var i=e.CountryName.toUpperCase(),a=t.CountryName.toUpperCase();return i<a?-1:i>a?1:0}),$.each(e,function(e,o){if(2==t.UserRole||1==t.UserRole&&!l(o.IsBusinessUseOnly)&&1==o.IsBusinessUseOnly){var n="liFront"+t.ControlId+e;o.CSSClass,o.CountryName,o.DialingCode;$("#"+n).bind("click",function(){a.model.CountryId=o.CountryID,a.model.DialingCode=o.DialingCode,d()}),a.model.countryFlag[o.CountryID]=o.CSSClass,a.model.countryDialingCode[o.CountryID]=o.DialingCode,o.CountryID==("undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail&&""!=countryIdBusDetail?parseInt(countryIdBusDetail,10):t.CurrentLocationCountryID)?i+=' <option class="'+o.CSSClass+'" value="'+o.CountryID+'">'+o.CountryName+"+"+o.DialingCode+"</option> </optgroup >":r+=' <option class="'+o.CSSClass+'" value="'+o.CountryID+'">'+o.CountryName+"+"+o.DialingCode+"</option>"}}),r+="</optgroup >",$(a.ControlsPrefix.ddlMainCountry).append(i+r),$(a.ControlsPrefix.ddlMainCountry).select2({searchInputPlaceholder:"Search for a Country",closeOnSelect:!1,dropdownCssClass:"all-country-flag",formatResult:n}).on("select2-selected",function(e){a.model.CountryId=parseInt(e.choice.id),d(),S(),setTimeout(function(){$(a.ControlsPrefix.PhoneControl).focus()},100)}).on("select2-opening",function(e){!1===$(e.target).is(".select2-container")&&$(".select2-dropdown-open").select2("close"),$(a.ControlsPrefix.ddlMainCountry).select2("data",{id:a.model.CountryId})}).on("select2-open",function(e){if(("undefined"==typeof IsMobileDevice||l(IsMobileDevice))&&(isiPhone=null!=navigator.userAgent.match(/iphone/i),isWindowsPhone=navigator.userAgent.match(/windows phone/i)||!1,AndroidMobile=null!=navigator.userAgent.match(/Android/i)&&null!=navigator.userAgent.match(/Mobile/i)&&null==navigator.userAgent.match(/Windows/i),IsMobileDevice=/iPad/.test(navigator.userAgent)||isiPhone||isWindowsPhone||AndroidMobile||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&($(window).width()<=850||$(window).height()<=850)||/androidcheckin/.test(navigator.userAgent)),1==IsMobileDevice&&$(".select2-input text-primary demo, :focus,input").prop("focus",!1).blur(),this.selectedIndex>0){var i=$("#select2-drop .select2-results"),a=i.find(".select2-highlighted").position().top;1==t.ScrollType?i.scrollTop(a+i.scrollTop()):i.scrollTop(a)}}),d(),S()}},n=e=>{var t=e.text.split("+");return $('<span class="'+e.css+'" >'+t[0]+'</span><span class="country-code-text" >'+(1==l(t[1])?"":"+"+t[1])+"</span>")},s=e=>{swal({title:a.model.errorMessage,text:"",timer:4e3,type:"error",showConfirmButton:!1,customClass:"swal-nobutton swal-white-greenbtn"},function(e){swal.close()})},l=e=>void 0===e||null==e||""==e||null==e,d=()=>{0==a.model.CountryId&&(a.model.CountryId=1),void 0!==a.model.countryFlag[a.model.CountryId]&&null!=a.model.countryFlag[a.model.CountryId]||(a.model.CountryId=1),a.model.CountryId="undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail&&""!=countryIdBusDetail?parseInt(countryIdBusDetail,10):a.model.CountryId;var e=a.model.countryFlag[a.model.CountryId];l(e)&&(a.model.CountryId=t.CurrentLocationCountryID,e=a.model.countryFlag[a.model.CountryId]),a.model.DialingCode=a.model.countryDialingCode[a.model.CountryId],$(a.ControlsPrefix.PhoneControllerCountry).removeClass(),$(a.ControlsPrefix.PhoneControllerCountry).addClass("selectedcountry "+e),$(a.ControlsPrefix.myCountryPopup).removeClass(),$(a.ControlsPrefix.myCountryPopup).addClass("selectedcountry "+e),$(a.ControlsPrefix.countrySelectOption).removeAttr("style").attr("style","display:none"),$(a.ControlsPrefix.countrySelectOption).removeClass("active"),$(a.ControlsPrefix.dvWrap).removeClass(),$(a.ControlsPrefix.dvWrap).addClass("select-country-mar vg-select-icon-mar input-focus-relative "+e),$(a.ControlsPrefix.dvDialingCode).text("+"+a.model.DialingCode)},c=()=>{u(),h(3,0),C()},u=()=>{var e=t.Control,i=$(e).val().trim();$(e).val(p(i))},p=e=>(e.match(/(<([^>]+)>)/gi)&&(e=e.replace(/(<([^>]+)>)/gi,"")),e),h=(e,t)=>{var i=$(a.ControlsPrefix.PhoneControl);nDotCount=0;var r=0;if(i.val(m(f(i.val(),e),20)),1==e&&1==v(i.val())){if(i.val(Math.round(i.val()*Math.pow(10,t))/Math.pow(10,t)),0==v(i.val()))for(r=0;r<t;r++)0;else if(i.val().length-1-A(i.val())<t)for(r=i.val().length-1-A(i.val());r<t;r++)0}else if(1==e&&0==v(i.val()))for(i.val(Math.round(i.val()*Math.pow(10,t))/Math.pow(10,t)),r=0;r<t;r++)0},m=(e,t)=>{if(t>0&&t<e.length){var i=e.split(""),a="",r=0;for(r=0;r<t;r++)a+=i[r];return a}return e},f=(e,t)=>{var i="",a=e.length,r=e.split(""),o=0,n=0;for(n=0;n<a;n++)1==g(r[n],t)&&(1==t?"."==r[n]&&0==o&&1!=nDotCount?(i+=r[n],o+=1,nDotCount=1):"."!=r[n]&&(i+=r[n]):i+=r[n]);return i},g=(e,t)=>{var a;0==t?a="0123456789":1==t?a="0123456789.":2==t?a="0123456789 ":3==t&&(a="0123456789()- ");var r,o=!0;for(i=0;i<e.length&&1==o;i++)r=e.charAt(i),-1==a.indexOf(r)&&(o=!1);return o},v=e=>{var t=0,i=!1;for(t=0;t<e.length;t++)"."==e.charAt(t)&&(i=!0);return i},A=e=>{var t=0,i=0;for(t=0;t<e.length;t++)"."==e.charAt(t)&&(i=t);return i},C=(e=!1)=>{var i=$(a.ControlsPrefix.PhoneControl),r=!0,o=a.model.CountryId,n="",s=0;if(i.val().length>0){var d=i.val().replace(/[^0-9.]/g,"").trim();if("undefined"!=typeof _sharing&&null!=_sharing&&void 0!==_sharing.SelectedFFRelation&&null!=_sharing.SelectedFFRelation&&""!=_sharing.SelectedFFRelation&&"child"==_sharing.SelectedFFRelation.toLowerCase()&&""===d)return!e||{isSucess:!0,WarningMessage:"",WarningType:0};var c="";if(o<=4)Minlength=4==o||2==o?9:10,Maxlength=4==o||2==o?11:10,c=Minlength==Maxlength?" 10 ":" 9 to 11 ",""==i.val().replace(/[^0-9.]/g,"").trim()?(r=!1,n="Please enter "+t.ControlText+".",s=a.WarningType.Required):(i.val().trim().match(/\d/g).length<Minlength||i.val().trim().match(/\d/g).length>Maxlength)&&(r=!1,n=t.ControlText+a.Message.InvalidLength+c+"digits.",s=a.WarningType.InvalidLength);else{var u=new libphonenumber.AsYouType(_(a.model.CountryId).CountryCode);u.input(i.val().replace(/[^0-9.]/g,""));r=u.isValid()}}else 1==t.IsPhoneNoRequire&&(r=!1,s=a.WarningType.Required,n=t.ControlText+a.Message.Required);return r?i.removeClass("errorInput"):(i.addClass("errorInput"),0==e&&(s=l(n)?a.WarningType.InvalidPhone:s,"undefined"!=typeof Webflow&&null!=Webflow&&void 0!==Webflow.require&&null!=Webflow.require&&k(l(n)?a.Message.InvalidPhone+t.ControlText+".":n))),0==e?r:(ValidateCellNoResult={},ValidateCellNoResult.WarningMessage=l(n)?a.Message.InvalidPhone+t.ControlText+".":n,ValidateCellNoResult.isSucess=r,ValidateCellNoResult.WarningType=s,ValidateCellNoResult)},y=(e,i)=>{var r=t.Control;if("Microsoft Internet Explorer"==navigator.appName){if(a.model.IsSelected){a.model.nDotCount=0;var o=m(b(r.val(),i),11);r.val(o),a.model.IsSelected=!1}8!=e.keyCode&&46!=e.keyCode||v(r.val())||(a.model.nDotCount=0),""==r.val()&&(a.model.nDotCount=0)}else{if("keyup"==e.type&&a.model.IsPaste){a.model.nDotCount=0;o=m(b(r.val(),i),11);r.val(o),a.model.IsPaste=!1}8!=e.which&&46!=e.which||v(r.val())||(a.model.nDotCount=0),""==r.val()&&(a.model.nDotCount=0)}},b=(e,t)=>{var i="",r=e.length,o=e.split(""),n=0,s=0;for(s=0;s<r;s++)1==g(o[s],t)&&(1==t?"."==o[s]&&0==n&&1!=a.model.nDotCount?(i+=o[s],n+=1,a.model.nDotCount=1):"."!=o[s]&&(i+=o[s]):i+=o[s]);return i},S=()=>{var e=a.model.CountryId,i=$(a.ControlsPrefix.PhoneControl);if(void 0!==e&&null!=e&&""!=e){var r=i.val().replace(/([()-\s])+/g,""),o=r.length;if(o<=0)return;if(11==o&&0==r[0]&&parseInt(e)<=4&&(t.CellOldValue=r,o=(r=r.substring(1)).length),"1"!=e&&"3"!=e||10!=o)if("2"==e)o>=9&&o<=11&&(s="1"==r.substring(0,1)?r.replace(/(\d{4})\-?(\d{6})/,"$1 $2"):"2"==r.substring(0,1)?r.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3"):"7"==r.substring(0,1)?r.replace(/(\d{4})\-?(\d{3})\-?(\d{3})/,"$1 $2 $3"):r.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3"),t.CellOldValue==s&&i.val()==t.CellOldValue||(i.val(s),t.CellOldValue=s));else if("4"==e){if(o>=9&&o<=11){s=r.replace(/(\d{1})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3");10==o&&(s=r.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3")),t.CellOldValue==s&&i.val()==t.CellOldValue||(i.val(s),t.CellOldValue=s)}}else{var n=new libphonenumber.AsYouType(_(a.model.CountryId).CountryCode);s=n.input(r);!n.isValid()||t.CellOldValue==s&&i.val()==t.CellOldValue||(i.val(s),t.CellOldValue=s)}else if("3"==e){var s=r.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"$1-$2-$3");t.CellOldValue==s&&i.val()==t.CellOldValue||(i.val(s),t.CellOldValue=s)}else{var s=r.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1) $2-$3");t.CellOldValue==s&&i.val()==t.CellOldValue||(i.val(s),t.CellOldValue=s)}}else{s=i.val().replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1)-$2-$3");i.val(s)}},k=e=>{$(".banner-warning .text-block-28").html(e);var t=Webflow.require("ix"),i=$(".banner-warning"),a=D(e);if("undefined"!=typeof ver)if(ver[0]<=9){var r={type:"click",preserve3d:!0,stepsA:[{display:"-webkit-flex",transition:"transform 300ms ease 0",x:"0px",y:"50px",z:"0px"},{wait:a},{transition:"transform 300 ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};t.run(r,i)}else{r={type:"click",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 300ms ease 0",x:"0px",y:"50px",z:"0px"},{wait:a},{transition:"transform 300 ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};t.run(r,i)}else{r={type:"click",preserve3d:!0,stepsA:[{display:"flex",transition:"transform 300ms ease 0",x:"0px",y:"50px",z:"0px"},{wait:a},{transition:"transform 300 ease 0",x:"0px",y:"0px",z:"0px"},{display:"none"}],stepsB:[]};t.run(r,i)}},D=e=>{var t="2s";return""!=e&&e.length>0&&(e.length<50?t="2s":e.length<100?t="3s":e.length<200?t="4s":e.length>200&&(t="7s")),t},_=e=>(Country=jQuery.grep(a.model.CountryList,function(t){return t.CountryID==parseInt(e)}),Country[0]),I=()=>"undefined"!=typeof _glbPluginCountryList&&null!=_glbPluginCountryList&&0!=Object.keys(_glbPluginCountryList).length;return l(t.ControlId)||(()=>{var e=t.ControlId,i=document.getElementById(e).tabIndex;$("#"+e).wrap('<div id="dvWrap'+e+'" class="select-country-mar vg-select-icon-mar input-focus-relative address-phone-plugin">').parent().wrap('<div class="addresswithcountry vagaro-dropdown-icon clearfix">');var o=' <div class="w-custom-dropdown countrydropdown allflag-show">';a.ControlsPrefix.countrySelectOption,o+='<div id="PhoneControllerCountry'+e+'" class="selectedcountry" ></div > ',o+='<div id="dvDialingCode'+e+'" class="country-code" >+1</div > ',o+='<select id="ddlMainCountry'+e+'" class="form-control" tabindex="'+i+'">  </select>',o+="</div>",o+='<ul id="countryselectoption'+e+'" class="countryselectoption" style="display: none">',o+=" </ul>",$("#countryselectoption"+e).length<=0&&(null!=$("#"+e).parent()?$("#"+e).parent().before(o):$("#"+e).before(o),r(),$(a.ControlsPrefix.PhoneControl).on("blur",function(){c()}),$(a.ControlsPrefix.PhoneControl).on("keyup",function(e){S(),y(e,3)}),$(a.ControlsPrefix.PhoneControllerCountry).bind("click",function(){t.IsDisabled||$(a.ControlsPrefix.countrySelectOption).is(":visible")||$(".countryselectoption").hide()}))})(),{validatePhoneNumber:function(e=!1,i=null,a=null){if(0==e)return C(e);null!=typeof a&&null!=a&&(a.IsValid=!0);var r=C(e);return null!=typeof a&&null!=a&&(a.IsValid=r.isSucess),0==r.isSucess?(t.ValidateReturnObject=r,null!=i&&($(i).html(r.WarningMessage),$(i).show()),r.isSucess):(null!=i&&$(i).hide(),r.isSucess)},setPhoneData:function(e,i){return a.model.CountryId=e,t.CellOldValue="",l(i)||$(a.ControlsPrefix.PhoneControl).val(i),d(),S(),$(a.ControlsPrefix.PhoneControl).val()},getPhoneData:function(){var e={};e.countryId=parseInt(a.model.CountryId);var t="",i="";return null!=$(a.ControlsPrefix.PhoneControl).val()&&""!=$(a.ControlsPrefix.PhoneControl).val()&&(t=$(a.ControlsPrefix.PhoneControl).val().replace(/([()-\s])+/g,""),i=e.countryId>5?t:2==e.countryId?t.length>11?t.substring(1):t:t.length>10?t.substring(1):t),e.phoneNo=i,e.dialingCode=a.model.DialingCode,e.countryCode=_(a.model.CountryId).CountryCode,e},getCountryId:function(){return a.model.CountryId},setDisabledControl:function(e){t.IsDisabled=e,$(a.ControlsPrefix.PhoneControl).attr("disabled",e),$(a.ControlsPrefix.ddlMainCountry).attr("disabled",e);var i=a.model.countryFlag[a.model.CountryId];$(a.ControlsPrefix.PhoneControllerCountry).removeClass(),$(a.ControlsPrefix.PhoneControllerCountry).addClass("selectedcountry "+(1==e?"select2-container-disabled ":"")+i)},setDisabledCountry:function(e){t.IsDisabled=e,$(a.ControlsPrefix.ddlMainCountry).attr("disabled",e);var i=a.model.countryFlag[a.model.CountryId];$(a.ControlsPrefix.PhoneControllerCountry).removeClass(),$(a.ControlsPrefix.PhoneControllerCountry).addClass("selectedcountry "+(1==e?"select2-container-disabled ":"")+i)},getCountryList:function(){return a.model.CountryList},getdialingCode:function(e){return e>0?_(e).DialingCode:""},getphoneformat:function(e,i){if(void 0!==i&&null!=i&&""!=i){var a=null==e?"":e.replace(/([()-\s])+/g,""),r=a.length;if(r<=0)return;if(0==a[0]&&parseInt(i)<=4&&(t.CellOldValue=a,r=(a=a.substring(1)).length),!("1"!=i&&"3"!=i||9!=r&&10!=r))return"3"==i?a.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"$1-$2-$3"):a.replace(/(\d{3})\-?(\d{3})\-?(\d{4})/,"($1) $2-$3");if("2"==i){if(9==r||10==r)return"1"==a.substring(0,1)?a.replace(/(\d{4})\-?(\d{6})/,"$1 $2"):"2"==a.substring(0,1)?a.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3"):"7"==a.substring(0,1)?a.replace(/(\d{4})\-?(\d{3})\-?(\d{3})/,"$1 $2 $3"):a.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"$1 $2 $3")}else{if("4"!=i)return new libphonenumber.AsYouType(_(i>0?i:1).CountryCode).input(e);if(8==r||9==r)return a.replace(/(\d{1})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3");if(10==r)return a.replace(/(\d{2})\-?(\d{4})\-?(\d{4})/,"($1) $2 $3")}}return e},getValidateMessage:function(){return t.ValidateReturnObject}}},$(document).on("click",function(e){try{!1===$(e.target).is(".select2-container")&&$(".select2-dropdown-open").length>0&&$(".select2-dropdown-open").select2("close")}catch(e){}}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).libphonenumber={})}(this,function(e){"use strict";var t={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6],0,0,0,0,0,0,0,[["6[2-467]\\d{3}",[5]],["4\\d{4}",[5]],0,0,0,0,["(?:0[1-9]|[1589]\\d)\\d{4}",[6]]]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[["[78]\\d{5}",[6]],["690\\d{6}|[356]\\d{5}",[6,9]],["180[02]\\d{4}",[8]],["[19]\\d{5}",[6]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0",0,0,0,0,0,[["[2-4679][2-8]\\d{6}",[8]],["5[024-68]\\d{7}",[9]],["400\\d{6}|800\\d{2,9}"],["900[02]\\d{5}",[9]],0,0,["600[25]\\d{5}",[9]],0,0,["700[05]\\d{5}",[9]]]],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0",0,0,0,0,0,[["(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}"],["7\\d{8}"]]],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([457]\\d{6})$","268$1",0,"268",[["268(?:4(?:6[0-38]|84)|56[0-2])\\d{4}"],["268(?:464|7(?:1[3-9]|[28]\\d|3[0246]|64|7[0-689]))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,0,["26840[69]\\d{4}"],["26848[01]\\d{4}"]]],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2457]\\d{6})$","264$1",0,"264",[["264(?:292|4(?:6[12]|9[78]))\\d{4}"],["264(?:235|4(?:69|76)|5(?:3[6-9]|8[1-4])|7(?:29|72))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,0,["264724\\d{4}"]]],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0",0,0,0,0,0,[["4505[0-2]\\d{3}|(?:[2358][16-9]\\d[2-9]|4410)\\d{4}|(?:[2358][2-5][2-9]|4(?:[2-57-9][2-9]|6\\d))\\d{5}",[8]],["6(?:[78][2-9]|9\\d)\\d{6}",[9]],["800\\d{4}",[7]],["900[1-9]\\d\\d",[6]],["700[2-9]\\d{4}",[8]],0,0,0,0,["808[1-9]\\d\\d",[6]]]],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:1[0-25]|47)\\d|2(?:2[2-46]|3[1-8]|4[2-69]|5[2-7]|6[1-9]|8[1-7])|3[12]2)\\d{5}"],["(?:33|4[1349]|55|77|88|9[13-9])\\d{6}"],["800\\d{5}"],["90[016]\\d{5}"],0,0,0,0,["60(?:2[78]|3[5-9]|4[02-9]|5[0-46-9]|[6-8]\\d|9[01])\\d{4}"],["80[1-4]\\d{5}"]]],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]],0,0,0,0,0,0,[["2\\d(?:[0134][25-9]|[25-9]\\d)\\d{5}"],["9[1-59]\\d{7}"]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1",0,0,[["3888[013-9]\\d{5}|3(?:7(?:1[15]|81)|8(?:21|4[16]|69|9[12]))[46]\\d{5}|(?:29(?:54|66)|3(?:7(?:55|77)|865))[2-8]\\d{5}|(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|(?:2(?:284|3(?:02|23)|657|920)|3(?:4(?:8[27]|92)|541|878))[2-7]\\d{5}|(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:[47]6|62|89)|564))[2-6]\\d{5}|(?:(?:11[1-8]|670)\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-7]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6])))\\d{6}|2(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}",[10]],["93(?:7(?:1[15]|81)[46]|8(?:(?:21|4[16]|69|9[12])[46]|88[013-9]))\\d{5}|9(?:29(?:54|66)|3(?:7(?:55|77)|865))[2-8]\\d{5}|9(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|9(?:2(?:284|3(?:02|23)|657|920)|3(?:4(?:8[27]|92)|541|878))[2-7]\\d{5}|9(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:[47]6|62|89)|564))[2-6]\\d{5}|(?:675\\d|9(?:11[1-8]\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-7]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6]))))\\d{6}|92(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|9(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|9(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}"],["800\\d{7,8}"],["60[04579]\\d{7}",[10]],0,0,["810\\d{7}",[10]]]],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"1|([267]\\d{6})$","684$1",0,"684",[["6846(?:22|33|44|55|77|88|9[19])\\d{4}"],["684(?:2(?:48|5[2468]|72)|7(?:3[13]|70|82))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0",0,0,0,0,0,[["1(?:11\\d|[2-9]\\d{3,11})|(?:316|463|(?:51|66|73)2)\\d{3,10}|(?:2(?:1[467]|2[13-8]|5[2357]|6[1-46-8]|7[1-8]|8[124-7]|9[1458])|3(?:1[1-578]|3[23568]|4[5-7]|5[1378]|6[1-38]|8[3-68])|4(?:2[1-8]|35|7[1368]|8[2457])|5(?:2[1-8]|3[357]|4[147]|5[12578]|6[37])|6(?:13|2[1-47]|4[135-8]|5[468])|7(?:2[1-8]|35|4[13478]|5[68]|6[16-8]|7[1-6]|9[45]))\\d{4,10}"],["6(?:5[0-3579]|6[013-9]|[7-9]\\d)\\d{4,10}",[7,8,9,10,11,12,13]],["800\\d{6,10}",[9,10,11,12,13]],["(?:8[69][2-68]|9(?:0[01]|3[019]))\\d{6,10}",[9,10,11,12,13]],0,0,0,0,["5(?:0[1-9]|17|[79]\\d)\\d{2,10}|7[28]0\\d{6,10}",[5,6,7,8,9,10,11,12,13]],["8(?:10|2[018])\\d{6,10}|828\\d{5}",[8,9,10,11,12,13]]]],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"0|(183[12])",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]],0,0,0,0,0,0,[["5(?:2\\d|8[1-9])\\d{4}"],["(?:290|5[69]\\d|6(?:[03]0|22|4[0-2]|[69]\\d)|7(?:[34]\\d|7[07])|9(?:6[45]|9[4-8]))\\d{4}"],["800\\d{4}"],["900\\d{4}"],0,0,0,0,["(?:28\\d|501)\\d{4}"]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",[["18[1-8]\\d{3,6}",[6,7,8,9]],["4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}",[6,7,8,9,10]],["800\\d{4,6}",[7,8,9]],["[67]00\\d{5,6}",[8,9]],0,0,["20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}"]],"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:2[12]428|3655[02])\\d{4}|(?:2(?:22[0-79]|63[0-28])|3654)\\d{5}|(?:(?:1[28]|46)\\d|2(?:[014-6]2|[23]3))\\d{6}"],["36554\\d{4}|(?:[16]0|4[04]|5[015]|7[07]|99)\\d{7}"],["88\\d{7}"],["900200\\d{3}"]]],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0",0,0,0,0,0,[["(?:3(?:[05-79][2-9]|1[4579]|[23][24-9]|4[2-4689]|8[2457-9])|49[2-579]|5(?:0[2-49]|[13][2-9]|[268][2-4679]|4[4689]|5[2-79]|7[2-69]|9[2-4689]))\\d{5}",[8]],["6040\\d{5}|6(?:03|[1-356]|44|7\\d)\\d{6}"],["8[08]\\d{6}",[8]],["9[0246]\\d{6}",[8]],0,0,["703[235]0\\d{3}|70(?:2[0-5]|3[0146]|[56]0)\\d{4}",[8]],0,0,["8[12]\\d{6}",[8]]]],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","246$1",0,"246",[["246521[0369]\\d{3}|246(?:2(?:2[78]|7[0-4])|4(?:1[024-6]|2\\d|3[2-9])|5(?:20|[34]\\d|54|7[1-3])|6(?:2\\d|38)|7[35]7|9(?:1[89]|63))\\d{4}"],["246(?:(?:2(?:[3568]\\d|4[0-57-9])|3(?:5[2-9]|6[0-6])|4(?:46|5\\d)|69[5-7]|8(?:[2-5]\\d|83))\\d|52(?:1[147]|20))\\d{3}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["(?:246976|900[2-9]\\d\\d)\\d{4}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,["246(?:292|367|4(?:1[7-9]|3[01]|4[47-9]|67)|7(?:1[2-9]|2\\d|3[016]|53))\\d{4}"],0,["24631\\d{5}"]]],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:28|4[14]|5)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0",0,0,0,0,0,[["(?:4(?:31\\d\\d|423)|5222)\\d{3}(?:\\d{2})?|8332[6-9]\\d\\d|(?:3(?:03[56]|224)|4(?:22[25]|653))\\d{3,4}|(?:3(?:42[47]|529|823)|4(?:027|525|65(?:28|8))|562|6257|7(?:1(?:5[3-5]|6[12]|7[156]|89)|22[589]56|32|42675|52(?:[25689](?:56|8)|[347]8)|71(?:6[1267]|75|89)|92374)|82(?:2[59]|32)56|9(?:03[23]56|23(?:256|373)|31|5(?:1|2[4589]56)))\\d{3}|(?:3(?:02[348]|22[35]|324|422)|4(?:22[67]|32[236-9]|6(?:2[46]|5[57])|953)|5526|6(?:024|6655)|81)\\d{4,5}|(?:2(?:7(?:1[0-267]|2[0-289]|3[0-29]|4[01]|5[1-3]|6[013]|7[0178]|91)|8(?:0[125]|1[1-6]|2[0157-9]|3[1-69]|41|6[1-35]|7[1-5]|8[1-8]|9[0-6])|9(?:0[0-2]|1[0-4]|2[568]|3[3-6]|5[5-7]|6[0136-9]|7[0-7]|8[014-9]))|3(?:0(?:2[025-79]|3[2-4])|181|22[12]|32[2356]|824)|4(?:02[09]|22[348]|32[045]|523|6(?:27|54))|666(?:22|53)|7(?:22[57-9]|42[56]|82[35])8|8(?:0[124-9]|2(?:181|2[02-4679]8)|4[12]|[5-7]2)|9(?:[04]2|2(?:2|328)|81))\\d{4}|(?:2(?:222|[45]\\d)\\d|3(?:1(?:2[5-7]|[5-7])|425|822)|4(?:033|1\\d|[257]1|332|4(?:2[246]|5[25])|6(?:2[35]|56|62)|8(?:23|54)|92[2-5])|5(?:02[03489]|22[457]|32[35-79]|42[46]|6(?:[18]|53)|724|826)|6(?:023|2(?:2[2-5]|5[3-5]|8)|32[3478]|42[34]|52[47]|6(?:[18]|6(?:2[34]|5[24]))|[78]2[2-5]|92[2-6])|7(?:02|21\\d|[3-589]1|6[12]|72[24])|8(?:217|3[12]|[5-7]1)|9[24]1)\\d{5}|(?:(?:3[2-8]|5[2-57-9]|6[03-589])1|4[4689][18])\\d{5}|[59]1\\d{5}"],["(?:1[13-9]\\d|644)\\d{7}|(?:3[78]|44|66)[02-9]\\d{7}",[10]],["80[03]\\d{7}",[10]],0,0,0,0,0,["96(?:0[469]|1[0-47]|3[389]|6[69]|7[78])\\d{6}",[10]]]],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0",0,0,0,0,0,[["80[2-8]\\d{5}|(?:1[0-69]|[23][2-8]|4[23]|5\\d|6[013-57-9]|71|8[1-79]|9[2-4])\\d{6}",[8]],["4[5-9]\\d{7}",[9]],["800[1-9]\\d{4}",[8]],["(?:70(?:2[0-57]|3[04-7]|44|6[569]|7[0579])|90(?:0[0-8]|1[36]|2[0-3568]|3[0-689]|[47][2-68]|5[1-68]|6[0-378]|9[34679]))\\d{4}",[8]],0,0,["78(?:0[57]|1[014-8]|2[25]|3[15-8]|48|[56]0|7[06-8]|9\\d)\\d{4}",[8]],0,0,["7879\\d{4}",[8]]]],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]],0,0,0,0,0,0,[["2(?:0(?:49|5[23]|6[5-7]|9[016-9])|4(?:4[569]|5[4-6]|6[5-7]|7[0179])|5(?:[34]\\d|50|6[5-7]))\\d{4}"],["(?:0[1-35-7]|5[1-8]|[67]\\d)\\d{6}"]]],BG:["359","00","[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0",0,0,0,0,0,[["2\\d{5,7}|(?:43[1-6]|70[1-9])\\d{4,5}|(?:[36]\\d|4[124-7]|[57][1-9]|8[1-6]|9[1-7])\\d{5,6}",[6,7,8]],["(?:43[07-9]|99[69]\\d)\\d{5}|(?:8[7-9]|98)\\d{7}",[8,9]],["800\\d{5}",[8]],["90\\d{6}",[8]],0,0,0,0,0,["700\\d{5}",[8]]]],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[047]"]]],0,0,0,0,0,0,[["(?:1(?:3[1356]|6[0156]|7\\d)\\d|6(?:1[16]\\d|500|6(?:0\\d|3[12]|44|7[7-9]|88)|9[69][69])|7(?:1(?:11|78)|7\\d\\d))\\d{4}"],["(?:3(?:[1-79]\\d|8[0-47-9])\\d|6(?:3(?:00|33|6[16])|6(?:3[03-9]|[69]\\d|7[0-6])))\\d{4}"],["80\\d{6}"],["(?:87|9[014578])\\d{6}"],0,0,0,0,0,["84\\d{6}"]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]],0,0,0,0,0,0,[["(?:22|31)\\d{6}"],["(?:29|6[1257-9]|7[125-9])\\d{6}"]]],BJ:["229","00","(?:[25689]\\d|40)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]],0,0,0,0,0,0,[["2(?:02|1[037]|2[45]|3[68])\\d{5}"],["(?:40|5[1-9]|6\\d|9[013-9])\\d{6}"],0,0,0,0,["81\\d{6}"],0,["857[58]\\d{4}"]]],BL:["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","441$1",0,"441",[["441(?:[46]\\d\\d|5(?:4\\d|60|89))\\d{4}"],["441(?:[2378]\\d|5[0-39])\\d{5}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]],0,0,0,0,0,0,[["22[0-7]\\d{4}|(?:2[013-9]|[34]\\d|5[0-25-9])\\d{5}"],["(?:22[89]|[78]\\d\\d)\\d{4}"],0,0,0,0,0,0,["5[34]\\d{5}"]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?",0,0,0,[["(?:2(?:2\\d\\d|5(?:11|[258]\\d|9[67])|6(?:12|2\\d|9[34])|8(?:2[34]|39|62))|3(?:3\\d\\d|4(?:6\\d|8[24])|8(?:25|42|5[257]|86|9[25])|9(?:[27]\\d|3[2-4]|4[248]|5[24]|6[2-6]))|4(?:4\\d\\d|6(?:11|[24689]\\d|72)))\\d{4}",[8]],["[67]\\d{7}",[8]],["8001[07]\\d{4}",[9]]]],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]",[["(?:318[023]|41(?:6[023]|70)|7(?:1[578]|2[05]|50)\\d)\\d{3}"],["(?:31(?:8[14-8]|9[14578])|416[14-9]|7(?:0[01]|7[07]|8\\d|9[056])\\d)\\d{3}"]]],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2",0,0,[["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}",[10]],["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])(?:7|9\\d)\\d{7}",[10,11]],["800\\d{6,7}",[9,10]],["300\\d{6}|[59]00\\d{6,7}",[9,10]],0,0,0,0,0,["(?:30[03]\\d{3}|4(?:0(?:0\\d|20)|370))\\d{4}|300\\d{5}",[8,10]]]],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([3-8]\\d{6})$","242$1",0,"242",[["242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[347]|8[0-4]|9[2-467])|461|502|6(?:0[1-4]|12|2[013]|[45]0|7[67]|8[78]|9[89])|7(?:02|88))\\d{4}"],["242(?:3(?:5[79]|7[56]|95)|4(?:[23][1-9]|4[1-35-9]|5[1-8]|6[2-8]|7\\d|81)|5(?:2[45]|3[35]|44|5[1-46-9]|65|77)|6[34]6|7(?:27|38)|8(?:0[1-9]|1[02-9]|2\\d|[89]9))\\d{4}"],["242300\\d{4}|8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,["242225\\d{4}"]]],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]],0,0,0,0,0,0,[["(?:2[3-6]|[34][5-7]|5[236]|6[2-46]|7[246]|8[2-4])\\d{5}",[7]],["(?:1[67]|77)\\d{6}",[8]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-79]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["(?:2(?:4[0-48]|6[0-24]|9[0578])|3(?:1[0-35-9]|55|[69]\\d|7[013])|4(?:6[03]|7[1267]|9[0-5])|5(?:3[03489]|4[0489]|7[1-47]|88|9[0-49])|6(?:2[1-35]|5[149]|8[067]))\\d{4}",[7]],["(?:321|7(?:[1-7]\\d|8[01]))\\d{5}",[8]],["(?:0800|800\\d)\\d{6}",[10]],["90\\d{5}",[7]],0,0,0,0,["79(?:1(?:[01]\\d|2[0-7])|2[0-7]\\d)\\d{3}",[8]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,[["(?:1(?:5(?:1[1-5]|[24]\\d|6[2-4]|9[1-7])|6(?:[235]\\d|4[1-7])|7\\d\\d)|2(?:1(?:[246]\\d|3[0-35-9]|5[1-9])|2(?:[235]\\d|4[0-8])|3(?:[26]\\d|3[02-79]|4[024-7]|5[03-7])))\\d{5}",[9]],["(?:2(?:5[5-79]|9[1-9])|(?:33|44)\\d)\\d{6}",[9]],["800\\d{3,7}|8(?:0[13]|20\\d)\\d{7}"],["(?:810|902)\\d{7}",[10]],0,0,0,0,["249\\d{6}",[9]]],"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]],0,0,0,0,0,0,[["(?:2(?:[02]\\d|36|[68]0)|[3-58](?:[02]\\d|[68]0)|7(?:[02]\\d|32|[68]0))\\d{4}",[7]],["6[0-35-7]\\d{5}",[7]],["0800\\d{7}",[11]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|6[578])|4(?:03|1[68]|3[178]|50|68|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|13|39|47|72)|7(?:0[59]|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-7]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"0|([59]\\d{7})$","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,[["12\\d{7}|[1-6]\\d{6}"],["88\\d{5}|(?:8[0-59]|9[017-9])\\d{7}"]]],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]],0,0,0,0,0,0,[["2[12]\\d{6}"],["7[02457]\\d{6}"],0,["8776\\d{4}"]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]],0,0,0,0,0,0,[["222[1-589]\\d{5}"],["026(?:1[0-5]|6[6-9])\\d{4}|0(?:[14-6]\\d\\d|2(?:40|5[5-8]|6[07-9]))\\d{5}"],0,["80(?:0\\d\\d|120)\\d{4}"]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:2[12467]|3[1-4]|4[134]|5[256]|6[12]|[7-9]1)\\d{7}"],["7[35-9]\\d{7}"],["800\\d{6}"],["90[016]\\d{6}"],["878\\d{6}"],0,["5[18]\\d{7}"],["74[0248]\\d{6}"],0,["84[0248]\\d{6}"]]],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]],0,0,0,0,0,0,[["2(?:[15]\\d{3}|7(?:2(?:0[23]|1[2357]|[23][45]|4[3-5])|3(?:06|1[69]|[2-6]7)))\\d{5}"],["0704[0-7]\\d{5}|0(?:[15]\\d\\d|7(?:0[0-37-9]|[4-9][7-9]))\\d{6}"]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]],0,0,0,0,0,0,[["(?:2\\d|3[13-7]|4[1-5])\\d{3}"],["[578]\\d{4}"]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]],0,0,0,0,0,0,[["2(?:1982[0-6]|3314[05-9])\\d{3}|(?:2(?:1(?:160|962)|3(?:2\\d\\d|3(?:[0346]\\d|1[0-35-9]|2[1-9]|5[0-24-9]|7[0-3])|600)|646[59])|80[1-9]\\d\\d|9(?:3(?:[0-57-9]\\d\\d|6(?:0[02-9]|[1-9]\\d))|6(?:[0-8]\\d\\d|9(?:[02-79]\\d|1[05-9]))|7[1-9]\\d\\d|9(?:[03-9]\\d\\d|1(?:[0235-9]\\d|4[0-24-9])|2(?:[0-79]\\d|8[0-46-9]))))\\d{4}|(?:22|3[2-5]|[47][1-35]|5[1-3578]|6[13-57]|8[1-9]|9[2458])\\d{7}",[9]],["",[9]],["(?:123|8)00\\d{6}",[9,11]],0,0,0,0,0,["44\\d{7}",[9]],["600\\d{7,8}",[10,11]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]],0,0,0,0,0,0,[["2(?:22|33)\\d{6}",[9]],["(?:24[23]|6[25-9]\\d)\\d{6}",[9]],["88\\d{6,7}"]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","(?:10|2[0-57-9])(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"0|(1(?:[12]\\d|79)\\d\\d)",0,0,0,[["(?:10(?:[02-79]\\d\\d|[18](?:0[1-9]|[1-9]\\d))|21(?:[18](?:0[1-9]|[1-9]\\d)|[2-79]\\d\\d))\\d{5}|(?:43[35]|754)\\d{7,8}|8(?:078\\d{7}|51\\d{7,8})|(?:10|(?:2|85)1|43[35]|754)(?:100\\d\\d|95\\d{3,4})|(?:2[02-57-9]|3(?:11|7[179])|4(?:[15]1|3[12])|5(?:1\\d|2[37]|3[12]|51|7[13-79]|9[15])|7(?:[39]1|5[57]|6[09])|8(?:71|98))(?:[02-8]\\d{7}|1(?:0(?:0\\d\\d(?:\\d{3})?|[1-9]\\d{5})|[1-9]\\d{6})|9(?:[0-46-9]\\d{6}|5\\d{3}(?:\\d(?:\\d{2})?)?))|(?:3(?:1[02-9]|35|49|5\\d|7[02-68]|9[1-68])|4(?:1[02-9]|2[179]|3[46-9]|5[2-9]|6[47-9]|7\\d|8[23])|5(?:3[03-9]|4[36]|5[02-9]|6[1-46]|7[028]|80|9[2-46-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[17]\\d|2[248]|3[04-9]|4[3-6]|5[0-3689]|6[2368]|9[02-9])|8(?:1[236-8]|2[5-7]|3\\d|5[2-9]|7[02-9]|8[36-8]|9[1-7])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:[02-8]\\d{6}|1(?:0(?:0\\d\\d(?:\\d{2})?|[1-9]\\d{4})|[1-9]\\d{5})|9(?:[0-46-9]\\d{5}|5\\d{3,5}))",[7,8,9,10,11]],["1740[0-5]\\d{6}|1(?:[38]\\d|4[57]|[59][0-35-9]|6[25-7]|7[0-35-8])\\d{8}",[11]],["(?:(?:10|21)8|8)00\\d{7}",[10,12]],["16[08]\\d{5}",[8]],0,0,0,0,0,["400\\d{7}|950\\d{7,8}|(?:10|2[0-57-9]|3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))96\\d{3,4}",[7,8,9,10,11]]],"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["[39]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0(4(?:[14]4|56)|[579])?",0,0,0,[["60[124-8][2-9]\\d{6}",[10]],["3333(?:0(?:0\\d|1[0-5])|[4-9]\\d\\d)\\d{3}|(?:3(?:24[1-9]|3(?:00|3[0-24-9]))|9101)\\d{6}|3(?:0[0-5]|1\\d|2[0-3]|5[01]|70)\\d{7}",[10]],["1800\\d{7}",[11]],["19(?:0[01]|4[78])\\d{7}",[11]]]],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))",0,0,0,[["210[7-9]\\d{4}|2(?:[024-7]\\d|1[1-9])\\d{5}",[8]],["(?:3005\\d|6500[01])\\d{3}|(?:5[07]|6[0-4]|7[0-3]|8[3-9])\\d{6}",[8]],["800\\d{7}",[10]],["90[059]\\d{7}",[10]],0,0,0,0,["(?:210[0-6]|4\\d{3}|5100)\\d{4}",[8]]]],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["5"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:3[23]|48)\\d{4,6}|(?:31|4[36]|8(?:0[25]|78)\\d)\\d{6}|(?:2[1-4]|4[1257]|7\\d)\\d{5,6}"],["5\\d{7}",[8]],["800\\d{7}",[10]],0,0,0,0,0,0,["807\\d{7}",[10]]]],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]],0,0,0,0,0,0,[["2(?:2[1-7]|3[0-8]|4[12]|5[1256]|6\\d|7[1-3]|8[1-5])\\d{4}"],["(?:36|5[1-389]|9\\d)\\d{5}"],["800\\d{4}"],0,0,0,0,0,["(?:3[3-5]|4[356])\\d{5}"]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]",[["9(?:4(?:3[0-5]|4[14]|6\\d)|50\\d|7(?:2[014]|3[02-9]|4[4-9]|6[357]|77|8[7-9])|8(?:3[39]|[46]\\d|7[01]|8[57-9]))\\d{4}"],["953[01]\\d{4}|9(?:5[12467]|6[5-9])\\d{5}"],0,0,0,0,0,["955\\d{5}",[8]],0,["60[0-2]\\d{4}",[7]]]],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"0|([59]\\d{7})$","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]],0,0,0,0,0,0,[["2[2-6]\\d{6}"],["9[4-79]\\d{6}"],["800\\d{5}"],["90[09]\\d{5}"],["700\\d{5}"],0,["(?:50|77)\\d{6}"],0,0,["80[1-9]\\d{5}"]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,[["(?:2\\d|3[1257-9]|4[16-9]|5[13-9])\\d{7}"],["(?:60[1-8]|7(?:0[2-5]|[2379]\\d))\\d{6}"],["800\\d{6}"],["9(?:0[05689]|76)\\d{6}"],["70[01]\\d{6}"],0,["9(?:5\\d|7[2-4])\\d{6}"],0,["9[17]0\\d{6}"],["8[134]\\d{7}"]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[02-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|[23]1|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0",0,0,0,0,0,[["32\\d{9,11}|49[1-6]\\d{10}|322\\d{6}|49[0-7]\\d{3,9}|(?:[34]0|[68]9)\\d{3,13}|(?:2(?:0[1-689]|[1-3569]\\d|4[0-8]|7[1-7]|8[0-7])|3(?:[3569]\\d|4[0-79]|7[1-7]|8[1-8])|4(?:1[02-9]|[2-48]\\d|5[0-6]|6[0-8]|7[0-79])|5(?:0[2-8]|[124-6]\\d|[38][0-8]|[79][0-7])|6(?:0[02-9]|[1-358]\\d|[47][0-8]|6[1-9])|7(?:0[2-8]|1[1-9]|[27][0-7]|3\\d|[4-6][0-8]|8[0-5]|9[013-7])|8(?:0[2-9]|1[0-79]|2\\d|3[0-46-9]|4[0-6]|5[013-9]|6[1-8]|7[0-8]|8[0-24-6])|9(?:0[6-9]|[1-4]\\d|[589][0-7]|6[0-8]|7[0-467]))\\d{3,12}",[5,6,7,8,9,10,11,12,13,14,15]],["15[0-25-9]\\d{8}|1(?:6[023]|7\\d)\\d{7,8}",[10,11]],["800\\d{7,12}",[10,11,12,13,14,15]],["(?:137[7-9]|900(?:[135]|9\\d))\\d{6}",[10,11]],["700\\d{8}",[11]],0,["18(?:1\\d{5,11}|[2-9]\\d{8})",[8,9,10,11,12,13,14]],["16(?:4\\d{1,10}|[89]\\d{1,11})",[4,5,6,7,8,9,10,11,12,13,14]],0,["180\\d{5,11}|13(?:7[1-6]\\d\\d|8)\\d{4}",[7,8,9,10,11,12,13,14]]]],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]],0,0,0,0,0,0,[["2(?:1[2-5]|7[45])\\d{5}"],["77\\d{6}"]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]],0,0,0,0,0,0,[["(?:[2-7]\\d|8[126-9]|9[1-46-9])\\d{6}"],[""],["80\\d{6}"],["90\\d{6}"]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","767$1",0,"767",[["767(?:2(?:55|66)|4(?:2[01]|4[0-25-9])|50[0-4])\\d{4}"],["767(?:2(?:[2-4689]5|7[5-7])|31[5-7]|61[1-8]|70[1-6])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9",[["8(?:[04]9[2-9]\\d\\d|29(?:2(?:[0-59]\\d|6[04-9]|7[0-27]|8[0237-9])|3(?:[0-35-9]\\d|4[7-9])|[45]\\d\\d|6(?:[0-27-9]\\d|[3-5][1-9]|6[0135-8])|7(?:0[013-9]|[1-37]\\d|4[1-35689]|5[1-4689]|6[1-57-9]|8[1-79]|9[1-8])|8(?:0[146-9]|1[0-48]|[248]\\d|3[1-79]|5[01589]|6[013-68]|7[124-8]|9[0-8])|9(?:[0-24]\\d|3[02-46-9]|5[0-79]|60|7[0169]|8[57-9]|9[02-9])))\\d{4}"],["8[024]9[2-9]\\d{6}"],["8(?:00(?:14|[2-9]\\d)|(?:33|44|55|66|77|88)[2-9]\\d)\\d{5}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0",0,0,0,0,0,[["9619\\d{5}|(?:1\\d|2[013-79]|3[0-8]|4[013-689])\\d{6}"],["(?:5(?:4[0-29]|5\\d|6[0-2])|6(?:[569]\\d|7[0-6])|7[7-9]\\d)\\d{6}",[9]],["800\\d{6}",[9]],["80[3-689]1\\d{5}",[9]],0,0,0,0,["98[23]\\d{6}",[9]],["80[12]1\\d{5}",[9]]]],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["[2-7][2-7]\\d{6}",[8]],["964[0-2]\\d{5}|9(?:39|[57][89]|6[0-36-9]|[89]\\d)\\d{6}",[9]],["1800\\d{7}|1[78]00\\d{6}",[10,11]],0,0,0,0,0,["[2-7]890\\d{4}",[8]]]],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["(?:3[23589]|4[3-8]|6\\d|7[1-9]|88)\\d{5}",[7]],["(?:5\\d{5}|8(?:1(?:0(?:000|[3-9]\\d\\d)|(?:1(?:0[236]|1\\d)|(?:23|[3-79]\\d)\\d)\\d)|2(?:0(?:000|(?:19|[2-7]\\d)\\d)|(?:(?:[124-6]\\d|3[5-9])\\d|7(?:[3679]\\d|8[13-9])|8(?:[2-6]\\d|7[01]))\\d)|[349]\\d{4}))\\d\\d|5(?:(?:[02]\\d|5[0-478])\\d|1(?:[0-8]\\d|95)|6(?:4[0-4]|5[1-589]))\\d{3}",[7,8]],["800(?:(?:0\\d\\d|1)\\d|[2-9])\\d{3}"],["(?:40\\d\\d|900)\\d{4}",[7,8]],["70[0-2]\\d{5}",[8]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[189]"],"0$1"]],"0",0,0,0,0,0,[["13[23]\\d{6}|(?:15|57)\\d{6,7}|(?:2[2-4]|3|4[05-8]|5[05]|6[24-689]|8[2468]|9[235-7])\\d{7}",[8,9]],["1[0-25]\\d{8}",[10]],["800\\d{7}",[10]],["900\\d{7}",[10]]]],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]",[["528[89]\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1[12568]|[24]0|55|6[146])|8\\d\\d)\\d{4}"],["(?:17[1-3]|7\\d\\d)\\d{4}"]]],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]],0,0,0,0,0,0,[["96906(?:0[0-8]|1[1-9]|[2-9]\\d)\\d\\d|9(?:69(?:0[0-57-9]|[1-9]\\d)|73(?:[0-8]\\d|9[1-9]))\\d{4}|(?:8(?:[1356]\\d|[28][0-8]|[47][1-9])|9(?:[135]\\d|[268][0-8]|4[1-9]|7[124-9]))\\d{6}"],["(?:590[16]00\\d|9(?:6906(?:09|10)|7390\\d\\d))\\d\\d|(?:6\\d|7[1-48])\\d{7}"],["[89]00\\d{6}"],["80[367]\\d{6}"],["70\\d{7}"],0,["51\\d{7}"],0,0,["90[12]\\d{6}"]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0",0,0,0,0,0,[["11667[01]\\d{3}|(?:11(?:1(?:1[124]|2[2-7]|3[1-5]|5[5-8]|8[6-8])|2(?:13|3[6-8]|5[89]|7[05-9]|8[2-6])|3(?:2[01]|3[0-289]|4[1289]|7[1-4]|87)|4(?:1[69]|3[2-49]|4[0-3]|6[5-8])|5(?:1[578]|44|5[0-4])|6(?:1[78]|2[69]|39|4[5-7]|5[1-5]|6[0-59]|8[015-8]))|2(?:2(?:11[1-9]|22[0-7]|33\\d|44[1467]|66[1-68])|5(?:11[124-6]|33[2-8]|44[1467]|55[14]|66[1-3679]|77[124-79]|880))|3(?:3(?:11[0-46-8]|(?:22|55)[0-6]|33[0134689]|44[04]|66[01467])|4(?:44[0-8]|55[0-69]|66[0-3]|77[1-5]))|4(?:6(?:119|22[0-24-7]|33[1-5]|44[13-69]|55[14-689]|660|88[1-4])|7(?:(?:11|22)[1-9]|33[13-7]|44[13-6]|55[1-689]))|5(?:7(?:227|55[05]|(?:66|77)[14-8])|8(?:11[149]|22[013-79]|33[0-68]|44[013-8]|550|66[1-5]|77\\d)))\\d{4}"],["7001\\d{5}|(?:7(?:0[1-9]|1[01]|77|86|99)|9\\d\\d)\\d{6}"]]],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",[["(?:1[3-79][1-8]|[235689][1-8]\\d)\\d{2,6}",[5,6,7,8,9]],["4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}",[6,7,8,9,10]],["800\\d{4,6}",[7,8,9]],["[67]00\\d{5,6}",[8,9]],0,0,["20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}"]],"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,[["603\\d{4}|(?:3[0-5]|6[25-7]|8[58])\\d{5}",[7]],["(?:[279]\\d|45|5[01568]|8[034679])\\d{5}",[7]],["0800\\d{7}",[11]]],"00"],FK:["500","00","[2-7]\\d{4}",[5],0,0,0,0,0,0,0,[["[2-47]\\d{4}"],["[56]\\d{4}"]]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]],0,0,0,0,0,0,[["31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-6]\\d)\\d)\\d{3}"],["31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-7]\\d)\\d)\\d{3}"]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))",0,0,0,[["(?:20|[34]\\d|8[19])\\d{4}"],["(?:[27][1-9]|5\\d|9[16])\\d{4}"],["80[257-9]\\d{3}"],["90(?:[13-5][15-7]|2[125-7]|9\\d)\\d\\d"],0,0,0,0,["(?:6[0-36]|88)\\d{4}"]]],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0",0,0,0,0,0,[["(?:[1-35]\\d|4[1-9])\\d{7}"],["(?:6(?:[0-24-8]\\d|3[0-8]|9[589])|7(?:00|[3-9]\\d))\\d{6}"],["80[0-5]\\d{6}"],["836(?:0[0-36-9]|[1-9]\\d)\\d{4}|8(?:1[2-9]|2[2-47-9]|3[0-57-9]|[569]\\d|8[0-35-9])\\d{6}"],0,0,["80[6-9]\\d{6}"],0,["9\\d{8}"],["8(?:1[01]|2[0156]|4[02]|84)\\d{6}"]]],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1",0,0,[["[01]1\\d{6}",[8]],["(?:(?:0[2-7]|7[467])\\d|6(?:0[0-4]|10|[256]\\d))\\d{5}|[2-7]\\d{6}"]]],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[01359])|(?:5[0-26-9]|[78][0-49])\\d\\d|6(?:[0-4]\\d\\d|50[0-79]))|2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d\\d|1(?:[0-7]\\d\\d|8(?:[02]\\d|1[0-26-9])))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","473$1",0,"473",[["473(?:2(?:3[0-2]|69)|3(?:2[89]|86)|4(?:[06]8|3[5-9]|4[0-49]|5[5-79]|73|90)|63[68]|7(?:58|84)|800|938)\\d{4}"],["473(?:4(?:0[2-79]|1[04-9]|2[0-5]|58)|5(?:2[01]|3[3-8])|901)\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0",0,0,0,0,0,[["(?:3(?:[256]\\d|4[124-9]|7[0-4])|4(?:1\\d|2[2-7]|3[1-79]|4[2-8]|7[239]|9[1-7]))\\d{6}"],["5(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d{3}|5(?:0070|11(?:33|51)|[25]222|3333)[0-4]\\d{3}|5(?:00(?:0\\d|5[05])|11(?:00|[124]\\d|3[01])|5200|75(?:00|[57]5)|8(?:0(?:[01]\\d|2[0-4])|58[89]|8(?:55|88)))\\d{4}|(?:5(?:[14]4|5[0157-9]|68|7[0147-9]|9[1-35-9])|790)\\d{6}"],["800\\d{6}"],0,0,0,0,0,["70[67]\\d{6}"]]],GF:["594","00","(?:[56]94|80\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["594(?:[023]\\d|1[0-2]|4[03-9]|5[6-9]|6[0-3]|80|9[0-8])\\d{4}"],["694(?:[0-249]\\d|3[0-48])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976\\d{6}"]]],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"0|([25-9]\\d{5})$","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0",0,0,0,0,0,[["3082[0-5]\\d{4}|3(?:0(?:[237]\\d|8[01])|[167](?:2[0-6]|7\\d|80)|2(?:2[0-5]|7\\d|80)|3(?:2[0-3]|7\\d|80)|4(?:2[013-9]|3[01]|7\\d|80)|5(?:2[0-7]|7\\d|80)|8(?:2[0-2]|7\\d|80)|9(?:[28]0|7\\d))\\d{5}",[9]],["(?:2(?:[0346-9]\\d|5[67])|5(?:[0457]\\d|6[01]|9[1-9]))\\d{6}",[9]],["800\\d{5}",[8]]]],GI:["350","00","(?:[25]\\d\\d|606)\\d{5}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]],0,0,0,0,0,0,[["21(?:6[24-7]\\d|90[0-2])\\d{3}|2(?:00|2[25])\\d{5}"],["(?:5[146-8]\\d|606)\\d{5}"]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]],0,0,0,0,0,0,[["(?:19|3[1-7]|6[14689]|70|8[14-79]|9\\d)\\d{4}"],["[245]\\d{5}"],["80\\d{4}"],0,0,0,0,0,["3[89]\\d{4}"]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]],0,0,0,0,0,0,[["(?:4(?:[23]\\d\\d|4(?:1[024679]|[6-9]\\d))|5(?:5(?:3\\d|4[0-7])|6[67]\\d|7(?:1[04]|2[035]|3[58]|48))|8\\d{3})\\d{3}"],["(?:[23679]\\d|5[0-389])\\d{5}"]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]],0,0,0,0,0,0,[["3(?:0(?:24|3[12]|4[1-35-7]|5[13]|6[189]|[78]1|9[1478])|1\\d\\d)\\d{4}",[8]],["6[0-356]\\d{7}",[9]],0,0,0,0,0,0,["722\\d{6}",[9]]]],GP:["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1289]|5[3-579]|6[0-289]|7[08]|8[0-689]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]],0,0,0,0,0,0,[["33[0-24-9]\\d[46]\\d{4}|3(?:33|5\\d)\\d[7-9]\\d{4}"],["(?:222|55\\d)\\d{6}"],["80\\d[1-9]\\d{5}"],["90\\d[1-9]\\d{5}"]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["2(?:1\\d\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\d|2[1-5]|[34][1-4]|9[1-57]))\\d{6}",[10]],["68[57-9]\\d{7}|(?:69|94)\\d{8}",[10]],["800\\d{7,9}"],["90[19]\\d{7}",[10]],["70\\d{8}",[10]],0,["5005000\\d{3}",[10]],0,0,["8(?:0[16]|12|[27]5|50)\\d{7}",[10]]]],GT:["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[["[267][2-9]\\d{6}",[8]],["[3-5]\\d{7}",[8]],["18[01]\\d{8}",[11]],["19\\d{9}",[11]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"1|([3-9]\\d{6})$","671$1",0,"671",[["671(?:3(?:00|3[39]|4[349]|55|6[26])|4(?:00|56|7[1-9]|8[0236-9])|5(?:55|6[2-5]|88)|6(?:3[2-578]|4[24-9]|5[34]|78|8[235-9])|7(?:[0479]7|2[0167]|3[45]|8[7-9])|8(?:[2-57-9]8|6[48])|9(?:2[29]|6[79]|7[1279]|8[7-9]|9[78]))\\d{4}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]],0,0,0,0,0,0,[["443\\d{6}",[9]],["9(?:5\\d|6[569]|77)\\d{6}",[9]],0,0,0,0,0,0,["40\\d{5}",[7]]]],GY:["592","001","9008\\d{3}|(?:[2-467]\\d\\d|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-46-9]"]]],0,0,0,0,0,0,[["(?:2(?:1[6-9]|2[0-35-9]|3[1-4]|5[3-9]|6\\d|7[0-24-79])|3(?:2[25-9]|3\\d)|4(?:4[0-24]|5[56])|77[1-57])\\d{4}"],["(?:6\\d\\d|70[015-7])\\d{4}"],["(?:289|862)\\d{4}"],["9008\\d{3}"]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,[["(?:38[45][0-8]|58(?:0[1-8]|1[2-9]))\\d{4}|(?:2(?:[13-9]\\d|2[013-9])|3(?:[1569][0-24-9]|4[0-246-9]|7[0-24-69]|89))\\d{5}",[8]],["(?:4(?:44[5-9]|6(?:0[0-7]|1[0-6]|4[0-57-9]|6[0-4]|7[0-8]))|573[0-6]|6(?:26[013-8]|66[0-3])|70(?:7[1-5]|8[0-4])|848[015-9]|9(?:29[013-9]|59[0-4]))\\d{4}|(?:4(?:4[01]|6[2358])|5(?:[1-59][0-46-9]|6[0-4689]|7[0-246-9])|6(?:0[1-9]|[13-59]\\d|[268][0-57-9]|7[0-79])|84[09]|9(?:0[1-9]|1[02-9]|[2358][0-8]|[467]\\d))\\d{5}",[8]],["800\\d{6}",[9]],["900(?:[0-24-9]\\d{7}|3\\d{1,4})",[5,6,7,8,11]],["8(?:1[0-4679]\\d|2(?:[0-36]\\d|7[0-4])|3(?:[034]\\d|2[09]|70))\\d{4}",[8]],0,["30(?:0[1-9]|[15-7]\\d|2[047]|89)\\d{4}",[8]],["7(?:1(?:0[0-38]|1[0-3679]|3[013]|69|9[0136])|2(?:[02389]\\d|1[18]|7[27-9])|3(?:[0-38]\\d|7[0-369]|9[2357-9])|47\\d|5(?:[178]\\d|5[0-5])|6(?:0[0-7]|2[236-9]|[35]\\d)|7(?:[27]\\d|8[7-9])|8(?:[23689]\\d|7[1-9])|9(?:[025]\\d|6[0-246-8]|7[0-36-9]|8[238]))\\d{4}",[8]]],"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]],0,0,0,0,0,0,[["2(?:2(?:0[0-359]|1[1-367]|[23]\\d|4[03-6]|5[57]|6[245]|7[0135689]|8[01346-9]|9[0-2])|4(?:0[78]|2[3-59]|3[13-9]|4[0-68]|5[1-35])|5(?:0[7-9]|16|4[03-5]|5\\d|6[014-6]|7[04]|80)|6(?:[056]\\d|17|2[067]|3[04]|4[0-378]|[78][0-8]|9[01])|7(?:6[46-9]|7[02-9]|8[034]|91)|8(?:79|8[0-357-9]|9[1-57-9]))\\d{4}",[8]],["[37-9]\\d{7}",[8]],["8002\\d{7}",[11]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0",0,0,0,0,0,[["1\\d{7}|(?:2[0-3]|3[1-5]|4[02-47-9]|5[1-3])\\d{6,7}",[8,9]],["98\\d{6,7}|975(?:1\\d|9[67])\\d{4}|9(?:0[1-9]|[1259]\\d|7[0679])\\d{6}",[8,9]],["80[01]\\d{4,6}",[7,8,9]],["6[01459]\\d{6}|6[01]\\d{4,5}",[6,7,8]],["7[45]\\d{6}",[8]],0,["62\\d{6,7}|72\\d{6}",[8,9]]]],HT:["509","00","[2-489]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-489]"]]],0,0,0,0,0,0,[["2(?:2\\d|5[1-5]|81|9[149])\\d{5}"],["[34]\\d{7}"],["8\\d{7}"],0,0,0,0,0,["9(?:[67][0-4]|8[0-3589]|9\\d)\\d{5}"]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06",0,0,0,0,0,[["(?:1\\d|[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6[23689]|8[2-57-9]|9[2-69])\\d{6}",[8]],["(?:[257]0|3[01])\\d{7}",[9]],["(?:[48]0\\d|680[29])\\d{5}"],["9[01]\\d{6}",[8]],0,0,["38\\d{7}",[9]],0,["21\\d{7}",[9]]]],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0",0,0,0,0,0,[["2[124]\\d{7,8}|619\\d{8}|2(?:1(?:14|500)|2\\d{3})\\d{3}|61\\d{5,8}|(?:2(?:[35][1-4]|6[0-8]|7[1-6]|8\\d|9[1-8])|3(?:1|[25][1-8]|3[1-68]|4[1-3]|6[1-3568]|7[0-469]|8\\d)|4(?:0[1-589]|1[01347-9]|2[0-36-8]|3[0-24-68]|43|5[1-378]|6[1-5]|7[134]|8[1245])|5(?:1[1-35-9]|2[25-8]|3[124-9]|4[1-3589]|5[1-46]|6[1-8])|6(?:[25]\\d|3[1-69]|4[1-6])|7(?:02|[125][1-9]|[36]\\d|4[1-8]|7[0-36-9])|9(?:0[12]|1[013-8]|2[0-479]|5[125-8]|6[23679]|7[159]|8[01346]))\\d{5,8}",[7,8,9,10,11]],["8[1-35-9]\\d{7,10}",[9,10,11,12]],["00[17]803\\d{7}|(?:177\\d|800)\\d{5,7}|001803\\d{6}",[8,9,10,11,12,13]],["809\\d{7}",[10]],0,0,["(?:1500|8071\\d{3})\\d{3}",[7,10]],0,0,["804\\d{7}",[10]]]],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:1\\d|21)\\d{6,7}|(?:2[24-9]|4(?:0[24]|5\\d|7)|5(?:0[45]|1\\d|8)|6(?:1\\d|[237-9])|9(?:1\\d|[35-9]))\\d{5}|(?:23|4(?:[1-469]|8\\d)|5[23679]|6[4-6]|7[14]|9[04])\\d{7}"],["8(?:22|[35-9]\\d)\\d{6}",[9]],["1800\\d{6}",[10]],["15(?:1[2-8]|[2-8]0|9[089])\\d{6}",[10]],["700\\d{6}",[9]],0,["818\\d{6}",[9]],0,["76\\d{7}",[9]],["18[59]0\\d{6}",[10]]]],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0",0,0,0,0,0,[["153\\d{8,9}|29[1-9]\\d{5}|(?:2[0-8]|[3489]\\d)\\d{6}",[8,11,12]],["5(?:(?:[02368]\\d|[19][2-9]|4[1-9])\\d|5(?:01|1[79]|2[2-9]|3[0-3]|4[34]|5[015689]|6[6-8]|7[0-267]|8[7-9]|9[1-9]))\\d{5}",[9]],["1(?:255|80[019]\\d{3})\\d{3}",[7,10]],["1212\\d{4}|1(?:200|9(?:0[0-2]|19))\\d{6}",[8,10]],0,0,["1599\\d{6}",[10]],0,["7(?:380|8(?:33|55|77|81))\\d{5}|7(?:18|2[23]|3[237]|47|6[258]|7\\d|82|9[2-9])\\d{6}",[9]],["1700\\d{6}",[10]]]],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"0|([25-8]\\d{5})$","1624$1",0,"74576|(?:16|7[56])24",[["1624(?:230|[5-8]\\d\\d)\\d{3}"],["76245[06]\\d{4}|7(?:4576|[59]24\\d|624[0-4689])\\d{5}"],["808162\\d{4}"],["8(?:440[49]06|72299\\d)\\d{3}|(?:8(?:45|70)|90[0167])624\\d{4}"],["70\\d{8}"],0,["3440[49]06\\d{3}|(?:3(?:08162|3\\d{4}|45624|7(?:0624|2299))|55\\d{4})\\d{4}"],0,["56\\d{8}"]]],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0",0,0,0,0,0,[["2717(?:[2-7]\\d|95)\\d{4}|(?:271[0-689]|782[0-6])[2-7]\\d{5}|(?:170[24]|2(?:(?:[02][2-79]|90)\\d|80[13468])|(?:3(?:23|80)|683|79[1-7])\\d|4(?:20[24]|72[2-8])|552[1-7])\\d{6}|(?:11|33|4[04]|80)[2-7]\\d{7}|(?:342|674|788)(?:[0189][2-7]|[2-7]\\d)\\d{5}|(?:1(?:2[0-249]|3[0-25]|4[145]|[59][14]|6[014]|7[1257]|8[01346])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568]|9[14])|3(?:26|4[13]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[014-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|2[14]|3[134]|4[47]|5[15]|[67]1)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91))[2-7]\\d{6}|(?:1(?:2[35-8]|3[346-9]|4[236-9]|[59][0235-9]|6[235-9]|7[34689]|8[257-9])|2(?:1[134689]|3[24-8]|4[2-8]|5[25689]|6[2-4679]|7[3-79]|8[2-479]|9[235-9])|3(?:01|1[79]|2[1245]|4[5-8]|5[125689]|6[235-7]|7[157-9]|8[2-46-8])|4(?:1[14578]|2[5689]|3[2-467]|5[4-7]|6[35]|73|8[2689]|9[2389])|5(?:[16][146-9]|2[14-8]|3[1346]|4[14-69]|5[46]|7[2-4]|8[2-8]|9[246])|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])|7(?:1[013-9]|2[0235-9]|3[2679]|4[1-35689]|5[2-46-9]|[67][02-9]|8[013-7]|9[089])|8(?:1[1357-9]|2[235-8]|3[03-57-9]|4[0-24-9]|5\\d|6[2457-9]|7[1-6]|8[1256]|9[2-4]))\\d[2-7]\\d{5}",[10]],["(?:61279|7(?:887[02-9]|9(?:313|79[07-9]))|8(?:079[04-9]|(?:84|91)7[02-8]))\\d{5}|(?:6(?:12|[2-47]1|5[17]|6[13]|80)[0189]|7(?:1(?:2[0189]|9[0-5])|2(?:[14][017-9]|8[0-59])|3(?:2[5-8]|[34][017-9]|9[016-9])|4(?:1[015-9]|[29][89]|39|8[389])|5(?:[15][017-9]|2[04-9]|9[7-9])|6(?:0[0-47]|1[0-257-9]|2[0-4]|3[19]|5[4589])|70[0289]|88[089]|97[02-8])|8(?:0(?:6[67]|7[02-8])|70[017-9]|84[01489]|91[0-289]))\\d{6}|(?:7(?:31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[0189]\\d|7[02-8])\\d{5}|(?:6(?:[09]\\d|1[04679]|2[03689]|3[05-9]|4[0489]|50|6[069]|7[07]|8[7-9])|7(?:0\\d|2[0235-79]|3[05-8]|40|5[0346-8]|6[6-9]|7[1-9]|8[0-79]|9[089])|8(?:0[01589]|1[0-57-9]|2[235-9]|3[03-57-9]|[45]\\d|6[02457-9]|7[1-69]|8[0-25-9]|9[02-9])|9\\d\\d)\\d{7}|(?:6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|8[124-6])\\d|7(?:[235689]\\d|4[0189]))|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-5])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]|881))[0189]\\d{5}",[10]],["000800\\d{7}|1(?:600\\d{6}|80(?:0\\d{4,9}|3\\d{9}))"],["186[12]\\d{9}",[13]],0,0,["140\\d{7}",[10]],0,0,["1860\\d{7}",[11]]]],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]],0,0,0,0,0,0,[["37\\d{5}"],["38\\d{5}"]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["1\\d{7}|(?:2[13-5]|3[02367]|4[023]|5[03]|6[026])\\d{6,7}",[8,9]],["7[3-9]\\d{8}",[10]]]],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0",0,0,0,0,0,[["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])(?:[03-57]\\d{7}|[16]\\d{3}(?:\\d{4})?|[289]\\d{3}(?:\\d(?:\\d{3})?)?)|94(?:000[09]|2(?:121|[2689]0\\d)|30[0-2]\\d|4(?:111|40\\d))\\d{4}",[6,7,10]],["9(?:(?:0(?:[0-35]\\d|4[4-6])|(?:[13]\\d|2[0-3])\\d)\\d|9(?:[0-46]\\d\\d|5[15]0|8(?:1\\d|88)|9(?:0[0-3]|[19]\\d|21|77|8[7-9])))\\d{5}",[10]],0,0,0,0,["96(?:0[12]|2[16-8]|3(?:08|[14]5|[23]|66)|4(?:0|80)|5[01]|6[89]|86|9[19])",[4,5]]]],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["(?:4(?:1[0-24-69]|2[0-7]|[37][0-8]|4[0-24589]|5[0-68]|6\\d|8[0-36-8])|5(?:05|[156]\\d|2[02578]|3[0-579]|4[03-7]|7[0-2578]|8[0-35-9]|9[013-689])|872)\\d{4}",[7]],["(?:38[589]\\d\\d|6(?:1[1-8]|2[0-6]|3[026-9]|4[014679]|5[0159]|6[0-69]|70|8[06-8]|9\\d)|7(?:5[057]|[6-9]\\d)|8(?:2[0-59]|[3-69]\\d|8[238]))\\d{4}"],["80[0-8]\\d{4}",[7]],["90(?:0\\d|1[5-79]|2[015-79]|3[135-79]|4[125-7]|5[25-79]|7[1-37]|8[0-35-7])\\d{3}",[7]],0,0,["809\\d{4}",[7]],0,["49[0-24-79]\\d{4}",[7]]],"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"0|([0-24-8]\\d{5})$","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876",[["8766060\\d{3}|(?:658(?:2(?:[0-8]\\d|9[0-46-9])|[3-9]\\d\\d)|876(?:52[35]|6(?:0[1-3579]|1[02357-9]|[23]\\d|40|5[06]|6[2-589]|7[025-7]|8[04]|9[4-9])|7(?:0[2-689]|[1-6]\\d|8[056]|9[45])|9(?:0[1-8]|1[02378]|[2-8]\\d|9[2-468])))\\d{4}"],["(?:658295|876(?:2(?:0[1-9]|[13-9]\\d|2[013-9])|[348]\\d\\d|5(?:0[1-9]|[1-9]\\d)|6(?:4[89]|6[67])|7(?:0[07]|7\\d|8[1-47-9]|9[0-36-9])|9(?:[01]9|9[0579])))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["87(?:000|90[01])\\d{3}|(?:2(?:6(?:2[0-35-9]|3[0-578]|4[24-7]|5[0-24-8]|[6-8][023]|9[0-3])|7(?:0[1-79]|10|2[014-7]|3[0-689]|4[019]|5[0-3578]))|32(?:0[1-69]|1[1-35-7]|2[024-7]|3\\d|4[0-3]|[5-7][023])|53(?:0[0-3]|[13][023]|2[0-59]|49|5[0-35-9]|6[15]|7[45]|8[1-6]|9[0-36-9])|6(?:2(?:[05]0|22)|3(?:00|33)|4(?:0[0-25]|1[2-7]|2[0569]|[38][07-9]|4[025689]|6[0-589]|7\\d|9[0-2])|5(?:[01][056]|2[034]|3[0-57-9]|4[178]|5[0-69]|6[0-35-9]|7[1-379]|8[0-68]|9[0239]))|87(?:20|7[078]|99))\\d{4}",[8]],["7(?:[78][0-25-9]|9\\d)\\d{6}",[9]],["80\\d{6}",[8]],["9\\d{7}",[8]],["70\\d{7}",[9]],0,["8(?:10|8\\d)\\d{5}",[8]],["74(?:66|77)\\d{5}",[9]],0,["85\\d{6}",[8]]]],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1[235-8]|2[3-6]|3[3-9]|4[2-6]|[58][2-8]|6[2-7]|7[2-9]|9[1-9])|(?:2[2-9]|[36][1-9])\\d|4(?:[2-578]\\d|6[02-8]|9[2-59])|5(?:[2-589]\\d|6[1-9]|7[2-8])|7(?:[25-9]\\d|3[4-9]|4[02-9])|8(?:[2679]\\d|3[2-9]|4[5-9]|5[1-9]|8[03-9])|9(?:[2-58]\\d|[679][1-9]))\\d{6}",[9]],["[7-9]0[1-9]\\d{7}",[10]],["00777(?:[01]|5\\d)\\d\\d|(?:00(?:7778|882[1245])|(?:120|800\\d)\\d\\d)\\d{4}|00(?:37|66|78)\\d{6,13}"],["990\\d{6}",[9]],["60\\d{7}",[9]],0,["570\\d{6}",[9]],["20\\d{8}",[10]],["50[1-9]\\d{7}",[10]]]],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,[["(?:4[245]|5[1-79]|6[01457-9])\\d{5,7}|(?:4[136]|5[08]|62)\\d{7}|(?:[24]0|66)\\d{6,7}",[7,8,9]],["(?:1(?:0[0-6]|1[0-5]|2[014]|30)|7\\d\\d)\\d{6}",[9]],["800[2-8]\\d{5,6}",[9,10]],["900[02-9]\\d{5}",[9]]]],KG:["996","00","8\\d{9}|(?:[235-8]\\d|99)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["312(?:5[0-79]\\d|9(?:[0-689]\\d|7[0-24-9]))\\d{3}|(?:3(?:1(?:2[0-46-8]|3[1-9]|47|[56]\\d)|2(?:22|3[0-479]|6[0-7])|4(?:22|5[6-9]|6\\d)|5(?:22|3[4-7]|59|6\\d)|6(?:22|5[35-7]|6\\d)|7(?:22|3[468]|4[1-9]|59|[67]\\d)|9(?:22|4[1-8]|6\\d))|6(?:09|12|2[2-4])\\d)\\d{5}",[9]],["312(?:58\\d|973)\\d{3}|(?:2(?:0[0-35]|2\\d)|5[0-24-7]\\d|7(?:[07]\\d|55)|88[08]|99[05-9])\\d{6}",[9]],["800\\d{6,7}"]]],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["23(?:4(?:[2-4]|[56]\\d)|[568]\\d\\d)\\d{4}|23[236-9]\\d{5}|(?:2[4-6]|3[2-6]|4[2-4]|[5-7][2-5])(?:(?:[237-9]|4[56]|5\\d)\\d{5}|6\\d{5,6})",[8,9]],["(?:(?:1[28]|3[18]|9[67])\\d|6[016-9]|7(?:[07-9]|[16]\\d)|8(?:[013-79]|8\\d))\\d{6}|(?:1\\d|9[0-57-9])\\d{6}|(?:2[3-6]|3[2-6]|4[2-4]|[5-7][2-5])48\\d{5}",[8,9]],["1800(?:1\\d|2[019])\\d{4}",[10]],["1900(?:1\\d|2[09])\\d{4}",[10]]]],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0",0,0,0,0,0,[["(?:[24]\\d|3[1-9]|50|65(?:02[12]|12[56]|22[89]|[3-5]00)|7(?:27\\d\\d|3100|5(?:02[12]|12[56]|22[89]|[34](?:00|81)|500))|8[0-5])\\d{3}"],["(?:63\\d{3}|73(?:0[0-5]\\d|140))\\d{3}|[67]200[01]\\d{3}",[8]],0,0,0,0,0,0,["30(?:0[01]\\d\\d|12(?:11|20))\\d\\d",[8]]]],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]],0,0,0,0,0,0,[["7[4-7]\\d{5}"],["[34]\\d{6}"],0,["8\\d{6}"]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","869$1",0,"869",[["869(?:2(?:29|36)|302|4(?:6[015-9]|70)|56[5-7])\\d{4}"],["869(?:48[89]|55[6-8]|66\\d|76[02-7])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:195|2)\\d|3[19]|4[159]|5[37]|6[17]|7[39]|85)\\d{6}"],["19[1-3]\\d{7}",[10]]]],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?",0,0,0,[["(?:2|3[1-3]|[46][1-4]|5[1-5])[1-9]\\d{6,7}|(?:3[1-3]|[46][1-4]|5[1-5])1\\d{2,3}",[5,6,8,9,10]],["1(?:05(?:[0-8]\\d|9[0-6])|22[13]\\d)\\d{4,5}|1(?:0[1-46-9]|[16-9]\\d|2[013-9])\\d{6,7}",[9,10]],["00(?:308\\d{6,7}|798\\d{7,9})|(?:00368|80)\\d{7}",[9,11,12,13,14]],["60[2-9]\\d{6}",[9]],["50\\d{8,9}",[10,11]],0,["1(?:5(?:22|33|44|66|77|88|99)|6(?:[07]0|44|6[168]|88)|8(?:00|33|55|77|99))\\d{4}",[8]],["15\\d{7,8}",[9,10]],["70\\d{8}",[10]]]],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]],0,0,0,0,0,0,[["2(?:[23]\\d\\d|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7]))\\d{4}",[8]],["(?:41\\d\\d|5(?:(?:[05]\\d|1[0-7]|6[56])\\d|2(?:22|5[25])|7(?:55|77)|88[58])|6(?:(?:0[034679]|5[015-9]|6\\d)\\d|111|222|333|444|7(?:0[013-9]|[67]\\d)|888|9(?:[069]\\d|3[039]))|9(?:(?:0[09]|22|[4679]\\d|8[057-9])\\d|1(?:1[01]|99)|3(?:00|33)|5(?:00|5\\d)))\\d{4}",[8]],["18\\d{5}",[7]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","345$1",0,"345",[["345(?:2(?:22|3[23]|44|66)|333|444|6(?:23|38|40)|7(?:30|4[35-79]|6[6-9]|77)|8(?:00|1[45]|[48]8)|9(?:14|4[035-9]))\\d{4}"],["345(?:32[1-9]|42[0-4]|5(?:1[67]|2[5-79]|4[6-9]|50|76)|649|82[56]|9(?:1[679]|2[2-9]|3[06-9]|90))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["(?:345976|900[2-9]\\d\\d)\\d{4}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,0,["345849\\d{4}"]]],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",[["(?:33622|7(?:1(?:0(?:[23]\\d|4[0-3]|59|63)|1(?:[23]\\d|4[0-79]|59)|2(?:[23]\\d|59)|3(?:2\\d|3[0-79]|4[0-35-9]|59)|4(?:[24]\\d|3[013-9]|5[1-9])|5(?:2\\d|3[1-9]|4[0-7]|59)|6(?:[2-4]\\d|5[19]|61)|72\\d|8(?:[27]\\d|3[1-46-9]|4[0-5]))|2(?:1(?:[23]\\d|4[46-9]|5[3469])|2(?:2\\d|3[0679]|46|5[12679])|3(?:[2-4]\\d|5[139])|4(?:2\\d|3[1-35-9]|59)|5(?:[23]\\d|4[0-246-8]|59|61)|6(?:2\\d|3[1-9]|4[0-4]|59)|7(?:[2379]\\d|40|5[279])|8(?:[23]\\d|4[0-3]|59)|9(?:2\\d|3[124578]|59))))\\d{5}",[10]],["7(?:0[0-25-8]|47|6[0-4]|7[15-8]|85)\\d{7}",[10]],["8(?:00|108\\d{3})\\d{7}"],["809\\d{7}",[10]],["808\\d{7}",[10]],0,0,0,["751\\d{7}",[10]]],"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,0,0,0,0,[["(?:2[13]|[35-7][14]|41|8[1468])\\d{6}",[8]],["(?:20(?:[239]\\d|5[24-9]|7[6-8]|88)|302\\d)\\d{6}",[10]],0,0,0,0,["30[013-9]\\d{6}",[9]]]],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0",0,0,0,0,0,[["7(?:62|8[0-7]|9[04-9])\\d{4}|(?:[14-69]\\d|2(?:[14-69]\\d|[78][1-9])|7[2-57]|8[02-9])\\d{5}"],["793(?:[01]\\d|2[0-4])\\d{3}|(?:(?:3|81)\\d|7(?:[01]\\d|6[013-9]|8[89]|9[12]))\\d{5}"],0,["9[01]\\d{6}",[8]],0,0,0,0,0,["80\\d{6}",[8]]]],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","758$1",0,"758",[["758(?:234|4(?:30|5\\d|6[2-9]|8[0-2])|57[0-2]|(?:63|75)8)\\d{4}"],["758(?:28[4-7]|384|4(?:6[01]|8[4-9])|5(?:1[89]|20|84)|7(?:1[2-9]|2\\d|3[0-3])|812)\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"0|(1001)",0,0,0,[["(?:2(?:01|1[27]|2[02]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}",[7]],["(?:6(?:(?:4[5-9]|5[0-4])\\d|6(?:[0245]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}"],["8002[28]\\d\\d|80(?:05\\d|9)\\d{4}"],["90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d",[7]],0,0,["870(?:28|87)\\d\\d",[7]]]],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0",0,0,0,0,0,[["(?:12[2-9]|602|8[12]\\d|9(?:1\\d|22|9[245]))\\d{6}|(?:11|2[13-7]|3[1-8]|4[157]|5[12457]|6[35-7])[2-57]\\d{6}"],["7(?:[0-25-8]\\d|4[0-4])\\d{6}"],0,0,0,0,["1973\\d{5}"]]],LR:["231","00","(?:2|33|5\\d|77|88)\\d{7}|[4-6]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3578]"],"0$1"]],"0",0,0,0,0,0,[["(?:2\\d{3}|33333)\\d{4}",[8,9]],["(?:(?:330|555|(?:77|88)\\d)\\d|4[67])\\d{5}|[56]\\d{6}",[7,9]],0,["332(?:02|[34]\\d)\\d{4}",[9]]]],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]],0,0,0,0,0,0,[["2\\d{7}"],["[56]\\d{7}"],["800[256]\\d{4}"]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]",0,0,0,[["(?:3[1478]|4[124-6]|52)\\d{6}"],["6\\d{7}"],["80[02]\\d{5}"],["9(?:0[0239]|10)\\d{5}"],["70[05]\\d{5}"],0,["70[67]\\d{5}"],0,["[89]01\\d{5}"],["808\\d{5}"]]],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)",0,0,0,[["(?:35[013-9]|80[2-9]|90[89])\\d{1,8}|(?:2[2-9]|3[0-46-9]|[457]\\d|8[13-9]|9[2-579])\\d{2,9}"],["6(?:[269][18]|5[1568]|7[189]|81)\\d{6}",[9]],["800\\d{5}",[8]],["90[015]\\d{5}",[8]],0,0,0,0,["20(?:1\\d{5}|[2-689]\\d{1,7})",[4,5,6,7,8,9,10]],["801\\d{5}",[8]]]],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]],0,0,0,0,0,0,[["6\\d{7}"],["2\\d{7}"],["80\\d{6}"],["90\\d{6}"],0,0,0,0,0,["81\\d{6}"]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:0[56]|[1-6]\\d|7[124579]|8[124])|3(?:1\\d|2[2356])|4(?:[17]\\d|2[1-357]|5[2-4]|8[124])|5(?:[1347]\\d|2[1-469]|5[13-5]|8[1-4])|6(?:[1-479]\\d|5[2-57]|8[1-5])|7(?:[13]\\d|2[13-79])|8(?:[124]\\d|5[124]|84))\\d{6}"],["9[1-6]\\d{7}"]]],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[89]|389)","5(?:29[89]|389)0"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:29(?:[189][05]|2[29]|3[01])|389[05])\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|90)|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[08]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0",0,0,0,0,0,[["(?:870|9[2-47-9]\\d)\\d{5}",[8]],["4(?:[46]\\d|5[1-9])\\d{5}|(?:3|6\\d)\\d{7}"],["(?:800|90\\d)\\d{5}",[8]]]],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:2[1-9]|3[1-79])\\d|5(?:33|5[257]))\\d{5}"],["562\\d{5}|(?:6\\d|7[16-9])\\d{6}"],["800\\d{5}"],["90[056]\\d{5}"],0,0,["803\\d{5}"],0,["3[08]\\d{6}"],["808\\d{5}"]]],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:20[2-8]|3(?:[0-2][2-7]|3[24-7])|4(?:0[2-467]|1[2467])|5(?:0[2467]|1[24-7]|2[2-467]))\\d{5}",[8]],["6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}",[8]],["80(?:[0-2578]|9\\d)\\d{5}"],["9(?:4[1568]|5[178])\\d{5}",[8]],0,0,["77[1-9]\\d{5}",[8]],0,["78[1-49]\\d{5}",[8]]]],MF:["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"0|([24-9]\\d{6})$","20$1",0,0,[["2072[29]\\d{4}|20(?:2\\d|4[47]|5[3467]|6[279]|7[35]|8[268]|9[245])\\d{5}"],["3[2-489]\\d{7}"],0,0,0,0,0,0,["22\\d{7}"]]],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1",0,0,0,0,0,[["(?:247|528|625)\\d{4}"],["(?:(?:23|54)5|329|45[356])\\d{4}"],0,0,0,0,0,0,["635\\d{4}"]]],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:2(?:62|77)0|3444)\\d|4[56]440)\\d{3}|(?:34|4[357])700\\d{3}|(?:2(?:[23]\\d|5[0-578]|6[01]|82)|3(?:1[3-68]|[23][2-68]|4[23568])|4(?:[23][2-68]|4[3-68]|5[2568]|6[25-8]|7[24-68]|8[4-68]))\\d{5}"],["7(?:3555|4(?:60\\d|747)|94(?:[01]\\d|2[0-4]))\\d{3}|7(?:[0-25-8]\\d|3[1-4]|42|9[23])\\d{5}"],["800\\d{5}"],["5[02-9]\\d{6}"],0,0,0,0,0,["8(?:0[1-9]|[1-9]\\d)\\d{5}"]]],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]],0,0,0,0,0,0,[["2(?:07[0-8]|12[67])\\d{4}|(?:2(?:02|1[4-689])|4(?:0[0-4]|4[1-39]))\\d{5}"],["2(?:0(?:01|79)|17\\d)\\d{4}|(?:5[01]|[679]\\d|8[2-49])\\d{6}"],["80\\d{6}"]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:(?:2\\d|3[56]|[89][0-6])\\d|4(?:2[2-469]|39|46|6[25]|7[0-3]|83)|6)|2(?:2(?:00|8[34])|4(?:0\\d|2[246]|39|46|62|7[0-3]|83)|51\\d\\d)|4(?:2(?:2\\d\\d|48[0-3])|3(?:20\\d|4(?:70|83)|56)|420\\d|5470)|6(?:0(?:[23]|88\\d)|(?:124|[56]2\\d)\\d|247[23]|3(?:20\\d|470)|4(?:2[04]\\d|47[23])|7(?:(?:3\\d|8[01459])\\d|4(?:39|60|7[013]))))\\d{4}|5(?:2(?:2\\d{5,6}|47[023]\\d{4})|(?:347[23]|4(?:2(?:1|86)|470)|522\\d|6(?:20\\d|483)|7(?:20\\d|48[0-2])|8(?:20\\d|47[02])|9(?:20\\d|47[01]))\\d{4})|7(?:(?:0470|4(?:25\\d|470)|5(?:202|470|96\\d))\\d{4}|1(?:20\\d{4,5}|4(?:70|83)\\d{4}))|8(?:1(?:2\\d{5,6}|4(?:10|7[01]\\d)\\d{3})|2(?:2\\d{5,6}|(?:320|490\\d)\\d{3})|(?:3(?:2\\d\\d|470)|4[24-7]|5(?:2\\d|4[1-9]|51)\\d|6[23])\\d{4})|(?:1[2-6]\\d|4(?:2[24-8]|3[2-7]|[46][2-6]|5[3-5])|5(?:[27][2-8]|3[2-68]|4[24-8]|5[23]|6[2-4]|8[24-7]|9[2-7])|6(?:[19]20|42[03-6]|(?:52|7[45])\\d)|7(?:[04][24-8]|[15][2-7]|22|3[2-4])|8(?:1[2-689]|2[2-8]|[35]2\\d))\\d{4}|25\\d{5,6}|(?:2[2-9]|6(?:1[2356]|[24][2-6]|3[24-6]|5[2-4]|6[2-8]|7[235-7]|8[245]|9[24])|8(?:3[24]|5[245]))\\d{4}",[6,7,8,9]],["(?:17[01]|9(?:2(?:[0-4]|[56]\\d\\d)|(?:3(?:[0-36]|4\\d)|(?:6\\d|9[4-8])\\d|7(?:3|40|[5-9]\\d)|8(?:78|[89]\\d))\\d|4(?:(?:[0245]\\d|[1379])\\d|88)|5[0-6])\\d)\\d{4}|9[69]1\\d{6}|9(?:[68]\\d|9[089])\\d{5}",[7,8,9,10]],["80080(?:[01][1-9]|2\\d)\\d{3}",[10]],0,0,0,0,0,["1333\\d{4}|[12]468\\d{4}",[8]]]],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0",0,0,0,0,0,[["[12]2[1-3]\\d{5,6}|7(?:0[0-5]\\d|128)\\d{4}|(?:[12](?:1|27)|5[368])\\d{6}|[12](?:3[2-8]|4[2-68]|5[1-4689])\\d{6,7}"],["(?:83[01]|920)\\d{5}|(?:5[05]|6[06]|8[015689]|9[013-9])\\d{6}",[8]],0,0,0,0,0,0,["712[0-79]\\d{4}|7(?:1[013-9]|[25-8]\\d)\\d{5}",[8]]]],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]],0,0,0,0,0,0,[["(?:28[2-9]|8(?:11|[2-57-9]\\d))\\d{5}",[8]],["6800[0-79]\\d{3}|6(?:[235]\\d\\d|6(?:0[0-5]|[1-9]\\d)|8(?:0[1-9]|[14-8]\\d|2[5-9]|[39][0-4]))\\d{4}",[8]],["0800\\d{3}",[7]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","670$1",0,"670",[["670(?:2(?:3[3-7]|56|8[4-8])|32[1-38]|4(?:33|8[348])|5(?:32|55|88)|6(?:64|70|82)|78[3589]|8[3-9]8|989)\\d{4}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],MQ:["596","00","(?:69|80)\\d{7}|(?:59|97)6\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["596(?:[03-7]\\d|10|2[7-9]|8[09]|9[4-9])\\d{4}"],["69(?:6(?:[0-46-9]\\d|5[0-6])|727)\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976(?:6\\d|7[0-367])\\d{4}"]]],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]],0,0,0,0,0,0,[["(?:25[08]|35\\d|45[1-7])\\d{5}"],["[2-4][0-46-9]\\d{6}"],["800\\d{5}"]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"1|([34]\\d{6})$","664$1",0,"664",[["6644(?:1[0-3]|91)\\d{4}"],["664(?:3(?:49|9[1-6])|49[2-6])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]],0,0,0,0,0,0,[["20(?:3[1-4]|6[059])\\d{4}|2(?:0[19]|[1-357]\\d|60)\\d{5}"],["(?:7(?:210|[79]\\d\\d)|9(?:[29]\\d\\d|69[67]|8(?:1[1-3]|89|97)))\\d{4}"],["800(?:02|[3467]\\d)\\d{3}"],["5(?:0(?:0(?:37|43)|(?:6\\d|70|9[0168])\\d)|[12]\\d0[1-5])\\d{3}"],0,0,["501\\d{5}"],["7117\\d{4}"],["3550\\d{4}"]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:5|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["5"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,[["(?:2(?:[0346-8]\\d|1[0-7])|4(?:[013568]\\d|2[4-7])|54(?:[3-5]\\d|71)|6\\d\\d|8(?:14|3[129]))\\d{4}",[7,8]],["5(?:4(?:2[1-389]|7[1-9])|87[15-8])\\d{4}|5(?:2[5-9]|4[3-689]|[57]\\d|8[0-689]|9[0-8])\\d{5}",[8]],["802\\d{7}|80[0-2]\\d{4}",[7,10]],["30\\d{5}",[7]],0,0,0,0,["3(?:20|9\\d)\\d{4}",[7]]],"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[3467]|9[13-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,[["(?:3(?:0[0-3]|3[0-59])|6(?:[57][02468]|6[024-68]|8[024689]))\\d{4}",[7]],["46[46]\\d{4}|(?:7\\d|9[13-9])\\d{5}",[7]],["800\\d{7}",[10]],["900\\d{7}",[10]],0,0,["4(?:0[01]|50)\\d{4}",[7]]],"00"],MW:["265","00","(?:[129]\\d|31|77|88)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0",0,0,0,0,0,[["(?:1[2-9]|2[12]\\d\\d)\\d{5}"],["111\\d{6}|(?:31|77|88|9[89])\\d{7}",[9]]]],MX:["52","0[09]","1(?:(?:44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[017]\\d|[235][1-9]|4[0-35-9]|6[0-46-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,[["657[12]\\d{6}|(?:2(?:0[01]|2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}",[10]],["657[12]\\d{6}|(?:1(?:2(?:2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[24-7][1-9]|3[1-8]|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|[69][1-9]|7[12]|8[1-8]))|2(?:2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}"],["8(?:00|88)\\d{7}",[10]],["900\\d{7}",[10]],["500\\d{7}",[10]],0,0,0,0,["300\\d{7}",[10]]],"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0",0,0,0,0,0,[["(?:3(?:2[0-36-9]|3[0-368]|4[0-278]|5[0-24-8]|6[0-467]|7[1246-9]|8\\d|9[0-57])\\d|4(?:2[0-689]|[3-79]\\d|8[1-35689])|5(?:2[0-589]|[3468]\\d|5[0-489]|7[1-9]|9[23])|6(?:2[2-9]|3[1357-9]|[46]\\d|5[0-6]|7[0-35-9]|85|9[015-8])|7(?:[2579]\\d|3[03-68]|4[0-8]|6[5-9]|8[0-35-9])|8(?:[24][2-8]|3[2-5]|5[2-7]|6[2-589]|7[2-578]|[89][2-9])|9(?:0[57]|13|[25-7]\\d|[3489][0-8]))\\d{5}",[8,9]],["1(?:1888[689]|4400|8(?:47|8[27])[0-4])\\d{4}|1(?:0(?:[23568]\\d|4[0-6]|7[016-9]|9[0-8])|1(?:[1-5]\\d\\d|6(?:0[5-9]|[1-9]\\d)|7(?:[0134]\\d|2[1-9]|5[0-6]))|(?:[269]\\d|[37][1-9]|4[235-9])\\d|5(?:31|9\\d\\d)|8(?:1[23]|[236]\\d|4[06]|5(?:46|[7-9])|7[016-9]|8[01]|9[0-8]))\\d{5}",[9,10]],["1[378]00\\d{6}",[10]],["1600\\d{6}",[10]],0,0,0,0,["15(?:4(?:6[0-4]\\d|8(?:0[125]|[17]\\d|21|3[01]|4[01589]|5[014]|6[02]))|6(?:32[0-6]|78\\d))\\d{4}",[10]]]],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["2(?:[1346]\\d|5[0-2]|[78][12]|93)\\d{5}",[8]],["8[2-79]\\d{7}",[9]],["800\\d{6}",[9]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0",0,0,0,0,0,[["64426\\d{3}|6(?:1(?:2[2-7]|3[01378]|4[0-4])|254|32[0237]|4(?:27|41|5[25])|52[236-8]|626|7(?:2[2-4]|30))\\d{4,5}|6(?:1(?:(?:0\\d|2[0189]|3[24-69]|4[5-9])\\d|17|69|7[014])|2(?:17|5[0-36-8]|69|70)|3(?:17|2[14-689]|34|6[289]|7[01]|81)|4(?:17|2[0-2]|4[06]|5[0137]|69|7[01])|5(?:17|2[0459]|69|7[01])|6(?:17|25|38|42|69|7[01])|7(?:17|2[569]|3[13]|6[89]|7[01]))\\d{4}"],["(?:60|8[1245])\\d{7}",[9]],["80\\d{7}",[9]],["8701\\d{5}",[9]],0,0,0,0,["8(?:3\\d\\d|86)\\d{5}"]]],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]],0,0,0,0,0,0,[["(?:2[03-9]|3[0-5]|4[1-7]|88)\\d{4}"],["(?:5[0-4]|[79]\\d|8[0-79])\\d{4}"],["050\\d{3}"],["36\\d{4}"]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[04]"]]],0,0,0,0,0,0,[["2(?:0(?:20|3[1-8]|4[13-5]|5[14]|6[14578]|7[1-578])|1(?:4[145]|5[14]|6[14-68]|7[169]|88))\\d{4}"],["(?:23|7[04]|[89]\\d)\\d{6}"],["08\\d{6}"],["09\\d{6}"]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1",0,0,[["(?:1(?:06|17|28|39)|3[0-2]\\d)\\d{3}"],["(?:14|3[58])\\d{4}"]]],NG:["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0",0,0,0,0,0,[["(?:(?:[1-356]\\d|4[02-8]|8[2-9])\\d|9(?:0[3-9]|[1-9]\\d))\\d{5}|7(?:0(?:[013-689]\\d|2[0-24-9])\\d{3,4}|[1-79]\\d{6})|(?:[12]\\d|4[147]|5[14579]|6[1578]|7[1-3578])\\d{5}",[7,8]],["(?:702[0-24-9]|8(?:01|19)[01])\\d{6}|(?:70[13-689]|8(?:0[2-9]|1[0-8])|9(?:0[1-9]|1[2356]))\\d{7}",[10]],["800\\d{7,11}",[10,11,12,13,14]],0,0,0,["700\\d{7,11}",[10,11,12,13,14]]]],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]],0,0,0,0,0,0,[["2\\d{7}"],["(?:5(?:5[0-7]|[78]\\d)|6(?:20|3[035]|4[045]|5[05]|77|8[1-9]|9[059])|(?:7[5-8]|8\\d)\\d)\\d{5}"],["1800\\d{4}"]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:[035]\\d|1[13-578]|6[124-8]|7[24]|8[0-467])|2(?:[0346]\\d|2[2-46-9]|5[125]|9[479])|3(?:[03568]\\d|1[3-8]|2[01]|4[1-8])|4(?:[0356]\\d|1[1-368]|7[58]|8[15-8]|9[23579])|5(?:[0358]\\d|[19][1-9]|2[1-57-9]|4[13-8]|6[126]|7[0-3578])|7\\d\\d)\\d{6}",[9]],["(?:6[1-58]|970\\d)\\d{7}",[9,11]],["800\\d{4,7}",[7,8,9,10]],["90[069]\\d{4,7}",[7,8,9,10]],0,0,["140(?:1[035]|2[0346]|3[03568]|4[0356]|5[0358]|8[458])|(?:140(?:1[16-8]|2[259]|3[124]|4[17-9]|5[124679]|7)|8[478]\\d{6})\\d",[5,6,9]],["66\\d{7}",[9]],["(?:85|91)\\d{7}",[9]]]],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[489]|59"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-7]"]]],0,0,0,0,0,"[02-689]|7[0-8]",[["(?:2[1-4]|3[1-3578]|5[1-35-7]|6[1-4679]|7[0-8])\\d{6}",[8]],["(?:4[015-8]|59|9\\d)\\d{6}",[8]],["80[01]\\d{5}",[8]],["82[09]\\d{5}",[8]],["880\\d{5}",[8]],0,["(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}"],0,["85[0-5]\\d{5}",[8]],["810(?:0[0-6]|[2-8]\\d)\\d{3}",[8]]]],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0",0,0,0,0,0,[["(?:1[0-6]\\d|99[02-6])\\d{5}|(?:2[13-79]|3[135-8]|4[146-9]|5[135-7]|6[13-9]|7[15-9]|8[1-46-9]|9[1-7])[2-6]\\d{5}",[8]],["9(?:6[0-3]|7[024-6]|8[0-24-68])\\d{7}",[10]],["1(?:66001|800\\d\\d)\\d{5}",[11]]]],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]],0,0,0,0,0,0,[["444\\d{4}"],["(?:55[3-9]|666|8\\d\\d)\\d{4}"]]],NU:["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]],0,0,0,0,0,0,[["[47]\\d{3}",[4]],["888[4-9]\\d{3}",[7]]]],NZ:["64","0(?:0|161)","[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-579]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|[89]0","50(?:[0367]|88)|[89]0"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[59]|80"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7|86"],"0$1"]],"0",0,0,0,0,0,[["24099\\d{3}|(?:3[2-79]|[49][2-9]|6[235-9]|7[2-57-9])\\d{6}",[8]],["2[0-27-9]\\d{7,8}|21\\d{6}",[8,9,10]],["508\\d{6,7}|80\\d{6,8}",[8,9,10]],["(?:11\\d{5}|50(?:0[08]|30|66|77|88))\\d{3}|90\\d{6,8}",[7,8,9,10]],["70\\d{7}",[9]],0,["8(?:1[6-9]|22|3\\d|4[045]|5[459]|7[0-3579]|90)\\d{2,7}"],["[28]6\\d{6,7}",[8,9]]],"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]],0,0,0,0,0,0,[["2[2-6]\\d{6}",[8]],["1505\\d{4}|(?:7(?:[1289]\\d|7[0-4])|9(?:0[1-9]|[1-9]\\d))\\d{5}",[8]],["8007\\d{4,5}|(?:500|800[05])\\d{4}"],["900\\d{5}",[8]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["(?:1(?:0\\d|1[479]|2[37]|3[0137]|4[17]|5[05]|6[58]|7[0167]|8[258]|9[1389])|2(?:[0235-79]\\d|1[0-7]|4[013-9]|8[02-9])|3(?:[089]\\d|1[0-7]|2[0-5]|33|4[0-79]|5[0-35]|6[068]|7[0-8])|4(?:00|3[0-579]|4\\d|7[0-57-9])|5(?:[01]\\d|2[0-7]|[56]0|79)|7(?:0[09]|2[0-26-8]|3[03]|4[04]|5[05-9]|6[056]|7[0-24-9]|8[5-9]|90)|8(?:09|2[89]|3\\d|4[0-24-689]|5[014]|8[02])|9(?:0[5-9]|1[0135-8]|2[036-9]|3[35-79]|40|5[0457-9]|6[05-9]|7[04-9]|8[35-8]|9\\d))\\d{4}",[7]],["(?:1[16]1|21[89]|6\\d{3}|8(?:1[01]|7[23]))\\d{4}",[7,8]],["800\\d{4,5}|(?:00800|800\\d)\\d{6}"],["(?:8(?:22|55|60|7[78]|86)|9(?:00|81))\\d{4}",[7]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,[["(?:(?:4[34]|5[14])[0-8]\\d|7(?:173|3[0-8]\\d)|8(?:10[05689]|6(?:0[06-9]|1[6-9]|29)|7(?:0[569]|[56]0)))\\d{4}|(?:1[0-8]|4[12]|5[236]|6[1-7]|7[246]|8[2-4])\\d{6}",[8]],["9\\d{8}",[9]],["800\\d{5}",[8]],["805\\d{5}",[8]],["80[24]\\d{5}",[8]],0,0,0,0,["801\\d{5}",[8]]],"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]],0,0,0,0,0,0,[["4(?:0[4-689]|9[4-68])\\d{5}",[8]],["8[7-9]\\d{6}",[8]],["80[0-5]\\d{6}",[9]],0,0,0,["44\\d{4}",[6]],0,["499\\d{5}",[8]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,[["(?:(?:3[0-2]|4[257]|5[34]|9[78])\\d|64[1-9]|85[02-46-9])\\d{4}",[7]],["(?:7\\d|8[128])\\d{6}",[8]],["180\\d{4}",[7]],0,0,0,0,["27[01]\\d{4}",[7]],["2(?:0[0-57]|7[568])\\d{4}",[7]]],"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0",0,0,0,0,0,[["(?:(?:2[3-8]|3[2-68]|4[2-9]|5[2-6]|6[2-58]|7[24578])\\d{3}|88(?:22\\d\\d|42))\\d{4}|(?:2|8[2-8]\\d\\d)\\d{5}",[6,8,9,10]],["(?:8(?:1[37]|9[5-8])|9(?:0[5-9]|1[0-24-9]|[235-7]\\d|4[2-9]|8[135-9]|9[1-9]))\\d{7}",[10]],["1800\\d{7,9}",[11,12,13]]]],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0",0,0,0,0,0,[["(?:(?:21|42)[2-9]|58[126])\\d{7}|(?:2[25]|4[0146-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\\d{6,7}|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8]))[2-9]\\d{5,6}",[9,10]],["3(?:[0-24]\\d|3[0-7]|55|64)\\d{7}",[10]],["800\\d{5}(?:\\d{3})?",[8,11]],["900\\d{5}",[8]],["122\\d{6}",[9]],0,["(?:2(?:[125]|3[2358]|4[2-4]|9[2-8])|4(?:[0-246-9]|5[3479])|5(?:[1-35-7]|4[2-467])|6(?:0[468]|[1-8])|7(?:[14]|2[236])|8(?:[16]|2[2-689]|3[23578]|4[3478]|5[2356])|9(?:1|22|3[27-9]|4[2-6]|6[3569]|9[2-7]))111\\d{6}",[11,12]]]],PL:["48","00","6\\d{5}(?:\\d{2})?|8\\d{9}|[1-9]\\d{6}(?:\\d{2})?",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]],0,0,0,0,0,0,[["47\\d{7}|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])(?:[02-9]\\d{6}|1(?:[0-8]\\d{5}|9\\d{3}(?:\\d{2})?))",[7,9]],["21(?:1(?:[145]\\d|3[1-5])|2[0-4]\\d)\\d{4}|(?:45|5[0137]|6[069]|7[2389]|88)\\d{7}",[9]],["800\\d{6,7}",[9,10]],["70[01346-8]\\d{6}",[9]],0,0,["804\\d{6}",[9]],["64\\d{4,7}",[6,7,8,9]],["39\\d{7}",[9]],["801\\d{6}",[9]]]],PM:["508","00","(?:[45]|80\\d\\d)\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:4[1-356]|50)\\d{4}",[6]],["(?:4[02-4]|5[056])\\d{4}",[6]],["80[0-5]\\d{6}",[9]]]],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939",[["(?:787|939)[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["(?:22[2-47-9]|42[45]|82[014-68]|92[3569])\\d{5}",[8]],["5[69]\\d{7}",[9]],["1800\\d{6}",[10]],0,0,0,0,0,0,["1700\\d{6}",[10]]]],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]],0,0,0,0,0,0,[["2(?:[12]\\d|3[1-689]|4[1-59]|[57][1-9]|6[1-35689]|8[1-69]|9[1256])\\d{6}"],["6(?:[06]92(?:30|9\\d)|[35]92(?:3[03]|9\\d))\\d{3}|(?:(?:16|6[0356])93|9(?:[1-36]\\d\\d|480))\\d{5}"],["80[02]\\d{6}"],["(?:6(?:0[178]|4[68])\\d|76(?:0[1-57]|1[2-47]|2[237]))\\d{5}"],["884[0-4689]\\d{5}"],0,["70(?:7\\d|8[17])\\d{5}"],0,["30\\d{7}"],["80(?:8\\d|9[1579])\\d{5}"]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]],0,0,0,0,0,0,[["(?:2(?:55|77)|345|488|5(?:35|44|87)|6(?:22|54|79)|7(?:33|47)|8(?:24|55|76)|900)\\d{4}"],["(?:(?:46|83)[0-5]|6[2-4689]0)\\d{4}|(?:45|77|88)\\d{5}"]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,[["(?:[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36])\\d{5,7}|(?:2(?:2[4-68]|[4-68]\\d|7[15]|9[1-5])|3(?:18|3[167]|4[2357]|51|[67]\\d)|4(?:3[12]|5[13]|9[1-47])|5(?:[1-4]\\d|5[02-4])|6(?:3[1-3]|44|7[1-8])|7(?:4[0-4]|5\\d|6[1-578]|75|8[0-8])|858)\\d{5,6}",[7,8,9]],["9(?:51|6[129]|[78][1-6]|9[1-5])\\d{6}",[9]],["9800\\d{5,7}",[9,10,11]],0,0,0,["[2-9]0\\d{4,7}",[6,7,8,9]],0,["8700[0-4]\\d{4}",[9]]]],QA:["974","00","[2-7]\\d{7}|800\\d{4}(?:\\d{2})?|2\\d{6}",[7,8,9],[["(\\d{3})(\\d{4})","$1 $2",["2[126]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]]],0,0,0,0,0,0,[["414[1-4]\\d{4}|(?:23|4[04])\\d{6}",[8]],["(?:2[89]|[35-7]\\d)\\d{6}",[8]],["800\\d{4}(?:\\d{2})?",[7,9]],0,0,0,0,["2(?:[12]\\d|61)\\d{4}",[7]]]],RE:["262","00","976\\d{6}|(?:26|[68]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,"26[23]|69|[89]",[["26(?:2\\d\\d|3(?:0\\d|1[01]))\\d{4}"],["(?:69(?:2\\d\\d|3(?:0[0-46]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|6[0-6]|7[0-27]|8[0-8]|9[0-479]))|976(?:2[27]|3[0-37]|9\\d))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,0,["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,[["[23][13-6]\\d{7}|(?:2(?:19\\d|[3-6]\\d9)|31\\d\\d)\\d\\d"],["7020\\d{5}|7(?:0[013-9]|1[0-3]|[2-7]\\d|8[03-8]|9[019])\\d{6}",[9]],["800\\d{6}",[9]],["90[0136]\\d{6}",[9]],0,0,["(?:37\\d|80[578])\\d{6}",[9]],0,0,["801\\d{6}",[9]]],0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0",0,0,0,0,0,[["(?:11[1-9]\\d|(?:2[389]|39)(?:0[2-9]|[2-9]\\d))\\d{3,8}|(?:1[02-9]|2[0-24-7]|3[0-8])[2-9]\\d{4,9}",[7,8,9,10,11,12]],["6(?:[0-689]|7\\d)\\d{6,7}",[8,9,10]],["800\\d{3,9}"],["(?:78\\d|90[0169])\\d{3,7}",[6,7,8,9,10]],0,0,["7[06]\\d{4,10}"]]],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-6]2|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-6]2|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",[["(?:3(?:0[12]|4[1-35-79]|5[1-3]|65|8[1-58]|9[0145])|4(?:01|1[1356]|2[13467]|7[1-5]|8[1-7]|9[1-689])|8(?:1[1-8]|2[01]|3[13-6]|4[0-8]|5[15]|6[1-35-79]|7[1-37-9]))\\d{7}",[10]],["9\\d{9}",[10]],["8(?:0[04]|108\\d{3})\\d{7}"],["80[39]\\d{7}",[10]],["808\\d{7}",[10]]],"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]]],"0",0,0,0,0,0,[["(?:06|2[23568]\\d)\\d{6}"],["7[2389]\\d{7}",[9]],["800\\d{6}",[9]],["900\\d{6}",[9]]]],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0",0,0,0,0,0,[["1(?:1\\d|2[24-8]|3[35-8]|4[3-68]|6[2-5]|7[235-7])\\d{6}",[9]],["579[01]\\d{5}|5(?:[013-689]\\d|7[0-35-8])\\d{6}",[9]],["800\\d{7}",[10]],["925\\d{6}",[9]],0,0,["811\\d{7}",[10]],0,0,["920\\d{6}",[9]]]],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]],0,0,0,0,0,0,[["(?:1[4-79]|[23]\\d|4[0-2]|5[03]|6[0-37])\\d{3}",[5]],["48\\d{3}|(?:(?:7[1-9]|8[4-9])\\d|9(?:1[2-9]|2[013-9]|3[0-2]|[46]\\d|5[0-46-9]|7[0-689]|8[0-79]|9[0-8]))\\d{4}"],["1[38]\\d{3}",[5]],0,0,0,0,0,["5[12]\\d{3}",[5]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,[["4[2-46]\\d{5}"],["2[125-8]\\d{5}"],["800[08]\\d{3}"],0,0,0,0,0,["971\\d{4}|(?:64|95)\\d{5}"]],"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0",0,0,0,0,0,[["1(?:5\\d|8[35-7])\\d{6}"],["(?:1[0-2]|9[0-3569])\\d{7}"]]],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0",0,0,0,0,0,[["(?:(?:[12][136]|3[356]|4[0246]|6[03]|8\\d)\\d|90[1-9])\\d{4,6}|(?:1(?:2[0-35]|4[0-4]|5[0-25-9]|7[13-6]|[89]\\d)|2(?:2[0-7]|4[0136-8]|5[0138]|7[018]|8[01]|9[0-57])|3(?:0[0-4]|1\\d|2[0-25]|4[056]|7[0-2]|8[0-3]|9[023])|4(?:1[013-8]|3[0135]|5[14-79]|7[0-246-9]|8[0156]|9[0-689])|5(?:0[0-6]|[15][0-5]|2[0-68]|3[0-4]|4\\d|6[03-5]|7[013]|8[0-79]|9[01])|6(?:1[1-3]|2[0-4]|4[02-57]|5[0-37]|6[0-3]|7[0-2]|8[0247]|9[0-356])|9(?:1[0-68]|2\\d|3[02-5]|4[0-3]|5[0-4]|[68][01]|7[0135-8]))\\d{5,6}",[7,8,9]],["7[02369]\\d{7}",[9]],["20\\d{4,7}",[6,7,8,9]],["649\\d{6}|99[1-59]\\d{4}(?:\\d{3})?|9(?:00|39|44)[1-8]\\d{3,6}",[7,8,9,10]],["75[1-8]\\d{6}",[9]],0,["10[1-8]\\d{6}",[9]],["74[02-9]\\d{6}",[9]],0,["77[0-7]\\d{6}",[9]]]],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-5]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[["662[0-24-9]\\d{4}|6(?:[0-578]\\d|6[013-57-9]|9[0-35-9])\\d{5}",[8]],["8(?:05[0-3]|95[0-2])\\d{4}|(?:8(?:0[1-4]|[1-8]\\d|9[0-4])|9[0-8]\\d)\\d{5}",[8]],["(?:18|8)00\\d{7}",[10,11]],["1900\\d{7}",[11]],0,0,["7000\\d{7}",[11]],0,["(?:3[12]\\d|666)\\d{5}",[8]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]",[["2(?:[0-57-9]\\d|6[4-9])\\d\\d"],["[56]\\d{4}",[5]],0,0,0,0,0,0,["262\\d\\d",[5]]]],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,[["(?:[1-357][2-8]|4[24-8])\\d{6}",[8]],["65(?:1\\d|55|6[01]|70)\\d{4}|(?:[37][01]|4[0139]|51|6[489])\\d{6}",[8]],["80\\d{4,6}",[6,7,8]],["89[1-3]\\d{2,5}|90\\d{4,6}"],0,0,0,0,["(?:59\\d\\d|8(?:1(?:[67]\\d|8[0-589])|2(?:0\\d|2[0-37-9]|8[0-2489])|3[389]\\d))\\d{4}",[8]]],"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|[57]9)\\d{6}",[5,8],0,0,0,0,0,0,"79",[["79\\d{6}",[8]],["(?:4[015-8]|59|9\\d)\\d{6}",[8]],["80[01]\\d{5}",[8]],["82[09]\\d{5}",[8]],["880\\d{5}",[8]],0,["(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}"],0,["85[0-5]\\d{5}",[8]],["810(?:0[0-6]|[2-8]\\d)\\d{3}",[8]]]],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:16|[2-9]\\d{3})|(?:(?:[3-5][1-8]\\d|819)\\d|601[1-5])\\d)\\d{4}|(?:2|[3-5][1-8])1[67]\\d{3}|[3-5][1-8]16\\d\\d"],["909[1-9]\\d{5}|9(?:0[1-8]|1[0-24-9]|4[03-57-9]|5\\d)\\d{6}",[9]],["800\\d{6}",[9]],["9(?:00|[78]\\d)\\d{6}",[9]],0,0,["96\\d{7}",[9]],["9090\\d{3}",[7]],["6(?:02|5[0-4]|9[0-6])\\d{6}",[9]],["8[5-9]\\d{7}",[9]]]],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0",0,0,0,0,0,[["22[2-4][2-9]\\d{4}"],["(?:25|3[0-5]|66|7[2-9]|8[08]|9[09])\\d{6}"]]],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1",0,0,[["0549(?:8[0157-9]|9\\d)\\d{4}",[10]],["6[16]\\d{6}",[8]],0,["7[178]\\d{6}",[8]],0,0,0,0,["5[158]\\d{6}",[8]]]],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]],0,0,0,0,0,0,[["3(?:0(?:1[0-2]|80)|282|3(?:8[1-9]|9[3-9])|611)\\d{5}"],["75(?:01|[38]3)\\d{5}|7(?:[06-8]\\d|21|5[4-7]|90)\\d{6}"],["800\\d{6}"],["88[4689]\\d{6}"],0,0,0,0,["(?:3(?:392|9[01]\\d)\\d|93(?:3[13]0|929))\\d{4}"],["81[02468]\\d{6}"]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["24|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3478]|64|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6(?:0[5-7]|[1-35-9])|9[2-9]"]]],"0",0,0,0,0,0,[["(?:1\\d|2[0-79]|3[0-46-8]|4[0-7]|5[57-9])\\d{5}|(?:[134]\\d|8[125])\\d{4}",[6,7]],["(?:(?:15|(?:3[59]|4[89]|79|8[08])\\d|6(?:0[5-7]|[1-9]\\d)|9(?:0\\d|[2-9]))\\d|2(?:4\\d|8))\\d{5}|(?:6\\d|7[1-9])\\d{6}",[7,8,9]]]],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]],0,0,0,0,0,0,[["(?:2[1-3]|3[0-7]|(?:4|68)\\d|5[2-58])\\d{4}"],["(?:7[124-7]|8[124-9])\\d{5}",[7]],0,0,0,0,0,0,["56\\d{4}",[6]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0",0,0,0,0,0,[["1[89]\\d{7}"],["(?:12|9[1257-9])\\d{7}"]]],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]],0,0,0,0,0,0,[["22\\d{5}"],["900[5-9]\\d{3}|9(?:0[1-9]|[89]\\d)\\d{4}"]]],SV:["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,[["2(?:[1-6]\\d{3}|[79]90[034]|890[0245])\\d{3}",[8]],["66(?:[02-9]\\d\\d|1(?:[02-9]\\d|16))\\d{3}|(?:6[0-57-9]|7\\d)\\d{6}",[8]],["800\\d{4}(?:\\d{4})?",[7,11]],["900\\d{4}(?:\\d{4})?",[7,11]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|(5\\d{6})$","721$1",0,"721",[["7215(?:4[2-8]|8[239]|9[056])\\d{4}"],["7215(?:1[02]|2\\d|5[034679]|8[014-8])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0",0,0,0,0,0,[["21\\d{6,7}|(?:1(?:[14]\\d|[2356])|2[235]|3(?:[13]\\d|4)|4[134]|5[1-3])\\d{6}"],["9[1-689]\\d{7}",[9]]]],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]],0,0,0,0,0,0,[["[23][2-5]\\d{6}",[8]],["7[6-9]\\d{6}",[8]],["0800\\d{4}",[8]],["900\\d{6}",[9]],0,0,0,0,["70\\d{6}",[8]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8",[["8\\d{3}"]]],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"1|([2-479]\\d{6})$","649$1",0,"649",[["649(?:266|712|9(?:4\\d|50))\\d{4}"],["649(?:2(?:3[129]|4[1-79])|3\\d\\d|4[34][1-3])\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["649(?:71[01]|966)\\d{4}"]]],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,[["22(?:[37-9]0|5[0-5]|6[89])\\d{4}"],["(?:6[023568]|77|9\\d)\\d{6}"]],"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]],0,0,0,0,0,0,[["2(?:2[2-7]|3[23]|4[45]|55|6[67]|77)\\d{5}"],["(?:7[09]|9[0-36-9])\\d{6}"]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0",0,0,0,0,0,[["(?:1[0689]|2\\d|3[2-9]|4[2-5]|5[2-6]|7[3-7])\\d{6}",[8]],["671[0-8]\\d{5}|(?:14|6[1-6]|[89]\\d)\\d{7}",[9]],["(?:001800\\d|1800)\\d{6}",[10,13]],["1900\\d{6}",[10]],0,0,0,0,["6[08]\\d{7}",[9]]]],TJ:["992","810","(?:00|[1-57-9]\\d)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[34]7|91[78]"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,[["(?:3(?:1[3-5]|2[245]|3[12]|4[24-7]|5[25]|72)|4(?:46|74|87))\\d{6}"],["41[18]\\d{6}|(?:[034]0|[17][017]|2[02]|5[05]|8[08]|9\\d)\\d{7}"]],"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7],0,0,0,0,0,0,0,[["(?:2[2-4]|[34]\\d)\\d{2,5}"],["7[2-4]\\d{2,5}"]]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]],0,0,0,0,0,0,[["(?:2[1-5]|3[1-9]|4[1-4])\\d{5}",[7]],["7[2-8]\\d{6}",[8]],["80\\d{5}",[7]],["90\\d{5}",[7]],["70\\d{5}",[7]]]],TM:["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,[["(?:1(?:2\\d|3[1-9])|2(?:22|4[0-35-8])|3(?:22|4[03-9])|4(?:22|3[128]|4\\d|6[15])|5(?:22|5[7-9]|6[014-689]))\\d{5}"],["6\\d{7}"]],"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]],0,0,0,0,0,0,[["81200\\d{3}|(?:3[0-2]|7\\d)\\d{6}"],["3(?:001|[12]40)\\d{4}|(?:(?:[259]\\d|4[0-7])\\d|3(?:1[1-35]|6[0-4]|91))\\d{5}"],["8010\\d{4}"],["88\\d{6}"],0,0,0,0,0,["8[12]10\\d{4}"]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]],0,0,0,0,0,0,[["(?:2\\d|3[0-8]|4[0-4]|50|6[09]|7[0-24-69]|8[05])\\d{3}",[5]],["(?:55[4-6]|6(?:[09]\\d|3[02]|8[15-9])|(?:7\\d|8[46-9])\\d|999)\\d{4}",[7]],["0800\\d{3}",[7]],0,0,0,0,0,["55[0-37-9]\\d{4}",[7]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0",0,0,0,0,0,[["(?:2(?:[13][26]|[28][2468]|[45][268]|[67][246])|3(?:[13][28]|[24-6][2468]|[78][02468]|92)|4(?:[16][246]|[23578][2468]|4[26]))\\d{7}",[10]],["56161\\d{5}|5(?:0[15-7]|1[06]|24|[34]\\d|5[1-59]|9[46])\\d{7}",[10]],["8(?:00\\d{7}(?:\\d{2,3})?|11\\d{7})",[10,12,13]],["(?:8[89]8|900)\\d{7}",[10]],["592(?:21[12]|461)\\d{4}",[10]],0,["444\\d{4}",[7]],["512\\d{7}",[10]],["850\\d{7}",[10]]]],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-46-8]\\d{6})$","868$1",0,"868",[["868(?:2(?:0[13]|1[5-9]|[23]\\d|4[0-2])|6(?:0[7-9]|1[02-8]|2[1-9]|[3-69]\\d|7[0-79])|82[124])\\d{4}"],["868(?:(?:2[5-9]|3\\d)\\d|4(?:3[0-6]|[6-9]\\d)|6(?:20|78|8\\d)|7(?:0[1-9]|1[02-9]|[2-9]\\d))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]],0,0,0,0,0,0,[["2[02-9]\\d{3}",[5]],["(?:7[01]\\d|90)\\d{4}",[6,7]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["(?:2[2-8]\\d|370|55[01]|7[1-9])\\d{6}|4(?:(?:0(?:0[1-9]|[2-48]\\d)|1[023]\\d)\\d{4,5}|(?:[239]\\d\\d|4(?:0[56]|12|49))\\d{5})|6(?:[01]\\d{7}|4(?:0[56]|12|24|4[09])\\d{4,5})|8(?:(?:2(?:3\\d|4[0-269]|[578]0|66)|36[24-9]|90\\d\\d)\\d{4}|4(?:0[56]|12|24|4[09])\\d{4,5})|(?:2(?:2(?:0\\d\\d|4(?:0[68]|[249]0|3[0-467]|5[0-25-9]|6[0235689]))|(?:3(?:[09]\\d|1[0-4])|(?:4\\d|5[0-49]|6[0-29]|7[0-5])\\d)\\d)|(?:(?:3[2-9]|5[2-8]|6[0-35-79]|8[7-9])\\d\\d|4(?:2(?:[089]\\d|7[1-9])|(?:3[0-4]|[78]\\d|9[01])\\d))\\d)\\d{3}",[8,9]],["(?:40001[0-2]|9[0-8]\\d{4})\\d{3}",[9]],["80[0-79]\\d{6}|800\\d{5}",[8,9]],["20(?:[013-9]\\d\\d|2)\\d{4}",[7,9]],["99\\d{7}",[9]],0,["50[0-46-9]\\d{6}",[9]],0,["7010(?:[0-2679]\\d|3[0-7]|8[0-5])\\d{5}|70\\d{8}",[10,11]]],0,"#"],TZ:["255","00[056]","(?:[26-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0",0,0,0,0,0,[["2[2-8]\\d{7}"],["77[2-9]\\d{6}|(?:6[1-9]|7[1-689])\\d{7}"],["80[08]\\d{6}"],["90\\d{7}"],0,0,0,0,["41\\d{7}"],["8(?:40|6[01])\\d{6}"]]],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,[["(?:3[1-8]|4[13-8]|5[1-7]|6[12459])\\d{7}",[9]],["(?:39|50|6[36-8]|7[1-3]|9[1-9])\\d{7}",[9]],["800[1-8]\\d{5,6}"],["900[239]\\d{5,6}"],0,0,0,0,["89[1-579]\\d{6}",[9]]],"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0",0,0,0,0,0,[["20(?:(?:240|30[67])\\d|6(?:00[0-2]|30[0-4]))\\d{3}|(?:20(?:[017]\\d|2[5-9]|32|5[0-4]|6[15-9])|[34]\\d{3})\\d{5}"],["726[01]\\d{5}|7(?:[01578]\\d|20|36|[46][0-4]|9[89])\\d{6}"],["800[1-3]\\d{5}"],["90[1-3]\\d{6}"]]],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5(?:05(?:[2-57-9]\\d\\d|6(?:[0-35-9]\\d|44))|82(?:2(?:0[0-3]|[268]2)|3(?:0[02]|22|33)|4(?:00|4[24]|65|82)|5(?:00|29|58|83)|6(?:00|66|82)|7(?:58|77)|8(?:00|42|5[25]|88)|9(?:00|9[89])))\\d{4}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[12]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[0-5]|8[056])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-289]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","4\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:770|987)|(?:2\\d|4[2-7])\\d\\d)\\d{4}",[8]],["9[1-9]\\d{6}",[8]],["(?:4\\d{5}|80[05])\\d{4}|405\\d{4}",[7,10]],["90[0-8]\\d{4}",[7]]],"00"," int. "],UZ:["998","810","(?:33|55|[679]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[35-9]"],"8 $1"]],"8",0,0,0,0,0,[["(?:6(?:1(?:22|3[124]|4[1-4]|5[1-3578]|64)|2(?:22|3[0-57-9]|41)|5(?:22|3[3-7]|5[024-8])|6\\d\\d|7(?:[23]\\d|7[69])|9(?:22|4[1-8]|6[135]))|7(?:0(?:5[4-9]|6[0146]|7[124-6]|9[135-8])|(?:1[12]|8\\d)\\d|2(?:22|3[13-57-9]|4[1-3579]|5[14])|3(?:2\\d|3[1578]|4[1-35-7]|5[1-57]|61)|4(?:2\\d|3[1-579]|7[1-79])|5(?:22|5[1-9]|6[1457])|6(?:22|3[12457]|4[13-8])|9(?:22|5[1-9])))\\d{5}"],["(?:(?:33|88|9[0-57-9])\\d{3}|55(?:50[013]|90\\d)|6(?:1(?:2(?:2[01]|98)|35[0-4]|50\\d|61[23]|7(?:[01][017]|4\\d|55|9[5-9]))|2(?:(?:11|7\\d)\\d|2(?:[12]1|9[01379])|5(?:[126]\\d|3[0-4]))|5(?:19[01]|2(?:27|9[26])|(?:30|59|7\\d)\\d)|6(?:2(?:1[5-9]|2[0367]|38|41|52|60)|(?:3[79]|9[0-3])\\d|4(?:56|83)|7(?:[07]\\d|1[017]|3[07]|4[047]|5[057]|67|8[0178]|9[79]))|7(?:2(?:24|3[237]|4[5-9]|7[15-8])|5(?:7[12]|8[0589])|7(?:0\\d|[39][07])|9(?:0\\d|7[079]))|9(?:2(?:1[1267]|3[01]|5\\d|7[0-4])|(?:5[67]|7\\d)\\d|6(?:2[0-26]|8\\d)))|7(?:[07]\\d{3}|1(?:13[01]|6(?:0[47]|1[67]|66)|71[3-69]|98\\d)|2(?:2(?:2[79]|95)|3(?:2[5-9]|6[0-6])|57\\d|7(?:0\\d|1[17]|2[27]|3[37]|44|5[057]|66|88))|3(?:2(?:1[0-6]|21|3[469]|7[159])|(?:33|9[4-6])\\d|5(?:0[0-4]|5[579]|9\\d)|7(?:[0-3579]\\d|4[0467]|6[67]|8[078]))|4(?:2(?:29|5[0257]|6[0-7]|7[1-57])|5(?:1[0-4]|8\\d|9[5-9])|7(?:0\\d|1[024589]|2[0-27]|3[0137]|[46][07]|5[01]|7[5-9]|9[079])|9(?:7[015-9]|[89]\\d))|5(?:112|2(?:0\\d|2[29]|[49]4)|3[1568]\\d|52[6-9]|7(?:0[01578]|1[017]|[23]7|4[047]|[5-7]\\d|8[78]|9[079]))|6(?:2(?:2[1245]|4[2-4])|39\\d|41[179]|5(?:[349]\\d|5[0-2])|7(?:0[017]|[13]\\d|22|44|55|67|88))|9(?:22[128]|3(?:2[0-4]|7\\d)|57[02569]|7(?:2[05-9]|3[37]|4\\d|60|7[2579]|87|9[07]))))\\d{4}"]],"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698",[["06698\\d{1,6}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","784$1",0,"784",[["784(?:266|3(?:6[6-9]|7\\d|8[0-6])|4(?:38|5[0-36-8]|8[0-8])|5(?:55|7[0-2]|93)|638|784)\\d{4}"],["784(?:4(?:3[0-5]|5[45]|89|9[0-8])|5(?:2[6-9]|3[0-4])|720)\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["78451[0-2]\\d{4}"]]],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:12|3[457-9]|[467]\\d|[58][1-9]|9[1-6])|[4-6]00)\\d{7}"],["4(?:1[24-8]|2[46])\\d{7}"],["800\\d{7}"],["90[01]\\d{7}"],0,0,["501\\d{7}"]]],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-578]\\d{6})$","284$1",0,"284",[["284496[0-5]\\d{3}|284(?:229|4(?:22|9[45])|774|8(?:52|6[459]))\\d{4}"],["284496[6-9]\\d{3}|284(?:245|3(?:0[0-3]|4[0-7]|68|9[34])|4(?:4[0-6]|68|99)|5(?:4[0-7]|68|9[69]))\\d{4}"],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","340$1",0,"340",[["340(?:2(?:0[0-38]|2[06-8]|4[49]|77)|3(?:32|44)|4(?:2[23]|44|7[34]|89)|5(?:1[34]|55)|6(?:2[56]|4[23]|77|9[023])|7(?:1[2-57-9]|2[57]|7\\d)|884|998)\\d{4}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[69]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3578]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0",0,0,0,0,0,[["2(?:0[3-9]|1[0-689]|2[0-25-9]|3[2-9]|4[2-8]|5[124-9]|6[0-39]|7[0-7]|8[2-79]|9[0-4679])\\d{7}",[10]],["(?:5(?:2[238]|59)|89[6-9]|99[013-9])\\d{6}|(?:3\\d|5[689]|7[06-9]|8[1-8]|9[0-8])\\d{7}",[9]],["1800\\d{4,6}|12(?:0[13]|28)\\d{4}",[8,9,10]],["1900\\d{4,6}",[8,9,10]],0,0,["(?:[17]99|80\\d)\\d{4}|69\\d{5,6}",[7,8]],0,["672\\d{6}",[9]]]],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]],0,0,0,0,0,0,[["(?:38[0-8]|48[4-9])\\d\\d|(?:2[02-9]|3[4-7]|88)\\d{3}",[5]],["(?:[58]\\d|7[013-7])\\d{5}",[7]],["81[18]\\d\\d",[5]],0,0,0,["(?:3[03]|900\\d)\\d{3}"],0,["9(?:0[1-9]|1[01])\\d{4}",[7]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]],0,0,0,0,0,0,[["72\\d{4}",[6]],["(?:72|8[23])\\d{4}",[6]],["80[0-5]\\d{6}",[9]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]],0,0,0,0,0,0,[["6[1-9]\\d{3}|(?:[2-5]|60)\\d{4}",[5,6]],["(?:7[1-35-7]|8(?:[3-7]|9\\d{3}))\\d{5}",[7,10]],["800\\d{3}",[6]]]],XK:["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0",0,0,0,0,0,[["(?:2[89]|39)0\\d{6}|[23][89]\\d{6}"],["4[3-9]\\d{6}",[8]],["800\\d{5}",[8]],["900\\d{5}",[8]]]],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7[24-68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,[["78[0-7]\\d{4}|17\\d{6}|(?:[12][2-68]|3[2358]|4[2-58]|5[2-6]|6[3-58]|7[24-6])\\d{5}",[7,8]],["7[0137]\\d{7}",[9]]]],YT:["262","00","80\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,"269|63",[["269(?:0[0-367]|5[0-3]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:2(?:0330|4302)|52087)0\\d{3}|(?:1[0-8]|2[1-378]|3[1-69]|4\\d|5[1346-8])\\d{7}",[9]],["(?:1(?:3492[0-25]|4495[0235]|549(?:20|5[01]))|4[34]492[01])\\d{3}|8[1-4]\\d{3,7}|(?:2[27]|47|54)4950\\d{3}|(?:1(?:049[2-4]|9[12]\\d\\d)|(?:6\\d|7[0-46-9])\\d{3}|8(?:5\\d{3}|7(?:08[67]|158|28[5-9]|310)))\\d{4}|(?:1[6-8]|28|3[2-69]|4[025689]|5[36-8])4920\\d{3}|(?:12|[2-5]1)492\\d{4}",[5,6,7,8,9]],["80\\d{7}",[9]],["(?:86[2-9]|9[0-2]\\d)\\d{6}",[9]],0,0,["861\\d{6,7}",[9,10]],0,["87(?:08[0-589]|15[0-79]|28[0-4]|31[1-9])\\d{4}|87(?:[02][0-79]|1[0-46-9]|3[02-9]|[4-9]\\d)\\d{5}",[9]],["860\\d{6}",[9]]]],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0",0,0,0,0,0,[["21[1-8]\\d{6}"],["(?:7[679]|9[5-8])\\d{7}"],["800\\d{6}"],0,0,0,0,0,["63\\d{7}"]]],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:(?:3\\d|9)\\d|[4-8])|2(?:(?:(?:0(?:2[014]|5)|(?:2[0157]|31|84|9)\\d\\d|[56](?:[14]\\d\\d|20)|7(?:[089]|2[03]|[35]\\d\\d))\\d|4(?:2\\d\\d|8))\\d|1(?:2|[39]\\d{4}))|3(?:(?:123|(?:29\\d|92)\\d)\\d\\d|7(?:[19]|[56]\\d))|5(?:0|1[2-478]|26|[37]2|4(?:2\\d{3}|83)|5(?:25\\d\\d|[78])|[689]\\d)|6(?:(?:[16-8]21|28|52[013])\\d\\d|[39])|8(?:[1349]28|523)\\d\\d)\\d{3}|(?:4\\d\\d|9[2-9])\\d{4,5}|(?:(?:2(?:(?:(?:0|8[146])\\d|7[1-7])\\d|2(?:[278]\\d|92)|58(?:2\\d|3))|3(?:[26]|9\\d{3})|5(?:4\\d|5)\\d\\d)\\d|6(?:(?:(?:[0-246]|[78]\\d)\\d|37)\\d|5[2-8]))\\d\\d|(?:2(?:[569]\\d|8[2-57-9])|3(?:[013-59]\\d|8[37])|6[89]8)\\d{3}"],["7(?:[178]\\d|3[1-9])\\d{6}",[9]],["80(?:[01]\\d|20|8[0-8])\\d{3}",[7]],0,0,0,0,0,["86(?:1[12]|22|30|44|55|77|8[368])\\d{6}",[10]]]]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|285\\d{9}|(?:[19]\\d|49)\\d{6}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["4"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[19]"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["34[57]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-3]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|3(?:2|47|7\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:(?:285\\d\\d|3(?:45|[69]\\d{3}))\\d|9[89])\\d{6}"]]],883:["883",0,"(?:210|370\\d\\d)\\d{7}|51\\d{7}(?:\\d{3})?",[9,10,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["2"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[35]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:210|(?:370[1-9]|51[013]0)\\d)\\d{7}|5100\\d{5}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function i(e,i){var a=Array.prototype.slice.call(i);return a.push(t),e.apply(this,a)}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function r(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e){var t="function"==typeof Map?new Map:void 0;return n=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,a)}function a(){return s(e,arguments,c(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),d(a,e)},n(e)}function s(e,t,i){return s=l()?Reflect.construct:function(e,t,i){var a=[null];a.push.apply(a,t);var r=new(Function.bind.apply(e,a));return i&&d(r,i.prototype),r},s.apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}var u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(s,e);var t,i,a,n=(t=s,i=l(),function(){var e,a=c(t);if(i){var o=c(this).constructor;e=Reflect.construct(a,arguments,o)}else e=a.apply(this,arguments);return r(this,e)});function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=n.call(this,e),Object.setPrototypeOf(o(t),s.prototype),t.name=t.constructor.name,t}return a=s,Object.defineProperty(a,"prototype",{writable:!1}),a}(n(Error)),p="".concat("-‐-―−ー－").concat("／/").concat("．.").concat("  ­​⁠　").concat("()（）［］\\[\\]").concat("~⁓∼～");function h(e,t){e=e.split("-"),t=t.split("-");for(var i=e[0].split("."),a=t[0].split("."),r=0;r<3;r++){var o=Number(i[r]),n=Number(a[r]);if(o>n)return 1;if(n>o)return-1;if(!isNaN(o)&&isNaN(n))return 1;if(isNaN(o)&&!isNaN(n))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function v(e,t,i){return t&&g(e.prototype,t),i&&g(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}var A=" ext. ",C=/^\d+$/,y=function(){function e(t){f(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!I(e)||!I(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(I(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+w(e)+": "+e,"."))}(t),this.metadata=t,x.call(this,t)}return v(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(e){return"001"!==e})}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&C.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new b(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new b(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var i=this.nonGeographic()[e];if(i)return i}else{var a=this.countryCallingCodes()[e];if(a&&1===a.length&&"001"===a[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),b=function(){function e(t,i){f(this,e),this.globalMetadataObject=i,this.metadata=t,x.call(this,i.metadata)}return v(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this;return(this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[]).map(function(t){return new S(t,e)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return!(this.types()&&0===this.types().length||!this.types())}},{key:"type",value:function(e){if(this.hasTypes()&&_(this.types(),e))return new D(_(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?A:this.metadata[13]||A}}]),e}(),S=function(){function e(t,i){f(this,e),this._format=t,this.metadata=i}return v(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||k.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),k=/^\(?\$1\)?$/,D=function(){function e(t,i){f(this,e),this.type=t,this.metadata=i}return v(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function _(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var I=function(e){return"object"===m(e)},w=function(e){return m(e)};function P(e,t){return(t=new y(t)).hasCountry(e)?t.country(e).ext():A}function T(e,t){if((t=new y(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function B(e,t){return void 0!==t.countries[e]}function x(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===h(t,"1.2.0")?this.v2=!0:-1===h(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var F=function(e){return"([".concat("0-9０-９٠-٩۰-۹","]{1,").concat(e,"})")};function O(e){var t="#?";return";ext="+F("20")+"|[  \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|ｅ?ｘｔｎ?|доб|anexo)[:\\.．]?[  \\t,-]*"+F("20")+"#?|[  \\t,]*(?:[xｘ#＃~～]|int|ｉｎｔ)[:\\.．]?[  \\t,-]*"+F("9")+"#?|[- ]+"+F("6")+"#|[  \\t]*(?:,{2}|;)[:\\.．]?[  \\t,-]*"+F("15")+"#?|[  \\t]*(?:,)+[:\\.．]?[  \\t,-]*"+F("9")+t}var M="[+＋]{0,1}(?:["+p+"]*[0-9０-９٠-٩۰-۹]){3,}["+p+"0-9０-９٠-٩۰-۹]*",E=new RegExp("^[+＋]{0,1}(?:["+p+"]*[0-9０-９٠-٩۰-۹]){1,2}$","i"),$=M+"(?:"+O()+")?",N=new RegExp("^[0-9０-９٠-٩۰-۹]{2}$|^"+$+"$","i");function L(e){return e.length>=2&&N.test(e)}var U=new RegExp("(?:"+O()+")$","i");function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}var G={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","０":"0","１":"1","２":"2","３":"3","４":"4","５":"5","６":"6","７":"7","８":"8","９":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function W(e){return G[e]}function V(e){for(var t,i="",a=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return R(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?R(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=a()).done;){var r=W(t.value);r&&(i+=r)}return i}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function H(e){for(var t,i="",a=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return j(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?j(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=a()).done;)i+=Y(t.value,i)||"";return i}function Y(e,t){if("+"===e){if(t)return;return"+"}return W(e)}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function z(e,t){return X(e,void 0,t)}function X(e,t,i){var a=i.type(t),r=a&&a.possibleLengths()||i.possibleLengths();if(!r)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!i.type("FIXED_LINE"))return X(e,"MOBILE",i);var o=i.type("MOBILE");o&&(r=function(e,t){for(var i,a=e.slice(),r=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return Z(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Z(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(i=r()).done;){var o=i.value;e.indexOf(o)<0&&a.push(o)}return a.sort(function(e,t){return e-t})}(r,o.possibleLengths()))}else if(t&&!a)return"INVALID_LENGTH";var n=e.length,s=r[0];return s===n?"IS_POSSIBLE":s>n?"TOO_SHORT":r[r.length-1]<n?"TOO_LONG":r.indexOf(n,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function q(e,t){return"IS_POSSIBLE"===z(e,t)}function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a,r,o=[],n=!0,s=!1;try{for(i=i.call(e);!(n=(a=i.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){s=!0,r=e}finally{try{n||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||Q(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(e,t){if(e){if("string"==typeof e)return K(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?K(e,t):void 0}}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function ee(e){for(var t,i,a,r=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=Q(e))){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}((e=e.replace(/^tel:/,"tel=")).split(";"));!(a=r()).done;){var o=J(a.value.split("="),2),n=o[0],s=o[1];switch(n){case"tel":t=s;break;case"ext":i=s;break;case"phone-context":"+"===s[0]&&(t=s+t)}}if(!L(t))return{};var l={number:t};return i&&(l.ext=i),l}function te(e){var t=e.number,i=e.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(i?";ext="+i:"")}function ie(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}var re=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function oe(e,t,i){if(t=t||{},e.country){(i=new y(i)).selectNumberingPlan(e.country,e.countryCallingCode);var a=t.v2?e.nationalNumber:e.phone;if(ie(a,i.nationalNumberPattern())){if(ne(a,"FIXED_LINE",i))return i.type("MOBILE")&&""===i.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":i.type("MOBILE")?ne(a,"MOBILE",i)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return ae(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ae(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(re);!(r=o()).done;){var n=r.value;if(ne(a,n,i))return n}}}}function ne(e,t,i){return!(!(t=i.type(t))||!t.pattern())&&!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&ie(e,t.pattern())}function se(e,t,i){return t=t||{},i=new y(i),!!e.country&&(i.selectNumberingPlan(e.country,e.countryCallingCode),i.hasTypes()?void 0!==oe(e,t,i.metadata):ie(t.v2?e.nationalNumber:e.phone,i.nationalNumberPattern()))}function le(e){return e.replace(new RegExp("[".concat(p,"]+"),"g")," ").trim()}var de=/(\$\d)/;function ce(e,t,i){var a=i.useInternationalFormat,r=i.withNationalPrefix;i.carrierCode,i.metadata;var o=e.replace(new RegExp(t.pattern()),a?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(de,t.nationalPrefixFormattingRule()):t.format());return a?le(o):o}var ue=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function he(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function me(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?he(Object(i),!0).forEach(function(t){fe(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):he(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function fe(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var ge={formatExtension:function(e,t,i){return"".concat(e).concat(i.ext()).concat(t)}};function ve(e,t,i,a,r){var o=function(e,t){for(var i,a=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return pe(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?pe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(i=a()).done;){var r=i.value;if(r.leadingDigitsPatterns().length>0){var o=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(ie(t,r.pattern()))return r}}(a.formats(),e);return o?ce(e,o,{useInternationalFormat:"INTERNATIONAL"===i,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:a}):e}function Ae(e,t,i,a){return t?a(e,t,i):e}function Ce(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function ye(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(i),!0).forEach(function(t){be(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ce(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function be(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Se(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var ke=function(){function e(t,i,a){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!i)throw new TypeError("`nationalNumber` not passed");if(!a)throw new TypeError("`metadata` not passed");var r=new y(a);De(t)&&(this.country=t,r.country(t),t=r.countryCallingCode()),this.countryCallingCode=t,this.nationalNumber=i,this.number="+"+this.countryCallingCode+this.nationalNumber,this.metadata=a}var t,i;return t=e,i=[{key:"setExt",value:function(e){this.ext=e}},{key:"isPossible",value:function(){return function(e,t,i){if(void 0===t&&(t={}),i=new y(i),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");i.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!i.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));i.country(e.country)}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");i.selectNumberingPlan(e.countryCallingCode)}}if(i.possibleLengths())return q(e.phone||e.nationalNumber,i);if(e.countryCallingCode&&i.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.metadata)}},{key:"isValid",value:function(){return se(this,{v2:!0},this.metadata)}},{key:"isNonGeographic",value:function(){return new y(this.metadata).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return oe(this,{v2:!0},this.metadata)}},{key:"format",value:function(e,t){return function(e,t,i,a){if(i=i?me(me({},ge),i):ge,a=new y(a),e.country&&"001"!==e.country){if(!a.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));a.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";a.selectNumberingPlan(e.countryCallingCode)}var r,o=a.countryCallingCode(),n=i.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return n?Ae(r=ve(n,e.carrierCode,"NATIONAL",a,i),e.ext,a,i.formatExtension):"";case"INTERNATIONAL":return n?(r=ve(n,null,"INTERNATIONAL",a,i),Ae(r="+".concat(o," ").concat(r),e.ext,a,i.formatExtension)):"+".concat(o);case"E.164":return"+".concat(o).concat(n);case"RFC3966":return te({number:"+".concat(o).concat(n),ext:e.ext});case"IDD":if(!i.fromCountry)return;var s=function(e,t,i,a,r){if(T(a,r.metadata)===i){var o=ve(e,t,"NATIONAL",r);return"1"===i?i+" "+o:o}var n=function(e,t,i){var a=new y(i);return a.selectNumberingPlan(e,void 0),a.defaultIDDPrefix()?a.defaultIDDPrefix():ue.test(a.IDDPrefix())?a.IDDPrefix():void 0}(a,0,r.metadata);if(n)return"".concat(n," ").concat(i," ").concat(ve(e,null,"INTERNATIONAL",r))}(n,e.carrierCode,o,i.fromCountry,a);return Ae(s,e.ext,a,i.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?ye(ye({},t),{},{v2:!0}):{v2:!0},this.metadata)}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],i&&Se(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),De=function(e){return/^[A-Z]{2}$/.test(e)},_e=new RegExp("([0-9０-９٠-٩۰-۹])");function Ie(e,t,i,a){if(t){var r=new y(a);r.selectNumberingPlan(t,i);var o=new RegExp(r.IDDPrefix());if(0===e.search(o)){var n=(e=e.slice(e.match(o)[0].length)).match(_e);if(!(n&&null!=n[1]&&n[1].length>0&&"0"===n[1]))return e}}}function we(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var i=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),a=i.exec(e);if(a){var r,o,n,s=a.length-1,l=s>0&&a[s];if(t.nationalPrefixTransformRule()&&l)r=e.replace(i,t.nationalPrefixTransformRule()),s>1&&(o=a[1]);else{var d=a[0];r=e.slice(d.length),l&&(o=a[1])}if(l){var c=e.indexOf(a[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(n=t.numberingPlan.nationalPrefix())}else n=a[0];return{nationalNumber:r,nationalPrefix:n,carrierCode:o}}}return{nationalNumber:e}}function Pe(e,t){var i=we(e,t),a=i.carrierCode,r=i.nationalNumber;if(r!==e){if(!function(e,t,i){return!(ie(e,i.nationalNumberPattern())&&!ie(t,i.nationalNumberPattern()))}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(z(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:a}}function Te(e,t,i,a){var r=t?T(t,a):i;if(0===e.indexOf(r)){(a=new y(a)).selectNumberingPlan(t,i);var o=e.slice(r.length),n=Pe(o,a).nationalNumber,s=Pe(e,a).nationalNumber;if(!ie(s,a.nationalNumberPattern())&&ie(n,a.nationalNumberPattern())||"TOO_LONG"===z(s,a))return{countryCallingCode:r,number:o}}return{number:e}}function Be(e,t,i,a){if(!e)return{};if("+"!==e[0]){var r=Ie(e,t,i,a);if(!r||r===e){if(t||i){var o=Te(e,t,i,a),n=o.countryCallingCode,s=o.number;if(n)return{countryCallingCode:n,number:s}}return{number:e}}e="+"+r}if("0"===e[1])return{};a=new y(a);for(var l=2;l-1<=3&&l<=e.length;){var d=e.slice(1,l);if(a.hasCallingCode(d))return a.selectNumberingPlan(d),{countryCallingCode:d,number:e.slice(l)};l++}return{}}function xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function Fe(e,t,i){var a=i.getCountryCodesForCallingCode(e);if(a)return 1===a.length?a[0]:function(e,t,i){i=new y(i);for(var a,r=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return xe(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?xe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(a=r()).done;){var o=a.value;if(i.country(o),i.leadingDigits()){if(t&&0===t.search(i.leadingDigits()))return o}else if(oe({phone:t,country:o},void 0,i.metadata))return o}}(a,t,i.metadata)}var Oe=new RegExp("[+＋0-9０-９٠-٩۰-۹]"),Me=new RegExp("[^0-9０-９٠-٩۰-۹#]+$");function Ee(e,t,i){if(t=t||{},i=new y(i),t.defaultCountry&&!i.hasCountry(t.defaultCountry)){if(t.v2)throw new u("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var a=function(e,t,i){if(e&&0===e.indexOf("tel:"))return ee(e);var a=function(e,t,i){if(e)if(e.length>250){if(i)throw new u("TOO_LONG")}else{if(!1===t)return e;var a=e.search(Oe);if(!(a<0))return e.slice(a).replace(Me,"")}}(e,i,t);if(!a)return{};if(!L(a))return function(e){return E.test(e)}(a)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(U);if(t<0)return{};for(var i=e.slice(0,t),a=e.match(U),r=1;r<a.length;){if(a[r])return{number:i,ext:a[r]};r++}}(a);return r.ext?r:{number:a}}(e,t.v2,t.extract),r=a.number,o=a.ext,n=a.error;if(!r){if(t.v2){if("TOO_SHORT"===n)throw new u("TOO_SHORT");throw new u("NOT_A_NUMBER")}return{}}var s=function(e,t,i,a){var r,o=Be(H(e),t,i,a.metadata),n=o.countryCallingCode,s=o.number;if(n)a.selectNumberingPlan(n);else{if(!s||!t&&!i)return{};a.selectNumberingPlan(t,i),t&&(r=t),n=i||T(t,a.metadata)}if(!s)return{countryCallingCode:n};var l=Pe(H(s),a),d=l.nationalNumber,c=l.carrierCode,u=Fe(n,d,a);return u&&(r=u,"001"===u||a.country(r)),{country:r,countryCallingCode:n,nationalNumber:d,carrierCode:c}}(r,t.defaultCountry,t.defaultCallingCode,i),l=s.country,d=s.nationalNumber,c=s.countryCallingCode,p=s.carrierCode;if(!i.hasSelectedNumberingPlan()){if(t.v2)throw new u("INVALID_COUNTRY");return{}}if(!d||d.length<2){if(t.v2)throw new u("TOO_SHORT");return{}}if(d.length>17){if(t.v2)throw new u("TOO_LONG");return{}}if(t.v2){var h=new ke(c,d,i.metadata);return l&&(h.country=l),p&&(h.carrierCode=p),o&&(h.ext=o),h}var m=!!(t.extended?i.hasSelectedNumberingPlan():l)&&ie(d,i.nationalNumberPattern());return t.extended?{country:l,countryCallingCode:c,carrierCode:p,valid:m,possible:!!m||!(!0!==t.extended||!i.possibleLengths()||!q(d,i)),phone:d,ext:o}:m?function(e,t,i){var a={country:e,phone:t};return i&&(a.ext=i),a}(l,d,o):{}}function $e(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function Ne(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(i),!0).forEach(function(t){Le(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):$e(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function Le(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ue(e,t,i){return Ee(e,Ne(Ne({},t),{},{v2:!0}),i)}function Re(e){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Re(e)}function Ge(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function We(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function je(){var e=He(arguments);return Ue(e.text,e.options,e.metadata)}function He(e){var t,i,a,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a,r,o=[],n=!0,s=!1;try{for(i=i.call(e);!(n=(a=i.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){s=!0,r=e}finally{try{n||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ve(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ve(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array.prototype.slice.call(e),4),o=r[0],n=r[1],s=r[2],l=r[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,n&&"string"!=typeof n){if(!Ye(n))throw new Error("Invalid second argument: ".concat(n));s?(i=n,a=s):a=n}else l?(i=s,a=l):(i=void 0,a=s),n&&(i=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(i),!0).forEach(function(t){We(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ge(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({defaultCountry:n},i));return{text:t,options:i,metadata:a}}var Ye=function(e){return"object"===Re(e)};function Ze(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function ze(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(i),!0).forEach(function(t){Xe(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ze(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function Xe(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function qe(e,t,i){t&&t.defaultCountry&&!B(t.defaultCountry,i)&&(t=ze(ze({},t),{},{defaultCountry:void 0}));try{return Ue(e,t,i)}catch(e){if(!(e instanceof u))throw e}}function Je(){var e=He(arguments);return qe(e.text,e.options,e.metadata)}function Qe(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function Ke(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(i),!0).forEach(function(t){et(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Qe(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function et(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function tt(){var e=He(arguments),t=e.text,i=e.options,a=e.metadata,r=qe(t,i=Ke(Ke({},i),{},{extract:!1}),a);return r&&r.isValid()||!1}function it(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function at(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?it(Object(i),!0).forEach(function(t){rt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):it(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function rt(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ot(){var e=He(arguments),t=e.text,i=e.options,a=e.metadata,r=qe(t,i=at(at({},i),{},{extract:!1}),a);return r&&r.isPossible()||!1}function nt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function st(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?nt(Object(i),!0).forEach(function(t){lt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):nt(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function lt(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function dt(){var e=He(arguments),t=e.text,i=e.options,a=e.metadata;i=st(st({},i),{},{extract:!1});try{var r=Ue(t,i,a);(a=new y(a)).selectNumberingPlan(r.countryCallingCode);var o=z(r.nationalNumber,a);if("IS_POSSIBLE"!==o)return o}catch(e){if(e instanceof u)return e.message;throw e}}function ct(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function ut(e,t,i){return t&&ct(e.prototype,t),i&&ct(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ht=ut(function e(t,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;pt(this,e),this.key=t,this.value=i,this.next=a,this.prev=r}),mt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;pt(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return ut(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var i=new ht(e,t,this.head);this.head.prev=i,this.head=i}else this.head=this.tail=new ht(e,t);this.cache[e]=this.head,this.size++}},{key:"get",value:function(e){if(this.cache[e]){var t=this.cache[e].value;return this.remove(e),this.put(e,t),t}console.log("Item not available in cache for key ".concat(e))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(e){var t=this.cache[e];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[e],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),e}();function ft(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var gt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new mt(t)}var t,i;return t=e,(i=[{key:"getPatternForRegExp",value:function(e){var t=this.cache.get(e);return t||(t=new RegExp("^"+e),this.cache.put(e,t)),t}}])&&ft(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function vt(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function At(e,t){var i=t.search(e);return i>=0?t.slice(0,i):t}var Ct="   ᠎ - \u2028\u2029  　",yt="[".concat(Ct,"]"),bt="[^".concat(Ct,"]"),St="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹０-９","]"),kt="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ﬀ-ﬆﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼＡ-Ｚａ-ｚｦ-ﾾￂ-ￇￊ-ￏￒ-ￗￚ-ￜ",Dt="[".concat(kt,"]"),_t=new RegExp(Dt),It="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩＄￠￡￥￦","]"),wt=new RegExp(It),Pt="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),Tt=new RegExp(Pt),Bt=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function xt(e){return!(!_t.test(e)&&!Tt.test(e))&&Bt.test(e)}function Ft(e){return"%"===e||wt.test(e)}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}var Mt={POSSIBLE:function(e,t,i){return!0},VALID:function(e,t,i){return!(!se(e,void 0,i)||!Et(e,t.toString()))},STRICT_GROUPING:function(e,t,i,a){var r=t.toString();return!(!se(e,void 0,i)||!Et(e,r)||Nt(e,r)||!$t(e))&&Lt(e,t,i,Gt,a)},EXACT_GROUPING:function(e,t,i,a){var r=t.toString();return!(!se(e,void 0,i)||!Et(e,r)||Nt(e,r)||!$t(e))&&Lt(e,t,i,Rt,a)}};function Et(e,t,i){for(var a=0;a<t.length-1;a++){var r=t.charAt(a);if("x"===r||"X"===r){var o=t.charAt(a+1);if("x"===o||"X"===o){if(a++,util.isNumberMatch(e,t.substring(a))!=MatchType.NSN_MATCH)return!1}else if(V(t.substring(a))!==e.ext)return!1}}return!0}function $t(e,t){if("FROM_DEFAULT_COUNTRY"!=e.getCountryCodeSource())return!0;var i=util.getRegionCodeForCountryCode(e.getCountryCode()),a=util.getMetadataForRegion(i);if(null==a)return!0;var r=util.getNationalSignificantNumber(e),o=util.chooseFormattingPatternForNumber(a.numberFormats(),r);if(o&&o.getNationalPrefixFormattingRule().length>0){if(o.getNationalPrefixOptionalWhenFormatting())return!0;if(PhoneNumberUtil.formattingRuleHasFirstGroupOnly(o.getNationalPrefixFormattingRule()))return!0;var n=PhoneNumberUtil.normalizeDigitsOnly(e.getRawInput());return util.maybeStripNationalPrefixAndCarrierCode(n,a,null)}return!0}function Nt(e,t){var i=t.indexOf("/");if(i<0)return!1;var a=t.indexOf("/",i+1);return!(a<0)&&(!(e.getCountryCodeSource()===CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN||e.getCountryCodeSource()===CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN)||PhoneNumberUtil.normalizeDigitsOnly(t.substring(0,i))!==String(e.getCountryCode())||t.slice(a+1).indexOf("/")>=0)}function Lt(e,t,i,a,r){var o=normalizeDigits(t,!0),n=Ut(i,e,null);if(a(i,e,o,n))return!0;var s=MetadataManager.getAlternateFormatsForCountry(e.getCountryCode()),l=util.getNationalSignificantNumber(e);if(s)for(var d,c=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return Ot(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ot(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(s.numberFormats());!(d=c()).done;){var u=d.value;if((!(u.leadingDigitsPatterns().length>0)||r.getPatternForRegExp("^"+u.leadingDigitsPatterns()[0]).test(l))&&a(i,e,o,n=Ut(i,e,u)))return!0}return!1}function Ut(e,t,i){if(i){var a=util.getNationalSignificantNumber(t);return util.formatNsnUsingPattern(a,i,"RFC3966",e).split("-")}var r=formatNumber(t,"RFC3966",e),o=r.indexOf(";");o<0&&(o=r.length);var n=r.indexOf("-")+1;return r.slice(n,o).split("-")}function Rt(e,t,i,a){var r=i.split(NON_DIGITS_PATTERN),o=t.hasExtension()?r.length-2:r.length-1;if(1==r.length||r[o].contains(util.getNationalSignificantNumber(t)))return!0;for(var n,s,l=a.length-1;l>0&&o>=0;){if(r[o]!==a[l])return!1;l--,o--}return o>=0&&(n=r[o],s=a[0],n.indexOf(s,n.length-s.length)===n.length-s.length)}function Gt(e,t,i,a){var r,o=0;if(t.getCountryCodeSource()!==CountryCodeSource.FROM_DEFAULT_COUNTRY){var n=String(t.getCountryCode());o=i.indexOf(n)+n.length()}for(var s=0;s<a.length;s++){if((o=i.indexOf(a[s],o))<0)return!1;if(o+=a[s].length(),0==s&&o<i.length()){var l=util.getRegionCodeForCountryCode(t.getCountryCode());if(null!=util.getNddPrefixForRegion(l,!0)&&Character.isDigit(i.charAt(o)))return r=util.getNationalSignificantNumber(t),0===i.slice(o-a[s].length).indexOf(r)}}return i.slice(o).contains(t.getExtension())}var Wt=/[\\/] *x/;function Vt(e){return At(Wt,e)}var jt=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,Ht=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Yt=/^:[0-5]\d/;function Zt(e,t,i){if(jt.test(e))return!1;if(Ht.test(e)){var a=i.slice(t+e.length);if(Yt.test(a))return!1}return!0}var zt="(\\[（［",Xt="[^".concat(zt).concat(")\\]）］","]"),qt="[".concat(zt).concat("+＋","]"),Jt=new RegExp("^"+qt),Qt=vt(0,3),Kt=new RegExp("^(?:[(\\[（［])?(?:"+Xt+"+[)\\]）］])?"+Xt+"+(?:[(\\[（［]"+Xt+"+[)\\]）］])"+Qt+Xt+"*$"),ei=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function ii(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function ai(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ii(Object(i),!0).forEach(function(t){ri(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ii(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function ri(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function oi(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var ni=O(),si=["\\/+(.*)/","(\\([^(]*)","(?:".concat(yt,"-|-").concat(yt,")").concat(yt,"*(.+)"),"[‒-―－]".concat(yt,"*(.+)"),"\\.+".concat(yt,"*([^.]+)"),"".concat(yt,"+(").concat(bt,"+)")],li=vt(0,2),di=vt(0,4),ci=vt(0,20),ui="[".concat(p,"]")+di,pi=St+vt(1,20),hi="(?:"+qt+ui+")"+li+pi+"(?:"+ui+pi+")"+ci+"(?:"+ni+")?",mi=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹０-９").concat(kt,"#]+$")),fi=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,gi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(i=ai(ai({},i),{},{defaultCallingCode:i.defaultCallingCode,defaultCountry:i.defaultCountry&&B(i.defaultCountry,a)?i.defaultCountry:void 0,leniency:i.leniency||i.extended?"POSSIBLE":"VALID",maxTries:i.maxTries||fi})).leniency)throw new TypeError("`Leniency` not supplied");if(i.maxTries<0)throw new TypeError("`maxTries` not supplied");if(this.text=t,this.options=i,this.metadata=a,this.leniency=Mt[i.leniency],!this.leniency)throw new TypeError("Unknown leniency: ".concat(i.leniency,"."));this.maxTries=i.maxTries,this.PATTERN=new RegExp(hi,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new gt(32)}var t,i;return t=e,i=[{key:"find",value:function(){for(var e;this.maxTries>0&&null!==(e=this.PATTERN.exec(this.text));){var t=e[0],i=e.index;if(Zt(t=Vt(t),i,this.text)){var a=this.parseAndVerify(t,i,this.text)||this.extractInnerMatch(t,i,this.text);if(a){if(this.options.v2){var r=new ke(a.country||a.countryCallingCode,a.phone,this.metadata);return a.ext&&(r.ext=a.ext),{startsAt:a.startsAt,endsAt:a.endsAt,number:r}}return a}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,i){for(var a,r=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return ti(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ti(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(si);!(a=r()).done;)for(var o=a.value,n=!0,s=void 0,l=new RegExp(o,"g");this.maxTries>0&&null!==(s=l.exec(e));){if(n){var d=At(mi,e.slice(0,s.index)),c=this.parseAndVerify(d,t,i);if(c)return c;this.maxTries--,n=!1}var u=At(mi,s[1]),p=e.indexOf(u,s.index),h=this.parseAndVerify(u,t+p,i);if(h)return h;this.maxTries--}}},{key:"parseAndVerify",value:function(e,t,i){if(function(e,t,i,a){if(Kt.test(e)&&!ei.test(e)){if("POSSIBLE"!==a){if(t>0&&!Jt.test(e)){var r=i[t-1];if(Ft(r)||xt(r))return!1}var o=t+e.length;if(o<i.length){var n=i[o];if(Ft(n)||xt(n))return!1}}return!0}}(e,t,i,this.options.leniency)){var a=Ee(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(a.possible&&this.leniency(a,e,this.metadata,this.regExpCache)){var r={startsAt:t,endsAt:t+e.length,phone:a.phone};return a.country&&"001"!==a.country?r.country=a.country:r.countryCallingCode=a.countryCallingCode,a.ext&&(r.ext=a.ext),r}}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var e=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",e}}],i&&oi(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function vi(){var e=He(arguments);return function(e,t,i){for(var a=new gi(e,t,i),r=[];a.hasNext();)r.push(a.next());return r}(e.text,e.options,e.metadata)}function Ai(){var e=He(arguments),t=e.text,i=e.options,a=e.metadata,r=new gi(t,i,a);return function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}({},Symbol.iterator,function(){return{next:function(){return r.hasNext()?{done:!1,value:r.next()}:{done:!0}}}})}function Ci(e){return Ci="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ci(e)}function yi(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function bi(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(i),!0).forEach(function(t){Si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):yi(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function Si(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ki(e,t,i,a){var r=Di(t,i,a);return vi(e,r.options,r.metadata)}function Di(e,t,i){return i?e&&(t=bi(bi({},t),{},{defaultCountry:e})):t?(i=t,t=e?_i(e)?e:{defaultCountry:e}:void 0):(i=e,t=void 0),{options:bi(bi({},t),{},{v2:!0}),metadata:i}}var _i=function(e){return"object"===Ci(e)};function Ii(e,t,i,a){var r=Di(t,i,a);return Ai(e,r.options,r.metadata)}function wi(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var Pi=function(){function e(t){var i=t.onCountryChange,a=t.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.onCountryChange=i,this.onCallingCodeChange=a}var t,i;return t=e,(i=[{key:"reset",value:function(e,t){this.international=!1,this.IDDPrefix=void 0,this.missingPlus=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(e,t)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,i=Object.keys(e);t<i.length;t++){var a=i[t];this[a]=e[a]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}])&&wi(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}var Bi="x",xi=new RegExp(Bi);function Fi(e,t){if(t<1)return"";for(var i="";t>1;)1&t&&(i+=e),t>>=1,e+=e;return i+e}function Oi(e,t){return")"===e[t]&&t++,function(e){for(var t=[],i=0;i<e.length;)"("===e[i]?t.push(i):")"===e[i]&&t.pop(),i++;var a=0,r="";t.push(e.length);for(var o=0,n=t;o<n.length;o++){var s=n[o];r+=e.slice(a,s),a=s+1}return r}(e.slice(0,t))}function Mi(e,t,i){var a=i.metadata,r=i.shouldTryNationalPrefixFormattingRule,o=i.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,i){var a=i.metadata,r=i.shouldTryNationalPrefixFormattingRule,o=i.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,r(t)){var n=Ei(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:a});if(n)return n}return Ei(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:a})}(e,t,{metadata:a,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function Ei(e,t,i){var a=i.metadata,r=i.useNationalPrefixFormattingRule,o=i.getSeparatorAfterNationalPrefix,n=ce(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:r,metadata:a});if(r||(e.nationalPrefix?n=e.nationalPrefix+o(t)+n:e.complexPrefixBeforeNationalSignificantNumber&&(n=e.complexPrefixBeforeNationalSignificantNumber+" "+n)),function(e,t){return V(e)===t.getNationalDigits()}(n,e))return n}function $i(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var Ni=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,i;return t=e,(i=[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],i=t.branches,a=t.instructions;if(i)return{op:"|",args:i.concat([Gi(a)])};if(0===a.length)throw new Error("Pattern is required");return 1===a.length?a[0]:a}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw new Error("Pattern is required");var t=e.match(Ri);if(t){var i=t[1],a=e.slice(0,t.index),r=e.slice(t.index+i.length);switch(i){case"(?:":a&&this.parsePattern(a),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(a&&this.parsePattern(a),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(Gi(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:o});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(a&&this.parsePattern(a),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(Gi(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":a&&this.parsePattern(a),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:Li(a)});break;default:throw new Error("Unknown operator: ".concat(i))}r&&this.parsePattern(r)}else{if(Ui.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}])&&$i(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Li(e){for(var t=[],i=0;i<e.length;){if("-"===e[i]){if(0===i||i===e.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(e));for(var a=e[i-1].charCodeAt(0)+1,r=e[i+1].charCodeAt(0)-1,o=a;o<=r;)t.push(String.fromCharCode(o)),o++}else t.push(e[i]);i++}return t}var Ui=/[\(\)\[\]\?\:\|]/,Ri=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Gi(e){return 1===e.length?e[0]:e}function Wi(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return Vi(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Vi(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Vi(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function ji(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var Hi=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matchTree=(new Ni).parse(t)}var t,i;return t=e,i=[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw new Error("String is required");var i=Yi(e.split(""),this.matchTree,!0);if(i&&i.match&&delete i.matchedChars,!i||!i.overflow||t)return i}}],i&&ji(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Yi(e,t,i){if("string"==typeof t){var a=e.join("");return 0===t.indexOf(a)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===a.indexOf(t)?i&&e.length>t.length?{overflow:!0}:{match:!0,matchedChars:e.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var r=e.slice(),o=0;o<t.length;){var n=Yi(r,t[o],i&&o===t.length-1);if(!n)return;if(n.overflow)return n;if(!n.match){if(n.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(n,null,2)))}if(0===(r=r.slice(n.matchedChars.length)).length)return o===t.length-1?{match:!0,matchedChars:e}:{partialMatch:!0};o++}return i?{overflow:!0}:{match:!0,matchedChars:e.slice(0,e.length-r.length)}}switch(t.op){case"|":for(var s,l,d=Wi(t.args);!(l=d()).done;){var c=Yi(e,l.value,i);if(c){if(c.overflow)return c;if(c.match)return{match:!0,matchedChars:c.matchedChars};if(!c.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)));s=!0}}return s?{partialMatch:!0}:void 0;case"[]":for(var u,p=Wi(t.args);!(u=p()).done;){var h=u.value;if(e[0]===h)return 1===e.length?{match:!0,matchedChars:e}:i?{overflow:!0}:{match:!0,matchedChars:[h]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function Zi(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return zi(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?zi(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function Xi(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var qi=Fi("9",15),Ji=/[- ]/,Qi=new RegExp("["+p+"]*\\$1["+p+"]*(\\$\\d["+p+"]*)*$"),Ki=function(){function e(t){t.state;var i=t.metadata;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=i,this.resetFormat()}var t,i;return t=e,i=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var i=this;if(function(e,t){return"IS_POSSIBLE"===z(e,t)}(t.nationalSignificantNumber,this.metadata))for(var a,r=Zi(this.matchingFormats);!(a=r()).done;){var o=a.value,n=Mi(t,o,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return i.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return i.getSeparatorAfterNationalPrefix(e)}});if(n)return this.resetFormat(),this.chosenFormat=o,this.setNationalNumberTemplate(n.replace(/\d/g,Bi),t),this.populatedNationalNumberTemplate=n,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(Bi),n}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var i=this.chosenFormat,a=this.chooseFormat(t);if(a)return a===i?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,i=e.nationalSignificantNumber,a=e.nationalPrefix,r=e.international,o=i,n=o.length-3;n<0&&(n=0),this.matchingFormats=this.matchingFormats.filter(function(e){return t.formatSuits(e,r,a)&&t.formatMatches(e,o,n)}),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,i){return!(i&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!i&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,i){var a=e.leadingDigitsPatterns().length;if(0===a)return!0;i=Math.min(i,a-1);var r=e.leadingDigitsPatterns()[i];if(t.length<3)try{return void 0!==new Hi(r).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(r,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,i=this,a=function(){var a=t.value;return i.chosenFormat===a?"break":Qi.test(i.getFormatFormat(a,e.international))?i.createTemplateForFormat(a,e)?(i.chosenFormat=a,"break"):(i.matchingFormats=i.matchingFormats.filter(function(e){return e!==a}),"continue"):"continue"},r=Zi(this.matchingFormats.slice());!(t=r()).done;){if("break"===a())break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var i=this.getTemplateForFormat(e,t);return i?(this.setNationalNumberTemplate(i,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&Ji.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var i=e.IDDPrefix,a=e.missingPlus;return i?t&&!1===t.spacing?i:i+" ":a?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,i=0,a=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";i<a.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(Bi,t+1),i++;return Oi(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,Bi)+Fi(Bi,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var i=t.nationalSignificantNumber,a=t.international,r=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,n=e.pattern();n=n.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var s=qi.match(n)[0];if(!(i.length>s.length)){var l=new RegExp("^"+n+"$"),d=i.replace(/\d/g,"9");l.test(d)&&(s=d);var c,u=this.getFormatFormat(e,a);if(this.shouldTryNationalPrefixFormattingRule(e,{international:a,nationalPrefix:r})){var p=u.replace(de,e.nationalPrefixFormattingRule());if(V(e.nationalPrefixFormattingRule())===(r||"")+V("$1")&&(u=p,c=!0,r))for(var h=r.length;h>0;)u=u.replace(/\d/,Bi),h--}var m=s.replace(new RegExp(n),u).replace(new RegExp("9","g"),Bi);return c||(o?m=Fi(Bi,o.length)+" "+m:r&&(m=Fi(Bi,r.length)+this.getSeparatorAfterNationalPrefix(e)+m)),a&&(m=le(m)),m}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,i){for(var a,r=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return Ti(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ti(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(i.split(""));!(a=r()).done;){var o=a.value;if(e.slice(t+1).search(xi)<0)return;t=e.search(xi),e=e.replace(xi,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Oi(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var i=t.international,a=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var r=e.usesNationalPrefix();if(r&&a||!r&&!i)return!0}}}],i&&Xi(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ea(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a,r,o=[],n=!0,s=!1;try{for(i=i.call(e);!(n=(a=i.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){s=!0,r=e}finally{try{n||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ta(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ta(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function ia(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var aa=new RegExp("^["+p+"0-9０-９٠-٩۰-۹]+$","i"),ra="(?:[+＋]["+p+"0-9０-９٠-٩۰-۹]*|["+p+"0-9０-９٠-٩۰-۹]+)",oa=new RegExp("[^"+p+"0-9０-９٠-٩۰-۹]+.*$"),na=/[^\d\[\]]/,sa=function(){function e(t){var i=t.defaultCountry,a=t.defaultCallingCode,r=t.metadata,o=t.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaultCountry=i,this.defaultCallingCode=a,this.metadata=r,this.onNationalSignificantNumberChange=o}var t,i;return t=e,(i=[{key:"input",value:function(e,t){var i,a=function(e){var t=ea(function(e){var t=function(e){var t,i=e.search(ra);if(!(i<0))return"+"===(e=e.slice(i))[0]&&(t=!0,e=e.slice(1)),e=e.replace(oa,""),t&&(e="+"+e),e}(e)||"";return"+"===t[0]?[t.slice(1),!0]:[t]}(e),2),i=t[0],a=t[1];return aa.test(i)||(i=""),[i,a]}(e),r=ea(a,2),o=r[0],n=r[1],s=V(o);return n&&(t.digits||(t.startInternationalNumber(),s||(i=!0))),s&&this.inputDigits(s,t),{digits:s,justLeadingPlus:i}}},{key:"inputDigits",value:function(e,t){var i=t.digits,a=i.length<3&&i.length+e.length>=3;if(t.appendDigits(e),a&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),function(e){return t.update(e)})}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,i=e.callingCode;return t&&!i}},{key:"extractCountryCallingCode",value:function(e){var t=Be("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),i=t.countryCallingCode,a=t.number;if(i)return e.setCallingCode(i),e.update({nationalSignificantNumber:a}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&na.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var i=we(e,this.metadata),a=i.nationalPrefix,r=i.nationalNumber,o=i.carrierCode;if(r!==e)return this.onExtractedNationalNumber(a,o,r,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,i){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,i);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var a=we(e,this.metadata),r=a.nationalPrefix,o=a.nationalNumber,n=a.carrierCode;if(o!==t)return this.onExtractedNationalNumber(r,n,o,e,i),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,i,a,r){var o,n,s=a.lastIndexOf(i);if(s>=0&&s===a.length-i.length){n=!0;var l=a.slice(0,s);l!==e&&(o=l)}r({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:i,nationalSignificantNumberMatchesInput:n,complexPrefixBeforeNationalSignificantNumber:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,function(t){return e.update(t)})||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,i=e.IDDPrefix,a=e.digits;if(e.nationalSignificantNumber,!t&&!i){var r=Ie(a,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==a?(e.update({IDDPrefix:a.slice(0,a.length-r.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=Te(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),i=t.countryCallingCode;if(t.number,i)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:i}),!0}}},{key:"startInternationalNumber",value:function(e,t){var i=t.country,a=t.callingCode;e.startInternationalNumber(i,a),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),function(t){return e.update(t)})}}])&&ia(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function la(e){return la="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},la(e)}function da(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}function ca(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var ua=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new y(i);var a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a,r,o=[],n=!0,s=!1;try{for(i=i.call(e);!(n=(a=i.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){s=!0,r=e}finally{try{n||null==i.return||i.return()}finally{if(s)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return da(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?da(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this.getCountryAndCallingCode(t),2),r=a[0],o=a[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}var t,i;return t=e,(i=[{key:"getCountryAndCallingCode",value:function(e){var t,i;return e&&("object"===la(e)?(t=e.defaultCountry,i=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,i]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),i=t.digits;if(t.justLeadingPlus)this.formattedOutput="+";else if(i){var a;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(a=this.formatter.format(i,this.state)),void 0===a&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(a=this.formatter.format(r,this.state))}this.formattedOutput=a?this.getFullNumber(a):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Pi({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,i){e.metadata.selectNumberingPlan(i,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new Ki({state:this.state,metadata:this.metadata}),this.parser=new sa({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset(this.defaultCountry,this.defaultCallingCode),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var i=this.state.callingCode;return function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e}(i?e?"".concat(i," ").concat(e):i:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,i=e.complexPrefixBeforeNationalSignificantNumber,a=e.nationalPrefix,r=t,o=i||a;return o&&(r=o+r),r}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,Bi)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(Fe(this.isInternational()?this.state.callingCode:this.defaultCallingCode,this.state.nationalSignificantNumber,this.metadata))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,i=e.callingCode,a=e.country,r=e.nationalSignificantNumber;if(t)return this.isInternational()?i?"+"+i+r:"+"+t:a||i?"+"+(a?this.metadata.countryCallingCode():i)+r:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,i=e.carrierCode,a=e.callingCode,r=this._getCountry();if(t&&(r||a)){var o=new ke(r||a,t,this.metadata.metadata);return i&&(o.carrierCode=i),o}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])&&ca(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function pa(e){return new y(e).getCountries()}function ha(e,t,i){if(t[e])return new ke(e,t[e],i)}function ma(e,t,i){return i||(i=t,t=void 0),new ua(t,i).input(e)}function fa(){return i(je,arguments)}function ga(){return i(Je,arguments)}function va(e,i){return gi.call(this,e,i,t)}function Aa(e){return ua.call(this,e,t)}function Ca(){return y.call(this,t)}va.prototype=Object.create(gi.prototype,{}),va.prototype.constructor=va,Aa.prototype=Object.create(ua.prototype,{}),Aa.prototype.constructor=Aa,Ca.prototype=Object.create(y.prototype,{}),Ca.prototype.constructor=Ca,e.AsYouType=Aa,e.DIGIT_PLACEHOLDER=Bi,e.Metadata=Ca,e.ParseError=u,e.PhoneNumberMatcher=va,e.default=ga,e.findNumbers=function(){return i(vi,arguments)},e.findPhoneNumbersInText=function(){return i(ki,arguments)},e.formatIncompletePhoneNumber=function(){return i(ma,arguments)},e.formatRFC3966=te,e.getCountries=function(){return i(pa,arguments)},e.getCountryCallingCode=function(){return i(T,arguments)},e.getExampleNumber=function(){return i(ha,arguments)},e.getExtPrefix=function(){return i(P,arguments)},e.isPossiblePhoneNumber=function(){return i(ot,arguments)},e.isSupportedCountry=function(){return i(B,arguments)},e.isValidPhoneNumber=function(){return i(tt,arguments)},e.parseDigits=V,e.parseIncompletePhoneNumber=H,e.parsePhoneNumber=fa,e.parsePhoneNumberCharacter=Y,e.parsePhoneNumberFromString=ga,e.parsePhoneNumberWithError=fa,e.parseRFC3966=ee,e.searchNumbers=function(){return i(Ai,arguments)},e.searchPhoneNumbersInText=function(){return i(Ii,arguments)},e.validatePhoneNumberLength=function(){return i(dt,arguments)},Object.defineProperty(e,"__esModule",{value:!0})}),function(){var e={618:function(e,t,i){"use strict";var a=i(81),r=i.n(a),o=i(645),n=i.n(o),s=i(667),l=i.n(s),d=new URL(i(818),i.b),c=n()(r()),u=l()(d);c.push([e.id,".tingle-modal * {\n  box-sizing: border-box;\n}\n\n.tingle-modal {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1000;\n  display: flex;\n  visibility: hidden;\n  flex-direction: column;\n  align-items: center;\n  overflow: hidden;\n  -webkit-overflow-scrolling: touch;\n  background: rgba(0, 0, 0, .9);\n  opacity: 0;\n  cursor: url("+u+'), auto;\n}\n\n@supports ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {\n  .tingle-modal {\n    -webkit-backdrop-filter: blur(12px);\n            backdrop-filter: blur(12px);\n  }\n}\n\n/* confirm and alerts\n-------------------------------------------------------------- */\n\n.tingle-modal--confirm .tingle-modal-box {\n  text-align: center;\n}\n\n/* modal\n-------------------------------------------------------------- */\n\n.tingle-modal--noOverlayClose {\n  cursor: default;\n}\n\n.tingle-modal--noClose .tingle-modal__close {\n  display: none;\n}\n\n.tingle-modal__close {\n  position: fixed;\n  top: 2.5rem;\n  right: 2.5rem;\n  z-index: 1000;\n  padding: 0;\n  width: 2rem;\n  height: 2rem;\n  border: none;\n  background-color: transparent;\n  color: #fff;\n  cursor: pointer;\n}\n\n.tingle-modal__close svg * {\n  fill: currentColor;\n}\n\n.tingle-modal__closeLabel {\n  display: none;\n}\n\n.tingle-modal__close:hover {\n  color: #fff;\n}\n\n.tingle-modal-box {\n  position: relative;\n  flex-shrink: 0;\n  margin-top: auto;\n  margin-bottom: auto;\n  width: 60%;\n  border-radius: 4px;\n  background: #fff;\n  opacity: 1;\n  cursor: auto;\n  will-change: transform, opacity;\n}\n\n.tingle-modal-box__content {\n  padding: 3rem 3rem;\n}\n\n.tingle-modal-box__footer {\n  padding: 1.5rem 2rem;\n  width: auto;\n  border-bottom-right-radius: 4px;\n  border-bottom-left-radius: 4px;\n  background-color: #f5f5f5;\n  cursor: auto;\n}\n\n.tingle-modal-box__footer::after {\n  display: table;\n  clear: both;\n  content: "";\n}\n\n.tingle-modal-box__footer--sticky {\n  position: fixed;\n  bottom: -200px; /* TODO : find a better way */\n  z-index: 10001;\n  opacity: 1;\n  transition: bottom .3s ease-in-out .3s;\n}\n\n/* state\n-------------------------------------------------------------- */\n\n.tingle-enabled {\n  position: fixed;\n  right: 0;\n  left: 0;\n  overflow: hidden;\n}\n\n.tingle-modal--visible .tingle-modal-box__footer {\n  bottom: 0;\n}\n\n.tingle-modal--visible {\n  visibility: visible;\n  opacity: 1;\n}\n\n.tingle-modal--visible .tingle-modal-box {\n  animation: scale .2s cubic-bezier(.68, -.55, .265, 1.55) forwards;\n}\n\n.tingle-modal--overflow {\n  overflow-y: scroll;\n  padding-top: 8vh;\n}\n\n/* btn\n-------------------------------------------------------------- */\n\n.tingle-btn {\n  display: inline-block;\n  margin: 0 .5rem;\n  padding: 1rem 2rem;\n  border: none;\n  background-color: grey;\n  box-shadow: none;\n  color: #fff;\n  vertical-align: middle;\n  text-decoration: none;\n  font-size: inherit;\n  font-family: inherit;\n  line-height: normal;\n  cursor: pointer;\n  transition: background-color .4s ease;\n}\n\n.tingle-btn--primary {\n  background-color: #3498db;\n}\n\n.tingle-btn--danger {\n  background-color: #e74c3c;\n}\n\n.tingle-btn--default {\n  background-color: #34495e;\n}\n\n.tingle-btn--pull-left {\n  float: left;\n}\n\n.tingle-btn--pull-right {\n  float: right;\n}\n\n/* responsive\n-------------------------------------------------------------- */\n\n@media (max-width : 540px) {\n  .tingle-modal {\n    top: 0px;\n    display: block;\n    padding-top: 60px;\n    width: 100%;\n  }\n\n  .tingle-modal-box {\n    width: auto;\n    border-radius: 0;\n  }\n\n  .tingle-modal-box__content {\n    overflow-y: scroll;\n  }\n\n  .tingle-modal--noClose {\n    top: 0;\n  }\n\n  .tingle-modal--noOverlayClose {\n    padding-top: 0;\n  }\n\n  .tingle-modal-box__footer .tingle-btn {\n    display: block;\n    float: none;\n    margin-bottom: 1rem;\n    width: 100%;\n  }\n\n  .tingle-modal__close {\n    top: 0;\n    right: 0;\n    left: 0;\n    display: block;\n    width: 100%;\n    height: 60px;\n    border: none;\n    background-color: #2c3e50;\n    box-shadow: none;\n    color: #fff;\n  }\n\n  .tingle-modal__closeLabel {\n    display: inline-block;\n    vertical-align: middle;\n    font-size: 1.6rem;\n    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n  }\n\n  .tingle-modal__closeIcon {\n    display: inline-block;\n    margin-right: .8rem;\n    width: 1.6rem;\n    vertical-align: middle;\n    font-size: 0;\n  }\n}\n\n/* animations\n-------------------------------------------------------------- */\n\n@keyframes scale {\n  0% {\n    opacity: 0;\n    transform: scale(.9);\n  }\n  100% {\n    opacity: 1;\n    transform: scale(1);\n  }\n}\n',""]),t.Z=c},907:function(e,t,i){"use strict";var a=i(81),r=i.n(a),o=i(645),n=i.n(o),s=i(618),l=n()(r());l.i(s.Z),l.push([e.id,".tingle-modal-box {\n    width: auto;\n    border-radius: 0;\n}\n\n.tingle-modal-box__content {\n    padding: 0;\n}\n\n#bankpay-iframe {\n    width: 100%;\n    height: 100vh;\n    border-width: 0;\n    border-style: none;\n    border-color: currentColor;\n    border-color: initial;\n    -o-border-image: none;\n       border-image: none;\n    -o-border-image: initial;\n       border-image: initial;\n}\n\n@media screen and (min-width: 541px) {\n    .tingle-modal-box {\n        width: 600px;\n    }\n\n    #bankpay-iframe {\n        height: 90vh;\n    }\n}\n",""]),t.Z=l},645:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i="",a=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),a&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),a&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i}).join("")},t.i=function(e,i,a,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var n={};if(a)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(n[l]=!0)}for(var d=0;d<e.length;d++){var c=[].concat(e[d]);a&&n[c[0]]||(void 0!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),t.push(c))}},t}},667:function(e){"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},81:function(e){"use strict";e.exports=function(e){return e[1]}},379:function(e){"use strict";var t=[];function i(e){for(var i=-1,a=0;a<t.length;a++)if(t[a].identifier===e){i=a;break}return i}function a(e,a){for(var o={},n=[],s=0;s<e.length;s++){var l=e[s],d=a.base?l[0]+a.base:l[0],c=o[d]||0,u="".concat(d," ").concat(c);o[d]=c+1;var p=i(u),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)t[p].references++,t[p].updater(h);else{var m=r(h,a);a.byIndex=s,t.splice(s,0,{identifier:u,updater:m,references:1})}n.push(u)}return n}function r(e,t){var i=t.domAPI(t);return i.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,r){var o=a(e=e||[],r=r||{});return function(e){e=e||[];for(var n=0;n<o.length;n++){var s=i(o[n]);t[s].references--}for(var l=a(e,r),d=0;d<o.length;d++){var c=i(o[d]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}o=l}}},569:function(e){"use strict";var t={};e.exports=function(e,i){var a=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(i)}},216:function(e){"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:function(e,t,i){"use strict";e.exports=function(e){var t=i.nc;t&&e.setAttribute("nonce",t)}},37:function(e){"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function a(e,t,a,r){var o;if(a)o="";else{o="",r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var n=void 0!==r.layer;n&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,n&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,o);else{var s=document.createTextNode(o),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(s,l[t]):e.appendChild(s)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){var t=r.singletonCounter++,i=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){a(i,t,!1,e)},remove:function(e){a(i,t,!0,e)}}}},584:function(e,t,i){var a,r;a=function(){var e=!1;function t(e){this.opts=function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}({},{onClose:null,onOpen:null,beforeOpen:null,beforeClose:null,stickyFooter:!1,footer:!1,cssClass:[],closeLabel:"Close",closeMethods:["overlay","button","escape"]},e),this.init()}function i(){this.modalBoxFooter&&(this.modalBoxFooter.style.width=this.modalBox.clientWidth+"px",this.modalBoxFooter.style.left=this.modalBox.offsetLeft+"px")}return t.prototype.init=function(){if(!this.modal)return function(){this.modal=document.createElement("div"),this.modal.classList.add("tingle-modal"),0!==this.opts.closeMethods.length&&-1!==this.opts.closeMethods.indexOf("overlay")||this.modal.classList.add("tingle-modal--noOverlayClose"),this.modal.style.display="none",this.opts.cssClass.forEach(function(e){"string"==typeof e&&this.modal.classList.add(e)},this),-1!==this.opts.closeMethods.indexOf("button")&&(this.modalCloseBtn=document.createElement("button"),this.modalCloseBtn.type="button",this.modalCloseBtn.classList.add("tingle-modal__close"),this.modalCloseBtnIcon=document.createElement("span"),this.modalCloseBtnIcon.classList.add("tingle-modal__closeIcon"),this.modalCloseBtnIcon.innerHTML='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.3 9.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3L5 6.4l3.3 3.3c.2.2.5.3.7.3.2 0 .5-.1.7-.3.4-.4.4-1 0-1.4L6.4 5l3.3-3.3c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L5 3.6 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4L3.6 5 .3 8.3c-.4.4-.4 1 0 1.4z" fill="#000" fill-rule="nonzero"/></svg>',this.modalCloseBtnLabel=document.createElement("span"),this.modalCloseBtnLabel.classList.add("tingle-modal__closeLabel"),this.modalCloseBtnLabel.innerHTML=this.opts.closeLabel,this.modalCloseBtn.appendChild(this.modalCloseBtnIcon),this.modalCloseBtn.appendChild(this.modalCloseBtnLabel)),this.modalBox=document.createElement("div"),this.modalBox.classList.add("tingle-modal-box"),this.modalBoxContent=document.createElement("div"),this.modalBoxContent.classList.add("tingle-modal-box__content"),this.modalBox.appendChild(this.modalBoxContent),-1!==this.opts.closeMethods.indexOf("button")&&this.modal.appendChild(this.modalCloseBtn),this.modal.appendChild(this.modalBox)}.call(this),function(){this._events={clickCloseBtn:this.close.bind(this),clickOverlay:function(e){var t=this.modal.offsetWidth-this.modal.clientWidth,i=e.clientX>=this.modal.offsetWidth-15,a=this.modal.scrollHeight!==this.modal.offsetHeight;"MacIntel"===navigator.platform&&0==t&&i&&a||-1!==this.opts.closeMethods.indexOf("overlay")&&!function(e){for(;(e=e.parentElement)&&!e.classList.contains("tingle-modal"););return e}(e.target)&&e.clientX<this.modal.clientWidth&&this.close()}.bind(this),resize:this.checkOverflow.bind(this),keyboardNav:function(e){-1!==this.opts.closeMethods.indexOf("escape")&&27===e.which&&this.isOpen()&&this.close()}.bind(this)},-1!==this.opts.closeMethods.indexOf("button")&&this.modalCloseBtn.addEventListener("click",this._events.clickCloseBtn),this.modal.addEventListener("mousedown",this._events.clickOverlay),window.addEventListener("resize",this._events.resize),document.addEventListener("keydown",this._events.keyboardNav)}.call(this),document.body.appendChild(this.modal,document.body.firstChild),this.opts.footer&&this.addFooter(),this},t.prototype._busy=function(t){e=t},t.prototype._isBusy=function(){return e},t.prototype.destroy=function(){null!==this.modal&&(this.isOpen()&&this.close(!0),function(){-1!==this.opts.closeMethods.indexOf("button")&&this.modalCloseBtn.removeEventListener("click",this._events.clickCloseBtn),this.modal.removeEventListener("mousedown",this._events.clickOverlay),window.removeEventListener("resize",this._events.resize),document.removeEventListener("keydown",this._events.keyboardNav)}.call(this),this.modal.parentNode.removeChild(this.modal),this.modal=null)},t.prototype.isOpen=function(){return!!this.modal.classList.contains("tingle-modal--visible")},t.prototype.open=function(){if(!this._isBusy()){this._busy(!0);var e=this;return"function"==typeof e.opts.beforeOpen&&e.opts.beforeOpen(),this.modal.style.removeProperty?this.modal.style.removeProperty("display"):this.modal.style.removeAttribute("display"),document.getSelection().removeAllRanges(),this._scrollPosition=window.pageYOffset,document.body.classList.add("tingle-enabled"),document.body.style.top=-this._scrollPosition+"px",this.setStickyFooter(this.opts.stickyFooter),this.modal.classList.add("tingle-modal--visible"),"function"==typeof e.opts.onOpen&&e.opts.onOpen.call(e),e._busy(!1),this.checkOverflow(),this}},t.prototype.close=function(e){if(!this._isBusy()){if(this._busy(!0),"function"==typeof this.opts.beforeClose&&!this.opts.beforeClose.call(this))return void this._busy(!1);document.body.classList.remove("tingle-enabled"),document.body.style.top=null,window.scrollTo({top:this._scrollPosition,behavior:"instant"}),this.modal.classList.remove("tingle-modal--visible");var t=this;t.modal.style.display="none","function"==typeof t.opts.onClose&&t.opts.onClose.call(this),t._busy(!1)}},t.prototype.setContent=function(e){return"string"==typeof e?this.modalBoxContent.innerHTML=e:(this.modalBoxContent.innerHTML="",this.modalBoxContent.appendChild(e)),this.isOpen()&&this.checkOverflow(),this},t.prototype.getContent=function(){return this.modalBoxContent},t.prototype.addFooter=function(){return function(){this.modalBoxFooter=document.createElement("div"),this.modalBoxFooter.classList.add("tingle-modal-box__footer"),this.modalBox.appendChild(this.modalBoxFooter)}.call(this),this},t.prototype.setFooterContent=function(e){return this.modalBoxFooter.innerHTML=e,this},t.prototype.getFooterContent=function(){return this.modalBoxFooter},t.prototype.setStickyFooter=function(e){return this.isOverflow()||(e=!1),e?this.modalBox.contains(this.modalBoxFooter)&&(this.modalBox.removeChild(this.modalBoxFooter),this.modal.appendChild(this.modalBoxFooter),this.modalBoxFooter.classList.add("tingle-modal-box__footer--sticky"),i.call(this),this.modalBoxContent.style["padding-bottom"]=this.modalBoxFooter.clientHeight+20+"px"):this.modalBoxFooter&&(this.modalBox.contains(this.modalBoxFooter)||(this.modal.removeChild(this.modalBoxFooter),this.modalBox.appendChild(this.modalBoxFooter),this.modalBoxFooter.style.width="auto",this.modalBoxFooter.style.left="",this.modalBoxContent.style["padding-bottom"]="",this.modalBoxFooter.classList.remove("tingle-modal-box__footer--sticky"))),this},t.prototype.addFooterBtn=function(e,t,i){var a=document.createElement("button");return a.innerHTML=e,a.addEventListener("click",i),"string"==typeof t&&t.length&&t.split(" ").forEach(function(e){a.classList.add(e)}),this.modalBoxFooter.appendChild(a),a},t.prototype.resize=function(){console.warn("Resize is deprecated and will be removed in version 1.0")},t.prototype.isOverflow=function(){return window.innerHeight<=this.modalBox.clientHeight},t.prototype.checkOverflow=function(){this.modal.classList.contains("tingle-modal--visible")&&(this.isOverflow()?this.modal.classList.add("tingle-modal--overflow"):this.modal.classList.remove("tingle-modal--overflow"),!this.isOverflow()&&this.opts.stickyFooter?this.setStickyFooter(!1):this.isOverflow()&&this.opts.stickyFooter&&(i.call(this),this.setStickyFooter(!0)))},{modal:t}},void 0===(r=a.call(t,i,t,e))||(e.exports=r)},818:function(e){"use strict";e.exports="data:image/svg+xml,%3Csvg width=%2719%27 height=%2719%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M15.514.535l-6.42 6.42L2.677.536a1.517 1.517 0 00-2.14 0 1.517 1.517 0 000 2.14l6.42 6.419-6.42 6.419a1.517 1.517 0 000 2.14 1.517 1.517 0 002.14 0l6.419-6.42 6.419 6.42a1.517 1.517 0 002.14 0 1.517 1.517 0 000-2.14l-6.42-6.42 6.42-6.418a1.517 1.517 0 000-2.14 1.516 1.516 0 00-2.14 0z%27 fill=%27%23FFF%27 fill-rule=%27nonzero%27/%3E%3C/svg%3E"}},t={};function i(a){var r=t[a];if(void 0!==r)return r.exports;var o=t[a]={id:a,exports:{}};return e[a].call(o.exports,o,o.exports,i),o.exports}i.m=e,i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.b=document.baseURI||self.location.href;var a={};!function(){"use strict";i.d(a,{default:function(){return K}});var e=i(379),t=i.n(e),r=i(37),o=i.n(r),n=i(569),s=i.n(n),l=i(565),d=i.n(l),c=i(216),u=i.n(c),p=i(907),h={};h.setAttributes=d(),h.insert=s().bind(null,"head"),h.domAPI=o(),h.insertStyleElement=u(),t()(p.Z,h),p.Z&&p.Z.locals&&p.Z.locals;var m,f={cce:{domain:"cce.bankpay.certegy.com",scheme:"https"},production:{domain:"bankpay.certegy.com",scheme:"https"}};!function(e){e.Enrollment="enrollment",e.Transaction="transaction"}(m||(m={}));var g,v=m;!function(e){e.Cancel="cancel",e.Close="close",e.Failure="failure",e.ReadyForAuthorization="readyForAuthorization",e.Success="success"}(g||(g={}));var A=g;function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function y(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function b(e,t,i){return t&&y(e.prototype,t),i&&y(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}function D(e){var t=w();return function(){var i,a=T(e);if(t){var r=T(this).constructor;i=Reflect.construct(a,arguments,r)}else i=a.apply(this,arguments);return function(e,t){if(t&&("object"===C(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,i)}}function _(e){var t="function"==typeof Map?new Map:void 0;return _=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,a)}function a(){return I(e,arguments,T(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),P(a,e)},_(e)}function I(e,t,i){return I=w()?Reflect.construct:function(e,t,i){var a=[null];a.push.apply(a,t);var r=new(Function.bind.apply(e,a));return i&&P(r,i.prototype),r},I.apply(null,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function P(e,t){return P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},P(e,t)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}var B=function(e){k(i,e);var t=D(i);function i(){return S(this,i),t.call(this,A.Cancel)}return b(i)}(_(Event)),x=function(e){k(i,e);var t=D(i);function i(){return S(this,i),t.call(this,A.Close)}return b(i)}(_(Event)),F=function(e){k(i,e);var t=D(i);function i(e){var a;return S(this,i),(a=t.call(this,A.Failure)).data=e,a}return b(i)}(_(Event)),O=function(e){k(i,e);var t=D(i);function i(e){var a;return S(this,i),(a=t.call(this,A.ReadyForAuthorization)).data=e,a}return b(i)}(_(Event)),M=function(e){k(i,e);var t=D(i);function i(e){var a;return S(this,i),(a=t.call(this,A.Success)).data=e,a}return b(i)}(_(Event)),E=function(){function e(){var t,i,a;S(this,e),t=this,i="target",a=new EventTarget,i in t?Object.defineProperty(t,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[i]=a}return b(e,[{key:"addEventListener",value:function(e,t,i){this.target.addEventListener(e,t,i)}},{key:"dispatchEvent",value:function(e){return this.target.dispatchEvent(e)}},{key:"removeEventListener",value:function(e,t,i){this.target.removeEventListener(e,t,i)}}]),e}();function $(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var N=function(){function e(){var t,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i=[],(t="targets")in this?Object.defineProperty(this,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):this[t]=i,this.boundMessageHandler=this.messageHandler.bind(this)}var t,i,a;return t=e,a=[{key:"dispatchMessage",value:function(t,i){var a;if(null!=t&&null!==(a=t.data)&&void 0!==a&&a.type){var r=e.parseMessage(t);r&&i.dispatchEvent(r)}}},{key:"findDataContextLayer",value:function(){if(Object.prototype.hasOwnProperty.call(document,"postMessage"))return document;if(Object.prototype.hasOwnProperty.call(window,"postMessage"))return window;throw new Error("Unable to find suitable postMessage context.")}},{key:"parseMessage",value:function(e){var t;switch(null==e||null===(t=e.data)||void 0===t?void 0:t.type){case A.Cancel:return new B;case A.Close:return new x;case A.Failure:return new F(e.data.data);case A.ReadyForAuthorization:return new O(e.data.data);case A.Success:return new M(e.data.data)}}}],(i=[{key:"addEventTarget",value:function(e){this.targets.push(e)}},{key:"removeEventTarget",value:function(e){this.targets=this.targets.filter(function(t){return t!==e})}},{key:"attach",value:function(){e.findDataContextLayer().addEventListener("message",this.boundMessageHandler)}},{key:"detach",value:function(){e.findDataContextLayer().removeEventListener("message",this.boundMessageHandler)}},{key:"messageHandler",value:function(t){this.targets.forEach(function(i){return e.dispatchMessage(t,i)})}}])&&$(t.prototype,i),a&&$(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}(),L=i(584),U=i.n(L);function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function G(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function W(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?G(Object(i),!0).forEach(function(t){V(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):G(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function V(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function j(){return j="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var a=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Y(e)););return e}(e,t);if(a){var r=Object.getOwnPropertyDescriptor(a,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}},j.apply(this,arguments)}function H(e,t){return H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},H(e,t)}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&H(e,t)}(n,e);var t,i,a,r,o=(a=n,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Y(a);if(r){var i=Y(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===R(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),o.apply(this,arguments)}return t=n,(i=[{key:"close",value:function(){var e;j(Y(n.prototype),"close",this).call(this),null===(e=this.modal)||void 0===e||e.destroy(),this.modal=void 0}},{key:"open",value:function(){this.modal&&this.close();var e=j(Y(n.prototype),"open",this).call(this),t=document.createElement("div");return t.className="tingle-content-wrapper",t.appendChild(e.iFrameElement),this.modal=new(U().modal)({footer:!1,stickyFooter:!1,closeMethods:[],cssClass:["bankpay-container"],closeLabel:""}),this.modal.setContent(t.outerHTML),this.modal.open(),W(W({},e),{},{modal:this.modal})}}])&&function(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),n}(function(){function e(t,i){var a,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a=this,r="events",o=new E,r in a?Object.defineProperty(a,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):a[r]=o,this.handler=t,this.iFrameUrl=i,this.events.addEventListener(A.Close,this.close.bind(this))}var t,i;return t=e,(i=[{key:"close",value:function(){this.handler.removeEventTarget(this.events)}},{key:"open",value:function(){this.handler.addEventTarget(this.events);var e=document.createElement("iframe");return e.setAttribute("id","bankpay-iframe"),e.setAttribute("height","600"),e.setAttribute("src",this.iFrameUrl),{iFrameElement:e,iFrameUrl:this.iFrameUrl}}}])&&function(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}());function z(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function X(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?z(Object(i),!0).forEach(function(t){J(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):z(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function q(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function J(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Q=function(){function e(t){var i,a,r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),J(this,"eventHandler",new N),this.options=X(X({},{openBankingRedirect:""}),X(X({},t),{},{environment:null!==(i=t.environment)&&void 0!==i?i:"production",environmentScheme:null!==(a=t.environmentScheme)&&void 0!==a?a:"https"})),Object.prototype.hasOwnProperty.call(f,this.options.environment)&&(this.options.environmentScheme=f[this.options.environment].scheme,this.options.environment=f[this.options.environment].domain),/^http:/i.test(null!==(r=this.options.openBankingRedirect)&&void 0!==r?r:""))throw new Error("Open banking redirect URL must be custom scheme or HTTPS.");if(/certegy\.com/i.test(this.options.environment)&&"https"!==this.options.environmentScheme)throw new Error("environmentScheme must be HTTPS.");this.eventHandler.attach()}var t,i,a;return t=e,a=[{key:"getOriginUrl",value:function(){var e=window.location.protocol;return["https:","http:"].includes(e)?window.location.origin?window.location.origin:"".concat(e,"//").concat(window.location.host):"*"}}],(i=[{key:"destroy",value:function(){this.eventHandler.detach()}},{key:"createEnrollment",value:function(e){return new Z(this.eventHandler,this.buildWebviewUrl(v.Enrollment,e))}},{key:"createTransaction",value:function(e){return new Z(this.eventHandler,this.buildWebviewUrl(v.Transaction,e))}},{key:"buildWebviewUrl",value:function(t,i){var a,r="".concat(this.options.environmentScheme,"://").concat(this.options.environment),o=new URL("".concat(r,"/webview/v2/").concat(t,"/").concat(i));return o.searchParams.set("key",this.options.publishableKey),o.searchParams.set("originUrl",e.getOriginUrl()),t===v.Enrollment&&""!==this.options.openBankingRedirect&&o.searchParams.set("redirectUrl",null!==(a=this.options.openBankingRedirect)&&void 0!==a?a:""),o.toString()}}])&&q(t.prototype,i),a&&q(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}(),K={Sdk:Q,EventName:A}}(),BankPay=a.default}(),"undefined"==typeof _vgVPLOnline&&(_vgVPLOnline={});var VPLBankDetail="";!function(e){_vgVPLOnline.Controls={DivActiveDialog:"#divActiveDialog",Lblterms:"#lblterms",ChkDialogAggree:"#chkDialogAggree"},_vgVPLOnline.Model={BtnSaveVplTerms:"btnSaveVplTerms",BtnSaveVpl:"btnSaveVpl",BtnClose:"btnClose",BtnCancel:"btnCancel",vplStatus:0,objVPLCutomerRsponse:{},CustomerObject:{},TransactionIntent:"",objBankDetails:[],certegyAmount:0,certegyCallbackSuccessFucn:"",certegyCallbackErrorFucn:"",certegyInstallmentCallCount:0},_vgVPLOnline.Messages={},_vgVPLOnline.WebsiteApiPath="websiteapi/homepage/",_vgVPLOnline.ApiURLEnumVPL={AddBankAccount:"myaccount/addbankinmongo",EnrollCustomer:"enrollcustomervpl",CertegyIntents:"certegyintentsvpl",PaymentSchedule:"paymentschedulevpl",CertegyTransactionIntents:"certegytransactionintents",CertegyTransactionAction:"certegytransactionaction"},_vgVPLOnline.AddBankErrorType={Cancel:"Cancel",Close:"Close",Error:"Error",Success:"Success"},_vgVPLOnline.TransactionActionType={Authorize:1,Capture:2,Refund:3,Cancel:4},_vgVPLOnline.EnrollUser={},_vgVPLOnline.VagaroApiResponseEnum={ResponseCode:{Success:1e3,Error:1001}},_vgVPLOnline.VPLGatewayType={Certegy:1,Affirm:2},_vgVPLOnline.EnrollNewUser=function(e){if(1==_siteBuilderDetail.isAffirmEnable)ShowLoader(!1);else{if(ShowLoader(!0),(String.isNullOrUndefineOrBlank(e)||String.isNullOrUndefineOrBlank(e.merchant_token_id))&&(e.merchant_token_id="MCT1d983d51-5ddf-48e1-a630-58a5b6fbb48d"),CustomerObject=e,void 0===CoreAPIURL&&(CoreAPIURL=e.CoreAPIURL),String.isNullOrUndefineOrBlank(e))return;var t=new vagaro.ajax;t.datamodel.Token=_vgVPLOnline.WebsiteApiPath+_vgVPLOnline.ApiURLEnumVPL.EnrollCustomer,t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=_vgVPLOnline.EnrollNewUserSuccess,t.datamodel.Error=_vgVPLOnline.callFailed,t.Post()}},_vgVPLOnline.EnrollNewUserSuccess=function(e){ShowLoader(!1),e.IsSucess?(_vgVPLOnline.EnrollUser={},_vgVPLOnline.EnrollUser.ConsumerId=e.ConsumerId,_vgVPLOnline.EnrollUser.EnrollmentId=e.EnrollmentId,_vgVPLOnline.ProcessEnroll()):vagaro.alert({message:"Something went wrong, please try again!",title:"Oops!"})},_vgVPLOnline.callFailed=function(e){ShowLoader(!1),vagaro.alert({message:"Something went wrong, please try again!",title:"Oops!"})},_vgVPLOnline.ProcessEnroll=function(){const t=new BankPay.Sdk({publishableKey:e("#hdnCertegyPublishableKey").val(),environment:e("#hdnCertegyEnvironment").val()}).createEnrollment(_vgVPLOnline.EnrollUser.EnrollmentId);t.events.addEventListener(BankPay.EventName.ReadyForAuthorization,({data:e})=>{_vgVPLOnline.CertegyIntents(e.intentId)}),t.events.addEventListener(BankPay.EventName.Close,()=>{_vgVPLOnline.AddBankResponce(_vgVPLOnline.AddBankErrorType.Close,null)}),t.events.addEventListener(BankPay.EventName.Cancel,()=>{_vgVPLOnline.AddBankResponce(_vgVPLOnline.AddBankErrorType.Cancel,null)}),t.events.addEventListener(BankPay.EventName.Failure,({data:e})=>{_vgVPLOnline.AddBankResponce(_vgVPLOnline.AddBankErrorType.Error,e)}),t.events.addEventListener(BankPay.EventName.Success,({data:e})=>{_vgVPLOnline.AddBankResponce(_vgVPLOnline.AddBankErrorType.Success,e)}),t.open()},_vgVPLOnline.CertegyIntents=function(e){if(!String.isNullOrUndefineOrBlank(e)){var t={};t.enrollment_id=e;var i=new vagaro.ajax;i.datamodel.Token=_vgVPLOnline.WebsiteApiPath+_vgVPLOnline.ApiURLEnumVPL.CertegyIntents,i.datamodel.data=t,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=_vgVPLOnline.CertegyIntentsSuccess,i.datamodel.Error=_vgVPLOnline.callFailed,i.Post()}},_vgVPLOnline.CertegyIntentsSuccess=function(e){if(null!=typeof e&&null!=e&&null!=e.BankAccount){var t={};t.BankId=e.BankAccount.id,t.UserID=CustomerObject.UserID,t.strLoginUserId=CustomerObject.strLoginUserId,t.FirstName=CustomerObject.first_name,t.LastName=CustomerObject.last_name,t.AccountNumber=e.BankAccount.account_number,VPLBankDetail=e.BankAccount.account_number,t.RoutingNumber=e.BankAccount.routing_number,t.BankName="",t.CertegyConsumerTokenID=e.ConsumerId,t.CertegyEnrollmentID=e.EnrollmentId,t.ClientIP=CustomerObject.ClientIpAddress,_vgVPLOnline.Model.objBankDetails=t,_vgVPLOnline.AddBank(t)}},_vgVPLOnline.AddBankResponce=function(e,t){e==_vgVPLOnline.AddBankErrorType.Close||e==_vgVPLOnline.AddBankErrorType.Cancel||e==_vgVPLOnline.AddBankErrorType.Error||(ShowLoader(!1),console.log("Bank Add"+t))},_vgVPLOnline.AddBank=function(e){ShowLoader(!0);var t=new vagaro.ajax;t.datamodel.Token=_vgVPLOnline.GetCoreAPIURLWithToken(_vgVPLOnline.ApiURLEnumVPL.AddBankAccount),t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=_vgVPLOnline.OnSuccess_addBankDetails,t.datamodel.Error=function(e){ShowLoader(!1)},t.Post()},_vgVPLOnline.OnSuccess_addBankDetails=function(e){if(ShowLoader(!1),void 0!==e&&e.CustomCode==vagaro.VagaroCoreApiResponseCode.Success&&null!=e.Data&&null!=e.Data){if(2==e.Data)return void vagaro.alert({message:"Same bank already added",title:"Information"});window.location.href.includes("paylatersignup")?_checkout.AfterBankAddedSuccess():window.location.href.includes("shopping-bag")?_onlineCheckout.VPLBankDetailsBind():window.location.href.includes("book-now")?_onlineCheckout.BindVPLBank():window.location.href.includes("paylatercheckout")?_checkout.AfterBankAddedSuccessCheckoutTime():window.location.href.includes("freecardreader")&&_freeCardReader.BindVPLBank()}},_vgVPLOnline.OnFaild_addBankDetails=function(e){ShowLoader(!1),console.log(e),vagaro.alert({message:"Something went wrong, please try again!",title:"Oops!"})},_vgVPLOnline.PaymentSchedule=function(e,t,i){if(1==_siteBuilderDetail.isAffirmEnable)e>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount||(ShowLoader(!1),console.log("Vpl limit not match for certagy"));else if(e>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount){_vgVPLOnline.Model.certegyAmount=e,_vgVPLOnline.Model.certegyCallbackSuccessFucn=t,_vgVPLOnline.Model.certegyCallbackErrorFucn=i;var a={};a.encryptAmount=e,(window.location.href.includes("book-now")||window.location.href.includes("shopping-bag"))&&ShowLoader(!0);var r=new vagaro.ajax;r.datamodel.Token=_vgVPLOnline.WebsiteApiPath+_vgVPLOnline.ApiURLEnumVPL.PaymentSchedule,r.datamodel.data=a,r.datamodel.IsNewVagaroAPI=!0,r.datamodel.callback=_vgVPLOnline.ValidatePaymentSchedule,r.datamodel.Error=i,r.Post()}else ShowLoader(!1),console.log("Vpl limit not match for certagy")},_vgVPLOnline.ValidatePaymentSchedule=function(t){"0"==e("#finalCheckout").val()&&ShowLoader(!1);var i=0;void 0!==t&&null!=t&&t.InstallmentDetails.length>0&&(e.grep(t.InstallmentDetails,function(e){i+=parseFloat(e.amount)}),i.toFixed(2)==parseFloat(_vgVPLOnline.Model.certegyAmount)?_vgVPLOnline.Model.certegyCallbackSuccessFucn(t):(_vgVPLOnline.Model.certegyInstallmentCallCount++,_vgVPLOnline.Model.certegyInstallmentCallCount>3?(vagaro.alert({message:"Something went wrong, please try again!",title:"Oops!"}),setTimeout(function(){window.location.reload()},3e3)):_vgVPLOnline.Model.certegyCallbackErrorFucn(null)))},_vgVPLOnline.CertegyTransactionIntents=function(e){if(e.Amount>=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MinimumAmount&&e.Amount<=_siteBuilderDetail.UserLocationInfo.Model.BusinessDetail.MaximumAmount){if(void 0!==e&&null!=e){var t=new vagaro.ajax;t.datamodel.Token=_vgVPLOnline.WebsiteApiPath+_vgVPLOnline.ApiURLEnumVPL.CertegyTransactionIntents,t.datamodel.data=e,t.datamodel.IsNewVagaroAPI=!0,t.datamodel.callback=_vgVPLOnline.CertegyTransactionIntentSuccess,t.datamodel.Error=_vgVPLOnline.CertegyTransactionIntentError,t.Post()}}else ShowLoader(!1),console.log("Vpl limit not match for certagy")},_vgVPLOnline.CertegyTransactionIntentSuccess=function(t){if(void 0===t||null==t||null==t.TransactionId)return ShowLoader(!1),void console.log("certagy issue");{_vgVPLOnline.Model.TransactionIntent=t.TransactionId;const i=new BankPay.Sdk({publishableKey:e("#hdnCertegyPublishableKey").val(),environment:e("#hdnCertegyEnvironment").val()}).createTransaction(_vgVPLOnline.Model.TransactionIntent);i.events.addEventListener(BankPay.EventName.Close,()=>{}),i.events.addEventListener(BankPay.EventName.Cancel,()=>{}),i.events.addEventListener(BankPay.EventName.Failure,({data:e})=>{_vgVPLOnline.CetegyFreamInError(e)}),i.events.addEventListener(BankPay.EventName.ReadyForAuthorization,({data:e})=>{_vgVPLOnline.CertegyTreanscationAuth(e)}),i.events.addEventListener(BankPay.EventName.Success,({data:e})=>{}),i.open(),(window.location.href.includes("shopping-bag")||window.location.href.includes("book-now")||window.location.href.includes("paylatercheckout")||window.location.href.includes("Users/BusinessWidget.aspx"))&&ShowLoader(!1)}},_vgVPLOnline.CetegyFreamInError=function(e){console.log(e)},_vgVPLOnline.CertegyTransactionIntentError=function(e){console.log(e)},_vgVPLOnline.CertegyTreanscationAuth=function(e){if(window.location.href.includes("shopping-bag"))return ShowLoader(!1),void _onlineCheckout.SavecheckoutVPL(e);window.location.href.includes("paylatercheckout")?_checkout.AfterPaymentSuccessCheckoutTime(e):(window.location.href.includes("book-now")||window.location.href.includes("Users/BusinessWidget.aspx"))&&_shopdetail.SaveServiceBookVPL(e)},_vgVPLOnline.ProccessTransaction=function(e){if(void 0!==e&&null!=e){var t={};t.transaction_id=_vgVPLOnline.Model.TransactionIntent,t.transaction_action=_vgVPLOnline.TransactionActionType.Authorize;var i=new vagaro.ajax;i.datamodel.Token=_vgVPLOnline.WebsiteApiPath+_vgVPLOnline.ApiURLEnumVPL.CertegyTransactionAction,i.datamodel.data=t,i.datamodel.IsNewVagaroAPI=!0,i.datamodel.callback=_vgVPLOnline.ProccessTransactionSuccess,i.datamodel.Error=_vgVPLOnline.ProccessTransactionError,i.Post()}},_vgVPLOnline.ProccessTransactionSuccess=function(e){if(void 0!==e&&null!=e){if(window.location.href.includes("shopping-bag"))return void _onlineCheckout.SavecheckoutVPL(e);if(window.location.href.includes("paylatercheckout"))return void _checkout.AfterPaymentSuccessCheckoutTime(e);if(window.location.href.includes("book-now"))return void _shopdetail.SaveServiceBookVPL(result)}},_vgVPLOnline.ProccessTransactionError=function(e){console.log(e)},_vgVPLOnline.GetCoreAPIURLWithToken=function(e,t){try{var i="",a=CoreAPIURL.split("/");if(void 0!==t&&null!=t&&""!=t)a[3]=t,i=a.join("/")+e;else if("undefined"!=typeof myAccountUserGroupID&&null!=myAccountUserGroupID&&""!=myAccountUserGroupID){var r=myAccountUserGroupID.split(",");r.length>0&&(a[3]=r[0],i=a.join("/")+e)}return""==i&&(i=CoreAPIURL+e),i}catch(t){return CoreAPIURL+e}}}(jQuery,window,document);QueryStringValue="";var iframeParent="",IsWebsiteBuilderCommunication=0,WBBusinessID=0,modalTop=0,getCenterPoint=0,modalHeight=0,isAndroidMobile=null!=navigator.userAgent.match(/Android/i)&&null!=navigator.userAgent.match(/Mobile/i)&&null==navigator.userAgent.match(/Windows/i),isMobileModalOpen=(iOS=/(iPhone)/i.test(navigator.userAgent)&&!window.MSStream,!1),lastPosition=20;function getQueryStringData(e){var t,i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("&"),a=QueryStringValue.toLowerCase();if(void 0!==a&&null!=a&&a.includes("payrollconfiguration")&&QueryStringValue.indexOf("MerchntEmployeeID")>-1&&QueryStringValue.indexOf("payrollconfiguration")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("payrollconfiguration")&&(QueryStringValue.indexOf("isfromcompanyinforeq")>-1||QueryStringValue.indexOf("gnotification")>-1)&&QueryStringValue.indexOf("payrollconfiguration")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("vagaropayroll")&&QueryStringValue.indexOf("BankUuid")>-1&&QueryStringValue.indexOf("vagaropayroll")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("vagaropayroll")&&QueryStringValue.indexOf("FormUUID")>-1&&QueryStringValue.indexOf("vagaropayroll")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("/merchants/settings/employee/profile")&&QueryStringValue.indexOf("FormUUID")>-1&&QueryStringValue.indexOf("/merchants/settings/employee/profile")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("/merchants/settings/employee/profile")&&QueryStringValue.indexOf("IsFromBankInfo")>-1&&QueryStringValue.indexOf("/merchants/settings/employee/profile")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("/merchants/settings/employee/profile")&&QueryStringValue.indexOf("gnotificationtype")>-1&&QueryStringValue.indexOf("/merchants/settings/employee/profile")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("vagaropayroll")&&QueryStringValue.indexOf("gnotificationtype")>-1&&QueryStringValue.indexOf("vagaropayroll")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&a.includes("employees/payroll")&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&decodeURIComponent(a).includes("/merchants/settings/employee/profile/user/rentcollection")&&QueryStringValue.indexOf("empnotificationtype")>-1&&decodeURIComponent(QueryStringValue).indexOf("/merchants/settings/employee/profile/user/rentcollection")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&decodeURIComponent(a).includes("/merchants/settings/employee/profile/user/payroll")&&(QueryStringValue.indexOf("IsFromBankInfo")>-1||QueryStringValue.indexOf("FormUUID")>-1)&&decodeURIComponent(QueryStringValue).indexOf("/merchants/settings/employee/profile/user/payroll")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),a.includes("builder")&&a.includes("facebookshare")&&i.length>3)for(var r=3;r<i.length;r+=1)i[2]=i[2]+"&"+i[r];void 0!==a&&null!=a&&decodeURIComponent(a).includes("/merchants/calendar")&&QueryStringValue.indexOf("isFromEmail")>-1&&QueryStringValue.indexOf("isFromVagaroAi")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?")),void 0!==a&&null!=a&&decodeURIComponent(a).includes("/merchants/settings/premiumfeature/eprescribe")&&QueryStringValue.indexOf("isFromEmail")>-1&&QueryStringValue.indexOf("isFromEprescribeEmailSMS")>-1&&(i=QueryStringValue.slice(QueryStringValue.indexOf("?")+1).split("?"));for(r=0;r<i.length;r+=1){var o=(i[r]||"").split("=");if(o[0]===e)if(o.length>2)for(r=1;r<o.length;r++)t?t+="="+o[r]:t=o[r];else t=o[1]}return void 0!==t&&null!=t&&""!=t?decodeURIComponent(t):""}function hideVagaroComponent(){$("#menuBar").length>0&&$("#menuBar").hide(),$("#topHeadSection").length>0&&$("#topHeadSection").hide(),$(".extra-toggle-nav").length>0&&$(".extra-toggle-nav").css("min-height","0"),$(".menu-normal").length>0&&($(".menu-normal").parent().hide(),$(".menu-normal").hide()),$("#footerdiv").length>0&&$("#footerdiv").hide(),$("#btnBackLogin").length>0&&$("#btnBackLogin").show(),$("#pushdiv").length>0&&$("#pushdiv").hide()}$("#btnBackLogin").on("click",function(){wbc._postMessage('{"eventType": "closeIframe","parentID": "'+iframeParent+'"}'),iframeParent=""}),$("#btnBackSignup").on("click",function(){wbc._postMessage('{"eventType": "closeIframe","parentID": "'+iframeParent+'"}'),iframeParent=""});var isFromBottom=!1,isFromTop=!1;function setBookingDataFromWebsiteBuilder(){if(null!=window.parent&&null!=window.document&&null!=window.parent.postMessage&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL,"Builder"==getQueryStringData("Type"))){var e=getQueryStringData("Event");if("ServiceBook"==e){r=(r=getQueryStringData("Data")).replaceAll("\\","");var t=JSON.parse(r);if(void 0!==$("#hdnBuilderServiceid")&&isNotNullOrUndefinedString($("#hdnBuilderServiceid").val())&&(t.serviceid=$("#hdnBuilderServiceid").val()),1==t.AddonData)var i=setInterval(function(){if(void 0!==OnlindBookingResponse&&null!=OnlindBookingResponse&&void 0!==OnlindBookingResponse.lstOnlineServiceParent){clearInterval(i);var e=$.extend(!0,[],OnlindBookingResponse.lstOnlineServiceParent),a=_shopdetail.GetSelectedServiceDetail(e,t.serviceid);$("#txtService1").select2("onSelect",a)}},300);else _shopdetail.SetBookData(t.serviceid,t.providerID,t.styleID,t.styleName,t.bookingDateTime,t.PromotionID,t.EventType,t.isdeeplinkentry,t.PromotionProviderID)}else if("StaffServiceBook"==e){if(void 0!==$("#hdnBuilderSpid")&&isNotNullOrUndefinedString($("#hdnBuilderSpid").val()))var a=$("#hdnBuilderSpid").val();else{r=(r=getQueryStringData("Data")).replaceAll("\\","");t=JSON.parse(r)}_shopdetail.SetBookData("0",void 0!==a?a:t.providerID,"0","","","")}else if("BookNowPortfolio"==e){r=(r=getQueryStringData("Data")).replaceAll("\\","");t=JSON.parse(r);void 0!==$("#hdnBuilderServiceid")&&isNotNullOrUndefinedString($("#hdnBuilderServiceid").val())&&(t.serviceid=$("#hdnBuilderServiceid").val()),void 0!==$("#hdnBuilderSpid")&&isNotNullOrUndefinedString($("#hdnBuilderSpid").val())&&(t.spid=$("#hdnBuilderSpid").val()),void 0!==$("#hdnBuilderStyleid")&&isNotNullOrUndefinedString($("#hdnBuilderStyleid").val())&&(t.styleid=$("#hdnBuilderStyleid").val()),_shopdetail.SetBookData(t.serviceid,t.spid,t.styleid,t.styletitle,"","")}else if("DealBookNow"==e){var r;r=(r=getQueryStringData("Data")).replaceAll("\\","");t=JSON.parse(r);void 0!==$("#hdnBuilderServiceid")&&isNotNullOrUndefinedString($("#hdnBuilderServiceid").val())&&(t.serviceid=$("#hdnBuilderServiceid").val()),void 0!==$("#hdnBuilderPromotionid")&&isNotNullOrUndefinedString($("#hdnBuilderPromotionid").val())&&(t.promotionID=$("#hdnBuilderPromotionid").val()),void 0!==t.Referral&&null!=t.Referral&&isNotNullOrUndefinedString(t.Referral)&&cookieManager.setCookie("Referral","DailyDeal",.0833,cookieManager.defaultPath,cookieManager.defaultDomain,!0,!1),_shopdetail.SetBookData(t.serviceid,"","","",t.bookingDateTime,t.promotionID)}}}function mobileMoreoverlay(e){(iOS||isAndroidMobile)&&$(e).find(".vg-dropdown-child").css({"margin-top":lastPosition})}function setPopupPosi(e){isMobileModalOpen=!1;var t=modalHeight;modalHeight>document.scrollingElement.scrollHeight&&(t=document.scrollingElement.scrollHeight),document.scrollingElement.scrollHeight<$(e).height()+modalTop?$(e).height()<t?(t=$(e).height(),$(e).css({top:"auto",height:t,bottom:"0"})):$(e).css({top:"auto",height:t,bottom:"0"}):$(e).css({top:modalTop,height:t,bottom:"auto"}),wbc._postMessage('{"eventType": "modalPosition","parentID": "'+iframeParent+'"}')}$(document).on("touchstart mousedown",function(e){if(console.log("touchstart"),null!=e.target&&(0==$(".modal").is(":visible")?(console.log(e.target.getBoundingClientRect().top),isFromBottom=window.innerHeight-(e.target.getBoundingClientRect().top+e.target.getBoundingClientRect().height)<=300,isFromTop=e.target.getBoundingClientRect().top<350,lastPosition=e.target.getBoundingClientRect().top,isFromBottom&&void 0!==e.target.classList&&null!=e.target.classList&e.target.classList.contains("spanMore")&&void 0!==e.target.dataset&&null!=e.target.dataset&&void 0!==e.target.dataset.parentdiv&&null!=e.target.dataset.parentdiv&&(lastPosition=$("#"+e.target.dataset.parentdiv)[0].getBoundingClientRect().top)):e.target.getBoundingClientRect().top,"txtEventFromDate"===e.target.id&&(iOS||isAndroidMobile))){var t=setInterval(function(){var e=$(".mobile-datepicker-bottom span").filter(function(){return"Anytime"===$.trim($(this).text())});e.length&&(e.hide(),clearInterval(t))},50);setTimeout(function(){clearInterval(t)},1e3)}}),$(window).on("load",function(){if(null!=window.parent&&null!=window.document&&null!=window.parent.postMessage&&(QueryStringValue=""!=window.QueryStringValue?window.QueryStringValue:window.document.URL,"Builder"==getQueryStringData("Type"))){IsWebsiteBuilderCommunication=1;var e=getQueryStringData("Event");if("StaffClassBook"==e){if(void 0!==$("#hdnBuilderSpid")&&isNotNullOrUndefinedString($("#hdnBuilderSpid").val()))var t=$("#hdnBuilderSpid").val();_shopdetail.SetClassBookDataForClass("undefined"!=t&&""!=t&&null!=t?t:"")}else"ShoppingBag"==e&&ShoppingCartIconClick();hideVagaroComponent(),setWebsiteBuilderHeight(),$(".modal:not(#divLoginNew,#dvRegister,#divForgotPwd)").on("show.bs.modal",function(){console.log("modal-open"),iOS||isAndroidMobile?(isMobileModalOpen=!0,wbc._postMessage('{"eventType": "modalPositionFull","parentID": "'+iframeParent+'"}'),$(this).css({top:modalTop})):setPopupPosi(this),$(window).trigger("resize")}),$(".modal:not(#divLoginNew,#dvRegister,#divForgotPwd)").on("hidden.bs.modal",function(){$(this).css({top:"",bottom:""}),isMobileModalOpen=!1,(iOS||isAndroidMobile)&&wbc._postMessage('{"eventType": "modalPositionFullRemove","parentID": "'+iframeParent+'"}')}),$(".modal:not(#divLoginNew,#dvRegister,#divForgotPwd)").on("shown.bs.modal",function(){}),setInterval(function(){$(window).trigger("resize")},700)}});var isOverlayopen=!1;function SetMobileOverlayes(){(iOS||isAndroidMobile)&&($("#AppProgressModalForClass").is(":visible")||($(".vagaro-datepicker-mobile").is(":visible")||$(".modal:not(#divLoginNew):not(#dvRegister)").is(":visible")?(isMobileModalOpen=!0,wbc._postMessage('{"eventType": "modalDatePickerOpen","parentID": "'+iframeParent+'"}')):(isMobileModalOpen=!1,wbc._postMessage('{"eventType": "modalDatePickerclose","parentID": "'+iframeParent+'"}'))))}function setWebsiteBuilderHeight(){var e=500,t=getQueryStringData("Event");if($("#divLoginNew:visible").length>0||$("#dvRegister:visible").length>0){if(isAndroidMobile||iOS){var i=getQueryStringData("Type");void 0!==i&&null!=i&&"Builder"===i&&$("#divFooterPresent").css({"padding-top":"0"}),$("#btnBackLogin").hide(),$(".login-backbtn").hide(),e=$("#divLoginNew:visible").length>0?600:760,$("#dvRegister:visible").length>0&&(e=810)}else e=$("#divLoginNew:visible").length>0?635:830;$("#divFooterPresent").addClass("nopadtopRec"),$("#divFooterPresent").removeClass("reactmyprofile"),"WBFormsLogin"===t?($("#divFooterPresent").css({position:"relative",top:"-14px"}),$("#btnBackLogin").hide(),$("#btnBackSignup").hide(),wbc._postMessage('{"eventType": "setHeightFormBuilder","height" :'+e+', "width" : "100%", "parentID": "divformsiframe"} ')):wbc._postMessage('{"eventType": "setHeightBuilder","height" :'+e+', "width" : "100%", "parentID": "'+iframeParent+'"} ')}else if($("#dvProfilePage:visible").length>0){var a=[];$("#myAccTopBar ul li").each(function(e,t){var i=$(this).outerHeight();a.push(i)}),sidebarHeight=0;for(let e=0;e<a.length;e++)sidebarHeight+=a[e];var r=$("#myaccount-tab-content").outerHeight(!0),o=0;o=sidebarHeight>r?sidebarHeight+90:r,(iOS||isAndroidMobile)&&(o=r),$("#divFooterPresent").addClass("nopadtopRec"),$("#dvProfilePage").addClass("reactmyprofile"),(e=o)<=500&&(e=650),wbc._postMessage('{"eventType": "setHeightBuilder","height" :'+e+',"width" :"100%","parentID": "'+iframeParent+'"}')}else location.href.toLowerCase().indexOf("facebookpost")>=0?wbc._postMessage('{"eventType": "setFacebookFrame","height" :'+e+',"width" :"100%","parentID": "'+iframeParent+'"}'):((e=null==document.getElementById("divFooterPresent")?0:document.getElementById("divFooterPresent").offsetHeight)<=500&&(e=650),$("#servicenamepopup.modal:visible").length>0&&(e+=200,$("#servicenamepopup").addClass("wbpopupheight")),$("#divFooterPresent").removeClass("nopadtopRec"),$("#divFooterPresent").removeClass("reactmyprofile"),(iOS||isAndroidMobile)&&$(".dw-webkit.mobile-datepicker-bottom").is(":visible")&&"ShoppingBag"==t?wbc._postMessage('{"eventType": "setHeightBuilder","height" :600,"width" :"100%","parentID": "'+iframeParent+'"}'):wbc._postMessage('{"eventType": "setHeightBuilder","height" :'+e+',"width" :"100%","parentID": "'+iframeParent+'"}'));(iOS||isAndroidMobile)&&($("#AppProgressModalForClass").is(":visible")||($(".vagaro-datepicker-mobile").is(":visible")||$(".modal:not(#divLoginNew):not(#dvRegister)").is(":visible")?!0&&wbc._postMessage('{"eventType": "modalDatePickerOpen","parentID": "'+iframeParent+'"}'):wbc._postMessage('{"eventType": "modalDatePickerclose","parentID": "'+iframeParent+'"}')))}function addStyle(e,t,i){$.ajax("/assets/WebsiteBuilder/wbtheme.css",{cache:!0});var a="";a+=":root{",a+="--wbFontFamily:"+e.lblstylefontfamily+";",a+="--wbFontColor:"+e.lblstylecolor+";",a+="--wbFontSize:"+e.lblstylefontsize+";",a+="--wbFontWeight:"+e.lblstylefontweight+";",a+="--wbBtnPrimaryTxtColor: "+e.primarybuttoncolor+";",a+="--wbBtnPrimaryBgColor: "+e.primarybuttonbackgroundcolor+";",a+="--wbBtnPrimaryBdrColor: ''; ",a+="--wbBtnPrimaryRadius:"+e.primarybuttonborderradius+";",a+="--wbBtnPrimaryShadow:"+e.primarybuttonboxshadow+";",a+="--wbBtnPrimaryTxtColorHover: ''; ",a+="--wbBtnPrimaryBgColorHover:"+e.primarybuttonHoverbackgroundcolor+";",a+="--wbBtnPrimaryBdrColorHover: ''; ",a+="--wbBtnPrimaryBgImage: "+e.primarybuttonbackgroundimage+";",a+="--wbBtnSecondaryTxtColor: "+e.secondorybuttonbuttoncolor+";",a+="--wbBtnSecondaryBgColor: "+e.secondorybuttonbuttonbackgroundcolor+";",a+="--wbBtnSecondaryBdrColor: '' ;",a+="--wbBtnSecondaryRadius:"+e.secondorybuttonbuttonborderradius+";",a+="--wbBtnSecondaryShadow:"+e.secondorybuttonbuttonboxshadow+";",a+="--wbBtnSecondaryTxtColorHover: '' ;",a+="--wbBtnSecondaryBgColorHover:"+e.secondorybuttonbuttonHoverbackgroundcolor+";",a+="--wbBtnSecondaryBdrColorHover: '' ;",a+="--wbBtnSecondaryBgImage: "+e.secondorybuttonbuttonbackgroundimage+";",a+="--wbFormInputColor: '' ;",a+="--wbFormInputColorFocus: '' ;",a+="--wbStarColor: "+e.btnratingcolor+";",a+="--wbBodyBg: "+e.glbbackgroundcolor+";",a+="--glbHeadFont:"+e.glbHeadingFonts+";",a+="}",a+="html, body {font-family: var(--wbFontFamily)!important;background-color:var(--wbBodyBg)}.shoppingcart .modal-body, .shoppingcart .modal-content{background-color:var(--wbBodyBg);}.popupwidth542{max-width:100%}.shoppingcart>.popupwidth542.zs-fullwithcc .modal-content{padding:0}.popupwidth542 .modal-title, .shoppingcart ul.list-inline li>label{font-family:var(--glbHeadFont)!important}body .popupwidth542 .cciframe-addresswithcountry .cc-detail-address-input .select2-container-multi .select2-choices .select2-search-field input.select2-input{font-family: var(--wbFontFamily)!important;}.popupwidth542 .modal-footer .btn-primary{background-color: var(--wbBtnPrimaryBgColor)!important;border-color: transparent!important;color: var(--wbBtnPrimaryTxtColor)!important;}.popupwidth542 .modal-footer .btn-primary:hover{background-color: var(--wbBtnPrimaryBgColorHover)!important;border-color: transparent!important;color: var(--wbBtnPrimaryTxtColor)!important;}.popupwidth542 .modal-footer .btn-default{background-color: var(--wbBtnSecondaryBgColor)!important;border-color: transparent!important;color: var(--wbBtnSecondaryTxtColor)!important;}.popupwidth542 .modal-footer .btn-default:hover{background-color: var(--wbBtnSecondaryBgColorHover)!important;border-color: transparent!important;color: var(--wbBtnSecondaryTxtColor)!important;}",$("#hdnBuilderFrameCSS").val(a),a+=".icon-plus-img:before {content:'\\f067'}";var r="<link href='https://fonts.googleapis.com/css2?family="+e.lblstylefontfamily+"' rel='stylesheet'>";$("head").append(r);var o=document.head||document.getElementsByTagName("head")[0];style=document.createElement("style"),style.type="text/css",style.styleSheet?style.styleSheet.cssText=a:style.appendChild(document.createTextNode(a)),o.appendChild(style),$("body").append("<link href='/assets/WebsiteBuilder/wbtheme.css?v=11' rel='stylesheet'>"),iframeParent=t,WBBusinessID=i,wbc._postMessage('{"eventType": "iframeLoaded","parentID": "'+iframeParent+'"}'),$("body,html").addClass("websitebuilder-loaded"),setWebsiteBuilderHeight()}function isNotNullOrUndefinedString(e){return void 0!==e&&null!=e&&""!=e}function isAllowedOrigin(e){try{var t=new URL(e).hostname;return"vagaro.com"===t||t.endsWith(".vagaro.com")||"bookitall.com"===t||t.endsWith(".bookitall.com")||"localdev.com"===t||t.endsWith(".localdev.com")}catch(e){return!1}}function vagaroConnectLitener(e){if(isAllowedOrigin((e.originalEvent||e).origin)&&null!=e&&"undefined"!=e&&null!=e.data&&"undefined"!=e.data&&isJsonString(e.data||void 0!==e.originalEvent&&void 0!==e.originalEvent.data&&e.originalEvent.data)){var t=JSON.parse(e.data||e.originalEvent.data);switch(t.eventType){case"BOOK":void 0!==window._aiBooking&&null!==window._aiBooking&&"function"==typeof window._aiBooking.handleBookMessage&&window._aiBooking.handleBookMessage(t.Data);break;case"iFrameReset":var i=JSON.parse(t.Data);ExpandMinimizeButtonClick(i.isCustomerChat,i.showValue,i.ClearChatSelection,i.isPageLoad,i.isIframeOpened);break;case"closeChat":ChatBoxCloseClick();break;case"closeChatClient":_siteBuilderDetail.HideVagaroConnectChat();break;case"setUnreadCount":setUnreadCount(t.Data);break;case"ExpandMinimizeChatForCustomer":ExpandMinimizeChatForCustomer(t.Data);break;case"iFrameRemoveClass":var a=JSON.parse(t.Data);"vc-iframeGalleryOpen"==a.className&&window.$("body").removeClass("vc-iframeGalleryBody"),$("#chatFrame").removeClass(a.className);break;case"iFrameAddClass":var r=JSON.parse(t.Data);"vc-iframeGalleryOpen"==r.className&&window.$("body").addClass("vc-iframeGalleryBody"),$("#chatFrame").addClass(r.className);break;case"vagaroConnectShowHideLoader":void 0!==window._siteBuilderDetail&&null!==window._siteBuilderDetail&&void 0!==window._siteBuilderDetail.ShowLoaderVagaroConnect&&null!==window._siteBuilderDetail.ShowLoaderVagaroConnect&&window._siteBuilderDetail.ShowLoaderVagaroConnect(!1),"function"==typeof ShowLoader&&ShowLoader(!1);break;case"setChatConversationId":window.document.getElementById("hdnChatConversionId").value=t.Data;break;case"openCustomerChatWindow":null!==window.document.getElementById("chatWindow")&&$("#chatFrame,#chatWindow").show();break;case"redirectToPageVagaro":window.location.href=t.Data;break;case"openCustomerProfile":OpenCustomerHistoryPopupFromVagaroConnect(t.Data,!1);break;case"openCustomerEditProfile":OpenCustomerHistoryPopupFromVagaroConnect(t.Data,!0);break;case"openEmployeeProfile":window.location.href=location.protocol+"//"+location.hostname+(location.port&&":"+location.port)+"/merchants/settings/employee/profile?ConnectSPID="+t.Data;break;case"OpenTextMessagingPlanPopup":OpenTextMessagingPlanPopup(!0,JSON.parse(t.Data).isEnable2WaySMS),_vagaroConnect.model.IsFromVagaroAiActive=!1;break;case"OpenTextMessagingPlanActivePopup":OpenTextMessagingPlanPopup(!0,JSON.parse(t.Data).isEnable2WaySMS),_vagaroConnect.model.IsFromVagaroAiActive=!0;break;case"ReloadTextMessagingPlanIframe":ReloadTextMessagingPlanIframe();break;case"upDateDetails":case"AppoinemtsPopupUpdte":case"customerNumberadded":_postMessage('{"eventType": "'+t.eventType+'", "payload" : '+t.Data+"}");break;case"CloseiFrame":CloseIframe();break;case"VG_BroadcastMassage":openBroadCastPopup(t.Data);break;case"mobilecallbackios":window.JSInterface.CallWSMethod(t.Data);break;case"AiLastModifiedDetails":ConnectLastModified(t.Data);break;case"DormantUpgrade":var o=document.createElement("div");o.addEventListener("click",function(){_vagaroConnect.OpenDormantUpgrade(e)}),o.click()}}}function ExpandMinimizeButtonClick(e,t,i=!0,a=!1,r){if(!e&&void 0!==window&&void 0!==window.document.getElementById("chatFrame")&&null!==window.document.getElementById("chatFrame")){if(t<0)return;if(t>3)return;!0===window.$(".sttingBtns").is(":visible")?window.$("body").addClass("bottom-button-space"):window.$("body").removeClass("bottom-button-space"),!0===window.$(".editemployee").is(":visible")&&window.$("body").addClass("bottom-sticky-chat"),!0===window.$(".vg-btn-fixrow").is(":visible")&&window.$("body").addClass("bottom-button-space"),1===t?(window.$("#chatFrame").addClass("ifream-rightSide"),window.$("#chatFrame").removeClass("ifream-smallscreen"),window.$("#chatFrame").removeClass("ifream-minimize"),window.$("body").removeClass("chat-icon-bottom"),!0!==window.$(".ServicesWrap").is(":visible")&&!0!==window.$(".rmpHiddenView").is(":visible")&&!0!==window.$(".EmptyCard").is(":visible")&&!0!==window.$(".marketing-wrapper-inner").is(":visible")&&!0!==window.$(".page-container").is(":visible")||window.$("#chatFrame").removeClass("fullpageView"),!0===window.$(".rightServicePart .divRight-Height").is(":visible")||window.$(".inventory-container").is(":visible"),window.$("#chatFrame").removeClass("fullpageWithFooterView"),window.$("#chatFrame").removeClass("fullpageView"),!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("halfpageWithFooterView"),"/merchants/settings/thingswesell/service"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("fullpageWithFooterView"),!0!==window.$(".settingWrapperHalf").is(":visible")&&!0!==window.$(".ddsales-settings").is(":visible")&&!0!==window.$(".settings-body-div").is(":visible")&&!0!==window.$(".settingMainWarp").is(":visible")&&!0!==window.$(".vagaroDrive-page").is(":visible")||(window.$("#chatFrame").removeClass("halfpageView"),window.$("#chatFrame").removeClass("fullpageView")),"/merchants/reports/sales/salessummary"===window.location.pathname&&window.$("#chatFrame").removeClass("fullpageWithFooterViewNoChat"),"/merchants/settings/employee/access"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("halfpageWithFooterView"),"/merchants/calendar"===window.location.pathname&&(window.$(".liveChat").removeClass("liveChat-calendar"),$("#dvcheckoutframe").is(":visible")&&void 0!==$("#checkoutframe")[0]&&void 0!==$("#checkoutframe")[0].contentWindow&&$("#checkoutframe")[0].contentWindow.length>0&&$("#checkoutframe")[0].contentWindow.$(".checkout-right-fix").removeClass("checkoutVC-minimize")),("/ShopOwner/Checkout.aspx"===window.location.pathname||/merchants\/checkout\/?(\?.*)?$/i.test(window.location.pathname))&&(window.$(".checkout-right-fix").removeClass("checkoutVC-minimize"),window.$("#chatFrame").removeClass("ifreamCheckOut-minimize"))):2===t?(window.$("#chatFrame").addClass("ifream-rightSide"),window.$("#chatFrame").addClass("ifream-smallscreen"),window.$("body").addClass("chat-icon-bottom"),window.$("#chatFrame").removeClass("ifream-minimize"),window.$("#lnkForChat").removeClass("activefirst"),1==_vagaroConnect.model.IsClose&&window.$("#lnkForChat").addClass("activefirst"),_vagaroConnect.model.IsClose=!0,!0!==window.$(".ServicesWrap").is(":visible")&&!0!==window.$(".rmpHiddenView").is(":visible")&&!0!==window.$(".EmptyCard").is(":visible")&&!0!==window.$(".marketing-wrapper-inner").is(":visible")&&!0!==window.$(".page-container").is(":visible")||window.$("#chatFrame").removeClass("fullpageView"),!0===window.$(".rightServicePart .divRight-Height").is(":visible")||window.$(".inventory-container").is(":visible"),window.$("#chatFrame").removeClass("fullpageWithFooterView"),window.$("#chatFrame").removeClass("fullpageView"),!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("halfpageWithFooterView"),"/merchants/settings/thingswesell/service"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("fullpageWithFooterView"),!0!==window.$(".settingWrapperHalf").is(":visible")&&!0!==window.$(".ddsales-settings").is(":visible")&&!0!==window.$(".settings-body-div").is(":visible")&&!0!==window.$(".settingMainWarp").is(":visible")&&!0!==window.$(".vagaroDrive-page").is(":visible")||(window.$("#chatFrame").removeClass("halfpageView"),window.$("#chatFrame").removeClass("fullpageView")),"/merchants/reports/sales/salessummary"===window.location.pathname&&window.$("#chatFrame").removeClass("fullpageWithFooterViewNoChat"),"/merchants/settings/employee/access"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("halfpageWithFooterView"),"/merchants/calendar"===window.location.pathname&&(window.$(".liveChat").addClass("liveChat-calendar"),window.top.$("body").css("overflow","initial"),$("#dvcheckoutframe").is(":visible")&&void 0!==$("#checkoutframe")[0]&&void 0!==$("#checkoutframe")[0].contentWindow&&$("#checkoutframe")[0].contentWindow.length>0&&$("#checkoutframe")[0].contentWindow.$(".checkout-right-fix").removeClass("checkoutVC-minimize")),("/ShopOwner/Checkout.aspx"===window.location.pathname||/merchants\/checkout\/?(\?.*)?$/i.test(window.location.pathname))&&(window.$(".checkout-right-fix").removeClass("checkoutVC-minimize"),window.$("#chatFrame").removeClass("ifreamCheckOut-minimize")),window.MidSizePage&&window.MidSizePage()):3===t?(window.$("#chatFrame").addClass("ifream-minimize"),window.$("body").addClass("chat-icon-bottom"),window.$("#lnkForChat").addClass("activefirst"),!0!==window.$(".ServicesWrap").is(":visible")&&!0!==window.$(".rmpHiddenView").is(":visible")&&!0!==window.$(".EmptyCard").is(":visible")&&!0!==window.$(".marketing-wrapper-inner").is(":visible")&&!0!==window.$(".page-container").is(":visible")||window.$("#chatFrame").addClass("fullpageView"),!0===window.$(".rightServicePart .divRight-Height").is(":visible")||!0===window.$(".inventory-container").is(":visible")?(window.$("#chatFrame").addClass("fullpageWithFooterView"),$("#chatFrame").hasClass("fullpageWithFooterView")&&($("#chatFrame").removeClass("halfpageWithFooterView"),$("#chatFrame").removeClass("fullpageView")),0===window.$(".inventory-container").children().length?(window.$("#chatFrame").addClass("fullpageView"),window.$("#chatFrame").removeClass("fullpageWithFooterView")):(window.$("#chatFrame").removeClass("fullpageView"),window.$("#chatFrame").addClass("fullpageWithFooterView"))):window.$("#chatFrame").removeClass("fullpageWithFooterView"),!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").addClass("halfpageWithFooterView"),"/merchants/settings/thingswesell/service"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&(window.$("#chatFrame").addClass("fullpageWithFooterView"),window.$("#chatFrame").removeClass("fullpageView"),window.$("#chatFrame").removeClass("halfpageWithFooterView")),!0!==window.$(".settingWrapperHalf").is(":visible")&&!0!==window.$(".ddsales-settings").is(":visible")&&!0!==window.$(".settings-body-div").is(":visible")&&!0!==window.$(".settingMainWarp").is(":visible")&&!0!==window.$(".vagaroDrive-page").is(":visible")||(window.$("#chatFrame").addClass("halfpageView"),0===window.$(".inventory-container").children().length?(window.$("#chatFrame").addClass("fullpageView"),window.$("#chatFrame").removeClass("halfpageView")):(window.$("#chatFrame").removeClass("fullpageView"),window.$("#chatFrame").addClass("fullpageWithFooterView"))),"/merchants/settings/employee/access"===window.location.pathname&&(!0===window.$(".custom-footerdiv").is(":visible")?window.$("#chatFrame").addClass("halfpageWithFooterView"):window.$("#chatFrame").removeClass("halfpageWithFooterView")),"/merchants/reports/sales/salessummary"===window.location.pathname&&(!0===window.$(".exportfootSection").is(":visible")?window.$("#chatFrame").addClass("fullpageWithFooterViewNoChat"):window.$("#chatFrame").removeClass("fullpageWithFooterViewNoChat")),"/merchants/calendar"===window.location.pathname&&(window.$(".liveChat").addClass("liveChat-calendar"),window.top.$("body").css("overflow","initial"),$("#dvcheckoutframe").is(":visible")&&void 0!==$("#checkoutframe")[0]&&void 0!==$("#checkoutframe")[0].contentWindow&&$("#checkoutframe")[0].contentWindow.length>0&&$("#checkoutframe")[0].contentWindow.$(".checkout-right-fix").addClass("checkoutVC-minimize")),("/ShopOwner/Checkout.aspx"===window.location.pathname||/merchants\/checkout\/?(\?.*)?$/i.test(window.location.pathname))&&(window.$(".checkout-right-fix").addClass("checkoutVC-minimize"),window.$("#chatFrame").addClass("ifreamCheckOut-minimize")),window.DownButtonCollapsedPage&&window.DownButtonCollapsedPage()):0===t&&(window.$("#chatFrame").removeClass("ifream-minimize"),window.$("#chatFrame").removeClass("ifream-smallscreen"),window.$("#chatFrame").removeClass("ifream-rightSide"),!0!==window.$(".ServicesWrap").is(":visible")&&!0!==window.$(".rmpHiddenView").is(":visible")&&!0!==window.$(".EmptyCard").is(":visible")&&!0!==window.$(".marketing-wrapper-inner").is(":visible")&&!0!==window.$(".page-container").is(":visible")||window.$("#chatFrame").removeClass("fullpageView"),!0===window.$(".rightServicePart .divRight-Height").is(":visible")||window.$(".inventory-container").is(":visible"),window.$("#chatFrame").removeClass("fullpageWithFooterView"),window.$("#chatFrame").removeClass("fullpageView"),!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("halfpageWithFooterView"),"/merchants/settings/thingswesell/service"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("fullpageWithFooterView"),!0!==window.$(".settingWrapperHalf").is(":visible")&&!0!==window.$(".ddsales-settings").is(":visible")&&!0!==window.$(".settings-body-div").is(":visible")&&!0!==window.$(".settingMainWarp").is(":visible")&&!0!==window.$(".vagaroDrive-page").is(":visible")||(window.$("#chatFrame").removeClass("halfpageView"),window.$("#chatFrame").removeClass("fullpageView")),"/merchants/settings/employee/access"===window.location.pathname&&!0===window.$(".custom-footerdiv").is(":visible")&&window.$("#chatFrame").removeClass("halfpageWithFooterView"),"/merchants/reports/sales/salessummary"===window.location.pathname&&window.$("#chatFrame").removeClass("fullpageWithFooterViewNoChat"),"/merchants/calendar"===window.location.pathname&&(window.$(".liveChat").removeClass("liveChat-calendar"),window.top.$("body").css("overflow","hidden"),$("#dvcheckoutframe").is(":visible")&&void 0!==$("#checkoutframe")[0]&&void 0!==$("#checkoutframe")[0].contentWindow&&$("#checkoutframe")[0].contentWindow.length>0&&$("#checkoutframe")[0].contentWindow.$(".checkout-right-fix").removeClass("checkoutVC-minimize")),("/ShopOwner/Checkout.aspx"===window.location.pathname||/merchants\/checkout\/?(\?.*)?$/i.test(window.location.pathname))&&(window.$(".checkout-right-fix").removeClass("checkoutVC-minimize"),window.$("#chatFrame").removeClass("ifreamCheckOut-minimize"))),$("body").addClass("vc-open")}}function isJsonString(e){try{JSON.parse(e)}catch(e){return!1}return!0}function ChatBoxCloseClick(e=!1){!1===e?(_vagaroConnect.model.IsClose=!1,window.$("#chatFrame").removeClass("vc-iframeCustomer_extend"),window.$("#chatFrame").removeClass("vc-iframeCustomer_minimize"),window.$("body").removeClass("chat-icon-bottom"),window.document.getElementById("chatFrame").style.display="none",window.$("body").removeClass("VC-customerChatOpen"),window.$('meta[name="viewport"]').attr("content","width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"),window.$("body").removeClass("vc-open"),window.$("#lnkForChat").removeClass("activefirst")):!0===e&&(window.$("#chatFrame").removeClass("ifream-minimize"),window.$("#chatFrame").removeClass("ifream-smallscreen"),window.$("#chatFrame").removeClass("ifream-rightSide"),window.$("body").removeClass("chat-icon-bottom"),window.$("#chatFrame").removeClass("ifream-chatActive"),window.document.getElementById("chatFrame").style.display="none","/merchants/calendar"===window.location.pathname&&(window.$(".liveChat").removeClass("liveChat-calendar"),window.top.$("body").css("overflow","initial"))),window.CloseChatButton&&window.CloseChatButton()}function _postMessage(e){try{$(_vagaroConnect.controls.chatWindow).length>0&&document.getElementById("chatWindow").contentWindow.postMessage(e,_vagaroConnect.model.vagaroConnectPath)}catch(e){console.log(e)}}function checkIframeContent(){var e=$("#chatWindow")[0];return!(!e||!e.contentDocument&&!e.contentWindow.document)}function setUnreadCount(e){parseInt(e)>0?($("#lblChatCount").html(parseInt(e)),$("#lblChatCount").show()):$("#lblChatCount").hide()}function ExpandMinimizeChatForCustomer(e){parseInt(e)<0||parseInt(e)>2||(0===parseInt(e)?($("#chatFrame").removeClass("vc-iframeCustomer_extend"),$("#chatFrame").addClass("vc-iframeCustomer_minimize"),$("body").removeClass("VC-customerChatOpen")):1===parseInt(e)?($("#chatFrame").removeClass("vc-iframeCustomer_extend"),$("#chatFrame").removeClass("vc-iframeCustomer_minimize")):2===parseInt(e)&&$("#chatFrame").addClass("vc-iframeCustomer_extend"))}function OpenCustomerHistoryPopupFromVagaroConnect(e,t){CallCustomerHistoryMain(e,12,"3170442",vConnectReactPayload.ReactBusinessId,"0","01/29/2024",!1,!1,!1,!1,"",null,!0,!0,null,null),window.top.$("#DivCustomerHistoryPopUp").css("z-index",1e9),window.top.gblIsFromReact=!0,void 0!==t&&1==t&&(window.top.gblIsOpenEditCustomerPopup=!0)}function CallCustomerHistoryMain(e,t,i,a,r,o,n,s,l,d,c,u,p,h,m,f){var g="/ShopOwner/CustomerHistoryPopUp.aspx";try{void 0!==window.parent.location.href&&null!=window.parent.location.href&&window.parent.location.href.includes("/merchants/calendar")&&(g="CustomerHistoryPopUp.aspx?cal=1")}catch(e){console.log(e)}ShowDynamicPopupForShopOwner(g,510,970,"DivCustomerHistoryPopUp","Customer Details",null,null,"cust-history-reponsive");var v=$("#iFrame_DivCustomerHistoryPopUp"),A=v[0].contentWindow,C="0",y=p;"true"==y.toString().toLowerCase()?C="2":"false"==y.toString().toLowerCase()&&"true"==h.toString().toLowerCase()&&(C="1"),v.load(function(){this.contentWindow.FillCustomerInfoFromCustomerID(e,t,i,a,r,o,n,s,l,d,c,u,C,p,m,f)}),null!=A.FillCustomerInfoFromCustomerID&&A.FillCustomerInfoFromCustomerID(e,t,i,a,r,o,n,s,l,d,c,u,C,p,m,f)}function OpenEmployeeProfilePopupFromVagaroConnect(e){console.log(e),window.top.$CalBookApp.CallCustomerHistoryMain(e,12,0,vConnectReactPayload.ReactBusinessId,"0","1/12/2021 9:30:00 AM",!1,!1,!1,!1,"",null,!0,!0,null,null),window.top.$("#DivCustomerHistoryPopUp").css("z-index",1e9)}function OpenTextMessagingPlanPopup(e,t){var i=$(_vagaroConnect.controls.ifrmTextMarketingPlans),a=i.attr("src");if(_vagaroConnect.model.IsFrom2WaySMS=!1,void 0!==t&&(_vagaroConnect.model.IsFrom2WaySMS=t),void 0!==a&&null!=a&&""!=a){window.$(".bootbox-confirm").modal("hide");var r=window.$("#divVCPromotionTextMarketingPlans");r.on("show.bs.modal",function(){r.addClass("show"),centerModal(r),$("body").addClass("textMessagingModalOpen")}).modal("show"),centerModal(r),r.on("hidden.bs.modal",function(e){$("body").removeClass("textMessagingModalOpen")})}else _vagaroConnect.ShowLoadingPanel(!0),i.attr("src",_vagaroConnect.model.vagaroConnectTextMessagingPlanIframe),i.on("load",function(){if(void 0!==e&&1==e){window.$(".bootbox-confirm").modal("hide");var t=window.$("#divVCPromotionTextMarketingPlans");t.on("show.bs.modal",function(){t.addClass("show"),centerModal(t),$("body").addClass("textMessagingModalOpen"),_vagaroConnect.ShowLoadingPanel(!1)}).modal("show"),centerModal(t),t.on("hidden.bs.modal",function(e){$("body").removeClass("textMessagingModalOpen")}),e=void 0}})}function centerModal(e){null==e&&(e=this),window.$(e).css("display","block");var t=window.$(e).not(".in").find(".modal-dialog");0==t.length&&(t=window.$(e).find(".modal-dialog"));var i=window;window.$(e).closest(".modal-dialog").length>0&&(i=window.$(e).closest(".modal-dialog"));var a=Math.min(window.$(i).height(),screen.availHeight);"undefined"!=typeof window_top&&"number"==typeof window_top||(window_top=0);var r=window_top+(a-t.height())/2;t.css("margin-top",r)}function CloseTextMarketingPopup(){""!=window.$("#hdnFromPhoneNumber").val()&&"Select Text Marketing Plan"!=window.$("#aPromotionTextNameAndTotalCount").html()||"0"==window.$("#HidId").val()&&("0"==window.$("#HidId").val()||""==window.$("#hdnFromPhoneNumber").val()||"Select Text Marketing Plan"==window.$("#aPromotionTextNameAndTotalCount").html()?window.$("#TabEmail").click():window.$("#btnCancel").click())}function ConnectCloseTextMarketingPopupCallBack(e){if(1==_vagaroConnect.model.IsFromVagaroAiActive){var t={isTextmarketingEnable:e};_postMessage('{"eventType": "TextMarketingCloseBtn", "payload" : '+JSON.stringify(t)+"}")}}function ReloadTextMessagingPlanIframe(){document.getElementById("ifrmVCTextMarketingPlans").contentDocument.location.reload(!0)}function LoadVagaroConnectPlanUsageMeter(){_postMessage('{"eventType": "TextMarketingCallBack", "payload" : ""}')}function LoadVagaroConnectPlanActivatedFirstTime(){_postMessage('{"eventType": "textmarketingactivefirstime", "payload" : ""}')}function CalanderCloseFream(){_postMessage('{"eventType": "CalanderCloseFream", "payload" : ""}')}function CloseIframe(){window.$("#chatFrame").removeClass("ifream-minimize"),window.$("#chatFrame").removeClass("ifream-smallscreen"),window.$("#chatFrame").removeClass("ifream-rightSide"),window.$("body").removeClass("chat-icon-bottom"),window.$("#chatFrame").removeClass("ifream-chatActive"),$(_vagaroConnect.controls.chatWindow).attr("src",""),_vagaroConnect.Init(),"/merchants/calendar"===window.location.pathname&&(window.$(".liveChat").removeClass("liveChat-calendar"),window.top.$("body").css("overflow","initial")),window.CloseChatButton&&window.CloseChatButton()}function ConnectLastModified(e){"undefined"!=typeof ShowConnectProgressBar&&ShowConnectProgressBar(!0);var t=e.replace('"{"','{"').replace('"}"','"}'),i=JSON.parse(t);"undefined"!=typeof ShowVagaroConnectAiSettingHistory?ShowVagaroConnectAiSettingHistory(i.type):("undefined"!=typeof BindSettingHistory&&BindSettingHistory(i.type),"undefined"!=typeof ShowConnectProgressBar&&ShowConnectProgressBar(!1))}function GetOrUpdateLastModifiedDetailsForConnect(e,t,i){void 0===t&&(t=null),void 0===e&&(e=null);var a=new vagaro.ajax;a.datamodel.Token="GetLastDate",a.datamodel.callback=GetOrUpdateLastModifiedDetails_SuccessForConnect,a.datamodel.data=[e,t,i],a.Post()}function GetOrUpdateLastModifiedDetails_SuccessForConnect(e){if(null==e||null==e.modified_by_name||null==e.ModifiedDate&&IsNullOrEmpty(e.ModifiedDate))$("#dvLastModified"+e.module_id).css("display","none");else{for(var t=e.modified_by_name.split(" "),i=0;i<t.length;i++)t[i]=t[i].charAt(0).toUpperCase()+t[i].slice(1);var a=t.join(" ");2010==e.module_id&&_postMessage('{"eventType": "GetAILastModifiedDetails", "payload" : "Last Modified: '+a+" - "+e.ModifiedDate+'"}')}}function openBroadCastPopup(e){var t=e.replace('"{"','{"').replace('"}"','"}');try{1==t.includes(_vagaroConnect.StaticString.IsBlockBusiness)&&(t=t.replace('"}',"}"))}catch(e){console.log(e)}var i=JSON.parse(t),a=i.data;if(!String.isNullOrUndefineOrBlank(a)&&!String.isNullOrUndefineOrBlank(typeof a.IsBlockBusiness)&&"true"==a.IsBlockBusiness)return void 0!==_postMessage&&"function"==typeof _postMessage&&_postMessage('{"eventType": "ClearLocalStorage", "payload" : ""}'),localStorage.removeItem(_vagaroConnect.StaticString.IsShowBellNotification),localStorage.removeItem(_vagaroConnect.StaticString.ReviewPlatformData),localStorage.removeItem(_vagaroConnect.StaticString.lblFeatureCount),localStorage.removeItem(_vagaroConnect.StaticString.lblFeatureCountUpdate),localStorage.removeItem(_vagaroConnect.StaticString.lblVCNotificationCount),localStorage.removeItem(_vagaroConnect.StaticString.PayProMiniDevice),location.href=_vagaroConnect.StaticString.ScreenLockUrl,!1;if(111==i.messageType)AddRemoveStarredMenuOnTop(a);else if("true"==a.isReloadNotification)removedCookie("isFromWareHouseAPI"),_vagroNotification.BindSupporUpSellRecommendation();else if("true"==a.isShow){var r=a.strSupportUpsellId,o=a.employeeID.toString();if(vConnectReactPayload.ReactUserID==o){var n={};n.strBusinessId=vConnectReactPayload.ReactBId,n.strLoginUserId=vConnectReactPayload.ReactUId,n.strsupportUpsellID=r,n.pageIndex=1,n.pageSize=0,n.device="featurespage",n.isFeaturePage=!0;var s=new vagaro.ajax;s.datamodel.Token="GetRecommendedFeatureDataByID",s.datamodel.data=[n],s.datamodel.callback=function(e){callSuccess_GetRecommendedFeatureDataByID(e,a.SupportUpsellID,r)},s.datamodel.Error=function(e){},s.Post(),_vagroNotification.BindSupporUpSellRecommendation()}}else $("#divbrandedappmodal").modal("hide"),$(".modal-backdrop").hide(),$("#divUpsellPopup").empty()}setInterval(function(){isMobileModalOpen||isOverlayopen||setWebsiteBuilderHeight()},500),checkDivs=setInterval(SetMobileOverlayes,700),$(window).bind("orientationchange",function(e){setWebsiteBuilderHeight()}),function(e){wbc={_postMessage:function(t){try{window.parent!=e&&window.document!=e&&window.parent.postMessage!=e&&window.parent.postMessage(t,"*")}catch(e){console.log(e)}}}}(),jQuery,window,document,_vagaroConnect={model:{isChatIframeLoaded:!1,vagaroConnectPath:"",isAdmin:!0,vagaroConnectTextMessagingPlanIframe:"/ShopOwner/VagaroConnectTextMessagingPlanIframe.aspx?isvc=true",IsFrom2WaySMS:!1,IsFromVagaroAiActive:!1,IsFromVagaroToAi:!1,IsVConnectAIEnableBetaRelease:!1,IsClose:!0,IsDormant:!1},controls:{lnkForChat:"#lnkForChat",chatFrame:"#chatFrame",chatWindow:"#chatWindow",vgCalendarPath:"/merchants/calendar",vcChatFrameDiv:"#chatFrame",SetOpenChatStatusToken:"SetVagaroConnectChat",ifrmTextMarketingPlans:"#ifrmVCTextMarketingPlans",connectPermissionDenied:"/Users/PermissionDenied.aspx"},cssClasses:{vcChatFullPage:"ifreamVC",vcChatSmallSize:"ifream-rightSide ifream-smallscreen",vcChatCollapsed:"ifreamVC ifream-rightSide ifream-smallscreen ifream-minimize"},ApiURLEnum:{GetVagaroConnectChat:"GetVagaroConnectChat",SetVagaroConnectChat:"SetVagaroConnectChat"},ChatWindowEnum:{Closed:0,FullSize:1,MidSize:2,Minimize:3},StaticString:{IsBlockBusiness:"IsBlockBusiness",IsShowBellNotification:"IsShowBellNotification",ReviewPlatformData:"ReviewPlatformData",lblFeatureCount:"lblFeatureCount",lblFeatureCountUpdate:"lblFeatureCountUpdate",lblVCNotificationCount:"lblVCNotificationCount",ScreenLockUrl:"/ShopOwner/ScreenLock.aspx",PayProMiniDevice:"PayProMiniDevice",AiBookingLoginRedirect:"vgAiBookingLoginRedirect"},AjaxPostCall:function(e,t,i,a,r,o){var n=new vagaro.ajax;void 0!==o&&null!=o&&0==o?(n.datamodel.Token=e,n.datamodel.IsNewVagaroAPI=o):(n.datamodel.Token=("undefined"!=typeof VagaroCoreApiUrl&&null!=VagaroCoreApiUrl&&""!=VagaroCoreApiUrl?VagaroCoreApiUrl:"")+e,n.datamodel.IsNewVagaroAPI=!0),n.datamodel.data=t,void 0!==r&&null!=r&&(n.datamodel.async=r),n.datamodel.Error=a,n.datamodel.callback=i,n.Post()},CallFailed:function(e){},GetVcOpenStatus:function(e){var t={};t.currentPageUrl=e,_vagaroConnect.AjaxPostCall(_vagaroConnect.ApiURLEnum.GetVagaroConnectChat,t,_vagaroConnect.Success_GetVagaroConnectChat,_vagaroConnect.CallFailed,!1,!1)},Success_GetVagaroConnectChat:function(e){var t=window.location.host+window.location.pathname;if(null!=e){var i=e;null!=i?i.CurrentPageUrl===t&&1==i.Status?(_vagaroConnect.ShowChatFrame(0),window.vcReactStatus=0):2==i.Status?(_vagaroConnect.ShowChatFrame(2),$(_vagaroConnect.controls.chatFrame).addClass("ifream-rightSide"),$(_vagaroConnect.controls.chatFrame).addClass("ifream-smallscreen"),window.vcReactStatus=2):3==i.Status?(_vagaroConnect.ShowChatFrame(3),$(_vagaroConnect.controls.chatFrame).addClass("ifream-rightSide"),$(_vagaroConnect.controls.chatFrame).addClass("ifream-smallscreen"),$(_vagaroConnect.controls.chatFrame).addClass("ifream-minimize"),window.vcReactStatus=3):(_vagaroConnect.ShowChatFrame(0),window.vcReactStatus=0):console.log("Something went wrong. VagaroConnect Chat Open Status")}},SetVcOpenStatus:function(e,t){var i={};i.currentPageUrl=t,i.vcStatus=e,_vagaroConnect.AjaxPostCall(_vagaroConnect.ApiURLEnum.SetVagaroConnectChat,i,_vagaroConnect.Success_SetVcOpenStatus,_vagaroConnect.CallFailed,!1,!1)},Success_SetVcOpenStatus:function(e){console.log("vc app opened session")},ShowChatFrame:function(e,t){if(defaultSize=0,isFromConnectApp=!1,isIOSMobile=!1,isAndroidIOSMobile=!1,QueryStringValue=window.document.URL?window.document.URL:"",window.parent.location.pathname===_vagaroConnect.controls.vgCalendarPath&&(window.top.$("body").css("overflow","hidden"),console.log("calender page")),$(_vagaroConnect.controls.chatFrame).length>0){if(_vagaroConnect.model.isChatIframeLoaded){_vagaroConnect.model.IsClose=!0,window.vcReactStatus&&(defaultSize=1==e?0:e),(QueryStringValue.includes("vagaroconnect?1=1")||QueryStringValue.includes("vagaroconnect?"))&&(isFromConnectApp=!0),window.navigator.userAgent.indexOf("iPhone")>0&&window.navigator.userAgent.indexOf("Mobile")>0&&(defaultSize=1,isIOSMobile=!0),(window.navigator.userAgent.indexOf("iPhone")>0&&window.navigator.userAgent.indexOf("Mobile")>0||window.navigator.userAgent.indexOf("Android")>0&&window.navigator.userAgent.indexOf("Mobile")>0)&&(defaultSize=1,isAndroidIOSMobile=!0);var i=navigator.userAgent,a="",r={iphone:i.match(/(iPhone|iPod)/),blackberry:i.match(/BlackBerry/),kindle:i.match(/Silk/),android:i.match(/Android/),windows:i.match(/Windows/),ipad:i.match(/iPad/),mac:i.match(/Mac/),iosDevice:i.match(/iPhone|iPod|Mac/)};return r.windows&&(a+=" Windows Phone"),r.iphone&&(a+=" iPhone"),r.android&&(a+=" Android"),r.blackberry&&(a+=" Blackberry"),r.ipad&&(a+=" iPad"),r.kindle&&(a+=" kindle"),r.mac&&(a+=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1?" iPad":" Mac"),r.iosDevice&&(a+=" iosDevice"),vConnectReactPayload.Device=a,vConnectReactPayload.defaultSize=defaultSize,vConnectReactPayload.isFromConnectApp=isFromConnectApp,vConnectReactPayload.isIOSMobile=isIOSMobile,vConnectReactPayload.isAndroidIOSMobile=isAndroidIOSMobile,vConnectReactPayload.intialState=e,vConnectReactPayload.isAi=_vagaroConnect.model.IsFromVagaroToAi,vConnectReactPayload.IsVConnectAIEnableBetaRelease=_vagaroConnect.model.IsVConnectAIEnableBetaRelease,vConnectReactPayload.Isdormant&&1==vConnectReactPayload.Isdormant?_vagaroConnect.model.IsDormant=!0:_vagaroConnect.model.IsDormant=!1,_postMessage('{"eventType": "GetIntitalData", "payload" : '+JSON.stringify(vConnectReactPayload)+"}"),_vagaroConnect.SetVcOpenStatus(e,window.location.host+window.location.pathname),$('a[id="lnkForChat"]').addClass("activefirst"),void(parseInt(e)>0&&(t?setTimeout(function(){$(_vagaroConnect.controls.chatFrame).show(),$(_vagaroConnect.controls.chatFrame).addClass("ifreamVC")},100):($(_vagaroConnect.controls.chatFrame).show(),$(_vagaroConnect.controls.chatFrame).addClass("ifreamVC"))))}$(_vagaroConnect.controls.chatWindow).on("load",function(){if(""!=$(this).attr("src")){vConnectReactPayload.isCustomerChat&&$("#chatFrame,#chatWindow").show(),_vagaroConnect.SetVcOpenStatus(e,window.location.host+window.location.pathname),window.vcReactStatus&&(defaultSize=1==window.vcReactStatus?0:window.vcReactStatus),(QueryStringValue.includes("vagaroconnect?1=1")||QueryStringValue.includes("vagaroconnect?"))&&(isFromConnectApp=!0),window.navigator.userAgent.indexOf("iPhone")>0&&window.navigator.userAgent.indexOf("Mobile")>0&&(defaultSize=1,isIOSMobile=!0),(window.navigator.userAgent.indexOf("iPhone")>0&&window.navigator.userAgent.indexOf("Mobile")>0||window.navigator.userAgent.indexOf("Android")>0&&window.navigator.userAgent.indexOf("Mobile")>0)&&(defaultSize=1,isAndroidIOSMobile=!0);var i=navigator.userAgent,a="",r={iphone:i.match(/(iPhone|iPod)/),blackberry:i.match(/BlackBerry/),kindle:i.match(/Silk/),android:i.match(/Android/),windows:i.match(/Windows/),ipad:i.match(/iPad/),mac:i.match(/Mac/),iosDevice:i.match(/iPhone|iPod|Mac/)};r.windows&&(a+=" Windows Phone"),r.iphone&&(a+=" iPhone"),r.android&&(a+=" Android"),r.blackberry&&(a+=" Blackberry"),r.ipad&&(a+=" iPad"),r.kindle&&(a+=" kindle"),r.mac&&(a+=/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1?" iPad":" Mac"),r.iosDevice&&(a+=" iosDevice"),vConnectReactPayload.Device=a,vConnectReactPayload.defaultSize=defaultSize,vConnectReactPayload.isFromConnectApp=isFromConnectApp,vConnectReactPayload.isIOSMobile=isIOSMobile,vConnectReactPayload.isAndroidIOSMobile=isAndroidIOSMobile,vConnectReactPayload.intialState=e,vConnectReactPayload.isAi=_vagaroConnect.model.IsFromVagaroToAi,vConnectReactPayload.IsVConnectAIEnableBetaRelease=_vagaroConnect.model.IsVConnectAIEnableBetaRelease,vConnectReactPayload.Isdormant&&1==vConnectReactPayload.Isdormant?_vagaroConnect.model.IsDormant=!0:_vagaroConnect.model.IsDormant=!1,_postMessage('{"eventType": "GetIntitalData", "payload" : '+JSON.stringify(vConnectReactPayload)+"}"),parseInt(e)>0&&(t?setTimeout(function(){$(_vagaroConnect.controls.chatFrame).show(),$(_vagaroConnect.controls.chatFrame).addClass("ifreamVC")},100):($(_vagaroConnect.controls.chatFrame).show(),$(_vagaroConnect.controls.chatFrame).addClass("ifreamVC")))}})}},Init:function(){if((location.href.toLowerCase().includes("checkout.aspx")||/merchants\/checkout\/?(\?.*)?$/i.test(location.href.toLowerCase()))&&window.self!==window.top)return!1;if(null!=_vagaroConnect.model.vagaroConnectPath&&""!=_vagaroConnect.model.vagaroConnectPath){if(vConnectReactPayload.isCustomerChat?_vagaroConnect.model.isAdmin="False":"undefined"!=typeof isVCAdminUser&&(_vagaroConnect.model.isAdmin=isVCAdminUser),"False"!=_vagaroConnect.model.isAdmin||location.href.toLowerCase().includes("choosebusiness.aspx"))$("#spanChat").hide();else{$(_vagaroConnect.controls.chatFrame).hide();var e=_vagaroConnect.model.vagaroConnectPath+"?v="+Math.random(),t=$(_vagaroConnect.controls.chatWindow);t.attr("src",e),t.on("load",function(){""==$(this).attr("src")?_vagaroConnect.model.isChatIframeLoaded=!1:_vagaroConnect.model.isChatIframeLoaded=!0}),"/shopowner/choosebusiness.aspx"===window.location.pathname.toLowerCase()&&$("#spanChat").hide(),vConnectReactPayload.isCustomerChat||window.parent.location.pathname!=window.location.pathname?vConnectReactPayload.isCustomerChat&&_vagaroConnect.ShowChatFrame(2):_vagaroConnect.GetVcOpenStatus(window.location.host+window.location.pathname)}"undefined"!=typeof hdnIsdormant&&"True"==hdnIsdormant?.value&&(_vagaroConnect.model.IsDormant=!0,_vagaroConnect.OpenDormantUpgrade=window.DisplaySalesPage)}},ShowLoadingPanel:function(e){"undefined"!=typeof ShowLoadingPanel?($(".loader-img").length>0&&$(".loader-img,.loader").css("zIndex","999999999"),ShowLoadingPanel(e)):$(".loaderNew").length>0?e?($(".loaderNew").css("zIndex","999999999"),$(".loaderNew").show()):$(".loaderNew").hide():$(".vagaroconnectloader").length>0?e?$(".vagaroconnectloader").show():$(".vagaroconnectloader").hide():($('<div class="vagaroconnectloader loader" style="display:none;z-index:999999999;"><div class="loader-img" style="z-index:999999999;"></div></div>').appendTo("body"),$(".vagaroconnectloader").show())},OpenCustomerChat:function(e){_postMessage('{"eventType": "OpenCustomerChatCallback", "payload" : '+JSON.stringify(e)+"}"),!1===$(_vagaroConnect.controls.chatFrame).is(":visible")&&(window.vcReactStatus=2,_vagaroConnect.ShowChatFrame(2,!0))},CloseConnectFrame:function(){_postMessage('{"eventType": "CloseConnectFrame", "payload" : ""}')},OpenDormantUpgrade:function(e){return 1!=_vagaroConnect.model.IsDormant||(e.preventDefault(),window.location.href=_vagaroConnect.controls.connectPermissionDenied,!1)}},$(document).ready(function(){if(window.addEventListener("message",vagaroConnectLitener,!1),$(document).on("click",_vagaroConnect.controls.lnkForChat,function(e){!1===$(_vagaroConnect.controls.chatFrame).is(":visible")?(_vagaroConnect.model.IsFromVagaroToAi=!1,ExpandMinimizeButtonClick(!1,0,!0,!1,!0),_vagaroConnect.ShowChatFrame(1)):_postMessage('{"eventType": "ExpandToFullsize", "payload" : "" }')}),window.$("#divVCPromotionTextMarketingPlans").on("hidden.bs.modal",function(){window.$("#divVCPromotionTextMarketingPlans").removeClass("show")}),"true"==localStorage.getItem("openCustomMessage")){localStorage.setItem("openCustomMessage","false");try{let e=setInterval(function(){"undefined"!=typeof vConnectReactPayload&&(clearInterval(e),_siteBuilderDetail.OpenVagaroConnectChat())},150)}catch(t){clearInterval(e)}}if($("#divVCPromotionTextMarketingPlans").on("shown.bs.modal",function(){1==_vagaroConnect.model.IsFrom2WaySMS?setTimeout(function(){window.$("#ifrmVCTextMarketingPlans").contents().find("#textmarketingplanpopup").animate({scrollTop:window.$("#ifrmVCTextMarketingPlans").contents().find("#divActiveSMSForMessenger").position().top},"slow")},100):window.$("#ifrmVCTextMarketingPlans").contents().find("#textmarketingplanpopup").animate({scrollTop:0},"slow"),_vagaroConnect.model.IsFrom2WaySMS=!1}),"undefined"==typeof vConnectReactPayload){var e="";try{e=setInterval(function(){"undefined"!=typeof vConnectReactPayload&&(1==vConnectReactPayload.isOpenCustomerChat&&(_siteBuilderDetail.isVConnectBetaRelease=JSON.parse($("#hdnVConnectBetaRelease").val().toLowerCase()),_siteBuilderDetail.sendMessagetoprovider()),clearInterval(e))},50)}catch(t){clearInterval(e)}}$(window).on("load",function(){const e=new URL(window.location.href);e.searchParams.has("opencustomerchat")&&"true"===e.searchParams.get("opencustomerchat")&&(e.searchParams.delete("opencustomerchat"),window.history.replaceState({},document.title,e.toString()))})}),window.BackToFullSizePage=function(){_vagaroConnect.SetVcOpenStatus(_vagaroConnect.ChatWindowEnum.FullSize,window.top.location.host+window.top.location.pathname)},window.MidSizePage=function(){_vagaroConnect.SetVcOpenStatus(_vagaroConnect.ChatWindowEnum.MidSize,window.top.location.host+window.top.location.pathname)},window.DownButtonCollapsedPage=function(){_vagaroConnect.SetVcOpenStatus(_vagaroConnect.ChatWindowEnum.Minimize,window.top.location.host+window.top.location.pathname)},window.CloseChatButton=function(){_vagaroConnect.SetVcOpenStatus(_vagaroConnect.ChatWindowEnum.Closed,window.top.location.host+window.top.location.pathname)},callSuccess_GetRecommendedFeatureDataByID=function(e,t,i){var a=e;void 0!==a&&null!=a&&void 0!==a.GetRecommendedFeatureData&&null!=a.GetRecommendedFeatureData&&a.GetRecommendedFeatureData.length>0&&0!=a.GetRecommendedFeatureData[0].FeatureID&&(removedCookie("isFromWareHouseAPI"),$("#divbrandedappmodal").modal("hide"),$("#upsellpopup").modal("hide"),$("#divUpsellPopup").empty(),$("#upsellnotification").empty(),$("#ScriptUpsellPopup").tmpl(a.GetRecommendedFeatureData).appendTo("#divUpsellPopup"),$("#divbrandedappmodal").modal("show"),$(".modal-backdrop").hide(),$("#upsellmaybelater").off("click"),$("#getstartedclick").off("click"),$("#upsellcanclebutton").off("click"),$("#upsellmaybelater").click(function(){DismissRecommendedFeature(t)}),$("#getstartedclick").click(function(){OpenUpsellPage(i,null,null,t)}),$("#upsellcanclebutton").click(function(){closeUpsellPopup()}),a.GetRecommendedFeatureData.length>1&&($(".feature-slick-slider").unslick(),$(".feature-slick-slider").slick({slidesToShow:1,slidesToScroll:1,autoplay:!1,autoplaySpeed:5e3,dots:!0})))},CallBroadCastforClosepopup=function(e){var t={},i={};t.isShow="false",t.businessID=vConnectReactPayload.ReactBusinessId,t.loginUserID=vConnectReactPayload.ReactUserID,i.Type=98,i.BusinessID=vConnectReactPayload.ReactBusinessId,i.Data=JSON.stringify(t);var a=new vagaro.ajax;a.datamodel.Token="BroadcastMassage",a.datamodel.data=[i],a.datamodel.async=!0,a.datamodel.callback=function(t){if(void 0!==e){var i=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/merchants/settings/premiumfeature/managesubscription/"+e;location.href=i}},a.datamodel.Error=function(e){console.log(e)},a.Post()},DismissRecommendedFeature=function(e,t,i){var a={};a.supportUpsellID=e,a.featureID="",a.isActive=!1,a.isVagaroDriveActive=!1,a.statusID=0,CallWSJSON("VagaroWebOffline.asmx/UpdateSupportRecommendedStatus",JSON.stringify(a),function(e){var a=e.d;void 0!==a&&null!=a&&1==a&&(void 0!==i?(saveLogInMongo(t,i),$("#divbrandedappmodal").modal("hide"),$(".modal-backdrop").hide(),$("#divUpsellPopup").empty(),AddLogInAmplitudeUpsell(t,i)):closeUpsellPopup())},function(e){})},OpenUpsellPage=function(e,t,i,a){if(void 0!==i&&null!=i){saveLogInMongo(t,i);var r={};r.supportUpsellID=a,r.featureID="",r.isActive=!1,r.isVagaroDriveActive=!1,r.statusID=0,CallWSJSON("VagaroWebOffline.asmx/UpdateSupportRecommendedStatus",JSON.stringify(r),function(e){},function(e){}),AddLogInAmplitudeUpsell(t,i);var o=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/merchants/settings/premiumfeature/managesubscription/"+e;location.href=o}else CallBroadCastforClosepopup(e)},closeUpsellPopup=function(e,t,i){void 0!==i?canclePopupClick(e,t,i):CallBroadCastforClosepopup()},AddRemoveStarredMenuOnTop=function(e){try{if(e.UserId==GetLoggedInUserID()&&e.BusinessID==GetBusinessID()){if("Setting"==e.MenuType&&$("#topSettingMenu").length>0){if($("#topSettingMenu li:gt(0)").remove(),0==e.StarredMenuList.length)$("#topSettingMenu").parent("li").children("a").attr("href","/merchants/settings/book/notification");else for(var t=0;t<e.StarredMenuList.length;t++){var i='<li><a href="'+(a=e.StarredMenuList[t]).URL+'" title = "'+a.MenuTitle+'" value = "" >'+a.MenuTitle+"</a></li>";$("#topSettingMenu").append(i),0==t&&$("#topSettingMenu").parent("li").children("a").attr("href",a.URL)}(r=document.getElementById("ulStarredMenuList"))&&void 0!==e.UlStarredMenuList&&(r.innerHTML=e.UlStarredMenuList)}else if("Report"==e.MenuType&&$("#topReportsMenu").length>0){if($("#topReportsMenu li:gt(0)").remove(),0==e.StarredMenuList.length)$("#topReportsMenu").parent("li").children("a").attr("href","/merchants/reports/sales/salessummary");else for(t=0;t<e.StarredMenuList.length;t++){var a;i='<li><a href="'+(a=e.StarredMenuList[t]).URL+'" title = "'+a.MenuTitle+'" value = "" target="_self">'+a.MenuTitle+"</a></li>";$("#topReportsMenu").append(i),0==t&&$("#topReportsMenu").parent("li").children("a").attr("href",a.URL).attr("target","_self")}var r;(r=document.getElementById("navbarToggleExternalContent_Starred basic-navbar-nav_Starred"))&&void 0!==e.UlStarredMenuList&&(r.innerHTML="",r.innerHTML=e.UlStarredMenuList)}SetSessionTopMenu(e)}}catch(e){console.log(e)}},SendBroadCastMenuData=function(e,t,i){var a={};a.BusinessID=GetBusinessID(),a.UserId=GetLoggedInUserID(),a.StarredMenuList=[],a.MenuType=e,a.UlStarredMenuList=i,$(t).each(function(){var t={};t.MenuTitle=$(this).find("a").html().split("<span")[0].trim(),t.URL=$(this).find("a").attr("href"),t.MenuType=e,a.StarredMenuList.push(t)}),BroadcastStarredMenu(a)},BroadcastStarredMenu=function(e){var t={Type:111};t.BusinessID=GetBusinessID(),t.Data=JSON.stringify(e);var i=new vagaro.ajax;i.datamodel.Token="BroadcastMassage",i.datamodel.data=[t],i.datamodel.async=!1,i.datamodel.callback=callSuccess_BroadcastData,i.datamodel.Error=callFailed_BroadcastData,i.Post()},callSuccess_BroadcastData=function(){},callFailed_BroadcastData=function(){},SetSessionTopMenu=function(e){var t=new vagaro.ajax;t.datamodel.Token="SetSessionTopMenu",t.datamodel.data=[e],t.datamodel.async=!1,t.datamodel.callback=callSuccess_SetSessionTopMenu,t.datamodel.Error=callFailed_SetSessionTopMenua,t.Post()},callSuccess_SetSessionTopMenu=function(e){console.log(e)},callFailed_SetSessionTopMenua=function(e){console.log(e)},GetLoggedInUserID=function(){return"undefined"!=typeof SecuUserID&&null!=SecuUserID&&""!=SecuUserID&&"0"!=SecuUserID?1*SecuUserID:"undefined"!=typeof ReactUserID&&null!=ReactUserID&&""!=ReactUserID&&"0"!=ReactUserID?1*ReactUserID:0},GetBusinessID=function(){return"undefined"!=typeof SecuBusinessID&&null!=SecuBusinessID&&""!=SecuBusinessID&&"0"!=SecuBusinessID?1*SecuBusinessID:"undefined"!=typeof ReactBusinessId&&null!=ReactBusinessId&&""!=ReactBusinessId&&"0"!=ReactBusinessId?1*ReactBusinessId:0},String.isNullOrUndefineOrBlank=function(e){return void 0===e||null==e||""==e||null==e},function(e){"use strict";var t=15e3,i=100,a="calendar",r={active:!1,context:null,_surfaceLoadTriggered:!1};function o(e,t){return null==e?void 0===t?"":t:String(e)}function n(t,i){if(e._aiBookingDebug)try{console.log("[_aiBooking]",t,i||"")}catch(e){}}var s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function l(e,t){var i=o(e),a=o(t),r=i.split("-");if(3===r.length){var l=parseInt(r[0],10),d=parseInt(r[1],10),c=parseInt(r[2],10);if(!isNaN(c)&&!isNaN(d)&&!isNaN(l)&&d>=1&&d<=12)return(c<10?"0":"")+c+" "+s[d-1]+" "+l+" "+a}return n("buildAppDateTime: unexpected startDate format '"+i+"'"),(i+" "+a).replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}var d={};function c(e){var t={},i=[];function a(e,a,r){if(function(e){return null!=e&&""!==e&&!/^\d+$/.test(String(e))}(e)){var o=String(e);t[o]||(t[o]=!0,i.push({id:o,type:a,dynamicSalt:!!r}))}}var r=e.provider||{},o=e.service||{},n=e.promotion||null;a(r.id,1),a(r.calendarId,0),a(o.serviceId,0),n&&a(n.dealId,0),e.appointmentId&&a(e.appointmentId,0);for(var s=e.currentAddOns||[],l=0;l<s.length;l++)s[l]&&(a(s[l].serviceId,0),a(s[l].appointmentId,0));for(var d=[{arr:e.attendees,prop:"customerId",type:1},{arr:e.addOns,prop:"serviceId",type:0},{arr:e.memberships,prop:"itemId",type:0},{arr:e.packages,prop:"itemId",type:0}],c=0;c<d.length;c++)for(var u=d[c].arr||[],p=0;p<u.length;p++)u[p]&&a(u[p][d[c].prop],d[c].type,d[c].dyn);return i}function u(e){var t=o(e);return""!==t&&Object.prototype.hasOwnProperty.call(d,t)?d[t]:t}function p(){return"function"==typeof e.OnBookClick&&"function"==typeof e.CheckUserLoggedIn&&void 0!==e._shopdetail&&null!==e._shopdetail&&function(){try{return $("[id$='hdnStyleID']").length>0}catch(e){return!1}}()&&void 0!==e.objVPLData&&null!==e.objVPLData&&void 0!==e.OnlindBookingResponse&&null!==e.OnlindBookingResponse}function h(t,i){var a=t.provider||{},r=t.schedule||{},n=t.service||{},s=t.promotion||null,d=function(e){if(!e)return null;return e.customerFilters||e.customerFilter||null}(s),c=!!s&&function(t){if(!t||!t.length)return!0;var i=t.map(String),a=void 0!==e.IsForNewCustomer&&!0===e.IsForNewCustomer;if(i.indexOf("2")>=0&&a)return!0;if(i.indexOf("1")>=0&&!a)return!0;return!1}(d),p=c?i:s?o(s.originalPrice,i):i;return{AppDateTime:l(r.startDate,r.startTime),CalID:u(a.calendarId),SPID:u(a.id),SPName:o(a.name),StartTime:o(r.startTime),Duration:o(n.duration),Price:p,PointRedeem:F(t,"pointRedeem"),PointGiven:F(t,"pointGiven"),serviceid:u(n.serviceId),servicename:o(n.serviceName),IsShowPriceOnline:!1===n.isShowPriceOnline?"false":"true",PromotionId:c&&null!=s.dealId?u(s.dealId):"0",IsForNewCustomers:c&&D(d)?"true":"false",ServiceOrginalPrice:s?o(s.originalPrice,i):i,ServiceProviderPhoto:"",IsServicePerformAtSameTime:"false",IsShowPriceAsStartingPoint:"false",CleanupTime:F(t,"cleanupTime"),IsDisplayBadge:"",popupSPNames:"",PreOutCallTime:x(t,"preOutCallTime"),PostOutCallTime:x(t,"postOutCallTime"),CustomerTime:o(r.startTime),CustomerTimezone:void 0}}function m(t,i,a){if(void 0!==e.SelectedAddonService&&null!==e.SelectedAddonService){if(e.SelectedAddonService=[],t&&t.length){for(var r=u(i),o=u(a),s=function(t,i){try{var a=e._shopdetail;if(!a||"function"!=typeof a.GetAddonsServiceDetailbyId)return null;"function"==typeof a.BindAddonDataByBusinessId&&a.BindAddonDataByBusinessId();var r=e.OnlindBookingResponse&&e.OnlindBookingResponse.lstAddonService;return r&&r.length?function(e){try{var r=a.GetAddonsServiceDetailbyId(t,e,i);return!(!r||!r.length)}catch(e){return n("add-on validation lookup failed; keeping add-on",e),!0}}:(n("add-on list unavailable; seeding unvalidated"),null)}catch(e){return n("add-on validation unavailable; seeding unvalidated",e),null}}(r,o),l=[],d=0;d<t.length;d++)if(t[d]&&null!==t[d].serviceId&&void 0!==t[d].serviceId){var c=u(t[d].serviceId);if(s&&!s(c)){n("add-on dropped — not bookable for this service/provider (id "+c+")");continue}l.push({ServiceId:c})}l.length&&e.SelectedAddonService.push({MainServiceID:r,SrNo:1,ServiceProviderId:parseInt(o,10)||0,lstAddonService:l})}}else n("SelectedAddonService global not available; add-ons skipped")}function f(t,i){if(void 0!==e.hdnCommandArgArray&&null!==e.hdnCommandArgArray){var a="";t&&t.length&&t[0]&&null!==t[0].itemId&&void 0!==t[0].itemId&&(a=u(t[0].itemId));var r=[];if(i&&i.length)for(var o=0;o<i.length;o++)i[o]&&null!==i[o].itemId&&void 0!==i[o].itemId&&r.push(u(i[o].itemId));""===a&&0===r.length||(""!==a&&(e.hdnCommandArgArray.SelectedMembership=a),r.length>0&&(e.hdnCommandArgArray.SelectedPackages=r),e.hdnCommandArgArray.IsSelectedFromPopUp=!0)}else n("hdnCommandArgArray not available; membership/package skipped")}r.handleBookMessage=function(a){var s;try{s="string"==typeof a?JSON.parse(a):a}catch(e){return void n("handleBookMessage: could not parse Data",e)}var l=s&&s.bookingType;!s||"appointment"!==l&&"reschedule"!==l||(r._surfaceLoadTriggered=!1,function(a){if(p())return void a(!0);!function(){if(r._surfaceLoadTriggered)return;if(void 0===e._common||null===e._common||"function"!=typeof e._common.LoadBookNowMenu||void 0===e.LoadMenuTypeEnum)return void n("cannot auto-load Book Now surface: _common.LoadBookNowMenu unavailable");r._surfaceLoadTriggered=!0,n("booking surface not rendered; loading Book Now tab");try{e._common.LoadBookNowMenu(e.LoadMenuTypeEnum.booknow,!1)}catch(e){n("LoadBookNowMenu failed",e)}}();var o=0,s=e.setInterval(function(){p()?(e.clearInterval(s),a(!0)):(o+=i)>=t&&(e.clearInterval(s),n("readiness timed out after 15000ms"),a(!1))},i)}(function(t){t?function(t,i){d={};var a=c(t);if(a.length){if(void 0===e.vagaro||"function"!=typeof e.vagaro.ajax)return n("vagaro.ajax unavailable; cannot resolve encrypted ids"),void A(t,"ID resolution unavailable.");var r=new e.vagaro.ajax;r.datamodel.Token="websiteapi/homepage/getconnectbookingids",r.datamodel.IsNewVagaroAPI=!0,r.datamodel.data={items:a},r.datamodel.callback=function(e){try{if("string"==typeof e&&(e=JSON.parse(e)),!e||!e.length)return void A(t,"ID resolution returned no data.");for(var r=0;r<a.length&&r<e.length;r++){var o=e[r]&&void 0!==e[r].id?e[r].id:null;if(null===o||""===o)return void A(t,"ID resolution failed for one or more ids.");d[a[r].id]=String(o)}i()}catch(e){n("resolve response handling failed",e),A(t,"ID resolution error.")}},r.datamodel.Error=function(e){n("resolve request failed",e),A(t,"ID resolution request failed.")},r.Post()}else i()}(s,function(){try{"reschedule"===l?function(t){var i=t.service||{},a=t.provider||{},s=o(B(t),"0.00");k(),M(),r.context=t,r.active=!0,function(t){try{e.IsRescheduleAppointment="true",e.isFromReschedual="true",e.lAppID=o(u(t.appointmentId)),e.lAppUserID=function(){if(void 0!==e.UserID&&null!==e.UserID&&""!==e.UserID){var t=parseInt(e.UserID,10);if(!isNaN(t)&&t>0)return t}try{var i=parseInt($("#hdnLoggedInUserid").val(),10);return!isNaN(i)&&i>0?i:0}catch(e){return 0}}(),O(!0===t.isPaid),S=!0,n("reschedule state set (lAppID="+e.lAppID+", isPaid="+(!0===t.isPaid)+")")}catch(e){n("seedRescheduleState failed",e)}}(t),function(t){for(var i=t&&t.currentAddOns||[],a=parseInt(u((t.service||{}).serviceId),10)||0,r=parseInt(u((t.provider||{}).id),10)||0,s=[],l=0;l<i.length;l++){var d=i[l];d&&null!=d.serviceId&&null!=d.appointmentId&&s.push({EventServiceID:a,ServiceId:parseInt(u(d.serviceId),10)||0,ServiceProviderID:r,AppointmentID:parseInt(u(d.appointmentId),10)||0,ServiceTitle:o(d.serviceName,""),Status:12})}e.ReschedualAddonService=s,n("reschedule addon baseline set ("+s.length+" existing add-on(s))")}(t),m(t.addOns,i.serviceId,a.id),w(t);var l=h(t,s);P(t,l),b=!0;try{e.OnBookClick(l.AppDateTime,l.CalID,l.SPID,l.SPName,l.StartTime,l.Duration,l.Price,l.PointRedeem,l.PointGiven,l.serviceid,l.servicename,l.IsShowPriceOnline,l.PromotionId,l.IsForNewCustomers,l.ServiceOrginalPrice,l.ServiceProviderPhoto,l.IsServicePerformAtSameTime,l.IsShowPriceAsStartingPoint,l.CleanupTime,l.IsDisplayBadge,l.popupSPNames,l.PreOutCallTime,l.PostOutCallTime,l.CustomerTime,l.CustomerTimezone)}finally{b=!1}f(t.memberships,t.packages),y()}(s):function(t){var i=t.service||{},a=t.provider||{},s=o(B(t),"0.00");if(k(),M(),r.context=t,r.active=!0,function(t){try{var i=e._shopdetail;if(!i||!0!==i.IsLimitOnlineBooking)return!1;var a=u((t&&t.provider||{}).id);return""!==a&&null!=a&&("function"==typeof i.LoadEmpNotAcceptingNewClients&&i.LoadEmpNotAcceptingNewClients(),"function"==typeof i.LoadUserAndFnFNewOrExistingForBusinessEmployees&&i.LoadUserAndFnFNewOrExistingForBusinessEmployees(),"function"==typeof i.DisplayEmpNotAccptNewClientsBadge&&!0===i.DisplayEmpNotAccptNewClientsBadge(a))}catch(e){return n("new-customer online-booking gate check failed; allowing booking",e),!1}}(t))return r.active=!1,r.context=null,void function(t){var i=o((t&&t.provider||{}).name)||"This provider",a="Sorry, "+i+" is not accepting new customers",r=i+" is not accepting new customer booking, but let's try another provider by choosing one or more above.";try{if("function"==typeof e.book24afterload)return e.book24afterload(JSON.parse('{"d":[]}'),!0,a,r),!0}catch(e){n("could not render new-customer-blocked screen",e)}}(t);m(t.addOns,i.serviceId,a.id),w(t);var l=h(t,s);P(t,l),b=!0;try{e.OnBookClick(l.AppDateTime,l.CalID,l.SPID,l.SPName,l.StartTime,l.Duration,l.Price,l.PointRedeem,l.PointGiven,l.serviceid,l.servicename,l.IsShowPriceOnline,l.PromotionId,l.IsForNewCustomers,l.ServiceOrginalPrice,l.ServiceProviderPhoto,l.IsServicePerformAtSameTime,l.IsShowPriceAsStartingPoint,l.CleanupTime,l.IsDisplayBadge,l.popupSPNames,l.PreOutCallTime,l.PostOutCallTime,l.CustomerTime,l.CustomerTimezone)}finally{b=!1}f(t.memberships,t.packages),y()}(s)}catch(e){n("start booking failed ("+l+")",e),A(s,e&&e.message||"Booking failed.")}}):A(s,"Booking surface not ready.")}))};var g=["AppointmentId","EventType","UserID","BusinessID","RuleID","AppType","AppRecurrenceRuleID","ServiceID","Amount","Status","AppConfirmUniqueID"];function v(e){if(!e||"object"!=typeof e)return null;var t=[],i=e.lstAppResult;if(i&&i.length)for(var a=0;a<i.length;a++){for(var r=i[a]||{},o={},n=0;n<g.length;n++){var s=g[n];o[s]=void 0!==r[s]?r[s]:null}t.push(o)}return{errMsg:void 0!==e.errMsg?e.errMsg:"",data:t}}function A(e,t){r.active=!1,r.context=null;try{C({bookingType:"appointment",success:!1,reason:t||"Booking failed.",service:e&&e.service||null})}catch(e){n("notifyFailure failed",e)}}function C(t){var i=JSON.stringify({eventType:"BOOKING_COMPLETED",Data:{type:"booking_response",properties:t||{}}});"function"==typeof e._postMessage?e._postMessage(i):n("_postMessage bus unavailable; message dropped: BOOKING_COMPLETED")}function y(){try{var t=e.navigator&&e.navigator.userAgent||"",i=t.indexOf("iPhone")>0&&t.indexOf("Mobile")>0||t.indexOf("Android")>0&&t.indexOf("Mobile")>0,a=void 0!==e.vgAppicationType&&void 0!==e.objApplicationType&&e.vgAppicationType==e.objApplicationType.CustomerApp;if(!i&&!a)return void n("closeWidgetForCheckout skipped (not a mobile browser or Customer app)");var r="function"==typeof e.jQuery?e.jQuery:"function"==typeof e.$?e.$:null;if(r&&r("#chatFrame").length)r("#chatFrame").hide(),n("hiding Connect widget for checkout (iframe kept alive for callback)");else{var o=document.getElementById("chatFrame");o?(o.style.display="none",n("hiding Connect widget for checkout (vanilla; iframe kept alive)")):n("#chatFrame not found; nothing to hide")}}catch(e){n("closeWidgetForCheckout failed",e)}}r.sendBookingCompleted=function(e,t){try{var i=r.context||{};C({bookingType:o(i.bookingType,"appointment"),success:!0,service:i.service||null,provider:i.provider||null,schedule:i.schedule||null,confirmation:v(e)})}catch(e){n("sendBookingCompleted failed",e)}finally{r.active=!1,r.context=null,M()}};var b=!1,S=!1;function k(){if(!r._guardInstalled&&"function"==typeof e.OnBookClick){var t=e.OnBookClick;e.OnBookClick=function(){return b||(r.active&&(n("manual OnBookClick detected; clearing stale AI booking flag"),r.active=!1,r.context=null),M()),t.apply(this,arguments)},r._guardInstalled=!0}}function D(e){if(!e||!e.length)return!1;var t=e.map(String);return t.indexOf("2")>=0&&t.indexOf("1")<0}function _(e){var t=e&&e.service||{},i=null;null!==t.outcallType&&void 0!==t.outcallType?i=t.outcallType:e&&null!==e.outcallType&&void 0!==e.outcallType?i=e.outcallType:e&&e.serviceLocation&&null!=e.serviceLocation.type&&(i=e.serviceLocation.type);var a=o(i).toLowerCase();return"1"===a||"business"===a||"at business"===a?1:"2"===a||"customer"===a||"my location"===a?2:"3"===a||"different"===a||"different location"===a?3:0}function I(e){var t=_(e);return function(e){if(!e)return!1;var t=e.service||{};return!0===e.isHouseCall||!0===e.isOutCall||!0===t.isHouseCall||!0===t.isOutCallService||!0===t.isHouseCallService}(e)||1===t||2===t||3===t}function w(t){var i=_(t);if(!I(t))return e.IsOutCallServiceSelected=!1,void(e.IsOutCallService=!1);e.IsOutCallServiceSelected=!0,e.IsOutCallService=!0;var a=2===i?2:1;try{var r=$("#hdnOutcallType");r.length&&r.val(a)}catch(e){n("could not set hdnOutcallType",e)}e.serviceType=a;try{"function"==typeof e.GetBusinessAddressDetails&&e.GetBusinessAddressDetails()}catch(e){n("could not populate business address",e)}n("house-call service; outcall gate set (callType="+i+", hdnOutcallType="+a+")")}function P(t,i){if(I(t))try{var a=parseInt(i.SPID,10),r=parseInt(i.serviceid,10);if(!(a>0&&r>0))return;void 0!==e.ServiceHouseCallPrice&&null!==e.ServiceHouseCallPrice||(e.ServiceHouseCallPrice={});var o=parseFloat(i.ServiceOrginalPrice);if(isNaN(o))return;var s=a+"_"+r;e.ServiceHouseCallPrice[s]=o+T(),n("house-call price guard seeded ("+s+"="+e.ServiceHouseCallPrice[s]+", base="+o+")")}catch(e){n("could not seed house-call price guard",e)}}function T(){try{var t=e._shopdetail;if(t&&null!==t.OutCallPrice&&void 0!==t.OutCallPrice&&""!==t.OutCallPrice){var i=parseFloat(t.OutCallPrice);if(!isNaN(i))return i}var a=parseFloat($("#hdnOutCallPrice").val());if(!isNaN(a))return a}catch(e){n("could not read outcall fee",e)}return 0}function B(e){var t=e&&null!==e.price&&void 0!==e.price?e.price:"0.00";try{if(I(e)&&2===_(e)){var i=parseFloat(t),a=T();if(!isNaN(i)&&!isNaN(a)&&a>0)return i-a}}catch(e){n("could not derive house-call base price",e)}return t}function x(e,t){var i=e&&e.service||{},a=null!==i[t]&&void 0!==i[t]?i[t]:e&&e.serviceLocation&&null!=e.serviceLocation[t]?e.serviceLocation[t]:null,r=parseInt(a,10);return!isNaN(r)&&r>0?String(r):"0"}function F(e,t){var i=e&&e.service||{},a=parseInt(i[t],10);return!isNaN(a)&&a>0?String(a):"0"}function O(t){try{t?(e.IsPaid="true",document.cookie="IsPaid=True; path=/"):(e.IsPaid="False",document.cookie="IsPaid=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}catch(e){n("could not set IsPaid signal",e)}}function M(){if(S){try{e.lAppID="",e.lAppUserID=0,e.gblReScheduleAppID=0,e.IsRescheduleAppointment="false",e.isFromReschedual="false",O(!1),e.ReschedualAddonService=[]}catch(e){n("resetRescheduleState failed",e)}S=!1}}function E(){try{for(var t=document.cookie?document.cookie.split("; "):[],i=0;i<t.length;i++){var a=t[i].indexOf("=");if(a>0&&"s_utkn"===t[i].substring(0,a))return decodeURIComponent(t[i].substring(a+1))}}catch(e){}try{return e.localStorage&&e.localStorage.getItem("s_utkn")||""}catch(e){return""}}function N(t){try{var i=e._vagaroConnect.StaticString.AiBookingLoginRedirect;if(e.sessionStorage.getItem(i)===t)return void n("already sent to login for this booking session; not redirecting again");e.sessionStorage.setItem(i,t)}catch(e){}var a=e.location.pathname+e.location.search;e.location.href="/login?ReturnUrl="+encodeURIComponent(a)}r.loadBookingFromSession=function(){var t=new URLSearchParams(e.location.search).get("id")||"";if(/^[0-9a-f]{32}$/i.test(t))if(""!==E()){var i=function(t){var i=void 0!==e.vConnectReactPayload&&e.vConnectReactPayload||{},a=o(i.VagaroCoreAPIURLV3),r=o(i.encStaticMerchantid);return""===a||""===r?"":a+"business/"+r+"/customers/cart/"+t}(t);""!==i?function(e,t,i){$.ajax({url:e,type:"GET",dataType:"json",headers:{accept:"application/json",s_utkn:t,"x-service-type":a}}).done(function(e){var t=e&&200===e.status&&e.data&&e.data.length?e.data:null;t&&t[0]?(t.length>1&&n("booking session has "+t.length+" items; only the first is booked (single-service flow)"),r.handleBookMessage(t[0])):n("booking session not found or expired")}).fail(function(e){if(e&&401===e.status&&"function"==typeof i)return n("booking session: s_utkn rejected; sending the customer to login"),void i();n("booking session request failed",e&&e.status)})}(i,E(),function(){N(t)}):n("booking session skipped: core API url / business id unavailable")}else N(t)},e._aiBooking=r}(window);var VagaroCountryDateFormat=Object.freeze({SmallDate:1,SmallDateWithTime:2,LargeDate:3,LargeDateWithTime:4,MiniDate:5,LongMiniDate:6,ChartDate:7});function countryDateFormat(e,t,i){try{if("undefined"==e||null==e||""==e||"---"==e||"--"==e)return e;void 0!==i&&null!=i&&""!=i||(i=GetBusinessCountry()),2!=i&&(i=1);var a=_countryDateFormat.find(function(e){return e.countryId===parseInt(i)&&e.dateFormatId===t});return null!=a&&""!=a&&a&&""!==a.dateFormat.trim()?"Invalid date"==moment(e).format(a.jsDateFormat)?e:moment(e).format(a.jsDateFormat):e.format("MMM dd, yyyy")}catch(t){console.error(t);try{return e.format("MMM dd, yyyy")}catch(t){return e}}}function DatePickerFormat(e){let t=GetBusinessCountry();return 2!=t&&(t=1),_countryDateFormat.find(function(i){return i.countryId==t&&i.dateFormatId===e}).jsDateFormat}function GetBusinessCountry(){return"undefined"!=typeof bCountryID&&null!=bCountryID&&"0"!=bCountryID&&"0"!=bCountryID?bCountryID:"undefined"!=typeof glbBusinessCountryId&&null!=glbBusinessCountryId&&""!=glbBusinessCountryId&&"0"!=glbBusinessCountryId?glbBusinessCountryId:"undefined"!=typeof _businessCountryId&&null!=_businessCountryId&&""!=_businessCountryId&&"0"!=_businessCountryId?_businessCountryId:"undefined"!=typeof BusinessCountryID&&null!=BusinessCountryID&&"0"!=BusinessCountryID&&"0"!=BusinessCountryID?BusinessCountryID:"undefined"!=typeof countryIdBusDetail&&null!=countryIdBusDetail&&"0"!=countryIdBusDetail&&"0"!=countryIdBusDetail?countryIdBusDetail:void 0!==countryid&&null!=countryid&&"0"!=countryid&&"0"!=countryid?countryid:1}!function e(t,i,a){function r(n,s){if(!i[n]){if(!t[n]){var l="function"==typeof require&&require;if(!s&&l)return l(n,!0);if(o)return o(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return r(i||e)},c,c.exports,e,t,i,a)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<a.length;n++)r(a[n]);return r}({1:[function(e,t,i){"use strict";var a=e("../main");"function"==typeof define&&define.amd?define(a):(window.PerfectScrollbar=a,void 0===window.Ps&&(window.Ps=a))},{"../main":6}],2:[function(e,t,i){"use strict";var a={};a.create=function(e,t){var i=document.createElement(e);return i.className=t,i},a.appendTo=function(e,t){return t.appendChild(e),e},a.css=function(e,t,i){return"object"==typeof t?function(e,t){for(var i in t){var a=t[i];"number"==typeof a&&(a=a.toString()+"px"),e.style[i]=a}return e}(e,t):void 0===i?function(e,t){try{return window.getComputedStyle(e)[t]}catch(e){return""}}(e,t):function(e,t,i){return"number"==typeof i&&(i=i.toString()+"px"),e.style[t]=i,e}(e,t,i)},a.matches=function(e,t){return void 0!==e.matches?e.matches(t):e.msMatchesSelector(t)},a.remove=function(e){void 0!==e.remove?e.remove():e.parentNode&&e.parentNode.removeChild(e)},a.queryChildren=function(e,t){return Array.prototype.filter.call(e.childNodes,function(e){return a.matches(e,t)})},t.exports=a},{}],3:[function(e,t,i){"use strict";var a=function(e){this.element=e,this.events={}};a.prototype.bind=function(e,t){void 0===this.events[e]&&(this.events[e]=[]),this.events[e].push(t),this.element.addEventListener(e,t,!1)},a.prototype.unbind=function(e,t){var i=void 0!==t;this.events[e]=this.events[e].filter(function(a){return!(!i||a===t)||(this.element.removeEventListener(e,a,!1),!1)},this)},a.prototype.unbindAll=function(){for(var e in this.events)this.unbind(e)};var r=function(){this.eventElements=[]};r.prototype.eventElement=function(e){var t=this.eventElements.filter(function(t){return t.element===e})[0];return void 0===t&&(t=new a(e),this.eventElements.push(t)),t},r.prototype.bind=function(e,t,i){this.eventElement(e).bind(t,i)},r.prototype.unbind=function(e,t,i){this.eventElement(e).unbind(t,i)},r.prototype.unbindAll=function(){for(var e=0;e<this.eventElements.length;e++)this.eventElements[e].unbindAll()},r.prototype.once=function(e,t,i){var a=this.eventElement(e),r=function(e){a.unbind(t,r),i(e)};a.bind(t,r)},t.exports=r},{}],4:[function(e,t,i){"use strict";t.exports=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}}()},{}],5:[function(e,t,i){"use strict";var a=e("./dom"),r=i.toInt=function(e){return parseInt(e,10)||0};function o(e){return["ps--in-scrolling"].concat(void 0===e?["ps--x","ps--y"]:["ps--"+e])}i.isEditable=function(e){return a.matches(e,"input,[contenteditable]")||a.matches(e,"select,[contenteditable]")||a.matches(e,"textarea,[contenteditable]")||a.matches(e,"button,[contenteditable]")},i.removePsClasses=function(e){for(var t=0;t<e.classList.length;t++){var i=e.classList[t];0===i.indexOf("ps-")&&e.classList.remove(i)}},i.outerWidth=function(e){return r(a.css(e,"width"))+r(a.css(e,"paddingLeft"))+r(a.css(e,"paddingRight"))+r(a.css(e,"borderLeftWidth"))+r(a.css(e,"borderRightWidth"))},i.startScrolling=function(e,t){for(var i=o(t),a=0;a<i.length;a++)e.classList.add(i[a])},i.stopScrolling=function(e,t){for(var i=o(t),a=0;a<i.length;a++)e.classList.remove(i[a])},i.env={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),supportsIePointer:"undefined"!=typeof window&&null!==window.navigator.msMaxTouchPoints}},{"./dom":2}],6:[function(e,t,i){"use strict";var a=e("./plugin/destroy"),r=e("./plugin/initialize"),o=e("./plugin/update");t.exports={initialize:r,update:o,destroy:a}},{"./plugin/destroy":8,"./plugin/initialize":16,"./plugin/update":20}],7:[function(e,t,i){"use strict";t.exports=function(){return{handlers:["click-rail","drag-scrollbar","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipePropagation:!0,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!1,wheelSpeed:1,theme:"default"}}},{}],8:[function(e,t,i){"use strict";var a=e("../lib/helper"),r=e("../lib/dom"),o=e("./instances");t.exports=function(e){var t=o.get(e);t&&(t.event.unbindAll(),r.remove(t.scrollbarX),r.remove(t.scrollbarY),r.remove(t.scrollbarXRail),r.remove(t.scrollbarYRail),a.removePsClasses(e),o.remove(e))}},{"../lib/dom":2,"../lib/helper":5,"./instances":17}],9:[function(e,t,i){"use strict";var a=e("../instances"),r=e("../update-geometry"),o=e("../update-scroll");t.exports=function(e){!function(e,t){function i(e){return e.getBoundingClientRect()}var a=function(e){e.stopPropagation()};t.event.bind(t.scrollbarY,"click",a),t.event.bind(t.scrollbarYRail,"click",function(a){var n=a.pageY-window.pageYOffset-i(t.scrollbarYRail).top>t.scrollbarYTop?1:-1;o(e,"top",e.scrollTop+n*t.containerHeight),r(e),a.stopPropagation()}),t.event.bind(t.scrollbarX,"click",a),t.event.bind(t.scrollbarXRail,"click",function(a){var n=a.pageX-window.pageXOffset-i(t.scrollbarXRail).left>t.scrollbarXLeft?1:-1;o(e,"left",e.scrollLeft+n*t.containerWidth),r(e),a.stopPropagation()})}(e,a.get(e))}},{"../instances":17,"../update-geometry":18,"../update-scroll":19}],10:[function(e,t,i){"use strict";var a=e("../../lib/helper"),r=e("../../lib/dom"),o=e("../instances"),n=e("../update-geometry"),s=e("../update-scroll");function l(e,t){var i=null,o=null;var l=function(r){!function(r){var o=i+r*t.railXRatio,n=Math.max(0,t.scrollbarXRail.getBoundingClientRect().left)+t.railXRatio*(t.railXWidth-t.scrollbarXWidth);t.scrollbarXLeft=o<0?0:o>n?n:o;var l=a.toInt(t.scrollbarXLeft*(t.contentWidth-t.containerWidth)/(t.containerWidth-t.railXRatio*t.scrollbarXWidth))-t.negativeScrollAdjustment;s(e,"left",l)}(r.pageX-o),n(e),r.stopPropagation(),r.preventDefault()},d=function(){a.stopScrolling(e,"x"),t.event.unbind(t.ownerDocument,"mousemove",l)};t.event.bind(t.scrollbarX,"mousedown",function(n){o=n.pageX,i=a.toInt(r.css(t.scrollbarX,"left"))*t.railXRatio,a.startScrolling(e,"x"),t.event.bind(t.ownerDocument,"mousemove",l),t.event.once(t.ownerDocument,"mouseup",d),n.stopPropagation(),n.preventDefault()})}function d(e,t){var i=null,o=null;var l=function(r){!function(r){var o=i+r*t.railYRatio,n=Math.max(0,t.scrollbarYRail.getBoundingClientRect().top)+t.railYRatio*(t.railYHeight-t.scrollbarYHeight);t.scrollbarYTop=o<0?0:o>n?n:o;var l=a.toInt(t.scrollbarYTop*(t.contentHeight-t.containerHeight)/(t.containerHeight-t.railYRatio*t.scrollbarYHeight));s(e,"top",l)}(r.pageY-o),n(e),r.stopPropagation(),r.preventDefault()},d=function(){a.stopScrolling(e,"y"),t.event.unbind(t.ownerDocument,"mousemove",l)};t.event.bind(t.scrollbarY,"mousedown",function(n){o=n.pageY,i=a.toInt(r.css(t.scrollbarY,"top"))*t.railYRatio,a.startScrolling(e,"y"),t.event.bind(t.ownerDocument,"mousemove",l),t.event.once(t.ownerDocument,"mouseup",d),n.stopPropagation(),n.preventDefault()})}t.exports=function(e){var t=o.get(e);l(e,t),d(e,t)}},{"../../lib/dom":2,"../../lib/helper":5,"../instances":17,"../update-geometry":18,"../update-scroll":19}],11:[function(e,t,i){"use strict";var a=e("../../lib/helper"),r=e("../../lib/dom"),o=e("../instances"),n=e("../update-geometry"),s=e("../update-scroll");function l(e,t){var i=!1;t.event.bind(e,"mouseenter",function(){i=!0}),t.event.bind(e,"mouseleave",function(){i=!1});var o=!1;t.event.bind(t.ownerDocument,"keydown",function(l){if(!(l.isDefaultPrevented&&l.isDefaultPrevented()||l.defaultPrevented)){var d=r.matches(t.scrollbarX,":focus")||r.matches(t.scrollbarY,":focus");if(i||d){var c=document.activeElement?document.activeElement:t.ownerDocument.activeElement;if(c){if("IFRAME"===c.tagName)c=c.contentDocument.activeElement;else for(;c.shadowRoot;)c=c.shadowRoot.activeElement;if(a.isEditable(c))return}var u=0,p=0;switch(l.which){case 37:u=l.metaKey?-t.contentWidth:l.altKey?-t.containerWidth:-30;break;case 38:p=l.metaKey?t.contentHeight:l.altKey?t.containerHeight:30;break;case 39:u=l.metaKey?t.contentWidth:l.altKey?t.containerWidth:30;break;case 40:p=l.metaKey?-t.contentHeight:l.altKey?-t.containerHeight:-30;break;case 33:p=90;break;case 32:p=l.shiftKey?90:-90;break;case 34:p=-90;break;case 35:p=l.ctrlKey?-t.contentHeight:-t.containerHeight;break;case 36:p=l.ctrlKey?e.scrollTop:t.containerHeight;break;default:return}s(e,"top",e.scrollTop-p),s(e,"left",e.scrollLeft+u),n(e),o=function(i,a){var r=e.scrollTop;if(0===i){if(!t.scrollbarYActive)return!1;if(0===r&&a>0||r>=t.contentHeight-t.containerHeight&&a<0)return!t.settings.wheelPropagation}var o=e.scrollLeft;if(0===a){if(!t.scrollbarXActive)return!1;if(0===o&&i<0||o>=t.contentWidth-t.containerWidth&&i>0)return!t.settings.wheelPropagation}return!0}(u,p),o&&l.preventDefault()}}})}t.exports=function(e){l(e,o.get(e))}},{"../../lib/dom":2,"../../lib/helper":5,"../instances":17,"../update-geometry":18,"../update-scroll":19}],12:[function(e,t,i){"use strict";var a=e("../instances"),r=e("../update-geometry"),o=e("../update-scroll");function n(e,t){var i=!1;function a(a){var n=function(e){var t=e.deltaX,i=-1*e.deltaY;return void 0!==t&&void 0!==i||(t=-1*e.wheelDeltaX/6,i=e.wheelDeltaY/6),e.deltaMode&&1===e.deltaMode&&(t*=10,i*=10),t!=t&&i!=i&&(t=0,i=e.wheelDelta),e.shiftKey?[-i,-t]:[t,i]}(a),s=n[0],l=n[1];(function(t,i){var a=e.querySelector("textarea:hover, select[multiple]:hover, .ps-child:hover");if(a){var r=window.getComputedStyle(a);if(![r.overflow,r.overflowX,r.overflowY].join("").match(/(scroll|auto)/))return!1;var o=a.scrollHeight-a.clientHeight;if(o>0&&!(0===a.scrollTop&&i>0||a.scrollTop===o&&i<0))return!0;var n=a.scrollLeft-a.clientWidth;if(n>0&&!(0===a.scrollLeft&&t<0||a.scrollLeft===n&&t>0))return!0}return!1})(s,l)||(i=!1,t.settings.useBothWheelAxes?t.scrollbarYActive&&!t.scrollbarXActive?(o(e,"top",l?e.scrollTop-l*t.settings.wheelSpeed:e.scrollTop+s*t.settings.wheelSpeed),i=!0):t.scrollbarXActive&&!t.scrollbarYActive&&(o(e,"left",s?e.scrollLeft+s*t.settings.wheelSpeed:e.scrollLeft-l*t.settings.wheelSpeed),i=!0):(o(e,"top",e.scrollTop-l*t.settings.wheelSpeed),o(e,"left",e.scrollLeft+s*t.settings.wheelSpeed)),r(e),i=i||function(i,a){var r=e.scrollTop;if(0===i){if(!t.scrollbarYActive)return!1;if(0===r&&a>0||r>=t.contentHeight-t.containerHeight&&a<0)return!t.settings.wheelPropagation}var o=e.scrollLeft;if(0===a){if(!t.scrollbarXActive)return!1;if(0===o&&i<0||o>=t.contentWidth-t.containerWidth&&i>0)return!t.settings.wheelPropagation}return!0}(s,l),i&&(a.stopPropagation(),a.preventDefault()))}void 0!==window.onwheel?t.event.bind(e,"wheel",a):void 0!==window.onmousewheel&&t.event.bind(e,"mousewheel",a)}t.exports=function(e){n(e,a.get(e))}},{"../instances":17,"../update-geometry":18,"../update-scroll":19}],13:[function(e,t,i){"use strict";var a=e("../instances"),r=e("../update-geometry");t.exports=function(e){!function(e,t){t.event.bind(e,"scroll",function(){r(e)})}(e,a.get(e))}},{"../instances":17,"../update-geometry":18}],14:[function(e,t,i){"use strict";var a=e("../../lib/helper"),r=e("../instances"),o=e("../update-geometry"),n=e("../update-scroll");function s(e,t){var i=null,s={top:0,left:0};function l(){i&&(clearInterval(i),i=null),a.stopScrolling(e)}var d=!1;t.event.bind(t.ownerDocument,"selectionchange",function(){var t;e.contains(0===(t=window.getSelection?window.getSelection():document.getSelection?document.getSelection():"").toString().length?null:t.getRangeAt(0).commonAncestorContainer)?d=!0:(d=!1,l())}),t.event.bind(window,"mouseup",function(){d&&(d=!1,l())}),t.event.bind(window,"keyup",function(){d&&(d=!1,l())}),t.event.bind(window,"mousemove",function(t){if(d){var c={x:t.pageX,y:t.pageY},u={left:e.offsetLeft,right:e.offsetLeft+e.offsetWidth,top:e.offsetTop,bottom:e.offsetTop+e.offsetHeight};c.x<u.left+3?(s.left=-5,a.startScrolling(e,"x")):c.x>u.right-3?(s.left=5,a.startScrolling(e,"x")):s.left=0,c.y<u.top+3?(s.top=u.top+3-c.y<5?-5:-20,a.startScrolling(e,"y")):c.y>u.bottom-3?(s.top=c.y-u.bottom+3<5?5:20,a.startScrolling(e,"y")):s.top=0,0===s.top&&0===s.left?l():i||(i=setInterval(function(){r.get(e)?(n(e,"top",e.scrollTop+s.top),n(e,"left",e.scrollLeft+s.left),o(e)):clearInterval(i)},50))}})}t.exports=function(e){s(e,r.get(e))}},{"../../lib/helper":5,"../instances":17,"../update-geometry":18,"../update-scroll":19}],15:[function(e,t,i){"use strict";var a=e("../../lib/helper"),r=e("../instances"),o=e("../update-geometry"),n=e("../update-scroll");function s(e,t,i,a){function s(t,i){n(e,"top",e.scrollTop-i),n(e,"left",e.scrollLeft-t),o(e)}var l={},d=0,c={},u=null,p=!1,h=!1;function m(){p=!0}function f(){p=!1}function g(e){return e.targetTouches?e.targetTouches[0]:e}function v(e){return(!e.pointerType||"pen"!==e.pointerType||0!==e.buttons)&&(!(!e.targetTouches||1!==e.targetTouches.length)||!(!e.pointerType||"mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))}function A(e){if(v(e)){h=!0;var t=g(e);l.pageX=t.pageX,l.pageY=t.pageY,d=(new Date).getTime(),null!==u&&clearInterval(u),e.stopPropagation()}}function C(i){if(!h&&t.settings.swipePropagation&&A(i),!p&&h&&v(i)){var a=g(i),r={pageX:a.pageX,pageY:a.pageY},o=r.pageX-l.pageX,n=r.pageY-l.pageY;s(o,n),l=r;var u=(new Date).getTime(),m=u-d;m>0&&(c.x=o/m,c.y=n/m,d=u),function(i,a){var r=e.scrollTop,o=e.scrollLeft,n=Math.abs(i),s=Math.abs(a);if(s>n){if(a<0&&r===t.contentHeight-t.containerHeight||a>0&&0===r)return!t.settings.swipePropagation}else if(n>s&&(i<0&&o===t.contentWidth-t.containerWidth||i>0&&0===o))return!t.settings.swipePropagation;return!0}(o,n)&&(i.stopPropagation(),i.preventDefault())}}function y(){!p&&h&&(h=!1,t.settings.swipeEasing&&(clearInterval(u),u=setInterval(function(){r.get(e)&&(c.x||c.y)?Math.abs(c.x)<.01&&Math.abs(c.y)<.01?clearInterval(u):(s(30*c.x,30*c.y),c.x*=.8,c.y*=.8):clearInterval(u)},10)))}i?(t.event.bind(window,"touchstart",m),t.event.bind(window,"touchend",f),t.event.bind(e,"touchstart",A),t.event.bind(e,"touchmove",C),t.event.bind(e,"touchend",y)):a&&(window.PointerEvent?(t.event.bind(window,"pointerdown",m),t.event.bind(window,"pointerup",f),t.event.bind(e,"pointerdown",A),t.event.bind(e,"pointermove",C),t.event.bind(e,"pointerup",y)):window.MSPointerEvent&&(t.event.bind(window,"MSPointerDown",m),t.event.bind(window,"MSPointerUp",f),t.event.bind(e,"MSPointerDown",A),t.event.bind(e,"MSPointerMove",C),t.event.bind(e,"MSPointerUp",y)))}t.exports=function(e){(a.env.supportsTouch||a.env.supportsIePointer)&&s(e,r.get(e),a.env.supportsTouch,a.env.supportsIePointer)}},{"../../lib/helper":5,"../instances":17,"../update-geometry":18,"../update-scroll":19}],16:[function(e,t,i){"use strict";var a=e("./instances"),r=e("./update-geometry"),o={"click-rail":e("./handler/click-rail"),"drag-scrollbar":e("./handler/drag-scrollbar"),keyboard:e("./handler/keyboard"),wheel:e("./handler/mouse-wheel"),touch:e("./handler/touch"),selection:e("./handler/selection")},n=e("./handler/native-scroll");t.exports=function(e,t){e.classList.add("ps");var i=a.add(e,"object"==typeof t?t:{});e.classList.add("ps--theme_"+i.settings.theme),i.settings.handlers.forEach(function(t){o[t](e)}),n(e),r(e)}},{"./handler/click-rail":9,"./handler/drag-scrollbar":10,"./handler/keyboard":11,"./handler/mouse-wheel":12,"./handler/native-scroll":13,"./handler/selection":14,"./handler/touch":15,"./instances":17,"./update-geometry":18}],17:[function(e,t,i){"use strict";var a=e("../lib/helper"),r=e("./default-setting"),o=e("../lib/dom"),n=e("../lib/event-manager"),s=e("../lib/guid"),l={};function d(e,t){var i=this;for(var s in i.settings=r(),t)i.settings[s]=t[s];function l(){e.classList.add("ps--focus")}function d(){e.classList.remove("ps--focus")}i.containerWidth=null,i.containerHeight=null,i.contentWidth=null,i.contentHeight=null,i.isRtl="rtl"===o.css(e,"direction"),i.isNegativeScroll=function(){var t,i=e.scrollLeft;return e.scrollLeft=-1,t=e.scrollLeft<0,e.scrollLeft=i,t}(),i.negativeScrollAdjustment=i.isNegativeScroll?e.scrollWidth-e.clientWidth:0,i.event=new n,i.ownerDocument=e.ownerDocument||document,i.scrollbarXRail=o.appendTo(o.create("div","ps__scrollbar-x-rail"),e),i.scrollbarX=o.appendTo(o.create("div","ps__scrollbar-x"),i.scrollbarXRail),i.scrollbarX.setAttribute("tabindex",0),i.event.bind(i.scrollbarX,"focus",l),i.event.bind(i.scrollbarX,"blur",d),i.scrollbarXActive=null,i.scrollbarXWidth=null,i.scrollbarXLeft=null,i.scrollbarXBottom=a.toInt(o.css(i.scrollbarXRail,"bottom")),i.isScrollbarXUsingBottom=i.scrollbarXBottom==i.scrollbarXBottom,i.scrollbarXTop=i.isScrollbarXUsingBottom?null:a.toInt(o.css(i.scrollbarXRail,"top")),i.railBorderXWidth=a.toInt(o.css(i.scrollbarXRail,"borderLeftWidth"))+a.toInt(o.css(i.scrollbarXRail,"borderRightWidth")),o.css(i.scrollbarXRail,"display","block"),i.railXMarginWidth=a.toInt(o.css(i.scrollbarXRail,"marginLeft"))+a.toInt(o.css(i.scrollbarXRail,"marginRight")),o.css(i.scrollbarXRail,"display",""),i.railXWidth=null,i.railXRatio=null,i.scrollbarYRail=o.appendTo(o.create("div","ps__scrollbar-y-rail"),e),i.scrollbarY=o.appendTo(o.create("div","ps__scrollbar-y"),i.scrollbarYRail),i.scrollbarY.setAttribute("tabindex",0),i.event.bind(i.scrollbarY,"focus",l),i.event.bind(i.scrollbarY,"blur",d),i.scrollbarYActive=null,i.scrollbarYHeight=null,i.scrollbarYTop=null,i.scrollbarYRight=a.toInt(o.css(i.scrollbarYRail,"right")),i.isScrollbarYUsingRight=i.scrollbarYRight==i.scrollbarYRight,i.scrollbarYLeft=i.isScrollbarYUsingRight?null:a.toInt(o.css(i.scrollbarYRail,"left")),i.scrollbarYOuterWidth=i.isRtl?a.outerWidth(i.scrollbarY):null,i.railBorderYWidth=a.toInt(o.css(i.scrollbarYRail,"borderTopWidth"))+a.toInt(o.css(i.scrollbarYRail,"borderBottomWidth")),o.css(i.scrollbarYRail,"display","block"),i.railYMarginHeight=a.toInt(o.css(i.scrollbarYRail,"marginTop"))+a.toInt(o.css(i.scrollbarYRail,"marginBottom")),o.css(i.scrollbarYRail,"display",""),i.railYHeight=null,i.railYRatio=null}function c(e){return e.getAttribute("data-ps-id")}i.add=function(e,t){var i=s();return function(e,t){e.setAttribute("data-ps-id",t)}(e,i),l[i]=new d(e,t),l[i]},i.remove=function(e){delete l[c(e)],function(e){e.removeAttribute("data-ps-id")}(e)},i.get=function(e){return l[c(e)]}},{"../lib/dom":2,"../lib/event-manager":3,"../lib/guid":4,"../lib/helper":5,"./default-setting":7}],18:[function(e,t,i){"use strict";var a=e("../lib/helper"),r=e("../lib/dom"),o=e("./instances"),n=e("./update-scroll");function s(e,t){return e.settings.minScrollbarLength&&(t=Math.max(t,e.settings.minScrollbarLength)),e.settings.maxScrollbarLength&&(t=Math.min(t,e.settings.maxScrollbarLength)),t}t.exports=function(e){var t,i=o.get(e);i.containerWidth=e.clientWidth,i.containerHeight=e.clientHeight,i.contentWidth=e.scrollWidth,i.contentHeight=e.scrollHeight,e.contains(i.scrollbarXRail)||((t=r.queryChildren(e,".ps__scrollbar-x-rail")).length>0&&t.forEach(function(e){r.remove(e)}),r.appendTo(i.scrollbarXRail,e)),e.contains(i.scrollbarYRail)||((t=r.queryChildren(e,".ps__scrollbar-y-rail")).length>0&&t.forEach(function(e){r.remove(e)}),r.appendTo(i.scrollbarYRail,e)),!i.settings.suppressScrollX&&i.containerWidth+i.settings.scrollXMarginOffset<i.contentWidth?(i.scrollbarXActive=!0,i.railXWidth=i.containerWidth-i.railXMarginWidth,i.railXRatio=i.containerWidth/i.railXWidth,i.scrollbarXWidth=s(i,a.toInt(i.railXWidth*i.containerWidth/i.contentWidth)),i.scrollbarXLeft=a.toInt((i.negativeScrollAdjustment+e.scrollLeft)*(i.railXWidth-i.scrollbarXWidth)/(i.contentWidth-i.containerWidth))):i.scrollbarXActive=!1,!i.settings.suppressScrollY&&i.containerHeight+i.settings.scrollYMarginOffset<i.contentHeight?(i.scrollbarYActive=!0,i.railYHeight=i.containerHeight-i.railYMarginHeight,i.railYRatio=i.containerHeight/i.railYHeight,i.scrollbarYHeight=s(i,a.toInt(i.railYHeight*i.containerHeight/i.contentHeight)),i.scrollbarYTop=a.toInt(e.scrollTop*(i.railYHeight-i.scrollbarYHeight)/(i.contentHeight-i.containerHeight))):i.scrollbarYActive=!1,i.scrollbarXLeft>=i.railXWidth-i.scrollbarXWidth&&(i.scrollbarXLeft=i.railXWidth-i.scrollbarXWidth),i.scrollbarYTop>=i.railYHeight-i.scrollbarYHeight&&(i.scrollbarYTop=i.railYHeight-i.scrollbarYHeight),function(e,t){var i={width:t.railXWidth};t.isRtl?i.left=t.negativeScrollAdjustment+e.scrollLeft+t.containerWidth-t.contentWidth:i.left=e.scrollLeft,t.isScrollbarXUsingBottom?i.bottom=t.scrollbarXBottom-e.scrollTop:i.top=t.scrollbarXTop+e.scrollTop,r.css(t.scrollbarXRail,i);var a={top:e.scrollTop,height:t.railYHeight};t.isScrollbarYUsingRight?t.isRtl?a.right=t.contentWidth-(t.negativeScrollAdjustment+e.scrollLeft)-t.scrollbarYRight-t.scrollbarYOuterWidth:a.right=t.scrollbarYRight-e.scrollLeft:t.isRtl?a.left=t.negativeScrollAdjustment+e.scrollLeft+2*t.containerWidth-t.contentWidth-t.scrollbarYLeft-t.scrollbarYOuterWidth:a.left=t.scrollbarYLeft+e.scrollLeft,r.css(t.scrollbarYRail,a),r.css(t.scrollbarX,{left:t.scrollbarXLeft,width:t.scrollbarXWidth-t.railBorderXWidth}),r.css(t.scrollbarY,{top:t.scrollbarYTop,height:t.scrollbarYHeight-t.railBorderYWidth})}(e,i),i.scrollbarXActive?e.classList.add("ps--active-x"):(e.classList.remove("ps--active-x"),i.scrollbarXWidth=0,i.scrollbarXLeft=0,n(e,"left",0)),i.scrollbarYActive?e.classList.add("ps--active-y"):(e.classList.remove("ps--active-y"),i.scrollbarYHeight=0,i.scrollbarYTop=0,n(e,"top",0))}},{"../lib/dom":2,"../lib/helper":5,"./instances":17,"./update-scroll":19}],19:[function(e,t,i){"use strict";var a=e("./instances"),r=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t};t.exports=function(e,t,i){if(void 0===e)throw"You must provide an element to the update-scroll function";if(void 0===t)throw"You must provide an axis to the update-scroll function";if(void 0===i)throw"You must provide a value to the update-scroll function";"top"===t&&i<=0&&(e.scrollTop=i=0,e.dispatchEvent(r("ps-y-reach-start"))),"left"===t&&i<=0&&(e.scrollLeft=i=0,e.dispatchEvent(r("ps-x-reach-start")));var o=a.get(e);"top"===t&&i>=o.contentHeight-o.containerHeight&&((i=o.contentHeight-o.containerHeight)-e.scrollTop<=2?i=e.scrollTop:e.scrollTop=i,e.dispatchEvent(r("ps-y-reach-end"))),"left"===t&&i>=o.contentWidth-o.containerWidth&&((i=o.contentWidth-o.containerWidth)-e.scrollLeft<=2?i=e.scrollLeft:e.scrollLeft=i,e.dispatchEvent(r("ps-x-reach-end"))),void 0===o.lastTop&&(o.lastTop=e.scrollTop),void 0===o.lastLeft&&(o.lastLeft=e.scrollLeft),"top"===t&&i<o.lastTop&&e.dispatchEvent(r("ps-scroll-up")),"top"===t&&i>o.lastTop&&e.dispatchEvent(r("ps-scroll-down")),"left"===t&&i<o.lastLeft&&e.dispatchEvent(r("ps-scroll-left")),"left"===t&&i>o.lastLeft&&e.dispatchEvent(r("ps-scroll-right")),"top"===t&&i!==o.lastTop&&(e.scrollTop=o.lastTop=i,e.dispatchEvent(r("ps-scroll-y"))),"left"===t&&i!==o.lastLeft&&(e.scrollLeft=o.lastLeft=i,e.dispatchEvent(r("ps-scroll-x")))}},{"./instances":17}],20:[function(e,t,i){"use strict";var a=e("../lib/helper"),r=e("../lib/dom"),o=e("./instances"),n=e("./update-geometry"),s=e("./update-scroll");t.exports=function(e){var t=o.get(e);t&&(t.negativeScrollAdjustment=t.isNegativeScroll?e.scrollWidth-e.clientWidth:0,r.css(t.scrollbarXRail,"display","block"),r.css(t.scrollbarYRail,"display","block"),t.railXMarginWidth=a.toInt(r.css(t.scrollbarXRail,"marginLeft"))+a.toInt(r.css(t.scrollbarXRail,"marginRight")),t.railYMarginHeight=a.toInt(r.css(t.scrollbarYRail,"marginTop"))+a.toInt(r.css(t.scrollbarYRail,"marginBottom")),r.css(t.scrollbarXRail,"display","none"),r.css(t.scrollbarYRail,"display","none"),n(e),s(e,"top",e.scrollTop),s(e,"left",e.scrollLeft),r.css(t.scrollbarXRail,"display",""),r.css(t.scrollbarYRail,"display",""))}},{"../lib/dom":2,"../lib/helper":5,"./instances":17,"./update-geometry":18,"./update-scroll":19}]},{},[1]),function(e,t){let i=null;var a=function(e){this.options=e||{},this.config={},this.paymentsClient=null};a.prototype={defaults:{type:"gpay",environment:"TEST",gateway:"adyen",gatewayMerchantId:"VagaroECOM",allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["VISA","MASTERCARD"],amountValue:0,currency:"USD",countryCode:"US",merchantName:"Vagaro",merchantId:"",merchantIdentifier:"merchant.com.adyen.vagaroapplepay.test",supportedNetworks:["visa","masterCard"],merchantCapabilities:["supports3DS"],onPaymentSuccess:null,onPaymentError:null},init:function(){return this.config=t.extend({},this.defaults,e.paymentDefaults||{},this.options),"gpay"===this.config.type&&(this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.config.environment})),this},checkAvailability:async function(){if("gpay"===this.config.type)try{return(await this.paymentsClient.isReadyToPay(this.getIsReadyToPayRequest())).result}catch(e){return console.error("Google Pay availability check failed:",e),!1}else if("applepay"===this.config.type)return e.ApplePaySession&&ApplePaySession.canMakePayments();return!1},open:function(){return"gpay"===this.config.type?this.openGooglePayPopup():"applepay"===this.config.type?this.openApplePayPopup():void 0},getIsReadyToPayRequest:function(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.getBaseCardPaymentMethod()]}},getPaymentDataRequest:function(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.getTokenizedCardPaymentMethod()],transactionInfo:{totalPriceStatus:"FINAL",totalPrice:this.config.amountValue.toFixed(2),currencyCode:this.config.currency,countryCode:this.config.countryCode},merchantInfo:{merchantName:this.config.merchantName,merchantId:this.config.merchantId||void 0}}},getBaseCardPaymentMethod:function(){return{type:"CARD",parameters:{allowedAuthMethods:this.config.allowedAuthMethods,allowedCardNetworks:this.config.allowedCardNetworks}}},getTokenizedCardPaymentMethod:function(){return{type:"CARD",parameters:{allowedAuthMethods:this.config.allowedAuthMethods,allowedCardNetworks:this.config.allowedCardNetworks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:this.config.gateway,gatewayMerchantId:this.config.gatewayMerchantId}}}},getSessionTokenTest:function(){try{ShowLoader(!0);var e={},t={DomainName:"https://dev30apiv2.bookitall.com/",PaymentProviderType:2};t.LoginUserId="undefined"!=typeof UserID?UserID.toString():"0",t.MerchantTokenId=_shopdetail.MerchantTokenID,t.UserAgent=null!=navigator.userAgent?navigator.userAgent:"",e.VirtualCardSessionRequest=t;var i=new vagaro.ajax;i.datamodel.Token="GenerateVirtualCardSession",i.datamodel.data=e,i.datamodel.callback=function(e){session.completeMerchantValidation(e),ShowLoader(!1)},i.datamodel.async=!1,i.datamodel.Error=function(e){ShowLoader(!1),session.abort(),"function"==typeof this.config.onPaymentError&&this.config.onPaymentError(e&&e.message)},i.Post()}catch(e){session.abort(),"function"==typeof this.config.onPaymentError&&this.config.onPaymentError(e&&e.message)}},openGooglePayPopup:async function(){try{const e=await this.paymentsClient.loadPaymentData(this.getPaymentDataRequest()),t=e.paymentMethodData?.tokenizationData?.token;t&&"function"==typeof this.config.onPaymentSuccess&&this.config.onPaymentSuccess(t)}catch(e){ShowLoader(!1);"CANCELED"===e?.statusCode||e?.message?.includes("cancel")||"function"!=typeof this.config.onPaymentError||this.config.onPaymentError(e&&e.message)}},openApplePayPopup:function(){if(!e.ApplePaySession||!ApplePaySession.canMakePayments())return void("function"==typeof this.config.onPaymentError&&this.config.onPaymentError("Apple Pay not available"));const t={countryCode:this.config.countryCode,currencyCode:this.config.currency,total:{label:this.config.merchantName,amount:this.config.amountValue.toFixed(2)},supportedNetworks:this.config.supportedNetworks,merchantCapabilities:this.config.merchantCapabilities};i=new ApplePaySession(3,t),i.onvalidatemerchant=async t=>{try{ShowLoader(!0);var a={},r={};r.DomainName=e.location.hostname,r.PaymentProviderType=2,r.LoginUserId="undefined"!=typeof UserID?UserID.toString():"0",r.MerchantTokenId=_shopdetail.MerchantTokenID,r.UserAgent=null!=navigator.userAgent?navigator.userAgent:"",a.VirtualCardSessionRequest=r;var o=new vagaro.ajax;o.datamodel.Token="GenerateVirtualCardSession",o.datamodel.data=a,o.datamodel.callback=function(e){var t=JSON.parse(e);i.completeMerchantValidation(t),ShowLoader(!1)},o.datamodel.async=!1,o.datamodel.Error=function(e){ShowLoader(!1),i.abort(),"function"==typeof this.config.onPaymentError&&this.config.onPaymentError(e&&e.message)},o.Post()}catch(e){i.abort(),"function"==typeof this.config.onPaymentError&&this.config.onPaymentError(e&&e.message)}},i.onpaymentauthorized=e=>{"function"==typeof this.config.onPaymentSuccess&&this.config.onPaymentSuccess(e.payment),i.completePayment(ApplePaySession.STATUS_SUCCESS)},i.oncancel=()=>{ShowLoader(!1),console.log("Apple Pay was cancelled by the user.")}}},e.paymentDefaults={},t(function(){var i=t("#hdnApayGPayPaymentMethods").val();if(i)try{var a=JSON.parse(i);"object"==typeof a&&null!==a?e.paymentDefaults=a:(console.log("Hidden config is not a valid object, using defaults."),e.paymentDefaults={})}catch(t){console.log("Invalid JSON in #hdnApayGPayPaymentMethods, using defaults."),e.paymentDefaults={}}else console.log("No hidden config found, using defaults."),e.paymentDefaults={}}),e.paymentCheckAvailability=function(e,i){new a(t.extend({},paymentDefaults,{type:e})).init().checkAvailability().then(function(e){i(!0===e)}).catch(function(){i(!1)})},e.paymentOpenPopup=function(e,i,r,o){new a(t.extend({},paymentDefaults,{type:e,amountValue:i,onPaymentSuccess:r,onPaymentError:o})).init().open()},e.PaymentBuilder=a,e.startApplePaySession=function(){i?i.begin():console.error("Apple Pay session not initialized yet.")}}(window,jQuery),window.glbs_utkn="",function(e){"use strict";const t="VjyaDUqIaJ9ZTvKEP9kn6g==";function i(){for(var t=[],i=0;i<e._formsSubmitButtonIds.length;i++){var a=document.getElementById(e._formsSubmitButtonIds[i]);a&&t.push(a)}return t}function a(e){e&&"true"!==e.getAttribute("data-vg-loading")&&(e.setAttribute("data-vg-loading","true"),void 0===e._vgOriginalHtml&&(e._vgOriginalHtml=e.innerHTML),e.innerHTML=function(e){var t=e?e.offsetHeight:0;return'<div class="flex items-center justify-center w-full h-full"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 88 40" style="height:'+(t>0?Math.round(.5*t):20)+'px;width:auto;"><circle cx="12" cy="20" r="12"><animate attributeName="cy" values="20;12;20" dur="0.6s" repeatCount="indefinite" begin="0s" /></circle><circle cx="44" cy="20" r="12"><animate attributeName="cy" values="20;12;20" dur="0.6s" repeatCount="indefinite" begin="0.2s" /></circle><circle cx="76" cy="20" r="12"><animate attributeName="cy" values="20;12;20" dur="0.6s" repeatCount="indefinite" begin="0.4s" /></circle></svg></div>'}(e),e.disabled=!0,e.style.cursor="not-allowed",e.style.opacity="0.6")}function r(e){e&&(void 0!==e._vgOriginalHtml&&(e.innerHTML=e._vgOriginalHtml,delete e._vgOriginalHtml),e.disabled=!1,e.style.cursor="",e.style.opacity="",e.removeAttribute("data-vg-loading"))}e.resolveFormsToken=function(){var t=e.glbs_utkn||"";if(!t)try{t=new URL(e.location.href).searchParams.get("glbs_utkn")||""}catch(e){t=""}return t||"function"!=typeof getCookie||(t=getCookie("s_utkn")||getCookie("s_utknforms")||""),t&&(e.glbs_utkn=t),t},e.getCorrectUserId=function(){let e=""!==$("#hdnSiteBuilderEncuserid").val()&&null!=$("#hdnSiteBuilderEncuserid").val()?$("#hdnSiteBuilderEncuserid").val():"",i="undefined"!=typeof glbEncryptUserIdForCheckInApp&&glbEncryptUserIdForCheckInApp?glbEncryptUserIdForCheckInApp:"",a="undefined"!=typeof staticEncryptUserID&&staticEncryptUserID?staticEncryptUserID:"";return""!=e&&e!=t?e:i===t||""===i?a:i},e.getFormsIframeUrl=function(t){let i="function"==typeof getBusinessID?getBusinessID():"",a=(t||"us02").toLowerCase();String.isNullOrUndefineOrBlank(getCookie("rpt_data"))||"274275"!=i&&"298570"!=i||(a=getCookie("rpt_data").grouptoken.toLowerCase());let r=e.location.origin,o="",n="undefined"!=typeof staticEncryptBusinessID?staticEncryptBusinessID:"",s=e.getCorrectUserId();if(""!=s&&"VjyaDUqIaJ9ZTvKEP9kn6g=="!=s||"undefined"==typeof widgetcookievalue||""==widgetcookievalue||"undefined"==typeof isWidget||"true"!=isWidget.toLowerCase())null!=_common&&_common.IsCookieLessWidget()&&(glbs_utkn=localStorage.getItem("s_utkn")||"");else{var l={WidgetUserID:widgetcookievalue.replace(" ","+"),EncBid:n},d=new vagaro.ajax;d.datamodel.Token=_shopdetail.GetCoreAPIURLWithToken(ApiURLEnumBooking.GetWidgetuserdetails,groupID),d.datamodel.async=!1,d.datamodel.data=l,d.datamodel.IsNewVagaroAPI=!0,d.datamodel.callback=function(e){if(1e3==e.ResponseCode){var t=e.Data||{};t.frmuid&&(s=t.frmuid,glbEncryptUserIdForCheckInApp=t.frmuid,glbs_utkn=t.frmToken)}},d.datamodel.Error=_common.CallFailed,d.Post()}let c=a;o="https://stage.bookitall.com"===r?`https://stage${a}.bookitall.com`:"https://lp.bookitall.com"===r?`https://lp${a}.bookitall.com`:"https://vagaro.com"===r||"https://www.vagaro.com"===r?`https://${a}.vagaro.com`:r;let u=[];n&&u.push(`merchantId=${n}`),s&&u.push(`userId=${s}`),c&&u.push(`grouptoken=${c}`),u.push("isopenfromonline=true"),e.glbs_utkn&&u.push(`glbs_utkn=${e.glbs_utkn}`);let p=u.length>0?"?"+u.join("&"):"";return console.log("Forms URL Parameters:",{MerchantId:n,UserId:s,grouptoken:c}),`${o}/merchants/customers/v3/profile/forms${p}`},e.setupFormMessageListener=function(t){console.log("Setting up form message listener globally"),e._formMessageHandler&&e.removeEventListener("message",e._formMessageHandler),e._formMessageHandler=function(i){e.handleFormMessage(i,t)},e.addEventListener("message",e._formMessageHandler),console.log("Form message listener setup complete for:",t.IFrameRootUrl)},e._formsSubmitButtonIds=["btnFormsSubmit","btnFormsSubmitCheckOut","btnFormsSubmitDirectClass","btnFormsSubmitCheckInApp","btnFormsSubmitForAllDirectClass"],e.handleFormMessage=function(t,o){try{if(console.log("Message received from:",t.origin),console.log("Raw message data:",t.data),"string"==typeof t.data&&!function(e){if("string"!=typeof e)return!1;var t=e.trim();return t.startsWith("{")||t.startsWith("[")}(t.data))return;var n="string"==typeof t.data?JSON.parse(t.data):t.data;if(!n||!n.type)return void console.log("Non-form message, ignoring");switch(console.log("Processing form message type:",n.type),n.type){case"REQUEST_FORM_IDS":console.log("Handling REQUEST_FORM_IDS"),e.sendFormIdsResponse(t.source,o);break;case"CANCEL_CUSTOMER_FORM_LEGACY":console.log("Handling CANCEL_CUSTOMER_FORM_LEGACY");var s=document.getElementById("iFrame_divFormsIframe"),l=document.getElementById("iFrame_divFormsIframeCheckOut"),d=document.getElementById("iFrame_divFormsIframeDirectClass");s&&void 0!==_shopdetail&&_shopdetail.HidePopup?(console.log("Calling _shopdetail.HidePopup() for iFrame_divFormsIframe"),_shopdetail.HidePopup()):l||d?(console.log("Calling _onlineCheckout.checkoutGotoNextStep(true) for checkout/direct class iframe"),"undefined"!=typeof _onlineCheckout&&_onlineCheckout.checkoutGotoNextStep&&_onlineCheckout.checkoutGotoNextStep(!0)):console.warn("No appropriate handler found for CANCEL_CUSTOMER_FORM_LEGACY");break;case"SAVE_CUSTOMER_FORM_LEGACY":console.log("Handling SAVE_CUSTOMER_FORM_LEGACY - Clearing all forms"),"undefined"!=typeof _onlineCheckout&&(_onlineCheckout.formsResponse.length=0,_onlineCheckout.DisplayFormsInIframe&&_onlineCheckout.DisplayFormsInIframe(null,null));break;case"setLegacyReactiframHeight":console.log("Handling setLegacyReactiframHeight");var c=n.height||n.value||0;if(c>0){console.log("Setting iframe height to:",c);var u,p=document.getElementById("iFrame_divFormsIframe")||document.getElementById("iFrame_divFormsIframeCheckOut")||document.getElementById("iFrame_divFormsIframeDirectClass");document.getElementById("divFormsIframe")&&document.getElementById("iFrame_divFormsIframe")?u=document.getElementById("divFormsIframe"):document.getElementById("divFormsIframeCheckOut")&&document.getElementById("iFrame_divFormsIframeCheckOut")?u=document.getElementById("divFormsIframeCheckOut"):document.getElementById("divFormsIframeDirectClass")&&document.getElementById("iFrame_divFormsIframeDirectClass")&&(u=document.getElementById("divFormsIframeDirectClass")),p?(p.style.height=c+"px",console.log("Iframe height set to:",c+"px")):console.warn("Iframe element not found"),u?(u.style.setProperty("height",c+"px","important"),console.log("Container div height set to:",c+"px")):console.warn("Container div element not found")}else console.warn("Invalid height value received:",c);break;case"initAllDropdownOutsideClick":console.log("Handling initAllDropdownOutsideClick"),e.initAllDropdownOutsideClick();break;case"CUSTOM_FIELD_DROPDOWN_PRESENCE":e._customFieldDDPresentInIframe=!!n.isPresent;break;case"customerFormSaveTriggered":a((g=i()).length>0?g[0]:null);break;case"customerFormSaveSuccess":for(var h=i(),m=0;m<h.length;m++)r(h[m]);break;case"customerFormScrolltoTop":console.log("Handling SCROLL_TO_TOP - scrolling parent page to top");try{e.scrollTo({top:0,behavior:"smooth"}),e.parent&&e.parent!==e&&e.parent.scrollTo({top:0,behavior:"smooth"})}catch(e){console.warn("SCROLL_TO_TOP failed:",e)}break;case"UPDATE_QUERY_PARAM":var f;document.getElementById("divFormsIframe")&&document.getElementById("iFrame_divFormsIframe")?f=document.getElementById("iFrame_divFormsIframe"):document.getElementById("divFormsIframeCheckOut")&&document.getElementById("iFrame_divFormsIframeCheckOut")?f=document.getElementById("iFrame_divFormsIframeCheckOut"):document.getElementById("divFormsIframeDirectClass")&&document.getElementById("iFrame_divFormsIframeDirectClass")?f=document.getElementById("iFrame_divFormsIframeDirectClass"):document.getElementById("divFormsIframeCheckInApp")&&document.getElementById("iFrame_divFormsIframeCheckInApp")&&(f=document.getElementById("iFrame_divFormsIframeCheckInApp"));const v=new URL(f.src);v.searchParams.set("glbs_utkn",t.data.token),f.src=v.toString();break;default:console.log("Unknown form message type:",n.type)}}catch(e){console.error("Error handling form message:",e)}var g},e.sendFormIdsResponse=function(t,i){try{console.log("Preparing form IDs response");var a={customerId:e.getCorrectUserId(),emailId:"undefined"!=typeof UserEmail?UserEmail:"",cellCountryId:"undefined"!=typeof countryIdBusDetail?countryIdBusDetail:1,customerName:"undefined"!=typeof FullUserName?FullUserName:""},r=[];"undefined"!=typeof _onlineCheckout&&_onlineCheckout.formsResponse&&Array.isArray(_onlineCheckout.formsResponse)&&(r=_onlineCheckout.formsResponse.map(function(e){return e.FormId})),console.log("Form IDs to send:",r),console.log("Customer ID:",a.customerId);const t=document.getElementById("iFrame_divFormsIframe")||document.getElementById("iFrame_divFormsIframeCheckOut")||document.getElementById("iFrame_divFormsIframeDirectClass");t&&t.contentWindow?(t.contentWindow.postMessage({type:"RESPONSE_FORM_IDS",formIds:r,customerDetails:a},"*"),console.log("Form IDs sent successfully")):console.error("Iframe not found or not ready")}catch(e){console.error("Error sending form IDs response:",e)}},e.getFormsCookie=function(e){let t=document.cookie.split(";");for(let i of t){let[t,a]=i.trim().split("=");if(t===e)return decodeURIComponent(a)}return null},e.cleanupFormMessageListener=function(){e._formMessageHandler&&(e.removeEventListener("message",e._formMessageHandler),e._formMessageHandler=null,console.log("Form message listener cleaned up"))},console.log("FormsIframeCommon.js loaded successfully"),e.initAllDropdownOutsideClick=function(){var t;function i(e){try{t&&t.contentWindow&&t.contentWindow.postMessage({type:"CLOSE_CUSTOM_FIELD_DROPDOWNS",forceClose:!!e},"*")}catch(e){console.warn("Failed to post CLOSE_CUSTOM_FIELD_DROPDOWNS:",e)}}document.getElementById("divFormsIframe")&&document.getElementById("iFrame_divFormsIframe")?t=document.getElementById("iFrame_divFormsIframe"):document.getElementById("divFormsIframeCheckOut")&&document.getElementById("iFrame_divFormsIframeCheckOut")?t=document.getElementById("iFrame_divFormsIframeCheckOut"):document.getElementById("divFormsIframeDirectClass")&&document.getElementById("iFrame_divFormsIframeDirectClass")&&(t=document.getElementById("iFrame_divFormsIframeDirectClass")),t&&(e._customFieldDDParentMouseDownHandler&&document.removeEventListener("mousedown",e._customFieldDDParentMouseDownHandler,!0),e._customFieldDDParentMouseDownHandler=function(e){try{if(t&&t.contains&&t.contains(e.target))return;i(!0)}catch(e){}},document.addEventListener("mousedown",e._customFieldDDParentMouseDownHandler,!0),e._customFieldDDParentBlurHandler&&e.removeEventListener("blur",e._customFieldDDParentBlurHandler,!0),e._customFieldDDParentBlurHandler=function(){e.setTimeout(function(){try{var e=document.activeElement;if(!(!t||e!==t))return;i(!0)}catch(e){}},0)},e.addEventListener("blur",e._customFieldDDParentBlurHandler,!0))}}(window);