UNPKG

unomi-analytics

Version:

The Apache Unomi analytics.js integration.

19 lines 132 kB
/*! * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @license Apache-2.0 */ !function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).unomiTracker=t()}(function(){return function i(a,s,c){function u(e,t){if(!s[e]){if(!a[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(l)return l(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var o=s[e]={exports:{}};a[e][0].call(o.exports,function(t){return u(a[e][1][t]||t)},o,o.exports,i,a,s,c)}return s[e].exports}for(var l="function"==typeof require&&require,t=0;t<c.length;t++)u(c[t]);return u}({1:[function(t,e,n){"use strict";var i=t("@ndhoule/arity"),a=Object.prototype.toString;e.exports=function(t,e){if("number"!=(r=typeof(n=t))&&("object"!=r||"[object Number]"!==a.call(n)))throw new TypeError("Expected a number but received "+typeof t);var n,r;if("function"!=typeof e)throw new TypeError("Expected a function but received "+typeof e);var o=0;return i(e.length,function(){if(!((o+=1)<t))return e.apply(this,arguments)})}},{"@ndhoule/arity":2}],2:[function(t,e,n){"use strict";var a=Object.prototype.toString,s=[function(t){return function(){return t.apply(this,arguments)}},function(e){return function(t){return e.apply(this,arguments)}},function(n){return function(t,e){return n.apply(this,arguments)}},function(r){return function(t,e,n){return r.apply(this,arguments)}},function(o){return function(t,e,n,r){return o.apply(this,arguments)}},function(i){return function(t,e,n,r,o){return i.apply(this,arguments)}}];e.exports=function(t,e){if("function"!=typeof e)throw new TypeError("Expected a function but got "+typeof e);var n,r,o,i;return t=Math.max("number"==(r=typeof(n=t))||"object"==r&&"[object Number]"===a.call(n)?t:0,0),s[t]||(s[t]=(o=function(t){for(var e=[],n=1;n<=t;n+=1)e.push("arg"+n);return e}(t).join(", "),i="".concat(" return function(",o,") {\n"," return func.apply(this, arguments);\n"," };"),new Function("func",i))),s[t](e)}},{}],3:[function(t,e,n){"use strict";var c=t("component-type");e.exports=function t(e){var n=c(e);if("object"===n){var r={};for(var o in e)e.hasOwnProperty(o)&&(r[o]=t(e[o]));return r}if("array"===n){for(var r=new Array(e.length),i=0,a=e.length;i<a;i++)r[i]=t(e[i]);return r}if("regexp"!==n)return"date"===n?new Date(e.getTime()):e;var s="";return s+=e.multiline?"m":"",s+=e.global?"g":"",s+=e.ignoreCase?"i":"",new RegExp(e.source,s)}},{"component-type":57}],4:[function(t,e,n){"use strict";function o(t){return Boolean(t)&&"[object Object]"===u.call(t)}function a(t,e,n,r){return c.call(e,r)&&void 0===t[r]&&(t[r]=n),e}function r(t,e){if(n=e,!Boolean(n)||"object"!=typeof n)return e;var n;t=t||a;for(var r=s(2,arguments),o=0;o<r.length;o+=1)for(var i in r[o])t(e,r[o],r[o][i],i);return e}var s=t("@ndhoule/drop"),i=t("@ndhoule/rest"),c=Object.prototype.hasOwnProperty,u=Object.prototype.toString,l=function(t){return r.apply(null,[function(t,e,n,r){return c.call(e,r)&&(o(t[r])&&o(n)?t[r]=l(t[r],n):void 0===t[r]&&(t[r]=n)),e},t].concat(i(arguments)))};e.exports=function(t){return r.apply(null,[null,t].concat(i(arguments)))},e.exports.deep=l},{"@ndhoule/drop":5,"@ndhoule/rest":14}],5:[function(t,e,n){"use strict";var s=Math.max;e.exports=function(t,e){var n=e?e.length:0;if(!n)return[];for(var r=s(Number(t)||0,0),o=s(n-r,0),i=new Array(o),a=0;a<o;a+=1)i[a]=e[a+r];return i}},{}],6:[function(t,e,n){"use strict";function r(t){return null!=t&&(a(t)||"function"!==t&&(e=t.length,"number"==(n=typeof e)||"object"==n&&"[object Number]"===i.call(e)));var e,n}var o=t("@ndhoule/keys"),i=Object.prototype.toString,a="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===i.call(t)};e.exports=function(t,e){return(r(e)?function(t,e){for(var n=0;n<e.length&&!1!==t(e[n],n,e);n+=1);}:function(t,e){for(var n=o(e),r=0;r<n.length&&!1!==t(e[n[r]],n[r],e);r+=1);}).call(this,t,e)}},{"@ndhoule/keys":11}],7:[function(t,e,n){"use strict";var i=t("@ndhoule/each");e.exports=function(r,t){if("function"!=typeof r)throw new TypeError("`predicate` must be a function but was a "+typeof r);var o=!0;return i(function(t,e,n){if(!(o=!!r(t,e,n)))return!1},t),o}},{"@ndhoule/each":6}],8:[function(t,e,n){"use strict";var o=Object.prototype.hasOwnProperty;e.exports=function(t){for(var e=Array.prototype.slice.call(arguments,1),n=0;n<e.length;n+=1)for(var r in e[n])o.call(e[n],r)&&(t[r]=e[n][r]);return t}},{}],9:[function(t,e,n){"use strict";var i=t("@ndhoule/each");e.exports=function(r,o,t){if("function"!=typeof r)throw new TypeError("Expected a function but received a "+typeof r);return i(function(t,e,n){o=r(o,t,e,n)},t),o}},{"@ndhoule/each":6}],10:[function(t,e,n){"use strict";var i=t("@ndhoule/each"),a=String.prototype.indexOf;e.exports=function(r,t){var o=!1;return"string"==typeof t?-1!==a.call(t,r):(i(function(t){if((e=t)===(n=r)?0!==e||1/e==1/n:e!=e&&n!=n)return!(o=!0);var e,n},t),o)}},{"@ndhoule/each":6}],11:[function(t,e,n){"use strict";function r(t,e){return s.call(t,e)}function i(t,e){return a.call(t,e)}function o(t,e){e=e||i;for(var n=[],r=0,o=t.length;r<o;r+=1)e(t,r)&&n.push(String(r));return n}var a=Object.prototype.hasOwnProperty,s=String.prototype.charAt,c=Object.prototype.toString;e.exports=function(t){return null==t?[]:(e=t,"[object String]"===c.call(e)?o(t,r):null!=(n=t)&&"function"!=typeof n&&"number"==typeof n.length?o(t,i):function(t,e){e=e||i;var n=[];for(var r in t)e(t,r)&&n.push(String(r));return n}(t));var e,n}},{}],12:[function(t,e,n){"use strict";var i=t("@ndhoule/each");e.exports=function(r,t){if("function"!=typeof r)throw new TypeError("Expected a function but received a "+typeof r);var o=[];return i(function(t,e,n){o.push(r(t,e,n))},t),o}},{"@ndhoule/each":6}],13:[function(t,e,n){"use strict";function a(t){return"string"==typeof t||"[object String]"===s.call(t)}var s=Object.prototype.toString;e.exports=function(t,e){if(null==e||(null==(n=e)||"object"!=typeof n))return{};var n,r;a(t)&&(t=[t]),r=t,"[object Array]"!==s.call(r)&&(t=[]);for(var o={},i=0;i<t.length;i+=1)a(t[i])&&t[i]in e&&(o[t[i]]=e[t[i]]);return o}},{}],14:[function(t,e,n){"use strict";var r=Math.max;e.exports=function(t){if(null==t||!t.length)return[];for(var e=new Array(r(t.length-2,0)),n=1;n<t.length;n+=1)e[n-1]=t[n];return e}},{}],15:[function(P,L,t){(function(t){"use strict";var e=t.analytics,i=P("segmentio-facade").Alias,n=P("component-emitter"),s=P("segmentio-facade"),a=P("segmentio-facade").Group,c=P("segmentio-facade").Identify,r=P("./middleware").SourceMiddlewareChain,o=P("./middleware").IntegrationMiddlewareChain,u=P("segmentio-facade").Page,l=P("segmentio-facade").Track,p=P("bind-all"),f=P("@ndhoule/clone"),d=P("extend"),h=P("./cookie"),y=P("./metrics"),g=P("debug"),m=P("@ndhoule/defaults"),v=P("@ndhoule/each"),b=P("@ndhoule/foldl"),w=P("./group"),j=P("is"),x=P("@segment/is-meta"),_=P("@ndhoule/keys"),k=P("./memory"),I=P("next-tick"),A=P("./normalize"),C=P("component-event").bind,O=P("./pageDefaults"),S=P("@ndhoule/pick"),T=P("@segment/prevent-default"),E=P("component-querystring"),D=P("./store"),N=P("./user"),z=P("component-type");function M(){this._options({}),this.Integrations={},this._sourceMiddlewares=new r,this._integrationMiddlewares=new o,this._integrations={},this._readied=!1,this._timeout=300,this._user=N,this.log=g("analytics.js"),p(this);var n=this;this.on("initialize",function(t,e){e.initialPageview&&n.page(),n._parseQuery(window.location.search)})}n(M.prototype),M.prototype.use=function(t){return t(this),this},M.prototype.addIntegration=function(t){var e=t.prototype.name;if(!e)throw new TypeError("attempted to add an invalid integration");return this.Integrations[e]=t,this},M.prototype.addSourceMiddleware=function(t){if(this.initialized)throw new Error("attempted to add a source middleware after initialization");return this._sourceMiddlewares.add(t),this},M.prototype.addIntegrationMiddleware=function(t){if(this.initialized)throw new Error("attempted to add an integration middleware after initialization");return this._integrationMiddlewares.add(t),this},M.prototype.init=M.prototype.initialize=function(n,i){n=n||{},i=i||{},this._options(i),this._readied=!1;var a=this;v(function(t,e){a.Integrations[e]||delete n[e]},n),v(function(t,e){var n,r,o;i.integrations&&(!1===i.integrations[e]||!1===i.integrations.All&&!i.integrations[e])||(n=a.Integrations[e],d(!0,r={},t),o=new n(r),a.log("initialize %o - %o",e,t),a.add(o))},n);var t=this._integrations;N.load(),w.load();function r(){o<=++e&&(a._readied=!0,a.emit("ready"))}var e=0,o=_(t).length;o<=0&&r();var s=!(this.failedInitializations=[]);return v(function(e){var t;i.initialPageview&&!1===e.options.initialPageview&&(t=e.page,e.page=function(){if(s)return t.apply(this,arguments);s=!0}),e.analytics=a,e.once("ready",r);try{y.increment("analytics_js.integration.invoke",{method:"initialize",integration_name:e.name}),e.initialize()}catch(t){var n=e.name;y.increment("analytics_js.integration.invoke.error",{method:"initialize",integration_name:e.name}),a.failedInitializations.push(n),a.log("Error initializing %s integration: %o",n,t),e.ready()}},t),this.initialized=!0,this.emit("initialize",n,i),this},M.prototype.setAnonymousId=function(t){return this.user().anonymousId(t),this},M.prototype.add=function(t){return this._integrations[t.name]=t,this},M.prototype.identify=function(t,e,n,r){j.fn(n)&&(r=n,n=null),j.fn(e)&&(r=e,e=n=null),j.object(t)&&(n=e,e=t,t=N.id()),N.identify(t,e);var o=this.normalize({options:n,traits:N.traits(),userId:N.id()});return this.options.integrations&&m(o.integrations,this.options.integrations),this._invoke("identify",new c(o)),this.emit("identify",t,e,n),this._callback(r),this},M.prototype.user=function(){return N},M.prototype.group=function(t,e,n,r){if(!arguments.length)return w;j.fn(n)&&(r=n,n=null),j.fn(e)&&(r=e,e=n=null),j.object(t)&&(n=e,e=t,t=w.id()),w.identify(t,e);var o=this.normalize({options:n,traits:w.traits(),groupId:w.id()});return this.options.integrations&&m(o.integrations,this.options.integrations),this._invoke("group",new a(o)),this.emit("group",t,e,n),this._callback(r),this},M.prototype.track=function(t,e,n,r){j.fn(n)&&(r=n,n=null),j.fn(e)&&(r=e,e=n=null);var o=this.options.plan||{},i=o.track||{},a={},s=this.normalize({properties:e,options:n,event:t});return(o=i[t])?(this.log("plan %o - %o",t,o),a=!1===o.enabled?{All:!1,"Segment.io":!0}:o.integrations||{}):(i.__default||{enabled:!0}).enabled||(a={All:!1,"Segment.io":!0}),m(s.integrations,this._mergeInitializeAndPlanIntegrations(a)),this._invoke("track",new l(s)),this.emit("track",t,e,n),this._callback(r),this},M.prototype.trackClick=M.prototype.trackLink=function(t,i,a){if(!t)return this;"element"===z(t)&&(t=[t]);var s=this;return v(function(o){if("element"!==z(o))throw new TypeError("Must pass HTMLElement to `analytics.trackLink`.");C(o,"click",function(t){var e=j.fn(i)?i(o):i,n=j.fn(a)?a(o):a,r=o.getAttribute("href")||o.getAttributeNS("http://www.w3.org/1999/xlink","href")||o.getAttribute("xlink:href");s.track(e,n),r&&"_blank"!==o.target&&!x(t)&&(T(t),s._callback(function(){window.location.href=r}))})},t),this},M.prototype.trackSubmit=M.prototype.trackForm=function(t,o,i){if(!t)return this;"element"===z(t)&&(t=[t]);var a=this;return v(function(r){if("element"!==z(r))throw new TypeError("Must pass HTMLElement to `analytics.trackForm`.");function t(t){T(t);var e=j.fn(o)?o(r):o,n=j.fn(i)?i(r):i;a.track(e,n),a._callback(function(){r.submit()})}var e=window.jQuery||window.Zepto;e?e(r).submit(t):C(r,"submit",t)},t),this},M.prototype.page=function(t,e,n,r,o){j.fn(r)&&(o=r,r=null),j.fn(n)&&(o=n,r=n=null),j.fn(e)&&(o=e,r=n=e=null),"object"===z(t)&&(r=e,n=t,e=t=null),"object"===z(e)&&(r=n,n=e,e=null),"string"===z(t)&&"string"!==z(e)&&(e=t,t=null),n=f(n)||{},e&&(n.name=e),t&&(n.category=t);var i=O();m(n,i);var a=S(_(i),n);j.empty(a)||((r=r||{}).context=r.context||{},r.context.page=a);var s=this.normalize({properties:n,category:t,options:r,name:e});return this.options.integrations&&m(s.integrations,this.options.integrations),this._invoke("page",new u(s)),this.emit("page",t,e,n,r),this._callback(o),this},M.prototype.pageview=function(t){var e={};return t&&(e.path=t),this.page(e),this},M.prototype.alias=function(t,e,n,r){j.fn(n)&&(r=n,n=null),j.fn(e)&&(r=e,e=n=null),j.object(e)&&(n=e,e=null);var o=this.normalize({options:n,previousId:e,userId:t});return this.options.integrations&&m(o.integrations,this.options.integrations),this._invoke("alias",new i(o)),this.emit("alias",t,e,n),this._callback(r),this},M.prototype.ready=function(t){return j.fn(t)&&(this._readied?I(t):this.once("ready",t)),this},M.prototype.timeout=function(t){this._timeout=t},M.prototype.debug=function(t){!arguments.length||t?g.enable("analytics:"+(t||"*")):g.disable()},M.prototype._options=function(t){return t=t||{},this.options=t,h.options(t.cookie),y.options(t.metrics),D.options(t.localStorage),N.options(t.user),w.options(t.group),this},M.prototype._callback=function(t){return j.fn(t)&&(this._timeout?setTimeout(t,this._timeout):I(t)),this},M.prototype._invoke=function(i,t){var a=this;try{this._sourceMiddlewares.applyMiddlewares(d(!0,new s({}),t),this._integrations,function(t){var r,o;null!==t?(t instanceof s||(t=new s(t)),a.emit("invoke",t),y.increment("analytics_js.invoke",{method:i}),r=t,o=a.failedInitializations||[],v(function(e,n){var t=d(!0,new s({}),r);if(t.enabled(n))if(0<=o.indexOf(n))a.log("Skipping invocation of .%s method of %s integration. Integration failed to initialize properly.",i,n);else try{a._integrationMiddlewares.applyMiddlewares(t,e.name,function(t){null!==t?(t instanceof s||(t=new s(t)),y.increment("analytics_js.integration.invoke",{method:i,integration_name:e.name}),e.invoke.call(e,i,t)):a.log('Payload to integration "%s" was null and dropped by a middleware.',n)})}catch(t){y.increment("analytics_js.integration.invoke.error",{method:i,integration_name:e.name}),a.log("Error invoking .%s method of %s integration: %o",i,n,t)}},a._integrations)):a.log('Payload with method "%s" was null and dropped by source a middleware.',i)})}catch(t){y.increment("analytics_js.invoke.error",{method:i}),a.log("Error invoking .%s method of %s integration: %o",i,name,t)}return this},M.prototype.push=function(t){var e=t.shift();this[e]&&this[e].apply(this,t)},M.prototype.reset=function(){this.user().logout(),this.group().logout()},M.prototype._parseQuery=function(t){var e=E.parse(t),n=o("ajs_trait_",e),r=o("ajs_prop_",e);return e.ajs_uid&&this.identify(e.ajs_uid,n),e.ajs_event&&this.track(e.ajs_event,r),e.ajs_aid&&N.anonymousId(e.ajs_aid),this;function o(r,t){var o=r.length;return b(function(t,e,n){return n.substr(0,o)===r&&(t[n.substr(o)]=e),t},{},t)}},M.prototype.normalize=function(t){return(t=A(t,_(this._integrations))).anonymousId&&N.anonymousId(t.anonymousId),t.anonymousId=N.anonymousId(),t.context.page=m(t.context.page||{},O()),t},M.prototype._mergeInitializeAndPlanIntegrations=function(t){if(!this.options.integrations)return t;var e,n=d({},this.options.integrations);for(e in!1===t.All&&(n={All:!1}),t)t.hasOwnProperty(e)&&!1!==this.options.integrations[e]&&(n[e]=t[e]);return n},M.prototype.noConflict=function(){return window.analytics=e,this},L.exports=M,L.exports.cookie=h,L.exports.memory=k,L.exports.store=D,L.exports.metrics=y}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./cookie":16,"./group":18,"./memory":20,"./metrics":21,"./middleware":22,"./normalize":23,"./pageDefaults":24,"./store":25,"./user":26,"@ndhoule/clone":3,"@ndhoule/defaults":4,"@ndhoule/each":6,"@ndhoule/foldl":9,"@ndhoule/keys":11,"@ndhoule/pick":13,"@segment/is-meta":35,"@segment/prevent-default":39,"bind-all":44,"component-emitter":52,"component-event":53,"component-querystring":55,"component-type":57,debug:27,extend:62,is:66,"next-tick":76,"segmentio-facade":86}],16:[function(t,e,n){"use strict";var r=t("bind-all"),o=t("@ndhoule/clone"),i=t("component-cookie"),a=t("debug")("analytics.js:cookie"),s=t("@ndhoule/defaults"),c=t("json3"),u=t("@segment/top-domain");function l(t){this.options(t)}l.prototype.options=function(t){if(0===arguments.length)return this._options;t=t||{};var e="."+u(window.location.href);"."===e&&(e=null),this._options=s(t,{maxage:31536e6,path:"/",domain:e}),this.set("ajs:test",!0),this.get("ajs:test")||(a("fallback to domain=null"),this._options.domain=null),this.remove("ajs:test")},l.prototype.set=function(t,e){try{return e=c.stringify(e),i(t,e,o(this._options)),!0}catch(t){return!1}},l.prototype.get=function(t){try{var e=i(t);return e=e?c.parse(e):null}catch(t){return null}},l.prototype.remove=function(t){try{return i(t,null,o(this._options)),!0}catch(t){return!1}},e.exports=r(new l),e.exports.Cookie=l},{"@ndhoule/clone":3,"@ndhoule/defaults":4,"@segment/top-domain":42,"bind-all":44,"component-cookie":46,debug:27,json3:67}],17:[function(t,e,n){"use strict";var r=t("@ndhoule/clone"),o=t("./cookie"),i=t("debug")("analytics:entity"),a=t("@ndhoule/defaults"),s=t("@ndhoule/extend"),c=t("./memory"),u=t("./store"),l=t("@segment/isodate-traverse");function p(t){this.options(t),this.initialize()}(e.exports=p).prototype.initialize=function(){if(o.set("ajs:cookies",!0),o.get("ajs:cookies"))return o.remove("ajs:cookies"),void(this._storage=o);u.enabled?this._storage=u:(i("warning using memory store both cookies and localStorage are disabled"),this._storage=c)},p.prototype.storage=function(){return this._storage},p.prototype.options=function(t){if(0===arguments.length)return this._options;this._options=a(t||{},this.defaults||{})},p.prototype.id=function(t){switch(arguments.length){case 0:return this._getId();case 1:return this._setId(t)}},p.prototype._getId=function(){if(!this._options.persist)return void 0===this._id?null:this._id;var t=this._getIdFromCookie();if(t)return t;var e=this._getIdFromLocalStorage();return e?(this._setIdInCookies(e),e):null},p.prototype._getIdFromCookie=function(){return this.storage().get(this._options.cookie.key)},p.prototype._getIdFromLocalStorage=function(){return this._options.localStorageFallbackDisabled?null:u.get(this._options.cookie.key)},p.prototype._setId=function(t){this._options.persist?(this._setIdInCookies(t),this._setIdInLocalStorage(t)):this._id=t},p.prototype._setIdInCookies=function(t){this.storage().set(this._options.cookie.key,t)},p.prototype._setIdInLocalStorage=function(t){this._options.localStorageFallbackDisabled||u.set(this._options.cookie.key,t)},p.prototype.properties=p.prototype.traits=function(t){switch(arguments.length){case 0:return this._getTraits();case 1:return this._setTraits(t)}},p.prototype._getTraits=function(){var t=this._options.persist?u.get(this._options.localStorage.key):this._traits;return t?l(r(t)):{}},p.prototype._setTraits=function(t){t=t||{},this._options.persist?u.set(this._options.localStorage.key,t):this._traits=t},p.prototype.identify=function(t,e){e=e||{};var n=this.id();null!==n&&n!==t||(e=s(this.traits(),e)),t&&this.id(t),this.debug("identify %o, %o",t,e),this.traits(e),this.save()},p.prototype.save=function(){return!!this._options.persist&&(this._setId(this.id()),this._setTraits(this.traits()),!0)},p.prototype.logout=function(){this.id(null),this.traits({}),this.storage().remove(this._options.cookie.key),u.remove(this._options.cookie.key),u.remove(this._options.localStorage.key)},p.prototype.reset=function(){this.logout(),this.options({})},p.prototype.load=function(){this.id(this.id()),this.traits(this.traits())}},{"./cookie":16,"./memory":20,"./store":25,"@ndhoule/clone":3,"@ndhoule/defaults":4,"@ndhoule/extend":8,"@segment/isodate-traverse":36,debug:27}],18:[function(t,e,n){"use strict";var r=t("./entity"),o=t("bind-all"),i=t("debug")("analytics:group"),a=t("inherits");function s(t){this.defaults=s.defaults,this.debug=i,r.call(this,t)}s.defaults={persist:!0,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}},a(s,r),e.exports=o(new s),e.exports.Group=s},{"./entity":17,"bind-all":44,debug:27,inherits:64}],19:[function(t,e,n){"use strict";var r=new(t("./analytics"));r.VERSION=t("../package.json").version,e.exports=r},{"../package.json":28,"./analytics":15}],20:[function(t,e,n){"use strict";var r=t("bind-all"),o=t("@ndhoule/clone"),i=Object.prototype.hasOwnProperty;function a(){this.store={}}e.exports=r(new a),a.prototype.set=function(t,e){return this.store[t]=o(e),!0},a.prototype.get=function(t){if(i.call(this.store,t))return o(this.store[t])},a.prototype.remove=function(t){return delete this.store[t],!0}},{"@ndhoule/clone":3,"bind-all":44}],21:[function(t,e,n){"use strict";var r=t("bind-all"),o=t("@segment/send-json"),i=t("debug")("analytics.js:metrics");function a(t){this.options(t)}a.prototype.options=function(t){var e;t=t||{},this.host=t.host||"api.segment.io/v1",this.sampleRate=t.sampleRate||0,this.flushTimer=t.flushTimer||3e4,this.maxQueueSize=t.maxQueueSize||20,this.queue=[],0<this.sampleRate&&setInterval(function(){e._flush()},(e=this).flushTimer)},a.prototype.increment=function(t,e){Math.random()>this.sampleRate||this.queue.length>=this.maxQueueSize||(this.queue.push({type:"Counter",metric:t,value:1,tags:e}),0<t.indexOf("error")&&this._flush())},a.prototype._flush=function(){var n;this.queue.length<=0||(n={series:this.queue},this.queue=[],"xhr"===o.type&&o("https://"+this.host+"/m",n,{"Content-Type":"text/plain"},function(t,e){i("sent %O, received %O",n,[t,e])}))},e.exports=r(new a),e.exports.Metrics=a},{"@segment/send-json":40,"bind-all":44,debug:27}],22:[function(t,e,n){"use strict";var a=t("segmentio-facade");function r(t){var o=[];return t.getMiddlewares=function(){return o.slice()},t.add=function(t){if("function"!=typeof t)throw new Error("attempted to add non-function middleware");if(-1!==o.indexOf(t))throw new Error("middleware is already registered");o.push(t)},function(t,e,n){if("object"!=typeof e)throw new Error("applyMiddlewares requires a payload object");if("function"!=typeof n)throw new Error("applyMiddlewares requires a function callback");var r=o.slice();r.push(n),function e(n,t,r,o){if(null===t)return void r[r.length-1](null);t instanceof a||(t=new a(t));var i=r[o];i&&(r[o+1]?n(i,t,function(t){e(n,t,r,++o)}):i(t))}(t,e,r,0)}}e.exports.SourceMiddlewareChain=function(){var n=r(this);this.applyMiddlewares=function(t,r,e){return n(function(t,e,n){t({integrations:r,next:n,payload:e})},t,e)}},e.exports.IntegrationMiddlewareChain=function(){var n=r(this);this.applyMiddlewares=function(t,r,e){return n(function(t,e,n){t(e,r,n)},t,e)}},e.exports.middlewareChain=r},{"segmentio-facade":86}],23:[function(t,e,n){"use strict";var u=t("debug")("analytics.js:normalize"),l=t("@ndhoule/defaults"),p=t("@ndhoule/each"),f=t("@ndhoule/includes"),d=t("@ndhoule/map"),h=t("component-type"),y=t("uuid").v4,g=t("json3"),m=t("spark-md5").hash,v=Object.prototype.hasOwnProperty;e.exports=function(t,e){var n=d(function(t){return t.toLowerCase()},e),r=t.options||{},o=r.integrations||{},i=r.providers||{},a=r.context||{},s={};return u("<-",t),p(function(t,e){c(e)&&(v.call(o,e)||(o[e]=t),delete r[e])},r),delete r.providers,p(function(t,e){c(e)&&"object"!==h(o[e])&&(v.call(o,e)&&"boolean"==typeof i[e]||(o[e]=t))},i),p(function(t,e){f(e,b)?s[e]=r[e]:a[e]=r[e]},r),t.messageId="ajs-"+m(g.stringify(t)+y()),delete t.options,s.integrations=o,s.context=a,s=l(s,t),u("->",s),s;function c(t){return f(t,e)||"all"===t.toLowerCase()||f(t.toLowerCase(),n)}};var b=["integrations","anonymousId","timestamp","context"]},{"@ndhoule/defaults":4,"@ndhoule/each":6,"@ndhoule/includes":10,"@ndhoule/map":12,"component-type":57,debug:27,json3:67,"spark-md5":93,uuid:101}],24:[function(t,e,n){"use strict";var o=t("@segment/canonical"),i=t("@ndhoule/includes"),r=t("component-url");e.exports=function(){return{path:(t=o())?r.parse(t).pathname:window.location.pathname,referrer:document.referrer,search:location.search,title:document.title,url:function(t){var e=o();if(e)return i("?",e)?e:e+t;var n=window.location.href,r=n.indexOf("#");return-1===r?n:n.slice(0,r)}(location.search)};var t}},{"@ndhoule/includes":10,"@segment/canonical":33,"component-url":58}],25:[function(t,e,n){"use strict";var r=t("bind-all"),o=t("@ndhoule/defaults"),i=t("@segment/store");function a(t){this.options(t)}a.prototype.options=function(t){if(0===arguments.length)return this._options;o(t=t||{},{enabled:!0}),this.enabled=t.enabled&&i.enabled,this._options=t},a.prototype.set=function(t,e){return!!this.enabled&&i.set(t,e)},a.prototype.get=function(t){return this.enabled?i.get(t):null},a.prototype.remove=function(t){return!!this.enabled&&i.remove(t)},e.exports=r(new a),e.exports.Store=a},{"@ndhoule/defaults":4,"@segment/store":41,"bind-all":44}],26:[function(t,e,n){"use strict";var r=t("./entity"),o=t("bind-all"),i=t("./cookie"),a=t("debug")("analytics:user"),s=t("inherits"),c=t("component-cookie"),u=t("uuid"),l=t("./store");function p(t){this.defaults=p.defaults,this.debug=a,r.call(this,t)}p.defaults={persist:!0,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}},s(p,r),p.prototype.id=function(t){var e=this._getId(),n=r.prototype.id.apply(this,arguments);return null==e||e!=t&&t&&this.anonymousId(null),n},p.prototype.anonymousId=function(t){var e=this.storage();return arguments.length?(e.set("ajs_anonymous_id",t),this._setAnonymousIdInLocalStorage(t),this):(t=e.get("ajs_anonymous_id"))?(this._setAnonymousIdInLocalStorage(t),e.set("ajs_anonymous_id",t),t):!this._options.localStorageFallbackDisabled&&(t=l.get("ajs_anonymous_id"))?(e.set("ajs_anonymous_id",t),t):(t=c("_sio"))?(t=t.split("----")[0],e.set("ajs_anonymous_id",t),this._setAnonymousIdInLocalStorage(t),e.remove("_sio"),t):(t=u.v4(),e.set("ajs_anonymous_id",t),this._setAnonymousIdInLocalStorage(t),e.get("ajs_anonymous_id"))},p.prototype._setAnonymousIdInLocalStorage=function(t){this._options.localStorageFallbackDisabled||l.set("ajs_anonymous_id",t)},p.prototype.logout=function(){r.prototype.logout.call(this),this.anonymousId(null)},p.prototype.load=function(){this._loadOldCookie()||r.prototype.load.call(this)},p.prototype._loadOldCookie=function(){var t=i.get(this._options.cookie.oldKey);return!!t&&(this.id(t.id),this.traits(t.traits),i.remove(this._options.cookie.oldKey),!0)},e.exports=o(new p),e.exports.User=p},{"./cookie":16,"./entity":17,"./store":25,"bind-all":44,"component-cookie":46,debug:27,inherits:64,uuid:101}],27:[function(t,e,n){function i(o){return i.enabled(o)?function(t){var e;t=(e=t)instanceof Error?e.stack||e.message:e;var n=new Date,r=n-(i[o]||n);i[o]=n,t=o+" "+t+" +"+i.humanize(r),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}(e.exports=i).names=[],i.skips=[],i.enable=function(t){try{localStorage.debug=t}catch(t){}for(var e=(t||"").split(/[\s,]+/),n=e.length,r=0;r<n;r++)"-"===(t=e[r].replace("*",".*?"))[0]?i.skips.push(new RegExp("^"+t.substr(1)+"$")):i.names.push(new RegExp("^"+t+"$"))},i.disable=function(){i.enable("")},i.humanize=function(t){return 36e5<=t?(t/36e5).toFixed(1)+"h":6e4<=t?(t/6e4).toFixed(1)+"m":1e3<=t?(t/1e3|0)+"s":t+"ms"},i.enabled=function(t){for(var e=0,n=i.skips.length;e<n;e++)if(i.skips[e].test(t))return!1;for(e=0,n=i.names.length;e<n;e++)if(i.names[e].test(t))return!0;return!1};try{window.localStorage&&i.enable(localStorage.debug)}catch(t){}},{}],28:[function(t,e,n){e.exports={name:"@segment/analytics.js-core",author:"Segment <friends@segment.com>",version:"3.10.1",description:"The hassle-free way to integrate analytics into any web application.",keywords:["analytics","analytics.js","segment","segment.io"],main:"lib/index.js",scripts:{test:"make test",lint:'eslint "./{lib,test}/**/*.js"',format:'prettier-eslint --write --list-different "./{lib,test}/**/*.{js,json,md}"',precommit:"lint-staged",np:"np --no-publish",cz:"git-cz",commitmsg:"commitlint -E GIT_PARAMS"},repository:{type:"git",url:"https://github.com/segmentio/analytics.js-core"},license:"SEE LICENSE IN LICENSE",bugs:{url:"https://github.com/segmentio/analytics.js-core/issues"},homepage:"https://github.com/segmentio/analytics.js-core#readme",dependencies:{"@ndhoule/clone":"^1.0.0","@ndhoule/defaults":"^2.0.1","@ndhoule/each":"^2.0.1","@ndhoule/extend":"^2.0.0","@ndhoule/foldl":"^2.0.1","@ndhoule/includes":"^2.0.1","@ndhoule/keys":"^2.0.0","@ndhoule/map":"^2.0.1","@ndhoule/pick":"^2.0.0","@segment/canonical":"^1.0.0","@segment/is-meta":"^1.0.0","@segment/isodate":"^1.0.2","@segment/isodate-traverse":"^1.0.1","@segment/prevent-default":"^1.0.0","@segment/send-json":"^3.0.0","@segment/store":"^1.3.20","@segment/top-domain":"^3.0.0","bind-all":"^1.0.0","component-cookie":"^1.1.2","component-emitter":"^1.2.1","component-event":"^0.1.4","component-querystring":"^2.0.0","component-type":"^1.2.1","component-url":"^0.2.1",debug:"^0.7.4",extend:"3.0.2",inherits:"^2.0.1",install:"^0.7.3",is:"^3.1.0",json3:"^3.3.2","new-date":"^1.0.0","next-tick":"^0.2.2","segmentio-facade":"^3.0.2","spark-md5":"^2.0.2",uuid:"^2.0.2"},devDependencies:{"@commitlint/cli":"^7.0.0","@commitlint/config-conventional":"^7.0.1","@segment/analytics.js-integration":"^3.2.1","@segment/eslint-config":"^4.0.0",browserify:"13.0.0","browserify-istanbul":"^2.0.0",codecov:"^3.0.2",commitizen:"^2.10.1","commitlint-circle":"^1.0.0","compat-trigger-event":"^1.0.0","component-each":"^0.2.6","cz-conventional-changelog":"^2.1.0",eslint:"^4.19.1","eslint-config-prettier":"^2.9.0","eslint-plugin-mocha":"^5.0.0","eslint-plugin-react":"^7.9.1","eslint-plugin-require-path-exists":"^1.1.8",husky:"^0.14.3",istanbul:"^0.4.3",jquery:"^3.2.1",karma:"1.3.0","karma-browserify":"^5.0.4","karma-chrome-launcher":"^1.0.1","karma-coverage":"^1.0.0","karma-junit-reporter":"^1.0.0","karma-mocha":"1.0.1","karma-phantomjs-launcher":"^1.0.0","karma-sauce-launcher":"^1.0.0","karma-spec-reporter":"0.0.26","karma-summary-reporter":"^1.5.0","lint-staged":"^7.2.0",mocha:"^2.2.5",np:"^3.0.4","phantomjs-prebuilt":"^2.1.7","prettier-eslint-cli":"^4.7.1",proclaim:"^3.4.1",sinon:"^1.7.3",snyk:"^1.83.0",watchify:"^3.7.0"},commitlint:{extends:["@commitlint/config-conventional"]},"lint-staged":{linters:{"*.{js,json,md}":["prettier-eslint --write","git add"]}},config:{commitizen:{path:"cz-conventional-changelog"}}}},{}],29:[function(t,e,n){"use strict";var r=t("component-bind"),o=t("lodash.clonedeep"),i=t("debug"),a=t("@ndhoule/defaults"),s=t("@ndhoule/extend"),c=t("slug-component"),u=t("./protos"),l=t("./statics");e.exports=function(e){function n(t){if(t&&t.addIntegration)return t.addIntegration(n);this.debug=i("analytics:integration:"+c(e)),this.options=a(o(t)||{},this.defaults),this._queue=[],this.once("ready",r(this,this.flush)),n.emit("construct",this),this.ready=r(this,this.ready),this._wrapInitialize(),this._wrapPage(),this._wrapTrack()}return n.prototype.defaults={},n.prototype.globals=[],n.prototype.templates={},n.prototype.name=e,s(n,l),s(n.prototype,u),n}},{"./protos":30,"./statics":31,"@ndhoule/defaults":4,"@ndhoule/extend":8,"component-bind":45,debug:59,"lodash.clonedeep":70,"slug-component":92}],30:[function(t,e,n){"use strict";function c(){}var r=t("component-emitter"),o=t("@ndhoule/after"),u=t("@ndhoule/each"),s=t("analytics-events"),l=t("@ndhoule/every"),p=t("@segment/fmt"),f=t("@ndhoule/foldl"),d=t("is"),h=t("load-iframe"),y=t("@segment/load-script"),i=t("next-tick"),g=t("to-no-case"),m=Object.prototype.hasOwnProperty,a=window.onerror;function v(t){return!!d.object(t)&&(!!d.string(t.key)&&!!m.call(t,"value"))}r(n),n.initialize=function(){var t=this.ready;i(t)},n.loaded=function(){return!1},n.page=function(t){},n.track=function(t){},n.map=function(t,e){var i=g(e),a=function(t){if(d.array(t))return l(v,t)?"mixed":"array";return d.object(t)?"map":"unknown"}(t);return"unknown"===a?[]:f(function(t,e,n){var r,o;return"map"===a&&(r=n,o=e),"array"===a&&(o=r=e),"mixed"===a&&(r=e.key,o=e.value),g(r)===i&&t.push(o),t},[],t)},n.invoke=function(e){if(this[e]){var t,n=Array.prototype.slice.call(arguments,1);if(!this._ready)return this.queue(e,n);try{this.debug("%s with %o",e,n),t=this[e].apply(this,n)}catch(t){this.debug("error %o calling %s with %o",t,e,n)}return t}},n.queue=function(t,e){this._queue.push({method:t,args:e})},n.flush=function(){this._ready=!0;var e=this;u(function(t){e[t.method].apply(e,t.args)},this._queue),this._queue.length=0},n.reset=function(){for(var t=0;t<this.globals.length;t++)window[this.globals[t]]=void 0;window.onerror=a,window.onload=null},n.load=function(t,e,n){"function"==typeof t&&(n=t,t=e=null),t&&"object"==typeof t&&(n=e,e=t,t=null),"function"==typeof e&&(n=e,e=null),t=t||"library",e=e||{},e=this.locals(e);var r=this.templates[t];if(!r)throw new Error(p('template "%s" not defined.',t));var o,i=(o=e,f(function(t,e,n){return t[n]=e.replace(/\{\{\ *(\w+)\ *\}\}/g,function(t,e){return o[e]}),t},{},r.attrs));n=n||c;var a,s=this;switch(r.type){case"img":i.width=1,i.height=1,a=function(t,e){e=e||function(){};var n=new Image;return n.onerror=function(n,r,o){return function(t){t=t||window.event;var e=new Error(r);e.event=t,e.source=o,n(e)}}(e,"failed to load pixel",n),n.onload=function(){e()},n.src=t.src,n.width=1,n.height=1,n}(i,n);break;case"script":a=y(i,function(t){if(!t)return n();s.debug('error loading "%s" error="%s"',s.name,t)}),delete i.src,u(function(t,e){a.setAttribute(e,t)},i);break;case"iframe":a=h(i,n)}return a},n.locals=function(n){n=n||{};var t=Math.floor((new Date).getTime()/36e5);return n.hasOwnProperty("cache")||(n.cache=t),u(function(t,e){n.hasOwnProperty(e)||(n[e]=t)},this.options),n},n.ready=function(){this.emit("ready")},n._wrapInitialize=function(){var e=this.initialize;this.initialize=function(){this.debug("initialize"),this._initialized=!0;var t=e.apply(this,arguments);return this.emit("initialize"),t}},n._wrapPage=function(){if(this._assumesPageview)return this.page=o(2,this.page)},n._wrapTrack=function(){var a=this.track;this.track=function(t){var e,n,r=t.event();for(var o in s)if(m.call(s,o)){var i=s[o];if(!this[o])continue;if(!i.test(r))continue;n=this[o].apply(this,arguments),e=!0;break}return e||(n=a.apply(this,arguments)),n}}},{"@ndhoule/after":1,"@ndhoule/each":6,"@ndhoule/every":7,"@ndhoule/foldl":9,"@segment/fmt":34,"@segment/load-script":38,"analytics-events":43,"component-emitter":52,is:66,"load-iframe":69,"next-tick":76,"to-no-case":96}],31:[function(t,e,n){"use strict";var r=t("component-emitter"),o=t("domify"),i=t("@ndhoule/each"),a=t("@ndhoule/includes");r(n),n.option=function(t,e){return this.prototype.defaults[t]=e,this},n.mapping=function(e){return this.option(e,[]),this.prototype[e]=function(t){return this.map(this.options[e],t)},this},n.global=function(t){return this.prototype.globals.push(t),this},n.assumesPageview=function(){return this.prototype._assumesPageview=!0,this},n.readyOnLoad=function(){return this.prototype._readyOnLoad=!0,this},n.readyOnInitialize=function(){return this.prototype._readyOnInitialize=!0,this},n.tag=function(t,e){return null==e&&(e=t,t="library"),this.prototype.templates[t]=function(n){n=n.replace(' src="',' data-src="');var t=o(n),r={};return i(function(t){var e="data-src"===t.name?"src":t.name;a(t.name+"=",n)&&(r[e]=t.value)},t.attributes),{type:t.tagName.toLowerCase(),attrs:r}}(e),this}},{"@ndhoule/each":6,"@ndhoule/includes":10,"component-emitter":52,domify:61}],32:[function(t,e,n){var l=t("utf8-encode"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.exports=function(t){var e,n,r,o,i,a,s,c="",u=0;t=l(t);for(;u<t.length;)e=t.charCodeAt(u++),n=t.charCodeAt(u++),r=t.charCodeAt(u++),o=e>>2,i=(3&e)<<4|n>>4,a=(15&n)<<2|r>>6,s=63&r,isNaN(n)?a=s=64:isNaN(r)&&(s=64),c=c+p.charAt(o)+p.charAt(i)+p.charAt(a)+p.charAt(s);return c}},{"utf8-encode":99}],33:[function(t,e,n){"use strict";e.exports=function(){for(var t,e=document.getElementsByTagName("link"),n=0;t=e[n];n++)if("canonical"===t.getAttribute("rel"))return t.getAttribute("href")}},{}],34:[function(t,n,e){(function(t){"use strict";var e=t.JSON&&"function"==typeof JSON.stringify?JSON.stringify:String;function o(t){var n=Array.prototype.slice.call(arguments,1),r=0;return t.replace(/%([a-z])/gi,function(t,e){return o[e]?o[e](n[r++]):t+e})}o.o=e,o.s=String,o.d=parseInt,n.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],35:[function(t,e,n){"use strict";e.exports=function(t){if(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)return!0;var e=t.which,n=t.button;return e||void 0===n?2===e:1&!n&&2&!n&&4&n}},{}],36:[function(t,e,n){"use strict";var o=t("component-type"),i=t("component-each"),a=t("@segment/isodate");function s(t,e){return void 0===e&&(e=!0),"object"===o(t)?function(n,r){!n.length||"number"!=typeof n.length||n.length-1 in n||(n.lengthNonArray=n.length,delete n.length);i(n,function(t,e){a.is(e,r)?n[t]=a.parse(e):"object"!==o(e)&&"array"!==o(e)||s(e,r)}),n.lengthNonArray&&(n.length=n.lengthNonArray,delete n.lengthNonArray);return n}(t,e):"array"===o(t)?(r=e,i(n=t,function(t,e){"object"===o(t)?s(t,r):a.is(t,r)&&(n[e]=a.parse(t))}),n):t;var n,r}e.exports=s},{"@segment/isodate":37,"component-each":50,"component-type":57}],37:[function(t,e,n){"use strict";var s=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;n.parse=function(t){var e=[1,5,6,7,11,12],n=s.exec(t),r=0;if(!n)return new Date(t);for(var o,i=0;o=e[i];i++)n[o]=parseInt(n[o],10)||0;n[2]=parseInt(n[2],10)||1,n[3]=parseInt(n[3],10)||1,n[2]--,n[8]=n[8]?(n[8]+"00").substring(0,3):0," "===n[4]?r=(new Date).getTimezoneOffset():"Z"!==n[9]&&n[10]&&(r=60*n[11]+n[12],"+"===n[10]&&(r=0-r));var a=Date.UTC(n[1],n[2],n[3],n[5],n[6]+r,n[7],n[8]);return new Date(a)},n.is=function(t,e){return"string"==typeof t&&((!e||!1!==/^\d{4}-\d{2}-\d{2}/.test(t))&&s.test(t))}},{}],38:[function(t,e,n){"use strict";var o=t("script-onload"),i=t("next-tick"),a=t("component-type");e.exports=function(t,e){if(!t)throw new Error("Can't load nothing...");"string"===a(t)&&(t={src:t});var n="https:"===document.location.protocol||"chrome-extension:"===document.location.protocol;t.src&&0===t.src.indexOf("//")&&(t.src=(n?"https:":"http:")+t.src),n&&t.https?t.src=t.https:!n&&t.http&&(t.src=t.http);var r=document.createElement("script");return r.type="text/javascript",r.async=!0,r.src=t.src,"function"===a(e)&&o(r,e),i(function(){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(r,t)}),r}},{"component-type":57,"next-tick":76,"script-onload":79}],39:[function(t,e,n){"use strict";e.exports=function(t){return(t=t||window.event).preventDefault?t.preventDefault():t.returnValue=!1}},{}],40:[function(t,e,c){"use strict";var u=t("json3"),l=t("@segment/base64-encode"),n=t("has-cors"),p=t("jsonp");function r(t,e,n,r){3===arguments.length&&(r=n,n={});var o=new XMLHttpRequest;for(var i in o.onerror=r,o.onreadystatechange=function(){if(4===o.readyState)return r(null,o)},o.open("POST",t,!0),n)o.setRequestHeader(i,n[i]);o.send(u.stringify(e))}function o(n,t,e,r){3===arguments.length&&(r=e);var o,i,a=c.prefix,s=(o=t,i="",i=u.stringify(o),i=(i=l(i)).replace(/\+/g,"-").replace(/\//g,"_"),encodeURIComponent(i));p(n+="?"+a+"="+s,{param:c.callback},function(t,e){if(t)return r(t);r(null,{url:n,body:e})})}(c=e.exports=n?r:o).callback="callback",c.prefix="data",c.json=r,c.base64=o,c.type=n?"xhr":"jsonp"},{"@segment/base64-encode":32,"has-cors":63,json3:67,jsonp:68}],41:[function(t,e,n){(function(p){"use strict";var f=t("json3");e.exports=function(){var r,o,t,i={},e="undefined"!=typeof window?window:p,n=e.document,a="localStorage";if(i.disabled=!1,i.version="1.3.20",i.set=function(t,e){},i.get=function(t,e){},i.has=function(t){return void 0!==i.get(t)},i.remove=function(t){},i.clear=function(){},i.transact=function(t,e,n){null==n&&(n=e,e=null),null==e&&(e={});var r=i.get(t,e);n(r),i.set(t,r)},i.getAll=function(){var n={};return i.forEach(function(t,e){n[t]=e}),n},i.forEach=function(){},i.serialize=function(t){return f.stringify(t)},i.deserialize=function(e){if("string"==typeof e)try{return f.parse(e)}catch(t){return e||void 0}},function(){try{return a in e&&e[a]}catch(t){return}}())r=e[a],i.set=function(t,e){return void 0===e?i.remove(t):(r.setItem(t,i.serialize(e)),e)},i.get=function(t,e){var n=i.deserialize(r.getItem(t));return void 0===n?e:n},i.remove=function(t){r.removeItem(t)},i.clear=function(){r.clear()},i.forEach=function(t){for(var e=0;e<r.length;e++){var n=r.key(e);t(n,i.get(n))}};else if(n&&n.documentElement.addBehavior){try{(t=new ActiveXObject("htmlfile")).open(),t.write('<script>document.w=window<\/script><iframe src="/favicon.ico"></iframe>'),t.close(),o=t.w.frames[0].document,r=o.createElement("div")}catch(t){r=n.createElement("div"),o=n.body}var s=function(n){return function(){var t=Array.prototype.slice.call(arguments,0);t.unshift(r),o.appendChild(r),r.addBehavior("#default#userData"),r.load(a);var e=n.apply(i,t);return o.removeChild(r),e}},c=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),u=function(t){return t.replace(/^d/,"___$&").replace(c,"___")};i.set=s(function(t,e,n){return e=u(e),void 0===n?i.remove(e):(t.setAttribute(e,i.serialize(n)),t.save(a),n)}),i.get=s(function(t,e,n){e=u(e);var r=i.deserialize(t.getAttribute(e));return void 0===r?n:r}),i.remove=s(function(t,e){e=u(e),t.removeAttribute(e),t.save(a)}),i.clear=s(function(t){var e=t.XMLDocument.documentElement.attributes;t.load(a);for(var n=e.length-1;0<=n;n--)t.removeAttribute(e[n].name);t.save(a)}),i.forEach=s(function(t,e){for(var n,r=t.XMLDocument.documentElement.attributes,o=0;n=r[o];++o)e(n.name,i.deserialize(t.getAttribute(n.name)))})}try{var l="__storejs__";i.set(l,l),i.get(l)!=l&&(i.disabled=!0),i.remove(l)}catch(t){i.disabled=!0}return i.enabled=!i.disabled,i}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{json3:67}],42:[function(t,e,s){"use strict";var i=t("component-url").parse,n=t("component-cookie");function r(t){for(var e=s.cookie,n=s.levels(t),r=0;r<n.length;++r){var o="__tld__",i=n[r],a={domain:"."+i};if(e(o,1,a),e(o))return e(o,null,a),i}return""}r.levels=function(t){var e=i(t).hostname.split("."),n=e[e.length-1],r=[];if(4===e.length&&n===parseInt(n,10))return r;if(e.length<=1)return r;for(var o=e.length-2;0<=o;--o)r.push(e.slice(o).join("."));return r},r.cookie=n,s=e.exports=r},{"component-cookie":46,"component-url":58}],43:[function(t,e,n){"use strict";var o=t("@ndhoule/map"),r=t("@ndhoule/foldl");e.exports=r(function(t,e,n){var r=o(function(t){return o(function(t){return"^[ _]?"+[].concat.apply([],o(function(t){return t.split(" ")},t)).join("[ _]?")+"[ _]?"},[[t.action,t.object],[t.object,t.action]]).join("|")},e).join("|")+"$";return t[n]=new RegExp(r,"i"),t},{},{videoPlaybackStarted:[{object:"video playback",action:"started"}],videoPlaybackPaused:[{object:"video playback",action:"paused"}],videoPlaybackInterrupted:[{object:"video playback",action:"interrupted"}],videoPlaybackResumed:[{object:"video playback",action:"resumed"}],videoPlaybackCompleted:[{object:"video playback",action:"completed"}],videoPlaybackBufferStarted:[{object:"video playback buffer",action:"started"}],videoPlaybackBufferCompleted:[{object:"video playback buffer",action:"completed"}],videoPlaybackSeekStarted:[{object:"video playback seek",action:"started"}],videoPlaybackSeekCompleted:[{object:"video playback seek",action:"completed"}],videoContentStarted:[{object:"video content",action:"started"}],videoContentPlaying:[{object:"video content",action:"playing"}],videoContentCompleted:[{object:"video content",action:"completed"}],videoAdStarted:[{object:"video ad",action:"started"}],videoAdPlaying:[{object:"video ad",action:"playing"}],videoAdCompleted:[{object:"video ad",action:"completed"}],promotionViewed:[{object:"promotion",action:"viewed"}],promotionClicked:[{object:"promotion",action:"clicked"}],productsSearched:[{object:"products",action:"searched"}],productListViewed:[{object:"product list",action:"viewed"},{object:"product category",action:"viewed"}],productListFiltered:[{object:"product list",action:"filtered"}],productClicked:[{object:"product",action:"clicked"}],productViewed:[{object:"product",action:"viewed"}],productAdded:[{object:"product",action:"added"}],productRemoved:[{object:"product",action:"removed"}],cartViewed:[{object:"cart",action:"viewed"}],orderUpdated:[{object:"order",action:"updated"}],orderCompleted:[{object:"order",action:"completed"}],orderRefunded:[{object:"order",action:"refunded"}],orderCancelled:[{object:"order",action:"cancelled"}],paymentInfoEntered:[{object:"payment info",action:"entered"}],checkoutStarted:[{object:"checkout",action:"started"}],checkoutStepViewed:[{object:"checkout step",action:"viewed"}],checkoutStepCompleted:[{object:"checkout step",action:"completed"}],couponEntered:[{object:"coupon",action:"entered"}],couponApplied:[{object:"coupon",action:"applied"}],couponDenied:[{object:"coupon",action:"denied"}],couponRemoved:[{object:"coupon",action:"removed"}],productAddedToWishlist:[{object:"product",action:"added to wishlist"}],productRemovedFromWishlist:[{object:"product",action:"removed from wishlist"}],productAddedFromWishlistToCart:[{object:"product",action:"added to cart from wishlist"},{object:"product",action:"added from wishlist to cart"}],productShared:[{object:"product",action:"shared"}],cartShared:[{object:"cart",action:"shared"}],productReviewed:[{object:"product",action:"reviewed"}],applicationInstalled:[{object:"application",action:"installed"}],applicationUpdated:[{object:"application",action:"updated"}],applicationOpened:[{object:"application",action:"opened"}],applicationBackgrounded:[{object:"application",action:"backgrounded"}],applicationUninstalled:[{object:"application",action:"uninstalled"}],applicationCrashed:[{object:"application",action:"crashed"}],installAttributed:[{object:"install",action:"attributed"}],deepLinkOpened:[{object:"deep link",action:"opened"}],pushNotificationReceived:[{object:"push notification",action:"received"}],pushNotificationTapped:[{object:"push notification",action:"tapped"}],pushNotificationBounced:[{object:"push notification",action:"bounced"}],emailBounced:[{object:"email",action:"bounced"}],emailDelivered:[{object:"email",action:"delivered"}],emailLinkClicked:[{object:"email link",action:"clicked"}],emailMarkedAsSpam:[{object:"email",action:"marked as spam"}],emailOpened:[{object:"email",action:"opened"}],unsubscribed:[{object:"",action:"unsubscribed"}]})},{"@ndhoule/foldl":9,"@ndhoule/map":12}],44:[function(t,e,n){"use strict";var r=t("component-bind");e.exports=function(t){for(var e in t){"function"==typeof t[e]&&(t[e]=r(t,t[e]))}return t}},{"component-bind":45}],45:[function(t,e,n){var r=[].slice;e.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}}},{}],46:[function(t,e,n){var r=t("debug")("cookie");function o(){var t;try{t=document.cookie}catch(t){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t.stack||t),{}}return function(t){var e,n={},r=t.split(/ *; */);if(""==r[0])return n;for(var o=0;o<r.length;++o)e=r[o].split("="),n[a(e[0])]=a(e[1]);return n}(t)}function i(e){try{return encodeURIComponent(e)}catch(t){r("error `encode(%o)` - %o",e,t)}}function a(e){try{return decodeURIComponent(e)}catch(t){r("error `decode(%o)` - %o",e,t)}}e.exports=function(t,e,n){switch(arguments.length){case 3:case 2:return function(t,e,n){n=n||{};var r=i(t)+"="+i(e);null==e&&(n.maxage=-1);n.maxage&&(n.expires=new Date(+new Date+n.maxage));n.path&&(r+="; path="+n.path);n.domain&&(r+="; domain="+n.domain);n.expires&&(r+="; expires="+n.expires.toUTCString());n.secure&&(r+="; secure");document.cookie=r}(t,e,n);case 1:return r=t,o()[r];default:return o()}var r}},{debug:47}],47:[function(t,e,i){function n(){var t;try{t=i.storage.debug}catch(t){}return t}(i=e.exports=t("./debug")).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},i.formatArgs=function(){var t=arguments,e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+i.humanize(this.diff),!e)return t;var n="color: "+this.color;t=[t[0],n,"color: inherit"].concat(Array.prototype.slice.call(t,1));var r=0,o=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),t.splice(o,0,n),t},i.save=function(t){try{null==t?i.storage.removeItem("debug"):i.storage.debug=t}catch(t){}},i.load=n,i.useColors=function(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)},i.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),i.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],i.formatters.j=function(t){return JSON.stringify(t)},i.enable(n())},{"./debug":48}],48:[fun