@lucida-analytics/browser 0.1.3 → 0.1.5

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 (85) hide show
  1. package/README.md +45 -0
  2. package/dist/autocapture.d.ts +1 -1
  3. package/dist/autocapture.js +1 -1
  4. package/dist/{banner-2TSKJ4WK.js → banner-7LEREYUH.js} +1 -1
  5. package/dist/{static/v0.1.3/chunk-32K5P5GN.js → chunk-536QABLP.js} +1 -1
  6. package/dist/{static/v0.1.3/chunk-O4W7SZ2X.js → chunk-EFNCQJI3.js} +1 -1
  7. package/dist/chunk-UPPUYIIH.js +1 -0
  8. package/dist/{client-DkIhkh91.d.ts → client-DZX6o-eI.d.ts} +2 -2
  9. package/dist/consent.d.ts +9 -3
  10. package/dist/consent.js +1 -1
  11. package/dist/core.d.ts +3 -3
  12. package/dist/core.js +3 -3
  13. package/dist/correlate.d.ts +1 -1
  14. package/dist/early-access.d.ts +1 -1
  15. package/dist/experiments.d.ts +1 -1
  16. package/dist/flags.d.ts +1 -1
  17. package/dist/forms.d.ts +1 -1
  18. package/dist/guides.d.ts +2 -1116
  19. package/dist/heatmaps.d.ts +1 -1
  20. package/dist/host-headers.d.ts +1 -1
  21. package/dist/index.d.ts +8 -4
  22. package/dist/index.js +2 -2
  23. package/dist/inspector.d.ts +1 -1
  24. package/dist/lucida.js +2 -2
  25. package/dist/recommendations.d.ts +1 -1
  26. package/dist/{recorder-P2QJ4AKY.js → recorder-4WIMQCLR.js} +1 -1
  27. package/dist/replay.d.ts +2 -2
  28. package/dist/replay.js +1 -1
  29. package/dist/static/v0/autocapture.js +1 -1
  30. package/dist/static/v0/{banner-2TSKJ4WK.js → banner-7LEREYUH.js} +1 -1
  31. package/dist/static/v0/{chunk-32K5P5GN.js → chunk-536QABLP.js} +1 -1
  32. package/dist/static/v0/{chunk-O4W7SZ2X.js → chunk-EFNCQJI3.js} +1 -1
  33. package/dist/static/v0/chunk-UPPUYIIH.js +1 -0
  34. package/dist/static/v0/consent.js +1 -1
  35. package/dist/static/v0/core.js +3 -3
  36. package/dist/static/v0/index.js +2 -2
  37. package/dist/static/v0/lucida.js +2 -2
  38. package/dist/static/v0/manifest.json +28 -0
  39. package/dist/static/{v0.1.3/recorder-P2QJ4AKY.js → v0/recorder-4WIMQCLR.js} +1 -1
  40. package/dist/static/v0/replay.js +1 -1
  41. package/dist/static/{v0.1.3 → v0.1.5}/autocapture.js +1 -1
  42. package/dist/static/{v0.1.3/banner-2TSKJ4WK.js → v0.1.5/banner-7LEREYUH.js} +1 -1
  43. package/dist/{chunk-32K5P5GN.js → static/v0.1.5/chunk-536QABLP.js} +1 -1
  44. package/dist/{chunk-O4W7SZ2X.js → static/v0.1.5/chunk-EFNCQJI3.js} +1 -1
  45. package/dist/static/v0.1.5/chunk-UPPUYIIH.js +1 -0
  46. package/dist/static/v0.1.5/consent.js +1 -0
  47. package/dist/static/v0.1.5/core.js +3 -0
  48. package/dist/static/v0.1.5/index.js +3 -0
  49. package/dist/static/v0.1.5/lucida.js +3 -0
  50. package/dist/static/v0.1.5/manifest.json +28 -0
  51. package/dist/static/{v0/recorder-P2QJ4AKY.js → v0.1.5/recorder-4WIMQCLR.js} +1 -1
  52. package/dist/static/v0.1.5/replay.js +1 -0
  53. package/dist/toolbar.d.ts +1 -1
  54. package/dist/{types-XbAgeGjz.d.ts → types-Dng5ldZO.d.ts} +52 -4
  55. package/dist/webmcp.d.ts +1 -1
  56. package/lucida-global.d.ts +24 -0
  57. package/package.json +7 -5
  58. package/storage.json +75 -0
  59. package/dist/chunk-UH2MVDMX.js +0 -1
  60. package/dist/static/v0/chunk-UH2MVDMX.js +0 -1
  61. package/dist/static/v0.1.3/chunk-UH2MVDMX.js +0 -1
  62. package/dist/static/v0.1.3/consent.js +0 -1
  63. package/dist/static/v0.1.3/core.js +0 -3
  64. package/dist/static/v0.1.3/index.js +0 -3
  65. package/dist/static/v0.1.3/integrity.json +0 -30
  66. package/dist/static/v0.1.3/lucida.js +0 -3
  67. package/dist/static/v0.1.3/replay.js +0 -1
  68. package/dist/types-Bgl5v0MP.d.ts +0 -972
  69. /package/dist/static/{v0.1.3 → v0.1.5}/chunk-AWIQCFGN.js +0 -0
  70. /package/dist/static/{v0.1.3 → v0.1.5}/chunk-FUE3SDQU.js +0 -0
  71. /package/dist/static/{v0.1.3 → v0.1.5}/correlate.js +0 -0
  72. /package/dist/static/{v0.1.3 → v0.1.5}/early-access.js +0 -0
  73. /package/dist/static/{v0.1.3 → v0.1.5}/experiments.js +0 -0
  74. /package/dist/static/{v0.1.3 → v0.1.5}/flags.js +0 -0
  75. /package/dist/static/{v0.1.3 → v0.1.5}/forms.js +0 -0
  76. /package/dist/static/{v0.1.3 → v0.1.5}/guides.js +0 -0
  77. /package/dist/static/{v0.1.3 → v0.1.5}/heatmaps.js +0 -0
  78. /package/dist/static/{v0.1.3 → v0.1.5}/host-headers.js +0 -0
  79. /package/dist/static/{v0.1.3 → v0.1.5}/inspector.js +0 -0
  80. /package/dist/static/{v0.1.3 → v0.1.5}/modules-FANMZRDJ.js +0 -0
  81. /package/dist/static/{v0.1.3 → v0.1.5}/persistent-SLVINN5A.js +0 -0
  82. /package/dist/static/{v0.1.3 → v0.1.5}/recommendations.js +0 -0
  83. /package/dist/static/{v0.1.3 → v0.1.5}/toolbar.js +0 -0
  84. /package/dist/static/{v0.1.3 → v0.1.5}/validation-HGJXZ553.js +0 -0
  85. /package/dist/static/{v0.1.3 → v0.1.5}/webmcp.js +0 -0
package/README.md CHANGED
@@ -105,6 +105,17 @@ inside `[data-lc-unmask]` or the unmask list (a mask selector inside still wins)
105
105
  `q`, `s`, `search`, `query`) emits `$site_search {$search_term, $search_param}` after each `$pageview` that carries a
106
106
  query param. Reported URLs drop query and hash. `[data-lc-ignore]` subtrees are skipped. `tag404(client)` (from
107
107
  `@lucida-analytics/browser`) on a 404 page captures `$page_not_found {$status: 404}`.
108
+ - **Consent default is `opt_out`**: with no `consent` config the SDK stores and sends from the first page view, before any
109
+ visitor choice. Where consent law applies (EU/UK/other opt-in regions) pass `consent: { mode: "opt_in" }` (nothing is stored
110
+ or sent until `optIn()` / `setConsent`), or `consent: { geo: ... }` to switch by region. `optIn()` grants analytics and replay;
111
+ marketing only with `optIn(["analytics", "replay", "marketing"])`.
112
+ - **Consent precedence** (0.1.5): a stored visitor decision wins; then the project's `consent_mode` (and geo `consent_default`)
113
+ from `GET /v1/config`; then the page's `consent.mode`; then the SDK default (`opt_out`). The project can only make it
114
+ stricter: a project `opt_in` beats a page `opt_out` (or no `consent` config at all), and a project `opt_out` never loosens a
115
+ page `opt_in`. Unless the page says `opt_in`, the SDK therefore reads the config first (one `GET` carrying only the public
116
+ key, no cookies) and holds every storage write and every send, events kept in memory, until it answers. If it does not answer
117
+ within 3 seconds, or answers with a network error or a 5xx, the SDK fails closed as `opt_in`; `flush()` waits for the answer.
118
+ Conformance vector: `testdata/consent/precedence.json`.
108
119
  - **DNT / GPC**: `respectDnt` (default false) and `respectGpc` (default false). When set and the browser sends the signal,
109
120
  an `opt_out` project starts with consent denied, so nothing is stored or sent until `setConsent`. An explicit stored
110
121
  decision still wins. (`consent.respectDnt` is kept and enables both.)
@@ -223,6 +234,40 @@ with `ai: { captureText: true }`, after cards, emails and phone numbers are mask
223
234
  conversation to its trace in Watchtower; tokens, latency, cost and model names are never captured here.
224
235
  Events use the normal capture path, so consent and opt-out apply.
225
236
 
237
+ ## Classic script (`lucida.js`)
238
+
239
+ For plain HTML, tag managers and site builders. Pin a version and check it with Subresource Integrity (the hash of each
240
+ release is in `/static/v<version>/manifest.json`; `lucida init --framework html` prints this snippet with it filled in):
241
+
242
+ ```html
243
+ <script>
244
+ window.lucidaQueue = window.lucidaQueue || [];
245
+ lucidaQueue.push(["init", "lc_pk_...", { apiHost: "https://<your capture host>", modules: ["consent", "replay"] }]);
246
+ </script>
247
+ <script async src="https://<your app host>/static/v0.1.5/lucida.js"
248
+ integrity="sha384-HASH_OF_LUCIDA_JS_FROM_MANIFEST_JSON" crossorigin="anonymous"></script>
249
+ ```
250
+
251
+ - **`window.lucidaQueue`** is a plain array you create before the script loads. The script drains it in order, then replaces
252
+ `push` so later commands run at once. Commands: `["init", publicKey, config?]` (once; later `init`s are ignored) and
253
+ `[method, ...args]` for any `Client` method (`["capture", "signed_up", {plan: "pro"}]`, `["identify", "u1"]`,
254
+ `["optIn"]`). Commands before `init` wait for it, and for the `modules` it loads. `window.lucida` is the client once `init`
255
+ ran. Types: add `/// <reference types="@lucida-analytics/browser/lucida-global" />` (`lucida-global.d.ts`).
256
+ - **`modules`** (init config, names only): `replay`, `heatmaps`, `forms`, `toolbar`, `guides`, `inspector`, `experiments`,
257
+ `early-access`, `consent`. Each loads from `<assetHost>/static/v<this script's version>/<name>.js` before the client
258
+ starts; one that fails to load is skipped. Not loaded in extension mode.
259
+ - **`assetHost`, `uiHost`** default to the origin the script was loaded from (set `assetHost` only when the files are hosted
260
+ elsewhere, `uiHost` only when replay links should point elsewhere). `apiHost` is where events go, default `https://capture.lucidace.com`.
261
+ - **`modules: ["consent"]`** adds `client.consent.showBanner()` and follows Cookie Munch: once `CookieMunch.hasResponse` it maps
262
+ `statistics` to analytics + replay and `marketing` to marketing, and follows its change events. Use it with `consent: { mode: "opt_in" }`.
263
+ - **Integrity**: with a `manifest.json` next to the script (every release publishes one: `{version, files: {"lucida.js":
264
+ "sha384-...", "modules/<name>.js": "sha384-..."}}`), the loader fetches each lazy module and checks it with WebCrypto
265
+ (`SHA-384`) against the manifest before running it. A module that differs, one the manifest does not list, or a page
266
+ without WebCrypto is refused with a `console.warn`, and the client starts without it. With no manifest (an old deploy) modules
267
+ load as before. Lazy chunks a module imports are not hashed separately.
268
+ - **Caching**: `/static/v<x.y.z>/*` is `immutable` for a year; `/static/v<major>/*` and `/lucida.js` are cached 5 minutes; a 404 is never cached.
269
+ - **Storage**: every cookie and storage key is listed in `storage.json` (shipped in this package).
270
+
226
271
  ## Interventions
