@lucida-analytics/browser 0.1.13 → 0.1.14

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 (63) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/autocapture.d.ts +1 -1
  3. package/dist/{client-fHMBaIXD.d.ts → client-D732FYEb.d.ts} +2 -2
  4. package/dist/consent.d.ts +2 -2
  5. package/dist/core.d.ts +3 -3
  6. package/dist/core.js +2 -2
  7. package/dist/correlate.d.ts +1 -1
  8. package/dist/early-access.d.ts +1 -1
  9. package/dist/experiments.d.ts +1 -1
  10. package/dist/flags.d.ts +1 -1
  11. package/dist/forms.d.ts +1 -1
  12. package/dist/guides.d.ts +1 -1
  13. package/dist/heatmaps.d.ts +1 -1
  14. package/dist/host-headers.d.ts +1 -1
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +2 -2
  17. package/dist/inspector.d.ts +1 -1
  18. package/dist/lucida.js +2 -2
  19. package/dist/recommendations.d.ts +1 -1
  20. package/dist/replay.d.ts +2 -2
  21. package/dist/static/v0/core.js +2 -2
  22. package/dist/static/v0/index.js +2 -2
  23. package/dist/static/v0/lucida.js +2 -2
  24. package/dist/static/v0/manifest.json +5 -5
  25. package/dist/static/v0/toolbar.js +4 -4
  26. package/dist/static/{v0.1.13 → v0.1.14}/core.js +2 -2
  27. package/dist/static/v0.1.14/index.js +3 -0
  28. package/dist/static/v0.1.14/lucida.js +3 -0
  29. package/dist/static/{v0.1.13 → v0.1.14}/manifest.json +5 -5
  30. package/dist/static/v0.1.14/toolbar.js +4 -0
  31. package/dist/toolbar.d.ts +1 -1
  32. package/dist/toolbar.js +4 -4
  33. package/dist/{types-Chfj1wdu.d.ts → types-BnEbxGJq.d.ts} +1 -1
  34. package/dist/webmcp.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/storage.json +1 -1
  37. package/dist/static/v0.1.13/index.js +0 -3
  38. package/dist/static/v0.1.13/lucida.js +0 -3
  39. package/dist/static/v0.1.13/toolbar.js +0 -4
  40. /package/dist/static/{v0.1.13 → v0.1.14}/autocapture.js +0 -0
  41. /package/dist/static/{v0.1.13 → v0.1.14}/banner-TXLAMTQM.js +0 -0
  42. /package/dist/static/{v0.1.13 → v0.1.14}/chunk-AWIQCFGN.js +0 -0
  43. /package/dist/static/{v0.1.13 → v0.1.14}/chunk-B722OERZ.js +0 -0
  44. /package/dist/static/{v0.1.13 → v0.1.14}/chunk-EFNCQJI3.js +0 -0
  45. /package/dist/static/{v0.1.13 → v0.1.14}/chunk-IXDYCBAD.js +0 -0
  46. /package/dist/static/{v0.1.13 → v0.1.14}/chunk-UPPUYIIH.js +0 -0
  47. /package/dist/static/{v0.1.13 → v0.1.14}/consent.js +0 -0
  48. /package/dist/static/{v0.1.13 → v0.1.14}/correlate.js +0 -0
  49. /package/dist/static/{v0.1.13 → v0.1.14}/early-access.js +0 -0
  50. /package/dist/static/{v0.1.13 → v0.1.14}/experiments.js +0 -0
  51. /package/dist/static/{v0.1.13 → v0.1.14}/flags.js +0 -0
  52. /package/dist/static/{v0.1.13 → v0.1.14}/forms.js +0 -0
  53. /package/dist/static/{v0.1.13 → v0.1.14}/guides.js +0 -0
  54. /package/dist/static/{v0.1.13 → v0.1.14}/heatmaps.js +0 -0
  55. /package/dist/static/{v0.1.13 → v0.1.14}/host-headers.js +0 -0
  56. /package/dist/static/{v0.1.13 → v0.1.14}/inspector.js +0 -0
  57. /package/dist/static/{v0.1.13 → v0.1.14}/modules-FANMZRDJ.js +0 -0
  58. /package/dist/static/{v0.1.13 → v0.1.14}/persistent-G2OR2L2N.js +0 -0
  59. /package/dist/static/{v0.1.13 → v0.1.14}/recommendations.js +0 -0
  60. /package/dist/static/{v0.1.13 → v0.1.14}/recorder-MHNUIAAP.js +0 -0
  61. /package/dist/static/{v0.1.13 → v0.1.14}/replay.js +0 -0
  62. /package/dist/static/{v0.1.13 → v0.1.14}/validation-S6TYVWAI.js +0 -0
  63. /package/dist/static/{v0.1.13 → v0.1.14}/webmcp.js +0 -0
