@lucida-analytics/browser 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +4 -2
  3. package/dist/autocapture.d.ts +1 -1
  4. package/dist/{client-Bx4fCDvT.d.ts → client-fHMBaIXD.d.ts} +2 -2
  5. package/dist/consent.d.ts +6 -2
  6. package/dist/consent.js +1 -1
  7. package/dist/core.d.ts +3 -3
  8. package/dist/core.js +3 -3
  9. package/dist/correlate.d.ts +1 -1
  10. package/dist/early-access.d.ts +1 -1
  11. package/dist/experiments.d.ts +1 -1
  12. package/dist/flags.d.ts +1 -1
  13. package/dist/forms.d.ts +1 -1
  14. package/dist/guides.d.ts +1 -1
  15. package/dist/heatmaps.d.ts +1 -1
  16. package/dist/host-headers.d.ts +1 -1
  17. package/dist/index.d.ts +6 -4
  18. package/dist/index.js +2 -2
  19. package/dist/inspector.d.ts +1 -1
  20. package/dist/lucida.js +2 -2
  21. package/dist/recommendations.d.ts +1 -1
  22. package/dist/{recorder-TZCDQIZN.js → recorder-MHNUIAAP.js} +4 -4
  23. package/dist/replay.d.ts +2 -2
  24. package/dist/replay.js +1 -1
  25. package/dist/static/v0/consent.js +1 -1
  26. package/dist/static/v0/core.js +3 -3
  27. package/dist/static/v0/index.js +2 -2
  28. package/dist/static/v0/lucida.js +2 -2
  29. package/dist/static/v0/manifest.json +7 -7
  30. package/dist/static/{v0.1.11/recorder-TZCDQIZN.js → v0/recorder-MHNUIAAP.js} +4 -4
  31. package/dist/static/v0/replay.js +1 -1
  32. package/dist/static/v0.1.13/consent.js +1 -0
  33. package/dist/static/v0.1.13/core.js +3 -0
  34. package/dist/static/v0.1.13/index.js +3 -0
  35. package/dist/static/v0.1.13/lucida.js +3 -0
  36. package/dist/static/{v0.1.11 → v0.1.13}/manifest.json +7 -7
  37. package/dist/static/{v0/recorder-TZCDQIZN.js → v0.1.13/recorder-MHNUIAAP.js} +4 -4
  38. package/dist/static/{v0.1.11 → v0.1.13}/replay.js +1 -1
  39. package/dist/toolbar.d.ts +1 -1
  40. package/dist/{types-B_CVJeLI.d.ts → types-Chfj1wdu.d.ts} +9 -2
  41. package/dist/webmcp.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/storage.json +2 -2
  44. package/dist/static/v0.1.11/consent.js +0 -1
  45. package/dist/static/v0.1.11/core.js +0 -3
  46. package/dist/static/v0.1.11/index.js +0 -3
  47. package/dist/static/v0.1.11/lucida.js +0 -3
  48. /package/dist/static/{v0.1.11 → v0.1.13}/autocapture.js +0 -0
  49. /package/dist/static/{v0.1.11 → v0.1.13}/banner-TXLAMTQM.js +0 -0
  50. /package/dist/static/{v0.1.11 → v0.1.13}/chunk-AWIQCFGN.js +0 -0
  51. /package/dist/static/{v0.1.11 → v0.1.13}/chunk-B722OERZ.js +0 -0
  52. /package/dist/static/{v0.1.11 → v0.1.13}/chunk-EFNCQJI3.js +0 -0
  53. /package/dist/static/{v0.1.11 → v0.1.13}/chunk-IXDYCBAD.js +0 -0
  54. /package/dist/static/{v0.1.11 → v0.1.13}/chunk-UPPUYIIH.js +0 -0
  55. /package/dist/static/{v0.1.11 → v0.1.13}/correlate.js +0 -0
  56. /package/dist/static/{v0.1.11 → v0.1.13}/early-access.js +0 -0
  57. /package/dist/static/{v0.1.11 → v0.1.13}/experiments.js +0 -0
  58. /package/dist/static/{v0.1.11 → v0.1.13}/flags.js +0 -0
  59. /package/dist/static/{v0.1.11 → v0.1.13}/forms.js +0 -0
  60. /package/dist/static/{v0.1.11 → v0.1.13}/guides.js +0 -0
  61. /package/dist/static/{v0.1.11 → v0.1.13}/heatmaps.js +0 -0
  62. /package/dist/static/{v0.1.11 → v0.1.13}/host-headers.js +0 -0
  63. /package/dist/static/{v0.1.11 → v0.1.13}/inspector.js +0 -0
  64. /package/dist/static/{v0.1.11 → v0.1.13}/modules-FANMZRDJ.js +0 -0
  65. /package/dist/static/{v0.1.11 → v0.1.13}/persistent-G2OR2L2N.js +0 -0
  66. /package/dist/static/{v0.1.11 → v0.1.13}/recommendations.js +0 -0
  67. /package/dist/static/{v0.1.11 → v0.1.13}/toolbar.js +0 -0
  68. /package/dist/static/{v0.1.11 → v0.1.13}/validation-S6TYVWAI.js +0 -0
  69. /package/dist/static/{v0.1.11 → v0.1.13}/webmcp.js +0 -0
@@ -303,8 +303,15 @@ interface UrlPrivacy {
303
303
  maskCampaignParams?: boolean;
304
304
  /** Drop the `#fragment` from URLs (not for hash routers: their route lives there). */
305
305
  stripHash?: boolean;
306
+ /** Rewrite the URL path, in order, with `String.replace` semantics (a string is a regex source; a RegExp needs `g` to replace every match). Applies to every URL the SDK sends, `$pathname` and autocapture hrefs. */
307
+ pathRules?: Array<{
308
+ match: RegExp | string;
309
+ replace: string;
310
+ }>;
311
+ /** Replace id-like path segments (UUID, ULID, all digits >= 4, hex >= 16, mixed alphanumeric >= 20 with a digit) with `:id`. Default false. */
312
+ maskPathIds?: boolean;
306
313
  }
307
- /** Applies the rules to one URL string. */
314
+ /** Applies the rules to one URL string (absolute, or a path such as `$pathname` or a relative href). */
308
315
  declare function privatizeUrl(url: string, p: UrlPrivacy): string;
309
316
  /** beforeSend hook: rewrites the page-URL properties of the event, `$set` and `$set_once`. */
310
317
  declare function urlPrivacyHook(p: UrlPrivacy): BeforeSend;
@@ -356,7 +363,7 @@ interface StorageConfig {
356
363
  consentPersistence?: Persistence;
357
364
  }