227
272
 
228
273
  `client.onIntervention((i) => ...)` receives the in-session interventions fired for the current person (`{id, intervention_id, name, event, payload, fired_at}`, each once). The first listener opens `GET /v1/interventions/stream` (after analytics consent); it resumes after the last fire on reconnect and follows `identify` / `reset`. Returns an unsubscribe function. See `docs/guides/interventions.md`.
@@ -1,4 +1,4 @@
1
- import { C as Client, M as Module } from './types-XbAgeGjz.js';
1
+ import { e as Client, M as Module } from './types-Dng5ldZO.js';
2
2
  import { Props } from '@lucida-analytics/sdk-core';
3
3
 
4
4
  interface ElementInfo {
@@ -1 +1 @@
1
- var ve=(e,t)=>()=>(e&&(t=e(e=0)),t);function Ke(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function j(e,t){return!!e?.some(n=>{try{return new RegExp(Ke(n),"i").test(t)}catch{return!1}})}var pe=ve(()=>{"use strict"});var be='[data-lc-region="article"]';function K(e,t,n){if(t.articles===!1)return()=>{};let o;e.loadConfig().then(f=>{typeof f?.article_selector=="string"&&(o=f.article_selector)});let s=()=>{for(let f of[t.articleSelector,o,be])if(f)try{let _=document.querySelector(f);if(_)return _}catch{}return null},i=location.href,l=location.pathname,c=null,a=0,u=!1,r=()=>{if(c??=s(),!c)return;let f=c.getBoundingClientRect();if(f.height<=0)return;let _=Math.round(Math.min(100,Math.max(0,(window.innerHeight-f.top)/f.height*100)));a=Math.max(a,_);let v=c.querySelector("h1,h2");v&&v.getBoundingClientRect().bottom<0&&(u=!0)},p=()=>{!c||!n()||(r(),e.client.capture("$article_read",{$article_id:(c.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||l,$article_depth:a,$article_finished:a>=90,$article_headline_exit:!u&&a<25}),c=null)},d=()=>{p(),c=null,a=0,u=!1,i=location.href,l=location.pathname},m=()=>location.href!==i?d():r(),g=new MutationObserver(m);return g.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",m,{passive:!0}),e.onUnload(p),r(),()=>{g.disconnect(),window.removeEventListener("scroll",m)}}var T="data-lc-content",Ee="data-lc-content-piece",we="data-lc-content-target";var O=(e,t)=>(e.getAttribute(t)??"").trim().slice(0,200);function G(e,t,n){if(t.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let o=new WeakSet,s=r=>{let p={$content_name:O(r,T)},d=O(r,Ee),m=O(r,we);return d&&(p.$content_piece=d),m&&(p.$content_target=m),p},i=location.href,l=new IntersectionObserver(r=>{for(let p of r)!p.isIntersecting||o.has(p.target)||!n()||(o.add(p.target),e.client.capture("$content_impression",s(p.target)))},{threshold:.5}),c=r=>r.querySelectorAll(`[${T}]`).forEach(p=>l.observe(p));c(document);let a=new MutationObserver(()=>{location.href!==i&&(i=location.href,l.disconnect(),document.querySelectorAll(`[${T}]`).forEach(r=>o.delete(r))),c(document)});a.observe(document.documentElement,{childList:!0,subtree:!0});let u=r=>{let p=r.target?.closest?.(`[${T}]`);p&&n()&&e.client.capture("$content_interaction",{...s(p),$content_interaction_type:"click"})};return document.addEventListener("click",u,!0),()=>{l.disconnect(),a.disconnect(),document.removeEventListener("click",u,!0)}}var ke=new Set(["input","textarea","select","option"]),xe=["name","type","role","aria-label","title","alt","placeholder"],Ce=/(?:\d[ -]?){9,}/;function Re(e){if(ke.has(e.tagName.toLowerCase())||e.isContentEditable)return;let t="";for(let n of Array.from(e.childNodes))n.nodeType===3&&(t+=n.textContent??"");if(t=t.replace(/\s+/g," ").trim(),!(!t||Ce.test(t)))return t.slice(0,255)}function Y(e){if(!e?.length)return()=>!1;let t=e.map(n=>n.toLowerCase());return n=>t.some(o=>o.endsWith("*")?n.startsWith(o.slice(0,-1)):n===o)}var B="***";function w(e){let t={};for(let n=e,o=0;n&&o<10;n=n.parentElement,o++)for(let s of Array.from(n.attributes)){let i=s.name.startsWith("data-lc-attr-")?s.name.slice(13):"";i&&!(i in t)&&!i.startsWith("$")&&(t[i]=s.value.slice(0,255))}return t}function Se(e,t,n,o){let s=e.parentElement,i=s?Array.from(s.children):[e],l={tag_name:e.tagName.toLowerCase(),nth_child:i.indexOf(e)+1,nth_of_type:i.filter(r=>r.tagName===e.tagName).indexOf(e)+1},c=(e.getAttribute("class")??"").split(/\s+/).filter(Boolean);c.length&&!n("class")&&(l.classes=c),e.id&&!n("id")&&(l.attr__id=o("id",e.id));let a=e.getAttribute("href");a&&!n("href")&&(l.href=o("href",a.slice(0,1024)));let u={};for(let r of Array.from(e.attributes))(r.name.startsWith("data-lc-")||xe.includes(r.name))&&!n(r.name)&&(u[r.name]=o(r.name,r.value.slice(0,255)));if(Object.keys(u).length&&(l.attrs=u),t){let r=Re(e);r&&(l.text=r)}return l}function k(e,t,n,o,s={}){let i=[],l=Y(o),c=Y(s.allow),a=s.maskAll?(r,p)=>c(r)?p:B:(r,p)=>p,u=t;for(let r=e;r&&i.length<10;r=r.parentElement)i.push(Se(r,u,l,a)),(r===n||!n)&&(u=!1);return i}var $=e=>e.replace(/(["\\])/g,"\\$1");function x(e){return e.map(t=>{let n=t.tag_name+(t.classes?"."+t.classes.join("."):"")+":";t.attr__id&&(n+=`attr__id="${$(t.attr__id)}"`),t.href&&(n+=`href="${$(t.href)}"`),t.text&&(n+=`text="${$(t.text)}"`);for(let[o,s]of Object.entries(t.attrs??{}))n+=`attr__${o}="${$(s)}"`;return n+`nth-child="${t.nth_child}"nth-of-type="${t.nth_of_type}"`}).join(";")}var b=[],Ae=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,Me=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,Te=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,$e="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function z(e,t=[]){if(t.length&&e.closest(t.join(","))||e.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=e.closest($e)??e,o=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(Ae.test((n.textContent??"").trim())||Me.test(o))return!0;for(let s=n,i=0;s&&i<3;s=s.parentElement,i++)if(Te.test(s.getAttribute("class")??""))return!0;return!1}var Le=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function V(e,t=Date.now(),n={},o){if(o&&n.ignoreSelectors?.length&&o.closest(n.ignoreSelectors.join(",")))return{};if(o&&n.suppressSteppers!==!1&&z(o,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&Le())return{};let s=n.windowMs??1e3,i=n.radiusPx??30;for(b.length&&t<b[b.length-1].t&&(b.length=0),b.push({t,x:e.clientX,y:e.clientY});b.length&&t-b[0].t>s;)b.shift();let l=b.filter(c=>Math.hypot(c.x-e.clientX,c.y-e.clientY)<=i).length;return l>=(n.count??3)?{$rageclick:!0,$rageclick_count:l}:{}}function Q(e,t,n=700){if(typeof MutationObserver>"u")return;let o=!1,s=new MutationObserver(()=>o=!0);s.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let i=()=>{o=!0};window.addEventListener("scroll",i,{capture:!0,passive:!0}),document.addEventListener("selectionchange",i);let l=()=>{s.disconnect(),window.removeEventListener("scroll",i,{capture:!0}),document.removeEventListener("selectionchange",i)},c=setTimeout(()=>{l(),!o&&document.visibilityState!=="hidden"&&e.client.capture("$deadclick_hint",{$selector:t,$no_mutation_ms:n})},n);e.onUnload(()=>{clearTimeout(c),l()})}var Z=/^[A-Za-z_][\w-]*$/,Oe=5;function J(e){let t=[];for(let n=e;n&&t.length<Oe;n=n.parentElement){let o=n.tagName.toLowerCase();if(n.id&&Z.test(n.id)){t.unshift(`${o}#${n.id}`);break}let s=(n.getAttribute("class")??"").split(/\s+/).filter(i=>Z.test(i)).slice(0,2);t.unshift(o+s.map(i=>`.${i}`).join(""))}return t.join(" ")}function ee(e,t,n,o,s={}){let i={$selector:J(n),$el_interactive:o};(t.clientX||t.clientY||t.detail)&&(i.$click_x=Math.round(t.clientX+(window.scrollX||0)),i.$click_y=Math.round(t.clientY+(window.scrollY||0))),s.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(i,V(t,Date.now(),s.rageClicks||{},n));let l=s.deadClicks;!o&&t.isTrusted&&l!==!1&&!(l?.ignoreSelectors?.length&&n.closest(l.ignoreSelectors.join(",")))&&Q(e,i.$selector,l?.waitMs);for(let c of e.clickExtras)Object.assign(i,c(t,n));return i}var He="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",Ie="[data-lc-ignore]",H=e=>e.some(t=>typeof t=="string"?location.href.includes(t):t.test(location.href)),Pe=e=>!e?.length||H(e),I=e=>({maskAll:e.maskAllAttributes,allow:e.attributeAllowlist}),C=(e,t)=>!!e.closest(Ie)||!!(t.denySelectors?.length&&e.closest(t.denySelectors.join(",")));function te(e,t,n){let o=t.events??["click","change","submit"],s=0,i=a=>{let u=a.target;!n()||a.isComposing||!(u instanceof Element)||C(u,t)||u instanceof HTMLInputElement&&u.type==="password"||(s+=1)},l=a=>u=>{if(!n())return;let r=u.target;if(!(r instanceof Element)||C(r,t)||t.allowSelectors?.length&&!r.closest(t.allowSelectors.join(","))||t.elementAllowlist?.length&&!r.closest(t.elementAllowlist.join(","))||!Pe(t.urlAllowlist)||a==="change"&&!/^(input|select|textarea)$/i.test(r.tagName)||r instanceof HTMLInputElement&&r.type==="password")return;let p=r.closest(He);if(a==="click"&&!p&&!t.allowSelectors?.length)return;let d=k(r,t.captureText??!0,p??void 0,t.attributeIgnore,I(t)),m=d.find(f=>f.text)?.text,g=s;s=0,e.client.capture("$autocapture",{...w(r),$event_type:a,...g>0?{$keystroke_count:g}:{},$elements:d,$elements_chain:x(d),...m?{$el_text:m}:{},...a==="click"?ee(e,u,r,!!p,t):{}})};e.autocaptureClicks=o.includes("click");let c=o.map(a=>[a,l(a)]);for(let[a,u]of c)document.addEventListener(a,u,!0);return document.addEventListener("keydown",i,!0),()=>{for(let[a,u]of c)document.removeEventListener(a,u,!0);document.removeEventListener("keydown",i,!0)}}var je='[contenteditable]:not([contenteditable="false"])',ne="input,textarea,select",Ne=255;function re(e){return e.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,Ne)}var We=e=>e?e instanceof Element?e:e.parentElement:null;function oe(e,t,n){let o=t.events??["click","change","submit"],s=t.contentEditable!==!1&&o.includes("change"),i=new WeakSet,l=p=>{let d=k(p,!1,p,t.attributeIgnore,I(t));return{...w(p),$elements:d,$elements_chain:x(d)}},c=p=>{let d=p instanceof Element?p.closest(je):null;return d&&!C(d,t)?d:null},a=p=>{let d=n()?c(p.target):null;d&&i.add(d)},u=p=>{let d=c(p.target);!d||!i.has(d)||p.relatedTarget instanceof Node&&d.contains(p.relatedTarget)||(i.delete(d),n()&&e.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...l(d)}))},r=p=>{if(!n()||!t.copyCut)return;let d=typeof getSelection=="function"?getSelection():null,m=p.target instanceof Element?p.target:null,g=We(d?.anchorNode)??m;if(!g||C(g,t)||g.closest(ne)||m?.closest(ne))return;let f=t.captureCopiedText?re(d?.toString()??""):"";e.client.capture("$copy_autocapture",{$copy_type:p.type,...l(g),...f?{$selected_content:f}:{}})};return s&&(document.addEventListener("input",a,!0),document.addEventListener("focusout",u,!0)),document.addEventListener("copy",r,!0),document.addEventListener("cut",r,!0),()=>{document.removeEventListener("input",a,!0),document.removeEventListener("focusout",u,!0),document.removeEventListener("copy",r,!0),document.removeEventListener("cut",r,!0)}}var De="[data-lc-ignore]",ie=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],ae=["q","s","search","query"],se=e=>e.origin+e.pathname;function le(e,t,n){let o=Array.isArray(t.fileDownloads)?t.fileDownloads.map(i=>i.toLowerCase()):ie,s=[];if(t.outboundLinks!==!1||t.fileDownloads!==!1){let i=l=>{let c=l.target instanceof Element?l.target.closest("a[href]"):null;if(!c||!n()||c.closest(De))return;let a;try{a=new URL(c.href,location.href)}catch{return}if(a.protocol!=="http:"&&a.protocol!=="https:")return;let u=decodeURIComponent(a.pathname.split("/").pop()??""),r=u.includes(".")?u.split(".").pop().toLowerCase():"";t.fileDownloads!==!1&&(c.hasAttribute("download")||o.includes(r))?e.client.capture("$file_download",{$url:se(a),$file_name:u,$file_extension:r}):t.outboundLinks!==!1&&a.host!==location.host&&e.client.capture("$outbound_click",{$url:se(a),$outbound_host:a.host})};document.addEventListener("click",i,!0),s.push(()=>document.removeEventListener("click",i,!0))}if(t.siteSearch!==!1){let i=typeof t.siteSearch=="object"&&t.siteSearch.params?t.siteSearch.params:ae,l=!0;s.push(()=>{l=!1}),e.onCapture(c=>{if(!l||c.event!=="$pageview"||!n())return;let a=new URLSearchParams(location.search);for(let u of i){let r=a.get(u)?.trim();if(r)return void e.client.capture("$site_search",{$search_term:r.slice(0,200),$search_param:u})}})}return()=>s.forEach(i=>i())}function Ue(e,t={}){e.capture("$page_not_found",{$status:404,...t})}var Xe=[25,50,75],Fe="data-lc-media-title";function P(e){let t=e.currentSrc||e.src;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return"";try{let n=new URL(t,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var qe=e=>(e.getAttribute(Fe)??e.getAttribute("title")??e.getAttribute("aria-label")??"").trim().slice(0,200);function ce(e,t,n){if(t.media===!1)return()=>{};let o=new WeakMap,s=a=>{let u={$media_type:a instanceof HTMLVideoElement?"video":"audio",$media_src:P(a)},r=qe(a);return r&&(u.$media_title=r),Number.isFinite(a.duration)&&(u.$media_duration=Math.round(a.duration)),u},i=a=>{let u=P(a);if(!u)return null;let r=o.get(a);return(!r||r.src!==u)&&o.set(a,r={src:u,played:!1,reached:new Set,done:!1}),r},l=a=>{let u=a.target;if(!(u instanceof HTMLMediaElement)||!n())return;let r=i(u);if(r)if(a.type==="play"){if(r.done&&Object.assign(r,{played:!1,reached:new Set,done:!1}),r.played)return;r.played=!0,e.client.capture("$media_play",s(u))}else if(a.type==="timeupdate"){if(!r.played||r.done||!Number.isFinite(u.duration)||u.duration<=0)return;let p=u.currentTime/u.duration*100;for(let d of Xe)p>=d&&!r.reached.has(d)&&(r.reached.add(d),e.client.capture("$media_progress",{...s(u),$media_progress:d}))}else a.type==="ended"&&r.played&&!r.done&&(r.done=!0,e.client.capture("$media_complete",s(u)))},c=["play","timeupdate","ended"];return c.forEach(a=>document.addEventListener(a,l,!0)),()=>c.forEach(a=>document.removeEventListener(a,l,!0))}function ue(e=()=>performance.now()){let t=()=>document.visibilityState!=="hidden",n=0,o=t()?e():null,s=()=>{t()?o===null&&(o=e()):(o!==null&&(n+=e()-o),o=null)};return document.addEventListener("visibilitychange",s),{read:()=>Math.round(n+(o===null?0:e()-o)),reset:()=>{n=0,o=t()?e():null},stop:()=>document.removeEventListener("visibilitychange",s)}}pe();var de=255,Ge=new Set(["input","textarea","select","option"]),Ye="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Be=new Set(["value","password","autocomplete"]),ze=/(?:\d[ -]?){9,}/,R=new WeakMap,N=new WeakMap;function fe(e,t){let n=N.get(e);if(n)return new Promise(o=>{let s=setTimeout(o,t);n.then(()=>(clearTimeout(s),o()))})}function me(e){return Array.isArray(e)?e.filter(t=>{if(!t||typeof t!="object")return!1;let n=t;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 Ve(e){if(!e||Ge.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(Ye)}catch{return!1}}function Qe(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||Be.has(o)||o.startsWith("on"))return;let s=t.getAttribute(o);return s===null?void 0:s.slice(0,de)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||ze.test(n)))return n.slice(0,de)}function W(e,t,n,o=location.href){let s={};for(let i of e){if(!i.events.includes(t)||i.url&&!j([i.url],o))continue;let l=null;try{l=i.scope==="target"?t==="click"&&n?n.closest(i.selector):null:document.querySelector(i.selector)}catch{continue}if(!Ve(l))continue;let c=Qe(i,l);c!==void 0&&(s[i.name]=c)}return s}function ge(e){let t=!0,n=e.loadConfig().then(o=>{t&&R.set(e,me(o?.snapshot_properties)),N.delete(e)});return N.set(e,n),e.clickExtras.push((o,s)=>t?W(R.get(e)??[],"click",s):{}),()=>{t=!1,R.delete(e)}}function he(e){let t=R.get(e);return t?.length?W(t,"pageview"):{}}function ye(e){return!!R.get(e)?.some(t=>t.events.includes("pageview"))}var Ze=e=>{try{return new URL(e).pathname}catch{return e}};function Je(e){for(let t of e===void 0?[]:Array.isArray(e)?e:[e])try{let n=document.querySelector(t);if(n)return n}catch{}}function _e(e){let t=0,n=0,o=()=>{let s=Je(e),i=document.documentElement,l=s?s.scrollHeight:Math.max(i.scrollHeight,document.body?.scrollHeight??0),c=s?s.scrollTop:window.scrollY||window.pageYOffset||0,a=Math.min(l,c+(s?s.clientHeight:window.innerHeight));a>t&&(t=a,n=l>0?Math.min(100,Math.round(a/l*100)):0)};return o(),window.addEventListener("scroll",o,{passive:!0,capture:!0}),window.addEventListener("resize",o,{passive:!0}),{read:()=>({pct:n,px:t}),stop:()=>{window.removeEventListener("scroll",o,{capture:!0}),window.removeEventListener("resize",o)}}}var et=800,tt=e=>e.core.hasConsent("analytics");function nt(e){return e==="history"?{path:!0,search:!0}:e==="hash"?{path:!0,search:!0,hash:!0}:typeof e=="object"?e:void 0}function rt(e,t,n){try{let o=new URL(e),s=new URL(t);return!!(n.path&&o.pathname!==s.pathname||n.search&&o.search!==s.search||n.hash&&o.hash!==s.hash)}catch{return e!==t}}function L(e,t,n={}){let o=n.views??!0,s=n.leave??!0,i=nt(t),l=e.config.scrollRoot,c=location.href,a=c,u=Date.now(),r=_e(l),p=ue(),d,m=()=>{if(!s||d===c)return;d=c;let{pct:h,px:E}=r.read();e.client.capture("$pageleave",{$current_url:c,$scroll_depth:h,$scroll_depth_px:E,$engagement_time_ms:p.read()})},g=!1,f=(h,E={})=>{if(!o)return;let{core:y}=e;if(!y.hasConsent("analytics")&&!y.anonymousOnReject&&!(y.consent.pending&&y.consent.queueBeforeConsent)){if(!g){g=!0;let A=()=>{g&&(g=!1,f())};e.whenConsented(A),y.onChange(M=>{M==="consent"&&y.anonymousOnReject&&A()})}return}e.client.capture("$pageview",{...he(e),...h===void 0?{}:{$referrer:h},...E})},_,v=()=>{let h=_;_=void 0,h?.()},S=h=>{if(location.href===a)return;let E=a;if(a=location.href,!i||!rt(E,a,i))return;let y=c;m(),r.stop();let A=new Date(u);c=location.href,u=Date.now(),r=_e(l),p.reset();let M={$navigation_type:h,$prev_pageview_pathname:Ze(y),$prev_pageview_duration:Math.round((u-A.getTime())/100)/10};ye(e)?setTimeout(()=>f(y,M),0):(v(),_=()=>f(y,M),queueMicrotask(v))};e.onUnload(m);let D=tt(e)?fe(e,et):void 0;if(D?(_=()=>f(),e.onUnload(v),D.then(v)):f(),!i)return()=>(r.stop(),p.stop());let{pushState:U,replaceState:X}=history;history.pushState=function(...h){v(),U.apply(this,h),S("pushState")},history.replaceState=function(...h){v(),X.apply(this,h),S("replaceState")};let F=()=>S("popstate"),q=()=>S("hashchange");return window.addEventListener("popstate",F),i.hash&&window.addEventListener("hashchange",q),()=>{window.removeEventListener("hashchange",q),history.pushState=U,history.replaceState=X,window.removeEventListener("popstate",F),r.stop(),p.stop()}}var Wt=e=>{let t=[],n=e.config.autocapture,o=!1;if(n!==!1){let l=typeof n=="object"?n:{},c=()=>!o&&!(l.urlIgnorelist?.length&&H(l.urlIgnorelist));t.push(te(e,l,c),oe(e,l,c),le(e,l,c),G(e,l,c),K(e,l,c),ce(e,l,c),ge(e)),n===void 0&&e.loadConfig().then(a=>o=a?.autocapture===!1)}let s=e.config.capturePageview??"history",i=e.config.capturePageleave??"if_capture_pageview";return s!==!1&&i!==!1?t.push(L(e,s)):s!==!1?t.push(L(e,s,{leave:!1})):i===!0&&t.push(L(e,"history",{views:!1})),()=>t.forEach(l=>l())};export{ie as DOWNLOAD_EXTENSIONS,B as MASKED,ae as SEARCH_PARAMS,w as attrProps,Wt as autocapture,k as buildChain,x as chainToString,J as cssSelector,z as isStepper,re as maskCopied,P as mediaSrc,W as readSnapshot,me as snapshotRules,Ue as tag404};
1
+ var ve=(e,t)=>()=>(e&&(t=e(e=0)),t);function Ke(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function j(e,t){return!!e?.some(n=>{try{return new RegExp(Ke(n),"i").test(t)}catch{return!1}})}var pe=ve(()=>{"use strict"});var be='[data-lc-region="article"]';function K(e,t,n){if(t.articles===!1)return()=>{};let o;e.loadConfig().then(f=>{typeof f?.article_selector=="string"&&(o=f.article_selector)});let s=()=>{for(let f of[t.articleSelector,o,be])if(f)try{let _=document.querySelector(f);if(_)return _}catch{}return null},i=location.href,l=location.pathname,c=null,a=0,u=!1,r=()=>{if(c??=s(),!c)return;let f=c.getBoundingClientRect();if(f.height<=0)return;let _=Math.round(Math.min(100,Math.max(0,(window.innerHeight-f.top)/f.height*100)));a=Math.max(a,_);let v=c.querySelector("h1,h2");v&&v.getBoundingClientRect().bottom<0&&(u=!0)},p=()=>{!c||!n()||(r(),e.client.capture("$article_read",{$article_id:(c.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||l,$article_depth:a,$article_finished:a>=90,$article_headline_exit:!u&&a<25}),c=null)},d=()=>{p(),c=null,a=0,u=!1,i=location.href,l=location.pathname},m=()=>location.href!==i?d():r(),g=new MutationObserver(m);return g.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",m,{passive:!0}),e.onUnload(p),r(),()=>{g.disconnect(),window.removeEventListener("scroll",m)}}var T="data-lc-content",Ee="data-lc-content-piece",we="data-lc-content-target";var O=(e,t)=>(e.getAttribute(t)??"").trim().slice(0,200);function G(e,t,n){if(t.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let o=new WeakSet,s=r=>{let p={$content_name:O(r,T)},d=O(r,Ee),m=O(r,we);return d&&(p.$content_piece=d),m&&(p.$content_target=m),p},i=location.href,l=new IntersectionObserver(r=>{for(let p of r)!p.isIntersecting||o.has(p.target)||!n()||(o.add(p.target),e.client.capture("$content_impression",s(p.target)))},{threshold:.5}),c=r=>r.querySelectorAll(`[${T}]`).forEach(p=>l.observe(p));c(document);let a=new MutationObserver(()=>{location.href!==i&&(i=location.href,l.disconnect(),document.querySelectorAll(`[${T}]`).forEach(r=>o.delete(r))),c(document)});a.observe(document.documentElement,{childList:!0,subtree:!0});let u=r=>{let p=r.target?.closest?.(`[${T}]`);p&&n()&&e.client.capture("$content_interaction",{...s(p),$content_interaction_type:"click"})};return document.addEventListener("click",u,!0),()=>{l.disconnect(),a.disconnect(),document.removeEventListener("click",u,!0)}}var ke=new Set(["input","textarea","select","option"]),xe=["name","type","role","aria-label","title","alt","placeholder"],Re=/(?:\d[ -]?){9,}/;function Ce(e){if(ke.has(e.tagName.toLowerCase())||e.isContentEditable)return;let t="";for(let n of Array.from(e.childNodes))n.nodeType===3&&(t+=n.textContent??"");if(t=t.replace(/\s+/g," ").trim(),!(!t||Re.test(t)))return t.slice(0,255)}function Y(e){if(!e?.length)return()=>!1;let t=e.map(n=>n.toLowerCase());return n=>t.some(o=>o.endsWith("*")?n.startsWith(o.slice(0,-1)):n===o)}var B="***";function w(e){let t={};for(let n=e,o=0;n&&o<10;n=n.parentElement,o++)for(let s of Array.from(n.attributes)){let i=s.name.startsWith("data-lc-attr-")?s.name.slice(13):"";i&&!(i in t)&&!i.startsWith("$")&&(t[i]=s.value.slice(0,255))}return t}function Se(e,t,n,o){let s=e.parentElement,i=s?Array.from(s.children):[e],l={tag_name:e.tagName.toLowerCase(),nth_child:i.indexOf(e)+1,nth_of_type:i.filter(r=>r.tagName===e.tagName).indexOf(e)+1},c=(e.getAttribute("class")??"").split(/\s+/).filter(Boolean);c.length&&!n("class")&&(l.classes=c),e.id&&!n("id")&&(l.attr__id=o("id",e.id));let a=e.getAttribute("href");a&&!n("href")&&(l.href=o("href",a.slice(0,1024)));let u={};for(let r of Array.from(e.attributes))(r.name.startsWith("data-lc-")||xe.includes(r.name))&&!n(r.name)&&(u[r.name]=o(r.name,r.value.slice(0,255)));if(Object.keys(u).length&&(l.attrs=u),t){let r=Ce(e);r&&(l.text=r)}return l}function k(e,t,n,o,s={}){let i=[],l=Y(o),c=Y(s.allow),a=s.maskAll?(r,p)=>c(r)?p:B:(r,p)=>p,u=t;for(let r=e;r&&i.length<10;r=r.parentElement)i.push(Se(r,u,l,a)),(r===n||!n)&&(u=!1);return i}var $=e=>e.replace(/(["\\])/g,"\\$1");function x(e){return e.map(t=>{let n=t.tag_name+(t.classes?"."+t.classes.join("."):"")+":";t.attr__id&&(n+=`attr__id="${$(t.attr__id)}"`),t.href&&(n+=`href="${$(t.href)}"`),t.text&&(n+=`text="${$(t.text)}"`);for(let[o,s]of Object.entries(t.attrs??{}))n+=`attr__${o}="${$(s)}"`;return n+`nth-child="${t.nth_child}"nth-of-type="${t.nth_of_type}"`}).join(";")}var b=[],Ae=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,Me=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,Te=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,$e="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function z(e,t=[]){if(t.length&&e.closest(t.join(","))||e.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=e.closest($e)??e,o=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(Ae.test((n.textContent??"").trim())||Me.test(o))return!0;for(let s=n,i=0;s&&i<3;s=s.parentElement,i++)if(Te.test(s.getAttribute("class")??""))return!0;return!1}var Le=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function V(e,t=Date.now(),n={},o){if(o&&n.ignoreSelectors?.length&&o.closest(n.ignoreSelectors.join(",")))return{};if(o&&n.suppressSteppers!==!1&&z(o,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&Le())return{};let s=n.windowMs??1e3,i=n.radiusPx??30;for(b.length&&t<b[b.length-1].t&&(b.length=0),b.push({t,x:e.clientX,y:e.clientY});b.length&&t-b[0].t>s;)b.shift();let l=b.filter(c=>Math.hypot(c.x-e.clientX,c.y-e.clientY)<=i).length;return l>=(n.count??3)?{$rageclick:!0,$rageclick_count:l}:{}}function Q(e,t,n=700){if(typeof MutationObserver>"u")return;let o=!1,s=new MutationObserver(()=>o=!0);s.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let i=()=>{o=!0};window.addEventListener("scroll",i,{capture:!0,passive:!0}),document.addEventListener("selectionchange",i);let l=()=>{s.disconnect(),window.removeEventListener("scroll",i,{capture:!0}),document.removeEventListener("selectionchange",i)},c=setTimeout(()=>{l(),!o&&document.visibilityState!=="hidden"&&e.client.capture("$deadclick_hint",{$selector:t,$no_mutation_ms:n})},n);e.onUnload(()=>{clearTimeout(c),l()})}var Z=/^[A-Za-z_][\w-]*$/,Oe=5;function J(e){let t=[];for(let n=e;n&&t.length<Oe;n=n.parentElement){let o=n.tagName.toLowerCase();if(n.id&&Z.test(n.id)){t.unshift(`${o}#${n.id}`);break}let s=(n.getAttribute("class")??"").split(/\s+/).filter(i=>Z.test(i)).slice(0,2);t.unshift(o+s.map(i=>`.${i}`).join(""))}return t.join(" ")}function ee(e,t,n,o,s={}){let i={$selector:J(n),$el_interactive:o};(t.clientX||t.clientY||t.detail)&&(i.$click_x=Math.round(t.clientX+(window.scrollX||0)),i.$click_y=Math.round(t.clientY+(window.scrollY||0))),s.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(i,V(t,Date.now(),s.rageClicks||{},n));let l=s.deadClicks;!o&&t.isTrusted&&l!==!1&&!(l?.ignoreSelectors?.length&&n.closest(l.ignoreSelectors.join(",")))&&Q(e,i.$selector,l?.waitMs);for(let c of e.clickExtras)Object.assign(i,c(t,n));return i}var He="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",Ie="[data-lc-ignore]",H=e=>e.some(t=>typeof t=="string"?location.href.includes(t):t.test(location.href)),Pe=e=>!e?.length||H(e),I=e=>({maskAll:e.maskAllAttributes,allow:e.attributeAllowlist}),R=(e,t)=>!!e.closest(Ie)||!!(t.denySelectors?.length&&e.closest(t.denySelectors.join(",")));function te(e,t,n){let o=t.events??["click","change","submit"],s=0,i=a=>{let u=a.target;!n()||a.isComposing||!(u instanceof Element)||R(u,t)||u instanceof HTMLInputElement&&u.type==="password"||(s+=1)},l=a=>u=>{if(!n())return;let r=u.target;if(!(r instanceof Element)||R(r,t)||t.allowSelectors?.length&&!r.closest(t.allowSelectors.join(","))||t.elementAllowlist?.length&&!r.closest(t.elementAllowlist.join(","))||!Pe(t.urlAllowlist)||a==="change"&&!/^(input|select|textarea)$/i.test(r.tagName)||r instanceof HTMLInputElement&&r.type==="password")return;let p=r.closest(He);if(a==="click"&&!p&&!t.allowSelectors?.length)return;let d=k(r,t.captureText??!0,p??void 0,t.attributeIgnore,I(t)),m=d.find(f=>f.text)?.text,g=s;s=0,e.client.capture("$autocapture",{...w(r),$event_type:a,...g>0?{$keystroke_count:g}:{},$elements:d,$elements_chain:x(d),...m?{$el_text:m}:{},...a==="click"?ee(e,u,r,!!p,t):{}})};e.autocaptureClicks=o.includes("click");let c=o.map(a=>[a,l(a)]);for(let[a,u]of c)document.addEventListener(a,u,!0);return document.addEventListener("keydown",i,!0),()=>{for(let[a,u]of c)document.removeEventListener(a,u,!0);document.removeEventListener("keydown",i,!0)}}var je='[contenteditable]:not([contenteditable="false"])',ne="input,textarea,select",Ne=255;function re(e){return e.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,Ne)}var We=e=>e?e instanceof Element?e:e.parentElement:null;function oe(e,t,n){let o=t.events??["click","change","submit"],s=t.contentEditable!==!1&&o.includes("change"),i=new WeakSet,l=p=>{let d=k(p,!1,p,t.attributeIgnore,I(t));return{...w(p),$elements:d,$elements_chain:x(d)}},c=p=>{let d=p instanceof Element?p.closest(je):null;return d&&!R(d,t)?d:null},a=p=>{let d=n()?c(p.target):null;d&&i.add(d)},u=p=>{let d=c(p.target);!d||!i.has(d)||p.relatedTarget instanceof Node&&d.contains(p.relatedTarget)||(i.delete(d),n()&&e.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...l(d)}))},r=p=>{if(!n()||!t.copyCut)return;let d=typeof getSelection=="function"?getSelection():null,m=p.target instanceof Element?p.target:null,g=We(d?.anchorNode)??m;if(!g||R(g,t)||g.closest(ne)||m?.closest(ne))return;let f=t.captureCopiedText?re(d?.toString()??""):"";e.client.capture("$copy_autocapture",{$copy_type:p.type,...l(g),...f?{$selected_content:f}:{}})};return s&&(document.addEventListener("input",a,!0),document.addEventListener("focusout",u,!0)),document.addEventListener("copy",r,!0),document.addEventListener("cut",r,!0),()=>{document.removeEventListener("input",a,!0),document.removeEventListener("focusout",u,!0),document.removeEventListener("copy",r,!0),document.removeEventListener("cut",r,!0)}}var De="[data-lc-ignore]",ie=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],ae=["q","s","search","query"],se=e=>e.origin+e.pathname;function le(e,t,n){let o=Array.isArray(t.fileDownloads)?t.fileDownloads.map(i=>i.toLowerCase()):ie,s=[];if(t.outboundLinks!==!1||t.fileDownloads!==!1){let i=l=>{let c=l.target instanceof Element?l.target.closest("a[href]"):null;if(!c||!n()||c.closest(De))return;let a;try{a=new URL(c.href,location.href)}catch{return}if(a.protocol!=="http:"&&a.protocol!=="https:")return;let u=decodeURIComponent(a.pathname.split("/").pop()??""),r=u.includes(".")?u.split(".").pop().toLowerCase():"";t.fileDownloads!==!1&&(c.hasAttribute("download")||o.includes(r))?e.client.capture("$file_download",{$url:se(a),$file_name:u,$file_extension:r}):t.outboundLinks!==!1&&a.host!==location.host&&e.client.capture("$outbound_click",{$url:se(a),$outbound_host:a.host})};document.addEventListener("click",i,!0),s.push(()=>document.removeEventListener("click",i,!0))}if(t.siteSearch!==!1){let i=typeof t.siteSearch=="object"&&t.siteSearch.params?t.siteSearch.params:ae,l=!0;s.push(()=>{l=!1}),e.onCapture(c=>{if(!l||c.event!=="$pageview"||!n())return;let a=new URLSearchParams(location.search);for(let u of i){let r=a.get(u)?.trim();if(r)return void e.client.capture("$site_search",{$search_term:r.slice(0,200),$search_param:u})}})}return()=>s.forEach(i=>i())}function Ue(e,t={}){e.capture("$page_not_found",{$status:404,...t})}var Xe=[25,50,75],Fe="data-lc-media-title";function P(e){let t=e.currentSrc||e.src;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return"";try{let n=new URL(t,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var qe=e=>(e.getAttribute(Fe)??e.getAttribute("title")??e.getAttribute("aria-label")??"").trim().slice(0,200);function ce(e,t,n){if(t.media===!1)return()=>{};let o=new WeakMap,s=a=>{let u={$media_type:a instanceof HTMLVideoElement?"video":"audio",$media_src:P(a)},r=qe(a);return r&&(u.$media_title=r),Number.isFinite(a.duration)&&(u.$media_duration=Math.round(a.duration)),u},i=a=>{let u=P(a);if(!u)return null;let r=o.get(a);return(!r||r.src!==u)&&o.set(a,r={src:u,played:!1,reached:new Set,done:!1}),r},l=a=>{let u=a.target;if(!(u instanceof HTMLMediaElement)||!n())return;let r=i(u);if(r)if(a.type==="play"){if(r.done&&Object.assign(r,{played:!1,reached:new Set,done:!1}),r.played)return;r.played=!0,e.client.capture("$media_play",s(u))}else if(a.type==="timeupdate"){if(!r.played||r.done||!Number.isFinite(u.duration)||u.duration<=0)return;let p=u.currentTime/u.duration*100;for(let d of Xe)p>=d&&!r.reached.has(d)&&(r.reached.add(d),e.client.capture("$media_progress",{...s(u),$media_progress:d}))}else a.type==="ended"&&r.played&&!r.done&&(r.done=!0,e.client.capture("$media_complete",s(u)))},c=["play","timeupdate","ended"];return c.forEach(a=>document.addEventListener(a,l,!0)),()=>c.forEach(a=>document.removeEventListener(a,l,!0))}function ue(e=()=>performance.now()){let t=()=>document.visibilityState!=="hidden",n=0,o=t()?e():null,s=()=>{t()?o===null&&(o=e()):(o!==null&&(n+=e()-o),o=null)};return document.addEventListener("visibilitychange",s),{read:()=>Math.round(n+(o===null?0:e()-o)),reset:()=>{n=0,o=t()?e():null},stop:()=>document.removeEventListener("visibilitychange",s)}}pe();var de=255,Ge=new Set(["input","textarea","select","option"]),Ye="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Be=new Set(["value","password","autocomplete"]),ze=/(?:\d[ -]?){9,}/,C=new WeakMap,N=new WeakMap;function fe(e,t){let n=N.get(e);if(n)return new Promise(o=>{let s=setTimeout(o,t);n.then(()=>(clearTimeout(s),o()))})}function me(e){return Array.isArray(e)?e.filter(t=>{if(!t||typeof t!="object")return!1;let n=t;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 Ve(e){if(!e||Ge.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(Ye)}catch{return!1}}function Qe(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||Be.has(o)||o.startsWith("on"))return;let s=t.getAttribute(o);return s===null?void 0:s.slice(0,de)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||ze.test(n)))return n.slice(0,de)}function W(e,t,n,o=location.href){let s={};for(let i of e){if(!i.events.includes(t)||i.url&&!j([i.url],o))continue;let l=null;try{l=i.scope==="target"?t==="click"&&n?n.closest(i.selector):null:document.querySelector(i.selector)}catch{continue}if(!Ve(l))continue;let c=Qe(i,l);c!==void 0&&(s[i.name]=c)}return s}function ge(e){let t=!0,n=e.loadConfig().then(o=>{t&&C.set(e,me(o?.snapshot_properties)),N.delete(e)});return N.set(e,n),e.clickExtras.push((o,s)=>t?W(C.get(e)??[],"click",s):{}),()=>{t=!1,C.delete(e)}}function he(e){let t=C.get(e);return t?.length?W(t,"pageview"):{}}function ye(e){return!!C.get(e)?.some(t=>t.events.includes("pageview"))}var Ze=e=>{try{return new URL(e).pathname}catch{return e}};function Je(e){for(let t of e===void 0?[]:Array.isArray(e)?e:[e])try{let n=document.querySelector(t);if(n)return n}catch{}}function _e(e){let t=0,n=0,o=()=>{let s=Je(e),i=document.documentElement,l=s?s.scrollHeight:Math.max(i.scrollHeight,document.body?.scrollHeight??0),c=s?s.scrollTop:window.scrollY||window.pageYOffset||0,a=Math.min(l,c+(s?s.clientHeight:window.innerHeight));a>t&&(t=a,n=l>0?Math.min(100,Math.round(a/l*100)):0)};return o(),window.addEventListener("scroll",o,{passive:!0,capture:!0}),window.addEventListener("resize",o,{passive:!0}),{read:()=>({pct:n,px:t}),stop:()=>{window.removeEventListener("scroll",o,{capture:!0}),window.removeEventListener("resize",o)}}}var et=800,tt=e=>e.core.hasConsent("analytics")||e.core.consent.resolving;function nt(e){return e==="history"?{path:!0,search:!0}:e==="hash"?{path:!0,search:!0,hash:!0}:typeof e=="object"?e:void 0}function rt(e,t,n){try{let o=new URL(e),s=new URL(t);return!!(n.path&&o.pathname!==s.pathname||n.search&&o.search!==s.search||n.hash&&o.hash!==s.hash)}catch{return e!==t}}function L(e,t,n={}){let o=n.views??!0,s=n.leave??!0,i=nt(t),l=e.config.scrollRoot,c=location.href,a=c,u=Date.now(),r=_e(l),p=ue(),d,m=()=>{if(!s||d===c)return;d=c;let{pct:h,px:E}=r.read();e.client.capture("$pageleave",{$current_url:c,$scroll_depth:h,$scroll_depth_px:E,$engagement_time_ms:p.read()})},g=!1,f=(h,E={})=>{if(!o)return;let{core:y}=e;if(!y.hasConsent("analytics")&&!y.anonymousOnReject&&!(y.consent.pending&&y.consent.queueBeforeConsent)){if(!g){g=!0;let A=()=>{g&&(g=!1,f())};e.whenConsented(A),y.onChange(M=>{M==="consent"&&y.anonymousOnReject&&A()})}return}e.client.capture("$pageview",{...he(e),...h===void 0?{}:{$referrer:h},...E})},_,v=()=>{let h=_;_=void 0,h?.()},S=h=>{if(location.href===a)return;let E=a;if(a=location.href,!i||!rt(E,a,i))return;let y=c;m(),r.stop();let A=new Date(u);c=location.href,u=Date.now(),r=_e(l),p.reset();let M={$navigation_type:h,$prev_pageview_pathname:Ze(y),$prev_pageview_duration:Math.round((u-A.getTime())/100)/10};ye(e)?setTimeout(()=>f(y,M),0):(v(),_=()=>f(y,M),queueMicrotask(v))};e.onUnload(m);let D=tt(e)?fe(e,et):void 0;if(D?(_=()=>f(),e.onUnload(v),D.then(v)):f(),!i)return()=>(r.stop(),p.stop());let{pushState:U,replaceState:X}=history;history.pushState=function(...h){v(),U.apply(this,h),S("pushState")},history.replaceState=function(...h){v(),X.apply(this,h),S("replaceState")};let F=()=>S("popstate"),q=()=>S("hashchange");return window.addEventListener("popstate",F),i.hash&&window.addEventListener("hashchange",q),()=>{window.removeEventListener("hashchange",q),history.pushState=U,history.replaceState=X,window.removeEventListener("popstate",F),r.stop(),p.stop()}}var Wt=e=>{let t=[],n=e.config.autocapture,o=!1;if(n!==!1){let l=typeof n=="object"?n:{},c=()=>!o&&!(l.urlIgnorelist?.length&&H(l.urlIgnorelist));t.push(te(e,l,c),oe(e,l,c),le(e,l,c),G(e,l,c),K(e,l,c),ce(e,l,c),ge(e)),n===void 0&&e.loadConfig().then(a=>o=a?.autocapture===!1)}let s=e.config.capturePageview??"history",i=e.config.capturePageleave??"if_capture_pageview";return s!==!1&&i!==!1?t.push(L(e,s)):s!==!1?t.push(L(e,s,{leave:!1})):i===!0&&t.push(L(e,"history",{views:!1})),()=>t.forEach(l=>l())};export{ie as DOWNLOAD_EXTENSIONS,B as MASKED,ae as SEARCH_PARAMS,w as attrProps,Wt as autocapture,k as buildChain,x as chainToString,J as cssSelector,z as isStepper,re as maskCopied,P as mediaSrc,W as readSnapshot,me as snapshotRules,Ue as tag404};
@@ -1 +1 @@
1
- import{b as A}from"./chunk-32K5P5GN.js";import"./chunk-O4W7SZ2X.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
1
+ import{b as A}from"./chunk-536QABLP.js";import"./chunk-EFNCQJI3.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-O4W7SZ2X.js";var r="$consent_updated";function l(e,s,a,n={}){let c=JSON.stringify(e.core.getConsent());e.client.setConsent(s);let t=e.core.getConsent();if(n.onlyIfChanged&&JSON.stringify(t)===c)return;let o={categories:t,source:a,version:n.version??e.config.consent?.policyVersion??"1"};if(e.core.hasConsent("analytics"))e.client.capture(r,o);else if(e.config.consent?.logBeacon&&!e.config.disabled){let p=JSON.stringify({api_key:e.apiKey,batch:[{uuid:i(Date.now()),event:r,timestamp:new Date().toISOString(),properties:{...o,$lib:"lucida-browser"}}],sent_at:new Date().toISOString()});e.fetch(`${e.config.apiHost}/v1/batch`,{method:"POST",body:p,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{})}}export{r as a,l as b};
1
+ import{a as i}from"./chunk-EFNCQJI3.js";var r="$consent_updated";function l(e,s,a,n={}){let c=JSON.stringify(e.core.getConsent());e.client.setConsent(s);let t=e.core.getConsent();if(n.onlyIfChanged&&JSON.stringify(t)===c)return;let o={categories:t,source:a,version:n.version??e.config.consent?.policyVersion??"1"};if(e.core.hasConsent("analytics"))e.client.capture(r,o);else if(e.config.consent?.logBeacon&&!e.config.disabled){let p=JSON.stringify({api_key:e.apiKey,batch:[{uuid:i(Date.now()),event:r,timestamp:new Date().toISOString(),properties:{...o,$lib:"lucida-browser"}}],sent_at:new Date().toISOString()});e.fetch(`${e.config.apiHost}/v1/batch`,{method:"POST",body:p,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{})}}export{r as a,l as b};
@@ -1 +1 @@
1
- var d=0,m=0;function x(e){let n=new Uint8Array(e),t=globalThis.crypto;if(t?.getRandomValues)t.getRandomValues(n);else for(let r=0;r<e;r++)n[r]=Math.floor(Math.random()*256);return n}function O(e=Date.now()){if(e>d){d=e;let s=x(2);m=((s[0]??0)<<8|(s[1]??0))&1023}else m++,m>4095&&(d++,m=0);let n=x(8),t=new Uint8Array(16),r=d;t[0]=Math.floor(r/2**40)&255,t[1]=Math.floor(r/2**32)&255,t[2]=Math.floor(r/2**24)&255,t[3]=Math.floor(r/2**16)&255,t[4]=Math.floor(r/2**8)&255,t[5]=r&255,t[6]=112|m>>8,t[7]=m&255,t[8]=128|(n[0]??0)&63;for(let s=1;s<8;s++)t[8+s]=n[s]??0;let o=Array.from(t,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)}`}function R(e,n={}){let t=Math.min(n.maxMs??3e4,(n.baseMs??1e3)*2**e);return Math.round(t*(.5+.5*(n.random??Math.random)()))}function w(e){return e===0||e===408||e===429||e>=500}var M=/^(0|[1-9]\d{0,2})$/,T=/^[0-9a-fA-F]{1,4}$/,V=/^(0|[1-9]\d*)$/;function h(e){let n=e.split(".");if(n.length!==4)return;let t=[];for(let r of n){if(!M.test(r)||Number(r)>255)return;t.push(Number(r))}return t}function N(e){if(e.includes("%"))return;let n=e,t=e.lastIndexOf(":"),r=e.slice(t+1);if(r.includes(".")){let f=h(r);if(!f)return;n=`${e.slice(0,t+1)}${(f[0]<<8|f[1]).toString(16)}:${(f[2]<<8|f[3]).toString(16)}`}let o=n.split("::");if(o.length>2)return;let s=f=>{if(f==="")return[];let c=[];for(let _ of f.split(":")){if(!T.test(_))return;c.push(parseInt(_,16))}return c},i=s(o[0]),a=o.length===2?s(o[1]):[];if(!i||!a)return;let u=i.length+a.length;return(o.length===2?u>7:u!==8)?void 0:[...i,...Array(8-u).fill(0),...a].flatMap(f=>[f>>8,f&255])}function S(e){return e.includes(":")?N(e):h(e)}var j=e=>e.length===16&&e.slice(0,10).every(n=>n===0)&&e[10]===255&&e[11]===255;function k(e){if(typeof e!="string")return;let n=S(e.trim());return n&&j(n)?n.slice(12):n}function q(e){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],t=[];for(let r of n){if(typeof r!="string")continue;let o=r.trim(),s=o.indexOf("/");if(s<0){let u=k(o);u&&t.push({bytes:u,bits:u.length*8});continue}let i=S(o.slice(0,s)),a=o.slice(s+1);!i||!V.test(a)||Number(a)>i.length*8||t.push({bytes:i,bits:Number(a)})}return t}function I(e,n){if(e.bytes.length!==n.length)return!1;for(let t=0;t<e.bits;t+=8){let o=255<<8-Math.min(8,e.bits-t)&255,s=t/8;if((e.bytes[s]&o)!==(n[s]&o))return!1}return!0}function v(e,n,t,r){switch(e){case"array_contains_any":case"array_contains_all":case"array_contains_none":{if(!Array.isArray(n)||!Array.isArray(t))return!1;let o=t.filter(s=>n.some(i=>r(i,s))).length;return e==="array_contains_any"?o>0:e==="array_contains_all"?o===t.length:o===0}case"ip_in_cidr":case"ip_not_in_cidr":{let o=k(n),s=q(t);return!o||!s.length?!1:s.some(i=>I(i,o))===(e==="ip_in_cidr")}}return!1}var P=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,A=/^\d{4}-\d{2}-\d{2}$/,$=/^-?(\d{1,6})([hdwmy])$/,H={h:3600,d:86400,w:604800,m:2592e3,y:31536e3};function D(e){let n=$.exec(e.trim());return n?Number(n[1])*H[n[2]]:void 0}function E(e,n,t){if(typeof e=="number")return e*1e3;if(typeof e!="string")return;let r=e.trim();if(t){let s=D(r);if(s!==void 0)return n-s*1e3}if(!P.test(r)&&!A.test(r))return;let o=Date.parse(A.test(r)?`${r}T00:00:00Z`:r);return Number.isNaN(o)?void 0:o}function F(e,n){for(let t=0;t<Math.max(e.length,n.length);t++){let r=e[t]??0,o=n[t]??0;if(r!==o)return r<o?-1:1}return 0}function L(e,n,t){if(typeof n!="string")return;let r=n.trim().replace(/^v/,"").split(".");if(e==="semver_wildcard"){let l=r[r.length-1];if(l!=="*"&&l!=="x"&&l!=="X")return;if(r.length===1)return[[0],[2**30]];let f=t.parseVersion(r.slice(0,-1).join("."));if(!f)return;let c=[...f];return c[c.length-1]=c[c.length-1]+1,[f,c]}let o=t.parseVersion(n);if(!o)return;for(;o.length<3;)o.push(0);let[s,i,a]=o,u;return e==="semver_tilde"&&r.length===1?u=[s+1,0,0]:e==="semver_tilde"||s===0&&i>0?u=[s,i+1,0]:s>0?u=[s+1,0,0]:u=[0,0,a+1],[o,u]}function C(e,n,t,r,o){switch(e){case"icontains":case"not_icontains":case"starts_with":case"not_starts_with":case"ends_with":case"not_ends_with":return typeof n!="string"||typeof t!="string"?!1:e.endsWith("icontains")?n.toLowerCase().includes(t.toLowerCase())===(e==="icontains"):e.endsWith("starts_with")?n.startsWith(t)===(e==="starts_with"):n.endsWith(t)===(e==="ends_with");case"between":case"not_between":{let s=o.toFloat(n);if(!Array.isArray(t)||t.length!==2||s===void 0)return!1;let[i,a]=t;return typeof i!="number"||typeof a!="number"?!1:(s>=i&&s<=a)==(e==="between")}case"is_date_before":case"is_date_after":{let s=E(n,r,!1),i=E(t,r,!0);return s===void 0||i===void 0?!1:e==="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(n,t);if(s===void 0)return!1;let i=e.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(n),i=L(e,t,o);return!!s&&!!i&&F(s,i[0])>=0&&F(s,i[1])<0}}return!1}var B=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function g(e){if(typeof e=="number")return e;if(typeof e=="string"&&B.test(e.trim()))return Number(e.trim())}function p(e,n){let t=typeof e=="number",r=typeof n=="number";return t||r?t&&r&&e===n:e===n}function y(e){if(typeof e!="string")return;let n=e.trim().replace(/^v/,""),t=n.search(/[-+]/);t>=0&&(n=n.slice(0,t));let r=[];for(let o of n.split(".")){if(!/^[+-]?\d+$/.test(o))return;let s=parseInt(o,10);if(s<0)return;r.push(s)}return r}function b(e,n){let t=y(e),r=y(n);if(!(!t||!r)){for(let o=0;o<Math.max(t.length,r.length);o++){let s=t[o]??0,i=r[o]??0;if(s!==i)return s<i?-1:1}return 0}}var G=(e,n)=>e<n?-1:e>n?1:0;function W(e,n,t,r,o,s=Date.now()){let i=t&&n!==null&&n!==void 0;if(e==="is_set")return i;if(e==="is_not_set")return!i;if(!i)return!1;switch(e){case"eq":case"neq":{let a;if(o){let u=b(n,r);if(u===void 0)return!1;a=u===0}else a=p(n,r);return a===(e==="eq")}case"contains":case"ncontains":case"regex":case"nregex":{if(typeof n!="string"||typeof r!="string")return!1;if(e==="contains"||e==="ncontains")return n.includes(r)===(e==="contains");let a;try{a=new RegExp(r)}catch{return!1}return a.test(n)===(e==="regex")}case"gt":case"gte":case"lt":case"lte":{let a;if(o)a=b(n,r);else{let u=g(n),l=g(r);a=u===void 0||l===void 0?void 0:G(u,l)}return a===void 0?!1:e==="gt"?a>0:e==="gte"?a>=0:e==="lt"?a<0:a<=0}case"in":case"not_in":return Array.isArray(r)?r.some(a=>p(n,a))===(e==="in"):!1}return e.startsWith("array_")||e.startsWith("ip_")?v(e,n,r,p):C(e,n,r,s,{toFloat:g,parseVersion:y,cmpVersion:b})}export{O as a,R as b,w as c,W as d};
1
+ var d=0,m=0;function x(e){let n=new Uint8Array(e),t=globalThis.crypto;if(t?.getRandomValues)t.getRandomValues(n);else for(let r=0;r<e;r++)n[r]=Math.floor(Math.random()*256);return n}function O(e=Date.now()){if(e>d){d=e;let s=x(2);m=((s[0]??0)<<8|(s[1]??0))&1023}else m++,m>4095&&(d++,m=0);let n=x(8),t=new Uint8Array(16),r=d;t[0]=Math.floor(r/2**40)&255,t[1]=Math.floor(r/2**32)&255,t[2]=Math.floor(r/2**24)&255,t[3]=Math.floor(r/2**16)&255,t[4]=Math.floor(r/2**8)&255,t[5]=r&255,t[6]=112|m>>8,t[7]=m&255,t[8]=128|(n[0]??0)&63;for(let s=1;s<8;s++)t[8+s]=n[s]??0;let o=Array.from(t,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)}`}function R(e,n={}){let t=Math.min(n.maxMs??3e4,(n.baseMs??1e3)*2**e);return Math.round(t*(.5+.5*(n.random??Math.random)()))}function w(e){return e===0||e===408||e===429||e>=500}var M=/^(0|[1-9]\d{0,2})$/,T=/^[0-9a-fA-F]{1,4}$/,V=/^(0|[1-9]\d*)$/;function h(e){let n=e.split(".");if(n.length!==4)return;let t=[];for(let r of n){if(!M.test(r)||Number(r)>255)return;t.push(Number(r))}return t}function N(e){if(e.includes("%"))return;let n=e,t=e.lastIndexOf(":"),r=e.slice(t+1);if(r.includes(".")){let f=h(r);if(!f)return;n=`${e.slice(0,t+1)}${(f[0]<<8|f[1]).toString(16)}:${(f[2]<<8|f[3]).toString(16)}`}let o=n.split("::");if(o.length>2)return;let s=f=>{if(f==="")return[];let c=[];for(let _ of f.split(":")){if(!T.test(_))return;c.push(parseInt(_,16))}return c},i=s(o[0]),a=o.length===2?s(o[1]):[];if(!i||!a)return;let u=i.length+a.length;return(o.length===2?u>7:u!==8)?void 0:[...i,...Array(8-u).fill(0),...a].flatMap(f=>[f>>8,f&255])}function S(e){return e.includes(":")?N(e):h(e)}var j=e=>e.length===16&&e.slice(0,10).every(n=>n===0)&&e[10]===255&&e[11]===255;function k(e){if(typeof e!="string")return;let n=S(e.trim());return n&&j(n)?n.slice(12):n}function q(e){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],t=[];for(let r of n){if(typeof r!="string")continue;let o=r.trim(),s=o.indexOf("/");if(s<0){let u=k(o);u&&t.push({bytes:u,bits:u.length*8});continue}let i=S(o.slice(0,s)),a=o.slice(s+1);!i||!V.test(a)||Number(a)>i.length*8||t.push({bytes:i,bits:Number(a)})}return t}function I(e,n){if(e.bytes.length!==n.length)return!1;for(let t=0;t<e.bits;t+=8){let o=255<<8-Math.min(8,e.bits-t)&255,s=t/8;if((e.bytes[s]&o)!==(n[s]&o))return!1}return!0}function v(e,n,t,r){switch(e){case"array_contains_any":case"array_contains_all":case"array_contains_none":{if(!Array.isArray(n)||!Array.isArray(t))return!1;let o=t.filter(s=>n.some(i=>r(i,s))).length;return e==="array_contains_any"?o>0:e==="array_contains_all"?o===t.length:o===0}case"ip_in_cidr":case"ip_not_in_cidr":{let o=k(n),s=q(t);return!o||!s.length?!1:s.some(i=>I(i,o))===(e==="ip_in_cidr")}}return!1}var P=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,A=/^\d{4}-\d{2}-\d{2}$/,$=/^-?(\d{1,6})([hdwmy])$/,D={h:3600,d:86400,w:604800,m:2592e3,y:31536e3};function H(e){let n=$.exec(e.trim());return n?Number(n[1])*D[n[2]]:void 0}function E(e,n,t){if(typeof e=="number")return e*1e3;if(typeof e!="string")return;let r=e.trim();if(t){let s=H(r);if(s!==void 0)return n-s*1e3}if(!P.test(r)&&!A.test(r))return;let o=Date.parse(A.test(r)?`${r}T00:00:00Z`:r);return Number.isNaN(o)?void 0:o}function C(e,n){for(let t=0;t<Math.max(e.length,n.length);t++){let r=e[t]??0,o=n[t]??0;if(r!==o)return r<o?-1:1}return 0}function L(e,n,t){if(typeof n!="string")return;let r=n.trim().replace(/^v/,"").split(".");if(e==="semver_wildcard"){let l=r[r.length-1];if(l!=="*"&&l!=="x"&&l!=="X")return;if(r.length===1)return[[0],[2**30]];let f=t.parseVersion(r.slice(0,-1).join("."));if(!f)return;let c=[...f];return c[c.length-1]=c[c.length-1]+1,[f,c]}let o=t.parseVersion(n);if(!o)return;for(;o.length<3;)o.push(0);let[s,i,a]=o,u;return e==="semver_tilde"&&r.length===1?u=[s+1,0,0]:e==="semver_tilde"||s===0&&i>0?u=[s,i+1,0]:s>0?u=[s+1,0,0]:u=[0,0,a+1],[o,u]}function F(e,n,t,r,o){switch(e){case"icontains":case"not_icontains":case"starts_with":case"not_starts_with":case"ends_with":case"not_ends_with":return typeof n!="string"||typeof t!="string"?!1:e.endsWith("icontains")?n.toLowerCase().includes(t.toLowerCase())===(e==="icontains"):e.endsWith("starts_with")?n.startsWith(t)===(e==="starts_with"):n.endsWith(t)===(e==="ends_with");case"between":case"not_between":{let s=o.toFloat(n);if(!Array.isArray(t)||t.length!==2||s===void 0)return!1;let[i,a]=t;return typeof i!="number"||typeof a!="number"?!1:(s>=i&&s<=a)==(e==="between")}case"is_date_before":case"is_date_after":{let s=E(n,r,!1),i=E(t,r,!0);return s===void 0||i===void 0?!1:e==="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(n,t);if(s===void 0)return!1;let i=e.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(n),i=L(e,t,o);return!!s&&!!i&&C(s,i[0])>=0&&C(s,i[1])<0}}return!1}var B=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function g(e){if(typeof e=="number")return e;if(typeof e=="string"&&B.test(e.trim()))return Number(e.trim())}function p(e,n){let t=typeof e=="number",r=typeof n=="number";return t||r?t&&r&&e===n:e===n}function y(e){if(typeof e!="string")return;let n=e.trim().replace(/^v/,""),t=n.search(/[-+]/);t>=0&&(n=n.slice(0,t));let r=[];for(let o of n.split(".")){if(!/^[+-]?\d+$/.test(o))return;let s=parseInt(o,10);if(s<0)return;r.push(s)}return r}function b(e,n){let t=y(e),r=y(n);if(!(!t||!r)){for(let o=0;o<Math.max(t.length,r.length);o++){let s=t[o]??0,i=r[o]??0;if(s!==i)return s<i?-1:1}return 0}}var G=(e,n)=>e<n?-1:e>n?1:0;function W(e,n,t,r,o,s=Date.now()){let i=t&&n!==null&&n!==void 0;if(e==="is_set")return i;if(e==="is_not_set")return!i;if(!i)return!1;switch(e){case"eq":case"neq":{let a;if(o){let u=b(n,r);if(u===void 0)return!1;a=u===0}else a=p(n,r);return a===(e==="eq")}case"contains":case"ncontains":case"regex":case"nregex":{if(typeof n!="string"||typeof r!="string")return!1;if(e==="contains"||e==="ncontains")return n.includes(r)===(e==="contains");let a;try{a=new RegExp(r)}catch{return!1}return a.test(n)===(e==="regex")}case"gt":case"gte":case"lt":case"lte":{let a;if(o)a=b(n,r);else{let u=g(n),l=g(r);a=u===void 0||l===void 0?void 0:G(u,l)}return a===void 0?!1:e==="gt"?a>0:e==="gte"?a>=0:e==="lt"?a<0:a<=0}case"in":case"not_in":return Array.isArray(r)?r.some(a=>p(n,a))===(e==="in"):!1}return e.startsWith("array_")||e.startsWith("ip_")?v(e,n,r,p):F(e,n,r,s,{toFloat:g,parseVersion:y,cmpVersion:b})}export{O as a,R as b,w as c,W as d};
@@ -0,0 +1 @@
1
+ import{d as m}from"./chunk-EFNCQJI3.js";function d(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function k(e,t){return!!e?.some(r=>{try{return new RegExp(d(r),"i").test(t)}catch{return!1}})}function w(e,t){return e===!1||!e&&!t?null:{fps:f(e?e.fps??2:2,1,15),quality:f(e?e.quality??.4:.4,.05,1)}}var f=(e,t,r)=>Math.min(r,Math.max(t,e)),T=1e7;function G(e,t){if(t?.session_recording===!1)return null;let r=t?.replay??{},s=(o,i)=>e[o]??r[o]??i,a=[...r.mask_selectors??[],...t?.replay_mask_selectors??[],...e.mask_selectors??[]];return{sample_rate:e.sample_rate??r.sample_rate??t?.replay_sample_rate??1,min_duration_ms:e.min_duration_ms??r.min_duration_ms??t?.replay_min_duration_ms??0,min_duration_mode:e.min_duration_mode??r.min_duration_mode??t?.replay_min_duration_mode??"buffer",trigger:s("trigger",{mode:"always"}),trigger_groups:e.trigger_groups??r.trigger_groups??t?.replay_trigger_groups??[],include_urls:s("include_urls",[]),exclude_urls:[...s("exclude_urls",[]),...(t?.replay_url_blocklist??[]).map(d)],block_selectors:[...r.block_selectors??[],...t?.replay_block_selectors??[],...e.block_selectors??[]],mask_selectors:a,mask_all_inputs:e.mask_all_inputs??(t?.mask_all_inputs===!0||r.mask_all_inputs!==!1),mask_all_text:e.mask_all_text===!0||t?.replay_mask_all_text===!0||r.mask_all_text===!0||a.includes("*"),unmask_selectors:[...e.unmask_selectors??[]],url_privacy_rules:[...Array.isArray(t?.replay_url_privacy_rules)?t?.replay_url_privacy_rules:[],...e.url_privacy_rules??[]],buffer_ms:s("buffer_ms",6e4),flush_interval_ms:s("flush_interval_ms",5e3),idle_threshold_ms:Math.max(0,s("idle_threshold_ms",5*6e4)),chunk_bytes:Math.min(s("chunk_bytes",256*1024),T-16384),canvas:w(e.captureCanvas,t?.replay_capture_canvas===!0),maskInputOptions:e.maskInputOptions,maskInputFn:e.maskInputFn,maskTextFn:e.maskTextFn,maskUrlFn:e.maskUrlFn,crossOriginIframes:e.crossOriginIframes?.allowedOrigins.length?[...e.crossOriginIframes.allowedOrigins]:null,canvasMaskRegions:e.canvasMaskRegions,canvasMask:(Array.isArray(t?.replay_canvas_mask)?t.replay_canvas_mask:[]).filter(o=>typeof o?.selector=="string"),mutationThrottle:e.mutationThrottle===!1?null:{...e.mutationThrottle},assets:e.assets,console:e.console===!0,network:e.network?e.network:null}}var _=(e,t)=>{let r=t;try{let s=new URL(t,"http://x");r=s.pathname+s.search}catch{}return e.some(s=>{try{let a=new RegExp(s);return a.test(t)||a.test(r)}catch{return!1}})};function I(e,t,r){return!_(r,e)&&(!t.length||_(t,e))}function E(e){return e==="watchtower"?!1:e?!0:globalThis.__WATCHTOWER__?.replayActive!==!0}function C(e){let t=2166136261;for(let r of new TextEncoder().encode(e))t^=r,t=Math.imul(t,16777619)>>>0;return t>>>0}function O(e,t,r){return C(`${e}:${t}`)/4294967296<r}var M=(e,t)=>{let r=t[e.key];return e.variant===void 0?r!==void 0&&r!==!1&&r!=="false":r===e.variant},v=e=>!!e.events?.length||!!e.event_filters?.length;function A(e,t,r){return e.events?.includes(t)?!0:!!e.event_filters?.some(s=>s.event===t&&(s.properties??[]).every(a=>m(a.op,r?.[a.key],!!r&&Object.hasOwn(r,a.key),a.value,!1)))}var F=(e,t)=>e.flatMap(r=>{try{return[new RegExp(r)]}catch{return t("bad url pattern",r),[]}});function y(e){let t=[];return e.urls.length&&t.push(e.url),v(e.g)&&t.push(e.event),e.g.flag&&t.push(e.flag),t.length?e.g.match==="all"?t.every(Boolean):t.some(Boolean):!0}function U(e,t,r,s,a={}){let o=t.map(n=>({g:n,urls:F(n.url_patterns??[],e.log),url:!!a.url,event:!!a.event,flag:!!a.flag})),i=!1,c=!1,p=()=>{if(!(i||c)){for(let n of o)if(y(n)&&(a.sampling||O(r(),n.g.id,n.g.sample_rate??1))){i=!0,s(n.g);return}}};e.onCapture(n=>{let u=!1;for(let l of o)!l.event&&A(l.g,n.event,n.properties)&&(u=l.event=!0);u&&p()});let h=n=>{let u=!1;for(let l of o)l.g.flag&&!l.flag&&M(l.g.flag,n)&&(u=l.flag=!0);u&&p()},x=e.flags?.onChange(h),g=(n,u)=>o.some(n)?o.some(l=>n(l)&&u(l))?"activated":"pending":"disabled";return{checkUrl(n){let u=!1;for(let l of o)!l.url&&l.urls.some(R=>R.test(n))&&(u=l.url=!0);u&&p()},check:p,stop(){c=!0,x?.()},matched:()=>o.filter(y).map(n=>n.g.id),states:()=>({url:g(n=>n.urls.length>0,n=>n.url),event:g(n=>v(n.g),n=>n.event),flag:g(n=>!!n.g.flag,n=>n.flag)})}}var b=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[];function H(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.url=="string").map(t=>({url:t.url,mask_all_text:t.mask_all_text===!0,mask_selectors:b(t.mask_selectors),block_selectors:b(t.block_selectors)})):[]}function K(e,t){let r=e.filter(i=>k([i.url],t)),s=r.some(i=>i.mask_all_text===!0),a=[...new Set(r.flatMap(i=>i.mask_selectors??[]))],o=[...new Set(r.flatMap(i=>i.block_selectors??[]))];return{maskAllText:s,mask:a,block:o,key:JSON.stringify([s,a,o])}}export{k as a,T as b,G as c,I as d,E as e,C as f,O as g,U as h,H as i,K as j};
@@ -1,6 +1,6 @@
1
- import { B as BrowserConfig, M as Module, C as Client } from './types-XbAgeGjz.js';
1
+ import { d as BrowserConfig, M as Module, e as Client } from './types-Dng5ldZO.js';
2
2
 
3
- declare const LIB_VERSION = "0.1.3";
3
+ declare const LIB_VERSION = "0.1.5";
4
4
  declare const DEFAULT_HOST = "https://capture.lucidace.com";
5
5
  /** Build a client from the shared core plus the given modules (pass none for the smallest bundle). */
6
6
  declare function createClient(apiKey: string, config?: BrowserConfig, modules?: Module[]): Client;
package/dist/consent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Module, H as Host, C as ConsentSource } from './types-Bgl5v0MP.js';
2
- export { B as BannerOptions, a as BannerPosition, b as BannerTexts, c as ConsentUi } from './types-Bgl5v0MP.js';
1
+ import { M as Module, H as Host, C as ConsentSource } from './types-Dng5ldZO.js';
2
+ export { B as BannerOptions, a as BannerPosition, b as BannerTexts, c as ConsentUi } from './types-Dng5ldZO.js';
3
3
  import { ConsentState } from '@lucida-analytics/sdk-core';
4
4
 
5
5
  type Update = {
@@ -92,4 +92,10 @@ declare function applyConsent(host: Host, update: Partial<ConsentState>, source:
92
92
  onlyIfChanged?: boolean;
93
93
  }): void;
94
94
 
95
- export { CONSENT_EVENT, ConsentSource, type UcService, applyConsent, consentBanner, cookieMunchConsent, cookieMunchToConsent, cookiebotConsent, cookiebotToConsent, gcmConsent, gcmToConsent, oneTrustConsent, oneTrustToConsent, osanoConsent, osanoToConsent, tcfConsent, tcfToConsent, usercentricsBridge, usercentricsConsent, usercentricsToConsent };
95
+ /**
96
+ * What the classic script's `modules: ["consent"]` loads: the banner API (`client.consent.showBanner()`) and the
97
+ * Cookie Munch follower, so a page behind Cookie Munch needs no wiring (a no-op when `window.CookieMunch` is absent).
98
+ */
99
+ declare const consentModule: Module;
100
+
101
+ export { CONSENT_EVENT, ConsentSource, type UcService, applyConsent, consentBanner, consentModule, cookieMunchConsent, cookieMunchToConsent, cookiebotConsent, cookiebotToConsent, gcmConsent, gcmToConsent, oneTrustConsent, oneTrustToConsent, osanoConsent, osanoToConsent, tcfConsent, tcfToConsent, usercentricsBridge, usercentricsConsent, usercentricsToConsent };
package/dist/consent.js CHANGED
@@ -1 +1 @@
1
- import{a as b,b as i}from"./chunk-32K5P5GN.js";import"./chunk-O4W7SZ2X.js";function l(e){if(e.gdprApplies===!1)return;let n=e.purpose?.consents??{},t=!!n[1]&&!!n[7];return{analytics:t,replay:t&&!!n[8],marketing:!!n[1]&&!!n[4]}}function C(e){let n=a=>a in e?e[a]==="granted":void 0,t={},r=n("analytics_storage");r!==void 0&&(t.analytics=t.replay=r);let o=n("ad_storage"),s=n("ad_user_data");return o!==void 0&&(t.marketing=o&&s!==!1),t}function g(e){let n=typeof e=="string"?e.split(","):e,t=n.includes("C0002");return{analytics:t,replay:t,marketing:n.includes("C0004")}}function m(e){return{analytics:!!e.statistics,replay:!!e.statistics,marketing:!!e.marketing}}function v(e){return{analytics:!!e.statistics,replay:!!e.statistics,marketing:!!e.marketing}}var h=e=>{let n,r=u(()=>{let o=window.__tcfapi;return typeof o!="function"?!1:(o("addEventListener",2,(s,a)=>{if(!a||s.eventStatus!=="tcloaded"&&s.eventStatus!=="useractioncomplete")return;n=s.listenerId;let c=l(s);c&&i(e,c,"tcf",{onlyIfChanged:!0})}),!0)});return()=>{r();let o=window.__tcfapi;n!==void 0&&typeof o=="function"&&o("removeEventListener",2,()=>{},n)}},T=e=>{let n=window,t=n.dataLayer??=[],r=s=>{let a=s;a&&typeof a=="object"&&a[0]==="consent"&&(a[1]==="default"||a[1]==="update")&&a[2]&&typeof a[2]=="object"&&i(e,C(a[2]),"gcm",{onlyIfChanged:!0})};t.forEach(r);let o=t.push;return t.push=function(...s){return s.forEach(r),o.apply(this,s)},()=>{t.push=o}},E=e=>{let n=o=>{(typeof o=="string"||Array.isArray(o))&&i(e,g(o),"onetrust",{onlyIfChanged:!0})},t=window,r=o=>n(o.detail??t.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",r),n(t.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",r)},O=e=>{let n=window,t=()=>{let o=n.Cookiebot;o?.consent&&o.hasResponse!==!1&&i(e,m(o.consent),"cookiebot",{onlyIfChanged:!0})},r=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let o of r)window.addEventListener(o,t);return t(),()=>r.forEach(o=>window.removeEventListener(o,t))};function y(e){let n=e.ANALYTICS==="ACCEPT";return{analytics:n,replay:n,marketing:e.MARKETING==="ACCEPT"}}function u(e){if(e())return()=>{};let n=0,t=setInterval(()=>(e()||++n>40)&&clearInterval(t),250);return()=>clearInterval(t)}var d=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],U=e=>{let n,t=o=>{let s=o&&typeof o=="object"&&Object.keys(o).length?o:n?.getConsent?.();s&&Object.keys(s).length&&i(e,y(s),"osano",{onlyIfChanged:!0})},r=u(()=>{if(n=window.Osano?.cm,!n)return!1;for(let o of d)n.addEventListener?.(o,t);return t(n.getConsent?.()),!0});return()=>{r();for(let o of d)n?.removeEventListener?.(o,t)}};function w(e,n="Lucida"){let t=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!t)return;let r=t.consent?.status===!0,o=e.filter(s=>s.categorySlug==="marketing");return{analytics:r,replay:r,marketing:o.length>0&&o.every(s=>s.consent?.status===!0)}}var f=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function k(e="Lucida"){return n=>{let t=()=>{let a=window.UC_UI?.getServicesBaseInfo?.();if(!a)return!1;let c=w(a,e);return c?i(n,c,"usercentrics",{onlyIfChanged:!0}):n.log(`usercentrics: no service named "${e}"; consent left unchanged`),!0},r=()=>{t()};for(let s of f)window.addEventListener(s,r);let o=u(t);return()=>{o();for(let s of f)window.removeEventListener(s,r)}}}var I=k(),p=["CookieMunchOnConsentReady","CookieMunchOnChange"],_=e=>{let n=()=>{let t=window.CookieMunch;t?.consent&&t.hasResponse===!0&&i(e,v(t.consent),"cookiemunch",{onlyIfChanged:!0})};for(let t of p)window.addEventListener(t,n);return n(),()=>p.forEach(t=>window.removeEventListener(t,n))};var x=e=>{e.consentUi={showBanner:async n=>(await import("./banner-2TSKJ4WK.js")).showBanner(e,n),hideBanner:()=>{import("./banner-2TSKJ4WK.js").then(n=>n.hideBanner())}}};export{b as CONSENT_EVENT,i as applyConsent,x as consentBanner,_ as cookieMunchConsent,v as cookieMunchToConsent,O as cookiebotConsent,m as cookiebotToConsent,T as gcmConsent,C as gcmToConsent,E as oneTrustConsent,g as oneTrustToConsent,U as osanoConsent,y as osanoToConsent,h as tcfConsent,l as tcfToConsent,k as usercentricsBridge,I as usercentricsConsent,w as usercentricsToConsent};
1
+ import{a as T,b as a}from"./chunk-536QABLP.js";import"./chunk-EFNCQJI3.js";function C(e){if(e.gdprApplies===!1)return;let n=e.purpose?.consents??{},t=!!n[1]&&!!n[7];return{analytics:t,replay:t&&!!n[8],marketing:!!n[1]&&!!n[4]}}function m(e){let n=i=>i in e?e[i]==="granted":void 0,t={},r=n("analytics_storage");r!==void 0&&(t.analytics=t.replay=r);let o=n("ad_storage"),s=n("ad_user_data");return o!==void 0&&(t.marketing=o&&s!==!1),t}function g(e){let n=typeof e=="string"?e.split(","):e,t=n.includes("C0002");return{analytics:t,replay:t,marketing:n.includes("C0004")}}function y(e){return{analytics:!!e.statistics,replay:!!e.statistics,marketing:!!e.marketing}}function v(e){return{analytics:!!e.statistics,replay:!!e.statistics,marketing:!!e.marketing}}var E=e=>{let n,r=u(()=>{let o=window.__tcfapi;return typeof o!="function"?!1:(o("addEventListener",2,(s,i)=>{if(!i||s.eventStatus!=="tcloaded"&&s.eventStatus!=="useractioncomplete")return;n=s.listenerId;let c=C(s);c&&a(e,c,"tcf",{onlyIfChanged:!0})}),!0)});return()=>{r();let o=window.__tcfapi;n!==void 0&&typeof o=="function"&&o("removeEventListener",2,()=>{},n)}},O=e=>{let n=window,t=n.dataLayer??=[],r=s=>{let i=s;i&&typeof i=="object"&&i[0]==="consent"&&(i[1]==="default"||i[1]==="update")&&i[2]&&typeof i[2]=="object"&&a(e,m(i[2]),"gcm",{onlyIfChanged:!0})};t.forEach(r);let o=t.push;return t.push=function(...s){return s.forEach(r),o.apply(this,s)},()=>{t.push=o}},M=e=>{let n=o=>{(typeof o=="string"||Array.isArray(o))&&a(e,g(o),"onetrust",{onlyIfChanged:!0})},t=window,r=o=>n(o.detail??t.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",r),n(t.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",r)},U=e=>{let n=window,t=()=>{let o=n.Cookiebot;o?.consent&&o.hasResponse!==!1&&a(e,y(o.consent),"cookiebot",{onlyIfChanged:!0})},r=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let o of r)window.addEventListener(o,t);return t(),()=>r.forEach(o=>window.removeEventListener(o,t))};function w(e){let n=e.ANALYTICS==="ACCEPT";return{analytics:n,replay:n,marketing:e.MARKETING==="ACCEPT"}}function u(e){if(e())return()=>{};let n=0,t=setInterval(()=>(e()||++n>40)&&clearInterval(t),250);return()=>clearInterval(t)}var p=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],I=e=>{let n,t=o=>{let s=o&&typeof o=="object"&&Object.keys(o).length?o:n?.getConsent?.();s&&Object.keys(s).length&&a(e,w(s),"osano",{onlyIfChanged:!0})},r=u(()=>{if(n=window.Osano?.cm,!n)return!1;for(let o of p)n.addEventListener?.(o,t);return t(n.getConsent?.()),!0});return()=>{r();for(let o of p)n?.removeEventListener?.(o,t)}};function k(e,n="Lucida"){let t=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!t)return;let r=t.consent?.status===!0,o=e.filter(s=>s.categorySlug==="marketing");return{analytics:r,replay:r,marketing:o.length>0&&o.every(s=>s.consent?.status===!0)}}var f=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function b(e="Lucida"){return n=>{let t=()=>{let i=window.UC_UI?.getServicesBaseInfo?.();if(!i)return!1;let c=k(i,e);return c?a(n,c,"usercentrics",{onlyIfChanged:!0}):n.log(`usercentrics: no service named "${e}"; consent left unchanged`),!0},r=()=>{t()};for(let s of f)window.addEventListener(s,r);let o=u(t);return()=>{o();for(let s of f)window.removeEventListener(s,r)}}}var x=b(),l=["CookieMunchOnConsentReady","CookieMunchOnChange"],d=e=>{let n=()=>{let t=window.CookieMunch;t?.consent&&t.hasResponse===!0&&a(e,v(t.consent),"cookiemunch",{onlyIfChanged:!0})};for(let t of l)window.addEventListener(t,n);return n(),()=>l.forEach(t=>window.removeEventListener(t,n))};var h=e=>{e.consentUi={showBanner:async n=>(await import("./banner-7LEREYUH.js")).showBanner(e,n),hideBanner:()=>{import("./banner-7LEREYUH.js").then(n=>n.hideBanner())}}};var N=e=>(h(e),d(e));export{T as CONSENT_EVENT,a as applyConsent,h as consentBanner,N as consentModule,d as cookieMunchConsent,v as cookieMunchToConsent,U as cookiebotConsent,y as cookiebotToConsent,O as gcmConsent,m as gcmToConsent,M as oneTrustConsent,g as oneTrustToConsent,I as osanoConsent,w as osanoToConsent,E as tcfConsent,C as tcfToConsent,b as usercentricsBridge,x as usercentricsConsent,k as usercentricsToConsent};
package/dist/core.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { B as BrowserConfig, C as Client } from './types-XbAgeGjz.js';
2
- export { F as FlagValue, H as Host, M as Module, P as Persistence } from './types-XbAgeGjz.js';
3
- export { c as createClient } from './client-DkIhkh91.js';
1
+ import { d as BrowserConfig, e as Client } from './types-Dng5ldZO.js';
2
+ export { F as FlagValue, H as Host, M as Module, P as Persistence } from './types-Dng5ldZO.js';
3
+ export { c as createClient } from './client-DZX6o-eI.js';
4
4
  import '@lucida-analytics/sdk-core';
5
5
 
6
6
  /** Core-only client: capture, identity, sessions, consent, transport. No autocapture, no flags. */