@@ -0,0 +1,3 @@
1
+ "use strict";(()=>{var R=(t,e)=>()=>(t&&(e=t(t=0)),e);function ct(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,at,he,Z,lt=R(()=>{"use strict";Oe="lc_consent";at=["analytics","replay","marketing"],he=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 at)typeof o[s]=="boolean"&&(this.state[s]=o[s]);this.decided=at.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 at)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)}},Z=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 ln(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 z(t=Date.now()){if(t>Ae){Ae=t;let s=ln(2);le=((s[0]??0)<<8|(s[1]??0))&1023}else le++,le>4095&&(Ae++,le=0);let e=ln(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 un,Me,dn=R(()=>{"use strict";Ie();un="lc_identity",Me=class{constructor(e,n,r=!1,o=!1){this.storage=e;this.cookieless=r;let s=e.get(un),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??z();this.s={distinct_id:a,anon_id:a,identified:o&&!!n},this.save()}}storage;cookieless;s;save(){this.storage.set(un,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||z();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 pn(t){return t===0||t===408||t===429||t>=500}var Te=R(()=>{"use strict"});var Le,fn=R(()=>{"use strict";Te();Le=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(!pn(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 gn(t,e,n){return typeof t=="number"&&Number.isInteger(t)&&t>=e&&t<=n?t*6e4:void 0}function Io(t,e){let n=Ao.exec(t);if(!n)return!0;let r=parseInt(n[1]+n[2],16);return r-e<=6e4&&e-r<=Oo}var ut,Po,$o,Oo,Ao,Fe,mn=R(()=>{"use strict";Ie();ut="lc_session";Po=6e4,$o=10*36e5,Oo=24*36e5,Ao=/^([0-9a-f]{8})-?([0-9a-f]{4})-7[0-9a-f]{3}-/i;Fe=class{constructor(e,n={}){this.storage=e;this.o=n;this.idleMs=Math.min($o,Math.max(Po,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=z();idleMs;maxMs;newOn;clock;bootstrapId;configure(e){this.o.idleMs===void 0&&(this.idleMs=gn(e.session_idle_minutes,1,600)??this.idleMs),this.o.maxMs===void 0&&(this.maxMs=gn(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(ut);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&&Io(this.bootstrapId,r)?this.bootstrapId:z(r),start:r,last:r}),this.bootstrapId=void 0,o.last=r,e&&(o.campaign=e),this.storage.set(ut,JSON.stringify(o)),{sessionId:o.id,windowId:this.windowId,isNew:a}}startedAt(){return this.read()?.start}reset(){this.storage.remove(ut)}}});function hn(t,e){let n=t.get(e);if(n)try{return JSON.parse(n)}catch{return}}var je,De,yn=R(()=>{"use strict";je=class{constructor(e,n="lc_props",r){this.storage=e;this.key=n;this.persist=r;this.p=hn(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=hn(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 Mo(t,e){let n=new Date(t??e);return(Number.isNaN(n.getTime())?new Date(e):n).toISOString()}var ye,vn=R(()=>{"use strict";lt();dn();fn();mn();yn();Ie();ye=class{constructor(e){this.c=e;this.clock=e.clock??{now:()=>Date.now()},this.consent=new he({...e.consent,storage:e.consentStorage??e.storage}),this.gated=new Z(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 Fe(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 Le({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")||z(),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:z(this.clock.now()),event:e,...m?{distinct_id:m}:{},timestamp:Mo(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}:{}},v=this.filter?this.filter(b):b;if(!v){this.c.log?.("dropped (policy)",e);return}this.c.log?.("capture",e,v),this.c.onCapture?.(v);for(let x of this.captureListeners)x(v);return o||s?this.queue.enqueue(v):this.pre.length<(this.c.queue?.maxQueueSize??1e3)&&this.pre.push(v),v}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(ct(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 dt(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 He,pt=R(()=>{"use strict";Te();He=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=dt(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 ft(t){let e=!1,n,r=new He({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 _n=R(()=>{"use strict";pt()});function gt(t,e){let n=new Set,{whenConsented:r,disabled:o,...s}=e,i=new Ne({...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 Ne,bn=R(()=>{"use strict";pt();Te();Ne=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=dt(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 mt(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((v,x)=>v+x.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,v){if(!i())return f([{url:m,body:b}]),{status:200};let x=await t.send(m,b,v);return x.status!==0?x:(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[v,x]of m.entries())if((await t.send(x.url,x.body)).status===0){b.push(...m.slice(v));break}b.length&&f(b)})().finally(()=>{l=void 0}),l}};return h}var wn=R(()=>{"use strict"});function xn(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=B(u,7)^B(u,18)^u>>>3,m=B(f,17)^B(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,v,x]=l,S=x+(B(m,6)^B(m,11)^B(m,25))+(m&b^~m&v)+To[c]+i[c]|0,C=(B(u,2)^B(u,13)^B(u,22))+(u&f^u&h^f&h)|0;l.pop(),l.unshift(S+C|0),l[4]=l[4]+S|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 To,B,kn=R(()=>{"use strict";To=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]),B=(t,e)=>t>>>e|t<<32-e});function Sn(t){let e=t.split(".");if(e.length!==4)return;let n=[];for(let r of e){if(!Lo.test(r)||Number(r)>255)return;n.push(Number(r))}return n}function Do(t){if(t.includes("%"))return;let e=t,n=t.lastIndexOf(":"),r=t.slice(n+1);if(r.includes(".")){let u=Sn(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(!Fo.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 Cn(t){return t.includes(":")?Do(t):Sn(t)}function Rn(t){if(typeof t!="string")return;let e=Cn(t.trim());return e&&Ho(e)?e.slice(12):e}function No(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=Rn(o);l&&n.push({bytes:l,bits:l.length*8});continue}let i=Cn(o.slice(0,s)),a=o.slice(s+1);!i||!jo.test(a)||Number(a)>i.length*8||n.push({bytes:i,bits:Number(a)})}return n}function qo(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 En(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=Rn(e),s=No(n);return!o||!s.length?!1:s.some(i=>qo(i,o))===(t==="ip_in_cidr")}}return!1}var Lo,Fo,jo,Ho,Pn=R(()=>{"use strict";Lo=/^(0|[1-9]\d{0,2})$/,Fo=/^[0-9a-fA-F]{1,4}$/,jo=/^(0|[1-9]\d*)$/;Ho=t=>t.length===16&&t.slice(0,10).every(e=>e===0)&&t[10]===255&&t[11]===255});function Vo(t){let e=Wo.exec(t.trim());return e?Number(e[1])*Bo[e[2]]:void 0}function On(t,e,n){if(typeof t=="number")return t*1e3;if(typeof t!="string")return;let r=t.trim();if(n){let s=Vo(r);if(s!==void 0)return e-s*1e3}if(!Uo.test(r)&&!$n.test(r))return;let o=Date.parse($n.test(r)?`${r}T00:00:00Z`:r);return Number.isNaN(o)?void 0:o}function An(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 Ko(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 In(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=On(e,r,!1),i=On(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=Ko(t,n,o);return!!s&&!!i&&An(s,i[0])>=0&&An(s,i[1])<0}}return!1}var Uo,$n,Wo,Bo,Mn=R(()=>{"use strict";Uo=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,$n=/^\d{4}-\d{2}-\d{2}$/,Wo=/^-?(\d{1,6})([hdwmy])$/,Bo={h:3600,d:86400,w:604800,m:2592e3,y:31536e3}});function ht(t){if(typeof t=="number")return t;if(typeof t=="string"&&Go.test(t.trim()))return Number(t.trim())}function yt(t,e){let n=typeof t=="number",r=typeof e=="number";return n||r?n&&r&&t===e:t===e}function _t(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 vt(t,e){let n=_t(t),r=_t(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=vt(e,r);if(l===void 0)return!1;a=l===0}else a=yt(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=vt(e,r);else{let l=ht(e),c=ht(r);a=l===void 0||c===void 0?void 0:zo(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=>yt(e,a))===(t==="in"):!1}return t.startsWith("array_")||t.startsWith("ip_")?En(t,e,r,yt):In(t,e,r,s,{toFloat:ht,parseVersion:_t,cmpVersion:vt})}var Go,zo,bt=R(()=>{"use strict";Pn();Mn();Go=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;zo=(t,e)=>t<e?-1:t>e?1:0});function xt(t){return t.properties?.length?`${t.key}|${JSON.stringify(t.properties.map(e=>[e.key,e.op,e.value??null]))}`:t.key}function Tn(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 kt(t,e){let n=e[t.scope??"session"]?.[xt(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 Fn(t,e,n){for(let s of t.runtime??[])if(s.filters.every(a=>{if(a.type!=="flag")return kt(a,e);let l=n(a.key);return!!l&&ee(a.op,l.value,!0,a.value,!1)}))return Fn(s.result,e,n);if(!t.runtime)return t;let{runtime:r,...o}=t;return o}function St(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=Fn(i,e,o);return n[s]=a,r.set(s,2),a};for(let s of Object.keys(t))o(s);return n}function qe(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(!wt(e))return e;let n=wt(t)?{...t}:{};for(let[r,o]of Object.entries(e))o===null?delete n[r]:n[r]=Ue(n[r],o);return n}var Ln,wt,ve,Ct=R(()=>{"use strict";bt();Ln=t=>(t??[]).filter(e=>e.type==="event");wt=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);ve=class{session={};page={};sid="";constructor(e){if(e&&typeof e.sid=="string"&&wt(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&&Tn(i,r)&&s.add(xt(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 jn(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 _e(t,e,n,r=!1){let o=r?`${t}.${e}.variant.${n}`:`${t}.${e}.${n}`;return parseInt(xn(o).slice(0,13),16)/Yo}function Jo(t,e){return typeof e=="boolean"?typeof t=="boolean"?t===e:e:t===e}function Qo(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(!Xo.includes(t.context_kind??""))return!1;s=jn(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 Zo(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=_e(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 Dn(t,e){return Hn(t.aggregation,e)}function Hn(t,e){return t.kind==="group"?e.groups?.[t.group_type??""]:t.kind==="device"?e.device_id:t.kind==="context"?jn(e,t.context_kind)?.key:e.bucketing_key||e.distinct_id}function es(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,Be(s,i.payload,e)):void 0}if(o===!0)return Be(s,t.type==="json"?t.payload:void 0,e)}function Be(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 ts(t,e){return!t.app_contexts?.length||!e.app_contexts?.length?!0:t.app_contexts.some(n=>e.app_contexts?.includes(n))}function Nn(t,e,n={}){if(!ts(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"||!Jo(c.value,l.value))return H("prerequisite_failed")}if(r)return H("requires_server");let o=Dn(t,e),s=t.conditions.some(l=>l.aggregation);if(!o&&(!s||t.holdout||t.namespace))return H("no_bucketing_key");if(t.holdout&&_e("holdout",t.holdout.salt,o??"")*100<t.holdout.percentage)return H("holdout");if(t.namespace&&t.namespace.total>0){let l=Math.floor(_e("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?Hn(c.aggregation,e):o;if(!u){i++;continue}let f=!1,h=!0,m=!1;for(let v of c.filters??[]){if(v.type==="event"){if(e.runtime_events===void 0)m=!0;else if(!kt(v,e.runtime_events)){h=!1;break}continue}let x=v.type==="cohort"?e.cohorts?.[v.key]:void 0;if(x!==void 0){if(x===(v.op==="not_in"||v.op==="neq")){h=!1;break}}else if(v.type==="cohort"||v.type==="flag"&&n[v.key]?.reason==="requires_server")f=!0;else if(!Qo(v,e,n)){h=!1;break}}if(!h)continue;if(f)return Rt(H("requires_server",l),a);let b=ns(t,c,l,e,u);if(b)if(m)a.push({filters:Ln(c.filters),result:b});else return Rt(b,a)}return Rt(H(i>0&&i===t.conditions.length?"no_bucketing_key":"no_condition_match"),a)}function ns(t,e,n,r,o){let s=e.aggregation?void 0:es(t,e,n,r);if(s)return s;if(_e(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=Zo(t,e,o);return i.value=i.variant=a.key,Be(i,a.payload,e)}return Be(i,t.type==="json"?t.payload:void 0,e)}function qn(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 qn(a))s(c),(o.get(c)===1||r[c]?.reason==="prerequisite_cycle")&&(l=!0);r[i]=l?H("prerequisite_cycle"):rs(a,e,r),o.set(i,2)};for(let i of t)s(i.key);return r}function rs(t,e,n){return We(t,e,n,[],new Set)}function We(t,e,n,r,o){let[s,...i]=r;if(s===void 0){let b=new Set,v=new Proxy(n,{get:(C,L)=>(b.add(String(L)),C[L])}),x=Nn(t,e,v),S=[];for(let C of qn(t))b.has(C)&&!o.has(C)&&!S.includes(C)&&n[C]?.runtime?.length&&S.push(C);return S.length?We(t,e,n,S,new Set([...o,...S])):x}let a=We(t,e,n,i,o),l=n[s],c=new Set([l.value]),u=[];for(let b of Un(l)){if(c.has(b.value))continue;c.add(b.value);let v=We(t,e,{...n,[s]:b},i,o);Wn(v,a)||u.push({filters:[{type:"flag",key:s,op:"eq",value:b.value}],result:v})}let f=[...u,...a.runtime??[]],{runtime:h,...m}=a;return f.length?{...m,runtime:f}:m}function Un(t){return(t.runtime??[]).flatMap(e=>{let{runtime:n,...r}=e.result;return[r,...Un(e.result)]})}function Wn(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(!Wn(n[s],r[s]))return!1;return!0}var Xo,Yo,H,Rt,Pt,$t,Bn=R(()=>{"use strict";bt();Ct();kn();Xo=["user","device","org"],Yo=16**13;H=(t,e=-1)=>({value:!1,reason:t,condition_index:e});Rt=(t,e)=>e.length?{...t,runtime:e}:t;Pt=t=>t.reason==="requires_server",$t=t=>t.reason!=="app_context_excluded"});function Ot(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 Vn=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 be,Kn=R(()=>{"use strict";be=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 ds(t){let e=as;for(let n of us.encode(t))e=(e^BigInt(n))*cs&ls;return e}function Yn(t){let e=(t.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).filter(o=>ke(o).length>=2);if(!e.length)return;let n=new Array(64).fill(0);for(let o of e){let s=ds(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 Jn(t){let n=` ${t.toLowerCase().replace(/’/g,"'").replace(/[.,!?;:]/g," ").replace(/\s+/g," ").trim()} `,r=0;for(let s of zn)n.includes(` ${s} `)&&(r++,n=n.split(` ${s} `).join(" "));let o=Xn.filter(s=>n.includes(` ${s} `)).length;return r>o?-1:o>r?1:0}function ps(t){let e=Qn(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 gs(t){let e=Qn(t).length;return e>=10&&e<=15}function Mt(t){let e=t;for(let[n,r]of fs)e=e.replace(n,o=>r(o)?ms(o):o);return e===t?void 0:e}function Zn(t){if(typeof t!="string")return;let e=t.toLowerCase();return/^[0-9a-f]{32}$/.test(e)?e:void 0}function hs(t,e,n){let r=It(e,n),o=Mt(r);return o===void 0?{[t]:r}:{[t]:o,$ai_text_redacted:!0}}function tr(t,e,n,r){if(t!=="user"&&t!=="assistant")return;let o={$ai_role:t,$ai_message_index:n,$ai_text_length:ke(e).length};if(t==="user"){let s=Yn(e);s!==void 0&&(o.$ai_text_hash=s),o.$ai_sentiment=Jn(e)}return r?{...o,...hs("$ai_text",e,ss)}:o}function nr(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=It(t.comment,is);r.$ai_feedback_comment=Mt(o)??o}return t.messageIndex!==void 0&&(r.$ai_message_index=t.messageIndex),r}function At(t,e){let n=er(t),r=we(e,64);return{...n?{$ai_outcome:n}:{},...r?{$ai_resolution:r}:{}}}function ys(){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 rr(t={}){let e={$ai_conversation_id:t.conversationId||ys()},n=(r,o)=>{o!==void 0&&(e[r]=o)};return n("$ai_agent_name",we(t.agentName,128)),n("$ai_agent_version",we(t.agentVersion,64)),n("$ai_topic",we(t.topic,128)),n("$ai_use_case",we(t.useCase,128)),n("$ai_trace_id",Zn(t.traceId)),e}var ue,os,ss,is,zn,Xn,ke,It,as,cs,ls,us,Qn,Gn,fs,ms,er,we,xe,or=R(()=>{"use strict";ue={started:"$ai_conversation_started",message:"$ai_message",feedback:"$ai_feedback",ended:"$ai_conversation_ended",outcome:"$ai_outcome"},os=["resolved","unresolved","escalated","abandoned","error"],ss=4e3,is=2e3,zn=["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"],Xn=["thanks","thank you","great","perfect","awesome","helpful","that worked","works now","solved","exactly"],ke=t=>Array.from(t),It=(t,e)=>ke(t).slice(0,e).join(""),as=0xcbf29ce484222325n,cs=0x100000001b3n,ls=0xffffffffffffffffn,us=new TextEncoder;Qn=t=>ke(t).filter(e=>e>="0"&&e<="9").map(Number);Gn=String.raw`[\p{Alphabetic}\p{M}\p{Nd}\p{Pc}\p{Join_Control}]`,fs=[[new RegExp(String.raw`(?<!${Gn})\p{Nd}(?:[ -]?\p{Nd}){12,18}(?!${Gn})`,"gu"),ps],[/[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,gs]];ms=t=>ke(t).map(e=>/\s/u.test(e)?e:"*").join("");er=t=>typeof t=="string"&&os.includes(t)?t:void 0,we=(t,e)=>typeof t=="string"&&t?It(t,e):void 0;xe=class{next=0;common;emit;captureText;constructor(e,n={},r=!1){this.emit=e,this.captureText=r,this.common=rr(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=tr(e,n,o,this.captureText);return s?(this.next=o+1,this.send(ue.message,s),!0):!1}feedback(e){let n=nr(e,this.captureText);return n?(this.send(ue.feedback,n),!0):!1}end(e,n){this.send(ue.ended,At(e,n))}outcome(e,n){let r=At(e,n);return r.$ai_outcome?(this.send(ue.outcome,r),!0):!1}}});var Se=R(()=>{"use strict";vn();lt();_n();bn();wn();Bn();Ct();Vn();Kn();or()});function ar(t,e=90,n=Date.now){let r,o=()=>{try{return JSON.parse(t.get(ir)??"{}")}catch{return{}}};return()=>{let s=o();if(location.search!==r){r=location.search;let a=new URLSearchParams(r),l=!1;for(let c of V){let u=a.get(c);u&&(s[c]={v:u.slice(0,512),t:n()},l=!0)}l&&t.set(ir,JSON.stringify(s))}let i={};for(let a of V){let l=s[a];l&&n()-l.t<e*864e5&&(i[a]=l.v)}return i}}var V,ir,Ce=R(()=>{"use strict";V=["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"],ir="lc_click_ids"});function $s(t){let e={},n=new URLSearchParams(location.search);for(let r of[...te,...V,...t]){let o=n.get(r);o&&(e[`$${r}`]=o)}return e}function hr(t){if(!t)return;let e=Array.isArray(t)?{params:t}:{params:t.params??Os,...t.category?{category:t.category}:{}};return e.params.length?e:void 0}function yr(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 vr(){let t=new URLSearchParams(location.search),e=te.map(n=>t.get(n)??"");return e.some(Boolean)?e.join("|"):void 0}function As(t){try{return t?new URL(t).hostname:""}catch{return""}}function Ms(){let t=location.hash;return t.length>1?location.pathname+t.split("?")[0]:location.pathname}function _r(t,e,n=[],r=!1){let o={$current_url:Is(),$host:location.host,$pathname:r?Ms():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=$s(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:As(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,Os,Is,Ke=R(()=>{"use strict";Ce();te=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];Os=["ref","referral","via","aff"];Is=()=>location.href.replace(/([?&])__lc_toolbar=[^&#]*&?/,"$1").replace(/[?&]$/,"")});function Rr(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 Er=R(()=>{"use strict"});function Hs(t,e){let n=t;for(let r of e.pathRules??[])try{n=n.replace(typeof r.match=="string"?new RegExp(r.match):r.match,r.replace)}catch{}return e.maskPathIds?n.split("/").map(r=>Ds.some(o=>o.test(r))?":id":r).join("/"):n}function Ft(t,e){let n=t;if(e.pathRules?.length||e.maskPathIds){let o=/^((?:[a-z][a-z0-9+.-]*:)?\/\/[^/?#]*)?([^?#]*)([\s\S]*)$/i.exec(n);o&&(n=(o[1]??"")+Hs(o[2],e)+o[3])}let r=[...Fs,...e.maskParams??[],...e.maskCampaignParams?[...te,...V]:[]];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(Pr).join("|")})=[^&]*`,"gi"),`$1$2=${jt}`)+i}return e.stripHash&&(n=n.replace(/#.*$/,"")),n}function $r(t){let e=new RegExp(`^\\$(initial_|last_)?(${[...te,...V].map(Pr).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]=jt:s==="$click_ids"&&i&&typeof i=="object"&&((o??={...r})[s]=Object.fromEntries(Object.keys(i).map(a=>[a,jt])));for(let s of js){let i=(o??r)[s];if(typeof i!="string")continue;let a=Ft(i,t);a!==i&&((o??={...r})[s]=a)}if(typeof r.$elements_chain=="string"){let s=r.$elements_chain.replace(/href="((?:[^"\\]|\\.)*)"/g,(i,a)=>`href="${Ft(a,t)}"`);s!==r.$elements_chain&&((o??={...r}).$elements_chain=s)}return Array.isArray(r.$elements)&&((o??={...r}).$elements=r.$elements.map(s=>typeof s?.href=="string"?{...s,href:Ft(s.href,t)}:s)),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 jt,Fs,js,Ds,Pr,Or=R(()=>{"use strict";Ce();Ke();jt="<masked>",Fs=["password","passwd","pwd","pass","token","access_token","refresh_token","id_token","secret","client_secret","state","session","api_key","apikey","key","auth","authorization","code","otp","email","ssn"],js=["$pathname","$current_url","$referrer","$initial_referrer","$initial_current_url","$last_current_url"],Ds=[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,/^[0-9a-hjkmnp-tv-z]{26}$/i,/^\d{4,}$/,/^[0-9a-f]{16,}$/i,/^(?=.*\d)[a-z0-9_-]{20,}$/i],Pr=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});function Ti(t){return t.startsWith("re:")?t.slice(3):t.split("*").map(e=>e.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function Jt(t,e){return!!t?.some(n=>{try{return new RegExp(Ti(n),"i").test(e)}catch{return!1}})}var Zr=R(()=>{"use strict"});Se();var vs=["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 sr(t,e=[]){let n=t.toLowerCase();return e.some(r=>r&&n.includes(r.toLowerCase()))?!0:vs.some(r=>n.includes(r))&&!/\bcubot\b/.test(n)}Ce();function _s(){return Array.from(document.querySelectorAll("meta[http-equiv]")).filter(t=>t.getAttribute("http-equiv")?.toLowerCase()==="content-security-policy").map(t=>t.getAttribute("content")??"")}function bs(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 lr(t,e){if(typeof document>"u")return()=>{};!e&&_s().some(bs)&&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 ws=(t,e)=>t.slice(0,e);function cr(t){try{let e=new URL(t);return e.protocol==="data:"||e.protocol==="blob:"?e.protocol:e.origin+e.pathname}catch{return ws(t,64)}}function ur(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:cr(i.blockedURI??""),$csp_source_file:i.sourceFile?cr(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 xs=["chrome-extension:","moz-extension:","safari-web-extension:","ms-browser-extension:"],Ve=()=>typeof location<"u"&&xs.includes(location.protocol),dr=t=>new URL(t,location.href).href.replace(/\/+$/,""),pr=(t,e,n)=>`${t.replace(/\/+$/,"")}/static/v${e}/${n}`,ks={replay:"replay",heatmaps:"heatmaps",forms:"forms",toolbar:"toolbar",guides:"guides",inspector:"inspector",experiments:"visualChanges","early-access":"earlyAccess",consent:"consentModule"},Ss=t=>import(t);async function Cs(t,e,n=globalThis.fetch){try{let r=await n(pr(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 Rs(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-384",t));return`sha384-${btoa(String.fromCharCode(...e))}`}async function fr(t,e,n,r=Ss,o=globalThis.fetch){let s=t.length?await Cs(e.assetHost,e.version,o):void 0;return(await Promise.all(t.map(async a=>{let l=ks[a];if(!l)return n("unknown module",a);let c=pr(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 Rs(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 Es(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 gr(t,e,n,r){if(!r)return{transport:t,fetch:e};let o=s=>Es(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 Ps="__LUCIDA_DEVTOOLS_HOOK__";function mr(t,e,n){let r=globalThis[Ps];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 Ge(t,e,n=globalThis){e&&(n[typeof e=="string"?e:"lucida"]=t,typeof CustomEvent=="function"&&n.dispatchEvent?.(new CustomEvent("lucida:ready",{detail:t})))}Se();var de=()=>{},Tt=()=>Promise.resolve(),br={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:()=>de,onFlags:()=>de,onIntervention:()=>de,onConsent:()=>de,flush:Tt,shutdown:Tt,reloadFlags:Tt,loadToolbar:()=>Promise.resolve(!1),recommendations:t=>Promise.resolve({placement:t,strategy:"",items:[],shown:de,clicked:de})};function wr(t){return new Proxy(()=>{},{get:(e,n)=>{if(!(typeof n!="string"||n==="then"))return t&&Object.hasOwn(br,n)?br[n]:wr(!1)}})}var xr=()=>wr(!0);var Lt="_lcid";var kr=(t,e)=>e.some(n=>{let r=n.replace(/^\./,"").toLowerCase();return t.toLowerCase()===r||t.toLowerCase().endsWith(`.${r}`)}),Ts=(t,e=Date.now(),n)=>`${t}.${e.toString(36)}${n?`_${n}`:""}`;function Ls(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 Sr(t){if(!t?.length)return;let e=new URL(location.href),n=e.searchParams.get(Lt);if(n!==null){e.searchParams.delete(Lt),history.replaceState(history.state,"",e.toString());try{if(document.referrer&&!kr(new URL(document.referrer).hostname,t))return}catch{return}return Ls(n)}}var Cr=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||!kr(s.hostname,e))return;let i=new URL(s.href);i.searchParams.set(Lt,Ts(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)}};Er();Or();function Ns(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 qs(t,e=Math.random){return n=>t>=1?n:t<=0||e()>=t?null:{...n,properties:{...n.properties,$sample_rate:t}}}function Us(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 Dt="lc_person_identified",ze="lc_pending_set_once",Ar=new Set(["$identify","$create_alias","$groupidentify"]),Ir="$$client_ingestion_warning",Ws=6e4,Ht=class{constructor(e,n){this.mode=e;this.storage=n;this.identified=n.get(Dt)==="1";try{this.pending=JSON.parse(n.get(ze)??"{}")}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(Dt,"1"))}personless(e){return this.mode==="always"?!1:(this.mode==="never"||!this.identified)&&!Ar.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(ze,JSON.stringify(this.pending)))}take(){if(!Object.keys(this.pending).length)return;let e=this.pending;return this.pending={},this.storage.remove(ze),e}reset(){this.identified=!1,this.pending={},this.storage.remove(Dt),this.storage.remove(ze)}};function Bs(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?Ns(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 Vs(t){let e=t.beforeSend?Array.isArray(t.beforeSend)?t.beforeSend:[t.beforeSend]:[];return[$r(t.urlPrivacy??{}),...t.propertyDenylist?.length?[Us(t.propertyDenylist)]:[],...t.sampleRate!==void 0?[qs(t.sampleRate)]:[],...e]}function Mr(t,e,n,r=Date.now){let o=new Ht(e.personProfiles??"always",t.storage),s,i,a=0,l=-1/0,c=()=>{a+=1,!(r()-l<Ws)&&(l=r(),queueMicrotask(()=>{let u=a;a=0,t.capture(Ir,{$$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?Rr(s):void 0),Bs({hooks:Vs(e),person:o,limit:u.event===Ir?void 0:i,log:n,onLimited:c},u))),o}var Ks={"https://capture.lucidace.com":"https://lucidace.com","https://capture.lucida.15-204-158-166.sslip.io":"https://lucida.15-204-158-166.sslip.io"},Tr=t=>Ks[t.replace(/\/+$/,"")]??t;var Nt=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)}},Gs=365,zs=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(" ")),Xs=new Set("co com net org edu gov gob go ac or ne ltd plc sch mil nom".split(" "));function Ys(t){let e=t.toLowerCase().split(".");for(let n=1;n<e.length-1;n++)if(zs.has(e.slice(n).join("."))||n===e.length-2&&e[n+1].length===2&&Xs.has(e[n]))return e.slice(n-1).join(".")}function Js(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 Ys(t)}var Xe=class{constructor(e={}){this.o=e}o;domain=null;attr(){if(this.domain===null)try{this.domain=this.o.domain??(this.o.crossSubdomain?Js():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??Gs)*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{}}},pe=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{}}},qt=class extends pe{constructor(){super("localStorage")}},Qs=["lc_identity","lc_session","lc_device_id","lc_consent","lc_person_identified"],Ut=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)}},Ye=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()}},Wt=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)}},Je=t=>`_${t.replace(/\W/g,"").slice(-8)}`;function Qe(t,e,n){if(t==="memory"||t==="none")return new Nt;let r=Je(e),o=t==="cookie"?new Xe(n):t==="localStorage+cookie"?new Ut(new Xe(n),new qt,s=>Qs.some(i=>s===i+r)):new pe(t);return new Wt(o,r)}var Zs=/^lc_(replay_ack|preview|flag_overrides|toolbar_\w+|distinct_id)$/;function Lr(t,e,n){let r=Je(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(Zs.test(s)){document.cookie=`${s}=; Max-Age=0; Path=/`;try{localStorage.removeItem(s),sessionStorage.removeItem(s)}catch{}continue}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 ei(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 Fr(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 ei(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 Bt={send:async()=>({status:200})};var ti="lucida-browser",Gt="0.1.14",Vt="lc_internal",ni=3e3,Ze="https://capture.lucidace.com",Kt=t=>!!t&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype;function jr(t,e={},n=[]){if(typeof window>"u"||typeof navigator>"u")return xr();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??Ze).replace(/\/+$/,""),i=Object.fromEntries(Object.entries(e).map(([d,p])=>[d,Kt(p)?{...p}:p]));i.apiHost=s;let a=e.extension??Ve(),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=>gr(d,f,u,e.rewritePath),m=h(Bt).fetch,b=e.consent?.respectDnt,v=navigator.globalPrivacyControl===!0,x=(e.respectDnt??b)===!0&&navigator.doNotTrack==="1"||(e.respectGpc??b)===!0&&v,S=e.blockBots!==!1&&typeof navigator<"u"&&sr(navigator.userAgent??"",e.blockedUserAgents),C=!!e.disabled||S;S&&o("bot user agent: capture disabled");let L,Y=h(e.transport??Fr(f,{headers:i.requestHeaders,onError:e.onRequestError,disableBeacon:e.disableBeacon})).transport;if(!e.transport&&e.offlineQueue!==!1&&c!=="memory"&&c!=="none"){let d=new Z(new pe(c==="sessionStorage"?"sessionStorage":"localStorage"),()=>y.hasConsent("analytics"));Y=L=mt(Y,d,{key:`lc_offline${Je(t)}`,isOnline:()=>navigator.onLine!==!1})}let I=C?void 0:Sr(e.crossDomains),$=Qe(C?"memory":c,t,e.cookie),M=(e.storageWriteDelayMs??0)>0?new Ye($,e.storageWriteDelayMs):void 0,O=I?.sessionId??e.bootstrap?.sessionId,N,A=!1,j,T=new Map,ae,K=[],y=new ye({apiKey:t,apiHost:s,transport:C?Bt:Y,storage:M??$,...e.consentPersistence&&!C?{consentStorage:Qe(l(e.consentPersistence),t,e.cookie)}:{},persistProperty:d=>!i.persistedProperties||i.persistedProperties.includes(d),...c==="none"?{cookieless:!0}:{},library:{name:ti,version:Gt},consent:{...e.cookieless==="on_reject"?{cookielessOnReject:!0}:{},...e.consent,...!C&&(e.consent?.geo||e.consent?.mode!=="opt_in")?{awaitRemote:!0}:{},respectDnt:!0,dnt:x},queue:{...e.flushAt?{flushAt:e.flushAt}:{},...e.flushIntervalMs?{flushIntervalMs:e.flushIntervalMs}:{}},...I||e.bootstrap?.distinctId?{bootstrapDistinctId:I?.distinctId??e.bootstrap?.distinctId}:{},...e.bootstrap?.isIdentified&&!I?{bootstrapIdentified:!0}:{},session:{...e.session,...O?{bootstrapId:O}:{}},enrich:(d,p)=>{let g=_r(d,p,i.customCampaignParams,e.capturePageview==="hash");if(s!==Ze&&(g.properties={...g.properties,$lib_custom_api_host:s}),K.length){let E=y.sessionId;for(let P of K)g.properties={...g.properties,...P(E)}}if(d==="$pageview"){let E=y.sessionId;if(E!==j){let P=hr(e.referralParams);if(P&&(!P.category||T.get(P.category)===!0)){j=E;let F=yr(P.params);F&&(g.properties={...g.properties,$referral_code:F},g.$set_once={...g.$set_once,initial_referral_code:F})}}}let _=ae?.()??{},k=Object.keys(_);return k.length&&(g.properties={...g.properties,$click_ids:_},d==="$pageview"&&(g.$set_once={...Object.fromEntries(k.map(E=>[`$initial_${E}`,_[E]])),...g.$set_once},g.$set=Object.fromEntries(k.map(E=>[`$last_${E}`,_[E]])))),i.sendFeatureFlags!==!1&&d!=="$snapshot"&&N&&(g.properties={...Ot(N.all()),...g.properties}),A?{...g,properties:{...g.properties,$internal:!0}}:g},campaignKey:vr,log:o});A=y.storage.get(Vt)==="1",e.clickIds!==!1&&(ae=ar(y.storage,e.clickIds?.expiryDays));let D=Mr(y,i,o);e.bootstrap?.isIdentified&&D.markIdentified();let q=d=>D.blocksPersonWrites?(o(`personProfiles=never: ${d} ignored`),!0):!1;C||y.onChange(d=>{if(d==="consent"){if(!y.hasConsent("replay"))try{sessionStorage.removeItem("lc_replay_ack")}catch{}y.hasConsent("analytics")||y.consentStatus()!=="denied"||(M?.flush(),Lr($,t,e.consent?.storageKey||Oe))}});let ce=new Set;y.onChange(d=>{d==="consent"&&[...ce].forEach(p=>p())});let fe=[],G=[lr(o,e.nonce)],ne=y.storage;if(e.flagPersistence&&!C){let d=new Z(Qe(l(e.flagPersistence),t,e.cookie),()=>y.hasConsent("analytics"));y.onChange(p=>{p==="consent"&&(y.hasConsent("analytics")?d.flushBuffered():d.discardBuffered())}),ne=d}let re=d=>{if(C)return;if(y.hasConsent("analytics"))return d();let p=!1;y.onChange(g=>{!p&&g==="consent"&&y.hasConsent("analytics")&&(p=!0,d())})},ge,w={core:y,client:void 0,config:i,flagStorage:ne,apiKey:t,log:o,fetch:m,onUnload:d=>{fe.push(d)},whenConsented:re,onCapture:d=>y.onCaptured(d),eventExtras:K,clickExtras:[],flagPersonProps:[],categoryGrants:T,loadConfig:()=>ge??=new Promise(d=>re(()=>{m(`${s}/v1/config?api_key=${encodeURIComponent(t)}`).then(p=>p.ok?p.json():null).then(p=>(p&&y.applyRemote(p),p)).then(d,()=>d(null))}))},me=Promise.resolve();if(y.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));ge=p,me=new Promise(g=>{let _=setTimeout(()=>(y.resolveConsent("opt_in"),g()),ni);p.then(k=>{clearTimeout(_),k?y.applyRemote(k):d?y.resolveConsent("opt_in"):y.applyRemote({}),g()})})}let oe=gt(y,{apiHost:s,apiKey:t,fetch:m,whenConsented:re,log:o,disabled:C});G.push(()=>oe.stop());let J={get distinctId(){return y.distinctId},capture:(d,p,g)=>{y.capture(d,p,g?.timestamp!==void 0?{timestamp:g.timestamp}:{})&&(g?.sendInstantly||g?.transport)&&y.flush(g.transport==="beacon"?{beacon:!0}:{})},identify:(d,p,g)=>{q("identify")||(D.markIdentified(),y.identify(d,p,g))},alias:(d,p)=>{q("alias")||(D.markIdentified(),y.alias(d,p))},reset:d=>{y.reset({resetDeviceId:!!d,reuseAnonymousId:!!e.reuseAnonymousId}),D.reset()},createPersonProfile:()=>{q("createPersonProfile")||D.isProfile||(D.markIdentified(),y.capture("$set",{}))},setConfig:d=>{let p=i;for(let[g,_]of Object.entries(d)){let k=p[g];Kt(k)&&Kt(_)?Object.assign(k,_):p[g]=_}"debug"in d&&(r=!!d.debug)},setPersonProperties:(d,p)=>{!d&&!p||q("setPersonProperties")||(D.markIdentified(),y.capture("$set",{},{...d?{$set:d}:{},...p?{$set_once:p}:{}}))},unsetPersonProperties:d=>{!d.length||q("unsetPersonProperties")||(D.markIdentified(),y.capture("$set",{},{$unset:d}))},getDistinctId:()=>y.distinctId,getSessionId:()=>y.sessionId,onSessionId:d=>y.onSessionId(p=>d(p)),getProperty:d=>y.getProperty(d),hasOptedOut:()=>y.consentStatus()==="denied",hasOptedIn:()=>y.consentStatus()==="granted",onConsent:d=>(ce.add(d),()=>{ce.delete(d)}),getReplayUrl:d=>{let g=`${(e.uiHost??Tr(s)).replace(/\/+$/,"")}/replays/${encodeURIComponent(y.sessionId)}`,_=y.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)=>{y.capture("$feature_view",{...p,$feature_flag:d},{$set:{[`$feature_view/${d}`]:!0}})},featureInteraction:(d,p)=>{y.capture("$feature_interaction",{...p,$feature_flag:d},{$set:{[`$feature_interaction/${d}`]:!0}})},updateFlags:(d,p,g)=>w.flags?.update(d,p,g?.merge??!0),register:d=>y.register(d),registerOnce:d=>y.registerOnce(d),unregister:d=>y.unregister(d),group:(d,p,g)=>{D.markIdentified(),y.group(d,p,g)},optIn:(d=["analytics","replay"])=>y.setConsent({analytics:d.includes("analytics"),replay:d.includes("replay"),marketing:d.includes("marketing")}),optOut:()=>y.optOut(),optOutInternal:(d=!0)=>{A=d,d?y.storage.set(Vt,"1"):y.storage.remove(Vt)},get isInternal(){return A},setConsent:d=>y.setConsent(d),getConsent:()=>y.getConsent(),getConsentStatus:d=>y.getConsentStatus(d),consentStatus:()=>y.consentStatus(),getFlag:d=>w.flags?.get(d),getFlagPayload:d=>w.flags?.payload(d),getFlagResult:(d,p)=>w.flags?.result(d,p)??ie(d,void 0,void 0,"not_found"),getLayerParam:(d,p,g)=>w.flags?.layerParam(d,p)??g,isFeatureEnabled:d=>{let p=w.flags?.get(d);return p!==void 0&&p!==!1},onFlags:d=>w.flags?.onChange(d)??(()=>{}),onIntervention:d=>oe.on(d),reloadFlags:()=>w.flags?.reload()??Promise.resolve(),getAllFlags:()=>w.flags?.all()??{},overrideFlags:(d,p)=>w.flags?.override(d,p),setPersonPropertiesForFlags:(d,p)=>w.flags?.setPersonProperties(d,p),resetPersonPropertiesForFlags:()=>w.flags?.resetPersonProperties(),setGroupPropertiesForFlags:(d,p)=>w.flags?.setGroupProperties(d,p),resetGroupPropertiesForFlags:()=>w.flags?.resetGroupProperties(),setContext:(d,p,g)=>w.flags?.setContext(d,p,g),clearContext:d=>w.flags?.clearContext(d),guides:{showChangelog:()=>w.guides?.showChangelog()??0,show:d=>w.guides?.show(d)??!1,reset:d=>w.guides?.reset(d)},ai:{startConversation:d=>new xe((p,g)=>J.capture(p,g),d,i.ai?.captureText===!0).start()},earlyAccess:{list:()=>w.earlyAccess?.list()??Promise.resolve([]),optIn:d=>w.earlyAccess?.optIn(d),optOut:d=>w.earlyAccess?.optOut(d)},replay:{start:d=>w.replay?.start(d)??Promise.resolve(),stop:()=>w.replay?.stop(),pause:()=>w.replay?.pause(),resume:()=>w.replay?.resume(),tag:d=>w.replay?.tag(d),isRecording:()=>w.replay?.isRecording()??!1},consent:{showBanner:d=>w.consentUi?.showBanner(d)??Promise.resolve(null),hideBanner:()=>w.consentUi?.hideBanner()},loadToolbar:d=>w.toolbar?.load(typeof d=="string"?d:d.token)??Promise.resolve(!1),activateExperiment:d=>w.experiments?.activate(d),recommendations:(d,p)=>w.recs?.get(d,p)??Promise.resolve({placement:d,strategy:"",items:[],shown(){},clicked(){}}),flush:()=>me.then(()=>y.flush()),shutdown:async()=>{for(let d of G)d();M?.flush(),await y.shutdown()}};if(w.client=J,!C){let d=()=>{for(let g of fe)g();M?.flush(),y.flush({beacon:!0})};window.addEventListener("pagehide",d);let p=()=>{document.visibilityState==="hidden"&&y.flush({beacon:!0})};if(document.addEventListener("visibilitychange",p),G.push(()=>{window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",p)}),L){let g=()=>{L.drain()};window.addEventListener("online",g),G.push(()=>window.removeEventListener("online",g)),re(g)}if(e.captureCspViolations){let g=typeof e.captureCspViolations=="object"?e.captureCspViolations:{};G.push(ur((_,k)=>{y.capture(_,k)},g))}for(let g of n){let _=g(w);_&&G.push(_)}N=w.flags,n.length||w.loadConfig(),mr(w,J,s)}return Ge(J,e.exposeGlobal),o("initialised",{apiHost:s,consent:y.getConsent()}),J}var ri='[data-lc-region="article"]';function Dr(t,e,n){if(e.articles===!1)return()=>{};let r;t.loadConfig().then(v=>{typeof v?.article_selector=="string"&&(r=v.article_selector)});let o=()=>{for(let v of[e.articleSelector,r,ri])if(v)try{let x=document.querySelector(v);if(x)return x}catch{}return null},s=location.href,i=location.pathname,a=null,l=0,c=!1,u=()=>{if(a??=o(),!a)return;let v=a.getBoundingClientRect();if(v.height<=0)return;let x=Math.round(Math.min(100,Math.max(0,(window.innerHeight-v.top)/v.height*100)));l=Math.max(l,x);let S=a.querySelector("h1,h2");S&&S.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 et="data-lc-content",oi="data-lc-content-piece",si="data-lc-content-target";var zt=(t,e)=>(t.getAttribute(e)??"").trim().slice(0,200);function Hr(t,e,n){if(e.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let r=new WeakSet,o=u=>{let f={$content_name:zt(u,et)},h=zt(u,oi),m=zt(u,si);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(`[${et}]`).forEach(f=>i.observe(f));a(document);let l=new MutationObserver(()=>{location.href!==s&&(s=location.href,i.disconnect(),document.querySelectorAll(`[${et}]`).forEach(u=>r.delete(u))),a(document)});l.observe(document.documentElement,{childList:!0,subtree:!0});let c=u=>{let f=u.target?.closest?.(`[${et}]`);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 ii=new Set(["input","textarea","select","option"]),ai=["name","type","role","aria-label","title","alt","placeholder"],ci=new Set(["aria-label","aria-description","title","alt","placeholder","value","label"]),li=/(?:\d[ -]?){9,}/;function ui(t){if(ii.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||li.test(e)))return e.slice(0,255)}function Nr(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 di="***";function nt(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 pi(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-")||ai.includes(f.name))&&!r(f.name)&&(n||!ci.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=ui(t);f&&(a.text=f)}return a}function rt(t,e,n,r,o={}){let s=[],i=Nr(r),a=Nr(o.allow),l=o.maskAll?(u,f)=>a(u)?f:di:(u,f)=>f,c=e;for(let u=t;u&&s.length<10;u=u.parentElement)s.push(pi(u,c,e,i,l)),(u===n||!n)&&(c=!1);return s}var tt=t=>t.replace(/(["\\])/g,"\\$1");function ot(t){return t.map(e=>{let n=e.tag_name+(e.classes?"."+e.classes.join("."):"")+":";e.attr__id&&(n+=`attr__id="${tt(e.attr__id)}"`),e.href&&(n+=`href="${tt(e.href)}"`),e.text&&(n+=`text="${tt(e.text)}"`);for(let[r,o]of Object.entries(e.attrs??{}))n+=`attr__${r}="${tt(o)}"`;return n+`nth-child="${e.nth_child}"nth-of-type="${e.nth_of_type}"`}).join(";")}var X=[],fi=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,gi=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,mi=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,hi="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function yi(t,e=[]){if(e.length&&t.closest(e.join(","))||t.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=t.closest(hi)??t,r=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(fi.test((n.textContent??"").trim())||gi.test(r))return!0;for(let o=n,s=0;o&&s<3;o=o.parentElement,s++)if(mi.test(o.getAttribute("class")??""))return!0;return!1}var vi=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function qr(t,e=Date.now(),n={},r){if(r&&n.ignoreSelectors?.length&&r.closest(n.ignoreSelectors.join(",")))return{};if(r&&n.suppressSteppers!==!1&&yi(r,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&vi())return{};let o=n.windowMs??1e3,s=n.radiusPx??30;for(X.length&&e<X[X.length-1].t&&(X.length=0),X.push({t:e,x:t.clientX,y:t.clientY});X.length&&e-X[0].t>o;)X.shift();let i=X.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 Ur(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 Wr=/^[A-Za-z_][\w-]*$/,_i=5;function bi(t){let e=[];for(let n=t;n&&e.length<_i;n=n.parentElement){let r=n.tagName.toLowerCase();if(n.id&&Wr.test(n.id)){e.unshift(`${r}#${n.id}`);break}let o=(n.getAttribute("class")??"").split(/\s+/).filter(s=>Wr.test(s)).slice(0,2);e.unshift(r+o.map(s=>`.${s}`).join(""))}return e.join(" ")}function Br(t,e,n,r,o={}){let s={$selector:bi(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,qr(e,Date.now(),o.rageClicks||{},n));let i=o.deadClicks;!r&&e.isTrusted&&i!==!1&&!(i?.ignoreSelectors?.length&&n.closest(i.ignoreSelectors.join(",")))&&Ur(t,s.$selector,i?.waitMs);for(let a of t.clickExtras)Object.assign(s,a(e,n));return s}var wi="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",xi="[data-lc-ignore]",Xt=t=>t.some(e=>typeof e=="string"?location.href.includes(e):e.test(location.href)),ki=t=>!t?.length||Xt(t),Yt=t=>({maskAll:t.maskAllAttributes,allow:t.attributeAllowlist}),Re=(t,e)=>!!t.closest(xi)||!!(e.denySelectors?.length&&t.closest(e.denySelectors.join(",")));function Vr(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)||Re(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)||Re(f,e)||e.allowSelectors?.length&&!f.closest(e.allowSelectors.join(","))||e.elementAllowlist?.length&&!f.closest(e.elementAllowlist.join(","))||!ki(e.urlAllowlist)||c==="change"&&!/^(input|select|textarea)$/i.test(f.tagName)||f instanceof HTMLInputElement&&f.type==="password")return;let h=f.closest(wi);if(c==="click"&&!h&&!e.allowSelectors?.length)return;let m=rt(f,e.captureText??!0,h??void 0,e.attributeIgnore,Yt(e)),b=m.find(x=>x.text)?.text,v=s;s=0,t.client.capture("$autocapture",{...nt(f),$event_type:c,...v>0?{$keystroke_count:v}:{},$elements:m,$elements_chain:ot(m),...b?{$el_text:b}:{},...c==="click"?Br(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 Si='[contenteditable]:not([contenteditable="false"])',Kr="input,textarea,select",Ci=255;function Ri(t){return t.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,Ci)}var Ei=t=>t?t instanceof Element?t:t.parentElement:null;function Gr(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=rt(h,!1,h,e.attributeIgnore,Yt(e));return{...nt(h),$elements:m,$elements_chain:ot(m)}},l=h=>{let m=h instanceof Element?h.closest(Si):null;return m&&!Re(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,v=Ei(m?.anchorNode)??b;if(!v||Re(v,e)||v.closest(Kr)||b?.closest(Kr))return;let x=e.captureCopiedText?Ri(m?.toString()??""):"";t.client.capture("$copy_autocapture",{$copy_type:h.type,...a(v),...x?{$selected_content:x}:{}})};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 Pi="[data-lc-ignore]",$i=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],Oi=["q","s","search","query"],zr=t=>t.origin+t.pathname;function Xr(t,e,n){let r=Array.isArray(e.fileDownloads)?e.fileDownloads.map(s=>s.toLowerCase()):$i,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(Pi))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:zr(l),$file_name:c,$file_extension:u}):e.outboundLinks!==!1&&l.host!==location.host&&t.client.capture("$outbound_click",{$url:zr(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:Oi,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())}var Ai=[25,50,75],Ii="data-lc-media-title";function Yr(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 Mi=t=>(t.getAttribute(Ii)??t.getAttribute("title")??t.getAttribute("aria-label")??"").trim().slice(0,200);function Jr(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:Yr(l)},u=Mi(l);return u&&(c.$media_title=u),Number.isFinite(l.duration)&&(c.$media_duration=Math.round(l.duration)),c},s=l=>{let c=Yr(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 Ai)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 Qr(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)}}Zr();var eo=255,Li=new Set(["input","textarea","select","option"]),Fi="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",ji=new Set(["value","password","autocomplete"]),Di=/(?:\d[ -]?){9,}/,Ee=new WeakMap,Qt=new WeakMap;function to(t,e){let n=Qt.get(t);if(n)return new Promise(r=>{let o=setTimeout(r,e);n.then(()=>(clearTimeout(o),r()))})}function Hi(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 Ni(t){if(!t||Li.has(t.tagName.toLowerCase())||t.isContentEditable)return!1;try{return!t.closest(Fi)}catch{return!1}}function qi(t,e){if(t.source==="attribute"){let r=(t.attribute??"").toLowerCase();if(!r||ji.has(r)||r.startsWith("on"))return;let o=e.getAttribute(r);return o===null?void 0:o.slice(0,eo)}let n=(e.textContent??"").replace(/\s+/g," ").trim();if(!(!n||Di.test(n)))return n.slice(0,eo)}function no(t,e,n,r=location.href){let o={};for(let s of t){if(!s.events.includes(e)||s.url&&!Jt([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(!Ni(i))continue;let a=qi(s,i);a!==void 0&&(o[s.name]=a)}return o}function ro(t){let e=!0,n=t.loadConfig().then(r=>{e&&Ee.set(t,Hi(r?.snapshot_properties)),Qt.delete(t)});return Qt.set(t,n),t.clickExtras.push((r,o)=>e?no(Ee.get(t)??[],"click",o):{}),()=>{e=!1,Ee.delete(t)}}function oo(t){let e=Ee.get(t);return e?.length?no(e,"pageview"):{}}function so(t){return!!Ee.get(t)?.some(e=>e.events.includes("pageview"))}var Ui=t=>{try{return new URL(t).pathname}catch{return t}};function Wi(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 io(t){let e=0,n=0,r=()=>{let o=Wi(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 Bi=800,Vi=t=>t.core.hasConsent("analytics")||t.core.consent.resolving;function Ki(t){return t==="history"?{path:!0,search:!0}:t==="hash"?{path:!0,search:!0,hash:!0}:typeof t=="object"?t:void 0}function Gi(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 st(t,e,n={}){let r=n.views??!0,o=n.leave??!0,s=Ki(e),i=t.config.scrollRoot,a=location.href,l=a,c=Date.now(),u=io(i),f=Qr(),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,v=(O,N={})=>{if(!r)return;let{core:A}=t;if(!A.hasConsent("analytics")&&!A.anonymousOnReject&&!(A.consent.pending&&A.consent.queueBeforeConsent)){if(!b){b=!0;let j=()=>{b&&(b=!1,v())};t.whenConsented(j),A.onChange(T=>{T==="consent"&&A.anonymousOnReject&&j()})}return}t.client.capture("$pageview",{...oo(t),...O===void 0?{}:{$referrer:O},...N})},x,S=()=>{let O=x;x=void 0,O?.()},C=O=>{if(location.href===l)return;let N=l;if(l=location.href,!s||!Gi(N,l,s))return;let A=a;m(),u.stop();let j=new Date(c);a=location.href,c=Date.now(),u=io(i),f.reset();let T={$navigation_type:O,$prev_pageview_pathname:Ui(A),$prev_pageview_duration:Math.round((c-j.getTime())/100)/10};so(t)?setTimeout(()=>v(A,T),0):(S(),x=()=>v(A,T),queueMicrotask(S))};t.onUnload(m);let L=Vi(t)?to(t,Bi):void 0;if(L?(x=()=>v(),t.onUnload(S),L.then(S)):v(),!s)return()=>(u.stop(),f.stop());let{pushState:Y,replaceState:I}=history;history.pushState=function(...O){S(),Y.apply(this,O),C("pushState")},history.replaceState=function(...O){S(),I.apply(this,O),C("replaceState")};let $=()=>C("popstate"),M=()=>C("hashchange");return window.addEventListener("popstate",$),s.hash&&window.addEventListener("hashchange",M),()=>{window.removeEventListener("hashchange",M),history.pushState=Y,history.replaceState=I,window.removeEventListener("popstate",$),u.stop(),f.stop()}}var ao=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&&Xt(a.urlIgnorelist)),c=()=>!o;e.push(Vr(t,a,l,c),Gr(t,a,l,c),Xr(t,a,l),Hr(t,a,l),Dr(t,a,l),Jr(t,a,l),ro(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(st(t,s)):s!==!1?e.push(st(t,s,{leave:!1})):i===!0&&e.push(st(t,"history",{views:!1})),()=>e.forEach(a=>a())};Se();var zi="lc_preview",Zt="lc_preview";function Xi(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 co(t){let e=new URL(t).searchParams.get(zi),n=null;try{n=sessionStorage.getItem(Zt)}catch{}return{forced:Xi(e==="off"?null:e??n),persist(){try{e==="off"?sessionStorage.removeItem(Zt):e&&sessionStorage.setItem(Zt,e)}catch{}}}}Ce();Ke();var en="lc_flag_initial";function Yi(t){try{return t?new URL(t).hostname:""}catch{return""}}function Ji(){let t=new URLSearchParams(location.search),e={$initial_referrer:document.referrer||"$direct",$initial_referring_domain:Yi(document.referrer)||"$direct",$initial_current_url:location.href.split("#")[0]};for(let n of[...te,...V]){let r=t.get(n);r&&(e[`$initial_${n}`]=r)}return e}function po(t,e){if(typeof location>"u")return{};let n=t.get(en);if(n)try{return JSON.parse(n)}catch{}let r=Ji();return e(()=>{t.get(en)||t.set(en,JSON.stringify(r))}),r}function Qi(){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 fo(){if(typeof location>"u"||typeof navigator>"u")return{};let t={},e=new URLSearchParams(location.search);for(let o of[...te,...V]){let s=e.get(o);s&&(t[`$${o}`]=s)}let{browser:n,os:r}=Qi();return t.$browser=n,t.$os=r,t.$device_type=String(tn().$device_type??"Desktop"),t}function tn(){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:Zi(t)}}function Zi(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 ea=/^[A-Za-z0-9_.-]{1,100}$/,ta=/^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*){0,5}$/,na=new Set(["__proto__","prototype","constructor"]),ra=50,go=200;function lo(t,e){if(!ta.test(e))return;let n=t;for(let r of e.split(".")){if(na.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,go);if(typeof n=="number"&&Number.isFinite(n)||typeof n=="boolean")return n}function oa(){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,go))}return t}function uo(t){let e={};if(!t||typeof window>"u")return e;let n=s=>Array.isArray(s)?s.filter(i=>typeof i=="string").slice(0,ra):[],r=n(t.cookies).filter(s=>ea.test(s));if(r.length){let s=oa();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=lo(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=lo(o[i],s);if(a!==void 0){e[`$datalayer/${s}`]=a;break}}return e}var mo=t=>{if(t.config.flagOptions?.disableRemote&&!t.config.localFlags?.length)return;let e;t.flagPersonProps.push(()=>e&&t.core.hasConsent("analytics")?uo(e):{}),t.loadConfig().then(n=>{let r=n?.flag_targeting_sources;!r||typeof r!="object"||(e=r,Object.keys(uo(r)).length&&t.flags?.reload())})};Se();function nn(t){return typeof t=="object"?t.value??t.variant??!!t.enabled:t}function rn(t){let e={value:nn(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:rn(n.result)}))),e}var ho="lc_rt_events",yo=t=>!!t?.some(e=>e.conditions.some(n=>n.filters?.some(r=>r.type==="event")));function vo(t,e){let n;try{let i=t.flagStorage.get(ho);i&&(n=JSON.parse(i))}catch{}let r=new ve(n),o={},s=qe(e,o);return{counts:()=>r.counts(t.core.sessionId),setServer(i){o=i,s=qe(e,o)},server:()=>o,drop(i){for(let a of i)delete o[a]},resolved(){return St(o,r.counts(t.core.sessionId))},record(i,a,l){r.record(i,t.core.sessionId,a,s),l&&t.whenConsented(()=>t.flagStorage.set(ho,JSON.stringify(r.saved())))}}}var on="lc_flags",sn="lc_flag_overrides_api";function _o(t){try{let e=localStorage.getItem("lc_flag_overrides");return e?JSON.parse(e)[t]:void 0}catch{return}}var bo=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,v={},x={},S={},C=new Set,L=typeof location>"u"?{forced:{},persist(){}}:co(location.href),Y=Object.keys(L.forced).length>0,I=()=>({...r,...S}),$=t.config.flagOptions??{},M=new be($.cacheTtlMs),O=(t.config.flagsApiHost??t.config.apiHost).replace(/\/+$/,""),N=$.keys?.length?new Set($.keys):void 0,A=p=>N?Object.fromEntries(Object.entries(p).filter(([g])=>N.has(g))):p,j=(p,g,_=!0)=>{if(r=A(p),o=A(g),l=!0,_)for(let k of C)k(I())},T=vo(t,n.localFlags),ae=!1,K=()=>{ae||(ae=!0,queueMicrotask(()=>{ae=!1,w()}))},y=t.flagStorage.get(on);if(y)try{let p=JSON.parse(y);r=p.values,o=p.payloads,s=Object.fromEntries(Object.keys(r).map(g=>[g,"cached"])),p.rt&&T.setServer(p.rt),M.restore(p),l=Object.keys(r).length>0}catch{}let D=t.flagStorage.get(sn);if(D)try{S=JSON.parse(D)}catch{}let q=n.bootstrap;if(q?.flags||q?.payloads){let p={...q.flags};for(let g of Object.keys(q.payloads??{}))p[g]??=!0;j({...r,...p},{...o,...q.payloads});for(let g of Object.keys(p))s[g]="bootstrap"}let ce={},fe=()=>({...$.autoProperties===!1?{}:fo(),...po(e.storage,t.whenConsented),...Object.assign({},...t.flagPersonProps.map(p=>p())),...v}),G=$.evaluationContexts?.length?{app_contexts:$.evaluationContexts}:{},ne=(p=!0)=>{let g=n.localFlags;if(!g?.length)return!0;let _=n.localFlagsContext,k=Et(g,{runtime_events:T.counts(),distinct_id:e.distinctId,...e.groups?{groups:e.groups}:{},...e.deviceId?{device_id:e.deviceId}:{},...b()?{contexts:m}:{},...G,..._,person_properties:{...fe(),..._?.person_properties},group_properties:{..._?.group_properties,...x}}),E={},P={},F=!1;for(let[Q,U]of Object.entries(k))Pt(U)?F=!0:$t(U)&&(E[Q]=U.value,s[Q]=U.reason,U.payload!==void 0&&(P[Q]=U.payload));return ce=E,j({...r,...E},{...o,...P},p),F},re=p=>{let g={...r},_={...o};for(let[k,E]of Object.entries(T.resolved()))g[k]=E.value,s[k]=E.reason,E.payload!==void 0?_[k]=E.payload:delete _[k];j(g,_,p)},ge=yo(n.localFlags);t.onCapture(p=>{let g=ge||Object.keys(T.server()).length>0;if(T.record(p.event,p.properties,g),!g)return;let _=JSON.stringify([I(),o]);if(ge&&ne(!1),re(!1),JSON.stringify([I(),o])!==_)for(let k of C)k(I())});let w=(p=!0)=>{let g=++c;return!ne()||$.disableRemote||!p&&M.fresh(e.distinctId)?Promise.resolve():new Promise(_=>{t.whenConsented(()=>{if(g!==c)return _();L.persist();let k=new AbortController,E=setTimeout(()=>k.abort(),$.timeoutMs??1e4);t.fetch(`${O}/v1/flags`,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",signal:k.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:fe(),...Object.keys(x).length?{group_properties:x}:{},device_properties:tn(),...e.deviceId?{device_id:e.deviceId}:{},...b()?{contexts:m}:{},...G,...Y?{preview:L.forced}:{},...$.keys?.length?{flag_keys:$.keys}:{}})}).then(P=>P.ok?P.json():Promise.reject(new Error(`status ${P.status}`))).then(P=>{if(g!==c)return;if(P.quota_limited)return a="quota_limited",t.log("flags quota limited; keeping cached values");a=P.errors_while_computing_flags?"errors_while_computing_flags":void 0;let F={},Q={},U={};for(let[$e,W]of Object.entries(P.flags??{}))F[$e]=nn(W),typeof W=="object"&&W.payload!==void 0&&(Q[$e]=W.payload),s[$e]=typeof W=="object"&&typeof W.reason=="string"?W.reason:"remote",typeof W=="object"&&W.runtime?.length&&(U[$e]=rn(W));i=P.request_id,T.setServer(U);let Pe=P.errors_while_computing_flags;j({...ce,...Pe?r:{},...F},Pe?{...o,...Q}:Q,!1),re(!0),t.flagStorage.set(on,JSON.stringify({values:{...Pe?r:{},...F},payloads:{...Pe?o:{},...Q},rt:U,...M.mark(e.distinctId)})),t.log("flags loaded",F)}).catch(P=>{let F=/^status (\d+)/.exec(String(P?.message))?.[1];g===c&&(a=k.signal.aborted?"timeout":F?`api_error_${F}`:"connection_error"),t.log("flags fetch failed",P)}).finally(()=>{clearTimeout(E),_()})})})},me=p=>S[p]??_o(p)??r[p];t.flags={get(p){let g=me(p);if(g===void 0)return;if(p in L.forced||p in S)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 k=`${p}:${String(g)}`;return u.has(k)||(u.add(k),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(S).length?I():{},payload:p=>o[p],result(p,g){let _=g?.sendExposure===!1?me(p):this.get(p),k=p in S||_o(p)!==void 0?"override":p in L.forced?"preview":s[p]??"remote";return ie(p,_,o[p],k)},layerParam(p,g){for(let[_,k]of Object.entries(o)){let E=k;if(E?.lc_layer!==p||!E.lc_params||!(g in E.lc_params))continue;let P=this.get(_);if(P!==void 0&&P!==!1)return E.lc_params[g]}},onChange(p){return C.add(p),l&&p(I()),()=>{C.delete(p)}},reload:w,update(p,g,_=!0){for(let k of Object.keys(p))s[k]="pushed";T.drop(Object.keys(p)),j(_?{...r,...p}:{...p},_?{...o,...g}:{...g})},override(p,g){S=p?{...p}:{},p?g?.persist&&t.whenConsented(()=>t.flagStorage.set(sn,JSON.stringify(S))):t.flagStorage.remove(sn);for(let _ of C)_(I())},setPersonProperties(p,g=!0){M.clear(),v={...v,...p},g&&K()},resetPersonProperties(){v={}},setGroupProperties(p,g=!0){M.clear();for(let[_,k]of Object.entries(p))x[_]={...x[_],...k};g&&K()},resetGroupProperties(){x={}},setContext(p,g,_){M.clear(),m={...m,[p]:{key:g,properties:_??{}}},K()},clearContext(p){M.clear();let{[p]:g,..._}=m;m=_,K()}},e.onChange(p=>{if(p==="reset"){m={},v={},x={},u.clear(),f.clear(),r={},o={},s={},i=void 0,a=void 0,T.setServer({}),M.clear(),t.flagStorage.remove(on),ne(!1);for(let g of C)g(I())}(p==="identify"||p==="reset"||p==="group")&&K()}),n.disableFlagsOnFirstLoad?ne():w(!1);let oe=n.flagStream,J;oe&&!$.disableRemote&&t.whenConsented(()=>{J=ft({apiHost:O,apiKey:t.apiKey,fetch:t.fetch,reload:()=>{w()},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=$.refreshMs&&$.refreshMs>0&&!$.disableRemote?setInterval(()=>document.visibilityState!=="hidden"&&void w(!1),$.refreshMs):void 0;return()=>{J?.(),d&&clearInterval(d)}};function it(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 sa={good:0,"needs-improvement":1,poor:2},ia=["good","needs-improvement","poor"],aa={LCP:"lcp_ms",INP:"inp_ms",CLS:"cls",FCP:"fcp_ms",TTFB:"ttfb_ms"};function ca(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 wo(t){let e,n=!1;return t.whenConsented(()=>{n||(e=ca(t,r=>la(t,r)))}),()=>(n=!0,e?.())}function la(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:ia[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=aa[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,sa[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 xo="__lucidaWatchtowerHint";function ko(t){if(t.config.exposeGlobal||t.config.disabled)return()=>{};let e=globalThis,n=()=>{e[xo]||(e[xo]=!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 an="lucida.session_id";function ua(t,e){return[...(t??"").split(",").map(r=>r.trim()).filter(r=>r&&!r.startsWith(`${an}=`)),`${an}=${encodeURIComponent(e)}`].join(",")}function da(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 So=t=>{let e=t.config.watchtower,{core:n}=t,r=pa(t),o=wo(t),s=ko(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)&&da(u,e.origins),c=it((u,f)=>{l(u)&&f.set("baggage",ua(f.get("baggage"),a))});return()=>(c(),i())};function pa(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(an,o)};return t.whenConsented(()=>r(n.sessionId)),n.onSessionId(r)}var fa="X-Lucida-Distinct-Id",ga="X-Lucida-Session-Id";function ma(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 Co=t=>/^[\x20-\x7e]*$/.test(t)?t:encodeURIComponent(t),Ro=t=>{let e=t.config.tracingHeaders;if(!e?.length)return;let{core:n}=t;return it((r,o)=>{!n.hasConsent("analytics")||r.startsWith(t.config.apiHost)||!ma(r,e)||(n.distinctId&&o.set(fa,Co(n.distinctId)),o.set(ga,Co(n.sessionId)))})};function Eo(t,e={},n=[]){return jr(t,e,[ao,bo,mo,So,Ro,Cr,...n])}var cn=(()=>{try{let t=typeof document>"u"?void 0:document.currentScript?.src;return t?new URL(t).origin:void 0}catch{return}})();function ha(t,e,n){if(!t.modules?.length)return Promise.resolve([]);if(t.extension??Ve())return console.warn("[lucida] extension mode: `modules` are not loaded remotely; bundle them with createClient"),Promise.resolve([]);let r=(t.assetHost?dr(t.assetHost):void 0)??cn??t.apiHost??Ze;return fr(t.modules,{assetHost:r,version:Gt},(...o)=>console.warn("[lucida]",...o),e,n)}function ya(t,e,n){let r=t.lucidaQueue??[],o=[],s=Promise.resolve(),i=!1,a=c=>{let[u,...f]=c;if(u==="init"){if(t.lucida||i)return;i=!0;let m=f[1]??{},b=v=>{let x=!m.uiHost&&!m.assetHost&&cn?{uiHost:cn}:{};t.lucida=Eo(String(f[0]),{...x,...m},v),Ge(t.lucida,!0,t);let S=o;o=[],S.forEach(a)};m.modules?.length?s=ha(m,e,n).then(b):b([]);return}if(!t.lucida){o.push(c);return}let h=t.lucida[u];typeof h=="function"&&h.apply(t.lucida,f)},l=r.splice(0);return r.push=(...c)=>(c.forEach(a),r.length),t.lucidaQueue=r,l.forEach(a),s}typeof window<"u"&&ya(window);})();
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.1.13",
2
+ "version": "0.1.14",
3
3
  "files": {
4
4
  "autocapture.js": "sha384-Yeaj4auYKc2SUHup0hcU28qycDNQF23biNXJ31IpaE4jLhAO1UJM97e3wba2PPNt",
5
5
  "banner-TXLAMTQM.js": "sha384-o/r8rh/gOYIPxFRZUpf8EVcVpOMMszbgdkHVkHs603LjCxNkA5cXiYki9GVL+KkD",
6
6
  "consent.js": "sha384-OTuFOodMIW5E/44jKwKGtvBw+DHqnuaS4dQ0eEGKbuP0kKO2cwEMgWrsEIPKpM8u",
7
- "core.js": "sha384-s0Zz3Zbs5iTYjE3ehzYLoww+CY5RY5BJGeb6tsYD5cr/s6LHVTxL923Cw3ESmFR6",
7
+ "core.js": "sha384-B46Q8aQZtbFNypGAS+sqEHNZcClmcpAlrFB5YaaNCtZL5KjJtmWoYrOC2wefW+Ff",
8
8
  "correlate.js": "sha384-VcfDDPARiL7tAELZDbkb0gT78Y9BLGY6iB7KHjApfDLTxfaUeo07l0o5pnY2AjRT",
9
9
  "early-access.js": "sha384-5JZ6DWRYgfoeu7QgSPi8kvVlys4CZ6H2wWuvEEggc83iau5z0sJ8RQD1AXtLCjGQ",
10
10
  "experiments.js": "sha384-5smoFlAcR2T1XmBgazy5HGun22PvX5Pa7IKIKtONtN/CpNy6U9SDWb7W7Di9d5fR",
@@ -13,15 +13,15 @@
13
13
  "guides.js": "sha384-L04oyaUz6CUQsRmlgACfa+LIO1X5V6IxynArZ/BbnBFNOF/KtzAcNhjSKrCUEpwX",
14
14
  "heatmaps.js": "sha384-5+7QtGYM5CTW7R/ZL42MiCVdJUxRwglV6sHwWtyatO6SzjHuuYrZ29SoXm/NtasE",
15
15
  "host-headers.js": "sha384-8OsSDIVDEo3Lsk3G+L5xNJ4pkAYXDEAz+ggBK7sG1cj7tOITAXDKaM2EFtQCHGiF",
16
- "index.js": "sha384-57g1s0x5nBhSFwsUkt8ssqXMyygYV6u19pLf2w5UJyhqQfBu0w1hHghm2U9tBgPx",
16
+ "index.js": "sha384-fE912LAyxdkvEL95+HD5hI+UK5a3IQH0rvYOZDZPwgUPWqLtPoIomSJYgO7ofnOW",
17
17
  "inspector.js": "sha384-wCjcdzjbZ1mAYS3w19Io8NOJQfrnlmfDkinoan/0LUTqCw6M7OSR9QDwxDp6M5+T",
18
- "lucida.js": "sha384-n64nBqxhgYXbiloBADhpwgwiDCPUXeQ1g6miY3MtunYTsx23dvlr3FfXH84Xg4hy",
18
+ "lucida.js": "sha384-4SgljJALO+s7wdXTCnXcV2ZMnoPZk7vYVPZJcfRsgntBGySaNHx2XICE8XELI95a",
19
19
  "modules-FANMZRDJ.js": "sha384-UjLSth+cPZTIxwMGFgoUEocqFSHXnM7IgYpICNSRRU7NTlFkfCg3WUNUbu8u04EP",
20
20
  "persistent-G2OR2L2N.js": "sha384-CsRTVYxlt1E++G7NYAPkyM+1qFJWbIBLRUNukG/wFP1pPLHTvKp6XIlxlGm9+efp",
21
21
  "recommendations.js": "sha384-6XyPo/sQd1LNvQ87+vlgOLYe/ecapP9mmDeKlkTRx15d9gTAmDRwCPrX+n6zy2lx",
22
22
  "recorder-MHNUIAAP.js": "sha384-e4zEmTuDgvv1OwNBei0HkABbpgW+T5WQGeQl9gDxoelIZZ84t9EslLCdvdbUO/r/",
23
23
  "replay.js": "sha384-35wLbPcEOHEutSWCaPqOIr1i/rNYike634HoLU0gPbjBvVJMAXfK5VQTmW6GEbQh",
24
- "toolbar.js": "sha384-5RaMXlQzkpgbv3L9JX67X8YdRd9s5/Kt5usUm4uqC0afaZkXTYbBkdInD2b0ORP3",
24
+ "toolbar.js": "sha384-sj5J2VxduVx3JUkgQreWVs9lkk6iLsrPjiVSHh7kNQXxf+xUO6s5MvAOs5R3RCAv",
25
25
  "validation-S6TYVWAI.js": "sha384-FJISudb3fVX9JZKMgLnOxqdzmfOj9BetMKw7jVvI3UlkyGNaarRpTCMBqfXKupRW",
26
26
  "webmcp.js": "sha384-Vs+fImvLlnbEZtId9H/pA4VXB1bVaxEjOYY+DcAUTN5pXXuNNFOYQfltuj2giALZ"
27
27
  }
@@ -0,0 +1,4 @@
1
+ var xn=Object.defineProperty;var N=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)xn(e,n,{get:t[n],enumerable:!0})};function F(e){let t=[];for(let n=e;n&&t.length<kn;n=n.parentElement){let o=n.tagName.toLowerCase();if(n.id&&Ve.test(n.id)){t.unshift(`${o}#${n.id}`);break}let r=(n.getAttribute("class")??"").split(/\s+/).filter(i=>Ve.test(i)).slice(0,2);t.unshift(o+r.map(i=>`.${i}`).join(""))}return t.join(" ")}var Ve,kn,de=N(()=>{"use strict";Ve=/^[A-Za-z_][\w-]*$/,kn=5});function Xe(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,r]=[String(n),String(e.value??"")];return e.op==="eq"?o===r:e.op==="neq"?o!==r:o.includes(r)}var Ye=N(()=>{"use strict"});function Ze(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):wn(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return Xe({key:e.key,op:e.op,value:e.value},t.person)}function xe(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}function Qe(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(xe(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(En))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(o,"value")?.set;r?r.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}function et(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||_n())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(s,a)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[a%e.length]})),r=Date.now()+1500,i=()=>{n.clearRect(0,0,t.width,t.height);for(let s of o)s.x+=s.vx,s.y+=s.vy,s.vy+=.35,n.fillStyle=s.color,n.fillRect(s.x,s.y,6,4);Date.now()<r?requestAnimationFrame(i):t.remove()};requestAnimationFrame(i)}var wn,En,_n,Oe=N(()=>{"use strict";Ye();wn=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};En="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";_n=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}});function ee(e,t=ke){for(let n of t){let o=e.getAttribute(n);if(o&&!/["\\]/.test(o))return`[${n}="${o}"]`}return e.id&&Sn.test(e.id)?`#${e.id}`:F(e)}function we(e,t){let n={...t,id:`s${e.steps.length+1}`};return e.steps.push(n),n}function tt(e){if(!e.name.trim())return"Name the guide";if(!e.steps.length)return"Add at least one step";if(Cn.has(e.kind)&&e.steps.length!==1)return`A ${e.kind} has exactly one step`;let t=Tn[e.kind];if(t&&(e.steps.length<t[0]||e.steps.length>t[1]))return`A ${e.kind} has ${t[0]} to ${t[1]} steps`;for(let[n,o]of e.steps.entries()){if(e.kind==="form_validation"){if(!o.validation?.selector||!o.validation.rules?.length)return`Step ${n+1} needs a field and at least one rule`;continue}if(!o.title?.trim()&&!o.body?.trim())return`Step ${n+1} needs a title or body`;if(An.has(e.kind)&&!o.selector)return`Step ${n+1} needs a picked element`;let r=o.automation?Ee(o.automation):null;if(r)return`Step ${n+1}: ${r}`}return null}function nt(e,t){return{name:e.name.trim(),kind:e.kind,steps:e.steps,targeting:e.targeting??{url:t,url_match:"exact"}}}function Ee(e,t=document){if(!e.selector||e.selector.length>500)return"automation needs a selector (max 500 chars)";let n;try{n=[...t.querySelectorAll(e.selector)]}catch{return`invalid selector ${e.selector}`}if(!n.length)return`nothing on this page matches ${e.selector}`;if(n.length>1)return`${e.selector} matches ${n.length} elements; pick a unique one`;let o=n[0];if(xe(o))return"automations never touch password, masked or card fields";if(e.action==="fill"){if(typeof e.value!="string"||!e.value||e.value.length>200)return"fill needs a value (max 200 chars)";if(!o.matches(Rn))return"fill needs a text field"}return null}function Mn(e){if(e.matches("input,textarea,select")||xe(e))return;let t=(e.getAttribute("aria-label")??e.textContent??"").trim().replace(/\s+/g," ");return t?t.slice(0,80):void 0}function rt(e,t=ke,n=30){let o=0,r=i=>{let s=i.target;if(!(s instanceof Element)||i.composedPath().some(d=>d instanceof Element&&d.hasAttribute("data-lc-ignore"))||o>=n)return;o++;let a=s.closest("button,a,[role=button],input,select,textarea,label,[data-lc-id],[data-testid]")??s,u=Mn(a);e({selector:ee(a,t),url:location.pathname,...u?{text:u}:{}})};return document.addEventListener("click",r,!0),()=>document.removeEventListener("click",r,!0)}function it(e){let t={name:"Recorded tour",kind:"tour",steps:[]};for(let n of e)we(t,{title:n.text?`Click "${n.text}"`:"Next step",body:"Continue here.",selector:n.selector,url:n.url,advance:"click"});return t}var ke,Sn,Cn,An,Tn,Rn,He,ot,re=N(()=>{"use strict";de();Oe();ke=["data-lc-id","data-testid","data-test","data-cy","data-qa"],Sn=/^[A-Za-z_][\w-]*$/,Cn=new Set(["tooltip","modal","banner","announcement","hotspot","beacon","badge","slideout","inline"]),An=new Set(["tooltip","tour","hotspot","beacon","badge","inline"]),Tn={carousel:[1,10],form_validation:[1,30]},Rn="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";He=()=>({name:"",kind:"tooltip",steps:[]});ot=e=>({id:e.id??"preview",name:e.name,kind:e.kind,steps:e.steps,conditions:{}})});var In,ct,dt=N(()=>{"use strict";In={"https://capture.lucidace.com":"https://lucidace.com","https://capture.lucida.15-204-158-166.sslip.io":"https://lucida.15-204-158-166.sslip.io"},ct=e=>In[e.replace(/\/+$/,"")]??e});async function ut(e,t){try{let n=await e.fetch(`${Se(e)}/v1/toolbar/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({token:t,origin:location.origin})});if(!n.ok)return null;let o=await n.json();return{session_token:o.token,project_id:o.project_id,expires_at:o.expires_at,permissions:o.scopes}}catch{return null}}function pt(e,t){let n=`${Se(e)}/v1/projects/${encodeURIComponent(t.project_id)}`,o=async(i,s={})=>{try{let a=await e.fetch(n+i,{...s,credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":"application/json"}});return a.ok?await a.json():null}catch{return null}},r=(i,s)=>`url=${encodeURIComponent(i)}&viewport=${s}`;return{scopes:t.permissions??[],createAction:i=>o("/actions",{method:"POST",body:JSON.stringify(i)}),updateAction:(i,s)=>o(`/actions/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify(s)}),deleteAction:async i=>{try{return(await e.fetch(`${n}/actions/${encodeURIComponent(i)}`,{method:"DELETE",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`}})).ok}catch{return!1}},putActionScreenshot:async(i,s)=>{try{return(await e.fetch(`${n}/actions/${encodeURIComponent(i)}/screenshot`,{method:"PUT",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":"image/png"},body:s})).ok}catch{return!1}},listActions:()=>o("/actions?limit=200").then(i=>i?.data??[]),flags:()=>o("/flags?limit=200").then(i=>i?.data??[]),heat:(i,s,a)=>o(`/heatmaps?${r(i,s)}&type=${a}`),scroll:(i,s)=>o(`/heatmaps?${r(i,s)}&type=scroll`),confetti:(i,s,a)=>o(`/heatmaps/confetti?${r(i,s)}&breakdown=${encodeURIComponent(a)}`),elements:(i,s,a,u=!1)=>o(`/heatmaps/elements?${r(i,s)}&limit=50${u?"&key=href":""}${a?`&cursor=${encodeURIComponent(a)}`:""}`),listGuides:()=>o("/guides?limit=100").then(i=>i?.data??[]),createGuide:i=>o("/guides",{method:"POST",body:JSON.stringify(i)}),updateGuide:(i,s)=>o(`/guides/${encodeURIComponent(i)}`,{method:"PUT",body:JSON.stringify(s)}),draftGuide:i=>o("/guides/draft",{method:"POST",body:JSON.stringify(i)}),createTheme:i=>o("/guide-themes",{method:"POST",body:JSON.stringify(i)}),experiment:i=>o(`/experiments/${encodeURIComponent(i)}`),saveVariants:(i,s)=>o(`/experiments/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({variants:s})}),addGoal:(i,s)=>o(`/experiments/${encodeURIComponent(i)}/goals`,{method:"POST",body:JSON.stringify(s)}),uploadAsset:async i=>{try{let s=await e.fetch(`${n}/experiments/assets`,{method:"POST",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":i.type||"application/octet-stream"},body:i});return s.ok?(await s.json()).url:null}catch{return null}}}}function ft(e,t){let n=De();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(mt,JSON.stringify(n))}catch{}}function De(){try{return JSON.parse(localStorage.getItem(mt)??"{}")}catch{return{}}}var _e,Ie,se,ae,Se,mt,ie=N(()=>{"use strict";dt();_e="guides:write",Ie="experiments:write",se="__lc_edit",ae="__lc_toolbar",Se=e=>(e.config.uiHost??ct(e.config.apiHost??"")).replace(/\/+$/,"");mt="lc_flag_overrides"});function Ce(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var Ne=N(()=>{"use strict"});function ue(e){let t=e.trim();return t?/^data:/i.test(t)?Fn.test(t):/^(https?:)?\/\//i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t):!1}function Kn(e){let t=e.trim();return/^(https?:|mailto:|tel:)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)}function zn(e){for(let{name:t,value:n}of[...e.attributes]){let o=t.toLowerCase();(Bn.has(o)||o.startsWith("aria-")||o.startsWith("data-")&&!o.startsWith("data-lc"))&&(o!=="href"||Kn(n))&&(o!=="src"||ue(n))&&(o!=="srcset"||Wn(n))&&(o!=="style"||qn(n))||e.removeAttribute(t)}e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener noreferrer")}function vt(e){for(let t of[...e.childNodes]){if(t.nodeType===3)continue;if(t.nodeType!==1){t.remove();continue}let n=t,o=n.tagName.toUpperCase();if(Gn.has(o)){n.remove();continue}if(vt(n),!Un.has(o)){n.replaceWith(...n.childNodes);continue}zn(n)}}function yt(e){let t=document.createElement("template");return t.innerHTML=e,vt(t.content),document.importNode(t.content,!0)}var Gn,Un,Bn,Fn,Wn,qn,bt=N(()=>{"use strict";Gn=new Set(["SCRIPT","STYLE","IFRAME","FRAME","FRAMESET","OBJECT","EMBED","APPLET","TEMPLATE","NOSCRIPT","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","LINK","META","BASE","AUDIO","VIDEO","PORTAL"]),Un=new Set(["A","ABBR","B","BLOCKQUOTE","BR","BUTTON","CAPTION","CITE","CODE","DD","DEL","DETAILS","DIV","DL","DT","EM","FIGCAPTION","FIGURE","FOOTER","H1","H2","H3","H4","H5","H6","HEADER","HR","I","IMG","INS","KBD","LABEL","LI","MARK","NAV","OL","P","PICTURE","PRE","Q","S","SECTION","ARTICLE","ASIDE","SMALL","SOURCE","SPAN","STRONG","SUB","SUMMARY","SUP","TABLE","TBODY","TD","TFOOT","TH","THEAD","TIME","TR","U","UL"]),Bn=new Set(["class","id","title","alt","href","src","srcset","sizes","width","height","role","target","rel","colspan","rowspan","loading","decoding","lang","dir","style","datetime","media"]),Fn=/^data:image\/(png|jpe?g|gif|webp|avif);/i;Wn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??"")),qn=e=>!/url\s*\(|expression\s*\(|@import|behavior\s*:|javascript:/i.test(e)});function xt(e){let t=JSON.stringify(e),n=5381;for(let o=0;o<t.length;o++)n=(n<<5)+n+t.charCodeAt(o)|0;return`c${(n>>>0).toString(36)}`}function je(e,t){let n=e?.[pe];return Array.isArray(n)?n.filter(o=>!!o&&typeof o=="object"&&typeof o.type=="string"&&(typeof o.selector=="string"||Xn.has(o.type))&&(t===void 0||!o.url||t.includes(o.url))):[]}function Zn(e,t){let n=xt(t),o=(e.getAttribute(Te)??"").split(" ").filter(Boolean);if(o.includes(n)||!Yn.has(t.position)||typeof t.html!="string")return;let r=yt(t.html);for(let i of[...r.children])i.setAttribute(Ae,n);t.position==="before"?e.before(r):t.position==="after"?e.after(r):t.position==="prepend"?e.prepend(r):e.append(r),e.setAttribute(Te,[...o,n].join(" "))}function eo(e,t){let n=e.tagName.toUpperCase();if(!(typeof t.src!="string"||!ue(t.src))){if(n==="SOURCE"){e.setAttribute("srcset",t.src);return}n==="IMG"&&(e.setAttribute("src",t.src),t.srcset&&Qn(t.srcset)?e.setAttribute("srcset",t.srcset):e.removeAttribute("srcset"),typeof t.alt=="string"&&e.setAttribute("alt",t.alt))}}function to(e,t,n){let o=xt(e);if(n.querySelector(`[${Ae}="${o}"]`))return;let r;if(e.type==="css"){if(typeof e.css!="string")return;r=n.importNode(Ce(e.css,t.nonce),!0)}else{if(e.approved!==!0||!t.allowJs||typeof e.js!="string")return;r=n.createElement("script"),t.nonce&&r.setAttribute("nonce",t.nonce),r.textContent=e.js}r.setAttribute(Ae,o),n.head.append(r)}function no(e,t){let n=e;switch(t.type){case"text":e.textContent=t.value;break;case"attr":if(Jn.test(t.name)||typeof t.value=="string"&&/^(href|src|action|formaction)$/i.test(t.name)&&Vn.test(t.value))break;t.value===null?e.removeAttribute(t.name):e.setAttribute(t.name,t.value);break;case"style":for(let[o,r]of Object.entries(t.styles))n.style.setProperty(o,r);break;case"hide":n.style.setProperty("display","none","important");break;case"insert":Zn(e,t);break;case"image":eo(e,t);break;case"reorder":{let o=e.parentElement;if(!o)break;let r=[...o.children].filter(s=>s!==e),i=Math.max(0,Math.min(t.index,r.length));o.insertBefore(e,r[i]??null);break}}}function oe(e,t=document,n={}){let o=[];for(let r of e){if(n.requireApproval&&(r.type==="css"||r.type==="js"||r.type==="insert")&&r.approved!==!0)continue;if(r.type==="css"||r.type==="js"){let s=t.nodeType===9?t:t.ownerDocument;s?.head&&to(r,n,s);continue}let i;try{i=[...t.querySelectorAll(r.selector)]}catch{continue}i.length||o.push(r);for(let s of i)no(s,r)}return o}function kt(e=document){for(let t of[...e.querySelectorAll(`[${Ae}]`)])t.remove();for(let t of[...e.querySelectorAll(`[${Te}]`)])t.removeAttribute(Te)}var pe,Ae,Jn,Vn,Xn,Yn,Te,Qn,Re=N(()=>{"use strict";Ne();bt();pe="lc_changes",Ae="data-lc-change",Jn=/^on/i,Vn=/^\s*(javascript|data|vbscript):/i,Xn=new Set(["css","js"]),Yn=new Set(["before","after","prepend","append"]),Te="data-lc-inserted";Qn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??""))});function me(e=[],t=()=>!1,n={}){let o=[...e],r=[],i=[],s=new Map,a=new Set,u=l=>`${l.url??""}|${l.selector??""}|${l.type}|${l.type==="attr"?l.name:""}`,d=l=>{if(!l)return;let p=[];try{p=[...document.querySelectorAll(l)]}catch{return}for(let c of p)s.has(c)||s.set(c,{attrs:[...c.attributes].map(h=>[h.name,h.value]),kids:[...c.childNodes].map(h=>h.cloneNode(!0)),parent:c.parentNode,next:c.nextSibling})},y=()=>{kt();for(let[l,p]of s){for(let c of[...l.attributes])l.removeAttribute(c.name);for(let[c,h]of p.attrs)l.setAttribute(c,h);l.replaceChildren(...p.kids.map(c=>c.cloneNode(!0))),p.parent&&(p.next===null||p.next.parentNode===p.parent)&&p.parent.insertBefore(l,p.next)}oe(o,document,{...n,allowJs:!1});for(let l of a)l()},w=l=>{r.push(o),r.length>oo&&r.shift(),i.length=0,o=l},f=(l,p)=>{d(l);let c={...p,...l?{selector:l}:{},...t()?{url:location.pathname}:{}},h=o.filter(v=>u(v)!==u(c));h.push(c),w(h),oe([c],document,{...n,allowJs:!1});for(let v of a)v()},b=l=>l.parentElement?[...l.parentElement.children].indexOf(l):0;for(let l of e)d(l.selector);return{changes:()=>o,text:(l,p)=>f(F(l),{type:"text",value:p}),attr:(l,p,c)=>f(F(l),{type:"attr",name:p,value:c}),style:(l,p,c)=>{let h=F(l),v=o.find(E=>E.selector===h&&E.type==="style");f(h,{type:"style",styles:{...v?.type==="style"?v.styles:{},[p]:c}})},hide:l=>f(F(l),{type:"hide"}),move:(l,p)=>{let c=Math.max(0,Math.min(b(l)+p,(l.parentElement?.children.length??1)-1));f(F(l),{type:"reorder",index:c})},insert:(l,p,c)=>{d(F(l));let h={type:"insert",position:p,html:c,selector:F(l),...t()?{url:location.pathname}:{}};w([...o,h]),oe([h],document,n);for(let v of a)v()},image:(l,p,c)=>f(F(l),{type:"image",src:p,...c!==void 0?{alt:c}:{}}),css:l=>f(void 0,{type:"css",css:l}),js:l=>f(void 0,{type:"js",js:l}),canUndo:()=>r.length>0,canRedo:()=>i.length>0,undo:()=>{let l=r.pop();l&&(i.push(o),o=l,y())},redo:()=>{let l=i.pop();l&&(r.push(o),o=l,y())},remove:l=>{l<0||l>=o.length||(w(o.filter((p,c)=>c!==l)),y())},onChange:l=>(a.add(l),()=>{a.delete(l)}),toPayload:()=>({[pe]:[...o]})}}function wt(e,t=document){let n=o=>{let r=o.target;if(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName))||!(o.ctrlKey||o.metaKey))return;let i=o.key.toLowerCase();if(i==="z"&&!o.shiftKey)e().undo();else if(i==="z"&&o.shiftKey||i==="y")e().redo();else return;o.preventDefault()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)}var oo,Ge=N(()=>{"use strict";de();Re();oo=100});function uo(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function Fe(e,t){return!!e?.some(n=>{try{return new RegExp(uo(n),"i").test(t)}catch{return!1}})}var Lt=N(()=>{"use strict"});function It(e){let t,n,o=()=>{let s=n?.contentDocument;s&&oe([...e()],s,{allowJs:!1})},r=()=>{t?.remove(),t=n=void 0};return{open:s=>{let a=Me[s];if(!a)return r();if(!t){t=document.createElement("div"),t.setAttribute("data-lc-ignore",""),t.setAttribute("role","dialog"),t.setAttribute("aria-label","Device preview"),t.style.cssText="position:fixed;inset:0;z-index:2147483646;background:rgba(15,23,42,.6);display:flex;align-items:center;justify-content:center",n=document.createElement("iframe"),n.title="Variant preview",n.style.cssText="height:90vh;border:0;background:#fff;border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,.4)",n.onload=o,t.append(n),t.onclick=d=>d.target===t&&r(),document.body.append(t);let u=new URL(location.href);u.hash="lc-device-preview",n.src=u.toString()}n&&(n.style.width=`${a}px`,n.setAttribute("aria-label",`${s} preview, ${a} pixels wide`))},close:r,update:()=>{n?.contentWindow&&n.contentWindow.location.reload()},isOpen:()=>!!t}}var Me,Dt=N(()=>{"use strict";Re();Me={desktop:0,tablet:768,mobile:375}});function Nt(e=document){let t=[],n=new Set;for(let o of e.querySelectorAll(bo)){if(o.closest("[data-lc-ignore],[data-lc-change]"))continue;let r=ee(o);if(n.has(r))continue;n.add(r);let i=o.tagName.toLowerCase(),s=(i==="img"?o.getAttribute("alt")??"":o.textContent??"").replace(/\s+/g," ").trim().slice(0,160);if(t.push({selector:r,tag:i,text:s}),t.length>=xo)break}return t}var bo,xo,jt=N(()=>{"use strict";re();bo="h1,h2,h3,button,a,img,[role=button],section[id],header,nav,footer,form label,li",xo=150});var Ut={};ye(Ut,{experimentEditor:()=>ko,withChanges:()=>Gt});function Gt(e,t,n){return e.variants.map(o=>o.key===t?{...o,payload:{...o.payload,[pe]:n}}:o)}async function ko(e){let t=J("div");t.setAttribute("role","region"),t.setAttribute("aria-label","Experiment visual editor");let n=await e.api.experiment(e.experimentId);if(!n)return t.textContent="Could not load the experiment (check the toolbar scope and project).",t;let o=!!e.scopes?.includes(Ie),r=J("select");for(let x of n.variants)r.append(J("option",{value:x.key,textContent:x.key}));r.value=n.variants[1]?.key??n.variants[0]?.key??"";let i=J("input",{type:"checkbox"}),s=J("ul"),a=Q("Undo",()=>d.undo()),u=Q("Redo",()=>d.redo());a.setAttribute("aria-keyshortcuts","Control+Z Meta+Z"),u.setAttribute("aria-keyshortcuts","Control+Shift+Z Meta+Shift+Z");let d=me(),y=It(()=>d.changes()),w=()=>{},f=()=>{let x=n.variants.find(A=>A.key===r.value);w(),d=me(je(x?.payload),()=>i.checked),w=d.onChange(()=>(b(),y.update())),oe(je(x?.payload,location.href)),b()},b=()=>{s.replaceChildren(),d.changes().forEach((x,A)=>{let O=J("li",{textContent:`${x.type} ${x.selector??"(page)"}${x.url?` (on ${x.url})`:""} `});O.append(Q(`Remove change ${A+1}`,()=>d.remove(A))),s.append(O)}),a.disabled=!d.canUndo(),u.disabled=!d.canRedo()},l=wt(()=>d),p=J("select");for(let x of Object.keys(Me))p.append(J("option",{value:x,textContent:x==="desktop"?"Desktop (this window)":`${x} (${Me[x]}px)`}));p.onchange=()=>y.open(p.value);let c=(x,A,O)=>{let H=J("textarea",{rows:4,placeholder:O});H.style.cssText="width:100%;font:12px ui-monospace,monospace";let g=fe(x,H);return g.append(Q(`Set ${x.toLowerCase()}`,()=>H.value.trim()?d[A](H.value):e.note("Write some code first"))),g},h=J("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp"});h.style.display="none",h.onchange=async()=>{let x=e.picked(),A=h.files?.[0];if(h.value="",!x||!A)return;let O=await e.api.uploadAsset(A);O?d.image(x,O):e.note("Upload failed: PNG, JPEG, GIF or WebP up to 2 MiB, with the experiments:write scope")},r.onchange=()=>(e.note("Reload the page to see the other variant without this one's edits"),f());let v=x=>()=>{let A=e.picked();if(!A)return e.note("Inspect an element first");x(A),b()},E=(x,A,O)=>Q(x,v(H=>{let g=window.prompt(A);g!==null&&O(H,g)})),C=J("input",{placeholder:"Goal name"}),S=Q("Save variant",async()=>{let x=await e.api.saveVariants(n.id,Gt(n,r.value,[...d.changes()]));x&&(n.variants=x.variants),e.note(x?`Saved ${d.changes().length} change(s) to ${r.value}`:"Could not save: only draft experiments can change their variants")}),L=Q("Add click goal",v(async x=>{if(!C.value.trim())return e.note("Name the goal first");let A=x.textContent?.trim().slice(0,100),O=await e.api.addGoal(n.id,{name:C.value.trim(),selector:ee(x),...A?{text:A}:{},url:location.pathname});e.note(O?`Goal "${C.value}" added as a secondary metric`:"Could not add the goal")}));if(!o)for(let x of[S,L])x.disabled=!0,x.title=`Requires the ${Ie} toolbar scope`;return t.append(J("b",{textContent:`Experiment: ${n.name} (${n.status})`}),fe("Variant",r),fe("This page only",i),E("Text","New text",(x,A)=>d.text(x,A)),E("Style","CSS as property:value",(x,A)=>{let[O,...H]=A.split(":");O&&H.length&&d.style(x,O.trim(),H.join(":").trim())}),E("Attribute","name=value (empty value removes)",(x,A)=>{let[O,...H]=A.split("=");O&&d.attr(x,O.trim(),H.length&&H.join("=")!==""?H.join("="):null)}),Q("Hide",v(x=>d.hide(x))),Q("Move up",v(x=>d.move(x,-1))),Q("Move down",v(x=>d.move(x,1))),E("Insert HTML","position:html, position = before | after | prepend | append (scripts and handlers are removed)",(x,A)=>{let[O,...H]=A.split(":"),g=O?.trim();["before","after","prepend","append"].includes(g)&&H.length?d.insert(x,g,H.join(":")):e.note("Use position:html, for example after:<p>Free shipping</p>")}),E("Image URL","Image URL (https://...)",(x,A)=>d.image(x,A.trim())),Q("Upload image",v(()=>h.click())),h,c("Page CSS","css",".hero h1 { font-size: 3rem }"),c("Page JS","js","Runs only after approval and when the site sets visualChanges.allowCustomJs"),a,u,fe("Preview width",p),Q("Copy page outline for AI variants",()=>{let x=JSON.stringify(Nt());navigator.clipboard?.writeText(x).then(()=>e.note("Page outline copied: paste it under Generate variants with AI in the experiment page"),()=>e.note(x))}),s,S,fe("Goal",C),L),new MutationObserver((x,A)=>{t.isConnected?t.dataset.mounted="1":t.dataset.mounted&&(l(),y.close(),w(),A.disconnect())}).observe(document.body,{childList:!0,subtree:!0}),f(),t}var J,Q,fe,Bt=N(()=>{"use strict";Re();ie();Ge();Dt();re();jt();J=(e,t={})=>Object.assign(document.createElement(e),t),Q=(e,t)=>{let n=J("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n},fe=(e,t)=>{let n=J("label",{textContent:`${e} `});return n.style.display="block",n.append(t),n}});function Kt(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let i=0;i<e.count;i++){let s=$e("",()=>e.to(i),`Slide ${i+1} of ${e.count}`);s.setAttribute("role","tab"),s.setAttribute("aria-current",String(i===e.index)),n.append(s)}let o=document.createElement("div");o.className="cn";let r=e.index===e.count-1;return o.append(e.index>0?$e("Back",()=>e.to(e.index-1)):$e("Skip",e.dismiss),$e(r?"Done":"Next",()=>r?e.complete():e.to(e.index+1))),t.append(n,o),t}function Wt(e,t){let n,o=s=>{n=s.clientX},r=s=>{if(n===void 0)return;let a=s.clientX-n;n=void 0;let u=t();a<-40&&u.index<u.count-1?u.to(u.index+1):a>40&&u.index>0&&u.to(u.index-1)},i=s=>{let a=t();s.key==="ArrowRight"&&a.index<a.count-1?a.to(a.index+1):s.key==="ArrowLeft"&&a.index>0&&a.to(a.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",r),e.addEventListener("keydown",i),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",r),e.removeEventListener("keydown",i)}}var Ft,$e,qt=N(()=>{"use strict";Ft=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",$e=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o}});function _o(e,t=So()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function So(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function Jt(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return _o(e,t)?{...n,...e?.dark?.tokens}:n}function Vt(e,t){let n=o=>typeof o=="string"&&wo.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&Eo.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in zt&&(e.style.boxShadow=zt[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var wo,Eo,zt,Xt=N(()=>{"use strict";wo=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,Eo=/^[\w\s,'"-]{1,100}$/,zt={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"}});var tn={};ye(tn,{listed:()=>Zt,renderModule:()=>Ro,resetAssist:()=>Co,searchHref:()=>Qt});function R(e,t){let n=document.createElement(e);return t!==void 0&&(n.textContent=t),n}function Zt(e,t){return e.guide_ids?.length?e.guide_ids.flatMap(n=>t.find(o=>o.id===n)??[]):t.filter(n=>Yt.has(n.kind))}function Qt(e,t){if(!e.search_url||!t.trim())return null;try{let n=new URL(e.search_url.replace("{q}",encodeURIComponent(t.trim())));return n.protocol==="https:"?n.href:null}catch{return null}}function Ro(e,t){let n=R("section");if(n.setAttribute("aria-label",e.title??e.module??"Module"),n.append(R("h2",e.title??"")),e.body&&n.append(R("p",e.body)),e.module==="guides"){let o=R("ul");for(let r of Zt(e,t.library)){let i=R("button",r.name);i.type="button",i.onclick=()=>(t.opened(),t.launch(r.id));let s=R("li");s.append(i),o.append(s)}n.append(o.childElementCount?o:R("p","No guides yet."))}else if(e.module==="announcements"){let o=t.library.filter(i=>To.has(i.kind)&&i.steps[0]).sort((i,s)=>(s.published_at??"").localeCompare(i.published_at??"")),r=R("ul");for(let i of o.slice(0,10)){let s=R("li");s.append(R("strong",i.steps[0].title??i.name)),i.steps[0].body&&s.append(R("p",i.steps[0].body)),r.append(s)}n.append(r.childElementCount?r:R("p","Nothing new."))}else if(e.module==="search"){let o=R("form");o.setAttribute("role","search");let r=R("label","Search help"),i=R("input");i.type="search",r.append(i);let s=R("button","Search");s.type="submit";let a=R("ul");o.append(r,s,a);let u=R("div");u.setAttribute("aria-live","polite"),o.onsubmit=d=>{d.preventDefault(),t.opened();let y=i.value.trim(),w=y.toLowerCase();a.replaceChildren();let f=t.library.filter(l=>Yt.has(l.kind)&&w&&(l.name+" "+l.steps.map(p=>`${p.title??""} ${p.body??""}`).join(" ")).toLowerCase().includes(w)).slice(0,5);for(let l of f)a.append(en(l,t));u.replaceChildren(),t.assist&&!We&&y?Mo(y,f.length,t,u):t.assist?.searched({query:y,results:f.length,answered:!1});let b=Qt(e,i.value);b&&window.open(b,"_blank","noopener,noreferrer")},o.append(u),n.append(o)}return n}function en(e,t){let n=R("button",e.name);n.type="button",n.onclick=()=>t.launch(e.id);let o=R("li");return o.append(n),o}async function Mo(e,t,n,o){let r=n.assist;o.textContent="Finding an answer...";let i=await r.ask(e.slice(0,500));if(o.replaceChildren(),i==="unavailable"&&(We=!0),!i||i==="unavailable")return r.searched({query:e,results:t,answered:!1});let s=!!i.answer.trim();if(r.searched({query:e,results:t,answered:s}),!s)return;o.append(R("h3","Answer"),R("p",i.answer));let a=R("ul");for(let w of(i.citations??[]).slice(0,5)){let f=Ao(w.url);if(!f)continue;let b=R("a",w.title||f);Object.assign(b,{href:f,target:"_blank",rel:"noopener noreferrer"});let l=R("li");l.append(b),a.append(l)}a.childElementCount&&o.append(R("p","Sources"),a);let u=R("ul");for(let w of(i.guide_ids??[]).slice(0,3)){let f=n.library.find(b=>b.id===w);f&&u.append(en(f,n))}u.childElementCount&&o.append(R("p","Suggested guides"),u);let d=R("div"),y=(w,f)=>{let b=R("button",w);return b.type="button",b.onclick=()=>{r.searched({query:e,results:t,answered:s,feedback:f}),d.replaceChildren(R("p","Thanks for the feedback."))},b};d.append(y("Helpful","up"),y("Not helpful","down")),o.append(d)}var We,Co,Ao,Yt,To,nn=N(()=>{"use strict";We=!1,Co=()=>{We=!1},Ao=e=>{try{let t=new URL(e);return t.protocol==="https:"?t.href:null}catch{return null}},Yt=new Set(["tour","checklist","modal","slideout"]),To=new Set(["announcement","banner"])});function $o(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let r=n?[]:[{label:"Back",action:"back"}];return o||r.push({label:t?"Done":"Next",action:"next"}),[...r,{label:"Dismiss",action:"dismiss"}]}function Lo(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}function z(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Do(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(z("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(z("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!Po.includes(t.host))return null;let n=Object.assign(z("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function No(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let r=[...e.querySelectorAll(Io)];if(!r.length)return;let i=r[0],s=r[r.length-1],a=t.activeElement;o.shiftKey&&a===i?(o.preventDefault(),s.focus()):!o.shiftKey&&a===s&&(o.preventDefault(),i.focus())})}function jo(e,t,n="bottom"){let o=t.getBoundingClientRect(),r=e.offsetWidth||280,i=e.offsetHeight||120,s=o.left,a=o.bottom+8;n==="top"?a=o.top-i-8:n==="left"?(s=o.left-r-8,a=o.top):n==="right"&&(s=o.right+8,a=o.top);let u=(d,y)=>Math.max(8,Math.min(d,y-8));e.style.left=`${u(s,window.innerWidth-r)}px`,e.style.top=`${u(a,window.innerHeight-i)}px`}function on(e,t,n,o={}){let r=document.createElement("div");r.setAttribute("data-lc-ignore","");let i=r.attachShadow({mode:"open"});i.append(Ce(Ho,o.nonce));let s=document.activeElement,a=Math.min(Math.max(o.start??0,0),e.steps.length-1),u=!1,d,y=[],w=[],f=()=>{for(let m of w)m();w=[]},b=()=>{},l=z("div",void 0,"g"),p=()=>{u||(u=!0,f(),b(),r.remove(),s?.focus?.(),n())},c=m=>{t.dismissed(a,e.steps[a]?.id??"",m),p()},h=()=>c(),v=()=>{t.completed(),p(),e.steps.at(-1)?.confetti&&et()},E=m=>(o.resolveTarget??Lo)(m),C=m=>{let M=m?.goto?void 0:e.steps[a]?.branch?.find(W=>Ze(W,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),U=m?.goto??M?.goto,$=U==="end"?e.steps.length:U?e.steps.findIndex(W=>W.id===U):-1;y.push(a),a=$>a?$:a+1,S()},S=()=>{let m=e.steps[a];if(!m)return v();if(t.progress?.(m.id),m.url&&!location.href.includes(m.url))return p();j()},L=m=>{m<0||m>=e.steps.length||m===a||(a=m,S())},x=()=>{let m=y.pop();m!==void 0&&(a=m,S())},A=m=>{if(m.action==="next"||m.action==="start_tour")C(m);else if(m.action==="back")x();else if(m.action==="dismiss")h();else if(m.action==="snooze"){let M=Math.min(Math.max(Math.round(m.snooze_hours??24),1),720);t.snoozed?.(e.steps[a]?.id??"",M),c("snooze")}else m.action==="link"&&m.url&&/^https?:\/\//i.test(m.url)?window.open(m.url,"_blank","noopener,noreferrer"):m.action==="event"&&m.event&&t.event(m.event)},O=(m,M)=>{let U=z("div"),$=m.buttons?.length?m.buttons:$o(e.kind,M,y.length===0,m.advance==="click"||m.advance==="input");for(let W of $){let X=z("button",W.label);X.type="button",X.onclick=()=>A(W),U.append(X)}return U},H=m=>[...m.title?[z("h2",m.title)]:[],...m.body?[z("p",m.body)]:[],...(m.media??[]).flatMap(M=>Do(M)??[])],g=new Set(o.checked),G=new Map;function V(m,M,U){let $=G.get(M.id);$&&!$.hasAttribute("data-done")&&($.setAttribute("data-done",""),$.setAttribute("aria-pressed","true"),$.textContent=`\u2713 ${M.title??M.id}`),!(!U||g.has(M.id)&&$?.hasAttribute("data-reported"))&&($?.setAttribute("data-reported",""),g.add(M.id),t.step(m,M.id),g.size>=e.steps.length&&v())}let _=()=>{let m=z("ul");for(let[U,$]of e.steps.entries()){let W=z("li"),X=z("button",`${$.title??$.id}`);if(X.type="button",X.setAttribute("aria-pressed","false"),G.set($.id,X),g.has($.id)&&(V(U,$,!1),X.setAttribute("data-reported","")),X.onclick=()=>{if(e.kind==="checklist")V(U,$,!0);else if(e.kind==="resource_center"){t.step(U,$.id);let K=$.buttons?.find(q=>q.action==="link");K&&A(K)}},$.module){let K={library:o.library??[],launch:q=>(p(),o.launch?.(q)),opened:()=>t.step(U,$.id),...o.assist?{assist:o.assist}:{}};Promise.resolve().then(()=>(nn(),tn)).then(q=>W.append(q.renderModule($,K))),m.append(W);continue}W.append(X),$.body&&W.append(z("p",$.body)),m.append(W)}l.append(z("h2",e.name),m);let M=z("button",e.kind==="resource_center"?"Close":"Dismiss");M.type="button",M.onclick=h,l.append(M)};function j(){f(),l.replaceChildren(),l.style.visibility="";let m=e.steps[a];if(!m)return;let M=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")_();else{let K={index:a,count:e.steps.length,to:L,complete:v,dismiss:h};l.append(...H(m),M?Kt(K):O(m,a===e.steps.length-1)),t.step(a,m.id)}l.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),l.setAttribute("aria-label",m?.title??e.name),M&&l.setAttribute("aria-roledescription","carousel");let U={modal:"m",carousel:"m",banner:`bn${m.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(l.className=`g ${U[e.kind]??"p"}`,Vt(l,Jt(e.appearance)),(e.kind==="modal"||M)&&l.setAttribute("aria-modal","true"),M&&w.push(Wt(l,()=>({index:a,count:e.steps.length,to:L,complete:v,dismiss:h}))),m.auto_close_s&&m.auto_close_s>0){let K=setTimeout(()=>c("auto_close"),Math.min(m.auto_close_s,600)*1e3);w.push(()=>clearTimeout(K))}if(m.automation&&o.automate!==!1){let K=m.automation,q=setTimeout(()=>t.automated?.(m.id,Qe(K)));w.push(()=>clearTimeout(q))}let $=(e.kind==="tooltip"||e.kind==="tour")&&!!(m.selector||m.fallback_selectors?.length),W=K=>{l.style.visibility="",l.classList.remove("p"),jo(l,K,m.placement);let q=m.advance==="click"?"click":m.advance==="input"?"change":null;if(!q)return;let ce=()=>C();K.addEventListener(q,ce,{once:!0}),w.push(()=>K.removeEventListener(q,ce))},X=$?E(m):null;if(X)W(X);else if($){l.style.visibility="hidden";let K=Date.now()+Math.min(Math.max(m.wait_ms??3e3,0),15e3),q=setInterval(()=>{let ce=E(m);ce?(clearInterval(q),W(ce)):Date.now()>=K&&(clearInterval(q),l.style.visibility="",t.targetMissing?.(m.id,m.selector??m.fallback_selectors?.[0]??""))},150);w.push(()=>clearInterval(q))}e.kind!=="inline"&&l.querySelector("button")?.focus()}No(l,i,h);let D=e.kind==="modal"||e.kind==="carousel",B=e.appearance?.dismiss_on_outside_click??D;if(e.appearance?.overlay??D)d=z("div",void 0,"o"),B&&(d.onclick=h),i.append(d);else if(B&&e.kind!=="inline"){let m=U=>{U.composedPath().includes(r)||h()},M=setTimeout(()=>document.addEventListener("click",m,!0));b=()=>(clearTimeout(M),document.removeEventListener("click",m,!0))}i.append(l);let ne=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return ne?ne.after(r):document.body.append(r),t.shown(),j(),Object.assign(p,{markDone(m){let M=e.steps.findIndex(U=>U.id===m);e.kind==="checklist"&&M>=0&&!u&&V(M,e.steps[M],!0)}})}var Oo,Ho,Po,Io,rn=N(()=>{"use strict";Ne();qt();Oe();Xt();Oo=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",Ho=Oo+Ft,Po=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],Io="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])"});function ge(e){let t=e.trim().toLowerCase();if(/^#([0-9a-f]{6})$/.test(t))return t;if(/^#([0-9a-f]{3})$/.test(t))return`#${[...t.slice(1)].map(i=>i+i).join("")}`;let n=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(t);if(!n)return null;let o=n[4];return(o===void 0?1:o.endsWith("%")?parseFloat(o)/100:parseFloat(o))<.5?null:`#${[n[1],n[2],n[3]].map(i=>Math.min(255,Number(i)).toString(16).padStart(2,"0")).join("")}`}function Uo(e){let t=["button[type=submit]","[class*=primary]","button","a[class*=btn]","[role=button]"];for(let n of t)for(let o of e.querySelectorAll(n)){if(o.closest("[data-lc-ignore]"))continue;let r=o.getBoundingClientRect();if(r.width>0&&r.height>0&&ge(getComputedStyle(o).backgroundColor))return o}return null}function sn(e=document){let t=getComputedStyle(e.body),n=getComputedStyle(e.documentElement),o={},r=ge(t.backgroundColor)??ge(n.backgroundColor);r&&(o.background=r);let i=ge(t.color);i&&(o.text=i);let s=Uo(e),a={name:`${e.title||location.hostname} theme`.slice(0,100),tokens:o};if(s){let d=getComputedStyle(s),y=ge(d.backgroundColor);y&&y!==r&&(o.accent=y);let w=Math.round(parseFloat(d.borderTopLeftRadius));Number.isFinite(w)&&w>=0&&(o.radius=Math.min(w,32),a.radius=o.radius)}let u=t.fontFamily.trim();return u&&Go.test(u)&&(a.font_family=u),a}var Go,an=N(()=>{"use strict";Go=/^[\w\s,'"-]{1,100}$/});async function ln(e,t){let n=await e.draftGuide(t);return n&&Array.isArray(n.steps)?{name:n.name,kind:n.kind,steps:n.steps,...n.targeting?{targeting:n.targeting}:{}}:t.recorded_steps?.length?it(t.recorded_steps):null}function cn(e){let t=he("div"),n=()=>{try{return JSON.parse(sessionStorage.getItem(qe)??"null")}catch{return null}},o=f=>{try{f?sessionStorage.setItem(qe,JSON.stringify(f)):sessionStorage.removeItem(qe)}catch{}},r=[],i,s=he("div"),a=f=>{r=f,o(r),i=rt(b=>{if(!t.isConnected)return i?.(),void(i=void 0);r.push(b),o(r),s.textContent=`Recording: ${r.length} step${r.length===1?"":"s"} (${b.selector})`},e.attrs,30-f.length),u.textContent="Stop and draft"},u=ze("Record clicks",async()=>{if(!i)return a([]),e.note("Click through the flow; each click becomes a tour step");if(i(),i=void 0,o(null),u.textContent="Record clicks",!r.length)return e.note("Nothing recorded");e.note("Drafting copy...");let f=await ln(e.api,{recorded_steps:r});f&&(e.load(f),e.note(`Draft with ${f.steps.length} steps loaded; review, then save`))}),d=n();d&&e.canWrite&&a(d);let y=ze("Draft from prompt",async()=>{let f=window.prompt("Describe the guide (who, what, where)");if(!f?.trim())return;e.note("Drafting...");let b=await ln(e.api,{prompt:f.trim().slice(0,2e3)});b?(e.load(b),e.note("Draft loaded; review, then save")):e.note("Could not draft a guide right now")}),w=ze("Derive theme from this page",async()=>{let f=sn(),b=JSON.stringify({tokens:f.tokens,font_family:f.font_family});if(!e.canWrite)return e.note(`Derived ${b}. Saving themes requires the guides:write scope.`);let l=window.prompt("Theme name",f.name);if(!l?.trim())return;let p=await e.api.createTheme({name:l.trim().slice(0,100),tokens:f.tokens,...f.font_family?{font_family:f.font_family}:{},...f.radius!==void 0?{radius:f.radius}:{}});e.note(p?`Theme "${p.name}" saved (${p.id}): pick it in a guide's appearance`:`Could not save the theme. Derived ${b}`)});if(!e.canWrite)for(let f of[u,y])f.disabled=!0,f.title="Requires the guides:write toolbar scope";return t.append(he("b",{textContent:"AI and themes"}),he("br"),u,y,w,s),{node:t,teardown:()=>i?.()}}var qe,he,ze,dn=N(()=>{"use strict";re();an();qe="lc_toolbar_recording",he=(e,t={})=>Object.assign(document.createElement(e),t),ze=(e,t)=>{let n=he("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n}});var un={};ye(un,{guideBuilder:()=>Ko});function Ko(e){let t=I("div"),n=He(),o,r=!!e.scopes?.includes(_e),i=cn({api:e.api,canWrite:r,note:e.note,load:g=>O(g),...e.attrs?{attrs:e.attrs}:{}}),s=I("input",{placeholder:"Guide name"}),a=I("select");for(let g of Bo)a.append(I("option",{value:g,textContent:g}));let u=I("input",{placeholder:"Step title"}),d=I("textarea",{placeholder:"Step body",rows:2}),y=I("input",{placeholder:"Image URL (https, optional)"}),w=I("input",{placeholder:"Image description (alt text)"});for(let g of[s,u,d,y,w])g.setAttribute("aria-label",g.placeholder);let f=I("select");for(let g of["bottom","top","left","right"])f.append(I("option",{value:g,textContent:g}));let b=I("select");for(let g of["","click","focus","fill"])b.append(I("option",{value:g,textContent:g?`Automation: ${g}`:"No automation"}));let l=I("input",{placeholder:"Fill value (constant)"}),p="",c=I("select");for(let g of Fo)c.append(I("option",{value:g,textContent:`Rule: ${g}`}));let h=I("input",{placeholder:"Rule value (regex / length)"}),v=I("input",{placeholder:"Message shown on a bad value"});for(let g of[l,h,v])g.setAttribute("aria-label",g.placeholder);let E=I("div"),C=I("div");C.style.whiteSpace="pre-wrap";let S="",L=()=>{E.textContent=S?`Element: ${S}`:"No element picked",C.textContent=n.steps.map((g,G)=>`${G+1}. ${g.title??g.body??g.id}${g.selector?` @ ${g.selector}`:""}`).join(`
2
+ `)},x=()=>{n.name=s.value,n.kind=a.value},A=()=>{x(),o?.();let g=ot(n);if(!g.steps.length)return e.note("Add a step first");o=on(g,{shown(){},step(){},completed(){},dismissed(){},event(){}},()=>o=void 0)},O=g=>{n={...g.id?{id:g.id}:{},name:g.name,kind:g.kind,steps:g.steps,..."targeting"in g&&g.targeting?{targeting:g.targeting}:{}},s.value=g.name,a.value=g.kind,L()},H=te("Save guide",async()=>{x();let g=tt(n);if(g)return e.note(g);let G=nt(n,location.pathname),V=n.id?await e.api.updateGuide(n.id,G):await e.api.createGuide(G);V&&(n.id=V.id),e.note(V?`Guide saved (${V.id}), start it from the app`:"Could not save guide")});return r||(H.disabled=!0,H.title=`Requires the ${_e} toolbar scope`),t.append(I("b",{textContent:"Guide builder"}),I("br"),s,a,te("Pick element",()=>{let g=e.picked();S=g?ee(g,e.attrs):"",L(),g||e.note("Use Inspect element first, then Pick element")}),E,u,d,y,w,f,b,te("Pick automation target",()=>{let g=e.picked();p=g?ee(g,e.attrs):"",e.note(g?`Automation target ${p}`:"Use Inspect element first")}),l,te("Check automation",()=>{let g=b.value;if(!g)return e.note("Choose an automation action first");e.note(Ee({action:g,selector:p,...l.value?{value:l.value}:{}})??"The automation target is valid on this page")}),c,h,v,te("Add step",()=>{x();let g=b.value&&p?{action:b.value,selector:p,...b.value==="fill"?{value:l.value}:{}}:void 0;if(g){let G=Ee(g);if(G)return e.note(G)}if(n.kind==="form_validation"){if(!S||!v.value.trim())return e.note("Pick the field and write the message");let G=c.value==="min_length"||c.value==="max_length"?Number(h.value):h.value;return we(n,{title:u.value||"Field check",validation:{selector:S,rules:[{type:c.value,message:v.value.trim().slice(0,200),...h.value?{value:G}:{}}]}}),S=h.value=v.value=u.value="",L()}we(n,{...g?{automation:g}:{},...u.value?{title:u.value}:{},...d.value?{body:d.value}:{},...S?{selector:S,placement:f.value}:{},...y.value.startsWith("https://")&&w.value.trim()?{media:[{type:"image",url:y.value,alt:w.value.trim()}]}:{}}),u.value=d.value=y.value=w.value=l.value="",S=p="",b.value="",L()}),te("Remove last",()=>(n.steps.pop(),L())),C,te("Preview",A),te("Close preview",()=>o?.()),H,te("Load existing",async()=>{let g=await e.api.listGuides(),G=g.find(V=>V.name===s.value)??g[0];G?O(G):e.note("No guides yet")}),te("New",()=>(n=He(),s.value="",L())),I("div",{textContent:r?"":`Saving requires the ${_e} scope on the toolbar token.`}),i.node),L(),t}var Bo,Fo,I,te,pn=N(()=>{"use strict";rn();ie();re();dn();Bo=["tooltip","modal","banner","tour","checklist","resource_center","announcement","hotspot","beacon","badge","launcher","slideout","inline","carousel","form_validation"],Fo=["required","email","url","phone","regex","min_length","max_length","number"],I=(e,t={})=>Object.assign(document.createElement(e),t),te=(e,t)=>{let n=I("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n}});var hn={};ye(hn,{CHECK_MESSAGE:()=>mn,CHECK_PARAM:()=>Wo,describeResult:()=>gn,parseCheck:()=>qo,resolveSteps:()=>fn,runCheck:()=>Jo});function qo(e){if(!e||e.length>2e4)return null;try{let t=JSON.parse(e),n=typeof t.origin=="string"?new URL(t.origin).origin:"";if(!/^https?:\/\//.test(n)||!Array.isArray(t.steps))return null;let o=t.steps.filter(r=>r&&typeof r.step=="number"&&Array.isArray(r.selectors)).slice(0,50).map(r=>({step:r.step,...typeof r.url=="string"&&r.url?{url:r.url}:{},selectors:r.selectors.filter(i=>typeof i=="string"&&i.trim()).slice(0,10)}));return{origin:n,steps:o}}catch{return null}}function fn(e,t=location.href){return e.steps.map(n=>{let o=[],r=null;for(let i of n.selectors)try{let s=Array.from(document.querySelectorAll(i));s.length&&!r&&(r={selector:i,els:s})}catch{o.push(i)}return{step:n.step,selector:r?.selector??null,matches:r?.els.length??0,visible:!!r?.els.some(zo),onPage:!n.url||t.includes(n.url),invalid:o}})}async function Jo(e,t,n=1500){t("Checking guide selectors on this page..."),await new Promise(r=>setTimeout(r,n));let o=fn(e);t(o.map(gn).join(`
3
+ `)||"The guide has no anchored steps");try{window.opener?.postMessage({type:mn,url:location.href,results:o},e.origin)}catch{}return o}var Wo,mn,zo,gn,vn=N(()=>{"use strict";Wo="__lc_check",mn="lc:guide-check";zo=e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0};gn=e=>`Step ${e.step}: ${e.onPage?e.selector?`${e.selector} - ${e.matches} match${e.matches===1?"":"es"}${e.visible?"":" (hidden)"}`:"no selector matched":"on another page"}${e.invalid.length?`; invalid: ${e.invalid.join(", ")}`:""}`});de();var T=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&(o.title=n),o.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",o.onclick=t,o},k=(e,t,n)=>{let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.style.cssText=n),o},P=(e,t)=>{let n=k("label",void 0,"display:block;margin:2px 0");return n.append(`${e} `,t),n},Y=(e="",t="")=>{let n=k("input",void 0,"font:12px system-ui;width:150px");return n.value=e,n.placeholder=t,n},Z=(e,t)=>{let n=k("select",void 0,"font:12px system-ui");for(let[o,r]of e)n.append(Object.assign(k("option",r),{value:o}));return t!==void 0&&(n.value=t),n};function be(e,t,n="#4af"){let o=k("div",void 0,`position:absolute;left:${e.left+scrollX}px;top:${e.top+scrollY}px;width:${e.width}px;height:${e.height}px;border:2px solid ${n};box-sizing:border-box;z-index:2147483646;pointer-events:none`);o.setAttribute("data-lc-ignore","");let r=k("span",t,`position:absolute;left:-2px;top:-18px;background:${n};color:#000;font:bold 11px system-ui;padding:1px 4px;border-radius:3px;white-space:nowrap`);return o.append(r),o}re();function $n(e){let t=e.cloneNode(!0),n=[e,...e.querySelectorAll("*")],o=[t,...t.querySelectorAll("*")];n.forEach((r,i)=>{let s=o[i];if(!s)return;let a=getComputedStyle(r),u="";for(let d=0;d<a.length;d++){let y=a.item(d);u+=`${y}:${a.getPropertyValue(y)};`}if(s.setAttribute("style",u),(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&(s.removeAttribute("value"),s.textContent=""),s instanceof HTMLSelectElement)for(let d of s.querySelectorAll("option"))d.removeAttribute("selected");s.hasAttribute("data-lc-mask")&&(s.textContent="\u2022\u2022\u2022"),s.removeAttribute("id");for(let d of[...s.attributes])d.name.startsWith("on")&&s.removeAttribute(d.name)});for(let r of t.querySelectorAll("script"))r.remove();return new XMLSerializer().serializeToString(t)}function Ln(e,t,n){return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${e}</div></foreignObject></svg>`}async function st(e){let t=e.getBoundingClientRect(),n=Math.max(1,Math.ceil(t.width)),o=Math.max(1,Math.ceil(t.height)),r=Math.min(1,640/Math.max(n,o));if(typeof URL.createObjectURL!="function")return null;let i=URL.createObjectURL(new Blob([Ln($n(e),n,o)],{type:"image/svg+xml"}));try{let s=new Image;await new Promise((d,y)=>{s.onload=()=>d(),s.onerror=()=>y(new Error("render")),s.src=i});let a=document.createElement("canvas");a.width=Math.round(n*r),a.height=Math.round(o*r);let u=a.getContext("2d");return u?(u.drawImage(s,0,0,a.width,a.height),await new Promise(d=>a.toBlob(d,"image/png"))):null}catch{return null}finally{URL.revokeObjectURL(i)}}var On=100;function Pe(e,t,n=location.pathname){let o=e.textContent?.trim().replace(/\s+/g," ")??"",r=e.closest("a")?.getAttribute("href");return{selector:ee(e,t),...o&&o.length<=On?{text:o,text_match:"exact"}:{},...r?{href:r,href_match:"exact"}:{},url:n,url_match:"contains"}}var at=(e,t,n="exact")=>t===void 0||e!=null&&(n==="exact"?e.trim()===t:e.includes(t));function Hn(e,t=location.href){if(e.url===void 0)return!0;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return e.url_match==="exact"?t===e.url||new URL(t).pathname===e.url:t.includes(e.url)}function Pn(e,t=document,n=location.href){if(!Hn(e,n)||!e.selector&&e.text===void 0&&e.href===void 0)return[];let o;try{o=Array.from(t.querySelectorAll(e.selector??(e.href!==void 0?"a":"*")))}catch{return[]}return o.filter(r=>!r.closest("[data-lc-ignore]")&&at(r.textContent,e.text,e.text_match)&&at(r.closest("a")?.getAttribute("href"),e.href,e.href_match))}function lt(e){let t=k("div"),n=Y("","Action name"),o=k("div"),r=[],i,s,a=[],u=k("div"),d=(c,h,v)=>{let E=Y(c[h]??"");return E.oninput=()=>{E.value?c[h]=E.value:delete c[h]},P(v,E)},y=(c,h,v,E)=>{let C=Z(E.map(S=>[S,S]),c[h]??E[0]);return C.onchange=()=>{c[h]=C.value},P(v,C)},w=()=>{o.replaceChildren(...r.map((c,h)=>{let v=k("fieldset",void 0,"border:1px solid #444;margin:4px 0;padding:4px");return v.append(k("legend",h===0?"Element 1":`OR element ${h+1}`),d(c,"selector","Selector"),d(c,"text","Text"),y(c,"text_match","Text match",["exact","contains"]),d(c,"href","Link target"),y(c,"href_match","Link match",["exact","contains"]),d(c,"url","Page URL"),y(c,"url_match","Page match",["contains","exact","regex"]),T("Remove element",()=>(r.splice(h,1),w()))),v}))},f=()=>{r=[],i=void 0,s=void 0,n.value="",w()},b=()=>{for(let c of a)c.remove();a=[]},l=async()=>{b();let c=await e.api.listActions(),h=0;u.replaceChildren(...c.map(v=>{let E=[...new Set((Array.isArray(v.steps)?v.steps:[]).flatMap(S=>Pn(S)))];for(let S of E){h+=1;let L=be(S.getBoundingClientRect(),`${h} ${v.name}`,"#fc4");document.body.append(L),a.push(L)}let C=k("div",`${v.name} (${E.length} on this page)`,"margin:2px 0");return C.append(T("Edit",()=>{i=v.id,n.value=v.name,r=(v.steps??[]).map(S=>({...S})),w(),e.note(`Editing ${v.name}`)}),T("Delete",async()=>{window.confirm(`Delete action ${v.name}?`)&&(e.note(await e.api.deleteAction(v.id)?`Deleted ${v.name}`:"Could not delete"),l())})),C})),u.prepend(k("b",`${h} matched element${h===1?"":"s"} on this page`))};return t.append(k("b","Actions"),P("Name",n),T("Add picked element",()=>{let c=e.picked();if(!c)return e.note("Inspect an element first");r.push(Pe(c,e.attrs)),s??=c,w()}),o,T("Save action",async()=>{if(!n.value.trim()||!r.length)return e.note("Name the action and add at least one element");let c={name:n.value.trim(),steps:r},h=i?await e.api.updateAction(i,c):await e.api.createAction(c);if(e.note(h?`Action ${h.name??c.name} saved`:"Could not save the action"),h&&s){let v=await st(s);v&&!await e.api.putActionScreenshot(h.id,v)&&e.note(`Action ${h.name??c.name} saved, screenshot not stored`)}h&&f()}),T("New action",f),T("Show existing actions",()=>{l()}),T("Hide action boxes",()=>(b(),u.replaceChildren())),u),{node:t,teardown:b,addStep:c=>{r.push(c),w()}}}ie();var gt=500,Dn=new Set(["$snapshot","$replay_tag","$rageclick","$deadclick","$heatmap_moves","$attention"]),Nn=e=>Dn.has(e)?"replay":e.startsWith("$")?"system":"custom";function jn(e){let t=/^\/(.+)\/([a-z]*)$/.exec(e.trim());if(t)try{let o=new RegExp(t[1],t[2]);return r=>o.test(r)}catch{return()=>!1}let n=e.trim().toLowerCase();return o=>!n||o.toLowerCase().includes(n)}function ht(e){let t=k("div"),n=Y("","name, payload or /regex/"),o=Z([["all","All events"],["custom","Custom"],["system","System ($)"],["replay","Replay and heatmap"]]),r=Object.assign(k("input"),{type:"checkbox"}),i=Object.assign(k("input"),{type:"checkbox"}),s=k("div"),a=k("div",void 0,"max-height:240px;overflow:auto"),u=[],d=[],y=!0,w=Date.now(),f=()=>{let l=jn(n.value),p=u.filter(c=>c.pinned||(o.value==="all"||Nn(c.e.event)===o.value)&&l(`${c.e.event} ${JSON.stringify(c.e.properties??{})}`)).sort((c,h)=>Number(h.pinned)-Number(c.pinned)||h.at-c.at);s.textContent=`${p.length} of ${u.length} events${d.length?`, ${d.length} held while paused`:""}`,a.replaceChildren(...p.map(c=>{let h=k("details",void 0,"border-top:1px solid #333;padding:2px 0"),v=i.checked?`+${((c.at-w)/1e3).toFixed(1)}s`:new Date(c.at).toLocaleTimeString(),E=k("summary",`${c.pinned?"[pinned] ":""}${v} ${c.e.event}`),C=JSON.stringify(c.e,null,1);return h.append(E,T(c.pinned?"Unpin":"Pin",()=>(c.pinned=!c.pinned,f())),T("Copy",()=>{navigator.clipboard?.writeText(C)}),k("pre",C,"white-space:pre-wrap;max-height:160px;overflow:auto;margin:0")),h}))};e.onCapture(l=>{if(!y)return;let p={e:l,at:Date.now(),pinned:!1};r.checked?d.push(p):u.push(p),u.length>gt&&(u=u.filter((c,h)=>c.pinned||h>=u.length-gt)),f()}),r.onchange=()=>{r.checked||u.push(...d.splice(0)),f()},n.oninput=o.onchange=i.onchange=f;let b=()=>{let l=new Blob([JSON.stringify(u.map(c=>c.e),null,1)],{type:"application/json"}),p=Object.assign(k("a"),{href:URL.createObjectURL(l),download:`lucida-events-${w}.json`});p.click(),URL.revokeObjectURL(p.href)};return t.append(k("b","Event debugger"),P("Search",n),P("Category",o),P("Pause",r),P("Relative time",i),T("Clear",()=>(u=u.filter(l=>l.pinned),d=[],f())),T("Export JSON",b),s,a),f(),{node:t,teardown:()=>{y=!1}}}Ge();ie();var Ue="__default";function ro(e,t){let n=e?.variants?.map(r=>r.key)??[],o=n.length?n:typeof t=="string"?[t]:[];return[[Ue,"(no override)"],["true","on"],["false","off"],...o.map(r=>[`v:${r}`,r])]}var io=e=>e===void 0?Ue:typeof e=="boolean"?String(e):`v:${e}`,so=e=>e===Ue?null:e==="true"?!0:e==="false"?!1:e.slice(2);function Et(e,t){let n=k("div"),o=Y("","Search flags"),r=k("div"),i=k("div"),s={},a=[],u=()=>{let y=De(),w=o.value.trim().toLowerCase(),f=[...new Set([...a.map(b=>b.key),...Object.keys(s)])].filter(b=>!w||b.toLowerCase().includes(w)).sort();r.replaceChildren(...f.map(b=>{let l=Z(ro(a.find(c=>c.key===b),y[b]??s[b]),io(y[b]));return l.onchange=()=>{ft(b,so(l.value)),i.replaceChildren(k("span","Overrides apply on the next page load. "),T("Reload now",()=>location.reload())),u()},P(`${b} = ${String(y[b]??s[b]??"-")}${b in y?" (override)":""}`,l)})),f.length||r.append(k("div",w?"No flag matches":"No flags"))};o.oninput=u;let d=e.client.onFlags(y=>{s=y,u()});return t.flags().then(y=>{a=y,u()}),n.append(k("b","Feature flags (this browser)"),P("Search",o),r,i),{node:n,teardown:d}}re();function _t(e){return e<768?"mobile":e<1024?"tablet":"desktop"}var St=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#17becf","#bcbd22","#3b4cc0","#f4a582","#006d2c"],Ct=(e,t)=>t[e]?.value==="(other)"?"#9e9e9e":St[e%St.length]??"#9e9e9e",At=[["","Heat (no breakdown)"],["channel","Channel"],["referrer","Referrer"],["device","Device"],["country","Country"],["browser","Browser"],["os","OS"],["visitor","New vs returning"],["event","Event property"],["person","Person property"]];function Tt(e,t){return e==="event"||e==="person"?t.trim()?`${e}:${t.trim()}`:"":e}function Be(e,t,n=document.createElement("canvas")){let o=document.documentElement.scrollWidth,r=Math.max(document.documentElement.scrollHeight,...e.dots.map(a=>a[1]+4));n.width=o,n.height=r,n.setAttribute("data-lc-ignore",""),n.setAttribute("role","img"),n.setAttribute("aria-label",`Confetti of ${e.dots.length} clicks`),n.style.cssText=`position:absolute;left:0;top:0;width:${o}px;height:${r}px;pointer-events:none;z-index:2147483645`;let i=n.getContext("2d");if(!i)return n;let s=document.documentElement.clientWidth||o;for(let[a,u,d]of e.dots)t.has(d)||(i.fillStyle=Ct(d,e.legend),i.beginPath(),i.arc(a*s,u,3,0,Math.PI*2),i.fill());return n}function Rt(e,t,n){if(e.legend.length===0)return k("div","No clicks in this range.");let o=k("ul",void 0,"list-style:none;margin:4px 0;padding:0");return o.setAttribute("aria-label","Confetti legend"),e.legend.forEach((r,i)=>{let s=Object.assign(k("input"),{type:"checkbox",checked:!t.has(i)});s.onchange=()=>{s.checked?t.delete(i):t.add(i),n()};let a=k("span",void 0,`display:inline-block;width:10px;height:10px;border-radius:5px;margin:0 6px;background:${Ct(i,e.legend)}`);a.setAttribute("aria-hidden","true");let u=k("label");u.append(s,a,`${r.value||"(none)"} (${r.clicks})`);let d=k("li");d.append(u),o.append(d)}),o}var Mt=()=>({w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight}),le=(e=location.pathname)=>e.length>1&&e.replace(/\/+$/,"")||"/";function ao(e){let{w:t,h:n}=Mt(),o=document.createElement("canvas");o.width=t,o.height=n,o.setAttribute("data-lc-ignore",""),o.setAttribute("role","img"),o.setAttribute("aria-label",`Heatmap of ${e.total} events`),o.style.cssText=`position:absolute;left:0;top:0;width:${t}px;height:${n}px;pointer-events:none;z-index:2147483645;opacity:.75`;let r=o.getContext("2d");if(!r)return o;let i=(document.documentElement.clientWidth||t)/Math.max(1,e.x_bins);for(let s of e.bins){let a=e.max>0?s.count/e.max:0;r.fillStyle=`hsla(${Math.round((1-a)*55)}, 95%, 52%, ${(.25+.55*a).toFixed(2)})`,r.fillRect(s.x*i,s.y*e.y_bin_px,i,e.y_bin_px)}return o}function lo(e){let{h:t}=Mt(),n=k("div",void 0,`position:absolute;left:0;top:0;width:100%;height:${t}px;pointer-events:none;z-index:2147483645`);n.setAttribute("data-lc-ignore","");for(let o of e.reach){let r=e.sessions>0?o.sessions/e.sessions:0,i=k("div",`${Math.round(r*100)}% reached`,`position:absolute;left:0;width:100%;top:${(o.depth_pct-10)/100*t}px;height:${t/10}px;background:hsla(${Math.round(r*120)},80%,50%,.25);font:bold 11px system-ui;color:#000;padding:2px`);n.append(i)}return n}function co(e,t){try{return(t?Array.from(document.querySelectorAll("a[href]")).filter(o=>o.getAttribute("href")===e.selector):Array.from(document.querySelectorAll(e.selector))).filter(o=>!o.closest("[data-lc-ignore]"))}catch{return[]}}function $t(e){let t=k("div"),n=Z([["click","Clicks"],["rage","Rage clicks"],["dead","Dead clicks"],["move","Mouse movement"],["scroll","Scrollmap"]]),o=Z(At),r=Y("","property key"),i=Object.assign(k("input"),{type:"checkbox"}),s=k("div"),a=k("div",void 0,"white-space:pre-wrap"),u,d=[],y=null,w=[],f=()=>{u?.remove(),u=void 0;for(let v of d)v.remove();d=[],w=[],y=null,a.replaceChildren(),s.replaceChildren()},b=()=>_t(window.innerWidth),l=()=>{for(let v of d)v.remove();d=[],a.replaceChildren(),w.forEach((v,E)=>{let C=`${E+1}: ${v.clicks} clicks${v.rage_clicks?`, ${v.rage_clicks} rage`:""}`,S=co(v,i.checked);for(let x of S){let A=be(x.getBoundingClientRect(),C,v.rage_clicks?"#f55":"#4af");document.body.append(A),d.push(A)}let L=k("div",`${C} ${v.selector}${S.length?"":" (not on this page)"}`);S[0]&&L.append(T("Create action",()=>e.onPick(S[0]))),a.append(L)})},p=async v=>{do{let E=await e.api.elements(le(),b(),y,i.checked);if(!E)return e.note("Could not load elements");w.push(...E.data),y=E.next_cursor}while(v&&y);l(),h.style.display=y?"":"none"},c=async()=>{f();let v=n.value,E=Tt(o.value,r.value);if(v==="click"&&E){let C=await e.api.confetti(le(),b(),E);if(!C)return e.note("No confetti data");let S=new Set,L=Be(C,S);u=L,s.append(Rt(C,S,()=>{Be(C,S,L)})),e.note(`${C.dots.length} clicks on ${le()} (${b()}) coloured by ${E}`),await p(!1)}else if(v==="scroll"){let C=await e.api.scroll(le(),b());if(!C)return e.note("No scroll data");u=lo(C)}else{let C=await e.api.heat(le(),b(),v);if(!C)return e.note("No heatmap data");u=ao(C),e.note(`${C.total} ${v} events on ${le()} (${b()})`),(v==="click"||v==="rage"||v==="dead")&&await p(!1)}document.body.append(u)},h=k("span");return h.style.display="none",h.append(T("Load more",()=>{p(!1)}),T("Load all",()=>{p(!0)})),t.append(k("b","Heatmap"),P("Heatmap type",n),P("Colour by (clicks)",o),P("Property",r),P("Match links by URL",i),T("Show heatmap",()=>{c()}),T("Hide heatmap",f),h,s,a),{node:t,teardown:f}}Lt();var Ot=255,po=new Set(["input","textarea","select","option"]),mo="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",fo=new Set(["value","password","autocomplete"]),go=/(?:\d[ -]?){9,}/;function ho(e){if(!e||po.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(mo)}catch{return!1}}function vo(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||fo.has(o)||o.startsWith("on"))return;let r=t.getAttribute(o);return r===null?void 0:r.slice(0,Ot)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||go.test(n)))return n.slice(0,Ot)}function Ke(e,t,n,o=location.href){let r={};for(let i of e){if(!i.events.includes(t)||i.url&&!Fe([i.url],o))continue;let s=null;try{s=i.scope==="target"?t==="click"&&n?n.closest(i.selector):null:document.querySelector(i.selector)}catch{continue}if(!ho(s))continue;let a=vo(i,s);a!==void 0&&(r[i.name]=a)}return r}de();ie();var yo=new Set(["input","textarea","select","option"]);function Ht(e,t){if(!e)return"Inspect an element first";if(yo.has(e.tagName.toLowerCase()))return"Form fields are never captured: pick a label or container";let n=t.name.trim();if(!n||n.startsWith("$"))return"Give the property a name (no leading $)";let o=[...t.click?["click"]:[],...t.pageview?["pageview"]:[]];if(!o.length)return"Pick click and/or pageview";let r=t.attribute.trim().toLowerCase();if(t.source==="attribute"&&(!r||r==="value"||r.startsWith("on")))return"That attribute cannot be captured";let i=t.scope==="target"&&!t.pageview?"target":"page";return{name:n,selector:F(e),source:t.source==="attribute"?"attribute":"text",...t.source==="attribute"?{attribute:r}:{},events:o,...i==="target"?{scope:i}:{}}}function Pt(e){let t=`${Se(e.host)}/v1/projects/${encodeURIComponent(e.session.project_id)}/snapshot-properties`,n=async(p={})=>{try{let c=await e.host.fetch(t,{...p,credentials:"omit",headers:{Authorization:`Bearer ${e.session.session_token}`,"Content-Type":"application/json"}});return c.ok?await c.json():null}catch{return null}},o=k("div",void 0,"border-top:1px solid #333;margin-top:4px;padding-top:4px"),r=Y("","property name"),i=Z([["text","Visible text"],["attribute","Attribute"]],"text"),s=Y("","data-plan"),a=Z([["page","First match on the page"],["target","Around the clicked element"]],"page"),u=Object.assign(k("input"),{type:"checkbox",checked:!0}),d=Object.assign(k("input"),{type:"checkbox",checked:!1}),y=k("div",void 0,"white-space:pre-wrap;color:#9cf"),w=k("ul",void 0,"margin:4px 0;padding-left:16px"),f=()=>({name:r.value,source:i.value,attribute:s.value,click:u.checked,pageview:d.checked,scope:a.value}),b=p=>{w.replaceChildren(...p.map(c=>k("li",`${c.name}: ${c.source==="attribute"?`[${c.attribute}] of `:""}${c.selector} (${c.events.join(", ")})`)))},l=()=>{let p=Ht(e.picked(),f());if(typeof p=="string")return void(y.textContent=p);let c=Ke([{...p,scope:"page"}],p.events[0]);y.textContent=`${p.selector}
4
+ ${p.name} = ${JSON.stringify(c[p.name]??null)}`};for(let p of[r,i,s,a,u,d])p.addEventListener("input",l);return o.append(k("b","Snapshot properties"),T("Use inspected element",l),P("Name",r),P("Read",i),P("Attribute",s),P("Element",a),P("On clicks",u),P("On pageviews",d),y,T("Save snapshot property",async()=>{let p=Ht(e.picked(),f());if(typeof p=="string")return e.note(p);let c=await n({method:"POST",body:JSON.stringify(p)});if(!c)return e.note("Saving failed (needs toolbar write access)");b(c.data),e.note(`Saved snapshot property ${p.name}; SDKs pick it up with the next config refresh`)}),w),n().then(p=>p&&b(p.data)),{node:o,teardown:()=>o.remove()}}ie();var bn="lc_toolbar_session",Le="lc_toolbar_edit",Je="lc_toolbar_check",Vo="lc_toolbar_recording",ve="__lc_check";function yn(){try{let e=JSON.parse(sessionStorage.getItem(bn)??"null");return e&&(!e.expires_at||Date.parse(e.expires_at)>Date.now())?e:null}catch{return null}}function Xo(){let e=new URL(location.href),t=new URLSearchParams(e.hash.slice(1)),n=e.searchParams.get(ae)??t.get(ae),o=e.searchParams.get(se)??t.get(se),r=e.searchParams.get(ve)??t.get(ve);return o&&sessionStorage.setItem(Le,o),r&&sessionStorage.setItem(Je,r),(n||o||r)&&(e.searchParams.delete(ae),e.searchParams.delete(se),e.searchParams.delete(ve),(t.has(ae)||t.has(se)||t.has(ve))&&(t.delete(ae),t.delete(se),t.delete(ve),e.hash=t.toString()),history.replaceState(history.state,"",e.toString())),n}var Li=e=>{if(location.hash==="#lc-device-preview")return;let t=Xo(),n,o=async r=>{let i=yn();return r&&(i=await ut(e,r),i&&sessionStorage.setItem(bn,JSON.stringify(i))),i?(n?.(),n=Yo(e,i),!0):!1};return e.toolbar={load:r=>o(r)},(t||yn())&&o(t),()=>n?.()};function Yo(e,t){let n=pt(e,t),o=_=>(t.permissions??[]).includes(_),r=e.config.toolbar?.dataAttributes??ke,i=document.createElement("div");i.setAttribute("data-lc-ignore",""),i.style.cssText="position:fixed;bottom:12px;right:12px;z-index:2147483647";let s=i.attachShadow({mode:"open"}),a=k("div",void 0,"background:#111;color:#eee;padding:8px;border-radius:8px;font:12px system-ui;max-width:340px;max-height:70vh;overflow:auto");s.append(a);let u=k("div",void 0,"white-space:pre-wrap"),d=_=>{u.textContent=_},y,w=!1,f,b,l=k("div",void 0,"position:fixed;pointer-events:none;border:2px solid #4af;z-index:2147483646;display:none");l.setAttribute("data-lc-ignore","");let p=_=>{let j=_.target;if(!w||!(j instanceof Element)||j===i)return;let D=j.getBoundingClientRect();Object.assign(l.style,{display:"block",left:`${D.left}px`,top:`${D.top}px`,width:`${D.width}px`,height:`${D.height}px`})},c=_=>{!w||!(_.target instanceof Element)||_.target===i||(_.preventDefault(),_.stopPropagation(),y=_.target,w=!1,l.style.display="none",d(`Selected ${F(y)}`))};document.addEventListener("mousemove",p,!0),document.addEventListener("click",c,!0),document.body.append(l);let h=[],v=(_,j)=>{let D=k("div"),B,ne=T(_,()=>{if(B)B.hidden=!B.hidden;else{let m=j();B=m.node,h.push(m.teardown),D.append(B)}ne.setAttribute("aria-expanded",String(!B.hidden))});return ne.setAttribute("aria-expanded","false"),D.prepend(ne),D},E=o("actions:write")?lt({api:n,attrs:r,picked:()=>y,note:d}):void 0;E&&(E.node.hidden=!0,h.push(E.teardown));let C=E?T("Actions",()=>{E.node.hidden=!E.node.hidden,C?.setAttribute("aria-expanded",String(!E.node.hidden))}):void 0,S=me(),L=_=>()=>y?_(y):d("Inspect an element first"),x=()=>d(JSON.stringify(S.toPayload(),null,1)),A=(_,j,D)=>T(_,L(B=>{let ne=window.prompt(j);ne!==null&&(D(B,ne),x())})),O=()=>e.client.isInternal?"Count my traffic":"Exclude my traffic ($internal)",H=T(O(),()=>{e.client.optOutInternal(!e.client.isInternal),H.textContent=O()}),g=T("Experiment editor",async()=>{if(b)return b.remove(),void(b=void 0);let _=sessionStorage.getItem(Le)??window.prompt("Experiment id");if(!_)return;sessionStorage.setItem(Le,_);let{experimentEditor:j}=await Promise.resolve().then(()=>(Bt(),Ut));b=await j({api:n,scopes:t.permissions,experimentId:_,picked:()=>y,note:d}),a.prepend(b)}),G=T("Guide builder",async()=>{if(f)return f.remove(),void(f=void 0);let{guideBuilder:_}=await Promise.resolve().then(()=>(pn(),un));f=_({api:n,scopes:t.permissions,picked:()=>y,note:d,attrs:r}),a.append(f)});a.append(k("b",`Lucida toolbar${t.user?.email?` - ${t.user.email}`:""}${o("actions:write")?"":" (view only)"}`),k("br"),H,T("Inspect element",()=>(w=!0,d("Click an element"))),...C&&E?[C,E.node]:[],v("Heatmap",()=>$t({api:n,note:d,onPick:_=>{if(y=_,!E)return d("Creating actions needs toolbar write access");E.addStep(Pe(_,r)),E.node.hidden=!1,d(`Added ${F(_)} to the action`)}})),v("Feature flags",()=>Et(e,n)),v("Event debugger",()=>ht(e)),...o("actions:write")?[v("Snapshot properties",()=>Pt({host:e,session:t,picked:()=>y,note:d}))]:[],G,g,k("hr"),k("b","Visual editor"),k("br"),A("Text","New text",(_,j)=>S.text(_,j)),A("Style","CSS as property:value",(_,j)=>{let[D,...B]=j.split(":");D&&B.length&&S.style(_,D.trim(),B.join(":").trim())}),A("Attribute","name=value (empty value removes)",(_,j)=>{let[D,...B]=j.split("=");D&&S.attr(_,D.trim(),B.length&&B.join("=")!==""?B.join("="):null)}),T("Hide",L(_=>(S.hide(_),x()))),T("Move up",L(_=>(S.move(_,-1),x()))),T("Move down",L(_=>(S.move(_,1),x()))),T("Show changes JSON",x),u),document.body.append(i),sessionStorage.getItem(Le)?g.click():sessionStorage.getItem(Vo)&&G.click();let V=sessionStorage.getItem(Je);return V&&(sessionStorage.removeItem(Je),Promise.resolve().then(()=>(vn(),hn)).then(({parseCheck:_,runCheck:j})=>{let D=_(V);D?j(D,d):d("The guide check request is malformed")})),()=>{document.removeEventListener("mousemove",p,!0),document.removeEventListener("click",c,!0);for(let _ of h)_();i.remove(),l.remove()}}export{se as EDIT_PARAM,Ie as EXPERIMENT_SCOPE,_e as GUIDE_SCOPE,ae as TOOLBAR_PARAM,ut as exchangeToken,De as getFlagOverrides,ft as setFlagOverride,Li as toolbar,pt as toolbarApi,Se as toolbarHost};
package/dist/toolbar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as Guide, G as GuideStep, H as Host, M as Module } from './types-Chfj1wdu.js';
1
+ import { g as Guide, G as GuideStep, H as Host, M as Module } from './types-BnEbxGJq.js';
2
2
  import '@lucida-analytics/sdk-core';
3
3
 
4
4
  /** Session derived from the POST /v1/toolbar/exchange response (contract: sdks/browser/README.md). */