358
365
  interface DeliveryConfig {
359
- /** Origin that serves the SDK's versioned static files (`/static/v<version>/...`). Default `apiHost`. */
366
+ /** Where the SDK's versioned static files (`/static/v<version>/...`) are served: an absolute URL or a path on this site (`/dashboard/lucida`, resolved against the page URL). Default `apiHost`. */
360
367
  assetHost?: string;
361
368
  /** Classic script only: modules to load from `assetHost` before the client starts. Refused in extension mode. */
362
369
  modules?: LazyModuleName[];
package/dist/webmcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { M as Module } from './types-B_CVJeLI.js';
1
+ import { M as Module } from './types-Chfj1wdu.js';
2
2
  import '@lucida-analytics/sdk-core';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucida-analytics/browser",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
package/storage.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "$comment": "Every cookie and storage key the Lucida browser SDK writes. Published for consent managers (Cookie Munch preset, docs/integrations/cookiemunch-preset.md). sdks/browser/test/storage-manifest.test.ts fails when the SDK source names an lc_* key that is not listed here.",
3
3
  "sdk": "@lucida-analytics/browser",
4
4
  "default_persistence": "cookie",
5
- "version": "0.1.11",
6
- "updated": "2026-11-16T00:00:00Z",
5
+ "version": "0.1.13",
6
+ "updated": "2026-11-17T00:00:00Z",
7
7
  "suffix_rule": {
8
8
  "applies_to": "every key with suffixed: true",
9
9
  "rule": "name + '_' + the last 8 word characters of the project's public key (key.replace(/\\W/g, '').slice(-8))",
@@ -1 +0,0 @@
1
- import{a as M,b as c}from"./chunk-IXDYCBAD.js";import"./chunk-EFNCQJI3.js";var a={onlyIfChanged:!0,cookie:!0};function g(n){if(n.gdprApplies===!1)return;let e=n.purpose?.consents??{},t=!!e[1]&&!!e[7];return{analytics:t,replay:t&&!!e[8],marketing:!!e[1]&&!!e[4]}}function m(n){let e=i=>i in n?n[i]==="granted":void 0,t={},s=e("analytics_storage");s!==void 0&&(t.analytics=t.replay=s);let o=e("ad_storage"),r=e("ad_user_data");return o!==void 0&&(t.marketing=o&&r!==!1),t}function v(n){let e=typeof n=="string"?n.split(","):n,t=e.includes("C0002");return{analytics:t,replay:t,marketing:e.includes("C0004")}}function y(n){return{analytics:!!n.statistics,replay:!!n.statistics,marketing:!!n.marketing}}function w(n,e){for(let[t,s]of Object.entries(e))typeof s=="boolean"&&n.categoryGrants.set(t,s)}function k(n,e){return{analytics:!!n.statistics,replay:e?!!n[e]:!!n.statistics,marketing:!!n.marketing}}var O=n=>{let e,s=u(()=>{let o=window.__tcfapi;return typeof o!="function"?!1:(o("addEventListener",2,(r,i)=>{if(!i||r.eventStatus!=="tcloaded"&&r.eventStatus!=="useractioncomplete")return;e=r.listenerId;let d=g(r);d&&c(n,d,"tcf",a)}),!0)});return()=>{s();let o=window.__tcfapi;e!==void 0&&typeof o=="function"&&o("removeEventListener",2,()=>{},e)}},U=n=>{let e=window,t=e.dataLayer??=[],s=r=>{let i=r;i&&typeof i=="object"&&i[0]==="consent"&&(i[1]==="default"||i[1]==="update")&&i[2]&&typeof i[2]=="object"&&c(n,m(i[2]),"gcm",a)};t.forEach(s);let o=t.push;return t.push=function(...r){return r.forEach(s),o.apply(this,r)},()=>{t.push=o}},x=n=>{let e=o=>{(typeof o=="string"||Array.isArray(o))&&c(n,v(o),"onetrust",a)},t=window,s=o=>e(o.detail??t.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",s),e(t.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",s)},_=n=>{let e=window,t=()=>{let o=e.Cookiebot;!o?.consent||o.hasResponse===!1||(w(n,o.consent),c(n,y(o.consent),"cookiebot",a))},s=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let o of s)window.addEventListener(o,t);return t(),()=>s.forEach(o=>window.removeEventListener(o,t))};function b(n){let e=n.ANALYTICS==="ACCEPT";return{analytics:e,replay:e,marketing:n.MARKETING==="ACCEPT"}}function u(n){if(n())return()=>{};let e=0,t=setInterval(()=>(n()||++e>40)&&clearInterval(t),250);return()=>clearInterval(t)}var f=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],L=n=>{let e,t=o=>{let r=o&&typeof o=="object"&&Object.keys(o).length?o:e?.getConsent?.();r&&Object.keys(r).length&&c(n,b(r),"osano",a)},s=u(()=>{if(e=window.Osano?.cm,!e)return!1;for(let o of f)e.addEventListener?.(o,t);return t(e.getConsent?.()),!0});return()=>{s();for(let o of f)e?.removeEventListener?.(o,t)}};function E(n,e="Lucida"){let t=n.find(r=>r.name.toLowerCase()===e.toLowerCase());if(!t)return;let s=t.consent?.status===!0,o=n.filter(r=>r.categorySlug==="marketing");return{analytics:s,replay:s,marketing:o.length>0&&o.every(r=>r.consent?.status===!0)}}var l=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function h(n="Lucida"){return e=>{let t=()=>{let i=window.UC_UI?.getServicesBaseInfo?.();if(!i)return!1;let d=E(i,n);return d?c(e,d,"usercentrics",a):e.log(`usercentrics: no service named "${n}"; consent left unchanged`),!0},s=()=>{t()};for(let r of l)window.addEventListener(r,s);let o=u(t);return()=>{o();for(let r of l)window.removeEventListener(r,s)}}}var S=h(),C=["CookieMunchOnConsentReady","CookieMunchOnChange"];function A(n,e){let t=e?.detail??{};for(let s of[t.receiptId,t.consentReceiptId,t.consentId,t.ledgerId,n.receiptId,n.consentReceiptId,n.consentId,n.ledgerId])if(typeof s=="string"&&s)return s.slice(0,128)}function T(n={}){return e=>{let t=s=>{let o=window.CookieMunch;if(!o?.consent||o.hasResponse!==!0)return;w(e,o.consent);let r=A(o,s);c(e,k(o.consent,n.replayCategory),"cookiemunch",{...a,...r?{receiptId:r}:{}})};for(let s of C)window.addEventListener(s,t);return t(),()=>C.forEach(s=>window.removeEventListener(s,t))}}var p=T();var I=n=>{n.consentUi={showBanner:async e=>(await import("./banner-TXLAMTQM.js")).showBanner(n,e),hideBanner:()=>{import("./banner-TXLAMTQM.js").then(e=>e.hideBanner())}}};var D=n=>(I(n),p(n));export{M as CONSENT_EVENT,c as applyConsent,I as consentBanner,D as consentModule,T as cookieMunchBridge,p as cookieMunchConsent,k as cookieMunchToConsent,_ as cookiebotConsent,y as cookiebotToConsent,U as gcmConsent,m as gcmToConsent,x as oneTrustConsent,v as oneTrustToConsent,L as osanoConsent,b as osanoToConsent,O as tcfConsent,g as tcfToConsent,h as usercentricsBridge,S as usercentricsConsent,E as usercentricsToConsent};
@@ -1,3 +0,0 @@
1
- var J="lc_consent";function ye(n,e,t){return e==="opt_in"?"opt_in":t==="opt_in"||t==="opt_out"||t==="cookieless"?t:e==="opt_out"?n:void 0}var me=["analytics","replay","marketing"],F=class{constructor(e){this.o=e;this.modeNow=e.mode??"opt_out",this.queueBeforeConsent=e.queueBeforeConsent??!1;let t=this.opens();this.state={analytics:t,replay:t,marketing:t},this.key=e.storageKey||J;let s=e.storage.get(this.key);if(s)try{let r=JSON.parse(s);for(let i of me)typeof r[i]=="boolean"&&(this.state[i]=r[i]);this.decided=me.some(i=>typeof r[i]=="boolean")}catch{}this.waiting=!!e.awaitRemote&&!this.decided,this.waiting&&(this.state={analytics:!1,replay:!1,marketing:!1})}o;modeNow;queueBeforeConsent;state;decided=!1;waiting;geoCookieless=!1;key;listeners=[];opens(){return this.modeNow==="opt_out"&&!(this.o.respectDnt&&this.o.dnt)}get mode(){return this.modeNow}get resolving(){return this.waiting}get anonymous(){return this.geoCookieless&&!this.decided}resolve(e){if(!this.waiting)return this.state.analytics;this.waiting=!1,(e==="opt_in"||e==="opt_out")&&(this.modeNow=e),this.geoCookieless=e==="cookieless";let t=!this.geoCookieless&&this.opens();return this.state={analytics:t,replay:t,marketing:t},t}get(){return{...this.state}}has(e){return this.state[e]}status(e="analytics"){return this.decided?this.state[e]?"granted":"denied":"pending"}get pending(){return this.waiting||this.modeNow==="opt_in"&&!this.state.analytics}set(e){let t=this.get();for(let s of me)e[s]!==void 0&&(this.state[s]=e[s]);this.decided=!0,this.waiting=!1,this.o.storage.set(this.key,JSON.stringify(this.state));for(let s of this.listeners)s(this.get(),t)}onChange(e){this.listeners.push(e)}},I=class{constructor(e,t){this.inner=e;this.allowed=t}inner;allowed;mem=new Map;get(e){return this.mem.has(e)?this.mem.get(e)??null:this.inner.get(e)}set(e,t){this.allowed()?this.inner.set(e,t):this.mem.set(e,t)}remove(e){this.allowed()?this.inner.remove(e):this.mem.set(e,null)}flushBuffered(){for(let[e,t]of this.mem)t===null?this.inner.remove(e):this.inner.set(e,t);this.mem.clear()}discardBuffered(){this.mem.clear()}};var Q=0,A=0;function Ke(n){let e=new Uint8Array(n),t=globalThis.crypto;if(t?.getRandomValues)t.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Math.floor(Math.random()*256);return e}function P(n=Date.now()){if(n>Q){Q=n;let i=Ke(2);A=((i[0]??0)<<8|(i[1]??0))&1023}else A++,A>4095&&(Q++,A=0);let e=Ke(8),t=new Uint8Array(16),s=Q;t[0]=Math.floor(s/2**40)&255,t[1]=Math.floor(s/2**32)&255,t[2]=Math.floor(s/2**24)&255,t[3]=Math.floor(s/2**16)&255,t[4]=Math.floor(s/2**8)&255,t[5]=s&255,t[6]=112|A>>8,t[7]=A&255,t[8]=128|(e[0]??0)&63;for(let i=1;i<8;i++)t[8+i]=e[i]??0;let r=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}var Ge="lc_identity",X=class{constructor(e,t,s=!1,r=!1){this.storage=e;this.cookieless=s;let i=e.get(Ge),a;try{a=i?JSON.parse(i):void 0}catch{a=void 0}if(a?.distinct_id)this.s=a;else if(s)this.s={distinct_id:"",anon_id:"",identified:!1};else{let u=t??P();this.s={distinct_id:u,anon_id:u,identified:r&&!!t},this.save()}}storage;cookieless;s;save(){this.storage.set(Ge,JSON.stringify(this.s))}get distinctId(){return this.s.distinct_id}get priorAnonId(){return this.s.identified&&this.s.anon_id&&this.s.anon_id!==this.s.distinct_id?this.s.anon_id:void 0}get isIdentified(){return this.s.identified}identify(e){if(!e||e===this.s.distinct_id)return e&&!this.s.identified&&(this.s.identified=!0,this.save()),{event:null};let t=this.s.distinct_id,s=!this.s.identified;return this.s={...this.s,distinct_id:e,identified:!0},this.save(),s&&t?{event:"$identify",anonDistinctId:t}:{event:"$identify"}}aliasProps(e,t){return{alias:e,distinct_id:t??this.s.distinct_id}}reset(e=!1){if(this.cookieless){this.s={distinct_id:"",anon_id:"",identified:!1};return}let t=e&&this.s.anon_id||P();this.s={distinct_id:t,anon_id:t,identified:!1},this.save()}};function N(n,e={}){let t=Math.min(e.maxMs??3e4,(e.baseMs??1e3)*2**n);return Math.round(t*(.5+.5*(e.random??Math.random)()))}function Ye(n){return n===0||n===408||n===429||n>=500}var Z=class{constructor(e){this.o=e;this.flushAt=e.flushAt??20,this.intervalMs=e.flushIntervalMs??5e3,this.maxSize=e.maxQueueSize??1e3,this.maxRetries=e.maxRetries??5,this.batchMax=Math.max(1,Math.min(e.maxBatchSize??1e3,1e3))}o;items=[];timer;attempt=0;inflight;closed=!1;warned404=!1;flushAt;intervalMs;maxSize;maxRetries;batchMax;get size(){return this.items.length}enqueue(e){this.closed||(this.items.push(e),this.items.length>this.maxSize&&this.o.onDrop?.(this.items.splice(0,this.items.length-this.maxSize),"queue_full"),this.items.length>=this.flushAt?this.flush():this.arm(this.intervalMs))}arm(e){this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},e))}disarm(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0}flush(e={}){if(this.disarm(),this.inflight)return this.inflight.then(()=>this.items.length?this.flush(e):void 0);if(!this.items.length)return Promise.resolve();let t=this.items.splice(0,this.batchMax),s=(this.o.clock??Date).now(),r=JSON.stringify({api_key:this.o.apiKey,batch:t,sent_at:new Date(s).toISOString()});this.o.log?.("send batch",t.length);let i=this.o.transport.send(this.o.url,r,e.beacon?{beacon:!0}:{}).then(a=>a,()=>({status:0,retryAfterMs:void 0})).then(a=>this.settle(t,a.status,!!e.beacon,a.retryAfterMs)).finally(()=>{this.inflight=void 0});return this.inflight=i,i}settle(e,t,s,r){if(t>=200&&t<300){this.attempt=0,this.items.length>=this.flushAt?this.flush():this.items.length&&this.arm(this.intervalMs);return}if(!Ye(t)||s||this.attempt>=this.maxRetries){t===404&&!this.warned404&&(this.warned404=!0,console.warn(`[lucida] ${this.o.url} returned 404, so events are being dropped. apiHost is probably wrong: use https://capture.lucidace.com (or your own capture host), not the app host.`)),this.o.onDrop?.(e,`status_${t}`),this.attempt=0;return}this.items.unshift(...e);let i=Math.max(N(this.attempt++,this.o.backoff),Math.min(r??0,6e4));this.o.log?.("retry in",i,"ms"),this.arm(i)}clear(){this.items=[],this.disarm()}async shutdown(){await this.flush(),this.closed=!0,this.disarm()}};var ve="lc_session";function Je(n,e,t){return typeof n=="number"&&Number.isInteger(n)&&n>=e&&n<=t?n*6e4:void 0}var Ft=6e4,Nt=10*36e5,Bt=24*36e5,Ut=/^([0-9a-f]{8})-?([0-9a-f]{4})-7[0-9a-f]{3}-/i;function qt(n,e){let t=Ut.exec(n);if(!t)return!0;let s=parseInt(t[1]+t[2],16);return s-e<=6e4&&e-s<=Bt}var ee=class{constructor(e,t={}){this.storage=e;this.o=t;this.idleMs=Math.min(Nt,Math.max(Ft,t.idleMs??30*6e4)),this.maxMs=t.maxMs??24*36e5,this.newOn=t.newOnEvents??[],this.clock=t.clock??{now:()=>Date.now()},this.bootstrapId=t.bootstrapId}storage;o;windowId=P();idleMs;maxMs;newOn;clock;bootstrapId;configure(e){this.o.idleMs===void 0&&(this.idleMs=Je(e.session_idle_minutes,1,600)??this.idleMs),this.o.maxMs===void 0&&(this.maxMs=Je(e.session_max_minutes,5,10080)??this.maxMs),this.o.newOnEvents===void 0&&Array.isArray(e.session_new_on_events)&&(this.newOn=e.session_new_on_events.filter(t=>typeof t=="string"&&t!==""))}read(){try{let e=this.storage.get(ve);return e?JSON.parse(e):void 0}catch{return}}touch(e,t){let s=this.clock.now(),r=this.read(),i=!!(r?.campaign&&e&&r.campaign!==e),a=t!==void 0&&this.newOn.includes(t),u=!r||Math.abs(s-r.last)>this.idleMs||Math.abs(s-r.start)>this.maxMs||i||a;return(u||!r)&&(r={id:!r&&this.bootstrapId&&qt(this.bootstrapId,s)?this.bootstrapId:P(s),start:s,last:s}),this.bootstrapId=void 0,r.last=s,e&&(r.campaign=e),this.storage.set(ve,JSON.stringify(r)),{sessionId:r.id,windowId:this.windowId,isNew:u}}startedAt(){return this.read()?.start}reset(){this.storage.remove(ve)}};function Qe(n,e){let t=n.get(e);if(t)try{return JSON.parse(t)}catch{return}}var te=class{constructor(e,t="lc_props",s){this.storage=e;this.key=t;this.persist=s;this.p=Qe(e,t)??{}}storage;key;persist;p;save(){let e=this.persist;this.storage.set(this.key,JSON.stringify(e?Object.fromEntries(Object.entries(this.p).filter(([t])=>e(t))):this.p))}register(e){Object.assign(this.p,e),this.save()}registerOnce(e){for(let[t,s]of Object.entries(e))t in this.p||(this.p[t]=s);this.save()}unregister(e){delete this.p[e],this.save()}all(){return{...this.p}}clear(){this.p={},this.storage.remove(this.key)}},ne=class{constructor(e){this.storage=e;this.g=Qe(e,"lc_groups")??{}}storage;g;set(e,t){this.g[e]=t,this.storage.set("lc_groups",JSON.stringify(this.g))}all(){return Object.keys(this.g).length?{...this.g}:void 0}clear(){this.g={},this.storage.remove("lc_groups")}};function Ht(n,e){let t=new Date(n??e);return(Number.isNaN(t.getTime())?new Date(e):t).toISOString()}var B=class{constructor(e){this.c=e;this.clock=e.clock??{now:()=>Date.now()},this.consent=new F({...e.consent,storage:e.consentStorage??e.storage}),this.gated=new I(e.storage,()=>this.consent.has("analytics")),this.storage=this.gated,this.identity=new X(this.gated,e.bootstrapDistinctId,e.cookieless,e.bootstrapIdentified),this.session=new ee(this.gated,{clock:this.clock,...e.session}),this.props=new te(this.gated,void 0,e.persistProperty),this.groupState=new ne(this.gated),this.queue=new Z({transport:e.transport,url:`${e.apiHost.replace(/\/+$/,"")}/v1/batch`,apiKey:e.apiKey,clock:this.clock,...e.log?{log:e.log}:{},...e.onDrop?{onDrop:e.onDrop}:{},...e.queue})}c;consent;identity;session;queue;storage;gated;props;groupState;clock;device;pre=[];listeners=[];captureListeners=[];sessionListeners=[];lastSession="";filter;get anonDistinctId(){return this.identity.priorAnonId}get distinctId(){return this.identity.distinctId}get deviceId(){return this.c.cookieless?"":(this.device||(this.device=this.gated.get("lc_device_id")||P(),this.gated.set("lc_device_id",this.device)),this.device)}get groups(){return this.groupState.all()}get sessionId(){return this.touchSession().sessionId}touchSession(e){let t=this.session.touch(this.c.campaignKey?.(),e);if(t.sessionId!==this.lastSession){this.lastSession=t.sessionId;for(let s of this.sessionListeners)s(t.sessionId,t.windowId)}return t}onSessionId(e){return this.sessionListeners.push(e),()=>{this.sessionListeners.splice(this.sessionListeners.indexOf(e),1)}}get sessionStart(){return this.session.startedAt()}getProperty(e){return this.props.all()[e]}setFilter(e){this.filter=e}onChange(e){this.listeners.push(e)}onCaptured(e){this.captureListeners.push(e)}emit(e){for(let t of this.listeners)t(e)}consentStatus(){return this.consent.status()}get anonymousOnReject(){return!!this.c.consent?.cookielessOnReject&&this.consent.status()==="denied"}capture(e,t={},s={}){let r=this.consent.has("analytics"),i=!r&&(this.anonymousOnReject||this.consent.anonymous),a=this.consent.pending&&(this.consent.queueBeforeConsent||this.consent.resolving);if(!r&&!i&&!a){this.c.log?.("dropped (no consent)",e);return}if(i&&(e==="$identify"||e==="$create_alias")){this.c.log?.("withheld (declined, anonymous mode)",e);return}let u=this.touchSession(e),p=this.c.enrich?.(e,t),h=this.consent.status()!=="pending",m=i?{}:{...p?.$set,...s.$set,...e==="$consent_updated"&&h?{$consent:this.consent.get()}:{}},_=i?{}:{...p?.$set_once,...s.$set_once},$=this.groupState.all(),g=i?"":this.identity.distinctId,v={uuid:P(this.clock.now()),event:e,...g?{distinct_id:g}:{},timestamp:Ht(s.timestamp,this.clock.now()),properties:{...this.props.all(),...p?.properties,...t,$session_id:u.sessionId,$window_id:u.windowId,$lib:this.c.library.name,$lib_version:this.c.library.version,...h?{$consent:this.consent.get()}:{}},...Object.keys(m).length?{$set:m}:{},...Object.keys(_).length?{$set_once:_}:{},...!i&&s.$unset?.length?{$unset:s.$unset}:{},...$?{$groups:$}:{}},b=this.filter?this.filter(v):v;if(!b){this.c.log?.("dropped (policy)",e);return}this.c.log?.("capture",e,b),this.c.onCapture?.(b);for(let S of this.captureListeners)S(b);return r||i?this.queue.enqueue(b):this.pre.length<(this.c.queue?.maxQueueSize??1e3)&&this.pre.push(b),b}identify(e,t,s){let r=this.identity.identify(e);(r.event||t||s)&&this.capture("$identify",r.anonDistinctId?{$anon_distinct_id:r.anonDistinctId}:{},{...t?{$set:t}:{},...s?{$set_once:s}:{}}),this.emit("identify")}alias(e,t){this.capture("$create_alias",this.identity.aliasProps(e,t))}reset(e={}){this.identity.reset(e.reuseAnonymousId),e.resetDeviceId&&(this.device=void 0,this.gated.remove("lc_device_id")),this.props.clear(),this.groupState.clear(),this.session.reset(),this.lastSession="",this.emit("reset")}register(e){this.props.register(e)}registerOnce(e){this.props.registerOnce(e)}unregister(e){this.props.unregister(e)}group(e,t,s){this.groupState.set(e,t),this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:s??{}}),this.emit("group")}getConsent(){return this.consent.get()}getConsentStatus(e="analytics"){return this.consent.status(e)}hasConsent(e){return this.consent.has(e)}setConsent(e){let t=this.consent.has("analytics"),s=e.analytics??t;if(t&&!s&&(this.capture("$opt_out"),this.queue.flush()),!t&&s&&(this.anonymousOnReject||this.consent.anonymous)&&this.queue.flush(),this.consent.set(e),!t&&s){this.gated.flushBuffered();for(let r of this.pre.splice(0))this.queue.enqueue(r);this.capture("$opt_in")}else t&&!s&&this.queue.clear();s||(this.pre.length=0),this.emit("consent")}applyRemote(e){this.session.configure(e),this.resolveConsent(ye(this.consent.mode,e.consent_mode,e.consent_default))}resolveConsent(e){if(!this.consent.resolving)return;let t=this.consent.resolve(e),s=this.pre.splice(0);if(t){this.gated.flushBuffered();for(let r of s)this.queue.enqueue(r)}else if(this.consent.anonymous){this.gated.discardBuffered();for(let r of s){if(r.event==="$identify"||r.event==="$create_alias")continue;let i={...r};delete i.distinct_id,delete i.$set,delete i.$set_once,delete i.$unset,this.queue.enqueue(i)}}else this.consent.queueBeforeConsent&&this.pre.push(...s);this.emit("consent")}optIn(){this.setConsent({analytics:!0,replay:!0,marketing:!0})}optOut(){this.setConsent({analytics:!1,replay:!1,marketing:!1})}flush(e){return this.queue.flush(e)}shutdown(){return this.queue.shutdown()}};function Xe(n){let e="";return t=>{for(e+=t;;){let s=/\r?\n\r?\n/.exec(e);if(!s)return;let r=e.slice(0,s.index);e=e.slice(s.index+s[0].length);let i="message",a,u=[];for(let p of r.split(/\r?\n/)){if(p.startsWith(":"))continue;let h=p.indexOf(":"),[m,_]=h<0?[p,""]:[p.slice(0,h),p.slice(h+1).replace(/^ /,"")];m==="event"?i=_??"":m==="data"?u.push(_??""):m==="id"&&(a=_)}u.length&&n(a===void 0?{event:i,data:u.join(`
2
- `)}:{event:i,data:u.join(`
3
- `),id:a})}}}var se=class{constructor(e){this.o=e}o;ctl;stopped=!0;timer;cursor=0;gen=0;polling=!1;start(){this.stopped&&(this.stopped=!1,this.loop(++this.gen))}stop(){this.stopped=!0,this.gen++,this.ctl?.abort(),this.timer&&clearTimeout(this.timer)}restart(){let e=!this.stopped;this.stop(),this.cursor=0,e&&this.start()}live(e){return!this.stopped&&e===this.gen}deliver(e){if(e.seq>this.cursor){this.cursor=e.seq;try{this.o.onIntervention(e)}catch(t){this.o.log?.("onIntervention threw",t)}}}url(e){let t=`distinct_id=${encodeURIComponent(this.o.distinctId())}${this.cursor?`&cursor=${this.cursor}`:""}`;return`${this.o.apiHost}${e}?${t}`}sleep(e){return new Promise(t=>{this.timer=setTimeout(t,e),this.timer.unref?.()})}async loop(e){let t=0;for(;this.live(e);){let s;try{let r=await this.connectOnce(e);if(r==="gone")return this.stop();r==="poll"?(t=0,s=this.o.pollMs??15e3):(r==="streamed"&&(t=0),s=N(t++,this.o.backoff))}catch(r){this.live(e)&&this.o.log?.("intervention stream error",r),s=N(t++,this.o.backoff)}if(!this.live(e))return;await this.sleep(s)}}async connectOnce(e){if(this.polling)return this.pollOnce(e);this.ctl=new AbortController;let t={Authorization:`Bearer ${this.o.apiKey}`,Accept:"text/event-stream"},s=await this.o.fetch(this.url("/v1/interventions/stream"),{headers:t,signal:this.ctl.signal});if(s.status===404)return"gone";if(!s.ok)return"failed";let r=s.body;if(!r||typeof TextDecoderStream>"u")return this.ctl.abort(),this.polling=!0,this.pollOnce(e);let i=Xe(u=>{if(!(u.event!=="intervention"||!this.live(e)))try{this.deliver(JSON.parse(u.data))}catch{this.o.log?.("bad intervention payload")}}),a=r.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:u,value:p}=await a.read();if(u)return"streamed";i(p)}}async pollOnce(e){this.ctl=new AbortController;let t=await this.o.fetch(this.url("/v1/interventions"),{headers:{Authorization:`Bearer ${this.o.apiKey}`},signal:this.ctl.signal});if(t.status===404)return"gone";if(!t.ok)return"failed";let s=await t.json();if(this.live(e))for(let r of s.data??[])this.deliver(r);return"poll"}};function be(n,e){let t=new Set,{whenConsented:s,disabled:r,...i}=e,a=new se({...i,distinctId:()=>n.distinctId,onIntervention:p=>{for(let h of[...t])h(p)}}),u=!1;return n.onChange(p=>{u&&((p==="identify"||p==="reset")&&a.restart(),p==="consent"&&(n.hasConsent("analytics")?a.start():a.stop()))}),{on(p){return t.add(p),!u&&!r&&(u=!0,s(()=>a.start())),()=>{t.delete(p)}},stop:()=>a.stop()}}function _e(n,e,t={}){let s=t.key??"lc_offline",r=t.maxBatches??50,i=t.maxBytes??1e6,a=t.isOnline??(()=>!0),u,p,h=()=>{try{let g=JSON.parse(e.get(s)??"[]");return Array.isArray(g)?g:[]}catch{return[]}},m=g=>{let v=g.reduce((b,S)=>b+S.body.length,0);for(;g.length>r||v>i&&g.length>1;)v-=g.shift().body.length;g.length?e.set(s,JSON.stringify(g)):e.remove(s)},_=g=>{m([...h(),...g]),u??=setTimeout(()=>{u=void 0,$.drain()},t.retryMs??3e4)},$={async send(g,v,b){if(!a())return _([{url:g,body:v}]),{status:200};let S=await n.send(g,v,b);return S.status!==0?S:(_([{url:g,body:v}]),{status:200})},drain(){return p??=(async()=>{let g=h();if(!g.length||!a())return;e.remove(s);let v=[];for(let[b,S]of g.entries())if((await n.send(S.url,S.body)).status===0){v.push(...g.slice(b));break}v.length&&_(v)})().finally(()=>{p=void 0}),p}};return $}function Se(n){let e=Object.keys(n);if(e.length===0)return{};let t={};for(let s of e)t[`$feature/${s}`]=n[s];return t.$active_feature_flags=e.filter(s=>n[s]!==!1).sort(),t}function U(n,e,t,s){return{key:n,value:e,enabled:e!==void 0&&e!==!1,...typeof e=="string"?{variant:e}:{},...t!==void 0?{payload:t}:{},reason:e===void 0?"not_found":s}}var T={started:"$ai_conversation_started",message:"$ai_message",feedback:"$ai_feedback",ended:"$ai_conversation_ended",outcome:"$ai_outcome"},Wt=["resolved","unresolved","escalated","abandoned","error"],Vt=4e3,zt=2e3,et=["wrong","useless","not helpful","unhelpful","doesn't work","does not work","didn't help","did not help","not what i asked","that's not it","stupid","terrible","awful","frustrating","frustrated","annoying","worst","hate","incorrect","nonsense","confusing","makes no sense","real person","human agent","talk to a human","speak to a human","wtf","ugh"],tt=["thanks","thank you","great","perfect","awesome","helpful","that worked","works now","solved","exactly"],W=n=>Array.from(n),ke=(n,e)=>W(n).slice(0,e).join(""),Kt=0xcbf29ce484222325n,Gt=0x100000001b3n,Yt=0xffffffffffffffffn,Jt=new TextEncoder;function Qt(n){let e=Kt;for(let t of Jt.encode(n))e=(e^BigInt(t))*Gt&Yt;return e}function nt(n){let e=(n.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).filter(r=>W(r).length>=2);if(!e.length)return;let t=new Array(64).fill(0);for(let r of e){let i=Qt(r);for(let a=0;a<64;a++)t[a]=(t[a]??0)+((i>>BigInt(a)&1n)===1n?1:-1)}let s=0n;for(let r=0;r<64;r++)(t[r]??0)>0&&(s|=1n<<BigInt(r));return s.toString(16).padStart(16,"0")}function st(n){let t=` ${n.toLowerCase().replace(/’/g,"'").replace(/[.,!?;:]/g," ").replace(/\s+/g," ").trim()} `,s=0;for(let i of et)t.includes(` ${i} `)&&(s++,t=t.split(` ${i} `).join(" "));let r=tt.filter(i=>t.includes(` ${i} `)).length;return s>r?-1:r>s?1:0}var rt=n=>W(n).filter(e=>e>="0"&&e<="9").map(Number);function Xt(n){let e=rt(n);if(e.length<13||e.length>19)return!1;let t=0;return e.reverse().forEach((s,r)=>t+=r%2===1?s>4?s*2-9:s*2:s),t%10===0}var Ze=String.raw`[\p{Alphabetic}\p{M}\p{Nd}\p{Pc}\p{Join_Control}]`,Zt=[[new RegExp(String.raw`(?<!${Ze})\p{Nd}(?:[ -]?\p{Nd}){12,18}(?!${Ze})`,"gu"),Xt],[/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g,()=>!0],[/\+?\p{Nd}[\p{Nd}\s().-]{7,}\p{Nd}/gu,en]];function en(n){let e=rt(n).length;return e>=10&&e<=15}var tn=n=>W(n).map(e=>/\s/u.test(e)?e:"*").join("");function xe(n){let e=n;for(let[t,s]of Zt)e=e.replace(t,r=>s(r)?tn(r):r);return e===n?void 0:e}function ot(n){if(typeof n!="string")return;let e=n.toLowerCase();return/^[0-9a-f]{32}$/.test(e)?e:void 0}var it=n=>typeof n=="string"&&Wt.includes(n)?n:void 0,q=(n,e)=>typeof n=="string"&&n?ke(n,e):void 0;function nn(n,e,t){let s=ke(e,t),r=xe(s);return r===void 0?{[n]:s}:{[n]:r,$ai_text_redacted:!0}}function at(n,e,t,s){if(n!=="user"&&n!=="assistant")return;let r={$ai_role:n,$ai_message_index:t,$ai_text_length:W(e).length};if(n==="user"){let i=nt(e);i!==void 0&&(r.$ai_text_hash=i),r.$ai_sentiment=st(e)}return s?{...r,...nn("$ai_text",e,Vt)}:r}function ct(n,e){let t=n.value;if(n.kind==="thumbs"&&t!==1&&t!==-1||n.kind==="rating"&&!(Number.isInteger(t)&&t>=1&&t<=5)||n.kind!=="thumbs"&&n.kind!=="rating"&&n.kind!=="comment")return;let s={$ai_feedback_kind:n.kind};if(n.kind!=="comment"&&(s.$ai_feedback_value=t),n.comment&&e){let r=ke(n.comment,zt);s.$ai_feedback_comment=xe(r)??r}return n.messageIndex!==void 0&&(s.$ai_message_index=n.messageIndex),s}function we(n,e){let t=it(n),s=q(e,64);return{...t?{$ai_outcome:t}:{},...s?{$ai_resolution:s}:{}}}function sn(){let n=globalThis.crypto,e=new Uint8Array(16);if(n?.getRandomValues)n.getRandomValues(e);else for(let s=0;s<16;s++)e[s]=Math.floor(Math.random()*256);e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let t=Array.from(e,s=>s.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function lt(n={}){let e={$ai_conversation_id:n.conversationId||sn()},t=(s,r)=>{r!==void 0&&(e[s]=r)};return t("$ai_agent_name",q(n.agentName,128)),t("$ai_agent_version",q(n.agentVersion,64)),t("$ai_topic",q(n.topic,128)),t("$ai_use_case",q(n.useCase,128)),t("$ai_trace_id",ot(n.traceId)),e}var H=class{next=0;common;emit;captureText;constructor(e,t={},s=!1){this.emit=e,this.captureText=s,this.common=lt(t)}get id(){return this.common.$ai_conversation_id}send(e,t){this.emit(e,{...this.common,...t})}start(){return this.send(T.started,{}),this}message(e,t,s={}){let r=s.index??this.next,i=at(e,t,r,this.captureText);return i?(this.next=r+1,this.send(T.message,i),!0):!1}feedback(e){let t=ct(e,this.captureText);return t?(this.send(T.feedback,t),!0):!1}end(e,t){this.send(T.ended,we(e,t))}outcome(e,t){let s=we(e,t);return s.$ai_outcome?(this.send(T.outcome,s),!0):!1}};var rn=["bot","crawl","spider","slurp","headlesschrome","phantomjs","puppeteer","playwright","lighthouse","pingdom","uptimerobot","facebookexternalhit","preview","scrapy","python-requests","go-http-client","cypress","lightpanda","hubspot","nessus","prerender","deepscan","screaming frog","sitebulb","turnitin","ia_archiver","chatgpt-user","app.hypefactors.com","google favicon","google web preview","-google","googleother","googleweblight","google-read-aloud","google-inspectiontool","google-hoteladsverifier","google-cloudvertexbot"];function dt(n,e=[]){let t=n.toLowerCase();return e.some(s=>s&&t.includes(s.toLowerCase()))?!0:rn.some(s=>t.includes(s))&&!/\bcubot\b/.test(t)}var O=["gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","igshid","msclkid","ttclid","li_fat_id","twclid","mc_cid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],ut="lc_click_ids";function pt(n,e=90,t=Date.now){let s,r=()=>{try{return JSON.parse(n.get(ut)??"{}")}catch{return{}}};return()=>{let i=r();if(location.search!==s){s=location.search;let u=new URLSearchParams(s),p=!1;for(let h of O){let m=u.get(h);m&&(i[h]={v:m.slice(0,512),t:t()},p=!0)}p&&n.set(ut,JSON.stringify(i))}let a={};for(let u of O){let p=i[u];p&&t()-p.t<e*864e5&&(a[u]=p.v)}return a}}function on(){return Array.from(document.querySelectorAll("meta[http-equiv]")).filter(n=>n.getAttribute("http-equiv")?.toLowerCase()==="content-security-policy").map(n=>n.getAttribute("content")??"")}function an(n){let e=new Map;for(let s of n.split(";")){let[r,...i]=s.trim().toLowerCase().split(/\s+/);r&&!e.has(r)&&e.set(r,i)}let t=e.get("style-src-elem")??e.get("style-src")??e.get("default-src");return!!t&&!(t.includes("'unsafe-inline'")&&!t.some(s=>s.startsWith("'nonce-")||s.startsWith("'sha")))}function gt(n,e){if(typeof document>"u")return()=>{};!e&&on().some(an)&&n("CSP hint: this page's Content-Security-Policy blocks inline <style>; set the `nonce` option so guides and the experiment veil render (see the Content Security Policy help page)");let t=s=>{let r=s;/^style-src/.test(r.effectiveDirective??"")&&r.blockedURI==="inline"&&n(`CSP hint: an inline style was blocked by ${r.effectiveDirective}${e?" (check that `nonce` matches the page's nonce)":"; set the `nonce` option"}`)};return document.addEventListener("securitypolicyviolation",t),()=>document.removeEventListener("securitypolicyviolation",t)}var cn=(n,e)=>n.slice(0,e);function ft(n){try{let e=new URL(n);return e.protocol==="data:"||e.protocol==="blob:"?e.protocol:e.origin+e.pathname}catch{return cn(n,64)}}function ht(n,e={}){if(typeof document>"u")return()=>{};let t=e.maxPerPage??20,s=new Set,r=i=>{let a=i,u={$csp_directive:a.effectiveDirective??a.violatedDirective,$csp_blocked_uri:ft(a.blockedURI??""),$csp_source_file:a.sourceFile?ft(a.sourceFile):void 0,$csp_line:a.lineNumber||void 0,$csp_column:a.columnNumber||void 0,$csp_disposition:a.disposition},p=[u.$csp_directive,u.$csp_blocked_uri,u.$csp_source_file,u.$csp_line].join("|");s.has(p)||s.size>=t||(s.add(p),n("$csp_violation",Object.fromEntries(Object.entries(u).filter(([,h])=>h!==void 0))))};return document.addEventListener("securitypolicyviolation",r),()=>document.removeEventListener("securitypolicyviolation",r)}var ln=["chrome-extension:","moz-extension:","safari-web-extension:","ms-browser-extension:"],mt=()=>typeof location<"u"&&ln.includes(location.protocol);function dn(n,e,t){let s=e.find(a=>n.startsWith(`${a}/`));if(!s)return n;let r=n.slice(s.length),i=r.search(/[?#]/);return s+t(i<0?r:r.slice(0,i))+(i<0?"":r.slice(i))}function yt(n,e,t,s){if(!s)return{transport:n,fetch:e};let r=i=>dn(i,t,s);return{transport:{send:(i,a,u)=>n.send(r(i),a,u)},fetch:((i,a)=>e(typeof i=="string"?r(i):i instanceof URL?r(i.href):i,a))}}var un="__LUCIDA_DEVTOOLS_HOOK__";function vt(n,e,t){let s=globalThis[un];if(!(!s||typeof s.emit!="function"||typeof s.attach!="function")){n.onCapture(r=>{try{s.emit(r)}catch{}});try{s.attach({projectKeyPrefix:n.apiKey.slice(0,8),apiHost:t,distinctId:()=>e.distinctId,loadToolbar:r=>e.loadToolbar(r),startReplay:async()=>n.replay?(await n.replay.start(!0),n.replay.isRecording()):!1,replayUrl:()=>e.getReplayUrl()})}catch{}}}var V=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function pn(n){let e={},t=new URLSearchParams(location.search);for(let s of[...V,...O,...n]){let r=t.get(s);r&&(e[`$${s}`]=r)}return e}var fn=["ref","referral","via","aff"];function bt(n){if(!n)return;let e=Array.isArray(n)?{params:n}:{params:n.params??fn,...n.category?{category:n.category}:{}};return e.params.length?e:void 0}function _t(n){let e=new URLSearchParams(location.search);for(let t of n){let s=e.get(t);if(s)return s.slice(0,256)}}function St(){let n=new URLSearchParams(location.search),e=V.map(t=>n.get(t)??"");return e.some(Boolean)?e.join("|"):void 0}function gn(n){try{return n?new URL(n).hostname:""}catch{return""}}var hn=()=>location.href.replace(/([?&])__lc_toolbar=[^&#]*&?/,"$1").replace(/[?&]$/,"");function mn(){let n=location.hash;return n.length>1?location.pathname+n.split("?")[0]:location.pathname}function wt(n,e,t=[],s=!1){let r={$current_url:hn(),$host:location.host,$pathname:s?mn():location.pathname,$referrer:document.referrer,$title:document.title,$screen_width:screen.width,$screen_height:screen.height,$viewport_width:window.innerWidth,$viewport_height:window.innerHeight,$browser_language:navigator.language,$timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};if(navigator.maxTouchPoints>1&&(r.$touch_points=navigator.maxTouchPoints),n!=="$pageview")return{properties:r};let i=pn(t);Object.assign(r,i);let a=e.$current_url??location.href,u=e.$referrer??document.referrer,p={$initial_referrer:u||"$direct",$initial_referring_domain:gn(u)||"$direct",$initial_current_url:a};for(let[h,m]of Object.entries(i))p[`$initial_${h.slice(1)}`]=m;return{properties:r,$set_once:p}}function kt(n,e,t=globalThis){e&&(t[typeof e=="string"?e:"lucida"]=n,typeof CustomEvent=="function"&&t.dispatchEvent?.(new CustomEvent("lucida:ready",{detail:n})))}var M=()=>{},Ce=()=>Promise.resolve(),xt={isInternal:!1,hasOptedOut:()=>!1,hasOptedIn:()=>!1,consentStatus:()=>"pending",getConsentStatus:()=>"pending",getConsent:()=>({analytics:!1,replay:!1,marketing:!1}),getAllFlags:()=>({}),isFeatureEnabled:()=>!1,getFlagResult:n=>U(n,void 0,void 0,"not_found"),getReplayUrl:()=>"",onSessionId:()=>M,onFlags:()=>M,onIntervention:()=>M,onConsent:()=>M,flush:Ce,shutdown:Ce,reloadFlags:Ce,loadToolbar:()=>Promise.resolve(!1),recommendations:n=>Promise.resolve({placement:n,strategy:"",items:[],shown:M,clicked:M})};function Ct(n){return new Proxy(()=>{},{get:(e,t)=>{if(!(typeof t!="string"||t==="then"))return n&&Object.hasOwn(xt,t)?xt[t]:Ct(!1)}})}var Pt=()=>Ct(!0);var $t="_lcid";var yn=(n,e)=>e.some(t=>{let s=t.replace(/^\./,"").toLowerCase();return n.toLowerCase()===s||n.toLowerCase().endsWith(`.${s}`)});function vn(n,e=Date.now()){let t=n.lastIndexOf("."),[s="",r]=n.slice(t+1).split("_",2),i=/^[0-9a-z]+$/.test(s)?parseInt(s,36):NaN,a=n.slice(0,t);if(t>0&&a.length<=200&&i<=e+5e3&&e-i<=12e4)return r&&/^[\w-]{1,64}$/.test(r)?{distinctId:a,sessionId:r}:{distinctId:a}}function It(n){if(!n?.length)return;let e=new URL(location.href),t=e.searchParams.get($t);if(t!==null){e.searchParams.delete($t),history.replaceState(history.state,"",e.toString());try{if(document.referrer&&!yn(new URL(document.referrer).hostname,n))return}catch{return}return vn(t)}}function Ot(n,e=Date.now){let t=n.eventsPerSecond??10,s=n.burst??100,r=s,i=e();return()=>{let a=e();return r=Math.min(s,r+(a-i)/1e3*t),i=a,r<1?!1:(r-=1,!0)}}var Pe="<masked>",bn=["password","passwd","pwd","pass","token","access_token","refresh_token","id_token","secret","client_secret","api_key","apikey","key","auth","authorization","code","otp","email","ssn"],_n=["$current_url","$referrer","$initial_referrer","$initial_current_url","$last_current_url"],Et=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Sn(n,e){let t=n,s=[...bn,...e.maskParams??[],...e.maskCampaignParams?[...V,...O]:[]];if(s.length){let r=t.indexOf("#"),i=r<0?t:t.slice(0,r),a=r<0?"":t.slice(r);t=i.replace(new RegExp(`([?&])(${s.map(Et).join("|")})=[^&]*`,"gi"),`$1$2=${Pe}`)+a}return e.stripHash&&(t=t.replace(/#.*$/,"")),t}function Rt(n){let e=new RegExp(`^\\$(initial_|last_)?(${[...V,...O].map(Et).join("|")})$`),t=s=>{let r;if(n.maskCampaignParams)for(let[i,a]of Object.entries(s))typeof a=="string"&&e.test(i)?(r??={...s})[i]=Pe:i==="$click_ids"&&a&&typeof a=="object"&&((r??={...s})[i]=Object.fromEntries(Object.keys(a).map(u=>[u,Pe])));for(let i of _n){let a=(r??s)[i];if(typeof a!="string")continue;let u=Sn(a,n);u!==a&&((r??={...s})[i]=u)}return r??s};return s=>({...s,properties:t(s.properties),...s.$set?{$set:t(s.$set)}:{},...s.$set_once?{$set_once:t(s.$set_once)}:{}})}function wn(n,e,t){let s=e;for(let r of n)try{let i=r(s);if(i==null)return null;if(typeof i!="object"||typeof i.event!="string")return t("beforeSend hook returned a non-event, dropping:",typeof i),null;s=i}catch(i){return t("beforeSend hook threw, dropping event:",i),null}return s}function kn(n,e=Math.random){return t=>n>=1?t:n<=0||e()>=n?null:{...t,properties:{...t.properties,$sample_rate:n}}}function xn(n){let e=new Set(n),t=s=>Object.fromEntries(Object.entries(s).filter(([r])=>!e.has(r)));return s=>({...s,properties:t(s.properties),...s.$set?{$set:t(s.$set)}:{},...s.$set_once?{$set_once:t(s.$set_once)}:{}})}var $e="lc_person_identified",re="lc_pending_set_once",At=new Set(["$identify","$create_alias","$groupidentify"]),Tt="$$client_ingestion_warning",Cn=6e4,Ie=class{constructor(e,t){this.mode=e;this.storage=t;this.identified=t.get($e)==="1";try{this.pending=JSON.parse(t.get(re)??"{}")}catch{this.pending={}}}mode;storage;identified;pending;get blocksPersonWrites(){return this.mode==="never"}get isProfile(){return this.mode==="always"||this.mode==="identified_only"&&this.identified}markIdentified(){this.mode!=="identified_only"||this.identified||(this.identified=!0,this.storage.set($e,"1"))}personless(e){return this.mode==="always"?!1:(this.mode==="never"||!this.identified)&&!At.has(e)}stash(e){if(this.mode!=="identified_only"||!e)return;let t=Object.entries(e).filter(([s])=>!(s in this.pending));t.length&&(this.pending={...this.pending,...Object.fromEntries(t)},this.storage.set(re,JSON.stringify(this.pending)))}take(){if(!Object.keys(this.pending).length)return;let e=this.pending;return this.pending={},this.storage.remove(re),e}reset(){this.identified=!1,this.pending={},this.storage.remove($e),this.storage.remove(re)}};function Pn(n,e){let t=e,s;if(n.person.personless(e.event)){n.person.stash(e.$set_once);let{$set:i,$set_once:a,$unset:u,...p}=e;t={...p,properties:{...e.properties,$process_person_profile:!1}}}else(s=n.person.take())&&(t={...e,$set_once:{...e.$set_once,...s}});let r=n.hooks.length?wn(n.hooks,t,n.log):t;return r&&n.limit&&!n.limit()&&(n.log("rate limited, dropped",r.event),n.onLimited?.(),r=null),!r&&s&&n.person.stash(s),r}function $n(n){let e=n.beforeSend?Array.isArray(n.beforeSend)?n.beforeSend:[n.beforeSend]:[];return[Rt(n.urlPrivacy??{}),...n.propertyDenylist?.length?[xn(n.propertyDenylist)]:[],...n.sampleRate!==void 0?[kn(n.sampleRate)]:[],...e]}function Mt(n,e,t,s=Date.now){let r=new Ie(e.personProfiles??"always",n.storage),i,a,u=0,p=-1/0,h=()=>{u+=1,!(s()-p<Cn)&&(p=s(),queueMicrotask(()=>{let m=u;u=0,n.capture(Tt,{$$client_ingestion_warning_message:`client rate limit dropped ${m} event(s)`,$dropped_count:m})}))};return n.setFilter(m=>(e.rateLimit!==i&&(i=e.rateLimit,a=i?Ot(i):void 0),Pn({hooks:$n(e),person:r,limit:m.event===Tt?void 0:a,log:t,onLimited:h},m))),r}var Oe=class{m=new Map;get(e){return this.m.get(e)??null}set(e,t){this.m.set(e,t)}remove(e){this.m.delete(e)}},In=365,On=new Set("co.uk org.uk ac.uk gov.uk me.uk ltd.uk plc.uk net.uk com.au net.au org.au edu.au gov.au co.nz org.nz net.nz co.jp ne.jp or.jp ac.jp go.jp co.kr or.kr com.cn net.cn org.cn com.hk com.tw com.sg com.my co.in net.in org.in co.id co.th com.ph com.vn com.br net.br org.br com.ar com.mx com.co com.pe com.tr com.ua com.pl co.za co.il com.eg com.sa com.ng co.ke github.io gitlab.io vercel.app netlify.app herokuapp.com pages.dev workers.dev web.app firebaseapp.com azurewebsites.net cloudfront.net appspot.com onrender.com fly.dev glitch.me repl.co blogspot.com wordpress.com myshopify.com vercel.dev netlify.com surge.sh render.com railway.app koyeb.app deno.dev ngrok.io ngrok-free.app trycloudflare.com cloudfunctions.net run.app s3.amazonaws.com elasticbeanstalk.com azurestaticapps.net wixsite.com webflow.io framer.app bubbleapps.io".split(" ")),En=new Set("co com net org edu gov gob go ac or ne ltd plc sch mil nom".split(" "));function Rn(n){let e=n.toLowerCase().split(".");for(let t=1;t<e.length-1;t++)if(On.has(e.slice(t).join("."))||t===e.length-2&&e[t+1].length===2&&En.has(e[t]))return e.slice(t-1).join(".")}function An(n=location.hostname){if(/^[\d.]+$/.test(n)||n.includes(":"))return;let e=n.split(".");for(let t=e.length-2;t>=0;t--){let s=e.slice(t).join(".");if(document.cookie=`__lc_probe=1; Domain=${s}; Path=/; Max-Age=10; SameSite=Lax`,document.cookie.includes("__lc_probe=1"))return document.cookie=`__lc_probe=; Domain=${s}; Path=/; Max-Age=0`,s}return Rn(n)}var oe=class{constructor(e={}){this.o=e}o;domain=null;attr(){if(this.domain===null)try{this.domain=this.o.domain??(this.o.crossSubdomain?An():void 0)}catch{this.domain=void 0}return this.domain?`; Domain=${this.domain}`:""}held=new Map;read(e){try{for(let t of document.cookie.split("; ")){let s=t.indexOf("=");if(t.slice(0,s)===e)return decodeURIComponent(t.slice(s+1))}}catch{}return null}get(e){return this.read(e)??this.held.get(e)??null}set(e,t){let s=this.o.secure??location.protocol==="https:"?"; Secure":"",r=Math.round((this.o.expiryDays??In)*86400);try{document.cookie=`${e}=${encodeURIComponent(t)}; Max-Age=${r}; Path=/${this.attr()}; SameSite=Lax${s}`}catch{}this.read(e)===t?this.held.delete(e):this.held.set(e,t)}remove(e){this.held.delete(e);try{document.cookie=`${e}=; Max-Age=0; Path=/${this.attr()}; SameSite=Lax`}catch{}}},j=class{constructor(e="localStorage"){this.kind=e}kind;store(){try{return globalThis[this.kind]}catch{return}}get(e){try{return this.store()?.getItem(e)??null}catch{return null}}set(e,t){try{this.store()?.setItem(e,t)}catch{}}remove(e){try{this.store()?.removeItem(e)}catch{}}},Ee=class extends j{constructor(){super("localStorage")}},Tn=["lc_identity","lc_session","lc_device_id","lc_consent","lc_person_identified"],Re=class{constructor(e,t,s){this.cookie=e;this.local=t;this.cookieKeys=s}cookie;local;cookieKeys;get(e){let[t,s]=this.cookieKeys(e)?[this.cookie,this.local]:[this.local,this.cookie];return t.get(e)??s.get(e)}set(e,t){this.local.set(e,t),this.cookieKeys(e)?this.cookie.set(e,t):this.cookie.remove(e)}remove(e){this.local.remove(e),this.cookie.remove(e)}},ie=class{constructor(e,t){this.inner=e;this.delayMs=t}inner;delayMs;pending=new Map;timer;get(e){return this.pending.has(e)?this.pending.get(e)??null:this.inner.get(e)}set(e,t){this.queue(e,t)}remove(e){this.queue(e,null)}queue(e,t){this.pending.set(e,t),this.timer??=setTimeout(()=>this.flush(),this.delayMs)}flush(){clearTimeout(this.timer),this.timer=void 0;for(let[e,t]of this.pending)t===null?this.inner.remove(e):this.inner.set(e,t);this.pending.clear()}},Ae=class{constructor(e,t){this.inner=e;this.suffix=t}inner;suffix;get(e){return this.inner.get(e+this.suffix)}set(e,t){this.inner.set(e+this.suffix,t)}remove(e){this.inner.remove(e+this.suffix)}},ae=n=>`_${n.replace(/\W/g,"").slice(-8)}`;function ce(n,e,t){if(n==="memory"||n==="none")return new Oe;let s=ae(e),r=n==="cookie"?new oe(t):n==="localStorage+cookie"?new Re(new oe(t),new Ee,i=>Tn.some(a=>i===a+s)):new j(n);return new Ae(r,s)}function jt(n,e,t){let s=ae(e),r=new Set;try{for(let i of document.cookie.split("; "))r.add(i.split("=")[0]);for(let i of[globalThis.localStorage,globalThis.sessionStorage])for(let a=0;a<i.length;a++)r.add(i.key(a))}catch{}for(let i of r)if(!(!i.startsWith("lc_")||!i.endsWith(s)||i===t+s)){n.remove(i.slice(0,-s.length));try{localStorage.removeItem(i),sessionStorage.removeItem(i)}catch{}}}async function Mn(n){if(!(typeof CompressionStream>"u"||typeof Response>"u"))try{let e=new Response(n).body?.pipeThrough(new CompressionStream("gzip"));return e?new Uint8Array(await new Response(e).arrayBuffer()):void 0}catch{return}}function Dt(n,e={}){let t=e.compress??!0,s=(r,i)=>(e.onError?.({url:r,status:i}),{status:i});return{async send(r,i,a){if(a?.beacon&&!e.disableBeacon&&typeof navigator<"u"&&navigator.sendBeacon)return navigator.sendBeacon(r,new Blob([i],{type:"text/plain"}))?{status:200}:s(r,0);try{let u=t&&i.length>=1024?await Mn(i):void 0,p=await n(u?`${r}${r.includes("?")?"&":"?"}compression=gzip`:r,{method:"POST",body:u??i,headers:{...e.headers,"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",keepalive:(u?.length??i.length)<6e4});return p.status>=400?s(r,p.status):{status:p.status}}catch{return s(r,0)}}}}var Te={send:async()=>({status:200})};var jn="lucida-browser",Dn="0.1.11",Me="lc_internal",Ln=3e3,Lt="https://capture.lucidace.com",je=n=>!!n&&typeof n=="object"&&Object.getPrototypeOf(n)===Object.prototype;function De(n,e={},t=[]){if(typeof window>"u"||typeof navigator>"u")return Pt();let s=!!e.debug||typeof location<"u"&&/[?&]__(lc|lucida)_debug=(1|true)/.test(location.search),r=(...o)=>{s&&console.debug("[lucida]",...o)},i=(e.apiHost??Lt).replace(/\/+$/,""),a=Object.fromEntries(Object.entries(e).map(([o,c])=>[o,je(c)?{...c}:c]));a.apiHost=i;let u=e.extension??mt(),p=o=>u&&(o==="cookie"||o==="localStorage+cookie")?e.extensionPersistence??"localStorage":o,h=p(e.cookieless==="always"?"none":e.persistence??"cookie"),m=[i,...e.flagsApiHost?[e.flagsApiHost.replace(/\/+$/,"")]:[]],_=e.fetch??((...o)=>fetch(...o)),$=o=>yt(o,_,m,e.rewritePath),g=$(Te).fetch,v=e.consent?.respectDnt,b=navigator.globalPrivacyControl===!0,S=(e.respectDnt??v)===!0&&navigator.doNotTrack==="1"||(e.respectGpc??v)===!0&&b,Le=e.blockBots!==!1&&typeof navigator<"u"&&dt(navigator.userAgent??"",e.blockedUserAgents),k=!!e.disabled||Le;Le&&r("bot user agent: capture disabled");let le,de=$(e.transport??Dt(_,{headers:a.requestHeaders,onError:e.onRequestError,disableBeacon:e.disableBeacon})).transport;if(!e.transport&&e.offlineQueue!==!1&&h!=="memory"&&h!=="none"){let o=new I(new j(h==="sessionStorage"?"sessionStorage":"localStorage"),()=>l.hasConsent("analytics"));de=le=_e(de,o,{key:`lc_offline${ae(n)}`,isOnline:()=>navigator.onLine!==!1})}let z=k?void 0:It(e.crossDomains),ue=ce(k?"memory":h,n,e.cookie),K=(e.storageWriteDelayMs??0)>0?new ie(ue,e.storageWriteDelayMs):void 0,Fe=z?.sessionId??e.bootstrap?.sessionId,pe,G=!1,Ne,Be=new Map,Ue,fe=[],l=new B({apiKey:n,apiHost:i,transport:k?Te:de,storage:K??ue,...e.consentPersistence&&!k?{consentStorage:ce(p(e.consentPersistence),n,e.cookie)}:{},persistProperty:o=>!a.persistedProperties||a.persistedProperties.includes(o),...h==="none"?{cookieless:!0}:{},library:{name:jn,version:Dn},consent:{...e.cookieless==="on_reject"?{cookielessOnReject:!0}:{},...e.consent,...!k&&(e.consent?.geo||e.consent?.mode!=="opt_in")?{awaitRemote:!0}:{},respectDnt:!0,dnt:S},queue:{...e.flushAt?{flushAt:e.flushAt}:{},...e.flushIntervalMs?{flushIntervalMs:e.flushIntervalMs}:{}},...z||e.bootstrap?.distinctId?{bootstrapDistinctId:z?.distinctId??e.bootstrap?.distinctId}:{},...e.bootstrap?.isIdentified&&!z?{bootstrapIdentified:!0}:{},session:{...e.session,...Fe?{bootstrapId:Fe}:{}},enrich:(o,c)=>{let d=wt(o,c,a.customCampaignParams,e.capturePageview==="hash");if(i!==Lt&&(d.properties={...d.properties,$lib_custom_api_host:i}),fe.length){let C=l.sessionId;for(let R of fe)d.properties={...d.properties,...R(C)}}if(o==="$pageview"){let C=l.sessionId;if(C!==Ne){let R=bt(e.referralParams);if(R&&(!R.category||Be.get(R.category)===!0)){Ne=C;let he=_t(R.params);he&&(d.properties={...d.properties,$referral_code:he},d.$set_once={...d.$set_once,initial_referral_code:he})}}}let y=Ue?.()??{},w=Object.keys(y);return w.length&&(d.properties={...d.properties,$click_ids:y},o==="$pageview"&&(d.$set_once={...Object.fromEntries(w.map(C=>[`$initial_${C}`,y[C]])),...d.$set_once},d.$set=Object.fromEntries(w.map(C=>[`$last_${C}`,y[C]])))),a.sendFeatureFlags!==!1&&o!=="$snapshot"&&pe&&(d.properties={...Se(pe.all()),...d.properties}),G?{...d,properties:{...d.properties,$internal:!0}}:d},campaignKey:St,log:r});G=l.storage.get(Me)==="1",e.clickIds!==!1&&(Ue=pt(l.storage,e.clickIds?.expiryDays));let x=Mt(l,a,r);e.bootstrap?.isIdentified&&x.markIdentified();let D=o=>x.blocksPersonWrites?(r(`personProfiles=never: ${o} ignored`),!0):!1;k||l.onChange(o=>{o!=="consent"||l.hasConsent("analytics")||l.consentStatus()!=="denied"||(K?.flush(),jt(ue,n,e.consent?.storageKey||J))});let ge=new Set;l.onChange(o=>{o==="consent"&&[...ge].forEach(c=>c())});let qe=[],E=[gt(r,e.nonce)],He=l.storage;if(e.flagPersistence&&!k){let o=new I(ce(p(e.flagPersistence),n,e.cookie),()=>l.hasConsent("analytics"));l.onChange(c=>{c==="consent"&&(l.hasConsent("analytics")?o.flushBuffered():o.discardBuffered())}),He=o}let Y=o=>{if(k)return;if(l.hasConsent("analytics"))return o();let c=!1;l.onChange(d=>{!c&&d==="consent"&&l.hasConsent("analytics")&&(c=!0,o())})},We,f={core:l,client:void 0,config:a,flagStorage:He,apiKey:n,log:r,fetch:g,onUnload:o=>{qe.push(o)},whenConsented:Y,onCapture:o=>l.onCaptured(o),eventExtras:fe,clickExtras:[],flagPersonProps:[],categoryGrants:Be,loadConfig:()=>We??=new Promise(o=>Y(()=>{g(`${i}/v1/config?api_key=${encodeURIComponent(n)}`).then(c=>c.ok?c.json():null).then(c=>(c&&l.applyRemote(c),c)).then(o,()=>o(null))}))},Ve=Promise.resolve();if(l.consent.resolving){let o=!1,c=g(`${i}/v1/config?api_key=${encodeURIComponent(n)}`,{credentials:"omit"}).then(d=>(o=d.status>=500,d.ok?d.json():null)).catch(()=>(o=!0,null));We=c,Ve=new Promise(d=>{let y=setTimeout(()=>(l.resolveConsent("opt_in"),d()),Ln);c.then(w=>{clearTimeout(y),w?l.applyRemote(w):o?l.resolveConsent("opt_in"):l.applyRemote({}),d()})})}let ze=be(l,{apiHost:i,apiKey:n,fetch:g,whenConsented:Y,log:r,disabled:k});E.push(()=>ze.stop());let L={get distinctId(){return l.distinctId},capture:(o,c,d)=>{l.capture(o,c,d?.timestamp!==void 0?{timestamp:d.timestamp}:{})&&(d?.sendInstantly||d?.transport)&&l.flush(d.transport==="beacon"?{beacon:!0}:{})},identify:(o,c,d)=>{D("identify")||(x.markIdentified(),l.identify(o,c,d))},alias:(o,c)=>{D("alias")||(x.markIdentified(),l.alias(o,c))},reset:o=>{l.reset({resetDeviceId:!!o,reuseAnonymousId:!!e.reuseAnonymousId}),x.reset()},createPersonProfile:()=>{D("createPersonProfile")||x.isProfile||(x.markIdentified(),l.capture("$set",{}))},setConfig:o=>{let c=a;for(let[d,y]of Object.entries(o)){let w=c[d];je(w)&&je(y)?Object.assign(w,y):c[d]=y}"debug"in o&&(s=!!o.debug)},setPersonProperties:(o,c)=>{!o&&!c||D("setPersonProperties")||(x.markIdentified(),l.capture("$set",{},{...o?{$set:o}:{},...c?{$set_once:c}:{}}))},unsetPersonProperties:o=>{!o.length||D("unsetPersonProperties")||(x.markIdentified(),l.capture("$set",{},{$unset:o}))},getDistinctId:()=>l.distinctId,getSessionId:()=>l.sessionId,onSessionId:o=>l.onSessionId(c=>o(c)),getProperty:o=>l.getProperty(o),hasOptedOut:()=>l.consentStatus()==="denied",hasOptedIn:()=>l.consentStatus()==="granted",onConsent:o=>(ge.add(o),()=>{ge.delete(o)}),getReplayUrl:o=>{let d=`${(e.uiHost??i).replace(/\/+$/,"")}/replays/${encodeURIComponent(l.sessionId)}`,y=l.sessionStart;return!o?.withTimestamp||y===void 0?d:`${d}?t=${Math.max(0,Math.round((Date.now()-y)/1e3-(o.timestampLookBackSeconds??10)))}`},debug:(o=!0)=>{s=o},featureView:(o,c)=>{l.capture("$feature_view",{...c,$feature_flag:o},{$set:{[`$feature_view/${o}`]:!0}})},featureInteraction:(o,c)=>{l.capture("$feature_interaction",{...c,$feature_flag:o},{$set:{[`$feature_interaction/${o}`]:!0}})},updateFlags:(o,c,d)=>f.flags?.update(o,c,d?.merge??!0),register:o=>l.register(o),registerOnce:o=>l.registerOnce(o),unregister:o=>l.unregister(o),group:(o,c,d)=>{x.markIdentified(),l.group(o,c,d)},optIn:(o=["analytics","replay"])=>l.setConsent({analytics:o.includes("analytics"),replay:o.includes("replay"),marketing:o.includes("marketing")}),optOut:()=>l.optOut(),optOutInternal:(o=!0)=>{G=o,o?l.storage.set(Me,"1"):l.storage.remove(Me)},get isInternal(){return G},setConsent:o=>l.setConsent(o),getConsent:()=>l.getConsent(),getConsentStatus:o=>l.getConsentStatus(o),consentStatus:()=>l.consentStatus(),getFlag:o=>f.flags?.get(o),getFlagPayload:o=>f.flags?.payload(o),getFlagResult:(o,c)=>f.flags?.result(o,c)??U(o,void 0,void 0,"not_found"),getLayerParam:(o,c,d)=>f.flags?.layerParam(o,c)??d,isFeatureEnabled:o=>{let c=f.flags?.get(o);return c!==void 0&&c!==!1},onFlags:o=>f.flags?.onChange(o)??(()=>{}),onIntervention:o=>ze.on(o),reloadFlags:()=>f.flags?.reload()??Promise.resolve(),getAllFlags:()=>f.flags?.all()??{},overrideFlags:(o,c)=>f.flags?.override(o,c),setPersonPropertiesForFlags:(o,c)=>f.flags?.setPersonProperties(o,c),resetPersonPropertiesForFlags:()=>f.flags?.resetPersonProperties(),setGroupPropertiesForFlags:(o,c)=>f.flags?.setGroupProperties(o,c),resetGroupPropertiesForFlags:()=>f.flags?.resetGroupProperties(),setContext:(o,c,d)=>f.flags?.setContext(o,c,d),clearContext:o=>f.flags?.clearContext(o),guides:{showChangelog:()=>f.guides?.showChangelog()??0,show:o=>f.guides?.show(o)??!1,reset:o=>f.guides?.reset(o)},ai:{startConversation:o=>new H((c,d)=>L.capture(c,d),o,a.ai?.captureText===!0).start()},earlyAccess:{list:()=>f.earlyAccess?.list()??Promise.resolve([]),optIn:o=>f.earlyAccess?.optIn(o),optOut:o=>f.earlyAccess?.optOut(o)},replay:{start:o=>f.replay?.start(o)??Promise.resolve(),stop:()=>f.replay?.stop(),pause:()=>f.replay?.pause(),resume:()=>f.replay?.resume(),tag:o=>f.replay?.tag(o),isRecording:()=>f.replay?.isRecording()??!1},consent:{showBanner:o=>f.consentUi?.showBanner(o)??Promise.resolve(null),hideBanner:()=>f.consentUi?.hideBanner()},loadToolbar:o=>f.toolbar?.load(typeof o=="string"?o:o.token)??Promise.resolve(!1),activateExperiment:o=>f.experiments?.activate(o),recommendations:(o,c)=>f.recs?.get(o,c)??Promise.resolve({placement:o,strategy:"",items:[],shown(){},clicked(){}}),flush:()=>Ve.then(()=>l.flush()),shutdown:async()=>{for(let o of E)o();K?.flush(),await l.shutdown()}};if(f.client=L,!k){let o=()=>{for(let d of qe)d();K?.flush(),l.flush({beacon:!0})};window.addEventListener("pagehide",o);let c=()=>{document.visibilityState==="hidden"&&l.flush({beacon:!0})};if(document.addEventListener("visibilitychange",c),E.push(()=>{window.removeEventListener("pagehide",o),document.removeEventListener("visibilitychange",c)}),le){let d=()=>{le.drain()};window.addEventListener("online",d),E.push(()=>window.removeEventListener("online",d)),Y(d)}if(e.captureCspViolations){let d=typeof e.captureCspViolations=="object"?e.captureCspViolations:{};E.push(ht((y,w)=>{l.capture(y,w)},d))}for(let d of t){let y=d(f);y&&E.push(y)}pe=f.flags,t.length||f.loadConfig(),vt(f,L,i)}return kt(L,e.exposeGlobal),r("initialised",{apiHost:i,consent:l.getConsent()}),L}function sr(n,e={}){return De(n,e)}export{De as createClient,sr as init};
@@ -1,3 +0,0 @@
1
- var R=(t,e)=>()=>(t&&(e=t(t=0)),e);function it(t,e,n){return e==="opt_in"?"opt_in":n==="opt_in"||n==="opt_out"||n==="cookieless"?n:e==="opt_out"?t:void 0}var Oe,st,ye,Q,at=R(()=>{"use strict";Oe="lc_consent";st=["analytics","replay","marketing"],ye=class{constructor(e){this.o=e;this.modeNow=e.mode??"opt_out",this.queueBeforeConsent=e.queueBeforeConsent??!1;let n=this.opens();this.state={analytics:n,replay:n,marketing:n},this.key=e.storageKey||Oe;let r=e.storage.get(this.key);if(r)try{let o=JSON.parse(r);for(let s of st)typeof o[s]=="boolean"&&(this.state[s]=o[s]);this.decided=st.some(s=>typeof o[s]=="boolean")}catch{}this.waiting=!!e.awaitRemote&&!this.decided,this.waiting&&(this.state={analytics:!1,replay:!1,marketing:!1})}o;modeNow;queueBeforeConsent;state;decided=!1;waiting;geoCookieless=!1;key;listeners=[];opens(){return this.modeNow==="opt_out"&&!(this.o.respectDnt&&this.o.dnt)}get mode(){return this.modeNow}get resolving(){return this.waiting}get anonymous(){return this.geoCookieless&&!this.decided}resolve(e){if(!this.waiting)return this.state.analytics;this.waiting=!1,(e==="opt_in"||e==="opt_out")&&(this.modeNow=e),this.geoCookieless=e==="cookieless";let n=!this.geoCookieless&&this.opens();return this.state={analytics:n,replay:n,marketing:n},n}get(){return{...this.state}}has(e){return this.state[e]}status(e="analytics"){return this.decided?this.state[e]?"granted":"denied":"pending"}get pending(){return this.waiting||this.modeNow==="opt_in"&&!this.state.analytics}set(e){let n=this.get();for(let r of st)e[r]!==void 0&&(this.state[r]=e[r]);this.decided=!0,this.waiting=!1,this.o.storage.set(this.key,JSON.stringify(this.state));for(let r of this.listeners)r(this.get(),n)}onChange(e){this.listeners.push(e)}},Q=class{constructor(e,n){this.inner=e;this.allowed=n}inner;allowed;mem=new Map;get(e){return this.mem.has(e)?this.mem.get(e)??null:this.inner.get(e)}set(e,n){this.allowed()?this.inner.set(e,n):this.mem.set(e,n)}remove(e){this.allowed()?this.inner.remove(e):this.mem.set(e,null)}flushBuffered(){for(let[e,n]of this.mem)n===null?this.inner.remove(e):this.inner.set(e,n);this.mem.clear()}discardBuffered(){this.mem.clear()}}});function bn(t){let e=new Uint8Array(t),n=globalThis.crypto;if(n?.getRandomValues)n.getRandomValues(e);else for(let r=0;r<t;r++)e[r]=Math.floor(Math.random()*256);return e}function X(t=Date.now()){if(t>Ae){Ae=t;let s=bn(2);le=((s[0]??0)<<8|(s[1]??0))&1023}else le++,le>4095&&(Ae++,le=0);let e=bn(8),n=new Uint8Array(16),r=Ae;n[0]=Math.floor(r/2**40)&255,n[1]=Math.floor(r/2**32)&255,n[2]=Math.floor(r/2**24)&255,n[3]=Math.floor(r/2**16)&255,n[4]=Math.floor(r/2**8)&255,n[5]=r&255,n[6]=112|le>>8,n[7]=le&255,n[8]=128|(e[0]??0)&63;for(let s=1;s<8;s++)n[8+s]=e[s]??0;let o=Array.from(n,s=>s.toString(16).padStart(2,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}var Ae,le,Ie=R(()=>{"use strict";Ae=0,le=0});var wn,Me,xn=R(()=>{"use strict";Ie();wn="lc_identity",Me=class{constructor(e,n,r=!1,o=!1){this.storage=e;this.cookieless=r;let s=e.get(wn),i;try{i=s?JSON.parse(s):void 0}catch{i=void 0}if(i?.distinct_id)this.s=i;else if(r)this.s={distinct_id:"",anon_id:"",identified:!1};else{let a=n??X();this.s={distinct_id:a,anon_id:a,identified:o&&!!n},this.save()}}storage;cookieless;s;save(){this.storage.set(wn,JSON.stringify(this.s))}get distinctId(){return this.s.distinct_id}get priorAnonId(){return this.s.identified&&this.s.anon_id&&this.s.anon_id!==this.s.distinct_id?this.s.anon_id:void 0}get isIdentified(){return this.s.identified}identify(e){if(!e||e===this.s.distinct_id)return e&&!this.s.identified&&(this.s.identified=!0,this.save()),{event:null};let n=this.s.distinct_id,r=!this.s.identified;return this.s={...this.s,distinct_id:e,identified:!0},this.save(),r&&n?{event:"$identify",anonDistinctId:n}:{event:"$identify"}}aliasProps(e,n){return{alias:e,distinct_id:n??this.s.distinct_id}}reset(e=!1){if(this.cookieless){this.s={distinct_id:"",anon_id:"",identified:!1};return}let n=e&&this.s.anon_id||X();this.s={distinct_id:n,anon_id:n,identified:!1},this.save()}}});function se(t,e={}){let n=Math.min(e.maxMs??3e4,(e.baseMs??1e3)*2**t);return Math.round(n*(.5+.5*(e.random??Math.random)()))}function kn(t){return t===0||t===408||t===429||t>=500}var Te=R(()=>{"use strict"});var Fe,Sn=R(()=>{"use strict";Te();Fe=class{constructor(e){this.o=e;this.flushAt=e.flushAt??20,this.intervalMs=e.flushIntervalMs??5e3,this.maxSize=e.maxQueueSize??1e3,this.maxRetries=e.maxRetries??5,this.batchMax=Math.max(1,Math.min(e.maxBatchSize??1e3,1e3))}o;items=[];timer;attempt=0;inflight;closed=!1;warned404=!1;flushAt;intervalMs;maxSize;maxRetries;batchMax;get size(){return this.items.length}enqueue(e){this.closed||(this.items.push(e),this.items.length>this.maxSize&&this.o.onDrop?.(this.items.splice(0,this.items.length-this.maxSize),"queue_full"),this.items.length>=this.flushAt?this.flush():this.arm(this.intervalMs))}arm(e){this.timer===void 0&&(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},e))}disarm(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0}flush(e={}){if(this.disarm(),this.inflight)return this.inflight.then(()=>this.items.length?this.flush(e):void 0);if(!this.items.length)return Promise.resolve();let n=this.items.splice(0,this.batchMax),r=(this.o.clock??Date).now(),o=JSON.stringify({api_key:this.o.apiKey,batch:n,sent_at:new Date(r).toISOString()});this.o.log?.("send batch",n.length);let s=this.o.transport.send(this.o.url,o,e.beacon?{beacon:!0}:{}).then(i=>i,()=>({status:0,retryAfterMs:void 0})).then(i=>this.settle(n,i.status,!!e.beacon,i.retryAfterMs)).finally(()=>{this.inflight=void 0});return this.inflight=s,s}settle(e,n,r,o){if(n>=200&&n<300){this.attempt=0,this.items.length>=this.flushAt?this.flush():this.items.length&&this.arm(this.intervalMs);return}if(!kn(n)||r||this.attempt>=this.maxRetries){n===404&&!this.warned404&&(this.warned404=!0,console.warn(`[lucida] ${this.o.url} returned 404, so events are being dropped. apiHost is probably wrong: use https://capture.lucidace.com (or your own capture host), not the app host.`)),this.o.onDrop?.(e,`status_${n}`),this.attempt=0;return}this.items.unshift(...e);let s=Math.max(se(this.attempt++,this.o.backoff),Math.min(o??0,6e4));this.o.log?.("retry in",s,"ms"),this.arm(s)}clear(){this.items=[],this.disarm()}async shutdown(){await this.flush(),this.closed=!0,this.disarm()}}});function Cn(t,e,n){return typeof t=="number"&&Number.isInteger(t)&&t>=e&&t<=n?t*6e4:void 0}function Wo(t,e){let n=qo.exec(t);if(!n)return!0;let r=parseInt(n[1]+n[2],16);return r-e<=6e4&&e-r<=No}var ct,Do,Ho,No,qo,Le,En=R(()=>{"use strict";Ie();ct="lc_session";Do=6e4,Ho=10*36e5,No=24*36e5,qo=/^([0-9a-f]{8})-?([0-9a-f]{4})-7[0-9a-f]{3}-/i;Le=class{constructor(e,n={}){this.storage=e;this.o=n;this.idleMs=Math.min(Ho,Math.max(Do,n.idleMs??30*6e4)),this.maxMs=n.maxMs??24*36e5,this.newOn=n.newOnEvents??[],this.clock=n.clock??{now:()=>Date.now()},this.bootstrapId=n.bootstrapId}storage;o;windowId=X();idleMs;maxMs;newOn;clock;bootstrapId;configure(e){this.o.idleMs===void 0&&(this.idleMs=Cn(e.session_idle_minutes,1,600)??this.idleMs),this.o.maxMs===void 0&&(this.maxMs=Cn(e.session_max_minutes,5,10080)??this.maxMs),this.o.newOnEvents===void 0&&Array.isArray(e.session_new_on_events)&&(this.newOn=e.session_new_on_events.filter(n=>typeof n=="string"&&n!==""))}read(){try{let e=this.storage.get(ct);return e?JSON.parse(e):void 0}catch{return}}touch(e,n){let r=this.clock.now(),o=this.read(),s=!!(o?.campaign&&e&&o.campaign!==e),i=n!==void 0&&this.newOn.includes(n),a=!o||Math.abs(r-o.last)>this.idleMs||Math.abs(r-o.start)>this.maxMs||s||i;return(a||!o)&&(o={id:!o&&this.bootstrapId&&Wo(this.bootstrapId,r)?this.bootstrapId:X(r),start:r,last:r}),this.bootstrapId=void 0,o.last=r,e&&(o.campaign=e),this.storage.set(ct,JSON.stringify(o)),{sessionId:o.id,windowId:this.windowId,isNew:a}}startedAt(){return this.read()?.start}reset(){this.storage.remove(ct)}}});function Rn(t,e){let n=t.get(e);if(n)try{return JSON.parse(n)}catch{return}}var je,De,Pn=R(()=>{"use strict";je=class{constructor(e,n="lc_props",r){this.storage=e;this.key=n;this.persist=r;this.p=Rn(e,n)??{}}storage;key;persist;p;save(){let e=this.persist;this.storage.set(this.key,JSON.stringify(e?Object.fromEntries(Object.entries(this.p).filter(([n])=>e(n))):this.p))}register(e){Object.assign(this.p,e),this.save()}registerOnce(e){for(let[n,r]of Object.entries(e))n in this.p||(this.p[n]=r);this.save()}unregister(e){delete this.p[e],this.save()}all(){return{...this.p}}clear(){this.p={},this.storage.remove(this.key)}},De=class{constructor(e){this.storage=e;this.g=Rn(e,"lc_groups")??{}}storage;g;set(e,n){this.g[e]=n,this.storage.set("lc_groups",JSON.stringify(this.g))}all(){return Object.keys(this.g).length?{...this.g}:void 0}clear(){this.g={},this.storage.remove("lc_groups")}}});function Uo(t,e){let n=new Date(t??e);return(Number.isNaN(n.getTime())?new Date(e):n).toISOString()}var ve,$n=R(()=>{"use strict";at();xn();Sn();En();Pn();Ie();ve=class{constructor(e){this.c=e;this.clock=e.clock??{now:()=>Date.now()},this.consent=new ye({...e.consent,storage:e.consentStorage??e.storage}),this.gated=new Q(e.storage,()=>this.consent.has("analytics")),this.storage=this.gated,this.identity=new Me(this.gated,e.bootstrapDistinctId,e.cookieless,e.bootstrapIdentified),this.session=new Le(this.gated,{clock:this.clock,...e.session}),this.props=new je(this.gated,void 0,e.persistProperty),this.groupState=new De(this.gated),this.queue=new Fe({transport:e.transport,url:`${e.apiHost.replace(/\/+$/,"")}/v1/batch`,apiKey:e.apiKey,clock:this.clock,...e.log?{log:e.log}:{},...e.onDrop?{onDrop:e.onDrop}:{},...e.queue})}c;consent;identity;session;queue;storage;gated;props;groupState;clock;device;pre=[];listeners=[];captureListeners=[];sessionListeners=[];lastSession="";filter;get anonDistinctId(){return this.identity.priorAnonId}get distinctId(){return this.identity.distinctId}get deviceId(){return this.c.cookieless?"":(this.device||(this.device=this.gated.get("lc_device_id")||X(),this.gated.set("lc_device_id",this.device)),this.device)}get groups(){return this.groupState.all()}get sessionId(){return this.touchSession().sessionId}touchSession(e){let n=this.session.touch(this.c.campaignKey?.(),e);if(n.sessionId!==this.lastSession){this.lastSession=n.sessionId;for(let r of this.sessionListeners)r(n.sessionId,n.windowId)}return n}onSessionId(e){return this.sessionListeners.push(e),()=>{this.sessionListeners.splice(this.sessionListeners.indexOf(e),1)}}get sessionStart(){return this.session.startedAt()}getProperty(e){return this.props.all()[e]}setFilter(e){this.filter=e}onChange(e){this.listeners.push(e)}onCaptured(e){this.captureListeners.push(e)}emit(e){for(let n of this.listeners)n(e)}consentStatus(){return this.consent.status()}get anonymousOnReject(){return!!this.c.consent?.cookielessOnReject&&this.consent.status()==="denied"}capture(e,n={},r={}){let o=this.consent.has("analytics"),s=!o&&(this.anonymousOnReject||this.consent.anonymous),i=this.consent.pending&&(this.consent.queueBeforeConsent||this.consent.resolving);if(!o&&!s&&!i){this.c.log?.("dropped (no consent)",e);return}if(s&&(e==="$identify"||e==="$create_alias")){this.c.log?.("withheld (declined, anonymous mode)",e);return}let a=this.touchSession(e),l=this.c.enrich?.(e,n),c=this.consent.status()!=="pending",u=s?{}:{...l?.$set,...r.$set,...e==="$consent_updated"&&c?{$consent:this.consent.get()}:{}},f=s?{}:{...l?.$set_once,...r.$set_once},h=this.groupState.all(),m=s?"":this.identity.distinctId,b={uuid:X(this.clock.now()),event:e,...m?{distinct_id:m}:{},timestamp:Uo(r.timestamp,this.clock.now()),properties:{...this.props.all(),...l?.properties,...n,$session_id:a.sessionId,$window_id:a.windowId,$lib:this.c.library.name,$lib_version:this.c.library.version,...c?{$consent:this.consent.get()}:{}},...Object.keys(u).length?{$set:u}:{},...Object.keys(f).length?{$set_once:f}:{},...!s&&r.$unset?.length?{$unset:r.$unset}:{},...h?{$groups:h}:{}},y=this.filter?this.filter(b):b;if(!y){this.c.log?.("dropped (policy)",e);return}this.c.log?.("capture",e,y),this.c.onCapture?.(y);for(let w of this.captureListeners)w(y);return o||s?this.queue.enqueue(y):this.pre.length<(this.c.queue?.maxQueueSize??1e3)&&this.pre.push(y),y}identify(e,n,r){let o=this.identity.identify(e);(o.event||n||r)&&this.capture("$identify",o.anonDistinctId?{$anon_distinct_id:o.anonDistinctId}:{},{...n?{$set:n}:{},...r?{$set_once:r}:{}}),this.emit("identify")}alias(e,n){this.capture("$create_alias",this.identity.aliasProps(e,n))}reset(e={}){this.identity.reset(e.reuseAnonymousId),e.resetDeviceId&&(this.device=void 0,this.gated.remove("lc_device_id")),this.props.clear(),this.groupState.clear(),this.session.reset(),this.lastSession="",this.emit("reset")}register(e){this.props.register(e)}registerOnce(e){this.props.registerOnce(e)}unregister(e){this.props.unregister(e)}group(e,n,r){this.groupState.set(e,n),this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r??{}}),this.emit("group")}getConsent(){return this.consent.get()}getConsentStatus(e="analytics"){return this.consent.status(e)}hasConsent(e){return this.consent.has(e)}setConsent(e){let n=this.consent.has("analytics"),r=e.analytics??n;if(n&&!r&&(this.capture("$opt_out"),this.queue.flush()),!n&&r&&(this.anonymousOnReject||this.consent.anonymous)&&this.queue.flush(),this.consent.set(e),!n&&r){this.gated.flushBuffered();for(let o of this.pre.splice(0))this.queue.enqueue(o);this.capture("$opt_in")}else n&&!r&&this.queue.clear();r||(this.pre.length=0),this.emit("consent")}applyRemote(e){this.session.configure(e),this.resolveConsent(it(this.consent.mode,e.consent_mode,e.consent_default))}resolveConsent(e){if(!this.consent.resolving)return;let n=this.consent.resolve(e),r=this.pre.splice(0);if(n){this.gated.flushBuffered();for(let o of r)this.queue.enqueue(o)}else if(this.consent.anonymous){this.gated.discardBuffered();for(let o of r){if(o.event==="$identify"||o.event==="$create_alias")continue;let s={...o};delete s.distinct_id,delete s.$set,delete s.$set_once,delete s.$unset,this.queue.enqueue(s)}}else this.consent.queueBeforeConsent&&this.pre.push(...r);this.emit("consent")}optIn(){this.setConsent({analytics:!0,replay:!0,marketing:!0})}optOut(){this.setConsent({analytics:!1,replay:!1,marketing:!1})}flush(e){return this.queue.flush(e)}shutdown(){return this.queue.shutdown()}}});function lt(t,e){return{event:On,props:{$feature_flag:t,$enrolled:e},extra:{$set:{[He(t)]:e}}}}var On,He,An=R(()=>{"use strict";On="$early_access_opt_in",He=t=>`$feature_enrollment/${t}`});function ut(t){let e="";return n=>{for(e+=n;;){let r=/\r?\n\r?\n/.exec(e);if(!r)return;let o=e.slice(0,r.index);e=e.slice(r.index+r[0].length);let s="message",i,a=[];for(let l of o.split(/\r?\n/)){if(l.startsWith(":"))continue;let c=l.indexOf(":"),[u,f]=c<0?[l,""]:[l.slice(0,c),l.slice(c+1).replace(/^ /,"")];u==="event"?s=f??"":u==="data"?a.push(f??""):u==="id"&&(i=f)}a.length&&t(i===void 0?{event:s,data:a.join(`
2
- `)}:{event:s,data:a.join(`
3
- `),id:i})}}}var Ne,dt=R(()=>{"use strict";Te();Ne=class{constructor(e){this.o=e}o;ctl;stopped=!0;timer;start(){this.stopped&&(this.stopped=!1,this.loop())}stop(){this.stopped=!0,this.ctl?.abort(),this.timer&&clearTimeout(this.timer),this.o.onState?.(!1)}async loop(){let e=0;for(;!this.stopped;){try{await this.connectOnce()&&(e=0)}catch(r){this.stopped||this.o.log?.("flag stream error",r)}if(this.o.onState?.(!1),this.stopped)return;let n=se(e++,this.o.backoff);await new Promise(r=>{this.timer=setTimeout(r,n),this.timer.unref?.()})}}async connectOnce(){this.ctl=new AbortController;let e=await this.o.fetch(this.o.url,{headers:{Authorization:`Bearer ${this.o.secretKey}`,Accept:"text/event-stream"},signal:this.ctl.signal});if(!e.ok||!e.body)throw new Error(`stream status ${e.status}`);this.o.onState?.(!0);let n=ut(o=>{if(o.event==="definitions")try{this.o.onChange(JSON.parse(o.data).etag)}catch{this.o.onChange(void 0)}}),r=e.body.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:o,value:s}=await r.read();if(o)return!0;n(s)}}}});function pt(t){let e=!1,n,r=new Ne({url:`${t.apiHost}/v1/flags/stream`,secretKey:t.apiKey,fetch:t.fetch,...t.backoff?{backoff:t.backoff}:{},...t.log?{log:t.log}:{},onState:c=>e=c,onChange:c=>{c!==void 0&&c===n||(n=c,t.reload())}}),o=()=>t.visibility?.hidden()??!1,s=t.pollMs??6e4,i=s>0?setInterval(()=>!e&&!o()&&t.reload(),s):void 0,a=()=>{o()?r.stop():(r.start(),t.reload())};o()||r.start();let l=t.visibility?.subscribe(a);return()=>{r.stop(),l?.(),i&&clearInterval(i)}}var In=R(()=>{"use strict";dt()});function ft(t,e){let n=new Set,{whenConsented:r,disabled:o,...s}=e,i=new qe({...s,distinctId:()=>t.distinctId,onIntervention:l=>{for(let c of[...n])c(l)}}),a=!1;return t.onChange(l=>{a&&((l==="identify"||l==="reset")&&i.restart(),l==="consent"&&(t.hasConsent("analytics")?i.start():i.stop()))}),{on(l){return n.add(l),!a&&!o&&(a=!0,r(()=>i.start())),()=>{n.delete(l)}},stop:()=>i.stop()}}var qe,Mn=R(()=>{"use strict";dt();Te();qe=class{constructor(e){this.o=e}o;ctl;stopped=!0;timer;cursor=0;gen=0;polling=!1;start(){this.stopped&&(this.stopped=!1,this.loop(++this.gen))}stop(){this.stopped=!0,this.gen++,this.ctl?.abort(),this.timer&&clearTimeout(this.timer)}restart(){let e=!this.stopped;this.stop(),this.cursor=0,e&&this.start()}live(e){return!this.stopped&&e===this.gen}deliver(e){if(e.seq>this.cursor){this.cursor=e.seq;try{this.o.onIntervention(e)}catch(n){this.o.log?.("onIntervention threw",n)}}}url(e){let n=`distinct_id=${encodeURIComponent(this.o.distinctId())}${this.cursor?`&cursor=${this.cursor}`:""}`;return`${this.o.apiHost}${e}?${n}`}sleep(e){return new Promise(n=>{this.timer=setTimeout(n,e),this.timer.unref?.()})}async loop(e){let n=0;for(;this.live(e);){let r;try{let o=await this.connectOnce(e);if(o==="gone")return this.stop();o==="poll"?(n=0,r=this.o.pollMs??15e3):(o==="streamed"&&(n=0),r=se(n++,this.o.backoff))}catch(o){this.live(e)&&this.o.log?.("intervention stream error",o),r=se(n++,this.o.backoff)}if(!this.live(e))return;await this.sleep(r)}}async connectOnce(e){if(this.polling)return this.pollOnce(e);this.ctl=new AbortController;let n={Authorization:`Bearer ${this.o.apiKey}`,Accept:"text/event-stream"},r=await this.o.fetch(this.url("/v1/interventions/stream"),{headers:n,signal:this.ctl.signal});if(r.status===404)return"gone";if(!r.ok)return"failed";let o=r.body;if(!o||typeof TextDecoderStream>"u")return this.ctl.abort(),this.polling=!0,this.pollOnce(e);let s=ut(a=>{if(!(a.event!=="intervention"||!this.live(e)))try{this.deliver(JSON.parse(a.data))}catch{this.o.log?.("bad intervention payload")}}),i=o.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:a,value:l}=await i.read();if(a)return"streamed";s(l)}}async pollOnce(e){this.ctl=new AbortController;let n=await this.o.fetch(this.url("/v1/interventions"),{headers:{Authorization:`Bearer ${this.o.apiKey}`},signal:this.ctl.signal});if(n.status===404)return"gone";if(!n.ok)return"failed";let r=await n.json();if(this.live(e))for(let o of r.data??[])this.deliver(o);return"poll"}}});function gt(t,e,n={}){let r=n.key??"lc_offline",o=n.maxBatches??50,s=n.maxBytes??1e6,i=n.isOnline??(()=>!0),a,l,c=()=>{try{let m=JSON.parse(e.get(r)??"[]");return Array.isArray(m)?m:[]}catch{return[]}},u=m=>{let b=m.reduce((y,w)=>y+w.body.length,0);for(;m.length>o||b>s&&m.length>1;)b-=m.shift().body.length;m.length?e.set(r,JSON.stringify(m)):e.remove(r)},f=m=>{u([...c(),...m]),a??=setTimeout(()=>{a=void 0,h.drain()},n.retryMs??3e4)},h={async send(m,b,y){if(!i())return f([{url:m,body:b}]),{status:200};let w=await t.send(m,b,y);return w.status!==0?w:(f([{url:m,body:b}]),{status:200})},drain(){return l??=(async()=>{let m=c();if(!m.length||!i())return;e.remove(r);let b=[];for(let[y,w]of m.entries())if((await t.send(w.url,w.body)).status===0){b.push(...m.slice(y));break}b.length&&f(b)})().finally(()=>{l=void 0}),l}};return h}var Tn=R(()=>{"use strict"});function Fn(t){let e=new TextEncoder().encode(t),n=e.length+9+63>>6<<6,r=new Uint8Array(n);r.set(e),r[e.length]=128;let o=new DataView(r.buffer);o.setUint32(n-8,Math.floor(e.length*8/2**32)),o.setUint32(n-4,e.length*8>>>0);let s=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],i=new Uint32Array(64);for(let a=0;a<n;a+=64){for(let c=0;c<16;c++)i[c]=o.getUint32(a+c*4);for(let c=16;c<64;c++){let u=i[c-15],f=i[c-2],h=V(u,7)^V(u,18)^u>>>3,m=V(f,17)^V(f,19)^f>>>10;i[c]=i[c-16]+h+i[c-7]+m|0}let l=s.slice();for(let c=0;c<64;c++){let[u,f,h,,m,b,y,w]=l,C=w+(V(m,6)^V(m,11)^V(m,25))+(m&b^~m&y)+Bo[c]+i[c]|0,E=(V(u,2)^V(u,13)^V(u,22))+(u&f^u&h^f&h)|0;l.pop(),l.unshift(C+E|0),l[4]=l[4]+C|0}for(let c=0;c<8;c++)s[c]=s[c]+l[c]|0}return s.map(a=>(a>>>0).toString(16).padStart(8,"0")).join("")}var Bo,V,Ln=R(()=>{"use strict";Bo=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),V=(t,e)=>t>>>e|t<<32-e});function jn(t){let e=t.split(".");if(e.length!==4)return;let n=[];for(let r of e){if(!Vo.test(r)||Number(r)>255)return;n.push(Number(r))}return n}function zo(t){if(t.includes("%"))return;let e=t,n=t.lastIndexOf(":"),r=t.slice(n+1);if(r.includes(".")){let u=jn(r);if(!u)return;e=`${t.slice(0,n+1)}${(u[0]<<8|u[1]).toString(16)}:${(u[2]<<8|u[3]).toString(16)}`}let o=e.split("::");if(o.length>2)return;let s=u=>{if(u==="")return[];let f=[];for(let h of u.split(":")){if(!Ko.test(h))return;f.push(parseInt(h,16))}return f},i=s(o[0]),a=o.length===2?s(o[1]):[];if(!i||!a)return;let l=i.length+a.length;return(o.length===2?l>7:l!==8)?void 0:[...i,...Array(8-l).fill(0),...a].flatMap(u=>[u>>8,u&255])}function Dn(t){return t.includes(":")?zo(t):jn(t)}function Hn(t){if(typeof t!="string")return;let e=Dn(t.trim());return e&&Xo(e)?e.slice(12):e}function Yo(t){let e=typeof t=="string"?[t]:Array.isArray(t)?t:[],n=[];for(let r of e){if(typeof r!="string")continue;let o=r.trim(),s=o.indexOf("/");if(s<0){let l=Hn(o);l&&n.push({bytes:l,bits:l.length*8});continue}let i=Dn(o.slice(0,s)),a=o.slice(s+1);!i||!Go.test(a)||Number(a)>i.length*8||n.push({bytes:i,bits:Number(a)})}return n}function Jo(t,e){if(t.bytes.length!==e.length)return!1;for(let n=0;n<t.bits;n+=8){let o=255<<8-Math.min(8,t.bits-n)&255,s=n/8;if((t.bytes[s]&o)!==(e[s]&o))return!1}return!0}function Nn(t,e,n,r){switch(t){case"array_contains_any":case"array_contains_all":case"array_contains_none":{if(!Array.isArray(e)||!Array.isArray(n))return!1;let o=n.filter(s=>e.some(i=>r(i,s))).length;return t==="array_contains_any"?o>0:t==="array_contains_all"?o===n.length:o===0}case"ip_in_cidr":case"ip_not_in_cidr":{let o=Hn(e),s=Yo(n);return!o||!s.length?!1:s.some(i=>Jo(i,o))===(t==="ip_in_cidr")}}return!1}var Vo,Ko,Go,Xo,qn=R(()=>{"use strict";Vo=/^(0|[1-9]\d{0,2})$/,Ko=/^[0-9a-fA-F]{1,4}$/,Go=/^(0|[1-9]\d*)$/;Xo=t=>t.length===16&&t.slice(0,10).every(e=>e===0)&&t[10]===255&&t[11]===255});function ts(t){let e=Qo.exec(t.trim());return e?Number(e[1])*es[e[2]]:void 0}function Un(t,e,n){if(typeof t=="number")return t*1e3;if(typeof t!="string")return;let r=t.trim();if(n){let s=ts(r);if(s!==void 0)return e-s*1e3}if(!Zo.test(r)&&!Wn.test(r))return;let o=Date.parse(Wn.test(r)?`${r}T00:00:00Z`:r);return Number.isNaN(o)?void 0:o}function Bn(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=t[n]??0,o=e[n]??0;if(r!==o)return r<o?-1:1}return 0}function ns(t,e,n){if(typeof e!="string")return;let r=e.trim().replace(/^v/,"").split(".");if(t==="semver_wildcard"){let c=r[r.length-1];if(c!=="*"&&c!=="x"&&c!=="X")return;if(r.length===1)return[[0],[2**30]];let u=n.parseVersion(r.slice(0,-1).join("."));if(!u)return;let f=[...u];return f[f.length-1]=f[f.length-1]+1,[u,f]}let o=n.parseVersion(e);if(!o)return;for(;o.length<3;)o.push(0);let[s,i,a]=o,l;return t==="semver_tilde"&&r.length===1?l=[s+1,0,0]:t==="semver_tilde"||s===0&&i>0?l=[s,i+1,0]:s>0?l=[s+1,0,0]:l=[0,0,a+1],[o,l]}function Vn(t,e,n,r,o){switch(t){case"icontains":case"not_icontains":case"starts_with":case"not_starts_with":case"ends_with":case"not_ends_with":return typeof e!="string"||typeof n!="string"?!1:t.endsWith("icontains")?e.toLowerCase().includes(n.toLowerCase())===(t==="icontains"):t.endsWith("starts_with")?e.startsWith(n)===(t==="starts_with"):e.endsWith(n)===(t==="ends_with");case"between":case"not_between":{let s=o.toFloat(e);if(!Array.isArray(n)||n.length!==2||s===void 0)return!1;let[i,a]=n;return typeof i!="number"||typeof a!="number"?!1:(s>=i&&s<=a)==(t==="between")}case"is_date_before":case"is_date_after":{let s=Un(e,r,!1),i=Un(n,r,!0);return s===void 0||i===void 0?!1:t==="is_date_before"?s<i:s>i}case"semver_eq":case"semver_neq":case"semver_gt":case"semver_gte":case"semver_lt":case"semver_lte":{let s=o.cmpVersion(e,n);if(s===void 0)return!1;let i=t.slice(7);return i==="eq"?s===0:i==="neq"?s!==0:i==="gt"?s>0:i==="gte"?s>=0:i==="lt"?s<0:s<=0}case"semver_tilde":case"semver_caret":case"semver_wildcard":{let s=o.parseVersion(e),i=ns(t,n,o);return!!s&&!!i&&Bn(s,i[0])>=0&&Bn(s,i[1])<0}}return!1}var Zo,Wn,Qo,es,Kn=R(()=>{"use strict";Zo=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,Wn=/^\d{4}-\d{2}-\d{2}$/,Qo=/^-?(\d{1,6})([hdwmy])$/,es={h:3600,d:86400,w:604800,m:2592e3,y:31536e3}});function mt(t){if(typeof t=="number")return t;if(typeof t=="string"&&rs.test(t.trim()))return Number(t.trim())}function ht(t,e){let n=typeof t=="number",r=typeof e=="number";return n||r?n&&r&&t===e:t===e}function vt(t){if(typeof t!="string")return;let e=t.trim().replace(/^v/,""),n=e.search(/[-+]/);n>=0&&(e=e.slice(0,n));let r=[];for(let o of e.split(".")){if(!/^[+-]?\d+$/.test(o))return;let s=parseInt(o,10);if(s<0)return;r.push(s)}return r}function yt(t,e){let n=vt(t),r=vt(e);if(!(!n||!r)){for(let o=0;o<Math.max(n.length,r.length);o++){let s=n[o]??0,i=r[o]??0;if(s!==i)return s<i?-1:1}return 0}}function ee(t,e,n,r,o,s=Date.now()){let i=n&&e!==null&&e!==void 0;if(t==="is_set")return i;if(t==="is_not_set")return!i;if(!i)return!1;switch(t){case"eq":case"neq":{let a;if(o){let l=yt(e,r);if(l===void 0)return!1;a=l===0}else a=ht(e,r);return a===(t==="eq")}case"contains":case"ncontains":case"regex":case"nregex":{if(typeof e!="string"||typeof r!="string")return!1;if(t==="contains"||t==="ncontains")return e.includes(r)===(t==="contains");let a;try{a=new RegExp(r)}catch{return!1}return a.test(e)===(t==="regex")}case"gt":case"gte":case"lt":case"lte":{let a;if(o)a=yt(e,r);else{let l=mt(e),c=mt(r);a=l===void 0||c===void 0?void 0:os(l,c)}return a===void 0?!1:t==="gt"?a>0:t==="gte"?a>=0:t==="lt"?a<0:a<=0}case"in":case"not_in":return Array.isArray(r)?r.some(a=>ht(e,a))===(t==="in"):!1}return t.startsWith("array_")||t.startsWith("ip_")?Nn(t,e,r,ht):Vn(t,e,r,s,{toFloat:mt,parseVersion:vt,cmpVersion:yt})}var rs,os,_t=R(()=>{"use strict";qn();Kn();rs=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;os=(t,e)=>t<e?-1:t>e?1:0});function wt(t){return t.properties?.length?`${t.key}|${JSON.stringify(t.properties.map(e=>[e.key,e.op,e.value??null]))}`:t.key}function Gn(t,e,n=Date.now()){return(t.properties??[]).every(r=>ee(r.op,e[r.key],Object.hasOwn(e,r.key),r.value,!1,n))}function xt(t,e){let n=e[t.scope??"session"]?.[wt(t)]??0;return t.op==="is_set"?n>0:t.op==="is_not_set"?n===0:ee(t.op,n,!0,t.value,!1)}function Xn(t,e,n){for(let s of t.runtime??[])if(s.filters.every(a=>{if(a.type!=="flag")return xt(a,e);let l=n(a.key);return!!l&&ee(a.op,l.value,!0,a.value,!1)}))return Xn(s.result,e,n);if(!t.runtime)return t;let{runtime:r,...o}=t;return o}function kt(t,e){let n={},r=new Map,o=s=>{if(r.get(s)===2)return n[s];let i=t[s];if(!i||r.get(s)===1)return;r.set(s,1);let a=Xn(i,e,o);return n[s]=a,r.set(s,2),a};for(let s of Object.keys(t))o(s);return n}function We(t,e){let n=[],r=s=>{s.type==="event"&&s.properties?.length&&n.push(s)};for(let s of t??[])for(let i of s.conditions)for(let a of i.filters??[])r(a);let o=s=>{for(let i of s.runtime??[])i.filters.forEach(r),o(i.result)};return Object.values(e).forEach(o),n}function Ue(t,e){if(!bt(e))return e;let n=bt(t)?{...t}:{};for(let[r,o]of Object.entries(e))o===null?delete n[r]:n[r]=Ue(n[r],o);return n}var zn,bt,_e,St=R(()=>{"use strict";_t();zn=t=>(t??[]).filter(e=>e.type==="event");bt=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);_e=class{session={};page={};sid="";constructor(e){if(e&&typeof e.sid=="string"&&bt(e.session)){this.sid=e.sid;for(let[n,r]of Object.entries(e.session))typeof r=="number"&&r>0&&(this.session[n]=r)}}record(e,n,r={},o=[]){n!==this.sid&&(this.sid=n,this.session={},this.page={}),e==="$pageview"&&(this.page={});let s=new Set([e]);for(let i of o)i.type==="event"&&i.key===e&&i.properties?.length&&Gn(i,r)&&s.add(wt(i));for(let i of s)this.session[i]=(this.session[i]??0)+1,this.page[i]=(this.page[i]??0)+1}counts(e){return e===this.sid?{session:{...this.session},page:{...this.page}}:{session:{},page:{}}}saved(){return{sid:this.sid,session:{...this.session}}}}});function Yn(t,e){let n=e?t.contexts?.[e]:void 0;if(n)return n;if(e==="user")return{key:t.bucketing_key||t.distinct_id,properties:t.person_properties};if(e==="device")return{key:t.device_id,properties:t.device_properties}}function be(t,e,n,r=!1){let o=r?`${t}.${e}.variant.${n}`:`${t}.${e}.${n}`;return parseInt(Fn(o).slice(0,13),16)/is}function as(t,e){return typeof e=="boolean"?typeof t=="boolean"?t===e:e:t===e}function cs(t,e,n){let r=e.now?Date.parse(e.now):NaN,o=Number.isNaN(r)?Date.now():r,s;switch(t.type){case"person":s=e.person_properties;break;case"group":s=e.group_properties?.[t.group_type??""];break;case"device":s=e.device_properties;break;case"geo":s=e.geo_properties;break;case"context":if(!ss.includes(t.context_kind??""))return!1;s=Yn(e,t.context_kind)?.properties;break;case"app_version":return ee(t.op,e.app_version,!!e.app_version,t.value,!0,o);case"flag":{let i=n[t.key];return!!i&&ee(t.op,i.value,!0,t.value,!1,o)}default:return!1}return ee(t.op,s?.[t.key],!!s&&Object.hasOwn(s,t.key),t.value,!1,o)}function ls(t,e,n){let r=t.variants;if(e.variant_override){let i=r.find(a=>a.key===e.variant_override);if(i)return i}let o=be(t.key,t.salt,n,!0)*100,s=0;for(let i of r)if(s+=i.rollout_pct,o<s)return i;return r[r.length-1]}function Jn(t,e){return Zn(t.aggregation,e)}function Zn(t,e){return t.kind==="group"?e.groups?.[t.group_type??""]:t.kind==="device"?e.device_id:t.kind==="context"?Yn(e,t.context_kind)?.key:e.bucketing_key||e.distinct_id}function us(t,e,n,r){let o=t.sticky?r.sticky_assignments?.[t.key]:void 0;if(o===void 0)return;let s={value:!0,reason:"sticky_bucket",condition_index:n};if(t.type==="multivariate"&&t.variants?.length){if(t.variants.some(a=>a.key===e.variant_override))return;let i=t.variants.find(a=>a.key===o);return i?(s.value=s.variant=i.key,Ve(s,i.payload,e)):void 0}if(o===!0)return Ve(s,t.type==="json"?t.payload:void 0,e)}function Ve(t,e,n){let r=n.payload_patch===void 0||n.payload_patch===null?e:Ue(e,n.payload_patch);return r!==void 0&&(t.payload=r),t}function ds(t,e){return!t.app_contexts?.length||!e.app_contexts?.length?!0:t.app_contexts.some(n=>e.app_contexts?.includes(n))}function Qn(t,e,n={}){if(!ds(t,e))return H("app_context_excluded");if(!t.active)return H("inactive");if(t.kill_switch)return H("kill_switch");let r=!1;for(let l of t.prerequisites??[]){let c=n[l.flag];if(!c)return H("prerequisite_missing");if(c.reason==="requires_server")r=!0;else if(c.reason==="prerequisite_cycle"||!as(c.value,l.value))return H("prerequisite_failed")}if(r)return H("requires_server");let o=Jn(t,e),s=t.conditions.some(l=>l.aggregation);if(!o&&(!s||t.holdout||t.namespace))return H("no_bucketing_key");if(t.holdout&&be("holdout",t.holdout.salt,o??"")*100<t.holdout.percentage)return H("holdout");if(t.namespace&&t.namespace.total>0){let l=Math.floor(be("namespace",t.namespace.salt,o??"")*t.namespace.total);if(l<t.namespace.start||l>=t.namespace.end)return H("namespace_excluded")}let i=0,a=[];for(let[l,c]of t.conditions.entries()){let u=c.aggregation?Zn(c.aggregation,e):o;if(!u){i++;continue}let f=!1,h=!0,m=!1;for(let y of c.filters??[]){if(y.type==="event"){if(e.runtime_events===void 0)m=!0;else if(!xt(y,e.runtime_events)){h=!1;break}continue}let w=y.type==="cohort"?e.cohorts?.[y.key]:void 0;if(w!==void 0){if(w===(y.op==="not_in"||y.op==="neq")){h=!1;break}}else if(y.type==="cohort"||y.type==="flag"&&n[y.key]?.reason==="requires_server")f=!0;else if(!cs(y,e,n)){h=!1;break}}if(!h)continue;if(f)return Ct(H("requires_server",l),a);let b=ps(t,c,l,e,u);if(b)if(m)a.push({filters:zn(c.filters),result:b});else return Ct(b,a)}return Ct(H(i>0&&i===t.conditions.length?"no_bucketing_key":"no_condition_match"),a)}function ps(t,e,n,r,o){let s=e.aggregation?void 0:us(t,e,n,r);if(s)return s;if(be(t.key,t.salt,o)*100>=e.rollout_pct)return t.early_exit?H("out_of_rollout",n):void 0;let i={value:!0,reason:"condition_match",condition_index:n};if(t.type==="multivariate"&&t.variants?.length){let a=ls(t,e,o);return i.value=i.variant=a.key,Ve(i,a.payload,e)}return Ve(i,t.type==="json"?t.payload:void 0,e)}function er(t){return[...(t.prerequisites??[]).map(e=>e.flag),...t.conditions.flatMap(e=>(e.filters??[]).filter(n=>n.type==="flag").map(n=>n.key))]}function Et(t,e){let n=new Map(t.map(i=>[i.key,i])),r={},o=new Map,s=i=>{let a=n.get(i);if(!a||o.has(i))return;o.set(i,1);let l=!1;for(let c of er(a))s(c),(o.get(c)===1||r[c]?.reason==="prerequisite_cycle")&&(l=!0);r[i]=l?H("prerequisite_cycle"):fs(a,e,r),o.set(i,2)};for(let i of t)s(i.key);return r}function fs(t,e,n){return Be(t,e,n,[],new Set)}function Be(t,e,n,r,o){let[s,...i]=r;if(s===void 0){let b=new Set,y=new Proxy(n,{get:(E,M)=>(b.add(String(M)),E[M])}),w=Qn(t,e,y),C=[];for(let E of er(t))b.has(E)&&!o.has(E)&&!C.includes(E)&&n[E]?.runtime?.length&&C.push(E);return C.length?Be(t,e,n,C,new Set([...o,...C])):w}let a=Be(t,e,n,i,o),l=n[s],c=new Set([l.value]),u=[];for(let b of tr(l)){if(c.has(b.value))continue;c.add(b.value);let y=Be(t,e,{...n,[s]:b},i,o);nr(y,a)||u.push({filters:[{type:"flag",key:s,op:"eq",value:b.value}],result:y})}let f=[...u,...a.runtime??[]],{runtime:h,...m}=a;return f.length?{...m,runtime:f}:m}function tr(t){return(t.runtime??[]).flatMap(e=>{let{runtime:n,...r}=e.result;return[r,...tr(e.result)]})}function nr(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Array.isArray(t)!==Array.isArray(e))return!1;let n=t,r=e,o=new Set([...Object.keys(n),...Object.keys(r)]);for(let s of o)if(!nr(n[s],r[s]))return!1;return!0}var ss,is,H,Ct,Rt,Pt,rr=R(()=>{"use strict";_t();St();Ln();ss=["user","device","org"],is=16**13;H=(t,e=-1)=>({value:!1,reason:t,condition_index:e});Ct=(t,e)=>e.length?{...t,runtime:e}:t;Rt=t=>t.reason==="requires_server",Pt=t=>t.reason!=="app_context_excluded"});function $t(t){let e=Object.keys(t);if(e.length===0)return{};let n={};for(let r of e)n[`$feature/${r}`]=t[r];return n.$active_feature_flags=e.filter(r=>t[r]!==!1).sort(),n}var or=R(()=>{"use strict"});function ie(t,e,n,r){return{key:t,value:e,enabled:e!==void 0&&e!==!1,...typeof e=="string"?{variant:e}:{},...n!==void 0?{payload:n}:{},reason:e===void 0?"not_found":r}}var we,sr=R(()=>{"use strict";we=class{constructor(e,n=Date.now){this.ttlMs=e;this.now=n}ttlMs;now;stamp;mark(e){return this.stamp={at:this.now(),id:e}}restore(e){typeof e?.at=="number"&&typeof e.id=="string"&&(this.stamp={at:e.at,id:e.id})}fresh(e){return!!this.ttlMs&&this.ttlMs>0&&!!this.stamp&&this.stamp.id===e&&this.now()-this.stamp.at<this.ttlMs}clear(){this.stamp=void 0}}});function ws(t){let e=ys;for(let n of bs.encode(t))e=(e^BigInt(n))*vs&_s;return e}function lr(t){let e=(t.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).filter(o=>Se(o).length>=2);if(!e.length)return;let n=new Array(64).fill(0);for(let o of e){let s=ws(o);for(let i=0;i<64;i++)n[i]=(n[i]??0)+((s>>BigInt(i)&1n)===1n?1:-1)}let r=0n;for(let o=0;o<64;o++)(n[o]??0)>0&&(r|=1n<<BigInt(o));return r.toString(16).padStart(16,"0")}function ur(t){let n=` ${t.toLowerCase().replace(/’/g,"'").replace(/[.,!?;:]/g," ").replace(/\s+/g," ").trim()} `,r=0;for(let s of ar)n.includes(` ${s} `)&&(r++,n=n.split(` ${s} `).join(" "));let o=cr.filter(s=>n.includes(` ${s} `)).length;return r>o?-1:o>r?1:0}function xs(t){let e=dr(t);if(e.length<13||e.length>19)return!1;let n=0;return e.reverse().forEach((r,o)=>n+=o%2===1?r>4?r*2-9:r*2:r),n%10===0}function Ss(t){let e=dr(t).length;return e>=10&&e<=15}function It(t){let e=t;for(let[n,r]of ks)e=e.replace(n,o=>r(o)?Cs(o):o);return e===t?void 0:e}function pr(t){if(typeof t!="string")return;let e=t.toLowerCase();return/^[0-9a-f]{32}$/.test(e)?e:void 0}function Es(t,e,n){let r=At(e,n),o=It(r);return o===void 0?{[t]:r}:{[t]:o,$ai_text_redacted:!0}}function gr(t,e,n,r){if(t!=="user"&&t!=="assistant")return;let o={$ai_role:t,$ai_message_index:n,$ai_text_length:Se(e).length};if(t==="user"){let s=lr(e);s!==void 0&&(o.$ai_text_hash=s),o.$ai_sentiment=ur(e)}return r?{...o,...Es("$ai_text",e,ms)}:o}function mr(t,e){let n=t.value;if(t.kind==="thumbs"&&n!==1&&n!==-1||t.kind==="rating"&&!(Number.isInteger(n)&&n>=1&&n<=5)||t.kind!=="thumbs"&&t.kind!=="rating"&&t.kind!=="comment")return;let r={$ai_feedback_kind:t.kind};if(t.kind!=="comment"&&(r.$ai_feedback_value=n),t.comment&&e){let o=At(t.comment,hs);r.$ai_feedback_comment=It(o)??o}return t.messageIndex!==void 0&&(r.$ai_message_index=t.messageIndex),r}function Ot(t,e){let n=fr(t),r=xe(e,64);return{...n?{$ai_outcome:n}:{},...r?{$ai_resolution:r}:{}}}function Rs(){let t=globalThis.crypto,e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let r=0;r<16;r++)e[r]=Math.floor(Math.random()*256);e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function hr(t={}){let e={$ai_conversation_id:t.conversationId||Rs()},n=(r,o)=>{o!==void 0&&(e[r]=o)};return n("$ai_agent_name",xe(t.agentName,128)),n("$ai_agent_version",xe(t.agentVersion,64)),n("$ai_topic",xe(t.topic,128)),n("$ai_use_case",xe(t.useCase,128)),n("$ai_trace_id",pr(t.traceId)),e}var ue,gs,ms,hs,ar,cr,Se,At,ys,vs,_s,bs,dr,ir,ks,Cs,fr,xe,ke,yr=R(()=>{"use strict";ue={started:"$ai_conversation_started",message:"$ai_message",feedback:"$ai_feedback",ended:"$ai_conversation_ended",outcome:"$ai_outcome"},gs=["resolved","unresolved","escalated","abandoned","error"],ms=4e3,hs=2e3,ar=["wrong","useless","not helpful","unhelpful","doesn't work","does not work","didn't help","did not help","not what i asked","that's not it","stupid","terrible","awful","frustrating","frustrated","annoying","worst","hate","incorrect","nonsense","confusing","makes no sense","real person","human agent","talk to a human","speak to a human","wtf","ugh"],cr=["thanks","thank you","great","perfect","awesome","helpful","that worked","works now","solved","exactly"],Se=t=>Array.from(t),At=(t,e)=>Se(t).slice(0,e).join(""),ys=0xcbf29ce484222325n,vs=0x100000001b3n,_s=0xffffffffffffffffn,bs=new TextEncoder;dr=t=>Se(t).filter(e=>e>="0"&&e<="9").map(Number);ir=String.raw`[\p{Alphabetic}\p{M}\p{Nd}\p{Pc}\p{Join_Control}]`,ks=[[new RegExp(String.raw`(?<!${ir})\p{Nd}(?:[ -]?\p{Nd}){12,18}(?!${ir})`,"gu"),xs],[/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g,()=>!0],[/\+?\p{Nd}[\p{Nd}\s().-]{7,}\p{Nd}/gu,Ss]];Cs=t=>Se(t).map(e=>/\s/u.test(e)?e:"*").join("");fr=t=>typeof t=="string"&&gs.includes(t)?t:void 0,xe=(t,e)=>typeof t=="string"&&t?At(t,e):void 0;ke=class{next=0;common;emit;captureText;constructor(e,n={},r=!1){this.emit=e,this.captureText=r,this.common=hr(n)}get id(){return this.common.$ai_conversation_id}send(e,n){this.emit(e,{...this.common,...n})}start(){return this.send(ue.started,{}),this}message(e,n,r={}){let o=r.index??this.next,s=gr(e,n,o,this.captureText);return s?(this.next=o+1,this.send(ue.message,s),!0):!1}feedback(e){let n=mr(e,this.captureText);return n?(this.send(ue.feedback,n),!0):!1}end(e,n){this.send(ue.ended,Ot(e,n))}outcome(e,n){let r=Ot(e,n);return r.$ai_outcome?(this.send(ue.outcome,r),!0):!1}}});var de=R(()=>{"use strict";$n();at();An();In();Mn();Tn();rr();St();or();sr();yr()});function br(t,e=90,n=Date.now){let r,o=()=>{try{return JSON.parse(t.get(_r)??"{}")}catch{return{}}};return()=>{let s=o();if(location.search!==r){r=location.search;let a=new URLSearchParams(r),l=!1;for(let c of K){let u=a.get(c);u&&(s[c]={v:u.slice(0,512),t:n()},l=!0)}l&&t.set(_r,JSON.stringify(s))}let i={};for(let a of K){let l=s[a];l&&n()-l.t<e*864e5&&(i[a]=l.v)}return i}}var K,_r,Ce=R(()=>{"use strict";K=["gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","igshid","msclkid","ttclid","li_fat_id","twclid","mc_cid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],_r="lc_click_ids"});function Hs(t){let e={},n=new URLSearchParams(location.search);for(let r of[...te,...K,...t]){let o=n.get(r);o&&(e[`$${r}`]=o)}return e}function Rr(t){if(!t)return;let e=Array.isArray(t)?{params:t}:{params:t.params??Ns,...t.category?{category:t.category}:{}};return e.params.length?e:void 0}function Pr(t){let e=new URLSearchParams(location.search);for(let n of t){let r=e.get(n);if(r)return r.slice(0,256)}}function $r(){let t=new URLSearchParams(location.search),e=te.map(n=>t.get(n)??"");return e.some(Boolean)?e.join("|"):void 0}function qs(t){try{return t?new URL(t).hostname:""}catch{return""}}function Us(){let t=location.hash;return t.length>1?location.pathname+t.split("?")[0]:location.pathname}function Or(t,e,n=[],r=!1){let o={$current_url:Ws(),$host:location.host,$pathname:r?Us():location.pathname,$referrer:document.referrer,$title:document.title,$screen_width:screen.width,$screen_height:screen.height,$viewport_width:window.innerWidth,$viewport_height:window.innerHeight,$browser_language:navigator.language,$timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};if(navigator.maxTouchPoints>1&&(o.$touch_points=navigator.maxTouchPoints),t!=="$pageview")return{properties:o};let s=Hs(n);Object.assign(o,s);let i=e.$current_url??location.href,a=e.$referrer??document.referrer,l={$initial_referrer:a||"$direct",$initial_referring_domain:qs(a)||"$direct",$initial_current_url:i};for(let[c,u]of Object.entries(s))l[`$initial_${c.slice(1)}`]=u;return{properties:o,$set_once:l}}var te,Ns,Ws,Ke=R(()=>{"use strict";Ce();te=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];Ns=["ref","referral","via","aff"];Ws=()=>location.href.replace(/([?&])__lc_toolbar=[^&#]*&?/,"$1").replace(/[?&]$/,"")});function Fr(t,e=Date.now){let n=t.eventsPerSecond??10,r=t.burst??100,o=r,s=e();return()=>{let i=e();return o=Math.min(r,o+(i-s)/1e3*n),s=i,o<1?!1:(o-=1,!0)}}var Lr=R(()=>{"use strict"});function Dr(t,e){let n=t,r=[...Ks,...e.maskParams??[],...e.maskCampaignParams?[...te,...K]:[]];if(r.length){let o=n.indexOf("#"),s=o<0?n:n.slice(0,o),i=o<0?"":n.slice(o);n=s.replace(new RegExp(`([?&])(${r.map(jr).join("|")})=[^&]*`,"gi"),`$1$2=${qt}`)+i}return e.stripHash&&(n=n.replace(/#.*$/,"")),n}function Wt(t){let e=new RegExp(`^\\$(initial_|last_)?(${[...te,...K].map(jr).join("|")})$`),n=r=>{let o;if(t.maskCampaignParams)for(let[s,i]of Object.entries(r))typeof i=="string"&&e.test(s)?(o??={...r})[s]=qt:s==="$click_ids"&&i&&typeof i=="object"&&((o??={...r})[s]=Object.fromEntries(Object.keys(i).map(a=>[a,qt])));for(let s of Gs){let i=(o??r)[s];if(typeof i!="string")continue;let a=Dr(i,t);a!==i&&((o??={...r})[s]=a)}return o??r};return r=>({...r,properties:n(r.properties),...r.$set?{$set:n(r.$set)}:{},...r.$set_once?{$set_once:n(r.$set_once)}:{}})}var qt,Ks,Gs,jr,Ut=R(()=>{"use strict";Ce();Ke();qt="<masked>",Ks=["password","passwd","pwd","pass","token","access_token","refresh_token","id_token","secret","client_secret","api_key","apikey","key","auth","authorization","code","otp","email","ssn"],Gs=["$current_url","$referrer","$initial_referrer","$initial_current_url","$last_current_url"],jr=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});function Li(t){return t.startsWith("re:")?t.slice(3):t.split("*").map(e=>e.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function on(t,e){return!!t?.some(n=>{try{return new RegExp(Li(n),"i").test(e)}catch{return!1}})}var po=R(()=>{"use strict"});de();var Ps=["bot","crawl","spider","slurp","headlesschrome","phantomjs","puppeteer","playwright","lighthouse","pingdom","uptimerobot","facebookexternalhit","preview","scrapy","python-requests","go-http-client","cypress","lightpanda","hubspot","nessus","prerender","deepscan","screaming frog","sitebulb","turnitin","ia_archiver","chatgpt-user","app.hypefactors.com","google favicon","google web preview","-google","googleother","googleweblight","google-read-aloud","google-inspectiontool","google-hoteladsverifier","google-cloudvertexbot"];function vr(t,e=[]){let n=t.toLowerCase();return e.some(r=>r&&n.includes(r.toLowerCase()))?!0:Ps.some(r=>n.includes(r))&&!/\bcubot\b/.test(n)}Ce();function $s(t,e){let n=document.createElement("style");return e&&n.setAttribute("nonce",e),n.textContent=t,n}function Os(){return Array.from(document.querySelectorAll("meta[http-equiv]")).filter(t=>t.getAttribute("http-equiv")?.toLowerCase()==="content-security-policy").map(t=>t.getAttribute("content")??"")}function xr(t){let e=new Map;for(let r of t.split(";")){let[o,...s]=r.trim().toLowerCase().split(/\s+/);o&&!e.has(o)&&e.set(o,s)}let n=e.get("style-src-elem")??e.get("style-src")??e.get("default-src");return!!n&&!(n.includes("'unsafe-inline'")&&!n.some(r=>r.startsWith("'nonce-")||r.startsWith("'sha")))}function kr(t,e){if(typeof document>"u")return()=>{};!e&&Os().some(xr)&&t("CSP hint: this page's Content-Security-Policy blocks inline <style>; set the `nonce` option so guides and the experiment veil render (see the Content Security Policy help page)");let n=r=>{let o=r;/^style-src/.test(o.effectiveDirective??"")&&o.blockedURI==="inline"&&t(`CSP hint: an inline style was blocked by ${o.effectiveDirective}${e?" (check that `nonce` matches the page's nonce)":"; set the `nonce` option"}`)};return document.addEventListener("securitypolicyviolation",n),()=>document.removeEventListener("securitypolicyviolation",n)}var As=(t,e)=>t.slice(0,e);function wr(t){try{let e=new URL(t);return e.protocol==="data:"||e.protocol==="blob:"?e.protocol:e.origin+e.pathname}catch{return As(t,64)}}function Mt(t,e={}){if(typeof document>"u")return()=>{};let n=e.maxPerPage??20,r=new Set,o=s=>{let i=s,a={$csp_directive:i.effectiveDirective??i.violatedDirective,$csp_blocked_uri:wr(i.blockedURI??""),$csp_source_file:i.sourceFile?wr(i.sourceFile):void 0,$csp_line:i.lineNumber||void 0,$csp_column:i.columnNumber||void 0,$csp_disposition:i.disposition},l=[a.$csp_directive,a.$csp_blocked_uri,a.$csp_source_file,a.$csp_line].join("|");r.has(l)||r.size>=n||(r.add(l),t("$csp_violation",Object.fromEntries(Object.entries(a).filter(([,c])=>c!==void 0))))};return document.addEventListener("securitypolicyviolation",o),()=>document.removeEventListener("securitypolicyviolation",o)}var Is=["chrome-extension:","moz-extension:","safari-web-extension:","ms-browser-extension:"],Tt=()=>typeof location<"u"&&Is.includes(location.protocol),Ft=(t,e,n)=>`${t.replace(/\/+$/,"")}/static/v${e}/${n}`,Ms={replay:"replay",heatmaps:"heatmaps",forms:"forms",toolbar:"toolbar",guides:"guides",inspector:"inspector",experiments:"visualChanges","early-access":"earlyAccess",consent:"consentModule"},Ts=t=>import(t);async function Fs(t,e,n=globalThis.fetch){try{let r=await n(Ft(t,e,"manifest.json"),{credentials:"omit"});if(!r.ok)return;let o=await r.json();return o&&typeof o.files=="object"&&o.files?o:void 0}catch{return}}async function Ls(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-384",t));return`sha384-${btoa(String.fromCharCode(...e))}`}async function js(t,e,n,r=Ts,o=globalThis.fetch){let s=t.length?await Fs(e.assetHost,e.version,o):void 0;return(await Promise.all(t.map(async a=>{let l=Ms[a];if(!l)return n("unknown module",a);let c=Ft(e.assetHost,e.version,`${a}.js`);try{if(s){let f=s.files[`${a}.js`],h=f?await o(c,{credentials:"omit",cache:"force-cache"}):void 0;if(!h?.ok||await Ls(await h.arrayBuffer())!==f)return n("module refused, it does not match the manifest",a)}let u=(await r(c))[l];return typeof u=="function"?u:n("module has no export",a,l)}catch(u){return n("module failed to load",a,u)}}))).filter(a=>!!a)}function Sr(t,e,n){let r=e.find(i=>t.startsWith(`${i}/`));if(!r)return t;let o=t.slice(r.length),s=o.search(/[?#]/);return r+n(s<0?o:o.slice(0,s))+(s<0?"":o.slice(s))}function Cr(t,e,n,r){if(!r)return{transport:t,fetch:e};let o=s=>Sr(s,n,r);return{transport:{send:(s,i,a)=>t.send(o(s),i,a)},fetch:((s,i)=>e(typeof s=="string"?o(s):s instanceof URL?o(s.href):s,i))}}var Ds="__LUCIDA_DEVTOOLS_HOOK__";function Er(t,e,n){let r=globalThis[Ds];if(!(!r||typeof r.emit!="function"||typeof r.attach!="function")){t.onCapture(o=>{try{r.emit(o)}catch{}});try{r.attach({projectKeyPrefix:t.apiKey.slice(0,8),apiHost:n,distinctId:()=>e.distinctId,loadToolbar:o=>e.loadToolbar(o),startReplay:async()=>t.replay?(await t.replay.start(!0),t.replay.isRecording()):!1,replayUrl:()=>e.getReplayUrl()})}catch{}}}Ke();function Lt(t,e,n=globalThis){e&&(n[typeof e=="string"?e:"lucida"]=t,typeof CustomEvent=="function"&&n.dispatchEvent?.(new CustomEvent("lucida:ready",{detail:t})))}de();var pe=()=>{},jt=()=>Promise.resolve(),Ar={isInternal:!1,hasOptedOut:()=>!1,hasOptedIn:()=>!1,consentStatus:()=>"pending",getConsentStatus:()=>"pending",getConsent:()=>({analytics:!1,replay:!1,marketing:!1}),getAllFlags:()=>({}),isFeatureEnabled:()=>!1,getFlagResult:t=>ie(t,void 0,void 0,"not_found"),getReplayUrl:()=>"",onSessionId:()=>pe,onFlags:()=>pe,onIntervention:()=>pe,onConsent:()=>pe,flush:jt,shutdown:jt,reloadFlags:jt,loadToolbar:()=>Promise.resolve(!1),recommendations:t=>Promise.resolve({placement:t,strategy:"",items:[],shown:pe,clicked:pe})};function Ir(t){return new Proxy(()=>{},{get:(e,n)=>{if(!(typeof n!="string"||n==="then"))return t&&Object.hasOwn(Ar,n)?Ar[n]:Ir(!1)}})}var Dt=()=>Ir(!0);var Ht="_lcid";var Mr=(t,e)=>e.some(n=>{let r=n.replace(/^\./,"").toLowerCase();return t.toLowerCase()===r||t.toLowerCase().endsWith(`.${r}`)}),Bs=(t,e=Date.now(),n)=>`${t}.${e.toString(36)}${n?`_${n}`:""}`;function Vs(t,e=Date.now()){let n=t.lastIndexOf("."),[r="",o]=t.slice(n+1).split("_",2),s=/^[0-9a-z]+$/.test(r)?parseInt(r,36):NaN,i=t.slice(0,n);if(n>0&&i.length<=200&&s<=e+5e3&&e-s<=12e4)return o&&/^[\w-]{1,64}$/.test(o)?{distinctId:i,sessionId:o}:{distinctId:i}}function Tr(t){if(!t?.length)return;let e=new URL(location.href),n=e.searchParams.get(Ht);if(n!==null){e.searchParams.delete(Ht),history.replaceState(history.state,"",e.toString());try{if(document.referrer&&!Mr(new URL(document.referrer).hostname,t))return}catch{return}return Vs(n)}}var Nt=t=>{let e=t.config.crossDomains;if(!e?.length)return;let n=r=>{let o=r.target instanceof Element?r.target.closest("a[href]"):null;if(!o||!t.core.hasConsent("analytics"))return;let s=o;if(!/^https?:$/.test(s.protocol)||s.host===location.host||!Mr(s.hostname,e))return;let i=new URL(s.href);i.searchParams.set(Ht,Bs(t.client.distinctId,Date.now(),t.core.sessionId)),s.href=i.toString()};return document.addEventListener("click",n,!0),document.addEventListener("auxclick",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("auxclick",n,!0)}};Lr();Ut();function zs(t,e,n){let r=e;for(let o of t)try{let s=o(r);if(s==null)return null;if(typeof s!="object"||typeof s.event!="string")return n("beforeSend hook returned a non-event, dropping:",typeof s),null;r=s}catch(s){return n("beforeSend hook threw, dropping event:",s),null}return r}function qr(t,e=Math.random){return n=>t>=1?n:t<=0||e()>=t?null:{...n,properties:{...n.properties,$sample_rate:t}}}function Wr(t){let e=new Set(t),n=r=>Object.fromEntries(Object.entries(r).filter(([o])=>!e.has(o)));return r=>({...r,properties:n(r.properties),...r.$set?{$set:n(r.$set)}:{},...r.$set_once?{$set_once:n(r.$set_once)}:{}})}var Bt="lc_person_identified",Ge="lc_pending_set_once",Hr=new Set(["$identify","$create_alias","$groupidentify"]),Nr="$$client_ingestion_warning",Xs=6e4,Vt=class{constructor(e,n){this.mode=e;this.storage=n;this.identified=n.get(Bt)==="1";try{this.pending=JSON.parse(n.get(Ge)??"{}")}catch{this.pending={}}}mode;storage;identified;pending;get blocksPersonWrites(){return this.mode==="never"}get isProfile(){return this.mode==="always"||this.mode==="identified_only"&&this.identified}markIdentified(){this.mode!=="identified_only"||this.identified||(this.identified=!0,this.storage.set(Bt,"1"))}personless(e){return this.mode==="always"?!1:(this.mode==="never"||!this.identified)&&!Hr.has(e)}stash(e){if(this.mode!=="identified_only"||!e)return;let n=Object.entries(e).filter(([r])=>!(r in this.pending));n.length&&(this.pending={...this.pending,...Object.fromEntries(n)},this.storage.set(Ge,JSON.stringify(this.pending)))}take(){if(!Object.keys(this.pending).length)return;let e=this.pending;return this.pending={},this.storage.remove(Ge),e}reset(){this.identified=!1,this.pending={},this.storage.remove(Bt),this.storage.remove(Ge)}};function Ys(t,e){let n=e,r;if(t.person.personless(e.event)){t.person.stash(e.$set_once);let{$set:s,$set_once:i,$unset:a,...l}=e;n={...l,properties:{...e.properties,$process_person_profile:!1}}}else(r=t.person.take())&&(n={...e,$set_once:{...e.$set_once,...r}});let o=t.hooks.length?zs(t.hooks,n,t.log):n;return o&&t.limit&&!t.limit()&&(t.log("rate limited, dropped",o.event),t.onLimited?.(),o=null),!o&&r&&t.person.stash(r),o}function Js(t){let e=t.beforeSend?Array.isArray(t.beforeSend)?t.beforeSend:[t.beforeSend]:[];return[Wt(t.urlPrivacy??{}),...t.propertyDenylist?.length?[Wr(t.propertyDenylist)]:[],...t.sampleRate!==void 0?[qr(t.sampleRate)]:[],...e]}function Ur(t,e,n,r=Date.now){let o=new Vt(e.personProfiles??"always",t.storage),s,i,a=0,l=-1/0,c=()=>{a+=1,!(r()-l<Xs)&&(l=r(),queueMicrotask(()=>{let u=a;a=0,t.capture(Nr,{$$client_ingestion_warning_message:`client rate limit dropped ${u} event(s)`,$dropped_count:u})}))};return t.setFilter(u=>(e.rateLimit!==s&&(s=e.rateLimit,i=s?Fr(s):void 0),Ys({hooks:Js(e),person:o,limit:u.event===Nr?void 0:i,log:n,onLimited:c},u))),o}var Kt=class{m=new Map;get(e){return this.m.get(e)??null}set(e,n){this.m.set(e,n)}remove(e){this.m.delete(e)}},Zs=365,Qs=new Set("co.uk org.uk ac.uk gov.uk me.uk ltd.uk plc.uk net.uk com.au net.au org.au edu.au gov.au co.nz org.nz net.nz co.jp ne.jp or.jp ac.jp go.jp co.kr or.kr com.cn net.cn org.cn com.hk com.tw com.sg com.my co.in net.in org.in co.id co.th com.ph com.vn com.br net.br org.br com.ar com.mx com.co com.pe com.tr com.ua com.pl co.za co.il com.eg com.sa com.ng co.ke github.io gitlab.io vercel.app netlify.app herokuapp.com pages.dev workers.dev web.app firebaseapp.com azurewebsites.net cloudfront.net appspot.com onrender.com fly.dev glitch.me repl.co blogspot.com wordpress.com myshopify.com vercel.dev netlify.com surge.sh render.com railway.app koyeb.app deno.dev ngrok.io ngrok-free.app trycloudflare.com cloudfunctions.net run.app s3.amazonaws.com elasticbeanstalk.com azurestaticapps.net wixsite.com webflow.io framer.app bubbleapps.io".split(" ")),ei=new Set("co com net org edu gov gob go ac or ne ltd plc sch mil nom".split(" "));function ti(t){let e=t.toLowerCase().split(".");for(let n=1;n<e.length-1;n++)if(Qs.has(e.slice(n).join("."))||n===e.length-2&&e[n+1].length===2&&ei.has(e[n]))return e.slice(n-1).join(".")}function ni(t=location.hostname){if(/^[\d.]+$/.test(t)||t.includes(":"))return;let e=t.split(".");for(let n=e.length-2;n>=0;n--){let r=e.slice(n).join(".");if(document.cookie=`__lc_probe=1; Domain=${r}; Path=/; Max-Age=10; SameSite=Lax`,document.cookie.includes("__lc_probe=1"))return document.cookie=`__lc_probe=; Domain=${r}; Path=/; Max-Age=0`,r}return ti(t)}var ze=class{constructor(e={}){this.o=e}o;domain=null;attr(){if(this.domain===null)try{this.domain=this.o.domain??(this.o.crossSubdomain?ni():void 0)}catch{this.domain=void 0}return this.domain?`; Domain=${this.domain}`:""}held=new Map;read(e){try{for(let n of document.cookie.split("; ")){let r=n.indexOf("=");if(n.slice(0,r)===e)return decodeURIComponent(n.slice(r+1))}}catch{}return null}get(e){return this.read(e)??this.held.get(e)??null}set(e,n){let r=this.o.secure??location.protocol==="https:"?"; Secure":"",o=Math.round((this.o.expiryDays??Zs)*86400);try{document.cookie=`${e}=${encodeURIComponent(n)}; Max-Age=${o}; Path=/${this.attr()}; SameSite=Lax${r}`}catch{}this.read(e)===n?this.held.delete(e):this.held.set(e,n)}remove(e){this.held.delete(e);try{document.cookie=`${e}=; Max-Age=0; Path=/${this.attr()}; SameSite=Lax`}catch{}}},fe=class{constructor(e="localStorage"){this.kind=e}kind;store(){try{return globalThis[this.kind]}catch{return}}get(e){try{return this.store()?.getItem(e)??null}catch{return null}}set(e,n){try{this.store()?.setItem(e,n)}catch{}}remove(e){try{this.store()?.removeItem(e)}catch{}}},Gt=class extends fe{constructor(){super("localStorage")}},ri=["lc_identity","lc_session","lc_device_id","lc_consent","lc_person_identified"],zt=class{constructor(e,n,r){this.cookie=e;this.local=n;this.cookieKeys=r}cookie;local;cookieKeys;get(e){let[n,r]=this.cookieKeys(e)?[this.cookie,this.local]:[this.local,this.cookie];return n.get(e)??r.get(e)}set(e,n){this.local.set(e,n),this.cookieKeys(e)?this.cookie.set(e,n):this.cookie.remove(e)}remove(e){this.local.remove(e),this.cookie.remove(e)}},Xe=class{constructor(e,n){this.inner=e;this.delayMs=n}inner;delayMs;pending=new Map;timer;get(e){return this.pending.has(e)?this.pending.get(e)??null:this.inner.get(e)}set(e,n){this.queue(e,n)}remove(e){this.queue(e,null)}queue(e,n){this.pending.set(e,n),this.timer??=setTimeout(()=>this.flush(),this.delayMs)}flush(){clearTimeout(this.timer),this.timer=void 0;for(let[e,n]of this.pending)n===null?this.inner.remove(e):this.inner.set(e,n);this.pending.clear()}},Xt=class{constructor(e,n){this.inner=e;this.suffix=n}inner;suffix;get(e){return this.inner.get(e+this.suffix)}set(e,n){this.inner.set(e+this.suffix,n)}remove(e){this.inner.remove(e+this.suffix)}},Ye=t=>`_${t.replace(/\W/g,"").slice(-8)}`;function Je(t,e,n){if(t==="memory"||t==="none")return new Kt;let r=Ye(e),o=t==="cookie"?new ze(n):t==="localStorage+cookie"?new zt(new ze(n),new Gt,s=>ri.some(i=>s===i+r)):new fe(t);return new Xt(o,r)}function Br(t,e,n){let r=Ye(e),o=new Set;try{for(let s of document.cookie.split("; "))o.add(s.split("=")[0]);for(let s of[globalThis.localStorage,globalThis.sessionStorage])for(let i=0;i<s.length;i++)o.add(s.key(i))}catch{}for(let s of o)if(!(!s.startsWith("lc_")||!s.endsWith(r)||s===n+r)){t.remove(s.slice(0,-r.length));try{localStorage.removeItem(s),sessionStorage.removeItem(s)}catch{}}}async function oi(t){if(!(typeof CompressionStream>"u"||typeof Response>"u"))try{let e=new Response(t).body?.pipeThrough(new CompressionStream("gzip"));return e?new Uint8Array(await new Response(e).arrayBuffer()):void 0}catch{return}}function Vr(t,e={}){let n=e.compress??!0,r=(o,s)=>(e.onError?.({url:o,status:s}),{status:s});return{async send(o,s,i){if(i?.beacon&&!e.disableBeacon&&typeof navigator<"u"&&navigator.sendBeacon)return navigator.sendBeacon(o,new Blob([s],{type:"text/plain"}))?{status:200}:r(o,0);try{let a=n&&s.length>=1024?await oi(s):void 0,l=await t(a?`${o}${o.includes("?")?"&":"?"}compression=gzip`:o,{method:"POST",body:a??s,headers:{...e.headers,"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",keepalive:(a?.length??s.length)<6e4});return l.status>=400?r(o,l.status):{status:l.status}}catch{return r(o,0)}}}}var Yt={send:async()=>({status:200})};var si="lucida-browser",Kr="0.1.11",Jt="lc_internal",ii=3e3,Qt="https://capture.lucidace.com",Zt=t=>!!t&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype;function en(t,e={},n=[]){if(typeof window>"u"||typeof navigator>"u")return Dt();let r=!!e.debug||typeof location<"u"&&/[?&]__(lc|lucida)_debug=(1|true)/.test(location.search),o=(...d)=>{r&&console.debug("[lucida]",...d)},s=(e.apiHost??Qt).replace(/\/+$/,""),i=Object.fromEntries(Object.entries(e).map(([d,p])=>[d,Zt(p)?{...p}:p]));i.apiHost=s;let a=e.extension??Tt(),l=d=>a&&(d==="cookie"||d==="localStorage+cookie")?e.extensionPersistence??"localStorage":d,c=l(e.cookieless==="always"?"none":e.persistence??"cookie"),u=[s,...e.flagsApiHost?[e.flagsApiHost.replace(/\/+$/,"")]:[]],f=e.fetch??((...d)=>fetch(...d)),h=d=>Cr(d,f,u,e.rewritePath),m=h(Yt).fetch,b=e.consent?.respectDnt,y=navigator.globalPrivacyControl===!0,w=(e.respectDnt??b)===!0&&navigator.doNotTrack==="1"||(e.respectGpc??b)===!0&&y,C=e.blockBots!==!1&&typeof navigator<"u"&&vr(navigator.userAgent??"",e.blockedUserAgents),E=!!e.disabled||C;C&&o("bot user agent: capture disabled");let M,q=h(e.transport??Vr(f,{headers:i.requestHeaders,onError:e.onRequestError,disableBeacon:e.disableBeacon})).transport;if(!e.transport&&e.offlineQueue!==!1&&c!=="memory"&&c!=="none"){let d=new Q(new fe(c==="sessionStorage"?"sessionStorage":"localStorage"),()=>v.hasConsent("analytics"));q=M=gt(q,d,{key:`lc_offline${Ye(t)}`,isOnline:()=>navigator.onLine!==!1})}let A=E?void 0:Tr(e.crossDomains),k=Je(E?"memory":c,t,e.cookie),I=(e.storageWriteDelayMs??0)>0?new Xe(k,e.storageWriteDelayMs):void 0,O=A?.sessionId??e.bootstrap?.sessionId,N,T=!1,j,F=new Map,ae,G=[],v=new ve({apiKey:t,apiHost:s,transport:E?Yt:q,storage:I??k,...e.consentPersistence&&!E?{consentStorage:Je(l(e.consentPersistence),t,e.cookie)}:{},persistProperty:d=>!i.persistedProperties||i.persistedProperties.includes(d),...c==="none"?{cookieless:!0}:{},library:{name:si,version:Kr},consent:{...e.cookieless==="on_reject"?{cookielessOnReject:!0}:{},...e.consent,...!E&&(e.consent?.geo||e.consent?.mode!=="opt_in")?{awaitRemote:!0}:{},respectDnt:!0,dnt:w},queue:{...e.flushAt?{flushAt:e.flushAt}:{},...e.flushIntervalMs?{flushIntervalMs:e.flushIntervalMs}:{}},...A||e.bootstrap?.distinctId?{bootstrapDistinctId:A?.distinctId??e.bootstrap?.distinctId}:{},...e.bootstrap?.isIdentified&&!A?{bootstrapIdentified:!0}:{},session:{...e.session,...O?{bootstrapId:O}:{}},enrich:(d,p)=>{let g=Or(d,p,i.customCampaignParams,e.capturePageview==="hash");if(s!==Qt&&(g.properties={...g.properties,$lib_custom_api_host:s}),G.length){let P=v.sessionId;for(let $ of G)g.properties={...g.properties,...$(P)}}if(d==="$pageview"){let P=v.sessionId;if(P!==j){let $=Rr(e.referralParams);if($&&(!$.category||F.get($.category)===!0)){j=P;let L=Pr($.params);L&&(g.properties={...g.properties,$referral_code:L},g.$set_once={...g.$set_once,initial_referral_code:L})}}}let _=ae?.()??{},S=Object.keys(_);return S.length&&(g.properties={...g.properties,$click_ids:_},d==="$pageview"&&(g.$set_once={...Object.fromEntries(S.map(P=>[`$initial_${P}`,_[P]])),...g.$set_once},g.$set=Object.fromEntries(S.map(P=>[`$last_${P}`,_[P]])))),i.sendFeatureFlags!==!1&&d!=="$snapshot"&&N&&(g.properties={...$t(N.all()),...g.properties}),T?{...g,properties:{...g.properties,$internal:!0}}:g},campaignKey:$r,log:o});T=v.storage.get(Jt)==="1",e.clickIds!==!1&&(ae=br(v.storage,e.clickIds?.expiryDays));let D=Ur(v,i,o);e.bootstrap?.isIdentified&&D.markIdentified();let W=d=>D.blocksPersonWrites?(o(`personProfiles=never: ${d} ignored`),!0):!1;E||v.onChange(d=>{d!=="consent"||v.hasConsent("analytics")||v.consentStatus()!=="denied"||(I?.flush(),Br(k,t,e.consent?.storageKey||Oe))});let ce=new Set;v.onChange(d=>{d==="consent"&&[...ce].forEach(p=>p())});let ge=[],z=[kr(o,e.nonce)],ne=v.storage;if(e.flagPersistence&&!E){let d=new Q(Je(l(e.flagPersistence),t,e.cookie),()=>v.hasConsent("analytics"));v.onChange(p=>{p==="consent"&&(v.hasConsent("analytics")?d.flushBuffered():d.discardBuffered())}),ne=d}let re=d=>{if(E)return;if(v.hasConsent("analytics"))return d();let p=!1;v.onChange(g=>{!p&&g==="consent"&&v.hasConsent("analytics")&&(p=!0,d())})},me,x={core:v,client:void 0,config:i,flagStorage:ne,apiKey:t,log:o,fetch:m,onUnload:d=>{ge.push(d)},whenConsented:re,onCapture:d=>v.onCaptured(d),eventExtras:G,clickExtras:[],flagPersonProps:[],categoryGrants:F,loadConfig:()=>me??=new Promise(d=>re(()=>{m(`${s}/v1/config?api_key=${encodeURIComponent(t)}`).then(p=>p.ok?p.json():null).then(p=>(p&&v.applyRemote(p),p)).then(d,()=>d(null))}))},he=Promise.resolve();if(v.consent.resolving){let d=!1,p=m(`${s}/v1/config?api_key=${encodeURIComponent(t)}`,{credentials:"omit"}).then(g=>(d=g.status>=500,g.ok?g.json():null)).catch(()=>(d=!0,null));me=p,he=new Promise(g=>{let _=setTimeout(()=>(v.resolveConsent("opt_in"),g()),ii);p.then(S=>{clearTimeout(_),S?v.applyRemote(S):d?v.resolveConsent("opt_in"):v.applyRemote({}),g()})})}let oe=ft(v,{apiHost:s,apiKey:t,fetch:m,whenConsented:re,log:o,disabled:E});z.push(()=>oe.stop());let J={get distinctId(){return v.distinctId},capture:(d,p,g)=>{v.capture(d,p,g?.timestamp!==void 0?{timestamp:g.timestamp}:{})&&(g?.sendInstantly||g?.transport)&&v.flush(g.transport==="beacon"?{beacon:!0}:{})},identify:(d,p,g)=>{W("identify")||(D.markIdentified(),v.identify(d,p,g))},alias:(d,p)=>{W("alias")||(D.markIdentified(),v.alias(d,p))},reset:d=>{v.reset({resetDeviceId:!!d,reuseAnonymousId:!!e.reuseAnonymousId}),D.reset()},createPersonProfile:()=>{W("createPersonProfile")||D.isProfile||(D.markIdentified(),v.capture("$set",{}))},setConfig:d=>{let p=i;for(let[g,_]of Object.entries(d)){let S=p[g];Zt(S)&&Zt(_)?Object.assign(S,_):p[g]=_}"debug"in d&&(r=!!d.debug)},setPersonProperties:(d,p)=>{!d&&!p||W("setPersonProperties")||(D.markIdentified(),v.capture("$set",{},{...d?{$set:d}:{},...p?{$set_once:p}:{}}))},unsetPersonProperties:d=>{!d.length||W("unsetPersonProperties")||(D.markIdentified(),v.capture("$set",{},{$unset:d}))},getDistinctId:()=>v.distinctId,getSessionId:()=>v.sessionId,onSessionId:d=>v.onSessionId(p=>d(p)),getProperty:d=>v.getProperty(d),hasOptedOut:()=>v.consentStatus()==="denied",hasOptedIn:()=>v.consentStatus()==="granted",onConsent:d=>(ce.add(d),()=>{ce.delete(d)}),getReplayUrl:d=>{let g=`${(e.uiHost??s).replace(/\/+$/,"")}/replays/${encodeURIComponent(v.sessionId)}`,_=v.sessionStart;return!d?.withTimestamp||_===void 0?g:`${g}?t=${Math.max(0,Math.round((Date.now()-_)/1e3-(d.timestampLookBackSeconds??10)))}`},debug:(d=!0)=>{r=d},featureView:(d,p)=>{v.capture("$feature_view",{...p,$feature_flag:d},{$set:{[`$feature_view/${d}`]:!0}})},featureInteraction:(d,p)=>{v.capture("$feature_interaction",{...p,$feature_flag:d},{$set:{[`$feature_interaction/${d}`]:!0}})},updateFlags:(d,p,g)=>x.flags?.update(d,p,g?.merge??!0),register:d=>v.register(d),registerOnce:d=>v.registerOnce(d),unregister:d=>v.unregister(d),group:(d,p,g)=>{D.markIdentified(),v.group(d,p,g)},optIn:(d=["analytics","replay"])=>v.setConsent({analytics:d.includes("analytics"),replay:d.includes("replay"),marketing:d.includes("marketing")}),optOut:()=>v.optOut(),optOutInternal:(d=!0)=>{T=d,d?v.storage.set(Jt,"1"):v.storage.remove(Jt)},get isInternal(){return T},setConsent:d=>v.setConsent(d),getConsent:()=>v.getConsent(),getConsentStatus:d=>v.getConsentStatus(d),consentStatus:()=>v.consentStatus(),getFlag:d=>x.flags?.get(d),getFlagPayload:d=>x.flags?.payload(d),getFlagResult:(d,p)=>x.flags?.result(d,p)??ie(d,void 0,void 0,"not_found"),getLayerParam:(d,p,g)=>x.flags?.layerParam(d,p)??g,isFeatureEnabled:d=>{let p=x.flags?.get(d);return p!==void 0&&p!==!1},onFlags:d=>x.flags?.onChange(d)??(()=>{}),onIntervention:d=>oe.on(d),reloadFlags:()=>x.flags?.reload()??Promise.resolve(),getAllFlags:()=>x.flags?.all()??{},overrideFlags:(d,p)=>x.flags?.override(d,p),setPersonPropertiesForFlags:(d,p)=>x.flags?.setPersonProperties(d,p),resetPersonPropertiesForFlags:()=>x.flags?.resetPersonProperties(),setGroupPropertiesForFlags:(d,p)=>x.flags?.setGroupProperties(d,p),resetGroupPropertiesForFlags:()=>x.flags?.resetGroupProperties(),setContext:(d,p,g)=>x.flags?.setContext(d,p,g),clearContext:d=>x.flags?.clearContext(d),guides:{showChangelog:()=>x.guides?.showChangelog()??0,show:d=>x.guides?.show(d)??!1,reset:d=>x.guides?.reset(d)},ai:{startConversation:d=>new ke((p,g)=>J.capture(p,g),d,i.ai?.captureText===!0).start()},earlyAccess:{list:()=>x.earlyAccess?.list()??Promise.resolve([]),optIn:d=>x.earlyAccess?.optIn(d),optOut:d=>x.earlyAccess?.optOut(d)},replay:{start:d=>x.replay?.start(d)??Promise.resolve(),stop:()=>x.replay?.stop(),pause:()=>x.replay?.pause(),resume:()=>x.replay?.resume(),tag:d=>x.replay?.tag(d),isRecording:()=>x.replay?.isRecording()??!1},consent:{showBanner:d=>x.consentUi?.showBanner(d)??Promise.resolve(null),hideBanner:()=>x.consentUi?.hideBanner()},loadToolbar:d=>x.toolbar?.load(typeof d=="string"?d:d.token)??Promise.resolve(!1),activateExperiment:d=>x.experiments?.activate(d),recommendations:(d,p)=>x.recs?.get(d,p)??Promise.resolve({placement:d,strategy:"",items:[],shown(){},clicked(){}}),flush:()=>he.then(()=>v.flush()),shutdown:async()=>{for(let d of z)d();I?.flush(),await v.shutdown()}};if(x.client=J,!E){let d=()=>{for(let g of ge)g();I?.flush(),v.flush({beacon:!0})};window.addEventListener("pagehide",d);let p=()=>{document.visibilityState==="hidden"&&v.flush({beacon:!0})};if(document.addEventListener("visibilitychange",p),z.push(()=>{window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",p)}),M){let g=()=>{M.drain()};window.addEventListener("online",g),z.push(()=>window.removeEventListener("online",g)),re(g)}if(e.captureCspViolations){let g=typeof e.captureCspViolations=="object"?e.captureCspViolations:{};z.push(Mt((_,S)=>{v.capture(_,S)},g))}for(let g of n){let _=g(x);_&&z.push(_)}N=x.flags,n.length||x.loadConfig(),Er(x,J,s)}return Lt(J,e.exposeGlobal),o("initialised",{apiHost:s,consent:v.getConsent()}),J}var ai='[data-lc-region="article"]';function Gr(t,e,n){if(e.articles===!1)return()=>{};let r;t.loadConfig().then(y=>{typeof y?.article_selector=="string"&&(r=y.article_selector)});let o=()=>{for(let y of[e.articleSelector,r,ai])if(y)try{let w=document.querySelector(y);if(w)return w}catch{}return null},s=location.href,i=location.pathname,a=null,l=0,c=!1,u=()=>{if(a??=o(),!a)return;let y=a.getBoundingClientRect();if(y.height<=0)return;let w=Math.round(Math.min(100,Math.max(0,(window.innerHeight-y.top)/y.height*100)));l=Math.max(l,w);let C=a.querySelector("h1,h2");C&&C.getBoundingClientRect().bottom<0&&(c=!0)},f=()=>{!a||!n()||(u(),t.client.capture("$article_read",{$article_id:(a.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||i,$article_depth:l,$article_finished:l>=90,$article_headline_exit:!c&&l<25}),a=null)},h=()=>{f(),a=null,l=0,c=!1,s=location.href,i=location.pathname},m=()=>location.href!==s?h():u(),b=new MutationObserver(m);return b.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",m,{passive:!0}),t.onUnload(f),u(),()=>{b.disconnect(),window.removeEventListener("scroll",m)}}var Ze="data-lc-content",ci="data-lc-content-piece",li="data-lc-content-target";var tn=(t,e)=>(t.getAttribute(e)??"").trim().slice(0,200);function zr(t,e,n){if(e.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let r=new WeakSet,o=u=>{let f={$content_name:tn(u,Ze)},h=tn(u,ci),m=tn(u,li);return h&&(f.$content_piece=h),m&&(f.$content_target=m),f},s=location.href,i=new IntersectionObserver(u=>{for(let f of u)!f.isIntersecting||r.has(f.target)||!n()||(r.add(f.target),t.client.capture("$content_impression",o(f.target)))},{threshold:.5}),a=u=>u.querySelectorAll(`[${Ze}]`).forEach(f=>i.observe(f));a(document);let l=new MutationObserver(()=>{location.href!==s&&(s=location.href,i.disconnect(),document.querySelectorAll(`[${Ze}]`).forEach(u=>r.delete(u))),a(document)});l.observe(document.documentElement,{childList:!0,subtree:!0});let c=u=>{let f=u.target?.closest?.(`[${Ze}]`);f&&n()&&t.client.capture("$content_interaction",{...o(f),$content_interaction_type:"click"})};return document.addEventListener("click",c,!0),()=>{i.disconnect(),l.disconnect(),document.removeEventListener("click",c,!0)}}var ui=new Set(["input","textarea","select","option"]),di=["name","type","role","aria-label","title","alt","placeholder"],pi=new Set(["aria-label","aria-description","title","alt","placeholder","value","label"]),fi=/(?:\d[ -]?){9,}/;function gi(t){if(ui.has(t.tagName.toLowerCase())||t.isContentEditable)return;let e="";for(let n of Array.from(t.childNodes))n.nodeType===3&&(e+=n.textContent??"");if(e=e.replace(/\s+/g," ").trim(),!(!e||fi.test(e)))return e.slice(0,255)}function Xr(t){if(!t?.length)return()=>!1;let e=t.map(n=>n.toLowerCase());return n=>e.some(r=>r.endsWith("*")?n.startsWith(r.slice(0,-1)):n===r)}var mi="***";function et(t){let e={};for(let n=t,r=0;n&&r<10;n=n.parentElement,r++)for(let o of Array.from(n.attributes)){let s=o.name.startsWith("data-lc-attr-")?o.name.slice(13):"";s&&!(s in e)&&!s.startsWith("$")&&(e[s]=o.value.slice(0,255))}return e}function hi(t,e,n,r,o){let s=t.parentElement,i=s?Array.from(s.children):[t],a={tag_name:t.tagName.toLowerCase(),nth_child:i.indexOf(t)+1,nth_of_type:i.filter(f=>f.tagName===t.tagName).indexOf(t)+1},l=(t.getAttribute("class")??"").split(/\s+/).filter(Boolean);l.length&&!r("class")&&(a.classes=l),t.id&&!r("id")&&(a.attr__id=o("id",t.id));let c=t.getAttribute("href");c&&!r("href")&&(a.href=o("href",c.slice(0,1024)));let u={};for(let f of Array.from(t.attributes))(f.name.startsWith("data-lc-")||di.includes(f.name))&&!r(f.name)&&(n||!pi.has(f.name))&&(u[f.name]=o(f.name,f.value.slice(0,255)));if(Object.keys(u).length&&(a.attrs=u),e){let f=gi(t);f&&(a.text=f)}return a}function tt(t,e,n,r,o={}){let s=[],i=Xr(r),a=Xr(o.allow),l=o.maskAll?(u,f)=>a(u)?f:mi:(u,f)=>f,c=e;for(let u=t;u&&s.length<10;u=u.parentElement)s.push(hi(u,c,e,i,l)),(u===n||!n)&&(c=!1);return s}var Qe=t=>t.replace(/(["\\])/g,"\\$1");function nt(t){return t.map(e=>{let n=e.tag_name+(e.classes?"."+e.classes.join("."):"")+":";e.attr__id&&(n+=`attr__id="${Qe(e.attr__id)}"`),e.href&&(n+=`href="${Qe(e.href)}"`),e.text&&(n+=`text="${Qe(e.text)}"`);for(let[r,o]of Object.entries(e.attrs??{}))n+=`attr__${r}="${Qe(o)}"`;return n+`nth-child="${e.nth_child}"nth-of-type="${e.nth_of_type}"`}).join(";")}var Y=[],yi=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,vi=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,_i=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,bi="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function wi(t,e=[]){if(e.length&&t.closest(e.join(","))||t.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=t.closest(bi)??t,r=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(yi.test((n.textContent??"").trim())||vi.test(r))return!0;for(let o=n,s=0;o&&s<3;o=o.parentElement,s++)if(_i.test(o.getAttribute("class")??""))return!0;return!1}var xi=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function Yr(t,e=Date.now(),n={},r){if(r&&n.ignoreSelectors?.length&&r.closest(n.ignoreSelectors.join(",")))return{};if(r&&n.suppressSteppers!==!1&&wi(r,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&xi())return{};let o=n.windowMs??1e3,s=n.radiusPx??30;for(Y.length&&e<Y[Y.length-1].t&&(Y.length=0),Y.push({t:e,x:t.clientX,y:t.clientY});Y.length&&e-Y[0].t>o;)Y.shift();let i=Y.filter(a=>Math.hypot(a.x-t.clientX,a.y-t.clientY)<=s).length;return i>=(n.count??3)?{$rageclick:!0,$rageclick_count:i}:{}}function Jr(t,e,n=700){if(typeof MutationObserver>"u")return;let r=!1,o=new MutationObserver(()=>r=!0);o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let s=()=>{r=!0};window.addEventListener("scroll",s,{capture:!0,passive:!0}),document.addEventListener("selectionchange",s);let i=()=>{o.disconnect(),window.removeEventListener("scroll",s,{capture:!0}),document.removeEventListener("selectionchange",s)},a=setTimeout(()=>{i(),!r&&document.visibilityState!=="hidden"&&t.client.capture("$deadclick_hint",{$selector:e,$no_mutation_ms:n})},n);t.onUnload(()=>{clearTimeout(a),i()})}var Zr=/^[A-Za-z_][\w-]*$/,ki=5;function Si(t){let e=[];for(let n=t;n&&e.length<ki;n=n.parentElement){let r=n.tagName.toLowerCase();if(n.id&&Zr.test(n.id)){e.unshift(`${r}#${n.id}`);break}let o=(n.getAttribute("class")??"").split(/\s+/).filter(s=>Zr.test(s)).slice(0,2);e.unshift(r+o.map(s=>`.${s}`).join(""))}return e.join(" ")}function Qr(t,e,n,r,o={}){let s={$selector:Si(n),$el_interactive:r};(e.clientX||e.clientY||e.detail)&&(s.$click_x=Math.round(e.clientX+(window.scrollX||0)),s.$click_y=Math.round(e.clientY+(window.scrollY||0))),o.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(s,Yr(e,Date.now(),o.rageClicks||{},n));let i=o.deadClicks;!r&&e.isTrusted&&i!==!1&&!(i?.ignoreSelectors?.length&&n.closest(i.ignoreSelectors.join(",")))&&Jr(t,s.$selector,i?.waitMs);for(let a of t.clickExtras)Object.assign(s,a(e,n));return s}var Ci="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",Ei="[data-lc-ignore]",nn=t=>t.some(e=>typeof e=="string"?location.href.includes(e):e.test(location.href)),Ri=t=>!t?.length||nn(t),rn=t=>({maskAll:t.maskAllAttributes,allow:t.attributeAllowlist}),Ee=(t,e)=>!!t.closest(Ei)||!!(e.denySelectors?.length&&t.closest(e.denySelectors.join(",")));function eo(t,e,n,r=()=>!0){let o=e.events??["click","change","submit"],s=0,i=c=>{let u=c.target;!n()||!r()||c.isComposing||!(u instanceof Element)||Ee(u,e)||u instanceof HTMLInputElement&&u.type==="password"||(s+=1)},a=c=>u=>{if(!n()||c!=="click"&&!r())return;let f=u.target;if(!(f instanceof Element)||Ee(f,e)||e.allowSelectors?.length&&!f.closest(e.allowSelectors.join(","))||e.elementAllowlist?.length&&!f.closest(e.elementAllowlist.join(","))||!Ri(e.urlAllowlist)||c==="change"&&!/^(input|select|textarea)$/i.test(f.tagName)||f instanceof HTMLInputElement&&f.type==="password")return;let h=f.closest(Ci);if(c==="click"&&!h&&!e.allowSelectors?.length)return;let m=tt(f,e.captureText??!0,h??void 0,e.attributeIgnore,rn(e)),b=m.find(w=>w.text)?.text,y=s;s=0,t.client.capture("$autocapture",{...et(f),$event_type:c,...y>0?{$keystroke_count:y}:{},$elements:m,$elements_chain:nt(m),...b?{$el_text:b}:{},...c==="click"?Qr(t,u,f,!!h,e):{}})};t.autocaptureClicks=o.includes("click");let l=o.map(c=>[c,a(c)]);for(let[c,u]of l)document.addEventListener(c,u,!0);return document.addEventListener("keydown",i,!0),()=>{for(let[c,u]of l)document.removeEventListener(c,u,!0);document.removeEventListener("keydown",i,!0)}}var Pi='[contenteditable]:not([contenteditable="false"])',to="input,textarea,select",$i=255;function Oi(t){return t.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,$i)}var Ai=t=>t?t instanceof Element?t:t.parentElement:null;function no(t,e,n,r=()=>!0){let o=e.events??["click","change","submit"],s=e.contentEditable!==!1&&o.includes("change"),i=new WeakSet,a=h=>{let m=tt(h,!1,h,e.attributeIgnore,rn(e));return{...et(h),$elements:m,$elements_chain:nt(m)}},l=h=>{let m=h instanceof Element?h.closest(Pi):null;return m&&!Ee(m,e)?m:null},c=h=>{let m=n()&&r()?l(h.target):null;m&&i.add(m)},u=h=>{let m=l(h.target);!m||!i.has(m)||h.relatedTarget instanceof Node&&m.contains(h.relatedTarget)||(i.delete(m),n()&&r()&&t.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...a(m)}))},f=h=>{if(!n()||!e.copyCut)return;let m=typeof getSelection=="function"?getSelection():null,b=h.target instanceof Element?h.target:null,y=Ai(m?.anchorNode)??b;if(!y||Ee(y,e)||y.closest(to)||b?.closest(to))return;let w=e.captureCopiedText?Oi(m?.toString()??""):"";t.client.capture("$copy_autocapture",{$copy_type:h.type,...a(y),...w?{$selected_content:w}:{}})};return s&&(document.addEventListener("input",c,!0),document.addEventListener("focusout",u,!0)),document.addEventListener("copy",f,!0),document.addEventListener("cut",f,!0),()=>{document.removeEventListener("input",c,!0),document.removeEventListener("focusout",u,!0),document.removeEventListener("copy",f,!0),document.removeEventListener("cut",f,!0)}}var Ii="[data-lc-ignore]",oo=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],so=["q","s","search","query"],ro=t=>t.origin+t.pathname;function io(t,e,n){let r=Array.isArray(e.fileDownloads)?e.fileDownloads.map(s=>s.toLowerCase()):oo,o=[];if(e.outboundLinks!==!1||e.fileDownloads!==!1){let s=i=>{let a=i.target instanceof Element?i.target.closest("a[href]"):null;if(!a||!n()||a.closest(Ii))return;let l;try{l=new URL(a.href,location.href)}catch{return}if(l.protocol!=="http:"&&l.protocol!=="https:")return;let c=decodeURIComponent(l.pathname.split("/").pop()??""),u=c.includes(".")?c.split(".").pop().toLowerCase():"";e.fileDownloads!==!1&&(a.hasAttribute("download")||r.includes(u))?t.client.capture("$file_download",{$url:ro(l),$file_name:c,$file_extension:u}):e.outboundLinks!==!1&&l.host!==location.host&&t.client.capture("$outbound_click",{$url:ro(l),$outbound_host:l.host})};document.addEventListener("click",s,!0),o.push(()=>document.removeEventListener("click",s,!0))}if(e.siteSearch!==!1){let s=typeof e.siteSearch=="object"&&e.siteSearch.params?e.siteSearch.params:so,i=!0;o.push(()=>{i=!1}),t.onCapture(a=>{if(!i||a.event!=="$pageview"||!n())return;let l=new URLSearchParams(location.search);for(let c of s){let u=l.get(c)?.trim();if(u)return void t.client.capture("$site_search",{$search_term:u.slice(0,200),$search_param:c})}})}return()=>o.forEach(s=>s())}function ao(t,e={}){t.capture("$page_not_found",{$status:404,...e})}var Mi=[25,50,75],Ti="data-lc-media-title";function co(t){let e=t.currentSrc||t.src;if(!e||e.startsWith("blob:")||e.startsWith("data:"))return"";try{let n=new URL(e,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var Fi=t=>(t.getAttribute(Ti)??t.getAttribute("title")??t.getAttribute("aria-label")??"").trim().slice(0,200);function lo(t,e,n){if(e.media===!1)return()=>{};let r=new WeakMap,o=l=>{let c={$media_type:l instanceof HTMLVideoElement?"video":"audio",$media_src:co(l)},u=Fi(l);return u&&(c.$media_title=u),Number.isFinite(l.duration)&&(c.$media_duration=Math.round(l.duration)),c},s=l=>{let c=co(l);if(!c)return null;let u=r.get(l);return(!u||u.src!==c)&&r.set(l,u={src:c,played:!1,reached:new Set,done:!1}),u},i=l=>{let c=l.target;if(!(c instanceof HTMLMediaElement)||!n())return;let u=s(c);if(u)if(l.type==="play"){if(u.done&&Object.assign(u,{played:!1,reached:new Set,done:!1}),u.played)return;u.played=!0,t.client.capture("$media_play",o(c))}else if(l.type==="timeupdate"){if(!u.played||u.done||!Number.isFinite(c.duration)||c.duration<=0)return;let f=c.currentTime/c.duration*100;for(let h of Mi)f>=h&&!u.reached.has(h)&&(u.reached.add(h),t.client.capture("$media_progress",{...o(c),$media_progress:h}))}else l.type==="ended"&&u.played&&!u.done&&(u.done=!0,t.client.capture("$media_complete",o(c)))},a=["play","timeupdate","ended"];return a.forEach(l=>document.addEventListener(l,i,!0)),()=>a.forEach(l=>document.removeEventListener(l,i,!0))}function uo(t=()=>performance.now()){let e=()=>document.visibilityState!=="hidden",n=0,r=e()?t():null,o=()=>{e()?r===null&&(r=t()):(r!==null&&(n+=t()-r),r=null)};return document.addEventListener("visibilitychange",o),{read:()=>Math.round(n+(r===null?0:t()-r)),reset:()=>{n=0,r=e()?t():null},stop:()=>document.removeEventListener("visibilitychange",o)}}po();var fo=255,ji=new Set(["input","textarea","select","option"]),Di="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Hi=new Set(["value","password","autocomplete"]),Ni=/(?:\d[ -]?){9,}/,Re=new WeakMap,sn=new WeakMap;function go(t,e){let n=sn.get(t);if(n)return new Promise(r=>{let o=setTimeout(r,e);n.then(()=>(clearTimeout(o),r()))})}function qi(t){return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!="object")return!1;let n=e;return typeof n.name=="string"&&n.name!==""&&!n.name.startsWith("$")&&typeof n.selector=="string"&&(n.source==="text"||n.source==="attribute"&&typeof n.attribute=="string")&&Array.isArray(n.events)}):[]}function Wi(t){if(!t||ji.has(t.tagName.toLowerCase())||t.isContentEditable)return!1;try{return!t.closest(Di)}catch{return!1}}function Ui(t,e){if(t.source==="attribute"){let r=(t.attribute??"").toLowerCase();if(!r||Hi.has(r)||r.startsWith("on"))return;let o=e.getAttribute(r);return o===null?void 0:o.slice(0,fo)}let n=(e.textContent??"").replace(/\s+/g," ").trim();if(!(!n||Ni.test(n)))return n.slice(0,fo)}function mo(t,e,n,r=location.href){let o={};for(let s of t){if(!s.events.includes(e)||s.url&&!on([s.url],r))continue;let i=null;try{i=s.scope==="target"?e==="click"&&n?n.closest(s.selector):null:document.querySelector(s.selector)}catch{continue}if(!Wi(i))continue;let a=Ui(s,i);a!==void 0&&(o[s.name]=a)}return o}function ho(t){let e=!0,n=t.loadConfig().then(r=>{e&&Re.set(t,qi(r?.snapshot_properties)),sn.delete(t)});return sn.set(t,n),t.clickExtras.push((r,o)=>e?mo(Re.get(t)??[],"click",o):{}),()=>{e=!1,Re.delete(t)}}function yo(t){let e=Re.get(t);return e?.length?mo(e,"pageview"):{}}function vo(t){return!!Re.get(t)?.some(e=>e.events.includes("pageview"))}var Bi=t=>{try{return new URL(t).pathname}catch{return t}};function Vi(t){for(let e of t===void 0?[]:Array.isArray(t)?t:[t])try{let n=document.querySelector(e);if(n)return n}catch{}}function _o(t){let e=0,n=0,r=()=>{let o=Vi(t),s=document.documentElement,i=o?o.scrollHeight:Math.max(s.scrollHeight,document.body?.scrollHeight??0),a=o?o.scrollTop:window.scrollY||window.pageYOffset||0,l=Math.min(i,a+(o?o.clientHeight:window.innerHeight));l>e&&(e=l,n=i>0?Math.min(100,Math.round(l/i*100)):0)};return r(),window.addEventListener("scroll",r,{passive:!0,capture:!0}),window.addEventListener("resize",r,{passive:!0}),{read:()=>({pct:n,px:e}),stop:()=>{window.removeEventListener("scroll",r,{capture:!0}),window.removeEventListener("resize",r)}}}var Ki=800,Gi=t=>t.core.hasConsent("analytics")||t.core.consent.resolving;function zi(t){return t==="history"?{path:!0,search:!0}:t==="hash"?{path:!0,search:!0,hash:!0}:typeof t=="object"?t:void 0}function Xi(t,e,n){try{let r=new URL(t),o=new URL(e);return!!(n.path&&r.pathname!==o.pathname||n.search&&r.search!==o.search||n.hash&&r.hash!==o.hash)}catch{return t!==e}}function rt(t,e,n={}){let r=n.views??!0,o=n.leave??!0,s=zi(e),i=t.config.scrollRoot,a=location.href,l=a,c=Date.now(),u=_o(i),f=uo(),h,m=()=>{if(!o||h===a)return;h=a;let{pct:O,px:N}=u.read();t.client.capture("$pageleave",{$current_url:a,$scroll_depth:O,$scroll_depth_px:N,$engagement_time_ms:f.read()})},b=!1,y=(O,N={})=>{if(!r)return;let{core:T}=t;if(!T.hasConsent("analytics")&&!T.anonymousOnReject&&!(T.consent.pending&&T.consent.queueBeforeConsent)){if(!b){b=!0;let j=()=>{b&&(b=!1,y())};t.whenConsented(j),T.onChange(F=>{F==="consent"&&T.anonymousOnReject&&j()})}return}t.client.capture("$pageview",{...yo(t),...O===void 0?{}:{$referrer:O},...N})},w,C=()=>{let O=w;w=void 0,O?.()},E=O=>{if(location.href===l)return;let N=l;if(l=location.href,!s||!Xi(N,l,s))return;let T=a;m(),u.stop();let j=new Date(c);a=location.href,c=Date.now(),u=_o(i),f.reset();let F={$navigation_type:O,$prev_pageview_pathname:Bi(T),$prev_pageview_duration:Math.round((c-j.getTime())/100)/10};vo(t)?setTimeout(()=>y(T,F),0):(C(),w=()=>y(T,F),queueMicrotask(C))};t.onUnload(m);let M=Gi(t)?go(t,Ki):void 0;if(M?(w=()=>y(),t.onUnload(C),M.then(C)):y(),!s)return()=>(u.stop(),f.stop());let{pushState:q,replaceState:A}=history;history.pushState=function(...O){C(),q.apply(this,O),E("pushState")},history.replaceState=function(...O){C(),A.apply(this,O),E("replaceState")};let k=()=>E("popstate"),I=()=>E("hashchange");return window.addEventListener("popstate",k),s.hash&&window.addEventListener("hashchange",I),()=>{window.removeEventListener("hashchange",I),history.pushState=q,history.replaceState=A,window.removeEventListener("popstate",k),u.stop(),f.stop()}}var an=t=>{let e=[],n=t.config.autocapture,r=!1,o=!1;if(n!==!1){let a=typeof n=="object"?n:{},l=()=>!r&&!(a.urlIgnorelist?.length&&nn(a.urlIgnorelist)),c=()=>!o;e.push(eo(t,a,l,c),no(t,a,l,c),io(t,a,l),zr(t,a,l),Gr(t,a,l),lo(t,a,l),ho(t)),n===void 0&&t.loadConfig().then(u=>r=u?.autocapture===!1),t.loadConfig().then(u=>o=u?.autocapture_inputs===!1)}let s=t.config.capturePageview??"history",i=t.config.capturePageleave??"if_capture_pageview";return s!==!1&&i!==!1?e.push(rt(t,s)):s!==!1?e.push(rt(t,s,{leave:!1})):i===!0&&e.push(rt(t,"history",{views:!1})),()=>e.forEach(a=>a())};de();var Yi="lc_preview",cn="lc_preview";function Ji(t){let e={};for(let n of(t??"").split(",")){let r=n.indexOf(":");r>0&&r<n.length-1&&(e[n.slice(0,r)]=n.slice(r+1))}return e}function bo(t){let e=new URL(t).searchParams.get(Yi),n=null;try{n=sessionStorage.getItem(cn)}catch{}return{forced:Ji(e==="off"?null:e??n),persist(){try{e==="off"?sessionStorage.removeItem(cn):e&&sessionStorage.setItem(cn,e)}catch{}}}}Ce();Ke();var ln="lc_flag_initial";function Zi(t){try{return t?new URL(t).hostname:""}catch{return""}}function Qi(){let t=new URLSearchParams(location.search),e={$initial_referrer:document.referrer||"$direct",$initial_referring_domain:Zi(document.referrer)||"$direct",$initial_current_url:location.href.split("#")[0]};for(let n of[...te,...K]){let r=t.get(n);r&&(e[`$initial_${n}`]=r)}return e}function xo(t,e){if(typeof location>"u")return{};let n=t.get(ln);if(n)try{return JSON.parse(n)}catch{}let r=Qi();return e(()=>{t.get(ln)||t.set(ln,JSON.stringify(r))}),r}function ea(){let t=navigator.userAgent,e=/Edg\//.test(t)?"Edge":/OPR\/|Opera/.test(t)?"Opera":/Firefox\//.test(t)?"Firefox":/Chrome\/|CriOS/.test(t)?"Chrome":/Safari\//.test(t)?"Safari":"Other",n=/Windows/.test(t)?"Windows":/Android/.test(t)?"Android":/iPhone|iPad|iPod/.test(t)?"iOS":/Mac OS X/.test(t)?"Mac OS X":/CrOS/.test(t)?"Chrome OS":/Linux/.test(t)?"Linux":"Other";return{browser:e,os:n}}function ko(){if(typeof location>"u"||typeof navigator>"u")return{};let t={},e=new URLSearchParams(location.search);for(let o of[...te,...K]){let s=e.get(o);s&&(t[`$${o}`]=s)}let{browser:n,os:r}=ea();return t.$browser=n,t.$os=r,t.$device_type=String(dn().$device_type??"Desktop"),t}function dn(){if(typeof window>"u")return{};let t=window.innerWidth;return{$viewport_width:t,$viewport_height:window.innerHeight,$screen_width:screen.width,$screen_height:screen.height,$browser_language:navigator.language,$device_type:ta(t)}}function ta(t,e=navigator){let n=e.userAgent??"";return/iPad|Tablet|PlayBook|Silk|Kindle/i.test(n)||/Macintosh/.test(n)&&(e.maxTouchPoints??0)>1?"Tablet":/Android/i.test(n)?/Mobile/i.test(n)?"Mobile":"Tablet":/iPhone|iPod|Mobile|Windows Phone|BlackBerry|Opera Mini/i.test(n)||e.userAgentData?.mobile?"Mobile":/Windows|Macintosh|X11|CrOS|Linux/i.test(n)?"Desktop":t<768?"Mobile":t<1024?"Tablet":"Desktop"}var na=/^[A-Za-z0-9_.-]{1,100}$/,ra=/^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*){0,5}$/,oa=new Set(["__proto__","prototype","constructor"]),sa=50,So=200;function wo(t,e){if(!ra.test(e))return;let n=t;for(let r of e.split(".")){if(oa.has(r)||n===null||typeof n!="object"||typeof Node<"u"&&n instanceof Node)return;n=n[r]}if(typeof n=="string")return n.slice(0,So);if(typeof n=="number"&&Number.isFinite(n)||typeof n=="boolean")return n}function ia(){let t=new Map;for(let e of(typeof document>"u"?"":document.cookie).split(";")){let n=e.indexOf("=");if(n<1)continue;let r=e.slice(0,n).trim(),o=e.slice(n+1).trim();try{o=decodeURIComponent(o)}catch{}t.has(r)||t.set(r,o.slice(0,So))}return t}function un(t){let e={};if(!t||typeof window>"u")return e;let n=s=>Array.isArray(s)?s.filter(i=>typeof i=="string").slice(0,sa):[],r=n(t.cookies).filter(s=>na.test(s));if(r.length){let s=ia();for(let i of r){let a=s.get(i);a!==void 0&&(e[`$cookie/${i}`]=a)}}for(let s of n(t.globals)){let i=wo(window,s);i!==void 0&&(e[`$global/${s}`]=i)}let o=window.dataLayer;if(Array.isArray(o))for(let s of n(t.data_layer))for(let i=o.length-1;i>=0;i--){let a=wo(o[i],s);if(a!==void 0){e[`$datalayer/${s}`]=a;break}}return e}var pn=t=>{if(t.config.flagOptions?.disableRemote&&!t.config.localFlags?.length)return;let e;t.flagPersonProps.push(()=>e&&t.core.hasConsent("analytics")?un(e):{}),t.loadConfig().then(n=>{let r=n?.flag_targeting_sources;!r||typeof r!="object"||(e=r,Object.keys(un(r)).length&&t.flags?.reload())})};de();function fn(t){return typeof t=="object"?t.value??t.variant??!!t.enabled:t}function gn(t){let e={value:fn(t),reason:t.reason??"remote",condition_index:t.condition_index??-1};return t.variant&&(e.variant=t.variant),t.payload!==void 0&&(e.payload=t.payload),t.runtime?.length&&(e.runtime=t.runtime.map(n=>({filters:n.filters,result:gn(n.result)}))),e}var Co="lc_rt_events",Eo=t=>!!t?.some(e=>e.conditions.some(n=>n.filters?.some(r=>r.type==="event")));function Ro(t,e){let n;try{let i=t.flagStorage.get(Co);i&&(n=JSON.parse(i))}catch{}let r=new _e(n),o={},s=We(e,o);return{counts:()=>r.counts(t.core.sessionId),setServer(i){o=i,s=We(e,o)},server:()=>o,drop(i){for(let a of i)delete o[a]},resolved(){return kt(o,r.counts(t.core.sessionId))},record(i,a,l){r.record(i,t.core.sessionId,a,s),l&&t.whenConsented(()=>t.flagStorage.set(Co,JSON.stringify(r.saved())))}}}var mn="lc_flags",hn="lc_flag_overrides_api";function Po(t){try{let e=localStorage.getItem("lc_flag_overrides");return e?JSON.parse(e)[t]:void 0}catch{return}}var yn=t=>{let{core:e,config:n}=t,r={},o={},s={},i,a,l=!1,c=0,u=new Set,f=new Set,h="",m={},b=()=>Object.keys(m).length>0,y={},w={},C={},E=new Set,M=typeof location>"u"?{forced:{},persist(){}}:bo(location.href),q=Object.keys(M.forced).length>0,A=()=>({...r,...C}),k=t.config.flagOptions??{},I=new we(k.cacheTtlMs),O=(t.config.flagsApiHost??t.config.apiHost).replace(/\/+$/,""),N=k.keys?.length?new Set(k.keys):void 0,T=p=>N?Object.fromEntries(Object.entries(p).filter(([g])=>N.has(g))):p,j=(p,g,_=!0)=>{if(r=T(p),o=T(g),l=!0,_)for(let S of E)S(A())},F=Ro(t,n.localFlags),ae=!1,G=()=>{ae||(ae=!0,queueMicrotask(()=>{ae=!1,x()}))},v=t.flagStorage.get(mn);if(v)try{let p=JSON.parse(v);r=p.values,o=p.payloads,s=Object.fromEntries(Object.keys(r).map(g=>[g,"cached"])),p.rt&&F.setServer(p.rt),I.restore(p),l=Object.keys(r).length>0}catch{}let D=t.flagStorage.get(hn);if(D)try{C=JSON.parse(D)}catch{}let W=n.bootstrap;if(W?.flags||W?.payloads){let p={...W.flags};for(let g of Object.keys(W.payloads??{}))p[g]??=!0;j({...r,...p},{...o,...W.payloads});for(let g of Object.keys(p))s[g]="bootstrap"}let ce={},ge=()=>({...k.autoProperties===!1?{}:ko(),...xo(e.storage,t.whenConsented),...Object.assign({},...t.flagPersonProps.map(p=>p())),...y}),z=k.evaluationContexts?.length?{app_contexts:k.evaluationContexts}:{},ne=(p=!0)=>{let g=n.localFlags;if(!g?.length)return!0;let _=n.localFlagsContext,S=Et(g,{runtime_events:F.counts(),distinct_id:e.distinctId,...e.groups?{groups:e.groups}:{},...e.deviceId?{device_id:e.deviceId}:{},...b()?{contexts:m}:{},...z,..._,person_properties:{...ge(),..._?.person_properties},group_properties:{..._?.group_properties,...w}}),P={},$={},L=!1;for(let[Z,U]of Object.entries(S))Rt(U)?L=!0:Pt(U)&&(P[Z]=U.value,s[Z]=U.reason,U.payload!==void 0&&($[Z]=U.payload));return ce=P,j({...r,...P},{...o,...$},p),L},re=p=>{let g={...r},_={...o};for(let[S,P]of Object.entries(F.resolved()))g[S]=P.value,s[S]=P.reason,P.payload!==void 0?_[S]=P.payload:delete _[S];j(g,_,p)},me=Eo(n.localFlags);t.onCapture(p=>{let g=me||Object.keys(F.server()).length>0;if(F.record(p.event,p.properties,g),!g)return;let _=JSON.stringify([A(),o]);if(me&&ne(!1),re(!1),JSON.stringify([A(),o])!==_)for(let S of E)S(A())});let x=(p=!0)=>{let g=++c;return!ne()||k.disableRemote||!p&&I.fresh(e.distinctId)?Promise.resolve():new Promise(_=>{t.whenConsented(()=>{if(g!==c)return _();M.persist();let S=new AbortController,P=setTimeout(()=>S.abort(),k.timeoutMs??1e4);t.fetch(`${O}/v1/flags`,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",signal:S.signal,body:JSON.stringify({api_key:t.apiKey,...e.distinctId?{distinct_id:e.distinctId}:{},...e.anonDistinctId?{anon_distinct_id:e.anonDistinctId}:{},groups:e.groups??{},person_properties:ge(),...Object.keys(w).length?{group_properties:w}:{},device_properties:dn(),...e.deviceId?{device_id:e.deviceId}:{},...b()?{contexts:m}:{},...z,...q?{preview:M.forced}:{},...k.keys?.length?{flag_keys:k.keys}:{}})}).then($=>$.ok?$.json():Promise.reject(new Error(`status ${$.status}`))).then($=>{if(g!==c)return;if($.quota_limited)return a="quota_limited",t.log("flags quota limited; keeping cached values");a=$.errors_while_computing_flags?"errors_while_computing_flags":void 0;let L={},Z={},U={};for(let[$e,B]of Object.entries($.flags??{}))L[$e]=fn(B),typeof B=="object"&&B.payload!==void 0&&(Z[$e]=B.payload),s[$e]=typeof B=="object"&&typeof B.reason=="string"?B.reason:"remote",typeof B=="object"&&B.runtime?.length&&(U[$e]=gn(B));i=$.request_id,F.setServer(U);let Pe=$.errors_while_computing_flags;j({...ce,...Pe?r:{},...L},Pe?{...o,...Z}:Z,!1),re(!0),t.flagStorage.set(mn,JSON.stringify({values:{...Pe?r:{},...L},payloads:{...Pe?o:{},...Z},rt:U,...I.mark(e.distinctId)})),t.log("flags loaded",L)}).catch($=>{let L=/^status (\d+)/.exec(String($?.message))?.[1];g===c&&(a=S.signal.aborted?"timeout":L?`api_error_${L}`:"connection_error"),t.log("flags fetch failed",$)}).finally(()=>{clearTimeout(P),_()})})})},he=p=>C[p]??Po(p)??r[p];t.flags={get(p){let g=he(p);if(g===void 0)return;if(p in M.forced||p in C)return g;let _=e.sessionId;_!==h&&(u.clear(),f.clear(),h=_),f.has(p)||(f.add(p),e.capture("$exposure",{$feature_flag:p,$feature_flag_response:g,...typeof g=="string"?{$feature_flag_variant:g}:{},...i?{$feature_flag_request_id:i}:{}}));let S=`${p}:${String(g)}`;return u.has(S)||(u.add(S),e.capture("$feature_flag_called",{$feature_flag:p,$feature_flag_response:g,...i?{$feature_flag_request_id:i}:{},...s[p]?{$feature_flag_reason:s[p]}:{},...s[p]==="bootstrap"?{$used_bootstrap_value:!0}:{},...a?{$feature_flag_error:a}:{}})),g},all:()=>l||Object.keys(r).length||Object.keys(C).length?A():{},payload:p=>o[p],result(p,g){let _=g?.sendExposure===!1?he(p):this.get(p),S=p in C||Po(p)!==void 0?"override":p in M.forced?"preview":s[p]??"remote";return ie(p,_,o[p],S)},layerParam(p,g){for(let[_,S]of Object.entries(o)){let P=S;if(P?.lc_layer!==p||!P.lc_params||!(g in P.lc_params))continue;let $=this.get(_);if($!==void 0&&$!==!1)return P.lc_params[g]}},onChange(p){return E.add(p),l&&p(A()),()=>{E.delete(p)}},reload:x,update(p,g,_=!0){for(let S of Object.keys(p))s[S]="pushed";F.drop(Object.keys(p)),j(_?{...r,...p}:{...p},_?{...o,...g}:{...g})},override(p,g){C=p?{...p}:{},p?g?.persist&&t.whenConsented(()=>t.flagStorage.set(hn,JSON.stringify(C))):t.flagStorage.remove(hn);for(let _ of E)_(A())},setPersonProperties(p,g=!0){I.clear(),y={...y,...p},g&&G()},resetPersonProperties(){y={}},setGroupProperties(p,g=!0){I.clear();for(let[_,S]of Object.entries(p))w[_]={...w[_],...S};g&&G()},resetGroupProperties(){w={}},setContext(p,g,_){I.clear(),m={...m,[p]:{key:g,properties:_??{}}},G()},clearContext(p){I.clear();let{[p]:g,..._}=m;m=_,G()}},e.onChange(p=>{if(p==="reset"){m={},y={},w={},u.clear(),f.clear(),r={},o={},s={},i=void 0,a=void 0,F.setServer({}),I.clear(),t.flagStorage.remove(mn),ne(!1);for(let g of E)g(A())}(p==="identify"||p==="reset"||p==="group")&&G()}),n.disableFlagsOnFirstLoad?ne():x(!1);let oe=n.flagStream,J;oe&&!k.disableRemote&&t.whenConsented(()=>{J=pt({apiHost:O,apiKey:t.apiKey,fetch:t.fetch,reload:()=>{x()},visibility:{hidden:()=>document.visibilityState==="hidden",subscribe:p=>(document.addEventListener("visibilitychange",p),()=>document.removeEventListener("visibilitychange",p))},...typeof oe=="object"&&oe.pollMs!==void 0?{pollMs:oe.pollMs}:{},log:t.log})});let d=k.refreshMs&&k.refreshMs>0&&!k.disableRemote?setInterval(()=>document.visibilityState!=="hidden"&&void x(!1),k.refreshMs):void 0;return()=>{J?.(),d&&clearInterval(d)}};function ot(t){let e=window.fetch;window.fetch=function(i,a){let l=i instanceof Request?i.url:String(i),c=new Headers(a?.headers??(i instanceof Request?i.headers:void 0)),u=[...c.entries()].join("|");return t(l,c),[...c.entries()].join("|")===u?e.call(this,i,a):e.call(this,i,{...a,headers:c})};let n=XMLHttpRequest.prototype,{open:r,send:o}=n,s=new WeakMap;return n.open=function(i,a,...l){return s.set(this,String(a)),r.call(this,i,a,...l)},n.send=function(i){let a=s.get(this);if(a){let l=new Headers;t(a,l),l.forEach((c,u)=>this.setRequestHeader(u,c))}return o.call(this,i)},()=>{window.fetch=e,n.open=r,n.send=o}}var aa={good:0,"needs-improvement":1,poor:2},ca=["good","needs-improvement","poor"],la={LCP:"lcp_ms",INP:"inp_ms",CLS:"cls",FCP:"fcp_ms",TTFB:"ttfb_ms"};function ua(t,e){let n=()=>t.config.watchtower?.client??globalThis.watchtower,r,o=()=>{let s=n();r||typeof s?.on!="function"||(r=e(s))};return o(),window.addEventListener("watchtower:ready",o),()=>(window.removeEventListener("watchtower:ready",o),r?.())}function $o(t){let e,n=!1;return t.whenConsented(()=>{n||(e=ua(t,r=>da(t,r)))}),()=>(n=!0,e?.())}function da(t,e){let n=new Map,r=new Set,o=c=>{let u=n.get(c);n.delete(c),!(!u||r.has(c))&&(r.add(c),t.client.capture("$web_vitals",{...u.props,rating_worst:ca[u.worst]}))},s=c=>{t.client.capture("$exception_seen",{wt_event_id:c.event_id,wt_trace_id:c.trace_id,message:String(c.message??"").slice(0,300),handled:c.handled,...c.issue_id?{wt_issue_id:c.issue_id}:{}})},i=c=>{let u=la[c.name];if(!u||r.has(c.navigation_id))return;for(let h of[...n.keys()])h!==c.navigation_id&&o(h);let f=n.get(c.navigation_id)??{props:{$current_url:c.url},worst:0,final:new Set};n.set(c.navigation_id,f),f.props[u]=c.value,f.worst=Math.max(f.worst,aa[c.rating]??0),c.final&&f.final.add(c.name),f.final.size===5&&o(c.navigation_id)},a=c=>u=>{try{c(u)}catch{}},l=[e.on?.("error",a(s)),e.on?.("vital",a(i))];return t.onUnload(()=>[...n.keys()].forEach(o)),()=>l.forEach(c=>c?.())}var Oo="__lucidaWatchtowerHint";function Ao(t){if(t.config.exposeGlobal||t.config.disabled)return()=>{};let e=globalThis,n=()=>{e[Oo]||(e[Oo]=!0,console.info("[lucida] Watchtower is on this page but Lucida's `exposeGlobal` is off, so Watchtower cannot find Lucida to link sessions. Set `exposeGlobal: true` in the Lucida init options."))};return e.watchtower?(n(),()=>{}):(window.addEventListener("watchtower:ready",n,{once:!0}),()=>window.removeEventListener("watchtower:ready",n))}var vn="lucida.session_id";function pa(t,e){return[...(t??"").split(",").map(r=>r.trim()).filter(r=>r&&!r.startsWith(`${vn}=`)),`${vn}=${encodeURIComponent(e)}`].join(",")}function fa(t,e=[]){let n;try{n=new URL(t,location.href)}catch{return!1}return n.origin===location.origin||e.some(r=>typeof r=="string"?n.origin===r:r.test(n.href))}var Io=t=>{let e=t.config.watchtower,{core:n}=t,r=ga(t),o=$o(t),s=Ao(t),i=()=>(r?.(),o(),s());if(!e?.correlate)return i;let a=n.sessionId;t.onCapture(u=>a=String(u.properties.$session_id??a));let l=u=>n.hasConsent("analytics")&&!u.startsWith(t.config.apiHost)&&fa(u,e.origins),c=ot((u,f)=>{l(u)&&f.set("baggage",pa(f.get("baggage"),a))});return()=>(c(),i())};function ga(t){let e=t.config.watchtower?.client??globalThis.watchtower;if(typeof e?.setAttribute!="function")return;let{core:n}=t,r=o=>{n.hasConsent("analytics")&&e.setAttribute(vn,o)};return t.whenConsented(()=>r(n.sessionId)),n.onSessionId(r)}var ma="X-Lucida-Distinct-Id",ha="X-Lucida-Session-Id";function ya(t,e){let n;try{n=new URL(t,location.href).hostname.toLowerCase()}catch{return!1}return e.some(r=>{let o=r.toLowerCase();return o.startsWith(".")?n===o.slice(1)||n.endsWith(o):n===o})}var Mo=t=>/^[\x20-\x7e]*$/.test(t)?t:encodeURIComponent(t),_n=t=>{let e=t.config.tracingHeaders;if(!e?.length)return;let{core:n}=t;return ot((r,o)=>{!n.hasConsent("analytics")||r.startsWith(t.config.apiHost)||!ya(r,e)||(n.distinctId&&o.set(ma,Mo(n.distinctId)),o.set(ha,Mo(n.sessionId)))})};Ut();de();var To="lc_early_access",va=t=>{let{core:e}=t,n=()=>{try{return JSON.parse(e.storage.get(To)??"{}")}catch{return{}}},r=(o,s)=>{e.storage.set(To,JSON.stringify({...n(),[o]:s}));let i=lt(o,s);e.capture(i.event,i.props,i.extra),t.flags?.reload()};t.flagPersonProps.push(()=>Object.fromEntries(Object.entries(n()).map(([o,s])=>[He(o),s]))),t.earlyAccess={list:()=>new Promise(o=>t.whenConsented(()=>{t.fetch(`${t.config.apiHost}/v1/early-access?api_key=${encodeURIComponent(t.apiKey)}`,{credentials:"omit"}).then(s=>s.ok?s.json():Promise.reject(new Error(`status ${s.status}`))).then(s=>{let i=n();o((s.features??[]).map(a=>({...a,enrolled:i[a.flag_key]===!0})))}).catch(s=>{t.log("early access fetch failed",s),o([])})})),optIn:o=>r(o,!0),optOut:o=>r(o,!1)}};var Lo="lc_recs",Fo="lc_recs_recent";function jo(t,e,n,r){for(let o of r?[r]:n){let s=e(o)?.[Lo];if(s&&typeof s=="object"&&(s.placement===t||r!==void 0&&s.placement===void 0))return{flag:o,cfg:s}}}var _a=t=>{let{core:e}=t,n=t.config.recommendations??{},r=n.viewEvent??"$product_viewed",o=n.itemIdProperty??"item_id",s=[];try{let l=JSON.parse(e.storage.get(Fo)??"[]");Array.isArray(l)&&(s=l.filter(c=>typeof c=="string").slice(0,20))}catch{}let i=()=>e.hasConsent("analytics"),a=l=>{l&&(s=[l,...s.filter(c=>c!==l)].slice(0,20),i()&&e.storage.set(Fo,JSON.stringify(s)))};t.onCapture(l=>{let c=l.properties?.[o];l.event===r&&(typeof c=="string"||typeof c=="number")&&a(String(c))}),t.recs={viewed:a,async get(l,c={}){let u=Object.keys(t.flags?.all()??{}),f=jo(l,k=>t.flags?.payload(k),u,c.flag),h=f?t.flags?.get(f.flag):void 0,m=new URLSearchParams({api_key:t.apiKey,placement:l});c.itemId&&m.set("item_id",c.itemId),i()&&s.length&&m.set("recent",s.filter(k=>k!==c.itemId).slice(0,10).join(","));let b=f?.cfg.strategy;typeof b=="string"&&m.set("strategy",b);let y=c.limit??f?.cfg.limit;typeof y=="number"&&y>0&&m.set("limit",String(Math.min(50,Math.floor(y)))),c.exclude?.length&&m.set("exclude",c.exclude.slice(0,50).join(","));let w={};try{let k=await t.fetch(`${t.config.apiHost}/v1/recommendations?${m}`,{credentials:"omit"});k.ok?w=await k.json():t.log("recommendations failed",k.status)}catch(k){t.log("recommendations failed",k)}let C=Array.isArray(w.items)?w.items:[],E=w.strategy??b??"",M={$recommendation_placement:l,$recommendation_strategy:E,...f?{$recommendation_flag:f.flag}:{},...h!==void 0?{$recommendation_variant:String(h)}:{}},q=!1,A={placement:l,strategy:E,items:C,...f?{flag:f.flag}:{},...h!==void 0?{variant:h}:{},shown(){q||!C.length||(q=!0,e.capture("$recommendation_shown",{...M,$recommendation_items:C.map(k=>k.item_id)}))},clicked(k){let I=C.findIndex(O=>O.item_id===k);e.capture("$recommendation_clicked",{...M,$recommendation_item:k,...I>=0?{$recommendation_position:I+1}:{}})}};return c.autoShown!==!1&&A.shown(),A}}};function yu(t,e={},n=[]){return en(t,e,[an,yn,pn,Io,_n,Nt,...n])}export{Qt as DEFAULT_HOST,Kr as LIB_VERSION,Lo as RECS_PAYLOAD_KEY,Ft as assetUrl,an as autocapture,xr as blocksInlineStyle,Mt as captureCspViolations,en as createClient,Nt as crossDomain,Wr as denylistHook,va as earlyAccess,Lt as exposeGlobal,un as flagSourceProps,pn as flagSources,yn as flags,_n as hostHeaders,yu as init,Tt as isExtensionPage,js as loadModules,Dt as noopClient,jo as placementFlag,Dr as privatizeUrl,_a as recommendations,Sr as rewriteUrl,qr as sampleHook,$s as styleTag,ao as tag404,Wt as urlPrivacyHook};