!function(){var t,e,n,r,i={8971:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(8578));function o(t,e){return function(){var n=this.traits(),r=this.properties?this.properties():{};return i.default(n,"address."+t)||i.default(n,t)||(e?i.default(n,"address."+e):null)||(e?i.default(n,e):null)||i.default(r,"address."+t)||i.default(r,t)||(e?i.default(r,"address."+e):null)||(e?i.default(r,e):null)}}e.default=function(t){t.zip=o("postalCode","zip"),t.country=o("country"),t.street=o("street"),t.state=o("state"),t.city=o("city"),t.region=o("region")}},7663:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Alias=void 0;var i=r(n(5615)),o=n(2265);function a(t,e){o.Facade.call(this,t,e)}e.Alias=a,i.default(a,o.Facade),a.prototype.action=function(){return"alias"},a.prototype.type=a.prototype.action,a.prototype.previousId=function(){return this.field("previousId")||this.field("from")},a.prototype.from=a.prototype.previousId,a.prototype.userId=function(){return this.field("userId")||this.field("to")},a.prototype.to=a.prototype.userId},3194:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.clone=void 0,e.clone=function t(e){if("[object Object]"===Object.prototype.toString.call(e)){var n={};for(var r in e)n[r]=t(e[r]);return n}return Array.isArray(e)?e.map(t):e}},7532:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Delete=void 0;var i=r(n(5615)),o=n(2265);function a(t,e){o.Facade.call(this,t,e)}e.Delete=a,i.default(a,o.Facade),a.prototype.type=function(){return"delete"}},2265:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Facade=void 0;var i=r(n(8971)),o=n(3194),a=r(n(7751)),s=r(n(7639)),u=r(n(8578)),c=r(n(518));function l(t,e){e=e||{},this.raw=o.clone(t),"clone"in e||(e.clone=!0),e.clone&&(t=o.clone(t)),"traverse"in e||(e.traverse=!0),t.timestamp="timestamp"in t?s.default(t.timestamp):new Date,e.traverse&&c.default(t),this.opts=e,this.obj=t}e.Facade=l;var f=l.prototype;function d(t){return o.clone(t)}f.proxy=function(t){var e=t.split("."),n=this[t=e.shift()]||this.field(t);return n?("function"==typeof n&&(n=n.call(this)||{}),0===e.length||(n=u.default(n,e.join("."))),this.opts.clone?d(n):n):n},f.field=function(t){var e=this.obj[t];return this.opts.clone?d(e):e},l.proxy=function(t){return function(){return this.proxy(t)}},l.field=function(t){return function(){return this.field(t)}},l.multi=function(t){return function(){var e=this.proxy(t+"s");if(Array.isArray(e))return e;var n=this.proxy(t);return n&&(n=[this.opts.clone?o.clone(n):n]),n||[]}},l.one=function(t){return function(){var e=this.proxy(t);if(e)return e;var n=this.proxy(t+"s");return Array.isArray(n)?n[0]:void 0}},f.json=function(){var t=this.opts.clone?o.clone(this.obj):this.obj;return this.type&&(t.type=this.type()),t},f.rawEvent=function(){return this.raw},f.options=function(t){var e=this.obj.options||this.obj.context||{},n=this.opts.clone?o.clone(e):e;if(!t)return n;if(this.enabled(t)){var r=this.integrations(),i=r[t]||u.default(r,t);return"object"!=typeof i&&(i=u.default(this.options(),t)),"object"==typeof i?i:{}}},f.context=f.options,f.enabled=function(t){var e=this.proxy("options.providers.all");"boolean"!=typeof e&&(e=this.proxy("options.all")),"boolean"!=typeof e&&(e=this.proxy("integrations.all")),"boolean"!=typeof e&&(e=!0);var n=e&&a.default(t),r=this.integrations();if(r.providers&&r.providers.hasOwnProperty(t)&&(n=r.providers[t]),r.hasOwnProperty(t)){var i=r[t];n="boolean"!=typeof i||i}return!!n},f.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},f.active=function(){var t=this.proxy("options.active");return null==t&&(t=!0),t},f.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},f.sessionId=f.anonymousId,f.groupId=l.proxy("options.groupId"),f.traits=function(t){var e=this.proxy("options.traits")||{},n=this.userId();for(var r in t=t||{},n&&(e.id=n),t){var i=null==this[r]?this.proxy("options.traits."+r):this[r]();null!=i&&(e[t[r]]=i,delete e[r])}return e},f.library=function(){var t=this.proxy("options.library");return t?"string"==typeof t?{name:t,version:null}:t:{name:"unknown",version:null}},f.device=function(){var t=this.proxy("context.device");"object"==typeof t&&null!==t||(t={});var e=this.library().name;return t.type||(e.indexOf("ios")>-1&&(t.type="ios"),e.indexOf("android")>-1&&(t.type="android")),t},f.userAgent=l.proxy("context.userAgent"),f.timezone=l.proxy("context.timezone"),f.timestamp=l.field("timestamp"),f.channel=l.field("channel"),f.ip=l.proxy("context.ip"),f.userId=l.field("userId"),i.default(f)},7748:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Group=void 0;var i=r(n(5615)),o=r(n(6362)),a=r(n(7639)),s=n(2265);function u(t,e){s.Facade.call(this,t,e)}e.Group=u,i.default(u,s.Facade);var c=u.prototype;c.action=function(){return"group"},c.type=c.action,c.groupId=s.Facade.field("groupId"),c.created=function(){var t=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(t)return a.default(t)},c.email=function(){var t=this.proxy("traits.email");if(t)return t;var e=this.groupId();return o.default(e)?e:void 0},c.traits=function(t){var e=this.properties(),n=this.groupId();for(var r in t=t||{},n&&(e.id=n),t){var i=null==this[r]?this.proxy("traits."+r):this[r]();null!=i&&(e[t[r]]=i,delete e[r])}return e},c.name=s.Facade.proxy("traits.name"),c.industry=s.Facade.proxy("traits.industry"),c.employees=s.Facade.proxy("traits.employees"),c.properties=function(){return this.field("traits")||this.field("properties")||{}}},5543:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Identify=void 0;var i=n(2265),o=r(n(8578)),a=r(n(5615)),s=r(n(6362)),u=r(n(7639)),c=function(t){return t.trim()};function l(t,e){i.Facade.call(this,t,e)}e.Identify=l,a.default(l,i.Facade);var f=l.prototype;f.action=function(){return"identify"},f.type=f.action,f.traits=function(t){var e=this.field("traits")||{},n=this.userId();for(var r in t=t||{},n&&(e.id=n),t){var i=null==this[r]?this.proxy("traits."+r):this[r]();null!=i&&(e[t[r]]=i,r!==t[r]&&delete e[r])}return e},f.email=function(){var t=this.proxy("traits.email");if(t)return t;var e=this.userId();return s.default(e)?e:void 0},f.created=function(){var t=this.proxy("traits.created")||this.proxy("traits.createdAt");if(t)return u.default(t)},f.companyCreated=function(){var t=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(t)return u.default(t)},f.companyName=function(){return this.proxy("traits.company.name")},f.name=function(){var t=this.proxy("traits.name");if("string"==typeof t)return c(t);var e=this.firstName(),n=this.lastName();return e&&n?c(e+" "+n):void 0},f.firstName=function(){var t=this.proxy("traits.firstName");if("string"==typeof t)return c(t);var e=this.proxy("traits.name");return"string"==typeof e?c(e).split(" ")[0]:void 0},f.lastName=function(){var t=this.proxy("traits.lastName");if("string"==typeof t)return c(t);var e=this.proxy("traits.name");if("string"==typeof e){var n=c(e).indexOf(" ");if(-1!==n)return c(e.substr(n+1))}},f.uid=function(){return this.userId()||this.username()||this.email()},f.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")},f.age=function(){var t=this.birthday(),e=o.default(this.traits(),"age");return null!=e?e:t instanceof Date?(new Date).getFullYear()-t.getFullYear():void 0},f.avatar=function(){var t=this.traits();return o.default(t,"avatar")||o.default(t,"photoUrl")||o.default(t,"avatarUrl")},f.position=function(){var t=this.traits();return o.default(t,"position")||o.default(t,"jobTitle")},f.username=i.Facade.proxy("traits.username"),f.website=i.Facade.one("traits.website"),f.websites=i.Facade.multi("traits.website"),f.phone=i.Facade.one("traits.phone"),f.phones=i.Facade.multi("traits.phone"),f.address=i.Facade.proxy("traits.address"),f.gender=i.Facade.proxy("traits.gender"),f.birthday=i.Facade.proxy("traits.birthday")},4303:function(t,e,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var c=!1,l=function(){c||(c=!0,a.flush().catch(u),c=!1,setTimeout(l,a.flushTimer))};l()}}return t.prototype.increment=function(t,e){if(t.includes("analytics_js.")&&0!==e.length&&!(Math.random()>this.sampleRate||this.queue.length>=this.maxQueueSize)){var n=function(t,e,n){var i=e.reduce((function(t,e){var n=e.split(":"),r=n[0],i=n[1];return t[r]=i,t}),{});return{type:"Counter",metric:t,value:1,tags:(0,r.Cl)((0,r.Cl)({},i),{library:"analytics.js",library_version:"web"===n?"next-".concat(o.r):"npm:next-".concat(o.r)})}}(t,e,(0,a.X)());this.queue.push(n),t.includes("error")&&this.flush().catch(u)}},t.prototype.flush=function(){return(0,r.sH)(this,void 0,Promise,(function(){var t=this;return(0,r.YH)(this,(function(e){switch(e.label){case 0:return this.queue.length<=0?[2]:[4,this.send().catch((function(e){u(e),t.sampleRate=0}))];case 1:return e.sent(),[2]}}))}))},t.prototype.send=function(){return(0,r.sH)(this,void 0,Promise,(function(){var t,e,n;return(0,r.YH)(this,(function(r){return t={series:this.queue},this.queue=[],e={"Content-Type":"text/plain"},n="".concat(this.protocol,"://").concat(this.host,"/m"),[2,(0,i.h)(n,{headers:e,body:JSON.stringify(t),method:"POST"})]}))}))},t}()},6452:function(t,e,n){"use strict";n.d(e,{r:function(){return r}});var r="1.84.3"},7610:function(t,e,n){"use strict";n.d(e,{V:function(){return r}});try{window.analyticsWriteKey="A5SWuOrDC6mCcwR3s55ajxSBBgWFgku1"}catch(t){}function r(){if(void 0!==window.analyticsWriteKey)return window.analyticsWriteKey!==["__","WRITE","_","KEY","__"].join("")?window.analyticsWriteKey:void 0}},824:function(t,e,n){"use strict";function r(t,e){return e=e||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],a=[],s={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return a},get:function(t){return s[t.toLowerCase()]},has:function(t){return t.toLowerCase()in s}}}};for(var c in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,n){o.push(e=e.toLowerCase()),a.push([e,n]),s[e]=s[e]?s[e]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==e.credentials,e.headers)i.setRequestHeader(c,e.headers[c]);i.send(e.body||null)}))}n.d(e,{h:function(){return o}}),n.dn(r);var i=n(5120),o=function(){for(var t=[],e=0;et}(o);if(a)return s.setItem(r,JSON.stringify((new Date).getTime()+50)),e(),void s.removeItem(r);!a&&n<3?setTimeout((function(){f(t,e,n+1)}),50):console.error("Unable to retrieve lock")}var d=function(t){function e(e,n){var i=t.call(this,e,[])||this,o="persisted-queue:v1:".concat(n,":items"),a="persisted-queue:v1:".concat(n,":seen"),d=[],p={};return f(n,(function(){try{d=u(o),p=c(a),l(o),l(a),i.queue=(0,r.fX)((0,r.fX)([],d,!0),i.queue,!0),i.seen=(0,r.Cl)((0,r.Cl)({},p),i.seen)}catch(t){console.error(t)}})),window.addEventListener("pagehide",(function(){if(i.todo>0){var t=(0,r.fX)((0,r.fX)([],i.queue,!0),i.future,!0);try{f(n,(function(){!function(t,e){var n=u(t),i=(0,r.fX)((0,r.fX)([],e,!0),n,!0).reduce((function(t,e){var n;return(0,r.Cl)((0,r.Cl)({},t),((n={})[e.id]=e,n))}),{});s.setItem(t,JSON.stringify(Object.values(i)))}(o,t),function(t,e){var n=c(t);s.setItem(t,JSON.stringify((0,r.Cl)((0,r.Cl)({},n),e)))}(a,i.seen)}))}catch(t){console.error(t)}}})),i}return(0,r.C6)(e,t),e}(i.M)},7536:function(t,e,n){"use strict";n.d(e,{W:function(){return i}});var r=n(4303);function i(t,e){var n=new r.Facade(t,e);return"track"===t.type&&(n=new r.Track(t,e)),"identify"===t.type&&(n=new r.Identify(t,e)),"page"===t.type&&(n=new r.Page(t,e)),"alias"===t.type&&(n=new r.Alias(t,e)),"group"===t.type&&(n=new r.Group(t,e)),"screen"===t.type&&(n=new r.Screen(t,e)),Object.defineProperty(n,"obj",{value:t,writable:!0}),n}},3831:function(t,e,n){"use strict";n.d(e,{J:function(){return i},X:function(){return o}});var r="npm";function i(t){r=t}function o(){return r}},1418:function(t,e,n){"use strict";n.r(e),n.d(e,{applyDestinationMiddleware:function(){return a},sourceMiddlewarePlugin:function(){return s}});var r=n(5478),i=n(9752),o=n(7536);function a(t,e,n){return(0,r.sH)(this,void 0,Promise,(function(){function i(e,n){return(0,r.sH)(this,void 0,Promise,(function(){var i,a,s;return(0,r.YH)(this,(function(u){switch(u.label){case 0:return i=!1,a=null,[4,n({payload:(0,o.W)(e,{clone:!0,traverse:!1}),integration:t,next:function(t){i=!0,null===t&&(a=null),t&&(a=t.obj)}})];case 1:return u.sent(),i||null===a||(a.integrations=(0,r.Cl)((0,r.Cl)({},e.integrations),((s={})[t]=!1,s))),[2,a]}}))}))}var a,s,u,c,l;return(0,r.YH)(this,(function(t){switch(t.label){case 0:a=(0,o.W)(e,{clone:!0,traverse:!1}).rawEvent(),s=0,u=n,t.label=1;case 1:return s0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]1){var t=this._logs.reduce((function(t,e){var n,r,i,a=(0,o.Cl)((0,o.Cl)({},e),{json:JSON.stringify(e.extras,null," "),extras:e.extras});delete a.time;var s=null!==(i=null===(r=e.time)||void 0===r?void 0:r.toISOString())&&void 0!==i?i:"";return t[s]&&(s="".concat(s,"-").concat(Math.random())),(0,o.Cl)((0,o.Cl)({},t),((n={})[s]=a,n))}),{});console.table?console.table(t):console.log(t)}else this.logs.forEach((function(t){var e=t.level,n=t.message,r=t.extras;"info"===e||"debug"===e?console.log(n,null!=r?r:""):console[e](n,null!=r?r:"")}));this._logs=[]},t}(),s=n(4034),u=function(t){var e,n,r;this.retry=null===(e=t.retry)||void 0===e||e,this.type=null!==(n=t.type)&&void 0!==n?n:"plugin Error",this.reason=null!==(r=t.reason)&&void 0!==r?r:""},c=function(){function t(t,e,n,i){void 0===e&&(e=(0,r.v4)()),void 0===n&&(n=new s.r),void 0===i&&(i=new a),this.attempts=0,this.event=t,this._id=e,this.logger=i,this.stats=n}return t.system=function(){},t.prototype.isSame=function(t){return t.id===this.id},t.prototype.cancel=function(t){if(t)throw t;throw new u({reason:"Context Cancel"})},t.prototype.log=function(t,e,n){this.logger.log(t,e,n)},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),t.prototype.updateEvent=function(t,e){var n;if("integrations"===t.split(".")[0]){var r=t.split(".")[1];if(!1===(null===(n=this.event.integrations)||void 0===n?void 0:n[r]))return this.event}return(0,i.J)(this.event,t,e),this.event},t.prototype.failedDelivery=function(){return this._failedDelivery},t.prototype.setFailedDelivery=function(t){this._failedDelivery=t},t.prototype.logs=function(){return this.logger.logs},t.prototype.flush=function(){this.logger.flush(),this.stats.flush()},t.prototype.toJSON=function(){return{id:this._id,event:this.event,logs:this.logger.logs,metrics:this.stats.metrics}},t}()},2939:function(t,e,n){"use strict";n.d(e,{g:function(){return o},M:function(){return a}});var r=n(5478),i=n(3255);var o="onRemoveFromFuture",a=function(t){function e(e,n,r){var i=t.call(this)||this;return i.future=[],i.maxAttempts=e,i.queue=n,i.seen=null!=r?r:{},i}return(0,r.C6)(e,t),e.prototype.push=function(){for(var t=this,e=[],n=0;nt.maxAttempts||t.includes(e))&&(t.queue.push(e),!0)}));return this.queue=this.queue.sort((function(e,n){return t.getAttempts(e)-t.getAttempts(n)})),r},e.prototype.pushWithBackoff=function(t,e){if(void 0===e&&(e=0),0==e&&0===this.getAttempts(t))return this.push(t)[0];var n=function(t){var e=Math.random()+1,n=t.minTimeout,r=void 0===n?500:n,i=t.factor,o=void 0===i?2:i,a=t.attempt,s=t.maxTimeout,u=void 0===s?1/0:s;return Math.min(e*r*Math.pow(o,a),u)}({attempt:this.getAttempts(t)});return e>0&&nthis.maxAttempts||this.includes(t))&&(setTimeout((function(){n.queue.push(t),n.future=n.future.filter((function(e){return e.id!==t.id})),n.emit(o)}),e),this.future.push(t),!0)},e.prototype.getAttempts=function(t){var e;return null!==(e=this.seen[t.id])&&void 0!==e?e:0},e.prototype.updateAttempts=function(t){return this.seen[t.id]=this.getAttempts(t)+1,this.getAttempts(t)},e.prototype.includes=function(t){return this.queue.includes(t)||this.future.includes(t)||Boolean(this.queue.find((function(e){return e.id===t.id})))||Boolean(this.future.find((function(e){return e.id===t.id})))},e.prototype.pop=function(){return this.queue.shift()},Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"todo",{get:function(){return this.queue.length+this.future.length},enumerable:!1,configurable:!0}),e}(i.v)},2620:function(t,e,n){"use strict";n.d(e,{C:function(){return o},D:function(){return a}});var r=n(5478),i=n(9752);function o(t,e){t.log("debug","plugin",{plugin:e.name});var n=(new Date).getTime(),o=e[t.event.type];return void 0===o?Promise.resolve(t):function(t){return(0,r.sH)(this,void 0,void 0,(function(){var e;return(0,r.YH)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,t()];case 1:return[2,n.sent()];case 2:return e=n.sent(),[2,Promise.reject(e)];case 3:return[2]}}))}))}((function(){return o.apply(e,[t])})).then((function(t){var r=(new Date).getTime()-n;return t.stats.gauge("plugin_time",r,["plugin:".concat(e.name)]),t})).catch((function(n){if(n instanceof i.d&&"middleware_cancellation"===n.type)throw n;return n instanceof i.d?(t.log("warn",n.type,{plugin:e.name,error:n}),n):(t.log("error","plugin Error",{plugin:e.name,error:n}),t.stats.increment("plugin_error",1,["plugin:".concat(e.name)]),n)}))}function a(t,e){return o(t,e).then((function(e){if(e instanceof i.j)return e;t.log("debug","Context canceled"),t.stats.increment("context_canceled"),t.cancel(e)}))}},4034:function(t,e,n){"use strict";n.d(e,{p:function(){return i},r:function(){return o}});var r=n(5478),i=function(){function t(){this.metrics=[]}return t.prototype.increment=function(t,e,n){void 0===e&&(e=1),this.metrics.push({metric:t,value:e,tags:null!=n?n:[],type:"counter",timestamp:Date.now()})},t.prototype.gauge=function(t,e,n){this.metrics.push({metric:t,value:e,tags:null!=n?n:[],type:"gauge",timestamp:Date.now()})},t.prototype.flush=function(){var t=this.metrics.map((function(t){return(0,r.Cl)((0,r.Cl)({},t),{tags:t.tags.join(",")})}));console.table?console.table(t):console.log(t),this.metrics=[]},t.prototype.serialize=function(){return this.metrics.map((function(t){return{m:t.metric,v:t.value,t:t.tags,k:(e=t.type,{gauge:"g",counter:"c"}[e]),e:t.timestamp};var e}))},t}(),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,r.C6)(e,t),e.prototype.gauge=function(){for(var t=[],e=0;ethis.maxListeners&&(console.warn("Event Emitter: Possible memory leak detected; ".concat(String(t)," has exceeded ").concat(this.maxListeners," listeners.")),this.warned=!0)},t.prototype.on=function(t,e){return this.callbacks[t]?(this.callbacks[t].push(e),this.warnIfPossibleMemoryLeak(t)):this.callbacks[t]=[e],this},t.prototype.once=function(t,e){var n=this,r=function(){for(var i=[],o=0;o256){for(r=Array(e=256);e--;)r[e]=256*Math.random()|0;e=i=0}for(;e<16;e++)t=r[i+e],n+=6==e?o[15&t|64]:8==e?o[63&t|128]:o[t],1&e&&e>1&&e<11&&(n+="-");return i++,n}},3435:function(t,e,n){"use strict";function r(t,e,n){e.split&&(e=e.split("."));for(var r,i,o=0,a=e.length,s=t;o-1?t:t+e}(r,o):-1===(n=(e=a).indexOf("#"))?e:e.slice(0,n);return{path:c,referrer:s,search:o,title:u,url:l}},w=function(){var t=document.querySelector("link[rel='canonical']");return y(location.href,t&&t.getAttribute("href")||void 0,location.search,location.pathname,document.title,document.referrer)},_=function(e,n){void 0===n&&(n=b(w()));var r,i,o,a=e.context;"page"===e.type&&(r=e.properties&&(i=e.properties,o=Object.keys(n),Object.assign.apply(Object,(0,t.fX)([{}],o.map((function(t){var e;if(i&&Object.prototype.hasOwnProperty.call(i,t))return(e={})[t]=i[t],e})),!1))),e.properties=(0,t.Cl)((0,t.Cl)((0,t.Cl)({},n),e.properties),e.name?{name:e.name}:{})),a.page=(0,t.Cl)((0,t.Cl)((0,t.Cl)({},n),r),a.page)},x=a(3435),C=function(e){function n(t,n){var r=e.call(this,"".concat(t," ").concat(n))||this;return r.field=t,r}return(0,t.C6)(n,e),n}(Error),S="is not a string",k="is not an object",j="is nil";function P(t){!function(t){if(!(0,i.t2)(t))throw new C("Event",j);if("object"!=typeof t)throw new C("Event",k)}(t),function(t){if(!(0,i.Kg)(t.type))throw new C(".type",S)}(t),function(t){if(!(0,i.Kg)(t.messageId))throw new C(".messageId",S)}(t),"track"===t.type&&(function(t){if(!(0,i.Kg)(t.event))throw new C(".event",S)}(t),function(t){if(!(0,i.Qd)(t.properties))throw new C(".properties",k)}(t)),["group","identify"].includes(t.type)&&function(t){if(!(0,i.Qd)(t.traits))throw new C(".traits",k)}(t)}var I=function(t){var e,n;this.settings=t,this.createMessageId=t.createMessageId,this.onEventMethodCall=null!==(e=t.onEventMethodCall)&&void 0!==e?e:function(){},this.onFinishedEvent=null!==(n=t.onFinishedEvent)&&void 0!==n?n:function(){}},O=function(){function e(t){this.settings=new I(t)}return e.prototype.track=function(e,n,r,i){return this.settings.onEventMethodCall({type:"track",options:r}),this.normalize((0,t.Cl)((0,t.Cl)({},this.baseEvent()),{event:e,type:"track",properties:null!=n?n:{},options:(0,t.Cl)({},r),integrations:(0,t.Cl)({},i)}))},e.prototype.page=function(e,n,r,i,o){var a;this.settings.onEventMethodCall({type:"page",options:i});var s={type:"page",properties:(0,t.Cl)({},r),options:(0,t.Cl)({},i),integrations:(0,t.Cl)({},o)};return null!==e&&(s.category=e,s.properties=null!==(a=s.properties)&&void 0!==a?a:{},s.properties.category=e),null!==n&&(s.name=n),this.normalize((0,t.Cl)((0,t.Cl)({},this.baseEvent()),s))},e.prototype.screen=function(e,n,r,i,o){this.settings.onEventMethodCall({type:"screen",options:i});var a={type:"screen",properties:(0,t.Cl)({},r),options:(0,t.Cl)({},i),integrations:(0,t.Cl)({},o)};return null!==e&&(a.category=e),null!==n&&(a.name=n),this.normalize((0,t.Cl)((0,t.Cl)({},this.baseEvent()),a))},e.prototype.identify=function(e,n,r,i){return this.settings.onEventMethodCall({type:"identify",options:r}),this.normalize((0,t.Cl)((0,t.Cl)({},this.baseEvent()),{type:"identify",userId:e,traits:null!=n?n:{},options:(0,t.Cl)({},r),integrations:i}))},e.prototype.group=function(e,n,r,i){return this.settings.onEventMethodCall({type:"group",options:r}),this.normalize((0,t.Cl)((0,t.Cl)({},this.baseEvent()),{type:"group",traits:null!=n?n:{},options:(0,t.Cl)({},r),integrations:(0,t.Cl)({},i),groupId:e}))},e.prototype.alias=function(e,n,r,i){this.settings.onEventMethodCall({type:"alias",options:r});var o={userId:e,type:"alias",options:(0,t.Cl)({},r),integrations:(0,t.Cl)({},i)};return null!==n&&(o.previousId=n),void 0===e?this.normalize((0,t.Cl)((0,t.Cl)({},o),this.baseEvent())):this.normalize((0,t.Cl)((0,t.Cl)({},this.baseEvent()),o))},e.prototype.baseEvent=function(){return{integrations:{},options:{}}},e.prototype.context=function(t){var e,n=["userId","anonymousId","timestamp","messageId"];delete t.integrations;var r=Object.keys(t),i=null!==(e=t.context)&&void 0!==e?e:{},o={};return r.forEach((function(e){"context"!==e&&(n.includes(e)?(0,x.J)(o,e,t[e]):(0,x.J)(i,e,t[e]))})),[i,o]},e.prototype.normalize=function(e){var n,r,i,o,a=Object.keys(null!==(n=e.integrations)&&void 0!==n?n:{}).reduce((function(n,r){var i,o;return(0,t.Cl)((0,t.Cl)({},n),((i={})[r]=Boolean(null===(o=e.integrations)||void 0===o?void 0:o[r]),i))}),{});e.options=(i=e.options||{},o=function(t,e){return void 0!==e},Object.keys(i).filter((function(t){return o(t,i[t])})).reduce((function(t,e){return t[e]=i[e],t}),{}));var s=(0,t.Cl)((0,t.Cl)({},a),null===(r=e.options)||void 0===r?void 0:r.integrations),u=e.options?this.context(e.options):[],c=u[0],l=u[1],f=e.options,d=(0,t.Tt)(e,["options"]),p=(0,t.Cl)((0,t.Cl)((0,t.Cl)((0,t.Cl)({timestamp:new Date},d),{context:c,integrations:s}),l),{messageId:f.messageId||this.settings.createMessageId()});return this.settings.onFinishedEvent(p),P(p),p},e}(),E=function(e){function n(t){var n=e.call(this,{createMessageId:function(){return"ajs-next-".concat(Date.now(),"-").concat((0,v.v4)())},onEventMethodCall:function(t){var e=t.options;n.maybeUpdateAnonId(e)},onFinishedEvent:function(t){return n.addIdentity(t),t}})||this;return n.user=t,n}return(0,t.C6)(n,e),n.prototype.maybeUpdateAnonId=function(t){(null==t?void 0:t.anonymousId)&&this.user.anonymousId(t.anonymousId)},n.prototype.addIdentity=function(t){this.user.id()&&(t.userId=this.user.id()),this.user.anonymousId()&&(t.anonymousId=this.user.anonymousId())},n.prototype.track=function(t,n,r,i,o){var a=e.prototype.track.call(this,t,n,r,i);return _(a,o),a},n.prototype.page=function(t,n,r,i,o,a){var s=e.prototype.page.call(this,t,n,r,i,o);return _(s,a),s},n.prototype.screen=function(t,n,r,i,o,a){var s=e.prototype.screen.call(this,t,n,r,i,o);return _(s,a),s},n.prototype.identify=function(t,n,r,i,o){var a=e.prototype.identify.call(this,t,n,r,i);return _(a,o),a},n.prototype.group=function(t,n,r,i,o){var a=e.prototype.group.call(this,t,n,r,i);return _(a,o),a},n.prototype.alias=function(t,n,r,i,o){var a=e.prototype.alias.call(this,t,n,r,i);return _(a,o),a},n}(O),M=function(t){return"addMiddleware"in t&&"destination"===t.type},H=a(9732);var A=a(2939),F=a(9752),D=a(2620),T=function(e){function n(t){var n,r,i,o=e.call(this)||this;return o.criticalTasks=(i=0,{done:function(){return n},run:function(t){var e,o=t();return"object"==typeof(e=o)&&null!==e&&"then"in e&&"function"==typeof e.then&&(1==++i&&(n=new Promise((function(t){return r=t}))),o.finally((function(){return 0==--i&&r()}))),o}}),o.plugins=[],o.failedInitializations=[],o.flushing=!1,o.queue=t,o.queue.on(A.g,(function(){o.scheduleFlush(0)})),o}return(0,t.C6)(n,e),n.prototype.register=function(e,n,r){return(0,t.sH)(this,void 0,void 0,(function(){var i,o,a=this;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return this.plugins.push(n),i=function(t){a.failedInitializations.push(n.name),a.emit("initialization_failure",n),console.warn(n.name,t),e.log("warn","Failed to load destination",{plugin:n.name,error:t}),a.plugins=a.plugins.filter((function(t){return t!==n}))},"destination"!==n.type||"Segment.io"===n.name?[3,1]:(n.load(e,r).catch(i),[3,4]);case 1:return t.trys.push([1,3,,4]),[4,n.load(e,r)];case 2:return t.sent(),[3,4];case 3:return o=t.sent(),i(o),[3,4];case 4:return[2]}}))}))},n.prototype.deregister=function(e,n,r){return(0,t.sH)(this,void 0,void 0,(function(){var i;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),n.unload?[4,Promise.resolve(n.unload(e,r))]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.plugins=this.plugins.filter((function(t){return t.name!==n.name})),[3,4];case 3:return i=t.sent(),e.log("warn","Failed to unload destination",{plugin:n.name,error:i}),[3,4];case 4:return[2]}}))}))},n.prototype.dispatch=function(e){return(0,t.sH)(this,void 0,void 0,(function(){var n;return(0,t.YH)(this,(function(t){return e.log("debug","Dispatching"),e.stats.increment("message_dispatched"),this.queue.push(e),n=this.subscribeToDelivery(e),this.scheduleFlush(0),[2,n]}))}))},n.prototype.subscribeToDelivery=function(e){return(0,t.sH)(this,void 0,void 0,(function(){var n=this;return(0,t.YH)(this,(function(t){return[2,new Promise((function(t){var r=function(i,o){i.isSame(e)&&(n.off("flush",r),t(i))};n.on("flush",r)}))]}))}))},n.prototype.dispatchSingle=function(e){return(0,t.sH)(this,void 0,void 0,(function(){var n=this;return(0,t.YH)(this,(function(t){return e.log("debug","Dispatching"),e.stats.increment("message_dispatched"),this.queue.updateAttempts(e),e.attempts=1,[2,this.deliver(e).catch((function(t){return n.enqueuRetry(t,e)?n.subscribeToDelivery(e):(e.setFailedDelivery({reason:t}),e)}))]}))}))},n.prototype.isEmpty=function(){return 0===this.queue.length},n.prototype.scheduleFlush=function(t){var e=this;void 0===t&&(t=500),this.flushing||(this.flushing=!0,setTimeout((function(){e.flush().then((function(){setTimeout((function(){e.flushing=!1,e.queue.length&&e.scheduleFlush(0)}),0)}))}),t))},n.prototype.deliver=function(e){var n;return(0,t.sH)(this,void 0,void 0,(function(){var r,i,o,a,s;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return[4,this.criticalTasks.done()];case 1:t.sent(),r=Date.now(),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.flushOne(e)];case 3:return e=t.sent(),i=Date.now()-r,(o=e.failedDelivery())?(s=o.reason instanceof Error?o.reason:new Error(String(null!==(n=o.reason)&&void 0!==n?n:"Unknown delivery failure")),e.log("error","Failed to deliver",s),this.emit("delivery_failure",e,s),e.stats.increment("delivery_failed"),[2,e]):(this.emit("delivery_success",e),e.stats.gauge("delivered",i),e.log("debug","Delivered",e.event),[2,e]);case 4:throw a=t.sent(),s=a,e.log("error","Failed to deliver",s),this.emit("delivery_failure",e,s),e.stats.increment("delivery_failed"),a;case 5:return[2]}}))}))},n.prototype.enqueuRetry=function(t,e){return!(t instanceof F.d&&!t.retry)&&this.queue.pushWithBackoff(e)},n.prototype.flush=function(){return(0,t.sH)(this,void 0,void 0,(function(){var e,n,r;return(0,t.YH)(this,(function(t){switch(t.label){case 0:if(0===this.queue.length)return[2,[]];if(!(e=this.queue.pop()))return[2,[]];e.attempts=this.queue.getAttempts(e),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.deliver(e)];case 2:return e=t.sent(),n=!e.failedDelivery(),this.emit("flush",e,n),[3,4];case 3:return r=t.sent(),this.enqueuRetry(r,e)||(e.setFailedDelivery({reason:r}),this.emit("flush",e,!1)),[2,[]];case 4:return[2,[e]]}}))}))},n.prototype.isReady=function(){return!0},n.prototype.availableExtensions=function(e){var n,r,i=this.plugins.filter((function(t){var n,r,i;if("destination"!==t.type&&"Segment.io"!==t.name)return!0;var o=void 0;return null===(n=t.alternativeNames)||void 0===n||n.forEach((function(t){void 0!==e[t]&&(o=e[t])})),null!==(i=null!==(r=e[t.name])&&void 0!==r?r:o)&&void 0!==i?i:!1!==("Segment.io"===t.name||e.All)})),o=(n="type",r={},i.forEach((function(e){var i,o=void 0;if("string"==typeof n){var a=e[n];o="string"!=typeof a?JSON.stringify(a):a}else n instanceof Function&&(o=n(e));void 0!==o&&(r[o]=(0,t.fX)((0,t.fX)([],null!==(i=r[o])&&void 0!==i?i:[],!0),[e],!1))})),r),a=o.before,s=void 0===a?[]:a,u=o.enrichment,c=void 0===u?[]:u,l=o.destination,f=void 0===l?[]:l,d=o.after;return{before:s,enrichment:c,destinations:f,after:void 0===d?[]:d}},n.prototype.flushOne=function(e){var n,r;return(0,t.sH)(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,f,d,p,h,v,y,m;return(0,t.YH)(this,(function(t){switch(t.label){case 0:if(!this.isReady())throw new Error("Not ready");e.attempts>1&&this.emit("delivery_retry",e),i=this.availableExtensions(null!==(n=e.event.integrations)&&void 0!==n?n:{}),o=i.before,a=i.enrichment,s=0,u=o,t.label=1;case 1:return s0)return r;if(e.length<=1)return r;for(var i=e.length-2;i>=0;--i)r.push(e.slice(i).join("."));return r}(e),r=0;r=500?e.default5xxBehavior:t>=400?e.default4xxBehavior:"drop")}function Ct(e,n){var r,i,o,a,s=e||n?{rateLimitConfig:(0,t.Cl)((0,t.Cl)({},null==e?void 0:e.rateLimitConfig),null==n?void 0:n.rateLimitConfig),backoffConfig:(0,t.Cl)((0,t.Cl)((0,t.Cl)({},null==e?void 0:e.backoffConfig),null==n?void 0:n.backoffConfig),{statusCodeOverrides:(0,t.Cl)((0,t.Cl)({},null===(r=null==e?void 0:e.backoffConfig)||void 0===r?void 0:r.statusCodeOverrides),null===(i=null==n?void 0:n.backoffConfig)||void 0===i?void 0:i.statusCodeOverrides)})}:void 0,u=null==s?void 0:s.rateLimitConfig,c=null==s?void 0:s.backoffConfig;return{rateLimitConfig:{maxRetryCount:wt(null==u?void 0:u.maxRetryCount,10,0,100),maxRetryInterval:wt(null==u?void 0:u.maxRetryInterval,300,.1,86400),maxRateLimitDuration:wt(null==u?void 0:u.maxRateLimitDuration,43200,10,86400)},backoffConfig:{maxRetryCount:wt(null==c?void 0:c.maxRetryCount,10,0,100),baseBackoffInterval:wt(null==c?void 0:c.baseBackoffInterval,.5,.1,300),maxBackoffInterval:wt(null==c?void 0:c.maxBackoffInterval,60,.1,86400),maxTotalBackoffDuration:wt(null==c?void 0:c.maxTotalBackoffDuration,43200,60,604800),jitterPercent:wt(null==c?void 0:c.jitterPercent,10,0,100),default4xxBehavior:null!==(o=null==c?void 0:c.default4xxBehavior)&&void 0!==o?o:"drop",default5xxBehavior:null!==(a=null==c?void 0:c.default5xxBehavior)&&void 0!==a?a:"retry",statusCodeOverrides:(0,t.Cl)((0,t.Cl)({},bt),null==c?void 0:c.statusCodeOverrides)}}}function St(t){return(encodeURI(JSON.stringify(t)).split(/%..|./).length-1)/1024}function kt(t){return St(t)>=450}function jt(e,n,r,i){var o,a;void 0===i&&(i="https");var s,u,c,l=[],d=!1,p=null!==(o=null==n?void 0:n.size)&&void 0!==o?o:10,h=null!==(a=null==n?void 0:n.timeout)&&void 0!==a?a:5e3,v=null!=r?r:Ct(),y=0,m=0,g=!1,b=!1,w=0,_=0,x=0;function C(r,o){var a;if(0!==r.length){var s=null===(a=r[0])||void 0===a?void 0:a.writeKey,u=r.map((function(e){var n=e;n.sentAt;return(0,t.Tt)(n,["sentAt"])})),c=gt(null==n?void 0:n.headers);if(o>0&&(c["X-Retry-Count"]=String(o)),s){var l=btoa(s+":");c.Authorization="Basic ".concat(l)}var f=e.startsWith("http://")||e.startsWith("https://")?"":"".concat(i,"://");return(0,yt.h)("".concat(f).concat(e,"/b"),{credentials:null==n?void 0:n.credentials,keepalive:(null==n?void 0:n.keepalive)||d,headers:c,method:"post",body:JSON.stringify({writeKey:s,batch:u,sentAt:(new Date).toISOString()}),priority:null==n?void 0:n.priority}).then((function(t){var e=t.status;if(!(e<400)){var n=xt(e,v.backoffConfig);if("drop"!==n){var r=_t(t,v.rateLimitConfig);if(r)throw new mt("Rate limit exceeded: ".concat(e),r.retryAfterMs,r.fromHeader)}if("retry"===n)throw new Error("Retryable error: ".concat(e))}}))}}function S(){l.length>0&&j(1)}function k(e){var r;return void 0===e&&(e=1),(0,t.sH)(this,void 0,Promise,(function(){var i,o,a,s;return(0,t.YH)(this,(function(u){return g||(m=0,w=0,_=0,x=0),g=!1,b=!0,l.length?(i=function(e){for(var n=[],r=0;r0&&kt(o))return{batch:n,remaining:e.slice(r)};n.push(i)}return{batch:n,remaining:[]}}(l),o=i.batch,a=i.remaining,0===o.length?(b=!1,[2]):(l=a,s=m,m+=1,[2,null===(r=C(o,s))||void 0===r?void 0:r.then((function(t){return l.length>0&&j(1),t})).catch((function(r){var i;f.o.system().log("error","Error sending batch",r);var a,s=null!==(i=null==n?void 0:n.maxRetries)&&void 0!==i?i:v.backoffConfig.maxRetryCount,u="RateLimitError"===r.name,c=u&&r.isRetryableWithoutCount;if(!(c||e<=s))return S();if(c){if(++w>v.rateLimitConfig.maxRetryCount)return S();var d=r.retryTimeout;x+=d;var p=1e3*v.rateLimitConfig.maxRateLimitDuration;if(x>p)return S();y=d}if(!u){a=function(t,e){var n=1e3*e.baseBackoffInterval,r=1e3*e.maxBackoffInterval,i=n*Math.pow(2,t-1),o=Math.min(i,r),a=1+2*(Math.random()-.5)*(e.jitterPercent/100);return Math.max(0,o*a)}(e,v.backoffConfig),_+=a;var h=1e3*v.backoffConfig.maxTotalBackoffDuration;if(_>h)return S()}l=(0,t.fX)((0,t.fX)([],o,!0),l,!0),o.forEach((function(n){if("_metadata"in n){var r=n;r._metadata=(0,t.Cl)((0,t.Cl)({},r._metadata),{retryCount:e})}})),g=!0,j(c?e:e+1,a)})).finally((function(){b=!1}))])):(b=!1,[2])}))}))}function j(t,e){(void 0===t&&(t=1),s)||(s=setTimeout((function(){s=void 0,k(t).catch(console.error)}),y||e||h),y=0)}return u=function(t){if((d=t)&&l.length){var e=function(t){var e=[],n=0;return t.forEach((function(t){St(e[n])>=64&&n++,e[n]?e[n].push(t):e[n]=[t]})),e}(l).map((function(t){return C(t,0)}));Promise.all(e).catch(console.error)}},c=!1,window.addEventListener("pagehide",(function(){c||u(c=!0)})),document.addEventListener("visibilitychange",(function(){if("hidden"==document.visibilityState){if(c)return;c=!0}else c=!1;u(c)})),{dispatch:function(e,r,i){return(0,t.sH)(this,void 0,Promise,(function(){var e;return(0,t.YH)(this,(function(t){return l.push(r),g?[2]:(e=l.length>=p||kt(l)||(null==n?void 0:n.keepalive)&&function(t){return St(t)>=54}(l),e||d?[2,b?j():k()]:[2,j()])}))}))}}}function Pt(t,e){return{dispatch:function(n,r,i){var o=gt(null==t?void 0:t.headers),a=null==r?void 0:r.writeKey;if(a){var s=btoa(a+":");o.Authorization="Basic ".concat(s)}return i&&(o["X-Retry-Count"]=String(i)),(0,yt.h)(n,{credentials:null==t?void 0:t.credentials,keepalive:null==t?void 0:t.keepalive,headers:o,method:"post",body:JSON.stringify(r),priority:null==t?void 0:t.priority}).then((function(t){var n=t.status;if(!(n<400)){var r=null!=e?e:Ct(),i=xt(n,r.backoffConfig);if("drop"!==i){var o=_t(t,r.rateLimitConfig);if(o)throw new mt("Rate limit exceeded: ".concat(n),o.retryAfterMs,o.fromHeader)}if("retry"===i)throw new Error("Retryable error: ".concat(n));var a=new Error("Non-retryable error: ".concat(n));throw a.name="NonRetryableError",a}}))}}}function It(e,n,r,i,o){var a,s=e.user();delete n.options,n.writeKey=null==r?void 0:r.apiKey,n.userId=n.userId||s.id(),n.anonymousId=n.anonymousId||s.anonymousId(),n.sentAt=new Date;var u=e.queue.failedInitializations||[];u.length>0&&(n._metadata={failedInitializations:u}),null!=o&&(o.attempts>1&&(n._metadata=(0,t.Cl)((0,t.Cl)({},n._metadata),{retryCount:o.attempts})),o.attempts++);var c=[],l=[];for(var f in i){var d=i[f];"Segment.io"===f&&c.push(f),"bundled"===d.bundlingStatus&&c.push(f),"unbundled"===d.bundlingStatus&&l.push(f)}for(var p=0,h=(null==r?void 0:r.unbundledIntegrations)||[];p0&&!(0,l.a)()}),(function(){return(0,t.sH)(i,void 0,void 0,(function(){var i,o;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return(i=n.pop())?[4,(0,D.C)(i,e)]:[2];case 1:return o=t.sent(),o instanceof f.o||r.push(i),[2]}}))}))}))];case 1:return o.sent(),r.map((function(t){return n.pushWithBackoff(t)})),[2,n]}}))}))}function Mt(e,n,r,i){var o=this;e||setTimeout((function(){return(0,t.sH)(o,void 0,void 0,(function(){var e,o;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return e=!0,[4,Et(r,n)];case 1:return o=t.sent(),e=!1,n.todo>0&&i(e,o,r,i),[2]}}))}))}),500*Math.random()+100)}var Ht=a(3858);var At=function(t){return"Segment.io"===t.name};function Ft(e,n,r){var i,o,a,s;window.addEventListener("pagehide",(function(){c.push.apply(c,Array.from(f)),f.clear()}));var u=null!==(i=null==n?void 0:n.apiKey)&&void 0!==i?i:"",c=e.options.disableClientPersistence?new A.M(e.queue.queue.maxAttempts,[]):new H.x(e.queue.queue.maxAttempts,"".concat(u,":dest-Segment.io")),f=new Set,d=new WeakMap,p=!1,h=null!==(o=null==n?void 0:n.apiHost)&&void 0!==o?o:Ht.a,v=null!==(a=null==n?void 0:n.protocol)&&void 0!==a?a:"https",y="".concat(v,"://").concat(h),m=null===(s=null==r?void 0:r["Segment.io"])||void 0===s?void 0:s.httpConfig,g=Ct(null==n?void 0:n.httpConfig,m);!1!==e.options.retryQueue&&(c.maxAttempts=g.backoffConfig.maxRetryCount);var b=null==n?void 0:n.deliveryStrategy,w=b&&"strategy"in b&&"batching"===b.strategy?jt(h,b.config,g,v):Pt(null==b?void 0:b.config,g);function _(i){return(0,t.sH)(this,void 0,Promise,(function(){var o,a,s,u;return(0,t.YH)(this,(function(t){return(0,l.a)()?(c.push(i),Mt(p,c,x,Mt),[2,i]):(f.add(i),o=i.event.type.charAt(0),a=(0,vt.W)(i.event).json(),"track"===i.event.type&&delete a.traits,"alias"===i.event.type&&(a=function(t,e){var n,r,i,o,a=t.user();return e.previousId=null!==(i=null!==(r=null!==(n=e.previousId)&&void 0!==n?n:e.from)&&void 0!==r?r:a.id())&&void 0!==i?i:a.anonymousId(),e.userId=null!==(o=e.userId)&&void 0!==o?o:e.to,delete e.from,delete e.to,e}(e,a)),(s=c.getAttempts(i))>=c.maxAttempts?(f.delete(i),u=new Error("Retry attempts exhausted (".concat(s,"/").concat(c.maxAttempts,")")),i.setFailedDelivery({reason:u}),e.emit("error",{code:"delivery_failure",reason:u,ctx:i}),[2,i]):[2,w.dispatch("".concat(y,"/").concat(o),It(e,a,n,r,i),s).then((function(){return i})).catch((function(t){var n;if(i.log("error","Error sending event",t),"RateLimitError"===t.name){var r=(null!==(n=d.get(i))&&void 0!==n?n:0)+1;if(d.set(i,r),r>g.rateLimitConfig.maxRetryCount)i.setFailedDelivery({reason:t}),e.emit("error",{code:"delivery_failure",reason:t,ctx:i});else{var o=t.retryTimeout;c.pushWithDelay(i,o)}}else"NonRetryableError"===t.name?(i.setFailedDelivery({reason:t}),e.emit("error",{code:"delivery_failure",reason:t,ctx:i})):c.pushWithBackoff(i);return Mt(p,c,x,Mt),i})).finally((function(){f.delete(i)}))])}))}))}var x={metadata:{writeKey:u,apiHost:h,protocol:v},name:"Segment.io",type:"destination",version:"0.1.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:_,identify:_,page:_,alias:_,group:_,screen:_};return c.todo&&Mt(p,c,x,Mt),x}var Dt="This is being deprecated and will be not be available in future releases of Analytics JS",Tt=(0,nt.m)(),Nt=null==Tt?void 0:Tt.analytics;var Rt=function(){function t(t,e){var n;this.timeout=300,this._getSegmentPluginMetadata=function(){var t;return null===(t=e.plugins.find(At))||void 0===t?void 0:t.metadata},this.writeKey=t.writeKey;this.cdnSettings=null!==(n=t.cdnSettings)&&void 0!==n?n:{integrations:{"Segment.io":{apiKey:""}}},this.cdnURL=t.cdnURL}return Object.defineProperty(t.prototype,"apiHost",{get:function(){var t,e;return null===(e=null===(t=this._getSegmentPluginMetadata)||void 0===t?void 0:t.call(this))||void 0===e?void 0:e.apiHost},enumerable:!1,configurable:!0}),t}();function Lt(){console.warn(Dt)}var qt,Yt=function(e){function n(n,r,i,o,a){var s,u,c=this;(c=e.call(this)||this)._debug=!1,c.initialized=!1,c.user=function(){return c._user},c.init=c.initialize.bind(c),c.log=Lt,c.addIntegrationMiddleware=Lt,c.listeners=Lt,c.addEventListener=Lt,c.removeAllListeners=Lt,c.removeListener=Lt,c.removeEventListener=Lt,c.hasListeners=Lt,c.add=Lt,c.addIntegration=Lt;var l=null==r?void 0:r.cookie,f=null!==(s=null==r?void 0:r.disableClientPersistence)&&void 0!==s&&s;c.queue=null!=i?i:function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var r=e?10:1,i=n?new A.M(r,[]):new H.x(r,t);return new N(i)}("".concat(n.writeKey,":event-queue"),null==r?void 0:r.retryQueue,f),c.settings=new Rt(n,c.queue);var d=null==r?void 0:r.storage;return c._universalStorage=c.createStore(f,d,l),c._user=null!=o?o:new Z((0,t.Cl)({persist:!f,storage:null==r?void 0:r.storage},null==r?void 0:r.user),l).load(),c._group=null!=a?a:new tt((0,t.Cl)({persist:!f,storage:null==r?void 0:r.storage},null==r?void 0:r.group),l).load(),c.eventFactory=new E(c._user),c.integrations=null!==(u=null==r?void 0:r.integrations)&&void 0!==u?u:{},c.options=null!=r?r:{},R(c),c}return(0,t.C6)(n,e),n.prototype.createStore=function(t,e,n){return t?new U([new J]):e&&X(e)?new U(Q(V(e.stores,n))):new U(Q([L.LocalStorage,{name:L.Cookie,settings:n},L.Memory]))},Object.defineProperty(n.prototype,"storage",{get:function(){return this._universalStorage},enumerable:!1,configurable:!0}),n.prototype.track=function(){for(var e=[],n=0;n4){var a=r.slice(4);"campaign"===a&&(a="name"),t[a]=(0,Ut.p)(o)}return t}),{})}(u));var l=function(){var t=Y.get("_ga");if(t&&t.startsWith("amp"))return t}();l&&(a.amp={id:l}),function(e,n,r){var i,o=new U(r?[]:[new B(Xt())]),a=o.get("s:context.referrer"),s=null!==(i=function(t){var e={btid:"dataxu",urid:"millennial-media"};t.startsWith("?")&&(t=t.substring(1));for(var n=0,r=(t=t.replace(/\?/g,"&")).split("&");n0}(n)?[4,a.e(10).then(a.bind(a,31)).then((function(t){return t.tsubMiddleware(n.middlewareSettings.routingRules)}))]:[3,2];case 1:return y=I.sent(),[3,3];case 2:y=void 0,I.label=3;case 3:return v=y,O=n,"test"!==r().NODE_ENV&&Object.keys(O.integrations).length>1||u.length>0?[4,a.e(50).then(a.bind(a,3771)).then((function(t){return t.ajsDestinations(e,n,i.integrations,o,v,u)}))]:[3,5];case 4:return g=I.sent(),[3,6];case 5:g=[],I.label=6;case 6:return m=g,n.legacyVideoPluginsEnabled?[4,a.e(694).then(a.bind(a,8162)).then((function(t){return t.loadLegacyVideoPlugins(i)}))]:[3,8];case 7:I.sent(),I.label=8;case 8:return(null===(l=o.plan)||void 0===l?void 0:l.track)?[4,a.e(104).then(a.bind(a,3542)).then((function(t){var e;return t.schemaFilter(null===(e=o.plan)||void 0===e?void 0:e.track,n)}))]:[3,10];case 9:return w=I.sent(),[3,11];case 10:w=void 0,I.label=11;case 11:return b=w,_=(0,Bt.J)(n,o),[4,re(n,i.integrations,_,o,v,h).catch((function(t){return console.error("Failed to load remote plugins",t),[]}))];case 12:return x=I.sent(),C=(0,t.fX)((0,t.fX)([Gt],m,!0),x,!0),b&&C.push(b),!1===(null===(f=o.integrations)||void 0===f?void 0:f.All)&&!o.integrations["Segment.io"]||o.integrations&&!1===o.integrations["Segment.io"]?[3,14]:(k=(S=C).push,[4,Ft(i,_["Segment.io"],n.integrations)]);case 13:k.apply(S,[I.sent()]),I.label=14;case 14:return[4,i.register.apply(i,(0,t.fX)((0,t.fX)([],C,!1),p,!1))];case 15:return j=I.sent(),[4,at(i,c)];case 16:return I.sent(),Object.entries(null!==(d=n.enabledMiddleware)&&void 0!==d?d:{}).some((function(t){return t[1]}))?[4,a.e(521).then(a.bind(a,9231)).then((function(e){var r=e.remoteMiddlewares;return(0,t.sH)(P,void 0,void 0,(function(){var e,a;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return[4,r(j,n,o.obfuscate)];case 1:return e=t.sent(),a=e.map((function(t){return i.addSourceMiddleware(t)})),[2,Promise.all(a)]}}))}))}))]:[3,18];case 17:I.sent(),I.label=18;case 18:return[4,ot(i,c)];case 19:return I.sent(),[2,j]}var O}))}))}function ce(n,r,i){var o,a,s,u,c,l,d,p,h;return void 0===r&&(r={}),(0,t.sH)(this,void 0,Promise,(function(){var v,y,m,g,b,w,_,x,C,S;return(0,t.YH)(this,(function(k){switch(k.label){case 0:return!0===r.disable?[2,[new Kt,f.o.system()]]:(r.globalAnalyticsKey&&(0,rt.rY)(r.globalAnalyticsKey),n.cdnURL&&(0,e.qQ)(n.cdnURL),r.initialPageview&&i.add(new ft("page",[])),v=function(){var t,e,n=null!==(t=window.location.hash)&&void 0!==t?t:"",r=null!==(e=window.location.search)&&void 0!==e?e:"";return r.length?r:n.replace(/(?=#).*(?=\?)/,"")}(),y=null!==(o=n.cdnURL)&&void 0!==o?o:(0,e.I2)(),null===(a=n.cdnSettings)||void 0===a?[3,1]:(g=a,[3,3]));case 1:return[4,(j=n.writeKey,P=y,(0,yt.h)("".concat(P,"/v1/projects/").concat(j,"/settings")).then((function(t){return t.ok?t.json():t.text().then((function(t){throw new Error(t)}))})).catch((function(t){throw console.error(t.message),t})))];case 2:g=k.sent(),k.label=3;case 3:return m=g,r.updateCDNSettings&&(m=r.updateCDNSettings(m)),"function"!=typeof r.disable?[3,5]:[4,r.disable(m)];case 4:if(k.sent())return[2,[new Kt,f.o.system()]];k.label=5;case 5:return b=null===(u=null===(s=m.integrations["Segment.io"])||void 0===s?void 0:s.retryQueue)||void 0===u||u,r=(0,t.Cl)({retryQueue:b},r),function(t){var e;null===(e=ie.attach)||void 0===e||e.call(ie,t)}(w=new Yt((0,t.Cl)((0,t.Cl)({},n),{cdnSettings:m,cdnURL:y}),r)),_=null!==(c=n.plugins)&&void 0!==c?c:[],x=null!==(l=n.classicIntegrations)&&void 0!==l?l:[],C=null===(d=r.integrations)||void 0===d?void 0:d["Segment.io"],oe.U.initRemoteMetrics((0,t.Cl)((0,t.Cl)({},m.metrics),{host:null!==(p=null==C?void 0:C.apiHost)&&void 0!==p?p:null===(h=m.metrics)||void 0===h?void 0:h.host,protocol:null==C?void 0:C.protocol})),[4,ue(n.writeKey,m,w,r,_,x,i)];case 6:return S=k.sent(),w.initialized=!0,w.emit("initialize",n,r),[4,ae(w,v,i)];case 7:return k.sent(),[2,[w,S]]}var j,P}))}))}var le=function(e){function n(){var t=this,n=(0,zt.u)(),r=n.promise,i=n.resolve;return t=e.call(this,(function(t){return r.then((function(e){return ce(e[0],e[1],t)}))}))||this,t._resolveLoadStart=function(t,e){return i([t,e])},t}return(0,t.C6)(n,e),n.prototype.load=function(t,e){return void 0===e&&(e={}),this._resolveLoadStart(t,e),this},n.load=function(t,e){return void 0===e&&(e={}),(new n).load(t,e)},n.standalone=function(t,e){return n.load({writeKey:t},e).then((function(t){return t[0]}))},n}(ht),fe=a(7610);function de(){var e,n;return(0,t.sH)(this,void 0,Promise,(function(){var r,i,o;return(0,t.YH)(this,(function(t){switch(t.label){case 0:return r=function(){var t;if((0,fe.V)())return(0,fe.V)();var e=(0,rt.kJ)();if(null==e?void 0:e._writeKey)return e._writeKey;for(var n=/http.*\/analytics\.js\/v1\/([^/]*)(\/platform)?\/analytics.*/,r=void 0,i=0,o=Array.prototype.slice.call(document.querySelectorAll("script"));i=parseInt(o)}()){var we=document.createElement("script");we.setAttribute("src","https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.7.0/polyfill.min.js"),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(function(){return document.body.appendChild(we)})):document.body.appendChild(we),we.onload=function(){ge(de)}}else ge(de)}(),window.AnalyticsNext={}}(); //# sourceMappingURL=standalone.js.map