window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o<i;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=g(b.temporaryFormId);d&&h&&(g(b.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(h,d),this.style.display="none",n=(d=(d=g(b.commentReplyTitleId))&&d.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,d=m(n,"belowelement"),o=m(n,"commentid"),i=m(n,"respondelement"),r=m(n,"postid"),n=m(n,"replyto")||t;d&&o&&i&&r&&!1===v.addComment.moveForm(d,o,i,r,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return r&&"loading"!==E.readyState?t():r&&v.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var i,r,l,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===o&&(o=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),d&&y&&(y.value=d),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=o),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],r=!1,"getComputedStyle"in v?l=v.getComputedStyle(i):E.documentElement.currentStyle&&(l=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===l.visibility)&&(r=!0),"hidden"!==i.type&&!i.disabled&&!r){i.focus();break}}catch(e){}return!1}}}}(window);
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.sbjs=e()}}(function(){return function e(t,r,n){function a(s,o){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[s]={exports:{}};t[s][0].call(p.exports,function(e){var r=t[s][1][e];return a(r||e)},p,p.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)a(n[s]);return a}({1:[function(e,t,r){"use strict";var n=e("./init"),a={init:function(e){this.get=n(e),e&&e.callback&&"function"==typeof e.callback&&e.callback(this.get)}};t.exports=a},{"./init":6}],2:[function(e,t,r){"use strict";var n=e("./terms"),a=e("./helpers/utils"),i={containers:{current:"sbjs_current",current_extra:"sbjs_current_add",first:"sbjs_first",first_extra:"sbjs_first_add",session:"sbjs_session",udata:"sbjs_udata",promocode:"sbjs_promo"},service:{migrations:"sbjs_migrations"},delimiter:"|||",aliases:{main:{type:"typ",source:"src",medium:"mdm",campaign:"cmp",content:"cnt",term:"trm",id:"id",platform:"plt",format:"fmt",tactic:"tct"},extra:{fire_date:"fd",entrance_point:"ep",referer:"rf"},session:{pages_seen:"pgs",current_page:"cpg"},udata:{visits:"vst",ip:"uip",agent:"uag"},promo:"code"},pack:{main:function(e){return i.aliases.main.type+"="+e.type+i.delimiter+i.aliases.main.source+"="+e.source+i.delimiter+i.aliases.main.medium+"="+e.medium+i.delimiter+i.aliases.main.campaign+"="+e.campaign+i.delimiter+i.aliases.main.content+"="+e.content+i.delimiter+i.aliases.main.term+"="+e.term+i.delimiter+i.aliases.main.id+"="+e.id+i.delimiter+i.aliases.main.platform+"="+e.platform+i.delimiter+i.aliases.main.format+"="+e.format+i.delimiter+i.aliases.main.tactic+"="+e.tactic},extra:function(e){return i.aliases.extra.fire_date+"="+a.setDate(new Date,e)+i.delimiter+i.aliases.extra.entrance_point+"="+document.location.href+i.delimiter+i.aliases.extra.referer+"="+(document.referrer||n.none)},user:function(e,t){return i.aliases.udata.visits+"="+e+i.delimiter+i.aliases.udata.ip+"="+t+i.delimiter+i.aliases.udata.agent+"="+navigator.userAgent},session:function(e){return i.aliases.session.pages_seen+"="+e+i.delimiter+i.aliases.session.current_page+"="+document.location.href},promo:function(e){return i.aliases.promo+"="+a.setLeadingZeroToInt(a.randomInt(e.min,e.max),e.max.toString().length)}}};t.exports=i},{"./helpers/utils":5,"./terms":9}],3:[function(e,t,r){"use strict";var n=e("../data").delimiter;t.exports={useBase64:!1,setBase64Flag:function(e){this.useBase64=e},encodeData:function(e){return encodeURIComponent(e).replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29")},decodeData:function(e){try{return decodeURIComponent(e).replace(/\%21/g,"!").replace(/\%7E/g,"~").replace(/\%2A/g,"*").replace(/\%27/g,"'").replace(/\%28/g,"(").replace(/\%29/g,")")}catch(t){try{return unescape(e)}catch(r){return""}}},set:function(e,t,r,n,a){var i,s;if(r){var o=new Date;o.setTime(o.getTime()+60*r*1e3),i="; expires="+o.toGMTString()}else i="";s=n&&!a?";domain=."+n:"";var c=this.encodeData(t);this.useBase64&&(c=btoa(c).replace(/=+$/,"")),document.cookie=this.encodeData(e)+"="+c+i+s+"; path=/"},get:function(e){for(var t=this.encodeData(e)+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var a=r[n];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t)){var i=a.substring(t.length,a.length);if(/^[A-Za-z0-9+/]+$/.test(i))try{i=atob(i.padEnd(4*Math.ceil(i.length/4),"="))}catch(s){}return this.decodeData(i)}}return null},destroy:function(e,t,r){this.set(e,"",-1,t,r)},parse:function(e){var t=[],r={};if("string"==typeof e)t.push(e);else for(var a in e)e.hasOwnProperty(a)&&t.push(e[a]);for(var i=0;i<t.length;i++){var s;r[this.unsbjs(t[i])]={},s=this.get(t[i])?this.get(t[i]).split(n):[];for(var o=0;o<s.length;o++){var c=s[o].split("="),u=c.splice(0,1);u.push(c.join("=")),r[this.unsbjs(t[i])][u[0]]=this.decodeData(u[1])}}return r},unsbjs:function(e){return e.replace("sbjs_","")}}},{"../data":2}],4:[function(e,t,r){"use strict";t.exports={parse:function(e){for(var t=this.parseOptions,r=t.parser[t.strictMode?"strict":"loose"].exec(e),n={},a=14;a--;)n[t.key[a]]=r[a]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(e,r,a){r&&(n[t.q.name][r]=a)}),n},parseOptions:{strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},getParam:function(e){for(var t={},r=(e||window.location.search.substring(1)).split("&"),n=0;n<r.length;n++){var a=r[n].split("=");if("undefined"==typeof t[a[0]])t[a[0]]=a[1];else if("string"==typeof t[a[0]]){var i=[t[a[0]],a[1]];t[a[0]]=i}else t[a[0]].push(a[1])}return t},getHost:function(e){return this.parse(e).host.replace("www.","")}}},{}],5:[function(e,t,r){"use strict";t.exports={escapeRegexp:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},setDate:function(e,t){var r=e.getTimezoneOffset()/60,n=e.getHours(),a=t||0===t?t:-r;return e.setHours(n+r+a),e.getFullYear()+"-"+this.setLeadingZeroToInt(e.getMonth()+1,2)+"-"+this.setLeadingZeroToInt(e.getDate(),2)+" "+this.setLeadingZeroToInt(e.getHours(),2)+":"+this.setLeadingZeroToInt(e.getMinutes(),2)+":"+this.setLeadingZeroToInt(e.getSeconds(),2)},setLeadingZeroToInt:function(e,t){for(var r=e+"";r.length<t;)r="0"+r;return r},randomInt:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}}},{}],6:[function(e,t,r){"use strict";var n=e("./data"),a=e("./terms"),i=e("./helpers/cookies"),s=e("./helpers/uri"),o=e("./helpers/utils"),c=e("./params"),u=e("./migrations");t.exports=function(e){var t,r,p,f,m,d,l,g,h,y,_,v,b,x=c.fetch(e),k=s.getParam(),w=x.domain.host,q=x.domain.isolate,I=x.lifetime;function j(e){switch(e){case a.traffic.utm:t=a.traffic.utm,r="undefined"!=typeof k.utm_source?k.utm_source:"undefined"!=typeof k.gclid?"google":"undefined"!=typeof k.yclid?"yandex":a.none,p="undefined"!=typeof k.utm_medium?k.utm_medium:"undefined"!=typeof k.gclid?"cpc":"undefined"!=typeof k.yclid?"cpc":a.none,f="undefined"!=typeof k.utm_campaign?k.utm_campaign:"undefined"!=typeof k[x.campaign_param]?k[x.campaign_param]:"undefined"!=typeof k.gclid?"google_cpc":"undefined"!=typeof k.yclid?"yandex_cpc":a.none,m="undefined"!=typeof k.utm_content?k.utm_content:"undefined"!=typeof k[x.content_param]?k[x.content_param]:a.none,l=k.utm_id||a.none,g=k.utm_source_platform||a.none,h=k.utm_creative_format||a.none,y=k.utm_marketing_tactic||a.none,d="undefined"!=typeof k.utm_term?k.utm_term:"undefined"!=typeof k[x.term_param]?k[x.term_param]:function(){var e=document.referrer;if(k.utm_term)return k.utm_term;if(!(e&&s.parse(e).host&&s.parse(e).host.match(/^(?:.*\.)?yandex\..{2,9}$/i)))return!1;try{return s.getParam(s.parse(document.referrer).query).text}catch(t){return!1}}()||a.none;break;case a.traffic.organic:t=a.traffic.organic,r=r||s.getHost(document.referrer),p=a.referer.organic,f=a.none,m=a.none,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;case a.traffic.referral:t=a.traffic.referral,r=r||s.getHost(document.referrer),p=p||a.referer.referral,f=a.none,m=s.parse(document.referrer).path,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;case a.traffic.typein:t=a.traffic.typein,r=x.typein_attributes.source,p=x.typein_attributes.medium,f=a.none,m=a.none,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;default:t=a.oops,r=a.oops,p=a.oops,f=a.oops,m=a.oops,d=a.oops,l=a.oops,g=a.oops,h=a.oops,y=a.oops}var i={type:t,source:r,medium:p,campaign:f,content:m,term:d,id:l,platform:g,format:h,tactic:y};return n.pack.main(i)}function R(e){var t=document.referrer;switch(e){case a.traffic.organic:return!!t&&H(t)&&function(e){var t=new RegExp("^(?:.*\\.)?"+o.escapeRegexp("yandex")+"\\..{2,9}$"),n=new RegExp(".*"+o.escapeRegexp("text")+"=.*"),a=new RegExp("^(?:www\\.)?"+o.escapeRegexp("google")+"\\..{2,9}$");if(s.parse(e).query&&s.parse(e).host.match(t)&&s.parse(e).query.match(n))return r="yandex",!0;if(s.parse(e).host.match(a))return r="google",!0;if(!s.parse(e).query)return!1;for(var i=0;i<x.organics.length;i++){if(s.parse(e).host.match(new RegExp("^(?:.*\\.)?"+o.escapeRegexp(x.organics[i].host)+"$","i"))&&s.parse(e).query.match(new RegExp(".*"+o.escapeRegexp(x.organics[i].param)+"=.*","i")))return r=x.organics[i].display||x.organics[i].host,!0;if(i+1===x.organics.length)return!1}}(t);case a.traffic.referral:return!!t&&H(t)&&function(e){if(!(x.referrals.length>0))return r=s.getHost(e),!0;for(var t=0;t<x.referrals.length;t++){if(s.parse(e).host.match(new RegExp("^(?:.*\\.)?"+o.escapeRegexp(x.referrals[t].host)+"$","i")))return r=x.referrals[t].display||x.referrals[t].host,p=x.referrals[t].medium||a.referer.referral,!0;if(t+1===x.referrals.length)return r=s.getHost(e),!0}}(t);default:return!1}}function H(e){if(x.domain){if(q)return s.getHost(e)!==s.getHost(w);var t=new RegExp("^(?:.*\\.)?"+o.escapeRegexp(w)+"$","i");return!s.getHost(e).match(t)}return s.getHost(e)!==s.getHost(document.location.href)}function D(){i.set(n.containers.current_extra,n.pack.extra(x.timezone_offset),I,w,q),i.get(n.containers.first_extra)||i.set(n.containers.first_extra,n.pack.extra(x.timezone_offset),I,w,q)}return i.setBase64Flag(x.base64),u.go(I,w,q),i.set(n.containers.current,function(){var e;if("undefined"!=typeof k.utm_source||"undefined"!=typeof k.utm_medium||"undefined"!=typeof k.utm_campaign||"undefined"!=typeof k.utm_content||"undefined"!=typeof k.utm_term||"undefined"!=typeof k.utm_id||"undefined"!=typeof k.utm_source_platform||"undefined"!=typeof k.utm_creative_format||"undefined"!=typeof k.utm_marketing_tactic||"undefined"!=typeof k.gclid||"undefined"!=typeof k.yclid||"undefined"!=typeof k[x.campaign_param]||"undefined"!=typeof k[x.term_param]||"undefined"!=typeof k[x.content_param])D(),e=j(a.traffic.utm);else if(R(a.traffic.organic))D(),e=j(a.traffic.organic);else if(!i.get(n.containers.session)&&R(a.traffic.referral))D(),e=j(a.traffic.referral);else{if(i.get(n.containers.first)||i.get(n.containers.current))return i.get(n.containers.current);D(),e=j(a.traffic.typein)}return e}(),I,w,q),i.get(n.containers.first)||i.set(n.containers.first,i.get(n.containers.current),I,w,q),i.get(n.containers.udata)?(_=parseInt(i.parse(n.containers.udata)[i.unsbjs(n.containers.udata)][n.aliases.udata.visits])||1,_=i.get(n.containers.session)?_:_+1,v=n.pack.user(_,x.user_ip)):(_=1,v=n.pack.user(_,x.user_ip)),i.set(n.containers.udata,v,I,w,q),i.get(n.containers.session)?(b=parseInt(i.parse(n.containers.session)[i.unsbjs(n.containers.session)][n.aliases.session.pages_seen])||1,b+=1):b=1,i.set(n.containers.session,n.pack.session(b),x.session_length,w,q),x.promocode&&!i.get(n.containers.promocode)&&i.set(n.containers.promocode,n.pack.promo(x.promocode),I,w,q),i.parse(n.containers)}},{"./data":2,"./helpers/cookies":3,"./helpers/uri":4,"./helpers/utils":5,"./migrations":7,"./params":8,"./terms":9}],7:[function(e,t,r){"use strict";var n=e("./data"),a=e("./helpers/cookies");t.exports={go:function(e,t,r){var i,s=this.migrations,o={l:e,d:t,i:r};if(a.get(n.containers.first)||a.get(n.service.migrations)){if(!a.get(n.service.migrations))for(i=0;i<s.length;i++)s[i].go(s[i].id,o)}else{var c=[];for(i=0;i<s.length;i++)c.push(s[i].id);var u="";for(i=0;i<c.length;i++)u+=c[i]+"=1",i<c.length-1&&(u+=n.delimiter);a.set(n.service.migrations,u,o.l,o.d,o.i)}},migrations:[{id:"1418474375998",version:"1.0.0-beta",go:function(e,t){var r=e+"=1",i=e+"=0",s=function(e,t,r){return t||r?e:n.delimiter};try{var o=[];for(var c in n.containers)n.containers.hasOwnProperty(c)&&o.push(n.containers[c]);for(var u=0;u<o.length;u++)if(a.get(o[u])){var p=a.get(o[u]).replace(/(\|)?\|(\|)?/g,s);a.destroy(o[u],t.d,t.i),a.destroy(o[u],t.d,!t.i),a.set(o[u],p,t.l,t.d,t.i)}a.get(n.containers.session)&&a.set(n.containers.session,n.pack.session(0),t.l,t.d,t.i),a.set(n.service.migrations,r,t.l,t.d,t.i)}catch(f){a.set(n.service.migrations,i,t.l,t.d,t.i)}}}]}},{"./data":2,"./helpers/cookies":3}],8:[function(e,t,r){"use strict";var n=e("./terms"),a=e("./helpers/uri");t.exports={fetch:function(e){var t=e||{},r={};if(r.lifetime=this.validate.checkFloat(t.lifetime)||6,r.lifetime=parseInt(30*r.lifetime*24*60),r.session_length=this.validate.checkInt(t.session_length)||30,r.timezone_offset=this.validate.checkInt(t.timezone_offset),r.base64=t.base64||!1,r.campaign_param=t.campaign_param||!1,r.term_param=t.term_param||!1,r.content_param=t.content_param||!1,r.user_ip=t.user_ip||n.none,t.promocode?(r.promocode={},r.promocode.min=parseInt(t.promocode.min)||1e5,r.promocode.max=parseInt(t.promocode.max)||999999):r.promocode=!1,t.typein_attributes&&t.typein_attributes.source&&t.typein_attributes.medium?(r.typein_attributes={},r.typein_attributes.source=t.typein_attributes.source,r.typein_attributes.medium=t.typein_attributes.medium):r.typein_attributes={source:"(direct)",medium:"(none)"},t.domain&&this.validate.isString(t.domain)?r.domain={host:t.domain,isolate:!1}:t.domain&&t.domain.host?r.domain=t.domain:r.domain={host:a.getHost(document.location.hostname),isolate:!1},r.referrals=[],t.referrals&&t.referrals.length>0)for(var i=0;i<t.referrals.length;i++)t.referrals[i].host&&r.referrals.push(t.referrals[i]);if(r.organics=[],t.organics&&t.organics.length>0)for(var s=0;s<t.organics.length;s++)t.organics[s].host&&t.organics[s].param&&r.organics.push(t.organics[s]);return r.organics.push({host:"bing.com",param:"q",display:"bing"}),r.organics.push({host:"yahoo.com",param:"p",display:"yahoo"}),r.organics.push({host:"about.com",param:"q",display:"about"}),r.organics.push({host:"aol.com",param:"q",display:"aol"}),r.organics.push({host:"ask.com",param:"q",display:"ask"}),r.organics.push({host:"globososo.com",param:"q",display:"globo"}),r.organics.push({host:"go.mail.ru",param:"q",display:"go.mail.ru"}),r.organics.push({host:"rambler.ru",param:"query",display:"rambler"}),r.organics.push({host:"tut.by",param:"query",display:"tut.by"}),r.referrals.push({host:"t.co",display:"twitter.com"}),r.referrals.push({host:"plus.url.google.com",display:"plus.google.com"}),r},validate:{checkFloat:function(e){return!(!e||!this.isNumeric(parseFloat(e)))&&parseFloat(e)},checkInt:function(e){return!(!e||!this.isNumeric(parseInt(e)))&&parseInt(e)},isNumeric:function(e){return!isNaN(e)},isString:function(e){return"[object String]"===Object.prototype.toString.call(e)}}}},{"./helpers/uri":4,"./terms":9}],9:[function(e,t,r){"use strict";t.exports={traffic:{utm:"utm",organic:"organic",referral:"referral",typein:"typein"},referer:{referral:"referral",organic:"organic",social:"social"},none:"(none)",oops:"(Houston, we have a problem)"}},{}]},{},[1])(1)});
!function(t){"use strict";const e=t.params,n=(document.querySelector.bind(document),(t,e)=>e.split(".").reduce((t,e)=>t&&t[e],t)),i=()=>null,s=t=>null===t||t===undefined?"":t,o="wc/store/checkout";function a(t){document.querySelectorAll("wc-order-attribution-inputs").forEach((t,e)=>{e>0&&t.remove()});for(const e of document.querySelectorAll("wc-order-attribution-inputs"))e.values=t}function r(t){window.wp&&window.wp.data&&window.wp.data.dispatch&&window.wc&&window.wc.wcBlocksData&&window.wp.data.dispatch(window.wc.wcBlocksData.CHECKOUT_STORE_KEY).setExtensionData("woocommerce/order-attribution",t,!0)}function c(){return"undefined"!=typeof sbjs}function d(){if(window.wp&&window.wp.data&&"function"==typeof window.wp.data.subscribe){const e=window.wp.data.subscribe(function(){e(),r(t.getAttributionData())},o)}}t.getAttributionData=function(){const s=e.allowTracking&&c()?n:i,o=c()?sbjs.get:{},a=Object.entries(t.fields).map(([t,e])=>[t,s(o,e)]);return Object.fromEntries(a)},t.setOrderTracking=function(n){if(e.allowTracking=n,n){if(!c())return;sbjs.init({lifetime:Number(e.lifetime),session_length:Number(e.session),base64:Boolean(e.base64),timezone_offset:"0"})}else!function(){const t=window.location.hostname;["sbjs_current","sbjs_current_add","sbjs_first","sbjs_first_add","sbjs_session","sbjs_udata","sbjs_migrations","sbjs_promo"].forEach(e=>{document.cookie=`${e}=; path=/; max-age=-999; domain=.${t};`})}();const i=t.getAttributionData();a(i),r(i)},t.setOrderTracking(e.allowTracking),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",d):d(),window.customElements.define("wc-order-attribution-inputs",class extends HTMLElement{constructor(){if(super(),this._fieldNames=Object.keys(t.fields),this.hasOwnProperty("_values")){let t=this.values;delete this.values,this.values=t||{}}}connectedCallback(){this.innerHTML="";const t=new DocumentFragment;for(const n of this._fieldNames){const i=document.createElement("input");i.type="hidden",i.name=`${e.prefix}${n}`,i.value=s(this.values&&this.values[n]||""),t.appendChild(i)}this.appendChild(t)}set values(t){if(this._values=t,this.isConnected)for(const t of this._fieldNames){const n=this.querySelector(`input[name="${e.prefix}${t}"]`);n?n.value=s(this.values[t]):console.warn(`Field "${t}" not found. `+"Most likely, the '<wc-order-attribution-inputs>' element was manipulated.")}}get values(){return this._values}})}(window.wc_order_attribution);
function _callSuper(t,e,s){return e=_getPrototypeOf(e),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(e,s||[],_getPrototypeOf(t).constructor):e.apply(t,s))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function(){return!!t})()}function _superPropGet(t,e,s,a){var n=_get(_getPrototypeOf(1&a?t.prototype:t),e,s);return 2&a&&"function"==typeof n?function(t){return n.apply(s,t)}:n}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,s){var a=_superPropBase(t,e);if(a)return(a=Object.getOwnPropertyDescriptor(a,e)).get?a.get.call(arguments.length<3?t:s):a.value}).apply(null,arguments)}function _superPropBase(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var s=0;s<e.length;s++){var a=e[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,_toPropertyKey(a.key),a)}}function _createClass(t,e,s){return e&&_defineProperties(t.prototype,e),s&&_defineProperties(t,s),Object.defineProperty(t,"prototype",{writable:!1}),t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var s=t[Symbol.toPrimitive];if(void 0===s)return("string"===e?String:Number)(t);s=s.call(t,e||"default");if("object"!=_typeof(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}(c=>{var t=(()=>_createClass(function t(){if(_classCallCheck(this,t),this.css_selector={},this.button_id="fkwcs_stripe_smart_button",this.payment_request=null,this.express_request_type=null,this.express_button_wrapper=null,this.is_product_page=!1,this.style_value=fkwcs_data.style,this.request_data={},this.cart_request_data={},this.add_to_cart_end_point="fkwcs_add_to_cart",this.is_google_ready_to_pay=!1,this.dataCommon={currency:fkwcs_data.currency,country:fkwcs_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0},""!==fkwcs_data.pub_key){try{this.stripe=Stripe(fkwcs_data.pub_key,{locale:fkwcs_data.locale}),this.init()}catch(t){"yes"===fkwcs_data.debug_log&&console.log("Stripe Error",t)}this.wcEvents()}},[{key:"init",value:function(){"yes"===fkwcs_data.is_product?this.request_data=Object.assign(this.dataCommon,{total:fkwcs_data.single_product.total,requestShipping:"yes"===fkwcs_data.single_product.requestShipping,displayItems:fkwcs_data.single_product.displayItems}):"yes"===fkwcs_data.is_cart&&(this.request_data=Object.assign(this.dataCommon,{total:fkwcs_data.cart_data.order_data.total,requestShipping:"yes"===fkwcs_data.shipping_required,displayItems:fkwcs_data.cart_data.displayItems})),this.setupPaymentRequest()}},{key:"ajaxEndpoint",value:function(t){var e="";return e=fkwcs_data.hasOwnProperty("wc_endpoints")&&fkwcs_data.wc_endpoints.hasOwnProperty(t)?fkwcs_data.wc_endpoints[t]:e}},{key:"setRequestData",value:function(t){var e,s;t.hasOwnProperty("order_data")&&(e=c('input[name="payment_method"]:checked'),s="yes"===t.shipping_required,0<e.length&&"fkwcs_stripe_apple_pay"===e.val()&&(s=!1),this.request_data=Object.assign(this.dataCommon,{total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestShipping:s,displayItems:t.order_data.displayItems}))}},{key:"getRequestData",value:function(){return this.request_data}},{key:"setupPaymentRequest",value:function(){var t=this.getRequestData();if(0!==Object.keys(t).length)try{var e=this.stripe.paymentRequest(t);this.productEvents(e),e.canMakePayment().then(this.makePayment.bind(this)).catch(this.makePaymentCatch.bind(this)),e.on("paymentmethod",this.onPaymentMethod.bind(this)),e.on("shippingaddresschange",this.shippingAddressChange.bind(this)),e.on("shippingoptionchange",this.shippingOptionChange.bind(this)),e.on("cancel",this.cancelPayment.bind(this))}catch(t){console.log(t)}}},{key:"productEvents",value:function(s){var a=this,n=(c(".fkwcs_smart_cart_button").off("click").on("click",function(t){s.show(),t.preventDefault()}),c("body").off("click",".fkwcs_smart_checkout_button").on("click",".fkwcs_smart_checkout_button",function(t){s.show(),t.preventDefault()}),c("button.fkwcs_smart_product_button"));n.off("click").on("click",function(t){var e=c("form.cart button.single_add_to_cart_button");if(!c(this).hasClass("fkwcs_disabled_btn"))return s.show(),t.preventDefault(),c.when(a.addToCartProduct());e.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):e.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)}),c(document.body).off("show_variation").on("show_variation",function(t,e,s){s?n.removeClass("fkwcs_disabled_btn"):n.addClass("fkwcs_disabled_btn")}),c(document.body).off("hide_variation").on("hide_variation",function(){n.addClass("fkwcs_disabled_btn")}),c(document.body).off("woocommerce_variation_has_changed").on("woocommerce_variation_has_changed",function(){a.updateSelectedProductsData(s)}),c("form.cart .quantity").off("input").on("input",".qty",function(){a.updateSelectedProductsData(s)})}},{key:"updateSelectedProductsData",value:function(e){c.when(this.prepareSelectedProductData()).then(function(t){t.error?self.showErrorMessage(t.error):c.when(e.update({total:t.total,displayItems:t.displayItems})).then(function(){})})}},{key:"createButton",value:function(t){}},{key:"makePayment",value:function(t){var e=c(".fkwcs_smart_buttons");if(t){var s=c(".fkwcs_express_checkout_button_icon"),a=c(".fkwcs_stripe_smart_button_wrapper"),n=c("#fkwcs-payment-request-separator"),r="";if(!0!==this.is_google_ready_to_pay||"yes"!==fkwcs_data.google_pay_as_express||!1!==t.applePay&&null!==t.applePay){if(t.applePay)this.express_request_type="apple_pay",this.express_button_wrapper="fkwcs_ec_applepay_button",r="dark"===fkwcs_data.style.theme?fkwcs_data.icons.applepay_light:fkwcs_data.icons.applepay_gray;else if(t.googlePay)this.express_request_type="google_pay",this.express_button_wrapper="fkwcs_ec_googlepay_button",r="dark"===fkwcs_data.style.theme?fkwcs_data.icons.gpay_light:fkwcs_data.icons.gpay_gray;else{if(!this.linkEnabled())return void e.hide();this.express_request_type="payment_request_api",this.express_button_wrapper="fkwcs_ec_link_button",r=fkwcs_data.icons.link}a.hasClass("fkwcs_hide_button")||e.show(),this.makeButtonVisibleInline(),this.buttonOnProductPage(),this.buttonOnCartPage(),this.buttonOnCheckoutPage(),s.hide(),e.addClass("fkwcs_express_"+this.express_request_type),e.removeClass("fkwcs_ec_payment_button-"+fkwcs_data.style.theme),e.addClass(this.express_button_wrapper+"-"+fkwcs_data.style.theme),""!==r&&(s.attr("src",r),s.show()),n.hasClass("cart")&&n.show(),n.hasClass("checkout")&&n.show(),!n.hasClass("fkwcs-product")||a.hasClass("inline")||n.show(),a.length&&(a.css("display","block"),c(document.body).trigger("fkwcs_smart_buttons_showed",["stripe",t])),"inline"===fkwcs_data.style.button_position&&a.hasClass("fkwcs-product")&&(document.getElementById("fkwcs_stripe_smart_button_wrapper").style.display="inline-block")}else t.googlePay=!1,t.link=!1}else"yes"===fkwcs_data.debug_log&&(console.log(fkwcs_data.debug_msg),e.hide()),c(document.body).trigger("fkwcs_smart_buttons_not_available")}},{key:"onPaymentMethod",value:function(e){var s=this,t=this.paymentMethodData(e);c.ajax({type:"POST",data:t,dataType:"text",url:this.ajaxEndpoint("wc_stripe_create_order"),success:function(t){t=(t=>{if(!(t=t.match(/\{(?:[^{}]|(\{[^{}]*\}))*\}/)))return console.warn("No JSON object found in response."),null;try{return JSON.parse(t[0])}catch(t){return console.error("Failed to parse JSON:",t),null}})(t);t&&"success"===t.result?!1===s.confirmPaymentIntent(e,t.redirect)&&(window.location=t.redirect):s.abortPayment(e,t?t.messages:"Error processing payment")}})}},{key:"addToCartProduct",value:function(){var t=c(".single_add_to_cart_button").val(),e=c(".single_variation_wrap"),e=(e.length&&(t=e.find('input[name="product_id"]').val()),c(".quantity .qty").val()),a={fkwcs_nonce:fkwcs_data.fkwcs_nonce,action:"add_to_cart",product_id:t,qty:e,attributes:c(".variations_form").length?this.getVariationAttributes().attributes:[]},t=c("form.cart").serializeArray();return c.each(t,function(t,e){var s;/^addon-/.test(e.name)&&(/\[\]$/.test(e.name)?(s=e.name.substring(0,e.name.length-2),a[s]?a[s].push(e.value):a[s]=[e.value]):a[e.name]=e.value),"sublium-option-plan"===e.name&&(a[e.name]=e.value)}),c.ajax({type:"POST",data:a,url:this.ajaxEndpoint(this.add_to_cart_end_point),success:function(t){c(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,c(".single_add_to_cart_button")])}})}},{key:"prepareSelectedProductData",value:function(){var t=c(".single_variation_wrap"),e=c(".single_add_to_cart_button").val(),t=(0<t.length&&(e=c(".single_variation_wrap").find('input[name="product_id"]').val()),c("#product-addons-total")),s=0,t=(0<t.length&&(s=(t.data("price_data")||[]).reduce(function(t,e){return t+e.cost},0)),{fkwcs_nonce:fkwcs_data.fkwcs_nonce,product_id:e,qty:c(".quantity .qty").val(),addon_value:s,attributes:c(".variations_form").length?this.getVariationAttributes().attributes:[]});return c.ajax({type:"POST",data:t,url:this.ajaxEndpoint("fkwcs_selected_product_data")})}},{key:"logError",value:function(t){c.ajax({type:"POST",url:fkwcs_data.admin_ajax,data:{action:"fkwcs_js_errors",_security:fkwcs_data.js_nonce,failed:2<arguments.length&&void 0!==arguments[2]&&arguments[2],error:t}})}},{key:"getVariationAttributes",value:function(){var t=c(".variations_form").first().find(".variations select"),e={},s=0;return t.each(function(){var t=c(this).data("attribute_name")||c(this).attr("name");e[t]=c(this).val()||"",s++}),{count:s,chosenCount:0,attributes:e}}},{key:"paymentMethodData",value:function(t){var e=t.paymentMethod,s=e.billing_details,a=s.email,n=s.phone,r=s.address,s=s.name,o=t.shippingAddress,i={fkwcs_nonce:fkwcs_data.fkwcs_nonce,billing_first_name:null!==s?s.split(" ").slice(0,1).join(" "):"test",billing_last_name:null!==s?s.split(" ").slice(1).join(" "):"test",billing_company:"",billing_email:null!==a?a:t.payerEmail,billing_phone:null!==n?n:t.payerPhone&&t.payerPhone.replace("/[() -]/g",""),order_comments:"",payment_method:"fkwcs_stripe",terms:1,fkwcs_source:e.id,payment_request_type:this.express_request_type};return 0<c('input[name="billing_email"]').length&&""!==c('input[name="billing_email"]').val()&&(i.billing_email=c('input[name="billing_email"]').val()),"apple_pay"===this.express_request_type&&0<c("li.payment_method_fkwcs_stripe_apple_pay").length&&(i.payment_method="fkwcs_stripe_apple_pay"),i=this.prepareBillingAddress(i,r),i=this.prepareShippingAddress(i,o),"yes"===fkwcs_data.is_checkout?(null!==t.shippingOption&&c('input[name="shipping_method[0]"][value="'+t.shippingOption.id+'"]').prop("checked",!0),s=c("form[name=checkout]").serializeArray(),c.each(s,function(t,e){!1!==Object.prototype.hasOwnProperty.call(i,e.name)&&""!==i[e.name]||(i[e.name]=e.value)}),i.page_from="checkout"):"yes"===fkwcs_data.is_product?i.page_from="product":i.page_from="cart",!0===Object.prototype.hasOwnProperty.call(i,"wc-fkwcs_stripe-payment-token")&&delete i["wc-fkwcs_stripe-payment-token"],i=JSON.parse(JSON.stringify(i))}},{key:"prepareBillingAddress",value:function(t,e){return null!==e&&(t.billing_address_1=null!==e?e.line1:"",t.billing_address_2=null!==e?e.line2:"",t.billing_city=null!==e?e.city:"",t.billing_state=null!==e?e.state:"",t.billing_postcode=null!==e?e.postal_code:"",t.billing_country=null!==e?e.country:""),t}},{key:"prepareShippingAddress",value:function(t,e){return e&&(t.shipping_first_name=e.recipient.split(" ").slice(0,1).join(" "),t.shipping_last_name=e.recipient.split(" ").slice(1).join(" "),t.shipping_company=e.organization,t.shipping_country=e.country,t.shipping_address_1=void 0===e.addressLine[0]?"":e.addressLine[0],t.shipping_address_2=void 0===e.addressLine[1]?"":e.addressLine[1],t.shipping_city=e.city,t.shipping_state=e.region,t.hasOwnProperty("billing_phone")&&(t.shipping_phone=t.billing_phone),t.shipping_postcode=e.postalCode,t.ship_to_different_address=1),t}},{key:"confirmPaymentIntent",value:function(t,e){var s=e.match(/^#?fkwcs-confirm-(pi|si)-([^:]+):(.+):(.+):(.+):(.+)$/);if(!s||s.length<5)return window.location.redirect=e,!1;var e=s[1],a=s[2],s=decodeURIComponent(s[3]);this.confirmPayment(t,a,s,e)}},{key:"confirmPayment",value:function(s,a,n,r){var o=this,t=null,t="si"===r?this.stripe.handleCardSetup(a,{payment_method:s.paymentMethod.id},{handleActions:!1}):this.stripe.confirmCardPayment(a,{payment_method:s.paymentMethod.id},{handleActions:!1}),i=c("form.woocommerce-checkout");t.then(function(t){var e;t.error?(o.logError(t.error),c(".woocommerce-error").remove(),i.unblock(),c(".woocommerce-notices-wrapper:first-child").html('<div class="woocommerce-error fkwcs-errors">'+t.error.message+"</div>").show(),s.complete("fail")):(s.complete("success"),"requires_action"===(t=t["si"===r?"setupIntent":"paymentIntent"]).status||"requires_source_action"===t.status?(e=o,("si"===r?o.stripe.handleCardSetup(a):o.stripe.confirmCardPayment(a)).then(function(t){t.error?(e.logError(t.error),c(".woocommerce-error").remove(),i.unblock(),c(".woocommerce-notices-wrapper:first-child").html('<div class="woocommerce-error fkwcs-errors">'+t.error.message+"</div>").show()):(i.addClass("processing"),i.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),window.location=n)})):(i.addClass("processing"),i.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),window.location=n))})}},{key:"abortPayment",value:function(t,e){t.complete("success"),this.showErrorMessage(e)}},{key:"shippingAddressChange",value:function(e){var t=e.shippingAddress,t={fkwcs_nonce:fkwcs_data.fkwcs_nonce,country:t.country,state:t.region,postcode:t.postalCode,city:t.city,address:void 0===t.addressLine[0]?"":t.addressLine[0],address_2:void 0===t.addressLine[1]?"":t.addressLine[1],payment_request_type:this.express_request_type,is_product_page:this.is_product_page};return c.ajax({type:"POST",data:t,url:this.ajaxEndpoint("fkwcs_update_shipping_address"),success:function(t){"success"===t.result?e.updateWith({status:t.result,total:t.total,shippingOptions:t.shipping_methods,displayItems:t.displayItems}):"fail"===t.result&&e.updateWith({status:"fail"})}})}},{key:"shippingOptionChange",value:function(e){var t=e.shippingOption,t={fkwcs_nonce:fkwcs_data.fkwcs_nonce,shipping_method:[t.id],payment_request_type:this.express_request_type,is_product_page:this.is_product_page};return c.ajax({type:"POST",data:t,url:this.ajaxEndpoint("fkwcs_update_shipping_option"),success:function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})}})}},{key:"makePaymentCatch",value:function(t){console.log("error",t)}},{key:"cancelPayment",value:function(){c(document.body).trigger("fkwcs_express_cancel_payment",this)}},{key:"showErrorMessage",value:function(t){c(".woocommerce-error").remove(),("no"!==fkwcs_data.is_product?c(".product").first():c("form.checkout").closest("form")).before(t),window.scrollTo({top:100,behavior:"smooth"})}},{key:"getCartDetails",value:function(){var t={fkwcs_nonce:fkwcs_data.fkwcs_nonce},e=this;c.ajax({type:"POST",data:t,url:this.ajaxEndpoint("fkwcs_get_cart_details"),success:function(t){t.success&&(e.setRequestData(t.data),e.setupPaymentRequest())}})}},{key:"wcEvents",value:function(){var a=this,s=this;c(document.body).on("updated_checkout",function(t,e){try{e&&e.fragments&&(s.setRequestData(e.fragments.fkwcs_cart_details),s.setupPaymentRequest(),!1===e.fragments.fkwcs_cart_details.is_fkwcs_need_payment?document.getElementById("fkwcs_stripe_smart_button_wrapper").classList.add("fkwcs_hide_button"):document.getElementById("fkwcs_stripe_smart_button_wrapper").classList.remove("fkwcs_hide_button"))}catch(t){}}),c(document.body).on("updated_cart_totals",function(){s.getCartDetails()}),c(document.body).on("wc_fragments_refreshed added_to_cart removed_from_cart wc_fragments_loaded",function(t,e){setTimeout(function(){if("undefined"==typeof wc_cart_fragments_params)return!1;var t;"undefined"!=typeof Storage&&(t=sessionStorage.getItem(wc_cart_fragments_params.fragment_name),"object"===_typeof(t=JSON.parse(t)))&&t.hasOwnProperty("fkwcs_cart_details")&&(a.cart_request_data=t.fkwcs_cart_details,"yes"!==fkwcs_data.is_product)&&(s.setRequestData(t.fkwcs_cart_details),s.setupPaymentRequest())},300)}),c(document.body).on("fkwcs_express_button_init",function(){var t=c("#fkcart-modal");"yes"===fkwcs_data.is_product&&!t.hasClass("fkcart-show")||(0<Object.keys(a.cart_request_data).length&&a.setRequestData(a.cart_request_data),a.setupPaymentRequest())}),c(document.body).on("fkwcs_express_button_update_cart_details",function(t,e){e.hasOwnProperty("fkwcs_cart_details")&&(a.setRequestData(e.fkwcs_cart_details),a.setupPaymentRequest())}),c(document.body).on("fkcart_fragments_refreshed",function(t,e){var s=c("#fkcart-modal");void 0!==e&&e.hasOwnProperty("fkwcs_cart_details")&&(a.cart_request_data=e.fkwcs_cart_details,s.hasClass("fkcart-show"))&&(a.setRequestData(a.cart_request_data),a.setupPaymentRequest())}),c(document.body).on("fkwcs_google_ready_pay",function(){s.is_google_ready_to_pay=!0}),c(document.body).on("fkcart_cart_closed",function(){var t;"yes"===fkwcs_data.is_product&&((t=c("form.cart").find(".qty")).length&&t.val(1),a.request_data=Object.assign(a.dataCommon,{total:fkwcs_data.single_product.total,requestShipping:"yes"===fkwcs_data.single_product.requestShipping,displayItems:fkwcs_data.single_product.displayItems}),a.setupPaymentRequest())})}},{key:"setCss",value:function(t,e,s){this.css_selector.hasOwnProperty(t)||(this.css_selector[t]={}),this.css_selector[t][e]=s}},{key:"applyCss",value:function(){for(var t in this.css_selector)if(0!==Object.keys(this.css_selector[t]).length)for(var e in this.css_selector[t])c(t).css(e,this.css_selector[t][e])}},{key:"buttonOnProductPage",value:function(){var t,e,s,a,n;1==fkwcs_data.is_product_page&&0!==c("form.cart button.single_add_to_cart_button").length&&(t=c("form.cart button.single_add_to_cart_button:visible"),e=c(".fkwcs_smart_buttons"),s=10<this.style_value.button_length?"min-width":"width",!(a="px")!==e.hasClass("fkwcs_smart_product_button"))&&("above"===this.style_value.button_position?(this.setCss("#fkwcs_stripe_smart_button_wrapper","width","100%"),this.setCss("#fkwcs-payment-request-separator","width","200px"),this.setCss("form.cart button.single_add_to_cart_button",s,"200px"),this.setCss("form.cart button.single_add_to_cart_button","float","left"),this.setCss("form.cart","display","inline-block"),this.setCss(".fkwcs_smart_buttons",s,"200px")):(n=t.outerWidth(),0<c("form.cart .quantity").length&&(n=n+c("form.cart .quantity").width()+parseInt(c("form.cart .quantity").css("marginRight").replace("px",""))),"inline"===this.style_value.button_position?(n=(n=t.outerWidth())<120?150:n,c("form.cart").width()<500&&this.makeButtonVisibleInline(),this.setCss("form.cart button.single_add_to_cart_button",s,n+"px")):(this.setCss("form.grouped_form button.single_add_to_cart_button",s,n+"px"),0<c(".theme-kadence button.single_add_to_cart_button").length&&(this.setCss(".theme-kadence button.single_add_to_cart_button",s,(n=100)+(a="%")),this.setCss(".theme-kadence button.single_add_to_cart_button","margin-top","20px"))),this.setCss("#fkwcs_stripe_smart_button_wrapper",s,n+a),this.setCss("form.cart .fkwcs_smart_buttons",s,n+a),"below"===this.style_value.button_position&&(this.setCss(".theme-twentytwentytwo .fkwcs_smart_buttons",s,t.outerWidth()+"px"),this.setCss(".theme-twentytwentytwo #fkwcs-payment-request-separator",s,t.outerWidth()+"px"))),this.applyCss(),this.expressBtnStyle(e,t))}},{key:"buttonOnCartPage",value:function(){var t,e;"yes"===fkwcs_data.is_cart&&0!==c(".wc-proceed-to-checkout .checkout-button").length&&(t=c(".wc-proceed-to-checkout .checkout-button"),e=c(".fkwcs_smart_buttons"),30<c(".place-order #place_order").outerHeight()&&this.setCss(".fkwcs_smart_buttons","height",t.outerHeight()+"px"),this.setCss(".fkwcs_smart_buttons","font-size",t.css("font-size")),this.applyCss(),this.expressBtnStyle(e,t))}},{key:"buttonOnCheckoutPage",value:function(){var t=c(".woocommerce-billing-fields");"yes"===fkwcs_data.is_checkout&&0!==t.length&&(this.setCss("#fkwcs_stripe_smart_button_wrapper","max-width",t.outerWidth(!0)),this.applyCss())}},{key:"expressBtnStyle",value:function(s,a){c.each(["padding","border-radius","box-shadow","font-weight","text-shadow","font-size","line-height","padding"],function(t,e){s.css(e,a.css(e))}),s.css("max-height",a.outerHeight()+"px")}},{key:"makeButtonVisibleInline",value:function(){var t,e,s="",a=c("#fkwcs_stripe_smart_button_wrapper");0!==a.length&&(a.hasClass("inline")&&(t=(a=a.parent()).children(".single_add_to_cart_button"),e=a.children(".quantity"),s=a.outerWidth()-((a=t.outerWidth())+e.outerWidth()+10),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","marginRight",e.css("marginRight")),a<s?(this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","margin",0),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","marginRight",e.css("marginRight")),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","clear","unset"),this.setCss("#fkwcs_stripe_smart_button_wrapper","margin","0px"),this.setCss("#fkwcs_stripe_smart_button_wrapper","display","inline-block")):(this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","margin","10px 0"),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","flex","initial"),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","clear","both"),this.setCss("#fkwcs_stripe_smart_button_wrapper .theme-flatsome .cart .quantity","width","100%"),this.setCss("#fkwcs_stripe_smart_button_wrapper .theme-flatsome .cart .quantity","clear","both"),this.setCss("#fkwcs_stripe_smart_button_wrapper","maringTop","10px"),this.setCss("#fkwcs_stripe_smart_button_wrapper","display","block")),60<(s=t.outerHeight())&&this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","height","60"),s<35&&this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","height","35"),c("#fkwcs_stripe_smart_button_wrapper").width(a)),this.applyCss())}},{key:"linkEnabled",value:function(){return"yes"===fkwcs_data.link_button_enabled&&"yes"===fkwcs_data.express_pay_enabled}}]))(),e=(()=>{function s(){return _classCallCheck(this,s),_callSuper(this,s)}return _inherits(s,t),_createClass(s,[{key:"init",value:function(){fkwcs_data.hasOwnProperty("google_pay_as_express")&&"yes"===fkwcs_data.google_pay_as_express&&(this.google_pay_client=null,this.shipping_options=[],this.request_data={},this.google_is_ready=null,this.add_to_cart_end_point="fkwcs_gpay_add_to_cart",this.gateway_id="fkwcs_stripe_google_pay",this.createPaymentClient())}},{key:"googlePayVersion",value:function(){return{apiVersion:2,apiVersionMinor:0}}},{key:"getBaseCardBrand",value:function(){return{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],assuranceDetailsRequired:!0},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":fkwcs_data.pub_key}}}}},{key:"getMerchantData",value:function(){var t={environment:"test"===fkwcs_data.mode?"TEST":"PRODUCTION",merchantId:fkwcs_data.google_pay.merchant_id,merchantName:fkwcs_data.google_pay.merchant_name,paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(t){t({transactionState:"SUCCESS"})}.bind(this))}}};return"test"===fkwcs_data.mode&&delete t.merchantId,this.shippingAddressRequired()&&(t.paymentDataCallbacks.onPaymentDataChanged=this.paymentDataChanged.bind(this)),t}},{key:"createGooglePayButton",value:function(t){return c("<div class='fkwcs_google_pay_wrapper fkwcs_smart_product_button ".concat(1<arguments.length&&void 0!==arguments[1]?arguments[1]:"","'></div>")).html(this.google_pay_client.createButton(t))}},{key:"createPaymentClient",value:function(){var t=this;try{this.google_pay_client=new google.payments.api.PaymentsClient(this.getMerchantData());var e=this.googlePayVersion();e.allowedPaymentMethods=[this.getBaseCardBrand ()],this.google_pay_client.isReadyToPay(e).then(function(){t.google_is_ready=!0,c(document.body).trigger("fkwcs_google_ready_pay",[t.google_pay_client]),t.createCheckoutExpressBtn()}).catch(function(t){console.log("error",t)})}catch(t){console.log(t)}}},{key:"buttonOnProductPage",value:function(){var t,e,s,a,n,r=this;1==fkwcs_data.is_product_page&&0!==c("form.cart button.single_add_to_cart_button").length&&(t=c("form.cart button.single_add_to_cart_button:visible"),e=c(".fkwcs_smart_buttons"),s=10<this.style_value.button_length?"min-width":"width",!(a="px")!==e.hasClass("fkwcs_smart_product_button"))&&("above"===this.style_value.button_position?(this.setCss("#fkwcs_stripe_smart_button_wrapper","width","100%"),this.setCss("#fkwcs-payment-request-separator","width","200px"),this.setCss("form.cart button.single_add_to_cart_button",s,"200px"),this.setCss("form.cart button.single_add_to_cart_button","float","left"),this.setCss("form.cart","display","inline-block"),this.setCss(".fkwcs_smart_buttons",s,"200px")):(n=t.outerWidth(),0<c("form.cart .quantity").length&&(n=n+c("form.cart .quantity").width()+parseInt(c("form.cart .quantity").css("marginRight").replace("px",""))),"inline"===this.style_value.button_position?(n=(n=t.outerWidth())<120?150:n,c("form.cart").width()<500&&this.makeButtonVisibleInline(),this.setCss("form.cart button.single_add_to_cart_button",s,n+"px"),this.setCss("#fkwcs_stripe_smart_button_wrapper.fkwcs-product","display","inline-block")):(this.setCss("form.grouped_form button.single_add_to_cart_button",s,n+"px"),0<c(".theme-kadence button.single_add_to_cart_button").length&&(this.setCss(".theme-kadence button.single_add_to_cart_button",s,(n=100)+(a="%")),this.setCss(".theme-kadence button.single_add_to_cart_button","margin-top","20px"))),this.setCss("#fkwcs_stripe_smart_button_wrapper",s,n+a),this.setCss("form.cart .fkwcs_smart_buttons",s,n+a),setTimeout(function(t){r.setCss("#fkwcs_stripe_smart_button_wrapper .gpay-card-info-container",s,t+"px"),r.setCss("#fkwcs_stripe_smart_button_wrapper .gpay-card-info-container","min-width",t+"px"),r.setCss("#fkwcs_stripe_smart_button_wrapper .gpay-card-info-iframe","width",t+"px"),r.applyCss()},300,n),"below"===this.style_value.button_position&&(this.setCss(".theme-twentytwentytwo .fkwcs_smart_buttons",s,t.outerWidth()+"px"),this.setCss(".theme-twentytwentytwo #fkwcs-payment-request-separator",s,t.outerWidth()+"px"))),this.applyCss(),this.expressBtnStyle(e,t))}},{key:"createCheckoutExpressBtn",value:function(){var t,a=this,e=(c("#fkwcs_stripe_smart_button_wrapper").css("display","block"),c("#fkwcs_custom_express_button"));0<e.length&&("1"===fkwcs_data.is_product_page||"yes"===fkwcs_data.is_product_page?(e.after(this.createGooglePayButton(this.getSingleProductExpressOptions(),"fkwcs-single-product")),this.buttonOnProductPage(),t=c("form.cart .fkwcs_google_pay_wrapper"),c(document.body).off("show_variation").on("show_variation",function(){t.removeClass("fkwcs_disabled_btn")}),c(document.body).off("hide_variation").on("hide_variation",function(){t.addClass("fkwcs_disabled_btn")})):"1"!==fkwcs_data.is_cart&&"yes"!==fkwcs_data.is_cart||(e.after(this.createGooglePayButton(this.getCartExpressOptions(),"fkwcs-woocommerce-cart")),c(document.body).on("wc_fragments_refreshed",function(t,e){setTimeout(function(){var t;"sessionStorage"in window&&null!==window.sessionStorage&&null!=(t=sessionStorage.getItem(wc_cart_fragments_params.fragment_name))&&"object"===_typeof(t=JSON.parse(t))&&t.hasOwnProperty("fkwcs_google_pay_data")&&(fkwcs_data.gpay_cart_data=t.fkwcs_google_pay_data,c("#fkwcs_stripe_smart_button_wrapper").css("display","block"),c(".fkwcs-woocommerce-cart").remove(),c("#fkwcs_custom_express_button").after(a.createGooglePayButton(a.getCartExpressOptions(),"fkwcs-woocommerce-cart")))},1e3)}))),c(document.body).on("added_to_cart fkcart_fragments_refreshed",function(t,e){void 0!==e&&e.hasOwnProperty("fkwcs_google_pay_data")&&(fkwcs_data.gpay_cart_data=e.fkwcs_google_pay_data)}),c(document.body).on("fkwcs_generate_fkcart_mini_button",function(){c(".fkwcs_fkcart_gpay_wrapper").html(a.createGooglePayButton(a.getCartExpressOptions(),"mini-cart"));for(var t=c("#fkcart-modal .fkcart-checkout-wrap #fkcart-checkout-button"),e=["font-size","font-weight","border-radius","line-height"],s=0;s<e.length;s++)c(".fkcart-checkout-wrap.fkcart-panel.fkwcs_fkcart_gpay_wrapper button").css(e[s],t.css(e[s]))})}},{key:"getSingleProductExpressOptions",value:function(){return{buttonColor:fkwcs_data.google_pay_btn_color,buttonType:fkwcs_data.google_pay_btn_theme,buttonSizeMode:"fill",onClick:this.startSingleProductCheckout.bind(this)}}},{key:"getCartExpressOptions",value:function(){return{buttonColor:fkwcs_data.google_pay_btn_color,buttonType:fkwcs_data.google_pay_btn_theme,buttonSizeMode:"fill",onClick:this.startExpressCartGpayPayment.bind(this)}}},{key:"startExpressCartGpayPayment",value:function(){var t=fkwcs_data.gpay_cart_data||fkwcs_data.gpay_single_product;t&&this.update_transaction_data(t),this.startSingleProductGpayPayment()}},{key:"startSingleProductCheckout",value:function(){var e=this;try{c.when(this.addToCartProduct()).then(function(t){e.update_transaction_data(null==t||null==(t=t.fragments)?void 0:t.fkwcs_google_pay_data),e.startSingleProductGpayPayment()})}catch(t){}}},{key:"startSingleProductGpayPayment",value:function(){var e=this;this.google_pay_client.loadPaymentData(this.buildGpayPaymentData()).then(this.productSingleProductGpayData.bind(this)).catch(function(t){console.log("error",t),"CANCELED"!==t.statusCode&&(t.statusMessage&&-1<t.statusMessage.indexOf("paymentDataRequest.callbackIntent")?e.showError({message:"DEVELOPER_ERROR_WHITELIST"}):e.showError({message:t.statusMessage}))})}},{key:"buildGpayPaymentData",value:function(){var t=c.extend({},this.googlePayVersion(),{emailRequired:!0,environment:"test"===fkwcs_data.mode?"TEST":"PRODUCTION",merchantInfo:{merchantName:fkwcs_data.google_pay.merchant_name,merchantId:fkwcs_data.google_pay.merchant_id},allowedPaymentMethods:[this.getBaseCardBrand ()]});return t.shippingAddressRequired=this.shippingAddressRequired(),t.callbackIntents=["PAYMENT_AUTHORIZATION"],t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressRequired&&(t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:!0}),(t=c.extend(t,this.request_data)).shippingAddressRequired&&(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.shipping_options},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]),t}},{key:"paymentDataChanged",value:function(t){var s=this;return new Promise(function(e){s.update_payment_data(t).then(function(t){"fail"===t.result?e({error:{reason:"SHIPPING_ADDRESS_UNSUPPORTED",message:fkwcs_data.shipping_error,intent:"SHIPPING_ADDRESS"}}):e(t.paymentRequestUpdate)}).catch(function(t){e({error:{reason:"SHIPPING_ADDRESS_UNSUPPORTED",message:fkwcs_data.shipping_error,intent:"SHIPPING_ADDRESS"}})})})}},{key:"update_transaction_data",value:function(t){var e=t.order_data.displayItems;this.request_data={transactionInfo:{countryCode:t.order_data.country_code.toUpperCase(),currencyCode:t.order_data.currency.toUpperCase(),totalPriceStatus:"ESTIMATED",totalPrice:t.order_data.total.amount.toString(),displayItems:e,totalPriceLabel:t.order_data.total.label}},null!=t&&t.shipping_options&&(this.shipping_options=null==t?void 0:t.shipping_options)}},{key:"mapAddress",value:function(t,e){var s={};return e.hasOwnProperty("address1")&&(s.line_1=null==e?void 0:e.address1),e.hasOwnProperty("address2")&&(s.line_2=(null==e?void 0:e.address2)+(null==e?void 0:e.address3)),e.hasOwnProperty("locality")&&(s.city=null==e?void 0:e.locality),e.hasOwnProperty("postalCode")&&(s.postal_code=null==e?void 0:e.postalCode),e.hasOwnProperty("administrativeArea")&&(s.state=null==e?void 0:e.administrativeArea),e.hasOwnProperty("countryCode")&&(s.country=null==e?void 0:e.countryCode),e.hasOwnProperty("name")&&(s.name=e.name),s}},{key:"updateAddress",value:function(t){var e={},s=t.hasOwnProperty("shippingAddress")?t.shippingAddress:null,a=(null!==s&&(e.shipping=this.mapAddress("shipping",s),e.shipping.shipping_method=null==t?void 0:t.shippingOptionData),t.hasOwnProperty("paymentMethodData")&&t.paymentMethodData.hasOwnProperty("info")&&t.paymentMethodData.info.hasOwnProperty("billingAddress")?t.paymentMethodData.info.billingAddress:null);return null!==a&&(e.billing=this.mapAddress("billing",a)),null==a&&null!==s&&(e.billing=this.mapAddress("billing",s)),null!==a&&a.hasOwnProperty("phoneNumber")&&(e.phone=null==a?void 0:a.phoneNumber),null!=t&&t.email&&(e.email=null==t?void 0:t.email),null!=t&&t.phone&&(e.phone=null==t?void 0:t.phone),e}},{key:"map_google_pay_address",value:function(t){return{country:t.countryCode,postcode:t.postalCode,city:t.locality,state:t.administrativeArea}}},{key:"update_payment_data",value:function(s,a){var n=this;return new Promise(function(e){var t="default"===s.shippingOptionData.id?null:s.shippingOptionData.id;c.ajax({url:fkwcs_data.wc_endpoints.fkwcs_gpay_update_shipping_address,dataType:"json",method:"POST",data:c.extend({fkwcs_nonce:fkwcs_data.fkwcs_nonce},{shipping_address:n.map_google_pay_address(s.shippingAddress),shipping_method:[t]},a),success:function(t){e(t)}})})}},{key:"productSingleProductGpayData",value:function(t){var s=this,e=JSON.parse(t.paymentMethodData.tokenizationData.token),a=this.updateAddress(t),t={name:a.billing.name,email:a.email,phone:null==a?void 0:a.phone,address:{country:null==(t=a.billing)?void 0:t.country,city:null==(t=a.billing)?void 0:t.city,postal_code:null==(t=a.billing)?void 0:t.postal_code,state:null==(t=a.billing)?void 0:t.state,line1:null==(t=a.billing)?void 0:t.line1,line2:null==(t=a.billing)?void 0:t.line2}};c("body").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),this.stripe.createPaymentMethod({type:"card",card:{token:e.id},billing_details:t}).then(function(e){if(e.error)return s.showError(e.error);a.paymentMethod=e.paymentMethod.id,c.ajax({type:"POST",data:s.prepareCheckoutData(a),dataType:"text",url:s.ajaxEndpoint("fkwcs_gpay_button_payment_request"),success:function(t){t=(t=>{if(!(t=t.match(/\{(?:[^{}]|(\{[^{}]*\}))*\}/)))return console.warn("No JSON object found in response."),null;try{return JSON.parse(t[0])}catch(t){return console.error("Failed to parse JSON:",t),null}})(t);t&&"success"===t.result?!1===s.confirmPaymentIntent(e,t.redirect)&&(window.location=t.redirect):(c("body").unblock(),window.location.reload())}})}).catch(function(){c("body").unblock()})}},{key:"prepareCheckoutData",value:function(t){var e=t.paymentMethod,s=t.email,a=null==t?void 0:t.phone,n=t.billing,r=t.billing.name,t=t.shipping,r={fkwcs_nonce:fkwcs_data.fkwcs_nonce,billing_first_name:null!==r?r.split(" ").slice(0,1).join(" "):"test",billing_last_name:null!==r?r.split(" ").slice(1).join(" "):"test",billing_company:"",billing_email:0<c('input[name="billing_email"]').length&&""!==c('input[name="billing_email"]').val()?c('input[name="billing_email"]').val():s,billing_phone:a?a.replace("/[() -]/g",""):"",order_comments:"",payment_method:this.gateway_id,terms:1,fkwcs_source:e,payment_request_type:this.gateway_id},r=this.prepareBillingAddress(r,n);return r=this.prepareShippingAddress(r,t),"yes"===fkwcs_data.is_product?r.page_from="product":r.page_from="cart",r=JSON.parse(JSON.stringify(r))}},{key:"shippingAddressRequired",value:function(){return"yes"===fkwcs_data.shipping_required}},{key:"prepareBillingAddress",value:function(t,e){return console.trace(),(t=_superPropGet(s,"prepareBillingAddress",this,3)([t,e])).billing_address_1=null!==e?e.line_1:"",t.billing_address_2=null!==e?e.line_2:"",t}},{key:"prepareShippingAddress",value:function(t,e){return e&&(t.shipping_first_name=e.name.split(" ").slice(0,1).join(" "),t.shipping_last_name=e.name.split(" ").slice(1).join(" "),t.shipping_country=e.country,t.shipping_address_1=e.line_1,t.shipping_address_2=e.line_2,t.shipping_city=e.city,t.shipping_state=e.state,e.hasOwnProperty("shipping_method")&&(t.shipping_method=Object.values(e.shipping_method)),t.hasOwnProperty("billing_phone")&&(t.shipping_phone=t.billing_phone),t.shipping_postcode=e.postal_code,t.ship_to_different_address=1),t}},{key:"confirmPaymentIntent",value:function(t,e){var s=e.match(/^#?fkwcs-confirm-(pi|si)-([^:]+):(.+):(.+):(.+):(.+)$/);if(!s||s.length<5)return window.location.redirect=e,c("body").unblock(),!1;var e=s[1],a=s[2],s=decodeURIComponent(s[3]);this.confirmPayment(t,a,s,e)}},{key:"confirmPayment",value:function(t,e,s,a){var n=this;("si"==a?this.stripe.handleCardSetup(e,{payment_method:t.paymentMethod.id},{handleActions:!1}):this.stripe.confirmCardPayment(e,{payment_method:t.paymentMethod.id},{handleActions:!1})).then(function(t){t.error?(n.logError(t.error),c("body").unblock()):"requires_action"===(t=t["si"===a?"setupIntent":"paymentIntent"]).status||"requires_source_action"===t.status?("si"==a?n.stripe.handleCardSetup(e):n.stripe.confirmCardPayment(e)).then(function(t){t.error?(n.logError(t.error),c("body").unblock()):window.location=s}):(c("body").unblock(),window.location=s)})}},{key:"setupPaymentRequest",value:function(){}},{key:"setRequestData",value:function(){}}])})();new t;try{void 0===fkwcs_data.google_pay||"live"===fkwcs_data.mode&&""===fkwcs_data.google_pay.merchant_id||new e}catch(t){console.log("Error Captured During Gpay initialization",t)}})(jQuery);