zar 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/zar.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- var re=(Q,ie,ee)=>new Promise((Re,Ne)=>{var qe=R=>{try{ae(ee.next(R))}catch(me){Ne(me)}},te=R=>{try{ae(ee.throw(R))}catch(me){Ne(me)}},ae=R=>R.done?Re(R.value):Promise.resolve(R.value).then(qe,te);ae((ee=ee.apply(Q,ie)).next())});(function(Q,ie){typeof exports=="object"&&typeof module!="undefined"?ie(exports):typeof define=="function"&&define.amd?define(["exports"],ie):(Q=typeof globalThis!="undefined"?globalThis:Q||self,ie(Q.zar={}))})(this,function(Q){"use strict";function ie(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:i;return e===i?n:e}var ee="undefined",Re="object",Ne="any",qe="*",te="__",ae=typeof process!="undefined"?process:{};ae.env&&ae.env.NODE_ENV;var R=typeof window!="undefined";ae.versions!=null&&ae.versions.node!=null,typeof Deno!="undefined"&&Deno.core,R&&window.name==="nodejs"||typeof navigator!="undefined"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function me(e,t){return t.charAt(0)[e]()+t.slice(1)}var Sn=me.bind(null,"toUpperCase"),Pn=me.bind(null,"toLowerCase");function xn(e){return yt(e)?Sn("null"):typeof e=="object"?Nn(e):Object.prototype.toString.call(e).slice(8,-1)}function Ce(e,t){t===void 0&&(t=!0);var n=xn(e);return t?Pn(n):n}function je(e,t){return typeof t===e}var K=je.bind(null,"function"),ve=je.bind(null,"string"),he=je.bind(null,"undefined"),On=je.bind(null,"boolean");je.bind(null,"symbol");function yt(e){return e===null}function En(e){return Ce(e)==="number"&&!isNaN(e)}function kn(e){return Ce(e)==="array"}function J(e){if(!_n(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function _n(e){return e&&(typeof e=="object"||e!==null)}function Nn(e){return K(e.constructor)?e.constructor.name:null}function jn(e){return e instanceof Error||ve(e.message)&&e.constructor&&En(e.constructor.stackTraceLimit)}function bt(e,t){if(typeof t!="object"||yt(t))return!1;if(t instanceof e)return!0;var n=Ce(new e(""));if(jn(t))for(;t;){if(Ce(t)===n)return!0;t=Object.getPrototypeOf(t)}return!1}bt.bind(null,TypeError),bt.bind(null,SyntaxError);function Be(e,t){var n=e instanceof Element||e instanceof HTMLDocument;return n&&t?Tn(e,t):n}function Tn(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function Ve(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}Ve(Be,"form"),Ve(Be,"button"),Ve(Be,"input"),Ve(Be,"select");function wt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return null}}function An(){if(R){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function Mn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}}function zn(e){return function(t){for(var n,r=Object.create(null),i=/([^&=]+)=?([^&]*)/g;n=i.exec(t);){var a=wt(n[1]),o=wt(n[2]);a.substring(a.length-2)==="[]"?(r[a=a.substring(0,a.length-2)]||(r[a]=[])).push(o):r[a]=o===""||o}for(var s in r){var p=s.split("[");p.length>1&&(Ln(r,p.map(function(g){return g.replace(/[?[\]\\ ]/g,"")}),r[s]),delete r[s])}return r}(function(t){if(t){var n=t.match(/\?(.*)/);return n&&n[1]?n[1].split("#")[0]:""}return R&&window.location.search.substring(1)}(e))}function Ln(e,t,n){for(var r=t.length-1,i=0;i<r;++i){var a=t[i];if(a==="__proto__"||a==="constructor")break;a in e||(e[a]={}),e=e[a]}e[t[r]]=n}function Je(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+=r=="-"||r=="4"?r:(r=="x"?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}var Te="global",ye=te+"global"+te,be=typeof self===Re&&self.self===self&&self||typeof global===Re&&global.global===global&&global||void 0;function se(e){return be[ye][e]}function le(e,t){return be[ye][e]=t}function we(e){delete be[ye][e]}function Ie(e,t,n){var r;try{if(nt(e)){var i=window[e];r=i[t].bind(i)}}catch(a){}return r||n}be[ye]||(be[ye]={});var Fe={};function nt(e){if(typeof Fe[e]!==ee)return Fe[e];try{var t=window[e];t.setItem(ee,ee),t.removeItem(ee)}catch(n){return Fe[e]=!1}return Fe[e]=!0}function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m.apply(this,arguments)}var oe="function",ne="undefined",$n="@@redux/"+Math.random().toString(36),It=function(){return typeof Symbol===oe&&Symbol.observable||"@@observable"}(),He=" != "+oe;function St(e,t,n){var r;if(typeof t===oe&&typeof n===ne&&(n=t,t=void 0),typeof n!==ne){if(typeof n!==oe)throw new Error("enhancer"+He);return n(St)(e,t)}if(typeof e!==oe)throw new Error("reducer"+He);var i=e,a=t,o=[],s=o,p=!1;function g(){s===o&&(s=o.slice())}function x(){return a}function d(h){if(typeof h!==oe)throw new Error("Listener"+He);var A=!0;return g(),s.push(h),function(){if(A){A=!1,g();var I=s.indexOf(h);s.splice(I,1)}}}function N(h){if(!J(h))throw new Error("Act != obj");if(typeof h.type===ne)throw new Error("ActType "+ne);if(p)throw new Error("Dispatch in reducer");try{p=!0,a=i(a,h)}finally{p=!1}for(var A=o=s,I=0;I<A.length;I++)(0,A[I])();return h}return N({type:"@@redux/INIT"}),(r={dispatch:N,subscribe:d,getState:x,replaceReducer:function(h){if(typeof h!==oe)throw new Error("next reducer"+He);i=h,N({type:"@@redux/INIT"})}})[It]=function(){var h,A=d;return(h={subscribe:function(I){if(typeof I!="object")throw new TypeError("Observer != obj");function y(){I.next&&I.next(x())}return y(),{unsubscribe:A(y)}}})[It]=function(){return this},h},r}function Un(e,t){var n=t&&t.type;return"action "+(n&&n.toString()||"?")+"reducer "+e+" returns "+ne}function Se(){var e=[].slice.call(arguments);return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,n){return function(){return t(n.apply(void 0,[].slice.call(arguments)))}})}function Dn(){var e=arguments;return function(t){return function(n,r,i){var a,o=t(n,r,i),s=o.dispatch,p={getState:o.getState,dispatch:function(g){return s(g)}};return a=[].slice.call(e).map(function(g){return g(p)}),m({},o,{dispatch:s=Se.apply(void 0,a)(o.dispatch)})}}}var ue=te+"anon_id",fe=te+"user_id",Pe=te+"user_traits",ce="userId",xe="anonymousId",Ge=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],rt=["name","EVENTS","config","loaded"],v=Ge.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Pt=/^utm_/,xt=/^an_prop_/,Ot=/^an_trait_/;function Rn(e){var t=e.storage.setItem;return function(n){return function(r){return function(i){if(i.type===v.bootstrap){var a=i.params,o=i.user,s=i.persistedUser,p=i.initialUser,g=s.userId===o.userId;s.anonymousId!==o.anonymousId&&t(ue,o.anonymousId),g||t(fe,o.userId),p.traits&&t(Pe,m({},g&&s.traits?s.traits:{},p.traits));var x=Object.keys(i.params);if(x.length){var d=a.an_uid,N=a.an_event,h=x.reduce(function(A,I){if(I.match(Pt)||I.match(/^(d|g)clid/)){var y=I.replace(Pt,"");A.campaign[y==="campaign"?"name":y]=a[I]}return I.match(xt)&&(A.props[I.replace(xt,"")]=a[I]),I.match(Ot)&&(A.traits[I.replace(Ot,"")]=a[I]),A},{campaign:{},props:{},traits:{}});n.dispatch(m({type:v.params,raw:a},h,d?{userId:d}:{})),d&&setTimeout(function(){return e.identify(d,h.traits)},0),N&&setTimeout(function(){return e.track(N,h.props)},0),Object.keys(h.campaign).length&&n.dispatch({type:v.campaign,campaign:h.campaign})}}return r(i)}}}}function qn(e){return function(t,n){if(t===void 0&&(t={}),n===void 0&&(n={}),n.type===v.setItemEnd){if(n.key===ue)return m({},t,{anonymousId:n.value});if(n.key===fe)return m({},t,{userId:n.value})}switch(n.type){case v.identify:return Object.assign({},t,{userId:n.userId,traits:m({},t.traits,n.traits)});case v.reset:return[fe,ue,Pe].forEach(function(r){e.removeItem(r)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function Et(e){return{userId:e.getItem(fe),anonymousId:e.getItem(ue),traits:e.getItem(Pe)}}var it=function(e){return te+"TEMP"+te+e};function Cn(e){var t=e.storage,n=t.setItem,r=t.removeItem,i=t.getItem;return function(a){return function(o){return function(s){var p=s.userId,g=s.traits,x=s.options;if(s.type===v.reset&&([fe,Pe,ue].forEach(function(h){r(h)}),[ce,xe,"traits"].forEach(function(h){we(it(h))})),s.type===v.identify){i(ue)||n(ue,Je());var d=i(fe),N=i(Pe)||{};d&&d!==p&&a.dispatch({type:v.userIdChanged,old:{userId:d,traits:N},new:{userId:p,traits:g},options:x}),p&&n(fe,p),g&&n(Pe,m({},N,g))}return o(s)}}}}var Ae={};function kt(e,t){Ae[e]&&K(Ae[e])&&(Ae[e](t),delete Ae[e])}function _t(e,t,n){return new Promise(function(r,i){return t()?r(e):n<1?i(m({},e,{queue:!0})):new Promise(function(a){return setTimeout(a,10)}).then(function(a){return _t(e,t,n-10).then(r,i)})})}function Nt(e,t,n){var r=t(),i=e.getState(),a=i.plugins,o=i.queue,s=i.user;if(!i.context.offline&&o&&o.actions&&o.actions.length){var p=o.actions.reduce(function(x,d,N){return a[d.plugin].loaded?(x.process.push(d),x.processIndex.push(N)):(x.requeue.push(d),x.requeueIndex.push(N)),x},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(p.processIndex&&p.processIndex.length){p.processIndex.forEach(function(x){var d=o.actions[x],N=d.plugin,h=d.payload.type,A=r[N][h];if(A&&K(A)){var I=function(E,j){return E===void 0&&(E={}),j===void 0&&(j={}),[ce,xe].reduce(function(M,l){return E.hasOwnProperty(l)&&j[l]&&j[l]!==E[l]&&(M[l]=j[l]),M},E)}(d.payload,s);A({payload:I,config:a[N].config,instance:n});var y=h+":"+N;e.dispatch(m({},I,{type:y,_:{called:y,from:"queueDrain"}}))}});var g=o.actions.filter(function(x,d){return!~p.processIndex.indexOf(d)});o.actions=g}}}var at=function(e){var t=e.data,n=e.action,r=e.instance,i=e.state,a=e.allPlugins,o=e.allMatches,s=e.store,p=e.EVENTS;try{var g=i.plugins,x=i.context,d=n.type,N=d.match(Oe),h=t.exact.map(function(y){return y.pluginName});N&&(h=o.during.map(function(y){return y.pluginName}));var A=function(y,E){return function(j,M,l){var b=M.config,$=M.name,z=$+"."+j.type;l&&(z=l.event);var L=j.type.match(Oe)?function(B,U,F,q,H){return function(S,T){var X=q?q.name:B,V=T&&Me(T)?T:F;if(q&&(!(V=T&&Me(T)?T:[B]).includes(B)||V.length!==1))throw new Error("Method "+U+" can only abort "+B+" plugin. "+JSON.stringify(V)+" input valid");return m({},H,{abort:{reason:S,plugins:V,caller:U,_:X}})}}($,z,E,l,j):function(B,U){return function(){throw new Error(B.type+" action not cancellable. Remove abort in "+U)}}(j,z);return{payload:Bn(j),instance:y,config:b||{},abort:L}}}(r,h),I=t.exact.reduce(function(y,E){var j=E.pluginName,M=E.methodName,l=!1;return M.match(/^initialize/)||M.match(/^reset/)||(l=!g[j].loaded),x.offline&&M.match(/^(page|track|identify)/)&&(l=!0),y[""+j]=l,y},{});return Promise.resolve(t.exact.reduce(function(y,E,j){var M=E.pluginName;return Promise.resolve(y).then(function(l){function b(){return Promise.resolve(l)}var $=function(){if(t.namespaced&&t.namespaced[M])return Promise.resolve(t.namespaced[M].reduce(function(z,L,B){return Promise.resolve(z).then(function(U){return L.method&&K(L.method)?(function(S,T){var X=Ut(S);if(X&&X.name===T){var V=Ut(X.method);throw new Error([T+" plugin is calling method "+S,"Plugins cant call self","Use "+X.method+" "+(V?"or "+V.method:"")+" in "+T+" plugin insteadof "+S].join(`
2
- `))}}(L.methodName,L.pluginName),Promise.resolve(L.method({payload:U,instance:r,abort:(F=U,q=M,H=L.pluginName,function(S,T){return m({},F,{abort:{reason:S,plugins:T||[q],caller:d,from:H||q}})}),config:At(L.pluginName,g,a),plugins:g})).then(function(S){var T=J(S)?S:{};return Promise.resolve(m({},U,T))})):U;var F,q,H})},Promise.resolve(n))).then(function(z){l[M]=z});l[M]=n}();return $&&$.then?$.then(b):b()})},Promise.resolve({}))).then(function(y){return Promise.resolve(t.exact.reduce(function(E,j,M){try{var l=t.exact.length===M+1,b=j.pluginName,$=a[b];return Promise.resolve(E).then(function(z){var L=y[b]?y[b]:{};if(N&&(L=z),ut(L,b))return ot({data:L,method:d,instance:r,pluginName:b,store:s}),Promise.resolve(z);if(ut(z,b))return l&&ot({data:z,method:d,instance:r,store:s}),Promise.resolve(z);if(I.hasOwnProperty(b)&&I[b]===!0)return s.dispatch({type:"queue",plugin:b,payload:L,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(z);var B=A(y[b],a[b]);return Promise.resolve($[d]({abort:B.abort,payload:L,instance:r,config:At(b,g,a),plugins:g})).then(function(U){var F=J(U)?U:{},q=m({},z,F),H=y[b];if(ut(H,b))ot({data:H,method:d,instance:r,pluginName:b,store:s});else{var S=d+":"+b;(S.match(/:/g)||[]).length<2&&!d.match(jt)&&!d.match(Tt)&&r.dispatch(m({},N?q:L,{type:S,_:{called:S,from:"submethod"}}))}return Promise.resolve(q)})})}catch(z){return Promise.reject(z)}},Promise.resolve(n))).then(function(E){if(!(d.match(Oe)||d.match(/^registerPlugin/)||d.match(Tt)||d.match(jt)||d.match(/^params/)||d.match(/^userIdChanged/))){if(p.plugins.includes(d),E._&&E._.originalAction===d)return E;var j=m({},E,{_:{originalAction:E.type,called:E.type,from:"engineEnd"}});Lt(E,t.exact.length)&&!d.match(/End$/)&&(j=m({},j,{type:E.type+"Aborted"})),s.dispatch(j)}return E})})}catch(y){return Promise.reject(y)}},Oe=/Start$/,jt=/^bootstrap/,Tt=/^ready/;function ot(e){var t=e.pluginName,n=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(m({},e.data,{type:n,_:{called:n,from:"abort"}}))}function At(e,t,n){var r=t[e]||n[e];return r&&r.config?r.config:{}}function Mt(e,t){return t.reduce(function(n,r){return r[e]?n.concat({methodName:e,pluginName:r.name,method:r[e]}):n},[])}function zt(e,t){var n=e.replace(Oe,""),r=t?":"+t:"";return[""+e+r,""+n+r,n+"End"+r]}function ut(e,t){var n=e.abort;return!!n&&(n===!0||$t(n,t)||n&&$t(n.plugins,t))}function Lt(e,t){var n=e.abort;if(!n)return!1;if(n===!0||ve(n))return!0;var r=n.plugins;return Me(n)&&n.length===t||Me(r)&&r.length===t}function Me(e){return Array.isArray(e)}function $t(e,t){return!(!e||!Me(e))&&e.includes(t)}function Ut(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function Bn(e){return Object.keys(e).reduce(function(t,n){return n==="type"||(t[n]=J(e[n])?Object.assign({},e[n]):e[n]),t},{})}function Vn(e,t,n){var r={};return function(i){return function(a){return function(o){try{var s,p=function(l){return s?l:a(d)},g=o.type,x=o.plugins,d=o;if(o.abort)return Promise.resolve(a(o));if(g===v.enablePlugin&&i.dispatch({type:v.initializeStart,plugins:x,disabled:[],fromEnable:!0,meta:o.meta}),g===v.disablePlugin&&setTimeout(function(){return kt(o.meta.rid,{payload:o})},0),g===v.initializeEnd){var N=t(),h=Object.keys(N),A=h.filter(function(l){return x.includes(l)}).map(function(l){return N[l]}),I=[],y=[],E=o.disabled,j=A.map(function(l){var b=l.name;return _t(l,l.loaded,1e4).then(function($){return r[b]||(i.dispatch({type:v.pluginReadyType(b),name:b,events:Object.keys(l).filter(function(z){return!rt.includes(z)})}),r[b]=!0),I=I.concat(b),l}).catch(function($){if($ instanceof Error)throw new Error($);return y=y.concat($.name),$})});Promise.all(j).then(function(l){var b={plugins:I,failed:y,disabled:E};setTimeout(function(){h.length===j.length+E.length&&i.dispatch(m({},{type:v.ready},b))},0)})}var M=function(){if(g!==v.bootstrap)return/^ready:([^:]*)$/.test(g)&&setTimeout(function(){return Nt(i,t,e)},0),Promise.resolve(function(l,b,$,z,L){try{var B=K(b)?b():b,U=l.type,F=U.replace(Oe,"");if(l._&&l._.called)return Promise.resolve(l);var q=$.getState(),H=(X=B,(V=q.plugins)===void 0&&(V={}),(c=l.options)===void 0&&(c={}),Object.keys(X).filter(function(u){var f=c.plugins||{};return On(f[u])?f[u]:f.all!==!1&&(!V[u]||V[u].enabled!==!1)}).map(function(u){return X[u]}));U===v.initializeStart&&l.fromEnable&&(H=Object.keys(q.plugins).filter(function(u){var f=q.plugins[u];return l.plugins.includes(u)&&!f.initialized}).map(function(u){return B[u]}));var S=H.map(function(u){return u.name}),T=function(u,f,P){var O=zt(u).map(function(w){return Mt(w,f)});return f.reduce(function(w,C){var k=C.name,D=zt(u,k).map(function(_e){return Mt(_e,f)}),_=D[0],Z=D[1],ke=D[2];return _.length&&(w.beforeNS[k]=_),Z.length&&(w.duringNS[k]=Z),ke.length&&(w.afterNS[k]=ke),w},{before:O[0],beforeNS:{},during:O[1],duringNS:{},after:O[2],afterNS:{}})}(U,H);return Promise.resolve(at({action:l,data:{exact:T.before,namespaced:T.beforeNS},state:q,allPlugins:B,allMatches:T,instance:$,store:z,EVENTS:L})).then(function(u){function f(){var w=function(){if(U.match(Oe))return Promise.resolve(at({action:m({},P,{type:F+"End"}),data:{exact:T.after,namespaced:T.afterNS},state:q,allPlugins:B,allMatches:T,instance:$,store:z,EVENTS:L})).then(function(C){C.meta&&C.meta.hasCallback&&kt(C.meta.rid,{payload:C})})}();return w&&w.then?w.then(function(){return u}):u}if(Lt(u,S.length))return u;var P,O=function(){if(U!==F)return Promise.resolve(at({action:m({},u,{type:F}),data:{exact:T.during,namespaced:T.duringNS},state:q,allPlugins:B,allMatches:T,instance:$,store:z,EVENTS:L})).then(function(w){P=w});P=u}();return O&&O.then?O.then(f):f()})}catch(u){return Promise.reject(u)}var X,V,c}(o,t,e,i,n)).then(function(l){var b=a(l);return s=1,b})}();return Promise.resolve(M&&M.then?M.then(p):p(M))}catch(l){return Promise.reject(l)}}}}}function Jn(e){return function(t){return function(n){return function(r){var i=r.type,a=r.key,o=r.value,s=r.options;if(i===v.setItem||i===v.removeItem){if(r.abort)return n(r);i===v.setItem?e.setItem(a,o,s):e.removeItem(a,s)}return n(r)}}}}var Fn=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,n){e[n]=e[n].concat(t)},this.removeMiddleware=function(t,n){var r=e[n].findIndex(function(i){return i===t});r!==-1&&(e[n]=[].concat(e[n].slice(0,r),e[n].slice(r+1)))},this.dynamicMiddlewares=function(t){return function(n){return function(r){return function(i){var a={getState:n.getState,dispatch:function(s){return n.dispatch(s)}},o=e[t].map(function(s){return s(a)});return Se.apply(void 0,o)(r)(i)}}}}};function Hn(e){return function(t,n){t===void 0&&(t={});var r={};if(n.type==="initialize:aborted")return t;if(/^registerPlugin:([^:]*)$/.test(n.type)){var i=Dt(n.type,"registerPlugin"),a=e()[i];if(!a||!i)return t;var o=n.enabled;return r[i]={enabled:o,initialized:!!o&&Boolean(!a.initialize),loaded:!!o&&Boolean(a.loaded()),config:a.config||{}},m({},t,r)}if(/^initialize:([^:]*)$/.test(n.type)){var s=Dt(n.type,v.initialize),p=e()[s];return p&&s?(r[s]=m({},t[s],{initialized:!0,loaded:Boolean(p.loaded())}),m({},t,r)):t}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=m({},t[n.name],{loaded:!0}),m({},t,r);switch(n.type){case v.disablePlugin:return m({},t,Rt(n.plugins,!1,t));case v.enablePlugin:return m({},t,Rt(n.plugins,!0,t));default:return t}}}function Dt(e,t){return e.substring(t.length+1,e.length)}function Rt(e,t,n){return e.reduce(function(r,i){return r[i]=m({},n[i],{enabled:t}),r},n)}function qt(e){try{return JSON.parse(JSON.stringify(e))}catch(t){}return e}var Gn={last:{},history:[]};function Wn(e,t){e===void 0&&(e=Gn);var n=t.options,r=t.meta;if(t.type===v.track){var i=qt(m({event:t.event,properties:t.properties},Object.keys(n).length&&{options:n},{meta:r}));return m({},e,{last:i,history:e.history.concat(i)})}return e}var Xn={actions:[]};function Qn(e,t){e===void 0&&(e=Xn);var n=t.payload;switch(t.type){case"queue":var r;return r=n&&n.type&&n.type===v.identify?[t].concat(e.actions):e.actions.concat(t),m({},e,{actions:r});case"dequeue":return[];default:return e}}var Ct=/#.*$/;function Kn(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(Ct,""):"")}var Bt,Vt,Jt,Ft,Yn=function(e){if(e===void 0&&(e={}),!R)return e;var t=document,n=t.title,r=t.referrer,i=window,a=i.location,o=i.innerWidth,s=i.innerHeight,p=a.hash,g=a.search,x=function(N){var h=function(){if(R){for(var A,I=document.getElementsByTagName("link"),y=0;A=I[y];y++)if(A.getAttribute("rel")==="canonical")return A.getAttribute("href")}}();return h?h.match(/\?/)?h:h+N:window.location.href.replace(Ct,"")}(g),d={title:n,url:x,path:Kn(x),hash:p,search:g,width:o,height:s};return r&&r!==""&&(d.referrer=r),m({},d,e)},Zn={last:{},history:[]};function er(e,t){e===void 0&&(e=Zn);var n=t.options;if(t.type===v.page){var r=qt(m({properties:t.properties,meta:t.meta},Object.keys(n).length&&{options:n}));return m({},e,{last:r,history:e.history.concat(r)})}return e}Bt=function(){if(!R)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"}(),Vt=R?document.referrer:null,Jt=An(),Ft=Mn();var Ht={initialized:!1,sessionId:Je(),app:null,version:null,debug:!1,offline:!!R&&!navigator.onLine,os:{name:Bt},userAgent:R?navigator.userAgent:"node",library:{name:"analytics",version:"0.11.0"},timezone:Ft,locale:Jt,campaign:{},referrer:Vt};function tr(e,t){e===void 0&&(e=Ht);var n=e.initialized,r=t.campaign;switch(t.type){case v.campaign:return m({},e,{campaign:r});case v.offline:return m({},e,{offline:!0});case v.online:return m({},e,{offline:!1});default:return n?e:m({},Ht,e,{initialized:!0})}}var nr=["plugins","reducers","storage"];function rr(e,t,n){if(R){var r=window[(n?"add":"remove")+"EventListener"];e.split(" ").forEach(function(i){r(i,t)})}}function ir(e){var t=rr.bind(null,"online offline",function(n){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(n){return t(!1)}}function Gt(){return le("analytics",[]),function(e){return function(t,n,r){var i=e(t,n,r),a=i.dispatch;return Object.assign(i,{dispatch:function(o){return be[ye].analytics.push(o.action||o),a(o)}})}}}function Wt(e){return function(){return Se(Se.apply(null,arguments),Gt())}}function ct(e){return e?kn(e)?e:[e]:[]}function Xt(e,t,n){e===void 0&&(e={});var r,i,a=Je();return t&&(Ae[a]=(r=t,i=function(o){for(var s,p=o||Array.prototype.slice.call(arguments),g=0;g<p.length;g++)if(K(p[g])){s=p[g];break}return s}(n),function(o){i&&i(o),r(o)})),m({},e,{rid:a,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function ar(e){e===void 0&&(e={});var t=e.reducers||{},n=e.initialUser||{},r=(e.plugins||[]).reduce(function(c,u){if(K(u))return c.middlewares=c.middlewares.concat(u),c;if(u.NAMESPACE&&(u.name=u.NAMESPACE),!u.name)throw new Error("https://lytics.dev/errors/1");var f=u.EVENTS?Object.keys(u.EVENTS).map(function(w){return u.EVENTS[w]}):[];c.pluginEnabled[u.name]=!(u.enabled===!1||u.config&&u.config.enabled===!1),delete u.enabled,u.methods&&(c.methods[u.name]=Object.keys(u.methods).reduce(function(w,C){var k;return w[C]=(k=u.methods[C],function(){for(var D=Array.prototype.slice.call(arguments),_=new Array(k.length),Z=0;Z<D.length;Z++)_[Z]=D[Z];return _[_.length]=l,k.apply({instance:l},_)}),w},{}),delete u.methods);var P=Object.keys(u).concat(f),O=new Set(c.events.concat(P));if(c.events=Array.from(O),c.pluginsArray=c.pluginsArray.concat(u),c.plugins[u.name])throw new Error(u.name+"AlreadyLoaded");return c.plugins[u.name]=u,c.plugins[u.name].loaded||(c.plugins[u.name].loaded=function(){return!0}),c},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=e.storage?e.storage:{getItem:se,setItem:le,removeItem:we},a=function(c){return function(u,f,P){return f.getState("user")[u]||(P&&J(P)&&P[u]?P[u]:Et(c)[u]||se(it(u))||null)}}(i),o=r.plugins,s=r.events.filter(function(c){return!rt.includes(c)}).sort(),p=new Set(s.concat(Ge).filter(function(c){return!rt.includes(c)})),g=Array.from(p).sort(),x=function(){return o},d=new Fn,N=d.addMiddleware,h=d.removeMiddleware,A=d.dynamicMiddlewares,I=function(){throw new Error("Abort disabled inListener")},y=zn(),E=Et(i),j=m({},E,n,y.an_uid?{userId:y.an_uid}:{},y.an_aid?{anonymousId:y.an_aid}:{});j.anonymousId||(j.anonymousId=Je());var M=m({enable:function(c,u){return new Promise(function(f){S.dispatch({type:v.enablePlugin,plugins:ct(c),_:{originalAction:v.enablePlugin}},f,[u])})},disable:function(c,u){return new Promise(function(f){S.dispatch({type:v.disablePlugin,plugins:ct(c),_:{originalAction:v.disablePlugin}},f,[u])})}},r.methods),l={identify:function(c,u,f,P){try{var O=ve(c)?c:null,w=J(c)?c:u,C=f||{},k=l.user();le(it(ce),O);var D=O||w.userId||a(ce,l,w);return Promise.resolve(new Promise(function(_){S.dispatch(m({type:v.identifyStart,userId:D,traits:w||{},options:C,anonymousId:k.anonymousId},k.id&&k.id!==O&&{previousId:k.id}),_,[u,f,P])}))}catch(_){return Promise.reject(_)}},track:function(c,u,f,P){try{var O=J(c)?c.event:c;if(!O||!ve(O))throw new Error("EventMissing");var w=J(c)?c:u||{},C=J(f)?f:{};return Promise.resolve(new Promise(function(k){S.dispatch({type:v.trackStart,event:O,properties:w,options:C,userId:a(ce,l,u),anonymousId:a(xe,l,u)},k,[u,f,P])}))}catch(k){return Promise.reject(k)}},page:function(c,u,f){try{var P=J(c)?c:{},O=J(u)?u:{};return Promise.resolve(new Promise(function(w){S.dispatch({type:v.pageStart,properties:Yn(P),options:O,userId:a(ce,l,P),anonymousId:a(xe,l,P)},w,[c,u,f])}))}catch(w){return Promise.reject(w)}},user:function(c){if(c===ce||c==="id")return a(ce,l);if(c===xe||c==="anonId")return a(xe,l);var u=l.getState("user");return c?ie(u,c):u},reset:function(c){return new Promise(function(u){S.dispatch({type:v.resetStart},u,c)})},ready:function(c){return l.on(v.ready,c)},on:function(c,u){if(!c||!K(u))return!1;if(c===v.bootstrap)throw new Error(".on disabled for "+c);var f=/Start$|Start:/;if(c==="*"){var P=function(k){return function(D){return function(_){return _.type.match(f)&&u({payload:_,instance:l,plugins:o}),D(_)}}},O=function(k){return function(D){return function(_){return _.type.match(f)||u({payload:_,instance:l,plugins:o}),D(_)}}};return N(P,We),N(O,Xe),function(){h(P,We),h(O,Xe)}}var w=c.match(f)?We:Xe,C=function(k){return function(D){return function(_){return _.type===c&&u({payload:_,instance:l,plugins:o,abort:I}),D(_)}}};return N(C,w),function(){return h(C,w)}},once:function(c,u){if(!c||!K(u))return!1;if(c===v.bootstrap)throw new Error(".once disabled for "+c);var f=l.on(c,function(P){u({payload:P.payload,instance:l,plugins:o,abort:I}),f()});return f},getState:function(c){var u=S.getState();return c?ie(u,c):Object.assign({},u)},dispatch:function(c){var u=ve(c)?{type:c}:c;if(Ge.includes(u.type))throw new Error("reserved action "+u.type);var f=m({},u,{_:m({originalAction:u.type},c._||{})});S.dispatch(f)},enablePlugin:M.enable,disablePlugin:M.disable,plugins:M,storage:{getItem:i.getItem,setItem:function(c,u,f){S.dispatch({type:v.setItemStart,key:c,value:u,options:f})},removeItem:function(c,u){S.dispatch({type:v.removeItemStart,key:c,options:u})}},setAnonymousId:function(c,u){l.storage.setItem(ue,c,u)},events:{core:Ge,plugins:s}},b=r.middlewares.concat([function(c){return function(u){return function(f){return f.meta||(f.meta=Xt()),u(f)}}},A(We),Vn(l,x,{all:g,plugins:s}),Jn(i),Rn(l),Cn(l),A(Xe)]),$={context:tr,user:qn(i),page:er,track:Wn,plugins:Hn(x),queue:Qn},z=Se,L=Se;if(R&&e.debug){var B=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;B&&(z=B({trace:!0,traceLimit:25})),L=function(){return arguments.length===0?Gt():J(typeof arguments[0])?Wt():Wt().apply(null,arguments)}}var U,F=function(c){return Object.keys(c).reduce(function(u,f){return nr.includes(f)||(u[f]=c[f]),u},{})}(e),q=r.pluginsArray.reduce(function(c,u){var f=u.name,P=u.config,O=u.loaded,w=r.pluginEnabled[f];return c[f]={enabled:w,initialized:!!w&&Boolean(!u.initialize),loaded:Boolean(O()),config:P||{}},c},{}),H={context:F,user:j,plugins:q},S=St(function(c){for(var u=Object.keys(c),f={},P=0;P<u.length;P++){var O=u[P];typeof c[O]===oe&&(f[O]=c[O])}var w,C=Object.keys(f);try{(function(k){Object.keys(k).forEach(function(D){var _=k[D];if(typeof _(void 0,{type:"@@redux/INIT"})===ne||typeof _(void 0,{type:$n})===ne)throw new Error("reducer "+D+" "+ne)})})(f)}catch(k){w=k}return function(k,D){if(k===void 0&&(k={}),w)throw w;for(var _=!1,Z={},ke=0;ke<C.length;ke++){var _e=C[ke],In=k[_e],ht=(0,f[_e])(In,D);if(typeof ht===ne){var Rr=Un(_e,D);throw new Error(Rr)}Z[_e]=ht,_=_||ht!==In}return _?Z:k}}(m({},$,t)),H,L(z(Dn.apply(void 0,b))));S.dispatch=(U=S.dispatch,function(c,u,f){var P=m({},c,{meta:Xt(c.meta,u,ct(f))});return U.apply(null,[P])});var T=Object.keys(o);S.dispatch({type:v.bootstrap,plugins:T,config:F,params:y,user:j,initialUser:n,persistedUser:E});var X=T.filter(function(c){return r.pluginEnabled[c]}),V=T.filter(function(c){return!r.pluginEnabled[c]});return S.dispatch({type:v.registerPlugins,plugins:T,enabled:r.pluginEnabled}),r.pluginsArray.map(function(c,u){var f=c.bootstrap,P=c.config,O=c.name;f&&K(f)&&f({instance:l,config:P,payload:c}),S.dispatch({type:v.registerPluginType(O),name:O,enabled:r.pluginEnabled[O],plugin:c}),r.pluginsArray.length===u+1&&S.dispatch({type:v.initializeStart,plugins:X,disabled:V})}),ir(function(c){S.dispatch({type:c?v.offline:v.online})}),function(c,u,f){setInterval(function(){return Nt(c,u,f)},3e3)}(S,x,l),l}var We="before",Xe="after",ze="cookie",de=Yt(),Qt=Qe,or=Qe;function Kt(e){return de?Qe(e,"",-1):we(e)}function Yt(){if(de!==void 0)return de;var e="cookiecookie";try{Qe(e,e),de=document.cookie.indexOf(e)!==-1,Kt(e)}catch(t){de=!1}return de}function Qe(e,t,n,r,i,a){if(typeof window!="undefined"){var o=arguments.length>1;return de===!1&&(o?le(e,t):se(e)),o?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(a?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var Le="localStorage",ur=nt.bind(null,"localStorage");Ie("localStorage","getItem",se),Ie("localStorage","setItem",le),Ie("localStorage","removeItem",we);var $e="sessionStorage",cr=nt.bind(null,"sessionStorage");Ie("sessionStorage","getItem",se),Ie("sessionStorage","setItem",le),Ie("sessionStorage","removeItem",we);function Ee(e){var t=e;try{if((t=JSON.parse(e))==="true")return!0;if(t==="false")return!1;if(J(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch(n){}if(t!==null&&t!=="")return t}var sr=ur(),lr=cr(),fr=Yt();function Zt(e,t){if(e){var n=st(t),r=!pt(n),i=lt(n)?Ee(localStorage.getItem(e)):void 0;if(r&&!he(i))return i;var a=ft(n)?Ee(Qt(e)):void 0;if(r&&a)return a;var o=dt(n)?Ee(sessionStorage.getItem(e)):void 0;if(r&&o)return o;var s=se(e);return r?s:{localStorage:i,sessionStorage:o,cookie:a,global:s}}}function dr(e,t,n){if(e&&!he(t)){var r={},i=st(n),a=JSON.stringify(t),o=!pt(i);return lt(i)&&(r[Le]=Ye(Le,t,Ee(localStorage.getItem(e))),localStorage.setItem(e,a),o)?r[Le]:ft(i)&&(r[ze]=Ye(ze,t,Ee(Qt(e))),or(e,a),o)?r[ze]:dt(i)&&(r[$e]=Ye($e,t,Ee(sessionStorage.getItem(e))),sessionStorage.setItem(e,a),o)?r[$e]:(r[Te]=Ye(Te,t,se(e)),le(e,t),o?r[Te]:r)}}function pr(e,t){if(e){var n=st(t),r=Zt(e,qe),i={};return!he(r.localStorage)&&lt(n)&&(localStorage.removeItem(e),i[Le]=r.localStorage),!he(r.cookie)&&ft(n)&&(Kt(e),i[ze]=r.cookie),!he(r.sessionStorage)&&dt(n)&&(sessionStorage.removeItem(e),i[$e]=r.sessionStorage),!he(r.global)&&Ke(n,Te)&&(we(e),i[Te]=r.global),i}}function st(e){return e?ve(e)?e:e.storage:Ne}function lt(e){return sr&&Ke(e,Le)}function ft(e){return fr&&Ke(e,ze)}function dt(e){return lr&&Ke(e,$e)}function pt(e){return e===qe||e==="all"}function Ke(e,t){return e===Ne||e===t||pt(e)}function Ye(e,t,n){return{location:e,current:t,previous:n}}var gr={setItem:dr,getItem:Zt,removeItem:pr};function mr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?en(Object(n),!0).forEach(function(r){mr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):en(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nn(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:gr};return ar(tn(tn({},t),e))}function vr(e,t,n,r,i,a,o){e.fbq||(i=e.fbq=function(){i.callMethod?i.callMethod.apply(i,arguments):i.queue.push(arguments)},e._fbq||(e._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[],a=t.createElement(n),a.async=!0,a.src=r,o=t.getElementsByTagName(n)[0],o.parentNode.insertBefore(a,o))}function hr({trackingId:e}){vr(window,document,"script","https://connect.facebook.net/en_US/fbevents.js"),window.fbq("init",e)}function yr(e={}){return{name:"facebook",config:e,initialize:function({config:t,instance:n}){if(!t.trackingId)throw new Error("No Facebook trackingId defined");hr({trackingId:t.trackingId})},page:function({payload:t,config:n,instance:r}){window.fbq("track","PageView")},track:function({payload:t,config:n,instance:r}){window.fbq("track",t.event,t.properties)},identify:function({payload:t,config:n}){},loaded:function(){return!!window.fbq}}}function Ue(){window.dataLayer.push(arguments)}window.gtag=Ue;function br({trackingId:e,configParams:t={},setParams:n={}}){var r="ga-gtag";if(!document.getElementById(r)){var i=document.head,a=document.createElement("script");a.id=r,a.type="text/javascript",a.async=!0,a.src="https://www.googletagmanager.com/gtag/js?id="+e,i.insertBefore(a,i.firstChild),window.dataLayer=window.dataLayer||[],Ue("js",new Date),n&&Ue("set",n),Ue("config",e,t)}}function wr(e={}){return{name:"google-analytics-4",config:e,initialize:function({config:t,instance:n}){if(!t.trackingId)throw new Error("No GA trackingId defined");var r={},i={};if(t.customDimensions){for(var a={},o=0;o<t.customDimensions.length;o++){var s=t.customDimensions[o];r[s.name]=s.callback(n,t),a["dimension"+(o+1)]=s.name}i.custom_map=a}br({trackingId:t.trackingId,configParams:r,setParams:i})},page:function({payload:t,config:n,instance:r}){},track:function({payload:t,config:n,instance:r}){Ue("event",t.event,t.properties)},identify:function({payload:t,config:n}){},loaded:function(){return!!window.gtag}}}var Ir=new URLSearchParams(window.location.search),Sr=Ir.get("zdbg"),rn={};const Ze="undefined";function Y(){Sr==1&&console.debug(...arguments)}function G(e){console.warn(e),window.Rollbar&&window.Rollbar.warning(e)}function Pr(e){return e&&(Object.prototype.toString.call(e)==="[object Function]"||typeof e=="function"||e instanceof Function)}function an(){try{var e=navigator.userAgent||"",t=new RegExp([/bot/,/spider/,/crawl/,/mediapartners/,/Google-Read-Aloud/,/semrush/].map(n=>n.source).join("|"),"i");return t.test(e)}catch(n){return!1}}function xr(e){document.readyState==="complete"||document.readyState==="loaded"||document.readyState==="interactive"?e():window.addEventListener("DOMContentLoaded",e)}var pe=Or();function Or(){if(typeof pe!==Ze)return pe;pe=!0;try{sessionStorage.setItem(Ze,Ze),sessionStorage.removeItem(Ze)}catch(e){pe=!1}return pe}function on(e){var t,n=rn[e];return pe?(t=sessionStorage.getItem(e),!t&&n&&(t=n,sessionStorage.setItem(e,t))):t=n,t?JSON.parse(t):void 0}function Er(e,t){var n=JSON.stringify(t);pe&&sessionStorage.setItem(e,n),rn[e]=n}function kr(){var e=document.createElement("div");e.innerHTML="&nbsp;",e.className="pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links",e.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;");try{if(document.body.appendChild(e),document.body.getAttribute("abp")!==null||e.offsetHeight===0||e.clientHeight===0)return!0;if(typeof getComputedStyle!="undefined"){var t=window.getComputedStyle(e,null);if(t&&(t.getPropertyValue("display")==="none"||t.getPropertyValue("visibility")==="hidden"))return!0}document.body.removeChild(e)}catch(n){}return!1}function un({method:e,url:t,data:n,json:r=!0}){return new Promise(function(i,a){var o=new XMLHttpRequest;o.open(e,t),o.withCredentials=!0,r&&(o.setRequestHeader("Accept","application/json"),o.setRequestHeader("Content-Type","application/json")),o.onload=function(){this.status>=200&&this.status<300?i(r?JSON.parse(o.response):o.response):a({status:this.status,message:o.statusText})},o.onerror=function(){a({status:this.status,message:"Network Error"})},n?o.send(n):o.send()})}function _r(e){return"?"+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function Nr(n){return re(this,arguments,function*({url:e,data:t}){if(window&&window.navigator&&typeof window.navigator.sendBeacon=="function"&&typeof window.Blob=="function")try{const r=new Blob([JSON.stringify(t)],{type:"text/plain; charset=UTF-8"});return!!window.navigator.sendBeacon(e,r)}catch(r){return G("postBeacon:"),!1}return!1})}function jr(r){return re(this,arguments,function*({url:e,params:t=null,json:n=!0}){var i=e;return t&&(i=i+_r(t)),yield un({method:"GET",url:i,json:n})})}function gt(i){return re(this,arguments,function*({url:e,data:t,json:n=!0,beacon:r=!1}){var a=t;if(n&&(a=JSON.stringify(a)),r){var o=yield Nr({url:e,data:t});if(o)return;Y("Beacon failed")}return yield un({method:"POST",url:e,data:a,json:n})})}var et="__zar_vid",cn="success",De="error",Tr=30*1e3,sn=0,Ar=3,W={};window.zarPoolData=null;var ge=new Map;function Mr(){return Date.now().toString(36)+"."+Math.random().toString(36).substring(2)}function zr(e,t,n,r){var i,a=!1,o=null,s=n(e);!s||!s.id?(i=t(),o=document.referrer,a=!0,Y("new ID for",e,"-",i)):(i=s.id,o=s.origReferrer);var p={id:i,t:Date.now(),origReferrer:o,isNew:a};return r(e,p),p}function ln(){var e=zr(et,Mr,on,Er);return{vid:e}}function fn(){return window.location.host+"/api/v1"}function dn(e){return on(e)}function pn(e){var t=dn(e);return t?t.id:null}function tt(){return{vid:dn(et)}}function Lr(){return{vid:pn(et)}}function gn({elem:e}){var t=null,n=null,r=null,i=new RegExp("\\+?\\(?\\d*\\)? ?\\(?\\d+\\)?\\d*([\\s./-]?\\d{2,})+","g");e.href&&e.href.startsWith("tel:")&&(r=e.href);var a=e.innerText,o=e.innerHTML,s=i.exec(a);return s&&(t=s[0].trim(),n=t.replace("+","").replace(/-/g,"").replace(/ /g,"").replace("(","").replace(")","").replace(/^1/,"")),{text:a,html:o,numberText:t,href:r,number:n}}function mt({elems:e,number:t,force:n=!1}){var r,i=t;t.startsWith("+1")||(i="+1"+t);for(var a=0;a<e.length;a++){if(ge.has(e[a]))if(n)r=ge.get(e[a]);else{Y("element already in overlay map:",e[a]);continue}var o=gn({elem:e[a]});if(r?!n&&o.number&&r.number&&r.number!==o.number&&G("overlaying multiple numbers with a single number",r.number,o.number):r=o,Y("overlaying",i,"on",e[a]),ge.has(e[a])||ge.set(e[a],o),o.href&&(e[a].href="tel:"+i),o.numberText)if(e[a].innerHTML="",o.text){var s=i;if(o.numberText.indexOf("-")>-1&&(s=i.slice(2,5)+"-"+i.slice(5,8)+"-"+i.slice(8,12)),o.html.indexOf("<img")>-1){var p=o.html.replace(o.numberText,s);e[a].innerHTML=p}else{var g=o.text.replace(o.numberText,s);e[a].appendChild(document.createTextNode(g))}}else e[a].appendChild(document.createTextNode(i));else Y("no number text found:",e[a])}}function vt({elems:e}){for(var t=0;t<e.length;t++)if(ge.has(e[t])){var n=e[t].innerHTML,r=ge.get(e[t]);Y("orig:",r);var i=r.html;Y("reverting",n,"to",i),e[t].innerHTML=i,r.href&&(e[t].href=r.href),ge.delete(e[t])}else Y("element not in map:",e[t])}function mn(e){clearInterval(W[e]),delete W[e]}function vn(){for(var e in W)mn(e)}function hn(i){return re(this,arguments,function*({poolId:e,apiUrl:t,number:n=null,context:r=null}){var a={pool_id:e,number:n,context:r,properties:{zar:tt()}},o=yield gt({url:`${t}/number_pool`,data:a});return o})}function $r(r){return re(this,arguments,function*({apiUrl:e,key:t=null,with_contexts:n=!1}){var i={key:t,with_contexts:n},a=yield jr({url:`${e}/number_pool_stats`,params:i});return a})}function Ur(){return re(this,arguments,function*({overlayElements:e,apiUrl:t=fn(),contextCallback:n=null}={}){var r={};n&&(r=n()||{});const i=window.zarPoolData.pool_id,a=window.zarPoolData.number;try{var o=yield hn({poolId:i,apiUrl:t,number:a,context:r})}catch(g){var s="error getting number: "+JSON.stringify(g);return G(s),sn++,sn>=Ar&&(G("max failures, stopping pool"),vn(),e&&vt({elems:e})),{status:De,msg:s}}if(o.status===cn&&o.number){var p=!1;o.number!==window.zarPoolData.number&&(G("number changed from "+window.zarPoolData.number+" to "+o.number),window.zarPoolData.number=o.number,p=!0),e&&mt({elems:e,number:o.number,force:p})}else e&&vt({elems:e}),W[i]&&(clearInterval(W[i]),delete W[i]);return o})}function yn(e){return Pr(e)?e():e}function bn(){return re(this,arguments,function*({poolData:e,poolConfig:t,apiUrl:n}={}){var r;if(!t||!t.poolId||!t.overlayQuerySelector||!n)return r="missing pool config: "+JSON.stringify(t),G(r),t.initCallback&&t.initCallback({status:De,msg:r}),W;var i={};t.contextCallback&&(i=t.contextCallback()||{});var a=yn(t.poolId);if(!a)return r="no pool ID",G(r),t.initCallback&&t.initCallback({status:De,msg:r}),W;if(!e)try{e=yield hn({poolId:a,apiUrl:n,number:null,context:i})}catch(o){return r="error getting number on init: "+JSON.stringify(o),G(r),t.initCallback&&t.initCallback({status:De,msg:r}),W}return window.zarPoolData=e,e&&e.status===cn&&e.number&&xr(function(){var o=document.querySelectorAll(t.overlayQuerySelector);if(!o){var s="No elems found for:"+t.overlayQuerySelector;G(s),t.initCallback&&t.initCallback({status:De,msg:s});return}mt({elems:o,number:e.number});var p=setInterval(function(){try{Ur({overlayElements:o,apiUrl:n,contextCallback:t.contextCallback})}catch(x){var g="error on interval: "+JSON.stringify(x);G(g)}},t.renewalInterval||Tr);W[e.pool_id]=p,t.initCallback&&t.initCallback(e)}),W})}function wn({apiUrl:e,poolConfig:t}){return ln(),{name:"zar",config:{apiUrl:e,poolConfig:t},initialize:function({config:n}){},loaded:function(){return!0},pageStart:function({payload:n,config:r,instance:i}){n.properties.zar=tt(),n.properties.referrer=document.referrer,n.properties.is_bot=an(),"hash"in n.properties&&delete n.properties.hash,"path"in n.properties&&delete n.properties.path,"search"in n.properties&&delete n.properties.search;try{var a=r.poolConfig;a&&a.poolId&&(n.properties.pool_id=yn(a.poolId),a.contextCallback&&(n.properties.pool_context=a.contextCallback()||{}))}catch(o){G("error getting pool id: "+JSON.stringify(o))}return n},page:function(o){return re(this,arguments,function*({payload:n,options:r,instance:i,config:a}){Y("page",n,r,a);for(var s=0,p=3,g;s<p;)try{g=yield gt({url:`${a.apiUrl}/page`,data:n});break}catch(x){if(s++,s>=p)throw G("error posting page: "+JSON.stringify(x)),x;yield new Promise(d=>setTimeout(d,1e3))}g&&g.pool_data&&bn({poolData:g.pool_data,poolConfig:a.poolConfig,apiUrl:a.apiUrl})})},trackStart:function({payload:n,config:r,instance:i}){return n.properties.zar=tt(),n.properties.url=window.location.href,n.properties.referrer=document.referrer,n},track:function({payload:n,options:r,instance:i,config:a}){Y("track",n),gt({url:`${a.apiUrl}/track`,data:n,beacon:!0})},methods:{apiUrl(){return e},poolConfig(){return t},initIDs(){return ln()},getIDs(){return Lr()},getStorage(){return tt()},getVID(){return pn(et)},hasAdBlock(){return kr()},isBot(){return an()},initTrackingPool({poolConfig:n}){var r=this.instance.plugins.zar;return bn({poolData:null,poolConfig:Object.assign(r.poolConfig(),n||{}),apiUrl:r.apiUrl()})},getPoolIntervals(){return W},clearPoolInterval({poolId:n}){mn(n)},clearPoolIntervals(){vn()},extractPhoneNumbers({elems:n}){for(var r=[],i=0;i<n.length;i++){var a=gn({elem:n[i]});r.push(a)}return r},overlayPhoneNumber({overlayElements:n,number:r}){mt({elems:n,number:r})},revertOverlayNumbers({overlayElements:n}){vt({elems:n})},getPoolStats({key:n=null,with_contexts:r=!1}){return $r({apiUrl:this.instance.plugins.zar.apiUrl(),key:n,with_contexts:r})}}}}function Dr({app:e,ga4Config:t=null,facebookConfig:n=null,apiUrl:r=null,poolConfig:i=null}){r||(r=fn());var a=[wn({apiUrl:r,poolConfig:i})];return t&&a.push(wr(t)),n&&a.push(yr(n)),nn({app:e,plugins:a})}Q.Analytics=nn,Q.init=Dr,Q.zar=wn,Object.defineProperties(Q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ var ee=(Q,ie,te)=>new Promise((Re,Ne)=>{var qe=C=>{try{ae(te.next(C))}catch(ve){Ne(ve)}},re=C=>{try{ae(te.throw(C))}catch(ve){Ne(ve)}},ae=C=>C.done?Re(C.value):Promise.resolve(C.value).then(qe,re);ae((te=te.apply(Q,ie)).next())});(function(Q,ie){typeof exports=="object"&&typeof module!="undefined"?ie(exports):typeof define=="function"&&define.amd?define(["exports"],ie):(Q=typeof globalThis!="undefined"?globalThis:Q||self,ie(Q.zar={}))})(this,function(Q){"use strict";function ie(e,t,r,n,i){for(t=t.split?t.split("."):t,n=0;n<t.length;n++)e=e?e[t[n]]:i;return e===i?r:e}var te="undefined",Re="object",Ne="any",qe="*",re="__",ae=typeof process!="undefined"?process:{};ae.env&&ae.env.NODE_ENV;var C=typeof window!="undefined";ae.versions!=null&&ae.versions.node!=null,typeof Deno!="undefined"&&Deno.core,C&&window.name==="nodejs"||typeof navigator!="undefined"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function ve(e,t){return t.charAt(0)[e]()+t.slice(1)}var xr=ve.bind(null,"toUpperCase"),Or=ve.bind(null,"toLowerCase");function Er(e){return It(e)?xr("null"):typeof e=="object"?zr(e):Object.prototype.toString.call(e).slice(8,-1)}function Be(e,t){t===void 0&&(t=!0);var r=Er(e);return t?Or(r):r}function je(e,t){return typeof t===e}var K=je.bind(null,"function"),me=je.bind(null,"string"),he=je.bind(null,"undefined"),kr=je.bind(null,"boolean");je.bind(null,"symbol");function It(e){return e===null}function _r(e){return Be(e)==="number"&&!isNaN(e)}function Nr(e){return Be(e)==="array"}function F(e){if(!jr(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function jr(e){return e&&(typeof e=="object"||e!==null)}function zr(e){return K(e.constructor)?e.constructor.name:null}function Tr(e){return e instanceof Error||me(e.message)&&e.constructor&&_r(e.constructor.stackTraceLimit)}function Pt(e,t){if(typeof t!="object"||It(t))return!1;if(t instanceof e)return!0;var r=Be(new e(""));if(Tr(t))for(;t;){if(Be(t)===r)return!0;t=Object.getPrototypeOf(t)}return!1}Pt.bind(null,TypeError),Pt.bind(null,SyntaxError);function Ve(e,t){var r=e instanceof Element||e instanceof HTMLDocument;return r&&t?Ar(e,t):r}function Ar(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function Je(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}Je(Ve,"form"),Je(Ve,"button"),Je(Ve,"input"),Je(Ve,"select");function St(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return null}}function Dr(){if(C){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function Lr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}}function Mr(e){return function(t){for(var r,n=Object.create(null),i=/([^&=]+)=?([^&]*)/g;r=i.exec(t);){var a=St(r[1]),o=St(r[2]);a.substring(a.length-2)==="[]"?(n[a=a.substring(0,a.length-2)]||(n[a]=[])).push(o):n[a]=o===""||o}for(var s in n){var p=s.split("[");p.length>1&&($r(n,p.map(function(g){return g.replace(/[?[\]\\ ]/g,"")}),n[s]),delete n[s])}return n}(function(t){if(t){var r=t.match(/\?(.*)/);return r&&r[1]?r[1].split("#")[0]:""}return C&&window.location.search.substring(1)}(e))}function $r(e,t,r){for(var n=t.length-1,i=0;i<n;++i){var a=t[i];if(a==="__proto__"||a==="constructor")break;a in e||(e[a]={}),e=e[a]}e[t[n]]=r}function Fe(){for(var e="",t=0,r=4294967295*Math.random()|0;t++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&r;e+=n=="-"||n=="4"?n:(n=="x"?i:3&i|8).toString(16),r=t%8==0?4294967295*Math.random()|0:r>>4}return e}var ze="global",ye=re+"global"+re,be=typeof self===Re&&self.self===self&&self||typeof global===Re&&global.global===global&&global||void 0;function se(e){return be[ye][e]}function le(e,t){return be[ye][e]=t}function we(e){delete be[ye][e]}function Ie(e,t,r){var n;try{if(it(e)){var i=window[e];n=i[t].bind(i)}}catch(a){}return n||r}be[ye]||(be[ye]={});var He={};function it(e){if(typeof He[e]!==te)return He[e];try{var t=window[e];t.setItem(te,te),t.removeItem(te)}catch(r){return He[e]=!1}return He[e]=!0}function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v.apply(this,arguments)}var oe="function",ne="undefined",Ur="@@redux/"+Math.random().toString(36),xt=function(){return typeof Symbol===oe&&Symbol.observable||"@@observable"}(),Ge=" != "+oe;function Ot(e,t,r){var n;if(typeof t===oe&&typeof r===ne&&(r=t,t=void 0),typeof r!==ne){if(typeof r!==oe)throw new Error("enhancer"+Ge);return r(Ot)(e,t)}if(typeof e!==oe)throw new Error("reducer"+Ge);var i=e,a=t,o=[],s=o,p=!1;function g(){s===o&&(s=o.slice())}function x(){return a}function d(h){if(typeof h!==oe)throw new Error("Listener"+Ge);var T=!0;return g(),s.push(h),function(){if(T){T=!1,g();var I=s.indexOf(h);s.splice(I,1)}}}function N(h){if(!F(h))throw new Error("Act != obj");if(typeof h.type===ne)throw new Error("ActType "+ne);if(p)throw new Error("Dispatch in reducer");try{p=!0,a=i(a,h)}finally{p=!1}for(var T=o=s,I=0;I<T.length;I++)(0,T[I])();return h}return N({type:"@@redux/INIT"}),(n={dispatch:N,subscribe:d,getState:x,replaceReducer:function(h){if(typeof h!==oe)throw new Error("next reducer"+Ge);i=h,N({type:"@@redux/INIT"})}})[xt]=function(){var h,T=d;return(h={subscribe:function(I){if(typeof I!="object")throw new TypeError("Observer != obj");function y(){I.next&&I.next(x())}return y(),{unsubscribe:T(y)}}})[xt]=function(){return this},h},n}function Cr(e,t){var r=t&&t.type;return"action "+(r&&r.toString()||"?")+"reducer "+e+" returns "+ne}function Pe(){var e=[].slice.call(arguments);return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,r){return function(){return t(r.apply(void 0,[].slice.call(arguments)))}})}function Rr(){var e=arguments;return function(t){return function(r,n,i){var a,o=t(r,n,i),s=o.dispatch,p={getState:o.getState,dispatch:function(g){return s(g)}};return a=[].slice.call(e).map(function(g){return g(p)}),v({},o,{dispatch:s=Pe.apply(void 0,a)(o.dispatch)})}}}var ue=re+"anon_id",fe=re+"user_id",Se=re+"user_traits",ce="userId",xe="anonymousId",We=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],at=["name","EVENTS","config","loaded"],m=We.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Et=/^utm_/,kt=/^an_prop_/,_t=/^an_trait_/;function qr(e){var t=e.storage.setItem;return function(r){return function(n){return function(i){if(i.type===m.bootstrap){var a=i.params,o=i.user,s=i.persistedUser,p=i.initialUser,g=s.userId===o.userId;s.anonymousId!==o.anonymousId&&t(ue,o.anonymousId),g||t(fe,o.userId),p.traits&&t(Se,v({},g&&s.traits?s.traits:{},p.traits));var x=Object.keys(i.params);if(x.length){var d=a.an_uid,N=a.an_event,h=x.reduce(function(T,I){if(I.match(Et)||I.match(/^(d|g)clid/)){var y=I.replace(Et,"");T.campaign[y==="campaign"?"name":y]=a[I]}return I.match(kt)&&(T.props[I.replace(kt,"")]=a[I]),I.match(_t)&&(T.traits[I.replace(_t,"")]=a[I]),T},{campaign:{},props:{},traits:{}});r.dispatch(v({type:m.params,raw:a},h,d?{userId:d}:{})),d&&setTimeout(function(){return e.identify(d,h.traits)},0),N&&setTimeout(function(){return e.track(N,h.props)},0),Object.keys(h.campaign).length&&r.dispatch({type:m.campaign,campaign:h.campaign})}}return n(i)}}}}function Br(e){return function(t,r){if(t===void 0&&(t={}),r===void 0&&(r={}),r.type===m.setItemEnd){if(r.key===ue)return v({},t,{anonymousId:r.value});if(r.key===fe)return v({},t,{userId:r.value})}switch(r.type){case m.identify:return Object.assign({},t,{userId:r.userId,traits:v({},t.traits,r.traits)});case m.reset:return[fe,ue,Se].forEach(function(n){e.removeItem(n)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function Nt(e){return{userId:e.getItem(fe),anonymousId:e.getItem(ue),traits:e.getItem(Se)}}var ot=function(e){return re+"TEMP"+re+e};function Vr(e){var t=e.storage,r=t.setItem,n=t.removeItem,i=t.getItem;return function(a){return function(o){return function(s){var p=s.userId,g=s.traits,x=s.options;if(s.type===m.reset&&([fe,Se,ue].forEach(function(h){n(h)}),[ce,xe,"traits"].forEach(function(h){we(ot(h))})),s.type===m.identify){i(ue)||r(ue,Fe());var d=i(fe),N=i(Se)||{};d&&d!==p&&a.dispatch({type:m.userIdChanged,old:{userId:d,traits:N},new:{userId:p,traits:g},options:x}),p&&r(fe,p),g&&r(Se,v({},N,g))}return o(s)}}}}var Te={};function jt(e,t){Te[e]&&K(Te[e])&&(Te[e](t),delete Te[e])}function zt(e,t,r){return new Promise(function(n,i){return t()?n(e):r<1?i(v({},e,{queue:!0})):new Promise(function(a){return setTimeout(a,10)}).then(function(a){return zt(e,t,r-10).then(n,i)})})}function Tt(e,t,r){var n=t(),i=e.getState(),a=i.plugins,o=i.queue,s=i.user;if(!i.context.offline&&o&&o.actions&&o.actions.length){var p=o.actions.reduce(function(x,d,N){return a[d.plugin].loaded?(x.process.push(d),x.processIndex.push(N)):(x.requeue.push(d),x.requeueIndex.push(N)),x},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(p.processIndex&&p.processIndex.length){p.processIndex.forEach(function(x){var d=o.actions[x],N=d.plugin,h=d.payload.type,T=n[N][h];if(T&&K(T)){var I=function(E,j){return E===void 0&&(E={}),j===void 0&&(j={}),[ce,xe].reduce(function(A,l){return E.hasOwnProperty(l)&&j[l]&&j[l]!==E[l]&&(A[l]=j[l]),A},E)}(d.payload,s);T({payload:I,config:a[N].config,instance:r});var y=h+":"+N;e.dispatch(v({},I,{type:y,_:{called:y,from:"queueDrain"}}))}});var g=o.actions.filter(function(x,d){return!~p.processIndex.indexOf(d)});o.actions=g}}}var ut=function(e){var t=e.data,r=e.action,n=e.instance,i=e.state,a=e.allPlugins,o=e.allMatches,s=e.store,p=e.EVENTS;try{var g=i.plugins,x=i.context,d=r.type,N=d.match(Oe),h=t.exact.map(function(y){return y.pluginName});N&&(h=o.during.map(function(y){return y.pluginName}));var T=function(y,E){return function(j,A,l){var b=A.config,M=A.name,D=M+"."+j.type;l&&(D=l.event);var L=j.type.match(Oe)?function(B,$,H,R,G){return function(P,z){var X=R?R.name:B,J=z&&Ae(z)?z:H;if(R&&(!(J=z&&Ae(z)?z:[B]).includes(B)||J.length!==1))throw new Error("Method "+$+" can only abort "+B+" plugin. "+JSON.stringify(J)+" input valid");return v({},G,{abort:{reason:P,plugins:J,caller:$,_:X}})}}(M,D,E,l,j):function(B,$){return function(){throw new Error(B.type+" action not cancellable. Remove abort in "+$)}}(j,D);return{payload:Jr(j),instance:y,config:b||{},abort:L}}}(n,h),I=t.exact.reduce(function(y,E){var j=E.pluginName,A=E.methodName,l=!1;return A.match(/^initialize/)||A.match(/^reset/)||(l=!g[j].loaded),x.offline&&A.match(/^(page|track|identify)/)&&(l=!0),y[""+j]=l,y},{});return Promise.resolve(t.exact.reduce(function(y,E,j){var A=E.pluginName;return Promise.resolve(y).then(function(l){function b(){return Promise.resolve(l)}var M=function(){if(t.namespaced&&t.namespaced[A])return Promise.resolve(t.namespaced[A].reduce(function(D,L,B){return Promise.resolve(D).then(function($){return L.method&&K(L.method)?(function(P,z){var X=Rt(P);if(X&&X.name===z){var J=Rt(X.method);throw new Error([z+" plugin is calling method "+P,"Plugins cant call self","Use "+X.method+" "+(J?"or "+J.method:"")+" in "+z+" plugin insteadof "+P].join(`
2
+ `))}}(L.methodName,L.pluginName),Promise.resolve(L.method({payload:$,instance:n,abort:(H=$,R=A,G=L.pluginName,function(P,z){return v({},H,{abort:{reason:P,plugins:z||[R],caller:d,from:G||R}})}),config:Lt(L.pluginName,g,a),plugins:g})).then(function(P){var z=F(P)?P:{};return Promise.resolve(v({},$,z))})):$;var H,R,G})},Promise.resolve(r))).then(function(D){l[A]=D});l[A]=r}();return M&&M.then?M.then(b):b()})},Promise.resolve({}))).then(function(y){return Promise.resolve(t.exact.reduce(function(E,j,A){try{var l=t.exact.length===A+1,b=j.pluginName,M=a[b];return Promise.resolve(E).then(function(D){var L=y[b]?y[b]:{};if(N&&(L=D),st(L,b))return ct({data:L,method:d,instance:n,pluginName:b,store:s}),Promise.resolve(D);if(st(D,b))return l&&ct({data:D,method:d,instance:n,store:s}),Promise.resolve(D);if(I.hasOwnProperty(b)&&I[b]===!0)return s.dispatch({type:"queue",plugin:b,payload:L,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(D);var B=T(y[b],a[b]);return Promise.resolve(M[d]({abort:B.abort,payload:L,instance:n,config:Lt(b,g,a),plugins:g})).then(function($){var H=F($)?$:{},R=v({},D,H),G=y[b];if(st(G,b))ct({data:G,method:d,instance:n,pluginName:b,store:s});else{var P=d+":"+b;(P.match(/:/g)||[]).length<2&&!d.match(At)&&!d.match(Dt)&&n.dispatch(v({},N?R:L,{type:P,_:{called:P,from:"submethod"}}))}return Promise.resolve(R)})})}catch(D){return Promise.reject(D)}},Promise.resolve(r))).then(function(E){if(!(d.match(Oe)||d.match(/^registerPlugin/)||d.match(Dt)||d.match(At)||d.match(/^params/)||d.match(/^userIdChanged/))){if(p.plugins.includes(d),E._&&E._.originalAction===d)return E;var j=v({},E,{_:{originalAction:E.type,called:E.type,from:"engineEnd"}});Ut(E,t.exact.length)&&!d.match(/End$/)&&(j=v({},j,{type:E.type+"Aborted"})),s.dispatch(j)}return E})})}catch(y){return Promise.reject(y)}},Oe=/Start$/,At=/^bootstrap/,Dt=/^ready/;function ct(e){var t=e.pluginName,r=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(v({},e.data,{type:r,_:{called:r,from:"abort"}}))}function Lt(e,t,r){var n=t[e]||r[e];return n&&n.config?n.config:{}}function Mt(e,t){return t.reduce(function(r,n){return n[e]?r.concat({methodName:e,pluginName:n.name,method:n[e]}):r},[])}function $t(e,t){var r=e.replace(Oe,""),n=t?":"+t:"";return[""+e+n,""+r+n,r+"End"+n]}function st(e,t){var r=e.abort;return!!r&&(r===!0||Ct(r,t)||r&&Ct(r.plugins,t))}function Ut(e,t){var r=e.abort;if(!r)return!1;if(r===!0||me(r))return!0;var n=r.plugins;return Ae(r)&&r.length===t||Ae(n)&&n.length===t}function Ae(e){return Array.isArray(e)}function Ct(e,t){return!(!e||!Ae(e))&&e.includes(t)}function Rt(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function Jr(e){return Object.keys(e).reduce(function(t,r){return r==="type"||(t[r]=F(e[r])?Object.assign({},e[r]):e[r]),t},{})}function Fr(e,t,r){var n={};return function(i){return function(a){return function(o){try{var s,p=function(l){return s?l:a(d)},g=o.type,x=o.plugins,d=o;if(o.abort)return Promise.resolve(a(o));if(g===m.enablePlugin&&i.dispatch({type:m.initializeStart,plugins:x,disabled:[],fromEnable:!0,meta:o.meta}),g===m.disablePlugin&&setTimeout(function(){return jt(o.meta.rid,{payload:o})},0),g===m.initializeEnd){var N=t(),h=Object.keys(N),T=h.filter(function(l){return x.includes(l)}).map(function(l){return N[l]}),I=[],y=[],E=o.disabled,j=T.map(function(l){var b=l.name;return zt(l,l.loaded,1e4).then(function(M){return n[b]||(i.dispatch({type:m.pluginReadyType(b),name:b,events:Object.keys(l).filter(function(D){return!at.includes(D)})}),n[b]=!0),I=I.concat(b),l}).catch(function(M){if(M instanceof Error)throw new Error(M);return y=y.concat(M.name),M})});Promise.all(j).then(function(l){var b={plugins:I,failed:y,disabled:E};setTimeout(function(){h.length===j.length+E.length&&i.dispatch(v({},{type:m.ready},b))},0)})}var A=function(){if(g!==m.bootstrap)return/^ready:([^:]*)$/.test(g)&&setTimeout(function(){return Tt(i,t,e)},0),Promise.resolve(function(l,b,M,D,L){try{var B=K(b)?b():b,$=l.type,H=$.replace(Oe,"");if(l._&&l._.called)return Promise.resolve(l);var R=M.getState(),G=(X=B,(J=R.plugins)===void 0&&(J={}),(c=l.options)===void 0&&(c={}),Object.keys(X).filter(function(u){var f=c.plugins||{};return kr(f[u])?f[u]:f.all!==!1&&(!J[u]||J[u].enabled!==!1)}).map(function(u){return X[u]}));$===m.initializeStart&&l.fromEnable&&(G=Object.keys(R.plugins).filter(function(u){var f=R.plugins[u];return l.plugins.includes(u)&&!f.initialized}).map(function(u){return B[u]}));var P=G.map(function(u){return u.name}),z=function(u,f,S){var O=$t(u).map(function(w){return Mt(w,f)});return f.reduce(function(w,q){var k=q.name,U=$t(u,k).map(function(_e){return Mt(_e,f)}),_=U[0],Z=U[1],ke=U[2];return _.length&&(w.beforeNS[k]=_),Z.length&&(w.duringNS[k]=Z),ke.length&&(w.afterNS[k]=ke),w},{before:O[0],beforeNS:{},during:O[1],duringNS:{},after:O[2],afterNS:{}})}($,G);return Promise.resolve(ut({action:l,data:{exact:z.before,namespaced:z.beforeNS},state:R,allPlugins:B,allMatches:z,instance:M,store:D,EVENTS:L})).then(function(u){function f(){var w=function(){if($.match(Oe))return Promise.resolve(ut({action:v({},S,{type:H+"End"}),data:{exact:z.after,namespaced:z.afterNS},state:R,allPlugins:B,allMatches:z,instance:M,store:D,EVENTS:L})).then(function(q){q.meta&&q.meta.hasCallback&&jt(q.meta.rid,{payload:q})})}();return w&&w.then?w.then(function(){return u}):u}if(Ut(u,P.length))return u;var S,O=function(){if($!==H)return Promise.resolve(ut({action:v({},u,{type:H}),data:{exact:z.during,namespaced:z.duringNS},state:R,allPlugins:B,allMatches:z,instance:M,store:D,EVENTS:L})).then(function(w){S=w});S=u}();return O&&O.then?O.then(f):f()})}catch(u){return Promise.reject(u)}var X,J,c}(o,t,e,i,r)).then(function(l){var b=a(l);return s=1,b})}();return Promise.resolve(A&&A.then?A.then(p):p(A))}catch(l){return Promise.reject(l)}}}}}function Hr(e){return function(t){return function(r){return function(n){var i=n.type,a=n.key,o=n.value,s=n.options;if(i===m.setItem||i===m.removeItem){if(n.abort)return r(n);i===m.setItem?e.setItem(a,o,s):e.removeItem(a,s)}return r(n)}}}}var Gr=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,r){e[r]=e[r].concat(t)},this.removeMiddleware=function(t,r){var n=e[r].findIndex(function(i){return i===t});n!==-1&&(e[r]=[].concat(e[r].slice(0,n),e[r].slice(n+1)))},this.dynamicMiddlewares=function(t){return function(r){return function(n){return function(i){var a={getState:r.getState,dispatch:function(s){return r.dispatch(s)}},o=e[t].map(function(s){return s(a)});return Pe.apply(void 0,o)(n)(i)}}}}};function Wr(e){return function(t,r){t===void 0&&(t={});var n={};if(r.type==="initialize:aborted")return t;if(/^registerPlugin:([^:]*)$/.test(r.type)){var i=qt(r.type,"registerPlugin"),a=e()[i];if(!a||!i)return t;var o=r.enabled;return n[i]={enabled:o,initialized:!!o&&Boolean(!a.initialize),loaded:!!o&&Boolean(a.loaded()),config:a.config||{}},v({},t,n)}if(/^initialize:([^:]*)$/.test(r.type)){var s=qt(r.type,m.initialize),p=e()[s];return p&&s?(n[s]=v({},t[s],{initialized:!0,loaded:Boolean(p.loaded())}),v({},t,n)):t}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=v({},t[r.name],{loaded:!0}),v({},t,n);switch(r.type){case m.disablePlugin:return v({},t,Bt(r.plugins,!1,t));case m.enablePlugin:return v({},t,Bt(r.plugins,!0,t));default:return t}}}function qt(e,t){return e.substring(t.length+1,e.length)}function Bt(e,t,r){return e.reduce(function(n,i){return n[i]=v({},r[i],{enabled:t}),n},r)}function Vt(e){try{return JSON.parse(JSON.stringify(e))}catch(t){}return e}var Xr={last:{},history:[]};function Qr(e,t){e===void 0&&(e=Xr);var r=t.options,n=t.meta;if(t.type===m.track){var i=Vt(v({event:t.event,properties:t.properties},Object.keys(r).length&&{options:r},{meta:n}));return v({},e,{last:i,history:e.history.concat(i)})}return e}var Kr={actions:[]};function Yr(e,t){e===void 0&&(e=Kr);var r=t.payload;switch(t.type){case"queue":var n;return n=r&&r.type&&r.type===m.identify?[t].concat(e.actions):e.actions.concat(t),v({},e,{actions:n});case"dequeue":return[];default:return e}}var Jt=/#.*$/;function Zr(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(Jt,""):"")}var Ft,Ht,Gt,Wt,en=function(e){if(e===void 0&&(e={}),!C)return e;var t=document,r=t.title,n=t.referrer,i=window,a=i.location,o=i.innerWidth,s=i.innerHeight,p=a.hash,g=a.search,x=function(N){var h=function(){if(C){for(var T,I=document.getElementsByTagName("link"),y=0;T=I[y];y++)if(T.getAttribute("rel")==="canonical")return T.getAttribute("href")}}();return h?h.match(/\?/)?h:h+N:window.location.href.replace(Jt,"")}(g),d={title:r,url:x,path:Zr(x),hash:p,search:g,width:o,height:s};return n&&n!==""&&(d.referrer=n),v({},d,e)},tn={last:{},history:[]};function rn(e,t){e===void 0&&(e=tn);var r=t.options;if(t.type===m.page){var n=Vt(v({properties:t.properties,meta:t.meta},Object.keys(r).length&&{options:r}));return v({},e,{last:n,history:e.history.concat(n)})}return e}Ft=function(){if(!C)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"}(),Ht=C?document.referrer:null,Gt=Dr(),Wt=Lr();var Xt={initialized:!1,sessionId:Fe(),app:null,version:null,debug:!1,offline:!!C&&!navigator.onLine,os:{name:Ft},userAgent:C?navigator.userAgent:"node",library:{name:"analytics",version:"0.11.0"},timezone:Wt,locale:Gt,campaign:{},referrer:Ht};function nn(e,t){e===void 0&&(e=Xt);var r=e.initialized,n=t.campaign;switch(t.type){case m.campaign:return v({},e,{campaign:n});case m.offline:return v({},e,{offline:!0});case m.online:return v({},e,{offline:!1});default:return r?e:v({},Xt,e,{initialized:!0})}}var an=["plugins","reducers","storage"];function on(e,t,r){if(C){var n=window[(r?"add":"remove")+"EventListener"];e.split(" ").forEach(function(i){n(i,t)})}}function un(e){var t=on.bind(null,"online offline",function(r){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(r){return t(!1)}}function Qt(){return le("analytics",[]),function(e){return function(t,r,n){var i=e(t,r,n),a=i.dispatch;return Object.assign(i,{dispatch:function(o){return be[ye].analytics.push(o.action||o),a(o)}})}}}function Kt(e){return function(){return Pe(Pe.apply(null,arguments),Qt())}}function lt(e){return e?Nr(e)?e:[e]:[]}function Yt(e,t,r){e===void 0&&(e={});var n,i,a=Fe();return t&&(Te[a]=(n=t,i=function(o){for(var s,p=o||Array.prototype.slice.call(arguments),g=0;g<p.length;g++)if(K(p[g])){s=p[g];break}return s}(r),function(o){i&&i(o),n(o)})),v({},e,{rid:a,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function cn(e){e===void 0&&(e={});var t=e.reducers||{},r=e.initialUser||{},n=(e.plugins||[]).reduce(function(c,u){if(K(u))return c.middlewares=c.middlewares.concat(u),c;if(u.NAMESPACE&&(u.name=u.NAMESPACE),!u.name)throw new Error("https://lytics.dev/errors/1");var f=u.EVENTS?Object.keys(u.EVENTS).map(function(w){return u.EVENTS[w]}):[];c.pluginEnabled[u.name]=!(u.enabled===!1||u.config&&u.config.enabled===!1),delete u.enabled,u.methods&&(c.methods[u.name]=Object.keys(u.methods).reduce(function(w,q){var k;return w[q]=(k=u.methods[q],function(){for(var U=Array.prototype.slice.call(arguments),_=new Array(k.length),Z=0;Z<U.length;Z++)_[Z]=U[Z];return _[_.length]=l,k.apply({instance:l},_)}),w},{}),delete u.methods);var S=Object.keys(u).concat(f),O=new Set(c.events.concat(S));if(c.events=Array.from(O),c.pluginsArray=c.pluginsArray.concat(u),c.plugins[u.name])throw new Error(u.name+"AlreadyLoaded");return c.plugins[u.name]=u,c.plugins[u.name].loaded||(c.plugins[u.name].loaded=function(){return!0}),c},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=e.storage?e.storage:{getItem:se,setItem:le,removeItem:we},a=function(c){return function(u,f,S){return f.getState("user")[u]||(S&&F(S)&&S[u]?S[u]:Nt(c)[u]||se(ot(u))||null)}}(i),o=n.plugins,s=n.events.filter(function(c){return!at.includes(c)}).sort(),p=new Set(s.concat(We).filter(function(c){return!at.includes(c)})),g=Array.from(p).sort(),x=function(){return o},d=new Gr,N=d.addMiddleware,h=d.removeMiddleware,T=d.dynamicMiddlewares,I=function(){throw new Error("Abort disabled inListener")},y=Mr(),E=Nt(i),j=v({},E,r,y.an_uid?{userId:y.an_uid}:{},y.an_aid?{anonymousId:y.an_aid}:{});j.anonymousId||(j.anonymousId=Fe());var A=v({enable:function(c,u){return new Promise(function(f){P.dispatch({type:m.enablePlugin,plugins:lt(c),_:{originalAction:m.enablePlugin}},f,[u])})},disable:function(c,u){return new Promise(function(f){P.dispatch({type:m.disablePlugin,plugins:lt(c),_:{originalAction:m.disablePlugin}},f,[u])})}},n.methods),l={identify:function(c,u,f,S){try{var O=me(c)?c:null,w=F(c)?c:u,q=f||{},k=l.user();le(ot(ce),O);var U=O||w.userId||a(ce,l,w);return Promise.resolve(new Promise(function(_){P.dispatch(v({type:m.identifyStart,userId:U,traits:w||{},options:q,anonymousId:k.anonymousId},k.id&&k.id!==O&&{previousId:k.id}),_,[u,f,S])}))}catch(_){return Promise.reject(_)}},track:function(c,u,f,S){try{var O=F(c)?c.event:c;if(!O||!me(O))throw new Error("EventMissing");var w=F(c)?c:u||{},q=F(f)?f:{};return Promise.resolve(new Promise(function(k){P.dispatch({type:m.trackStart,event:O,properties:w,options:q,userId:a(ce,l,u),anonymousId:a(xe,l,u)},k,[u,f,S])}))}catch(k){return Promise.reject(k)}},page:function(c,u,f){try{var S=F(c)?c:{},O=F(u)?u:{};return Promise.resolve(new Promise(function(w){P.dispatch({type:m.pageStart,properties:en(S),options:O,userId:a(ce,l,S),anonymousId:a(xe,l,S)},w,[c,u,f])}))}catch(w){return Promise.reject(w)}},user:function(c){if(c===ce||c==="id")return a(ce,l);if(c===xe||c==="anonId")return a(xe,l);var u=l.getState("user");return c?ie(u,c):u},reset:function(c){return new Promise(function(u){P.dispatch({type:m.resetStart},u,c)})},ready:function(c){return l.on(m.ready,c)},on:function(c,u){if(!c||!K(u))return!1;if(c===m.bootstrap)throw new Error(".on disabled for "+c);var f=/Start$|Start:/;if(c==="*"){var S=function(k){return function(U){return function(_){return _.type.match(f)&&u({payload:_,instance:l,plugins:o}),U(_)}}},O=function(k){return function(U){return function(_){return _.type.match(f)||u({payload:_,instance:l,plugins:o}),U(_)}}};return N(S,Xe),N(O,Qe),function(){h(S,Xe),h(O,Qe)}}var w=c.match(f)?Xe:Qe,q=function(k){return function(U){return function(_){return _.type===c&&u({payload:_,instance:l,plugins:o,abort:I}),U(_)}}};return N(q,w),function(){return h(q,w)}},once:function(c,u){if(!c||!K(u))return!1;if(c===m.bootstrap)throw new Error(".once disabled for "+c);var f=l.on(c,function(S){u({payload:S.payload,instance:l,plugins:o,abort:I}),f()});return f},getState:function(c){var u=P.getState();return c?ie(u,c):Object.assign({},u)},dispatch:function(c){var u=me(c)?{type:c}:c;if(We.includes(u.type))throw new Error("reserved action "+u.type);var f=v({},u,{_:v({originalAction:u.type},c._||{})});P.dispatch(f)},enablePlugin:A.enable,disablePlugin:A.disable,plugins:A,storage:{getItem:i.getItem,setItem:function(c,u,f){P.dispatch({type:m.setItemStart,key:c,value:u,options:f})},removeItem:function(c,u){P.dispatch({type:m.removeItemStart,key:c,options:u})}},setAnonymousId:function(c,u){l.storage.setItem(ue,c,u)},events:{core:We,plugins:s}},b=n.middlewares.concat([function(c){return function(u){return function(f){return f.meta||(f.meta=Yt()),u(f)}}},T(Xe),Fr(l,x,{all:g,plugins:s}),Hr(i),qr(l),Vr(l),T(Qe)]),M={context:nn,user:Br(i),page:rn,track:Qr,plugins:Wr(x),queue:Yr},D=Pe,L=Pe;if(C&&e.debug){var B=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;B&&(D=B({trace:!0,traceLimit:25})),L=function(){return arguments.length===0?Qt():F(typeof arguments[0])?Kt():Kt().apply(null,arguments)}}var $,H=function(c){return Object.keys(c).reduce(function(u,f){return an.includes(f)||(u[f]=c[f]),u},{})}(e),R=n.pluginsArray.reduce(function(c,u){var f=u.name,S=u.config,O=u.loaded,w=n.pluginEnabled[f];return c[f]={enabled:w,initialized:!!w&&Boolean(!u.initialize),loaded:Boolean(O()),config:S||{}},c},{}),G={context:H,user:j,plugins:R},P=Ot(function(c){for(var u=Object.keys(c),f={},S=0;S<u.length;S++){var O=u[S];typeof c[O]===oe&&(f[O]=c[O])}var w,q=Object.keys(f);try{(function(k){Object.keys(k).forEach(function(U){var _=k[U];if(typeof _(void 0,{type:"@@redux/INIT"})===ne||typeof _(void 0,{type:Ur})===ne)throw new Error("reducer "+U+" "+ne)})})(f)}catch(k){w=k}return function(k,U){if(k===void 0&&(k={}),w)throw w;for(var _=!1,Z={},ke=0;ke<q.length;ke++){var _e=q[ke],Sr=k[_e],wt=(0,f[_e])(Sr,U);if(typeof wt===ne){var Vn=Cr(_e,U);throw new Error(Vn)}Z[_e]=wt,_=_||wt!==Sr}return _?Z:k}}(v({},M,t)),G,L(D(Rr.apply(void 0,b))));P.dispatch=($=P.dispatch,function(c,u,f){var S=v({},c,{meta:Yt(c.meta,u,lt(f))});return $.apply(null,[S])});var z=Object.keys(o);P.dispatch({type:m.bootstrap,plugins:z,config:H,params:y,user:j,initialUser:r,persistedUser:E});var X=z.filter(function(c){return n.pluginEnabled[c]}),J=z.filter(function(c){return!n.pluginEnabled[c]});return P.dispatch({type:m.registerPlugins,plugins:z,enabled:n.pluginEnabled}),n.pluginsArray.map(function(c,u){var f=c.bootstrap,S=c.config,O=c.name;f&&K(f)&&f({instance:l,config:S,payload:c}),P.dispatch({type:m.registerPluginType(O),name:O,enabled:n.pluginEnabled[O],plugin:c}),n.pluginsArray.length===u+1&&P.dispatch({type:m.initializeStart,plugins:X,disabled:J})}),un(function(c){P.dispatch({type:c?m.offline:m.online})}),function(c,u,f){setInterval(function(){return Tt(c,u,f)},3e3)}(P,x,l),l}var Xe="before",Qe="after",De="cookie",de=tr(),Zt=Ke,sn=Ke;function er(e){return de?Ke(e,"",-1):we(e)}function tr(){if(de!==void 0)return de;var e="cookiecookie";try{Ke(e,e),de=document.cookie.indexOf(e)!==-1,er(e)}catch(t){de=!1}return de}function Ke(e,t,r,n,i,a){if(typeof window!="undefined"){var o=arguments.length>1;return de===!1&&(o?le(e,t):se(e)),o?document.cookie=e+"="+encodeURIComponent(t)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(n?"; path="+n:"")+(i?"; domain="+i:"")+(a?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var Le="localStorage",ln=it.bind(null,"localStorage");Ie("localStorage","getItem",se),Ie("localStorage","setItem",le),Ie("localStorage","removeItem",we);var Me="sessionStorage",fn=it.bind(null,"sessionStorage");Ie("sessionStorage","getItem",se),Ie("sessionStorage","setItem",le),Ie("sessionStorage","removeItem",we);function Ee(e){var t=e;try{if((t=JSON.parse(e))==="true")return!0;if(t==="false")return!1;if(F(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch(r){}if(t!==null&&t!=="")return t}var dn=ln(),pn=fn(),gn=tr();function rr(e,t){if(e){var r=ft(t),n=!vt(r),i=dt(r)?Ee(localStorage.getItem(e)):void 0;if(n&&!he(i))return i;var a=pt(r)?Ee(Zt(e)):void 0;if(n&&a)return a;var o=gt(r)?Ee(sessionStorage.getItem(e)):void 0;if(n&&o)return o;var s=se(e);return n?s:{localStorage:i,sessionStorage:o,cookie:a,global:s}}}function vn(e,t,r){if(e&&!he(t)){var n={},i=ft(r),a=JSON.stringify(t),o=!vt(i);return dt(i)&&(n[Le]=Ze(Le,t,Ee(localStorage.getItem(e))),localStorage.setItem(e,a),o)?n[Le]:pt(i)&&(n[De]=Ze(De,t,Ee(Zt(e))),sn(e,a),o)?n[De]:gt(i)&&(n[Me]=Ze(Me,t,Ee(sessionStorage.getItem(e))),sessionStorage.setItem(e,a),o)?n[Me]:(n[ze]=Ze(ze,t,se(e)),le(e,t),o?n[ze]:n)}}function mn(e,t){if(e){var r=ft(t),n=rr(e,qe),i={};return!he(n.localStorage)&&dt(r)&&(localStorage.removeItem(e),i[Le]=n.localStorage),!he(n.cookie)&&pt(r)&&(er(e),i[De]=n.cookie),!he(n.sessionStorage)&&gt(r)&&(sessionStorage.removeItem(e),i[Me]=n.sessionStorage),!he(n.global)&&Ye(r,ze)&&(we(e),i[ze]=n.global),i}}function ft(e){return e?me(e)?e:e.storage:Ne}function dt(e){return dn&&Ye(e,Le)}function pt(e){return gn&&Ye(e,De)}function gt(e){return pn&&Ye(e,Me)}function vt(e){return e===qe||e==="all"}function Ye(e,t){return e===Ne||e===t||vt(e)}function Ze(e,t,r){return{location:e,current:t,previous:r}}var hn={setItem:vn,getItem:rr,removeItem:mn};function yn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ir(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nr(Object(r),!0).forEach(function(n){yn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ar(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:hn};return cn(ir(ir({},t),e))}function bn(e,t,r,n,i,a,o){e.fbq||(i=e.fbq=function(){i.callMethod?i.callMethod.apply(i,arguments):i.queue.push(arguments)},e._fbq||(e._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[],a=t.createElement(r),a.async=!0,a.src=n,o=t.getElementsByTagName(r)[0],o.parentNode.insertBefore(a,o))}function wn({trackingId:e}){bn(window,document,"script","https://connect.facebook.net/en_US/fbevents.js"),window.fbq("init",e)}function In(e={}){return{name:"facebook",config:e,initialize:function({config:t,instance:r}){if(!t.trackingId)throw new Error("No Facebook trackingId defined");wn({trackingId:t.trackingId})},page:function({payload:t,config:r,instance:n}){window.fbq("track","PageView")},track:function({payload:t,config:r,instance:n}){window.fbq("track",t.event,t.properties)},identify:function({payload:t,config:r}){},loaded:function(){return!!window.fbq}}}function $e(){window.dataLayer.push(arguments)}window.gtag=$e;function Pn({trackingId:e,configParams:t={},setParams:r={}}){var n="ga-gtag";if(!document.getElementById(n)){var i=document.head,a=document.createElement("script");a.id=n,a.type="text/javascript",a.async=!0,a.src="https://www.googletagmanager.com/gtag/js?id="+e,i.insertBefore(a,i.firstChild),window.dataLayer=window.dataLayer||[],$e("js",new Date),r&&$e("set",r),$e("config",e,t)}}function Sn(e={}){return{name:"google-analytics-4",config:e,initialize:function({config:t,instance:r}){if(!t.trackingId)throw new Error("No GA trackingId defined");var n={},i={};if(t.customDimensions){for(var a={},o=0;o<t.customDimensions.length;o++){var s=t.customDimensions[o];n[s.name]=s.callback(r,t),a["dimension"+(o+1)]=s.name}i.custom_map=a}Pn({trackingId:t.trackingId,configParams:n,setParams:i})},page:function({payload:t,config:r,instance:n}){},track:function({payload:t,config:r,instance:n}){$e("event",t.event,t.properties)},identify:function({payload:t,config:r}){},loaded:function(){return!!window.gtag}}}var xn=new URLSearchParams(window.location.search),On=xn.get("zdbg"),or={};const et="undefined";function Y(){On==1&&console.debug(...arguments)}function V(e){console.warn(e),window.Rollbar&&window.Rollbar.warning(e)}function En(e){return e&&(Object.prototype.toString.call(e)==="[object Function]"||typeof e=="function"||e instanceof Function)}function ur(){try{var e=navigator.userAgent||"",t=new RegExp([/bot/,/spider/,/crawl/,/mediapartners/,/Google-Read-Aloud/,/semrush/].map(r=>r.source).join("|"),"i");return t.test(e)}catch(r){return!1}}function kn(e){document.readyState==="complete"||document.readyState==="loaded"||document.readyState==="interactive"?e():window.addEventListener("DOMContentLoaded",e)}var pe=_n();function _n(){if(typeof pe!==et)return pe;pe=!0;try{sessionStorage.setItem(et,et),sessionStorage.removeItem(et)}catch(e){pe=!1}return pe}function cr(e){var t,r=or[e];return pe?(t=sessionStorage.getItem(e),!t&&r&&(t=r,sessionStorage.setItem(e,t))):t=r,t?JSON.parse(t):void 0}function Nn(e,t){var r=JSON.stringify(t);pe&&sessionStorage.setItem(e,r),or[e]=r}function jn(){var e=document.createElement("div");e.innerHTML="&nbsp;",e.className="pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links",e.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;");try{if(document.body.appendChild(e),document.body.getAttribute("abp")!==null||e.offsetHeight===0||e.clientHeight===0)return!0;if(typeof getComputedStyle!="undefined"){var t=window.getComputedStyle(e,null);if(t&&(t.getPropertyValue("display")==="none"||t.getPropertyValue("visibility")==="hidden"))return!0}document.body.removeChild(e)}catch(r){}return!1}function sr({method:e,url:t,data:r,json:n=!0}){return new Promise(function(i,a){var o=new XMLHttpRequest;o.open(e,t),o.withCredentials=!0,n&&(o.setRequestHeader("Accept","application/json"),o.setRequestHeader("Content-Type","application/json")),o.onload=function(){this.status>=200&&this.status<300?i(n?JSON.parse(o.response):o.response):a({status:this.status,message:o.statusText})},o.onerror=function(){a({status:this.status,message:"Network Error"})},r?o.send(r):o.send()})}function zn(e){return"?"+Object.keys(e).map(function(t){return t+"="+encodeURIComponent(e[t])}).join("&")}function Tn(r){return ee(this,arguments,function*({url:e,data:t}){if(window&&window.navigator&&typeof window.navigator.sendBeacon=="function"&&typeof window.Blob=="function")try{const n=new Blob([JSON.stringify(t)],{type:"text/plain; charset=UTF-8"});return!!window.navigator.sendBeacon(e,n)}catch(n){return V("postBeacon:"),!1}return!1})}function An(n){return ee(this,arguments,function*({url:e,params:t=null,json:r=!0}){var i=e;return t&&(i=i+zn(t)),yield sr({method:"GET",url:i,json:r})})}function tt(i){return ee(this,arguments,function*({url:e,data:t,json:r=!0,beacon:n=!1}){var a=t;if(r&&(a=JSON.stringify(a)),n){var o=yield Tn({url:e,data:t});if(o)return;Y("Beacon failed")}return yield sr({method:"POST",url:e,data:a,json:r})})}var rt="__zar_vid",lr="success",Ue="error",Dn=30*1e3,fr=0,Ln=3,W={};window.zarPoolData=window.zarPoolData||null,window.zarPoolDLObserverDone=window.zarPoolDLObserverDone||!1,window.zarPoolDataLayer=window.zarPoolDataLayer||[];var ge=new Map;function Mn(){return Date.now().toString(36)+"."+Math.random().toString(36).substring(2)}function $n(e,t,r,n){var i,a=!1,o=null,s=r(e);!s||!s.id?(i=t(),o=document.referrer,a=!0,Y("new ID for",e,"-",i)):(i=s.id,o=s.origReferrer);var p={id:i,t:Date.now(),origReferrer:o,isNew:a};return n(e,p),p}function dr(){var e=$n(rt,Mn,cr,Nn);return{vid:e}}function pr(){return window.location.protocol+"://"+window.location.host+"/api/v2"}function gr(e){return cr(e)}function vr(e){var t=gr(e);return t?t.id:null}function Ce(){return{vid:gr(rt)}}function Un(){return{vid:vr(rt)}}function mr({elem:e}){var t=null,r=null,n=null,i=new RegExp("\\+?\\(?\\d*\\)? ?\\(?\\d+\\)?\\d*([\\s./-]?\\d{2,})+","g");e.href&&e.href.startsWith("tel:")&&(n=e.href);var a=e.innerText,o=e.innerHTML,s=i.exec(a);return s&&(t=s[0].trim(),r=t.replace("+","").replace(/-/g,"").replace(/ /g,"").replace("(","").replace(")","").replace(/^1/,"")),{text:a,html:o,numberText:t,href:n,number:r}}function mt({elems:e,number:t,force:r=!1}){var n,i=t;t.startsWith("+1")||(i="+1"+t);for(var a=0;a<e.length;a++){if(ge.has(e[a]))if(r)n=ge.get(e[a]);else{Y("element already in overlay map:",e[a]);continue}var o=mr({elem:e[a]});if(n?!r&&o.number&&n.number&&n.number!==o.number&&V("overlaying multiple numbers with a single number",n.number,o.number):n=o,Y("overlaying",i,"on",e[a]),ge.has(e[a])||ge.set(e[a],o),o.href&&(e[a].href="tel:"+i),o.numberText)if(e[a].innerHTML="",o.text){var s=i;if(o.numberText.indexOf("-")>-1&&(s=i.slice(2,5)+"-"+i.slice(5,8)+"-"+i.slice(8,12)),o.html.indexOf("<img")>-1){var p=o.html.replace(o.numberText,s);e[a].innerHTML=p}else{var g=o.text.replace(o.numberText,s);e[a].appendChild(document.createTextNode(g))}}else e[a].appendChild(document.createTextNode(i));else Y("no number text found:",e[a])}}function ht({elems:e}){for(var t=0;t<e.length;t++)if(ge.has(e[t])){var r=e[t].innerHTML,n=ge.get(e[t]);Y("orig:",n);var i=n.html;Y("reverting",r,"to",i),e[t].innerHTML=i,n.href&&(e[t].href=n.href),ge.delete(e[t])}else Y("element not in map:",e[t])}function hr(e){clearInterval(W[e]),delete W[e]}function yr(){for(var e in W)hr(e)}function br(i){return ee(this,arguments,function*({poolId:e,apiUrl:t,number:r=null,context:n=null}){var a={pool_id:e,number:r,context:n,properties:{zar:Ce()}},o=yield tt({url:`${t}/number_pool`,data:a});return o})}function yt(){return window.zarPoolData&&window.zarPoolData.status===lr&&window.zarPoolData.number}function nt(){if(!window.zarPoolDataLayer||!Array.isArray(window.zarPoolDataLayer))return{};for(var e={},t=0;t<window.zarPoolDataLayer.length;t++){var r=window.zarPoolDataLayer[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return window.zarPoolDataLayer.length=0,e}function wr(i){return ee(this,arguments,function*({apiUrl:e,poolId:t,number:r,context:n}){if(!yt()){V("no valid pool data, not updating context");return}var a={pool_id:t,number:r,context:n,properties:{zar:Ce()}},o=yield tt({url:`${e}/update_number`,data:a});return o})}function Cn(n){return ee(this,arguments,function*({apiUrl:e,key:t=null,with_contexts:r=!1}){var i={key:t,with_contexts:r},a=yield An({url:`${e}/number_pool_stats`,params:i});return a})}function Rn(){return ee(this,arguments,function*({overlayElements:e,apiUrl:t=pr(),contextCallback:r=null}={}){var n=nt()||{};r&&(n=r(n)||{});const i=window.zarPoolData.pool_id,a=window.zarPoolData.number;try{var o=yield br({poolId:i,apiUrl:t,number:a,context:n})}catch(g){var s="error getting number: "+JSON.stringify(g);return V(s),fr++,fr>=Ln&&(V("max failures, stopping pool"),yr(),e&&ht({elems:e})),{status:Ue,msg:s}}if(o.status===lr&&o.number){var p=!1;o.number!==window.zarPoolData.number&&(V("number changed from "+window.zarPoolData.number+" to "+o.number),window.zarPoolData.number=o.number,p=!0),e&&mt({elems:e,number:o.number,force:p})}else e&&ht({elems:e}),W[i]&&(clearInterval(W[i]),delete W[i]);return o})}function bt(e){return En(e)?e():e}function qn(e){if(!window.zarPoolDLObserverDone&&!!yt()){var t=window.zarPoolDataLayer.push;window.zarPoolDataLayer.push=function(...r){var n=t.apply(this,r),i=nt();return i&&wr({apiUrl:e,poolId:window.zarPoolData.pool_id,number:window.zarPoolData.number,context:i}),n},window.zarPoolDLObserverDone=!0}}function Ir(){return ee(this,arguments,function*({poolData:e,poolConfig:t,apiUrl:r}={}){var n;if(!t||!t.poolId||!t.overlayQuerySelector||!r)return n="missing pool config: "+JSON.stringify(t),V(n),t.initCallback&&t.initCallback({status:Ue,msg:n}),W;var i=nt()||{};t.contextCallback&&(i=t.contextCallback(i)||{});var a=bt(t.poolId);if(!a)return n="no pool ID",V(n),t.initCallback&&t.initCallback({status:Ue,msg:n}),W;if(!e)try{e=yield br({poolId:a,apiUrl:r,number:null,context:i})}catch(o){return n="error getting number on init: "+JSON.stringify(o),V(n),t.initCallback&&t.initCallback({status:Ue,msg:n}),W}if(window.zarPoolData=e,yt()){try{qn(r)}catch(o){V("data layer observer error: "+JSON.stringify(o))}kn(function(){var o=document.querySelectorAll(t.overlayQuerySelector);if(!o){var s="No elems found for:"+t.overlayQuerySelector;V(s),t.initCallback&&t.initCallback({status:Ue,msg:s});return}mt({elems:o,number:e.number});var p=setInterval(function(){try{Rn({overlayElements:o,apiUrl:r,contextCallback:t.contextCallback})}catch(x){var g="error on interval: "+JSON.stringify(x);V(g)}},t.renewalInterval||Dn);W[e.pool_id]=p,t.initCallback&&t.initCallback(e)})}return W})}function Pr({apiUrl:e,poolConfig:t}){return dr(),{name:"zar",config:{apiUrl:e,poolConfig:t},initialize:function({config:r}){},loaded:function(){return!0},pageStart:function({payload:r,config:n,instance:i}){r.properties.zar=Ce(),r.properties.referrer=document.referrer,r.properties.is_bot=ur(),"hash"in r.properties&&delete r.properties.hash,"path"in r.properties&&delete r.properties.path,"search"in r.properties&&delete r.properties.search;try{var a=n.poolConfig;if(a&&a.poolId){r.properties.pool_id=bt(a.poolId);var o=nt()||{};a.contextCallback&&(r.properties.pool_context=a.contextCallback(o)||{})}}catch(s){V("error getting pool id: "+JSON.stringify(s))}return r},page:function(o){return ee(this,arguments,function*({payload:r,options:n,instance:i,config:a}){Y("page",r,n,a);for(var s=0,p=3,g;s<p;)try{g=yield tt({url:`${a.apiUrl}/page`,data:r});break}catch(x){if(s++,s>=p)throw V("error posting page: "+JSON.stringify(x)),x;yield new Promise(d=>setTimeout(d,1e3))}g&&g.pool_data&&Ir({poolData:g.pool_data,poolConfig:a.poolConfig,apiUrl:a.apiUrl})})},trackStart:function({payload:r,config:n,instance:i}){return r.properties.zar=Ce(),r.properties.url=window.location.href,r.properties.referrer=document.referrer,r},track:function({payload:r,options:n,instance:i,config:a}){Y("track",r),tt({url:`${a.apiUrl}/track`,data:r,beacon:!0})},methods:{apiUrl(){return e},poolConfig(){return t},initIDs(){return dr()},getIDs(){return Un()},getStorage(){return Ce()},getVID(){return vr(rt)},hasAdBlock(){return jn()},isBot(){return ur()},initTrackingPool({poolConfig:r}){var n=this.instance.plugins.zar;return Ir({poolData:null,poolConfig:Object.assign(n.poolConfig(),r||{}),apiUrl:n.apiUrl()})},updateTrackingNumberContext({number:r,context:n}){var i=this.instance.plugins.zar,a=i.poolConfig();return wr({apiUrl:this.instance.plugins.zar.apiUrl(),poolId:bt(a.poolId),number:r,context:n})},getPoolIntervals(){return W},clearPoolInterval({poolId:r}){hr(r)},clearPoolIntervals(){yr()},extractPhoneNumbers({elems:r}){for(var n=[],i=0;i<r.length;i++){var a=mr({elem:r[i]});n.push(a)}return n},overlayPhoneNumber({overlayElements:r,number:n}){mt({elems:r,number:n})},revertOverlayNumbers({overlayElements:r}){ht({elems:r})},getPoolStats({key:r=null,with_contexts:n=!1}){return Cn({apiUrl:this.instance.plugins.zar.apiUrl(),key:r,with_contexts:n})}}}}function Bn({app:e,ga4Config:t=null,facebookConfig:r=null,apiUrl:n=null,poolConfig:i=null}){n||(n=pr());var a=[Pr({apiUrl:n,poolConfig:i})];return t&&a.push(Sn(t)),r&&a.push(In(r)),ar({app:e,plugins:a})}Q.Analytics=ar,Q.init=Bn,Q.zar=Pr,Object.defineProperties(Q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
3
3
  //# sourceMappingURL=zar.umd.js.map