88980e3a-6890-4e52-bcc1-3154ab2a17c7.edge.permutive.app
Open in
urlscan Pro
2606:4700:4400::ac40:98f3
Public Scan
URL:
https://88980e3a-6890-4e52-bcc1-3154ab2a17c7.edge.permutive.app/88980e3a-6890-4e52-bcc1-3154ab2a17c7-web.js
Submission: On September 20 via api from IT — Scanned from IT
Submission: On September 20 via api from IT — Scanned from IT
Form analysis
0 forms found in the DOMText Content
/*! permutive-javascript-sdk v20.11.0 (web) (built 2024-09-20T12:29:27.036Z) */(()=>{"use strict";var __webpack_modules__={2688:(e,t,n)=>{function r(e){return e instanceof Error?e:new Error("string"==typeof e?e:JSON.stringify(e))}n.d(t,{w:()=>r})},787:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(3735),i=n(2884);function o(e){return(0,r.zG)((0,i.Y3)((()=>JSON.parse(e))),(0,i.fS)(r.gn))}},6726:(e,t,n)=>{n.r(t),n.d(t,{CleanRoomAddon:()=>v,load:()=>h});var r=n(9853),i=n(2688),o=n(5851),s=n(365),a=n(3735),u=n(2884),c=n(2707),l=n(2851),d=n(2652),f=n(4730),p=n(7826);class g{prefix="[clean_room]";api;sessionManager;permutive;logger;clientContext;viewId;async putOrResetUnprocessed(e){return(0,a.zG)(e,u.g_((()=>c.Y3((()=>this.unprocessedPrebidAuctions.reset()),i.w)),(e=>c.Y3((()=>this.unprocessedPrebidAuctions.put(e)),i.w))),c.vx((e=>(this.reportError(`Unprocessed auctions failed to put. Got ${e}`),c.F2((0,a.Q1)())))),(e=>e()))}unprocessedPrebidAuctions;debouncedPutOrResetUnprocessed=this.setupUnprocessedPrebidAuctions();stagedAuctions={};trackableAuctions={};get allAuctions(){return{...this.stagedAuctions,...this.trackableAuctions}}trackAuctionsInterval=null;constructor(e){this.permutive=e.permutive,this.api=e.api,this.logger=e.logger,this.unprocessedPrebidAuctions=e.unprocessedEvents.PrebidAuctions,this.sessionManager=e.sessionManager,this.clientContext=e.clientContext,this.viewId=e.viewId,(0,a.zG)(e.pbjs,l.UI(u.EQ((()=>{this.logInfo("Waiting for PrebidJS to start PrebidAuctions tracking...")}),(e=>this.startPrebidAuctions(e)))))}async startPrebidAuctions(e){await this.trackUnprocessedPrebidAuctions(),this.logDebug("Starting PrebidAuctions tracking",{prebid:e});const t=(0,p.zi)(e),n=e=>0===e.bidsReceived.length&&0===e.noBids.length?null:(0,a.zG)(this.mapToStagedAuctions(e),s.tS((()=>s.Y3((()=>e.bidsReceived.forEach((e=>{var n;("rendered"===(n=e).status||"targetingSet"===n.status)&&this.setBidToWon(t,e)}))),(e=>{const t=`Failed to process auction. Got ${(0,i.w)(e)}`;return this.reportError(t),(0,i.w)(t)})))));e.onEvent("auctionEnd",(e=>{n(e),this.storeAuctionsAsUnprocessed(this.allAuctions)}));const r=n=>{const r=(0,d.qh)(n);this.logDebug("Processing setTargeting event",{adUnitCodes:r});const i=s.DT((e=>{let[t,n]=e;return!!t&&!!n.hb_adid}),(()=>new Error("Missing targeting data"))),u=(0,a.ls)(i,s.tS((t=>{let[n,{hb_adid:r}]=t;return(0,a.zG)(e.getAllPrebidWinningBids(),(0,o.Ew)((e=>e.adId===r&&e.adUnitCode===n)),s.Yo((()=>new Error("Prebid winning bid does not exist"))))})),s.UI((e=>{this.setBidToWon(t,e)})));return r.forEach(u)};e.onEvent("setTargeting",(e=>{r(e),this.storeAuctionsAsUnprocessed(this.allAuctions)})),e.onEvent("bidWon",(e=>{this.setBidToWon(t,e),this.storeAuctionsAsUnprocessed(this.allAuctions)}));const u=(e,n)=>{this.logDebug("Processing render event",{isRendered:e,props:n}),n.bid&&(e&&this.setBidToRendered(t,n.bid),this.promoteAuctionToTrackable(n.bid),this.storeAuctionsAsUnprocessed(this.allAuctions),this.trackEligibleAuctions())};e.onEvent("adRenderSucceeded",(e=>{u(!0,e)})),e.onEvent("adRenderFailed",(e=>{u(!1,e)})),e.getEvents().forEach((e=>"auctionEnd"===e.eventType?n(e.args):"setTargeting"===e.eventType?r(e.args):"bidWon"===e.eventType?this.setBidToWon(t,e.args):"adRenderSucceeded"===e.eventType?u(!0,e.args):"adRenderFailed"===e.eventType?u(!1,e.args):void 0)),this.storeAuctionsAsUnprocessed(this.allAuctions,{debounced:!1}),(0,d.aT)((async()=>{this.trackAuctionsInterval=null;const e=this.allAuctions;this.stagedAuctions={},this.trackableAuctions={},await this.trackPrebidAuctions(e,{useBeacon:!0}),await this.storeAuctionsAsUnprocessed(null,{debounced:!1})}))}trackUnprocessedPrebidAuctions(){return(0,a.zG)(c.Y3((async()=>(0,a.zG)(await this.unprocessedPrebidAuctions.getIfPresent(),u.g_((()=>this.logDebug("No unprocessed PrebidAuctions found")),(e=>{let{props:t,...n}=e;return this.logDebug("Found unprocessed PrebidAuctions",{props:t,unprocessedData:n}),Promise.all([this.permutive.track("PrebidAuctions",t,{unprocessedData:n}),this.unprocessedPrebidAuctions.reset()])})))),(e=>{const t=`Failed to track unprocessed PrebidAuctions. Got ${(0,i.w)(e)}`;return this.reportError(t),(0,i.w)(t)})),(e=>e()))}setupUnprocessedPrebidAuctions(){const e=new f.b(1e3,2500),t=this.putOrResetUnprocessed.bind(this);return e.schedule(t)}async storeAuctionsAsUnprocessed(e){let{debounced:t=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.logDebug("Store auctions as unprocessed",{auctionsToStore:e,debounced:t});const n=c.Y3((async()=>{const t=(0,d.qh)(e??{}).map((e=>{let[t,n]=e;return{...n,auction_id:t}})),n=await this.clientContext.getClient();return(0,a.zG)(t,u.DT((e=>e.length>0)),u.UI((e=>({client:n,props:this.makePrebidAuctionProperties({auctions:e}),viewId:this.viewId.get(),sessionId:this.sessionManager.getSessionId()}))))}),i.w);return(0,a.zG)(n,c.EQ((e=>{this.reportError(`Failed to process auctions: ${e}`)}),(e=>{const n=this.debouncedPutOrResetUnprocessed(e);return t?n:Promise.all([this.putOrResetUnprocessed(e),n])})),(e=>e()))}mapBidProperties(e,t){var n;return{ad_id:t.adId,ad_unit_code:t.adUnitCode,advertiser_domains:(0,p.Cg)(t),advertiser_id:(e=>{var t,n;const r=e.rubicon&&"object"==typeof e.rubicon&&"advertiserId"in e.rubicon&&e.rubicon.advertiserId||(null==e||null===(t=e.meta)||void 0===t?void 0:t.buyerId)||(null==e||null===(n=e.meta)||void 0===n?void 0:n.advertiserId);return r?`${r}`:void 0})(t),advertiser_name:(e=>{var t,n,r;const i=(null===(t=e.meta)||void 0===t?void 0:t.clickUrl)||(null===(n=e.adomain)||void 0===n?void 0:n[0])||(null===(r=e.meta)||void 0===r?void 0:r.advertiserName);return i?`${i}`:void 0})(t),bid_available:"string"==typeof t.statusMessage&&t.statusMessage.indexOf("empty")<0,bidder:t.bidder,bidder_timeout:(0,d.rH)(e.bidderTimeout),brand_id:(e=>{var t;const n=null===(t=e.meta)||void 0===t?void 0:t.brandId;return n?`${n}`:void 0})(t),brand_name:(e=>{var t;return null===(t=e.meta)||void 0===t?void 0:t.brandName})(t),cpm:(0,p.Qd)(t),creative_id:`${t.creativeId}`,deal_id:(0,p.$7)(t),dsp_id:(0,p.cs)(t),hb_pb:null===(n=t.adserverTargeting)||void 0===n?void 0:n.hb_pb,height:(0,d.rH)(t.height),request_timestamp:t.requestTimestamp,response_timestamp:t.responseTimestamp,time_to_respond:t.timeToRespond,width:(0,d.rH)(t.width)}}collectAdUnitCodes(e){const t=new Set;return e.reduce(((e,n)=>{let{adUnitCode:r}=n;return!r||t.has(r)||(t.add(r),e.push({ad_unit_code:r})),e}),[])}mapToStagedAuctions(e){return s.Y3((()=>{const{auctionId:t,bidsReceived:n,noBids:r}=e,i=this.collectAdUnitCodes(n),o=this.collectAdUnitCodes(r);return this.stagedAuctions[t]={bids:i,no_bids:o},this.logDebug("Added auction",this.stagedAuctions[t]),this.stagedAuctions[t]}),(e=>{const t=`Failed to map auction. Got ${(0,i.w)(e)}`;return this.reportError(t),(0,i.w)(t)}))}findAuction(e){return(0,a.zG)(this.getStagedAuction(e.auctionId),s.vx((()=>this.getTrackableAuction(e.auctionId))),s.vx((()=>this.mapToStagedAuctions({auctionId:e.auctionId,bidsReceived:[e],bidderRequests:[],noBids:[]}))))}setBidByOperation(e,t,n){const r=e=>e.hasOwnProperty("ad_id"),u=(n,u)=>{const c=e=>e.ad_id===n.adId,l=e=>e.ad_unit_code===n.adUnitCode,[d,f]=(0,a.zG)(u,(0,o.uK)((e=>r(e)&&c(e)&&l(e))),(e=>[e.left,e.right]));this.logDebug(`Bids for ${t}`,{nonMatching:d,matching:f});const p=(0,a.ls)(s.DT((e=>1===e.length),(()=>new Error("No matching bids"))),s.UI((e=>{let[n]=e;return this.logDebug(`Found bid for ${t}`,{found:n}),{found:n,others:d}}))),g=s.DT((e=>e.length<=1),(()=>new Error("Ad ID is not unique"))),m=(0,a.ls)(p,s.vx((()=>s.Y3((()=>{const i=this.mapBidProperties(e,n),o=d.filter((e=>!(!l(e)||!r(e))||!l(e)));return this.logDebug(`Creating bid for ${t}`,{created:i,others:o}),{found:i,others:o}}),(e=>(0,i.w)(`Failed to create bid. Got ${(0,i.w)(e)}`))))));return(0,a.zG)(f,g,s.tS(m))};return(0,a.ls)((e=>(0,a.zG)(this.findAuction(e),s.tS((r=>(0,a.zG)(u(e,r.bids),s.tS((e=>{let{found:t,others:r}=e;return s.Y3((()=>({updated:n(t),others:r})),i.w)})),s.UI((e=>{let{updated:n,others:i}=e;const o=[n,...i];r.bids=o,this.logDebug(`Bid operation ${t} successful`,n,o)}))))))),s.Vn((e=>{const n=`Failed bid operation ${t}. Got ${(0,i.w)(e)}`;return this.reportError(n),(0,i.w)(n)})))}setBidToWon(e,t){return this.setBidByOperation(e,"setWon",(e=>({...e,winning_bid:!0})))(t)}setBidToRendered(e,t){return this.setBidByOperation(e,"setRendered",(e=>({...e,winning_bid:!0,is_rendered:!0,rendered_timestamp:(new Date).getTime()})))(t)}promoteAuctionToTrackable(e){let{auctionId:t}=e;const n=this.stagedAuctions[t];if(n){if(this.trackableAuctions[t])return this.logError("Auction is already promoted to trackable",{auction:this.trackableAuctions[t]});this.trackableAuctions[t]=n,delete this.stagedAuctions[t],this.logDebug("Auction promoted to trackable",{auctionId:t,trackableAuctions:this.trackableAuctions})}}trackEligibleAuctions(){if(this.trackAuctionsInterval)return;this.trackAuctionsInterval=(0,d.PQ)((async()=>{if(!this.trackAuctionsInterval)return;this.trackAuctionsInterval=null;const e=this.trackableAuctions;this.trackableAuctions={},await this.trackPrebidAuctions(e),await this.storeAuctionsAsUnprocessed(this.stagedAuctions,{debounced:!1})}),{timeout:5e3})}async trackPrebidAuctions(e,t){const n=(0,d.qh)(e).map((e=>{let[t,n]=e;return{...n,auction_id:t}}));n.length&&(await this.permutive.track("PrebidAuctions",this.makePrebidAuctionProperties({auctions:n}),t),this.logDebug("Tracked auctions",{auctions:n}))}makePrebidAuctionProperties(e){return{aggregations:e,isp_info:"$ip_isp_info",geo_info:"$ip_geo_info"}}getStagedAuction(e){return(0,a.zG)(this.stagedAuctions[e],s.DT(Boolean,(()=>new Error("Staged auction not found"))),s.Vn((t=>(this.logError(t,{auctionId:e}),t))))}getTrackableAuction(e){return(0,a.zG)(this.trackableAuctions[e],s.DT(Boolean,(()=>new Error("Trackable auction not found"))),s.Vn((t=>(this.logError(t,{auctionId:e}),t))))}reportError(e){return this.api.reportError(`${this.prefix} ${e}`)}logInfo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.log(this.prefix,...t)}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(this.prefix,...t)}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(this.prefix,...t)}}const m="clean_room",h=e=>{(0,r.Hn)(m)("auto_init",!1)&&e.q.push({functionName:"addon",arguments:[m,{}]})};class v extends g{}},3992:(e,t,n)=>{n.d(t,{GL:()=>a,HJ:()=>u,N1:()=>l,NC:()=>r,RP:()=>i,SF:()=>d,UM:()=>c,ho:()=>p,iE:()=>f});const r=performance.now(),i=(new Date).getTime();let o=[],s=!1;const a=e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return u((()=>e(...n)))},u=(e,t)=>{if(!s){const n=self.setTimeout(e,t);return()=>self.clearTimeout(n)}let n;const r=()=>{void 0!==n&&s&&o.length<1e4&&o.push([n,performance.now()]),n=void 0},i=[self.setTimeout((()=>{n=performance.now(),self.requestAnimationFrame(r),e()}),t),self.setTimeout(r,t)];return()=>{void 0===n&&i.forEach((e=>self.clearTimeout(e)))}},c=(e,t)=>{if(!s){const n=self.setInterval(e,t);return()=>self.clearInterval(n)}let n=!1,r=()=>{};const i=self.setInterval((()=>{r=u((()=>{n||e()}))}),t);return()=>{n=!0,r(),self.clearInterval(i)}},l=e=>()=>{return t=e(),new Promise(((e,n)=>t.then(a(e),a(n))));var t},d=e=>{const t=l(e);return()=>new Promise((e=>u((()=>e(t())))))},f=()=>{const e=o;return o=[],e},p=e=>{s=e}},2851:(e,t,n)=>{n.d(t,{ap:()=>y,a9:()=>v,Ue:()=>g,gS:()=>m,D8:()=>G,VS:()=>w,xH:()=>I,En:()=>h,p4:()=>P,UI:()=>b,Rp:()=>k,vP:()=>E,bw:()=>U,YP:()=>_});var r=n(2688),i=n(365),o=n(3735),s=n(2884),a=n(3328),u=n(2652);function c(e){let t=e,n=[],r=!1;return{addListener(e){if(r)return()=>{};let i=t;const o=()=>{Object.is(t,i)||(i=t,e(t))};n=[...n,o];return()=>{n=n.filter((e=>e!==o))}},notify(e){if(r)throw new Error("Ref bug: Attempted to notify a terminated notifier");Object.is(e,t)||(t=e,n.forEach((e=>e())))},terminate(){r=!0,n=[]}}}function l(e,t){let n=0;return function(){try{if(n++>0)throw new Error(e);return t(...arguments)}finally{n--}}}function d(e,t){let n=[...new Set(e)].filter((e=>"final"!==e.state));if(0===n.length)return{state:"final",onStateChange:()=>()=>{}};const r=()=>0===n.length?"final":n.some((e=>"might_change"===e.state))?"might_change":"nominal",[i,o]=f(r(),(e=>"might_change"!==e&&t())),s=()=>o(r());return n.forEach((t=>{t.onStateChange((t=>{switch(t){case"final":n=e.filter((e=>"final"!==e.state)),s();break;case"might_change":o("might_change");break;case"nominal":s();break;default:throw new Error(`Ref bug: Invalid state ${t}`)}}))})),i}function f(e,t){if("final"===e)return[{state:"final",onStateChange:()=>()=>{}},()=>{}];const{terminate:n,notify:r,addListener:i}=c(e),o={state:e,onStateChange:i},s=l("Disallowed recursion in Branch.",(e=>{if("final"===o.state){if("final"===e)return;throw new Error(`Attempted to change state of final branch to ${e}.`)}try{null==t||t(e),o.state=e,r(e)}finally{"final"===e&&n()}}));return[o,s]}var p=n(6392);function g(e){const[t,n,r]=function(){const[e,t]=f("nominal"),n=l("Disallowed recursion in Branch.",(n=>{if("final"===e.state)throw new Error("Attempted to mutate a finalized Ref.");const r=e.state;try{t("might_change"),n()}finally{t(r)}}));return[e,n,()=>t("final")]}(),[i,o]=D(t,e);return[i,e=>n((()=>o(e))),r]}function m(e){let t=e.empty;const n=()=>()=>{const n=t;return t=e.empty,n},[r,i,o]=g(n());return[r,r=>{t=e.concat(t,r),i(n())},o]}function h(e,t){return n=>{let r=new Array(e).fill(t.empty);return new Array(e).fill(null).map(((e,i)=>(0,o.zG)(n,b(p.UI((e=>{const n=t.concat(r[i],e);return r=r.map(((n,r)=>r===i?t.empty:t.concat(n,e))),n}))))))}}function v(e){return{get current(){return e},onChange:()=>()=>{},branch:{state:"final",onStateChange:()=>()=>{}}}}function _(e){return t=>{const n=t.onChange(e);return e(t.current),n}}function b(e,t){if(t){const[n,r]=D(t.branch,e(t.current));return t.onChange((t=>r(e(t)))),n}return t=>b(e,t)}const y=e=>w((t=>b(t)(e)));function w(e,t){return t?I(b(e,t)):t=>I(b(e,t))}function I(e){if("final"===e.branch.state)return e.current;const[t,n]=function(e,t){let n=t;const r=[e.state,n.state].includes("might_change")?"might_change":"nominal",[i,o]=f(r),s=e=>t=>{switch(t){case"final":o(e().state);break;case"might_change":o("might_change");break;case"nominal":"might_change"===e().state?o("might_change"):o("nominal");break;default:throw new Error(`Ref bug: Unexpected upstream state ${t}`)}};e.onStateChange(s((()=>n)));const a=s((()=>e));let u=n.onStateChange(a);return[i,e=>{n=e,u(),u=e.onStateChange(a),a(n.state)}]}(e.branch,e.current.branch),[r,i]=D(t,e.current.current);let o=e.current.onChange(i);return e.onChange((e=>{o(),o=e.onChange(i),n(e.branch),i(e.current)})),r}function k(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{if(2===t.length){let n=t[0];return b((e=>(n=t[1](n,e),n)),e)}let n=s.bM();return b((e=>{const r=t[0](n,e);return n=s.G(r),r}),e)}}function E(){if(0===arguments.length||z(arguments.length<=0?void 0:arguments[0]))return S(...arguments);const e=arguments.length<=0?void 0:arguments[0],t=Object.keys(e);return(0,o.zG)(Object.values(e),(e=>S(...e)),b((0,o.ls)(a.Su(((e,n)=>[t[e],n])),Object.fromEntries)))}function S(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return v([]);if(1===t.length)return b((e=>[e]))(t[0]);let r=!1;t.forEach((e=>e.onChange((()=>{if("might_change"!==e.branch.state)throw new Error("Ref bug: Received a change notification without a `might_change` state.");r=!0}))));const i=t.map((0,u.vg)("branch")),o=()=>{r&&(r=!1,c(t.map((e=>e.current))))},s=d(i,o),[a,c]=D(s,t.map((e=>e.current)));return a}function P(e){const[t,n,a]=g(s.YP);return e.then(i.F2).catch((0,o.ls)(r.w,i.t$)).then((0,o.ls)(s.G,n,a)),t}function G(e){const t=e.hasOwnProperty("equals")?e.equals:e;return function(e){return t=>{if("final"===t.branch.state)return t;let n=s.YP;return b((t=>{if(s.Wi(n))return n=s.G(t),t;const r=e(n.value,t);return n=s.G(r),r}),t)}}(((e,n)=>t(e,n)?e:n))}function U(e){return t=>(_(e)(t),t)}function D(e,t){if("final"===e.state)return[v(t),()=>{}];const n=c(t);e.onStateChange((e=>{"final"===e&&n.terminate()}));let r=t;return[{get current(){return r},onChange:n.addListener,branch:e},l("Disallowed recursion in Ref.",(e=>{r=e,n.notify(r)}))]}function z(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"function"==typeof e.onChange}},2116:(e,t,n)=>{n.d(t,{K4:()=>a,UI:()=>l,ak:()=>p,bw:()=>d,dQ:()=>u,of:()=>c,vP:()=>f});var r=n(2851),i=n(3735),o=n(2652),s=n(4923);const a=e=>(0,i.ls)((t=>{let{previousState:n,...r}=t;return e(r)}),(e=>({value:e,state:r.a9(void 0)}))),u=i.yR,c=(0,i.ls)(i.a9,a),l=e=>t=>(0,i.ls)(t,(0,o.rO)({value:e})),d=e=>t=>(0,i.ls)(t,(0,o.rO)({value:(0,o.bw)(e)}));function f(e){return t=>{let{previousState:n,...o}=t;const a=m(n)?n:{},u=(0,i.zG)(e,s.Su(((e,t)=>t({previousState:a[e],...o}))));return{value:(0,i.zG)(u,s.UI((e=>e.value))),state:(0,i.zG)(u,s.UI((e=>e.state)),(e=>r.vP(e)))}}}function p(e,t){return n=>(0,i.ls)((0,o.rO)({previousState:g}),(o=>{const s=n(o),a=t(s.value)({...o,previousState:o.previousState[e]});return{value:(0,i.zG)([s.value,a.value],(t=>{let[n,r]=t;if(!m(n))throw new Error("Service.bind() was passed an upstream Service with a non-record value.");return{...n,[e]:r}})),state:(0,i.zG)(r.vP(s.state,a.state),r.UI((t=>{let[n,r]=t;if(void 0===n)return{[e]:r};if(!m(n))throw new Error("Service.bind() was passed an upstream Service with a non-record state.");return{...n,[e]:r}})))}}))}function g(e){return m(e)?e:{}}function m(e){return"object"==typeof e&&null!==e}},6967:(e,t,n)=>{n(2497)},8612:(e,t,n)=>{n.d(t,{lg:()=>g,Bt:()=>h});var r=n(5851),i=n(3735),o=n(2884),s=n(2751),a=n(2652);class u{userId;network;api;logger;constructor(e,t,n,r){this.userId=e,this.network=t,this.api=n,this.logger=r}tag="appnexus";ttlInSeconds=86400;usedForThirdPartyData=!0;url="https://ib.adnxs.com/getuidj";invalidAliases=["","0","-1"];getId(){return this.logger.debug("identities[appnexus]: start HTTP request"),(0,a.G6)(navigator.userAgent)?Promise.resolve({type:"skipped"}):this.api.appnexus(this.url).then((e=>(this.logger.debug("identities[appnexus]: end HTTP request"),{type:"attempted",result:(0,i.zG)((0,o.DT)((e=>this.isValidAlias(e.uid)))(e),(0,o.UI)((e=>e.uid)))})),(e=>({type:"attempted",result:o.YP})))}reset(){return Promise.resolve()}isValidAlias(e){return!!e&&-1===this.invalidAliases.indexOf(e)}}var c=n(2851),l=n(4923),d=n(2197),f=n(365);const p=d.ff((e=>void 0===e));class g{metrics;trace;permutiveData;identityProviderEnv;logger;ref;setReady;thirdParty;rawRef;identityMapRef;setIdentityMap;providers={};static emailSHA256Regex=/^[a-f0-9]{64}$/;constructor(e,t,n,r,u){this.metrics=e,this.trace=t,this.permutiveData=n,this.identityProviderEnv=r,this.logger=u;const d=this.getCachedIdentitiesAndMigrateIfRequired(),[f,g]=c.Ue(d);this.identityMapRef=f,this.setIdentityMap=g,f.onChange((0,i.ls)(l.z7((e=>!m.has(e))),(0,a.bw)((e=>{this.logger.debug("[identities] Persisting",e),this.permutiveData.setData("identities",e)})))),this.rawRef=(0,i.zG)(f,c.UI((0,i.ls)(l.UI((e=>e.value)),l.hX(p))),c.D8(l.Eh(s.Eq)));const[h,v]=c.Ue(!1);this.ref=(0,i.zG)(c.vP(h,this.rawRef),c.UI((e=>{let[t,n]=e;return(0,i.zG)(n,(0,o.DT)((()=>t)))}))),this.setReady=()=>{e.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"identity_ready",time_origin:"sdk_init"}),v(!0)},this.thirdParty=this.prepareThirdPartyIdentities()}get identities(){return this.identityMapRef.current}prepareThirdPartyIdentities(){this.logger.debug("[Identities]","loading 3rd party identities");const e=this.metrics.startTimer("sdk_get_third_party_identities_task_duration_seconds",{}),t=this.trace.startSpan("load_tpd_ids"),n=[{load:e=>(e.config,e.network,e.api,e.userId,e.logger,o.YP)},{load:e=>{return t=e.userId,n=e.network,r=e.api,i=e.logger,(0,o.G)(new u(t,n,r,i));var t,n,r,i}},{load:e=>(e.cookies,e.messages,o.YP)},{load:e=>(e.cookies,o.YP)},{load:e=>(e.metrics,e.permutiveData,e.permutive,e.messages,o.YP)}],s=(0,r.oA)(n.map((e=>e.load(this.identityProviderEnv)))).map((e=>this.shouldAskForNewIdentity(e)?this.retrieveIdentity(e):Promise.resolve((0,i.bc)(e,this.getCachedTPDIdentity(e.tag)))));return Promise.all(s).then((e=>e.map((e=>{let[t,n]=e;return this.providers[t.tag]=t,this.mapTPDIdentityIfPresent(t.tag,n,t.ttlInSeconds)})))).then((e=>this.setIdentities(e))).then((0,a.bw)((()=>{this.metrics.stopTimer("sdk_get_third_party_identities_task_duration_seconds",e),t.finish()})))}getPrioritizedIdentities(e){const t={default:0,appnexus:1},n=Object.entries(e).map((e=>{let[t,{id:n,expiry:r,priority:i}]=e;return{tag:t,...n?{id:n}:{},...r?{expiry:r}:{},...void 0!==i?{priority:i}:{}}})),i=n.filter((e=>((e,t)=>!!e.id&&!(0,r.t9)(s.Eq)(e.tag,t))(e,Object.values(this.providers).map((e=>e.tag))))),a=n.filter((e=>((e,t)=>!!e.id&&!!(0,r.t9)(s.Eq)(e.tag,t))(e,Object.values(this.providers).map((e=>e.tag))))),u=(0,r.DZ)((e=>(0,o.ij)(e.priority)))(i),c=u.length>0?Math.max(...u):0,l=i.map((e=>void 0!==e.priority?{...e,priority:e.priority}:{...e,priority:c+1})),d=a.map((e=>void 0===t[e.tag]?{tag:e.tag,id:e.id,priority:c+v}:{tag:e.tag,id:e.id,priority:c+_}));return l.concat(d)}getIdentitiesMap(){return this.getFilteredIdentities(((e,t)=>!!t.value))}parseCustomerDefinedIdentities(e){const t=`Identify must be passed a non-empty string or list of { tag, id, priority? } tuples, value passed was '${JSON.stringify(e)}'`,n=e=>"string"==typeof e.id&&"string"==typeof e.tag,o=e=>"email_sha256"!==e.tag||g.emailSHA256Regex.test(e.id);return"string"==typeof e?(a=e).length>0?{left:[],right:[{id:a,tag:"default"}]}:{left:[t],right:[]}:Array.isArray(e)?(s=e,(0,i.zG)(s,r.tV((0,i.ls)(f.DT(n,(()=>t)),f.Y$(o,(()=>"Identify called with unsupported format of email_sha256 ID. The support format is hex-encoded 64 character long lowercase string.")))))):{left:[t],right:[]};var s,a}extractIdentifyFromQueue(e){let{global:t}=e;const n=()=>t.q.findIndex((e=>"identify"===e.functionName)),r=(e,i)=>{if(e<0)return i;const o=t.q.splice(e,1)[0],s=this.parseCustomerDefinedIdentities(o.arguments[0]);return r(n(),{left:i.left.concat(s.left),right:i.right.concat(s.right)})},{left:i,right:o}=r(n(),{left:[],right:[]});return i.forEach((e=>this.logger.warn("Invalid identity provided during init",e))),o}setIdentities(e){const t=e.reduce(((e,t)=>{let{tag:n,id:r,expiry:i,priority:o}=t;return void 0===this.identities[n]&&this.logger.debug(`identities[${n}]: added`),e[n]={...r?{value:r}:{},...i?{expiry:i}:{},...void 0!==o?{priority:o}:{}},e}),{}),n=this.rawRef.current;this.setIdentityMap({...this.identities,...t});const r=this.rawRef.current;return{identifyRequestRequired:()=>!l.xb(r)&&!l.Eh(s.Eq).equals(n,r)}}async reset(){this.setIdentityMap({}),await Promise.all(Object.values(this.providers).map((e=>e.reset())))}getFilteredIdentities(e){return(0,a.m8)(...Object.entries(this.identities).filter((t=>{let[n,r]=t;return e(n,r)})).map((e=>{let[t,{value:n,expiry:r,priority:o}]=e;return(0,i.bc)(t,{id:n,...r?{expiry:r}:{},...void 0!==o?{priority:o}:{}})})))}shouldAskForNewIdentity(e){var t;const n=(0,o.ij)(null===(t=this.identities)||void 0===t?void 0:t[e.tag]);return(0,o.g_)((()=>!0),this.isIdentityExpired)(n)}getCachedTPDIdentity(e){return this.identities[e]?(0,o.ij)(this.identities[e].value):o.YP}mapTPDIdentityIfPresent(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:86400;const r=()=>Date.now()+Math.floor(1e3*n);return(0,o.g_)((()=>({tag:e,expiry:r()})),(t=>({tag:e,id:t,expiry:r()})))(t)}retrieveIdentity(e){return e.getId().then((t=>"skipped"===t.type?(0,i.bc)(e,o.YP):(0,i.zG)(t.result,(t=>this.metrics.track({name:(0,o.pC)(t)?"sdk_third_party_identity_present_count":"sdk_third_party_identity_missing_count",value:1,labels:{identity_tag:e.tag}})),(n=>(0,i.bc)(e,t.result)))))}isIdentityExpired(e){return"number"==typeof e.expiry&&Date.now()>=e.expiry}getCachedIdentitiesAndMigrateIfRequired(){return(e=>(0,a.m8)(...Object.entries(e).filter((e=>{let[t,n]=e;return!this.isIdentityExpired(n)&&!m.has(t)}))))(this.permutiveData.getData("identities")||{})}}const m=new Set(["public","email","email_md5","email_sha256","ip_address"]),h=(e,t,n,i,o)=>{const a=(e,t)=>{const n=["(null)"];return n.indexOf(e)>-1||!!y[e]||(0,r.jV)(s.Eq)(t,n).length>0},u=e=>"721d6d85-35f0-4e35-bb38-13eb0d465158"===e,c={"be668577-07f5-444d-98e0-222b990951b1":a,"e43c8a90-d17b-4790-bfda-81b069b3b8c2":(e,t,n)=>["thestudentroom.co.uk"].some((e=>n.indexOf(e)>-1))&&(0,r.jV)(s.Eq)(t,["tsr-"]).length>0,"5d79bce7-5d2b-427e-a6c4-b89b6c7bf048":a,"366ab8da-5efa-4355-ab00-84db3b68ded2":e=>"96539955-4d7e-40df-882b-7e2fbacedb1c"===e||"345600e7-fb5f-48b1-9aa6-cde5396419b0"===e,"f3a06674-ebb9-4b9d-ba8f-0052018c0687":u,"38dadd0d-257a-4641-b332-b8b0fd20a6cb":u,"10453011-272d-49cd-9043-1964fdb36fd8":e=>"936ba6ac-9a8b-454d-ba98-facebd7553fe"===e},l={"fe68d1f7-c9f4-45b3-8905-7cda73d3fd74":e=>!!b[e]},d=c[e]||l[t];return!!d&&d(o,n,i)},v=2,_=3,b={},y={}},7658:(e,t,n)=>{n.d(t,{z:()=>r});class r{ingestIfEligible(e){return Promise.resolve()}}},922:(e,t,n)=>{n.d(t,{CL:()=>a,EW:()=>u,PH:()=>s,eV:()=>i,jH:()=>c,t2:()=>o});var r=n(9853);const i=(0,r.MU)("track_form_submission",!0),o=((0,r.MU)("track_pageview_complete",!0),(0,r.MU)("track_pageview_engagement",!0)),s=((0,r.$S)("sync_segments_cookie",!1),(0,r.$S)("track_slot_clicked",!0)),a=(0,r.$S)("track_slot_rendered",!0),u=(0,r.$S)("track_slot_viewable",!1),c=(0,r.$S)("track_targeting_keys",!1)},8975:(e,t,n)=>{n.d(t,{v:()=>s});class r{logger;permutive;id;segmentCode;triggerType;config;workspaceLevelConfig;prefix="[Activation]";constructor(e,t,n,r,i,o,s){this.logger=e,this.permutive=t,this.id=n,this.segmentCode=r,this.triggerType=i,this.config=o,this.workspaceLevelConfig=s}getSegmentCode(){return this.segmentCode}getTriggerType(){return this.triggerType}getConfig(){return this.config}getWorkspaceLevelConfig(){return this.workspaceLevelConfig}trackImpression(e){return this.trackActivation("impression",e)}trackConversion(e){return this.trackActivation("conversion",e)}trackActivation(e,t){const n={reaction_id:this.id,type:e};this.permutive.track("Reaction",n,t),this.logger.log(this.prefix,n.type,n)}}var i=n(9853);const o={dfp:{dfp:[178089,180643,180644,180716,184424,184423,184619,185436,185437,184485,187070],dfp_legacy:{}},eyeota_pixel:[],dbm:{omitted:0},appnexus:{},appnexus_adserver:[],nativo:[],rubicon_ssp:[],smart:[],freewheel:[]};class s{logger;permutive;clientContext;constructor(e,t,n){this.logger=e,this.permutive=t,this.clientContext=n}getSpecializedActivations(e){return o[e]}getActivations(e){return(0,i.Hn)(e)("activationConfigs",[]).filter((e=>this.areContextCriteriaSatisfied(e))).map((e=>new r(this.logger,this.permutive,e.id,e.sc,e.tt,e.c,e.wc)))}areContextCriteriaSatisfied(e){const t=e.cc,n=e=>{const t=this.clientContext.getContext()[e.key];switch(e.comparison){case"EQUALS":return t===e.value;case"NOT_EQUALS":return t!==e.value;case"CONTAINS":return"string"==typeof t&&t.indexOf(e.value)>=0;case"NOT_CONTAINS":return"string"==typeof t&&t.indexOf(e.value)<0}};return!t||("AND"===(r=t).operator?r.criteria.every(n):r.criteria.some(n));var r}}},9853:(e,t,n)=>{n.d(t,{$S:()=>s,Hn:()=>i,MU:()=>o});const r={brightcove:{auto_init:!1,activationConfigs:[]},scriptrunner:{auto_init:!0,activationConfigs:[]},clean_room:{auto_init:!0,cohort_ssp_config:[],activationConfigs:[]},dfp:{auto_init:!0,track_slot_rendered:!1,track_slot_viewable:!0,track_slot_clicked:!0,activationConfigs:[]},prebid:{auto_init:!0,revenue_insights_enabled:!0,data_provider_config:{ac_bidders:[]},activationConfigs:[]},web:{auto_init:!1,track_pageview_engagement:!0,track_form_submission:!1,track_link_click:!0,track_pageview_complete:!0,add_alchemy_taxonomy:!1,add_alchemy_entities:!1,engagement_edge_only:!0,segment_transition_edge_only:!0,activationConfigs:[]}},i=e=>{const t=r[e];return(e,n)=>(null==t?void 0:t[e])??n},o=i("web"),s=i("dfp");i("facebook_pixel_v2")},2836:(e,t,n)=>{n.d(t,{z:()=>o,k:()=>s});var r=n(3030);class i{context;constructor(e){this.context=e}getContext(){return this.context}updateContext(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach((e=>{let[t,n]=e;this.context[t]=n}))}}class o extends i{constructor(e){super(e)}getClient(){return Promise.resolve(s())}}const s=()=>{const e="PermutiveWebSDK/v20.11.0";return{type:"web",user_agent:navigator.userAgent?`${navigator.userAgent} ${e}`:e,url:(0,r.bk)(window.location.href),domain:window.location.hostname||"",title:document.title,referrer:(0,r.bk)(document.referrer)}}},1568:(e,t,n)=>{n.d(t,{J:()=>u});var r=n(3735),i=n(2884),o=n(7554);const s=e=>t=>class extends t{key=e;put(e){return this.db.then((t=>t.put(e,this.key))).then(r.Q1)}getIfPresent(){return this.db.then((e=>e.get(this.key))).then(i.ij)}reset(){return this.db.then((e=>e.delete(this.key)))}},a=e=>(0,r.zG)(class{db;constructor(e){this.db=Promise.resolve((0,o.E)(e.namespace,e.logger,e.consent))}},s(e));class u extends(a("permutive-unprocessed-pba")){constructor(e){super(e)}}},5700:(e,t,n)=>{n.d(t,{LP:()=>o,dG:()=>r,eP:()=>i});const r=4096,i=`Cookie exceeds maximum supported size of ${r} bytes for most browsers.`,o="Cookie is missing required parameters."},5619:(e,t,n)=>{n.d(t,{Eq:()=>d,X:()=>f,b:()=>l});var r=n(2851),i=n(2116),o=n(4268),s=n(2751),a=n(4011),u=n(3735),c=n(2884);const l=()=>({continent:void 0,environment:"",events_count:0,os:"",sample_rate:0,sdk_version:"",segments_count:0,session_count:0,session_init_count:0,session_view_count:0,user_agent:""}),d=o.n_({continent:{equals:(e,t)=>e===t},environment:s.Eq,events_count:a.Eq,os:s.Eq,sample_rate:a.Eq,sdk_version:s.Eq,segments_count:a.Eq,session_count:a.Eq,session_init_count:a.Eq,session_view_count:a.Eq,user_agent:s.Eq}),f=e=>{const t=g(e.userId),n=(0,u.zG)(r.vP(e.userId,e.sessionId),r.UI((e=>{let[t,n]=e;return`${t},${n}`})),g),o=String(Math.random()),s=(0,u.zG)(e.sdkVariant,c.UI((e=>`-${e}`)),c.fS((()=>""))),a={environment:"web",events_count:0,os:p(window.navigator.userAgent||""),sample_rate:e.sampleRate,sdk_version:"v20.11.0"+s,segments_count:0,user_agent:window.navigator.userAgent||""};return(0,u.zG)(i.vP({session_count:t(e.sessionId),session_init_count:n(r.a9(o)),session_view_count:n(e.viewId)}),i.UI((0,u.ls)((t=>r.vP({...t,continent:(0,u.zG)(e.continent,r.UI(c.FS))})),r.UI((e=>({...a,...e}))))))},p=e=>{const t=e.toLowerCase();return t.includes("windows")?"windows":t.includes("iphone")||t.includes("ipad")?"ios":t.includes("android")?"android":t.includes("macintosh")?"macos":t.includes("linux")?"linux":"unknown"},g=e=>t=>i.dQ((n=>{let{previousState:i}=n;const c=(0,u.zG)(r.vP(e,t),r.Rp(function(e){if(null!==e&&"object"==typeof e&&"scope"in e&&"lastValue"in e&&"count"in e)return e;return{scope:"",lastValue:"",count:1}}(i),((e,t)=>{let[n,r]=t;return{scope:n,lastValue:r,count:n!==e.scope?1:r!==e.lastValue?e.count+1:e.count}})),r.D8(o.n_({scope:s.Eq,lastValue:s.Eq,count:a.Eq})));return{state:c,value:(0,u.zG)(c,r.UI((e=>e.count)))}}))},6478:(e,t,n)=>{n.d(t,{p:()=>f});var r=n(2688),i=n(3735),o=n(2652),s=n(5619),a=n(2851),u=n(3328),c=n(2707),l=n(7407),d=n(3992);const f=e=>{let t=e.context.current;(0,i.zG)(e.context,a.D8(s.Eq),a.Rp((0,i.bc)(s.b(),s.b()),((e,t)=>{let[,n]=e;return(0,i.bc)(n,t)})),(e=>e.onChange((e=>{let[n,r]=e;s.Eq.equals({...n,continent:void 0},{...r,continent:void 0})||p({beacon:!1}),t=r}))));const n="[Metrics Reporter]";let f=!0;const p=async o=>{let{beacon:s}=o;const a=t,d=(0,i.zG)(c.of(e.metrics.consume()),c.Y$((()=>f),(()=>{})),c.tS(u.EQ((()=>c.of(void 0)),(t=>c.Y3((()=>(async(t,n)=>{if(!t)return e.api.metrics(n);if(!e.api.metricsBeacon(n))throw new Error("Failed to send beacon.")})(s,{context:a,items:t})),(i=>{f=!1,function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e.logger.error(n,...r)}(`Failed to publish metrics ${(0,r.w)(i).message}`,t)}))))),l.UI(i.Q1));return d()},g=()=>{(0,d.HJ)((()=>p({beacon:!1}).finally((()=>g()))),5e3)};g(),(0,o.Bf)((()=>p({beacon:!0})),{capture:!1})}},7575:(e,t,n)=>{n.d(t,{u:()=>r});class r{trace;metrics;messages;_isRealtime=!1;_isReady=!1;constructor(e,t,n){this.trace=e,this.metrics=t,this.messages=n}isRealtime(){return this._isRealtime}isReady(){return this._isReady}setAsRealtime(e){const t=performance.now();this._isRealtime=!0,this.trace.measureSinceInit("sdk_realtime").finish(),this.messages.emit("permutive:realtime"),this.metrics.trackTimeSinceInit("sdk_realtime_targeting_set_task_duration_seconds",{},t),this.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"sdk_realtime",time_origin:"sdk_init"},t),this.metrics.track({name:"sdk_user_segments_count",value:e,labels:{}})}setAsReady(){const e=performance.now();this._isReady=!0,this.trace.measureSinceInit("sdk_ready").finish(),this.messages.emit("permutive:ready"),this.metrics.trackTimeSinceInit("sdk_initialisation_task_duration_seconds",{},e),this.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"sdk_ready",time_origin:"sdk_init"},e),window.performance&&window.performance.memory&&(this.metrics.track({name:"sdk_heap_memory_bytes_used",value:window.performance.memory.usedJSHeapSize,labels:{}}),this.metrics.track({name:"sdk_heap_memory_limit_fraction_used",value:window.performance.memory.usedJSHeapSize/window.performance.memory.jsHeapSizeLimit,labels:{}}))}}},3898:(e,t,n)=>{n.d(t,{a:()=>b});var r=n(3735),i=n(4923),o=n(2751),s=(n(5605),i.dp,i.xb,function(e){return function(t){return Object.keys(t).sort(e.compare)}}),a=s(o.Df);i.dx,i.e$;i.Bu,i.P5,i.Su,i.UI;i.ri;function u(e){return i.vP(e)}i._r;i.jt;i.yW,i.G,i.t9;var c=i.HA,l=(i.nn,i.kp),d=i.CC,f=i.RF,p=(i.I8,i.mS,i.RJ,i._Y,i.V_),g=i.EW,m=i.nu,h=(i.SW,i.zV,i.Ub,i.vA,i.qS),v=(i.mK,function(e){return function(t){var n=s(e);return function(e,r){var i=n(e);if(0===i.length)return t.of({});for(var o=t.of({}),s=function(n){o=t.ap(t.map(o,(function(e){return function(t){return e[n]=t,e}})),r(n,e[n]))},a=0,u=i;a<u.length;a++){s(u[a])}return o}}});i.hX,i.DZ,i.uK,i.tV;i.oA,i.oh;var _="Record";i.Eh,i.uZ,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,i.nr,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df,o.Df;class b{config;localStorage;logger;permutiveData;cookies;externalData;constructor(e,t,n,r,i,o){this.config=e,this.localStorage=t,this.logger=n,this.permutiveData=r,this.cookies=i,this.externalData=o}async reset(){return this.logger.log("Resetting State"),(0,r.zG)(this.cookies.deleteCookie(this.config.cookieName),(e=>this.externalData.removeExternalData(this.config.cookieName)),(e=>a({_paols:!0,_papns:!0,_pcrdbs:!0,_pcrprs:!0,_pdfps:!0,_pfws:!0,_pnativo:!0,_prps:!0,_prubicons:!0,_psegs:!0,_psmart:!0,"permutive-id":!0,"permutive-loaded":!0,"permutive-prebid-rtd":!0,"permutive-events-cache":!0,_pssps:!0,_ppsts:!0}).forEach((e=>this.externalData.removeExternalData(e)))),(e=>this.permutiveData.reset()),(e=>Promise.all([this.localStorage.delete(this.config.permutiveDataMiscKey),this.localStorage.delete(this.config.permutiveDataQueriesKey)])),r.Q1)}}},7274:(e,t,n)=>{n.d(t,{u:()=>r});class r{permutiveData;permutiveReset;userId;viewId;logger;constructor(e,t,n,r,i){this.permutiveData=e,this.permutiveReset=t,this.userId=n,this.viewId=r,this.logger=i}getPermutiveData(e){return this.permutiveData.getData(e)}setPermutiveData(e,t){return this.permutiveData.setData(e,t)}getStateSizeInBytes(){return this.logger.warn("getStateSizeInBytes needs to be updated to reflect new event persistence"),this.permutiveData.getDataSize()}reset(){return this.permutiveReset.reset()}}},9880:(e,t,n)=>{n.d(t,{W:()=>r});class r{ref;constructor(e){this.ref=e}get(){return this.ref.current}}},7554:(e,t,n)=>{n.d(t,{E:()=>i});var r=n(8259);const i=(e,t,n)=>{const i=window.localStorage;return(0,r.rK)(i,"[Local Storage]",e,t,n)}},9332:(e,t,n)=>{n.d(t,{u:()=>i});n(2233);var r=n(8259);const i=(e,t,n)=>{const i=window.sessionStorage;return(0,r.rK)(i,"[Session Storage]",e,t,n)}},8259:(e,t,n)=>{n.d(t,{oP:()=>u,rK:()=>d});var r=n(2688),i=n(787),o=n(365),s=n(3735),a=n(4769);class u{storage;namespace;constructor(e,t){this.storage=e,this.namespace=t}async put(e,t){const n=this.namespace.getNamespacedStorageKey(t.toString());return this.storage.setItem(n,JSON.stringify(e)),t}async get(e){const t=this.namespace.getNamespacedStorageKey(e.toString()),n=this.storage.getItem(t);return null===n?null:(0,i.A)(n)}async delete(e){const t=this.namespace.getNamespacedStorageKey(e.toString());this.storage.removeItem(t)}async deleteStore(){}}const c=e=>{const{logger:t,consent:n,prefix:r}=e,i=(e,n)=>(t.debug(`${r} Failed to write ${String(n)} as consent is revoked`),Promise.resolve(n));return e=>class extends e{put=(0,a.v)(super.put.bind(this),i,(()=>!n.current))}},l=e=>{const{logger:t,prefix:n,storage:i}=e;return e=>class extends e{isSupported=null;isStorageSupported(){return null!==this.isSupported||(this.isSupported=o.Y3((()=>{const e="_permutive_ls_test";return i.setItem(e,e),i.getItem(e),i.removeItem(e),!0}),r.w),(0,s.zG)(this.isSupported,o.EQ((e=>{t.warn(`${n} Is NOT supported`,e)}),(()=>{t.debug(`${n} Is supported`)})))),this.isSupported}async put(e,t){return(0,s.zG)(this.isStorageSupported(),o.EQ((e=>{throw e}),(()=>super.put(e,t))))}async get(e){return(0,s.zG)(this.isStorageSupported(),o.EQ((()=>null),(()=>super.get(e))))}async delete(e){return(0,s.zG)(this.isStorageSupported(),o.EQ(s.Q1,(()=>super.delete(e))))}async deleteStore(){return(0,s.zG)(this.isStorageSupported(),o.EQ(s.Q1,(()=>super.deleteStore())))}}},d=(e,t,n,r,i)=>new((0,s.zG)(u,l({logger:r,prefix:t,storage:e}),c({logger:r,consent:i,prefix:t})))(e,n)},2497:(e,t,n)=>{n.d(t,{SD:()=>d});var r=n(2884),i=n(3328),o=n(4923),s=n(3735),a=n(2851),u=n(2652);const c={tradedesk:21,ddp:755,appnexus:32,pubmatic:76,neustar_fabrick:468},l="[TCF]",d=(e,t)=>{const[n,d,p]=(0,s.zG)(a.Ue(r.YP),(e=>{let[n,...i]=e;return[(0,s.zG)(n,a.bw(r.UI((e=>{t.debug(l,`Status "${e.type}"`,e)})))),...i]})),g=e.__tcfapi;if(g){const e=new Set(["tcloaded","useractioncomplete"]);g("addEventListener",2,((n,i)=>{i?"loaded"===n.cmpStatus&&e.has(n.eventStatus)&&(t.debug(l,"TCF API loaded",n),d(r.G({type:"loaded",data:n}))):(t.warn(l,"TCF API failed to register event listener"),d(r.G({type:"aborted"})),p())}))}else t.debug(l,"TCF API missing from the page"),d(r.G({type:"missing"})),p();const[m,h]=(0,s.zG)(a.gS(i.uZ()),(e=>{let[t,n]=e;return[t,(0,s.ls)(i.of,n)]}));return(0,s.zG)(a.vP(n,m),a.bw((e=>{let[n,i]=e;return(0,s.zG)(n,r.UI((e=>{const n=i();switch(t.debug(l,`Processing ${n.length} listeners`,n),e.type){case"missing":n.forEach((n=>{let[r,i]=n;t.debug(l,`Invoking ${r} as TCF API missing`),i(e)}));break;case"aborted":n.forEach((e=>{let[n]=e;t.debug(l,`Invoking ${n} skipped as TCF API aborted`)}));break;case"loaded":n.forEach((n=>{let[i,a]=n;(0,s.zG)(f(e.data),r.EQ((()=>{t.debug(l,`Invoking ${i} as GDPR does not apply`),a(e)}),(n=>(0,s.zG)(c,o.P5(i),r.tS((e=>(0,s.zG)(n,o.P5(e.toString())))),r.UI((n=>{n?(t.debug(l,`${i} has consent`,{vendor:i}),a(e)):t.debug(l,`${i} does not have consent`,{vendor:i})}))))))}))}})))}))),{registerVendorOnValidConsent:(e,t)=>h([e,t]),getStatusOrAbortOnTimeout:e=>new Promise((t=>{const i=setTimeout((()=>t({type:"aborted"})),e);(0,s.zG)(n,a.UI(r.UI((e=>{clearTimeout(i),t(e)}))))})).then((0,u.bw)((e=>t.debug(l,"TCF status resolved as",{status:e}))))}},f=e=>e.gdprApplies?r.G(e.vendor.consents):r.YP},6037:(e,t,n)=>{n.d(t,{C:()=>a});var r=n(5851),i=n(3735);n(7305);const o=(s=[[{name:"dfp",import:Promise.resolve().then(n.bind(n,4388))}],[],[],[],[],[{name:"brightcove",import:Promise.resolve().then(n.bind(n,1522))}],[{name:"clean_room",import:Promise.resolve().then(n.bind(n,6726))}],[],[],[],[],[],[],[],[],[],[],[],[],[{name:"prebid",import:Promise.resolve().then(n.bind(n,9581))}],[],[],[],[],[{name:"scriptrunner",import:Promise.resolve().then(n.bind(n,7416))}],[],[],[],[{name:"web",import:Promise.resolve().then(n.bind(n,4400))}],[],[],[],[]],(0,i.zG)((0,r.xH)(s),(0,r.u4)({},((e,t)=>({...e,[t.name]:t.import})))));var s;const a=e=>{const t=Object.entries(o).map((async t=>{let[n,r]=t;return e.logger.log(`Loading addon ${n}`),(await r).load(e)}));return Promise.all(t)}},1522:(e,t,n)=>{n.r(t),n.d(t,{load:()=>s});var r=n(3992),i=n(8771),o=n(2652);const s=e=>{(function(){function t(e,t,n){let i=0;const o=(0,r.UM)((function(){(e()||i===n)&&o(),i++}),t)}async function n(t){return{userId:e.state.userId.get(),visitId:e.state.viewId.get(),sessionId:e.sessionManager.getSessionId(),client:await e.clientContext.getClient(),segments:t}}async function s(t){const r=e.nextGen.queryLanguageCohorts.all,i=await n(r.current);t.postMessage({type:"Init",data:i},"*"),t.postMessage({type:"permutive:init",data:i},"*"),r.onChange((0,o.Z_)(e.api,e.userId,(async function(e){t.postMessage({type:"permutive:update",data:await n(e)},"*")})))}const a=function(){return"undefined"!=typeof videojs&&(Object.values(videojs.players).filter((e=>!!e)).forEach((e=>e.on("loadedmetadata",(()=>s(window))))),s(window),!0)},u=function(){!function(){const e=document.getElementsByTagName("iframe");if(0===e.length)return;[].slice.call(e).forEach((e=>{var t;if("amp-brightcove"!==(null===(t=e.parentNode)||void 0===t?void 0:t.nodeName.toLowerCase())&&-1!==e.src.indexOf("brightcove")&&e.contentWindow){const{contentWindow:t}=e;s(t),e.addEventListener("load",(()=>s(t)))}}))}(),function(){const e=document.getElementsByTagName("amp-brightcove");if(0===e.length)return;[].slice.call(e).forEach((e=>{t((function(){const t=e.getElementsByTagName("iframe");return!!(t.length>0&&t[0].contentWindow)&&(s(t[0].contentWindow),!0)}),500,10)}))}(),"complete"===document.readyState?a():window.addEventListener("load",(function(){t(a,500,10)}),!1)},c=function(){var t,n;null!==(t=e.state)&&void 0!==t&&null!==(n=t.userId)&&void 0!==n&&n.get()?u():e.messages.on("permutive:user:ready",u)};(0,i.p)((()=>e.extMessages.listen("brightcove-init",c)),"permutive:internals:extMessages:ready",e.messages).catch((t=>e.api.reportError(`Error on brightcove-init. Got ${t.message}`))),c()})()}},9658:(e,t,n)=>{n.r(t),n.d(t,{createAddon:()=>k,getCachedDFPSegments:()=>w});var r=n(2688),i=n(365),o=n(3735),s=n(2884),a=n(3328),u=n(2851),c=n(9853),l=n(2652);const d="_pdfps";n(5700);var f=n(5851),p=n(2751);let g=!1;let m=null;const h=(e,t)=>{const{logger:n}=t;(0,o.zG)(e,s.UI((e=>{!0!==g&&e.pubadsReady&&(m??=r=>{let{slot:i}=r;const{getContentUrl:s}=i;if(!s||"function"!=typeof s)return;(0,o.zG)(s(),(0,p.pn)("&trunc=1"))&&(n.debug("DFP content URL has been truncated!"),(e=>{let{metrics:t,logger:n}=e;g||(t.track({name:"sdk_targeting_size_limit_exceeded_count",value:1,labels:{target:"dfp"}}),g=!0,n.debug("DFP has exceeded targeting limit"))})(t),m&&e.pubads().removeEventListener("slotRenderEnded",m),m=null)},e.pubads().addEventListener("slotRenderEnded",m))})))},v=(e,t,n,r)=>{const{logger:i}=t;h(e,t);(0,o.zG)(e,s.UI((e=>(e=>{e.cmd.push((()=>{const{getTargeting:t,setTargeting:o}=e.pubads(),s=t("permutive")||[],a=Object.values(n.eligibleSegments).map(String).concat(n.allSeenCloudCohorts).concat("rts"),u=(0,f.uK)((e=>a.includes(e))),{left:c}=u(s),l=r.concat(c).concat("rts");i.debug("DFP setting GPT targeting to",l),o("permutive",l)}))})(e))))};var _=n(4388);const b={liveSegments:[],cloudCohorts:[],allSeenCloudCohorts:[],eligibleSegments:{}},y={segments:b,getGAMKeyValues:()=>({permutive:""})},w=e=>e.getExternalJsonData(d)||[],I=(e,t,n)=>{const{logger:i,externalData:o,api:s}=t;let a=n.map(String).concat(b.cloudCohorts);i.debug("DFP is updating with targeting values",a),v(e,t,b,a);try{o.setExternalJsonData(d,a)}catch(e){const t=(0,r.w)(e),n="DFP failed to set data. Got:";i.error(n,t),s.reportError(`${n} ${t.message}`)}return((e,t)=>{let{api:n,logger:r}=e;(0,c.$S)("sync_segments_cookie",!1)?(r.debug("DFP syncing segment cookie _pdfps"),n.segmentSync({key:d,value:t})):r.debug("DFP sync segments cookie not enabled, skipping sync")})(t,JSON.stringify(a)),i.debug("DFP live segments updated to",n),n},k=async e=>{const{api:t,logger:n,activationManager:r,messages:c,externalData:f,nextGenOutput:p,userId:g,cookies:m}=e,h=await(0,l.a4)((()=>window.googletag),(()=>!!window.googletag),{waitTimeInMs:10,maxAttempts:200,exponentialBackOff:!1});s.Wi(h)&&n.error("[DFP]: unable to find google tag script on the page"),(0,o.zG)(h,s.UI((e=>(e=>e.cmd.push((()=>e.pubads().setTargeting("prmtvsdk","web"))))(e))));y.getGAMKeyValues=()=>({...(0,o.zG)((0,_.generateProjectSpecificKVs)(e),i.Vn((e=>{var n;return n=e,t.reportError(`[DFP] ${n}`,g.get()),e})),i.fS((()=>({})))),permutive:y.segments.liveSegments.join(",")}),b.eligibleSegments=(e=>{const t=e.getSpecializedActivations("dfp"),n={};for(const e of t.dfp)n[e]=e;for(const e of Object.keys(t.dfp_legacy)){const r=Number(e);n[r]=t.dfp_legacy[r]}return n})(r);const v=(0,o.zG)(p.queryLanguageCohorts.all,u.UI((e=>(n.debug("DFP received QL segments",{qlSegments:e}),((e,t)=>e.filter((e=>e in t)).map((e=>t[e])))(e,b.eligibleSegments)))),u.D8(l.cO)),w=p.activations.dfp??u.a9(a.bM()),k=(0,o.zG)(w,u.Rp(a.bM(),((e,t)=>[...new Set([...e,...t])])));return(0,o.zG)(u.vP(v,w,k),u.YP((0,l.Z_)(t,g,(t=>{let[r,i,o]=t;n.debug("DFP received updated cohorts",{filteredQlSegments:r,cloudCohorts:i}),b.cloudCohorts=i,b.allSeenCloudCohorts=o,b.liveSegments=I(h,e,r)})))),n.debug("DFP initialised with segments",b),c.on("permutive:reset",(0,l.Z_)(t,g,(()=>{n.debug("DFP received 'permutive:reset' event"),f.removeExternalData(d),m.deleteCookie(d)}))),c.emit("permutive:dfp:ready"),y}},4388:(e,t,n)=>{n.r(t),n.d(t,{generateProjectSpecificKVs:()=>G,load:()=>f});var r=n(2688),i=n(365),o=n(2884),s=n(3735),a=n(922),u=n(9853),c=n(2652),l=n(9658);const d={},f=e=>{(0,u.Hn)("dfp")("auto_init",!1)&&e.q.push({functionName:"addon",arguments:["dfp",{}]}),window.googletag=window.googletag||{},window.googletag.cmd.push((()=>p(e)))},p=e=>{e.permutive.ready((0,c.Z_)(e.api,e.userId,(()=>k(e.metrics))),"realtime");E(e.externalData);(0,s.zG)(G(e),i.tS((e=>i.Y3((()=>(0,c.qh)(e).forEach((e=>{let[t,n]=e;googletag.pubads().setTargeting(t,n)}))),r.w))),i.Vn((t=>e.api.reportError(`[DFP:load], ${t}`,e.userId.get())))),b(e.permutive),googletag.cmd.push((()=>{y(e.permutive),w(e.permutive)})),window.addEventListener("message",m(e.permutive),!1)},g=e=>{let{advertiserId:t,campaignId:n,lineItemId:r,creativeId:i}=e;return{advertiser_id:(0,c.rH)(t),campaign_id:(0,c.rH)(n),line_item_id:(0,c.rH)(r),creative_id:(0,c.rH)(i)}},m=e=>t=>{try{const n=JSON.parse(t.data);if(!n.permutive_type||"google_ad_click"!==n.permutive_type)return;const{ad_unit_path:r,creative_id:i,advertiser_id:o,order_id:s,line_item_id:a}=(null==n?void 0:n.data)??{},u=g({lineItemId:a,advertiserId:o,campaignId:s,creativeId:i});let c;Object.keys(d).some((e=>{const{slot:t,creative_id:n}=d[e];if((null==t?void 0:t.ad_unit_path)===r&&n===u.creative_id)return c=d[e],!0})),c=c??{...u,is_empty:!1},h(e,c)}catch{}},h=(e,t)=>{a.PH&&t&&e.track("SlotClicked",t)},v={},_=(e,t,n)=>{d[t]=n,I(e,n),v[t]&&v[t](),v[t]=P(e,t)},b=e=>{const t=googletag.pubadsReady&&googletag.pubads().getSlots();t&&t.forEach((t=>{const n=t.getResponseInformation();if(!n)return;const r={...g(n),is_empty:!1,service_name:"publisher_ads",slot:S(t)},i=t.getSlotElementId();_(e,i,r)}))},y=e=>{googletag.pubads().addEventListener("slotRenderEnded",(t=>{const n={...g(t),is_empty:t.isEmpty,service_name:t.serviceName,slot:S(t.slot)};if(t.size){const[e,r]=t.size;"number"==typeof e&&"number"==typeof r&&(n.width=e,n.height=r)}const r=t.slot.getSlotElementId();_(e,r,n)}))},w=e=>{a.EW&&googletag.pubads().addEventListener("impressionViewable",(t=>{let{slot:n,serviceName:r}=t;const i=n.getResponseInformation();if(!i)return;const o={...g(i),service_name:r,slot:S(n)};e.track("SlotViewable",o)}))},I=(e,t)=>{if(!a.CL)return;var n;n={...t,rendered_timestamp:Date.now()},e.track("SlotRendered",n)},k=e=>{let t=0;const n=googletag.pubadsReady&&googletag.pubads().getSlots();n&&n.forEach((e=>e.getResponseInformation()&&t++));const r=0===t?"sdk_targeting_realtime_success_count":"sdk_targeting_realtime_fail_count";e.track({name:r,value:1,labels:{target:"dfp"}})},E=e=>{const t=(0,l.getCachedDFPSegments)(e);googletag.cmd.push((()=>{const{getTargeting:e,setTargeting:n}=googletag.pubads(),r=e("permutive")||[];n("permutive",[...new Set([...t.map(String),...r])])}))},S=e=>{const t={ad_unit_path:e.getAdUnitPath(),slot_element_id:e.getSlotElementId()};return a.jH?{...t,...(()=>{const t={},n=[];let r=[];const i=(e,i)=>{const o="slot"===e?e=>t[e]=1:()=>{},s=i.getTargetingKeys();r=s;for(let s=0;s<r.length;s++){const a=r[s];if(void 0!==t[a]&&"service"===e)continue;const u=[],c=i.getTargeting(a);for(let e=0;e<c.length;e++)u.push(c[e].toString());u.length>0&&(o(a),n.push({key:a,value:u}))}};return i("slot",e),i("service",googletag.pubads()),{targeting_keys:n}})()}:t},P=(e,t)=>{let n=[];const r=()=>(0,s.zG)((0,s.bc)((0,s.zG)(o.Y3((()=>document.getElementById(t))),o.tS(o.ij),o.tS(o.KQ((e=>e.querySelector("iframe"))))),o.ij(document.activeElement)),o.RD,o.UI((n=>{let[r,i]=n;"hidden"===document.visibilityState&&r===i&&h(e,d[t])})));return document.addEventListener("visibilitychange",r),n.push((()=>document.removeEventListener("visibilitychange",r))),()=>{n.forEach((e=>e())),n=[]}},G=e=>{let{userId:t,viewId:n}=e;return i.Y3((()=>({})),r.w)}},7416:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{ScriptRunnerAddon:()=>ScriptRunnerAddon,load:()=>load});const load=e=>{e.q.unshift({functionName:"addon",arguments:["scriptrunner",{}]})};class ScriptRunnerAddon{permutive;options;api;activations;constructor(options){this.permutive=options.permutive,this.options=options,this.api=options.api,this.activations=this.options.activationManager.getActivations("scriptrunner");const segmentTransitions=this.options.nextGenOutput.segmentTransitionsSinceInit.current;for(let i=0;i<this.activations.length;i++){const activation=this.activations[i],triggerType=activation.getTriggerType(),segmentCode=activation.getSegmentCode(),run=activation=>{const script=activation.getConfig().script.replace(/impression\(\)/g,"activation.trackImpression();").replace(/conversion\(\)/g,"activation.trackConversion();");try{eval(script)}catch(e){e instanceof Error&&(e.message="Error running custom script: "+e.message,this.api.reportError(e,this.options.userId.get()))}};"EveryTime"===triggerType?this.permutive.segment(segmentCode,(e=>{e?run(activation):this.permutive.trigger(segmentCode,"result",(function(e){e.result&&run(activation)}))})):"OnEntry"===triggerType?segmentTransitions.segmentsEntered.includes(segmentCode)?run(activation):this.permutive.trigger(segmentCode,"result",(function(e){e.result&&run(activation)})):"OnExit"===triggerType&&(segmentTransitions.segmentsExited.includes(segmentCode)?run(activation):this.permutive.trigger(activation.getSegmentCode(),"result",(function(e){e.result||run(activation)})))}}}},4400:(e,t,n)=>{n.r(t),n.d(t,{WebAddon:()=>I,load:()=>w});var r=n(2688),i=n(365),o=n(3735),s=n(4011),a=n(2884),u=n(7209),c=n(922),l=n(9853),d=n(2652);const f=(0,l.MU)("add_alchemy_entities",!1),p=(0,l.MU)("add_alchemy_taxonomy",!1);function g(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{...e&&p?{taxonomy_labels:"$alchemy_taxonomy_labels"}:{},...e&&f?{entity_names:"$alchemy_entity_names"}:{}}}function m(e,t,n,r){const i={isp_info:"$ip_isp_info",geo_info:"$ip_geo_info",...h(),...e,...t};n.track("Pageview",i).then((e=>{e&&r.emit("permutive:event:pageview",e)}))}function h(){return{}}var v=n(3992);const _=["mousemove","click","scroll"],b=["email","tel","submit","reset","button","file","password","radio","checkbox"],y=["email","e-mail","password","tel","telephone","phone","name_first","name_last","sa_zip"],w=e=>{(0,l.Hn)("web")("auto_init",!1)&&e.q.push({functionName:"addon",arguments:["web",{auto_init:!0}]})};class I{permutive;options;api;clientContext;logger;dirtyState=!1;cancelEngagementTimer=()=>{};totalCompletion=0;totalEngagedTime=0;pageEngagementDetected;cleanupPageEngagementDetection=o.Q1;constructor(e){this.permutive=e.permutive,this.options=e,this.api=e.api,this.clientContext=e.clientContext,this.logger=e.logger,this.options.customProperties.setCustomProps(e.page||{});this.pageEngagementDetected=(()=>{this.dirtyState=!0}).bind(this),m(g(this.clientContext.getContext().isArticle),this.options.customProperties.getCustomProps(),this.permutive,this.options.messages),this.enablePageEngagementDetection(),"loading"!==document.readyState?this.attachListeners():window.addEventListener("DOMContentLoaded",this.attachListeners.bind(this),!1),c.t2&&(this.cancelEngagementTimer=this.registerEngagementInterval(this.getEventInterval()))}sendFormSubmissionEvent(e){{const t=e.currentTarget,n={form:{method:t.method||"GET",properties:this.serializeForm(t),..."string"==typeof t.id?{id:t.id}:{},...t.name&&"string"==typeof t.name?{name:t.name}:{},...t.action&&"string"==typeof t.action?{action:t.action}:{}}};this.permutive.track("FormSubmission",n)}}async trackEngagementInterval(e){const t=this.updateState(e);!function(e,t,n,r,i,o){const s={isp_info:"$ip_isp_info",geo_info:"$ip_geo_info",engaged_time:e,total_engaged_time:t,...i,completion:n,total_completion:r};o.track("PageviewEngagement",s)}(t.engaged_time,t.total_engaged_time,t.completion,t.total_completion,this.options.customProperties.getCustomProps(),this.permutive)}async reset(e){this.disablePageEngagementDetection(),this.dirtyState=!1;const t=this.updateWebOptions(e);this.options.pageviewState.setState(((e,n)=>{var r,i;return{viewId:(null===(r=t.context)||void 0===r?void 0:r.view_id)??(0,d.k$)(),watsonEnabled:(null===(i=t.watson)||void 0===i?void 0:i.enabled)??n.watsonEnabled}})),this.totalCompletion=0,this.totalEngagedTime=0,this.options.customProperties.setCustomProps(this.options.page||{}),this.enablePageEngagementDetection(),m(g(this.clientContext.getContext().isArticle),this.options.customProperties.getCustomProps(),this.permutive,this.options.messages),c.t2&&(this.cancelEngagementTimer(),this.cancelEngagementTimer=this.registerEngagementInterval(this.getEventInterval()))}serializeForm(e){return[...e.getElementsByTagName("input")].filter((e=>!(!e.type||!e.id||e.disabled||e.checked||"fieldset"===e.nodeName.toLowerCase()||-1!==b.indexOf(e.type.toLowerCase())||-1!==y.indexOf(e.name.toLowerCase())))).map((e=>({name:e.name||e.id,value:e.value}))).filter((e=>e.value.length<120))}registerEngagementInterval(e){return(0,v.UM)((()=>{this.dirtyState&&this.trackEngagementInterval(e)}),1e3*e)}attachListeners(){const e=e=>"a"===e.tagName.toLowerCase(),t=e=>e instanceof Element,n=t=>e(t)?(0,a.G)(t):t.parentElement?e(t.parentElement)?(0,a.G)(t.parentElement):n(t.parentElement):a.YP;c.eV&&[].slice.call(document.getElementsByTagName("form"),0).forEach((e=>e.addEventListener("submit",(0,o.ls)(a.DT(this.canTrackPermutiveEvent("FormSubmission")),a.UI((0,d.Z_)(this.options.api,this.options.userId,this.sendFormSubmissionEvent.bind(this)))))));(0,l.MU)("track_link_click",!0)&&document.body.addEventListener("click",(0,o.ls)(a.DT(this.canTrackPermutiveEvent("LinkClick")),a.UI((e=>({event:e,anchor:(0,o.zG)(e.target,a.ij,a.tS(a.DT(t)),a.tS(n))}))),a.DZ((e=>{let{event:t,anchor:n}=e;return a.pC(n)?a.G({event:t,anchor:n.value}):a.YP})),a.UI((e=>{let{event:t,anchor:n}=e;return k(this.permutive,n,(r=t,!("_blank"===n.target||r.metaKey||r.ctrlKey||r.shiftKey||2===r.which||3===r.which)));var r}))),{capture:!0})}updateState(e){const t=Math.max(this.totalCompletion,this.getCurrentCompletion()),n=t-this.totalCompletion;return this.totalEngagedTime+=e,this.totalCompletion=t,this.dirtyState=!1,{engaged_time:e,total_engaged_time:this.totalEngagedTime,completion:n,total_completion:this.totalCompletion}}getCurrentCompletion(){if("function"==typeof this.options.getPageCompletion)return(0,o.zG)((0,i.Y3)((0,o.ls)(this.options.getPageCompletion,Number,(e=>isNaN(e)?0:e),(0,u.uZ)(s.Df)(0,1)),r.w),(0,i.EQ)((e=>(this.logger.warn("Web: invoking getPageCompletion threw an error. Got",e),0)),(e=>(this.logger.debug("Web: invoking getPageCompletion returned",e),e))));return(()=>{const e=document.documentElement.scrollHeight,t=window.pageYOffset+window.innerHeight;return t<=0?0:t>=e?1:t/e})()}registerPageEngagementCleanup(e){"function"==typeof e?this.cleanupPageEngagementDetection=()=>(0,i.Y3)((()=>{e(),this.cleanupPageEngagementDetection=o.Q1}),(e=>this.logger.warn("Page detection cleanup threw an error",(0,r.w)(e)))):this.logger.warn("No page detection cleanup was registered")}enablePageEngagementDetection(){this.options.addPageEngagementDetection&&(0,o.zG)(this.options.addPageEngagementDetection(this.pageEngagementDetected),(e=>this.registerPageEngagementCleanup(e))),this.setDirtyEventListenersTo(!0,this.getDirtyEvents())}disablePageEngagementDetection(){this.cleanupPageEngagementDetection(),this.setDirtyEventListenersTo(!1,this.getDirtyEvents())}setDirtyEventListenersTo(e,t){const n=e?window.addEventListener:window.removeEventListener;return t.forEach((e=>n(e,this.pageEngagementDetected))),null}getDirtyEvents(){return this.options.dirtyEvents||_}getEventInterval(){return this.options.eventInterval||5}canTrackPermutiveEvent(e){return t=>{var n,s;return(0,o.zG)(null===(n=this.options)||void 0===n||null===(s=n.filterPermutiveEvent)||void 0===s?void 0:s[e],a.DT((e=>"function"==typeof e)),a.tS((0,o.ls)((e=>i.Y3((()=>e(t)),(e=>new Error(`Threw an unexpected error: ${(0,r.w)(e)}`)))),i.tS(i.DT((e=>"boolean"==typeof e),(()=>new Error("Did not return a boolean")))),(0,d.bw)(i.Vn((t=>this.logger.error(`Filter predicate for "${e}" event failed`,t)))),a.Uo)),a.fS((()=>!0)))}}updateWebOptions(e){(0,d.Kn)(e)||(e={}),e.watson&&"object"==typeof e.watson&&"enabled"in e.watson&&"boolean"==typeof e.watson.enabled||delete e.watson,"object"==typeof e.filterPermutiveEvent&&null!==e.filterPermutiveEvent||delete e.filterPermutiveEvent,"context"in e&&!(0,d.Kn)(e.context)&&delete e.context;const t={addPageEngagementDetection:void 0,context:void 0,dirtyEvents:void 0,eventInterval:void 0,filterPermutiveEvent:void 0,getPageCompletion:void 0,page:void 0,watson:void 0};return this.options={...this.options,...t,...e}}}const k=(e,t,n)=>{if(window.location.href&&t.href){const r=0===t.href.indexOf("data:")?"NOT_URL":t.href;e.track("LinkClick",{dest_url:r},{useBeacon:n})}}},9078:(e,t,n)=>{n.d(t,{a:()=>r});class r{messages;handlers={};messageQueue={};constructor(e){var t,n;this.messages=e;null===(t=(n=window).addEventListener)||void 0===t||t.call(n,"message",(e=>{var t;"permutive"===(null==e||null===(t=e.data)||void 0===t?void 0:t.origin)&&this.handle(e)}),!1),this.messages.once("permutive:api:ready",(function(){var e,t;null===(e=(t=window).postMessage)||void 0===e||e.call(t,{origin:"permutive",type:"sdk-init"},"*")}))}listen(e,t){if(e in this.handlers||(this.handlers[e]=[]),this.handlers[e].push(t),e in this.messageQueue){const t=this.messageQueue[e];if(void 0===t)return;for(let e=0;e<t.length;e++){const n=t[e];this.handle(n)}}}handle(e){if(e.data.type in this.handlers)this.handlers[e.data.type].forEach((t=>{t(e)}));else{(this.messageQueue[e.data.type]??=[]).push(e)}}}},533:(e,t,n)=>{n.d(t,{o:()=>r,s:()=>i});class r extends Error{static errorName="NetworkRequestFailedError";name=r.errorName;constructor(){super(r.defaultMessage)}static get defaultMessage(){return"Network request failed"}}class i extends Error{static errorName="NetworkRequestTimeoutError";name=i.errorName;constructor(){super(i.defaultMessage)}static get defaultMessage(){return"Network request timed out"}}},7423:(e,t,n)=>{n.d(t,{F:()=>d});var r=n(2688),i=n(3735),o=n(2884),s=n(3328),a=n(3030),u=n(533),c=n(6392);class l{urls;config;network;metricsCollector;logger;webClient;prefix="[API]";constructor(e,t,n,r,i){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:()=>o.YP;this.urls=e,this.config=t,this.network=n,this.metricsCollector=r,this.logger=i,this.webClient=s}async reportError(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;const l=(0,r.w)(e);if(this.logError("Reporting error:\n",l),!this.config.sendClientErrors)return void this.logDebug("Send errors not enabled. Skipping");const d=(0,i.zG)(this.webClient,c.UI(o.fS((()=>{var e,t,n,r;return{domain:(null===(e=self.location)||void 0===e?void 0:e.hostname)??"",referrer:"document"in self?null===(t=self.document)||void 0===t?void 0:t.referrer:"",url:(null===(n=self.location)||void 0===n?void 0:n.href)??"",user_agent:(null===(r=navigator)||void 0===r?void 0:r.userAgent)??""}}))),c.UI((e=>{var r,i;const o={error_message:(null==l||null===(r=l.message)||void 0===r?void 0:r.toString())??"",stack_trace:null==l||null===(i=l.stack)||void 0===i?void 0:i.split("\n")},s=t?{user_id:t}:{};return{platform:"web",sdk_version:"v20.11.0",ql_runtime_version:"v13.0.0",timestamp:n,domain:e.domain,url:(0,a.bk)(e.url),referrer:(0,a.bk)(e.referrer),user_agent:e.user_agent,error_message:o.error_message??String(l),stack_trace:o.stack_trace,...s}}))),f=e=>this.network.req({url:this.urls.getSdkErrorsUrl("/errors",o.G(this.config.sdkErrorsApiVersion)),method:"POST",payload:[e],contentType:"text/plain",dataType:"text",withCredentials:!1}),p=e=>{this.metricsCollector.trackCounter({name:"sdk_http_generic_network_request_fail_count_total",value:1,labels:{network_error_type:e}})};await(0,i.zG)([u.o,u.s],s.Ew((e=>l.name===e.errorName||l.message.indexOf(e.errorName)>=0||l.message.indexOf(e.defaultMessage)>=0)),o.g_((()=>{const e=d();return f(e).catch((0,i.ls)(r.w,(e=>this.logError(e))))}),(async e=>p(e.errorName))))}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(this.prefix,...t)}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(this.prefix,...t)}}class d extends l{identifyPromise;identify(e,t,n){const r=()=>this.reqWithMetrics(e,"sdk_http_identify_seconds",{url:this.urls.getEndpointUrl("/identify",o.G(this.config.apiVersion)),method:"POST",payload:{user_id:t.get(),aliases:n},contentType:"text/plain",dataType:"json",withCredentials:!0});return this.identifyPromise?this.identifyPromise=this.identifyPromise.then(r):this.identifyPromise=r()}metrics(e){return this.network.req({url:this.urls.getEndpointUrl("/internal/metrics",o.G(this.config.apiVersion)),method:"POST",payload:e,contentType:"text/plain",dataType:"text",withCredentials:!1})}metricsBeacon(e){return this.network.reqWithBeacon({url:this.urls.getEndpointUrl("/internal/metrics",o.G(this.config.apiVersion)),payload:e})}reset(e){return this.reqWithMetrics(e,"sdk_http_reset_seconds",{url:this.urls.getEndpointUrl("/reset",o.G(this.config.apiVersion)),method:"POST",payload:null,contentType:"text/plain",dataType:"json",withCredentials:!0})}segmentSync(e){return this.network.req({url:`https://${this.config.segmentSyncApiHost}/sync/${e.key}`,method:"POST",payload:`value=${encodeURIComponent(e.value)}`,contentType:"application/x-www-form-urlencoded",dataType:"json",withCredentials:!0})}appnexus(e){return this.network.req({url:e,method:"GET",contentType:"text/plain",dataType:"json",withCredentials:!0,timeout:2e3})}pxid(e){return this.network.req({url:this.urls.makeAuthenticatedUrl(e),method:"GET",contentType:"text/plain",dataType:"json",withCredentials:!0,timeout:2e3})}queries(){const e={addons:{dfp:{activations:{dfp:[],dfp_legacy:{}},auto_init:!0,track_slot_rendered:!1,track_slot_viewable:!1,track_slot_clicked:!1,track_targeting_keys:!1,sync_segments_cookie:!1},web:{auto_init:!1,track_pageview_engagement:!0,track_pageview_complete:!0,track_form_submission:!1,track_link_click:!1,engagement_edge_only:!0,segment_transition_edge_only:!1}},queries:{queries:{},eventSegments:{},eventsLookup:[],literalsLookup:[],subexpressionsLookup:[],stateSyncReplays:[],propertiesLookup:[],ahoCorasickLookup:[]},queries_metadata:{}},t=`${this.config.cdnBaseUrl.startsWith("dev.local:")?"http":"https"}://${this.config.cdnBaseUrl}/queries/88980e3a-6890-4e52-bcc1-3154ab2a17c7-amp.json`;return this.network.req({url:t,withCredentials:!1,dataType:"json",method:"GET"}).catch((()=>e))}pxidReset(e){return this.network.req({url:this.urls.makeAuthenticatedUrl(e),method:"POST",payload:null,contentType:"text/plain",dataType:"json",withCredentials:!0})}uploadCohortMemberships(e,t){return this.reqWithMetrics(e,"sdk_http_upload_cohort_memberships_seconds",{url:this.urls.getCCSCohortMembershipEndpointUrl("/amp/cohorts",o.G("alpha"),[["i",t.user_id]]),method:"POST",payload:t,contentType:"text/plain",dataType:"json",withCredentials:!1})}reqWithMetrics(e,t,n){const r=e.startTimer(t,{});return this.network.req(n).then((n=>(0,i.zG)(e.stopTimer(t,r),(e=>n))))}}},7354:(e,t,n)=>{n.d(t,{E:()=>b});var r=n(365),i=n(3735),o=n(533),s=n(3992),a=n(2884),u=n(9384),c=function(e){return"Left"===e._tag},l=function(e){return"Right"===e._tag};function d(e){return{_tag:"Left",left:e}}function f(e){return{_tag:"Right",right:e}}function p(e,t){return{_tag:"Both",left:e,right:t}}var g=function(e,t,n){return function(r){switch(r._tag){case"Left":return e(r.left);case"Right":return t(r.right);case"Both":return n(r.left,r.right)}}},m=g;m(f,d,(function(e,t){return p(t,e)}));var h=f,v="These",_=(i.yR,i.yR,u.Xl,n(2652));class b{metrics;constructor(e){this.metrics=e}req(e){return this.reqImpl(e).then((e=>(0,i.MZ)(e)))}reqWithBeacon(e){var t,n;let{url:r,payload:i}=e;const o=JSON.stringify(i),s=(null===(t=navigator)||void 0===t||null===(n=t.sendBeacon)||void 0===n?void 0:n.call(t,r,JSON.stringify(i)))??!1;return this.trackRequestMetrics({is_beacon:!0,is_error:!s,request:{method:"POST",url:r,content_length:o.length}}),s}reqImpl(e){const t="arraybuffer",{url:n,dataType:c,contentType:l,method:d,withCredentials:g,timeout:m}=e;return new Promise(((h,v)=>{const b=new XMLHttpRequest,y="POST"===e.method?"string"==typeof(w=e.payload)?w:JSON.stringify(w):null;var w;const I=e=>this.trackRequestMetrics({is_beacon:!1,request:{method:d,url:n,content_length:(null==y?void 0:y.length)??0},response:e});b.onload=(0,s.GL)((()=>{var e,n;return(0,i.zG)(b.status,r.DT((e=>e<400),(()=>{const e="text"===b.responseType||""===b.responseType?b.responseText:"Couldn't access response text";return`Failed ajax request. Status code was ${b.status}. ${e}`})),r.tS((()=>"json"===c?b.responseText?r.Y3((()=>JSON.parse(b.responseText)),(e=>`Failed to parse response as JSON. Response was ${JSON.stringify(b.responseText)}. Got ${e}`)):r.F2(null):"text"===c?r.F2(b.responseText):r.F2(b.response))),(0,_.bw)((0,i.ls)(a.IS,(n={content_length:"text"===b.responseType||""===b.responseType?(null===(e=b.responseText)||void 0===e?void 0:e.length)??0:b.responseType===t?b.response.byteLength:0,response_time_ms:self.performance.now()-k,status_code:b.status},function(e){return u.Wi(e)?f(n):p(e.value,n)}),I)),r.EQ(v,h))})),b.onerror=(0,s.GL)((()=>{I(r.t$("network error")),v(new o.o)})),b.ontimeout=(0,s.GL)((()=>{I(r.t$("timeout")),v(new o.s)})),b.open(d,n,!0),l&&b.setRequestHeader("content-type",l),b.timeout=m||b.timeout,b.withCredentials=g||b.withCredentials,b.responseType="binary"===c?t:b.responseType;const k=self.performance.now();b.send(y)}))}trackRequestMetrics(e){var t;if(null===(t=this.metrics)||void 0===t||!t.isEnabled())return;const n=new URL(e.request.url).pathname;if(n.includes("metrics"))return;const r=t=>this.metrics.track({name:"sdk_http_request_count_total",value:1,labels:{request_method:e.request.method,request_path:n,request_content_length:e.request.content_length,...t}});var o;!0===e.is_beacon?r({is_beacon:!0,is_error:e.is_error}):(0,i.zG)((o=e.response,c(o)?u.YP:(l(o),u.G(o.right))),a.aD((()=>({})),(e=>({response_content_length:e.content_length,response_status:e.status_code,response_time_ms:e.response_time_ms}))),(t=>({is_beacon:!1,is_error:!l(e.response),...t})),r)}}},7548:(e,t,n)=>{n.d(t,{X:()=>i,k:()=>r});const r=e=>({id:e.id,name:e.name,time:new Date(e.time),properties:e.properties||{},session_id:e.session_id,view_id:e.view_id}),i=e=>({id:e.id,name:e.name,time:(o(e.time)?e.time:new Date).toISOString(),properties:e.properties||{},session_id:e.session_id,view_id:e.view_id}),o=e=>isFinite(e)&&e instanceof Date},9145:(e,t,n)=>{n.r(t),n.d(t,{startMaster:()=>ce});var r=n(2851),i=n(3735),o=n(2116),s=n(2884),a=n(3328),u=n(2652),c=n(6392),l=n(4923),d=n(1828),f=n(6017),p=n(7241);var g=n(7407),m=n(6862),h=n(7341),v=n(4870);function _(e,t){return function(n){return e.map(n,t.compact)}}function b(e,t,n){var r=_(e,t),o=(0,h.UI)(e,n);return function(e){return v.s4(r((0,i.zG)(e,o(s.IS))),r((0,i.zG)(e,o(s.EK))))}}function y(e,t){return function(n){return function(r){return e.map(r,(function(e){return t.filter(e,n)}))}}}function w(e,t){return function(n){return function(r){return e.map(r,(function(e){return t.filterMap(e,n)}))}}}function I(e,t){var n=y(e,t);return function(e){var t=n((0,f.ff)(e)),r=n(e);return function(e){return(0,v.s4)(t(e),r(e))}}}function k(e,t){var n=w(e,t);return function(e){return function(t){return(0,v.s4)((0,i.zG)(t,n((function(t){return(0,s.IS)(e(t))}))),(0,i.zG)(t,n((function(t){return(0,s.EK)(e(t))}))))}}}var E=n(9384);function S(e){return(0,i.ls)(s.G,e.of)}function P(e){return(0,i.a9)(e.of(s.YP))}function G(e){return function(t){return e.map(t,s.G)}}function U(e){return(0,i.ls)(s.ij,e.of)}function D(e){var t=U(e);return function(e){return(0,i.ls)(e,t)}}function z(e){var t=$(e),n=D(e);return function(e){return t(n(e))}}function C(e){return function(t){return(0,i.ls)(t,e.of)}}function T(e){var t=$(e),n=C(e);return function(e){return t(n(e))}}function O(e){return function(t){return function(n){return e.of(s.DT(t)(n))}}}function M(e){return(0,i.ls)(s.Uo,e.of)}function x(e){return function(t,n){return function(r){return e.map(r,s.EQ(t,n))}}}function A(e){return function(t,n){return function(r){return e.chain(r,s.EQ(t,n))}}}function R(e){return function(t){return function(n){return e.chain(n,s.EQ(t,e.of))}}}function q(e){return(0,h.UI)(e,s.dO)}function L(e){return(0,d.ap)(e,s.G5)}function $(e){var t=P(e);return function(n){return function(r){return e.chain(r,s.EQ((function(){return t()}),n))}}}function B(e){var t=S(e);return function(n){return function(r){return e.chain(r,s.EQ(n,t))}}}var F=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},j=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},N=S(g.PM),Y=(g.PM,g.of,g.PM,g.dO,g.UI(s.Uo)),Q=(g.dO,g.qo,g.UA,g.PM,function(e){return function(){return F(void 0,void 0,void 0,(function(){return j(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e().then(E.G)];case 1:return[2,t.sent()];case 2:return t.sent(),[2,E.YP];case 3:return[2]}}))}))}}),K=(g.PM,g.UA,g.PM,g.UA,q(g.dO)),W=L(g.Hi),H=N,V=$(g.UA),J=(g.UA,g.PM,g.dO,s.Ri,g.dO,s.Ri,s.dO,g.dO,s.xu,g.dO,s.xu,g.dO,s.xu,g.dO,s.xu,function(e,t){return(0,i.zG)(e,K(t))}),X=function(e,t){return(0,i.zG)(e,W(t))},Z=function(e,t){return(0,i.zG)(e,V(t))},ee="TaskOption",te={URI:ee,map:J},ne={URI:ee,map:J,ap:X,chain:Z},re=(E.F4,(0,h.YO)(te)),ie=(0,m.a)(ne),oe=(E.Xl,n(3992)),se=n(8377);const ae=(e,t)=>{const[n,o]=r.gS(a.uZ());return(0,i.zG)(t,r.UI(c.UI((t=>{a.Od(t)&&e.all().then((e=>(0,i.zG)(t,a.UI((0,se.H5)((()=>e))),o)))}))),r.UI((e=>e()))),n},ue=(e,t)=>{let n=!1;return r.UI(c.UI((0,u.bw)((r=>{n||(n=(0,i.zG)(r,a.G((e=>{let[,t]=e;return"Pageview"===t.name}))),n&&e.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:t,time_origin:"sdk_init"}))}))))};function ce(e){let{eventsCacheFactory:t,metrics:m,trace:h,migratedStateMaps:v,worker:_,...b}=e;return e=>o.dQ((0,i.ls)((0,u.rO)({previousState:le}),(o=>{let{stopped:u,previousState:y}=o;(0,i.zG)(u,r.YP((e=>e&&_.stop()))),_.send({...b,migratedStateMaps:y.stateMigrated?{external:s.YP,internal:s.YP}:v(),previousState:y.workerState}),h.measureSinceInit("post_worker_config_duration").finish(),m.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"master_sent_worker_config",time_origin:"sdk_init"},performance.now());const w=h.startSpan("worker_config_response_duration"),I=_.next();I.then((()=>{w.finish(),m.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"master_received_worker_config_response",time_origin:"sdk_init"},performance.now())}));const k=((e,t)=>{const o=(0,i.zG)((()=>t),g.UI((e=>s.lo(!e))),V((()=>Y(e()))),re("eventsCache"),ie("eventsCacheService",(()=>(0,i.zG)((0,oe.N1)(Q((()=>Promise.resolve().then(n.bind(n,7476))))),K((e=>e.eventCacheService)))))),u=o();return e=>{let{priorCachedEventsRequests:t,...n}=e;return e=>{let{previousState:o,stopped:l}=e;const d=r.a9(c.of(a.bM())),[f,p]=r.Ue({eventsToPublish:r.a9(c.of(a.bM())),priorCachedEventsResponses:d,state:r.a9(o)});return u.then(s.EQ((()=>p({eventsToPublish:n.eventsToPublish,priorCachedEventsResponses:d,state:r.a9(void 0)})),(e=>{let{eventsCache:r,eventsCacheService:i}=e;const{state:s,value:{newEvents:a}}=i({eventsCache:r,eventsToProcessOnPageUnload:n.eventsToPublishOnPageUnload,newEvents:n.eventsToPublish})({previousState:o,stopped:l});p({eventsToPublish:a,priorCachedEventsResponses:ae(r,t),state:s})}))),{state:(0,i.zG)(f,r.VS((e=>e.state))),value:(0,i.bc)((0,i.zG)(f,r.VS((e=>e.priorCachedEventsResponses))),{...n,eventsToPublish:(0,i.zG)(f,r.VS((e=>e.eventsToPublish)))})}}}})(t,I.then((e=>e.eventsCachedInWorker)));return(0,i.zG)((()=>_.read()),function(e,t){const n=e=>(0,i.zG)(e,l.Hd((e=>e in t)),(e=>{let{left:t,right:n}=e;return{buffers:n,nonBuffers:t}}));return o=>{const{buffers:s,nonBuffers:a}=n(e),[u,c]=r.Ue({...a,...(0,i.zG)(s,l.Su((e=>()=>{const n=s[e];return s[e]=t[e].empty,n})))});return(async()=>{for(;;){const e=(0,i.zG)(await o(),p.UI(n),p.ur({concat:(e,n)=>({nonBuffers:{...e.nonBuffers,...n.nonBuffers},buffers:(()=>{const r={...e.buffers};for(const e in n.buffers)r[e]=e in r?t[e].concat(r[e],n.buffers[e]):n.buffers[e];return r})()})})),r=(0,i.zG)(e.buffers,l.Su(((e,n)=>(s[e]=t[e].concat(s[e],n),()=>{const n=s[e];return s[e]=t[e].empty,n}))));c({...u.current,...e.nonBuffers,...r})}})(),(0,i.zG)(e,l.Su((e=>(0,i.zG)(u,r.UI((t=>t[e]))))))}}({activations:y.activations,cohorts:y.cohorts,context:{},eventsToPublish:a.cS,eventsToPublishOnPageUnload:a.cS,externalData:{},geoIP:s.YP,metrics:a.cS,priorCachedEventsRequests:a.cS,realtime:!1,state:y.workerState,transitionsSinceInit:{segmentsEntered:a.cS,segmentsExited:a.cS},workerStateFlushed:!1,stateMigratedThisInitialisation:!1},{eventsToPublish:a.uZ(),metrics:a.uZ(),priorCachedEventsRequests:a.uZ()}),(e=>{let{metrics:t,...n}=e;return t.onChange((e=>e().forEach((e=>m.track(e))))),n}),(t=>{let{workerStateFlushed:n,stateMigratedThisInitialisation:o,activations:p,cohorts:g,state:h,...v}=t;const{value:[b,w],state:I}=k(v)({stopped:u,previousState:y.masterEventsCache});return function(e,t,n){const o=(0,i.zG)(r.vP(t),r.UI((0,i.ls)(l.UI((e=>"function"==typeof e?e:c.of(e))),(0,d.Yt)(c.G5))));let a=o.current();e(a),(0,i.zG)(o,r.YP((t=>{const r=t(),o=(0,i.zG)(r,l.z7(((e,t)=>{var r;return t!==a[e]&&(null===(r=n[e])||void 0===r||!r.isEmpty(t))})),s.DT((0,f.ff)(l.xb)));s.pC(o)&&(a={...a,...o.value},e(o.value))})))}(_.send,{consent:e.consent,contextualCohorts:e.contextualCohorts,enrichmentReplacementMap:e.enrichmentReplacementMap,eventSourceId:e.eventSourceId,identities:e.identities,userId:e.userId,userIdIsNewlyGenerated:e.userIdIsNewlyGenerated,newEvents:(0,i.zG)(e.newEvents,ue(m,"pageview_sent_to_worker")),sessionId:e.sessionId,viewId:e.viewId,webClient:e.webClient,pageviewState:e.pageviewState,priorCachedEventsResponses:b},{newEvents:{isEmpty:a.xb},priorCachedEventsResponses:{isEmpty:a.xb}}),m.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"master_sent_worker_input",time_origin:"sdk_init"},performance.now()),{state:r.vP({activations:p,cohorts:g,masterEventsCache:I,workerState:h,stateMigrated:(0,i.zG)(r.vP(n,o),r.Rp(y.stateMigrated,((e,t)=>{let[n,r]=t;return e||n&&r})))}),value:{...w,stateMigratedThisInitialisation:o,activations:{dfp:r.UI((e=>e.dfp),p),xandr_ssp:r.UI((e=>e.xandr_ssp),p)},cohorts:{all:r.UI((e=>e.all),g),ql:r.UI((e=>e.ql),g),qlCustom:r.UI((e=>e.qlCustom),g),qlStandard:r.UI((e=>e.qlStandard),g)}}}}))})))}const le=e=>me(e)?{activations:de(e.activations),cohorts:pe(e.cohorts),masterEventsCache:e.masterEventsCache,workerState:e.workerState,stateMigrated:!!e.stateMigrated}:{activations:de(null),cohorts:pe(null),masterEventsCache:null,workerState:null,stateMigrated:!1},de=e=>me(e)?{dfp:ge(e.dfp),xandr_ssp:ge(e.xandr_ssp)}:fe(),fe=()=>({dfp:a.cS,xandr_ssp:a.cS}),pe=e=>me(e)?{all:ge(e.all),ql:ge(e.ql),qlCustom:ge(e.qlCustom),qlStandard:ge(e.qlStandard)}:he(),ge=e=>Array.isArray(e)?e:a.cS,me=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),he=()=>({all:a.cS,ql:a.cS,qlCustom:a.cS,qlStandard:a.cS})},2520:(e,t,n)=>{n.r(t),n.d(t,{runNextGenFeatures:()=>Xe});var r=n(3735),i=n(2851),o=n(2116),s=n(3992),a=n(2884),u=n(2652);function c(e){let{messages:t}=e;const[n,r]=i.Ue(new Set);return t.on("permutive:addon:preinit",(e=>r(new Set([...n.current,e])))),n}function l(){const e=()=>Math.floor(Date.now()/1e3),[t,n]=i.Ue(e());return(0,s.UM)((()=>n(e())),1e3),t}function d(){const[e,t]=i.Ue(!1);return(0,u.aT)((()=>t(!0)),navigator.userAgent),e}var f=n(3328),p=n(2688),g=n(365),m=n(7241),h=n(2197),v=n(4923),_=n(4870),b=n(9853),y=n(7826);const w="[Prebid Monitoring]",I=(e,t)=>{e.metrics.trackCounter({name:"sdk_prebid_monitoring_key_flag_count_total",labels:t,value:1})},k=(e,t)=>{e.metrics.trackCounter({name:"sdk_prebid_monitoring_key_bidder_flag_count_total",labels:t,value:1})},E=function(e,t){const n=S(e);return o.K4((()=>(0,r.zG)(t,i.UI((0,r.ls)(a.DT((e=>e.consent)),a.UI((e=>e.prebidJS)))),i.D8(a.Eh((0,u.Or)())),i.bw((0,r.ls)(a.tS((e=>e.completedChecks?e.mainPair:a.YP)),a.UI((t=>I(e,{flag:"prebid_main_key",prebid_key:t.windowPropertyKey}))))),i.UI(a.UI((e=>(0,r.zG)(e.mainPair,a.UI((t=>[t,...e.otherPairs])),a.fS((()=>e.otherPairs)))))),i.Rp(new Set,((t,i)=>(0,r.zG)(i,a.UI(f.hX((e=>!t.has(e.windowPropertyKey)))),a.hX(f.Od),(0,u.bw)(a.EQ((()=>e.logger.debug(w,"Nothing to report")),(t=>e.logger.debug(w,"Reporting",t)))),a.fS((()=>[])),f.UI((t=>(0,r.zG)((t=>(0,r.zG)(g.Y3((function(){var n;const{pbjs:i,windowPropertyKey:o}=t;e.logger.log(w,`Reporting on "${o}"`,t);const s=P(i);e.logger.debug(w,`Version ${i.version} parsed as`,s);const a=(0,y.zi)(i);e.logger.debug(w,"Read config",a);const u=(0,r.zG)((null===(n=a.realTimeData)||void 0===n?void 0:n.dataProviders)??[],f.Ew((e=>"permutive"===e.name)));return e.logger.debug(w,"Read data provider config",u),{pbjs:i,config:a,dataProviderConfig:u,installedModules:i.installedModules||[],version:s,windowPropertyKey:o}}),p.w),g.ak("bidders",(e=>n.acBidders(e))),g.ak("permutiveRTDProvider",(e=>n.permutiveRTDProvider(e))),g.ak("consent",(e=>n.consent(e))),g.ak("targeting",(e=>n.targeting(e)))))(t),g.Pd((n=>e.reportError(`${w} Failed to report pair "${t.windowPropertyKey}", ${n.message}`)),(()=>t.windowPropertyKey))))),f.hp,(e=>new Set([...t,...e]))))),(e=>({reportedKeys:e})))))};const S=e=>({acBidders:t=>g.Y3((()=>{const n=(0,b.Hn)("prebid")("data_provider_config",{ac_bidders:[]}),i=t.version.major>=7&&t.version.minor>=13?n.ac_bidders:[],o=(0,r.zG)(t.dataProviderConfig,a.UI((e=>{var t;return(null==e||null===(t=e.params)||void 0===t?void 0:t.acBidders)??[]})),a.fS((()=>[]))),s=[...new Set([...i,...o])];return e.logger.debug(w,"Determined acBidders as",{acBidders:s,dynamicBidders:i,staticBidders:o}),s.forEach((n=>{k(e,{flag:"prebid_ac_bidder",prebid_key:t.windowPropertyKey,prebid_bidder:n})})),{acBidders:s,dynamicBidders:i,readBidders:o}}),p.w),consent:t=>g.Y3((()=>{var n,r,i,o,s,a;const u=t.windowPropertyKey;t.config.consentManagement&&"object"==typeof t.config.consentManagement&&I(e,{prebid_key:u,flag:"prebid_has_consent_management"});const c=t.installedModules.includes("gdprEnforcement");c&&I(e,{prebid_key:u,flag:"prebid_gdpr_enforcement_module"});const l=(null===(n=t.config)||void 0===n||null===(r=n.consentManagement)||void 0===r||null===(i=r.gdpr)||void 0===i||null===(o=i.rules)||void 0===o||null===(s=o.find((e=>"storage"===(null==e?void 0:e.purpose))))||void 0===s||null===(a=s.vendorExceptions)||void 0===a?void 0:a.includes("permutive"))||!1;return l&&I(e,{prebid_key:u,flag:"prebid_storage_exception"}),{hasGDPREnforcementModule:c,addedAsStorageException:l}}),p.w),permutiveRTDProvider:t=>g.Y3((()=>{const n=t.installedModules.includes("permutiveRtdProvider");return n&&I(e,{prebid_key:t.windowPropertyKey,flag:"prebid_permutive_rtd"}),n}),p.w),targeting:t=>{const n=(0,r.ls)(f.UI((e=>[e,null])),v.sq),i=(t,n)=>(0,r.zG)(t,(0,u.bw)((t=>e.logger.debug(w,`Processing ${t.length} bidder request(s)`,t))),f.hX((e=>n.hasOwnProperty(e.bidderCode)&&null===n[e.bidderCode])),m.vM((e=>e.bidderCode)),v.DZ(f.f2((0,u.lo)([[e=>(e=>{var t,n,r;const i=null==e||null===(t=e.user)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.find((e=>"permutive.com"===e.name));return!(null==i||null===(r=i.segment)||void 0===r||!r.length)})(e.ortb2),()=>a.G("ortb2")],[e=>{return t=e.params,["permutive","p_standard"].some((e=>{var n,r,i,o;return(null==t||null===(n=t.visitor)||void 0===n||null===(r=n[e])||void 0===r?void 0:r.length)||(null==t||null===(i=t.keywords)||void 0===i||null===(o=i[e])||void 0===o?void 0:o.length)}));var t},()=>a.G("params")],()=>a.YP]))),(0,u.bw)((t=>e.logger.debug(w,"Bidders targeting method's updated",t)))),o=o=>{e.logger.debug(w,"Bidders found with no targeting method",o);let s=n(o);const a=n=>(0,r.zG)(i([n],s),(0,u.bw)((e=>{s={...s,...e}})),(0,u.bw)(v.Su(((n,r)=>k(e,{flag:`prebid_${r}_targeting_success`,prebid_key:t.windowPropertyKey,prebid_bidder:n})))),(0,u.bw)((()=>{Object.values(s).includes(null)||(e.logger.debug(w,`Cleaning up "bidRequested" listener for ${t.windowPropertyKey}`),t.pbjs.offEvent("bidRequested",a))})));t.pbjs.onEvent("bidRequested",a)};return g.Y3((()=>{const s=(0,r.zG)(t.pbjs.getEvents(),f.DZ((0,r.ls)(a.DT((e=>"bidRequested"===e.eventType)),a.UI((0,u.vg)("args")))));return(0,r.zG)(t.bidders.acBidders,a.DT(f.Od),a.EQ((()=>e.logger.debug(w,"No bidders for targeting")),(0,r.ls)(n,(e=>({...e,...i(s,e)})),v.uK(h.ff((e=>null===e))),_.Pd((0,r.ls)(v.XP,a.DT(f.Od),a.UI(o)),v.Su(((n,r)=>k(e,{prebid_bidder:n,prebid_key:t.windowPropertyKey,flag:`prebid_${r}_targeting_success`})))))))}),p.w)}}),P=e=>{const[t,n,r]=e.version.split("-")[0].replace("v","").split(".").map((e=>parseInt(e)));return{major:t,minor:n,patch:r}},G=function(e,t){const n=(0,r.zG)(t.pbjs,i.VS((0,r.ls)(a.tS(a.KQ((e=>{var t;return null===(t=e.getUserIdsAsync)||void 0===t?void 0:t.call(e).then((()=>{var t;return(null===(t=e.getUserIdsAsEids)||void 0===t?void 0:t.call(e))??[]}))}))),a.UI(i.p4),a.fS((()=>i.a9(a.YP))))),i.UI(a.tS(a.Uo)),i.bw(a.mU((t=>(t.length>0?t.forEach((t=>{e.metrics.trackCounter({name:"sdk_prebid_alternative_identifiers_count_total",labels:{alternative_user_id_name:t.source},value:1})})):e.metrics.trackCounter({name:"sdk_prebid_alternative_identifiers_count_total",labels:{identifier:"NONE"},value:1}),a.YP))))),s=(0,r.zG)(t.pbjs,i.UI(a.tS(a.KQ((e=>{var t;return null===(t=e.getUserIdsAsEids)||void 0===t?void 0:t.call(e)})))));return o.K4((()=>(0,r.zG)(i.vP(n,s),i.UI((e=>{let[t,n]=e;return(0,r.zG)(t,a.wp((()=>n)))})),i.UI((0,r.ls)(a.UI(f.DZ((e=>{var t,n;return"string"==typeof(null===(t=e.uids)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id)?a.G((0,r.bc)(e.source,{id:e.uids[0].id})):a.YP}))),a.tS(m.c2),a.UI(v.sq))),i.bw((t=>{a.pC(t)&&e.logger.debug("[Prebid Identifiers]","Found identifiers",t.value)})))))};const U=function(e){let{externalData:t}=e;return o.K4((()=>{t.removeExternalData(D)}))};const D="_pfws",z=new Set(["AdRequest","Reaction","PageviewEngagement","SegmentEntry","SegmentExit"]);class C{events;listeners;static highVolumeEvents=(()=>{const e=new Set([...z]);return e.delete("Reaction"),e})();constructor(){this.events=[],this.listeners=[]}newEvent(e,t){C.highVolumeEvents.has(e.name)||this.events.push([e,t]),[...this.listeners].forEach((n=>{this.handle(e,t,n)}))}addListener(e){this.listeners.push(e);const t={replay:()=>(this.replay(e),t),remove:()=>(this.remove(e),t)};return t}handle(e,t,n){const r="string"==typeof n.name&&e.name===n.name,i=n.name.test&&n.name.test(e.name),o=r||i;if(o)try{n.callback(e,t)}catch(e){window.console&&window.console.error&&window.console.error("callback error: ",e)}o&&n.once&&this.remove(n)}replay(e){let t=-1!==this.listeners.indexOf(e);for(let n=0;n<this.events.length&&t;n++)this.handle(this.events[n][0],this.events[n][1],e),t=-1!==this.listeners.indexOf(e)}remove(e){const t=this.listeners.indexOf(e);-1!==t&&this.listeners.splice(t,1)}}var T=n(6392),O=n(1828);var M=n(8377),x=n(2707),A=n(7407);const R="[Event Upload]",q=(e,t,n,a)=>o.dQ((o=>{let{stopped:c,previousState:l}=o;Array.isArray(l)&&(0,r.zG)(l,j(e))();const d=new Set([...z]),[p,{appendUntrackedEvents:m,appendUploadResults:h}]=(0,r.zG)((()=>{const[e,t]=i.gS(f.uZ()),[n,o]=i.gS(f.uZ());return(0,r.bc)({uploadResults:e,untrackedEvents:n},{appendUploadResults:t,appendUntrackedEvents:o})})(),(0,M.pL)((0,r.ls)((function(e){const[t,n]=(0,r.zG)(e.uploadResults,N(f.bj));return{...e,uploadResults:t,erroredEventsAsJSON:n}}),(function(e){const[t,n]=(0,r.zG)(e.erroredEventsAsJSON,N(f.UI((0,M.H5)((0,u.rO)({event:(0,u.rO)({time:e=>new Date(e)})})))));return{...e,erroredEventsAsJSON:t,erroredEvents:n}}),(function(e){let{uploadResults:t,untrackedEvents:n,...o}=e;const s=(0,r.zG)(t,i.UI(T.UI((0,r.ls)(f.hp,f.UI((0,M.H5)((0,u.rO)({time:e=>new Date(e)}))))))),a=(0,r.zG)(i.vP(s,n),i.UI(T.RD),i.UI(T.UI((e=>{let[t,n]=e;return n.concat(t)}))));return{...o,successEvents:a}}),(function(e){const[t,n]=(0,r.zG)(e.successEvents,N(f.UI((0,M.H5)((0,u.rO)({time:e=>e.toISOString()})))));return{...e,successEvents:t,successEventsAsJSON:n}})))),[v,_]=i.Ue(0),[b,y]=i.Ue(0),w=(0,r.zG)(t,i.UI(T.UI((e=>(0,r.zG)(e,f.uK((e=>{let[,t]=e;return!d.has(t.event.name)})),(e=>{let{left:t,right:n}=e;return(0,r.zG)(t,f.UI((0,M.H5)((e=>e.event))),m),n}))))),i.UI(T.UI((e=>(e.length>0&&((0,s.HJ)((()=>_(v.current+e.length)),500),(0,s.HJ)((()=>y(b.current+e.length)),5e3)),e))))),I=e=>t=>(0,r.zG)(e,f.hX((e=>{let[n]=e;return!t.closeEventsProcessed.includes(n)})),f.zo(t.queue)),k=(0,r.zG)(i.vP(v,b,w,n,c,a),i.Rp({closeEventsProcessed:f.cS,noQueueItemsProcessed:0,queue:f.cS},((t,n)=>{let[i,o,s,a,c,l]=n;return c?t:(0,r.zG)(t,(0,u.rO)({queue:f.zo(s())}),(t=>l?(0,r.zG)(t,(t=>n=>(0,r.zG)(n,I(t),F(e),(0,u.rO)({right:(0,u.bw)((0,r.ls)(f.UI((0,r.ls)((0,M.H5)((0,u.rO)({time:e=>e.toISOString()})),g.F2)),h))}),(e=>{let{left:t,right:i}=e;return(0,r.zG)(n,(0,u.rO)({closeEventsProcessed:(0,r.zG)(i,f.UI(M.li),f.zo),queue:(0,r.zG)(t.map(M.li),(e=>new Set(e)),(e=>f.hX((t=>{let[n]=t;return e.has(n)})))),noQueueItemsProcessed:e=>e+n.queue.length}))})))(a)):o>t.noQueueItemsProcessed||i===t.noQueueItemsProcessed+t.queue.length?(t=>((0,r.zG)(t.queue,j(e),A.UI(h))(),{closeEventsProcessed:t.closeEventsProcessed,noQueueItemsProcessed:t.noQueueItemsProcessed+t.queue.length,queue:f.cS}))(t):t))}))),E=(0,r.zG)(n,i.UI(I),i.ap(k),i.D8(f.Eh({equals:(e,t)=>e[0]===t[0]})));return{state:E,value:p}})),L=(e,t)=>e.permutiveUrls.getEndpointUrl("/batch/events",a.G(e.config.apiVersion),[["enrich",JSON.stringify(t.requiresEnrichment)],["sdkp",JSON.stringify(t.sdkProcessed)]]),$=e=>(0,r.zG)(e.events,f.UI((0,r.ls)(M.Yg,(e=>e.event)))),B=(0,r.ls)(m.vM((e=>{let[t,n]=e;return`${n.requiresEnrichment}${n.sdkProcessed}`})),(e=>Object.values(e)),f.UI((e=>({requiresEnrichment:e[0][1].requiresEnrichment,events:e,sdkProcessed:e[0][1].sdkProcessed})))),F=e=>(0,r.ls)(B,f.YO("request"),f.Hr("success",(t=>{let{request:n}=t;return e.logger.debug(R,"Uploading via beacon",n),e.permutiveApi.reqWithBeacon({url:L(e,n),payload:$(n)})})),f.tS((e=>(0,r.zG)(e.request.events,f.UI((t=>{let[n,{event:i}]=t;return e.success?g.F2((0,r.bc)(n,i)):g.t$((0,r.bc)(n,i))}))))),f.UI((0,u.bw)(g.EQ((t=>{let[,n]=t;return e.metrics.trackCounter({name:"sdk_event_beacon_fail_count_total",labels:{event_name:n.name},value:1})}),(t=>{let[,n]=t;return e.metrics.trackCounter({name:"sdk_event_beacon_success_count_total",labels:{event_name:n.name},value:1})})))),f.oh),j=e=>t=>(0,r.zG)(B(t),A.uU((t=>(0,r.zG)(t,(e=>t=>(e.logger.debug(R,"Uploading",t),x.Y3((()=>e.permutiveApi.req({payload:$(t),url:L(e,t),method:"POST",contentType:"text/plain",dataType:"json",withCredentials:!1})),(t=>(e.reportError(`Error sending events batch. Got ${g.KC(t)}`),t)))))(e),x.UI(f.UI((e=>e.body))),x.EQ((e=>(0,r.zG)(t.events,f.UI((()=>g.t$(e))))),f.UI(g.F2)),A.UI(f.$R(t.events))))),A.UI(f.tS(f.UI((t=>{let[n,[i,{event:o}]]=t;return(0,r.zG)(n,g.EQ((e=>g.t$((0,r.bc)(i,{event:{...o,time:o.time.toISOString()},error:e}))),(e=>"request_id"in e?g.t$((0,r.bc)(i,{event:{...o,time:o.time.toISOString()},error:e})):g.F2((0,r.bc)(i,{...o,id:e.id,time:e.time})))),(0,u.bw)(g.EQ((t=>{let[,{event:n}]=t;return e.metrics.trackCounter({name:"sdk_event_upload_fail_count_total",labels:{event_name:n.name},value:1})}),(t=>{let[,n]=t;return e.metrics.trackCounter({name:"sdk_event_upload_success_count_total",labels:{event_name:n.name},value:1})}))))}))))),N=e=>t=>(0,r.zG)(t,i.En(2,f.uZ()),(0,M.H5)(i.UI(T.UI(e)))),Y=(e,t,n,s)=>(0,r.zG)(o.K4((()=>{const[e,t]=i.Ue(i.a9(T.of([])));return{eventsToPublishBufferRef:i.xH(e),publishEvents:n=>{(0,r.zG)(i.vP(e.current,n),i.UI(T.RD),i.UI(T.UI(f.xH)),t)}}})),o.ak("eventUpload",(t=>{let{eventsToPublishBufferRef:r}=t;return q(e,r,n,s)})),o.ak("eventHandler",(e=>{let{eventUpload:t}=e;return n=t.successEventsAsJSON,s=t.erroredEventsAsJSON,o.K4((()=>{const e=new C;return(0,r.zG)(n,i.UI((e=>e())),i.bw((t=>t.forEach((t=>{let[,n]=t;return e.newEvent(n,null)}))))),(0,r.zG)(s,i.UI((e=>e())),i.bw((t=>t.forEach((t=>{let[,{event:n,error:r}]=t;return e.newEvent(n,r)}))))),{eventHandlerAfterUpload:e}}));var n,s})),o.ak("eventResolver",(e=>{let{eventUpload:n}=e;return((e,t,n,s)=>o.K4((()=>{(0,r.zG)(i.vP({unresolvedEvents:t,erroredEvents:s,successEvents:n}),i.UI((0,O.Yt)(T.G5)),i.Rp({},((e,t)=>{const n=t();return(0,r.zG)(n.unresolvedEvents,a.DT(f.Od),a.UI((0,r.ls)(v.sq,(t=>({...e,...t})))),a.fS((()=>e)),(e=>(0,r.zG)(n.successEvents,f.u4(e,((e,t)=>{let[n,i]=t;return(0,r.zG)(v.P5(n,e),a.UI((t=>(t.succeed(i),v.EG(n)(e)))),a.fS((()=>e)))})))),(e=>(0,r.zG)(n.erroredEvents,f.u4(e,((e,t)=>{let[n,{event:i,error:o}]=t;return(0,r.zG)(v.P5(n,e),a.UI((t=>(t.fail(`Failed to track ${i.name}. ${"error"in o?o.error.message:o.message}`),v.EG(n)(e)))),a.fS((()=>e)))})))))})))})))(0,t,n.successEvents,n.erroredEvents)})),o.UI((e=>{let{publishEvents:t,eventHandler:n}=e;return{eventHandlerAfterUpload:n.eventHandlerAfterUpload,publishEvents:t}}))),Q="_pnativo",K=function(e){let{externalData:t}=e;return o.K4((()=>{t.removeExternalData(Q)}))};var W,H,V,J,X,Z=-1,ee=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Z=t.timeStamp,e(t))}),!0)},te=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},ne=function(){var e=te();return e&&e.activationStart||0},re=function(e,t){var n=te(),r="navigate";return Z>=0?r="back-forward-cache":n&&(document.prerendering||ne()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},ie=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},oe=function(e,t,n,r){var i,o;return function(s){t.value>=0&&(s||r)&&((o=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},se=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ae=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},ue=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},ce=-1,le=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},de=function(e){"hidden"===document.visibilityState&&ce>-1&&(ce="visibilitychange"===e.type?e.timeStamp:0,pe())},fe=function(){addEventListener("visibilitychange",de,!0),addEventListener("prerenderingchange",de,!0)},pe=function(){removeEventListener("visibilitychange",de,!0),removeEventListener("prerenderingchange",de,!0)},ge=function(){return ce<0&&(ce=le(),fe(),ee((function(){setTimeout((function(){ce=le(),fe()}),0)}))),{get firstHiddenTime(){return ce}}},me=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},he=[1800,3e3],ve=[.1,.25],_e=function(e,t){t=t||{},function(e,t){t=t||{},me((function(){var n,r=ge(),i=re("FCP"),o=ie("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-ne(),0),i.entries.push(e),n(!0)))}))}));o&&(n=oe(e,i,he,t.reportAllChanges),ee((function(r){i=re("FCP"),n=oe(e,i,he,t.reportAllChanges),se((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))}(ue((function(){var n,r=re("CLS",0),i=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],n=o[o.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,o.push(e)):(i=e.value,o=[e])}})),i>r.value&&(r.value=i,r.entries=o,n())},a=ie("layout-shift",s);a&&(n=oe(e,r,ve,t.reportAllChanges),ae((function(){s(a.takeRecords()),n(!0)})),ee((function(){i=0,r=re("CLS",0),n=oe(e,r,ve,t.reportAllChanges),se((function(){return n()}))})),setTimeout(n,0))})))},be={passive:!0,capture:!0},ye=new Date,we=function(e,t){W||(W=t,H=e,V=new Date,Ee(removeEventListener),Ie())},Ie=function(){if(H>=0&&H<V-ye){var e={entryType:"first-input",name:W.type,target:W.target,cancelable:W.cancelable,startTime:W.timeStamp,processingStart:W.timeStamp+H};J.forEach((function(t){t(e)})),J=[]}},ke=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){we(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,be),removeEventListener("pointercancel",r,be)};addEventListener("pointerup",n,be),addEventListener("pointercancel",r,be)}(t,e):we(t,e)}},Ee=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,ke,be)}))},Se=[100,300],Pe=0,Ge=1/0,Ue=0,De=function(e){e.forEach((function(e){e.interactionId&&(Ge=Math.min(Ge,e.interactionId),Ue=Math.max(Ue,e.interactionId),Pe=Ue?(Ue-Ge)/7+1:0)}))},ze=function(){return X?Pe:performance.interactionCount||0},Ce=function(){"interactionCount"in performance||X||(X=ie("event",De,{type:"event",buffered:!0,durationThreshold:0}))},Te=[200,500],Oe=0,Me=function(){return ze()-Oe},xe=[],Ae={},Re=function(e){var t=xe[xe.length-1],n=Ae[e.interactionId];if(n||xe.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};Ae[r.id]=r,xe.push(r)}xe.sort((function(e,t){return t.latency-e.latency})),xe.splice(10).forEach((function(e){delete Ae[e.id]}))}},qe=[2500,4e3],Le={};const $e=function(e){let t=0;const n=n=>{if(0===t)return;const r=Be(n);r&&e.metrics.track({name:`sdk_web_vitals_${r.suffix}`,labels:{},value:r.value})},s=(0,u.HP)((()=>{_e(n),function(e,t){t=t||{},me((function(){var n,r=ge(),i=re("LCP"),o=function(e){var t=e[e.length-1];t&&t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-ne(),0),i.entries=[t],n())},s=ie("largest-contentful-paint",o);if(s){n=oe(e,i,qe,t.reportAllChanges);var a=ue((function(){Le[i.id]||(o(s.takeRecords()),s.disconnect(),Le[i.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,a,!0)})),ae(a),ee((function(r){i=re("LCP"),n=oe(e,i,qe,t.reportAllChanges),se((function(){i.value=performance.now()-r.timeStamp,Le[i.id]=!0,n(!0)}))}))}}))}(n),function(e,t){t=t||{},me((function(){var n,r=ge(),i=re("FID"),o=function(e){e.startTime<r.firstHiddenTime&&(i.value=e.processingStart-e.startTime,i.entries.push(e),n(!0))},s=function(e){e.forEach(o)},a=ie("first-input",s);n=oe(e,i,Se,t.reportAllChanges),a&&ae(ue((function(){s(a.takeRecords()),a.disconnect()}))),a&&ee((function(){var r;i=re("FID"),n=oe(e,i,Se,t.reportAllChanges),J=[],H=-1,W=null,Ee(addEventListener),r=o,J.push(r),Ie()}))}))}(n),function(e,t){t=t||{},me((function(){Ce();var n,r=re("INP"),i=function(e){e.forEach((function(e){e.interactionId&&Re(e),"first-input"===e.entryType&&!xe.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&Re(e)}));var t,i=(t=Math.min(xe.length-1,Math.floor(Me()/50)),xe[t]);i&&i.latency!==r.value&&(r.value=i.latency,r.entries=i.entries,n())},o=ie("event",i,{durationThreshold:t.durationThreshold||40});n=oe(e,r,Te,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),ae((function(){i(o.takeRecords()),r.value<0&&Me()>0&&(r.value=0,r.entries=[]),n(!0)})),ee((function(){xe=[],Oe=ze(),r=re("INP"),n=oe(e,r,Te,t.reportAllChanges)})))}))}(n)}));return o.K4((n=>{let{stopped:o}=n;t++,(0,r.zG)(o,i.YP((e=>{e&&t--}))),e.metrics.isEnabled()&&s()}))};const Be=e=>(e=>"CLS"===e.name)(e)?{value:e.value,suffix:`${e.name.toLowerCase()}_score`}:(e=>["INP","FID","LCP"].includes(e.name))(e)?{value:e.value/1e3,suffix:`${e.name.toLowerCase()}_seconds`}:void 0;var Fe=n(926);const je=(e,t)=>{const{activationManager:n,externalData:s,metrics:a,permutiveData:u}=e;return(0,r.zG)(o.of({}),o.ak("psegs",(()=>((e,t)=>o.K4((n=>{let{stopped:o}=n;const s="_psegs";(0,r.zG)(i.vP(t,o),i.YP((t=>{let[n,i]=t;i||(0,r.zG)(n,f.EQ((()=>e.removeExternalData(s)),(t=>e.setExternalJsonData(s,t))))})))})))(e.externalData,t.qlSegments))),o.ak("webVitals",(()=>$e(e))),o.ak("nativo",(()=>K({activationManager:n,externalData:s,metrics:a,queryLanguageCohorts:t.qlSegments,...t}))),o.ak("twitterPixel",(()=>(0,Fe.eJ)({activationManager:n,metrics:a,permutiveData:u,queryLanguageCohorts:t.qlSegments,...t}))),o.ak("prebidJS",(()=>(0,y.dN)(e))))};var Ne=n(5619);const Ye=()=>{const[e,t]=i.gS(f.uZ());return{trackEvent:e=>{let n,r,{event:i,useBeacon:o}=e;const s=new Promise(((e,t)=>{n=e,r=t}));return t([{localId:(0,u.k$)(),event:i,fail:r,succeed:n,useBeacon:o}]),s},trackedEvents:e}};n(4564);const Qe=function(e,t){return o.K4((()=>({addon:()=>({}),cohorts:i.a9(a.YP)})))};const Ke=(e,t)=>o.vP({contextual:Qe(e,t)}),We=function(e,t,n){return o.of({replacementMap:i.a9(a.of({$privacy_sandbox_topics_v2:[]}))})};i.a9([]),i.a9([]),i.a9([]),i.a9(Ne.b()),i.a9(a.YP),i.a9({segmentsEntered:[],segmentsExited:[]}),i.a9(!1),i.a9((e=>{let{event:t}=e;return Promise.resolve(t)})),new C,i.a9(a.YP),i.a9(!1);function He(e,t,n){const{addonsLoaded:c,consent:l,currentTimestampSecs:d,enabledAddons:p,identities:g,sdkVariant:m,sessionId:h,userId:v,userIdIsNewlyGenerated:_,viewId:b,pageviewState:y}=t,[w,I]=(0,r.zG)(i.Ue(i.a9(f.cS)),(e=>{let[t,n]=e;return[i.xH(t),n]})),k=a.ij(e.permutiveData.getData("event-source-id")),S=(0,r.zG)(v,i.Rp(-1,(e=>e+1)),i.UI((t=>(0,r.zG)(k,a.hX((()=>0===t)),a.fS((()=>{const t=(0,u.k$)();return e.permutiveData.setData("event-source-id",t),t}))))));return(0,r.zG)(o.vP({computeTimeMetrics:(P=e.metrics,o.K4((e=>{let{stopped:t}=e;const n=(0,s.HJ)((()=>{(0,r.zG)((0,s.iE)(),(0,u.bw)((()=>(0,s.ho)(!1))),f.UI((e=>{let[t,n]=e;return(n-t)/1e3})),(e=>{P.track({name:"sdk_ui_thread_compute_first10s_total_seconds",value:e.reduce(((e,t)=>e+t),0),labels:{}}),P.track({name:"sdk_ui_thread_compute_first10s_total_task_overrun_seconds",value:(0,r.zG)(e,f.hX((e=>e>.05)),f.UI((e=>e-.05)),f.u4(0,((e,t)=>e+t))),labels:{}}),P.track({name:"sdk_ui_thread_compute_first10s_longest_task_seconds",value:Math.max(0,...e),labels:{}})}))}),1e4);(0,r.zG)(t,i.YP((e=>e&&n())))}))),audiences:Ke(e,t),privacySandboxTopics:We(e,h,l)}),o.UI((e=>{const{reset:t,trackEvent:n,trackedEvents:o}=((e,t)=>{const[n,o]=i.Ue(0),s=(0,r.zG)(i.vP(n,t),i.UI((()=>[]))),a=(0,r.zG)(i.vP(s,e),i.D8(((e,t)=>{let[,n]=e,[,r]=t;return n===r})),i.UI((e=>{let[t]=e;const n=Ye();return t.forEach(n.trackEvent),n})));return{reset:()=>o(n.current+1),trackEvent:(0,r.zG)(i.vP(a,s),i.UI((e=>{let[t,n]=e;return e=>(n.push(e),t.trackEvent(e))}))),trackedEvents:(0,r.zG)(a,i.VS((e=>e.trackedEvents)))}})(v,b),[s,a,u]=(0,r.zG)(o,i.En(3,f.uZ()));return{...e,reset:t,trackEvent:n,unresolvedEvents:(0,r.zG)(s,i.UI(T.UI(f.UI((e=>(0,r.bc)(e.localId,{fail:e.fail,succeed:e.succeed})))))),eventsToProcessLocally:(0,r.zG)(a,i.UI(T.UI(f.hX((e=>!e.useBeacon))))),eventsToUploadViaBeacon:(0,r.zG)(u,i.UI(T.UI(f.hX((e=>e.useBeacon)))))}})),o.ak("eventPublication",(n=>{let{unresolvedEvents:r}=n;return Y(e,r,w,t.sdkClosing)})),o.ak("core",(s=>{let{audiences:u,eventPublication:c,eventsToProcessLocally:p,privacySandboxTopics:m}=s;return(0,r.zG)(n({contextualCohorts:u.contextual.cohorts,consent:l,currentTimestampSecs:d,enrichmentReplacementMap:m.replacementMap,eventSourceId:S,identities:g,newEvents:(0,r.zG)(p,i.UI(T.UI(f.UI((e=>(0,r.bc)(e.localId,e.event)))))),sessionId:h,userId:v,userIdIsNewlyGenerated:_,viewId:b,webClient:t.webClient,pageviewState:y}),o.bw((e=>{let{eventsToPublish:t}=e;return(0,r.zG)(t,i.UI(T.UI(Ve)),c.publishEvents)})),o.bw((e=>{let{eventsToPublishOnPageUnload:t}=e;return(0,r.zG)(t,i.UI(Ve),I)})),o.bw((t=>{let{externalData:n}=t;return(0,r.zG)(n,i.UI((t=>(0,r.zG)(Object.entries(t),f.UI((t=>{let[n,i]=t;return(0,r.zG)(i,a.EQ((()=>e.externalData.removeExternalData(n)),(t=>e.externalData.setExternalJsonData(n,t))))}))))))})),o.bw((t=>{let{context:n}=t;return(0,r.zG)(n,i.UI((t=>{const n=Object.entries(t);e.clientContext.updateContext(...n)})))})))})),o.bw((e=>{let{core:n,eventPublication:o,eventsToUploadViaBeacon:s}=e;return(0,r.zG)(i.vP({cohorts:n.cohorts.all,eventsIO:s,segments:n.cohorts.ql,sessionId:h,userId:v,viewId:b,webClient:t.webClient}),i.UI((e=>{let{webClient:t,...n}=e;return(0,r.zG)(t,a.UI((e=>({...n,webClient:e}))))})),i.UI(a.EQ((()=>T.of(f.bM())),(e=>{let{cohorts:t,eventsIO:n,segments:i,sessionId:o,userId:s,viewId:a,webClient:u}=e;return(0,r.zG)(n,T.UI(f.UI((e=>{let{event:n,localId:c}=e;return(0,r.bc)(c,{requiresEnrichment:!0,sdkProcessed:!1,event:{user_id:s,name:n.name,segments:i,cohorts:t,properties:{...n.properties,client:{...u,...n.properties.client??{}}},session_id:o,time:new Date,view_id:a}})}))))}))),o.publishEvents)})),o.ak("metricContext",(e=>{let{core:n}=e;return(0,r.zG)(n.geoIP,i.UI(a.tS((e=>{var t;return a.ij(null===(t=e.geo_info)||void 0===t?void 0:t.continent)}))),(e=>Ne.X({continent:e,sampleRate:t.metricSampleRate,sdkVariant:m,sessionId:h,userId:v,viewId:b})))})),o.ak("sdkql",(t=>{let{core:n}=t;return je(e,{addonsLoaded:c,consent:l,initdAddons:p,qlSegments:n.cohorts.ql})})),o.ak("strategicPartnerships",(t=>{let{sdkql:n}=t;return((e,t)=>o.vP({prebid_identifiers:G(e,t)}))(e,{pbjs:(0,r.zG)(n.prebidJS,i.UI((e=>(0,r.zG)(e.mainPair,a.UI((e=>e.pbjs))))))})})),o.ak("mediaAndEntertainment",(t=>{let{core:n}=t;return((e,t)=>(0,r.zG)(o.vP({freewheel:U({activationManager:e.activationManager,externalData:e.externalData,...t})}),o.UI((0,r.a9)({}))))(e,{addonsLoaded:c,consent:l,initdAddons:p,queryLanguageCohorts:n.cohorts.ql})})),o.ak("advertisers",(t=>{let{sdkql:n}=t;return((e,t)=>(0,r.zG)(o.of(t),o.ak("prebidMonitoring",(t=>{let{consent:n,prebidJS:r}=t;return E(e,i.vP({consent:n,prebidJS:r}))})),o.UI(r.Q1)))(e,{consent:l,prebidJS:n.prebidJS})})),o.UI((e=>{let{core:t,audiences:n,metricContext:r,sdkql:o,trackEvent:s,eventPublication:a,strategicPartnerships:u,reset:c}=e;return{activations:t.activations,addons:{contextual:n.contextual.addon},metricContext:r,pbjsPair:i.UI((e=>e.mainPair),o.prebidJS),queryLanguageCohorts:{all:t.cohorts.ql,custom:t.cohorts.qlCustom,standard:t.cohorts.qlStandard},segmentTransitionsSinceInit:t.transitionsSinceInit,trackEvent:s,realtime:t.realtime,eventHandlerAfterUpload:a.eventHandlerAfterUpload,prebidIdentifiers:u.prebid_identifiers,reset:c,stateMigratedThisInitialisation:t.stateMigratedThisInitialisation}})));var P}const Ve=f.UI((0,M.H5)((e=>({event:e,requiresEnrichment:!1,sdkProcessed:!0}))));function Je(e){return(0,r.ls)((0,u.rO)({previousState:e=>{if("string"!=typeof e)return{};try{return JSON.parse(e)}catch{return{}}}}),e,(0,u.rO)({state:i.UI(JSON.stringify)}))}function Xe(e){const t=function(e){const{activationManager:t,api:n,clientContext:r,config:i,externalData:o,logger:s,metrics:a,permutiveData:u,network:c,urls:l,namespace:d,trace:f}=e;return{activationManager:t,api:n,clientContext:r,config:i,externalData:o,logger:s,metrics:a,permutiveData:u,permutiveApi:c,permutiveUrls:l,reportError:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n.reportError(e,null==t?void 0:t.userId,null==t?void 0:t.timestamp)},namespace:d,trace:f}}(e),n=function(e){const t={addonsLoaded:e.addonsLoaded,consent:(n=e.consentTracking,(0,r.zG)(n,a.EQ((()=>i.a9(!0)),(e=>e.consentRef)))),currentTimestampSecs:l(),enabledAddons:c(e),identities:e.identities,sdkClosing:d(),metricSampleRate:e.config.metricsSamplingPercentage/100,sdkVariant:a.ij(e.sdkVariant),sessionId:i.a9(e.sessionManager.getSessionId()),userId:e.userId.ref,userIdIsNewlyGenerated:e.userId.isNewlyGenerated,viewId:e.viewId.ref,pageviewState:e.pageviewState,webClient:e.webClient};var n;return t}(e);return function(e,t,n,a){const c=5e3;return(0,r.zG)(e,function(e,t){return n=>o=>{const{value:a,state:u}=n(o),[c,l]=i.Ue(u.current),d=(0,s.UM)((()=>l(u.current)),e),f=(0,r.zG)(i.vP(u,c),i.UI((e=>{let[t,n]=e;return t===n})));return(0,r.zG)(t,i.bw((e=>e&&d()))),{value:(0,r.bc)(f,a),state:(0,r.zG)(i.vP(t,u,c),i.UI((e=>{let[t,n,r]=e;return t?n:r})))}}}(c,a),Je,function(e){return t=>(0,r.ls)((0,u.rO)({previousState:t=>e.current?t:void 0}),t,(0,u.rO)({state:(0,r.ls)((t=>i.vP(e,t)),i.UI((e=>{let[t,n]=e;return t?n:void 0})))}))}(n),function(e){return t=>(0,r.ls)((0,u.rO)({previousState:()=>localStorage.getItem(e)}),t,(0,u.rO)({state:(0,u.bw)(i.YP((t=>{switch(typeof t){case"string":localStorage.setItem(e,t);break;case"undefined":localStorage.removeItem(e);break;case"object":if(null===t){localStorage.removeItem(e);break}throw new Error("Permutive app raised an invalid state.");default:throw new Error("Permutive app raised an invalid state.")}})))}))}(t),o.UI((e=>{let[t,n]=e;return n})))({stopped:i.a9(!1)}).value}(He(t,n,e.core),e.namespace.getNamespacedStorageKey("permutive-app"),n.consent,n.sdkClosing)}},2233:(e,t,n)=>{n.d(t,{iq:()=>d,B9:()=>g,ti:()=>h});var r=n(2688),i=n(787),o=n(365),s=n(2884),a=n(3735),u=n(2652);var c=n(3030);const l="__permutive.",d="__permutiveConfigQueryParams";const f={default:{windowKey:"permutive",environment:"default",apiHost:"api.permutive.com",apiKey:"",apiProtocol:"https",cdnBaseUrl:"cdn.permutive.com",cdnProtocol:"https",pxidHost:"prmutv.co",apiVersion:"v2.0",sdkErrorsApiVersion:"v2",advertiserApiVersion:"v2",classificationModelsApiVersion:"v1",loggingEnabled:!1,tracingEnabled:!1,requestTimeout:5e3,cookieDomain:"."+(0,c._Y)(window.location.hostname),cookieName:"permutive-id",cookieExpiry:function(){const e=new Date;return e.setMonth(e.getMonth()+6),e.toUTCString()}(),eventsTTLInDays:null,permutiveDataMiscKey:"permutive-data-misc",permutiveDataQueriesKey:"permutive-data-queries",stateNamespace:"",sendClientErrors:!0,metricsSamplingPercentage:20,eventsCacheLimitBytes:25e5,segmentSyncApiHost:"88980e3a-6890-4e52-bcc1-3154ab2a17c7.partner.permutive.app",consentRequired:!1,sdkType:"stable",viewId:null,localStorageDebouncedKeys:[],localStorageWriteDelay:1e3,localStorageWriteMaxDelay:1500,watson:{enabled:!0}},production:{},development:{apiProtocol:"http",loggingEnabled:!0,tracingEnabled:!0,sendClientErrors:!1}},p=e=>{const t={consentRequired:!0,loggingEnabled:!0,sendClientErrors:!0,tracingEnabled:!0},n={eventsTTLInDays:!0,eventsCacheLimitBytes:!0,metricsSamplingPercentage:!0,requestTimeout:!0,localStorageWriteDelay:!0,localStorageWriteMaxDelay:!0};return Object.keys(e).reduce(((r,i)=>{if(t.hasOwnProperty(i)){const t="true"===e[i];return{...r,[i]:t}}if(n.hasOwnProperty(i)){const t=Number(e[i]);return isNaN(t)?r:{...r,[i]:t}}return{...r,[i]:e[i]}}),{})},g=function(){let{getQueryParams:e=c.zM}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e=>Object.entries(e).reduce(((e,t)=>{let[n,r]=t;if(!(0===n.indexOf(l)))return e;const i=n.replace(l,"");return[...e,[i,r]]}),[]);return(0,a.zG)(o.Y3((()=>(0,a.zG)(e(),t,(e=>(0,u.m8)(...e)),p,(e=>m({queryConfig:e})))),(e=>`Failed to parse query params. Got ${(0,r.w)(e).message}`)))},m=e=>{let{queryConfig:t}=e;const n=(0,a.zG)(s.Y3((()=>window.sessionStorage.getItem(d))),s.tS(s.ij),s.tS((0,a.ls)(i.A,s.ij)),s.fS((()=>({}))));return(0,u.PM)(n,t)},h=(e,t)=>{const n=(e.environment&&f[e.environment])??{};return(0,u.PM)(f.default,n,e,t)}},4564:(e,t,n)=>{n.d(t,{NY:()=>m,vk:()=>f,qA:()=>d});var r=n(2688),i=n(365),o=n(3735),s=n(2707),a=n(8259),u=n(1410),c=n(2851);var l=n(30);const d=()=>({opt_in:!0,token:u.L}),f=()=>({opt_in:!1,token:""}),p=e=>{return(0,o.ls)((t=e,e=>(0,o.zG)((0,l.J)(t.consentRequired,e),(e=>{let{consentData:n,isValid:r}=e;return t.consentDatabase.put(n,u.L),r}))),(e=>{let{logger:t,messages:n}=e;return e=>{const r=e?"given":"revoked";return t.log("Consent has been",r),n.emit(`permutive:consent:${r}`),e}})(e));var t},g=e=>(t,n)=>{e.on("permutive:consent:revoked",t),e.on("permutive:consent:given",n)},m=async e=>{const{logger:t,namespace:n,consentRequired:d,messages:f}=e,m=new a.oP(window.localStorage,n),h=(0,l.J)(d,await m.get(u.L)),v=await(0,o.zG)(s.Y3((()=>m.put(h.consentData,u.L)),(e=>new Error(`LocalStorage access is required. ${(0,r.w)(e).message}`))),(e=>e()));if(i.nM(v))return v;const{consentRef:_,giveConsent:b,revokeConsent:y,isRevoked:w,isGiven:I}=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const[t,n]=c.Ue(e),r=()=>!0===t.current;return{consentRef:t,revokeConsent:()=>(n(!1),t.current),giveConsent:()=>(n(!0),t.current),isRevoked:()=>!r(),isGiven:r}}(h.isValid),k={consentRef:_,isGiven:I,isRevoked:w,listenForConsent:g(f)};k.listenForConsent(y,b);const E=p({consentDatabase:m,consentRequired:d,logger:t,messages:f});return i.F2({consentTracking:k,consentValidation:E,consentDatabase:m})}},1410:(e,t,n)=>{n.d(t,{L:()=>r});const r="permutive-consent"},4769:(e,t,n)=>{n.d(t,{v:()=>r});const r=(e,t,n)=>function(){const r=n()?t:e;return r(...arguments)}},30:(e,t,n)=>{n.d(t,{J:()=>s});var r=n(3735),i=n(2884),o=n(4564);const s=(e,t)=>(0,r.zG)((0,i.ij)(t),(t=>!1===e&&(0,i.Wi)(t)?{isValid:!0,consentData:(0,o.qA)()}:(e=>(0,i.pC)(e)&&(e=>null!==e&&"object"==typeof e)(e.value)&&(e=>{var t;return!0===e.opt_in&&"string"==typeof e.token&&(null===(t=e.token)||void 0===t?void 0:t.length)>0})(e.value))(t)?{isValid:!0,consentData:t.value}:{isValid:!1,consentData:(0,o.vk)()}))},589:(e,t,n)=>{n.d(t,{S:()=>h});var r=n(3735),i=n(2884),o=n(5851),s=n(2851),a=n(8612),u=n(2497),c=n(8771),l=n(2652);class d{wait_prev;block_next;task;started;complete;constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.wait_prev=t.wait_prev||!1,this.block_next=t.block_next||!1,this.started=!1,this.complete=!1,this.task=e}waits(){return this.wait_prev}blocks(){return this.block_next}execute(e){this.started=!0,this.task((()=>{this.complete=!0,e()}))}}var f=n(6315);n(7305);class p{logger;api;activationManager;sessionManager;metrics;viewId;userId;network;clientContext;unprocessedEvents;taskQueue;identities;permutiveReset;messages;addons;trace;permutiveRealtime;state;customProperties;config;permutiveData;externalData;cookies;identitiesIngestor;global;nextGen;pageviewState;initialisedAddons=[];tcf;constructor(e,t,n,r,i,o,s,a,c,l,d,f,p,g,m,h,v,_,b,y,w,I,k,E,S,P,G){this.logger=e,this.api=t,this.activationManager=n,this.sessionManager=r,this.metrics=i,this.viewId=o,this.userId=s,this.network=a,this.clientContext=c,this.unprocessedEvents=l,this.taskQueue=d,this.identities=f,this.permutiveReset=p,this.messages=g,this.addons=m,this.trace=h,this.permutiveRealtime=v,this.state=_,this.customProperties=b,this.config=y,this.permutiveData=w,this.externalData=I,this.cookies=k,this.identitiesIngestor=E,this.global=S,this.nextGen=P,this.pageviewState=G,this.tcf=(0,u.SD)(window,this.logger)}identify(e){const t="[Identify]";this.logger.debug("<call> identify",e);const n=(0,l.b2)(),{left:s,right:u}=this.identities.parseCustomerDefinedIdentities(e);if(s.length>0)throw new Error(s.join(" "));const c={...this.identities.getIdentitiesMap(),...u.reduce(((e,t)=>{let{tag:n,id:r,priority:i,expiry:o}=t;return{...e,[n]:{id:r,...void 0!==i?{priority:i}:{},...void 0!==o?{expiry:o}:{}}}}),{})},p=(0,r.zG)(Object.values(c),o.DZ((e=>i.ij(e.id)))),g=this.identities.getPrioritizedIdentities(c);if("string"==typeof e&&(0,a.Bt)("88980e3a-6890-4e52-bcc1-3154ab2a17c7","88980e3a-6890-4e52-bcc1-3154ab2a17c7",p,window.location.hostname,this.userId.get()))return n.resolve(),n.promise;const m=async e=>{await(0,f.Yj)({clientContext:this.clientContext,global:this.global,identities:this.identities,logger:this.logger,reset:this.permutiveReset,userId:this.userId},e.user_id)};return this.taskQueue.add(new d((async e=>{this.logger.debug("<task> identify",u);const r=async()=>{this.logger.log(t,"request identity");const e=await this.api.identify(this.metrics,this.userId,g);this.userId.isEqual(e.user_id)?this.metrics.track({name:"sdk_identity_remained_total",value:1,labels:{identify_reason:"identify_call"}}):(this.metrics.track({name:"sdk_identity_changed_total",value:1,labels:{identify_reason:"identify_call"}}),await m(e))};this.identities.setIdentities(u).identifyRequestRequired()?await r():this.logger.log(t,"skip request"),this.logger.debug("<done> identify",u),e(),n.resolve(),await this.identitiesIngestor.ingestIfEligible(u).catch((e=>this.api.reportError(`Couldn't ingest identities, got ${e}`,this.userId.get())))}),{wait_prev:!0,block_next:!0})),n.promise}on(e,t){return this.nextGen.eventHandlerAfterUpload.addListener({name:e,callback:t,once:!1})}once(e,t){return this.nextGen.eventHandlerAfterUpload.addListener({name:e,callback:t,once:!0})}pageviewTracked=!1;track(){const[e,t,n]=[arguments.length<=0?void 0:arguments[0],(arguments.length<=1?void 0:arguments[1])||{},(arguments.length<=2?void 0:arguments[2])||{}],r=this.trace.startSpan(`track("${e}")`);this.logger.log("<call> track",e);const i=(0,l.b2)();this.pageviewTracked||"Pageview"!==e||(this.pageviewTracked=!0,this.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"pageview_tracked",time_origin:"sdk_init"})),this.metrics.trackCounter({name:"sdk_event_track_count_total",labels:{event_name:e},value:1}),i.promise.then((()=>{this.metrics.trackCounter({name:"sdk_event_track_success_count_total",labels:{event_name:e},value:1}),r.finish()}),(()=>{this.metrics.trackCounter({name:"sdk_event_track_fail_count_total",labels:{event_name:e},value:1}),r.finish()}));const o=n.unprocessedData??{},s=o.sessionId??this.sessionManager.getSessionId(),a=o.viewId??this.viewId.get(),u={success:n.success||(e=>{}),error:n.error||((e,t)=>{})};return this.taskQueue.add(new d((r=>{this.logger.log("<task> track",e);return(o.client?Promise.resolve(o.client):this.clientContext.getClient()).then((o=>{const c={name:e,properties:{...t,client:t.client?(0,l.PM)(o,t.client):o},session_id:s,view_id:a,time:new Date};return this.nextGen.trackEvent.current({event:c,useBeacon:n.useBeacon??!1}).then((e=>{this.logger.log("<done> track",c.name),u.success(e),i.resolve(c),r()})).catch((e=>{u.error(e),this.api.reportError(e,this.userId.get()),i.reject(e)}))}))}))),i.promise}trigger(e,t,n){const r=(0,l.b2)();this.logger.log("<call> trigger",e);const i=t=>(i,o)=>{if(i.properties.segment_number===e){const s={result:t};this.logger.debug("<fire> trigger",{event:i,error:o,segmentCode:e,payload:s}),n(s),r.resolve(s)}};return this.nextGen.eventHandlerAfterUpload.addListener({name:"SegmentEntry",callback:i(!0),once:!1}),this.nextGen.eventHandlerAfterUpload.addListener({name:"SegmentExit",callback:i(!1),once:!1}),this.logger.log("<done> trigger",e),r.promise}query(){return Promise.resolve({result:!1})}segment(e,t){const n=(0,l.b2)();this.logger.log("<call> segment",e);return this.taskQueue.add(new d((r=>{this.logger.log("<task> segment",e);const i=this.nextGen.queryLanguageCohorts.all.current.includes(e)||!1;t(i),n.resolve(),this.logger.log("<done> segment",e),r()}))),n.promise}segments(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";const n=(0,l.b2)();this.logger.log("<call> segments");return this.taskQueue.add(new d((r=>{this.logger.log("<task> segments ("+t+")");const i=i=>{e(i),n.resolve(i),this.logger.log("<done> segments ("+t+")"),r()};"dfp"===t?this.messages.once("permutive:dfp:ready",(()=>{this.addons.dfp&&i([...this.addons.dfp.segments.liveSegments])})):i([...this.nextGen.queryLanguageCohorts.all.current])}))),n.promise}reset(){return Promise.all([this.api.reset(this.metrics),this.identities.reset(),this.permutiveReset.reset(),this.nextGen.reset(),this.userId.reset()]).then((()=>{this.messages.emit("permutive:reset")})).catch((e=>{this.api.reportError(`Error resetting internals. Got ${e}`)}))}addon(e,t){this.logger.debug("[Addon]",`Called for ${e}`,t);const o={...t,permutive:this,api:this.api,activationManager:this.activationManager,network:this.network,clientContext:this.clientContext,logger:this.logger,unprocessedEvents:this.unprocessedEvents,metrics:this.metrics,state:this.state,messages:this.messages,userId:this.userId,viewId:this.viewId,customProperties:this.customProperties,config:this.config,permutiveData:this.permutiveData,sessionManager:this.sessionManager,addons:this.addons,externalData:this.externalData,cookies:this.cookies,nextGenOutput:this.nextGen,identities:this.identities,pageviewState:this.pageviewState,tcf:this.tcf},a=(0,r.zG)(this.nextGen.pbjsPair,s.UI(i.UI((0,l.vg)("pbjs")))),u=e=>{this.initialisedAddons.push(e),this.messages.emit("permutive:addon:preinit",e)};if(-1===this.initialisedAddons.indexOf(e))switch(u(e),e){case"web":Promise.resolve().then(n.bind(n,4400)).then((e=>this.addons.web=new e.WebAddon(o))).then((()=>this.messages.emit("permutive:web:ready")));break;case"publishers":case"overlays":case"nativo":case"freewheel":case"facebook_pixel_v2":case"tiktok_pixel":case"eyeota_pixel":case"rubicon":case"rubicon_ssp":case"tracking_pixel":case"twitter_pixel":case"pinterest_pixel":case"local_storage":case"appnexus_adserver":case"classification_models":case"gam_log":case"smart":case"tradedesk":case"ddp":case"dbm":case"appnexus":case"pubmatic":case"ssp":0;break;case"scriptrunner":Promise.resolve().then(n.bind(n,7416)).then((e=>this.addons.scriptrunner=new e.ScriptRunnerAddon(o)));break;case"dfp":Promise.resolve().then(n.bind(n,9658)).then((async e=>this.addons.dfp=await e.createAddon(o)));break;case"prebid":Promise.resolve().then(n.bind(n,9581)).then((e=>this.addons.prebid=new e.PrebidAddon({...o,pbjs:a})));break;case"clean_room":Promise.resolve().then(n.bind(n,6726)).then((e=>this.addons.clean_room=new e.CleanRoomAddon({...o,pbjs:a,prebidIdentifiers:this.nextGen.prebidIdentifiers})))}else"web"===e&&!0!==t.auto_init&&(0,c.p)((()=>{if(!this.addons.web)throw new Error('"web" addon not ready');return this.addons.web.reset(t)}),"permutive:web:ready",this.messages).catch((e=>{this.api.reportError(`Got error while trying to reset web. Got ${e.message}`,this.state.userId.get())}))}ready(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"initialised";const n=(0,l.b2)(),r=()=>{e(),n.resolve()};switch(t){case"initialised":this.permutiveRealtime.isReady()?r():this.messages.on("permutive:ready",r);break;case"realtime":this.permutiveRealtime.isRealtime()?r():this.messages.once("permutive:realtime",r)}return n.promise}}var g=n(4769);const m=e=>{const{logger:t,consentTracking:n}=e,i=function(){return t.debug("Methods[track]: Cannot track as consent is revoked"),Promise.resolve(null)};return e=>class extends e{constructor(){super(...arguments),n.isRevoked()&&this.consentRevoked(),n.listenForConsent((()=>this.consentRevoked()),r.Q1)}async consentRevoked(){return await this.sessionManager.reset(),this.reset()}track=(0,g.v)(super.track.bind(this),i,n.isRevoked)}},h=(e,t,n,i,o,s,a,u,c,l,d,f,g,h,v,_,b,y,w,I,k,E,S,P,G,U,D,z)=>new((0,r.zG)(p,m({consentTracking:U,logger:e})))(e,t,n,i,o,s,a,u,c,l,d,f,g,h,v,_,b,y,w,I,k,E,S,P,G,D,z)},6315:(e,t,n)=>{n.d(t,{Yj:()=>u,TZ:()=>a});var r=n(2688),i=n(2652);var o=n(8612);const s=async e=>{await e.identities.thirdParty,await function(e,t){return(0,o.Bt)("88980e3a-6890-4e52-bcc1-3154ab2a17c7","88980e3a-6890-4e52-bcc1-3154ab2a17c7",e.identities.getPrioritizedIdentities(e.identities.getIdentitiesMap()).map((e=>e.id)),window.location.hostname,e.userId.get())?t.reset():Promise.resolve()}(e,e.permutiveMethods);const t=await function(e){const t=e.trace.startSpan("identify");0;return(async e=>{const t="[Identify Init]",{logger:n,api:r,userId:o,identities:s,metrics:a,identitiesIngestor:u,messages:c,sessionManager:l}=e,d=await s.thirdParty,f=s.extractIdentifyFromQueue(e),p={...s.getIdentitiesMap(),...f.reduce(((e,t)=>{let{tag:n,id:r,priority:i,expiry:o}=t;return{...e,[n]:{id:r,...o?{expiry:o}:{},...void 0!==i?{priority:i}:{}}}}),{})},g=s.setIdentities(Object.entries(p).map((e=>{let[t,{id:n,priority:r,expiry:i}]=e;return{tag:t,id:n,...i?{expiry:i}:{},...void 0!==r?{priority:r}:{}}})));s.setReady();const m=s.getPrioritizedIdentities(p);n.log("Begin identification");const h=e.sessionCount>1&&l.sessionHasChanged()||d.identifyRequestRequired()||g.identifyRequestRequired()?await(n.debug(t,"request identity"),r.identify(a,o,m).then((e=>{const r=e.user_id;return o.isEqual(r)?{identityChanged:!1}:(n.debug(t,"fetch received new user id",r),{identityChanged:!0,userId:r})})).catch((e=>(r.reportError(`${t} Fetch failed. Got ${e}`,o.get()),{identityChanged:!1}))).then((0,i.bw)((t=>e.metrics.track({name:`sdk_identity_${t.identityChanged?"changed":"remained"}_total`,value:1,labels:{identify_reason:"sdk_init"}}))))):(n.debug(t,"skip request"),{identityChanged:!1});return u.ingestIfEligible(m).catch((e=>r.reportError(`Couldn't ingest identities, got ${e}`,h.identityChanged?h.userId:o.get()))),c.emit("permutive:user:ready"),n.debug(t,"result",h),h})(e).catch((t=>(e.api.reportError(`Failed to identify. Got ${(0,r.w)(t)}`),{identityChanged:!1}))).then((e=>(t.finish(),e)))}(e);return t.identityChanged?await u(e,t.userId):e.logger.log("Identity has not changed"),t},a=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>{};s(e).then(t),c(e.global,e.clientContext)};async function u(e,t){e.logger.log("Identity has changed"),await e.reset.reset(),e.userId.set(t),c(e.global,e.clientContext),e.identities.setIdentities([])}function c(e,t){return e.context=t.getContext()}},5919:(e,t,n)=>{function r(e,t,n,r){r.debug("set SDK as ready"),e.emit("permutive:api:ready"),e.emit("permutive:queries:initialised"),t.track({name:"sdk_local_storage_byte_total",value:n.getStateSizeInBytes(),labels:{}}),r.warn("sdk_query_states_byte_total metric needs re-implementing")}n.d(t,{R:()=>r})},7078:(e,t,n)=>{n.d(t,{LA:()=>a});var r=n(5851),i=n(7209),o=n(2652);const s=(e,t,n)=>{let{api:r,state:i}=n;r.reportError(`Function "permutive.${t.functionName}" caused an error: ${e.message}`,i.userId.get())};function a(e,t,n,r,i,o){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:d;const c=u(e),l=o.startSpan("queued_methods"),f={api:i,state:t},p=e=>{if(e.functionName in n){n[e.functionName].apply(r,e.arguments)}else s(new Error("Does not exist."),e,f)},g=e=>!a.includes(e);c.forEach((e=>{try{g(e.functionName)&&p(e)}catch(t){const n=t instanceof Error?t:new Error("Unknown error.");s(n,e,f)}})),l.finish()}function u(e){const t=(0,r.uK)((e=>-1!==l.indexOf(e.functionName)))(e),n=t.right,s=t.left.filter((e=>"consent"!==e.functionName)),a=(0,i.Zt)(((e,t)=>c(e)&&c(t)?(0,o.lW)(f).compare(e.arguments[0],t.arguments[0]):(0,o.lW)(l).compare(e.functionName,t.functionName)));return(0,r.DY)(a)(n).concat(s)}const c=e=>"addon"===e.functionName,l=["identify","trigger","addon","track"],d=["identify"],f=["dfp","appnexus_adserver","web"]},7271:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{initialiseWebSDK:()=>initialiseWebSDK});var _permutive_permutive_utils_ts_error__WEBPACK_IMPORTED_MODULE_24__=__webpack_require__(2688),fp_ts_Option__WEBPACK_IMPORTED_MODULE_33__=__webpack_require__(2884),fp_ts_Either__WEBPACK_IMPORTED_MODULE_35__=__webpack_require__(365),fp_ts_function__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(3735),fp_ts_TaskEither__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(2707),_framework_ref__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(2851),_identity_legacy_NeustarFabrickIdentitiesIngestor__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(6967),_identity_legacy_PermutiveIdentities__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(8612),_identity_legacy_PermutiveIdentitiesIngestorNoOp__WEBPACK_IMPORTED_MODULE_27__=__webpack_require__(7658),_sdkql_blockers__WEBPACK_IMPORTED_MODULE_36__=__webpack_require__(122),_core_activations_PermutiveActivationManagerWeb__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(8975),_core_activations_PermutiveAddons__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(9853),_core_context_PermutiveClientContextWeb__WEBPACK_IMPORTED_MODULE_26__=__webpack_require__(2836),_sdkql_event_collection_events_cache_store_crypto_HashcodeDigest__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(6197),_sdkql_event_collection_events_cache_store_crypto_SHA256Digest__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(6272),_sdkql_event_collection_PermutiveEventCustomProps__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7748),_core_events_unprocessed_UnprocessedPrebidAuctions__WEBPACK_IMPORTED_MODULE_29__=__webpack_require__(1568),_core_metrics_MetricReporter__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(6478),_core_state_PermutiveRealtime__WEBPACK_IMPORTED_MODULE_28__=__webpack_require__(7575),_core_state_PermutiveReset__WEBPACK_IMPORTED_MODULE_30__=__webpack_require__(3898),_core_state_PermutiveStateWeb__WEBPACK_IMPORTED_MODULE_34__=__webpack_require__(7274),_core_state_PermutiveViewId__WEBPACK_IMPORTED_MODULE_23__=__webpack_require__(9880),_core_store_LocalStorage__WEBPACK_IMPORTED_MODULE_31__=__webpack_require__(7554),_core_tcf_TCF__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(2497),_dynamic_addons_LoadAddons__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(6037),_dynamic_messages_PermutiveMessages__WEBPACK_IMPORTED_MODULE_37__=__webpack_require__(9078),_http_PermutiveApi__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(7423),_utils_PermutiveUtils__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(2652),_utils_task_queue_PermutiveTaskQueue__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(4996),_utils_urls_UrlHelpers__WEBPACK_IMPORTED_MODULE_25__=__webpack_require__(3030),_Config__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(2233),_initialisation_identity__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(6315),_initialisation_initialisationLifecycle__WEBPACK_IMPORTED_MODULE_38__=__webpack_require__(5919),_initialisation_queuedMethods__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(7078),_PermutiveMethodsWeb__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(589),_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(3992),fp_ts_Task__WEBPACK_IMPORTED_MODULE_32__=__webpack_require__(7407),main_core_store_SessionStorage__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(9332),main_http_PermutiveNetwork__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(7354);const prefix="[Initialisation Web]",initialiseWebSDK=_ref=>{let{cookieStore,consentModule,core,externalData,localStorage,logger,messages,metrics,namespace,pageviewState,partialTagWithKey,permutiveData,sessionManager,tag,trace,configFromQueryParams,urls,userId}=_ref;return(0,fp_ts_TaskEither__WEBPACK_IMPORTED_MODULE_21__.Y3)((async()=>{const windowKey=partialTagWithKey.key,permutiveGlobal=window[windowKey],config=tag.config,viewId=(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(pageviewState.ref,_framework_ref__WEBPACK_IMPORTED_MODULE_0__.UI((e=>e.viewId)),(e=>new _core_state_PermutiveViewId__WEBPACK_IMPORTED_MODULE_23__.W(e))),network=new main_http_PermutiveNetwork__WEBPACK_IMPORTED_MODULE_20__.E(metrics),sessionStorage=(0,main_core_store_SessionStorage__WEBPACK_IMPORTED_MODULE_19__.u)(namespace,logger,consentModule.consentTracking.consentRef),{consentTracking,consentValidation}=consentModule;(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(consentTracking.consentRef,_framework_ref__WEBPACK_IMPORTED_MODULE_0__.YP((e=>{e?sessionStorage.put(configFromQueryParams,_Config__WEBPACK_IMPORTED_MODULE_14__.iq).then(fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.Q1,(e=>{logger.warn(prefix,`Failed to cache "${_Config__WEBPACK_IMPORTED_MODULE_14__.iq}".`,(0,_permutive_permutive_utils_ts_error__WEBPACK_IMPORTED_MODULE_24__.w)(e))})):sessionStorage.delete(_Config__WEBPACK_IMPORTED_MODULE_14__.iq)}))),window[windowKey].consent=consentValidation;const context=(0,_utils_PermutiveUtils__WEBPACK_IMPORTED_MODULE_12__.PM)(tag.context||{},{path:window.location.pathname,url:(0,_utils_urls_UrlHelpers__WEBPACK_IMPORTED_MODULE_25__.bk)(window.location.href),referrer:(0,_utils_urls_UrlHelpers__WEBPACK_IMPORTED_MODULE_25__.bk)(document.referrer),view_id:viewId.get()}),createInternalsSpan=trace.startSpan("internals"),clientContext=new _core_context_PermutiveClientContextWeb__WEBPACK_IMPORTED_MODULE_26__.z(context);(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(viewId.ref,_framework_ref__WEBPACK_IMPORTED_MODULE_0__.YP((e=>clientContext.updateContext(["view_id",e])))),(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(userId.ref,_framework_ref__WEBPACK_IMPORTED_MODULE_0__.YP((e=>clientContext.updateContext(["user_id",e]))));const api=new _http_PermutiveApi__WEBPACK_IMPORTED_MODULE_11__.F(urls,config,network,metrics,logger),identityProviderEnv={permutive:permutiveGlobal,network,api,userId,metrics,permutiveData,messages,config,cookies:cookieStore,logger},identities=new _identity_legacy_PermutiveIdentities__WEBPACK_IMPORTED_MODULE_2__.lg(metrics,trace,permutiveData,identityProviderEnv,logger),identitiesIngestor=new _identity_legacy_PermutiveIdentitiesIngestorNoOp__WEBPACK_IMPORTED_MODULE_27__.z,permutiveRealtime=new _core_state_PermutiveRealtime__WEBPACK_IMPORTED_MODULE_28__.u(trace,metrics,messages),unprocessedArgs={consent:consentTracking.consentRef,logger,namespace},unprocessedEvents={PrebidAuctions:new _core_events_unprocessed_UnprocessedPrebidAuctions__WEBPACK_IMPORTED_MODULE_29__.J(unprocessedArgs)},customProperties=new _sdkql_event_collection_PermutiveEventCustomProps__WEBPACK_IMPORTED_MODULE_7__.X,permutiveReset=new _core_state_PermutiveReset__WEBPACK_IMPORTED_MODULE_30__.a(config,localStorage,logger,permutiveData,cookieStore,externalData),taskQueue=new _utils_task_queue_PermutiveTaskQueue__WEBPACK_IMPORTED_MODULE_13__.i(messages),activationManager=new _core_activations_PermutiveActivationManagerWeb__WEBPACK_IMPORTED_MODULE_3__.v(logger,permutiveGlobal,clientContext),[addonsLoadedRef,setAddonsLoaded]=_framework_ref__WEBPACK_IMPORTED_MODULE_0__.Ue(!1),webClient=(()=>{const[e,t]=_framework_ref__WEBPACK_IMPORTED_MODULE_0__.Ue(Date.now());return(0,_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_18__.UM)((()=>t(Date.now())),1e3),(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(_framework_ref__WEBPACK_IMPORTED_MODULE_0__.vP(viewId.ref,e),_framework_ref__WEBPACK_IMPORTED_MODULE_0__.UI((()=>(0,_core_context_PermutiveClientContextWeb__WEBPACK_IMPORTED_MODULE_26__.k)())),_framework_ref__WEBPACK_IMPORTED_MODULE_0__.D8(((e,t)=>e===t||JSON.stringify(e)===JSON.stringify(t))))})(),eventCacheStoreFactory=()=>(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)((0,_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_18__.N1)((0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)((0,fp_ts_TaskEither__WEBPACK_IMPORTED_MODULE_21__.Y3)((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,9381))),String),trace.traceTask("import-DBStore-main-thread"))),(0,fp_ts_TaskEither__WEBPACK_IMPORTED_MODULE_21__.UI)((e=>{let{DBStore:t}=e;return new t((0,_core_store_LocalStorage__WEBPACK_IMPORTED_MODULE_31__.E)(namespace,logger,consentTracking.consentRef))}))),eventsCacheFactory=()=>(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)((0,_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_18__.SF)((0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)((0,fp_ts_TaskEither__WEBPACK_IMPORTED_MODULE_21__.Y3)((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,5717))),String),trace.traceTask("import-events-cache"))),(0,fp_ts_TaskEither__WEBPACK_IMPORTED_MODULE_21__.tS)((e=>{let{EventsCache:t}=e;return(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(t.initialise(config,logger,(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};api.reportError(e,null==t?void 0:t.userId,null==t?void 0:t.timestamp)}),trace,metrics,userId.ref,eventCacheStoreFactory),trace.traceTask("initialise-events-cache-main-thread"))}))),nextGen=await(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)((0,_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_18__.SF)((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,2520)))),trace.traceTask("import-next-gen"),fp_ts_Task__WEBPACK_IMPORTED_MODULE_32__.Qt("configureCore",core),fp_ts_Task__WEBPACK_IMPORTED_MODULE_32__.UI((e=>{let{runNextGenFeatures:t,configureCore:n}=e;return t({activationManager,addonsLoaded:addonsLoadedRef,api,clientContext,config,consentTracking:fp_ts_Option__WEBPACK_IMPORTED_MODULE_33__.G(consentTracking),core:n({eventsCacheFactory,migratedStateMaps:()=>({internal:(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(permutiveData.getData("internal_query_states"),fp_ts_Option__WEBPACK_IMPORTED_MODULE_33__.DT(_utils_PermutiveUtils__WEBPACK_IMPORTED_MODULE_12__.Kn)),external:(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(permutiveData.getData("external_query_states"),fp_ts_Option__WEBPACK_IMPORTED_MODULE_33__.DT(_utils_PermutiveUtils__WEBPACK_IMPORTED_MODULE_12__.Kn))})}),externalData,identities:identities.ref,logger,messages,metrics,namespace,network,permutiveData,sessionManager,urls,userId,viewId,pageviewState:pageviewState.ref,trace,webClient:(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(webClient,_framework_ref__WEBPACK_IMPORTED_MODULE_0__.UI(fp_ts_Option__WEBPACK_IMPORTED_MODULE_33__.of))})})))();(0,_core_metrics_MetricReporter__WEBPACK_IMPORTED_MODULE_8__.p)({api,context:nextGen.metricContext,logger,messages,metrics});const state=new _core_state_PermutiveStateWeb__WEBPACK_IMPORTED_MODULE_34__.u(permutiveData,permutiveReset,userId,viewId,logger),addons={},permutiveMethods=(0,_PermutiveMethodsWeb__WEBPACK_IMPORTED_MODULE_17__.S)(logger,api,activationManager,sessionManager,metrics,viewId,userId,network,clientContext,unprocessedEvents,taskQueue,identities,permutiveReset,messages,addons,trace,permutiveRealtime,state,customProperties,config,permutiveData,externalData,cookieStore,identitiesIngestor,permutiveGlobal,consentTracking,nextGen,pageviewState);createInternalsSpan.finish(),[].forEach((s=>{fp_ts_Either__WEBPACK_IMPORTED_MODULE_35__.Y3((()=>eval(s)),(e=>{api.reportError({...e,message:`Error running custom script ${s}`},userId.get())}))}));const blockers=(0,_sdkql_blockers__WEBPACK_IMPORTED_MODULE_36__.X)({logger,messages});blockers.addBlocker("permutive:queries:initialised");const initialIdentifyResult=(0,_utils_PermutiveUtils__WEBPACK_IMPORTED_MODULE_12__.b2)();let globalIdentifyBound=!1;messages.on("permutive:user:ready",(()=>{permutiveGlobal.identify=permutiveMethods.identify.bind(permutiveMethods),globalIdentifyBound=!0;const e=identities.extractIdentifyFromQueue({global:permutiveGlobal});e.length>0?initialIdentifyResult.resolve(permutiveGlobal.identify(e)):initialIdentifyResult.resolve()})),messages.on("permutive:blockers:empty",(()=>{if(!globalIdentifyBound){const e=permutiveGlobal.identify;permutiveGlobal.identify=t=>(e(t),initialIdentifyResult.promise)}permutiveGlobal.on=permutiveMethods.on.bind(permutiveMethods),permutiveGlobal.once=permutiveMethods.once.bind(permutiveMethods),permutiveGlobal.track=permutiveMethods.track.bind(permutiveMethods),permutiveGlobal.trigger=permutiveMethods.trigger.bind(permutiveMethods),permutiveGlobal.query=permutiveMethods.query.bind(permutiveMethods),permutiveGlobal.segment=permutiveMethods.segment.bind(permutiveMethods),permutiveGlobal.segments=permutiveMethods.segments.bind(permutiveMethods),permutiveGlobal.reset=permutiveMethods.reset.bind(permutiveMethods),permutiveGlobal.ready=permutiveMethods.ready.bind(permutiveMethods),permutiveGlobal.addon=permutiveMethods.addon.bind(permutiveMethods),permutiveGlobal.context=clientContext.getContext(),permutiveGlobal.addons=addons,permutiveGlobal.config=config,permutiveRealtime.setAsReady(),(0,_initialisation_queuedMethods__WEBPACK_IMPORTED_MODULE_16__.LA)(permutiveGlobal.q,state,permutiveGlobal,permutiveMethods,api,trace),setAddonsLoaded(!0)}));const loadAddonsSpan=trace.startSpan("load_addons");(0,_dynamic_addons_LoadAddons__WEBPACK_IMPORTED_MODULE_10__.C)({extMessages:new _dynamic_messages_PermutiveMessages__WEBPACK_IMPORTED_MODULE_37__.a(messages),nextGen,messages,viewId,state,sessionManager,api,clientContext,externalData,logger,metrics,namespace,network,permutive:permutiveGlobal,q:permutiveGlobal.q,userId}),loadAddonsSpan.finish(),await(0,_initialisation_identity__WEBPACK_IMPORTED_MODULE_15__.TZ)({api,clientContext,externalData,global:permutiveGlobal,identities,identitiesIngestor,logger,messages,metrics,network,permutiveMethods,reset:permutiveReset,trace,userId,sessionManager,sessionCount:nextGen.metricContext.current.session_count}),(0,_initialisation_initialisationLifecycle__WEBPACK_IMPORTED_MODULE_38__.R)(messages,metrics,state,logger),(0,fp_ts_function__WEBPACK_IMPORTED_MODULE_22__.zG)(_framework_ref__WEBPACK_IMPORTED_MODULE_0__.vP(nextGen.realtime,nextGen.queryLanguageCohorts.all),_framework_ref__WEBPACK_IMPORTED_MODULE_0__.D8(((e,t)=>e[0]===t[0])),_framework_ref__WEBPACK_IMPORTED_MODULE_0__.bw((e=>{let[t,n]=e;t&&permutiveRealtime.setAsRealtime(n.length)})))}),(e=>`Exception during initialisation. Got ${e}`))}},4095:(e,t,n)=>{n.r(t),n.d(t,{runSdk:()=>te});var r=n(365),i=n(3735);var o=n(2707),s=n(7407),a=n(2884);var u=n(5700);class c{namespace;config;logger;constructor(e,t,n){this.namespace=e,this.config=t,this.logger=n}makeCookie(e,t,n){return[encodeURIComponent(this.namespace.getNamespacedStorageKey(e)),"=",t?encodeURIComponent(t):"","; expires=",n,"; domain=",this.config.cookieDomain,"; path=/; samesite=none; secure"].join("")}setCookie(e,t){if(!(t&&e&&this.config.cookieExpiry&&this.config.cookieDomain)){const{cookieExpiry:n,cookieDomain:r}=this.config??{};throw this.logger.warn(`Unable to set cookie. ${u.LP}`,{value:t,cookieName:e,cookieExpiry:n,cookieDomain:r}),new Error(u.LP)}const n=this.makeCookie(e,t,this.config.cookieExpiry);if(n.length>u.dG)throw this.logger.warn(`Unable to set cookie ${this.namespace.getNamespacedStorageKey(e)}. ${u.eP}`),new Error(u.eP);return this.logger.debug(`Setting cookie ${n}`),document.cookie=n,!0}getCookie(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e:this.namespace.getNamespacedStorageKey(e),n=new RegExp("\\b"+encodeURIComponent(t)+"=([^;]+)").exec(document.cookie);return null!==n?decodeURIComponent(n[1]):null}deleteCookie(e){if(!e||!this.config.cookieDomain)return!1;const t=this.makeCookie(e,void 0,"Thu, 01 Jan 1970 00:00:00 UTC");return this.logger.debug(`Deleting cookie ${t}`),document.cookie=t,!0}}var l=n(4769);const d=e=>{const{logger:t,consentTracking:n}=e,r=e=>(t.debug(`Cookie: Failed to set cookie ${e} as consent is revoked`),!1);return e=>class extends e{setCookie=(0,l.v)(super.setCookie.bind(this),r,n.isRevoked)}};var f=n(2688),p=n(787);class g{namespace;constructor(e){this.namespace=e}getExternalData(e){const t=this.namespace.getNamespacedStorageKey(e);return window.localStorage.getItem(t)}getExternalJsonData(e){const t=this.getExternalData(e);return null===t?null:(0,p.A)(t)}setExternalData(e,t){const n=this.namespace.getNamespacedStorageKey(e);try{window.localStorage.setItem(n,t)}catch(e){}}setExternalJsonData(e,t){return(0,i.zG)((n=t,(0,r.Y3)((function(){var e=JSON.stringify(n);if("string"!=typeof e)throw new Error("Converting unsupported structure to JSON");return e}),i.yR)),(0,r.UI)((t=>this.setExternalData(e,t))),(0,r.g_)((e=>{throw(0,f.w)(e)}),i.Q1));var n}removeExternalData(e){const t=this.namespace.getNamespacedStorageKey(e);window.localStorage.removeItem(t)}}const m=e=>{const{logger:t,consentTracking:n}=e,r=e=>{t.debug(`External Data: Failed to set key ${e} as consent is revoked`)},i=r,o=r;return e=>class extends e{setExternalData=(0,l.v)(super.setExternalData.bind(this),i,n.isRevoked);setExternalJsonData=(0,l.v)(super.setExternalJsonData.bind(this),o,n.isRevoked)}};var h=n(3992);class v{sdkInitTimestamp;prefix="[Permutive]"+(self.document?"[Main]":"[Worker]");debugStyle=["color: blue"].join(";");constructor(e){this.sdkInitTimestamp=e}get timeDeltaFromInit(){return`[${(new Date).getTime()-this.sdkInitTimestamp}ms]`}log(){return console.log.bind(self.console,this.timeDeltaFromInit,this.prefix)(...arguments)}debug(){return console.debug.bind(self.console,"%s%c%s",this.timeDeltaFromInit,this.debugStyle,this.prefix)(...arguments)}warn(){return console.warn.bind(self.console,this.timeDeltaFromInit,this.prefix)(...arguments)}error(){return console.error.bind(self.console,this.timeDeltaFromInit,this.prefix)(...arguments)}}class _{log(){}debug(){}warn(){}error(){}}const b="[MESSAGES]";class y{logger;messageListenerMap={};replayQueue={};onceTracker={};defaultMessageOptions={withReplay:!1,once:!1};constructor(e){this.logger=e}on(e,t,n){const r=this.mergeMessageOptions(n);r.withReplay&&this.processReplayQueue(e,t);const i=w(e,this.messageListenerMap).push(t)-1;return r.once&&this.addToOnceTracker(e,i),i}once(e,t){return this.on(e,t,{once:!0})}off(e,t){if(null==t)return this.messageListenerMap[e]=[],void(this.replayQueue[e]=[]);t<0?this.logError('Index for "off" fell out of range',{index:t}):w(e,this.messageListenerMap)[t]=i.Q1}emit(e,t,n){const r=this.mergeMessageOptions(n);w(e,this.messageListenerMap).length>0?(this.logDebug(`Emitting Event: ${e}`),this.emitMessageWithPayload(e,t)):r.withReplay&&this.addToReplayQueue(e,t)}addToReplayQueue(e,t){w(e,this.replayQueue).push(t)}processReplayQueue(e,t){var n;null===(n=this.replayQueue[e])||void 0===n||n.forEach((e=>t(e)))}emitMessageWithPayload(e,t){var n;null===(n=this.messageListenerMap[e])||void 0===n||n.forEach(((n,r)=>{n(t),this.removeListenerIfSetToFireOnlyOnce(e,r)}))}addToOnceTracker(e,t){w(e,this.onceTracker).push(t)}removeListenerIfSetToFireOnlyOnce(e,t){var n;null!==(n=this.onceTracker[e])&&void 0!==n&&n.includes(t)&&this.off(e,t)}mergeMessageOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...this.defaultMessageOptions,...e}}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(b,...t)}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(b,...t)}}const w=(e,t)=>t[e]??=[];var I=n(1828);class k{sdkInitTimestamp;timeOriginSdkInit;logger;prefix="[Metrics]";timeOriginForContext=P();pendingMetrics=[];pendingCounters={};pendingTimers={};noMetricsTracked=0;constructor(e,t,n){this.sdkInitTimestamp=e,this.timeOriginSdkInit=t,this.logger=n}isEnabled(){return!0}getNoMetricsTracked(){return this.noMetricsTracked}consume(){const e=this.pendingMetrics.concat(Object.values(this.pendingCounters).flat());return this.pendingMetrics=[],this.pendingCounters={},e}track(e){this.noMetricsTracked++,this.logDebug(`Tracking ${e.name}`,{metric:e}),this.pendingMetrics.push(e)}trackCounter(e){if(this.noMetricsTracked++,this.logDebug(`Tracking ${e.name}`,{metric:e}),e.name in this.pendingCounters){const t=Object.keys(e.labels),n=this.pendingCounters[e.name].findIndex((n=>Object.keys(n.labels).length===t.length&&t.every((t=>n.labels[t]===e.labels[t]))));-1===n?this.pendingCounters[e.name].push(e):this.pendingCounters[e.name][n]=S(this.pendingCounters[e.name][n],e.value)}else this.pendingCounters[e.name]=[e]}synchroniseTimeBetweenContexts(e){return(0,i.zG)(I.gz(a.G5)(this.timeOriginForContext,this.timeOriginSdkInit),a.UI((t=>{let[n,r]=t;return e+n-r})))}trackTimeSinceInit(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:performance.now();(0,i.zG)(this.synchroniseTimeBetweenContexts(n),a.UI((e=>(e-this.sdkInitTimestamp)/1e3)),a.UI((n=>this.track({name:e,value:n,labels:t}))))}startTimer(e,t){const n=performance.now(),r=this.generateRandomKey(e);return this.pendingTimers[r]={startTime:n,labels:t},r}stopTimer(e,t){const n=this.pendingTimers[t];if(n){const r=(performance.now()-n.startTime)/1e3;this.logDebug("timer stopped",e,r),this.track({name:e,value:r,labels:n.labels}),delete this.pendingTimers[t]}}generateRandomKey(e){return`${e}-${[...Array(24)].map((()=>Math.random().toString(36)[2])).join("")}`}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(this.prefix,...t)}}class E{isEnabled(){return!1}getNoMetricsTracked(){return 0}consume(){return[]}track(e){}trackCounter(e){}trackTimeSinceInit(e,t){}startTimer(e,t){return""}stopTimer(e,t){}}const S=(e,t)=>({...e,value:e.value+t}),P=()=>(0,i.zG)(a.Y3((()=>performance.timeOrigin)),a.hX((e=>"number"==typeof e&&!Number.isNaN(e))));var G=n(2652),U=n(4730),D=n(926);class z{config;namespace;logger;prefix="[Data Store]";permutiveData={};permutiveDataSize=0;localStorageScheduler;localStorageQueue=new Set;debouncedStorageKeys;debouncedFlush;constructor(e,t,n){this.config=e,this.namespace=t,this.logger=n,this.localStorageScheduler=new U.b(e.localStorageWriteDelay,e.localStorageWriteMaxDelay),this.debouncedFlush=this.localStorageScheduler.schedule(this.flushLocalStorageQueue.bind(this)),this.debouncedStorageKeys=new Set(e.localStorageDebouncedKeys),this.localStorageScheduler.scheduleForPageUnload(this.flushLocalStorageQueue.bind(this)),this.permutiveData=this.buildData()}reset(){this.permutiveData={}}getDataSize(){return this.permutiveDataSize}getData(e){return this.permutiveData[e]}setData(e,t){this.permutiveData[e]=t,this.requestWrite(e)}deleteKey(e){delete this.permutiveData[e],this.requestWrite(e)}requestWrite(e){this.debouncedStorageKeys.has(e)?(this.localStorageQueue.add(e),this.debouncedFlush()):this.writeData(e)}flushLocalStorageQueue(){for(let e of this.localStorageQueue)this.writeData(e);this.localStorageQueue.clear()}buildData(){return{...this.getDataChunk("misc"),...this.getDataChunk("queries")}}getDataChunk(e){const t=this.namespace.getNamespacedStorageKey(this.chunkKeyToStorageKey(e)),n=window.localStorage.getItem(t),r=null===n?null:(0,p.A)(n);return n&&r?(this.permutiveDataSize+=2*n.length,r):{}}chunkKeyToStorageKey(e){switch(e){case"queries":return this.config.permutiveDataQueriesKey;case"misc":return this.config.permutiveDataMiscKey;default:throw new Error(`Unhandled chunk key "${e}"`)}}writeData(e){this.logger.debug(`Data Store: Writing ${e} to localStorage`);const[t,n]=this.dataKeyToChunkInfo(e);return r.Y3((()=>window.localStorage.setItem(this.namespace.getNamespacedStorageKey(t),JSON.stringify(n))),(t=>{const n=(0,f.w)(t);return this.logError(`Failed to set ${e}. Got ${n}`),n}))}dataKeyToChunkInfo(e){const t=e=>(0,G.eu)(this.permutiveData,e);switch(e){case"internal_query_states":case"external_query_states":case"event-source-id":return[this.chunkKeyToStorageKey("queries"),t(C)];case D.Kd:case"identities":case"amp_ready":case"metricsEnabled":case"addon:tradedesk":case"addon:tracking_pixel":case"addon:eyeota_pixel":case"addon:pinterest_pixel":case"addon:facebook_pixel_v2":case"addon:tiktok_pixel":case"addon:appnexus":case"addon:ddp":case"addon:gigya":case"addon:neustar_fabrick":case"pubmatic":case"lotame":return[this.chunkKeyToStorageKey("misc"),t(T)];default:throw new Error(`Unhandled data key "${e}"`)}}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(this.prefix,...t)}}const C=["internal_query_states","external_query_states","event-source-id"],T=[D.Kd,"identities","amp_ready","metricsEnabled","addon:tradedesk","addon:tracking_pixel","addon:eyeota_pixel","addon:pinterest_pixel","addon:facebook_pixel_v2","addon:tiktok_pixel","addon:appnexus","addon:ddp","addon:gigya","addon:neustar_fabrick","pubmatic","lotame"],O=e=>{const{logger:t,consentTracking:n}=e,i=e=>(t.debug(`Data Store: Failed to write ${e} as consent is revoked`),r.F2(void 0));return e=>class extends e{writeData=(0,l.v)(super.writeData.bind(this),i,n.isRevoked)}};class M{config;constructor(e){this.config=e}getNamespacedStorageKey(e){return`${this.config.stateNamespace}${e}`}}var x=n(2851);class A{config;cookies;externalData;ref;isNewlyGenerated;setState;constructor(e,t,n,r){this.config=e,this.cookies=t,this.externalData=n;const[o,s]=x.Ue(this.getOrGenerateUserId());this.ref=(0,i.zG)(o,x.UI((e=>e.userId))),this.isNewlyGenerated=(0,i.zG)(o,x.UI((e=>e.isNewlyGenerated))),this.setState=s,(0,i.zG)(x.vP(this.ref,r),x.YP((e=>{let[t,n]=e;n?(this.cookies.setCookie(this.config.cookieName,t),this.externalData.setExternalData(this.config.cookieName,t)):(this.cookies.deleteCookie(this.config.cookieName),this.externalData.removeExternalData(this.config.cookieName))})))}isEqual(e){return this.ref.current===e}get(){return this.ref.current}set(e){this.setState({userId:e,isNewlyGenerated:!1})}reset(){this.setState({userId:(0,G.k$)(),isNewlyGenerated:!0})}getOrGenerateUserId(){return(0,i.zG)(this.getUserIdFromCookie(),a.wp((()=>this.getUserIdFromLocalStorage())),a.UI((e=>({userId:e,isNewlyGenerated:!1}))),a.fS((()=>({userId:(0,G.k$)(),isNewlyGenerated:!0}))))}getUserIdFromCookie(){return this.getUserIdFromStorageIfValid("cookie")}getUserIdFromLocalStorage(){return this.getUserIdFromStorageIfValid("localStorage")}getUserIdFromStorageIfValid(e){const t=a.DT(G.Gz);return(0,i.zG)("cookie"===e?this.cookies.getCookie(this.config.cookieName):this.externalData.getExternalData(this.config.cookieName),a.ij,a.tS(t))}}class R{config;PATH_JOINER_Q="?";PATH_JOINER_A="&";constructor(e){this.config=e}getBaseUrl(){return`${this.config.apiProtocol}://${this.config.apiHost}`}getEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("base",e,t,n)}getSdkErrorsUrl(e,t){return this.getUrl("sdk-errors",e,t,[])}getAdvertiserEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("adv",e,t,n)}getClassificationModelsEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("clm",e,t,n)}getAudienceMatchingEndpointUrl(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const i=`${e}/${n}/audiences`;return this.getUrl("audience-matching",i,t,r)}getCCSCohortMembershipEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("ccs",e,t,n)}makeAuthenticatedUrl(e){return this.makeUrlWithQueryParams(e,[["k",this.config.apiKey]])}getUrlPrefix(e){switch(e){case"base":return"";case"adv":return"/adv";case"sdk-errors":return"/sdk-errors";case"clm":return"/clm";case"audience-matching":return"/audience-matching";case"ccs":return"/ccs"}}getUrl(e,t,n,r){const i=this.getUrlPrefix(e),o=(0,a.g_)((()=>""),(e=>`/${e}`))(n),s=`${this.getBaseUrl()}${i}${o}${t}`;return this.makeUrlWithQueryParams(s,r.concat([["k",this.config.apiKey]]))}makeUrlWithQueryParams(e,t){const n=t.map((e=>{let[t,n]=e;return`${t}=${n}`})).join(this.PATH_JOINER_A),r=e.includes(this.PATH_JOINER_Q)?this.PATH_JOINER_A:this.PATH_JOINER_Q;return`${e}${r}${n}`}}const q=`permutive.${self.document?"main":"worker"}.`;class L{config;shouldUsePerformanceMark=!1;constructor(e){var t;this.config=e,this.shouldUsePerformanceMark=((null===(t=self.performance)||void 0===t?void 0:t.mark)&&this.config.tracingEnabled)??!1}startSpan(e){const t=this.generateSpan(e);return t.start(),{spanId:t.spanId,finish:t.finish}}measureSinceInit(e){const t=this.generateSpan(`${e}_since_init`);return t.start({startTime:h.NC}),{spanId:t.spanId,finish:t.finish}}traceTask(e){return t=>async()=>{const n=this.startSpan(e),r=await t();return n.finish(),r}}measureBetween(e,t,n){const r=this.generateSpan(e);r.start({startTime:t}),r.finish({startTime:n})}generateSpan(e){if(!this.shouldUsePerformanceMark)return{spanId:null,start:()=>{},finish:()=>{}};const{spanName:t,startMarkerName:n,endMarkerName:r}=L.generateUniqueMarkerNames(e);return{spanId:n,start:e=>{var t;return null===(t=self.performance)||void 0===t?void 0:t.mark(n,e)},finish:e=>{var i,o,s;null===(i=self.performance)||void 0===i||i.mark(r,{startTime:(null==e?void 0:e.startTime)??performance.now()}),null===(o=self.performance)||void 0===o||null===(s=o.measure)||void 0===s||s.call(o,t,n,r)}}}static generateUniqueMarkerNames(e){const t=`${q}${e}`,n=`${t}${L.generateId()}`;return{spanName:t,startMarkerName:`${n}_start`,endMarkerName:`${n}_end`}}static generateId(){return"_"+Math.random().toString(36).substr(2,9)}}var $=n(2233),B=n(4564),F=n(5851),j=n(7271),N=n(1410),Y=n(30);const Q=e=>{const{partialTagWithKey:t}=e,n=t.key;var o;window[n].consent=(o=e,(0,i.ls)(o.consentModule.consentValidation,a.DT(Boolean),a.UI((0,j.initialiseWebSDK)(o)),i.Q1));const u=(0,a.EQ)((()=>{return t={consentDatabase:e.consentModule.consentDatabase,consentRequired:e.tag.config.consentRequired},(0,i.zG)((0,i.a9)(t.consentDatabase.get(N.L)),(0,s.UI)((e=>(0,Y.J)(t.consentRequired,e).isValid)));var t}),s.of);return(0,i.zG)((0,i.zG)((e=>{let{consentModule:t,tag:n}=e;const r=(0,F.Ew)((function(e){return"consent"===e.functionName}))(n.q);return(0,a.UI)((e=>t.consentValidation(e.arguments[0])))(r)})(e),u),(0,s.UI)((e=>e?(0,r.F2)(!0):(0,r.t$)("No consent to run on the page"))))},K=e=>(0,i.zG)((e=>"function"==typeof e.Map?(0,r.F2)(new e.Map([["a",1]])):(0,r.t$)("Maps not supported"))(e),r.tS((e=>1===e.size?(0,r.F2)(null):(0,r.t$)("Iterable Maps not supported")))),W=e=>(0,i.zG)((e=>"function"==typeof e.Set?(0,r.F2)(new e.Set([1,2])):(0,r.t$)("Sets not supported"))(e),r.tS((e=>2===e.size?(0,r.F2)(null):(0,r.t$)("Iterable Sets not supported")))),H=e=>(0,i.zG)((0,I.gz)(r.G5)(K(e),W(e),(e=>e.Worker&&e.Blob?(0,r.F2)(null):(0,r.t$)("WebWorkers not supported"))(e)),(e=>(0,r.UI)(i.Q1)(e)));const V=()=>{const e=(0,n(8537).Z)(),t=(e=>{const t=[],n=[],r=()=>{for(;t.length>0&&n.length>0;)n.shift()()},i=e=>new Promise((t=>{n.push((()=>t(e()))),(0,h.HJ)(r)}));return e.addEventListener("message",(0,h.GL)((e=>{null!==e.data&&(t.push(e.data),(0,h.HJ)(r))}))),{next:()=>i((()=>t.shift())),read:()=>i((()=>t.splice(0)))}})(e);return e.postMessage(null),r=>function(e){let{worker:t,trace:r,metrics:o,...u}=e;return t.send({...u,globals:self._____workerGlobals,initialTimestampSecs:(0,i.zG)(a.lo(!1),a.UI((()=>Math.floor(Date.now()/1e3)))),metricsEnabled:o.isEnabled(),timeOriginMainContext:P()}),(0,i.zG)((0,h.SF)((()=>Promise.resolve().then(n.bind(n,9145)))),r.traceTask("import-master-low-priority"),s.UI((e=>n=>e.startMaster({...n,metrics:o,trace:r,worker:t}))))}({...r,worker:{...t,send:t=>e.postMessage(t),stop:()=>e.terminate()}})};var J=n(7554);class X{db;options;constructor(e,t){this.db=e,this.options=t}getSessionId(){return this.options.session_id}sessionHasChanged(){return this.options.hasChanged}static decodeSessionData(e){return e&&"object"==typeof e&&e.hasOwnProperty("session_id")&&e.hasOwnProperty("last_updated")?{...e,last_updated:new Date(e.last_updated)}:null}reset(){return this.db.delete(this.options.session_data_key)}async persistSessionData(e){const t=e.last_updated.toISOString();await this.db.put({...e,last_updated:t},this.options.session_data_key)}static generateNewSession(e){return{session_id:(0,G.k$)(),last_updated:e}}static hasExpired(e,t,n){if(isNaN(t.getTime()))return!0;return e>new Date(t.getTime()+1e3*n)}static async initialise(e,t,n){const r={timeout_seconds:1800,session_data_key:"permutive-session",hasChanged:!1,logger:n};e.deleteCookie(r.session_data_key);const o=new Date,s=await t.get(r.session_data_key).catch(i.gn),a=X.decodeSessionData(s),u=null===a||X.hasExpired(o,a.last_updated,r.timeout_seconds)?{...X.generateNewSession(o),hasChanged:!0}:{...a,last_updated:o,hasChanged:!1},c=new X(t,(0,G.PM)(r,u));return await c.persistSessionData(u),c}}var Z=n(2836);const ee=e=>(0,i.zG)(o.Do,o.Qt("support",o.Uo(H(self))),o.Qt("partialTagWithKey",o.Uo((e=>{var t,n;const o="88980e3a-6890-4e52-bcc1-3154ab2a17c7",s=void 0!==(null===(t=e[o])||void 0===t?void 0:t.q)&&void 0!==(null===(n=e[o])||void 0===n?void 0:n.config)?o:"permutive";return(0,i.zG)(e[s],(0,r.ij)("Can't find permutive tag on the page"),(0,r.UI)((e=>({tag:e,key:s}))))})(window))),o.Qt("configFromQueryParams",o.Uo((0,$.B9)())),o.Hr("tag",(e=>((e,t)=>{let{tag:n,key:r}=e;return{...n,config:(0,$.ti)({...n.config,windowKey:r},t)}})(e.partialTagWithKey,e.configFromQueryParams))),o.UI((e=>{{const n=e.partialTagWithKey.key,r=window[n];t=r,window.googletag=window.googletag||{cmd:[]},window.googletag.cmd.push((()=>{const e=googletag.pubads(),n=()=>{t.track("AdRequest",{ad_server_id:"dfp",cohorts:e.getTargeting("permutive")})},r=e.getSlots().filter((e=>e.getResponseInformation())).length;for(let e=0;e<r;e++)n();e.addEventListener("slotRequested",n)}))}var t;return e})),o.Hr("trace",(e=>{let{tag:t}=e;return new L(t.config)})),o.Hr("namespace",(e=>{let{tag:t}=e;return new M(t.config)})),o.Hr("logger",(e=>{let{tag:t}=e;return function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.RP;return e.loggingEnabled&&void 0!==(null===(t=self.console)||void 0===t?void 0:t.log)?new v(n):new _}(t.config)})),o.Hr("urls",(e=>{let{tag:t}=e;return new R(t.config)})),o.Hr("messages",(e=>{let{logger:t}=e;return new y(t)})),o.Hr("worker",(()=>V())),o.ak("consentModule",(e=>(0,i.zG)((()=>(0,B.NY)({...e,consentRequired:e.tag.config.consentRequired})),o.Vn((e=>e.message))))),o.Hr("cookieStore",(e=>{let{consentModule:t,logger:n,namespace:r,tag:o}=e;return((e,t,n,r)=>new((0,i.zG)(c,d({consentTracking:r,logger:n})))(e,t,n))(r,o.config,n,t.consentTracking)})),o.Hr("externalData",(e=>{let{consentModule:t,logger:n,namespace:r}=e;return((e,t,n)=>new((0,i.zG)(g,m({consentTracking:n,logger:t})))(e))(r,n,t.consentTracking)})),o.Hr("userId",(e=>{let{cookieStore:t,consentModule:n,externalData:r,tag:i}=e;return new A(i.config,t,r,n.consentTracking.consentRef)})),o.Hr("permutiveData",(e=>{let{tag:t,namespace:n,logger:r,consentModule:o}=e;return((e,t,n,r)=>new((0,i.zG)(z,O({consentTracking:r,logger:n})))(e,t,n))(t.config,n,r,o.consentTracking)})),o.Hr("metrics",(t=>{let{tag:n,logger:r,permutiveData:i}=t;return function(e,t,n,r,i){const o=r.getData("metricsEnabled")??(()=>{const e=Math.random()<=n.metricsSamplingPercentage/100;return r.setData("metricsEnabled",e),e})()?new k(e,t,i):new E;return o.track({name:"sdk_initialisation_start_time_seconds",value:e/1e3,labels:{}}),o}(e.contextsInitTimestampPerformance,P(),n.config,i,r)})),o.Hr("pageviewState",(e=>{let{tag:t}=e;return(e=>{const t={viewId:(0,i.zG)(e.viewId,a.DT((e=>"string"==typeof e&&(0,G.Gz)(e))),a.fS(G.k$)),watsonEnabled:e.watson.enabled};return(0,i.zG)(x.Ue(t),(e=>{let[n,r]=e;return{ref:n,setState:(0,i.ls)((e=>e(n.current,t)),r)}}))})(t.config)})),(0,i.ls)(o.Hr("localStorage",(e=>{let{logger:t,namespace:n,consentModule:r}=e;return(0,J.E)(n,t,r.consentTracking.consentRef)})),o.ak("sessionManager",(e=>{let{cookieStore:t,localStorage:n,logger:r}=e;return o.Y3((()=>X.initialise(t,n,r)),(e=>`Failed to initialise session manager: ${e.message}`))})),o.Hr("core",(t=>{let{consentModule:n,metrics:r,pageviewState:o,permutiveData:s,sessionManager:u,trace:c,tag:l,userId:d,worker:f}=t;const{eventSourceId:p,isFirstPageview:g}=(0,i.zG)(a.ij(s.getData("event-source-id")),a.hX(G.Gz),a.UI((e=>({eventSourceId:e,isFirstPageview:!1}))),a.fS((()=>{const e=(0,G.k$)();return s.setData("event-source-id",e),{eventSourceId:e,isFirstPageview:!0}})));return f({consent:n.consentTracking.consentRef.current,eventSourceId:p,isFirstPageview:g,isSecureContext:(m=l.config,"development"===m.environment?self.isSecureContext:"https:"===self.location.protocol),metrics:r,permutiveConfig:l.config,organizationId:"88980e3a-6890-4e52-bcc1-3154ab2a17c7",pageviewState:o.ref.current,sdkInitTimestampPerformance:e.contextsInitTimestampPerformance,sdkInitTimestampDate:e.contextsInitTimestamp,sessionId:u.getSessionId(),trace:c,trackPageviewComplete:!0,userId:d.get(),userIdIsNewlyGenerated:d.isNewlyGenerated.current,webClient:(0,Z.k)()});var m})),o.ak("consent",(e=>Q(e))),o.tS((e=>(0,i.zG)((0,h.SF)((()=>Promise.resolve().then(n.bind(n,7271)))),e.trace.traceTask("permutive.main.import_permutiveWebLowPriority"),s.tS((t=>t.initialiseWebSDK(e)))))))),te=e=>(e=>{e().then((0,r.g_)((e=>console.warn(`Permutive was not initialized. ${e}`)),i.Q1))})(ee(e))},2652:(e,t,n)=>{n.d(t,{Bf:()=>_,G6:()=>k,Gz:()=>y,HP:()=>z,Kn:()=>l,Or:()=>P,PM:()=>f,PQ:()=>E,Z_:()=>U,a4:()=>g,aT:()=>v,b2:()=>p,bw:()=>T,cO:()=>S,eu:()=>m,k$:()=>b,lW:()=>G,lo:()=>O,m8:()=>w,qh:()=>d,rH:()=>x,rO:()=>C,vg:()=>D});var r=n(5851),i=n(3735),o=n(2884),s=n(7209),a=n(6017),u=n(2751),c=n(3992);const l=e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,d=e=>Object.entries(e);function f(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(((e,t)=>({...e,...t})),{})}a.ff(u.xb);function p(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),reject:t,resolve:e}}function g(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={waitTimeInMs:50,exponentialBackOff:!1,maxAttempts:20},{waitTimeInMs:s,exponentialBackOff:a,maxAttempts:u}=f(r,n);let l=0;const d=n=>new Promise((r=>Promise.resolve(t()).then((t=>t?Promise.resolve(e()).then((e=>r((0,o.G)(e)))):(0,i.zG)(l++,(e=>e<u?(0,c.HJ)((()=>r(d(n*(a?2:1)))),n):r(o.YP)))))));return d(s)}function m(e,t){const n=Object.create(null);for(const r of t)n[r]=e[r];return n}let h=[];function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:navigator.userAgent;if(h.unshift(e),h.length>1)return;const n=["beforeunload","pagehide"],r=n.concat(["visibilitychange"]),i=e=>{if(!o&&e){o=!0;const e=h;h=[],e.forEach((e=>{try{e()}catch{}}))}};let o=!1;r.forEach((e=>{window.addEventListener(e,(()=>{const n=("visibilitychange"!==e||document.hidden)&&I(t);i(n)}))})),n.forEach((e=>{window.addEventListener(e,(()=>i(!0)))}))}function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t={capture:!0,...t};const n=["visibilitychange","pagehide"];n.forEach((n=>window.addEventListener(n,(()=>o.Y3((()=>{"pagehide"!==n&&"hidden"!==document.visibilityState||e()}))),{capture:t.capture})))}function b(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^(self.crypto||self.msCrypto).getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))}function y(e){return 36===e.length&&/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(e)}function w(){const e={},t=arguments.length;for(let n=0;n<t;n++){const[t,r]=n<0||arguments.length<=n?void 0:arguments[n];e[t]=r}return e}function I(e){return/Mobi|Android/i.test(e)}function k(e){return/^((?!chrome|android).)*safari/i.test(e)}function E(e,t){return new Promise((n=>{(0,c.HJ)((()=>{Promise.resolve(e()).then(n)}),(null==t?void 0:t.timeout)??0)}))}function S(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}const P=()=>({equals:(e,t)=>Object.is(e,t)});function G(e){return(0,s.Zt)(((t,n)=>{const r=e.indexOf(t),i=e.indexOf(n);switch(!0){case-1===r&&-1===i:return 0;case-1!==r&&-1===i:return-1;case-1===r&&-1!==i:return 1;default:return r<=i?-1:1}}))}function U(e,t,n){return function(){try{return n(...arguments)}catch(n){e.reportError(n,t.get())}}}function D(e){return t=>null!=t&&e in t?t[e]:void 0}function z(e){let t=o.YP;const n=(0,o.fS)((()=>{const n=e();return t=(0,o.G)(n),n}));return()=>n(t)}const C=e=>t=>{const n={...t};for(const i in e){var r;n[i]=null===(r=e[i])||void 0===r?void 0:r.call(e,t[i])}return n};function T(e){return t=>(e(t),t)}const O=e=>t=>{const n=e.slice(0,-1),s=e.slice(-1)[0];return(0,i.zG)(n,r.f2((e=>{let[n,r]=e;return(0,i.zG)(t,o.DT(n),o.UI(r))})),o.fS((()=>s(t))))},M=e=>t=>{if("number"==typeof t)return t;if("string"==typeof t){const n=e(t);return Number.isNaN(n)?void 0:n}},x=M(parseInt);M(parseFloat)},8771:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(2884),i=n(3992);const o=(e,t,n,o)=>new Promise(((s,a)=>{const u=(0,r.Y3)(e);if((0,r.pC)(u))return s(u.value);n.once(t,(()=>(0,r.g_)((()=>a(new Error(`Error after waiting for event ${t}`))),s)((0,r.Y3)(e))));const c=(null==o?void 0:o.timeout)??1e4;(0,i.HJ)((()=>a(new Error(`Event ${t} was not received within the timeout period ${c}ms`))),c)}))},4730:(e,t,n)=>{n.d(t,{b:()=>o});var r=n(2652),i=n(3992);class o{timeoutDurationInMilliseconds;maxTimeOutDurationInMilliseconds;constructor(e,t){this.timeoutDurationInMilliseconds=e,this.maxTimeOutDurationInMilliseconds=t}schedule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.timeoutDurationInMilliseconds,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.maxTimeOutDurationInMilliseconds;return this.debounce(e,t,n)}scheduleAccumulated(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeoutDurationInMilliseconds,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.maxTimeOutDurationInMilliseconds;return this.debounce(e,n,r,t)}scheduleForPageUnload(e){return(0,r.aT)(e)}debounce(e,t,n,o){let s,a,u,c=[];return l=>{o&&(u=o.concat(u??o.empty,l));const d=(0,r.b2)();c.push(d);var f;return null===(f=s)||void 0===f||f(),s=(0,i.HJ)((()=>{var t;null===(t=a)||void 0===t||t(),a=void 0;const n=e(u||l);c.forEach((e=>e.resolve(n))),u=null==o?void 0:o.empty,c=[]}),t),a||(a=(0,i.HJ)((()=>{var t;null===(t=s)||void 0===t||t(),a=void 0;const n=e(u||l);c.forEach((e=>e.resolve(n))),u=null==o?void 0:o.empty,c=[]}),n)),d.promise}}}},4996:(e,t,n)=>{n.d(t,{i:()=>i});var r=n(3992);class i{messages;queue=[];nextNotify=null;constructor(e){this.messages=e,e.on("permutive:taskQueue:update",(()=>{this.execute()}))}add(e){this.queue.push(e),this.notify()}notify(){const e=()=>{this.messages.emit("permutive:taskQueue:update")},t=(new Date).getTime();null===this.nextNotify||this.nextNotify<t-50?(this.nextNotify=t,e()):this.nextNotify<=t&&(this.nextNotify=t+50,(0,r.HJ)(e,50))}execute(){if(0===this.queue.length)return;let e=!1,t=!1,n=0;for(let r=0;r<this.queue.length;r++){const i=this.queue[r];if(i.complete)n+=1;else if(i.started)t=!0,e=e||i.blocks();else{if(i.waits()&&t)break;e||(t=!0,e=e||i.blocks(),i.execute((()=>{this.notify()})))}}this.queue.splice(0,n)}size(){return this.queue.length}}},3030:(e,t,n)=>{n.d(t,{_Y:()=>s,bk:()=>o,zM:()=>i});var r=n(3735);const i=()=>{var e,t;const n=null===(e=window.location.href.split("?")[1])||void 0===e||null===(t=e.split("#")[0])||void 0===t?void 0:t.split("&");return void 0===n?{}:n.reduce(((e,t)=>{const[n,r]=t.split("=");return{...e,[n]:r}}),{})},o=e=>{if(!e)return"";return(0,r.zG)(e,(e=>{const t=e.length-1;return"/"===e[t]?e.slice(0,t):e}))};function s(e){const t=e.match(/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/),n=e.match(/[a-z0-9][a-z0-9-]+\.[a-z.]{2,24}$/i),r=e.match(/localhost/);if(n&&n.length>0){const t=e.split(".").reverse();return t.length>=3&&t[1].match(/^(com|edu|gov|net|mil|org|nom|co|ac|name|info|biz)$/i)?t[2]+"."+t[1]+"."+t[0]:t[1]+"."+t[0]}return t&&(null==t?void 0:t.length)>0?t[0]:r&&(null==r?void 0:r.length)>0?"localhost":""}},7305:(e,t,n)=>{n(9853),n(2652),n(3992)},7826:(e,t,n)=>{n.d(t,{$7:()=>h,Cg:()=>p,Qd:()=>m,cs:()=>g,dN:()=>d,zi:()=>f});var r=n(365),i=n(3735),o=n(2884),s=n(3328),a=n(2116),u=n(2851),c=n(2652);const l="[PrebidJS]";function d(e){const t=(()=>{const e=["pbjs",...window._pbjsGlobals||[]];return[...new Set(e)]})();e.logger.debug(l,"Found keys",t);return a.K4((()=>(0,i.zG)(t,s.UI((0,i.ls)((e=>(e=>{const t={maxAttempts:100,waitTimeInMs:50};let n;return{windowPropertyKey:e,pbjs:(0,c.a4)((()=>n),(()=>{const t=(0,i.zG)(window,(0,c.vg)(e));return!(null==t||!t.que||"function"!=typeof(null==t?void 0:t.getEvents)||(n=t,0))}),t)}})(e)),(t=>(0,i.zG)(u.p4(t.pbjs),u.UI((n=>{const s=r.pF((n=>(n.message=`Failed to resolve key "${t.windowPropertyKey}". ${n.message}`,e.reportError(`${l} ${n.toString()}`),o.YP)));return(0,i.zG)(n,(0,c.bw)(o.UI((n=>e.logger.debug(l,`Completed check for key "${t.windowPropertyKey}"`,{result:n})))),o.UI(s),o.UI(o.UI((e=>({windowPropertyKey:t.windowPropertyKey,pbjs:e})))))})))))),(e=>u.vP(...e)),u.UI((e=>({completedChecks:e.every(o.pC),pbjsKeyPairs:e.map(o.xH)}))),u.UI((e=>{let{pbjsKeyPairs:t,completedChecks:n}=e;const r=t.filter(o.pC),[a,...u]=r;return{completedChecks:n,mainPair:a??o.YP,otherPairs:(0,i.zG)(u,s.DZ(i.yR))}})))))}const f=e=>"function"==typeof e.readConfig?e.readConfig():e.getConfig();function p(e){var t;const n=null===(t=e.meta)||void 0===t?void 0:t.advertiserDomains;if("string"==typeof n)return[n];if(Array.isArray(n)){const e=n.filter((e=>"string"==typeof e));return e.length>0?e:void 0}}const g=e=>{var t;const n=e.appnexus&&"object"==typeof e.appnexus&&"buyerMemberId"in e.appnexus&&e.appnexus.buyerMemberId,r=e.rubicon&&"object"==typeof e.rubicon&&"networkId"in e.rubicon&&e.rubicon.networkId,i=n||r||(null==e||null===(t=e.meta)||void 0===t?void 0:t.networkId);return i?`${i}`:void 0},m=e=>{const t=e=>isNaN(e)?void 0:e;try{return"number"==typeof e.cpm?t(e.cpm):(0,i.zG)(e.cpm??"",parseFloat,t)}catch{return}},h=e=>e.dealId?`${e.dealId}`:void 0},122:(e,t,n)=>{n.d(t,{X:()=>r});const r=e=>{let t=!0;const n=[];return{addBlocker:r=>{n.push(r),e.logger.log("<blockers> added blocker "+r),e.messages.on(r,(()=>{if(t){const i=n.indexOf(r);i>=0&&(n.splice(i,1),e.logger.log("<blockers> removed blocker "+r)),0===n.length&&(t=!1,e.messages.emit("permutive:blockers:empty"),e.logger.log("<blockers> complete"))}}))}}}},7748:(e,t,n)=>{n.d(t,{X:()=>i});var r=n(2851);class i{ref;setCustomProps;constructor(){const[e,t]=r.Ue({});this.ref=e,this.setCustomProps=t}getCustomProps(){return this.ref.current}}},5717:(e,t,n)=>{n.r(t),n.d(t,{EventsCache:()=>y,RESET_HISTORICAL:()=>v});var r=n(2688),i=n(1828),o=n(3328),s=n(365),a=n(3735),u=n(2884),c=n(7407),l=n(2707),d=n(7548),f=n(2652),p=n(4730);class g extends Error{constructor(e){super(e),this.name="StoreClosingError"}}const m="permutive-events-cache",h="permutive-events-for-page",v="historical",_="[EVENTSCACHE]",b=e=>"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name;class y{config;logger;reportError;trace;metrics;userId;makeEventsStore;eventStore;eventsCache=this.makeEventsRepository(m);eventsForPage=this.makeEventsRepository(h);eventsTTLInMilliseconds;readiness;debouncedReportError=(()=>new p.b(5e3,5e3).schedule((e=>this.reportError(e.errorMessage,{userId:e.userId}))))();static initialise(e,t,n,r,i,o,s){return(0,a.zG)(s(),l.UI((a=>new y(e,t,n,r,i,o,s,a))))}constructor(e,t,n,r,i,o,s,l){this.config=e,this.logger=t,this.reportError=n,this.trace=r,this.metrics=i,this.userId=o,this.makeEventsStore=s,this.eventStore=l,this.eventsTTLInMilliseconds=(0,a.zG)((0,u.ij)(this.config.eventsTTLInDays),(0,u.tS)((e=>"number"==typeof e&&e>0?(0,u.G)(24*e*3600):u.YP))),this.eventsCache.events=(0,f.HP)((()=>(0,f.PQ)((0,a.zG)(c.tD((()=>this.trace.startSpan("load_event_cache"))),c.tS((e=>(0,a.zG)(this.loadFromDisk(),c.At((t=>()=>{e.finish(),this.logDebug(`Event cache loaded, #e ${t.length}`)}))))))))),this.readiness=this.eventsCache.events().then((()=>this.migratePreviousPagesEvents())),o.onChange((()=>this.reset()))}async migratePreviousPagesEvents(){const e=this.trace.startSpan("migrate_previous_for_page_events"),t=(0,c.pE)((e=>(0,l.Y3)((()=>e.flush()),r.w)));return(0,a.zG)([this.eventsForPage,this.eventsCache],t,(0,c.UI)((t=>{const n=o.bj(t);return n.length>0&&this.reportError(`Migrate previous events failed. Got:\n${n.join("\n ")}`,{userId:this.userId.current}),e.finish()})),(e=>e()))}all(){return Promise.all([this.eventsCache.events(),this.eventsForPage.events()]).then(o.xH)}async add(e,t){let{persistOnDisk:n}=t;return this.logDebug("Adding to cache",e),this.eventsForPage.events=(0,a.zG)(this.eventsForPage.events,c.UI((t=>[...t,e])),f.HP),n&&this.readiness.then((()=>this.eventsForPage.flush())),e}filterEventsByWorkspace(e){return e}pruneEventsToSizeLimit(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.config.eventsCacheLimitBytes;if(n<=0||t<=n)return this.logDebug(`Event size of ${t} less than limit of ${n}`),{events:e,sizeInBytes:t};this.logDebug("Events before pruning",{count:e.length,sizeInBytes:t,byteLimit:n});let r=1,i=[...e];for(;t>n;)i.splice(0,r),r*=2,t=2*JSON.stringify(i).length;return this.logDebug("Events after pruning",{count:i.length,sizeInBytes:t}),{events:i,sizeInBytes:t}}loadFromDisk(){const e=()=>[],t=(0,a.zG)(this.eventsTTLInMilliseconds,u.EQ((()=>a.yR),(e=>o.hX((t=>e>Date.now()-t.time.getTime())))));return(0,a.zG)(c.tD((()=>(this.logLog("Loading event cache..."),this.metrics.startTimer("sdk_load_events_cache_task_duration_seconds",{})))),c.YO("loadEventsCacheTask"),c.ak("eventsFromDisk",(()=>(0,a.zG)(o.nI([this.eventStore.get(m),this.eventStore.get(h)]),o.UI(l.LV((0,f.lo)([[e=>e instanceof g,(0,a.ls)(e,c.of)],t=>(0,a.zG)(c.tD((()=>this.reportError(`Error fetching data from store. Got ${t}`,{userId:this.userId.current}))),c.tS((()=>()=>this.reset("historical"))),c.UI(e))]),(0,a.ls)(u.fS(e),c.of))),o.vP(c.qA)))),c.At((e=>{let{eventsFromDisk:t,loadEventsCacheTask:n}=e;return()=>{this.logDebug("Read events from store:",t),this.metrics.stopTimer("sdk_load_events_cache_task_duration_seconds",n)}})),c.UI((0,a.ls)((0,f.vg)("eventsFromDisk"),o.xH,this.filterEventsByWorkspace,(e=>this.pruneEventsToSizeLimit(e,2*JSON.stringify(e).length)),(e=>(this.eventsCache.sizeInBytes=e.sizeInBytes,this.eventsCache.sizeInBytesLastSuccessfulWrite=e.sizeInBytes,e.events.length>0&&(this.metrics.track({name:"sdk_events_cache_byte_total",value:e.sizeInBytes,labels:{}}),this.metrics.track({name:"sdk_events_cache_size_total",value:e.events.length,labels:{}})),e.events)),o.UI(d.k),t)))}async reset(e){return(0,a.zG)(c.tD((()=>this.logDebug("Resetting Events Cache"))),c.tS((()=>this.eventStore.deleteStore())),l.tS((()=>this.makeEventsStore())),l.Zl((t=>(this.eventStore=t,e===v?i.gz(l.Ij)(this.eventsCache.reset,this.eventsForPage.flush):i.gz(l.Ij)(this.eventsCache.reset,this.eventsForPage.reset)))),l.wE((()=>()=>this.all())),l.fS((()=>c.of(w()))),(e=>e()))}getStateSizeInBytes(){return this.eventsForPage.sizeInBytes+this.eventsCache.sizeInBytes}makeEventsRepository(e){const t=(()=>{let e=Promise.resolve(s.F2((0,a.Q1)()));return t=>e=e.then(t)})(),n=e=>(0,a.zG)(c.tD((()=>this.logDebug(`Writing ${e.length} events to ${v.key}`))),c.tS((()=>this.eventStore.put(e.map(d.X),v.key))),l.UI(a.Q1)),i=(0,a.zG)(c.tD((()=>this.logDebug(`Deleting events for ${v.key}`))),c.tS((()=>this.eventStore.delete(v.key))),l.Vn(r.w)),o=(0,a.ls)(c.of,c.At((e=>()=>this.logError(`Events cache failed to put ${v.key}. Got ${e}`))),c.tS((0,f.lo)([[e=>b(e)&&v.retryAttempts<9,()=>(0,a.zG)(c.tD((()=>{v.retryAttempts+=1,this.logDebug(`Attempt #${v.retryAttempts} to write ${v.key} to EventsStore`)})),c.tS((()=>h)),c.tS((()=>p)))],[e=>b(e),e=>(0,a.zG)(c.tD((()=>this.logDebug(`Attempted ${v.retryAttempts} rewrite attempts and reached limit of 9 max writes.`,"Reporting QuotaExceededError to API"))),c.tS((()=>()=>this.debouncedReportError({errorMessage:`Events cache failed to put ${v.key}. Got ${e}`,userId:this.userId.current}))),c.tS((()=>l.t$(e))))],l.t$]))),u=e=>l.tD((()=>{this.logDebug(`Successfully wrote events for ${v.key} after ${v.retryAttempts} attempts`),v.retryAttempts=0,v.sizeInBytes=2*JSON.stringify(e).length,v.sizeInBytesLastSuccessfulWrite=v.sizeInBytes})),p=(0,a.zG)((()=>v.events()),c.tS((e=>(0,a.zG)(n(e),c.mU(s.EQ(o,(()=>u(e)))))))),g=(e,t)=>(0,a.zG)(e.events,c.UI((n=>{const r=2*JSON.stringify(n).length,i=this.pruneEventsToSizeLimit(n,r,t);return e.events=c.of(i.events),e.sizeInBytes=i.sizeInBytes,t-e.sizeInBytes}))),m=(e,t)=>{let[n,...r]=e;return n&&0!==t?(0,a.zG)(g(n,t),c.tS((e=>(this.logDebug(`${e} left after pruning ${n.key}`),m(r,e))))):c.of((0,a.Q1)())},h=(0,a.zG)(l.tD((()=>this.eventsForPage.sizeInBytes-this.eventsForPage.sizeInBytesLastSuccessfulWrite)),l.fX(s.DT((e=>e>0),(e=>new Error(`${this.eventsForPage.key} failed to write the same or smaller events cache of size ${e}`)))),l.tS((e=>{const t=1.2*e,n=[this.eventsCache,this.eventsForPage];return this.logDebug(`Pruning ${t} bytes from`,n),(0,a.zG)(m(n,t),l.fF)}))),v={key:e,events:c.of([]),sizeInBytes:0,sizeInBytesLastSuccessfulWrite:0,retryAttempts:0,flush:()=>(0,a.zG)(c.tD((()=>this.trace.startSpan(`write_${v.key}`))),c.tS((e=>(0,a.zG)(p,c.At((()=>()=>e.finish()))))),t),reset:()=>(0,a.zG)(c.tD((()=>{v.events=c.of([]),v.sizeInBytes=0,v.sizeInBytesLastSuccessfulWrite=0})),c.tS((()=>i)),t)};return v}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(_,...t)}logWarn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.warn(_,...t)}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(_,...t)}logLog(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.log(_,...t)}}const w=()=>[]},9381:(e,t,n)=>{n.r(t),n.d(t,{DBStore:()=>s});var r=n(2688),i=n(2884),o=n(2707);class s{db;constructor(e){this.db=Promise.resolve(e)}put(e,t){return(0,o.Y3)((()=>this.db.then((n=>n.put(e,t)))),r.w)}get(e){return(0,o.Y3)((()=>this.db.then((t=>t.get(e))).then(i.ij)),r.w)}delete(e){return(0,o.Y3)((()=>this.db.then((t=>t.delete(e)))),(e=>String(e)))}deleteStore(){return(0,o.Y3)((()=>this.db.then((e=>e.deleteStore()))),(e=>String(e)))}}},6197:(e,t,n)=>{n(2652)},6272:(e,t,n)=>{n(3992)},9581:(e,t,n)=>{n.r(t),n.d(t,{PrebidAddon:()=>b,load:()=>_});var r=n(9853),i=n(5851),o=n(365),s=n(3735),a=n(2884),u=n(2851),c=n(2652),l=n(7826);const d="prebidAddonLoadingtime",f="prebidAddonInitStart",p="prebidAddonInitEnd",g=(0,r.Hn)("prebid")("revenue_insights_enabled",!1);class m{logger;options;permutive;trackedBids=[];constructor(e){this.logger=e.logger,this.permutive=e.permutive,this.options=e,this.startRevenueInsights()}async startRevenueInsights(){if(this.logger.debug("[Revenue Insights]","revenue insights enabled",g),!1===g)return;performance.mark(f);const e={maxAttempts:200,waitTimeInMs:50};(0,s.zG)(this.options.pbjs,u.UI(a.UI((t=>(0,c.a4)((()=>this.runRevenueInsights(t)),(()=>{var e;return!(null===(e=window.googletag)||void 0===e||!e.pubads)}),e)))))}runRevenueInsights(e){this.trackMetrics();const t=()=>{e.getAllWinningBids().forEach((e=>n(e,!0))),e.onEvent("bidWon",(e=>n(e,!0)))},n=(e,t)=>(0,o.Y3)((()=>d(e,t)),(e=>{})),r=e=>{var t,n,r,i,o;const s=(null==e||null===(t=e.meta)||void 0===t?void 0:t.brandName)||(null==e||null===(n=e.meta)||void 0===n?void 0:n.clickUrl)||(null==e||null===(r=e.adomain)||void 0===r?void 0:r[0])||(null==e||null===(i=e.meta)||void 0===i?void 0:i.advertiserName)||((0,l.Cg)(e)??[])[0]||(null==e||null===(o=e.adserverTargeting)||void 0===o?void 0:o.hb_adomain);return s?`${s}`:void 0},s=e=>{var t,n,r;const i=e.rubicon&&"object"==typeof e.rubicon&&"advertiserId"in e.rubicon&&e.rubicon.advertiserId||(null==e||null===(t=e.meta)||void 0===t?void 0:t.brandId)||(null==e||null===(n=e.meta)||void 0===n?void 0:n.buyerId)||(null==e||null===(r=e.meta)||void 0===r?void 0:r.advertiserId);return i?`${i}`:void 0},a={equals:(e,t)=>e.ad_unit_code===t.ad_unit_code&&e.ad_id===t.ad_id&&e.auction_id===t.auction_id&&e.winning_bid===t.winning_bid},u=e=>!(0,i.t9)(a)(e,this.trackedBids),d=(t,n)=>{const i=(0,l.zi)(e),o=((e,t,n)=>({ad_id:e.adId??"",ad_unit_code:e.adUnitCode??"",bidder:e.bidder,bidder_timeout:n,deal_id:(0,l.$7)(e),cpm:(0,l.Qd)(e),hb_pb:e.adserverTargeting&&e.adserverTargeting.hb_pb,height:(0,c.rH)(e.height),width:(0,c.rH)(e.width),time_to_respond:e.timeToRespond,bid_available:"string"==typeof e.statusMessage&&e.statusMessage.indexOf("empty")<0,winning_bid:t,advertiser_id:s(e),advertiser_name:r(e),dsp_id:(0,l.cs)(e),auction_id:e.auctionId}))(t,n,(0,c.rH)(i.bidderTimeout));u(o)&&(o.cpm&&o.cpm>0&&n&&this.permutive.track("PrebidBid",o),this.updateTrackedBids(o))};e.que.push((()=>{window.googletag.cmd.push(t)}))}trackMetrics(){performance.mark(p),performance.measure(d,f,p);const e=performance.getEntriesByName(d)[0].duration;this.options.metrics.track({name:"sdk_addon_init_duration_seconds",value:e,labels:{addon:"prebid"}})}updateTrackedBids(e){const t=this.trackedBids.findIndex((t=>e.ad_id===t.ad_id&&e.winning_bid!==t.winning_bid));t>-1?this.trackedBids[t]={...this.trackedBids[t],...e}:this.trackedBids.push(e)}}const h="prebid",v=(0,r.Hn)("prebid")("data_provider_config",{ac_bidders:[]}),_=e=>{(0,r.Hn)(h)("auto_init",!1)&&e.q.push({functionName:"addon",arguments:[h,{}]})};class b extends m{externalData;dataProviderParamsFromIntegrationConfig={};constructor(e){super(e),this.externalData=e.externalData,this.parsePrebidConfig()}getPermutiveRtdConfig(){return this.logDebug("RTD config retrieved",this.dataProviderParamsFromIntegrationConfig),this.dataProviderParamsFromIntegrationConfig}storeAndSetPermutiveRtdConfig(e){this.externalData.setExternalJsonData("permutive-prebid-rtd",e),this.dataProviderParamsFromIntegrationConfig=e}parsePrebidConfig(){this.logDebug("data provider config",v);const{ac_bidders:e}=v;this.storeAndSetPermutiveRtdConfig({acBidders:e})}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.log("[prebid]",...t)}}},7476:(e,t,n)=>{n.r(t),n.d(t,{eventCacheService:()=>d,eventNameBlacklist:()=>p});var r=n(2851),i=n(2116),o=n(6392),s=n(3735),a=n(3328),u=n(2652),c=n(8377),l=n(7548);const d=e=>i.dQ((0,s.ls)((e=>{let{previousState:t}=e;return function(e){if(e&&"object"==typeof e)return{previousUnloadEvents:"previousUnloadEvents"in e?f(e.previousUnloadEvents):[]};return{previousUnloadEvents:[]}}(t)}),(t=>{let{previousUnloadEvents:n}=t;n.forEach((t=>e.eventsCache.add((0,l.k)(t),{persistOnDisk:!0})));return{value:{newEvents:(0,s.zG)(e.newEvents,r.UI(o.UI((0,u.bw)(a.UI((t=>{let[,n]=t;p.has(n.name)||e.eventsCache.add(n,{persistOnDisk:!0})})))))),priorEvents:()=>e.eventsCache.all()},state:(0,s.zG)(e.eventsToProcessOnPageUnload,r.UI(a.hX((e=>{let[,t]=e;return!p.has(t.name)}))),r.UI(a.UI((0,s.ls)(c.Yg,l.X))),r.UI((e=>({previousUnloadEvents:e}))))}})));function f(e){return e&&Array.isArray(e)?e:[]}const p=new Set(["AdRequest","PageviewEngagement","PrebidAuctions","Reaction","SegmentEntry","SegmentExit","SlotRendered","ThirdPartySegments","VideoEngagement"])},926:(e,t,n)=>{n.d(t,{Kd:()=>i,eJ:()=>o});n(9853);var r=n(2116);n(2851),n(2652);const i="addon:twitter_pixel",o=function(e){return r.K4((()=>{}))}},1828:(e,t,n)=>{n.d(t,{Qt:()=>s,Yt:()=>d,ap:()=>o,gz:()=>l});var r=n(3735),i=n(9384);function o(e,t){return function(n){return function(r){return e.ap(e.map(r,(function(e){return function(n){return t.ap(e,n)}})),n)}}}function s(e){return function(t,n){return function(r){return e.ap(e.map(r,(function(e){return function(n){var r;return Object.assign({},e,((r={})[t]=n,r))}})),n)}}}function a(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,0===t?e.apply(null,i):a(e,t-1,i)}}var u={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function c(e){return i.e$.call(u,e)||(u[e]=a(r.bc,e-1,[])),u[e]}function l(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=c(r),o=e.map(t[0],i),s=1;s<r;s++)o=e.ap(o,t[s]);return o}}function d(e){return function(t){for(var n=Object.keys(t),r=n.length,i=function(e){var t=e.length;switch(t){case 1:return function(t){var n;return(n={})[e[0]]=t,n};case 2:return function(t){return function(n){var r;return(r={})[e[0]]=t,r[e[1]]=n,r}};case 3:return function(t){return function(n){return function(r){var i;return(i={})[e[0]]=t,i[e[1]]=n,i[e[2]]=r,i}}};case 4:return function(t){return function(n){return function(r){return function(i){var o;return(o={})[e[0]]=t,o[e[1]]=n,o[e[2]]=r,o[e[3]]=i,o}}}};case 5:return function(t){return function(n){return function(r){return function(i){return function(o){var s;return(s={})[e[0]]=t,s[e[1]]=n,s[e[2]]=r,s[e[3]]=i,s[e[4]]=o,s}}}}};default:return a((function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i}),t-1,[])}}(n),o=e.map(t[n[0]],i),s=1;s<r;s++)o=e.ap(o,t[n[s]]);return o}}},5851:(e,t,n)=>{n.d(t,{oA:()=>y,t9:()=>p,DZ:()=>b,Ew:()=>c,f2:()=>l,xH:()=>v,jV:()=>g,uK:()=>w,tV:()=>k,u4:()=>S,DY:()=>f});var r=n(3735),i=(n(7341),n(9384)),o=n(7241);i.r1;var s=function(e){return[e]};o.xP,o.Lx,o.u4,o.OE,o.nq,o.iw,o.YM,o.ZN,o.Eh,i.F4,o.YM,o.Z$,o.VV,o.Fp,o.j0;o.ur;var a=n(3328),u=n(4870);n(5605);a.P5,a.YM,a.Z$;a.cx;function c(e){return a.Ew(e)}var l=a.f2;a.JO,a.qr;var d=function(e){return e.slice()},f=function(e){return function(t){return t.length<=1?d(t):t.slice().sort(e.compare)}};var p=a.t9;function g(e){var t=p(e);return function(n,r){if(void 0===r){var i=g(e);return function(e){return i(e,n)}}return n.filter((function(e){return t(e,r)}))}}a.kp,a.Eq;var m=s,h=function(e){return function(t){return(0,r.zG)(t,function(e){return function(t){for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}}((function(t,n){return e(n)})))}},v=h(r.yR),_=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var o=e(r,t[r]);i.pC(o)&&n.push(o.value)}return n}},b=function(e){return _((function(t,n){return e(n)}))},y=b(r.yR),w=function(e){return I((function(t,n){return e(n)}))},I=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return(0,u.s4)(n,r)}},k=function(e){return E((function(t,n){return e(n)}))},E=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);"Left"===o._tag?n.push(o.left):r.push(o.right)}return(0,u.s4)(n,r)}},S=(a.Lx,a.xP,a.u4);a.OE,a.nq,a.iw,a.ZN,a.Eh,a.pR,a.pJ,a.oR,a.yW,a.j0,i.F4},6862:(e,t,n)=>{function r(e){return function(t){return function(n){return e.chain(n,(function(n){return e.map(t(n),(function(){return n}))}))}}}function i(e){return function(t,n){return function(r){return e.chain(r,(function(r){return e.map(n(r),(function(e){var n;return Object.assign({},r,((n={})[t]=e,n))}))}))}}}n.d(t,{a:()=>i,m:()=>r})},365:(e,t,n)=>{n.d(t,{G5:()=>v,dO:()=>g,Pd:()=>w,ak:()=>$,tS:()=>b,Y$:()=>O,g_:()=>z,ij:()=>A,Yo:()=>S,DT:()=>E,fS:()=>T,pF:()=>C,nM:()=>P,t$:()=>a,UI:()=>p,Vn:()=>I,EQ:()=>D,vx:()=>x,F2:()=>u,LF:()=>M,KC:()=>L,i$:()=>q,Y3:()=>R});var r=n(6862),i=n(2690),o=n(3735),s=(n(7341),n(9384)),a=s.t$,u=s.F2,c=function(e,t){return(0,o.zG)(e,p(t))},l=function(e,t){return(0,o.zG)(e,h(t))},d=function(e,t){return(0,o.zG)(e,b(t))},f="Either",p=function(e){return function(t){return P(t)?t:u(e(t.right))}},g={URI:f,map:c},m=u,h=function(e){return function(t){return P(t)?t:P(e)?e:u(t.right(e.right))}},v={URI:f,map:c,ap:l},_=function(e){return function(t){return P(t)?t:e(t.right)}},b=_,y={URI:f,map:c,ap:l,chain:d},w=function(e,t){return function(n){return P(n)?a(e(n.left)):u(t(n.right))}},I=function(e){return function(t){return P(t)?a(e(t.left)):t}},k={URI:f,fromEither:o.yR},E=(0,i.DT)(k),S=(0,i.Yo)(k),P=s.nM,G=(s.tO,function(e,t){return function(n){return P(n)?e(n.left):t(n.right)}}),U=G,D=G,z=D,C=function(e){return function(t){return P(t)?e(t.left):t.right}},T=C,O=(0,i.Y$)(k,y),M=function(e){return P(e)?u(e.left):a(e.right)},x=function(e){return function(t){return P(t)?e(t.left):t}},A=function(e){return function(t){return null==t?a(e):u(t)}},R=function(e,t){try{return u(e())}catch(e){return a(t(e))}},q=U(o.yR,o.yR);function L(e){return e instanceof Error?e:new Error(String(e))}s.F4;var $=(0,r.a)(y);s.Xl},4268:(e,t,n)=>{n.d(t,{f7:()=>r,n_:()=>i,w4:()=>o});n(3735);var r=function(e){return{equals:function(t,n){return t===n||e(t,n)}}},i=function(e){return r((function(t,n){for(var r in e)if(!e[r].equals(t[r],n[r]))return!1;return!0}))},o={equals:function(e,t){return e===t}};o.equals},2690:(e,t,n)=>{n.d(t,{DT:()=>s,Y$:()=>c,Yo:()=>o,fX:()=>u});var r=n(3735),i=n(9384);function o(e){return function(t){return function(n){return e.fromEither(i.Wi(n)?i.t$(t()):i.F2(n.value))}}}function s(e){return function(t,n){return function(r){return e.fromEither(t(r)?i.F2(r):i.t$(n(r)))}}}function a(e){return function(t){return(0,r.ls)(t,e.fromEither)}}function u(e,t){var n=a(e);return function(e){return function(r){return t.chain(r,n(e))}}}function c(e,t){return function(n,r){return function(o){return t.chain(o,(function(t){return e.fromEither(n(t)?i.F2(t):i.t$(r(t)))}))}}}},7341:(e,t,n)=>{function r(e,t){return function(n){return function(r){return e.map(r,(function(e){return t.map(e,n)}))}}}function i(e){return function(t){return function(n){return e.map(n,(function(e){var n;return(n={})[t]=e,n}))}}}function o(e){return function(t,n){return function(r){return e.map(r,(function(e){var r;return Object.assign({},e,((r={})[t]=n(e),r))}))}}}n.d(t,{Hr:()=>o,UI:()=>r,YO:()=>i})},6392:(e,t,n)=>{n.d(t,{G5:()=>l,RD:()=>g,UI:()=>a,of:()=>u});var r=n(3735),i=(n(7341),n(9384)),o=function(e,t){return function(){return t(e())}},s=function(e,t){return function(){return e()(t())}},a=function(e){return function(t){return o(t,e)}},u=r.a9,c="IO",l={URI:c,map:o,ap:s},d=(r.yR,r.yR,i.F4,u(i.Xl)),f=function(e){var t=function(e){return function(t){return function(){for(var n=[e(0,i.YM(t))()],r=1;r<t.length;r++)n.push(e(r,t[r])());return n}}}(e);return function(e){return i.Od(e)?t(e):d}},p=function(e){return f((function(t,n){return e(n)}))},g=p(r.yR)},2884:(e,t,n)=>{n.d(t,{G5:()=>G,Ri:()=>A,xu:()=>B,dO:()=>E,wp:()=>z,tS:()=>U,mU:()=>V,hX:()=>R,DZ:()=>q,xH:()=>H,g_:()=>K,Uo:()=>F,ij:()=>J,KQ:()=>Z,DT:()=>d,Eh:()=>I,IS:()=>f,fS:()=>W,EK:()=>p,lo:()=>T,Wi:()=>N,pC:()=>j,UI:()=>k,EQ:()=>Q,aD:()=>Y,YP:()=>c,of:()=>S,RD:()=>re,G:()=>l,FS:()=>ee,Y3:()=>X,bM:()=>C});var r=n(6862),i=n(3735),o=(n(7341),n(9384)),s=n(6017),a=n(4870);n(5605);function u(e,t){return function(n){return n?t.of(void 0):e.zero()}}var c=o.YP,l=o.G;function d(e){return function(t){return e(t)?l(t):c}}var f=function(e){return"Right"===e._tag?c:l(e.left)},p=function(e){return"Left"===e._tag?c:l(e.right)},g=function(e,t){return(0,i.zG)(e,k(t))},m=function(e,t){return(0,i.zG)(e,P(t))},h=function(e,t){return(0,i.zG)(e,U(t))},v=function(e,t){return(0,i.zG)(e,R(t))},_=function(e,t){return(0,i.zG)(e,q(t))},b=function(e,t){return(0,i.zG)(e,L(t))},y=function(e,t){return(0,i.zG)(e,$(t))},w="Option",I=function(e){return{equals:function(t,n){return t===n||(N(t)?N(n):!N(n)&&e.equals(t.value,n.value))}}},k=function(e){return function(t){return N(t)?c:l(e(t.value))}},E={URI:w,map:g},S=l,P=function(e){return function(t){return N(t)||N(e)?c:l(t.value(e.value))}},G={URI:w,map:g,ap:m},U=function(e){return function(t){return N(t)?c:e(t.value)}},D={URI:w,map:g,ap:m,chain:h},z=function(e){return function(t){return N(t)?e():t}},C=function(){return c},T=u({URI:w,zero:C},{URI:w,of:S}),O=U(i.yR),M=(0,a.s4)(c,c),x=function(e){return N(e)?M:(0,a.s4)(f(e.value),p(e.value))},A={URI:w,compact:O,separate:x},R=function(e){return function(t){return N(t)?c:e(t.value)?t:c}},q=function(e){return function(t){return N(t)?c:e(t.value)}},L=function(e){return function(t){return(0,a.s4)(v(t,(0,s.ff)(e)),v(t,e))}},$=function(e){return(0,i.ls)(k(e),x)},B={URI:w,map:g,compact:O,separate:x,filter:v,filterMap:_,partition:b,partitionMap:y},F=p,j=o.pC,N=function(e){return"None"===e._tag},Y=function(e,t){return function(n){return N(n)?e():t(n.value)}},Q=Y,K=Q,W=function(e){return function(t){return N(t)?e():t.value}},H=O,V=(0,r.m)(D),J=function(e){return null==e?c:l(e)},X=function(e){try{return l(e())}catch(e){return c}},Z=function(e){return(0,i.ls)(e,J)},ee=Q(i.r5,i.yR);o.F4;var te=S(o.Xl),ne=function(e){var t=function(e){return function(t){var n=e(0,o.YM(t));if(N(n))return c;for(var r=[n.value],i=1;i<t.length;i++){var s=e(i,t[i]);if(N(s))return c;r.push(s.value)}return l(r)}}(e);return function(e){return o.Od(e)?t(e):te}},re=function(e){return ne((function(t,n){return e(n)}))}(i.yR)},7209:(e,t,n)=>{n.d(t,{Fp:()=>u,VV:()=>a,Zt:()=>s,uZ:()=>c});var r=n(4268),i=n(3735),o=function(e){return function(t,n){return t===n||0===e(t,n)}},s=function(e){return{equals:o(e),compare:function(t,n){return t===n?0:e(t,n)}}},a=(i.W8,function(e){return function(t,n){return t===n||e.compare(t,n)<1?t:n}}),u=function(e){return function(t,n){return t===n||e.compare(t,n)>-1?t:n}},c=function(e){var t=a(e),n=u(e);return function(e,r){return function(i){return n(t(i,r),e)}}};r.w4.equals},6017:(e,t,n)=>{n.d(t,{ff:()=>r});n(3735);var r=function(e){return function(t){return!e(t)}}},3328:(e,t,n)=>{n.d(t,{$R:()=>G,DZ:()=>j,EQ:()=>m,Eh:()=>ne,Eq:()=>O,Ew:()=>w,G:()=>le,Hr:()=>pe,JO:()=>k,Lx:()=>W,OE:()=>H,Od:()=>p,P5:()=>v,Su:()=>L,UI:()=>q,YM:()=>_,YO:()=>fe,Z$:()=>b,ZN:()=>ee,bM:()=>x,bj:()=>P,cS:()=>ue,cx:()=>y,f2:()=>I,hX:()=>B,hp:()=>S,iw:()=>J,j0:()=>de,kp:()=>T,nI:()=>ae,nq:()=>V,oR:()=>se,of:()=>M,oh:()=>$,pJ:()=>oe,pR:()=>re,qr:()=>E,t9:()=>U,tS:()=>A,u4:()=>K,uK:()=>N,uZ:()=>te,vP:()=>X,xH:()=>R,xP:()=>Q,xb:()=>f,yW:()=>ce,zo:()=>D});var r=n(4268),i=n(3735),o=n(7341),s=n(9384),a=n(4011),u=n(7209),c=n(7241),l=n(4870),d=(n(5605),function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}),f=function(e){return 0===e.length},p=c.Od,g=(c.Ce,c.ws,c.R3);c.Im;var m=function(e,t){return function(n){return p(n)?t(n):e()}},h=c.dC;function v(e,t){return void 0===t?function(t){return v(e,t)}:h(e,t)?s.YP:s.G(t[e])}var _=function(e){return p(e)?s.G(c.YM(e)):s.YP},b=function(e){return p(e)?s.G(c.Z$(e)):s.YP};var y=function(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return s.G(n);return s.YP}};function w(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return s.G(t[n]);return s.YP}}var I=function(e){return function(t){for(var n=0;n<t.length;n++){var r=e(t[n]);if(s.pC(r))return r}return s.YP}};var k=function(e){return function(t){for(var n=t.length-1;n>=0;n--){var r=e(t[n]);if(s.pC(r))return r}return s.YP}},E=function(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return s.G(n);return s.YP}},S=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];"Right"===r._tag&&t.push(r.right)}return t},P=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];"Left"===r._tag&&t.push(r.left)}return t};function G(e,t){return void 0===t?function(t){return G(t,e)}:function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r}(e,t,(function(e,t){return[e,t]}))}function U(e){return function(t,n){if(void 0===n){var r=U(e);return function(e){return r(t,e)}}for(var i,o=0;o<n.length;o++)if(i=n[o],e.equals(i,t))return!0;return!1}}var D=function(e){return function(t){return f(t)?e:f(e)?t:t.concat(e)}};var z=function(e,t){return(0,i.zG)(e,q(t))},C=function(e,t,n){return(0,i.zG)(e,K(t,n))},T=function(e,t){return(0,i.zG)(e,oe(t))},O=function(e,t){return(0,i.zG)(e,se(t))},M=c.of,x=function(){return ue},A=function(e){return function(t){return(0,i.zG)(t,function(e){return function(t){if(f(t))return ue;for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}}((function(t,n){return e(n)})))}},R=A(i.yR),q=function(e){return function(t){return t.map((function(t){return e(t)}))}},L=function(e){return function(t){return t.map((function(t,n){return e(n,t)}))}},$=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];"Left"===o._tag?t.push(o.left):n.push(o.right)}return(0,l.s4)(t,n)},B=function(e){return function(t){return t.filter(e)}},F=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);s.pC(i)&&n.push(i.value)}return n}},j=function(e){return F((function(t,n){return e(n)}))},N=(i.yR,function(e){return Y((function(t,n){return e(n)}))}),Y=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return(0,l.s4)(n,r)}},Q=function(e){return function(t){return function(n){return n.reduce((function(n,r,i){return e.concat(n,t(i,r))}),e.empty)}}},K=function(e,t){return H(e,(function(e,n,r){return t(n,r)}))},W=function(e){var t=Q(e);return function(e){return t((function(t,n){return e(n)}))}},H=function(e,t){return function(n){for(var r=n.length,i=e,o=0;o<r;o++)i=t(o,i,n[o]);return i}},V=function(e,t){return J(e,(function(e,n,r){return t(n,r)}))},J=function(e,t){return function(n){return n.reduceRight((function(e,n,r){return t(r,n,e)}),e)}},X=function(e){return function(t){return C(t,e.of(x()),(function(t,n){return e.ap(e.map(t,(function(e){return function(t){return(0,i.zG)(e,g(t))}})),n)}))}},Z="ReadonlyArray",ee=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},te=function(){return{concat:function(e,t){return f(e)?t:f(t)?e:e.concat(t)},empty:ue}},ne=function(e){return(0,r.f7)((function(t,n){return t.length===n.length&&t.every((function(t,r){return e.equals(t,n[r])}))}))},re=function(e){return(0,u.Zt)((function(t,n){for(var r=t.length,i=n.length,o=Math.min(r,i),s=0;s<o;s++){var u=e.compare(t[s],n[s]);if(0!==u)return u}return a.Df.compare(r,i)}))},ie={URI:Z,map:z},oe=function(e){return function(t){for(var n=d([],e(t),!0),r=[];n.length>0;){var i=n.shift();s.nM(i)?n.unshift.apply(n,e(i.left)):r.push(i.right)}return r}},se=function(e){return function(t){var n=e(t),r=[],i=[];function o(t){s.nM(t)?e(t.left).forEach((function(e){return r.push(e)})):i.push(t.right)}for(var a=0,u=n;a<u.length;a++){o(u[a])}for(;r.length>0;)o(r.shift());return i}},ae=(c.oo,function(e){return f(e)?ue:e.slice()}),ue=c.cS;function ce(e){return function(t){return t.every(e)}}var le=function(e){return function(t){return t.some(e)}},de=function(e){var t=c.j0(e);return function(n){return m((function(){return e.empty}),t(n))}},fe=(s.F4,(0,o.YO)(ie)),pe=(0,o.Hr)(ie);c.w6,c.QI,c.Ss},7241:(e,t,n)=>{n.d(t,{R3:()=>v,Im:()=>h,ur:()=>F,QI:()=>N,cS:()=>d,Lx:()=>D,xP:()=>T,c2:()=>b,Eh:()=>A,ZN:()=>x,vM:()=>k,YM:()=>R,j0:()=>j,Od:()=>f,dC:()=>p,Z$:()=>L,UI:()=>P,Fp:()=>B,VV:()=>$,of:()=>S,Ce:()=>m,ws:()=>g,w6:()=>w,u4:()=>U,nq:()=>z,iw:()=>O,OE:()=>C,Ss:()=>Y,oo:()=>_});var r,i=n(4268),o=n(3735),s=(n(7341),n(9384)),a=n(7209),u=function(e){return{concat:a.VV(e)}},c=function(e){return{concat:a.Fp(e)}};r=void 0;var l=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},d=s.Xl,f=s.Od,p=function(e,t){return e<0||e>=t.length},g=function(e){return function(t){return l([e],t,!0)}},m=g,h=function(e){return function(t){return l(l([],t,!0),[e],!1)}},v=h,_=function(e,t,n){if(f(n)){var r=s.r1(n);return r.splice(e,0,t),r}return[t]},b=function(e){return f(e)?s.G(e):s.YP},y=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},w=function(e,t){return e<=t?y((function(t){return e+t}))(t-e+1):[e]};function I(e,t){return t?e.concat(t):function(t){return t.concat(e)}}var k=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);s.e$.call(n,a)?n[a].push(o):n[a]=[o]}return n}};var E=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},S=s.ri,P=function(e){return G((function(t,n){return e(n)}))},G=function(e){return function(t){for(var n=[e(0,R(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},U=function(e,t){return C(e,(function(e,n,r){return t(n,r)}))},D=function(e){return function(t){return function(n){return n.slice(1).reduce((function(n,r){return e.concat(n,t(r))}),t(n[0]))}}},z=function(e,t){return O(e,(function(e,n,r){return t(n,r)}))},C=function(e,t){return function(n){return n.reduce((function(e,n,r){return t(r,e,n)}),e)}},T=function(e){return function(t){return function(n){return n.slice(1).reduce((function(n,r,i){return e.concat(n,t(i+1,r))}),t(0,n[0]))}}},O=function(e,t){return function(n){return n.reduceRight((function(e,n,r){return t(r,n,e)}),e)}},M=s.YM,x=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},A=function(e){return(0,i.f7)((function(t,n){return t.length===n.length&&t.every((function(t,r){return e.equals(t,n[r])}))}))},R=(s.F4,M),q=s.Gb,L=function(e){return e[e.length-1]},$=function(e){var t=u(e);return function(e){return e.reduce(t.concat)}},B=function(e){var t=c(e);return function(e){return e.reduce(t.concat)}},F=function(e){return function(t){return t.reduce(e.concat)}},j=function(e){var t=F(e);return function(e){return(0,o.ls)(function(e){return function(t){var n=q(t);return f(n)?(0,o.zG)(n,E(e),m(R(t))):t}}(e),t)}};function N(e,t){return void 0===t?m(e):(0,o.zG)(t,m(e))}var Y=function(e,t){return(0,o.zG)(e,I([t]))}},4923:(e,t,n)=>{n.d(t,{Bu:()=>m,CC:()=>A,DZ:()=>Z,EG:()=>g,EW:()=>j,Eh:()=>ue,G:()=>C,HA:()=>O,Hd:()=>P,I8:()=>q,P5:()=>h,RF:()=>R,RJ:()=>$,SW:()=>Y,Su:()=>_,UI:()=>b,Ub:()=>K,V_:()=>F,XP:()=>d,_Y:()=>B,_r:()=>S,dp:()=>u,dx:()=>f,e$:()=>p,hX:()=>X,jt:()=>G,kp:()=>x,mK:()=>V,mS:()=>L,nn:()=>M,nr:()=>le,nu:()=>N,oA:()=>oe,oh:()=>se,qS:()=>H,ri:()=>k,sq:()=>D,t9:()=>T,tV:()=>te,uK:()=>ee,uZ:()=>ce,vA:()=>W,vP:()=>E,xb:()=>c,yW:()=>z,z7:()=>U,zV:()=>Q});var r=n(4268),i=n(3735),o=n(9384),s=n(4870),a=n(2751),u=(n(5605),function(e){return Object.keys(e).length}),c=function(e){for(var t in e)if(o.e$.call(e,t))return!1;return!0},l=function(e){return function(t){return Object.keys(t).sort(e.compare)}},d=l(a.Df);var f=function(e,t){return function(n){if(o.e$.call(n,e)&&n[e]===t)return n;var r=Object.assign({},n);return r[e]=t,r}},p=function(e,t){return o.e$.call(t,e)};function g(e){return function(t){if(!o.e$.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}function m(e){return function(t,n){if(void 0===n){var r=m(e);return function(e){return r(e,t)}}for(var i in t)if(!o.e$.call(n,i)||!e.equals(t[i],n[i]))return!1;return!0}}function h(e,t){return void 0===t?function(t){return h(e,t)}:o.e$.call(t,e)?o.G(t[e]):o.YP}var v={};function _(e){return function(t){var n={};for(var r in t)o.e$.call(t,r)&&(n[r]=e(r,t[r]));return n}}function b(e){return _((function(t,n){return e(n)}))}function y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(2===e.length)return y(a.Df).apply(void 0,e);var n=l(e[0]);return function(e,t){return function(r){for(var i=e,o=n(r),s=o.length,a=0;a<s;a++){var u=o[a];i=t(u,i,r[u])}return i}}}function w(e){if("compare"in e){var t=l(e);return function(e){return function(n){return function(r){for(var i=e.empty,o=t(r),s=o.length,a=0;a<s;a++){var u=o[a];i=e.concat(i,n(u,r[u]))}return i}}}}return w(a.Df)(e)}function I(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(2===e.length)return I(a.Df).apply(void 0,e);var n=l(e[0]);return function(e,t){return function(r){for(var i=e,o=n(r),s=o.length-1;s>=0;s--){var a=o[s];i=t(a,r[a],i)}return i}}}var k=function(e,t){var n;return(n={})[e]=t,n};function E(e){return V(a.Df)(e)}function S(e){return function(t){var n={},r={};for(var i in t)if(o.e$.call(t,i)){var a=e(i,t[i]);switch(a._tag){case"Left":n[i]=a.left;break;case"Right":r[i]=a.right}}return(0,s.s4)(n,r)}}function P(e){return function(t){var n={},r={};for(var i in t)if(o.e$.call(t,i)){var a=t[i];e(i,a)?r[i]=a:n[i]=a}return(0,s.s4)(n,r)}}function G(e){return function(t){var n={};for(var r in t)if(o.e$.call(t,r)){var i=e(r,t[r]);o.pC(i)&&(n[r]=i.value)}return n}}function U(e){return function(t){var n={},r=!1;for(var i in t)if(o.e$.call(t,i)){var s=t[i];e(i,s)?n[i]=s:r=!0}return r?n:t}}var D=function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];t[i[0]]=i[1]}return t};function z(e){return function(t){for(var n in t)if(!e(t[n]))return!1;return!0}}function C(e){return function(t){for(var n in t)if(e(t[n]))return!0;return!1}}function T(e){return function(t,n){if(void 0===n){var r=T(e);return function(e){return r(t,e)}}for(var i in n)if(e.equals(n[i],t))return!0;return!1}}var O=function(e,t){return(0,i.zG)(e,b(t))},M=function(e,t){return(0,i.zG)(e,_(t))},x=function(e){var t=ne(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},A=function(e){return function(t){var n=re(e)(t);return function(e,t){return(0,i.zG)(e,n(t))}}},R=function(e){var t=ie(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},q=function(e,t){return(0,i.zG)(e,X(t))},L=function(e,t){return(0,i.zG)(e,Z(t))},$=function(e,t){return(0,i.zG)(e,ee(t))},B=function(e,t){return(0,i.zG)(e,te(t))},F=function(e){var t=y(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},j=function(e){var t=w(e);return function(e){var n=t(e);return function(e,t){return(0,i.zG)(e,n(t))}}},N=function(e){var t=I(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},Y=function(e,t){return(0,i.zG)(e,S(t))},Q=function(e,t){return(0,i.zG)(e,P(t))},K=function(e,t){return(0,i.zG)(e,G(t))},W=function(e,t){return(0,i.zG)(e,U(t))},H=function(e){var t=J(e);return function(e){var n=t(e);return function(e,t){return n(e,(0,i.ls)(i.SK,t))}}},V=function(e){var t=H(e);return function(e){var n=t(e);return function(e){return n(e,i.yR)}}},J=function(e){return function(t){var n=l(e);return function(e,r){var i=n(e);if(0===i.length)return t.of(v);for(var o=t.of({}),s=function(n){o=t.ap(t.map(o,(function(e){return function(t){var r;return Object.assign({},e,((r={})[n]=t,r))}})),r(n,e[n]))},a=0,u=i;a<u.length;a++){s(u[a])}return o}}},X=function(e){return U((function(t,n){return e(n)}))},Z=function(e){return G((function(t,n){return e(n)}))},ee=function(e){return P((function(t,n){return e(n)}))},te=function(e){return S((function(t,n){return e(n)}))};function ne(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){var n=y(e[0]);return function(e,t){return n(e,(function(e,n,r){return t(n,r)}))}}return ne(a.Df).apply(void 0,e)}function re(e){if("compare"in e){var t=w(e);return function(e){var n=t(e);return function(e){return n((function(t,n){return e(n)}))}}}return re(a.Df)(e)}function ie(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){var n=I(e[0]);return function(e,t){return n(e,(function(e,n,r){return t(n,r)}))}}return ie(a.Df).apply(void 0,e)}var oe=function(e){var t={};for(var n in e)if(o.e$.call(e,n)){var r=e[n];o.pC(r)&&(t[n]=r.value)}return t},se=function(e){var t={},n={};for(var r in e)if(o.e$.call(e,r)){var i=e[r];o.nM(i)?t[r]=i.left:n[r]=i.right}return(0,s.s4)(t,n)},ae="ReadonlyRecord";function ue(e){var t=m(e);return(0,r.f7)((function(e,n){return t(e)(n)&&t(n)(e)}))}function ce(e){return{concat:function(t,n){if(c(t))return n;if(c(n))return t;var r=Object.assign({},t);for(var i in n)o.e$.call(n,i)&&(r[i]=o.e$.call(t,i)?e.concat(t[i],n[i]):n[i]);return r},empty:v}}a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df;function le(e,t){return o.e$.call(void 0===t?this:t,e)}a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df,a.Df},8377:(e,t,n)=>{n.d(t,{H5:()=>s,Yg:()=>i,li:()=>r,pL:()=>o});n(3735);function r(e){return e[0]}function i(e){return e[1]}var o=function(e){return function(t){return[e(r(t)),i(t)]}},s=function(e){return function(t){return[r(t),e(i(t))]}}},2197:(e,t,n)=>{n.d(t,{ff:()=>r});var r=function(e){return function(t){return!e(t)}}},4870:(e,t,n)=>{n.d(t,{Pd:()=>i,s4:()=>r});n(3735);var r=function(e,t){return{left:e,right:t}},i=function(e,t){return function(n){return r(e(o(n)),t(s(n)))}},o=function(e){return e.left},s=function(e){return e.right}},7407:(e,t,n)=>{n.d(t,{qA:()=>w,Hi:()=>y,qo:()=>I,dO:()=>_,UA:()=>k,PM:()=>b,Qt:()=>D,ak:()=>U,YO:()=>G,tS:()=>h,mU:()=>E,At:()=>P,tD:()=>c,UI:()=>p,of:()=>m,uU:()=>O,pE:()=>M});var r=n(1828),i=n(6862),o=n(3735);function s(e,t){var n=(0,i.m)(t);return function(t){return n((0,o.ls)(t,e.fromIO))}}var a=n(7341),u=n(9384),c=function(e){return function(){return Promise.resolve().then(e)}};var l=function(e,t){return(0,o.zG)(e,p(t))},d=function(e,t){return(0,o.zG)(e,g(t))},f=function(e,t){return(0,o.zG)(e,h(t))},p=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},g=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then((function(e){return(0,e[0])(e[1])}))}}},m=function(e){return function(){return Promise.resolve(e)}},h=function(e){return function(t){return function(){return Promise.resolve().then(t).then((function(t){return e(t)()}))}}},v="Task";var _={URI:v,map:l},b={URI:v,of:m},y={URI:v,map:l,ap:d},w={URI:v,map:l,ap:d,of:m},I={URI:v,map:l,ap:d,chain:f},k={URI:v,map:l,of:m,ap:d,chain:f},E=(o.yR,(0,i.m)(I)),S={URI:v,fromIO:c},P=s(S,I),G=(u.F4,(0,a.YO)(_)),U=(0,i.a)(I),D=(0,r.Qt)(y),z=m(u.Xl),C=function(e){var t=function(e){return function(t){return function(){return Promise.all(t.map((function(t,n){return Promise.resolve().then((function(){return e(n,t)()}))})))}}}(e);return function(e){return u.Od(e)?t(e):z}},T=function(e){var t=function(e){return function(t){return function(){return u.Gb(t).reduce((function(t,n,r){return t.then((function(t){return Promise.resolve().then(e(r+1,n)).then((function(e){return t.push(e),t}))}))}),Promise.resolve().then(e(0,u.YM(t))).then(u.ri))}}}(e);return function(e){return u.Od(e)?t(e):z}},O=function(e){return C((function(t,n){return e(n)}))},M=function(e){return T((function(t,n){return e(n)}))}},2707:(e,t,n)=>{n.d(t,{Do:()=>_e,Qt:()=>we,ak:()=>ye,tS:()=>ie,fX:()=>ge,wE:()=>ve,Zl:()=>oe,Y$:()=>me,Uo:()=>F,tD:()=>$,fF:()=>B,fS:()=>Y,t$:()=>x,Hr:()=>be,UI:()=>ee,Vn:()=>ne,EQ:()=>j,LV:()=>N,of:()=>ae,vx:()=>K,F2:()=>A,Ij:()=>Ie,Y3:()=>Q});var r=n(1828),i=n(6862),o=n(365),s=n(3735),a=n(7341);function u(e){return(0,s.ls)(o.F2,e.of)}function c(e){return(0,s.ls)(o.t$,e.of)}function l(e){return function(t){return e.map(t,o.F2)}}function d(e){return function(t){return e.map(t,o.t$)}}function f(e){return function(t){return(0,s.ls)(o.ij(t),e.of)}}function p(e){var t=f(e);return function(e){var n=t(e);return function(e){return(0,s.ls)(e,n)}}}function g(e){var t=v(e),n=p(e);return function(e){var r=n(e);return function(e){return t(r(e))}}}function m(e){return(0,a.UI)(e,o.dO)}function h(e){return(0,r.ap)(e,o.G5)}function v(e){return function(t){return function(n){return e.chain(n,(function(n){return o.nM(n)?e.of(n):t(n.right)}))}}}function _(e){return function(t){return function(n){return e.chain(n,(function(n){return o.nM(n)?t():e.of(n)}))}}}function b(e){return function(t,n){return function(r){return e.map(r,o.Pd(t,n))}}}function y(e){return function(t){return function(n){return e.map(n,o.Vn(t))}}}function w(e){return function(t,n){return function(r){return e.map(r,o.EQ(t,n))}}}function I(e){return function(t,n){return function(r){return e.chain(r,o.EQ(t,n))}}}function k(e){return function(t){return function(n){return e.chain(n,o.EQ(t,e.of))}}}function E(e){return function(t){return function(n){return e.chain(n,(function(n){return o.nM(n)?t(n.left):e.of(n)}))}}}function S(e){var t=E(e);return function(n){return t((function(t){return e.map(n(t),(function(e){return o.nM(e)?e:o.t$(t)}))}))}}function P(e){return function(t){return function(n){return e.chain(n,o.EQ((function(n){return e.map(t(n),o.t$)}),(function(t){return e.of(o.F2(t))})))}}}function G(e){return function(t){return e.map(t,o.LF)}}function U(e){return function(t){return e.map(t,o.i$)}}var D=n(2690);function z(e,t){return function(n){var r=(0,s.ls)(n,e.fromTask);return function(e){return t.chain(e,r)}}}var C=n(9384),T=n(7407),O=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},M=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},x=c(T.PM),A=u(T.PM),R=l(T.dO),q=d(T.dO),L=(0,s.ls)(T.tD,R),$=(T.tD,L),B=R,F=T.of,j=(T.tD,w(T.dO)),N=I(T.UA),Y=k(T.UA),Q=function(e,t){return function(){return O(void 0,void 0,void 0,(function(){var n;return M(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(C.F2)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,C.t$(t(n))];case 3:return[2]}}))}))}},K=(T.dO,T.PM,T.PM,T.UA,E(T.UA)),W=(T.UA,T.UA,T.dO,function(e,t){return(0,s.zG)(e,ee(t))}),H=function(e,t){return(0,s.zG)(e,re(t))},V=function(e,t){return(0,s.zG)(e,ie(t))},J=function(e,t,n){return(0,s.zG)(e,te(t,n))},X=function(e,t){return(0,s.zG)(e,ne(t))},Z=function(e,t){return(0,s.zG)(e,se(t))},ee=m(T.dO),te=b(T.dO),ne=y(T.dO),re=h(T.Hi),ie=v(T.UA),oe=ie,se=_(T.UA),ae=A,ue=x,ce="TaskEither";var le={URI:ce,map:W},de={URI:ce,map:W,ap:H},fe={URI:ce,map:W,ap:H,chain:V},pe={URI:ce,fromEither:F},ge=(0,D.fX)(pe,fe),me=(0,D.Y$)(pe,fe),he={URI:ce,fromIO:$,fromTask:B},ve=z(he,fe);var _e=ae(C.F4),be=(0,a.Hr)(le),ye=(0,i.a)(fe),we=(0,r.Qt)(de),Ie=(C.Xl,{URI:ce,bimap:J,mapLeft:X,map:W,of:ae,ap:H,chain:V,alt:Z,fromIO:$,fromTask:B,throwError:ue})},5605:(e,t,n)=>{function r(e,t){return function(n){var r=e.traverse(n);return function(e,i){return n.map(r(e,i),t.separate)}}}function i(e,t){return function(n){var r=e.traverse(n);return function(e,i){return n.map(r(e,i),t.compact)}}}n.d(t,{BL:()=>i,Fj:()=>r})},3735:(e,t,n)=>{n.d(t,{MZ:()=>i,Q1:()=>c,SK:()=>p,W8:()=>s,a9:()=>o,bc:()=>d,gn:()=>a,ls:()=>l,r5:()=>u,yR:()=>r,zG:()=>f});function r(e){return e}var i=r;function o(e){return function(){return e}}var s=o(!0),a=o(null),u=o(void 0),c=u;function l(e,t,n,r,i,o,s,a,u){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return s(o(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(s(o(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return u(a(s(o(i(r(n(t(e.apply(this,arguments)))))))))}}}function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}function f(e,t,n,r,i,o,s,a,u){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return s(o(i(r(n(t(e))))));case 8:return a(s(o(i(r(n(t(e)))))));case 9:return u(a(s(o(i(r(n(t(e))))))));default:for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}var p=function(e,t){return t}},9384:(e,t,n)=>{n.d(t,{F2:()=>d,F4:()=>v,G:()=>a,Gb:()=>m,Od:()=>p,Wi:()=>i,Xl:()=>h,YM:()=>g,YP:()=>s,e$:()=>_,nM:()=>u,pC:()=>o,r1:()=>b,ri:()=>f,t$:()=>l,tO:()=>c});var r=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},i=function(e){return"None"===e._tag},o=function(e){return"Some"===e._tag},s={_tag:"None"},a=function(e){return{_tag:"Some",value:e}},u=function(e){return"Left"===e._tag},c=function(e){return"Right"===e._tag},l=function(e){return{_tag:"Left",left:e}},d=function(e){return{_tag:"Right",right:e}},f=function(e){return[e]},p=function(e){return e.length>0},g=function(e){return e[0]},m=function(e){return e.slice(1)},h=[],v={},_=Object.prototype.hasOwnProperty,b=function(e){return r([e[0]],e.slice(1),!0)}},4011:(e,t,n)=>{n.d(t,{Df:()=>i,Eq:()=>r});var r={equals:function(e,t){return e===t}},i={equals:r.equals,compare:function(e,t){return e<t?-1:e>t?1:0}};r.equals,i.compare},2751:(e,t,n)=>{n.d(t,{Df:()=>i,Eq:()=>r,pn:()=>s,xb:()=>o});var r={equals:function(e,t){return e===t}},i={equals:r.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},o=function(e){return 0===e.length},s=function(e,t){return function(n){return n.endsWith(e,t)}}},8537:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(477),i=n.n(r);function o(){return i()('/*! permutive-javascript-sdk v20.11.0 (web) (built 2024-09-20T12:29:27.036Z) */(()=>{"use strict";var __webpack_modules__={688:(e,t,n)=>{function r(e){return e instanceof Error?e:new Error("string"==typeof e?e:JSON.stringify(e))}n.d(t,{w:()=>r})},256:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{N:()=>runtimeFactory});const runtimeFactory=deps=>{const{provideEnvironment,...lookups}=generateLookupMethods(deps.runtimeInput),env=generateRuntimeEnvironment({lookups,hash:deps.hash});return provideEnvironment(env),{env,locallyLiftedQueries:deps.runtimeInput.queries(env)||{},cloudLiftedQueries:"function"==typeof deps.runtimeInput.interpretOnlyQueries?deps.runtimeInput.interpretOnlyQueries(env):{},queriesByEvent:deps.runtimeInput.eventSegments(env)||{},createCloudLiftQueries:cloudLiftQueries=>{const createQueries=eval?.(`"use strict";${cloudLiftQueries}`);return createQueries(env)}}};function generateRuntimeEnvironment(e){const t=e=>()=>{throw new Error(`${e} lookup has not been provided`)};let n=t("events"),r=t("literals"),i=t("properties"),o=t("ahoCorasick"),s=t("subexpressions"),u=t("rootCompression");function a(e){switch(e.length){case 0:return null;case 1:return e[0];default:return e}}function c(e,t,n=f){const r=i(t).reduce((function(e,t){return e&&null!=e[t]?e[t]:null}),e);return null===r?null:n(r)}function l(e,t,n=f){return e.properties?c(e.properties,t,n):null}e.lookups.onReady((e=>{const{ahoCorasick:t,events:a,literals:c,properties:l,subexpressions:f,rootCompression:d}=e;n=e=>"number"==typeof e?a[e]:e,r=e=>"number"==typeof e?c[e]:e,i=e=>"number"==typeof e?l[e]:e,o=e=>t[e],s=e=>f[e],u=e=>d[e]}));let f=e=>e,d=e=>!0;function p(e,t){return function(n){for(let r=0;r<e.length;r++){if((e[r](n)||!1)===t)return t}return!t}}function m(e){return p(e,!0)}function g(e){return p(e,!1)}let h=e=>t=>!e(t),v=(e,t)=>n=>n>=e&&n<=t,y=e=>new Date(e).getTime(),_=e=>c(e,["time"],y),b=(e,t)=>c(t,e,y),I=(e,t,n,r,i,o)=>s=>{const u=c(s,e,(e=>e.filter(r).map((e=>c(e,t))).reduce(i,o)));return n(null===u?o:u)};function S(e,t,n,r){for(const i of e)if(n(i)&&t(i)===r)return r;return!r}let w=e=>t=>("string"==typeof e||"number"==typeof e)&&"string"==typeof t&&t.toLowerCase().indexOf(r(e).toLowerCase())>-1,G=e=>t=>null!=t&&Array.isArray(t)&&t.indexOf(e)>=0;function k(e,t,n,r,i){const o=c(e.getSegments(),[t,n])||!1;return i&&(r||o)&&e.setSegmentActivation(t,n,i),o}function z(e,t,n){return c(e.getSegments(),[t,n])||!1}function U(e,t,n=18e5){return r=>({a:{m:(e,t)=>[t[0],r.a.m(null!=e[0]&&e[0][0]===t[0][0]?e[1]:r.a.z,t[1])],z:[[],r.a.z]},p:(n,i)=>[[e(n)],c(i,t)===e(n)?r.p(n,i):r.a.z],r:(t,n)=>r.r(t,0!==n[0].length&&n[0][0]===e(t)?n[1]:r.a.z),d:r.d.sq||{l:(i,o)=>{let s=c(i,t),u=e(o);if(s!==u)return null;let a=r.d.l(i,o);if(!(Array.isArray(a)&&a.length>1))return null;let[l,...f]=a,d=+(_(i)||o.getCurrentTime()),p=Math.floor(d/n),m={};return m[p]={},m[p][u]=1===f.length?f[0]:f,[l,"u",null,m]},i:(t,n)=>{if(!Array.isArray(t)||"object"!=typeof t[3])return[[],r.a.z];let i=e(n),o=t[3];return[[i],Object.keys(o).map((e=>o[e][i])).filter((e=>e)).map((e=>r.d.i([t[0]].concat(e)))).reduce(r.a.m,r.a.z)]}}})}let E=U((e=>e.getCurrentSession()),["session_id"],18e5),P=U((e=>e.getCurrentView()),["view_id"],3e5);function O(e,t,r,i=1){return{a:{m:(e,t)=>e.concat(t).slice(-r),z:[]},p:(r,i)=>c(i,["name"])===n(t)?[e.p(r,i)]:[],r:(t,n)=>e.r(t,n.reduce(((t,n)=>e.a.m(t,n)),e.a.z)),d:e.d.ftn||{l:(t,n)=>{const o=e.d.l(t,n),s=c(t,["time"],y)*i;return o&&[o[0],"x"+r,null,{[s]:2==o.length?o[1]:o.slice(1)}]},i:(t,n)=>t?Object.keys(t[3]||{}).sort().reverse().map((e=>Array.isArray(e)?[t[0],...t[3][e]]:[t[0],t[3][e]])).map((t=>e.d.i(t,n))):[]}}}let C=(e,t)=>null===e?null==t?null:{b:t}:null==t?{a:e}:{a:e,b:t},T=(e,t)=>e&&t?e(t):null,D=(e,t,n)=>{if(n&&n.result&&Array.isArray(n.result)){let r=T(e.d&&e.d.m,{result:n.result[0]}),i=T(t.d&&t.d.m,{result:n.result[1]});return C(r,i)}return null};function x(e,t,n,r){let i=e,o=t.map(n),s=(e,n)=>r(t[e])(n);for(let e=t.length-1;e>0&&i;e--)i.b&&(o[e]=s(e,i.b)),i.a&&1===e&&(o[0]=s(0,i.a)),i=i.a;return o}let A=e=>t=>{function n(e){let t=e[0];for(let n=1;n<e.length;n++)t=[t,e[n]];return t}function r(e){let n=e,r=Array(t.length);for(let e=t.length-1;e>0;e--)r[e]=n[1],n=n[0];return r[0]=n,r}return{p:(e,r)=>n(t.map((t=>t.p(e,r)))),r:(n,i)=>{const o=r(i);return e(t.map(((e,t)=>()=>e.r(n,o[t]))))({})},a:{z:n(t.map((e=>e.a.z))),m:(e,i)=>{const o=r(e),s=r(i);return n(t.map(((e,t)=>function(e,t,n){return null===t?n:null===n?t:e.a.m(t,n)}(e,o[t],s[t]))))}},d:{l:(e,n)=>function(e){let t=e[0];for(let n=1;n<e.length;n++){const r=e[n],i=t;t={},null!==i&&(t.a=i),null!==r&&(t.b=r)}return t}(t.map((t=>t.d.l(e,n)))),i:(e,r)=>((e,r)=>n(x(e,t,(e=>e.a.z),(e=>t=>e.d.i(t,r)))))(e,r)}}},q=A(m),M=A(g);let R=e=>t=>({i:(n,r)=>e(x(n,t,(e=>e.i(null,r)),(e=>t=>e.i(t,r))).map((e=>t=>e)))({})}),F=R(g),j=R(m);function L(e,t){let n=o(e);if(!t||!n)return!1;if(!n.length)return!0;let r=0,i=!1,s=(e=>{let t=[];for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=e.charCodeAt(n+1);if(r>=56320&&r<=57343){t.push(e.slice(n,n+2)),++n;continue}}t.push(e.charAt(n))}return t})(t.toLowerCase());for(let e=0;e<s.length;e++){let t=s[e];for(;r>0&&!n[r][t];)r=n[r].su?n[r].su:0;if(n[r][t]&&(r=n[r][t],i=!!n[r].te,i))break}return i}let Y=(t,n)=>{let r,i,o=e.hash(t);if(0===n.length)return!1;if(n[0]===o)return!0;let s=0,u=n.length,a=!1;for(;(a=(r=n[i=s+(u-s>>1)])!==o)&&(r<o?s=i:u=i,!(s>=u-1)););return!a},$=(e,t)=>n=>Y(c(n,e),t),N=(e,t)=>n=>Y(l(n,e),t);return{q:function(e){return{lift:(t,n)=>e.d.l(t,n),interpret:(t,n)=>((t,n)=>({result:e.r(t,n)}))(n,e.d.i(t,n)),migrate:t=>t&&e.d.m?e.d.m(t):null,m:e.a.m,z:e.a.z,p:e.p,r:e.r,i:e.d.i}},i_q:function(e){return{interpret:(t,n)=>({result:e.i(t,n)})}},a:g,acq:function(e,t){return{p:(n,r)=>[e.p(n,r),t.p(n,r)],r:(n,r)=>e.r(n,r[0])&&t.r(n,r[1]),a:{z:[e.a.z,t.a.z],m:(n,r)=>[e.a.m(n[0],r[0]),t.a.m(n[1],r[1])]},d:{l:(n,r)=>C(e.d.l(n,r),t.d.l(n,r)),i:(n,r)=>n?[e.d.i(n.a||null,r),t.d.i(n.b||null,r)]:[e.a.z,t.a.z],m:n=>D(e,t,n)}}},acqs:M,acs:L,acs_:(e,t)=>n=>L(t,c(n,e)),af_i:(e,t,n=d)=>r=>c(r,e,(e=>S(e,t,n,!1)))&&!0,af_l:(e,t,n=d)=>r=>{const i=c(r,e,(e=>e.filter(n).length));return t(null===i?0:i)},af_m:(e,t,n,r=d)=>i=>{const o=c(i,e,(e=>e.filter(r)));return null===o||0===o.length?n(0):n(o.map((e=>c(e,t))).reduce(((e,t)=>e+t),0)/o.length)},af_n:(e,t,n,r=d)=>I(e,t,n,r,((e,t)=>Math.min(e,t)),Number.POSITIVE_INFINITY),af_p:(e,t,n,r=d)=>I(e,t,n,r,((e,t)=>e*t),1),af_s:(e,t,n,r=d)=>I(e,t,n,r,((e,t)=>e+t),0),af_u:(e,t,n=d)=>r=>c(r,e,(e=>S(e,t,n,!0)))||!1,af_x:(e,t,n,r=d)=>I(e,t,n,r,((e,t)=>Math.max(e,t)),Number.NEGATIVE_INFINITY),as:(e,t,n)=>r=>{const i=l(r,t),o=n.length;let s=!0;for(let t=0;t<o;t++){const r=n[t];if(s=e(r)(i),!s)break}return s},c:G,c_:(e,t)=>n=>G(t)(c(n,e)),cl_:(e,t)=>n=>G(r(t))(c(n,e)),cx:e=>t=>G(r(e))(t),ctu:function(e,t,r,i){return{a:i?{m:(e,t)=>e.filter((e=>-1===t.indexOf(e))).concat(t).slice(-i),z:[]}:{m:(e,t)=>e.filter((e=>-1===t.indexOf(e))).concat(t),z:[]},p:(i,o)=>c(o,["name"])===n(e)&&t(o)?c(o,r):[],r:(e,t)=>t,d:{l:()=>null,i:()=>[]}}},ctv:function(e,t,r,i){function o(e,t){const n=e=>({k:e.k,c:1+e.c}),r={arr:[],add:{k:t,c:1}};return t?(i=e.reduce(((e,t)=>e.add.k===t.k?{arr:e.arr,add:n(t)}:{arr:e.arr.concat(t),add:e.add}),r)).arr.concat(i.add):e;var i}return{a:i?{m:(e,t)=>o(e,t).slice(-i),z:[]}:{m:(e,t)=>o(e,t),z:[]},p:(i,o)=>c(o,["name"])===n(e)&&t(o)?c(o,r):null,r:(e,t)=>t.reduce(((e,t)=>({...e,[t.k]:t.c})),{}),d:{l:e=>null,i:e=>[]}}},ctw:function(e,t,r,i){return{a:i?{m:(e,t)=>e.concat(t).slice(-i),z:[]}:{m:(e,t)=>e.concat(t),z:[]},p:(i,o)=>c(o,["name"])===n(e)&&t(o)?c(o,r):[],r:(e,t)=>t,d:{l:()=>null,i:()=>[]}}},cw:function(e,t,r=f){return{a:{m:(e,t)=>e+t,z:0},p:(r,i)=>c(i,["name"])===n(e)&&t(i)?1:0,r:(e,t)=>r(t),d:{l:r=>c(r,["name"])===n(e)&&t(r)?["p",1]:null,i:e=>e?Array.isArray(e)?e.slice(-1)[0]:e:0,m:e=>e&&e.result?["p",e.result]:null}}},cb:function(e,t,r,i){return{a:{m:(e,t)=>Math.min(e+t,i),z:0},p:(r,i)=>c(i,["name"])===n(e)&&t(i)?1:0,r:(e,t)=>r(t),d:{l:r=>c(r,["name"])===n(e)&&t(r)?[`b${i}p`,1]:null,i:e=>e?Array.isArray(e)?e.slice(-1)[0]:e:0,m:e=>e&&e.result?[`b${i}p`,Math.min(i,e.result)]:null}}},e:e=>t=>t===e,e_:(e,t)=>n=>c(n,e)===t,fm:function(e,t){return{p:t.p,r:(n,r)=>e(t.r(n,r)),a:t.a,d:t.d}},frontDecode:function(e){const t=e.split("\\t");if(0===t.length)return[];var n=t[0],r=new Array(Math.ceil(t.length/2));r[0]=t[0];for(var i=1;i<t.length/2;i+=1){const e=t[2*i-1],o=t[2*i];if(""===e)n=o;else{const t=parseInt(e);n=n.slice(0,t)+o}r[i]=n}return r},ftn:function(e,t,r){return{a:{m:(e,t)=>e.concat(t.slice(0,r-e.length)),z:[]},p:(r,i)=>c(i,["name"])===n(t)?[e.p(r,i)]:[],r:(t,n)=>e.r(t,n.reduce(((t,n)=>e.a.m(t,n)),e.a.z)),d:O(e,t,r,-1).d}},fw:function(e,t,r,i=f){return{a:{m:(e,t)=>null===e?t:e,z:null},p:(i,o)=>c(o,["name"])===n(e)&&t(o)?c(o,r):null,r:(e,t)=>t,d:{l:r=>c(r,["name"])===n(e)&&t(r)?["p",1]:null,i:e=>e?Array.isArray(e)?e.slice(-1)[0]:e:0,m:e=>e&&e.result?["p",e.result]:null}}},g:e=>t=>t>e,g_:(e,t)=>n=>c(n,e)>t,gb:function(e,t,n){return{a:{m:(n,r)=>Object.keys(n).concat(Object.keys(r)).filter(((e,t,n)=>n.indexOf(e)===t)).sort(((e,t)=>Math.max(c(n,[t,1]),c(r,[t,1]))-Math.max(c(n,[e,1]),c(r,[e,1])))).slice(0,t).reduce(((t,i)=>{const o=e.a.m(c(n,[i,0])||e.a.z,c(r,[i,0])||e.a.z);return t[i]=[o,Math.max(c(n,[i,1]),c(r,[i,1]))],t}),{}),z:{}},p:(t,r)=>{const i=l(r,n),o=e.p(t,r);return null==i||(null==(s=o)||"object"==typeof s&&0===Object.keys(s).length||s===e.a.z)?{}:{[i]:[o,c(r,["time"],y)]};var s},r:(t,n)=>{const r={};return Object.keys(n).forEach((i=>r[i]=e.r(t,n[i][0]))),r},d:{l:()=>null,i:()=>({})}}},ge:e=>t=>t>=e,ge_:(e,t)=>n=>c(n,e)>=t,bse:(t,n)=>r=>{let i=c(r,t);return e.hash(i)===n},bsne:(t,n)=>r=>{let i=c(r,t);return e.hash(i)!==n},bsc:$,bsnc:(e,t)=>h($(e,t)),bsc_:N,bsnc_:(e,t)=>h(N(e,t)),i_:f,ifp:function(e){return{a:{m:(e,t)=>t,z:null},p:e=>null,r:(t,n)=>(t=>z(t,"1p",e))(t),d:{l:(e,t)=>null,i:e=>null}}},isp:function(e,t,n,r){return{a:{m:(e,t)=>t,z:!1},p:(n,r)=>z(n,e,t),r:(i,o)=>k(i,e,t,n,r),d:{l:(e,t)=>null,i:e=>Array.isArray(e)&&(!!+e[2]||!1)}}},itp:function(e,t,n,r){return{a:{m:(e,t)=>t,z:!1},p:(n,r)=>z(n,e,t),r:(i,o)=>k(i,e,t,n,r),d:{l:(e,t)=>null,i:e=>Array.isArray(e)&&(!!+e[2]||!1)}}},i_cw:function(e){return{i:t=>{let n=t?Array.isArray(t)?t.slice(-1)[0]:t:0;return e(n)}}},i_acqs:F,i_ocqs:j,i_tw:function(e,t,n){const r=n||100,i=Math.ceil(t/r);return{i:(n,r)=>{const o=Array.isArray(n)?n:[],s=r.getCurrentTime(),u=(a=s.getTime()-t,Math.floor(a/i));var a;const c=Object.keys(o[3]||{}).reduce(((e,t)=>parseInt(t)>=u?o[3][t]+e:e),0);return e.i(["p",c],r)}}},i_ltn:function(e,t,n=1){return{i:(t,n)=>{const r=Array.isArray(t)?t:[],i=Object.keys(r[3]||{}).reduce(((e,t)=>r[3][t]+e),0);return e.i(["p",i],n)}}},k:c,l:e=>t=>t<e,l_:(e,t)=>n=>{const r=c(n,e);return null!==r&&r<t},le:e=>t=>t<=e,le_:(e,t)=>n=>{const r=c(n,e);return null!==r&&r<=t},lm:function(e,t){let n=t=>function(e,t,n){if(void 0===t[n])return NaN;const r=e||{};if(0==(r["1p"]||[]).length)return NaN;const i=t[n]||{};let o=(i["1p"]||{}).const||0;return Object.keys(r).forEach((e=>{r[e].forEach((t=>{const n=(i[e]||{})[t]||0;o+=n}))})),s=o,1/(1+Math.pow(Math.E,-s));var s}(t.getSegmentsArray(),t.getLookalikeModels(),e);return{a:{m:(e,t)=>t,z:null},p:e=>null,r:(e,r)=>t(n(e)),d:{l:(e,t)=>null,i:e=>null}}},ltn:O,mnw:function(e,t,r,i=f){const o=Number.POSITIVE_INFINITY;return{a:{m:(e,t)=>e<t?e:t,z:o},p:(i,s)=>c(s,["name"])===n(e)&&t(s)?c(s,r):o,r:(e,t)=>i(t),d:{l:i=>c(i,["name"])===n(e)&&t(i)?["n",c(i,r)]:null,i:e=>e?Array.isArray(e)?e.slice(-1)[0]:e:o}}},mxw:function(e,t,r,i=f){const o=Number.NEGATIVE_INFINITY;return{a:{m:(e,t)=>e>t?e:t,z:o},p:(i,s)=>c(s,["name"])===n(e)&&t(s)?c(s,r):o,r:(e,t)=>i(t),d:{l:i=>c(i,["name"])===n(e)&&t(i)?["v",c(i,r)]:null,i:e=>e?Array.isArray(e)?e.slice(-1)[0]:e:o}}},n0:h(f),n:e=>t=>t!==e,nt:h,n_:(e,t)=>n=>c(n,e)!==t,o:m,ocq:function(e,t){return{p:(n,r)=>[e.p(n,r),t.p(n,r)],r:(n,r)=>e.r(n,r[0])||t.r(n,r[1]),a:{z:[e.a.z,t.a.z],m:(n,r)=>[e.a.m(n[0],r[0]),t.a.m(n[1],r[1])]},d:{l:(n,r)=>C(e.d.l(n,r),t.d.l(n,r)),i:(n,r)=>n?[e.d.i(n.a||null,r),t.d.i(n.b||null,r)]:[e.a.z,t.a.z],m:n=>D(e,t,n)}}},ocqs:q,oe:function(e){const t=Object.keys(e);let n=t.length,r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r},os:(e,t,n)=>r=>{const i=l(r,t),o=n.length;let s=!1;for(let t=0;t<o;t++){const r=n[t];if(s=e(r)(i),s)break}return s},pacs:(e,t)=>n=>L(t,l(n,e)),pb:(e,t,n)=>r=>v(t,n)(l(r,e)),pc:(e,t)=>n=>{const r=l(n,e);return null!=r&&Array.isArray(r)&&r.indexOf(t)>=0},pc_:(e,t)=>n=>{const i=l(n,e),o=r(t);return null!=i&&Array.isArray(i)&&i.indexOf(o)>=0},pe:(e,t)=>n=>l(n,e)===t,pg:(e,t)=>n=>l(n,e)>t,pge:(e,t)=>n=>l(n,e)>=t,pl:(e,t)=>n=>{let r=l(n,e);return null!==r&&r<t},ple:(e,t)=>n=>{let r=l(n,e);return null!==r&&r<=t},pn:(e,t)=>n=>l(n,e)!==t,ps:(e,t)=>n=>w(t)(l(n,e)),pw:function(e,t,r,i=f){return{a:{m:(e,t)=>e*t,z:1},p:(i,o)=>c(o,["name"])===n(e)&&t(o)?c(o,r):1,r:(e,t)=>i(t),d:{l:i=>{return c(i,["name"])===n(e)&&t(i)?(o=c(i,r))>=1?["m2p",o]:o>0?["m2p",null,1/o]:0==o?["m2p",0]:o>-1?["m2p",null,1/o,1]:["m2p",o,null,1]:null;var o},i:e=>{return e?Array.isArray(e)?0===(t=e.slice(1))[0]?0:Math.pow(-1,t[2]||0)*(t[0]||1)/(t[1]||1):e:1;var t}}}},r:function(e,...t){return u(e)(...t)},ref:function(e){return t=>s(e)(t)},rle:function(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];"number"==typeof r?(t+=r,n+=1):t+=1}let n=Array(t),r=0;for(let t=0;t<e.length;t++){let i=e[t];"number"==typeof i?(n.fill(e[t+1],r,r+i),t+=1,r+=i):(n[r]=i,r++)}return n},s:w,s_:(e,t)=>n=>w(t)(c(n,e)),scq:function(e,t,n=f){return{p:(n,r)=>[e.p(n,r),t.p(n,r)],r:(r,i)=>n(e.r(r,i[0])+t.r(r,i[1])),a:{z:[e.a.z,t.a.z],m:(n,r)=>[e.a.m(n[0],r[0]),t.a.m(n[1],r[1])]},d:{l:(n,r)=>C(e.d.l(n,r),t.d.l(n,r)),i:(n,r)=>n?[e.d.i(n.a||null,r),t.d.i(n.b||null,r)]:[e.a.z,t.a.z],m:n=>D(e,t,n)}}},sq:E,dscq:function(e,t,r,i){const o=`x${i}`,s=e=>e?2===e.length?["p",o,"",e[1]]:e:null,u=r=>{const i=(e=>c(e,["session_id"]))(r);return i&&c(r,["name"])===n(e)&&t(r)?["p",o,"",{[i]:1}]:null};return{a:{m:(e,t)=>{const n=s(e),r=s(t);return n?r?["p",o,"",{...n[3],...r[3]}]:n:r},z:null},p:(e,t)=>u(t),r:(e,t)=>{const n=t&&t[3]&&"object"==typeof t[3]?Object.keys(t[3]).length:0;return r(n)},d:{l:(e,t)=>u(e),i:(e,t)=>s(e)}}},sw:function(e,t,r,i=f){return{a:{m:(e,t)=>e+t,z:0},p:(i,o)=>c(o,["name"])===n(e)&&t(o)?c(o,r):0,r:(e,t)=>i(t),d:{l:i=>{return(r=>c(r,["name"])===n(e)&&t(r))(i)?(o=c(i,r))<0?["p2",null,-o]:["p2",o]:null;var o},i:e=>{return e?Array.isArray(e)?((t="p2"===e[0]?e.slice(1):e)[0]||0)-(t[1]||0):e:0;var t}}}},t:d,tb:(e,t)=>n=>v(e,t)(_(n)),te:e=>t=>_(t)===e,te_:(e,t)=>n=>b(e,n)===t,tg:e=>t=>_(t)>e,tg_:(e,t)=>n=>b(e,n)>t,tge:e=>t=>_(t)>=e,tge_:(e,t)=>n=>b(e,n)>=t,ti:y,tl:e=>t=>_(t)<e,tl_:(e,t)=>n=>b(e,n)<t,tle:e=>t=>_(t)<e,tle_:(e,t)=>n=>b(e,n)<t,tn:e=>t=>_(t)!==e,tn_:(e,t)=>n=>b(e,n)!==t,tw:function(e,t,n){const r=n||100,i=Math.ceil(t/r),o=e=>Math.floor(e/i),s=(e,n,r)=>[o(e.getTime()-t),{[o(n)]:r}],u=(t,n)=>{const r=Math.max(t[0],n[0]),i=Object.keys(t[1]).filter((e=>e>=r)).concat(Object.keys(n[1]).filter((e=>e>=r))).filter(((e,t,n)=>n.indexOf(e)===t)).reduce(((r,i)=>{const o=e.a.m(t[1][i]||e.a.z,n[1][i]||e.a.z);return o!==e.a.z&&(r[i]=o),r}),{});return[r,i]},l=[Number.NEGATIVE_INFINITY,{}],f=e=>{const t=t=>t.map((([t,n,r])=>s(e.t,r,t))).reduce(u,l);return u(t(e.in),t(e.out))},d=t=>{if(void 0!==t.result)return d(t.result);if(void 0!==t.w)return d(f(t));const[n,r]=t;let i=null,o={};for(let t in r){let n=e.d.m({result:r[t]});n&&Array.isArray(n)&&(i=n[0],o[t]=a(n.slice(1)))}return i&&[i,"w",t[0],o]};return{a:{m:(e,t)=>{const n=e.w?f(e):e;return u(n,t)},z:l},p:(t,n)=>s(t.getCurrentTime(),c(n,["time"],y),e.p(t,n)),r:(t,n)=>{const r=(n.w?f(n):n)[1];return e.r(t,Object.keys(r).reduce(((t,n)=>e.a.m(t,r[n])),e.a.z))},d:e.d.tw||{l:(t,n)=>{const r=e.d.l(t,n),i=e.d.i(r,n);return r&&[r[0],"w",...s(n.getCurrentTime(),c(t,["time"],y),i)]},i:(e,n)=>{const r=Array.isArray(e)?e:[],i=n.getCurrentTime(),s=o(i.getTime()-t);return[r[2]||null,Object.keys(r[3]||{}).map((e=>({[e]:r[3][e]}))).reduce(((e,t)=>(Object.keys(t).filter((e=>parseInt(e)>=s)).forEach((n=>e[n]=t[n])),e)),{})]},m:e.d.m&&d}}},vgw:function(e,t,r,i=f){const o={v:0,k:0};return{a:{m:(e,t)=>{var n=e.k+t.k;return{v:n?e.v+t.k*(t.v-e.v)/n:0,k:n}},z:o},p:(i,s)=>c(s,["name"])===n(e)&&t(s)?{v:c(s,r),k:1}:o,r:(e,t)=>i(t.v),d:{l:i=>{return c(i,["name"])===n(e)&&t(i)?0==(o=c(i,r))?["p3",1]:o<0?["p3",1,null,-o]:["p3",1,o]:null;var o},i:e=>{return e?Array.isArray(e)?{v:(((t=e.slice(1))[1]||0)-(t[2]||0))/(t[0]||1),k:t[0]||0}:void 0:o;var t}}}},vq:P,w:e=>t=>t===r(e),x:e=>t=>t!==r(e),y:(e,t)=>n=>l(n,e)===r(t),y_:(e,t)=>n=>c(n,e)===r(t),z:(e,t)=>n=>l(n,e)!==r(t),z_:(e,t)=>n=>c(n,e)!==r(t)}}function generateLookupMethods(e){let t,n=!1,r=[];return{onReady:e=>{n?e(t):r.push(e)},provideEnvironment:i=>{t={events:e.eventsLookup(i),literals:e.literalsLookup(i),properties:e.propertiesLookup(i),ahoCorasick:e.ahoCorasickLookup(i),subexpressions:e.subexpressionsLookup(i),rootCompression:e.rootCompressionLookup(i)},r.forEach((e=>e(t))),r=[],n=!0}}}},992:(e,t,n)=>{n.d(t,{GL:()=>u,HJ:()=>a,N1:()=>f,NC:()=>r,RP:()=>i,UM:()=>c,t_:()=>l});const r=performance.now(),i=(new Date).getTime();let o=[],s=!1;const u=e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return a((()=>e(...n)))},a=(e,t)=>{if(!s){const n=self.setTimeout(e,t);return()=>self.clearTimeout(n)}let n;const r=()=>{void 0!==n&&s&&o.length<1e4&&o.push([n,performance.now()]),n=void 0},i=[self.setTimeout((()=>{n=performance.now(),self.requestAnimationFrame(r),e()}),t),self.setTimeout(r,t)];return()=>{void 0===n&&i.forEach((e=>self.clearTimeout(e)))}},c=(e,t)=>{if(!s){const n=self.setInterval(e,t);return()=>self.clearInterval(n)}let n=!1,r=()=>{};const i=self.setInterval((()=>{r=a((()=>{n||e()}))}),t);return()=>{n=!0,r(),self.clearInterval(i)}},l=e=>new Promise(((t,n)=>e.then(u(t),u(n)))),f=e=>()=>l(e())},851:(e,t,n)=>{n.d(t,{g1:()=>z,YO:()=>w,oQ:()=>q,a9:()=>_,Ue:()=>h,gS:()=>v,D8:()=>A,VS:()=>U,xH:()=>E,En:()=>y,p4:()=>x,fF:()=>D,Hr:()=>G,UI:()=>I,u4:()=>P,Rp:()=>O,vP:()=>C,bw:()=>M,YP:()=>b});var r=n(688),i=n(365),o=n(735),s=n(567),u=n(328),a=n(652);function c(e){let t=e,n=[],r=!1;return{addListener(e){if(r)return()=>{};let i=t;const o=()=>{Object.is(t,i)||(i=t,e(t))};n=[...n,o];return()=>{n=n.filter((e=>e!==o))}},notify(e){if(r)throw new Error("Ref bug: Attempted to notify a terminated notifier");Object.is(e,t)||(t=e,n.forEach((e=>e())))},terminate(){r=!0,n=[]}}}function l(e,t){let n=0;return function(){try{if(n++>0)throw new Error(e);return t(...arguments)}finally{n--}}}function f(e,t){let n=[...new Set(e)].filter((e=>"final"!==e.state));if(0===n.length)return{state:"final",onStateChange:()=>()=>{}};const r=()=>0===n.length?"final":n.some((e=>"might_change"===e.state))?"might_change":"nominal",[i,o]=d(r(),(e=>"might_change"!==e&&t())),s=()=>o(r());return n.forEach((t=>{t.onStateChange((t=>{switch(t){case"final":n=e.filter((e=>"final"!==e.state)),s();break;case"might_change":o("might_change");break;case"nominal":s();break;default:throw new Error(`Ref bug: Invalid state ${t}`)}}))})),i}function d(e,t){if("final"===e)return[{state:"final",onStateChange:()=>()=>{}},()=>{}];const{terminate:n,notify:r,addListener:i}=c(e),o={state:e,onStateChange:i},s=l("Disallowed recursion in Branch.",(e=>{if("final"===o.state){if("final"===e)return;throw new Error(`Attempted to change state of final branch to ${e}.`)}try{null==t||t(e),o.state=e,r(e)}finally{"final"===e&&n()}}));return[o,s]}var p=n(341),m=n(392);const g="Ref";function h(e){const[t,n,r]=function(){const[e,t]=d("nominal"),n=l("Disallowed recursion in Branch.",(n=>{if("final"===e.state)throw new Error("Attempted to mutate a finalized Ref.");const r=e.state;try{t("might_change"),n()}finally{t(r)}}));return[e,n,()=>t("final")]}(),[i,o]=R(t,e);return[i,e=>n((()=>o(e))),r]}function v(e){let t=e.empty;const n=()=>()=>{const n=t;return t=e.empty,n},[r,i,o]=h(n());return[r,r=>{t=e.concat(t,r),i(n())},o]}function y(e,t){return n=>{let r=new Array(e).fill(t.empty);return new Array(e).fill(null).map(((e,i)=>(0,o.zG)(n,I(m.UI((e=>{const n=t.concat(r[i],e);return r=r.map(((n,r)=>r===i?t.empty:t.concat(n,e))),n}))))))}}function _(e){return{get current(){return e},onChange:()=>()=>{},branch:{state:"final",onStateChange:()=>()=>{}}}}function b(e){return t=>{const n=t.onChange(e);return e(t.current),n}}function I(e,t){if(t){const[n,r]=R(t.branch,e(t.current));return t.onChange((t=>r(e(t)))),n}return t=>I(e,t)}const S={URI:g,map:(e,t)=>I(t)(e)},w=p.YO(S),G=p.Hr(S),k=e=>U((t=>I(t)(e))),z={URI:g,of:_,map:S.map,ap:(e,t)=>k(t)(e)};function U(e,t){return t?E(I(e,t)):t=>E(I(e,t))}function E(e){if("final"===e.branch.state)return e.current;const[t,n]=function(e,t){let n=t;const r=[e.state,n.state].includes("might_change")?"might_change":"nominal",[i,o]=d(r),s=e=>t=>{switch(t){case"final":o(e().state);break;case"might_change":o("might_change");break;case"nominal":"might_change"===e().state?o("might_change"):o("nominal");break;default:throw new Error(`Ref bug: Unexpected upstream state ${t}`)}};e.onStateChange(s((()=>n)));const u=s((()=>e));let a=n.onStateChange(u);return[i,e=>{n=e,a(),a=e.onStateChange(u),u(n.state)}]}(e.branch,e.current.branch),[r,i]=R(t,e.current.current);let o=e.current.onChange(i);return e.onChange((e=>{o(),o=e.onChange(i),n(e.branch),i(e.current)})),r}function P(e){return t=>{if("final"===t.branch.state)return t;let n=s.YP;return I((t=>{if(s.Wi(n))return n=s.G(t),t;const r=e(n.value,t);return n=s.G(r),r}),t)}}function O(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{if(2===t.length){let n=t[0];return I((e=>(n=t[1](n,e),n)),e)}let n=s.bM();return I((e=>{const r=t[0](n,e);return n=s.G(r),r}),e)}}function C(){if(0===arguments.length||F(arguments.length<=0?void 0:arguments[0]))return T(...arguments);const e=arguments.length<=0?void 0:arguments[0],t=Object.keys(e);return(0,o.zG)(Object.values(e),(e=>T(...e)),I((0,o.ls)(u.Su(((e,n)=>[t[e],n])),Object.fromEntries)))}function T(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return _([]);if(1===t.length)return I((e=>[e]))(t[0]);let r=!1;t.forEach((e=>e.onChange((()=>{if("might_change"!==e.branch.state)throw new Error("Ref bug: Received a change notification without a `might_change` state.");r=!0}))));const i=t.map((0,a.vg)("branch")),o=()=>{r&&(r=!1,c(t.map((e=>e.current))))},s=f(i,o),[u,c]=R(s,t.map((e=>e.current)));return u}function D(e){const[t,n,r]=h(s.YP);return e().then((0,o.ls)(s.G,n,r)),t}function x(e){const[t,n,u]=h(s.YP);return e.then(i.F2).catch((0,o.ls)(r.w,i.t$)).then((0,o.ls)(s.G,n,u)),t}function A(e){const t=e.hasOwnProperty("equals")?e.equals:e;return P(((e,n)=>t(e,n)?e:n))}function q(e){return F(e)?e:_(e)}function M(e){return t=>(b(e)(t),t)}function R(e,t){if("final"===e.state)return[_(t),()=>{}];const n=c(t);e.onStateChange((e=>{"final"===e&&n.terminate()}));let r=t;return[{get current(){return r},onChange:n.addListener,branch:e},l("Disallowed recursion in Ref.",(e=>{r=e,n.notify(r)}))]}function F(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"function"==typeof e.onChange}},116:(e,t,n)=>{n.d(t,{Hr:()=>h,K4:()=>a,KD:()=>_,UI:()=>f,VS:()=>p,YO:()=>v,ak:()=>g,bw:()=>d,dQ:()=>c,kR:()=>b,of:()=>l,vP:()=>m,yi:()=>y});var r=n(851),i=n(735),o=n(652),s=n(923),u=n(567);const a=e=>(0,i.ls)((t=>{let{previousState:n,...r}=t;return e(r)}),(e=>({value:e,state:r.a9(void 0)}))),c=i.yR,l=(0,i.ls)(i.a9,a),f=e=>t=>(0,i.ls)(t,(0,o.rO)({value:e})),d=e=>t=>(0,i.ls)(t,(0,o.rO)({value:(0,o.bw)(e)}));function p(e){return t=>n=>{let{previousState:i,...o}=n;const s=t({previousState:Array.isArray(i)?i[0]:void 0,...o}),u=e(s.value)({previousState:Array.isArray(i)?i[1]:void 0,...o});return{value:u.value,state:r.vP(s.state,u.state)}}}function m(e){return t=>{let{previousState:n,...o}=t;const u=w(n)?n:{},a=(0,i.zG)(e,s.Su(((e,t)=>t({previousState:u[e],...o}))));return{value:(0,i.zG)(a,s.UI((e=>e.value))),state:(0,i.zG)(a,s.UI((e=>e.state)),(e=>r.vP(e)))}}}function g(e,t){return n=>(0,i.ls)((0,o.rO)({previousState:S}),(o=>{const s=n(o),u=t(s.value)({...o,previousState:o.previousState[e]});return{value:(0,i.zG)([s.value,u.value],(t=>{let[n,r]=t;if(!w(n))throw new Error("Service.bind() was passed an upstream Service with a non-record value.");return{...n,[e]:r}})),state:(0,i.zG)(r.vP(s.state,u.state),r.UI((t=>{let[n,r]=t;if(void 0===n)return{[e]:r};if(!w(n))throw new Error("Service.bind() was passed an upstream Service with a non-record state.");return{...n,[e]:r}})))}}))}const h=(e,t)=>f((n=>({...n,[e]:t(n)})));function v(e){return t=>(0,i.ls)((0,o.rO)({previousState:(0,i.ls)(S,(t=>t[e]))}),t,(0,o.rO)({value:t=>({[e]:t}),state:r.UI((t=>({[e]:t})))}))}const y=(e,t)=>{const n=t||(t=>t===e);return t=>c((s=>{let{previousState:u,...a}=s;const c=Array.isArray(u)&&2===u.length&&n(u[0])?u[1]:void 0;return(0,i.zG)({previousState:c,...a},t,(0,o.rO)({state:r.UI((t=>[e,t]))}))}))},_=e=>{const t=e.slice(0,-1),n=e.slice(-1)[0],r=[...t.map((e=>{let[t,n]=e;return[t,(0,i.a9)(n)]})),(0,i.a9)(n)];return b((0,o.lo)(r))};function b(e){return(0,i.ls)(r.UI(e),I)}function I(e){const t=(0,i.zG)(e,r.Rp(0,(e=>e+1)));return n=>{let{previousState:o,stopped:s,...a}=n;return(0,i.zG)(r.vP(e,t),r.Rp(((e,n)=>{let[c,l]=n;return(0,i.zG)(e,u.UI((e=>e.state.current)),u.fS((()=>o)),(e=>c({previousState:e,stopped:(0,i.zG)(r.vP(s,t),r.UI((e=>{let[t,n]=e;return t||n!==l}))),...a})))})),(e=>({value:r.UI((e=>e.value),e),state:r.VS((e=>e.state),e)})))}}function S(e){return w(e)?e:{}}function w(e){return"object"==typeof e&&null!==e}},930:(e,t,n)=>{n.d(t,{d:()=>f,m:()=>l});var r=n(735),i=n(365),o=n(567),s=n(851),u=n(652),a=n(116),c=n(268);const l=e=>a.dQ((t=>{let{stopped:n,previousState:a}=t;const c=function(e){return h(e)?e:{validityKey:"",lastSuccess:o.YP}}(a),l=(0,r.zG)(c,(e=>({...e,inFlight:o.YP,lastSuccess:(0,r.zG)(e.lastSuccess,o.UI(i.F2))}))),f=(0,r.zG)(e,s.UI((e=>"currentTimestampSecs"in e&&"freshness"in e&&"validity"in e?e:{currentTimestampSecs:0,validity:{key:e.validityKey,maxAge:Number.MAX_SAFE_INTEGER},freshness:{key:e.freshnessKey,maxAge:Number.MAX_SAFE_INTEGER},refresh:e.refresh})),(e=>s.vP(e,n)),s.Rp(s.a9(l),((e,t)=>{let[n,a]=t;if(a)return e;const c=n.validity.key(),l=o.hX((e=>n.currentTimestampSecs-e.timestamp<=n.validity.maxAge)),f=(0,u.HP)(n.freshness.key),d=o.hX((e=>n.currentTimestampSecs-e.timestamp<=n.freshness.maxAge&&e.freshnessKey===f())),p=(0,r.zG)(e,s.UI((0,r.ls)(o.DT((e=>e.validityKey===c)),o.EQ((()=>({validityKey:c,inFlight:o.YP,lastSuccess:o.YP})),(0,u.rO)({inFlight:l,lastSuccess:o.tS(i.EQ((e=>o.G(i.t$(e))),(0,r.ls)(o.G,l,o.UI((e=>i.F2(e))))))})))),s.D8(m()));if((0,r.zG)(p.current,(e=>(0,r.zG)(e.inFlight,o.wp((()=>(0,r.zG)(e.lastSuccess,o.tS(o.Uo)))),d,o.pC))))return p;const g=()=>({timestamp:n.currentTimestampSecs,freshnessKey:f(),output:o.YP});return(0,r.zG)(n.refresh,o.EQ((()=>p),(0,r.ls)(s.fF,s.UI(o.EQ((()=>(0,r.zG)(p,s.UI((0,u.rO)({inFlight:()=>o.G(g())})))),i.EQ((e=>(0,r.zG)(p,s.UI((0,u.rO)({inFlight:()=>o.YP,lastSuccess:(0,r.ls)(o.tS((0,r.ls)(o.Uo,o.hX((e=>o.pC(e.output))))),i.Yo((()=>e)),o.G)})))),(e=>s.a9({validityKey:c,inFlight:o.YP,lastSuccess:o.G(i.F2({...g(),output:o.G(e)}))}))))),s.xH)))})),s.xH,s.D8(m())),d=(0,r.zG)(f,s.UI((e=>({validityKey:e.validityKey,lastSuccess:(0,r.zG)(e.lastSuccess,o.tS(o.Uo))}))),s.D8(g())),p=(0,r.zG)(d,s.Rp(-1,(e=>e+1)));return{value:(0,r.zG)(f,s.UI((0,r.ls)((0,u.vg)("lastSuccess"),o.UI(i.UI((e=>e.output))),o.fS((()=>i.F2(o.YP)))))),state:(0,r.zG)(s.vP(d,p),s.UI((e=>{let[t,n]=e;return n>0?t:g().equals(t,c)?a:t})))}})),f=e=>t=>(0,r.ls)((0,u.rO)({previousState:(0,r.ls)(o.DT(h),o.YO("s1"),o.Hr("s2",(t=>{let{s1:n}=t;return(0,r.zG)(n,(0,u.rO)({lastSuccess:o.UI((0,u.rO)({output:o.tS(e)}))}))})),o.UI((e=>{let{s1:t,s2:n}=e;return g().equals(t,n)?t:n})),o.FS)}),t),d=()=>c.n_({freshnessKey:(0,u.Or)(),timestamp:(0,u.Or)(),output:o.Eh((0,u.Or)())});function p(e){return"object"==typeof e&&null!==e&&(!(!("freshnessKey"in e)||!v(e.freshnessKey))&&("timestamp"in e&&"number"==typeof e.timestamp&&!(!("output"in e)||!(0,u.El)(e.output))))}const m=()=>c.n_({validityKey:(0,u.Or)(),inFlight:o.Eh(d()),lastSuccess:o.Eh(i.Eh((0,u.Or)(),d()))}),g=()=>c.n_({validityKey:(0,u.Or)(),lastSuccess:o.Eh(d())});function h(e){return"object"==typeof e&&null!==e&&(!(!("validityKey"in e)||!v(e.validityKey))&&!!("lastSuccess"in e&&(0,u.El)(e.lastSuccess)&&(0,r.zG)(e.lastSuccess,o.EQ((()=>!0),p))))}function v(e){return null===e||"string"==typeof e||"number"==typeof e}},975:(e,t,n)=>{n.r(t),n.d(t,{PermutiveActivationManagerWeb:()=>s,optimisedActivationsConfig:()=>o});class r{logger;permutive;id;segmentCode;triggerType;config;workspaceLevelConfig;prefix="[Activation]";constructor(e,t,n,r,i,o,s){this.logger=e,this.permutive=t,this.id=n,this.segmentCode=r,this.triggerType=i,this.config=o,this.workspaceLevelConfig=s}getSegmentCode(){return this.segmentCode}getTriggerType(){return this.triggerType}getConfig(){return this.config}getWorkspaceLevelConfig(){return this.workspaceLevelConfig}trackImpression(e){return this.trackActivation("impression",e)}trackConversion(e){return this.trackActivation("conversion",e)}trackActivation(e,t){const n={reaction_id:this.id,type:e};this.permutive.track("Reaction",n,t),this.logger.log(this.prefix,n.type,n)}}var i=n(853);const o={dfp:{dfp:[178089,180643,180644,180716,184424,184423,184619,185436,185437,184485,187070],dfp_legacy:{}},eyeota_pixel:[],dbm:{omitted:0},appnexus:{},appnexus_adserver:[],nativo:[],rubicon_ssp:[],smart:[],freewheel:[]};class s{logger;permutive;clientContext;constructor(e,t,n){this.logger=e,this.permutive=t,this.clientContext=n}getSpecializedActivations(e){return o[e]}getActivations(e){return(0,i.Hn)(e)("activationConfigs",[]).filter((e=>this.areContextCriteriaSatisfied(e))).map((e=>new r(this.logger,this.permutive,e.id,e.sc,e.tt,e.c,e.wc)))}areContextCriteriaSatisfied(e){const t=e.cc,n=e=>{const t=this.clientContext.getContext()[e.key];switch(e.comparison){case"EQUALS":return t===e.value;case"NOT_EQUALS":return t!==e.value;case"CONTAINS":return"string"==typeof t&&t.indexOf(e.value)>=0;case"NOT_CONTAINS":return"string"==typeof t&&t.indexOf(e.value)<0}};return!t||("AND"===(r=t).operator?r.criteria.every(n):r.criteria.some(n));var r}}},853:(e,t,n)=>{n.d(t,{Hn:()=>i});const r={brightcove:{auto_init:!1,activationConfigs:[]},scriptrunner:{auto_init:!0,activationConfigs:[]},clean_room:{auto_init:!0,cohort_ssp_config:[],activationConfigs:[]},dfp:{auto_init:!0,track_slot_rendered:!1,track_slot_viewable:!0,track_slot_clicked:!0,activationConfigs:[]},prebid:{auto_init:!0,revenue_insights_enabled:!0,data_provider_config:{ac_bidders:[]},activationConfigs:[]},web:{auto_init:!1,track_pageview_engagement:!0,track_form_submission:!1,track_link_click:!0,track_pageview_complete:!0,add_alchemy_taxonomy:!1,add_alchemy_entities:!1,engagement_edge_only:!0,segment_transition_edge_only:!0,activationConfigs:[]}},i=e=>{const t=r[e];return(e,n)=>(null==t?void 0:t[e])??n};i("web"),i("dfp"),i("facebook_pixel_v2")},548:(e,t,n)=>{n.d(t,{X:()=>i,k:()=>r});const r=e=>({id:e.id,name:e.name,time:new Date(e.time),properties:e.properties||{},session_id:e.session_id,view_id:e.view_id}),i=e=>({id:e.id,name:e.name,time:(o(e.time)?e.time:new Date).toISOString(),properties:e.properties||{},session_id:e.session_id,view_id:e.view_id}),o=e=>isFinite(e)&&e instanceof Date},656:(e,t,n)=>{n.d(t,{F:()=>c,I:()=>a});var r=n(851),i=n(392),o=n(328),s=n(735),u=n(652);const a=(e,t)=>{let n=!1;return r.UI(i.UI((0,u.bw)((r=>{n||(n=(0,s.zG)(r,o.G((e=>{let[,t]=e;return"Pageview"===t.name}))),n&&e.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:t,time_origin:"sdk_init"}))}))))},c=(e,t)=>{const n=a(e,t);return(0,s.ls)(r.En(2,o.uZ()),(e=>{let[t,i]=e;return(0,s.zG)(i,n,r.UI((e=>e()))),t}))}},373:(e,t,n)=>{n.r(t),n.d(t,{service:()=>Di});var r=n(735),i=n(116),o=n(851),s=n(567),u=n(377);const a=e=>{const t=e.current;return(0,r.zG)(e,o.UI((e=>e===t?{segmentsEntered:[],segmentsExited:[]}:{segmentsEntered:(0,r.zG)(e,l(t)),segmentsExited:(0,r.zG)(t,l(e))})))},c=e=>new Set(e),l=e=>t=>(0,r.zG)(t,f((t=>!e.has(t)))),f=e=>t=>{const n=[];return t.forEach((t=>e(t)&&n.push(t))),n};var d=n(392),p=n(328),m=n(652),g=n(268),h=n(751);const v=e=>{let{events:t,...n}=e;return i.K4((e=>{let{stopped:i}=e;const[u,a,c]=(0,r.zG)(t,o.En(3,p.uZ())),l=(0,r.zG)(o.vP(n.viewId,n.currentTimestampSecs,c,i),o.Rp(s.YP,((e,t)=>{let[n,i,o,u]=t;if(u)return e;const a=o();return(0,r.zG)(e,s.hX((e=>e.id===n)),s.EQ((()=>({id:n,lastEngagementTime:i})),(e=>({id:n,lastEngagementTime:(0,r.zG)(a,p.dF((e=>{let[,t]=e;return"PageviewEngagement"===t.name})),s.EQ((()=>e.lastEngagementTime),(e=>{let[,t]=e;return Math.floor(t.time.getTime()/1e3)})))}))),s.G)})),(e=>o.vP(e,n.currentTimestampSecs)),o.UI((e=>{let[t,n]=e;return(0,r.zG)(t,s.hX((e=>600>n-e.lastEngagementTime)),s.UI((e=>e.id)))})),o.D8(s.Eh(h.Eq))),f={PageviewEngagement:{engaged_time:0},SegmentEntry:new Set,SegmentExit:new Set,CohortEntry:new Set,CohortExit:new Set},v=(0,r.zG)(o.vP({events:u,sessionId:n.sessionId,viewIdOpt:l,stopped:i}),o.Rp(s.YP,((e,t)=>{let{events:n,sessionId:i,viewIdOpt:o,stopped:u}=t;if(u)return e;const a=(0,r.zG)(o,s.UI((t=>(0,r.zG)(e,s.tS((0,m.vg)("unprocessedPVC")),s.hX((e=>e.viewId===t)),s.fS((()=>({aggregations:f,customProperties:{},sessionId:i,viewId:t}))),(e=>(0,r.zG)(n(),p.u4(e,((e,t)=>{let[,n]=t;return function(e,t){switch(t.name){case"Pageview":return t.view_id!==e.viewId?e:{...e,customProperties:t.properties};case"SegmentEntry":{const n=t.properties.segment_number;return(0,r.zG)(e,(0,m.rO)({aggregations:e=>e.SegmentExit.has(n)?(0,r.zG)(e,(0,m.rO)({CohortExit:b(String(n)),SegmentExit:b(n)})):(0,r.zG)(e,(0,m.rO)({CohortEntry:_(String(n)),SegmentEntry:_(n)}))}))}case"SegmentExit":{const n=t.properties.segment_number;return(0,r.zG)(e,(0,m.rO)({aggregations:e=>e.SegmentEntry.has(n)?(0,r.zG)(e,(0,m.rO)({CohortEntry:b(String(n)),SegmentEntry:b(n)})):(0,r.zG)(e,(0,m.rO)({CohortExit:_(String(n)),SegmentExit:_(n)}))}))}case"PageviewEngagement":{if(t.view_id!==e.viewId)return e;const n=t.properties;return(0,r.zG)(e,(0,m.rO)({aggregations:(0,m.rO)({PageviewEngagement:()=>({engaged_time:n.total_engaged_time,completion:n.total_completion})})}))}default:return e}}(e,n)})))))))),c=(0,r.zG)(e,s.EQ((()=>d.of(p.cS)),(e=>(0,r.zG)(e.unprocessedPVC,s.hX((e=>{var t;return e.viewId!==(null===(t=s.FS(a))||void 0===t?void 0:t.viewId)})),s.EQ((()=>e.pvcsToProcessImmediately),(t=>{let n=[...e.pvcsToProcessImmediately(),y(t)];return()=>{const e=n;return n=p.cS,e}}))))));return s.G({pvcsToProcessImmediately:c,unprocessedPVC:a})})));return{eventsToProcessImmediately:(0,r.zG)(v,o.UI(s.EQ((()=>()=>p.cS),(e=>e.pvcsToProcessImmediately))),(e=>o.vP(e,a)),o.UI(d.RD),o.UI(d.UI(p.xH))),eventsToProcessOnPageUnload:(0,r.zG)(v,o.UI(s.tS((0,m.vg)("unprocessedPVC"))),o.D8(s.Eh((0,g.MW)({aggregations:(0,m.Or)(),customProperties:(0,m.Or)(),sessionId:(0,m.Or)(),viewId:(0,m.Or)()}))),o.UI((0,r.ls)(s.UI(y),p.Yo)))}}))},y=e=>(0,r.bc)(`PageviewComplete-${e.viewId}`,{name:"PageviewComplete",time:new Date,session_id:e.sessionId,view_id:e.viewId,properties:{...e.customProperties,aggregations:(0,r.zG)(e.aggregations,(0,m.rO)({SegmentEntry:I,SegmentExit:I,CohortEntry:I,CohortExit:I}))}});const _=e=>t=>{const n=new Set(t);return n.add(e),n},b=e=>t=>{const n=new Set(t);return n.delete(e),n},I=e=>[...e];var S=n(992);const w=()=>({kind:"null",value:null}),G=e=>({kind:"string",value:e}),k=e=>({kind:"number",value:e}),z=e=>({kind:"array",value:e}),U=e=>({kind:"object",value:e}),E=e=>e,P=()=>({kind:"bottom"}),O=e=>({kind:"inner",a:e}),C=e=>({kind:"top",error:e}),T=e=>({kind:"unbounded",group:e}),D=(e,t)=>({kind:"windowed",key:t,group:e}),x=(e,t,n)=>({kind:"countLimit",n,limit:t,group:e}),A=(e,t,n)=>({kind:"uniqueLimit",n,limit:t,group:e}),q=e=>({kind:"numberGroup",group:e}),M=e=>({kind:"stringGroup",group:e}),R=e=>({kind:"tuple",tuple:e}),F=e=>({state:e}),j=(e,t)=>({commands:e,payload:t});var L=n(209);const Y=(e,t)=>{switch(e.kind){case"bottom":return{kind:"bottom"};case"inner":return O(t(e.a));case"top":return C(e.error)}},$=e=>(0,L.Zt)(((t,n)=>{if("bottom"===t.kind&&"bottom"===n.kind)return 0;if("bottom"===t.kind)return-1;if("bottom"===n.kind)return 1;if("top"===t.kind&&"top"===n.kind)return h.Df.compare(t.error,n.error);if("top"===t.kind)return 1;if("top"===n.kind)return-1;if("inner"===t.kind&&"inner"===n.kind)return e.compare(t.a,n.a);throw new Error("Non exhaustive match in extendedAlgebraOrd")}));var N=n(885),Q=n(500),B=n(365),H=function(e){return-1===e?1:1===e?-1:0};function K(e,t){return(0,Q.oA)(e.map(t))}function V(e,t,n,r){const i=(e,t)=>{if(0===e.length)return(0,Q.oA)(t.map((e=>(0,s.G)({1:e[1],2:n(s.YP,(0,s.G)(e[2]))}))));if(0===t.length)return(0,Q.oA)(e.map((e=>(0,s.G)({1:e[1],2:n((0,s.G)(e[2]),s.YP)}))));if(e.length>0&&t.length>0&&(0,L.lt)(r)(e[0][1],t[0][1])){const[r,...o]=e,u=r[1],a=r[2];return(0,Q.Ce)({1:u,2:n((0,s.G)(a),s.YP)})(i(o,t))}if(e.length>0&&t.length>0&&(0,L.gt)(r)(e[0][1],t[0][1])){const[r,...o]=t,u=r[1],a=r[2];return(0,Q.Ce)({1:u,2:n(s.YP,(0,s.G)(a))})(i(e,o))}if(e.length>0&&t.length>0){const[r,...o]=e,[u,...a]=t,c=r[1],l=r[2],f=u[2];return(0,Q.Ce)({1:c,2:n((0,s.G)(l),(0,s.G)(f))})(i(o,a))}throw new Error("Non exhaustive match in mapOption2")},o=(0,L.Uz)((e=>e[1]))(r),u=(e=>{const t=K(e,(e=>(0,s.pC)(e[2])?(0,s.G)({1:e[1],2:e[2].value}):s.YP));return 0===t.length?s.YP:(0,s.G)(t)})(i((0,Q.DY)(o)([...e].map((e=>({1:e[0],2:e[1]})))),(0,Q.DY)(o)([...t].map((e=>({1:e[0],2:e[1]}))))));return(0,s.UI)((e=>new Map(e.map((e=>[e[1],e[2]])))))(u)}function W(e,t,n,r){const i=(0,L.Uz)((e=>e[0]))(r),o=(0,Q.DY)(i)([...t]).reduceRight(((e,t)=>{if((0,B.nM)(e)){const r=n(t[1],e.left);return(0,s.pC)(r)?(0,B.t$)(r.value):(0,B.F2)(t[0])}return e}),(0,B.t$)(e));return(0,s.Uo)(o)}function X(e,t){return new Map([...e].map(t))}function J(e,t){return new Map([...e].filter(t))}var Z=n(11);function ee(e){return JSON.stringify(te(e))}function te(e){switch(e.kind){case"null":return ie.encode(e);case"string":return oe.encode(e);case"number":return se.encode(e);case"array":return ue.encode(e);case"object":return ae.encode(e)}}function ne(e){return null===e?ie.decode(e):"number"==typeof e?se.decode(e):"string"==typeof e?oe.decode(e):Array.isArray(e)?ue.decode(e):ae.decode(e)}const re=(e,t)=>(0,B.t$)(`Failed to decode. Input was ${JSON.stringify(e)}. Codec type was ${t}`),ie={encode:e=>null,decode:e=>null===e?(0,B.F2)({kind:"null",value:null}):re(e,"SimpleNull")},oe={encode:e=>e.value,decode:e=>"string"==typeof e?(0,B.F2)(G(e)):re(e,"SimpleString")},se={encode:e=>e.value,decode:e=>"number"==typeof e?(0,B.F2)(k(e)):re(e,"SimpleNumber")},ue={encode:e=>e.value.map(te),decode:e=>{if(Array.isArray(e)){const t=(0,Q.fw)(B.g1)(ne)(e);return(0,B.UI)(z)(t)}return re(e,"SimpleArray")}},ae={encode:e=>{const t=[...e.value.entries()];return Object.assign({},...Array.from(t,(([e,t])=>({[e]:te(t)}))))},decode:e=>{if(e&&e.constructor===Object){const t=(0,Q.fw)(B.g1)((([e,t])=>(0,r.zG)(ne(t),(0,B.UI)((t=>(0,r.bc)(e,t))))))(Object.entries(e));return(0,B.UI)((e=>U(new Map([...e]))))(t)}return re(e,"SimpleObject")}};function ce(e){return(0,r.zG)(e,fe,(0,s.UI)(ee),(0,s.fS)((()=>"<encode error>")))}function le(e){return(0,s.UI)(ve)(function(e){switch(e.state.kind){case"top":return(0,s.G)(G(e.state.error));case"bottom":return s.YP;case"inner":return fe(e.state.a)}}(e))}function fe(e){return function(e){switch(e.kind){case"numberGroup":case"stringGroup":return de(e.group);case"tuple":return e.tuple.length>0}}(e.payload)?(0,s.G)(z(function(e,t){const n=(0,s.UI)((e=>(0,Q.Ce)(e)(t)))(e);return(0,s.fS)((()=>t))(n)}((0,s.UI)((e=>G(function(e){const t=e=>(0,s.EQ)((()=>""),(e=>"b"+JSON.stringify(e)))(e.bound),n=e=>{switch(e.operation){case"add":return"p";case"mul":return"m";case"max":return"v";case"min":return"n"}},r=e=>{const r=t(e[1])+n(e[1]);return 1===e[2]?r:r+JSON.stringify(e[2])};return e.map(r).join("")}(e))))(e.commands),function(e){const t=e=>{switch(e.kind){case"bottom":return{kind:"null",value:null};case"top":return G(e.error);case"inner":return k(e.a)}},n=e=>K([pe,me,e=>(0,r.zG)(e,he,U,s.G)],(t=>t(e))),i=e=>K([pe,ge,e=>(0,r.zG)(e,he,(e=>X(e,(([e,t])=>[JSON.stringify(e),t]))),U,s.G)],(t=>t(e)));switch(e.kind){case"tuple":return e.tuple.map(t);case"stringGroup":return n(e.group);case"numberGroup":return i(e.group)}}(e.payload)))):s.YP}function de(e){switch(e.kind){case"unbounded":return e.group.size>0;case"windowed":return e.group.size>0||(0,s.pC)(e.key);case"countLimit":case"uniqueLimit":return e.group.size>0||(0,s.pC)(e.limit)}}function pe(e){switch(e.kind){case"unbounded":return s.YP;case"windowed":return(0,s.G)(G("w"));case"countLimit":return(0,s.G)(G(1===e.n?"x":`x${e.n}`));case"uniqueLimit":return(0,s.G)(G(1===e.n?"u":`u${e.n}`))}}function me(e){switch(e.kind){case"unbounded":return s.YP;case"windowed":return(0,s.G)(G((0,s.pC)(e.key)?e.key.value:""));case"countLimit":case"uniqueLimit":return(0,s.G)(G((0,s.pC)(e.limit)?e.limit.value:""))}}function ge(e){switch(e.kind){case"unbounded":return s.YP;case"windowed":return(0,s.pC)(e.key)?(0,s.G)(k(e.key.value)):(0,s.G)({kind:"null",value:null});case"countLimit":case"uniqueLimit":return(0,s.pC)(e.limit)?(0,s.G)(k(e.limit.value)):(0,s.G)({kind:"null",value:null})}}function he(e){switch(e.kind){case"unbounded":case"windowed":case"countLimit":case"uniqueLimit":return e.group}}function ve(e){switch(e.kind){case"array":return 0===e.value.length?{kind:"null",value:null}:1===e.value.length?ve(e.value[0]):z(e.value.map(ve));case"object":return(0,r.zG)(J(e.value,(([e,t])=>"null"!==t.kind)),(e=>X(e,(e=>[e[0],ve(e[1])]))),U);default:return e}}function ye(e){const t=e=>{if(0===e.length)return{kind:"bottom"};const t=(e=>{if(4!==e.length)return s.YP;const[t,n,r,i]=e;if("string"===t.kind&&"string"===n.kind&&"object"===i.kind){const e=(0,s.DT)((e=>_e(e[1].value)&&be(e[2].value)))({1:t,2:n});return(0,s.UI)((e=>({prim:e[1].value,grp:e[2].value,cutoff:r,m:i.value})))(e)}return s.YP})(e);if((0,s.pC)(t)){const{prim:e,grp:n,cutoff:r,m:i}=t.value,o=Ie(r,i,Se(n));return"string"==typeof o?C(o):O(j(we(e),o))}const n=(e=>{if(3!==e.length)return s.YP;const[t,n,r]=e;if("string"===t.kind&&"object"===r.kind){const e=(0,s.DT)((e=>be(e.value)))(t);return(0,s.UI)((e=>({grp:e.value,cutoff:n,m:r.value})))(e)}return s.YP})(e);if((0,s.pC)(n)){const{grp:e,cutoff:t,m:r}=n.value,i=Ie(t,r,Se(e));return"string"==typeof i?C(i):O(j(s.YP,i))}const r=(e=>{if(2!==e.length)return s.YP;const[t,n]=e;if("string"===t.kind&&"object"===n.kind){const e=(0,s.DT)((e=>_e(e.value)))(t);return(0,s.UI)((e=>({prim:e.value,m:n.value})))(e)}return s.YP})(e);if((0,s.pC)(r)){const{prim:e,m:t}=r.value;return O(j(we(e),M(T(t))))}const i=(e=>{if(1!==e.length)return s.YP;const[t]=e;return"object"===t.kind?(0,s.G)({m:t.value}):s.YP})(e);if((0,s.pC)(i)){const{m:e}=i.value;return O(j(s.YP,M(T(e))))}const o=(e=>{if(e.length<1)return s.YP;const[t,...n]=e;if("string"===t.kind){const e=(0,s.DT)((e=>_e(e.value)))(t);return(0,s.UI)((e=>({prim:e.value,rest:n})))(e)}return s.YP})(e);if((0,s.pC)(o)){const{prim:e,rest:t}=o.value;return O(j(we(e),ke(t)))}return O(j(s.YP,ke(e)))},n=e=>"array"===e.kind?(0,Q.tS)(n)(e.value):[e];return"null"===e.kind?F({kind:"bottom"}):F(t(n(e)))}function _e(e){const t=e.split("");if(!0==(0===t.length))return!1;{const[e,...n]=t;return-1!=="bpmvn".indexOf(e)&&n.every((e=>-1!=="bpmvn0123456789.".indexOf(e)))}}function be(e){const t=e.split("");switch(!0){case 0===t.length:return!1;case"w"===t[0]&&void 0===t[1]:return!0;default:{const[e,...n]=t;return-1!=="ux".indexOf(e)&&-1===n.map((e=>!isNaN(parseInt(e)))).indexOf(!1)}}}function Ie(e,t,n){switch(e.kind){case"string":return M(n({1:(0,s.G)(e.value),2:t}));case"number":case"null":return q(n({1:"null"===e.kind?s.YP:(0,s.G)(e.value),2:J(X(t,(([e,t])=>[Number(e),t])),(e=>!isNaN(e[0])))}));default:return"{bad cutoff}"}}function Se(e){const t=e=>t=>A(t[2],t[1],e),n=e=>t=>x(t[2],t[1],e),r=e.split("");switch(!0){case"w"===r[0]&&void 0===r[1]:return e=>D(e[2],e[1]);case"u"===r[0]&&void 0===r[1]:return t(1);case"u"===r[0]&&void 0!==r[1]:return t(parseInt(r.slice(1).join("")));case"x"===r[0]&&void 0===r[1]:return n(1);case"x"===r[0]&&void 0!==r[1]:return n(parseInt(r.slice(1).join("")));default:throw new Error("This should never happen if you use isGroupCommand")}}function we(e){const t=e=>(0,s.Wi)(e.bound)||"add"===e.operation||"mul"===e.operation?(0,s.G)(e):s.YP,n=(e,n,i)=>{const o=((e,n)=>(0,r.zG)(e,(e=>{switch(e){case"p":return(0,s.G)("add");case"m":return(0,s.G)("mul");case"v":return(0,s.G)("max");case"n":return(0,s.G)("min");default:return s.YP}}),s.UI((e=>({operation:e,bound:n}))),s.tS(t)))(e,i);return(0,s.UI)((e=>{const{init:t,rest:r}=(0,Q.zT)((e=>{return"number"==typeof(t=parseInt(e))&&isFinite(t)&&Math.floor(t)===t;var t}))(n);return{1:{1:e,2:0===t.length?1:parseInt(t.join(""))},2:r.join("")}}))(o)};return(0,s.UI)(E)((0,N.nI)(Ge(e,(e=>{const t=e.split("");if(0===t.length)return s.YP;const[i,...o]=t;if("b"===i){const{init:e,rest:t}=(0,r.zG)(o,(0,Q.zT)((e=>-1!=="1234567890.".indexOf(e))));if(0===e.length||0===t.length)return s.YP;const i=parseFloat(e.join("")),[u,...a]=t;return n(u,a,(0,s.G)(i))}return n(i,o,s.YP)}))))}function Ge(e,t){const n=t(e);return(0,s.fS)((()=>[]))((0,s.UI)((e=>[e[1]].concat(Ge(e[2],t))))(n))}function ke(e){return R(e.map(ze))}function ze(e){switch(e.kind){case"number":return O(e.value);case"string":return C(e.value);case"null":return{kind:"bottom"};case"object":return C("{object}");case"array":return C("{array}")}}var Ue=n(828);const Ee={strategy:(e,t,n)=>r=>{if((0,s.Wi)(n))return t;if("delta"===e&&(0,s.Wi)(t))return s.YP;if((0,s.Wi)(t))return n;if((0,s.pC)(t)&&(0,s.pC)(n))return r(t.value,n.value);throw new Error("Non exhaustive match in combineCommand.strategy")},operation:(e,t,n,i,o,u)=>{const a=(0,Q.pR)($(u)),c=(0,r.zG)(t.bound,s.EQ((()=>r.yR),(e=>t=>(0,L.VV)(u)(o.fromNumber(e),t))));if("append"===e&&"add"===t.operation)return(0,Q.yL)(n,i,Ae("append",(0,r.ls)(o.plus,c)));if("append"===e&&"mul"===t.operation)return(0,Q.yL)(n,i,Ae("append",(0,r.ls)(o.times,c)));if("append"===e&&"max"===t.operation)return(0,L.Fp)(a)(n,i);if("join"===e&&"add"===t.operation)return(0,Q.yL)(n,i,Ae("join",(0,L.Fp)(u)));if("join"===e&&"mul"===t.operation)return(0,Q.yL)(n,i,Ae("join",(0,L.Fp)(u)));if("join"===e&&"max"===t.operation)return(0,L.Fp)(a)(n,i);if("min"===t.operation)return Ee.operation(e,{operation:"max",bound:t.bound},n,i,o,function(e){return(0,L.Zt)(((t,n)=>H(e.compare(t,n))))}(u));if("delta"===e&&"max"===t.operation)return(0,L.gt)(a)(n,i)?n:i.map(P);if("delta"===e)return(0,Q.yL)(n,i,((e,t)=>(0,L.gt)($(u))(e,t)?Y(e,c):{kind:"bottom"}));throw new Error("Non exhaustive match in combineCommand.operation")},extend:(e,t,n,r)=>{if("delta"===e&&"top"===n.kind&&"top"===r.kind)return(0,L.gt)(h.Df)(n.error,r.error)?C(n.error):{kind:"bottom"};if("delta"===e&&"bottom"===r.kind)return n;if("delta"===e&&"bottom"===n.kind)return{kind:"bottom"};if("top"===n.kind&&"top"===r.kind)return C((0,L.Fp)(h.Df)(n.error,r.error));if("top"===n.kind)return n;if("top"===r.kind)return r;if("inner"===n.kind&&"inner"===r.kind)return t(n.a,r.a);if("bottom"===n.kind)return r;if("bottom"===r.kind)return n;throw new Error("Non exhaustive match in extend")}},Pe={fromNumber:r.yR,plus:(e,t)=>e+t,times:(e,t)=>e*t};function Oe(e,t,n,r){if("unbounded"===e.kind&&"unbounded"===t.kind){const i=e.group,o=t.group;return(0,s.fS)(P)((0,s.UI)((e=>O(T(e))))(V(i,o,n,r)))}if("windowed"===e.kind&&"windowed"===t.kind){const i=e.key,o=e.group,u=t.key,a=t.group,c=(0,L.Fp)((0,s.pR)(r))(i,u);return(0,s.fS)(P)((0,s.UI)((e=>O(D(e,c))))(V(o,a,n,r)))}if("countLimit"===e.kind&&"countLimit"===t.kind){const i=e.n,o=t.n;if(i===o){const o=e.limit,u=e.group,a=t.limit,c=t.group,l=(0,L.Fp)((0,s.pR)(r))(o,a);return(0,s.fS)(P)((0,s.UI)((e=>O(x(e,l,i))))(V(u,c,n,r)))}return C("Non matching counts")}if("uniqueLimit"===e.kind&&"uniqueLimit"===t.kind){const i=e.n,o=t.n;if(i===o){const o=e.limit,u=e.group,a=t.limit,c=t.group,l=(0,L.Fp)((0,s.pR)(r))(o,a);return(0,s.fS)(P)((0,s.UI)((e=>O(A(e,l,i))))(V(u,c,n,r)))}return C("Non matching counts")}return C("Non matching group types")}function Ce(e,t,n){return(0,s.fS)(w)(Te(e,s.YP)(t,n))}function Te(e,t){const n=t=>(n,r)=>Ee.strategy(e,n,r)(Te(e,t)),i=(t,r,i)=>{if("stringGroup"===r.kind&&"stringGroup"===i.kind){const e=Oe(r.group,i.group,n(t),h.Df);return Y(e,(e=>M(xe(e,h.Df))))}if("numberGroup"===r.kind&&"numberGroup"===i.kind){const e=Oe(r.group,i.group,n(t),Z.Df);return Y(e,(e=>q(xe(e,Z.Df))))}if("tuple"===r.kind&&"tuple"===i.kind){const n=(0,s.pC)(t)?t.value:[];return O(R(function(e,t,n,r,i,o){const u=(e,t)=>({1:(0,Q.ke)(e)(t).concat((0,Q.KB)(Math.max(0,e-t.length),P)),2:(0,Q.md)(e)(t)}),a=(t,n,r)=>{if(0===t.length)return Ee.operation(e,{operation:"max",bound:s.YP},n,r,i,o);if(t.length>0){const[s,...c]=t,l=u(s[2],n),f=l[1],d=l[2],p=u(s[2],r),m=p[1],g=p[2];return Ee.operation(e,s[1],f,m,i,o).concat(a(c,d,g))}throw new Error("Non exhaustive match in recurse")};return(0,Q.GY)((0,Q.Qp)((e=>"bottom"===e.kind))((0,Q.GY)(a(t,n,r))))}(e,n,r.tuple,i.tuple,Pe,Z.Df)))}throw new Error(`Non matching payload. Got ${r.kind} and ${i.kind}`)},o=(e,n)=>{if((0,s.Eh)((0,N.Eh)((0,g.n_)({1:(0,g.n_)({operation:h.Eq,bound:(0,s.Eh)(Z.Eq)}),2:Z.Eq}))).equals(e.commands,n.commands)){const r=(0,s.Wi)(e.commands)?t:e.commands,o=i(r,e.payload,n.payload);return Y(o,(t=>j(e.commands,t)))}if(o=e.commands,u=n.commands,(0,s.Eh)((0,N.Eh)((0,g.n_)({1:(0,g.n_)({operation:h.Eq}),2:Z.Eq}))).equals(o,u)){const o=(0,r.zG)(((e,t)=>(0,r.zG)((0,Ue.gz)(s.G5)(e,t),(0,s.UI)((([e,t])=>N.yL(e,t,((e,t)=>({1:{operation:e[1].operation,bound:(0,r.zG)((0,Ue.gz)(s.G5)(e[1].bound,t[1].bound),s.UI((([e,t])=>Math.min(e,t))),s.wp((()=>e[1].bound)),s.wp((()=>t[1].bound)))},2:e[2]})))))))(e.commands,n.commands),s.wp((()=>t))),u=i(o,e.payload,n.payload);return Y(u,(e=>j(o,e)))}throw new Error(`Non matching primitive strings. Got ${ce(e)} and ${ce(n)}`);var o,u};return(t,n)=>le(F(Ee.extend(e,o,ye(t).state,ye(n).state)))}function De(e,t,n){const r=(0,s.UI)((t=>J(e,(([e,r])=>(0,L.gf)(n)(e,t)))))(t);return(0,s.fS)((()=>e))(r)}function xe(e,t){switch(e.kind){case"unbounded":return e;case"windowed":return(0,s.Wi)(e.key)?e:D(De(e.group,e.key,t),e.key);case"countLimit":{const n=e.limit,r=e.n,i=e.group,o=W(r,i,((e,t)=>t<=1?s.YP:(0,s.G)(t-1)),t),u=(0,L.Fp)((0,s.pR)(t))(n,o);return x(De(i,u,t),u,r)}case"uniqueLimit":{const n=e.limit,r=e.n,i=e.group,o=(e,t)=>{if("object"===e.kind){const n=[...e.value.keys(),...t.keys()],i=new Set(n);return i.size>=r?s.YP:(0,s.G)(i)}return s.YP},u=W(new Set,i,o,t),a=(0,L.Fp)((0,s.pR)(t))(n,u);return A(De(i,a,t),a,r)}}}function Ae(e,t){return(n,r)=>Ee.extend(e,((e,n)=>O(t(e,n))),n,r)}function qe(e,t){return Ce("append",e,t)}function Me(e,t){return Ce("join",e,t)}var Re=n(923),Fe=n(17),je=n(767),Le=n(862),Ye=n(341),$e=n(870);function Ne(e,t){return function(n){return e.map(n,t.compact)}}function Qe(e,t,n){var i=Ne(e,t),o=(0,Ye.UI)(e,n);return function(e){return $e.s4(i((0,r.zG)(e,o(s.IS))),i((0,r.zG)(e,o(s.EK))))}}function Be(e,t){return function(n){return function(r){return e.map(r,(function(e){return t.filter(e,n)}))}}}function He(e,t){return function(n){return function(r){return e.map(r,(function(e){return t.filterMap(e,n)}))}}}function Ke(e,t){var n=Be(e,t);return function(e){var t=n((0,Fe.ff)(e)),r=n(e);return function(e){return(0,$e.s4)(t(e),r(e))}}}function Ve(e,t){var n=He(e,t);return function(e){return function(t){return(0,$e.s4)((0,r.zG)(t,n((function(t){return(0,s.IS)(e(t))}))),(0,r.zG)(t,n((function(t){return(0,s.EK)(e(t))}))))}}}var We=n(679),Xe=n(384);function Je(e){return(0,r.ls)(s.G,e.of)}function Ze(e){return(0,r.a9)(e.of(s.YP))}function et(e){return function(t){return e.map(t,s.G)}}function tt(e){return(0,r.ls)(s.ij,e.of)}function nt(e){var t=tt(e);return function(e){return(0,r.ls)(e,t)}}function rt(e){var t=pt(e),n=nt(e);return function(e){return t(n(e))}}function it(e){return function(t){return(0,r.ls)(t,e.of)}}function ot(e){var t=pt(e),n=it(e);return function(e){return t(n(e))}}function st(e){return function(t){return function(n){return e.of(s.DT(t)(n))}}}function ut(e){return(0,r.ls)(s.Uo,e.of)}function at(e){return function(t,n){return function(r){return e.map(r,s.EQ(t,n))}}}function ct(e){return function(t,n){return function(r){return e.chain(r,s.EQ(t,n))}}}function lt(e){return function(t){return function(n){return e.chain(n,s.EQ(t,e.of))}}}function ft(e){return(0,Ye.UI)(e,s.dO)}function dt(e){return(0,Ue.ap)(e,s.G5)}function pt(e){var t=Ze(e);return function(n){return function(r){return e.chain(r,s.EQ((function(){return t()}),n))}}}function mt(e){var t=Je(e);return function(n){return function(r){return e.chain(r,s.EQ(n,t))}}}var gt=n(151),ht=Je(gt.PM),vt=(gt.PM,gt.of),yt=(gt.PM,function(e){return _t(gt.tD(e))}),_t=et(gt.dO),bt=gt.UI(s.Uo),It=(gt.dO,ct(gt.qo)),St=(gt.UA,gt.PM,gt.PM,gt.UA,gt.PM,ot(gt.UA)),wt=ft(gt.dO),Gt=dt(gt.Hi),kt=ht,zt=pt(gt.UA),Ut=(gt.UA,gt.PM,gt.dO,s.Ri,gt.dO,s.Ri,s.dO,Be(gt.dO,s.xu)),Et=(gt.dO,s.xu,gt.dO,s.xu,gt.dO,s.xu,function(e,t){return(0,r.zG)(e,wt(t))}),Pt=function(e,t){return(0,r.zG)(e,Gt(t))},Ot=function(e,t){return(0,r.zG)(e,zt(t))},Ct="TaskOption",Tt={URI:Ct,map:Et,ap:Pt,chain:Ot},Dt={URI:Ct,fromIO:yt,fromTask:_t},xt=(0,We.oU)(Dt,Tt),At=(Xe.F4,(0,Le.a)(Tt)),qt=(Xe.Xl,Je(d.PM)),Mt=(d.PM,d.of,d.PM,d.dO,s.Uo,d.dO,d.qo,d.UA,d.UI(s.FS),d.UI(s.WG),d.PM,d.PM,d.UA,d.PM,d.UA,d.dO,d.G5,qt),Rt=(d.UA,mt(d.UA));d.PM,d.dO,s.Ri,d.dO,s.Ri,s.dO,d.dO,s.xu,d.dO,s.xu,d.dO,s.xu,d.dO,s.xu,Xe.F4,Xe.Xl;const Ft=new Set(["AdRequest","Reaction","PageviewEngagement","SegmentEntry","SegmentExit"]),jt=e=>i.dQ((t=>{let{previousState:n}=t;const[i,u]=o.Ue(!1);const[a,c]=o.gS({empty:s.YP,concat:(e,t)=>(0,r.zG)(p.oA([e,t]),s.DT(p.Od),s.UI((e=>e.reduce(((e,t)=>({...e,...t}))))))}),l=(0,r.zG)((0,m.Kn)(n)?n:{},(0,m.rO)({stateOffset:(0,r.ls)(s.DT(m.BJ),s.fS((()=>0))),fetchUnseenKey:(0,r.ls)(s.DT(m.HD),s.fS((()=>"")))})),f=(0,r.zG)(o.gS(s.uZ({concat:function(e,t){return Object.assign({},e,t)}})),(t=>{let[n,i]=t;return(0,r.zG)(o.vP(e.lastProcessedEvents,e.internalStateDiff,e.queryLanguageProcessing),o.bw((e=>{let[t,n,r]=e;if(r)return;return t().filter((e=>!Ft.has(e.name))).length>0?i(n()):void 0}))),(0,r.zG)(o.vP({internalStateDiff:n,internalStateMap:e.internalStateMap}),o.D8(((e,t)=>e.internalStateDiff===t.internalStateDiff)))})),d=(0,r.zG)(o.vP(e.sessionId,f,i),o.Rp(o.a9({...l,inFlightRequest:!1,previousDecodedState:(0,r.zG)(e.internalStateMap.current,Yt,ne,B.fS((()=>U(new Map)))),sendFullStateWithUnseen:!1}),((t,n)=>{let[i,{internalStateDiff:u,internalStateMap:a},l]=n;return(0,r.zG)(t,o.VS((t=>{if(t.inFlightRequest)return o.a9(t);const n=!l&&t.sendFullStateWithUnseen,f=n||!e.groupIdIsNewlyGenerated&&i!==t.fetchUnseenKey;return(0,r.zG)(n?Mt(a):u,Rt((()=>()=>(0,r.zG)({},s.DT((()=>f))))),gt.tD,zt((0,r.ls)(Nt(t.previousDecodedState),je.Vn((0,m.bw)((t=>e.logger.error(t)))),bt)),It((()=>gt.of({...t,inFlightRequest:!1})),(0,r.ls)(gt.of,gt.ak("processed",(n=>(0,r.zG)(e,Lt({delta:n.delta,stateOffset:t.stateOffset,fetchUnseen:f}),gt.UI((0,m.bw)((0,r.ls)(s.UI((0,m.vg)("stateDelta")),s.hX(Fe.ff(Re.xb)),c)))))),gt.UI((e=>({fetchUnseenKey:i,inFlightRequest:!1,sendFullStateWithUnseen:t.sendFullStateWithUnseen&&!n,previousDecodedState:e.decodedState,stateOffset:(0,r.zG)(e.processed,s.UI((e=>e.response.state_offset)),s.fS((()=>t.stateOffset)))}))))),o.fF,o.UI(s.fS((()=>({...t,inFlightRequest:!0})))))})))})),o.xH,o.UI((e=>({stateOffset:e.stateOffset,fetchUnseenKey:e.fetchUnseenKey}))),o.D8((0,g.MW)({stateOffset:Z.Eq,fetchUnseenKey:h.Eq})));return{state:d,value:{externalStateDelta:a}}})),Lt=e=>t=>(0,r.zG)(e,s.DT((e=>e.fetchUnseen||Fe.ff(Re.xb)(e.delta))),vt,zt((e=>{return(0,r.zG)(t,(n={event_source_id:t.eventSourceId,fetch_unseen:e.fetchUnseen,group_id:t.groupId,last_seen_offset:e.stateOffset,state:e.delta},e=>je.Y3((()=>e.permutiveApi.req({url:e.permutiveUrls.getEndpointUrl("/state",s.G("v1.0"),[["fetch_unseen",JSON.stringify(n.fetch_unseen)]]),method:"POST",payload:{group_id:n.group_id,event_source_id:n.event_source_id,state:JSON.stringify(n.state),last_seen_offset:n.last_seen_offset},contentType:"text/plain",dataType:"json",withCredentials:!1})),(e=>`Error sending state delta. Got ${B.KC(e)}`))),je.Vn((0,m.bw)((e=>t.reportError(e)))),bt,Ut((e=>!!e)),St((0,r.ls)(B.of,B.YO("response"),B.ak("stateDelta",(e=>{return t=e.response.state,(0,B.Y3)((function(){return JSON.parse(t)}),r.yR);var t})),B.Vn((0,m.bw)((e=>t.reportError(`Failed to parse State API response, got ${e}`)))),s.Uo)));var n}))),Yt=e=>(0,m.b0)(e,((e,t)=>t.state?s.G({[t.checksum]:t.state}):s.YP)),$t=e=>t=>{const n=(0,r.zG)(t,Yt,ne,B.fS((()=>U(new Map))),(t=>Ce("delta",t,e)));return{decodedState:Me(n,e),delta:(0,r.zG)(n,te,s.ij,s.fS((()=>({}))))}},Nt=e=>t=>()=>new Promise((n=>(0,S.HJ)((()=>(0,r.zG)(t,B.it($t(e),(e=>`Failed to compute delta for state sync. Got ${e}`)),n)))));n(605),Re.dp;var Qt=Re.xb,Bt=function(e){return function(t){return Object.keys(t).sort(e.compare)}};h.Df;Re.dx,Re.e$;Re.Bu,Re.P5,Re.Su;var Ht=Re.UI;Re.ri;function Kt(e){return Re.vP(e)}Re._r;Re.jt;Re.yW,Re.G,Re.t9;var Vt=Re.HA,Wt=(Re.nn,Re.kp),Xt=Re.CC,Jt=Re.RF,Zt=(Re.I8,Re.mS,Re.RJ,Re._Y,Re.V_),en=Re.EW,tn=Re.nu,nn=(Re.SW,Re.zV,Re.Ub,Re.vA,Re.qS),rn=(Re.mK,function(e){return function(t){var n=Bt(e);return function(e,r){var i=n(e);if(0===i.length)return t.of({});for(var o=t.of({}),s=function(n){o=t.ap(t.map(o,(function(e){return function(t){return e[n]=t,e}})),r(n,e[n]))},u=0,a=i;u<a.length;u++){s(a[u])}return o}}}),on=Re.hX;Re.DZ,Re.uK,Re.tV;Re.oA,Re.oh;var sn="Record";var un,an,cn=Re.Eh,ln=(Re.uZ,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,Re.nr,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,h.Df,n(688)),fn=n(241),dn=function(e){return function(t){return[void 0,e(t)]}},pn=function(e){return function(t){return[e(t),t]}},mn=function(e,t){return(0,r.zG)(e,vn(t))},gn=function(e,t){return(0,r.zG)(e,yn(t))},hn=function(e,t){return(0,r.zG)(e,bn(t))},vn=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return[e(i),o]}}},yn=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1],s=e(o),u=s[0],a=s[1];return[i(u),a]}}},_n=function(e){return function(t){return[e,t]}},bn=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return e(i)(o)}}},In="State",Sn={URI:In,map:mn},wn={URI:In,map:mn,ap:gn},Gn=(0,Ue.N)(wn),kn={URI:In,map:mn,ap:gn,of:_n},zn={URI:In,map:mn,ap:gn,chain:hn},Un=(0,Le.m)(zn),En=(r.yR,(0,Ye.YO)(Sn)),Pn=(0,Le.a)(zn),On=function(e){var t=function(e){return function(t){return function(n){for(var r=e(0,Xe.YM(t))(n),i=[r[0]],o=r[1],s=1;s<t.length;s++){var u=e(s,t[s])(o),a=u[0],c=u[1];i.push(a),o=c}return[i,o]}}}(e);return function(e){return Xe.Od(e)?t(e):_n(Xe.Xl)}},Cn=function(e){return On((function(t,n){return e(n)}))},Tn=Cn(r.yR);!function(e){e.init=function(e){return e&&"object"==typeof e&&"externalStateMap"in e&&"internalStateMap"in e?e:{externalStateMap:s.YP,internalStateMap:{}}}}(un||(un={})),function(e){e.sequenceNonEmptyArray=e=>{if(1===e.length)return e[0];const t=(0,r.bc)([],{},[]);for(const n of e){t[0].push(...n[0]);for(const e in n[1])t[1][e]=n[1][e];t[2].push(...n[2])}return t},e.sequenceArray=t=>(0,r.zG)(t,s.DT(p.Od),s.UI(e.sequenceNonEmptyArray)),e.empty=[p.cS,Re.cS,p.cS]}(an||(an={}));const Dn=e=>t=>(0,r.zG)(xn((e=>({...e,getCurrentSession:()=>t.environment.sessionId,getCurrentView:()=>t.environment.viewId}))),bn((()=>{return Tn([An(e),Mn(t.environment.thirdPartyData),(i=t.environment.lookalikeModels,(0,r.zG)((function(e){return[e,e]}),bn((e=>Jn.equals(e.lal,i)?_n(p.cS):(0,r.zG)(dn((0,m.rO)({lal:(0,r.a9)(i)})),Gn(xn(function(e){const t=(0,r.zG)(e,s.fS((()=>({}))));return e=>({...e,getLookalikeModels:()=>t})}(i))),bn((()=>(0,r.zG)(p.Yo(i),Cn((()=>Fn("updateLAL"))),vn(p.xH))))))))),(0,r.zG)(t.externalStateDelta,s.UI(Rn),s.fS((()=>_n(p.bM())))),(n=t.cloudLiftedState,(0,r.zG)(n,p.tS((e=>Object.entries(e))),Cn((e=>{let[t,n]=e;return pn((e=>(0,r.bc)(t,e.queries.runtime.cloudLiftedQueries[t],n)))})),bn((e=>Yn(B.F2(e)))))),jn(t.newEvents)]);var n,i})),vn((0,r.ls)(p.xH,s.DT(p.Od),s.tS(an.sequenceArray))),(e=>t=>{let[n,i]=e(t);if(s.pC(n)){let e=n.value,t=0;for(;e[2].length>t;)t=e[2].length,[e,i]=(0,r.zG)(i,(0,r.zG)(jn(e[2]),vn((t=>an.sequenceNonEmptyArray([e,...t])))));n=s.G(e)}return(0,r.bc)(n,i)}),rr(e,"query_language_process_duration")),xn=e=>dn((0,m.rO)({effects:e}));function An(e){return(0,r.zG)((function(e){return[e,e]}),bn((t=>{let{bootstrapped:n,effects:i,eventsForReplay:o}=t;return n?_n(p.cS):(0,r.zG)(dn((e=>({...e,bootstrapped:!0,eventsForReplay:[]}))),bn((()=>(0,r.zG)(o,p.R3(nr(i)),Cn(Ln("bootstrap")),vn(p.xH)))),rr(e,"query_language_bootstrap_duration"))})))}const qn=(0,r.zG)(pn((e=>e.tpdQueries)),bn(s.EQ((()=>(0,r.zG)(pn((e=>new Set([...e.queries.runtime.queriesByEvent["!UpdateSecondPartyData"]||[],...e.queries.runtime.queriesByEvent["!UpdateThirdPartyData"]||[]]))),Un((e=>dn((0,m.rO)({tpdQueries:()=>s.G(e)})))))),_n)));function Mn(e){const t=(0,r.zG)(e,s.UI(u.li));return(0,r.zG)((function(e){return[e,e]}),bn((n=>{if(s.Eh(Z.Eq).equals(t,n.tpdHashInEffectsObject))return _n(p.cS);const i=s.FS(t);return(0,r.zG)(dn((0,m.rO)({persistentState:(0,m.rO)({tpdHash:(0,r.a9)(i)}),tpdHashInEffectsObject:(0,r.a9)(t),tpdReady:(0,r.a9)(s.pC(e))})),vn((()=>(0,r.zG)(e,s.UI(u.Yg)))),Un((e=>xn(function(e){const t=Zn((()=>(0,r.zG)(e,s.fS((()=>({"3p":{}}))))));return e=>{const n=Zn((()=>({...t(),...e.get1PSegments()})));return{...e,getSegments:n,getSegmentsArray:Zn((()=>tr(n()))),get3PSegments:t}}}(e)))),bn(s.fw(kn)((()=>(0,r.zG)(n.tpdEventsToProcess,p.EQ((()=>i!==n.persistentState.tpdHash?Fn("updateTPD"):_n(p.cS)),(0,r.ls)(Cn(Ln("updateTPD")),Gn(dn((e=>({...e,tpdEventsToProcess:[]})))),vn(p.xH))))))),vn(s.fS((()=>p.bM()))))})))}function Rn(e){return(0,r.zG)(pn((t=>(0,r.zG)(e,Re.jt(((e,n)=>(0,r.zG)(Re.P5(e,t.queries.metadata),s.tS((e=>Re.P5(e,n))),s.tS((0,r.ls)(ne,s.Uo))))),(e=>(0,r.zG)(t.persistentState.externalStateMap,s.UI(Re.DZ((0,r.ls)(ne,s.Uo))),s.EQ((()=>e),(t=>(0,r.zG)({...t,...e},Re.Su(((e,n)=>(0,r.zG)(Re.P5(e,t),s.tS((e=>s.Y3((()=>Me(n,e))))),s.fS((()=>n)))))))))),Re.UI(te)))),bn((e=>dn((0,m.rO)({persistentState:(0,m.rO)({externalStateMap:(0,r.a9)(s.G(e))})})))),bn((()=>Fn("updateExternalState"))))}function Fn(e){return(0,r.zG)(pn((e=>nr(e.effects))),bn(Ln(e)))}function jn(e){return(0,r.zG)(e,p.EQ((()=>_n(p.bM())),(0,r.ls)(Qn,bn(Cn((e=>{let[t,n]=e;return(0,r.zG)(n,Ln(t))}))),vn(p.xH))))}function Ln(e){return(0,r.ls)(_n,Un((e=>"Pageview"!==e.name?_n(void 0):dn((0,m.rO)({pageviewProperties:(0,r.a9)(e.properties)})))),Un((e=>{return Kn(e)?xn((t=e.properties.segment_number,n="SegmentEntry"===e.name,e=>{return(0,r.zG)(e,(i={"1p":{...e.get1PSegments()["1p"],[t]:n}},e=>{const t=Zn((()=>({...i,...e.get3PSegments()})));return{...e,getSegments:t,getSegmentsArray:Zn((()=>tr(t()))),get1PSegments:()=>i}}));var i})):_n(void 0);var t,n})),En("event"),Pn("queriesToProcess",(t=>{let{event:n}=t;return function(e,t){return(0,r.zG)((function(e){return[e,e]}),En("state"),Pn("tpdQueriesToReject",(e=>{let{state:{tpdReady:t}}=e;return t?_n(s.bM()):(0,r.zG)(qn,vn(s.DT((e=>e.size>0))))})),bn((n=>{let{state:i,tpdQueriesToReject:o}=n;const u=(0,r.zG)(o,s.UI((e=>p.hX((t=>!e.has(t))))),s.fS((()=>e=>e)));switch(e){case"bootstrap":return _n((0,r.zG)(i.queriesForReplay,u));case"event":const e=i.tpdReady?_n(void 0):dn((0,m.rO)({tpdEventsToProcess:p.R3(t)}));return(0,r.zG)(_n(i.locallyLiftedQueriesByEvent[t.name]||[]),vn(u),Gn(e));case"lookalikeTransition":return _n(i.locallyLiftedQueriesByEvent[t.name]||[]);case"transition":const n=i.locallyLiftedQueriesByEvent[t.name]||[];if(s.pC(i.lal)){const e=i.locallyLiftedQueriesByEvent["!UpdateLookalikeModels"]||[];return _n(n.concat(e))}return _n(n);case"updateExternalState":return _n((0,r.zG)(i.persistentState.externalStateMap,s.fS((()=>({}))),Re.XP));case"updateLAL":return _n(i.locallyLiftedQueriesByEvent["!UpdateLookalikeModels"]||[]);case"updateTPD":return _n([...i.locallyLiftedQueriesByEvent["!UpdateSecondPartyData"]||[],...i.locallyLiftedQueriesByEvent["!UpdateThirdPartyData"]||[]]);default:return _n([])}})))}(e,n)})),bn((t=>{let{event:n,queriesToProcess:i}=t;return(0,r.zG)(i,p.EQ((()=>_n(p.bM())),(t=>(0,r.zG)(pn((t=>"bootstrap"!==e?t.effects:{...t.effects,getCurrentTime:()=>n.time,getCurrentView:()=>n.view_id,getCurrentSession:()=>n.session_id})),bn((e=>(0,r.zG)(t,Cn((e=>pn((t=>(0,r.bc)(e,t.queries.runtime.locallyLiftedQueries[e]??t.cloudLiftQueriesForReplay[e]))))),bn((t=>Yn(B.t$((0,r.bc)(t,n)),e))))))))))})))}const Yn=(e,t)=>(0,r.zG)(e,B.EQ((e=>{let[n,i]=e;return(0,r.zG)(n,Cn((e=>{let[n,r]=e;return $n(n,B.t$([r,i]),t)})))}),Cn((e=>{let[t,n,r]=e;return $n(t,B.F2([n,r]))}))),vn(an.sequenceArray),Un(s.fw(kn)((e=>{let[,t]=e;return dn((0,m.rO)({persistentState:(0,m.rO)({internalStateMap:e=>({...e,...t})})}))}))),vn(p.Yo)),$n=(e,t,n)=>(0,r.zG)(pn(B.it((i=>{var o,a,c;const l=n??i.effects,f=(0,r.zG)(t,B.EQ(u.li,u.li)),d=(0,r.zG)(t,B.UI(u.Yg),B.fS((e=>{let[t,n]=e;return t.lift(n,l)}))),m=(0,r.zG)(i.persistentState.externalStateMap,s.tS((0,r.ls)(Re.P5(e),s.UI(Wn)))),g=i.persistentState.internalStateMap[e]||{checksum:i.queries.metadata[e]},h=Xn(e,l,f,g,m,d),v=Boolean(null===(o=h.result)||void 0===o?void 0:o.result)!==Boolean(null===(a=i.persistentState.internalStateMap[e])||void 0===a||null===(c=a.result)||void 0===c?void 0:c.result),y=(0,r.zG)(p.lo(v),p.UI((()=>{var t;return{name:null!==(t=h.result)&&void 0!==t&&t.result?"SegmentEntry":"SegmentExit",time:l.getCurrentTime(),view_id:l.getCurrentView(),session_id:l.getCurrentSession(),properties:{...i.pageviewProperties,segment_number:Number(e)}}})));return(0,r.bc)(h,y)}),(t=>`Failed to interpret query ${e}. Got ${t}`))),bn(B.EQ((e=>_n([[e],Re.cS,p.cS])),(t=>{let[n,i]=t;return(0,r.zG)(n.dropExternalState?Nn(e):_n(void 0),vn((()=>[p.cS,{[e]:n},i])))})))),Nn=e=>dn((0,m.rO)({persistentState:(0,m.rO)({externalStateMap:s.UI(Re.EG(e))})}));function Qn(e){const t=e=>t=>(0,r.bc)(e,t);return pn((n=>(0,r.zG)(e,p.pO(fn.aL(((e,t)=>{const n=Kn(e);return(0,r.zG)(t,p.zT((e=>Kn(e)===n)),(e=>{let{init:t,rest:n}=e;return(0,r.bc)(t,n)}),(0,u.pL)(((e,t)=>n=>(0,r.bc)(e,(0,r.zG)(n,p.Ce(t))))(n,e)))}))),p.tS((e=>{let[i,o]=e;if(!i)return(0,r.zG)(o,p.UI(t("event")));const s=(0,r.zG)(o,p.yW((e=>n.lookalikeTransitionSegmentNumbers.has(e.properties.segment_number))),(e=>e?"lookalikeTransition":"transition"));return(0,r.zG)(o,fn.ut(((e,n)=>(0,r.zG)(e,p.UI(t("event")),p.R3((0,r.zG)(n,t(s)))))))})))))}const Bn=(0,r.ls)(Re.hX((e=>{var t;return Boolean(null===(t=e.result)||void 0===t?void 0:t.result)})),Re.XP,p.UI(parseInt)),Hn=(0,r.ls)(Ht((e=>e.activations??{})),on((0,r.zG)(Boolean,(0,Fe.xD)((0,Fe.ff)(Qt)))));function Kn(e){var t;return("SegmentEntry"===e.name||"SegmentExit"===e.name)&&void 0!==(null===(t=e.properties)||void 0===t?void 0:t.segment_number)}const Vn=w,Wn=(0,r.ls)(ne,B.fS(Vn)),Xn=(e,t,n,i,o,u)=>{const a={...i.activations},c={...t,setSegmentActivation:(t,n,r)=>{if(r!=e)throw new Error(`QL called setSegmentActivation for query ${r} while interpreting query ${e}`);t in a?a[t].includes(n)||(a[t]=[...a[t],n]):a[t]=[n]}},l=Wn(i.state||null),f=Wn(u),d=(0,r.zG)(B.Y3((()=>qe(l,f)),ln.w),B.pF((e=>{throw(0,ln.w)(`Failed to append lifted event ${ee(f)} to internal state ${ee(l)}. Got ${e}`)}))),[p,m]=(0,r.zG)(o,s.g_((()=>(0,r.bc)(d,!1)),(e=>(0,r.zG)(B.Y3((()=>(0,r.bc)(qe(d,e),!1)),r.Q1),B.fS((()=>(0,r.bc)(d,!0))))))),g=te(d),h=n.interpret(te(p),c);return{checksum:i.checksum,...null===g?{}:{state:g},...!1===h.result?{}:{result:h},...Qt(a)?{}:{activations:a},...!1===m?{}:{dropExternalState:m}}},Jn=s.Eh({equals:(e,t)=>e===t});function Zn(e){let t,n=!1;return()=>(n||(t=e(),n=!0),t)}function er(e){const t=Zn((()=>(0,r.zG)(e,Re.hX((e=>{var t;return Boolean(null===(t=e.result)||void 0===t?void 0:t.result)})),Re.UI((()=>!0)),(e=>({"1p":e}))))),n={"3p":{}},i=Zn((()=>({...t(),...n})));return{getSegments:i,getSegmentsArray:Zn((()=>tr(i()))),get1PSegments:t,get3PSegments:()=>n}}function tr(e){return Object.keys(e).reduce(((t,n)=>{const r=Object.keys(e[n]),i=[];return r.forEach((t=>{!0===e[n][t]&&i.push(t)})),t[n]=i,t}),{})}const nr=e=>({name:"",properties:{},session_id:e.getCurrentSession(),view_id:e.getCurrentView(),time:e.getCurrentTime()}),rr=(e,t)=>n=>r=>{const i=e.startSpan(t),o=n(r);return i.finish(),o};var ir=n(706),or=n(656);const sr=()=>e=>((0,r.zG)(e,o.UI((e=>e()))),o.a9({newResults:d.of(p.cS),pendingEvents:p.cS})),ur=()=>()=>je.of((()=>({}))),ar=e=>[e,gt.of(e)],cr=u.li,lr=u.Yg,fr=e=>t=>(0,r.zG)(lr(t),(t=>()=>new Promise((n=>{const r=t();r.then(s.G).then(n);const i=(0,S.HJ)((()=>n(s.YP)),e);r.then(i)})))),dr="RefEventual",pr=o.UI(ar),mr=e=>o.a9(ar(e)),gr=e=>t=>o.vP((0,r.zG)(t,o.UI(cr),o.UI(e)),(0,r.zG)(t,o.UI(lr),o.UI(gt.UI(e)))),hr=e=>t=>o.vP((0,r.zG)(o.vP((0,r.zG)(e,o.UI(cr)),(0,r.zG)(t,o.UI(cr))),o.UI((e=>{let[t,n]=e;return n(t)}))),(0,r.zG)(o.vP((0,r.zG)(e,o.UI(lr)),(0,r.zG)(t,o.UI(lr))),o.UI((e=>{let[t,n]=e;return gt.ap(t)(n)})))),vr=e=>t=>(0,r.zG)(t.current,fr(e),gt.UI(s.fS((()=>(e=>cr(e.current))(t))))),yr=o.UI(cr),_r=o.UI(lr),br={URI:dr,map:(e,t)=>gr(t)(e)},Ir={URI:dr,map:br.map,ap:(e,t)=>hr(t)(e)},Sr=e=>i.dQ((t=>{let{previousState:n}=t;const[i,a]=(0,r.zG)(e.newEvents,o.En(2,p.uZ()),(0,ir.H5)(sr(e.permutiveApi,e.permutiveUrls,(c=e.customQueries.runtime,(0,r.zG)(Object.entries(c.queriesByEvent),p.hX((e=>{let[,t]=e;return(0,r.zG)(t,p.G((e=>e in c.cloudLiftedQueries)))})),p.UI(u.li))))));var c;const l=o.vP({lookalikeModels:e.lookalikeModels,sessionId:e.sessionId,thirdPartyData:(0,r.zG)(e.thirdPartyData,o.UI(s.UI((0,ir.H5)(Re.UI((e=>{const t={};return e.forEach((e=>t[e]=!0)),t})))))),viewId:e.viewId}),f=(0,r.zG)(o.vP({cloudLiftedState:(0,r.zG)(a,o.UI((e=>e.newResults))),environment:l,externalStateDelta:e.externalStateDelta,newEvents:(0,r.zG)(i,(0,or.I)(e.metrics,"query_language_began_processing_pageview"))}),o.UI((0,m.rO)({environment:e=>d.of(e)})),o.UI((0,Ue.Yt)(d.G5))),g=un.init(n);const h=(0,r.zG)(n?gt.of({processedState:g,stateMigratedThisInitialisation:!1}):(e.metrics.track({name:"sdk_query_state_migrated_workerisation_count_total",labels:{},value:1}),(0,r.zG)(e.migratedStateMaps,gt.UI((e=>{let{internal:t,external:n}=e;return{stateMigratedThisInitialisation:!0,processedState:{externalStateMap:n,internalStateMap:(0,r.zG)(t,s.fS((()=>({}))))}}})))),gt.Hr("environment",(()=>l.current)),gt.ak("process",(t=>{let{environment:n,processedState:i}=t;return(0,r.zG)((o={downloadCloudLiftQueries:ur(e.permutiveApi,e.permutiveUrls),environment:n,initialState:i,pastEvents:e.priorEvents,queries:e.customQueries},(0,r.zG)(gt.Do,gt.Hr("invalidatedLocalQueries",(()=>(0,r.zG)(o.queries.runtime.locallyLiftedQueries,Re.z7((e=>{var t;return(null===(t=o.initialState.internalStateMap[e])||void 0===t?void 0:t.checksum)!==o.queries.metadata[e]}))))),gt.Hr("invalidatedCloudLiftQueries",(()=>(0,r.zG)(o.queries.runtime.cloudLiftedQueries,Re.z7((e=>{var t;return(null===(t=o.initialState.internalStateMap[e])||void 0===t?void 0:t.checksum)!==o.queries.metadata[e]}))))),gt.Hr("hasInvalidatedQueries",(e=>{let{invalidatedCloudLiftQueries:t,invalidatedLocalQueries:n}=e;return!(Re.xb(t)&&Re.xb(n))})),gt.ak("eventsForReplay",(e=>{let{hasInvalidatedQueries:t}=e;return t?o.pastEvents:gt.of(p.bM())})),gt.ak("cloudLiftQueriesForReplay",(0,r.ls)(s.DT((e=>e.eventsForReplay.length>0)),s.UI((e=>Object.keys(e.invalidatedCloudLiftQueries))),s.hX(p.Od),s.UI((0,r.ls)(o.downloadCloudLiftQueries,je.OV(o.queries.runtime),gt.UI(B.fS((()=>({})))))),s.fS((()=>gt.of({}))))),gt.Hr("queriesForReplay",(e=>{let{cloudLiftQueriesForReplay:t,invalidatedLocalQueries:n}=e;return[...Object.keys(n),...Object.keys(t)]})),gt.Hr("internalStateMap",(e=>{let{invalidatedCloudLiftQueries:t,invalidatedLocalQueries:n}=e;return(0,r.zG)(o.queries.metadata,Re.Su(((e,r)=>e in n||e in t?{checksum:r}:o.initialState.internalStateMap[e])))})),gt.Hr("persistentState",(e=>{let{internalStateMap:t}=e;return{...o.initialState,internalStateMap:t}})),gt.UI((e=>{let{cloudLiftQueriesForReplay:t,eventsForReplay:n,queriesForReplay:i,persistentState:u}=e;return{bootstrapped:!1,cloudLiftQueriesForReplay:t,effects:{getCurrentTime:()=>new Date,getCurrentSession:()=>o.environment.sessionId,getCurrentView:()=>o.environment.viewId,getLookalikeModels:()=>({}),setSegmentActivation:(e,t,n)=>{throw new Error(`setSegmentActivation() called for segment ${n} without being overridden first.`)},...er(u.internalStateMap)},eventsForReplay:n,lal:s.YP,locallyLiftedQueriesByEvent:(0,r.zG)(o.queries.runtime.queriesByEvent,Re.DZ(s.KQ(p.hX((e=>e in o.queries.runtime.locallyLiftedQueries))))),lookalikeTransitionSegmentNumbers:(0,r.zG)(o.queries.runtime.queriesByEvent["!UpdateLookalikeModels"]||p.cS,p.UI(parseInt),(e=>new Set(e))),pageviewProperties:{},numEventsForReplay:n.length,queries:o.queries,queriesForReplay:i,persistentState:u,tpdEventsToProcess:p.cS,tpdHashInEffectsObject:s.YP,tpdQueries:s.YP,tpdReady:!1}})))),e.trace.traceTask("query_language_initialisation_duration"),gt.UI((0,m.bw)((t=>{var n;e.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"query_language_ready",time_origin:"sdk_init"},performance.now()),e.metrics.trackCounter({name:"sdk_queries_to_replay_count",value:(n=t,0===n.numEventsForReplay?0:n.queriesForReplay.length),labels:{}})}))),gt.UI((t=>{let n=t;return t=>{const[i,o]=(0,r.zG)(t,Dn(e.trace))(n);return n=o,[i,o.persistentState]}})));var o})),o.fF),v=(0,r.zG)(h,o.UI(s.UI((e=>e.process)))),y=(0,r.zG)(h,o.UI(s.EQ((()=>!1),(e=>e.stateMigratedThisInitialisation))));let _=p.bM();const b=(0,r.zG)(o.vP({processInput:v,inputIO:(0,r.zG)(f,o.UI(s.G))}),o.UI((0,Ue.Yt)(s.G5)),o.UI(s.UI((e=>{let{processInput:t,inputIO:n}=e;const i=n(),[o,a]=(0,r.zG)(i,(0,m.rO)({newEvents:p.UI(u.Yg),cloudLiftedState:p.UI((e=>e.state))}),(e=>t({...e}))),c=(0,r.zG)(o,s.EQ((()=>({errors:[],events:i.newEvents,internalStateDiff:s.YP})),(e=>{let[t,n,r]=e;return{errors:t,events:i.newEvents.concat(r.map((e=>[(0,m.k$)(),e]))),internalStateDiff:s.G(n)}})));return _=(0,r.zG)(_,p.R3(c)),{consumeDeltas:()=>{const e=_;return _=p.cS,e},modelState:a}})))),I=(0,r.zG)(b,o.UI(s.UI((e=>e.modelState)))),S=(0,r.zG)(b,o.UI(s.UI((e=>e.consumeDeltas))),o.UI(s.fS((()=>d.of(p.bM()))))),w=(0,r.zG)(o.vP(I,a),o.Rp(((e,t)=>{let[n,i]=t;const o=(0,r.zG)(e,s.UI((e=>{let[,t]=e;return(0,r.zG)(n,s.EQ((()=>t),(e=>(0,r.zG)(t,p.hX((t=>!t(e,i.pendingEvents)))))))})),s.fS((()=>p.bM())));if(s.pC(n)&&p.xb(i.pendingEvents))return[ar(n.value),o];const u=(0,m.b2)(),a=(0,r.zG)(n,s.fS((()=>g)));var c;return[(0,r.zG)((()=>u.promise),(c=a,e=>[c,e])),(0,r.zG)(o,p.R3(((e,t)=>{const n=p.xb(t)||(0,r.zG)(i.pendingEvents,p.yW((e=>!t.includes(e))));return n&&u.resolve(e),n})))]})),o.UI(u.li)),G=(0,r.zG)(S,o.En(3,p.uZ()),(t=>{let[n,i,u]=t;return{errors:(0,r.zG)(n,o.UI(d.UI(p.tS((e=>e.errors))))),events:(0,r.zG)(i,o.UI(d.UI(p.tS((e=>e.events)))),(0,or.F)(e.metrics,"query_language_processed_pageview")),internalStateDiff:(0,r.zG)(u,o.UI(d.UI((0,r.ls)(p.DZ((e=>e.internalStateDiff)),s.DT(p.Od),s.UI((e=>e.reduce(((e,t)=>({...e,...t})))))))))}})),k=(0,r.zG)(w,gr((e=>e.internalStateMap))),z=yr(k);return{state:yr(w),value:{...G,stateMigratedThisInitialisation:y,internalStateMap:z,processing:(0,r.zG)(o.vP(b,a),o.UI((e=>{let[t,n]=e;return s.Wi(t)||p.Od(n.pendingEvents)}))),segments:(0,r.zG)(k,gr(wr)),tpdUsage:(0,r.zG)(o.vP(e.thirdPartyData,z),o.UI((e=>{let[t,n]=e;return(0,r.zG)(t,s.UI((()=>Hn(n))))})))}}})),wr=e=>(0,r.zG)(Bn(e),(e=>(0,r.zG)(e,p.uK((e=>e<1e7)),(t=>{let{left:n,right:r}=t;return{all:e,custom:r,standard:n}}))));n(856);const Gr=Ye.UI(br,B.dO),kr=(B.G5,e=>gr(B.F2)(e)),zr=e=>gr(B.fS(e)),Ur=e=>yr(e.all),Er=(e,t)=>n=>({all:(0,r.zG)(n,Gr(e)),byAdServer:(0,m.mQ)((0,r.ls)(t,s.UI((e=>(0,r.zG)(n,Gr(e))))))}),Pr=(e,t)=>(0,r.ls)(gr(B.F2),Er(e,t)),Or=e=>(0,r.zG)(e,gr(B.F2),Er(r.yR,(e=>s.G(e.filterCohorts)))),Cr=e=>({all:(0,r.zG)(e.all,zr((()=>p.bM()))),byAdServer:(0,m.mQ)((0,r.ls)(e.byAdServer,s.UI(zr((()=>p.bM())))))}),Tr=e=>(0,r.zG)(e,Cr,Ur);var Dr=n(548);const xr=e=>i.dQ((0,r.ls)((e=>{let{previousState:t}=e;return function(e){if(e&&"object"==typeof e)return{previousUnloadEvents:"previousUnloadEvents"in e?Ar(e.previousUnloadEvents):[]};return{previousUnloadEvents:[]}}(t)}),(t=>{let{previousUnloadEvents:n}=t;n.forEach((t=>e.eventsCache.add((0,Dr.k)(t),{persistOnDisk:!0})));return{value:{newEvents:(0,r.zG)(e.newEvents,o.UI(d.UI((0,m.bw)(p.UI((t=>{let[,n]=t;qr.has(n.name)||e.eventsCache.add(n,{persistOnDisk:!0})})))))),priorEvents:()=>e.eventsCache.all()},state:(0,r.zG)(e.eventsToProcessOnPageUnload,o.UI(p.hX((e=>{let[,t]=e;return!qr.has(t.name)}))),o.UI(p.UI((0,r.ls)(u.Yg,Dr.X))),o.UI((e=>({previousUnloadEvents:e}))))}})));function Ar(e){return e&&Array.isArray(e)?e:[]}const qr=new Set(["AdRequest","PageviewEngagement","PrebidAuctions","Reaction","SegmentEntry","SegmentExit","SlotRendered","ThirdPartySegments","VideoEngagement"]),Mr=function(){return(0,r.bc)(...arguments)},Rr=e=>(0,r.zG)(i.K4((t=>{let{stopped:n}=t;const[i,u]=o.Ue(o.a9(d.of(s.YP)));let a;const c=new Promise((e=>{a=e}));return{priorEvents:()=>c.then((e=>e())),externalStateDelta:o.xH(i),newEvents:(0,r.zG)(o.vP(e.newEvents,n),o.UI((e=>{let[t,n]=e;return n?()=>[]:t}))),setCachedPriorEvents:a,setExternalStateDelta:u}})),i.ak("segmentationService",(t=>{let{newEvents:n,priorEvents:r,externalStateDelta:i}=t;return Sr({...e,externalStateDelta:i,newEvents:n,priorEvents:r})})),i.UI((t=>(0,r.zG)(t.segmentationService.events,o.En(4,p.uZ()),(n=>{let[i,a,c,l]=n;return{...t,newEvents:i,realtime:(0,r.zG)(a,o.Rp(!1,((e,t)=>{const n=t();return e||n.some((e=>{let[,t]=e;return"Pageview"===t.name}))})),(e=>o.vP(e,t.segmentationService.processing)),o.UI((e=>{let[t,n]=e;return t&&!n})),o.u4(((e,t)=>e||t))),currentPageviewSegments:(f={processedEvents:(0,r.zG)(c,o.UI(d.UI(p.UI(u.Yg)))),segments:t.segmentationService.segments,viewId:e.viewId},(0,r.zG)(o.vP(f.processedEvents,f.viewId,f.segments),o.Rp({pageviewProcessed:!1,resolvePageviewSegments:e=>{},segments:ar({all:[],custom:[],standard:[]}),viewId:""},((e,t)=>{let[n,i,o]=t;const u=n();return(0,r.zG)(e,s.DT((e=>e.viewId===i)),s.EQ((()=>{if((0,r.zG)(u,p.G((e=>"Pageview"===e.name&&e.view_id===i))))return{pageviewProcessed:!0,resolvePageviewSegments:()=>{},segments:o,viewId:i};{const e=(0,m.b2)();return{pageviewProcessed:!1,resolvePageviewSegments:t=>e.resolve(lr(t)()),segments:Mr(cr(o),(()=>e.promise)),viewId:i}}}),(e=>e.pageviewProcessed?{...e,segments:o}:(0,r.zG)(u,p.G((e=>"Pageview"===e.name&&e.view_id===i)))?(e.resolvePageviewSegments(o),{pageviewProcessed:!0,resolvePageviewSegments:()=>{},segments:o,viewId:i}):{...e,segments:o})))})),o.UI((e=>e.segments)))),lastProcessedEvents:(0,r.zG)(l,o.UI(d.UI(p.UI(u.Yg))))};var f})))),i.Hr("cohorts",(t=>{let{segmentationService:n}=t;return(0,r.zG)(o.fF(e.nonQlCohorts),o.UI(s.UI((e=>(0,r.zG)(n.segments,gr((e=>e.all)),gr(p.UI(String)),Or,(t=>({query_language:t,...e})))))))})),i.ak("stateSync",(t=>{let{segmentationService:n,lastProcessedEvents:r}=t;return jt({eventSourceId:e.eventSourceId,groupId:e.groupId,groupIdIsNewlyGenerated:e.groupIdIsNewlyGenerated,internalStateDiff:n.internalStateDiff,internalStateMap:n.internalStateMap,lastProcessedEvents:r,logger:e.logger,permutiveApi:e.permutiveApi,permutiveUrls:e.permutiveUrls,queryLanguageProcessing:n.processing,reportError:e.reportError,sessionId:e.sessionId,viewId:e.viewId})})),i.bw((e=>{let{stateSync:t,setExternalStateDelta:n}=e;return n(t.externalStateDelta)})),i.ak("segmentTransitions",(t=>{let{segmentationService:n}=t;return(e=>(0,r.zG)(i.vP({currentSegmentsSet:i.K4((()=>(0,r.zG)(e.segments,o.UI(c))))}),i.ak("transitionsSinceInit",(e=>{let{currentSegmentsSet:t}=e;return i.of(a(t))})),i.UI((e=>{let{currentSegmentsSet:t,...n}=e;return n}))))({segments:(0,r.zG)(yr(n.segments),o.UI((e=>e.all))),viewId:e.viewId})})),i.Hr("cohortsRef",(e=>{let{cohorts:t}=e;return(0,r.zG)(t,o.VS(s.EQ((()=>o.a9(p.bM())),(0,r.ls)((e=>Object.values(e)),p.UI((0,r.ls)(Cr,(e=>e.all),yr,o.D8(p.Eh(h.Eq)))),p.vP(o.g1),o.UI(p.xH)))))})),i.Hr("createTrackRequest",(t=>{let{cohortsRef:n,segmentationService:i}=t;return(0,r.zG)(o.vP({cohorts:(0,r.zG)(n,o.UI(s.G)),qlSegments:(0,r.zG)(yr(i.segments),o.UI(s.G)),webClient:e.webClient}),o.UI((0,Ue.Yt)(s.G5)),o.UI(s.UI((t=>{let{cohorts:n,qlSegments:r,webClient:i}=t;return t=>({...t,segments:r.all,user_id:e.groupId,cohorts:n,properties:{...t.properties,client:{...i,...t.properties.client??{}}}})}))))})),e.trackPageviewComplete?(0,r.ls)(i.ak("pageviewComplete",(t=>{let{newEvents:n}=t;return v({currentTimestampSecs:e.currentTimestampSecs,events:n,sessionId:e.sessionId,viewId:e.viewId})})),i.UI((e=>{let{pageviewComplete:t,...n}=e;return{...n,eventsToCacheOnPageUnload:t.eventsToProcessOnPageUnload,eventsToPublishOnPageUnload:(0,r.zG)(o.vP(n.createTrackRequest,t.eventsToProcessOnPageUnload),o.UI((e=>{let[t,n]=e;return(0,r.zG)(t,s.EQ((()=>p.cS),(e=>(0,r.zG)(n,p.UI((0,u.H5)(e))))))}))),newEvents:t.eventsToProcessImmediately}}))):i.UI((e=>({...e,eventsToCacheOnPageUnload:o.a9(p.cS),eventsToPublishOnPageUnload:o.a9(p.cS)}))),i.ak("eventCache",(t=>{let{eventsToCacheOnPageUnload:n,newEvents:o,setCachedPriorEvents:s}=t;return(0,r.zG)(e.eventsCache,B.EQ((e=>(s(e),i.of({newEvents:o}))),(e=>(0,r.zG)(xr({eventsCache:e,eventsToProcessOnPageUnload:n,newEvents:o}),i.UI((e=>{let{newEvents:t,priorEvents:n}=e;return s(n),{newEvents:t}}))))))})),i.UI((e=>({...e,newEvents:e.eventCache.newEvents}))),i.Hr("eventsToPublish",(t=>{let{cohorts:n,newEvents:i,segmentationService:a}=t;return(0,r.zG)(o.vP(i,e.webClient,a.segments,(0,r.zG)(n,o.UI(s.UI((0,r.ls)((e=>Object.values(e)),p.UI(Cr),p.UI((e=>e.all))))))),o.UI((t=>{let[n,i,o,a]=t;return(0,r.zG)(s.Do,s.Qt("webClient",i),s.Qt("cohorts",a),s.ak("events",(()=>(0,r.zG)(n(),s.DT(p.Od)))),vt,At("segments",(()=>(0,r.zG)(lr(o),_t))),xt((e=>(0,r.zG)(e.cohorts,gt.uU(vr(1e3)),gt.UI(p.xH),gt.UI((t=>({...e,cohorts:t})))))),wt((t=>{let{cohorts:n,events:i,segments:o,webClient:s}=t;return(0,r.zG)(i,p.UI((0,u.H5)((t=>({...t,segments:o.all,user_id:e.groupId,cohorts:n,properties:{...t.properties,client:{...s,...t.properties.client??{}}}})))))})),gt.UI(s.fS((()=>p.bM()))))})),(e=>{const[t,n]=o.gS(p.uZ());return(0,r.zG)(e,o.UI((e=>e().then(n)))),t}))})));var Fr=n(963);function jr(e){return t=>(0,r.zG)(o.oQ(e),o.UI((0,m.rO)({backoffAfterErrorMs:e=>e??0,backoffAfterSuccessMs:e=>e??0})),(e=>i.dQ((n=>{let{previousState:i}=n;const[u,a]=o.Ue(function(e){if("object"!=typeof e||null===e)return{lastSuccess:0,lastError:0};return e}(i)),c=(0,r.zG)(o.vP(u,e),o.UI((e=>{let[t,n]=e;return Math.max(t.lastError+n.backoffAfterErrorMs,t.lastSuccess+n.backoffAfterSuccessMs)})));return{state:u,value:(0,r.ls)(s.DT((()=>Date.now()>=c.current)),s.UI(t),s.UI((0,m.bw)((e=>e.then((()=>a({...u.current,lastSuccess:Date.now()})),(()=>a({...u.current,lastError:Date.now()})))))))}}))))}const Lr=function(e,t){return i.of(s.YP)};var Yr=n(930);const $r=["pug"],Nr=function(e,t){return(0,r.zG)(Qr(e),jr({backoffAfterErrorMs:6e5}),i.VS((e=>Yr.m((0,r.zG)(t,o.UI((0,m.rO)({tpdUsage:s.UI((0,r.ls)(Re.UI(Re.z7((e=>!$r.includes(e)))),Re.hX((0,Fe.ff)(Re.xb))))})),o.UI((t=>{let{tpdUsage:n,userId:i}=t;return{validityKey:()=>i,freshnessKey:(0,r.ls)((()=>n),s.EQ((()=>0),(0,r.ls)(JSON.stringify,m.vp))),refresh:(0,r.zG)(n,s.hX((e=>Object.keys(e).length>0)),s.UI(je.it((t=>(0,r.zG)(e({user_id:i,time:new Date,tpd_segments:t}),s.fS((()=>Promise.reject("Blocked by backoff."))))),(e=>`Failed to report TPD usage. Got ${e}`))))}})))))),i.UI(r.Q1))};const Qr=e=>t=>{const{config:n,metrics:r,permutiveApi:i,permutiveUrls:o}=e,u=r.startTimer("sdk_http_tpd_usage_seconds",{});return i.req({url:o.getEndpointUrl("/tpd/usage",s.G(n.apiVersion)),method:"POST",payload:t,contentType:"text/plain",dataType:"json",withCredentials:!1}).then((e=>(r.stopTimer("sdk_http_tpd_usage_seconds",u),e)))};function Br(e,t){const n=["amp","gigya","pxid","sailthru"],u=(0,r.zG)(t.identities,o.UI(s.UI(Re.z7((e=>!n.includes(e)))))),a=e=>(0,m.vp)(JSON.stringify(e)),c=e=>[a(e),e];return(0,r.zG)(i.vP({fetchFromNewEndpoint:(0,r.zG)(Hr(e),jr({backoffAfterErrorMs:6e5})),fetchFromLegacyEndpoint:(0,r.zG)(Kr(e),jr({backoffAfterErrorMs:6e5}))}),i.VS((n=>{let{fetchFromNewEndpoint:a,fetchFromLegacyEndpoint:l}=n;return(0,r.zG)(Yr.m((0,r.zG)(o.vP(t.userId,t.sessionId,u),o.UI((t=>{let[n,i,o]=t;return{validityKey:()=>n,freshnessKey:()=>`${Vr(o)},${i}`,refresh:(0,r.zG)(o,s.UI((t=>Re.xb(t)?je.of({}):je.Y3((()=>(0,r.zG)((t=>(0,r.zG)(a(t),s.UI((e=>e.catch((()=>(0,r.zG)(l(t.identities),s.fS((()=>e))))))),s.wp((()=>l(t.identities))),s.UI((0,m.bw)((t=>{const n=e.metrics.startTimer("sdk_get_third_party_data_task_duration_seconds",{});t.catch(r.Q1).then((()=>{e.metrics.stopTimer("sdk_get_third_party_data_task_duration_seconds",n)}))})))))({userId:n,identities:t}),s.fS((()=>Promise.reject("Blocked by persistent backoff"))))),(e=>`Error fetching TPD. Got ${e}`)))),s.UI(je.UI(c)))}})))),Yr.d((e=>s.G((e=>Array.isArray(e)?e:c(e))(e)))),i.UI(o.UI(B.fS((t=>(e.logger.warn("[TPD]",`Failed to retrieve usable value, using zero value. ${t}`),s.G(c({}))))))),i.bw((0,r.ls)(o.UI(s.pC),o.UI((t=>{t&&e.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"audience_matching_ready",time_origin:"sdk_init"})})))))})))}const Hr=e=>async t=>{const n=e.metrics.startTimer("sdk_http_audience_matching_seconds",{}),i=await e.permutiveApi.req({url:e.permutiveUrls.getAudienceMatchingEndpointUrl("/id",s.G("v1"),t.userId),payload:{identities:(0,r.zG)(t.identities,Re.Yz,p.UI((e=>{let[t,n]=e;return{tag:t,id:n}})))},method:"POST",withCredentials:!1,dataType:"json"});return e.metrics.stopTimer("sdk_http_audience_matching_seconds",n),i.items},Kr=e=>async t=>{const n=e.metrics.startTimer("sdk_http_tpd_seconds",{}),r=await e.permutiveApi.req({url:e.permutiveUrls.getEndpointUrl("/tpd",s.G(e.config.apiVersion)),method:"POST",payload:{user_id:t},contentType:"text/plain",dataType:"json",withCredentials:!1});return e.metrics.stopTimer("sdk_http_tpd_seconds",n),r},Vr=(0,r.ls)(JSON.stringify,m.vp);const Wr=(e,t)=>(0,r.zG)(i.vP({data:Br(e,{identities:t.identities,sessionId:t.sessionId,userId:t.userId}),usageReporting:Nr(e,o.vP({tpdUsage:t.tpdUsage,userId:t.userId}))}),i.ak("analytics",(e=>{let{data:n}=e;return function(e){return i.dQ((t=>{let{previousState:n}=t;const[i,u]=o.gS(p.uZ());var a;return{state:(0,r.zG)(o.vP(e.userId,e.providerSegments,e.sessionId,e.viewId),o.D8(((e,t)=>{let[n,r]=e,[i,o]=t;return n===i&&r===o})),o.Rp(null!==(a=n)&&"object"==typeof a?a:{userId:"",providerHashes:{}},((e,t)=>{let[n,i,o,a]=t;const c=(0,r.zG)(i,s.fS((()=>({})))),l=(0,r.zG)(c,Re.UI((0,m.SL)(m.vp))),f=(0,r.zG)(e,s.DT((e=>e.userId===n)),s.UI((e=>e.providerHashes)),s.fS((()=>({}))));return(0,r.zG)(c,Re.z7((e=>l[e]!==(f[e]||0))),(e=>Object.entries(e)),p.UI((e=>{let[t,n]=e;return(0,r.bc)((0,m.k$)(),{name:"ThirdPartySegments",properties:{data_provider:t,segments:[...n]},session_id:o,time:new Date,view_id:a})})),u),{userId:n,providerHashes:l}}))),value:i}}))}({providerSegments:(0,r.zG)(n,o.UI(s.UI(ir.Yg))),sessionId:t.sessionId,userId:t.userId,viewId:t.viewId})})),i.UI((e=>{let{data:t,analytics:n}=e;return{data:t,analyticsEvents:n}}))),Xr=function(e){const t={include_geo:!0,include_isp:!0,include_ip_hash:!0,include_ip:!1},n=e.trace.startSpan("geoip_data_retrieval");return(0,r.zG)(Yr.m((0,r.zG)(e.sessionId,o.UI((n=>({validityKey:()=>(0,m.vp)(JSON.stringify(t)),freshnessKey:()=>n,refresh:s.G(je.Y3((()=>Jr(e.permutiveApi,e.metrics,e.config,t,e.permutiveUrls)),(e=>`Error fetching geoip. Got ${e}`)))}))))),i.UI(o.UI(B.fS((t=>(e.logger.warn("[geoip]",`Failed to retrieve usable value, using zero value. ${t}`),s.G({})))))),i.bw((0,r.ls)(o.UI(s.pC),o.UI((t=>{t&&(e.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"geoip_data_ready",time_origin:"sdk_init"},performance.now()),n.finish())})))))};const Jr=(e,t,n,r,i)=>{const o=[];r.include_geo&&o.push(["include","geo"]),r.include_isp&&o.push(["include","isp"]),r.include_ip&&o.push(["include","ip"]),r.include_ip_hash&&o.push(["include","ip_hash"]);const u=t.startTimer("sdk_http_geoip_seconds",{});return e.req({url:i.getEndpointUrl("/geoip",s.G(n.apiVersion),o),method:"GET",contentType:"text/plain",dataType:"json",withCredentials:!1}).then((e=>(t.stopTimer("sdk_http_geoip_seconds",u),e)))},Zr=e=>t=>{const n=r=>{const i={...r};for(let o in r){const s=r[o];t.hasOwnProperty(s)?null!=e&&e.dropUnenriched&&void 0===t[s]?delete i[o]:i[o]=t[s]:null!==s&&"object"==typeof s&&s.constructor===Object&&(i[o]=n(s))}return i};return n};var ei=n(965);n(853);const ti=function(e,t,n,r){return i.of({cohorts:s.YP,externalData:{[ni]:o.a9(s.YP)}})};const ni="_pssps",ri=e=>{const t=(0,r.zG)((null==e?void 0:e.dfp)??[],p.UI(String),(e=>new Set(e)));return{id:"dfp",filterCohorts:p.hX((e=>t.has(e)))}};const ii=e=>{if(!e.metrics.isEnabled())return()=>{};const t=(0,r.zG)(e.adServers,p.UI((e=>(0,r.bc)(e.id,e))),Re.sq,Re.UI((t=>{const n=(0,r.zG)(e.cohorts,Re.DZ((e=>e.byAdServer(t))),(e=>o.vP(e)),o.UI(Re.UI((i=5e3,u="Timeout",e=>(0,r.zG)(e,fr(i),gt.UI(s.pF((()=>B.t$(u)))))))),o.UI((0,Ue.Yt)(gt.Hi)),o.UI(gt.UI((0,r.ls)(Re.oh,$e.Vn(Re.Su(((t,n)=>{e.logger.warn("[Targeting Metrics]",`[${t}]`,n)}))),$e.F2))),(e=>()=>e.current));var i,u;return(0,r.ls)(p.of,p.UI((e=>e.cohorts)),si,p.UI((e=>{let[t,n]=e;return{allCohorts:new Set(t),cohortCountByType:oi(t),requestCount:n}})),(i=>(0,r.zG)(n(),gt.UI(Re.Su(((t,n)=>(i,o)=>{(0,r.zG)(n,p.Hr("actualCohortCount",(e=>{let{cohortCountByType:t}=e;return(0,r.zG)(t,Re.P5(i))})),p.UI((n=>{const u={cohort_type:i,target:t},a=o.reduce(((e,t)=>n.allCohorts.has(t)?e+1:e),0),c=o.length-a;e.metrics.track({name:"sdk_ad_request_missed_cohorts",labels:u,value:n.requestCount*c}),e.metrics.track({name:"sdk_ad_request_successful_cohorts",labels:u,value:n.requestCount*a}),(0,r.zG)(n.actualCohortCount,s.UI((t=>{const r=t-a;e.metrics.track({name:"sdk_ad_request_superfluous_cohorts",labels:u,value:n.requestCount*r})})))})))})(t.id,i))))),(e=>e()))})));return e=>{if("AdRequest"===e.name)(n=e.properties).ad_server_id in t&&t[n.ad_server_id](n);var n}},oi=e=>({ql:(0,r.zG)(e,p.u4(0,((e,t)=>isNaN(parseInt(t))?e:e+1)))}),si=e=>(0,r.zG)(e,p.pO((e=>{const{init:t,rest:n}=(0,r.zG)(e,p.zT((t=>t===e[0])));return[t,n]})),p.UI((e=>[e[0],e.length]))),ui=e=>s.YP;const ai=g.n_({cohorts:p.Eh((0,m.Or)()),ctx:(0,m.Or)()}),ci=p.cS;Promise.resolve(B.F2(ci)),g.n_({userId:(0,m.Or)(),lastSuccess:{equals:(e,t)=>e&&t&&ai.equals(e,t)||e===t}});function li(e,t){return Object.keys(t).reduce(((n,r)=>void 0!==e[r]?{...n,[r]:t[r]+e[r]}:{...n,[r]:t[r]}),e)}function fi(e,t){return(0,r.zG)(gi(e),((e,t)=>n=>(0,r.zG)((e=>n(e)().then((e=>B.nM(e)?Promise.reject(e.left):e.right))),jr(e),i.UI((e=>n=>()=>(0,r.zG)(n,e,s.EQ((()=>Promise.resolve(B.t$(t))),(e=>e.then(B.F2,B.t$))))))))({backoffAfterErrorMs:6e5},"Advertiser segmentation request blocked by rate limiting."),i.VS((n=>i.dQ((i=>{let{previousState:u}=i;return e.logger.debug("[advertiser] previous state:",u),(0,r.zG)(t,o.Rp(o.a9(pi(e)(u)),mi(e)(n)),o.xH,o.bw((t=>e.logger.debug("[advertiser] updated state:",t))),(e=>({state:(0,r.zG)(e,o.UI((e=>{let{userId:t,lastSuccess:n}=e;return{userId:t,lastSuccess:s.FS(n)}})),o.D8(Gi)),value:(0,r.zG)(e,o.UI((e=>{let{eventual:t}=e;return t})))})))})))))}const di=e=>t=>(0,r.zG)(t,gr(function(e){return t=>(0,r.zG)(t.cohorts,Q.hX((n=>(0,r.zG)(n.groups,Q.yW((i=>(0,r.zG)(s.ij(t.groups[i]),B.Yo((()=>`cohort [${n.code}] is missing group [${i}]`)),B.Vn((t=>e.error(`[advertiser] ${t}`))),B.UI((e=>e>0)),B.fS((()=>!0)))))))),Q.UI((e=>{let{code:t}=e;return t})))}(e)),Pr((e=>e),(e=>"dfp"===e.id?s.G((e=>e)):s.YP)),s.G),pi=e=>t=>(0,r.zG)(t,s.DT(ki),s.fS((()=>zi())),(e=>B.Y3((()=>({userId:e.userId,inFlight:!1,lastSuccess:s.ij(e.lastSuccess),view:Si(),ctx:(0,r.zG)(s.ij(e.lastSuccess),s.UI((e=>{let[t]=e;return t}))),eventual:Ui()})),(e=>`failed to parse existing persistent state: ${e}`))),B.fS((t=>(e.logger.error("[advertiser]",t),Ii(""))))),mi=e=>t=>(n,i)=>(0,r.zG)(n,o.VS((0,r.ls)(s.DT((e=>{let{userId:t}=e;return t===i.userId})),s.fS((()=>Ii(i.userId))),(n=>{if(wi(n)===i.viewId)return e.logger.debug("[advertiser] view id is the same as previous, returning existing state",n),o.a9(n);if(n.inFlight)return e.logger.debug("[advertiser] in flight request",n),o.a9(n);{let u;e.logger.debug("[advertiser] fetching cohorts for view",n);const a=new Promise((e=>{u=e})),c=()=>a;return(0,r.zG)((0,Ue.gz)(gt.Hi)(i.customCohorts,i.standardCohorts),gt.tS((e=>{let[r,o]=e;return t([i.userId,s.FS(n.ctx),r,o])})),je.YO("response"),je.ak("cohorts",(t=>{let{response:n}=t;return(0,r.zG)(n.c,yi,(0,m.bw)(B.EQ((t=>{e.logger.error(`[advertiser] failed to decode data from response. ${t}`)}),(t=>{e.logger.debug("[advertiser] decoded data from response",t)}))),gt.of)})),je.Hr("view",(e=>{let{response:t,cohorts:n}=e;return(0,r.bc)(t.ctx,n)})),o.fF,o.UI((0,r.ls)(s.EQ((function(){return{...n,inFlight:!0,eventual:(0,r.bc)((0,r.zG)(n.lastSuccess,s.UI((e=>{let[t,n]=e;return n})),s.fS((()=>bi()))),c)}}),B.EQ((function(t){e.logger.error(`[advertiser] ${t}`);const o=(0,r.zG)(n.lastSuccess,s.UI((e=>{let[t,n]=e;return n})),s.fS((()=>bi())));return u(o),{userId:i.userId,lastSuccess:n.lastSuccess,ctx:n.ctx,view:(0,r.bc)(i.viewId,s.YP),inFlight:!1,eventual:[o,c]}}),(function(e){let{response:t,view:n}=e;const[,o]=n;return u(o),(0,r.zG)({userId:i.userId,lastSuccess:s.G(n),view:(0,r.bc)(i.viewId,s.G(o)),ctx:s.G(t.ctx),inFlight:!1,eventual:(0,r.bc)(o,c)})}))))))}})))),gi=e=>je.it((t=>e.permutiveApi.req({url:e.permutiveUrls.getAdvertiserEndpointUrl("/segment",s.G("v4")),method:"POST",payload:hi(t),contentType:"text/plain",dataType:"json",withCredentials:!1})),(e=>`Failed to fetch advertiser cohorts: ${e}`)),hi=e=>JSON.stringify(e),vi=e=>{const t=(0,r.zG)(e,Q.YM,B.Yo((()=>"Expected a value, found empty array")),B.tS((e=>"string"==typeof e?B.F2(e):B.t$("Expected a cohort code, found "+typeof e)))),n=(0,r.zG)(e,Q.Gb,s.fS((()=>[])),B.DT(Array.isArray,(()=>"Expected an array of groups [integer], found "+typeof e[1])));return(0,r.zG)(t,B.tS((e=>(0,r.zG)(n,B.UI((t=>({code:e,groups:t})))))))};function yi(e){const[t,n]=e;return(0,r.zG)(t,Q.fw(B.g1)(vi),B.UI((e=>({cohorts:e,groups:n}))))}const _i=g.n_({cohorts:Q.Eh(g.n_({code:h.Eq,groups:Q.Eh(Z.Eq)})),groups:Q.Eh(Z.Eq)}),bi=()=>({cohorts:[],groups:[]}),Ii=e=>({inFlight:!1,userId:e,lastSuccess:s.YP,view:Si(),ctx:s.YP,eventual:Ui()}),Si=()=>["",s.YP],wi=e=>e.view[0],Gi=g.n_({userId:(0,m.Or)(),lastSuccess:{equals:(e,t)=>e===t||!!e&&!!t&&g.bc(h.Eq,_i).equals(e,t)}}),ki=e=>"object"==typeof e&&null!==e&&"userId"in e&&"lastSuccess"in e&&(void 0===e.lastSuccess||Array.isArray(e.lastSuccess)&&2===e.lastSuccess.length&&"string"==typeof e.lastSuccess[0]&&null!==e.lastSuccess[1]&&"object"==typeof e.lastSuccess[1]),zi=()=>({userId:""}),Ui=()=>(0,r.bc)(bi(),(()=>Promise.resolve(bi()))),Ei=(e,t)=>(e.log("[advertiser] pass_cohorts_to_prebid: false"),{_pcrdbs:o.a9(s.YP),_pcrprs:o.a9(s.YP)}),Pi=function(e,t){return(0,r.zG)(t,i.KD([[e=>!e.consent,i.K4((()=>mr(bi())))],fi(e,t)]),i.UI((0,r.ls)(o.xH,(n=>(0,Ue.gz)(Ir)(n,pr((0,r.zG)(t,o.UI((e=>{let{events:t}=e;return t})),(t=>{return(n=e.logger,e=>t=>(0,r.zG)(t,o.UI((t=>(0,r.zG)(B.Y3((()=>{const i=t().filter((t=>{let[,n]=t;return"SlotViewable"===n.name&&(0,r.zG)(s.ij(n.properties.line_item_id),s.UI((e=>e.toString())),s.UI((t=>e.has(t))),s.fS((()=>!1)))})).map((e=>{let[t,n]=e;return n.properties.line_item_id.toString()}));return i.forEach((e=>t=>e.debug("[advertiser] impression event for deal_id:",t))(n)),(e=>e.reduce(((e,t)=>({...e,[t]:1})),{}))(i)}),(e=>`Caught error when processing deal id impressions on events. Got ${e}`)),B.fS((e=>(n.error("[advertiser]",e),{})))))),o.Rp({},li),o.D8(((e,t)=>Qt(t))),o.D8(cn(Z.Eq)),o.bw((e=>n.debug("[advertiser] impressions:",e)))))(new Set([]))(t);var n}))))),gr((e=>{let[t,n]=e;return function(e,t,n){const i=(0,r.zG)(t.groups,Q.Su(((i,o)=>{const u=(0,r.zG)((0,r.zG)(t.cohorts,Q.hX((e=>{let{groups:t}=e;return t.includes(i)})),Q.Lx(Z.Pc)((t=>(0,r.zG)(s.ij(e[t.code]),s.fS((()=>[])),Q.Lx(Z.Pc)((e=>(0,r.zG)(s.ij(n[e]),s.fS((()=>0))))))))));return Math.max(0,o-u)})));return{cohorts:t.cohorts,groups:i}}({},t,n)})),di(e.logger))),i.bw((t=>{(0,r.zG)(t,s.UI(Tr),s.fS((()=>o.a9([]))),(t=>(0,r.zG)(t,o.UI((t=>e.logger.debug("[advertiser] cohorts available for targeting:",t))))))})))};const Oi=(0,r.zG)(Pi,(e=>(t,n)=>(0,r.zG)(e(t,n),i.UI((e=>({cohorts:e,externalData:Ei(t.logger)}))))));const Ci=i.K4((()=>{}));const Ti=e=>t=>(0,r.zG)(e,Re.UI((e=>t.reduce(((t,n)=>t+Number(e.has(n))),0)))),Di=e=>t=>{const{consent:n,currentTimestampSecs:a,identities:c,sessionId:l,userId:f,viewId:v,pageviewState:y}=t;return(0,r.zG)(i.K4((()=>{let n;const r=new Promise((e=>{n=e})),[i,u]=o.Ue(o.a9(s.YP));return{...t,adServers:[ri(e.optimisedActivationsConfig.dfp)],nonQlCohortsT:()=>r,setNonQlCohorts:n,setTpdUsage:u,tpdUsage:o.xH(i)}})),i.ak("geoip",(()=>(e=>(0,r.zG)(e,Xr,i.YO("data"),i.Hr("replacementMap",(e=>{let{data:t}=e;return(0,r.zG)(t,o.UI(s.UI((e=>{var t;return{$ip_geo_info:e.geo_info,$ip_geo_info_continent:null===(t=e.geo_info)||void 0===t?void 0:t.continent,$ip_isp_info:e.isp_info,$ip_address:e.ip,$ip_address_hash:e.ip_hash}}))))})),i.Hr("permutiveContext",(e=>{let{data:t}=e;return(0,r.zG)(t,o.UI(s.EQ((()=>({})),(e=>{var t,n,r,i,o,s,u,a,c;return{isp:null===(t=e.isp_info)||void 0===t?void 0:t.isp,organization:null===(n=e.isp_info)||void 0===n?void 0:n.organization,autonomous_system_number:null===(r=e.isp_info)||void 0===r?void 0:r.autonomous_system_number,autonomous_system_organization:null===(i=e.isp_info)||void 0===i?void 0:i.autonomous_system_organization,continent:null===(o=e.geo_info)||void 0===o?void 0:o.continent,country:null===(s=e.geo_info)||void 0===s?void 0:s.country,city:null===(u=e.geo_info)||void 0===u?void 0:u.city,province:null===(a=e.geo_info)||void 0===a?void 0:a.province,postal_code:null===(c=e.geo_info)||void 0===c?void 0:c.postal_code}}))))}))))({...e,sessionId:l}))),i.Hr("watson",(t=>{let{webClient:n}=t;return(0,r.zG)(e.watson,s.fS((()=>(0,r.zG)(n,o.UI(s.UI((e=>e.url))),o.D8(s.Eh(h.Eq)),(t=>(0,ei.watson)({...e,pageUrl:t,watsonEnabled:(0,r.zG)(y,o.UI((e=>e.watsonEnabled)))}))))))})),i.ak("audienceMatching",(t=>{let{tpdUsage:n}=t;return Wr(e,{identities:c,sessionId:l,tpdUsage:n,userId:f,viewId:v})})),i.UI((e=>{let{audienceMatching:{analyticsEvents:t,...n},newEvents:i,...s}=e;return{...s,audienceMatching:n,newEvents:(0,r.zG)(o.vP(i,t),o.UI(d.RD),o.UI(d.UI(p.xH)))}})),i.UI((e=>{const[t,n,i]=o.Ue(s.bM()),[u,a]=(0,r.zG)(e.newEvents,o.En(2,p.uZ())),c=(0,r.zG)(o.vP(u,t),o.UI((e=>{let[t,n]=e;return(0,r.zG)(n,s.UI((e=>(0,r.zG)(t,d.UI(p.UI((0,m.bw)((t=>{let[,n]=t;return e(n)}))))))),s.fS((()=>d.of(p.bM()))))})));return{...e,newEvents:c,newEventsForAdvertiserSegmentation:a,collectTargetingSuccessMetrics:e=>{n(s.G(e)),i()}}})),i.ak("enrichedEvents",(t=>{let{enrichmentReplacementMap:n,geoip:a,newEvents:c,watson:l}=t;return(0,r.zG)(o.vP({misc:n,geoip:a.replacementMap,watson:l.replacementMap}),o.UI((0,Ue.Yt)(s.G5)),o.UI(s.UI((e=>{let{misc:t,geoip:n,watson:r}=e;return{...t,...n,...r}}))),(t=>i.K4((()=>((e,t,n,i)=>((0,r.zG)(t,o.UI(s.pC),o.YP((t=>{t&&e.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"event_enrichment_ready",time_origin:"sdk_init"})}))),(0,r.zG)(n,o.VS((()=>(0,r.zG)(o.vP((0,r.zG)(t,o.UI(s.UI(Zr({dropUnenriched:!0})))),i),o.UI((0,r.ls)((e=>{let[t,n]=e;return()=>(0,r.zG)(t,s.EQ((()=>[]),(e=>(0,r.zG)(n(),p.UI((0,u.H5)((0,m.rO)({properties:e})))))))})))))))))(e.metrics,t,f,c)))))})),i.UI((0,m.rO)({enrichedEvents:(0,or.F)(e.metrics,"pageview_enriched")})),i.ak("lookalikeModels",(()=>(0,r.zG)(e.lookalikeModels,s.EQ((()=>(0,Fr.lookalikeModelsService)({...e,consent:n,currentTimestampSecs:a})),i.of)))),i.ak("queryLanguage",(n=>{let{audienceMatching:s,nonQlCohortsT:u,enrichedEvents:a,lookalikeModels:c,setTpdUsage:l,userIdIsNewlyGenerated:d}=n;return(0,r.zG)((p={...e,...t,newEvents:a,thirdPartyData:s.data,groupId:f,groupIdIsNewlyGenerated:d,nonQlCohorts:u,lookalikeModels:c,migratedStateMaps:e.migratedStateMaps},(0,r.zG)(o.vP(p.eventSourceId,p.groupId,p.groupIdIsNewlyGenerated),o.D8((0,r.zG)(h.Eq,g.Uz((e=>{let[t]=e;return t})))),i.kR((e=>{let[t,n,o]=e;return(0,r.zG)(Rr({...p,eventSourceId:t,groupId:n,groupIdIsNewlyGenerated:o,migratedStateMaps:p.migratedStateMaps}),i.yi(t))})),i.UI((e=>({stateMigratedThisInitialisation:(0,r.zG)(e,o.VS((e=>e.segmentationService.stateMigratedThisInitialisation))),cohorts:(0,r.zG)(e,o.VS((e=>e.cohortsRef))),currentPageviewSegments:{all:(0,r.zG)(e,o.VS((e=>e.currentPageviewSegments)),gr((e=>e.all))),custom:(0,r.zG)(e,o.VS((e=>e.currentPageviewSegments)),gr((e=>e.custom))),standard:(0,r.zG)(e,o.VS((e=>e.currentPageviewSegments)),gr((e=>e.standard)))},eventsToPublish:(0,r.zG)(e,o.VS((e=>e.eventsToPublish))),eventsToPublishOnPageUnload:(0,r.zG)(e,o.VS((e=>e.eventsToPublishOnPageUnload))),realtime:(0,r.zG)(e,o.VS((e=>e.realtime)),o.Rp(!1,((e,t)=>e||t)),o.bw((e=>{e&&p.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"worker_realtime",time_origin:"sdk_init"},performance.now())}))),segments:{all:(0,r.zG)(e,o.VS((e=>yr(e.segmentationService.segments))),o.UI((e=>e.all))),custom:(0,r.zG)(e,o.VS((e=>yr(e.segmentationService.segments))),o.UI((e=>e.custom))),standard:(0,r.zG)(e,o.VS((e=>yr(e.segmentationService.segments))),o.UI((e=>e.standard)))},thirdPartyDataUsage:(0,r.zG)(e,o.VS((e=>e.segmentationService.tpdUsage))),transitionsSinceInit:(0,r.zG)(e,o.VS((e=>e.segmentTransitions.transitionsSinceInit)))}))))),i.bw((e=>{let{thirdPartyDataUsage:t}=e;return l(t)})));var p})),i.ak("classificationModels",(t=>{let{queryLanguage:r}=t;return Lr(e,o.vP({consent:n,currentTimestampSecs:a,queryLanguageCohorts:_r(r.currentPageviewSegments.all),realtime:r.realtime,userId:f}))})),i.ak("demandPartners",(n=>{let{queryLanguage:u}=n;return((e,t)=>(0,r.zG)(ti(e.permutiveApi,e.permutiveUrls,e.reportError,t),i.UI((e=>{let{cohorts:t,externalData:n}=e;return{ssp:t,externalData:n}}))))(e,{cohorts:kr(u.currentPageviewSegments.all),consent:t.consent,url:(0,r.zG)(t.webClient,o.UI(s.UI((e=>e.url))))})})),i.ak("advertiserSegmentation",(t=>{let{queryLanguage:r,newEventsForAdvertiserSegmentation:i}=t;return Oi(e,o.vP({consent:n,customCohorts:_r(r.currentPageviewSegments.custom),realtime:r.realtime,sessionId:l,standardCohorts:_r(r.currentPageviewSegments.standard),userId:f,viewId:v,events:i}))})),i.ak("ipIdentifier",(e=>{let{userId:t,geoip:n}=e;return(0,r.zG)(n.data,o.UI(s.tS(s.KQ((e=>e.ip))))),Ci})),i.ak("nonQlCohorts",(e=>{let{advertiserSegmentation:t,classificationModels:n,contextualCohorts:o,setNonQlCohorts:s,demandPartners:u,viewId:a}=e;return(0,r.zG)(i.of(Re.oA({advertiser:t.cohorts,classificationModel:n,contextual:ui({contextualCohorts:o,viewId:a}),ssp:u.ssp})),i.bw(s))})),i.Hr("qlCohorts",(e=>{let{queryLanguage:t}=e;return(0,r.zG)(t.segments.all,o.UI(p.UI(String)))})),i.bw((t=>{return t.collectTargetingSuccessMetrics(ii({adServers:t.adServers,cohorts:{...t.nonQlCohorts,query_language:(n=t.qlCohorts,(0,r.zG)(n,pr,Or))},logger:e.logger,metrics:e.metrics}));var n})),i.Hr("eventsToPublish",(t=>{let{qlCohorts:n,queryLanguage:i,nonQlCohorts:s}=t;const u=(e=>{if(!e.metrics.isEnabled())return e=>{};const t=(0,r.zG)(e.cohortsByType,Re.UI(o.Rp(new Set,((e,t)=>new Set([...e,...t])))),(e=>o.vP(e)));return n=>{"Pageview"===n.name&&(0,S.HJ)((()=>(0,r.zG)(n.cohorts,Ti(t.current),Re.Su(((t,n)=>e.metrics.track({name:"sdk_pageview_cohort_count",labels:{cohort_type:t},value:n}))))))}})({cohortsByType:(0,r.zG)(s,Re.UI(Tr),Re.dx("query_language",n)),metrics:e.metrics});return(0,r.zG)(i.eventsToPublish,o.UI(d.UI(p.UI((0,m.bw)((e=>{let[,t]=e;return u(t)}))))))})),i.UI((e=>{let{adServers:t,advertiserSegmentation:n,demandPartners:i,eventsToPublish:s,geoip:u,queryLanguage:a,nonQlCohorts:c,watson:l}=e;return{activations:(0,r.zG)(t,p.UI((e=>(0,r.zG)(Object.values(c),p.UI(Cr),p.DZ((t=>t.byAdServer(e))),p.UI(yr),p.UI(o.D8(p.Eh(h.Eq))),(e=>o.vP(...e)),o.UI(p.xH),(t=>(0,r.bc)(e.id,t))))),Re.sq),cohorts:{all:a.cohorts,ql:a.segments.all,qlCustom:a.segments.custom,qlStandard:a.segments.standard},context:(0,r.zG)(o.vP(l.permutiveContext,u.permutiveContext),o.UI((e=>{let[t,n]=e;return{...t,...n}}))),eventsToPublish:s,eventsToPublishOnPageUnload:a.eventsToPublishOnPageUnload,externalData:o.vP({...n.externalData,...i.externalData}),geoIP:u.data,realtime:a.realtime,stateMigratedThisInitialisation:a.stateMigratedThisInitialisation,transitionsSinceInit:a.transitionsSinceInit}})))}},652:(e,t,n)=>{n.d(t,{BJ:()=>f,El:()=>O,G6:()=>b,HD:()=>l,HP:()=>G,Kn:()=>c,Or:()=>S,PQ:()=>I,SL:()=>p,aT:()=>h,b0:()=>y,b2:()=>m,bw:()=>U,k$:()=>v,lo:()=>E,mQ:()=>k,rO:()=>z,vg:()=>w,vp:()=>d});var r=n(500),i=n(735),o=n(567),s=n(17),u=n(751),a=n(992);const c=e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,l=e=>"string"==typeof e,f=e=>"number"==typeof e&&!Number.isNaN(e);function d(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}function p(e){return t=>{let n=0;for(let r of t){n=n+e(r)|0}return n}}s.ff(u.xb);function m(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),reject:t,resolve:e}}let g=[];function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:navigator.userAgent;if(g.unshift(e),g.length>1)return;const n=["beforeunload","pagehide"],r=n.concat(["visibilitychange"]),i=e=>{if(!o&&e){o=!0;const e=g;g=[],e.forEach((e=>{try{e()}catch{}}))}};let o=!1;r.forEach((e=>{window.addEventListener(e,(()=>{const n=("visibilitychange"!==e||document.hidden)&&_(t);i(n)}))})),n.forEach((e=>{window.addEventListener(e,(()=>i(!0)))}))}function v(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^(self.crypto||self.msCrypto).getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))}function y(e,t){const n=Object.keys(e),r=n.length,i={};for(let s=0;s<r;s++){const r=n[s],u=t(r,e[r]);(0,o.pC)(u)&&(i[r]=u.value)}return i}function _(e){return/Mobi|Android/i.test(e)}function b(e){return/^((?!chrome|android).)*safari/i.test(e)}function I(e,t){return new Promise((n=>{(0,a.HJ)((()=>{Promise.resolve(e()).then(n)}),(null==t?void 0:t.timeout)??0)}))}const S=()=>({equals:(e,t)=>Object.is(e,t)});function w(e){return t=>null!=t&&e in t?t[e]:void 0}function G(e){let t=o.YP;const n=(0,o.fS)((()=>{const n=e();return t=(0,o.G)(n),n}));return()=>n(t)}const k=e=>{const t=new Map;return n=>(t.has(n)||t.set(n,e(n)),t.get(n))},z=e=>t=>{const n={...t};for(const i in e){var r;n[i]=null===(r=e[i])||void 0===r?void 0:r.call(e,t[i])}return n};function U(e){return t=>(e(t),t)}const E=e=>t=>{const n=e.slice(0,-1),s=e.slice(-1)[0];return(0,i.zG)(n,r.f2((e=>{let[n,r]=e;return(0,i.zG)(t,o.DT(n),o.UI(r))})),o.fS((()=>s(t))))},P=e=>t=>{if("number"==typeof t)return t;if("string"==typeof t){const n=e(t);return Number.isNaN(n)?void 0:n}};P(parseInt),P(parseFloat);function O(e){return"object"==typeof e&&null!==e&&"_tag"in e&&["None","Some"].includes(e._tag)}},963:(e,t,n)=>{n.r(t),n.d(t,{lookalikeModelsService:()=>b,realService:()=>S,stubService:()=>I});var r=n(735),i=n(567);const o=(e,t,n,r)=>t+(n-t)*r/(Math.pow(2,e)-1),s=(e,t)=>{const n=(e,t)=>{const n=e.toString(16);return("0".repeat(t)+n).slice(Math.min(-t,-n.length))};return`${n(e.getUint32(t),8)}-${n(e.getUint16(t+4),4)}-${n(e.getUint16(t+6),4)}-${n(e.getUint16(t+8),4)}-${n(e.getUint32(t+10),8)}${n(e.getUint16(t+14),4)}`},u=e=>{const t=[1,2],n=e.getInt8(0);if(1===n)return a(e);if(2===n)return c(e);{const r=(0,i.Y3)((()=>s(e,1))),o=(0,i.g_)((()=>"Couldn\'t decode model id"),(e=>`Model id was ${e}`))(r);throw new Error(`Decoding only supported for version(s): ${t}; Supplied version was ${n}; ${o}`)}},a=e=>l(e,1),c=e=>l(e,2),l=(e,t)=>{const n=s(e,1),r=((e,t)=>{switch(String.fromCharCode(e.getInt8(t))){case"1":return"1p";case"3":return"3p"}})(e,17),i=e.getInt8(18),o=e.getFloat32(19),u=e.getFloat32(23),[a,c]=((e,t,n,r,i,o)=>{const s={};let u=0;do{let n;1===o?(u=e.getUint16(t),n=e.getUint16(t+2),t+=4):(u=e.getUint32(t),n=e.getUint16(t+4),t+=6),s[0===u?"const":u]=n.toString(36)}while(0!==u);return[s,t]})(e,27,0,0,0,t);return[{version:t,id:n,data_preference:r,weights:a,precision:i,min:o,max:u},c]};var f=n(767),d=n(151),p=n(992),m=n(116),g=n(851),h=n(365),v=n(930),y=n(652);const _=()=>i.G({}),b=I;function I(e){return m.K4((()=>g.a9(_())))}function S(e){e.logger.warn("add cleanup of legacy LAL cache");const t=e.trace.startSpan("lookalike_models_data_retrieval_duration");return(0,r.zG)(v.m((0,r.zG)(g.vP(e.consent,e.currentTimestampSecs),g.UI((t=>{let[n,s]=t;return{currentTimestampSecs:s,validity:{maxAge:604800,key:()=>null},freshness:{maxAge:86400,key:()=>null},refresh:(0,r.zG)(n,i.DT(Boolean),i.UI((()=>f.fF(function(e){const t="Failed fetching binary models, reverting to JSON.\\nError: ",n="Failed fetching json models.\\nError: ";return(0,r.zG)(f.Y3((()=>G(e)),(e=>e.message)),p.N1,f.oU((e=>()=>function(e){const t=[];let n=0;for(;n<e.byteLength;){const[r,i]=u(new DataView(e,n));t.push(r),n+=i}return t}(e))),p.N1,f.UI(w((e=>{let{precision:t,max:n,min:r}=e;return{"1p":{},precision:t,min:r,max:n}}))),f.Vn((n=>(e.logger.log(t+n),e.metrics.track({name:"sdk_binary_models_missing_count",value:1,labels:{}}),n))),f.wp((()=>(0,r.zG)(f.Y3((()=>k(e)),(e=>e.message)),f.UI((e=>e.models)),f.UI(w((()=>({"1p":{}}))))))),f.UI((e=>(e=>{const t=Object.keys(e);return t.length>0&&e[t[0]].hasOwnProperty("precision")})(e)?(e=>{const t={},n=Object.keys(e),r=e=>{const t={"1p":{}},{precision:n,min:r,max:i}=e,s=e["1p"],u=Object.keys(s);for(let e=0;e<u.length;e++){const a=u[e],c=parseInt(s[a],36);t["1p"][a]=o(n,r,i,c)}return t};for(let i=0;i<n.length;i++){const o=n[i],s=e[o];t[o]=r(s)}return t})(e):e)),f.fS((t=>(e.reportError(n+t),d.of({})))))}(e)))))}})))),m.UI(g.UI((0,r.ls)(h.fS((t=>(e.logger.warn("[LAL]",`Failed to refresh, using zero value. ${t}`),_()))),(0,y.bw)(i.UI((()=>{t.finish(),e.metrics.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"lookalike_models_ready",time_origin:"sdk_init"})})))))))}function w(e){return t=>{const n={};for(let r=0;r<t.length;r++){const i=t[r],{id:o,weights:s}=i;if(void 0===o||void 0===s)continue;const u=e(i);Object.keys(s).forEach((e=>{u["1p"][e]=s[e]})),n[o]=u}return n}}const G=e=>{const{permutiveApi:t,config:n,metrics:r}=e,i=r.startTimer("sdk_http_models_seconds",{});return t.req({url:z(n.cdnProtocol,n.cdnBaseUrl,"binary"),method:"GET",contentType:"text/plain",dataType:"binary",withCredentials:!1}).then((e=>(r.stopTimer("sdk_http_models_seconds",i),e)))},k=e=>{const{permutiveApi:t,config:n,metrics:r}=e,i=r.startTimer("sdk_http_models_seconds",{});return t.req({url:z(n.cdnProtocol,n.cdnBaseUrl,"json"),method:"GET",contentType:"text/plain",dataType:"json",withCredentials:!1}).then((e=>(r.stopTimer("sdk_http_models_seconds",i),e)))};function z(e,t,n){const r=`${e}://${t}`;switch(n){case"binary":return`${r}/models/v2/88980e3a-6890-4e52-bcc1-3154ab2a17c7-models.bin`;case"json":return`${r}/models/88980e3a-6890-4e52-bcc1-3154ab2a17c7-models.json`}}},869:(e,t,n)=>{n.d(t,{K:()=>E,O:()=>z});let r,i;const o=new WeakMap,s=new WeakMap,u=new WeakMap,a=new WeakMap,c=new WeakMap;let l={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return s.get(e);if("objectStoreNames"===t)return e.objectStoreNames||u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return p(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function f(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(m(this),t),p(o.get(this))}:function(...t){return p(e.apply(m(this),t))}:function(t,...n){const r=e.call(m(this),t,...n);return u.set(r,t.sort?t.sort():[t]),p(r)}}function d(e){return"function"==typeof e?f(e):(e instanceof IDBTransaction&&function(e){if(s.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)}));s.set(e,t)}(e),t=e,(r||(r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,l):e);var t}function p(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(p(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}));return t.then((t=>{t instanceof IDBCursor&&o.set(t,e)})).catch((()=>{})),c.set(t,e),t}(e);if(a.has(e))return a.get(e);const t=d(e);return t!==e&&(a.set(e,t),c.set(t,e)),t}const m=e=>c.get(e);const g=["get","getKey","getAll","getAllKeys","count"],h=["put","add","delete","clear"],v=new Map;function y(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(v.get(t))return v.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=h.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!g.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return v.set(t,o),o}l=(e=>({...e,get:(t,n,r)=>y(t,n)||e.get(t,n,r),has:(t,n)=>!!y(t,n)||e.has(t,n)}))(l);var _=n(688),b=n(365),I=n(735),S=n(151),w=n(767),G=n(652),k=n(992);const z="[IDB]",U=(e,t,n,r,i,o)=>(0,I.zG)((0,S.of)(e.getNamespacedStorageKey(i)),(0,S.tS)((e=>(0,w.Y3)((async()=>n.put(r,o,e)),_.w))),(0,S.UI)((0,b.g_)((e=>{throw t.error(z,`Failed to store crypto key to ${r} due to unexpected error,\\n`,e),e}),(()=>o))),(e=>e()));class E{namespace;logger;cryptoAlg;idb;mainObjectStore;keyObjectStore;keyObjectKey;cryptoKey;MAX_CONSECUTIVE_PUTS=30;puts=1;hasForcedCompaction=!1;constructor(e,t,n,r,i,o,s,u){this.namespace=e,this.logger=t,this.cryptoAlg=n,this.idb=r,this.mainObjectStore=i,this.keyObjectStore=o,this.keyObjectKey=s,this.cryptoKey=u,this.logDebug("Created",this.idb)}static initialise(e,t,n,r,i,o,s,u,a,c){const l=(0,G.G6)(navigator.userAgent)&&!1,f=[c,r.isAvailable(),!l].every((e=>!0===e)),d=async(t,i,o)=>(0,I.zG)(await t.get(o,e.getNamespacedStorageKey(i)),(async e=>e??r.generateKey(!1)),(async r=>U(e,n,t,s,u,await r))).catch((e=>{const t=(0,_.w)(e);throw n.error(z,"Get crypto key failed. Got\\n",t),t})),p=(e,t,n)=>t.includes(n)?(0,I.Q1)():e.createObjectStore(n),m=()=>P(i,a,{upgrade:e=>{const t=[...e.objectStoreNames];p(e,t,o),p(e,t,s)}}).then((e=>{const t=[...e.objectStoreNames];return t.includes(o)&&t.includes(s)?e:Promise.reject(new Error("Object store(s) missing."))})),g=f?(0,b.Y3)((()=>function(e){if(!(0,G.G6)(navigator.userAgent)||!indexedDB.databases)return Promise.resolve();let t=()=>{},n=0;return new Promise((e=>{const r=()=>(n++,indexedDB.databases().finally((0,k.GL)(e)));t=(0,k.UM)(r,100),r()})).finally((()=>{t(),e.track({name:"sdk_idb_conn_attempt_safari_count",value:n,labels:{}})}))}(t).then((()=>m())).catch((e=>(n.error(`Re-creating IDB database ${i} due to error`,e),O(i).then((()=>m())))))),String):(0,b.t$)("Connection not attempted. Default to localStorage");return(0,b.g_)((e=>(0,w.t$)(e)),(t=>(0,I.zG)((0,w.Y3)((()=>t.then((async e=>({db:e,cryptoKey:await d(e,u,s)})))),String),(0,w.UI)((t=>{let{db:i,cryptoKey:a}=t;return new E(e,n,r,i,o,s,u,a)})))))(g)}async put(e,t){return(0,I.zG)((async()=>(0,I.bc)(JSON.stringify(e),this.cryptoKey)),(0,S.tS)((e=>{let[t,n]=e;return(0,S.of)(this.cryptoAlg.encrypt(n,t))})),(0,S.tS)((e=>async()=>(await this.recreateIfNecessary(this.puts++),e))),(0,S.tS)((e=>(0,w.Y3)((()=>this.idb.put(this.mainObjectStore,e,this.namespace.getNamespacedStorageKey(String(t)))),_.w))),(0,S.UI)((0,b.g_)((n=>{throw this.logError(`Failed to put "${t.toString()}" value`,e,". Got \\n",n),"QuotaExceededError"===n.name&&this.forceCompaction(),n}),(()=>t))),(e=>e()))}get(e){return(0,I.zG)(this.namespace.getNamespacedStorageKey(String(e)),(t=>this.idb.get(this.mainObjectStore,t).then((async e=>e?JSON.parse(await this.cryptoAlg.decrypt(this.cryptoKey,e)):null)).catch((t=>{const n=(0,_.w)(t);throw this.logError(`Get ${e.toString()} failed. Got`,n),n}))))}delete(e){return(0,I.zG)(this.namespace.getNamespacedStorageKey(String(e)),(e=>this.idb.delete(this.mainObjectStore,e)))}deleteStore(){return this.logDebug("Deleting",this.idb),this.idb.close(),O(this.idb.name)}forceCompaction(){if(this.hasForcedCompaction)return null;this.hasForcedCompaction=!0,this.logDebug("Attempting to force compaction");const e=`__${this.mainObjectStore}`;return P(e).then((t=>(t.close(),O(e))))}recreateIfNecessary(e){return(0,G.G6)(navigator.userAgent)&&e%this.MAX_CONSECUTIVE_PUTS==0?this.recreate():Promise.resolve()}async recreate(){const e=this.idb.name,t=this.idb.version,n=await this.idb.getAllKeys(this.mainObjectStore),r=[];for(const e of n)r.push([e,await this.idb.get(this.mainObjectStore,e)]);await this.deleteStore(),this.idb=await P(e,t,{upgrade:e=>{e.createObjectStore(this.mainObjectStore),e.createObjectStore(this.keyObjectStore)}}),await Promise.all(r.map((e=>{let[t,n]=e;return this.idb.put(this.mainObjectStore,n,t)}))),await U(this.namespace,this.logger,this.idb,this.keyObjectStore,this.keyObjectKey,this.cryptoKey),this.logDebug("Reset to",this.idb)}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(z,...t)}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(z,...t)}}const P=(0,I.ls)((function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),u=p(s);return r&&s.addEventListener("upgradeneeded",(e=>{r(p(s.result),e.oldVersion,e.newVersion,p(s.transaction))})),n&&s.addEventListener("blocked",(()=>n())),u.then((e=>{o&&e.addEventListener("close",(()=>o())),i&&e.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),u}),k.t_,(e=>e.then((e=>({close:e.close.bind(e),createObjectStore:(0,I.ls)(e.createObjectStore.bind(e),I.Q1),delete:(0,I.ls)(e.delete.bind(e),k.t_),get:(0,I.ls)(e.get.bind(e),k.t_),getAllKeys:(0,I.ls)(e.getAllKeys.bind(e),k.t_),get name(){return e.name},get objectStoreNames(){return e.objectStoreNames},put:(0,I.ls)(e.put.bind(e),k.t_),get version(){return e.version}}))))),O=(0,I.ls)((function(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),p(n).then((()=>{}))}),k.t_)},569:(e,t,n)=>{n.r(t),n.d(t,{make:()=>s});var r=n(735),i=n(869);const o=e=>{const{logger:t,consent:n,prefix:r}=e,i=(e,n)=>(t.debug(`${r} Failed to write ${String(n)} as consent is revoked`),Promise.resolve(n));return e=>class extends e{put=((e,t,n)=>function(){return(n()?t:e)(...arguments)})(super.put.bind(this),i,(()=>!n.current))}},s=(e,t,n,s,u,a,c,l,f,d,p)=>(0,r.zG)(i.K,o({logger:f,consent:d,prefix:i.O})).initialise(e,t,f,n,s,u,a,c,l,p)},965:(e,t,n)=>{n.r(t),n.d(t,{watson:()=>l});var r=n(851),i=n(735),o=n(567),s=n(365),u=n(328),a=n(751),c=n(706);const l=e=>(0,i.zG)(d(e),r.YO("data"),r.Hr("replacementMap",(e=>{let{data:t}=e;return(0,i.zG)(t,o.YO("data"),o.Hr("taxonomyLabels",(e=>{let{data:t}=e;return function(e){const t=e=>{const t=e.split("/").filter((e=>e));return t.map(((e,n)=>"/"+t.slice(0,n+1).join("/")))},n=u.xH(e.filter(Boolean).map((e=>t(e.label))));return u.jj(a.Eq)(n)}(t.taxonomy??[])})),o.UI((e=>{var t,n,r;let{data:o,taxonomyLabels:s}=e;return{$alchemy_concepts:o.concepts??[],$alchemy_document_emotion:(null===(t=o.emotion)||void 0===t||null===(n=t.document)||void 0===n?void 0:n.emotion)??null,$alchemy_document_sentiment:(null===(r=o.sentiment)||void 0===r?void 0:r.document)??null,$alchemy_entities:o.entities??[],$alchemy_entity_names:(0,i.zG)(o.entities??[],u.UI((e=>e.text))),$alchemy_keywords:o.keywords??[],$alchemy_taxonomy:o.taxonomy??[],$alchemy_taxonomy_labels:s,$taxonomy_labels:s}})))})),r.Hr("permutiveContext",(e=>{let{data:t}=e;return(0,i.zG)(t,o.EQ((()=>({})),(e=>({watson:e}))))})),(e=>({permutiveContext:(0,i.zG)(e,r.UI((e=>e.permutiveContext))),replacementMap:(0,i.zG)(e,r.UI((e=>e.replacementMap)))}))),f=()=>r.a9(o.G({})),d=e=>(0,i.zG)(r.vP(e.watsonEnabled,e.pageUrl),r.UI((0,i.ls)(o.DT(c.li),o.tS(c.Yg))),r.UI(o.UI((0,i.ls)(p(e.permutiveApi,e.metrics,e.config,e.permutiveUrls,e.trace),r.p4,r.UI(o.UI(s.fS((()=>({})))))))),r.VS(o.fS(f))),p=(e,t,n,r,i)=>s=>{const u=t.startTimer("sdk_http_watson_seconds",{}),a=i.startSpan("watson_data_retrieval");return e.req({url:r.getEndpointUrl("/watson",o.G(n.apiVersion)),method:"POST",contentType:"text/plain",dataType:"json",withCredentials:!1,payload:{url:s,classify:!0}}).then((e=>(t.stopTimer("sdk_http_watson_seconds",u),t.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"watson_data_ready",time_origin:"sdk_init"},performance.now()),a.finish(),e)))}},828:(e,t,n)=>{n.d(t,{N:()=>s,Qt:()=>u,Yt:()=>d,ap:()=>o,gz:()=>f});var r=n(735),i=n(384);function o(e,t){return function(n){return function(r){return e.ap(e.map(r,(function(e){return function(n){return t.ap(e,n)}})),n)}}}function s(e){return function(t){return function(n){return e.ap(e.map(n,(function(e){return function(){return e}})),t)}}}function u(e){return function(t,n){return function(r){return e.ap(e.map(r,(function(e){return function(n){var r;return Object.assign({},e,((r={})[t]=n,r))}})),n)}}}function a(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,0===t?e.apply(null,i):a(e,t-1,i)}}var c={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function l(e){return i.e$.call(c,e)||(c[e]=a(r.bc,e-1,[])),c[e]}function f(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=l(r),o=e.map(t[0],i),s=1;s<r;s++)o=e.ap(o,t[s]);return o}}function d(e){return function(t){for(var n=Object.keys(t),r=n.length,i=function(e){var t=e.length;switch(t){case 1:return function(t){var n;return(n={})[e[0]]=t,n};case 2:return function(t){return function(n){var r;return(r={})[e[0]]=t,r[e[1]]=n,r}};case 3:return function(t){return function(n){return function(r){var i;return(i={})[e[0]]=t,i[e[1]]=n,i[e[2]]=r,i}}};case 4:return function(t){return function(n){return function(r){return function(i){var o;return(o={})[e[0]]=t,o[e[1]]=n,o[e[2]]=r,o[e[3]]=i,o}}}};case 5:return function(t){return function(n){return function(r){return function(i){return function(o){var s;return(s={})[e[0]]=t,s[e[1]]=n,s[e[2]]=r,s[e[3]]=i,s[e[4]]=o,s}}}}};default:return a((function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i}),t-1,[])}}(n),o=e.map(t[n[0]],i),s=1;s<r;s++)o=e.ap(o,t[n[s]]);return o}}},500:(e,t,n)=>{n.d(t,{Ce:()=>c,DY:()=>w,Eh:()=>R,GY:()=>S,Gb:()=>m,KB:()=>f,Lx:()=>x,Qp:()=>_,Su:()=>P,UI:()=>U,YM:()=>p,f2:()=>b,fw:()=>q,hX:()=>D,ke:()=>g,md:()=>y,oA:()=>T,pR:()=>F,tS:()=>E,yL:()=>G,yW:()=>j,zT:()=>v});var r=n(735),i=(n(341),n(384)),o=n(885),s=n(328),u=(n(870),n(605),function(e){return 0===e.length}),a=o.Od,c=o.Ce,l=(o.ws,o.R3),f=(o.Im,function(e,t){return e<=0?[]:o.KB(t)(e)});var d=o.dC,p=(s.P5,s.YM),m=(s.Z$,function(e){return a(e)?i.G(o.Gb(e)):i.YP}),g=function(e){return function(t){return d(e,t)?I(t):t.slice(0,e)}};var h=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function v(e){return function(t){var n=k(h(t,e))(t);return{init:n[0],rest:n[1]}}}var y=function(e){return function(t){return e<=0||u(t)?I(t):e>=t.length?[]:t.slice(e,t.length)}};function _(e){return function(t){return t.slice(h(t,e))}}s.cx;var b=s.f2;s.JO,s.qr;var I=function(e){return e.slice()},S=function(e){return u(e)?[]:e.slice().reverse()},w=function(e){return function(t){return t.length<=1?I(t):t.slice().sort(e.compare)}},G=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};s.t9;var k=function(e){return function(t){return e>=1&&a(t)?o.lx(e)(t):u(t)?[I(t),[]]:[[],I(t)]}};s.kp,s.Eq;var z=o.of,U=function(e){return function(t){return t.map((function(t){return e(t)}))}},E=function(e){return function(t){return(0,r.zG)(t,function(e){return function(t){for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}}((function(t,n){return e(n)})))}},P=function(e){return function(t){return t.map((function(t,n){return e(n,t)}))}},O=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var o=e(r,t[r]);i.pC(o)&&n.push(o.value)}return n}},C=function(e){return O((function(t,n){return e(n)}))},T=C(r.yR),D=function(e){return function(t){return t.filter(e)}},x=s.Lx,A=(s.xP,s.u4,s.OE),q=(s.nq,s.iw,function(e){var t=M(e);return function(e){return t((function(t,n){return e(n)}))}}),M=function(e){return function(t){return A(e.of([]),(function(n,i,o){return e.ap(e.map(i,(function(e){return function(t){return(0,r.zG)(e,l(t))}})),t(n,o))}))}},R=(s.ZN,s.Eh),F=s.pR,j=(s.pJ,s.oR,o.oo,s.yW);s.j0,i.F4,o.w6,o.QI,o.Ss},862:(e,t,n)=>{function r(e){return function(t){return function(n){return e.chain(n,(function(n){return e.map(t(n),(function(){return n}))}))}}}function i(e){return function(t,n){return function(r){return e.chain(r,(function(r){return e.map(n(r),(function(e){var n;return Object.assign({},r,((n={})[t]=e,n))}))}))}}}n.d(t,{a:()=>i,m:()=>r})},365:(e,t,n)=>{n.d(t,{g1:()=>b,G5:()=>_,dO:()=>h,Pd:()=>G,ak:()=>$,YO:()=>Y,tS:()=>S,g_:()=>D,ij:()=>M,Yo:()=>E,DT:()=>U,Eh:()=>m,fS:()=>A,pF:()=>x,nM:()=>P,t$:()=>a,UI:()=>g,Vn:()=>k,EQ:()=>T,of:()=>v,F2:()=>c,LF:()=>q,KC:()=>L,i$:()=>j,Y3:()=>R,it:()=>F});var r=n(862),i=n(690),o=n(735),s=n(341),u=n(384),a=u.t$,c=u.F2,l=function(e,t){return(0,o.zG)(e,g(t))},f=function(e,t){return(0,o.zG)(e,y(t))},d=function(e,t){return(0,o.zG)(e,S(t))},p="Either",m=function(e,t){return{equals:function(n,r){return n===r||(P(n)?P(r)&&e.equals(n.left,r.left):O(r)&&t.equals(n.right,r.right))}}},g=function(e){return function(t){return P(t)?t:c(e(t.right))}},h={URI:p,map:l},v=c,y=function(e){return function(t){return P(t)?t:P(e)?e:c(t.right(e.right))}},_={URI:p,map:l,ap:f},b={URI:p,map:l,ap:f,of:v},I=function(e){return function(t){return P(t)?t:e(t.right)}},S=I,w={URI:p,map:l,ap:f,chain:d},G=function(e,t){return function(n){return P(n)?a(e(n.left)):c(t(n.right))}},k=function(e){return function(t){return P(t)?a(e(t.left)):t}},z={URI:p,fromEither:o.yR},U=(0,i.DT)(z),E=(0,i.Yo)(z),P=u.nM,O=u.tO,C=function(e,t){return function(n){return P(n)?e(n.left):t(n.right)}},T=C,D=T,x=function(e){return function(t){return P(t)?e(t.left):t.right}},A=x,q=function(e){return P(e)?c(e.left):a(e.right)},M=function(e){return function(t){return null==t?a(e):c(t)}},R=function(e,t){try{return c(e())}catch(e){return a(t(e))}},F=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return R((function(){return e.apply(void 0,n)}),t)}},j=C(o.yR,o.yR);function L(e){return e instanceof Error?e:new Error(String(e))}u.F4;var Y=(0,s.YO)(h),$=(0,r.a)(w);u.Xl},856:(e,t,n)=>{n.d(t,{EQ:()=>b,F2:()=>u,KQ:()=>d,LF:()=>z,LU:()=>k,LV:()=>I,NG:()=>p,Pd:()=>y,UI:()=>m,Vn:()=>_,ap:()=>g,dQ:()=>G,fS:()=>S,i$:()=>U,ij:()=>f,m8:()=>c,pk:()=>l,t$:()=>a,tS:()=>h,vx:()=>w,wp:()=>v});var r=n(828),i=n(365),o=n(735),s=n(341);function u(e){return(0,o.ls)(i.F2,e.of)}function a(e){return(0,o.ls)(i.t$,e.of)}function c(e){return function(t){return e.map(t,i.F2)}}function l(e){return function(t){return e.map(t,i.t$)}}function f(e){return function(t){return(0,o.ls)(i.ij(t),e.of)}}function d(e){var t=f(e);return function(e){var n=t(e);return function(e){return(0,o.ls)(e,n)}}}function p(e){var t=h(e),n=d(e);return function(e){var r=n(e);return function(e){return t(r(e))}}}function m(e){return(0,s.UI)(e,i.dO)}function g(e){return(0,r.ap)(e,i.G5)}function h(e){return function(t){return function(n){return e.chain(n,(function(n){return i.nM(n)?e.of(n):t(n.right)}))}}}function v(e){return function(t){return function(n){return e.chain(n,(function(n){return i.nM(n)?t():e.of(n)}))}}}function y(e){return function(t,n){return function(r){return e.map(r,i.Pd(t,n))}}}function _(e){return function(t){return function(n){return e.map(n,i.Vn(t))}}}function b(e){return function(t,n){return function(r){return e.map(r,i.EQ(t,n))}}}function I(e){return function(t,n){return function(r){return e.chain(r,i.EQ(t,n))}}}function S(e){return function(t){return function(n){return e.chain(n,i.EQ(t,e.of))}}}function w(e){return function(t){return function(n){return e.chain(n,(function(n){return i.nM(n)?t(n.left):e.of(n)}))}}}function G(e){var t=w(e);return function(n){return t((function(t){return e.map(n(t),(function(e){return i.nM(e)?e:i.t$(t)}))}))}}function k(e){return function(t){return function(n){return e.chain(n,i.EQ((function(n){return e.map(t(n),i.t$)}),(function(t){return e.of(i.F2(t))})))}}}function z(e){return function(t){return e.map(t,i.LF)}}function U(e){return function(t){return e.map(t,i.i$)}}},268:(e,t,n)=>{n.d(t,{MW:()=>a,Uz:()=>s,bc:()=>o,f7:()=>r,n_:()=>i,w4:()=>u});n(735);var r=function(e){return{equals:function(t,n){return t===n||e(t,n)}}},i=function(e){return r((function(t,n){for(var r in e)if(!e[r].equals(t[r],n[r]))return!1;return!0}))},o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r((function(t,n){return e.every((function(e,r){return e.equals(t[r],n[r])}))}))},s=function(e){return function(t){return r((function(n,r){return t.equals(e(n),e(r))}))}},u={equals:function(e,t){return e===t}},a=i;u.equals},690:(e,t,n)=>{n.d(t,{DT:()=>s,Yo:()=>o,fX:()=>a});var r=n(735),i=n(384);function o(e){return function(t){return function(n){return e.fromEither(i.Wi(n)?i.t$(t()):i.F2(n.value))}}}function s(e){return function(t,n){return function(r){return e.fromEither(t(r)?i.F2(r):i.t$(n(r)))}}}function u(e){return function(t){return(0,r.ls)(t,e.fromEither)}}function a(e,t){var n=u(e);return function(e){return function(r){return t.chain(r,n(e))}}}},130:(e,t,n)=>{n.d(t,{At:()=>s,oU:()=>o});var r=n(862),i=n(735);function o(e,t){return function(n){var r=(0,i.ls)(n,e.fromIO);return function(e){return t.chain(e,r)}}}function s(e,t){var n=(0,r.m)(t);return function(t){return n((0,i.ls)(t,e.fromIO))}}},679:(e,t,n)=>{n.d(t,{oU:()=>i});var r=n(735);function i(e,t){return function(n){var i=(0,r.ls)(n,e.fromTask);return function(e){return t.chain(e,i)}}}},341:(e,t,n)=>{function r(e,t){return function(n){return function(r){return e.map(r,(function(e){return t.map(e,n)}))}}}function i(e){return function(t){return function(n){return e.map(n,(function(e){return e(t)}))}}}function o(e){return function(t){return function(n){return e.map(n,(function(e){var n;return(n={})[t]=e,n}))}}}function s(e){return function(t,n){return function(r){return e.map(r,(function(e){var r;return Object.assign({},e,((r={})[t]=n(e),r))}))}}}n.d(t,{Hr:()=>s,OV:()=>i,UI:()=>r,YO:()=>o})},392:(e,t,n)=>{n.d(t,{G5:()=>p,PM:()=>d,RD:()=>_,UA:()=>g,UI:()=>a,dO:()=>f,of:()=>c,qo:()=>m});var r=n(735),i=(n(341),n(384)),o=function(e,t){return function(){return t(e())}},s=function(e,t){return function(){return e()(t())}},u=function(e,t){return function(){return t(e())()}},a=function(e){return function(t){return o(t,e)}},c=r.a9,l="IO",f={URI:l,map:o},d={URI:l,of:c},p={URI:l,map:o,ap:s},m={URI:l,map:o,ap:s,chain:u},g={URI:l,map:o,ap:s,of:c,chain:u},h=(r.yR,r.yR,i.F4,c(i.Xl)),v=function(e){var t=function(e){return function(t){return function(){for(var n=[e(0,i.YM(t))()],r=1;r<t.length;r++)n.push(e(r,t[r])());return n}}}(e);return function(e){return i.Od(e)?t(e):h}},y=function(e){return v((function(t,n){return e(n)}))},_=y(r.yR)},885:(e,t,n)=>{n.d(t,{Ce:()=>l,Eh:()=>S,Gb:()=>G,Im:()=>f,KB:()=>h,Od:()=>u,QI:()=>k,R3:()=>d,Ss:()=>z,dC:()=>a,lx:()=>I,nI:()=>g,of:()=>_,oo:()=>p,w6:()=>v,ws:()=>c,yL:()=>b});var r=n(735),i=(n(341),n(384)),o=n(241),s=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},u=function(e){return e.length>0},a=function(e,t){return e<0||e>=t.length},c=function(e){return function(t){return s([e],t,!0)}},l=c,f=function(e){return function(t){return s(s([],t,!0),[e],!1)}},d=f,p=function(e,t,n){if(u(n)){var r=m(n);return r.splice(e,0,t),r}return[t]},m=i.r1,g=function(e){return u(e)?i.G(e):i.YP},h=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},v=function(e,t){return e<=t?h((function(t){return e+t}))(t-e+1):[e]};var y=m,_=function(e){return[e]},b=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};o.xP,o.Lx;var I=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[y(t),[]]:[(0,r.zG)(t.slice(1,n),l(w(t))),t.slice(n)]}},S=(o.u4,o.OE,o.nq,o.iw,o.YM,o.ZN,o.Eh),w=(i.F4,o.YM),G=function(e){return e.slice(1)};o.Z$,o.VV,o.Fp,o.j0;function k(e,t){return void 0===t?l(e):(0,r.zG)(t,l(e))}var z=function(e,t){return(0,r.zG)(e,d(t))};o.ur},567:(e,t,n)=>{n.d(t,{DT:()=>p,Do:()=>ae,EK:()=>g,EQ:()=>Z,Eh:()=>G,FS:()=>ue,G:()=>d,G5:()=>T,Hr:()=>le,IS:()=>m,KQ:()=>oe,Qt:()=>de,Ri:()=>Y,UI:()=>U,Uo:()=>V,WG:()=>se,Wi:()=>X,Y3:()=>ie,YO:()=>ce,YP:()=>f,aD:()=>J,ak:()=>fe,bM:()=>q,dO:()=>E,fS:()=>ne,fw:()=>K,g_:()=>ee,hX:()=>$,ij:()=>re,lo:()=>R,pC:()=>W,pF:()=>te,pR:()=>k,tS:()=>D,uZ:()=>z,wp:()=>A,xu:()=>H});var r=n(828),i=n(862),o=n(735),s=n(341),u=n(384),a=n(17),c=n(870),l=(n(605),n(560)),f=u.YP,d=u.G;function p(e){return function(t){return e(t)?d(t):f}}var m=function(e){return"Right"===e._tag?f:d(e.left)},g=function(e){return"Left"===e._tag?f:d(e.right)},h=function(e,t){return(0,o.zG)(e,U(t))},v=function(e,t){return(0,o.zG)(e,C(t))},y=function(e,t){return(0,o.zG)(e,D(t))},_=function(e,t){return(0,o.zG)(e,$(t))},b=function(e,t){return(0,o.zG)(e,N(t))},I=function(e,t){return(0,o.zG)(e,Q(t))},S=function(e,t){return(0,o.zG)(e,B(t))},w="Option",G=function(e){return{equals:function(t,n){return t===n||(X(t)?X(n):!X(n)&&e.equals(t.value,n.value))}}},k=function(e){return{equals:G(e).equals,compare:function(t,n){return t===n?0:W(t)?W(n)?e.compare(t.value,n.value):1:-1}}},z=function(e){return{concat:function(t,n){return X(t)?n:X(n)?t:d(e.concat(t.value,n.value))},empty:f}},U=function(e){return function(t){return X(t)?f:d(e(t.value))}},E={URI:w,map:h},P=d,O={URI:w,of:P},C=function(e){return function(t){return X(t)||X(e)?f:d(t.value(e.value))}},T={URI:w,map:h,ap:v},D=function(e){return function(t){return X(t)?f:e(t.value)}},x={URI:w,map:h,ap:v,chain:y},A=function(e){return function(t){return X(t)?e():t}},q=function(){return f},M={URI:w,zero:q},R=(0,l.l)(M,O),F=D(o.yR),j=(0,c.s4)(f,f),L=function(e){return X(e)?j:(0,c.s4)(m(e.value),g(e.value))},Y={URI:w,compact:F,separate:L},$=function(e){return function(t){return X(t)?f:e(t.value)?t:f}},N=function(e){return function(t){return X(t)?f:e(t.value)}},Q=function(e){return function(t){return(0,c.s4)(_(t,(0,a.ff)(e)),_(t,e))}},B=function(e){return(0,o.ls)(U(e),L)},H={URI:w,map:h,compact:F,separate:L,filter:_,filterMap:b,partition:I,partitionMap:S},K=function(e){return function(t){return function(n){return X(n)?e.of(f):e.map(t(n.value),d)}}},V=g,W=u.pC,X=function(e){return"None"===e._tag},J=function(e,t){return function(n){return X(n)?e():t(n.value)}},Z=J,ee=Z,te=function(e){return function(t){return X(t)?e():t.value}},ne=te,re=function(e){return null==e?f:d(e)},ie=function(e){try{return d(e())}catch(e){return f}},oe=function(e){return(0,o.ls)(e,re)},se=Z(o.gn,o.yR),ue=Z(o.r5,o.yR);var ae=P(u.F4),ce=(0,s.YO)(E),le=(0,s.Hr)(E),fe=(0,i.a)(x),de=(0,r.Qt)(T);u.Xl},209:(e,t,n)=>{n.d(t,{Fp:()=>d,Uz:()=>u,VV:()=>f,Zt:()=>s,gf:()=>l,gt:()=>c,lt:()=>a});var r=n(268),i=n(735),o=function(e){return function(t,n){return t===n||0===e(t,n)}},s=function(e){return{equals:o(e),compare:function(t,n){return t===n?0:e(t,n)}}},u=function(e){return function(t){return s((function(n,r){return t.compare(e(n),e(r))}))}},a=(i.W8,function(e){return function(t,n){return-1===e.compare(t,n)}}),c=function(e){return function(t,n){return 1===e.compare(t,n)}},l=function(e){return function(t,n){return-1!==e.compare(t,n)}},f=function(e){return function(t,n){return t===n||e.compare(t,n)<1?t:n}},d=function(e){return function(t,n){return t===n||e.compare(t,n)>-1?t:n}};r.w4.equals},17:(e,t,n)=>{n.d(t,{ff:()=>r,xD:()=>i});n(735);var r=function(e){return function(t){return!e(t)}},i=function(e){return function(t){return function(n){return t(n)&&e(n)}}}},328:(e,t,n)=>{n.d(t,{Ce:()=>g,DZ:()=>K,EQ:()=>y,Eh:()=>ae,Eq:()=>F,Ew:()=>z,G:()=>_e,Hr:()=>Ie,JO:()=>P,Lx:()=>ee,OE:()=>te,Od:()=>m,P5:()=>b,R3:()=>h,Su:()=>Q,UI:()=>N,YM:()=>I,Yo:()=>v,Z$:()=>S,ZN:()=>se,bM:()=>L,bj:()=>C,cS:()=>ve,cx:()=>k,dF:()=>E,f2:()=>U,hX:()=>B,iw:()=>re,j0:()=>be,jj:()=>D,kp:()=>R,lo:()=>pe,nI:()=>he,nq:()=>ne,oA:()=>V,oR:()=>ge,of:()=>j,pJ:()=>me,pO:()=>x,pR:()=>ce,qr:()=>O,t9:()=>T,tS:()=>Y,u4:()=>Z,uK:()=>W,uZ:()=>ue,vP:()=>ie,xH:()=>$,xP:()=>J,xb:()=>p,yW:()=>ye,zT:()=>G});var r=n(268),i=n(735),o=n(341),s=n(384),u=n(11),a=n(209),c=n(241),l=n(870),f=(n(605),n(560)),d=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},p=function(e){return 0===e.length},m=c.Od,g=c.Ce,h=(c.ws,c.R3);c.Im;var v=function(e){return s.Wi(e)?ve:[e.value]},y=function(e,t){return function(n){return m(n)?t(n):e()}},_=c.dC;function b(e,t){return void 0===t?function(t){return b(e,t)}:_(e,t)?s.YP:s.G(t[e])}var I=function(e){return m(e)?s.G(c.YM(e)):s.YP},S=function(e){return m(e)?s.G(c.Z$(e)):s.YP};var w=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function G(e){return function(t){var n=A(w(t,e))(t);return{init:n[0],rest:n[1]}}}var k=function(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return s.G(n);return s.YP}};function z(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return s.G(t[n]);return s.YP}}var U=function(e){return function(t){for(var n=0;n<t.length;n++){var r=e(t[n]);if(s.pC(r))return r}return s.YP}};function E(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return s.G(t[n]);return s.YP}}var P=function(e){return function(t){for(var n=t.length-1;n>=0;n--){var r=e(t[n]);if(s.pC(r))return r}return s.YP}},O=function(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return s.G(n);return s.YP}},C=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];"Left"===r._tag&&t.push(r.left)}return t};function T(e){return function(t,n){if(void 0===n){var r=T(e);return function(e){return r(t,e)}}for(var i,o=0;o<n.length;o++)if(i=n[o],e.equals(i,t))return!0;return!1}}var D=function(e){var t=c.jj(e);return function(e){return m(e)?t(e):e}},x=function(e){var t=c.pO(e);return function(e){return m(e)?t(e):ve}},A=function(e){return function(t){return e>=1&&m(t)?c.lx(e)(t):p(t)?[t,ve]:[ve,t]}};var q=function(e,t){return(0,i.zG)(e,N(t))},M=function(e,t,n){return(0,i.zG)(e,Z(t,n))},R=function(e,t){return(0,i.zG)(e,me(t))},F=function(e,t){return(0,i.zG)(e,ge(t))},j=c.of,L=function(){return ve},Y=function(e){return function(t){return(0,i.zG)(t,function(e){return function(t){if(p(t))return ve;for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}}((function(t,n){return e(n)})))}},$=Y(i.yR),N=function(e){return function(t){return t.map((function(t){return e(t)}))}},Q=function(e){return function(t){return t.map((function(t,n){return e(n,t)}))}},B=function(e){return function(t){return t.filter(e)}},H=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);s.pC(i)&&n.push(i.value)}return n}},K=function(e){return H((function(t,n){return e(n)}))},V=K(i.yR),W=function(e){return X((function(t,n){return e(n)}))},X=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return(0,l.s4)(n,r)}},J=function(e){return function(t){return function(n){return n.reduce((function(n,r,i){return e.concat(n,t(i,r))}),e.empty)}}},Z=function(e,t){return te(e,(function(e,n,r){return t(n,r)}))},ee=function(e){var t=J(e);return function(e){return t((function(t,n){return e(n)}))}},te=function(e,t){return function(n){for(var r=n.length,i=e,o=0;o<r;o++)i=t(o,i,n[o]);return i}},ne=function(e,t){return re(e,(function(e,n,r){return t(n,r)}))},re=function(e,t){return function(n){return n.reduceRight((function(e,n,r){return t(r,n,e)}),e)}},ie=function(e){return function(t){return M(t,e.of(L()),(function(t,n){return e.ap(e.map(t,(function(e){return function(t){return(0,i.zG)(e,h(t))}})),n)}))}},oe="ReadonlyArray",se=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},ue=function(){return{concat:function(e,t){return p(e)?t:p(t)?e:e.concat(t)},empty:ve}},ae=function(e){return(0,r.f7)((function(t,n){return t.length===n.length&&t.every((function(t,r){return e.equals(t,n[r])}))}))},ce=function(e){return(0,a.Zt)((function(t,n){for(var r=t.length,i=n.length,o=Math.min(r,i),s=0;s<o;s++){var a=e.compare(t[s],n[s]);if(0!==a)return a}return u.Df.compare(r,i)}))},le={URI:oe,map:q},fe={URI:oe,of:j},de={URI:oe,zero:L},pe=(0,f.l)(de,fe),me=function(e){return function(t){for(var n=d([],e(t),!0),r=[];n.length>0;){var i=n.shift();s.nM(i)?n.unshift.apply(n,e(i.left)):r.push(i.right)}return r}},ge=function(e){return function(t){var n=e(t),r=[],i=[];function o(t){s.nM(t)?e(t.left).forEach((function(e){return r.push(e)})):i.push(t.right)}for(var u=0,a=n;u<a.length;u++){o(a[u])}for(;r.length>0;)o(r.shift());return i}},he=(c.oo,function(e){return p(e)?ve:e.slice()}),ve=c.cS;function ye(e){return function(t){return t.every(e)}}var _e=function(e){return function(t){return t.some(e)}},be=function(e){var t=c.j0(e);return function(n){return y((function(){return e.empty}),t(n))}},Ie=(s.F4,(0,o.Hr)(le));c.w6,c.QI,c.Ss},241:(e,t,n)=>{n.d(t,{R3:()=>v,Im:()=>h,pO:()=>k,ur:()=>Q,QI:()=>V,cS:()=>f,Lx:()=>C,xP:()=>x,c2:()=>b,Eh:()=>R,ZN:()=>M,YM:()=>F,j0:()=>K,Od:()=>d,dC:()=>p,Z$:()=>L,UI:()=>E,aL:()=>B,ut:()=>H,Fp:()=>N,VV:()=>$,of:()=>U,Ce:()=>g,ws:()=>m,w6:()=>S,u4:()=>O,nq:()=>T,iw:()=>A,OE:()=>D,Ss:()=>W,lx:()=>z,jj:()=>_,oo:()=>y});var r,i=n(268),o=n(735),s=(n(341),n(384)),u=n(209),a=function(e){return{concat:u.VV(e)}},c=function(e){return{concat:u.Fp(e)}};r=void 0;var l=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},f=s.Xl,d=s.Od,p=function(e,t){return e<0||e>=t.length},m=function(e){return function(t){return l([e],t,!0)}},g=m,h=function(e){return function(t){return l(l([],t,!0),[e],!1)}},v=h,y=function(e,t,n){if(d(n)){var r=s.r1(n);return r.splice(e,0,t),r}return[t]},_=function(e){return function(t){if(1===t.length)return t;for(var n=[F(t)],r=function(t){n.every((function(n){return!e.equals(n,t)}))&&n.push(t)},i=0,o=j(t);i<o.length;i++){r(o[i])}return n}},b=function(e){return d(e)?s.G(e):s.YP},I=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},S=function(e,t){return e<=t?I((function(t){return e+t}))(t-e+1):[e]};function w(e,t){return t?e.concat(t):function(t){return t.concat(e)}}var G=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},k=function(e){return function(t){for(var n=e(t),r=[n[0]],i=n[1];d(i);){var o=e(i),s=o[0],u=o[1];r.push(s),i=u}return r}},z=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[t,f]:[(0,o.zG)(t.slice(1,n),g(F(t))),t.slice(n)]}},U=s.ri,E=function(e){return P((function(t,n){return e(n)}))},P=function(e){return function(t){for(var n=[e(0,F(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},O=function(e,t){return D(e,(function(e,n,r){return t(n,r)}))},C=function(e){return function(t){return function(n){return n.slice(1).reduce((function(n,r){return e.concat(n,t(r))}),t(n[0]))}}},T=function(e,t){return A(e,(function(e,n,r){return t(n,r)}))},D=function(e,t){return function(n){return n.reduce((function(e,n,r){return t(r,e,n)}),e)}},x=function(e){return function(t){return function(n){return n.slice(1).reduce((function(n,r,i){return e.concat(n,t(i+1,r))}),t(0,n[0]))}}},A=function(e,t){return function(n){return n.reduceRight((function(e,n,r){return t(r,n,e)}),e)}},q=s.YM,M=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},R=function(e){return(0,i.f7)((function(t,n){return t.length===n.length&&t.every((function(t,r){return e.equals(t,n[r])}))}))},F=(s.F4,q),j=s.Gb,L=function(e){return e[e.length-1]},Y=function(e){return e.slice(0,-1)},$=function(e){var t=a(e);return function(e){return e.reduce(t.concat)}},N=function(e){var t=c(e);return function(e){return e.reduce(t.concat)}},Q=function(e){return function(t){return t.reduce(e.concat)}},B=function(e){return function(t){return e(F(t),j(t))}},H=function(e){return function(t){return e(Y(t),L(t))}},K=function(e){var t=Q(e);return function(e){return(0,o.ls)(function(e){return function(t){var n=j(t);return d(n)?(0,o.zG)(n,G(e),g(F(t))):t}}(e),t)}};function V(e,t){return void 0===t?g(e):(0,o.zG)(t,g(e))}var W=function(e,t){return(0,o.zG)(e,w([t]))}},923:(e,t,n)=>{n.d(t,{Bu:()=>v,CC:()=>F,DZ:()=>ne,EG:()=>h,EW:()=>B,Eh:()=>fe,G:()=>x,HA:()=>q,Hd:()=>E,I8:()=>L,P5:()=>y,RF:()=>j,RJ:()=>$,SW:()=>K,Su:()=>b,UI:()=>I,Ub:()=>W,V_:()=>Q,XP:()=>f,Yz:()=>C,_Y:()=>N,_r:()=>U,cS:()=>_,dp:()=>a,dx:()=>m,e$:()=>g,hX:()=>te,jt:()=>P,kp:()=>R,mK:()=>Z,mS:()=>Y,nn:()=>M,nr:()=>pe,nu:()=>H,oA:()=>ae,oh:()=>ce,qS:()=>J,ri:()=>k,sq:()=>T,t9:()=>A,tV:()=>ie,uK:()=>re,uZ:()=>de,vA:()=>X,vP:()=>z,xb:()=>c,yW:()=>D,z7:()=>O,zV:()=>V});var r=n(268),i=n(735),o=n(384),s=n(870),u=n(751),a=(n(605),function(e){return Object.keys(e).length}),c=function(e){for(var t in e)if(o.e$.call(e,t))return!1;return!0},l=function(e){return function(t){return Object.keys(t).sort(e.compare)}},f=l(u.Df);function d(e){if("function"==typeof e)return d(u.Df)(e);var t=l(e);return function(e){return function(n){for(var r=[],i=0,o=t(n);i<o.length;i++){var s=o[i];r.push(e(s,n[s]))}return r}}}var p=d(u.Df)((function(e,t){return[e,t]}));var m=function(e,t){return function(n){if(o.e$.call(n,e)&&n[e]===t)return n;var r=Object.assign({},n);return r[e]=t,r}},g=function(e,t){return o.e$.call(t,e)};function h(e){return function(t){if(!o.e$.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}function v(e){return function(t,n){if(void 0===n){var r=v(e);return function(e){return r(e,t)}}for(var i in t)if(!o.e$.call(n,i)||!e.equals(t[i],n[i]))return!1;return!0}}function y(e,t){return void 0===t?function(t){return y(e,t)}:o.e$.call(t,e)?o.G(t[e]):o.YP}var _={};function b(e){return function(t){var n={};for(var r in t)o.e$.call(t,r)&&(n[r]=e(r,t[r]));return n}}function I(e){return b((function(t,n){return e(n)}))}function S(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(2===e.length)return S(u.Df).apply(void 0,e);var n=l(e[0]);return function(e,t){return function(r){for(var i=e,o=n(r),s=o.length,u=0;u<s;u++){var a=o[u];i=t(a,i,r[a])}return i}}}function w(e){if("compare"in e){var t=l(e);return function(e){return function(n){return function(r){for(var i=e.empty,o=t(r),s=o.length,u=0;u<s;u++){var a=o[u];i=e.concat(i,n(a,r[a]))}return i}}}}return w(u.Df)(e)}function G(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(2===e.length)return G(u.Df).apply(void 0,e);var n=l(e[0]);return function(e,t){return function(r){for(var i=e,o=n(r),s=o.length-1;s>=0;s--){var u=o[s];i=t(u,r[u],i)}return i}}}var k=function(e,t){var n;return(n={})[e]=t,n};function z(e){return Z(u.Df)(e)}function U(e){return function(t){var n={},r={};for(var i in t)if(o.e$.call(t,i)){var u=e(i,t[i]);switch(u._tag){case"Left":n[i]=u.left;break;case"Right":r[i]=u.right}}return(0,s.s4)(n,r)}}function E(e){return function(t){var n={},r={};for(var i in t)if(o.e$.call(t,i)){var u=t[i];e(i,u)?r[i]=u:n[i]=u}return(0,s.s4)(n,r)}}function P(e){return function(t){var n={};for(var r in t)if(o.e$.call(t,r)){var i=e(r,t[r]);o.pC(i)&&(n[r]=i.value)}return n}}function O(e){return function(t){var n={},r=!1;for(var i in t)if(o.e$.call(t,i)){var s=t[i];e(i,s)?n[i]=s:r=!0}return r?n:t}}var C=p,T=function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];t[i[0]]=i[1]}return t};function D(e){return function(t){for(var n in t)if(!e(t[n]))return!1;return!0}}function x(e){return function(t){for(var n in t)if(e(t[n]))return!0;return!1}}function A(e){return function(t,n){if(void 0===n){var r=A(e);return function(e){return r(t,e)}}for(var i in n)if(e.equals(n[i],t))return!0;return!1}}var q=function(e,t){return(0,i.zG)(e,I(t))},M=function(e,t){return(0,i.zG)(e,b(t))},R=function(e){var t=oe(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},F=function(e){return function(t){var n=se(e)(t);return function(e,t){return(0,i.zG)(e,n(t))}}},j=function(e){var t=ue(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},L=function(e,t){return(0,i.zG)(e,te(t))},Y=function(e,t){return(0,i.zG)(e,ne(t))},$=function(e,t){return(0,i.zG)(e,re(t))},N=function(e,t){return(0,i.zG)(e,ie(t))},Q=function(e){var t=S(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},B=function(e){var t=w(e);return function(e){var n=t(e);return function(e,t){return(0,i.zG)(e,n(t))}}},H=function(e){var t=G(e);return function(e,n,r){return(0,i.zG)(e,t(n,r))}},K=function(e,t){return(0,i.zG)(e,U(t))},V=function(e,t){return(0,i.zG)(e,E(t))},W=function(e,t){return(0,i.zG)(e,P(t))},X=function(e,t){return(0,i.zG)(e,O(t))},J=function(e){var t=ee(e);return function(e){var n=t(e);return function(e,t){return n(e,(0,i.ls)(i.SK,t))}}},Z=function(e){var t=J(e);return function(e){var n=t(e);return function(e){return n(e,i.yR)}}},ee=function(e){return function(t){var n=l(e);return function(e,r){var i=n(e);if(0===i.length)return t.of(_);for(var o=t.of({}),s=function(n){o=t.ap(t.map(o,(function(e){return function(t){var r;return Object.assign({},e,((r={})[n]=t,r))}})),r(n,e[n]))},u=0,a=i;u<a.length;u++){s(a[u])}return o}}},te=function(e){return O((function(t,n){return e(n)}))},ne=function(e){return P((function(t,n){return e(n)}))},re=function(e){return E((function(t,n){return e(n)}))},ie=function(e){return U((function(t,n){return e(n)}))};function oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){var n=S(e[0]);return function(e,t){return n(e,(function(e,n,r){return t(n,r)}))}}return oe(u.Df).apply(void 0,e)}function se(e){if("compare"in e){var t=w(e);return function(e){var n=t(e);return function(e){return n((function(t,n){return e(n)}))}}}return se(u.Df)(e)}function ue(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){var n=G(e[0]);return function(e,t){return n(e,(function(e,n,r){return t(n,r)}))}}return ue(u.Df).apply(void 0,e)}var ae=function(e){var t={};for(var n in e)if(o.e$.call(e,n)){var r=e[n];o.pC(r)&&(t[n]=r.value)}return t},ce=function(e){var t={},n={};for(var r in e)if(o.e$.call(e,r)){var i=e[r];o.nM(i)?t[r]=i.left:n[r]=i.right}return(0,s.s4)(t,n)},le="ReadonlyRecord";function fe(e){var t=v(e);return(0,r.f7)((function(e,n){return t(e)(n)&&t(n)(e)}))}function de(e){return{concat:function(t,n){if(c(t))return n;if(c(n))return t;var r=Object.assign({},t);for(var i in n)o.e$.call(n,i)&&(r[i]=o.e$.call(t,i)?e.concat(t[i],n[i]):n[i]);return r},empty:_}}u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df;function pe(e,t){return o.e$.call(void 0===t?this:t,e)}u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df,u.Df},377:(e,t,n)=>{n.d(t,{H5:()=>u,Kl:()=>a,Lx:()=>l,Pd:()=>o,Yg:()=>i,li:()=>r,nq:()=>f,pL:()=>s,u4:()=>c});n(735);function r(e){return e[0]}function i(e){return e[1]}var o=function(e,t){return function(n){return[t(r(n)),e(i(n))]}},s=function(e){return function(t){return[e(r(t)),i(t)]}},u=function(e){return function(t){return[r(t),e(i(t))]}},a=r,c=function(e,t){return function(n){return t(e,r(n))}},l=function(){return function(e){return function(t){return e(r(t))}}},f=function(e,t){return function(n){return t(r(n),e)}}},870:(e,t,n)=>{n.d(t,{F2:()=>s,Vn:()=>i,s4:()=>r});n(735);var r=function(e,t){return{left:e,right:t}},i=function(e){return function(t){return r(e(o(t)),s(t))}},o=function(e){return e.left},s=function(e){return e.right}},151:(e,t,n)=>{n.d(t,{At:()=>k,Do:()=>z,Hi:()=>_,Hr:()=>E,PM:()=>y,UA:()=>S,UI:()=>d,YO:()=>U,ak:()=>P,ap:()=>p,dO:()=>v,mU:()=>w,of:()=>m,pE:()=>x,qA:()=>b,qo:()=>I,tD:()=>a,tS:()=>g,uU:()=>D});var r=n(862),i=n(130),o=n(735),s=n(341),u=n(384),a=function(e){return function(){return Promise.resolve().then(e)}};var c=function(e,t){return(0,o.zG)(e,d(t))},l=function(e,t){return(0,o.zG)(e,p(t))},f=function(e,t){return(0,o.zG)(e,g(t))},d=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},p=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then((function(e){return(0,e[0])(e[1])}))}}},m=function(e){return function(){return Promise.resolve(e)}},g=function(e){return function(t){return function(){return Promise.resolve().then(t).then((function(t){return e(t)()}))}}},h="Task";var v={URI:h,map:c},y={URI:h,of:m},_={URI:h,map:c,ap:l},b={URI:h,map:c,ap:l,of:m},I={URI:h,map:c,ap:l,chain:f},S={URI:h,map:c,of:m,ap:l,chain:f},w=(o.yR,(0,r.m)(I)),G={URI:h,fromIO:a},k=(0,i.At)(G,I),z=m(u.F4),U=(0,s.YO)(v),E=(0,s.Hr)(v),P=(0,r.a)(I),O=m(u.Xl),C=function(e){var t=function(e){return function(t){return function(){return Promise.all(t.map((function(t,n){return Promise.resolve().then((function(){return e(n,t)()}))})))}}}(e);return function(e){return u.Od(e)?t(e):O}},T=function(e){var t=function(e){return function(t){return function(){return u.Gb(t).reduce((function(t,n,r){return t.then((function(t){return Promise.resolve().then(e(r+1,n)).then((function(e){return t.push(e),t}))}))}),Promise.resolve().then(e(0,u.YM(t))).then(u.ri))}}}(e);return function(e){return u.Od(e)?t(e):O}},D=function(e){return C((function(t,n){return e(n)}))},x=function(e){return T((function(t,n){return e(n)}))}},767:(e,t,n)=>{n.d(t,{At:()=>Z,DT:()=>W,EQ:()=>w,Hi:()=>B,Hr:()=>re,Ij:()=>se,LV:()=>G,OV:()=>Q,Qt:()=>oe,UI:()=>x,Vn:()=>q,Y3:()=>z,YO:()=>ne,Zl:()=>F,ak:()=>ie,fF:()=>I,fS:()=>k,fX:()=>V,it:()=>U,oU:()=>J,of:()=>L,t$:()=>g,tD:()=>b,tS:()=>R,wE:()=>te,wp:()=>j});var r=n(828),i=n(862),o=n(856),s=n(690),u=n(130),a=n(679),c=n(735),l=n(341),f=n(384),d=n(151),p=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},m=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},g=o.t$(d.PM),h=o.F2(d.PM),v=o.m8(d.dO),y=o.pk(d.dO),_=(0,c.ls)(d.tD,v),b=(d.tD,_),I=v,S=d.of,w=(d.tD,o.EQ(d.dO)),G=o.LV(d.UA),k=o.fS(d.UA),z=function(e,t){return function(){return p(void 0,void 0,void 0,(function(){var n;return m(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(f.F2)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,f.t$(t(n))];case 3:return[2]}}))}))}},U=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return z((function(){return e.apply(void 0,n)}),t)}},E=(d.dO,d.PM,d.PM,d.UA,d.UA,d.UA,d.UA,d.dO,function(e,t){return(0,c.zG)(e,x(t))}),P=function(e,t){return(0,c.zG)(e,M(t))},O=function(e,t){return(0,c.zG)(e,R(t))},C=function(e,t,n){return(0,c.zG)(e,A(t,n))},T=function(e,t){return(0,c.zG)(e,q(t))},D=function(e,t){return(0,c.zG)(e,j(t))},x=o.UI(d.dO),A=o.Pd(d.dO),q=o.Vn(d.dO),M=o.ap(d.Hi),R=o.tS(d.UA),F=R,j=o.wp(d.UA),L=h,Y=g,$="TaskEither";var N={URI:$,map:E},Q=(0,l.OV)(N),B={URI:$,map:E,ap:P},H={URI:$,map:E,ap:P,chain:O},K={URI:$,fromEither:S},V=(0,s.fX)(K,H),W=(0,s.DT)(K),X={URI:$,fromIO:b},J=(0,u.oU)(X,H),Z=(0,u.At)(X,H),ee={URI:$,fromIO:b,fromTask:I},te=(0,a.oU)(ee,H);f.F4;var ne=(0,l.YO)(N),re=(0,l.Hr)(N),ie=(0,i.a)(H),oe=(0,r.Qt)(B),se=(f.Xl,{URI:$,bimap:C,mapLeft:T,map:E,of:L,ap:P,chain:O,alt:D,fromIO:b,fromTask:I,throwError:Y})},706:(e,t,n)=>{n.d(t,{H5:()=>s,Yg:()=>o,li:()=>i});var r=n(377),i=(n(735),r.li),o=r.Yg;var s=function(e){return function(t){return[i(t),e(o(t))]}};r.Kl,r.Lx,r.u4,r.nq},605:(e,t,n)=>{function r(e,t){return function(n){var r=e.traverse(n);return function(e,i){return n.map(r(e,i),t.separate)}}}function i(e,t){return function(n){var r=e.traverse(n);return function(e,i){return n.map(r(e,i),t.compact)}}}n.d(t,{BL:()=>i,Fj:()=>r})},560:(e,t,n)=>{function r(e,t){return function(n){return n?t.of(void 0):e.zero()}}n.d(t,{l:()=>r})},735:(e,t,n)=>{n.d(t,{MZ:()=>i,Q1:()=>c,SK:()=>p,W8:()=>s,a9:()=>o,bc:()=>f,gn:()=>u,ls:()=>l,r5:()=>a,yR:()=>r,zG:()=>d});function r(e){return e}var i=r;function o(e){return function(){return e}}var s=o(!0),u=o(null),a=o(void 0),c=a;function l(e,t,n,r,i,o,s,u,a){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return s(o(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return u(s(o(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return a(u(s(o(i(r(n(t(e.apply(this,arguments)))))))))}}}function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}function d(e,t,n,r,i,o,s,u,a){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return s(o(i(r(n(t(e))))));case 8:return u(s(o(i(r(n(t(e)))))));case 9:return a(u(s(o(i(r(n(t(e))))))));default:for(var c=arguments[0],l=1;l<arguments.length;l++)c=arguments[l](c);return c}}var p=function(e,t){return t}},384:(e,t,n)=>{n.d(t,{F2:()=>f,F4:()=>v,G:()=>u,Gb:()=>g,Od:()=>p,Wi:()=>i,Xl:()=>h,YM:()=>m,YP:()=>s,e$:()=>y,nM:()=>a,pC:()=>o,r1:()=>_,ri:()=>d,t$:()=>l,tO:()=>c});var r=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},i=function(e){return"None"===e._tag},o=function(e){return"Some"===e._tag},s={_tag:"None"},u=function(e){return{_tag:"Some",value:e}},a=function(e){return"Left"===e._tag},c=function(e){return"Right"===e._tag},l=function(e){return{_tag:"Left",left:e}},f=function(e){return{_tag:"Right",right:e}},d=function(e){return[e]},p=function(e){return e.length>0},m=function(e){return e[0]},g=function(e){return e.slice(1)},h=[],v={},y=Object.prototype.hasOwnProperty,_=function(e){return r([e[0]],e.slice(1),!0)}},11:(e,t,n)=>{n.d(t,{Df:()=>i,Eq:()=>r,Pc:()=>s});var r={equals:function(e,t){return e===t}},i={equals:r.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},o=(r.equals,i.compare,{concat:function(e,t){return e+t}}),s={concat:o.concat,empty:0}},751:(e,t,n)=>{n.d(t,{Df:()=>i,Eq:()=>r,xb:()=>o});var r={equals:function(e,t){return e===t}},i={equals:r.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},o=function(e){return 0===e.length}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{var e=__webpack_require__(992),t=__webpack_require__(851),n=__webpack_require__(735),r=__webpack_require__(116),i=__webpack_require__(567),o=__webpack_require__(328),s=__webpack_require__(652),u=__webpack_require__(767);function a(e,r){return(0,n.zG)(u.Y3((()=>e.get(r)),(e=>`Failed to read previous state from IndexedDB: ${e}.`)),u.UI((e=>e??void 0)),u.UI((i=>o=>(0,n.ls)((0,s.rO)({previousState:()=>i}),o,(o=>{let{value:u,state:a}=o;const[c,l]=t.Ue(!1),f=(0,n.zG)(a,t.Rp(-1,(e=>e+1)));return{value:(0,n.bc)(c,u),state:(0,n.zG)(t.vP(a,f),(0,s.bw)(t.YP((t=>{let[n,o]=t;if(0!==o||n!==i)switch(l(!1),typeof n){case"undefined":e.delete(r).then((()=>l(!0)));break;case"object":null===n?e.delete(r).then((()=>l(!0))):e.put(n,r).then((()=>l(!0)));break;default:e.put(n,r).then((()=>l(!0)))}}))))}})))))}function c(e){return r=>(0,n.ls)((0,s.rO)({previousState:t=>e.current?t:void 0}),r,(0,s.rO)({state:(0,n.ls)((n=>t.vP(e,n)),t.UI((e=>{let[t,n]=e;return t?n:void 0})))}))}var l=__webpack_require__(365);class f extends Error{static errorName="NetworkRequestFailedError";name=f.errorName;constructor(){super(f.defaultMessage)}static get defaultMessage(){return"Network request failed"}}class d extends Error{static errorName="NetworkRequestTimeoutError";name=d.errorName;constructor(){super(d.defaultMessage)}static get defaultMessage(){return"Network request timed out"}}var p=__webpack_require__(384),m=function(e){return"Left"===e._tag},g=function(e){return"Right"===e._tag};function h(e){return{_tag:"Left",left:e}}function v(e){return{_tag:"Right",right:e}}function y(e,t){return{_tag:"Both",left:e,right:t}}var _=function(e,t,n){return function(r){switch(r._tag){case"Left":return e(r.left);case"Right":return t(r.right);case"Both":return n(r.left,r.right)}}},b=_;b(v,h,(function(e,t){return y(t,e)}));var I=v,S="These";n.yR,n.yR,p.Xl;class w{metrics;constructor(e){this.metrics=e}req(e){return this.reqImpl(e).then((e=>(0,n.MZ)(e)))}reqWithBeacon(e){var t,n;let{url:r,payload:i}=e;const o=JSON.stringify(i),s=(null===(t=navigator)||void 0===t||null===(n=t.sendBeacon)||void 0===n?void 0:n.call(t,r,JSON.stringify(i)))??!1;return this.trackRequestMetrics({is_beacon:!0,is_error:!s,request:{method:"POST",url:r,content_length:o.length}}),s}reqImpl(t){const r="arraybuffer",{url:o,dataType:u,contentType:a,method:c,withCredentials:m,timeout:g}=t;return new Promise(((h,_)=>{const b=new XMLHttpRequest,I="POST"===t.method?"string"==typeof(S=t.payload)?S:JSON.stringify(S):null;var S;const w=e=>this.trackRequestMetrics({is_beacon:!1,request:{method:c,url:o,content_length:(null==I?void 0:I.length)??0},response:e});b.onload=(0,e.GL)((()=>{var e,t;return(0,n.zG)(b.status,l.DT((e=>e<400),(()=>{const e="text"===b.responseType||""===b.responseType?b.responseText:"Couldn\'t access response text";return`Failed ajax request. Status code was ${b.status}. ${e}`})),l.tS((()=>"json"===u?b.responseText?l.Y3((()=>JSON.parse(b.responseText)),(e=>`Failed to parse response as JSON. Response was ${JSON.stringify(b.responseText)}. Got ${e}`)):l.F2(null):"text"===u?l.F2(b.responseText):l.F2(b.response))),(0,s.bw)((0,n.ls)(i.IS,(t={content_length:"text"===b.responseType||""===b.responseType?(null===(e=b.responseText)||void 0===e?void 0:e.length)??0:b.responseType===r?b.response.byteLength:0,response_time_ms:self.performance.now()-G,status_code:b.status},function(e){return p.Wi(e)?v(t):y(e.value,t)}),w)),l.EQ(_,h))})),b.onerror=(0,e.GL)((()=>{w(l.t$("network error")),_(new f)})),b.ontimeout=(0,e.GL)((()=>{w(l.t$("timeout")),_(new d)})),b.open(c,o,!0),a&&b.setRequestHeader("content-type",a),b.timeout=g||b.timeout,b.withCredentials=m||b.withCredentials,b.responseType="binary"===u?r:b.responseType;const G=self.performance.now();b.send(I)}))}trackRequestMetrics(e){var t;if(null===(t=this.metrics)||void 0===t||!t.isEnabled())return;const r=new URL(e.request.url).pathname;if(r.includes("metrics"))return;const o=t=>this.metrics.track({name:"sdk_http_request_count_total",value:1,labels:{request_method:e.request.method,request_path:r,request_content_length:e.request.content_length,...t}});var s;!0===e.is_beacon?o({is_beacon:!0,is_error:e.is_error}):(0,n.zG)((s=e.response,m(s)?p.YP:(g(s),p.G(s.right))),i.aD((()=>({})),(e=>({response_content_length:e.content_length,response_status:e.status_code,response_time_ms:e.response_time_ms}))),(t=>({is_beacon:!1,is_error:!g(e.response),...t})),o)}}class G{config;PATH_JOINER_Q="?";PATH_JOINER_A="&";constructor(e){this.config=e}getBaseUrl(){return`${this.config.apiProtocol}://${this.config.apiHost}`}getEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("base",e,t,n)}getSdkErrorsUrl(e,t){return this.getUrl("sdk-errors",e,t,[])}getAdvertiserEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("adv",e,t,n)}getClassificationModelsEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("clm",e,t,n)}getAudienceMatchingEndpointUrl(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const i=`${e}/${n}/audiences`;return this.getUrl("audience-matching",i,t,r)}getCCSCohortMembershipEndpointUrl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return this.getUrl("ccs",e,t,n)}makeAuthenticatedUrl(e){return this.makeUrlWithQueryParams(e,[["k",this.config.apiKey]])}getUrlPrefix(e){switch(e){case"base":return"";case"adv":return"/adv";case"sdk-errors":return"/sdk-errors";case"clm":return"/clm";case"audience-matching":return"/audience-matching";case"ccs":return"/ccs"}}getUrl(e,t,n,r){const o=this.getUrlPrefix(e),s=(0,i.g_)((()=>""),(e=>`/${e}`))(n),u=`${this.getBaseUrl()}${o}${s}${t}`;return this.makeUrlWithQueryParams(u,r.concat([["k",this.config.apiKey]]))}makeUrlWithQueryParams(e,t){const n=t.map((e=>{let[t,n]=e;return`${t}=${n}`})).join(this.PATH_JOINER_A),r=e.includes(this.PATH_JOINER_Q)?this.PATH_JOINER_A:this.PATH_JOINER_Q;return`${e}${r}${n}`}}var k=__webpack_require__(869),z=__webpack_require__(828);class U{sdkInitTimestamp;timeOriginSdkInit;logger;prefix="[Metrics]";timeOriginForContext=O();pendingMetrics=[];pendingCounters={};pendingTimers={};noMetricsTracked=0;constructor(e,t,n){this.sdkInitTimestamp=e,this.timeOriginSdkInit=t,this.logger=n}isEnabled(){return!0}getNoMetricsTracked(){return this.noMetricsTracked}consume(){const e=this.pendingMetrics.concat(Object.values(this.pendingCounters).flat());return this.pendingMetrics=[],this.pendingCounters={},e}track(e){this.noMetricsTracked++,this.logDebug(`Tracking ${e.name}`,{metric:e}),this.pendingMetrics.push(e)}trackCounter(e){if(this.noMetricsTracked++,this.logDebug(`Tracking ${e.name}`,{metric:e}),e.name in this.pendingCounters){const t=Object.keys(e.labels),n=this.pendingCounters[e.name].findIndex((n=>Object.keys(n.labels).length===t.length&&t.every((t=>n.labels[t]===e.labels[t]))));-1===n?this.pendingCounters[e.name].push(e):this.pendingCounters[e.name][n]=P(this.pendingCounters[e.name][n],e.value)}else this.pendingCounters[e.name]=[e]}synchroniseTimeBetweenContexts(e){return(0,n.zG)(z.gz(i.G5)(this.timeOriginForContext,this.timeOriginSdkInit),i.UI((t=>{let[n,r]=t;return e+n-r})))}trackTimeSinceInit(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:performance.now();(0,n.zG)(this.synchroniseTimeBetweenContexts(r),i.UI((e=>(e-this.sdkInitTimestamp)/1e3)),i.UI((n=>this.track({name:e,value:n,labels:t}))))}startTimer(e,t){const n=performance.now(),r=this.generateRandomKey(e);return this.pendingTimers[r]={startTime:n,labels:t},r}stopTimer(e,t){const n=this.pendingTimers[t];if(n){const r=(performance.now()-n.startTime)/1e3;this.logDebug("timer stopped",e,r),this.track({name:e,value:r,labels:n.labels}),delete this.pendingTimers[t]}}generateRandomKey(e){return`${e}-${[...Array(24)].map((()=>Math.random().toString(36)[2])).join("")}`}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(this.prefix,...t)}}class E{isEnabled(){return!1}getNoMetricsTracked(){return 0}consume(){return[]}track(e){}trackCounter(e){}trackTimeSinceInit(e,t){}startTimer(e,t){return""}stopTimer(e,t){}}const P=(e,t)=>({...e,value:e.value+t}),O=()=>(0,n.zG)(i.Y3((()=>performance.timeOrigin)),i.hX((e=>"number"==typeof e&&!Number.isNaN(e))));class C{sdkInitTimestamp;prefix="[Permutive]"+(self.document?"[Main]":"[Worker]");debugStyle=["color: blue"].join(";");constructor(e){this.sdkInitTimestamp=e}get timeDeltaFromInit(){return`[${(new Date).getTime()-this.sdkInitTimestamp}ms]`}log(){return console.log.bind(self.console,this.timeDeltaFromInit,this.prefix)(...arguments)}debug(){return console.debug.bind(self.console,"%s%c%s",this.timeDeltaFromInit,this.debugStyle,this.prefix)(...arguments)}warn(){return console.warn.bind(self.console,this.timeDeltaFromInit,this.prefix)(...arguments)}error(){return console.error.bind(self.console,this.timeDeltaFromInit,this.prefix)(...arguments)}}class T{log(){}debug(){}warn(){}error(){}}class D{crypto=self.crypto||self.msCrypto;ALG_NAME="AES-GCM";isAvailable(){var e;return!(null===(e=this.crypto)||void 0===e||!e.subtle)}generateKey(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,e.t_)(this.crypto.subtle.generateKey({name:this.ALG_NAME,length:256},t,["encrypt","decrypt"]))}encrypt(e,t){const[n,r]=this._encrypt(e,this.str2bytes(t));return n.then((e=>{const t=new Uint8Array(16+e.byteLength);return t.set(r,0),t.set(new Uint8Array(Uint32Array.of(e.byteLength).buffer),12),t.set(new Uint8Array(e),16),t.buffer}))}decrypt(e,t){const n=new Uint8Array(t,0,12),r=new Uint32Array(t,12,1)[0],i=t.slice(16,16+r);return this._decrypt(e,n,i).then(this.bytes2str)}_encrypt(t,n){const r=this.crypto.getRandomValues(new Uint8Array(12));return[(0,e.t_)(this.crypto.subtle.encrypt({name:this.ALG_NAME,iv:r},t,n)),r]}_decrypt(t,n,r){return(0,e.t_)(this.crypto.subtle.decrypt({name:this.ALG_NAME,iv:n},t,r))}str2bytes(e){return(new TextEncoder).encode(e).buffer}bytes2str(e){return(new TextDecoder).decode(e)}}class x{config;constructor(e){this.config=e}getNamespacedStorageKey(e){return`${this.config.stateNamespace}${e}`}}var A=__webpack_require__(151),q=__webpack_require__(392),M=__webpack_require__(923),R=__webpack_require__(17),F=__webpack_require__(241);var j=__webpack_require__(688),L=__webpack_require__(548);class Y{timeoutDurationInMilliseconds;maxTimeOutDurationInMilliseconds;constructor(e,t){this.timeoutDurationInMilliseconds=e,this.maxTimeOutDurationInMilliseconds=t}schedule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.timeoutDurationInMilliseconds,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.maxTimeOutDurationInMilliseconds;return this.debounce(e,t,n)}scheduleAccumulated(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeoutDurationInMilliseconds,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.maxTimeOutDurationInMilliseconds;return this.debounce(e,n,r,t)}scheduleForPageUnload(e){return(0,s.aT)(e)}debounce(t,n,r,i){let o,u,a,c=[];return l=>{i&&(a=i.concat(a??i.empty,l));const f=(0,s.b2)();c.push(f);var d;return null===(d=o)||void 0===d||d(),o=(0,e.HJ)((()=>{var e;null===(e=u)||void 0===e||e(),u=void 0;const n=t(a||l);c.forEach((e=>e.resolve(n))),a=null==i?void 0:i.empty,c=[]}),n),u||(u=(0,e.HJ)((()=>{var e;null===(e=o)||void 0===e||e(),u=void 0;const n=t(a||l);c.forEach((e=>e.resolve(n))),a=null==i?void 0:i.empty,c=[]}),r)),f.promise}}}class $ extends Error{constructor(e){super(e),this.name="StoreClosingError"}}const N="permutive-events-cache",Q="permutive-events-for-page",B="[EVENTSCACHE]",H=e=>"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name;class K{config;logger;reportError;trace;metrics;userId;makeEventsStore;eventStore;eventsCache=this.makeEventsRepository(N);eventsForPage=this.makeEventsRepository(Q);eventsTTLInMilliseconds;readiness;debouncedReportError=(()=>new Y(5e3,5e3).schedule((e=>this.reportError(e.errorMessage,{userId:e.userId}))))();static initialise(e,t,r,i,o,s,a){return(0,n.zG)(a(),u.UI((n=>new K(e,t,r,i,o,s,a,n))))}constructor(e,t,r,o,u,a,c,l){this.config=e,this.logger=t,this.reportError=r,this.trace=o,this.metrics=u,this.userId=a,this.makeEventsStore=c,this.eventStore=l,this.eventsTTLInMilliseconds=(0,n.zG)((0,i.ij)(this.config.eventsTTLInDays),(0,i.tS)((e=>"number"==typeof e&&e>0?(0,i.G)(24*e*3600):i.YP))),this.eventsCache.events=(0,s.HP)((()=>(0,s.PQ)((0,n.zG)(A.tD((()=>this.trace.startSpan("load_event_cache"))),A.tS((e=>(0,n.zG)(this.loadFromDisk(),A.At((t=>()=>{e.finish(),this.logDebug(`Event cache loaded, #e ${t.length}`)}))))))))),this.readiness=this.eventsCache.events().then((()=>this.migratePreviousPagesEvents())),a.onChange((()=>this.reset()))}async migratePreviousPagesEvents(){const e=this.trace.startSpan("migrate_previous_for_page_events"),t=(0,A.pE)((e=>(0,u.Y3)((()=>e.flush()),j.w)));return(0,n.zG)([this.eventsForPage,this.eventsCache],t,(0,A.UI)((t=>{const n=o.bj(t);return n.length>0&&this.reportError(`Migrate previous events failed. Got:\\n${n.join("\\n ")}`,{userId:this.userId.current}),e.finish()})),(e=>e()))}all(){return Promise.all([this.eventsCache.events(),this.eventsForPage.events()]).then(o.xH)}async add(e,t){let{persistOnDisk:r}=t;return this.logDebug("Adding to cache",e),this.eventsForPage.events=(0,n.zG)(this.eventsForPage.events,A.UI((t=>[...t,e])),s.HP),r&&this.readiness.then((()=>this.eventsForPage.flush())),e}filterEventsByWorkspace(e){return e}pruneEventsToSizeLimit(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.config.eventsCacheLimitBytes;if(n<=0||t<=n)return this.logDebug(`Event size of ${t} less than limit of ${n}`),{events:e,sizeInBytes:t};this.logDebug("Events before pruning",{count:e.length,sizeInBytes:t,byteLimit:n});let r=1,i=[...e];for(;t>n;)i.splice(0,r),r*=2,t=2*JSON.stringify(i).length;return this.logDebug("Events after pruning",{count:i.length,sizeInBytes:t}),{events:i,sizeInBytes:t}}loadFromDisk(){const e=()=>[],t=(0,n.zG)(this.eventsTTLInMilliseconds,i.EQ((()=>n.yR),(e=>o.hX((t=>e>Date.now()-t.time.getTime())))));return(0,n.zG)(A.tD((()=>(this.logLog("Loading event cache..."),this.metrics.startTimer("sdk_load_events_cache_task_duration_seconds",{})))),A.YO("loadEventsCacheTask"),A.ak("eventsFromDisk",(()=>(0,n.zG)(o.nI([this.eventStore.get(N),this.eventStore.get(Q)]),o.UI(u.LV((0,s.lo)([[e=>e instanceof $,(0,n.ls)(e,A.of)],t=>(0,n.zG)(A.tD((()=>this.reportError(`Error fetching data from store. Got ${t}`,{userId:this.userId.current}))),A.tS((()=>()=>this.reset("historical"))),A.UI(e))]),(0,n.ls)(i.fS(e),A.of))),o.vP(A.qA)))),A.At((e=>{let{eventsFromDisk:t,loadEventsCacheTask:n}=e;return()=>{this.logDebug("Read events from store:",t),this.metrics.stopTimer("sdk_load_events_cache_task_duration_seconds",n)}})),A.UI((0,n.ls)((0,s.vg)("eventsFromDisk"),o.xH,this.filterEventsByWorkspace,(e=>this.pruneEventsToSizeLimit(e,2*JSON.stringify(e).length)),(e=>(this.eventsCache.sizeInBytes=e.sizeInBytes,this.eventsCache.sizeInBytesLastSuccessfulWrite=e.sizeInBytes,e.events.length>0&&(this.metrics.track({name:"sdk_events_cache_byte_total",value:e.sizeInBytes,labels:{}}),this.metrics.track({name:"sdk_events_cache_size_total",value:e.events.length,labels:{}})),e.events)),o.UI(L.k),t)))}async reset(e){return(0,n.zG)(A.tD((()=>this.logDebug("Resetting Events Cache"))),A.tS((()=>this.eventStore.deleteStore())),u.tS((()=>this.makeEventsStore())),u.Zl((t=>(this.eventStore=t,"historical"===e?z.gz(u.Ij)(this.eventsCache.reset,this.eventsForPage.flush):z.gz(u.Ij)(this.eventsCache.reset,this.eventsForPage.reset)))),u.wE((()=>()=>this.all())),u.fS((()=>A.of(V()))),(e=>e()))}getStateSizeInBytes(){return this.eventsForPage.sizeInBytes+this.eventsCache.sizeInBytes}makeEventsRepository(e){const t=(()=>{let e=Promise.resolve(l.F2((0,n.Q1)()));return t=>e=e.then(t)})(),r=e=>(0,n.zG)(A.tD((()=>this.logDebug(`Writing ${e.length} events to ${m.key}`))),A.tS((()=>this.eventStore.put(e.map(L.X),m.key))),u.UI(n.Q1)),i=(0,n.zG)(A.tD((()=>this.logDebug(`Deleting events for ${m.key}`))),A.tS((()=>this.eventStore.delete(m.key))),u.Vn(j.w)),o=(0,n.ls)(A.of,A.At((e=>()=>this.logError(`Events cache failed to put ${m.key}. Got ${e}`))),A.tS((0,s.lo)([[e=>H(e)&&m.retryAttempts<9,()=>(0,n.zG)(A.tD((()=>{m.retryAttempts+=1,this.logDebug(`Attempt #${m.retryAttempts} to write ${m.key} to EventsStore`)})),A.tS((()=>p)),A.tS((()=>c)))],[e=>H(e),e=>(0,n.zG)(A.tD((()=>this.logDebug(`Attempted ${m.retryAttempts} rewrite attempts and reached limit of 9 max writes.`,"Reporting QuotaExceededError to API"))),A.tS((()=>()=>this.debouncedReportError({errorMessage:`Events cache failed to put ${m.key}. Got ${e}`,userId:this.userId.current}))),A.tS((()=>u.t$(e))))],u.t$]))),a=e=>u.tD((()=>{this.logDebug(`Successfully wrote events for ${m.key} after ${m.retryAttempts} attempts`),m.retryAttempts=0,m.sizeInBytes=2*JSON.stringify(e).length,m.sizeInBytesLastSuccessfulWrite=m.sizeInBytes})),c=(0,n.zG)((()=>m.events()),A.tS((e=>(0,n.zG)(r(e),A.mU(l.EQ(o,(()=>a(e)))))))),f=(e,t)=>(0,n.zG)(e.events,A.UI((n=>{const r=2*JSON.stringify(n).length,i=this.pruneEventsToSizeLimit(n,r,t);return e.events=A.of(i.events),e.sizeInBytes=i.sizeInBytes,t-e.sizeInBytes}))),d=(e,t)=>{let[r,...i]=e;return r&&0!==t?(0,n.zG)(f(r,t),A.tS((e=>(this.logDebug(`${e} left after pruning ${r.key}`),d(i,e))))):A.of((0,n.Q1)())},p=(0,n.zG)(u.tD((()=>this.eventsForPage.sizeInBytes-this.eventsForPage.sizeInBytesLastSuccessfulWrite)),u.fX(l.DT((e=>e>0),(e=>new Error(`${this.eventsForPage.key} failed to write the same or smaller events cache of size ${e}`)))),u.tS((e=>{const t=1.2*e,r=[this.eventsCache,this.eventsForPage];return this.logDebug(`Pruning ${t} bytes from`,r),(0,n.zG)(d(r,t),u.fF)}))),m={key:e,events:A.of([]),sizeInBytes:0,sizeInBytesLastSuccessfulWrite:0,retryAttempts:0,flush:()=>(0,n.zG)(A.tD((()=>this.trace.startSpan(`write_${m.key}`))),A.tS((e=>(0,n.zG)(c,A.At((()=>()=>e.finish()))))),t),reset:()=>(0,n.zG)(A.tD((()=>{m.events=A.of([]),m.sizeInBytes=0,m.sizeInBytesLastSuccessfulWrite=0})),A.tS((()=>i)),t)};return m}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(B,...t)}logWarn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.warn(B,...t)}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(B,...t)}logLog(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.log(B,...t)}}const V=()=>[],W=`permutive.${self.document?"main":"worker"}.`;class X{config;shouldUsePerformanceMark=!1;constructor(e){var t;this.config=e,this.shouldUsePerformanceMark=((null===(t=self.performance)||void 0===t?void 0:t.mark)&&this.config.tracingEnabled)??!1}startSpan(e){const t=this.generateSpan(e);return t.start(),{spanId:t.spanId,finish:t.finish}}measureSinceInit(t){const n=this.generateSpan(`${t}_since_init`);return n.start({startTime:e.NC}),{spanId:n.spanId,finish:n.finish}}traceTask(e){return t=>async()=>{const n=this.startSpan(e),r=await t();return n.finish(),r}}measureBetween(e,t,n){const r=this.generateSpan(e);r.start({startTime:t}),r.finish({startTime:n})}generateSpan(e){if(!this.shouldUsePerformanceMark)return{spanId:null,start:()=>{},finish:()=>{}};const{spanName:t,startMarkerName:n,endMarkerName:r}=X.generateUniqueMarkerNames(e);return{spanId:n,start:e=>{var t;return null===(t=self.performance)||void 0===t?void 0:t.mark(n,e)},finish:e=>{var i,o,s;null===(i=self.performance)||void 0===i||i.mark(r,{startTime:(null==e?void 0:e.startTime)??performance.now()}),null===(o=self.performance)||void 0===o||null===(s=o.measure)||void 0===s||s.call(o,t,n,r)}}}static generateUniqueMarkerNames(e){const t=`${W}${e}`,n=`${t}${X.generateId()}`;return{spanName:t,startMarkerName:`${n}_start`,endMarkerName:`${n}_end`}}static generateId(){return"_"+Math.random().toString(36).substr(2,9)}}class J{db;static version=3;static connect(t,r,i,o,s,a,c,l,f,d){return(0,n.zG)(u.Y3((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,569))),String),e.N1,u.tS((e=>e.make(t,r,i,o,s,a,c,J.version,l,f,d))),u.UI((e=>new J(Promise.resolve(e)))))}constructor(e){this.db=e}shouldThrowStoreClosingError(e){return"NotFoundError"===e.name||"InvalidStateError"===e.name}makeStoreClosingDuringOpertationError(e){return new $(`Attempted ${e} when the current store is closing.`)}put(e,t){return(0,u.Y3)((()=>this.db.then((n=>n.put(e,t)))),(e=>{const t=(0,j.w)(e);return this.shouldThrowStoreClosingError(t)?this.makeStoreClosingDuringOpertationError("put"):t}))}get(e){return(0,u.Y3)((()=>this.db.then((t=>t.get(e))).then(i.ij)),(e=>{const t=(0,j.w)(e);return this.shouldThrowStoreClosingError(t)?this.makeStoreClosingDuringOpertationError("get"):t}))}delete(e){return(0,u.Y3)((()=>this.db.then((t=>t.delete(e)))),(e=>String(e)))}deleteStore(){return(0,u.Y3)((()=>this.db.then((e=>e.deleteStore()))),(e=>String(e)))}}const Z=e=>{if(!e)return"";return(0,n.zG)(e,(e=>{const t=e.length-1;return"/"===e[t]?e.slice(0,t):e}))};class ee{urls;config;network;metricsCollector;logger;webClient;prefix="[API]";constructor(e,t,n,r,o){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:()=>i.YP;this.urls=e,this.config=t,this.network=n,this.metricsCollector=r,this.logger=o,this.webClient=s}async reportError(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;const s=(0,j.w)(e);if(this.logError("Reporting error:\\n",s),!this.config.sendClientErrors)return void this.logDebug("Send errors not enabled. Skipping");const u=(0,n.zG)(this.webClient,q.UI(i.fS((()=>{var e,t,n,r;return{domain:(null===(e=self.location)||void 0===e?void 0:e.hostname)??"",referrer:"document"in self?null===(t=self.document)||void 0===t?void 0:t.referrer:"",url:(null===(n=self.location)||void 0===n?void 0:n.href)??"",user_agent:(null===(r=navigator)||void 0===r?void 0:r.userAgent)??""}}))),q.UI((e=>{var n,i;const o={error_message:(null==s||null===(n=s.message)||void 0===n?void 0:n.toString())??"",stack_trace:null==s||null===(i=s.stack)||void 0===i?void 0:i.split("\\n")},u=t?{user_id:t}:{};return{platform:"web",sdk_version:"v20.11.0",ql_runtime_version:"v13.0.0",timestamp:r,domain:e.domain,url:Z(e.url),referrer:Z(e.referrer),user_agent:e.user_agent,error_message:o.error_message??String(s),stack_trace:o.stack_trace,...u}}))),a=e=>this.network.req({url:this.urls.getSdkErrorsUrl("/errors",i.G(this.config.sdkErrorsApiVersion)),method:"POST",payload:[e],contentType:"text/plain",dataType:"text",withCredentials:!1}),c=e=>{this.metricsCollector.trackCounter({name:"sdk_http_generic_network_request_fail_count_total",value:1,labels:{network_error_type:e}})};await(0,n.zG)([f,d],o.Ew((e=>s.name===e.errorName||s.message.indexOf(e.errorName)>=0||s.message.indexOf(e.defaultMessage)>=0)),i.g_((()=>{const e=u();return a(e).catch((0,n.ls)(j.w,(e=>this.logError(e))))}),(async e=>c(e.errorName))))}logDebug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.debug(this.prefix,...t)}logError(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.logger.error(this.prefix,...t)}}var te=__webpack_require__(256);const ne=e=>{const t=re(e.javaScriptInput),{env:n,...r}=(0,te.N)({hash:e.hash,runtimeInput:t});return r},re=e=>{if(e&&"object"==typeof e)return e;throw new Error("Invalid runtime input specified.")},ie=("undefined"!=typeof globalThis?globalThis:void 0)?.crypto||("undefined"!=typeof global?global:void 0)?.crypto||("undefined"!=typeof window?window:void 0)?.crypto||("undefined"!=typeof self?self:void 0)?.crypto||("undefined"!=typeof frames?frames:void 0)?.[0]?.crypto;let oe;oe=ie?e=>{const t=[];for(let n=0;n<e;n+=4)t.push(ie.getRandomValues(new Uint32Array(1))[0]);return new ue(t,e)}:e=>{const t=[],n=e=>{let t=e,n=987654321;const r=4294967295;return()=>{n=36969*(65535&n)+(n>>16)&r,t=18e3*(65535&t)+(t>>16)&r;let e=(n<<16)+t&r;return e/=4294967296,e+=.5,e*(Math.random()>.5?1:-1)}};for(let r,i=0;i<e;i+=4){const e=n(4294967296*(r||Math.random()));r=987654071*e(),t.push(4294967296*e()|0)}return new ue(t,e)};class se{static create(...e){return new this(...e)}mixIn(e){return Object.assign(this,e)}clone(){const e=new this.constructor;return Object.assign(e,this),e}}class ue extends se{constructor(e=[],t=4*e.length){super();let n=e;if(n instanceof ArrayBuffer&&(n=new Uint8Array(n)),(n instanceof Int8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array)&&(n=new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),n instanceof Uint8Array){const e=n.byteLength,t=[];for(let r=0;r<e;r+=1)t[r>>>2]|=n[r]<<24-r%4*8;this.words=t,this.sigBytes=e}else this.words=e,this.sigBytes=t}static random=oe;toString(e=ae){return e.stringify(this)}concat(e){const t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(let e=0;e<i;e+=1){const i=n[e>>>2]>>>24-e%4*8&255;t[r+e>>>2]|=i<<24-(r+e)%4*8}else for(let e=0;e<i;e+=4)t[r+e>>>2]=n[e>>>2];return this.sigBytes+=i,this}clamp(){const{words:e,sigBytes:t}=this;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)}clone(){const e=super.clone.call(this);return e.words=this.words.slice(0),e}}const ae={stringify(e){const{words:t,sigBytes:n}=e,r=[];for(let e=0;e<n;e+=1){const n=t[e>>>2]>>>24-e%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse(e){const t=e.length,n=[];for(let r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new ue(n,t/2)}},ce={stringify(e){const{words:t,sigBytes:n}=e,r=[];for(let e=0;e<n;e+=1){const n=t[e>>>2]>>>24-e%4*8&255;r.push(String.fromCharCode(n))}return r.join("")},parse(e){const t=e.length,n=[];for(let r=0;r<t;r+=1)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new ue(n,t)}},le={stringify(e){try{return decodeURIComponent(escape(ce.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:e=>ce.parse(unescape(encodeURIComponent(e)))};class fe extends se{constructor(){super(),this._minBufferSize=0}reset(){this._data=new ue,this._nDataBytes=0}_append(e){let t=e;"string"==typeof t&&(t=le.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(e){let t;const{_data:n,blockSize:r}=this,i=n.words,o=n.sigBytes;let s=o/(4*r);s=e?Math.ceil(s):Math.max((0|s)-this._minBufferSize,0);const u=s*r,a=Math.min(4*u,o);if(u){for(let e=0;e<u;e+=r)this._doProcessBlock(i,e);t=i.splice(0,u),n.sigBytes-=a}return new ue(t,a)}clone(){const e=super.clone.call(this);return e._data=this._data.clone(),e}}class de extends fe{constructor(e){super(),this.blockSize=16,this.cfg=Object.assign(new se,e),this.reset()}static _createHelper(e){return(t,n)=>new e(n).finalize(t)}static _createHmacHelper(e){return(t,n)=>new pe(e,n).finalize(t)}reset(){super.reset.call(this),this._doReset()}update(e){return this._append(e),this._process(),this}finalize(e){e&&this._append(e);return this._doFinalize()}}class pe extends se{constructor(e,t){super();const n=new e;this._hasher=n;let r=t;"string"==typeof r&&(r=le.parse(r));const i=n.blockSize,o=4*i;r.sigBytes>o&&(r=n.finalize(t)),r.clamp();const s=r.clone();this._oKey=s;const u=r.clone();this._iKey=u;const a=s.words,c=u.words;for(let e=0;e<i;e+=1)a[e]^=1549556828,c[e]^=909522486;s.sigBytes=o,u.sigBytes=o,this.reset()}reset(){const e=this._hasher;e.reset(),e.update(this._iKey)}update(e){return this._hasher.update(e),this}finalize(e){const t=this._hasher,n=t.finalize(e);t.reset();return t.finalize(this._oKey.clone().concat(n))}}const me=[];class ge extends de{_doReset(){this._hash=new ue([1732584193,4023233417,2562383102,271733878,3285377520])}_doProcessBlock(e,t){const n=this._hash.words;let r=n[0],i=n[1],o=n[2],s=n[3],u=n[4];for(let n=0;n<80;n+=1){if(n<16)me[n]=0|e[t+n];else{const e=me[n-3]^me[n-8]^me[n-14]^me[n-16];me[n]=e<<1|e>>>31}let a=(r<<5|r>>>27)+u+me[n];a+=n<20?1518500249+(i&o|~i&s):n<40?1859775393+(i^o^s):n<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,u=s,s=o,o=i<<30|i>>>2,i=r,r=a}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0}_doFinalize(){const e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash}clone(){const e=super.clone.call(this);return e._hash=this._hash.clone(),e}}const he=de._createHelper(ge),ve=(de._createHmacHelper(ge),{stringify(e){const{words:t,sigBytes:n}=e,r=this._map;e.clamp();const i=[];for(let e=0;e<n;e+=3){const o=(t[e>>>2]>>>24-e%4*8&255)<<16|(t[e+1>>>2]>>>24-(e+1)%4*8&255)<<8|t[e+2>>>2]>>>24-(e+2)%4*8&255;for(let t=0;t<4&&e+.75*t<n;t+=1)i.push(r.charAt(o>>>6*(3-t)&63))}const o=r.charAt(64);if(o)for(;i.length%4;)i.push(o);return i.join("")},parse(e){let t=e.length;const n=this._map;let r=this._reverseMap;if(!r){this._reverseMap=[],r=this._reverseMap;for(let e=0;e<n.length;e+=1)r[n.charCodeAt(e)]=e}const i=n.charAt(64);if(i){const n=e.indexOf(i);-1!==n&&(t=n)}return((e,t,n)=>{const r=[];let i=0;for(let o=0;o<t;o+=1)if(o%4){const t=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;r[i>>>2]|=t<<24-i%4*8,i+=1}return ue.create(r,i)})(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="});const ye=function(e){let t=i.YP;const n=i.fS((()=>{const n=e();return t=i.G(n),n}));return()=>n(t)}((()=>({metadata:{178089:"0c8b70cdb7",180643:"c784c76f7e",180644:"22911a2329",180716:"24be4b370e",184118:"3071fc9d07",184423:"1e417447a0",184424:"86bfebdd8e",184485:"45546c04e4",184486:"e125dd01f0",184499:"01006e0e87",184500:"c04d9009d3",184619:"f842715556",184859:"6e0965d18c",184883:"f494102061",185436:"9c0dc9b920",185437:"734454175a",187070:"6b549242e1",187072:"d5fa2399f5",187717:"fb28082512",187718:"63ba7f1be8",187804:"78321fd987",187805:"9d8b6adde7",187806:"499362dfdc",192415:"fbf897f74f",192851:"830b64995e",193964:"db3537cdb7",194279:"d2f664deef"},runtime:ne({hash:function(e){return he(e).toString(ve).slice(0,8)},javaScriptInput:{ahoCorasickLookup:e=>[],eventSegments:e=>({"!UpdateThirdPartyData":["184486","184883","187718","187804","192851"],LinkClick:["184859","192415"],Pageview:["178089","180643","180644","180716","184118","184423","184424","184485","184499","184500","184619","184859","185436","185437","187070","187072","187717","187804","187805","192415","192851"],PageviewComplete:["184883"],PrebidBid:["184118","184423","184424","184499","184619","187070","187072","187717","187806","192851","193964"],SegmentEntry:["184883"],SlotClicked:["184423","184424","184499","184619","187070","187717","193964","194279"],VideoAdClick:["184619"]}),eventsLookup:e=>["Pageview","PrebidBid","SlotClicked","VideoAdClick","LinkClick"],interpretOnlyQueries:e=>({}),literalsLookup:e=>e.frontDecode("-ott\\t\\t/automotive and vehicles/auto parts\\t25\\tbuying and selling cars\\t25\\tcars/car culture\\t31\\toupe\\t30\\tperformance vehicles\\t30\\tsedan\\t25\\tvehicle brands\\t1\\ttechnology and computing/consumer electronics/game systems and consoles\\t47\\ttv and video equipment\\t69\\t/televisions/lcd tvs\\t26\\thardware/computer components\\t54\\t/chips and processors\\t55\\tsound cards\\t44\\tperipherals\\t43\\t/servers\\t26\\tinternet technology\\t45\\t/web search\\t56\\t/people search\\t26\\tnetworking/vpn and remote access\\t26\\toperating systems\\t26\\ttech news\\t\\tCULTURE\\t\\tMLS\\t1\\tanchester United\\t\\tTV Guide & Streaming\\t\\tUSA MLS\\t\\talvarez\\t1\\tndroid 14\\t1\\tpple\\t1\\tutodesk\\t4\\tguide.com\\t4\\tlist.com\\t4\\ttrader.co.uk\\t13\\tm\\t4\\tzone\\t\\tbet\\t1\\tmw\\t1\\tusiness\\t1\\tyd\\t\\tcarfax.com\\t3\\tgurus\\t3\\tmax.com\\t3\\ts.com\\t1\\thevrolet\\t1\\titroen\\t1\\tolombia\\t\\tdirecttv\\t\\tespn\\t\\tferrari\\t1\\tifa 22\\t1\\tord\\t1\\tubo\\t\\tgaming\\t1\\teneral motors\\t1\\tmc\\t\\thonda\\t1\\tttps://tv.univision.com/channels\\t1\\tyundai\\t\\tiphone os 17_\\t\\tkia\\t\\tmaruti\\t1\\tclaren\\t1\\tercedes\\t2\\txico\\t\\tnissan\\t\\tparamount\\t1\\teacock\\t1\\tlaystation\\t1\\tolstar\\t2\\trsche\\t1\\trimera\\t\\trenault\\t1\\todriguez\\t2\\tldan\\t\\tskoda.co.uk\\t1\\tling\\t1\\ttellantis\\t1\\tuzuki\\t\\ttechnology\\t2\\tsla\\t1\\tiffany.co.uk\\t1\\toyota brands\\t7\\tdealers\\t6\\t.co.uk\\t9\\tm\\t1\\tv.apple\\t\\tvauxhall\\t1\\tolkswagen\\t3\\tvo\\t\\twomen\\t1\\tww.dazn\\t\\txbox"),propertiesLookup:e=>[["advertiser_name"],["text"],["advertiser_id"],["client","title"],["label"],["primaryTagName"],["secondaryTagName"],["otherContentTags"],["parentCategoryName"],["childCategoryName"],["client","url"],["client","user_agent"],["dest_url"],["geo_info","country"]],queries:e=>({178089:e.r(2,0),180643:e.r(3,["doaFylgq"]),180644:e.r(3,["l2kSHxD3"]),180716:e.r(1,0,3,[36,"gambling","odds"]),184118:e.q(e.ocqs([e.cb(0,e.o([e.os(e.cx,7,["Gaming","FIFA 22","FIFA 21","FIFA 23"]),e.os(e.s,10,["ea-sports","fantasy","fc-24","fifa-22","fifa-23","football-manager","front-three",53,"ps4","ps5",92]),e.os(e.s,5,["fifa 21",50,"fifa 23",53]),e.os(e.s,6,["fifa 19",50,53])]),e.ge(1),1),e.cb(1,e.os(e.s,0,["activision","call of duty","ea fc","ea sports","eafc","easports","electronic arts","gamestop","konami","nintendo",68,"rockstar","sega","spinxgames.com","ubisoft",92]),e.ge(1),1),e.cb(0,e.af_u(["properties","classifications_watson","categories"],e.s_(4,"/hobbies and interests/games/video and computer games")),e.ge(1),1)])),184423:e.r(7,[29,"dell","hewlett-packard brands","lg","logitech","microsoft","oneplus","panasonic","pixel",68,"samsung","sonos","sony",92]),184424:e.r(8,[36,"ladbrokes","poker"],[e.pe(9,"Better Collective"),e.pe(["hasBettingLink"],!0),e.pe(8,"BETTING"),e.ps(["pageSubType"],"betting"),e.af_u(["properties","classifications_watson","entities"],e.y_(1,36))],[5537895979,5175623407,5501445809,4994075169,5005277922,5007535382,5107631456,5132405400,5199857904,5368738247,5525348637]),184485:e.r(5,0,e.o([e.pc_(7,24),e.ps(10,"Manchester-united"),e.ps(5,24),e.ps(6,24)]),2,0,e.af_u(["properties","classifications_watson","keywords"],e.o([e.e_(1,"Rasmus Hojlund"),e.e_(1,"Marcus Rashford"),e.e_(1,"Ten Hag"),e.e_(1,"Bruno Fernandes"),e.e_(1,"Man Utd")])),e.ge(3),3,2),184486:e.q(e.ocqs([e.itp("liveramp_Epsilon","1002890016",!1,"184486"),e.itp("eyeota","287",!1,"184486"),e.itp("liveramp_Epsilon","1000991499",!1,"184486")])),184499:e.r(8,["adidas brands","e.l.f. beauty","johnson & johnson brands","lacoste","new balance","next","nike brands","nike.com","puig",81,"under armour","underarmour.co.uk","underarmour.com","us.puma.com"],[e.y(8,22),e.ps(3,"kit"),e.ps(8,22),e.af_u(["properties","classifications_watson","keywords"],e.o([e.s_(1,"beauty"),e.s_(1,"fashion"),e.s_(1,"fitness")]))],[5618946659,5047830233,5181638091]),184500:e.q(e.cb(0,e.o([e.ps(9,"Women\'s football"),e.os(e.s,3,[90,"wsl"]),e.af_u(["properties","classifications_watson","keywords"],e.s_(1,90))]),e.ge(2),2)),184619:e.r(6,e.cb(3,e.bsc_(["ad","creative_id"],["5AuEIATs","D1DgIGV7","FfzgIGmq","NoEI3qJ0","ZYnpXcHF","bQuokjRx"]),e.ge(1),1),e.cb(3,e.bsc_(["ad","ad_id"],["MRzhjl3e"]),e.ge(1),1),e.cb(3,e.bsc_(["ad","title"],["H4cPdXGv","KgdjS0wL","KiKWh03e"]),e.ge(1),1),e.o([e.ps(9,"Business"),e.ps(3,38),e.af_u(["properties","classifications_watson","keywords"],e.s_(1,38))]),1,e.bsc_(0,["0CWQi6l3","3OFlIww6","R8GN9tLC","qGCay7TA","vocTcASk"]),2,e.pe(2,5023666259)),184859:e.r(4,0,e.o([e.pc_(7,23),e.ps(10,23),e.ps(5,26),e.ps(6,26),e.af_u(["properties","classifications_watson","keywords"],e.y_(1,23))]),3,4,3,5),184883:e.r(0,e.scq(e.cw("PageviewComplete",e.pc(["aggregations","SegmentEntry"],184486)),e.cw("SegmentEntry",e.pe(["segment_number"],184486)),e.ge(1)),[e.itp("eyeota","300",!1,"184883"),e.itp("eyeota","35435",!1,"184883"),e.itp("liveramp_Epsilon","1005785731",!1,"184883")]),185436:e.q(e.ltn(e.cb(0,e.ref(3),e.ge(1),1),0,1)),185437:e.r(9,2592e6,e.ref(3),3,3),187070:e.q(e.ocqs([e.cb(0,e.af_u(["properties","classifications_watson","categories"],e.o([e.e_(4,"/travel/specialty travel/ecotourism"),e.e_(4,"/travel/traveling with kids"),e.e_(4,"/travel/business travel")])),e.ge(1),1),e.cb(1,e.os(e.s,0,["aerlingus.com","aeromexico","air","easyjet.com","emirates","etihad","expedia brands","expedia.com","flight","holiday","hotel","qantas","train","travel"]),e.ge(1),1),e.cb(2,e.os(e.e,2,[5226963795,5360239376,5255476207,5614763233,5211453765]),e.ge(1),1)])),187072:e.r(4,1,e.ref(1),1,0,1,0),187717:e.r(7,["american express",29,"hilton","marriott","mercedes-benz group",81]),187718:e.q(e.itp("eyeota","35491",!1,"187718")),187804:e.r(6,e.itp("eyeota","304",!1,"187804"),e.itp("liveramp_Epsilon","1002889896",!1,"187804"),e.itp("eyeota","35480",!1,"187804"),e.ps(10,"/es"),0,e.ps(["language"],"es"),0,e.o([e.os(e.cx,7,[71,"Primera Division",74,73,"Colombia",27,"Guillermo Ochoa","Mexico"]),e.os(e.s,5,[27,46,"guillermo ochoa",64,71,73,74]),e.os(e.s,6,[27,46,64,"ochoa",71,73,74])])),187805:e.r(9,12096e5,e.t,4,4),187806:e.r(1,1,0,["deliveroo","eat","mars brands","snickers"]),192415:e.r(5,4,e.ref(5),1,0,e.o([e.y(5,25),e.y(6,25),e.pc_(7,25)]),e.ge(1),1,1),192851:e.r(0,e.ocqs([e.cb(1,e.ref(1),e.ge(1),1),e.cb(0,e.ref(0),e.ge(1),1),e.itp("eyeota","1469",!1,"192851")]),[e.itp("eyeota","35490",!1,"192851"),e.itp("eyeota","13018",!1,"192851")]),193964:e.r(5,1,e.os(e.s,0,["ab-inbev.com","bacardi","beam suntory inc.","beamsuntory.com","brown-forman.com","constellation brands","coronausa.com","diageo brands","flechatequila.com","guinness","heineken international","heineken.com","jack daniel","jamesons","michelobultra.com","miller lite","modelousa.com","molson coors beverage company","suntory beverage & food limited"]),1,2,e.os(e.e,2,[5338867817,5632622363]),e.ge(1),1,1),194279:e.r(2,2)}),rootCompressionLookup:e=>[(t,n)=>e.q(e.acqs([t,e.ocqs(n)])),(t,n,r)=>e.q(e.cb(t,e.os(e.s,n,r),e.ge(1),1)),t=>e.q(e.cb(t,e.t,e.ge(1),1)),t=>e.q(e.cb(0,e.bsc_(13,t),e.ge(1),1)),(t,n,r,i,o,s)=>e.q(e.ocqs([e.cb(t,n,e.ge(o),r),e.cb(i,e.ref(s),e.ge(1),1)])),(t,n,r,i,o,s,u,a)=>e.q(e.ocqs([e.cb(t,n,e.ge(a),r),e.cb(i,o,s,u)])),(t,n,r,i,o,s,u,a)=>e.q(e.ocqs([e.cb(0,i,e.ge(1),1),e.cb(o,s,e.ge(1),1),e.cb(u,a,e.ge(1),1),t,n,r])),t=>e.q(e.ocqs([e.cb(0,e.ref(4),e.ge(1),1),e.cb(1,e.os(e.s,0,t),e.ge(1),1),e.cb(2,e.ref(2),e.ge(1),1)])),(t,n,r)=>e.q(e.ocqs([e.cb(0,e.o(n),e.ge(1),1),e.cb(1,e.os(e.s,0,t),e.ge(1),1),e.cb(2,e.os(e.e,2,r),e.ge(1),1)])),(t,n,r,i)=>e.q(e.tw(e.cb(0,n,e.ge(i),r),t))],stateSyncReplays:e=>["185436"],subexpressionsLookup:e=>[e.af_u(["properties","classifications_watson","categories"],e.o([e.y_(4,2),e.y_(4,5),e.y_(4,3),e.y_(4,7),e.y_(4,4),e.y_(4,6),e.y_(4,1)])),e.os(e.s,0,[30,31,32,33,34,35,37,39,40,41,42,43,44,45,49,51,54,55,56,58,60,61,62,63,65,69,70,72,75,77,78,80,82,83,84,85,87,88,89]),e.os(e.e,2,[5032929097,5034541352,5171230769,5433690610]),e.af_i(["properties","classifications_watson","categories"],e.o([e.y_(4,10),e.y_(4,12),e.y_(4,9),e.y_(4,8),e.y_(4,13),e.y_(4,18),e.y_(4,17),e.y_(4,19),e.y_(4,14),e.y_(4,11),e.y_(4,15),e.y_(4,20),e.y_(4,16),e.y_(4,21)])),e.o([e.ps(3,79),e.os(e.s,11,[28,59]),e.af_u(["properties","classifications_watson","keywords"],e.s_(1,79))]),e.os(e.s,12,[0,47,48,52,57,66,67,76,86,91])]}})})));var _e=__webpack_require__(656),be=__webpack_require__(751);async function Ie(f){let{contextsInitTimestampPerformance:d,master:p}=f;const m=await p.next(),g=performance.now();Object.entries(m.globals??{}).forEach((e=>{let[t,n]=e;Object.defineProperty(self,t,{value:n})}));const h=new X(m.permutiveConfig);h.measureBetween("waiting_worker_high_priority_config",d,g);const v=function(t){var n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.RP;return t.loggingEnabled&&void 0!==(null===(n=self.console)||void 0===n?void 0:n.log)?new C(r):new T}(m.permutiveConfig,m.sdkInitTimestampDate),y=m.metricsEnabled?new U(m.sdkInitTimestampPerformance,m.timeOriginMainContext,v):new E;y.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"worker_evaluated",time_origin:"sdk_init"},d),y.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"worker_received_high_priority_config",time_origin:"sdk_init"},g);const _=(0,n.zG)(p.next,h.traceTask("waiting_worker_low_priority_config"))();_.then((()=>y.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"worker_received_low_priority_config",time_origin:"sdk_init"})));const b=(0,n.zG)((()=>p.read()),function(e,r){const i=e=>(0,n.zG)(e,M.Hd((e=>e in r)),(e=>{let{left:t,right:n}=e;return{buffers:n,nonBuffers:t}}));return o=>{const{buffers:s,nonBuffers:u}=i(e),[a,c]=t.Ue({...u,...(0,n.zG)(s,M.Su((e=>()=>{const t=s[e];return s[e]=r[e].empty,t})))});return(async()=>{for(;;){const e=(0,n.zG)(await o(),F.UI(i),F.ur({concat:(e,t)=>({nonBuffers:{...e.nonBuffers,...t.nonBuffers},buffers:(()=>{const n={...e.buffers};for(const e in t.buffers)n[e]=e in n?r[e].concat(n[e],t.buffers[e]):t.buffers[e];return n})()})})),t=(0,n.zG)(e.buffers,M.Su(((e,t)=>(s[e]=r[e].concat(s[e],t),()=>{const t=s[e];return s[e]=r[e].empty,t}))));c({...a.current,...e.nonBuffers,...t})}})(),(0,n.zG)(e,M.Su((e=>(0,n.zG)(a,t.UI((t=>t[e]))))))}}({contextualCohorts:i.YP,consent:m.consent,enrichmentReplacementMap:i.YP,eventSourceId:m.eventSourceId,identities:i.YP,newEvents:o.cS,pageviewState:m.pageviewState,priorCachedEventsResponses:o.cS,sessionId:m.sessionId,userId:m.userId,userIdIsNewlyGenerated:m.userIdIsNewlyGenerated,viewId:m.pageviewState.viewId,webClient:i.G(m.webClient)},{newEvents:o.uZ(),priorCachedEventsResponses:o.uZ()}),(0,s.rO)({newEvents:(0,_e.F)(y,"pageview_received_by_worker")}),(e=>({...e,currentTimestampSecs:Se((0,n.zG)(m.initialTimestampSecs,i.EQ((()=>0),(e=>e-Date.now()/1e3))))}))),{eventsCachedInWorker:I,coreService:S}=await function(s,f,d,p,m,g){p.debug("SDK core started",s);const h=500,v=new w(g),y=new G(s.permutiveConfig),_=new ee(y,s.permutiveConfig,v,g,p,(()=>d.webClient.current)),b=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_.reportError(e,null==t?void 0:t.userId,null==t?void 0:t.timestamp)},I=(0,n.zG)(u.Y3((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,965)).then((e=>e.watson))),(()=>"Failed to import watson.")),u.UI((e=>(0,n.zG)(d.webClient,t.UI(i.UI((e=>e.url))),t.D8(i.Eh(be.Eq)),(r=>e({config:s.permutiveConfig,metrics:g,permutiveApi:v,permutiveUrls:y,pageUrl:r,trace:m,watsonEnabled:(0,n.zG)(d.pageviewState,t.UI((e=>e.watsonEnabled)))})))))),S=(0,n.zG)(K.initialise(s.permutiveConfig,p,b,m,g,d.userId,(()=>(0,n.zG)(J.connect(new x(s.permutiveConfig),g,new D,s.organizationId,`events_${d.userId.current}`,`keys_${d.userId.current}`,"events",p,d.consent,s.isSecureContext),m.traceTask("connect_idb_events_cache")))),m.traceTask("initialise_events_cache"),u.At((()=>()=>g.trackTimeSinceInit("sdk_lifecycle_timestamps",{timestamp_name:"events_cache_initialised",time_origin:"sdk_init"},performance.now()))),u.EQ((e=>{p.error(`Worker failed to initialise IndexedDB event cache: ${e}`);const r={},[i,s]=t.gS(o.uZ()),u=()=>new Promise((e=>{const t=String(Math.random());r[t]=n=>{delete r[t],e(n)},s([[t,void 0]])}));return(0,n.zG)(d.priorCachedEventsResponses,t.UI((e=>(0,n.zG)(e(),o.UI((e=>{var t;let[n,i]=e;return null===(t=r[n])||void 0===t?void 0:t.call(r,i)})))))),{eventsCachedInWorker:!1,coreOutput:{priorCachedEventsRequests:i},coreConfig:{eventsCache:l.t$(u)}}}),(e=>({eventsCachedInWorker:!0,coreOutput:{priorCachedEventsRequests:t.a9(q.of(o.bM()))},coreConfig:{eventsCache:l.F2(e)}})))),U=(0,n.zG)(!0,u.DT(n.yR,(()=>"IndexedDB disabled.")),u.tS((()=>(0,n.zG)(k.K.initialise(new x(s.permutiveConfig),g,p,new D,`worker_${s.organizationId}`,"core_service_state","keys","core_service_state",4,s.isSecureContext),m.traceTask("initialise-core-idb")))),u.tS((e=>(0,z.Yt)(u.Hi)({persistCoreState:a(e,"core"),persistLalState:a(e,"lal")})))),E=()=>new Promise((e=>(0,n.zG)(d.consent,t.YP((t=>{t&&e()}))))),P=o=>(0,n.zG)(u.fF(U),u.YO("servicePersistence"),u.Qt("eventsCache",u.fF((()=>o))),u.Qt("coreService",(0,n.zG)(u.Y3((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,373)).then((e=>e.service))),(e=>`Failed to import core service: ${e}`)),m.traceTask("import-core-service"))),u.Qt("lookalikeModelsService",u.Y3((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,963)).then((e=>e.lookalikeModelsService))),(()=>"Failed to import lookalike models."))),u.Qt("optimisedActivationsConfig",u.Y3((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,975)).then((e=>e.optimisedActivationsConfig))),(()=>"Failed to import lookalike models."))),u.Qt("watson",I),A.mU((()=>E)),u.UI((o=>{let{coreService:u,eventsCache:a,lookalikeModelsService:_,optimisedActivationsConfig:I,servicePersistence:S,watson:w}=o;const G={config:s.permutiveConfig,customQueries:ye(),logger:p,metrics:g,optimisedActivationsConfig:I,permutiveApi:v,permutiveUrls:y,reportError:b,trackPageviewComplete:s.trackPageviewComplete,migratedStateMaps:(0,n.zG)(i.lo(!s.isFirstPageview),i.EQ((()=>A.of({external:i.bM(),internal:i.bM()})),(()=>q.of(f.then((e=>e.migratedStateMaps)))))),trace:m,watson:i.G(w)};return(0,n.zG)(S,l.UI((o=>{let{persistCoreState:s,persistLalState:l}=o;return(0,n.zG)(_({...G,...d}),l,r.VS((o=>{let[l,f]=o;return(0,n.zG)(d,u({...G,...a.coreConfig,lookalikeModels:i.G(f)}),(p=h,m=t.a9(!1),r=>i=>{const{value:o,state:s}=r(i),[u,a]=t.Ue(s.current),c=(0,e.UM)((()=>a(s.current)),p),l=(0,n.zG)(t.vP(s,u),t.UI((e=>{let[t,n]=e;return t===n})));return(0,n.zG)(m,t.bw((e=>e&&c()))),{value:(0,n.bc)(l,o),state:(0,n.zG)(t.vP(m,s,u),t.UI((e=>{let[t,n,r]=e;return t?n:r})))}}),c(d.consent),s,r.UI((e=>{let[r,[i,o]]=e;return{...o,stateFlushed:(0,n.zG)(t.vP(l,r,i),t.UI((e=>{let[t,n,r]=e;return t&&n&&r})))}})));var p,m})),(e=>{const{value:n}=e({stopped:t.a9(!1),previousState:{}});return e=>({value:n,state:t.a9(void 0)})}))})),l.fS((e=>(p.warn("Worker running in non-persistent mode.",e),(0,n.zG)(d,u({...G,...a.coreConfig,lookalikeModels:i.YP}),r.Hr("stateFlushed",(()=>t.a9(!0))),c(d.consent))))),r.UI((e=>({...e,...a.coreOutput}))))})));return async()=>{const e=S(),t=P(e)(),{eventsCachedInWorker:n}=await e;return{eventsCachedInWorker:n,coreService:t}}}(m,_,b,v,h,y)();p.send({eventsCachedInWorker:I});const P=await S;var O,j;if(l.nM(P))return v.error(`Failed to start worker: ${P.left}`),void(null===(O=(j=self).close)||void 0===O||O.call(j));const L=P.right,Y=await _,$=(await L)({stopped:t.a9(!1),previousState:Y.previousState}),[N,Q]=t.Ue(y.getNoMetricsTracked());(0,e.UM)((()=>Q(y.getNoMetricsTracked())),100),function(e,r,o){const s=(0,n.zG)(t.vP(r),t.UI((0,n.ls)(M.UI((e=>"function"==typeof e?e:q.of(e))),(0,z.Yt)(q.G5))));let u=s.current();e(u),(0,n.zG)(s,t.YP((t=>{const r=t(),s=(0,n.zG)(r,M.z7(((e,t)=>{var n;return t!==u[e]&&(null===(n=o[e])||void 0===n||!n.isEmpty(t))})),i.DT((0,R.ff)(M.xb)));i.pC(s)&&(u={...u,...s.value},e(s.value))})))}(p.send,{activations:t.vP($.value.activations),cohorts:t.vP($.value.cohorts),context:$.value.context,eventsToPublish:$.value.eventsToPublish,eventsToPublishOnPageUnload:$.value.eventsToPublishOnPageUnload,externalData:$.value.externalData,geoIP:$.value.geoIP,metrics:(0,n.zG)(N,t.UI((()=>()=>y.consume()))),priorCachedEventsRequests:$.value.priorCachedEventsRequests,realtime:$.value.realtime,state:$.state,transitionsSinceInit:$.value.transitionsSinceInit,workerStateFlushed:$.value.stateFlushed,stateMigratedThisInitialisation:$.value.stateMigratedThisInitialisation},{eventsToPublish:{isEmpty:o.xb},metrics:{isEmpty:o.xb}})}function Se(n){const r=()=>Math.floor(Date.now()/1e3)+n,[i,o]=t.Ue(r());return(0,e.UM)((()=>o(r())),1e3),i}const we=t=>{const n=[],r=[],i=()=>{for(;n.length>0&&r.length>0;)r.shift()()},o=t=>new Promise((n=>{r.push((()=>n(t()))),(0,e.HJ)(i)}));return t.addEventListener("message",(0,e.GL)((t=>{null!==t.data&&(n.push(t.data),(0,e.HJ)(i))}))),{next:()=>o((()=>n.shift())),read:()=>o((()=>n.splice(0)))}};!async function(){const t=self;Ie({contextsInitTimestampPerformance:e.NC,master:{...we(t),send:e=>t.postMessage(e)}})}()})()})();',"Worker",void 0,void 0)}},477:e=>{e.exports=function(e,t,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([e])}catch(t){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(e),o=o.getBlob()}var s=i.URL||i.webkitURL,a=s.createObjectURL(o),u=new i[t](a,n);return s.revokeObjectURL(a),u}catch(r){return new i[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch(e){if(!r)throw Error("Inline worker is not supported");return new i[t](r,n)}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={},_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_0__;_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3992),(()=>{var e,t;(0,_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_0__.ho)(!0);const n="permutive.main.import_runWebSdk",r=`${n}_start`;null===(e=performance)||void 0===e||null===(t=e.mark)||void 0===t||t.call(e,r),(0,_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_0__.SF)((()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__,4095))))().then((e=>{var t,i;null===(t=performance)||void 0===t||null===(i=t.measure)||void 0===i||i.call(t,n,r),e.runSdk({contextsInitTimestampPerformance:_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_0__.NC,contextsInitTimestamp:_framework_compute_time_measurement__WEBPACK_IMPORTED_MODULE_0__.RP})})).catch(console.error)})()})();